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/dialog | |
| 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/dialog')
55 files changed, 643 insertions, 643 deletions
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 7a87a75ad..fb2b86b68 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -49,7 +49,7 @@ namespace Inkscape { namespace UI { namespace Dialog { -static AboutBox *window=NULL; +static AboutBox *window=nullptr; void AboutBox::show_about() { if (!window) diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 1dc79474e..23a925de1 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -128,7 +128,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) if (selected.empty()) return; const Coeffs &a = _allCoeffs[index]; - SPItem *focus = NULL; + SPItem *focus = nullptr; Geom::OptRect b = Geom::OptRect(); Selection::CompareSize horiz = (a.mx0 != 0.0) || (a.mx1 != 0.0) ? Selection::VERTICAL : Selection::HORIZONTAL; @@ -557,8 +557,8 @@ private : static boost::optional<Geom::Point> center; static bool sort_compare(const SPItem * a,const SPItem * b) { - if (a == NULL) return false; - if (b == NULL) return true; + if (a == nullptr) return false; + if (b == nullptr) return true; if (center) { Geom::Point point_a = a->getCenter() - (*center); Geom::Point point_b = b->getCenter() - (*center); @@ -830,7 +830,7 @@ private : } else { //align Geom::Point ref_point; - SPItem *focus = NULL; + SPItem *focus = nullptr; Geom::OptRect b = Geom::OptRect(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 06f25c5ae..c1998249d 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -70,16 +70,16 @@ namespace Dialog { static Glib::ustring const prefs_path = "/dialogs/clonetiler/"; -static Inkscape::Drawing *trace_drawing = NULL; +static Inkscape::Drawing *trace_drawing = nullptr; static unsigned trace_visionkey; static gdouble trace_zoom; -static SPDocument *trace_doc = NULL; +static SPDocument *trace_doc = nullptr; CloneTiler::CloneTiler () : UI::Widget::Panel("/dialogs/clonetiler/", SP_VERB_DIALOG_CLONETILER), - desktop(NULL), + desktop(nullptr), deskTrack(), - table_row_labels(NULL) + table_row_labels(nullptr) { Gtk::Box *contents = _getContents(); contents->set_spacing(0); @@ -1845,7 +1845,7 @@ Geom::Affine CloneTiler::get_transform( bool CloneTiler::is_a_clone_of(SPObject *tile, SPObject *obj) { bool result = false; - char *id_href = NULL; + char *id_href = nullptr; if (obj) { Inkscape::XML::Node *obj_repr = obj->getRepr(); @@ -1864,7 +1864,7 @@ bool CloneTiler::is_a_clone_of(SPObject *tile, SPObject *obj) } if (id_href) { g_free(id_href); - id_href = 0; + id_href = nullptr; } return result; } @@ -1876,7 +1876,7 @@ void CloneTiler::trace_hide_tiled_clones_recursively(SPObject *from) for (auto& o: from->children) { SPItem *item = dynamic_cast<SPItem *>(&o); - if (item && is_a_clone_of(&o, NULL)) { + if (item && is_a_clone_of(&o, nullptr)) { item->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too! } trace_hide_tiled_clones_recursively (&o); @@ -1930,15 +1930,15 @@ void CloneTiler::trace_finish() if (trace_doc) { trace_doc->getRoot()->invoke_hide(trace_visionkey); delete trace_drawing; - trace_doc = NULL; - trace_drawing = NULL; + trace_doc = nullptr; + trace_drawing = nullptr; } } void CloneTiler::unclump() { auto desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) { + if (desktop == nullptr) { return; } @@ -1987,7 +1987,7 @@ guint CloneTiler::number_of_clones(SPObject *obj) void CloneTiler::remove(bool do_undo/* = true*/) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) { + if (desktop == nullptr) { return; } @@ -2010,7 +2010,7 @@ void CloneTiler::remove(bool do_undo/* = true*/) } } for (auto obj:to_delete) { - g_assert(obj != NULL); + g_assert(obj != nullptr); obj->deleteObject(); } @@ -2057,7 +2057,7 @@ double CloneTiler::randomize01(double val, double rand) void CloneTiler::apply() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) { + if (desktop == nullptr) { return; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index 8eda9ae08..04ade3d1e 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -170,7 +170,7 @@ static bool popVal( guint64& numVal, std::string& str ) if ( endPos != std::string::npos && endPos > 0 ) { std::string xxx = str.substr( 0, endPos ); const gchar* ptr = xxx.c_str(); - gchar* endPtr = 0; + gchar* endPtr = nullptr; numVal = g_ascii_strtoull( ptr, &endPtr, 10 ); if ( (numVal == G_MAXUINT64) && (ERANGE == errno) ) { // overflow @@ -200,7 +200,7 @@ static void colorItemDragBegin( GtkWidget */*widget*/, GdkDragContext* dc, gpoin int height = 24; if (item->def.getType() != ege::PaintDef::RGB){ - GError *error = NULL; + GError *error = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; gchar *localFilename = g_filename_from_utf8( get_path(SYSTEM, ICONS, "remove-color.png"), @@ -212,7 +212,7 @@ static void colorItemDragBegin( GtkWidget */*widget*/, GdkDragContext* dc, gpoin g_free(localFilename); gtk_drag_set_icon_pixbuf( dc, pixbuf, 0, 0 ); } else { - GdkPixbuf* pixbuf = 0; + GdkPixbuf* pixbuf = nullptr; if ( item->getGradient() ){ cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); cairo_pattern_t *gradient = sp_gradient_create_preview_pattern(item->getGradient(), width); @@ -271,9 +271,9 @@ ColorItem::ColorItem(ege::PaintDef::ColorType type) : _linkIsTone(false), _linkPercent(0), _linkGray(0), - _linkSrc(0), - _grad(0), - _pattern(0) + _linkSrc(nullptr), + _grad(nullptr), + _pattern(nullptr) { } @@ -285,15 +285,15 @@ ColorItem::ColorItem( unsigned int r, unsigned int g, unsigned int b, Glib::ustr _linkIsTone(false), _linkPercent(0), _linkGray(0), - _linkSrc(0), - _grad(0), - _pattern(0) + _linkSrc(nullptr), + _grad(nullptr), + _pattern(nullptr) { } ColorItem::~ColorItem() { - if (_pattern != NULL) { + if (_pattern != nullptr) { cairo_pattern_destroy(_pattern); } } @@ -397,7 +397,7 @@ void ColorItem::_dragGetColorData( GtkWidget */*widget*/, } if ( !key.empty() ) { - char* tmp = 0; + char* tmp = nullptr; int len = 0; int format = 0; item->def.getMIMEData(key, tmp, len, format); @@ -510,7 +510,7 @@ void ColorItem::_regenPreview(EekPreview * preview) using Inkscape::IO::Resource::get_path; using Inkscape::IO::Resource::ICONS; using Inkscape::IO::Resource::SYSTEM; - GError *error = NULL; + GError *error = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; gchar *localFilename = g_filename_from_utf8( get_path(SYSTEM, ICONS, "remove-color.png"), @@ -556,7 +556,7 @@ void ColorItem::_regenPreview(EekPreview * preview) Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewSize size, guint ratio, guint border) { - Gtk::Widget* widget = 0; + Gtk::Widget* widget = nullptr; if ( style == PREVIEW_STYLE_BLURB) { Gtk::Label *lbl = new Gtk::Label(def.descr); lbl->set_halign(Gtk::ALIGN_START); diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index efceeae11..aa0198f27 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -35,7 +35,7 @@ namespace Dialog { */ CssDialog::CssDialog(): UI::Widget::Panel("/dialogs/css", SP_VERB_DIALOG_CSS), - _desktop(0) + _desktop(nullptr) { set_size_request(20, 15); _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); @@ -98,7 +98,7 @@ CssDialog::CssDialog(): */ CssDialog::~CssDialog() { - setDesktop(NULL); + setDesktop(nullptr); } diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index 8771f935a..a34185f49 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -145,7 +145,7 @@ void DebugDialogImpl::message(char const *msg) } /* static instance, to reduce dependencies */ -static DebugDialog *debugDialogInstance = NULL; +static DebugDialog *debugDialogInstance = nullptr; DebugDialog *DebugDialog::getInstance() { @@ -189,7 +189,7 @@ void DebugDialogImpl::captureLogMessages() G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG); if ( !handlerDefault ) { - handlerDefault = g_log_set_handler(NULL, flags, + handlerDefault = g_log_set_handler(nullptr, flags, dialogLoggingFunction, (gpointer)this); } if ( !handlerGlibmm ) { @@ -218,7 +218,7 @@ void DebugDialogImpl::captureLogMessages() void DebugDialogImpl::releaseLogMessages() { if ( handlerDefault ) { - g_log_remove_handler(NULL, handlerDefault); + g_log_remove_handler(nullptr, handlerDefault); handlerDefault = 0; } if ( handlerGlibmm ) { diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp index c18711a55..a25243f08 100644 --- a/src/ui/dialog/desktop-tracker.cpp +++ b/src/ui/dialog/desktop-tracker.cpp @@ -17,9 +17,9 @@ namespace UI { namespace Dialog { DesktopTracker::DesktopTracker() : - base(0), - desktop(0), - widget(0), + base(nullptr), + desktop(nullptr), + widget(nullptr), hierID(0), trackActive(false), desktopChangedSig() @@ -111,7 +111,7 @@ bool DesktopTracker::hierarchyChangeCB(GtkWidget * /*widget*/, GtkWidget* /*prev void DesktopTracker::handleHierarchyChange() { GtkWidget *wdgt = gtk_widget_get_ancestor(widget, SP_TYPE_DESKTOP_WIDGET); - bool newFlag = (wdgt == 0); // true means not in an SPDesktopWidget, thus floating. + bool newFlag = (wdgt == nullptr); // true means not in an SPDesktopWidget, thus floating. if (wdgt && !base) { SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt); if (dtw && dtw->desktop) { diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 0a4a774e6..5a10cf890 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -208,7 +208,7 @@ DialogManager &DialogManager::getInstance() /* Use singleton behavior for floating dialogs */ if (dialogs_type == FLOATING) { - static DialogManager *instance = 0; + static DialogManager *instance = nullptr; if (!instance) instance = new DialogManager(); @@ -252,7 +252,7 @@ Dialog *DialogManager::getDialog(GQuark name) { DialogMap::iterator dialog_found; dialog_found = _dialog_map.find(name); - Dialog *dialog=NULL; + Dialog *dialog=nullptr; if ( dialog_found != _dialog_map.end() ) { dialog = dialog_found->second; } else { @@ -280,14 +280,14 @@ void DialogManager::showDialog(gchar const *name, bool grabfocus) { */ void DialogManager::showDialog(GQuark name, bool /*grabfocus*/) { bool wantTiming = Inkscape::Preferences::get()->getBool("/dialogs/debug/trackAppear", false); - GTimer *timer = (wantTiming) ? g_timer_new() : 0; // if needed, must be created/started before getDialog() + GTimer *timer = (wantTiming) ? g_timer_new() : nullptr; // if needed, must be created/started before getDialog() Dialog *dialog = getDialog(name); if ( dialog ) { if ( wantTiming ) { gchar const * nameStr = g_quark_to_string(name); ege::AppearTimeTracker *tracker = new ege::AppearTimeTracker(timer, dialog->gobj(), nameStr); tracker->setAutodelete(true); - timer = 0; + timer = nullptr; } // should check for grabfocus, but lp:1348927 prevents it dialog->present(); @@ -295,7 +295,7 @@ void DialogManager::showDialog(GQuark name, bool /*grabfocus*/) { if ( timer ) { g_timer_destroy(timer); - timer = 0; + timer = nullptr; } } diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index f7e9a1bed..0cee7f1d6 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -57,9 +57,9 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat _verb_num(verb_num), _title(), _apply_label(apply_label), - _desktop(NULL), + _desktop(nullptr), _is_active_desktop(true), - _behavior(0) + _behavior(nullptr) { gchar title[500]; @@ -86,7 +86,7 @@ Dialog::~Dialog() { save_geometry(); delete _behavior; - _behavior = 0; + _behavior = nullptr; } @@ -205,7 +205,7 @@ Dialog::save_status(int visible, int state, int placement) { // Only save dialog status for dialogs on the "last document" SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop != NULL || !_is_active_desktop ) { + if (desktop != nullptr || !_is_active_desktop ) { return; } @@ -284,7 +284,7 @@ void Dialog::_apply() void Dialog::_close() { _behavior->hide(); - _onDeleteEvent(NULL); + _onDeleteEvent(nullptr); } void Dialog::_defocus() diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h index 2bde4459b..8f94c544b 100644 --- a/src/ui/dialog/dialog.h +++ b/src/ui/dialog/dialog.h @@ -63,7 +63,7 @@ public: * @param prefs_path characteristic path for loading/saving dialog position. * @param verb_num the dialog verb. */ - Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = NULL, + Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = nullptr, int verb_num = 0, Glib::ustring const &apply_label = ""); virtual ~Dialog(); diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index e46f5ec6c..21ffef04a 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -43,11 +43,11 @@ namespace Dialog { static void on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer); static Inkscape::XML::NodeEventVector const _repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ on_repr_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 7b1025e2b..1dda7f17d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -69,8 +69,8 @@ static Inkscape::XML::NodeEventVector const _repr_events = { on_child_added, // child_added on_child_removed, // child_removed on_repr_attr_changed, - NULL, // content_changed - NULL // order_changed + nullptr, // content_changed + nullptr // order_changed }; static void docprops_style_button(Gtk::Button& btn, char const* iconName) @@ -101,7 +101,7 @@ DocumentProperties::DocumentProperties() _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- - _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, NULL, NULL, NULL, "crispEdges"), + _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, nullptr, nullptr, nullptr, "crispEdges"), _rcb_checkerboard(_("Checkerboard background"), _("If set, use checkerboard for background, otherwise use background color at full opacity."), "inkscape:pagecheckerboard", _wr, false), _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), @@ -310,35 +310,35 @@ void DocumentProperties::build_page() Gtk::Widget *const widget_array[] = { - label_gen, 0, - 0, &_rum_deflt, + label_gen, nullptr, + nullptr, &_rum_deflt, //label_col, 0, //_rcp_bg._label, &_rcp_bg, - 0, 0, - label_for, 0, - 0, &_page_sizer, - 0, 0, + nullptr, nullptr, + label_for, nullptr, + nullptr, &_page_sizer, + nullptr, nullptr, &_rcb_doc_props_left, &_rcb_doc_props_right, }; attach_all(_page_page->table(), widget_array, G_N_ELEMENTS(widget_array),0,1); Gtk::Widget *const widget_array_left[] = { - label_bkg, 0, - 0, &_rcb_checkerboard, - 0, &_rcp_bg, - label_dsp, 0, - 0, &_rcb_antialias, + label_bkg, nullptr, + nullptr, &_rcb_checkerboard, + nullptr, &_rcp_bg, + label_dsp, nullptr, + nullptr, &_rcb_antialias, }; attach_all(_rcb_doc_props_left, widget_array_left, G_N_ELEMENTS(widget_array_left),0,1); Gtk::Widget *const widget_array_right[] = { - label_bdr, 0, - 0, &_rcb_canb, - 0, &_rcb_bord, - 0, &_rcb_shad, - 0, &_rcp_bord, + label_bdr, nullptr, + nullptr, &_rcb_canb, + nullptr, &_rcb_bord, + nullptr, &_rcb_shad, + nullptr, &_rcp_bord, }; attach_all(_rcb_doc_props_right, widget_array_right, G_N_ELEMENTS(widget_array_right),0,1, true); @@ -361,13 +361,13 @@ void DocumentProperties::build_guides() Gtk::Widget *const widget_array[] = { - label_gui, 0, - 0, &_rcb_sgui, - 0, &_rcb_lgui, - 0, &_rcp_gui, - 0, &_rcp_hgui, - 0, &_create_guides_btn, - 0, &_delete_guides_btn + label_gui, nullptr, + nullptr, &_rcb_sgui, + nullptr, &_rcb_lgui, + nullptr, &_rcp_gui, + nullptr, &_rcp_hgui, + nullptr, &_create_guides_btn, + nullptr, &_delete_guides_btn }; attach_all(_page_guides->table(), widget_array, G_N_ELEMENTS(widget_array)); @@ -391,20 +391,20 @@ void DocumentProperties::build_snap() Gtk::Widget *const array[] = { - label_o, 0, - 0, _rsu_sno._vbox, - 0, &_rcb_snclp, - 0, &_rcb_snmsk, - 0, 0, - label_gr, 0, - 0, _rsu_sn._vbox, - 0, 0, - label_gu, 0, - 0, _rsu_gusn._vbox, - 0, 0, - label_m, 0, - 0, &_rcb_perp, - 0, &_rcb_tang + label_o, nullptr, + nullptr, _rsu_sno._vbox, + nullptr, &_rcb_snclp, + nullptr, &_rcb_snmsk, + nullptr, nullptr, + label_gr, nullptr, + nullptr, _rsu_sn._vbox, + nullptr, nullptr, + label_gu, nullptr, + nullptr, _rsu_gusn._vbox, + nullptr, nullptr, + label_m, nullptr, + nullptr, &_rcb_perp, + nullptr, &_rcb_tang }; attach_all(_page_snap->table(), array, G_N_ELEMENTS(array)); @@ -417,7 +417,7 @@ void DocumentProperties::create_guides_around_page() if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(dt)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } } @@ -429,7 +429,7 @@ void DocumentProperties::delete_all_guides() if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(dt)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } } @@ -538,11 +538,11 @@ void DocumentProperties::linkSelectedProfile() Inkscape::XML::Node *defsRepr = sp_repr_lookup_name(xml_doc, "svg:defs"); if (!defsRepr) { defsRepr = xml_doc->createElement("svg:defs"); - xml_doc->root()->addChild(defsRepr, NULL); + xml_doc->root()->addChild(defsRepr, nullptr); } g_assert(desktop->doc()->getDefs()); - defsRepr->addChild(cprofRepr, NULL); + defsRepr->addChild(cprofRepr, nullptr); // TODO check if this next line was sometimes needed. It being there caused an assertion. //Inkscape::GC::release(defsRepr); @@ -1083,7 +1083,7 @@ void DocumentProperties::addExternalScript(){ scriptRepr->setAttribute("xlink:href", (gchar*) _script_entry.get_text().c_str()); _script_entry.set_text(""); - xml_doc->root()->addChild(scriptRepr, NULL); + xml_doc->root()->addChild(scriptRepr, nullptr); // inform the document, so we can undo DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script...")); @@ -1093,7 +1093,7 @@ void DocumentProperties::addExternalScript(){ } -static Inkscape::UI::Dialog::FileOpenDialog * selectPrefsFileInstance = NULL; +static Inkscape::UI::Dialog::FileOpenDialog * selectPrefsFileInstance = nullptr; void DocumentProperties::browseExternalScript() { @@ -1150,7 +1150,7 @@ void DocumentProperties::addEmbeddedScript(){ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); Inkscape::XML::Node *scriptRepr = xml_doc->createElement("svg:script"); - xml_doc->root()->addChild(scriptRepr, NULL); + xml_doc->root()->addChild(scriptRepr, nullptr); // inform the document, so we can undo DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EMBEDDED_SCRIPT, _("Add embedded script...")); @@ -1319,13 +1319,13 @@ void DocumentProperties::populate_script_lists(){ std::vector<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); if (!current.empty()) { SPObject *obj = *(current.begin()); - g_assert(obj != NULL); + g_assert(obj != nullptr); _scripts_observer.set(obj->parent); } for (std::vector<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) { SPObject* obj = *it; SPScript* script = dynamic_cast<SPScript *>(obj); - g_assert(script != NULL); + g_assert(script != nullptr); if (script->xlinkhref) { Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append()); @@ -1357,7 +1357,7 @@ void DocumentProperties::update_gridspage() for(std::vector<Inkscape::CanvasGrid *>::const_iterator it = nv->grids.begin(); it != nv->grids.end(); ++it) { if (!(*it)->repr->attribute("id")) continue; // update_gridspage is called again when "id" is added Glib::ustring name((*it)->repr->attribute("id")); - const char *icon = NULL; + const char *icon = nullptr; switch ((*it)->getGridType()) { case GRID_RECTANGULAR: icon = "grid-rectangular"; @@ -1631,7 +1631,7 @@ void DocumentProperties::onRemoveGrid() SPDesktop *dt = getDesktop(); SPNamedView *nv = dt->getNamedView(); - Inkscape::CanvasGrid * found_grid = NULL; + Inkscape::CanvasGrid * found_grid = nullptr; if( pagenum < (gint)nv->grids.size()) found_grid = nv->grids[pagenum]; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index ab5fe06fd..4d61091a2 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -156,10 +156,10 @@ Export::Export (void) : closeWhenDone(_("Close when complete"), _("Once the export completes, close this dialog")), button_box(false, 3), _prog(), - prog_dlg(NULL), + prog_dlg(nullptr), interrupted(false), - prefs(NULL), - desktop(NULL), + prefs(nullptr), + desktop(nullptr), deskTrack(), selectChangedConn(), subselChangedConn(), @@ -270,7 +270,7 @@ Export::Export (void) : */ ydpi_adj = createSpinbutton ( "ydpi", prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE), 0.01, 100000.0, 0.1, 1.0, t, 3, 1, - "", _("dpi"), 2, 0, NULL ); + "", _("dpi"), 2, 0, nullptr ); singleexport_box.pack_start(size_box); } @@ -442,13 +442,13 @@ void Export::set_default_filename () { SPDocument * doc = SP_ACTIVE_DOCUMENT; const gchar *uri = doc->getURI(); const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str(); - Inkscape::Extension::Output * oextension = NULL; + Inkscape::Extension::Output * oextension = nullptr; - if (text_extension != NULL) { + if (text_extension != nullptr) { oextension = dynamic_cast<Inkscape::Extension::Output *>(Inkscape::Extension::db.get(text_extension)); } - if (oextension != NULL) { + if (oextension != nullptr) { gchar * old_extension = oextension->get_extension(); if (g_str_has_suffix(uri, old_extension)) { gchar * uri_copy; @@ -496,7 +496,7 @@ Glib::RefPtr<Gtk::Adjustment> Export::createSpinbutton( gchar const * /*key*/, f auto adj = Gtk::Adjustment::create(val, min, max, step, page, 0); int pos = 0; - Gtk::Label *l = NULL; + Gtk::Label *l = nullptr; if (!ll.empty()) { l = new Gtk::Label(ll,true); @@ -564,7 +564,7 @@ Glib::ustring Export::create_filepath_from_id (Glib::ustring id, const Glib::ust } if (directory.empty()) { - directory = Inkscape::IO::Resource::homedir_path(NULL); + directory = Inkscape::IO::Resource::homedir_path(nullptr); } Glib::ustring filename = Glib::build_filename(directory, id+".png"); @@ -1086,7 +1086,7 @@ void Export::onExport () setExporting(false); delete prog_dlg; - prog_dlg = NULL; + prog_dlg = nullptr; interrupted = false; exportSuccessful = (export_count > 0); } else { @@ -1184,7 +1184,7 @@ void Export::onExport () setExporting(false); delete prog_dlg; - prog_dlg = NULL; + prog_dlg = nullptr; interrupted = false; /* Setup the values in the document */ @@ -1199,17 +1199,17 @@ void Export::onExport () DocumentUndo::setUndoSensitive(doc, false); gchar const *temp_string = repr->attribute("inkscape:export-filename"); - if (temp_string == NULL || (filename_ext != temp_string)) { + if (temp_string == nullptr || (filename_ext != temp_string)) { repr->setAttribute("inkscape:export-filename", filename_ext.c_str()); modified = true; } temp_string = repr->attribute("inkscape:export-xdpi"); - if (temp_string == NULL || xdpi != atof(temp_string)) { + if (temp_string == nullptr || xdpi != atof(temp_string)) { sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi); modified = true; } temp_string = repr->attribute("inkscape:export-ydpi"); - if (temp_string == NULL || ydpi != atof(temp_string)) { + if (temp_string == nullptr || ydpi != atof(temp_string)) { sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi); modified = true; } @@ -1238,23 +1238,23 @@ void Export::onExport () { docdir = Glib::path_get_dirname(docURI); } - if (repr->attribute("id") == NULL || + if (repr->attribute("id") == nullptr || !(filename_ext.find_last_of(repr->attribute("id")) && ( !docURI || (dir == docdir)))) { temp_string = repr->attribute("inkscape:export-filename"); - if (temp_string == NULL || (filename_ext != temp_string)) { + if (temp_string == nullptr || (filename_ext != temp_string)) { repr->setAttribute("inkscape:export-filename", filename_ext.c_str()); modified = true; } } temp_string = repr->attribute("inkscape:export-xdpi"); - if (temp_string == NULL || xdpi != atof(temp_string)) { + if (temp_string == nullptr || xdpi != atof(temp_string)) { sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi); modified = true; } temp_string = repr->attribute("inkscape:export-ydpi"); - if (temp_string == NULL || ydpi != atof(temp_string)) { + if (temp_string == nullptr || ydpi != atof(temp_string)) { sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi); modified = true; } @@ -1379,7 +1379,7 @@ void Export::onBrowse () file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fs)); - gchar * utf8file = g_filename_to_utf8( file, -1, NULL, NULL, NULL ); + gchar * utf8file = g_filename_to_utf8( file, -1, nullptr, nullptr, nullptr ); filename_entry.set_text (utf8file); filename_entry.set_position(strlen(utf8file)); @@ -1446,7 +1446,7 @@ void Export::detectSize() { for (int i = 0; i < SELECTION_NUMBER_OF + 1 && key == SELECTION_NUMBER_OF && - SP_ACTIVE_DESKTOP != NULL; + SP_ACTIVE_DESKTOP != nullptr; i++) { switch (this_test[i]) { case SELECTION_SELECTION: diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index 14248cc4b..2413d51e0 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -150,24 +150,24 @@ void ExtensionEditor::on_pagelist_selection_changed(void) Inkscape::Extension::Extension * ext = Inkscape::Extension::db.get(id.c_str()); /* Make sure we have all the widges */ - Gtk::Widget * info = NULL; - Gtk::Widget * help = NULL; - Gtk::Widget * params = NULL; + Gtk::Widget * info = nullptr; + Gtk::Widget * help = nullptr; + Gtk::Widget * params = nullptr; - if (ext != NULL) { + if (ext != nullptr) { info = ext->get_info_widget(); help = ext->get_help_widget(); params = ext->get_params_widget(); } /* Place them in the pages */ - if (info != NULL) { + if (info != nullptr) { _notebook_info.add(*info); } - if (help != NULL) { + if (help != nullptr) { _notebook_help.add(*help); } - if (params != NULL) { + if (params != nullptr) { _notebook_params.add(*params); } diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index c8c508ee3..4466c888a 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -210,7 +210,7 @@ void SVGPreview::showImage(Glib::ustring &theFileName) gint previewHeight = 600; // Get some image info. Smart pointer does not need to be deleted - Glib::RefPtr<Gdk::Pixbuf> img(NULL); + Glib::RefPtr<Gdk::Pixbuf> img(nullptr); try { img = Gdk::Pixbuf::create_from_file(fileName); @@ -588,8 +588,8 @@ SVGPreview::SVGPreview() // \FIXME Why?!!?? if (!Inkscape::Application::exists()) Inkscape::Application::create("", false); - document = NULL; - viewerGtk = NULL; + document = nullptr; + viewerGtk = nullptr; set_size_request(150, 150); showingNoPreview = false; } @@ -695,7 +695,7 @@ FileOpenDialogImplGtk::FileOpenDialogImplGtk(Gtk::Window &parentWindow, const Gl set_local_only(false); /* Initialize to Autodetect */ - extension = NULL; + extension = nullptr; /* No filename to start out with */ myFilename = ""; @@ -747,7 +747,7 @@ void FileOpenDialogImplGtk::addFilterMenu(Glib::ustring name, Glib::ustring patt auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_(name.c_str())); allFilter->add_pattern(pattern); - extensionMap[Glib::ustring(_("All Files"))] = NULL; + extensionMap[Glib::ustring(_("All Files"))] = nullptr; add_filter(allFilter); } @@ -761,7 +761,7 @@ void FileOpenDialogImplGtk::createFilterMenu() auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_("All Files")); allFilter->add_pattern("*"); - extensionMap[Glib::ustring(_("All Files"))] = NULL; + extensionMap[Glib::ustring(_("All Files"))] = nullptr; add_filter(allFilter); } else { auto allInkscapeFilter = Gtk::FileFilter::create(); @@ -779,19 +779,19 @@ void FileOpenDialogImplGtk::createFilterMenu() auto allBitmapFilter = Gtk::FileFilter::create(); allBitmapFilter->set_name(_("All Bitmaps")); - extensionMap[Glib::ustring(_("All Inkscape Files"))] = NULL; + extensionMap[Glib::ustring(_("All Inkscape Files"))] = nullptr; add_filter(allInkscapeFilter); - extensionMap[Glib::ustring(_("All Files"))] = NULL; + extensionMap[Glib::ustring(_("All Files"))] = nullptr; add_filter(allFilter); - extensionMap[Glib::ustring(_("All Images"))] = NULL; + extensionMap[Glib::ustring(_("All Images"))] = nullptr; add_filter(allImageFilter); - extensionMap[Glib::ustring(_("All Vectors"))] = NULL; + extensionMap[Glib::ustring(_("All Vectors"))] = nullptr; add_filter(allVectorFilter); - extensionMap[Glib::ustring(_("All Bitmaps"))] = NULL; + extensionMap[Glib::ustring(_("All Bitmaps"))] = nullptr; add_filter(allBitmapFilter); // patterns added dynamically below @@ -958,7 +958,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl set_local_only(false); /* Initialize to Autodetect */ - extension = NULL; + extension = nullptr; /* No filename to start out with */ myFilename = ""; @@ -1004,7 +1004,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl set_extra_widget(childBox); // Let's do some customization - fileNameEntry = NULL; + fileNameEntry = nullptr; Gtk::Container *cont = get_toplevel(); std::vector<Gtk::Entry *> entries; findEntryWidgets(cont, entries); @@ -1132,7 +1132,7 @@ void FileSaveDialogImplGtk::addFileType(Glib::ustring name, Glib::ustring patter FileType guessType; guessType.name = name; guessType.pattern = pattern; - guessType.extension = NULL; + guessType.extension = nullptr; fileTypeComboBox.append(guessType.name); fileTypes.push_back(guessType); @@ -1170,7 +1170,7 @@ void FileSaveDialogImplGtk::createFileTypeMenu() FileType guessType; guessType.name = _("Guess from extension"); guessType.pattern = "*"; - guessType.extension = NULL; + guessType.extension = nullptr; fileTypeComboBox.append(guessType.name); fileTypes.push_back(guessType); @@ -1205,7 +1205,7 @@ bool FileSaveDialogImplGtk::show() prefs->setBool("/dialogs/save_as/append_extension", fileTypeCheckbox.get_active()); } - Inkscape::Extension::store_file_extension_in_prefs((extension != NULL ? extension->get_id() : ""), save_method); + Inkscape::Extension::store_file_extension_in_prefs((extension != nullptr ? extension->get_id() : ""), save_method); cleanup(true); @@ -1326,7 +1326,7 @@ void FileSaveDialogImplGtk::updateNameAndExtension() myFilename = tmp; } - Inkscape::Extension::Output *newOut = extension ? dynamic_cast<Inkscape::Extension::Output *>(extension) : 0; + Inkscape::Extension::Output *newOut = extension ? dynamic_cast<Inkscape::Extension::Output *>(extension) : nullptr; if (fileTypeCheckbox.get_active() && newOut) { // Append the file extension if it's not already present and display it in the file name entry field appendExtension(myFilename, newOut); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index d09b371d3..65018efa7 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -67,7 +67,7 @@ findExpanderWidgets(Gtk::Container *parent, class FileType { public: - FileType(): name(), pattern(),extension(0) {} + FileType(): name(), pattern(),extension(nullptr) {} ~FileType() {} Glib::ustring name; Glib::ustring pattern; diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index f09546bdc..dd387c37e 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -48,9 +48,9 @@ FillAndStroke::FillAndStroke() UI::Widget::SimpleFilterModifier::BLUR | UI::Widget::SimpleFilterModifier::OPACITY ), deskTrack(), - targetDesktop(0), - fillWdgt(0), - strokeWdgt(0), + targetDesktop(nullptr), + fillWdgt(nullptr), + strokeWdgt(nullptr), desktopChangeConn() { Gtk::Box *contents = _getContents(); @@ -81,7 +81,7 @@ FillAndStroke::FillAndStroke() FillAndStroke::~FillAndStroke() { - _composite_settings.setSubject(NULL); + _composite_settings.setSubject(nullptr); desktopChangeConn.disconnect(); deskTrack.disconnect(); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index acf73554d..db930fe8e 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -174,7 +174,7 @@ public: template< typename T> class ComboWithTooltip : public Gtk::EventBox { public: - ComboWithTooltip<T>(T default_value, const Util::EnumDataConverter<T>& c, const SPAttributeEnum a = SP_ATTR_INVALID, char* tip_text = NULL) + ComboWithTooltip<T>(T default_value, const Util::EnumDataConverter<T>& c, const SPAttributeEnum a = SP_ATTR_INVALID, char* tip_text = nullptr) { if (tip_text) { set_tooltip_text(tip_text); @@ -373,7 +373,7 @@ public: class FilterEffectsDialog::MatrixAttr : public Gtk::Frame, public AttrWidget { public: - MatrixAttr(const SPAttributeEnum a, char* tip_text = NULL) + MatrixAttr(const SPAttributeEnum a, char* tip_text = nullptr) : AttrWidget(a), _locked(false) { _model = Gtk::ListStore::create(_columns); @@ -465,7 +465,7 @@ private: _tree.remove_all_columns(); - std::vector<gdouble>* values = NULL; + std::vector<gdouble>* values = nullptr; if(SP_IS_FECOLORMATRIX(o)) values = &SP_FECOLORMATRIX(o)->values; else if(SP_IS_FECONVOLVEMATRIX(o)) @@ -607,7 +607,7 @@ private: double _angle_store; }; -static Inkscape::UI::Dialog::FileOpenDialog * selectFeImageFileInstance = NULL; +static Inkscape::UI::Dialog::FileOpenDialog * selectFeImageFileInstance = nullptr; //Displays a chooser for feImage input //It may be a filename or the id for an SVG Element @@ -805,7 +805,7 @@ public: // CheckButton CheckButtonAttr* add_checkbutton(bool def, const SPAttributeEnum attr, const Glib::ustring& label, - const Glib::ustring& tv, const Glib::ustring& fv, char* tip_text = NULL) + const Glib::ustring& tv, const Glib::ustring& fv, char* tip_text = nullptr) { CheckButtonAttr* cb = new CheckButtonAttr(def, label, tv, fv, attr, tip_text); add_widget(cb, ""); @@ -814,7 +814,7 @@ public: } // ColorButton - ColorButton* add_color(unsigned int def, const SPAttributeEnum attr, const Glib::ustring& label, char* tip_text = NULL) + ColorButton* add_color(unsigned int def, const SPAttributeEnum attr, const Glib::ustring& label, char* tip_text = nullptr) { ColorButton* col = new ColorButton(def, attr, tip_text); add_widget(col, label); @@ -842,7 +842,7 @@ public: // SpinScale SpinScale* add_spinscale(double def, const SPAttributeEnum attr, const Glib::ustring& label, - const double lo, const double hi, const double step_inc, const double climb, const int digits, char* tip_text = NULL) + const double lo, const double hi, const double step_inc, const double climb, const int digits, char* tip_text = nullptr) { Glib::ustring tip_text2; if (tip_text) @@ -869,7 +869,7 @@ public: // SpinButton SpinButtonAttr* add_spinbutton(double defalt_value, const SPAttributeEnum attr, const Glib::ustring& label, const double lo, const double hi, const double step_inc, - const double climb, const int digits, char* tip = NULL) + const double climb, const int digits, char* tip = nullptr) { SpinButtonAttr* sb = new SpinButtonAttr(lo, hi, step_inc, climb, digits, attr, defalt_value, tip); add_widget(sb, label); @@ -880,7 +880,7 @@ public: // DualSpinButton DualSpinButton* add_dualspinbutton(char* defalt_value, const SPAttributeEnum attr, const Glib::ustring& label, const double lo, const double hi, const double step_inc, - const double climb, const int digits, char* tip1 = NULL, char* tip2 = NULL) + const double climb, const int digits, char* tip1 = nullptr, char* tip2 = nullptr) { DualSpinButton* dsb = new DualSpinButton(defalt_value, lo, hi, step_inc, climb, digits, attr, tip1, tip2); add_widget(dsb, label); @@ -891,7 +891,7 @@ public: // MultiSpinButton MultiSpinButton* add_multispinbutton(double def1, double def2, const SPAttributeEnum attr1, const SPAttributeEnum attr2, const Glib::ustring& label, const double lo, const double hi, - const double step_inc, const double climb, const int digits, char* tip1 = NULL, char* tip2 = NULL) + const double step_inc, const double climb, const int digits, char* tip1 = nullptr, char* tip2 = nullptr) { std::vector<SPAttributeEnum> attrs; attrs.push_back(attr1); @@ -913,7 +913,7 @@ public: } MultiSpinButton* add_multispinbutton(double def1, double def2, double def3, const SPAttributeEnum attr1, const SPAttributeEnum attr2, const SPAttributeEnum attr3, const Glib::ustring& label, const double lo, - const double hi, const double step_inc, const double climb, const int digits, char* tip1 = NULL, char* tip2 = NULL, char* tip3 = NULL) + const double hi, const double step_inc, const double climb, const int digits, char* tip1 = nullptr, char* tip2 = nullptr, char* tip3 = nullptr) { std::vector<SPAttributeEnum> attrs; attrs.push_back(attr1); @@ -950,7 +950,7 @@ public: // ComboBoxEnum template<typename T> ComboBoxEnum<T>* add_combo(T default_value, const SPAttributeEnum attr, const Glib::ustring& label, - const Util::EnumDataConverter<T>& conv, char* tip_text = NULL) + const Util::EnumDataConverter<T>& conv, char* tip_text = nullptr) { ComboWithTooltip<T>* combo = new ComboWithTooltip<T>(default_value, conv, attr, tip_text); add_widget(combo, label); @@ -961,7 +961,7 @@ public: // Entry EntryAttr* add_entry(const SPAttributeEnum attr, const Glib::ustring& label, - char* tip_text = NULL) + char* tip_text = nullptr) { EntryAttr* entry = new EntryAttr(attr, tip_text); add_widget(entry, label); @@ -1014,7 +1014,7 @@ public: _settings(d, _box, sigc::mem_fun(*this, &ComponentTransferValues::set_func_attr), COMPONENTTRANSFER_TYPE_ERROR), _type(ComponentTransferTypeConverter, SP_ATTR_TYPE, false), _channel(channel), - _funcNode(NULL) + _funcNode(nullptr) { set_shadow_type(Gtk::SHADOW_IN); add(_box); @@ -1044,7 +1044,7 @@ public: // FuncNode can be in any order so we must search to find correct one. SPFeFuncNode* find_node(SPFeComponentTransfer* ct) { - SPFeFuncNode* funcNode = NULL; + SPFeFuncNode* funcNode = nullptr; bool found = false; for(auto& node: ct->children) { funcNode = SP_FEFUNCNODE(&node); @@ -1054,7 +1054,7 @@ public: } } if( !found ) - funcNode = NULL; + funcNode = nullptr; return funcNode; } @@ -1079,7 +1079,7 @@ public: SPFilterPrimitive* prim = _dialog._primitive_list.get_selected(); if(prim) { Inkscape::XML::Document *xml_doc = prim->document->getReprDoc(); - Inkscape::XML::Node *repr = NULL; + Inkscape::XML::Node *repr = nullptr; switch(_channel) { case SPFeFuncNode::R: repr = xml_doc->createElement("svg:feFuncR"); @@ -1323,7 +1323,7 @@ static Gtk::Menu * create_popup_menu(Gtk::Widget& parent, /*** FilterModifier ***/ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) - : _desktop(NULL), + : _desktop(nullptr), _deskTrack(), _dialog(d), _add(_("_New"), true), @@ -1402,7 +1402,7 @@ void FilterEffectsDialog::FilterModifier::setTargetDesktop(SPDesktop *desktop) _selectModifiedConn.disconnect(); _doc_replaced.disconnect(); _resource_changed.disconnect(); - _dialog.setDesktop(NULL); + _dialog.setDesktop(nullptr); } _desktop = desktop; if (desktop) { @@ -1472,7 +1472,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel) SP_ITEM(obj)->bbox_valid = FALSE; used.insert(style->getFilter()); } else { - used.insert(0); + used.insert(nullptr); } } @@ -1539,13 +1539,13 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri /* If this filter is the only one used in the selection, unset it */ if((*iter)[_columns.sel] == 1) - filter = 0; + filter = nullptr; auto itemlist= sel->items(); for(auto i=itemlist.begin(); itemlist.end() != i; ++i) { SPItem * item = *i; SPStyle *style = item->style; - g_assert(style != NULL); + g_assert(style != nullptr); if (filter) { sp_style_set_property_url(item, "filter", filter, false); @@ -1603,7 +1603,7 @@ SPFilter* FilterEffectsDialog::FilterModifier::get_selected_filter() return (*i)[_columns.filter]; } - return 0; + return nullptr; } void FilterEffectsDialog::FilterModifier::select_filter(const SPFilter* filter) @@ -1622,7 +1622,7 @@ void FilterEffectsDialog::FilterModifier::select_filter(const SPFilter* filter) void FilterEffectsDialog::FilterModifier::filter_list_button_release(GdkEventButton* event) { if((event->type == GDK_BUTTON_RELEASE) && (event->button == 3)) { - const bool sensitive = get_selected_filter() != NULL; + const bool sensitive = get_selected_filter() != nullptr; auto items = _menu->get_children(); items[0]->set_sensitive(sensitive); items[1]->set_sensitive(sensitive); @@ -1712,7 +1712,7 @@ void FilterEffectsDialog::FilterModifier::rename_filter() FilterEffectsDialog::CellRendererConnection::CellRendererConnection() : Glib::ObjectBase(typeid(CellRendererConnection)), - _primitive(*this, "primitive", 0), + _primitive(*this, "primitive", nullptr), _text_width(0) {} @@ -1896,7 +1896,7 @@ SPFilterPrimitive* FilterEffectsDialog::PrimitiveList::get_selected() return (*i)[_columns.primitive]; } - return 0; + return nullptr; } void FilterEffectsDialog::PrimitiveList::select(SPFilterPrimitive* prim) @@ -1913,7 +1913,7 @@ void FilterEffectsDialog::PrimitiveList::remove_selected() SPFilterPrimitive* prim = get_selected(); if(prim) { - _observer->set(0); + _observer->set(nullptr); //XML Tree being used directly here while it shouldn't be. sp_repr_unparent(prim->getRepr()); @@ -2306,7 +2306,7 @@ bool FilterEffectsDialog::PrimitiveList::on_button_press_event(GdkEventButton* e const int x = (int)e->x, y = (int)e->y; int cx, cy; - _drag_prim = 0; + _drag_prim = nullptr; if(get_path_at_pos(x, y, path, col, cx, cy)) { Gtk::TreeIter iter = _model->get_iter(path); @@ -2397,7 +2397,7 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* int cx, cy; if(get_path_at_pos((int)e->x, (int)e->y, path, col, cx, cy)) { - const gchar *in_val = 0; + const gchar *in_val = nullptr; Glib::ustring result; Gtk::TreeIter target_iter = _model->get_iter(path); target = (*target_iter)[_columns.primitive]; @@ -2487,7 +2487,7 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* } if((e->type == GDK_BUTTON_RELEASE) && (e->button == 3)) { - const bool sensitive = get_selected() != NULL; + const bool sensitive = get_selected() != nullptr; auto items = _primitive_menu->get_children(); items[0]->set_sensitive(sensitive); items[1]->set_sensitive(sensitive); @@ -2509,20 +2509,20 @@ static void check_single_connection(SPFilterPrimitive* prim, const int result) { if (prim && (result >= 0)) { if (prim->image_in == result) { - prim->getRepr()->setAttribute("in", 0); + prim->getRepr()->setAttribute("in", nullptr); } if (SP_IS_FEBLEND(prim)) { if (SP_FEBLEND(prim)->in2 == result) { - prim->getRepr()->setAttribute("in2", 0); + prim->getRepr()->setAttribute("in2", nullptr); } } else if (SP_IS_FECOMPOSITE(prim)) { if (SP_FECOMPOSITE(prim)->in2 == result) { - prim->getRepr()->setAttribute("in2", 0); + prim->getRepr()->setAttribute("in2", nullptr); } } else if (SP_IS_FEDISPLACEMENTMAP(prim)) { if (SP_FEDISPLACEMENTMAP(prim)->in2 == result) { - prim->getRepr()->setAttribute("in2", 0); + prim->getRepr()->setAttribute("in2", nullptr); } } } diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index d172eca57..a010ac667 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -110,7 +110,7 @@ Find::Find() button_replace(_("_Replace All"), _("Replace all matches")), _action_replace(false), blocked(false), - desktop(NULL), + desktop(nullptr), deskTrack() { @@ -334,13 +334,13 @@ bool Find::find_strcmp(const gchar *str, const gchar *find, bool exact, bool cas bool Find::item_text_match (SPItem *item, const gchar *find, bool exact, bool casematch, bool replace/*=false*/) { - if (item->getRepr() == NULL) { + if (item->getRepr() == nullptr) { return false; } if (dynamic_cast<SPText *>(item) || dynamic_cast<SPFlowtext *>(item)) { const gchar *item_text = sp_te_get_string_multiline (item); - if (item_text == NULL) { + if (item_text == nullptr) { return false; } bool found = find_strcmp(item_text, find, exact, casematch); @@ -379,7 +379,7 @@ bool Find::item_text_match (SPItem *item, const gchar *find, bool exact, bool ca bool Find::item_id_match (SPItem *item, const gchar *id, bool exact, bool casematch, bool replace/*=false*/) { - if (item->getRepr() == NULL) { + if (item->getRepr() == nullptr) { return false; } @@ -388,7 +388,7 @@ bool Find::item_id_match (SPItem *item, const gchar *id, bool exact, bool casema } const gchar *item_id = item->getRepr()->attribute("id"); - if (item_id == NULL) { + if (item_id == nullptr) { return false; } @@ -408,12 +408,12 @@ bool Find::item_id_match (SPItem *item, const gchar *id, bool exact, bool casema bool Find::item_style_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace/*=false*/) { - if (item->getRepr() == NULL) { + if (item->getRepr() == nullptr) { return false; } gchar *item_style = g_strdup(item->getRepr()->attribute("style")); - if (item_style == NULL) { + if (item_style == nullptr) { return false; } @@ -436,13 +436,13 @@ bool Find::item_attr_match(SPItem *item, const gchar *text, bool exact, bool /*c { bool found = false; - if (item->getRepr() == NULL) { + if (item->getRepr() == nullptr) { return false; } gchar *attr_value = g_strdup(item->getRepr()->attribute(text)); if (exact) { - found = (attr_value != NULL); + found = (attr_value != nullptr); } else { found = item->getRepr()->matchAttributeName(text); } @@ -460,7 +460,7 @@ bool Find::item_attrvalue_match(SPItem *item, const gchar *text, bool exact, boo { bool ret = false; - if (item->getRepr() == NULL) { + if (item->getRepr() == nullptr) { return false; } @@ -492,12 +492,12 @@ bool Find::item_font_match(SPItem *item, const gchar *text, bool exact, bool cas { bool ret = false; - if (item->getRepr() == NULL) { + if (item->getRepr() == nullptr) { return false; } const gchar *item_style = item->getRepr()->attribute("style"); - if (item_style == NULL) { + if (item_style == nullptr) { return false; } @@ -558,7 +558,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); if (item_text_match(item, text, exact, casematch)) { if (out.end()==find(out.begin(),out.end(), *i)) { out.push_back(*i); @@ -597,7 +597,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); if (item_style_match(item, text, exact, casematch)) { if (out.end()==find(out.begin(),out.end(), *i)){ out.push_back(*i); @@ -614,7 +614,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); if (item_attr_match(item, text, exact, casematch)) { if (out.end()==find(out.begin(),out.end(), *i)) { out.push_back(*i); @@ -631,7 +631,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); if (item_attrvalue_match(item, text, exact, casematch)) { if (out.end()==find(out.begin(),out.end(), *i)) { out.push_back(*i); @@ -648,7 +648,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); if (item_font_match(item, text, exact, casematch)) { if (out.end()==find(out.begin(),out.end(),*i)) { out.push_back(*i); @@ -715,7 +715,7 @@ std::vector<SPItem*> Find::filter_types (std::vector<SPItem*> &l) for(std::vector<SPItem*>::const_reverse_iterator i=l.rbegin(); l.rend() != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); if (item_type_match(item)) { n.push_back(*i); } @@ -759,7 +759,7 @@ std::vector<SPItem*> &Find::all_selection_items (Inkscape::Selection *s, std::ve for(auto i=boost::rbegin(itemlist); boost::rend(itemlist) != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); if (item && !item->cloned && !desktop->isLayer(item)) { if (!ancestor || ancestor->isAncestorOf(item)) { if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { @@ -816,7 +816,7 @@ void Find::onAction() if (check_scope_layer.get_active()) { l = all_selection_items (desktop->selection, l, desktop->currentLayer(), hidden, locked); } else { - l = all_selection_items (desktop->selection, l, NULL, hidden, locked); + l = all_selection_items (desktop->selection, l, nullptr, hidden, locked); } } else { if (check_scope_layer.get_active()) { @@ -853,7 +853,7 @@ void Find::onAction() selection->setList(n); SPObject *obj = n[0]; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); scroll_to_show_item(desktop, item); if (_action_replace) { diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 9abad3e7b..0cc3af606 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -125,7 +125,7 @@ bool FloatingBehavior::_trans_timer (void) { FloatingBehavior::~FloatingBehavior() { delete _d; - _d = 0; + _d = nullptr; } Behavior * diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index da7d14d9c..7ec7cb3e1 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -155,7 +155,7 @@ std::vector<SPItem*> FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli } else if (SP_IS_TEXTPATH(item)) { SPTextPath const *textpath = SP_TEXTPATH(item); - if (textpath->originalPath != NULL) { + if (textpath->originalPath != nullptr) { family = SP_TEXT(item->parent)->layout.getFontFamily(0); setFontSpans.insert(family); } @@ -167,7 +167,7 @@ std::vector<SPItem*> FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli while (parent_text && !SP_IS_TEXT(parent_text)) { parent_text = parent_text->parent; } - if (parent_text != NULL) { + if (parent_text != nullptr) { family = SP_TEXT(parent_text)->layout.getFontFamily(0); // Add all the spans fonts to the set for (unsigned int f=0; f < parent_text->children.size(); f++) { @@ -178,7 +178,7 @@ std::vector<SPItem*> FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli } if (style) { - gchar const *style_font = NULL; + gchar const *style_font = nullptr; if (style->font_family.set) style_font = style->font_family.value; else if (style->font_specification.set) diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 193ff232d..4737913f6 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -511,7 +511,7 @@ void GlyphsPanel::setTargetDesktop(SPDesktop *desktop) // Append selected glyphs to selected text void GlyphsPanel::insertText() { - SPItem *textItem = 0; + SPItem *textItem = nullptr; auto itemlist= targetDesktop->selection->items(); for(auto i=itemlist.begin(); itemlist.end() != i; ++i) { if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) { @@ -541,7 +541,7 @@ void GlyphsPanel::insertText() if (str) { combined = str; g_free(str); - str = 0; + str = nullptr; } combined += glyphs; sp_te_set_repr_text_multiline(textItem, combined.c_str()); @@ -644,7 +644,7 @@ void GlyphsPanel::rebuild() { Glib::ustring fontspec = fontSelector->get_fontspec(); - font_instance* font = 0; + font_instance* font = nullptr; if( !fontspec.empty() ) { font = font_factory::Default()->FaceFromFontSpecification( fontspec.c_str() ); } diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 96e6acb3c..91e93de93 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -358,7 +358,7 @@ void GridArrangeTab::on_row_spinbutton_changed() updating = true; SPDesktop *desktop = Parent->getDesktop(); - Inkscape::Selection *selection = desktop ? desktop->selection : 0; + Inkscape::Selection *selection = desktop ? desktop->selection : nullptr; g_return_if_fail( selection ); int selcount = (int) boost::distance(selection->items()); @@ -383,7 +383,7 @@ void GridArrangeTab::on_col_spinbutton_changed() // in turn, prevent listener from responding updating = true; SPDesktop *desktop = Parent->getDesktop(); - Inkscape::Selection *selection = desktop ? desktop->selection : 0; + Inkscape::Selection *selection = desktop ? desktop->selection : nullptr; g_return_if_fail(selection); int selcount = (int) boost::distance(selection->items()); @@ -522,7 +522,7 @@ void GridArrangeTab::updateSelection() // in turn, prevent listener from responding updating = true; SPDesktop *desktop = Parent->getDesktop(); - Inkscape::Selection *selection = desktop ? desktop->selection : 0; + Inkscape::Selection *selection = desktop ? desktop->selection : nullptr; std::vector<SPItem*> items; if (selection) { items.insert(items.end(), selection->items().begin(), selection->items().end()); @@ -589,7 +589,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) SPDesktop *desktop = Parent->getDesktop(); - Inkscape::Selection *selection = desktop ? desktop->selection : 0; + Inkscape::Selection *selection = desktop ? desktop->selection : nullptr; g_return_if_fail( selection ); int selcount = 1; if (!selection->isEmpty()) { diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 47f6f3121..e7f6e0040 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -91,15 +91,15 @@ void IconPreviewPanel::on_button_clicked(int which) IconPreviewPanel::IconPreviewPanel() : UI::Widget::Panel("/dialogs/iconpreview", SP_VERB_VIEW_ICON_PREVIEW), deskTrack(), - desktop(0), - document(0), - timer(0), - renderTimer(0), + desktop(nullptr), + document(nullptr), + timer(nullptr), + renderTimer(nullptr), pending(false), minDelay(0.1), targetId(), hot(1), - selectionButton(0), + selectionButton(nullptr), desktopChangeConn(), docReplacedConn(), docModConn(), @@ -152,8 +152,8 @@ IconPreviewPanel::IconPreviewPanel() : char *label = g_strdup_printf(_("%d x %d"), sizes[i], sizes[i]); labels[i] = new Glib::ustring(label); g_free(label); - pixMem[i] = 0; - images[i] = 0; + pixMem[i] = nullptr; + images[i] = nullptr; } @@ -169,7 +169,7 @@ IconPreviewPanel::IconPreviewPanel() : Gtk::VBox *verts = new Gtk::VBox(); - Gtk::HBox *horiz = 0; + Gtk::HBox *horiz = nullptr; int previous = 0; int avail = 0; for ( int i = numEntries - 1; i >= 0; --i ) { @@ -177,7 +177,7 @@ IconPreviewPanel::IconPreviewPanel() : pixMem[i] = new guchar[sizes[i] * stride]; memset( pixMem[i], 0x00, sizes[i] * stride ); - GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], stride, /*(GdkPixbufDestroyNotify)g_free*/NULL, NULL ); + GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], stride, /*(GdkPixbufDestroyNotify)g_free*/nullptr, nullptr ); GtkImage* img = GTK_IMAGE( gtk_image_new_from_pixbuf( pb ) ); images[i] = Glib::wrap(img); Glib::ustring label(*labels[i]); @@ -206,9 +206,9 @@ IconPreviewPanel::IconPreviewPanel() : } else { int pad = 12; if ((avail < pad) || ((sizes[i] > avail) && (sizes[i] < previous))) { - horiz = 0; + horiz = nullptr; } - if ((horiz == 0) && (sizes[i] <= previous)) { + if ((horiz == nullptr) && (sizes[i] <= previous)) { avail = previous; } if (sizes[i] <= avail) { @@ -221,7 +221,7 @@ IconPreviewPanel::IconPreviewPanel() : avail -= sizes[i]; avail -= pad; // a little extra for padding } else { - horiz = 0; + horiz = nullptr; verts->pack_end(*(buttons[i]), Gtk::PACK_SHRINK); } } @@ -254,16 +254,16 @@ IconPreviewPanel::IconPreviewPanel() : IconPreviewPanel::~IconPreviewPanel() { - setDesktop(0); + setDesktop(nullptr); if (timer) { timer->stop(); delete timer; - timer = 0; + timer = nullptr; } if ( renderTimer ) { renderTimer->stop(); delete renderTimer; - renderTimer = 0; + renderTimer = nullptr; } selChangedConn.disconnect(); @@ -298,7 +298,7 @@ void IconPreviewPanel::setDesktop( SPDesktop* desktop ) { Panel::setDesktop(desktop); - SPDocument *newDoc = (desktop) ? desktop->doc() : 0; + SPDocument *newDoc = (desktop) ? desktop->doc() : nullptr; if ( desktop != this->desktop ) { docReplacedConn.disconnect(); @@ -348,10 +348,10 @@ void IconPreviewPanel::refreshPreview() g_message( "%s Refreshing preview.", getTimestr().c_str() ); #endif // ICON_VERBOSE bool hold = Inkscape::Preferences::get()->getBool("/iconpreview/selectionHold", true); - SPObject *target = 0; + SPObject *target = nullptr; if ( selectionButton && selectionButton->get_active() ) { - target = (hold && !targetId.empty()) ? desktop->doc()->getObjectById( targetId.c_str() ) : 0; + target = (hold && !targetId.empty()) ? desktop->doc()->getObjectById( targetId.c_str() ) : nullptr; if ( !target ) { targetId.clear(); Inkscape::Selection * sel = desktop->getSelection(); @@ -492,7 +492,7 @@ sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing, unsigned &stride) { bool const dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg"); - guchar *px = NULL; + guchar *px = nullptr; if (doc) { SPObject *object = doc->getObjectById(name); @@ -501,7 +501,7 @@ sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing, // Find bbox in document Geom::OptRect dbox = item->documentVisualBounds(); - if ( object->parent == NULL ) + if ( object->parent == nullptr ) { dbox = Geom::Rect(Geom::Point(0, 0), Geom::Point(doc->getWidth().value("px"), doc->getHeight().value("px"))); @@ -582,7 +582,7 @@ sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing, CAIRO_FORMAT_ARGB32, psize, psize, stride); Inkscape::DrawingContext dc(s, ua.min()); - SPNamedView *nv = sp_document_namedview(doc, NULL); + SPNamedView *nv = sp_document_namedview(doc, nullptr); float bg_r = SP_RGBA32_R_F(nv->pagecolor); float bg_g = SP_RGBA32_G_F(nv->pagecolor); float bg_b = SP_RGBA32_B_F(nv->pagecolor); @@ -639,7 +639,7 @@ void IconPreviewPanel::renderPreview( SPObject* obj ) if ( px ) { memcpy( pixMem[i], px, sizes[i] * stride ); g_free( px ); - px = 0; + px = nullptr; } else { memset( pixMem[i], 0, sizes[i] * stride ); } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index ee4082111..3261a0376 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -77,7 +77,7 @@ InkscapePreferences::InkscapePreferences() _minimum_height(0), _natural_width(0), _natural_height(0), - _current_page(0), + _current_page(nullptr), _init(true) { //get the width of a spinbutton @@ -251,7 +251,7 @@ void InkscapePreferences::AddPencilPowerStrokePressureStep(DialogPage &p, Glib:: static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatch *swatch) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) + if (desktop == nullptr) return; Inkscape::Selection *selection = desktop->getSelection(); @@ -305,7 +305,7 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const else p.add_group_header( _("Style of new objects")); PrefRadioButton* current = Gtk::manage( new PrefRadioButton); - current->init ( _("Last used style"), prefs_path + "/usecurrent", 1, true, 0); + current->init ( _("Last used style"), prefs_path + "/usecurrent", 1, true, nullptr); p.add_line( true, "", *current, "", _("Apply the style you last set on an object")); @@ -320,7 +320,7 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const // style swatch Gtk::Button* button = Gtk::manage( new Gtk::Button(_("Take from selection"), true)); - StyleSwatch *swatch = 0; + StyleSwatch *swatch = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getInt(prefs_path + "/usecurrent")) { @@ -344,7 +344,7 @@ void InkscapePreferences::initPageTools() _path_tools = _page_list.get_model()->get_path(iter_tools); _page_tools.add_group_header( _("Bounding box to use")); - _t_bbox_visual.init ( _("Visual bounding box"), "/tools/bounding_box", 0, false, 0); // 0 means visual + _t_bbox_visual.init ( _("Visual bounding box"), "/tools/bounding_box", 0, false, nullptr); // 0 means visual _page_tools.add_line( true, "", _t_bbox_visual, "", _("This bounding box includes stroke width, markers, filter margins, etc.")); _t_bbox_geometric.init ( _("Geometric bounding box"), "/tools/bounding_box", 1, true, &_t_bbox_visual); // 1 means geometric @@ -371,14 +371,14 @@ void InkscapePreferences::initPageTools() AddSelcueCheckbox(_page_selector, "/tools/select", false); AddGradientCheckbox(_page_selector, "/tools/select", false); _page_selector.add_group_header( _("When transforming, show")); - _t_sel_trans_obj.init ( _("Objects"), "/tools/select/show", "content", true, 0); + _t_sel_trans_obj.init ( _("Objects"), "/tools/select/show", "content", true, nullptr); _page_selector.add_line( true, "", _t_sel_trans_obj, "", _("Show the actual objects when moving or transforming")); _t_sel_trans_outl.init ( _("Box outline"), "/tools/select/show", "outline", false, &_t_sel_trans_obj); _page_selector.add_line( true, "", _t_sel_trans_outl, "", _("Show only a box outline of the objects when moving or transforming")); _page_selector.add_group_header( _("Per-object selection cue")); - _t_sel_cue_none.init ( C_("Selection cue", "None"), "/options/selcue/value", Inkscape::SelCue::NONE, false, 0); + _t_sel_cue_none.init ( C_("Selection cue", "None"), "/options/selcue/value", Inkscape::SelCue::NONE, false, nullptr); _page_selector.add_line( true, "", _t_sel_cue_none, "", _("No per-object selection indication")); _t_sel_cue_mark.init ( _("Mark"), "/options/selcue/value", Inkscape::SelCue::MARK, true, &_t_sel_cue_none); @@ -719,24 +719,24 @@ void InkscapePreferences::initPageUI() } // Windows - _win_save_geom.init ( _("Save and restore window geometry for each document"), "/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_FILE, true, 0); + _win_save_geom.init ( _("Save and restore window geometry for each document"), "/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_FILE, true, nullptr); _win_save_geom_prefs.init ( _("Remember and use last window's geometry"), "/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_LAST, false, &_win_save_geom); _win_save_geom_off.init ( _("Don't save window geometry"), "/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_NONE, false, &_win_save_geom); - _win_save_dialog_pos_on.init ( _("Save and restore dialogs status"), "/options/savedialogposition/value", 1, true, 0); + _win_save_dialog_pos_on.init ( _("Save and restore dialogs status"), "/options/savedialogposition/value", 1, true, nullptr); _win_save_dialog_pos_off.init ( _("Don't save dialogs status"), "/options/savedialogposition/value", 0, false, &_win_save_dialog_pos_on); - _win_dockable.init ( _("Dockable"), "/options/dialogtype/value", 1, true, 0); + _win_dockable.init ( _("Dockable"), "/options/dialogtype/value", 1, true, nullptr); _win_floating.init ( _("Floating"), "/options/dialogtype/value", 0, false, &_win_dockable); - _win_native.init ( _("Native open/save dialogs"), "/options/desktopintegration/value", 1, true, 0); + _win_native.init ( _("Native open/save dialogs"), "/options/desktopintegration/value", 1, true, nullptr); _win_gtk.init ( _("GTK open/save dialogs"), "/options/desktopintegration/value", 0, false, &_win_native); _win_hide_task.init ( _("Dialogs are hidden in taskbar"), "/options/dialogsskiptaskbar/value", true); _win_save_viewport.init ( _("Save and restore documents viewport"), "/options/savedocviewport/value", true); _win_zoom_resize.init ( _("Zoom when window is resized"), "/options/stickyzoom/value", false); - _win_ontop_none.init ( C_("Dialog on top", "None"), "/options/transientpolicy/value", 0, false, 0); + _win_ontop_none.init ( C_("Dialog on top", "None"), "/options/transientpolicy/value", 0, false, nullptr); _win_ontop_normal.init ( _("Normal"), "/options/transientpolicy/value", 1, true, &_win_ontop_none); _win_ontop_agressive.init ( _("Aggressive"), "/options/transientpolicy/value", 2, false, &_win_ontop_none); @@ -818,7 +818,7 @@ void InkscapePreferences::initPageUI() // Grids _page_grids.add_group_header( _("Line color when zooming out")); - _grids_no_emphasize_on_zoom.init( _("Minor grid line color"), "/options/grids/no_emphasize_when_zoomedout", 1, true, 0); + _grids_no_emphasize_on_zoom.init( _("Minor grid line color"), "/options/grids/no_emphasize_when_zoomedout", 1, true, nullptr); _page_grids.add_line( true, "", _grids_no_emphasize_on_zoom, "", _("The gridlines will be shown in minor grid line color"), false); _grids_emphasize_on_zoom.init( _("Major grid line color"), "/options/grids/no_emphasize_when_zoomedout", 0, false, &_grids_no_emphasize_on_zoom); _page_grids.add_line( true, "", _grids_emphasize_on_zoom, "", _("The gridlines will be shown in major grid line color"), false); @@ -1054,7 +1054,7 @@ void InkscapePreferences::initPageIO() _page_cms.add_line( true, _("Display profile:"), _cms_display_profile, "", profileTip, false); g_free(profileTip); - profileTip = 0; + profileTip = nullptr; _cms_from_display.init( _("Retrieve profile from display"), "/options/displayprofile/from_display", false); _page_cms.add_line( true, "", _cms_from_display, "", @@ -1224,7 +1224,7 @@ void InkscapePreferences::initPageBehavior() _markers_color_update.init ( _("Update marker color when object color changes"), "/options/markers/colorUpdateMarkers", true); // Selecting options - _sel_all.init ( _("Select in all layers"), "/options/kbselection/inlayer", PREFS_SELECTION_ALL, false, 0); + _sel_all.init ( _("Select in all layers"), "/options/kbselection/inlayer", PREFS_SELECTION_ALL, false, nullptr); _sel_current.init ( _("Select only within current layer"), "/options/kbselection/inlayer", PREFS_SELECTION_LAYER, true, &_sel_all); _sel_recursive.init ( _("Select in current layer and sublayers"), "/options/kbselection/inlayer", PREFS_SELECTION_LAYER_RECURSIVE, false, &_sel_all); _sel_hidden.init ( _("Ignore hidden objects and layers"), "/options/kbselection/onlyvisible", true); @@ -1259,7 +1259,7 @@ void InkscapePreferences::initPageBehavior() _trans_scale_corner.init ( _("Scale rounded corners in rectangles"), "/options/transform/rectcorners", false); _trans_gradient.init ( _("Transform gradients"), "/options/transform/gradient", true); _trans_pattern.init ( _("Transform patterns"), "/options/transform/pattern", false); - _trans_optimized.init ( _("Optimized"), "/options/preservetransform/value", 0, true, 0); + _trans_optimized.init ( _("Optimized"), "/options/preservetransform/value", 0, true, nullptr); _trans_preserved.init ( _("Preserved"), "/options/preservetransform/value", 1, false, &_trans_optimized); _page_transforms.add_line( false, "", _trans_scale_stroke, "", @@ -1374,13 +1374,13 @@ void InkscapePreferences::initPageBehavior() // Clones options _clone_option_parallel.init ( _("Move in parallel"), "/options/clonecompensation/value", - SP_CLONE_COMPENSATION_PARALLEL, true, 0); + SP_CLONE_COMPENSATION_PARALLEL, true, nullptr); _clone_option_stay.init ( _("Stay unmoved"), "/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED, false, &_clone_option_parallel); _clone_option_transform.init ( _("Move according to transform"), "/options/clonecompensation/value", SP_CLONE_COMPENSATION_NONE, false, &_clone_option_parallel); _clone_option_unlink.init ( _("Are unlinked"), "/options/cloneorphans/value", - SP_CLONE_ORPHANS_UNLINK, true, 0); + SP_CLONE_ORPHANS_UNLINK, true, nullptr); _clone_option_delete.init ( _("Are deleted"), "/options/cloneorphans/value", SP_CLONE_ORPHANS_DELETE, false, &_clone_option_unlink); @@ -1421,7 +1421,7 @@ void InkscapePreferences::initPageBehavior() _page_mask.add_group_header( _("Before applying")); - _mask_grouping_none.init( _("Do not group clipped/masked objects"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_NONE, true, 0); + _mask_grouping_none.init( _("Do not group clipped/masked objects"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_NONE, true, nullptr); _mask_grouping_separate.init( _("Put every clipped/masked object in its own group"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_SEPARATE, false, &_mask_grouping_none); _mask_grouping_all.init( _("Put all clipped/masked objects into one group"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_ALL, false, &_mask_grouping_none); @@ -1480,7 +1480,7 @@ void InkscapePreferences::initPageRendering() /* blur quality */ _blur_quality_best.init ( _("Best quality (slowest)"), "/options/blurquality/value", - BLUR_QUALITY_BEST, false, 0); + BLUR_QUALITY_BEST, false, nullptr); _blur_quality_better.init ( _("Better quality (slower)"), "/options/blurquality/value", BLUR_QUALITY_BETTER, false, &_blur_quality_best); _blur_quality_normal.init ( _("Average quality"), "/options/blurquality/value", @@ -1504,7 +1504,7 @@ void InkscapePreferences::initPageRendering() /* filter quality */ _filter_quality_best.init ( _("Best quality (slowest)"), "/options/filterquality/value", - Inkscape::Filters::FILTER_QUALITY_BEST, false, 0); + Inkscape::Filters::FILTER_QUALITY_BEST, false, nullptr); _filter_quality_better.init ( _("Better quality (slower)"), "/options/filterquality/value", Inkscape::Filters::FILTER_QUALITY_BETTER, false, &_filter_quality_best); _filter_quality_normal.init ( _("Average quality"), "/options/filterquality/value", @@ -1889,7 +1889,7 @@ void InkscapePreferences::onKBListKeyboardShortcuts() if (str) { shortcut_label = Glib::Markup::escape_text(str); g_free(str); - str = 0; + str = nullptr; } } // Add the verb to the group @@ -1955,7 +1955,7 @@ void InkscapePreferences::initPageSpellcheck() const AspellDictInfo *entry; int en_index = 0; int i = 0; - while ( (entry = aspell_dict_info_enumeration_next(dels)) != 0) + while ( (entry = aspell_dict_info_enumeration_next(dels)) != nullptr) { languages.push_back(Glib::ustring(entry->name)); langValues.push_back(Glib::ustring(entry->name)); @@ -2057,7 +2057,7 @@ void InkscapePreferences::initPageSystem() _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true); tmp = ""; - gchar** paths = 0; + gchar** paths = nullptr; gint count = 0; gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count); appendList( tmp, paths ); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 1cc55d88e..2a6e3040c 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -521,7 +521,7 @@ protected: static void AddDotSizeSpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value); static void AddBaseSimplifySpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value); static void AddPencilPowerStrokePressureStep(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, gint def_value); - static void AddNewObjectsStyle(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL); + static void AddNewObjectsStyle(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = nullptr); void on_pagelist_selection_changed(); void on_reset_open_recent_clicked(); diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index b6f9b8f01..34a8c3820 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -1218,7 +1218,7 @@ void InputDialogImpl::updateDeviceAxes(Glib::RefPtr<InputDevice const> device) } } } - updateTestAxes( device->getId(), 0 ); + updateTestAxes( device->getId(), nullptr ); } void InputDialogImpl::updateDeviceButtons(Glib::RefPtr<InputDevice const> device) @@ -1514,7 +1514,7 @@ void InputDialogImpl::updateTestAxes( Glib::ustring const& key, GdkDevice* dev ) Glib::ustring val = row[getCols().description]; Glib::RefPtr<InputDevice const> idev = row[getCols().device]; if ( !idev || (idev->getId() != key) ) { - dev = 0; + dev = nullptr; } } } diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index 29e1cb2bb..c5cc903c6 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -38,8 +38,8 @@ namespace UI { namespace Dialogs { KnotPropertiesDialog::KnotPropertiesDialog() - : _desktop(NULL), - _knotpoint(NULL), + : _desktop(nullptr), + _knotpoint(nullptr), _position_visible(false), _close_button(_("_Close"), true) { @@ -104,7 +104,7 @@ KnotPropertiesDialog::KnotPropertiesDialog() KnotPropertiesDialog::~KnotPropertiesDialog() { - _setDesktop(NULL); + _setDesktop(nullptr); } void KnotPropertiesDialog::showDialog(SPDesktop *desktop, const SPKnot *pt, Glib::ustring const unit_name) @@ -138,7 +138,7 @@ KnotPropertiesDialog::_apply() void KnotPropertiesDialog::_close() { - _setDesktop(NULL); + _setDesktop(nullptr); destroy_(); Glib::signal_idle().connect( sigc::bind_return( diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 4ab6e130e..256360cf9 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -35,9 +35,9 @@ namespace UI { namespace Dialogs { LayerPropertiesDialog::LayerPropertiesDialog() - : _strategy(NULL), - _desktop(NULL), - _layer(NULL), + : _strategy(nullptr), + _desktop(nullptr), + _layer(nullptr), _position_visible(false), _close_button(_("_Cancel"), true) { @@ -90,8 +90,8 @@ LayerPropertiesDialog::LayerPropertiesDialog() LayerPropertiesDialog::~LayerPropertiesDialog() { - _setDesktop(NULL); - _setLayer(NULL); + _setDesktop(nullptr); + _setLayer(nullptr); } void LayerPropertiesDialog::_showDialog(LayerPropertiesDialog::Strategy &strategy, @@ -116,7 +116,7 @@ void LayerPropertiesDialog::_showDialog(LayerPropertiesDialog::Strategy &strateg void LayerPropertiesDialog::_apply() { - g_assert(_strategy != NULL); + g_assert(_strategy != nullptr); _strategy->perform(*this); DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_NONE, @@ -128,8 +128,8 @@ LayerPropertiesDialog::_apply() void LayerPropertiesDialog::_close() { - _setLayer(NULL); - _setDesktop(NULL); + _setLayer(nullptr); + _setDesktop(nullptr); destroy_(); Glib::signal_idle().connect( sigc::bind_return( @@ -141,7 +141,7 @@ LayerPropertiesDialog::_close() void LayerPropertiesDialog::_setup_position_controls() { - if ( NULL == _layer || _desktop->currentRoot() == _layer ) { + if ( nullptr == _layer || _desktop->currentRoot() == _layer ) { // no layers yet, so option above/below/sublayer is useless return; } @@ -225,7 +225,7 @@ LayerPropertiesDialog::_setup_layers_controls() { if ( root ) { SPObject* target = _desktop->currentLayer(); _store->clear(); - _addLayer( document, SP_OBJECT(root), 0, target, 0 ); + _addLayer( document, SP_OBJECT(root), nullptr, target, 0 ); } _layout_table.remove(_layer_name_entry); @@ -276,7 +276,7 @@ void LayerPropertiesDialog::_addLayer( SPDocument* doc, SPObject* layer, Gtk::Tr SPObject* LayerPropertiesDialog::_selectedLayer() { - SPObject* obj = 0; + SPObject* obj = nullptr; Gtk::TreeModel::iterator iter = _tree.get_selection()->get_selected(); if ( iter ) { @@ -347,7 +347,7 @@ void LayerPropertiesDialog::Create::setup(LayerPropertiesDialog &dialog) { // Set the initial name to the "next available" layer name LayerManager *mgr = dialog._desktop->layer_manager; - Glib::ustring newName = mgr->getNextLayerName(NULL, dialog._desktop->currentLayer()->label()); + Glib::ustring newName = mgr->getNextLayerName(nullptr, dialog._desktop->currentLayer()->label()); dialog._layer_name_entry.set_text(newName.c_str()); dialog._apply_button.set_label(_("_Add")); dialog._setup_position_controls(); @@ -402,10 +402,10 @@ void LayerPropertiesDialog::_setDesktop(SPDesktop *desktop) { void LayerPropertiesDialog::_setLayer(SPObject *layer) { if (layer) { - sp_object_ref(layer, NULL); + sp_object_ref(layer, nullptr); } if (_layer) { - sp_object_unref(_layer, NULL); + sp_object_unref(_layer, nullptr); } _layer = layer; } diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 6fa96e539..c836f9925 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -118,7 +118,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ) { Gtk::Image *iconWidget = nullptr; - const char* label = 0; + const char* label = nullptr; if ( iconName ) { iconWidget = Gtk::manage(new Gtk::Image()); @@ -178,7 +178,7 @@ void LayersPanel::_fireAction( unsigned int code ) if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(_desktop)); if ( action ) { - sp_action_perform( action, NULL ); + sp_action_perform( action, nullptr ); // } else { // g_message("no action"); } @@ -295,7 +295,7 @@ bool LayersPanel::_executeAction() } delete _pending; - _pending = 0; + _pending = nullptr; } return false; @@ -393,7 +393,7 @@ void LayersPanel::_layersChanged() #if DUMP_LAYERS g_message("root:%p {%s} [%s]", root, root->id, root->label() ); #endif // DUMP_LAYERS - _addLayer( document, root, 0, target, 0 ); + _addLayer( document, root, nullptr, target, 0 ); } _selectedConnection.unblock(); } @@ -435,7 +435,7 @@ void LayersPanel::_addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::R SPObject* LayersPanel::_selectedLayer() { - SPObject* obj = 0; + SPObject* obj = nullptr; Gtk::TreeModel::iterator iter = _tree.get_selection()->get_selected(); if ( iter ) { @@ -473,8 +473,8 @@ void LayersPanel::_checkTreeSelection() SPObject* inTree = _selectedLayer(); if ( inTree ) { - sensitiveNonTop = (Inkscape::next_layer(inTree->parent, inTree) != 0); - sensitiveNonBottom = (Inkscape::previous_layer(inTree->parent, inTree) != 0); + sensitiveNonTop = (Inkscape::next_layer(inTree->parent, inTree) != nullptr); + sensitiveNonBottom = (Inkscape::previous_layer(inTree->parent, inTree) != nullptr); } } @@ -496,7 +496,7 @@ void LayersPanel::_preToggle( GdkEvent const *event ) if ( _toggleEvent ) { gdk_event_free(_toggleEvent); - _toggleEvent = 0; + _toggleEvent = nullptr; } if ( event && (event->type == GDK_BUTTON_PRESS) ) { @@ -507,7 +507,7 @@ void LayersPanel::_preToggle( GdkEvent const *event ) void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) { - g_return_if_fail(_desktop != NULL); + g_return_if_fail(_desktop != nullptr); Gtk::TreeModel::Children::iterator iter = _tree.get_model()->get_iter(str); Gtk::TreeModel::Row row = *iter; @@ -515,7 +515,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) Glib::ustring tmp = row[_model->_colLabel]; SPObject* obj = row[_model->_colObject]; - SPItem* item = ( obj && SP_IS_ITEM(obj) ) ? SP_ITEM(obj) : 0; + SPItem* item = ( obj && SP_IS_ITEM(obj) ) ? SP_ITEM(obj) : nullptr; if ( item ) { switch ( targetCol ) { case COL_VISIBLE: @@ -590,7 +590,7 @@ bool LayersPanel::_handleButtonEvent(GdkEventButton* event) && (event->state & GDK_MOD1_MASK)) { // Alt left click on the visible/lock columns - eat this event to keep row selection Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -608,7 +608,7 @@ bool LayersPanel::_handleButtonEvent(GdkEventButton* event) && (event->state & (GDK_SHIFT_MASK | GDK_MOD1_MASK))) { Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -647,7 +647,7 @@ bool LayersPanel::_handleButtonEvent(GdkEventButton* event) if ( event->type == GDK_BUTTON_RELEASE && doubleclick) { doubleclick = 0; Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -675,8 +675,8 @@ bool LayersPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*contex SPObject *selected = _selectedLayer(); _dnd_into = false; - _dnd_target = NULL; - _dnd_source = ( selected && SP_IS_ITEM(selected) ) ? SP_ITEM(selected) : 0; + _dnd_target = nullptr; + _dnd_source = ( selected && SP_IS_ITEM(selected) ) ? SP_ITEM(selected) : nullptr; if (_tree.get_path_at_pos (x, y, target_path, target_column, cell_x, cell_y)) { // Are we before, inside or after the drop layer @@ -699,7 +699,7 @@ bool LayersPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*contex _dnd_into = true; } else { // Drop into the top level - _dnd_target = NULL; + _dnd_target = nullptr; } } } @@ -707,7 +707,7 @@ bool LayersPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*contex if (_store->iter_is_valid(iter)) { Gtk::TreeModel::Row row = *iter; SPObject *obj = row[_model->_colObject]; - _dnd_target = ( obj && SP_IS_ITEM(obj) ) ? SP_ITEM(obj) : 0; + _dnd_target = ( obj && SP_IS_ITEM(obj) ) ? SP_ITEM(obj) : nullptr; } } @@ -733,7 +733,7 @@ void LayersPanel::_doTreeMove( ) } _dnd_source->moveTo(_dnd_target, _dnd_into); _selectLayer(_dnd_source); - _dnd_source = NULL; + _dnd_source = nullptr; DocumentUndo::done( _desktop->doc() , SP_VERB_NONE, _("Move layer")); } @@ -805,10 +805,10 @@ LayersPanel::LayersPanel() : UI::Widget::Panel("/dialogs/layers", SP_VERB_DIALOG_LAYERS), deskTrack(), _maxNestDepth(20), - _desktop(0), - _model(0), - _pending(0), - _toggleEvent(0), + _desktop(nullptr), + _model(nullptr), + _pending(nullptr), + _toggleEvent(nullptr), _compositeSettings(SP_VERB_DIALOG_LAYERS, "layers", UI::Widget::SimpleFilterModifier::BLEND | UI::Widget::SimpleFilterModifier::OPACITY | @@ -941,20 +941,20 @@ LayersPanel::LayersPanel() : // ------------------------------------------------------- { - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, "Rename", (int)BUTTON_RENAME ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, nullptr, "New", (int)BUTTON_NEW ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, nullptr, "Rename", (int)BUTTON_RENAME ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, "Solo", (int)BUTTON_SOLO ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SHOW_ALL, 0, "Show All", (int)BUTTON_SHOW_ALL ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_HIDE_ALL, 0, "Hide All", (int)BUTTON_HIDE_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, nullptr, "Solo", (int)BUTTON_SOLO ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SHOW_ALL, nullptr, "Show All", (int)BUTTON_SHOW_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_HIDE_ALL, nullptr, "Hide All", (int)BUTTON_HIDE_ALL ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_OTHERS, 0, "Lock Others", (int)BUTTON_LOCK_OTHERS ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_ALL, 0, "Lock All", (int)BUTTON_LOCK_ALL ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_UNLOCK_ALL, 0, "Unlock All", (int)BUTTON_UNLOCK_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_OTHERS, nullptr, "Lock Others", (int)BUTTON_LOCK_OTHERS ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_ALL, nullptr, "Lock All", (int)BUTTON_LOCK_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_UNLOCK_ALL, nullptr, "Unlock All", (int)BUTTON_UNLOCK_ALL ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); @@ -963,8 +963,8 @@ LayersPanel::LayersPanel() : _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, 0, "Duplicate", (int)BUTTON_DUPLICATE ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DELETE, 0, "Delete", (int)BUTTON_DELETE ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, nullptr, "Duplicate", (int)BUTTON_DUPLICATE ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DELETE, nullptr, "Delete", (int)BUTTON_DELETE ) ); _popupMenu.show_all_children(); } @@ -995,25 +995,25 @@ LayersPanel::LayersPanel() : LayersPanel::~LayersPanel() { - setDesktop(NULL); + setDesktop(nullptr); - _compositeSettings.setSubject(NULL); + _compositeSettings.setSubject(nullptr); if ( _model ) { delete _model; - _model = 0; + _model = nullptr; } if (_pending) { delete _pending; - _pending = 0; + _pending = nullptr; } if ( _toggleEvent ) { gdk_event_free( _toggleEvent ); - _toggleEvent = 0; + _toggleEvent = nullptr; } desktopChangeConn.disconnect(); @@ -1030,7 +1030,7 @@ void LayersPanel::setDesktop( SPDesktop* desktop ) _layerUpdatedConnection.disconnect(); _changedConnection.disconnect(); if ( _desktop ) { - _desktop = 0; + _desktop = nullptr; } _desktop = Panel::getDesktop(); diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index ba9d33f0a..ca14c0750 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -138,7 +138,7 @@ LivePathEffectAdd::getActiveData() return row[instance()._columns.data]; } - return 0; + return nullptr; } diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 6cf7f807a..dd019cfba 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -92,16 +92,16 @@ LivePathEffectEditor::LivePathEffectEditor() deskTrack(), lpe_list_locked(false), lpe_changed(true), - effectwidget(NULL), + effectwidget(nullptr), status_label("", Gtk::ALIGN_CENTER), effectcontrol_frame(""), button_add(), button_remove(), button_up(), button_down(), - current_desktop(NULL), - current_lpeitem(NULL), - current_lperef(NULL) + current_desktop(nullptr), + current_lpeitem(nullptr), + current_lperef(nullptr) { Gtk::Box *contents = _getContents(); contents->set_spacing(4); @@ -190,7 +190,7 @@ LivePathEffectEditor::~LivePathEffectEditor() if (effectwidget) { effectcontrol_vbox.remove(*effectwidget); delete effectwidget; - effectwidget = NULL; + effectwidget = nullptr; } if (current_desktop) { @@ -209,7 +209,7 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) if (effectwidget) { effectcontrol_vbox.remove(*effectwidget); delete effectwidget; - effectwidget = NULL; + effectwidget = nullptr; } effectwidget = effect.newWidget(); effectcontrol_frame.set_label(effect.getName()); @@ -241,7 +241,7 @@ LivePathEffectEditor::showText(Glib::ustring const &str) if (effectwidget) { effectcontrol_vbox.remove(*effectwidget); delete effectwidget; - effectwidget = NULL; + effectwidget = nullptr; } status_label.show(); @@ -271,7 +271,7 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) lpe_list_locked = false; return; } - current_lpeitem = NULL; + current_lpeitem = nullptr; effectlist_store->clear(); if ( sel && !sel->isEmpty() ) { @@ -388,7 +388,7 @@ LivePathEffectEditor::setDesktop(SPDesktop *desktop) onSelectionChanged(selection); } else { - onSelectionChanged(NULL); + onSelectionChanged(nullptr); } } @@ -453,7 +453,7 @@ LivePathEffectEditor::onAdd() gchar *id = g_strdup(item->getRepr()->attribute("id")); gchar *transform = g_strdup(item->getRepr()->attribute("transform")); item->deleteObject(false); - item = NULL; + item = nullptr; // run sp_selection_clone_original_path_lpe sel->cloneOriginalPathLPE(true); @@ -491,7 +491,7 @@ LivePathEffectEditor::onRemove() SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item); if ( lpeitem ) { lpeitem->removeCurrentPathEffect(false); - current_lperef = NULL; + current_lperef = nullptr; DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Remove path effect") ); lpe_list_locked = false; diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 6d19f9090..0d5f7332d 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -27,8 +27,8 @@ namespace UI { namespace Dialogs { FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() - : _desktop(NULL), - _knotpoint(NULL), + : _desktop(nullptr), + _knotpoint(nullptr), _position_visible(false), _close_button(_("_Cancel"), true) { @@ -104,7 +104,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() { - _setDesktop(NULL); + _setDesktop(nullptr); } void FilletChamferPropertiesDialog::showDialog( @@ -169,7 +169,7 @@ void FilletChamferPropertiesDialog::_apply() void FilletChamferPropertiesDialog::_close() { - _setDesktop(NULL); + _setDesktop(nullptr); destroy_(); Glib::signal_idle().connect( sigc::bind_return( diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index e66229dcd..13a20b041 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -33,8 +33,8 @@ namespace UI { namespace Dialogs { PowerstrokePropertiesDialog::PowerstrokePropertiesDialog() - : _desktop(NULL), - _knotpoint(NULL), + : _desktop(nullptr), + _knotpoint(nullptr), _position_visible(false), _close_button(_("_Cancel"), true) { @@ -99,7 +99,7 @@ PowerstrokePropertiesDialog::PowerstrokePropertiesDialog() PowerstrokePropertiesDialog::~PowerstrokePropertiesDialog() { - _setDesktop(NULL); + _setDesktop(nullptr); } void PowerstrokePropertiesDialog::showDialog(SPDesktop *desktop, Geom::Point knotpoint, const Inkscape::LivePathEffect::PowerStrokePointArrayParamKnotHolderEntity *pt) @@ -133,7 +133,7 @@ PowerstrokePropertiesDialog::_apply() void PowerstrokePropertiesDialog::_close() { - _setDesktop(NULL); + _setDesktop(nullptr); destroy_(); Glib::signal_idle().connect( sigc::bind_return( diff --git a/src/ui/dialog/messages.cpp b/src/ui/dialog/messages.cpp index e96ac73c3..5ff0d24e8 100644 --- a/src/ui/dialog/messages.cpp +++ b/src/ui/dialog/messages.cpp @@ -148,7 +148,7 @@ void Messages::captureLogMessages() G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG); if ( !handlerDefault ) { - handlerDefault = g_log_set_handler(NULL, flags, + handlerDefault = g_log_set_handler(nullptr, flags, dialogLoggingCallback, (gpointer)this); } if ( !handlerGlibmm ) { @@ -177,7 +177,7 @@ void Messages::captureLogMessages() void Messages::releaseLogMessages() { if ( handlerDefault ) { - g_log_remove_handler(NULL, handlerDefault); + g_log_remove_handler(nullptr, handlerDefault); handlerDefault = 0; } if ( handlerGlibmm ) { diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index f3e93ded8..9e4339113 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -58,7 +58,7 @@ static const SPAttrDesc anchor_desc[] = { { N_("Show:"), "xlink:show"}, // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/linking.html#AElementXLinkActuateAttribute { N_("Actuate:"), "xlink:actuate"}, - { NULL, NULL} + { nullptr, nullptr} }; static const SPAttrDesc image_desc[] = { @@ -68,7 +68,7 @@ static const SPAttrDesc image_desc[] = { { N_("Width:"), "width"}, { N_("Height:"), "height"}, { N_("Image Rendering:"), "image-rendering"}, - { NULL, NULL} + { nullptr, nullptr} }; static const SPAttrDesc image_nohref_desc[] = { @@ -76,15 +76,15 @@ static const SPAttrDesc image_nohref_desc[] = { { N_("Y:"), "y"}, { N_("Width:"), "width"}, { N_("Height:"), "height"}, - { NULL, NULL} + { nullptr, nullptr} }; ObjectAttributes::ObjectAttributes (void) : UI::Widget::Panel("/dialogs/objectattr/", SP_VERB_DIALOG_ATTR), blocked (false), - CurrentItem(NULL), + CurrentItem(nullptr), attrTable(Gtk::manage(new SPAttributeTable())), - desktop(NULL), + desktop(nullptr), deskTrack(), selectChangedConn(), subselChangedConn(), @@ -118,7 +118,7 @@ void ObjectAttributes::widget_setup (void) if (!item) { set_sensitive (false); - CurrentItem = NULL; + CurrentItem = nullptr; //no selection anymore or multiple objects selected, means that we need //to close the connections to the previously selected object return; diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 2d2ee9e2c..a43791d08 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -49,7 +49,7 @@ namespace Dialog { ObjectProperties::ObjectProperties() : UI::Widget::Panel("/dialogs/object/", SP_VERB_DIALOG_ITEM) , _blocked (false) - , _current_item(NULL) + , _current_item(nullptr) , _label_id(_("_ID:"), 1) , _label_label(_("_Label:"), 1) , _label_title(_("_Title:"), 1) @@ -57,7 +57,7 @@ ObjectProperties::ObjectProperties() , _cb_hide(_("_Hide"), 1) , _cb_lock(_("L_ock"), 1) , _attr_table(Gtk::manage(new SPAttributeTable())) - , _desktop(NULL) + , _desktop(nullptr) { //initialize labels for the table at the bottom of the dialog _int_attrs.push_back("onclick"); @@ -267,7 +267,7 @@ void ObjectProperties::update() if (!selection->singleItem()) { contents->set_sensitive (false); - _current_item = NULL; + _current_item = nullptr; //no selection anymore or multiple objects selected, means that we need //to close the connections to the previously selected object _attr_table->clear(); @@ -350,7 +350,7 @@ void ObjectProperties::update() } _ft_description.set_sensitive(TRUE); - if (_current_item == NULL) { + if (_current_item == nullptr) { _attr_table->set_object(obj, _int_labels, _int_attrs, (GtkWidget*) _exp_interactivity.gobj()); } else { _attr_table->change_object(obj); @@ -368,7 +368,7 @@ void ObjectProperties::_labelChanged() } SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); _blocked = true; @@ -379,7 +379,7 @@ void ObjectProperties::_labelChanged() _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" ")); } else if (!*id || !isalnum (*id)) { _label_id.set_text(_("Id invalid! ")); - } else if (SP_ACTIVE_DOCUMENT->getObjectById(id) != NULL) { + } else if (SP_ACTIVE_DOCUMENT->getObjectById(id) != nullptr) { _label_id.set_text(_("Id exists! ")); } else { SPException ex; @@ -428,7 +428,7 @@ void ObjectProperties::_imageRenderingChanged() } SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); _blocked = true; @@ -455,7 +455,7 @@ void ObjectProperties::_sensitivityToggled() } SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); - g_return_if_fail(item != NULL); + g_return_if_fail(item != nullptr); _blocked = true; item->setLocked(_cb_lock.get_active()); @@ -471,7 +471,7 @@ void ObjectProperties::_hiddenToggled() } SPItem *item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); - g_return_if_fail(item != NULL); + g_return_if_fail(item != nullptr); _blocked = true; item->setExplicitlyHidden(_cb_hide.get_active()); diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 9b2c12d40..a5b86a561 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -249,7 +249,7 @@ void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char con Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ) { Gtk::Image *iconWidget = nullptr; - const char* label = 0; + const char* label = nullptr; if ( iconName ) { iconWidget = Gtk::manage(new Gtk::Image()); @@ -327,7 +327,7 @@ void ObjectsPanel::_objectsChanged(SPObject */*obj*/) //Clear the tree store _store->clear(); //Add all items recursively - _addObject( root, 0 ); + _addObject( root, nullptr ); _selectedConnection.unblock(); _documentChangedCurrentLayer.unblock(); //Set the tree selection @@ -350,7 +350,7 @@ void ObjectsPanel::_addObject(SPObject* obj, Gtk::TreeModel::Row* parentRow) if (SP_IS_ITEM(&child)) { SPItem * item = SP_ITEM(&child); - SPGroup * group = SP_IS_GROUP(&child) ? SP_GROUP(&child) : 0; + SPGroup * group = SP_IS_GROUP(&child) ? SP_GROUP(&child) : nullptr; //Add the item to the tree and set the column information Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); @@ -426,8 +426,8 @@ bool ObjectsPanel::_checkForUpdated(const Gtk::TreeIter& iter, SPObject* obj) if ( obj == row[_model->_colObject] ) { //We found our item in the tree!! Update it! - SPItem * item = SP_IS_ITEM(obj) ? SP_ITEM(obj) : 0; - SPGroup * group = SP_IS_GROUP(obj) ? SP_GROUP(obj) : 0; + SPItem * item = SP_IS_ITEM(obj) ? SP_ITEM(obj) : nullptr; + SPGroup * group = SP_IS_GROUP(obj) ? SP_GROUP(obj) : nullptr; row[_model->_colLabel] = obj->label() ? obj->label() : obj->getId(); row[_model->_colVisible] = item ? !item->isHidden() : false; @@ -488,7 +488,7 @@ void ObjectsPanel::_objectsSelected( Selection *sel ) { bool setOpacity = true; _selectedConnection.block(); _tree.get_selection()->unselect_all(); - SPItem *item = NULL; + SPItem *item = nullptr; auto items = sel->items(); for(auto i=items.begin(); i!=items.end(); ++i){ item = *i; @@ -526,8 +526,8 @@ void ObjectsPanel::_setCompositingValues(SPItem *item) opacity *= 100; // Display in percent. _filter_modifier.set_opacity_value(opacity); - SPFeBlend *spblend = NULL; - SPGaussianBlur *spblur = NULL; + SPFeBlend *spblend = nullptr; + SPGaussianBlur *spblur = nullptr; if (item->style->getFilter()) { for (auto& primitive_obj: item->style->getFilter()->children) { @@ -750,7 +750,7 @@ bool ObjectsPanel::_handleKeyEvent(GdkEventKey *event) case GDK_KEY_KP_Enter: { Gtk::TreeModel::Path path; - Gtk::TreeViewColumn *focus_column = 0; + Gtk::TreeViewColumn *focus_column = nullptr; _tree.get_cursor(path, focus_column); if (focus_column == _name_column && !_text_renderer->property_editable()) { @@ -804,7 +804,7 @@ bool ObjectsPanel::_handleButtonEvent(GdkEventButton* event) if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1)) { overVisible = false; Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -839,7 +839,7 @@ bool ObjectsPanel::_handleButtonEvent(GdkEventButton* event) if ( (event->type == GDK_BUTTON_RELEASE) && (event->button == 1)) { Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -982,7 +982,7 @@ bool ObjectsPanel::_handleButtonEvent(GdkEventButton* event) if ( event->type == GDK_BUTTON_RELEASE && doubleclick) { doubleclick = 0; Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -1023,7 +1023,7 @@ bool ObjectsPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*conte //Set up our defaults and clear the source vector _dnd_into = false; - _dnd_target = NULL; + _dnd_target = nullptr; _dnd_source.clear(); //Add all selected items to the source vector @@ -1050,7 +1050,7 @@ bool ObjectsPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*conte _dnd_into = true; } else { // Drop into the top level - _dnd_target = NULL; + _dnd_target = nullptr; } } } @@ -1088,8 +1088,8 @@ void ObjectsPanel::_storeDragSource(const Gtk::TreeModel::iterator& iter) */ void ObjectsPanel::_doTreeMove( ) { - g_assert(_desktop != NULL); - g_assert(_document != NULL); + g_assert(_desktop != nullptr); + g_assert(_document != nullptr); std::vector<gchar *> idvector; @@ -1142,7 +1142,7 @@ void ObjectsPanel::_fireAction( unsigned int code ) if ( verb ) { SPAction *action = verb->get_action(_desktop); if ( action ) { - sp_action_perform( action, NULL ); + sp_action_perform( action, nullptr ); } } } @@ -1336,7 +1336,7 @@ bool ObjectsPanel::_executeAction() } delete _pending; - _pending = 0; + _pending = nullptr; } return false; @@ -1541,7 +1541,7 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl { //Since blur and blend are both filters, we need to set both at the same time SPStyle *style = item->style; - g_assert(style != NULL); + g_assert(style != nullptr); if (blendmode != "normal") { gdouble radius = 0; @@ -1652,13 +1652,13 @@ void ObjectsPanel::_blurChangedIter(const Gtk::TreeIter& iter, double blur) */ ObjectsPanel::ObjectsPanel() : UI::Widget::Panel("/dialogs/objects", SP_VERB_DIALOG_OBJECTS), - _rootWatcher(0), + _rootWatcher(nullptr), _deskTrack(), - _desktop(0), - _document(0), - _model(0), - _pending(0), - _toggleEvent(0), + _desktop(nullptr), + _document(nullptr), + _model(nullptr), + _pending(nullptr), + _toggleEvent(nullptr), _defer_target(), _visibleHeader(C_("Visibility", "V")), _lockHeader(C_("Lock", "L")), @@ -1882,21 +1882,21 @@ ObjectsPanel::ObjectsPanel() : //Set up the pop-up menu // ------------------------------------------------------- { - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, _("Rename"), (int)BUTTON_RENAME ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_EDIT_DUPLICATE, 0, _("Duplicate"), (int)BUTTON_DUPLICATE ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, _("New"), (int)BUTTON_NEW ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, nullptr, _("Rename"), (int)BUTTON_RENAME ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_EDIT_DUPLICATE, nullptr, _("Duplicate"), (int)BUTTON_DUPLICATE ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, nullptr, _("New"), (int)BUTTON_NEW ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, _("Solo"), (int)BUTTON_SOLO ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SHOW_ALL, 0, _("Show All"), (int)BUTTON_SHOW_ALL ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_HIDE_ALL, 0, _("Hide All"), (int)BUTTON_HIDE_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, nullptr, _("Solo"), (int)BUTTON_SOLO ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SHOW_ALL, nullptr, _("Show All"), (int)BUTTON_SHOW_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_HIDE_ALL, nullptr, _("Hide All"), (int)BUTTON_HIDE_ALL ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_OTHERS, 0, _("Lock Others"), (int)BUTTON_LOCK_OTHERS ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_ALL, 0, _("Lock All"), (int)BUTTON_LOCK_ALL ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_UNLOCK_ALL, 0, _("Unlock All"), (int)BUTTON_UNLOCK_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_OTHERS, nullptr, _("Lock Others"), (int)BUTTON_LOCK_OTHERS ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_ALL, nullptr, _("Lock All"), (int)BUTTON_LOCK_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_UNLOCK_ALL, nullptr, _("Unlock All"), (int)BUTTON_UNLOCK_ALL ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); @@ -1905,23 +1905,23 @@ ObjectsPanel::ObjectsPanel() : _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_GROUP, 0, _("Group"), (int)BUTTON_GROUP ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_UNGROUP, 0, _("Ungroup"), (int)BUTTON_UNGROUP ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_GROUP, nullptr, _("Group"), (int)BUTTON_GROUP ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_UNGROUP, nullptr, _("Ungroup"), (int)BUTTON_UNGROUP ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_SET_CLIPPATH, 0, _("Set Clip"), (int)BUTTON_SETCLIP ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_SET_CLIPPATH, nullptr, _("Set Clip"), (int)BUTTON_SETCLIP ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_CREATE_CLIP_GROUP, 0, _("Create Clip Group"), (int)BUTTON_CLIPGROUP ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_CREATE_CLIP_GROUP, nullptr, _("Create Clip Group"), (int)BUTTON_CLIPGROUP ) ); //will never be implemented //_watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_SET_INVERSE_CLIPPATH, 0, "Set Inverse Clip", (int)BUTTON_SETINVCLIP ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_UNSET_CLIPPATH, 0, _("Unset Clip"), (int)BUTTON_UNSETCLIP ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_UNSET_CLIPPATH, nullptr, _("Unset Clip"), (int)BUTTON_UNSETCLIP ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_SET_MASK, 0, _("Set Mask"), (int)BUTTON_SETMASK ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_UNSET_MASK, 0, _("Unset Mask"), (int)BUTTON_UNSETMASK ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_SET_MASK, nullptr, _("Set Mask"), (int)BUTTON_SETMASK ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_UNSET_MASK, nullptr, _("Unset Mask"), (int)BUTTON_UNSETMASK ) ); _popupMenu.show_all_children(); } @@ -1975,23 +1975,23 @@ ObjectsPanel::~ObjectsPanel() _colorSelectorDialog.hide(); //Set the desktop to null, which will disconnect all object watchers - setDesktop(NULL); + setDesktop(nullptr); if ( _model ) { delete _model; - _model = 0; + _model = nullptr; } if (_pending) { delete _pending; - _pending = 0; + _pending = nullptr; } if ( _toggleEvent ) { gdk_event_free( _toggleEvent ); - _toggleEvent = 0; + _toggleEvent = nullptr; } desktopChangeConn.disconnect(); @@ -2017,7 +2017,7 @@ void ObjectsPanel::setDocument(SPDesktop* /*desktop*/, SPDocument* document) { _rootWatcher->_repr->removeObserver(*_rootWatcher); delete _rootWatcher; - _rootWatcher = NULL; + _rootWatcher = nullptr; } _document = document; @@ -2043,7 +2043,7 @@ void ObjectsPanel::setDesktop( SPDesktop* desktop ) _documentChangedCurrentLayer.disconnect(); _selectionChangedConnection.disconnect(); if ( _desktop ) { - _desktop = 0; + _desktop = nullptr; } _desktop = Panel::getDesktop(); @@ -2057,7 +2057,7 @@ void ObjectsPanel::setDesktop( SPDesktop* desktop ) setDocument(_desktop, _desktop->doc()); } else { - setDocument(NULL, NULL); + setDocument(nullptr, nullptr); } } _deskTrack.setBase(desktop); @@ -2078,10 +2078,10 @@ void SPItem::setHighlightColor(guint32 const color) } else { - _highlightColor = NULL; + _highlightColor = nullptr; } - NodeTool *tool = 0; + NodeTool *tool = nullptr; if (SP_ACTIVE_DESKTOP ) { Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; if (INK_IS_NODE_TOOL(ec)) { @@ -2094,8 +2094,8 @@ void SPItem::setHighlightColor(guint32 const color) void SPItem::unsetHighlightColor() { g_free(_highlightColor); - _highlightColor = NULL; - NodeTool *tool = 0; + _highlightColor = nullptr; + NodeTool *tool = nullptr; if (SP_ACTIVE_DESKTOP ) { Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; if (INK_IS_NODE_TOOL(ec)) { diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 4302161dc..2c457b6d0 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -995,8 +995,8 @@ void ImportDialog::on_xml_file_read(const Glib::RefPtr<Gio::AsyncResult>& result // Create the resulting xml document tree // Initialize libxml and test mistakes between compiled and shared library used LIBXML_TEST_VERSION - xmlDoc *doc = NULL; - xmlNode *root_element = NULL; + xmlDoc *doc = nullptr; + xmlNode *root_element = nullptr; int parse_options = XML_PARSE_RECOVER + XML_PARSE_NOWARNING + XML_PARSE_NOERROR; // do not use XML_PARSE_NOENT ! see bug lp:1025185 Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1005,9 +1005,9 @@ void ImportDialog::on_xml_file_read(const Glib::RefPtr<Gio::AsyncResult>& result parse_options |= XML_PARSE_NONET; } - doc = xmlReadMemory(data, (int) length, xml_uri.c_str(), NULL, parse_options); + doc = xmlReadMemory(data, (int) length, xml_uri.c_str(), nullptr, parse_options); - if (doc == NULL) { + if (doc == nullptr) { // If nothing is returned, no results could be found if (length == 0) { notebook_content->set_current_page(NOTEBOOK_PAGE_NOT_FOUND); @@ -1065,7 +1065,7 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types FileDialogBase(title, parent_window) { // Initialize to Autodetect - extension = NULL; + extension = nullptr; // No filename to start out with Glib::ustring search_keywords = ""; diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index 0762450f8..198737eb8 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -548,7 +548,7 @@ void PixelArtDialogImpl::workerThread() void PixelArtDialogImpl::onWorkerThreadFinished() { thread->join(); - thread = NULL; + thread = nullptr; for ( std::vector<Output>::const_iterator it = output.begin(), end = output.end() ; it != end ; ++it ) { importOutput(*it); diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 7f535092f..49b5a5790 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -266,7 +266,7 @@ void PolarArrangeTab::arrange() { Inkscape::Selection *selection = parent->getDesktop()->getSelection(); const std::vector<SPItem*> tmp(selection->items().begin(), selection->items().end()); - SPGenericEllipse *referenceEllipse = NULL; // Last ellipse in selection + SPGenericEllipse *referenceEllipse = nullptr; // Last ellipse in selection bool arrangeOnEllipse = !arrangeOnParametersRadio.get_active(); bool arrangeOnFirstEllipse = arrangeOnEllipse && arrangeOnFirstCircleRadio.get_active(); @@ -285,7 +285,7 @@ void PolarArrangeTab::arrange() referenceEllipse = SP_GENERICELLIPSE(item); } else { // The last selected ellipse is actually the first in list - if(SP_IS_GENERICELLIPSE(item) && referenceEllipse == NULL) + if(SP_IS_GENERICELLIPSE(item) && referenceEllipse == nullptr) referenceEllipse = SP_GENERICELLIPSE(item); } } @@ -299,7 +299,7 @@ void PolarArrangeTab::arrange() if(arrangeOnEllipse) { - if(referenceEllipse == NULL) + if(referenceEllipse == nullptr) { Gtk::MessageDialog dialog(_("Couldn't find an ellipse in selection"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); dialog.run(); @@ -328,7 +328,7 @@ void PolarArrangeTab::arrange() arcBeg = angleX.getValue("rad"); arcEnd = angleY.getValue("rad"); transformation.setIdentity(); - referenceEllipse = NULL; + referenceEllipse = nullptr; } int anchor = 9; diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 606b48f8a..cb22e254c 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -143,7 +143,7 @@ void Print::draw_page(const Glib::RefPtr<Gtk::PrintContext>& context, int /*page width, height, (unsigned long)(Inkscape::Util::Quantity::convert(width, "px", "in") * dpi), (unsigned long)(Inkscape::Util::Quantity::convert(height, "px", "in") * dpi), - dpi, dpi, bgcolor, NULL, NULL, true, std::vector<SPItem*>()); + dpi, dpi, bgcolor, nullptr, nullptr, true, std::vector<SPItem*>()); // This doesn't seem to work: //context->set_cairo_context ( Cairo::Context::create (Cairo::ImageSurface::create_from_png (tmp_png) ), dpi, dpi ); @@ -191,7 +191,7 @@ void Print::draw_page(const Glib::RefPtr<Gtk::PrintContext>& context, int /*page bool ret = ctx->setSurfaceTarget (surface, true, &ctm); if (ret) { - ret = renderer.setupDocument (ctx, _workaround._doc, TRUE, 0., NULL); + ret = renderer.setupDocument (ctx, _workaround._doc, TRUE, 0., nullptr); if (ret) { renderer.renderItem(ctx, _workaround._base); ctx->finish(false); // do not finish the cairo_surface_t - it's owned by our GtkPrintContext! diff --git a/src/ui/dialog/prototype.cpp b/src/ui/dialog/prototype.cpp index 973cffd60..ee0cbe1ab 100644 --- a/src/ui/dialog/prototype.cpp +++ b/src/ui/dialog/prototype.cpp @@ -39,7 +39,7 @@ Prototype::Prototype() : // desktop is set by Panel constructor so this should never be NULL. // Note, we need to use getDesktop() since _desktop is private in Panel.h. // It should probably be protected instead... but need to verify in doesn't break anything. - if (getDesktop() == NULL) { + if (getDesktop() == nullptr) { std::cerr << "Prototype::Prototype: desktop is NULL!" << std::endl; } diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 252782081..ff3dd2636 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -55,13 +55,13 @@ namespace Dialog { SpellCheck::SpellCheck (void) : UI::Widget::Panel("/dialogs/spellcheck/", SP_VERB_DIALOG_SPELLCHECK), - _text(NULL), - _layout(NULL), + _text(nullptr), + _layout(nullptr), _stops(0), _adds(0), _working(false), _local_change(false), - _prefs(NULL), + _prefs(nullptr), _lang("en"), _lang2(""), _lang3(""), @@ -72,14 +72,14 @@ SpellCheck::SpellCheck (void) : dictionary_hbox(false, 0), stop_button(_("_Stop"), true), start_button(_("_Start"), true), - desktop(NULL), + desktop(nullptr), deskTrack() { #ifdef HAVE_ASPELL - _speller = NULL; - _speller2 = NULL; - _speller3 = NULL; + _speller = nullptr; + _speller2 = nullptr; + _speller3 = nullptr; #endif /* HAVE_ASPELL */ _prefs = Inkscape::Preferences::get(); @@ -278,7 +278,7 @@ SPItem *SpellCheck::getText (SPObject *root) if(_seen_objects.insert(item).second) return item; } - return NULL; + return nullptr; } void @@ -337,7 +337,7 @@ SpellCheck::init(SPDesktop *d) aspell_config_replace(config, "encoding", "UTF-8"); AspellCanHaveError *ret = new_aspell_speller(config); delete_aspell_config(config); - if (aspell_error(ret) != 0) { + if (aspell_error(ret) != nullptr) { g_warning("Error: %s\n", aspell_error_message(ret)); delete_aspell_can_have_error(ret); return false; @@ -354,7 +354,7 @@ SpellCheck::init(SPDesktop *d) aspell_config_replace(config, "encoding", "UTF-8"); AspellCanHaveError *ret = new_aspell_speller(config); delete_aspell_config(config); - if (aspell_error(ret) != 0) { + if (aspell_error(ret) != nullptr) { g_warning("Error: %s\n", aspell_error_message(ret)); delete_aspell_can_have_error(ret); return false; @@ -371,7 +371,7 @@ SpellCheck::init(SPDesktop *d) aspell_config_replace(config, "encoding", "UTF-8"); AspellCanHaveError *ret = new_aspell_speller(config); delete_aspell_config(config); - if (aspell_error(ret) != 0) { + if (aspell_error(ret) != nullptr) { g_warning("Error: %s\n", aspell_error_message(ret)); delete_aspell_can_have_error(ret); return false; @@ -399,16 +399,16 @@ SpellCheck::finished () #ifdef HAVE_ASPELL aspell_speller_save_all_word_lists(_speller); delete_aspell_speller(_speller); - _speller = NULL; + _speller = nullptr; if (_speller2) { aspell_speller_save_all_word_lists(_speller2); delete_aspell_speller(_speller2); - _speller2 = NULL; + _speller2 = nullptr; } if (_speller3) { aspell_speller_save_all_word_lists(_speller3); delete_aspell_speller(_speller3); - _speller3 = NULL; + _speller3 = nullptr; } #endif /* HAVE_ASPELL */ @@ -438,8 +438,8 @@ SpellCheck::finished () _seen_objects.clear(); - desktop = NULL; - _root = NULL; + desktop = nullptr; + _root = nullptr; _working = false; } @@ -583,7 +583,7 @@ SpellCheck::nextWord() area.expandBy(MAX(0.05 * mindim, 1)); // create canvas path rectangle, red stroke - SPCanvasItem *rect = sp_canvas_bpath_new(desktop->getSketch(), NULL); + SPCanvasItem *rect = sp_canvas_bpath_new(desktop->getSketch(), nullptr); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(rect), 0xff0000ff, 3.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(rect), 0, SP_WIND_RULE_NONZERO); SPCurve *curve = new SPCurve(); @@ -636,7 +636,7 @@ SpellCheck::nextWord() const char *sugg; Gtk::TreeModel::iterator iter; - while ((sugg = aspell_string_enumeration_next(els)) != 0) { + while ((sugg = aspell_string_enumeration_next(els)) != nullptr) { iter = model->append(); Gtk::TreeModel::Row row = *iter; row[tree_columns.suggestions] = sugg; @@ -649,7 +649,7 @@ SpellCheck::nextWord() AspellStringEnumeration * els = aspell_word_list_elements(wl); const char *sugg; Gtk::TreeModel::iterator iter; - while ((sugg = aspell_string_enumeration_next(els)) != 0) { + while ((sugg = aspell_string_enumeration_next(els)) != nullptr) { iter = model->append(); Gtk::TreeModel::Row row = *iter; row[tree_columns.suggestions] = sugg; @@ -662,7 +662,7 @@ SpellCheck::nextWord() AspellStringEnumeration * els = aspell_word_list_elements(wl); const char *sugg; Gtk::TreeModel::iterator iter; - while ((sugg = aspell_string_enumeration_next(els)) != 0) { + while ((sugg = aspell_string_enumeration_next(els)) != nullptr) { iter = model->append(); Gtk::TreeModel::Row row = *iter; row[tree_columns.suggestions] = sugg; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index fd7e9bad8..307c6f6a7 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -240,7 +240,7 @@ Glib::RefPtr<StyleDialog::TreeStore> StyleDialog::TreeStore::create(StyleDialog StyleDialog::StyleDialog() : UI::Widget::Panel("/dialogs/style", SP_VERB_DIALOG_STYLE), _updating(false), - _textNode(NULL), + _textNode(nullptr), _desktopTracker() { #ifdef DEBUG_STYLEDIALOG @@ -377,8 +377,8 @@ StyleDialog::~StyleDialog() Inkscape::XML::Node* StyleDialog::_getStyleTextNode() { - Inkscape::XML::Node *styleNode = NULL; - Inkscape::XML::Node *textNode = NULL; + Inkscape::XML::Node *styleNode = nullptr; + Inkscape::XML::Node *textNode = nullptr; Inkscape::XML::Node *root = SP_ACTIVE_DOCUMENT->getReprRoot(); for (unsigned i = 0; i < root->childCount(); ++i) { @@ -392,7 +392,7 @@ Inkscape::XML::Node* StyleDialog::_getStyleTextNode() } } - if (textNode == NULL) { + if (textNode == nullptr) { // Style element found but does not contain text node! std::cerr << "StyleDialog::_getStyleTextNode(): No text node!" << std::endl; textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); @@ -402,7 +402,7 @@ Inkscape::XML::Node* StyleDialog::_getStyleTextNode() } } - if (styleNode == NULL) { + if (styleNode == nullptr) { // Style element not found, create one styleNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createElement("svg:style"); textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); @@ -410,7 +410,7 @@ Inkscape::XML::Node* StyleDialog::_getStyleTextNode() styleNode->appendChild(textNode); Inkscape::GC::release(textNode); - root->addChild(styleNode, NULL); + root->addChild(styleNode, nullptr); Inkscape::GC::release(styleNode); } @@ -439,7 +439,7 @@ void StyleDialog::_readStyleElement() _store->clear(); Inkscape::XML::Node * textNode = _getStyleTextNode(); - if (textNode == NULL) { + if (textNode == nullptr) { std::cerr << "StyleDialog::_readStyleElement: No text node!" << std::endl; } @@ -1015,7 +1015,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) std::cout << "StyleDialog::_handleButtonEvent: Entrance" << std::endl; #endif if (event->type == GDK_BUTTON_RELEASE && event->button == 1) { - Gtk::TreeViewColumn *col = 0; + Gtk::TreeViewColumn *col = nullptr; Gtk::TreeModel::Path path; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); @@ -1093,7 +1093,7 @@ void StyleDialog::_updateCSSPanel() properties = row[_mColumns._colProperties]; sheet = row[_mColumns._colProperties]; - _objObserver.set( NULL ); + _objObserver.set( nullptr ); } else { _cssPane->_propRenderer->property_editable() = false; _cssPane->_sheetRenderer->property_editable() = false; @@ -1108,7 +1108,7 @@ void StyleDialog::_updateCSSPanel() sheet = prow[_mColumns._colProperties]; } _objObserver.set( objects[0] ); - if (objects[0] && objects[0]->getAttribute("style") != NULL) { + if (objects[0] && objects[0]->getAttribute("style") != nullptr) { properties = objects[0]->getAttribute("style"); attr = objects[0]->getAttribute("style"); } @@ -1422,7 +1422,7 @@ bool StyleDialog::_delProperty(GdkEventButton *event) #endif if (event->type == GDK_BUTTON_RELEASE && event->button == 1) { - Gtk::TreeViewColumn *col = 0; + Gtk::TreeViewColumn *col = nullptr; Gtk::TreeModel::Path path; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); @@ -1490,7 +1490,7 @@ bool StyleDialog::_delProperty(GdkEventButton *event) if (objects[0]) { if (properties.empty()) { - objects[0]->setAttribute("style", NULL); + objects[0]->setAttribute("style", nullptr); } else { objects[0]->setAttribute("style", properties); } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 19d67916a..1c418a76d 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -44,7 +44,7 @@ SvgFontDrawingArea::SvgFontDrawingArea(): _x(0), _y(0), - _svgfont(0), + _svgfont(nullptr), _text() { } @@ -122,7 +122,7 @@ void SvgFontsDialog::AttrEntry::set_text(char* t){ // 'font-family' has a problem as it is also a presentation attribute for <text> void SvgFontsDialog::AttrEntry::on_attr_changed(){ - SPObject* o = NULL; + SPObject* o = nullptr; for (auto& node: dialog->get_selected_spfont()->children) { switch(this->attr){ case SP_PROP_FONT_FAMILY: @@ -132,7 +132,7 @@ void SvgFontsDialog::AttrEntry::on_attr_changed(){ } break; default: - o = NULL; + o = nullptr; } } @@ -171,7 +171,7 @@ void SvgFontsDialog::AttrSpin::set_value(double v){ void SvgFontsDialog::AttrSpin::on_attr_changed(){ - SPObject* o = NULL; + SPObject* o = nullptr; switch (this->attr) { // <font> attributes @@ -199,7 +199,7 @@ void SvgFontsDialog::AttrSpin::on_attr_changed(){ break; default: - o = NULL; + o = nullptr; } const gchar* name = (const gchar*)sp_attribute_name(this->attr); @@ -435,7 +435,7 @@ SPGlyphKerning* SvgFontsDialog::get_selected_kerning_pair() Gtk::TreeModel::iterator i = _KerningPairsList.get_selection()->get_selected(); if(i) return (*i)[_KerningPairsListColumns.spnode]; - return NULL; + return nullptr; } SvgFont* SvgFontsDialog::get_selected_svgfont() @@ -443,7 +443,7 @@ SvgFont* SvgFontsDialog::get_selected_svgfont() Gtk::TreeModel::iterator i = _FontsList.get_selection()->get_selected(); if(i) return (*i)[_columns.svgfont]; - return NULL; + return nullptr; } SPFont* SvgFontsDialog::get_selected_spfont() @@ -451,7 +451,7 @@ SPFont* SvgFontsDialog::get_selected_spfont() Gtk::TreeModel::iterator i = _FontsList.get_selection()->get_selected(); if(i) return (*i)[_columns.spfont]; - return NULL; + return nullptr; } SPGlyph* SvgFontsDialog::get_selected_glyph() @@ -459,7 +459,7 @@ SPGlyph* SvgFontsDialog::get_selected_glyph() Gtk::TreeModel::iterator i = _GlyphsList.get_selection()->get_selected(); if(i) return (*i)[_GlyphsListColumns.glyph_node]; - return NULL; + return nullptr; } Gtk::VBox* SvgFontsDialog::global_settings_tab(){ @@ -538,7 +538,7 @@ SvgFontsDialog::populate_kerning_pairs_box() SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count) { - g_return_val_if_fail(font != NULL, NULL); + g_return_val_if_fail(font != nullptr, NULL); Inkscape::XML::Document *xml_doc = document->getReprDoc(); // create a new glyph @@ -556,7 +556,7 @@ SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count) // get corresponding object SPGlyph *g = SP_GLYPH( document->getObjectByRepr(repr) ); - g_assert(g != NULL); + g_assert(g != nullptr); g_assert(SP_IS_GLYPH(g)); return g; @@ -848,7 +848,7 @@ void SvgFontsDialog::add_kerning_pair(){ second_glyph.get_active_text() == "") return; //look for this kerning pair on the currently selected font - this->kerning_pair = NULL; + this->kerning_pair = nullptr; for (auto& node: get_selected_spfont()->children) { //TODO: It is not really correct to get only the first byte of each string. //TODO: We should also support vertical kerning @@ -924,7 +924,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){ SPFont *new_font(SPDocument *document) { - g_return_val_if_fail(document != NULL, NULL); + g_return_val_if_fail(document != nullptr, NULL); SPDefs *defs = document->getDefs(); @@ -954,7 +954,7 @@ SPFont *new_font(SPDocument *document) // get corresponding object SPFont *f = SP_FONT( document->getObjectByRepr(repr) ); - g_assert(f != NULL); + g_assert(f != nullptr); g_assert(SP_IS_FONT(f)); Inkscape::GC::release(mg); Inkscape::GC::release(repr); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 7225f12e0..7d8729b0e 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -103,13 +103,13 @@ static void handleSecondaryClick( GtkWidget* /*widget*/, gint /*arg1*/, gpointer } } -static GtkWidget* popupMenu = 0; -static GtkWidget *popupSubHolder = 0; -static GtkWidget *popupSub = 0; +static GtkWidget* popupMenu = nullptr; +static GtkWidget *popupSubHolder = nullptr; +static GtkWidget *popupSub = nullptr; static std::vector<Glib::ustring> popupItems; static std::vector<GtkWidget*> popupExtras; -static ColorItem* bounceTarget = 0; -static SwatchesPanel* bouncePanel = 0; +static ColorItem* bounceTarget = nullptr; +static SwatchesPanel* bouncePanel = nullptr; static void redirClick( GtkMenuItem *menuitem, gpointer /*user_data*/ ) { @@ -163,7 +163,7 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr ) if ( verb ) { SPAction *action = verb->get_action( Inkscape::ActionContext( ( Inkscape::UI::View::View * ) SP_ACTIVE_DESKTOP ) ); if ( action ) { - sp_action_perform( action, NULL ); + sp_action_perform( action, nullptr ); } } } @@ -175,8 +175,8 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) { if ( bounceTarget ) { SwatchesPanel* swp = bouncePanel; - SPDesktop* desktop = swp ? swp->getDesktop() : 0; - SPDocument *doc = desktop ? desktop->doc() : 0; + SPDesktop* desktop = swp ? swp->getDesktop() : nullptr; + SPDocument *doc = desktop ? desktop->doc() : nullptr; if (doc) { std::string targetName(bounceTarget->def.descr); std::vector<SPObject *> gradients = doc->getResourceList("gradient"); @@ -195,8 +195,8 @@ void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer us { if ( bounceTarget ) { SwatchesPanel* swp = bouncePanel; - SPDesktop* desktop = swp ? swp->getDesktop() : 0; - SPDocument *doc = desktop ? desktop->doc() : 0; + SPDesktop* desktop = swp ? swp->getDesktop() : nullptr; + SPDocument *doc = desktop ? desktop->doc() : nullptr; gint index = GPOINTER_TO_INT(userData); if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) { Glib::ustring targetName = popupItems[index]; @@ -219,14 +219,14 @@ void SwatchesPanelHook::deleteGradient( GtkMenuItem */*menuitem*/, gpointer /*us { if ( bounceTarget ) { SwatchesPanel* swp = bouncePanel; - SPDesktop* desktop = swp ? swp->getDesktop() : 0; + SPDesktop* desktop = swp ? swp->getDesktop() : nullptr; sp_gradient_unset_swatch(desktop, bounceTarget->def.descr); } } static SwatchesPanel* findContainingPanel( GtkWidget *widget ) { - SwatchesPanel *swp = 0; + SwatchesPanel *swp = nullptr; std::map<GtkWidget*, SwatchesPanel*> rawObjects; for (std::map<SwatchesPanel*, SPDocument*>::iterator it = docPerPanel.begin(); it != docPerPanel.end(); ++it) { @@ -259,7 +259,7 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g if ( !popupMenu ) { popupMenu = gtk_menu_new(); - GtkWidget* child = 0; + GtkWidget* child = nullptr; //TRANSLATORS: An item in context menu on a colour in the swatches child = gtk_menu_item_new_with_label(_("Set fill")); @@ -455,8 +455,8 @@ void _loadPaletteFile(Glib::ustring path, gboolean user/*=FALSE*/) } if ( !hasErr && *ptr ) { char* n = trim(ptr); - if (n != NULL && *n) { - name = g_dpgettext2(NULL, "Palette", n); + if (n != nullptr && *n) { + name = g_dpgettext2(nullptr, "Palette", n); } if (name == "") { name = Glib::ustring::compose("#%1%2%3", @@ -492,7 +492,7 @@ void _loadPaletteFile(Glib::ustring path, gboolean user/*=FALSE*/) } else if ( strcmp( "Columns", name ) == 0 ) { - gchar* endPtr = 0; + gchar* endPtr = nullptr; guint64 numVal = g_ascii_strtoull( val, &endPtr, 10 ); if ( (numVal == G_MAXUINT64) && (ERANGE == errno) ) { // overflow @@ -569,13 +569,13 @@ SwatchesPanel& SwatchesPanel::getInstance() */ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : Inkscape::UI::Widget::Panel(prefsPath, SP_VERB_DIALOG_SWATCHES), - _menu(0), - _holder(0), - _clear(0), - _remove(0), + _menu(nullptr), + _holder(nullptr), + _clear(nullptr), + _remove(nullptr), _currentIndex(0), - _currentDesktop(0), - _currentDocument(0) + _currentDesktop(nullptr), + _currentDocument(nullptr) { _holder = new PreviewHolder(); @@ -604,7 +604,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : load_palettes(); - Gtk::RadioMenuItem* hotItem = 0; + Gtk::RadioMenuItem* hotItem = nullptr; _clear = new ColorItem( ege::PaintDef::CLEAR ); _remove = new ColorItem( ege::PaintDef::NONE ); @@ -612,11 +612,11 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : SwatchPage *docPalette = new SwatchPage(); docPalette->_name = "Auto"; - docPalettes[0] = docPalette; + docPalettes[nullptr] = docPalette; } if ( !systemSwatchPages.empty() || !userSwatchPages.empty()) { - SwatchPage* first = 0; + SwatchPage* first = nullptr; int index = 0; Glib::ustring targetName; if ( !_prefs_path.empty() ) { @@ -624,7 +624,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : targetName = prefs->getString(_prefs_path + "/palette"); if (!targetName.empty()) { if (targetName == "Auto") { - first = docPalettes[0]; + first = docPalettes[nullptr]; } else { std::vector<SwatchPage*> pages = _getSwatchSets(); for ( std::vector<SwatchPage*>::iterator iter = pages.begin(); iter != pages.end(); ++iter ) { @@ -639,7 +639,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : } if ( !first ) { - first = docPalettes[0]; + first = docPalettes[nullptr]; _currentIndex = 0; } else { _currentIndex = index; @@ -672,7 +672,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : SwatchesPanel::~SwatchesPanel() { - _trackDocument( this, 0 ); + _trackDocument( this, nullptr ); _documentConnection.disconnect(); _selChanged.disconnect(); @@ -744,7 +744,7 @@ void SwatchesPanel::_build_menu() Gtk::RadioMenuItem::Group heightGroup; for (unsigned int i = 0; i < G_N_ELEMENTS(heightLabels); i++) { - Glib::ustring _label(g_dpgettext2(NULL, "Swatches height", heightLabels[i])); + Glib::ustring _label(g_dpgettext2(nullptr, "Swatches height", heightLabels[i])); Gtk::RadioMenuItem* _item = Gtk::manage(new Gtk::RadioMenuItem(heightGroup, _label)); sizeMenu->append(*_item); if (i == panel_size) { @@ -784,7 +784,7 @@ void SwatchesPanel::_build_menu() } } for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) { - Glib::ustring _label(g_dpgettext2(NULL, "Swatches width", widthLabels[i])); + Glib::ustring _label(g_dpgettext2(nullptr, "Swatches width", widthLabels[i])); Gtk::RadioMenuItem *_item = Gtk::manage(new Gtk::RadioMenuItem(widthGroup, _label)); type_menu->append(*_item); if ( i <= hot_index ) { @@ -820,7 +820,7 @@ void SwatchesPanel::_build_menu() } } for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) { - Glib::ustring _label(g_dpgettext2(NULL, "Swatches border", widthLabels[i])); + Glib::ustring _label(g_dpgettext2(nullptr, "Swatches border", widthLabels[i])); Gtk::RadioMenuItem *_item = Gtk::manage(new Gtk::RadioMenuItem(widthGroup, _label)); type_menu->append(*_item); if ( i <= hot_index ) { @@ -878,7 +878,7 @@ void SwatchesPanel::setDesktop( SPDesktop* desktop ) _setDocument( desktop->doc() ); } else { - _setDocument(0); + _setDocument(nullptr); } } } @@ -1030,7 +1030,7 @@ public: if ( timer ) { timer->stop(); delete timer; - timer = 0; + timer = nullptr; } } if (doc) { @@ -1038,7 +1038,7 @@ public: defsChanged.disconnect(); defsModified.disconnect(); doc->doUnref(); - doc = NULL; + doc = nullptr; } } @@ -1067,7 +1067,7 @@ private: DocTrack &operator=(DocTrack const &) = delete; // no assign }; -Glib::Timer *DocTrack::timer = 0; +Glib::Timer *DocTrack::timer = nullptr; int DocTrack::timerRefCount = 0; sigc::connection DocTrack::refreshTimer; @@ -1121,7 +1121,7 @@ bool DocTrack::queueUpdateIfNeeded( SPDocument *doc ) void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document ) { - SPDocument *oldDoc = NULL; + SPDocument *oldDoc = nullptr; if (docPerPanel.find(panel) != docPerPanel.end()) { oldDoc = docPerPanel[panel]; if (!oldDoc) { @@ -1130,7 +1130,7 @@ void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document ) } if (oldDoc != document) { if (oldDoc) { - docPerPanel[panel] = NULL; + docPerPanel[panel] = nullptr; bool found = false; for (std::map<SwatchesPanel*, SPDocument*>::iterator it = docPerPanel.begin(); (it != docPerPanel.end()) && !found; ++it) { found = (it->second == document); @@ -1230,7 +1230,7 @@ static void recalcSwatchContents(SPDocument* doc, void SwatchesPanel::handleGradientsChange(SPDocument *document) { - SwatchPage *docPalette = (docPalettes.find(document) != docPalettes.end()) ? docPalettes[document] : 0; + SwatchPage *docPalette = (docPalettes.find(document) != docPalettes.end()) ? docPalettes[document] : nullptr; if (docPalette) { boost::ptr_vector<ColorItem> tmpColors; std::map<ColorItem*, cairo_pattern_t*> tmpPrevs; @@ -1265,7 +1265,7 @@ void SwatchesPanel::handleGradientsChange(SPDocument *document) void SwatchesPanel::handleDefsModified(SPDocument *document) { - SwatchPage *docPalette = (docPalettes.find(document) != docPalettes.end()) ? docPalettes[document] : 0; + SwatchPage *docPalette = (docPalettes.find(document) != docPalettes.end()) ? docPalettes[document] : nullptr; if (docPalette && !DocTrack::queueUpdateIfNeeded(document) ) { boost::ptr_vector<ColorItem> tmpColors; std::map<ColorItem*, cairo_pattern_t*> tmpPrevs; @@ -1316,7 +1316,7 @@ std::vector<SwatchPage*> SwatchesPanel::_getSwatchSets() const void SwatchesPanel::_updateFromSelection() { - SwatchPage *docPalette = (docPalettes.find(_currentDocument) != docPalettes.end()) ? docPalettes[_currentDocument] : 0; + SwatchPage *docPalette = (docPalettes.find(_currentDocument) != docPalettes.end()) ? docPalettes[_currentDocument] : nullptr; if ( docPalette ) { Glib::ustring fillId; Glib::ustring strokeId; @@ -1331,7 +1331,7 @@ void SwatchesPanel::_updateFromSelection() if (tmpStyle.fill.set && tmpStyle.fill.isPaintserver()) { SPPaintServer* server = tmpStyle.getFillPaintServer(); if ( SP_IS_GRADIENT(server) ) { - SPGradient* target = 0; + SPGradient* target = nullptr; SPGradient* grad = SP_GRADIENT(server); if ( grad->isSwatch() ) { @@ -1364,7 +1364,7 @@ void SwatchesPanel::_updateFromSelection() if (tmpStyle.stroke.set && tmpStyle.stroke.isPaintserver()) { SPPaintServer* server = tmpStyle.getStrokePaintServer(); if ( SP_IS_GRADIENT(server) ) { - SPGradient* target = 0; + SPGradient* target = nullptr; SPGradient* grad = SP_GRADIENT(server); if ( grad->isSwatch() ) { target = grad; diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index dc65f299f..af044eff0 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -107,11 +107,11 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : UI::Widget::Panel(prefsPath, SP_VERB_DIALOG_SYMBOLS), store(Gtk::ListStore::create(*getColumns())), all_docs_processed(0), - icon_view(0), - current_desktop(0), + icon_view(nullptr), + current_desktop(nullptr), desk_track(), - current_document(0), - preview_document(0), + current_document(nullptr), + preview_document(nullptr), instanceConns() { @@ -527,13 +527,13 @@ void SymbolsDialog::hideOverlay() { void SymbolsDialog::insertSymbol() { Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_SYMBOL ); SPAction *action = verb->get_action(Inkscape::ActionContext( (Inkscape::UI::View::View *) current_desktop) ); - sp_action_perform (action, NULL); + sp_action_perform (action, nullptr); } void SymbolsDialog::revertSymbol() { Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_UNSYMBOL ); SPAction *action = verb->get_action(Inkscape::ActionContext( (Inkscape::UI::View::View *) current_desktop ) ); - sp_action_perform (action, NULL); + sp_action_perform (action, nullptr); } void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/) @@ -589,7 +589,7 @@ SPDocument* SymbolsDialog::selectedSymbols() { /* OK, we know symbol name... now we need to copy it to clipboard, bon chance! */ Glib::ustring doc_title = symbol_set->get_active_text(); if (doc_title == ALLDOCS) { - return NULL; + return nullptr; } SPDocument* symbol_document = symbol_sets[doc_title]; if( !symbol_document ) { @@ -728,7 +728,7 @@ SPDocument* read_vss(Glib::ustring filename, Glib::ustring name ) { g_free(fullname); if (!libvisio::VisioDocument::isSupported(&input)) { - return NULL; + return nullptr; } RVNGStringVector output; RVNGStringVector titles; @@ -739,10 +739,10 @@ SPDocument* read_vss(Glib::ustring filename, Glib::ustring name ) { #else if (!libvisio::VisioDocument::generateSVGStencils(&input, output)) { #endif - return NULL; + return nullptr; } if (output.empty()) { - return NULL; + return nullptr; } // prepare a valid title for the symbol file @@ -816,7 +816,7 @@ void SymbolsDialog::getSymbolsTitle() { if(title.empty()) { title = _("Unnamed Symbols"); } - symbol_sets[title]= NULL; + symbol_sets[title]= nullptr; ++number_docs; } else { std::ifstream infile(filename); @@ -824,7 +824,7 @@ void SymbolsDialog::getSymbolsTitle() { while (std::getline(infile, line)) { std::string title_res = std::regex_replace (line, matchtitle,"$1",std::regex_constants::format_no_copy); if (!title_res.empty()) { - symbol_sets[ellipsize(Glib::ustring(title_res), 33)]= NULL; + symbol_sets[ellipsize(Glib::ustring(title_res), 33)]= nullptr; ++number_docs; break; } @@ -836,7 +836,7 @@ void SymbolsDialog::getSymbolsTitle() { if(title.empty()) { title = _("Unnamed Symbols"); } - symbol_sets[title]= NULL; + symbol_sets[title]= nullptr; ++number_docs; break; } @@ -852,7 +852,7 @@ void SymbolsDialog::getSymbolsTitle() { std::pair<Glib::ustring, SPDocument*> SymbolsDialog::getSymbolsSet(Glib::ustring title) { - SPDocument* symbol_doc = NULL; + SPDocument* symbol_doc = nullptr; Glib::ustring current = symbol_set->get_active_text(); if (current == CURRENTDOC) { return std::make_pair(CURRENTDOC, symbol_doc); @@ -995,7 +995,7 @@ std::vector<SPUse*> SymbolsDialog::useInDoc( SPDocument* useDocument) { // This is a last ditch effort to find a style. gchar const* SymbolsDialog::styleFromUse( gchar const* id, SPDocument* document) { - gchar const* style = 0; + gchar const* style = nullptr; std::vector<SPUse*> l = useInDoc( document ); for( auto use:l ) { if ( use ) { @@ -1231,8 +1231,8 @@ void SymbolsDialog::addSymbol( SPObject* symbol, Glib::ustring doc_title) { if( pixbuf ) { Gtk::ListStore::iterator row = store->append(); (*row)[columns->symbol_id] = Glib::ustring( id ); - (*row)[columns->symbol_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", symbol_title.c_str()) )); - (*row)[columns->symbol_doc_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "SymbolDoc", doc_title.c_str()) )); + (*row)[columns->symbol_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "Symbol", symbol_title.c_str()) )); + (*row)[columns->symbol_doc_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "SymbolDoc", doc_title.c_str()) )); (*row)[columns->symbol_image] = pixbuf; } g_free(title); @@ -1301,10 +1301,10 @@ SymbolsDialog::drawSymbol(SPObject *symbol) preview_document->ensureUpToDate(); SPItem *item = dynamic_cast<SPItem *>(object_temp); - g_assert(item != NULL); + g_assert(item != nullptr); unsigned psize = SYMBOL_ICON_SIZES[pack_size]; - Glib::RefPtr<Gdk::Pixbuf> pixbuf(NULL); + Glib::RefPtr<Gdk::Pixbuf> pixbuf(nullptr); // We could use cache here, but it doesn't really work with the structure // of this user interface and we've already cached the pixbuf in the gtklist diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index 71a7e2ccf..720cf0507 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -135,8 +135,8 @@ void TagsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ) { - GtkWidget* iconWidget = 0; - const char* label = 0; + GtkWidget* iconWidget = nullptr; + const char* label = nullptr; if ( iconName ) { iconWidget = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_MENU ); @@ -160,14 +160,14 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, label = fallback; } - Gtk::Widget* wrapped = 0; + Gtk::Widget* wrapped = nullptr; if ( iconWidget ) { wrapped = Gtk::manage(Glib::wrap(iconWidget)); wrapped->show(); } - Gtk::MenuItem* item = 0; + Gtk::MenuItem* item = nullptr; if (wrapped) { item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label, true)); @@ -188,7 +188,7 @@ void TagsPanel::_fireAction( unsigned int code ) if ( verb ) { SPAction *action = verb->get_action(_desktop); if ( action ) { - sp_action_perform( action, NULL ); + sp_action_perform( action, nullptr ); } } } @@ -260,7 +260,7 @@ bool TagsPanel::_executeAction() } delete _pending; - _pending = 0; + _pending = nullptr; } return false; @@ -313,7 +313,7 @@ bool TagsPanel::_checkForUpdated(const Gtk::TreePath &/*path*/, const Gtk::TreeI */ //row[_model->_colLabel] = layer->label() ? layer->label() : layer->getId(); gchar const *label; - SPTagUse * use = SP_IS_TAG_USE(obj) ? SP_TAG_USE(obj) : 0; + SPTagUse * use = SP_IS_TAG_USE(obj) ? SP_TAG_USE(obj) : nullptr; if (use && use->ref->isAttached()) { label = use->ref->getObject()->getAttribute("inkscape:label"); } else { @@ -370,7 +370,7 @@ void TagsPanel::_objectsChanged(SPObject* root) if ( root ) { _selectedConnection.block(); _store->clear(); - _addObject( document, root, 0 ); + _addObject( document, root, nullptr ); _selectedConnection.unblock(); _objectsSelected(_desktop->selection); _checkTreeSelection(); @@ -581,7 +581,7 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1)) { // Alt left click on the visible/lock columns - eat this event to keep row selection Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -609,7 +609,7 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) if ( (event->type == GDK_BUTTON_RELEASE) && (event->button == 1)) { Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -681,7 +681,7 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) if ( event->type == GDK_BUTTON_RELEASE && doubleclick) { doubleclick = 0; Gtk::TreeModel::Path path; - Gtk::TreeViewColumn* col = 0; + Gtk::TreeViewColumn* col = nullptr; int x = static_cast<int>(event->x); int y = static_cast<int>(event->y); int x2 = 0; @@ -707,7 +707,7 @@ void TagsPanel::_storeDragSource(const Gtk::TreeModel::iterator& iter) { Gtk::TreeModel::Row row = *iter; SPObject* obj = row[_model->_colObject]; - SPTag* item = ( obj && SP_IS_TAG(obj) ) ? SP_TAG(obj) : 0; + SPTag* item = ( obj && SP_IS_TAG(obj) ) ? SP_TAG(obj) : nullptr; if (item) { _dnd_source.push_back(item); @@ -899,13 +899,13 @@ void TagsPanel::_setExpanded(const Gtk::TreeModel::iterator& iter, const Gtk::Tr */ TagsPanel::TagsPanel() : UI::Widget::Panel("/dialogs/tags", SP_VERB_DIALOG_TAGS), - _rootWatcher(0), + _rootWatcher(nullptr), deskTrack(), - _desktop(0), - _document(0), - _model(0), - _pending(0), - _toggleEvent(0), + _desktop(nullptr), + _document(nullptr), + _model(nullptr), + _pending(nullptr), + _toggleEvent(nullptr), _defer_target(), desktopChangeConn() { @@ -1001,7 +1001,7 @@ TagsPanel::TagsPanel() : // ------------------------------------------------------- { - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_TAG_NEW, 0, "Add a new selection set", (int)BUTTON_NEW ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_TAG_NEW, nullptr, "Add a new selection set", (int)BUTTON_NEW ) ); _popupMenu.show_all_children(); } @@ -1033,23 +1033,23 @@ TagsPanel::TagsPanel() : TagsPanel::~TagsPanel() { - setDesktop(NULL); + setDesktop(nullptr); if ( _model ) { delete _model; - _model = 0; + _model = nullptr; } if (_pending) { delete _pending; - _pending = 0; + _pending = nullptr; } if ( _toggleEvent ) { gdk_event_free( _toggleEvent ); - _toggleEvent = 0; + _toggleEvent = nullptr; } desktopChangeConn.disconnect(); @@ -1070,7 +1070,7 @@ void TagsPanel::setDocument(SPDesktop* /*desktop*/, SPDocument* document) { _rootWatcher->_repr->removeObserver(*_rootWatcher); delete _rootWatcher; - _rootWatcher = NULL; + _rootWatcher = nullptr; } _document = document; @@ -1091,7 +1091,7 @@ void TagsPanel::setDesktop( SPDesktop* desktop ) _documentChangedConnection.disconnect(); _selectionChangedConnection.disconnect(); if ( _desktop ) { - _desktop = 0; + _desktop = nullptr; } _desktop = Panel::getDesktop(); diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp index d39c03709..8e4a3c667 100644 --- a/src/ui/dialog/template-load-tab.cpp +++ b/src/ui/dialog/template-load-tab.cpp @@ -184,7 +184,7 @@ void TemplateLoadTab::_refreshTemplatesList() } // reselect item - Gtk::TreeIter* item_to_select = NULL; + Gtk::TreeIter* item_to_select = nullptr; for (Gtk::TreeModel::Children::iterator it = _tlist_store->children().begin(); it != _tlist_store->children().end(); ++it) { Gtk::TreeModel::Row row = *it; if (_current_template == row[_columns.textValue]) { @@ -244,7 +244,7 @@ TemplateLoadTab::TemplateData TemplateLoadTab::_processTemplateFile(const std::s myRoot = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); - if (myRoot == NULL) // No template info + if (myRoot == nullptr) // No template info return result; _getDataFromNode(myRoot, result); } @@ -281,20 +281,20 @@ void TemplateLoadTab::_getProceduralTemplates() void TemplateLoadTab::_getDataFromNode(Inkscape::XML::Node *dataNode, TemplateData &data) { Inkscape::XML::Node *currentData; - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_name")) != NULL) + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_name")) != nullptr) data.display_name = _(currentData->firstChild()->content()); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:author")) != NULL) + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:author")) != nullptr) data.author = currentData->firstChild()->content(); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_shortdesc")) != NULL) + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_shortdesc")) != nullptr) data.short_description = _( currentData->firstChild()->content()); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_long") )!= NULL) + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_long") )!= nullptr) data.long_description = _(currentData->firstChild()->content()); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:preview")) != NULL) + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:preview")) != nullptr) data.preview_name = currentData->firstChild()->content(); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:date")) != NULL) + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:date")) != nullptr) data.creation_date = currentData->firstChild()->content(); - if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_keywords")) != NULL){ + if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_keywords")) != nullptr){ Glib::ustring tplKeywords = _(currentData->firstChild()->content()); while (!tplKeywords.empty()){ std::size_t pos = tplKeywords.find_first_of(" "); diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index 12c6b0298..978cadb53 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -31,7 +31,7 @@ TemplateWidget::TemplateWidget() : _more_info_button(_("More info")) , _short_description_label(" ") , _template_name_label(_("no template selected")) - , _effect_prefs(NULL) + , _effect_prefs(nullptr) { pack_start(_template_name_label, Gtk::PACK_SHRINK, 10); pack_start(_preview_box, Gtk::PACK_SHRINK, 0); @@ -97,7 +97,7 @@ void TemplateWidget::display(TemplateLoadTab::TemplateData data) } if (data.is_procedural){ - _effect_prefs = data.tpl_effect->get_imp()->prefs_effect(data.tpl_effect, SP_ACTIVE_DESKTOP, NULL, NULL); + _effect_prefs = data.tpl_effect->get_imp()->prefs_effect(data.tpl_effect, SP_ACTIVE_DESKTOP, nullptr, nullptr); pack_start(*_effect_prefs); } _more_info_button.set_sensitive(true); @@ -109,9 +109,9 @@ void TemplateWidget::clear() _short_description_label.set_text(""); _preview_render.hide(); _preview_image.hide(); - if (_effect_prefs != NULL){ + if (_effect_prefs != nullptr){ remove (*_effect_prefs); - _effect_prefs = NULL; + _effect_prefs = nullptr; } _more_info_button.set_sensitive(false); } diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 5cb0993c6..7b43977bb 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -69,7 +69,7 @@ TextEdit::TextEdit() setasdefault_button(_("Set as _default")), close_button(_("_Close"), true), apply_button(_("_Apply"), true), - desktop(NULL), + desktop(nullptr), deskTrack(), selectChangedConn(), subselChangedConn(), @@ -110,7 +110,7 @@ TextEdit::TextEdit() scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); scroller.set_shadow_type(Gtk::SHADOW_IN); - text_buffer = gtk_text_buffer_new (NULL); + text_buffer = gtk_text_buffer_new (nullptr); text_view = gtk_text_view_new_with_buffer (text_buffer); gtk_text_view_set_wrap_mode ((GtkTextView *) text_view, GTK_WRAP_WORD); @@ -320,7 +320,7 @@ void TextEdit::setPreviewText (Glib::ustring font_spec, Glib::ustring font_featu SPItem *TextEdit::getSelectedTextItem (void) { if (!SP_ACTIVE_DESKTOP) - return NULL; + return nullptr; auto tmp= SP_ACTIVE_DESKTOP->getSelection()->items(); for(auto i=tmp.begin();i!=tmp.end();++i) @@ -329,7 +329,7 @@ SPItem *TextEdit::getSelectedTextItem (void) return *i; } - return NULL; + return nullptr; } diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 2486e8897..e95724435 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -97,9 +97,9 @@ UndoHistory::UndoHistory() : UI::Widget::Panel("/dialogs/undo-history", SP_VERB_DIALOG_UNDO_HISTORY), _document_replaced_connection(), _desktop(getDesktop()), - _document(_desktop ? _desktop->doc() : NULL), - _event_log(_desktop ? _desktop->event_log : NULL), - _columns(_event_log ? &_event_log->getColumns() : NULL), + _document(_desktop ? _desktop->doc() : nullptr), + _event_log(_desktop ? _desktop->event_log : nullptr), + _columns(_event_log ? &_event_log->getColumns() : nullptr), _scrolled_window(), _event_list_store(), _event_list_selection(_event_list_view.get_selection()), @@ -184,13 +184,13 @@ void UndoHistory::setDesktop(SPDesktop* desktop) { Panel::setDesktop(desktop); - EventLog *newEventLog = desktop ? desktop->event_log : NULL; + EventLog *newEventLog = desktop ? desktop->event_log : nullptr; if ((_desktop == desktop) && (_event_log == newEventLog)) { // same desktop set } else { - _connectDocument(desktop, desktop ? desktop->doc() : NULL); + _connectDocument(desktop, desktop ? desktop->doc() : nullptr); } } @@ -207,8 +207,8 @@ void UndoHistory::_connectDocument(SPDesktop* desktop, SPDocument * /*document*/ // connect to new EventLog/Desktop _desktop = desktop; - _event_log = desktop ? desktop->event_log : NULL; - _document = desktop ? desktop->doc() : NULL; + _event_log = desktop ? desktop->event_log : nullptr; + _document = desktop ? desktop->doc() : nullptr; _connectEventLog(); } @@ -234,7 +234,7 @@ void UndoHistory::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *docume void *UndoHistory::_handleEventLogDestroyCB(void *data) { - void *result = NULL; + void *result = nullptr; if (data) { UndoHistory *self = reinterpret_cast<UndoHistory*>(data); result = self->_handleEventLogDestroy(); @@ -250,10 +250,10 @@ void *UndoHistory::_handleEventLogDestroy() _event_list_view.unset_model(); _event_list_store.reset(); - _event_log = NULL; + _event_log = nullptr; } - return NULL; + return nullptr; } void @@ -316,7 +316,7 @@ UndoHistory::_onListSelectionChange() last_selected == last_selected->parent()->children().begin() ) { last_selected = last_selected->parent(); - _event_log->setCurrEventParent((EventLog::iterator)NULL); + _event_log->setCurrEventParent((EventLog::iterator)nullptr); } else { --last_selected; if ( !last_selected->children().empty() ) { @@ -347,7 +347,7 @@ UndoHistory::_onListSelectionChange() { last_selected = last_selected->parent(); ++last_selected; - _event_log->setCurrEventParent((EventLog::iterator)NULL); + _event_log->setCurrEventParent((EventLog::iterator)nullptr); } } } diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index f582161d9..ae5be30ff 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -41,7 +41,7 @@ public: CellRendererSPIcon() : Glib::ObjectBase(typeid(CellRendererPixbuf)), Gtk::CellRendererPixbuf(), - _property_icon(*this, "icon", Glib::RefPtr<Gdk::Pixbuf>(0)), + _property_icon(*this, "icon", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), _property_event_type(*this, "event_type", 0) { } diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index e3975dfdc..6be6d9f22 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -51,15 +51,15 @@ namespace Dialog { XmlTree::XmlTree() : UI::Widget::Panel("/dialogs/xml/", SP_VERB_DIALOG_XML_EDITOR), blocked (0), - _message_stack (NULL), - _message_context (NULL), - current_desktop (NULL), - current_document (NULL), + _message_stack (nullptr), + _message_context (nullptr), + current_desktop (nullptr), + current_document (nullptr), selected_attr (0), - selected_repr (NULL), - tree (NULL), - attributes (NULL), - content (NULL), + selected_repr (nullptr), + tree (nullptr), + attributes (nullptr), + content (nullptr), attr_name (), status (""), tree_toolbar(), @@ -77,7 +77,7 @@ XmlTree::XmlTree() : attr_container (), attr_subpaned_container(Gtk::ORIENTATION_VERTICAL), set_attr (_("Set")), - new_window(NULL) + new_window(nullptr) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -108,7 +108,7 @@ XmlTree::XmlTree() : /* tree view */ paned.pack1(left_box); - tree = SP_XMLVIEW_TREE(sp_xmlview_tree_new(NULL, NULL, NULL)); + tree = SP_XMLVIEW_TREE(sp_xmlview_tree_new(nullptr, nullptr, nullptr)); gtk_widget_set_tooltip_text( GTK_WIDGET(tree), _("Drag to reorder nodes") ); tree_toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS); @@ -200,7 +200,7 @@ XmlTree::XmlTree() : /* attributes */ right_box.pack_start( attr_container, TRUE, TRUE, 0 ); - attributes = SP_XMLVIEW_ATTR_LIST(sp_xmlview_attr_list_new(NULL)); + attributes = SP_XMLVIEW_ATTR_LIST(sp_xmlview_attr_list_new(nullptr)); attr_toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS); @@ -249,7 +249,7 @@ XmlTree::XmlTree() : text_container.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); right_box.pack_start(text_container, TRUE, TRUE, 0); - content = SP_XMLVIEW_CONTENT(sp_xmlview_content_new(NULL)); + content = SP_XMLVIEW_CONTENT(sp_xmlview_content_new(nullptr)); text_container.add(*Gtk::manage(Glib::wrap(GTK_WIDGET(content)))); /* Signal handlers */ @@ -288,7 +288,7 @@ XmlTree::XmlTree() : tree_reset_context(); - g_assert(desktop != NULL); + g_assert(desktop != nullptr); set_tree_desktop(desktop); } @@ -305,13 +305,13 @@ void XmlTree::present() XmlTree::~XmlTree (void) { - set_tree_desktop(NULL); + set_tree_desktop(nullptr); _message_changed_connection.disconnect(); delete _message_context; - _message_context = NULL; + _message_context = nullptr; Inkscape::GC::release(_message_stack); - _message_stack = NULL; + _message_stack = nullptr; _message_changed_connection.~connection(); } @@ -378,7 +378,7 @@ void XmlTree::set_tree_desktop(SPDesktop *desktop) set_tree_document(desktop->getDocument()); } else { - set_tree_document(NULL); + set_tree_document(nullptr); } } // end of set_tree_desktop() @@ -400,7 +400,7 @@ void XmlTree::set_tree_document(SPDocument *document) on_document_uri_set( current_document->getURI(), current_document ); set_tree_repr(current_document->getReprRoot()); } else { - set_tree_repr(NULL); + set_tree_repr(nullptr); } } @@ -416,7 +416,7 @@ void XmlTree::set_tree_repr(Inkscape::XML::Node *repr) if (repr) { set_tree_select(get_dt_select()); } else { - set_tree_select(NULL); + set_tree_select(nullptr); } propagate_tree_select(selected_repr); @@ -444,7 +444,7 @@ void XmlTree::set_tree_select(Inkscape::XML::Node *repr) GtkTreePath* path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree->store), &node); gtk_tree_view_expand_to_path (GTK_TREE_VIEW(tree), path); - gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(tree), path, NULL, TRUE, 0.66, 0.0); + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(tree), path, nullptr, TRUE, 0.66, 0.0); gtk_tree_path_free(path); gtk_tree_selection_select_iter(selection, &node); @@ -469,13 +469,13 @@ void XmlTree::propagate_tree_select(Inkscape::XML::Node *repr) if (repr && (repr->type() == Inkscape::XML::ELEMENT_NODE)) { sp_xmlview_attr_list_set_repr(attributes, repr); } else { - sp_xmlview_attr_list_set_repr(attributes, NULL); + sp_xmlview_attr_list_set_repr(attributes, nullptr); } if (repr && ( repr->type() == Inkscape::XML::TEXT_NODE || repr->type() == Inkscape::XML::COMMENT_NODE || repr->type() == Inkscape::XML::PI_NODE ) ) { sp_xmlview_content_set_repr(content, repr); } else { - sp_xmlview_content_set_repr(content, NULL); + sp_xmlview_content_set_repr(content, nullptr); } } @@ -483,7 +483,7 @@ void XmlTree::propagate_tree_select(Inkscape::XML::Node *repr) Inkscape::XML::Node *XmlTree::get_dt_select() { if (!current_desktop) { - return NULL; + return nullptr; } return current_desktop->getSelection()->singleRepr(); } @@ -508,7 +508,7 @@ void XmlTree::set_dt_select(Inkscape::XML::Node *repr) object = current_desktop->getDocument()->getObjectByRepr(repr); } else { - object = NULL; + object = nullptr; } blocked++; @@ -538,14 +538,14 @@ void XmlTree::on_tree_select_row(GtkTreeSelection *selection, gpointer data) if (self->selected_repr) { Inkscape::GC::release(self->selected_repr); - self->selected_repr = NULL; + self->selected_repr = nullptr; } if (!gtk_tree_selection_get_selected (selection, &model, &iter)) { // Nothing selected, update widgets - self->propagate_tree_select(NULL); - self->set_dt_select(NULL); + self->propagate_tree_select(nullptr); + self->set_dt_select(nullptr); self->on_tree_unselect_row_disable(); self->on_tree_unselect_row_hide(); self->on_attr_unselect_row_clear_text(); @@ -553,7 +553,7 @@ void XmlTree::on_tree_select_row(GtkTreeSelection *selection, gpointer data) } Inkscape::XML::Node *repr = sp_xmlview_tree_node_get_repr(model, &iter); - g_assert(repr != NULL); + g_assert(repr != nullptr); self->selected_repr = repr; @@ -584,7 +584,7 @@ void XmlTree::after_tree_move(SPXMLViewTree * /*attributes*/, gpointer value, gp * data is probably not synchronized, so reload the tree */ SPDocument *document = self->current_document; - self->set_tree_document(NULL); + self->set_tree_document(nullptr); self->set_tree_document(document); } } @@ -757,8 +757,8 @@ void XmlTree::on_attr_select_row(GtkTreeSelection *selection, gpointer data) return; } - gchar *name = 0; - gchar *value = 0; + gchar *name = nullptr; + gchar *value = nullptr; guint attr = 0; gtk_tree_model_get (model, &iter, ATTR_COL_NAME, &name, ATTR_COL_VALUE, &value, ATTR_COL_ATTR, &attr, -1); @@ -786,7 +786,7 @@ void XmlTree::on_attr_row_changed(SPXMLViewAttrList *attributes, const gchar * n GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(attributes)); GtkTreeIter iter; GtkTreeModel *model; - gchar *attr_name = 0; + gchar *attr_name = nullptr; if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gtk_tree_model_get (model, &iter, 0, &attr_name, -1); if (gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter) ) { @@ -799,7 +799,7 @@ void XmlTree::on_attr_row_changed(SPXMLViewAttrList *attributes, const gchar * n if (attr_name) { g_free(attr_name); - attr_name = 0; + attr_name = nullptr; } } @@ -875,9 +875,9 @@ void XmlTree::cmd_new_element_node() { GtkWidget *cancel, *vbox, *bbox, *sep; - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); - new_window = sp_window_new(NULL, TRUE); + new_window = sp_window_new(nullptr, TRUE); gtk_container_set_border_width(GTK_CONTAINER(new_window), 4); gtk_window_set_title(GTK_WINDOW(new_window), _("New element node...")); gtk_window_set_resizable(GTK_WINDOW(new_window), FALSE); @@ -951,7 +951,7 @@ void XmlTree::cmd_new_element_node() void XmlTree::cmd_new_text_node() { - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); Inkscape::XML::Document *xml_doc = current_document->getReprDoc(); Inkscape::XML::Node *text = xml_doc->createTextNode(""); @@ -969,7 +969,7 @@ void XmlTree::cmd_new_text_node() void XmlTree::cmd_duplicate_node() { - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); Inkscape::XML::Node *parent = selected_repr->parent(); Inkscape::XML::Node *dup = selected_repr->duplicate(parent->document()); @@ -988,7 +988,7 @@ void XmlTree::cmd_duplicate_node() void XmlTree::cmd_delete_node() { - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); sp_repr_unparent(selected_repr); reinterpret_cast<SPObject *>(current_desktop->currentLayer())->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -1000,10 +1000,10 @@ void XmlTree::cmd_delete_node() void XmlTree::cmd_delete_attr() { - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); g_assert(selected_attr != 0); - selected_repr->setAttribute(g_quark_to_string(selected_attr), NULL); + selected_repr->setAttribute(g_quark_to_string(selected_attr), nullptr); SPObject *updated = current_document->getObjectByRepr(selected_repr); if (updated) { @@ -1019,7 +1019,7 @@ void XmlTree::cmd_delete_attr() void XmlTree::cmd_set_attr() { - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); gchar *name = g_strdup(attr_name.get_text().c_str()); gchar *value = g_strdup(attr_value.get_buffer()->get_text().c_str()); @@ -1046,14 +1046,14 @@ void XmlTree::cmd_set_attr() void XmlTree::cmd_raise_node() { - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); Inkscape::XML::Node *parent = selected_repr->parent(); - g_return_if_fail(parent != NULL); + g_return_if_fail(parent != nullptr); g_return_if_fail(parent->firstChild() != selected_repr); - Inkscape::XML::Node *ref = NULL; + Inkscape::XML::Node *ref = nullptr; Inkscape::XML::Node *before = parent->firstChild(); while (before && (before->next() != selected_repr)) { ref = before; @@ -1073,9 +1073,9 @@ void XmlTree::cmd_raise_node() void XmlTree::cmd_lower_node() { - g_assert(selected_repr != NULL); + g_assert(selected_repr != nullptr); - g_return_if_fail(selected_repr->next() != NULL); + g_return_if_fail(selected_repr->next() != nullptr); Inkscape::XML::Node *parent = selected_repr->parent(); parent->changeOrder(selected_repr, selected_repr->next()); @@ -1090,20 +1090,20 @@ void XmlTree::cmd_lower_node() void XmlTree::cmd_indent_node() { Inkscape::XML::Node *repr = selected_repr; - g_assert(repr != NULL); + g_assert(repr != nullptr); Inkscape::XML::Node *parent = repr->parent(); - g_return_if_fail(parent != NULL); + g_return_if_fail(parent != nullptr); g_return_if_fail(parent->firstChild() != repr); Inkscape::XML::Node* prev = parent->firstChild(); while (prev && (prev->next() != repr)) { prev = prev->next(); } - g_return_if_fail(prev != NULL); + g_return_if_fail(prev != nullptr); g_return_if_fail(prev->type() == Inkscape::XML::ELEMENT_NODE); - Inkscape::XML::Node* ref = NULL; + Inkscape::XML::Node* ref = nullptr; if (prev->firstChild()) { for( ref = prev->firstChild() ; ref->next() ; ref = ref->next() ){}; } @@ -1123,7 +1123,7 @@ void XmlTree::cmd_indent_node() void XmlTree::cmd_unindent_node() { Inkscape::XML::Node *repr = selected_repr; - g_assert(repr != NULL); + g_assert(repr != nullptr); Inkscape::XML::Node *parent = repr->parent(); g_return_if_fail(parent); @@ -1149,13 +1149,13 @@ bool XmlTree::in_dt_coordsys(SPObject const &item) { /* Definition based on sp_item_i2doc_affine. */ SPObject const *child = &item; - g_return_val_if_fail(child != NULL, false); + g_return_val_if_fail(child != nullptr, false); for(;;) { if (!SP_IS_ITEM(child)) { return false; } SPObject const * const parent = child->parent; - if (parent == NULL) { + if (parent == nullptr) { break; } child = parent; |
