diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-15 10:46:15 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2018-06-18 12:27:01 +0000 |
| commit | f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 (patch) | |
| tree | 7c6044fd3a17a2665841959dac9b3b2110b27924 /src/ui/widget | |
| parent | Run clang-tidy’s modernize-use-override pass. (diff) | |
| download | inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.tar.gz inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.zip | |
Run clang-tidy’s modernize-use-nullptr pass.
This replaces all NULL or 0 with nullptr when assigned to or returned as
a pointer.
Diffstat (limited to 'src/ui/widget')
45 files changed, 227 insertions, 227 deletions
diff --git a/src/ui/widget/attr-widget.h b/src/ui/widget/attr-widget.h index e54116a67..8dbff8874 100644 --- a/src/ui/widget/attr-widget.h +++ b/src/ui/widget/attr-widget.h @@ -157,7 +157,7 @@ protected: const gchar* val = o->getRepr()->attribute(name); return val; } - return 0; + return nullptr; } private: diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index eceff13ca..509e218a9 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -30,9 +30,9 @@ ClipMaskIcon::ClipMaskIcon() : _pixMaskName(INKSCAPE_ICON("path-difference")), _pixBothName(INKSCAPE_ICON("bitmap-trace")), _property_active(*this, "active", 0), - _property_pixbuf_clip(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_mask(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_both(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_clip(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_mask(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_both(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; @@ -46,7 +46,7 @@ ClipMaskIcon::ClipMaskIcon() : _property_pixbuf_mask = icon_theme->load_icon(_pixMaskName, phys, (Gtk::IconLookupFlags)0); _property_pixbuf_both = icon_theme->load_icon(_pixBothName, phys, (Gtk::IconLookupFlags)0); - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); } void ClipMaskIcon::get_preferred_height_vfunc(Gtk::Widget& widget, @@ -97,7 +97,7 @@ void ClipMaskIcon::render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, property_pixbuf() = _property_pixbuf_both; break; default: - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); break; } Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); diff --git a/src/ui/widget/color-entry.cpp b/src/ui/widget/color-entry.cpp index f5658c3a6..b766dc9ed 100644 --- a/src/ui/widget/color-entry.cpp +++ b/src/ui/widget/color-entry.cpp @@ -61,7 +61,7 @@ void ColorEntry::on_changed() } gchar *str = g_strdup(text.c_str()); - gchar *end = 0; + gchar *end = nullptr; guint64 rgba = g_ascii_strtoull(str, &end, 16); if (end != str) { ptrdiff_t len = end - str; diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index c6f5b799f..bd1cfde1b 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -209,21 +209,21 @@ class ComponentUI { public: ComponentUI() : _component() - , _adj(0) - , _slider(0) - , _btn(0) - , _label(0) - , _map(0) + , _adj(nullptr) + , _slider(nullptr) + , _btn(nullptr) + , _label(nullptr) + , _map(nullptr) { } ComponentUI(colorspace::Component const &component) : _component(component) - , _adj(0) - , _slider(0) - , _btn(0) - , _label(0) - , _map(0) + , _adj(nullptr) + , _slider(nullptr) + , _btn(nullptr) + , _label(nullptr) + , _map(nullptr) { } @@ -290,7 +290,7 @@ class ColorICCSelectorImpl { const gchar *ColorICCSelector::MODE_NAME = N_("CMS"); ColorICCSelector::ColorICCSelector(SelectedColor &color) - : _impl(NULL) + : _impl(nullptr) { _impl = new ColorICCSelectorImpl(this, color); init(); @@ -302,7 +302,7 @@ ColorICCSelector::~ColorICCSelector() { if (_impl) { delete _impl; - _impl = 0; + _impl = nullptr; } } @@ -314,16 +314,16 @@ ColorICCSelectorImpl::ColorICCSelectorImpl(ColorICCSelector *owner, SelectedColo , _updating(FALSE) , _dragging(FALSE) , _fixupNeeded(0) - , _fixupBtn(0) - , _profileSel(0) + , _fixupBtn(nullptr) + , _profileSel(nullptr) , _compUI() - , _adj(0) - , _slider(0) - , _sbtn(0) - , _label(0) + , _adj(nullptr) + , _slider(nullptr) + , _sbtn(nullptr) + , _label(nullptr) #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) , _profileName() - , _prof(0) + , _prof(nullptr) , _profChannelCount(0) , _profChangedID(0) #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -332,9 +332,9 @@ ColorICCSelectorImpl::ColorICCSelectorImpl(ColorICCSelector *owner, SelectedColo ColorICCSelectorImpl::~ColorICCSelectorImpl() { - _adj = 0; - _sbtn = 0; - _label = 0; + _adj = nullptr; + _sbtn = nullptr; + _label = nullptr; } void ColorICCSelector::init() @@ -524,7 +524,7 @@ void ColorICCSelectorImpl::_profileSelected(GtkWidget * /*src*/, gpointer data) GtkTreeIter iter; if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(self->_profileSel), &iter)) { GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(self->_profileSel)); - gchar *name = 0; + gchar *name = nullptr; gtk_tree_model_get(store, &iter, 1, &name, -1); self->_switchToProfile(name); @@ -615,9 +615,9 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) #endif // DEBUG_LCMS if (tmp.icc) { delete tmp.icc; - tmp.icc = 0; + tmp.icc = nullptr; dirty = true; - _fixupHit(0, this); + _fixupHit(nullptr, this); } else { #ifdef DEBUG_LCMS @@ -789,7 +789,7 @@ void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) // Need to clear out the prior one profChanged = true; _profileName.clear(); - _prof = 0; + _prof = nullptr; _profChannelCount = 0; } else if (profile && !_prof) { @@ -855,7 +855,7 @@ void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) } else { // Give up for now on named colors - _prof = 0; + _prof = nullptr; } } diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 308bb968e..5b0f12e51 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -88,7 +88,7 @@ ColorNotebook::~ColorNotebook() { if (_buttons) { delete[] _buttons; - _buttons = 0; + _buttons = nullptr; } } @@ -271,7 +271,7 @@ void ColorNotebook::_updateICCButtons() #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* update color management icon*/ - gtk_widget_set_sensitive(_box_colormanaged, color.icc != NULL); + gtk_widget_set_sensitive(_box_colormanaged, color.icc != nullptr); /* update out-of-gamut icon */ gtk_widget_set_sensitive(_box_outofgamut, false); @@ -330,7 +330,7 @@ void ColorNotebook::_addPage(Page &page) tab_label->set_name("ColorModeLabel"); gint page_num = gtk_notebook_append_page(GTK_NOTEBOOK(_book), selector_widget->gobj(), tab_label->gobj()); - _buttons[page_num] = gtk_radio_button_new_with_label(NULL, mode_name.c_str()); + _buttons[page_num] = gtk_radio_button_new_with_label(nullptr, mode_name.c_str()); gtk_widget_set_name(_buttons[page_num], "ColorModeButton"); gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(_buttons[page_num]), FALSE); if (page_num > 0) { diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index cb6349c4b..620e77cbf 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -51,10 +51,10 @@ ColorScales::ColorScales(SelectedColor &color, SPColorScalesMode mode) , _mode(SP_COLOR_SCALES_MODE_NONE) { for (gint i = 0; i < 5; i++) { - _l[i] = 0; - _a[i] = 0; - _s[i] = 0; - _b[i] = 0; + _l[i] = nullptr; + _a[i] = nullptr; + _s[i] = nullptr; + _b[i] = nullptr; } _initUI(mode); @@ -66,10 +66,10 @@ ColorScales::ColorScales(SelectedColor &color, SPColorScalesMode mode) ColorScales::~ColorScales() { for (gint i = 0; i < 5; i++) { - _l[i] = 0; - _a[i] = 0; - _s[i] = 0; - _b[i] = 0; + _l[i] = nullptr; + _a[i] = nullptr; + _s[i] = nullptr; + _b[i] = nullptr; } } @@ -283,7 +283,7 @@ void ColorScales::on_show() void ColorScales::_getRgbaFloatv(gfloat *rgba) { - g_return_if_fail(rgba != NULL); + g_return_if_fail(rgba != nullptr); switch (_mode) { case SP_COLOR_SCALES_MODE_RGB: @@ -314,7 +314,7 @@ void ColorScales::_getCmykaFloatv(gfloat *cmyka) { gfloat rgb[3]; - g_return_if_fail(cmyka != NULL); + g_return_if_fail(cmyka != nullptr); switch (_mode) { case SP_COLOR_SCALES_MODE_RGB: @@ -384,7 +384,7 @@ void ColorScales::setMode(SPColorScalesMode mode) gtk_label_set_markup_with_mnemonic(GTK_LABEL(_l[3]), _("_A:")); _s[3]->set_tooltip_text(_("Alpha (opacity)")); gtk_widget_set_tooltip_text(_b[3], _("Alpha (opacity)")); - _s[0]->setMap(NULL); + _s[0]->setMap(nullptr); gtk_widget_hide(_l[4]); _s[4]->hide(); gtk_widget_hide(_b[4]); @@ -485,7 +485,7 @@ void ColorScales::setMode(SPColorScalesMode mode) gtk_label_set_markup_with_mnemonic(GTK_LABEL(_l[4]), _("_A:")); _s[4]->set_tooltip_text(_("Alpha (opacity)")); gtk_widget_set_tooltip_text(_b[4], _("Alpha (opacity)")); - _s[0]->setMap(NULL); + _s[0]->setMap(nullptr); gtk_widget_show(_l[4]); _s[4]->show(); gtk_widget_show(_b[4]); @@ -704,7 +704,7 @@ void ColorScales::_updateSliders(guint channels) static const gchar *sp_color_scales_hue_map(void) { - static gchar *map = NULL; + static gchar *map = nullptr; if (!map) { gchar *p; diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index ed034598e..58a236e92 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -42,7 +42,7 @@ ColorSlider::ColorSlider(Glib::RefPtr<Gtk::Adjustment> adjustment) , _value(0.0) , _oldvalue(0.0) , _mapsize(0) - , _map(NULL) + , _map(nullptr) { _c0[0] = 0x00; _c0[1] = 0x00; @@ -170,10 +170,10 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) window, GDK_SEAT_CAPABILITY_ALL_POINTING, FALSE, - NULL, + nullptr, reinterpret_cast<GdkEvent *>(event), - NULL, - NULL); + nullptr, + nullptr); #else auto device = gdk_event_get_device(reinterpret_cast<GdkEvent *>(event)); gdk_device_grab(device, @@ -286,7 +286,7 @@ void ColorSlider::_onAdjustmentValueChanged() void ColorSlider::setColors(guint32 start, guint32 mid, guint32 end) { // Remove any map, if set - _map = 0; + _map = nullptr; _c0[0] = start >> 24; _c0[1] = (start >> 16) & 0xff; @@ -354,7 +354,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) const guchar *b = sp_color_slider_render_map(0, 0, carea.get_width(), carea.get_height(), _map, s, d, _b0, _b1, _bmask); - if (b != NULL && carea.get_width() > 0) { + if (b != nullptr && carea.get_width() > 0) { Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_data( b, Gdk::COLORSPACE_RGB, false, 8, carea.get_width(), carea.get_height(), carea.get_width() * 3); @@ -377,7 +377,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) const guchar *b = sp_color_slider_render_gradient(0, 0, wi, carea.get_height(), c, dc, _b0, _b1, _bmask); /* Draw pixelstore 1 */ - if (b != NULL && wi > 0) { + if (b != nullptr && wi > 0) { Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_data(b, Gdk::COLORSPACE_RGB, false, 8, wi, carea.get_height(), wi * 3); @@ -397,7 +397,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) _b0, _b1, _bmask); /* Draw pixelstore 2 */ - if (b != NULL && wi > 0) { + if (b != nullptr && wi > 0) { Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_data(b, Gdk::COLORSPACE_RGB, false, 8, wi, carea.get_height(), wi * 3); @@ -448,7 +448,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) static const guchar *sp_color_slider_render_gradient(gint x0, gint y0, gint width, gint height, gint c[], gint dc[], guint b0, guint b1, guint mask) { - static guchar *buf = NULL; + static guchar *buf = nullptr; static gint bs = 0; guchar *dp; gint x, y; @@ -456,7 +456,7 @@ static const guchar *sp_color_slider_render_gradient(gint x0, gint y0, gint widt if (buf && (bs < width * height)) { g_free(buf); - buf = NULL; + buf = nullptr; } if (!buf) { buf = g_new(guchar, width * height * 3); @@ -503,14 +503,14 @@ static const guchar *sp_color_slider_render_gradient(gint x0, gint y0, gint widt static const guchar *sp_color_slider_render_map(gint x0, gint y0, gint width, gint height, guchar *map, gint start, gint step, guint b0, guint b1, guint mask) { - static guchar *buf = NULL; + static guchar *buf = nullptr; static gint bs = 0; guchar *dp; gint x, y; if (buf && (bs < width * height)) { g_free(buf); - buf = NULL; + buf = nullptr; } if (!buf) { buf = g_new(guchar, width * height * 3); diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index ffdf173ba..b4b6e6e5c 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -28,8 +28,8 @@ ColorWheelSelector::ColorWheelSelector(SelectedColor &color) : Gtk::Grid() , _color(color) , _updating(false) - , _wheel(0) - , _slider(0) + , _wheel(nullptr) + , _slider(nullptr) { set_name("ColorWheelSelector"); @@ -40,7 +40,7 @@ ColorWheelSelector::ColorWheelSelector(SelectedColor &color) ColorWheelSelector::~ColorWheelSelector() { - _wheel = 0; + _wheel = nullptr; _color_changed_connection.disconnect(); _color_dragged_connection.disconnect(); diff --git a/src/ui/widget/combo-enums.h b/src/ui/widget/combo-enums.h index 6b69533d2..e06f5b610 100644 --- a/src/ui/widget/combo-enums.h +++ b/src/ui/widget/combo-enums.h @@ -114,7 +114,7 @@ public: Gtk::TreeModel::iterator i = this->get_active(); if(i) return (*i)[_columns.data]; - return 0; + return nullptr; } void add_row(const Glib::ustring& s) diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 29f22977a..7cd841d88 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -25,11 +25,11 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l _dock(dock), _prev_state(state), _prev_position(0), - _window(0), + _window(nullptr), _x(0), _y(0), _grab_focus_on_realize(false), - _gdl_dock_item(0) + _gdl_dock_item(nullptr) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GdlDockItemBehavior gdl_dock_behavior = @@ -437,8 +437,8 @@ DockItem::getWindow() { g_return_val_if_fail(_gdl_dock_item, 0); Gtk::Container *parent = getWidget().get_parent(); - parent = (parent ? parent->get_parent() : 0); - return (parent ? dynamic_cast<Gtk::Window *>(parent) : 0); + parent = (parent ? parent->get_parent() : nullptr); + return (parent ? dynamic_cast<Gtk::Window *>(parent) : nullptr); } const Glib::SignalProxyInfo diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index 9c1f0f783..7e90017e8 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -27,7 +27,7 @@ namespace { void hideCallback(GObject * /*object*/, gpointer dock_ptr) { - g_return_if_fail( dock_ptr != NULL ); + g_return_if_fail( dock_ptr != nullptr ); Dock *dock = static_cast<Dock *>(dock_ptr); dock->hide(); @@ -35,7 +35,7 @@ void hideCallback(GObject * /*object*/, gpointer dock_ptr) void unhideCallback(GObject * /*object*/, gpointer dock_ptr) { - g_return_if_fail( dock_ptr != NULL ); + g_return_if_fail( dock_ptr != nullptr ); Dock *dock = static_cast<Dock *>(dock_ptr); dock->show(); @@ -89,7 +89,7 @@ Dock::Dock(Gtk::Orientation orientation) static_cast<GdlSwitcherStyle>(prefs->getIntLimited("/options/dock/switcherstyle", GDL_SWITCHER_STYLE_BOTH, 0, 4)); - GdlDockMaster* master = NULL; + GdlDockMaster* master = nullptr; g_object_get(GDL_DOCK_OBJECT(_gdl_dock), "master", &master, @@ -139,7 +139,7 @@ Gtk::Paned *Dock::getParentPaned() { g_return_val_if_fail(_dock_box, 0); Gtk::Container *parent = getWidget().get_parent(); - return (parent != 0 ? dynamic_cast<Gtk::Paned *>(parent) : 0); + return (parent != nullptr ? dynamic_cast<Gtk::Paned *>(parent) : nullptr); } diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index 67412b1e0..48597842b 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -45,7 +45,7 @@ EntityEntry* EntityEntry::create (rdf_work_entity_t* ent, Registry& wr) { g_assert (ent); - EntityEntry* obj = 0; + EntityEntry* obj = nullptr; switch (ent->format) { case RDF_FORMAT_LINE: @@ -65,7 +65,7 @@ EntityEntry::create (rdf_work_entity_t* ent, Registry& wr) EntityEntry::EntityEntry (rdf_work_entity_t* ent, Registry& wr) : _label(Glib::ustring(_(ent->title)), Gtk::ALIGN_END), - _packable(0), + _packable(nullptr), _entity(ent), _wr(&wr) { } diff --git a/src/ui/widget/font-button.cpp b/src/ui/widget/font-button.cpp index ed57c803a..1137c2d95 100644 --- a/src/ui/widget/font-button.cpp +++ b/src/ui/widget/font-button.cpp @@ -27,20 +27,20 @@ FontButton::FontButton(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring FontButton::getValue() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<Gtk::FontButton*>(_widget)->get_font_name(); } void FontButton::setValue (Glib::ustring fontspec) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<Gtk::FontButton*>(_widget)->set_font_name(fontspec); } Glib::SignalProxy0<void> FontButton::signal_font_value_changed() { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<Gtk::FontButton*>(_widget)->signal_font_set(); } diff --git a/src/ui/widget/font-selector-toolbar.cpp b/src/ui/widget/font-selector-toolbar.cpp index 87dadf211..276b05cd8 100644 --- a/src/ui/widget/font-selector-toolbar.cpp +++ b/src/ui/widget/font-selector-toolbar.cpp @@ -263,7 +263,7 @@ FontSelectorToolbar::on_key_press_event (GdkEventKey* key_event) gdk_keymap_translate_keyboard_state( Gdk::Display::get_default()->get_keymap(), key_event->hardware_keycode, (GdkModifierType)key_event->state, - 0, &key, 0, 0, 0 ); + 0, &key, nullptr, nullptr, nullptr ); switch ( key ) { diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp index 8e7df7a68..5837c0842 100644 --- a/src/ui/widget/imageicon.cpp +++ b/src/ui/widget/imageicon.cpp @@ -86,8 +86,8 @@ void ImageIcon::init() // \FIXME Why? if (!Inkscape::Application::exists()) Inkscape::Application::create("", false); - document = NULL; - viewerGtkmm = NULL; + document = nullptr; + viewerGtkmm = nullptr; //set_size_request(150,150); showingBrokenImage = false; } diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index 38c84ca51..1200144f1 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -29,8 +29,8 @@ ImageToggler::ImageToggler( char const* on, char const* off) : _pixOffName(off), _property_active(*this, "active", false), _property_activatable(*this, "activatable", true), - _property_pixbuf_on(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_off(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_on(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_off(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp index 5d1f64a54..d402aca37 100644 --- a/src/ui/widget/insertordericon.cpp +++ b/src/ui/widget/insertordericon.cpp @@ -25,8 +25,8 @@ InsertOrderIcon::InsertOrderIcon() : _pixTopName(INKSCAPE_ICON("insert-top")), _pixBottomName(INKSCAPE_ICON("insert-bottom")), _property_active(*this, "active", 0), - _property_pixbuf_top(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_bottom(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_top(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_bottom(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; @@ -39,7 +39,7 @@ InsertOrderIcon::InsertOrderIcon() : _property_pixbuf_top = icon_theme->load_icon(_pixTopName, phys, (Gtk::IconLookupFlags)0); _property_pixbuf_bottom = icon_theme->load_icon(_pixBottomName, phys, (Gtk::IconLookupFlags)0); - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); } @@ -88,7 +88,7 @@ void InsertOrderIcon::render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, property_pixbuf() = _property_pixbuf_bottom; break; default: - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); break; } Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index 003b64d53..2e9840035 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -30,7 +30,7 @@ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip, _label(new Gtk::Label(label, Gtk::ALIGN_END, Gtk::ALIGN_CENTER, mnemonic)), _suffix(new Gtk::Label(suffix, Gtk::ALIGN_START)) { - g_assert(g_utf8_validate(icon.c_str(), -1, NULL)); + g_assert(g_utf8_validate(icon.c_str(), -1, nullptr)); if (icon != "") { _icon = Gtk::manage(new Gtk::Image()); _icon->set_from_icon_name(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR); diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index e0a52a868..b86222404 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -42,7 +42,7 @@ namespace { class AlternateIcons : public Gtk::HBox { public: AlternateIcons(Gtk::IconSize size, Glib::ustring const &a, Glib::ustring const &b) - : _a(NULL), _b(NULL) + : _a(nullptr), _b(nullptr) { set_name("AlternateIcons"); if (!a.empty()) { @@ -94,7 +94,7 @@ private: * selector is changed. */ LayerSelector::LayerSelector(SPDesktop *desktop) -: _desktop(NULL), _layer(NULL) +: _desktop(nullptr), _layer(nullptr) { set_name("LayerSelector"); AlternateIcons *label; @@ -159,7 +159,7 @@ LayerSelector::LayerSelector(SPDesktop *desktop) /** Destructor - disconnects signal handler */ LayerSelector::~LayerSelector() { - setDesktop(NULL); + setDesktop(nullptr); _selection_changed_connection.disconnect(); } @@ -258,8 +258,8 @@ void LayerSelector::_selectLayer(SPObject *layer) { SPObject *root=_desktop->currentRoot(); if (_layer) { - sp_object_unref(_layer, NULL); - _layer = NULL; + sp_object_unref(_layer, nullptr); + _layer = nullptr; } if (layer) { @@ -282,7 +282,7 @@ void LayerSelector::_selectLayer(SPObject *layer) { } _layer = layer; - sp_object_ref(_layer, NULL); + sp_object_ref(_layer, nullptr); } if ( !layer || layer == root ) { @@ -353,7 +353,7 @@ void LayerSelector::_buildSiblingEntries( auto siblings = parent.children | boost::adaptors::filtered(is_layer(_desktop)) | boost::adaptors::reversed; - SPObject *layer( hierarchy ? &*hierarchy : NULL ); + SPObject *layer( hierarchy ? &*hierarchy : nullptr ); for (auto& sib: siblings) { _buildEntry(depth, sib); @@ -435,7 +435,7 @@ void LayerSelector::_protectUpdate(sigc::slot<void> slot) { _lock_toggled_connection.block(true); slot(); - SPObject *layer = _desktop ? _desktop->currentLayer() : 0; + SPObject *layer = _desktop ? _desktop->currentLayer() : nullptr; if ( layer ) { bool wantedValue = ( SP_IS_ITEM(layer) ? SP_ITEM(layer)->isLocked() : false ); if ( _lock_toggle.get_active() != wantedValue ) { @@ -480,18 +480,18 @@ void LayerSelector::_buildEntry(unsigned depth, SPObject &object) { &node_added, &node_removed, &attribute_changed, - NULL, + nullptr, &node_reordered }; vector = new Inkscape::XML::NodeEventVector(events); } else { Inkscape::XML::NodeEventVector events = { - NULL, - NULL, + nullptr, + nullptr, &attribute_changed, - NULL, - NULL + nullptr, + nullptr }; vector = new Inkscape::XML::NodeEventVector(events); @@ -501,7 +501,7 @@ void LayerSelector::_buildEntry(unsigned depth, SPObject &object) { row->set_value(_model_columns.depth, depth); - sp_object_ref(&object, NULL); + sp_object_ref(&object, nullptr); row->set_value(_model_columns.object, &object); Inkscape::GC::anchor(object.getRepr()); @@ -519,7 +519,7 @@ void LayerSelector::_destroyEntry(Gtk::ListStore::iterator const &row) { Callbacks *callbacks=reinterpret_cast<Callbacks *>(row->get_value(_model_columns.callbacks)); SPObject *object=row->get_value(_model_columns.object); if (object) { - sp_object_unref(object, NULL); + sp_object_unref(object, nullptr); } Inkscape::XML::Node *repr=row->get_value(_model_columns.repr); if (repr) { @@ -543,8 +543,8 @@ void LayerSelector::_prepareLabelRenderer( // "invent" an iterator with null data and try to render it; // where does it come from, and how can we avoid it? if ( object && object->getRepr() ) { - SPObject *layer=( _desktop ? _desktop->currentLayer() : NULL ); - SPObject *root=( _desktop ? _desktop->currentRoot() : NULL ); + SPObject *layer=( _desktop ? _desktop->currentLayer() : nullptr ); + SPObject *root=( _desktop ? _desktop->currentRoot() : nullptr ); bool isancestor = !( (layer && (object->parent == layer->parent)) || ((layer == root) && (object->parent == root))); diff --git a/src/ui/widget/layer-selector.h b/src/ui/widget/layer-selector.h index 0b531231a..bcdc2548e 100644 --- a/src/ui/widget/layer-selector.h +++ b/src/ui/widget/layer-selector.h @@ -38,7 +38,7 @@ class DocumentTreeModel; class LayerSelector : public Gtk::HBox { public: - LayerSelector(SPDesktop *desktop = NULL); + LayerSelector(SPDesktop *desktop = nullptr); ~LayerSelector() override; SPDesktop *desktop() { return _desktop; } diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index 3a8ffab44..278bd317b 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -30,9 +30,9 @@ LayerTypeIcon::LayerTypeIcon() : _pixPathName(INKSCAPE_ICON("layer-rename")), _property_active(*this, "active", false), _property_activatable(*this, "activatable", true), - _property_pixbuf_layer(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_group(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_path(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_layer(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_group(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_path(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index c9d46bc66..a8325525b 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -37,10 +37,10 @@ namespace Widget { //=================================================== const struct rdf_license_t _proprietary_license = - {_("Proprietary"), "", 0}; + {_("Proprietary"), "", nullptr}; const struct rdf_license_t _other_license = - {Q_("MetadataLicence|Other"), "", 0}; + {Q_("MetadataLicence|Other"), "", nullptr}; class LicenseItem : public Gtk::RadioButton { public: @@ -67,7 +67,7 @@ void LicenseItem::on_toggled() _wr.setUpdating (true); SPDocument *doc = SP_ACTIVE_DOCUMENT; - rdf_set_license (doc, _lic->details ? _lic : 0); + rdf_set_license (doc, _lic->details ? _lic : nullptr); if (doc->priv->sensitive) { DocumentUndo::done(doc, SP_VERB_NONE, _("Document license updated")); } @@ -80,7 +80,7 @@ void LicenseItem::on_toggled() Licensor::Licensor() : Gtk::VBox(false,4), - _eentry (NULL) + _eentry (nullptr) { } @@ -97,7 +97,7 @@ void Licensor::init (Registry& wr) LicenseItem *i; wr.setUpdating (true); - i = Gtk::manage (new LicenseItem (&_proprietary_license, _eentry, wr, NULL)); + i = Gtk::manage (new LicenseItem (&_proprietary_license, _eentry, wr, nullptr)); Gtk::RadioButtonGroup group = i->get_group(); add (*i); LicenseItem *pd = i; diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 3677233bc..fc24ec7cd 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -52,7 +52,7 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co } ObjectCompositeSettings::~ObjectCompositeSettings() { - setSubject(NULL); + setSubject(nullptr); } void ObjectCompositeSettings::setSubject(StyleSubject *subject) { @@ -110,13 +110,13 @@ ObjectCompositeSettings::_blendBlurValueChanged() SPItem * item = SP_ITEM(*i); SPStyle *style = item->style; - g_assert(style != NULL); + g_assert(style != nullptr); if (blendmode != "normal") { SPFilter *filter = new_filter_simple_from_item(document, item, blendmode.c_str(), radius); sp_style_set_property_url(item, "filter", filter, false); } else { - sp_style_set_property_url(item, "filter", NULL, false); + sp_style_set_property_url(item, "filter", nullptr, false); } if (radius == 0 && item->style->filter.set diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 805333f8e..579049d29 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -199,7 +199,7 @@ static PaperSizeRec const inkscape_papers[] = { * September 2009 - DAK */ - { NULL, 0, 0, "px" }, + { nullptr, 0, 0, "px" }, }; @@ -216,7 +216,7 @@ PageSizer::PageSizer(Registry & _wr) _dimensionUnits( _("U_nits:"), "units", _wr ), _dimensionWidth( _("_Width:"), _("Width of paper"), "width", _dimensionUnits, _wr ), _dimensionHeight( _("_Height:"), _("Height of paper"), "height", _dimensionUnits, _wr ), - _marginLock( _("Loc_k margins"), _("Lock margins"), "lock-margins", _wr, false, NULL, NULL), + _marginLock( _("Loc_k margins"), _("Lock margins"), "lock-margins", _wr, false, nullptr, nullptr), _lock_icon(), _marginTop( _("T_op margin:"), _("Top margin"), "fit-margin-top", _wr ), _marginLeft( _("L_eft:"), _("Left margin"), "fit-margin-left", _wr), @@ -655,7 +655,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() Inkscape::XML::Node *nv_repr; if ((doc = SP_ACTIVE_DESKTOP->getDocument()) - && (nv = sp_document_namedview(doc, 0)) + && (nv = sp_document_namedview(doc, nullptr)) && (nv_repr = nv->getRepr())) { _lockMarginUpdate = true; sp_repr_set_svg_double(nv_repr, "fit-margin-top", _marginTop.getValue()); @@ -669,7 +669,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(dt)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } } diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 281e6e21a..7b54995c1 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -45,7 +45,7 @@ Panel::Panel(gchar const *prefs_path, int verb_num) : _prefs_path(prefs_path), _desktop(SP_ACTIVE_DESKTOP), _verb_num(verb_num), - _action_area(0) + _action_area(nullptr) { set_name("InkscapePanel"); set_orientation(Gtk::ORIENTATION_VERTICAL); diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index aed90f99c..708d2b957 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -59,7 +59,7 @@ public: * @param prefs_path characteristic path to load/save dialog position. * @param verb_num the dialog verb. */ - Panel(gchar const *prefs_path = 0, int verb_num = 0); + Panel(gchar const *prefs_path = nullptr, int verb_num = 0); ~Panel() override; gchar const *getPrefsPath() const; diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 078aba9cf..fee392632 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -351,7 +351,7 @@ draw_text(cairo_t *cr, Geom::Point loc, const char* txt, bool bottom = false, pango_font_description_free (font_desc); PangoRectangle logical_extent; - pango_layout_get_pixel_extents(layout, NULL, &logical_extent); + pango_layout_get_pixel_extents(layout, nullptr, &logical_extent); cairo_move_to(cr, loc[Geom::X], loc[Geom::Y] - (bottom ? logical_extent.height : 0)); pango_cairo_show_layout(cr, layout); } @@ -732,7 +732,7 @@ void PrefEntryFileButtonHBox::onRelatedEntryChangedCallback() } } -static Inkscape::UI::Dialog::FileOpenDialog * selectPrefsFileInstance = NULL; +static Inkscape::UI::Dialog::FileOpenDialog * selectPrefsFileInstance = nullptr; void PrefEntryFileButtonHBox::onRelatedButtonClickedCallback() { diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 2b10d1a81..129a7b336 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -274,7 +274,7 @@ class DialogPage : public Gtk::Grid { public: DialogPage(); - void add_line(bool indent, Glib::ustring const &label, Gtk::Widget& widget, Glib::ustring const &suffix, Glib::ustring const &tip, bool expand = true, Gtk::Widget *other_widget = NULL); + void add_line(bool indent, Glib::ustring const &label, Gtk::Widget& widget, Glib::ustring const &suffix, Glib::ustring const &tip, bool expand = true, Gtk::Widget *other_widget = nullptr); void add_group_header(Glib::ustring name); void set_tip(Gtk::Widget &widget, Glib::ustring const &tip); }; diff --git a/src/ui/widget/registered-enums.h b/src/ui/widget/registered-enums.h index 04ed521cd..c837640d3 100644 --- a/src/ui/widget/registered-enums.h +++ b/src/ui/widget/registered-enums.h @@ -32,8 +32,8 @@ public: const Glib::ustring& key, const Util::EnumDataConverter<E>& c, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL, + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr, bool sorted = true ) : RegisteredWidget< LabelledComboBoxEnum<E> >(label, tip, c, (const Glib::ustring &)"", (const Glib::ustring &)"", true, sorted) { diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index d539cdcc5..b4c114cff 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -207,7 +207,7 @@ RegisteredScalarUnit::~RegisteredScalarUnit() RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in, RSU_UserUnits user_units) : RegisteredWidget<ScalarUnit>(label, tip, UNIT_TYPE_LINEAR, "", "", rum.getUnitMenu()), - _um(0) + _um(nullptr) { init_parent(key, wr, repr_in, doc_in); @@ -489,8 +489,8 @@ RegisteredRadioButtonPair::RegisteredRadioButtonPair (const Glib::ustring& label const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget<Gtk::HBox>(), - _rb1(NULL), - _rb2(NULL) + _rb1(nullptr), + _rb2(nullptr) { init_parent(key, wr, repr_in, doc_in); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index ca55e5397..bb0f6da8a 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -135,9 +135,9 @@ protected: private: void construct() { - _wr = NULL; - repr = NULL; - doc = NULL; + _wr = nullptr; + repr = nullptr; + doc = nullptr; write_undo = false; event_type = 0; //SP_VERB_INVALID } @@ -148,7 +148,7 @@ private: class RegisteredCheckButton : public RegisteredWidget<Gtk::CheckButton> { public: ~RegisteredCheckButton() override; - RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false"); + RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=nullptr, SPDocument *doc_in=nullptr, char const *active_str = "true", char const *inactive_str = "false"); void setActive (bool); @@ -173,7 +173,7 @@ protected: class RegisteredToggleButton : public RegisteredWidget<Gtk::ToggleButton> { public: ~RegisteredToggleButton() override; - RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *icon_active = "true", char const *icon_inactive = "false"); + RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=nullptr, SPDocument *doc_in=nullptr, char const *icon_active = "true", char const *icon_inactive = "false"); void setActive (bool); @@ -200,8 +200,8 @@ public: RegisteredUnitMenu ( const Glib::ustring& label, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); void setUnit (const Glib::ustring); Unit const * getUnit() const { return static_cast<UnitMenu*>(_widget)->getUnit(); }; @@ -228,8 +228,8 @@ public: const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL, + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr, RSU_UserUnits _user_units = RSU_none ); protected: @@ -246,8 +246,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); protected: sigc::connection _value_changed_connection; void on_value_changed(); @@ -260,8 +260,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); protected: sigc::connection _activate_connection; @@ -278,8 +278,8 @@ public: const Glib::ustring& ckey, const Glib::ustring& akey, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr); void setRgba32 (guint32); void closeWindow(); @@ -298,8 +298,8 @@ public: const Glib::ustring& suffix, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); bool setProgrammatically; // true if the value was set by setValue, not changed by the user; // if a callback checks it, it must reset it back to false @@ -319,8 +319,8 @@ public: const Glib::ustring& tip2, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); void setValue (bool second); @@ -339,8 +339,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); protected: sigc::connection _value_x_changed_connection; @@ -356,8 +356,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); // redefine setValue, because transform must be applied void setValue(Geom::Point const & p); @@ -380,8 +380,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); // redefine setValue, because transform must be applied void setValue(Geom::Point const & p); @@ -411,8 +411,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr); void setValue (double val, long startseed); @@ -429,8 +429,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr); void setValue (Glib::ustring fontspec); diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index 4fa1a7584..fc8c92142 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -34,7 +34,7 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, _absolute_is_increment(false), _percentage_is_increment(false) { - if (_unit_menu == NULL) { + if (_unit_menu == nullptr) { _unit_menu = new UnitMenu(); g_assert(_unit_menu); _unit_menu->setUnitType(unit_type); @@ -70,7 +70,7 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, void ScalarUnit::initScalar(double min_value, double max_value) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); Scalar::setDigits(_unit_menu->getDefaultDigits()); Scalar::setIncrements(_unit_menu->getDefaultStep(), _unit_menu->getDefaultPage()); @@ -79,7 +79,7 @@ void ScalarUnit::initScalar(double min_value, double max_value) bool ScalarUnit::setUnit(Glib::ustring const &unit) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); // First set the unit if (!_unit_menu->setUnit(unit)) { return false; @@ -90,21 +90,21 @@ bool ScalarUnit::setUnit(Glib::ustring const &unit) void ScalarUnit::setUnitType(UnitType unit_type) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); _unit_menu->setUnitType(unit_type); lastUnits = _unit_menu->getUnitAbbr(); } void ScalarUnit::resetUnitType(UnitType unit_type) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); _unit_menu->resetUnitType(unit_type); lastUnits = _unit_menu->getUnitAbbr(); } Unit const * ScalarUnit::getUnit() const { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); return _unit_menu->getUnit(); } @@ -116,14 +116,14 @@ UnitType ScalarUnit::getUnitType() const void ScalarUnit::setValue(double number, Glib::ustring const &units) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); _unit_menu->setUnit(units); Scalar::setValue(number); } void ScalarUnit::setValueKeepUnit(double number, Glib::ustring const &units) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); if (units == "") { // set the value in the default units Scalar::setValue(number); @@ -140,7 +140,7 @@ void ScalarUnit::setValue(double number) double ScalarUnit::getValue(Glib::ustring const &unit_name) const { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); if (unit_name == "") { // Return the value in the default units return Scalar::getValue(); @@ -223,7 +223,7 @@ void ScalarUnit::setFromPercentage(double value) void ScalarUnit::on_unit_changed() { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); Glib::ustring abbr = _unit_menu->getUnitAbbr(); _suffix->set_label(abbr); diff --git a/src/ui/widget/scalar-unit.h b/src/ui/widget/scalar-unit.h index 9e310d3bd..debcff53e 100644 --- a/src/ui/widget/scalar-unit.h +++ b/src/ui/widget/scalar-unit.h @@ -52,7 +52,7 @@ public: UnitType unit_type = UNIT_TYPE_LINEAR, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", - UnitMenu *unit_menu = NULL, + UnitMenu *unit_menu = nullptr, bool mnemonic = true); /** diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index 937bea697..a3fff0c8c 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -54,13 +54,13 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, unsigned Scalar::getDigits() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<SpinButton*>(_widget)->get_digits(); } double Scalar::getStep() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double step, page; static_cast<SpinButton*>(_widget)->get_increments(step, page); return step; @@ -68,7 +68,7 @@ double Scalar::getStep() const double Scalar::getPage() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double step, page; static_cast<SpinButton*>(_widget)->get_increments(step, page); return page; @@ -76,7 +76,7 @@ double Scalar::getPage() const double Scalar::getRangeMin() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double min, max; static_cast<SpinButton*>(_widget)->get_range(min, max); return min; @@ -84,7 +84,7 @@ double Scalar::getRangeMin() const double Scalar::getRangeMax() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double min, max; static_cast<SpinButton*>(_widget)->get_range(min, max); return max; @@ -92,38 +92,38 @@ double Scalar::getRangeMax() const double Scalar::getValue() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<SpinButton*>(_widget)->get_value(); } int Scalar::getValueAsInt() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<SpinButton*>(_widget)->get_value_as_int(); } void Scalar::setDigits(unsigned digits) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->set_digits(digits); } void Scalar::setIncrements(double step, double /*page*/) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->set_increments(step, 0); } void Scalar::setRange(double min, double max) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->set_range(min, max); } void Scalar::setValue(double value, bool setProg) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); if (setProg) { setProgrammatically = true; // callback is supposed to reset back, if it cares } @@ -132,7 +132,7 @@ void Scalar::setValue(double value, bool setProg) void Scalar::update() { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->update(); } diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index a15afde4c..c0b0a7f56 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -74,7 +74,7 @@ ss_selection_modified( Inkscape::Selection *selection, guint /*flags*/, gpointer static void ss_subselection_changed( gpointer /*dragger*/, gpointer data ) { - ss_selection_changed (NULL, data); + ss_selection_changed (nullptr, data); } namespace { @@ -121,9 +121,9 @@ SelectedStyle::SelectedStyle(bool /*layout*/) : current_stroke_width(0), - _sw_unit(NULL), + _sw_unit(nullptr), - _desktop (NULL), + _desktop (nullptr), _table(), _fill_label (_("Fill:")), _stroke_label (_("Stroke:")), @@ -146,7 +146,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_blocked (false) { set_name("SelectedStyle"); - _drop[0] = _drop[1] = 0; + _drop[0] = _drop[1] = nullptr; _dropEnabled[0] = _dropEnabled[1] = false; _fill_label.set_halign(Gtk::ALIGN_START); @@ -207,7 +207,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _lgradient[i].show_all(); __lgradient[i] = (i == SS_FILL)? (_("Linear gradient fill")) : (_("Linear gradient stroke")); - _gradient_preview_l[i] = GTK_WIDGET(sp_gradient_image_new (NULL)); + _gradient_preview_l[i] = GTK_WIDGET(sp_gradient_image_new (nullptr)); _gradient_box_l[i].pack_start(_lgradient[i]); _gradient_box_l[i].pack_start(*(Glib::wrap(_gradient_preview_l[i]))); _gradient_box_l[i].show_all(); @@ -217,7 +217,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _rgradient[i].show_all(); __rgradient[i] = (i == SS_FILL)? (_("Radial gradient fill")) : (_("Radial gradient stroke")); - _gradient_preview_r[i] = GTK_WIDGET(sp_gradient_image_new (NULL)); + _gradient_preview_r[i] = GTK_WIDGET(sp_gradient_image_new (nullptr)); _gradient_box_r[i].pack_start(_rgradient[i]); _gradient_box_r[i].pack_start(*(Glib::wrap(_gradient_preview_r[i]))); _gradient_box_r[i].show_all(); @@ -228,7 +228,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _mgradient[i].show_all(); __mgradient[i] = (i == SS_FILL)? (_("Mesh gradient fill")) : (_("Mesh gradient stroke")); - _gradient_preview_m[i] = GTK_WIDGET(sp_gradient_image_new (NULL)); + _gradient_preview_m[i] = GTK_WIDGET(sp_gradient_image_new (nullptr)); _gradient_box_m[i].pack_start(_mgradient[i]); _gradient_box_m[i].pack_start(*(Glib::wrap(_gradient_preview_m[i]))); _gradient_box_m[i].show_all(); @@ -925,7 +925,7 @@ void SelectedStyle::on_popup_preset(int i) { void SelectedStyle::update() { - if (_desktop == NULL) + if (_desktop == nullptr) return; // create temporary style @@ -1201,7 +1201,7 @@ RotateableSwatch::RotateableSwatch(SelectedStyle *parent, guint mode) : startcolor(0), startcolor_set(false), undokey("ssrot1"), - cr(0), + cr(nullptr), cr_set(false) { @@ -1285,7 +1285,7 @@ RotateableSwatch::do_motion(double by, guint modifier) { if (!scrolling && !cr_set) { GtkWidget *w = GTK_WIDGET(gobj()); - GdkPixbuf *pixbuf = NULL; + GdkPixbuf *pixbuf = nullptr; if (modifier == 2) { // saturation pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)cursor_adj_s_xpm); @@ -1297,13 +1297,13 @@ RotateableSwatch::do_motion(double by, guint modifier) { pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)cursor_adj_h_xpm); } - if (pixbuf != NULL) { + if (pixbuf != nullptr) { cr = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, 16, 16); g_object_unref(pixbuf); gdk_window_set_cursor(gtk_widget_get_window(w), cr); g_object_unref(cr); - cr = NULL; + cr = nullptr; cr_set = true; } } @@ -1364,10 +1364,10 @@ RotateableSwatch::do_release(double by, guint modifier) { if (cr_set) { GtkWidget *w = GTK_WIDGET(gobj()); - gdk_window_set_cursor(gtk_widget_get_window(w), NULL); + gdk_window_set_cursor(gtk_widget_get_window(w), nullptr); if (cr) { g_object_unref(cr); - cr = NULL; + cr = nullptr; } cr_set = false; } @@ -1495,7 +1495,7 @@ Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop) } catch (std::exception &e) { } } - return 0; + return nullptr; } } // namespace Widget diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index 94b178a43..0c843590c 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -161,7 +161,7 @@ void DualSpinScale::set_from_attribute(SPObject* o) if(toks[1]) v2 = Glib::Ascii::strtod(toks[1]); - _link.set_active(toks[1] == 0); + _link.set_active(toks[1] == nullptr); _s1.get_adjustment()->set_value(v1); _s2.get_adjustment()->set_value(v2); diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 03981763d..0b63e7455 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -153,7 +153,7 @@ void DualSpinSlider::set_from_attribute(SPObject* o) if(toks[1]) v2 = Glib::Ascii::strtod(toks[1]); - _link.set_active(toks[1] == 0); + _link.set_active(toks[1] == nullptr); _s1.get_adjustment()->set_value(v1); _s2.get_adjustment()->set_value(v2); diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index cd2d2a427..fe03c85d3 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -32,7 +32,7 @@ class SpinSlider : public Gtk::HBox, public AttrWidget { public: SpinSlider(double value, double lower, double upper, double step_inc, - double climb_rate, int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); + double climb_rate, int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = nullptr); Glib::ustring get_as_attribute() const override; void set_from_attribute(SPObject*) override; diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 0c082d3ce..777a6edf4 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -35,7 +35,7 @@ int SpinButton::on_input(double* newvalue) try { Inkscape::Util::EvaluatorQuantity result; if (_unit_menu || _unit_tracker) { - Unit const *unit = NULL; + Unit const *unit = nullptr; if (_unit_menu) { unit = _unit_menu->getUnit(); } else { @@ -48,7 +48,7 @@ int SpinButton::on_input(double* newvalue) throw Inkscape::Util::EvaluatorException("Input dimensions do not match with parameter dimensions.",""); } } else { - Inkscape::Util::ExpressionEvaluator eval = Inkscape::Util::ExpressionEvaluator(get_text().c_str(), NULL); + Inkscape::Util::ExpressionEvaluator eval = Inkscape::Util::ExpressionEvaluator(get_text().c_str(), nullptr); result = eval.evaluate(); } diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index a252743be..28d9849a8 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -30,16 +30,16 @@ class SpinButton : public Gtk::SpinButton public: SpinButton(double climb_rate = 0.0, guint digits = 0) : Gtk::SpinButton(climb_rate, digits), - _unit_menu(NULL), - _unit_tracker(NULL), + _unit_menu(nullptr), + _unit_tracker(nullptr), _on_focus_in_value(0.) { connect_signals(); }; explicit SpinButton(Glib::RefPtr<Gtk::Adjustment>& adjustment, double climb_rate = 0.0, guint digits = 0) : Gtk::SpinButton(adjustment, climb_rate, digits), - _unit_menu(NULL), - _unit_tracker(NULL), + _unit_menu(nullptr), + _unit_tracker(nullptr), _on_focus_in_value(0.) { connect_signals(); diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index e23627080..5eccc67cf 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -17,11 +17,11 @@ namespace Inkscape { namespace UI { namespace Widget { -StyleSubject::StyleSubject() : _desktop(NULL) { +StyleSubject::StyleSubject() : _desktop(nullptr) { } StyleSubject::~StyleSubject() { - setDesktop(NULL); + setDesktop(nullptr); } void StyleSubject::setDesktop(SPDesktop *desktop) { @@ -49,7 +49,7 @@ Inkscape::Selection *StyleSubject::Selection::_getSelection() const { if (desktop) { return desktop->getSelection(); } else { - return NULL; + return nullptr; } } @@ -102,7 +102,7 @@ void StyleSubject::Selection::setCSS(SPCSSAttr *css) { } StyleSubject::CurrentLayer::CurrentLayer() { - _element = NULL; + _element = nullptr; } StyleSubject::CurrentLayer::~CurrentLayer() { @@ -112,12 +112,12 @@ void StyleSubject::CurrentLayer::_setLayer(SPObject *layer) { _layer_release.disconnect(); _layer_modified.disconnect(); if (_element) { - sp_object_unref(_element, NULL); + sp_object_unref(_element, nullptr); } _element = layer; if (layer) { - sp_object_ref(layer, NULL); - _layer_release = layer->connectRelease(sigc::hide(sigc::bind(sigc::mem_fun(*this, &CurrentLayer::_setLayer), (SPObject *)NULL))); + sp_object_ref(layer, nullptr); + _layer_release = layer->connectRelease(sigc::hide(sigc::bind(sigc::mem_fun(*this, &CurrentLayer::_setLayer), (SPObject *)nullptr))); _layer_modified = layer->connectModified(sigc::hide(sigc::hide(sigc::mem_fun(*this, &CurrentLayer::_emitChanged)))); } _emitChanged(); @@ -171,7 +171,7 @@ void StyleSubject::CurrentLayer::_afterDesktopSwitch(SPDesktop *desktop) { _layer_switched = desktop->connectCurrentLayerChanged(sigc::mem_fun(*this, &CurrentLayer::_setLayer)); _setLayer(desktop->currentLayer()); } else { - _setLayer(NULL); + _setLayer(nullptr); } } diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 15928e300..04a63271e 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -106,13 +106,13 @@ void StyleSwatch::ToolObserver::notify(Inkscape::Preferences::Entry const &val) StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) : - _desktop(NULL), + _desktop(nullptr), _verb_t(0), - _css(NULL), - _tool_obs(NULL), - _style_obs(NULL), + _css(nullptr), + _tool_obs(nullptr), + _style_obs(nullptr), _table(Gtk::manage(new Gtk::Grid())), - _sw_unit(NULL) + _sw_unit(nullptr) { set_name("StyleSwatch"); @@ -201,7 +201,7 @@ StyleSwatch::on_click(GdkEventButton */*event*/) if (this->_desktop && this->_verb_t != SP_VERB_NONE) { Inkscape::Verb *verb = Inkscape::Verb::get(this->_verb_t); SPAction *action = verb->get_action(Inkscape::ActionContext((Inkscape::UI::View::View *) this->_desktop)); - sp_action_perform (action, NULL); + sp_action_perform (action, nullptr); return true; } return false; @@ -227,7 +227,7 @@ StyleSwatch::setWatchedTool(const char *path, bool synthesize) if (_tool_obs) { delete _tool_obs; - _tool_obs = NULL; + _tool_obs = nullptr; } if (path) { diff --git a/src/ui/widget/text.cpp b/src/ui/widget/text.cpp index e6795b138..5b6b7468d 100644 --- a/src/ui/widget/text.cpp +++ b/src/ui/widget/text.cpp @@ -30,13 +30,13 @@ Text::Text(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const Text::getText() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<Gtk::Entry*>(_widget)->get_text(); } void Text::setText(Glib::ustring const text) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); setProgrammatically = true; // callback is supposed to reset back, if it cares static_cast<Gtk::Entry*>(_widget)->set_text(text); // FIXME: set correctly } diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index d2c338571..447efdfe0 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -46,7 +46,7 @@ namespace Widget { //==================================================== ToleranceSlider::ToleranceSlider(const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& label3, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& tip3, const Glib::ustring& key, Registry& wr) -: _vbox(0) +: _vbox(nullptr) { init(label1, label2, label3, tip1, tip2, tip3, key, wr); } diff --git a/src/ui/widget/unit-tracker.cpp b/src/ui/widget/unit-tracker.cpp index e7e47af4b..bb9425b29 100644 --- a/src/ui/widget/unit-tracker.cpp +++ b/src/ui/widget/unit-tracker.cpp @@ -33,7 +33,7 @@ namespace Widget { UnitTracker::UnitTracker(UnitType unit_type) : _active(0), _isUpdating(false), - _activeUnit(NULL), + _activeUnit(nullptr), _activeUnitInitialized(false), _store(nullptr), _priorValues() |
