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 | |
| 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')
174 files changed, 1935 insertions, 1935 deletions
diff --git a/src/ui/cache/svg_preview_cache.cpp b/src/ui/cache/svg_preview_cache.cpp index 829c6b0ef..0665f474f 100644 --- a/src/ui/cache/svg_preview_cache.cpp +++ b/src/ui/cache/svg_preview_cache.cpp @@ -87,9 +87,9 @@ SvgPreview::~SvgPreview() Glib::ustring SvgPreview::cache_key(gchar const *uri, gchar const *name, unsigned psize) const { Glib::ustring key; - key += (uri!=NULL) ? uri : ""; + key += (uri!=nullptr) ? uri : ""; key += ":"; - key += (name!=NULL) ? name : "unknown"; + key += (name!=nullptr) ? name : "unknown"; key += ":"; key += psize; return key; @@ -100,7 +100,7 @@ GdkPixbuf* SvgPreview::get_preview_from_cache(const Glib::ustring& key) { if ( found != _pixmap_cache.end() ) { return found->second; } - return NULL; + return nullptr; } void SvgPreview::set_preview_in_cache(const Glib::ustring& key, GdkPixbuf* px) { @@ -114,7 +114,7 @@ GdkPixbuf* SvgPreview::get_preview(const gchar* uri, const gchar* id, Inkscape:: Glib::ustring key = cache_key(uri, id, psize); GdkPixbuf* px = get_preview_from_cache(key); - if (px == NULL) { + if (px == nullptr) { /* px = render_pixbuf(root, scale_factor, dbox, psize); set_preview_in_cache(key, px); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index e719b2607..1da3bf9bc 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -163,12 +163,12 @@ private: ClipboardManagerImpl::ClipboardManagerImpl() - : _clipboardSPDoc(NULL), - _defs(NULL), - _root(NULL), - _clipnode(NULL), - _doc(NULL), - _text_style(NULL), + : _clipboardSPDoc(nullptr), + _defs(nullptr), + _root(nullptr), + _clipnode(nullptr), + _doc(nullptr), + _text_style(nullptr), _clipboard( Gtk::Clipboard::get() ) { // Clipboard Formats: http://msdn.microsoft.com/en-us/library/ms649013(VS.85).aspx @@ -212,7 +212,7 @@ void ClipboardManagerImpl::copy(ObjectSet *set) // pasted on other stops or objects if (_text_style) { sp_repr_css_attr_unref(_text_style); - _text_style = NULL; + _text_style = nullptr; } _text_style = sp_repr_css_attr_new(); // print and set properties @@ -248,7 +248,7 @@ void ClipboardManagerImpl::copy(ObjectSet *set) _clipboard->set_text(selected_text); if (_text_style) { sp_repr_css_attr_unref(_text_style); - _text_style = NULL; + _text_style = nullptr; } te_selected_style.clear(); te_selected_style_positions.clear(); @@ -277,11 +277,11 @@ void ClipboardManagerImpl::copy(ObjectSet *set) */ void ClipboardManagerImpl::copyPathParameter(Inkscape::LivePathEffect::PathParam *pp) { - if ( pp == NULL ) { + if ( pp == nullptr ) { return; } gchar *svgd = sp_svg_write_path( pp->get_pathvector() ); - if ( svgd == NULL || *svgd == '\0' ) { + if ( svgd == nullptr || *svgd == '\0' ) { return; } @@ -305,7 +305,7 @@ void ClipboardManagerImpl::copyPathParameter(Inkscape::LivePathEffect::PathParam void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol) { //std::cout << "ClipboardManagerImpl::copySymbol" << std::endl; - if ( symbol == NULL ) { + if ( symbol == nullptr ) { return; } @@ -364,7 +364,7 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const* bool ClipboardManagerImpl::paste(SPDesktop *desktop, bool in_place) { // do any checking whether we really are able to paste before requesting the contents - if ( desktop == NULL ) { + if ( desktop == nullptr ) { return false; } if ( Inkscape::have_viable_layer(desktop, desktop->messageStack()) == false ) { @@ -388,7 +388,7 @@ bool ClipboardManagerImpl::paste(SPDesktop *desktop, bool in_place) // otherwise, use the import extensions SPDocument *tempdoc = _retrieveClipboard(target); - if ( tempdoc == NULL ) { + if ( tempdoc == nullptr ) { _userWarn(desktop, _("Nothing on the clipboard.")); return false; } @@ -405,18 +405,18 @@ bool ClipboardManagerImpl::paste(SPDesktop *desktop, bool in_place) const gchar *ClipboardManagerImpl::getFirstObjectID() { SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); - if ( tempdoc == NULL ) { - return NULL; + if ( tempdoc == nullptr ) { + return nullptr; } Inkscape::XML::Node *root = tempdoc->getReprRoot(); if (!root) { - return NULL; + return nullptr; } Inkscape::XML::Node *ch = root->firstChild(); - while (ch != NULL && + while (ch != nullptr && strcmp(ch->name(), "svg:g") && strcmp(ch->name(), "svg:path") && strcmp(ch->name(), "svg:use") && @@ -432,7 +432,7 @@ const gchar *ClipboardManagerImpl::getFirstObjectID() return ch->attribute("id"); } - return NULL; + return nullptr; } @@ -441,7 +441,7 @@ const gchar *ClipboardManagerImpl::getFirstObjectID() */ bool ClipboardManagerImpl::pasteStyle(ObjectSet *set) { - if (set->desktop() == NULL) { + if (set->desktop() == nullptr) { return false; } @@ -452,7 +452,7 @@ bool ClipboardManagerImpl::pasteStyle(ObjectSet *set) } SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); - if ( tempdoc == NULL ) { + if ( tempdoc == nullptr ) { // no document, but we can try _text_style if (_text_style) { sp_desktop_set_style(set, set->desktop(), _text_style); @@ -507,7 +507,7 @@ bool ClipboardManagerImpl::pasteSize(ObjectSet *set, bool separately, bool apply // FIXME: actually, this should accept arbitrary documents SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); - if ( tempdoc == NULL ) { + if ( tempdoc == nullptr ) { if(set->desktop()) _userWarn(set->desktop(), _("No size on the clipboard.")); return false; @@ -560,7 +560,7 @@ bool ClipboardManagerImpl::pastePathEffect(ObjectSet *set) /** @todo FIXME: pastePathEffect crashes when moving the path with the applied effect, segfaulting in fork_private_if_necessary(). */ - if ( set->desktop() == NULL ) { + if ( set->desktop() == nullptr ) { return false; } @@ -604,13 +604,13 @@ bool ClipboardManagerImpl::pastePathEffect(ObjectSet *set) Glib::ustring ClipboardManagerImpl::getPathParameter(SPDesktop* desktop) { SPDocument *tempdoc = _retrieveClipboard(); // any target will do here - if ( tempdoc == NULL ) { + if ( tempdoc == nullptr ) { _userWarn(desktop, _("Nothing on the clipboard.")); return ""; } Inkscape::XML::Node *root = tempdoc->getReprRoot(); Inkscape::XML::Node *path = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth - if ( path == NULL ) { + if ( path == nullptr ) { _userWarn(desktop, _("Clipboard does not contain a path.")); tempdoc->doUnref(); return ""; @@ -633,7 +633,7 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop) // clip path or mask, not the original path! SPDocument *tempdoc = _retrieveClipboard(); // any target will do here - if ( tempdoc == NULL ) { + if ( tempdoc == nullptr ) { _userWarn(desktop, _("Nothing on the clipboard.")); return ""; } @@ -643,11 +643,11 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop) root->removeChild(tempdoc->getDefs()->getRepr()); Inkscape::XML::Node *repr = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = sp_repr_lookup_name(root, "svg:text", -1); } - if ( repr == NULL ) { + if ( repr == nullptr ) { _userWarn(desktop, _("Clipboard does not contain a path.")); tempdoc->doUnref(); return ""; @@ -665,7 +665,7 @@ std::vector<Glib::ustring> ClipboardManagerImpl::getElementsOfType(SPDesktop *de { std::vector<Glib::ustring> result; SPDocument *tempdoc = _retrieveClipboard(); // any target will do here - if ( tempdoc == NULL ) { + if ( tempdoc == nullptr ) { _userWarn(desktop, _("Nothing on the clipboard.")); return result; } @@ -855,7 +855,7 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) // Copy text paths { SPText *text = dynamic_cast<SPText *>(item); - SPTextPath *textpath = (text) ? dynamic_cast<SPTextPath *>(text->firstChild()) : NULL; + SPTextPath *textpath = (text) ? dynamic_cast<SPTextPath *>(text->firstChild()) : nullptr; if (textpath) { _copyTextPath(textpath); } @@ -925,7 +925,7 @@ void ClipboardManagerImpl::_copyGradient(SPGradient *gradient) gradient = gradient->ref->getObject(); } else { - gradient = NULL; + gradient = nullptr; } } } @@ -951,7 +951,7 @@ void ClipboardManagerImpl::_copyPattern(SPPattern *pattern) pattern = pattern->ref->getObject(); } else{ - pattern = NULL; + pattern = nullptr; } } } @@ -997,7 +997,7 @@ Inkscape::XML::Node *ClipboardManagerImpl::_copyNode(Inkscape::XML::Node *node, */ bool ClipboardManagerImpl::_pasteImage(SPDocument *doc) { - if ( doc == NULL ) { + if ( doc == nullptr ) { return false; } @@ -1031,7 +1031,7 @@ bool ClipboardManagerImpl::_pasteImage(SPDocument *doc) */ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop) { - if ( desktop == NULL ) { + if ( desktop == nullptr ) { return false; } @@ -1096,7 +1096,7 @@ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop) */ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effectstack) { - if ( item == NULL ) { + if ( item == nullptr ) { return; } if ( dynamic_cast<SPRect *>(item) ) { @@ -1138,7 +1138,7 @@ SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_targ } if ( best_target == "" ) { - return NULL; + return nullptr; } // FIXME: Temporary hack until we add memory input. @@ -1168,7 +1168,7 @@ SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_targ if (!file_saved) { if ( !_clipboard->wait_is_target_available(best_target) ) { - return NULL; + return nullptr; } // doing this synchronously makes better sense @@ -1180,7 +1180,7 @@ SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_targ // FIXME: Temporary hack until we add memory input. // Save the clipboard contents to some file, then read it - g_file_set_contents(filename, (const gchar *) sel.get_data(), sel.get_length(), NULL); + g_file_set_contents(filename, (const gchar *) sel.get_data(), sel.get_length(), nullptr); } // there is no specific plain SVG input extension, so if we can paste the Inkscape SVG format, @@ -1199,10 +1199,10 @@ SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_targ for (; in != inlist.end() && target != (*in)->get_mimetype() ; ++in) { }; if ( in == inlist.end() ) { - return NULL; // this shouldn't happen unless _getBestTarget returns something bogus + return nullptr; // this shouldn't happen unless _getBestTarget returns something bogus } - SPDocument *tempdoc = NULL; + SPDocument *tempdoc = nullptr; try { tempdoc = (*in)->open(filename); } catch (...) { @@ -1222,7 +1222,7 @@ SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_targ */ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) { - g_assert( _clipboardSPDoc != NULL ); + g_assert( _clipboardSPDoc != nullptr ); Glib::ustring target = sel.get_target(); if (target == "") { @@ -1270,7 +1270,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) bgcolor |= SP_COLOR_F_TO_U(opacity); } std::vector<SPItem*> x; - sp_export_png_file(_clipboardSPDoc, filename, area, width, height, dpi, dpi, bgcolor, NULL, NULL, true, x); + sp_export_png_file(_clipboardSPDoc, filename, area, width, height, dpi, dpi, bgcolor, nullptr, nullptr, true, x); } else { @@ -1280,7 +1280,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) } (*out)->save(_clipboardSPDoc, filename); } - g_file_get_contents(filename, &data, &len, NULL); + g_file_get_contents(filename, &data, &len, nullptr); sel.set(8, (guint8 const *) data, len); } catch (...) { @@ -1309,8 +1309,8 @@ void ClipboardManagerImpl::_onClear() */ void ClipboardManagerImpl::_createInternalClipboard() { - if ( _clipboardSPDoc == NULL ) { - _clipboardSPDoc = SPDocument::createNewDoc(NULL, false, true); + if ( _clipboardSPDoc == nullptr ) { + _clipboardSPDoc = SPDocument::createNewDoc(nullptr, false, true); //g_assert( _clipboardSPDoc != NULL ); _defs = _clipboardSPDoc->getDefs()->getRepr(); _doc = _clipboardSPDoc->getReprDoc(); @@ -1323,7 +1323,7 @@ void ClipboardManagerImpl::_createInternalClipboard() // once we create a SVG document, style will be stored in it, so flush _text_style if (_text_style) { sp_repr_css_attr_unref(_text_style); - _text_style = NULL; + _text_style = nullptr; } } } @@ -1334,13 +1334,13 @@ void ClipboardManagerImpl::_createInternalClipboard() */ void ClipboardManagerImpl::_discardInternalClipboard() { - if ( _clipboardSPDoc != NULL ) { + if ( _clipboardSPDoc != nullptr ) { _clipboardSPDoc->doUnref(); - _clipboardSPDoc = NULL; - _defs = NULL; - _doc = NULL; - _root = NULL; - _clipnode = NULL; + _clipboardSPDoc = nullptr; + _defs = nullptr; + _doc = nullptr; + _root = nullptr; + _clipnode = nullptr; } } @@ -1531,13 +1531,13 @@ void ClipboardManagerImpl::_userWarn(SPDesktop *desktop, char const *msg) ClipboardManager class ####################################### */ -ClipboardManager *ClipboardManager::_instance = NULL; +ClipboardManager *ClipboardManager::_instance = nullptr; ClipboardManager::ClipboardManager() {} ClipboardManager::~ClipboardManager() {} ClipboardManager *ClipboardManager::get() { - if ( _instance == NULL ) { + if ( _instance == nullptr ) { _instance = new ClipboardManagerImpl; } diff --git a/src/ui/contextmenu.cpp b/src/ui/contextmenu.cpp index 628b0b2fd..e9ff59f36 100644 --- a/src/ui/contextmenu.cpp +++ b/src/ui/contextmenu.cpp @@ -74,7 +74,7 @@ ContextMenu::ContextMenu(SPDesktop *desktop, SPItem *item) : positionOfLastDialog = 10; // 9 in front + 1 for the separator in the next if; used to position the dialog menu entries below each other /* Item menu */ - if (item!=NULL) { + if (item!=nullptr) { AddSeparator(); MakeObjectMenu(); } @@ -126,7 +126,7 @@ ContextMenu::ContextMenu(SPDesktop *desktop, SPItem *item) : mi->show(); append(*mi);//insert(*mi,positionOfLastDialog++); /* layer menu */ - SPGroup *group=NULL; + SPGroup *group=nullptr; if (item) { if (SP_IS_GROUP(item)) { group = SP_GROUP(item); @@ -236,7 +236,7 @@ static void context_menu_item_on_my_activate(void */*object*/, SPAction *action) { if (!temporarily_block_actions) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } @@ -535,7 +535,7 @@ void ContextMenu::ItemCreateLink(void) const char *id = _item->getRepr()->attribute("id"); Inkscape::XML::Node *child = _item->getRepr()->duplicate(xml_doc); _item->deleteObject(false); - repr->addChild(child, NULL); + repr->addChild(child, nullptr); child->setAttribute("id", id); Inkscape::GC::release(repr); @@ -640,7 +640,7 @@ void ContextMenu::AnchorLinkFollow(void) if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(_desktop)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } } @@ -748,7 +748,7 @@ void ContextMenu::ImageEdit(void) _desktop->selection->set(_item); } - GError* errThing = 0; + GError* errThing = nullptr; Glib::ustring bmpeditor = getImageEditorName(); Glib::ustring cmdline = bmpeditor; Glib::ustring name; @@ -782,7 +782,7 @@ void ContextMenu::ImageEdit(void) if (strncmp (href,"file:",5) == 0) { // URI to filename conversion - name = g_filename_from_uri(href, NULL, NULL); + name = g_filename_from_uri(href, nullptr, nullptr); } else { name.append(href); } @@ -814,7 +814,7 @@ void ContextMenu::ImageEdit(void) g_warning("Problem launching editor (%d). %s", errThing->code, errThing->message); (_desktop->messageStack())->flash(Inkscape::ERROR_MESSAGE, errThing->message); g_error_free(errThing); - errThing = 0; + errThing = nullptr; } } @@ -840,7 +840,7 @@ void ContextMenu::ImageEmbed(void) if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(_desktop)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } } @@ -855,7 +855,7 @@ void ContextMenu::ImageExtract(void) if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(_desktop)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } } diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index 866f2eda7..2f6cf533f 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -216,7 +216,7 @@ void ControlManagerImpl::setControlSize(int size, bool force) SPCanvasItem *ControlManagerImpl::createControl(SPCanvasGroup *parent, ControlType type) { - SPCanvasItem *item = 0; + SPCanvasItem *item = nullptr; double targetSize = _sizeTable[type][_size - 1]; switch (type) { @@ -259,7 +259,7 @@ SPCanvasItem *ControlManagerImpl::createControl(SPCanvasGroup *parent, ControlTy break; case CTRL_TYPE_UNKNOWN: default: - item = sp_canvas_item_new(parent, SP_TYPE_CTRL, NULL); + item = sp_canvas_item_new(parent, SP_TYPE_CTRL, nullptr); } if (item) { item->ctrlType = type; @@ -387,7 +387,7 @@ SPCanvasItem *ControlManager::createControl(SPCanvasGroup *parent, ControlType t SPCtrlLine *ControlManager::createControlLine(SPCanvasGroup *parent, CtrlLineType type) { - SPCtrlLine *line = SP_CTRLLINE(sp_canvas_item_new(parent, SP_TYPE_CTRLLINE, NULL)); + SPCtrlLine *line = SP_CTRLLINE(sp_canvas_item_new(parent, SP_TYPE_CTRLLINE, nullptr)); if (line) { line->ctrlType = CTRL_TYPE_LINE; @@ -408,7 +408,7 @@ SPCtrlLine *ControlManager::createControlLine(SPCanvasGroup *parent, Geom::Point SPCtrlCurve *ControlManager::createControlCurve(SPCanvasGroup *parent, Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2, Geom::Point const &p3, CtrlLineType type) { - SPCtrlCurve *line = SP_CTRLCURVE(sp_canvas_item_new(parent, SP_TYPE_CTRLCURVE, NULL)); + SPCtrlCurve *line = SP_CTRLCURVE(sp_canvas_item_new(parent, SP_TYPE_CTRLCURVE, nullptr)); if (line) { line->ctrlType = CTRL_TYPE_LINE; 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; diff --git a/src/ui/draw-anchor.cpp b/src/ui/draw-anchor.cpp index c3bc5676d..f21803b52 100644 --- a/src/ui/draw-anchor.cpp +++ b/src/ui/draw-anchor.cpp @@ -33,7 +33,7 @@ SPDrawAnchor *sp_draw_anchor_new(Inkscape::UI::Tools::FreehandBase *dc, SPCurve { if (SP_IS_LPETOOL_CONTEXT(dc)) { // suppress all kinds of anchors in LPEToolContext - return NULL; + return nullptr; } SPDrawAnchor *a = g_new(SPDrawAnchor, 1); @@ -65,7 +65,7 @@ SPDrawAnchor *sp_draw_anchor_destroy(SPDrawAnchor *anchor) sp_canvas_item_destroy(anchor->ctrl); } g_free(anchor); - return NULL; + return nullptr; } /** @@ -91,7 +91,7 @@ SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, bool acti anchor->active = FALSE; } - return NULL; + return nullptr; } diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 19dddf2c3..f9a30001a 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -111,7 +111,7 @@ static GtkTargetEntry ui_drop_target_entries [] = { {(gchar *)"application/x-inkscape-paste", 0, APP_X_INK_PASTE } }; -static GtkTargetEntry *completeDropTargets = 0; +static GtkTargetEntry *completeDropTargets = nullptr; static int completeDropTargetsCount = 0; static bool temporarily_block_actions = false; @@ -144,7 +144,7 @@ static void sp_recent_open(GtkRecentChooser *, gpointer); void sp_create_window(SPViewWidget *vw, bool editable) { - g_return_if_fail(vw != NULL); + g_return_if_fail(vw != nullptr); g_return_if_fail(SP_IS_VIEW_WIDGET(vw)); Gtk::Window *win = Inkscape::UI::window_new("", TRUE); @@ -192,7 +192,7 @@ sp_create_window(SPViewWidget *vw, bool editable) } } - if ( completeDropTargets == 0 || completeDropTargetsCount == 0 ) + if ( completeDropTargets == nullptr || completeDropTargetsCount == 0 ) { std::vector<Glib::ustring> types; @@ -254,8 +254,8 @@ sp_ui_new_view() document = SP_ACTIVE_DOCUMENT; if (!document) return; - dtw = sp_desktop_widget_new(sp_document_namedview(document, NULL)); - g_return_if_fail(dtw != NULL); + dtw = sp_desktop_widget_new(sp_document_namedview(document, nullptr)); + g_return_if_fail(dtw != nullptr); sp_create_window(dtw, TRUE); sp_namedview_window_from_document(static_cast<SPDesktop*>(dtw->view)); @@ -267,7 +267,7 @@ void sp_ui_new_view_preview() SPDocument *document = SP_ACTIVE_DOCUMENT; if ( document ) { SPViewWidget *dtw = reinterpret_cast<SPViewWidget *>(sp_svg_view_widget_new(document)); - g_return_if_fail(dtw != NULL); + g_return_if_fail(dtw != nullptr); SP_SVG_VIEW_WIDGET(dtw)->setResize(true, 400.0, 400.0); sp_create_window(dtw, FALSE); @@ -279,7 +279,7 @@ sp_ui_close_view(GtkWidget */*widget*/) { SPDesktop *dt = SP_ACTIVE_DESKTOP; - if (dt == NULL) { + if (dt == nullptr) { return; } @@ -339,7 +339,7 @@ static void sp_ui_menu_activate(void */*object*/, SPAction *action) { if (!temporarily_block_actions) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } @@ -420,7 +420,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men Inkscape::UI::View::View *view, bool show_icon = false, bool radio = false, - Gtk::RadioMenuItem::Group *group = NULL) + Gtk::RadioMenuItem::Group *group = nullptr) { Gtk::Widget *item; @@ -431,7 +431,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men } else { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); - if (!action) return NULL; + if (!action) return nullptr; // Create the menu item itself, either as a radio menu item, or just // a regular menu item depending on whether the "radio" flag is set @@ -470,7 +470,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men icon = gtk_image_new_from_icon_name(action->image, GTK_ICON_SIZE_MENU); } else { - icon = gtk_label_new(NULL); // A fake icon just to act as a placeholder + icon = gtk_label_new(nullptr); // A fake icon just to act as a placeholder } gtk_box_pack_start(GTK_BOX(box), icon, FALSE, TRUE, 0); @@ -619,7 +619,7 @@ static void taskToggled(GtkCheckMenuItem *menuitem, gpointer userData) static gboolean update_view_menu(GtkWidget *widget, cairo_t * /*cr*/, gpointer user_data) { SPAction *action = (SPAction *) user_data; - g_assert(action->id != NULL); + g_assert(action->id != nullptr); Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(widget), "view"); SPDesktop *dt = static_cast<SPDesktop*>(view); @@ -664,7 +664,7 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * Inkscape::Verb *verb) { unsigned int shortcut = (verb) ? sp_shortcut_get_primary(verb) : 0; - SPAction *action = (verb) ? verb->get_action(Inkscape::ActionContext(view)) : 0; + SPAction *action = (verb) ? verb->get_action(Inkscape::ActionContext(view)) : nullptr; GtkWidget *item = gtk_check_menu_item_new_with_mnemonic(action ? action->name : label); #if 0 @@ -686,7 +686,7 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * g_signal_connect( G_OBJECT(item), "draw", (GCallback) callback_update, (void *) pref); - (*callback_update)(item, NULL, (void *)pref); + (*callback_update)(item, nullptr, (void *)pref); g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), (gpointer) (action ? action->tip : tip)); g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect), NULL); @@ -698,9 +698,9 @@ sp_recent_open(GtkRecentChooser *recent_menu, gpointer /*user_data*/) { // dealing with the bizarre filename convention in Inkscape for now gchar *uri = gtk_recent_chooser_get_current_uri(GTK_RECENT_CHOOSER(recent_menu)); - gchar *local_fn = g_filename_from_uri(uri, NULL, NULL); - gchar *utf8_fn = g_filename_to_utf8(local_fn, -1, NULL, NULL, NULL); - sp_file_open(utf8_fn, NULL); + gchar *local_fn = g_filename_from_uri(uri, nullptr, nullptr); + gchar *utf8_fn = g_filename_to_utf8(local_fn, -1, nullptr, nullptr, nullptr); + sp_file_open(utf8_fn, nullptr); g_free(utf8_fn); g_free(local_fn); g_free(uri); @@ -711,21 +711,21 @@ sp_ui_checkboxes_menus(GtkMenu *m, Inkscape::UI::View::View *view) { //sp_ui_menu_append_check_item_from_verb(m, view, _("_Menu"), _("Show or hide the menu bar"), "menu", // checkitem_toggled, checkitem_update, 0); - sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "commands", + sp_ui_menu_append_check_item_from_verb(m, view, nullptr, nullptr, "commands", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_COMMANDS_TOOLBAR)); - sp_ui_menu_append_check_item_from_verb(m, view,NULL, NULL, "snaptoolbox", + sp_ui_menu_append_check_item_from_verb(m, view,nullptr, nullptr, "snaptoolbox", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_SNAP_TOOLBAR)); - sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "toppanel", + sp_ui_menu_append_check_item_from_verb(m, view, nullptr, nullptr, "toppanel", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_TOOL_TOOLBAR)); - sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "toolbox", + sp_ui_menu_append_check_item_from_verb(m, view, nullptr, nullptr, "toolbox", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_TOOLBOX)); - sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "rulers", + sp_ui_menu_append_check_item_from_verb(m, view, nullptr, nullptr, "rulers", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_RULERS)); - sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "scrollbars", + sp_ui_menu_append_check_item_from_verb(m, view, nullptr, nullptr, "scrollbars", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_SCROLLBARS)); - sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "panels", + sp_ui_menu_append_check_item_from_verb(m, view, nullptr, nullptr, "panels", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_PALETTE)); - sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "statusbar", + sp_ui_menu_append_check_item_from_verb(m, view, nullptr, nullptr, "statusbar", checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_STATUSBAR)); } @@ -736,7 +736,7 @@ static void addTaskMenuItems(GtkMenu *menu, Inkscape::UI::View::View *view) C_("Interface setup", "Default"), _("Default interface setup"), C_("Interface setup", "Custom"), _("Setup for custom task"), C_("Interface setup", "Wide"), _("Setup for widescreen work"), - 0, 0 + nullptr, nullptr }; Gtk::RadioMenuItem::Group group; @@ -798,16 +798,16 @@ private: */ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI::View::View *view) { - if (menus == NULL) return; - if (menu == NULL) return; + if (menus == nullptr) return; + if (menu == nullptr) return; Gtk::RadioMenuItem::Group group; for (Inkscape::XML::Node *menu_pntr = menus; - menu_pntr != NULL; + menu_pntr != nullptr; menu_pntr = menu_pntr->next()) { if (!strcmp(menu_pntr->name(), "submenu")) { GtkWidget *mitem; - if (menu_pntr->attribute("_name") != NULL) { + if (menu_pntr->attribute("_name") != nullptr) { mitem = gtk_menu_item_new_with_mnemonic(_(menu_pntr->attribute("_name"))); } else { mitem = gtk_menu_item_new_with_mnemonic(menu_pntr->attribute("name")); @@ -824,26 +824,26 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I // Check if the "show-icon" attribute is set, and set the flag here accordingly bool show_icon = false; - if(menu_pntr->attribute("show-icon") != NULL) { + if(menu_pntr->attribute("show-icon") != nullptr) { show_icon = true; } Inkscape::Verb *verb = Inkscape::Verb::getbyid(verb_name); - if (verb != NULL) { - if (menu_pntr->attribute("radio") != NULL) { + if (verb != nullptr) { + if (menu_pntr->attribute("radio") != nullptr) { GtkWidget *item = sp_ui_menu_append_item_from_verb (GTK_MENU(menu), verb, view, show_icon, true, &group); - if (menu_pntr->attribute("default") != NULL) { + if (menu_pntr->attribute("default") != nullptr) { gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); } if (verb->get_code() != SP_VERB_NONE) { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); g_signal_connect( G_OBJECT(item), "draw", (GCallback) update_view_menu, (void *) action); } - } else if (menu_pntr->attribute("check") != NULL) { + } else if (menu_pntr->attribute("check") != nullptr) { if (verb->get_code() != SP_VERB_NONE) { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); - sp_ui_menu_append_check_item_from_verb(GTK_MENU(menu), view, action->name, action->tip, NULL, + sp_ui_menu_append_check_item_from_verb(GTK_MENU(menu), view, action->name, action->tip, nullptr, checkitem_toggled, checkitem_update, verb); } } else { @@ -878,7 +878,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I gtk_recent_chooser_set_limit(GTK_RECENT_CHOOSER(recent_menu), max_recent); // sort most recently used documents first to preserve previous behavior gtk_recent_chooser_set_sort_type(GTK_RECENT_CHOOSER(recent_menu), GTK_RECENT_SORT_MRU); - g_signal_connect(G_OBJECT(recent_menu), "item-activated", G_CALLBACK(sp_recent_open), (gpointer) NULL); + g_signal_connect(G_OBJECT(recent_menu), "item-activated", G_CALLBACK(sp_recent_open), (gpointer) nullptr); // add filter to only open files added by Inkscape GtkRecentFilter *inkscape_only_filter = gtk_recent_filter_new(); @@ -1108,7 +1108,7 @@ sp_ui_drag_data_received(GtkWidget *widget, unsigned int g = color.getG(); unsigned int b = color.getB(); - SPGradient* matches = 0; + SPGradient* matches = nullptr; std::vector<SPObject *> gradients = doc->getResourceList("gradient"); for (std::vector<SPObject *>::const_iterator item = gradients.begin(); item != gradients.end(); ++item) { SPGradient* grad = SP_GRADIENT(*item); @@ -1197,7 +1197,7 @@ sp_ui_drag_data_received(GtkWidget *widget, Inkscape::XML::Document *rnewdoc = sp_repr_read_mem(svgdata, gtk_selection_data_get_length (data), SP_SVG_NS_URI); - if (rnewdoc == NULL) { + if (rnewdoc == nullptr) { sp_ui_error_dialog(_("Could not parse SVG data")); return; } @@ -1209,7 +1209,7 @@ sp_ui_drag_data_received(GtkWidget *widget, newgroup->setAttribute("style", style); Inkscape::XML::Document * xml_doc = doc->getReprDoc(); - for (Inkscape::XML::Node *child = repr->firstChild(); child != NULL; child = child->next()) { + for (Inkscape::XML::Node *child = repr->firstChild(); child != nullptr; child = child->next()) { Inkscape::XML::Node *newchild = child->duplicate(xml_doc); newgroup->appendChild(newchild); } @@ -1219,7 +1219,7 @@ sp_ui_drag_data_received(GtkWidget *widget, // Add it to the current layer // Greg's edits to add intelligent positioning of svg drops - SPObject *new_obj = NULL; + SPObject *new_obj = nullptr; new_obj = desktop->currentLayer()->appendChildRepr(newgroup); Inkscape::Selection *selection = desktop->getSelection(); @@ -1266,7 +1266,7 @@ sp_ui_drag_data_received(GtkWidget *widget, g_file_set_contents(filename, reinterpret_cast<gchar const *>(gtk_selection_data_get_data (data)), gtk_selection_data_get_length (data), - NULL); + nullptr); file_import(doc, filename, ext); g_free(filename); @@ -1309,8 +1309,8 @@ sp_ui_import_files(gchar *buffer) { gchar** l = g_uri_list_extract_uris(buffer); for (unsigned int i=0; i < g_strv_length(l); i++) { - gchar *f = g_filename_from_uri (l[i], NULL, NULL); - sp_ui_import_one_file_with_check(f, NULL); + gchar *f = g_filename_from_uri (l[i], nullptr, nullptr); + sp_ui_import_one_file_with_check(f, nullptr); g_free(f); } g_strfreev(l); @@ -1331,11 +1331,11 @@ sp_ui_import_one_file(char const *filename) SPDocument *doc = SP_ACTIVE_DOCUMENT; if (!doc) return; - if (filename == NULL) return; + if (filename == nullptr) return; // Pass off to common implementation // TODO might need to get the proper type of Inkscape::Extension::Extension - file_import( doc, filename, NULL ); + file_import( doc, filename, nullptr ); } void @@ -1344,7 +1344,7 @@ sp_ui_error_dialog(gchar const *message) GtkWidget *dlg; gchar *safeMsg = Inkscape::IO::sanitizeString(message); - dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, + dlg = gtk_message_dialog_new(nullptr, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", safeMsg); sp_transientize(dlg); gtk_window_set_resizable(GTK_WINDOW(dlg), FALSE); @@ -1401,7 +1401,7 @@ sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name) //- a GtkBox, whose first child is a label displaying name if the menu //item has an accel key //- a GtkLabel if the menu has no accel key - if (child != NULL){ + if (child != nullptr){ if (GTK_IS_LABEL(child)) { gtk_label_set_markup_with_mnemonic(GTK_LABEL (child), name.c_str()); } else if (GTK_IS_BOX(child)) { diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index dfe75c0b7..8198e709c 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -31,8 +31,8 @@ namespace UI { PreviewHolder::PreviewHolder() : Bin(), - _scroller(0), - _insides(0), + _scroller(nullptr), + _insides(nullptr), _prefCols(0), _updatesFrozen(false), _anchor(SP_ANCHOR_CENTER), @@ -278,7 +278,7 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* item, int itemCount, int& n auto hs = _scroller->get_hscrollbar(); - if (_wrap && item != NULL) { + if (_wrap && item != nullptr) { // Get width of bar. int width_scroller = _scroller->get_width(); diff --git a/src/ui/selected-color.cpp b/src/ui/selected-color.cpp index 08f4bd979..422088ed2 100644 --- a/src/ui/selected-color.cpp +++ b/src/ui/selected-color.cpp @@ -144,7 +144,7 @@ void SelectedColor::setHeld(bool held) { } void SelectedColor::preserveICC() { - _color.icc = _color.icc ? new SVGICCColor(*_color.icc) : 0; + _color.icc = _color.icc ? new SVGICCColor(*_color.icc) : nullptr; } } diff --git a/src/ui/shape-editor-knotholders.cpp b/src/ui/shape-editor-knotholders.cpp index 53829be0b..d3bd6fa1b 100644 --- a/src/ui/shape-editor-knotholders.cpp +++ b/src/ui/shape-editor-knotholders.cpp @@ -90,7 +90,7 @@ namespace { static KnotHolder *sp_lpe_knot_holder(SPLPEItem *item, SPDesktop *desktop) { - KnotHolder *knot_holder = new KnotHolder(desktop, item, NULL); + KnotHolder *knot_holder = new KnotHolder(desktop, item, nullptr); Inkscape::LivePathEffect::Effect *effect = item->getCurrentLPE(); effect->addHandles(knot_holder, item); @@ -105,31 +105,31 @@ namespace UI { KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop) { - KnotHolder *knotholder = NULL; + KnotHolder *knotholder = nullptr; if (dynamic_cast<SPRect *>(item)) { - knotholder = new RectKnotHolder(desktop, item, NULL); + knotholder = new RectKnotHolder(desktop, item, nullptr); } else if (dynamic_cast<SPBox3D *>(item)) { - knotholder = new Box3DKnotHolder(desktop, item, NULL); + knotholder = new Box3DKnotHolder(desktop, item, nullptr); } else if (dynamic_cast<SPGenericEllipse *>(item)) { - knotholder = new ArcKnotHolder(desktop, item, NULL); + knotholder = new ArcKnotHolder(desktop, item, nullptr); } else if (dynamic_cast<SPStar *>(item)) { - knotholder = new StarKnotHolder(desktop, item, NULL); + knotholder = new StarKnotHolder(desktop, item, nullptr); } else if (dynamic_cast<SPSpiral *>(item)) { - knotholder = new SpiralKnotHolder(desktop, item, NULL); + knotholder = new SpiralKnotHolder(desktop, item, nullptr); } else if (dynamic_cast<SPOffset *>(item)) { - knotholder = new OffsetKnotHolder(desktop, item, NULL); + knotholder = new OffsetKnotHolder(desktop, item, nullptr); } else { SPFlowtext *flowtext = dynamic_cast<SPFlowtext *>(item); if (flowtext && flowtext->has_internal_frame()) { - knotholder = new FlowtextKnotHolder(desktop, flowtext->get_frame(NULL), NULL); + knotholder = new FlowtextKnotHolder(desktop, flowtext->get_frame(nullptr), nullptr); } else if ((item->style->fill.isPaintserver() && dynamic_cast<SPPattern *>(item->style->getFillPaintServer())) || (item->style->stroke.isPaintserver() && dynamic_cast<SPPattern *>(item->style->getStrokePaintServer()))) { - knotholder = new KnotHolder(desktop, item, NULL); + knotholder = new KnotHolder(desktop, item, nullptr); knotholder->add_pattern_knotholder(); } } - if (!knotholder) knotholder = new KnotHolder(desktop, item, NULL); + if (!knotholder) knotholder = new KnotHolder(desktop, item, nullptr); knotholder->add_filter_knotholder(); return knotholder; @@ -137,7 +137,7 @@ KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop) KnotHolder *createLPEKnotHolder(SPItem *item, SPDesktop *desktop) { - KnotHolder *knotholder = NULL; + KnotHolder *knotholder = nullptr; SPLPEItem *lpe = dynamic_cast<SPLPEItem *>(item); if (lpe && @@ -198,7 +198,7 @@ Geom::Point RectKnotHolderEntityRX::knot_get() const { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); return Geom::Point(rect->x.computed + rect->width.computed - rect->rx.computed, rect->y.computed); } @@ -207,7 +207,7 @@ void RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); //In general we cannot just snap this radius to an arbitrary point, as we have only a single //degree of freedom. For snapping to an arbitrary point we need two DOF. If we're going to snap @@ -230,12 +230,12 @@ void RectKnotHolderEntityRX::knot_click(unsigned int state) { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); if (state & GDK_SHIFT_MASK) { /* remove rounding from rectangle */ - rect->getRepr()->setAttribute("rx", NULL); - rect->getRepr()->setAttribute("ry", NULL); + rect->getRepr()->setAttribute("rx", nullptr); + rect->getRepr()->setAttribute("ry", nullptr); } else if (state & GDK_CONTROL_MASK) { /* Ctrl-click sets the vertical rounding to be the same as the horizontal */ rect->getRepr()->setAttribute("ry", rect->getRepr()->attribute("rx")); @@ -247,7 +247,7 @@ Geom::Point RectKnotHolderEntityRY::knot_get() const { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->ry.computed); } @@ -256,7 +256,7 @@ void RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); //In general we cannot just snap this radius to an arbitrary point, as we have only a single //degree of freedom. For snapping to an arbitrary point we need two DOF. If we're going to snap @@ -288,12 +288,12 @@ void RectKnotHolderEntityRY::knot_click(unsigned int state) { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); if (state & GDK_SHIFT_MASK) { /* remove rounding */ - rect->getRepr()->setAttribute("rx", NULL); - rect->getRepr()->setAttribute("ry", NULL); + rect->getRepr()->setAttribute("rx", nullptr); + rect->getRepr()->setAttribute("ry", nullptr); } else if (state & GDK_CONTROL_MASK) { /* Ctrl-click sets the vertical rounding to be the same as the horizontal */ rect->getRepr()->setAttribute("rx", rect->getRepr()->attribute("ry")); @@ -317,7 +317,7 @@ Geom::Point RectKnotHolderEntityWH::knot_get() const { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed); } @@ -326,7 +326,7 @@ void RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &origin, unsigned int state) { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); Geom::Point s = p; @@ -407,7 +407,7 @@ Geom::Point RectKnotHolderEntityXY::knot_get() const { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); return Geom::Point(rect->x.computed, rect->y.computed); } @@ -416,7 +416,7 @@ void RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin, unsigned int state) { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); // opposite corner (unmoved) gdouble opposite_x = (rect->x.computed + rect->width.computed); @@ -504,7 +504,7 @@ Geom::Point RectKnotHolderEntityCenter::knot_get() const { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); return Geom::Point(rect->x.computed + (rect->width.computed / 2.), rect->y.computed + (rect->height.computed / 2.)); } @@ -513,7 +513,7 @@ void RectKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPRect *rect = dynamic_cast<SPRect *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); Geom::Point const s = snap_knot_position(p, state); @@ -595,9 +595,9 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom { Geom::Point const s = snap_knot_position(new_pos, state); - g_assert(item != NULL); + g_assert(item != nullptr); SPBox3D *box = dynamic_cast<SPBox3D *>(item); - g_assert(box != NULL); + g_assert(box != nullptr); Geom::Affine const i2dt (item->i2dt_affine ()); Box3D::Axis movement; @@ -779,7 +779,7 @@ Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point co Geom::Point const s = snap_knot_position(new_pos, state); SPBox3D *box = dynamic_cast<SPBox3D *>(item); - g_assert(box != NULL); + g_assert(box != nullptr); Geom::Affine const i2dt (item->i2dt_affine ()); box3d_set_center(box, s * i2dt, origin * i2dt, !(state & GDK_SHIFT_MASK) ? Box3D::XY : Box3D::Z, @@ -914,7 +914,7 @@ ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*or int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12); SPGenericEllipse *arc = dynamic_cast<SPGenericEllipse *>(item); - g_assert(arc != NULL); + g_assert(arc != nullptr); gint side = sp_genericellipse_side(arc, p); if(side != 0) { arc->setArcType( (side == -1) ? @@ -942,7 +942,7 @@ Geom::Point ArcKnotHolderEntityStart::knot_get() const { SPGenericEllipse const *ge = dynamic_cast<SPGenericEllipse const *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); return ge->getPointAtAngle(ge->start); } @@ -951,7 +951,7 @@ void ArcKnotHolderEntityStart::knot_click(unsigned int state) { SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); if (state & GDK_SHIFT_MASK) { ge->end = ge->start = 0; @@ -965,7 +965,7 @@ ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*orig int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12); SPGenericEllipse *arc = dynamic_cast<SPGenericEllipse *>(item); - g_assert(arc != NULL); + g_assert(arc != nullptr); gint side = sp_genericellipse_side(arc, p); if(side != 0) { arc->setArcType( (side == -1) ? @@ -993,7 +993,7 @@ Geom::Point ArcKnotHolderEntityEnd::knot_get() const { SPGenericEllipse const *ge = dynamic_cast<SPGenericEllipse const *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); return ge->getPointAtAngle(ge->end); } @@ -1003,7 +1003,7 @@ void ArcKnotHolderEntityEnd::knot_click(unsigned int state) { SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); if (state & GDK_SHIFT_MASK) { ge->end = ge->start = 0; @@ -1016,7 +1016,7 @@ void ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); Geom::Point const s = snap_knot_position(p, state); @@ -1033,7 +1033,7 @@ Geom::Point ArcKnotHolderEntityRX::knot_get() const { SPGenericEllipse const *ge = dynamic_cast<SPGenericEllipse const *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); return (Geom::Point(ge->cx.computed, ge->cy.computed) - Geom::Point(ge->rx.computed, 0)); } @@ -1042,7 +1042,7 @@ void ArcKnotHolderEntityRX::knot_click(unsigned int state) { SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); if (state & GDK_CONTROL_MASK) { ge->ry = ge->rx.computed; @@ -1054,7 +1054,7 @@ void ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); Geom::Point const s = snap_knot_position(p, state); @@ -1071,7 +1071,7 @@ Geom::Point ArcKnotHolderEntityRY::knot_get() const { SPGenericEllipse const *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); return (Geom::Point(ge->cx.computed, ge->cy.computed) - Geom::Point(0, ge->ry.computed)); } @@ -1080,7 +1080,7 @@ void ArcKnotHolderEntityRY::knot_click(unsigned int state) { SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); if (state & GDK_CONTROL_MASK) { ge->rx = ge->ry.computed; @@ -1092,7 +1092,7 @@ void ArcKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPGenericEllipse *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); Geom::Point const s = snap_knot_position(p, state); @@ -1106,7 +1106,7 @@ Geom::Point ArcKnotHolderEntityCenter::knot_get() const { SPGenericEllipse const *ge = dynamic_cast<SPGenericEllipse *>(item); - g_assert(ge != NULL); + g_assert(ge != nullptr); return Geom::Point(ge->cx.computed, ge->cy.computed); } @@ -1180,7 +1180,7 @@ void StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPStar *star = dynamic_cast<SPStar *>(item); - g_assert(star != NULL); + g_assert(star != nullptr); Geom::Point const s = snap_knot_position(p, state); @@ -1207,7 +1207,7 @@ void StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPStar *star = dynamic_cast<SPStar *>(item); - g_assert(star != NULL); + g_assert(star != nullptr); Geom::Point const s = snap_knot_position(p, state); @@ -1237,7 +1237,7 @@ void StarKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPStar *star = dynamic_cast<SPStar *>(item); - g_assert(star != NULL); + g_assert(star != nullptr); star->center = snap_knot_position(p, state); @@ -1247,10 +1247,10 @@ StarKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/* Geom::Point StarKnotHolderEntity1::knot_get() const { - g_assert(item != NULL); + g_assert(item != nullptr); SPStar const *star = dynamic_cast<SPStar const *>(item); - g_assert(star != NULL); + g_assert(star != nullptr); return sp_star_get_xy(star, SP_STAR_POINT_KNOT1, 0); @@ -1259,10 +1259,10 @@ StarKnotHolderEntity1::knot_get() const Geom::Point StarKnotHolderEntity2::knot_get() const { - g_assert(item != NULL); + g_assert(item != nullptr); SPStar const *star = dynamic_cast<SPStar const *>(item); - g_assert(star != NULL); + g_assert(star != nullptr); return sp_star_get_xy(star, SP_STAR_POINT_KNOT2, 0); } @@ -1270,10 +1270,10 @@ StarKnotHolderEntity2::knot_get() const Geom::Point StarKnotHolderEntityCenter::knot_get() const { - g_assert(item != NULL); + g_assert(item != nullptr); SPStar const *star = dynamic_cast<SPStar const *>(item); - g_assert(star != NULL); + g_assert(star != nullptr); return star->center; } @@ -1282,7 +1282,7 @@ static void sp_star_knot_click(SPItem *item, unsigned int state) { SPStar *star = dynamic_cast<SPStar *>(item); - g_assert(star != NULL); + g_assert(star != nullptr); if (state & GDK_MOD1_MASK) { star->randomized = 0; @@ -1312,7 +1312,7 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel KnotHolder(desktop, item, relhandler) { SPStar *star = dynamic_cast<SPStar *>(item); - g_assert(item != NULL); + g_assert(item != nullptr); StarKnotHolderEntity1 *entity1 = new StarKnotHolderEntity1(); entity1->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER, @@ -1373,7 +1373,7 @@ SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &o int snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); SPSpiral *spiral = dynamic_cast<SPSpiral *>(item); - g_assert(spiral != NULL); + g_assert(spiral != nullptr); gdouble dx = p[Geom::X] - spiral->cx; gdouble dy = p[Geom::Y] - spiral->cy; @@ -1391,7 +1391,7 @@ SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &o } else { // roll/unroll from inside gdouble arg_t0; - spiral->getPolar(spiral->t0, NULL, &arg_t0); + spiral->getPolar(spiral->t0, nullptr, &arg_t0); gdouble arg_tmp = atan2(dy, dx) - arg_t0; gdouble arg_t0_new = arg_tmp - floor((arg_tmp+M_PI)/(2.0*M_PI))*2.0*M_PI + arg_t0; @@ -1423,7 +1423,7 @@ SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/ int snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); SPSpiral *spiral = dynamic_cast<SPSpiral *>(item); - g_assert(spiral != NULL); + g_assert(spiral != nullptr); gdouble dx = p[Geom::X] - spiral->cx; gdouble dy = p[Geom::Y] - spiral->cy; @@ -1441,7 +1441,7 @@ SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/ } else { // roll/unroll // arg of the spiral outer end double arg_1; - spiral->getPolar(1, NULL, &arg_1); + spiral->getPolar(1, nullptr, &arg_1); // its fractional part after the whole turns are subtracted double arg_r = arg_1 - sp_round(arg_1, 2.0*M_PI); @@ -1469,7 +1469,7 @@ SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/ // the rad at that t: double rad_new = 0; if (t_temp > spiral->t0) - spiral->getPolar(t_temp, &rad_new, NULL); + spiral->getPolar(t_temp, &rad_new, nullptr); // change the revo (converting diff from radians to the number of turns) spiral->revo += diff/(2*M_PI); @@ -1480,7 +1480,7 @@ SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/ if (!(state & GDK_MOD1_MASK) && rad_new > 1e-3 && rad_new/spiral->rad < 2) { // adjust t0 too so that the inner point stays unmoved double r0; - spiral->getPolar(spiral->t0, &r0, NULL); + spiral->getPolar(spiral->t0, &r0, nullptr); spiral->rad = rad_new; spiral->t0 = pow(r0 / spiral->rad, 1.0/spiral->exp); } @@ -1495,7 +1495,7 @@ void SpiralKnotHolderEntityCenter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPSpiral *spiral = dynamic_cast<SPSpiral *>(item); - g_assert(spiral != NULL); + g_assert(spiral != nullptr); Geom::Point const s = snap_knot_position(p, state); @@ -1509,7 +1509,7 @@ Geom::Point SpiralKnotHolderEntityInner::knot_get() const { SPSpiral const *spiral = dynamic_cast<SPSpiral const *>(item); - g_assert(spiral != NULL); + g_assert(spiral != nullptr); return spiral->getXY(spiral->t0); } @@ -1518,7 +1518,7 @@ Geom::Point SpiralKnotHolderEntityOuter::knot_get() const { SPSpiral const *spiral = dynamic_cast<SPSpiral const *>(item); - g_assert(spiral != NULL); + g_assert(spiral != nullptr); return spiral->getXY(1.0); } @@ -1527,7 +1527,7 @@ Geom::Point SpiralKnotHolderEntityCenter::knot_get() const { SPSpiral const *spiral = dynamic_cast<SPSpiral const *>(item); - g_assert(spiral != NULL); + g_assert(spiral != nullptr); return Geom::Point(spiral->cx, spiral->cy); } @@ -1536,7 +1536,7 @@ void SpiralKnotHolderEntityInner::knot_click(unsigned int state) { SPSpiral *spiral = dynamic_cast<SPSpiral *>(item); - g_assert(spiral != NULL); + g_assert(spiral != nullptr); if (state & GDK_MOD1_MASK) { spiral->exp = 1; @@ -1597,7 +1597,7 @@ void OffsetKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, unsigned int state) { SPOffset *offset = dynamic_cast<SPOffset *>(item); - g_assert(offset != NULL); + g_assert(offset != nullptr); Geom::Point const p_snapped = snap_knot_position(p, state); @@ -1613,7 +1613,7 @@ Geom::Point OffsetKnotHolderEntity::knot_get() const { SPOffset const *offset = dynamic_cast<SPOffset const *>(item); - g_assert(offset != NULL); + g_assert(offset != nullptr); Geom::Point np; sp_offset_top_point(offset,&np); @@ -1644,7 +1644,7 @@ Geom::Point FlowtextKnotHolderEntity::knot_get() const { SPRect const *rect = dynamic_cast<SPRect const *>(item); - g_assert(rect != NULL); + g_assert(rect != nullptr); return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed); } @@ -1658,7 +1658,7 @@ FlowtextKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &orig FlowtextKnotHolder::FlowtextKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler) : KnotHolder(desktop, item, relhandler) { - g_assert(item != NULL); + g_assert(item != nullptr); FlowtextKnotHolderEntity *entity_flowtext = new FlowtextKnotHolderEntity(); entity_flowtext->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER, diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp index b40bec86f..4c11a8b52 100644 --- a/src/ui/shape-editor.cpp +++ b/src/ui/shape-editor.cpp @@ -53,12 +53,12 @@ void ShapeEditor::unset_item(bool keep_knotholder) { if (old_repr && old_repr == knotholder_listener_attached_for) { sp_repr_remove_listener_by_data(old_repr, this); Inkscape::GC::release(old_repr); - knotholder_listener_attached_for = NULL; + knotholder_listener_attached_for = nullptr; } if (!keep_knotholder) { delete this->knotholder; - this->knotholder = NULL; + this->knotholder = nullptr; } } if (this->lpeknotholder) { @@ -66,18 +66,18 @@ void ShapeEditor::unset_item(bool keep_knotholder) { if (old_repr && old_repr == lpeknotholder_listener_attached_for) { sp_repr_remove_listener_by_data(old_repr, this); Inkscape::GC::release(old_repr); - lpeknotholder_listener_attached_for = NULL; + lpeknotholder_listener_attached_for = nullptr; } if (!keep_knotholder) { delete this->lpeknotholder; - this->lpeknotholder = NULL; + this->lpeknotholder = nullptr; } } } bool ShapeEditor::has_knotholder() { - return this->knotholder != NULL || this->lpeknotholder != NULL; + return this->knotholder != nullptr || this->lpeknotholder != nullptr; } void ShapeEditor::update_knotholder() { @@ -121,11 +121,11 @@ void ShapeEditor::event_attr_changed(Inkscape::XML::Node * node, gchar const *na } static Inkscape::XML::NodeEventVector shapeeditor_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ ShapeEditor::event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; diff --git a/src/ui/tool-factory.cpp b/src/ui/tool-factory.cpp index f101e5a24..189ff21df 100644 --- a/src/ui/tool-factory.cpp +++ b/src/ui/tool-factory.cpp @@ -40,7 +40,7 @@ using namespace Inkscape::UI::Tools; ToolBase *ToolFactory::createObject(std::string const& id) { - ToolBase *tool = NULL; + ToolBase *tool = nullptr; if (id == "/tools/shapes/arc") tool = new ArcTool; diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index a5611addc..f886c0145 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -179,7 +179,7 @@ void ControlPointSelection::spatialGrow(SelectableControlPoint *origin, int dir) bool grow = (dir > 0); Geom::Point p = origin->position(); double best_dist = grow ? HUGE_VAL : 0; - SelectableControlPoint *match = NULL; + SelectableControlPoint *match = nullptr; for (set_type::iterator i = _all_points.begin(); i != _all_points.end(); ++i) { bool selected = (*i)->selected(); if (grow && !selected) { @@ -423,7 +423,7 @@ void ControlPointSelection::_pointUngrabbed() _original_positions.clear(); _last_trans.clear(); _dragging = false; - _grabbed_point = _farthest_point = NULL; + _grabbed_point = _farthest_point = nullptr; _updateBounds(); restoreTransformHandles(); signal_commit.emit(COMMIT_MOUSE_MOVE); diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index 005e60c62..85475d2d5 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -42,7 +42,7 @@ ControlPoint::ColorSet ControlPoint::_default_color_set = { {0xff000000, 0x000000ff} // clicked fill, stroke when selected }; -ControlPoint *ControlPoint::mouseovered_point = 0; +ControlPoint *ControlPoint::mouseovered_point = nullptr; sigc::signal<void, ControlPoint*> ControlPoint::signal_mouseover_change; @@ -70,7 +70,7 @@ ControlPoint::ControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAncho Glib::RefPtr<Gdk::Pixbuf> pixbuf, ColorSet const &cset, SPCanvasGroup *group) : _desktop(d), - _canvas_item(NULL), + _canvas_item(nullptr), _cset(cset), _state(STATE_NORMAL), _position(initial_pos), @@ -92,7 +92,7 @@ ControlPoint::ControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAncho ControlType type, ColorSet const &cset, SPCanvasGroup *group) : _desktop(d), - _canvas_item(NULL), + _canvas_item(nullptr), _cset(cset), _state(STATE_NORMAL), _position(initial_pos), @@ -217,7 +217,7 @@ void ControlPoint::_setPixbuf(Glib::RefPtr<Gdk::Pixbuf> p) // re-routes events into the virtual function int ControlPoint::_event_handler(SPCanvasItem */*item*/, GdkEvent *event, ControlPoint *point) { - if ((point == NULL) || (point->_desktop == NULL)) { + if ((point == nullptr) || (point->_desktop == nullptr)) { return FALSE; } return point->_eventHandler(point->_desktop->event_context, event) ? TRUE : FALSE; @@ -229,16 +229,16 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G // NOTE the static variables below are shared for all points! // TODO handle clicks and drags from other buttons too - if (event == NULL) + if (event == nullptr) { return false; } - if (event_context == NULL) + if (event_context == nullptr) { return false; } - if (_desktop == NULL) + if (_desktop == nullptr) { return false; } @@ -269,7 +269,7 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G pointer_offset = _position - _desktop->w2d(_drag_event_origin); _drag_initiated = false; // route all events to this handler - sp_canvas_item_grab(_canvas_item, _grab_event_mask, NULL, event->button.time); + sp_canvas_item_grab(_canvas_item, _grab_event_mask, nullptr, event->button.time); _event_grab = true; _setState(STATE_CLICKED); return true; @@ -317,7 +317,7 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G _desktop->scroll_to_point(new_pos); _desktop->set_coordinate_status(_position); - sp_event_context_snap_delay_handler(event_context, NULL, + sp_event_context_snap_delay_handler(event_context, nullptr, (gpointer) this, &event->motion, Inkscape::UI::Tools::DelayedSnapEvent::CONTROL_POINT_HANDLER); } @@ -370,7 +370,7 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G case GDK_GRAB_BROKEN: if (_event_grab && !event->grab_broken.keyboard) { { - ungrabbed(NULL); + ungrabbed(nullptr); if (_drag_initiated) { _desktop->canvas->endForcedFullRedraws(); } @@ -409,10 +409,10 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G fake.time = event->key.time; fake.x = _drag_event_origin[Geom::X]; // these two are normally not used in handlers fake.y = _drag_event_origin[Geom::Y]; // (and shouldn't be) - fake.axes = NULL; + fake.axes = nullptr; fake.state = 0; // unconstrained drag fake.is_hint = FALSE; - fake.device = NULL; + fake.device = nullptr; fake.x_root = -1; // not used in handlers (and shouldn't be) fake.y_root = -1; // can be used as a flag to check for cancelled drag @@ -424,7 +424,7 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G _event_grab = false; _drag_initiated = false; - ungrabbed(NULL); // ungrabbed handlers can handle a NULL event + ungrabbed(nullptr); // ungrabbed handlers can handle a NULL event snapprefs.setSnapEnabledGlobally(snap_save); } return true; @@ -524,7 +524,7 @@ void ControlPoint::_clearMouseover() if (mouseovered_point) { mouseovered_point->_desktop->event_context->defaultMessageContext()->clear(); mouseovered_point->_setState(STATE_NORMAL); - mouseovered_point = 0; + mouseovered_point = nullptr; signal_mouseover_change.emit(mouseovered_point); } } @@ -535,7 +535,7 @@ void ControlPoint::transferGrab(ControlPoint *prev_point, GdkEventMotion *event) grabbed(event); sp_canvas_item_ungrab(prev_point->_canvas_item, event->time); - sp_canvas_item_grab(_canvas_item, _grab_event_mask, NULL, event->time); + sp_canvas_item_grab(_canvas_item, _grab_event_mask, nullptr, event->time); if (!_drag_initiated) { _desktop->canvas->forceFullRedrawAfterInterruptions(5); diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h index 24ff86c43..2ff5b7355 100644 --- a/src/ui/tool/control-point.h +++ b/src/ui/tool/control-point.h @@ -221,7 +221,7 @@ protected: */ ControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAnchorType anchor, ControlType type, - ColorSet const &cset = _default_color_set, SPCanvasGroup *group = 0); + ColorSet const &cset = _default_color_set, SPCanvasGroup *group = nullptr); /** * Create a control point with a pixbuf-based visual representation. @@ -235,7 +235,7 @@ protected: */ ControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAnchorType anchor, Glib::RefPtr<Gdk::Pixbuf> pixbuf, - ColorSet const &cset = _default_color_set, SPCanvasGroup *group = 0); + ColorSet const &cset = _default_color_set, SPCanvasGroup *group = nullptr); /// @name Handle control point events in subclasses /// @{ diff --git a/src/ui/tool/event-utils.cpp b/src/ui/tool/event-utils.cpp index 7793c9d4d..99e861240 100644 --- a/src/ui/tool/event-utils.cpp +++ b/src/ui/tool/event-utils.cpp @@ -27,7 +27,7 @@ guint shortcut_key(GdkEventKey const &event) event.hardware_keycode, (GdkModifierType) event.state, 0 /*event->key.group*/, - &shortcut_key, NULL, NULL, NULL); + &shortcut_key, nullptr, nullptr, nullptr); return shortcut_key; } @@ -56,7 +56,7 @@ unsigned combine_key_events(guint keyval, gint mask) unsigned combine_motion_events(SPCanvas *canvas, GdkEventMotion &event, gint mask) { - if (canvas == NULL) { + if (canvas == nullptr) { return false; } GdkEvent *event_next; diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index b982a622f..7010f58bf 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -770,8 +770,8 @@ bool MultiPathManipulator::event(Inkscape::UI::Tools::ToolBase *event_context, G * by sub-manipulators, for example TransformHandleSet and ControlPointSelection. */ void MultiPathManipulator::_commit(CommitEvent cps) { - gchar const *reason = NULL; - gchar const *key = NULL; + gchar const *reason = nullptr; + gchar const *key = nullptr; switch(cps) { case COMMIT_MOUSE_MOVE: reason = _("Move nodes"); diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 94a80a882..f64ee7827 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -136,8 +136,8 @@ void Handle::move(Geom::Point const &new_pos) Handle *other = this->other(); Node *node_towards = _parent->nodeToward(this); // node in direction of this handle Node *node_away = _parent->nodeAwayFrom(this); // node in the opposite direction - Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; - Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; + Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : nullptr; + Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : nullptr; double bspline_weight = 0.0; if (Geom::are_near(new_pos, _parent->position())) { @@ -595,7 +595,7 @@ Node *Node::_next() if (n) { return n.ptr(); } else { - return NULL; + return nullptr; } } @@ -610,7 +610,7 @@ Node *Node::_prev() if (p) { return p.ptr(); } else { - return NULL; + return nullptr; } } @@ -1359,7 +1359,7 @@ Handle *Node::handleToward(Node *to) return back(); } g_error("Node::handleToward(): second node is not adjacent!"); - return NULL; + return nullptr; } Node *Node::nodeToward(Handle *dir) @@ -1371,7 +1371,7 @@ Node *Node::nodeToward(Handle *dir) return _prev(); } g_error("Node::nodeToward(): handle is not a child of this node!"); - return NULL; + return nullptr; } Handle *Node::handleAwayFrom(Node *to) @@ -1383,7 +1383,7 @@ Handle *Node::handleAwayFrom(Node *to) return front(); } g_error("Node::handleAwayFrom(): second node is not adjacent!"); - return NULL; + return nullptr; } Node *Node::nodeAwayFrom(Handle *h) @@ -1395,7 +1395,7 @@ Node *Node::nodeAwayFrom(Handle *h) return _next(); } g_error("Node::nodeAwayFrom(): handle is not a child of this node!"); - return NULL; + return nullptr; } Glib::ustring Node::_getTip(unsigned state) const diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index 6a766125a..594f6b633 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -304,16 +304,16 @@ class NodeIterator public: typedef NodeIterator self; NodeIterator() - : _node(0) + : _node(nullptr) {} // default copy, default assign self &operator++() { - _node = (_node?_node->ln_next:NULL); + _node = (_node?_node->ln_next:nullptr); return *this; } self &operator--() { - _node = (_node?_node->ln_prev:NULL); + _node = (_node?_node->ln_prev:nullptr); return *this; } bool operator==(self const &other) const { if(&other){return _node == other._node;} else{return false;} } @@ -387,9 +387,9 @@ public: bool degenerate(); void setClosed(bool c) { _closed = c; } - iterator before(double t, double *fracpart = NULL); + iterator before(double t, double *fracpart = nullptr); iterator before(Geom::PathTime const &pvp); - const_iterator before(double t, double *fracpart = NULL) const { + const_iterator before(double t, double *fracpart = nullptr) const { return const_iterator(before(t, fracpart)._node); } const_iterator before(Geom::PathTime const &pvp) const { diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 6582501cb..5d043ffcf 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -129,7 +129,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _getGeometry(); - _outline = sp_canvas_bpath_new(_multi_path_manipulator._path_data.outline_group, NULL); + _outline = sp_canvas_bpath_new(_multi_path_manipulator._path_data.outline_group, nullptr); sp_canvas_item_hide(_outline); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(_outline), outline_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); @@ -201,7 +201,7 @@ void PathManipulator::writeXML() // this manipulator will have to be destroyed right after this call _getXMLNode()->removeObserver(*_observer); _path->deleteObject(true, true); - _path = NULL; + _path = nullptr; } _observer->unblock(); } @@ -1203,7 +1203,7 @@ void PathManipulator::_createControlPointsFromGeometry() // TODO move this into SPPath - do not manipulate directly //XML Tree being used here directly while it shouldn't be. - gchar const *nts_raw = _path ? _path->getRepr()->attribute(_nodetypesKey().data()) : 0; + gchar const *nts_raw = _path ? _path->getRepr()->attribute(_nodetypesKey().data()) : nullptr; std::string nodetype_string = nts_raw ? nts_raw : ""; /* Calculate the needed length of the nodetype string. * For closed paths, the entry is duplicated for the starting node, @@ -1236,7 +1236,7 @@ void PathManipulator::_createControlPointsFromGeometry() //determines if the trace has a bspline effect and the number of steps that it takes int PathManipulator::_bsplineGetSteps() const { - LivePathEffect::LPEBSpline const *lpe_bsp = NULL; + LivePathEffect::LPEBSpline const *lpe_bsp = nullptr; SPLPEItem * path = dynamic_cast<SPLPEItem *>(_path); if (path){ @@ -1277,7 +1277,7 @@ double PathManipulator::_bsplineHandlePosition(Handle *h, bool check_other) using Geom::Y; double pos = NO_POWER; Node *n = h->parent(); - Node * next_node = NULL; + Node * next_node = nullptr; next_node = n->nodeToward(h); if(next_node){ SPCurve *line_inside_nodes = new SPCurve(); @@ -1308,7 +1308,7 @@ Geom::Point PathManipulator::_bsplineHandleReposition(Handle *h,double pos){ Node *n = h->parent(); Geom::D2< Geom::SBasis > sbasis_inside_nodes; SPCurve *line_inside_nodes = new SPCurve(); - Node * next_node = NULL; + Node * next_node = nullptr; next_node = n->nodeToward(h); if(next_node && pos != NO_POWER){ line_inside_nodes->moveto(n->position()); @@ -1482,7 +1482,7 @@ void PathManipulator::_getGeometry() _spcurve->unref(); _spcurve = _path->getCurveForEdit(); // never allow NULL to sneak in here! - if (_spcurve == NULL) { + if (_spcurve == nullptr) { _spcurve = new SPCurve(); } } diff --git a/src/ui/tool/selectable-control-point.h b/src/ui/tool/selectable-control-point.h index b3020b47f..b083516c4 100644 --- a/src/ui/tool/selectable-control-point.h +++ b/src/ui/tool/selectable-control-point.h @@ -37,12 +37,12 @@ protected: SelectableControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAnchorType anchor, Inkscape::ControlType type, ControlPointSelection &sel, - ColorSet const &cset = _default_scp_color_set, SPCanvasGroup *group = 0); + ColorSet const &cset = _default_scp_color_set, SPCanvasGroup *group = nullptr); SelectableControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAnchorType anchor, Glib::RefPtr<Gdk::Pixbuf> pixbuf, ControlPointSelection &sel, - ColorSet const &cset = _default_scp_color_set, SPCanvasGroup *group = 0); + ColorSet const &cset = _default_scp_color_set, SPCanvasGroup *group = nullptr); void _setState(State state) override; diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index 3444de809..376de399e 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -37,7 +37,7 @@ public: { setVisible(false); _rubber = static_cast<CtrlRect*>(sp_canvas_item_new(_desktop->getControls(), - SP_TYPE_CTRLRECT, NULL)); + SP_TYPE_CTRLRECT, nullptr)); _rubber->setShadow(1, 0xffffffff); sp_canvas_item_hide(_rubber); } diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index bb2e6c861..56c34b4d9 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -696,14 +696,14 @@ ControlPoint::ColorSet RotationCenter::_center_cset = { TransformHandleSet::TransformHandleSet(SPDesktop *d, SPCanvasGroup *th_group) : Manipulator(d) - , _active(0) + , _active(nullptr) , _transform_handle_group(th_group) , _mode(MODE_SCALE) , _in_transform(false) , _visible(true) { _trans_outline = static_cast<CtrlRect*>(sp_canvas_item_new(_desktop->getControls(), - SP_TYPE_CTRLRECT, NULL)); + SP_TYPE_CTRLRECT, nullptr)); sp_canvas_item_hide(_trans_outline); _trans_outline->setDashed(true); @@ -796,7 +796,7 @@ void TransformHandleSet::_clearActiveHandle() { // This can only be called from handles, so they had to be visible before _setActiveHandle sp_canvas_item_hide(_trans_outline); - _active = 0; + _active = nullptr; _in_transform = false; _updateVisibility(_visible); } diff --git a/src/ui/toolbar/arc-toolbar.cpp b/src/ui/toolbar/arc-toolbar.cpp index ad1b70a6c..b8650e2b8 100644 --- a/src/ui/toolbar/arc-toolbar.cpp +++ b/src/ui/toolbar/arc-toolbar.cpp @@ -96,7 +96,7 @@ static void sp_arctb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" )); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); SPDocument* document = desktop->getDocument(); Geom::Scale scale = document->getDocumentScale(); @@ -265,7 +265,7 @@ static void sp_arctb_type_changed( GObject *tbl, int type ) SPItem *item = *i; if (SP_IS_GENERICELLIPSE(item)) { Inkscape::XML::Node *repr = item->getRepr(); - repr->setAttribute("sodipodi:open", (open?"true":NULL) ); + repr->setAttribute("sodipodi:open", (open?"true":nullptr) ); repr->setAttribute("sodipodi:arc-type", arc_type.c_str()); item->updateRepr(); modmade = true; @@ -321,7 +321,7 @@ static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const * / UnitTracker* tracker = reinterpret_cast<UnitTracker*>( g_object_get_data( tbl, "tracker" ) ); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); GtkAdjustment *adj; adj = GTK_ADJUSTMENT( g_object_get_data(tbl, "rx") ); @@ -354,10 +354,10 @@ static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const * / sp_arctb_sensitivize( tbl, gtk_adjustment_get_value(adj1), gtk_adjustment_get_value(adj2) ); - char const *arctypestr = NULL; + char const *arctypestr = nullptr; arctypestr = repr->attribute("sodipodi:arc-type"); if (!arctypestr) { // For old files. - char const *openstr = NULL; + char const *openstr = nullptr; openstr = repr->attribute("sodipodi:open"); arctypestr = (openstr ? "arc" : "slice"); } @@ -377,22 +377,22 @@ static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const * / } static Inkscape::XML::NodeEventVector arc_tb_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ arc_tb_event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; static void sp_arc_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl) { int n_selected = 0; - Inkscape::XML::Node *repr = NULL; - SPItem *item = NULL; + Inkscape::XML::Node *repr = nullptr; + SPItem *item = nullptr; if ( g_object_get_data( tbl, "repr" ) ) { - g_object_set_data( tbl, "item", NULL ); + g_object_set_data( tbl, "item", nullptr ); } purge_repr_listener( tbl, tbl ); @@ -440,7 +440,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); @@ -448,7 +448,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec g_object_set_data( holder, "tracker", tracker ); { - EgeOutputAction* act = ege_output_action_new( "ArcStateAction", _("<b>New:</b>"), "", 0 ); + EgeOutputAction* act = ege_output_action_new( "ArcStateAction", _("<b>New:</b>"), "", nullptr ); ege_output_action_set_use_markup( act, TRUE ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_object_set_data( holder, "mode_action", act ); @@ -456,7 +456,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec /* Radius X */ { - gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500}; eact = create_adjustment_action( "ArcRadiusXAction", _("Horizontal radius"), _("Rx:"), _("Horizontal radius of the circle, ellipse, or arc"), @@ -472,12 +472,12 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec /* Radius Y */ { - gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500}; eact = create_adjustment_action( "ArcRadiusYAction", _("Vertical radius"), _("Ry:"), _("Vertical radius of the circle, ellipse, or arc"), "/tools/shapes/arc/ry", 0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP, labels, values, G_N_ELEMENTS(labels), sp_arctb_ry_value_changed, tracker); @@ -500,7 +500,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec "/tools/shapes/arc/start", 0.0, GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-arc", -360.0, 360.0, 1.0, 10.0, - 0, 0, 0, + nullptr, nullptr, 0, sp_arctb_start_value_changed); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } @@ -511,9 +511,9 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec _("End"), _("End:"), _("The angle (in degrees) from the horizontal to the arc's end point"), "/tools/shapes/arc/end", 0.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, -360.0, 360.0, 1.0, 10.0, - 0, 0, 0, + nullptr, nullptr, 0, sp_arctb_end_value_changed); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } @@ -597,7 +597,7 @@ static void arc_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBa } else { if (changed) { changed.disconnect(); - purge_repr_listener(NULL, holder); + purge_repr_listener(nullptr, holder); } } } diff --git a/src/ui/toolbar/box3d-toolbar.cpp b/src/ui/toolbar/box3d-toolbar.cpp index 846aea59d..7e7c8df10 100644 --- a/src/ui/toolbar/box3d-toolbar.cpp +++ b/src/ui/toolbar/box3d-toolbar.cpp @@ -103,9 +103,9 @@ static void box3d_resync_toolbar(Inkscape::XML::Node *persp_repr, GObject *data) } GtkWidget *tbl = GTK_WIDGET(data); - GtkAdjustment *adj = 0; - GtkAction *act = 0; - GtkToggleAction *tact = 0; + GtkAdjustment *adj = nullptr; + GtkAction *act = nullptr; + GtkToggleAction *tact = nullptr; Persp3D *persp = persp3d_get_from_repr(persp_repr); if (!persp) { // Hmm, is it an error if this happens? @@ -165,11 +165,11 @@ static void box3d_persp_tb_event_attr_changed(Inkscape::XML::Node *repr, static Inkscape::XML::NodeEventVector box3d_persp_tb_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ box3d_persp_tb_event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; /** @@ -183,7 +183,7 @@ static void box3d_toolbox_selection_changed(Inkscape::Selection *selection, GObj // disable the angle entry fields for this direction (otherwise entering a value in them should only // update the perspectives with infinite VPs and leave the other ones untouched). - Inkscape::XML::Node *persp_repr = NULL; + Inkscape::XML::Node *persp_repr = nullptr; purge_repr_listener(tbl, tbl); SPItem *item = selection->singleItem(); @@ -290,17 +290,17 @@ static void box3d_toolbox_check_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; SPDocument *document = desktop->getDocument(); Persp3DImpl *persp_impl = document->getCurrentPersp3DImpl(); - EgeAdjustmentAction* box3d_angle_x = 0; - EgeAdjustmentAction* box3d_angle_y = 0; - EgeAdjustmentAction* box3d_angle_z = 0; + EgeAdjustmentAction* box3d_angle_x = nullptr; + EgeAdjustmentAction* box3d_angle_y = nullptr; + EgeAdjustmentAction* box3d_angle_z = nullptr; /* Angle X */ { - gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0 }; + gchar const* labels[] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; gdouble values[] = {-90, -60, -30, 0, 30, 60, 90}; eact = create_adjustment_action( "3DBoxAngleXAction", _("Angle in X direction"), _("Angle X:"), @@ -340,14 +340,14 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject /* Angle Y */ { - gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0 }; + gchar const* labels[] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; gdouble values[] = {-90, -60, -30, 0, 30, 60, 90}; eact = create_adjustment_action( "3DBoxAngleYAction", _("Angle in Y direction"), _("Angle Y:"), // Translators: PL is short for 'perspective line' _("Angle of PLs in Y direction"), "/tools/shapes/3dbox/box3d_angle_y", 30, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, -360.0, 360.0, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), box3d_angle_y_value_changed ); @@ -379,14 +379,14 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject /* Angle Z */ { - gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0 }; + gchar const* labels[] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; gdouble values[] = {-90, -60, -30, 0, 30, 60, 90}; eact = create_adjustment_action( "3DBoxAngleZAction", _("Angle in Z direction"), _("Angle Z:"), // Translators: PL is short for 'perspective line' _("Angle of PLs in Z direction"), "/tools/shapes/3dbox/box3d_angle_z", 30, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, -360.0, 360.0, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), box3d_angle_z_value_changed ); diff --git a/src/ui/toolbar/calligraphy-toolbar.cpp b/src/ui/toolbar/calligraphy-toolbar.cpp index 44271531e..7f4d9648a 100644 --- a/src/ui/toolbar/calligraphy-toolbar.cpp +++ b/src/ui/toolbar/calligraphy-toolbar.cpp @@ -382,7 +382,7 @@ static void sp_ddc_change_profile(GObject* tbl, int mode) static void sp_ddc_edit_profile(GtkAction * /*act*/, GObject* tbl) { - sp_dcc_save_profile(NULL, tbl); + sp_dcc_save_profile(nullptr, tbl); } void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) @@ -391,11 +391,11 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions { g_object_set_data(holder, "presets_blocked", GINT_TO_POINTER(TRUE)); - EgeAdjustmentAction* calligraphy_angle = 0; + EgeAdjustmentAction* calligraphy_angle = nullptr; { /* Width */ - gchar const* labels[] = {_("(hairline)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad stroke)")}; + gchar const* labels[] = {_("(hairline)"), nullptr, nullptr, nullptr, _("(default)"), nullptr, nullptr, nullptr, nullptr, _("(broad stroke)")}; gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "CalligraphyWidthAction", _("Pen Width"), _("Width:"), @@ -404,7 +404,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-calligraphy", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_width_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_ddc_width_value_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -412,23 +412,23 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions { /* Thinning */ - gchar const* labels[] = {_("(speed blows up stroke)"), 0, 0, _("(slight widening)"), _("(constant width)"), _("(slight thinning, default)"), 0, 0, _("(speed deflates stroke)")}; + gchar const* labels[] = {_("(speed blows up stroke)"), nullptr, nullptr, _("(slight widening)"), _("(constant width)"), _("(slight thinning, default)"), nullptr, nullptr, _("(speed deflates stroke)")}; gdouble values[] = {-100, -40, -20, -10, 0, 10, 20, 40, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "ThinningAction", _("Stroke Thinning"), _("Thinning:"), _("How much velocity thins the stroke (> 0 makes fast strokes thinner, < 0 makes them broader, 0 makes width independent of velocity)"), "/tools/calligraphic/thinning", 10, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, -100, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_velthin_value_changed, NULL /*unit tracker*/, 1, 0); + sp_ddc_velthin_value_changed, nullptr /*unit tracker*/, 1, 0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); } { /* Angle */ - gchar const* labels[] = {_("(left edge up)"), 0, 0, _("(horizontal)"), _("(default)"), 0, _("(right edge up)")}; + gchar const* labels[] = {_("(left edge up)"), nullptr, nullptr, _("(horizontal)"), _("(default)"), nullptr, _("(right edge up)")}; gdouble values[] = {-90, -60, -30, 0, 30, 60, 90}; EgeAdjustmentAction* eact = create_adjustment_action( "AngleAction", _("Pen Angle"), _("Angle:"), @@ -437,7 +437,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions GTK_WIDGET(desktop->canvas), holder, TRUE, "calligraphy-angle", -90.0, 90.0, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_angle_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_ddc_angle_value_changed, nullptr /*unit tracker*/, 1, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); g_object_set_data( holder, "angle_action", eact ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -446,49 +446,49 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions { /* Fixation */ - gchar const* labels[] = {_("(perpendicular to stroke, \"brush\")"), 0, 0, 0, _("(almost fixed, default)"), _("(fixed by Angle, \"pen\")")}; + gchar const* labels[] = {_("(perpendicular to stroke, \"brush\")"), nullptr, nullptr, nullptr, _("(almost fixed, default)"), _("(fixed by Angle, \"pen\")")}; gdouble values[] = {0, 20, 40, 60, 90, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "FixationAction", _("Fixation"), _("Fixation:"), _("Angle behavior (0 = nib always perpendicular to stroke direction, 100 = fixed angle)"), "/tools/calligraphic/flatness", 90, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_flatness_value_changed, NULL /*unit tracker*/, 1, 0); + sp_ddc_flatness_value_changed, nullptr /*unit tracker*/, 1, 0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); } { /* Cap Rounding */ - gchar const* labels[] = {_("(blunt caps, default)"), _("(slightly bulging)"), 0, 0, _("(approximately round)"), _("(long protruding caps)")}; + gchar const* labels[] = {_("(blunt caps, default)"), _("(slightly bulging)"), nullptr, nullptr, _("(approximately round)"), _("(long protruding caps)")}; gdouble values[] = {0, 0.3, 0.5, 1.0, 1.4, 5.0}; // TRANSLATORS: "cap" means "end" (both start and finish) here EgeAdjustmentAction* eact = create_adjustment_action( "CapRoundingAction", _("Cap rounding"), _("Caps:"), _("Increase to make caps at the ends of strokes protrude more (0 = no caps, 1 = round caps)"), "/tools/calligraphic/cap_rounding", 0.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 5.0, 0.01, 0.1, labels, values, G_N_ELEMENTS(labels), - sp_ddc_cap_rounding_value_changed, NULL /*unit tracker*/, 0.01, 2 ); + sp_ddc_cap_rounding_value_changed, nullptr /*unit tracker*/, 0.01, 2 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); } { /* Tremor */ - gchar const* labels[] = {_("(smooth line)"), _("(slight tremor)"), _("(noticeable tremor)"), 0, 0, _("(maximum tremor)")}; + gchar const* labels[] = {_("(smooth line)"), _("(slight tremor)"), _("(noticeable tremor)"), nullptr, nullptr, _("(maximum tremor)")}; gdouble values[] = {0, 10, 20, 40, 60, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "TremorAction", _("Stroke Tremor"), _("Tremor:"), _("Increase to make strokes rugged and trembling"), "/tools/calligraphic/tremor", 0.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_tremor_value_changed, NULL /*unit tracker*/, 1, 0); + sp_ddc_tremor_value_changed, nullptr /*unit tracker*/, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); @@ -497,16 +497,16 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions { /* Wiggle */ - gchar const* labels[] = {_("(no wiggle)"), _("(slight deviation)"), 0, 0, _("(wild waves and curls)")}; + gchar const* labels[] = {_("(no wiggle)"), _("(slight deviation)"), nullptr, nullptr, _("(wild waves and curls)")}; gdouble values[] = {0, 20, 40, 60, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "WiggleAction", _("Pen Wiggle"), _("Wiggle:"), _("Increase to make the pen waver and wiggle"), "/tools/calligraphic/wiggle", 0.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_wiggle_value_changed, NULL /*unit tracker*/, 1, 0); + sp_ddc_wiggle_value_changed, nullptr /*unit tracker*/, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -514,16 +514,16 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions { /* Mass */ - gchar const* labels[] = {_("(no inertia)"), _("(slight smoothing, default)"), _("(noticeable lagging)"), 0, 0, _("(maximum inertia)")}; + gchar const* labels[] = {_("(no inertia)"), _("(slight smoothing, default)"), _("(noticeable lagging)"), nullptr, nullptr, _("(maximum inertia)")}; gdouble values[] = {0.0, 2, 10, 20, 50, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "MassAction", _("Pen Mass"), _("Mass:"), _("Increase to make the pen drag behind, as if slowed by inertia"), "/tools/calligraphic/mass", 2.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_mass_value_changed, NULL /*unit tracker*/, 1, 0); + sp_ddc_mass_value_changed, nullptr /*unit tracker*/, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); diff --git a/src/ui/toolbar/connector-toolbar.cpp b/src/ui/toolbar/connector-toolbar.cpp index 2709c700e..42bf965b7 100644 --- a/src/ui/toolbar/connector-toolbar.cpp +++ b/src/ui/toolbar/connector-toolbar.cpp @@ -105,7 +105,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl if (Inkscape::UI::Tools::cc_item_is_connector(item)) { item->setAttribute( "inkscape:connector-type", - value, NULL); + value, nullptr); item->avoidRef->handleSettingChange(); modmade = true; } @@ -152,7 +152,7 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) if (Inkscape::UI::Tools::cc_item_is_connector(item)) { item->setAttribute( "inkscape:connector-curvature", - value, NULL); + value, nullptr); item->avoidRef->handleSettingChange(); modmade = true; } @@ -282,11 +282,11 @@ static void connector_tb_event_attr_changed(Inkscape::XML::Node *repr, } static Inkscape::XML::NodeEventVector connector_tb_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ connector_tb_event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; static void sp_connector_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl) @@ -344,7 +344,7 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_connector_orthogonal_toggled), holder ); } - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; // Curvature spinbox eact = create_adjustment_action( "ConnectorCurvatureAction", _("Connector Curvature"), _("Curvature:"), @@ -352,8 +352,8 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, "/tools/connector/curvature", defaultConnCurvature, GTK_WIDGET(desktop->canvas), holder, TRUE, "inkscape:connector-curvature", 0, 100, 1.0, 10.0, - 0, 0, 0, - connector_curvature_changed, NULL /*unit tracker*/, 1, 0 ); + nullptr, nullptr, 0, + connector_curvature_changed, nullptr /*unit tracker*/, 1, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); // Spacing spinbox @@ -363,8 +363,8 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, "/tools/connector/spacing", defaultConnSpacing, GTK_WIDGET(desktop->canvas), holder, TRUE, "inkscape:connector-spacing", 0, 100, 1.0, 10.0, - 0, 0, 0, - connector_spacing_changed, NULL /*unit tracker*/, 1, 0 ); + nullptr, nullptr, 0, + connector_spacing_changed, nullptr /*unit tracker*/, 1, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); // Graph (connector network) layout @@ -385,8 +385,8 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, "/tools/connector/length", 100, GTK_WIDGET(desktop->canvas), holder, TRUE, "inkscape:connector-length", 10, 1000, 10.0, 100.0, - 0, 0, 0, - connector_length_changed, NULL /*unit tracker*/, 1, 0 ); + nullptr, nullptr, 0, + connector_length_changed, nullptr /*unit tracker*/, 1, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); @@ -425,7 +425,7 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, // Code to watch for changes to the connector-spacing attribute in // the XML. Inkscape::XML::Node *repr = desktop->namedview->getRepr(); - g_assert(repr != NULL); + g_assert(repr != nullptr); purge_repr_listener( holder, holder ); diff --git a/src/ui/toolbar/dropper-toolbar.cpp b/src/ui/toolbar/dropper-toolbar.cpp index ba3c9037c..b9d21be1b 100644 --- a/src/ui/toolbar/dropper-toolbar.cpp +++ b/src/ui/toolbar/dropper-toolbar.cpp @@ -80,7 +80,7 @@ void sp_dropper_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainAction gint pickAlpha = prefs->getInt( "/tools/dropper/pick", 1 ); { - EgeOutputAction* act = ege_output_action_new( "DropperOpacityAction", _("Opacity:"), "", 0 ); + EgeOutputAction* act = ege_output_action_new( "DropperOpacityAction", _("Opacity:"), "", nullptr ); ege_output_action_set_use_markup( act, TRUE ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); } @@ -89,7 +89,7 @@ void sp_dropper_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainAction InkToggleAction* act = ink_toggle_action_new( "DropperPickAlphaAction", _("Pick opacity"), _("Pick both the color and the alpha (transparency) under cursor; otherwise, pick only the visible color premultiplied by alpha"), - NULL, + nullptr, GTK_ICON_SIZE_MENU ); g_object_set( act, "short_label", _("Pick"), NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -102,7 +102,7 @@ void sp_dropper_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainAction InkToggleAction* act = ink_toggle_action_new( "DropperSetAlphaAction", _("Assign opacity"), _("If alpha was picked, assign it to selection as fill or stroke transparency"), - NULL, + nullptr, GTK_ICON_SIZE_MENU ); g_object_set( act, "short_label", _("Assign"), NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); diff --git a/src/ui/toolbar/eraser-toolbar.cpp b/src/ui/toolbar/eraser-toolbar.cpp index 26ff3a654..ec028a2c8 100644 --- a/src/ui/toolbar/eraser-toolbar.cpp +++ b/src/ui/toolbar/eraser-toolbar.cpp @@ -183,7 +183,7 @@ void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb /* Width */ { - gchar const* labels[] = {_("(no width)"),_("(hairline)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad stroke)")}; + gchar const* labels[] = {_("(no width)"),_("(hairline)"), nullptr, nullptr, nullptr, _("(default)"), nullptr, nullptr, nullptr, nullptr, _("(broad stroke)")}; gdouble values[] = {0, 1, 3, 5, 10, 15, 20, 30, 50, 75, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "EraserWidthAction", _("Pen Width"), _("Width:"), @@ -192,7 +192,7 @@ void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-eraser", 0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_erc_width_value_changed, NULL /*unit tracker*/, 1, 0); + sp_erc_width_value_changed, nullptr /*unit tracker*/, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); g_object_set_data( holder, "width", eact ); @@ -216,16 +216,16 @@ void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb /* Thinning */ { - gchar const* labels[] = {_("(speed blows up stroke)"), 0, 0, _("(slight widening)"), _("(constant width)"), _("(slight thinning, default)"), 0, 0, _("(speed deflates stroke)")}; + gchar const* labels[] = {_("(speed blows up stroke)"), nullptr, nullptr, _("(slight widening)"), _("(constant width)"), _("(slight thinning, default)"), nullptr, nullptr, _("(speed deflates stroke)")}; gdouble values[] = {-100, -40, -20, -10, 0, 10, 20, 40, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "EraserThinningAction", _("Eraser Stroke Thinning"), _("Thinning:"), _("How much velocity thins the stroke (> 0 makes fast strokes thinner, < 0 makes them broader, 0 makes width independent of velocity)"), "/tools/eraser/thinning", 10, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, -100, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_erc_velthin_value_changed, NULL /*unit tracker*/, 1, 0); + sp_erc_velthin_value_changed, nullptr /*unit tracker*/, 1, 0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); g_object_set_data( holder, "thinning", eact ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -234,17 +234,17 @@ void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb /* Cap Rounding */ { - gchar const* labels[] = {_("(blunt caps, default)"), _("(slightly bulging)"), 0, 0, _("(approximately round)"), _("(long protruding caps)")}; + gchar const* labels[] = {_("(blunt caps, default)"), _("(slightly bulging)"), nullptr, nullptr, _("(approximately round)"), _("(long protruding caps)")}; gdouble values[] = {0, 0.3, 0.5, 1.0, 1.4, 5.0}; // TRANSLATORS: "cap" means "end" (both start and finish) here EgeAdjustmentAction* eact = create_adjustment_action( "EraserCapRoundingAction", _("Eraser Cap rounding"), _("Caps:"), _("Increase to make caps at the ends of strokes protrude more (0 = no caps, 1 = round caps)"), "/tools/eraser/cap_rounding", 0.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 5.0, 0.01, 0.1, labels, values, G_N_ELEMENTS(labels), - sp_erc_cap_rounding_value_changed, NULL /*unit tracker*/, 0.01, 2 ); + sp_erc_cap_rounding_value_changed, nullptr /*unit tracker*/, 0.01, 2 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); g_object_set_data( holder, "cap_rounding", eact ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -253,16 +253,16 @@ void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb /* Tremor */ { - gchar const* labels[] = {_("(smooth line)"), _("(slight tremor)"), _("(noticeable tremor)"), 0, 0, _("(maximum tremor)")}; + gchar const* labels[] = {_("(smooth line)"), _("(slight tremor)"), _("(noticeable tremor)"), nullptr, nullptr, _("(maximum tremor)")}; gdouble values[] = {0, 10, 20, 40, 60, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "EraserTremorAction", _("EraserStroke Tremor"), _("Tremor:"), _("Increase to make strokes rugged and trembling"), "/tools/eraser/tremor", 0.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_erc_tremor_value_changed, NULL /*unit tracker*/, 1, 0); + sp_erc_tremor_value_changed, nullptr /*unit tracker*/, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); g_object_set_data( holder, "tremor", eact ); @@ -273,16 +273,16 @@ void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb /* Mass */ { - gchar const* labels[] = {_("(no inertia)"), _("(slight smoothing, default)"), _("(noticeable lagging)"), 0, 0, _("(maximum inertia)")}; + gchar const* labels[] = {_("(no inertia)"), _("(slight smoothing, default)"), _("(noticeable lagging)"), nullptr, nullptr, _("(maximum inertia)")}; gdouble values[] = {0.0, 2, 10, 20, 50, 100}; EgeAdjustmentAction* eact = create_adjustment_action( "EraserMassAction", _("Eraser Mass"), _("Mass:"), _("Increase to make the eraser drag behind, as if slowed by inertia"), "/tools/eraser/mass", 10.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_erc_mass_value_changed, NULL /*unit tracker*/, 1, 0); + sp_erc_mass_value_changed, nullptr /*unit tracker*/, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); g_object_set_data( holder, "mass", eact ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); diff --git a/src/ui/toolbar/gradient-toolbar.cpp b/src/ui/toolbar/gradient-toolbar.cpp index 38724aca4..b6677e221 100644 --- a/src/ui/toolbar/gradient-toolbar.cpp +++ b/src/ui/toolbar/gradient-toolbar.cpp @@ -157,7 +157,7 @@ int gr_vector_list(Glib::RefPtr<Gtk::ListStore> store, SPDesktop *desktop, } else { - if (gr_selected == NULL) { + if (gr_selected == nullptr) { row = *(store->append()); row[columns.col_label ] = _("No gradient"); row[columns.col_tooltip ] = ""; @@ -210,13 +210,13 @@ int gr_vector_list(Glib::RefPtr<Gtk::ListStore> store, SPDesktop *desktop, */ void gr_get_dt_selected_gradient(Inkscape::Selection *selection, SPGradient *&gr_selected) { - SPGradient *gradient = 0; + SPGradient *gradient = nullptr; auto itemlist= selection->items(); for(auto i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i;// get the items gradient, not the getVector() version SPStyle *style = item->style; - SPPaintServer *server = 0; + SPPaintServer *server = nullptr; if (style && (style->fill.isPaintserver())) { server = item->style->getFillPaintServer(); @@ -231,7 +231,7 @@ void gr_get_dt_selected_gradient(Inkscape::Selection *selection, SPGradient *&gr } if (gradient && gradient->isSolid()) { - gradient = 0; + gradient = nullptr; } if (gradient) { @@ -258,7 +258,7 @@ void gr_read_selection( Inkscape::Selection *selection, SPGradientSpread spread = sp_item_gradient_get_spread(draggable->item, draggable->fill_or_stroke); if (gradient && gradient->isSolid()) { - gradient = 0; + gradient = nullptr; } if (gradient && (gradient != gr_selected)) { @@ -292,7 +292,7 @@ void gr_read_selection( Inkscape::Selection *selection, SPGradientSpread spread = SP_GRADIENT(server)->fetchSpread(); if (gradient && gradient->isSolid()) { - gradient = 0; + gradient = nullptr; } if (gradient && (gradient != gr_selected)) { @@ -318,7 +318,7 @@ void gr_read_selection( Inkscape::Selection *selection, SPGradientSpread spread = SP_GRADIENT(server)->fetchSpread(); if (gradient && gradient->isSolid()) { - gradient = 0; + gradient = nullptr; } if (gradient && (gradient != gr_selected)) { @@ -394,7 +394,7 @@ static void gr_remove_stop(GtkWidget * /*button*/, GObject *data) } ToolBase *ev = desktop->getEventContext(); - GrDrag *drag = NULL; + GrDrag *drag = nullptr; if (ev) { drag = ev->get_drag(); } @@ -450,18 +450,18 @@ static void gr_stop_set_offset (GObject *data) bool isEndStop = false; - SPStop *prev = NULL; + SPStop *prev = nullptr; prev = stop->getPrevStop(); - if (prev != NULL ) { + if (prev != nullptr ) { gtk_adjustment_set_lower(adj, prev->offset); } else { isEndStop = true; gtk_adjustment_set_lower(adj, 0); } - SPStop *next = NULL; + SPStop *next = nullptr; next = stop->getNextStop(); - if (next != NULL ) { + if (next != nullptr ) { gtk_adjustment_set_upper(adj, next->offset); } else { isEndStop = true; @@ -739,7 +739,7 @@ static void gr_gradient_changed( GObject *data, int active ) Inkscape::Selection *selection = desktop->getSelection(); ToolBase *ev = desktop->getEventContext(); - gr_apply_gradient(selection, ev ? ev->get_drag() : NULL, gr); + gr_apply_gradient(selection, ev ? ev->get_drag() : nullptr, gr); DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Assign gradient to object")); @@ -761,7 +761,7 @@ static void gr_spread_changed( GObject *data, int active ) SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(data, "desktop")); Inkscape::Selection *selection = desktop->getSelection(); - SPGradient *gradient = 0; + SPGradient *gradient = nullptr; gr_get_dt_selected_gradient(selection, gradient); if (gradient) { @@ -1047,15 +1047,15 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, /* Offset */ { - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; eact = create_adjustment_action( "GradientEditOffsetAction", _("Offset"), C_("Gradient", "Offset:"), _("Offset of selected stop"), "/tools/gradient/stopoffset", 0, - GTK_WIDGET(desktop->canvas), data, FALSE, NULL, + GTK_WIDGET(desktop->canvas), data, FALSE, nullptr, 0.0, 1.0, 0.01, 0.1, - 0, 0, 0, + nullptr, nullptr, 0, gr_stop_offset_adjustment_changed, - NULL /*unit tracker*/, + nullptr /*unit tracker*/, 0.01, 2, 1.0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); @@ -1149,12 +1149,12 @@ static void gr_tb_selection_changed(Inkscape::Selection * /*selection*/, GObject if (selection) { ToolBase *ev = desktop->getEventContext(); - GrDrag *drag = NULL; + GrDrag *drag = nullptr; if (ev) { drag = ev->get_drag(); } - SPGradient *gr_selected = 0; + SPGradient *gr_selected = nullptr; SPGradientSpread spr_selected = SP_GRADIENT_SPREAD_UNDEFINED; bool gr_multi = false; bool spr_multi = false; @@ -1188,7 +1188,7 @@ static void gr_tb_selection_changed(Inkscape::Selection * /*selection*/, GObject gtk_action_set_sensitive(GTK_ACTION(del), (gr_selected && !gr_multi && drag && !drag->selected.empty())); InkAction *reverse = (InkAction *) g_object_get_data(data, "gradient_stops_reverse_action"); - gtk_action_set_sensitive(GTK_ACTION(reverse), (gr_selected!= NULL)); + gtk_action_set_sensitive(GTK_ACTION(reverse), (gr_selected!= nullptr)); InkSelectOneAction *stops_action = (InkSelectOneAction *) g_object_get_data(data, "gradient_stop_action"); stops_action->set_sensitive( gr_selected && !gr_multi); @@ -1207,17 +1207,17 @@ static void gr_tb_selection_modified(Inkscape::Selection *selection, guint /*fla static void gr_drag_selection_changed(gpointer /*dragger*/, GObject* data) { - gr_tb_selection_changed(NULL, data); + gr_tb_selection_changed(nullptr, data); } static void gr_defs_release(SPObject * /*defs*/, GObject* data) { - gr_tb_selection_changed(NULL, data); + gr_tb_selection_changed(nullptr, data); } static void gr_defs_modified(SPObject * /*defs*/, guint /*flags*/, GObject* data) { - gr_tb_selection_changed(NULL, data); + gr_tb_selection_changed(nullptr, data); } // lp:1327267 diff --git a/src/ui/toolbar/lpe-toolbar.cpp b/src/ui/toolbar/lpe-toolbar.cpp index bed5ed4bf..b42c1ae0c 100644 --- a/src/ui/toolbar/lpe-toolbar.cpp +++ b/src/ui/toolbar/lpe-toolbar.cpp @@ -131,14 +131,14 @@ static void sp_lpetool_toolbox_sel_changed(Inkscape::Selection *selection, GObje act->set_sensitive(true); act->set_active( lpels->end_type.get_value() ); } else { - g_object_set_data(tbl, "currentlpe", NULL); - g_object_set_data(tbl, "currentlpeitem", NULL); + g_object_set_data(tbl, "currentlpe", nullptr); + g_object_set_data(tbl, "currentlpeitem", nullptr); act->set_sensitive(false); } } else { - g_object_set_data(tbl, "currentlpe", NULL); - g_object_set_data(tbl, "currentlpeitem", NULL); + g_object_set_data(tbl, "currentlpe", nullptr); + g_object_set_data(tbl, "currentlpeitem", nullptr); act->set_sensitive(false); } } @@ -180,7 +180,7 @@ static void lpetool_unit_changed(GObject* tbl, int /* NotUsed */) { UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(tbl, "tracker")); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setString("/tools/lpetool/unit", unit->abbr); @@ -247,7 +247,7 @@ static void lpetool_open_lpe_dialog(GtkToggleAction *act, gpointer data) SPDesktop *desktop = static_cast<SPDesktop *>(data); if (tools_isactive(desktop, TOOLS_LPETOOL)) { - sp_action_perform(Inkscape::Verb::get(SP_VERB_DIALOG_LIVE_PATH_EFFECT)->get_action(Inkscape::ActionContext(desktop)), NULL); + sp_action_perform(Inkscape::Verb::get(SP_VERB_DIALOG_LIVE_PATH_EFFECT)->get_action(Inkscape::ActionContext(desktop)), nullptr); } gtk_toggle_action_set_active(act, false); } @@ -260,7 +260,7 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO tracker->setActiveUnit(desktop->getNamedView()->display_units); g_object_set_data(holder, "tracker", tracker); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setString("/tools/lpetool/unit", unit->abbr); diff --git a/src/ui/toolbar/measure-toolbar.cpp b/src/ui/toolbar/measure-toolbar.cpp index ec9cffe25..07eefa330 100644 --- a/src/ui/toolbar/measure-toolbar.cpp +++ b/src/ui/toolbar/measure-toolbar.cpp @@ -63,7 +63,7 @@ using Inkscape::UI::Tools::MeasureTool; * Will go away during tool refactoring. */ static MeasureTool *get_measure_tool() { - MeasureTool *tool = 0; + MeasureTool *tool = nullptr; if (SP_ACTIVE_DESKTOP ) { Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; if (SP_IS_MEASURE_CONTEXT(ec)) { @@ -286,7 +286,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G g_object_set_data( holder, "tracker", tracker ); - EgeAdjustmentAction *eact = 0; + EgeAdjustmentAction *eact = nullptr; GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); /* Font Size */ @@ -295,16 +295,16 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G _("Font Size"), _("Font Size:"), _("The font size to be used in the measurement labels"), "/tools/measure/fontsize", 10.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 1.0, 36.0, 1.0, 4.0, - 0, 0, 0, - sp_measure_fontsize_value_changed, NULL, 0 , 2); + nullptr, nullptr, 0, + sp_measure_fontsize_value_changed, nullptr, 0 , 2); gtk_action_group_add_action( mainActions, GTK_ACTION(eact)); } /* units label */ { - EgeOutputAction* act = ege_output_action_new( "measure_units_label", _("Units:"), _("The units to be used for the measurements"), 0 ); + EgeOutputAction* act = ege_output_action_new( "measure_units_label", _("Units:"), _("The units to be used for the measurements"), nullptr ); ege_output_action_set_use_markup( act, TRUE ); g_object_set( act, "visible-overflown", FALSE, NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -323,10 +323,10 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G _("Precision"), _("Precision:"), _("Decimal precision of measure"), "/tools/measure/precision", 2, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 10, 1, 0, - 0, 0, 0, - sp_measure_precision_value_changed, NULL, 0 ,0); + nullptr, nullptr, 0, + sp_measure_precision_value_changed, nullptr, 0 ,0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact)); } @@ -336,10 +336,10 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G _("Scale %"), _("Scale %:"), _("Scale the results"), "/tools/measure/scale", 100.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 90000.0, 1.0, 4.0, - 0, 0, 0, - sp_measure_scale_value_changed, NULL, 0 , 3); + nullptr, nullptr, 0, + sp_measure_scale_value_changed, nullptr, 0 , 3); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } @@ -349,10 +349,10 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G _("Offset"), _("Offset:"), _("Mark dimension offset"), "/tools/measure/offset", 5.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 90000.0, 1.0, 4.0, - 0, 0, 0, - sp_measure_offset_value_changed, NULL, 0 , 2); + nullptr, nullptr, 0, + sp_measure_offset_value_changed, nullptr, 0 , 2); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } diff --git a/src/ui/toolbar/mesh-toolbar.cpp b/src/ui/toolbar/mesh-toolbar.cpp index fdeb736e6..80f817ae3 100644 --- a/src/ui/toolbar/mesh-toolbar.cpp +++ b/src/ui/toolbar/mesh-toolbar.cpp @@ -112,7 +112,7 @@ void ms_read_selection( Inkscape::Selection *selection, SPMeshType &ms_type, bool &ms_type_multi ) { - ms_selected = NULL; + ms_selected = nullptr; ms_selected_multi = false; ms_type = SP_MESH_TYPE_COONS; ms_type_multi = false; @@ -162,7 +162,7 @@ static void ms_tb_selection_changed(Inkscape::Selection * /*selection*/, gpointe // // Hide/show handles? // } - SPMeshGradient *ms_selected = 0; + SPMeshGradient *ms_selected = nullptr; SPMeshType ms_type = SP_MESH_TYPE_COONS; bool ms_selected_multi = false; bool ms_type_multi = false; @@ -187,18 +187,18 @@ static void ms_tb_selection_modified(Inkscape::Selection *selection, guint /*fla static void ms_drag_selection_changed(gpointer /*dragger*/, gpointer data) { - ms_tb_selection_changed(NULL, data); + ms_tb_selection_changed(nullptr, data); } static void ms_defs_release(SPObject * /*defs*/, GObject *widget) { - ms_tb_selection_changed(NULL, widget); + ms_tb_selection_changed(nullptr, widget); } static void ms_defs_modified(SPObject * /*defs*/, guint /*flags*/, GObject *widget) { - ms_tb_selection_changed(NULL, widget); + ms_tb_selection_changed(nullptr, widget); } /* @@ -279,7 +279,7 @@ static void ms_type_changed( GObject *tbl, int mode ) * Will go away during tool refactoring. */ static MeshTool *get_mesh_tool() { - MeshTool *tool = 0; + MeshTool *tool = nullptr; if (SP_ACTIVE_DESKTOP ) { Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; if (SP_IS_MESH_CONTEXT(ec)) { @@ -338,7 +338,7 @@ static void ms_toggle_fill_stroke(InkToggleAction * /*act*/, gpointer data) drag->updateDraggers(); drag->updateLines(); drag->updateLevels(); - ms_tb_selection_changed(NULL, data); // Need to update Type widget + ms_tb_selection_changed(nullptr, data); // Need to update Type widget } } @@ -367,7 +367,7 @@ void sp_mesh_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObj { GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -449,15 +449,15 @@ void sp_mesh_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObj /* Number of mesh rows */ { - gchar const** labels = NULL; + gchar const** labels = nullptr; gdouble values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; eact = create_adjustment_action( "MeshRowAction", _("Rows"), _("Rows:"), _("Number of rows in new mesh"), "/tools/mesh/mesh_rows", 1, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 1, 20, 1, 1, labels, values, 0, - ms_row_changed, NULL /*unit tracker*/, + ms_row_changed, nullptr /*unit tracker*/, 1.0, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -465,15 +465,15 @@ void sp_mesh_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObj /* Number of mesh columns */ { - gchar const** labels = NULL; + gchar const** labels = nullptr; gdouble values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; eact = create_adjustment_action( "MeshColumnAction", _("Columns"), _("Columns:"), _("Number of columns in new mesh"), "/tools/mesh/mesh_cols", 1, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 1, 20, 1, 1, labels, values, 0, - ms_col_changed, NULL /*unit tracker*/, + ms_col_changed, nullptr /*unit tracker*/, 1.0, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); diff --git a/src/ui/toolbar/node-toolbar.cpp b/src/ui/toolbar/node-toolbar.cpp index a5e6a68ad..2cb9fb364 100644 --- a/src/ui/toolbar/node-toolbar.cpp +++ b/src/ui/toolbar/node-toolbar.cpp @@ -70,7 +70,7 @@ using Inkscape::UI::Tools::NodeTool; * Will go away during tool refactoring. */ static NodeTool *get_node_tool() { - 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)) { @@ -231,7 +231,7 @@ static void sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tb return; } Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); NodeTool *nt = get_node_tool(); if (!nt || !(nt->_selected_nodes) ||nt->_selected_nodes->empty()) { @@ -348,10 +348,10 @@ void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje g_object_set( INK_ACTION(inky), "short_label", _("Insert"), NULL ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_add), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); - GtkToolItem *menu_tool_button = gtk_menu_tool_button_new (NULL, NULL); + GtkToolItem *menu_tool_button = gtk_menu_tool_button_new (nullptr, nullptr); gtk_activatable_set_related_action (GTK_ACTIVATABLE (menu_tool_button), GTK_ACTION(inky)); // also create dummy menu action: - gtk_action_group_add_action( mainActions, gtk_action_new("NodeInsertActionMenu", NULL, NULL, NULL) ); + gtk_action_group_add_action( mainActions, gtk_action_new("NodeInsertActionMenu", nullptr, nullptr, nullptr) ); } { @@ -577,8 +577,8 @@ void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* X coord of selected node(s) */ { - EgeAdjustmentAction* eact = 0; - gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + EgeAdjustmentAction* eact = nullptr; + gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500}; eact = create_adjustment_action( "NodeXAction", _("X coordinate:"), _("X:"), _("X coordinate of selected node(s)"), @@ -594,13 +594,13 @@ void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Y coord of selected node(s) */ { - EgeAdjustmentAction* eact = 0; - gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + EgeAdjustmentAction* eact = nullptr; + gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500}; eact = create_adjustment_action( "NodeYAction", _("Y coordinate:"), _("Y:"), _("Y coordinate of selected node(s)"), "/tools/nodes/Ycoord", 0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, -1e6, 1e6, SPIN_STEP, SPIN_PAGE_STEP, labels, values, G_N_ELEMENTS(labels), sp_node_path_y_value_changed, tracker ); diff --git a/src/ui/toolbar/paintbucket-toolbar.cpp b/src/ui/toolbar/paintbucket-toolbar.cpp index 280cf0eb1..c46a007b6 100644 --- a/src/ui/toolbar/paintbucket-toolbar.cpp +++ b/src/ui/toolbar/paintbucket-toolbar.cpp @@ -83,7 +83,7 @@ static void paintbucket_offset_changed(GtkAdjustment *adj, GObject *tbl) // unit and it'll be correctly handled on load. prefs->setDouble("/tools/paintbucket/offset", (gdouble)gtk_adjustment_get_value(adj)); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); prefs->setString("/tools/paintbucket/offsetunits", unit->abbr); } @@ -117,7 +117,7 @@ static void paintbucket_defaults(GtkWidget *, GObject *tbl) void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // Channel @@ -164,8 +164,8 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("The maximum allowed difference between the clicked pixel and the neighboring pixels to be counted in the fill"), "/tools/paintbucket/threshold", 5, GTK_WIDGET(desktop->canvas), holder, TRUE, "inkscape:paintbucket-threshold", 0, 100.0, 1.0, 10.0, - 0, 0, 0, - paintbucket_threshold_changed, NULL /*unit tracker*/, 1, 0 ); + nullptr, nullptr, 0, + paintbucket_threshold_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); @@ -193,7 +193,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("The amount to grow (positive) or shrink (negative) the created fill path"), "/tools/paintbucket/offset", 0, GTK_WIDGET(desktop->canvas), holder, TRUE, "inkscape:paintbucket-offset", -1e4, 1e4, 0.1, 0.5, - 0, 0, 0, + nullptr, nullptr, 0, paintbucket_offset_changed, tracker, 1, 2); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } diff --git a/src/ui/toolbar/pencil-toolbar.cpp b/src/ui/toolbar/pencil-toolbar.cpp index 6391af394..cf4ba5a5d 100644 --- a/src/ui/toolbar/pencil-toolbar.cpp +++ b/src/ui/toolbar/pencil-toolbar.cpp @@ -304,7 +304,7 @@ static void sp_flatten_spiro_bspline(GtkWidget * /*widget*/, GObject *obj) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(obj, "desktop")); auto selected = desktop->getSelection()->items(); - SPLPEItem* lpeitem = NULL; + SPLPEItem* lpeitem = nullptr; for (auto it(selected.begin()); it != selected.end(); ++it){ lpeitem = dynamic_cast<SPLPEItem*>(*it); if (lpeitem && lpeitem->hasPathEffect()){ @@ -347,7 +347,7 @@ static void sp_simplify_flatten(GtkWidget * /*widget*/, GObject *obj) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(obj, "desktop")); auto selected = desktop->getSelection()->items(); - SPLPEItem* lpeitem = NULL; + SPLPEItem* lpeitem = nullptr; for (auto it(selected.begin()); it != selected.end(); ++it){ lpeitem = dynamic_cast<SPLPEItem*>(*it); if (lpeitem && lpeitem->hasPathEffect()){ @@ -497,7 +497,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb { sp_add_freehand_mode_toggle(mainActions, holder, true); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; /* min pressure */ @@ -505,10 +505,10 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb eact = create_adjustment_action( "MinPressureAction", _("Min pressure"), _("Min:"), _("Min percent of pressure"), "/tools/freehand/pencil/minpressure", 0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 100, 1, 0, - 0, 0, 0, - sp_minpressure_value_changed, NULL, 0 ,0); + nullptr, nullptr, 0, + sp_minpressure_value_changed, nullptr, 0 ,0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); g_object_set_data( holder, "minpressure", eact ); @@ -523,10 +523,10 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb eact = create_adjustment_action( "MaxPressureAction", _("Max pressure"), _("Max:"), _("Max percent of pressure"), "/tools/freehand/pencil/maxpressure", 100, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 100, 1, 0, - 0, 0, 0, - sp_maxpressure_value_changed, NULL, 0 ,0); + nullptr, nullptr, 0, + sp_maxpressure_value_changed, nullptr, 0 ,0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); g_object_set_data( holder, "maxpressure", eact ); if (prefs->getInt("/tools/freehand/pencil/freehand-mode", 0) == 3) { @@ -556,7 +556,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb } /* Tolerance */ { - gchar const* labels[] = {_("(many nodes, rough)"), _("(default)"), 0, 0, 0, 0, _("(few nodes, smooth)")}; + gchar const* labels[] = {_("(many nodes, rough)"), _("(default)"), nullptr, nullptr, nullptr, nullptr, _("(few nodes, smooth)")}; gdouble values[] = {1, 10, 20, 30, 50, 75, 100}; eact = create_adjustment_action( "PencilToleranceAction", _("Smoothing:"), _("Smoothing: "), @@ -568,7 +568,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb 1, 100.0, 0.5, 1.0, labels, values, G_N_ELEMENTS(labels), sp_pencil_tb_tolerance_value_changed, - NULL /*unit tracker*/, + nullptr /*unit tracker*/, 1, 2); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); diff --git a/src/ui/toolbar/rect-toolbar.cpp b/src/ui/toolbar/rect-toolbar.cpp index 420c3410e..f52e4dfa1 100644 --- a/src/ui/toolbar/rect-toolbar.cpp +++ b/src/ui/toolbar/rect-toolbar.cpp @@ -90,7 +90,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" )); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -114,7 +114,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * if (gtk_adjustment_get_value(adj) != 0) { (SP_RECT(*i)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); } else { - (*i)->getRepr()->setAttribute(value_name, NULL); + (*i)->getRepr()->setAttribute(value_name, nullptr); } modmade = true; } @@ -154,7 +154,7 @@ static void sp_rtb_height_value_changed(GtkAdjustment *adj, GObject *tbl) static void sp_rtb_defaults( GtkWidget * /*widget*/, GObject *obj) { - GtkAdjustment *adj = 0; + GtkAdjustment *adj = nullptr; adj = GTK_ADJUSTMENT( g_object_get_data(obj, "rx") ); gtk_adjustment_set_value(adj, 0.0); @@ -190,7 +190,7 @@ static void rect_tb_event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar con UnitTracker* tracker = reinterpret_cast<UnitTracker*>( g_object_get_data( tbl, "tracker" ) ); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); gpointer item = g_object_get_data( tbl, "item" ); if (item && SP_IS_RECT(item)) { @@ -230,11 +230,11 @@ static void rect_tb_event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar con static Inkscape::XML::NodeEventVector rect_tb_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ rect_tb_event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; /** @@ -243,11 +243,11 @@ static Inkscape::XML::NodeEventVector rect_tb_repr_events = { static void sp_rect_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl) { int n_selected = 0; - Inkscape::XML::Node *repr = NULL; - SPItem *item = NULL; + Inkscape::XML::Node *repr = nullptr; + SPItem *item = nullptr; if ( g_object_get_data( tbl, "repr" ) ) { - g_object_set_data( tbl, "item", NULL ); + g_object_set_data( tbl, "item", nullptr ); } purge_repr_listener( tbl, tbl ); @@ -300,11 +300,11 @@ static void rect_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); { - EgeOutputAction* act = ege_output_action_new( "RectStateAction", _("<b>New:</b>"), "", 0 ); + EgeOutputAction* act = ege_output_action_new( "RectStateAction", _("<b>New:</b>"), "", nullptr ); ege_output_action_set_use_markup( act, TRUE ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_object_set_data( holder, "mode_action", act ); @@ -319,7 +319,7 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* W */ { - gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500}; eact = create_adjustment_action( "RectWidthAction", _("Width"), _("W:"), _("Width of rectangle"), @@ -335,12 +335,12 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* H */ { - gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500}; eact = create_adjustment_action( "RectHeightAction", _("Height"), _("H:"), _("Height of rectangle"), "/tools/shapes/rect/height", 0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP, labels, values, G_N_ELEMENTS(labels), sp_rtb_height_value_changed, tracker); @@ -351,12 +351,12 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* rx */ { - gchar const* labels[] = {_("not rounded"), 0, 0, 0, 0, 0, 0, 0, 0}; + gchar const* labels[] = {_("not rounded"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {0.5, 1, 2, 3, 5, 10, 20, 50, 100}; eact = create_adjustment_action( "RadiusXAction", _("Horizontal radius"), _("Rx:"), _("Horizontal radius of rounded corners"), "/tools/shapes/rect/rx", 0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP, labels, values, G_N_ELEMENTS(labels), sp_rtb_rx_value_changed, tracker); @@ -365,12 +365,12 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* ry */ { - gchar const* labels[] = {_("not rounded"), 0, 0, 0, 0, 0, 0, 0, 0}; + gchar const* labels[] = {_("not rounded"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {0.5, 1, 2, 3, 5, 10, 20, 50, 100}; eact = create_adjustment_action( "RadiusYAction", _("Vertical radius"), _("Ry:"), _("Vertical radius of rounded corners"), "/tools/shapes/rect/ry", 0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP, labels, values, G_N_ELEMENTS(labels), sp_rtb_ry_value_changed, tracker); @@ -419,7 +419,7 @@ static void rect_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB } else { if (changed) { changed.disconnect(); - purge_repr_listener(NULL, holder); + purge_repr_listener(nullptr, holder); } } } diff --git a/src/ui/toolbar/select-toolbar.cpp b/src/ui/toolbar/select-toolbar.cpp index 47a9b9ed7..fcb76a185 100644 --- a/src/ui/toolbar/select-toolbar.cpp +++ b/src/ui/toolbar/select-toolbar.cpp @@ -76,7 +76,7 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) if ( bbox ) { UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker")); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); struct { char const *key; double val; } const keyval[] = { { "X", bbox->min()[X] }, @@ -182,7 +182,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, GObject *tbl) gdouble xrel = 0; gdouble yrel = 0; Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); GtkAdjustment* a_x = GTK_ADJUSTMENT( g_object_get_data( tbl, "X" ) ); GtkAdjustment* a_y = GTK_ADJUSTMENT( g_object_get_data( tbl, "Y" ) ); @@ -239,9 +239,9 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, GObject *tbl) char const * const actionkey = ( mh > 5e-4 ? "selector:toolbar:move:horizontal" : sh > 5e-4 ? "selector:toolbar:scale:horizontal" : mv > 5e-4 ? "selector:toolbar:move:vertical" : - sv > 5e-4 ? "selector:toolbar:scale:vertical" : NULL ); + sv > 5e-4 ? "selector:toolbar:scale:vertical" : nullptr ); - if (actionkey != NULL) { + if (actionkey != nullptr) { // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed desktop->getCanvas()->forceFullRedrawAfterInterruptions(0); @@ -339,7 +339,7 @@ static void destroy_tracker( GObject* obj, gpointer /*user_data*/ ) UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(obj, "tracker")); if ( tracker ) { delete tracker; - g_object_set_data( obj, "tracker", 0 ); + g_object_set_data( obj, "tracker", nullptr ); } } @@ -347,13 +347,13 @@ static void trigger_sp_action( GtkAction* /*act*/, gpointer user_data ) { SPAction* targetAction = SP_ACTION(user_data); if ( targetAction ) { - sp_action_perform( targetAction, NULL ); + sp_action_perform( targetAction, nullptr ); } } static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, GtkIconSize size ) { - GtkAction* act = 0; + GtkAction* act = nullptr; SPAction* targetAction = verb->get_action(Inkscape::ActionContext(view)); InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size ); @@ -370,7 +370,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb GtkIconSize secondarySize = Inkscape::UI::ToolboxFactory::prefToSize("/toolbox/secondary", 1); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - GtkAction* act = 0; + GtkAction* act = nullptr; GtkActionGroup* selectionActions = mainActions; // temporary std::vector<GtkAction*>* contextActions = new std::vector<GtkAction*>(); @@ -429,7 +429,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb g_object_set_data( G_OBJECT(spw), "tracker", tracker ); g_signal_connect( G_OBJECT(spw), "destroy", G_CALLBACK(destroy_tracker), spw ); - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; // four spinbuttons @@ -444,7 +444,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb G_OBJECT(spw), /* dataKludge */ TRUE, "altx", /* altx, altx_mark */ -1e6, 1e6, SPIN_STEP, SPIN_PAGE_STEP, /* lower, upper, step, page */ - 0, 0, 0, /* descrLabels, descrValues, descrCount */ + nullptr, nullptr, 0, /* descrLabels, descrValues, descrCount */ sp_object_layout_any_value_changed, /* callback */ tracker, /* unit_tracker */ SPIN_STEP, 3, 1); /* climb, digits, factor */ @@ -463,7 +463,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb G_OBJECT(spw), /* dataKludge */ TRUE, "altx", /* altx, altx_mark */ -1e6, 1e6, SPIN_STEP, SPIN_PAGE_STEP, /* lower, upper, step, page */ - 0, 0, 0, /* descrLabels, descrValues, descrCount */ + nullptr, nullptr, 0, /* descrLabels, descrValues, descrCount */ sp_object_layout_any_value_changed, /* callback */ tracker, /* unit_tracker */ SPIN_STEP, 3, 1); /* climb, digits, factor */ @@ -482,7 +482,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb G_OBJECT(spw), /* dataKludge */ TRUE, "altx", /* altx, altx_mark */ 0.0, 1e6, SPIN_STEP, SPIN_PAGE_STEP, /* lower, upper, step, page */ - 0, 0, 0, /* descrLabels, descrValues, descrCount */ + nullptr, nullptr, 0, /* descrLabels, descrValues, descrCount */ sp_object_layout_any_value_changed, /* callback */ tracker, /* unit_tracker */ SPIN_STEP, 3, 1); /* climb, digits, factor */ @@ -514,7 +514,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb G_OBJECT(spw), /* dataKludge */ TRUE, "altx", /* altx, altx_mark */ 0.0, 1e6, SPIN_STEP, SPIN_PAGE_STEP, /* lower, upper, step, page */ - 0, 0, 0, /* descrLabels, descrValues, descrCount */ + nullptr, nullptr, 0, /* descrLabels, descrValues, descrCount */ sp_object_layout_any_value_changed, /* callback */ tracker, /* unit_tracker */ SPIN_STEP, 3, 1); /* climb, digits, factor */ @@ -537,7 +537,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb g_signal_connect(G_OBJECT(spw), "change_selection", G_CALLBACK(sp_selection_layout_widget_change_selection), desktop); // Update now. - sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? SP_ACTIVE_DESKTOP->getSelection() : NULL); + sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? SP_ACTIVE_DESKTOP->getSelection() : nullptr); for ( std::vector<GtkAction*>::iterator iter = contextActions->begin(); iter != contextActions->end(); ++iter) { diff --git a/src/ui/toolbar/spiral-toolbar.cpp b/src/ui/toolbar/spiral-toolbar.cpp index c5c87755d..b551ea379 100644 --- a/src/ui/toolbar/spiral-toolbar.cpp +++ b/src/ui/toolbar/spiral-toolbar.cpp @@ -189,17 +189,17 @@ static void spiral_tb_event_attr_changed(Inkscape::XML::Node *repr, static Inkscape::XML::NodeEventVector spiral_tb_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ spiral_tb_event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; static void sp_spiral_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl) { int n_selected = 0; - Inkscape::XML::Node *repr = NULL; + Inkscape::XML::Node *repr = nullptr; purge_repr_listener( tbl, tbl ); @@ -235,11 +235,11 @@ static void sp_spiral_toolbox_selection_changed(Inkscape::Selection *selection, void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); { - EgeOutputAction* act = ege_output_action_new( "SpiralStateAction", _("<b>New:</b>"), "", 0 ); + EgeOutputAction* act = ege_output_action_new( "SpiralStateAction", _("<b>New:</b>"), "", nullptr ); ege_output_action_set_use_markup( act, TRUE ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_object_set_data( holder, "mode_action", act ); @@ -247,7 +247,7 @@ void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb /* Revolution */ { - gchar const* labels[] = {_("just a curve"), 0, _("one full revolution"), 0, 0, 0, 0, 0, 0}; + gchar const* labels[] = {_("just a curve"), nullptr, _("one full revolution"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {0.01, 0.5, 1, 2, 3, 5, 10, 20, 50, 100}; eact = create_adjustment_action( "SpiralRevolutionAction", _("Number of turns"), _("Turns:"), _("Number of revolutions"), @@ -255,18 +255,18 @@ void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-spiral", 0.01, 1024.0, 0.1, 1.0, labels, values, G_N_ELEMENTS(labels), - sp_spl_tb_revolution_value_changed, NULL /*unit tracker*/, 1, 2); + sp_spl_tb_revolution_value_changed, nullptr /*unit tracker*/, 1, 2); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } /* Expansion */ { - gchar const* labels[] = {_("circle"), _("edge is much denser"), _("edge is denser"), _("even"), _("center is denser"), _("center is much denser"), 0}; + gchar const* labels[] = {_("circle"), _("edge is much denser"), _("edge is denser"), _("even"), _("center is denser"), _("center is much denser"), nullptr}; gdouble values[] = {0, 0.1, 0.5, 1, 1.5, 5, 20}; eact = create_adjustment_action( "SpiralExpansionAction", _("Divergence"), _("Divergence:"), _("How much denser/sparser are outer revolutions; 1 = uniform"), "/tools/shapes/spiral/expansion", 1.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 1000.0, 0.01, 1.0, labels, values, G_N_ELEMENTS(labels), sp_spl_tb_expansion_value_changed); @@ -280,7 +280,7 @@ void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb eact = create_adjustment_action( "SpiralT0Action", _("Inner radius"), _("Inner radius:"), _("Radius of the innermost revolution (relative to the spiral size)"), "/tools/shapes/spiral/t0", 0.0, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0.0, 0.999, 0.01, 1.0, labels, values, G_N_ELEMENTS(labels), sp_spl_tb_t0_value_changed); diff --git a/src/ui/toolbar/spray-toolbar.cpp b/src/ui/toolbar/spray-toolbar.cpp index f44e61051..894a69a69 100644 --- a/src/ui/toolbar/spray-toolbar.cpp +++ b/src/ui/toolbar/spray-toolbar.cpp @@ -137,7 +137,7 @@ Inkscape::UI::Dialog::CloneTiler *get_clone_tiler_panel(SPDesktop *desktop) } catch (std::exception &e) { } } - return 0; + return nullptr; } static void sp_spray_width_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ ) @@ -290,7 +290,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj Inkscape::Preferences *prefs = Inkscape::Preferences::get(); { /* Width */ - gchar const* labels[] = {_("(narrow spray)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad spray)")}; + gchar const* labels[] = {_("(narrow spray)"), nullptr, nullptr, nullptr, _("(default)"), nullptr, nullptr, nullptr, nullptr, _("(broad spray)")}; gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayWidthAction", _("Width"), _("Width:"), _("The width of the spray area (relative to the visible canvas area)"), @@ -298,7 +298,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, true, "altx-spray", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_spray_width_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_spray_width_value_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), true ); @@ -319,7 +319,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj { /* Mean */ - gchar const* labels[] = {_("(default)"), 0, 0, 0, 0, 0, 0, _("(maximum mean)")}; + gchar const* labels[] = {_("(default)"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, _("(maximum mean)")}; gdouble values[] = {0, 5, 10, 20, 30, 50, 70, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayMeanAction", _("Focus"), _("Focus:"), _("0 to spray a spot; increase to enlarge the ring radius"), @@ -327,7 +327,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, true, "spray-mean", 0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_spray_mean_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_spray_mean_value_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), true ); @@ -335,7 +335,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj { /* Standard_deviation */ - gchar const* labels[] = {_("(minimum scatter)"), 0, 0, 0, 0, 0, _("(default)"), _("(maximum scatter)")}; + gchar const* labels[] = {_("(minimum scatter)"), nullptr, nullptr, nullptr, nullptr, nullptr, _("(default)"), _("(maximum scatter)")}; gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayStandard_deviationAction", C_("Spray tool", "Scatter"), C_("Spray tool", "Scatter:"), _("Increase to scatter sprayed objects"), @@ -343,7 +343,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, true, "spray-standard_deviation", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_spray_standard_deviation_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_spray_standard_deviation_value_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), true ); @@ -402,7 +402,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj } { /* Population */ - gchar const* labels[] = {_("(low population)"), 0, 0, 0, _("(default)"), 0, _("(high population)")}; + gchar const* labels[] = {_("(low population)"), nullptr, nullptr, nullptr, _("(default)"), nullptr, _("(high population)")}; gdouble values[] = {5, 20, 35, 50, 70, 85, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayPopulationAction", _("Amount"), _("Amount:"), @@ -411,7 +411,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, true, "spray-population", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_spray_population_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_spray_population_value_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), true ); @@ -432,7 +432,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj } { /* Rotation */ - gchar const* labels[] = {_("(default)"), 0, 0, 0, 0, 0, 0, _("(high rotation variation)")}; + gchar const* labels[] = {_("(default)"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, _("(high rotation variation)")}; gdouble values[] = {0, 10, 25, 35, 50, 60, 80, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayRotationAction", _("Rotation"), _("Rotation:"), @@ -442,7 +442,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, true, "spray-rotation", 0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_spray_rotation_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_spray_rotation_value_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), true ); @@ -450,7 +450,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj } { /* Scale */ - gchar const* labels[] = {_("(default)"), 0, 0, 0, 0, 0, 0, _("(high scale variation)")}; + gchar const* labels[] = {_("(default)"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, _("(high scale variation)")}; gdouble values[] = {0, 10, 25, 35, 50, 60, 80, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayScaleAction", C_("Spray tool", "Scale"), C_("Spray tool", "Scale:"), @@ -460,7 +460,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, true, "spray-scale", 0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_spray_scale_value_changed, NULL /*unit tracker*/, 1, 0 ); + sp_spray_scale_value_changed, nullptr /*unit tracker*/, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), true ); @@ -599,16 +599,16 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj /* Offset */ { - gchar const* labels[] = {_("(minimum offset)"), 0, 0, 0, _("(default)"), 0, 0, _("(maximum offset)")}; + gchar const* labels[] = {_("(minimum offset)"), nullptr, nullptr, nullptr, _("(default)"), nullptr, nullptr, _("(maximum offset)")}; gdouble values[] = {0, 25, 50, 75, 100, 150, 200, 1000}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayToolOffsetAction", _("Offset %"), _("Offset %:"), _("Increase to segregate objects more (value in percent)"), "/tools/spray/offset", 100, - GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, nullptr, 0, 1000, 1, 4, labels, values, G_N_ELEMENTS(labels), - sp_spray_offset_value_changed, NULL, 0 , 0); + sp_spray_offset_value_changed, nullptr, 0 , 0); g_object_set_data( holder, "offset", eact ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } diff --git a/src/ui/toolbar/star-toolbar.cpp b/src/ui/toolbar/star-toolbar.cpp index 1c5745273..6cd225c78 100644 --- a/src/ui/toolbar/star-toolbar.cpp +++ b/src/ui/toolbar/star-toolbar.cpp @@ -300,7 +300,7 @@ static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *n // in turn, prevent callbacks from responding g_object_set_data(dataKludge, "freeze", GINT_TO_POINTER(TRUE)); - GtkAdjustment *adj = 0; + GtkAdjustment *adj = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool isFlatSided = prefs->getBool("/tools/shapes/star/isflatsided", true); @@ -361,11 +361,11 @@ static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *n static Inkscape::XML::NodeEventVector star_tb_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ star_tb_event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; @@ -376,7 +376,7 @@ static void sp_star_toolbox_selection_changed(Inkscape::Selection *selection, GObject *dataKludge) { int n_selected = 0; - Inkscape::XML::Node *repr = NULL; + Inkscape::XML::Node *repr = nullptr; purge_repr_listener( dataKludge, dataKludge ); @@ -415,7 +415,7 @@ static void sp_star_defaults( GtkWidget * /*widget*/, GObject *dataKludge ) // FIXME: in this and all other _default functions, set some flag telling the value_changed // callbacks to lump all the changes for all selected objects in one undo step - GtkAdjustment *adj = 0; + GtkAdjustment *adj = nullptr; // fixme: make settable in prefs! gint mag = 5; @@ -469,10 +469,10 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool isFlatSided = prefs->getBool("/tools/shapes/star/isflatsided", true); - EgeAdjustmentAction* eact = 0; + EgeAdjustmentAction* eact = nullptr; { - EgeOutputAction* act = ege_output_action_new( "StarStateAction", _("<b>New:</b>"), "", 0 ); + EgeOutputAction* act = ege_output_action_new( "StarStateAction", _("<b>New:</b>"), "", nullptr ); ege_output_action_set_use_markup( act, TRUE ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_object_set_data( dataKludge, "mode_action", act ); @@ -516,15 +516,15 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Magnitude */ { - gchar const* labels[] = {_("triangle/tri-star"), _("square/quad-star"), _("pentagon/five-pointed star"), _("hexagon/six-pointed star"), 0, 0, 0, 0, 0}; + gchar const* labels[] = {_("triangle/tri-star"), _("square/quad-star"), _("pentagon/five-pointed star"), _("hexagon/six-pointed star"), nullptr, nullptr, nullptr, nullptr, nullptr}; gdouble values[] = {3, 4, 5, 6, 7, 8, 10, 12, 20}; eact = create_adjustment_action( "MagnitudeAction", _("Corners"), _("Corners:"), _("Number of corners of a polygon or star"), "/tools/shapes/star/magnitude", 3, - GTK_WIDGET(desktop->canvas), dataKludge, FALSE, NULL, + GTK_WIDGET(desktop->canvas), dataKludge, FALSE, nullptr, 3, 1024, 1, 5, labels, values, G_N_ELEMENTS(labels), - sp_star_magnitude_value_changed, NULL /*unit tracker*/, + sp_star_magnitude_value_changed, nullptr /*unit tracker*/, 1.0, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -532,7 +532,7 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Spoke ratio */ { - gchar const* labels[] = {_("thin-ray star"), 0, _("pentagram"), _("hexagram"), _("heptagram"), _("octagram"), _("regular polygon")}; + gchar const* labels[] = {_("thin-ray star"), nullptr, _("pentagram"), _("hexagram"), _("heptagram"), _("octagram"), _("regular polygon")}; gdouble values[] = {0.01, 0.2, 0.382, 0.577, 0.692, 0.765, 1}; eact = create_adjustment_action( "SpokeAction", _("Spoke ratio"), _("Spoke ratio:"), @@ -540,7 +540,7 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje // Base radius is the same for the closest handle. _("Base radius to tip radius ratio"), "/tools/shapes/star/proportion", 0.5, - GTK_WIDGET(desktop->canvas), dataKludge, FALSE, NULL, + GTK_WIDGET(desktop->canvas), dataKludge, FALSE, nullptr, 0.01, 1.0, 0.01, 0.1, labels, values, G_N_ELEMENTS(labels), sp_star_proportion_value_changed ); @@ -557,12 +557,12 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Roundedness */ { gchar const* labels[] = {_("stretched"), _("twisted"), _("slightly pinched"), _("NOT rounded"), _("slightly rounded"), - _("visibly rounded"), _("well rounded"), _("amply rounded"), 0, _("stretched"), _("blown up")}; + _("visibly rounded"), _("well rounded"), _("amply rounded"), nullptr, _("stretched"), _("blown up")}; gdouble values[] = {-1, -0.2, -0.03, 0, 0.05, 0.1, 0.2, 0.3, 0.5, 1, 10}; eact = create_adjustment_action( "RoundednessAction", _("Rounded"), _("Rounded:"), _("How much rounded are the corners (0 for sharp)"), "/tools/shapes/star/rounded", 0.0, - GTK_WIDGET(desktop->canvas), dataKludge, FALSE, NULL, + GTK_WIDGET(desktop->canvas), dataKludge, FALSE, nullptr, -10.0, 10.0, 0.01, 0.1, labels, values, G_N_ELEMENTS(labels), sp_star_rounded_value_changed ); @@ -577,10 +577,10 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje eact = create_adjustment_action( "RandomizationAction", _("Randomized"), _("Randomized:"), _("Scatter randomly the corners and angles"), "/tools/shapes/star/randomized", 0.0, - GTK_WIDGET(desktop->canvas), dataKludge, FALSE, NULL, + GTK_WIDGET(desktop->canvas), dataKludge, FALSE, nullptr, -10.0, 10.0, 0.001, 0.01, labels, values, G_N_ELEMENTS(labels), - sp_star_randomized_value_changed, NULL /*unit tracker*/, 0.1, 3 ); + sp_star_randomized_value_changed, nullptr /*unit tracker*/, 0.1, 3 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); } @@ -605,7 +605,7 @@ static void star_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB { static sigc::connection changed; - if (dynamic_cast<Inkscape::UI::Tools::StarTool const*>(ec) != NULL) { + if (dynamic_cast<Inkscape::UI::Tools::StarTool const*>(ec) != nullptr) { changed = desktop->getSelection()->connectChanged(sigc::bind(sigc::ptr_fun(sp_star_toolbox_selection_changed), dataKludge)); sp_star_toolbox_selection_changed(desktop->getSelection(), dataKludge); } else { diff --git a/src/ui/toolbar/text-toolbar.cpp b/src/ui/toolbar/text-toolbar.cpp index 4f532fa3d..a521c165d 100644 --- a/src/ui/toolbar/text-toolbar.cpp +++ b/src/ui/toolbar/text-toolbar.cpp @@ -341,7 +341,7 @@ static void sp_text_outer_style_changed( InkToggleAction*act, GObject *tbl ) prefs->setInt("/tools/text/outer_style", outer); // Update widgets to reflect new state of Text Outer Style button. - sp_text_toolbox_selection_changed( NULL, tbl ); + sp_text_toolbox_selection_changed( nullptr, tbl ); } // Unset line height on selection's inner text objects (tspan, etc.). @@ -663,7 +663,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) // Get user selected unit and save as preference UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(tbl, "tracker")); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -746,7 +746,7 @@ static void sp_text_lineheight_unit_changed( GObject *tbl, int /* Not Used */ ) // Get user selected unit and save as preference UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(tbl, "tracker")); Unit const *unit = tracker->getActiveUnit(); - g_return_if_fail(unit != NULL); + g_return_if_fail(unit != nullptr); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // This nonsense is to get SP_CSS_UNIT_xx value corresponding to unit. @@ -1476,7 +1476,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ fontlister->selection_update(); // Update font list, but only if widget already created. - if( fontFamilyAction->combobox != NULL ) { + if( fontFamilyAction->combobox != nullptr ) { ink_comboboxentry_action_set_active_text( fontFamilyAction, fontlister->get_font_family().c_str(), fontlister->get_font_family_row() ); ink_comboboxentry_action_set_active_text( fontStyleAction, fontlister->get_font_style().c_str() ); } @@ -1553,7 +1553,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // To ensure the value of the combobox is properly set on start-up, only mark // the prefs set if the combobox has already been constructed. - if( fontFamilyAction->combobox != NULL ) { + if( fontFamilyAction->combobox != nullptr ) { g_object_set_data(tbl, "text_style_from_prefs", GINT_TO_POINTER(TRUE)); } } else { @@ -1928,7 +1928,7 @@ static void sp_text_toolbox_selection_modified(Inkscape::Selection *selection, g static void sp_text_toolbox_subselection_changed (gpointer /*tc*/, GObject *tbl) { - sp_text_toolbox_selection_changed (NULL, tbl, true); + sp_text_toolbox_selection_changed (nullptr, tbl, true); } // TODO: possibly share with font-selector by moving most code to font-lister (passing family name) @@ -1994,7 +1994,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje ink_comboboxentry_action_new( "TextFontFamilyAction", _("Font Family"), _("Select Font Family (Alt-X to access)"), - NULL, + nullptr, GTK_TREE_MODEL(model), -1, // Entry width 50, // Extra list width @@ -2023,7 +2023,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje "#TextFontFamilyAction_combobox {\n" " -GtkComboBox-appears-as-list: true;\n" "}\n", - -1, NULL); + -1, nullptr); auto screen = gdk_screen_get_default(); gtk_style_context_add_provider_for_screen(screen, @@ -2045,12 +2045,12 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje Ink_ComboBoxEntry_Action* act = ink_comboboxentry_action_new( "TextFontSizeAction", _("Font Size"), _(tooltip.c_str()), - NULL, + nullptr, GTK_TREE_MODEL(model_size), 8, // Width in characters 0, // Extra list width - NULL, // Cell layout - NULL, // Separator + nullptr, // Cell layout + nullptr, // Separator GTK_WIDGET(desktop->canvas)); // Focus widget g_signal_connect( G_OBJECT(act), "changed", G_CALLBACK(sp_text_fontsize_value_changed), holder ); @@ -2067,12 +2067,12 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje Ink_ComboBoxEntry_Action* act = ink_comboboxentry_action_new( "TextFontStyleAction", _("Font Style"), _("Font style"), - NULL, + nullptr, GTK_TREE_MODEL(model_style), 12, // Width in characters 0, // Extra list width - NULL, // Cell layout - NULL, // Separator + nullptr, // Cell layout + nullptr, // Separator GTK_WIDGET(desktop->canvas)); // Focus widget g_signal_connect( G_OBJECT(act), "changed", G_CALLBACK(sp_text_fontstyle_value_changed), holder ); @@ -2291,7 +2291,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Line height */ { // Drop down menu - gchar const* labels[] = {_("Smaller spacing"), 0, 0, 0, 0, C_("Text tool", "Normal"), 0, 0, 0, 0, 0, _("Larger spacing")}; + gchar const* labels[] = {_("Smaller spacing"), nullptr, nullptr, nullptr, nullptr, C_("Text tool", "Normal"), nullptr, nullptr, nullptr, nullptr, nullptr, _("Larger spacing")}; gdouble values[] = { 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1,2, 1.3, 1.4, 1.5, 2.0}; EgeAdjustmentAction *eact = create_adjustment_action( @@ -2304,11 +2304,11 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GTK_WIDGET(desktop->canvas), /* focusTarget */ holder, /* dataKludge */ FALSE, /* set alt-x keyboard shortcut? */ - NULL, /* altx_mark */ + nullptr, /* altx_mark */ 0.0, 1000.0, 0.1, 1.0, /* lower, upper, step (arrow up/down), page up/down */ labels, values, G_N_ELEMENTS(labels), /* drop down menu */ sp_text_lineheight_value_changed, /* callback */ - NULL, // tracker, /* unit tracker */ + nullptr, // tracker, /* unit tracker */ 0.1, /* step (used?) */ 2, /* digits to show */ 1.0 /* factor (multiplies default) */ @@ -2379,7 +2379,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Word spacing */ { // Drop down menu - gchar const* labels[] = {_("Negative spacing"), 0, 0, 0, C_("Text tool", "Normal"), 0, 0, 0, 0, 0, 0, 0, _("Positive spacing")}; + gchar const* labels[] = {_("Negative spacing"), nullptr, nullptr, nullptr, C_("Text tool", "Normal"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, _("Positive spacing")}; gdouble values[] = {-2.0, -1.5, -1.0, -0.5, 0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0}; EgeAdjustmentAction *eact = create_adjustment_action( @@ -2392,11 +2392,11 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GTK_WIDGET(desktop->canvas), /* focusTarget */ holder, /* dataKludge */ FALSE, /* set alt-x keyboard shortcut? */ - NULL, /* altx_mark */ + nullptr, /* altx_mark */ -100.0, 100.0, 0.01, 0.10, /* lower, upper, step (arrow up/down), page up/down */ labels, values, G_N_ELEMENTS(labels), /* drop down menu */ sp_text_wordspacing_value_changed, /* callback */ - NULL, /* unit tracker */ + nullptr, /* unit tracker */ 0.1, /* step (used?) */ 2, /* digits to show */ 1.0 /* factor (multiplies default) */ @@ -2410,7 +2410,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Letter spacing */ { // Drop down menu - gchar const* labels[] = {_("Negative spacing"), 0, 0, 0, C_("Text tool", "Normal"), 0, 0, 0, 0, 0, 0, 0, _("Positive spacing")}; + gchar const* labels[] = {_("Negative spacing"), nullptr, nullptr, nullptr, C_("Text tool", "Normal"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, _("Positive spacing")}; gdouble values[] = {-2.0, -1.5, -1.0, -0.5, 0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0}; EgeAdjustmentAction *eact = create_adjustment_action( @@ -2423,11 +2423,11 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GTK_WIDGET(desktop->canvas), /* focusTarget */ holder, /* dataKludge */ FALSE, /* set alt-x keyboard shortcut? */ - NULL, /* altx_mark */ + nullptr, /* altx_mark */ -100.0, 100.0, 0.01, 0.10, /* lower, upper, step (arrow up/down), page up/down */ labels, values, G_N_ELEMENTS(labels), /* drop down menu */ sp_text_letterspacing_value_changed, /* callback */ - NULL, /* unit tracker */ + nullptr, /* unit tracker */ 0.1, /* step (used?) */ 2, /* digits to show */ 1.0 /* factor (multiplies default) */ @@ -2441,7 +2441,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Character kerning (horizontal shift) */ { // Drop down menu - gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + gchar const* labels[] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; gdouble values[] = { -2.0, -1.5, -1.0, -0.5, 0, 0.5, 1.0, 1.5, 2.0, 2.5 }; EgeAdjustmentAction *eact = create_adjustment_action( @@ -2454,11 +2454,11 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GTK_WIDGET(desktop->canvas), /* focusTarget */ holder, /* dataKludge */ FALSE, /* set alt-x keyboard shortcut? */ - NULL, /* altx_mark */ + nullptr, /* altx_mark */ -100.0, 100.0, 0.01, 0.1, /* lower, upper, step (arrow up/down), page up/down */ labels, values, G_N_ELEMENTS(labels), /* drop down menu */ sp_text_dx_value_changed, /* callback */ - NULL, /* unit tracker */ + nullptr, /* unit tracker */ 0.1, /* step (used?) */ 2, /* digits to show */ 1.0 /* factor (multiplies default) */ @@ -2472,7 +2472,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Character vertical shift */ { // Drop down menu - gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + gchar const* labels[] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; gdouble values[] = { -2.0, -1.5, -1.0, -0.5, 0, 0.5, 1.0, 1.5, 2.0, 2.5 }; EgeAdjustmentAction *eact = create_adjustment_action( @@ -2485,11 +2485,11 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GTK_WIDGET(desktop->canvas), /* focusTarget */ holder, /* dataKludge */ FALSE, /* set alt-x keyboard shortcut? */ - NULL, /* altx_mark */ + nullptr, /* altx_mark */ -100.0, 100.0, 0.01, 0.1, /* lower, upper, step (arrow up/down), page up/down */ labels, values, G_N_ELEMENTS(labels), /* drop down menu */ sp_text_dy_value_changed, /* callback */ - NULL, /* unit tracker */ + nullptr, /* unit tracker */ 0.1, /* step (used?) */ 2, /* digits to show */ 1.0 /* factor (multiplies default) */ @@ -2503,7 +2503,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje /* Character rotation */ { // Drop down menu - gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + gchar const* labels[] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; gdouble values[] = { -90, -45, -30, -15, 0, 15, 30, 45, 90, 180 }; EgeAdjustmentAction *eact = create_adjustment_action( @@ -2516,11 +2516,11 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GTK_WIDGET(desktop->canvas), /* focusTarget */ holder, /* dataKludge */ FALSE, /* set alt-x keyboard shortcut? */ - NULL, /* altx_mark */ + nullptr, /* altx_mark */ -180.0, 180.0, 0.1, 1.0, /* lower, upper, step (arrow up/down), page up/down */ labels, values, G_N_ELEMENTS(labels), /* drop down menu */ sp_text_rotation_value_changed, /* callback */ - NULL, /* unit tracker */ + nullptr, /* unit tracker */ 0.1, /* step (used?) */ 2, /* digits to show */ 1.0 /* factor (multiplies default) */ diff --git a/src/ui/toolbar/tweak-toolbar.cpp b/src/ui/toolbar/tweak-toolbar.cpp index 173e99479..be6dda4e5 100644 --- a/src/ui/toolbar/tweak-toolbar.cpp +++ b/src/ui/toolbar/tweak-toolbar.cpp @@ -126,7 +126,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj { /* Width */ - gchar const* labels[] = {_("(pinch tweak)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad tweak)")}; + gchar const* labels[] = {_("(pinch tweak)"), nullptr, nullptr, nullptr, _("(default)"), nullptr, nullptr, nullptr, nullptr, _("(broad tweak)")}; gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "TweakWidthAction", _("Width"), _("Width:"), _("The width of the tweak area (relative to the visible canvas area)"), @@ -134,7 +134,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-tweak", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_tweak_width_value_changed, NULL /*unit tracker*/, 0.01, 0, 100 ); + sp_tweak_width_value_changed, nullptr /*unit tracker*/, 0.01, 0, 100 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -143,7 +143,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj { /* Force */ - gchar const* labels[] = {_("(minimum force)"), 0, 0, _("(default)"), 0, 0, 0, _("(maximum force)")}; + gchar const* labels[] = {_("(minimum force)"), nullptr, nullptr, _("(default)"), nullptr, nullptr, nullptr, _("(maximum force)")}; gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "TweakForceAction", _("Force"), _("Force:"), _("The force of the tweak action"), @@ -151,7 +151,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, TRUE, "tweak-force", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_tweak_force_value_changed, NULL /*unit tracker*/, 0.01, 0, 100 ); + sp_tweak_force_value_changed, nullptr /*unit tracker*/, 0.01, 0, 100 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -266,7 +266,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj guint mode = prefs->getInt("/tools/tweak/mode", 0); { - EgeOutputAction* act = ege_output_action_new( "TweakChannelsLabel", _("Channels:"), "", 0 ); + EgeOutputAction* act = ege_output_action_new( "TweakChannelsLabel", _("Channels:"), "", nullptr ); ege_output_action_set_use_markup( act, TRUE ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); if (mode != Inkscape::UI::Tools::TWEAK_MODE_COLORPAINT && mode != Inkscape::UI::Tools::TWEAK_MODE_COLORJITTER) { @@ -279,7 +279,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj InkToggleAction* act = ink_toggle_action_new( "TweakDoH", _("Hue"), _("In color mode, act on objects' hue"), - NULL, + nullptr, GTK_ICON_SIZE_MENU ); //TRANSLATORS: "H" here stands for hue g_object_set( act, "short_label", C_("Hue", "H"), NULL ); @@ -295,7 +295,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj InkToggleAction* act = ink_toggle_action_new( "TweakDoS", _("Saturation"), _("In color mode, act on objects' saturation"), - NULL, + nullptr, GTK_ICON_SIZE_MENU ); //TRANSLATORS: "S" here stands for Saturation g_object_set( act, "short_label", C_("Saturation", "S"), NULL ); @@ -311,7 +311,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj InkToggleAction* act = ink_toggle_action_new( "TweakDoL", _("Lightness"), _("In color mode, act on objects' lightness"), - NULL, + nullptr, GTK_ICON_SIZE_MENU ); //TRANSLATORS: "L" here stands for Lightness g_object_set( act, "short_label", C_("Lightness", "L"), NULL ); @@ -327,7 +327,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj InkToggleAction* act = ink_toggle_action_new( "TweakDoO", _("Opacity"), _("In color mode, act on objects' opacity"), - NULL, + nullptr, GTK_ICON_SIZE_MENU ); //TRANSLATORS: "O" here stands for Opacity g_object_set( act, "short_label", C_("Opacity", "O"), NULL ); @@ -341,7 +341,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj } { /* Fidelity */ - gchar const* labels[] = {_("(rough, simplified)"), 0, 0, _("(default)"), 0, 0, _("(fine, but many nodes)")}; + gchar const* labels[] = {_("(rough, simplified)"), nullptr, nullptr, _("(default)"), nullptr, nullptr, _("(fine, but many nodes)")}; gdouble values[] = {10, 25, 35, 50, 60, 80, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "TweakFidelityAction", _("Fidelity"), _("Fidelity:"), @@ -350,7 +350,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj GTK_WIDGET(desktop->canvas), holder, TRUE, "tweak-fidelity", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_tweak_fidelity_value_changed, NULL /*unit tracker*/, 0.01, 0, 100 ); + sp_tweak_fidelity_value_changed, nullptr /*unit tracker*/, 0.01, 0, 100 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_visible( GTK_ACTION(eact), TRUE ); if (mode == Inkscape::UI::Tools::TWEAK_MODE_COLORPAINT || mode == Inkscape::UI::Tools::TWEAK_MODE_COLORJITTER) { diff --git a/src/ui/tools-switch.cpp b/src/ui/tools-switch.cpp index 5953887ce..d89844686 100644 --- a/src/ui/tools-switch.cpp +++ b/src/ui/tools-switch.cpp @@ -60,7 +60,7 @@ using Inkscape::UI::Tools::ToolBase; static char const *const tool_names[] = { - NULL, + nullptr, "/tools/select", "/tools/nodes", "/tools/tweak", @@ -85,12 +85,12 @@ static char const *const tool_names[] = { #endif "/tools/eraser", "/tools/lpetool", - NULL + nullptr }; // TODO: HEY! these belong to the tools themselves! static char const *const tool_msg[] = { - NULL, + nullptr, N_("<b>Click</b> to Select and Transform objects, <b>Drag</b> to select many objects."), N_("Modify selected path points (nodes) directly."), N_("To tweak a path by pushing, select it and drag over it."), diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index 34b29f3bb..e0378ff03 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -64,7 +64,7 @@ const std::string ArcTool::prefsPath = "/tools/shapes/arc"; ArcTool::ArcTool() : ToolBase(cursor_ellipse_xpm) - , arc(NULL) + , arc(nullptr) { } @@ -82,7 +82,7 @@ ArcTool::~ArcTool() { this->sel_changed_connection.disconnect(); delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; /* fixme: This is necessary because we do not grab */ if (this->arc) { @@ -166,7 +166,7 @@ bool ArcTool::root_handler(GdkEvent* event) { sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, - NULL, event->button.time); + nullptr, event->button.time); handled = true; m.unSetup(); } @@ -224,7 +224,7 @@ bool ArcTool::root_handler(GdkEvent* event) { this->xp = 0; this->yp = 0; - this->item_to_select = NULL; + this->item_to_select = nullptr; handled = true; } sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); @@ -244,7 +244,7 @@ bool ArcTool::root_handler(GdkEvent* event) { sp_event_show_modifier_tip(this->defaultMessageContext(), event, _("<b>Ctrl</b>: make circle or integer-ratio ellipse, snap arc/segment angle"), _("<b>Shift</b>: draw around the starting point"), - NULL); + nullptr); } break; @@ -412,14 +412,14 @@ void ArcTool::drag(Geom::Point pt, guint state) { void ArcTool::finishItem() { this->message_context->clear(); - if (this->arc != NULL) { + if (this->arc != nullptr) { if (this->arc->rx.computed == 0 || this->arc->ry.computed == 0) { this->cancel(); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point return; } this->arc->updateRepr(); - this->arc->doWriteTransform(this->arc->transform, NULL, true); + this->arc->doWriteTransform(this->arc->transform, nullptr, true); desktop->canvas->endForcedFullRedraws(); @@ -427,7 +427,7 @@ void ArcTool::finishItem() { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ARC, _("Create ellipse")); - this->arc = NULL; + this->arc = nullptr; } } @@ -435,15 +435,15 @@ void ArcTool::cancel() { desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0); - if (this->arc != NULL) { + if (this->arc != nullptr) { this->arc->deleteObject(); - this->arc = NULL; + this->arc = nullptr; } this->within_tolerance = false; this->xp = 0; this->yp = 0; - this->item_to_select = NULL; + this->item_to_select = nullptr; desktop->canvas->endForcedFullRedraws(); diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 52c66fb2b..f643fc356 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -61,8 +61,8 @@ const std::string Box3dTool::prefsPath = "/tools/shapes/3dbox"; Box3dTool::Box3dTool() : ToolBase(cursor_3dbox_xpm) - , _vpdrag(NULL) - , box3d(NULL) + , _vpdrag(nullptr) + , box3d(nullptr) , ctrl_dragged(false) , extruded(false) { @@ -81,12 +81,12 @@ Box3dTool::~Box3dTool() { this->enableGrDrag(false); delete (this->_vpdrag); - this->_vpdrag = NULL; + this->_vpdrag = nullptr; this->sel_changed_connection.disconnect(); delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; /* fixme: This is necessary because we do not grab */ if (this->box3d) { @@ -236,7 +236,7 @@ bool Box3dTool::root_handler(GdkEvent* event) { GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK ), - NULL, event->button.time); + nullptr, event->button.time); ret = TRUE; } break; @@ -333,7 +333,7 @@ bool Box3dTool::root_handler(GdkEvent* event) { selection->clear(); } - this->item_to_select = NULL; + this->item_to_select = nullptr; ret = TRUE; sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); @@ -575,7 +575,7 @@ void Box3dTool::finishItem() { this->ctrl_dragged = false; this->extruded = false; - if (this->box3d != NULL) { + if (this->box3d != nullptr) { SPDocument *doc = this->desktop->getDocument(); if (!doc || !doc->getCurrentPersp3D()) { @@ -595,7 +595,7 @@ void Box3dTool::finishItem() { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Create 3D box")); - this->box3d = NULL; + this->box3d = nullptr; } } diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index c080571d0..5cd2514ba 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -96,12 +96,12 @@ CalligraphicTool::CalligraphicTool() , keep_selected(true) , hatch_spacing(0) , hatch_spacing_step(0) - , hatch_item(NULL) - , hatch_livarot_path(NULL) + , hatch_item(nullptr) + , hatch_livarot_path(nullptr) , hatch_last_nearest(Geom::Point(0,0)) , hatch_last_pointer(Geom::Point(0,0)) , hatch_escaped(false) - , hatch_area(NULL) + , hatch_area(nullptr) , just_started_drawing(false) , trace_bg(false) { @@ -114,7 +114,7 @@ CalligraphicTool::CalligraphicTool() CalligraphicTool::~CalligraphicTool() { if (this->hatch_area) { sp_canvas_item_destroy(this->hatch_area); - this->hatch_area = NULL; + this->hatch_area = nullptr; } } @@ -127,7 +127,7 @@ void CalligraphicTool::setup() { this->cal1 = new SPCurve(); this->cal2 = new SPCurve(); - this->currentshape = sp_canvas_item_new(this->desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); + this->currentshape = sp_canvas_item_new(this->desktop->getSketch(), SP_TYPE_CANVAS_BPATH, nullptr); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->currentshape), DDC_RED_RGBA, SP_WIND_RULE_EVENODD); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->currentshape), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); @@ -434,7 +434,7 @@ void CalligraphicTool::cancel() { this->clear_current(); if (this->repr) { - this->repr = NULL; + this->repr = nullptr; } } @@ -451,7 +451,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) { this->accumulated->reset(); if (this->repr) { - this->repr = NULL; + this->repr = nullptr; } /* initialize first point */ @@ -462,7 +462,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) { GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK ), - NULL, + nullptr, event->button.time); ret = TRUE; @@ -750,7 +750,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) { this->clear_current(); if (this->repr) { - this->repr = NULL; + this->repr = nullptr; } if (!this->hatch_pointer_past.empty()) this->hatch_pointer_past.clear(); @@ -760,8 +760,8 @@ bool CalligraphicTool::root_handler(GdkEvent* event) { this->hatch_last_nearest = Geom::Point(0,0); this->hatch_last_pointer = Geom::Point(0,0); this->hatch_escaped = false; - this->hatch_item = NULL; - this->hatch_livarot_path = NULL; + this->hatch_item = nullptr; + this->hatch_livarot_path = nullptr; this->just_started_drawing = false; if (this->hatch_spacing != 0 && !this->keep_selected) { @@ -891,7 +891,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) { void CalligraphicTool::clear_current() { /* reset bpath */ - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), nullptr); /* reset curve */ this->currentcurve->reset(); this->cal1->reset(); @@ -920,7 +920,7 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) { Geom::PathVector pathv = this->accumulated->get_pathvector() * desktop->dt2doc(); gchar *str = sp_svg_write_path(pathv); - g_assert( str != NULL ); + g_assert( str != nullptr ); this->repr->setAttribute("d", str); g_free(str); @@ -942,19 +942,19 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) { // Either there was no boolean op or it failed. SPItem *result = SP_ITEM(desktop->doc()->getObjectByRepr(this->repr)); - if (result == NULL) { + if (result == nullptr) { // The boolean operation succeeded. // Now we fetch the single item, that has been set as selected by the boolean op. // This is its result. result = desktop->getSelection()->singleItem(); } - result->doWriteTransform(result->transform, NULL, true); + result->doWriteTransform(result->transform, nullptr, true); } else { if (this->repr) { sp_repr_unparent(this->repr); } - this->repr = NULL; + this->repr = nullptr; } DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_CALLIGRAPHIC, @@ -1128,7 +1128,7 @@ void CalligraphicTool::fit_and_split(bool release) { SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, - NULL); + nullptr); SPCurve *curve = this->currentcurve->copy(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve, true); curve->unref(); diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index c1175f592..7481e8470 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -128,19 +128,19 @@ static bool cc_item_is_shape(SPItem *item); static bool connector_within_tolerance = false;*/ static Inkscape::XML::NodeEventVector shape_repr_events = { - NULL, /* child_added */ - NULL, /* child_added */ + nullptr, /* child_added */ + nullptr, /* child_added */ shape_event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; static Inkscape::XML::NodeEventVector layer_repr_events = { - NULL, /* child_added */ + nullptr, /* child_added */ shape_event_attr_deleted, - NULL, /* child_added */ - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* child_added */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; std::string const& ConnectorTool::getPrefsPath() @@ -152,35 +152,35 @@ std::string const ConnectorTool::prefsPath = "/tools/connector"; ConnectorTool::ConnectorTool() : ToolBase(cursor_connector_xpm) - , selection(NULL) + , selection(nullptr) , npoints(0) , state(SP_CONNECTOR_CONTEXT_IDLE) - , red_bpath(NULL) - , red_curve(NULL) + , red_bpath(nullptr) + , red_curve(nullptr) , red_color(0xff00007f) - , green_curve(NULL) - , newconn(NULL) - , newConnRef(NULL) + , green_curve(nullptr) + , newconn(nullptr) + , newConnRef(nullptr) , curvature(0.0) , isOrthogonal(false) - , active_shape(NULL) - , active_shape_repr(NULL) - , active_shape_layer_repr(NULL) - , active_conn(NULL) - , active_conn_repr(NULL) - , active_handle(NULL) - , selected_handle(NULL) - , clickeditem(NULL) - , clickedhandle(NULL) - , shref(NULL) - , ehref(NULL) - , c0(NULL) - , c1(NULL) - , cl0(NULL) - , cl1(NULL) + , active_shape(nullptr) + , active_shape_repr(nullptr) + , active_shape_layer_repr(nullptr) + , active_conn(nullptr) + , active_conn_repr(nullptr) + , active_handle(nullptr) + , selected_handle(nullptr) + , clickeditem(nullptr) + , clickedhandle(nullptr) + , shref(nullptr) + , ehref(nullptr) + , c0(nullptr) + , c1(nullptr) + , cl0(nullptr) + , cl1(nullptr) { for (int i = 0; i < 2; ++i) { - this->endpt_handle[i] = NULL; + this->endpt_handle[i] = nullptr; this->endpt_handler_id[i] = 0; } } @@ -193,21 +193,21 @@ ConnectorTool::~ConnectorTool() if (this->endpt_handle[1]) { //g_object_unref(this->endpt_handle[i]); knot_unref(this->endpt_handle[i]); - this->endpt_handle[i] = NULL; + this->endpt_handle[i] = nullptr; } } if (this->shref) { g_free(this->shref); - this->shref = NULL; + this->shref = nullptr; } if (this->ehref) { g_free(this->shref); - this->shref = NULL; + this->shref = nullptr; } - g_assert( this->newConnRef == NULL ); + g_assert( this->newConnRef == nullptr ); } void ConnectorTool::setup() @@ -222,7 +222,7 @@ void ConnectorTool::setup() ); /* Create red bpath */ - this->red_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL); + this->red_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), nullptr); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->red_bpath), this->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->red_bpath), 0x00000000, @@ -272,7 +272,7 @@ void ConnectorTool::finish() ToolBase::finish(); if (this->selection) { - this->selection = NULL; + this->selection = nullptr; } this->cc_clear_active_shape(); @@ -287,22 +287,22 @@ void ConnectorTool::finish() void ConnectorTool::cc_clear_active_shape() { - if (this->active_shape == NULL) { + if (this->active_shape == nullptr) { return; } g_assert( this->active_shape_repr ); g_assert( this->active_shape_layer_repr ); - this->active_shape = NULL; + this->active_shape = nullptr; if (this->active_shape_repr) { sp_repr_remove_listener_by_data(this->active_shape_repr, this); Inkscape::GC::release(this->active_shape_repr); - this->active_shape_repr = NULL; + this->active_shape_repr = nullptr; sp_repr_remove_listener_by_data(this->active_shape_layer_repr, this); Inkscape::GC::release(this->active_shape_layer_repr); - this->active_shape_layer_repr = NULL; + this->active_shape_layer_repr = nullptr; } cc_clear_active_knots(this->knots); @@ -320,17 +320,17 @@ static void cc_clear_active_knots(SPKnotList k) void ConnectorTool::cc_clear_active_conn() { - if (this->active_conn == NULL) { + if (this->active_conn == nullptr) { return; } g_assert( this->active_conn_repr ); - this->active_conn = NULL; + this->active_conn = nullptr; if (this->active_conn_repr) { sp_repr_remove_listener_by_data(this->active_conn_repr, this); Inkscape::GC::release(this->active_conn_repr); - this->active_conn_repr = NULL; + this->active_conn_repr = nullptr; } // Hide the endpoint handles. @@ -349,7 +349,7 @@ bool ConnectorTool::_ptHandleTest(Geom::Point& p, gchar **href) *href = g_strdup_printf("#%s", this->active_handle->owner->getId()); return true; } - *href = NULL; + *href = nullptr; return false; } @@ -726,7 +726,7 @@ bool ConnectorTool::_handleKeyPress(guint const keyval) if (this->state == SP_CONNECTOR_CONTEXT_REROUTING) { SPDocument *doc = desktop->getDocument(); - this->_reroutingFinish(NULL); + this->_reroutingFinish(nullptr); DocumentUndo::undo(doc); @@ -753,18 +753,18 @@ void ConnectorTool::_reroutingFinish(Geom::Point *const p) // Clear the temporary path: this->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); - if (p != NULL) { + if (p != nullptr) { // Test whether we clicked on a connection point gchar *shape_label; bool found = this->_ptHandleTest(*p, &shape_label); if (found) { if (this->clickedhandle == this->endpt_handle[0]) { - this->clickeditem->setAttribute("inkscape:connection-start", shape_label, NULL); + this->clickeditem->setAttribute("inkscape:connection-start", shape_label, nullptr); } else { - this->clickeditem->setAttribute("inkscape:connection-end", shape_label, NULL); + this->clickeditem->setAttribute("inkscape:connection-end", shape_label, nullptr); } g_free(shape_label); } @@ -781,7 +781,7 @@ void ConnectorTool::_resetColors() { /* Red */ this->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); this->green_curve->reset(); this->npoints = 0; @@ -794,7 +794,7 @@ void ConnectorTool::_setInitialPoint(Geom::Point const p) this->p[0] = p; this->p[1] = p; this->npoints = 2; - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); } void ConnectorTool::_setSubsequentPoint(Geom::Point const p) @@ -838,7 +838,7 @@ void ConnectorTool::_concatColorsAndFlush() this->green_curve = new SPCurve(); this->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); if (c->is_empty()) { c->unref(); @@ -884,7 +884,7 @@ void ConnectorTool::_flushWhite(SPCurve *gc) sp_desktop_apply_style_tool(desktop, repr, "/tools/connector", false); gchar *str = sp_svg_write_path( c->get_pathvector() ); - g_assert( str != NULL ); + g_assert( str != nullptr ); repr->setAttribute("d", str); g_free(str); @@ -894,16 +894,16 @@ void ConnectorTool::_flushWhite(SPCurve *gc) bool connection = false; this->newconn->setAttribute( "inkscape:connector-type", - this->isOrthogonal ? "orthogonal" : "polyline", NULL ); + this->isOrthogonal ? "orthogonal" : "polyline", nullptr ); this->newconn->setAttribute( "inkscape:connector-curvature", - Glib::Ascii::dtostr(this->curvature).c_str(), NULL ); + Glib::Ascii::dtostr(this->curvature).c_str(), nullptr ); if (this->shref) { - this->newconn->setAttribute( "inkscape:connection-start", this->shref, NULL); + this->newconn->setAttribute( "inkscape:connection-start", this->shref, nullptr); connection = true; } if (this->ehref) { - this->newconn->setAttribute( "inkscape:connection-end", this->ehref, NULL); + this->newconn->setAttribute( "inkscape:connection-end", this->ehref, nullptr); connection = true; } // Process pending updates. @@ -916,7 +916,7 @@ void ConnectorTool::_flushWhite(SPCurve *gc) this->newconn->updateRepr(); } - this->newconn->doWriteTransform(this->newconn->transform, NULL, true); + this->newconn->doWriteTransform(this->newconn->transform, nullptr, true); // Only set the selection after we are finished with creating the attributes of // the connector. Otherwise, the selection change may alter the defaults for @@ -956,14 +956,14 @@ void ConnectorTool::_finish() if (this->newConnRef) { this->newConnRef->router()->deleteConnector(this->newConnRef); - this->newConnRef = NULL; + this->newConnRef = nullptr; } } static gboolean cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot) { - g_assert (knot != NULL); + g_assert (knot != nullptr); //g_object_ref(knot); knot_ref(knot); @@ -993,7 +993,7 @@ static gboolean cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot * It seems that a signal is not correctly disconnected, maybe * something missing in cc_clear_active_conn()? */ if (cc) { - cc->active_handle = NULL; + cc->active_handle = nullptr; } if (knot_tip) { @@ -1062,7 +1062,7 @@ static gboolean endpt_handler(SPKnot */*knot*/, GdkEvent *event, ConnectorTool * void ConnectorTool::_activeShapeAddKnot(SPItem* item) { - SPKnot *knot = new SPKnot(desktop, 0); + SPKnot *knot = new SPKnot(desktop, nullptr); knot->owner = item; knot->setShape(SP_KNOT_SHAPE_SQUARE); @@ -1087,7 +1087,7 @@ void ConnectorTool::_activeShapeAddKnot(SPItem* item) void ConnectorTool::_setActiveShape(SPItem *item) { - g_assert(item != NULL ); + g_assert(item != nullptr ); if (this->active_shape != item) { // The active shape has changed @@ -1162,7 +1162,7 @@ void ConnectorTool::cc_set_active_conn(SPItem *item) if (this->active_conn_repr) { sp_repr_remove_listener_by_data(this->active_conn_repr, this); Inkscape::GC::release(this->active_conn_repr); - this->active_conn_repr = NULL; + this->active_conn_repr = nullptr; } // Listen in case the active conn changes @@ -1174,7 +1174,7 @@ void ConnectorTool::cc_set_active_conn(SPItem *item) for (int i = 0; i < 2; ++i) { // Create the handle if it doesn't exist - if ( this->endpt_handle[i] == NULL ) { + if ( this->endpt_handle[i] == nullptr ) { SPKnot *knot = new SPKnot(this->desktop, _("<b>Connector endpoint</b>: drag to reroute or connect to new shapes")); @@ -1238,7 +1238,7 @@ void cc_create_connection_point(ConnectorTool* cc) cc_deselect_handle( cc->selected_handle ); } - SPKnot *knot = new SPKnot(cc->desktop, 0); + SPKnot *knot = new SPKnot(cc->desktop, nullptr); // We do not process events on this knot. g_signal_handler_disconnect(G_OBJECT(knot->item), @@ -1289,7 +1289,7 @@ bool cc_item_is_connector(SPItem *item) void cc_selection_set_avoid(bool const set_avoid) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) { + if (desktop == nullptr) { return; } @@ -1301,10 +1301,10 @@ void cc_selection_set_avoid(bool const set_avoid) int changes = 0; for (SPItem *item: selection->items()) { - char const *value = (set_avoid) ? "true" : NULL; + char const *value = (set_avoid) ? "true" : nullptr; if (cc_item_is_shape(item)) { - item->setAttribute("inkscape:connector-avoid", value, NULL); + item->setAttribute("inkscape:connector-avoid", value, nullptr); item->avoidRef->handleSettingChange(); changes++; } @@ -1331,7 +1331,7 @@ void ConnectorTool::_selectionChanged(Inkscape::Selection *selection) return; } - if (item == NULL) { + if (item == nullptr) { this->cc_clear_active_conn(); return; } diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 07fc4b719..0c81e179c 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -72,8 +72,8 @@ DropperTool::DropperTool() , stroke(false) , dropping(false) , dragging(false) - , grabbed(NULL) - , area(NULL) + , grabbed(nullptr) + , area(nullptr) , centre(0, 0) { } @@ -113,12 +113,12 @@ void DropperTool::finish() { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } if (this->area) { sp_canvas_item_destroy(this->area); - this->area = NULL; + this->area = nullptr; } ToolBase::finish(); @@ -211,7 +211,7 @@ bool DropperTool::root_handler(GdkEvent* event) { sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, - NULL, event->button.time); + nullptr, event->button.time); this->grabbed = SP_CANVAS_ITEM(desktop->acetate); break; @@ -299,7 +299,7 @@ bool DropperTool::root_handler(GdkEvent* event) { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, event->button.time); - this->grabbed = NULL; + this->grabbed = nullptr; } Inkscape::Selection *selection = desktop->getSelection(); diff --git a/src/ui/tools/dynamic-base.cpp b/src/ui/tools/dynamic-base.cpp index 1026c26c6..8bc1ddb97 100644 --- a/src/ui/tools/dynamic-base.cpp +++ b/src/ui/tools/dynamic-base.cpp @@ -20,15 +20,15 @@ namespace Tools { DynamicBase::DynamicBase(gchar const *const *cursor_shape) : ToolBase(cursor_shape) - , accumulated(NULL) - , currentshape(NULL) - , currentcurve(NULL) - , cal1(NULL) - , cal2(NULL) + , accumulated(nullptr) + , currentshape(nullptr) + , currentcurve(nullptr) + , cal1(nullptr) + , cal2(nullptr) , point1() , point2() , npoints(0) - , repr(NULL) + , repr(nullptr) , cur(0, 0) , vel(0, 0) , vel_max(0) @@ -58,7 +58,7 @@ DynamicBase::DynamicBase(gchar const *const *cursor_shape) DynamicBase::~DynamicBase() { if (this->accumulated) { this->accumulated = this->accumulated->unref(); - this->accumulated = 0; + this->accumulated = nullptr; } for (auto i:segments) { @@ -68,22 +68,22 @@ DynamicBase::~DynamicBase() { if (this->currentcurve) { this->currentcurve = this->currentcurve->unref(); - this->currentcurve = 0; + this->currentcurve = nullptr; } if (this->cal1) { this->cal1 = this->cal1->unref(); - this->cal1 = 0; + this->cal1 = nullptr; } if (this->cal2) { this->cal2 = this->cal2->unref(); - this->cal2 = 0; + this->cal2 = nullptr; } if (this->currentshape) { sp_canvas_item_destroy(this->currentshape); - this->currentshape = 0; + this->currentshape = nullptr; } } diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 6d1c24f07..a76234aa4 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -115,7 +115,7 @@ void EraserTool::setup() { this->cal1 = new SPCurve(); this->cal2 = new SPCurve(); - this->currentshape = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); + this->currentshape = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, nullptr); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->currentshape), ERC_RED_RGBA, SP_WIND_RULE_EVENODD); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->currentshape), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); @@ -372,7 +372,7 @@ void EraserTool::cancel() { this->accumulated->reset(); this->clear_current(); if (this->repr) { - this->repr = NULL; + this->repr = nullptr; } } @@ -397,7 +397,7 @@ bool EraserTool::root_handler(GdkEvent* event) { this->accumulated->reset(); if (this->repr) { - this->repr = NULL; + this->repr = nullptr; } if ( eraser_mode == ERASER_MODE_DELETE ) { Inkscape::Rubberband::get(desktop)->start(desktop, button_dt); @@ -411,7 +411,7 @@ bool EraserTool::root_handler(GdkEvent* event) { GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK ), - NULL, + nullptr, event->button.time); ret = TRUE; @@ -482,7 +482,7 @@ bool EraserTool::root_handler(GdkEvent* event) { this->clear_current(); if (this->repr) { - this->repr = NULL; + this->repr = nullptr; } this->message_context->clear(); @@ -625,7 +625,7 @@ bool EraserTool::root_handler(GdkEvent* event) { void EraserTool::clear_current() { // reset bpath - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), nullptr); // reset curve this->currentcurve->reset(); @@ -657,7 +657,7 @@ void EraserTool::set_to_accumulated() { Geom::PathVector pathv = this->accumulated->get_pathvector() * this->desktop->dt2doc(); pathv *= item_repr->i2doc_affine().inverse(); gchar *str = sp_svg_write_path(pathv); - g_assert( str != NULL ); + g_assert( str != nullptr ); this->repr->setAttribute("d", str); g_free(str); Geom::OptRect eraserBbox; @@ -723,7 +723,7 @@ void EraserTool::set_to_accumulated() { sp_repr_css_set_property(css, "fill-rule", "evenodd"); sp_desktop_set_style(this->desktop, css); sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; } if (this->nowidth) { selection->pathCut(true); @@ -842,12 +842,12 @@ void EraserTool::set_to_accumulated() { } // Remove the eraser stroke itself: sp_repr_unparent( this->repr ); - this->repr = 0; + this->repr = nullptr; } } else { if (this->repr) { sp_repr_unparent(this->repr); - this->repr = 0; + this->repr = nullptr; } } if ( workDone ) { @@ -1047,7 +1047,7 @@ void EraserTool::fit_and_split(bool release) { gint eraser_mode = prefs->getInt("/tools/eraser/mode",2); g_assert(!this->currentcurve->is_empty()); - SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); + SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, nullptr); SPCurve *curve = this->currentcurve->copy(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve, true); curve->unref(); diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 487f3f7d8..aaa5f1d9a 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -109,7 +109,7 @@ const std::vector<Glib::ustring> FloodTool::gap_list( gap_init, gap_init+4 ); FloodTool::FloodTool() : ToolBase(cursor_paintbucket_xpm) - , item(NULL) + , item(nullptr) { // TODO: Why does the flood tool use a hardcoded tolerance instead of a pref? this->tolerance = 4; @@ -119,7 +119,7 @@ FloodTool::~FloodTool() { this->sel_changed_connection.disconnect(); delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; /* fixme: This is necessary because we do not grab */ if (this->item) { @@ -450,7 +450,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto g_free(str); } - desktop->currentLayer()->addChild(pathRepr,NULL); + desktop->currentLayer()->addChild(pathRepr,nullptr); SPObject *reprobj = document->getObjectByRepr(pathRepr); if (reprobj) { @@ -1227,7 +1227,7 @@ bool FloodTool::root_handler(GdkEvent* event) { void FloodTool::finishItem() { this->message_context->clear(); - if (this->item != NULL) { + if (this->item != nullptr) { this->item->updateRepr(); desktop->canvas->endForcedFullRedraws(); @@ -1236,7 +1236,7 @@ void FloodTool::finishItem() { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); - this->item = NULL; + this->item = nullptr; } } diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index a9b3ff8f5..ba2609975 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -76,24 +76,24 @@ static void spdc_free_colors(FreehandBase *dc); FreehandBase::FreehandBase(gchar const *const *cursor_shape) : ToolBase(cursor_shape) - , selection(NULL) - , grab(NULL) + , selection(nullptr) + , grab(nullptr) , attach(false) , red_color(0xff00007f) , blue_color(0x0000ff7f) , green_color(0x00ff007f) , highlight_color(0x0000007f) - , red_bpath(NULL) - , red_curve(NULL) - , blue_bpath(NULL) - , blue_curve(NULL) - , green_curve(NULL) - , green_anchor(NULL) + , red_bpath(nullptr) + , red_curve(nullptr) + , blue_bpath(nullptr) + , blue_curve(nullptr) + , green_curve(nullptr) + , green_anchor(nullptr) , green_closed(false) - , white_item(NULL) - , sa_overwrited(NULL) - , sa(NULL) - , ea(NULL) + , white_item(nullptr) + , sa_overwrited(nullptr) + , sa(nullptr) + , ea(nullptr) , waiting_LPE_type(Inkscape::LivePathEffect::INVALID_LPE) , red_curve_is_valid(false) , anchor_statusbar(false) @@ -106,11 +106,11 @@ FreehandBase::FreehandBase(gchar const *const *cursor_shape) FreehandBase::~FreehandBase() { if (this->grab) { sp_canvas_item_ungrab(this->grab, GDK_CURRENT_TIME); - this->grab = NULL; + this->grab = nullptr; } if (this->selection) { - this->selection = NULL; + this->selection = nullptr; } spdc_free_colors(this); @@ -130,14 +130,14 @@ void FreehandBase::setup() { ); // Create red bpath - this->red_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL); + this->red_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), nullptr); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->red_bpath), this->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); // Create red curve this->red_curve = new SPCurve(); // Create blue bpath - this->blue_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL); + this->blue_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), nullptr); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); // Create blue curve @@ -147,7 +147,7 @@ void FreehandBase::setup() { this->green_curve = new SPCurve(); // No green anchor by default - this->green_anchor = NULL; + this->green_anchor = nullptr; this->green_closed = FALSE; // Create start anchor alternative curve @@ -166,7 +166,7 @@ void FreehandBase::finish() { } if (this->selection) { - this->selection = NULL; + this->selection = nullptr; } spdc_free_colors(this); @@ -248,7 +248,7 @@ static void spdc_apply_powerstroke_shape(std::vector<Geom::Point> points, Freeha return; } Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE(); - LPEPowerStroke* ps = NULL; + LPEPowerStroke* ps = nullptr; pt->addPowerStrokePencil(c); if (lpe) { ps = static_cast<LPEPowerStroke*>(lpe); @@ -483,7 +483,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if(pasted_clipboard){ Inkscape::XML::Node *pasted_clipboard_root = pasted_clipboard->getRepr(); Inkscape::XML::Node *path = sp_repr_lookup_name(pasted_clipboard_root, "svg:path", -1); // unlimited search depth - if ( path != NULL ) { + if ( path != nullptr ) { gchar const *svgd = path->attribute("d"); dc->selection->remove(SP_OBJECT(pasted_clipboard)); previous_shape_pathv = sp_svg_read_pathv(svgd); @@ -528,7 +528,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, shape = BEND_CLIPBOARD; } else { - bend_item = NULL; + bend_item = nullptr; shape = NONE; } break; @@ -544,7 +544,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, shape = NONE; } } else { - if(bend_item != NULL && bend_item->getRepr() != NULL){ + if(bend_item != nullptr && bend_item->getRepr() != nullptr){ gchar const *svgd = item->getRepr()->attribute("d"); dc->selection->add(SP_OBJECT(bend_item)); dc->selection->duplicate(); @@ -630,10 +630,10 @@ static void spdc_attach_selection(FreehandBase *dc, Inkscape::Selection */*sel*/ } // We reset white and forget white/start/end anchors spdc_reset_white(dc); - dc->sa = NULL; - dc->ea = NULL; + dc->sa = nullptr; + dc->ea = nullptr; - SPItem *item = dc->selection ? dc->selection->singleItem() : NULL; + SPItem *item = dc->selection ? dc->selection->singleItem() : nullptr; if ( item && SP_IS_PATH(item) ) { // Create new white data @@ -644,7 +644,7 @@ static void spdc_attach_selection(FreehandBase *dc, Inkscape::Selection */*sel*/ // We keep it in desktop coordinates to eliminate calculation errors SPCurve *norm = SP_PATH(item)->getCurveForEdit(); norm->transform((dc->white_item)->i2dt_affine()); - g_return_if_fail( norm != NULL ); + g_return_if_fail( norm != nullptr ); dc->white_curves = norm->split(); norm->unref(); @@ -737,14 +737,14 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) // Blue c->append_continuous(dc->blue_curve, 0.0625); dc->blue_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue_bpath), nullptr); // Red if (dc->red_curve_is_valid) { c->append_continuous(dc->red_curve, 0.0625); } dc->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), nullptr); if (c->is_empty()) { c->unref(); @@ -780,7 +780,7 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), dc->sa->curve)); } dc->white_curves.push_back(dc->sa_overwrited); - spdc_flush_white(dc, NULL); + spdc_flush_white(dc, nullptr); return; } // Step C - test start @@ -874,7 +874,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) } gchar *str = sp_svg_write_path( c->get_pathvector() ); - g_assert( str != NULL ); + g_assert( str != nullptr ); if (has_lpe) repr->setAttribute("inkscape:original-d", str); else @@ -898,7 +898,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) Inkscape::GC::release(repr); item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); item->updateRepr(); - item->doWriteTransform(item->transform, NULL, true); + item->doWriteTransform(item->transform, nullptr, true); spdc_check_for_and_apply_waiting_LPE(dc, item, c, false); dc->selection->set(repr); if(previous_shape_type == BEND_CLIPBOARD){ @@ -924,7 +924,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) SPDrawAnchor *spdc_test_inside(FreehandBase *dc, Geom::Point p) { - SPDrawAnchor *active = NULL; + SPDrawAnchor *active = nullptr; // Test green anchor if (dc->green_anchor) { @@ -944,7 +944,7 @@ static void spdc_reset_white(FreehandBase *dc) { if (dc->white_item) { // We do not hold refcount - dc->white_item = NULL; + dc->white_item = nullptr; } for (auto i: dc->white_curves) i->unref(); @@ -959,7 +959,7 @@ static void spdc_free_colors(FreehandBase *dc) // Red if (dc->red_bpath) { sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->red_bpath)); - dc->red_bpath = NULL; + dc->red_bpath = nullptr; } if (dc->red_curve) { dc->red_curve = dc->red_curve->unref(); @@ -968,7 +968,7 @@ static void spdc_free_colors(FreehandBase *dc) // Blue if (dc->blue_bpath) { sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->blue_bpath)); - dc->blue_bpath = NULL; + dc->blue_bpath = nullptr; } if (dc->blue_curve) { dc->blue_curve = dc->blue_curve->unref(); @@ -992,7 +992,7 @@ static void spdc_free_colors(FreehandBase *dc) // White if (dc->white_item) { // We do not hold refcount - dc->white_item = NULL; + dc->white_item = nullptr; } for (auto i: dc->white_curves) i->unref(); diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index b0c2a0185..a443716d7 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -65,8 +65,8 @@ GradientTool::GradientTool() , cursor_addnode(false) , node_added(false) // TODO: Why are these connections stored as pointers? - , selcon(NULL) - , subselcon(NULL) + , selcon(nullptr) + , subselcon(nullptr) { // TODO: This value is overwritten in the root handler this->tolerance = 6; @@ -105,7 +105,7 @@ void GradientTool::selection_changed(Inkscape::Selection*) { GrDrag *drag = rc->_grdrag; Inkscape::Selection *selection = this->desktop->getSelection(); - if (selection == NULL) { + if (selection == nullptr) { return; } guint n_obj = (guint) boost::distance(selection->items()); @@ -168,7 +168,7 @@ void GradientTool::setup() { this->subselcon = new sigc::connection(this->desktop->connectToolSubselectionChanged( sigc::hide(sigc::bind( sigc::mem_fun(this, &GradientTool::selection_changed), - (Inkscape::Selection*)NULL + (Inkscape::Selection*)nullptr )) )); @@ -259,7 +259,7 @@ sp_gradient_context_get_stop_intervals (GrDrag *drag, std::vector<SPStop *> &the // if there's a next stop, if (next_stop) { - GrDragger *dnext = NULL; + GrDragger *dnext = nullptr; // find its dragger // (complex because it may have different types, and because in radial, // more than one dragger may correspond to a stop, so we must distinguish) @@ -307,7 +307,7 @@ sp_gradient_context_get_stop_intervals (GrDrag *drag, std::vector<SPStop *> &the void sp_gradient_context_add_stops_between_selected_stops (GradientTool *rc) { - SPDocument *doc = NULL; + SPDocument *doc = nullptr; GrDrag *drag = rc->_grdrag; std::vector<SPStop *> these_stops; @@ -376,7 +376,7 @@ static double sqr(double x) {return x*x;} static void sp_gradient_simplify(GradientTool *rc, double tolerance) { - SPDocument *doc = NULL; + SPDocument *doc = nullptr; GrDrag *drag = rc->_grdrag; std::vector<SPStop *> these_stops; @@ -471,7 +471,7 @@ bool GradientTool::root_handler(GdkEvent* event) { case GDK_2BUTTON_PRESS: if ( event->button.button == 1 ) { bool over_line = false; - SPCtrlLine *line = NULL; + SPCtrlLine *line = nullptr; if (!drag->lines.empty()) { for (std::vector<SPCtrlLine *>::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) { @@ -602,7 +602,7 @@ bool GradientTool::root_handler(GdkEvent* event) { if ( event->button.button == 1 && !this->space_panning ) { bool over_line = false; - SPCtrlLine *line = NULL; + SPCtrlLine *line = nullptr; if (!drag->lines.empty()) { for (std::vector<SPCtrlLine *>::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) { @@ -659,7 +659,7 @@ bool GradientTool::root_handler(GdkEvent* event) { } } - this->item_to_select = NULL; + this->item_to_select = nullptr; ret = TRUE; } @@ -680,7 +680,7 @@ bool GradientTool::root_handler(GdkEvent* event) { sp_event_show_modifier_tip (this->defaultMessageContext(), event, _("<b>Ctrl</b>: snap gradient angle"), _("<b>Shift</b>: draw gradient around the starting point"), - NULL); + nullptr); break; case GDK_KEY_x: diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index f62a70c34..c523b7bde 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -73,8 +73,8 @@ const std::string LpeTool::prefsPath = "/tools/lpetool"; LpeTool::LpeTool() : PenTool(cursor_crosshairs_xpm) - , shape_editor(NULL) - , canvas_bbox(NULL) + , shape_editor(nullptr) + , canvas_bbox(nullptr) , mode(Inkscape::LivePathEffect::BEND_PATH) // TODO: pointer? , measuring_items(new std::map<SPPath *, SPCanvasItem*>) @@ -83,16 +83,16 @@ LpeTool::LpeTool() LpeTool::~LpeTool() { delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; if (this->canvas_bbox) { sp_canvas_item_destroy(SP_CANVAS_ITEM(this->canvas_bbox)); - this->canvas_bbox = NULL; + this->canvas_bbox = nullptr; } lpetool_delete_measuring_items(this); delete this->measuring_items; - this->measuring_items = NULL; + this->measuring_items = nullptr; this->sel_changed_connection.disconnect(); } @@ -343,7 +343,7 @@ lpetool_context_reset_limiting_bbox(LpeTool *lc) { if (lc->canvas_bbox) { sp_canvas_item_destroy(lc->canvas_bbox); - lc->canvas_bbox = NULL; + lc->canvas_bbox = nullptr; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -407,7 +407,7 @@ lpetool_create_measuring_items(LpeTool *lc, Inkscape::Selection *selection) if (!show) sp_canvas_item_hide(SP_CANVAS_ITEM(canvas_text)); - Inkscape::Util::Unit const * unit = NULL; + Inkscape::Util::Unit const * unit = nullptr; if (prefs->getString("/tools/lpetool/unit").compare("")) { unit = unit_table.getUnit(prefs->getString("/tools/lpetool/unit")); } else { @@ -446,7 +446,7 @@ lpetool_update_measuring_items(LpeTool *lc) SPPath *path = i->first; SPCurve *curve = path->getCurve(); Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = Geom::paths_to_pw(curve->get_pathvector()); - Inkscape::Util::Unit const * unit = NULL; + Inkscape::Util::Unit const * unit = nullptr; if (prefs->getString("/tools/lpetool/unit").compare("")) { unit = unit_table.getUnit(prefs->getString("/tools/lpetool/unit")); } else { diff --git a/src/ui/tools/lpe-tool.h b/src/ui/tools/lpe-tool.h index d3a5a056e..ead4095a8 100644 --- a/src/ui/tools/lpe-tool.h +++ b/src/ui/tools/lpe-tool.h @@ -76,7 +76,7 @@ bool lpetool_try_construction(LpeTool *lc, Inkscape::LivePathEffect::EffectType void lpetool_context_switch_mode(LpeTool *lc, Inkscape::LivePathEffect::EffectType const type); void lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B); void lpetool_context_reset_limiting_bbox(LpeTool *lc); -void lpetool_create_measuring_items(LpeTool *lc, Inkscape::Selection *selection = NULL); +void lpetool_create_measuring_items(LpeTool *lc, Inkscape::Selection *selection = nullptr); void lpetool_delete_measuring_items(LpeTool *lc); void lpetool_update_measuring_items(LpeTool *lc); void lpetool_show_measuring_info(LpeTool *lc, bool show = true); diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index c2bc23d8b..633bf6ec3 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -244,11 +244,11 @@ void setMeasureItem(Geom::PathVector pathv, bool is_curve, bool markers, guint32 sp_repr_css_write_string(css,css_str); repr->setAttribute("style", css_str.c_str()); sp_repr_css_attr_unref (css); - g_assert( str != NULL ); + g_assert( str != nullptr ); repr->setAttribute("d", str); g_free(str); if(measure_repr) { - measure_repr->addChild(repr, NULL); + measure_repr->addChild(repr, nullptr); Inkscape::GC::release(repr); } else { SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr)); @@ -269,7 +269,7 @@ void setMeasureItem(Geom::PathVector pathv, bool is_curve, bool markers, guint32 * @param angle the angle of the arc segment to draw. * @param measure_rpr the container of the curve if converted to items. */ -void createAngleDisplayCurve(SPDesktop *desktop, Geom::Point const ¢er, Geom::Point const &end, Geom::Point const &anchor, double angle, bool to_phantom, std::vector<SPCanvasItem *> &measure_phantom_items , std::vector<SPCanvasItem *> &measure_tmp_items , Inkscape::XML::Node *measure_repr = NULL) +void createAngleDisplayCurve(SPDesktop *desktop, Geom::Point const ¢er, Geom::Point const &end, Geom::Point const &anchor, double angle, bool to_phantom, std::vector<SPCanvasItem *> &measure_phantom_items , std::vector<SPCanvasItem *> &measure_tmp_items , Inkscape::XML::Node *measure_repr = nullptr) { // Given that we have a point on the arc's edge and the angle of the arc, we need to get the two endpoints. @@ -333,7 +333,7 @@ boost::optional<Geom::Point> explicit_base_tmp = boost::none; MeasureTool::MeasureTool() : ToolBase(cursor_measure_xpm) - , grabbed(NULL) + , grabbed(nullptr) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; start_p = readMeasurePoint(true); @@ -519,7 +519,7 @@ void MeasureTool::finish() if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } ToolBase::finish(); @@ -540,9 +540,9 @@ static void calculate_intersections(SPDesktop * /*desktop*/, SPItem* item, Geom: if (!show_hidden) { double eps = 0.0001; if (((*m).ta > eps && - item == desktop->getItemAtPoint(desktop->d2w(desktop->dt2doc(lineseg[0].pointAt((*m).ta - eps))), true, NULL)) || + item == desktop->getItemAtPoint(desktop->d2w(desktop->dt2doc(lineseg[0].pointAt((*m).ta - eps))), true, nullptr)) || ((*m).ta + eps < 1 && - item == desktop->getItemAtPoint(desktop->d2w(desktop->dt2doc(lineseg[0].pointAt((*m).ta + eps))), true, NULL))) { + item == desktop->getItemAtPoint(desktop->d2w(desktop->dt2doc(lineseg[0].pointAt((*m).ta + eps))), true, nullptr))) { intersections.push_back((*m).ta); } } else { @@ -579,7 +579,7 @@ bool MeasureTool::root_handler(GdkEvent* event) sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, - NULL, event->button.time); + nullptr, event->button.time); this->grabbed = SP_CANVAS_ITEM(desktop->acetate); break; } @@ -676,7 +676,7 @@ bool MeasureTool::root_handler(GdkEvent* event) if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, event->button.time); - this->grabbed = NULL; + this->grabbed = nullptr; } break; } @@ -969,11 +969,11 @@ void MeasureTool::setLabelText(const char *value, Geom::Point pos, double fontsi sp_repr_css_write_string(css,css_str); rtspan->setAttribute("style", css_str.c_str()); sp_repr_css_attr_unref (css); - rtext->addChild(rtspan, NULL); + rtext->addChild(rtspan, nullptr); Inkscape::GC::release(rtspan); /* Create TEXT */ Inkscape::XML::Node *rstring = xml_doc->createTextNode(value); - rtspan->addChild(rstring, NULL); + rtspan->addChild(rstring, nullptr); Inkscape::GC::release(rstring); SPItem *text_item = SP_ITEM(desktop->currentLayer()->appendChildRepr(rtext)); Inkscape::GC::release(rtext); @@ -1007,9 +1007,9 @@ void MeasureTool::setLabelText(const char *value, Geom::Point pos, double fontsi sp_repr_set_svg_double(rrect, "height", bbox->height() + 6); Inkscape::XML::Node *rtextitem = text_item->getRepr(); text_item->deleteObject(); - rgroup->addChild(rtextitem, NULL); + rgroup->addChild(rtextitem, nullptr); Inkscape::GC::release(rtextitem); - rgroup->addChild(rrect, NULL); + rgroup->addChild(rrect, nullptr); Inkscape::GC::release(rrect); SPItem *text_item_box = SP_ITEM(desktop->currentLayer()->appendChildRepr(rgroup)); Geom::Scale scale = Geom::Scale(desktop->current_zoom()).inverse(); @@ -1021,16 +1021,16 @@ void MeasureTool::setLabelText(const char *value, Geom::Point pos, double fontsi text_item_box->transform *= Geom::Translate(pos); text_item_box->transform *= SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); text_item_box->updateRepr(); - text_item_box->doWriteTransform(text_item_box->transform, NULL, true); + text_item_box->doWriteTransform(text_item_box->transform, nullptr, true); Inkscape::XML::Node *rlabel = text_item_box->getRepr(); text_item_box->deleteObject(); - measure_repr->addChild(rlabel, NULL); + measure_repr->addChild(rlabel, nullptr); Inkscape::GC::release(rlabel); } else { text_item->transform *= Geom::Rotate(angle); text_item->transform *= Geom::Translate(pos); text_item->transform *= SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); - text_item->doWriteTransform(text_item->transform, NULL, true); + text_item->doWriteTransform(text_item->transform, nullptr, true); } } @@ -1195,7 +1195,7 @@ void MeasureTool::showInfoBox(Geom::Point cursor, bool into_groups) } } } - gchar *measure_str = NULL; + gchar *measure_str = nullptr; std::stringstream precision_str; precision_str.imbue(std::locale::classic()); double origin = Inkscape::Util::Quantity::convert(14, "px", unit->abbr); @@ -1285,8 +1285,8 @@ void MeasureTool::showCanvasItems(bool to_guides, bool to_item, bool to_phantom, SPDocument *doc = desktop->getDocument(); Geom::Rect rect(start_p, end_p); items = doc->getItemsPartiallyInBox(desktop->dkey, rect, false, true); - Inkscape::LayerModel *layer_model = NULL; - SPObject *current_layer = NULL; + Inkscape::LayerModel *layer_model = nullptr; + SPObject *current_layer = nullptr; if(desktop){ layer_model = desktop->layers; current_layer = desktop->currentLayer(); diff --git a/src/ui/tools/measure-tool.h b/src/ui/tools/measure-tool.h index 519e849c3..e50caa434 100644 --- a/src/ui/tools/measure-tool.h +++ b/src/ui/tools/measure-tool.h @@ -43,7 +43,7 @@ public: void finish() override; bool root_handler(GdkEvent* event) override; - virtual void showCanvasItems(bool to_guides = false, bool to_item = false, bool to_phantom = false, Inkscape::XML::Node *measure_repr = NULL); + virtual void showCanvasItems(bool to_guides = false, bool to_item = false, bool to_phantom = false, Inkscape::XML::Node *measure_repr = nullptr); virtual void reverseKnots(); virtual void toGuides(); virtual void toPhantom(); @@ -59,11 +59,11 @@ public: void writeMeasurePoint(Geom::Point point, bool is_start); void setGuide(Geom::Point origin, double angle, const char *label); void setPoint(Geom::Point origin, Inkscape::XML::Node *measure_repr); - void setLine(Geom::Point start_point,Geom::Point end_point, bool markers, guint32 color, Inkscape::XML::Node *measure_repr = NULL); + void setLine(Geom::Point start_point,Geom::Point end_point, bool markers, guint32 color, Inkscape::XML::Node *measure_repr = nullptr); void setMeasureCanvasText(bool is_angle, double precision, double amount, double fontsize, Glib::ustring unit_name, Geom::Point position, guint32 background, CanvasTextAnchorPositionEnum text_anchor, bool to_item, bool to_phantom, Inkscape::XML::Node *measure_repr); void setMeasureCanvasItem(Geom::Point position, bool to_item, bool to_phantom, Inkscape::XML::Node *measure_repr); void setMeasureCanvasControlLine(Geom::Point start, Geom::Point end, bool to_item, bool to_phantom, Inkscape::CtrlLineType ctrl_line_type, Inkscape::XML::Node *measure_repr); - void setLabelText(const char *value, Geom::Point pos, double fontsize, Geom::Coord angle, guint32 background , Inkscape::XML::Node *measure_repr = NULL, CanvasTextAnchorPositionEnum text_anchor = TEXT_ANCHOR_CENTER ); + void setLabelText(const char *value, Geom::Point pos, double fontsize, Geom::Coord angle, guint32 background , Inkscape::XML::Node *measure_repr = nullptr, CanvasTextAnchorPositionEnum text_anchor = TEXT_ANCHOR_CENTER ); void knotStartMovedHandler(SPKnot */*knot*/, Geom::Point const &ppointer, guint state); void knotEndMovedHandler(SPKnot */*knot*/, Geom::Point const &ppointer, guint state); void knotClickHandler(SPKnot *knot, guint state); diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index e94da4813..93b94d750 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -74,8 +74,8 @@ const std::string MeshTool::prefsPath = "/tools/mesh"; MeshTool::MeshTool() : ToolBase(cursor_gradient_xpm) // TODO: Why are these connections stored as pointers? - , selcon(NULL) - , subselcon(NULL) + , selcon(nullptr) + , subselcon(nullptr) , cursor_addnode(false) , node_added(false) , show_handles(true) @@ -118,7 +118,7 @@ void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) { GrDrag *drag = this->_grdrag; Inkscape::Selection *selection = this->desktop->getSelection(); - if (selection == NULL) { + if (selection == nullptr) { return; } @@ -190,7 +190,7 @@ void MeshTool::setup() { this->subselcon = new sigc::connection(this->desktop->connectToolSubselectionChanged( sigc::hide(sigc::bind( sigc::mem_fun(*this, &MeshTool::selection_changed), - (Inkscape::Selection*)NULL) + (Inkscape::Selection*)nullptr) ) )); @@ -310,7 +310,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) std::cout << "sp_mesh_corner_operation: entrance: " << operation << std::endl; #endif - SPDocument *doc = NULL; + SPDocument *doc = nullptr; GrDrag *drag = rc->_grdrag; std::map<SPMeshGradient*, std::vector<guint> > points; @@ -442,7 +442,7 @@ sp_mesh_context_fit_mesh_in_bbox (MeshTool *rc) SPDesktop *desktop = SP_EVENT_CONTEXT (rc)->desktop; Inkscape::Selection *selection = desktop->getSelection(); - if (selection == NULL) { + if (selection == nullptr) { return; } @@ -805,7 +805,7 @@ bool MeshTool::root_handler(GdkEvent* event) { } } - this->item_to_select = NULL; + this->item_to_select = nullptr; ret = TRUE; } @@ -1115,7 +1115,7 @@ static void sp_mesh_new_default(MeshTool &rc) { if (css) { sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; } DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Create mesh")); diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index d54adba89..3ec40d086 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -127,16 +127,16 @@ SPCanvasGroup *create_control_group(SPDesktop *d); NodeTool::NodeTool() : ToolBase(cursor_node_xpm) - , _selected_nodes(NULL) - , _multipath(NULL) + , _selected_nodes(nullptr) + , _multipath(nullptr) , edit_clipping_paths(false) , edit_masks(false) - , flashed_item(NULL) - , flash_tempitem(NULL) - , _selector(NULL) - , _path_data(NULL) - , _transform_handle_group(NULL) - , _last_over(NULL) + , flashed_item(nullptr) + , flash_tempitem(nullptr) + , _selector(nullptr) + , _path_data(nullptr) + , _transform_handle_group(nullptr) + , _last_over(nullptr) , cursor_drag(false) , show_handles(false) , show_outline(false) @@ -151,7 +151,7 @@ NodeTool::NodeTool() SPCanvasGroup *create_control_group(SPDesktop *d) { return reinterpret_cast<SPCanvasGroup*>(sp_canvas_item_new( - d->getControls(), SP_TYPE_CANVAS_GROUP, NULL)); + d->getControls(), SP_TYPE_CANVAS_GROUP, nullptr)); } void destroy_group(SPCanvasGroup *g) @@ -219,7 +219,7 @@ void NodeTool::setup() { this->_sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged( sigc::mem_fun(this, &NodeTool::handleControlUiStyleChange) ); - this->helperpath_tmpitem = NULL; + this->helperpath_tmpitem = nullptr; this->_selected_nodes = new Inkscape::UI::ControlPointSelection(this->desktop, this->_transform_handle_group); data.node_data.selection = this->_selected_nodes; @@ -232,7 +232,7 @@ void NodeTool::setup() { this->_multipath->signal_coords_changed.connect( sigc::bind( sigc::mem_fun(*this->desktop, &SPDesktop::emitToolSubselectionChanged), - (void*)NULL + (void*)nullptr ) ); @@ -243,16 +243,16 @@ void NodeTool::setup() { // void update_tip(GdkEvent *event) sigc::hide(sigc::hide(sigc::bind( sigc::mem_fun(this, &NodeTool::update_tip), - (GdkEvent*)NULL + (GdkEvent*)nullptr ))) ); this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; - this->flash_tempitem = NULL; - this->flashed_item = NULL; - this->_last_over = NULL; + this->flash_tempitem = nullptr; + this->flashed_item = nullptr; + this->_last_over = nullptr; // read prefs before adding items to selection to prevent momentarily showing the outline sp_event_context_read(this, "show_handles"); @@ -266,7 +266,7 @@ void NodeTool::setup() { sp_event_context_read(this, "edit_masks"); this->selection_changed(selection); - this->update_tip(NULL); + this->update_tip(nullptr); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -278,7 +278,7 @@ void NodeTool::setup() { this->enableGrDrag(); } - this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive + this->desktop->emitToolSubselectionChanged(nullptr); // sets the coord entry fields to inactive sp_update_helperpath(); } @@ -292,7 +292,7 @@ void sp_update_helperpath() { Inkscape::Selection *selection = desktop->getSelection(); if (nt->helperpath_tmpitem) { desktop->remove_temporary_canvasitem(nt->helperpath_tmpitem); - nt->helperpath_tmpitem = NULL; + nt->helperpath_tmpitem = nullptr; } if (SP_IS_LPE_ITEM(selection->singleItem())) { @@ -378,7 +378,7 @@ void gather_items(NodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Shape //XML Tree being used directly here while it shouldn't be. if (SP_IS_PATH(obj) && - obj->getRepr()->attribute("inkscape:original-d") != NULL && + obj->getRepr()->attribute("inkscape:original-d") != nullptr && !SP_LPE_ITEM(obj)->hasPathEffectOfType(Inkscape::LivePathEffect::POWERCLIP)) { ShapeRecord r; @@ -421,7 +421,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) { SPObject *obj = *i; if (SP_IS_ITEM(obj)) { - gather_items(this, NULL, static_cast<SPItem*>(obj), SHAPE_ROLE_NORMAL, shapes); + gather_items(this, nullptr, static_cast<SPItem*>(obj), SHAPE_ROLE_NORMAL, shapes); } } @@ -457,7 +457,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) { _current_selection = vec; this->_multipath->setItems(shapes); - this->update_tip(NULL); + this->update_tip(nullptr); this->desktop->updateNow(); } @@ -524,8 +524,8 @@ bool NodeTool::root_handler(GdkEvent* event) { if (this->flash_tempitem) { desktop->remove_temporary_canvasitem(this->flash_tempitem); - this->flash_tempitem = NULL; - this->flashed_item = NULL; + this->flash_tempitem = nullptr; + this->flashed_item = nullptr; } if (!SP_IS_SHAPE(over_item)) { @@ -756,7 +756,7 @@ void NodeTool::select_point(Geom::Point const &/*sel*/, GdkEventButton *event) { SPItem *item_clicked = sp_event_context_find_item (this->desktop, event_point(*event), (event->state & GDK_MOD1_MASK) && !(event->state & GDK_CONTROL_MASK), TRUE); - if (item_clicked == NULL) { // nothing under cursor + if (item_clicked == nullptr) { // nothing under cursor // if no Shift, deselect // if there are nodes selected, the first click should deselect the nodes // and the second should deselect the items diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 7dd120077..c5855540b 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -96,12 +96,12 @@ PenTool::PenTool() , polylines_paraxial(false) , num_clicks(0) , expecting_clicks_for_LPE(0) - , waiting_LPE(NULL) - , waiting_item(NULL) - , c0(NULL) - , c1(NULL) - , cl0(NULL) - , cl1(NULL) + , waiting_LPE(nullptr) + , waiting_item(nullptr) + , c0(nullptr) + , c1(nullptr) + , cl0(nullptr) + , cl1(nullptr) , events_disabled(false) { tablet_enabled = false; @@ -118,12 +118,12 @@ PenTool::PenTool(gchar const *const *cursor_shape) , polylines_paraxial(false) , num_clicks(0) , expecting_clicks_for_LPE(0) - , waiting_LPE(NULL) - , waiting_item(NULL) - , c0(NULL) - , c1(NULL) - , cl0(NULL) - , cl1(NULL) + , waiting_LPE(nullptr) + , waiting_item(nullptr) + , c0(nullptr) + , c1(nullptr) + , cl0(nullptr) + , cl1(nullptr) , events_disabled(false) { } @@ -131,19 +131,19 @@ PenTool::PenTool(gchar const *const *cursor_shape) PenTool::~PenTool() { if (this->c0) { sp_canvas_item_destroy(this->c0); - this->c0 = NULL; + this->c0 = nullptr; } if (this->c1) { sp_canvas_item_destroy(this->c1); - this->c1 = NULL; + this->c1 = nullptr; } if (this->cl0) { sp_canvas_item_destroy(this->cl0); - this->cl0 = NULL; + this->cl0 = nullptr; } if (this->cl1) { sp_canvas_item_destroy(this->cl1); - this->cl1 = NULL; + this->cl1 = nullptr; } if (this->expecting_clicks_for_LPE > 0) { @@ -229,7 +229,7 @@ void PenTool::finish() { if (this->npoints != 0) { // switching context - finish path - this->ea = NULL; // unset end anchor if set (otherwise crashes) + this->ea = nullptr; // unset end anchor if set (otherwise crashes) this->_finish(false); } @@ -253,7 +253,7 @@ void PenTool::set(const Inkscape::Preferences::Entry& val) { bool PenTool::hasWaitingLPE() { // note: waiting_LPE_type is defined in SPDrawContext - return (this->waiting_LPE != NULL || + return (this->waiting_LPE != nullptr || this->waiting_LPE_type != Inkscape::LivePathEffect::INVALID_LPE); } @@ -399,7 +399,7 @@ bool PenTool::_handleButtonPress(GdkEventButton const &bevent) { sp_canvas_item_grab(this->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ), - NULL, bevent.time); + nullptr, bevent.time); } pen_drag_origin_w = event_w; @@ -539,7 +539,7 @@ bool PenTool::_handleButtonPress(GdkEventButton const &bevent) { ret = true; } else if (bevent.button == 3 && this->npoints != 0) { // right click - finish path - this->ea = NULL; // unset end anchor if set (otherwise crashes) + this->ea = nullptr; // unset end anchor if set (otherwise crashes) this->_finish(false); ret = true; } @@ -814,7 +814,7 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) { if (this->grab) { // Release grab now sp_canvas_item_ungrab(this->grab, revent.time); - this->grab = NULL; + this->grab = nullptr; } ret = true; @@ -833,7 +833,7 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) { // we have an already created LPE waiting for a path this->waiting_LPE->acceptParamPath(SP_PATH(selection->singleItem())); selection->add(this->waiting_item); - this->waiting_LPE = NULL; + this->waiting_LPE = nullptr; } else { // the case that we need to create a new LPE and apply it to the just-drawn path is // handled in spdc_check_for_and_apply_waiting_LPE() in draw-context.cpp @@ -1199,7 +1199,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { case GDK_KEY_Return: case GDK_KEY_KP_Enter: if (this->npoints != 0) { - this->ea = NULL; // unset end anchor if set (otherwise crashes) + this->ea = nullptr; // unset end anchor if set (otherwise crashes) if(MOD__SHIFT_ONLY(event)) { // All this is needed to stop the last control // point dispeating and stop making an n-1 shape. @@ -1243,10 +1243,10 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { void PenTool::_resetColors() { // Red this->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL, true); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr, true); // Blue this->blue_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), NULL, true); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), nullptr, true); // Green for (auto i:this->green_bpaths) { sp_canvas_item_destroy(i); @@ -1256,8 +1256,8 @@ void PenTool::_resetColors() { if (this->green_anchor) { this->green_anchor = sp_draw_anchor_destroy(this->green_anchor); } - this->sa = NULL; - this->ea = NULL; + this->sa = nullptr; + this->ea = nullptr; this->sa_overwrited->reset(); this->npoints = 0; @@ -1271,7 +1271,7 @@ void PenTool::_setInitialPoint(Geom::Point const p) { this->p[0] = p; this->p[1] = p; this->npoints = 2; - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL, true); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr, true); this->desktop->canvas->forceFullRedrawAfterInterruptions(5); } @@ -1282,9 +1282,9 @@ void PenTool::_setInitialPoint(Geom::Point const p) { * two parameters ("angle %3.2f°, distance %s"). */ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_to_compare, gchar const *message) { - g_assert(this != NULL); + g_assert(this != nullptr); g_assert((pc_point_to_compare == 0) || (pc_point_to_compare == 3)); // exclude control handles - g_assert(message != NULL); + g_assert(message != nullptr); Geom::Point rel = p - this->p[pc_point_to_compare]; Inkscape::Util::Quantity q = Inkscape::Util::Quantity(Geom::L2(rel), "px"); @@ -1384,7 +1384,7 @@ void PenTool::_bsplineSpiroStartAnchor(bool shift) return; } - LivePathEffect::LPEBSpline *lpe_bsp = NULL; + LivePathEffect::LPEBSpline *lpe_bsp = nullptr; if (SP_IS_LPE_ITEM(this->white_item) && SP_LPE_ITEM(this->white_item)->hasPathEffect()){ Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(this->white_item)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); @@ -1397,7 +1397,7 @@ void PenTool::_bsplineSpiroStartAnchor(bool shift) }else{ this->bspline = false; } - LivePathEffect::LPESpiro *lpe_spi = NULL; + LivePathEffect::LPESpiro *lpe_spi = nullptr; if (SP_IS_LPE_ITEM(this->white_item) && SP_LPE_ITEM(this->white_item)->hasPathEffect()){ Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(this->white_item)->getPathEffectOfType(Inkscape::LivePathEffect::SPIRO); @@ -1902,7 +1902,7 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { bool PenTool::_undoLastPoint() { bool ret = false; - if ( this->green_curve->is_unset() || (this->green_curve->last_segment() == NULL) ) { + if ( this->green_curve->is_unset() || (this->green_curve->last_segment() == nullptr) ) { if (!this->red_curve->is_unset()) { this->_cancel (); ret = true; @@ -1997,8 +1997,8 @@ void PenTool::_finish(gboolean const closed) { // cancelate line without a created segment this->red_curve->reset(); spdc_concat_colors_and_flush(this, closed); - this->sa = NULL; - this->ea = NULL; + this->sa = nullptr; + this->ea = nullptr; this->npoints = 0; this->state = PenTool::POINT; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 590ef3634..842a84f74 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -80,8 +80,8 @@ PencilTool::PencilTool() , _req_tangent(0, 0) , _is_drawing(false) , sketch_n(0) - , _powerpreview(NULL) - , _curve(NULL) + , _powerpreview(nullptr) + , _curve(nullptr) , _previous_pressure(0.0) , _last_point(Geom::Point()) { @@ -187,7 +187,7 @@ bool PencilTool::_handleButtonPress(GdkEventButton const &bevent) { sp_canvas_item_grab(this->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ), - NULL, bevent.time); + nullptr, bevent.time); } Geom::Point const button_w(bevent.x, bevent.y); @@ -289,7 +289,7 @@ bool PencilTool::_handleMotionNotify(GdkEventMotion const &mevent) { sp_canvas_item_grab(this->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ), - NULL, mevent.time); + nullptr, mevent.time); } /* Find desktop coordinates */ @@ -367,10 +367,10 @@ bool PencilTool::_handleMotionNotify(GdkEventMotion const &mevent) { } else if (!anchor && this->anchor_statusbar) { this->message_context->clear(); this->anchor_statusbar = false; - this->ea = NULL; + this->ea = nullptr; } else if (!anchor) { this->message_context->set(Inkscape::NORMAL_MESSAGE, _("Drawing a freehand path")); - this->ea = NULL; + this->ea = nullptr; } } else { @@ -481,8 +481,8 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) { this->_interpolate(); spdc_concat_colors_and_flush(this, FALSE); this->points.clear(); - this->sa = NULL; - this->ea = NULL; + this->sa = nullptr; + this->ea = nullptr; this->ps.clear(); this->_wps.clear(); this->_key_nodes.clear(); @@ -505,7 +505,7 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) { if (this->grab) { /* Release grab now */ sp_canvas_item_ungrab(this->grab, revent.time); - this->grab = NULL; + this->grab = nullptr; } ret = true; @@ -517,7 +517,7 @@ void PencilTool::_cancel() { if (this->grab) { /* Release grab now */ sp_canvas_item_ungrab(this->grab, 0); - this->grab = NULL; + this->grab = nullptr; } this->_is_drawing = false; @@ -525,7 +525,7 @@ void PencilTool::_cancel() { sp_event_context_discard_delayed_snap_event(this); this->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); for (auto i:this->green_bpaths) { sp_canvas_item_destroy(i); } @@ -605,8 +605,8 @@ bool PencilTool::_handleKeyRelease(GdkEventKey const &event) { if (this->_state == SP_PENCIL_CONTEXT_SKETCH) { spdc_concat_colors_and_flush(this, FALSE); this->sketch_n = 0; - this->sa = NULL; - this->ea = NULL; + this->sa = nullptr; + this->ea = nullptr; if (this->green_anchor) { this->green_anchor = sp_draw_anchor_destroy(this->green_anchor); } @@ -682,12 +682,12 @@ void PencilTool::_finishEndpoint() { this->red_curve->first_point() == this->red_curve->second_point()) { this->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); } else { /* Write curves to object. */ spdc_concat_colors_and_flush(this, FALSE); - this->sa = NULL; - this->ea = NULL; + this->sa = nullptr; + this->ea = nullptr; } } @@ -703,7 +703,7 @@ PencilTool::_powerStrokePreview(Geom::Path const path) Geom::PathVector const pathv(path); SPLPEItem * lpeitem = dynamic_cast<SPLPEItem *>(_powerpreview); if (!lpeitem) { - Inkscape::XML::Node *body = NULL; + Inkscape::XML::Node *body = nullptr; body = xml_doc->createElement("svg:path"); body->setAttribute("sodipodi:insensitive", "true"); sp_desktop_apply_style_tool(desktop, body, Glib::ustring("/tools/freehand/pencil").data(), false); @@ -760,10 +760,10 @@ PencilTool::removePowerStrokePreview() LivePathEffectObject * lpeobj = lpe->getLPEObj(); if (lpeobj) { SP_OBJECT(lpeobj)->deleteObject(); - lpeobj = NULL; + lpeobj = nullptr; } _powerpreview->deleteObject(); - _powerpreview = NULL; + _powerpreview = nullptr; } } void @@ -793,7 +793,7 @@ PencilTool::addPowerStrokePencil() } } if (!this->_curve || this->_curve->is_unset()) { - this->_curve = NULL; + this->_curve = nullptr; } double dezoomify_factor = 0.05 * 1000/SP_EVENT_CONTEXT(this)->desktop->current_zoom();//\/100 we want 100% = 1; double last_pressure = this->_wps.back(); @@ -836,7 +836,7 @@ void PencilTool::_addFreehandPoint(Geom::Point const &p, guint /*state*/) { this->_wps.push_back(this->pressure); this->addPowerStrokePencil(); } - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); for (auto i:this->green_bpaths) { sp_canvas_item_destroy(i); } @@ -870,7 +870,7 @@ PencilTool::_powerstrokeInterpolate(bool apply) { Geom::Affine transform_coordinate = SP_ITEM(SP_ACTIVE_DESKTOP->currentLayer())->i2dt_affine(); this->_key_nodes.clear(); std::vector<Geom::Point> sa_points; - SPItem *item = selection ? selection->singleItem() : NULL; + SPItem *item = selection ? selection->singleItem() : nullptr; if(sa && apply && item) { using namespace Inkscape::LivePathEffect; SPCurve * c = sa_overwrited->copy(); @@ -929,7 +929,7 @@ PencilTool::_powerstrokeInterpolate(bool apply) { sa_points.insert(sa_points.end(),this->points.begin(),this->points.end()); this->points = sa_points; sa_points.clear(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr); if (!path.empty()){ this->_curve->set_pathvector(path); if( apply && @@ -1117,7 +1117,7 @@ void PencilTool::_fitAndSplit() { || is_unit_vector(this->_req_tangent)); Geom::Point const tHatEnd(0, 0); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - int const n_segs = Geom::bezier_fit_cubic_full(b, NULL, this->p, this->_npoints, + int const n_segs = Geom::bezier_fit_cubic_full(b, nullptr, this->p, this->_npoints, this->_req_tangent, tHatEnd, tolerance_sq, 1); if ( n_segs > 0 diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 7442c6eca..cedf43962 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -58,7 +58,7 @@ const std::string RectTool::prefsPath = "/tools/shapes/rect"; RectTool::RectTool() : ToolBase(cursor_rect_xpm) - , rect(NULL) + , rect(nullptr) , rx(0) , ry(0) { @@ -79,7 +79,7 @@ RectTool::~RectTool() { this->sel_changed_connection.disconnect(); delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; /* fixme: This is necessary because we do not grab */ if (this->rect) { @@ -199,7 +199,7 @@ bool RectTool::root_handler(GdkEvent* event) { GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK ), - NULL, event->button.time); + nullptr, event->button.time); ret = TRUE; } @@ -256,7 +256,7 @@ bool RectTool::root_handler(GdkEvent* event) { selection->clear(); } - this->item_to_select = NULL; + this->item_to_select = nullptr; ret = TRUE; sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); @@ -276,7 +276,7 @@ bool RectTool::root_handler(GdkEvent* event) { sp_event_show_modifier_tip (this->defaultMessageContext(), event, _("<b>Ctrl</b>: make square or integer-ratio rect, lock a rounded corner circular"), _("<b>Shift</b>: draw around the starting point"), - NULL); + nullptr); } break; case GDK_KEY_x: @@ -450,14 +450,14 @@ void RectTool::drag(Geom::Point const pt, guint state) { void RectTool::finishItem() { this->message_context->clear(); - if (this->rect != NULL) { + if (this->rect != nullptr) { if (this->rect->width.computed == 0 || this->rect->height.computed == 0) { this->cancel(); // Don't allow the creating of zero sized rectangle, for example when the start and and point snap to the snap grid point return; } this->rect->updateRepr(); - this->rect->doWriteTransform(this->rect->transform, NULL, true); + this->rect->doWriteTransform(this->rect->transform, nullptr, true); this->desktop->canvas->endForcedFullRedraws(); @@ -469,7 +469,7 @@ void RectTool::finishItem() { DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_RECT, _("Create rectangle")); - this->rect = NULL; + this->rect = nullptr; } } @@ -477,15 +477,15 @@ void RectTool::cancel(){ this->desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(this->desktop->acetate), 0); - if (this->rect != NULL) { + if (this->rect != nullptr) { this->rect->deleteObject(); - this->rect = NULL; + this->rect = nullptr; } this->within_tolerance = false; this->xp = 0; this->yp = 0; - this->item_to_select = NULL; + this->item_to_select = nullptr; this->desktop->canvas->endForcedFullRedraws(); diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b412812b6..90451e662 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -64,8 +64,8 @@ namespace Inkscape { namespace UI { namespace Tools { -static GdkCursor *CursorSelectMouseover = NULL; -static GdkCursor *CursorSelectDragging = NULL; +static GdkCursor *CursorSelectMouseover = nullptr; +static GdkCursor *CursorSelectDragging = nullptr; static gint rb_escaped = 0; // if non-zero, rubberband was canceled by esc, so the next button release should not deselect static gint drag_escaped = 0; // if non-zero, drag was canceled by esc @@ -89,17 +89,17 @@ sp_load_handles(int start, int count, char const **xpm) { SelectTool::SelectTool() // Don't load a default cursor - : ToolBase(NULL) + : ToolBase(nullptr) , dragging(false) , moved(false) , button_press_shift(false) , button_press_ctrl(false) , button_press_alt(false) , cycling_wrap(true) - , item(NULL) - , grabbed(NULL) - , _seltrans(NULL) - , _describer(NULL) + , item(nullptr) + , grabbed(nullptr) + , _seltrans(nullptr) + , _describer(nullptr) { // cursors in select context CursorSelectMouseover = sp_cursor_from_xpm(cursor_select_m_xpm); @@ -124,23 +124,23 @@ SelectTool::~SelectTool() { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } delete this->_seltrans; - this->_seltrans = NULL; + this->_seltrans = nullptr; delete this->_describer; - this->_describer = NULL; + this->_describer = nullptr; if (CursorSelectDragging) { g_object_unref(CursorSelectDragging); - CursorSelectDragging = NULL; + CursorSelectDragging = nullptr; } if (CursorSelectMouseover) { g_object_unref(CursorSelectMouseover); - CursorSelectMouseover = NULL; + CursorSelectMouseover = nullptr; } } @@ -195,14 +195,14 @@ bool SelectTool::sp_select_context_abort() { DocumentUndo::undo(desktop->getDocument()); } - sp_object_unref( this->item, NULL); + sp_object_unref( this->item, nullptr); } else if (this->button_press_ctrl) { // NOTE: This is a workaround to a bug. // When the ctrl key is held, sc->item is not defined // so in this case (only), we skip the object doc check DocumentUndo::undo(desktop->getDocument()); } - this->item = NULL; + this->item = nullptr; SP_EVENT_CONTEXT(this)->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Move canceled.")); return true; @@ -269,7 +269,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); // make sure we still have valid objects to move around - if (this->item && this->item->document == NULL) { + if (this->item && this->item->document == nullptr) { this->sp_select_context_abort(); } @@ -303,25 +303,25 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { // remember the clicked item in this->item: if (this->item) { - sp_object_unref(this->item, NULL); - this->item = NULL; + sp_object_unref(this->item, nullptr); + this->item = nullptr; } this->item = sp_event_context_find_item (desktop, Geom::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, FALSE); - sp_object_ref(this->item, NULL); + sp_object_ref(this->item, nullptr); rb_escaped = drag_escaped = 0; if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, event->button.time); - this->grabbed = NULL; + this->grabbed = nullptr; } sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->drawing), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, - NULL, event->button.time); + nullptr, event->button.time); this->grabbed = SP_CANVAS_ITEM(desktop->drawing); @@ -433,7 +433,7 @@ void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *sele this->cycling_cur_item = *next; g_assert(next != cycling_items.end()); - g_assert(cycling_cur_item != NULL); + g_assert(cycling_cur_item != nullptr); arenaitem = cycling_cur_item->get_arenaitem(desktop->dkey); arenaitem->setOpacity(1.0); @@ -457,19 +457,19 @@ void SelectTool::sp_select_context_reset_opacities() { } this->cycling_items_cmp.clear(); - this->cycling_cur_item = NULL; + this->cycling_cur_item = nullptr; } bool SelectTool::root_handler(GdkEvent* event) { - SPItem *item = NULL; - SPItem *item_at_point = NULL, *group_at_point = NULL, *item_in_group = NULL; + SPItem *item = nullptr; + SPItem *item_at_point = nullptr, *group_at_point = nullptr, *item_in_group = nullptr; gint ret = FALSE; Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // make sure we still have valid objects to move around - if (this->item && this->item->document == NULL) { + if (this->item && this->item->document == nullptr) { this->sp_select_context_abort(); } @@ -517,12 +517,12 @@ bool SelectTool::root_handler(GdkEvent* event) { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, event->button.time); - this->grabbed = NULL; + this->grabbed = nullptr; } sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, - NULL, event->button.time); + nullptr, event->button.time); this->grabbed = SP_CANVAS_ITEM(desktop->acetate); @@ -605,7 +605,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (group_at_point != item_in_group && !(group_at_point && item_at_point && group_at_point->isAncestorOf(item_at_point))) { - group_at_point = NULL; + group_at_point = nullptr; } // if neither a group nor an item (possibly in a group) at point are selected, set selection to the item at point @@ -703,10 +703,10 @@ bool SelectTool::root_handler(GdkEvent* event) { desktop->canvas->endForcedFullRedraws(); if (this->item) { - sp_object_unref( this->item, NULL); + sp_object_unref( this->item, nullptr); } - this->item = NULL; + this->item = nullptr; } else { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); @@ -753,7 +753,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (item) { selection->toggle(item); - item = NULL; + item = nullptr; } } else if ((this->button_press_ctrl || this->button_press_alt) && !rb_escaped && !drag_escaped) { // ctrl+click, alt+click @@ -771,7 +771,7 @@ bool SelectTool::root_handler(GdkEvent* event) { selection->set(item); } - item = NULL; + item = nullptr; } } else { // click without shift, simply deselect, unless with Alt or something was cancelled if (!selection->isEmpty()) { @@ -789,7 +789,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, event->button.time); - this->grabbed = NULL; + this->grabbed = nullptr; } desktop->updateNow(); @@ -816,11 +816,11 @@ bool SelectTool::root_handler(GdkEvent* event) { /* Rebuild list of items underneath the mouse pointer */ Geom::Point p = desktop->d2w(desktop->point()); - SPItem *item = desktop->getItemAtPoint(p, true, NULL); + SPItem *item = desktop->getItemAtPoint(p, true, nullptr); this->cycling_items.clear(); - SPItem *tmp = NULL; - while(item != NULL) { + SPItem *tmp = nullptr; + while(item != nullptr) { this->cycling_items.push_back(item); item = desktop->getItemAtPoint(p, true, item); if (selection->includes(item)) tmp = item; diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp index 61ee1026b..4b7743678 100644 --- a/src/ui/tools/spiral-tool.cpp +++ b/src/ui/tools/spiral-tool.cpp @@ -56,7 +56,7 @@ const std::string SpiralTool::prefsPath = "/tools/shapes/spiral"; SpiralTool::SpiralTool() : ToolBase(cursor_spiral_xpm) - , spiral(NULL) + , spiral(nullptr) , revo(3) , exp(1) , t0(0) @@ -80,7 +80,7 @@ SpiralTool::~SpiralTool() { this->sel_changed_connection.disconnect(); delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; /* fixme: This is necessary because we do not grab */ if (this->spiral) { @@ -168,7 +168,7 @@ bool SpiralTool::root_handler(GdkEvent* event) { GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK ), - NULL, event->button.time); + nullptr, event->button.time); ret = TRUE; } break; @@ -229,7 +229,7 @@ bool SpiralTool::root_handler(GdkEvent* event) { selection->clear(); } - this->item_to_select = NULL; + this->item_to_select = nullptr; ret = TRUE; sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); } @@ -246,7 +246,7 @@ bool SpiralTool::root_handler(GdkEvent* event) { case GDK_KEY_Meta_R: sp_event_show_modifier_tip(this->defaultMessageContext(), event, _("<b>Ctrl</b>: snap angle"), - NULL, + nullptr, _("<b>Alt</b>: lock spiral radius")); break; @@ -385,7 +385,7 @@ void SpiralTool::drag(Geom::Point const &p, guint state) { void SpiralTool::finishItem() { this->message_context->clear(); - if (this->spiral != NULL) { + if (this->spiral != nullptr) { if (this->spiral->rad == 0) { this->cancel(); // Don't allow the creating of zero sized spiral, for example when the start and and point snap to the snap grid point return; @@ -393,7 +393,7 @@ void SpiralTool::finishItem() { spiral->set_shape(); spiral->updateRepr(SP_OBJECT_WRITE_EXT); - spiral->doWriteTransform(spiral->transform, NULL, true); + spiral->doWriteTransform(spiral->transform, nullptr, true); this->desktop->canvas->endForcedFullRedraws(); @@ -401,7 +401,7 @@ void SpiralTool::finishItem() { DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPIRAL, _("Create spiral")); - this->spiral = NULL; + this->spiral = nullptr; } } @@ -409,15 +409,15 @@ void SpiralTool::cancel() { this->desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(this->desktop->acetate), 0); - if (this->spiral != NULL) { + if (this->spiral != nullptr) { this->spiral->deleteObject(); - this->spiral = NULL; + this->spiral = nullptr; } this->within_tolerance = false; this->xp = 0; this->yp = 0; - this->item_to_select = NULL; + this->item_to_select = nullptr; this->desktop->canvas->endForcedFullRedraws(); diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 603d5e80a..ebfc10d8a 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -154,7 +154,7 @@ SprayTool::SprayTool() , is_drawing(false) , is_dilating(false) , has_dilated(false) - , dilate_area(NULL) + , dilate_area(nullptr) , no_overlap(false) , picker(false) , pick_center(true) @@ -184,13 +184,13 @@ SprayTool::~SprayTool() { if (this->dilate_area) { sp_canvas_item_destroy(this->dilate_area); - this->dilate_area = NULL; + this->dilate_area = nullptr; } } void SprayTool::update_cursor(bool /*with_shift*/) { guint num = 0; - gchar *sel_message = NULL; + gchar *sel_message = nullptr; if (!desktop->selection->isEmpty()) { num = (guint) boost::distance(desktop->selection->items()); @@ -418,7 +418,7 @@ static void random_position(double &radius, double &angle, double &a, double &s, } static void sp_spray_transform_path(SPItem * item, Geom::Path &path, Geom::Affine affine, Geom::Point center){ - path *= i2anc_affine(static_cast<SPItem *>(item->parent), NULL).inverse(); + path *= i2anc_affine(static_cast<SPItem *>(item->parent), nullptr).inverse(); path *= item->transform.inverse(); Geom::Affine dt2p; if (item->parent) { @@ -429,7 +429,7 @@ static void sp_spray_transform_path(SPItem * item, Geom::Path &path, Geom::Affin } Geom::Affine i2dt = item->i2dt_affine() * Geom::Translate(center).inverse() * affine * Geom::Translate(center); path *= i2dt * dt2p; - path *= i2anc_affine(static_cast<SPItem *>(item->parent), NULL); + path *= i2anc_affine(static_cast<SPItem *>(item->parent), nullptr); } /** @@ -1144,13 +1144,13 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end(); ++i){ SPItem *item = *i; - g_assert(item != NULL); + g_assert(item != nullptr); sp_object_ref(item); } for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end(); ++i){ SPItem *item = *i; - g_assert(item != NULL); + g_assert(item != nullptr); if (sp_spray_recursive(desktop , set , item @@ -1194,7 +1194,7 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end(); ++i){ SPItem *item = *i; - g_assert(item != NULL); + g_assert(item != nullptr); sp_object_unref(item); } } diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index 3a5615c3b..5c0111012 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -61,7 +61,7 @@ const std::string StarTool::prefsPath = "/tools/shapes/star"; StarTool::StarTool() : ToolBase(cursor_star_xpm) - , star(NULL) + , star(nullptr) , magnitude(5) , proportion(0.5) , isflatsided(false) @@ -85,7 +85,7 @@ StarTool::~StarTool() { this->sel_changed_connection.disconnect(); delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; /* fixme: This is necessary because we do not grab */ if (this->star) { @@ -100,7 +100,7 @@ StarTool::~StarTool() { * @param selection Should not be NULL. */ void StarTool::selection_changed(Inkscape::Selection* selection) { - g_assert (selection != NULL); + g_assert (selection != nullptr); this->shape_editor->unset_item(); this->shape_editor->set_item(selection->singleItem()); @@ -183,7 +183,7 @@ bool StarTool::root_handler(GdkEvent* event) { GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, - NULL, event->button.time); + nullptr, event->button.time); ret = TRUE; } break; @@ -242,7 +242,7 @@ bool StarTool::root_handler(GdkEvent* event) { selection->clear(); } - this->item_to_select = NULL; + this->item_to_select = nullptr; ret = TRUE; sp_canvas_item_ungrab(SP_CANVAS_ITEM (desktop->acetate), event->button.time); } @@ -259,8 +259,8 @@ bool StarTool::root_handler(GdkEvent* event) { case GDK_KEY_Meta_R: sp_event_show_modifier_tip(this->defaultMessageContext(), event, _("<b>Ctrl</b>: snap angle; keep rays radial"), - NULL, - NULL); + nullptr, + nullptr); break; case GDK_KEY_x: @@ -403,7 +403,7 @@ void StarTool::drag(Geom::Point p, guint state) void StarTool::finishItem() { this->message_context->clear(); - if (this->star != NULL) { + if (this->star != nullptr) { if (this->star->r[1] == 0) { // Don't allow the creating of zero sized arc, for example // when the start and and point snap to the snap grid point @@ -416,14 +416,14 @@ void StarTool::finishItem() { this->star->setCenter(this->center); this->star->set_shape(); this->star->updateRepr(SP_OBJECT_WRITE_EXT); - this->star->doWriteTransform(this->star->transform, NULL, true); + this->star->doWriteTransform(this->star->transform, nullptr, true); desktop->canvas->endForcedFullRedraws(); desktop->getSelection()->set(this->star); DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Create star")); - this->star = NULL; + this->star = nullptr; } } @@ -431,15 +431,15 @@ void StarTool::cancel() { desktop->getSelection()->clear(); sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0); - if (this->star != NULL) { + if (this->star != nullptr) { this->star->deleteObject(); - this->star = NULL; + this->star = nullptr; } this->within_tolerance = false; this->xp = 0; this->yp = 0; - this->item_to_select = NULL; + this->item_to_select = nullptr; desktop->canvas->endForcedFullRedraws(); diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 8db6c323c..f4f20ef30 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -81,14 +81,14 @@ const std::string TextTool::prefsPath = "/tools/text"; TextTool::TextTool() : ToolBase(cursor_text_xpm) - , imc(NULL) - , text(NULL) + , imc(nullptr) + , text(nullptr) , pdoc(0, 0) , unimode(false) , unipos(0) - , cursor(NULL) - , indicator(NULL) - , frame(NULL) + , cursor(nullptr) + , indicator(nullptr) + , frame(nullptr) , timeout(0) , show(false) , phase(false) @@ -96,18 +96,18 @@ TextTool::TextTool() , over_text(false) , dragging(0) , creating(false) - , grabbed(NULL) - , preedit_string(NULL) + , grabbed(nullptr) + , preedit_string(nullptr) { } TextTool::~TextTool() { delete this->shape_editor; - this->shape_editor = NULL; + this->shape_editor = nullptr; if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } Inkscape::Rubberband::get(this->desktop)->stop(); @@ -128,13 +128,13 @@ void TextTool::setup() { this->cursor->setRgba32(0x000000ff); sp_canvas_item_hide(this->cursor); - this->indicator = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRLRECT, NULL); + this->indicator = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRLRECT, nullptr); SP_CTRLRECT(this->indicator)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100))); SP_CTRLRECT(this->indicator)->setColor(0x0000ff7f, false, 0); SP_CTRLRECT(this->indicator)->setShadow(1, 0xffffff7f); sp_canvas_item_hide(this->indicator); - this->frame = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRLRECT, NULL); + this->frame = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRLRECT, nullptr); SP_CTRLRECT(this->frame)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100))); SP_CTRLRECT(this->frame)->setColor(0x0000ff7f, false, 0); sp_canvas_item_hide(this->frame); @@ -160,7 +160,7 @@ void TextTool::setup() { g_signal_connect(G_OBJECT(this->imc), "commit", G_CALLBACK(sptc_commit), this); if (gtk_widget_has_focus(canvas)) { - sptc_focus_in(canvas, NULL, this); + sptc_focus_in(canvas, nullptr, this); } } @@ -213,7 +213,7 @@ void TextTool::finish() { if (this->imc) { g_object_unref(G_OBJECT(this->imc)); - this->imc = NULL; + this->imc = nullptr; } if (this->timeout) { @@ -223,17 +223,17 @@ void TextTool::finish() { if (this->cursor) { sp_canvas_item_destroy(this->cursor); - this->cursor = NULL; + this->cursor = nullptr; } if (this->indicator) { sp_canvas_item_destroy(this->indicator); - this->indicator = NULL; + this->indicator = nullptr; } if (this->frame) { sp_canvas_item_destroy(this->frame); - this->frame = NULL; + this->frame = nullptr; } for (std::vector<SPCanvasItem*>::iterator it = this->text_selection_quads.begin() ; @@ -406,12 +406,12 @@ static void sp_text_context_setup_text(TextTool *tc) /* Create <tspan> */ Inkscape::XML::Node *rtspan = xml_doc->createElement("svg:tspan"); rtspan->setAttribute("sodipodi:role", "line"); // otherwise, why bother creating the tspan? - rtext->addChild(rtspan, NULL); + rtext->addChild(rtspan, nullptr); Inkscape::GC::release(rtspan); /* Create TEXT */ Inkscape::XML::Node *rstring = xml_doc->createTextNode(""); - rtspan->addChild(rstring, NULL); + rtspan->addChild(rstring, nullptr); Inkscape::GC::release(rstring); SPItem *text_item = SP_ITEM(ec->desktop->currentLayer()->appendChildRepr(rtext)); /* fixme: Is selection::changed really immediate? */ @@ -421,7 +421,7 @@ static void sp_text_context_setup_text(TextTool *tc) text_item->transform = SP_ITEM(ec->desktop->currentLayer())->i2doc_affine().inverse(); text_item->updateRepr(); - text_item->doWriteTransform(text_item->transform, NULL, true); + text_item->doWriteTransform(text_item->transform, nullptr, true); DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Create text")); } @@ -537,7 +537,7 @@ bool TextTool::root_handler(GdkEvent* event) { Inkscape::Rubberband::get(desktop)->start(desktop, this->p0); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, - NULL, event->button.time); + nullptr, event->button.time); this->grabbed = SP_CANVAS_ITEM(desktop->acetate); this->creating = 1; @@ -605,7 +605,7 @@ bool TextTool::root_handler(GdkEvent* event) { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } Inkscape::Rubberband::get(desktop)->stop(); @@ -1098,7 +1098,7 @@ bool TextTool::root_handler(GdkEvent* event) { this->creating = 0; if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } Inkscape::Rubberband::get(desktop)->stop(); } else { @@ -1220,7 +1220,7 @@ bool TextTool::root_handler(GdkEvent* event) { this->creating = 0; if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } Inkscape::Rubberband::get(desktop)->stop(); } @@ -1332,7 +1332,7 @@ Glib::ustring sp_text_get_selected_text(ToolBase const *ec) if (!SP_IS_TEXT_CONTEXT(ec)) return ""; TextTool const *tc = SP_TEXT_CONTEXT(ec); - if (tc->text == NULL) + if (tc->text == nullptr) return ""; return sp_te_get_string_multiline(tc->text, tc->text_sel_start, tc->text_sel_end); @@ -1341,10 +1341,10 @@ Glib::ustring sp_text_get_selected_text(ToolBase const *ec) SPCSSAttr *sp_text_get_style_at_cursor(ToolBase const *ec) { if (!SP_IS_TEXT_CONTEXT(ec)) - return NULL; + return nullptr; TextTool const *tc = SP_TEXT_CONTEXT(ec); - if (tc->text == NULL) - return NULL; + if (tc->text == nullptr) + return nullptr; SPObject const *obj = sp_te_object_at_position(tc->text, tc->text_sel_end); @@ -1352,7 +1352,7 @@ SPCSSAttr *sp_text_get_style_at_cursor(ToolBase const *ec) return take_style_from_item(const_cast<SPObject*>(obj)); } - return NULL; + return nullptr; } static bool css_attrs_are_equal(SPCSSAttr const *first, SPCSSAttr const *second) @@ -1360,13 +1360,13 @@ static bool css_attrs_are_equal(SPCSSAttr const *first, SPCSSAttr const *second) Inkscape::Util::List<Inkscape::XML::AttributeRecord const> attrs = first->attributeList(); for ( ; attrs ; attrs++) { gchar const *other_attr = second->attribute(g_quark_to_string(attrs->key)); - if (other_attr == NULL || strcmp(attrs->value, other_attr)) + if (other_attr == nullptr || strcmp(attrs->value, other_attr)) return false; } attrs = second->attributeList(); for ( ; attrs ; attrs++) { gchar const *other_attr = first->attribute(g_quark_to_string(attrs->key)); - if (other_attr == NULL || strcmp(attrs->value, other_attr)) + if (other_attr == nullptr || strcmp(attrs->value, other_attr)) return false; } return true; @@ -1417,7 +1417,7 @@ bool sp_text_delete_selection(ToolBase *ec) if (!SP_IS_TEXT_CONTEXT(ec)) return false; TextTool *tc = SP_TEXT_CONTEXT(ec); - if (tc->text == NULL) + if (tc->text == nullptr) return false; if (tc->text_sel_start == tc->text_sel_end) @@ -1445,7 +1445,7 @@ bool sp_text_delete_selection(ToolBase *ec) */ void TextTool::_selectionChanged(Inkscape::Selection *selection) { - g_assert(selection != NULL); + g_assert(selection != nullptr); ToolBase *ec = SP_EVENT_CONTEXT(this); @@ -1458,7 +1458,7 @@ void TextTool::_selectionChanged(Inkscape::Selection *selection) if (this->text && (item != this->text)) { sp_text_context_forget_text(this); } - this->text = NULL; + this->text = nullptr; if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { this->text = item; @@ -1466,7 +1466,7 @@ void TextTool::_selectionChanged(Inkscape::Selection *selection) if (layout) this->text_sel_start = this->text_sel_end = layout->end(); } else { - this->text = NULL; + this->text = nullptr; } // we update cursor without scrolling, because this position may not be final; @@ -1483,7 +1483,7 @@ void TextTool::_selectionModified(Inkscape::Selection */*selection*/, guint /*fl bool TextTool::_styleSet(SPCSSAttr const *css) { - if (this->text == NULL) + if (this->text == nullptr) return false; if (this->text_sel_start == this->text_sel_end) return false; // will get picked up by the parent and applied to the whole text object @@ -1498,11 +1498,11 @@ bool TextTool::_styleSet(SPCSSAttr const *css) int TextTool::_styleQueried(SPStyle *style, int property) { - if (this->text == NULL) { + if (this->text == nullptr) { return QUERY_STYLE_NOTHING; } const Inkscape::Text::Layout *layout = te_get_layout(this->text); - if (layout == NULL) { + if (layout == nullptr) { return QUERY_STYLE_NOTHING; } sp_text_context_validate_cursor_iterators(this); @@ -1523,8 +1523,8 @@ int TextTool::_styleQueried(SPStyle *style, int property) } } for (Inkscape::Text::Layout::iterator it = begin_it ; it < end_it ; it.nextStartOfSpan()) { - SPObject *pos_obj = 0; - void *rawptr = 0; + SPObject *pos_obj = nullptr; + void *rawptr = nullptr; layout->getSourceOfCharacter(it, &rawptr); if (!rawptr || !SP_IS_OBJECT(rawptr)) { continue; @@ -1543,7 +1543,7 @@ int TextTool::_styleQueried(SPStyle *style, int property) static void sp_text_context_validate_cursor_iterators(TextTool *tc) { - if (tc->text == NULL) + if (tc->text == nullptr) return; Inkscape::Text::Layout const *layout = te_get_layout(tc->text); if (layout) { // undo can change the text length without us knowing it @@ -1602,7 +1602,7 @@ static void sp_text_context_update_cursor(TextTool *tc, bool scroll_to_see) trunc = _(" [truncated]"); } if (SP_IS_FLOWTEXT(tc->text)) { - SPItem *frame = SP_FLOWTEXT(tc->text)->get_frame (NULL); // first frame only + SPItem *frame = SP_FLOWTEXT(tc->text)->get_frame (nullptr); // first frame only if (frame) { if (truncated) { SP_CTRLRECT(tc->frame)->setColor(0xff0000ff, false, 0); @@ -1646,11 +1646,11 @@ static void sp_text_context_update_text_selection(TextTool *tc) tc->text_selection_quads.clear(); std::vector<Geom::Point> quads; - if (tc->text != NULL) + if (tc->text != nullptr) quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, (tc->text)->i2dt_affine()); for (unsigned i = 0 ; i < quads.size() ; i += 4) { SPCanvasItem *quad_canvasitem; - quad_canvasitem = sp_canvas_item_new(tc->desktop->getControls(), SP_TYPE_CTRLQUADR, NULL); + quad_canvasitem = sp_canvas_item_new(tc->desktop->getControls(), SP_TYPE_CTRLQUADR, nullptr); // FIXME: make the color settable in prefs // for now, use semitrasparent blue, as cairo cannot do inversion :( sp_ctrlquadr_set_rgba32(SP_CTRLQUADR(quad_canvasitem), 0x00777777); @@ -1683,7 +1683,7 @@ static void sp_text_context_forget_text(TextTool *tc) (void)ti; /* We have to set it to zero, * or selection changed signal messes everything up */ - tc->text = NULL; + tc->text = nullptr; /* FIXME: this automatic deletion when nothing is inputted crashes the XML edittor and also crashes when duplicating an empty flowtext. So don't create an empty flowtext in the first place? Create it when first character is typed. @@ -1748,7 +1748,7 @@ void sp_text_context_place_cursor_at (TextTool *tc, SPObject *text, Geom::Point Inkscape::Text::Layout::iterator *sp_text_context_get_cursor_position(TextTool *tc, SPObject *text) { if (text != tc->text) - return NULL; + return nullptr; return &(tc->text_sel_end); } diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index ce319009b..e45d30994 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -99,21 +99,21 @@ SPDesktop const& ToolBase::getDesktop() const { } ToolBase::ToolBase(gchar const *const *cursor_shape, bool uses_snap) - : pref_observer(NULL) - , cursor(NULL) + : pref_observer(nullptr) + , cursor(nullptr) , xp(0) , yp(0) , tolerance(0) , within_tolerance(false) - , item_to_select(NULL) - , message_context(NULL) - , _selcue(NULL) - , _grdrag(NULL) - , shape_editor(NULL) + , item_to_select(nullptr) + , message_context(nullptr) + , _selcue(nullptr) + , _grdrag(nullptr) + , shape_editor(nullptr) , space_panning(false) - , _delayed_snap_event(NULL) + , _delayed_snap_event(nullptr) , _dse_callback_in_process(false) - , desktop(NULL) + , desktop(nullptr) , _uses_snap(uses_snap) , cursor_shape(cursor_shape) { @@ -125,7 +125,7 @@ ToolBase::~ToolBase() { } if (this->desktop) { - this->desktop = NULL; + this->desktop = nullptr; } if (this->pref_observer) { @@ -388,7 +388,7 @@ bool ToolBase::root_handler(GdkEvent* event) { sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK, NULL, + | GDK_POINTER_MOTION_HINT_MASK, nullptr, event->button.time - 1); ret = TRUE; @@ -408,7 +408,7 @@ bool ToolBase::root_handler(GdkEvent* event) { GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - NULL, event->button.time ); + nullptr, event->button.time ); // sp_canvas_item_hide (desktop->drawing); } else if (event->button.state & GDK_SHIFT_MASK) { @@ -423,7 +423,7 @@ bool ToolBase::root_handler(GdkEvent* event) { sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, - NULL, event->button.time - 1); + nullptr, event->button.time - 1); } @@ -440,12 +440,12 @@ bool ToolBase::root_handler(GdkEvent* event) { sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK, NULL, + | GDK_POINTER_MOTION_HINT_MASK, nullptr, event->button.time); ret = TRUE; } else { - sp_event_root_menu_popup(desktop, NULL, event); + sp_event_root_menu_popup(desktop, nullptr, event); } break; @@ -465,7 +465,7 @@ bool ToolBase::root_handler(GdkEvent* event) { sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK, NULL, + | GDK_POINTER_MOTION_HINT_MASK, nullptr, event->motion.time - 1); } @@ -625,7 +625,7 @@ bool ToolBase::root_handler(GdkEvent* event) { case GDK_KEY_F4: /* Close view */ if (MOD__CTRL_ONLY(event)) { - sp_ui_close_view(NULL); + sp_ui_close_view(nullptr); ret = TRUE; } break; @@ -691,13 +691,13 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case GDK_KEY_Menu: - sp_event_root_menu_popup(desktop, NULL, event); + sp_event_root_menu_popup(desktop, nullptr, event); ret = TRUE; break; case GDK_KEY_F10: if (MOD__SHIFT_ONLY(event)) { - sp_event_root_menu_popup(desktop, NULL, event); + sp_event_root_menu_popup(desktop, nullptr, event); ret = TRUE; } break; @@ -935,7 +935,7 @@ void ToolBase::enableSelectionCue(bool enable) { } } else { delete _selcue; - _selcue = NULL; + _selcue = nullptr; } } @@ -950,7 +950,7 @@ void ToolBase::enableGrDrag(bool enable) { } else { if (_grdrag) { delete _grdrag; - _grdrag = NULL; + _grdrag = nullptr; } } } @@ -972,9 +972,9 @@ bool ToolBase::deleteSelectedDrag(bool just_one) { * Calls virtual set() function of ToolBase. */ void sp_event_context_read(ToolBase *ec, gchar const *key) { - g_return_if_fail(ec != NULL); + g_return_if_fail(ec != nullptr); g_return_if_fail(SP_IS_EVENT_CONTEXT(ec)); - g_return_if_fail(key != NULL); + g_return_if_fail(key != nullptr); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Preferences::Entry val = prefs->getEntry(ec->pref_observer->observed_path + '/' + key); @@ -993,7 +993,7 @@ gint sp_event_context_root_handler(ToolBase * event_context, switch (event->type) { case GDK_MOTION_NOTIFY: - sp_event_context_snap_delay_handler(event_context, NULL, NULL, + sp_event_context_snap_delay_handler(event_context, nullptr, nullptr, (GdkEventMotion *) event, DelayedSnapEvent::EVENTCONTEXT_ROOT_HANDLER); break; @@ -1048,7 +1048,7 @@ gint sp_event_context_item_handler(ToolBase * event_context, switch (event->type) { case GDK_MOTION_NOTIFY: - sp_event_context_snap_delay_handler(event_context, (gpointer) item, NULL, (GdkEventMotion *) event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER); + sp_event_context_snap_delay_handler(event_context, (gpointer) item, nullptr, (GdkEventMotion *) event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER); break; case GDK_BUTTON_RELEASE: if (event_context && event_context->_delayed_snap_event) { @@ -1205,7 +1205,7 @@ guint get_latin_keyval(GdkEventKey const *event, guint *consumed_modifiers /*= N gdk_keymap_translate_keyboard_state( Gdk::Display::get_default()->get_keymap(), event->hardware_keycode, (GdkModifierType) event->state, group, - &keyval, NULL, NULL, &modifiers); + &keyval, nullptr, nullptr, &modifiers); if (consumed_modifiers) { *consumed_modifiers = modifiers; @@ -1222,18 +1222,18 @@ guint get_latin_keyval(GdkEventKey const *event, guint *consumed_modifiers /*= N SPItem *sp_event_context_find_item(SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups) { - SPItem *item = 0; + SPItem *item = nullptr; if (select_under) { auto tmp = desktop->selection->items(); std::vector<SPItem *> vec(tmp.begin(), tmp.end()); SPItem *selected_at_point = desktop->getItemFromListAtPointBottom(vec, p); item = desktop->getItemAtPoint(p, into_groups, selected_at_point); - if (item == NULL) { // we may have reached bottom, flip over to the top - item = desktop->getItemAtPoint(p, into_groups, NULL); + if (item == nullptr) { // we may have reached bottom, flip over to the top + item = desktop->getItemAtPoint(p, into_groups, nullptr); } } else { - item = desktop->getItemAtPoint(p, into_groups, NULL); + item = desktop->getItemAtPoint(p, into_groups, nullptr); } return item; @@ -1327,14 +1327,14 @@ void sp_event_context_snap_delay_handler(ToolBase *ec, // But if we're really standing still, then we should snap now. We could use some low-pass filtering, // otherwise snapping occurs for each jitter movement. For this filtering we'll leave the watchdog to expire, // snap, and set a new watchdog again. - if (ec->_delayed_snap_event == NULL) { // no watchdog has been set + if (ec->_delayed_snap_event == nullptr) { // no watchdog has been set // it might have already expired, so we'll set a new one; the snapping frequency will be limited this way ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); } // else: watchdog has been set before and we'll wait for it to expire } } else { // This is the first GDK_MOTION_NOTIFY event, so postpone snapping and set the watchdog - g_assert(ec->_delayed_snap_event == NULL); + g_assert(ec->_delayed_snap_event == nullptr); ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); } @@ -1351,19 +1351,19 @@ gboolean sp_event_context_snap_watchdog_callback(gpointer data) { // Snap NOW! For this the "postponed" flag will be reset and the last motion event will be repeated DelayedSnapEvent *dse = reinterpret_cast<DelayedSnapEvent*> (data); - if (dse == NULL) { + if (dse == nullptr) { // This might occur when this method is called directly, i.e. not through the timer // E.g. on GDK_BUTTON_RELEASE in sp_event_context_root_handler() return FALSE; } ToolBase *ec = dse->getEventContext(); - if (ec == NULL) { + if (ec == nullptr) { delete dse; return false; } - if (ec->desktop == NULL) { - ec->_delayed_snap_event = NULL; + if (ec->desktop == nullptr) { + ec->_delayed_snap_event = nullptr; delete dse; return false; } @@ -1399,7 +1399,7 @@ gboolean sp_event_context_snap_watchdog_callback(gpointer data) { gpointer pitem2 = dse->getItem2(); if (!pitem2) { - ec->_delayed_snap_event = NULL; + ec->_delayed_snap_event = nullptr; delete dse; return false; } @@ -1448,7 +1448,7 @@ gboolean sp_event_context_snap_watchdog_callback(gpointer data) { break; } - ec->_delayed_snap_event = NULL; + ec->_delayed_snap_event = nullptr; delete dse; ec->_dse_callback_in_process = false; @@ -1458,7 +1458,7 @@ gboolean sp_event_context_snap_watchdog_callback(gpointer data) { void sp_event_context_discard_delayed_snap_event(ToolBase *ec) { delete ec->_delayed_snap_event; - ec->_delayed_snap_event = NULL; + ec->_delayed_snap_event = nullptr; ec->desktop->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(false); } diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h index cb08e67b4..1696c6453 100644 --- a/src/ui/tools/tool-base.h +++ b/src/ui/tools/tool-base.h @@ -68,7 +68,7 @@ public: DelayedSnapEvent(ToolBase *event_context, gpointer const dse_item, gpointer dse_item2, GdkEventMotion const *event, DelayedSnapEvent::DelayedSnapEventOrigin const origin) : _timer_id(0) - , _event(NULL) + , _event(nullptr) , _item(dse_item) , _item2(dse_item2) , _origin(origin) @@ -90,7 +90,7 @@ public: ~DelayedSnapEvent() { if (_timer_id > 0) g_source_remove(_timer_id); // Kill the watchdog - if (_event != NULL) gdk_event_free(_event); // Remove the copy of the original event + if (_event != nullptr) gdk_event_free(_event); // Remove the copy of the original event } ToolBase* getEventContext() { @@ -253,7 +253,7 @@ void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context, GdkEv gchar const *ctrl_tip, gchar const *shift_tip, gchar const *alt_tip); void init_latin_keys_group(); -guint get_latin_keyval(GdkEventKey const *event, guint *consumed_modifiers = NULL); +guint get_latin_keyval(GdkEventKey const *event, guint *consumed_modifiers = nullptr); SPItem *sp_event_context_find_item (SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups); SPItem *sp_event_context_over_item (SPDesktop *desktop, SPItem *item, Geom::Point const &p); diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 6698316c7..f6b10d67a 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -104,7 +104,7 @@ TweakTool::TweakTool() , is_drawing(false) , is_dilating(false) , has_dilated(false) - , dilate_area(NULL) + , dilate_area(nullptr) , do_h(true) , do_s(true) , do_l(true) @@ -119,7 +119,7 @@ TweakTool::~TweakTool() { if (this->dilate_area) { sp_canvas_item_destroy(this->dilate_area); - this->dilate_area = NULL; + this->dilate_area = nullptr; } } @@ -140,7 +140,7 @@ static bool is_color_mode (gint mode) void TweakTool::update_cursor (bool with_shift) { guint num = 0; - gchar *sel_message = NULL; + gchar *sel_message = nullptr; if (!desktop->selection->isEmpty()) { num = (guint) boost::distance(desktop->selection->items()); @@ -369,7 +369,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P sp_item_list_to_curves (items, selected, to_select); SPObject* newObj = doc->getObjectByRepr(to_select[0]); item = dynamic_cast<SPItem *>(newObj); - g_assert(item != NULL); + g_assert(item != nullptr); selection->add(item); } @@ -383,7 +383,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P for (auto i = children.rbegin(); i!= children.rend(); ++i) { SPItem *child = *i; - g_assert(child != NULL); + g_assert(child != nullptr); if (sp_tweak_dilate_recursive (selection, child, p, vector, mode, radius, force, fidelity, reverse)) { did = true; } @@ -490,10 +490,10 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P } else if (dynamic_cast<SPPath *>(item) || dynamic_cast<SPShape *>(item)) { - Inkscape::XML::Node *newrepr = NULL; + Inkscape::XML::Node *newrepr = nullptr; gint pos = 0; - Inkscape::XML::Node *parent = NULL; - char const *id = NULL; + Inkscape::XML::Node *parent = nullptr; + char const *id = nullptr; if (!dynamic_cast<SPPath *>(item)) { newrepr = sp_selected_item_to_curved_repr(item, 0); if (!newrepr) { @@ -518,7 +518,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P } Path *orig = Path_for_item(item, false); - if (orig == NULL) { + if (orig == nullptr) { return false; } @@ -533,7 +533,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P orig->Fill(theShape, 0); SPCSSAttr *css = sp_repr_css_attr(item->getRepr(), "style"); - gchar const *val = sp_repr_css_property(css, "fill-rule", NULL); + gchar const *val = sp_repr_css_property(css, "fill-rule", nullptr); if (val && strcmp(val, "nonzero") == 0) { theRes->ConvertToShape(theShape, fill_nonZero); } else if (val && strcmp(val, "evenodd") == 0) { @@ -624,7 +624,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (newrepr) { Inkscape::GC::release(newrepr); - newrepr = NULL; + newrepr = nullptr; } } @@ -818,7 +818,7 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or double offset_l = 0; double offset_h = 0; - SPObject *child_prev = NULL; + SPObject *child_prev = nullptr; for (auto& child: vector->children) { SPStop *stop = dynamic_cast<SPStop *>(&child); if (!stop) { @@ -829,7 +829,7 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or if (child_prev) { SPStop *prevStop = dynamic_cast<SPStop *>(child_prev); - g_assert(prevStop != NULL); + g_assert(prevStop != nullptr); if (offset_h - offset_l > r && pos_e >= offset_l && pos_e <= offset_h) { // the summit falls in this interstop, and the radius is small, diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp index 6f7fca242..dcd6eac80 100644 --- a/src/ui/tools/zoom-tool.cpp +++ b/src/ui/tools/zoom-tool.cpp @@ -37,7 +37,7 @@ const std::string ZoomTool::prefsPath = "/tools/zoom"; ZoomTool::ZoomTool() : ToolBase(cursor_zoom_xpm) - , grabbed(NULL) + , grabbed(nullptr) , escaped(false) { } @@ -50,7 +50,7 @@ void ZoomTool::finish() { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, GDK_CURRENT_TIME); - this->grabbed = NULL; + this->grabbed = nullptr; } ToolBase::finish(); @@ -108,7 +108,7 @@ bool ZoomTool::root_handler(GdkEvent* event) { GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, - NULL, event->button.time); + nullptr, event->button.time); this->grabbed = SP_CANVAS_ITEM(desktop->acetate); break; @@ -160,7 +160,7 @@ bool ZoomTool::root_handler(GdkEvent* event) { if (this->grabbed) { sp_canvas_item_ungrab(this->grabbed, event->button.time); - this->grabbed = NULL; + this->grabbed = nullptr; } xp = yp = 0; diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index 5412d1fef..5256ecf88 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -74,7 +74,7 @@ static Glib::ustring getLayoutPrefPath( Inkscape::UI::View::View *view ) namespace Inkscape { namespace UI { -UXManager* instance = 0; +UXManager* instance = nullptr; class UXManagerImpl : public UXManager { diff --git a/src/ui/view/view-widget.cpp b/src/ui/view/view-widget.cpp index 671a4afe6..fec18845b 100644 --- a/src/ui/view/view-widget.cpp +++ b/src/ui/view/view-widget.cpp @@ -34,7 +34,7 @@ static void sp_view_widget_class_init(SPViewWidgetClass *vwc) */ static void sp_view_widget_init(SPViewWidget *vw) { - vw->view = NULL; + vw->view = nullptr; } /** @@ -49,7 +49,7 @@ static void sp_view_widget_dispose(GObject *object) if (vw->view) { vw->view->close(); Inkscape::GC::release(vw->view); - vw->view = NULL; + vw->view = nullptr; } if (G_OBJECT_CLASS(sp_view_widget_parent_class)->dispose) { @@ -61,11 +61,11 @@ static void sp_view_widget_dispose(GObject *object) void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view) { - g_return_if_fail(vw != NULL); + g_return_if_fail(vw != nullptr); g_return_if_fail(SP_IS_VIEW_WIDGET(vw)); - g_return_if_fail(view != NULL); + g_return_if_fail(view != nullptr); - g_return_if_fail(vw->view == NULL); + g_return_if_fail(vw->view == nullptr); vw->view = view; Inkscape::GC::anchor(view); @@ -77,7 +77,7 @@ void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view) bool sp_view_widget_shutdown(SPViewWidget *vw) { - g_return_val_if_fail(vw != NULL, TRUE); + g_return_val_if_fail(vw != nullptr, TRUE); g_return_val_if_fail(SP_IS_VIEW_WIDGET(vw), TRUE); if (((SPViewWidgetClass *) G_OBJECT_GET_CLASS(vw))->shutdown) { diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp index 47e2a1e0d..21fe10f4a 100644 --- a/src/ui/view/view.cpp +++ b/src/ui/view/view.cpp @@ -58,7 +58,7 @@ _onDocumentResized (double x, double y, View* v) //-------------------------------------------------------------------- View::View() -: _doc(0) +: _doc(nullptr) { _message_stack = GC::release(new Inkscape::MessageStack()); _tips_message_context = new Inkscape::MessageContext(_message_stack); @@ -78,9 +78,9 @@ void View::_close() { _message_changed_connection.disconnect(); delete _tips_message_context; - _tips_message_context = 0; + _tips_message_context = nullptr; - _message_stack = 0; + _message_stack = nullptr; if (_doc) { _document_uri_set_connection.disconnect(); @@ -89,7 +89,7 @@ void View::_close() { // this was the last view of this document, so delete it delete _doc; } - _doc = NULL; + _doc = nullptr; } Inkscape::Verb::delete_all_view (this); @@ -106,7 +106,7 @@ void View::requestRedraw() } void View::setDocument(SPDocument *doc) { - g_return_if_fail(doc != NULL); + g_return_if_fail(doc != nullptr); if (_doc) { _document_uri_set_connection.disconnect(); diff --git a/src/ui/widget/attr-widget.h b/src/ui/widget/attr-widget.h index e54116a67..8dbff8874 100644 --- a/src/ui/widget/attr-widget.h +++ b/src/ui/widget/attr-widget.h @@ -157,7 +157,7 @@ protected: const gchar* val = o->getRepr()->attribute(name); return val; } - return 0; + return nullptr; } private: diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index eceff13ca..509e218a9 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -30,9 +30,9 @@ ClipMaskIcon::ClipMaskIcon() : _pixMaskName(INKSCAPE_ICON("path-difference")), _pixBothName(INKSCAPE_ICON("bitmap-trace")), _property_active(*this, "active", 0), - _property_pixbuf_clip(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_mask(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_both(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_clip(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_mask(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_both(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; @@ -46,7 +46,7 @@ ClipMaskIcon::ClipMaskIcon() : _property_pixbuf_mask = icon_theme->load_icon(_pixMaskName, phys, (Gtk::IconLookupFlags)0); _property_pixbuf_both = icon_theme->load_icon(_pixBothName, phys, (Gtk::IconLookupFlags)0); - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); } void ClipMaskIcon::get_preferred_height_vfunc(Gtk::Widget& widget, @@ -97,7 +97,7 @@ void ClipMaskIcon::render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, property_pixbuf() = _property_pixbuf_both; break; default: - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); break; } Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); diff --git a/src/ui/widget/color-entry.cpp b/src/ui/widget/color-entry.cpp index f5658c3a6..b766dc9ed 100644 --- a/src/ui/widget/color-entry.cpp +++ b/src/ui/widget/color-entry.cpp @@ -61,7 +61,7 @@ void ColorEntry::on_changed() } gchar *str = g_strdup(text.c_str()); - gchar *end = 0; + gchar *end = nullptr; guint64 rgba = g_ascii_strtoull(str, &end, 16); if (end != str) { ptrdiff_t len = end - str; diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index c6f5b799f..bd1cfde1b 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -209,21 +209,21 @@ class ComponentUI { public: ComponentUI() : _component() - , _adj(0) - , _slider(0) - , _btn(0) - , _label(0) - , _map(0) + , _adj(nullptr) + , _slider(nullptr) + , _btn(nullptr) + , _label(nullptr) + , _map(nullptr) { } ComponentUI(colorspace::Component const &component) : _component(component) - , _adj(0) - , _slider(0) - , _btn(0) - , _label(0) - , _map(0) + , _adj(nullptr) + , _slider(nullptr) + , _btn(nullptr) + , _label(nullptr) + , _map(nullptr) { } @@ -290,7 +290,7 @@ class ColorICCSelectorImpl { const gchar *ColorICCSelector::MODE_NAME = N_("CMS"); ColorICCSelector::ColorICCSelector(SelectedColor &color) - : _impl(NULL) + : _impl(nullptr) { _impl = new ColorICCSelectorImpl(this, color); init(); @@ -302,7 +302,7 @@ ColorICCSelector::~ColorICCSelector() { if (_impl) { delete _impl; - _impl = 0; + _impl = nullptr; } } @@ -314,16 +314,16 @@ ColorICCSelectorImpl::ColorICCSelectorImpl(ColorICCSelector *owner, SelectedColo , _updating(FALSE) , _dragging(FALSE) , _fixupNeeded(0) - , _fixupBtn(0) - , _profileSel(0) + , _fixupBtn(nullptr) + , _profileSel(nullptr) , _compUI() - , _adj(0) - , _slider(0) - , _sbtn(0) - , _label(0) + , _adj(nullptr) + , _slider(nullptr) + , _sbtn(nullptr) + , _label(nullptr) #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) , _profileName() - , _prof(0) + , _prof(nullptr) , _profChannelCount(0) , _profChangedID(0) #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -332,9 +332,9 @@ ColorICCSelectorImpl::ColorICCSelectorImpl(ColorICCSelector *owner, SelectedColo ColorICCSelectorImpl::~ColorICCSelectorImpl() { - _adj = 0; - _sbtn = 0; - _label = 0; + _adj = nullptr; + _sbtn = nullptr; + _label = nullptr; } void ColorICCSelector::init() @@ -524,7 +524,7 @@ void ColorICCSelectorImpl::_profileSelected(GtkWidget * /*src*/, gpointer data) GtkTreeIter iter; if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(self->_profileSel), &iter)) { GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(self->_profileSel)); - gchar *name = 0; + gchar *name = nullptr; gtk_tree_model_get(store, &iter, 1, &name, -1); self->_switchToProfile(name); @@ -615,9 +615,9 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) #endif // DEBUG_LCMS if (tmp.icc) { delete tmp.icc; - tmp.icc = 0; + tmp.icc = nullptr; dirty = true; - _fixupHit(0, this); + _fixupHit(nullptr, this); } else { #ifdef DEBUG_LCMS @@ -789,7 +789,7 @@ void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) // Need to clear out the prior one profChanged = true; _profileName.clear(); - _prof = 0; + _prof = nullptr; _profChannelCount = 0; } else if (profile && !_prof) { @@ -855,7 +855,7 @@ void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) } else { // Give up for now on named colors - _prof = 0; + _prof = nullptr; } } diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 308bb968e..5b0f12e51 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -88,7 +88,7 @@ ColorNotebook::~ColorNotebook() { if (_buttons) { delete[] _buttons; - _buttons = 0; + _buttons = nullptr; } } @@ -271,7 +271,7 @@ void ColorNotebook::_updateICCButtons() #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* update color management icon*/ - gtk_widget_set_sensitive(_box_colormanaged, color.icc != NULL); + gtk_widget_set_sensitive(_box_colormanaged, color.icc != nullptr); /* update out-of-gamut icon */ gtk_widget_set_sensitive(_box_outofgamut, false); @@ -330,7 +330,7 @@ void ColorNotebook::_addPage(Page &page) tab_label->set_name("ColorModeLabel"); gint page_num = gtk_notebook_append_page(GTK_NOTEBOOK(_book), selector_widget->gobj(), tab_label->gobj()); - _buttons[page_num] = gtk_radio_button_new_with_label(NULL, mode_name.c_str()); + _buttons[page_num] = gtk_radio_button_new_with_label(nullptr, mode_name.c_str()); gtk_widget_set_name(_buttons[page_num], "ColorModeButton"); gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(_buttons[page_num]), FALSE); if (page_num > 0) { diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index cb6349c4b..620e77cbf 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -51,10 +51,10 @@ ColorScales::ColorScales(SelectedColor &color, SPColorScalesMode mode) , _mode(SP_COLOR_SCALES_MODE_NONE) { for (gint i = 0; i < 5; i++) { - _l[i] = 0; - _a[i] = 0; - _s[i] = 0; - _b[i] = 0; + _l[i] = nullptr; + _a[i] = nullptr; + _s[i] = nullptr; + _b[i] = nullptr; } _initUI(mode); @@ -66,10 +66,10 @@ ColorScales::ColorScales(SelectedColor &color, SPColorScalesMode mode) ColorScales::~ColorScales() { for (gint i = 0; i < 5; i++) { - _l[i] = 0; - _a[i] = 0; - _s[i] = 0; - _b[i] = 0; + _l[i] = nullptr; + _a[i] = nullptr; + _s[i] = nullptr; + _b[i] = nullptr; } } @@ -283,7 +283,7 @@ void ColorScales::on_show() void ColorScales::_getRgbaFloatv(gfloat *rgba) { - g_return_if_fail(rgba != NULL); + g_return_if_fail(rgba != nullptr); switch (_mode) { case SP_COLOR_SCALES_MODE_RGB: @@ -314,7 +314,7 @@ void ColorScales::_getCmykaFloatv(gfloat *cmyka) { gfloat rgb[3]; - g_return_if_fail(cmyka != NULL); + g_return_if_fail(cmyka != nullptr); switch (_mode) { case SP_COLOR_SCALES_MODE_RGB: @@ -384,7 +384,7 @@ void ColorScales::setMode(SPColorScalesMode mode) gtk_label_set_markup_with_mnemonic(GTK_LABEL(_l[3]), _("_A:")); _s[3]->set_tooltip_text(_("Alpha (opacity)")); gtk_widget_set_tooltip_text(_b[3], _("Alpha (opacity)")); - _s[0]->setMap(NULL); + _s[0]->setMap(nullptr); gtk_widget_hide(_l[4]); _s[4]->hide(); gtk_widget_hide(_b[4]); @@ -485,7 +485,7 @@ void ColorScales::setMode(SPColorScalesMode mode) gtk_label_set_markup_with_mnemonic(GTK_LABEL(_l[4]), _("_A:")); _s[4]->set_tooltip_text(_("Alpha (opacity)")); gtk_widget_set_tooltip_text(_b[4], _("Alpha (opacity)")); - _s[0]->setMap(NULL); + _s[0]->setMap(nullptr); gtk_widget_show(_l[4]); _s[4]->show(); gtk_widget_show(_b[4]); @@ -704,7 +704,7 @@ void ColorScales::_updateSliders(guint channels) static const gchar *sp_color_scales_hue_map(void) { - static gchar *map = NULL; + static gchar *map = nullptr; if (!map) { gchar *p; diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index ed034598e..58a236e92 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -42,7 +42,7 @@ ColorSlider::ColorSlider(Glib::RefPtr<Gtk::Adjustment> adjustment) , _value(0.0) , _oldvalue(0.0) , _mapsize(0) - , _map(NULL) + , _map(nullptr) { _c0[0] = 0x00; _c0[1] = 0x00; @@ -170,10 +170,10 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) window, GDK_SEAT_CAPABILITY_ALL_POINTING, FALSE, - NULL, + nullptr, reinterpret_cast<GdkEvent *>(event), - NULL, - NULL); + nullptr, + nullptr); #else auto device = gdk_event_get_device(reinterpret_cast<GdkEvent *>(event)); gdk_device_grab(device, @@ -286,7 +286,7 @@ void ColorSlider::_onAdjustmentValueChanged() void ColorSlider::setColors(guint32 start, guint32 mid, guint32 end) { // Remove any map, if set - _map = 0; + _map = nullptr; _c0[0] = start >> 24; _c0[1] = (start >> 16) & 0xff; @@ -354,7 +354,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) const guchar *b = sp_color_slider_render_map(0, 0, carea.get_width(), carea.get_height(), _map, s, d, _b0, _b1, _bmask); - if (b != NULL && carea.get_width() > 0) { + if (b != nullptr && carea.get_width() > 0) { Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_data( b, Gdk::COLORSPACE_RGB, false, 8, carea.get_width(), carea.get_height(), carea.get_width() * 3); @@ -377,7 +377,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) const guchar *b = sp_color_slider_render_gradient(0, 0, wi, carea.get_height(), c, dc, _b0, _b1, _bmask); /* Draw pixelstore 1 */ - if (b != NULL && wi > 0) { + if (b != nullptr && wi > 0) { Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_data(b, Gdk::COLORSPACE_RGB, false, 8, wi, carea.get_height(), wi * 3); @@ -397,7 +397,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) _b0, _b1, _bmask); /* Draw pixelstore 2 */ - if (b != NULL && wi > 0) { + if (b != nullptr && wi > 0) { Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_data(b, Gdk::COLORSPACE_RGB, false, 8, wi, carea.get_height(), wi * 3); @@ -448,7 +448,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) static const guchar *sp_color_slider_render_gradient(gint x0, gint y0, gint width, gint height, gint c[], gint dc[], guint b0, guint b1, guint mask) { - static guchar *buf = NULL; + static guchar *buf = nullptr; static gint bs = 0; guchar *dp; gint x, y; @@ -456,7 +456,7 @@ static const guchar *sp_color_slider_render_gradient(gint x0, gint y0, gint widt if (buf && (bs < width * height)) { g_free(buf); - buf = NULL; + buf = nullptr; } if (!buf) { buf = g_new(guchar, width * height * 3); @@ -503,14 +503,14 @@ static const guchar *sp_color_slider_render_gradient(gint x0, gint y0, gint widt static const guchar *sp_color_slider_render_map(gint x0, gint y0, gint width, gint height, guchar *map, gint start, gint step, guint b0, guint b1, guint mask) { - static guchar *buf = NULL; + static guchar *buf = nullptr; static gint bs = 0; guchar *dp; gint x, y; if (buf && (bs < width * height)) { g_free(buf); - buf = NULL; + buf = nullptr; } if (!buf) { buf = g_new(guchar, width * height * 3); diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index ffdf173ba..b4b6e6e5c 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -28,8 +28,8 @@ ColorWheelSelector::ColorWheelSelector(SelectedColor &color) : Gtk::Grid() , _color(color) , _updating(false) - , _wheel(0) - , _slider(0) + , _wheel(nullptr) + , _slider(nullptr) { set_name("ColorWheelSelector"); @@ -40,7 +40,7 @@ ColorWheelSelector::ColorWheelSelector(SelectedColor &color) ColorWheelSelector::~ColorWheelSelector() { - _wheel = 0; + _wheel = nullptr; _color_changed_connection.disconnect(); _color_dragged_connection.disconnect(); diff --git a/src/ui/widget/combo-enums.h b/src/ui/widget/combo-enums.h index 6b69533d2..e06f5b610 100644 --- a/src/ui/widget/combo-enums.h +++ b/src/ui/widget/combo-enums.h @@ -114,7 +114,7 @@ public: Gtk::TreeModel::iterator i = this->get_active(); if(i) return (*i)[_columns.data]; - return 0; + return nullptr; } void add_row(const Glib::ustring& s) diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 29f22977a..7cd841d88 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -25,11 +25,11 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l _dock(dock), _prev_state(state), _prev_position(0), - _window(0), + _window(nullptr), _x(0), _y(0), _grab_focus_on_realize(false), - _gdl_dock_item(0) + _gdl_dock_item(nullptr) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GdlDockItemBehavior gdl_dock_behavior = @@ -437,8 +437,8 @@ DockItem::getWindow() { g_return_val_if_fail(_gdl_dock_item, 0); Gtk::Container *parent = getWidget().get_parent(); - parent = (parent ? parent->get_parent() : 0); - return (parent ? dynamic_cast<Gtk::Window *>(parent) : 0); + parent = (parent ? parent->get_parent() : nullptr); + return (parent ? dynamic_cast<Gtk::Window *>(parent) : nullptr); } const Glib::SignalProxyInfo diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index 9c1f0f783..7e90017e8 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -27,7 +27,7 @@ namespace { void hideCallback(GObject * /*object*/, gpointer dock_ptr) { - g_return_if_fail( dock_ptr != NULL ); + g_return_if_fail( dock_ptr != nullptr ); Dock *dock = static_cast<Dock *>(dock_ptr); dock->hide(); @@ -35,7 +35,7 @@ void hideCallback(GObject * /*object*/, gpointer dock_ptr) void unhideCallback(GObject * /*object*/, gpointer dock_ptr) { - g_return_if_fail( dock_ptr != NULL ); + g_return_if_fail( dock_ptr != nullptr ); Dock *dock = static_cast<Dock *>(dock_ptr); dock->show(); @@ -89,7 +89,7 @@ Dock::Dock(Gtk::Orientation orientation) static_cast<GdlSwitcherStyle>(prefs->getIntLimited("/options/dock/switcherstyle", GDL_SWITCHER_STYLE_BOTH, 0, 4)); - GdlDockMaster* master = NULL; + GdlDockMaster* master = nullptr; g_object_get(GDL_DOCK_OBJECT(_gdl_dock), "master", &master, @@ -139,7 +139,7 @@ Gtk::Paned *Dock::getParentPaned() { g_return_val_if_fail(_dock_box, 0); Gtk::Container *parent = getWidget().get_parent(); - return (parent != 0 ? dynamic_cast<Gtk::Paned *>(parent) : 0); + return (parent != nullptr ? dynamic_cast<Gtk::Paned *>(parent) : nullptr); } diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index 67412b1e0..48597842b 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -45,7 +45,7 @@ EntityEntry* EntityEntry::create (rdf_work_entity_t* ent, Registry& wr) { g_assert (ent); - EntityEntry* obj = 0; + EntityEntry* obj = nullptr; switch (ent->format) { case RDF_FORMAT_LINE: @@ -65,7 +65,7 @@ EntityEntry::create (rdf_work_entity_t* ent, Registry& wr) EntityEntry::EntityEntry (rdf_work_entity_t* ent, Registry& wr) : _label(Glib::ustring(_(ent->title)), Gtk::ALIGN_END), - _packable(0), + _packable(nullptr), _entity(ent), _wr(&wr) { } diff --git a/src/ui/widget/font-button.cpp b/src/ui/widget/font-button.cpp index ed57c803a..1137c2d95 100644 --- a/src/ui/widget/font-button.cpp +++ b/src/ui/widget/font-button.cpp @@ -27,20 +27,20 @@ FontButton::FontButton(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring FontButton::getValue() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<Gtk::FontButton*>(_widget)->get_font_name(); } void FontButton::setValue (Glib::ustring fontspec) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<Gtk::FontButton*>(_widget)->set_font_name(fontspec); } Glib::SignalProxy0<void> FontButton::signal_font_value_changed() { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<Gtk::FontButton*>(_widget)->signal_font_set(); } diff --git a/src/ui/widget/font-selector-toolbar.cpp b/src/ui/widget/font-selector-toolbar.cpp index 87dadf211..276b05cd8 100644 --- a/src/ui/widget/font-selector-toolbar.cpp +++ b/src/ui/widget/font-selector-toolbar.cpp @@ -263,7 +263,7 @@ FontSelectorToolbar::on_key_press_event (GdkEventKey* key_event) gdk_keymap_translate_keyboard_state( Gdk::Display::get_default()->get_keymap(), key_event->hardware_keycode, (GdkModifierType)key_event->state, - 0, &key, 0, 0, 0 ); + 0, &key, nullptr, nullptr, nullptr ); switch ( key ) { diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp index 8e7df7a68..5837c0842 100644 --- a/src/ui/widget/imageicon.cpp +++ b/src/ui/widget/imageicon.cpp @@ -86,8 +86,8 @@ void ImageIcon::init() // \FIXME Why? if (!Inkscape::Application::exists()) Inkscape::Application::create("", false); - document = NULL; - viewerGtkmm = NULL; + document = nullptr; + viewerGtkmm = nullptr; //set_size_request(150,150); showingBrokenImage = false; } diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index 38c84ca51..1200144f1 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -29,8 +29,8 @@ ImageToggler::ImageToggler( char const* on, char const* off) : _pixOffName(off), _property_active(*this, "active", false), _property_activatable(*this, "activatable", true), - _property_pixbuf_on(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_off(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_on(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_off(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp index 5d1f64a54..d402aca37 100644 --- a/src/ui/widget/insertordericon.cpp +++ b/src/ui/widget/insertordericon.cpp @@ -25,8 +25,8 @@ InsertOrderIcon::InsertOrderIcon() : _pixTopName(INKSCAPE_ICON("insert-top")), _pixBottomName(INKSCAPE_ICON("insert-bottom")), _property_active(*this, "active", 0), - _property_pixbuf_top(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_bottom(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_top(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_bottom(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; @@ -39,7 +39,7 @@ InsertOrderIcon::InsertOrderIcon() : _property_pixbuf_top = icon_theme->load_icon(_pixTopName, phys, (Gtk::IconLookupFlags)0); _property_pixbuf_bottom = icon_theme->load_icon(_pixBottomName, phys, (Gtk::IconLookupFlags)0); - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); } @@ -88,7 +88,7 @@ void InsertOrderIcon::render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, property_pixbuf() = _property_pixbuf_bottom; break; default: - property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); + property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(nullptr); break; } Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index 003b64d53..2e9840035 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -30,7 +30,7 @@ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip, _label(new Gtk::Label(label, Gtk::ALIGN_END, Gtk::ALIGN_CENTER, mnemonic)), _suffix(new Gtk::Label(suffix, Gtk::ALIGN_START)) { - g_assert(g_utf8_validate(icon.c_str(), -1, NULL)); + g_assert(g_utf8_validate(icon.c_str(), -1, nullptr)); if (icon != "") { _icon = Gtk::manage(new Gtk::Image()); _icon->set_from_icon_name(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR); diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index e0a52a868..b86222404 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -42,7 +42,7 @@ namespace { class AlternateIcons : public Gtk::HBox { public: AlternateIcons(Gtk::IconSize size, Glib::ustring const &a, Glib::ustring const &b) - : _a(NULL), _b(NULL) + : _a(nullptr), _b(nullptr) { set_name("AlternateIcons"); if (!a.empty()) { @@ -94,7 +94,7 @@ private: * selector is changed. */ LayerSelector::LayerSelector(SPDesktop *desktop) -: _desktop(NULL), _layer(NULL) +: _desktop(nullptr), _layer(nullptr) { set_name("LayerSelector"); AlternateIcons *label; @@ -159,7 +159,7 @@ LayerSelector::LayerSelector(SPDesktop *desktop) /** Destructor - disconnects signal handler */ LayerSelector::~LayerSelector() { - setDesktop(NULL); + setDesktop(nullptr); _selection_changed_connection.disconnect(); } @@ -258,8 +258,8 @@ void LayerSelector::_selectLayer(SPObject *layer) { SPObject *root=_desktop->currentRoot(); if (_layer) { - sp_object_unref(_layer, NULL); - _layer = NULL; + sp_object_unref(_layer, nullptr); + _layer = nullptr; } if (layer) { @@ -282,7 +282,7 @@ void LayerSelector::_selectLayer(SPObject *layer) { } _layer = layer; - sp_object_ref(_layer, NULL); + sp_object_ref(_layer, nullptr); } if ( !layer || layer == root ) { @@ -353,7 +353,7 @@ void LayerSelector::_buildSiblingEntries( auto siblings = parent.children | boost::adaptors::filtered(is_layer(_desktop)) | boost::adaptors::reversed; - SPObject *layer( hierarchy ? &*hierarchy : NULL ); + SPObject *layer( hierarchy ? &*hierarchy : nullptr ); for (auto& sib: siblings) { _buildEntry(depth, sib); @@ -435,7 +435,7 @@ void LayerSelector::_protectUpdate(sigc::slot<void> slot) { _lock_toggled_connection.block(true); slot(); - SPObject *layer = _desktop ? _desktop->currentLayer() : 0; + SPObject *layer = _desktop ? _desktop->currentLayer() : nullptr; if ( layer ) { bool wantedValue = ( SP_IS_ITEM(layer) ? SP_ITEM(layer)->isLocked() : false ); if ( _lock_toggle.get_active() != wantedValue ) { @@ -480,18 +480,18 @@ void LayerSelector::_buildEntry(unsigned depth, SPObject &object) { &node_added, &node_removed, &attribute_changed, - NULL, + nullptr, &node_reordered }; vector = new Inkscape::XML::NodeEventVector(events); } else { Inkscape::XML::NodeEventVector events = { - NULL, - NULL, + nullptr, + nullptr, &attribute_changed, - NULL, - NULL + nullptr, + nullptr }; vector = new Inkscape::XML::NodeEventVector(events); @@ -501,7 +501,7 @@ void LayerSelector::_buildEntry(unsigned depth, SPObject &object) { row->set_value(_model_columns.depth, depth); - sp_object_ref(&object, NULL); + sp_object_ref(&object, nullptr); row->set_value(_model_columns.object, &object); Inkscape::GC::anchor(object.getRepr()); @@ -519,7 +519,7 @@ void LayerSelector::_destroyEntry(Gtk::ListStore::iterator const &row) { Callbacks *callbacks=reinterpret_cast<Callbacks *>(row->get_value(_model_columns.callbacks)); SPObject *object=row->get_value(_model_columns.object); if (object) { - sp_object_unref(object, NULL); + sp_object_unref(object, nullptr); } Inkscape::XML::Node *repr=row->get_value(_model_columns.repr); if (repr) { @@ -543,8 +543,8 @@ void LayerSelector::_prepareLabelRenderer( // "invent" an iterator with null data and try to render it; // where does it come from, and how can we avoid it? if ( object && object->getRepr() ) { - SPObject *layer=( _desktop ? _desktop->currentLayer() : NULL ); - SPObject *root=( _desktop ? _desktop->currentRoot() : NULL ); + SPObject *layer=( _desktop ? _desktop->currentLayer() : nullptr ); + SPObject *root=( _desktop ? _desktop->currentRoot() : nullptr ); bool isancestor = !( (layer && (object->parent == layer->parent)) || ((layer == root) && (object->parent == root))); diff --git a/src/ui/widget/layer-selector.h b/src/ui/widget/layer-selector.h index 0b531231a..bcdc2548e 100644 --- a/src/ui/widget/layer-selector.h +++ b/src/ui/widget/layer-selector.h @@ -38,7 +38,7 @@ class DocumentTreeModel; class LayerSelector : public Gtk::HBox { public: - LayerSelector(SPDesktop *desktop = NULL); + LayerSelector(SPDesktop *desktop = nullptr); ~LayerSelector() override; SPDesktop *desktop() { return _desktop; } diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index 3a8ffab44..278bd317b 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -30,9 +30,9 @@ LayerTypeIcon::LayerTypeIcon() : _pixPathName(INKSCAPE_ICON("layer-rename")), _property_active(*this, "active", false), _property_activatable(*this, "activatable", true), - _property_pixbuf_layer(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_group(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)), - _property_pixbuf_path(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)) + _property_pixbuf_layer(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_group(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)), + _property_pixbuf_path(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(nullptr)) { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index c9d46bc66..a8325525b 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -37,10 +37,10 @@ namespace Widget { //=================================================== const struct rdf_license_t _proprietary_license = - {_("Proprietary"), "", 0}; + {_("Proprietary"), "", nullptr}; const struct rdf_license_t _other_license = - {Q_("MetadataLicence|Other"), "", 0}; + {Q_("MetadataLicence|Other"), "", nullptr}; class LicenseItem : public Gtk::RadioButton { public: @@ -67,7 +67,7 @@ void LicenseItem::on_toggled() _wr.setUpdating (true); SPDocument *doc = SP_ACTIVE_DOCUMENT; - rdf_set_license (doc, _lic->details ? _lic : 0); + rdf_set_license (doc, _lic->details ? _lic : nullptr); if (doc->priv->sensitive) { DocumentUndo::done(doc, SP_VERB_NONE, _("Document license updated")); } @@ -80,7 +80,7 @@ void LicenseItem::on_toggled() Licensor::Licensor() : Gtk::VBox(false,4), - _eentry (NULL) + _eentry (nullptr) { } @@ -97,7 +97,7 @@ void Licensor::init (Registry& wr) LicenseItem *i; wr.setUpdating (true); - i = Gtk::manage (new LicenseItem (&_proprietary_license, _eentry, wr, NULL)); + i = Gtk::manage (new LicenseItem (&_proprietary_license, _eentry, wr, nullptr)); Gtk::RadioButtonGroup group = i->get_group(); add (*i); LicenseItem *pd = i; diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 3677233bc..fc24ec7cd 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -52,7 +52,7 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co } ObjectCompositeSettings::~ObjectCompositeSettings() { - setSubject(NULL); + setSubject(nullptr); } void ObjectCompositeSettings::setSubject(StyleSubject *subject) { @@ -110,13 +110,13 @@ ObjectCompositeSettings::_blendBlurValueChanged() SPItem * item = SP_ITEM(*i); SPStyle *style = item->style; - g_assert(style != NULL); + g_assert(style != nullptr); if (blendmode != "normal") { SPFilter *filter = new_filter_simple_from_item(document, item, blendmode.c_str(), radius); sp_style_set_property_url(item, "filter", filter, false); } else { - sp_style_set_property_url(item, "filter", NULL, false); + sp_style_set_property_url(item, "filter", nullptr, false); } if (radius == 0 && item->style->filter.set diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 805333f8e..579049d29 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -199,7 +199,7 @@ static PaperSizeRec const inkscape_papers[] = { * September 2009 - DAK */ - { NULL, 0, 0, "px" }, + { nullptr, 0, 0, "px" }, }; @@ -216,7 +216,7 @@ PageSizer::PageSizer(Registry & _wr) _dimensionUnits( _("U_nits:"), "units", _wr ), _dimensionWidth( _("_Width:"), _("Width of paper"), "width", _dimensionUnits, _wr ), _dimensionHeight( _("_Height:"), _("Height of paper"), "height", _dimensionUnits, _wr ), - _marginLock( _("Loc_k margins"), _("Lock margins"), "lock-margins", _wr, false, NULL, NULL), + _marginLock( _("Loc_k margins"), _("Lock margins"), "lock-margins", _wr, false, nullptr, nullptr), _lock_icon(), _marginTop( _("T_op margin:"), _("Top margin"), "fit-margin-top", _wr ), _marginLeft( _("L_eft:"), _("Left margin"), "fit-margin-left", _wr), @@ -655,7 +655,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() Inkscape::XML::Node *nv_repr; if ((doc = SP_ACTIVE_DESKTOP->getDocument()) - && (nv = sp_document_namedview(doc, 0)) + && (nv = sp_document_namedview(doc, nullptr)) && (nv_repr = nv->getRepr())) { _lockMarginUpdate = true; sp_repr_set_svg_double(nv_repr, "fit-margin-top", _marginTop.getValue()); @@ -669,7 +669,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(dt)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } } } diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 281e6e21a..7b54995c1 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -45,7 +45,7 @@ Panel::Panel(gchar const *prefs_path, int verb_num) : _prefs_path(prefs_path), _desktop(SP_ACTIVE_DESKTOP), _verb_num(verb_num), - _action_area(0) + _action_area(nullptr) { set_name("InkscapePanel"); set_orientation(Gtk::ORIENTATION_VERTICAL); diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index aed90f99c..708d2b957 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -59,7 +59,7 @@ public: * @param prefs_path characteristic path to load/save dialog position. * @param verb_num the dialog verb. */ - Panel(gchar const *prefs_path = 0, int verb_num = 0); + Panel(gchar const *prefs_path = nullptr, int verb_num = 0); ~Panel() override; gchar const *getPrefsPath() const; diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 078aba9cf..fee392632 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -351,7 +351,7 @@ draw_text(cairo_t *cr, Geom::Point loc, const char* txt, bool bottom = false, pango_font_description_free (font_desc); PangoRectangle logical_extent; - pango_layout_get_pixel_extents(layout, NULL, &logical_extent); + pango_layout_get_pixel_extents(layout, nullptr, &logical_extent); cairo_move_to(cr, loc[Geom::X], loc[Geom::Y] - (bottom ? logical_extent.height : 0)); pango_cairo_show_layout(cr, layout); } @@ -732,7 +732,7 @@ void PrefEntryFileButtonHBox::onRelatedEntryChangedCallback() } } -static Inkscape::UI::Dialog::FileOpenDialog * selectPrefsFileInstance = NULL; +static Inkscape::UI::Dialog::FileOpenDialog * selectPrefsFileInstance = nullptr; void PrefEntryFileButtonHBox::onRelatedButtonClickedCallback() { diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 2b10d1a81..129a7b336 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -274,7 +274,7 @@ class DialogPage : public Gtk::Grid { public: DialogPage(); - void add_line(bool indent, Glib::ustring const &label, Gtk::Widget& widget, Glib::ustring const &suffix, Glib::ustring const &tip, bool expand = true, Gtk::Widget *other_widget = NULL); + void add_line(bool indent, Glib::ustring const &label, Gtk::Widget& widget, Glib::ustring const &suffix, Glib::ustring const &tip, bool expand = true, Gtk::Widget *other_widget = nullptr); void add_group_header(Glib::ustring name); void set_tip(Gtk::Widget &widget, Glib::ustring const &tip); }; diff --git a/src/ui/widget/registered-enums.h b/src/ui/widget/registered-enums.h index 04ed521cd..c837640d3 100644 --- a/src/ui/widget/registered-enums.h +++ b/src/ui/widget/registered-enums.h @@ -32,8 +32,8 @@ public: const Glib::ustring& key, const Util::EnumDataConverter<E>& c, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL, + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr, bool sorted = true ) : RegisteredWidget< LabelledComboBoxEnum<E> >(label, tip, c, (const Glib::ustring &)"", (const Glib::ustring &)"", true, sorted) { diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index d539cdcc5..b4c114cff 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -207,7 +207,7 @@ RegisteredScalarUnit::~RegisteredScalarUnit() RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in, RSU_UserUnits user_units) : RegisteredWidget<ScalarUnit>(label, tip, UNIT_TYPE_LINEAR, "", "", rum.getUnitMenu()), - _um(0) + _um(nullptr) { init_parent(key, wr, repr_in, doc_in); @@ -489,8 +489,8 @@ RegisteredRadioButtonPair::RegisteredRadioButtonPair (const Glib::ustring& label const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget<Gtk::HBox>(), - _rb1(NULL), - _rb2(NULL) + _rb1(nullptr), + _rb2(nullptr) { init_parent(key, wr, repr_in, doc_in); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index ca55e5397..bb0f6da8a 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -135,9 +135,9 @@ protected: private: void construct() { - _wr = NULL; - repr = NULL; - doc = NULL; + _wr = nullptr; + repr = nullptr; + doc = nullptr; write_undo = false; event_type = 0; //SP_VERB_INVALID } @@ -148,7 +148,7 @@ private: class RegisteredCheckButton : public RegisteredWidget<Gtk::CheckButton> { public: ~RegisteredCheckButton() override; - RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false"); + RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=nullptr, SPDocument *doc_in=nullptr, char const *active_str = "true", char const *inactive_str = "false"); void setActive (bool); @@ -173,7 +173,7 @@ protected: class RegisteredToggleButton : public RegisteredWidget<Gtk::ToggleButton> { public: ~RegisteredToggleButton() override; - RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *icon_active = "true", char const *icon_inactive = "false"); + RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=nullptr, SPDocument *doc_in=nullptr, char const *icon_active = "true", char const *icon_inactive = "false"); void setActive (bool); @@ -200,8 +200,8 @@ public: RegisteredUnitMenu ( const Glib::ustring& label, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); void setUnit (const Glib::ustring); Unit const * getUnit() const { return static_cast<UnitMenu*>(_widget)->getUnit(); }; @@ -228,8 +228,8 @@ public: const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL, + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr, RSU_UserUnits _user_units = RSU_none ); protected: @@ -246,8 +246,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); protected: sigc::connection _value_changed_connection; void on_value_changed(); @@ -260,8 +260,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); protected: sigc::connection _activate_connection; @@ -278,8 +278,8 @@ public: const Glib::ustring& ckey, const Glib::ustring& akey, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr); void setRgba32 (guint32); void closeWindow(); @@ -298,8 +298,8 @@ public: const Glib::ustring& suffix, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); bool setProgrammatically; // true if the value was set by setValue, not changed by the user; // if a callback checks it, it must reset it back to false @@ -319,8 +319,8 @@ public: const Glib::ustring& tip2, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); void setValue (bool second); @@ -339,8 +339,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); protected: sigc::connection _value_x_changed_connection; @@ -356,8 +356,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); // redefine setValue, because transform must be applied void setValue(Geom::Point const & p); @@ -380,8 +380,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr ); // redefine setValue, because transform must be applied void setValue(Geom::Point const & p); @@ -411,8 +411,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr); void setValue (double val, long startseed); @@ -429,8 +429,8 @@ public: const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, - Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Inkscape::XML::Node* repr_in = nullptr, + SPDocument *doc_in = nullptr); void setValue (Glib::ustring fontspec); diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index 4fa1a7584..fc8c92142 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -34,7 +34,7 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, _absolute_is_increment(false), _percentage_is_increment(false) { - if (_unit_menu == NULL) { + if (_unit_menu == nullptr) { _unit_menu = new UnitMenu(); g_assert(_unit_menu); _unit_menu->setUnitType(unit_type); @@ -70,7 +70,7 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, void ScalarUnit::initScalar(double min_value, double max_value) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); Scalar::setDigits(_unit_menu->getDefaultDigits()); Scalar::setIncrements(_unit_menu->getDefaultStep(), _unit_menu->getDefaultPage()); @@ -79,7 +79,7 @@ void ScalarUnit::initScalar(double min_value, double max_value) bool ScalarUnit::setUnit(Glib::ustring const &unit) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); // First set the unit if (!_unit_menu->setUnit(unit)) { return false; @@ -90,21 +90,21 @@ bool ScalarUnit::setUnit(Glib::ustring const &unit) void ScalarUnit::setUnitType(UnitType unit_type) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); _unit_menu->setUnitType(unit_type); lastUnits = _unit_menu->getUnitAbbr(); } void ScalarUnit::resetUnitType(UnitType unit_type) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); _unit_menu->resetUnitType(unit_type); lastUnits = _unit_menu->getUnitAbbr(); } Unit const * ScalarUnit::getUnit() const { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); return _unit_menu->getUnit(); } @@ -116,14 +116,14 @@ UnitType ScalarUnit::getUnitType() const void ScalarUnit::setValue(double number, Glib::ustring const &units) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); _unit_menu->setUnit(units); Scalar::setValue(number); } void ScalarUnit::setValueKeepUnit(double number, Glib::ustring const &units) { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); if (units == "") { // set the value in the default units Scalar::setValue(number); @@ -140,7 +140,7 @@ void ScalarUnit::setValue(double number) double ScalarUnit::getValue(Glib::ustring const &unit_name) const { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); if (unit_name == "") { // Return the value in the default units return Scalar::getValue(); @@ -223,7 +223,7 @@ void ScalarUnit::setFromPercentage(double value) void ScalarUnit::on_unit_changed() { - g_assert(_unit_menu != NULL); + g_assert(_unit_menu != nullptr); Glib::ustring abbr = _unit_menu->getUnitAbbr(); _suffix->set_label(abbr); diff --git a/src/ui/widget/scalar-unit.h b/src/ui/widget/scalar-unit.h index 9e310d3bd..debcff53e 100644 --- a/src/ui/widget/scalar-unit.h +++ b/src/ui/widget/scalar-unit.h @@ -52,7 +52,7 @@ public: UnitType unit_type = UNIT_TYPE_LINEAR, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", - UnitMenu *unit_menu = NULL, + UnitMenu *unit_menu = nullptr, bool mnemonic = true); /** diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index 937bea697..a3fff0c8c 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -54,13 +54,13 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, unsigned Scalar::getDigits() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<SpinButton*>(_widget)->get_digits(); } double Scalar::getStep() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double step, page; static_cast<SpinButton*>(_widget)->get_increments(step, page); return step; @@ -68,7 +68,7 @@ double Scalar::getStep() const double Scalar::getPage() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double step, page; static_cast<SpinButton*>(_widget)->get_increments(step, page); return page; @@ -76,7 +76,7 @@ double Scalar::getPage() const double Scalar::getRangeMin() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double min, max; static_cast<SpinButton*>(_widget)->get_range(min, max); return min; @@ -84,7 +84,7 @@ double Scalar::getRangeMin() const double Scalar::getRangeMax() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); double min, max; static_cast<SpinButton*>(_widget)->get_range(min, max); return max; @@ -92,38 +92,38 @@ double Scalar::getRangeMax() const double Scalar::getValue() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<SpinButton*>(_widget)->get_value(); } int Scalar::getValueAsInt() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<SpinButton*>(_widget)->get_value_as_int(); } void Scalar::setDigits(unsigned digits) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->set_digits(digits); } void Scalar::setIncrements(double step, double /*page*/) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->set_increments(step, 0); } void Scalar::setRange(double min, double max) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->set_range(min, max); } void Scalar::setValue(double value, bool setProg) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); if (setProg) { setProgrammatically = true; // callback is supposed to reset back, if it cares } @@ -132,7 +132,7 @@ void Scalar::setValue(double value, bool setProg) void Scalar::update() { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); static_cast<SpinButton*>(_widget)->update(); } diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index a15afde4c..c0b0a7f56 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -74,7 +74,7 @@ ss_selection_modified( Inkscape::Selection *selection, guint /*flags*/, gpointer static void ss_subselection_changed( gpointer /*dragger*/, gpointer data ) { - ss_selection_changed (NULL, data); + ss_selection_changed (nullptr, data); } namespace { @@ -121,9 +121,9 @@ SelectedStyle::SelectedStyle(bool /*layout*/) : current_stroke_width(0), - _sw_unit(NULL), + _sw_unit(nullptr), - _desktop (NULL), + _desktop (nullptr), _table(), _fill_label (_("Fill:")), _stroke_label (_("Stroke:")), @@ -146,7 +146,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_blocked (false) { set_name("SelectedStyle"); - _drop[0] = _drop[1] = 0; + _drop[0] = _drop[1] = nullptr; _dropEnabled[0] = _dropEnabled[1] = false; _fill_label.set_halign(Gtk::ALIGN_START); @@ -207,7 +207,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _lgradient[i].show_all(); __lgradient[i] = (i == SS_FILL)? (_("Linear gradient fill")) : (_("Linear gradient stroke")); - _gradient_preview_l[i] = GTK_WIDGET(sp_gradient_image_new (NULL)); + _gradient_preview_l[i] = GTK_WIDGET(sp_gradient_image_new (nullptr)); _gradient_box_l[i].pack_start(_lgradient[i]); _gradient_box_l[i].pack_start(*(Glib::wrap(_gradient_preview_l[i]))); _gradient_box_l[i].show_all(); @@ -217,7 +217,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _rgradient[i].show_all(); __rgradient[i] = (i == SS_FILL)? (_("Radial gradient fill")) : (_("Radial gradient stroke")); - _gradient_preview_r[i] = GTK_WIDGET(sp_gradient_image_new (NULL)); + _gradient_preview_r[i] = GTK_WIDGET(sp_gradient_image_new (nullptr)); _gradient_box_r[i].pack_start(_rgradient[i]); _gradient_box_r[i].pack_start(*(Glib::wrap(_gradient_preview_r[i]))); _gradient_box_r[i].show_all(); @@ -228,7 +228,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _mgradient[i].show_all(); __mgradient[i] = (i == SS_FILL)? (_("Mesh gradient fill")) : (_("Mesh gradient stroke")); - _gradient_preview_m[i] = GTK_WIDGET(sp_gradient_image_new (NULL)); + _gradient_preview_m[i] = GTK_WIDGET(sp_gradient_image_new (nullptr)); _gradient_box_m[i].pack_start(_mgradient[i]); _gradient_box_m[i].pack_start(*(Glib::wrap(_gradient_preview_m[i]))); _gradient_box_m[i].show_all(); @@ -925,7 +925,7 @@ void SelectedStyle::on_popup_preset(int i) { void SelectedStyle::update() { - if (_desktop == NULL) + if (_desktop == nullptr) return; // create temporary style @@ -1201,7 +1201,7 @@ RotateableSwatch::RotateableSwatch(SelectedStyle *parent, guint mode) : startcolor(0), startcolor_set(false), undokey("ssrot1"), - cr(0), + cr(nullptr), cr_set(false) { @@ -1285,7 +1285,7 @@ RotateableSwatch::do_motion(double by, guint modifier) { if (!scrolling && !cr_set) { GtkWidget *w = GTK_WIDGET(gobj()); - GdkPixbuf *pixbuf = NULL; + GdkPixbuf *pixbuf = nullptr; if (modifier == 2) { // saturation pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)cursor_adj_s_xpm); @@ -1297,13 +1297,13 @@ RotateableSwatch::do_motion(double by, guint modifier) { pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)cursor_adj_h_xpm); } - if (pixbuf != NULL) { + if (pixbuf != nullptr) { cr = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, 16, 16); g_object_unref(pixbuf); gdk_window_set_cursor(gtk_widget_get_window(w), cr); g_object_unref(cr); - cr = NULL; + cr = nullptr; cr_set = true; } } @@ -1364,10 +1364,10 @@ RotateableSwatch::do_release(double by, guint modifier) { if (cr_set) { GtkWidget *w = GTK_WIDGET(gobj()); - gdk_window_set_cursor(gtk_widget_get_window(w), NULL); + gdk_window_set_cursor(gtk_widget_get_window(w), nullptr); if (cr) { g_object_unref(cr); - cr = NULL; + cr = nullptr; } cr_set = false; } @@ -1495,7 +1495,7 @@ Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop) } catch (std::exception &e) { } } - return 0; + return nullptr; } } // namespace Widget diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index 94b178a43..0c843590c 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -161,7 +161,7 @@ void DualSpinScale::set_from_attribute(SPObject* o) if(toks[1]) v2 = Glib::Ascii::strtod(toks[1]); - _link.set_active(toks[1] == 0); + _link.set_active(toks[1] == nullptr); _s1.get_adjustment()->set_value(v1); _s2.get_adjustment()->set_value(v2); diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 03981763d..0b63e7455 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -153,7 +153,7 @@ void DualSpinSlider::set_from_attribute(SPObject* o) if(toks[1]) v2 = Glib::Ascii::strtod(toks[1]); - _link.set_active(toks[1] == 0); + _link.set_active(toks[1] == nullptr); _s1.get_adjustment()->set_value(v1); _s2.get_adjustment()->set_value(v2); diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index cd2d2a427..fe03c85d3 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -32,7 +32,7 @@ class SpinSlider : public Gtk::HBox, public AttrWidget { public: SpinSlider(double value, double lower, double upper, double step_inc, - double climb_rate, int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); + double climb_rate, int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = nullptr); Glib::ustring get_as_attribute() const override; void set_from_attribute(SPObject*) override; diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 0c082d3ce..777a6edf4 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -35,7 +35,7 @@ int SpinButton::on_input(double* newvalue) try { Inkscape::Util::EvaluatorQuantity result; if (_unit_menu || _unit_tracker) { - Unit const *unit = NULL; + Unit const *unit = nullptr; if (_unit_menu) { unit = _unit_menu->getUnit(); } else { @@ -48,7 +48,7 @@ int SpinButton::on_input(double* newvalue) throw Inkscape::Util::EvaluatorException("Input dimensions do not match with parameter dimensions.",""); } } else { - Inkscape::Util::ExpressionEvaluator eval = Inkscape::Util::ExpressionEvaluator(get_text().c_str(), NULL); + Inkscape::Util::ExpressionEvaluator eval = Inkscape::Util::ExpressionEvaluator(get_text().c_str(), nullptr); result = eval.evaluate(); } diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index a252743be..28d9849a8 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -30,16 +30,16 @@ class SpinButton : public Gtk::SpinButton public: SpinButton(double climb_rate = 0.0, guint digits = 0) : Gtk::SpinButton(climb_rate, digits), - _unit_menu(NULL), - _unit_tracker(NULL), + _unit_menu(nullptr), + _unit_tracker(nullptr), _on_focus_in_value(0.) { connect_signals(); }; explicit SpinButton(Glib::RefPtr<Gtk::Adjustment>& adjustment, double climb_rate = 0.0, guint digits = 0) : Gtk::SpinButton(adjustment, climb_rate, digits), - _unit_menu(NULL), - _unit_tracker(NULL), + _unit_menu(nullptr), + _unit_tracker(nullptr), _on_focus_in_value(0.) { connect_signals(); diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index e23627080..5eccc67cf 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -17,11 +17,11 @@ namespace Inkscape { namespace UI { namespace Widget { -StyleSubject::StyleSubject() : _desktop(NULL) { +StyleSubject::StyleSubject() : _desktop(nullptr) { } StyleSubject::~StyleSubject() { - setDesktop(NULL); + setDesktop(nullptr); } void StyleSubject::setDesktop(SPDesktop *desktop) { @@ -49,7 +49,7 @@ Inkscape::Selection *StyleSubject::Selection::_getSelection() const { if (desktop) { return desktop->getSelection(); } else { - return NULL; + return nullptr; } } @@ -102,7 +102,7 @@ void StyleSubject::Selection::setCSS(SPCSSAttr *css) { } StyleSubject::CurrentLayer::CurrentLayer() { - _element = NULL; + _element = nullptr; } StyleSubject::CurrentLayer::~CurrentLayer() { @@ -112,12 +112,12 @@ void StyleSubject::CurrentLayer::_setLayer(SPObject *layer) { _layer_release.disconnect(); _layer_modified.disconnect(); if (_element) { - sp_object_unref(_element, NULL); + sp_object_unref(_element, nullptr); } _element = layer; if (layer) { - sp_object_ref(layer, NULL); - _layer_release = layer->connectRelease(sigc::hide(sigc::bind(sigc::mem_fun(*this, &CurrentLayer::_setLayer), (SPObject *)NULL))); + sp_object_ref(layer, nullptr); + _layer_release = layer->connectRelease(sigc::hide(sigc::bind(sigc::mem_fun(*this, &CurrentLayer::_setLayer), (SPObject *)nullptr))); _layer_modified = layer->connectModified(sigc::hide(sigc::hide(sigc::mem_fun(*this, &CurrentLayer::_emitChanged)))); } _emitChanged(); @@ -171,7 +171,7 @@ void StyleSubject::CurrentLayer::_afterDesktopSwitch(SPDesktop *desktop) { _layer_switched = desktop->connectCurrentLayerChanged(sigc::mem_fun(*this, &CurrentLayer::_setLayer)); _setLayer(desktop->currentLayer()); } else { - _setLayer(NULL); + _setLayer(nullptr); } } diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 15928e300..04a63271e 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -106,13 +106,13 @@ void StyleSwatch::ToolObserver::notify(Inkscape::Preferences::Entry const &val) StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) : - _desktop(NULL), + _desktop(nullptr), _verb_t(0), - _css(NULL), - _tool_obs(NULL), - _style_obs(NULL), + _css(nullptr), + _tool_obs(nullptr), + _style_obs(nullptr), _table(Gtk::manage(new Gtk::Grid())), - _sw_unit(NULL) + _sw_unit(nullptr) { set_name("StyleSwatch"); @@ -201,7 +201,7 @@ StyleSwatch::on_click(GdkEventButton */*event*/) if (this->_desktop && this->_verb_t != SP_VERB_NONE) { Inkscape::Verb *verb = Inkscape::Verb::get(this->_verb_t); SPAction *action = verb->get_action(Inkscape::ActionContext((Inkscape::UI::View::View *) this->_desktop)); - sp_action_perform (action, NULL); + sp_action_perform (action, nullptr); return true; } return false; @@ -227,7 +227,7 @@ StyleSwatch::setWatchedTool(const char *path, bool synthesize) if (_tool_obs) { delete _tool_obs; - _tool_obs = NULL; + _tool_obs = nullptr; } if (path) { diff --git a/src/ui/widget/text.cpp b/src/ui/widget/text.cpp index e6795b138..5b6b7468d 100644 --- a/src/ui/widget/text.cpp +++ b/src/ui/widget/text.cpp @@ -30,13 +30,13 @@ Text::Text(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const Text::getText() const { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); return static_cast<Gtk::Entry*>(_widget)->get_text(); } void Text::setText(Glib::ustring const text) { - g_assert(_widget != NULL); + g_assert(_widget != nullptr); setProgrammatically = true; // callback is supposed to reset back, if it cares static_cast<Gtk::Entry*>(_widget)->set_text(text); // FIXME: set correctly } diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index d2c338571..447efdfe0 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -46,7 +46,7 @@ namespace Widget { //==================================================== ToleranceSlider::ToleranceSlider(const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& label3, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& tip3, const Glib::ustring& key, Registry& wr) -: _vbox(0) +: _vbox(nullptr) { init(label1, label2, label3, tip1, tip2, tip3, key, wr); } diff --git a/src/ui/widget/unit-tracker.cpp b/src/ui/widget/unit-tracker.cpp index e7e47af4b..bb9425b29 100644 --- a/src/ui/widget/unit-tracker.cpp +++ b/src/ui/widget/unit-tracker.cpp @@ -33,7 +33,7 @@ namespace Widget { UnitTracker::UnitTracker(UnitType unit_type) : _active(0), _isUpdating(false), - _activeUnit(NULL), + _activeUnit(nullptr), _activeUnitInitialized(false), _store(nullptr), _priorValues() |
