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 | |
| 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.
676 files changed, 7558 insertions, 7558 deletions
diff --git a/src/attribute-rel-css.cpp b/src/attribute-rel-css.cpp index f8483d538..d8c90b573 100644 --- a/src/attribute-rel-css.cpp +++ b/src/attribute-rel-css.cpp @@ -25,7 +25,7 @@ #include "path-prefix.h" #include "preferences.h" -SPAttributeRelCSS * SPAttributeRelCSS::instance = NULL; +SPAttributeRelCSS * SPAttributeRelCSS::instance = nullptr; bool SPAttributeRelCSS::foundFileProp = false; bool SPAttributeRelCSS::foundFileDefault = false; @@ -35,7 +35,7 @@ bool SPAttributeRelCSS::foundFileDefault = false; */ bool SPAttributeRelCSS::findIfValid(Glib::ustring property, Glib::ustring element) { - if (SPAttributeRelCSS::instance == NULL) { + if (SPAttributeRelCSS::instance == nullptr) { SPAttributeRelCSS::instance = new SPAttributeRelCSS(); } @@ -75,7 +75,7 @@ bool SPAttributeRelCSS::findIfValid(Glib::ustring property, Glib::ustring elemen */ bool SPAttributeRelCSS::findIfDefault(Glib::ustring property, Glib::ustring value) { - if (SPAttributeRelCSS::instance == NULL) { + if (SPAttributeRelCSS::instance == nullptr) { SPAttributeRelCSS::instance = new SPAttributeRelCSS(); } @@ -94,7 +94,7 @@ bool SPAttributeRelCSS::findIfDefault(Glib::ustring property, Glib::ustring valu */ bool SPAttributeRelCSS::findIfInherit(Glib::ustring property) { - if (SPAttributeRelCSS::instance == NULL) { + if (SPAttributeRelCSS::instance == nullptr) { SPAttributeRelCSS::instance = new SPAttributeRelCSS(); } @@ -109,7 +109,7 @@ bool SPAttributeRelCSS::findIfInherit(Glib::ustring property) */ bool SPAttributeRelCSS::findIfProperty(Glib::ustring property) { - if (SPAttributeRelCSS::instance == NULL) { + if (SPAttributeRelCSS::instance == nullptr) { SPAttributeRelCSS::instance = new SPAttributeRelCSS(); } diff --git a/src/attribute-rel-svg.cpp b/src/attribute-rel-svg.cpp index 1f4bee1b3..e0aaa9f15 100644 --- a/src/attribute-rel-svg.cpp +++ b/src/attribute-rel-svg.cpp @@ -24,7 +24,7 @@ #include "path-prefix.h" #include "preferences.h" -SPAttributeRelSVG * SPAttributeRelSVG::instance = NULL; +SPAttributeRelSVG * SPAttributeRelSVG::instance = nullptr; bool SPAttributeRelSVG::foundFile = false; /* @@ -32,7 +32,7 @@ bool SPAttributeRelSVG::foundFile = false; */ bool SPAttributeRelSVG::isSVGElement(Glib::ustring element) { - if (SPAttributeRelSVG::instance == NULL) { + if (SPAttributeRelSVG::instance == nullptr) { SPAttributeRelSVG::instance = new SPAttributeRelSVG(); } @@ -53,7 +53,7 @@ bool SPAttributeRelSVG::isSVGElement(Glib::ustring element) */ bool SPAttributeRelSVG::findIfValid(Glib::ustring attribute, Glib::ustring element) { - if (SPAttributeRelSVG::instance == NULL) { + if (SPAttributeRelSVG::instance == nullptr) { SPAttributeRelSVG::instance = new SPAttributeRelSVG(); } diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp index d377e5edb..f428cc9f7 100644 --- a/src/attribute-rel-util.cpp +++ b/src/attribute-rel-util.cpp @@ -52,7 +52,7 @@ unsigned int sp_attribute_clean_get_prefs() { */ void sp_attribute_clean_tree(Node *repr) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); unsigned int flags = sp_attribute_clean_get_prefs(); @@ -66,7 +66,7 @@ void sp_attribute_clean_tree(Node *repr) { */ void sp_attribute_clean_recursive(Node *repr, unsigned int flags) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); if( repr->type() == Inkscape::XML::ELEMENT_NODE ) { Glib::ustring element = repr->name(); @@ -94,11 +94,11 @@ void sp_attribute_clean_recursive(Node *repr, unsigned int flags) { */ void sp_attribute_clean_element(Node *repr, unsigned int flags) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); g_return_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE); Glib::ustring element = repr->name(); - Glib::ustring id = (repr->attribute( "id" )==NULL ? "" : repr->attribute( "id" )); + Glib::ustring id = (repr->attribute( "id" )==nullptr ? "" : repr->attribute( "id" )); // Clean style: this attribute is unique in that normally we want to change it and not simply // delete it. @@ -122,7 +122,7 @@ void sp_attribute_clean_element(Node *repr, unsigned int flags) { // Do actual deleting (done after so as not to perturb List iterator). for( std::set<Glib::ustring>::const_iterator iter_d = attributesToDelete.begin(); iter_d != attributesToDelete.end(); ++iter_d ) { - repr->setAttribute( (*iter_d).c_str(), NULL, false ); + repr->setAttribute( (*iter_d).c_str(), nullptr, false ); } } @@ -132,7 +132,7 @@ void sp_attribute_clean_element(Node *repr, unsigned int flags) { */ void sp_attribute_clean_style(Node *repr, unsigned int flags) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); g_return_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE); // Find element's style @@ -144,7 +144,7 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) { Glib::ustring value; sp_repr_css_write_string(css, value); if( value.empty() ) { - repr->setAttribute("style", NULL ); + repr->setAttribute("style", nullptr ); } else { repr->setAttribute("style", value.c_str()); } @@ -158,7 +158,7 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) { */ Glib::ustring sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int flags) { - g_return_val_if_fail (repr != NULL, NULL); + g_return_val_if_fail (repr != nullptr, NULL); g_return_val_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE, NULL); SPCSSAttr *css = sp_repr_css_attr_new(); @@ -184,15 +184,15 @@ Glib::ustring sp_attribute_clean_style(Node *repr, gchar const *string, unsigned */ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) { - g_return_if_fail (repr != NULL); - g_return_if_fail (css != NULL); + g_return_if_fail (repr != nullptr); + g_return_if_fail (css != nullptr); Glib::ustring element = repr->name(); - Glib::ustring id = (repr->attribute( "id" )==NULL ? "" : repr->attribute( "id" )); + Glib::ustring id = (repr->attribute( "id" )==nullptr ? "" : repr->attribute( "id" )); // Find parent's style, including properties that are inherited. // Note, a node may not have a parent if it has not yet been added to tree. - SPCSSAttr *css_parent = NULL; + SPCSSAttr *css_parent = nullptr; if( repr->parent() ) css_parent = sp_repr_css_attr_inherited( repr->parent(), "style" ); // Loop over all properties in "style" node, keeping track of which to delete. @@ -215,8 +215,8 @@ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) { } // Find parent value for same property (property) - gchar const * value_p = NULL; - if( css_parent != NULL ) { + gchar const * value_p = nullptr; + if( css_parent != nullptr ) { for ( List<AttributeRecord const> iter_p = css_parent->attributeList() ; iter_p ; ++iter_p ) { gchar const * property_p = g_quark_to_string(iter_p->key); @@ -244,7 +244,7 @@ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) { // If property value is same as default and the parent value not set or property is not inherited, // mark for deletion. if ( SPAttributeRelCSS::findIfDefault( property, value ) && - ( (css_parent != NULL && value_p == NULL) || !SPAttributeRelCSS::findIfInherit( property ) ) ) { + ( (css_parent != nullptr && value_p == nullptr) || !SPAttributeRelCSS::findIfInherit( property ) ) ) { if ( flags & SP_ATTR_CLEAN_DEFAULT_WARN ) { g_warning( "<%s id=\"%s\">: CSS Style property: \"%s\" with default value (%s) not needed.", @@ -260,7 +260,7 @@ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) { // Delete unneeded style properties. Do this at the end so as to not perturb List iterator. for( std::set<Glib::ustring>::const_iterator iter_d = toDelete.begin(); iter_d != toDelete.end(); ++iter_d ) { - sp_repr_css_set_property( css, (*iter_d).c_str(), NULL ); + sp_repr_css_set_property( css, (*iter_d).c_str(), nullptr ); } } @@ -270,7 +270,7 @@ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) { */ void sp_attribute_purge_default_style(SPCSSAttr *css, unsigned int flags) { - g_return_if_fail (css != NULL); + g_return_if_fail (css != nullptr); // Loop over all properties in "style" node, keeping track of which to delete. std::set<Glib::ustring> toDelete; @@ -296,7 +296,7 @@ void sp_attribute_purge_default_style(SPCSSAttr *css, unsigned int flags) { // Delete unneeded style properties. Do this at the end so as to not perturb List iterator. for( std::set<Glib::ustring>::const_iterator iter_d = toDelete.begin(); iter_d != toDelete.end(); ++iter_d ) { - sp_repr_css_set_property( css, (*iter_d).c_str(), NULL ); + sp_repr_css_set_property( css, (*iter_d).c_str(), nullptr ); } } diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index 7aa8d8357..28a4d4f5a 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -32,7 +32,7 @@ using Inkscape::Util::List; */ void sp_attribute_sort_tree(Node *repr) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); sp_attribute_sort_recursive( repr ); } @@ -42,7 +42,7 @@ void sp_attribute_sort_tree(Node *repr) { */ void sp_attribute_sort_recursive(Node *repr) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); if( repr->type() == Inkscape::XML::ELEMENT_NODE ) { Glib::ustring element = repr->name(); @@ -75,7 +75,7 @@ bool cmp(std::pair< Glib::ustring, Glib::ustring > const &a, */ void sp_attribute_sort_element(Node *repr) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); g_return_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE); // Glib::ustring element = repr->name(); @@ -105,7 +105,7 @@ void sp_attribute_sort_element(Node *repr) { it != my_list.end(); ++it) { // Removing "inkscape:label" results in crash when Layers dialog is open. if (it->first != "inkscape:label") { - repr->setAttribute( it->first.c_str(), NULL, false ); + repr->setAttribute( it->first.c_str(), nullptr, false ); } } // Insert all attributes in proper order @@ -123,7 +123,7 @@ void sp_attribute_sort_element(Node *repr) { */ void sp_attribute_sort_style(Node *repr) { - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); g_return_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE); // Find element's style @@ -135,7 +135,7 @@ void sp_attribute_sort_style(Node *repr) { Glib::ustring value; sp_repr_css_write_string(css, value); if( value.empty() ) { - repr->setAttribute("style", NULL ); + repr->setAttribute("style", nullptr ); } else { repr->setAttribute("style", value.c_str()); } @@ -149,7 +149,7 @@ void sp_attribute_sort_style(Node *repr) { */ Glib::ustring sp_attribute_sort_style(Node *repr, gchar const *string) { - g_return_val_if_fail (repr != NULL, NULL); + g_return_val_if_fail (repr != nullptr, NULL); g_return_val_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE, NULL); SPCSSAttr *css = sp_repr_css_attr_new(); @@ -169,11 +169,11 @@ Glib::ustring sp_attribute_sort_style(Node *repr, gchar const *string) { */ void sp_attribute_sort_style(Node* repr, SPCSSAttr *css) { - g_return_if_fail (repr != NULL); - g_return_if_fail (css != NULL); + g_return_if_fail (repr != nullptr); + g_return_if_fail (css != nullptr); Glib::ustring element = repr->name(); - Glib::ustring id = (repr->attribute( "id" )==NULL ? "" : repr->attribute( "id" )); + Glib::ustring id = (repr->attribute( "id" )==nullptr ? "" : repr->attribute( "id" )); // Loop over all properties in "style" node. std::vector<std::pair< Glib::ustring, Glib::ustring > > my_list; @@ -190,7 +190,7 @@ void sp_attribute_sort_style(Node* repr, SPCSSAttr *css) { //for (auto it: my_list) { for (std::vector<std::pair< Glib::ustring, Glib::ustring > >::iterator it = my_list.begin(); it != my_list.end(); ++it) { - sp_repr_css_set_property( css, it->first.c_str(), NULL ); + sp_repr_css_set_property( css, it->first.c_str(), nullptr ); } // Insert all attributes in proper order for (std::vector<std::pair< Glib::ustring, Glib::ustring > >::iterator it = my_list.begin(); diff --git a/src/attributes.cpp b/src/attributes.cpp index fb9b97a15..0c16916f9 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -25,7 +25,7 @@ typedef struct { */ static SPStyleProp const props[] = { - {SP_ATTR_INVALID, NULL}, + {SP_ATTR_INVALID, nullptr}, /* SPObject */ {SP_ATTR_ID, "id"}, {SP_ATTR_STYLE, "style"}, @@ -579,7 +579,7 @@ unsigned char const * sp_attribute_name(unsigned int id) { if (id >= n_attrs) { - return NULL; + return nullptr; } return (unsigned char*)props[id].name; diff --git a/src/color.cpp b/src/color.cpp index d7e8d25dd..29efd5fee 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -35,7 +35,7 @@ static bool profileMatches( SVGICCColor const* first, SVGICCColor const* second #define PROFILE_EPSILON 0.00000001 SPColor::SPColor() : - icc(0) + icc(nullptr) { v.c[0] = 0; v.c[1] = 0; @@ -43,19 +43,19 @@ SPColor::SPColor() : } SPColor::SPColor( SPColor const& other ) : - icc(0) + icc(nullptr) { *this = other; } SPColor::SPColor( float r, float g, float b ) : - icc(0) + icc(nullptr) { set( r, g, b ); } SPColor::SPColor( guint32 value ) : - icc(0) + icc(nullptr) { set( value ); } @@ -63,7 +63,7 @@ SPColor::SPColor( guint32 value ) : SPColor::~SPColor() { delete icc; - icc = 0; + icc = nullptr; } @@ -73,7 +73,7 @@ SPColor& SPColor::operator= (SPColor const& other) return *this; } - SVGICCColor* tmp_icc = other.icc ? new SVGICCColor(*other.icc) : 0; + SVGICCColor* tmp_icc = other.icc ? new SVGICCColor(*other.icc) : nullptr; v.c[0] = other.v.c[0]; v.c[1] = other.v.c[1]; @@ -223,8 +223,8 @@ std::string SPColor::toString() const void sp_color_get_rgb_floatv(SPColor const *color, float *rgb) { - return_if_fail (color != NULL); - return_if_fail (rgb != NULL); + return_if_fail (color != nullptr); + return_if_fail (rgb != nullptr); rgb[0] = color->v.c[0]; rgb[1] = color->v.c[1]; @@ -238,8 +238,8 @@ sp_color_get_rgb_floatv(SPColor const *color, float *rgb) void sp_color_get_cmyk_floatv(SPColor const *color, float *cmyk) { - return_if_fail (color != NULL); - return_if_fail (cmyk != NULL); + return_if_fail (color != nullptr); + return_if_fail (cmyk != nullptr); sp_color_rgb_to_cmyk_floatv( cmyk, color->v.c[0], diff --git a/src/conditions.cpp b/src/conditions.cpp index b531f22cf..4188b75e1 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -58,8 +58,8 @@ bool sp_item_evaluate(SPItem const *item) { #define ISALNUM(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= '0' && (c) <= '9')) static gchar *preprocessLanguageCode(gchar *lngcode) { - if ( NULL == lngcode ) - return NULL; + if ( nullptr == lngcode ) + return nullptr; lngcode = g_strstrip(lngcode); if ( 0 == *lngcode ) @@ -80,11 +80,11 @@ static gchar *preprocessLanguageCode(gchar *lngcode) { } static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { - if ( NULL == value ) + if ( nullptr == value ) return true; std::set<Glib::ustring> language_codes; - gchar *str = NULL; + gchar *str = nullptr; gchar **strlist = g_strsplit( value, ",", 0); for ( int i = 0 ; (str = strlist[i]) ; i++ ) { @@ -132,7 +132,7 @@ static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { static std::vector<Glib::ustring> splitByWhitespace(gchar const *value) { std::vector<Glib::ustring> parts; - gchar *str = NULL; + gchar *str = nullptr; gchar **strlist = g_strsplit( value, ",", 0); for ( int i = 0 ; (str = strlist[i]) ; i++ ) { @@ -246,7 +246,7 @@ static bool evaluateSVG10Feature(gchar const *feature) { } static bool evaluateSingleFeature(gchar const *value) { - if ( NULL == value ) + if ( nullptr == value ) return false; gchar const *found; found = strstr(value, SVG11FEATURE); @@ -259,7 +259,7 @@ static bool evaluateSingleFeature(gchar const *value) { } static bool evaluateRequiredFeatures(SPItem const */*item*/, gchar const *value) { - if ( NULL == value ) + if ( nullptr == value ) return true; std::vector<Glib::ustring> parts = splitByWhitespace(value); @@ -278,7 +278,7 @@ static bool evaluateRequiredFeatures(SPItem const */*item*/, gchar const *value) } static bool evaluateRequiredExtensions(SPItem const */*item*/, gchar const *value) { - if ( NULL == value ) + if ( nullptr == value ) return true; return false; } diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index c7254a449..d4b0ee50a 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -45,7 +45,7 @@ static Avoid::Polygon avoid_item_poly(SPItem const *item); SPAvoidRef::SPAvoidRef(SPItem *spitem) - : shapeRef(NULL) + : shapeRef(nullptr) , item(spitem) , setting(false) , new_setting(false) @@ -65,7 +65,7 @@ SPAvoidRef::~SPAvoidRef() if (shapeRef && router) { router->deleteShape(shapeRef); } - shapeRef = NULL; + shapeRef = nullptr; } @@ -83,7 +83,7 @@ void SPAvoidRef::setAvoid(char const *value) void SPAvoidRef::handleSettingChange(void) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) { + if (desktop == nullptr) { return; } if (desktop->getDocument() != item->document) { @@ -112,7 +112,7 @@ void SPAvoidRef::handleSettingChange(void) sigc::ptr_fun(&avoid_item_move)); char const *id = item->getAttribute("id"); - g_assert(id != NULL); + g_assert(id != nullptr); // Get a unique ID for the item. GQuark itemID = g_quark_from_string(id); @@ -125,7 +125,7 @@ void SPAvoidRef::handleSettingChange(void) g_assert(shapeRef); router->deleteShape(shapeRef); - shapeRef = NULL; + shapeRef = nullptr; } } @@ -142,7 +142,7 @@ std::vector<SPItem *> SPAvoidRef::getAttachedShapes(const unsigned int type) for (Avoid::IntList::iterator i = shapes.begin(); i != finish; ++i) { const gchar *connId = g_quark_to_string(*i); SPObject *obj = item->document->getObjectById(connId); - if (obj == NULL) { + if (obj == nullptr) { g_warning("getAttachedShapes: Object with id=\"%s\" is not " "found. Skipping.", connId); continue; @@ -166,7 +166,7 @@ std::vector<SPItem *> SPAvoidRef::getAttachedConnectors(const unsigned int type) for (Avoid::IntList::iterator i = conns.begin(); i != finish; ++i) { const gchar *connId = g_quark_to_string(*i); SPObject *obj = item->document->getObjectById(connId); - if (obj == NULL) { + if (obj == nullptr) { g_warning("getAttachedConnectors: Object with id=\"%s\" is not " "found. Skipping.", connId); continue; @@ -270,7 +270,7 @@ static std::vector<Geom::Point> approxItemWithPoints(SPItem const *item, const G static Avoid::Polygon avoid_item_poly(SPItem const *item) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - g_assert(desktop != NULL); + g_assert(desktop != nullptr); double spacing = desktop->namedview->connector_spacing; Geom::Affine itd_mat = item->i2doc_affine(); diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp index d422b8e72..e89d895b8 100644 --- a/src/debug/logger.cpp +++ b/src/debug/logger.cpp @@ -109,7 +109,7 @@ static void set_category_mask(bool * const mask, char const *filter) { { "INTERACTION", Event::INTERACTION }, { "CONFIGURATION", Event::CONFIGURATION }, { "OTHER", Event::OTHER }, - { NULL, Event::OTHER } + { nullptr, Event::OTHER } }; CategoryName const *iter; for ( iter = category_names ; iter->name ; iter++ ) { diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h index b22f1c2ee..7f7f7614d 100644 --- a/src/debug/simple-event.h +++ b/src/debug/simple-event.h @@ -73,7 +73,7 @@ private: va_list args; va_start(args, format); gchar *value=g_strdup_vprintf(format, args); - g_assert(value != NULL); + g_assert(value != nullptr); va_end(args); _addProperty(name, value); g_free(value); diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index feeddbdff..6f79f33e3 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -99,7 +99,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge { static bool clicked = false; static bool dragged = false; - static SPCanvasItem *guide = NULL; + static SPCanvasItem *guide = nullptr; static Geom::Point normal; int wx, wy; static gint xp = 0, yp = 0; // where drag started @@ -110,8 +110,8 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge gint width, height; auto device = gdk_event_get_device(event); - gdk_window_get_device_position(window, device, &wx, &wy, NULL); - gdk_window_get_geometry(window, NULL /*x*/, NULL /*y*/, &width, &height); + gdk_window_get_device_position(window, device, &wx, &wy, nullptr); + gdk_window_get_geometry(window, nullptr /*x*/, nullptr /*y*/, &width, &height); Geom::Point const event_win(wx, wy); @@ -164,7 +164,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge } } - guide = sp_guideline_new(desktop->guides, NULL, event_dt, normal); + guide = sp_guideline_new(desktop->guides, nullptr, event_dt, normal); sp_guideline_set_color(SP_GUIDELINE(guide), desktop->namedview->guidehicolor); auto window = gtk_widget_get_window(widget); @@ -175,10 +175,10 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge window, GDK_SEAT_CAPABILITY_ALL_POINTING, FALSE, - NULL, + nullptr, event, - NULL, - NULL); + nullptr, + nullptr); #else gdk_device_grab(device, window, @@ -237,7 +237,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge } sp_canvas_item_destroy(guide); - guide = NULL; + guide = nullptr; if ((horiz ? wy : wx) >= 0) { Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide"); @@ -347,7 +347,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) ( GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK ), - NULL, + nullptr, event->button.time); } ret = TRUE; @@ -364,7 +364,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) // This is for snapping while dragging existing guidelines. New guidelines, // which are dragged off the ruler, are being snapped in sp_dt_ruler_event SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop, true, NULL, NULL, guide); + m.setup(desktop, true, nullptr, nullptr, guide); if (drag_type == SP_DRAG_MOVE_ORIGIN) { // If we snap in guideConstrainedSnap() below, then motion_dt will // be forced to be on the guide. If we don't snap however, then @@ -445,7 +445,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) Geom::Point event_dt(desktop->w2d(event_w)); SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop, true, NULL, NULL, guide); + m.setup(desktop, true, nullptr, nullptr, guide); if (drag_type == SP_DRAG_MOVE_ORIGIN) { // If we snap in guideConstrainedSnap() below, then motion_dt will // be forced to be on the guide. If we don't snap however, then diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 0d9ae599e..3da49fd37 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -163,12 +163,12 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) } for (auto& child: o->children) { - if (sp_repr_css_property(css, "opacity", NULL) != NULL) { + if (sp_repr_css_property(css, "opacity", nullptr) != nullptr) { // Unset properties which are accumulating and thus should not be set recursively. // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group. SPCSSAttr *css_recurse = sp_repr_css_attr_new(); sp_repr_css_merge(css_recurse, css); - sp_repr_css_set_property(css_recurse, "opacity", NULL); + sp_repr_css_set_property(css_recurse, "opacity", nullptr); sp_desktop_apply_css_recursive(&child, css_recurse, skip_lines); sp_repr_css_attr_unref(css_recurse); } else { @@ -270,7 +270,7 @@ sp_desktop_get_style(SPDesktop *desktop, bool with_text) sp_repr_css_merge(css, desktop->current); if (!css->attributeList()) { sp_repr_css_attr_unref(css); - return NULL; + return nullptr; } else { if (!with_text) { css = sp_css_attr_unset_text(css); @@ -304,7 +304,7 @@ double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool *has_opacity) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - SPCSSAttr *css = NULL; + SPCSSAttr *css = nullptr; gfloat value = 1.0; // default if nothing else found if (has_opacity) *has_opacity = false; @@ -315,7 +315,7 @@ sp_desktop_get_master_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool } if (css) { - gchar const *property = css ? sp_repr_css_property(css, "opacity", "1.000") : 0; + gchar const *property = css ? sp_repr_css_property(css, "opacity", "1.000") : nullptr; if (desktop->current && property) { // if there is style and the property in it, if ( !sp_svg_number_read_f(property, &value) ) { @@ -335,7 +335,7 @@ double sp_desktop_get_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - SPCSSAttr *css = NULL; + SPCSSAttr *css = nullptr; gfloat value = 1.0; // default if nothing else found if (prefs->getBool(tool + "/usecurrent")) { css = sp_desktop_get_style(desktop, true); @@ -344,7 +344,7 @@ sp_desktop_get_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool } if (css) { - gchar const *property = css ? sp_repr_css_property(css, is_fill ? "fill-opacity": "stroke-opacity", "1.000") : 0; + gchar const *property = css ? sp_repr_css_property(css, is_fill ? "fill-opacity": "stroke-opacity", "1.000") : nullptr; if (desktop->current && property) { // if there is style and the property in it, if ( !sp_svg_number_read_f(property, &value) ) { @@ -362,7 +362,7 @@ guint32 sp_desktop_get_color_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill, bool *has_color) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - SPCSSAttr *css = NULL; + SPCSSAttr *css = nullptr; guint32 r = 0; // if there's no color, return black if (has_color) *has_color = false; @@ -503,7 +503,7 @@ objects_query_fillstroke (const std::vector<SPItem*> &objects, SPStyle *style_re bool paintImpossible = true; paint_res->set = true; - SVGICCColor* iccColor = 0; + SVGICCColor* iccColor = nullptr; bool iccSeen = false; gfloat c[4]; @@ -547,8 +547,8 @@ objects_query_fillstroke (const std::vector<SPItem*> &objects, SPStyle *style_re SPPaintServer *server = isfill ? style->getFillPaintServer() : style->getStrokePaintServer(); SPLinearGradient *linear_res = dynamic_cast<SPLinearGradient *>(server_res); - SPRadialGradient *radial_res = linear_res ? NULL : dynamic_cast<SPRadialGradient *>(server_res); - SPPattern *pattern_res = (linear_res || radial_res) ? NULL : dynamic_cast<SPPattern *>(server_res); + SPRadialGradient *radial_res = linear_res ? nullptr : dynamic_cast<SPRadialGradient *>(server_res); + SPPattern *pattern_res = (linear_res || radial_res) ? nullptr : dynamic_cast<SPPattern *>(server_res); if (linear_res) { SPLinearGradient *linear = dynamic_cast<SPLinearGradient *>(server); if (!linear) { @@ -602,14 +602,14 @@ objects_query_fillstroke (const std::vector<SPItem*> &objects, SPStyle *style_re } else { if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2])) { same_color = false; - iccColor = 0; + iccColor = nullptr; } if ( iccSeen && iccColor ) { if ( !paint->value.color.icc || (iccColor->colorProfile != paint->value.color.icc->colorProfile) || !vectorsClose(iccColor->colors, paint->value.color.icc->colors) ) { same_color = false; - iccColor = 0; + iccColor = nullptr; } } } @@ -627,7 +627,7 @@ objects_query_fillstroke (const std::vector<SPItem*> &objects, SPStyle *style_re paint_res->colorSet = paint->colorSet; paint_res->paintOrigin = paint->paintOrigin; if (paint_res->set && paint_effectively_set && paint->isPaintserver()) { // copy the server - gchar const *string = NULL; // memory leak results if style->get* called inside sp_style_set_to_uri_string. + gchar const *string = nullptr; // memory leak results if style->get* called inside sp_style_set_to_uri_string. if (isfill) { string = style->getFillURI(); sp_style_set_to_uri_string (style_res, true, string); @@ -1074,7 +1074,7 @@ objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_r texts ++; SPItem *item = dynamic_cast<SPItem *>(obj); - g_assert(item != NULL); + g_assert(item != nullptr); // Quick way of getting document scale. Should be same as: // item->document->getDocumentScale().Affine().descrim() @@ -1443,7 +1443,7 @@ objects_query_fontfeaturesettings (const std::vector<SPItem*> &objects, SPStyle if (style_res->font_feature_settings.value) { g_free(style_res->font_feature_settings.value); - style_res->font_feature_settings.value = NULL; + style_res->font_feature_settings.value = nullptr; } style_res->font_feature_settings.set = FALSE; @@ -1469,7 +1469,7 @@ objects_query_fontfeaturesettings (const std::vector<SPItem*> &objects, SPStyle if (style_res->font_feature_settings.value) { g_free(style_res->font_feature_settings.value); - style_res->font_feature_settings.value = NULL; + style_res->font_feature_settings.value = nullptr; } style_res->font_feature_settings.set = true; @@ -1599,7 +1599,7 @@ objects_query_fontfamily (const std::vector<SPItem*> &objects, SPStyle *style_re if (style_res->font_family.value) { g_free(style_res->font_family.value); - style_res->font_family.value = NULL; + style_res->font_family.value = nullptr; } style_res->font_family.set = FALSE; @@ -1625,7 +1625,7 @@ objects_query_fontfamily (const std::vector<SPItem*> &objects, SPStyle *style_re if (style_res->font_family.value) { g_free(style_res->font_family.value); - style_res->font_family.value = NULL; + style_res->font_family.value = nullptr; } style_res->font_family.set = true; @@ -1655,7 +1655,7 @@ objects_query_fontspecification (const std::vector<SPItem*> &objects, SPStyle *s if (style_res->font_specification.value) { g_free(style_res->font_specification.value); - style_res->font_specification.value = NULL; + style_res->font_specification.value = nullptr; } style_res->font_specification.set = FALSE; @@ -1684,7 +1684,7 @@ objects_query_fontspecification (const std::vector<SPItem*> &objects, SPStyle *s if (style_res->font_specification.value) { g_free(style_res->font_specification.value); - style_res->font_specification.value = NULL; + style_res->font_specification.value = nullptr; } style_res->font_specification.set = true; @@ -1938,7 +1938,7 @@ sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property) return ret; // subselection returned a style, pass it on // otherwise, do querying and averaging over selection - if (desktop->selection != NULL) { + if (desktop->selection != nullptr) { std::vector<SPItem *> vec(desktop->selection->items().begin(), desktop->selection->items().end()); return sp_desktop_query_style_from_list (vec, style, property); } diff --git a/src/desktop-style.h b/src/desktop-style.h index 7887f2709..6674e5329 100644 --- a/src/desktop-style.h +++ b/src/desktop-style.h @@ -68,9 +68,9 @@ void sp_desktop_set_style(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAtt void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true); SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text); guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill); -double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool* has_opacity = NULL); +double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool* has_opacity = nullptr); double sp_desktop_get_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill); -guint32 sp_desktop_get_color_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill, bool* has_color = NULL); +guint32 sp_desktop_get_color_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill, bool* has_color = nullptr); double sp_desktop_get_font_size_tool (SPDesktop *desktop); void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, Glib::ustring const &tool, bool with_text); diff --git a/src/desktop.cpp b/src/desktop.cpp index dad60832d..8e71d0d5a 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -88,27 +88,27 @@ static void _reconstruction_finish(SPDesktop * desktop); static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop); SPDesktop::SPDesktop() : - _dlg_mgr( NULL ), - namedview( NULL ), - canvas( NULL ), - layers( NULL ), - selection( NULL ), - event_context( NULL ), - layer_manager( NULL ), - event_log( NULL ), - temporary_item_list( NULL ), - snapindicator( NULL ), - acetate( NULL ), - main( NULL ), - gridgroup( NULL ), - guides( NULL ), - drawing( NULL ), - sketch( NULL ), - controls( NULL ), - tempgroup ( NULL ), - page( NULL ), - page_border( NULL ), - current( NULL ), + _dlg_mgr( nullptr ), + namedview( nullptr ), + canvas( nullptr ), + layers( nullptr ), + selection( nullptr ), + event_context( nullptr ), + layer_manager( nullptr ), + event_log( nullptr ), + temporary_item_list( nullptr ), + snapindicator( nullptr ), + acetate( nullptr ), + main( nullptr ), + gridgroup( nullptr ), + guides( nullptr ), + drawing( nullptr ), + sketch( nullptr ), + controls( nullptr ), + tempgroup ( nullptr ), + page( nullptr ), + page_border( nullptr ), + current( nullptr ), _focusMode(false), dkey( 0 ), number( 0 ), @@ -117,15 +117,15 @@ SPDesktop::SPDesktop() : waiting_cursor( false ), showing_dialogs ( false ), guides_active( false ), - gr_item( NULL ), + gr_item( nullptr ), gr_point_type( POINT_LG_BEGIN ), gr_point_i( 0 ), gr_fill_or_stroke( Inkscape::FOR_FILL ), _reconstruction_old_layer_id(), // an id attribute is not allowed to be the empty string _display_mode(Inkscape::RENDERMODE_NORMAL), _display_color_mode(Inkscape::COLORMODE_NORMAL), - _widget( NULL ), - _guides_message_context( NULL ), + _widget( nullptr ), + _guides_message_context( nullptr ), _active( false ), _doc2dt( Geom::Scale(1, -1) ), _image_render_observer(this, "/options/rendering/imageinoutlinemode"), @@ -194,19 +194,19 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid SPCanvasGroup *root = canvas->getRoot(); /* Setup administrative layers */ - acetate = sp_canvas_item_new (root, GNOME_TYPE_CANVAS_ACETATE, NULL); + acetate = sp_canvas_item_new (root, GNOME_TYPE_CANVAS_ACETATE, nullptr); g_signal_connect (G_OBJECT (acetate), "event", G_CALLBACK (sp_desktop_root_handler), this); - main = (SPCanvasGroup *) sp_canvas_item_new (root, SP_TYPE_CANVAS_GROUP, NULL); + main = (SPCanvasGroup *) sp_canvas_item_new (root, SP_TYPE_CANVAS_GROUP, nullptr); g_signal_connect (G_OBJECT (main), "event", G_CALLBACK (sp_desktop_root_handler), this); /* This is the background the page sits on. */ canvas->setBackgroundColor(0xffffff00); - page = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, NULL); + page = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, nullptr); ((CtrlRect *) page)->setColor(0x00000000, FALSE, 0x00000000); - page_border = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, NULL); + page_border = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, nullptr); - drawing = sp_canvas_item_new (main, SP_TYPE_CANVAS_ARENA, NULL); + drawing = sp_canvas_item_new (main, SP_TYPE_CANVAS_ARENA, nullptr); g_signal_connect (G_OBJECT (drawing), "arena_event", G_CALLBACK (_arena_handler), this); SP_CANVAS_ARENA (drawing)->drawing.delta = prefs->getDouble("/options/cursortolerance/value", 1.0); // default is 1 px @@ -226,11 +226,11 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid // will not work (the snap indicator is on top of the node handler; is the snapindicator // being selected? or does it intercept some of the events that should have gone to the // node handler? see bug https://bugs.launchpad.net/inkscape/+bug/414142) - gridgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); - guides = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); - sketch = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); - tempgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); - controls = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); + gridgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, nullptr); + guides = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, nullptr); + sketch = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, nullptr); + tempgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, nullptr); + controls = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, nullptr); // Set the select tool as the active tool. setEventContext("/tools/select"); @@ -322,7 +322,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid temporary_item_list = new Inkscape::Display::TemporaryItemList( this ); snapindicator = new Inkscape::Display::SnapIndicator ( this ); - canvas_rotate = sp_canvas_item_new (root, SP_TYPE_CANVAS_ROTATE, NULL); + canvas_rotate = sp_canvas_item_new (root, SP_TYPE_CANVAS_ROTATE, nullptr); sp_canvas_item_hide( canvas_rotate ); // canvas_debug = sp_canvas_item_new (main, SP_TYPE_CANVAS_DEBUG, NULL); } @@ -333,17 +333,17 @@ void SPDesktop::destroy() if (snapindicator) { delete snapindicator; - snapindicator = NULL; + snapindicator = nullptr; } if (temporary_item_list) { delete temporary_item_list; - temporary_item_list = NULL; + temporary_item_list = nullptr; } if (selection) { delete selection; - selection = NULL; + selection = nullptr; } namedview->hide(this); @@ -365,17 +365,17 @@ void SPDesktop::destroy() if (layer_manager) { delete layer_manager; - layer_manager = NULL; + layer_manager = nullptr; } if (drawing) { doc()->getRoot()->invoke_hide(dkey); g_object_unref(drawing); - drawing = NULL; + drawing = nullptr; } delete _guides_message_context; - _guides_message_context = NULL; + _guides_message_context = nullptr; } SPDesktop::~SPDesktop() @@ -633,7 +633,7 @@ SPDesktop::activate_guides(bool activate) void SPDesktop::change_document (SPDocument *theDocument) { - g_return_if_fail (theDocument != NULL); + g_return_if_fail (theDocument != nullptr); /* unselect everything before switching documents */ selection->clear(); @@ -643,7 +643,7 @@ SPDesktop::change_document (SPDocument *theDocument) /* update the rulers, connect the desktop widget's signal to the new namedview etc. (this can probably be done in a better way) */ Gtk::Window *parent = this->getToplevel(); - g_assert(parent != NULL); + g_assert(parent != nullptr); SPDesktopWidget *dtw = (SPDesktopWidget *) parent->get_data("desktopwidget"); if (dtw) { dtw->desktop = this; @@ -704,7 +704,7 @@ Inkscape::UI::Widget::Dock* SPDesktop::getDock() { */ SPItem *SPDesktop::getItemFromListAtPointBottom(const std::vector<SPItem*> &list, Geom::Point const &p) const { - g_return_val_if_fail (doc() != NULL, NULL); + g_return_val_if_fail (doc() != nullptr, NULL); return SPDocument::getItemFromListAtPointBottom(dkey, doc()->getRoot(), list, p); } @@ -713,7 +713,7 @@ SPItem *SPDesktop::getItemFromListAtPointBottom(const std::vector<SPItem*> &list */ SPItem *SPDesktop::getItemAtPoint(Geom::Point const &p, bool into_groups, SPItem *upto) const { - g_return_val_if_fail (doc() != NULL, NULL); + g_return_val_if_fail (doc() != nullptr, NULL); return doc()->getItemAtPoint( dkey, p, into_groups, upto); } @@ -722,7 +722,7 @@ SPItem *SPDesktop::getItemAtPoint(Geom::Point const &p, bool into_groups, SPItem */ SPItem *SPDesktop::getGroupAtPoint(Geom::Point const &p) const { - g_return_val_if_fail (doc() != NULL, NULL); + g_return_val_if_fail (doc() != nullptr, NULL); return doc()->getGroupAtPoint(dkey, p); } @@ -993,9 +993,9 @@ SPDesktop::zoom_page_width() void SPDesktop::zoom_drawing() { - g_return_if_fail (doc() != NULL); + g_return_if_fail (doc() != nullptr); SPItem *docitem = doc()->getRoot(); - g_return_if_fail (docitem != NULL); + g_return_if_fail (docitem != nullptr); docitem->bbox_valid = FALSE; Geom::OptRect d = docitem->desktopVisualBounds(); @@ -1612,7 +1612,7 @@ SPDesktop::setDocument (SPDocument *doc) this->doc()->removeUndoObserver(*event_log); } delete event_log; - event_log = 0; + event_log = nullptr; } /* setup EventLog */ @@ -1627,9 +1627,9 @@ SPDesktop::setDocument (SPDocument *doc) /// are surely more safe methods to accomplish this. // TODO since the comment had reversed logic, check the intent of this block of code: if (drawing) { - Inkscape::DrawingItem *ai = 0; + Inkscape::DrawingItem *ai = nullptr; - namedview = sp_document_namedview (doc, NULL); + namedview = sp_document_namedview (doc, nullptr); _modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this)); number = namedview->getViewCount(); @@ -1773,7 +1773,7 @@ static void _reconstruction_finish(SPDesktop * desktop) g_debug("Desktop, finishing reconstruction\n"); if ( !desktop->_reconstruction_old_layer_id.empty() ) { SPObject * newLayer = desktop->namedview->document->getObjectById(desktop->_reconstruction_old_layer_id); - if (newLayer != NULL) { + if (newLayer != nullptr) { desktop->layers->setCurrentLayer(newLayer); } @@ -1880,7 +1880,7 @@ SPDesktop::show_dialogs() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs == NULL) { + if (prefs == nullptr) { return; } diff --git a/src/desktop.h b/src/desktop.h index aec4ee518..927e1a3da 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -313,7 +313,7 @@ public: void set_coordinate_status (Geom::Point p); SPItem *getItemFromListAtPointBottom(const std::vector<SPItem*> &list, Geom::Point const &p) const; - SPItem *getItemAtPoint(Geom::Point const &p, bool into_groups, SPItem *upto = NULL) const; + SPItem *getItemAtPoint(Geom::Point const &p, bool into_groups, SPItem *upto = nullptr) const; SPItem *getGroupAtPoint(Geom::Point const &p) const; Geom::Point point() const; diff --git a/src/device-manager.cpp b/src/device-manager.cpp index df6567a30..cbc67238e 100644 --- a/src/device-manager.cpp +++ b/src/device-manager.cpp @@ -604,7 +604,7 @@ void DeviceManagerImpl::setLinkedTo(Glib::ustring const & id, Glib::ustring cons -static DeviceManagerImpl* theInstance = 0; +static DeviceManagerImpl* theInstance = nullptr; DeviceManager::DeviceManager() : Glib::Object() diff --git a/src/dir-util.cpp b/src/dir-util.cpp index 64f7ab7e7..96968cd6d 100644 --- a/src/dir-util.cpp +++ b/src/dir-util.cpp @@ -41,15 +41,15 @@ std::string sp_relative_path_from_path( std::string const &path, std::string con char const *sp_extension_from_path(char const *const path) { - if (path == NULL) { - return NULL; + if (path == nullptr) { + return nullptr; } char const *p = path; while (*p != '\0') p++; while ((p >= path) && (*p != G_DIR_SEPARATOR) && (*p != '.')) p--; - if (* p != '.') return NULL; + if (* p != '.') return nullptr; p++; return p; @@ -78,7 +78,7 @@ char *inkscape_rel2abs(const char *path, const char *base, char *result, const s else if (*base != G_DIR_SEPARATOR || !size) { errno = EINVAL; - return (NULL); + return (nullptr); } else if (size == 1) goto erange; @@ -144,7 +144,7 @@ finish: return result; erange: errno = ERANGE; - return (NULL); + return (nullptr); } char *inkscape_abs2rel(const char *path, const char *base, char *result, const size_t size) @@ -164,7 +164,7 @@ char *inkscape_abs2rel(const char *path, const char *base, char *result, const s else if (*base != G_DIR_SEPARATOR || !size) { errno = EINVAL; - return (NULL); + return (nullptr); } else if (size == 1) goto erange; @@ -214,13 +214,13 @@ finish: return result; erange: errno = ERANGE; - return (NULL); + return (nullptr); } char *prepend_current_dir_if_relative(gchar const *uri) { if (!uri) { - return NULL; + return nullptr; } gchar *full_path = (gchar *) g_malloc (1001); @@ -228,7 +228,7 @@ char *prepend_current_dir_if_relative(gchar const *uri) gsize bytesRead = 0; gsize bytesWritten = 0; - GError* error = NULL; + GError* error = nullptr; gchar* cwd_utf8 = g_filename_to_utf8 ( cwd, -1, &bytesRead, diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index eae6b0d19..e34e4cd6b 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -162,7 +162,7 @@ Pixbuf::Pixbuf(cairo_surface_t *s) : _pixbuf(gdk_pixbuf_new_from_data( cairo_image_surface_get_data(s), GDK_COLORSPACE_RGB, TRUE, 8, cairo_image_surface_get_width(s), cairo_image_surface_get_height(s), - cairo_image_surface_get_stride(s), NULL, NULL)) + cairo_image_surface_get_stride(s), nullptr, nullptr)) , _surface(s) , _mod_time(0) , _pixel_format(PF_CAIRO) @@ -174,7 +174,7 @@ Pixbuf::Pixbuf(cairo_surface_t *s) * so it should not be unrefed. */ Pixbuf::Pixbuf(GdkPixbuf *pb) : _pixbuf(pb) - , _surface(0) + , _surface(nullptr) , _mod_time(0) , _pixel_format(PF_GDK) , _cairo_store(false) @@ -209,7 +209,7 @@ Pixbuf::~Pixbuf() Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data) { - Pixbuf *pixbuf = NULL; + Pixbuf *pixbuf = nullptr; bool data_is_image = false; bool data_is_svg = false; @@ -271,13 +271,13 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data) if ((*data) && data_is_image && !data_is_svg && data_is_base64) { GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); - if (!loader) return NULL; + if (!loader) return nullptr; gsize decoded_len = 0; guchar *decoded = g_base64_decode(data, &decoded_len); - if (gdk_pixbuf_loader_write(loader, decoded, decoded_len, NULL)) { - gdk_pixbuf_loader_close(loader, NULL); + if (gdk_pixbuf_loader_write(loader, decoded, decoded_len, nullptr)) { + gdk_pixbuf_loader_close(loader, nullptr); GdkPixbuf *buf = gdk_pixbuf_loader_get_pixbuf(loader); if (buf) { g_object_ref(buf); @@ -301,13 +301,13 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data) guchar *decoded = g_base64_decode(data, &decoded_len); SPDocument *svgDoc = SPDocument::createNewDocFromMem (reinterpret_cast<gchar const *>(decoded), decoded_len, false); // Check the document loaded properly - if (svgDoc == NULL) { - return NULL; + if (svgDoc == nullptr) { + return nullptr; } - if (svgDoc->getRoot() == NULL) + if (svgDoc->getRoot() == nullptr) { svgDoc->doUnref(); - return NULL; + return nullptr; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const double dpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", 96.0); @@ -321,13 +321,13 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data) const int scaledSvgWidth = round(svgWidth_px/(96.0/dpi)); const int scaledSvgHeight = round(svgHeight_px/(96.0/dpi)); - GdkPixbuf *buf = sp_generate_internal_bitmap(svgDoc, NULL, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, NULL)->getPixbufRaw(); + GdkPixbuf *buf = sp_generate_internal_bitmap(svgDoc, nullptr, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, nullptr)->getPixbufRaw(); // Tidy up svgDoc->doUnref(); - if (buf == NULL) { + if (buf == nullptr) { std::cerr << "Pixbuf::create_from_data: failed to load contents: " << std::endl; g_free(decoded); - return NULL; + return nullptr; } else { g_object_ref(buf); pixbuf = new Pixbuf(buf); @@ -340,32 +340,32 @@ Pixbuf *Pixbuf::create_from_data_uri(gchar const *uri_data) Pixbuf *Pixbuf::create_from_file(std::string const &fn) { - Pixbuf *pb = NULL; + Pixbuf *pb = nullptr; // test correctness of filename if (!g_file_test(fn.c_str(), G_FILE_TEST_EXISTS)) { - return NULL; + return nullptr; } GStatBuf stdir; int val = g_stat(fn.c_str(), &stdir); if (val == 0 && stdir.st_mode & S_IFDIR){ - return NULL; + return nullptr; } // we need to load the entire file into memory, // since we'll store it as MIME data - gchar *data = NULL; + gchar *data = nullptr; gsize len = 0; - GError *error = NULL; + GError *error = nullptr; if (g_file_get_contents(fn.c_str(), &data, &len, &error)) { - if (error != NULL) { + if (error != nullptr) { std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl; std::cerr << " (" << fn << ")" << std::endl; - return NULL; + return nullptr; } - GdkPixbuf *buf = NULL; - GdkPixbufLoader *loader = NULL; + GdkPixbuf *buf = nullptr; + GdkPixbufLoader *loader = nullptr; std::string::size_type idx; idx = fn.rfind('.'); bool is_svg = false; @@ -374,13 +374,13 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn) if (boost::iequals(fn.substr(idx+1).c_str(), "svg")) { SPDocument *svgDoc = SPDocument::createNewDoc(fn.c_str(), TRUE); // Check the document loaded properly - if (svgDoc == NULL) { - return NULL; + if (svgDoc == nullptr) { + return nullptr; } - if (svgDoc->getRoot() == NULL) + if (svgDoc->getRoot() == nullptr) { svgDoc->doUnref(); - return NULL; + return nullptr; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const double dpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", 96.0); @@ -394,12 +394,12 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn) const int scaledSvgWidth = round(svgWidth_px/(96.0/dpi)); const int scaledSvgHeight = round(svgHeight_px/(96.0/dpi)); - buf = sp_generate_internal_bitmap(svgDoc, NULL, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, NULL)->getPixbufRaw(); + buf = sp_generate_internal_bitmap(svgDoc, nullptr, 0, 0, svgWidth_px, svgHeight_px, scaledSvgWidth, scaledSvgHeight, dpi, dpi, (guint32) 0xffffff00, nullptr)->getPixbufRaw(); // Tidy up svgDoc->doUnref(); - if (buf == NULL) { - return NULL; + if (buf == nullptr) { + return nullptr; } is_svg = true; } @@ -407,21 +407,21 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn) if (!is_svg) { loader = gdk_pixbuf_loader_new(); gdk_pixbuf_loader_write(loader, (guchar *) data, len, &error); - if (error != NULL) { + if (error != nullptr) { std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl; std::cerr << " (" << fn << ")" << std::endl; g_free(data); g_object_unref(loader); - return NULL; + return nullptr; } gdk_pixbuf_loader_close(loader, &error); - if (error != NULL) { + if (error != nullptr) { std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl; std::cerr << " (" << fn << ")" << std::endl; g_free(data); g_object_unref(loader); - return NULL; + return nullptr; } buf = gdk_pixbuf_loader_get_pixbuf(loader); @@ -449,7 +449,7 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn) // from the file. This can be done by using format-specific libraries e.g. libpng. } else { std::cerr << "Pixbuf::create_from_file: failed to get contents: " << fn << std::endl; - return NULL; + return nullptr; } return pb; @@ -512,15 +512,15 @@ Cairo::RefPtr<Cairo::Surface> Pixbuf::getSurface(bool convert_format) guchar const *Pixbuf::getMimeData(gsize &len, std::string &mimetype) const { static gchar const *mimetypes[] = { - CAIRO_MIME_TYPE_JPEG, CAIRO_MIME_TYPE_JP2, CAIRO_MIME_TYPE_PNG, NULL }; + CAIRO_MIME_TYPE_JPEG, CAIRO_MIME_TYPE_JP2, CAIRO_MIME_TYPE_PNG, nullptr }; static guint mimetypes_len = g_strv_length(const_cast<gchar**>(mimetypes)); - guchar const *data = NULL; + guchar const *data = nullptr; for (guint i = 0; i < mimetypes_len; ++i) { unsigned long len_long = 0; cairo_surface_get_mime_data(const_cast<cairo_surface_t*>(_surface), mimetypes[i], &data, &len_long); - if (data != NULL) { + if (data != nullptr) { len = len_long; mimetype = mimetypes[i]; break; @@ -560,7 +560,7 @@ void Pixbuf::_forceAlpha() void Pixbuf::_setMimeData(guchar *data, gsize len, Glib::ustring const &format) { - gchar const *mimetype = NULL; + gchar const *mimetype = nullptr; if (format == "jpeg") { mimetype = CAIRO_MIME_TYPE_JPEG; @@ -570,7 +570,7 @@ void Pixbuf::_setMimeData(guchar *data, gsize len, Glib::ustring const &format) mimetype = CAIRO_MIME_TYPE_PNG; } - if (mimetype != NULL) { + if (mimetype != nullptr) { cairo_surface_set_mime_data(_surface, mimetype, data, len, g_free, data); //g_message("Setting Cairo MIME data: %s", mimetype); } else { @@ -837,7 +837,7 @@ feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv) SPColorInterpolation get_cairo_surface_ci(cairo_surface_t *surface) { void* data = cairo_surface_get_user_data( surface, &ink_color_interpolation_key ); - if( data != NULL ) { + if( data != nullptr ) { return (SPColorInterpolation)GPOINTER_TO_INT( data ); } else { return SP_CSS_COLOR_INTERPOLATION_AUTO; @@ -862,13 +862,13 @@ set_cairo_surface_ci(cairo_surface_t *surface, SPColorInterpolation ci) { ink_cairo_surface_linear_to_srgb( surface ); } - cairo_surface_set_user_data(surface, &ink_color_interpolation_key, GINT_TO_POINTER (ci), NULL); + cairo_surface_set_user_data(surface, &ink_color_interpolation_key, GINT_TO_POINTER (ci), nullptr); } } void copy_cairo_surface_ci(cairo_surface_t *in, cairo_surface_t *out) { - cairo_surface_set_user_data(out, &ink_color_interpolation_key, cairo_surface_get_user_data(in, &ink_color_interpolation_key), NULL); + cairo_surface_set_user_data(out, &ink_color_interpolation_key, cairo_surface_get_user_data(in, &ink_color_interpolation_key), nullptr); } void @@ -957,7 +957,7 @@ cairo_surface_t * ink_cairo_surface_create_identical(cairo_surface_t *s) { cairo_surface_t *ns = ink_cairo_surface_create_same_size(s, cairo_surface_get_content(s)); - cairo_surface_set_user_data(ns, &ink_color_interpolation_key, cairo_surface_get_user_data(s, &ink_color_interpolation_key), NULL); + cairo_surface_set_user_data(ns, &ink_color_interpolation_key, cairo_surface_get_user_data(s, &ink_color_interpolation_key), nullptr); return ns; } @@ -1004,7 +1004,7 @@ ink_cairo_surface_create_output(cairo_surface_t *image, cairo_surface_t *bg) { cairo_content_t imgt = cairo_surface_get_content(image); cairo_content_t bgt = cairo_surface_get_content(bg); - cairo_surface_t *out = NULL; + cairo_surface_t *out = nullptr; if (bgt == CAIRO_CONTENT_ALPHA && imgt == CAIRO_CONTENT_ALPHA) { out = ink_cairo_surface_create_identical(bg); @@ -1416,7 +1416,7 @@ void ink_pixbuf_ensure_argb32(GdkPixbuf *pb) { gchar *pixel_format = reinterpret_cast<gchar*>(g_object_get_data(G_OBJECT(pb), "pixel_format")); - if (pixel_format != NULL && strcmp(pixel_format, "argb32") == 0) { + if (pixel_format != nullptr && strcmp(pixel_format, "argb32") == 0) { // nothing to do return; } @@ -1437,7 +1437,7 @@ void ink_pixbuf_ensure_normal(GdkPixbuf *pb) { gchar *pixel_format = reinterpret_cast<gchar*>(g_object_get_data(G_OBJECT(pb), "pixel_format")); - if (pixel_format == NULL || strcmp(pixel_format, "pixbuf") == 0) { + if (pixel_format == nullptr || strcmp(pixel_format, "pixbuf") == 0) { // nothing to do return; } diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index 8271a6ad9..72415d82d 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -78,7 +78,7 @@ sp_canvas_arena_class_init (SPCanvasArenaClass *klass) G_TYPE_FROM_CLASS(item_class), G_SIGNAL_RUN_LAST, ((glong)((guint8*)&(klass->arena_event) - (guint8*)klass)), - NULL, NULL, + nullptr, nullptr, sp_marshal_INT__POINTER_POINTER, G_TYPE_INT, 2, G_TYPE_POINTER, G_TYPE_POINTER); @@ -116,7 +116,7 @@ sp_canvas_arena_init (SPCanvasArena *arena) sigc::ptr_fun(&sp_canvas_arena_item_deleted), arena)); - arena->active = NULL; + arena->active = nullptr; } static void sp_canvas_arena_destroy(SPCanvasItem *object) @@ -180,7 +180,7 @@ static void sp_canvas_arena_item_deleted(SPCanvasArena *arena, Inkscape::DrawingItem *item) { if (arena->active == item) { - arena->active = NULL; + arena->active = nullptr; } } @@ -260,7 +260,7 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event) case GDK_LEAVE_NOTIFY: if (arena->cursor) { ret = sp_canvas_arena_send_event (arena, event); - arena->active = NULL; + arena->active = nullptr; arena->cursor = FALSE; } break; @@ -342,7 +342,7 @@ static void sp_canvas_arena_request_render(SPCanvasArena *ca, Geom::IntRect cons void sp_canvas_arena_set_pick_delta (SPCanvasArena *ca, gdouble delta) { - g_return_if_fail (ca != NULL); + g_return_if_fail (ca != nullptr); g_return_if_fail (SP_IS_CANVAS_ARENA (ca)); /* fixme: repick? */ @@ -352,7 +352,7 @@ sp_canvas_arena_set_pick_delta (SPCanvasArena *ca, gdouble delta) void sp_canvas_arena_set_sticky (SPCanvasArena *ca, gboolean sticky) { - g_return_if_fail (ca != NULL); + g_return_if_fail (ca != nullptr); g_return_if_fail (SP_IS_CANVAS_ARENA (ca)); /* fixme: repick? */ @@ -362,7 +362,7 @@ sp_canvas_arena_set_sticky (SPCanvasArena *ca, gboolean sticky) void sp_canvas_arena_render_surface (SPCanvasArena *ca, cairo_surface_t *surface, Geom::IntRect const &r) { - g_return_if_fail (ca != NULL); + g_return_if_fail (ca != nullptr); g_return_if_fail (SP_IS_CANVAS_ARENA (ca)); Inkscape::DrawingContext dc(surface, r.min()); diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 66231b7dd..8d9cb7d0a 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -191,7 +191,7 @@ CanvasAxonomGrid::readRepr() } if ( (value = repr->attribute("gridanglex")) ) { - angle_deg[X] = g_ascii_strtod(value, NULL); + angle_deg[X] = g_ascii_strtod(value, nullptr); if (angle_deg[X] < 0.) angle_deg[X] = 0.; if (angle_deg[X] > 89.0) angle_deg[X] = 89.0; angle_rad[X] = Geom::rad_from_deg(angle_deg[X]); @@ -199,7 +199,7 @@ CanvasAxonomGrid::readRepr() } if ( (value = repr->attribute("gridanglez")) ) { - angle_deg[Z] = g_ascii_strtod(value, NULL); + angle_deg[Z] = g_ascii_strtod(value, nullptr); if (angle_deg[Z] < 0.) angle_deg[Z] = 0.; if (angle_deg[Z] > 89.0) angle_deg[Z] = 89.0; angle_rad[Z] = Geom::rad_from_deg(angle_deg[Z]); @@ -230,12 +230,12 @@ CanvasAxonomGrid::readRepr() } if ( (value = repr->attribute("enabled")) ) { - g_assert(snapper != NULL); + g_assert(snapper != nullptr); snapper->setEnabled(strcmp(value,"false") != 0 && strcmp(value, "0") != 0); } if ( (value = repr->attribute("snapvisiblegridlinesonly")) ) { - g_assert(snapper != NULL); + g_assert(snapper != nullptr); snapper->setSnapVisibleOnly(strcmp(value,"false") != 0 && strcmp(value, "0") != 0); } @@ -358,7 +358,7 @@ CanvasAxonomGrid::updateWidgets() _wr.setUpdating (true); _rcb_visible->setActive(visible); - if (snapper != NULL) { + if (snapper != nullptr) { _rcb_enabled->setActive(snapper->getEnabled()); _rcb_snap_visible_only->setActive(snapper->getSnapVisibleOnly()); } @@ -590,7 +590,7 @@ CanvasAxonomGridSnapper::_getSnapLines(Geom::Point const &p) const { LineList s; - if ( grid == NULL ) { + if ( grid == nullptr ) { return s; } diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index fc6b79b43..35f46e2ae 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -172,7 +172,7 @@ sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_ Geom::Rect viewbox = item->canvas->getViewbox(); viewbox.expandBy (width); double dist = Geom::infinity(); - pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox); + pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, nullptr, nullptr, &dist, 0.5, &viewbox); if (dist <= 1.0) { *actual_item = item; @@ -184,10 +184,10 @@ sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_ SPCanvasItem * sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve, bool phantom_line) { - g_return_val_if_fail (parent != NULL, NULL); + g_return_val_if_fail (parent != nullptr, NULL); g_return_val_if_fail (SP_IS_CANVAS_GROUP (parent), NULL); - SPCanvasItem *item = sp_canvas_item_new (parent, SP_TYPE_CANVAS_BPATH, NULL); + SPCanvasItem *item = sp_canvas_item_new (parent, SP_TYPE_CANVAS_BPATH, nullptr); sp_canvas_bpath_set_bpath (SP_CANVAS_BPATH (item), curve, phantom_line); @@ -197,7 +197,7 @@ sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve, bool phantom_line) void sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve, bool phantom_line) { - g_return_if_fail (cbp != NULL); + g_return_if_fail (cbp != nullptr); g_return_if_fail (SP_IS_CANVAS_BPATH (cbp)); cbp->phantom_line = phantom_line; @@ -215,7 +215,7 @@ sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve, bool phantom_line void sp_canvas_bpath_set_fill (SPCanvasBPath *cbp, guint32 rgba, SPWindRule rule) { - g_return_if_fail (cbp != NULL); + g_return_if_fail (cbp != nullptr); g_return_if_fail (SP_IS_CANVAS_BPATH (cbp)); cbp->fill_rgba = rgba; @@ -227,7 +227,7 @@ sp_canvas_bpath_set_fill (SPCanvasBPath *cbp, guint32 rgba, SPWindRule rule) void sp_canvas_bpath_set_stroke (SPCanvasBPath *cbp, guint32 rgba, gdouble width, SPStrokeJoinType join, SPStrokeCapType cap, double dash, double gap) { - g_return_if_fail (cbp != NULL); + g_return_if_fail (cbp != nullptr); g_return_if_fail (SP_IS_CANVAS_BPATH (cbp)); cbp->stroke_rgba = rgba; diff --git a/src/display/canvas-debug.cpp b/src/display/canvas-debug.cpp index 00a4f3fee..a4ca19673 100644 --- a/src/display/canvas-debug.cpp +++ b/src/display/canvas-debug.cpp @@ -41,7 +41,7 @@ static void sp_canvas_debug_init (SPCanvasDebug *debug) namespace { static void sp_canvas_debug_destroy (SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (SP_IS_CANVAS_DEBUG (object)); if (SP_CANVAS_ITEM_CLASS(sp_canvas_debug_parent_class)->destroy) { diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 6d646f39d..42769e1b1 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -81,12 +81,12 @@ static void grid_canvasitem_class_init(GridCanvasItemClass *klass) static void grid_canvasitem_init (GridCanvasItem *griditem) { - griditem->grid = NULL; + griditem->grid = nullptr; } static void grid_canvasitem_destroy(SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (INKSCAPE_IS_GRID_CANVASITEM (object)); if (SP_CANVAS_ITEM_CLASS(grid_canvasitem_parent_class)->destroy) @@ -131,11 +131,11 @@ grid_canvasitem_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned // CanvasGrid static Inkscape::XML::NodeEventVector const _repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ CanvasGrid::on_repr_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type) @@ -244,10 +244,10 @@ CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, Gri CanvasGrid* CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype) { - if (!repr) return NULL; + if (!repr) return nullptr; if (!doc) { g_error("CanvasGrid::NewGrid - doc==NULL"); - return NULL; + return nullptr; } switch (gridtype) { @@ -257,7 +257,7 @@ CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * d return dynamic_cast<CanvasGrid*>(new CanvasAxonomGrid(nv, repr, doc)); } - return NULL; + return nullptr; } @@ -267,18 +267,18 @@ CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * d GridCanvasItem * CanvasGrid::createCanvasItem(SPDesktop * desktop) { - if (!desktop) return NULL; + if (!desktop) return nullptr; // Johan: I think for multiple desktops it is best if each has their own canvasitem, // but share the same CanvasGrid object; that is what this function is for. // check if there is already a canvasitem on this desktop linking to this grid for (auto i:canvasitems) { if ( desktop->getGridGroup() == SP_CANVAS_GROUP(i->parent) ) { - return NULL; + return nullptr; } } - GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(desktop->getGridGroup(), INKSCAPE_TYPE_GRID_CANVASITEM, NULL) ); + GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(desktop->getGridGroup(), INKSCAPE_TYPE_GRID_CANVASITEM, nullptr) ); item->grid = this; sp_canvas_item_show(SP_CANVAS_ITEM(item)); @@ -340,7 +340,7 @@ CanvasGrid::newWidget() // set widget values _wr.setUpdating (true); _rcb_visible->setActive(visible); - if (snapper != NULL) { + if (snapper != nullptr) { _rcb_enabled->setActive(snapper->getEnabled()); _rcb_snap_visible_only->setActive(snapper->getSnapVisibleOnly()); } @@ -359,7 +359,7 @@ CanvasGrid::on_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gc bool CanvasGrid::isEnabled() const { - if (snapper == NULL) { + if (snapper == nullptr) { return false; } @@ -454,7 +454,7 @@ static void validateInt(gint oldVal, gint* pTarget) { // Avoid nullness. - if ( pTarget == NULL ) + if ( pTarget == nullptr ) return; // Invalid new value? @@ -600,12 +600,12 @@ CanvasXYGrid::readRepr() } if ( (value = repr->attribute("enabled")) ) { - g_assert(snapper != NULL); + g_assert(snapper != nullptr); snapper->setEnabled(strcmp(value,"false") != 0 && strcmp(value, "0") != 0); } if ( (value = repr->attribute("snapvisiblegridlinesonly")) ) { - g_assert(snapper != NULL); + g_assert(snapper != nullptr); snapper->setSnapVisibleOnly(strcmp(value,"false") != 0 && strcmp(value, "0") != 0); } @@ -735,7 +735,7 @@ CanvasXYGrid::updateWidgets() _wr.setUpdating (true); _rcb_visible->setActive(visible); - if (snapper != NULL) { + if (snapper != nullptr) { _rcb_enabled->setActive(snapper->getEnabled()); _rcb_snap_visible_only->setActive(snapper->getSnapVisibleOnly()); } @@ -1022,7 +1022,7 @@ CanvasXYGridSnapper::_getSnapLines(Geom::Point const &p) const { LineList s; - if ( grid == NULL ) { + if ( grid == nullptr ) { return s; } diff --git a/src/display/canvas-rotate.cpp b/src/display/canvas-rotate.cpp index 1d917a677..61728ca50 100644 --- a/src/display/canvas-rotate.cpp +++ b/src/display/canvas-rotate.cpp @@ -48,14 +48,14 @@ static void sp_canvas_rotate_init (SPCanvasRotate *rotate) rotate->pickable = true; // So we can receive events. rotate->angle = 0.0; rotate->start_angle = -1000; - rotate->surface_copy = NULL; - rotate->surface_rotated = NULL; + rotate->surface_copy = nullptr; + rotate->surface_rotated = nullptr; } namespace { static void sp_canvas_rotate_destroy (SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (SP_IS_CANVAS_ROTATE (object)); if (SP_CANVAS_ITEM_CLASS(sp_canvas_rotate_parent_class)->destroy) { @@ -68,15 +68,15 @@ static void sp_canvas_rotate_update( SPCanvasItem *item, Geom::Affine const &/*a { SPCanvasRotate *cr = SP_CANVAS_ROTATE(item); - if (cr->surface_copy == NULL) { + if (cr->surface_copy == nullptr) { // std::cout << "sp_canvas_rotate_update: surface_copy is NULL" << std::endl; return; } // Destroy surface_rotated if it already exists. - if (cr->surface_rotated != NULL) { + if (cr->surface_rotated != nullptr) { cairo_surface_destroy (cr->surface_rotated); - cr->surface_rotated = NULL; + cr->surface_rotated = nullptr; } // Create rotated surface @@ -114,7 +114,7 @@ static void sp_canvas_rotate_render( SPCanvasItem *item, SPCanvasBuf *buf) return; } - if (cr->surface_rotated == NULL ) { + if (cr->surface_rotated == nullptr ) { // std::cout << " surface_rotated is NULL" << std::endl; return; } @@ -206,13 +206,13 @@ static int sp_canvas_rotate_event (SPCanvasItem *item, GdkEvent *event) sp_canvas_item_hide (item); cr->start_angle = -1000; - if (cr->surface_copy != NULL) { + if (cr->surface_copy != nullptr) { cairo_surface_destroy( cr->surface_copy ); - cr->surface_copy = NULL; + cr->surface_copy = nullptr; } - if (cr->surface_rotated != NULL) { + if (cr->surface_rotated != nullptr) { cairo_surface_destroy( cr->surface_rotated ); - cr->surface_rotated = NULL; + cr->surface_rotated = nullptr; } // sp_canvas_item_show (desktop->drawing); @@ -237,7 +237,7 @@ static int sp_canvas_rotate_event (SPCanvasItem *item, GdkEvent *event) void sp_canvas_rotate_start (SPCanvasRotate *canvas_rotate, cairo_surface_t *background) { - if (background == NULL) { + if (background == nullptr) { std::cerr << "sp_canvas_rotate_start: background is NULL!" << std::endl; return; } @@ -254,7 +254,7 @@ void sp_canvas_rotate_start (SPCanvasRotate *canvas_rotate, cairo_surface_t *bac // Paint the canvas ourselves for speed.... void sp_canvas_rotate_paint (SPCanvasRotate *canvas_rotate, cairo_surface_t *background) { - if (background == NULL) { + if (background == nullptr) { std::cerr << "sp_canvas_rotate_paint: background is NULL!" << std::endl; return; } diff --git a/src/display/canvas-text.cpp b/src/display/canvas-text.cpp index 4117825e3..9df002f7f 100644 --- a/src/display/canvas-text.cpp +++ b/src/display/canvas-text.cpp @@ -52,9 +52,9 @@ sp_canvastext_init (SPCanvasText *canvastext) canvastext->s[Geom::X] = canvastext->s[Geom::Y] = 0.0; canvastext->affine = Geom::identity(); canvastext->fontsize = 10.0; - canvastext->item = NULL; - canvastext->desktop = NULL; - canvastext->text = NULL; + canvastext->item = nullptr; + canvastext->desktop = nullptr; + canvastext->text = nullptr; canvastext->outline = false; canvastext->background = false; canvastext->border = 3; // must be a constant, and not proportional to any width, height, or fontsize to allow alignment with other text boxes @@ -62,14 +62,14 @@ sp_canvastext_init (SPCanvasText *canvastext) static void sp_canvastext_destroy(SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (SP_IS_CANVASTEXT (object)); SPCanvasText *canvastext = SP_CANVASTEXT (object); g_free(canvastext->text); - canvastext->text = NULL; - canvastext->item = NULL; + canvastext->text = nullptr; + canvastext->item = nullptr; if (SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->destroy) SP_CANVAS_ITEM_CLASS(sp_canvastext_parent_class)->destroy(object); @@ -227,7 +227,7 @@ SPCanvasText *sp_canvastext_new(SPCanvasGroup *parent, SPDesktop *desktop, Geom: { // Pos specifies the position of the anchor, which is at the bounding box of the text itself (i.e. not at the border of the filled background rectangle) // The relative position of the anchor can be set using e.g. anchor_position = TEXT_ANCHOR_LEFT - SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_CANVASTEXT, NULL); + SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_CANVASTEXT, nullptr); SPCanvasText *ct = SP_CANVASTEXT(item); @@ -244,7 +244,7 @@ SPCanvasText *sp_canvastext_new(SPCanvasGroup *parent, SPDesktop *desktop, Geom: void sp_canvastext_set_rgba32 (SPCanvasText *ct, guint32 rgba, guint32 rgba_stroke) { - g_return_if_fail (ct != NULL); + g_return_if_fail (ct != nullptr); g_return_if_fail (SP_IS_CANVASTEXT (ct)); if (rgba != ct->rgba || rgba_stroke != ct->rgba_stroke) { diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 1115978e9..e424fee05 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -127,7 +127,7 @@ SPCurve::unref() delete this; } - return NULL; + return nullptr; } /** @@ -341,7 +341,7 @@ SPCurve::is_closed() const bool SPCurve::is_equal(SPCurve * other) const { - if(other == NULL) { + if(other == nullptr) { return false; } else if(_pathv == other->get_pathvector()){ return true; @@ -357,10 +357,10 @@ Geom::Curve const * SPCurve::last_segment() const { if (is_empty()) { - return NULL; + return nullptr; } if (_pathv.back().empty()) { - return NULL; + return nullptr; } return &_pathv.back().back_default(); @@ -373,7 +373,7 @@ Geom::Path const * SPCurve::last_path() const { if (is_empty()) { - return NULL; + return nullptr; } return &_pathv.back(); @@ -387,10 +387,10 @@ Geom::Curve const * SPCurve::first_segment() const { if (is_empty()) { - return NULL; + return nullptr; } if (_pathv.front().empty()) { - return NULL; + return nullptr; } return &_pathv.front().front(); @@ -403,7 +403,7 @@ Geom::Path const * SPCurve::first_path() const { if (is_empty()) { - return NULL; + return nullptr; } return &_pathv.front(); @@ -545,9 +545,9 @@ SPCurve::append_continuous(SPCurve const *c1, double tolerance) using Geom::X; using Geom::Y; - g_return_val_if_fail(c1 != NULL, NULL); + g_return_val_if_fail(c1 != nullptr, NULL); if ( this->is_closed() || c1->is_closed() ) { - return NULL; + return nullptr; } if (c1->is_empty()) { diff --git a/src/display/drawing-context.cpp b/src/display/drawing-context.cpp index ffd60ef9f..16263b607 100644 --- a/src/display/drawing-context.cpp +++ b/src/display/drawing-context.cpp @@ -24,7 +24,7 @@ using Geom::Y; */ DrawingContext::Save::Save() - : _dc(NULL) + : _dc(nullptr) {} DrawingContext::Save::Save(DrawingContext &dc) : _dc(&dc) @@ -70,7 +70,7 @@ DrawingContext::DrawingContext(cairo_t *ct, Geom::Point const &origin) } DrawingContext::DrawingContext(cairo_surface_t *surface, Geom::Point const &origin) - : _ct(NULL) + : _ct(nullptr) , _surface(new DrawingSurface(surface, origin)) , _delete_surface(true) , _restore_context(false) diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp index 6abce34a2..22a6c42ed 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -18,7 +18,7 @@ namespace Inkscape { DrawingGroup::DrawingGroup(Drawing &drawing) : DrawingItem(drawing) - , _child_transform(NULL) + , _child_transform(nullptr) {} DrawingGroup::~DrawingGroup() @@ -54,7 +54,7 @@ DrawingGroup::setChildTransform(Geom::Affine const &new_trans) _markForRendering(); if (new_trans.isIdentity()) { delete _child_transform; // delete NULL; is safe - _child_transform = NULL; + _child_transform = nullptr; } else { _child_transform = new Geom::Affine(new_trans); } @@ -89,7 +89,7 @@ DrawingGroup::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u unsigned DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) { - if (stop_at == NULL) { + if (stop_at == nullptr) { // normal rendering for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { i->setAntialiasing(_antialias); @@ -131,7 +131,7 @@ DrawingGroup::_pickItem(Geom::Point const &p, double delta, unsigned flags) return _pick_children ? picked : this; } } - return NULL; + return nullptr; } bool @@ -142,7 +142,7 @@ DrawingGroup::_canClip() bool is_drawing_group(DrawingItem *item) { - return dynamic_cast<DrawingGroup *>(item) != NULL; + return dynamic_cast<DrawingGroup *>(item) != nullptr; } } // end namespace Inkscape diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index 4be3099bf..2a3777e36 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -22,7 +22,7 @@ namespace Inkscape { DrawingImage::DrawingImage(Drawing &drawing) : DrawingItem(drawing) - , _pixbuf(NULL) + , _pixbuf(nullptr) {} DrawingImage::~DrawingImage() @@ -184,7 +184,7 @@ distance_to_segment (Geom::Point const &p, Geom::Point const &a1, Geom::Point co DrawingItem * DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) { - if (!_pixbuf) return NULL; + if (!_pixbuf) return nullptr; bool outline = _drawing.outline(); @@ -201,7 +201,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) } } } - return NULL; + return nullptr; } else { unsigned char *const pixels = _pixbuf->pixels(); @@ -213,7 +213,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) Geom::Rect r = bounds(); if (!r.contains(tp)) - return NULL; + return nullptr; double vw = width * _scale[Geom::X]; double vh = height * _scale[Geom::Y]; @@ -221,7 +221,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) int iy = floor((tp[Geom::Y] - _origin[Geom::Y]) / vh * height); if ((ix < 0) || (iy < 0) || (ix >= width) || (iy >= height)) - return NULL; + return nullptr; unsigned char *pix_ptr = pixels + iy * rowstride + ix * 4; // pick if the image is less than 99% transparent @@ -235,7 +235,7 @@ DrawingImage::_pickItem(Geom::Point const &p, double delta, unsigned /*sticky*/) throw std::runtime_error("Unrecognized pixel format"); } float alpha_f = (alpha / 255.0f) * _opacity; - return alpha_f > 0.01 ? this : NULL; + return alpha_f > 0.01 ? this : nullptr; } } diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index cc4673bc8..4f2f50ddd 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -107,19 +107,19 @@ void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) { DrawingItem::DrawingItem(Drawing &drawing) : _drawing(drawing) - , _parent(NULL) + , _parent(nullptr) , _key(0) - , _style(NULL) - , _context_style(NULL) + , _style(nullptr) + , _context_style(nullptr) , _opacity(1.0) - , _transform(NULL) - , _clip(NULL) - , _mask(NULL) - , _fill_pattern(NULL) - , _stroke_pattern(NULL) - , _filter(NULL) - , _user_data(NULL) - , _cache(NULL) + , _transform(nullptr) + , _clip(nullptr) + , _mask(nullptr) + , _fill_pattern(nullptr) + , _stroke_pattern(nullptr) + , _filter(nullptr) + , _user_data(nullptr) + , _cache(nullptr) , _state(0) , _child_type(CHILD_ORPHAN) , _background_new(0) @@ -163,19 +163,19 @@ DrawingItem::~DrawingItem() case CHILD_CLIP: // we cannot call setClip(NULL) or setMask(NULL), // because that would be an endless loop - _parent->_clip = NULL; + _parent->_clip = nullptr; break; case CHILD_MASK: - _parent->_mask = NULL; + _parent->_mask = nullptr; break; case CHILD_ROOT: - _drawing._root = NULL; + _drawing._root = nullptr; break; case CHILD_FILL_PATTERN: - _parent->_fill_pattern = NULL; + _parent->_fill_pattern = nullptr; break; case CHILD_STROKE_PATTERN: - _parent->_stroke_pattern = NULL; + _parent->_stroke_pattern = nullptr; break; default: ; } @@ -273,7 +273,7 @@ DrawingItem::setTransform(Geom::Affine const &new_trans) _markForRendering(); if (new_trans.isIdentity()) { delete _transform; // delete NULL; is safe - _transform = NULL; + _transform = nullptr; } else { _transform = new Geom::Affine(new_trans); } @@ -351,7 +351,7 @@ DrawingItem::setCached(bool cached, bool persistent) } else { _drawing._cached_items.erase(this); delete _cache; - _cache = NULL; + _cache = nullptr; } } @@ -381,7 +381,7 @@ DrawingItem::setStyle(SPStyle *style, SPStyle *context_style) } else { // no filter set for this group delete _filter; - _filter = NULL; + _filter = nullptr; } if (style && style->enable_background.set) { @@ -394,9 +394,9 @@ DrawingItem::setStyle(SPStyle *style, SPStyle *context_style) } } - if (context_style != NULL) { + if (context_style != nullptr) { _context_style = context_style; - } else if (_parent != NULL) { + } else if (_parent != nullptr) { _context_style = _parent->_context_style; } @@ -633,7 +633,7 @@ DrawingItem::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigne // The opposite transition (invisible -> visible or object // entering the canvas) is handled during the render phase delete _cache; - _cache = NULL; + _cache = nullptr; } } } @@ -748,11 +748,11 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag bool needs_opacity = (_opacity < 0.995); // this item needs an intermediate rendering if: - nir |= (_clip != NULL); // 1. it has a clipping path - nir |= (_mask != NULL); // 2. it has a mask - nir |= (_filter != NULL && render_filters); // 3. it has a filter + nir |= (_clip != nullptr); // 1. it has a clipping path + nir |= (_mask != nullptr); // 2. it has a mask + nir |= (_filter != nullptr && render_filters); // 3. it has a filter nir |= needs_opacity; // 4. it is non-opaque - nir |= (_cache != NULL); // 5. it is cached + nir |= (_cache != nullptr); // 5. it is cached nir |= (_mix_blend_mode != SP_CSS_BLEND_NORMAL); // 6. Blend mode not normal nir |= (_isolation == SP_CSS_ISOLATION_ISOLATE); // 7. Explicit isolatiom @@ -843,7 +843,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag } } if (!rendered) { - _filter->render(this, ict, NULL); + _filter->render(this, ict, nullptr); } // Note that because the object was rendered to a group, // the internals of the filter need to use cairo_get_group_target() @@ -884,7 +884,7 @@ DrawingItem::_renderOutline(DrawingContext &dc, Geom::IntRect const &area, unsig // just render everything: item, clip, mask // First, render the object itself - _renderItem(dc, *carea, flags, NULL); + _renderItem(dc, *carea, flags, nullptr); // render clip and mask, if any guint32 saved_rgba = _drawing.outlinecolor; // save current outline color @@ -957,11 +957,11 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) if (!(_state & STATE_BBOX) || !(_state & STATE_PICK)) { g_warning("Invalid state when picking: STATE_BBOX = %d, STATE_PICK = %d", _state & STATE_BBOX, _state & STATE_PICK); - return NULL; + return nullptr; } // ignore invisible and insensitive items unless sticky if (!(flags & PICK_STICKY) && !(_visible && _sensitive)) - return NULL; + return nullptr; bool outline = _drawing.outline(); @@ -969,18 +969,18 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) // pick inside clipping path; if NULL, it means the object is clipped away there if (_clip) { DrawingItem *cpick = _clip->pick(p, delta, flags | PICK_AS_CLIP); - if (!cpick) return NULL; + if (!cpick) return nullptr; } // same for mask if (_mask) { DrawingItem *mpick = _mask->pick(p, delta, flags); - if (!mpick) return NULL; + if (!mpick) return nullptr; } } Geom::OptIntRect box = (outline || (flags & PICK_AS_CLIP)) ? _bbox : _drawbox; if (!box) { - return NULL; + return nullptr; } Geom::Rect expanded = *box; @@ -989,7 +989,7 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) if (expanded.contains(p)) { return _pickItem(p, delta, flags); } - return NULL; + return nullptr; } // For debugging @@ -1042,7 +1042,7 @@ DrawingItem::_markForRendering() if (!dirty) return; // dirty the caches of all parents - DrawingItem *bkg_root = NULL; + DrawingItem *bkg_root = nullptr; for (DrawingItem *i = this; i; i = i->_parent) { if (i != this && i->_filter) { diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 43015c263..b688b467c 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -112,7 +112,7 @@ public: bool cached() const { return _cached; } void setCached(bool c, bool persistent = false); - virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); + virtual void setStyle(SPStyle *style, SPStyle *context_style = nullptr); virtual void setChildrenStyle(SPStyle *context_style); void setOpacity(float opacity); void setAntialiasing(unsigned a); @@ -133,7 +133,7 @@ public: void *data() const { return _user_data; } void update(Geom::IntRect const &area = Geom::IntRect::infinite(), UpdateContext const &ctx = UpdateContext(), unsigned flags = STATE_ALL, unsigned reset = 0); - unsigned render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0, DrawingItem *stop_at = NULL); + unsigned render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0, DrawingItem *stop_at = nullptr); void clip(DrawingContext &dc, Geom::IntRect const &area); DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags = 0); @@ -165,7 +165,7 @@ protected: virtual unsigned _renderItem(DrawingContext &/*dc*/, Geom::IntRect const &/*area*/, unsigned /*flags*/, DrawingItem * /*stop_at*/) { return RENDER_OK; } virtual void _clipItem(DrawingContext &/*dc*/, Geom::IntRect const &/*area*/) {} - virtual DrawingItem *_pickItem(Geom::Point const &/*p*/, double /*delta*/, unsigned /*flags*/) { return NULL; } + virtual DrawingItem *_pickItem(Geom::Point const &/*p*/, double /*delta*/, unsigned /*flags*/) { return nullptr; } virtual bool _canClip() { return false; } // member variables start here diff --git a/src/display/drawing-pattern.cpp b/src/display/drawing-pattern.cpp index b590a59c5..2cb86440e 100644 --- a/src/display/drawing-pattern.cpp +++ b/src/display/drawing-pattern.cpp @@ -18,7 +18,7 @@ namespace Inkscape { DrawingPattern::DrawingPattern(Drawing &drawing, bool debug) : DrawingGroup(drawing) - , _pattern_to_user(NULL) + , _pattern_to_user(nullptr) , _overflow_steps(1) , _debug(debug) { @@ -41,7 +41,7 @@ DrawingPattern::setPatternToUserTransform(Geom::Affine const &new_trans) { _markForRendering(); if (new_trans.isIdentity()) { delete _pattern_to_user; // delete NULL; is safe - _pattern_to_user = NULL; + _pattern_to_user = nullptr; } else { _pattern_to_user = new Geom::Affine(new_trans); } @@ -67,11 +67,11 @@ DrawingPattern::renderPattern(float opacity) { bool visible = opacity >= 1e-3; if (!visible) { - return NULL; + return nullptr; } if (!_tile_rect || (_tile_rect->area() == 0)) { - return NULL; + return nullptr; } Geom::Rect pattern_tile = *_tile_rect; diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index d7329e670..63db9475d 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -33,8 +33,8 @@ namespace Inkscape { DrawingShape::DrawingShape(Drawing &drawing) : DrawingItem(drawing) - , _curve(NULL) - , _last_pick(NULL) + , _curve(nullptr) + , _last_pick(nullptr) , _repick_after(0) {} @@ -51,7 +51,7 @@ DrawingShape::setPath(SPCurve *curve) if (_curve) { _curve->unref(); - _curve = NULL; + _curve = nullptr; } if (curve) { _curve = curve; @@ -312,15 +312,15 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags) if (_repick_after > 0) // we are a slow, huge path return _last_pick; // skip this pick, returning what was returned last time - if (!_curve) return NULL; - if (!_style) return NULL; + if (!_curve) return nullptr; + if (!_style) return nullptr; bool outline = _drawing.outline(); bool pick_as_clip = flags & PICK_AS_CLIP; if (SP_SCALE24_TO_FLOAT(_style->opacity.value) == 0 && !outline && !pick_as_clip) // fully transparent, no pick unless outline mode - return NULL; + return nullptr; GTimeVal tstart, tfinish; g_get_current_time (&tstart); @@ -351,9 +351,9 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags) if (_drawing.arena()) { Geom::Rect viewbox = _drawing.arena()->item.canvas->getViewbox(); viewbox.expandBy (width); - pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox); + pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, nullptr, needfill? &wind : nullptr, &dist, 0.5, &viewbox); } else { - pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, NULL); + pathv_matrix_point_bbox_wind_distance(_curve->get_pathvector(), _ctm, p, nullptr, needfill? &wind : nullptr, &dist, 0.5, nullptr); } g_get_current_time (&tfinish); @@ -397,8 +397,8 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags) } } - _last_pick = NULL; - return NULL; + _last_pick = nullptr; + return nullptr; } bool diff --git a/src/display/drawing-shape.h b/src/display/drawing-shape.h index 20da54239..8b0d1b082 100644 --- a/src/display/drawing-shape.h +++ b/src/display/drawing-shape.h @@ -28,7 +28,7 @@ public: ~DrawingShape() override; void setPath(SPCurve *curve); - void setStyle(SPStyle *style, SPStyle *context_style = NULL) override; + void setStyle(SPStyle *style, SPStyle *context_style = nullptr) override; void setChildrenStyle(SPStyle *context_style) override; protected: diff --git a/src/display/drawing-surface.cpp b/src/display/drawing-surface.cpp index 2752789e2..061641015 100644 --- a/src/display/drawing-surface.cpp +++ b/src/display/drawing-surface.cpp @@ -42,7 +42,7 @@ using Geom::Y; * will cover the area under the given rectangle. */ DrawingSurface::DrawingSurface(Geom::IntRect const &area, int device_scale) - : _surface(NULL) + : _surface(nullptr) , _origin(area.min()) , _scale(1, 1) , _pixels(area.dimensions()) @@ -60,7 +60,7 @@ DrawingSurface::DrawingSurface(Geom::IntRect const &area, int device_scale) * @param pixdims Pixel dimensions of the surface. */ DrawingSurface::DrawingSurface(Geom::Rect const &logbox, Geom::IntPoint const &pixdims, int device_scale) - : _surface(NULL) + : _surface(nullptr) , _origin(logbox.min()) , _scale(pixdims[X] / logbox.width(), pixdims[Y] / logbox.height()) , _pixels(pixdims) @@ -163,7 +163,7 @@ DrawingSurface::dropContents() { if (_surface) { cairo_surface_destroy(_surface); - _surface = NULL; + _surface = nullptr; } } @@ -263,7 +263,7 @@ DrawingCache::prepare() // the area has changed, so the cache content needs to be copied Geom::IntPoint old_origin = old_area.min(); cairo_surface_t *old_surface = _surface; - _surface = NULL; + _surface = nullptr; _pixels = _pending_area.dimensions(); _origin = _pending_area.min(); diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index aa2a744c8..a51e00606 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -28,7 +28,7 @@ namespace Inkscape { DrawingGlyphs::DrawingGlyphs(Drawing &drawing) : DrawingItem(drawing) - , _font(NULL) + , _font(nullptr) , _glyph(0) {} @@ -36,7 +36,7 @@ DrawingGlyphs::~DrawingGlyphs() { if (_font) { _font->Unref(); - _font = NULL; + _font = nullptr; } } @@ -182,7 +182,7 @@ DrawingItem *DrawingGlyphs::_pickItem(Geom::Point const &p, double /*delta*/, un if (!ggroup) { throw InvalidItemException(); } - DrawingItem *result = NULL; + DrawingItem *result = nullptr; bool invisible = (ggroup->_nrstyle.fill.type == NRStyle::PAINT_NONE) && (ggroup->_nrstyle.stroke.type == NRStyle::PAINT_NONE); @@ -684,7 +684,7 @@ void DrawingText::_clipItem(DrawingContext &dc, Geom::IntRect const &/*area*/) DrawingItem * DrawingText::_pickItem(Geom::Point const &p, double delta, unsigned flags) { - return DrawingGroup::_pickItem(p, delta, flags) ? this : NULL; + return DrawingGroup::_pickItem(p, delta, flags) ? this : nullptr; } bool diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h index 376182d4e..fdfab122f 100644 --- a/src/display/drawing-text.h +++ b/src/display/drawing-text.h @@ -28,7 +28,7 @@ public: ~DrawingGlyphs() override; void setGlyph(font_instance *font, int glyph, Geom::Affine const &trans); - void setStyle(SPStyle *style, SPStyle *context_style = NULL) override; // Not to be used + void setStyle(SPStyle *style, SPStyle *context_style = nullptr) override; // Not to be used protected: unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, @@ -57,7 +57,7 @@ public: void clear(); bool addComponent(font_instance *font, int glyph, Geom::Affine const &trans, float width, float ascent, float descent, float phase_length); - void setStyle(SPStyle *style, SPStyle *context_style = NULL) override; + void setStyle(SPStyle *style, SPStyle *context_style = nullptr) override; void setChildrenStyle(SPStyle *context_style) override; protected: diff --git a/src/display/drawing.cpp b/src/display/drawing.cpp index 71fb94be0..18c2d98e8 100644 --- a/src/display/drawing.cpp +++ b/src/display/drawing.cpp @@ -31,7 +31,7 @@ static const gdouble grayscale_value_matrix[20] = { }; Drawing::Drawing(SPCanvasArena *arena) - : _root(NULL) + : _root(nullptr) , outlinecolor(0x000000ff) , delta(0) , _exact(false) @@ -198,7 +198,7 @@ Drawing::pick(Geom::Point const &p, double delta, unsigned flags) if (_root) { return _root->pick(p, delta, flags); } - return NULL; + return nullptr; } void diff --git a/src/display/drawing.h b/src/display/drawing.h index e472c8f5b..1348f02af 100644 --- a/src/display/drawing.h +++ b/src/display/drawing.h @@ -40,7 +40,7 @@ public: guint32 images; }; - Drawing(SPCanvasArena *arena = NULL); + Drawing(SPCanvasArena *arena = nullptr); ~Drawing(); DrawingItem *root() { return _root; } diff --git a/src/display/gnome-canvas-acetate.cpp b/src/display/gnome-canvas-acetate.cpp index 297d69068..50d26a068 100644 --- a/src/display/gnome-canvas-acetate.cpp +++ b/src/display/gnome-canvas-acetate.cpp @@ -41,7 +41,7 @@ static void sp_canvas_acetate_init (SPCanvasAcetate */*acetate*/) static void sp_canvas_acetate_destroy(SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (GNOME_IS_CANVAS_ACETATE (object)); if (SP_CANVAS_ITEM_CLASS(sp_canvas_acetate_parent_class)->destroy) diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index cde10f6c2..8091f8369 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -53,13 +53,13 @@ static void sp_guideline_init(SPGuideLine *gl) gl->point_on_line = Geom::Point(0,0); gl->sensitive = 0; - gl->origin = NULL; - gl->label = NULL; + gl->origin = nullptr; + gl->label = nullptr; } static void sp_guideline_destroy(SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (SP_IS_GUIDELINE (object)); SPGuideLine *gl = SP_GUIDELINE(object); @@ -200,7 +200,7 @@ static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point point_on_line, Geom::Point normal) { - SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_GUIDELINE, NULL); + SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_GUIDELINE, nullptr); SPGuideLine *gl = SP_GUIDELINE(item); normal.normalize(); diff --git a/src/display/nr-filter-colormatrix.cpp b/src/display/nr-filter-colormatrix.cpp index 77873d523..5f477ae9b 100644 --- a/src/display/nr-filter-colormatrix.cpp +++ b/src/display/nr-filter-colormatrix.cpp @@ -151,7 +151,7 @@ struct ColorMatrixLuminanceToAlpha { void FilterColorMatrix::render_cairo(FilterSlot &slot) { cairo_surface_t *input = slot.getcairo(_input); - cairo_surface_t *out = NULL; + cairo_surface_t *out = nullptr; // We may need to transform input surface to correct color interpolation space. The input surface // might be used as input to another primitive but it is likely that all the primitives in a given diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index 2227edfef..5cc8f74fd 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -637,7 +637,7 @@ void FilterGaussian::render_cairo(FilterSlot &slot) } } - cairo_surface_t *downsampled = NULL; + cairo_surface_t *downsampled = nullptr; if (resampling) { // Divide by device scale as w_downsampled is in pixels while // cairo_surface_create_similar() uses device units. diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 551a86cbf..b8b45b40b 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -27,10 +27,10 @@ namespace Inkscape { namespace Filters { FilterImage::FilterImage() - : SVGElem(0) - , document(0) - , feImageHref(0) - , image(0) + : SVGElem(nullptr) + , document(nullptr) + , feImageHref(nullptr) + , image(nullptr) , broken_ref(false) { } @@ -309,10 +309,10 @@ double FilterImage::complexity(Geom::Affine const &) void FilterImage::set_href(const gchar *href){ if (feImageHref) g_free (feImageHref); - feImageHref = (href) ? g_strdup (href) : NULL; + feImageHref = (href) ? g_strdup (href) : nullptr; delete image; - image = NULL; + image = nullptr; broken_ref = false; } diff --git a/src/display/nr-filter-merge.cpp b/src/display/nr-filter-merge.cpp index fc2ce408f..316df84f0 100644 --- a/src/display/nr-filter-merge.cpp +++ b/src/display/nr-filter-merge.cpp @@ -43,7 +43,7 @@ void FilterMerge::render_cairo(FilterSlot &slot) // output is RGBA if at least one input is RGBA bool rgba32 = false; - cairo_surface_t *out = NULL; + cairo_surface_t *out = nullptr; for (std::vector<int>::iterator i = _input_image.begin(); i != _input_image.end(); ++i) { cairo_surface_t *in = slot.getcairo(*i); if (cairo_surface_get_content(in) == CAIRO_CONTENT_COLOR_ALPHA) { diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp index ec392ea06..c6be75e16 100644 --- a/src/display/nr-filter-primitive.cpp +++ b/src/display/nr-filter-primitive.cpp @@ -46,7 +46,7 @@ FilterPrimitive::FilterPrimitive() _subregion_width.unset(SVGLength::PERCENT, 1, 0); _subregion_height.unset(SVGLength::PERCENT, 1, 0); - _style = NULL; + _style = nullptr; } FilterPrimitive::~FilterPrimitive() diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp index 9d76462c0..1358530b8 100644 --- a/src/display/nr-filter-slot.cpp +++ b/src/display/nr-filter-slot.cpp @@ -29,7 +29,7 @@ FilterSlot::FilterSlot(DrawingItem *item, DrawingContext *bgdc, DrawingContext &graphic, FilterUnits const &u) : _item(item) , _source_graphic(graphic.rawTarget()) - , _background_ct(bgdc ? bgdc->raw() : NULL) + , _background_ct(bgdc ? bgdc->raw() : nullptr) , _source_graphic_area(graphic.targetLogicalBounds().roundOutwards()) // fixme , _background_area(bgdc ? bgdc->targetLogicalBounds().roundOutwards() : Geom::IntRect()) // fixme , _units(u) @@ -223,7 +223,7 @@ void FilterSlot::_set_internal(int slot_nr, cairo_surface_t *surface) void FilterSlot::set(int slot_nr, cairo_surface_t *surface) { - g_return_if_fail(surface != NULL); + g_return_if_fail(surface != nullptr); if (slot_nr == NR_FILTER_SLOT_NOT_SET) slot_nr = NR_FILTER_UNNAMED_SLOT; diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index 4782f3f54..6f8798a2a 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -367,7 +367,7 @@ int Filter::replace_primitive(int target, FilterPrimitiveType type) } FilterPrimitive *Filter::get_primitive(int handle) { - if (handle < 0 || handle >= static_cast<int>(_primitive.size())) return NULL; + if (handle < 0 || handle >= static_cast<int>(_primitive.size())) return nullptr; return _primitive[handle]; } diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 31bb27755..cec6de4d3 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -19,8 +19,8 @@ void NRStyle::Paint::clear() { if (server) { - sp_object_unref(server, NULL); - server = NULL; + sp_object_unref(server, nullptr); + server = nullptr; } type = PAINT_NONE; } @@ -38,7 +38,7 @@ void NRStyle::Paint::set(SPPaintServer *ps) if (ps) { type = PAINT_SERVER; server = ps; - sp_object_ref(server, NULL); + sp_object_ref(server, nullptr); } } @@ -48,15 +48,15 @@ NRStyle::NRStyle() , stroke_width(0.0) , miter_limit(0.0) , n_dash(0) - , dash(NULL) + , dash(nullptr) , dash_offset(0.0) , fill_rule(CAIRO_FILL_RULE_EVEN_ODD) , line_cap(CAIRO_LINE_CAP_BUTT) , line_join(CAIRO_LINE_JOIN_MITER) - , fill_pattern(NULL) - , stroke_pattern(NULL) - , text_decoration_fill_pattern(NULL) - , text_decoration_stroke_pattern(NULL) + , fill_pattern(nullptr) + , stroke_pattern(nullptr) + , text_decoration_fill_pattern(nullptr) + , text_decoration_stroke_pattern(nullptr) , text_decoration_line(TEXT_DECORATION_LINE_CLEAR) , text_decoration_style(TEXT_DECORATION_STYLE_CLEAR) , text_decoration_fill() @@ -97,14 +97,14 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style) // Handle 'context-fill' and 'context-stroke': Work in progress const SPIPaint *style_fill = &(style->fill); if( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { - if( context_style != NULL ) { + if( context_style != nullptr ) { style_fill = &(context_style->fill); } else { // A marker in the defs section will result in ending up here. //std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; } } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { - if( context_style != NULL ) { + if( context_style != nullptr ) { style_fill = &(context_style->stroke); } else { //std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; @@ -148,13 +148,13 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style) const SPIPaint *style_stroke = &(style->stroke); if( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { - if( context_style != NULL ) { + if( context_style != nullptr ) { style_stroke = &(context_style->fill); } else { //std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; } } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { - if( context_style != NULL ) { + if( context_style != nullptr ) { style_stroke = &(context_style->stroke); } else { //std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; @@ -225,7 +225,7 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style) } } else { dash_offset = 0.0; - dash = NULL; + dash = nullptr; } @@ -472,7 +472,7 @@ void NRStyle::applyTextDecorationStroke(Inkscape::DrawingContext &dc) dc.setLineCap(CAIRO_LINE_CAP_BUTT); dc.setLineJoin(CAIRO_LINE_JOIN_MITER); dc.setMiterLimit(miter_limit); - cairo_set_dash(dc.raw(), 0, 0, 0.0); // fixme (no dash) + cairo_set_dash(dc.raw(), nullptr, 0, 0.0); // fixme (no dash) } void NRStyle::update() @@ -482,10 +482,10 @@ void NRStyle::update() if (stroke_pattern) cairo_pattern_destroy(stroke_pattern); if (text_decoration_fill_pattern) cairo_pattern_destroy(text_decoration_fill_pattern); if (text_decoration_stroke_pattern) cairo_pattern_destroy(text_decoration_stroke_pattern); - fill_pattern = NULL; - stroke_pattern = NULL; - text_decoration_fill_pattern = NULL; - text_decoration_stroke_pattern = NULL; + fill_pattern = nullptr; + stroke_pattern = nullptr; + text_decoration_fill_pattern = nullptr; + text_decoration_stroke_pattern = nullptr; } /* diff --git a/src/display/nr-style.h b/src/display/nr-style.h index 6c652311a..354b9dd8b 100644 --- a/src/display/nr-style.h +++ b/src/display/nr-style.h @@ -29,7 +29,7 @@ struct NRStyle { NRStyle(); ~NRStyle(); - void set(SPStyle *style, SPStyle *context_style = NULL); + void set(SPStyle *style, SPStyle *context_style = nullptr); bool prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); bool prepareStroke(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); bool prepareTextDecorationFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); @@ -47,7 +47,7 @@ struct NRStyle { }; struct Paint { - Paint() : type(PAINT_NONE), color(0), server(NULL), opacity(1.0) {} + Paint() : type(PAINT_NONE), color(0), server(nullptr), opacity(1.0) {} ~Paint() { clear(); } PaintType type; diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp index c3354bc0b..e2b112c1b 100644 --- a/src/display/nr-svgfonts.cpp +++ b/src/display/nr-svgfonts.cpp @@ -79,7 +79,7 @@ UserFont::UserFont(SvgFont* instance){ cairo_user_font_face_set_render_glyph_func (this->face, font_render_glyph_cb); cairo_user_font_face_set_text_to_glyphs_func(this->face, font_text_to_glyphs_cb); - cairo_font_face_set_user_data (this->face, &key, (void*)instance, (cairo_destroy_func_t) NULL); + cairo_font_face_set_user_data (this->face, &key, (void*)instance, (cairo_destroy_func_t) nullptr); } //******************************// @@ -87,8 +87,8 @@ UserFont::UserFont(SvgFont* instance){ //******************************// SvgFont::SvgFont(SPFont* spfont){ this->font = spfont; - this->missingglyph = NULL; - this->userfont = NULL; + this->missingglyph = nullptr; + this->userfont = nullptr; } cairo_status_t @@ -191,8 +191,8 @@ SvgFont::scaled_font_text_to_glyphs (cairo_scaled_font_t */*scaled_font*/, //We use that info to allocate memory for the glyphs *glyphs = (cairo_glyph_t*) malloc(count*sizeof(cairo_glyph_t)); - char* previous_unicode = NULL; //This is used for kerning - gchar* previous_glyph_name = NULL; //This is used for kerning + char* previous_unicode = nullptr; //This is used for kerning + gchar* previous_glyph_name = nullptr; //This is used for kerning count=0; double x=0, y=0;//These vars store the position of the glyph within the rendered string @@ -312,7 +312,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, if (glyph > this->glyphs.size()) return CAIRO_STATUS_SUCCESS;//TODO: this is an error! - SPObject *node = NULL; + SPObject *node = nullptr; if (glyph == glyphs.size()){ if (!missingglyph) { return CAIRO_STATUS_SUCCESS; @@ -370,7 +370,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, SPPath *path = dynamic_cast<SPPath *>(item); if (path) { SPShape *shape = dynamic_cast<SPShape *>(item); - g_assert(shape != NULL); + g_assert(shape != nullptr); pathv = shape->_curve->get_pathvector(); pathv = flip_coordinate_system(spfont, pathv); this->render_glyph_path(cr, &pathv); @@ -405,7 +405,7 @@ SvgFont::get_font_face(){ void SvgFont::refresh(){ this->glyphs.clear(); delete this->userfont; - this->userfont = NULL; + this->userfont = nullptr; } double SvgFont::units_per_em() { diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index f2271e0c6..2e329c4aa 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -29,10 +29,10 @@ namespace Inkscape { namespace Display { SnapIndicator::SnapIndicator(SPDesktop * desktop) - : _snaptarget(NULL), - _snaptarget_tooltip(NULL), - _snaptarget_bbox(NULL), - _snapsource(NULL), + : _snaptarget(nullptr), + _snaptarget_tooltip(nullptr), + _snaptarget_bbox(nullptr), + _snapsource(nullptr), _snaptarget_is_presnap(false), _desktop(desktop) { @@ -50,7 +50,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap { remove_snaptarget(); //only display one snaptarget at a time - g_assert(_desktop != NULL); + g_assert(_desktop != nullptr); if (!p.getSnapped()) { return; // If we haven't snapped, then it is of no use to draw a snapindicator @@ -245,7 +245,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap remove_snapsource(); // Don't set both the source and target indicators, as these will overlap // Display the snap indicator (i.e. the cross) - SPCanvasItem * canvasitem = NULL; + SPCanvasItem * canvasitem = nullptr; canvasitem = sp_canvas_item_new(_desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, @@ -281,7 +281,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap _snaptarget_is_presnap = pre_snap; // Display the tooltip, which reveals the type of snap source and the type of snap target - gchar *tooltip_str = NULL; + gchar *tooltip_str = nullptr; if ( (p.getSource() != SNAPSOURCE_GRID_PITCH) && (p.getTarget() != SNAPTARGET_UNDEFINED) ) { tooltip_str = g_strconcat(source_name, _(" to "), target_name, NULL); } else if (p.getSource() != SNAPSOURCE_UNDEFINED) { @@ -320,7 +320,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap if (bbox) { SPCanvasItem* box = sp_canvas_item_new(_desktop->getTempGroup(), SP_TYPE_CTRLRECT, - NULL); + nullptr); SP_CTRLRECT(box)->setRectangle(*bbox); SP_CTRLRECT(box)->setColor(pre_snap ? 0x7f7f7fff : 0xff0000ff, 0, 0); @@ -341,18 +341,18 @@ SnapIndicator::remove_snaptarget(bool only_if_presnap) if (_snaptarget) { _desktop->remove_temporary_canvasitem(_snaptarget); - _snaptarget = NULL; + _snaptarget = nullptr; _snaptarget_is_presnap = false; } if (_snaptarget_tooltip) { _desktop->remove_temporary_canvasitem(_snaptarget_tooltip); - _snaptarget_tooltip = NULL; + _snaptarget_tooltip = nullptr; } if (_snaptarget_bbox) { _desktop->remove_temporary_canvasitem(_snaptarget_bbox); - _snaptarget_bbox = NULL; + _snaptarget_bbox = nullptr; } } @@ -362,7 +362,7 @@ SnapIndicator::set_new_snapsource(Inkscape::SnapCandidatePoint const &p) { remove_snapsource(); - g_assert(_desktop != NULL); // If this fails, then likely setup() has not been called on the snap manager (see snap.cpp -> setup()) + g_assert(_desktop != nullptr); // If this fails, then likely setup() has not been called on the snap manager (see snap.cpp -> setup()) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool value = prefs->getBool("/options/snapindicator/value", true); @@ -386,7 +386,7 @@ SnapIndicator::set_new_snapsource(Inkscape::SnapCandidatePoint const &p) void SnapIndicator::set_new_debugging_point(Geom::Point const &p) { - g_assert(_desktop != NULL); + g_assert(_desktop != nullptr); SPCanvasItem * canvasitem = sp_canvas_item_new( _desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, @@ -407,7 +407,7 @@ SnapIndicator::remove_snapsource() { if (_snapsource) { _desktop->remove_temporary_canvasitem(_snapsource); - _snapsource = NULL; + _snapsource = nullptr; } } diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index 04ec947f6..45db82a93 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -79,7 +79,7 @@ sp_ctrl_set_property(GObject *object, guint prop_id, const GValue *value, GParam SPCanvasItem *item; SPCtrl *ctrl; - GdkPixbuf * pixbuf = NULL; + GdkPixbuf * pixbuf = nullptr; item = SP_CANVAS_ITEM (object); ctrl = SP_CTRL (object); @@ -206,22 +206,22 @@ sp_ctrl_init (SPCtrl *ctrl) ctrl->angle = 0.0; new (&ctrl->box) Geom::IntRect(0,0,0,0); - ctrl->cache = NULL; - ctrl->pixbuf = NULL; + ctrl->cache = nullptr; + ctrl->pixbuf = nullptr; ctrl->_point = Geom::Point(0,0); } static void sp_ctrl_destroy(SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (SP_IS_CTRL (object)); SPCtrl *ctrl = SP_CTRL (object); if (ctrl->cache) { delete[] ctrl->cache; - ctrl->cache = NULL; + ctrl->cache = nullptr; } if (SP_CANVAS_ITEM_CLASS(sp_ctrl_parent_class)->destroy) diff --git a/src/display/sp-canvas-util.cpp b/src/display/sp-canvas-util.cpp index 25b70824b..e6c6ea839 100644 --- a/src/display/sp-canvas-util.cpp +++ b/src/display/sp-canvas-util.cpp @@ -42,7 +42,7 @@ void sp_canvas_prepare_buffer(SPCanvasBuf *) Geom::Affine sp_canvas_item_i2p_affine (SPCanvasItem * item) { - g_assert (item != NULL); /* this may be overly zealous - it is + g_assert (item != nullptr); /* this may be overly zealous - it is * plausible that this gets called * with item == 0. */ @@ -51,22 +51,22 @@ Geom::Affine sp_canvas_item_i2p_affine (SPCanvasItem * item) Geom::Affine sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to) { - g_assert (from != NULL); - g_assert (to != NULL); + g_assert (from != nullptr); + g_assert (to != nullptr); return sp_canvas_item_i2w_affine(from) * sp_canvas_item_i2w_affine(to).inverse(); } void sp_canvas_item_set_i2w_affine (SPCanvasItem * item, Geom::Affine const &i2w) { - g_assert (item != NULL); + g_assert (item != nullptr); sp_canvas_item_affine_absolute(item, i2w * sp_canvas_item_i2w_affine(item->parent).inverse()); } void sp_canvas_item_move_to_z (SPCanvasItem * item, gint z) { - g_assert (item != NULL); + g_assert (item != nullptr); if (z == 0) return sp_canvas_item_lower_to_bottom(item); diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index c717bc7ae..6a38ae3e7 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -49,7 +49,7 @@ using Inkscape::Debug::GdkEventLatencyTracker; // gtk_check_version returns non-NULL on failure static bool const HAS_BROKEN_MOTION_HINTS = - true || gtk_check_version(2, 12, 0) != NULL; + true || gtk_check_version(2, 12, 0) != nullptr; // Define this to visualize the regions to be redrawn //#define DEBUG_REDRAW 1; @@ -209,7 +209,7 @@ sp_canvas_item_class_init(SPCanvasItemClass *klass) G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, ((glong)((guint8*)&(klass->event) - (guint8*)klass)), - NULL, NULL, + nullptr, nullptr, sp_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, GDK_TYPE_EVENT); @@ -223,7 +223,7 @@ sp_canvas_item_class_init(SPCanvasItemClass *klass) G_TYPE_FROM_CLASS (gobject_class), (GSignalFlags)(G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS), G_STRUCT_OFFSET (SPCanvasItemClass, destroy), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } @@ -248,11 +248,11 @@ SPCanvasItem *sp_canvas_item_new(SPCanvasGroup *parent, GType type, gchar const { va_list args; - g_return_val_if_fail(parent != NULL, NULL); + g_return_val_if_fail(parent != nullptr, NULL); g_return_val_if_fail(SP_IS_CANVAS_GROUP(parent), NULL); g_return_val_if_fail(g_type_is_a(type, SP_TYPE_CANVAS_ITEM), NULL); - SPCanvasItem *item = SP_CANVAS_ITEM(g_object_new(type, NULL)); + SPCanvasItem *item = SP_CANVAS_ITEM(g_object_new(type, nullptr)); va_start(args, first_arg_name); sp_canvas_item_construct(item, parent, first_arg_name, args); @@ -329,22 +329,22 @@ void sp_canvas_item_dispose(GObject *object) item->visible = FALSE; if (item == item->canvas->_current_item) { - item->canvas->_current_item = NULL; + item->canvas->_current_item = nullptr; item->canvas->_need_repick = TRUE; } if (item == item->canvas->_new_current_item) { - item->canvas->_new_current_item = NULL; + item->canvas->_new_current_item = nullptr; item->canvas->_need_repick = TRUE; } if (item == item->canvas->_grabbed_item) { - item->canvas->_grabbed_item = NULL; + item->canvas->_grabbed_item = nullptr; ungrab_default_client_pointer(); } if (item == item->canvas->_focused_item) { - item->canvas->_focused_item = NULL; + item->canvas->_focused_item = nullptr; } if (item->parent) { @@ -439,7 +439,7 @@ void sp_canvas_item_affine_absolute(SPCanvasItem *item, Geom::Affine const &affi if (!item->need_affine) { item->need_affine = TRUE; - if (item->parent != NULL) { + if (item->parent != nullptr) { sp_canvas_item_request_update (item->parent); } else { item->canvas->requestUpdate(); @@ -460,7 +460,7 @@ void sp_canvas_item_affine_absolute(SPCanvasItem *item, Geom::Affine const &affi */ void sp_canvas_item_raise(SPCanvasItem *item, int positions) { - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); g_return_if_fail (positions >= 0); @@ -484,7 +484,7 @@ void sp_canvas_item_raise(SPCanvasItem *item, int positions) void sp_canvas_item_raise_to_top(SPCanvasItem *item) { - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); if (!item->parent) return; @@ -508,7 +508,7 @@ void sp_canvas_item_raise_to_top(SPCanvasItem *item) */ void sp_canvas_item_lower(SPCanvasItem *item, int positions) { - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); g_return_if_fail (positions >= 1); @@ -533,7 +533,7 @@ void sp_canvas_item_lower(SPCanvasItem *item, int positions) void sp_canvas_item_lower_to_bottom(SPCanvasItem *item) { - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); if (!item->parent) return; @@ -554,7 +554,7 @@ bool sp_canvas_item_is_visible(SPCanvasItem *item) */ void sp_canvas_item_show(SPCanvasItem *item) { - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); if (item->visible) { @@ -579,7 +579,7 @@ void sp_canvas_item_show(SPCanvasItem *item) */ void sp_canvas_item_hide(SPCanvasItem *item) { - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); if (!item->visible) { @@ -606,7 +606,7 @@ void sp_canvas_item_hide(SPCanvasItem *item) */ int sp_canvas_item_grab(SPCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime) { - g_return_val_if_fail (item != NULL, -1); + g_return_val_if_fail (item != nullptr, -1); g_return_val_if_fail (SP_IS_CANVAS_ITEM (item), -1); g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)), -1); @@ -637,9 +637,9 @@ int sp_canvas_item_grab(SPCanvasItem *item, guint event_mask, GdkCursor *cursor, GDK_SEAT_CAPABILITY_ALL_POINTING, FALSE, cursor, - NULL, - NULL, - NULL); + nullptr, + nullptr, + nullptr); #else auto dm = gdk_display_get_device_manager(display); auto device = gdk_device_manager_get_client_pointer(dm); @@ -669,14 +669,14 @@ int sp_canvas_item_grab(SPCanvasItem *item, guint event_mask, GdkCursor *cursor, */ void sp_canvas_item_ungrab(SPCanvasItem *item, guint32 etime) { - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); if (item->canvas->_grabbed_item != item) { return; } - item->canvas->_grabbed_item = NULL; + item->canvas->_grabbed_item = nullptr; ungrab_default_client_pointer(etime); } @@ -726,7 +726,7 @@ void sp_canvas_item_request_update(SPCanvasItem *item) item->need_update = TRUE; - if (item->parent != NULL) { + if (item->parent != nullptr) { // Recurse up the tree sp_canvas_item_request_update (item->parent); } else { @@ -772,7 +772,7 @@ static void sp_canvas_group_init(SPCanvasGroup * group) void SPCanvasGroup::destroy(SPCanvasItem *object) { - g_return_if_fail(object != NULL); + g_return_if_fail(object != nullptr); g_return_if_fail(SP_IS_CANVAS_GROUP(object)); SPCanvasGroup *group = SP_CANVAS_GROUP(object); @@ -827,14 +827,14 @@ double SPCanvasGroup::point(SPCanvasItem *item, Geom::Point p, SPCanvasItem **ac int y2 = (int)(y + item->canvas->_close_enough); double best = 0.0; - *actual_item = NULL; + *actual_item = nullptr; double dist = 0.0; for (std::list<SPCanvasItem *>::const_iterator it = group->items.begin(); it != group->items.end(); ++it) { SPCanvasItem *child = *it; if ((child->x1 <= x2) && (child->y1 <= y2) && (child->x2 >= x1) && (child->y2 >= y1)) { - SPCanvasItem *point_item = NULL; // cater for incomplete item implementations + SPCanvasItem *point_item = nullptr; // cater for incomplete item implementations int pickable; if (child->visible && child->pickable && SP_CANVAS_ITEM_GET_CLASS(child)->point) { @@ -905,7 +905,7 @@ void SPCanvasGroup::add(SPCanvasItem *item) void SPCanvasGroup::remove(SPCanvasItem *item) { - g_return_if_fail(item != NULL); + g_return_if_fail(item != nullptr); auto position = std::find(items.begin(), items.end(), item); if (position != items.end()) { @@ -913,7 +913,7 @@ void SPCanvasGroup::remove(SPCanvasItem *item) } // Unparent the child - item->parent = NULL; + item->parent = nullptr; g_object_unref(item); } @@ -955,7 +955,7 @@ static void sp_canvas_init(SPCanvas *canvas) canvas->_pick_event.crossing.y = 0; // Create the root item as a special case - canvas->_root = SP_CANVAS_ITEM(g_object_new(SP_TYPE_CANVAS_GROUP, NULL)); + canvas->_root = SP_CANVAS_ITEM(g_object_new(SP_TYPE_CANVAS_GROUP, nullptr)); canvas->_root->canvas = canvas; g_object_ref (canvas->_root); @@ -968,9 +968,9 @@ static void sp_canvas_init(SPCanvas *canvas) canvas->_drawing_disabled = false; - canvas->_backing_store = NULL; + canvas->_backing_store = nullptr; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - canvas->_surface_for_similar = NULL; + canvas->_surface_for_similar = nullptr; #endif canvas->_clean_region = cairo_region_create(); canvas->_background = cairo_pattern_create_rgb(1, 1, 1); @@ -991,7 +991,7 @@ void SPCanvas::shutdownTransients() dirtyAll(); if (_grabbed_item) { - _grabbed_item = NULL; + _grabbed_item = nullptr; ungrab_default_client_pointer(); } removeIdle(); @@ -1003,25 +1003,25 @@ void SPCanvas::dispose(GObject *object) if (canvas->_root) { g_object_unref (canvas->_root); - canvas->_root = NULL; + canvas->_root = nullptr; } if (canvas->_backing_store) { cairo_surface_destroy(canvas->_backing_store); - canvas->_backing_store = NULL; + canvas->_backing_store = nullptr; } #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) if (canvas->_surface_for_similar) { cairo_surface_destroy(canvas->_surface_for_similar); - canvas->_surface_for_similar = NULL; + canvas->_surface_for_similar = nullptr; } #endif if (canvas->_clean_region) { cairo_region_destroy(canvas->_clean_region); - canvas->_clean_region = NULL; + canvas->_clean_region = nullptr; } if (canvas->_background) { cairo_pattern_destroy(canvas->_background); - canvas->_background = NULL; + canvas->_background = nullptr; } canvas->shutdownTransients(); @@ -1048,7 +1048,7 @@ void trackLatency(GdkEvent const *event) GtkWidget *SPCanvas::createAA() { - SPCanvas *canvas = SP_CANVAS(g_object_new(SP_TYPE_CANVAS, NULL)); + SPCanvas *canvas = SP_CANVAS(g_object_new(SP_TYPE_CANVAS, nullptr)); return GTK_WIDGET(canvas); } @@ -1099,9 +1099,9 @@ void SPCanvas::handle_unrealize(GtkWidget *widget) { SPCanvas *canvas = SP_CANVAS (widget); - canvas->_current_item = NULL; - canvas->_grabbed_item = NULL; - canvas->_focused_item = NULL; + canvas->_current_item = nullptr; + canvas->_grabbed_item = nullptr; + canvas->_focused_item = nullptr; canvas->shutdownTransients(); @@ -1138,9 +1138,9 @@ void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation allocation->width, allocation->height); // Resize backing store. - cairo_surface_t *new_backing_store = NULL; + cairo_surface_t *new_backing_store = nullptr; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - if (canvas->_surface_for_similar != NULL) { + if (canvas->_surface_for_similar != nullptr) { // Size in device pixels. Does not set device scale. new_backing_store = @@ -1150,7 +1150,7 @@ void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation allocation->height * canvas->_device_scale); } #endif - if (new_backing_store == NULL) { + if (new_backing_store == nullptr) { // Size in device pixels. Does not set device scale. new_backing_store = @@ -1268,7 +1268,7 @@ int SPCanvas::emitEvent(GdkEvent *event) // (e.g. if the pointer leaves the window). So this is a hack that // Lauris applied to SP to get around the problem. // - SPCanvasItem* item = NULL; + SPCanvasItem* item = nullptr; if (_grabbed_item && !is_descendant(_current_item, _grabbed_item)) { item = _grabbed_item; } else { @@ -1333,7 +1333,7 @@ int SPCanvas::pickCurrentItem(GdkEvent *event) _pick_event.crossing.type = GDK_ENTER_NOTIFY; _pick_event.crossing.window = event->motion.window; _pick_event.crossing.send_event = event->motion.send_event; - _pick_event.crossing.subwindow = NULL; + _pick_event.crossing.subwindow = nullptr; _pick_event.crossing.x = event->motion.x; _pick_event.crossing.y = event->motion.y; _pick_event.crossing.mode = GDK_CROSSING_NORMAL; @@ -1381,10 +1381,10 @@ int SPCanvas::pickCurrentItem(GdkEvent *event) if (_root->visible) { sp_canvas_item_invoke_point (_root, Geom::Point(x, y), &_new_current_item); } else { - _new_current_item = NULL; + _new_current_item = nullptr; } } else { - _new_current_item = NULL; + _new_current_item = nullptr; } if ((_new_current_item == _current_item) && !_left_grabbed_item) { @@ -1394,7 +1394,7 @@ int SPCanvas::pickCurrentItem(GdkEvent *event) // Synthesize events for old and new current items if ((_new_current_item != _current_item) && - _current_item != NULL && !_left_grabbed_item) + _current_item != nullptr && !_left_grabbed_item) { GdkEvent new_event; @@ -1402,7 +1402,7 @@ int SPCanvas::pickCurrentItem(GdkEvent *event) new_event.type = GDK_LEAVE_NOTIFY; new_event.crossing.detail = GDK_NOTIFY_ANCESTOR; - new_event.crossing.subwindow = NULL; + new_event.crossing.subwindow = nullptr; _in_repick = TRUE; retval = emitEvent(&new_event); _in_repick = FALSE; @@ -1421,13 +1421,13 @@ int SPCanvas::pickCurrentItem(GdkEvent *event) _left_grabbed_item = FALSE; _current_item = _new_current_item; - if (_current_item != NULL) { + if (_current_item != nullptr) { GdkEvent new_event; new_event = _pick_event; new_event.type = GDK_ENTER_NOTIFY; new_event.crossing.detail = GDK_NOTIFY_ANCESTOR; - new_event.crossing.subwindow = NULL; + new_event.crossing.subwindow = nullptr; retval = emitEvent(&new_event); } @@ -1508,7 +1508,7 @@ gint SPCanvas::handle_scroll(GtkWidget *widget, GdkEventScroll *event) static inline void request_motions(GdkWindow *w, GdkEventMotion *event) { gdk_window_get_device_position(w, gdk_event_get_device((GdkEvent *)(event)), - NULL, NULL, NULL); + nullptr, nullptr, nullptr); gdk_event_request_motions(event); } @@ -1523,7 +1523,7 @@ int SPCanvas::handle_motion(GtkWidget *widget, GdkEventMotion *event) return FALSE; } - if (canvas->_root == NULL) // canvas being deleted + if (canvas->_root == nullptr) // canvas being deleted return FALSE; canvas->_state = event->state; @@ -1541,11 +1541,11 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect // Prevent crash if paintSingleBuffer is called before _backing_store is // initialized. - if (_backing_store == NULL) + if (_backing_store == nullptr) return; SPCanvasBuf buf; - buf.buf = NULL; + buf.buf = nullptr; buf.buf_rowstride = 0; buf.rect = paint_rect; buf.canvas_rect = canvas_rect; @@ -1604,7 +1604,7 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (_enable_cms_display_adj) { - cmsHTRANSFORM transf = 0; + cmsHTRANSFORM transf = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display"); if ( fromDisplay ) { @@ -1788,7 +1788,7 @@ bool SPCanvas::paintRect(int xx0, int yy0, int xx1, int yy1) gdk_window_get_device_position(gtk_widget_get_window(GTK_WIDGET(this)), device->gobj(), - &x, &y, NULL); + &x, &y, nullptr); setup.mouse_loc = sp_canvas_window_to_world(this, Geom::Point(x,y)); @@ -1828,7 +1828,7 @@ gboolean SPCanvas::handle_draw(GtkWidget *widget, cairo_t *cr) { SPCanvas *canvas = SP_CANVAS(widget); #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - if (canvas->_surface_for_similar == NULL && canvas->_backing_store != NULL) { + if (canvas->_surface_for_similar == nullptr && canvas->_backing_store != nullptr) { // Device scale is copied but since this is only created one time, we'll // need to check/set device scale anytime it is used in case window moved @@ -2011,7 +2011,7 @@ gint SPCanvas::idle_handler(gpointer data) void SPCanvas::addIdle() { if (_idle_id == 0) { - _idle_id = gdk_threads_add_idle_full(UPDATE_PRIORITY, idle_handler, this, NULL); + _idle_id = gdk_threads_add_idle_full(UPDATE_PRIORITY, idle_handler, this, nullptr); } } void SPCanvas::removeIdle() @@ -2055,9 +2055,9 @@ void SPCanvas::scrollTo( Geom::Point const &c, unsigned int clear, bool is_scrol // Adjust backing store contents assert(_backing_store); - cairo_surface_t *new_backing_store = NULL; + cairo_surface_t *new_backing_store = nullptr; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - if (_surface_for_similar != NULL) + if (_surface_for_similar != nullptr) // Size in device pixels. Does not set device scale. new_backing_store = @@ -2066,7 +2066,7 @@ void SPCanvas::scrollTo( Geom::Point const &c, unsigned int clear, bool is_scrol allocation.width * _device_scale, allocation.height * _device_scale); #endif - if (new_backing_store == NULL) + if (new_backing_store == nullptr) // Size in device pixels. Does not set device scale. new_backing_store = @@ -2158,7 +2158,7 @@ void SPCanvas::setBackgroundColor(guint32 rgba) { double new_b = SP_RGBA32_B_F(rgba); if (!_background_is_checkerboard) { double old_r, old_g, old_b; - cairo_pattern_get_rgba(_background, &old_r, &old_g, &old_b, NULL); + cairo_pattern_get_rgba(_background, &old_r, &old_g, &old_b, nullptr); if (new_r == old_r && new_g == old_g && new_b == old_b) return; } if (_background) { @@ -2186,7 +2186,7 @@ void SPCanvas::setBackgroundCheckerboard() { */ void sp_canvas_window_to_world(SPCanvas const *canvas, double winx, double winy, double *worldx, double *worldy) { - g_return_if_fail (canvas != NULL); + g_return_if_fail (canvas != nullptr); g_return_if_fail (SP_IS_CANVAS (canvas)); if (worldx) *worldx = canvas->_x0 + winx; @@ -2198,7 +2198,7 @@ void sp_canvas_window_to_world(SPCanvas const *canvas, double winx, double winy, */ void sp_canvas_world_to_window(SPCanvas const *canvas, double worldx, double worldy, double *winx, double *winy) { - g_return_if_fail (canvas != NULL); + g_return_if_fail (canvas != nullptr); g_return_if_fail (SP_IS_CANVAS (canvas)); if (winx) *winx = worldx - canvas->_x0; @@ -2210,7 +2210,7 @@ void sp_canvas_world_to_window(SPCanvas const *canvas, double worldx, double wor */ Geom::Point sp_canvas_window_to_world(SPCanvas const *canvas, Geom::Point const win) { - g_assert (canvas != NULL); + g_assert (canvas != nullptr); g_assert (SP_IS_CANVAS (canvas)); return Geom::Point(canvas->_x0 + win[0], canvas->_y0 + win[1]); @@ -2221,7 +2221,7 @@ Geom::Point sp_canvas_window_to_world(SPCanvas const *canvas, Geom::Point const */ Geom::Point sp_canvas_world_to_window(SPCanvas const *canvas, Geom::Point const world) { - g_assert (canvas != NULL); + g_assert (canvas != nullptr); g_assert (SP_IS_CANVAS (canvas)); return Geom::Point(world[0] - canvas->_x0, world[1] - canvas->_y0); @@ -2234,7 +2234,7 @@ bool sp_canvas_world_pt_inside_window(SPCanvas const *canvas, Geom::Point const { GtkAllocation allocation; - g_assert( canvas != NULL ); + g_assert( canvas != nullptr ); g_assert(SP_IS_CANVAS(canvas)); GtkWidget *w = GTK_WIDGET(canvas); diff --git a/src/display/sp-ctrlcurve.cpp b/src/display/sp-ctrlcurve.cpp index 79ef20d6c..26a3c2055 100644 --- a/src/display/sp-ctrlcurve.cpp +++ b/src/display/sp-ctrlcurve.cpp @@ -46,7 +46,7 @@ sp_ctrlcurve_init(SPCtrlCurve *ctrlcurve) { // Points are initialized to 0,0 ctrlcurve->rgba = 0x0000ff7f; - ctrlcurve->item=NULL; + ctrlcurve->item=nullptr; ctrlcurve->corner0 = -1; ctrlcurve->corner1 = -1; } @@ -55,12 +55,12 @@ namespace { static void sp_ctrlcurve_destroy(SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (SP_IS_CTRLCURVE (object)); SPCtrlCurve *ctrlcurve = SP_CTRLCURVE (object); - ctrlcurve->item=NULL; + ctrlcurve->item=nullptr; if (SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->destroy) SP_CANVAS_ITEM_CLASS(sp_ctrlcurve_parent_class)->destroy(object); diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp index c4ced2a33..709f85e54 100644 --- a/src/display/sp-ctrlline.cpp +++ b/src/display/sp-ctrlline.cpp @@ -51,19 +51,19 @@ static void sp_ctrlline_init(SPCtrlLine *ctrlline) { ctrlline->rgba = 0x0000ff7f; ctrlline->s[Geom::X] = ctrlline->s[Geom::Y] = ctrlline->e[Geom::X] = ctrlline->e[Geom::Y] = 0.0; - ctrlline->item=NULL; + ctrlline->item=nullptr; ctrlline->is_fill = true; } namespace { void sp_ctrlline_destroy(SPCanvasItem *object) { - g_return_if_fail(object != NULL); + g_return_if_fail(object != nullptr); g_return_if_fail(SP_IS_CTRLLINE(object)); SPCtrlLine *ctrlline = SP_CTRLLINE(object); - ctrlline->item = NULL; + ctrlline->item = nullptr; if(SP_CANVAS_ITEM_CLASS (sp_ctrlline_parent_class)->destroy) { SP_CANVAS_ITEM_CLASS (sp_ctrlline_parent_class)->destroy(object); diff --git a/src/display/sp-ctrlquadr.cpp b/src/display/sp-ctrlquadr.cpp index 760e93a6d..40c011e26 100644 --- a/src/display/sp-ctrlquadr.cpp +++ b/src/display/sp-ctrlquadr.cpp @@ -58,7 +58,7 @@ sp_ctrlquadr_init (SPCtrlQuadr *ctrlquadr) static void sp_ctrlquadr_destroy(SPCanvasItem *object) { - g_return_if_fail (object != NULL); + g_return_if_fail (object != nullptr); g_return_if_fail (SP_IS_CTRLQUADR (object)); if (SP_CANVAS_ITEM_CLASS(sp_ctrlquadr_parent_class)->destroy) @@ -139,7 +139,7 @@ static void sp_ctrlquadr_update(SPCanvasItem *item, Geom::Affine const &affine, void sp_ctrlquadr_set_rgba32 (SPCtrlQuadr *cl, guint32 rgba) { - g_return_if_fail (cl != NULL); + g_return_if_fail (cl != nullptr); g_return_if_fail (SP_IS_CTRLQUADR (cl)); if (rgba != cl->rgba) { @@ -153,7 +153,7 @@ sp_ctrlquadr_set_rgba32 (SPCtrlQuadr *cl, guint32 rgba) void sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, Geom::Point p1, Geom::Point p2, Geom::Point p3, Geom::Point p4) { - g_return_if_fail (cl != NULL); + g_return_if_fail (cl != nullptr); g_return_if_fail (SP_IS_CTRLQUADR (cl)); if (p1 != cl->p1 || p2 != cl->p2 || p3 != cl->p3 || p4 != cl->p4) { diff --git a/src/document-subset.cpp b/src/document-subset.cpp index f5e60db31..b16c1879f 100644 --- a/src/document-subset.cpp +++ b/src/document-subset.cpp @@ -31,7 +31,7 @@ struct DocumentSubset::Relations : public GC::Managed<GC::ATOMIC>, sigc::connection release_connection; sigc::connection position_changed_connection; - Record() : parent(NULL) {} + Record() : parent(nullptr) {} unsigned childIndex(SPObject *obj) { Siblings::iterator found; @@ -126,7 +126,7 @@ struct DocumentSubset::Relations : public GC::Managed<GC::ATOMIC>, sigc::signal<void, SPObject *> added_signal; sigc::signal<void, SPObject *> removed_signal; - Relations() { records[NULL]; } + Relations() { records[nullptr]; } ~Relations() override { for ( Map::iterator iter=records.begin() @@ -146,7 +146,7 @@ struct DocumentSubset::Relations : public GC::Managed<GC::ATOMIC>, if ( found != records.end() ) { return &(*found).second; } else { - return NULL; + return nullptr; } } @@ -177,8 +177,8 @@ private: void _doRemove(SPObject *obj) { Record &record=records[obj]; - if ( record.parent == NULL ) { - Record &root = records[NULL]; + if ( record.parent == nullptr ) { + Record &root = records[nullptr]; for ( Siblings::iterator it = root.children.begin(); it != root.children.end(); ++it ) { if ( *it == obj ) { root.children.erase( it ); @@ -220,13 +220,13 @@ DocumentSubset::DocumentSubset() } void DocumentSubset::Relations::addOne(SPObject *obj) { - g_return_if_fail( obj != NULL ); - g_return_if_fail( get(obj) == NULL ); + g_return_if_fail( obj != nullptr ); + g_return_if_fail( get(obj) == nullptr ); Record &record=_doAdd(obj); /* find the nearest ancestor in the subset */ - Record *parent_record=NULL; + Record *parent_record=nullptr; for ( SPObject::ParentIterator parent_iter=obj->parent ; !parent_record && parent_iter ; ++parent_iter ) { @@ -236,8 +236,8 @@ void DocumentSubset::Relations::addOne(SPObject *obj) { } } if (!parent_record) { - parent_record = get(NULL); - g_assert( parent_record != NULL ); + parent_record = get(nullptr); + g_assert( parent_record != nullptr ); } Siblings &children=record.children; @@ -251,7 +251,7 @@ void DocumentSubset::Relations::addOne(SPObject *obj) { ; iter != children.end() ; ++iter ) { Record *child_record=get(*iter); - g_assert( child_record != NULL ); + g_assert( child_record != nullptr ); child_record->parent = obj; } @@ -263,13 +263,13 @@ void DocumentSubset::Relations::addOne(SPObject *obj) { } void DocumentSubset::Relations::remove(SPObject *obj, bool subtree) { - g_return_if_fail( obj != NULL ); + g_return_if_fail( obj != nullptr ); Record *record=get(obj); - g_return_if_fail( record != NULL ); + g_return_if_fail( record != nullptr ); Record *parent_record=get(record->parent); - g_assert( parent_record != NULL ); + g_assert( parent_record != nullptr ); unsigned index=parent_record->removeChild(obj); @@ -286,7 +286,7 @@ void DocumentSubset::Relations::remove(SPObject *obj, bool subtree) { ; iter != children.end() ; ++iter) { Record *child_record=get(*iter); - g_assert( child_record != NULL ); + g_assert( child_record != nullptr ); child_record->parent = record->parent; } @@ -298,7 +298,7 @@ void DocumentSubset::Relations::remove(SPObject *obj, bool subtree) { } void DocumentSubset::Relations::clear() { - Record &root=records[NULL]; + Record &root=records[nullptr]; while (!root.children.empty()) { _doRemoveSubtree(root.children.front()); @@ -311,7 +311,7 @@ void DocumentSubset::Relations::reorder(SPObject *obj) { SPObject::ParentIterator parent=obj; /* find nearest ancestor in the subset */ - Record *parent_record=NULL; + Record *parent_record=nullptr; while (!parent_record) { parent_record = get(++parent); } @@ -356,7 +356,7 @@ bool DocumentSubset::includes(SPObject *obj) const { SPObject *DocumentSubset::parentOf(SPObject *obj) const { Relations::Record *record=_relations->get(obj); - return ( record ? record->parent : NULL ); + return ( record ? record->parent : nullptr ); } unsigned DocumentSubset::childCount(SPObject *obj) const { @@ -372,7 +372,7 @@ unsigned DocumentSubset::indexOf(SPObject *obj) const { SPObject *DocumentSubset::nthChildOf(SPObject *obj, unsigned n) const { Relations::Record *record=_relations->get(obj); - return ( record ? record->children[n] : NULL ); + return ( record ? record->children[n] : nullptr ); } sigc::connection DocumentSubset::connectChanged(sigc::slot<void> slot) const { diff --git a/src/document-undo.cpp b/src/document-undo.cpp index a66fb0ee8..50ae286df 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -61,8 +61,8 @@ void Inkscape::DocumentUndo::setUndoSensitive(SPDocument *doc, bool sensitive) { - g_assert (doc != NULL); - g_assert (doc->priv != NULL); + g_assert (doc != nullptr); + g_assert (doc->priv != nullptr); if ( sensitive == doc->priv->sensitive ) return; @@ -87,15 +87,15 @@ void Inkscape::DocumentUndo::setUndoSensitive(SPDocument *doc, bool sensitive) */ bool Inkscape::DocumentUndo::getUndoSensitive(SPDocument const *document) { - g_assert(document != NULL); - g_assert(document->priv != NULL); + g_assert(document != nullptr); + g_assert(document->priv != nullptr); return document->priv->sensitive; } void Inkscape::DocumentUndo::done(SPDocument *doc, const unsigned int event_type, Glib::ustring const &event_description) { - maybeDone(doc, NULL, event_type, event_description); + maybeDone(doc, nullptr, event_type, event_description); } void Inkscape::DocumentUndo::resetKey( SPDocument *doc ) @@ -138,8 +138,8 @@ public: void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const unsigned int event_type, Glib::ustring const &event_description) { - g_assert (doc != NULL); - g_assert (doc->priv != NULL); + g_assert (doc != nullptr); + g_assert (doc->priv != nullptr); g_assert (doc->priv->sensitive); if ( key && !*key ) { g_warning("Blank undo key specified."); @@ -154,7 +154,7 @@ void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const DocumentUndo::clearRedo(doc); Inkscape::XML::Event *log = sp_repr_coalesce_log (doc->priv->partial, sp_repr_commit_undoable (doc->rdoc)); - doc->priv->partial = NULL; + doc->priv->partial = nullptr; if (!log) { sp_repr_begin_transaction (doc->rdoc); @@ -187,8 +187,8 @@ void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const void Inkscape::DocumentUndo::cancel(SPDocument *doc) { - g_assert (doc != NULL); - g_assert (doc->priv != NULL); + g_assert (doc != nullptr); + g_assert (doc->priv != nullptr); g_assert (doc->priv->sensitive); sp_repr_rollback (doc->rdoc); @@ -197,7 +197,7 @@ void Inkscape::DocumentUndo::cancel(SPDocument *doc) sp_repr_undo_log (doc->priv->partial); doc->emitReconstructionFinish(); sp_repr_free_log (doc->priv->partial); - doc->priv->partial = NULL; + doc->priv->partial = nullptr; } sp_repr_begin_transaction (doc->rdoc); @@ -213,7 +213,7 @@ static void finish_incomplete_transaction(SPDocument &doc) { Inkscape::Event *event = new Inkscape::Event(priv.partial); priv.undo.push_back(event); priv.undoStackObservers.notifyUndoCommitEvent(event); - priv.partial = NULL; + priv.partial = nullptr; } } @@ -224,7 +224,7 @@ static void perform_document_update(SPDocument &doc) { Inkscape::XML::Event *update_log=sp_repr_commit_undoable(doc.rdoc); doc.emitReconstructionFinish(); - if (update_log != NULL) { + if (update_log != nullptr) { g_warning("Document was modified while being updated after undo operation"); sp_repr_debug_print_log(update_log); @@ -247,8 +247,8 @@ gboolean Inkscape::DocumentUndo::undo(SPDocument *doc) EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker("undo"); - g_assert (doc != NULL); - g_assert (doc->priv != NULL); + g_assert (doc != nullptr); + g_assert (doc->priv != nullptr); g_assert (doc->priv->sensitive); doc->priv->sensitive = FALSE; @@ -293,8 +293,8 @@ gboolean Inkscape::DocumentUndo::redo(SPDocument *doc) EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker("redo"); - g_assert (doc != NULL); - g_assert (doc->priv != NULL); + g_assert (doc != nullptr); + g_assert (doc->priv != nullptr); g_assert (doc->priv->sensitive); doc->priv->sensitive = FALSE; diff --git a/src/document.cpp b/src/document.cpp index d8b5ee38e..825b826c5 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -101,24 +101,24 @@ SPDocument::SPDocument() : keepalive(FALSE), virgin(TRUE), modified_since_save(FALSE), - rdoc(NULL), - rroot(NULL), - root(NULL), - style_cascade(cr_cascade_new(NULL, NULL, NULL)), - style_sheet(NULL), - uri(NULL), - base(NULL), - name(NULL), - priv(NULL), // reset in ctor + rdoc(nullptr), + rroot(nullptr), + root(nullptr), + style_cascade(cr_cascade_new(nullptr, nullptr, nullptr)), + style_sheet(nullptr), + uri(nullptr), + base(nullptr), + name(nullptr), + priv(nullptr), // reset in ctor actionkey(), modified_id(0), rerouting_handler_id(0), - profileManager(NULL), // deferred until after other initialization + profileManager(nullptr), // deferred until after other initialization router(new Avoid::Router(Avoid::PolyLineRouting|Avoid::OrthogonalRouting)), oldSignalsConnected(false), - current_persp3d(NULL), - current_persp3d_impl(NULL), - _parent_document(NULL), + current_persp3d(nullptr), + current_persp3d_impl(nullptr), + _parent_document(nullptr), _node_cache_valid(false) { // Penalise libavoid for choosing paths with needless extra segments. @@ -130,7 +130,7 @@ SPDocument::SPDocument() : p->serial = next_serial++; p->sensitive = false; - p->partial = NULL; + p->partial = nullptr; p->history_size = 0; p->seeking = false; @@ -150,12 +150,12 @@ SPDocument::~SPDocument() { // kill/unhook this first if ( profileManager ) { delete profileManager; - profileManager = 0; + profileManager = nullptr; } if (router) { delete router; - router = NULL; + router = nullptr; } if (oldSignalsConnected) { @@ -169,7 +169,7 @@ SPDocument::~SPDocument() { if (priv) { if (priv->partial) { sp_repr_free_log(priv->partial); - priv->partial = NULL; + priv->partial = nullptr; } DocumentUndo::clearRedo(this); @@ -178,7 +178,7 @@ SPDocument::~SPDocument() { if (root) { root->releaseReferences(); sp_object_unref(root); - root = NULL; + root = nullptr; } if (rdoc) Inkscape::GC::release(rdoc); @@ -189,19 +189,19 @@ SPDocument::~SPDocument() { // This also destroys all attached stylesheets cr_cascade_unref(style_cascade); - style_cascade = NULL; + style_cascade = nullptr; if (name) { g_free(name); - name = NULL; + name = nullptr; } if (base) { g_free(base); - base = NULL; + base = nullptr; } if (uri) { g_free(uri); - uri = NULL; + uri = nullptr; } if (modified_id) { @@ -221,7 +221,7 @@ SPDocument::~SPDocument() { if (this->current_persp3d_impl) delete this->current_persp3d_impl; - this->current_persp3d_impl = NULL; + this->current_persp3d_impl = nullptr; // This is at the end of the destructor, because preceding code adds new orphans to the queue collectOrphans(); @@ -236,7 +236,7 @@ sigc::connection SPDocument::connectDestroy(sigc::signal<void>::slot_type slot) SPDefs *SPDocument::getDefs() { if (!root) { - return NULL; + return nullptr; } return root->defs; } @@ -289,10 +289,10 @@ unsigned long SPDocument::serial() const { } void SPDocument::queueForOrphanCollection(SPObject *object) { - g_return_if_fail(object != NULL); + g_return_if_fail(object != nullptr); g_return_if_fail(object->document == this); - sp_object_ref(object, NULL); + sp_object_ref(object, nullptr); _collection_queue.push_back(object); } @@ -303,7 +303,7 @@ void SPDocument::collectOrphans() { for (std::vector<SPObject *>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) { SPObject *object = *iter; object->collectOrphan(); - sp_object_unref(object, NULL); + sp_object_unref(object, nullptr); } } } @@ -336,15 +336,15 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, if (document->uri){ g_free(document->uri); - document->uri = 0; + document->uri = nullptr; } if (document->base){ g_free(document->base); - document->base = 0; + document->base = nullptr; } if (document->name){ g_free(document->name); - document->name = 0; + document->name = nullptr; } #ifndef WIN32 document->uri = prepend_current_dir_if_relative(uri); @@ -359,7 +359,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, if (base) { document->base = g_strdup(base); } else { - document->base = NULL; + document->base = nullptr; } document->name = g_strdup(name); @@ -368,7 +368,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, SPObject* rootObj = SPFactory::createObject(typeString); document->root = dynamic_cast<SPRoot*>(rootObj); - if (document->root == 0) { + if (document->root == nullptr) { // Node is not a valid root element delete rootObj; @@ -380,15 +380,15 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, document->root->invoke_build(document, rroot, false); /* Eliminate obsolete sodipodi:docbase, for privacy reasons */ - rroot->setAttribute("sodipodi:docbase", NULL); + rroot->setAttribute("sodipodi:docbase", nullptr); /* Eliminate any claim to adhere to a profile, as we don't try to */ - rroot->setAttribute("baseProfile", NULL); + rroot->setAttribute("baseProfile", nullptr); // creating namedview - if (!sp_item_group_get_child_by_name(document->root, NULL, "sodipodi:namedview")) { + if (!sp_item_group_get_child_by_name(document->root, nullptr, "sodipodi:namedview")) { // if there's none in the document already, - Inkscape::XML::Node *rnew = NULL; + Inkscape::XML::Node *rnew = nullptr; rnew = rdoc->createElement("sodipodi:namedview"); //rnew->setAttribute("id", "base"); @@ -422,11 +422,11 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, prefs->getInt("/template/base/inkscape:window-height", 480)); // insert into the document - rroot->addChild(rnew, NULL); + rroot->addChild(rnew, nullptr); // clean up Inkscape::GC::release(rnew); } else { - Inkscape::XML::Node *nv_repr = sp_item_group_get_child_by_name(document->root, NULL, "sodipodi:namedview")->getRepr(); + Inkscape::XML::Node *nv_repr = sp_item_group_get_child_by_name(document->root, nullptr, "sodipodi:namedview")->getRepr(); if (!nv_repr->attribute("inkscape:document-rotation")) { sp_repr_set_svg_double(nv_repr, "inkscape:document-rotation", 0.); } @@ -435,7 +435,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, // Defs if (!document->root->defs) { Inkscape::XML::Node *r = rdoc->createElement("svg:defs"); - rroot->addChild(r, NULL); + rroot->addChild(r, nullptr); Inkscape::GC::release(r); g_assert(document->root->defs); } @@ -494,9 +494,9 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, SPDocument *SPDocument::createChildDoc(std::string const &uri) { SPDocument *parent = this; - SPDocument *document = NULL; + SPDocument *document = nullptr; - while(parent != NULL && parent->getURI() != NULL && document == NULL) { + while(parent != nullptr && parent->getURI() != nullptr && document == nullptr) { // Check myself and any parents in the chain if(uri == parent->getURI()) { document = parent; @@ -533,9 +533,9 @@ SPDocument *SPDocument::createChildDoc(std::string const &uri) */ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, bool make_new, SPDocument *parent) { - Inkscape::XML::Document *rdoc = NULL; - gchar *base = NULL; - gchar *name = NULL; + Inkscape::XML::Document *rdoc = nullptr; + gchar *base = nullptr; + gchar *name = nullptr; if (uri) { Inkscape::XML::Node *rroot; @@ -543,11 +543,11 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b /* Try to fetch repr from file */ rdoc = sp_repr_read_file(uri, SP_SVG_NS_URI); /* If file cannot be loaded, return NULL without warning */ - if (rdoc == NULL) return NULL; + if (rdoc == nullptr) return nullptr; rroot = rdoc->root(); /* If xml file is not svg, return NULL without warning */ /* fixme: destroy document */ - if (strcmp(rroot->name(), "svg:svg") != 0) return NULL; + if (strcmp(rroot->name(), "svg:svg") != 0) return nullptr; s = g_strdup(uri); p = strrchr(s, '/'); if (p) { @@ -555,12 +555,12 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b p[1] = '\0'; base = g_strdup(s); } else { - base = NULL; + base = nullptr; name = g_strdup(uri); } if (make_new) { - base = NULL; - uri = NULL; + base = nullptr; + uri = nullptr; name = g_strdup_printf(_("New document %d"), ++doc_count); } g_free(s); @@ -585,7 +585,7 @@ SPDocument *SPDocument::createNewDoc(gchar const *uri, unsigned int keepalive, b SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, unsigned int keepalive) { - SPDocument *doc = NULL; + SPDocument *doc = nullptr; Inkscape::XML::Document *rdoc = sp_repr_read_mem(buffer, length, SP_SVG_NS_URI); if ( rdoc ) { @@ -596,7 +596,7 @@ SPDocument *SPDocument::createNewDocFromMem(gchar const *buffer, gint length, un // TODO fixme: destroy document } else { Glib::ustring name = Glib::ustring::compose( _("Memory document %1"), ++doc_mem_count ); - doc = createDoc(rdoc, NULL, NULL, name.c_str(), keepalive, NULL); + doc = createDoc(rdoc, nullptr, nullptr, name.c_str(), keepalive, nullptr); } } @@ -612,13 +612,13 @@ SPDocument *SPDocument::doRef() SPDocument *SPDocument::doUnref() { Inkscape::GC::release(this); - return NULL; + return nullptr; } /// guaranteed not to return nullptr Inkscape::Util::Unit const* SPDocument::getDisplayUnit() const { - SPNamedView const* nv = sp_document_namedview(this, NULL); + SPNamedView const* nv = sp_document_namedview(this, nullptr); return nv ? nv->getDisplayUnit() : unit_table.getUnit("px"); } @@ -700,8 +700,8 @@ void SPDocument::setWidthAndHeight(const Inkscape::Util::Quantity &width, const Inkscape::Util::Quantity SPDocument::getWidth() const { - g_return_val_if_fail(this->priv != NULL, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); - g_return_val_if_fail(this->root != NULL, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); + g_return_val_if_fail(this->priv != nullptr, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); + g_return_val_if_fail(this->root != nullptr, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); gdouble result = root->width.value; SVGLength::Unit u = root->width.unit; @@ -739,8 +739,8 @@ void SPDocument::setWidth(const Inkscape::Util::Quantity &width, bool changeSize Inkscape::Util::Quantity SPDocument::getHeight() const { - g_return_val_if_fail(this->priv != NULL, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); - g_return_val_if_fail(this->root != NULL, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); + g_return_val_if_fail(this->priv != nullptr, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); + g_return_val_if_fail(this->root != nullptr, Inkscape::Util::Quantity(0.0, unit_table.getUnit(""))); gdouble result = root->height.value; SVGLength::Unit u = root->height.unit; @@ -821,7 +821,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) Inkscape::Util::Unit const *nv_units = unit_table.getUnit("px"); if (root->height.unit && (root->height.unit != SVGLength::PERCENT)) nv_units = unit_table.getUnit(root->height.unit); - SPNamedView *nv = sp_document_namedview(this, NULL); + SPNamedView *nv = sp_document_namedview(this, nullptr); /* in px */ double margin_top = 0.0; @@ -830,7 +830,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) double margin_bottom = 0.0; if (with_margins && nv) { - if (nv != NULL) { + if (nv != nullptr) { margin_top = nv->getMarginLength("fit-margin-top", nv_units, unit_table.getUnit("px"), w, h, false); margin_left = nv->getMarginLength("fit-margin-left", nv_units, unit_table.getUnit("px"), w, h, true); margin_right = nv->getMarginLength("fit-margin-right", nv_units, unit_table.getUnit("px"), w, h, true); @@ -870,7 +870,7 @@ void SPDocument::setBase( gchar const* base ) { if (this->base) { g_free(this->base); - this->base = NULL; + this->base = nullptr; } if (base) { this->base = g_strdup(base); @@ -879,9 +879,9 @@ void SPDocument::setBase( gchar const* base ) void SPDocument::do_change_uri(gchar const *const filename, bool const rebase) { - gchar *new_base = NULL; - gchar *new_name = NULL; - gchar *new_uri = NULL; + gchar *new_base = nullptr; + gchar *new_name = nullptr; + gchar *new_uri = nullptr; if (filename) { #ifndef WIN32 @@ -895,7 +895,7 @@ void SPDocument::do_change_uri(gchar const *const filename, bool const rebase) new_name = g_path_get_basename(new_uri); } else { new_uri = g_strdup_printf(_("Unnamed document %d"), ++doc_count); - new_base = NULL; + new_base = nullptr; new_name = g_strdup(this->uri); } @@ -1068,9 +1068,9 @@ SPObject *SPDocument::getObjectById(Glib::ustring const &id) const SPObject *SPDocument::getObjectById(gchar const *id) const { - g_return_val_if_fail(id != NULL, NULL); + g_return_val_if_fail(id != nullptr, NULL); if (!priv || priv->iddef.empty()) { - return NULL; + return nullptr; } // GQuark idq = g_quark_from_string(id); @@ -1082,7 +1082,7 @@ SPObject *SPDocument::getObjectById(gchar const *id) const } else { - return NULL; + return nullptr; } } @@ -1171,7 +1171,7 @@ std::vector<SPObject *> SPDocument::getObjectsBySelector(Glib::ustring const &se std::vector<SPObject *> objects; g_return_val_if_fail(!selector.empty(), objects); - static CRSelEng *sel_eng = NULL; + static CRSelEng *sel_eng = nullptr; if (!sel_eng) { sel_eng = cr_sel_eng_new(); cr_sel_eng_set_node_iface(sel_eng, &Inkscape::XML::croco_node_iface); @@ -1181,7 +1181,7 @@ std::vector<SPObject *> SPDocument::getObjectsBySelector(Glib::ustring const &se CRSelector *cr_selector = cr_selector_parse_from_buf ((guchar*)my_selector.c_str(), CR_UTF_8); // char * cr_string = (char*)cr_selector_to_string( cr_selector ); // std::cout << " selector: |" << (cr_string?cr_string:"Empty") << "|" << std::endl; - CRSelector const *cur = NULL; + CRSelector const *cur = nullptr; for (cur = cr_selector; cur; cur = cur->next) { if (cur->simple_sel ) { _getObjectsBySelectorRecursive(root, sel_eng, cur->simple_sel, objects); @@ -1203,12 +1203,12 @@ void SPDocument::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) SPObject *SPDocument::getObjectByRepr(Inkscape::XML::Node *repr) const { - g_return_val_if_fail(repr != NULL, NULL); + g_return_val_if_fail(repr != nullptr, NULL); std::map<Inkscape::XML::Node *, SPObject *>::iterator rv = priv->reprdef.find(repr); if(rv != priv->reprdef.end()) return (rv->second); else - return NULL; + return nullptr; } Glib::ustring SPDocument::getLanguage() const @@ -1221,25 +1221,25 @@ Glib::ustring SPDocument::getLanguage() const if ( !document_language || 0 == *document_language) { // retrieve system language document_language = getenv("LC_ALL"); - if ( NULL == document_language || *document_language == 0 ) { + if ( nullptr == document_language || *document_language == 0 ) { document_language = getenv ("LC_MESSAGES"); } - if ( NULL == document_language || *document_language == 0 ) { + if ( nullptr == document_language || *document_language == 0 ) { document_language = getenv ("LANG"); } - if ( NULL == document_language || *document_language == 0 ) { + if ( nullptr == document_language || *document_language == 0 ) { document_language = getenv ("LANGUAGE"); } - if ( NULL != document_language ) { + if ( nullptr != document_language ) { const char *pos = strchr(document_language, '_'); - if ( NULL != pos ) { + if ( nullptr != pos ) { return Glib::ustring(document_language, pos - document_language); } } } - if ( NULL == document_language ) + if ( nullptr == document_language ) return Glib::ustring(); return document_language; } @@ -1250,11 +1250,11 @@ void SPDocument::requestModified() { if (!modified_id) { modified_id = g_idle_add_full(SP_DOCUMENT_UPDATE_PRIORITY, - sp_document_idle_handler, this, NULL); + sp_document_idle_handler, this, nullptr); } if (!rerouting_handler_id) { rerouting_handler_id = g_idle_add_full(SP_DOCUMENT_REROUTING_PRIORITY, - sp_document_rerouting_handler, this, NULL); + sp_document_rerouting_handler, this, nullptr); } } @@ -1433,7 +1433,7 @@ static bool item_is_in_group(SPItem *item, SPGroup *group) SPItem *SPDocument::getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, std::vector<SPItem*> const &list,Geom::Point const &p, bool take_insensitive) { g_return_val_if_fail(group, NULL); - SPItem *bottomMost = 0; + SPItem *bottomMost = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0); @@ -1446,7 +1446,7 @@ SPItem *SPDocument::getItemFromListAtPointBottom(unsigned int dkey, SPGroup *gro SPItem *item = SP_ITEM(&o); Inkscape::DrawingItem *arenaitem = item->get_arenaitem(dkey); arenaitem->drawing().update(); - if (arenaitem && arenaitem->pick(p, delta, 1) != NULL + if (arenaitem && arenaitem->pick(p, delta, 1) != nullptr && (take_insensitive || item->isVisibleAndUnlocked(dkey))) { if (find(list.begin(), list.end(), item) != list.end()) { bottomMost = item; @@ -1494,12 +1494,12 @@ upwards in z-order and returns what it has found so far (i.e. the found item is guaranteed to be lower than upto). Requires a list of nodes built by build_flat_item_list. */ -static SPItem *find_item_at_point(std::deque<SPItem*> *nodes, unsigned int dkey, Geom::Point const &p, SPItem* upto=NULL) +static SPItem *find_item_at_point(std::deque<SPItem*> *nodes, unsigned int dkey, Geom::Point const &p, SPItem* upto=nullptr) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0); - SPItem *seen = NULL; + SPItem *seen = nullptr; SPItem *child; bool seen_upto = (!upto); for (std::deque<SPItem*>::const_iterator i = nodes->begin(); i != nodes->end(); ++i) { @@ -1512,7 +1512,7 @@ static SPItem *find_item_at_point(std::deque<SPItem*> *nodes, unsigned int dkey, Inkscape::DrawingItem *arenaitem = child->get_arenaitem(dkey); if (arenaitem) { arenaitem->drawing().update(); - if (arenaitem->pick(p, delta, 1) != NULL) { + if (arenaitem->pick(p, delta, 1) != nullptr) { seen = child; break; } @@ -1528,7 +1528,7 @@ p, or NULL if none. Recurses into layers but not into groups. */ static SPItem *find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const &p) { - SPItem *seen = NULL; + SPItem *seen = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0); @@ -1550,7 +1550,7 @@ static SPItem *find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Poin } // seen remembers the last (topmost) of groups pickable at this point - if (arenaitem && arenaitem->pick(p, delta, 1) != NULL) { + if (arenaitem && arenaitem->pick(p, delta, 1) != nullptr) { seen = child; } } @@ -1567,7 +1567,7 @@ static SPItem *find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Poin std::vector<SPItem*> SPDocument::getItemsInBox(unsigned int dkey, Geom::Rect const &box, bool take_insensitive, bool into_groups) const { std::vector<SPItem*> x; - g_return_val_if_fail(this->priv != NULL, x); + g_return_val_if_fail(this->priv != nullptr, x); return find_items_in_area(x, SP_GROUP(this->root), dkey, box, is_within, take_insensitive, into_groups); } @@ -1581,7 +1581,7 @@ std::vector<SPItem*> SPDocument::getItemsInBox(unsigned int dkey, Geom::Rect con std::vector<SPItem*> SPDocument::getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box, bool take_insensitive, bool into_groups) const { std::vector<SPItem*> x; - g_return_val_if_fail(this->priv != NULL, x); + g_return_val_if_fail(this->priv != nullptr, x); return find_items_in_area(x, SP_GROUP(this->root), dkey, box, overlaps, take_insensitive, into_groups); } @@ -1604,7 +1604,7 @@ std::vector<SPItem*> SPDocument::getItemsAtPoints(unsigned const key, std::vecto } SPObject *current_layer = SP_ACTIVE_DESKTOP->currentLayer(); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Inkscape::LayerModel *layer_model = NULL; + Inkscape::LayerModel *layer_model = nullptr; if(desktop){ layer_model = desktop->layers; } @@ -1632,7 +1632,7 @@ std::vector<SPItem*> SPDocument::getItemsAtPoints(unsigned const key, std::vecto SPItem *SPDocument::getItemAtPoint( unsigned const key, Geom::Point const &p, bool const into_groups, SPItem *upto) const { - g_return_val_if_fail(this->priv != NULL, NULL); + g_return_val_if_fail(this->priv != nullptr, NULL); // Build a flattened SVG DOM for find_item_at_point. std::deque<SPItem*> bak(_node_cache); @@ -1654,7 +1654,7 @@ SPItem *SPDocument::getItemAtPoint( unsigned const key, Geom::Point const &p, SPItem *SPDocument::getGroupAtPoint(unsigned int key, Geom::Point const &p) const { - g_return_val_if_fail(this->priv != NULL, NULL); + g_return_val_if_fail(this->priv != nullptr, NULL); return find_group_at_point(key, SP_GROUP(this->root), p); } @@ -1663,9 +1663,9 @@ SPItem *SPDocument::getGroupAtPoint(unsigned int key, Geom::Point const &p) cons bool SPDocument::addResource(gchar const *key, SPObject *object) { - g_return_val_if_fail(key != NULL, false); + g_return_val_if_fail(key != nullptr, false); g_return_val_if_fail(*key != '\0', false); - g_return_val_if_fail(object != NULL, false); + g_return_val_if_fail(object != nullptr, false); g_return_val_if_fail(SP_IS_OBJECT(object), false); bool result = false; @@ -1694,9 +1694,9 @@ bool SPDocument::addResource(gchar const *key, SPObject *object) bool SPDocument::removeResource(gchar const *key, SPObject *object) { - g_return_val_if_fail(key != NULL, false); + g_return_val_if_fail(key != nullptr, false); g_return_val_if_fail(*key != '\0', false); - g_return_val_if_fail(object != NULL, false); + g_return_val_if_fail(object != nullptr, false); g_return_val_if_fail(SP_IS_OBJECT(object), false); bool result = false; @@ -1720,7 +1720,7 @@ bool SPDocument::removeResource(gchar const *key, SPObject *object) std::vector<SPObject *> const SPDocument::getResourceList(gchar const *key) const { std::vector<SPObject *> emptyset; - g_return_val_if_fail(key != NULL, emptyset); + g_return_val_if_fail(key != nullptr, emptyset); g_return_val_if_fail(*key != '\0', emptyset); return this->priv->resources[key]; diff --git a/src/document.h b/src/document.h index f235353cc..053137ffd 100644 --- a/src/document.h +++ b/src/document.h @@ -252,7 +252,7 @@ public: void fitToRect(Geom::Rect const &rect, bool with_margins = false); static SPDocument *createNewDoc(char const*uri, unsigned int keepalive, - bool make_new = false, SPDocument *parent=NULL ); + bool make_new = false, SPDocument *parent=nullptr ); static SPDocument *createNewDocFromMem(char const*buffer, int length, unsigned int keepalive); SPDocument *createChildDoc(std::string const &uri); @@ -287,7 +287,7 @@ public: const std::vector<SPObject *> getResourceList(char const *key) const; std::vector<SPItem*> getItemsInBox(unsigned int dkey, Geom::Rect const &box, bool take_insensitive = false, bool into_groups = false) const; std::vector<SPItem*> getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box, bool take_insensitive = false, bool into_groups = false) const; - SPItem *getItemAtPoint(unsigned int key, Geom::Point const &p, bool into_groups, SPItem *upto = NULL) const; + SPItem *getItemAtPoint(unsigned int key, Geom::Point const &p, bool into_groups, SPItem *upto = nullptr) const; std::vector<SPItem*> getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points, bool all_layers = true, size_t limit = 0) const ; SPItem *getGroupAtPoint(unsigned int key, Geom::Point const &p) const; diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp index 8401b2cc3..d709f60f9 100644 --- a/src/ege-color-prof-tracker.cpp +++ b/src/ege-color-prof-tracker.cpp @@ -119,13 +119,13 @@ void ege_color_prof_tracker_class_init( EgeColorProfTrackerClass* klass ) objClass->get_property = ege_color_prof_tracker_get_property; objClass->set_property = ege_color_prof_tracker_set_property; - klass->changed = 0; + klass->changed = nullptr; signals[CHANGED] = g_signal_new( "changed", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(EgeColorProfTrackerClass, changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); @@ -133,7 +133,7 @@ void ege_color_prof_tracker_class_init( EgeColorProfTrackerClass* klass ) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, - NULL, NULL, + nullptr, nullptr, sp_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, @@ -143,7 +143,7 @@ void ege_color_prof_tracker_class_init( EgeColorProfTrackerClass* klass ) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, - NULL, NULL, + nullptr, nullptr, sp_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, @@ -153,7 +153,7 @@ void ege_color_prof_tracker_class_init( EgeColorProfTrackerClass* klass ) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); @@ -166,14 +166,14 @@ void ege_color_prof_tracker_class_init( EgeColorProfTrackerClass* klass ) void ege_color_prof_tracker_init( EgeColorProfTracker* tracker ) { tracker->private_data = EGE_GET_PRIVATE( tracker ); - tracker->private_data->_target = 0; + tracker->private_data->_target = nullptr; tracker->private_data->_monitor = 0; } EgeColorProfTracker* ege_color_prof_tracker_new( GtkWidget* target ) { GObject* obj = (GObject*)g_object_new( EGE_COLOR_PROF_TRACKER_TYPE, - NULL ); + nullptr ); EgeColorProfTracker* tracker = EGE_COLOR_PROF_TRACKER( obj ); tracker->private_data->_target = target; @@ -184,8 +184,8 @@ EgeColorProfTracker* ege_color_prof_tracker_new( GtkWidget* target ) g_signal_connect( G_OBJECT(target), "screen-changed", G_CALLBACK( target_screen_changed_cb ), obj ); /* invoke the callbacks now to connect if the widget is already visible */ - target_hierarchy_changed_cb( target, 0, obj ); - target_screen_changed_cb( target, 0, obj ); + target_hierarchy_changed_cb( target, nullptr, obj ); + target_screen_changed_cb( target, nullptr, obj ); } else { abstract_trackers.push_back(tracker); @@ -202,7 +202,7 @@ EgeColorProfTracker* ege_color_prof_tracker_new( GtkWidget* target ) void ege_color_prof_tracker_get_profile( EgeColorProfTracker const * tracker, gpointer* ptr, guint* len ) { - gpointer dataPos = 0; + gpointer dataPos = nullptr; guint dataLen = 0; if (tracker) { if (tracker->private_data->_target ) { @@ -230,7 +230,7 @@ void ege_color_prof_tracker_get_profile( EgeColorProfTracker const * tracker, gp void ege_color_prof_tracker_get_profile_for( guint monitor, gpointer* ptr, guint* len ) { - gpointer dataPos = 0; + gpointer dataPos = nullptr; guint dataLen = 0; GdkDisplay *display = gdk_display_get_default(); GdkScreen *screen = gdk_display_get_default_screen(display); @@ -307,7 +307,7 @@ void track_screen( GdkScreen* screen, EgeColorProfTracker* tracker ) tracked_screen->trackers->push_back(tracker ); tracked_screen->profiles = g_ptr_array_new(); for ( int i = 0; i < numMonitors; i++ ) { - g_ptr_array_add( tracked_screen->profiles, 0 ); + g_ptr_array_add( tracked_screen->profiles, nullptr ); } g_signal_connect( G_OBJECT(screen), "size-changed", G_CALLBACK( screen_size_changed_cb ), tracker ); @@ -331,7 +331,7 @@ void target_finalized( gpointer data, GObject* where_the_object_was ) for (auto i = tracked_screen->trackers->begin(); i != tracked_screen->trackers->end(); ++i) { if ( (void*)((*i)->private_data->_target) == (void*)where_the_object_was ) { /* The tracked widget is now gone, remove it */ - (*i)->private_data->_target = 0; + (*i)->private_data->_target = nullptr; tracked_screen->trackers->erase(i); break; } @@ -418,7 +418,7 @@ void screen_size_changed_cb(GdkScreen* screen, gpointer user_data) if ( numMonitors > (gint)tracked_screen->profiles->len ) { for ( guint i = tracked_screen->profiles->len; i < (guint)numMonitors; i++ ) { - g_ptr_array_add( tracked_screen->profiles, 0 ); + g_ptr_array_add( tracked_screen->profiles, nullptr ); #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_DISPLAY (display) ) { gchar* name = g_strdup_printf( "_ICC_PROFILE_%d", i ); @@ -453,7 +453,7 @@ GdkFilterReturn x11_win_filter(GdkXEvent *xevent, if ( stat ) { GdkDisplay* display = gdk_x11_lookup_xdisplay(native->xproperty.display); if ( display ) { - GdkScreen* targetScreen = 0; + GdkScreen* targetScreen = nullptr; GdkScreen* sc = gdk_display_get_default_screen(display); if ( tmp.screen == GDK_SCREEN_XSCREEN(sc) ) { targetScreen = sc; @@ -476,7 +476,7 @@ void handle_property_change(GdkScreen* screen, const gchar* name) gint monitor = 0; Atom atom = XInternAtom(xdisplay, name, True); if ( strncmp("_ICC_PROFILE_", name, 13 ) == 0 ) { - gint64 tmp = g_ascii_strtoll(name + 13, NULL, 10); + gint64 tmp = g_ascii_strtoll(name + 13, nullptr, 10); if ( tmp != 0 && tmp != G_MAXINT64 && tmp != G_MININT64 ) { monitor = (gint)tmp; } @@ -487,7 +487,7 @@ void handle_property_change(GdkScreen* screen, const gchar* name) unsigned long size = 128 * 1042; unsigned long nitems = 0; unsigned long bytesAfter = 0; - unsigned char* prop = 0; + unsigned char* prop = nullptr; clear_profile( monitor ); @@ -500,7 +500,7 @@ void handle_property_change(GdkScreen* screen, const gchar* name) nitems = 0; if ( prop ) { XFree(prop); - prop = 0; + prop = nullptr; } if ( XGetWindowProperty( xdisplay, GDK_WINDOW_XID(gdk_screen_get_root_window(screen)), atom, 0, size, False, AnyPropertyType, @@ -513,7 +513,7 @@ void handle_property_change(GdkScreen* screen, const gchar* name) } } else { /* clear it */ - set_profile( monitor, 0, 0 ); + set_profile( monitor, nullptr, 0 ); } } else { g_warning("error loading profile property"); @@ -572,7 +572,7 @@ void add_x11_tracking_for_screen(GdkScreen* screen) g_free(name); } XFree(propArray); - propArray = 0; + propArray = nullptr; } } } @@ -591,16 +591,16 @@ void fire(gint monitor) static void clear_profile( guint monitor ) { if ( tracked_screen ) { - GByteArray* previous = 0; + GByteArray* previous = nullptr; for ( guint i = tracked_screen->profiles->len; i <= monitor; i++ ) { - g_ptr_array_add( tracked_screen->profiles, 0 ); + g_ptr_array_add( tracked_screen->profiles, nullptr ); } previous = (GByteArray*)g_ptr_array_index( tracked_screen->profiles, monitor ); if ( previous ) { g_byte_array_free( previous, TRUE ); } - tracked_screen->profiles->pdata[monitor] = 0; + tracked_screen->profiles->pdata[monitor] = nullptr; } } @@ -608,7 +608,7 @@ static void set_profile( guint monitor, const guint8* data, guint len ) { if ( tracked_screen ) { for ( guint i = tracked_screen->profiles->len; i <= monitor; i++ ) { - g_ptr_array_add( tracked_screen->profiles, 0 ); + g_ptr_array_add( tracked_screen->profiles, nullptr ); } GByteArray *previous = (GByteArray*)g_ptr_array_index( tracked_screen->profiles, monitor ); if ( previous ) { @@ -620,7 +620,7 @@ static void set_profile( guint monitor, const guint8* data, guint len ) newBytes = g_byte_array_append( newBytes, data, len ); tracked_screen->profiles->pdata[monitor] = newBytes; } else { - tracked_screen->profiles->pdata[monitor] = 0; + tracked_screen->profiles->pdata[monitor] = nullptr; } for (auto i:abstract_trackers) { diff --git a/src/event-log.cpp b/src/event-log.cpp index 41ab2f2d0..b12f286c6 100644 --- a/src/event-log.cpp +++ b/src/event-log.cpp @@ -169,7 +169,7 @@ EventLog::EventLog(SPDocument* document) : _priv(new EventLogPrivate()), _document (document), _event_list_store (Gtk::TreeStore::create(_columns)), - _curr_event_parent (NULL), + _curr_event_parent (nullptr), _notifications_blocked (false) { // add initial pseudo event @@ -185,7 +185,7 @@ EventLog::~EventLog() { _priv->clearEventList(_event_list_store); delete _priv; - _priv = 0; + _priv = nullptr; } void @@ -202,7 +202,7 @@ EventLog::notifyUndoEvent(Event* log) { // ...back up to the parent _curr_event = _curr_event->parent(); - _curr_event_parent = (iterator)NULL; + _curr_event_parent = (iterator)nullptr; } else { @@ -263,7 +263,7 @@ EventLog::notifyRedoEvent(Event* log) // ...and move to the next event at parent level _curr_event = _curr_event->parent(); - _curr_event_parent = (iterator)NULL; + _curr_event_parent = (iterator)nullptr; ++_curr_event; } @@ -309,7 +309,7 @@ EventLog::notifyUndoCommitEvent(Event* log) _priv->collapseRow(_event_list_store->get_path(_curr_event_parent)); } - _curr_event_parent = (iterator)(NULL); + _curr_event_parent = (iterator)(nullptr); } _curr_event = _last_event = curr_row; @@ -388,7 +388,7 @@ EventLog::updateUndoVerbs() EventLog::const_iterator EventLog::_getUndoEvent() const { - const_iterator undo_event = (const_iterator)NULL; + const_iterator undo_event = (const_iterator)nullptr; if( _curr_event != _event_list_store->children().begin() ) undo_event = _curr_event; return undo_event; @@ -397,7 +397,7 @@ EventLog::_getUndoEvent() const EventLog::const_iterator EventLog::_getRedoEvent() const { - const_iterator redo_event = (const_iterator)NULL; + const_iterator redo_event = (const_iterator)nullptr; if ( _curr_event != _last_event ) { diff --git a/src/extension/db.cpp b/src/extension/db.cpp index e885d3531..8d6ad7e0e 100644 --- a/src/extension/db.cpp +++ b/src/extension/db.cpp @@ -112,8 +112,8 @@ struct ModuleOutputCmp { void DB::register_ext (Extension *module) { - g_return_if_fail(module != NULL); - g_return_if_fail(module->get_id() != NULL); + g_return_if_fail(module != nullptr); + g_return_if_fail(module->get_id() != nullptr); // only add to list if it's a never-before-seen module bool add_to_list = @@ -134,8 +134,8 @@ DB::register_ext (Extension *module) void DB::unregister_ext (Extension * module) { - g_return_if_fail(module != NULL); - g_return_if_fail(module->get_id() != NULL); + g_return_if_fail(module != nullptr); + g_return_if_fail(module->get_id() != nullptr); // printf("Extension DB: removing %s\n", module->get_id()); moduledict.erase(moduledict.find(module->get_id())); @@ -157,11 +157,11 @@ DB::unregister_ext (Extension * module) Extension * DB::get (const gchar *key) { - if (key == NULL) return NULL; + if (key == nullptr) return nullptr; Extension *mod = moduledict[key]; if ( !mod || mod->deactivated() ) - return NULL; + return nullptr; return mod; } diff --git a/src/extension/db.h b/src/extension/db.h index 0014f4449..73e735ac0 100644 --- a/src/extension/db.h +++ b/src/extension/db.h @@ -36,9 +36,9 @@ private: to find the different extensions in the hash map. */ struct ltstr { bool operator()(const char* s1, const char* s2) const { - if ( (s1 == NULL) && (s2 != NULL) ) { + if ( (s1 == nullptr) && (s2 != nullptr) ) { return true; - } else if (s1 == NULL || s2 == NULL) { + } else if (s1 == nullptr || s2 == nullptr) { return false; } else { return strcmp(s1, s2) < 0; diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 5e843ee11..07462e5e7 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -51,20 +51,20 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) _type = TYPE_FILE; _location = LOCATION_PATH; _repr = in_repr; - _string = NULL; - _description = NULL; + _string = nullptr; + _description = nullptr; Inkscape::GC::anchor(_repr); if (const gchar * location = _repr->attribute("location")) { - for (int i = 0; i < LOCATION_CNT && location != NULL; i++) { + for (int i = 0; i < LOCATION_CNT && location != nullptr; i++) { if (!strcmp(location, _location_str[i])) { _location = (location_t)i; break; } } } else if (const gchar * location = _repr->attribute("reldir")) { - for (int i = 0; i < LOCATION_CNT && location != NULL; i++) { + for (int i = 0; i < LOCATION_CNT && location != nullptr; i++) { if (!strcmp(location, _location_str[i])) { _location = (location_t)i; break; @@ -73,7 +73,7 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) } const gchar * type = _repr->attribute("type"); - for (int i = 0; i < TYPE_CNT && type != NULL; i++) { + for (int i = 0; i < TYPE_CNT && type != nullptr; i++) { if (!strcmp(type, _type_str[i])) { _type = (type_t)i; break; @@ -83,7 +83,7 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) _string = _repr->firstChild()->content(); _description = _repr->attribute("description"); - if (_description == NULL) + if (_description == nullptr) _description = _repr->attribute("_description"); return; @@ -133,12 +133,12 @@ bool Dependency::check (void) const { // std::cout << "Checking: " << *this << std::endl; - if (_string == NULL) return FALSE; + if (_string == nullptr) return FALSE; switch (_type) { case TYPE_EXTENSION: { Extension * myext = db.get(_string); - if (myext == NULL) return FALSE; + if (myext == nullptr) return FALSE; if (myext->deactivated()) return FALSE; break; } @@ -171,7 +171,7 @@ bool Dependency::check (void) const default: { gchar * path = g_strdup(g_getenv("PATH")); - if (path == NULL) { + if (path == nullptr) { /* There is no `PATH' in the environment. The default search path is the current directory */ path = g_strdup(G_SEARCHPATH_SEPARATOR_S); @@ -179,7 +179,7 @@ bool Dependency::check (void) const gchar * orig_path = path; - for (; path != NULL;) { + for (; path != nullptr;) { gchar * local_path; // to have the path after detection of the separator Glib::ustring final_name; @@ -188,7 +188,7 @@ bool Dependency::check (void) const /* Not sure whether this is UTF8 happy, but it would seem like it considering that I'm searching (and finding) the ':' character */ - if (path != NULL) { + if (path != nullptr) { path[0] = '\0'; path++; } @@ -255,7 +255,7 @@ operator<< (std::ostream &out_file, const Dependency & in_dep) out_file << _(" location: ") << _(in_dep._location_str[in_dep._location]) << '\n'; out_file << _(" string: ") << in_dep._string << '\n'; - if (in_dep._description != NULL) { + if (in_dep._description != nullptr) { out_file << _(" description: ") << _(in_dep._description) << '\n'; } diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 0a9b56ed6..8be5287a2 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -26,9 +26,9 @@ namespace Inkscape { namespace Extension { -Effect * Effect::_last_effect = NULL; -Inkscape::XML::Node * Effect::_effects_list = NULL; -Inkscape::XML::Node * Effect::_filters_list = NULL; +Effect * Effect::_last_effect = nullptr; +Inkscape::XML::Node * Effect::_effects_list = nullptr; +Inkscape::XML::Node * Effect::_filters_list = nullptr; #define EFFECTS_LIST "effects-list" #define FILTERS_LIST "filters-list" @@ -37,12 +37,12 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * : Extension(in_repr, in_imp), _id_noprefs(Glib::ustring(get_id()) + ".noprefs"), _name_noprefs(Glib::ustring(_(get_name())) + _(" (No preferences)")), - _verb(get_id(), get_name(), NULL, NULL, this, true), - _verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), NULL, NULL, this, false), - _menu_node(NULL), _workingDialog(true), - _prefDialog(NULL) + _verb(get_id(), get_name(), nullptr, nullptr, this, true), + _verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), nullptr, nullptr, this, false), + _menu_node(nullptr), _workingDialog(true), + _prefDialog(nullptr) { - Inkscape::XML::Node * local_effects_menu = NULL; + Inkscape::XML::Node * local_effects_menu = nullptr; // This is a weird hack if (!strcmp(this->get_id(), "org.inkscape.filter.dropshadow")) @@ -53,9 +53,9 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * no_doc = false; no_live_preview = false; - if (repr != NULL) { + if (repr != nullptr) { - for (Inkscape::XML::Node *child = repr->firstChild(); child != NULL; child = child->next()) { + for (Inkscape::XML::Node *child = repr->firstChild(); child != nullptr; child = child->next()) { if (!strcmp(child->name(), INKSCAPE_EXTENSION_NS "effect")) { if (child->attribute("needs-document") && !strcmp(child->attribute("needs-document"), "false")) { no_doc = true; @@ -63,7 +63,7 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * if (child->attribute("needs-live-preview") && !strcmp(child->attribute("needs-live-preview"), "false")) { no_live_preview = true; } - for (Inkscape::XML::Node *effect_child = child->firstChild(); effect_child != NULL; effect_child = effect_child->next()) { + for (Inkscape::XML::Node *effect_child = child->firstChild(); effect_child != nullptr; effect_child = effect_child->next()) { if (!strcmp(effect_child->name(), INKSCAPE_EXTENSION_NS "effects-menu")) { // printf("Found local effects menu in %s\n", this->get_name()); local_effects_menu = effect_child->firstChild(); @@ -90,13 +90,13 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * // \TODO this gets called from the Inkscape::Application constructor, where it initializes the menus. // But in the constructor, our object isn't quite there yet! if (Inkscape::Application::exists() && INKSCAPE.use_gui()) { - if (_effects_list == NULL) + if (_effects_list == nullptr) _effects_list = find_menu(INKSCAPE.get_menus(), EFFECTS_LIST); - if (_filters_list == NULL) + if (_filters_list == nullptr) _filters_list = find_menu(INKSCAPE.get_menus(), FILTERS_LIST); } - if ((_effects_list != NULL || _filters_list != NULL)) { + if ((_effects_list != nullptr || _filters_list != nullptr)) { Inkscape::XML::Document *xml_doc; xml_doc = _effects_list->document(); _menu_node = xml_doc->createElement("verb"); @@ -123,22 +123,22 @@ Effect::merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * pattern, Inkscape::XML::Node * merge) { Glib::ustring mergename; - Inkscape::XML::Node * tomerge = NULL; - Inkscape::XML::Node * submenu = NULL; + Inkscape::XML::Node * tomerge = nullptr; + Inkscape::XML::Node * submenu = nullptr; /* printf("Merge menu with '%s' '%s' '%s'\n", base != NULL ? base->name() : "NULL", pattern != NULL ? pattern->name() : "NULL", merge != NULL ? merge->name() : "NULL"); */ - if (pattern == NULL) { + if (pattern == nullptr) { // Merge the verb name tomerge = merge; mergename = _(this->get_name()); } else { gchar const * menuname = pattern->attribute("name"); - if (menuname == NULL) menuname = pattern->attribute("_name"); - if (menuname == NULL) return; + if (menuname == nullptr) menuname = pattern->attribute("_name"); + if (menuname == nullptr) return; Inkscape::XML::Document *xml_doc; xml_doc = base->document(); @@ -150,28 +150,28 @@ Effect::merge_menu (Inkscape::XML::Node * base, int position = -1; - if (start != NULL) { + if (start != nullptr) { Inkscape::XML::Node * menupass; - for (menupass = start; menupass != NULL && strcmp(menupass->name(), "separator"); menupass = menupass->next()) { - gchar const * compare_char = NULL; + for (menupass = start; menupass != nullptr && strcmp(menupass->name(), "separator"); menupass = menupass->next()) { + gchar const * compare_char = nullptr; if (!strcmp(menupass->name(), "verb")) { gchar const * verbid = menupass->attribute("verb-id"); Inkscape::Verb * verb = Inkscape::Verb::getbyid(verbid); - if (verb == NULL) { + if (verb == nullptr) { g_warning("Unable to find verb '%s' which is referred to in the menus.", verbid); continue; } compare_char = verb->get_name(); } else if (!strcmp(menupass->name(), "submenu")) { compare_char = menupass->attribute("name"); - if (compare_char == NULL) + if (compare_char == nullptr) compare_char = menupass->attribute("_name"); } position = menupass->position() + 1; /* This will cause us to skip tags we don't understand */ - if (compare_char == NULL) { + if (compare_char == nullptr) { continue; } @@ -179,7 +179,7 @@ Effect::merge_menu (Inkscape::XML::Node * base, if (mergename == compare) { Inkscape::GC::release(tomerge); - tomerge = NULL; + tomerge = nullptr; submenu = menupass; break; } @@ -191,15 +191,15 @@ Effect::merge_menu (Inkscape::XML::Node * base, } // for menu items } // start != NULL - if (tomerge != NULL) { + if (tomerge != nullptr) { base->appendChild(tomerge); Inkscape::GC::release(tomerge); if (position != -1) tomerge->setPosition(position); } - if (pattern != NULL) { - if (submenu == NULL) + if (pattern != nullptr) { + if (submenu == nullptr) submenu = tomerge; merge_menu(submenu, submenu->firstChild(), pattern->firstChild(), merge); } @@ -210,7 +210,7 @@ Effect::merge_menu (Inkscape::XML::Node * base, Effect::~Effect (void) { if (get_last_effect() == this) - set_last_effect(NULL); + set_last_effect(nullptr); if (_menu_node) Inkscape::GC::release(_menu_node); return; @@ -222,9 +222,9 @@ Effect::check (void) if (!Extension::check()) { /** \todo Check to see if parent has this as its only child, if so, delete it too */ - if (_menu_node != NULL) + if (_menu_node != nullptr) sp_repr_unparent(_menu_node); - _menu_node = NULL; + _menu_node = nullptr; return false; } return true; @@ -233,7 +233,7 @@ Effect::check (void) bool Effect::prefs (Inkscape::UI::View::View * doc) { - if (_prefDialog != NULL) { + if (_prefDialog != nullptr) { _prefDialog->raise(); return true; } @@ -247,7 +247,7 @@ Effect::prefs (Inkscape::UI::View::View * doc) set_state(Extension::STATE_LOADED); if (!loaded()) return false; - _prefDialog = new PrefDialog(this->get_name(), this->get_help(), NULL, this); + _prefDialog = new PrefDialog(this->get_name(), this->get_help(), nullptr, this); _prefDialog->show(); return true; @@ -312,12 +312,12 @@ Effect::set_last_effect (Effect * in_effect) if (strncmp(verb_id, help_id_prefix, strlen(help_id_prefix)) == 0) return; } - if (in_effect == NULL) { - Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(NULL, false); - Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(NULL, false); - } else if (_last_effect == NULL) { - Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(NULL, true); - Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(NULL, true); + if (in_effect == nullptr) { + Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(nullptr, false); + Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(nullptr, false); + } else if (_last_effect == nullptr) { + Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(nullptr, true); + Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(nullptr, true); } _last_effect = in_effect; @@ -327,21 +327,21 @@ Effect::set_last_effect (Effect * in_effect) Inkscape::XML::Node * Effect::find_menu (Inkscape::XML::Node * menustruct, const gchar *name) { - if (menustruct == NULL) return NULL; + if (menustruct == nullptr) return nullptr; for (Inkscape::XML::Node * child = menustruct; - child != NULL; + child != nullptr; child = child->next()) { if (!strcmp(child->name(), name)) { return child; } Inkscape::XML::Node * firstchild = child->firstChild(); - if (firstchild != NULL) { + if (firstchild != nullptr) { Inkscape::XML::Node *found = find_menu (firstchild, name); if (found) return found; } } - return NULL; + return nullptr; } @@ -380,7 +380,7 @@ Effect::EffectVerb::perform( SPAction *action, void * data ) Effect::EffectVerb * ev = reinterpret_cast<Effect::EffectVerb *>(data); Effect * effect = ev->_effect; - if (effect == NULL) return; + if (effect == nullptr) return; if (ev->_showPrefs) { effect->prefs(current_view); diff --git a/src/extension/effect.h b/src/extension/effect.h index a0f478978..5481d420a 100644 --- a/src/extension/effect.h +++ b/src/extension/effect.h @@ -70,10 +70,10 @@ class Effect : public Extension { Verb(id, _(name), _(tip), image, _("Extensions")), _effect(effect), _showPrefs(showPrefs), - _elip_name(NULL) { + _elip_name(nullptr) { /* No clue why, but this is required */ this->set_default_sensitive(true); - if (_showPrefs && effect != NULL && effect->param_visible_count() != 0) { + if (_showPrefs && effect != nullptr && effect->param_visible_count() != 0) { _elip_name = g_strdup_printf("%s...", _(name)); set_name(_elip_name); } @@ -81,7 +81,7 @@ class Effect : public Extension { /** \brief Destructor */ ~EffectVerb() override { - if (_elip_name != NULL) { + if (_elip_name != nullptr) { g_free(_elip_name); } } diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 0c979660d..0e0688f44 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -46,8 +46,8 @@ namespace Extension { */ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Implementation::ImplementationDocumentCache * docCache, bool show_working, bool show_errors) : _state(ExecutionEnv::INIT), - _visibleDialog(NULL), - _mainloop(NULL), + _visibleDialog(nullptr), + _mainloop(nullptr), _doc(doc), _docCache(docCache), _effect(effect), @@ -64,10 +64,10 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp Destroys the dialog if created and the document cache. */ ExecutionEnv::~ExecutionEnv (void) { - if (_visibleDialog != NULL) { + if (_visibleDialog != nullptr) { _visibleDialog->hide(); delete _visibleDialog; - _visibleDialog = NULL; + _visibleDialog = nullptr; } killDocCache(); return; @@ -80,7 +80,7 @@ ExecutionEnv::~ExecutionEnv (void) { */ void ExecutionEnv::genDocCache (void) { - if (_docCache == NULL) { + if (_docCache == nullptr) { // printf("Gen Doc Cache\n"); _docCache = _effect->get_imp()->newDocCache(_effect, _doc); } @@ -93,10 +93,10 @@ ExecutionEnv::genDocCache (void) { */ void ExecutionEnv::killDocCache (void) { - if (_docCache != NULL) { + if (_docCache != nullptr) { // printf("Killed Doc Cache\n"); delete _docCache; - _docCache = NULL; + _docCache = nullptr; } return; } @@ -108,10 +108,10 @@ ExecutionEnv::killDocCache (void) { */ void ExecutionEnv::createWorkingDialog (void) { - if (_visibleDialog != NULL) { + if (_visibleDialog != nullptr) { _visibleDialog->hide(); delete _visibleDialog; - _visibleDialog = NULL; + _visibleDialog = nullptr; } SPDesktop *desktop = (SPDesktop *)_doc; diff --git a/src/extension/execution-env.h b/src/extension/execution-env.h index f75e97efa..5ae7beb42 100644 --- a/src/extension/execution-env.h +++ b/src/extension/execution-env.h @@ -78,7 +78,7 @@ public: */ ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, - Implementation::ImplementationDocumentCache * docCache = NULL, + Implementation::ImplementationDocumentCache * docCache = nullptr, bool show_working = true, bool show_errors = true); virtual ~ExecutionEnv (void); diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index f07d334af..55b5f68fc 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -54,29 +54,29 @@ std::ofstream Extension::error_file; a name and an ID the module will be left in an errored state. */ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) - : _help(NULL) + : _help(nullptr) , silent(false) , _gui(true) - , execution_env(NULL) + , execution_env(nullptr) { repr = in_repr; Inkscape::GC::anchor(in_repr); - id = NULL; - name = NULL; + id = nullptr; + name = nullptr; _state = STATE_UNLOADED; - if (in_imp == NULL) { + if (in_imp == nullptr) { imp = new Implementation::Implementation(); } else { imp = in_imp; } // printf("Extension Constructor: "); - if (repr != NULL) { + if (repr != nullptr) { Inkscape::XML::Node *child_repr = repr->firstChild(); /* TODO: Handle what happens if we don't have these two */ - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -96,14 +96,14 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat if (!strcmp(chname, "param") || !strcmp(chname, "_param")) { Parameter * param; param = Parameter::make(child_repr, this); - if (param != NULL) + if (param != nullptr) parameters.push_back(param); } /* param || _param */ if (!strcmp(chname, "dependency")) { _deps.push_back(new Dependency(child_repr)); } /* dependency */ if (!strcmp(chname, "script")) { - for (Inkscape::XML::Node *child = child_repr->firstChild(); child != NULL ; child = child->next()) { + for (Inkscape::XML::Node *child = child_repr->firstChild(); child != nullptr ; child = child->next()) { if (child->type() == Inkscape::XML::ELEMENT_NODE) { _deps.push_back(new Dependency(child)); break; @@ -119,7 +119,7 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat db.register_ext (this); } // printf("%s\n", name); - timer = NULL; + timer = nullptr; return; } @@ -142,7 +142,7 @@ Extension::~Extension (void) g_free(id); g_free(name); delete timer; - timer = NULL; + timer = nullptr; /** \todo Need to do parameters here */ // delete parameters: @@ -180,7 +180,7 @@ Extension::set_state (state_t in_state) if (imp->load(this)) _state = STATE_LOADED; - if (timer != NULL) { + if (timer != nullptr) { delete timer; } timer = new ExpirationTimer(this); @@ -191,17 +191,17 @@ Extension::set_state (state_t in_state) imp->unload(this); _state = STATE_UNLOADED; - if (timer != NULL) { + if (timer != nullptr) { delete timer; - timer = NULL; + timer = nullptr; } break; case STATE_DEACTIVATED: _state = STATE_DEACTIVATED; - if (timer != NULL) { + if (timer != nullptr) { delete timer; - timer = NULL; + timer = nullptr; } break; default: @@ -270,19 +270,19 @@ Extension::check (void) retval = false; } #endif - if (id == NULL) { + if (id == nullptr) { printFailure(Glib::ustring(_("an ID was not defined for it.")) + inx_failure); retval = false; } - if (name == NULL) { + if (name == nullptr) { printFailure(Glib::ustring(_("there was no name defined for it.")) + inx_failure); retval = false; } - if (repr == NULL) { + if (repr == nullptr) { printFailure(Glib::ustring(_("the XML description of it got lost.")) + inx_failure); retval = false; } - if (imp == NULL) { + if (imp == nullptr) { printFailure(Glib::ustring(_("no implementation was defined for the extension.")) + inx_failure); retval = false; } @@ -396,7 +396,7 @@ Extension::deactivated (void) Parameter *Extension::get_param(gchar const *name) { - if (name == NULL) { + if (name == nullptr) { throw Extension::param_not_exist(); } if (this->parameters.empty()) { @@ -653,7 +653,7 @@ void Extension::error_file_open (void) { gchar * ext_error_file = Inkscape::IO::Resource::log_path(EXTENSION_ERROR_LOG_FILENAME); - gchar * filename = g_filename_from_utf8( ext_error_file, -1, NULL, NULL, NULL ); + gchar * filename = g_filename_from_utf8( ext_error_file, -1, nullptr, nullptr, nullptr ); error_file.open(filename); if (!error_file.is_open()) { g_warning(_("Could not create extension error log file '%s'"), @@ -717,7 +717,7 @@ public: Gtk::Widget * Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { - if (!_gui || param_visible_count() == 0) return NULL; + if (!_gui || param_visible_count() == 0) return nullptr; AutoGUI * agui = Gtk::manage(new AutoGUI()); agui->set_border_width(Parameter::GUI_BOX_MARGIN); @@ -798,7 +798,7 @@ Extension::get_help_widget(void) { Gtk::VBox * retval = Gtk::manage(new Gtk::VBox()); - if (_help == NULL) { + if (_help == nullptr) { Gtk::Label * content = Gtk::manage(new Gtk::Label(_("Currently there is no help available for this Extension. Please look on the Inkscape website or ask on the mailing lists if you have questions regarding this extension."))); retval->pack_start(*content, true, true, 5); content->set_line_wrap(true); diff --git a/src/extension/extension.h b/src/extension/extension.h index d66399d59..e927e1431 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -204,16 +204,16 @@ private: public: bool get_param_bool (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr); int get_param_int (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr); float get_param_float (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr); /** * Gets a parameter identified by name with the string placed in value. @@ -226,60 +226,60 @@ public: * @return A constant pointer to the string held by the parameters. */ gchar const *get_param_string(gchar const *name, - SPDocument const *doc = NULL, - Inkscape::XML::Node const *node = NULL) const; + SPDocument const *doc = nullptr, + Inkscape::XML::Node const *node = nullptr) const; guint32 get_param_color (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL) const; + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr) const; const gchar * get_param_enum (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL) const; + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr) const; gchar const *get_param_optiongroup( gchar const * name, - SPDocument const * doc = 0, - Inkscape::XML::Node const * node = 0) const; + SPDocument const * doc = nullptr, + Inkscape::XML::Node const * node = nullptr) const; bool get_param_enum_contains(gchar const * name, gchar const * value, - SPDocument * doc = 0x0, - Inkscape::XML::Node * node = 0x0) const; + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr) const; bool set_param_bool (const gchar * name, bool value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); int set_param_int (const gchar * name, int value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); float set_param_float (const gchar * name, float value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); const gchar * set_param_string (const gchar * name, const gchar * value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); gchar const * set_param_optiongroup(gchar const * name, gchar const * value, - SPDocument * doc = 0, - Inkscape::XML::Node * node = 0); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); gchar const * set_param_enum (gchar const * name, gchar const * value, - SPDocument * doc = 0x0, - Inkscape::XML::Node * node = 0x0); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); guint32 set_param_color (const gchar * name, guint32 color, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); /* Error file handling */ public: @@ -287,7 +287,7 @@ public: static void error_file_close (void); public: - Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal = NULL); + Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal = nullptr); void paramListString (std::list <std::string> & retlist); void set_gui(bool s) { _gui = s; } diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 6e6100d2b..2a6a76ff4 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -29,24 +29,24 @@ namespace Implementation { Gtk::Widget * Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const */*filename*/) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } Gtk::Widget * Implementation::prefs_output(Inkscape::Extension::Output *module) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, ImplementationDocumentCache * /*docCache*/) { if (module->param_visible_count() == 0) { - return NULL; + return nullptr; } SPDocument * current_document = view->doc(); auto selected = ((SPDesktop *) view)->getSelection()->items(); - Inkscape::XML::Node const* first_select = NULL; + Inkscape::XML::Node const* first_select = nullptr; if (!selected.empty()) { const SPItem * item = selected.front(); first_select = item->getRepr(); diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index cf41e5517..52542064b 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -88,7 +88,7 @@ public: * @return A new document cache that is valid as long as the document * is not changed. */ - virtual ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*doc*/) { return NULL; } + virtual ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*doc*/) { return nullptr; } /** Verify any dependencies. */ virtual bool check(Inkscape::Extension::Extension * /*module*/) { return true; } @@ -103,7 +103,7 @@ public: gchar const *filename); virtual SPDocument *open(Inkscape::Extension::Input * /*module*/, - gchar const * /*filename*/) { return NULL; } + gchar const * /*filename*/) { return nullptr; } // ----- Output functions ----- /** Find out information about the file. */ diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 6b629934f..a8490fe73 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -93,7 +93,7 @@ Script::interpreter_t const Script::interpreterTab[] = { #endif {"ruby", "ruby-interpreter", "ruby" }, {"shell", "shell-interpreter", "sh" }, - { NULL, NULL, NULL } + { nullptr, nullptr, nullptr } }; @@ -105,7 +105,7 @@ Script::interpreter_t const Script::interpreterTab[] = { */ std::string Script::resolveInterpreterExecutable(const Glib::ustring &interpNameArg) { - interpreter_t const *interp = 0; + interpreter_t const *interp = nullptr; bool foundInterp = false; for (interp = interpreterTab ; interp->identity ; interp++ ){ if (interpNameArg == interp->identity) { @@ -156,7 +156,7 @@ std::string Script::resolveInterpreterExecutable(const Glib::ustring &interpName Script::Script() : Implementation() , _canceled(false) - , parent_window(NULL) + , parent_window(nullptr) { } @@ -294,12 +294,12 @@ bool Script::load(Inkscape::Extension::Extension *module) /* This should probably check to find the executable... */ Inkscape::XML::Node *child_repr = module->get_repr()->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "script")) { - for (child_repr = child_repr->firstChild(); child_repr != NULL; child_repr = child_repr->next()) { + for (child_repr = child_repr->firstChild(); child_repr != nullptr; child_repr = child_repr->next()) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "command")) { const gchar *interpretstr = child_repr->attribute("interpreter"); - if (interpretstr != NULL) { + if (interpretstr != nullptr) { std::string interpString = resolveInterpreterExecutable(interpretstr); if (interpString.empty()) { continue; // can't have a script extension with empty interpreter @@ -353,11 +353,11 @@ bool Script::check(Inkscape::Extension::Extension *module) { int script_count = 0; Inkscape::XML::Node *child_repr = module->get_repr()->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "script")) { script_count++; child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "check")) { std::string command_text = solve_reldir(child_repr); if (!command_text.empty()) { @@ -373,7 +373,7 @@ bool Script::check(Inkscape::Extension::Extension *module) if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "helper_extension")) { gchar const *helper = child_repr->firstChild()->content(); - if (Inkscape::Extension::db.get(helper) == NULL) { + if (Inkscape::Extension::db.get(helper) == nullptr) { return false; } } @@ -449,7 +449,7 @@ ImplementationDocumentCache *Script::newDocCache( Inkscape::Extension::Extension Gtk::Widget *Script::prefs_input(Inkscape::Extension::Input *module, const gchar */*filename*/) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } @@ -463,7 +463,7 @@ Gtk::Widget *Script::prefs_input(Inkscape::Extension::Input *module, */ Gtk::Widget *Script::prefs_output(Inkscape::Extension::Output *module) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } /** @@ -499,7 +499,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg"); } catch (...) { /// \todo Popup dialog here - return NULL; + return nullptr; } std::string lfilename = Glib::filename_from_utf8(filenameArg); @@ -508,7 +508,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, int data_read = execute(command, params, lfilename, fileout); fileout.toFile(tempfilename_out); - SPDocument * mydoc = NULL; + SPDocument * mydoc = nullptr; if (data_read > 10) { if (helper_extension.size()==0) { mydoc = Inkscape::Extension::open( @@ -521,8 +521,8 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, } } // data_read - if (mydoc != NULL) { - mydoc->setBase(0); + if (mydoc != nullptr) { + mydoc->setBase(nullptr); mydoc->changeUriAndHrefs(filenameArg); } @@ -646,15 +646,15 @@ void Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc, ImplementationDocumentCache * docCache) { - if (docCache == NULL) { + if (docCache == nullptr) { docCache = newDocCache(module, doc); } ScriptDocCache * dc = dynamic_cast<ScriptDocCache *>(docCache); - if (dc == NULL) { + if (dc == nullptr) { printf("TOO BAD TO LIVE!!!"); exit(1); } - if (doc == NULL) + if (doc == nullptr) { g_warning("Script::effect: View not defined"); return; @@ -709,7 +709,7 @@ void Script::effect(Inkscape::Extension::Effect *module, pump_events(); - SPDocument * mydoc = NULL; + SPDocument * mydoc = nullptr; if (data_read > 10) { try { mydoc = Inkscape::Extension::open( @@ -734,23 +734,23 @@ void Script::effect(Inkscape::Extension::Effect *module, if (mydoc) { SPDocument* vd=doc->doc(); - if (vd != NULL) + if (vd != nullptr) { vd->emitReconstructionStart(); copy_doc(vd->rroot, mydoc->rroot); vd->emitReconstructionFinish(); // Getting the named view from the document generated by the extension - SPNamedView *nv = sp_document_namedview(mydoc, NULL); + SPNamedView *nv = sp_document_namedview(mydoc, nullptr); //Check if it has a default layer set up - SPObject *layer = NULL; - if ( nv != NULL) + SPObject *layer = nullptr; + if ( nv != nullptr) { if( nv->default_layer_id != 0 ) { SPDocument *document = desktop->doc(); //If so, get that layer - if (document != NULL) + if (document != nullptr) { layer = document->getObjectById(g_quark_to_string(nv->default_layer_id)); } @@ -800,7 +800,7 @@ void Script::effect(Inkscape::Extension::Effect *module, */ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newroot) { - if ((oldroot == NULL) ||(newroot == NULL)) + if ((oldroot == nullptr) ||(newroot == nullptr)) { g_warning("Error on copy_doc: NULL pointer input."); return; @@ -822,7 +822,7 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr // Delete the attributes of the old root node. for (std::vector<gchar const *>::const_iterator it = attribs.begin(); it != attribs.end(); ++it) { - oldroot->setAttribute(*it, NULL); + oldroot->setAttribute(*it, nullptr); } // Set the new attributes. @@ -840,11 +840,11 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr // Make list for (Inkscape::XML::Node * child = oldroot->firstChild(); - child != NULL; + child != nullptr; child = child->next()) { if (!strcmp("sodipodi:namedview", child->name())) { for (Inkscape::XML::Node * oldroot_namedview_child = child->firstChild(); - oldroot_namedview_child != NULL; + oldroot_namedview_child != nullptr; oldroot_namedview_child = oldroot_namedview_child->next()) { delete_list.push_back(oldroot_namedview_child); } @@ -1014,7 +1014,7 @@ int Script::execute (const std::list<std::string> &in_command, static_cast<Glib::SpawnFlags>(0), // no flags sigc::slot<void>(), &_pid, // Pid - NULL, // STDIN + nullptr, // STDIN &stdout_pipe, // STDOUT &stderr_pipe); // STDERR } catch (Glib::Error &e) { diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index d11283db7..9e4a45483 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -48,8 +48,8 @@ namespace Implementation { XSLT::XSLT(void) : Implementation(), _filename(""), - _parsedDoc(NULL), - _stylesheet(NULL) + _parsedDoc(nullptr), + _stylesheet(nullptr) { } @@ -87,10 +87,10 @@ bool XSLT::load(Inkscape::Extension::Extension *module) if (module->loaded()) { return true; } Inkscape::XML::Node *child_repr = module->get_repr()->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "xslt")) { child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "file")) { _filename = solve_reldir(child_repr); } @@ -103,7 +103,7 @@ bool XSLT::load(Inkscape::Extension::Extension *module) } _parsedDoc = xmlParseFile(_filename.c_str()); - if (_parsedDoc == NULL) { return false; } + if (_parsedDoc == nullptr) { return false; } _stylesheet = xsltParseStylesheetDoc(_parsedDoc); @@ -122,10 +122,10 @@ SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) { xmlDocPtr filein = xmlParseFile(filename); - if (filein == NULL) { return NULL; } + if (filein == nullptr) { return nullptr; } const char * params[1]; - params[0] = NULL; + params[0] = nullptr; xmlDocPtr result = xsltApplyStylesheet(_stylesheet, filein, params); xmlFreeDoc(filein); @@ -133,17 +133,17 @@ SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/, Inkscape::XML::Document * rdoc = sp_repr_do_read( result, SP_SVG_NS_URI); xmlFreeDoc(result); - if (rdoc == NULL) { - return NULL; + if (rdoc == nullptr) { + return nullptr; } if (strcmp(rdoc->root()->name(), "svg:svg") != 0) { - return NULL; + return nullptr; } - gchar * base = NULL; - gchar * name = NULL; - gchar * s = NULL, * p = NULL; + gchar * base = nullptr; + gchar * name = nullptr; + gchar * s = nullptr, * p = nullptr; s = g_strdup(filename); p = strrchr(s, '/'); if (p) { @@ -151,12 +151,12 @@ SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/, p[1] = '\0'; base = g_strdup(s); } else { - base = NULL; + base = nullptr; name = g_strdup(filename); } g_free(s); - SPDocument * doc = SPDocument::createDoc(rdoc, filename, base, name, true, NULL); + SPDocument * doc = SPDocument::createDoc(rdoc, filename, base, name, true, nullptr); g_free(base); g_free(name); @@ -167,8 +167,8 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons { /* TODO: Should we assume filename to be in utf8 or to be a raw filename? * See JavaFXOutput::save for discussion. */ - g_return_if_fail(doc != NULL); - g_return_if_fail(filename != NULL); + g_return_if_fail(doc != nullptr); + g_return_if_fail(filename != nullptr); Inkscape::XML::Node *repr = doc->getReprRoot(); @@ -188,7 +188,7 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons xmlDocPtr svgdoc = xmlParseFile(tempfilename_out.c_str()); close(tempfd_out); - if (svgdoc == NULL) { + if (svgdoc == nullptr) { return; } @@ -207,7 +207,7 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons xslt_params[count++] = g_strdup_printf("%s", parameter.str().c_str()); xslt_params[count++] = g_strdup_printf("'%s'", value.str().c_str()); } - xslt_params[count] = NULL; + xslt_params[count] = nullptr; xmlDocPtr newdoc = xsltApplyStylesheet(_stylesheet, svgdoc, xslt_params); //xmlSaveFile(filename, newdoc); diff --git a/src/extension/init.cpp b/src/extension/init.cpp index 17c07ae1d..d0487d473 100644 --- a/src/extension/init.cpp +++ b/src/extension/init.cpp @@ -260,7 +260,7 @@ check_extensions_internal(Extension *in_plug, gpointer in_data) { int *count = (int *)in_data; - if (in_plug == NULL) return; + if (in_plug == nullptr) return; if (!in_plug->deactivated() && !in_plug->check()) { in_plug->deactivate(); (*count)++; diff --git a/src/extension/input.cpp b/src/extension/input.cpp index 862d4a4d3..3fb330998 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -38,21 +38,21 @@ namespace Extension { */ Input::Input (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : Extension(in_repr, in_imp) { - mimetype = NULL; - extension = NULL; - filetypename = NULL; - filetypetooltip = NULL; - output_extension = NULL; + mimetype = nullptr; + extension = nullptr; + filetypename = nullptr; + filetypetooltip = nullptr; + output_extension = nullptr; - if (repr != NULL) { + if (repr != nullptr) { Inkscape::XML::Node * child_repr; child_repr = repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "input")) { child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -119,9 +119,9 @@ Input::~Input (void) bool Input::check (void) { - if (extension == NULL) + if (extension == nullptr) return FALSE; - if (mimetype == NULL) + if (mimetype == nullptr) return FALSE; return Extension::check(); @@ -144,7 +144,7 @@ Input::open (const gchar *uri) set_state(Extension::STATE_LOADED); } if (!loaded()) { - return NULL; + return nullptr; } timer->touch(); @@ -184,7 +184,7 @@ Input::get_extension(void) gchar * Input::get_filetypename(void) { - if (filetypename != NULL) + if (filetypename != nullptr) return filetypename; else return get_name(); @@ -218,7 +218,7 @@ Input::prefs (const gchar *uri) Gtk::Widget * controls; controls = imp->prefs_input(this, uri); - if (controls == NULL) { + if (controls == nullptr) { // std::cout << "No preferences for Input" << std::endl; return true; } diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index f04007d00..808023c7c 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -96,10 +96,10 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View /* Doing an inset here folks */ offset *= -1.0; prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); - sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(Inkscape::ActionContext(desktop)), NULL); + sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(Inkscape::ActionContext(desktop)), nullptr); } else if (offset > 0.0) { prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); - sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(Inkscape::ActionContext(desktop)), NULL); + sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(Inkscape::ActionContext(desktop)), nullptr); } selection->clear(); @@ -119,7 +119,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View Gtk::Widget * BlurEdge::prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * /*view*/, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { - return module->autogui(NULL, NULL, changeSignal); + return module->autogui(nullptr, nullptr, changeSignal); } #include "clear-n_.h" diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index 3cdbee8c1..c3261fdce 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -66,7 +66,7 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) ctx = renderer->createContext(); /* Render document */ - bool ret = renderer->setupDocument(ctx, doc, TRUE, 0., NULL); + bool ret = renderer->setupDocument(ctx, doc, TRUE, 0., nullptr); if (ret) { renderer->renderItem(ctx, base); ctx->saveAsPng(filename); diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 287cf636f..9815088de 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -46,7 +46,7 @@ namespace Internal { bool CairoPsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) { + if (nullptr == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) { return FALSE; } else { return TRUE; @@ -55,7 +55,7 @@ bool CairoPsOutput::check (Inkscape::Extension::Extension * /*module*/) bool CairoEpsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) { + if (nullptr == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) { return FALSE; } else { return TRUE; @@ -68,7 +68,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l { doc->ensureUpToDate(); - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = TRUE; if (exportId && strcmp(exportId, "")) { @@ -134,13 +134,13 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con unsigned int ret; ext = Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS); - if (ext == NULL) + if (ext == nullptr) return; int level = CAIRO_PS_LEVEL_2; try { const gchar *new_level = mod->get_param_enum("PSlevel"); - if((new_level != NULL) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { level = CAIRO_PS_LEVEL_3; } } catch(...) {} @@ -180,7 +180,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con bleedmargin_px = mod->get_param_float("bleed"); } catch(...) {} - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } catch(...) {} @@ -223,13 +223,13 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co unsigned int ret; ext = Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS); - if (ext == NULL) + if (ext == nullptr) return; int level = CAIRO_PS_LEVEL_2; try { const gchar *new_level = mod->get_param_enum("PSlevel"); - if((new_level != NULL) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { level = CAIRO_PS_LEVEL_3; } } catch(...) {} @@ -269,7 +269,7 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co bleedmargin_px = mod->get_param_float("bleed"); } catch(...) {} - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } catch(...) {} diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 23c20b968..36f73136b 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -119,15 +119,15 @@ CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _is_omittext(FALSE), _is_filtertobitmap(FALSE), _bitmapresolution(72), - _stream(NULL), + _stream(nullptr), _is_valid(FALSE), _vector_based_target(FALSE), - _cr(NULL), // Cairo context - _surface(NULL), + _cr(nullptr), // Cairo context + _surface(nullptr), _target(CAIRO_SURFACE_TYPE_IMAGE), _target_format(CAIRO_FORMAT_ARGB32), - _layout(NULL), - _state(NULL), + _layout(nullptr), + _state(nullptr), _renderer(parent), _render_mode(RENDER_MODE_NORMAL), _clip_mode(CLIP_MODE_MASK), @@ -251,12 +251,12 @@ bool CairoRenderContext::setPdfTarget(gchar const *utf8_fn) _vector_based_target = TRUE; #endif - FILE *osf = NULL; - FILE *osp = NULL; + FILE *osf = nullptr; + FILE *osp = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError *error = NULL; + GError *error = nullptr; gchar *local_fn = g_filename_from_utf8(utf8_fn, -1, &bytesRead, &bytesWritten, &error); gchar const *fn = local_fn; @@ -266,7 +266,7 @@ bool CairoRenderContext::setPdfTarget(gchar const *utf8_fn) * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { if (*fn == '|') { fn += 1; while (isspace(*fn)) fn += 1; @@ -333,12 +333,12 @@ bool CairoRenderContext::setPsTarget(gchar const *utf8_fn) _vector_based_target = TRUE; #endif - FILE *osf = NULL; - FILE *osp = NULL; + FILE *osf = nullptr; + FILE *osp = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError *error = NULL; + GError *error = nullptr; gchar *local_fn = g_filename_from_utf8(utf8_fn, -1, &bytesRead, &bytesWritten, &error); gchar const *fn = local_fn; @@ -348,7 +348,7 @@ bool CairoRenderContext::setPsTarget(gchar const *utf8_fn) * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { if (*fn == '|') { fn += 1; while (isspace(*fn)) fn += 1; @@ -522,7 +522,7 @@ CairoRenderContext::getClipMode(void) const CairoRenderState* CairoRenderContext::_createState(void) { CairoRenderState *state = static_cast<CairoRenderState*>(g_try_malloc(sizeof(CairoRenderState))); - g_assert( state != NULL ); + g_assert( state != nullptr ); state->has_filtereffect = FALSE; state->merge_opacity = TRUE; @@ -530,8 +530,8 @@ CairoRenderState* CairoRenderContext::_createState(void) state->need_layer = FALSE; state->has_overflow = FALSE; state->parent_has_userspace = FALSE; - state->clip_path = NULL; - state->mask = NULL; + state->clip_path = nullptr; + state->mask = nullptr; return state; } @@ -579,14 +579,14 @@ CairoRenderContext::popLayer(void) SPMask *mask = _state->mask; if (clip_path || mask) { - CairoRenderContext *clip_ctx = 0; - cairo_surface_t *clip_mask = 0; + CairoRenderContext *clip_ctx = nullptr; + cairo_surface_t *clip_mask = nullptr; // Apply any clip path first if (clip_path) { TRACE((" Applying clip\n")); if (_render_mode == RENDER_MODE_CLIP) - mask = NULL; // disable mask when performing nested clipping + mask = nullptr; // disable mask when performing nested clipping if (_vector_based_target) { setClipMode(CLIP_MODE_PATH); // Vector @@ -783,7 +783,7 @@ CairoRenderContext::setupSurface(double width, double height) if (_is_valid) return true; - if (_vector_based_target && _stream == NULL) + if (_vector_based_target && _stream == nullptr) return false; _width = width; @@ -796,7 +796,7 @@ CairoRenderContext::setupSurface(double width, double height) os_bbox << "%%BoundingBox: 0 0 " << (int)ceil(width) << (int)ceil(height); // apparently, the numbers should be integers. (see bug 380501) os_pagebbox << "%%PageBoundingBox: 0 0 " << (int)ceil(width) << (int)ceil(height); - cairo_surface_t *surface = NULL; + cairo_surface_t *surface = nullptr; cairo_matrix_t ctm; cairo_matrix_init_identity (&ctm); char buffer[25]; @@ -889,7 +889,7 @@ CairoRenderContext::setSurfaceTarget(cairo_surface_t *surface, bool is_vector, c bool CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm) { - if(surface == NULL) { + if(surface == nullptr) { return false; } if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { @@ -932,13 +932,13 @@ CairoRenderContext::finish(bool finish_surface) g_critical("error while rendering output: %s", cairo_status_to_string(status)); cairo_destroy(_cr); - _cr = NULL; + _cr = nullptr; if (finish_surface) cairo_surface_finish(_surface); status = cairo_surface_status(_surface); cairo_surface_destroy(_surface); - _surface = NULL; + _surface = nullptr; if (_layout) g_object_unref(_layout); @@ -950,7 +950,7 @@ CairoRenderContext::finish(bool finish_surface) (void) fflush(_stream); fclose(_stream); - _stream = NULL; + _stream = nullptr; } if (status == CAIRO_STATUS_SUCCESS) @@ -1133,7 +1133,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver unsigned dkey = SPItem::display_key_new(1); // show items and render them - for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = pat; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { @@ -1162,7 +1162,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver delete pattern_ctx; // hide all items - for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = pat; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { @@ -1257,7 +1257,7 @@ cairo_pattern_t* CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const paintserver, Geom::OptRect const &pbox, float alpha) { - cairo_pattern_t *pattern = NULL; + cairo_pattern_t *pattern = nullptr; bool apply_bbox2user = FALSE; if (SP_IS_LINEARGRADIENT (paintserver)) { @@ -1315,7 +1315,7 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain } else if ( dynamic_cast<SPHatch const *>(paintserver) ) { pattern = _createHatchPainter(paintserver, pbox); } else { - return NULL; + return nullptr; } if (pattern && SP_IS_GRADIENT(paintserver)) { @@ -1441,7 +1441,7 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, Geom::OptRect const &p cairo_set_dash(_cr, dashes, ndashes, style->stroke_dashoffset.value); free(dashes); } else { - cairo_set_dash(_cr, NULL, 0, 0.0); // disable dashing + cairo_set_dash(_cr, nullptr, 0, 0.0); // disable dashing } cairo_set_line_width(_cr, style->stroke_width.computed); @@ -1567,7 +1567,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con return true; bool need_layer = ( !_state->merge_opacity && !_state->need_layer && - ( _state->opacity != 1.0 || _state->clip_path != NULL || _state->mask != NULL ) ); + ( _state->opacity != 1.0 || _state->clip_path != nullptr || _state->mask != nullptr ) ); if (!need_layer) cairo_save(_cr); @@ -1689,7 +1689,7 @@ unsigned int CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont * /*font*/, unsigned int num_glyphs = glyphtext.size(); if (num_glyphs > GLYPH_ARRAY_SIZE) { glyphs = (cairo_glyph_t*)g_try_malloc(sizeof(cairo_glyph_t) * num_glyphs); - if(glyphs == NULL) { + if(glyphs == nullptr) { g_warning("CairorenderContext::_showGlyphs: can not allocate memory for %d glyphs.", num_glyphs); return 0; } @@ -1737,11 +1737,11 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma // create a cairo_font_face from PangoFont // double size = style->font_size.computed; /// \fixme why is this variable never used? gpointer fonthash = (gpointer)font; - cairo_font_face_t *font_face = NULL; + cairo_font_face_t *font_face = nullptr; if(font_table.find(fonthash)!=font_table.end()) font_face = font_table[fonthash]; - FcPattern *fc_pattern = NULL; + FcPattern *fc_pattern = nullptr; #ifdef USE_PANGO_WIN32 # ifdef CAIRO_HAS_WIN32_FONT @@ -1761,7 +1761,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma # ifdef CAIRO_HAS_FT_FONT PangoFcFont *fc_font = PANGO_FC_FONT(font); fc_pattern = fc_font->font_pattern; - if(font_face == NULL) { + if(font_face == nullptr) { font_face = cairo_ft_font_face_create_for_pattern(fc_pattern); font_table[fonthash] = font_face; } diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index 401b06885..2cefb297d 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -91,7 +91,7 @@ public: bool setPdfTarget(gchar const *utf8_fn); bool setPsTarget(gchar const *utf8_fn); /** Set the cairo_surface_t from an external source */ - bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm=NULL); + bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm=nullptr); void setPSLevel(unsigned int level); void setEPS(bool eps); @@ -215,7 +215,7 @@ protected: unsigned int _showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoGlyphInfo> const &glyphtext, bool is_stroke); - bool _finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm = NULL); + bool _finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm = nullptr); void _setFillStyle(SPStyle const *style, Geom::OptRect const &pbox); void _setStrokeStyle(SPStyle const *style, Geom::OptRect const &pbox); diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 5b9759c15..333c0eb42 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -49,7 +49,7 @@ bool CairoRendererPdfOutput::check(Inkscape::Extension::Extension * /*module*/) { bool result = true; - if (NULL == Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer")) { + if (nullptr == Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer")) { result = false; } @@ -65,7 +65,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int /* Start */ - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = TRUE; if (exportId && strcmp(exportId, "")) { @@ -136,13 +136,13 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, unsigned int ret; ext = Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer"); - if (ext == NULL) + if (ext == nullptr) return; int level = 0; try { const gchar *new_level = mod->get_param_enum("PDFversion"); - if((new_level != NULL) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) { level = 1; } } @@ -182,7 +182,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, g_warning("Parameter <resolution> might not exist"); } - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index b48be2ed7..05605a9d9 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -117,9 +117,9 @@ CairoRenderContext* CairoRenderer::createContext(void) { CairoRenderContext *new_context = new CairoRenderContext(this); - g_assert( new_context != NULL ); + g_assert( new_context != nullptr ); - new_context->_state = NULL; + new_context->_state = nullptr; // create initial render state CairoRenderState *state = new_context->_createState(); @@ -516,7 +516,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) SPDocument *document = item->document; std::unique_ptr<Inkscape::Pixbuf> pb( - sp_generate_internal_bitmap(document, NULL, + sp_generate_internal_bitmap(document, nullptr, bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y], width, height, res, res, (guint32) 0xffffff00, item )); @@ -653,7 +653,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page { // PLEASE note when making changes to the boundingbox and transform calculation, corresponding changes should be made to PDFLaTeXRenderer::setupDocument !!! - g_assert( ctx != NULL ); + g_assert( ctx != nullptr ); if (!base) { base = doc->getRoot(); @@ -710,9 +710,9 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page void CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) { - g_assert( ctx != NULL && ctx->_is_valid ); + g_assert( ctx != nullptr && ctx->_is_valid ); - if (cp == NULL) + if (cp == nullptr) return; CairoRenderContext::CairoRenderMode saved_mode = ctx->getRenderMode(); @@ -766,9 +766,9 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) void CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) { - g_assert( ctx != NULL && ctx->_is_valid ); + g_assert( ctx != nullptr && ctx->_is_valid ); - if (mask == NULL) + if (mask == nullptr) return; // FIXME: the access to the first mask view to obtain the bbox is completely bogus diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index e6e7d4ed4..bf573cfac 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -245,7 +245,7 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #endif if (!libcdr::CDRDocument::isSupported(&input)) { - return NULL; + return nullptr; } RVNGStringVector output; @@ -256,11 +256,11 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #else if (!libcdr::CDRDocument::generateSVG(&input, output)) { #endif - return NULL; + return nullptr; } if (output.empty()) { - return NULL; + return nullptr; } std::vector<RVNGString> tmpSVGOutput; @@ -274,12 +274,12 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // If only one page is present, import that one without bothering user if (tmpSVGOutput.size() > 1) { - CdrImportDialog *dlg = 0; + CdrImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new CdrImportDialog(tmpSVGOutput); if (!dlg->showDialog()) { delete dlg; - return NULL; + return nullptr; } } diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 54099271b..f8cedcb50 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -80,7 +80,7 @@ Emf::~Emf (void) //The destructor bool Emf::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(PRINT_EMF)) + if (nullptr == Inkscape::Extension::db.get(PRINT_EMF)) return FALSE; return TRUE; } @@ -121,8 +121,8 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) (void) mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // deleted by invoke_hide /* end */ mod->set_param_string("destination", oldoutput); @@ -138,7 +138,7 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_EMF); - if (ext == NULL) + if (ext == nullptr) return; bool new_val = mod->get_param_bool("textToPath"); @@ -166,7 +166,7 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("textToPath", new_val); // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); print_document_to_file(doc, filename); @@ -479,11 +479,11 @@ uint32_t Emf::add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint int dibparams = U_BI_UNKNOWN; // type of image not yet determined MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table U_RGBQUAD ct2[2]; uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ @@ -524,7 +524,7 @@ uint32_t Emf::add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG || dibparams==U_BI_PNG){ // image was binary png or jpg in source file base64String = g_base64_encode((guchar*) px, numCt ); } @@ -749,7 +749,7 @@ int Emf::in_clips(PEMF_CALLBACK_DATA d, const char *test){ void Emf::add_clips(PEMF_CALLBACK_DATA d, const char *clippath, unsigned int logic){ int op = combine_ops_to_livarot(logic); Geom::PathVector combined_vect; - char *combined = NULL; + char *combined = nullptr; if (op >= 0 && d->dc[d->level].clip_id) { unsigned int real_idx = d->dc[d->level].clip_id - 1; Geom::PathVector old_vect = sp_svg_read_pathv(d->clips.strings[real_idx]); @@ -1080,7 +1080,7 @@ std::string Emf::pix_to_xy(PEMF_CALLBACK_DATA d, double x, double y){ void Emf::select_pen(PEMF_CALLBACK_DATA d, int index) { - PU_EMRCREATEPEN pEmr = NULL; + PU_EMRCREATEPEN pEmr = nullptr; if (index >= 0 && index < d->n_obj){ pEmr = (PU_EMRCREATEPEN) d->emf_obj[index].lpEMFR; @@ -1167,7 +1167,7 @@ Emf::select_pen(PEMF_CALLBACK_DATA d, int index) void Emf::select_extpen(PEMF_CALLBACK_DATA d, int index) { - PU_EMREXTCREATEPEN pEmr = NULL; + PU_EMREXTCREATEPEN pEmr = nullptr; if (index >= 0 && index < d->n_obj) pEmr = (PU_EMREXTCREATEPEN) d->emf_obj[index].lpEMFR; @@ -1379,7 +1379,7 @@ Emf::select_brush(PEMF_CALLBACK_DATA d, int index) void Emf::select_font(PEMF_CALLBACK_DATA d, int index) { - PU_EMREXTCREATEFONTINDIRECTW pEmr = NULL; + PU_EMREXTCREATEFONTINDIRECTW pEmr = nullptr; if (index >= 0 && index < d->n_obj) pEmr = (PU_EMREXTCREATEFONTINDIRECTW) d->emf_obj[index].lpEMFR; @@ -1423,7 +1423,7 @@ Emf::select_font(PEMF_CALLBACK_DATA d, int index) d->dc[d->level].style.text_decoration_line.set = true; d->dc[d->level].style.text_decoration_line.inherit = false; // malformed EMF with empty filename may exist, ignore font change if encountered - char *ctmp = U_Utf16leToUtf8((uint16_t *) (pEmr->elfw.elfLogFont.lfFaceName), U_LF_FACESIZE, NULL); + char *ctmp = U_Utf16leToUtf8((uint16_t *) (pEmr->elfw.elfLogFont.lfFaceName), U_LF_FACESIZE, nullptr); if(ctmp){ if (d->dc[d->level].font_name){ free(d->dc[d->level].font_name); } if(*ctmp){ @@ -1448,7 +1448,7 @@ Emf::delete_object(PEMF_CALLBACK_DATA d, int index) // files too big to fit into memory. if (d->emf_obj[index].lpEMFR) free(d->emf_obj[index].lpEMFR); - d->emf_obj[index].lpEMFR = NULL; + d->emf_obj[index].lpEMFR = nullptr; } } @@ -1472,8 +1472,8 @@ int Emf::AI_hack(PU_EMRHEADER pEmr){ char *ptr; ptr = (char *)pEmr; PU_EMRSETMAPMODE nEmr = (PU_EMRSETMAPMODE) (ptr + pEmr->emr.nSize); - char *string = NULL; - if(pEmr->nDescription)string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription), pEmr->nDescription, NULL); + char *string = nullptr; + if(pEmr->nDescription)string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription), pEmr->nDescription, nullptr); if(string){ if((pEmr->nDescription >= 13) && (0==strcmp("Adobe Systems",string)) && @@ -1526,12 +1526,12 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ // next call returns pointers and values, but allocates no memory @@ -1573,7 +1573,7 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG){ // image was binary jpg in source file tmp_image << " xlink:href=\"data:image/jpeg;base64,"; base64String = g_base64_encode((guchar*) px, numCt ); @@ -1630,14 +1630,14 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA int eDbgComment=0; int eDbgFinal=0; char const* eDbgString = getenv( "INKSCAPE_DBG_EMF" ); - if ( eDbgString != NULL ) { + if ( eDbgString != nullptr ) { if(strstr(eDbgString,"RECORD")){ eDbgRecord = 1; } if(strstr(eDbgString,"COMMENT")){ eDbgComment = 1; } if(strstr(eDbgString,"FINAL")){ eDbgFinal = 1; } } /* initialize the tsp for text reassembly */ - tsp.string = NULL; + tsp.string = nullptr; tsp.ori = 0.0; /* degrees */ tsp.fs = 12.0; /* font size */ tsp.x = 0.0; @@ -1874,14 +1874,14 @@ std::cout << "BEFORE DRAW" // Init the new emf_obj list elements to null, provided the // dynamic allocation succeeded. - if ( d->emf_obj != NULL ) + if ( d->emf_obj != nullptr ) { for( int i=0; i < d->n_obj; ++i ) - d->emf_obj[i].lpEMFR = NULL; + d->emf_obj[i].lpEMFR = nullptr; } //if } else { - d->emf_obj = NULL; + d->emf_obj = nullptr; } break; @@ -2352,7 +2352,7 @@ std::cout << "BEFORE DRAW" } if(d->dc[old_level].font_name){ free(d->dc[old_level].font_name); // else memory leak - d->dc[old_level].font_name = NULL; + d->dc[old_level].font_name = nullptr; } old_level--; } @@ -3095,7 +3095,7 @@ std::cout << "BEFORE DRAW" /* Rotation issues are handled entirely in libTERE now */ - uint32_t *dup_wt = NULL; + uint32_t *dup_wt = nullptr; if( lpEMFR->iType==U_EMR_EXTTEXTOUTA){ /* These should be JUST ASCII, but they might not be... @@ -3103,20 +3103,20 @@ std::cout << "BEFORE DRAW" If not, assume that it holds Latin1. If that fails then something is really screwed up! */ - dup_wt = U_Utf8ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, NULL); - if(!dup_wt)dup_wt = U_Latin1ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, NULL); + dup_wt = U_Utf8ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, nullptr); + if(!dup_wt)dup_wt = U_Latin1ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(pEmr->emrtext.nChars); } else if( lpEMFR->iType==U_EMR_EXTTEXTOUTW){ - dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmr + pEmr->emrtext.offString), pEmr->emrtext.nChars, NULL); + dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmr + pEmr->emrtext.offString), pEmr->emrtext.nChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(pEmr->emrtext.nChars); } else { // U_EMR_SMALLTEXTOUT if(pEmrS->fuOptions & U_ETO_SMALL_CHARS){ - dup_wt = U_Utf8ToUtf32le((char *) pEmrS + roff, cChars, NULL); + dup_wt = U_Utf8ToUtf32le((char *) pEmrS + roff, cChars, nullptr); } else { - dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmrS + roff), cChars, NULL); + dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmrS + roff), cChars, nullptr); } if(!dup_wt)dup_wt = unknown_chars(cChars); } @@ -3129,12 +3129,12 @@ std::cout << "BEFORE DRAW" } char *ansi_text; - ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, NULL); + ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, nullptr); free(dup_wt); // Empty string or starts with an invalid escape/control sequence, which is bogus text. Throw it out before g_markup_escape_text can make things worse if(*((uint8_t *)ansi_text) <= 0x1F){ free(ansi_text); - ansi_text=NULL; + ansi_text=nullptr; } if (ansi_text) { @@ -3528,18 +3528,18 @@ void Emf::free_emf_strings(EMF_STRINGS name){ SPDocument * Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { - if (uri == NULL) { - return NULL; + if (uri == nullptr) { + return nullptr; } // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); EMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt - d.emf_obj = NULL; + d.emf_obj = nullptr; d.dc[0].font_name = strdup("Arial"); // Default font, set only on lowest level, it copies up from there EMF spec says device can pick whatever it wants // set up the size default for patterns in defs. This might not be referenced if there are no patterns defined in the drawing. @@ -3556,12 +3556,12 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) size_t length; char *contents; - if(emf_readdata(uri, &contents, &length))return(NULL); + if(emf_readdata(uri, &contents, &length))return(nullptr); - d.pDesc = NULL; + d.pDesc = nullptr; // set up the text reassembly system - if(!(d.tri = trinfo_init(NULL)))return(NULL); + if(!(d.tri = trinfo_init(nullptr)))return(nullptr); (void) trinfo_load_ft_opts(d.tri, 1, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); @@ -3573,7 +3573,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = NULL; + SPDocument *doc = nullptr; if (good) { doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); } diff --git a/src/extension/internal/emf-inout.h b/src/extension/internal/emf-inout.h index 3c2a814aa..bef58b612 100644 --- a/src/extension/internal/emf-inout.h +++ b/src/extension/internal/emf-inout.h @@ -33,7 +33,7 @@ typedef struct emf_object { emf_object() : type(0), level(0), - lpEMFR(NULL) + lpEMFR(nullptr) {}; int type; int level; @@ -44,7 +44,7 @@ typedef struct emf_strings { emf_strings() : size(0), count(0), - strings(NULL) + strings(nullptr) {}; int size; // number of slots allocated in strings int count; // number of slots used in strings @@ -54,7 +54,7 @@ typedef struct emf_strings { typedef struct emf_device_context { emf_device_context() : // SPStyle: class with constructor - font_name(NULL), + font_name(nullptr), clip_id(0), stroke_set(false), stroke_mode(0), stroke_idx(0), stroke_recidx(0), fill_set(false), fill_mode(0), fill_idx(0), fill_recidx(0), @@ -67,7 +67,7 @@ typedef struct emf_device_context { textAlign(0) // worldTransform, cur { - font_name = NULL; + font_name = nullptr; sizeWnd = sizel_set( 0.0, 0.0 ); sizeView = sizel_set( 0.0, 0.0 ); winorg = point32_set( 0.0, 0.0 ); @@ -127,9 +127,9 @@ typedef struct emf_callback_data { dwRop2(U_R2_COPYPEN), dwRop3(0), MMX(0),MMY(0), drawtype(0), - pDesc(NULL), + pDesc(nullptr), // hatches, images, gradients, struct w/ constructor - tri(NULL), + tri(nullptr), n_obj(0) // emf_obj; {}; diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 0b005f8da..ec4594eea 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -75,8 +75,8 @@ namespace Internal { /* globals */ static double PX2WORLD; static bool FixPPTCharPos, FixPPTDashLine, FixPPTGrad2Polys, FixPPTLinGrad, FixPPTPatternAsHatch, FixImageRot; -static EMFTRACK *et = NULL; -static EMFHANDLES *eht = NULL; +static EMFTRACK *et = nullptr; +static EMFHANDLES *eht = nullptr; void PrintEmf::smuggle_adxkyrtl_out(const char *string, uint32_t **adx, double *ky, int *rtl, int *ndx, float scale) { @@ -85,7 +85,7 @@ void PrintEmf::smuggle_adxkyrtl_out(const char *string, uint32_t **adx, double * uint32_t *ladx; const char *cptr = &string[strlen(string) + 1]; // this works because of the first fake terminator - *adx = NULL; + *adx = nullptr; *ky = 0.0; // set a default value sscanf(cptr, "%7d", ndx); if (!*ndx) { @@ -207,12 +207,12 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) p = ansi_uri; } snprintf(buff, sizeof(buff) - 1, "Inkscape %s \1%s\1", Inkscape::version_string, p); - uint16_t *Description = U_Utf8ToUtf16le(buff, 0, NULL); + uint16_t *Description = U_Utf8ToUtf16le(buff, 0, nullptr); int cbDesc = 2 + wchar16len(Description); // also count the final terminator (void) U_Utf16leEdit(Description, '\1', '\0'); // swap the temporary \1 characters for nulls // construct the EMRHEADER record and append it to the EMF in memory - rec = U_EMRHEADER_set(rclBounds, rclFrame, NULL, cbDesc, Description, szlDev, szlMm, 0); + rec = U_EMRHEADER_set(rclBounds, rclFrame, nullptr, cbDesc, Description, szlDev, szlMm, 0); free(Description); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::begin at EMRHEADER"); @@ -301,7 +301,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) unsigned int PrintEmf::finish(Inkscape::Extension::Print * /*mod*/) { - do_clip_if_present(NULL); // Terminate any open clip. + do_clip_if_present(nullptr); // Terminate any open clip. char *rec; if (!et) { return 0; @@ -310,7 +310,7 @@ unsigned int PrintEmf::finish(Inkscape::Extension::Print * /*mod*/) // earlier versions had flush of fill here, but it never executed and was removed - rec = U_EMREOF_set(0, NULL, et); // generate the EOF record + rec = U_EMREOF_set(0, nullptr, et); // generate the EOF record if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::finish"); } @@ -410,8 +410,8 @@ int PrintEmf::create_brush(SPStyle const *style, PU_COLORREF fcolor) } else if (SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style))) { // must be a gradient // currently we do not do anything with gradients, the code below just sets the color to the average of the stops SPPaintServer *paintserver = style->fill.value.href->getObject(); - SPLinearGradient *lg = NULL; - SPRadialGradient *rg = NULL; + SPLinearGradient *lg = nullptr; + SPRadialGradient *rg = nullptr; if (SP_IS_LINEARGRADIENT(paintserver)) { lg = SP_LINEARGRADIENT(paintserver); @@ -533,8 +533,8 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) { U_EXTLOGPEN *elp; U_NUM_STYLEENTRY n_dash = 0; - U_STYLEENTRY *dash = NULL; - char *rec = NULL; + U_STYLEENTRY *dash = nullptr; + char *rec = nullptr; int linestyle = U_PS_SOLID; int linecap = 0; int linejoin = 0; @@ -545,14 +545,14 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) U_COLORREF hatchColor; U_COLORREF bkColor; uint32_t width, height; - char *px = NULL; + char *px = nullptr; char *rgba_px; uint32_t cbPx = 0; uint32_t colortype; - PU_RGBQUAD ct = NULL; + PU_RGBQUAD ct = nullptr; int numCt = 0; U_BITMAPINFOHEADER Bmih; - PU_BITMAPINFO Bmi = NULL; + PU_BITMAPINFO Bmi = nullptr; if (!et) { return 0; @@ -729,7 +729,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) U_RGB(0, 0, 0), U_HS_HORIZONTAL, 0, - NULL); + nullptr); } rec = extcreatepen_set(&pen, eht, Bmi, cbPx, px, elp); @@ -772,7 +772,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) // set the current pen to the stock object NULL_PEN and then delete the defined pen object, if there is one. void PrintEmf::destroy_pen() { - char *rec = NULL; + char *rec = nullptr; // before an object may be safely deleted it must no longer be selected // select in a stock object to deselect this one, the stock object should // never be used because we always select in a new one before drawing anythingrestore previous brush, necessary??? Would using a default stock object not work? @@ -987,14 +987,14 @@ U_TRIVERTEX PrintEmf::make_trivertex(Geom::Point Pt, U_COLORREF uc){ */ void PrintEmf::do_clip_if_present(SPStyle const *style){ char *rec; - static SPClipPath *scpActive = NULL; + static SPClipPath *scpActive = nullptr; if(!style){ if(scpActive){ // clear the existing clip rec = U_EMRRESTOREDC_set(-1); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::fill at U_EMRRESTOREDC_set"); } - scpActive=NULL; + scpActive=nullptr; } } else { /* The current implementation converts only one level of clipping. If there were more @@ -1005,10 +1005,10 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ Note, to debug this section of code use print statements on sp_svg_write_path(combined_pathvector). */ /* find the first clip_ref at object or up the stack. There may not be one. */ - SPClipPath *scp = NULL; + SPClipPath *scp = nullptr; SPItem *item = SP_ITEM(style->object); while(1) { - scp = (item->clip_ref ? item->clip_ref->getObject() : NULL); + scp = (item->clip_ref ? item->clip_ref->getObject() : nullptr); if(scp)break; item = SP_ITEM(item->parent); if(!item || SP_IS_ROOT(item))break; // this will never be a clipping path @@ -1020,7 +1020,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::fill at U_EMRRESTOREDC_set"); } - scpActive = NULL; + scpActive = nullptr; } if (scp) { // set the new clip @@ -1067,7 +1067,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ } } else { - scpActive = NULL; // no valid path available to draw, so no DC was saved, so no signal to restore + scpActive = nullptr; // no valid path available to draw, so no DC was saved, so no signal to restore } } // change or remove clipping } // scp exists @@ -1133,7 +1133,7 @@ unsigned int PrintEmf::fill( fill_transform = tf; - int brush_stat = create_brush(style, NULL); + int brush_stat = create_brush(style, nullptr); /* native linear gradients are only used if the object is a rectangle AND the gradient is parallel to the sides of the object */ bool is_Rect = false; @@ -1428,7 +1428,7 @@ unsigned int PrintEmf::stroke( Geom::OptRect const &/*pbox*/, Geom::OptRect const &/*dbox*/, Geom::OptRect const &/*bbox*/) { - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); do_clip_if_present(style); // If clipping is needed set it up @@ -1508,7 +1508,7 @@ bool PrintEmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff int moves = 0; int lines = 0; int curves = 0; - char *rec = NULL; + char *rec = nullptr; for (Geom::PathVector::iterator pit = pv.begin(); pit != pv.end(); ++pit) { moves++; @@ -1718,7 +1718,7 @@ unsigned int PrintEmf::image( SPStyle const *style) /** provides indirect link to image object */ { double x1, y1, dw, dh; - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); do_clip_if_present(style); // If clipping is needed set it up @@ -1923,7 +1923,7 @@ unsigned int PrintEmf::draw_pathv_to_EMF(Geom::PathVector const &pathv, const Ge unsigned int PrintEmf::print_pathv(Geom::PathVector const &pathv, const Geom::Affine &transform) { Geom::Affine tf = transform; - char *rec = NULL; + char *rec = nullptr; simple_shape = print_simple_shape(pathv, tf); if (simple_shape || pathv.empty()) { @@ -1976,7 +1976,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } do_clip_if_present(style); // If clipping is needed set it up - char *rec = NULL; + char *rec = nullptr; int ccount, newfont; int fix90n = 0; uint32_t hfont = 0; @@ -2006,7 +2006,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } char *text2 = strdup(text); // because U_Utf8ToUtf16le calls iconv which does not like a const char * - uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, NULL); + uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, nullptr); free(text2); //translates Unicode to NonUnicode, if possible. If any translate, all will, and all to //the same font, because of code in Layout::print @@ -2058,9 +2058,9 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te // of the special fonts. uint16_t *wfacename; if (!newfont) { - wfacename = U_Utf8ToUtf16le(style->font_family.value, 0, NULL); + wfacename = U_Utf8ToUtf16le(style->font_family.value, 0, nullptr); } else { - wfacename = U_Utf8ToUtf16le(FontName(newfont), 0, NULL); + wfacename = U_Utf8ToUtf16le(FontName(newfont), 0, nullptr); } // Scale the text to the minimum stretch. (It tends to stay within bounding rectangles even if @@ -2084,7 +2084,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te wfacename); free(wfacename); - rec = extcreatefontindirectw_set(&hfont, eht, (char *) &lf, NULL); + rec = extcreatefontindirectw_set(&hfont, eht, (char *) &lf, nullptr); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::text at extcreatefontindirectw_set"); } diff --git a/src/extension/internal/filter/bevels.h b/src/extension/internal/filter/bevels.h index 91fe2f8cf..4c2ddc719 100644 --- a/src/extension/internal/filter/bevels.h +++ b/src/extension/internal/filter/bevels.h @@ -45,7 +45,7 @@ protected: public: DiffuseLight ( ) : Filter() { }; - ~DiffuseLight ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~DiffuseLight ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -73,7 +73,7 @@ public: gchar const * DiffuseLight::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream elevation; @@ -125,7 +125,7 @@ protected: public: MatteJelly ( ) : Filter() { }; - ~MatteJelly ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~MatteJelly ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -154,7 +154,7 @@ public: gchar const * MatteJelly::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream bright; @@ -209,7 +209,7 @@ protected: public: SpecularLight ( ) : Filter() { }; - ~SpecularLight ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~SpecularLight ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -238,7 +238,7 @@ public: gchar const * SpecularLight::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream bright; diff --git a/src/extension/internal/filter/blurs.h b/src/extension/internal/filter/blurs.h index 0956b23b6..c99b9efac 100644 --- a/src/extension/internal/filter/blurs.h +++ b/src/extension/internal/filter/blurs.h @@ -46,7 +46,7 @@ protected: public: Blur ( ) : Filter() { }; - ~Blur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Blur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -73,7 +73,7 @@ public: gchar const * Blur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream bbox; std::ostringstream hblur; @@ -117,7 +117,7 @@ protected: public: CleanEdges ( ) : Filter() { }; - ~CleanEdges ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CleanEdges ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -142,7 +142,7 @@ public: gchar const * CleanEdges::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; @@ -177,7 +177,7 @@ protected: public: CrossBlur ( ) : Filter() { }; - ~CrossBlur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CrossBlur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -211,7 +211,7 @@ public: gchar const * CrossBlur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream bright; std::ostringstream fade; @@ -252,7 +252,7 @@ protected: public: Feather ( ) : Filter() { }; - ~Feather ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Feather ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -277,7 +277,7 @@ public: gchar const * Feather::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; @@ -317,7 +317,7 @@ protected: public: ImageBlur ( ) : Filter() { }; - ~ImageBlur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ImageBlur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -361,7 +361,7 @@ public: gchar const * ImageBlur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream hblur; std::ostringstream vblur; diff --git a/src/extension/internal/filter/bumps.h b/src/extension/internal/filter/bumps.h index 95f6170f3..0eaee7a5f 100644 --- a/src/extension/internal/filter/bumps.h +++ b/src/extension/internal/filter/bumps.h @@ -72,7 +72,7 @@ protected: public: Bump ( ) : Filter() { }; - ~Bump ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Bump ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -152,7 +152,7 @@ public: gchar const * Bump::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simplifyImage; std::ostringstream simplifyBump; @@ -301,7 +301,7 @@ protected: public: WaxBump ( ) : Filter() { }; - ~WaxBump ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~WaxBump ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -372,7 +372,7 @@ public: gchar const * WaxBump::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simplifyImage; std::ostringstream simplifyBump; diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 063073267..ae6bc718c 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -66,7 +66,7 @@ protected: public: Brilliance ( ) : Filter() { }; - ~Brilliance ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Brilliance ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -93,7 +93,7 @@ public: gchar const * Brilliance::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream brightness; std::ostringstream sat; @@ -146,7 +146,7 @@ protected: public: ChannelPaint ( ) : Filter() { }; - ~ChannelPaint ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ChannelPaint ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -182,7 +182,7 @@ public: gchar const * ChannelPaint::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream saturation; std::ostringstream red; @@ -247,7 +247,7 @@ protected: public: ColorBlindness ( ) : Filter() { }; - ~ColorBlindness ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorBlindness ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -293,7 +293,7 @@ public: gchar const * ColorBlindness::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; type << ext->get_param_enum("type"); @@ -322,7 +322,7 @@ protected: public: ColorShift ( ) : Filter() { }; - ~ColorShift ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorShift ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -348,7 +348,7 @@ public: gchar const * ColorShift::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream shift; std::ostringstream sat; @@ -385,7 +385,7 @@ protected: public: Colorize ( ) : Filter() { }; - ~Colorize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Colorize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -433,7 +433,7 @@ public: gchar const * Colorize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; @@ -492,7 +492,7 @@ protected: public: ComponentTransfer ( ) : Filter() { }; - ~ComponentTransfer ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ComponentTransfer ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -522,7 +522,7 @@ public: gchar const * ComponentTransfer::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream CTfunction; const gchar *type = ext->get_param_enum("type"); @@ -577,7 +577,7 @@ protected: public: Duochrome ( ) : Filter() { }; - ~Duochrome ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Duochrome ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -618,7 +618,7 @@ public: gchar const * Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a1; std::ostringstream r1; @@ -702,7 +702,7 @@ protected: public: ExtractChannel ( ) : Filter() { }; - ~ExtractChannel ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ExtractChannel ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -739,7 +739,7 @@ public: gchar const * ExtractChannel::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blend; std::ostringstream colors; @@ -808,7 +808,7 @@ protected: public: FadeToBW ( ) : Filter() { }; - ~FadeToBW ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~FadeToBW ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -836,7 +836,7 @@ public: gchar const * FadeToBW::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream level; std::ostringstream wlevel; @@ -887,7 +887,7 @@ protected: public: Greyscale ( ) : Filter() { }; - ~Greyscale ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Greyscale ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -915,7 +915,7 @@ public: gchar const * Greyscale::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream red; std::ostringstream green; @@ -973,7 +973,7 @@ protected: public: Invert ( ) : Filter() { }; - ~Invert ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Invert ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1007,7 +1007,7 @@ public: gchar const * Invert::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream line1; std::ostringstream line2; @@ -1108,7 +1108,7 @@ protected: public: Lighting ( ) : Filter() { }; - ~Lighting ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Lighting ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1134,7 +1134,7 @@ public: gchar const * Lighting::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream amplitude; std::ostringstream exponent; @@ -1179,7 +1179,7 @@ protected: public: LightnessContrast ( ) : Filter() { }; - ~LightnessContrast ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~LightnessContrast ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1204,7 +1204,7 @@ public: gchar const * LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream lightness; std::ostringstream contrast; @@ -1258,7 +1258,7 @@ protected: public: NudgeRGB ( ) : Filter() { }; - ~NudgeRGB ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NudgeRGB ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1297,7 +1297,7 @@ public: gchar const * NudgeRGB::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream rx; std::ostringstream ry; @@ -1370,7 +1370,7 @@ protected: public: NudgeCMY ( ) : Filter() { }; - ~NudgeCMY ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NudgeCMY ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1409,7 +1409,7 @@ public: gchar const * NudgeCMY::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream cx; std::ostringstream cy; @@ -1476,7 +1476,7 @@ protected: public: Quadritone ( ) : Filter() { }; - ~Quadritone ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Quadritone ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1515,7 +1515,7 @@ public: gchar const * Quadritone::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream dist; std::ostringstream colors; @@ -1559,7 +1559,7 @@ protected: public: SimpleBlend ( ) : Filter() { }; - ~SimpleBlend ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~SimpleBlend ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1600,7 +1600,7 @@ public: gchar const * SimpleBlend::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; @@ -1645,7 +1645,7 @@ protected: public: Solarize ( ) : Filter() { }; - ~Solarize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Solarize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1674,7 +1674,7 @@ public: gchar const * Solarize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream rotate; std::ostringstream blend1; @@ -1732,7 +1732,7 @@ protected: public: Tritone ( ) : Filter() { }; - ~Tritone ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Tritone ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1785,7 +1785,7 @@ public: gchar const * Tritone::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream dist; std::ostringstream a; diff --git a/src/extension/internal/filter/distort.h b/src/extension/internal/filter/distort.h index 6d1fc0a75..f1654d075 100644 --- a/src/extension/internal/filter/distort.h +++ b/src/extension/internal/filter/distort.h @@ -59,7 +59,7 @@ protected: public: FeltFeather ( ) : Filter() { }; - ~FeltFeather ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~FeltFeather ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -106,7 +106,7 @@ public: gchar const * FeltFeather::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream hblur; @@ -182,7 +182,7 @@ protected: public: Roughen ( ) : Filter() { }; - ~Roughen ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Roughen ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -215,7 +215,7 @@ public: gchar const * Roughen::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; diff --git a/src/extension/internal/filter/filter-file.cpp b/src/extension/internal/filter/filter-file.cpp index 07a7eb0af..241f0f52c 100644 --- a/src/extension/internal/filter/filter-file.cpp +++ b/src/extension/internal/filter/filter-file.cpp @@ -34,7 +34,7 @@ void filters_load_file (Glib::ustring filename, gchar * menuname) { Inkscape::XML::Document *doc = sp_repr_read_file(filename.c_str(), INKSCAPE_EXTENSION_URI); - if (doc == NULL) { + if (doc == nullptr) { g_warning("File (%s) is not parseable as XML. Ignored.", filename.c_str()); return; } @@ -47,10 +47,10 @@ filters_load_file (Glib::ustring filename, gchar * menuname) } for (Inkscape::XML::Node * child = root->firstChild(); - child != NULL; child = child->next()) { + child != nullptr; child = child->next()) { if (!strcmp(child->name(), "svg:defs")) { for (Inkscape::XML::Node * defs = child->firstChild(); - defs != NULL; defs = defs->next()) { + defs != nullptr; defs = defs->next()) { if (!strcmp(defs->name(), "svg:filter")) { Filter::filters_load_node(defs, menuname); } // oh! a filter @@ -97,7 +97,7 @@ Filter::filters_load_node (Inkscape::XML::Node * node, gchar * menuname) gchar const * menu_tooltip = node->attribute("inkscape:menu-tooltip"); gchar const * id = node->attribute("id"); - if (label == NULL) { + if (label == nullptr) { label = id; } diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 166e5406f..8e32bc05d 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -27,7 +27,7 @@ namespace Filter { Filter::Filter() : Inkscape::Extension::Implementation::Implementation(), - _filter(NULL) { + _filter(nullptr) { return; } @@ -38,8 +38,8 @@ Filter::Filter(gchar const * filter) : } Filter::~Filter (void) { - if (_filter != NULL) { - _filter = NULL; + if (_filter != nullptr) { + _filter = nullptr; } return; @@ -53,7 +53,7 @@ bool Filter::load(Inkscape::Extension::Extension * /*module*/) Inkscape::Extension::Implementation::ImplementationDocumentCache *Filter::newDocCache(Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*doc*/) { - return NULL; + return nullptr; } gchar const *Filter::get_filter_text(Inkscape::Extension::Extension * /*ext*/) @@ -64,7 +64,7 @@ gchar const *Filter::get_filter_text(Inkscape::Extension::Extension * /*ext*/) Inkscape::XML::Document * Filter::get_filter (Inkscape::Extension::Extension * ext) { gchar const * filter = get_filter_text(ext); - return sp_repr_read_mem(filter, strlen(filter), NULL); + return sp_repr_read_mem(filter, strlen(filter), nullptr); } void @@ -72,7 +72,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic, gchar const * srcGraphicAlpha) { - if (from == NULL) return; + if (from == nullptr) return; // copy attributes for ( Inkscape::Util::List<Inkscape::XML::AttributeRecord const> iter = from->attributeList() ; @@ -83,11 +83,11 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, to->setAttribute(attr, from->attribute(attr)); if (!strcmp(attr, "in") || !strcmp(attr, "in2") || !strcmp(attr, "in3")) { - if (srcGraphic != NULL && !strcmp(from->attribute(attr), "SourceGraphic")) { + if (srcGraphic != nullptr && !strcmp(from->attribute(attr), "SourceGraphic")) { to->setAttribute(attr, srcGraphic); } - if (srcGraphicAlpha != NULL && !strcmp(from->attribute(attr), "SourceAlpha")) { + if (srcGraphicAlpha != nullptr && !strcmp(from->attribute(attr), "SourceAlpha")) { to->setAttribute(attr, srcGraphicAlpha); } } @@ -95,7 +95,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, // for each child call recursively for (Inkscape::XML::Node * from_child = from->firstChild(); - from_child != NULL ; from_child = from_child->next()) { + from_child != nullptr ; from_child = from_child->next()) { Glib::ustring name = "svg:"; name += from_child->name(); @@ -103,7 +103,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, to->appendChild(to_child); merge_filters(to_child, from_child, doc, srcGraphic, srcGraphicAlpha); - if (from_child == from->firstChild() && !strcmp("filter", from->name()) && srcGraphic != NULL && to_child->attribute("in") == NULL) { + if (from_child == from->firstChild() && !strcmp("filter", from->name()) && srcGraphic != nullptr && to_child->attribute("in") == nullptr) { to_child->setAttribute("in", srcGraphic); } Inkscape::GC::release(to_child); @@ -117,7 +117,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { Inkscape::XML::Document *filterdoc = get_filter(module); - if (filterdoc == NULL) { + if (filterdoc == nullptr) { return; // could not parse the XML source of the filter; typically parser will stderr a warning } @@ -136,9 +136,9 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::XML::Node * node = spitem->getRepr(); SPCSSAttr * css = sp_repr_css_attr(node, "style"); - gchar const * filter = sp_repr_css_property(css, "filter", NULL); + gchar const * filter = sp_repr_css_property(css, "filter", nullptr); - if (filter == NULL) { + if (filter == nullptr) { Inkscape::XML::Node * newfilterroot = xmldoc->createElement("svg:filter"); merge_filters(newfilterroot, filterdoc->root(), xmldoc); @@ -159,8 +159,8 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie } gchar * lfilter = g_strndup(filter + 5, strlen(filter) - 6); - Inkscape::XML::Node * filternode = NULL; - for (Inkscape::XML::Node * child = defsrepr->firstChild(); child != NULL; child = child->next()) { + Inkscape::XML::Node * filternode = nullptr; + for (Inkscape::XML::Node * child = defsrepr->firstChild(); child != nullptr; child = child->next()) { if (!strcmp(lfilter, child->attribute("id"))) { filternode = child; break; @@ -169,12 +169,12 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie g_free(lfilter); // no filter - if (filternode == NULL) { + if (filternode == nullptr) { g_warning("no assigned filter found!"); continue; } - if (filternode->lastChild() == NULL) { + if (filternode->lastChild() == nullptr) { // empty filter, we insert merge_filters(filternode, filterdoc->root(), xmldoc); } else { diff --git a/src/extension/internal/filter/filter.h b/src/extension/internal/filter/filter.h index ea4ae2302..3a5b8a811 100644 --- a/src/extension/internal/filter/filter.h +++ b/src/extension/internal/filter/filter.h @@ -37,7 +37,7 @@ protected: private: Inkscape::XML::Document * get_filter (Inkscape::Extension::Extension * ext); - void merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic = NULL, gchar const * srcGraphicAlpha = NULL); + void merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic = nullptr, gchar const * srcGraphicAlpha = nullptr); public: Filter(); diff --git a/src/extension/internal/filter/image.h b/src/extension/internal/filter/image.h index 9cbe05e2f..592e41b9f 100644 --- a/src/extension/internal/filter/image.h +++ b/src/extension/internal/filter/image.h @@ -41,7 +41,7 @@ protected: public: EdgeDetect ( ) : Filter() { }; - ~EdgeDetect ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~EdgeDetect ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -72,7 +72,7 @@ public: gchar const * EdgeDetect::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream matrix; std::ostringstream inverted; diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h index 025cca8fe..905e71e67 100644 --- a/src/extension/internal/filter/morphology.h +++ b/src/extension/internal/filter/morphology.h @@ -50,7 +50,7 @@ protected: public: Crosssmooth ( ) : Filter() { }; - ~Crosssmooth ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Crosssmooth ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -86,7 +86,7 @@ public: gchar const * Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream width; @@ -158,7 +158,7 @@ protected: public: Outline ( ) : Filter() { }; - ~Outline ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Outline ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -213,7 +213,7 @@ public: gchar const * Outline::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream width1; std::ostringstream dilat1; diff --git a/src/extension/internal/filter/overlays.h b/src/extension/internal/filter/overlays.h index a0436e2ad..e0f78be9c 100644 --- a/src/extension/internal/filter/overlays.h +++ b/src/extension/internal/filter/overlays.h @@ -48,7 +48,7 @@ protected: public: NoiseFill ( ) : Filter() { }; - ~NoiseFill ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NoiseFill ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -90,7 +90,7 @@ public: gchar const * NoiseFill::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index 653008fc6..aae71fcf3 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -63,7 +63,7 @@ protected: public: Chromolitho ( ) : Filter() { }; - ~Chromolitho ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Chromolitho ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -122,7 +122,7 @@ public: gchar const * Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream b1in; std::ostringstream b2in; @@ -224,7 +224,7 @@ protected: public: CrossEngraving ( ) : Filter() { }; - ~CrossEngraving ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CrossEngraving ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -253,7 +253,7 @@ public: gchar const * CrossEngraving::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream clean; std::ostringstream dilat; @@ -323,7 +323,7 @@ protected: public: Drawing ( ) : Filter() { }; - ~Drawing ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Drawing ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -372,7 +372,7 @@ public: gchar const * Drawing::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simply; std::ostringstream clean; @@ -486,7 +486,7 @@ protected: public: Electrize ( ) : Filter() { }; - ~Electrize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Electrize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -516,7 +516,7 @@ public: gchar const * Electrize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream type; @@ -576,7 +576,7 @@ protected: public: NeonDraw ( ) : Filter() { }; - ~NeonDraw ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NeonDraw ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -611,7 +611,7 @@ public: gchar const * NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blend; std::ostringstream simply; @@ -679,7 +679,7 @@ protected: public: PointEngraving ( ) : Filter() { }; - ~PointEngraving ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~PointEngraving ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -735,7 +735,7 @@ public: gchar const * PointEngraving::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; @@ -842,7 +842,7 @@ protected: public: Posterize ( ) : Filter() { }; - ~Posterize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Posterize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -886,7 +886,7 @@ public: gchar const * Posterize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream table; std::ostringstream blendmode; @@ -965,7 +965,7 @@ protected: public: PosterizeBasic ( ) : Filter() { }; - ~PosterizeBasic ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~PosterizeBasic ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -990,7 +990,7 @@ public: gchar const * PosterizeBasic::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream transf; diff --git a/src/extension/internal/filter/protrusions.h b/src/extension/internal/filter/protrusions.h index c4cd2a688..0abac91e7 100644 --- a/src/extension/internal/filter/protrusions.h +++ b/src/extension/internal/filter/protrusions.h @@ -39,7 +39,7 @@ protected: public: Snow ( ) : Filter() { }; - ~Snow ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Snow ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } public: static void init (void) { @@ -65,7 +65,7 @@ public: gchar const * Snow::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream drift; drift << ext->get_param_float("drift"); diff --git a/src/extension/internal/filter/shadows.h b/src/extension/internal/filter/shadows.h index cca34e2a2..19cfdaba7 100644 --- a/src/extension/internal/filter/shadows.h +++ b/src/extension/internal/filter/shadows.h @@ -49,7 +49,7 @@ protected: public: ColorizableDropShadow ( ) : Filter() { }; - ~ColorizableDropShadow ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorizableDropShadow ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -91,7 +91,7 @@ public: gchar const * ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream a; diff --git a/src/extension/internal/filter/textures.h b/src/extension/internal/filter/textures.h index 39b1789b3..3340643a5 100644 --- a/src/extension/internal/filter/textures.h +++ b/src/extension/internal/filter/textures.h @@ -53,7 +53,7 @@ protected: public: InkBlot ( ) : Filter() { }; - ~InkBlot ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~InkBlot ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } public: static void init (void) { @@ -101,7 +101,7 @@ public: gchar const * InkBlot::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream freq; diff --git a/src/extension/internal/filter/transparency.h b/src/extension/internal/filter/transparency.h index b3498a638..1239c1fac 100644 --- a/src/extension/internal/filter/transparency.h +++ b/src/extension/internal/filter/transparency.h @@ -45,7 +45,7 @@ protected: public: Blend ( ) : Filter() { }; - ~Blend ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Blend ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -80,7 +80,7 @@ public: gchar const * Blend::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream source; std::ostringstream mode; @@ -122,7 +122,7 @@ protected: public: ChannelTransparency ( ) : Filter() { }; - ~ChannelTransparency ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ChannelTransparency ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -150,7 +150,7 @@ public: gchar const * ChannelTransparency::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream red; std::ostringstream green; @@ -197,7 +197,7 @@ protected: public: LightEraser ( ) : Filter() { }; - ~LightEraser ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~LightEraser ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -224,7 +224,7 @@ public: gchar const * LightEraser::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream expand; std::ostringstream erode; @@ -271,7 +271,7 @@ protected: public: Opacity ( ) : Filter() { }; - ~Opacity ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Opacity ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -297,7 +297,7 @@ public: gchar const * Opacity::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream matrix; std::ostringstream opacity; @@ -333,7 +333,7 @@ protected: public: Silhouette ( ) : Filter() { }; - ~Silhouette ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Silhouette ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -360,7 +360,7 @@ public: gchar const * Silhouette::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index efac1a02e..ba90c747e 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -64,14 +64,14 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } bool embed = ( link.compare( "embed" ) == 0 ); - SPDocument *doc = NULL; + SPDocument *doc = nullptr; std::unique_ptr<Inkscape::Pixbuf> pb(Inkscape::Pixbuf::create_from_file(uri)); // TODO: the pixbuf is created again from the base64-encoded attribute in SPImage. // Find a way to create the pixbuf only once. if (pb) { - doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + doc = SPDocument::createNewDoc(nullptr, TRUE, TRUE); bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); // no need to undo in this temporary document @@ -79,7 +79,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) double height = pb->height(); double defaultxdpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", Inkscape::Util::Quantity::convert(1, "in", "px")); //bool forcexdpi = prefs->getBool("/dialogs/import/forcexdpi"); - ImageResolution *ir = 0; + ImageResolution *ir = nullptr; double xscale = 1; double yscale = 1; @@ -126,7 +126,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) sp_embed_image(image_node, pb.get()); } else { // convert filename to uri - gchar* _uri = g_filename_to_uri(uri, NULL, NULL); + gchar* _uri = g_filename_to_uri(uri, nullptr, nullptr); if(_uri) { image_node->setAttribute("xlink:href", _uri); g_free(_uri); @@ -174,8 +174,8 @@ GdkpixbufInput::init(void) gchar **extensions = gdk_pixbuf_format_get_extensions(pixformat); gchar **mimetypes = gdk_pixbuf_format_get_mime_types(pixformat); - for (int i = 0; extensions[i] != NULL; i++) { - for (int j = 0; mimetypes[j] != NULL; j++) { + for (int i = 0; extensions[i] != nullptr; i++) { + for (int j = 0; mimetypes[j] != nullptr; j++) { /* thanks but no thanks, we'll handle SVG extensions... */ if (strcmp(extensions[i], "svg") == 0) { diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp index e6a429d34..1323ca7bc 100644 --- a/src/extension/internal/gimpgrad.cpp +++ b/src/extension/internal/gimpgrad.cpp @@ -133,13 +133,13 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) { Inkscape::IO::dump_fopen_call(filename, "I"); FILE *gradient = Inkscape::IO::fopen_utf8name(filename, "r"); - if (gradient == NULL) { - return NULL; + if (gradient == nullptr) { + return nullptr; } { char tempstr[1024]; - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the read failed" << std::endl; goto error; } @@ -149,7 +149,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) } /* Name field. */ - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the second read failed" << std::endl; goto error; } @@ -157,18 +157,18 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) goto error; } /* Handle very long names. (And also handle nul bytes gracefully: don't use strlen.) */ - while (memchr(tempstr, '\n', sizeof(tempstr) - 1) == NULL) { - if (fgets(tempstr, sizeof(tempstr), gradient) == 0) { + while (memchr(tempstr, '\n', sizeof(tempstr) - 1) == nullptr) { + if (fgets(tempstr, sizeof(tempstr), gradient) == nullptr) { goto error; } } /* n. segments */ - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the third read failed" << std::endl; goto error; } - char *endptr = NULL; + char *endptr = nullptr; long const n_segs = strtol(tempstr, &endptr, 10); if ((*endptr != '\n') || n_segs < 1) { @@ -183,11 +183,11 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) Glib::ustring outsvg("<svg><defs><linearGradient>\n"); long n_segs_found = 0; double prev_right = 0.0; - while (fgets(tempstr, 1024, gradient) != 0) { + while (fgets(tempstr, 1024, gradient) != nullptr) { double dbls[3 + 4 + 4]; gchar *p = tempstr; for (unsigned i = 0; i < G_N_ELEMENTS(dbls); ++i) { - gchar *end = NULL; + gchar *end = nullptr; double const xi = g_ascii_strtod(p, &end); if (!end || end == p || !g_ascii_isspace(*end)) { goto error; @@ -260,7 +260,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) error: fclose(gradient); - return NULL; + return nullptr; } #include "clear-n_.h" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index c7ebf2494..5347eaa86 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -180,7 +180,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPDocument * current_document = view->doc(); auto selected = ((SPDesktop *) view)->getSelection()->items(); - Inkscape::XML::Node * first_select = NULL; + Inkscape::XML::Node * first_select = nullptr; if (!selected.empty()) { first_select = selected.front()->getRepr(); } diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index 558276999..e5b1e4619 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -110,18 +110,18 @@ void ImageResolution::readpng(char const *fn) { return; } - png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); + png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png_ptr) return; png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_read_struct(&png_ptr, 0, 0); + png_destroy_read_struct(&png_ptr, nullptr, nullptr); return; } if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, 0); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); fclose(fp); return; } @@ -153,7 +153,7 @@ void ImageResolution::readpng(char const *fn) { } #endif - png_destroy_read_struct(&png_ptr, &info_ptr, 0); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); fclose(fp); if (ok_) { diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index d4666fcee..5646eeefd 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -65,11 +65,11 @@ namespace Internal static void err(const char *fmt, ...) { va_list args; - g_log(NULL, G_LOG_LEVEL_WARNING, "javafx-out err: "); + g_log(nullptr, G_LOG_LEVEL_WARNING, "javafx-out err: "); va_start(args, fmt); - g_logv(NULL, G_LOG_LEVEL_WARNING, fmt, args); + g_logv(nullptr, G_LOG_LEVEL_WARNING, fmt, args); va_end(args); - g_log(NULL, G_LOG_LEVEL_WARNING, "\n"); + g_log(nullptr, G_LOG_LEVEL_WARNING, "\n"); } @@ -222,7 +222,7 @@ void JavaFXOutput::out(const char *fmt, ...) */ bool JavaFXOutput::doHeader() { - time_t tim = time(NULL); + time_t tim = time(nullptr); out("/*###################################################################\n"); out("### This JavaFX document was generated by Inkscape\n"); out("### http://www.inkscape.org\n"); diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 0581f8edd..e1da0bab6 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -40,7 +40,7 @@ LatexOutput::~LatexOutput (void) //The destructor bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/) { - bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != NULL; + bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != nullptr; return result; } @@ -69,8 +69,8 @@ void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, mod->finish(); // Release things (mod->base)->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // should have been deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // should have been deleted by invoke_hide // end mod->set_param_string("destination", oldoutput); diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 83100d11e..aa90c4f59 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -39,7 +39,7 @@ namespace Internal { PrintLatex::PrintLatex (void): _width(0), _height(0), - _stream(NULL) + _stream(nullptr) { } @@ -63,11 +63,11 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc { Inkscape::SVGOStringStream os; int res; - FILE *osf = NULL; - const gchar * fn = NULL; + FILE *osf = nullptr; + const gchar * fn = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError* error = NULL; + GError* error = nullptr; os.setf(std::ios::fixed); fn = mod->get_param_string("destination"); @@ -80,7 +80,7 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { while (isspace(*fn)) fn += 1; Inkscape::IO::dump_fopen_call(fn, "K"); osf = Inkscape::IO::fopen_utf8name(fn, "w+"); @@ -110,7 +110,7 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc g_print("Printing failed\n"); /* fixme: should use pclose() for pipes */ fclose(_stream); - _stream = NULL; + _stream = nullptr; fflush(stdout); return 0; } @@ -144,7 +144,7 @@ unsigned int PrintLatex::finish(Inkscape::Extension::Print * /*mod*/) fflush(_stream); fclose(_stream); - _stream = NULL; + _stream = nullptr; } return 0; } diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 85426e376..c61a95922 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -64,7 +64,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, { doc->ensureUpToDate(); - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = true; if (exportId && strcmp(exportId, "")) { @@ -102,8 +102,8 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, } LaTeXTextRenderer::LaTeXTextRenderer(bool pdflatex) - : _stream(NULL), - _filename(NULL), + : _stream(nullptr), + _filename(nullptr), _pdflatex(pdflatex), _omittext_state(EMPTY), _omittext_page(1) @@ -136,7 +136,7 @@ LaTeXTextRenderer::~LaTeXTextRenderer(void) */ bool LaTeXTextRenderer::setTargetFile(gchar const *filename) { - if (filename != NULL) { + if (filename != nullptr) { while (isspace(*filename)) filename += 1; _filename = g_path_get_basename(filename); @@ -171,7 +171,7 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) { g_print("Output to LaTeX file failed\n"); /* fixme: should use pclose() for pipes */ fclose(_stream); - _stream = NULL; + _stream = nullptr; fflush(stdout); return false; } @@ -281,8 +281,8 @@ void LaTeXTextRenderer::sp_text_render(SPText *textobj) // get position and alignment // Align vertically on the baseline of the font (retrieved from the anchor point) // Align horizontally on anchorpoint - gchar const *alignment = NULL; - gchar const *aligntabular = NULL; + gchar const *alignment = nullptr; + gchar const *aligntabular = nullptr; switch (style->text_anchor.computed) { case SP_CSS_TEXT_ANCHOR_START: alignment = "[lt]"; @@ -437,7 +437,7 @@ Flowing in rectangle is possible, not in arb shape. SPStyle *style = flowtext->style; - SPItem *frame_item = flowtext->get_frame(NULL); + SPItem *frame_item = flowtext->get_frame(nullptr); SPRect *frame = dynamic_cast<SPRect *>(frame_item); if (!frame_item || !frame) { g_warning("LaTeX export: non-rectangular flowed text shapes are not supported, skipping text."); diff --git a/src/extension/internal/metafile-inout.cpp b/src/extension/internal/metafile-inout.cpp index ae79c8a8a..b90af9529 100644 --- a/src/extension/internal/metafile-inout.cpp +++ b/src/extension/internal/metafile-inout.cpp @@ -93,32 +93,32 @@ Metafile::my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t leng void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ bitmap_t bmStore; bitmap_t *bitmap = &bmStore; - accum->buffer=NULL; // PNG constructed in memory will end up here, caller must free(). + accum->buffer=nullptr; // PNG constructed in memory will end up here, caller must free(). accum->size=0; bitmap->pixels=(pixel_t *)px; bitmap->width = width; bitmap->height = height; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; + png_structp png_ptr = nullptr; + png_infop info_ptr = nullptr; size_t x, y; - png_byte ** row_pointers = NULL; + png_byte ** row_pointers = nullptr; /* The following number is set by trial and error only. I cannot see where it it is documented in the libpng manual. */ int pixel_size = 3; int depth = 8; - png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL){ - accum->buffer=NULL; + png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if (png_ptr == nullptr){ + accum->buffer=nullptr; return; } info_ptr = png_create_info_struct (png_ptr); - if (info_ptr == NULL){ + if (info_ptr == nullptr){ png_destroy_write_struct (&png_ptr, &info_ptr); - accum->buffer=NULL; + accum->buffer=nullptr; return; } @@ -126,7 +126,7 @@ void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ if (setjmp (png_jmpbuf (png_ptr))) { png_destroy_write_struct (&png_ptr, &info_ptr); - accum->buffer=NULL; + accum->buffer=nullptr; return; } @@ -163,9 +163,9 @@ void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ png_set_rows (png_ptr, info_ptr, row_pointers); - png_set_write_fn(png_ptr, accum, my_png_write_data, NULL); + png_set_write_fn(png_ptr, accum, my_png_write_data, nullptr); - png_write_png (png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); + png_write_png (png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, nullptr); for (y = 0; y < bitmap->height; y++) { png_free (png_ptr, row_pointers[y]); @@ -186,7 +186,7 @@ void Metafile::setViewBoxIfMissing(SPDocument *doc) { doc->ensureUpToDate(); // Set document unit - Inkscape::XML::Node *repr = sp_document_namedview(doc, 0)->getRepr(); + Inkscape::XML::Node *repr = sp_document_namedview(doc, nullptr)->getRepr(); Inkscape::SVGOStringStream os; Inkscape::Util::Unit const* doc_unit = doc->getWidth().unit; os << doc_unit->abbr; diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index fb44f8499..4bb8eae32 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -89,7 +89,7 @@ bool PrintMetafile::_load_ppt_fontfix_data() //this is not called by any other return (ppt_fontfix_available = false); } - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); std::string instr; @@ -271,7 +271,7 @@ void PrintMetafile::hatch_classify(char *name, int *hatchType, U_COLORREF *hatch void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf **epixbuf, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor) { if (depth == 0) { - *epixbuf = NULL; + *epixbuf = nullptr; *hatchType = -1; *hatchColor = U_RGB(0, 0, 0); *bkColor = U_RGB(255, 255, 255); @@ -279,7 +279,7 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf depth++; // first look along the pattern chain, if there is one if (SP_IS_PATTERN(parent)) { - for (SPPattern *pat_i = SP_PATTERN(parent); pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = SP_PATTERN(parent); pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (SP_IS_IMAGE(pat_i)) { *epixbuf = ((SPImage *)pat_i)->pixbuf; return; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 42c2bbae3..2c25ea1f4 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -218,7 +218,7 @@ private: virtual void init() { badval = 0.0; - d = NULL; + d = nullptr; rows = 0; cols = 0; size = 0; @@ -229,7 +229,7 @@ private: if (d) { delete[] d; - d = 0; + d = nullptr; } rows = other.rows; cols = other.cols; @@ -289,7 +289,7 @@ public: SingularValueDecomposition (const SVDMatrix &mat) : A (mat), U (), - s (NULL), + s (nullptr), s_size (0), V () { @@ -1010,7 +1010,7 @@ static void gatherText(Inkscape::XML::Node *node, Glib::ustring &buf) } for (Inkscape::XML::Node *child = node->firstChild() ; - child != NULL; child = child->next()) + child != nullptr; child = child->next()) { gatherText(child, buf); } @@ -1466,7 +1466,7 @@ bool OdfOutput::processGradient(SPItem *item, //## Gradient SPGradient *gradient = SP_GRADIENT((checkFillGradient?(SP_STYLE_FILL_SERVER(style)) :(SP_STYLE_STROKE_SERVER(style)))); - if (gradient == NULL) + if (gradient == nullptr) { return false; } @@ -1644,7 +1644,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, analyzeTransform(tf, rotate, xskew, yskew, xscale, yscale); //# Do our stuff - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (nodeName == "svg" || nodeName == "svg:svg") { @@ -2038,7 +2038,7 @@ bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node) //# Descend into the tree, doing all of our conversions //# to both files at the same time - char *oldlocale = g_strdup (setlocale (LC_NUMERIC, NULL)); + char *oldlocale = g_strdup (setlocale (LC_NUMERIC, nullptr)); setlocale (LC_NUMERIC, "C"); if (!writeTree(couts, souts, node)) { diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 552051eed..d078b5a9b 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -357,7 +357,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _preview_height = 300; // Init preview - _thumb_data = NULL; + _thumb_data = nullptr; _pageNumberSpin_adj->set_value(1.0); _current_page = 1; _setPreviewPage(_current_page); @@ -594,7 +594,7 @@ void PdfImportDialog::_setPreviewPage(int page) { if (!_render_thumb) { if (_thumb_data) { gfree(_thumb_data); - _thumb_data = NULL; + _thumb_data = nullptr; } if (!_previewed_page->loadThumb(&_thumb_data, &_thumb_width, &_thumb_height, &_thumb_rowstride)) { @@ -714,7 +714,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from // glib gstdio.c GooString *filename_goo = new GooString(uri); - PDFDoc *pdf_doc = new PDFDoc(filename_goo, NULL, NULL, NULL); // TODO: Could ask for password + PDFDoc *pdf_doc = new PDFDoc(filename_goo, nullptr, nullptr, nullptr); // TODO: Could ask for password //delete filename_goo; #else wchar_t *wfilename = reinterpret_cast<wchar_t*>(g_utf8_to_utf16 (uri, -1, NULL, NULL, NULL)); @@ -754,17 +754,17 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { g_message("Failed to load document from data (error %d)", error); } - return NULL; + return nullptr; } - PdfImportDialog *dlg = NULL; + PdfImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new PdfImportDialog(pdf_doc, uri); if (!dlg->showDialog()) { _cancelled = true; delete dlg; delete pdf_doc; - return NULL; + return nullptr; } } @@ -779,12 +779,12 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { #endif } - SPDocument *doc = NULL; + SPDocument *doc = nullptr; bool saved = false; if(!is_importvia_poppler) { // native importer - doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + doc = SPDocument::createNewDoc(nullptr, TRUE, TRUE); saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); // No need to undo in this temporary document @@ -802,7 +802,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { dlg->getImportSettings(prefs); // Apply crop settings - PDFRectangle *clipToBox = NULL; + PDFRectangle *clipToBox = nullptr; double crop_setting; sp_repr_get_double(prefs, "cropTo", &crop_setting); diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index caaeca18e..fbcb708fe 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -264,13 +264,13 @@ GfxPatch blankPatch() class ClipHistoryEntry { public: - ClipHistoryEntry(GfxPath *clipPath = NULL, GfxClipType clipType = clipNormal); + ClipHistoryEntry(GfxPath *clipPath = nullptr, GfxClipType clipType = clipNormal); virtual ~ClipHistoryEntry(); // Manipulate clip path stack ClipHistoryEntry *save(); ClipHistoryEntry *restore(); - GBool hasSaves() { return saved != NULL; } + GBool hasSaves() { return saved != nullptr; } void setClip(GfxPath *newClipPath, GfxClipType newClipType = clipNormal); GfxPath *getClipPath() { return clipPath; } GfxClipType getClipType() { return clipType; } @@ -300,18 +300,18 @@ PdfParser::PdfParser(XRef *xrefA, builder(builderA), subPage(gFalse), printCommands(false), - res(new GfxResources(xref, resDict, NULL)), // start the resource stack + res(new GfxResources(xref, resDict, nullptr)), // start the resource stack state(new GfxState(72.0, 72.0, box, rotate, gTrue)), fontChanged(gFalse), clip(clipNone), ignoreUndef(0), baseMatrix(), formDepth(0), - parser(NULL), + parser(nullptr), colorDeltas(), maxDepths(), clipHistory(new ClipHistoryEntry()), - operatorHistory(NULL) + operatorHistory(nullptr) { setDefaultApproximationPrecision(); builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"), @@ -357,18 +357,18 @@ PdfParser::PdfParser(XRef *xrefA, builder(builderA), subPage(gTrue), printCommands(false), - res(new GfxResources(xref, resDict, NULL)), // start the resource stack + res(new GfxResources(xref, resDict, nullptr)), // start the resource stack state(new GfxState(72, 72, box, 0, gFalse)), fontChanged(gFalse), clip(clipNone), ignoreUndef(0), baseMatrix(), formDepth(0), - parser(NULL), + parser(nullptr), colorDeltas(), maxDepths(), clipHistory(new ClipHistoryEntry()), - operatorHistory(NULL) + operatorHistory(nullptr) { setDefaultApproximationPrecision(); @@ -399,12 +399,12 @@ PdfParser::~PdfParser() { if (state) { delete state; - state = NULL; + state = nullptr; } if (clipHistory) { delete clipHistory; - clipHistory = NULL; + clipHistory = nullptr; } } @@ -436,7 +436,7 @@ void PdfParser::parse(Object *obj, GBool topLevel) { parser = new Parser(xref, new Lexer(xref, obj), gFalse); go(topLevel); delete parser; - parser = NULL; + parser = nullptr; } void PdfParser::go(GBool /*topLevel*/) @@ -531,38 +531,38 @@ void PdfParser::pushOperator(const char *name) { OpHistoryEntry *newEntry = new OpHistoryEntry; newEntry->name = name; - newEntry->state = NULL; - newEntry->depth = (operatorHistory != NULL ? (operatorHistory->depth+1) : 0); + newEntry->state = nullptr; + newEntry->depth = (operatorHistory != nullptr ? (operatorHistory->depth+1) : 0); newEntry->next = operatorHistory; operatorHistory = newEntry; // Truncate list if needed if (operatorHistory->depth > maxOperatorHistoryDepth) { OpHistoryEntry *curr = operatorHistory; - OpHistoryEntry *prev = NULL; - while (curr && curr->next != NULL) { + OpHistoryEntry *prev = nullptr; + while (curr && curr->next != nullptr) { curr->depth--; prev = curr; curr = curr->next; } if (prev) { - if (curr->state != NULL) + if (curr->state != nullptr) delete curr->state; delete curr; - prev->next = NULL; + prev->next = nullptr; } } } const char *PdfParser::getPreviousOperator(unsigned int look_back) { - OpHistoryEntry *prev = NULL; - if (operatorHistory != NULL && look_back > 0) { + OpHistoryEntry *prev = nullptr; + if (operatorHistory != nullptr && look_back > 0) { prev = operatorHistory->next; - while (--look_back > 0 && prev != NULL) { + while (--look_back > 0 && prev != nullptr) { prev = prev->next; } } - if (prev != NULL) { + if (prev != nullptr) { return prev->name; } else { return ""; @@ -635,7 +635,7 @@ PdfOperator* PdfParser::findOp(char *name) { a = b = m; } if (cmp != 0) - return NULL; + return nullptr; return &opTab[a]; } @@ -712,7 +712,7 @@ void PdfParser::opConcat(Object args[], int /*numArgs*/) // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opSetDash(Object args[], int /*numArgs*/) { - double *dash = 0; + double *dash = nullptr; Array *a = args[0].getArray(); int length = a->getLength(); @@ -770,7 +770,7 @@ void PdfParser::opSetLineWidth(Object args[], int /*numArgs*/) void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) { Object obj1, obj2, obj3, obj4, obj5; - Function *funcs[4] = {0, 0, 0, 0}; + Function *funcs[4] = {nullptr, nullptr, nullptr, nullptr}; GfxColor backdropColor; GBool haveBackdropColor = gFalse; GBool alpha = gFalse; @@ -876,7 +876,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) } if (obj2.isName(const_cast<char*>("Default")) || obj2.isName(const_cast<char*>("Identity"))) { - funcs[0] = funcs[1] = funcs[2] = funcs[3] = NULL; + funcs[0] = funcs[1] = funcs[2] = funcs[3] = nullptr; state->setTransfer(funcs); } else if (obj2.isArray() && obj2.arrayGetLength() == 4) { int pos = 4; @@ -900,7 +900,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) } } else if (obj2.isName() || obj2.isDict() || obj2.isStream()) { if ((funcs[0] = Function::parse(&obj2))) { - funcs[1] = funcs[2] = funcs[3] = NULL; + funcs[1] = funcs[2] = funcs[3] = nullptr; state->setTransfer(funcs); } } else if (!obj2.isNull()) { @@ -931,7 +931,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) #if !defined(POPPLER_NEW_OBJECT_API) obj3.free(); #endif - funcs[0] = NULL; + funcs[0] = nullptr; #if defined(POPPLER_NEW_OBJECT_API) if (!((obj3 = obj2.dictLookup(const_cast<char*>("TR"))).isNull())) { #else @@ -942,7 +942,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) funcs[0]->getOutputSize() != 1) { error(errSyntaxError, getPos(), "Invalid transfer function in soft mask in ExtGState"); delete funcs[0]; - funcs[0] = NULL; + funcs[0] = nullptr; } } #if defined(POPPLER_NEW_OBJECT_API) @@ -976,7 +976,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) if (obj2.dictLookup(const_cast<char*>("G"), &obj3)->isStream()) { if (obj3.streamGetDict()->lookup(const_cast<char*>("Group"), &obj4)->isDict()) { #endif - GfxColorSpace *blendingColorSpace = 0; + GfxColorSpace *blendingColorSpace = nullptr; GBool isolated = gFalse; GBool knockout = gFalse; #if defined(POPPLER_NEW_OBJECT_API) @@ -985,7 +985,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) { #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - blendingColorSpace = GfxColorSpace::parse(NULL, &obj5, NULL, NULL); + blendingColorSpace = GfxColorSpace::parse(nullptr, &obj5, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj5, NULL, NULL); #else @@ -1140,7 +1140,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha, #else dict->lookup(const_cast<char*>("Resources"), &obj1); #endif - resDict = obj1.isDict() ? obj1.getDict() : (Dict *)NULL; + resDict = obj1.isDict() ? obj1.getDict() : (Dict *)nullptr; // draw it ++formDepth; @@ -1170,7 +1170,7 @@ void PdfParser::opSetFillGray(Object args[], int /*numArgs*/) { GfxColor color; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceGrayColorSpace()); color.c[0] = dblToCol(args[0].getNum()); state->setFillColor(&color); @@ -1182,7 +1182,7 @@ void PdfParser::opSetStrokeGray(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceGrayColorSpace()); color.c[0] = dblToCol(args[0].getNum()); state->setStrokeColor(&color); @@ -1195,7 +1195,7 @@ void PdfParser::opSetFillCMYKColor(Object args[], int /*numArgs*/) GfxColor color; int i; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceCMYKColorSpace()); for (i = 0; i < 4; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1209,7 +1209,7 @@ void PdfParser::opSetStrokeCMYKColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceCMYKColorSpace()); for (int i = 0; i < 4; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1223,7 +1223,7 @@ void PdfParser::opSetFillRGBColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceRGBColorSpace()); for (int i = 0; i < 3; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1236,7 +1236,7 @@ void PdfParser::opSetFillRGBColor(Object args[], int /*numArgs*/) void PdfParser::opSetStrokeRGBColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceRGBColorSpace()); for (int i = 0; i < 3; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1250,19 +1250,19 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) { Object obj; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); #if defined(POPPLER_NEW_OBJECT_API) obj = res->lookupColorSpace(args[0].getName()); #else res->lookupColorSpace(args[0].getName(), &obj); #endif - GfxColorSpace *colorSpace = 0; + GfxColorSpace *colorSpace = nullptr; #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &args[0], nullptr, nullptr); } else { - colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj, nullptr, nullptr); } #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (obj.isNull()) { @@ -1295,9 +1295,9 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) { Object obj; - GfxColorSpace *colorSpace = 0; + GfxColorSpace *colorSpace = nullptr; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); #if defined(POPPLER_NEW_OBJECT_API) obj = res->lookupColorSpace(args[0].getName()); #else @@ -1305,9 +1305,9 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &args[0], nullptr, nullptr); } else { - colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj, nullptr, nullptr); } #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (obj.isNull()) { @@ -1344,7 +1344,7 @@ void PdfParser::opSetFillColor(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'sc' command"); return; } - state->setFillPattern(NULL); + state->setFillPattern(nullptr); for (i = 0; i < numArgs; ++i) { color.c[i] = dblToCol(args[i].getNum()); } @@ -1360,7 +1360,7 @@ void PdfParser::opSetStrokeColor(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SC' command"); return; } - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); for (i = 0; i < numArgs; ++i) { color.c[i] = dblToCol(args[i].getNum()); } @@ -1391,7 +1391,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { GfxPattern *pattern; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), nullptr, nullptr))) { state->setFillPattern(pattern); builder->updateStyle(state); } @@ -1408,7 +1408,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); return; } - state->setFillPattern(NULL); + state->setFillPattern(nullptr); for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); @@ -1443,7 +1443,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { GfxPattern *pattern; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), nullptr, nullptr))) { state->setStrokePattern(pattern); builder->updateStyle(state); } @@ -1460,7 +1460,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); return; } - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); @@ -1856,16 +1856,16 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat, // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opShFill(Object args[], int /*numArgs*/) { - GfxShading *shading = 0; - GfxPath *savedPath = NULL; + GfxShading *shading = nullptr; + GfxPath *savedPath = nullptr; double xMin, yMin, xMax, yMax; double xTemp, yTemp; double gradientTransform[6]; - double *matrix = NULL; + double *matrix = nullptr; GBool savedState = gFalse; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) - if (!(shading = res->lookupShading(args[0].getName(), NULL, NULL))) { + if (!(shading = res->lookupShading(args[0].getName(), nullptr, nullptr))) { return; } #else @@ -1883,7 +1883,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) // check proper operator sequence // first there should be one W(*) and then one 'cm' somewhere before 'sh' GBool seenClip, seenConcat; - seenClip = (clipHistory->getClipPath() != NULL); + seenClip = (clipHistory->getClipPath() != nullptr); seenConcat = gFalse; int i = 1; while (i <= maxOperatorHistoryDepth) { @@ -1909,7 +1909,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) // clip to bbox if (shading->getHasBBox()) { shading->getBBox(&xMin, &yMin, &xMax, &yMax); - if (matrix != NULL) { + if (matrix != nullptr) { xTemp = matrix[0]*xMin + matrix[2]*yMin + matrix[4]; yTemp = matrix[1]*xMin + matrix[3]*yMin + matrix[5]; state->moveTo(xTemp, yTemp); @@ -2374,7 +2374,7 @@ void PdfParser::opSetFont(Object args[], int /*numArgs*/) if (!font) { // unsetting the font (drawing no text) is better than using the // previous one and drawing random glyphs from it - state->setFont(NULL, args[1].getNum()); + state->setFont(nullptr, args[1].getNum()); fontChanged = gTrue; return; } @@ -2539,7 +2539,7 @@ void PdfParser::opMoveSetShowText(Object args[], int /*numArgs*/) // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) { - Array *a = 0; + Array *a = nullptr; Object obj; int wMode = 0; @@ -2586,7 +2586,7 @@ void PdfParser::doShowText(const GooString *s) { int wMode; double riseX, riseY; CharCode code; - Unicode *u = NULL; + Unicode *u = nullptr; double x, y, dx, dy, tdx, tdy; double originX, originY, tOriginX, tOriginY; double oldCTM[6], newCTM[6]; @@ -3009,7 +3009,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } if (!obj1.isNull()) { #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - colorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj1, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); #else @@ -3022,7 +3022,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } else if (csMode == streamCSDeviceCMYK) { colorSpace = new GfxDeviceCMYKColorSpace(); } else { - colorSpace = NULL; + colorSpace = nullptr; } #if !defined(POPPLER_NEW_OBJECT_API) obj1.free(); @@ -3055,11 +3055,11 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) // get the mask int maskColors[2*gfxColorMaxComps]; haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; - Stream *maskStr = NULL; + Stream *maskStr = nullptr; int maskWidth = 0; int maskHeight = 0; maskInvert = gFalse; - GfxImageColorMap *maskColorMap = NULL; + GfxImageColorMap *maskColorMap = nullptr; #if defined(POPPLER_NEW_OBJECT_API) maskObj = dict->lookup(const_cast<char*>("Mask")); smaskObj = dict->lookup(const_cast<char*>("SMask")); @@ -3180,7 +3180,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } } #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - GfxColorSpace *maskColorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(nullptr, &obj1, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); #else @@ -3355,7 +3355,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); } else { builder->addImage(state, str, width, height, colorMap, interpolate, - haveColorKeyMask ? maskColors : static_cast<int *>(NULL)); + haveColorKeyMask ? maskColors : static_cast<int *>(nullptr)); } delete colorMap; @@ -3468,11 +3468,11 @@ void PdfParser::doForm(Object *str) { #else dict->lookup(const_cast<char*>("Resources"), &resObj); #endif - resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL; + resDict = resObj.isDict() ? resObj.getDict() : (Dict *)nullptr; // check for a transparency group transpGroup = isolated = knockout = gFalse; - blendingColorSpace = NULL; + blendingColorSpace = nullptr; #if defined(POPPLER_NEW_OBJECT_API) if ((obj1 = dict->lookup(const_cast<char*>("Group"))).isDict()) { if ((obj2 = obj1.dictLookup(const_cast<char*>("S"))).isName(const_cast<char*>("Transparency"))) { @@ -3487,7 +3487,7 @@ void PdfParser::doForm(Object *str) { if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) { #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - blendingColorSpace = GfxColorSpace::parse(NULL, &obj3, NULL, NULL); + blendingColorSpace = GfxColorSpace::parse(nullptr, &obj3, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj3, NULL, NULL); #else @@ -3640,7 +3640,7 @@ void PdfParser::opBeginImage(Object /*args*/[], int /*numArgs*/) // display the image if (str) { - doImage(NULL, str, gTrue); + doImage(nullptr, str, gTrue); // skip 'EI' tag int c1 = str->getUndecodedStream()->getChar(); @@ -3701,7 +3701,7 @@ Stream *PdfParser::buildImageStream() { obj.free(); dict.free(); #endif - return NULL; + return nullptr; } #if !defined(POPPLER_NEW_OBJECT_API) obj.free(); @@ -3806,7 +3806,7 @@ void PdfParser::saveState() { bool is_radial = false; GfxPattern *pattern = state->getFillPattern(); - if (pattern != NULL) + if (pattern != nullptr) if (pattern->getType() == 2 ) { GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); GfxShading *shading = shading_pattern->getShading(); @@ -3861,8 +3861,8 @@ void PdfParser::setApproximationPrecision(int shadingType, double colorDelta, //------------------------------------------------------------------------ ClipHistoryEntry::ClipHistoryEntry(GfxPath *clipPathA, GfxClipType clipTypeA) : - saved(NULL), - clipPath((clipPathA) ? clipPathA->copy() : NULL), + saved(nullptr), + clipPath((clipPathA) ? clipPathA->copy() : nullptr), clipType(clipTypeA) { } @@ -3871,7 +3871,7 @@ ClipHistoryEntry::~ClipHistoryEntry() { if (clipPath) { delete clipPath; - clipPath = NULL; + clipPath = nullptr; } } @@ -3884,7 +3884,7 @@ void ClipHistoryEntry::setClip(GfxPath *clipPathA, GfxClipType clipTypeA) { clipPath = clipPathA->copy(); clipType = clipTypeA; } else { - clipPath = NULL; + clipPath = nullptr; clipType = clipNormal; } } @@ -3901,7 +3901,7 @@ ClipHistoryEntry *ClipHistoryEntry::restore() { if (saved) { oldEntry = saved; - saved = NULL; + saved = nullptr; delete this; // TODO really should avoid deleting from inside. } else { oldEntry = this; @@ -3915,10 +3915,10 @@ ClipHistoryEntry::ClipHistoryEntry(ClipHistoryEntry *other) { this->clipPath = other->clipPath->copy(); this->clipType = other->clipType; } else { - this->clipPath = NULL; + this->clipPath = nullptr; this->clipType = clipNormal; } - saved = NULL; + saved = nullptr; } #endif /* HAVE_POPPLER */ diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h index f985b15ca..755e6741b 100644 --- a/src/extension/internal/pdfinput/pdf-parser.h +++ b/src/extension/internal/pdfinput/pdf-parser.h @@ -295,10 +295,10 @@ private: void doForm(Object *str); void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox, GBool transpGroup = gFalse, GBool softMask = gFalse, - GfxColorSpace *blendingColorSpace = NULL, + GfxColorSpace *blendingColorSpace = nullptr, GBool isolated = gFalse, GBool knockout = gFalse, - GBool alpha = gFalse, Function *transferFunc = NULL, - GfxColor *backdropColor = NULL); + GBool alpha = gFalse, Function *transferFunc = nullptr, + GfxColor *backdropColor = nullptr); // in-line image operators void opBeginImage(Object args[], int numArgs); diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 8e5a5f639..59481b9eb 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -109,14 +109,14 @@ SvgBuilder::~SvgBuilder() { } void SvgBuilder::_init() { - _font_style = NULL; - _current_font = NULL; - _font_specification = NULL; + _font_style = nullptr; + _current_font = nullptr; + _font_specification = nullptr; _font_scaling = 1; _need_font_update = true; _in_text_object = false; _invalidated_style = true; - _current_state = NULL; + _current_state = nullptr; _width = 0; _height = 0; @@ -128,9 +128,9 @@ void SvgBuilder::_init() { _availableFontNames.push_back(pango_font_family_get_name(*iter)); } - _transp_group_stack = NULL; + _transp_group_stack = nullptr; SvgGraphicsState initial_state; - initial_state.softmask = NULL; + initial_state.softmask = nullptr; initial_state.group_depth = 0; _state_stack.push_back(initial_state); _node_stack.push_back(_container); @@ -186,7 +186,7 @@ Inkscape::XML::Node *SvgBuilder::pushNode(const char *name) { } Inkscape::XML::Node *SvgBuilder::popNode() { - Inkscape::XML::Node *node = NULL; + Inkscape::XML::Node *node = nullptr; if ( _node_stack.size() > 1 ) { node = _node_stack.back(); _node_stack.pop_back(); @@ -215,7 +215,7 @@ Inkscape::XML::Node *SvgBuilder::pushGroup() { setAsLayer(_docname); } } - if (_container->parent()->attribute("inkscape:groupmode") != NULL) { + if (_container->parent()->attribute("inkscape:groupmode") != nullptr) { _ttm[0] = _ttm[3] = 1.0; // clear ttm if parent is a layer _ttm[1] = _ttm[2] = _ttm[4] = _ttm[5] = 0.0; _ttm_is_set = false; @@ -379,7 +379,7 @@ void SvgBuilder::_setStrokeStyle(SPCSSAttr *css, GfxState *state) { sp_repr_css_set_property(css, "stroke-dashoffset", os_offset.str().c_str()); } else { sp_repr_css_set_property(css, "stroke-dasharray", "none"); - sp_repr_css_set_property(css, "stroke-dashoffset", NULL); + sp_repr_css_set_property(css, "stroke-dashoffset", nullptr); } } @@ -503,7 +503,7 @@ void SvgBuilder::addShadedFill(GfxShading *shading, double *matrix, GfxPath *pat SPObject *clip_obj = _doc->getObjectById(clip_path_id); if (clip_obj) { clip_obj->deleteObject(); - node->setAttribute("clip-path", NULL); + node->setAttribute("clip-path", nullptr); TRACE(("removed clipping path: %s\n", clip_path_id)); } break; @@ -570,7 +570,7 @@ bool SvgBuilder::getTransform(double *transform) { void SvgBuilder::setTransform(double c0, double c1, double c2, double c3, double c4, double c5) { // do not remember the group which is a layer - if ((_container->attribute("inkscape:groupmode") == NULL) && !_ttm_is_set) { + if ((_container->attribute("inkscape:groupmode") == nullptr) && !_ttm_is_set) { _ttm[0] = c0; _ttm[1] = c1; _ttm[2] = c2; @@ -581,7 +581,7 @@ void SvgBuilder::setTransform(double c0, double c1, double c2, double c3, } // Avoid transforming a group with an already set clip-path - if ( _container->attribute("clip-path") != NULL ) { + if ( _container->attribute("clip-path") != nullptr ) { pushGroup(); } TRACE(("setTransform: %f %f %f %f %f %f\n", c0, c1, c2, c3, c4, c5)); @@ -598,7 +598,7 @@ void SvgBuilder::setTransform(double const *transform) { * Used by PdfParser to decide when to do fallback operations. */ bool SvgBuilder::isPatternTypeSupported(GfxPattern *pattern) { - if ( pattern != NULL ) { + if ( pattern != nullptr ) { if ( pattern->getType() == 2 ) { // shading pattern GfxShading *shading = (static_cast<GfxShadingPattern *>(pattern))->getShading(); int shadingType = shading->getType(); @@ -622,8 +622,8 @@ bool SvgBuilder::isPatternTypeSupported(GfxPattern *pattern) { * \return a url pointing to the created pattern */ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_stroke) { - gchar *id = NULL; - if ( pattern != NULL ) { + gchar *id = nullptr; + if ( pattern != nullptr ) { if ( pattern->getType() == 2 ) { // Shading pattern GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); double *ptm; @@ -656,7 +656,7 @@ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_ id = _createTilingPattern(static_cast<GfxTilingPattern*>(pattern), state, is_stroke); } } else { - return NULL; + return nullptr; } gchar *urltext = g_strdup_printf ("url(#%s)", id); g_free(id); @@ -719,7 +719,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxPatternColorSpace *pat_cs = (GfxPatternColorSpace *)( is_stroke ? state->getStrokeColorSpace() : state->getFillColorSpace() ); // Set fill/stroke colors if this is an uncolored tiling pattern - GfxColorSpace *cs = NULL; + GfxColorSpace *cs = nullptr; if ( tiling_pattern->getPaintType() == 2 && ( cs = pat_cs->getUnder() ) ) { GfxState *pattern_state = pdf_parser->getState(); pattern_state->setFillColorSpace(cs->copy()); @@ -785,7 +785,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for num_funcs = radial_shading->getNFuncs(); func = radial_shading->getFunc(0); } else { // Unsupported shading type - return NULL; + return nullptr; } gradient->setAttribute("gradientUnits", "userSpaceOnUse"); // If needed, flip the gradient transform around the y axis @@ -807,7 +807,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for if ( num_funcs > 1 || !_addGradientStops(gradient, shading, func) ) { Inkscape::GC::release(gradient); - return NULL; + return nullptr; } Inkscape::XML::Node *defs = _doc->getDefs()->getRepr(); @@ -827,8 +827,8 @@ void SvgBuilder::_addStopToGradient(Inkscape::XML::Node *gradient, double offset Inkscape::XML::Node *stop = _xml_doc->createElement("svg:stop"); SPCSSAttr *css = sp_repr_css_attr_new(); Inkscape::CSSOStringStream os_opacity; - gchar *color_text = NULL; - if ( _transp_group_stack != NULL && _transp_group_stack->for_softmask ) { + gchar *color_text = nullptr; + if ( _transp_group_stack != nullptr && _transp_group_stack->for_softmask ) { double gray = (double)color->r / 65535.0; gray = CLAMP(gray, 0.0, 1.0); os_opacity << gray; @@ -1028,9 +1028,9 @@ void SvgBuilder::updateFont(GfxState *state) { // Prune the font name to get the correct font family name // In a PDF font names can look like this: IONIPB+MetaPlusBold-Italic - char *font_family = NULL; - char *font_style = NULL; - char *font_style_lowercase = NULL; + char *font_family = nullptr; + char *font_style = nullptr; + char *font_style_lowercase = nullptr; char *plus_sign = strstr(_font_specification, "+"); if (plus_sign) { font_family = g_strdup(plus_sign + 1); @@ -1038,7 +1038,7 @@ void SvgBuilder::updateFont(GfxState *state) { } else { font_family = g_strdup(_font_specification); } - char *style_delim = NULL; + char *style_delim = nullptr; if ( ( style_delim = g_strrstr(font_family, "-") ) || ( style_delim = g_strrstr(font_family, ",") ) ) { font_style = style_delim + 1; @@ -1077,7 +1077,7 @@ void SvgBuilder::updateFont(GfxState *state) { // Font weight GfxFont::Weight font_weight = font->getWeight(); - char *css_font_weight = NULL; + char *css_font_weight = nullptr; if ( font_weight != GfxFont::WeightNotDefined ) { if ( font_weight == GfxFont::W400 ) { css_font_weight = (char*) "normal"; @@ -1109,7 +1109,7 @@ void SvgBuilder::updateFont(GfxState *state) { // Font stretch GfxFont::Stretch font_stretch = font->getStretch(); - gchar *stretch_value = NULL; + gchar *stretch_value = nullptr; switch (font_stretch) { case GfxFont::UltraCondensed: stretch_value = (char*) "ultra-condensed"; @@ -1141,7 +1141,7 @@ void SvgBuilder::updateFont(GfxState *state) { default: break; } - if ( stretch_value != NULL ) { + if ( stretch_value != nullptr ) { sp_repr_css_set_property(_font_style, "font-stretch", stretch_value); } @@ -1250,7 +1250,7 @@ void SvgBuilder::_flushText() { bool same_coords[2] = {true, true}; Geom::Point last_delta_pos; unsigned int glyphs_in_a_row = 0; - Inkscape::XML::Node *tspan_node = NULL; + Inkscape::XML::Node *tspan_node = nullptr; Glib::ustring x_coords; Glib::ustring y_coords; Glib::ustring text_buffer; @@ -1415,7 +1415,7 @@ void SvgBuilder::addChar(GfxState *state, double x, double y, uu[i] = u[i]; } - gchar *tmp = g_utf16_to_utf8(uu, uLen, NULL, NULL, NULL); + gchar *tmp = g_utf16_to_utf8(uu, uLen, nullptr, nullptr, nullptr); if ( tmp && *tmp ) { new_glyph.code = tmp; } else { @@ -1492,20 +1492,20 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height bool invert_alpha) { // Create PNG write struct - png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if ( png_ptr == NULL ) { - return NULL; + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if ( png_ptr == nullptr ) { + return nullptr; } // Create PNG info struct png_infop info_ptr = png_create_info_struct(png_ptr); - if ( info_ptr == NULL ) { - png_destroy_write_struct(&png_ptr, NULL); - return NULL; + if ( info_ptr == nullptr ) { + png_destroy_write_struct(&png_ptr, nullptr); + return nullptr; } // Set error handler if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); - return NULL; + return nullptr; } // Decide whether we should embed this image int attr_value = 1; @@ -1514,8 +1514,8 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height // Set read/write functions Inkscape::IO::StringOutputStream base64_string; Inkscape::IO::Base64OutputStream base64_stream(base64_string); - FILE *fp = NULL; - gchar *file_name = NULL; + FILE *fp = nullptr; + gchar *file_name = nullptr; if (embed_image) { base64_stream.setColumnWidth(0); // Disable line breaks png_set_write_fn(png_ptr, &base64_stream, png_write_base64stream, png_flush_base64stream); @@ -1523,10 +1523,10 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height static int counter = 0; file_name = g_strdup_printf("%s_img%d.png", _docname, counter++); fp = fopen(file_name, "wb"); - if ( fp == NULL ) { + if ( fp == nullptr ) { png_destroy_write_struct(&png_ptr, &info_ptr); g_free(file_name); - return NULL; + return nullptr; } png_init_io(png_ptr, fp); } @@ -1646,7 +1646,7 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height fclose(fp); g_free(file_name); } - return NULL; + return nullptr; } delete image_stream; str->close(); @@ -1712,7 +1712,7 @@ Inkscape::XML::Node *SvgBuilder::_createMask(double width, double height) { if ( !( defs && !strcmp(defs->name(), "svg:defs") ) ) { // Create <defs> node defs = _xml_doc->createElement("svg:defs"); - _root->addChild(defs, NULL); + _root->addChild(defs, nullptr); Inkscape::GC::release(defs); defs = _root->firstChild(); } @@ -1754,12 +1754,12 @@ void SvgBuilder::addImageMask(GfxState *state, Stream *str, int width, int heigh // Scaling 1x1 surfaces might not work so skip setting a mask with this size if ( width > 1 || height > 1 ) { Inkscape::XML::Node *mask_image_node = - _createImage(str, width, height, NULL, interpolate, NULL, true, invert); + _createImage(str, width, height, nullptr, interpolate, nullptr, true, invert); if (mask_image_node) { // Create the mask Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); Inkscape::GC::release(mask_image_node); gchar *mask_url = g_strdup_printf("url(#%s)", mask_node->attribute("id")); @@ -1779,13 +1779,13 @@ void SvgBuilder::addMaskedImage(GfxState * /*state*/, Stream *str, int width, in bool invert_mask, bool mask_interpolate) { Inkscape::XML::Node *mask_image_node = _createImage(mask_str, mask_width, mask_height, - NULL, mask_interpolate, NULL, true, invert_mask); - Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, NULL); + nullptr, mask_interpolate, nullptr, true, invert_mask); + Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, nullptr); if ( mask_image_node && image_node ) { // Create mask for the image Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); // Scale the mask to the size of the image Geom::Affine mask_transform((double)width, 0.0, 0.0, (double)height, 0.0, 0.0); @@ -1812,13 +1812,13 @@ void SvgBuilder::addSoftMaskedImage(GfxState * /*state*/, Stream *str, int width GfxImageColorMap *mask_color_map, bool mask_interpolate) { Inkscape::XML::Node *mask_image_node = _createImage(mask_str, mask_width, mask_height, - mask_color_map, mask_interpolate, NULL, true); - Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, NULL); + mask_color_map, mask_interpolate, nullptr, true); + Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, nullptr); if ( mask_image_node && image_node ) { // Create mask for the image Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); // Set mask and add image gchar *mask_url = g_strdup_printf("url(#%s)", mask_node->attribute("id")); @@ -1902,7 +1902,7 @@ void SvgBuilder::setSoftMask(GfxState * /*state*/, double * /*bbox*/, bool /*alp void SvgBuilder::clearSoftMask(GfxState * /*state*/) { if (_state_stack.back().softmask) { - _state_stack.back().softmask = NULL; + _state_stack.back().softmask = nullptr; popGroup(); } } diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index ed2a4d48e..499724a4c 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -94,7 +94,7 @@ public: // Property setting void setDocumentSize(double width, double height); // Document size in px - void setAsLayer(char *layer_name=NULL); + void setAsLayer(char *layer_name=nullptr); void setGroupOpacity(double opacity); Inkscape::XML::Node *getPreferences() { return _preferences; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 15acb97ec..2215fbb3e 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -59,11 +59,11 @@ namespace Internal static void err(const char *fmt, ...) { va_list args; - g_log(NULL, G_LOG_LEVEL_WARNING, "Pov-out err: "); + g_log(nullptr, G_LOG_LEVEL_WARNING, "Pov-out err: "); va_start(args, fmt); - g_logv(NULL, G_LOG_LEVEL_WARNING, fmt, args); + g_logv(nullptr, G_LOG_LEVEL_WARNING, fmt, args); va_end(args); - g_log(NULL, G_LOG_LEVEL_WARNING, "\n"); + g_log(nullptr, G_LOG_LEVEL_WARNING, "\n"); } @@ -211,7 +211,7 @@ void PovOutput::segment(int segNr, */ bool PovOutput::doHeader() { - time_t tim = time(NULL); + time_t tim = time(nullptr); out("/*###################################################################\n"); out("### This PovRay document was generated by Inkscape\n"); out("### http://www.inkscape.org\n"); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index c4e12c174..f4e28e7ed 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -76,7 +76,7 @@ static void pruneExtendedNamespaces( Inkscape::XML::Node *repr ) } // Can't change the set we're interating over while we are iterating. for ( std::vector<gchar const*>::iterator it = attrsRemoved.begin(); it != attrsRemoved.end(); ++it ) { - repr->setAttribute(*it, 0); + repr->setAttribute(*it, nullptr); } } @@ -225,11 +225,11 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) prefs->setBool("/dialogs/import/ask", !mod->get_param_bool("do_not_ask") ); } - SPDocument * doc = SPDocument::createNewDoc (NULL, TRUE, TRUE); + SPDocument * doc = SPDocument::createNewDoc (nullptr, TRUE, TRUE); if (link_svg.compare("include") != 0 && is_import) { bool embed = ( link_svg.compare( "embed" ) == 0 ); SPDocument * ret = SPDocument::createNewDoc(uri, TRUE); - SPNamedView *nv = sp_document_namedview(doc, NULL); + SPNamedView *nv = sp_document_namedview(doc, nullptr); Glib::ustring display_unit = nv->display_units->abbr; if (display_unit.empty()) { display_unit = "px"; @@ -259,7 +259,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) sp_embed_svg(image_node, uri); } } else { - gchar* _uri = g_filename_to_uri(uri, NULL, NULL); + gchar* _uri = g_filename_to_uri(uri, nullptr, nullptr); if(_uri) { image_node->setAttribute("xlink:href", _uri); g_free(_uri); @@ -292,7 +292,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) return SPDocument::createNewDocFromMem(contents, length, 1); } catch (Gio::Error &e) { g_warning("Could not load contents of non-local URI %s\n", uri); - return NULL; + return nullptr; } } else { uri = path.c_str(); @@ -329,8 +329,8 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) void Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { - g_return_if_fail(doc != NULL); - g_return_if_fail(filename != NULL); + g_return_if_fail(doc != nullptr); + g_return_if_fail(filename != nullptr); Inkscape::XML::Document *rdoc = doc->rdoc; bool const exportExtensions = ( !mod->get_id() diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index b650e2876..765e67648 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -245,7 +245,7 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #endif if (!libvisio::VisioDocument::isSupported(&input)) { - return NULL; + return nullptr; } RVNGStringVector output; @@ -256,11 +256,11 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #else if (!libvisio::VisioDocument::generateSVG(&input, output)) { #endif - return NULL; + return nullptr; } if (output.empty()) { - return NULL; + return nullptr; } std::vector<RVNGString> tmpSVGOutput; @@ -274,12 +274,12 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // If only one page is present, import that one without bothering user if (tmpSVGOutput.size() > 1) { - VsdImportDialog *dlg = 0; + VsdImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new VsdImportDialog(tmpSVGOutput); if (!dlg->showDialog()) { delete dlg; - return NULL; + return nullptr; } } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 45f59ec03..5941aaf1e 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -82,7 +82,7 @@ Wmf::~Wmf (void) //The destructor bool Wmf::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(PRINT_WMF)) + if (nullptr == Inkscape::Extension::db.get(PRINT_WMF)) return FALSE; return TRUE; } @@ -121,8 +121,8 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // deleted by invoke_hide /* end */ mod->set_param_string("destination", oldoutput); @@ -138,7 +138,7 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_WMF); - if (ext == NULL) + if (ext == nullptr) return; bool new_val = mod->get_param_bool("textToPath"); @@ -162,7 +162,7 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("textToPath", new_val); // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); print_document_to_file(doc, filename); @@ -452,11 +452,11 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa int dibparams = U_BI_UNKNOWN; // type of image not yet determined MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table uint32_t numCt; int32_t width, height, colortype, invert; // if needed these values will be set by wget_DIB_params if(iUsage == U_DIB_RGB_COLORS){ @@ -484,7 +484,7 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG || dibparams==U_BI_PNG){ // image was binary png or jpg in source file base64String = g_base64_encode((guchar*) px, numCt ); } @@ -551,10 +551,10 @@ uint32_t Wmf::add_bm16_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char * char xywh[64]; // big enough MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const U_RGBQUAD *ct = NULL; // color table, always NULL here + char *rgba_px = nullptr; // RGBA pixels + const U_RGBQUAD *ct = nullptr; // color table, always NULL here int32_t width, height, colortype, numCt, invert; numCt = 0; width = Bm16.Width; // bitmap width in pixels. @@ -582,7 +582,7 @@ uint32_t Wmf::add_bm16_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char * free(rgba_px); } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(mempng.buffer){ // image was Bm16 in source file, converted to png in this routine base64String = g_base64_encode((guchar*) mempng.buffer, mempng.size ); free(mempng.buffer); @@ -658,7 +658,7 @@ int Wmf::in_clips(PWMF_CALLBACK_DATA d, const char *test){ void Wmf::add_clips(PWMF_CALLBACK_DATA d, const char *clippath, unsigned int logic){ int op = combine_ops_to_livarot(logic); Geom::PathVector combined_vect; - char *combined = NULL; + char *combined = nullptr; if (op >= 0 && d->dc[d->level].clip_id) { unsigned int real_idx = d->dc[d->level].clip_id - 1; Geom::PathVector old_vect = sp_svg_read_pathv(d->clips.strings[real_idx]); @@ -967,7 +967,7 @@ void Wmf::select_pen(PWMF_CALLBACK_DATA d, int index) { int width; - char *record = NULL; + char *record = nullptr; U_PEN up; if (index < 0 && index >= d->n_obj){ return; } @@ -1153,7 +1153,7 @@ Wmf::select_brush(PWMF_CALLBACK_DATA d, int index) void Wmf::select_font(PWMF_CALLBACK_DATA d, int index) { - char *record = NULL; + char *record = nullptr; const char *memfont; const char *facename; U_FONT font; @@ -1221,7 +1221,7 @@ Wmf::select_font(PWMF_CALLBACK_DATA d, int index) int Wmf::insertable_object(PWMF_CALLBACK_DATA d) { int index = d->low_water; // Start looking from here, it may already have been filled - while(index < d->n_obj && d->wmf_obj[index].record != NULL){ index++; } + while(index < d->n_obj && d->wmf_obj[index].record != nullptr){ index++; } if(index >= d->n_obj)return(-1); // this is a big problem, percolate it back up so the program can get out of this gracefully d->low_water = index; // Could probably be index+1 return(index); @@ -1265,7 +1265,7 @@ Wmf::delete_object(PWMF_CALLBACK_DATA d, int index) // files too big to fit into memory. if (d->wmf_obj[index].record) free(d->wmf_obj[index].record); - d->wmf_obj[index].record = NULL; + d->wmf_obj[index].record = nullptr; if(index < d->low_water)d->low_water = index; } } @@ -1321,12 +1321,12 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib, tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // color table uint32_t numCt; int32_t width, height, colortype, invert; // if needed these values will be set in wget_DIB_params if(iUsage == U_DIB_RGB_COLORS){ @@ -1367,7 +1367,7 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib, } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG){ // image was binary jpg in source file tmp_image << " xlink:href=\"data:image/jpeg;base64,"; base64String = g_base64_encode((guchar*) px, numCt ); @@ -1422,11 +1422,11 @@ void Wmf::common_bm16_to_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const U_RGBQUAD *ct = NULL; // color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const U_RGBQUAD *ct = nullptr; // color table int32_t width, height, colortype, numCt, invert; numCt = 0; @@ -1470,7 +1470,7 @@ void Wmf::common_bm16_to_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char free(sub_px); } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(mempng.buffer){ // image was Bm16 in source file, converted to png in this routine tmp_image << " xlink:href=\"data:image/png;base64,"; base64String = g_base64_encode((guchar*) mempng.buffer, mempng.size ); @@ -1541,14 +1541,14 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK int wDbgComment=0; int wDbgFinal=0; char const* wDbgString = getenv( "INKSCAPE_DBG_WMF" ); - if ( wDbgString != NULL ) { + if ( wDbgString != nullptr ) { if(strstr(wDbgString,"RECORD")){ wDbgRecord = 1; } if(strstr(wDbgString,"COMMENT")){ wDbgComment = 1; } if(strstr(wDbgString,"FINAL")){ wDbgFinal = 1; } } /* initialize the tsp for text reassembly */ - tsp.string = NULL; + tsp.string = nullptr; tsp.ori = 0.0; /* degrees */ tsp.fs = 12.0; /* font size */ tsp.x = 0.0; @@ -1592,10 +1592,10 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK // Init the new wmf_obj list elements to null, provided the // dynamic allocation succeeded. - if ( d->wmf_obj != NULL ) + if ( d->wmf_obj != nullptr ) { for( int i=0; i < d->n_obj; ++i ) - d->wmf_obj[i].record = NULL; + d->wmf_obj[i].record = nullptr; } //if if(!Placeable.Inch){ Placeable.Inch= 1440; } @@ -2445,7 +2445,7 @@ std::cout << "BEFORE DRAW" } if(d->dc[old_level].font_name){ free(d->dc[old_level].font_name); // else memory leak - d->dc[old_level].font_name = NULL; + d->dc[old_level].font_name = nullptr; } old_level--; } @@ -2557,9 +2557,9 @@ std::cout << "BEFORE DRAW" /* Rotation issues are handled entirely in libTERE now */ - uint32_t *dup_wt = NULL; + uint32_t *dup_wt = nullptr; - dup_wt = U_Latin1ToUtf32le(text, cChars, NULL); + dup_wt = U_Latin1ToUtf32le(text, cChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(cChars); msdepua(dup_wt); //convert everything in Microsoft's private use area. For Symbol, Wingdings, Dingbats @@ -2570,12 +2570,12 @@ std::cout << "BEFORE DRAW" } char *ansi_text; - ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, NULL); + ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, nullptr); free(dup_wt); // Empty text or starts with an invalid escape/control sequence, which is bogus text. Throw it out before g_markup_escape_text can make things worse if(*((uint8_t *)ansi_text) <= 0x1F){ free(ansi_text); - ansi_text=NULL; + ansi_text=nullptr; } if (ansi_text) { @@ -3101,18 +3101,18 @@ SPDocument * Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { - if (uri == NULL) { - return NULL; + if (uri == nullptr) { + return nullptr; } // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); WMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt - d.wmf_obj=NULL; + d.wmf_obj=nullptr; // Default font, WMF spec says device can pick whatever it wants. // WMF files that do not specify a font are unlikely to look very good! @@ -3150,10 +3150,10 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) size_t length; char *contents; - if(wmf_readdata(uri, &contents, &length))return(NULL); + if(wmf_readdata(uri, &contents, &length))return(nullptr); // set up the text reassembly system - if(!(d.tri = trinfo_init(NULL)))return(NULL); + if(!(d.tri = trinfo_init(nullptr)))return(nullptr); (void) trinfo_load_ft_opts(d.tri, 1, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); @@ -3163,7 +3163,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = NULL; + SPDocument *doc = nullptr; if (good) { doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); } diff --git a/src/extension/internal/wmf-inout.h b/src/extension/internal/wmf-inout.h index 02280f6d8..a9831a7c6 100644 --- a/src/extension/internal/wmf-inout.h +++ b/src/extension/internal/wmf-inout.h @@ -30,7 +30,7 @@ typedef struct wmf_object { wmf_object() : type(0), level(0), - record(NULL) + record(nullptr) {}; int type; int level; @@ -41,7 +41,7 @@ typedef struct wmf_strings { wmf_strings() : size(0), count(0), - strings(NULL) + strings(nullptr) {}; int size; // number of slots allocated in strings int count; // number of slots used in strings @@ -51,7 +51,7 @@ typedef struct wmf_strings { typedef struct wmf_device_context { wmf_device_context() : // SPStyle: class with constructor - font_name(NULL), + font_name(nullptr), clip_id(0), stroke_set(false), stroke_mode(0), stroke_idx(0), stroke_recidx(0), fill_set(false), fill_mode(0), fill_idx(0), fill_recidx(0), @@ -65,7 +65,7 @@ typedef struct wmf_device_context { textAlign(0) // worldTransform, cur { - font_name = NULL; + font_name = nullptr; sizeWnd = point16_set( 0.0, 0.0 ); sizeView = point16_set( 0.0, 0.0 ); winorg = point16_set( 0.0, 0.0 ); @@ -126,7 +126,7 @@ typedef struct wmf_callback_data { dwRop2(U_R2_COPYPEN), dwRop3(0), id(0), drawtype(0), // hatches, images, gradients, struct w/ constructor - tri(NULL), + tri(nullptr), n_obj(0), low_water(0) //wmf_obj diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index cdc59298b..d98d28b09 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -77,8 +77,8 @@ namespace Internal { /* globals */ static double PX2WORLD; // value set in begin() static bool FixPPTCharPos, FixPPTDashLine, FixPPTGrad2Polys, FixPPTPatternAsHatch; -static WMFTRACK *wt = NULL; -static WMFHANDLES *wht = NULL; +static WMFTRACK *wt = nullptr; +static WMFHANDLES *wht = nullptr; void PrintWmf::smuggle_adxky_out(const char *string, int16_t **adx, double *ky, int *rtl, int *ndx, float scale) { @@ -87,7 +87,7 @@ void PrintWmf::smuggle_adxky_out(const char *string, int16_t **adx, double *ky, int16_t *ladx; const char *cptr = &string[strlen(string) + 1]; // this works because of the first fake terminator - *adx = NULL; + *adx = nullptr; *ky = 0.0; // set a default value sscanf(cptr, "%7d", ndx); if (!*ndx) { @@ -403,8 +403,8 @@ int PrintWmf::create_brush(SPStyle const *style, U_COLORREF *fcolor) } else if (SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style))) { // must be a gradient // currently we do not do anything with gradients, the code below just sets the color to the average of the stops SPPaintServer *paintserver = style->fill.value.href->getObject(); - SPLinearGradient *lg = NULL; - SPRadialGradient *rg = NULL; + SPLinearGradient *lg = nullptr; + SPRadialGradient *rg = nullptr; if (SP_IS_LINEARGRADIENT(paintserver)) { lg = SP_LINEARGRADIENT(paintserver); @@ -524,7 +524,7 @@ void PrintWmf::destroy_brush() int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) { - char *rec = NULL; + char *rec = nullptr; uint32_t pen; uint32_t penstyle; U_COLORREF penColor; @@ -642,7 +642,7 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) // delete the defined pen object void PrintWmf::destroy_pen() { - char *rec = NULL; + char *rec = nullptr; // WMF lets any object be deleted whenever, and the chips fall where they may... if (hpen) { rec = wdeleteobject_set(&hpen, wht); @@ -676,7 +676,7 @@ unsigned int PrintWmf::fill( fill_transform = tf; - if (create_brush(style, NULL)) { + if (create_brush(style, nullptr)) { /* Handle gradients. Uses modified livarot as 2geom boolops is currently broken. Can handle gradients with multiple stops. @@ -861,7 +861,7 @@ unsigned int PrintWmf::stroke( Geom::OptRect const &/*pbox*/, Geom::OptRect const &/*dbox*/, Geom::OptRect const &/*bbox*/) { - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); use_stroke = true; @@ -940,7 +940,7 @@ bool PrintWmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff int moves = 0; int lines = 0; int curves = 0; - char *rec = NULL; + char *rec = nullptr; for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { moves++; @@ -1126,7 +1126,7 @@ unsigned int PrintWmf::image( SPStyle const * /*style*/) /** provides indirect link to image object */ { double x1, y1, dw, dh; - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); rec = U_WMRSETSTRETCHBLTMODE_set(U_COLORONCOLOR); @@ -1189,7 +1189,7 @@ unsigned int PrintWmf::image( // may also be called with a simple_shape or an empty path, whereupon it just returns without doing anything unsigned int PrintWmf::print_pathv(Geom::PathVector const &pathv, const Geom::Affine &transform) { - char *rec = NULL; + char *rec = nullptr; U_POINT16 *pt16hold, *pt16ptr; uint16_t *n16hold; uint16_t *n16ptr; @@ -1349,7 +1349,7 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te return 0; } - char *rec = NULL; + char *rec = nullptr; int ccount, newfont; int fix90n = 0; uint32_t hfont = 0; @@ -1379,14 +1379,14 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } char *text2 = strdup(text); // because U_Utf8ToUtf16le calls iconv which does not like a const char * - uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, NULL); + uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, nullptr); free(text2); //translates Unicode as Utf16le to NonUnicode, if possible. If any translate, all will, and all to //the same font, because of code in Layout::print UnicodeToNon(unicode_text, &ccount, &newfont); // The preceding hopefully handled conversions to symbol, wingdings or zapf dingbats. Now slam everything // else down into latin1, which is all WMF can handle. If the language isn't English expect terrible results. - char *latin1_text = U_Utf16leToLatin1(unicode_text, 0, NULL); + char *latin1_text = U_Utf16leToLatin1(unicode_text, 0, nullptr); free(unicode_text); // in some cases a UTF string may reduce to NO latin1 characters, which returns NULL @@ -1439,9 +1439,9 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te // of the special fonts. char *facename; if (!newfont) { - facename = U_Utf8ToLatin1(style->font_family.value, 0, NULL); + facename = U_Utf8ToLatin1(style->font_family.value, 0, nullptr); } else { - facename = U_Utf8ToLatin1(FontName(newfont), 0, NULL); + facename = U_Utf8ToLatin1(FontName(newfont), 0, nullptr); } // Scale the text to the minimum stretch. (It tends to stay within bounding rectangles even if diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 2f3bfe27b..0953e5696 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -111,7 +111,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); // printf("I'm giving up not supported\n"); delete input; - return NULL; + return nullptr; } #if WITH_LIBWPG03 @@ -120,7 +120,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u if (!libwpg::WPGraphics::parse(input, &generator) || vec.empty() || vec[0].empty()) { delete input; - return NULL; + return nullptr; } RVNGString output("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"); diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp index 164a5cecf..7761b79bd 100644 --- a/src/extension/loader.cpp +++ b/src/extension/loader.cpp @@ -26,9 +26,9 @@ typedef const gchar *(*_getInkscapeVersion)(void); bool Loader::load_dependency(Dependency *dep) { - GModule *module = NULL; + GModule *module = nullptr; module = g_module_open(dep->get_name(), (GModuleFlags)0); - if (module == NULL) { + if (module == nullptr) { return false; } return true; @@ -47,7 +47,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum Inkscape::XML::Node *child_repr = repr->firstChild(); // Iterate over the xml content - while (child_repr != NULL) { + while (child_repr != nullptr) { char const *chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -62,7 +62,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // Could not load dependency, we abort const char *res = g_module_error(); g_warning("Unable to load dependency %s of plugin %s.\nDetails: %s\n", dep.get_name(), "<todo>", res); - return NULL; + return nullptr; } } @@ -71,20 +71,20 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // The name of the plugin is actually the library file we want to load if (const gchar *name = child_repr->attribute("name")) { - GModule *module = NULL; - _getImplementation GetImplementation = NULL; - _getInkscapeVersion GetInkscapeVersion = NULL; + GModule *module = nullptr; + _getImplementation GetImplementation = nullptr; + _getInkscapeVersion GetInkscapeVersion = nullptr; // build the path where to look for the plugin - gchar *path = g_build_filename(_baseDirectory.c_str(), name, (char *) NULL); + gchar *path = g_build_filename(_baseDirectory.c_str(), name, (char *) nullptr); module = g_module_open(path, G_MODULE_BIND_LOCAL); g_free(path); - if (module == NULL) { + if (module == nullptr) { // we were not able to load the plugin, write warning and abort const char *res = g_module_error(); g_warning("Unable to load extension %s.\nDetails: %s\n", name, res); - return NULL; + return nullptr; } // Get a handle to the version function of the module @@ -92,7 +92,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // This didn't work, write warning and abort const char *res = g_module_error(); g_warning("Unable to load extension %s.\nDetails: %s\n", name, res); - return NULL; + return nullptr; } // Get a handle to the function that delivers the implementation @@ -100,7 +100,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // This didn't work, write warning and abort const char *res = g_module_error(); g_warning("Unable to load extension %s.\nDetails: %s\n", name, res); - return NULL; + return nullptr; } // Get version and test against this version @@ -121,7 +121,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum } catch (std::exception &e) { g_warning("Unable to load extension."); } - return NULL; + return nullptr; } } // namespace Extension diff --git a/src/extension/output.cpp b/src/extension/output.cpp index 50b00f972..d6f95c19a 100644 --- a/src/extension/output.cpp +++ b/src/extension/output.cpp @@ -37,21 +37,21 @@ namespace Extension { */ Output::Output (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : Extension(in_repr, in_imp) { - mimetype = NULL; - extension = NULL; - filetypename = NULL; - filetypetooltip = NULL; + mimetype = nullptr; + extension = nullptr; + filetypename = nullptr; + filetypetooltip = nullptr; dataloss = TRUE; - if (repr != NULL) { + if (repr != nullptr) { Inkscape::XML::Node * child_repr; child_repr = repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "output")) { child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -115,9 +115,9 @@ Output::~Output (void) bool Output::check (void) { - if (extension == NULL) + if (extension == nullptr) return FALSE; - if (mimetype == NULL) + if (mimetype == nullptr) return FALSE; return Extension::check(); @@ -150,7 +150,7 @@ Output::get_extension(void) gchar * Output::get_filetypename(void) { - if (filetypename != NULL) + if (filetypename != nullptr) return filetypename; else return get_name(); @@ -181,7 +181,7 @@ Output::prefs (void) Gtk::Widget * controls; controls = imp->prefs_output(this); - if (controls == NULL) { + if (controls == nullptr) { // std::cout << "No preferences for Output" << std::endl; return true; } diff --git a/src/extension/output.h b/src/extension/output.h index c28706cf4..4f2924852 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -34,7 +34,7 @@ public: class export_id_not_found { /**< The object ID requested for export could not be found in the document */ public: const gchar * const id; - export_id_not_found(const gchar * const id = NULL) : id{id} {}; + export_id_not_found(const gchar * const id = nullptr) : id{id} {}; }; Output (Inkscape::XML::Node * in_repr, diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 80bc89138..eea660f69 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -33,12 +33,12 @@ ParamBool::ParamBool(const gchar * name, : Parameter(name, text, description, hidden, indent, ext) , _value(false) { - const char * defaultval = NULL; - if (xml->firstChild() != NULL) { + const char * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } - if (defaultval != NULL && (!strcmp(defaultval, "true") || !strcmp(defaultval, "1"))) { + if (defaultval != nullptr && (!strcmp(defaultval, "true") || !strcmp(defaultval, "1"))) { _value = true; } else { _value = false; @@ -85,7 +85,7 @@ public: */ ParamBoolCheckButton (ParamBool * param, gchar * label, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::CheckButton(label), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { - this->set_active(_pref->get(NULL, NULL) /**\todo fix */); + this->set_active(_pref->get(nullptr, nullptr) /**\todo fix */); this->signal_toggled().connect(sigc::mem_fun(this, &ParamBoolCheckButton::on_toggle)); return; } @@ -106,8 +106,8 @@ private: void ParamBoolCheckButton::on_toggle(void) { - _pref->set(this->get_active(), NULL /**\todo fix this */, NULL); - if (_changeSignal != NULL) { + _pref->set(this->get_active(), nullptr /**\todo fix this */, nullptr); + if (_changeSignal != nullptr) { _changeSignal->emit(); } return; @@ -127,7 +127,7 @@ void ParamBool::string(std::string &string) const Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 035c43ba8..1e3b1dc4c 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -60,10 +60,10 @@ ParamColor::ParamColor(const gchar * name, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : Parameter(name, text, description, hidden, indent, ext) - , _changeSignal(0) + , _changeSignal(nullptr) { - const char * defaulthex = NULL; - if (xml->firstChild() != NULL) + const char * defaulthex = nullptr; + if (xml->firstChild() != nullptr) defaulthex = xml->firstChild()->content(); gchar * pref_name = this->pref_name(); @@ -92,7 +92,7 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * { using Inkscape::UI::Widget::ColorNotebook; - if (_hidden) return NULL; + if (_hidden) return nullptr; if (changeSignal) { _changeSignal = new sigc::signal<void>(*changeSignal); diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index cf94918f7..d795514c3 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -37,15 +37,15 @@ ParamDescription::ParamDescription(const gchar * name, Inkscape::XML::Node * xml, AppearanceMode mode) : Parameter(name, text, description, hidden, indent, ext) - , _value(NULL) + , _value(nullptr) , _mode(mode) { // construct the text content by concatenating all (non-empty) text nodes, // removing all other nodes (e.g. comment nodes) and replacing <extension:br> elements with "<br/>" Glib::ustring value; Inkscape::XML::Node * cur_child = xml->firstChild(); - while (cur_child != NULL) { - if (cur_child->type() == XML::TEXT_NODE && cur_child->content() != NULL) { + while (cur_child != nullptr) { + if (cur_child->type() == XML::TEXT_NODE && cur_child->content() != nullptr) { value += cur_child->content(); } else if (cur_child->type() == XML::ELEMENT_NODE && !g_strcmp0(cur_child->name(), "extension:br")) { value += "<br/>"; @@ -71,8 +71,8 @@ ParamDescription::ParamDescription(const gchar * name, // translate if underscored version (_param) was used if (g_str_has_prefix(xml->name(), "extension:_")) { const gchar * context = xml->attribute("msgctxt"); - if (context != NULL) { - value = g_dpgettext2(NULL, context, value.c_str()); + if (context != nullptr) { + value = g_dpgettext2(nullptr, context, value.c_str()); } else { value = _(value.c_str()); } @@ -91,10 +91,10 @@ Gtk::Widget * ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/) { if (_hidden) { - return NULL; + return nullptr; } - if (_value == NULL) { - return NULL; + if (_value == nullptr) { + return nullptr; } Glib::ustring newtext = _value; diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index ddcbb358b..c5ee5f6b9 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -39,27 +39,27 @@ ParamComboBox::ParamComboBox(const gchar * name, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : Parameter(name, text, description, hidden, indent, ext) - , _value(NULL) + , _value(nullptr) { - const char *xmlval = NULL; // the value stored in XML + const char *xmlval = nullptr; // the value stored in XML - if (xml != NULL) { + if (xml != nullptr) { // Read XML tree to add enumeration items: for (Inkscape::XML::Node *node = xml->firstChild(); node; node = node->next()) { char const * chname = node->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "item") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) { Glib::ustring newtext, newvalue; - const char * contents = NULL; + const char * contents = nullptr; if (node->firstChild()) { contents = node->firstChild()->content(); } - if (contents != NULL) { + if (contents != nullptr) { // don't translate when 'item' but do translate when '_item' // NOTE: internal extensions use build_from_mem and don't need _item but // still need to include if are to be localized if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) { - if (node->attribute("msgctxt") != NULL) { - newtext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents); + if (node->attribute("msgctxt") != nullptr) { + newtext = g_dpgettext2(nullptr, node->attribute("msgctxt"), contents); } else { newtext = _(contents); } @@ -70,7 +70,7 @@ ParamComboBox::ParamComboBox(const gchar * name, continue; const char * val = node->attribute("value"); - if (val != NULL) { + if (val != nullptr) { newvalue = val; } else { newvalue = contents; @@ -128,8 +128,8 @@ ParamComboBox::~ParamComboBox (void) */ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { - if (in == NULL) { - return NULL; /* Can't have NULL string */ + if (in == nullptr) { + return nullptr; /* Can't have NULL string */ } Glib::ustring settext; @@ -140,7 +140,7 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape } } if (!settext.empty()) { - if (_value != NULL) { + if (_value != nullptr) { g_free(_value); } _value = g_strdup(settext.data()); @@ -158,7 +158,7 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape */ bool ParamComboBox::contains(const gchar * text, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const { - if (text == NULL) { + if (text == nullptr) { return false; /* Can't have NULL string */ } @@ -214,7 +214,7 @@ ParamComboBoxEntry::changed (void) { Glib::ustring data = this->get_active_text(); _pref->set(data.c_str(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -225,7 +225,7 @@ ParamComboBoxEntry::changed (void) Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 1dd3f073b..aaf871068 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -40,27 +40,27 @@ ParamFloat::ParamFloat(const gchar * name, , _min(0.0) , _max(10.0) { - const gchar * defaultval = NULL; - if (xml->firstChild() != NULL) { + const gchar * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } - if (defaultval != NULL) { - _value = g_ascii_strtod (defaultval,NULL); + if (defaultval != nullptr) { + _value = g_ascii_strtod (defaultval,nullptr); } const char * maxval = xml->attribute("max"); - if (maxval != NULL) { - _max = g_ascii_strtod (maxval,NULL); + if (maxval != nullptr) { + _max = g_ascii_strtod (maxval,nullptr); } const char * minval = xml->attribute("min"); - if (minval != NULL) { - _min = g_ascii_strtod (minval,NULL); + if (minval != nullptr) { + _min = g_ascii_strtod (minval,nullptr); } _precision = 1; const char * precision = xml->attribute("precision"); - if (precision != NULL) { + if (precision != nullptr) { _precision = atoi(precision); } @@ -136,7 +136,7 @@ public: describing the parameter. */ ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 0.1, 1.0, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { - this->set_value(_pref->get(NULL, NULL) /* \todo fix */); + this->set_value(_pref->get(nullptr, nullptr) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamFloatAdjustment::val_changed)); return; }; @@ -154,7 +154,7 @@ void ParamFloatAdjustment::val_changed(void) { //std::cout << "Value Changed to: " << this->get_value() << std::endl; _pref->set(this->get_value(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } return; @@ -168,7 +168,7 @@ void ParamFloatAdjustment::val_changed(void) Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); @@ -179,7 +179,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod if (_mode == FULL) { Glib::ustring text; - if (_text != NULL) + if (_text != nullptr) text = _text; UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(text, fadjust, _precision); scale->set_size_request(400, -1); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 9ad9b591c..1c946d8b8 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -40,21 +40,21 @@ ParamInt::ParamInt(const gchar * name, , _min(0) , _max(10) { - const char * defaultval = NULL; - if (xml->firstChild() != NULL) { + const char * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } - if (defaultval != NULL) { + if (defaultval != nullptr) { _value = atoi(defaultval); } const char * maxval = xml->attribute("max"); - if (maxval != NULL) { + if (maxval != nullptr) { _max = atoi(maxval); } const char * minval = xml->attribute("min"); - if (minval != NULL) { + if (minval != nullptr) { _min = atoi(minval); } /* We're handling this by just killing both values */ @@ -118,7 +118,7 @@ public: describing the parameter. */ ParamIntAdjustment (ParamInt * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 1.0, 10.0, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { - this->set_value(_pref->get(NULL, NULL) /* \todo fix */); + this->set_value(_pref->get(nullptr, nullptr) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamIntAdjustment::val_changed)); }; @@ -135,7 +135,7 @@ void ParamIntAdjustment::val_changed(void) { //std::cout << "Value Changed to: " << this->get_value() << std::endl; _pref->set((int)this->get_value(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -149,7 +149,7 @@ Gtk::Widget * ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); @@ -160,7 +160,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal if (_mode == FULL) { Glib::ustring text; - if (_text != NULL) + if (_text != nullptr) text = _text; UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(text, fadjust, 0); scale->set_size_request(400, -1); diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index e47644f45..d00693db4 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -51,9 +51,9 @@ ParamNotebook::ParamNotebookPage::ParamNotebookPage(const gchar * name, { // Read XML to build page - if (xml != NULL) { + if (xml != nullptr) { Inkscape::XML::Node *child_repr = xml->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -63,7 +63,7 @@ ParamNotebook::ParamNotebookPage::ParamNotebookPage(const gchar * name, if (!strcmp(chname, "param") || !strcmp(chname, "_param")) { Parameter * param; param = Parameter::make(child_repr, ext); - if (param != NULL) parameters.push_back(param); + if (param != nullptr) parameters.push_back(param); } child_repr = child_repr->next(); } @@ -122,13 +122,13 @@ ParamNotebook::ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inksc name = in_repr->attribute("name"); text = in_repr->attribute("gui-text"); - if (text == NULL) + if (text == nullptr) text = in_repr->attribute("_gui-text"); description = in_repr->attribute("gui-description"); - if (description == NULL) + if (description == nullptr) description = in_repr->attribute("_gui-description"); hide = in_repr->attribute("gui-hidden"); - if (hide != NULL) { + if (hide != nullptr) { if (strcmp(hide, "1") == 0 || strcmp(hide, "true") == 0) { hidden = true; @@ -137,8 +137,8 @@ ParamNotebook::ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inksc } /* In this case we just don't have enough information */ - if (name == NULL) { - return NULL; + if (name == nullptr) { + return nullptr; } ParamNotebookPage * page = new ParamNotebookPage(name, text, description, hidden, in_ext, in_repr); @@ -157,7 +157,7 @@ ParamNotebook::ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inksc Gtk::Widget * ParamNotebook::ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox); @@ -194,7 +194,7 @@ Gtk::Widget * ParamNotebook::ParamNotebookPage::get_widget(SPDocument * doc, Ink /** Search the parameter's name in the page content. */ Parameter *ParamNotebook::ParamNotebookPage::get_param(const gchar * name) { - if (name == NULL) { + if (name == nullptr) { throw Extension::param_not_exist(); } if (this->parameters.empty()) { @@ -208,7 +208,7 @@ Parameter *ParamNotebook::ParamNotebookPage::get_param(const gchar * name) } } - return NULL; + return nullptr; } /** End ParamNotebookPage **/ @@ -224,9 +224,9 @@ ParamNotebook::ParamNotebook(const gchar * name, : Parameter(name, text, description, hidden, indent, ext) { // Read XML tree to add pages: - if (xml != NULL) { + if (xml != nullptr) { Inkscape::XML::Node *child_repr = xml->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -236,14 +236,14 @@ ParamNotebook::ParamNotebook(const gchar * name, if (!strcmp(chname, "page")) { ParamNotebookPage * page; page = ParamNotebookPage::makepage(child_repr, ext); - if (page != NULL) pages.push_back(page); + if (page != nullptr) pages.push_back(page); } child_repr = child_repr->next(); } } // Initialize _value with the current page - const char * defaultval = NULL; + const char * defaultval = nullptr; // set first page as default if (!pages.empty()) { defaultval = pages[0]->name(); @@ -256,7 +256,7 @@ ParamNotebook::ParamNotebook(const gchar * name, if (!paramval.empty()) defaultval = paramval.data(); - if (defaultval != NULL) + if (defaultval != nullptr) _value = g_strdup(defaultval); // allocate space for _value } @@ -290,9 +290,9 @@ const gchar *ParamNotebook::set(const int in, SPDocument * /*doc*/, Inkscape::XM int i = in < pages.size() ? in : pages.size()-1; ParamNotebookPage * page = pages[i]; - if (page == NULL) return _value; + if (page == nullptr) return _value; - if (_value != NULL) g_free(_value); + if (_value != nullptr) g_free(_value); _value = g_strdup(page->name()); gchar * prefname = this->pref_name(); @@ -359,7 +359,7 @@ void ParamNotebookWdg::changed_page(Gtk::Widget * /*page*/, guint pagenum) /** Search the parameter's name in the notebook content. */ Parameter *ParamNotebook::get_param(const gchar * name) { - if (name == NULL) { + if (name == nullptr) { throw Extension::param_not_exist(); } for (auto page:pages) { @@ -369,7 +369,7 @@ Parameter *ParamNotebook::get_param(const gchar * name) } } - return NULL; + return nullptr; } @@ -381,7 +381,7 @@ Parameter *ParamNotebook::get_param(const gchar * name) Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } ParamNotebookWdg * nb = Gtk::manage(new ParamNotebookWdg(this, doc, node)); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index f9a69de05..d897903cb 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -52,37 +52,37 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex // we can't create a parameter without type if (!type) { - return NULL; + return nullptr; } // also require name unless it's a pure UI element that does not store its value if (!name) { static std::vector<std::string> ui_elements = {"description"}; if (std::find(ui_elements.begin(), ui_elements.end(), type) == ui_elements.end()) { - return NULL; + return nullptr; } } const char *text = in_repr->attribute("gui-text"); - if (text == NULL) { + if (text == nullptr) { text = in_repr->attribute("_gui-text"); - if (text == NULL) { + if (text == nullptr) { // text = ""; // probably better to require devs to explicitly set an empty gui-text if this is what they want } else { const char *context = in_repr->attribute("msgctxt"); - if (context != NULL) { - text = g_dpgettext2(NULL, context, text); + if (context != nullptr) { + text = g_dpgettext2(nullptr, context, text); } else { text = _(text); } } } const char *description = in_repr->attribute("gui-description"); - if (description == NULL) { + if (description == nullptr) { description = in_repr->attribute("_gui-description"); - if (description != NULL) { + if (description != nullptr) { const char *context = in_repr->attribute("msgctxt"); - if (context != NULL) { - description = g_dpgettext2(NULL, context, description); + if (context != nullptr) { + description = g_dpgettext2(nullptr, context, description); } else { description = _(description); } @@ -91,7 +91,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex bool hidden = false; { const char *gui_hide = in_repr->attribute("gui-hidden"); - if (gui_hide != NULL) { + if (gui_hide != nullptr) { if (strcmp(gui_hide, "1") == 0 || strcmp(gui_hide, "true") == 0) { hidden = true; @@ -102,7 +102,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex int indent = 0; { const char *indent_attr = in_repr->attribute("indent"); - if (indent_attr != NULL) { + if (indent_attr != nullptr) { if (strcmp(indent_attr, "true") == 0) { indent = 1; } else { @@ -112,7 +112,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } const gchar* appearance = in_repr->attribute("appearance"); - Parameter * param = NULL; + Parameter * param = nullptr; if (!strcmp(type, "boolean")) { param = new ParamBool(name, text, description, hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "int")) { @@ -130,7 +130,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } else if (!strcmp(type, "string")) { param = new ParamString(name, text, description, hidden, indent, in_ext, in_repr); gchar const * max_length = in_repr->attribute("max_length"); - if (max_length != NULL) { + if (max_length != nullptr) { ParamString * ps = dynamic_cast<ParamString *>(param); ps->setMaxLength(atoi(max_length)); } @@ -237,7 +237,7 @@ guint32 Parameter::get_color(const SPDocument* doc, Inkscape::XML::Node const *n bool Parameter::set_bool(bool in, SPDocument * doc, Inkscape::XML::Node * node) { ParamBool * boolpntr = dynamic_cast<ParamBool *>(this); - if (boolpntr == NULL) + if (boolpntr == nullptr) throw Extension::param_not_bool_param(); return boolpntr->set(in, doc, node); } @@ -245,7 +245,7 @@ bool Parameter::set_bool(bool in, SPDocument * doc, Inkscape::XML::Node * node) int Parameter::set_int(int in, SPDocument * doc, Inkscape::XML::Node * node) { ParamInt * intpntr = dynamic_cast<ParamInt *>(this); - if (intpntr == NULL) + if (intpntr == nullptr) throw Extension::param_not_int_param(); return intpntr->set(in, doc, node); } @@ -256,7 +256,7 @@ Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) { ParamFloat * floatpntr; floatpntr = dynamic_cast<ParamFloat *>(this); - if (floatpntr == NULL) + if (floatpntr == nullptr) throw Extension::param_not_float_param(); return floatpntr->set(in, doc, node); } @@ -266,7 +266,7 @@ gchar const * Parameter::set_string (gchar const * in, SPDocument * doc, Inkscape::XML::Node * node) { ParamString * stringpntr = dynamic_cast<ParamString *>(this); - if (stringpntr == NULL) + if (stringpntr == nullptr) throw Extension::param_not_string_param(); return stringpntr->set(in, doc, node); } @@ -295,7 +295,7 @@ guint32 Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) { ParamColor* param = dynamic_cast<ParamColor *>(this); - if (param == NULL) + if (param == nullptr) throw Extension::param_not_color_param(); return param->set(in, doc, node); } @@ -303,22 +303,22 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) /** Oop, now that we need a parameter, we need it's name. */ Parameter::Parameter(gchar const * name, gchar const * text, gchar const * description, bool hidden, int indent, Inkscape::Extension::Extension * ext) : - _description(0), - _text(0), + _description(nullptr), + _text(nullptr), _hidden(hidden), _indent(indent), _extension(ext), - _name(0) + _name(nullptr) { - if (name != NULL) { + if (name != nullptr) { _name = g_strdup(name); } - if (description != NULL) { + if (description != nullptr) { _description = g_strdup(description); } - if (text != NULL) { + if (text != nullptr) { _text = g_strdup(text); } else { _text = g_strdup(name); @@ -329,17 +329,17 @@ Parameter::Parameter(gchar const * name, gchar const * text, gchar const * descr /** Oop, now that we need a parameter, we need it's name. */ Parameter::Parameter (gchar const * name, gchar const * text, Inkscape::Extension::Extension * ext) : - _description(0), - _text(0), + _description(nullptr), + _text(nullptr), _hidden(false), _indent(0), _extension(ext), - _name(0) + _name(nullptr) { - if (name != NULL) { + if (name != nullptr) { _name = g_strdup(name); } - if (text != NULL) { + if (text != nullptr) { _text = g_strdup(text); } else { _text = g_strdup(name); @@ -351,13 +351,13 @@ Parameter::Parameter (gchar const * name, gchar const * text, Inkscape::Extensio Parameter::~Parameter(void) { g_free(_name); - _name = 0; + _name = nullptr; g_free(_text); - _text = 0; + _text = nullptr; g_free(_description); - _description = 0; + _description = nullptr; } gchar *Parameter::pref_name(void) const @@ -387,12 +387,12 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) { Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); - Inkscape::XML::Node * params = NULL; + Inkscape::XML::Node * params = nullptr; GQuark const name_quark = g_quark_from_string("inkscape:extension-params"); for (Inkscape::XML::Node * child = defs->firstChild(); - child != NULL; + child != nullptr; child = child->next()) { if ((GQuark)child->code() == name_quark && !strcmp(child->attribute("extension"), _extension->get_id())) { @@ -401,7 +401,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) } } - if (params == NULL) { + if (params == nullptr) { params = xml_doc->createElement("inkscape:extension-param"); params->setAttribute("extension", _extension->get_id()); defs->appendChild(params); @@ -415,7 +415,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) Gtk::Widget * Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/) { - return NULL; + return nullptr; } /** If I'm not sure which it is, just don't return a value. */ @@ -441,7 +441,7 @@ void Parameter::string(std::list <std::string> &list) const Parameter *Parameter::get_param(gchar const * /*name*/) { - return NULL; + return nullptr; } Glib::ustring const extension_pref_root = "/extensions/"; diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 5598081f3..45869378a 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -51,25 +51,25 @@ ParamRadioButton::ParamRadioButton(const gchar * name, Inkscape::XML::Node * xml, AppearanceMode mode) : Parameter(name, text, description, hidden, indent, ext) - , _value(0) + , _value(nullptr) , _mode(mode) { // Read XML tree to add enumeration items: // printf("Extension Constructor: "); - if (xml != NULL) { + if (xml != nullptr) { Inkscape::XML::Node *child_repr = xml->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "option") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { - Glib::ustring * newtext = NULL; - Glib::ustring * newvalue = NULL; + Glib::ustring * newtext = nullptr; + Glib::ustring * newvalue = nullptr; const char * contents = child_repr->firstChild()->content(); - if (contents != NULL) { + if (contents != nullptr) { // don't translate when 'item' but do translate when '_option' if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { - if (child_repr->attribute("msgctxt") != NULL) { - newtext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents)); + if (child_repr->attribute("msgctxt") != nullptr) { + newtext = new Glib::ustring(g_dpgettext2(nullptr, child_repr->attribute("msgctxt"), contents)); } else { newtext = new Glib::ustring(_(contents)); } @@ -82,7 +82,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name, const char * val = child_repr->attribute("value"); - if (val != NULL) { + if (val != nullptr) { newvalue = new Glib::ustring(val); } else { newvalue = new Glib::ustring(contents); @@ -98,7 +98,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name, // Initialize _value with the default value from xml // for simplicity : default to the contents of the first xml-child - const char * defaultval = NULL; + const char * defaultval = nullptr; if (!choices.empty()) { defaultval = (static_cast<optionentry*> (choices[0]))->value->c_str(); } @@ -111,7 +111,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name, if (!paramval.empty()) { defaultval = paramval.data(); } - if (defaultval != NULL) { + if (defaultval != nullptr) { _value = g_strdup(defaultval); // allocate space for _value } } @@ -143,11 +143,11 @@ ParamRadioButton::~ParamRadioButton (void) */ const gchar *ParamRadioButton::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { - if (in == NULL) { - return NULL; /* Can't have NULL string */ + if (in == nullptr) { + return nullptr; /* Can't have NULL string */ } - Glib::ustring * settext = NULL; + Glib::ustring * settext = nullptr; for (auto entr:choices) { if ( !entr->value->compare(in) ) { settext = entr->value; @@ -155,7 +155,7 @@ const gchar *ParamRadioButton::set(const gchar * in, SPDocument * /*doc*/, Inksc } } if (settext) { - if (_value != NULL) { + if (_value != nullptr) { g_free(_value); } _value = g_strdup(settext->c_str()); @@ -215,7 +215,7 @@ void ParamRadioButtonWdg::changed(void) Glib::ustring value = _pref->value_from_label(this->get_label()); _pref->set(value.c_str(), _doc, _node); } - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -247,7 +247,7 @@ void ComboWdg::changed(void) Glib::ustring value = _base->value_from_label(get_active_text()); _base->set(value.c_str(), _doc, _node); } - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -276,7 +276,7 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label) Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); @@ -288,7 +288,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node label->show(); hbox->pack_start(*label, false, false); - Gtk::ComboBoxText* cbt = 0; + Gtk::ComboBoxText* cbt = nullptr; bool comboSet = false; if (_mode == MINIMAL) { cbt = Gtk::manage(new ComboWdg(this, doc, node, changeSignal)); diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 51b5dfdf3..775bf62ee 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -30,7 +30,7 @@ namespace Extension { ParamString::~ParamString(void) { g_free(_value); - _value = 0; + _value = nullptr; } /** @@ -50,11 +50,11 @@ ParamString::~ParamString(void) */ const gchar * ParamString::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { - if (in == NULL) { - return NULL; /* Can't have NULL string */ + if (in == nullptr) { + return nullptr; /* Can't have NULL string */ } - if (_value != NULL) { + if (_value != nullptr) { g_free(_value); } @@ -84,10 +84,10 @@ ParamString::ParamString(const gchar * name, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : Parameter(name, text, description, hidden, indent, ext) - , _value(NULL) + , _value(nullptr) { - const char * defaultval = NULL; - if (xml->firstChild() != NULL) { + const char * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } @@ -99,11 +99,11 @@ ParamString::ParamString(const gchar * name, if (!paramval.empty()) { defaultval = paramval.data(); } - if (defaultval != NULL) { + if (defaultval != nullptr) { char const * chname = xml->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_param")) { - if (xml->attribute("msgctxt") != NULL) { - _value = g_strdup(g_dpgettext2(NULL, xml->attribute("msgctxt"), defaultval)); + if (xml->attribute("msgctxt") != nullptr) { + _value = g_strdup(g_dpgettext2(nullptr, xml->attribute("msgctxt"), defaultval)); } else { _value = g_strdup(_(defaultval)); } @@ -130,8 +130,8 @@ public: */ ParamStringEntry (ParamString * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::Entry(), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { - if (_pref->get(NULL, NULL) != NULL) { - this->set_text(Glib::ustring(_pref->get(NULL, NULL))); + if (_pref->get(nullptr, nullptr) != nullptr) { + this->set_text(Glib::ustring(_pref->get(nullptr, nullptr))); } this->set_max_length(_pref->getMaxLength()); //Set the max length - default zero means no maximum this->signal_changed().connect(sigc::mem_fun(this, &ParamStringEntry::changed_text)); @@ -150,7 +150,7 @@ void ParamStringEntry::changed_text(void) { Glib::ustring data = this->get_text(); _pref->set(data.c_str(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -163,7 +163,7 @@ void ParamStringEntry::changed_text(void) Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index 1e9e093ef..82d75dcb3 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -39,33 +39,33 @@ void PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path) { gchar const * patheffectlist = path->attribute("inkscape:path-effects"); - if (patheffectlist == NULL) + if (patheffectlist == nullptr) return; gchar ** patheffects = g_strsplit(patheffectlist, ";", 128); Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); - for (int i = 0; (i < 128) && (patheffects[i] != NULL); i++) { + for (int i = 0; (i < 128) && (patheffects[i] != nullptr); i++) { gchar * patheffect = patheffects[i]; // This is weird, they should all be references... but anyway if (patheffect[0] != '#') continue; Inkscape::XML::Node * prefs = sp_repr_lookup_child(defs, "id", &(patheffect[1])); - if (prefs == NULL) { + if (prefs == nullptr) { continue; } gchar const * ext_id = prefs->attribute("extension"); - if (ext_id == NULL) { + if (ext_id == nullptr) { continue; } Inkscape::Extension::PathEffect * peffect; peffect = dynamic_cast<Inkscape::Extension::PathEffect *>(Inkscape::Extension::db.get(ext_id)); - if (peffect != NULL) { + if (peffect != nullptr) { peffect->processPath(doc, path, prefs); } } diff --git a/src/extension/plugins/grid2/grid.cpp b/src/extension/plugins/grid2/grid.cpp index 256bb8dc2..3ebe85b3e 100644 --- a/src/extension/plugins/grid2/grid.cpp +++ b/src/extension/plugins/grid2/grid.cpp @@ -187,7 +187,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPDocument * current_document = view->doc(); auto selected = ((SPDesktop *) view)->getSelection()->items(); - Inkscape::XML::Node * first_select = NULL; + Inkscape::XML::Node * first_select = nullptr; if (!selected.empty()) { first_select = selected.front()->getRepr(); } diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index b5b1f9bfe..47ed14405 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -45,22 +45,22 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co Gtk::Dialog(_(name.c_str()), true), _help(help), _name(name), - _button_ok(NULL), - _button_cancel(NULL), - _button_preview(NULL), - _param_preview(NULL), + _button_ok(nullptr), + _button_cancel(nullptr), + _button_preview(nullptr), + _param_preview(nullptr), _effect(effect), - _exEnv(NULL) + _exEnv(nullptr) { this->set_default_size(0,0); // we want the window to be as small as possible instead of clobbering up space Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); - if (controls == NULL) { - if (_effect == NULL) { + if (controls == nullptr) { + if (_effect == nullptr) { std::cout << "AH!!! No controls and no effect!!!" << std::endl; return; } - controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL); + controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, nullptr); _signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change)); } @@ -74,15 +74,15 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co if (_help == NULL) help_button->set_sensitive(false); */ - _button_cancel = add_button(_effect == NULL ? _("_Cancel") : _("_Close"), Gtk::RESPONSE_CANCEL); - _button_ok = add_button(_effect == NULL ? _("_OK") : _("_Apply"), Gtk::RESPONSE_OK); + _button_cancel = add_button(_effect == nullptr ? _("_Cancel") : _("_Close"), Gtk::RESPONSE_CANCEL); + _button_ok = add_button(_effect == nullptr ? _("_OK") : _("_Apply"), Gtk::RESPONSE_OK); set_default_response(Gtk::RESPONSE_OK); _button_ok->grab_focus(); - if (_effect != NULL && !_effect->no_live_preview) { - if (_param_preview == NULL) { - XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), NULL); - if (doc == NULL) { + if (_effect != nullptr && !_effect->no_live_preview) { + if (_param_preview == nullptr) { + XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), nullptr); + if (doc == nullptr) { std::cout << "Error encountered loading live parameter XML !!!" << std::endl; return; } @@ -96,7 +96,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co hbox = Gtk::manage(new Gtk::HBox()); hbox->set_border_width(Parameter::GUI_BOX_MARGIN); - _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); + _button_preview = _param_preview->get_widget(nullptr, nullptr, &_signal_preview); _button_preview->show(); hbox->pack_start(*_button_preview, true, true, 0); hbox->show(); @@ -104,7 +104,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co this->get_content_area()->pack_start(*hbox, false, false, 0); Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview); - if (hbox != NULL) { + if (hbox != nullptr) { _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->get_children().front()); } @@ -113,7 +113,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co } // Set window modality for effects that don't use live preview - if (_effect != NULL && _effect->no_live_preview) { + if (_effect != nullptr && _effect->no_live_preview) { set_modal(false); } @@ -125,20 +125,20 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co PrefDialog::~PrefDialog ( ) { - if (_param_preview != NULL) { + if (_param_preview != nullptr) { delete _param_preview; - _param_preview = NULL; + _param_preview = nullptr; } - if (_exEnv != NULL) { + if (_exEnv != nullptr) { _exEnv->cancel(); delete _exEnv; - _exEnv = NULL; + _exEnv = nullptr; _effect->set_execution_env(_exEnv); } - if (_effect != NULL) { - _effect->set_pref_dialog(NULL); + if (_effect != nullptr) { + _effect->set_pref_dialog(nullptr); } return; @@ -176,21 +176,21 @@ PrefDialog::preview_toggle (void) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDocument *document = SP_ACTIVE_DOCUMENT; bool modified = document->isModifiedSinceSave(); - if(_param_preview->get_bool(NULL, NULL)) { - if (_exEnv == NULL) { + if(_param_preview->get_bool(nullptr, nullptr)) { + if (_exEnv == nullptr) { set_modal(true); - _exEnv = new ExecutionEnv(_effect, SP_ACTIVE_DESKTOP, NULL, false, false); + _exEnv = new ExecutionEnv(_effect, SP_ACTIVE_DESKTOP, nullptr, false, false); _effect->set_execution_env(_exEnv); _exEnv->run(); } } else { set_modal(false); - if (_exEnv != NULL) { + if (_exEnv != nullptr) { _exEnv->cancel(); _exEnv->undo(); _exEnv->reselect(); delete _exEnv; - _exEnv = NULL; + _exEnv = nullptr; _effect->set_execution_env(_exEnv); } } @@ -199,7 +199,7 @@ PrefDialog::preview_toggle (void) { void PrefDialog::param_change (void) { - if (_exEnv != NULL) { + if (_exEnv != nullptr) { if (!_effect->loaded()) { _effect->set_state(Extension::STATE_LOADED); } @@ -214,7 +214,7 @@ PrefDialog::param_change (void) { bool PrefDialog::param_timer_expire (void) { - if (_exEnv != NULL) { + if (_exEnv != nullptr) { _exEnv->cancel(); _exEnv->undo(); _exEnv->run(); @@ -226,8 +226,8 @@ PrefDialog::param_timer_expire (void) { void PrefDialog::on_response (int signal) { if (signal == Gtk::RESPONSE_OK) { - if (_exEnv == NULL) { - if (_effect != NULL) { + if (_exEnv == nullptr) { + if (_effect != nullptr) { _effect->effect(SP_ACTIVE_DESKTOP); } else { // Shutdown run() @@ -241,16 +241,16 @@ PrefDialog::on_response (int signal) { _exEnv->reselect(); } delete _exEnv; - _exEnv = NULL; + _exEnv = nullptr; _effect->set_execution_env(_exEnv); } } - if (_param_preview != NULL) { + if (_param_preview != nullptr) { _checkbox_preview->set_active(false); } - if ((signal == Gtk::RESPONSE_CANCEL || signal == Gtk::RESPONSE_DELETE_EVENT) && _effect != NULL) { + if ((signal == Gtk::RESPONSE_CANCEL || signal == Gtk::RESPONSE_DELETE_EVENT) && _effect != nullptr) { delete this; } return; diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h index 0c0bfcb88..f2ff60770 100644 --- a/src/extension/prefdialog.h +++ b/src/extension/prefdialog.h @@ -71,8 +71,8 @@ class PrefDialog : public Gtk::Dialog { public: PrefDialog (Glib::ustring name, gchar const * help, - Gtk::Widget * controls = NULL, - Effect * effect = NULL); + Gtk::Widget * controls = nullptr, + Effect * effect = nullptr); ~PrefDialog () override; }; diff --git a/src/extension/print.cpp b/src/extension/print.cpp index c37e9425c..ad9836a66 100644 --- a/src/extension/print.cpp +++ b/src/extension/print.cpp @@ -17,9 +17,9 @@ namespace Extension { Print::Print (Inkscape::XML::Node *in_repr, Implementation::Implementation *in_imp) : Extension(in_repr, in_imp) - , base(NULL) - , drawing(NULL) - , root(NULL) + , base(nullptr) + , drawing(nullptr) + , root(nullptr) , dkey(0) { } diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 5b039948a..6802050b0 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -70,9 +70,9 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio */ SPDocument *open(Extension *key, gchar const *filename) { - Input *imod = NULL; + Input *imod = nullptr; - if (key == NULL) { + if (key == nullptr) { gpointer parray[2]; parray[0] = (gpointer)filename; parray[1] = (gpointer)&imod; @@ -82,12 +82,12 @@ SPDocument *open(Extension *key, gchar const *filename) } bool last_chance_svg = false; - if (key == NULL && imod == NULL) { + if (key == nullptr && imod == nullptr) { last_chance_svg = true; imod = dynamic_cast<Input *>(db.get(SP_MODULE_KEY_INPUT_SVG)); } - if (imod == NULL) { + if (imod == nullptr) { throw Input::no_extension_found(); } @@ -119,7 +119,7 @@ SPDocument *open(Extension *key, gchar const *filename) } if (!imod->prefs(filename)) { - return NULL; + return nullptr; } SPDocument *doc = imod->open(filename); @@ -219,21 +219,21 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, Inkscape::Extension::FileSaveMethod save_method) { Output *omod; - if (key == NULL) { + if (key == nullptr) { gpointer parray[2]; parray[0] = (gpointer)filename; parray[1] = (gpointer)&omod; - omod = NULL; + omod = nullptr; db.foreach(save_internal, (gpointer)&parray); /* This is a nasty hack, but it is required to ensure that autodetect will always save with the Inkscape extensions if they are available. */ - if (omod != NULL && !strcmp(omod->get_id(), SP_MODULE_KEY_OUTPUT_SVG)) { + if (omod != nullptr && !strcmp(omod->get_id(), SP_MODULE_KEY_OUTPUT_SVG)) { omod = dynamic_cast<Output *>(db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)); } /* If autodetect fails, save as Inkscape SVG */ - if (omod == NULL) { + if (omod == nullptr) { // omod = dynamic_cast<Output *>(db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)); use exception and let user choose } } else { @@ -254,7 +254,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, throw Output::save_cancelled(); } - gchar *fileName = NULL; + gchar *fileName = nullptr; if (setextension) { gchar *lowerfile = g_utf8_strdown(filename, -1); gchar *lowerext = g_utf8_strdown(omod->get_extension(), -1); @@ -267,7 +267,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, g_free(lowerext); } - if (fileName == NULL) { + if (fileName == nullptr) { fileName = g_strdup(filename); } @@ -288,8 +288,8 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // remember attributes in case this is an unofficial save and/or overwrite fails gchar *saved_uri = g_strdup(doc->getURI()); - gchar *saved_output_extension = NULL; - gchar *saved_dataloss = NULL; + gchar *saved_output_extension = nullptr; + gchar *saved_dataloss = nullptr; bool saved_modified = doc->isModifiedSinceSave(); saved_output_extension = g_strdup(get_file_save_extension(save_method).c_str()); saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); @@ -306,7 +306,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // also save the extension for next use store_file_extension_in_prefs (omod->get_id(), save_method); // set the "dataloss" attribute if the chosen extension is lossy - repr->setAttribute("inkscape:dataloss", NULL); + repr->setAttribute("inkscape:dataloss", nullptr); if (omod->causes_dataloss()) { repr->setAttribute("inkscape:dataloss", "true"); } @@ -446,17 +446,17 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation MODULE_UNKNOWN_FUNC } module_functional_type = MODULE_UNKNOWN_FUNC; - g_return_val_if_fail(doc != NULL, NULL); + g_return_val_if_fail(doc != nullptr, NULL); Inkscape::XML::Node *repr = doc->root(); if (strcmp(repr->name(), INKSCAPE_EXTENSION_NS "inkscape-extension")) { g_warning("Extension definition started with <%s> instead of <" INKSCAPE_EXTENSION_NS "inkscape-extension>. Extension will not be created. See http://wiki.inkscape.org/wiki/index.php/Extensions for reference.\n", repr->name()); - return NULL; + return nullptr; } Inkscape::XML::Node *child_repr = repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const *element_name = child_repr->name(); /* printf("Child: %s\n", child_repr->name()); */ if (!strcmp(element_name, INKSCAPE_EXTENSION_NS "input")) { @@ -483,7 +483,7 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation } Implementation::Implementation *imp; - if (in_imp == NULL) { + if (in_imp == nullptr) { switch (module_implementation_type) { case MODULE_EXTENSION: { Implementation::Script *script = new Implementation::Script(); @@ -497,14 +497,14 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation } case MODULE_PLUGIN: { Inkscape::Extension::Loader loader = Inkscape::Extension::Loader(); - if( baseDir != NULL){ + if( baseDir != nullptr){ loader.set_base_directory ( *baseDir ); } imp = loader.load_implementation(doc); break; } default: { - imp = NULL; + imp = nullptr; break; } } @@ -512,7 +512,7 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation imp = in_imp; } - Extension *module = NULL; + Extension *module = nullptr; switch (module_functional_type) { case MODULE_INPUT: { module = new Input(repr, imp); @@ -556,8 +556,8 @@ build_from_file(gchar const *filename) { Inkscape::XML::Document *doc = sp_repr_read_file(filename, INKSCAPE_EXTENSION_URI); std::string dir = Glib::path_get_dirname(filename); - Extension *ext = build_from_reprdoc(doc, NULL, &dir); - if (ext != NULL) + Extension *ext = build_from_reprdoc(doc, nullptr, &dir); + if (ext != nullptr) Inkscape::GC::release(doc); else g_warning("Unable to create extension from definition file %s.\n", filename); @@ -577,8 +577,8 @@ Extension * build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp) { Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), INKSCAPE_EXTENSION_URI); - g_return_val_if_fail(doc != NULL, NULL); - Extension *ext = build_from_reprdoc(doc, in_imp, NULL); + g_return_val_if_fail(doc != nullptr, NULL); + Extension *ext = build_from_reprdoc(doc, in_imp, nullptr); Inkscape::GC::release(doc); return ext; } diff --git a/src/extension/timer.cpp b/src/extension/timer.cpp index b32c04f30..5fb727409 100644 --- a/src/extension/timer.cpp +++ b/src/extension/timer.cpp @@ -20,8 +20,8 @@ namespace Extension { #define TIMER_SCALE_VALUE 20 -ExpirationTimer * ExpirationTimer::timer_list = NULL; -ExpirationTimer * ExpirationTimer::idle_start = NULL; +ExpirationTimer * ExpirationTimer::timer_list = nullptr; +ExpirationTimer * ExpirationTimer::idle_start = nullptr; long ExpirationTimer::timeout = 240; bool ExpirationTimer::timer_started = false; @@ -38,7 +38,7 @@ ExpirationTimer::ExpirationTimer (Extension * in_extension): extension(in_extension) { /* Fix Me! */ - if (timer_list == NULL) { + if (timer_list == nullptr) { next = this; timer_list = this; } else { @@ -86,8 +86,8 @@ ExpirationTimer::~ExpirationTimer(void) } else { /* If we're the only entry in the list, the list needs to go to NULL */ - timer_list = NULL; - idle_start = NULL; + timer_list = nullptr; + idle_start = nullptr; } return; @@ -151,7 +151,7 @@ ExpirationTimer::idle_func (void) // std::cout << "Idle func pass: " << idle_cnt++ << " timer list: " << timer_list << std::endl; /* see if this is the last */ - if (timer_list == NULL) { + if (timer_list == nullptr) { timer_started = false; return false; } @@ -162,7 +162,7 @@ ExpirationTimer::idle_func (void) } /* see if this is the last */ - if (timer_list == NULL) { + if (timer_list == nullptr) { timer_started = false; return false; } diff --git a/src/extract-uri.cpp b/src/extract-uri.cpp index a25c8bb70..ae2efcb0e 100644 --- a/src/extract-uri.cpp +++ b/src/extract-uri.cpp @@ -10,18 +10,18 @@ gchar *extract_uri( gchar const *s, gchar const** endptr ) { if (!s) - return NULL; + return nullptr; - gchar* result = NULL; + gchar* result = nullptr; gchar const *sb = s; if ( strlen(sb) < 4 || strncmp(sb, "url", 3) != 0 ) { - return NULL; + return nullptr; } sb += 3; if ( endptr ) { - *endptr = 0; + *endptr = nullptr; } // This first whitespace technically is not allowed. diff --git a/src/extract-uri.h b/src/extract-uri.h index e9ee0b1d8..ee4520ec9 100644 --- a/src/extract-uri.h +++ b/src/extract-uri.h @@ -1,7 +1,7 @@ #ifndef SEEN_EXTRACT_URI_H #define SEEN_EXTRACT_URI_H -char *extract_uri(char const *s, char const** endptr = 0); +char *extract_uri(char const *s, char const** endptr = nullptr); #endif /* !SEEN_EXTRACT_URI_H */ diff --git a/src/file-update.cpp b/src/file-update.cpp index 0585fa875..ee0117c09 100644 --- a/src/file-update.cpp +++ b/src/file-update.cpp @@ -186,7 +186,7 @@ void fix_update(SPObject *o) { void sp_file_convert_text_baseline_spacing(SPDocument *doc) { - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC,"C"); sp_file_text_run_recursive(fix_blank_line, doc->getRoot()); sp_file_text_run_recursive(fix_line_spacing, doc->getRoot()); diff --git a/src/file.cpp b/src/file.cpp index 30a218141..48b9ee467 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -98,14 +98,14 @@ void dump_ustr(Glib::ustring const &ustr); // what gets passed here is not actually an URI... it is an UTF-8 encoded filename (!) static void sp_file_add_recent(gchar const *uri) { - if(uri == NULL) { + if(uri == nullptr) { g_warning("sp_file_add_recent: uri == NULL"); return; } GtkRecentManager *recent = gtk_recent_manager_get_default(); - gchar *fn = g_filename_from_utf8(uri, -1, NULL, NULL, NULL); + gchar *fn = g_filename_from_utf8(uri, -1, nullptr, nullptr, nullptr); if (fn) { - gchar *uri_to_add = g_filename_to_uri(fn, NULL, NULL); + gchar *uri_to_add = g_filename_to_uri(fn, nullptr, nullptr); if (uri_to_add) { gtk_recent_manager_add_item(recent, uri_to_add); g_free(uri_to_add); @@ -124,13 +124,13 @@ static void sp_file_add_recent(gchar const *uri) */ SPDesktop *sp_file_new(const std::string &templ) { - SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true ); - g_return_val_if_fail(doc != NULL, NULL); + SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : nullptr , TRUE, true ); + g_return_val_if_fail(doc != nullptr, NULL); // Remove all the template info from xml tree Inkscape::XML::Node *myRoot = doc->getReprRoot(); Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); - if (nodeToRemove != NULL){ + if (nodeToRemove != nullptr){ DocumentUndo::setUndoSensitive(doc, false); sp_repr_unparent(nodeToRemove); delete nodeToRemove; @@ -141,8 +141,8 @@ SPDesktop *sp_file_new(const std::string &templ) if (olddesktop) olddesktop->setWaitingCursor(); - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. - g_return_val_if_fail(dtw != NULL, NULL); + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, nullptr)); // TODO this will trigger broken link warnings, etc. + g_return_val_if_fail(dtw != nullptr, NULL); sp_create_window(dtw, TRUE); SPDesktop* desktop = static_cast<SPDesktop *>(dtw->view); @@ -188,7 +188,7 @@ SPDesktop* sp_file_new_default() void sp_file_exit() { - if (SP_ACTIVE_DESKTOP == NULL) { + if (SP_ACTIVE_DESKTOP == nullptr) { // We must be in console mode Gtk::Main::quit(); } else { @@ -219,16 +219,16 @@ bool sp_file_open(const Glib::ustring &uri, desktop->setWaitingCursor(); } - SPDocument *doc = NULL; + SPDocument *doc = nullptr; bool cancelled = false; try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { - doc = NULL; + doc = nullptr; } catch (Inkscape::Extension::Input::open_failed &e) { - doc = NULL; + doc = nullptr; } catch (Inkscape::Extension::Input::open_cancelled &e) { - doc = NULL; + doc = nullptr; cancelled = true; } @@ -238,7 +238,7 @@ bool sp_file_open(const Glib::ustring &uri, if (doc) { - SPDocument *existing = desktop ? desktop->getDocument() : NULL; + SPDocument *existing = desktop ? desktop->getDocument() : nullptr; if (existing && existing->virgin && replace_empty) { // If the current desktop is empty, open the document there @@ -247,7 +247,7 @@ bool sp_file_open(const Glib::ustring &uri, doc->emitResizedSignal(doc->getWidth().value("px"), doc->getHeight().value("px")); } else { // create a whole new desktop and window - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, nullptr)); // TODO this will trigger broken link warnings, etc. sp_create_window(dtw, TRUE); desktop = static_cast<SPDesktop*>(dtw->view); } @@ -313,13 +313,13 @@ bool sp_file_open(const Glib::ustring &uri, void sp_file_revert_dialog() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - g_assert(desktop != NULL); + g_assert(desktop != nullptr); SPDocument *doc = desktop->getDocument(); - g_assert(doc != NULL); + g_assert(doc != nullptr); Inkscape::XML::Node *repr = doc->getReprRoot(); - g_assert(repr != NULL); + g_assert(repr != nullptr); gchar const *uri = doc->getURI(); if (!uri) { @@ -345,7 +345,7 @@ void sp_file_revert_dialog() double zoom = desktop->current_zoom(); Geom::Point c = desktop->get_display_area().midpoint(); - reverted = sp_file_open(uri,NULL); + reverted = sp_file_open(uri,nullptr); if (reverted) { // restore zoom and view desktop->zoom_absolute_center_point(c, zoom); @@ -532,7 +532,7 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d //# We no longer need the file dialog object - delete it delete openDialogInstance; - openDialogInstance = NULL; + openDialogInstance = nullptr; //# Iterate through filenames if more than 1 if (flist.size() > 1) @@ -592,7 +592,7 @@ void sp_file_vacuum(SPDocument *doc) _("Clean up document")); SPDesktop *dt = SP_ACTIVE_DESKTOP; - if (dt != NULL) { + if (dt != nullptr) { // Show status messages when in GUI mode if (diff > 0) { dt->messageStack()->flashF(Inkscape::NORMAL_MESSAGE, @@ -710,7 +710,7 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, SP_ACTIVE_DESKTOP->event_log->rememberFileSave(); Glib::ustring msg; - if (doc->getURI() == NULL) { + if (doc->getURI() == nullptr) { msg = Glib::ustring::format(_("Document saved.")); } else { msg = Glib::ustring::format(_("Document saved."), " ", doc->getURI()); @@ -739,7 +739,7 @@ static bool hasEnding (Glib::ustring const &fullString, Glib::ustring const &end bool sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extension::FileSaveMethod save_method) { - Inkscape::Extension::Output *extension = 0; + Inkscape::Extension::Output *extension = nullptr; bool is_copy = (save_method == Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); // Note: default_extension has the format "org.inkscape.output.svg.inkscape", whereas @@ -825,7 +825,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens Inkscape::Extension::Extension *selectionType = saveDialog->getSelectionType(); delete saveDialog; - saveDialog = 0; + saveDialog = nullptr; if(doc_title) g_free(doc_title); if (!fileName.empty()) { @@ -871,7 +871,7 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) bool success = true; if (doc->isModifiedSinceSave()) { - if ( doc->getURI() == NULL ) + if ( doc->getURI() == nullptr ) { // Hier sollte in Argument mitgegeben werden, das anzeigt, da� das Dokument das erste // Mal gespeichert wird, so da� als default .svg ausgew�hlt wird und nicht die zuletzt @@ -898,7 +898,7 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) } } else { Glib::ustring msg; - if ( doc->getURI() == NULL ) + if ( doc->getURI() == nullptr ) { msg = Glib::ustring::format(_("No changes need to be saved.")); } else { @@ -1039,7 +1039,7 @@ sp_file_save_template(Gtk::Window &parentWindow, Glib::ustring name, auto nodeToRemove = sp_repr_lookup_name(root, "inkscape:_templateinfo"); - if (nodeToRemove != NULL){ + if (nodeToRemove != nullptr){ sp_repr_unparent(nodeToRemove); delete nodeToRemove; @@ -1071,7 +1071,7 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place) // copy definitions desktop->doc()->importDefs(clipdoc); - Inkscape::XML::Node* clipboard = NULL; + Inkscape::XML::Node* clipboard = nullptr; // copy objects std::vector<Inkscape::XML::Node*> pasted_objects; for (Inkscape::XML::Node *obj = root->firstChild() ; obj ; obj = obj->next()) { @@ -1176,15 +1176,15 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { - doc = NULL; + doc = nullptr; } catch (Inkscape::Extension::Input::open_failed &e) { - doc = NULL; + doc = nullptr; } catch (Inkscape::Extension::Input::open_cancelled &e) { - doc = NULL; + doc = nullptr; cancelled = true; } - if (doc != NULL) { + if (doc != nullptr) { Inkscape::XML::rebase_hrefs(doc, in_doc->getBase(), true); Inkscape::XML::Document *xml_in_doc = in_doc->getReprDoc(); @@ -1194,7 +1194,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // Count the number of top-level items in the imported document. guint items_count = 0; - SPObject *o = NULL; + SPObject *o = nullptr; for (auto& child: doc->getRoot()->children) { if (SP_IS_ITEM(&child)) { items_count++; @@ -1207,12 +1207,12 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, while(items_count==1 && o && SP_IS_GROUP(o) && o->children.size()==1){ std::vector<SPItem *>v; sp_item_group_ungroup(SP_GROUP(o),v,false); - o = v.empty() ? NULL : v[0]; + o = v.empty() ? nullptr : v[0]; did_ungroup=true; } // Create a new group if necessary. - Inkscape::XML::Node *newgroup = NULL; + Inkscape::XML::Node *newgroup = nullptr; if ((style && style->attributeList()) || items_count > 1) { newgroup = xml_in_doc->createElement("svg:g"); sp_repr_css_set(newgroup, style, "style"); @@ -1234,7 +1234,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // Construct a new object representing the imported image, // and insert it into the current document. - SPObject *new_obj = NULL; + SPObject *new_obj = nullptr; for (auto& child: doc->getRoot()->children) { if (SP_IS_ITEM(&child)) { Inkscape::XML::Node *newitem = did_ungroup ? o->getRepr()->duplicate(xml_in_doc) : child.getRepr()->duplicate(xml_in_doc); @@ -1242,8 +1242,8 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // convert layers to groups, and make sure they are unlocked // FIXME: add "preserve layers" mode where each layer from // import is copied to the same-named layer in host - newitem->setAttribute("inkscape:groupmode", NULL); - newitem->setAttribute("sodipodi:insensitive", NULL); + newitem->setAttribute("inkscape:groupmode", nullptr); + newitem->setAttribute("sodipodi:insensitive", nullptr); if (newgroup) newgroup->appendChild(newitem); else new_obj = place_to_insert->appendChildRepr(newitem); @@ -1296,7 +1296,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, g_free(text); } - return NULL; + return nullptr; } @@ -1354,7 +1354,7 @@ sp_file_import(Gtk::Window &parentWindow) Inkscape::Extension::Extension *selection = importDialogInstance->getSelectionType(); delete importDialogInstance; - importDialogInstance = NULL; + importDialogInstance = nullptr; //# Iterate through filenames if more than 1 if (flist.size() > 1) @@ -1695,7 +1695,7 @@ sp_file_export_to_ocal(Gtk::Window &parentWindow) ## I M P O R T F R O M O C A L ######################*/ -Inkscape::UI::Dialog::OCAL::ImportDialog* import_ocal_dialog = NULL; +Inkscape::UI::Dialog::OCAL::ImportDialog* import_ocal_dialog = nullptr; /** * Display an ImportFromOcal Dialog, and the selected document from OCAL @@ -1719,7 +1719,7 @@ sp_file_import_from_ocal(Gtk::Window &parent_window) if (!doc) return; - if (import_ocal_dialog == NULL) { + if (import_ocal_dialog == nullptr) { import_ocal_dialog = new Inkscape::UI::Dialog::OCAL::ImportDialog( parent_window, diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 2ab7aff48..2ce29b852 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -87,7 +87,7 @@ static void set_filter_area(Inkscape::XML::Node *repr, gdouble radius, SPFilter *new_filter(SPDocument *document) { - g_return_val_if_fail(document != NULL, NULL); + g_return_val_if_fail(document != nullptr, NULL); SPDefs *defs = document->getDefs(); @@ -114,7 +114,7 @@ SPFilter *new_filter(SPDocument *document) SPFilter *f = SP_FILTER( document->getObjectByRepr(repr) ); - g_assert(f != NULL); + g_assert(f != nullptr); g_assert(SP_IS_FILTER(f)); return f; @@ -181,7 +181,7 @@ filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveT // get corresponding object SPFilterPrimitive *prim = SP_FILTER_PRIMITIVE( filter->document->getObjectByRepr(repr) ); - g_assert(prim != NULL); + g_assert(prim != nullptr); g_assert(SP_IS_FILTER_PRIMITIVE(prim)); return prim; @@ -193,7 +193,7 @@ filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveT SPFilter * new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) { - g_return_val_if_fail(document != NULL, NULL); + g_return_val_if_fail(document != nullptr, NULL); SPDefs *defs = document->getDefs(); @@ -240,9 +240,9 @@ new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion SPFilter *f = SP_FILTER( document->getObjectByRepr(repr) ); SPGaussianBlur *b = SP_GAUSSIANBLUR( document->getObjectByRepr(b_repr) ); - g_assert(f != NULL); + g_assert(f != nullptr); g_assert(SP_IS_FILTER(f)); - g_assert(b != NULL); + g_assert(b != nullptr); g_assert(SP_IS_GAUSSIANBLUR(b)); return f; @@ -257,7 +257,7 @@ static SPFilter * new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) { - g_return_val_if_fail(document != NULL, NULL); + g_return_val_if_fail(document != nullptr, NULL); SPDefs *defs = document->getDefs(); @@ -305,7 +305,7 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo Inkscape::GC::release(b_repr); SPGaussianBlur *b = SP_GAUSSIANBLUR( document->getObjectByRepr(b_repr) ); - g_assert(b != NULL); + g_assert(b != nullptr); g_assert(SP_IS_GAUSSIANBLUR(b)); } // Blend primitive @@ -327,11 +327,11 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo } SPFeBlend *b = SP_FEBLEND(document->getObjectByRepr(b_repr)); - g_assert(b != NULL); + g_assert(b != nullptr); g_assert(SP_IS_FEBLEND(b)); } - g_assert(f != NULL); + g_assert(f != nullptr); g_assert(SP_IS_FILTER(f)); return f; diff --git a/src/gc-anchored.cpp b/src/gc-anchored.cpp index 3ce6eff7b..d70a55405 100644 --- a/src/gc-anchored.cpp +++ b/src/gc-anchored.cpp @@ -74,7 +74,7 @@ void Anchored::release() const { g_return_if_fail(_anchor); if (!--_anchor->refcount) { _free_anchor(_anchor); - _anchor = NULL; + _anchor = nullptr; } } diff --git a/src/gc-anchored.h b/src/gc-anchored.h index 772621eb2..04fb93436 100644 --- a/src/gc-anchored.h +++ b/src/gc-anchored.h @@ -55,12 +55,12 @@ public: } protected: - Anchored() : _anchor(NULL) { anchor(); } // initial refcount of one + Anchored() : _anchor(nullptr) { anchor(); } // initial refcount of one virtual ~Anchored() {} private: struct Anchor : public Managed<SCANNED, MANUAL> { - Anchor() : refcount(0),base(NULL) {} + Anchor() : refcount(0),base(nullptr) {} Anchor(Anchored const *obj) : refcount(0) { base = Core::base(const_cast<Anchored *>(obj)); } diff --git a/src/gc-finalized.h b/src/gc-finalized.h index 887603806..34dc387ad 100644 --- a/src/gc-finalized.h +++ b/src/gc-finalized.h @@ -98,7 +98,7 @@ public: if ( old_cleanup != _invoke_dtor ) { Core::register_finalizer_ignore_self(base, old_cleanup, old_data, - NULL, NULL); + nullptr, nullptr); } } } @@ -107,7 +107,7 @@ public: virtual ~Finalized() { // make sure the destructor won't get invoked twice Core::register_finalizer_ignore_self(Core::base(this), - NULL, NULL, NULL, NULL); + nullptr, nullptr, nullptr, nullptr); } private: diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 110aa8b38..17c61d3c0 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -94,7 +94,7 @@ SPGradient *sp_gradient_ensure_vector_normalized(SPGradient *gr) #ifdef SP_GR_VERBOSE g_message("sp_gradient_ensure_vector_normalized(%p)", gr); #endif - g_return_val_if_fail(gr != NULL, NULL); + g_return_val_if_fail(gr != nullptr, NULL); g_return_val_if_fail(SP_IS_GRADIENT(gr), NULL); g_return_val_if_fail(!SP_IS_MESHGRADIENT(gr), NULL); @@ -103,7 +103,7 @@ SPGradient *sp_gradient_ensure_vector_normalized(SPGradient *gr) /* Fail, if we have wrong state set */ if (gr->state != SP_GRADIENT_STATE_UNKNOWN) { g_warning("file %s: line %d: Cannot normalize private gradient to vector (%s)", __FILE__, __LINE__, gr->getId()); - return NULL; + return nullptr; } /* First make sure we have vector directly defined (i.e. gr has its own stops) */ @@ -120,7 +120,7 @@ SPGradient *sp_gradient_ensure_vector_normalized(SPGradient *gr) if (gr->ref->getObject()) { // We are hrefing someone, so require flattening gr->updateRepr(SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL); - sp_gradient_repr_set_link(gr->getRepr(), NULL); + sp_gradient_repr_set_link(gr->getRepr(), nullptr); } } @@ -139,8 +139,8 @@ static SPGradient *sp_gradient_get_private_normalized(SPDocument *document, SPGr g_message("sp_gradient_get_private_normalized(%p, %p, %d)", document, shared, type); #endif - g_return_val_if_fail(document != NULL, NULL); - g_return_val_if_fail(shared != NULL, NULL); + g_return_val_if_fail(document != nullptr, NULL); + g_return_val_if_fail(shared != nullptr, NULL); g_return_val_if_fail(SP_IS_GRADIENT(shared), NULL); g_return_val_if_fail(shared->hasStops() || shared->hasPatches(), NULL); @@ -169,7 +169,7 @@ static SPGradient *sp_gradient_get_private_normalized(SPDocument *document, SPGr // get corresponding object SPGradient *gr = static_cast<SPGradient *>(document->getObjectByRepr(repr)); - g_assert(gr != NULL); + g_assert(gr != nullptr); g_assert(SP_IS_GRADIENT(gr)); return gr; @@ -218,7 +218,7 @@ static SPGradient *sp_gradient_fork_private_if_necessary(SPGradient *gr, SPGradi #ifdef SP_GR_VERBOSE g_message("sp_gradient_fork_private_if_necessary(%p, %p, %d, %p)", gr, shared, type, o); #endif - g_return_val_if_fail(gr != NULL, NULL); + g_return_val_if_fail(gr != nullptr, NULL); g_return_val_if_fail(SP_IS_GRADIENT(gr), NULL); // Orphaned gradient, no shared with stops or patches at the end of the line; this used to be @@ -292,7 +292,7 @@ static SPGradient *sp_gradient_fork_private_if_necessary(SPGradient *gr, SPGradi repr_new->appendChild( copy ); Inkscape::GC::release( copy ); } - sp_gradient_repr_set_link(repr_new, NULL); + sp_gradient_repr_set_link(repr_new, nullptr); } return gr_new; } else { @@ -315,7 +315,7 @@ SPGradient *sp_gradient_fork_vector_if_necessary(SPGradient *gr) Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *repr = gr->getRepr()->duplicate(xml_doc); - doc->getDefs()->getRepr()->addChild(repr, NULL); + doc->getDefs()->getRepr()->addChild(repr, nullptr); SPGradient *gr_new = static_cast<SPGradient *>(doc->getObjectByRepr(repr)); gr_new = sp_gradient_ensure_vector_normalized (gr_new); Inkscape::GC::release(repr); @@ -595,7 +595,7 @@ void sp_gradient_transform_multiply(SPGradient *gradient, Geom::Affine postmul, SPGradient *getGradient(SPItem *item, Inkscape::PaintTarget fill_or_stroke) { SPStyle *style = item->style; - SPGradient *gradient = 0; + SPGradient *gradient = nullptr; switch (fill_or_stroke) { @@ -622,18 +622,18 @@ SPGradient *getGradient(SPItem *item, Inkscape::PaintTarget fill_or_stroke) SPStop *sp_last_stop(SPGradient *gradient) { - for (SPStop *stop = gradient->getFirstStop(); stop != NULL; stop = stop->getNextStop()) { - if (stop->getNextStop() == NULL) + for (SPStop *stop = gradient->getFirstStop(); stop != nullptr; stop = stop->getNextStop()) { + if (stop->getNextStop() == nullptr) return stop; } - return NULL; + return nullptr; } SPStop *sp_get_stop_i(SPGradient *gradient, guint stop_i) { SPStop *stop = gradient->getFirstStop(); if (!stop) { - return NULL; + return nullptr; } // if this is valid but weird gradient without an offset-zero stop element, @@ -646,7 +646,7 @@ SPStop *sp_get_stop_i(SPGradient *gradient, guint stop_i) for (guint i = 0; i < stop_i; i++) { if (!stop) { - return NULL; + return nullptr; } stop = stop->getNextStop(); } @@ -670,7 +670,7 @@ SPStop *sp_vector_add_stop(SPGradient *vector, SPStop* prev_stop, SPStop* next_s g_message("sp_vector_add_stop(%p, %p, %p, %f)", vector, prev_stop, next_stop, offset); #endif - Inkscape::XML::Node *new_stop_repr = NULL; + Inkscape::XML::Node *new_stop_repr = nullptr; new_stop_repr = prev_stop->getRepr()->duplicate(vector->getRepr()->document()); vector->getRepr()->addChild(new_stop_repr, prev_stop->getRepr()); @@ -895,7 +895,7 @@ void sp_item_gradient_stop_set_style(SPItem *item, GrPointType point_type, guint case POINT_MG_CORNER: { // Update mesh array (which is not updated automatically when stop is changed?) - gchar const* color_str = sp_repr_css_property( stop, "stop-color", NULL ); + gchar const* color_str = sp_repr_css_property( stop, "stop-color", nullptr ); if( color_str ) { SPColor color( 0 ); SPIPaint paint; @@ -906,7 +906,7 @@ void sp_item_gradient_stop_set_style(SPItem *item, GrPointType point_type, guint mg->array.corners[ point_i ]->color = color; changed = true; } - gchar const* opacity_str = sp_repr_css_property( stop, "stop-opacity", NULL ); + gchar const* opacity_str = sp_repr_css_property( stop, "stop-opacity", nullptr ); if( opacity_str ) { std::stringstream os( opacity_str ); double opacity = 1.0; @@ -1281,7 +1281,7 @@ SPGradient *sp_item_gradient_get_vector(SPItem *item, Inkscape::PaintTarget fill if (gradient) { return gradient->getVector(); } - return NULL; + return nullptr; } SPGradientSpread sp_item_gradient_get_spread(SPItem *item, Inkscape::PaintTarget fill_or_stroke) @@ -1422,16 +1422,16 @@ SPGradient *sp_item_set_gradient(SPItem *item, SPGradient *gr, SPGradientType ty #ifdef SP_GR_VERBOSE g_message("sp_item_set_gradient(%p, %p, %d, %d)", item, gr, type, fill_or_stroke); #endif - g_return_val_if_fail(item != NULL, NULL); + g_return_val_if_fail(item != nullptr, NULL); g_return_val_if_fail(SP_IS_ITEM(item), NULL); - g_return_val_if_fail(gr != NULL, NULL); + g_return_val_if_fail(gr != nullptr, NULL); g_return_val_if_fail(SP_IS_GRADIENT(gr), NULL); g_return_val_if_fail(gr->state == SP_GRADIENT_STATE_VECTOR, NULL); SPStyle *style = item->style; - g_assert(style != NULL); + g_assert(style != nullptr); - SPPaintServer *ps = NULL; + SPPaintServer *ps = nullptr; if ((fill_or_stroke == Inkscape::FOR_FILL) ? style->fill.isPaintserver() : style->stroke.isPaintserver()) { ps = (fill_or_stroke == Inkscape::FOR_FILL) ? SP_STYLE_FILL_SERVER(style) : SP_STYLE_STROKE_SERVER(style); } @@ -1466,7 +1466,7 @@ SPGradient *sp_item_set_gradient(SPItem *item, SPGradient *gr, SPGradientType ty // normalize it (this includes creating new private if necessary) SPGradient *normalized = sp_gradient_fork_private_if_necessary(current, gr, type, item); - g_return_val_if_fail(normalized != NULL, NULL); + g_return_val_if_fail(normalized != nullptr, NULL); if (normalized != current) { @@ -1496,7 +1496,7 @@ static void sp_gradient_repr_set_link(Inkscape::XML::Node *repr, SPGradient *lin #ifdef SP_GR_VERBOSE g_message("sp_gradient_repr_set_link(%p, %p)", repr, link); #endif - g_return_if_fail(repr != NULL); + g_return_if_fail(repr != nullptr); if (link) { g_return_if_fail(SP_IS_GRADIENT(link)); } @@ -1506,7 +1506,7 @@ static void sp_gradient_repr_set_link(Inkscape::XML::Node *repr, SPGradient *lin ref += link->getId(); repr->setAttribute("xlink:href", ref.c_str()); } else { - repr->setAttribute("xlink:href", 0); + repr->setAttribute("xlink:href", nullptr); } } @@ -1553,12 +1553,12 @@ SPGradient *sp_document_default_gradient_vector( SPDocument *document, SPColor c addStop( repr, colorStr, 0, "1" ); } - defs->getRepr()->addChild(repr, NULL); + defs->getRepr()->addChild(repr, nullptr); Inkscape::GC::release(repr); /* fixme: This does not look like nice */ SPGradient *gr = static_cast<SPGradient *>(document->getObjectByRepr(repr)); - g_assert(gr != NULL); + g_assert(gr != nullptr); g_assert(SP_IS_GRADIENT(gr)); /* fixme: Maybe add extra sanity check here */ gr->state = SP_GRADIENT_STATE_VECTOR; @@ -1570,7 +1570,7 @@ SPGradient *sp_gradient_vector_for_object( SPDocument *const doc, SPDesktop *con SPObject *const o, Inkscape::PaintTarget const fill_or_stroke, bool singleStop ) { SPColor color; - if ( (o == NULL) || (o->style == NULL) ) { + if ( (o == nullptr) || (o->style == nullptr) ) { color = sp_desktop_get_color(desktop, (fill_or_stroke == Inkscape::FOR_FILL)); } else { // take the color of the object @@ -1637,7 +1637,7 @@ void sp_gradient_reverse_selected_gradients(SPDesktop *desktop) void sp_gradient_unset_swatch(SPDesktop *desktop, std::string id) { - SPDocument *doc = desktop ? desktop->doc() : 0; + SPDocument *doc = desktop ? desktop->doc() : nullptr; if (doc) { const std::vector<SPObject *> gradients = doc->getResourceList("gradient"); diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index a67d18e9f..7551e11c4 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -219,7 +219,7 @@ Glib::ustring GrDrag::makeStopSafeColor( gchar const *str, bool &isNull ) if (firstStop) { Glib::ustring stopColorStr; if (firstStop->currentColor) { - stopColorStr = firstStop->getStyleProperty("color", NULL); + stopColorStr = firstStop->getStyleProperty("color", nullptr); } else { stopColorStr = firstStop->specified_color.toString(); } @@ -360,7 +360,7 @@ guint32 GrDrag::getColor() SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double tolerance) { gfloat new_stop_offset = 0; // type of SPStop.offset = gfloat - SPGradient *gradient = 0; + SPGradient *gradient = nullptr; //bool r1_knot = false; // For Mesh @@ -532,7 +532,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler } if (!next_stop) { // logical error: the endstop should have offset 1 and should always be more than this offset here - return NULL; + return nullptr; } @@ -569,7 +569,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler } // Mesh } - return NULL; + return nullptr; } @@ -585,7 +585,7 @@ bool GrDrag::dropColor(SPItem */*item*/, gchar const *c, Geom::Point p) if (Geom::L2(p - d->point)*desktop->current_zoom() < 5) { SPCSSAttr *stop = sp_repr_css_attr_new (); - sp_repr_css_set_property( stop, "stop-color", stopIsNull ? 0 : toUse.c_str() ); + sp_repr_css_set_property( stop, "stop-color", stopIsNull ? nullptr : toUse.c_str() ); sp_repr_css_set_property( stop, "stop-opacity", "1" ); for(std::vector<GrDraggable *>::const_iterator j = d->draggables.begin(); j != d->draggables.end(); ++j) { //for all draggables of dragger GrDraggable *draggable = *j; @@ -609,7 +609,7 @@ bool GrDrag::dropColor(SPItem */*item*/, gchar const *c, Geom::Point p) SPStop *stop = addStopNearPoint(line->item, p, 5/desktop->current_zoom()); if (stop) { SPCSSAttr *css = sp_repr_css_attr_new(); - sp_repr_css_set_property( css, "stop-color", stopIsNull ? 0 : toUse.c_str() ); + sp_repr_css_set_property( css, "stop-color", stopIsNull ? nullptr : toUse.c_str() ); sp_repr_css_set_property( css, "stop-opacity", "1" ); sp_repr_css_change(stop->getRepr(), css, "style"); return true; @@ -682,7 +682,7 @@ GrDrag::~GrDrag() desktop->gr_point_i = draggable->point_i; desktop->gr_fill_or_stroke = draggable->fill_or_stroke; } else { - desktop->gr_item = NULL; + desktop->gr_item = nullptr; desktop->gr_point_type = POINT_LG_BEGIN; desktop->gr_point_i = 0; desktop->gr_fill_or_stroke = Inkscape::FOR_FILL; @@ -720,7 +720,7 @@ GrDraggable::~GrDraggable() SPObject *GrDraggable::getServer() { - SPObject *server = 0; + SPObject *server = nullptr; if (item) { switch (fill_or_stroke) { case Inkscape::FOR_FILL: @@ -760,7 +760,7 @@ static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui // with Shift; unsnap if we carry more than one draggable if (dragger->draggables.size()>1) { // create a new dragger - GrDragger *dr_new = new GrDragger (dragger->parent, dragger->point, NULL); + GrDragger *dr_new = new GrDragger (dragger->parent, dragger->point, nullptr); dragger->parent->draggers.insert(dragger->parent->draggers.begin(), dr_new); // relink to it all but the first draggable in the list std::vector<GrDraggable *>::const_iterator i = dragger->draggables.begin(); @@ -978,7 +978,7 @@ static void gr_midpoint_limits(GrDragger *dragger, SPObject *server, Geom::Point *begin = d_temp->point; d_temp = drag->getDraggerFor (draggable->item, POINT_LG_MID, highest_i + 1, draggable->fill_or_stroke); - if (d_temp == NULL) { + if (d_temp == nullptr) { d_temp = drag->getDraggerFor (draggable->item, POINT_LG_END, num-1, draggable->fill_or_stroke); } if (d_temp) @@ -995,7 +995,7 @@ static void gr_midpoint_limits(GrDragger *dragger, SPObject *server, Geom::Point *begin = d_temp->point; d_temp = drag->getDraggerFor (draggable->item, draggable->point_type, highest_i + 1, draggable->fill_or_stroke); - if (d_temp == NULL) { + if (d_temp == nullptr) { d_temp = drag->getDraggerFor (draggable->item, (draggable->point_type==POINT_RG_MID1) ? POINT_RG_R1 : POINT_RG_R2, num-1, draggable->fill_or_stroke); } if (d_temp) @@ -1142,7 +1142,7 @@ static void gr_knot_clicked_handler(SPKnot */*knot*/, guint state, gpointer data SPGradient *gradient = getGradient(draggable->item, draggable->fill_or_stroke); gradient = gradient->getVector(); if (gradient->vector.stops.size() > 2) { // 2 is the minimum - SPStop *stop = NULL; + SPStop *stop = nullptr; switch (draggable->point_type) { // if we delete first or last stop, move the next/previous to the edge case POINT_LG_BEGIN: @@ -1463,7 +1463,7 @@ void GrDragger::updateTip() { if (this->knot && this->knot->tip) { g_free (this->knot->tip); - this->knot->tip = NULL; + this->knot->tip = nullptr; } if (this->draggables.size() == 1) { @@ -1662,7 +1662,7 @@ GrDragger::GrDragger(GrDrag *parent, Geom::Point p, GrDraggable *draggable) this->parent = parent; // create the knot - this->knot = new SPKnot(parent->desktop, NULL); + this->knot = new SPKnot(parent->desktop, nullptr); this->knot->setMode(SP_KNOT_MODE_XOR); guint32 fill_color = GR_KNOT_COLOR_NORMAL; if (draggable && draggable->point_type == POINT_MG_CORNER) { @@ -1741,7 +1741,7 @@ GrDragger *GrDrag::getDraggerFor(GrDraggable *d) { } } } - return NULL; + return nullptr; } /** @@ -1761,7 +1761,7 @@ GrDragger *GrDrag::getDraggerFor(SPItem *item, GrPointType point_type, gint poin } } } - return NULL; + return nullptr; } @@ -1816,7 +1816,7 @@ GrDragger* GrDragger::getMgCorner(){ } } } - return NULL; + return nullptr; } /** @@ -1963,7 +1963,7 @@ void GrDrag::deselect_all() void GrDrag::deselectAll() { deselect_all(); - this->desktop->emitToolSubselectionChanged(NULL); + this->desktop->emitToolSubselectionChanged(nullptr); } /** @@ -2034,7 +2034,7 @@ void GrDrag::selectRect(Geom::Rect const &r) */ void GrDrag::setSelected(GrDragger *dragger, bool add_to_selection, bool override) { - GrDragger *seldragger = NULL; + GrDragger *seldragger = nullptr; // Don't allow selecting a mesh handle or mesh tensor. // We might want to rethink since a dragger can have draggables of different types. @@ -2406,7 +2406,7 @@ void GrDrag::updateDraggers() } this->draggers.clear(); - g_return_if_fail(this->selection != NULL); + g_return_if_fail(this->selection != nullptr); auto list = this->selection->items(); for (auto i = list.begin(); i != list.end(); ++i) { SPItem *item = *i; @@ -2455,7 +2455,7 @@ void GrDrag::updateDraggers() void GrDrag::refreshDraggers() { - g_return_if_fail(this->selection != NULL); + g_return_if_fail(this->selection != nullptr); auto list = this->selection->items(); for (auto i = list.begin(); i != list.end(); ++i) { SPItem *item = *i; @@ -2516,7 +2516,7 @@ void GrDrag::updateLines() } this->lines.clear(); - g_return_if_fail(this->selection != NULL); + g_return_if_fail(this->selection != nullptr); auto list = this->selection->items(); for (auto i = list.begin(); i != list.end(); ++i) { @@ -2701,7 +2701,7 @@ void GrDrag::updateLevels() hor_levels.clear(); vert_levels.clear(); - g_return_if_fail (this->selection != NULL); + g_return_if_fail (this->selection != nullptr); auto list = this->selection->items(); for (auto i = list.begin(); i != list.end(); ++i) { @@ -2835,7 +2835,7 @@ void GrDrag::selected_move_screen(double x, double y) */ GrDragger *GrDrag::select_next() { - GrDragger *d = NULL; + GrDragger *d = nullptr; if (selected.empty() || (++find(draggers.begin(),draggers.end(),*(selected.begin())))==draggers.end()) { if (!draggers.empty()) d = draggers[0]; @@ -2852,7 +2852,7 @@ GrDragger *GrDrag::select_next() */ GrDragger *GrDrag::select_prev() { - GrDragger *d = NULL; + GrDragger *d = nullptr; if (selected.empty() || draggers[0] == (*(selected.begin()))) { if (!draggers.empty()) d = draggers[draggers.size()-1]; @@ -2870,7 +2870,7 @@ void GrDrag::deleteSelected(bool just_one) { if (selected.empty()) return; - SPDocument *document = NULL; + SPDocument *document = nullptr; struct StructStopInfo { SPStop * spstop; @@ -2913,7 +2913,7 @@ void GrDrag::deleteSelected(bool just_one) case POINT_RG_R1: case POINT_RG_R2: { - SPStop *stop = NULL; + SPStop *stop = nullptr; if ( (draggable->point_type == POINT_LG_BEGIN) || (draggable->point_type == POINT_RG_CENTER) ) { stop = vector->getFirstStop(); } else { @@ -3077,7 +3077,7 @@ void GrDrag::deleteSelected(bool just_one) unselectedrepr = unselectedrepr->next(); } - if (unselectedrepr == NULL) { + if (unselectedrepr == nullptr) { if (stopinfo->draggable->fill_or_stroke == Inkscape::FOR_FILL) { sp_repr_css_unset_property (css, "fill"); } else { diff --git a/src/graphlayout.cpp b/src/graphlayout.cpp index ff00370bd..e347ceb5a 100644 --- a/src/graphlayout.cpp +++ b/src/graphlayout.cpp @@ -43,7 +43,7 @@ using namespace vpsc; * Returns true if item is a connector */ bool isConnector(SPItem const * const item) { - SPPath * path = NULL; + SPPath * path = nullptr; if (SP_IS_PATH(item)) { path = SP_PATH(item); } @@ -163,7 +163,7 @@ void graphlayout(std::vector<SPItem*> const & items) { iv = items[0]; } - if (iv == NULL) { + if (iv == nullptr) { // The connector is not attached to anything at the // other end so we should just ignore it. continue; @@ -191,7 +191,7 @@ void graphlayout(std::vector<SPItem*> const & items) { for (Component * c: cs) { if (c->edges.size() < 2) continue; CheckProgress test(0.0001, 100, selected, rs, nodelookup); - ConstrainedMajorizationLayout alg(c->rects, c->edges, NULL, ideal_connector_length, elengths, &test); + ConstrainedMajorizationLayout alg(c->rects, c->edges, nullptr, ideal_connector_length, elengths, &test); if (avoid_overlaps) alg.setAvoidOverlaps(); alg.setConstraints(&constraints); alg.run(); diff --git a/src/guide-snapper.cpp b/src/guide-snapper.cpp index 96864f8e5..1842f3763 100644 --- a/src/guide-snapper.cpp +++ b/src/guide-snapper.cpp @@ -40,7 +40,7 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(Geom::Poi { LineList s; - if ( NULL == _snapmanager->getNamedView() || ThisSnapperMightSnap() == false) { + if ( nullptr == _snapmanager->getNamedView() || ThisSnapperMightSnap() == false) { return s; } @@ -60,7 +60,7 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(Geom::Poi */ bool Inkscape::GuideSnapper::ThisSnapperMightSnap() const { - if (_snapmanager->getNamedView() == NULL) { + if (_snapmanager->getNamedView() == nullptr) { return false; } diff --git a/src/help.cpp b/src/help.cpp index 643945a69..93bf715c9 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -31,7 +31,7 @@ void sp_help_open_tutorial(GtkMenuItem *, void* data) { gchar const *name = static_cast<gchar const *>(data); gchar *c = g_build_filename(INKSCAPE_TUTORIALSDIR, name, NULL); - sp_file_open(c, NULL, false, false); + sp_file_open(c, nullptr, false, false); g_free(c); } diff --git a/src/helper/action-context.cpp b/src/helper/action-context.cpp index 1ea12776b..e9299f7eb 100644 --- a/src/helper/action-context.cpp +++ b/src/helper/action-context.cpp @@ -18,19 +18,19 @@ namespace Inkscape { ActionContext::ActionContext() - : _selection(NULL) - , _view(NULL) + : _selection(nullptr) + , _view(nullptr) { } ActionContext::ActionContext(Selection *selection) : _selection(selection) - , _view(NULL) + , _view(nullptr) { } ActionContext::ActionContext(UI::View::View *view) - : _selection(NULL) + : _selection(nullptr) , _view(view) { SPDesktop *desktop = static_cast<SPDesktop *>(view); @@ -41,8 +41,8 @@ ActionContext::ActionContext(UI::View::View *view) SPDocument *ActionContext::getDocument() const { - if (_selection == NULL) { - return NULL; + if (_selection == nullptr) { + return nullptr; } // Should be the same as the view's document, if view is non-NULL diff --git a/src/helper/action.cpp b/src/helper/action.cpp index 48e051ada..6e44487f9 100644 --- a/src/helper/action.cpp +++ b/src/helper/action.cpp @@ -45,8 +45,8 @@ sp_action_init (SPAction *action) action->sensitive = 0; action->active = 0; action->context = Inkscape::ActionContext(); - action->id = action->name = action->tip = NULL; - action->image = NULL; + action->id = action->name = action->tip = nullptr; + action->image = nullptr; new (&action->signal_perform) sigc::signal<void>(); new (&action->signal_set_sensitive) sigc::signal<void, bool>(); @@ -86,7 +86,7 @@ sp_action_new(Inkscape::ActionContext const &context, const gchar *image, Inkscape::Verb * verb) { - SPAction *action = (SPAction *)g_object_new(SP_TYPE_ACTION, NULL); + SPAction *action = (SPAction *)g_object_new(SP_TYPE_ACTION, nullptr); action->context = context; action->sensitive = TRUE; @@ -131,7 +131,7 @@ public: */ void sp_action_perform(SPAction *action, void * /*data*/) { - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); g_return_if_fail (SP_IS_ACTION (action)); Inkscape::Debug::EventTracker<ActionEvent> tracker(action); @@ -144,7 +144,7 @@ void sp_action_perform(SPAction *action, void * /*data*/) void sp_action_set_active (SPAction *action, unsigned int active) { - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); g_return_if_fail (SP_IS_ACTION (action)); action->signal_set_active.emit(active); @@ -156,7 +156,7 @@ sp_action_set_active (SPAction *action, unsigned int active) void sp_action_set_sensitive (SPAction *action, unsigned int sensitive) { - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); g_return_if_fail (SP_IS_ACTION (action)); action->signal_set_sensitive.emit(sensitive); @@ -165,7 +165,7 @@ sp_action_set_sensitive (SPAction *action, unsigned int sensitive) void sp_action_set_name (SPAction *action, Glib::ustring const &name) { - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); g_return_if_fail (SP_IS_ACTION (action)); g_free(action->name); diff --git a/src/helper/geom-pathstroke.cpp b/src/helper/geom-pathstroke.cpp index c3e4f8213..b9cc1a38f 100644 --- a/src/helper/geom-pathstroke.cpp +++ b/src/helper/geom-pathstroke.cpp @@ -401,10 +401,10 @@ void extrapolate_join_internal(join_data jd, int alternative) std::vector<Geom::ShapeIntersection> points; - Geom::EllipticalArc *arc1 = NULL; - Geom::EllipticalArc *arc2 = NULL; - Geom::LineSegment *seg1 = NULL; - Geom::LineSegment *seg2 = NULL; + Geom::EllipticalArc *arc1 = nullptr; + Geom::EllipticalArc *arc2 = nullptr; + Geom::LineSegment *seg1 = nullptr; + Geom::LineSegment *seg2 = nullptr; Geom::Point sol; Geom::Point p1; Geom::Point p2; diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index 6bdf911e5..e83fb42f2 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -330,8 +330,8 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000, y1tt = s * y01t + t * y11t; yttt = s * y0tt + t * y1tt; - geom_cubic_bbox_wind_distance (x000, y000, x00t, y00t, x0tt, y0tt, xttt, yttt, pt, NULL, wind, best, tolerance); - geom_cubic_bbox_wind_distance (xttt, yttt, x1tt, y1tt, x11t, y11t, x111, y111, pt, NULL, wind, best, tolerance); + geom_cubic_bbox_wind_distance (x000, y000, x00t, y00t, x0tt, y0tt, xttt, yttt, pt, nullptr, wind, best, tolerance); + geom_cubic_bbox_wind_distance (xttt, yttt, x1tt, y1tt, x11t, y11t, x111, y111, pt, nullptr, wind, best, tolerance); } else { geom_line_wind_distance (x000, y000, x111, y111, pt, wind, best); } diff --git a/src/helper/gettext.cpp b/src/helper/gettext.cpp index 1942b373c..226304267 100644 --- a/src/helper/gettext.cpp +++ b/src/helper/gettext.cpp @@ -68,7 +68,7 @@ void initialize_gettext() { // Allow the user to override the locale directory by setting // the environment variable INKSCAPE_LOCALEDIR. char const *inkscape_localedir = g_getenv("INKSCAPE_LOCALEDIR"); - if (inkscape_localedir != NULL) { + if (inkscape_localedir != nullptr) { bindtextdomain(GETTEXT_PACKAGE, inkscape_localedir); } diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 3b43735ad..947af3b50 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -73,7 +73,7 @@ bool sp_export_jpg_file(SPDocument *doc, gchar const *filename, gchar c[32]; g_snprintf(c, 32, "%f", quality); - gboolean saved = gdk_pixbuf_save(pixbuf->getPixbufRaw(), filename, "jpeg", NULL, "quality", c, NULL); + gboolean saved = gdk_pixbuf_save(pixbuf->getPixbufRaw(), filename, "jpeg", nullptr, "quality", c, NULL); return saved; } @@ -99,9 +99,9 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi SPItem *item_only) { - if (width == 0 || height == 0) return NULL; + if (width == 0 || height == 0) return nullptr; - Inkscape::Pixbuf *inkpb = NULL; + Inkscape::Pixbuf *inkpb = nullptr; /* Create new drawing for offscreen rendering*/ Inkscape::Drawing drawing; drawing.setExact(true); diff --git a/src/helper/pixbuf-ops.h b/src/helper/pixbuf-ops.h index 067bc0be4..6f326a286 100644 --- a/src/helper/pixbuf-ops.h +++ b/src/helper/pixbuf-ops.h @@ -18,11 +18,11 @@ class SPDocument; namespace Inkscape { class Pixbuf; } bool sp_export_jpg_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, - unsigned int width, unsigned int height, double xdpi, double ydpi, unsigned long bgcolor, double quality, SPItem *item_only = NULL); + unsigned int width, unsigned int height, double xdpi, double ydpi, unsigned long bgcolor, double quality, SPItem *item_only = nullptr); Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, - unsigned long bgcolor, SPItem *item_only = NULL); + unsigned long bgcolor, SPItem *item_only = nullptr); #endif diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 93b07d410..a66d683ac 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -70,7 +70,7 @@ typedef struct SPPNGBD { */ class PngTextList { public: - PngTextList() : count(0), textItems(0) {} + PngTextList() : count(0), textItems(nullptr) {} ~PngTextList(); void add(gchar const* key, gchar const* text); @@ -97,7 +97,7 @@ void PngTextList::add(gchar const* key, gchar const* text) { if (count < 0) { count = 0; - textItems = 0; + textItems = nullptr; } png_text* tmp = (count > 0) ? g_try_renew(png_text, textItems, count + 1): g_try_new(png_text, 1); if (tmp) { @@ -111,12 +111,12 @@ void PngTextList::add(gchar const* key, gchar const* text) item->text_length = 0; #ifdef PNG_iTXt_SUPPORTED item->itxt_length = 0; - item->lang = 0; - item->lang_key = 0; + item->lang = nullptr; + item->lang_key = nullptr; #endif // PNG_iTXt_SUPPORTED } else { g_warning("Unable to allocate arrary for %d PNG text data.", count); - textItems = 0; + textItems = nullptr; count = 0; } } @@ -127,8 +127,8 @@ sp_png_write_rgba_striped(SPDocument *doc, int (* get_rows)(guchar const **rows, void **to_free, int row, int num_rows, void *data, int color_type, int bit_depth, int antialias), void *data, bool interlace, int color_type, int bit_depth, int zlib, int antialiasing) { - g_return_val_if_fail(filename != NULL, false); - g_return_val_if_fail(data != NULL, false); + g_return_val_if_fail(filename != nullptr, false); + g_return_val_if_fail(data != nullptr, false); struct SPEBP *ebp = (struct SPEBP *) data; FILE *fp; @@ -141,7 +141,7 @@ sp_png_write_rgba_striped(SPDocument *doc, Inkscape::IO::dump_fopen_call(filename, "M"); fp = Inkscape::IO::fopen_utf8name(filename, "wb"); - if(fp == NULL) return false; + if(fp == nullptr) return false; /* Create and initialize the png_struct with the desired error handler * functions. If you want to use the default stderr and longjump method, @@ -149,18 +149,18 @@ sp_png_write_rgba_striped(SPDocument *doc, * the library version is compatible with the one used at compile time, * in case we are using dynamically linked libraries. REQUIRED. */ - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (png_ptr == NULL) { + if (png_ptr == nullptr) { fclose(fp); return false; } /* Allocate/initialize the image information data. REQUIRED */ info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) { + if (info_ptr == nullptr) { fclose(fp); - png_destroy_write_struct(&png_ptr, NULL); + png_destroy_write_struct(&png_ptr, nullptr); return false; } @@ -411,8 +411,8 @@ ExportResult sp_export_png_file(SPDocument *doc, gchar const *filename, void *data, bool force_overwrite, const std::vector<SPItem*> &items_only, bool interlace, int color_type, int bit_depth, int zlib, int antialiasing) { - g_return_val_if_fail(doc != NULL, EXPORT_ERROR); - g_return_val_if_fail(filename != NULL, EXPORT_ERROR); + g_return_val_if_fail(doc != nullptr, EXPORT_ERROR); + g_return_val_if_fail(filename != nullptr, EXPORT_ERROR); g_return_val_if_fail(width >= 1, EXPORT_ERROR); g_return_val_if_fail(height >= 1, EXPORT_ERROR); g_return_val_if_fail(!area.hasZeroArea(), EXPORT_ERROR); diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index d33186344..75dd957c5 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -49,10 +49,10 @@ static SPObject *sp_gradient_load_from_svg(gchar const *name, SPDocument *curren static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current_doc) { - static SPDocument *doc = NULL; + static SPDocument *doc = nullptr; static unsigned int edoc = FALSE; if (!current_doc) { - return NULL; + return nullptr; } /* Try to load from document */ if (!edoc && !doc) { @@ -74,23 +74,23 @@ static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current SPDefs *defs = current_doc->getDefs(); Inkscape::XML::Document *xml_doc = current_doc->getReprDoc(); Inkscape::XML::Node *mark_repr = object->getRepr()->duplicate(xml_doc); - defs->getRepr()->addChild(mark_repr, NULL); + defs->getRepr()->addChild(mark_repr, nullptr); SPObject *cloned_item = current_doc->getObjectByRepr(mark_repr); Inkscape::GC::release(mark_repr); return cloned_item; } } - return NULL; + return nullptr; } static SPObject * sp_pattern_load_from_svg(gchar const *name, SPDocument *current_doc) { - static SPDocument *doc = NULL; + static SPDocument *doc = nullptr; static unsigned int edoc = FALSE; if (!current_doc) { - return NULL; + return nullptr; } /* Try to load from document */ if (!edoc && !doc) { @@ -118,22 +118,22 @@ sp_pattern_load_from_svg(gchar const *name, SPDocument *current_doc) SPDefs *defs = current_doc->getDefs(); Inkscape::XML::Document *xml_doc = current_doc->getReprDoc(); Inkscape::XML::Node *pat_repr = object->getRepr()->duplicate(xml_doc); - defs->getRepr()->addChild(pat_repr, NULL); + defs->getRepr()->addChild(pat_repr, nullptr); Inkscape::GC::release(pat_repr); return object; } } - return NULL; + return nullptr; } static SPObject * sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc) { - static SPDocument *doc = NULL; + static SPDocument *doc = nullptr; static unsigned int edoc = FALSE; if (!current_doc) { - return NULL; + return nullptr; } /* Try to load from document */ if (!edoc && !doc) { @@ -161,12 +161,12 @@ sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc) SPDefs *defs = current_doc->getDefs(); Inkscape::XML::Document *xml_doc = current_doc->getReprDoc(); Inkscape::XML::Node *pat_repr = object->getRepr()->duplicate(xml_doc); - defs->getRepr()->addChild(pat_repr, NULL); + defs->getRepr()->addChild(pat_repr, nullptr); Inkscape::GC::release(pat_repr); return object; } } - return NULL; + return nullptr; } // get_stock_item returns a pointer to an instance of the desired stock object in the current doc @@ -175,7 +175,7 @@ sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc) SPObject *get_stock_item(gchar const *urn, gboolean stock) { - g_assert(urn != NULL); + g_assert(urn != nullptr); /* check its an inkscape URN */ if (!strncmp (urn, "urn:inkscape:", 13)) { @@ -200,9 +200,9 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock) SPDefs *defs = doc->getDefs(); if (!defs) { g_free(base); - return NULL; + return nullptr; } - SPObject *object = NULL; + SPObject *object = nullptr; if (!strcmp(base, "marker") && !stock) { for (auto& child: defs->children) { @@ -240,7 +240,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock) } - if (object == NULL) { + if (object == nullptr) { if (!strcmp(base, "marker")) { object = sp_marker_load_from_svg(name_p, doc); diff --git a/src/id-clash.cpp b/src/id-clash.cpp index 146eeb2b5..5aafee6aa 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -104,7 +104,7 @@ find_references(SPObject *elem, refmap_type &refmap) if (css) { for (unsigned i = 0; i < NUM_CLIPBOARD_PROPERTIES; ++i) { const char *attr = clipboard_properties[i]; - const gchar *value = sp_repr_css_property(css, attr, NULL); + const gchar *value = sp_repr_css_property(css, attr, nullptr); if (value) { gchar *uri = extract_uri(value); if (uri && uri[0] == '#') { @@ -227,8 +227,8 @@ change_clashing_ids(SPDocument *imported_doc, SPDocument *current_doc, for (;;) { new_id += "0123456789"[std::rand() % 10]; const char *str = new_id.c_str(); - if (current_doc->getObjectById(str) == NULL && - imported_doc->getObjectById(str) == NULL) break; + if (current_doc->getObjectById(str) == nullptr && + imported_doc->getObjectById(str) == nullptr) break; } // Change to the new ID @@ -393,7 +393,7 @@ void rename_id(SPObject *elem, Glib::ustring const &new_name) new_name2 += '-'; for (;;) { new_name2 += "0123456789"[std::rand() % 10]; - if (current_doc->getObjectById(new_name2) == NULL) + if (current_doc->getObjectById(new_name2) == nullptr) break; } } diff --git a/src/inkgc/gc-alloc.h b/src/inkgc/gc-alloc.h index a92f38d7a..7a48bfa43 100644 --- a/src/inkgc/gc-alloc.h +++ b/src/inkgc/gc-alloc.h @@ -47,7 +47,7 @@ public: return std::numeric_limits<std::size_t>::max() / sizeof(T); } - pointer allocate(size_type count, void const * =NULL) { + pointer allocate(size_type count, void const * =nullptr) { return static_cast<pointer>(::operator new(count * sizeof(T), SCANNED, collect)); } diff --git a/src/inkgc/gc-core.h b/src/inkgc/gc-core.h index 407c857fb..e5f8cb772 100644 --- a/src/inkgc/gc-core.h +++ b/src/inkgc/gc-core.h @@ -131,8 +131,8 @@ void request_early_collection(); inline void *operator new(std::size_t size, Inkscape::GC::ScanPolicy scan, Inkscape::GC::CollectionPolicy collect, - Inkscape::GC::CleanupFunc cleanup=NULL, - void *data=NULL) + Inkscape::GC::CleanupFunc cleanup=nullptr, + void *data=nullptr) { using namespace Inkscape::GC; @@ -154,15 +154,15 @@ inline void *operator new(std::size_t size, throw std::bad_alloc(); } if (cleanup) { - Core::register_finalizer_ignore_self(mem, cleanup, data, NULL, NULL); + Core::register_finalizer_ignore_self(mem, cleanup, data, nullptr, nullptr); } return mem; } inline void *operator new(std::size_t size, Inkscape::GC::ScanPolicy scan, - Inkscape::GC::CleanupFunc cleanup=NULL, - void *data=NULL) + Inkscape::GC::CleanupFunc cleanup=nullptr, + void *data=nullptr) { return operator new(size, scan, Inkscape::GC::AUTO, cleanup, data); } @@ -170,16 +170,16 @@ inline void *operator new(std::size_t size, inline void *operator new[](std::size_t size, Inkscape::GC::ScanPolicy scan, Inkscape::GC::CollectionPolicy collect, - Inkscape::GC::CleanupFunc cleanup=NULL, - void *data=NULL) + Inkscape::GC::CleanupFunc cleanup=nullptr, + void *data=nullptr) { return operator new(size, scan, collect, cleanup, data); } inline void *operator new[](std::size_t size, Inkscape::GC::ScanPolicy scan, - Inkscape::GC::CleanupFunc cleanup=NULL, - void *data=NULL) + Inkscape::GC::CleanupFunc cleanup=nullptr, + void *data=nullptr) { return operator new[](size, scan, Inkscape::GC::AUTO, cleanup, data); } diff --git a/src/inkgc/gc-soft-ptr.h b/src/inkgc/gc-soft-ptr.h index 45a3ddcf7..9d71f389c 100644 --- a/src/inkgc/gc-soft-ptr.h +++ b/src/inkgc/gc-soft-ptr.h @@ -26,7 +26,7 @@ namespace GC { template <typename T> class soft_ptr { public: - soft_ptr(T *pointer=NULL) : _pointer(pointer) { + soft_ptr(T *pointer=nullptr) : _pointer(pointer) { _register(); } diff --git a/src/inkgc/gc.cpp b/src/inkgc/gc.cpp index b1bd07af6..d44647066 100644 --- a/src/inkgc/gc.cpp +++ b/src/inkgc/gc.cpp @@ -81,16 +81,16 @@ int debug_general_register_disappearing_link(void **p_ptr, void const *base) { void dummy_do_init() {} -void *dummy_base(void *) { return NULL; } +void *dummy_base(void *) { return nullptr; } void dummy_register_finalizer(void *, CleanupFunc, void *, CleanupFunc *old_func, void **old_data) { if (old_func) { - *old_func = NULL; + *old_func = nullptr; } if (old_data) { - *old_data = NULL; + *old_data = nullptr; } } @@ -196,12 +196,12 @@ void die_because_not_initialized() { void *stub_malloc(std::size_t) { die_because_not_initialized(); - return NULL; + return nullptr; } void *stub_base(void *) { die_because_not_initialized(); - return NULL; + return nullptr; } void stub_register_finalizer_ignore_self(void *, CleanupFunc, void *, @@ -249,7 +249,7 @@ void stub_free(void *) { } Ops Core::_ops = { - NULL, + nullptr, &stub_malloc, &stub_malloc, &stub_malloc, diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 410376ede..b2b67e754 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -59,7 +59,7 @@ #include "menus-skeleton.h" // Inkscape::Application static members -Inkscape::Application * Inkscape::Application::_S_inst = NULL; +Inkscape::Application * Inkscape::Application::_S_inst = nullptr; bool Inkscape::Application::_crashIsHappening = false; #define DESKTOP_IS_ACTIVE(d) (!INKSCAPE._desktops->empty() && ((d) == INKSCAPE._desktops->front())) @@ -174,7 +174,7 @@ Application::create(const char *argv0, bool use_gui) bool Application::exists() { - return Application::_S_inst != NULL; + return Application::_S_inst != nullptr; } /** @@ -215,12 +215,12 @@ int Application::autosave() } } - GDir *autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, NULL); + GDir *autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, nullptr); if (!autosave_dir_ptr) { // Try to create the autosave directory if it doesn't exist g_mkdir(autosave_dir.c_str(), 0755); // Try to read dir again - autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, NULL); + autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, nullptr); if( !autosave_dir_ptr ){ Glib::ustring msg = Glib::ustring::compose( _("Autosave failed! Cannot open directory %1."), Glib::filename_to_utf8(autosave_dir)); @@ -230,7 +230,7 @@ int Application::autosave() } } - time_t sptime = time(NULL); + time_t sptime = time(nullptr); struct tm *sptm = localtime(&sptime); gchar sptstr[256]; strftime(sptstr, 256, "%Y_%m_%d_%H_%M_%S", sptm); @@ -251,8 +251,8 @@ int Application::autosave() Inkscape::XML::Node *repr = doc->getReprRoot(); if (doc->isModifiedSinceSave()) { - gchar *oldest_autosave = 0; - const gchar *filename = 0; + gchar *oldest_autosave = nullptr; + const gchar *filename = nullptr; GStatBuf sb; time_t min_time = 0; gint count = 0; @@ -260,7 +260,7 @@ int Application::autosave() // Look for previous autosaves gchar* baseName = g_strdup_printf( "inkscape-autosave-%d", uid ); g_dir_rewind(autosave_dir_ptr); - while( (filename = g_dir_read_name(autosave_dir_ptr)) != NULL ){ + while( (filename = g_dir_read_name(autosave_dir_ptr)) != nullptr ){ if ( strncmp(filename, baseName, strlen(baseName)) == 0 ){ gchar* full_path = g_build_filename( autosave_dir.c_str(), filename, NULL ); if (g_file_test (full_path, G_FILE_TEST_EXISTS)){ @@ -289,7 +289,7 @@ int Application::autosave() if ( oldest_autosave ) { g_free(oldest_autosave); - oldest_autosave = 0; + oldest_autosave = nullptr; } @@ -298,11 +298,11 @@ int Application::autosave() baseName = g_strdup_printf("inkscape-autosave-%d-%s-%03d.svg", uid, sptstr, docnum); gchar* full_path = g_build_filename(autosave_dir.c_str(), baseName, NULL); g_free(baseName); - baseName = 0; + baseName = nullptr; // Try to save the file FILE *file = Inkscape::IO::fopen_utf8name(full_path, "w"); - gchar *errortext = 0; + gchar *errortext = nullptr; if (file) { try{ sp_repr_save_stream(repr->document(), file, SP_SVG_NS_URI); @@ -354,7 +354,7 @@ void Application::autosave_init() } else { // Turn on autosave guint32 timeout = prefs->getInt("/options/autosave/interval", 10) * 60; - autosave_timeout_id = g_timeout_add_seconds(timeout, inkscape_autosave, NULL); + autosave_timeout_id = g_timeout_add_seconds(timeout, inkscape_autosave, nullptr); } } @@ -423,8 +423,8 @@ Application::add_style_sheet() */ Application::Application(const char* argv, bool use_gui) : - _menus(NULL), - _desktops(NULL), + _menus(nullptr), + _desktops(nullptr), refCount(1), _dialogs_toggle(TRUE), _mapalt(GDK_MOD1_MASK), @@ -530,15 +530,15 @@ Application::~Application() if (_menus) { Inkscape::GC::release(_menus); - _menus = NULL; + _menus = nullptr; } if (_argv0) { g_free(_argv0); - _argv0 = NULL; + _argv0 = nullptr; } - _S_inst = NULL; // this will probably break things + _S_inst = nullptr; // this will probably break things refCount = 0; gtk_main_quit (); @@ -591,7 +591,7 @@ Application::crash_handler (int /*signum*/) fprintf(stderr, "\nEmergency save activated!\n"); - time_t sptime = time (NULL); + time_t sptime = time (nullptr); struct tm *sptm = localtime (&sptime); gchar sptstr[256]; strftime (sptstr, 256, "%Y_%m_%d_%H_%M_%S", sptm); @@ -646,7 +646,7 @@ Application::crash_handler (int /*signum*/) curdir, inkscapedir }; - FILE *file = 0; + FILE *file = nullptr; for(size_t i=0; i<sizeof(locations)/sizeof(*locations); i++) { if (!locations[i]) continue; // It seems to be okay, but just in case gchar * filename = g_build_filename(locations[i], c, NULL); @@ -742,7 +742,7 @@ Application::crash_handler (int /*signum*/) *(b + pos) = '\0'; if ( exists() && instance().use_gui() ) { - GtkWidget *msgbox = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", b); + GtkWidget *msgbox = gtk_message_dialog_new (nullptr, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", b); gtk_dialog_run (GTK_DIALOG (msgbox)); gtk_widget_destroy (msgbox); } @@ -767,18 +767,18 @@ bool Application::load_menus() using namespace Inkscape::IO::Resource; Glib::ustring filename = get_filename(UIS, MENUS_FILE); - _menus = sp_repr_read_file(filename.c_str(), NULL); + _menus = sp_repr_read_file(filename.c_str(), nullptr); if ( !_menus ) { - _menus = sp_repr_read_mem(menus_skeleton, MENUS_SKELETON_SIZE, NULL); + _menus = sp_repr_read_mem(menus_skeleton, MENUS_SKELETON_SIZE, nullptr); } - return (_menus != 0); + return (_menus != nullptr); } void Application::selection_modified (Inkscape::Selection *selection, guint flags) { - g_return_if_fail (selection != NULL); + g_return_if_fail (selection != nullptr); if (DESKTOP_IS_ACTIVE (selection->desktop())) { signal_selection_modified.emit(selection, flags); @@ -789,7 +789,7 @@ Application::selection_modified (Inkscape::Selection *selection, guint flags) void Application::selection_changed (Inkscape::Selection * selection) { - g_return_if_fail (selection != NULL); + g_return_if_fail (selection != nullptr); if (DESKTOP_IS_ACTIVE (selection->desktop())) { signal_selection_changed.emit(selection); @@ -799,7 +799,7 @@ Application::selection_changed (Inkscape::Selection * selection) void Application::subselection_changed (SPDesktop *desktop) { - g_return_if_fail (desktop != NULL); + g_return_if_fail (desktop != nullptr); if (DESKTOP_IS_ACTIVE (desktop)) { signal_subselection_changed.emit(desktop); @@ -810,7 +810,7 @@ Application::subselection_changed (SPDesktop *desktop) void Application::selection_set (Inkscape::Selection * selection) { - g_return_if_fail (selection != NULL); + g_return_if_fail (selection != nullptr); if (DESKTOP_IS_ACTIVE (selection->desktop())) { signal_selection_set.emit(selection); @@ -822,7 +822,7 @@ Application::selection_set (Inkscape::Selection * selection) void Application::eventcontext_set (Inkscape::UI::Tools::ToolBase * eventcontext) { - g_return_if_fail (eventcontext != NULL); + g_return_if_fail (eventcontext != nullptr); g_return_if_fail (SP_IS_EVENT_CONTEXT (eventcontext)); if (DESKTOP_IS_ACTIVE (eventcontext->desktop)) { @@ -834,8 +834,8 @@ Application::eventcontext_set (Inkscape::UI::Tools::ToolBase * eventcontext) void Application::add_desktop (SPDesktop * desktop) { - g_return_if_fail (desktop != NULL); - if (_desktops == NULL) { + g_return_if_fail (desktop != nullptr); + if (_desktops == nullptr) { _desktops = new std::vector<SPDesktop*>; } @@ -856,7 +856,7 @@ Application::add_desktop (SPDesktop * desktop) void Application::remove_desktop (SPDesktop * desktop) { - g_return_if_fail (desktop != NULL); + g_return_if_fail (desktop != nullptr); if (std::find (_desktops->begin(), _desktops->end(), desktop) == _desktops->end() ) { g_error("Attempted to remove desktop not in list."); @@ -876,7 +876,7 @@ Application::remove_desktop (SPDesktop * desktop) signal_selection_set.emit(new_desktop->getSelection()); signal_selection_changed.emit(new_desktop->getSelection()); } else { - signal_eventcontext_set.emit(NULL); + signal_eventcontext_set.emit(nullptr); if (desktop->getSelection()) desktop->getSelection()->clear(); } @@ -888,7 +888,7 @@ Application::remove_desktop (SPDesktop * desktop) if (_desktops->empty()) { this->exit(); delete _desktops; - _desktops = NULL; + _desktops = nullptr; } } @@ -897,7 +897,7 @@ Application::remove_desktop (SPDesktop * desktop) void Application::activate_desktop (SPDesktop * desktop) { - g_return_if_fail (desktop != NULL); + g_return_if_fail (desktop != nullptr); if (DESKTOP_IS_ACTIVE (desktop)) { return; @@ -929,7 +929,7 @@ Application::activate_desktop (SPDesktop * desktop) void Application::reactivate_desktop (SPDesktop * desktop) { - g_return_if_fail (desktop != NULL); + g_return_if_fail (desktop != nullptr); if (DESKTOP_IS_ACTIVE (desktop)) { signal_activate_desktop.emit(desktop); @@ -946,7 +946,7 @@ Application::find_desktop_by_dkey (unsigned int dkey) return *r; } } - return NULL; + return nullptr; } @@ -968,7 +968,7 @@ Application::maximum_dkey() SPDesktop * Application::next_desktop () { - SPDesktop *d = NULL; + SPDesktop *d = nullptr; unsigned int dkey_current = (_desktops->front())->dkey; if (dkey_current < maximum_dkey()) { @@ -998,7 +998,7 @@ Application::next_desktop () SPDesktop * Application::prev_desktop () { - SPDesktop *d = NULL; + SPDesktop *d = nullptr; unsigned int dkey_current = (_desktops->front())->dkey; if (dkey_current > 0) { @@ -1073,7 +1073,7 @@ Application::external_change() void Application::add_document (SPDocument *document) { - g_return_if_fail (document != NULL); + g_return_if_fail (document != nullptr); // try to insert the pair into the list if (!(_document_set.insert(std::make_pair(document, 1)).second)) { @@ -1102,7 +1102,7 @@ Application::add_document (SPDocument *document) bool Application::remove_document (SPDocument *document) { - g_return_val_if_fail (document != NULL, false); + g_return_val_if_fail (document != nullptr, false); for (std::map<SPDocument *,int>::iterator iter = _document_set.begin(); iter != _document_set.end(); @@ -1134,7 +1134,7 @@ SPDesktop * Application::active_desktop() { if (!_desktops || _desktops->empty()) { - return NULL; + return nullptr; } return _desktops->front(); @@ -1151,7 +1151,7 @@ Application::active_document() return _document_set.begin()->first; } - return NULL; + return nullptr; } bool @@ -1177,7 +1177,7 @@ Application::active_event_context (void) return SP_ACTIVE_DESKTOP->getEventContext(); } - return NULL; + return nullptr; } Inkscape::ActionContext @@ -1199,7 +1199,7 @@ Inkscape::ActionContext Application::action_context_for_document(SPDocument *doc) { // If there are desktops, check them first to see if the document is bound to one of them - if (_desktops != NULL) { + if (_desktops != nullptr) { for (std::vector<SPDesktop*>::iterator iter = _desktops->begin(), e = _desktops->end() ; iter != e ; ++iter) { SPDesktop *desktop = *iter; if (desktop->doc() == doc) { diff --git a/src/inkscape.h b/src/inkscape.h index e66201b25..e5fa93ba4 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -63,7 +63,7 @@ public: // TODO: is this really how we should manage the lifetime of the selection? // I just copied this from the initialization of the Selection in SPDesktop. // When and how is it actually released? - _selection = Inkscape::GC::release(new Inkscape::Selection(&_layer_model, NULL)); + _selection = Inkscape::GC::release(new Inkscape::Selection(&_layer_model, nullptr)); } Inkscape::Selection *getSelection() const { return _selection; } diff --git a/src/io/gzipstream.cpp b/src/io/gzipstream.cpp index 330191ecd..dfb605f14 100644 --- a/src/io/gzipstream.cpp +++ b/src/io/gzipstream.cpp @@ -51,8 +51,8 @@ GzipInputStream::GzipInputStream(InputStream &sourceStream) loaded(false), totalIn(0), totalOut(0), - outputBuf(NULL), - srcBuf(NULL), + outputBuf(nullptr), + srcBuf(nullptr), crc(0), srcCrc(0), srcSiz(0), @@ -72,11 +72,11 @@ GzipInputStream::~GzipInputStream() close(); if ( srcBuf ) { delete[] srcBuf; - srcBuf = NULL; + srcBuf = nullptr; } if ( outputBuf ) { delete[] outputBuf; - outputBuf = NULL; + outputBuf = nullptr; } } @@ -109,11 +109,11 @@ void GzipInputStream::close() if ( srcBuf ) { delete[] srcBuf; - srcBuf = NULL; + srcBuf = nullptr; } if ( outputBuf ) { delete[] outputBuf; - outputBuf = NULL; + outputBuf = nullptr; } closed = true; } @@ -179,7 +179,7 @@ bool GzipInputStream::load() outputBuf = new (std::nothrow) unsigned char [OUT_SIZE]; if ( !outputBuf ) { delete[] srcBuf; - srcBuf = NULL; + srcBuf = nullptr; return false; } outputBufLen = 0; // Not filled in yet @@ -251,9 +251,9 @@ bool GzipInputStream::load() unsigned long dataLen = srcLen - (headerLen + 8); //printf("%x %x\n", data[0], data[dataLen-1]); - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; + d_stream.zalloc = (alloc_func)nullptr; + d_stream.zfree = (free_func)nullptr; + d_stream.opaque = (voidpf)nullptr; d_stream.next_in = data; d_stream.avail_in = dataLen; d_stream.next_out = outputBuf; diff --git a/src/io/http.cpp b/src/io/http.cpp index 883f6f56c..c081ca7bc 100644 --- a/src/io/http.cpp +++ b/src/io/http.cpp @@ -110,7 +110,7 @@ Glib::ustring get_file(Glib::ustring uri, unsigned int timeout, callback func) { GStatBuf st; if(g_stat(filename.c_str(), &st) != -1) { time_t changed = st.st_mtime; - time_t now = time(0); + time_t now = time(nullptr); // The cache hasn't timed out, so return the filename. if(now - changed < timeout) { if(func) { diff --git a/src/io/http.h b/src/io/http.h index 8327ca79d..70676e156 100644 --- a/src/io/http.h +++ b/src/io/http.h @@ -27,7 +27,7 @@ namespace Inkscape { namespace IO { namespace HTTP { - Glib::ustring get_file(Glib::ustring uri, unsigned int timeout=0, std::function<void(Glib::ustring)> func=NULL); + Glib::ustring get_file(Glib::ustring uri, unsigned int timeout=0, std::function<void(Glib::ustring)> func=nullptr); } } diff --git a/src/io/inkscapestream.h b/src/io/inkscapestream.h index 3537b8872..536a121ce 100644 --- a/src/io/inkscapestream.h +++ b/src/io/inkscapestream.h @@ -379,7 +379,7 @@ protected: Reader *source; BasicReader() - { source = NULL; } + { source = nullptr; } private: @@ -563,7 +563,7 @@ protected: Writer *destination; BasicWriter() - { destination = NULL; } + { destination = nullptr; } private: diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 0b242cc31..f8cf9fce4 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -44,10 +44,10 @@ namespace Resource { gchar *_get_path(Domain domain, Type type, char const *filename) { - gchar *path=NULL; + gchar *path=nullptr; switch (domain) { case SYSTEM: { - gchar const* temp = 0; + gchar const* temp = nullptr; switch (type) { case APPICONS: temp = INKSCAPE_APPICONDIR; break; case EXTENSIONS: temp = INKSCAPE_EXTENSIONDIR; break; @@ -71,7 +71,7 @@ gchar *_get_path(Domain domain, Type type, char const *filename) path = g_strdup(temp); } break; case CREATE: { - gchar const* temp = 0; + gchar const* temp = nullptr; switch (type) { case GRADIENTS: temp = CREATE_GRADIENTSDIR; break; case PALETTES: temp = CREATE_PALETTESDIR; break; @@ -84,7 +84,7 @@ gchar *_get_path(Domain domain, Type type, char const *filename) path = g_build_filename(g_get_user_cache_dir(), "inkscape", NULL); } break; case USER: { - char const *name=NULL; + char const *name=nullptr; switch (type) { case EXTENSIONS: name = "extensions"; break; case FILTERS: name = "filters"; break; @@ -145,7 +145,7 @@ Glib::ustring get_filename(Type type, char const *filename, char const *locale) { Glib::ustring result; - if(locale != NULL) { + if(locale != nullptr) { char *user_locale = _get_path(USER, type, filename); char *sys_locale = _get_path(SYSTEM, type, filename); @@ -288,7 +288,7 @@ void get_filenames_from_path(std::vector<Glib::ustring> &files, Glib::ustring pa */ char *profile_path(const char *filename) { - static const gchar *prefdir = NULL; + static const gchar *prefdir = nullptr; if (!prefdir) { @@ -356,7 +356,7 @@ char *profile_path(const char *filename) int problem = errno; g_warning("Unable to create profile directory (%s) (%d)", g_strerror(problem), problem); } else { - gchar const *userDirs[] = {"keys", "templates", "icons", "extensions", "palettes", NULL}; + gchar const *userDirs[] = {"keys", "templates", "icons", "extensions", "palettes", nullptr}; for (gchar const** name = userDirs; *name; ++name) { gchar *dir = g_build_filename(prefdir, *name, NULL); g_mkdir_with_parents(dir, mode); @@ -379,7 +379,7 @@ char *log_path(const char *filename) char *homedir_path(const char *filename) { - static const gchar *homedir = NULL; + static const gchar *homedir = nullptr; homedir = g_get_home_dir(); // I suspect this is for handling inkscape app packages diff --git a/src/io/resource.h b/src/io/resource.h index 6ec08a28c..dae43ec8f 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -58,13 +58,13 @@ enum Domain { }; Util::ptr_shared get_path(Domain domain, Type type, - char const *filename=NULL); + char const *filename=nullptr); Glib::ustring get_path_ustring(Domain domain, Type type, - char const *filename=NULL); + char const *filename=nullptr); Glib::ustring get_filename(Type type, char const *filename, - char const *locale=NULL); + char const *locale=nullptr); Glib::ustring get_filename(Glib::ustring path, Glib::ustring filename); std::vector<Glib::ustring> get_filenames(Type type, diff --git a/src/io/sys.cpp b/src/io/sys.cpp index 2ff17cdc9..00f91137e 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -66,8 +66,8 @@ void Inkscape::IO::dump_fopen_call( char const *utf8name, char const *id ) FILE *Inkscape::IO::fopen_utf8name( char const *utf8name, char const *mode ) { - FILE* fp = NULL; - gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL ); + FILE* fp = nullptr; + gchar *filename = g_filename_from_utf8( utf8name, -1, nullptr, nullptr, nullptr ); if ( filename ) { // ensure we open the file in binary mode (not needed in POSIX but doesn't hurt either) @@ -87,7 +87,7 @@ FILE *Inkscape::IO::fopen_utf8name( char const *utf8name, char const *mode ) } fp = g_fopen(filename, how.c_str()); g_free(filename); - filename = 0; + filename = nullptr; } return fp; } @@ -96,12 +96,12 @@ FILE *Inkscape::IO::fopen_utf8name( char const *utf8name, char const *mode ) int Inkscape::IO::mkdir_utf8name( char const *utf8name ) { int retval = -1; - gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL ); + gchar *filename = g_filename_from_utf8( utf8name, -1, nullptr, nullptr, nullptr ); if ( filename ) { retval = g_mkdir(filename, S_IRWXU | S_IRGRP | S_IXGRP); // The mode argument is ignored on Windows. g_free(filename); - filename = 0; + filename = nullptr; } return retval; } @@ -111,8 +111,8 @@ bool Inkscape::IO::file_test( char const *utf8name, GFileTest test ) bool exists = false; if ( utf8name ) { - gchar *filename = NULL; - if (utf8name && !g_utf8_validate(utf8name, -1, NULL)) { + gchar *filename = nullptr; + if (utf8name && !g_utf8_validate(utf8name, -1, nullptr)) { /* FIXME: Trying to guess whether or not a filename is already in utf8 is unreliable. If any callers pass non-utf8 data (e.g. using g_get_home_dir), then change caller to use simple g_file_test. Then add g_return_val_if_fail(g_utf_validate(...), false) @@ -121,12 +121,12 @@ bool Inkscape::IO::file_test( char const *utf8name, GFileTest test ) // Looks like g_get_home_dir isn't safe. //g_warning("invalid UTF-8 detected internally. HUNT IT DOWN AND KILL IT!!!"); } else { - filename = g_filename_from_utf8 ( utf8name, -1, NULL, NULL, NULL ); + filename = g_filename_from_utf8 ( utf8name, -1, nullptr, nullptr, nullptr ); } if ( filename ) { exists = g_file_test (filename, test); g_free(filename); - filename = NULL; + filename = nullptr; } else { g_warning( "Unable to convert filename in IO:file_test" ); } @@ -140,8 +140,8 @@ bool Inkscape::IO::file_is_writable( char const *utf8name) bool success = true; if ( utf8name) { - gchar *filename = NULL; - if (utf8name && !g_utf8_validate(utf8name, -1, NULL)) { + gchar *filename = nullptr; + if (utf8name && !g_utf8_validate(utf8name, -1, nullptr)) { /* FIXME: Trying to guess whether or not a filename is already in utf8 is unreliable. If any callers pass non-utf8 data (e.g. using g_get_home_dir), then change caller to use simple g_file_test. Then add g_return_val_if_fail(g_utf_validate(...), false) @@ -150,7 +150,7 @@ bool Inkscape::IO::file_is_writable( char const *utf8name) // Looks like g_get_home_dir isn't safe. //g_warning("invalid UTF-8 detected internally. HUNT IT DOWN AND KILL IT!!!"); } else { - filename = g_filename_from_utf8 ( utf8name, -1, NULL, NULL, NULL ); + filename = g_filename_from_utf8 ( utf8name, -1, nullptr, nullptr, nullptr ); } if ( filename ) { GStatBuf st; @@ -160,7 +160,7 @@ bool Inkscape::IO::file_is_writable( char const *utf8name) } } g_free(filename); - filename = NULL; + filename = nullptr; } else { g_warning( "Unable to convert filename in IO:file_test" ); } @@ -175,8 +175,8 @@ bool Inkscape::IO::file_directory_exists( char const *utf8name ){ bool exists = true; if ( utf8name) { - gchar *filename = NULL; - if (utf8name && !g_utf8_validate(utf8name, -1, NULL)) { + gchar *filename = nullptr; + if (utf8name && !g_utf8_validate(utf8name, -1, nullptr)) { /* FIXME: Trying to guess whether or not a filename is already in utf8 is unreliable. If any callers pass non-utf8 data (e.g. using g_get_home_dir), then change caller to use simple g_file_test. Then add g_return_val_if_fail(g_utf_validate(...), false) @@ -185,15 +185,15 @@ bool Inkscape::IO::file_directory_exists( char const *utf8name ){ // Looks like g_get_home_dir isn't safe. //g_warning("invalid UTF-8 detected internally. HUNT IT DOWN AND KILL IT!!!"); } else { - filename = g_filename_from_utf8 ( utf8name, -1, NULL, NULL, NULL ); + filename = g_filename_from_utf8 ( utf8name, -1, nullptr, nullptr, nullptr ); } if ( filename ) { gchar *dirname = g_path_get_dirname(filename); exists = Inkscape::IO::file_test( dirname, G_FILE_TEST_EXISTS); g_free(filename); g_free(dirname); - filename = NULL; - dirname = NULL; + filename = nullptr; + dirname = nullptr; } else { g_warning( "Unable to convert filename in IO:file_test" ); } @@ -207,13 +207,13 @@ bool Inkscape::IO::file_directory_exists( char const *utf8name ){ GDir * Inkscape::IO::dir_open(gchar const *const utf8name, guint const flags, GError **const error) { - gchar *const opsys_name = g_filename_from_utf8(utf8name, -1, NULL, NULL, error); + gchar *const opsys_name = g_filename_from_utf8(utf8name, -1, nullptr, nullptr, error); if (opsys_name) { GDir *ret = g_dir_open(opsys_name, flags, error); g_free(opsys_name); return ret; } else { - return NULL; + return nullptr; } } @@ -228,9 +228,9 @@ Inkscape::IO::dir_read_utf8name(GDir *dir) for (;;) { gchar const *const opsys_name = g_dir_read_name(dir); if (!opsys_name) { - return NULL; + return nullptr; } - gchar *utf8_name = g_filename_to_utf8(opsys_name, -1, NULL, NULL, NULL); + gchar *utf8_name = g_filename_to_utf8(opsys_name, -1, nullptr, nullptr, nullptr); if (utf8_name) { return utf8_name; } @@ -244,24 +244,24 @@ gchar* Inkscape::IO::locale_to_utf8_fallback( const gchar *opsysstring, gsize *bytes_written, GError **error ) { - gchar *result = NULL; + gchar *result = nullptr; if ( opsysstring ) { gchar *newFileName = g_locale_to_utf8( opsysstring, len, bytes_read, bytes_written, error ); if ( newFileName ) { - if ( !g_utf8_validate(newFileName, -1, NULL) ) { + if ( !g_utf8_validate(newFileName, -1, nullptr) ) { g_warning( "input filename did not yield UTF-8" ); g_free( newFileName ); } else { result = newFileName; } - newFileName = 0; - } else if ( g_utf8_validate(opsysstring, -1, NULL) ) { + newFileName = nullptr; + } else if ( g_utf8_validate(opsysstring, -1, nullptr) ) { // This *might* be a case that we want // g_warning( "input failed filename->utf8, fell back to original" ); // TODO handle cases when len >= 0 result = g_strdup( opsysstring ); } else { - gchar const *charset = 0; + gchar const *charset = nullptr; g_get_charset(&charset); g_warning( "input filename conversion failed for file with locale charset '%s'", charset ); } @@ -292,9 +292,9 @@ Inkscape::IO::spawn_async_with_pipes( const std::string& working_directory, gchar* Inkscape::IO::sanitizeString( gchar const * str ) { - gchar *result = NULL; + gchar *result = nullptr; if ( str ) { - if ( g_utf8_validate(str, -1, NULL) ) { + if ( g_utf8_validate(str, -1, nullptr) ) { result = g_strdup(str); } else { guchar scratch[8]; diff --git a/src/io/uristream.cpp b/src/io/uristream.cpp index 5d2eb59ee..6dfb38e1f 100644 --- a/src/io/uristream.cpp +++ b/src/io/uristream.cpp @@ -39,18 +39,18 @@ namespace IO static FILE *fopen_utf8name( char const *utf8name, int mode ) { - FILE *fp = NULL; + FILE *fp = nullptr; if (!utf8name) { - return NULL; + return nullptr; } if (mode!=FILE_READ && mode!=FILE_WRITE) { - return NULL; + return nullptr; } #ifndef WIN32 - gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL ); + gchar *filename = g_filename_from_utf8( utf8name, -1, nullptr, nullptr, nullptr ); if ( filename ) { if (mode == FILE_READ) fp = std::fopen(filename, "rb"); @@ -99,7 +99,7 @@ UriInputStream::UriInputStream(Inkscape::URI &source) else if (strncmp("data", schemestr, 4)==0) scheme = SCHEME_DATA; - gchar *cpath = NULL; + gchar *cpath = nullptr; switch (scheme) { case SCHEME_FILE: @@ -132,7 +132,7 @@ UriInputStream::UriInputStream(Inkscape::URI &source) UriInputStream::UriInputStream(FILE *source, Inkscape::URI &uri) : uri(uri), inf(source), - data(0), + data(nullptr), dataPos(0), dataLen(0), closed(false) @@ -179,7 +179,7 @@ void UriInputStream::close() return; fflush(inf); fclose(inf); - inf=NULL; + inf=nullptr; break; case SCHEME_DATA: @@ -301,7 +301,7 @@ UriOutputStream::UriOutputStream(FILE* fp, Inkscape::URI &destination) UriOutputStream::UriOutputStream(Inkscape::URI &destination) : closed(false), ownsFile(true), - outf(NULL), + outf(nullptr), uri(destination), scheme(SCHEME_FILE) { @@ -312,7 +312,7 @@ UriOutputStream::UriOutputStream(Inkscape::URI &destination) else if (strncmp("data", schemestr, 4)==0) scheme = SCHEME_DATA; //printf("out schemestr:'%s' scheme:'%d'\n", schemestr, scheme); - gchar *cpath = NULL; + gchar *cpath = nullptr; switch (scheme) { @@ -362,7 +362,7 @@ void UriOutputStream::close() fflush(outf); if ( ownsFile ) fclose(outf); - outf=NULL; + outf=nullptr; break; case SCHEME_DATA: diff --git a/src/io/xsltstream.cpp b/src/io/xsltstream.cpp index 531647769..2e3c954da 100644 --- a/src/io/xsltstream.cpp +++ b/src/io/xsltstream.cpp @@ -31,7 +31,7 @@ namespace IO */ XsltStyleSheet::XsltStyleSheet(InputStream &xsltSource) - : stylesheet(NULL) + : stylesheet(nullptr) { if (!read(xsltSource)) { throw StreamException("read failed"); @@ -42,7 +42,7 @@ XsltStyleSheet::XsltStyleSheet(InputStream &xsltSource) * */ XsltStyleSheet::XsltStyleSheet() - : stylesheet(NULL) + : stylesheet(nullptr) { } @@ -95,7 +95,7 @@ XsltInputStream::XsltInputStream(InputStream &xmlSource, XsltStyleSheet &sheet) //Do the processing const char *params[1]; - params[0] = NULL; + params[0] = nullptr; xmlDocPtr srcDoc = xmlParseMemory(strBuf.c_str(), strBuf.size()); xmlDocPtr resDoc = xsltApplyStylesheet(stylesheet.stylesheet, srcDoc, params); xmlDocDumpFormatMemory(resDoc, &outbuf, &outsize, 1); @@ -199,7 +199,7 @@ void XsltOutputStream::flush() xmlChar *resbuf; int resSize; const char *params[1]; - params[0] = NULL; + params[0] = nullptr; xmlDocPtr srcDoc = xmlParseMemory(outbuf.raw().c_str(), outbuf.size()); xmlDocPtr resDoc = xsltApplyStylesheet(stylesheet.stylesheet, srcDoc, params); xmlDocDumpFormatMemory(resDoc, &resbuf, &resSize, 1); diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index 38ae9f92d..3d34cdf01 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -297,7 +297,7 @@ void FilterKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &o } if (state) { - SPFilter *filter = (item->style && item->style->filter.href) ? dynamic_cast<SPFilter *>(item->style->getFilter()) : NULL; + SPFilter *filter = (item->style && item->style->filter.href) ? dynamic_cast<SPFilter *>(item->style->getFilter()) : nullptr; if(!filter) return; Geom::OptRect orig_bbox = item->visualBounds(); Geom::Rect *new_bbox = _topleft ? new Geom::Rect(p,orig_bbox->max()) : new Geom::Rect(orig_bbox->min(), p); @@ -327,7 +327,7 @@ void FilterKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &o Geom::Point FilterKnotHolderEntity::knot_get() const { - SPFilter *filter = (item->style && item->style->filter.href) ? dynamic_cast<SPFilter *>(item->style->getFilter()) : NULL; + SPFilter *filter = (item->style && item->style->filter.href) ? dynamic_cast<SPFilter *>(item->style->getFilter()) : nullptr; if(!filter) return Geom::Point(Geom::infinity(), Geom::infinity()); Geom::OptRect r = item->visualBounds(); if (_topleft) return Geom::Point(r->min()); diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h index 1466cf243..e6efaa7e8 100644 --- a/src/knot-holder-entity.h +++ b/src/knot-holder-entity.h @@ -40,10 +40,10 @@ typedef Geom::Point (* SPKnotHolderGetFunc) (SPItem *item); class KnotHolderEntity { public: KnotHolderEntity(): - knot(NULL), - item(NULL), - desktop(NULL), - parent_holder(NULL), + knot(nullptr), + item(nullptr), + desktop(nullptr), + parent_holder(nullptr), my_counter(0), handler_id(0), _click_handler_id(0), diff --git a/src/knot.cpp b/src/knot.cpp index 8296891f4..d861004f4 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -63,9 +63,9 @@ static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot); SPKnot::SPKnot(SPDesktop *desktop, gchar const *tip) : ref_count(1) { - this->desktop = NULL; - this->item = NULL; - this->owner = NULL; + this->desktop = nullptr; + this->item = nullptr; + this->owner = nullptr; this->flags = 0; this->size = 8; @@ -75,7 +75,7 @@ SPKnot::SPKnot(SPDesktop *desktop, gchar const *tip) this->anchor = SP_ANCHOR_CENTER; this->shape = SP_KNOT_SHAPE_SQUARE; this->mode = SP_KNOT_MODE_XOR; - this->tip = NULL; + this->tip = nullptr; this->_event_handler_id = 0; this->pressure = 0; @@ -89,18 +89,18 @@ SPKnot::SPKnot(SPDesktop *desktop, gchar const *tip) this->stroke[SP_KNOT_STATE_DRAGGING] = 0x01000000; this->stroke[SP_KNOT_STATE_SELECTED] = 0x01000000; - this->image[SP_KNOT_STATE_NORMAL] = NULL; - this->image[SP_KNOT_STATE_MOUSEOVER] = NULL; - this->image[SP_KNOT_STATE_DRAGGING] = NULL; - this->image[SP_KNOT_STATE_SELECTED] = NULL; + this->image[SP_KNOT_STATE_NORMAL] = nullptr; + this->image[SP_KNOT_STATE_MOUSEOVER] = nullptr; + this->image[SP_KNOT_STATE_DRAGGING] = nullptr; + this->image[SP_KNOT_STATE_SELECTED] = nullptr; - this->cursor[SP_KNOT_STATE_NORMAL] = NULL; - this->cursor[SP_KNOT_STATE_MOUSEOVER] = NULL; - this->cursor[SP_KNOT_STATE_DRAGGING] = NULL; - this->cursor[SP_KNOT_STATE_SELECTED] = NULL; + this->cursor[SP_KNOT_STATE_NORMAL] = nullptr; + this->cursor[SP_KNOT_STATE_MOUSEOVER] = nullptr; + this->cursor[SP_KNOT_STATE_DRAGGING] = nullptr; + this->cursor[SP_KNOT_STATE_SELECTED] = nullptr; - this->saved_cursor = NULL; - this->pixbuf = NULL; + this->saved_cursor = nullptr; + this->pixbuf = nullptr; this->desktop = desktop; @@ -155,19 +155,19 @@ SPKnot::~SPKnot() { if (this->item) { sp_canvas_item_destroy(this->item); - this->item = NULL; + this->item = nullptr; } for (gint i = 0; i < SP_KNOT_VISIBLE_STATES; i++) { if (this->cursor[i]) { g_object_unref(this->cursor[i]); - this->cursor[i] = NULL; + this->cursor[i] = nullptr; } } if (this->tip) { g_free(this->tip); - this->tip = NULL; + this->tip = nullptr; } // FIXME: cannot snap to destroyed knot (lp:1309050) @@ -201,7 +201,7 @@ void SPKnot::selectKnot(bool select){ */ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot) { - g_assert(knot != NULL); + g_assert(knot != nullptr); g_assert(SP_IS_KNOT(knot)); /* Run client universal event handler, if present */ @@ -295,7 +295,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot knot->grabbed_signal.emit(knot, event->button.state); } - sp_event_context_snap_delay_handler(knot->desktop->event_context, NULL, knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER); + sp_event_context_snap_delay_handler(knot->desktop->event_context, nullptr, knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER); sp_knot_handler_request_position(event, knot); moved = TRUE; } diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 982e73747..1c5e59b2d 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -58,7 +58,7 @@ KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFun desktop(desktop), item(item), //XML Tree being used directly for item->getRepr() while it shouldn't be... - repr(item ? item->getRepr() : 0), + repr(item ? item->getRepr() : nullptr), entity(), sizeUpdatedConn(), released(relhandler), diff --git a/src/layer-fns.cpp b/src/layer-fns.cpp index 0bc721c37..f7a5fb146 100644 --- a/src/layer-fns.cpp +++ b/src/layer-fns.cpp @@ -112,7 +112,7 @@ static SPObject *last_elder_layer(SPObject *root, SPObject *layer) { SPObject *next_layer(SPObject *root, SPObject *layer) { using std::find_if; - g_return_val_if_fail(layer != NULL, NULL); + g_return_val_if_fail(layer != nullptr, NULL); SPObject *result = nullptr; SPObject *sibling = next_sibling_layer(layer); @@ -134,7 +134,7 @@ SPObject *next_layer(SPObject *root, SPObject *layer) { SPObject *previous_layer(SPObject *root, SPObject *layer) { using Inkscape::Algorithms::find_last_if; - g_return_val_if_fail(layer != NULL, NULL); + g_return_val_if_fail(layer != nullptr, NULL); SPObject *result = nullptr; SPObject *child = last_child_layer(layer); @@ -164,7 +164,7 @@ SPObject *create_layer(SPObject *root, SPObject *layer, LayerRelativePosition po SPDocument *document = root->document; static int layer_suffix=1; - gchar *id=NULL; + gchar *id=nullptr; do { g_free(id); id = g_strdup_printf("layer%d", layer_suffix++); @@ -179,7 +179,7 @@ SPObject *create_layer(SPObject *root, SPObject *layer, LayerRelativePosition po if ( LPOS_CHILD == position ) { root = layer; SPObject *child_layer = Inkscape::last_child_layer(layer); - if ( NULL != child_layer ) { + if ( nullptr != child_layer ) { layer = child_layer; } } diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 010411fc4..72ca54ae6 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -123,7 +123,7 @@ public: */ LayerManager::LayerManager(SPDesktop *desktop) -: _desktop(desktop), _document(NULL) +: _desktop(desktop), _document(nullptr) { _layer_connection = desktop->connectCurrentLayerChanged( sigc::mem_fun(*this, &LayerManager::_selectedLayerChanged) ); @@ -143,7 +143,7 @@ LayerManager::~LayerManager() _layer_connection.disconnect(); _document_connection.disconnect(); _resource_connection.disconnect(); - _document = NULL; + _document = nullptr; } void LayerManager::setCurrentLayer( SPObject* obj ) @@ -179,7 +179,7 @@ Glib::ustring LayerManager::getNextLayerName( SPObject* obj, gchar const *label) gchar* numpart = g_strdup(base.substr(pos+1).c_str()); if ( numpart ) { - gchar* endPtr = NULL; + gchar* endPtr = nullptr; guint64 val = g_ascii_strtoull( numpart, &endPtr, 10); if ( ((val > 0) || (endPtr != numpart)) && (val < 65536) ) { base.erase( pos+1); @@ -322,7 +322,7 @@ void LayerManager::_rebuild() { while ( higher && (higher->parent != root) ) { higher = higher->parent; } - Node const* node = higher ? higher->getRepr() : NULL; + Node const* node = higher ? higher->getRepr() : nullptr; if ( node && node->parent() ) { // Debug::EventTracker<DebugAddLayer> tracker(*layer); diff --git a/src/layer-model.cpp b/src/layer-model.cpp index 62f47966f..c86f57483 100644 --- a/src/layer-model.cpp +++ b/src/layer-model.cpp @@ -44,8 +44,8 @@ static void _layer_changed(SPObject *top, SPObject *bottom, Inkscape::LayerModel namespace Inkscape { LayerModel::LayerModel() - : _doc( 0 ) - , _layer_hierarchy( 0 ) + : _doc( nullptr ) + , _layer_hierarchy( nullptr ) , _display_key( 0 ) { } @@ -65,7 +65,7 @@ void LayerModel::setDocument(SPDocument *doc) _layer_hierarchy->clear(); delete _layer_hierarchy; } - _layer_hierarchy = new Inkscape::ObjectHierarchy(NULL); + _layer_hierarchy = new Inkscape::ObjectHierarchy(nullptr); _layer_hierarchy->connectAdded(sigc::bind(sigc::ptr_fun(_layer_activated), this)); _layer_hierarchy->connectRemoved(sigc::bind(sigc::ptr_fun(_layer_deactivated), this)); _layer_hierarchy->connectChanged(sigc::bind(sigc::ptr_fun(_layer_changed), this)); @@ -87,7 +87,7 @@ SPDocument *LayerModel::getDocument() */ SPObject *LayerModel::currentRoot() const { - return _layer_hierarchy ? _layer_hierarchy->top() : NULL; + return _layer_hierarchy ? _layer_hierarchy->top() : nullptr; } /** @@ -95,7 +95,7 @@ SPObject *LayerModel::currentRoot() const */ SPObject *LayerModel::currentLayer() const { - return _layer_hierarchy ? _layer_hierarchy->bottom() : NULL; + return _layer_hierarchy ? _layer_hierarchy->bottom() : nullptr; } /** @@ -199,14 +199,14 @@ void LayerModel::toggleLayerSolo(SPObject *object) { * Return layer that contains \a object. */ SPObject *LayerModel::layerForObject(SPObject *object) { - g_return_val_if_fail(object != NULL, NULL); + g_return_val_if_fail(object != nullptr, NULL); SPObject *root=currentRoot(); object = object->parent; while ( object && object != root && !isLayer(object) ) { // Objects in defs have no layer and are NOT in the root layer if(SP_IS_DEFS(object)) - return NULL; + return nullptr; object = object->parent; } return object; diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index f09bd3df3..eac18a76e 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -58,7 +58,7 @@ bool font_descr_equal::operator()( PangoFontDescription *const&a, PangoFontDesc //if ( pango_font_description_equal(a,b) ) return true; char const *fa = sp_font_description_get_family(a); char const *fb = sp_font_description_get_family(b); - if ( ( fa && fb == NULL ) || ( fb && fa == NULL ) ) return false; + if ( ( fa && fb == nullptr ) || ( fb && fa == nullptr ) ) return false; if ( fa && fb && strcmp(fa,fb) != 0 ) return false; if ( pango_font_description_get_style(a) != pango_font_description_get_style(b) ) return false; if ( pango_font_description_get_variant(a) != pango_font_description_get_variant(b) ) return false; @@ -227,11 +227,11 @@ static void FactorySubstituteFunc(FcPattern *pattern,gpointer /*data*/) #endif -font_factory *font_factory::lUsine = NULL; +font_factory *font_factory::lUsine = nullptr; font_factory *font_factory::Default(void) { - if ( lUsine == NULL ) lUsine = new font_factory; + if ( lUsine == nullptr ) lUsine = new font_factory; return lUsine; } @@ -256,7 +256,7 @@ font_factory::font_factory(void) : pango_ft2_font_map_set_default_substitute(PANGO_FT2_FONT_MAP(fontServer), FactorySubstituteFunc, this, - NULL); + nullptr); #endif // TEMP @@ -282,7 +282,7 @@ font_factory::~font_factory(void) if (loadedPtr) { FaceMapType* tmp = static_cast<FaceMapType*>(loadedPtr); delete tmp; - loadedPtr = 0; + loadedPtr = nullptr; } } @@ -305,7 +305,7 @@ Glib::ustring font_factory::ConstructFontSpecification(PangoFontDescription *fon char * copyAsString = pango_font_description_to_string(copy); pangoString = copyAsString; g_free(copyAsString); - copyAsString = 0; + copyAsString = nullptr; pango_font_description_free(copy); @@ -388,7 +388,7 @@ Glib::ustring font_factory::GetUIStyleString(PangoFontDescription const *fontDes char *fontDescrAsString = pango_font_description_to_string(fontDescrCopy); style = fontDescrAsString; g_free(fontDescrAsString); - fontDescrAsString = 0; + fontDescrAsString = nullptr; pango_font_description_free(fontDescrCopy); } @@ -433,7 +433,7 @@ static bool ustringPairSort(std::pair<PangoFontFamily*, Glib::ustring> const& fi void font_factory::GetUIFamilies(std::vector<PangoFontFamily *>& out) { // Gather the family names as listed by Pango - PangoFontFamily** families = NULL; + PangoFontFamily** families = nullptr; int numFamilies = 0; pango_font_map_list_families(fontServer, &families, &numFamilies); @@ -443,11 +443,11 @@ void font_factory::GetUIFamilies(std::vector<PangoFontFamily *>& out) for (int currentFamily = 0; currentFamily < numFamilies; ++currentFamily) { const char* displayName = pango_font_family_get_name(families[currentFamily]); - if (displayName == 0 || *displayName == '\0') { + if (displayName == nullptr || *displayName == '\0') { std::cerr << "font_factory::GetUIFamilies: Missing displayName! " << std::endl; continue; } - if (!g_utf8_validate(displayName, -1, 0)) { + if (!g_utf8_validate(displayName, -1, nullptr)) { // TODO: can can do anything about this or does it always indicate broken fonts that should not be used? std::cerr << "font_factory::GetUIFamilies: Illegal characters in displayName. "; std::cerr << "Ignoring font '" << displayName << "'" << std::endl; @@ -465,11 +465,11 @@ void font_factory::GetUIFamilies(std::vector<PangoFontFamily *>& out) GList* font_factory::GetUIStyles(PangoFontFamily * in) { - GList* ret = NULL; + GList* ret = nullptr; // Gather the styles for this family - PangoFontFace** faces = NULL; + PangoFontFace** faces = nullptr; int numFaces = 0; - if (in == NULL) { + if (in == nullptr) { std::cerr << "font_factory::GetUIStyles(): PangoFontFamily is NULL" << std::endl; return ret; } @@ -482,7 +482,7 @@ GList* font_factory::GetUIStyles(PangoFontFamily * in) // description to get the UI family and face strings const gchar* displayName = pango_font_face_get_face_name(faces[currentFace]); // std::cout << "Display Name: " << displayName << std::endl; - if (displayName == NULL || *displayName == '\0') { + if (displayName == nullptr || *displayName == '\0') { std::cerr << "font_factory::GetUIStyles: Missing displayName! " << std::endl; continue; } @@ -562,7 +562,7 @@ GList* font_factory::GetUIStyles(PangoFontFamily * in) font_instance* font_factory::FaceFromStyle(SPStyle const *style) { - font_instance *font = NULL; + font_instance *font = nullptr; g_assert(style); @@ -599,7 +599,7 @@ font_instance *font_factory::FaceFromDescr(char const *family, char const *style font_instance* font_factory::FaceFromPangoString(char const *pangoString) { - font_instance *fontInstance = NULL; + font_instance *fontInstance = nullptr; g_assert(pangoString); @@ -610,7 +610,7 @@ font_instance* font_factory::FaceFromPangoString(char const *pangoString) PangoFontDescription *descr = pango_font_description_from_string(pangoString); if (descr) { - if (sp_font_description_get_family(descr) != NULL) { + if (sp_font_description_get_family(descr) != nullptr) { fontInstance = Face(descr); } pango_font_description_free(descr); @@ -622,7 +622,7 @@ font_instance* font_factory::FaceFromPangoString(char const *pangoString) font_instance* font_factory::FaceFromFontSpecification(char const *fontSpecification) { - font_instance *font = NULL; + font_instance *font = nullptr; g_assert(fontSpecification); @@ -645,16 +645,16 @@ font_instance *font_factory::Face(PangoFontDescription *descr, bool canFail) pango_font_description_set_size(descr, (int) (fontSize*PANGO_SCALE)); // mandatory huge size (hinting workaround) #endif - font_instance *res = NULL; + font_instance *res = nullptr; FaceMapType& loadedFaces = *static_cast<FaceMapType*>(loadedPtr); if ( loadedFaces.find(descr) == loadedFaces.end() ) { // not yet loaded - PangoFont *nFace = NULL; + PangoFont *nFace = nullptr; // workaround for bug #1025565. // fonts without families blow up Pango. - if (sp_font_description_get_family(descr) != NULL) { + if (sp_font_description_get_family(descr) != nullptr) { nFace = pango_font_map_load_font(fontServer,fontContext,descr); } else { @@ -672,12 +672,12 @@ font_instance *font_factory::Face(PangoFontDescription *descr, bool canFail) res->descr = pango_font_description_copy(descr); res->parent = this; res->InstallFace(nFace); - if ( res->pFont == NULL ) { + if ( res->pFont == nullptr ) { // failed to install face -> bitmap font // printf("face failed\n"); - res->parent = NULL; + res->parent = nullptr; delete res; - res = NULL; + res = nullptr; if ( canFail ) { char *tc = pango_font_description_to_string(descr); PANGO_DEBUG("falling back from %s to 'sans-serif' because InstallFace failed\n",tc); @@ -749,7 +749,7 @@ void font_factory::UnrefFace(font_instance *who) void font_factory::AddInCache(font_instance *who) { - if ( who == NULL ) return; + if ( who == nullptr ) return; for (int i = 0;i < nbEnt;i++) ents[i].age *= 0.9; for (int i = 0;i < nbEnt;i++) { if ( ents[i].f == who ) { @@ -794,10 +794,10 @@ void font_factory::AddFontsDir(char const *utf8dir) # ifdef WIN32 dir = g_win32_locale_filename_from_utf8(utf8dir); # else - dir = g_filename_from_utf8(utf8dir, -1, NULL, NULL, NULL); + dir = g_filename_from_utf8(utf8dir, -1, nullptr, nullptr, nullptr); # endif - FcConfig *conf = NULL; + FcConfig *conf = nullptr; # if PANGO_VERSION_CHECK(1,38,0) conf = pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); # endif @@ -826,10 +826,10 @@ void font_factory::AddFontFile(char const *utf8file) # ifdef WIN32 file = g_win32_locale_filename_from_utf8(utf8file); # else - file = g_filename_from_utf8(utf8file, -1, NULL, NULL, NULL); + file = g_filename_from_utf8(utf8file, -1, nullptr, nullptr, nullptr); # endif - FcConfig *conf = NULL; + FcConfig *conf = nullptr; # if PANGO_VERSION_CHECK(1,38,0) conf = pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); # endif diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 667478924..619e78929 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -103,14 +103,14 @@ static int ft2_cubic_to(FT_Vector const *control1, FT_Vector const *control2, FT */ font_instance::font_instance(void) : - pFont(0), - descr(0), + pFont(nullptr), + descr(nullptr), refCount(0), - parent(0), + parent(nullptr), nbGlyph(0), maxGlyph(0), - glyphs(0), - theFace(0) + glyphs(nullptr), + theFace(nullptr) { //printf("font instance born\n"); _ascent = _ascent_max = 0.8; @@ -133,23 +133,23 @@ font_instance::~font_instance(void) { if ( parent ) { parent->UnrefFace(this); - parent = 0; + parent = nullptr; } //printf("font instance death\n"); if ( pFont ) { FreeTheFace(); g_object_unref(pFont); - pFont = 0; + pFont = nullptr; } if ( descr ) { pango_font_description_free(descr); - descr = 0; + descr = nullptr; } // if ( theFace ) FT_Done_Face(theFace); // owned by pFont. don't touch - theFace = 0; + theFace = nullptr; for (int i=0;i<nbGlyph;i++) { if ( glyphs[i].pathvector ) { @@ -158,7 +158,7 @@ font_instance::~font_instance(void) } if ( glyphs ) { free(glyphs); - glyphs = 0; + glyphs = nullptr; } nbGlyph = 0; maxGlyph = 0; @@ -185,7 +185,7 @@ void font_instance::Unref(void) void font_instance::InitTheFace() { - if (theFace == NULL && pFont != NULL) { + if (theFace == nullptr && pFont != nullptr) { #ifdef USE_PANGO_WIN32 @@ -229,7 +229,7 @@ void font_instance::InitTheFace() Glib::ustring variations(var); - FT_MM_Var* mmvar = NULL; + FT_MM_Var* mmvar = nullptr; FT_Multi_Master mmtype; if (FT_HAS_MULTIPLE_MASTERS( theFace ) && // Font has variables FT_Get_MM_Var(theFace, &mmvar) == 0 && // We found the data @@ -298,7 +298,7 @@ void font_instance::FreeTheFace() #else pango_fc_font_unlock_face(PANGO_FC_FONT(pFont)); #endif - theFace=NULL; + theFace=nullptr; } void font_instance::InstallFace(PangoFont* iFace) @@ -307,7 +307,7 @@ void font_instance::InstallFace(PangoFont* iFace) return; } pFont=iFace; - iFace = NULL; + iFace = nullptr; InitTheFace(); @@ -316,13 +316,13 @@ void font_instance::InstallFace(PangoFont* iFace) if ( pFont ) { g_object_unref(pFont); } - pFont=NULL; + pFont=nullptr; } } bool font_instance::IsOutlineFont(void) { - if ( pFont == NULL ) { + if ( pFont == nullptr ) { return false; } InitTheFace(); @@ -364,7 +364,7 @@ static inline Geom::Point pointfx_to_nrpoint(const POINTFX &p, double scale) void font_instance::LoadGlyph(int glyph_id) { - if ( pFont == NULL ) { + if ( pFont == nullptr ) { return; } InitTheFace(); @@ -382,7 +382,7 @@ void font_instance::LoadGlyph(int glyph_id) glyphs=(font_glyph*)realloc(glyphs,maxGlyph*sizeof(font_glyph)); } font_glyph n_g; - n_g.pathvector=NULL; + n_g.pathvector=nullptr; n_g.bbox[0]=n_g.bbox[1]=n_g.bbox[2]=n_g.bbox[3]=0; n_g.h_advance = 0; n_g.v_advance = 0; @@ -537,11 +537,11 @@ void font_instance::LoadGlyph(int glyph_id) bool font_instance::FontMetrics(double &ascent,double &descent,double &xheight) { - if ( pFont == NULL ) { + if ( pFont == nullptr ) { return false; } InitTheFace(); - if ( theFace == NULL ) { + if ( theFace == nullptr ) { return false; } @@ -555,11 +555,11 @@ bool font_instance::FontMetrics(double &ascent,double &descent,double &xheight) bool font_instance::FontDecoration( double &underline_position, double &underline_thickness, double &linethrough_position, double &linethrough_thickness) { - if ( pFont == NULL ) { + if ( pFont == nullptr ) { return false; } InitTheFace(); - if ( theFace == NULL ) { + if ( theFace == nullptr ) { return false; } #ifdef USE_PANGO_WIN32 @@ -591,11 +591,11 @@ bool font_instance::FontSlope(double &run, double &rise) run = 0.0; rise = 1.0; - if ( pFont == NULL ) { + if ( pFont == nullptr ) { return false; } InitTheFace(); - if ( theFace == NULL ) { + if ( theFace == nullptr ) { return false; } @@ -610,7 +610,7 @@ bool font_instance::FontSlope(double &run, double &rise) } TT_HoriHeader *hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(theFace, ft_sfnt_hhea); - if (hhea == NULL) { + if (hhea == nullptr) { return false; } run = hhea->caret_Slope_Run; @@ -654,7 +654,7 @@ Geom::PathVector* font_instance::PathVector(int glyph_id) } else { no = id_to_no[glyph_id]; } - if ( no < 0 ) return NULL; + if ( no < 0 ) return nullptr; return glyphs[no].pathvector; } diff --git a/src/libnrtype/Layout-TNG-Compute.cpp b/src/libnrtype/Layout-TNG-Compute.cpp index 20b07d84b..e9cf22e31 100644 --- a/src/libnrtype/Layout-TNG-Compute.cpp +++ b/src/libnrtype/Layout-TNG-Compute.cpp @@ -83,7 +83,7 @@ class Layout::Calculator bool in_sub_flow; Layout *sub_flow; // this is only set for the first input item in a sub-flow - InputItemInfo() : in_sub_flow(false), sub_flow(NULL) {} + InputItemInfo() : in_sub_flow(false), sub_flow(nullptr) {} /* fixme: I don't like the fact that InputItemInfo etc. use the default copy constructor and * operator= (and thus don't involve incrementing reference counts), yet they provide a free method @@ -95,7 +95,7 @@ class Layout::Calculator { if (sub_flow) { delete sub_flow; - sub_flow = NULL; + sub_flow = nullptr; } } }; @@ -106,7 +106,7 @@ class Layout::Calculator PangoItem *item; font_instance *font; - PangoItemInfo() : item(NULL), font(NULL) {} + PangoItemInfo() : item(nullptr), font(nullptr) {} /* fixme: I don't like the fact that InputItemInfo etc. use the default copy constructor and * operator= (and thus don't involve incrementing reference counts), yet they provide a free method @@ -118,11 +118,11 @@ class Layout::Calculator { if (item) { pango_item_free(item); - item = NULL; + item = nullptr; } if (font) { font->Unref(); - font = NULL; + font = nullptr; } } }; @@ -151,12 +151,12 @@ class Layout::Calculator unsigned char_index_in_para; /// the index of the first character in this span in the paragraph, for looking up char_attributes SVGLength x, y, dx, dy, rotate; // these are reoriented copies of the <tspan> attributes. We change span when we encounter one. - UnbrokenSpan() : glyph_string(NULL) {} + UnbrokenSpan() : glyph_string(nullptr) {} void free() { if (glyph_string) pango_glyph_string_free(glyph_string); - glyph_string = NULL; + glyph_string = nullptr; } }; @@ -691,7 +691,7 @@ void Layout::Calculator::_outputLine(ParagraphInfo const ¶, new_span.direction = para.pango_items[unbroken_span.pango_item_index].item->analysis.level & 1 ? RIGHT_TO_LEFT : LEFT_TO_RIGHT; new_span.input_stream_first_character = Glib::ustring::const_iterator(unbroken_span.input_stream_first_character.base() + it_span->start.char_byte); } else { // a control code - new_span.font = NULL; + new_span.font = nullptr; new_span.font_size = new_span.line_height.emSize(); new_span.direction = para.direction; } @@ -1091,7 +1091,7 @@ void Layout::Calculator::_buildPangoItemizationForPara(ParagraphInfo *para) con // create the font_instance font_instance *font = text_source->styleGetFontInstance(); - if (font == NULL) + if (font == nullptr) continue; // bad news: we'll have to ignore all this text because we know of no font to render it PangoAttribute *attribute_font_description = pango_attr_font_desc_new(font->descr); @@ -1119,19 +1119,19 @@ void Layout::Calculator::_buildPangoItemizationForPara(ParagraphInfo *para) con TRACE(("whole para: \"%s\"\n", para_text.data())); TRACE(("%d input sources used\n", input_index - para->first_input_index)); // do the pango_itemize() - GList *pango_items_glist = NULL; + GList *pango_items_glist = nullptr; para->direction = LEFT_TO_RIGHT; // CSS default if (_flow._input_stream[para->first_input_index]->Type() == TEXT_SOURCE) { Layout::InputStreamTextSource const *text_source = static_cast<Layout::InputStreamTextSource *>(_flow._input_stream[para->first_input_index]); para->direction = (text_source->style->direction.computed == SP_CSS_DIRECTION_LTR) ? LEFT_TO_RIGHT : RIGHT_TO_LEFT; PangoDirection pango_direction = (text_source->style->direction.computed == SP_CSS_DIRECTION_LTR) ? PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL; - pango_items_glist = pango_itemize_with_base_dir(_pango_context, pango_direction, para_text.data(), 0, para_text.bytes(), attributes_list, NULL); + pango_items_glist = pango_itemize_with_base_dir(_pango_context, pango_direction, para_text.data(), 0, para_text.bytes(), attributes_list, nullptr); } - if( pango_items_glist == NULL ) { + if( pango_items_glist == nullptr ) { // Type wasn't TEXT_SOURCE or direction was not set. - pango_items_glist = pango_itemize(_pango_context, para_text.data(), 0, para_text.bytes(), attributes_list, NULL); + pango_items_glist = pango_itemize(_pango_context, para_text.data(), 0, para_text.bytes(), attributes_list, nullptr); } pango_attr_list_unref(attributes_list); @@ -1139,7 +1139,7 @@ void Layout::Calculator::_buildPangoItemizationForPara(ParagraphInfo *para) con // convert the GList to our vector<> and make the font_instance for each PangoItem at the same time para->pango_items.reserve(g_list_length(pango_items_glist)); TRACE(("para itemizes to %d sections\n", g_list_length(pango_items_glist))); - for (GList *current_pango_item = pango_items_glist ; current_pango_item != NULL ; current_pango_item = current_pango_item->next) { + for (GList *current_pango_item = pango_items_glist ; current_pango_item != nullptr ; current_pango_item = current_pango_item->next) { PangoItemInfo new_item; new_item.item = (PangoItem*)current_pango_item->data; PangoFontDescription *font_description = pango_font_describe(new_item.item->analysis.font); @@ -1151,7 +1151,7 @@ void Layout::Calculator::_buildPangoItemizationForPara(ParagraphInfo *para) con // and get the character attributes on everything para->char_attributes.resize(para_text.length() + 1); - pango_get_log_attrs(para_text.data(), para_text.bytes(), -1, NULL, &*para->char_attributes.begin(), para->char_attributes.size()); + pango_get_log_attrs(para_text.data(), para_text.bytes(), -1, nullptr, &*para->char_attributes.begin(), para->char_attributes.size()); TRACE(("end para itemize, direction = %d\n", para->direction)); } @@ -1325,7 +1325,7 @@ unsigned Layout::Calculator::_buildSpansForPara(ParagraphInfo *para) const g_assert( span_start_byte_in_source < text_source->text->bytes() ); g_assert( span_start_byte_in_source + new_span.text_bytes <= text_source->text->bytes() ); g_assert( memchr(text_source->text->data() + span_start_byte_in_source, '\0', static_cast<size_t>(new_span.text_bytes)) - == NULL ); + == nullptr ); /* Notes as of 4/29/13. Pango_shape is not generating English language ligatures, but it is generating them for Hebrew (and probably other similar languages). In the case observed 3 unicode characters (a base @@ -1470,7 +1470,7 @@ unsigned Layout::Calculator::_buildSpansForPara(ParagraphInfo *para) const bool Layout::Calculator::_goToNextWrapShape() { delete _scanline_maker; - _scanline_maker = NULL; + _scanline_maker = nullptr; _current_shape_index++; if (_current_shape_index == _flow._input_wrap_shapes.size()) return false; _scanline_maker = new ShapeScanlineMaker(_flow._input_wrap_shapes[_current_shape_index].shape, _block_progression); @@ -1811,7 +1811,7 @@ bool Layout::Calculator::calculate() continue; } } - if (_scanline_maker == NULL) + if (_scanline_maker == nullptr) break; // we're trying to flow past the last wrap shape // Break things up into little pango units with unique direction, gravity, etc. @@ -1865,7 +1865,7 @@ bool Layout::Calculator::calculate() // we need a span just for the para if it's either an empty last para or a break in the middle Layout::Span new_span; if (_flow._spans.empty()) { - new_span.font = NULL; + new_span.font = nullptr; new_span.font_size = line_box_height.emSize(); new_span.line_height = line_box_height; new_span.x_end = 0.0; diff --git a/src/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp index 6100fa262..c5ea9b03a 100644 --- a/src/libnrtype/Layout-TNG-Input.cpp +++ b/src/libnrtype/Layout-TNG-Input.cpp @@ -46,7 +46,7 @@ void Layout::appendText(Glib::ustring const &text, Glib::ustring::const_iterator text_begin, Glib::ustring::const_iterator text_end) { - if (style == NULL) return; + if (style == nullptr) return; InputStreamTextSource *new_source = new InputStreamTextSource; @@ -187,9 +187,9 @@ Layout::Alignment Layout::InputStreamTextSource::styleGetAlignment(Layout::Direc } if (this_style->text_anchor.set) return text_anchor_to_alignment(this_style->text_anchor.computed, para_direction); - if (this_style->object == NULL || this_style->object->parent == NULL) break; + if (this_style->object == nullptr || this_style->object->parent == nullptr) break; this_style = this_style->object->parent->style; - if (this_style == NULL) break; + if (this_style == nullptr) break; } return para_direction == LEFT_TO_RIGHT ? LEFT : RIGHT; } @@ -197,7 +197,7 @@ Layout::Alignment Layout::InputStreamTextSource::styleGetAlignment(Layout::Direc font_instance *Layout::InputStreamTextSource::styleGetFontInstance() const { PangoFontDescription *descr = styleGetFontDescription(); - if (descr == NULL) return NULL; + if (descr == nullptr) return nullptr; font_instance *res = (font_factory::Default())->Face(descr); pango_font_description_free(descr); return res; diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp index 8c29b7dbc..e28c9b168 100644 --- a/src/libnrtype/Layout-TNG-OutIter.cpp +++ b/src/libnrtype/Layout-TNG-OutIter.cpp @@ -309,7 +309,7 @@ Geom::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) co double midpoint_offset = _characters[char_index].span(this).x_start + _characters[char_index].x + cluster_half_width; int unused = 0; Path::cut_position *midpoint_otp = const_cast<Path*>(_path_fitted)->CurvilignToPosition(1, &midpoint_offset, unused); - if (midpoint_offset >= 0.0 && midpoint_otp != NULL && midpoint_otp[0].piece >= 0) { + if (midpoint_offset >= 0.0 && midpoint_otp != nullptr && midpoint_otp[0].piece >= 0) { Geom::Point midpoint; Geom::Point tangent; Span const &span = _characters[char_index].span(this); @@ -461,7 +461,7 @@ void Layout::queryCursorShape(iterator const &it, Geom::Point &position, double // as far as I know these functions are const, they're just not marked as such Path::cut_position *path_parameter_list = const_cast<Path*>(_path_fitted)->CurvilignToPosition(1, &x_on_path, unused); Path::cut_position path_parameter; - if (path_parameter_list != NULL && path_parameter_list[0].piece >= 0) + if (path_parameter_list != nullptr && path_parameter_list[0].piece >= 0) path_parameter = path_parameter_list[0]; else { path_parameter.piece = _path_fitted->descr_cmd.size() - 1; @@ -534,7 +534,7 @@ void Layout::queryCursorShape(iterator const &it, Geom::Point &position, double void Layout::getSourceOfCharacter(iterator const &it, void **source_cookie, Glib::ustring::iterator *text_iterator) const { if (it._char_index == _characters.size()) { - *source_cookie = NULL; + *source_cookie = nullptr; return; } InputStreamItem *stream_item = _input_stream[_spans[_characters[it._char_index].in_span].in_input_stream_item]; diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 884c1a319..b9171d27b 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -90,12 +90,12 @@ void Layout::_clearOutputObjects() _spans.clear(); _characters.clear(); _glyphs.clear(); - _path_fitted = NULL; + _path_fitted = nullptr; } void Layout::FontMetrics::set(font_instance *font) { - if( font != NULL ) { + if( font != nullptr ) { ascent = font->GetTypoAscent(); descent = font->GetTypoDescent(); xheight = font->GetXHeight(); @@ -487,7 +487,7 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const glyph_index++; } } while (glyph_index < _glyphs.size() - && _path_fitted == NULL + && _path_fitted == nullptr && (font_matrix * glyph_matrix.inverse()).isIdentity() && _characters[_glyphs[glyph_index].in_character].in_span == this_span_index); @@ -689,7 +689,7 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path) if (_characters.empty()) { int unused = 0; Path::cut_position *point_otp = const_cast<Path&>(path).CurvilignToPosition(1, &offset, unused); - if (offset >= 0.0 && point_otp != NULL && point_otp[0].piece >= 0) { + if (offset >= 0.0 && point_otp != nullptr && point_otp[0].piece >= 0) { Geom::Point point; Geom::Point tangent; const_cast<Path&>(path).PointAndTangentAt(point_otp[0].piece, point_otp[0].t, point, tangent); @@ -738,16 +738,16 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path) double midpoint_offset = (start_offset + end_offset) * 0.5; // as far as I know these functions are const, they're just not marked as such Path::cut_position *midpoint_otp = const_cast<Path&>(path).CurvilignToPosition(1, &midpoint_offset, unused); - if (midpoint_offset >= 0.0 && midpoint_otp != NULL && midpoint_otp[0].piece >= 0) { + if (midpoint_offset >= 0.0 && midpoint_otp != nullptr && midpoint_otp[0].piece >= 0) { Geom::Point midpoint; Geom::Point tangent; const_cast<Path&>(path).PointAndTangentAt(midpoint_otp[0].piece, midpoint_otp[0].t, midpoint, tangent); if (start_offset >= 0.0 && end_offset >= 0.0) { Path::cut_position *start_otp = const_cast<Path&>(path).CurvilignToPosition(1, &start_offset, unused); - if (start_otp != NULL && start_otp[0].piece >= 0) { + if (start_otp != nullptr && start_otp[0].piece >= 0) { Path::cut_position *end_otp = const_cast<Path&>(path).CurvilignToPosition(1, &end_offset, unused); - if (end_otp != NULL && end_otp[0].piece >= 0) { + if (end_otp != nullptr && end_otp[0].piece >= 0) { bool on_same_subpath = true; for (size_t i = 0 ; i < path.pts.size() ; i++) { if (path.pts[i].piece <= start_otp[0].piece) continue; diff --git a/src/libnrtype/Layout-TNG.cpp b/src/libnrtype/Layout-TNG.cpp index 8b0889188..b3386926a 100644 --- a/src/libnrtype/Layout-TNG.cpp +++ b/src/libnrtype/Layout-TNG.cpp @@ -18,7 +18,7 @@ const double Layout::LINE_HEIGHT_NORMAL = 1.25; Layout::Layout() : _input_truncated(0), - _path_fitted(NULL) + _path_fitted(nullptr) { textLength._set = false; textLengthMultiplier = 1; diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index c33d14630..6db6c1221 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -255,7 +255,7 @@ public: to process. */ void appendText(Glib::ustring const &text, SPStyle *style, void *source_cookie, OptionalTextTagAttrs const *optional_attributes, unsigned optional_attributes_offset, Glib::ustring::const_iterator text_begin, Glib::ustring::const_iterator text_end); - inline void appendText(Glib::ustring const &text, SPStyle *style, void *source_cookie, OptionalTextTagAttrs const *optional_attributes = NULL, unsigned optional_attributes_offset = 0) + inline void appendText(Glib::ustring const &text, SPStyle *style, void *source_cookie, OptionalTextTagAttrs const *optional_attributes = nullptr, unsigned optional_attributes_offset = 0) {appendText(text, style, source_cookie, optional_attributes, optional_attributes_offset, text.begin(), text.end());} /** Control codes are metadata in the text stream to signify items @@ -532,7 +532,7 @@ public: parameter is set to point to the actual character, otherwise \a text_iterator is unaltered. */ // TODO FIXME a void* cookie is a very unsafe design, and C++ makes it unnecessary. - void getSourceOfCharacter(iterator const &it, void **source_cookie, Glib::ustring::iterator *text_iterator = NULL) const; + void getSourceOfCharacter(iterator const &it, void **source_cookie, Glib::ustring::iterator *text_iterator = nullptr) const; /** For latin text, the left side of the character, on the baseline */ Geom::Point characterAnchorPoint(iterator const &it) const; @@ -550,7 +550,7 @@ public: /** Returns the box extents (not ink extents) of the given character. The centre of rotation is at the horizontal centre of the box on the text baseline. */ - Geom::Rect characterBoundingBox(iterator const &it, double *rotation = NULL) const; + Geom::Rect characterBoundingBox(iterator const &it, double *rotation = nullptr) const; /** Basically uses characterBoundingBox() on all the characters from \a start to \a end and returns the union of these boxes. The return value @@ -951,7 +951,7 @@ public: friend class Layout; // this is just so you can create uninitialised iterators - don't actually try to use one iterator() : - _parent_layout(NULL), + _parent_layout(nullptr), _glyph_index(-1), _char_index(0), _cursor_moving_vertically(false), diff --git a/src/libnrtype/OpenTypeUtil.cpp b/src/libnrtype/OpenTypeUtil.cpp index 1398a4857..25e4f7094 100644 --- a/src/libnrtype/OpenTypeUtil.cpp +++ b/src/libnrtype/OpenTypeUtil.cpp @@ -71,10 +71,10 @@ void readOpenTypeGsubTable (const FT_Face ft_face, tables.clear(); // Use Harfbuzz, Pango's equivalent calls are deprecated. - auto const hb_face = hb_ft_face_create(ft_face, NULL); + auto const hb_face = hb_ft_face_create(ft_face, nullptr); // First time to get size of array - auto script_count = hb_ot_layout_table_get_script_tags(hb_face, HB_OT_TAG_GSUB, 0, NULL, NULL); + auto script_count = hb_ot_layout_table_get_script_tags(hb_face, HB_OT_TAG_GSUB, 0, nullptr, nullptr); auto const hb_scripts = g_new(hb_tag_t, script_count + 1); // Second time to fill array (this two step process was not necessary with Pango). @@ -82,7 +82,7 @@ void readOpenTypeGsubTable (const FT_Face ft_face, for(unsigned int i = 0; i < script_count; ++i) { // std::cout << " Script: " << extract_tag(&hb_scripts[i]) << std::endl; - auto language_count = hb_ot_layout_script_get_language_tags(hb_face, HB_OT_TAG_GSUB, i, 0, NULL, NULL); + auto language_count = hb_ot_layout_script_get_language_tags(hb_face, HB_OT_TAG_GSUB, i, 0, nullptr, nullptr); if(language_count > 0) { auto const hb_languages = g_new(hb_tag_t, language_count + 1); @@ -90,7 +90,7 @@ void readOpenTypeGsubTable (const FT_Face ft_face, for(unsigned int j = 0; j < language_count; ++j) { // std::cout << " Language: " << extract_tag(&hb_languages[j]) << std::endl; - auto feature_count = hb_ot_layout_language_get_feature_tags(hb_face, HB_OT_TAG_GSUB, i, j, 0, NULL, NULL); + auto feature_count = hb_ot_layout_language_get_feature_tags(hb_face, HB_OT_TAG_GSUB, i, j, 0, nullptr, nullptr); auto const hb_features = g_new(hb_tag_t, feature_count + 1); hb_ot_layout_language_get_feature_tags(hb_face, HB_OT_TAG_GSUB, i, j, 0, &feature_count, hb_features); @@ -110,7 +110,7 @@ void readOpenTypeGsubTable (const FT_Face ft_face, // std::cout << " Language: " << " (dflt)" << std::endl; auto feature_count = hb_ot_layout_language_get_feature_tags(hb_face, HB_OT_TAG_GSUB, i, HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX, - 0, NULL, NULL); + 0, nullptr, nullptr); auto const hb_features = g_new(hb_tag_t, feature_count + 1); hb_ot_layout_language_get_feature_tags(hb_face, HB_OT_TAG_GSUB, i, HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX, @@ -250,7 +250,7 @@ void readOpenTypeFvarAxes(const FT_Face ft_face, std::map<Glib::ustring, OTVarAxis>& axes) { #if FREETYPE_MAJOR *10000 + FREETYPE_MINOR*100 + FREETYPE_MICRO >= 20701 - FT_MM_Var* mmvar = NULL; + FT_MM_Var* mmvar = nullptr; FT_Multi_Master mmtype; if (FT_HAS_MULTIPLE_MASTERS( ft_face ) && // Font has variables FT_Get_MM_Var( ft_face, &mmvar) == 0 && // We found the data @@ -285,7 +285,7 @@ void readOpenTypeFvarNamed(const FT_Face ft_face, std::map<Glib::ustring, OTVarInstance>& named) { #if FREETYPE_MAJOR *10000 + FREETYPE_MINOR*100 + FREETYPE_MICRO >= 20701 - FT_MM_Var* mmvar = NULL; + FT_MM_Var* mmvar = nullptr; FT_Multi_Master mmtype; if (FT_HAS_MULTIPLE_MASTERS( ft_face ) && // Font has variables FT_Get_MM_Var( ft_face, &mmvar) == 0 && // We found the data diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 8c50f47d4..efbb9e3a9 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -58,7 +58,7 @@ FontLister::FontLister() font_list_store->freeze_notify(); /* Create default styles for use when font-family is unknown on system. */ - default_styles = g_list_append(NULL, new StyleNames("Normal")); + default_styles = g_list_append(nullptr, new StyleNames("Normal")); default_styles = g_list_append(default_styles, new StyleNames("Italic")); default_styles = g_list_append(default_styles, new StyleNames("Bold")); default_styles = g_list_append(default_styles, new StyleNames("Bold Italic")); @@ -71,7 +71,7 @@ FontLister::FontLister() for (size_t i = 0; i < familyVector.size(); ++i) { const char* displayName = sp_font_family_get_name(familyVector[i]); - if (displayName == 0 || *displayName == '\0') { + if (displayName == nullptr || *displayName == '\0') { continue; } @@ -605,7 +605,7 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::new_font_family(Glib::ustrin // 2. Select best valid style match to old style. // For finding style list, use list of first family in font-family list. - GList *styles = NULL; + GList *styles = nullptr; Gtk::TreeModel::iterator iter = font_list_store->get_iter("0"); while (iter != font_list_store->children().end()) { @@ -624,7 +624,7 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::new_font_family(Glib::ustrin // Newly typed in font-family may not yet be in list... use default list. // TODO: if font-family is list, check if first family in list is on system // and set style accordingly. - if (styles == NULL) { + if (styles == nullptr) { styles = default_styles; } @@ -980,9 +980,9 @@ static gint compute_distance(const PangoFontDescription *a, const PangoFontDescr // to another font-family with Bold style. gboolean font_description_better_match(PangoFontDescription *target, PangoFontDescription *old_desc, PangoFontDescription *new_desc) { - if (old_desc == NULL) + if (old_desc == nullptr) return true; - if (new_desc == NULL) + if (new_desc == nullptr) return false; int old_distance = compute_distance(target, old_desc); @@ -1027,7 +1027,7 @@ Glib::ustring FontLister::get_best_style_match(Glib::ustring family, Glib::ustri } PangoFontDescription *target = pango_font_description_from_string(fontspec.c_str()); - PangoFontDescription *best = NULL; + PangoFontDescription *best = nullptr; //font_description_dump( target ); @@ -1100,7 +1100,7 @@ bool font_lister_separator_func(const Glib::RefPtr<Gtk::TreeModel>& model, // Needed until Text toolbar updated gboolean font_lister_separator_func2(GtkTreeModel *model, GtkTreeIter *iter, gpointer /*data*/) { - gchar *text = 0; + gchar *text = nullptr; gtk_tree_model_get(model, iter, 0, &text, -1); // Column 0: FontList.family return (text && strcmp(text, "#") == 0); } @@ -1139,7 +1139,7 @@ void font_lister_cell_data_func2(GtkCellLayout * /*cell_layout*/, GtkTreeIter iter; gboolean valid; - gchar *family = 0; + gchar *family = nullptr; gboolean onSystem = true; gboolean found = false; for (valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter); diff --git a/src/livarot/AVL.cpp b/src/livarot/AVL.cpp index 17af5ee66..8c36283a6 100644 --- a/src/livarot/AVL.cpp +++ b/src/livarot/AVL.cpp @@ -27,11 +27,11 @@ void AVLTree::MakeNew() { for (int i = 0; i < 2; i++) { - elem[i] = NULL; - child[i] = NULL; + elem[i] = nullptr; + child[i] = nullptr; } - parent = NULL; + parent = nullptr; balance = 0; } @@ -41,13 +41,13 @@ void AVLTree::MakeDelete() if (elem[i]) { elem[i]->elem[1 - i] = elem[1 - i]; } - elem[i] = NULL; + elem[i] = nullptr; } } AVLTree *AVLTree::Leftmost() { - return leafFromParent(NULL, LEFT); + return leafFromParent(nullptr, LEFT); } AVLTree *AVLTree::leaf(AVLTree *from, Side s) @@ -66,7 +66,7 @@ AVLTree *AVLTree::leaf(AVLTree *from, Side s) } } - return NULL; + return nullptr; } AVLTree *AVLTree::leafFromParent(AVLTree */*from*/, Side s) @@ -81,7 +81,7 @@ AVLTree *AVLTree::leafFromParent(AVLTree */*from*/, Side s) int AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) { - if (from == NULL) + if (from == nullptr) { if (parent) return parent->RestoreBalances (this, racine); @@ -105,7 +105,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) balance = 0; return avl_no_err; } - if (child[LEFT] == NULL) + if (child[LEFT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -147,7 +147,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) } else { - if (child[LEFT]->child[RIGHT] == NULL) + if (child[LEFT]->child[RIGHT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -211,7 +211,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) balance = 0; return avl_no_err; } - if (child[RIGHT] == NULL) + if (child[RIGHT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -252,7 +252,7 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) } else { - if (child[RIGHT]->child[LEFT] == NULL) + if (child[RIGHT]->child[LEFT] == nullptr) { // cout << "mierda\n"; return avl_bal_err; @@ -333,7 +333,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (diff > 0) { - if (child[LEFT] == NULL) + if (child[LEFT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -409,7 +409,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (e->balance < 0) { - if (child[LEFT]->child[RIGHT] == NULL) + if (child[LEFT]->child[RIGHT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -492,7 +492,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) { if (diff < 0) { - if (child[RIGHT] == NULL) + if (child[RIGHT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -568,7 +568,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (e->balance > 0) { - if (child[RIGHT]->child[LEFT] == NULL) + if (child[RIGHT]->child[LEFT] == nullptr) { // cout << "un probleme\n"; return avl_bal_err; @@ -656,7 +656,7 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) int AVLTree::Remove (AVLTree * &racine, bool rebalance) { - AVLTree *startNode = NULL; + AVLTree *startNode = nullptr; int remDiff = 0; int res = Remove (racine, startNode, remDiff); if (res == avl_no_err && rebalance && startNode) @@ -671,12 +671,12 @@ AVLTree::Remove (AVLTree * &racine, AVLTree * &startNode, int &diff) elem[LEFT]->elem[RIGHT] = elem[RIGHT]; if (elem[RIGHT]) elem[RIGHT]->elem[LEFT] = elem[LEFT]; - elem[LEFT] = elem[RIGHT] = NULL; + elem[LEFT] = elem[RIGHT] = nullptr; if (child[LEFT] && child[RIGHT]) { AVLTree *newMe = child[LEFT]->leafFromParent(this, RIGHT); - if (newMe == NULL || newMe->child[RIGHT]) + if (newMe == nullptr || newMe->child[RIGHT]) { // cout << "pas normal\n"; return avl_rm_err; @@ -785,14 +785,14 @@ AVLTree::Remove (AVLTree * &racine, AVLTree * &startNode, int &diff) if (parent) { if (parent->child[LEFT] == this) - parent->child[LEFT] = NULL; + parent->child[LEFT] = nullptr; if (parent->child[RIGHT] == this) - parent->child[RIGHT] = NULL; + parent->child[RIGHT] = nullptr; } if (racine == this) - racine = NULL; + racine = nullptr; } - parent = child[RIGHT] = child[LEFT] = NULL; + parent = child[RIGHT] = child[LEFT] = nullptr; balance = 0; return avl_no_err; } @@ -806,7 +806,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, { int res = Insert (racine, insertType, insertL, insertR); if (res == avl_no_err && rebalance) - res = RestoreBalances ((AVLTree *) NULL, racine); + res = RestoreBalances ((AVLTree *) nullptr, racine); return res; } @@ -814,7 +814,7 @@ int AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, AVLTree * insertR) { - if (racine == NULL) + if (racine == nullptr) { racine = this; return avl_no_err; @@ -828,7 +828,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_on_left) { - if (insertR == NULL || insertR->child[LEFT]) + if (insertR == nullptr || insertR->child[LEFT]) { // cout << "ngou?\n"; return avl_ins_err; @@ -839,7 +839,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_on_right) { - if (insertL == NULL || insertL->child[RIGHT]) + if (insertL == nullptr || insertL->child[RIGHT]) { // cout << "ngou?\n"; return avl_ins_err; @@ -850,18 +850,18 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_between) { - if (insertR == NULL || insertL == NULL - || (insertR->child[LEFT] != NULL && insertL->child[RIGHT] != NULL)) + if (insertR == nullptr || insertL == nullptr + || (insertR->child[LEFT] != nullptr && insertL->child[RIGHT] != nullptr)) { // cout << "ngou?\n"; return avl_ins_err; } - if (insertR->child[LEFT] == NULL) + if (insertR->child[LEFT] == nullptr) { insertR->child[LEFT] = this; parent = insertR; } - else if (insertL->child[RIGHT] == NULL) + else if (insertL->child[RIGHT] == nullptr) { insertL->child[RIGHT] = this; parent = insertL; @@ -870,7 +870,7 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_exact) { - if (insertL == NULL) + if (insertL == nullptr) { // cout << "ngou?\n"; return avl_ins_err; diff --git a/src/livarot/AlphaLigne.cpp b/src/livarot/AlphaLigne.cpp index 5b8321b72..c7e7487bd 100644 --- a/src/livarot/AlphaLigne.cpp +++ b/src/livarot/AlphaLigne.cpp @@ -19,7 +19,7 @@ AlphaLigne::AlphaLigne(int iMin,int iMax) min=iMin; max=iMax; if ( max < min+1 ) max=min+1; - steps=NULL; + steps=nullptr; nbStep=maxStep=0; before.x=min-1; before.delta=0; @@ -29,7 +29,7 @@ AlphaLigne::AlphaLigne(int iMin,int iMax) AlphaLigne::~AlphaLigne(void) { g_free(steps); - steps=NULL; + steps=nullptr; nbStep=maxStep=0; } void AlphaLigne::Affiche(void) diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp index 30e21d546..b31cee14a 100644 --- a/src/livarot/PathConversion.cpp +++ b/src/livarot/PathConversion.cpp @@ -1271,7 +1271,7 @@ void Path::RecBezierTo(Geom::Point const &iP, Geom::Point const &iS,Geom::Point void Path::Fill(Shape* dest, int pathID, bool justAdd, bool closeIfNeeded, bool invert) { - if ( dest == NULL ) { + if ( dest == nullptr ) { return; } diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 086b30557..3c518c521 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -273,7 +273,7 @@ Geom::PathVector * Path::MakePathVector() { Geom::PathVector *pv = new Geom::PathVector(); - Geom::Path * currentpath = NULL; + Geom::Path * currentpath = nullptr; Geom::Point lastP,bezSt,bezEn; int bezNb=0; @@ -523,8 +523,8 @@ double Path::Surface() Path** Path::SubPaths(int &outNb,bool killNoSurf) { int nbRes=0; - Path** res=NULL; - Path* curAdd=NULL; + Path** res=nullptr; + Path* curAdd=nullptr; for (int i=0;i<int(descr_cmd.size());i++) { int const typ = descr_cmd[i]->getType(); @@ -543,7 +543,7 @@ Path** Path::SubPaths(int &outNb,bool killNoSurf) } else { delete curAdd; } - curAdd=NULL; + curAdd=nullptr; } curAdd=new Path; curAdd->SetBackData(false); @@ -605,7 +605,7 @@ Path** Path::SubPaths(int &outNb,bool killNoSurf) delete curAdd; } } - curAdd=NULL; + curAdd=nullptr; outNb=nbRes; return res; @@ -613,8 +613,8 @@ Path** Path::SubPaths(int &outNb,bool killNoSurf) Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* nesting,int* conts) { int nbRes=0; - Path** res=NULL; - Path* curAdd=NULL; + Path** res=nullptr; + Path* curAdd=nullptr; bool increment=false; for (int i=0;i<int(descr_cmd.size());i++) { @@ -638,9 +638,9 @@ Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* } else { delete curAdd; } - curAdd=NULL; + curAdd=nullptr; } - Path* hasParent=NULL; + Path* hasParent=nullptr; for (int j=0;j<nbNest;j++) { if ( conts[j] == i && nesting[j] >= 0 ) { int parentMvt=conts[nesting[j]]; @@ -719,7 +719,7 @@ Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* delete curAdd; } } - curAdd=NULL; + curAdd=nullptr; outNb=nbRes; return res; @@ -883,12 +883,12 @@ static int CmpCurv(const void * p1, const void * p2) { Path::cut_position* Path::CurvilignToPosition(int nbCv, double *cvAbs, int &nbCut) { if ( nbCv <= 0 || pts.empty() || back == false ) { - return NULL; + return nullptr; } qsort(cvAbs, nbCv, sizeof(double), CmpCurv); - cut_position *res = NULL; + cut_position *res = nullptr; nbCut = 0; int curCv = 0; diff --git a/src/livarot/PathOutline.cpp b/src/livarot/PathOutline.cpp index c1a48d41f..c6d050f01 100644 --- a/src/livarot/PathOutline.cpp +++ b/src/livarot/PathOutline.cpp @@ -32,7 +32,7 @@ void Path::Outline(Path *dest, double width, JoinType join, ButtType butt, doubl if ( descr_cmd.size() <= 1 ) { return; } - if ( dest == NULL ) { + if ( dest == nullptr ) { return; } @@ -210,7 +210,7 @@ Path::OutsideOutline (Path * dest, double width, JoinType join, ButtType butt, CloseSubpath(); } if (int(descr_cmd.size()) <= 1) return; - if (dest == NULL) return; + if (dest == nullptr) return; dest->Reset (); dest->SetBackData (false); @@ -235,7 +235,7 @@ Path::InsideOutline (Path * dest, double width, JoinType join, ButtType butt, CloseSubpath(); } if (int(descr_cmd.size()) <= 1) return; - if (dest == NULL) return; + if (dest == nullptr) return; dest->Reset (); dest->SetBackData (false); diff --git a/src/livarot/PathSimplify.cpp b/src/livarot/PathSimplify.cpp index 81ddcd049..c142aae0a 100644 --- a/src/livarot/PathSimplify.cpp +++ b/src/livarot/PathSimplify.cpp @@ -158,9 +158,9 @@ void Path::DoSimplify(int off, int N, double treshhold) int curP = 0; fitting_tables data; - data.Xk = data.Yk = data.Qk = NULL; - data.tk = data.lk = NULL; - data.fk = NULL; + data.Xk = data.Yk = data.Qk = nullptr; + data.tk = data.lk = nullptr; + data.fk = nullptr; data.totLen = 0; data.nbPt = data.maxPt = data.inPt = 0; diff --git a/src/livarot/PathStroke.cpp b/src/livarot/PathStroke.cpp index 4cfeb887a..4b65463dd 100644 --- a/src/livarot/PathStroke.cpp +++ b/src/livarot/PathStroke.cpp @@ -41,7 +41,7 @@ static Geom::Point StrokeNormalize(const Geom::Point value, double length) { void Path::Stroke(Shape *dest, bool doClose, double width, JoinType join, ButtType butt, double miter, bool justAdd) { - if (dest == NULL) { + if (dest == nullptr) { return; } diff --git a/src/livarot/Shape.cpp b/src/livarot/Shape.cpp index 33b383947..87af8423d 100644 --- a/src/livarot/Shape.cpp +++ b/src/livarot/Shape.cpp @@ -23,12 +23,12 @@ Shape::Shape() : nbQRas(0), firstQRas(-1), lastQRas(-1), - qrsData(NULL), + qrsData(nullptr), nbInc(0), maxInc(0), - iData(NULL), - sTree(NULL), - sEvts(NULL), + iData(nullptr), + sTree(nullptr), + sEvts(nullptr), _need_points_sorting(false), _need_edges_sorting(false), _has_points_data(false), @@ -242,7 +242,7 @@ Shape::MakeVoronoiData (bool nVal) void Shape::Copy (Shape * who) { - if (who == NULL) + if (who == nullptr) { Reset (0, 0); return; @@ -256,9 +256,9 @@ Shape::Copy (Shape * who) MakeBackData (false); delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; Reset (who->numberOfPoints(), who->numberOfEdges()); type = who->type; @@ -342,7 +342,7 @@ Shape::AddPoint (const Geom::Point x) pData[n].pending = 0; pData[n].edgeOnLeft = -1; pData[n].nextLinkedPoint = -1; - pData[n].askForWindingS = NULL; + pData[n].askForWindingS = nullptr; pData[n].askForWindingB = -1; pData[n].rx[0] = Round(p.x[0]); pData[n].rx[1] = Round(p.x[1]); @@ -1163,7 +1163,7 @@ Shape::AddEdge (int st, int en) } if (_has_sweep_src_data) { - swsData[n].misc = NULL; + swsData[n].misc = nullptr; swsData[n].firstLinkedPoint = -1; } if (_has_back_data) @@ -1238,7 +1238,7 @@ Shape::AddEdge (int st, int en, int leF, int riF) } if (_has_sweep_src_data) { - swsData[n].misc = NULL; + swsData[n].misc = nullptr; swsData[n].firstLinkedPoint = -1; } if (_has_back_data) @@ -2151,11 +2151,11 @@ void Shape::initialiseEdgeData() eData[i].coEd = -eData[i].coEd; } - swsData[i].misc = NULL; + swsData[i].misc = nullptr; swsData[i].firstLinkedPoint = -1; swsData[i].stPt = swsData[i].enPt = -1; swsData[i].leftRnd = swsData[i].rightRnd = -1; - swsData[i].nextSh = NULL; + swsData[i].nextSh = nullptr; swsData[i].nextBo = -1; swsData[i].curPoint = -1; swsData[i].doneTo = -1; @@ -2166,7 +2166,7 @@ void Shape::initialiseEdgeData() void Shape::clearIncidenceData() { g_free(iData); - iData = NULL; + iData = nullptr; nbInc = maxInc = 0; } diff --git a/src/livarot/Shape.h b/src/livarot/Shape.h index 2651f4d7f..3c2fdd0a3 100644 --- a/src/livarot/Shape.h +++ b/src/livarot/Shape.h @@ -291,7 +291,7 @@ public: // create a graph that is an offseted version of the graph "of" // the offset is dec, with joins between edges of type "join" (see LivarotDefs.h) // the result is NOT a polygon; you need a subsequent call to ConvertToShape to get a real polygon - int MakeOffset(Shape *of, double dec, JoinType join, double miter, bool do_profile=false, double cx = 0, double cy = 0, double radius = 0, Geom::Affine *i2doc = NULL); + int MakeOffset(Shape *of, double dec, JoinType join, double miter, bool do_profile=false, double cx = 0, double cy = 0, double radius = 0, Geom::Affine *i2doc = nullptr); int MakeTweak (int mode, Shape *a, double dec, JoinType join, double miter, bool do_profile, Geom::Point c, Geom::Point vector, double radius, Geom::Affine *i2doc); @@ -498,7 +498,7 @@ private: void CheckEdges(int lastPointNo, int lastChgtPt, Shape *a, Shape *b, BooleanOp mod); void Avance(int lastPointNo, int lastChgtPt, Shape *iS, int iB, Shape *a, Shape *b, BooleanOp mod); void DoEdgeTo(Shape *iS, int iB, int iTo, bool direct, bool sens); - void GetWindings(Shape *a, Shape *b = NULL, BooleanOp mod = bool_op_union, bool brutal = false); + void GetWindings(Shape *a, Shape *b = nullptr, BooleanOp mod = bool_op_union, bool brutal = false); void Validate(); diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 4f63007e7..f44a326ba 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -66,7 +66,7 @@ Shape::ConvertToForme (Path * dest) // suivParc: next in the stack for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -83,7 +83,7 @@ Shape::ConvertToForme (Path * dest) int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } lastPtUsed = fi + 1; @@ -128,7 +128,7 @@ Shape::ConvertToForme (Path * dest) if (nb < 0 || nb == curBord) break; } - while (swdData[nb].misc != 0 || getEdge(nb).st != cPt); + while (swdData[nb].misc != nullptr || getEdge(nb).st != cPt); if (nb < 0 || nb == curBord) { @@ -211,7 +211,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -225,7 +225,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } lastPtUsed = fi + 1; @@ -268,7 +268,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) if (nb < 0 || nb == curBord) break; } - while (swdData[nb].misc != 0 || getEdge(nb).st != cPt); + while (swdData[nb].misc != nullptr || getEdge(nb).st != cPt); if (nb < 0 || nb == curBord) { @@ -329,8 +329,8 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) void Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath*/,int &nbNest,int *&nesting,int *&contStart,bool splitWhenForced) { - nesting=NULL; - contStart=NULL; + nesting=nullptr; + contStart=nullptr; nbNest=0; if (numberOfPoints() <= 1 || numberOfEdges() <= 1) @@ -364,7 +364,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -381,7 +381,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } { @@ -439,7 +439,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* if (nb < 0 || nb == curBord) break; } - while (swdData[nb].misc != 0 || getEdge(nb).st != cPt); + while (swdData[nb].misc != nullptr || getEdge(nb).st != cPt); if (nb < 0 || nb == curBord) { @@ -896,7 +896,7 @@ Shape::AddContour (Path * dest, int nbP, Path * *orig, int startBord, int curBor int nPiece = ebData[bord].pieceID; int nPath = ebData[bord].pathID; - if (nPath < 0 || nPath >= nbP || orig[nPath] == NULL) + if (nPath < 0 || nPath >= nbP || orig[nPath] == nullptr) { // segment batard dest->LineTo (getPoint(getEdge(bord).en).x); @@ -1159,7 +1159,7 @@ Shape::ReFormeBezierTo (int bord, int /*curBord*/, Path * dest, Path * from) int inBezier = -1, nbInterm = -1; int typ; typ = from->descr_cmd[nPiece]->getType(); - PathDescrBezierTo *nBData = NULL; + PathDescrBezierTo *nBData = nullptr; if (typ == descr_bezierto) { nBData = dynamic_cast<PathDescrBezierTo *>(from->descr_cmd[nPiece]); @@ -1220,7 +1220,7 @@ Shape::ReFormeBezierTo (int bord, int /*curBord*/, Path * dest, Path * from) bord = swdData[bord].suivParc; } - g_return_val_if_fail(nBData != NULL, 0); + g_return_val_if_fail(nBData != nullptr, 0); if (pe == ps) { diff --git a/src/livarot/ShapeRaster.cpp b/src/livarot/ShapeRaster.cpp index 2b35c9666..4588fb722 100644 --- a/src/livarot/ShapeRaster.cpp +++ b/src/livarot/ShapeRaster.cpp @@ -34,10 +34,10 @@ void Shape::BeginRaster(float &pos, int &curPt) MakePointData(true); MakeEdgeData(true); - if (sTree == NULL) { + if (sTree == nullptr) { sTree = new SweepTreeList(numberOfEdges()); } - if (sEvts == NULL) { + if (sEvts == nullptr) { sEvts = new SweepEventQueue(numberOfEdges()); } @@ -55,7 +55,7 @@ void Shape::BeginRaster(float &pos, int &curPt) } for (int i = 0;i < numberOfEdges(); i++) { - swrData[i].misc = NULL; + swrData[i].misc = nullptr; eData[i].rdx=pData[getEdge(i).en].rx - pData[getEdge(i).st].rx; } } @@ -64,9 +64,9 @@ void Shape::BeginRaster(float &pos, int &curPt) void Shape::EndRaster() { delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; MakePointData(false); MakeEdgeData(false); @@ -95,7 +95,7 @@ void Shape::BeginQuickRaster(float &pos, int &curPt) initialisePointData(); for (int i=0;i<numberOfEdges();i++) { - swrData[i].misc = NULL; + swrData[i].misc = nullptr; qrsData[i].ind = -1; eData[i].rdx = pData[getEdge(i).en].rx - pData[getEdge(i).st].rx; } @@ -152,14 +152,14 @@ void Shape::Scan(float &pos, int &curP, float to, float step) if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } } else { if ( nbUp <= 0 ) { dnNo = -1; } - if ( dnNo >= 0 && swrData[dnNo].misc == NULL ) { + if ( dnNo >= 0 && swrData[dnNo].misc == nullptr ) { dnNo = -1; } } @@ -178,7 +178,7 @@ void Shape::Scan(float &pos, int &curP, float to, float step) // but the other edge don't have this chance SweepTree *node = swrData[cb].misc; if ( node ) { - swrData[cb].misc = NULL; + swrData[cb].misc = nullptr; node->Remove(*sTree, *sEvts, true); } } @@ -189,13 +189,13 @@ void Shape::Scan(float &pos, int &curP, float to, float step) // if there is one edge going down and one edge coming from above, we don't Insert() the new edge, // but replace the upNo edge by the new one (faster) - SweepTree* insertionNode = NULL; + SweepTree* insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { int rmNo=(d == DOWNWARDS) ? upNo:dnNo; int neNo=(d == DOWNWARDS) ? dnNo:upNo; SweepTree* node = swrData[rmNo].misc; - swrData[rmNo].misc = NULL; + swrData[rmNo].misc = nullptr; int const P = (d == DOWNWARDS) ? nPt : Other(nPt, neNo); node->ConvertTo(this, neNo, 1, P); @@ -304,7 +304,7 @@ void Shape::QuickScan(float &pos,int &curP, float to, bool /*doSort*/, float ste if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -629,7 +629,7 @@ void Shape::DirectScan(float &pos, int &curP, float to, float step) for (int i=0;i<numberOfEdges();i++) { if ( swrData[i].misc ) { SweepTree* node = swrData[i].misc; - swrData[i].misc = NULL; + swrData[i].misc = nullptr; node->Remove(*sTree, *sEvts, true); } } @@ -664,7 +664,7 @@ void Shape::DirectScan(float &pos, int &curP, float to, float step) for (int i = 0; i < numberOfEdges(); i++) { if ( swrData[i].misc ) { SweepTree* node = swrData[i].misc; - swrData[i].misc = NULL; + swrData[i].misc = nullptr; node->Remove(*sTree, *sEvts, true); } } @@ -860,7 +860,7 @@ void Shape::Scan(float &pos, int &curP, float to, FloatLigne *line, bool exact, if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -885,7 +885,7 @@ void Shape::Scan(float &pos, int &curP, float to, FloatLigne *line, bool exact, } // traitement du "upNo devient dnNo" - SweepTree *insertionNode = NULL; + SweepTree *insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { SweepTree* node = swrData[upNo].misc; @@ -1037,7 +1037,7 @@ void Shape::Scan(float &pos, int &curP, float to, FillRule directed, BitLigne *l if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1060,7 +1060,7 @@ void Shape::Scan(float &pos, int &curP, float to, FillRule directed, BitLigne *l } // traitement du "upNo devient dnNo" - SweepTree* insertionNode = NULL; + SweepTree* insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { SweepTree* node = swrData[upNo].misc; @@ -1146,7 +1146,7 @@ void Shape::Scan(float &pos, int &curP, float to, AlphaLigne *line, bool exact, if ( nbDn <= 0 ) { upNo=-1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo=-1; } @@ -1170,7 +1170,7 @@ void Shape::Scan(float &pos, int &curP, float to, AlphaLigne *line, bool exact, } // traitement du "upNo devient dnNo" - SweepTree* insertionNode = NULL; + SweepTree* insertionNode = nullptr; if ( dnNo >= 0 ) { if ( upNo >= 0 ) { SweepTree* node = swrData[upNo].misc; @@ -1298,7 +1298,7 @@ void Shape::QuickScan(float &pos, int &curP, float to, FloatLigne* line, float s if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1450,7 +1450,7 @@ void Shape::QuickScan(float &pos, int &curP, float to, FillRule directed, BitLig upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1544,7 +1544,7 @@ void Shape::QuickScan(float &pos, int &curP, float to, AlphaLigne* line, float s if ( nbDn <= 0 ) { upNo = -1; } - if ( upNo >= 0 && swrData[upNo].misc == NULL ) { + if ( upNo >= 0 && swrData[upNo].misc == nullptr ) { upNo = -1; } @@ -1990,7 +1990,7 @@ void Shape::_updateIntersection(int e, int p) swrData[e].lastY = swrData[e].curY; swrData[e].curX = getPoint(p).x[0]; swrData[e].curY = getPoint(p).x[1]; - swrData[e].misc = NULL; + swrData[e].misc = nullptr; } diff --git a/src/livarot/ShapeSweep.cpp b/src/livarot/ShapeSweep.cpp index 1e6273964..4004f183d 100644 --- a/src/livarot/ShapeSweep.cpp +++ b/src/livarot/ShapeSweep.cpp @@ -119,7 +119,7 @@ Shape::Reoriente (Shape * a) SortPointsRounded (); _need_edges_sorting = true; - GetWindings (this, NULL, bool_op_union, true); + GetWindings (this, nullptr, bool_op_union, true); // Plot(341,56,8,400,400,true,true,false,true); for (int i = 0; i < numberOfEdges(); i++) @@ -179,10 +179,10 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) a->ResetSweep(); - if (sTree == NULL) { + if (sTree == nullptr) { sTree = new SweepTreeList(a->numberOfEdges()); } - if (sEvts == NULL) { + if (sEvts == nullptr) { sEvts = new SweepEventQueue(a->numberOfEdges()); } @@ -202,7 +202,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) double lastChange = a->pData[0].rx[1] - 1.0; int lastChgtPt = 0; int edgeHead = -1; - Shape *shapeHead = NULL; + Shape *shapeHead = nullptr; clearIncidenceData(); @@ -211,10 +211,10 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) while (curAPt < a->numberOfPoints() || sEvts->size() > 0) { Geom::Point ptX; double ptL, ptR; - SweepTree *intersL = NULL; - SweepTree *intersR = NULL; + SweepTree *intersL = nullptr; + SweepTree *intersR = nullptr; int nPt = -1; - Shape *ptSh = NULL; + Shape *ptSh = nullptr; bool isIntersection = false; if (sEvts->peek(intersL, intersR, ptX, ptL, ptR)) { @@ -308,7 +308,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) CheckAdjacencies (lastI, lastChgtPt, shapeHead, edgeHead); - CheckEdges (lastI, lastChgtPt, a, NULL, bool_op_union); + CheckEdges (lastI, lastChgtPt, a, nullptr, bool_op_union); for (int i = lastChgtPt; i < lastI; i++) { if (pData[i].askForWindingS) { @@ -330,7 +330,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) lastChange = rPtX[1]; chgts.clear(); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } @@ -380,7 +380,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) { upNo = -1; } - if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == NULL) + if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == nullptr) { upNo = -1; } @@ -401,19 +401,19 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) { SweepTree *node = (SweepTree *) ptSh->swsData[cb].misc; - if (node == NULL) + if (node == nullptr) { } else { AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, node->src, node->bord, - NULL, -1); - ptSh->swsData[cb].misc = NULL; + nullptr, -1); + ptSh->swsData[cb].misc = nullptr; int onLeftB = -1, onRightB = -1; - Shape *onLeftS = NULL; - Shape *onRightS = NULL; + Shape *onLeftS = nullptr; + Shape *onRightS = nullptr; if (node->elem[LEFT]) { onLeftB = @@ -468,7 +468,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) } // traitement du "upNo devient dnNo" - SweepTree *insertionNode = NULL; + SweepTree *insertionNode = nullptr; if (dnNo >= 0) { if (upNo >= 0) @@ -476,9 +476,9 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) SweepTree *node = (SweepTree *) ptSh->swsData[upNo].misc; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); - ptSh->swsData[upNo].misc = NULL; + ptSh->swsData[upNo].misc = nullptr; node->RemoveEvents (*sEvts); node->ConvertTo (ptSh, dnNo, 1, lastPointNo); @@ -489,7 +489,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } else { @@ -517,7 +517,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } } @@ -559,7 +559,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) ptSh->swsData[cb].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, - edgeHead, EDGE_INSERTED, node->src, node->bord, NULL, + edgeHead, EDGE_INSERTED, node->src, node->bord, nullptr, -1); } } @@ -617,7 +617,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) CheckAdjacencies (lastI, lastChgtPt, shapeHead, edgeHead); - CheckEdges (lastI, lastChgtPt, a, NULL, bool_op_union); + CheckEdges (lastI, lastChgtPt, a, nullptr, bool_op_union); for (int i = lastChgtPt; i < lastI; i++) { @@ -633,7 +633,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) _pts.resize(lastI); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } chgts.clear(); @@ -818,9 +818,9 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) // Plot(200.0,200.0,2.0,400.0,400.0,true,true,true,true); delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; MakePointData (false); MakeEdgeData (false); @@ -837,7 +837,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) int Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) { - if (a == b || a == NULL || b == NULL) + if (a == b || a == nullptr || b == nullptr) return shape_input_err; Reset (0, 0); if (a->numberOfPoints() <= 1 || a->numberOfEdges() <= 1) @@ -856,10 +856,10 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) a->ResetSweep (); b->ResetSweep (); - if (sTree == NULL) { + if (sTree == nullptr) { sTree = new SweepTreeList(a->numberOfEdges() + b->numberOfEdges()); } - if (sEvts == NULL) { + if (sEvts == nullptr) { sEvts = new SweepEventQueue(a->numberOfEdges() + b->numberOfEdges()); } @@ -892,7 +892,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) b->pData[0].rx[1]) ? a->pData[0].rx[1] - 1.0 : b->pData[0].rx[1] - 1.0; int lastChgtPt = 0; int edgeHead = -1; - Shape *shapeHead = NULL; + Shape *shapeHead = nullptr; clearIncidenceData(); @@ -916,10 +916,10 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) Geom::Point ptX; double ptL, ptR; - SweepTree *intersL = NULL; - SweepTree *intersR = NULL; + SweepTree *intersL = nullptr; + SweepTree *intersR = nullptr; int nPt = -1; - Shape *ptSh = NULL; + Shape *ptSh = nullptr; bool isIntersection = false; if (sEvts->peek(intersL, intersR, ptX, ptL, ptR)) @@ -1135,7 +1135,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) lastChange = rPtX[1]; chgts.clear(); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } @@ -1186,7 +1186,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) { upNo = -1; } - if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == NULL) + if (upNo >= 0 && (SweepTree *) ptSh->swsData[upNo].misc == nullptr) { upNo = -1; } @@ -1209,19 +1209,19 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) { SweepTree *node = (SweepTree *) ptSh->swsData[cb].misc; - if (node == NULL) + if (node == nullptr) { } else { AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, node->src, node->bord, - NULL, -1); - ptSh->swsData[cb].misc = NULL; + nullptr, -1); + ptSh->swsData[cb].misc = nullptr; int onLeftB = -1, onRightB = -1; - Shape *onLeftS = NULL; - Shape *onRightS = NULL; + Shape *onLeftS = nullptr; + Shape *onRightS = nullptr; if (node->elem[LEFT]) { onLeftB = @@ -1277,7 +1277,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) } // traitement du "upNo devient dnNo" - SweepTree *insertionNode = NULL; + SweepTree *insertionNode = nullptr; if (dnNo >= 0) { if (upNo >= 0) @@ -1285,9 +1285,9 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) SweepTree *node = (SweepTree *) ptSh->swsData[upNo].misc; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_REMOVED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); - ptSh->swsData[upNo].misc = NULL; + ptSh->swsData[upNo].misc = nullptr; node->RemoveEvents (*sEvts); node->ConvertTo (ptSh, dnNo, 1, lastPointNo); @@ -1299,7 +1299,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } else { @@ -1330,7 +1330,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) ptSh->swsData[dnNo].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, edgeHead, EDGE_INSERTED, - node->src, node->bord, NULL, -1); + node->src, node->bord, nullptr, -1); } } @@ -1376,7 +1376,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) ptSh->swsData[cb].curPoint = lastPointNo; AddChgt (lastPointNo, lastChgtPt, shapeHead, - edgeHead, EDGE_INSERTED, node->src, node->bord, NULL, + edgeHead, EDGE_INSERTED, node->src, node->bord, nullptr, -1); } } @@ -1451,7 +1451,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) _pts.resize(lastI); edgeHead = -1; - shapeHead = NULL; + shapeHead = nullptr; } chgts.clear(); @@ -1626,9 +1626,9 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) } delete sTree; - sTree = NULL; + sTree = nullptr; delete sEvts; - sEvts = NULL; + sEvts = nullptr; if ( mod == bool_op_cut ) { // on garde le askForWinding @@ -1656,7 +1656,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) void Shape::TesteIntersection(SweepTree *t, Side s, bool onlyDiff) { SweepTree *tt = static_cast<SweepTree*>(t->elem[s]); - if (tt == NULL) { + if (tt == nullptr) { return; } @@ -2124,7 +2124,7 @@ Shape::AssemblePoints (int st, int en) pData[i].pending = lastI++; if (i > st && getPoint(i - 1).x[0] == getPoint(i).x[0] && getPoint(i - 1).x[1] == getPoint(i).x[1]) { pData[i].pending = pData[i - 1].pending; - if (pData[pData[i].pending].askForWindingS == NULL) { + if (pData[pData[i].pending].askForWindingS == nullptr) { pData[pData[i].pending].askForWindingS = pData[i].askForWindingS; pData[pData[i].pending].askForWindingB = pData[i].askForWindingB; } else { @@ -2354,7 +2354,7 @@ Shape::GetWindings (Shape * /*a*/, Shape * /*b*/, BooleanOp /*mod*/, bool brutal // preparation du parcours for (int i = 0; i < numberOfEdges(); i++) { - swdData[i].misc = 0; + swdData[i].misc = nullptr; swdData[i].precParc = swdData[i].suivParc = -1; } @@ -2372,7 +2372,7 @@ Shape::GetWindings (Shape * /*a*/, Shape * /*b*/, BooleanOp /*mod*/, bool brutal int fi = 0; for (fi = lastPtUsed; fi < numberOfPoints(); fi++) { - if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == 0) + if (getPoint(fi).incidentEdge[FIRST] >= 0 && swdData[getPoint(fi).incidentEdge[FIRST]].misc == nullptr) break; } lastPtUsed = fi + 1; @@ -2454,7 +2454,7 @@ Shape::GetWindings (Shape * /*a*/, Shape * /*b*/, BooleanOp /*mod*/, bool brutal } nb = nnb; } - while (nb >= 0 && nb != curBord && swdData[nb].misc != 0); + while (nb >= 0 && nb != curBord && swdData[nb].misc != nullptr); if (nb < 0 || nb == curBord) { // retour en arriere @@ -2830,10 +2830,10 @@ Shape::CheckAdjacencies (int lastPointNo, int lastChgtPt, Shape * /*shapeHead*/, { SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[LEFT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; @@ -2898,10 +2898,10 @@ Shape::CheckAdjacencies (int lastPointNo, int lastChgtPt, Shape * /*shapeHead*/, { SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[RIGHT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; @@ -2939,7 +2939,7 @@ void Shape::AddChgt(int lastPointNo, int lastChgtPt, Shape * &shapeHead, chgts[nCh].lSrc = llE->src; chgts[nCh].lBrd = llE->bord; } else { - chgts[nCh].lSrc = NULL; + chgts[nCh].lSrc = nullptr; chgts[nCh].lBrd = -1; } @@ -2971,7 +2971,7 @@ void Shape::AddChgt(int lastPointNo, int lastChgtPt, Shape * &shapeHead, chgts[nCh].rSrc = rrE->src; chgts[nCh].rBrd = rrE->bord; } else { - chgts[nCh].rSrc = NULL; + chgts[nCh].rSrc = nullptr; chgts[nCh].rBrd = -1; } @@ -3001,7 +3001,7 @@ void Shape::AddChgt(int lastPointNo, int lastChgtPt, Shape * &shapeHead, chgts[nCh].rSrc = rlE->src; chgts[nCh].rBrd = rlE->bord; } else { - chgts[nCh].rSrc = NULL; + chgts[nCh].rSrc = nullptr; chgts[nCh].rBrd = -1; } } @@ -3075,10 +3075,10 @@ Shape::CheckEdges (int lastPointNo, int lastChgtPt, Shape * a, Shape * b, SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[LEFT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; @@ -3095,10 +3095,10 @@ Shape::CheckEdges (int lastPointNo, int lastChgtPt, Shape * a, Shape * b, SweepTree *node = static_cast < SweepTree * >(nSrc->swsData[nBrd].misc); - if (node == NULL) + if (node == nullptr) break; node = static_cast < SweepTree * >(node->elem[RIGHT]); - if (node == NULL) + if (node == nullptr) break; nSrc = node->src; nBrd = node->bord; diff --git a/src/livarot/int-line.cpp b/src/livarot/int-line.cpp index 998f638e7..ff9e26790 100644 --- a/src/livarot/int-line.cpp +++ b/src/livarot/int-line.cpp @@ -22,10 +22,10 @@ IntLigne::IntLigne() { nbBord = maxBord = 0; - bords = NULL; + bords = nullptr; nbRun = maxRun = 0; - runs = NULL; + runs = nullptr; firstAc = lastAc = -1; } @@ -36,12 +36,12 @@ IntLigne::~IntLigne() if ( maxBord > 0 ) { g_free(bords); nbBord = maxBord = 0; - bords = NULL; + bords = nullptr; } if ( maxRun > 0 ) { g_free(runs); nbRun = maxRun = 0; - runs = NULL; + runs = nullptr; } } diff --git a/src/livarot/sweep-event.cpp b/src/livarot/sweep-event.cpp index 48354fc46..6b6e8f835 100644 --- a/src/livarot/sweep-event.cpp +++ b/src/livarot/sweep-event.cpp @@ -22,7 +22,7 @@ SweepEventQueue::~SweepEventQueue() SweepEvent *SweepEventQueue::add(SweepTree *iLeft, SweepTree *iRight, Geom::Point &px, double itl, double itr) { if (nbEvt > maxEvt) { - return NULL; + return nullptr; } int const n = nbEvt++; @@ -227,7 +227,7 @@ void SweepEventQueue::relocate(SweepEvent *e, int to) */ SweepEvent::SweepEvent() { - MakeNew (NULL, NULL, Geom::Point(0, 0), 0, 0); + MakeNew (nullptr, nullptr, Geom::Point(0, 0), 0, 0); } SweepEvent::~SweepEvent() @@ -257,8 +257,8 @@ void SweepEvent::MakeDelete() s->pData[n].pending--; } - sweep[i]->evt[1 - i] = NULL; - sweep[i] = NULL; + sweep[i]->evt[1 - i] = nullptr; + sweep[i] = nullptr; } } diff --git a/src/livarot/sweep-tree-list.cpp b/src/livarot/sweep-tree-list.cpp index ea9e9a5d2..020a4e110 100644 --- a/src/livarot/sweep-tree-list.cpp +++ b/src/livarot/sweep-tree-list.cpp @@ -7,7 +7,7 @@ SweepTreeList::SweepTreeList(int s) : nbTree(0), maxTree(s), trees((SweepTree *) g_malloc(s * sizeof(SweepTree))), - racine(NULL) + racine(nullptr) { /* FIXME: Use new[] for trees initializer above, but watch out for bad things happening when * SweepTree::~SweepTree is called. @@ -18,14 +18,14 @@ SweepTreeList::SweepTreeList(int s) : SweepTreeList::~SweepTreeList() { g_free(trees); - trees = NULL; + trees = nullptr; } SweepTree *SweepTreeList::add(Shape *iSrc, int iBord, int iWeight, int iStartPoint, Shape */*iDst*/) { if (nbTree >= maxTree) { - return NULL; + return nullptr; } int const n = nbTree++; diff --git a/src/livarot/sweep-tree.cpp b/src/livarot/sweep-tree.cpp index 1b9868f2e..6aec2a7f6 100644 --- a/src/livarot/sweep-tree.cpp +++ b/src/livarot/sweep-tree.cpp @@ -15,10 +15,10 @@ SweepTree::SweepTree() { - src = NULL; + src = nullptr; bord = -1; startPoint = -1; - evt[LEFT] = evt[RIGHT] = NULL; + evt[LEFT] = evt[RIGHT] = nullptr; sens = true; //invDirLength=1; } @@ -40,7 +40,7 @@ SweepTree::ConvertTo(Shape *iSrc, int iBord, int iWeight, int iStartPoint) { src = iSrc; bord = iBord; - evt[LEFT] = evt[RIGHT] = NULL; + evt[LEFT] = evt[RIGHT] = nullptr; startPoint = iStartPoint; if (src->getEdge(bord).st < src->getEdge(bord).en) { if (iWeight >= 0) @@ -62,9 +62,9 @@ void SweepTree::MakeDelete() { for (int i = 0; i < 2; i++) { if (evt[i]) { - evt[i]->sweep[1 - i] = NULL; + evt[i]->sweep[1 - i] = nullptr; } - evt[i] = NULL; + evt[i] = nullptr; } AVLTree::MakeDelete(); @@ -243,7 +243,7 @@ void SweepTree::RemoveEvent(SweepEventQueue &queue, Side s) { if (evt[s]) { queue.remove(evt[s]); - evt[s] = NULL; + evt[s] = nullptr; } } @@ -259,7 +259,7 @@ SweepTree::Remove(SweepTreeList &list, SweepEventQueue &queue, if (list.nbTree <= 1) { list.nbTree = 0; - list.racine = NULL; + list.racine = nullptr; } else { @@ -274,13 +274,13 @@ int SweepTree::Insert(SweepTreeList &list, SweepEventQueue &queue, Shape *iDst, int iAtPoint, bool rebalance, bool sweepSens) { - if (list.racine == NULL) + if (list.racine == nullptr) { list.racine = this; return avl_no_err; } - SweepTree *insertL = NULL; - SweepTree *insertR = NULL; + SweepTree *insertL = nullptr; + SweepTree *insertR = nullptr; int insertion = list.racine->Find(iDst->getPoint(iAtPoint).x, this, insertL, insertR, sweepSens); @@ -316,7 +316,7 @@ SweepTree::InsertAt(SweepTreeList &list, SweepEventQueue &queue, Shape */*iDst*/, SweepTree *insNode, int fromPt, bool rebalance, bool sweepSens) { - if (list.racine == NULL) + if (list.racine == nullptr) { list.racine = this; return avl_no_err; @@ -343,8 +343,8 @@ SweepTree::InsertAt(SweepTreeList &list, SweepEventQueue &queue, bNorm = -bNorm; } - SweepTree *insertL = NULL; - SweepTree *insertR = NULL; + SweepTree *insertL = nullptr; + SweepTree *insertR = nullptr; double ang = cross(bNorm, nNorm); if (ang == 0) { @@ -438,10 +438,10 @@ SweepTree::InsertAt(SweepTreeList &list, SweepEventQueue &queue, int insertion = found_between; - if (insertL == NULL) { + if (insertL == nullptr) { insertion = found_on_left; } - if (insertR == NULL) { + if (insertR == nullptr) { insertion = found_on_right; } diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1e691eb4d..bef7a1e3f 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -181,7 +181,7 @@ Effect::acceptsNumClicks(EffectType type) { Effect* Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) { - Effect* neweffect = NULL; + Effect* neweffect = nullptr; switch (lpenr) { case EMBRODERY_STITCH: neweffect = static_cast<Effect*> ( new LPEEmbroderyStitch(lpeobj) ); @@ -353,7 +353,7 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) break; default: g_warning("LivePathEffect::Effect::New called with invalid patheffect type (%d)", lpenr); - neweffect = NULL; + neweffect = nullptr; break; } @@ -371,7 +371,7 @@ void Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item) Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect"); repr->setAttribute("effect", name); - doc->getDefs()->getRepr()->addChild(repr, NULL); // adds to <defs> and assigns the 'id' attribute + doc->getDefs()->getRepr()->addChild(repr, nullptr); // adds to <defs> and assigns the 'id' attribute const gchar * repr_id = repr->attribute("id"); Inkscape::GC::release(repr); @@ -396,10 +396,10 @@ Effect::Effect(LivePathEffectObject *lpeobject) is_load(true), lpeobj(lpeobject), concatenate_before_pwd2(false), - sp_lpe_item(NULL), + sp_lpe_item(nullptr), current_zoom(1), upd_params(true), - current_shape(NULL), + current_shape(nullptr), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden defaultsopen(false), is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -480,7 +480,7 @@ Effect::processObjects(LPEAction lpe_action) if (id.empty()) { return; } - SPObject *elemref = NULL; + SPObject *elemref = nullptr; if ((elemref = document->getObjectById(id.c_str()))) { Inkscape::XML::Node * elemnode = elemref->getRepr(); std::vector<SPItem*> item_list; @@ -498,7 +498,7 @@ Effect::processObjects(LPEAction lpe_action) if (elemnode->attribute("inkscape:path-effect")) { sp_item_list_to_curves(item_list, item_selected, item_to_select); } - elemnode->setAttribute("sodipodi:insensitive", NULL); + elemnode->setAttribute("sodipodi:insensitive", nullptr); SP_ITEM(elemref)->moveTo(SP_ITEM(sp_lpe_item), false); } break; @@ -513,7 +513,7 @@ Effect::processObjects(LPEAction lpe_action) if (!this->isVisible()/* && std::strcmp(elemref->getId(),sp_lpe_item->getId()) != 0*/) { css->setAttribute("display", "none"); } else { - css->setAttribute("display", NULL); + css->setAttribute("display", nullptr); } sp_repr_css_write_string(css,css_str); elemnode->setAttribute("style", css_str.c_str()); @@ -876,7 +876,7 @@ Effect::defaultParamSet() vboxwidg->set_margin_top(5); return vboxwidg; } else { - return NULL; + return nullptr; } } @@ -921,7 +921,7 @@ Inkscape::XML::Node *Effect::getRepr() SPDocument *Effect::getSPDoc() { - if (lpeobj->document == NULL) { + if (lpeobj->document == nullptr) { g_message("Effect::getSPDoc() returns NULL"); } return lpeobj->document; @@ -932,7 +932,7 @@ Effect::getParameter(const char * key) { Glib::ustring stringkey(key); - if (param_vector.empty()) return NULL; + if (param_vector.empty()) return nullptr; std::vector<Parameter *>::iterator it = param_vector.begin(); while (it != param_vector.end()) { Parameter * param = *it; @@ -943,14 +943,14 @@ Effect::getParameter(const char * key) ++it; } - return NULL; + return nullptr; } Parameter * Effect::getNextOncanvasEditableParam() { if (param_vector.size() == 0) // no parameters - return NULL; + return nullptr; oncanvasedit_it++; if (oncanvasedit_it >= static_cast<int>(param_vector.size())) { @@ -970,7 +970,7 @@ Effect::getNextOncanvasEditableParam() } } while (oncanvasedit_it != old_it); // iterate until complete loop through map has been made - return NULL; + return nullptr; } void diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index 7b739256e..69415cf4e 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -46,7 +46,7 @@ class KnotHolderEntityWidthBendPath : public LPEKnotHolderEntity { ~KnotHolderEntityWidthBendPath() override { LPEBendPath *lpe = dynamic_cast<LPEBendPath *> (_effect); - lpe->_knot_entity = NULL; + lpe->_knot_entity = nullptr; } void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) override; Geom::Point knot_get() const override; @@ -71,7 +71,7 @@ LPEBendPath::LPEBendPath(LivePathEffectObject *lpeobject) : prop_scale.param_set_digits(3); prop_scale.param_set_increments(0.01, 0.10); - _knot_entity = NULL; + _knot_entity = nullptr; _provides_knotholder_entities = true; apply_to_clippath_and_mask = true; concatenate_before_pwd2 = true; @@ -182,7 +182,7 @@ void LPEBendPath::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { _knot_entity = new BeP::KnotHolderEntityWidthBendPath(this); - _knot_entity->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Change the width"), SP_KNOT_SHAPE_CIRCLE); + _knot_entity->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Change the width"), SP_KNOT_SHAPE_CIRCLE); knotholder->add(_knot_entity); if (hide_knot) { _knot_entity->knot->hide(); diff --git a/src/live_effects/lpe-bool.cpp b/src/live_effects/lpe-bool.cpp index 01b019cec..865968b30 100644 --- a/src/live_effects/lpe-bool.cpp +++ b/src/live_effects/lpe-bool.cpp @@ -344,7 +344,7 @@ sp_pathvector_boolop_remove_inner(Geom::PathVector const &pathva, fill_typ fra) static fill_typ GetFillTyp(SPItem *item) { 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) { return fill_nonZero; } else if (val && strcmp(val, "evenodd") == 0) { diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index 7834ff108..04182e84b 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -208,7 +208,7 @@ void sp_bspline_do_effect(SPCurve *curve, double helper_size) Geom::D2<Geom::SBasis> sbasis_in; Geom::D2<Geom::SBasis> sbasis_out; Geom::D2<Geom::SBasis> sbasis_helper; - Geom::CubicBezier const *cubic = NULL; + Geom::CubicBezier const *cubic = nullptr; curve_n->moveto(curve_it1->initialPoint()); if (path_it->closed()) { const Geom::Curve &closingline = path_it->back_closed(); @@ -375,7 +375,7 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weight_ammount) Geom::Point point_at3(0, 0); Geom::D2<Geom::SBasis> sbasis_in; Geom::D2<Geom::SBasis> sbasis_out; - Geom::CubicBezier const *cubic = NULL; + Geom::CubicBezier const *cubic = nullptr; curve_n->moveto(curve_it1->initialPoint()); if (path_it->closed()) { const Geom::Curve &closingline = path_it->back_closed(); diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp index f384c8bec..f491c7ad7 100644 --- a/src/live_effects/lpe-clone-original.cpp +++ b/src/live_effects/lpe-clone-original.cpp @@ -46,7 +46,7 @@ LPECloneOriginal::LPECloneOriginal(LivePathEffectObject *lpeobject) : const gchar * linkedpath = this->getRepr()->attribute("linkedpath"); if (linkedpath && strcmp(linkedpath, "") != 0){ this->getRepr()->setAttribute("linkeditem", linkedpath); - this->getRepr()->setAttribute("linkedpath", NULL); + this->getRepr()->setAttribute("linkedpath", nullptr); this->getRepr()->setAttribute("method", "bsplinespiro"); this->getRepr()->setAttribute("allow_transforms", "false"); }; @@ -118,11 +118,11 @@ LPECloneOriginal::cloneAttrbutes(SPObject *origin, SPObject *dest, const gchar * } gchar ** attarray = g_strsplit(attributes, ",", 0); gchar ** iter = attarray; - while (*iter != NULL) { + while (*iter != nullptr) { const char* attribute = (*iter); if (strlen(attribute)) { if ( shape_dest && shape_origin && (std::strcmp(attribute, "d") == 0)) { - SPCurve *c = NULL; + SPCurve *c = nullptr; if (method == CLM_BSPLINESPIRO) { c = shape_origin->getCurveForEdit(); SPLPEItem * lpe_item = SP_LPE_ITEM(origin); @@ -157,7 +157,7 @@ LPECloneOriginal::cloneAttrbutes(SPObject *origin, SPObject *dest, const gchar * g_free(str); c->unref(); } else { - dest->getRepr()->setAttribute(attribute, NULL); + dest->getRepr()->setAttribute(attribute, nullptr); } } else { dest->getRepr()->setAttribute(attribute, origin->getRepr()->attribute(attribute)); @@ -172,12 +172,12 @@ LPECloneOriginal::cloneAttrbutes(SPObject *origin, SPObject *dest, const gchar * sp_repr_css_attr_add_from_string(css_dest, dest->getRepr()->attribute("style")); gchar ** styleattarray = g_strsplit(style_attributes, ",", 0); gchar ** styleiter = styleattarray; - while (*styleiter != NULL) { + while (*styleiter != nullptr) { const char* attribute = (*styleiter); if (strlen(attribute)) { const char* origin_attribute = sp_repr_css_property(css_origin, attribute, ""); if (!strlen(origin_attribute)) { //==0 - sp_repr_css_set_property (css_dest, attribute, NULL); + sp_repr_css_set_property (css_dest, attribute, nullptr); } else { sp_repr_css_set_property (css_dest, attribute, origin_attribute); } diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 650d45747..909bd411e 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -74,7 +74,7 @@ LPECopyRotate::LPECopyRotate(LivePathEffectObject *lpeobject) : _provides_knotholder_entities = true; //0.92 compatibility if (this->getRepr()->attribute("fuse_paths") && strcmp(this->getRepr()->attribute("fuse_paths"), "true") == 0){ - this->getRepr()->setAttribute("fuse_paths", NULL); + this->getRepr()->setAttribute("fuse_paths", nullptr); this->getRepr()->setAttribute("method", "kaleidoskope"); this->getRepr()->setAttribute("mirror_copies", "true"); }; @@ -136,7 +136,7 @@ LPECopyRotate::doAfterEffect (SPLPEItem const* lpeitem) if (id.empty()) { return; } - SPObject *elemref = NULL; + SPObject *elemref = nullptr; if (elemref = document->getObjectById(id.c_str())) { SP_ITEM(elemref)->setHidden(true); } @@ -146,7 +146,7 @@ LPECopyRotate::doAfterEffect (SPLPEItem const* lpeitem) } previous_num_copies = num_copies; } - SPObject *elemref = NULL; + SPObject *elemref = nullptr; guint counter = 0; Glib::ustring id = "rotated-0-"; id += this->lpeobj->getId(); @@ -230,7 +230,7 @@ LPECopyRotate::cloneD(SPObject *orig, SPObject *dest, Geom::Affine transform, bo g_free(str); c->unref(); } else { - path->getRepr()->setAttribute("d", NULL); + path->getRepr()->setAttribute("d", nullptr); } if (reset) { dest->getRepr()->setAttribute("style", shape->getRepr()->attribute("style")); @@ -242,7 +242,7 @@ Inkscape::XML::Node * LPECopyRotate::createPathBase(SPObject *elemref) { SPDocument * document = SP_ACTIVE_DOCUMENT; if (!document) { - return NULL; + return nullptr; } Inkscape::XML::Document *xml_doc = document->getReprDoc(); Inkscape::XML::Node *prev = elemref->getRepr(); @@ -251,7 +251,7 @@ LPECopyRotate::createPathBase(SPObject *elemref) { Inkscape::XML::Node *container = xml_doc->createElement("svg:g"); container->setAttribute("transform", prev->attribute("transform")); std::vector<SPItem*> const item_list = sp_item_group_item_list(group); - Inkscape::XML::Node *previous = NULL; + Inkscape::XML::Node *previous = nullptr; for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPObject *sub_item = *iter; Inkscape::XML::Node *resultnode = createPathBase(sub_item); @@ -278,8 +278,8 @@ LPECopyRotate::toItem(Geom::Affine transform, size_t i, bool reset) elemref_id += "-"; elemref_id += this->lpeobj->getId(); items.push_back(elemref_id); - SPObject *elemref= NULL; - Inkscape::XML::Node *phantom = NULL; + SPObject *elemref= nullptr; + Inkscape::XML::Node *phantom = nullptr; if (elemref = document->getObjectById(elemref_id.c_str())) { phantom = elemref->getRepr(); } else { diff --git a/src/live_effects/lpe-embrodery-stitch-ordering.cpp b/src/live_effects/lpe-embrodery-stitch-ordering.cpp index b631065a8..86abf2d68 100644 --- a/src/live_effects/lpe-embrodery-stitch-ordering.cpp +++ b/src/live_effects/lpe-embrodery-stitch-ordering.cpp @@ -256,8 +256,8 @@ void OrderingPoint::FindNearest2(const std::vector<OrderingInfoEx *> &infos) Coord dist0 = infinity(); Coord dist1 = infinity(); - nearest[0] = 0; - nearest[1] = 0; + nearest[0] = nullptr; + nearest[1] = nullptr; for (std::vector<OrderingInfoEx *>::const_iterator it = infos.begin(); it != infos.end(); ++it) { Coord dist = distance(point, (*it)->beg.point); @@ -297,16 +297,16 @@ void OrderingPoint::FindNearest2(const std::vector<OrderingInfoEx *> &infos) void OrderingPoint::EnforceMutual(void) { if (nearest[0] && !(this == nearest[0]->nearest[0] || this == nearest[0]->nearest[1])) { - nearest[0] = 0; + nearest[0] = nullptr; } if (nearest[1] && !(this == nearest[1]->nearest[0] || this == nearest[1]->nearest[1])) { - nearest[1] = 0; + nearest[1] = nullptr; } if (nearest[1] && !nearest[0]) { nearest[0] = nearest[1]; - nearest[1] = 0; + nearest[1] = nullptr; } } @@ -318,19 +318,19 @@ void OrderingPoint::EnforceSymmetric(const OrderingPoint &other) (other.nearest[0] && nearest[0]->infoex == other.nearest[0]->infoex) || (other.nearest[1] && nearest[0]->infoex == other.nearest[1]->infoex) )) { - nearest[0] = 0; + nearest[0] = nullptr; } if (nearest[1] && !( (other.nearest[0] && nearest[1]->infoex == other.nearest[0]->infoex) || (other.nearest[1] && nearest[1]->infoex == other.nearest[1]->infoex) )) { - nearest[1] = 0; + nearest[1] = nullptr; } if (nearest[1] && !nearest[0]) { nearest[0] = nearest[1]; - nearest[1] = 0; + nearest[1] = nullptr; } } @@ -415,7 +415,7 @@ OrderingGroupNeighbor *OrderingGroupPoint::FindNearestUnused(void) // it shouldn't happen that we can't find any point at all assert(0); - return 0; + return nullptr; } // Return the other end in the group of the point @@ -430,11 +430,11 @@ OrderingGroupPoint *OrderingGroupPoint::GetOtherEndGroup(void) OrderingGroupPoint *OrderingGroupPoint::GetAltPointGroup(void) { if (group->nEndPoints < 4) { - return 0; + return nullptr; } OrderingGroupPoint *alt = group->endpoints[ indexInGroup ^ 2 ]; - return alt->used ? 0 : alt; + return alt->used ? nullptr : alt; } @@ -635,7 +635,7 @@ bool FindShortestReconnect(std::vector<OrderingSegment> &segments, std::vector<O { // Find the longest connection outside of the active set // The longest segment is then the longest of this longest outside segment and all inside segments - OrderingGroupConnection *longestOutside = 0; + OrderingGroupConnection *longestOutside = nullptr; if (contains(connections, *longestConnect)) { // The longest connection is inside the active set, so we need to search for the longest outside @@ -905,7 +905,7 @@ void OrderGroups(std::vector<OrderingGroup *> *groups, const int nDims) OrderingGroupPoint *crnt = groups->front()->endpoints[0]; // The longest connection is ignored (we don't want cycles) - OrderingGroupConnection *longestConnect = 0; + OrderingGroupConnection *longestConnect = nullptr; for (unsigned int nConnected = 0; nConnected < groups->size(); nConnected++) { // Mark both end points of the current segment as used diff --git a/src/live_effects/lpe-embrodery-stitch-ordering.h b/src/live_effects/lpe-embrodery-stitch-ordering.h index c307ec555..5f64462f7 100644 --- a/src/live_effects/lpe-embrodery-stitch-ordering.h +++ b/src/live_effects/lpe-embrodery-stitch-ordering.h @@ -55,7 +55,7 @@ struct OrderingPoint { infoex(infoexIn), begin(beginIn) { - nearest[0] = nearest[1] = 0; + nearest[0] = nearest[1] = nullptr; } // Check if both nearest values are valid @@ -137,7 +137,7 @@ struct OrderingGroupPoint { point(pointIn), group(groupIn), indexInGroup(indexIn), - connection(0), + connection(nullptr), indexInConnection(0), begin(beginIn), front(frontIn), @@ -189,8 +189,8 @@ struct OrderingGroupConnection { { assert(fromIn->connection == 0); assert(toIn->connection == 0); - points[0] = 0; - points[1] = 0; + points[0] = nullptr; + points[1] = nullptr; Connect(0, fromIn); Connect(1, toIn); } @@ -227,7 +227,7 @@ struct OrderingGroup { index(indexIn) { for (int i = 0; i < sizeof(endpoints) / sizeof(*endpoints); i++) { - endpoints[i] = 0; + endpoints[i] = nullptr; } } diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp index 9715d7ff8..389ddf007 100644 --- a/src/live_effects/lpe-fill-between-many.cpp +++ b/src/live_effects/lpe-fill-between-many.cpp @@ -79,7 +79,7 @@ void LPEFillBetweenMany::doOnApply (SPLPEItem const* lpeitem) lpe_repr->setAttribute("applied", "true"); lpe_repr->setAttribute("method", "partial"); lpe_repr->setAttribute("allow_transforms", "false"); - document->getDefs()->getRepr()->addChild(lpe_repr, NULL); // adds to <defs> and assigns the 'id' attribute + document->getDefs()->getRepr()->addChild(lpe_repr, nullptr); // adds to <defs> and assigns the 'id' attribute } std::string lpe_id_href = std::string("#") + lpe_repr->attribute("id"); Inkscape::GC::release(lpe_repr); @@ -149,7 +149,7 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve) } if(!allow_transforms) { - SP_ITEM(sp_lpe_item)->setAttribute("transform", NULL); + SP_ITEM(sp_lpe_item)->setAttribute("transform", nullptr); } if (!res_pathv.empty() && close) { diff --git a/src/live_effects/lpe-fill-between-strokes.cpp b/src/live_effects/lpe-fill-between-strokes.cpp index 5f4fd4fc2..5f327b6a4 100644 --- a/src/live_effects/lpe-fill-between-strokes.cpp +++ b/src/live_effects/lpe-fill-between-strokes.cpp @@ -43,7 +43,7 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve) if (curve) { Geom::Affine affine = Geom::identity(); if(!allow_transforms) { - SP_ITEM(sp_lpe_item)->setAttribute("transform", NULL); + SP_ITEM(sp_lpe_item)->setAttribute("transform", nullptr); } if ( linked_path.linksToPath() && second_path.linksToPath() && linked_path.getObject() && second_path.getObject() ) { Geom::PathVector linked_pathv = linked_path.get_pathvector(); diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index bb60db5c6..a6c8ab90b 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -63,7 +63,7 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) apply_with_radius(_("Apply changes if radius > 0"), _("Apply changes if radius > 0"), "apply_with_radius", &wr, this, true), helper_size(_("Helper path size with direction to node:"), _("Helper path size with direction to node"), "helper_size", &wr, this, 0), - _pathvector_satellites(NULL), + _pathvector_satellites(nullptr), _degenerate_hide(false) { registerParameter(&satellites_param); @@ -104,7 +104,7 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem) double power = radius; if (!flexible) { SPDocument * document = SP_ACTIVE_DOCUMENT; - SPNamedView *nv = sp_document_namedview(document, NULL); + SPNamedView *nv = sp_document_namedview(document, nullptr); Glib::ustring display_unit = nv->display_units->abbr; power = Inkscape::Util::Quantity::convert(power, unit.get_abbreviation(), display_unit.c_str()); } @@ -271,7 +271,7 @@ void LPEFilletChamfer::updateAmount() double power = radius; if (!flexible) { SPDocument * document = SP_ACTIVE_DOCUMENT; - SPNamedView *nv = sp_document_namedview(document, NULL); + SPNamedView *nv = sp_document_namedview(document, nullptr); Glib::ustring display_unit = nv->display_units->abbr; power = Inkscape::Util::Quantity::convert(power, unit.get_abbreviation(), display_unit.c_str()); } @@ -346,7 +346,7 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) double power = radius; if (!flexible) { SPDocument * document = SP_ACTIVE_DOCUMENT; - SPNamedView *nv = sp_document_namedview(document, NULL); + SPNamedView *nv = sp_document_namedview(document, nullptr); Glib::ustring display_unit = nv->display_units->abbr; power = Inkscape::Util::Quantity::convert(power, unit.get_abbreviation(), display_unit.c_str()); } diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index f42ee75e4..8522444c6 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -615,7 +615,7 @@ LPEKnot::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::Pat void LPEKnot::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { KnotHolderEntity *e = new KnotHolderEntityCrossingSwitcher(this); - e->create( NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + e->create( nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Drag to select a crossing, click to flip it") ); knotholder->add(e); }; diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp index 8c2c3ec31..ae9ec0361 100644 --- a/src/live_effects/lpe-lattice2.cpp +++ b/src/live_effects/lpe-lattice2.cpp @@ -238,7 +238,7 @@ LPELattice2::newWidget() Parameter * param = *it; Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget()); if(param->param_key == "grid") { - widg = NULL; + widg = nullptr; } Glib::ustring * tip = param->param_getTooltip(); if (widg) { diff --git a/src/live_effects/lpe-measure-segments.cpp b/src/live_effects/lpe-measure-segments.cpp index 0ec03ced0..fd016f24c 100644 --- a/src/live_effects/lpe-measure-segments.cpp +++ b/src/live_effects/lpe-measure-segments.cpp @@ -182,7 +182,7 @@ LPEMeasureSegments::LPEMeasureSegments(LivePathEffectObject *lpeobject) : angle_projection.param_set_range(0.0, 360.0); angle_projection.param_set_increments(90.0, 90.0); angle_projection.param_set_digits(2); - locale_base = strdup(setlocale(LC_NUMERIC, NULL)); + locale_base = strdup(setlocale(LC_NUMERIC, nullptr)); previous_size = 0; pagenumber = 0; general.param_update_default(_("Base of the LPE, focus on measure display and positioning")); @@ -195,7 +195,7 @@ LPEMeasureSegments::LPEMeasureSegments(LivePathEffectObject *lpeobject) : } LPEMeasureSegments::~LPEMeasureSegments() { - doOnRemove(NULL); + doOnRemove(nullptr); } Gtk::Widget * @@ -324,16 +324,16 @@ LPEMeasureSegments::createArrowMarker(Glib::ustring mode) style = style + Glib::ustring(";fill-opacity:") + Glib::ustring(os.str()); style = style + Glib::ustring(";stroke:none"); Inkscape::XML::Document *xml_doc = document->getReprDoc(); - SPObject *elemref = NULL; - Inkscape::XML::Node *arrow = NULL; + SPObject *elemref = nullptr; + Inkscape::XML::Node *arrow = nullptr; if ((elemref = document->getObjectById(mode.c_str()))) { Inkscape::XML::Node *arrow= elemref->getRepr(); if (arrow) { arrow->setAttribute("sodipodi:insensitive", "true"); - arrow->setAttribute("transform", NULL); + arrow->setAttribute("transform", nullptr); Inkscape::XML::Node *arrow_data = arrow->firstChild(); if (arrow_data) { - arrow_data->setAttribute("transform", NULL); + arrow_data->setAttribute("transform", nullptr); arrow_data->setAttribute("style", style.c_str()); } } @@ -370,7 +370,7 @@ LPEMeasureSegments::createArrowMarker(Glib::ustring mode) Glib::ustring arrowpath = mode + Glib::ustring("_path"); arrow_path->setAttribute("id", arrowpath.c_str()); arrow_path->setAttribute("style", style.c_str()); - arrow->addChild(arrow_path, NULL); + arrow->addChild(arrow_path, nullptr); Inkscape::GC::release(arrow_path); elemref = SP_OBJECT(document->getDefs()->appendChildRepr(arrow)); Inkscape::GC::release(arrow); @@ -386,7 +386,7 @@ LPEMeasureSegments::createTextLabel(Geom::Point pos, size_t counter, double leng return; } Inkscape::XML::Document *xml_doc = document->getReprDoc(); - Inkscape::XML::Node *rtext = NULL; + Inkscape::XML::Node *rtext = nullptr; Glib::ustring lpobjid = this->lpeobj->getId(); Glib::ustring itemid = sp_lpe_item->getId(); @@ -394,15 +394,15 @@ LPEMeasureSegments::createTextLabel(Geom::Point pos, size_t counter, double leng id += Glib::ustring::format(counter); id += "-"; id += lpobjid; - SPObject *elemref = NULL; - Inkscape::XML::Node *rtspan = NULL; + SPObject *elemref = nullptr; + Inkscape::XML::Node *rtspan = nullptr; elemref = document->getObjectById(id.c_str()); if (elemref) { rtext = elemref->getRepr(); sp_repr_set_svg_double(rtext, "x", pos[Geom::X]); sp_repr_set_svg_double(rtext, "y", pos[Geom::Y]); rtext->setAttribute("sodipodi:insensitive", "true"); - rtext->setAttribute("transform", NULL); + rtext->setAttribute("transform", nullptr); } else { rtext = xml_doc->createElement("svg:text"); rtext->setAttribute("xml:space", "preserve"); @@ -445,10 +445,10 @@ LPEMeasureSegments::createTextLabel(Geom::Point pos, size_t counter, double leng sp_repr_css_write_string(css,css_str); rtext->setAttribute("style", css_str.c_str()); rtspan->setAttribute("style", css_str.c_str()); - rtspan->setAttribute("transform", NULL); + rtspan->setAttribute("transform", nullptr); sp_repr_css_attr_unref (css); if (!elemref) { - rtext->addChild(rtspan, NULL); + rtext->addChild(rtspan, nullptr); Inkscape::GC::release(rtspan); } length = Inkscape::Util::Quantity::convert(length / doc_scale, display_unit.c_str(), unit.get_abbreviation()); @@ -489,10 +489,10 @@ LPEMeasureSegments::createTextLabel(Geom::Point pos, size_t counter, double leng if ( !valid ) { label_value = Glib::ustring(_("Non Uniform Scale")); } - Inkscape::XML::Node *rstring = NULL; + Inkscape::XML::Node *rstring = nullptr; if (!elemref) { rstring = xml_doc->createTextNode(label_value.c_str()); - rtspan->addChild(rstring, NULL); + rtspan->addChild(rstring, nullptr); Inkscape::GC::release(rstring); } else { rstring = rtspan->firstChild(); @@ -505,7 +505,7 @@ LPEMeasureSegments::createTextLabel(Geom::Point pos, size_t counter, double leng Geom::OptRect bounds = SP_ITEM(elemref)->bounds(SPItem::GEOMETRIC_BBOX); if (bounds) { anotation_width = bounds->width() * 1.15; - rtspan->setAttribute("style", NULL); + rtspan->setAttribute("style", nullptr); } gchar * transform; if (rotate_anotation) { @@ -520,7 +520,7 @@ LPEMeasureSegments::createTextLabel(Geom::Point pos, size_t counter, double leng affine *= Geom::Translate(pos); transform = sp_svg_transform_write(affine); } else { - transform = NULL; + transform = nullptr; } rtext->setAttribute("transform", transform); g_free(transform); @@ -541,7 +541,7 @@ LPEMeasureSegments::createLine(Geom::Point start,Geom::Point end, Glib::ustring id += lpobjid; Inkscape::XML::Document *xml_doc = document->getReprDoc(); SPObject *elemref = document->getObjectById(id.c_str()); - Inkscape::XML::Node *line = NULL; + Inkscape::XML::Node *line = nullptr; if (!main) { Geom::Ray ray(start, end); Geom::Coord angle = ray.angle(); @@ -575,7 +575,7 @@ LPEMeasureSegments::createLine(Geom::Point start,Geom::Point end, Glib::ustring line = elemref->getRepr(); gchar * line_str = sp_svg_write_path( line_pathv ); line->setAttribute("d" , line_str); - line->setAttribute("transform", NULL); + line->setAttribute("transform", nullptr); g_free(line_str); } else { line = xml_doc->createElement("svg:path"); @@ -655,8 +655,8 @@ LPEMeasureSegments::doOnApply(SPLPEItem const* lpeitem) SPDocument *document = SP_ACTIVE_DOCUMENT; bool saved = DocumentUndo::getUndoSensitive(document); DocumentUndo::setUndoSensitive(document, false); - 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) { if (Glib::ustring(root->nthChild(i)->name()) == "svg:style") { @@ -669,7 +669,7 @@ LPEMeasureSegments::doOnApply(SPLPEItem const* lpeitem) } } - 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(""); @@ -679,7 +679,7 @@ LPEMeasureSegments::doOnApply(SPLPEItem const* lpeitem) } } - 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(""); @@ -687,7 +687,7 @@ LPEMeasureSegments::doOnApply(SPLPEItem const* lpeitem) styleNode->appendChild(textNode); Inkscape::GC::release(textNode); - root->addChild(styleNode, NULL); + root->addChild(styleNode, nullptr); Inkscape::GC::release(styleNode); } Glib::ustring styleContent = Glib::ustring(textNode->content()); @@ -919,7 +919,7 @@ LPEMeasureSegments::doBeforeEffect (SPLPEItem const* lpeitem) if (shape) { //only check constrain viewbox on X Geom::Scale scaledoc = document->getDocumentScale(); - SPNamedView *nv = sp_document_namedview(document, NULL); + SPNamedView *nv = sp_document_namedview(document, nullptr); display_unit = nv->display_units->abbr; if (display_unit.empty()) { display_unit = "px"; @@ -938,7 +938,7 @@ LPEMeasureSegments::doBeforeEffect (SPLPEItem const* lpeitem) } rgb24 = color; rgb32 = color32; - SPCurve * c = NULL; + SPCurve * c = nullptr; gchar * fontbutton_str = fontbutton.param_getSVGValue(); Glib::ustring fontdesc_ustring = Glib::ustring(fontbutton_str); Pango::FontDescription fontdesc(fontdesc_ustring); diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 4d9b218a5..66f00689a 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -249,7 +249,7 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) } else if ( mode == MT_V){ SPDocument * document = SP_ACTIVE_DOCUMENT; if (document) { - Geom::Affine transform = i2anc_affine(SP_OBJECT(lpeitem), NULL).inverse(); + Geom::Affine transform = i2anc_affine(SP_OBJECT(lpeitem), nullptr).inverse(); Geom::Point sp = Geom::Point(document->getWidth().value("px")/2.0, 0) * transform; start_point.param_setValue(sp); Geom::Point ep = Geom::Point(document->getWidth().value("px")/2.0, document->getHeight().value("px")) * transform; @@ -259,7 +259,7 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) } else { //horizontal page SPDocument * document = SP_ACTIVE_DOCUMENT; if (document) { - Geom::Affine transform = i2anc_affine(SP_OBJECT(lpeitem), NULL).inverse(); + Geom::Affine transform = i2anc_affine(SP_OBJECT(lpeitem), nullptr).inverse(); Geom::Point sp = Geom::Point(0, document->getHeight().value("px")/2.0) * transform; start_point.param_setValue(sp); Geom::Point ep = Geom::Point(document->getWidth().value("px"), document->getHeight().value("px")/2.0) * transform; @@ -300,7 +300,7 @@ LPEMirrorSymmetry::cloneD(SPObject *orig, SPObject *dest, bool reset) g_free(str); c->unref(); } else { - dest->getRepr()->setAttribute("d", NULL); + dest->getRepr()->setAttribute("d", nullptr); } if (reset) { dest->getRepr()->setAttribute("style", shape->getRepr()->attribute("style")); @@ -312,7 +312,7 @@ Inkscape::XML::Node * LPEMirrorSymmetry::createPathBase(SPObject *elemref) { SPDocument * document = SP_ACTIVE_DOCUMENT; if (!document) { - return NULL; + return nullptr; } Inkscape::XML::Document *xml_doc = document->getReprDoc(); Inkscape::XML::Node *prev = elemref->getRepr(); @@ -321,7 +321,7 @@ LPEMirrorSymmetry::createPathBase(SPObject *elemref) { Inkscape::XML::Node *container = xml_doc->createElement("svg:g"); container->setAttribute("transform", prev->attribute("transform")); std::vector<SPItem*> const item_list = sp_item_group_item_list(group); - Inkscape::XML::Node *previous = NULL; + Inkscape::XML::Node *previous = nullptr; for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPObject *sub_item = *iter; Inkscape::XML::Node *resultnode = createPathBase(sub_item); @@ -347,8 +347,8 @@ LPEMirrorSymmetry::toMirror(Geom::Affine transform, bool reset) elemref_id += this->lpeobj->getId(); items.clear(); items.push_back(elemref_id); - SPObject *elemref = NULL; - Inkscape::XML::Node *phantom = NULL; + SPObject *elemref = nullptr; + Inkscape::XML::Node *phantom = nullptr; if (elemref = document->getObjectById(elemref_id.c_str())) { phantom = elemref->getRepr(); } else { diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp index 02b3c8eed..91ea9df74 100644 --- a/src/live_effects/lpe-offset.cpp +++ b/src/live_effects/lpe-offset.cpp @@ -90,7 +90,7 @@ LPEOffset::LPEOffset(LivePathEffectObject *lpeobject) : offset_pt = Geom::Point(); origin = Geom::Point(); evenodd = true; - _knot_entity = NULL; + _knot_entity = nullptr; _provides_knotholder_entities = true; apply_to_clippath_and_mask = true; } @@ -204,7 +204,7 @@ LPEOffset::doBeforeEffect (SPLPEItem const* lpeitem) SPCSSAttr *css; const gchar *val; css = sp_repr_css_attr (item->getRepr() , "style"); - val = sp_repr_css_property (css, "fill-rule", NULL); + val = sp_repr_css_property (css, "fill-rule", nullptr); bool upd_fill_rule = false; if (val && strcmp (val, "nonzero") == 0) { @@ -251,7 +251,7 @@ LPEOffset::doEffect_path(Geom::PathVector const & path_in) Geom::Point winding_point = original[0].initialPoint(); int wind = 0; double dist = Geom::infinity(); - pathv_matrix_point_bbox_wind_distance(original_pathv, Geom::identity(), winding_point, NULL, &wind, &dist, 0.5, NULL); + pathv_matrix_point_bbox_wind_distance(original_pathv, Geom::identity(), winding_point, nullptr, &wind, &dist, 0.5, nullptr); bool path_inside = wind % 2 != 0; Geom::PathVector outline = Inkscape::outline(original, std::abs(offset) * 2 , (attempt_force_join ? std::numeric_limits<double>::max() : miter_limit), @@ -382,7 +382,7 @@ LPEOffset::drawHandle(Geom::Point p) void LPEOffset::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { _knot_entity = new OfS::KnotHolderEntityOffsetPoint(this); - _knot_entity->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Offset point"), SP_KNOT_SHAPE_CIRCLE); + _knot_entity->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Offset point"), SP_KNOT_SHAPE_CIRCLE); knotholder->add(_knot_entity); } diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp index 09794f7a7..dd052c796 100644 --- a/src/live_effects/lpe-patternalongpath.cpp +++ b/src/live_effects/lpe-patternalongpath.cpp @@ -53,7 +53,7 @@ namespace WPAP { ~KnotHolderEntityWidthPatternAlongPath() override { LPEPatternAlongPath *lpe = dynamic_cast<LPEPatternAlongPath *> (_effect); - lpe->_knot_entity = NULL; + lpe->_knot_entity = nullptr; } void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) override; Geom::Point knot_get() const override; @@ -106,7 +106,7 @@ LPEPatternAlongPath::LPEPatternAlongPath(LivePathEffectObject *lpeobject) : registerParameter(&fuse_tolerance); prop_scale.param_set_digits(3); prop_scale.param_set_increments(0.01, 0.10); - _knot_entity = NULL; + _knot_entity = nullptr; _provides_knotholder_entities = true; } @@ -298,7 +298,7 @@ void LPEPatternAlongPath::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { _knot_entity = new WPAP::KnotHolderEntityWidthPatternAlongPath(this); - _knot_entity->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Change the width"), SP_KNOT_SHAPE_CIRCLE); + _knot_entity->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Change the width"), SP_KNOT_SHAPE_CIRCLE); knotholder->add(_knot_entity); if (hide_knot) { _knot_entity->knot->hide(); diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp index e95cdfd4b..dcbf3fee7 100644 --- a/src/live_effects/lpe-perspective-envelope.cpp +++ b/src/live_effects/lpe-perspective-envelope.cpp @@ -235,7 +235,7 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) } Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(curve->get_pathvector()); curve->reset(); - Geom::CubicBezier const *cubic = NULL; + Geom::CubicBezier const *cubic = nullptr; Geom::Point point_at1(0, 0); Geom::Point point_at2(0, 0); Geom::Point point_at3(0, 0); diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index 0387e52ba..857bd2952 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -73,7 +73,7 @@ void LPEPerspectivePath::doOnApply(SPLPEItem const* lpeitem) { Persp3D *persp = persp3d_document_first_persp(lpeitem->document); - if(persp == 0 ){ + if(persp == nullptr ){ char *msg = _("You need a BOX 3D object"); Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); @@ -88,7 +88,7 @@ LPEPerspectivePath::doBeforeEffect (SPLPEItem const* lpeitem) original_bbox(lpeitem, true); SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem); Persp3D *persp = persp3d_document_first_persp(lpeitem->document); - if(persp == 0 ){ + if(persp == nullptr ){ char *msg = _("You need a BOX 3D object"); Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); @@ -103,10 +103,10 @@ LPEPerspectivePath::doBeforeEffect (SPLPEItem const* lpeitem) void LPEPerspectivePath::refresh(Gtk::Entry* perspective) { perspectiveID = perspective->get_text(); - Persp3D *first = 0; - Persp3D *persp = 0; + Persp3D *first = nullptr; + Persp3D *persp = nullptr; for (auto& child: lpeobj->document->getDefs()->children) { - if (SP_IS_PERSP3D(&child) && first == 0) { + if (SP_IS_PERSP3D(&child) && first == nullptr) { first = SP_PERSP3D(&child); } if (SP_IS_PERSP3D(&child) && strcmp(child.getId(), const_cast<const gchar *>(perspectiveID.c_str())) == 0) { @@ -114,14 +114,14 @@ void LPEPerspectivePath::refresh(Gtk::Entry* perspective) { break; } } - if(first == 0 ){ + if(first == nullptr ){ char *msg = _("You need a BOX 3D object"); Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); dialog.run(); return; } - if(persp == 0){ + if(persp == nullptr){ persp = first; char *msg = _("First perspective selected"); Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, @@ -263,7 +263,7 @@ LPEPerspectivePath::newWidget() void LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { KnotHolderEntity *e = new PP::KnotHolderEntityOffset(this); - e->create( NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + e->create( nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Adjust the origin") ); knotholder->add(e); }; diff --git a/src/live_effects/lpe-powerclip.cpp b/src/live_effects/lpe-powerclip.cpp index b4c342930..35da3bd26 100644 --- a/src/live_effects/lpe-powerclip.cpp +++ b/src/live_effects/lpe-powerclip.cpp @@ -94,7 +94,7 @@ LPEPowerClip::doBeforeEffect (SPLPEItem const* lpeitem){ std::vector<SPObject*> clip_path_list = clip_path->childList(true); for ( std::vector<SPObject*>::const_iterator iter=clip_path_list.begin();iter!=clip_path_list.end();++iter) { SPObject * clip_data = *iter; - SPObject * clip_to_path = NULL; + SPObject * clip_to_path = nullptr; if (SP_IS_SHAPE(clip_data) && !SP_IS_PATH(clip_data) && convert_shapes) { SPDocument * document = SP_ACTIVE_DOCUMENT; if (!document) { @@ -126,7 +126,7 @@ LPEPowerClip::doBeforeEffect (SPLPEItem const* lpeitem){ clip_to_path = document->getObjectByRepr(clip_path_node); // transform position - SPCurve * c = NULL; + SPCurve * c = nullptr; c = SP_SHAPE(clip_to_path)->getCurve(); if (c) { Geom::PathVector c_pv = c->get_pathvector(); @@ -136,7 +136,7 @@ LPEPowerClip::doBeforeEffect (SPLPEItem const* lpeitem){ c->unref(); } - clip_path_node->setAttribute("transform", NULL); + clip_path_node->setAttribute("transform", nullptr); if (title && clip_to_path) { clip_to_path->setTitle(title); @@ -190,7 +190,7 @@ LPEPowerClip::addInverse (SPItem * clip_data){ addInverse(subitem); } } else if (SP_IS_PATH(clip_data)) { - SPCurve * c = NULL; + SPCurve * c = nullptr; c = SP_SHAPE(clip_data)->getCurve(); if (c) { Geom::PathVector c_pv = c->get_pathvector(); @@ -213,7 +213,7 @@ LPEPowerClip::addInverse (SPItem * clip_data){ if (tools_isactive(desktop, TOOLS_NODES)) { Inkscape::Selection * sel = SP_ACTIVE_DESKTOP->getSelection(); SPItem * item = sel->singleItem(); - if (item != NULL) { + if (item != nullptr) { sel->remove(item); sel->add(item); } @@ -236,7 +236,7 @@ LPEPowerClip::removeInverse (SPItem * clip_data){ removeInverse(subitem); } } else if (SP_IS_PATH(clip_data)) { - SPCurve * c = NULL; + SPCurve * c = nullptr; c = SP_SHAPE(clip_data)->getCurve(); if (c) { Geom::PathVector c_pv = c->get_pathvector(); @@ -255,7 +255,7 @@ LPEPowerClip::removeInverse (SPItem * clip_data){ if (tools_isactive(desktop, TOOLS_NODES)) { Inkscape::Selection * sel = SP_ACTIVE_DESKTOP->getSelection(); SPItem * item = sel->singleItem(); - if (item != NULL) { + if (item != nullptr) { sel->remove(item); sel->add(item); } @@ -413,7 +413,7 @@ LPEPowerClip::flattenClip(SPItem * clip_data, Geom::PathVector &path_in) flattenClip(subitem, path_in); } } else if (SP_IS_PATH(clip_data)) { - SPCurve * c = NULL; + SPCurve * c = nullptr; c = SP_SHAPE(clip_data)->getCurve(); if (c) { Geom::PathVector c_pv = c->get_pathvector(); diff --git a/src/live_effects/lpe-powermask.cpp b/src/live_effects/lpe-powermask.cpp index 577d8a841..ac3a1dd76 100644 --- a/src/live_effects/lpe-powermask.cpp +++ b/src/live_effects/lpe-powermask.cpp @@ -108,7 +108,7 @@ LPEPowerMask::doBeforeEffect (SPLPEItem const* lpeitem){ void LPEPowerMask::setMask(){ SPMask *mask = SP_ITEM(sp_lpe_item)->mask_ref->getObject(); - SPObject *elemref = NULL; + SPObject *elemref = nullptr; SPDocument * document = SP_ACTIVE_DOCUMENT; if (!document || !mask) { return; @@ -119,8 +119,8 @@ LPEPowerMask::setMask(){ return; } Inkscape::XML::Document *xml_doc = document->getReprDoc(); - Inkscape::XML::Node *box = NULL; - Inkscape::XML::Node *filter = NULL; + Inkscape::XML::Node *box = nullptr; + Inkscape::XML::Node *filter = nullptr; SPDefs * defs = document->getDefs(); Glib::ustring mask_id = (Glib::ustring)mask->getId(); Glib::ustring box_id = mask_id + (Glib::ustring)"_box"; @@ -218,12 +218,12 @@ LPEPowerMask::setMask(){ if(mask_node->attribute("style")) { sp_repr_css_attr_add_from_string(css, mask_node->attribute("style")); } - char const* filter = sp_repr_css_property (css, "filter", NULL); + char const* filter = sp_repr_css_property (css, "filter", nullptr); if(!filter || !strcmp(filter, filter_uri.c_str())) { if (invert && is_visible) { sp_repr_css_set_property (css, "filter", filter_uri.c_str()); } else { - sp_repr_css_set_property (css, "filter", NULL); + sp_repr_css_set_property (css, "filter", nullptr); } Glib::ustring css_str; sp_repr_css_write_string(css, css_str); @@ -250,12 +250,12 @@ LPEPowerMask::setMask(){ style = style + Glib::ustring(";fill-opacity:") + Glib::ustring(os.str()); SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_attr_add_from_string(css, style.c_str()); - char const* filter = sp_repr_css_property (css, "filter", NULL); + char const* filter = sp_repr_css_property (css, "filter", nullptr); if(!filter || !strcmp(filter, filter_uri.c_str())) { if (invert && is_visible) { sp_repr_css_set_property (css, "filter", filter_uri.c_str()); } else { - sp_repr_css_set_property (css, "filter", NULL); + sp_repr_css_set_property (css, "filter", nullptr); } } @@ -297,7 +297,7 @@ LPEPowerMask::doOnRemove (SPLPEItem const* lpeitem) //wrap.param_setValue(false); background.param_setValue(false); setMask(); - SPObject *elemref = NULL; + SPObject *elemref = nullptr; SPDocument * document = SP_ACTIVE_DOCUMENT; Glib::ustring mask_id = (Glib::ustring)mask->getId(); Glib::ustring filter_id = mask_id + (Glib::ustring)"_inverse"; diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 1d64e9042..ce240ab1e 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -450,12 +450,12 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom:: if (arc0) { build_from_sbasis(pb,arc0->toSBasis(), tol, false); delete arc0; - arc0 = NULL; + arc0 = nullptr; } if (arc1) { build_from_sbasis(pb,arc1->toSBasis(), tol, false); delete arc1; - arc1 = NULL; + arc1 = nullptr; } break; diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp index e44688baa..37a94343b 100644 --- a/src/live_effects/lpe-roughen.cpp +++ b/src/live_effects/lpe-roughen.cpp @@ -222,7 +222,7 @@ void LPERoughen::doEffect(SPCurve *curve) } } while (curve_it1 != curve_endit) { - Geom::CubicBezier const *cubic = NULL; + Geom::CubicBezier const *cubic = nullptr; cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1); if (cubic) { nCurve->curveto((*cubic)[1] + last_move, (*cubic)[2], curve_it1->finalPoint()); diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp index 7726af176..0cda15b81 100644 --- a/src/live_effects/lpe-ruler.cpp +++ b/src/live_effects/lpe-ruler.cpp @@ -79,7 +79,7 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const double real_mark_length = mark_length; SPDocument * document = SP_ACTIVE_DOCUMENT; - SPNamedView *nv = sp_document_namedview(document, NULL); + SPNamedView *nv = sp_document_namedview(document, nullptr); Glib::ustring display_unit = nv->display_units->abbr; real_mark_length = Inkscape::Util::Quantity::convert(real_mark_length, unit.get_abbreviation(), display_unit.c_str()); double real_minor_mark_length = minor_mark_length; @@ -134,7 +134,7 @@ LPERuler::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_i double real_mark_distance = mark_distance; SPDocument * document = SP_ACTIVE_DOCUMENT; - SPNamedView *nv = sp_document_namedview(document, NULL); + SPNamedView *nv = sp_document_namedview(document, nullptr); Glib::ustring display_unit = nv->display_units->abbr; real_mark_distance = Inkscape::Util::Quantity::convert(real_mark_distance, unit.get_abbreviation(), display_unit.c_str()); diff --git a/src/live_effects/lpe-show_handles.cpp b/src/live_effects/lpe-show_handles.cpp index 35da722d0..aa4b363f9 100644 --- a/src/live_effects/lpe-show_handles.cpp +++ b/src/live_effects/lpe-show_handles.cpp @@ -124,7 +124,7 @@ LPEShowHandles::generateHelperPath(Geom::PathVector result) return; } - Geom::CubicBezier const *cubic = NULL; + Geom::CubicBezier const *cubic = nullptr; for (Geom::PathVector::iterator path_it = result.begin(); path_it != result.end(); ++path_it) { //Si está vacío... if (path_it->empty()) { diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index e676f37a0..e640475dc 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -153,7 +153,7 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) return; } Geom::PathVector tmp_path; - Geom::CubicBezier const *cubic = NULL; + Geom::CubicBezier const *cubic = nullptr; for (Geom::PathVector::iterator path_it = result.begin(); path_it != result.end(); ++path_it) { if (path_it->empty()) { continue; diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp index ee2e6552b..6c34fc9e6 100644 --- a/src/live_effects/lpe-tangent_to_curve.cpp +++ b/src/live_effects/lpe-tangent_to_curve.cpp @@ -97,19 +97,19 @@ void LPETangentToCurve::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { { KnotHolderEntity *e = new TtC::KnotHolderEntityAttachPt(this); - e->create( NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + e->create( nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Adjust the point of attachment of the tangent") ); knotholder->add(e); } { KnotHolderEntity *e = new TtC::KnotHolderEntityLeftEnd(this); - e->create( NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + e->create( nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Adjust the <b>left</b> end of the tangent") ); knotholder->add(e); } { KnotHolderEntity *e = new TtC::KnotHolderEntityRightEnd(this); - e->create( NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + e->create( nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Adjust the <b>right</b> end of the tangent") ); knotholder->add(e); } diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 212485ecf..63225d745 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -450,11 +450,11 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path void LPETaperStroke::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { KnotHolderEntity *e = new TpS::KnotHolderEntityAttachBegin(this); - e->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Start point of the taper"), SP_KNOT_SHAPE_CIRCLE); + e->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("Start point of the taper"), SP_KNOT_SHAPE_CIRCLE); knotholder->add(e); KnotHolderEntity *f = new TpS::KnotHolderEntityAttachEnd(this); - f->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("End point of the taper"), SP_KNOT_SHAPE_CIRCLE); + f->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("End point of the taper"), SP_KNOT_SHAPE_CIRCLE); knotholder->add(f); } diff --git a/src/live_effects/lpeobject-reference.cpp b/src/live_effects/lpeobject-reference.cpp index edede5ca1..14472d001 100644 --- a/src/live_effects/lpeobject-reference.cpp +++ b/src/live_effects/lpeobject-reference.cpp @@ -25,12 +25,12 @@ static void lpeobjectreference_source_modified(SPObject *iSource, guint flags, L LPEObjectReference::LPEObjectReference(SPObject* i_owner) : URIReference(i_owner) { owner=i_owner; - lpeobject_href = NULL; - lpeobject_repr = NULL; - lpeobject = NULL; + lpeobject_href = nullptr; + lpeobject_repr = nullptr; + lpeobject = nullptr; _changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(lpeobjectreference_href_changed), this)); // listening to myself, this should be virtual instead - user_unlink = NULL; + user_unlink = nullptr; } LPEObjectReference::~LPEObjectReference(void) @@ -80,7 +80,7 @@ LPEObjectReference::unlink(void) { if (lpeobject_href) { g_free(lpeobject_href); - lpeobject_href = NULL; + lpeobject_href = nullptr; } detach(); } @@ -88,7 +88,7 @@ LPEObjectReference::unlink(void) void LPEObjectReference::start_listening(LivePathEffectObject* to) { - if ( to == NULL ) { + if ( to == nullptr ) { return; } lpeobject = to; @@ -102,8 +102,8 @@ LPEObjectReference::quit_listening(void) { _modified_connection.disconnect(); _delete_connection.disconnect(); - lpeobject_repr = NULL; - lpeobject = NULL; + lpeobject_repr = nullptr; + lpeobject = nullptr; } static void diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index bc5ff0576..c05d00d60 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -22,17 +22,17 @@ static void livepatheffect_on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data); static Inkscape::XML::NodeEventVector const livepatheffect_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ livepatheffect_on_repr_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; LivePathEffectObject::LivePathEffectObject() : SPObject(), effecttype(Inkscape::LivePathEffect::INVALID_LPE), effecttype_set(false), - lpe(NULL) + lpe(nullptr) { #ifdef LIVEPATHEFFECT_VERBOSE g_message("Init livepatheffectobject"); @@ -46,7 +46,7 @@ LivePathEffectObject::~LivePathEffectObject() { * Virtual build: set livepatheffect attributes from its associated XML node. */ void LivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr) { - g_assert(this != NULL); + g_assert(this != nullptr); g_assert(SP_IS_OBJECT(this)); SPObject::build(document, repr); @@ -85,7 +85,7 @@ void LivePathEffectObject::release() { if (this->lpe) { delete this->lpe; - this->lpe = NULL; + this->lpe = nullptr; } this->effecttype = Inkscape::LivePathEffect::INVALID_LPE; @@ -105,7 +105,7 @@ void LivePathEffectObject::set(unsigned key, gchar const *value) { case SP_PROP_PATH_EFFECT: if (this->lpe) { delete this->lpe; - this->lpe = NULL; + this->lpe = nullptr; } if ( value && Inkscape::LivePathEffect::LPETypeConverter.is_valid_key(value) ) { @@ -114,7 +114,7 @@ void LivePathEffectObject::set(unsigned key, gchar const *value) { this->effecttype_set = true; } else { this->effecttype = Inkscape::LivePathEffect::INVALID_LPE; - this->lpe = NULL; + this->lpe = nullptr; this->effecttype_set = false; } @@ -180,7 +180,7 @@ LivePathEffectObject *LivePathEffectObject::fork_private_if_necessary(unsigned i Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *dup_repr = this->getRepr()->duplicate(xml_doc); - doc->getDefs()->getRepr()->addChild(dup_repr, NULL); + doc->getDefs()->getRepr()->addChild(dup_repr, nullptr); LivePathEffectObject *lpeobj_new = LIVEPATHEFFECT( doc->getObjectByRepr(dup_repr) ); Inkscape::GC::release(dup_repr); diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp index 7470f54cd..3c1498fc3 100644 --- a/src/live_effects/parameter/array.cpp +++ b/src/live_effects/parameter/array.cpp @@ -57,7 +57,7 @@ ArrayParam<std::vector<Satellite > >::readsvg(const gchar * str) } gchar ** strarray = g_strsplit(str, "@", 0); gchar ** iter = strarray; - while (*iter != NULL) { + while (*iter != nullptr) { gchar ** strsubarray = g_strsplit(*iter, ",", 8); if (*strsubarray[7]) {//steps always > 0 Satellite *satellite = new Satellite(); diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h index be19889b3..156de2f81 100644 --- a/src/live_effects/parameter/array.h +++ b/src/live_effects/parameter/array.h @@ -46,14 +46,14 @@ public: } Gtk::Widget * param_newWidget() override { - return NULL; + return nullptr; } bool param_readSVGValue(const gchar * strvalue) override { _vector.clear(); gchar ** strarray = g_strsplit(strvalue, "|", 0); gchar ** iter = strarray; - while (*iter != NULL) { + while (*iter != nullptr) { _vector.push_back( readsvg(*iter) ); iter++; } diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp index bfbda2bfd..2e8c4dbcc 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -84,7 +84,7 @@ BoolParam::param_newWidget() checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter")); return dynamic_cast<Gtk::Widget *> (checkwdg); } else { - return NULL; + return nullptr; } } diff --git a/src/live_effects/parameter/colorpicker.cpp b/src/live_effects/parameter/colorpicker.cpp index d4ebdaa1c..ec2b18389 100644 --- a/src/live_effects/parameter/colorpicker.cpp +++ b/src/live_effects/parameter/colorpicker.cpp @@ -43,7 +43,7 @@ ColorPickerParam::param_set_default() static guint32 sp_read_color_alpha(gchar const *str, guint32 def) { guint32 val = 0; - if (str == NULL) return def; + if (str == nullptr) return def; while ((*str <= ' ') && *str) str++; if (!*str) return def; diff --git a/src/live_effects/parameter/hidden.cpp b/src/live_effects/parameter/hidden.cpp index 5a21f572b..fd062d277 100644 --- a/src/live_effects/parameter/hidden.cpp +++ b/src/live_effects/parameter/hidden.cpp @@ -69,7 +69,7 @@ HiddenParam::param_getDefaultSVGValue() const Gtk::Widget * HiddenParam::param_newWidget() { - return NULL; + return nullptr; } void diff --git a/src/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp index 2107a5912..c22a3df33 100644 --- a/src/live_effects/parameter/item.cpp +++ b/src/live_effects/parameter/item.cpp @@ -40,7 +40,7 @@ ItemParam::ItemParam( const Glib::ustring& label, const Glib::ustring& tip, Effect* effect, const gchar * default_value) : Parameter(label, tip, key, wr, effect), changed(true), - href(NULL), + href(nullptr), ref( (SPObject*)effect->getLPEObj() ) { last_transform = Geom::identity(); @@ -154,7 +154,7 @@ ItemParam::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::Pa void ItemParam::start_listening(SPObject * to) { - if ( to == NULL ) { + if ( to == nullptr ) { return; } linked_delete_connection = to->connectDelete(sigc::mem_fun(*this, &ItemParam::linked_delete)); @@ -188,7 +188,7 @@ ItemParam::remove_link() if (href) { ref.detach(); g_free(href); - href = NULL; + href = nullptr; } } diff --git a/src/live_effects/parameter/message.cpp b/src/live_effects/parameter/message.cpp index 03eb2219f..a6e919558 100644 --- a/src/live_effects/parameter/message.cpp +++ b/src/live_effects/parameter/message.cpp @@ -20,7 +20,7 @@ MessageParam::MessageParam( const Glib::ustring& label, const Glib::ustring& tip message(default_message), defmessage(default_message) { - _label = NULL; + _label = nullptr; _min_height = -1; } diff --git a/src/live_effects/parameter/originalitem.cpp b/src/live_effects/parameter/originalitem.cpp index 52e4c2fd8..820c4d6b9 100644 --- a/src/live_effects/parameter/originalitem.cpp +++ b/src/live_effects/parameter/originalitem.cpp @@ -105,7 +105,7 @@ OriginalItemParam::on_select_original_button_click() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPItem *original = ref.getObject(); - if (desktop == NULL || original == NULL) { + if (desktop == nullptr || original == nullptr) { return; } Inkscape::Selection *selection = desktop->getSelection(); diff --git a/src/live_effects/parameter/originalitem.h b/src/live_effects/parameter/originalitem.h index 4b285f8e1..d070161ac 100644 --- a/src/live_effects/parameter/originalitem.h +++ b/src/live_effects/parameter/originalitem.h @@ -23,7 +23,7 @@ public: Inkscape::UI::Widget::Registry* wr, Effect* effect); ~OriginalItemParam() override; - bool linksToItem() const { return (href != NULL); } + bool linksToItem() const { return (href != nullptr); } SPItem * getObject() const { return ref.getObject(); } Gtk::Widget * param_newWidget() override; diff --git a/src/live_effects/parameter/originalitemarray.cpp b/src/live_effects/parameter/originalitemarray.cpp index 5a0d67d26..3116b1f9c 100644 --- a/src/live_effects/parameter/originalitemarray.cpp +++ b/src/live_effects/parameter/originalitemarray.cpp @@ -323,7 +323,7 @@ void OriginalItemArrayParam::unlink(ItemAndActive* to) to->ref.detach(); if (to->href) { g_free(to->href); - to->href = NULL; + to->href = nullptr; } } @@ -398,12 +398,12 @@ bool OriginalItemArrayParam::param_readSVGValue(const gchar* strvalue) _store->clear(); gchar ** strarray = g_strsplit(strvalue, "|", 0); - for (gchar ** iter = strarray; *iter != NULL; iter++) { + for (gchar ** iter = strarray; *iter != nullptr; iter++) { if ((*iter)[0] == '#') { gchar ** substrarray = g_strsplit(*iter, ",", 0); ItemAndActive* w = new ItemAndActive((SPObject *)param_effect->getLPEObj()); w->href = g_strdup(*substrarray); - w->actived = *(substrarray+1) != NULL && (*(substrarray+1))[0] == '1'; + w->actived = *(substrarray+1) != nullptr && (*(substrarray+1))[0] == '1'; w->linked_changed_connection = w->ref.changedSignal().connect(sigc::bind<ItemAndActive *>(sigc::mem_fun(*this, &OriginalItemArrayParam::linked_changed), w)); w->ref.attach(URI(w->href)); diff --git a/src/live_effects/parameter/originalitemarray.h b/src/live_effects/parameter/originalitemarray.h index edb5a3be5..968aeaff0 100644 --- a/src/live_effects/parameter/originalitemarray.h +++ b/src/live_effects/parameter/originalitemarray.h @@ -32,7 +32,7 @@ namespace LivePathEffect { class ItemAndActive { public: ItemAndActive(SPObject *owner) - : href(NULL), + : href(nullptr), ref(owner), actived(true) { diff --git a/src/live_effects/parameter/originalpath.cpp b/src/live_effects/parameter/originalpath.cpp index 018e1e69e..5ad5546da 100644 --- a/src/live_effects/parameter/originalpath.cpp +++ b/src/live_effects/parameter/originalpath.cpp @@ -90,7 +90,7 @@ OriginalPathParam::param_newWidget() void OriginalPathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/) { - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE(linked_obj)) { if (_from_original_d) { curve = SP_SHAPE(linked_obj)->getCurveForEdit(); @@ -102,7 +102,7 @@ OriginalPathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags* curve = SP_TEXT(linked_obj)->getNormalizedBpath(); } - if (curve == NULL) { + if (curve == nullptr) { // curve invalid, set empty pathvector _pathvector = Geom::PathVector(); } else { @@ -128,7 +128,7 @@ OriginalPathParam::on_select_original_button_click() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPItem *original = ref.getObject(); - if (desktop == NULL || original == NULL) { + if (desktop == nullptr || original == nullptr) { return; } Inkscape::Selection *selection = desktop->getSelection(); diff --git a/src/live_effects/parameter/originalpath.h b/src/live_effects/parameter/originalpath.h index bd7b10741..4432d063d 100644 --- a/src/live_effects/parameter/originalpath.h +++ b/src/live_effects/parameter/originalpath.h @@ -24,7 +24,7 @@ public: Effect* effect); ~OriginalPathParam() override; - bool linksToPath() const { return (href != NULL); } + bool linksToPath() const { return (href != nullptr); } SPItem * getObject() const { return ref.getObject(); } Gtk::Widget * param_newWidget() override; diff --git a/src/live_effects/parameter/originalpatharray.cpp b/src/live_effects/parameter/originalpatharray.cpp index 2091c4d71..f9e56c8f3 100644 --- a/src/live_effects/parameter/originalpatharray.cpp +++ b/src/live_effects/parameter/originalpatharray.cpp @@ -363,7 +363,7 @@ void OriginalPathArrayParam::unlink(PathAndDirectionAndVisible* to) to->_pathvector = Geom::PathVector(); if (to->href) { g_free(to->href); - to->href = NULL; + to->href = nullptr; } } @@ -424,7 +424,7 @@ void OriginalPathArrayParam::setPathVector(SPObject *linked_obj, guint /*flags*/ if (!to) { return; } - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE(linked_obj)) { SPLPEItem * lpe_item = SP_LPE_ITEM(linked_obj); if (_from_original_d) { @@ -451,7 +451,7 @@ void OriginalPathArrayParam::setPathVector(SPObject *linked_obj, guint /*flags*/ curve = SP_TEXT(linked_obj)->getNormalizedBpath(); } - if (curve == NULL) { + if (curve == nullptr) { // curve invalid, set empty pathvector to->_pathvector = Geom::PathVector(); } else { @@ -483,14 +483,14 @@ bool OriginalPathArrayParam::param_readSVGValue(const gchar* strvalue) _store->clear(); gchar ** strarray = g_strsplit(strvalue, "|", 0); - for (gchar ** iter = strarray; *iter != NULL; iter++) { + for (gchar ** iter = strarray; *iter != nullptr; iter++) { if ((*iter)[0] == '#') { gchar ** substrarray = g_strsplit(*iter, ",", 0); PathAndDirectionAndVisible* w = new PathAndDirectionAndVisible((SPObject *)param_effect->getLPEObj()); w->href = g_strdup(*substrarray); - w->reversed = *(substrarray+1) != NULL && (*(substrarray+1))[0] == '1'; + w->reversed = *(substrarray+1) != nullptr && (*(substrarray+1))[0] == '1'; //Like this to make backwards compatible, new value added in 0.93 - w->visibled = *(substrarray+2) == NULL || (*(substrarray+2))[0] == '1'; + w->visibled = *(substrarray+2) == nullptr || (*(substrarray+2))[0] == '1'; w->linked_changed_connection = w->ref.changedSignal().connect(sigc::bind<PathAndDirectionAndVisible *>(sigc::mem_fun(*this, &OriginalPathArrayParam::linked_changed), w)); w->ref.attach(URI(w->href)); diff --git a/src/live_effects/parameter/originalpatharray.h b/src/live_effects/parameter/originalpatharray.h index 92edff103..23a41215f 100644 --- a/src/live_effects/parameter/originalpatharray.h +++ b/src/live_effects/parameter/originalpatharray.h @@ -32,7 +32,7 @@ namespace LivePathEffect { class PathAndDirectionAndVisible { public: PathAndDirectionAndVisible(SPObject *owner) - : href(NULL), + : href(nullptr), ref(owner), _pathvector(Geom::PathVector()), reversed(false), diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index a175359f0..acfe159ab 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -196,7 +196,7 @@ ScalarParam::param_newWidget() } return dynamic_cast<Gtk::Widget *> (rsu); } else { - return NULL; + return nullptr; } } diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index ab385daa6..649d3a1ef 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -64,7 +64,7 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, _pathvector(), _pwd2(), must_recalculate_pwd2(false), - href(NULL), + href(nullptr), ref( (SPObject*)effect->getLPEObj() ) { defvalue = g_strdup(default_value); @@ -198,8 +198,8 @@ PathParam::param_newWidget() Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); - Gtk::Image * pIcon = NULL; - Gtk::Button * pButton = NULL; + Gtk::Image * pIcon = nullptr; + Gtk::Button * pButton = nullptr; if (_edit_button) { pIcon = Gtk::manage(new Gtk::Image()); pIcon->set_from_icon_name( INKSCAPE_ICON("tool-node-editor"), Gtk::ICON_SIZE_BUTTON); @@ -398,7 +398,7 @@ PathParam::emit_changed() void PathParam::start_listening(SPObject * to) { - if ( to == NULL ) { + if ( to == nullptr ) { return; } linked_delete_connection = to->connectDelete(sigc::mem_fun(*this, &PathParam::linked_delete)); @@ -432,7 +432,7 @@ PathParam::remove_link() if (href) { ref.detach(); g_free(href); - href = NULL; + href = nullptr; } } @@ -457,7 +457,7 @@ void PathParam::linked_transformed(Geom::Affine const *rel_transf, SPItem *moved void PathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/) { - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE(linked_obj)) { if (_from_original_d) { curve = SP_SHAPE(linked_obj)->getCurveForEdit(); @@ -469,7 +469,7 @@ PathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/) curve = SP_TEXT(linked_obj)->getNormalizedBpath(); } - if (curve == NULL) { + if (curve == nullptr) { // curve invalid, set default value _pathvector = sp_svg_read_pathv(defvalue); } else { @@ -492,7 +492,7 @@ void PathParam::on_edit_button_click() { SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); - if (item != NULL) { + if (item != nullptr) { param_editOncanvas(item, SP_ACTIVE_DESKTOP); } } @@ -505,7 +505,7 @@ PathParam::paste_param_path(const char *svgd) // remove possible link to path remove_link(); SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); - if (item != NULL) { + if (item != nullptr) { Geom::PathVector path_clipboard = sp_svg_read_pathv(svgd); path_clipboard *= item->i2doc_affine().inverse(); svgd = sp_svg_write_path( path_clipboard ); diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index fe0699a19..a195d663b 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -25,7 +25,7 @@ PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip, : Parameter(label, tip, key, wr, effect), defvalue(default_value), liveupdate(live_update), - _knot_entity(NULL) + _knot_entity(nullptr) { knot_shape = SP_KNOT_SHAPE_DIAMOND; knot_mode = SP_KNOT_MODE_XOR; @@ -185,7 +185,7 @@ PointParam::set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint class PointParamKnotHolderEntity : public KnotHolderEntity { public: PointParamKnotHolderEntity(PointParam *p) { this->pparam = p; } - ~PointParamKnotHolderEntity() override { this->pparam->_knot_entity = NULL;} + ~PointParamKnotHolderEntity() override { this->pparam->_knot_entity = nullptr;} void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) override; Geom::Point knot_get() const override; @@ -239,7 +239,7 @@ PointParam::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { _knot_entity = new PointParamKnotHolderEntity(this); // TODO: can we ditch handleTip() etc. because we have access to handle_tip etc. itself??? - _knot_entity->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), knot_shape, knot_mode, knot_color); + _knot_entity->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), knot_shape, knot_mode, knot_color); knotholder->add(_knot_entity); } diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index 4f93b5354..7c620f502 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -29,7 +29,7 @@ public: const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, - const gchar *handle_tip = NULL,// tip for automatically associated on-canvas handle + const gchar *handle_tip = nullptr,// tip for automatically associated on-canvas handle Geom::Point default_value = Geom::Point(0,0), bool live_update = true ); ~PointParam() override; diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp index cf4adc5fd..0857deab5 100644 --- a/src/live_effects/parameter/powerstrokepointarray.cpp +++ b/src/live_effects/parameter/powerstrokepointarray.cpp @@ -39,7 +39,7 @@ PowerStrokePointArrayParam::~PowerStrokePointArrayParam() Gtk::Widget * PowerStrokePointArrayParam::param_newWidget() { - return NULL; + return nullptr; } void PowerStrokePointArrayParam::param_transform_multiply(Geom::Affine const &postmul, bool /*set*/) @@ -280,7 +280,7 @@ void PowerStrokePointArrayParam::addKnotHolderEntities(KnotHolder *knotholder, S { for (unsigned int i = 0; i < _vector.size(); ++i) { PowerStrokePointArrayParamKnotHolderEntity *e = new PowerStrokePointArrayParamKnotHolderEntity(this, i); - e->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + e->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _("<b>Stroke width control point</b>: drag to alter the stroke width. <b>Ctrl+click</b> adds a control point, <b>Ctrl+Alt+click</b> deletes it, <b>Shift+click</b> launches width dialog."), knot_shape, knot_mode, knot_color); knotholder->add(e); diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp index c6f5492d1..10ad0df45 100644 --- a/src/live_effects/parameter/satellitesarray.cpp +++ b/src/live_effects/parameter/satellitesarray.cpp @@ -26,7 +26,7 @@ SatellitesArrayParam::SatellitesArrayParam(const Glib::ustring &label, const Glib::ustring &key, Inkscape::UI::Widget::Registry *wr, Effect *effect) - : ArrayParam<std::vector<Satellite> >(label, tip, key, wr, effect, 0), _knoth(NULL) + : ArrayParam<std::vector<Satellite> >(label, tip, key, wr, effect, 0), _knoth(nullptr) { _knot_shape = SP_KNOT_SHAPE_DIAMOND; _knot_mode = SP_KNOT_MODE_XOR; @@ -36,7 +36,7 @@ SatellitesArrayParam::SatellitesArrayParam(const Glib::ustring &label, _global_knot_hide = false; _current_zoom = 0; _effectType = FILLET_CHAMFER; - _last_pathvector_satellites = NULL; + _last_pathvector_satellites = nullptr; param_widget_is_visible(false); } @@ -269,7 +269,7 @@ void SatellitesArrayParam::addKnotHolderEntities(KnotHolder *knotholder, "<b>Ctrl+Alt+Click</b> reset"); } FilletChamferKnotHolderEntity *e = new FilletChamferKnotHolderEntity(this, index); - e->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _(tip),_knot_shape, _knot_mode, _knot_color); + e->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _(tip),_knot_shape, _knot_mode, _knot_color); knotholder->add(e); } index++; diff --git a/src/live_effects/parameter/satellitesarray.h b/src/live_effects/parameter/satellitesarray.h index 30e196e41..005ea63ff 100644 --- a/src/live_effects/parameter/satellitesarray.h +++ b/src/live_effects/parameter/satellitesarray.h @@ -38,7 +38,7 @@ public: Gtk::Widget *param_newWidget() override { - return NULL; + return nullptr; } virtual void setHelperSize(int hs); void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) override; @@ -87,7 +87,7 @@ public: FilletChamferKnotHolderEntity(SatellitesArrayParam *p, size_t index); ~FilletChamferKnotHolderEntity() override { - _pparam->_knoth = NULL; + _pparam->_knoth = nullptr; } void knot_set(Geom::Point const &p, Geom::Point const &origin, diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h index cd1176bc2..fda470638 100644 --- a/src/live_effects/parameter/text.h +++ b/src/live_effects/parameter/text.h @@ -73,9 +73,9 @@ private: class TextParamInternal : public TextParam { public: TextParamInternal(Effect* effect) : - TextParam("", "", "", NULL, effect) {} + TextParam("", "", "", nullptr, effect) {} - Gtk::Widget * param_newWidget() override { return NULL; } + Gtk::Widget * param_newWidget() override { return nullptr; } }; } //namespace LivePathEffect diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index bb9d9a90e..b5f7f5998 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -29,7 +29,7 @@ ToggleButtonParam::ToggleButtonParam( const Glib::ustring& label, const Glib::us : Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value), inactive_label(inactive_label), _icon_active(_icon_active), _icon_inactive(_icon_inactive), _icon_size(_icon_size) { - checkwdg = NULL; + checkwdg = nullptr; } ToggleButtonParam::~ToggleButtonParam() @@ -107,7 +107,7 @@ ToggleButtonParam::param_newWidget() _icon_inactive = _icon_active; } gtk_widget_show(box_button); - GtkWidget *icon_button = NULL; + GtkWidget *icon_button = nullptr; if(!value){ icon_button = gtk_image_new_from_icon_name(_icon_inactive, _icon_size); } else { @@ -156,7 +156,7 @@ ToggleButtonParam::refresh_button() } } if ( _icon_active ) { - GdkPixbuf * icon_pixbuf = NULL; + GdkPixbuf * icon_pixbuf = nullptr; Gtk::Image *im = dynamic_cast<Gtk::Image*>(children[0]); Gtk::IconSize is(_icon_size); if (!im) return; diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h index 7476698f5..29ee72203 100644 --- a/src/live_effects/parameter/togglebutton.h +++ b/src/live_effects/parameter/togglebutton.h @@ -31,8 +31,8 @@ public: Effect* effect, bool default_value = false, const Glib::ustring& inactive_label = "", - char const * icon_active = NULL, - char const * icon_inactive = NULL, + char const * icon_active = nullptr, + char const * icon_inactive = nullptr, GtkIconSize icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR); ~ToggleButtonParam() override; diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp index 56895276c..8018ed618 100644 --- a/src/live_effects/parameter/vector.cpp +++ b/src/live_effects/parameter/vector.cpp @@ -216,11 +216,11 @@ void VectorParam::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) { VectorParamKnotHolderEntity_Origin *origin_e = new VectorParamKnotHolderEntity_Origin(this); - origin_e->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), ori_knot_shape, ori_knot_mode, ori_knot_color); + origin_e->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), ori_knot_shape, ori_knot_mode, ori_knot_color); knotholder->add(origin_e); VectorParamKnotHolderEntity_Vector *vector_e = new VectorParamKnotHolderEntity_Vector(this); - vector_e->create(NULL, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), vec_knot_shape, vec_knot_mode, vec_knot_color); + vector_e->create(nullptr, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), vec_knot_shape, vec_knot_mode, vec_knot_color); knotholder->add(vector_e); } diff --git a/src/main-cmdlineact.cpp b/src/main-cmdlineact.cpp index 4c4cf5f9a..6b97616dd 100644 --- a/src/main-cmdlineact.cpp +++ b/src/main-cmdlineact.cpp @@ -28,8 +28,8 @@ namespace Inkscape { std::list <CmdLineAction *> CmdLineAction::_list; -CmdLineAction::CmdLineAction (bool isVerb, gchar const * arg) : _isVerb(isVerb), _arg(NULL) { - if (arg != NULL) { +CmdLineAction::CmdLineAction (bool isVerb, gchar const * arg) : _isVerb(isVerb), _arg(nullptr) { + if (arg != nullptr) { _arg = g_strdup(arg); } @@ -39,7 +39,7 @@ CmdLineAction::CmdLineAction (bool isVerb, gchar const * arg) : _isVerb(isVerb), } CmdLineAction::~CmdLineAction () { - if (_arg != NULL) { + if (_arg != nullptr) { g_free(_arg); } } @@ -66,18 +66,18 @@ CmdLineAction::doIt (ActionContext const & context) { } Inkscape::Verb * verb = Inkscape::Verb::getbyid(_arg); - if (verb == NULL) { + if (verb == nullptr) { printf(_("Unable to find verb ID '%s' specified on the command line.\n"), _arg); return; } SPAction * action = verb->get_action(context); - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); } else { - if (context.getDocument() == NULL || context.getSelection() == NULL) { return; } + if (context.getDocument() == nullptr || context.getSelection() == nullptr) { return; } SPDocument * doc = context.getDocument(); SPObject * obj = doc->getObjectById(_arg); - if (obj == NULL) { + if (obj == nullptr) { printf(_("Unable to find node ID: '%s'\n"), _arg); return; } diff --git a/src/main-cmdlinexact.cpp b/src/main-cmdlinexact.cpp index fe4d52220..a407d3c0e 100644 --- a/src/main-cmdlinexact.cpp +++ b/src/main-cmdlinexact.cpp @@ -143,12 +143,12 @@ void xFileOpen( const Glib::ustring &uri ) Inkscape::DocumentUndo::clearUndo(old_document); } - SPDocument *doc = NULL; - Inkscape::Extension::Extension *key = NULL; + SPDocument *doc = nullptr; + Inkscape::Extension::Extension *key = nullptr; try { doc = Inkscape::Extension::open(key, document_filename.c_str()); } catch (std::exception &e) { - doc = NULL; + doc = nullptr; std::string exeption_mgs = e.what(); printf("Error: open %s:%s\n",document_filename.c_str(), exeption_mgs.c_str() ); fflush(stdout); @@ -240,12 +240,12 @@ void xFileExportPNG( Inkscape::ActionContext const & context, const Glib::ustrin ExportResult status = sp_export_png_file(doc, document_filename.c_str(), Geom::Rect(Geom::Point(0,0), Geom::Point(width, height)), png_width, png_height, dpi, dpi, - nv->pagecolor, 0, 0, TRUE); + nv->pagecolor, nullptr, nullptr, TRUE); } void xSelectElement( Inkscape::ActionContext const & context, const Glib::ustring &element_name ) { - if (context.getDocument() == NULL || context.getSelection() == NULL) { + if (context.getDocument() == nullptr || context.getSelection() == nullptr) { return; } @@ -257,7 +257,7 @@ void xSelectElement( Inkscape::ActionContext const & context, const Glib::ustrin SPDocument * doc = context.getDocument(); SPObject * obj = doc->getObjectById(element_name); - if (obj == NULL) { + if (obj == nullptr) { printf(_("Unable to find node ID: '%s'\n"), element_name.c_str()); fflush(stdout); return; @@ -326,7 +326,7 @@ parseVerbsYAMLFile(gchar const *yaml_filename) verbs_list_t verbs_list; FILE *fh = g_fopen(yaml_filename, "r"); - if(fh == NULL) { + if(fh == nullptr) { printf("Failed to read from file %s\n", yaml_filename); fflush(stdout); @@ -555,7 +555,7 @@ CmdLineXAction::createActionsFromYAML( gchar const *yaml_filename ) ++undo_counter; new CmdLineAction(true, verb.args[0].c_str()); } - else if( Verb::getbyid(verb.args[0].c_str()) != NULL ) + else if( Verb::getbyid(verb.args[0].c_str()) != nullptr ) { ++undo_counter; new CmdLineAction(true, verb.args[0].c_str()); diff --git a/src/main.cpp b/src/main.cpp index fbef39711..ee5735e02 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -194,32 +194,32 @@ static void do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const a static void do_query_all (SPDocument *doc); static void do_query_all_recurse (SPObject *o); -static gchar *sp_global_printer = NULL; -static gchar *sp_export_png = NULL; -static gchar *sp_export_dpi = NULL; -static gchar *sp_export_area = NULL; +static gchar *sp_global_printer = nullptr; +static gchar *sp_export_png = nullptr; +static gchar *sp_export_dpi = nullptr; +static gchar *sp_export_area = nullptr; static gboolean sp_export_area_drawing = FALSE; static gboolean sp_export_area_page = FALSE; -static gchar *sp_export_margin = NULL; +static gchar *sp_export_margin = nullptr; static gboolean sp_export_latex = FALSE; -static gchar *sp_export_width = NULL; -static gchar *sp_export_height = NULL; -static gchar *sp_export_id = NULL; -static gchar *sp_export_background = NULL; -static gchar *sp_export_background_opacity = NULL; +static gchar *sp_export_width = nullptr; +static gchar *sp_export_height = nullptr; +static gchar *sp_export_id = nullptr; +static gchar *sp_export_background = nullptr; +static gchar *sp_export_background_opacity = nullptr; static gboolean sp_export_area_snap = FALSE; static gboolean sp_export_use_hints = FALSE; static gboolean sp_export_id_only = FALSE; -static gchar *sp_export_svg = NULL; -static gchar *sp_export_inkscape_svg = NULL; -static gchar *sp_export_ps = NULL; -static gchar *sp_export_eps = NULL; +static gchar *sp_export_svg = nullptr; +static gchar *sp_export_inkscape_svg = nullptr; +static gchar *sp_export_ps = nullptr; +static gchar *sp_export_eps = nullptr; static gint sp_export_ps_level = 3; -static gchar *sp_export_pdf = NULL; -static gchar *sp_export_pdf_version = NULL; -static gchar *sp_export_emf = NULL; -static gchar *sp_export_wmf = NULL; -static gchar *sp_export_xaml = NULL; +static gchar *sp_export_pdf = nullptr; +static gchar *sp_export_pdf_version = nullptr; +static gchar *sp_export_emf = nullptr; +static gchar *sp_export_wmf = nullptr; +static gchar *sp_export_xaml = nullptr; static gboolean sp_export_text_to_path = FALSE; static gboolean sp_export_ignore_filters = FALSE; static gboolean sp_export_font = FALSE; @@ -228,53 +228,53 @@ static gboolean sp_query_y = FALSE; static gboolean sp_query_width = FALSE; static gboolean sp_query_height = FALSE; static gboolean sp_query_all = FALSE; -static gchar *sp_query_id = NULL; +static gchar *sp_query_id = nullptr; static gboolean sp_shell = FALSE; static gboolean sp_vacuum_defs = FALSE; #ifdef WITH_DBUS static gboolean sp_dbus_listen = FALSE; static gchar *sp_dbus_name = NULL; #endif // WITH_DBUS -static gchar *sp_export_png_utf8 = NULL; -static gchar *sp_export_svg_utf8 = NULL; -static gchar *sp_export_inkscape_svg_utf8 = NULL; -static gchar *sp_global_printer_utf8 = NULL; +static gchar *sp_export_png_utf8 = nullptr; +static gchar *sp_export_svg_utf8 = nullptr; +static gchar *sp_export_inkscape_svg_utf8 = nullptr; +static gchar *sp_global_printer_utf8 = nullptr; #ifdef WITH_YAML -static gchar *sp_xverbs_yaml_utf8 = NULL; -static gchar *sp_xverbs_yaml = NULL; +static gchar *sp_xverbs_yaml_utf8 = nullptr; +static gchar *sp_xverbs_yaml = nullptr; #endif // WITH_YAML /** * Reset variables to default values. */ static void resetCommandlineGlobals() { - sp_global_printer = NULL; - sp_export_png = NULL; - sp_export_dpi = NULL; - sp_export_area = NULL; + sp_global_printer = nullptr; + sp_export_png = nullptr; + sp_export_dpi = nullptr; + sp_export_area = nullptr; sp_export_area_drawing = FALSE; sp_export_area_page = FALSE; - sp_export_margin = NULL; + sp_export_margin = nullptr; sp_export_latex = FALSE; - sp_export_width = NULL; - sp_export_height = NULL; - sp_export_id = NULL; - sp_export_background = NULL; - sp_export_background_opacity = NULL; + sp_export_width = nullptr; + sp_export_height = nullptr; + sp_export_id = nullptr; + sp_export_background = nullptr; + sp_export_background_opacity = nullptr; sp_export_area_snap = FALSE; sp_export_use_hints = FALSE; sp_export_id_only = FALSE; - sp_export_svg = NULL; - sp_export_inkscape_svg = NULL; - sp_export_ps = NULL; - sp_export_eps = NULL; + sp_export_svg = nullptr; + sp_export_inkscape_svg = nullptr; + sp_export_ps = nullptr; + sp_export_eps = nullptr; sp_export_ps_level = 3; - sp_export_pdf = NULL; - sp_export_pdf_version = NULL; - sp_export_emf = NULL; - sp_export_wmf = NULL; - sp_export_xaml = NULL; + sp_export_pdf = nullptr; + sp_export_pdf_version = nullptr; + sp_export_emf = nullptr; + sp_export_wmf = nullptr; + sp_export_xaml = nullptr; sp_export_text_to_path = FALSE; sp_export_ignore_filters = FALSE; sp_export_font = FALSE; @@ -283,7 +283,7 @@ static void resetCommandlineGlobals() { sp_query_width = FALSE; sp_query_height = FALSE; sp_query_all = FALSE; - sp_query_id = NULL; + sp_query_id = nullptr; sp_vacuum_defs = FALSE; sp_no_convert_text_baseline_spacing = FALSE; sp_file_convert_dpi_method_commandline = -1; @@ -292,10 +292,10 @@ static void resetCommandlineGlobals() { sp_dbus_name = NULL; #endif // WITH_DBUS - sp_export_png_utf8 = NULL; - sp_export_svg_utf8 = NULL; - sp_export_inkscape_svg_utf8 = NULL; - sp_global_printer_utf8 = NULL; + sp_export_png_utf8 = nullptr; + sp_export_svg_utf8 = nullptr; + sp_export_inkscape_svg_utf8 = nullptr; + sp_global_printer_utf8 = nullptr; } #ifdef WIN32 @@ -304,22 +304,22 @@ static bool replaceArgs( int& argc, char**& argv ); static std::vector<gchar *> sp_process_args(poptContext ctx); struct poptOption options[] = { {"version", 'V', - POPT_ARG_NONE, NULL, SP_ARG_VERSION, + POPT_ARG_NONE, nullptr, SP_ARG_VERSION, N_("Print the Inkscape version number"), - NULL}, + nullptr}, {"without-gui", 'z', - POPT_ARG_NONE, NULL, SP_ARG_NOGUI, + POPT_ARG_NONE, nullptr, SP_ARG_NOGUI, N_("Do not use X server (only process files from console)"), - NULL}, + nullptr}, {"with-gui", 'g', - POPT_ARG_NONE, NULL, SP_ARG_GUI, + POPT_ARG_NONE, nullptr, SP_ARG_GUI, N_("Try to use X server (even if $DISPLAY is not set)"), - NULL}, + nullptr}, {"file", 'f', - POPT_ARG_STRING, NULL, SP_ARG_FILE, + POPT_ARG_STRING, nullptr, SP_ARG_FILE, N_("Open specified document(s) (option string may be excluded)"), N_("FILENAME")}, #ifdef WITH_YAML @@ -351,12 +351,12 @@ struct poptOption options[] = { {"export-area-drawing", 'D', POPT_ARG_NONE, &sp_export_area_drawing, SP_ARG_EXPORT_AREA_DRAWING, N_("Exported area is the entire drawing (not page)"), - NULL}, + nullptr}, {"export-area-page", 'C', POPT_ARG_NONE, &sp_export_area_page, SP_ARG_EXPORT_AREA_PAGE, N_("Exported area is the entire page"), - NULL}, + nullptr}, {"export-margin", 0, POPT_ARG_STRING, &sp_export_margin, SP_ARG_EXPORT_MARGIN, @@ -366,7 +366,7 @@ struct poptOption options[] = { {"export-area-snap", 0, POPT_ARG_NONE, &sp_export_area_snap, SP_ARG_EXPORT_AREA_SNAP, N_("Snap the bitmap export area outwards to the nearest integer values (in SVG user units)"), - NULL}, + nullptr}, {"export-width", 'w', POPT_ARG_STRING, &sp_export_width, SP_ARG_EXPORT_WIDTH, @@ -388,12 +388,12 @@ struct poptOption options[] = { // TRANSLATORS: this means: "Only export the object whose id is given in --export-id". // See "man inkscape" for details. N_("Export just the object with export-id, hide all others (only with export-id)"), - NULL}, + nullptr}, {"export-use-hints", 't', POPT_ARG_NONE, &sp_export_use_hints, SP_ARG_EXPORT_USE_HINTS, N_("Use stored filename and DPI hints when exporting (only with export-id)"), - NULL}, + nullptr}, {"export-background", 'b', POPT_ARG_STRING, &sp_export_background, SP_ARG_EXPORT_BACKGROUND, @@ -444,7 +444,7 @@ struct poptOption options[] = { {"export-latex", 0, POPT_ARG_NONE, &sp_export_latex, SP_ARG_EXPORT_LATEX, N_("Export PDF/PS/EPS without text. Besides the PDF/PS/EPS, a LaTeX file is exported, putting the text on top of the PDF/PS/EPS file. Include the result in LaTeX like: \\input{latexfile.tex}"), - NULL}, + nullptr}, {"export-emf", 'M', POPT_ARG_STRING, &sp_export_emf, SP_ARG_EXPORT_EMF, @@ -464,41 +464,41 @@ struct poptOption options[] = { {"export-text-to-path", 'T', POPT_ARG_NONE, &sp_export_text_to_path, SP_ARG_EXPORT_TEXT_TO_PATH, N_("Convert text object to paths on export (PS, EPS, PDF, SVG)"), - NULL}, + nullptr}, {"export-ignore-filters", 0, POPT_ARG_NONE, &sp_export_ignore_filters, SP_ARG_EXPORT_IGNORE_FILTERS, N_("Render filtered objects without filters, instead of rasterizing (PS, EPS, PDF)"), - NULL}, + nullptr}, {"query-x", 'X', POPT_ARG_NONE, &sp_query_x, SP_ARG_QUERY_X, // TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help" N_("Query the X coordinate of the drawing or, if specified, of the object with --query-id"), - NULL}, + nullptr}, {"query-y", 'Y', POPT_ARG_NONE, &sp_query_y, SP_ARG_QUERY_Y, // TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help" N_("Query the Y coordinate of the drawing or, if specified, of the object with --query-id"), - NULL}, + nullptr}, {"query-width", 'W', POPT_ARG_NONE, &sp_query_width, SP_ARG_QUERY_WIDTH, // TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help" N_("Query the width of the drawing or, if specified, of the object with --query-id"), - NULL}, + nullptr}, {"query-height", 'H', POPT_ARG_NONE, &sp_query_height, SP_ARG_QUERY_HEIGHT, // TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help" N_("Query the height of the drawing or, if specified, of the object with --query-id"), - NULL}, + nullptr}, {"query-all", 'S', POPT_ARG_NONE, &sp_query_all, SP_ARG_QUERY_ALL, N_("List id,x,y,w,h for all objects"), - NULL}, + nullptr}, {"query-id", 'I', POPT_ARG_STRING, &sp_query_id, SP_ARG_QUERY_ID, @@ -506,15 +506,15 @@ struct poptOption options[] = { N_("ID")}, {"extension-directory", 'x', - POPT_ARG_NONE, NULL, SP_ARG_EXTENSIONDIR, + POPT_ARG_NONE, nullptr, SP_ARG_EXTENSIONDIR, // TRANSLATORS: this option makes Inkscape print the name (path) of the extension directory N_("Print out the extension directory and exit"), - NULL}, + nullptr}, {"vacuum-defs", 0, POPT_ARG_NONE, &sp_vacuum_defs, SP_ARG_VACUUM_DEFS, N_("Remove unused definitions from the defs section(s) of the document"), - NULL}, + nullptr}, #ifdef WITH_DBUS {"dbus-listen", 0, @@ -529,32 +529,32 @@ struct poptOption options[] = { #endif // WITH_DBUS {"verb-list", 0, - POPT_ARG_NONE, NULL, SP_ARG_VERB_LIST, + POPT_ARG_NONE, nullptr, SP_ARG_VERB_LIST, N_("List the IDs of all the verbs in Inkscape"), - NULL}, + nullptr}, {"verb", 0, - POPT_ARG_STRING, NULL, SP_ARG_VERB, + POPT_ARG_STRING, nullptr, SP_ARG_VERB, N_("Verb to call when Inkscape opens."), N_("VERB-ID")}, {"select", 0, - POPT_ARG_STRING, NULL, SP_ARG_SELECT, + POPT_ARG_STRING, nullptr, SP_ARG_SELECT, N_("Object ID to select when Inkscape opens."), N_("OBJECT-ID")}, {"shell", 0, POPT_ARG_NONE, &sp_shell, SP_ARG_SHELL, N_("Start Inkscape in interactive shell mode."), - NULL}, + nullptr}, {"no-convert-text-baseline-spacing", 0, POPT_ARG_NONE, &sp_no_convert_text_baseline_spacing, SP_ARG_NO_CONVERT_TEXT_BASELINE_SPACING, N_("Do not fix legacy (pre-0.92) files' text baseline spacing on opening."), - NULL}, + nullptr}, {"convert-dpi-method", 0, - POPT_ARG_STRING, NULL, SP_ARG_CONVERT_DPI_METHOD, + POPT_ARG_STRING, nullptr, SP_ARG_CONVERT_DPI_METHOD, N_("Method used to convert pre-.92 document dpi, if needed. ([none|scale-viewbox|scale-document])"), "[...]"}, @@ -682,7 +682,7 @@ main(int argc, char **argv) gboolean use_gui; #if !defined(WIN32) && !defined(GDK_WINDOWING_QUARTZ) - use_gui = (g_getenv("DISPLAY") != NULL); + use_gui = (g_getenv("DISPLAY") != nullptr); #else use_gui = TRUE; #endif @@ -765,8 +765,8 @@ main(int argc, char **argv) static void fixupSingleFilename( gchar **orig, gchar **spare ) { if ( orig && *orig && **orig ) { - GError *error = NULL; - gchar *newFileName = Inkscape::IO::locale_to_utf8_fallback(*orig, -1, NULL, NULL, &error); + GError *error = nullptr; + gchar *newFileName = Inkscape::IO::locale_to_utf8_fallback(*orig, -1, nullptr, nullptr, &error); if ( newFileName ) { *orig = newFileName; @@ -784,7 +784,7 @@ static void fixupFilenameEncoding( std::vector<gchar*> &filenames) { for (unsigned int i=0; i<filenames.size(); ++i) { gchar *fn = filenames[i]; - gchar *newFileName = Inkscape::IO::locale_to_utf8_fallback(fn, -1, NULL, NULL, NULL); + gchar *newFileName = Inkscape::IO::locale_to_utf8_fallback(fn, -1, nullptr, nullptr, nullptr); if ( newFileName ) { g_free( fn ); filenames[i] = newFileName; @@ -799,9 +799,9 @@ static int sp_common_main( int argc, char const **argv, std::vector<gchar*> *flD Inkscape::bind_textdomain_codeset_console(); #endif - poptContext ctx = poptGetContext(NULL, argc, argv, options, 0); + poptContext ctx = poptGetContext(nullptr, argc, argv, options, 0); poptSetOtherOptionHelp(ctx, _("[OPTIONS...] [FILE...]\n\nAvailable options:")); - g_return_val_if_fail(ctx != NULL, 1); + g_return_val_if_fail(ctx != nullptr, 1); /* Collect own arguments */ std::vector<gchar*> fl = sp_process_args(ctx); @@ -867,7 +867,7 @@ namespace Inkscape { namespace UI { namespace Tools { -guint get_latin_keyval(GdkEventKey const* event, guint *consumed_modifiers = NULL); +guint get_latin_keyval(GdkEventKey const* event, guint *consumed_modifiers = nullptr); } } @@ -960,7 +960,7 @@ sp_main_gui(int argc, char const **argv) int retVal = sp_common_main( argc, argv, &fl ); g_return_val_if_fail(retVal == 0, 1); - gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); + gdk_event_handler_set((GdkEventFunc)snooper, nullptr, nullptr); Inkscape::Debug::log_display_config(); // Set default window icon. Obeys the theme. @@ -973,7 +973,7 @@ sp_main_gui(int argc, char const **argv) Inkscape::Application::create(argv[0], true); for (auto i:fl) { - if (sp_file_open(i,NULL)) { + if (sp_file_open(i,nullptr)) { create_new=false; } } @@ -1011,25 +1011,25 @@ static int sp_process_file_list(std::vector<gchar*> fl) for (auto filename:fl) { - SPDocument *doc = NULL; + SPDocument *doc = nullptr; try { - doc = Inkscape::Extension::open(NULL, filename); + doc = Inkscape::Extension::open(nullptr, filename); } catch (Inkscape::Extension::Input::no_extension_found &e) { - doc = NULL; + doc = nullptr; } catch (Inkscape::Extension::Input::open_failed &e) { - doc = NULL; + doc = nullptr; } - if (doc == NULL) { + if (doc == nullptr) { try { doc = Inkscape::Extension::open(Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), filename); } catch (Inkscape::Extension::Input::no_extension_found &e) { - doc = NULL; + doc = nullptr; } catch (Inkscape::Extension::Input::open_failed &e) { - doc = NULL; + doc = nullptr; } } - if (doc == NULL) { + if (doc == nullptr) { g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename); retVal++; } else { @@ -1118,7 +1118,7 @@ static int sp_main_shell(char const* command_name) fprintf(stdout, "Inkscape %s interactive shell mode. Type 'quit' to quit.\n", Inkscape::version_string); fflush(stdout); - char* linedata = 0; + char* linedata = nullptr; do { fprintf(stdout, ">"); fflush(stdout); @@ -1142,15 +1142,15 @@ static int sp_main_shell(char const* command_name) if ( strcmp(useme, "quit") == 0 ) { // Time to quit fflush(stdout); - linedata = 0; // mark for exit + linedata = nullptr; // mark for exit } else if ( len < 1 ) { // blank string. Do nothing. } else { - GError* parseError = 0; - gchar** argv = 0; + GError* parseError = nullptr; + gchar** argv = nullptr; gint argc = 0; if ( g_shell_parse_argv(command_line, &argc, &argv, &parseError) ) { - poptContext ctx = poptGetContext(NULL, argc, const_cast<const gchar**>(argv), options, 0); + poptContext ctx = poptGetContext(nullptr, argc, const_cast<const gchar**>(argv), options, 0); poptSetOtherOptionHelp(ctx, _("[OPTIONS...] [FILE...]\n\nAvailable options:")); if ( ctx ) { std::vector<gchar *> fl = sp_process_args(ctx); @@ -1223,7 +1223,7 @@ int sp_main_console(int argc, char const **argv) static void do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const gchar *id) { - SPObject *o = NULL; + SPObject *o = nullptr; if (id) { o = doc->getObjectById(id); @@ -1313,8 +1313,8 @@ static int do_export_png(SPDocument *doc) Geom::Rect area; if (sp_export_id || sp_export_area_drawing) { - SPObject *o = NULL; - SPObject *o_area = NULL; + SPObject *o = nullptr; + SPObject *o_area = nullptr; if (sp_export_id && sp_export_area_drawing) { o = doc->getObjectById(sp_export_id); o_area = doc->getRoot(); @@ -1431,7 +1431,7 @@ static int do_export_png(SPDocument *doc) if (sp_export_width) { errno=0; - width = strtoul(sp_export_width, NULL, 0); + width = strtoul(sp_export_width, nullptr, 0); if ((width < 1) || (width > PNG_UINT_31_MAX) || (errno == ERANGE) ) { g_warning("Export width %lu out of range (1 - %lu). Nothing exported.", width, (unsigned long int)PNG_UINT_31_MAX); return 1; @@ -1441,7 +1441,7 @@ static int do_export_png(SPDocument *doc) if (sp_export_height) { errno=0; - height = strtoul(sp_export_height, NULL, 0); + height = strtoul(sp_export_height, nullptr, 0); if ((height < 1) || (height > PNG_UINT_31_MAX)) { g_warning("Export height %lu out of range (1 - %lu). Nothing exported.", height, (unsigned long int)PNG_UINT_31_MAX); return 1; @@ -1520,7 +1520,7 @@ static int do_export_png(SPDocument *doc) if ((width >= 1) && (height >= 1) && (width <= PNG_UINT_31_MAX) && (height <= PNG_UINT_31_MAX)) { if( sp_export_png_file(doc, path.c_str(), area, width, height, dpi, - dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : std::vector<SPItem*>()) == 1 ) { + dpi, bgcolor, nullptr, nullptr, true, sp_export_id_only ? items : std::vector<SPItem*>()) == 1 ) { g_print("Bitmap saved as: %s\n", filename.c_str()); } else { g_warning("Bitmap failed to save to: %s", filename.c_str()); @@ -1564,11 +1564,11 @@ static int do_export_svg(SPDocument* doc) } if (sp_export_margin) { - gdouble margin = g_ascii_strtod(sp_export_margin, NULL); + gdouble margin = g_ascii_strtod(sp_export_margin, nullptr); doc->ensureUpToDate(); SPNamedView *nv; Inkscape::XML::Node *nv_repr; - if ((nv = sp_document_namedview(doc, 0)) && (nv_repr = nv->getRepr())) { + if ((nv = sp_document_namedview(doc, nullptr)) && (nv_repr = nv->getRepr())) { sp_repr_set_svg_double(nv_repr, "fit-margin-top", margin); sp_repr_set_svg_double(nv_repr, "fit-margin-left", margin); sp_repr_set_svg_double(nv_repr, "fit-margin-right", margin); @@ -1642,7 +1642,7 @@ static int do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime) if (sp_export_id) { SPObject *o = doc->getObjectById(sp_export_id); - if (o == NULL) { + if (o == nullptr) { g_warning("Object with id=\"%s\" was not found in the document. Nothing exported.", sp_export_id); return 1; } @@ -1704,7 +1704,7 @@ static int do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime) // if no bleed/margin is given, set to 0 (otherwise it takes the value last used from the UI) float margin = 0.; if (sp_export_margin) { - margin = g_ascii_strtod(sp_export_margin, NULL); + margin = g_ascii_strtod(sp_export_margin, nullptr); } (*i)->set_param_float("bleed", margin); @@ -2140,7 +2140,7 @@ sp_process_args(poptContext ctx) switch (a) { case SP_ARG_FILE: { gchar const *fn = poptGetOptArg(ctx); - if (fn != NULL) { + if (fn != nullptr) { fl.push_back(g_strdup(fn)); } break; @@ -2148,7 +2148,7 @@ sp_process_args(poptContext ctx) #ifdef WITH_YAML case SP_ARG_XVERBS: { gchar const *fn = poptGetOptArg(ctx); - if (fn != NULL) { + if (fn != nullptr) { sp_xverbs_yaml = g_strdup(fn); Inkscape::CmdLineXAction::createActionsFromYAML((const char *)sp_xverbs_yaml); } @@ -2178,7 +2178,7 @@ sp_process_args(poptContext ctx) case SP_ARG_VERB: case SP_ARG_SELECT: { gchar const *arg = poptGetOptArg(ctx); - if (arg != NULL) { + if (arg != nullptr) { // printf("Adding in: %s\n", arg); new Inkscape::CmdLineAction((a == SP_ARG_VERB), arg); } @@ -2186,7 +2186,7 @@ sp_process_args(poptContext ctx) } case SP_ARG_CONVERT_DPI_METHOD: { gchar const *arg = poptGetOptArg(ctx); - if (arg != NULL) { + if (arg != nullptr) { if (!strcmp(arg,"none")) { sp_file_convert_dpi_method_commandline = FILE_DPI_UNCHANGED; } else if (!strcmp(arg,"scale-viewbox")) { @@ -2211,8 +2211,8 @@ sp_process_args(poptContext ctx) } gchar const ** const args = poptGetArgs(ctx); - if (args != NULL) { - for (unsigned i = 0; args[i] != NULL; i++) { + if (args != nullptr) { + for (unsigned i = 0; args[i] != nullptr; i++) { fl.push_back(g_strdup(args[i])); } } diff --git a/src/message-context.cpp b/src/message-context.cpp index 2c07f4a43..160a060bb 100644 --- a/src/message-context.cpp +++ b/src/message-context.cpp @@ -24,7 +24,7 @@ MessageContext::MessageContext(MessageStack *stack) MessageContext::~MessageContext() { clear(); GC::release(_stack); - _stack = NULL; + _stack = nullptr; } void MessageContext::set(MessageType type, gchar const *message) { diff --git a/src/message-stack.cpp b/src/message-stack.cpp index 70b2fb42d..fdc08f4aa 100644 --- a/src/message-stack.cpp +++ b/src/message-stack.cpp @@ -17,7 +17,7 @@ namespace Inkscape { MessageStack::MessageStack() -: _messages(NULL), _next_id(1) +: _messages(nullptr), _next_id(1) { } @@ -136,8 +136,8 @@ MessageStack::Message *MessageStack::_discard(MessageStack::Message *m) m->timeout_id = 0; } g_free(m->message); - m->message = NULL; - m->stack = NULL; + m->message = nullptr; + m->stack = nullptr; delete m; return next; } @@ -146,7 +146,7 @@ void MessageStack::_emitChanged() { if (_messages) { _changed_signal.emit(_messages->type, _messages->message); } else { - _changed_signal.emit(NORMAL_MESSAGE, NULL); + _changed_signal.emit(NORMAL_MESSAGE, nullptr); } } diff --git a/src/message-stack.h b/src/message-stack.h index 64d42033a..31842af70 100644 --- a/src/message-stack.h +++ b/src/message-stack.h @@ -63,7 +63,7 @@ public: * the stack */ char const *currentMessage() { - return _messages ? _messages->message : NULL; + return _messages ? _messages->message : nullptr; } /** @brief connects to the "changed" signal which is emitted whenever diff --git a/src/number-opt-number.h b/src/number-opt-number.h index f6fe584f9..00b354d72 100644 --- a/src/number-opt-number.h +++ b/src/number-opt-number.h @@ -99,14 +99,14 @@ public: char **values = g_strsplit(str, " ", 2); - if( values[0] != NULL ) + if( values[0] != nullptr ) { - number = g_ascii_strtod(values[0], NULL); + number = g_ascii_strtod(values[0], nullptr); _set = TRUE; - if( values[1] != NULL ) + if( values[1] != nullptr ) { - optNumber = g_ascii_strtod(values[1], NULL); + optNumber = g_ascii_strtod(values[1], nullptr); optNumber_set = TRUE; } else diff --git a/src/object-hierarchy.cpp b/src/object-hierarchy.cpp index 15afbb59d..4d6acd578 100644 --- a/src/object-hierarchy.cpp +++ b/src/object-hierarchy.cpp @@ -29,11 +29,11 @@ ObjectHierarchy::~ObjectHierarchy() { void ObjectHierarchy::clear() { _clear(); - _changed_signal.emit(NULL, NULL); + _changed_signal.emit(nullptr, nullptr); } void ObjectHierarchy::setTop(SPObject *object) { - if (object == NULL) { printf("Assertion object != NULL failed\n"); return; } + if (object == nullptr) { printf("Assertion object != NULL failed\n"); return; } if ( top() == object ) { return; @@ -74,16 +74,16 @@ void ObjectHierarchy::_trimAbove(SPObject *limit) { while ( !_hierarchy.empty() && _hierarchy.back().object != limit ) { SPObject *object=_hierarchy.back().object; - sp_object_ref(object, NULL); + sp_object_ref(object, nullptr); _detach(_hierarchy.back()); _hierarchy.pop_back(); _removed_signal.emit(object); - sp_object_unref(object, NULL); + sp_object_unref(object, nullptr); } } void ObjectHierarchy::setBottom(SPObject *object) { - if (object == NULL) { printf("assertion object != NULL failed\n"); return; } + if (object == nullptr) { printf("assertion object != NULL failed\n"); return; } if ( bottom() == object ) { return; @@ -100,11 +100,11 @@ void ObjectHierarchy::setBottom(SPObject *object) { _trimBelow(object); } else { // object is a sibling or cousin of bottom() SPObject *saved_top=top(); - sp_object_ref(saved_top, NULL); + sp_object_ref(saved_top, nullptr); _clear(); _addBottom(saved_top); _addBottom(saved_top, object); - sp_object_unref(saved_top, NULL); + sp_object_unref(saved_top, nullptr); } } else { _clear(); @@ -117,11 +117,11 @@ void ObjectHierarchy::setBottom(SPObject *object) { void ObjectHierarchy::_trimBelow(SPObject *limit) { while ( !_hierarchy.empty() && _hierarchy.front().object != limit ) { SPObject *object=_hierarchy.front().object; - sp_object_ref(object, NULL); + sp_object_ref(object, nullptr); _detach(_hierarchy.front()); _hierarchy.pop_front(); _removed_signal.emit(object); - sp_object_unref(object, NULL); + sp_object_unref(object, nullptr); } } @@ -146,17 +146,17 @@ void ObjectHierarchy::_trim_for_release(SPObject *object) { assert(!this->_hierarchy.empty()); assert(this->_hierarchy.front().object == object); - sp_object_ref(object, NULL); + sp_object_ref(object, nullptr); this->_detach(this->_hierarchy.front()); this->_hierarchy.pop_front(); this->_removed_signal.emit(object); - sp_object_unref(object, NULL); + sp_object_unref(object, nullptr); this->_changed_signal.emit(this->top(), this->bottom()); } ObjectHierarchy::Record ObjectHierarchy::_attach(SPObject *object) { - sp_object_ref(object, NULL); + sp_object_ref(object, nullptr); sigc::connection connection = object->connectRelease( sigc::mem_fun(*this, &ObjectHierarchy::_trim_for_release) @@ -166,7 +166,7 @@ ObjectHierarchy::Record ObjectHierarchy::_attach(SPObject *object) { void ObjectHierarchy::_detach(ObjectHierarchy::Record &rec) { rec.connection.disconnect(); - sp_object_unref(rec.object, NULL); + sp_object_unref(rec.object, nullptr); } } diff --git a/src/object-hierarchy.h b/src/object-hierarchy.h index 16004c81a..535cd3439 100644 --- a/src/object-hierarchy.h +++ b/src/object-hierarchy.h @@ -40,7 +40,7 @@ public: * Create new object hierarchy. * @param top The first entry if non-NULL. */ - ObjectHierarchy(SPObject *top=NULL); + ObjectHierarchy(SPObject *top=nullptr); ~ObjectHierarchy(); @@ -63,7 +63,7 @@ public: void clear(); SPObject *top() { - return !_hierarchy.empty() ? _hierarchy.back().object : NULL; + return !_hierarchy.empty() ? _hierarchy.back().object : nullptr; } /** @@ -72,7 +72,7 @@ public: void setTop(SPObject *object); SPObject *bottom() { - return !_hierarchy.empty() ? _hierarchy.front().object : NULL; + return !_hierarchy.empty() ? _hierarchy.front().object : nullptr; } /** @@ -131,7 +131,7 @@ private: void _detach(Record &record); - void _clear() { _trimBelow(NULL); } + void _clear() { _trimBelow(nullptr); } void _trim_for_release(SPObject *released); diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 7ef053f9b..6d0b3cd7e 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -77,7 +77,7 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, Geom::Affine const additional_affine) const // transformation of the item being clipped / masked { SPDesktop const *dt = _snapmanager->getDesktop(); - if (dt == NULL) { + if (dt == nullptr) { g_warning("desktop == NULL, so we cannot snap; please inform the developers of this bug"); // Apparently the setup() method from the SnapManager class hasn't been called before trying to snap. } @@ -90,31 +90,31 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, bbox_to_snap_incl.expandBy(getSnapperTolerance()); // see? for (auto& o: parent->children) { - g_assert(dt != NULL); + g_assert(dt != nullptr); SPItem *item = dynamic_cast<SPItem *>(&o); if (item && !(dt->itemIsHidden(item) && !clip_or_mask)) { // Snapping to items in a locked layer is allowed // Don't snap to hidden objects, unless they're a clipped path or a mask /* See if this item is on the ignore list */ std::vector<SPItem const *>::const_iterator i; - if (it != NULL) { + if (it != nullptr) { i = it->begin(); while (i != it->end() && *i != &o) { ++i; } } - if (it == NULL || i == it->end()) { + if (it == nullptr || i == it->end()) { if (item) { if (!clip_or_mask) { // cannot clip or mask more than once // The current item is not a clipping path or a mask, but might // still be the subject of clipping or masking itself ; if so, then // we should also consider that path or mask for snapping to - SPObject *obj = item->clip_ref ? item->clip_ref->getObject() : NULL; + SPObject *obj = item->clip_ref ? item->clip_ref->getObject() : nullptr; if (obj && _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH_CLIP)) { _findCandidates(obj, it, false, bbox_to_snap, true, item->i2doc_affine()); } - obj = item->mask_ref ? item->mask_ref->getObject() : NULL; + obj = item->mask_ref ? item->mask_ref->getObject() : nullptr; if (obj && _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH_MASK)) { _findCandidates(obj, it, false, bbox_to_snap, true, item->i2doc_affine()); } @@ -280,8 +280,8 @@ void Inkscape::ObjectSnapper::_snapNodes(IntermSnapResults &isr, _collectNodes(p.getSourceType(), p.getSourceNum() <= 0); - if (unselected_nodes != NULL && unselected_nodes->size() > 0) { - g_assert(_points_to_snap_to != NULL); + if (unselected_nodes != nullptr && unselected_nodes->size() > 0) { + g_assert(_points_to_snap_to != nullptr); _points_to_snap_to->insert(_points_to_snap_to->end(), unselected_nodes->begin(), unselected_nodes->end()); } @@ -325,7 +325,7 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuide(IntermSnapResults &isr, if (_snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH, SNAPTARGET_PATH_INTERSECTION, SNAPTARGET_BBOX_EDGE, SNAPTARGET_PAGE_BORDER, SNAPTARGET_TEXT_BASELINE)) { _collectPaths(p, SNAPSOURCE_GUIDE, true); - _snapPaths(isr, SnapCandidatePoint(p, SNAPSOURCE_GUIDE), NULL, NULL); + _snapPaths(isr, SnapCandidatePoint(p, SNAPSOURCE_GUIDE), nullptr, nullptr); } SnappedPoint s; @@ -374,7 +374,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/, // Consider the page border for snapping if (_snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PAGE_BORDER) && _snapmanager->snapprefs.isAnyCategorySnappable()) { Geom::PathVector *border_path = _getBorderPathv(); - if (border_path != NULL) { + if (border_path != nullptr) { _paths_to_snap_to->push_back(SnapCandidatePath(border_path, SNAPTARGET_PAGE_BORDER, Geom::OptRect())); } } @@ -383,7 +383,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/, /* Transform the requested snap point to this item's coordinates */ Geom::Affine i2doc(Geom::identity()); - SPItem *root_item = NULL; + SPItem *root_item = nullptr; /* We might have a clone at hand, so make sure we get the root item */ SPUse *use = dynamic_cast<SPUse *>((*i).item); if (use) { @@ -404,7 +404,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/, if (_snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_TEXT_BASELINE)) { // Snap to the text baseline Text::Layout const *layout = te_get_layout(static_cast<SPItem *>(root_item)); - if (layout != NULL && layout->outputExists()) { + if (layout != nullptr && layout->outputExists()) { Geom::PathVector *pv = new Geom::PathVector(); pv->push_back(layout->baseline() * root_item->i2dt_affine() * (*i).additional_affine * _snapmanager->getDesktop()->doc2dt()); _paths_to_snap_to->push_back(SnapCandidatePath(pv, SNAPTARGET_TEXT_BASELINE, Geom::OptRect())); @@ -421,7 +421,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/, } if (!very_complex_path && root_item && _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH, SNAPTARGET_PATH_INTERSECTION)) { - SPCurve *curve = NULL; + SPCurve *curve = nullptr; SPShape *shape = dynamic_cast<SPShape *>(root_item); if (shape) { curve = shape->getCurve(); @@ -472,10 +472,10 @@ void Inkscape::ObjectSnapper::_snapPaths(IntermSnapResults &isr, // Now we can finally do the real snapping, using the paths collected above SPDesktop const *dt = _snapmanager->getDesktop(); - g_assert(dt != NULL); + g_assert(dt != nullptr); Geom::Point const p_doc = dt->dt2doc(p.getPoint()); - bool const node_tool_active = _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH, SNAPTARGET_PATH_INTERSECTION) && selected_path != NULL; + bool const node_tool_active = _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH, SNAPTARGET_PATH_INTERSECTION) && selected_path != nullptr; if (p.getSourceNum() <= 0) { /* findCandidates() is used for snapping to both paths and nodes. It ignores the path that is @@ -535,7 +535,7 @@ void Inkscape::ObjectSnapper::_snapPaths(IntermSnapResults &isr, * self-snapping. For this we check whether the nodes at both ends of the current * piece are unselected; if they are then this piece must be stationary */ - g_assert(unselected_nodes != NULL); + g_assert(unselected_nodes != nullptr); Geom::Point start_pt = dt->doc2dt(curve->pointAt(0)); Geom::Point end_pt = dt->doc2dt(curve->pointAt(1)); c1 = isUnselectedNode(start_pt, unselected_nodes); @@ -579,7 +579,7 @@ void Inkscape::ObjectSnapper::_snapPaths(IntermSnapResults &isr, /* Returns true if point is coincident with one of the unselected nodes */ bool Inkscape::ObjectSnapper::isUnselectedNode(Geom::Point const &point, std::vector<SnapCandidatePoint> const *unselected_nodes) const { - if (unselected_nodes == NULL) { + if (unselected_nodes == nullptr) { return false; } @@ -607,7 +607,7 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(IntermSnapResults &isr, // Now we can finally do the real snapping, using the paths collected above SPDesktop const *dt = _snapmanager->getDesktop(); - g_assert(dt != NULL); + g_assert(dt != nullptr); Geom::Point direction_vector = c.getDirection(); if (!is_zero(direction_vector)) { @@ -681,15 +681,15 @@ void Inkscape::ObjectSnapper::freeSnap(IntermSnapResults &isr, _snapNodes(isr, p, unselected_nodes); if (_snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH, SNAPTARGET_PATH_INTERSECTION, SNAPTARGET_BBOX_EDGE, SNAPTARGET_PAGE_BORDER, SNAPTARGET_TEXT_BASELINE)) { - unsigned n = (unselected_nodes == NULL) ? 0 : unselected_nodes->size(); + unsigned n = (unselected_nodes == nullptr) ? 0 : unselected_nodes->size(); if (n > 0) { /* While editing a path in the node tool, findCandidates must ignore that path because * of the node snapping requirements (i.e. only unselected nodes must be snapable). * That path must not be ignored however when snapping to the paths, so we add it here * manually when applicable */ - SPPath const *path = NULL; - if (it != NULL) { + SPPath const *path = nullptr; + if (it != nullptr) { SPPath const *tmpPath = dynamic_cast<SPPath const *>(*it->begin()); if ((it->size() == 1) && tmpPath) { path = tmpPath; @@ -698,7 +698,7 @@ void Inkscape::ObjectSnapper::freeSnap(IntermSnapResults &isr, } _snapPaths(isr, p, unselected_nodes, path); } else { - _snapPaths(isr, p, NULL, NULL); + _snapPaths(isr, p, nullptr, nullptr); } } } @@ -760,7 +760,7 @@ Geom::PathVector* Inkscape::ObjectSnapper::_getPathvFromRect(Geom::Rect const re Geom::PathVector *dummy = new Geom::PathVector(border_curve->get_pathvector()); return dummy; } else { - return NULL; + return nullptr; } } diff --git a/src/object/box3d-side.cpp b/src/object/box3d-side.cpp index b6b9bbbf7..b085b88ae 100644 --- a/src/object/box3d-side.cpp +++ b/src/object/box3d-side.cpp @@ -60,7 +60,7 @@ Inkscape::XML::Node* Box3DSide::write(Inkscape::XML::Document *xml_doc, Inkscape //Nulls might be possible if this called iteratively if ( !curve ) { - return NULL; + return nullptr; } char *d = sp_svg_write_path ( curve->get_pathvector() ); @@ -121,7 +121,7 @@ void Box3DSide::update(SPCtx* ctx, guint flags) { /* Create a new Box3DSide and append it to the parent box */ Box3DSide * Box3DSide::createBox3DSide(SPBox3D *box) { - Box3DSide *box3d_side = 0; + Box3DSide *box3d_side = nullptr; Inkscape::XML::Document *xml_doc = box->document->rdoc; Inkscape::XML::Node *repr_side = xml_doc->createElement("svg:path"); repr_side->setAttribute("sodipodi:type", "inkscape:box3dside"); @@ -247,8 +247,8 @@ box3d_side_compute_corner_ids(Box3DSide *side, unsigned int corners[4]) { Persp3D * box3d_side_perspective(Box3DSide *side) { - SPBox3D *box = side ? dynamic_cast<SPBox3D *>(side->parent) : NULL; - return box ? box->persp_ref->getObject() : NULL; + SPBox3D *box = side ? dynamic_cast<SPBox3D *>(side->parent) : nullptr; + return box ? box->persp_ref->getObject() : nullptr; } Inkscape::XML::Node *box3d_side_convert_to_path(Box3DSide *side) { diff --git a/src/object/box3d.cpp b/src/object/box3d.cpp index af1d00b0f..08190edfd 100644 --- a/src/object/box3d.cpp +++ b/src/object/box3d.cpp @@ -44,7 +44,7 @@ SPBox3D::SPBox3D() : SPGroup() { this->my_counter = 0; this->swapped = Box3D::NONE; - this->persp_href = NULL; + this->persp_href = nullptr; this->persp_ref = new Persp3DReference(this); /* we initialize the z-orders to zero so that they are updated during dragging */ @@ -93,7 +93,7 @@ void SPBox3D::release() { if (box->persp_ref) { box->persp_ref->detach(); delete box->persp_ref; - box->persp_ref = NULL; + box->persp_ref = nullptr; } if (persp) { @@ -126,7 +126,7 @@ void SPBox3D::set(unsigned int key, const gchar* value) { } else { if (box->persp_href) { g_free(box->persp_href); - box->persp_href = NULL; + box->persp_href = nullptr; } if (value) { box->persp_href = g_strdup(value); @@ -434,7 +434,7 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta SPBox3D * SPBox3D::createBox3D(SPItem * parent) { - SPBox3D *box3d = 0; + SPBox3D *box3d = nullptr; Inkscape::XML::Document *xml_doc = parent->document->rdoc; Inkscape::XML::Node *repr = xml_doc->createElement("svg:g"); repr->setAttribute("sodipodi:type", "inkscape:box3d"); @@ -1297,7 +1297,7 @@ SPGroup *box3d_convert_to_group(SPBox3D *box) grepr->setAttribute("id", id); SPGroup *group = dynamic_cast<SPGroup *>(doc->getObjectByRepr(grepr)); - g_assert(group != NULL); + g_assert(group != nullptr); return group; } diff --git a/src/object/color-profile.cpp b/src/object/color-profile.cpp index 7bdde9b6d..4b12df21b 100644 --- a/src/object/color-profile.cpp +++ b/src/object/color-profile.cpp @@ -147,19 +147,19 @@ cmsProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & s ColorProfileImpl::ColorProfileImpl() #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) : - _profHandle(0), + _profHandle(nullptr), _profileClass(cmsSigInputClass), _profileSpace(cmsSigRgbData), - _transf(0), - _revTransf(0), - _gamutTransf(0) + _transf(nullptr), + _revTransf(nullptr), + _gamutTransf(nullptr) #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) { } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -cmsHPROFILE ColorProfileImpl::_sRGBProf = 0; +cmsHPROFILE ColorProfileImpl::_sRGBProf = nullptr; cmsHPROFILE ColorProfileImpl::getSRGBProfile() { if ( !_sRGBProf ) { @@ -168,7 +168,7 @@ cmsHPROFILE ColorProfileImpl::getSRGBProfile() { return ColorProfileImpl::_sRGBProf; } -cmsHPROFILE ColorProfileImpl::_NullProf = 0; +cmsHPROFILE ColorProfileImpl::_NullProf = nullptr; cmsHPROFILE ColorProfileImpl::getNULLProfile() { if ( !_NullProf ) { @@ -208,10 +208,10 @@ bool ColorProfile::FilePlusHomeAndName::operator<(ColorProfile::FilePlusHomeAndN ColorProfile::ColorProfile() : SPObject() { this->impl = new ColorProfileImpl(); - this->href = 0; - this->local = 0; - this->name = 0; - this->intentStr = 0; + this->href = nullptr; + this->local = nullptr; + this->name = nullptr; + this->intentStr = nullptr; this->rendering_intent = Inkscape::RENDERING_INTENT_UNKNOWN; } @@ -238,22 +238,22 @@ void ColorProfile::release() { if ( this->href ) { g_free( this->href ); - this->href = 0; + this->href = nullptr; } if ( this->local ) { g_free( this->local ); - this->local = 0; + this->local = nullptr; } if ( this->name ) { g_free( this->name ); - this->name = 0; + this->name = nullptr; } if ( this->intentStr ) { g_free( this->intentStr ); - this->intentStr = 0; + this->intentStr = nullptr; } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -261,7 +261,7 @@ void ColorProfile::release() { #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) delete this->impl; - this->impl = 0; + this->impl = nullptr; } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -271,19 +271,19 @@ void ColorProfileImpl::_clearProfile() if ( _transf ) { cmsDeleteTransform( _transf ); - _transf = 0; + _transf = nullptr; } if ( _revTransf ) { cmsDeleteTransform( _revTransf ); - _revTransf = 0; + _revTransf = nullptr; } if ( _gamutTransf ) { cmsDeleteTransform( _gamutTransf ); - _gamutTransf = 0; + _gamutTransf = nullptr; } if ( _profHandle ) { cmsCloseProfile( _profHandle ); - _profHandle = 0; + _profHandle = nullptr; } } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -292,10 +292,10 @@ void ColorProfileImpl::_clearProfile() * Callback: set attributes from associated repr. */ void ColorProfile::build(SPDocument *document, Inkscape::XML::Node *repr) { - g_assert(this->href == 0); - g_assert(this->local == 0); - g_assert(this->name == 0); - g_assert(this->intentStr == 0); + g_assert(this->href == nullptr); + g_assert(this->local == nullptr); + g_assert(this->name == nullptr); + g_assert(this->intentStr == nullptr); SPObject::build(document, repr); @@ -320,7 +320,7 @@ void ColorProfile::set(unsigned key, gchar const *value) { case SP_ATTR_XLINK_HREF: if ( this->href ) { g_free( this->href ); - this->href = 0; + this->href = nullptr; } if ( value ) { this->href = g_strdup( value ); @@ -368,7 +368,7 @@ void ColorProfile::set(unsigned key, gchar const *value) { } DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)this->impl->_profHandle ); g_free(escaped); - escaped = 0; + escaped = nullptr; g_free(fullname); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } @@ -379,7 +379,7 @@ void ColorProfile::set(unsigned key, gchar const *value) { case SP_ATTR_LOCAL: if ( this->local ) { g_free( this->local ); - this->local = 0; + this->local = nullptr; } this->local = g_strdup( value ); this->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -388,7 +388,7 @@ void ColorProfile::set(unsigned key, gchar const *value) { case SP_ATTR_NAME: if ( this->name ) { g_free( this->name ); - this->name = 0; + this->name = nullptr; } this->name = g_strdup( value ); DEBUG_MESSAGE( lcmsTwo, "<color-profile> name set to '%s'", this->name ); @@ -398,7 +398,7 @@ void ColorProfile::set(unsigned key, gchar const *value) { case SP_ATTR_RENDERING_INTENT: if ( this->intentStr ) { g_free( this->intentStr ); - this->intentStr = 0; + this->intentStr = nullptr; } this->intentStr = g_strdup( value ); @@ -517,7 +517,7 @@ static int getLcmsIntent( guint svgIntent ) static SPObject* bruteFind( SPDocument* document, gchar const* name ) { - SPObject* result = 0; + SPObject* result = nullptr; std::vector<SPObject *> current = document->getResourceList("iccprofile"); for (std::vector<SPObject *>::const_iterator it = current.begin(); (!result) && (it != current.end()); ++it) { if ( IS_COLORPROFILE(*it) ) { @@ -536,7 +536,7 @@ static SPObject* bruteFind( SPDocument* document, gchar const* name ) cmsHPROFILE Inkscape::CMSSystem::getHandle( SPDocument* document, guint* intent, gchar const* name ) { - cmsHPROFILE prof = 0; + cmsHPROFILE prof = nullptr; SPObject* thing = bruteFind( document, name ); if ( thing ) { @@ -914,7 +914,7 @@ Glib::ustring getNameFromProfile(cmsHPROFILE profile) } nameStr = (name) ? name : C_("Profile name", "None"); #elif HAVE_LIBLCMS2 - cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", NULL, 0); + cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", nullptr, 0); if (byteLen > 0) { // TODO investigate wchar_t and cmsGetProfileInfo() std::vector<char> data(byteLen); @@ -926,7 +926,7 @@ Glib::ustring getNameFromProfile(cmsHPROFILE profile) } nameStr = Glib::ustring(data.begin(), data.end()); } - if (nameStr.empty() || !g_utf8_validate(nameStr.c_str(), -1, NULL)) { + if (nameStr.empty() || !g_utf8_validate(nameStr.c_str(), -1, nullptr)) { nameStr = _("(invalid UTF-8 string)"); } #endif @@ -960,7 +960,7 @@ void loadProfiles() if ( prof ) { ProfileInfo info( prof, Glib::filename_to_utf8( profile.filename.c_str() ) ); cmsCloseProfile( prof ); - prof = 0; + prof = nullptr; bool sameName = false; for(auto &knownProfile: knownProfiles) { @@ -990,12 +990,12 @@ static bool lastPreserveBlack = false; #endif // defined(cmsFLAGS_PRESERVEBLACK) static int lastIntent = INTENT_PERCEPTUAL; static int lastProofIntent = INTENT_PERCEPTUAL; -static cmsHTRANSFORM transf = 0; +static cmsHTRANSFORM transf = nullptr; namespace { cmsHPROFILE getSystemProfileHandle() { - static cmsHPROFILE theOne = 0; + static cmsHPROFILE theOne = nullptr; static Glib::ustring lastURI; loadProfiles(); @@ -1011,7 +1011,7 @@ cmsHPROFILE getSystemProfileHandle() } if ( transf ) { cmsDeleteTransform( transf ); - transf = 0; + transf = nullptr; } theOne = cmsOpenProfileFromFile( uri.data(), "r" ); if ( theOne ) { @@ -1022,11 +1022,11 @@ cmsHPROFILE getSystemProfileHandle() if ( profClass != cmsSigDisplayClass ) { g_warning("Not a display profile"); cmsCloseProfile( theOne ); - theOne = 0; + theOne = nullptr; } else if ( space != cmsSigRgbData ) { g_warning("Not an RGB profile"); cmsCloseProfile( theOne ); - theOne = 0; + theOne = nullptr; } else { lastURI = uri; } @@ -1034,11 +1034,11 @@ cmsHPROFILE getSystemProfileHandle() } } else if ( theOne ) { cmsCloseProfile( theOne ); - theOne = 0; + theOne = nullptr; lastURI.clear(); if ( transf ) { cmsDeleteTransform( transf ); - transf = 0; + transf = nullptr; } } @@ -1048,7 +1048,7 @@ cmsHPROFILE getSystemProfileHandle() cmsHPROFILE getProofProfileHandle() { - static cmsHPROFILE theOne = 0; + static cmsHPROFILE theOne = nullptr; static Glib::ustring lastURI; loadProfiles(); @@ -1065,7 +1065,7 @@ cmsHPROFILE getProofProfileHandle() } if ( transf ) { cmsDeleteTransform( transf ); - transf = 0; + transf = nullptr; } theOne = cmsOpenProfileFromFile( uri.data(), "r" ); if ( theOne ) { @@ -1094,11 +1094,11 @@ cmsHPROFILE getProofProfileHandle() } } else if ( theOne ) { cmsCloseProfile( theOne ); - theOne = 0; + theOne = nullptr; lastURI.clear(); if ( transf ) { cmsDeleteTransform( transf ); - transf = 0; + transf = nullptr; } } @@ -1115,9 +1115,9 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform() if ( fromDisplay ) { if ( transf ) { cmsDeleteTransform(transf); - transf = 0; + transf = nullptr; } - return 0; + return nullptr; } bool warn = prefs->getBool( "/options/softproof/gamutwarn"); @@ -1152,7 +1152,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform() // Fetch these now, as they might clear the transform as a side effect. cmsHPROFILE hprof = getSystemProfileHandle(); - cmsHPROFILE proofProf = hprof ? getProofProfileHandle() : 0; + cmsHPROFILE proofProf = hprof ? getProofProfileHandle() : nullptr; if ( !transf ) { if ( hprof && proofProf ) { @@ -1205,8 +1205,8 @@ public: MemProfile::MemProfile() : id(), - hprof(0), - transf(0) + hprof(nullptr), + transf(nullptr) { } @@ -1220,13 +1220,13 @@ void free_transforms() { if ( transf ) { cmsDeleteTransform(transf); - transf = 0; + transf = nullptr; } for ( auto profile : perMonitorProfiles ) { if ( profile.transf ) { cmsDeleteTransform(profile.transf); - profile.transf = 0; + profile.transf = nullptr; } } } @@ -1253,7 +1253,7 @@ Glib::ustring Inkscape::CMSSystem::setDisplayPer( gpointer buf, guint bufLen, in if ( item.hprof ) { cmsCloseProfile( item.hprof ); - item.hprof = 0; + item.hprof = nullptr; } Glib::ustring id; @@ -1273,9 +1273,9 @@ Glib::ustring Inkscape::CMSSystem::setDisplayPer( gpointer buf, guint bufLen, in cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id ) { - cmsHTRANSFORM result = 0; + cmsHTRANSFORM result = nullptr; if ( id.empty() ) { - return 0; + return nullptr; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1316,7 +1316,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id ) } // Fetch these now, as they might clear the transform as a side effect. - cmsHPROFILE proofProf = item.hprof ? getProofProfileHandle() : 0; + cmsHPROFILE proofProf = item.hprof ? getProofProfileHandle() : nullptr; if ( !item.transf ) { if ( item.hprof && proofProf ) { diff --git a/src/object/filters/blend.cpp b/src/object/filters/blend.cpp index e23b2aa57..6137843a3 100644 --- a/src/object/filters/blend.cpp +++ b/src/object/filters/blend.cpp @@ -254,7 +254,7 @@ Inkscape::XML::Node* SPFeBlend::write(Inkscape::XML::Document *doc, Inkscape::XM case Inkscape::Filters::BLEND_LUMINOSITY: mode = "luminosity"; break; default: - mode = 0; + mode = nullptr; } repr->setAttribute("mode", mode); @@ -265,13 +265,13 @@ Inkscape::XML::Node* SPFeBlend::write(Inkscape::XML::Document *doc, Inkscape::XM } void SPFeBlend::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_BLEND); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterBlend *nr_blend = dynamic_cast<Inkscape::Filters::FilterBlend*>(nr_primitive); - g_assert(nr_blend != NULL); + g_assert(nr_blend != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/colormatrix.cpp b/src/object/filters/colormatrix.cpp index 0e8398ace..ebeab56c1 100644 --- a/src/object/filters/colormatrix.cpp +++ b/src/object/filters/colormatrix.cpp @@ -134,13 +134,13 @@ Inkscape::XML::Node* SPFeColorMatrix::write(Inkscape::XML::Document *doc, Inksca } void SPFeColorMatrix::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COLORMATRIX); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterColorMatrix *nr_colormatrix = dynamic_cast<Inkscape::Filters::FilterColorMatrix*>(nr_primitive); - g_assert(nr_colormatrix != NULL); + g_assert(nr_colormatrix != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); nr_colormatrix->set_type(this->type); diff --git a/src/object/filters/componenttransfer.cpp b/src/object/filters/componenttransfer.cpp index dd13d85d1..fe488ce74 100644 --- a/src/object/filters/componenttransfer.cpp +++ b/src/object/filters/componenttransfer.cpp @@ -24,7 +24,7 @@ #include "xml/repr.h" SPFeComponentTransfer::SPFeComponentTransfer() - : SPFilterPrimitive(), renderer(NULL) + : SPFilterPrimitive(), renderer(nullptr) { } @@ -160,13 +160,13 @@ Inkscape::XML::Node* SPFeComponentTransfer::write(Inkscape::XML::Document *doc, } void SPFeComponentTransfer::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COMPONENTTRANSFER); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterComponentTransfer *nr_componenttransfer = dynamic_cast<Inkscape::Filters::FilterComponentTransfer*>(nr_primitive); - g_assert(nr_componenttransfer != NULL); + g_assert(nr_componenttransfer != nullptr); this->renderer = nr_componenttransfer; sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/composite.cpp b/src/object/filters/composite.cpp index bca67774b..2b5cdf75e 100644 --- a/src/object/filters/composite.cpp +++ b/src/object/filters/composite.cpp @@ -280,7 +280,7 @@ Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape comp_op = "lighter"; break; #endif default: - comp_op = 0; + comp_op = nullptr; } repr->setAttribute("operator", comp_op); @@ -291,10 +291,10 @@ Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape sp_repr_set_svg_double(repr, "k3", this->k3); sp_repr_set_svg_double(repr, "k4", this->k4); } else { - repr->setAttribute("k1", 0); - repr->setAttribute("k2", 0); - repr->setAttribute("k3", 0); - repr->setAttribute("k4", 0); + repr->setAttribute("k1", nullptr); + repr->setAttribute("k2", nullptr); + repr->setAttribute("k3", nullptr); + repr->setAttribute("k4", nullptr); } SPFilterPrimitive::write(doc, repr, flags); @@ -303,13 +303,13 @@ Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape } void SPFeComposite::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COMPOSITE); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterComposite *nr_composite = dynamic_cast<Inkscape::Filters::FilterComposite*>(nr_primitive); - g_assert(nr_composite != NULL); + g_assert(nr_composite != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/convolvematrix.cpp b/src/object/filters/convolvematrix.cpp index e856690ff..4f2588695 100644 --- a/src/object/filters/convolvematrix.cpp +++ b/src/object/filters/convolvematrix.cpp @@ -288,13 +288,13 @@ Inkscape::XML::Node* SPFeConvolveMatrix::write(Inkscape::XML::Document *doc, Ink } void SPFeConvolveMatrix::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_CONVOLVEMATRIX); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterConvolveMatrix *nr_convolve = dynamic_cast<Inkscape::Filters::FilterConvolveMatrix*>(nr_primitive); - g_assert(nr_convolve != NULL); + g_assert(nr_convolve != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/diffuselighting.cpp b/src/object/filters/diffuselighting.cpp index f23817993..a11ddf507 100644 --- a/src/object/filters/diffuselighting.cpp +++ b/src/object/filters/diffuselighting.cpp @@ -39,10 +39,10 @@ SPFeDiffuseLighting::SPFeDiffuseLighting() : SPFilterPrimitive() { this->surfaceScale = 1; this->diffuseConstant = 1; this->lighting_color = 0xffffffff; - this->icc = NULL; + this->icc = nullptr; //TODO kernelUnit - this->renderer = NULL; + this->renderer = nullptr; this->surfaceScale_set = FALSE; this->diffuseConstant_set = FALSE; @@ -78,14 +78,14 @@ void SPFeDiffuseLighting::release() { * Sets a specific value in the SPFeDiffuseLighting. */ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) { - gchar const *cend_ptr = NULL; - gchar *end_ptr = NULL; + gchar const *cend_ptr = nullptr; + gchar *end_ptr = nullptr; switch(key) { /*DEAL WITH SETTING ATTRIBUTES HERE*/ //TODO test forbidden values case SP_ATTR_SURFACESCALE: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->surfaceScale = g_ascii_strtod(value, &end_ptr); @@ -107,7 +107,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) { this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_DIFFUSECONSTANT: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->diffuseConstant = g_ascii_strtod(value, &end_ptr); @@ -115,7 +115,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) { if (end_ptr && this->diffuseConstant >= 0) { this->diffuseConstant_set = TRUE; } else { - end_ptr = NULL; + end_ptr = nullptr; g_warning("this: diffuseConstant should be a positive number ... defaulting to 1"); } } @@ -141,7 +141,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) { this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_PROP_LIGHTING_COLOR: - cend_ptr = NULL; + cend_ptr = nullptr; this->lighting_color = sp_svg_read_color(value, &cend_ptr, 0xffffffff); //if a value was read @@ -157,7 +157,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) { if ( ! sp_svg_read_icc_color( cend_ptr, this->icc ) ) { delete this->icc; - this->icc = NULL; + this->icc = nullptr; } } @@ -207,13 +207,13 @@ Inkscape::XML::Node* SPFeDiffuseLighting::write(Inkscape::XML::Document *doc, In if (this->surfaceScale_set) { sp_repr_set_css_double(repr, "surfaceScale", this->surfaceScale); } else { - repr->setAttribute("surfaceScale", NULL); + repr->setAttribute("surfaceScale", nullptr); } if (this->diffuseConstant_set) { sp_repr_set_css_double(repr, "diffuseConstant", this->diffuseConstant); } else { - repr->setAttribute("diffuseConstant", NULL); + repr->setAttribute("diffuseConstant", nullptr); } /*TODO kernelUnits */ @@ -222,7 +222,7 @@ Inkscape::XML::Node* SPFeDiffuseLighting::write(Inkscape::XML::Document *doc, In sp_svg_write_color(c, sizeof(c), this->lighting_color); repr->setAttribute("lighting-color", c); } else { - repr->setAttribute("lighting-color", NULL); + repr->setAttribute("lighting-color", nullptr); } SPFilterPrimitive::write(doc, repr, flags); @@ -277,13 +277,13 @@ static void sp_feDiffuseLighting_children_modified(SPFeDiffuseLighting *sp_diffu } void SPFeDiffuseLighting::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_DIFFUSELIGHTING); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterDiffuseLighting *nr_diffuselighting = dynamic_cast<Inkscape::Filters::FilterDiffuseLighting*>(nr_primitive); - g_assert(nr_diffuselighting != NULL); + g_assert(nr_diffuselighting != nullptr); this->renderer = nr_diffuselighting; sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/displacementmap.cpp b/src/object/filters/displacementmap.cpp index 978fd517b..7d4106648 100644 --- a/src/object/filters/displacementmap.cpp +++ b/src/object/filters/displacementmap.cpp @@ -179,7 +179,7 @@ static char const * get_channelselector_name(FilterDisplacementMapChannelSelecto case DISPLACEMENTMAP_CHANNEL_ALPHA: return "A"; default: - return 0; + return nullptr; } } @@ -229,13 +229,13 @@ Inkscape::XML::Node* SPFeDisplacementMap::write(Inkscape::XML::Document *doc, In } void SPFeDisplacementMap::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_DISPLACEMENTMAP); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterDisplacementMap *nr_displacement_map = dynamic_cast<Inkscape::Filters::FilterDisplacementMap*>(nr_primitive); - g_assert(nr_displacement_map != NULL); + g_assert(nr_displacement_map != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/distantlight.cpp b/src/object/filters/distantlight.cpp index e2dd4ea1b..bec28f66f 100644 --- a/src/object/filters/distantlight.cpp +++ b/src/object/filters/distantlight.cpp @@ -71,7 +71,7 @@ void SPFeDistantLight::set(unsigned int key, gchar const *value) { switch (key) { case SP_ATTR_AZIMUTH: - end_ptr =NULL; + end_ptr =nullptr; if (value) { this->azimuth = g_ascii_strtod(value, &end_ptr); @@ -93,7 +93,7 @@ void SPFeDistantLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_ELEVATION: - end_ptr =NULL; + end_ptr =nullptr; if (value) { this->elevation = g_ascii_strtod(value, &end_ptr); diff --git a/src/object/filters/flood.cpp b/src/object/filters/flood.cpp index 9132b2028..da0af4737 100644 --- a/src/object/filters/flood.cpp +++ b/src/object/filters/flood.cpp @@ -29,7 +29,7 @@ SPFeFlood::SPFeFlood() : SPFilterPrimitive() { this->color = 0; this->opacity = 1; - this->icc = NULL; + this->icc = nullptr; } SPFeFlood::~SPFeFlood() { @@ -59,8 +59,8 @@ void SPFeFlood::release() { * Sets a specific value in the SPFeFlood. */ void SPFeFlood::set(unsigned int key, gchar const *value) { - gchar const *cend_ptr = NULL; - gchar *end_ptr = NULL; + gchar const *cend_ptr = nullptr; + gchar *end_ptr = nullptr; guint32 read_color; double read_num; bool dirty = false; @@ -68,7 +68,7 @@ void SPFeFlood::set(unsigned int key, gchar const *value) { switch(key) { /*DEAL WITH SETTING ATTRIBUTES HERE*/ case SP_PROP_FLOOD_COLOR: - cend_ptr = NULL; + cend_ptr = nullptr; read_color = sp_svg_read_color(value, &cend_ptr, 0xffffffff); if (cend_ptr && read_color != this->color){ @@ -88,7 +88,7 @@ void SPFeFlood::set(unsigned int key, gchar const *value) { if ( ! sp_svg_read_icc_color( cend_ptr, this->icc ) ) { delete this->icc; - this->icc = NULL; + this->icc = nullptr; } dirty = true; @@ -103,7 +103,7 @@ void SPFeFlood::set(unsigned int key, gchar const *value) { if (value) { read_num = g_ascii_strtod(value, &end_ptr); - if (end_ptr != NULL) { + if (end_ptr != nullptr) { if (*end_ptr) { g_warning("Unable to convert \"%s\" to number", value); read_num = 1; @@ -154,13 +154,13 @@ Inkscape::XML::Node* SPFeFlood::write(Inkscape::XML::Document *doc, Inkscape::XM } void SPFeFlood::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_FLOOD); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterFlood *nr_flood = dynamic_cast<Inkscape::Filters::FilterFlood*>(nr_primitive); - g_assert(nr_flood != NULL); + g_assert(nr_flood != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/image.cpp b/src/object/filters/image.cpp index 1eeb32111..25ac3024a 100644 --- a/src/object/filters/image.cpp +++ b/src/object/filters/image.cpp @@ -34,10 +34,10 @@ SPFeImage::SPFeImage() : SPFilterPrimitive() { - this->href = NULL; + this->href = nullptr; this->from_element = 0; - this->SVGElemRef = NULL; - this->SVGElem = NULL; + this->SVGElemRef = nullptr; + this->SVGElem = nullptr; this->aspect_align = SP_ASPECT_XMID_YMID; // Default this->aspect_clip = SP_ASPECT_MEET; // Default @@ -88,7 +88,7 @@ static void sp_feImage_href_modified(SPObject* /*old_elem*/, SPObject* new_elem, feImage->SVGElem = SP_ITEM(new_elem); feImage->_image_modified_connection = ((SPObject*) feImage->SVGElem)->connectModified(sigc::bind(sigc::ptr_fun(&sp_feImage_elem_modified), obj)); } else { - feImage->SVGElem = 0; + feImage->SVGElem = nullptr; } obj->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -104,11 +104,11 @@ void SPFeImage::set(unsigned int key, gchar const *value) { if (this->href) { g_free(this->href); } - this->href = (value) ? g_strdup (value) : NULL; + this->href = (value) ? g_strdup (value) : nullptr; if (!this->href) return; delete this->SVGElemRef; - this->SVGElemRef = 0; - this->SVGElem = 0; + this->SVGElemRef = nullptr; + this->SVGElem = nullptr; this->_image_modified_connection.disconnect(); this->_href_modified_connection.disconnect(); try{ @@ -232,13 +232,13 @@ Inkscape::XML::Node* SPFeImage::write(Inkscape::XML::Document *doc, Inkscape::XM } void SPFeImage::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_IMAGE); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterImage *nr_image = dynamic_cast<Inkscape::Filters::FilterImage*>(nr_primitive); - g_assert(nr_image != NULL); + g_assert(nr_image != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/merge.cpp b/src/object/filters/merge.cpp index 8ec40cb46..ddd19e732 100644 --- a/src/object/filters/merge.cpp +++ b/src/object/filters/merge.cpp @@ -82,13 +82,13 @@ Inkscape::XML::Node* SPFeMerge::write(Inkscape::XML::Document *doc, Inkscape::XM } void SPFeMerge::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_MERGE); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterMerge *nr_merge = dynamic_cast<Inkscape::Filters::FilterMerge*>(nr_primitive); - g_assert(nr_merge != NULL); + g_assert(nr_merge != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/morphology.cpp b/src/object/filters/morphology.cpp index b3cfa0697..6f1006372 100644 --- a/src/object/filters/morphology.cpp +++ b/src/object/filters/morphology.cpp @@ -135,13 +135,13 @@ Inkscape::XML::Node* SPFeMorphology::write(Inkscape::XML::Document *doc, Inkscap } void SPFeMorphology::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_MORPHOLOGY); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterMorphology *nr_morphology = dynamic_cast<Inkscape::Filters::FilterMorphology*>(nr_primitive); - g_assert(nr_morphology != NULL); + g_assert(nr_morphology != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/offset.cpp b/src/object/filters/offset.cpp index a0057d722..ed674afbf 100644 --- a/src/object/filters/offset.cpp +++ b/src/object/filters/offset.cpp @@ -111,13 +111,13 @@ Inkscape::XML::Node* SPFeOffset::write(Inkscape::XML::Document *doc, Inkscape::X } void SPFeOffset::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_OFFSET); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterOffset *nr_offset = dynamic_cast<Inkscape::Filters::FilterOffset*>(nr_primitive); - g_assert(nr_offset != NULL); + g_assert(nr_offset != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/pointlight.cpp b/src/object/filters/pointlight.cpp index 942140c1b..c12d68ceb 100644 --- a/src/object/filters/pointlight.cpp +++ b/src/object/filters/pointlight.cpp @@ -74,7 +74,7 @@ void SPFePointLight::set(unsigned int key, gchar const *value) { switch (key) { case SP_ATTR_X: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->x = g_ascii_strtod(value, &end_ptr); @@ -96,7 +96,7 @@ void SPFePointLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_Y: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->y = g_ascii_strtod(value, &end_ptr); @@ -118,7 +118,7 @@ void SPFePointLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_Z: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->z = g_ascii_strtod(value, &end_ptr); diff --git a/src/object/filters/sp-filter-primitive.cpp b/src/object/filters/sp-filter-primitive.cpp index e5381373d..7f93754b9 100644 --- a/src/object/filters/sp-filter-primitive.cpp +++ b/src/object/filters/sp-filter-primitive.cpp @@ -249,8 +249,8 @@ int sp_filter_primitive_name_previous_out(SPFilterPrimitive *prim) { /* Common initialization for filter primitives */ void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, Inkscape::Filters::FilterPrimitive *nr_prim) { - g_assert(sp_prim != NULL); - g_assert(nr_prim != NULL); + g_assert(sp_prim != nullptr); + g_assert(nr_prim != nullptr); nr_prim->set_input(sp_prim->image_in); diff --git a/src/object/filters/specularlighting.cpp b/src/object/filters/specularlighting.cpp index c46a21080..3e66d6f95 100644 --- a/src/object/filters/specularlighting.cpp +++ b/src/object/filters/specularlighting.cpp @@ -42,10 +42,10 @@ SPFeSpecularLighting::SPFeSpecularLighting() : SPFilterPrimitive() { this->specularConstant = 1; this->specularExponent = 1; this->lighting_color = 0xffffffff; - this->icc = NULL; + this->icc = nullptr; //TODO kernelUnit - this->renderer = NULL; + this->renderer = nullptr; this->surfaceScale_set = FALSE; this->specularConstant_set = FALSE; @@ -83,14 +83,14 @@ void SPFeSpecularLighting::release() { * Sets a specific value in the SPFeSpecularLighting. */ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) { - gchar const *cend_ptr = NULL; - gchar *end_ptr = NULL; + gchar const *cend_ptr = nullptr; + gchar *end_ptr = nullptr; switch(key) { /*DEAL WITH SETTING ATTRIBUTES HERE*/ //TODO test forbidden values case SP_ATTR_SURFACESCALE: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->surfaceScale = g_ascii_strtod(value, &end_ptr); if (end_ptr) { @@ -111,13 +111,13 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) { this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_SPECULARCONSTANT: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->specularConstant = g_ascii_strtod(value, &end_ptr); if (end_ptr && this->specularConstant >= 0) { this->specularConstant_set = TRUE; } else { - end_ptr = NULL; + end_ptr = nullptr; g_warning("this: specularConstant should be a positive number ... defaulting to 1"); } } @@ -131,13 +131,13 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) { this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_SPECULAREXPONENT: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->specularExponent = g_ascii_strtod(value, &end_ptr); if (this->specularExponent >= 1 && this->specularExponent <= 128) { this->specularExponent_set = TRUE; } else { - end_ptr = NULL; + end_ptr = nullptr; g_warning("this: specularExponent should be a number in range [1, 128] ... defaulting to 1"); } } @@ -160,7 +160,7 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) { this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_PROP_LIGHTING_COLOR: - cend_ptr = NULL; + cend_ptr = nullptr; this->lighting_color = sp_svg_read_color(value, &cend_ptr, 0xffffffff); //if a value was read if (cend_ptr) { @@ -171,7 +171,7 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) { if (!this->icc) this->icc = new SVGICCColor(); if ( ! sp_svg_read_icc_color( cend_ptr, this->icc ) ) { delete this->icc; - this->icc = NULL; + this->icc = nullptr; } } this->lighting_color_set = TRUE; @@ -289,13 +289,13 @@ static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_spe } void SPFeSpecularLighting::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_SPECULARLIGHTING); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterSpecularLighting *nr_specularlighting = dynamic_cast<Inkscape::Filters::FilterSpecularLighting*>(nr_primitive); - g_assert(nr_specularlighting != NULL); + g_assert(nr_specularlighting != nullptr); this->renderer = nr_specularlighting; sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/filters/spotlight.cpp b/src/object/filters/spotlight.cpp index a05691196..239391478 100644 --- a/src/object/filters/spotlight.cpp +++ b/src/object/filters/spotlight.cpp @@ -79,7 +79,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { switch (key) { case SP_ATTR_X: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->x = g_ascii_strtod(value, &end_ptr); @@ -101,7 +101,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_Y: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->y = g_ascii_strtod(value, &end_ptr); @@ -123,7 +123,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_Z: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->z = g_ascii_strtod(value, &end_ptr); @@ -145,7 +145,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_POINTSATX: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->pointsAtX = g_ascii_strtod(value, &end_ptr); @@ -167,7 +167,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_POINTSATY: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->pointsAtY = g_ascii_strtod(value, &end_ptr); @@ -189,7 +189,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_POINTSATZ: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->pointsAtZ = g_ascii_strtod(value, &end_ptr); @@ -211,7 +211,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_SPECULAREXPONENT: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->specularExponent = g_ascii_strtod(value, &end_ptr); @@ -233,7 +233,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) { } break; case SP_ATTR_LIMITINGCONEANGLE: - end_ptr = NULL; + end_ptr = nullptr; if (value) { this->limitingConeAngle = g_ascii_strtod(value, &end_ptr); diff --git a/src/object/filters/tile.cpp b/src/object/filters/tile.cpp index 82e63c220..f36c5a758 100644 --- a/src/object/filters/tile.cpp +++ b/src/object/filters/tile.cpp @@ -86,13 +86,13 @@ Inkscape::XML::Node* SPFeTile::write(Inkscape::XML::Document *doc, Inkscape::XML } void SPFeTile::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_TILE); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterTile *nr_tile = dynamic_cast<Inkscape::Filters::FilterTile*>(nr_primitive); - g_assert(nr_tile != NULL); + g_assert(nr_tile != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); } diff --git a/src/object/filters/turbulence.cpp b/src/object/filters/turbulence.cpp index 9af51892e..657e44d6a 100644 --- a/src/object/filters/turbulence.cpp +++ b/src/object/filters/turbulence.cpp @@ -193,19 +193,19 @@ Inkscape::XML::Node* SPFeTurbulence::write(Inkscape::XML::Document *doc, Inkscap SPFilterPrimitive::write(doc, repr, flags); /* turbulence doesn't take input */ - repr->setAttribute("in", 0); + repr->setAttribute("in", nullptr); return repr; } void SPFeTurbulence::build_renderer(Inkscape::Filters::Filter* filter) { - g_assert(this != NULL); - g_assert(filter != NULL); + g_assert(this != nullptr); + g_assert(filter != nullptr); int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_TURBULENCE); Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); Inkscape::Filters::FilterTurbulence *nr_turbulence = dynamic_cast<Inkscape::Filters::FilterTurbulence*>(nr_primitive); - g_assert(nr_turbulence != NULL); + g_assert(nr_turbulence != nullptr); sp_filter_primitive_renderer_common(this, nr_primitive); diff --git a/src/object/object-set.cpp b/src/object/object-set.cpp index 36ddac350..de45450a1 100644 --- a/src/object/object-set.cpp +++ b/src/object/object-set.cpp @@ -21,7 +21,7 @@ namespace Inkscape { bool ObjectSet::add(SPObject* object, bool nosignal) { - g_return_val_if_fail(object != NULL, false); + g_return_val_if_fail(object != nullptr, false); g_return_val_if_fail(SP_IS_OBJECT(object), false); // any ancestor is in the set - do nothing @@ -43,7 +43,7 @@ bool ObjectSet::add(SPObject* object, bool nosignal) { } bool ObjectSet::remove(SPObject* object) { - g_return_val_if_fail(object != NULL, false); + g_return_val_if_fail(object != nullptr, false); g_return_val_if_fail(SP_IS_OBJECT(object), false); // object is the top of subtree @@ -65,7 +65,7 @@ bool ObjectSet::remove(SPObject* object) { } bool ObjectSet::includes(SPObject *object) { - g_return_val_if_fail(object != NULL, false); + g_return_val_if_fail(object != nullptr, false); g_return_val_if_fail(SP_IS_OBJECT(object), false); return _container.get<hashed>().find(object) != _container.get<hashed>().end(); @@ -206,7 +206,7 @@ SPItem *ObjectSet::largestItem(CompareSize compare) { SPItem *ObjectSet::_sizeistItem(bool sml, CompareSize compare) { auto items = this->items(); gdouble max = sml ? 1e18 : 0; - SPItem *ist = NULL; + SPItem *ist = nullptr; for (auto i = items.begin(); i != items.end(); ++i) { Geom::OptRect obox = SP_ITEM(*i)->documentPreferredBounds(); diff --git a/src/object/object-set.h b/src/object/object-set.h index f9f02a213..d07ee2193 100644 --- a/src/object/object-set.h +++ b/src/object/object-set.h @@ -334,7 +334,7 @@ public: * Returns a list of all 3D boxes in the current selection which are associated to @c * persp. If @c pers is @c NULL, return all selected boxes. */ - std::list<SPBox3D *> const box3DList(Persp3D *persp = NULL); + std::list<SPBox3D *> const box3DList(Persp3D *persp = nullptr); /** * Returns the desktop the selection is bound to diff --git a/src/object/persp3d-reference.cpp b/src/object/persp3d-reference.cpp index 49510764e..c1e6526bb 100644 --- a/src/object/persp3d-reference.cpp +++ b/src/object/persp3d-reference.cpp @@ -17,9 +17,9 @@ static void persp3dreference_source_modified(SPObject *iSource, guint flags, Per Persp3DReference::Persp3DReference(SPObject* i_owner) : URIReference(i_owner) { owner=i_owner; - persp_href = NULL; - persp_repr = NULL; - persp = NULL; + persp_href = nullptr; + persp_repr = nullptr; + persp = nullptr; _changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(persp3dreference_href_changed), this)); // listening to myself, this should be virtual instead } @@ -44,14 +44,14 @@ void Persp3DReference::unlink(void) { g_free(persp_href); - persp_href = NULL; + persp_href = nullptr; detach(); } void Persp3DReference::start_listening(Persp3D* to) { - if ( to == NULL ) { + if ( to == nullptr ) { return; } persp = to; @@ -63,13 +63,13 @@ Persp3DReference::start_listening(Persp3D* to) void Persp3DReference::quit_listening(void) { - if ( persp == NULL ) { + if ( persp == nullptr ) { return; } _modified_connection.disconnect(); _delete_connection.disconnect(); - persp_repr = NULL; - persp = NULL; + persp_repr = nullptr; + persp = nullptr; } static void diff --git a/src/object/persp3d.cpp b/src/object/persp3d.cpp index ca39447a1..8020d0221 100644 --- a/src/object/persp3d.cpp +++ b/src/object/persp3d.cpp @@ -39,17 +39,17 @@ static int global_counter = 0; Persp3DImpl::Persp3DImpl() : tmat (Proj::TransfMat3x4 ()), - document (NULL) + document (nullptr) { my_counter = global_counter++; } static Inkscape::XML::NodeEventVector const persp3d_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ persp3d_on_repr_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; @@ -192,7 +192,7 @@ Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {// proj_origin = dup->tmat.column (Proj::W); } - gchar *str = NULL; + gchar *str = nullptr; str = proj_vp_x.coord_string(); repr->setAttribute("inkscape:vp_x", str); g_free (str); @@ -207,7 +207,7 @@ Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {// g_free (str); /* Append the new persp3d to defs */ - defs->getRepr()->addChild(repr, NULL); + defs->getRepr()->addChild(repr, nullptr); Inkscape::GC::release(repr); return reinterpret_cast<Persp3D *>( defs->get_child_by_repr(repr) ); @@ -215,7 +215,7 @@ Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {// Persp3D *persp3d_document_first_persp(SPDocument *document) { - Persp3D *first = 0; + Persp3D *first = nullptr; for (auto& child: document->getDefs()->children) { if (SP_IS_PERSP3D(&child)) { first = SP_PERSP3D(&child); diff --git a/src/object/persp3d.h b/src/object/persp3d.h index eef0ff5b6..bcbc5c601 100644 --- a/src/object/persp3d.h +++ b/src/object/persp3d.h @@ -105,7 +105,7 @@ std::list<SPBox3D *> persp3d_list_of_boxes(Persp3D *persp); bool persp3d_perspectives_coincide(Persp3D const *lhs, Persp3D const *rhs); void persp3d_absorb(Persp3D *persp1, Persp3D *persp2); -Persp3D * persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup = NULL); +Persp3D * persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup = nullptr); Persp3D * persp3d_document_first_persp (SPDocument *document); bool persp3d_has_all_boxes_in_selection (Persp3D *persp, Inkscape::ObjectSet *set); diff --git a/src/object/sp-anchor.cpp b/src/object/sp-anchor.cpp index b40f53ee1..3baa7b7ca 100644 --- a/src/object/sp-anchor.cpp +++ b/src/object/sp-anchor.cpp @@ -23,10 +23,10 @@ #include "document.h" SPAnchor::SPAnchor() : SPGroup() { - this->href = NULL; - this->type = NULL; - this->title = NULL; - this->page = NULL; + this->href = nullptr; + this->type = nullptr; + this->title = nullptr; + this->page = nullptr; } SPAnchor::~SPAnchor() { @@ -48,19 +48,19 @@ void SPAnchor::build(SPDocument *document, Inkscape::XML::Node *repr) { void SPAnchor::release() { if (this->href) { g_free(this->href); - this->href = NULL; + this->href = nullptr; } if (this->type) { g_free(this->type); - this->type = NULL; + this->type = nullptr; } if (this->title) { g_free(this->title); - this->title = NULL; + this->title = nullptr; } if (this->page) { g_free(this->page); - this->page = NULL; + this->page = nullptr; } SPGroup::release(); diff --git a/src/object/sp-clippath.cpp b/src/object/sp-clippath.cpp index 4afbf7e51..3ef849c14 100644 --- a/src/object/sp-clippath.cpp +++ b/src/object/sp-clippath.cpp @@ -45,7 +45,7 @@ SPClipPath::SPClipPath() : SPObjectGroup() { this->clipPathUnits_set = FALSE; this->clipPathUnits = SP_CONTENT_UNITS_USERSPACEONUSE; - this->display = NULL; + this->display = nullptr; } SPClipPath::~SPClipPath() { @@ -111,7 +111,7 @@ void SPClipPath::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* re SPObject *ochild = this->document->getObjectByRepr(child); if (SP_IS_ITEM(ochild)) { - for (SPClipPathView *v = this->display; v != NULL; v = v->next) { + for (SPClipPathView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingItem *ac = SP_ITEM(ochild)->invoke_show(v->arenaitem->drawing(), v->key, SP_ITEM_REFERENCE_FLAGS); if (ac) { @@ -142,7 +142,7 @@ void SPClipPath::update(SPCtx* ctx, unsigned int flags) { sp_object_unref(child); } - for (SPClipPathView *v = this->display; v != NULL; v = v->next) { + for (SPClipPathView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); if (this->clipPathUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX && v->bbox) { @@ -218,7 +218,7 @@ void SPClipPath::hide(unsigned int key) { SP_ITEM(&child)->invoke_hide(key); } } - for (SPClipPathView *v = display; v != NULL; v = v->next) { + for (SPClipPathView *v = display; v != nullptr; v = v->next) { if (v->key == key) { /* We simply unref and let item to manage this in handler */ display = sp_clippath_view_list_remove(display, v); @@ -228,7 +228,7 @@ void SPClipPath::hide(unsigned int key) { } void SPClipPath::setBBox(unsigned int key, Geom::OptRect const &bbox) { - for (SPClipPathView *v = display; v != NULL; v = v->next) { + for (SPClipPathView *v = display; v != nullptr; v = v->next) { if (v->key == key) { v->bbox = bbox; break; diff --git a/src/object/sp-clippath.h b/src/object/sp-clippath.h index e2c60789a..57c3cf855 100644 --- a/src/object/sp-clippath.h +++ b/src/object/sp-clippath.h @@ -95,11 +95,11 @@ protected: char const * owner_clippath = ""; char const * obj_name = ""; char const * obj_id = ""; - if (owner_repr != NULL) { + if (owner_repr != nullptr) { owner_name = owner_repr->name(); owner_clippath = owner_repr->attribute("clippath"); } - if (obj_repr != NULL) { + if (obj_repr != nullptr) { obj_name = obj_repr->name(); obj_id = obj_repr->attribute("id"); } diff --git a/src/object/sp-conn-end-pair.cpp b/src/object/sp-conn-end-pair.cpp index b810df315..f05b211da 100644 --- a/src/object/sp-conn-end-pair.cpp +++ b/src/object/sp-conn-end-pair.cpp @@ -28,7 +28,7 @@ SPConnEndPair::SPConnEndPair(SPPath *const owner) : _path(owner) - , _connRef(NULL) + , _connRef(nullptr) , _connType(SP_CONNECTOR_NOAVOID) , _connCurvature(0.0) , _transformed_connection() @@ -46,7 +46,7 @@ SPConnEndPair::~SPConnEndPair() { for (unsigned handle_ix = 0; handle_ix < 2; ++handle_ix) { delete this->_connEnd[handle_ix]; - this->_connEnd[handle_ix] = NULL; + this->_connEnd[handle_ix] = nullptr; } } @@ -57,18 +57,18 @@ void SPConnEndPair::release() this->_connEnd[handle_ix]->_delete_connection.disconnect(); this->_connEnd[handle_ix]->_transformed_connection.disconnect(); g_free(this->_connEnd[handle_ix]->href); - this->_connEnd[handle_ix]->href = NULL; + this->_connEnd[handle_ix]->href = nullptr; this->_connEnd[handle_ix]->ref.detach(); } // If the document is being destroyed then the router instance // and the ConnRefs will have been destroyed with it. - const bool routerInstanceExists = (_path->document->router != NULL); + const bool routerInstanceExists = (_path->document->router != nullptr); if (_connRef && routerInstanceExists) { _connRef->router()->deleteConnector(_connRef); } - _connRef = NULL; + _connRef = nullptr; _transformed_connection.disconnect(); } @@ -116,14 +116,14 @@ void SPConnEndPair::setAttr(unsigned const key, gchar const *const value) if (_connRef) { _connRef->router()->deleteConnector(_connRef); - _connRef = NULL; + _connRef = nullptr; _transformed_connection.disconnect(); } } break; case SP_ATTR_CONNECTOR_CURVATURE: if (value) { - _connCurvature = g_strtod(value, NULL); + _connCurvature = g_strtod(value, nullptr); if (_connRef && _connRef->isInitialised()) { // Redraw the connector, but only if it has been initialised. sp_conn_reroute_path(_path); @@ -167,7 +167,7 @@ void SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const { if (SP_GROUP(h2attItem[h])->getItemCount() == 0) { // This group is empty, so detach. sp_conn_end_detach(_path, h); - h2attItem[h] = NULL; + h2attItem[h] = nullptr; } } } @@ -176,7 +176,7 @@ void SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const { void SPConnEndPair::getEndpoints(Geom::Point endPts[]) const { SPCurve const *curve = _path->getCurveForEdit(true); - SPItem *h2attItem[2] = {0}; + SPItem *h2attItem[2] = {nullptr}; getAttachedItems(h2attItem); Geom::Affine i2d = _path->i2doc_affine(); @@ -213,7 +213,7 @@ bool SPConnEndPair::isOrthogonal() const static void redrawConnectorCallback(void *ptr) { SPPath *path = SP_PATH(ptr); - if (path->document == NULL) { + if (path->document == nullptr) { // This can happen when the document is being destroyed. return; } @@ -230,7 +230,7 @@ void SPConnEndPair::rerouteFromManipulation() void SPConnEndPair::update() { if (_connType != SP_CONNECTOR_NOAVOID) { - g_assert(_connRef != NULL); + g_assert(_connRef != nullptr); if (!_connRef->isInitialised()) { _updateEndPoints(); _connRef->setCallback(&redrawConnectorCallback, _path); diff --git a/src/object/sp-conn-end.cpp b/src/object/sp-conn-end.cpp index 996d8499a..d0c48edd3 100644 --- a/src/object/sp-conn-end.cpp +++ b/src/object/sp-conn-end.cpp @@ -18,7 +18,7 @@ static void change_endpts(SPCurve *const curve, double const endPos[2]); SPConnEnd::SPConnEnd(SPObject *const owner) : ref(owner) - , href(NULL) + , href(nullptr) // Default to center connection endpoint , _changed_connection() , _delete_connection() @@ -31,7 +31,7 @@ static SPObject const *get_nearest_common_ancestor(SPObject const *const obj, SP { SPObject const *anc_sofar = obj; for (unsigned i = 0; i < 2; ++i) { - if ( objs[i] != NULL ) { + if ( objs[i] != nullptr ) { anc_sofar = anc_sofar->nearestCommonAncestor(objs[i]); } } @@ -141,7 +141,7 @@ static void sp_conn_get_route_and_redraw(SPPath *const path, const bool updatePa return; } - SPItem *h2attItem[2] = {0}; + SPItem *h2attItem[2] = {nullptr}; path->connEndPair.getAttachedItems(h2attItem); SPObject const *const ancestor = get_nearest_common_ancestor(path, h2attItem); @@ -221,13 +221,13 @@ static void sp_conn_end_deleted(SPObject *, SPObject *const owner, unsigned cons { char const * const attrs[] = { "inkscape:connection-start", "inkscape:connection-end"}; - owner->getRepr()->setAttribute(attrs[handle_ix], NULL); + owner->getRepr()->setAttribute(attrs[handle_ix], nullptr); /* I believe this will trigger sp_conn_end_href_changed. */ } void sp_conn_end_detach(SPObject *const owner, unsigned const handle_ix) { - sp_conn_end_deleted(NULL, owner, handle_ix); + sp_conn_end_deleted(nullptr, owner, handle_ix); } void SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/) @@ -255,7 +255,7 @@ void SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/) if (!validRef) { ref.detach(); g_free(href); - href = NULL; + href = nullptr; } } @@ -263,7 +263,7 @@ void SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/) void sp_conn_end_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPConnEnd *connEndPtr, SPPath *const path, unsigned const handle_ix) { - g_return_if_fail(connEndPtr != NULL); + g_return_if_fail(connEndPtr != nullptr); SPConnEnd &connEnd = *connEndPtr; connEnd._delete_connection.disconnect(); connEnd._transformed_connection.disconnect(); diff --git a/src/object/sp-defs.cpp b/src/object/sp-defs.cpp index 619a27c0f..4fb3e6688 100644 --- a/src/object/sp-defs.cpp +++ b/src/object/sp-defs.cpp @@ -75,13 +75,13 @@ Inkscape::XML::Node* SPDefs::write(Inkscape::XML::Document *xml_doc, Inkscape::X std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags); if (crepr) { l.push_back(crepr); } } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { diff --git a/src/object/sp-ellipse.cpp b/src/object/sp-ellipse.cpp index 74ade912c..f30a06ca1 100644 --- a/src/object/sp-ellipse.cpp +++ b/src/object/sp-ellipse.cpp @@ -281,11 +281,11 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I case SP_GENERIC_ELLIPSE_UNDEFINED: case SP_GENERIC_ELLIPSE_ARC: - repr->setAttribute("cx", NULL ); - repr->setAttribute("cy", NULL ); - repr->setAttribute("rx", NULL ); - repr->setAttribute("ry", NULL ); - repr->setAttribute("r", NULL ); + repr->setAttribute("cx", nullptr ); + repr->setAttribute("cy", nullptr ); + repr->setAttribute("rx", nullptr ); + repr->setAttribute("ry", nullptr ); + repr->setAttribute("r", nullptr ); if (flags & SP_OBJECT_WRITE_EXT) { @@ -302,7 +302,7 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I switch ( arc_type ) { case SP_GENERIC_ELLIPSE_ARC_TYPE_SLICE: - repr->setAttribute("sodipodi:open", NULL); // For backwards compat. + repr->setAttribute("sodipodi:open", nullptr); // For backwards compat. repr->setAttribute("sodipodi:arc-type", "slice"); break; case SP_GENERIC_ELLIPSE_ARC_TYPE_CHORD: @@ -318,10 +318,10 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I std::cerr << "SPGenericEllipse::write: unknown arc-type." << std::endl; } } else { - repr->setAttribute("sodipodi:end", NULL); - repr->setAttribute("sodipodi:start", NULL); - repr->setAttribute("sodipodi:open", NULL); - repr->setAttribute("sodipodi:arc-type", NULL); + repr->setAttribute("sodipodi:end", nullptr); + repr->setAttribute("sodipodi:start", nullptr); + repr->setAttribute("sodipodi:open", nullptr); + repr->setAttribute("sodipodi:arc-type", nullptr); } } @@ -333,18 +333,18 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I sp_repr_set_svg_length(repr, "cx", cx); sp_repr_set_svg_length(repr, "cy", cy); sp_repr_set_svg_length(repr, "r", rx); - repr->setAttribute("rx", NULL ); - repr->setAttribute("ry", NULL ); - repr->setAttribute("sodipodi:cx", NULL ); - repr->setAttribute("sodipodi:cy", NULL ); - repr->setAttribute("sodipodi:rx", NULL ); - repr->setAttribute("sodipodi:ry", NULL ); - repr->setAttribute("sodipodi:end", NULL ); - repr->setAttribute("sodipodi:start", NULL ); - repr->setAttribute("sodipodi:open", NULL ); - repr->setAttribute("sodipodi:arc-type", NULL); - repr->setAttribute("sodipodi:type", NULL ); - repr->setAttribute("d", NULL ); + repr->setAttribute("rx", nullptr ); + repr->setAttribute("ry", nullptr ); + repr->setAttribute("sodipodi:cx", nullptr ); + repr->setAttribute("sodipodi:cy", nullptr ); + repr->setAttribute("sodipodi:rx", nullptr ); + repr->setAttribute("sodipodi:ry", nullptr ); + repr->setAttribute("sodipodi:end", nullptr ); + repr->setAttribute("sodipodi:start", nullptr ); + repr->setAttribute("sodipodi:open", nullptr ); + repr->setAttribute("sodipodi:arc-type", nullptr); + repr->setAttribute("sodipodi:type", nullptr ); + repr->setAttribute("d", nullptr ); break; case SP_GENERIC_ELLIPSE_ELLIPSE: @@ -352,17 +352,17 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I sp_repr_set_svg_length(repr, "cy", cy); sp_repr_set_svg_length(repr, "rx", rx); sp_repr_set_svg_length(repr, "ry", ry); - repr->setAttribute("r", NULL ); - repr->setAttribute("sodipodi:cx", NULL ); - repr->setAttribute("sodipodi:cy", NULL ); - repr->setAttribute("sodipodi:rx", NULL ); - repr->setAttribute("sodipodi:ry", NULL ); - repr->setAttribute("sodipodi:end", NULL ); - repr->setAttribute("sodipodi:start", NULL ); - repr->setAttribute("sodipodi:open", NULL ); - repr->setAttribute("sodipodi:arc-type", NULL); - repr->setAttribute("sodipodi:type", NULL ); - repr->setAttribute("d", NULL ); + repr->setAttribute("r", nullptr ); + repr->setAttribute("sodipodi:cx", nullptr ); + repr->setAttribute("sodipodi:cy", nullptr ); + repr->setAttribute("sodipodi:rx", nullptr ); + repr->setAttribute("sodipodi:ry", nullptr ); + repr->setAttribute("sodipodi:end", nullptr ); + repr->setAttribute("sodipodi:start", nullptr ); + repr->setAttribute("sodipodi:open", nullptr ); + repr->setAttribute("sodipodi:arc-type", nullptr); + repr->setAttribute("sodipodi:type", nullptr ); + repr->setAttribute("d", nullptr ); break; default: @@ -434,7 +434,7 @@ void SPGenericEllipse::set_shape() this->normalize(); - SPCurve *c = NULL; + SPCurve *c = nullptr; // For simplicity, we use a circle with center (0, 0) and radius 1 for our calculations. Geom::Circle circle(0, 0, 1); @@ -663,7 +663,7 @@ bool SPGenericEllipse::set_elliptical_path_attribute(Inkscape::XML::Node *repr) g_free(d); } else { - repr->setAttribute("d", NULL); + repr->setAttribute("d", nullptr); } return true; diff --git a/src/object/sp-factory.cpp b/src/object/sp-factory.cpp index a540399c7..09ef89138 100644 --- a/src/object/sp-factory.cpp +++ b/src/object/sp-factory.cpp @@ -93,7 +93,7 @@ SPObject *SPFactory::createObject(std::string const& id) { - SPObject *ret = NULL; + SPObject *ret = nullptr; if (id == "inkscape:box3d") ret = new SPBox3D; diff --git a/src/object/sp-filter.cpp b/src/object/sp-filter.cpp index 6cb4f8e5d..a77ef9e24 100644 --- a/src/object/sp-filter.cpp +++ b/src/object/sp-filter.cpp @@ -46,7 +46,7 @@ SPFilter::SPFilter() : SPObject(), filterUnits(SP_FILTER_UNITS_OBJECTBOUNDINGBOX), filterUnits_set(FALSE), primitiveUnits(SP_FILTER_UNITS_USERSPACEONUSE), primitiveUnits_set(FALSE), filterRes(NumberOptNumber()), - _renderer(NULL), _image_name(new std::map<gchar *, int, ltstr>), _image_number_next(0) + _renderer(nullptr), _image_name(new std::map<gchar *, int, ltstr>), _image_number_next(0) { this->href = new SPFilterReference(this); this->href->changedSignal().connect(sigc::bind(sigc::ptr_fun(filter_ref_changed), this)); @@ -103,7 +103,7 @@ void SPFilter::release() { this->modified_connection.disconnect(); this->href->detach(); delete this->href; - this->href = NULL; + this->href = nullptr; } for (map<gchar *, int, ltstr>::const_iterator i = this->_image_name->begin() ; i != this->_image_name->end() ; ++i) { @@ -251,7 +251,7 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node *crepr = child.updateRepr(doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(doc, nullptr, flags); if (crepr) { l.push_back(crepr); @@ -259,7 +259,7 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -293,25 +293,25 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML if (this->x._set) { sp_repr_set_svg_double(repr, "x", this->x.computed); } else { - repr->setAttribute("x", NULL); + repr->setAttribute("x", nullptr); } if (this->y._set) { sp_repr_set_svg_double(repr, "y", this->y.computed); } else { - repr->setAttribute("y", NULL); + repr->setAttribute("y", nullptr); } if (this->width._set) { sp_repr_set_svg_double(repr, "width", this->width.computed); } else { - repr->setAttribute("width", NULL); + repr->setAttribute("width", nullptr); } if (this->height._set) { sp_repr_set_svg_double(repr, "height", this->height.computed); } else { - repr->setAttribute("height", NULL); + repr->setAttribute("height", nullptr); } if (this->filterRes.getNumber()>=0) { @@ -319,7 +319,7 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML repr->setAttribute("filterRes", tmp); g_free(tmp); } else { - repr->setAttribute("filterRes", NULL); + repr->setAttribute("filterRes", nullptr); } if (this->href->getURI()) { @@ -379,8 +379,8 @@ void SPFilter::remove_child(Inkscape::XML::Node *child) { void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr_filter) { - g_assert(sp_filter != NULL); - g_assert(nr_filter != NULL); + g_assert(sp_filter != nullptr); + g_assert(nr_filter != nullptr); sp_filter->_renderer = nr_filter; @@ -404,7 +404,7 @@ void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr for(auto& primitive_obj: sp_filter->children) { if (SP_IS_FILTER_PRIMITIVE(&primitive_obj)) { SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(&primitive_obj); - g_assert(primitive != NULL); + g_assert(primitive != nullptr); // if (((SPFilterPrimitiveClass*) G_OBJECT_GET_CLASS(primitive))->build_renderer) { // ((SPFilterPrimitiveClass *) G_OBJECT_GET_CLASS(primitive))->build_renderer(primitive, nr_filter); @@ -417,7 +417,7 @@ void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr } int sp_filter_primitive_count(SPFilter *filter) { - g_assert(filter != NULL); + g_assert(filter != nullptr); int count = 0; for(auto& primitive_obj: filter->children) { @@ -475,7 +475,7 @@ gchar const *sp_filter_name_for_image(SPFilter const *filter, int const image) { break; case Inkscape::Filters::NR_FILTER_SLOT_NOT_SET: case Inkscape::Filters::NR_FILTER_UNNAMED_SLOT: - return 0; + return nullptr; break; default: for (map<gchar *, int, ltstr>::const_iterator i @@ -486,11 +486,11 @@ gchar const *sp_filter_name_for_image(SPFilter const *filter, int const image) { } } } - return 0; + return nullptr; } Glib::ustring sp_filter_get_new_result_name(SPFilter *filter) { - g_assert(filter != NULL); + g_assert(filter != nullptr); int largest = 0; for(auto& primitive_obj: filter->children) { diff --git a/src/object/sp-flowdiv.cpp b/src/object/sp-flowdiv.cpp index 002fcff85..d79ff349d 100644 --- a/src/object/sp-flowdiv.cpp +++ b/src/object/sp-flowdiv.cpp @@ -87,19 +87,19 @@ void SPFlowdiv::set(unsigned int key, const gchar* value) { Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = xml_doc->createElement("svg:flowDiv"); } std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node* c_repr = NULL; + Inkscape::XML::Node* c_repr = nullptr; if ( SP_IS_FLOWTSPAN (&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_FLOWPARA(&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_STRING(&child) ) { c_repr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str()); } @@ -109,7 +109,7 @@ Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape } } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -210,19 +210,19 @@ void SPFlowtspan::set(unsigned int key, const gchar* value) { Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags&SP_OBJECT_WRITE_BUILD ) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = xml_doc->createElement("svg:flowSpan"); } std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node* c_repr = NULL; + Inkscape::XML::Node* c_repr = nullptr; if ( SP_IS_FLOWTSPAN(&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_FLOWPARA(&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_STRING(&child) ) { c_repr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str()); } @@ -232,7 +232,7 @@ Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inksca } } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -333,19 +333,19 @@ void SPFlowpara::set(unsigned int key, const gchar* value) { Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags&SP_OBJECT_WRITE_BUILD ) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = xml_doc->createElement("svg:flowPara"); } std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node* c_repr = NULL; + Inkscape::XML::Node* c_repr = nullptr; if ( SP_IS_FLOWTSPAN(&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_FLOWPARA(&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_STRING(&child) ) { c_repr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str()); } @@ -356,7 +356,7 @@ Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscap } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -403,7 +403,7 @@ void SPFlowline::modified(unsigned int flags) { Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = xml_doc->createElement("svg:flowLine"); } } @@ -440,7 +440,7 @@ void SPFlowregionbreak::modified(unsigned int flags) { Inkscape::XML::Node *SPFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = xml_doc->createElement("svg:flowLine"); } } diff --git a/src/object/sp-flowregion.cpp b/src/object/sp-flowregion.cpp index 6640d93c2..3e7732e1a 100644 --- a/src/object/sp-flowregion.cpp +++ b/src/object/sp-flowregion.cpp @@ -67,7 +67,7 @@ void SPFlowregion::update(SPCtx *ctx, unsigned int flags) { } for (auto child:l) { - g_assert(child != NULL); + g_assert(child != nullptr); SPItem *item = dynamic_cast<SPItem *>(child); if (childflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { @@ -97,7 +97,7 @@ void SPFlowregion::UpdateComputed(void) computed.clear(); for (auto& child: children) { - Shape *shape = 0; + Shape *shape = nullptr; GetDest(&child, &shape); computed.push_back(shape); } @@ -118,7 +118,7 @@ void SPFlowregion::modified(guint flags) { } for (auto child:l) { - g_assert(child != NULL); + g_assert(child != nullptr); if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); @@ -130,14 +130,14 @@ void SPFlowregion::modified(guint flags) { Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = xml_doc->createElement("svg:flowRegion"); } std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { if ( !dynamic_cast<SPTitle *>(&child) && !dynamic_cast<SPDesc *>(&child) ) { - Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags); if (crepr) { l.push_back(crepr); @@ -146,7 +146,7 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc } for (auto i = l.rbegin(); i != l.rend(); ++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } @@ -170,13 +170,13 @@ const char* SPFlowregion::displayName() const { } SPFlowregionExclude::SPFlowregionExclude() : SPItem() { - this->computed = NULL; + this->computed = nullptr; } SPFlowregionExclude::~SPFlowregionExclude() { if (this->computed) { delete this->computed; - this->computed = NULL; + this->computed = nullptr; } } @@ -215,7 +215,7 @@ void SPFlowregionExclude::update(SPCtx *ctx, unsigned int flags) { } for(auto child:l) { - g_assert(child != NULL); + g_assert(child != nullptr); if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { SPItem *item = dynamic_cast<SPItem *>(child); @@ -240,7 +240,7 @@ void SPFlowregionExclude::UpdateComputed(void) { if (computed) { delete computed; - computed = NULL; + computed = nullptr; } for (auto& child: children) { @@ -263,7 +263,7 @@ void SPFlowregionExclude::modified(guint flags) { } for (auto child:l) { - g_assert(child != NULL); + g_assert(child != nullptr); if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); @@ -275,14 +275,14 @@ void SPFlowregionExclude::modified(guint flags) { Inkscape::XML::Node *SPFlowregionExclude::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = xml_doc->createElement("svg:flowRegionExclude"); } std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags); if (crepr) { l.push_back(crepr); @@ -290,7 +290,7 @@ Inkscape::XML::Node *SPFlowregionExclude::write(Inkscape::XML::Document *xml_doc } for (auto i = l.rbegin(); i != l.rend(); ++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } @@ -315,7 +315,7 @@ const char* SPFlowregionExclude::displayName() const { static void UnionShape(Shape **base_shape, Shape const *add_shape) { - if (*base_shape == NULL) + if (*base_shape == nullptr) *base_shape = new Shape; if ( (*base_shape)->hasEdges() == false ) { (*base_shape)->Copy(const_cast<Shape*>(add_shape)); @@ -329,14 +329,14 @@ static void UnionShape(Shape **base_shape, Shape const *add_shape) static void GetDest(SPObject* child,Shape **computed) { - if ( child == NULL ) return; + if ( child == nullptr ) return; - SPCurve *curve=NULL; + SPCurve *curve=nullptr; Geom::Affine tr_mat; SPObject* u_child = child; SPItem *item = dynamic_cast<SPItem *>(u_child); - g_assert(item != NULL); + g_assert(item != nullptr); SPUse *use = dynamic_cast<SPUse *>(item); if ( use ) { u_child = use->child; diff --git a/src/object/sp-flowtext.cpp b/src/object/sp-flowtext.cpp index 28b6b9575..3811f4072 100644 --- a/src/object/sp-flowtext.cpp +++ b/src/object/sp-flowtext.cpp @@ -74,7 +74,7 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) { } for (auto child:l) { - g_assert(child != NULL); + g_assert(child != nullptr); if (childflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { SPItem *item = dynamic_cast<SPItem *>(child); @@ -97,7 +97,7 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) { Geom::OptRect pbox = this->geometricBounds(); - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); this->_clearFlow(g); g->setStyle(this->style); @@ -107,7 +107,7 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) { } void SPFlowtext::modified(unsigned int flags) { - SPObject *region = NULL; + SPObject *region = nullptr; if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -119,7 +119,7 @@ void SPFlowtext::modified(unsigned int flags) { if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) { Geom::OptRect pbox = geometricBounds(); - for (SPItemView* v = display; v != NULL; v = v->next) { + for (SPItemView* v = display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); _clearFlow(g); g->setStyle(style); @@ -156,9 +156,9 @@ void SPFlowtext::set(unsigned int key, const gchar* value) { //XML Tree being directly used while it shouldn't be. SPCSSAttr *opts = sp_repr_css_attr(this->getRepr(), "inkscape:layoutOptions"); { - gchar const *val = sp_repr_css_property(opts, "justification", NULL); + gchar const *val = sp_repr_css_property(opts, "justification", nullptr); - if (val != NULL && !this->style->text_align.set) { + if (val != nullptr && !this->style->text_align.set) { if ( strcmp(val, "0") == 0 || strcmp(val, "false") == 0 ) { this->style->text_align.value = SP_CSS_TEXT_ALIGN_LEFT; } else { @@ -187,12 +187,12 @@ void SPFlowtext::set(unsigned int key, const gchar* value) { } */ { // This would probably translate to padding-left, if SPStyle had it. - gchar const *val = sp_repr_css_property(opts, "par-indent", NULL); + gchar const *val = sp_repr_css_property(opts, "par-indent", nullptr); - if ( val == NULL ) { + if ( val == nullptr ) { this->par_indent = 0.0; } else { - this->par_indent = g_ascii_strtod(val, NULL); + this->par_indent = g_ascii_strtod(val, nullptr); } } @@ -209,17 +209,17 @@ void SPFlowtext::set(unsigned int key, const gchar* value) { Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { - if ( repr == NULL ) { + if ( repr == nullptr ) { repr = doc->createElement("svg:flowRoot"); } std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node *c_repr = NULL; + Inkscape::XML::Node *c_repr = nullptr; if ( dynamic_cast<SPFlowdiv *>(&child) || dynamic_cast<SPFlowpara *>(&child) || dynamic_cast<SPFlowregion *>(&child) || dynamic_cast<SPFlowregionExclude *>(&child)) { - c_repr = child.updateRepr(doc, NULL, flags); + c_repr = child.updateRepr(doc, nullptr, flags); } if ( c_repr ) { @@ -228,7 +228,7 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -291,7 +291,7 @@ void SPFlowtext::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inksca // of this point depending on the text alignment (left vs. right) Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) this); - if (layout != NULL && layout->outputExists()) { + if (layout != nullptr && layout->outputExists()) { boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { @@ -314,7 +314,7 @@ Inkscape::DrawingItem* SPFlowtext::show(Inkscape::Drawing &drawing, unsigned int } void SPFlowtext::hide(unsigned int key) { - for (SPItemView* v = this->display; v != NULL; v = v->next) { + for (SPItemView* v = this->display; v != nullptr; v = v->next) { if (v->key == key) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); this->_clearFlow(g); @@ -354,7 +354,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, // emulate par-indent with the first char's kern SPObject *t = root; - SPFlowtext *ft = NULL; + SPFlowtext *ft = nullptr; while (t && !ft) { ft = dynamic_cast<SPFlowtext *>(t); t = t->parent; @@ -378,7 +378,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, } else { layout.appendControlCode(Inkscape::Text::Layout::PARAGRAPH_BREAK, *pending_line_break_object); } - *pending_line_break_object = NULL; + *pending_line_break_object = nullptr; } for (auto& child: root->children) { @@ -390,7 +390,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, else { layout.appendControlCode(Inkscape::Text::Layout::PARAGRAPH_BREAK, *pending_line_break_object); } - *pending_line_break_object = NULL; + *pending_line_break_object = nullptr; } if (with_indent) { layout.appendText(str->string, root->style, &child, &pi); @@ -455,7 +455,7 @@ void SPFlowtext::rebuildLayout() layout.clear(); Shape *exclusion_shape = _buildExclusionShape(); - SPObject *pending_line_break_object = NULL; + SPObject *pending_line_break_object = nullptr; _buildLayoutInput(this, exclusion_shape, &shapes, &pending_line_break_object); delete exclusion_shape; layout.calculateFlow(); @@ -472,7 +472,7 @@ void SPFlowtext::_clearFlow(Inkscape::DrawingGroup *in_arena) Inkscape::XML::Node *SPFlowtext::getAsText() { if (!this->layout.outputExists()) { - return NULL; + return nullptr; } Inkscape::XML::Document *xml_doc = this->document->getReprDoc(); @@ -528,7 +528,7 @@ Inkscape::XML::Node *SPFlowtext::getAsText() sp_repr_set_svg_double(line_tspan, "y", anchor_point[Geom::Y]); } - void *rawptr = 0; + void *rawptr = nullptr; Glib::ustring::iterator span_text_start_iter; this->layout.getSourceOfCharacter(it, &rawptr, &span_text_start_iter); SPObject *source_obj = reinterpret_cast<SPObject *>(rawptr); @@ -541,7 +541,7 @@ Inkscape::XML::Node *SPFlowtext::getAsText() SPString *str = dynamic_cast<SPString *>(source_obj); if (str) { Glib::ustring *string = &(str->string); // TODO fixme: dangerous, unsafe premature-optimization - void *rawptr = 0; + void *rawptr = nullptr; Glib::ustring::iterator span_text_end_iter; this->layout.getSourceOfCharacter(it_span_end, &rawptr, &span_text_end_iter); SPObject *span_end_obj = reinterpret_cast<SPObject *>(rawptr); @@ -583,9 +583,9 @@ SPItem const *SPFlowtext::get_frame(SPItem const *after) const SPItem *SPFlowtext::get_frame(SPItem const *after) { - SPItem *frame = 0; + SPItem *frame = nullptr; - SPObject *region = 0; + SPObject *region = nullptr; for (auto& o: children) { if (dynamic_cast<SPFlowregion *>(&o)) { region = &o; @@ -599,7 +599,7 @@ SPItem *SPFlowtext::get_frame(SPItem const *after) for (auto& o: region->children) { SPItem *item = dynamic_cast<SPItem *>(&o); if (item) { - if ( (after == NULL) || past ) { + if ( (after == nullptr) || past ) { frame = item; } else { if (item == after) { @@ -619,7 +619,7 @@ SPItem *SPFlowtext::get_frame(SPItem const *after) bool SPFlowtext::has_internal_frame() const { - SPItem const *frame = get_frame(NULL); + SPItem const *frame = get_frame(nullptr); return (frame && isAncestorOf(frame) && dynamic_cast<SPRect const *>(frame)); } @@ -633,20 +633,20 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); root_repr->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create SPItem *ft_item = dynamic_cast<SPItem *>(desktop->currentLayer()->appendChildRepr(root_repr)); - g_assert(ft_item != NULL); + g_assert(ft_item != nullptr); SPObject *root_object = doc->getObjectByRepr(root_repr); - g_assert(dynamic_cast<SPFlowtext *>(root_object) != NULL); + g_assert(dynamic_cast<SPFlowtext *>(root_object) != nullptr); Inkscape::XML::Node *region_repr = xml_doc->createElement("svg:flowRegion"); root_repr->appendChild(region_repr); SPObject *region_object = doc->getObjectByRepr(region_repr); - g_assert(dynamic_cast<SPFlowregion *>(region_object) != NULL); + g_assert(dynamic_cast<SPFlowregion *>(region_object) != nullptr); Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); // FIXME: use path!!! after rects are converted to use path region_repr->appendChild(rect_repr); SPRect *rect = dynamic_cast<SPRect *>(doc->getObjectByRepr(rect_repr)); - g_assert(rect != NULL); + g_assert(rect != nullptr); p0 *= desktop->dt2doc(); p1 *= desktop->dt2doc(); @@ -665,7 +665,7 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, Inkscape::XML::Node *para_repr = xml_doc->createElement("svg:flowPara"); root_repr->appendChild(para_repr); SPObject *para_object = doc->getObjectByRepr(para_repr); - g_assert(dynamic_cast<SPFlowpara *>(para_object) != NULL); + g_assert(dynamic_cast<SPFlowpara *>(para_object) != nullptr); Inkscape::XML::Node *text = xml_doc->createTextNode(""); para_repr->appendChild(text); @@ -677,7 +677,7 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, SPItem *item = dynamic_cast<SPItem *>(desktop->currentLayer()); - g_assert(item != NULL); + g_assert(item != nullptr); ft_item->transform = item->i2doc_affine().inverse(); return ft_item; @@ -699,7 +699,7 @@ Geom::Affine SPFlowtext::set_transform (Geom::Affine const &xform) return xform; } - SPObject *region = NULL; + SPObject *region = nullptr; for (auto& o: children) { if (dynamic_cast<SPFlowregion *>(&o)) { region = &o; @@ -710,7 +710,7 @@ Geom::Affine SPFlowtext::set_transform (Geom::Affine const &xform) SPRect *rect = dynamic_cast<SPRect *>(region->firstChild()); if (rect) { rect->set_i2d_affine(xform * rect->i2dt_affine()); - rect->doWriteTransform(rect->transform, NULL, true); + rect->doWriteTransform(rect->transform, nullptr, true); } } diff --git a/src/object/sp-font-face.cpp b/src/object/sp-font-face.cpp index 52fc09ddd..754956058 100644 --- a/src/object/sp-font-face.cpp +++ b/src/object/sp-font-face.cpp @@ -275,13 +275,13 @@ SPFontFace::SPFontFace() : SPObject() { std::vector<FontFaceStretchType> stretch; stretch.push_back(SP_FONTFACE_STRETCH_NORMAL); this->font_stretch = stretch; - this->font_family = NULL; + this->font_family = nullptr; //this->font_style = ; //this->font_variant = ; //this->font_weight = ; //this->font_stretch = ; - this->font_size = NULL; + this->font_size = nullptr; //this->unicode_range = ; this->units_per_em = 1000; //this->panose_1 = ; @@ -293,8 +293,8 @@ SPFontFace::SPFontFace() : SPObject() { this->accent_height = 0; this->ascent = 0; this->descent = 0; - this->widths = NULL; - this->bbox = NULL; + this->widths = nullptr; + this->bbox = nullptr; this->ideographic = 0; this->alphabetic = 0; this->mathematical = 0; @@ -456,7 +456,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { break; case SP_ATTR_UNITS_PER_EM: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->units_per_em){ this->units_per_em = number; @@ -466,7 +466,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_STEMV: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->stemv){ this->stemv = number; @@ -476,7 +476,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_STEMH: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->stemh){ this->stemh = number; @@ -486,7 +486,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_SLOPE: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->slope){ this->slope = number; @@ -496,7 +496,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_CAP_HEIGHT: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->cap_height){ this->cap_height = number; @@ -506,7 +506,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_X_HEIGHT: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->x_height){ this->x_height = number; @@ -516,7 +516,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_ACCENT_HEIGHT: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->accent_height){ this->accent_height = number; @@ -526,7 +526,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_ASCENT: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->ascent){ this->ascent = number; @@ -536,7 +536,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_DESCENT: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->descent){ this->descent = number; @@ -546,7 +546,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_IDEOGRAPHIC: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->ideographic){ this->ideographic = number; @@ -556,7 +556,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_ALPHABETIC: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->alphabetic){ this->alphabetic = number; @@ -566,7 +566,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_MATHEMATICAL: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->mathematical){ this->mathematical = number; @@ -576,7 +576,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_HANGING: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->hanging){ this->hanging = number; @@ -586,7 +586,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_V_IDEOGRAPHIC: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->v_ideographic){ this->v_ideographic = number; @@ -596,7 +596,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_V_ALPHABETIC: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->v_alphabetic){ this->v_alphabetic = number; @@ -606,7 +606,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_V_MATHEMATICAL: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->v_mathematical){ this->v_mathematical = number; @@ -616,7 +616,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_V_HANGING: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->v_hanging){ this->v_hanging = number; @@ -626,7 +626,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_UNDERLINE_POSITION: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->underline_position){ this->underline_position = number; @@ -636,7 +636,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_UNDERLINE_THICKNESS: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->underline_thickness){ this->underline_thickness = number; @@ -646,7 +646,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_STRIKETHROUGH_POSITION: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->strikethrough_position){ this->strikethrough_position = number; @@ -656,7 +656,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_STRIKETHROUGH_THICKNESS: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->strikethrough_thickness){ this->strikethrough_thickness = number; @@ -666,7 +666,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_OVERLINE_POSITION: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->overline_position){ this->overline_position = number; @@ -676,7 +676,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) { } case SP_ATTR_OVERLINE_THICKNESS: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->overline_thickness){ this->overline_thickness = number; diff --git a/src/object/sp-font.cpp b/src/object/sp-font.cpp index a0193224c..4701e8690 100644 --- a/src/object/sp-font.cpp +++ b/src/object/sp-font.cpp @@ -84,7 +84,7 @@ void SPFont::set(unsigned int key, const gchar *value) { switch (key) { case SP_ATTR_HORIZ_ORIGIN_X: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->horiz_origin_x){ this->horiz_origin_x = number; @@ -94,7 +94,7 @@ void SPFont::set(unsigned int key, const gchar *value) { } case SP_ATTR_HORIZ_ORIGIN_Y: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->horiz_origin_y){ this->horiz_origin_y = number; @@ -104,7 +104,7 @@ void SPFont::set(unsigned int key, const gchar *value) { } case SP_ATTR_HORIZ_ADV_X: { - double number = value ? g_ascii_strtod(value, 0) : FNT_DEFAULT_ADV; + double number = value ? g_ascii_strtod(value, nullptr) : FNT_DEFAULT_ADV; if (number != this->horiz_adv_x){ this->horiz_adv_x = number; @@ -114,7 +114,7 @@ void SPFont::set(unsigned int key, const gchar *value) { } case SP_ATTR_VERT_ORIGIN_X: { - double number = value ? g_ascii_strtod(value, 0) : FNT_DEFAULT_ADV / 2.0; + double number = value ? g_ascii_strtod(value, nullptr) : FNT_DEFAULT_ADV / 2.0; if (number != this->vert_origin_x){ this->vert_origin_x = number; @@ -124,7 +124,7 @@ void SPFont::set(unsigned int key, const gchar *value) { } case SP_ATTR_VERT_ORIGIN_Y: { - double number = value ? g_ascii_strtod(value, 0) : FNT_DEFAULT_ASCENT; + double number = value ? g_ascii_strtod(value, nullptr) : FNT_DEFAULT_ASCENT; if (number != this->vert_origin_y){ this->vert_origin_y = number; @@ -134,7 +134,7 @@ void SPFont::set(unsigned int key, const gchar *value) { } case SP_ATTR_VERT_ADV_Y: { - double number = value ? g_ascii_strtod(value, 0) : FNT_UNITS_PER_EM; + double number = value ? g_ascii_strtod(value, nullptr) : FNT_UNITS_PER_EM; if (number != this->vert_adv_y){ this->vert_adv_y = number; diff --git a/src/object/sp-glyph-kerning.cpp b/src/object/sp-glyph-kerning.cpp index 66de5aed9..899bb71f6 100644 --- a/src/object/sp-glyph-kerning.cpp +++ b/src/object/sp-glyph-kerning.cpp @@ -22,10 +22,10 @@ SPGlyphKerning::SPGlyphKerning() : SPObject() //TODO: correct these values: - , u1(NULL) - , g1(NULL) - , u2(NULL) - , g2(NULL) + , u1(nullptr) + , g1(nullptr) + , u2(nullptr) + , g2(nullptr) , k(0) { } @@ -124,7 +124,7 @@ void SPGlyphKerning::set(unsigned int key, const gchar *value) } case SP_ATTR_K: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->k){ this->k = number; diff --git a/src/object/sp-glyph.cpp b/src/object/sp-glyph.cpp index 6284cbfa1..9f5f6403c 100644 --- a/src/object/sp-glyph.cpp +++ b/src/object/sp-glyph.cpp @@ -21,10 +21,10 @@ SPGlyph::SPGlyph() : SPObject() //TODO: correct these values: - , d(NULL) + , d(nullptr) , orientation(GLYPH_ORIENTATION_BOTH) , arabic_form(GLYPH_ARABIC_FORM_INITIAL) - , lang(NULL) + , lang(nullptr) , horiz_adv_x(0) , vert_origin_x(0) , vert_origin_y(0) @@ -168,7 +168,7 @@ void SPGlyph::set(unsigned int key, const gchar *value) } case SP_ATTR_HORIZ_ADV_X: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->horiz_adv_x){ this->horiz_adv_x = number; @@ -178,7 +178,7 @@ void SPGlyph::set(unsigned int key, const gchar *value) } case SP_ATTR_VERT_ORIGIN_X: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->vert_origin_x){ this->vert_origin_x = number; @@ -188,7 +188,7 @@ void SPGlyph::set(unsigned int key, const gchar *value) } case SP_ATTR_VERT_ORIGIN_Y: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->vert_origin_y){ this->vert_origin_y = number; @@ -198,7 +198,7 @@ void SPGlyph::set(unsigned int key, const gchar *value) } case SP_ATTR_VERT_ADV_Y: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->vert_adv_y){ this->vert_adv_y = number; diff --git a/src/object/sp-gradient.cpp b/src/object/sp-gradient.cpp index feaa04e0f..0dfee1385 100644 --- a/src/object/sp-gradient.cpp +++ b/src/object/sp-gradient.cpp @@ -88,8 +88,8 @@ void SPGradient::setSwatch( bool swatch ) { if ( swatch != isSwatch() ) { this->swatch = swatch; // to make isSolid() work, this happens first - gchar const* paintVal = swatch ? (isSolid() ? "solid" : "gradient") : 0; - setAttribute( "osb:paint", paintVal, 0 ); + gchar const* paintVal = swatch ? (isSolid() ? "solid" : "gradient") : nullptr; + setAttribute( "osb:paint", paintVal, nullptr ); requestModified( SP_OBJECT_MODIFIED_FLAG ); } @@ -228,7 +228,7 @@ bool SPGradient::isAligned(SPGradient *that) */ SPGradient::SPGradient() : SPPaintServer(), units(), spread(), - ref(NULL), + ref(nullptr), state(2), vector() { @@ -267,7 +267,7 @@ void SPGradient::build(SPDocument *document, Inkscape::XML::Node *repr) { // Work-around in case a swatch had been marked for immediate collection: if ( repr->attribute("osb:paint") && repr->attribute("inkscape:collect") ) { - repr->setAttribute("inkscape:collect", 0); + repr->setAttribute("inkscape:collect", nullptr); } SPPaintServer::build(document, repr); @@ -319,7 +319,7 @@ void SPGradient::release() this->modified_connection.disconnect(); this->ref->detach(); delete this->ref; - this->ref = NULL; + this->ref = nullptr; } //this->modified_connection.~connection(); @@ -402,7 +402,7 @@ void SPGradient::set(unsigned key, gchar const *value) case SP_ATTR_OSB_SWATCH: { - bool newVal = (value != 0); + bool newVal = (value != nullptr); bool modified = false; if (newVal != this->swatch) { @@ -415,7 +415,7 @@ void SPGradient::set(unsigned key, gchar const *value) Glib::ustring paintVal = ( this->hasStops() && (this->getStopCount() == 0) ) ? "solid" : "gradient"; if ( paintVal != value ) { - this->setAttribute( "osb:paint", paintVal.c_str(), 0 ); + this->setAttribute( "osb:paint", paintVal.c_str(), nullptr ); modified = true; } } @@ -479,7 +479,7 @@ void SPGradient::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *re if ( this->getStopCount() > 0 ) { gchar const * attr = this->getAttribute("osb:paint"); if ( attr && strcmp(attr, "gradient") ) { - this->setAttribute( "osb:paint", "gradient", 0 ); + this->setAttribute( "osb:paint", "gradient", nullptr ); } } } @@ -524,7 +524,7 @@ void SPGradient::remove_child(Inkscape::XML::Node *child) gchar const * attr = this->getAttribute("osb:paint"); if ( attr && strcmp(attr, "solid") ) { - this->setAttribute( "osb:paint", "solid", 0 ); + this->setAttribute( "osb:paint", "solid", nullptr ); } } @@ -617,7 +617,7 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags); if (crepr) { l.push_back(crepr); @@ -625,7 +625,7 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } @@ -677,7 +677,7 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap repr->setAttribute( "osb:paint", "gradient" ); } } else { - repr->setAttribute( "osb:paint", 0 ); + repr->setAttribute( "osb:paint", nullptr ); } #ifdef OBJECT_TRACE @@ -772,7 +772,7 @@ chase_hrefs(SPGradient *const src, bool (*match)(SPGradient const *)) if ( p2 == p1 ) { /* We've been here before, so return NULL to indicate that no matching gradient found * in the chain. */ - return NULL; + return nullptr; } } } @@ -814,7 +814,7 @@ has_units_set(SPGradient const *gr) SPGradient *SPGradient::getVector(bool force_vector) { SPGradient * src = chase_hrefs(this, has_stopsFN); - if (src == NULL) { + if (src == nullptr) { src = this; } @@ -827,7 +827,7 @@ SPGradient *SPGradient::getVector(bool force_vector) SPGradient *SPGradient::getArray(bool force_vector) { SPGradient * src = chase_hrefs(this, has_patchesFN); - if (src == NULL) { + if (src == nullptr) { src = this; } return src; @@ -870,7 +870,7 @@ sp_gradient_repr_clear_vector(SPGradient *gr) /* Collect stops from original repr */ std::vector<Inkscape::XML::Node *> l; - for (Inkscape::XML::Node *child = repr->firstChild() ; child != NULL; child = child->next() ) { + for (Inkscape::XML::Node *child = repr->firstChild() ; child != nullptr; child = child->next() ) { if (!strcmp(child->name(), "svg:stop")) { l.push_back(child); } @@ -892,7 +892,7 @@ sp_gradient_repr_clear_vector(SPGradient *gr) void sp_gradient_repr_write_vector(SPGradient *gr) { - g_return_if_fail(gr != NULL); + g_return_if_fail(gr != nullptr); g_return_if_fail(SP_IS_GRADIENT(gr)); Inkscape::XML::Document *xml_doc = gr->document->getReprDoc(); @@ -918,7 +918,7 @@ sp_gradient_repr_write_vector(SPGradient *gr) /* And insert new children from list */ for (auto i=l.rbegin();i!=l.rend();++i) { Inkscape::XML::Node *child = *i; - repr->addChild(child, NULL); + repr->addChild(child, nullptr); Inkscape::GC::release(child); } } @@ -974,7 +974,7 @@ void SPGradient::rebuildVector() vector.stops.clear(); - SPGradient *reffed = ref ? ref->getObject() : NULL; + SPGradient *reffed = ref ? ref->getObject() : nullptr; if ( !hasStops() && reffed ) { /* Copy vector from referenced gradient */ vector.built = true; // Prevent infinite recursion. @@ -1160,7 +1160,7 @@ sp_gradient_pattern_common_setup(cairo_pattern_t *cp, cairo_pattern_t * sp_gradient_create_preview_pattern(SPGradient *gr, double width) { - cairo_pattern_t *pat = NULL; + cairo_pattern_t *pat = nullptr; if (!SP_IS_MESHGRADIENT(gr)) { gr->ensureVector(); diff --git a/src/object/sp-guide.cpp b/src/object/sp-guide.cpp index 19aced5c0..eb0b27ab4 100644 --- a/src/object/sp-guide.cpp +++ b/src/object/sp-guide.cpp @@ -47,7 +47,7 @@ using std::vector; SPGuide::SPGuide() : SPObject() - , label(NULL) + , label(nullptr) , locked(0) , normal_to_line(Geom::Point(0.,1.)) , point_on_line(Geom::Point(0.,0.)) @@ -106,7 +106,7 @@ void SPGuide::set(unsigned int key, const gchar *value) { if (value) { this->label = g_strdup(value); } else { - this->label = NULL; + this->label = nullptr; } this->set_label(this->label, false); @@ -220,7 +220,7 @@ SPGuide *SPGuide::createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::P sp_repr_set_point(repr, "position", Geom::Point( newx, newy )); sp_repr_set_point(repr, "orientation", n); - SPNamedView *namedview = sp_document_namedview(doc, NULL); + SPNamedView *namedview = sp_document_namedview(doc, nullptr); if (namedview) { if (namedview->lockguides) { repr->setAttribute("inkscape:locked", "true"); @@ -299,7 +299,7 @@ void SPGuide::showSPGuide() void SPGuide::hideSPGuide(SPCanvas *canvas) { - g_assert(canvas != NULL); + g_assert(canvas != nullptr); g_assert(SP_IS_CANVAS(canvas)); for(std::vector<SPGuideLine *>::iterator it = this->views.begin(); it != this->views.end(); ++it) { if (canvas == SP_CANVAS_ITEM(*it)->canvas) { @@ -324,7 +324,7 @@ void SPGuide::hideSPGuide() void SPGuide::sensitize(SPCanvas *canvas, bool sensitive) { - g_assert(canvas != NULL); + g_assert(canvas != nullptr); g_assert(SP_IS_CANVAS(canvas)); for(std::vector<SPGuideLine *>::const_iterator it = this->views.begin(); it != this->views.end(); ++it) { @@ -479,12 +479,12 @@ char* SPGuide::description(bool const verbose) const using Geom::X; using Geom::Y; - char *descr = NULL; + char *descr = nullptr; if ( !this->document ) { // Guide has probably been deleted and no longer has an attached namedview. descr = g_strdup(_("Deleted")); } else { - SPNamedView *namedview = sp_document_namedview(this->document, NULL); + SPNamedView *namedview = sp_document_namedview(this->document, nullptr); Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(this->point_on_line[X], "px"); Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(this->point_on_line[Y], "px"); diff --git a/src/object/sp-hatch-path.cpp b/src/object/sp-hatch-path.cpp index 4497b6911..649fefe94 100644 --- a/src/object/sp-hatch-path.cpp +++ b/src/object/sp-hatch-path.cpp @@ -32,7 +32,7 @@ SPHatchPath::SPHatchPath() : offset(), _display(), - _curve(NULL), + _curve(nullptr), _continuous(false) { offset.unset(); @@ -74,7 +74,7 @@ void SPHatchPath::release() { for (ViewIterator iter = _display.begin(); iter != _display.end(); ++iter) { delete iter->arenaitem; - iter->arenaitem = NULL; + iter->arenaitem = nullptr; } SPObject::release(); @@ -94,7 +94,7 @@ void SPHatchPath::set(unsigned int key, const gchar* value) curve->unref(); } } else { - setCurve(NULL, true); + setCurve(nullptr, true); } requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -216,7 +216,7 @@ SPCurve *SPHatchPath::calculateRenderCurve(unsigned key) const } } g_assert_not_reached(); - return NULL; + return nullptr; } gdouble SPHatchPath::_repeatLength() const @@ -324,7 +324,7 @@ SPHatchPath::View::View(Inkscape::DrawingShape *arenaitem, int key) SPHatchPath::View::~View() { // remember, do not delete arenaitem here - arenaitem = NULL; + arenaitem = nullptr; } diff --git a/src/object/sp-hatch.cpp b/src/object/sp-hatch.cpp index ce6384a74..0675c66ac 100644 --- a/src/object/sp-hatch.cpp +++ b/src/object/sp-hatch.cpp @@ -34,7 +34,7 @@ SPHatch::SPHatch() : SPPaintServer(), href(), - ref(NULL), // avoiding 'this' in initializer list + ref(nullptr), // avoiding 'this' in initializer list _hatchUnits(UNITS_OBJECTBOUNDINGBOX), _hatchUnits_set(false), _hatchContentUnits(UNITS_USERSPACEONUSE), @@ -93,14 +93,14 @@ void SPHatch::release() child->hide(view_iter->key); } delete view_iter->arenaitem; - view_iter->arenaitem = NULL; + view_iter->arenaitem = nullptr; } if (ref) { _modified_connection.disconnect(); ref->detach(); delete ref; - ref = NULL; + ref = nullptr; } SPPaintServer::release(); @@ -292,7 +292,7 @@ void SPHatch::update(SPCtx* ctx, unsigned int flags) for (ChildIterator iter = children.begin(); iter != children.end(); ++iter) { SPHatchPath* child = *iter; - sp_object_ref(child, NULL); + sp_object_ref(child, nullptr); for (ViewIterator view_iter = _display.begin(); view_iter != _display.end(); ++view_iter) { Geom::OptInterval strip_extents = _calculateStripExtents(view_iter->bbox); @@ -304,7 +304,7 @@ void SPHatch::update(SPCtx* ctx, unsigned int flags) child->updateDisplay(ctx, flags); } - sp_object_unref(child, NULL); + sp_object_unref(child, nullptr); } for (ViewIterator iter = _display.begin(); iter != _display.end(); ++iter) { @@ -325,13 +325,13 @@ void SPHatch::modified(unsigned int flags) for (ChildIterator iter = children.begin(); iter != children.end(); ++iter) { SPObject *child = *iter; - sp_object_ref(child, NULL); + sp_object_ref(child, nullptr); if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } - sp_object_unref(child, NULL); + sp_object_unref(child, nullptr); } } @@ -349,8 +349,8 @@ void SPHatch::_onRefChanged(SPObject *old_ref, SPObject *ref) } if (!_hasHatchPatchChildren(this)) { - SPHatch *old_shown = NULL; - SPHatch *new_shown = NULL; + SPHatch *old_shown = nullptr; + SPHatch *new_shown = nullptr; std::vector<SPHatchPath *> oldhatchPaths; std::vector<SPHatchPath *> newhatchPaths; @@ -407,7 +407,7 @@ SPHatch *SPHatch::rootHatch() SPHatch::HatchUnits SPHatch::hatchUnits() const { HatchUnits units = _hatchUnits; - for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) { + for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) { if (pat_i->_hatchUnits_set) { units = pat_i->_hatchUnits; break; @@ -419,7 +419,7 @@ SPHatch::HatchUnits SPHatch::hatchUnits() const SPHatch::HatchUnits SPHatch::hatchContentUnits() const { HatchUnits units = _hatchContentUnits; - for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) { + for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) { if (pat_i->_hatchContentUnits_set) { units = pat_i->_hatchContentUnits; break; @@ -430,7 +430,7 @@ SPHatch::HatchUnits SPHatch::hatchContentUnits() const Geom::Affine const &SPHatch::hatchTransform() const { - for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) { + for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) { if (pat_i->_hatchTransform_set) { return pat_i->_hatchTransform; } @@ -441,7 +441,7 @@ Geom::Affine const &SPHatch::hatchTransform() const gdouble SPHatch::x() const { gdouble val = 0; - for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) { + for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) { if (pat_i->_x._set) { val = pat_i->_x.computed; break; @@ -453,7 +453,7 @@ gdouble SPHatch::x() const gdouble SPHatch::y() const { gdouble val = 0; - for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) { + for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) { if (pat_i->_y._set) { val = pat_i->_y.computed; break; @@ -465,7 +465,7 @@ gdouble SPHatch::y() const gdouble SPHatch::pitch() const { gdouble val = 0; - for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) { + for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) { if (pat_i->_pitch._set) { val = pat_i->_pitch.computed; break; @@ -477,7 +477,7 @@ gdouble SPHatch::pitch() const gdouble SPHatch::rotate() const { gdouble val = 0; - for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) { + for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) { if (pat_i->_rotate._set) { val = pat_i->_rotate.computed; break; @@ -736,7 +736,7 @@ SPHatch::View::View(Inkscape::DrawingPattern *arenaitem, int key) SPHatch::View::~View() { // remember, do not delete arenaitem here - arenaitem = NULL; + arenaitem = nullptr; } /* diff --git a/src/object/sp-hatch.h b/src/object/sp-hatch.h index 0b7e98577..fc978a74d 100644 --- a/src/object/sp-hatch.h +++ b/src/object/sp-hatch.h @@ -168,7 +168,7 @@ public: protected: bool _acceptObject(SPObject *obj) const override { - return dynamic_cast<SPHatch *>(obj) != NULL && URIReference::_acceptObject(obj); + return dynamic_cast<SPHatch *>(obj) != nullptr && URIReference::_acceptObject(obj); } }; diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp index cc319a924..18e8b6674 100644 --- a/src/object/sp-image.cpp +++ b/src/object/sp-image.cpp @@ -118,13 +118,13 @@ SPImage::SPImage() : SPItem(), SPViewBox() { this->sx = this->sy = 1.0; this->ox = this->oy = 0.0; - this->curve = NULL; + this->curve = nullptr; - this->href = 0; + this->href = nullptr; #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - this->color_profile = 0; + this->color_profile = nullptr; #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - this->pixbuf = 0; + this->pixbuf = nullptr; } SPImage::~SPImage() { @@ -153,16 +153,16 @@ void SPImage::release() { if (this->href) { g_free (this->href); - this->href = NULL; + this->href = nullptr; } delete this->pixbuf; - this->pixbuf = NULL; + this->pixbuf = nullptr; #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (this->color_profile) { g_free (this->color_profile); - this->color_profile = NULL; + this->color_profile = nullptr; } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -177,7 +177,7 @@ void SPImage::set(unsigned int key, const gchar* value) { switch (key) { case SP_ATTR_XLINK_HREF: g_free (this->href); - this->href = (value) ? g_strdup (value) : NULL; + this->href = (value) ? g_strdup (value) : nullptr; this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_IMAGE_HREF_MODIFIED_FLAG); break; @@ -228,7 +228,7 @@ void SPImage::set(unsigned int key, const gchar* value) { g_free (this->color_profile); } - this->color_profile = (value) ? g_strdup (value) : NULL; + this->color_profile = (value) ? g_strdup (value) : nullptr; if ( value ) { DEBUG_MESSAGE( lcmsFour, "<this> color-profile set to '%s'", value ); @@ -328,9 +328,9 @@ void SPImage::update(SPCtx *ctx, unsigned int flags) { SPItem::update(ctx, flags); if (flags & SP_IMAGE_HREF_MODIFIED_FLAG) { delete this->pixbuf; - this->pixbuf = NULL; + this->pixbuf = nullptr; if (this->href) { - Inkscape::Pixbuf *pixbuf = NULL; + Inkscape::Pixbuf *pixbuf = nullptr; pixbuf = sp_image_repr_read_image ( this->getRepr()->attribute("xlink:href"), this->getRepr()->attribute("sodipodi:absref"), @@ -407,7 +407,7 @@ void SPImage::modified(unsigned int flags) { // SPItem::onModified(flags); if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingImage *img = dynamic_cast<Inkscape::DrawingImage *>(v->arenaitem); img->setStyle(this->style); } @@ -501,17 +501,17 @@ gchar* SPImage::description() const { href_desc = g_strdup("(null_pointer)"); // we call g_free() on href_desc } - char *ret = ( this->pixbuf == NULL + char *ret = ( this->pixbuf == nullptr ? g_strdup_printf(_("[bad reference]: %s"), href_desc) : g_strdup_printf(_("%d × %d: %s"), this->pixbuf->width(), this->pixbuf->height(), href_desc) ); - if (this->pixbuf == NULL && + if (this->pixbuf == nullptr && this->document) { - Inkscape::Pixbuf * pb = NULL; + Inkscape::Pixbuf * pb = nullptr; pb = sp_image_repr_read_image ( this->getRepr()->attribute("xlink:href"), this->getRepr()->attribute("sodipodi:absref"), @@ -540,17 +540,17 @@ Inkscape::DrawingItem* SPImage::show(Inkscape::Drawing &drawing, unsigned int /* Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absref, gchar const *base) { - Inkscape::Pixbuf *inkpb = 0; + Inkscape::Pixbuf *inkpb = nullptr; gchar const *filename = href; - if (filename != NULL) { + if (filename != nullptr) { if (strncmp (filename,"file:",5) == 0) { - gchar *fullname = g_filename_from_uri(filename, NULL, NULL); + gchar *fullname = g_filename_from_uri(filename, nullptr, nullptr); if (fullname) { inkpb = Inkscape::Pixbuf::create_from_file(fullname); g_free(fullname); - if (inkpb != NULL) { + if (inkpb != nullptr) { return inkpb; } } @@ -558,7 +558,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre /* data URI - embedded image */ filename += 5; inkpb = Inkscape::Pixbuf::create_from_data_uri(filename); - if (inkpb != NULL) { + if (inkpb != nullptr) { return inkpb; } } else { @@ -576,7 +576,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre // and if it fails, we also try to use bare href regardless of its g_path_is_absolute if (g_file_test (fullname, G_FILE_TEST_EXISTS) && !g_file_test (fullname, G_FILE_TEST_IS_DIR)) { inkpb = Inkscape::Pixbuf::create_from_file(fullname); - if (inkpb != NULL) { + if (inkpb != nullptr) { g_free (fullname); return inkpb; } @@ -587,7 +587,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre /* try filename as absolute */ if (g_file_test (filename, G_FILE_TEST_EXISTS) && !g_file_test (filename, G_FILE_TEST_IS_DIR)) { inkpb = Inkscape::Pixbuf::create_from_file(filename); - if (inkpb != NULL) { + if (inkpb != nullptr) { return inkpb; } } @@ -596,16 +596,16 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre /* at last try to load from sp absolute path name */ filename = absref; - if (filename != NULL) { + if (filename != nullptr) { // using absref is outside of SVG rules, so we must at least warn the user - if ( base != NULL && href != NULL ) { + if ( base != nullptr && href != nullptr ) { g_warning ("<image xlink:href=\"%s\"> did not resolve to a valid image file (base dir is %s), now trying sodipodi:absref=\"%s\"", href, base, absref); } else { g_warning ("xlink:href did not resolve to a valid image file, now trying sodipodi:absref=\"%s\"", absref); } inkpb = Inkscape::Pixbuf::create_from_file(filename); - if (inkpb != NULL) { + if (inkpb != nullptr) { return inkpb; } } @@ -615,7 +615,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre /* It should be included xpm, so if it still does not does load, */ /* our libraries are broken */ - g_assert (inkpb != NULL); + g_assert (inkpb != nullptr); return inkpb; } @@ -635,7 +635,7 @@ static void sp_image_update_canvas_image(SPImage *image) { SPItem *item = SP_ITEM(image); - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = item->display; v != nullptr; v = v->next) { sp_image_update_arenaitem(image, dynamic_cast<Inkscape::DrawingImage *>(v->arenaitem)); } } @@ -738,7 +738,7 @@ static void sp_image_set_curve( SPImage *image ) */ SPCurve *sp_image_get_curve( SPImage *image ) { - SPCurve *result = 0; + SPCurve *result = nullptr; if (image->curve) { result = image->curve->copy(); } @@ -750,16 +750,16 @@ void sp_embed_image(Inkscape::XML::Node *image_node, Inkscape::Pixbuf *pb) bool free_data = false; // check whether the pixbuf has MIME data - guchar *data = NULL; + guchar *data = nullptr; gsize len = 0; std::string data_mimetype; data = const_cast<guchar *>(pb->getMimeData(len, data_mimetype)); - if (data == NULL) { + if (data == nullptr) { // if there is no supported MIME data, embed as PNG data_mimetype = "image/png"; - gdk_pixbuf_save_to_buffer(pb->getPixbufRaw(), reinterpret_cast<gchar**>(&data), &len, "png", NULL, NULL); + gdk_pixbuf_save_to_buffer(pb->getPixbufRaw(), reinterpret_cast<gchar**>(&data), &len, "png", nullptr, NULL); free_data = true; } @@ -801,13 +801,13 @@ void sp_embed_svg(Inkscape::XML::Node *image_node, std::string const &fn) // we need to load the entire file into memory, // since we'll store it as MIME data - gchar *data = NULL; + gchar *data = nullptr; gsize len = 0; - GError *error = NULL; + GError *error = nullptr; if (g_file_get_contents(fn.c_str(), &data, &len, &error)) { - if (error != NULL) { + if (error != nullptr) { std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl; std::cerr << " (" << fn << ")" << std::endl; return; diff --git a/src/object/sp-item-group.cpp b/src/object/sp-item-group.cpp index 602c4558c..735248248 100644 --- a/src/object/sp-item-group.cpp +++ b/src/object/sp-item-group.cpp @@ -95,7 +95,7 @@ void SPGroup::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) /* TODO: this should be moved into SPItem somehow */ SPItemView *v; - for (v = this->display; v != NULL; v = v->next) { + for (v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingItem *ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags); if (ac) { @@ -110,7 +110,7 @@ void SPGroup::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) SPItemView *v; unsigned position = item->pos_in_parent(); - for (v = this->display; v != NULL; v = v->next) { + for (v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingItem *ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags); if (ac) { @@ -140,7 +140,7 @@ void SPGroup::order_changed (Inkscape::XML::Node *child, Inkscape::XML::Node *ol /* TODO: this should be moved into SPItem somehow */ SPItemView *v; unsigned position = item->pos_in_parent(); - for ( v = item->display ; v != NULL ; v = v->next ) { + for ( v = item->display ; v != nullptr ; v = v->next ) { v->arenaitem->setZOrder(position); } } @@ -186,7 +186,7 @@ void SPGroup::update(SPCtx *ctx, unsigned int flags) { SPLPEItem::update(ctx, flags); if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *group = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); if( this->parent ) { this->context_style = this->parent->context_style; @@ -206,7 +206,7 @@ void SPGroup::modified(guint flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *group = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); group->setStyle(this->style); } @@ -238,7 +238,7 @@ Inkscape::XML::Node* SPGroup::write(Inkscape::XML::Document *xml_doc, Inkscape:: for (auto& child: children) { if ( !dynamic_cast<SPTitle *>(&child) && !dynamic_cast<SPDesc *>(&child) ) { - Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags); if (crepr) { l.push_back(crepr); @@ -246,7 +246,7 @@ Inkscape::XML::Node* SPGroup::write(Inkscape::XML::Document *xml_doc, Inkscape:: } } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -266,7 +266,7 @@ Inkscape::XML::Node* SPGroup::write(Inkscape::XML::Document *xml_doc, Inkscape:: } else if ( flags & SP_OBJECT_WRITE_ALL ) { value = "group"; } else { - value = NULL; + value = nullptr; } repr->setAttribute("inkscape:groupmode", value); @@ -400,9 +400,9 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){ SPCSSAttr * css = sp_repr_css_attr(repr,"style"); Glib::ustring element = g_quark_to_string(repr->code()); if ((css && element == "svg:text") || element == "svg:tspan") { - gchar const *w = sp_repr_css_property(css, "font-size", NULL); + gchar const *w = sp_repr_css_property(css, "font-size", nullptr); if (w) { - gchar *units = NULL; + gchar *units = nullptr; double wd = g_ascii_strtod(w, &units); wd *= scale; if (w != units) { @@ -414,10 +414,10 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){ repr->setAttribute("style", css_str.c_str()); } } - w = NULL; - w = sp_repr_css_property(css, "letter-spacing", NULL); + w = nullptr; + w = sp_repr_css_property(css, "letter-spacing", nullptr); if (w) { - gchar *units = NULL; + gchar *units = nullptr; double wd = g_ascii_strtod(w, &units); wd *= scale; if (w != units) { @@ -429,10 +429,10 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){ repr->setAttribute("style", css_str.c_str()); } } - w = NULL; - w = sp_repr_css_property(css, "word-spacing", NULL); + w = nullptr; + w = sp_repr_css_property(css, "word-spacing", nullptr); if (w) { - gchar *units = NULL; + gchar *units = nullptr; double wd = g_ascii_strtod(w, &units); wd *= scale; if (w != units) { @@ -448,7 +448,7 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){ if (dx) { gchar ** dxarray = g_strsplit(dx, " ", 0); Inkscape::SVGOStringStream dx_data; - while (*dxarray != NULL) { + while (*dxarray != nullptr) { double pos; sp_svg_number_read_d(*dxarray, &pos); pos *= scale; @@ -461,7 +461,7 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){ if (dy) { gchar ** dyarray = g_strsplit(dy, " ", 0); Inkscape::SVGOStringStream dy_data; - while (*dyarray != NULL) { + while (*dyarray != nullptr) { double pos; sp_svg_number_read_d(*dyarray, &pos); pos *= scale; @@ -476,7 +476,7 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){ void sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_done) { - g_return_if_fail (group != NULL); + g_return_if_fail (group != nullptr); SPDocument *doc = group->document; SPRoot *root = doc->getRoot(); @@ -558,10 +558,10 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d // When dealing with a chain of linked offsets, the transformation of an offset will be // tied to the transformation of the top-most source, not to any of the intermediate // offsets. So let's find the top-most source - while (source != NULL && dynamic_cast<SPOffset *>(source)) { + while (source != nullptr && dynamic_cast<SPOffset *>(source)) { source = sp_offset_get_source(dynamic_cast<SPOffset *>(source)); } - if (source != NULL && // If true then we must be dealing with a linked offset ... + if (source != nullptr && // If true then we must be dealing with a linked offset ... group->isAncestorOf(source) ) { // ... of which the source is in the same group ctrans = citem->transform; // then we should apply the transformation of the group to the offset } @@ -638,7 +638,7 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d SPItem *item = static_cast<SPItem *>(doc->getObjectByRepr(repr)); if (item) { - item->doWriteTransform(item->transform, NULL, false); + item->doWriteTransform(item->transform, nullptr, false); children.insert(children.begin(),item); item->requestModified(SP_OBJECT_MODIFIED_FLAG); } else { @@ -659,7 +659,7 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d std::vector<SPItem*> sp_item_group_item_list(SPGroup * group) { std::vector<SPItem*> s; - g_return_val_if_fail(group != NULL, s); + g_return_val_if_fail(group != nullptr, s); for (auto& o: group->children) { if ( dynamic_cast<SPItem *>(&o) ) { @@ -779,24 +779,24 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo tAff[4] = 0.0; tAff[5] = 0.0; } - item->doWriteTransform(tAff, NULL, true); + item->doWriteTransform(tAff, nullptr, true); } else { // used for other import - SPItem *sub_item = NULL; + SPItem *sub_item = nullptr; if (item->clip_ref->getObject()) { sub_item = dynamic_cast<SPItem *>(item->clip_ref->getObject()->firstChild()); } - if (sub_item != NULL) { - sub_item->doWriteTransform(sub_item->transform*sc, NULL, true); + if (sub_item != nullptr) { + sub_item->doWriteTransform(sub_item->transform*sc, nullptr, true); } - sub_item = NULL; + sub_item = nullptr; if (item->mask_ref->getObject()) { sub_item = dynamic_cast<SPItem *>(item->mask_ref->getObject()->firstChild()); } - if (sub_item != NULL) { - sub_item->doWriteTransform(sub_item->transform*sc, NULL, true); + if (sub_item != nullptr) { + sub_item->doWriteTransform(sub_item->transform*sc, nullptr, true); } - item->doWriteTransform(sc.inverse()*item->transform*sc, NULL, true); + item->doWriteTransform(sc.inverse()*item->transform*sc, nullptr, true); group->scaleChildItemsRec(sc, p, false); } } else { @@ -806,7 +806,7 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo Geom::Translate const s(p); Geom::Affine final = s.inverse() * sc * s; - gchar const *conn_type = NULL; + gchar const *conn_type = nullptr; SPText *text_item = dynamic_cast<SPText *>(item); bool is_text_path = text_item && text_item->firstChild() && dynamic_cast<SPTextPath *>(text_item->firstChild()); if (is_text_path) { @@ -820,9 +820,9 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo if (box) { // Force recalculation from perspective box3d_position_set(box); - } else if (item->getAttribute("inkscape:connector-type") != NULL - && (item->getAttribute("inkscape:connection-start") == NULL - || item->getAttribute("inkscape:connection-end") == NULL)) { + } else if (item->getAttribute("inkscape:connector-type") != nullptr + && (item->getAttribute("inkscape:connection-start") == nullptr + || item->getAttribute("inkscape:connection-end") == nullptr)) { // Remove and store connector type for transform if disconnected conn_type = item->getAttribute("inkscape:connector-type"); item->removeAttribute("inkscape:connector-type"); @@ -839,21 +839,21 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo item->transform = Geom::Affine(); // Apply scale item->set_i2d_affine(item->i2dt_affine() * sc); - item->doWriteTransform(item->transform, NULL, true); + item->doWriteTransform(item->transform, nullptr, true); // Scale translation and restore original transform tmp[4] *= sc[0]; tmp[5] *= sc[1]; - item->doWriteTransform(tmp, NULL, true); + item->doWriteTransform(tmp, nullptr, true); } else if (dynamic_cast<SPUse *>(item)) { // calculate the matrix we need to apply to the clone // to cancel its induced transform from its original Geom::Affine move = final.inverse() * item->transform * final; item->doWriteTransform(move, &move, true); } else { - item->doWriteTransform(item->transform*sc, NULL, true); + item->doWriteTransform(item->transform*sc, nullptr, true); } - if (conn_type != NULL) { + if (conn_type != nullptr) { item->setAttribute("inkscape:connector-type", conn_type); } @@ -880,7 +880,7 @@ gint SPGroup::getItemCount() const { } void SPGroup::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags) { - Inkscape::DrawingItem *ac = NULL; + Inkscape::DrawingItem *ac = nullptr; std::vector<SPObject*> l=this->childList(false, SPObject::ActionShow); for(std::vector<SPObject*>::const_iterator i=l.begin();i!=l.end();++i){ SPObject *o = *i; @@ -945,7 +945,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *top_group, Inkscape::LivePa top_group->applyToMask(clipmaskto, lpe); } if (sub_shape) { - SPCurve * c = NULL; + SPCurve * c = nullptr; // If item is a SPRect, convert it to path first: if ( dynamic_cast<SPRect *>(sub_shape) ) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; diff --git a/src/object/sp-item-rm-unsatisfied-cns.cpp b/src/object/sp-item-rm-unsatisfied-cns.cpp index 516c88672..f0b5a863e 100644 --- a/src/object/sp-item-rm-unsatisfied-cns.cpp +++ b/src/object/sp-item-rm-unsatisfied-cns.cpp @@ -14,7 +14,7 @@ void sp_item_rm_unsatisfied_cns(SPItem &item) return; } std::vector<Inkscape::SnapCandidatePoint> snappoints; - item.getSnappoints(snappoints, NULL); + item.getSnappoints(snappoints, nullptr); for (unsigned i = item.constraints.size(); i--;) { g_assert( i < item.constraints.size() ); SPGuideConstraint const &cn = item.constraints[i]; diff --git a/src/object/sp-item-update-cns.cpp b/src/object/sp-item-update-cns.cpp index 077931d52..cae95badd 100644 --- a/src/object/sp-item-update-cns.cpp +++ b/src/object/sp-item-update-cns.cpp @@ -11,7 +11,7 @@ using std::vector; void sp_item_update_cns(SPItem &item, SPDesktop const &desktop) { std::vector<Inkscape::SnapCandidatePoint> snappoints; - item.getSnappoints(snappoints, NULL); + item.getSnappoints(snappoints, nullptr); /* TODO: Implement the ordering. */ vector<SPGuideConstraint> found_cns; satisfied_guide_cns(desktop, snappoints, found_cns); diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 5ca22cabd..4d9b4d7bf 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -76,7 +76,7 @@ SPItem::SPItem() : SPObject() { sensitive = TRUE; bbox_valid = FALSE; - _highlightColor = NULL; + _highlightColor = nullptr; transform_center_x = 0; transform_center_y = 0; @@ -88,7 +88,7 @@ SPItem::SPItem() : SPObject() { transform = Geom::identity(); // doc_bbox = Geom::OptRect(); - display = NULL; + display = nullptr; clip_ref = new SPClipPathReference(this); clip_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(clip_ref_changed), this)); @@ -114,7 +114,7 @@ bool SPItem::isVisibleAndUnlocked(unsigned display_key) const { } bool SPItem::isLocked() const { - for (SPObject const *o = this; o != NULL; o = o->parent) { + for (SPObject const *o = this; o != nullptr; o = o->parent) { SPItem const *item = dynamic_cast<SPItem const *>(o); if (item && !(item->sensitive)) { return true; @@ -125,7 +125,7 @@ bool SPItem::isLocked() const { void SPItem::setLocked(bool locked) { setAttribute("sodipodi:insensitive", - ( locked ? "1" : NULL )); + ( locked ? "1" : nullptr )); updateRepr(); document->_emitModified(); } @@ -149,7 +149,7 @@ bool SPItem::isHidden(unsigned display_key) const { return true; for ( SPItemView *view(display) ; view ; view = view->next ) { if ( view->key == display_key ) { - g_assert(view->arenaitem != NULL); + g_assert(view->arenaitem != nullptr); for ( Inkscape::DrawingItem *arenaitem = view->arenaitem ; arenaitem ; arenaitem = arenaitem->parent() ) { @@ -164,7 +164,7 @@ bool SPItem::isHidden(unsigned display_key) const { } bool SPItem::isHighlightSet() const { - return _highlightColor != NULL; + return _highlightColor != nullptr; } guint32 SPItem::highlight_color() const { @@ -297,7 +297,7 @@ SPItem::scaleCenter(Geom::Scale const &sc) { namespace { bool is_item(SPObject const &object) { - return dynamic_cast<SPItem const *>(&object) != NULL; + return dynamic_cast<SPItem const *>(&object) != nullptr; } } @@ -351,7 +351,7 @@ void SPItem::lowerToBottom() { void SPItem::moveTo(SPItem *target, bool intoafter) { - Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL ); + Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : nullptr ); Inkscape::XML::Node *our_ref = getRepr(); if (!target_ref) { @@ -372,7 +372,7 @@ void SPItem::moveTo(SPItem *target, bool intoafter) { if (intoafter) { // Move this inside of the target at the end our_ref->parent()->removeChild(our_ref); - target_ref->addChild(our_ref, NULL); + target_ref->addChild(our_ref, nullptr); } else if (target_ref->parent() != our_ref->parent()) { // Change in parent, need to remove and add our_ref->parent()->removeChild(our_ref); @@ -480,7 +480,7 @@ void SPItem::set(unsigned int key, gchar const* value) { case SP_ATTR_SODIPODI_INSENSITIVE: { item->sensitive = !value; - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = item->display; v != nullptr; v = v->next) { v->arenaitem->setSensitive(item->sensitive); } break; @@ -491,7 +491,7 @@ void SPItem::set(unsigned int key, gchar const* value) { if (value) { item->_highlightColor = g_strdup(value); } else { - item->_highlightColor = NULL; + item->_highlightColor = nullptr; } break; } @@ -500,7 +500,7 @@ void SPItem::set(unsigned int key, gchar const* value) { break; case SP_ATTR_TRANSFORM_CENTER_X: if (value) { - item->transform_center_x = g_strtod(value, NULL); + item->transform_center_x = g_strtod(value, nullptr); } else { item->transform_center_x = 0; } @@ -508,7 +508,7 @@ void SPItem::set(unsigned int key, gchar const* value) { break; case SP_ATTR_TRANSFORM_CENTER_Y: if (value) { - item->transform_center_y = g_strtod(value, NULL); + item->transform_center_y = g_strtod(value, nullptr); } else { item->transform_center_y = 0; } @@ -538,16 +538,16 @@ void SPItem::clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item) if (old_clip) { SPItemView *v; /* Hide clippath */ - for (v = item->display; v != NULL; v = v->next) { + for (v = item->display; v != nullptr; v = v->next) { SPClipPath *oldPath = dynamic_cast<SPClipPath *>(old_clip); - g_assert(oldPath != NULL); + g_assert(oldPath != nullptr); oldPath->hide(v->arenaitem->key()); } } SPClipPath *clipPath = dynamic_cast<SPClipPath *>(clip); if (clipPath) { Geom::OptRect bbox = item->geometricBounds(); - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = item->display; v != nullptr; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } @@ -566,16 +566,16 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item) { if (old_mask) { /* Hide mask */ - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = item->display; v != nullptr; v = v->next) { SPMask *maskItem = dynamic_cast<SPMask *>(old_mask); - g_assert(maskItem != NULL); + g_assert(maskItem != nullptr); maskItem->sp_mask_hide(v->arenaitem->key()); } } SPMask *maskItem = dynamic_cast<SPMask *>(mask); if (maskItem) { Geom::OptRect bbox = item->geometricBounds(); - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = item->display; v != nullptr; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } @@ -592,7 +592,7 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item) void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { SPPaintServer *old_fill_ps = dynamic_cast<SPPaintServer *>(old_ps); if (old_fill_ps) { - for (SPItemView *v =item->display; v != NULL; v = v->next) { + for (SPItemView *v =item->display; v != nullptr; v = v->next) { old_fill_ps->hide(v->arenaitem->key()); } } @@ -600,7 +600,7 @@ void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { SPPaintServer *new_fill_ps = dynamic_cast<SPPaintServer *>(ps); if (new_fill_ps) { Geom::OptRect bbox = item->geometricBounds(); - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = item->display; v != nullptr; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } @@ -617,7 +617,7 @@ void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { SPPaintServer *old_stroke_ps = dynamic_cast<SPPaintServer *>(old_ps); if (old_stroke_ps) { - for (SPItemView *v =item->display; v != NULL; v = v->next) { + for (SPItemView *v =item->display; v != nullptr; v = v->next) { old_stroke_ps->hide(v->arenaitem->key()); } } @@ -625,7 +625,7 @@ void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) SPPaintServer *new_stroke_ps = dynamic_cast<SPPaintServer *>(ps); if (new_stroke_ps) { Geom::OptRect bbox = item->geometricBounds(); - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = item->display; v != nullptr; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } @@ -653,30 +653,30 @@ void SPItem::update(SPCtx* ctx, guint flags) { SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG) ) { if (flags & SP_OBJECT_MODIFIED_FLAG) { - for (SPItemView *v = display; v != NULL; v = v->next) { + for (SPItemView *v = display; v != nullptr; v = v->next) { v->arenaitem->setTransform(transform); } } - SPClipPath *clip_path = clip_ref ? clip_ref->getObject() : NULL; - SPMask *mask = mask_ref ? mask_ref->getObject() : NULL; + SPClipPath *clip_path = clip_ref ? clip_ref->getObject() : nullptr; + SPMask *mask = mask_ref ? mask_ref->getObject() : nullptr; if ( clip_path || mask ) { Geom::OptRect bbox = geometricBounds(); if (clip_path) { - for (SPItemView *v = display; v != NULL; v = v->next) { + for (SPItemView *v = display; v != nullptr; v = v->next) { clip_path->setBBox(v->arenaitem->key(), bbox); } } if (mask) { - for (SPItemView *v = display; v != NULL; v = v->next) { + for (SPItemView *v = display; v != nullptr; v = v->next) { mask->sp_mask_set_bbox(v->arenaitem->key(), bbox); } } } if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = display; v != NULL; v = v->next) { + for (SPItemView *v = display; v != nullptr; v = v->next) { v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(style->opacity.value)); v->arenaitem->setAntialiasing(style->shape_rendering.computed == SP_CSS_SHAPE_RENDERING_CRISPEDGES ? 0 : 2); v->arenaitem->setIsolation( style->isolation.value ); @@ -719,14 +719,14 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X std::vector<Inkscape::XML::Node *>l; for (auto& child: object->children) { if (dynamic_cast<SPTitle *>(&child) || dynamic_cast<SPDesc *>(&child)) { - Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags); if (crepr) { l.push_back(crepr); } } } for (auto i = l.rbegin(); i!= l.rend(); ++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -742,15 +742,15 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X g_free(c); if (flags & SP_OBJECT_WRITE_EXT) { - repr->setAttribute("sodipodi:insensitive", ( item->sensitive ? NULL : "true" )); + repr->setAttribute("sodipodi:insensitive", ( item->sensitive ? nullptr : "true" )); if (item->transform_center_x != 0) sp_repr_set_svg_double (repr, "inkscape:transform-center-x", item->transform_center_x); else - repr->setAttribute ("inkscape:transform-center-x", NULL); + repr->setAttribute ("inkscape:transform-center-x", nullptr); if (item->transform_center_y != 0) sp_repr_set_svg_double (repr, "inkscape:transform-center-y", item->transform_center_y); else - repr->setAttribute ("inkscape:transform-center-y", NULL); + repr->setAttribute ("inkscape:transform-center-y", nullptr); } if (item->clip_ref){ @@ -774,7 +774,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X if (item->_highlightColor){ repr->setAttribute("inkscape:highlight-color", item->_highlightColor); } else { - repr->setAttribute("inkscape:highlight-color", NULL); + repr->setAttribute("inkscape:highlight-color", nullptr); } SPObject::write(xml_doc, repr, flags); @@ -808,7 +808,7 @@ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const Geom::OptRect bbox; - SPFilter *filter = (style && style->filter.href) ? dynamic_cast<SPFilter *>(style->getFilter()) : NULL; + SPFilter *filter = (style && style->filter.href) ? dynamic_cast<SPFilter *>(style->getFilter()) : nullptr; if ( filter ) { // call the subclass method // CPPIFY @@ -862,7 +862,7 @@ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const } if (clip_ref->getObject()) { SPItem *ownerItem = dynamic_cast<SPItem *>(clip_ref->getOwner()); - g_assert(ownerItem != NULL); + g_assert(ownerItem != nullptr); ownerItem->bbox_valid = FALSE; // LP Bug 1349018 bbox.intersectWith(clip_ref->getObject()->geometricBounds(transform)); } @@ -945,7 +945,7 @@ Geom::OptRect SPItem::desktopBounds(BBoxType type) const } unsigned int SPItem::pos_in_parent() const { - g_assert(parent != NULL); + g_assert(parent != nullptr); g_assert(SP_IS_OBJECT(parent)); unsigned int pos = 0; @@ -982,7 +982,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap const_cast<SPItem*>(this)->snappoints(p, snapprefs); // Get the snappoints at the item's center - if (snapprefs != NULL && snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER)) { + if (snapprefs != nullptr && snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER)) { p.push_back(Inkscape::SnapCandidatePoint(getCenter(), Inkscape::SNAPSOURCE_ROTATION_CENTER, Inkscape::SNAPTARGET_ROTATION_CENTER)); } @@ -1059,7 +1059,7 @@ gchar *SPItem::detailedDescription() const { if ( style && style->filter.href && style->filter.href->getObject() ) { const gchar *label = style->filter.href->getObject()->label(); - gchar *snew = 0; + gchar *snew = nullptr; if (label) { snew = g_strdup_printf (_("%s; <i>filtered (%s)</i>"), s, _(label)); @@ -1107,16 +1107,16 @@ unsigned SPItem::display_key_new(unsigned numkeys) // CPPIFY: make pure virtual Inkscape::DrawingItem* SPItem::show(Inkscape::Drawing& /*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) { //throw; - return 0; + return nullptr; } Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned key, unsigned flags) { - Inkscape::DrawingItem *ai = NULL; + Inkscape::DrawingItem *ai = nullptr; ai = this->show(drawing, key, flags); - if (ai != NULL) { + if (ai != nullptr) { Geom::OptRect item_bbox = geometricBounds(); display = sp_item_view_new_prepend(display, this, flags, key, ai); @@ -1202,18 +1202,18 @@ void SPItem::invoke_hide(unsigned key) { this->hide(key); - SPItemView *ref = NULL; + SPItemView *ref = nullptr; SPItemView *v = display; - while (v != NULL) { + while (v != nullptr) { SPItemView *next = v->next; if (v->key == key) { if (clip_ref->getObject()) { (clip_ref->getObject())->hide(v->arenaitem->key()); - v->arenaitem->setClip(NULL); + v->arenaitem->setClip(nullptr); } if (mask_ref->getObject()) { mask_ref->getObject()->sp_mask_hide(v->arenaitem->key()); - v->arenaitem->setMask(NULL); + v->arenaitem->setMask(nullptr); } SPPaintServer *fill_ps = style->getFillPaintServer(); if (fill_ps) { @@ -1449,7 +1449,7 @@ void SPItem::doWriteTransform(Geom::Affine const &transform, Geom::Affine const { // calculate the relative transform, if not given by the adv attribute Geom::Affine advertized_transform; - if (adv != NULL) { + if (adv != nullptr) { advertized_transform = *adv; } else { advertized_transform = sp_item_transform_repr (this).inverse() * transform; @@ -1578,7 +1578,7 @@ void SPItem::set_item_transform(Geom::Affine const &transform_matrix) Geom::Affine i2anc_affine(SPObject const *object, SPObject const *const ancestor) { Geom::Affine ret(Geom::identity()); - g_return_val_if_fail(object != NULL, ret); + g_return_val_if_fail(object != nullptr, ret); /* stop at first non-renderable ancestor */ while ( object != ancestor && dynamic_cast<SPItem const *>(object) ) { @@ -1587,7 +1587,7 @@ Geom::Affine i2anc_affine(SPObject const *object, SPObject const *const ancestor ret *= root->c2p; } else { SPItem const *item = dynamic_cast<SPItem const *>(object); - g_assert(item != NULL); + g_assert(item != nullptr); ret *= item->transform; } object = object->parent; @@ -1597,7 +1597,7 @@ Geom::Affine i2anc_affine(SPObject const *object, SPObject const *const ancestor Geom::Affine i2i_affine(SPObject const *src, SPObject const *dest) { - g_return_val_if_fail(src != NULL && dest != NULL, Geom::identity()); + g_return_val_if_fail(src != nullptr && dest != nullptr, Geom::identity()); SPObject const *ancestor = src->nearestCommonAncestor(dest); return i2anc_affine(src, ancestor) * i2anc_affine(dest, ancestor).inverse(); } @@ -1608,7 +1608,7 @@ Geom::Affine SPItem::getRelativeTransform(SPObject const *dest) const { Geom::Affine SPItem::i2doc_affine() const { - return i2anc_affine(this, NULL); + return i2anc_affine(this, nullptr); } Geom::Affine SPItem::i2dt_affine() const @@ -1651,9 +1651,9 @@ Geom::Affine SPItem::dt2i_affine() const SPItemView *SPItem::sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, Inkscape::DrawingItem *drawing_item) { - g_assert(item != NULL); - g_assert(dynamic_cast<SPItem *>(item) != NULL); - g_assert(drawing_item != NULL); + g_assert(item != nullptr); + g_assert(dynamic_cast<SPItem *>(item) != nullptr); + g_assert(drawing_item != nullptr); SPItemView *new_view = g_new(SPItemView, 1); @@ -1692,7 +1692,7 @@ Inkscape::DrawingItem *SPItem::get_arenaitem(unsigned key) } } - return NULL; + return nullptr; } int sp_item_repr_compare_position(SPItem const *first, SPItem const *second) @@ -1708,7 +1708,7 @@ SPItem const *sp_item_first_item_child(SPObject const *obj) SPItem *sp_item_first_item_child(SPObject *obj) { - SPItem *child = 0; + SPItem *child = nullptr; for (auto& iter: obj->children) { SPItem *tmp = dynamic_cast<SPItem *>(&iter); if ( tmp ) { diff --git a/src/object/sp-item.h b/src/object/sp-item.h index 82aca1250..f6a6781e9 100644 --- a/src/object/sp-item.h +++ b/src/object/sp-item.h @@ -307,7 +307,7 @@ public: Inkscape::DrawingItem *invoke_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); void invoke_hide(unsigned int key); - void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=0) const; + void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=nullptr) const; void adjust_pattern(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false, PatternTransform = TRANSFORM_BOTH); void adjust_gradient(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false); void adjust_stroke(double ex); @@ -334,7 +334,7 @@ public: * stored optimized. Send _transformed_signal. Invoke _write method so that * the repr is updated with the new transform. */ - void doWriteTransform(Geom::Affine const &transform, Geom::Affine const *adv = NULL, bool compensate = true); + void doWriteTransform(Geom::Affine const &transform, Geom::Affine const *adv = nullptr, bool compensate = true); /** * Sets item private transform (not propagated to repr), without compensating stroke widths, diff --git a/src/object/sp-lpe-item.cpp b/src/object/sp-lpe-item.cpp index 8e1f425a8..9f81b0307 100644 --- a/src/object/sp-lpe-item.cpp +++ b/src/object/sp-lpe-item.cpp @@ -61,7 +61,7 @@ SPLPEItem::SPLPEItem() , path_effects_enabled(1) , path_effect_list(new PathEffectList()) , lpe_modified_connection_list(new std::list<sigc::connection>()) - , current_path_effect(NULL) + , current_path_effect(nullptr) , lpe_helperpaths() { } @@ -85,12 +85,12 @@ void SPLPEItem::release() { } delete this->lpe_modified_connection_list; - this->lpe_modified_connection_list = NULL; + this->lpe_modified_connection_list = nullptr; this->path_effect_list->clear(); // delete the list itself delete this->path_effect_list; - this->path_effect_list = NULL; + this->path_effect_list = nullptr; SPItem::release(); } @@ -99,7 +99,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) { switch (key) { case SP_ATTR_INKSCAPE_PATH_EFFECT: { - this->current_path_effect = NULL; + this->current_path_effect = nullptr; // Disable the path effects while populating the LPE list sp_lpe_item_enable_path_effects(this, false); @@ -135,7 +135,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) { g_warning("BadURIException when trying to find LPE: %s", e.what()); path_effect_ref->unlink(); delete path_effect_ref; - path_effect_ref = NULL; + path_effect_ref = nullptr; } this->path_effect_list->push_back(path_effect_ref); @@ -181,7 +181,7 @@ Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape if ( hasPathEffect() ) { repr->setAttribute("inkscape:path-effect", patheffectlist_svg_string(*this->path_effect_list)); } else { - repr->setAttribute("inkscape:path-effect", NULL); + repr->setAttribute("inkscape:path-effect", nullptr); } } @@ -288,14 +288,14 @@ sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write) #ifdef SHAPE_VERBOSE g_message("sp_lpe_item_update_patheffect: %p\n", lpeitem); #endif - g_return_if_fail (lpeitem != NULL); + g_return_if_fail (lpeitem != nullptr); g_return_if_fail (SP_IS_OBJECT (lpeitem)); g_return_if_fail (SP_IS_LPE_ITEM (lpeitem)); if (!lpeitem->pathEffectsEnabled()) return; - SPLPEItem *top = NULL; + SPLPEItem *top = nullptr; if (wholetree) { SPLPEItem *prev_parent = lpeitem; @@ -327,7 +327,7 @@ lpeobject_ref_modified(SPObject */*href*/, guint /*flags*/, SPLPEItem *lpeitem) static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) { - g_return_if_fail(lpeitem != NULL); + g_return_if_fail(lpeitem != nullptr); SPClipPath *clip_path = SP_ITEM(lpeitem)->clip_ref->getObject(); if(clip_path) { @@ -378,7 +378,7 @@ sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths, bool force, bool is_clip_mask) { - g_return_if_fail(lpeitem != NULL); + g_return_if_fail(lpeitem != nullptr); SPItem *item = dynamic_cast<SPItem *>(lpeitem); if (!item) { return; @@ -426,8 +426,8 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths, if (!keep_paths) { repr->setAttribute("d", repr->attribute("inkscape:original-d")); } - repr->setAttribute("inkscape:original-d", NULL); - path->setCurveBeforeLPE(NULL); + repr->setAttribute("inkscape:original-d", nullptr); + path->setCurveBeforeLPE(nullptr); if (!(shape->getCurve()->get_segment_count())) { repr->parent()->removeChild(repr); } @@ -447,8 +447,8 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths, ( is_clip_mask && force))) { if (!keep_paths) { - repr->setAttribute("d", NULL); - shape->setCurveBeforeLPE(NULL); + repr->setAttribute("d", nullptr); + shape->setCurveBeforeLPE(nullptr); } else { const char * id = repr->attribute("id"); const char * style = repr->attribute("style"); @@ -629,7 +629,7 @@ void SPLPEItem::removeAllPathEffects(bool keep_paths) } } new_list.clear(); - this->getRepr()->setAttribute("inkscape:path-effect", NULL); + this->getRepr()->setAttribute("inkscape:path-effect", nullptr); if (!keep_paths) { // Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible. @@ -810,8 +810,8 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse) } else if (shape) { shape->setCurveInsync( shape->getCurveForEdit()); if (!hasPathEffectOnClipOrMaskRecursive(shape)) { - shape->getRepr()->setAttribute("inkscape:original-d", NULL); - shape->setCurveBeforeLPE(NULL); + shape->getRepr()->setAttribute("inkscape:original-d", nullptr); + shape->setCurveBeforeLPE(nullptr); } else { // make sure there is an original-d for paths!!! sp_lpe_item_create_original_path_recursive(shape); @@ -836,8 +836,8 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse) } else if (shape) { shape->setCurveInsync( shape->getCurveForEdit()); if (!hasPathEffectOnClipOrMaskRecursive(shape)) { - shape->getRepr()->setAttribute("inkscape:original-d", NULL); - shape->setCurveBeforeLPE(NULL); + shape->getRepr()->setAttribute("inkscape:original-d", nullptr); + shape->setCurveBeforeLPE(nullptr); } else { // make sure there is an original-d for paths!!! sp_lpe_item_create_original_path_recursive(shape); @@ -862,8 +862,8 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse) } else if (shape) { shape->setCurveInsync( shape->getCurveForEdit()); if (!hasPathEffectOnClipOrMaskRecursive(shape)) { - shape->getRepr()->setAttribute("inkscape:original-d", NULL); - shape->setCurveBeforeLPE(NULL); + shape->getRepr()->setAttribute("inkscape:original-d", nullptr); + shape->setCurveBeforeLPE(nullptr); } else { // make sure there is an original-d for paths!!! sp_lpe_item_create_original_path_recursive(shape); @@ -918,7 +918,7 @@ SPLPEItem::applyToClipPathOrMask(SPItem *clip_mask, SPItem* to, Inkscape::LivePa applyToClipPathOrMask(subitem, to, lpe); } } else if (shape) { - SPCurve * c = NULL; + SPCurve * c = nullptr; // If item is a SPRect, convert it to path first: if ( dynamic_cast<SPRect *>(shape) ) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -993,7 +993,7 @@ SPLPEItem::getPathEffectOfType(int type) } } } - return NULL; + return nullptr; } Inkscape::LivePathEffect::Effect const* @@ -1009,7 +1009,7 @@ SPLPEItem::getPathEffectOfType(int type) const } } } - return NULL; + return nullptr; } void SPLPEItem::editNextParamOncanvas(SPDesktop *dt) @@ -1109,7 +1109,7 @@ Inkscape::LivePathEffect::Effect* SPLPEItem::getCurrentLPE() if (lperef && lperef->lpeobject) return lperef->lpeobject->get_lpe(); else - return NULL; + return nullptr; } bool SPLPEItem::setCurrentPathEffect(Inkscape::LivePathEffect::LPEObjectReference* lperef) diff --git a/src/object/sp-lpe-item.h b/src/object/sp-lpe-item.h index 665dbcd7d..b53b440a1 100644 --- a/src/object/sp-lpe-item.h +++ b/src/object/sp-lpe-item.h @@ -95,9 +95,9 @@ public: void addPathEffect(std::string value, bool reset); void addPathEffect(LivePathEffectObject * new_lpeobj); void resetClipPathAndMaskLPE(bool fromrecurse = false); - void applyToMask(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = NULL); - void applyToClipPath(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = NULL); - void applyToClipPathOrMask(SPItem * clip_mask, SPItem* to, Inkscape::LivePathEffect::Effect *lpe = NULL); + void applyToMask(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = nullptr); + void applyToClipPath(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = nullptr); + void applyToClipPathOrMask(SPItem * clip_mask, SPItem* to, Inkscape::LivePathEffect::Effect *lpe = nullptr); bool forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users = 1); void editNextParamOncanvas(SPDesktop *dt); diff --git a/src/object/sp-marker.cpp b/src/object/sp-marker.cpp index e5ddb91b5..851a7d54f 100644 --- a/src/object/sp-marker.cpp +++ b/src/object/sp-marker.cpp @@ -240,31 +240,31 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape: repr->setAttribute("markerUnits", "userSpaceOnUse"); } } else { - repr->setAttribute("markerUnits", NULL); + repr->setAttribute("markerUnits", nullptr); } if (this->refX._set) { sp_repr_set_svg_double(repr, "refX", this->refX.computed); } else { - repr->setAttribute("refX", NULL); + repr->setAttribute("refX", nullptr); } if (this->refY._set) { sp_repr_set_svg_double (repr, "refY", this->refY.computed); } else { - repr->setAttribute("refY", NULL); + repr->setAttribute("refY", nullptr); } if (this->markerWidth._set) { sp_repr_set_svg_double (repr, "markerWidth", this->markerWidth.computed); } else { - repr->setAttribute("markerWidth", NULL); + repr->setAttribute("markerWidth", nullptr); } if (this->markerHeight._set) { sp_repr_set_svg_double (repr, "markerHeight", this->markerHeight.computed); } else { - repr->setAttribute("markerHeight", NULL); + repr->setAttribute("markerHeight", nullptr); } if (this->orient_set) { @@ -276,7 +276,7 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape: sp_repr_set_css_double(repr, "orient", this->orient.computed); } } else { - repr->setAttribute("orient", NULL); + repr->setAttribute("orient", nullptr); } /* fixme: */ @@ -292,7 +292,7 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape: Inkscape::DrawingItem* SPMarker::show(Inkscape::Drawing &/*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) { // Markers in tree are never shown directly even if outside of <defs>. - return 0; + return nullptr; } Inkscape::DrawingItem* SPMarker::private_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { @@ -337,13 +337,13 @@ sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size) marker->hide(key); it->second.items.clear(); for (unsigned int i = 0; i < size; ++i) { - it->second.items.push_back(NULL); + it->second.items.push_back(nullptr); } } } else { marker->views_map[key] = SPMarkerView(); for (unsigned int i = 0; i < size; ++i) { - marker->views_map[key].items.push_back(NULL); + marker->views_map[key].items.push_back(nullptr); } } } @@ -361,23 +361,23 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent, // otherwise Cairo will fail to render anything on the tile // that contains the "degenerate" marker. if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH && linewidth == 0) { - return NULL; + return nullptr; } std::map<unsigned int, SPMarkerView>::iterator it = marker->views_map.find(key); if (it == marker->views_map.end()) { // Key not found - return NULL; + return nullptr; } SPMarkerView *view = &(it->second); if (pos >= view->items.size() ) { // Position index too large, doesn't exist. - return NULL; + return nullptr; } // If not already created - if (view->items[pos] == NULL) { + if (view->items[pos] == nullptr) { /* Parent class ::show method */ view->items[pos] = marker->private_show(parent->drawing(), key, SP_ITEM_REFERENCE_FLAGS); @@ -483,9 +483,9 @@ SPObject *sp_marker_fork_if_necessary(SPObject *marker) SPDocument *doc = marker->document; Inkscape::XML::Document *xml_doc = doc->getReprDoc(); // Turn off garbage-collectable or it might be collected before we can use it - marker->getRepr()->setAttribute("inkscape:collect", NULL); + marker->getRepr()->setAttribute("inkscape:collect", nullptr); Inkscape::XML::Node *mark_repr = marker->getRepr()->duplicate(xml_doc); - doc->getDefs()->getRepr()->addChild(mark_repr, NULL); + doc->getDefs()->getRepr()->addChild(mark_repr, nullptr); if (!mark_repr->attribute("inkscape:stockid")) { mark_repr->setAttribute("inkscape:stockid", mark_repr->attribute("id")); } diff --git a/src/object/sp-mask.cpp b/src/object/sp-mask.cpp index 2e764131c..5e6ed29f0 100644 --- a/src/object/sp-mask.cpp +++ b/src/object/sp-mask.cpp @@ -47,7 +47,7 @@ SPMask::SPMask() : SPObjectGroup() { this->maskContentUnits_set = FALSE; this->maskContentUnits = SP_CONTENT_UNITS_USERSPACEONUSE; - this->display = NULL; + this->display = nullptr; } SPMask::~SPMask() { @@ -150,7 +150,7 @@ void SPMask::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) { SPObject *ochild = this->document->getObjectByRepr(child); if (SP_IS_ITEM (ochild)) { - for (SPMaskView *v = this->display; v != NULL; v = v->next) { + for (SPMaskView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingItem *ac = SP_ITEM (ochild)->invoke_show(v->arenaitem->drawing(), v->key, SP_ITEM_REFERENCE_FLAGS); if (ac) { @@ -178,7 +178,7 @@ void SPMask::update(SPCtx* ctx, unsigned int flags) { sp_object_unref(*child); } - for (SPMaskView *v = this->display; v != NULL; v = v->next) { + for (SPMaskView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); if (this->maskContentUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX && v->bbox) { @@ -246,7 +246,7 @@ sp_mask_create (std::vector<Inkscape::XML::Node*> &reprs, SPDocument *document) } Inkscape::DrawingItem *SPMask::sp_mask_show(Inkscape::Drawing &drawing, unsigned int key) { - g_return_val_if_fail (this != NULL, NULL); + g_return_val_if_fail (this != nullptr, NULL); g_return_val_if_fail (SP_IS_MASK (this), NULL); Inkscape::DrawingGroup *ai = new Inkscape::DrawingGroup(drawing); @@ -272,7 +272,7 @@ Inkscape::DrawingItem *SPMask::sp_mask_show(Inkscape::Drawing &drawing, unsigned } void SPMask::sp_mask_hide(unsigned int key) { - g_return_if_fail (this != NULL); + g_return_if_fail (this != nullptr); g_return_if_fail (SP_IS_MASK (this)); for (auto& child: children) { @@ -281,7 +281,7 @@ void SPMask::sp_mask_hide(unsigned int key) { } } - for (SPMaskView *v = this->display; v != NULL; v = v->next) { + for (SPMaskView *v = this->display; v != nullptr; v = v->next) { if (v->key == key) { /* We simply unref and let item to manage this in handler */ this->display = sp_mask_view_list_remove (this->display, v); @@ -293,7 +293,7 @@ void SPMask::sp_mask_hide(unsigned int key) { } void SPMask::sp_mask_set_bbox(unsigned int key, Geom::OptRect const &bbox) { - for (SPMaskView *v = this->display; v != NULL; v = v->next) { + for (SPMaskView *v = this->display; v != nullptr; v = v->next) { if (v->key == key) { v->bbox = bbox; break; diff --git a/src/object/sp-mask.h b/src/object/sp-mask.h index f02a486b3..5707e27d3 100644 --- a/src/object/sp-mask.h +++ b/src/object/sp-mask.h @@ -94,11 +94,11 @@ protected: char const * owner_mask = ""; char const * obj_name = ""; char const * obj_id = ""; - if (owner_repr != NULL) { + if (owner_repr != nullptr) { owner_name = owner_repr->name(); owner_mask = owner_repr->attribute("mask"); } - if (obj_repr != NULL) { + if (obj_repr != nullptr) { obj_name = obj_repr->name(); obj_id = obj_repr->attribute("id"); } diff --git a/src/object/sp-mesh-array.cpp b/src/object/sp-mesh-array.cpp index d958427f2..14ec3866b 100644 --- a/src/object/sp-mesh-array.cpp +++ b/src/object/sp-mesh-array.cpp @@ -640,7 +640,7 @@ SPMeshNodeArray::SPMeshNodeArray( SPMeshGradient *mg ) { SPMeshNodeArray::SPMeshNodeArray( const SPMeshNodeArray& rhs ) { built = false; - mg = NULL; + mg = nullptr; draggers_valid = false; nodes = rhs.nodes; // This only copies the pointers but it does size the vector of vectors. @@ -661,7 +661,7 @@ SPMeshNodeArray& SPMeshNodeArray::operator=( const SPMeshNodeArray& rhs ) { clear(); // Clear any existing array. built = false; - mg = NULL; + mg = nullptr; draggers_valid = false; nodes = rhs.nodes; // This only copies the pointers but it does size the vector of vectors. diff --git a/src/object/sp-mesh-array.h b/src/object/sp-mesh-array.h index df43638db..e334de90b 100644 --- a/src/object/sp-mesh-array.h +++ b/src/object/sp-mesh-array.h @@ -163,7 +163,7 @@ public: friend class SPMeshPatchI; - SPMeshNodeArray() { built = false; mg = NULL; draggers_valid = false; }; + SPMeshNodeArray() { built = false; mg = nullptr; draggers_valid = false; }; SPMeshNodeArray( SPMeshGradient *mg ); SPMeshNodeArray( const SPMeshNodeArray& rhs ); SPMeshNodeArray& operator=(const SPMeshNodeArray& rhs); diff --git a/src/object/sp-mesh-gradient.cpp b/src/object/sp-mesh-gradient.cpp index 572131c60..d36a7fb73 100644 --- a/src/object/sp-mesh-gradient.cpp +++ b/src/object/sp-mesh-gradient.cpp @@ -163,7 +163,7 @@ cairo_pattern_t* SPMeshGradient::pattern_new(cairo_t * /*ct*/, this->ensureArray(); - cairo_pattern_t *cp = NULL; + cairo_pattern_t *cp = nullptr; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4) SPMeshNodeArray* my_array = &array; diff --git a/src/object/sp-mesh-patch.cpp b/src/object/sp-mesh-patch.cpp index 04a121c7a..1110e15ca 100644 --- a/src/object/sp-mesh-patch.cpp +++ b/src/object/sp-mesh-patch.cpp @@ -21,7 +21,7 @@ SPMeshpatch* SPMeshpatch::getNextMeshpatch() { - SPMeshpatch *result = 0; + SPMeshpatch *result = nullptr; for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) { if (SP_IS_MESHPATCH(obj)) { @@ -34,7 +34,7 @@ SPMeshpatch* SPMeshpatch::getNextMeshpatch() SPMeshpatch* SPMeshpatch::getPrevMeshpatch() { - SPMeshpatch *result = 0; + SPMeshpatch *result = nullptr; for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) { // The closest previous SPObject that is an SPMeshpatch *should* be ourself. @@ -58,7 +58,7 @@ SPMeshpatch* SPMeshpatch::getPrevMeshpatch() * Mesh Patch */ SPMeshpatch::SPMeshpatch() : SPObject() { - this->tensor_string = NULL; + this->tensor_string = nullptr; } SPMeshpatch::~SPMeshpatch() { diff --git a/src/object/sp-mesh-row.cpp b/src/object/sp-mesh-row.cpp index 8204aff65..03d71c6f5 100644 --- a/src/object/sp-mesh-row.cpp +++ b/src/object/sp-mesh-row.cpp @@ -19,7 +19,7 @@ SPMeshrow* SPMeshrow::getNextMeshrow() { - SPMeshrow *result = 0; + SPMeshrow *result = nullptr; for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) { if (SP_IS_MESHROW(obj)) { @@ -32,7 +32,7 @@ SPMeshrow* SPMeshrow::getNextMeshrow() SPMeshrow* SPMeshrow::getPrevMeshrow() { - SPMeshrow *result = 0; + SPMeshrow *result = nullptr; for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) { // The closest previous SPObject that is an SPMeshrow *should* be ourself. diff --git a/src/object/sp-metadata.cpp b/src/object/sp-metadata.cpp index e7907e4f0..04cddbb8b 100644 --- a/src/object/sp-metadata.cpp +++ b/src/object/sp-metadata.cpp @@ -44,7 +44,7 @@ namespace { void strip_ids_recursively(Inkscape::XML::Node *node) { using Inkscape::XML::NodeSiblingIterator; if ( node->type() == Inkscape::XML::ELEMENT_NODE ) { - node->setAttribute("id", NULL); + node->setAttribute("id", nullptr); } for ( NodeSiblingIterator iter=node->firstChild() ; iter ; ++iter ) { strip_ids_recursively(iter); @@ -125,11 +125,11 @@ SPMetadata *sp_document_metadata(SPDocument *document) { SPObject *nv; - g_return_val_if_fail (document != NULL, NULL); + g_return_val_if_fail (document != nullptr, NULL); - nv = sp_item_group_get_child_by_name( document->getRoot(), NULL, + nv = sp_item_group_get_child_by_name( document->getRoot(), nullptr, "metadata"); - g_assert (nv != NULL); + g_assert (nv != nullptr); return (SPMetadata *)nv; } diff --git a/src/object/sp-missing-glyph.cpp b/src/object/sp-missing-glyph.cpp index f441b66d2..7b10b4e9a 100644 --- a/src/object/sp-missing-glyph.cpp +++ b/src/object/sp-missing-glyph.cpp @@ -21,7 +21,7 @@ SPMissingGlyph::SPMissingGlyph() : SPObject() { //TODO: correct these values: - this->d = NULL; + this->d = nullptr; this->horiz_adv_x = 0; this->vert_origin_x = 0; this->vert_origin_y = 0; @@ -59,7 +59,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) { } case SP_ATTR_HORIZ_ADV_X: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->horiz_adv_x){ this->horiz_adv_x = number; this->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -68,7 +68,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) { } case SP_ATTR_VERT_ORIGIN_X: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->vert_origin_x){ this->vert_origin_x = number; this->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -77,7 +77,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) { } case SP_ATTR_VERT_ORIGIN_Y: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->vert_origin_y){ this->vert_origin_y = number; this->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -86,7 +86,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) { } case SP_ATTR_VERT_ADV_Y: { - double number = value ? g_ascii_strtod(value, 0) : 0; + double number = value ? g_ascii_strtod(value, nullptr) : 0; if (number != this->vert_adv_y){ this->vert_adv_y = number; this->requestModified(SP_OBJECT_MODIFIED_FLAG); diff --git a/src/object/sp-namedview.cpp b/src/object/sp-namedview.cpp index 7cea56119..a384c23c9 100644 --- a/src/object/sp-namedview.cpp +++ b/src/object/sp-namedview.cpp @@ -65,12 +65,12 @@ SPNamedView::SPNamedView() : SPObjectGroup(), snap_manager(this) { this->guidehicolor = 0; this->views.clear(); this->borderlayer = 0; - this->page_size_units = NULL; + this->page_size_units = nullptr; this->window_x = 0; this->cy = 0; this->window_y = 0; - this->display_units = NULL; - this->page_size_units = NULL; + this->display_units = nullptr; + this->page_size_units = nullptr; this->pagecolor = 0; this->cx = 0; this->pageshadow = 0; @@ -113,7 +113,7 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *doc const char* gridopacity = "0.15"; const char* gridempopacity = "0.38"; - const char* value = NULL; + const char* value = nullptr; if ((value = repr->attribute("gridoriginx"))) { gridoriginx = value; old_grid_settings_present = true; @@ -173,15 +173,15 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *doc Inkscape::GC::release(newnode); // remove all old settings - repr->setAttribute("gridoriginx", NULL); - repr->setAttribute("gridoriginy", NULL); - repr->setAttribute("gridspacingx", NULL); - repr->setAttribute("gridspacingy", NULL); - repr->setAttribute("gridcolor", NULL); - repr->setAttribute("gridempcolor", NULL); - repr->setAttribute("gridopacity", NULL); - repr->setAttribute("gridempopacity", NULL); - repr->setAttribute("gridempspacing", NULL); + repr->setAttribute("gridoriginx", nullptr); + repr->setAttribute("gridoriginy", nullptr); + repr->setAttribute("gridspacingx", nullptr); + repr->setAttribute("gridspacingy", nullptr); + repr->setAttribute("gridcolor", nullptr); + repr->setAttribute("gridempcolor", nullptr); + repr->setAttribute("gridopacity", nullptr); + repr->setAttribute("gridempopacity", nullptr); + repr->setAttribute("gridempspacing", nullptr); // SPDocumentUndo::done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid from pre0.46 grid settings")); } @@ -297,15 +297,15 @@ void SPNamedView::set(unsigned int key, const gchar* value) { this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_GRIDTOLERANCE: - this->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, NULL) : 10000); + this->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, nullptr) : 10000); this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_GUIDETOLERANCE: - this->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, NULL) : 20); + this->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, nullptr) : 20); this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_OBJECTTOLERANCE: - this->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, NULL) : 20); + this->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, nullptr) : 20); this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_GUIDECOLOR: @@ -400,15 +400,15 @@ void SPNamedView::set(unsigned int key, const gchar* value) { this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_INKSCAPE_ZOOM: - this->zoom = value ? g_ascii_strtod(value, NULL) : 0; // zero means not set + this->zoom = value ? g_ascii_strtod(value, nullptr) : 0; // zero means not set this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_INKSCAPE_CX: - this->cx = value ? g_ascii_strtod(value, NULL) : HUGE_VAL; // HUGE_VAL means not set + this->cx = value ? g_ascii_strtod(value, nullptr) : HUGE_VAL; // HUGE_VAL means not set this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_INKSCAPE_CY: - this->cy = value ? g_ascii_strtod(value, NULL) : HUGE_VAL; // HUGE_VAL means not set + this->cy = value ? g_ascii_strtod(value, nullptr) : HUGE_VAL; // HUGE_VAL means not set this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_INKSCAPE_WINDOW_WIDTH: @@ -528,7 +528,7 @@ void SPNamedView::set(unsigned int key, const gchar* value) { this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_INKSCAPE_CONNECTOR_SPACING: - this->connector_spacing = value ? g_ascii_strtod(value, NULL) : + this->connector_spacing = value ? g_ascii_strtod(value, nullptr) : defaultConnSpacing; this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; @@ -566,7 +566,7 @@ void SPNamedView::set(unsigned int key, const gchar* value) { } case SP_ATTR_UNITS: { // Only used in "Custom size" section of Document Properties dialog - Inkscape::Util::Unit const *new_unit = NULL; + Inkscape::Util::Unit const *new_unit = nullptr; if (value) { Inkscape::Util::Unit const *const req_unit = unit_table.getUnit(value); @@ -605,7 +605,7 @@ void SPNamedView::set(unsigned int key, const gchar* value) { */ static Inkscape::CanvasGrid* sp_namedview_add_grid(SPNamedView *nv, Inkscape::XML::Node *repr, SPDesktop *desktop) { - Inkscape::CanvasGrid* grid = NULL; + Inkscape::CanvasGrid* grid = nullptr; //check if namedview already has an object for this grid for(std::vector<Inkscape::CanvasGrid *>::const_iterator it=nv->grids.begin();it!=nv->grids.end();++it ) { if (repr == (*it)->repr) { @@ -619,7 +619,7 @@ sp_namedview_add_grid(SPNamedView *nv, Inkscape::XML::Node *repr, SPDesktop *des Inkscape::GridType gridtype = Inkscape::CanvasGrid::getGridTypeFromSVGName(repr->attribute("type")); if (!nv->document) { g_warning("sp_namedview_add_grid - how come doc is null here?!"); - return NULL; + return nullptr; } grid = Inkscape::CanvasGrid::NewGrid(nv, repr, nv->document, gridtype); nv->grids.push_back(grid); @@ -642,7 +642,7 @@ void SPNamedView::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *r SPObjectGroup::child_added(child, ref); if (!strcmp(child->name(), "inkscape:grid")) { - sp_namedview_add_grid(this, child, NULL); + sp_namedview_add_grid(this, child, nullptr); } else { SPObject *no = this->document->getObjectByRepr(child); if ( !SP_IS_OBJECT(no) ) { @@ -723,7 +723,7 @@ void SPNamedView::show(SPDesktop *desktop) // generate grids specified in SVG: Inkscape::XML::Node *repr = this->getRepr(); if (repr) { - for (Inkscape::XML::Node * child = repr->firstChild() ; child != NULL; child = child->next() ) { + for (Inkscape::XML::Node * child = repr->firstChild() ; child != nullptr; child = child->next() ) { if (!strcmp(child->name(), "inkscape:grid")) { sp_namedview_add_grid(this, child, desktop); } @@ -824,7 +824,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop) void SPNamedView::writeNewGrid(SPDocument *document,int gridtype) { - g_assert(this->getRepr() != NULL); + g_assert(this->getRepr() != nullptr); Inkscape::CanvasGrid::writeNewGridToRepr(this->getRepr(),document,static_cast<Inkscape::GridType>(gridtype)); } @@ -835,13 +835,13 @@ bool SPNamedView::getSnapGlobal() const void SPNamedView::setSnapGlobal(bool v) { - g_assert(this->getRepr() != NULL); + g_assert(this->getRepr() != nullptr); sp_repr_set_boolean(this->getRepr(), "inkscape:snap-global", v); } void sp_namedview_update_layers_from_document (SPDesktop *desktop) { - SPObject *layer = NULL; + SPObject *layer = nullptr; SPDocument *document = desktop->doc(); SPNamedView *nv = desktop->namedview; if ( nv->default_layer_id != 0 ) { @@ -849,7 +849,7 @@ void sp_namedview_update_layers_from_document (SPDesktop *desktop) } // don't use that object if it's not at least group if ( !layer || !SP_IS_GROUP(layer) ) { - layer = NULL; + layer = nullptr; } // if that didn't work out, look for the topmost layer if (!layer) { @@ -904,7 +904,7 @@ void sp_namedview_document_from_window(SPDesktop *desktop) void SPNamedView::hide(SPDesktop const *desktop) { - g_assert(desktop != NULL); + g_assert(desktop != nullptr); g_assert(std::find(views.begin(),views.end(),desktop)!=views.end()); for(std::vector<SPGuide *>::iterator it=this->guides.begin();it!=this->guides.end();++it ) { (*it)->hideSPGuide(desktop->getCanvas()); @@ -914,7 +914,7 @@ void SPNamedView::hide(SPDesktop const *desktop) void SPNamedView::activateGuides(void* desktop, bool active) { - g_assert(desktop != NULL); + g_assert(desktop != nullptr); g_assert(std::find(views.begin(),views.end(),desktop)!=views.end()); SPDesktop *dt = static_cast<SPDesktop*>(desktop); @@ -1060,12 +1060,12 @@ static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color) SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id) { - g_return_val_if_fail(document != NULL, NULL); + g_return_val_if_fail(document != nullptr, NULL); - SPObject *nv = sp_item_group_get_child_by_name(document->getRoot(), NULL, "sodipodi:namedview"); - g_assert(nv != NULL); + SPObject *nv = sp_item_group_get_child_by_name(document->getRoot(), nullptr, "sodipodi:namedview"); + g_assert(nv != nullptr); - if (id == NULL) { + if (id == nullptr) { return (SPNamedView *) nv; } @@ -1083,14 +1083,14 @@ SPNamedView const *sp_document_namedview(SPDocument const *document, const gchar void SPNamedView::setGuides(bool v) { - g_assert(this->getRepr() != NULL); + g_assert(this->getRepr() != nullptr); sp_repr_set_boolean(this->getRepr(), "showguides", v); sp_repr_set_boolean(this->getRepr(), "inkscape:guide-bbox", v); } bool SPNamedView::getGuides() { - g_assert(this->getRepr() != NULL); + g_assert(this->getRepr() != nullptr); unsigned int v; unsigned int set = sp_repr_get_boolean(this->getRepr(), "showguides", &v); if (!set) { // hide guides if not specified, for backwards compatibility @@ -1158,7 +1158,7 @@ Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedvie return (*it); } - return NULL; + return nullptr; } void SPNamedView::translateGuides(Geom::Translate const &tr) { diff --git a/src/object/sp-object-group.cpp b/src/object/sp-object-group.cpp index f8ef855e3..102eafa83 100644 --- a/src/object/sp-object-group.cpp +++ b/src/object/sp-object-group.cpp @@ -51,14 +51,14 @@ Inkscape::XML::Node *SPObjectGroup::write(Inkscape::XML::Document *xml_doc, Inks std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags); + Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags); if (crepr) { l.push_back(crepr); } } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { diff --git a/src/object/sp-object.cpp b/src/object/sp-object.cpp index 112a08fb9..d9a003074 100644 --- a/src/object/sp-object.cpp +++ b/src/object/sp-object.cpp @@ -91,7 +91,7 @@ public: */ static void setIdNull( SPObject* obj ) { if (obj) { - obj->id = 0; + obj->id = nullptr; } } @@ -105,7 +105,7 @@ public: if (obj && (id != obj->id) ) { if (obj->id) { g_free(obj->id); - obj->id = 0; + obj->id = nullptr; } if (id) { obj->id = g_strdup(id); @@ -118,10 +118,10 @@ public: * Constructor, sets all attributes to default values. */ SPObject::SPObject() - : cloned(0), clone_original(NULL), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0), - document(NULL), parent(NULL), id(NULL), repr(NULL), refCount(1), hrefList(std::list<SPObject*>()), - _successor(NULL), _collection_policy(SPObject::COLLECT_WITH_PARENT), - _label(NULL), _default_label(NULL) + : cloned(0), clone_original(nullptr), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0), + document(nullptr), parent(nullptr), id(nullptr), repr(nullptr), refCount(1), hrefList(std::list<SPObject*>()), + _successor(nullptr), _collection_policy(SPObject::COLLECT_WITH_PARENT), + _label(nullptr), _default_label(nullptr) { debug("id=%p, typename=%s",this, g_type_name_from_instance((GTypeInstance*)this)); @@ -134,8 +134,8 @@ SPObject::SPObject() // vg, g, defs, desc, title, symbol, use, image, switch, path, rect, circle, ellipse, line, polyline, // polygon, text, tspan, tref, textPath, altGlyph, glyphRef, marker, linearGradient, radialGradient, // stop, pattern, clipPath, mask, filter, feImage, a, font, glyph, missing-glyph, foreignObject - this->style = new SPStyle( NULL, this ); // Is it necessary to call with "this"? - this->context_style = NULL; + this->style = new SPStyle( nullptr, this ); // Is it necessary to call with "this"? + this->context_style = nullptr; } /** @@ -145,18 +145,18 @@ SPObject::~SPObject() { g_free(this->_label); g_free(this->_default_label); - this->_label = NULL; - this->_default_label = NULL; + this->_label = nullptr; + this->_default_label = nullptr; if (this->_successor) { - sp_object_unref(this->_successor, NULL); - this->_successor = NULL; + sp_object_unref(this->_successor, nullptr); + this->_successor = nullptr; } if (parent) { parent->children.erase(parent->children.iterator_to(*this)); } - if( style == NULL ) { + if( style == nullptr ) { // style pointer could be NULL if unreffed too many times. // Conjecture: style pointer is never NULL. std::cerr << "SPObject::~SPObject(): style pointer is NULL" << std::endl; @@ -241,7 +241,7 @@ Inkscape::XML::Node const* SPObject::getRepr() const{ SPObject *sp_object_ref(SPObject *object, SPObject *owner) { - g_return_val_if_fail(object != NULL, NULL); + g_return_val_if_fail(object != nullptr, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL); @@ -253,7 +253,7 @@ SPObject *sp_object_ref(SPObject *object, SPObject *owner) SPObject *sp_object_unref(SPObject *object, SPObject *owner) { - g_return_val_if_fail(object != NULL, NULL); + g_return_val_if_fail(object != nullptr, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL); @@ -265,12 +265,12 @@ SPObject *sp_object_unref(SPObject *object, SPObject *owner) delete object; } - return NULL; + return nullptr; } SPObject *sp_object_href(SPObject *object, SPObject* owner) { - g_return_val_if_fail(object != NULL, NULL); + g_return_val_if_fail(object != nullptr, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); object->hrefcount++; @@ -284,7 +284,7 @@ SPObject *sp_object_href(SPObject *object, SPObject* owner) SPObject *sp_object_hunref(SPObject *object, SPObject* owner) { - g_return_val_if_fail(object != NULL, NULL); + g_return_val_if_fail(object != nullptr, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(object->hrefcount > 0, NULL); @@ -294,11 +294,11 @@ SPObject *sp_object_hunref(SPObject *object, SPObject* owner) if(owner) object->hrefList.remove(owner); - return NULL; + return nullptr; } void SPObject::_updateTotalHRefCount(int increment) { - SPObject *topmost_collectable = NULL; + SPObject *topmost_collectable = nullptr; for ( SPObject *iter = this ; iter ; iter = iter->parent ) { iter->_total_hrefcount += increment; if ( iter->_total_hrefcount < iter->hrefcount ) { @@ -316,7 +316,7 @@ void SPObject::_updateTotalHRefCount(int increment) { } bool SPObject::isAncestorOf(SPObject const *object) const { - g_return_val_if_fail(object != NULL, false); + g_return_val_if_fail(object != nullptr, false); object = object->parent; while (object) { if ( object == this ) { @@ -336,14 +336,14 @@ bool same_objects(SPObject const &a, SPObject const &b) { } SPObject const *SPObject::nearestCommonAncestor(SPObject const *object) const { - g_return_val_if_fail(object != NULL, NULL); + g_return_val_if_fail(object != nullptr, NULL); using Inkscape::Algorithms::longest_common_suffix; - return longest_common_suffix<SPObject::ConstParentIterator>(this, object, NULL, &same_objects); + return longest_common_suffix<SPObject::ConstParentIterator>(this, object, nullptr, &same_objects); } static SPObject const *AncestorSon(SPObject const *obj, SPObject const *ancestor) { - SPObject const *result = 0; + SPObject const *result = nullptr; if ( obj && ancestor ) { if (obj->parent == ancestor) { result = obj; @@ -390,19 +390,19 @@ SPObject *SPObject::appendChildRepr(Inkscape::XML::Node *repr) { return document->getObjectByRepr(repr); } else { g_critical("Attempt to append repr as child of cloned object"); - return NULL; + return nullptr; } } void SPObject::setCSS(SPCSSAttr *css, gchar const *attr) { - g_assert(this->getRepr() != NULL); + g_assert(this->getRepr() != nullptr); sp_repr_css_set(this->getRepr(), css, attr); } void SPObject::changeCSS(SPCSSAttr *css, gchar const *attr) { - g_assert(this->getRepr() != NULL); + g_assert(this->getRepr() != nullptr); sp_repr_css_change(this->getRepr(), css, attr); } @@ -443,7 +443,7 @@ void SPObject::setLabel(gchar const *label) void SPObject::requestOrphanCollection() { - g_return_if_fail(document != NULL); + g_return_if_fail(document != nullptr); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // do not remove style or script elements (Bug #276244) @@ -484,7 +484,7 @@ void SPObject::_sendDeleteSignalRecursive() { void SPObject::deleteObject(bool propagate, bool propagate_descendants) { - sp_object_ref(this, NULL); + sp_object_ref(this, nullptr); if ( SP_IS_LPE_ITEM(this) && SP_LPE_ITEM(this)->hasPathEffect()) { SP_LPE_ITEM(this)->removeAllPathEffects(false); } @@ -503,7 +503,7 @@ void SPObject::deleteObject(bool propagate, bool propagate_descendants) if (_successor) { _successor->deleteObject(propagate, propagate_descendants); } - sp_object_unref(this, NULL); + sp_object_unref(this, nullptr); } void SPObject::cropToObject(SPObject *except) @@ -527,7 +527,7 @@ void SPObject::attach(SPObject *object, SPObject *prev) { //g_return_if_fail(parent != NULL); //g_return_if_fail(SP_IS_OBJECT(parent)); - g_return_if_fail(object != NULL); + g_return_if_fail(object != nullptr); g_return_if_fail(SP_IS_OBJECT(object)); g_return_if_fail(!prev || SP_IS_OBJECT(prev)); g_return_if_fail(!prev || prev->parent == this); @@ -566,14 +566,14 @@ void SPObject::detach(SPObject *object) { //g_return_if_fail(parent != NULL); //g_return_if_fail(SP_IS_OBJECT(parent)); - g_return_if_fail(object != NULL); + g_return_if_fail(object != nullptr); g_return_if_fail(SP_IS_OBJECT(object)); g_return_if_fail(object->parent == this); children.erase(children.iterator_to(*object)); object->releaseReferences(); - object->parent = NULL; + object->parent = nullptr; this->_updateTotalHRefCount(-object->_total_hrefcount); sp_object_unref(object, this); @@ -581,7 +581,7 @@ void SPObject::detach(SPObject *object) SPObject *SPObject::get_child_by_repr(Inkscape::XML::Node *repr) { - g_return_val_if_fail(repr != NULL, NULL); + g_return_val_if_fail(repr != nullptr, NULL); SPObject *result = nullptr; if (children.size() > 0 && children.back().getRepr() == repr) { @@ -603,7 +603,7 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) const std::string type_string = NodeTraits::get_type_string(*child); SPObject* ochild = SPFactory::createObject(type_string); - if (ochild == NULL) { + if (ochild == nullptr) { // Currenty, there are many node types that do not have // corresponding classes in the SPObject tree. // (rdf:RDF, inkscape:clipboard, ...) @@ -611,9 +611,9 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) return; } - SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL; + SPObject *prev = ref ? object->get_child_by_repr(ref) : nullptr; object->attach(ochild, prev); - sp_object_unref(ochild, NULL); + sp_object_unref(ochild, nullptr); ochild->invoke_build(object->document, child, object->cloned); } @@ -644,8 +644,8 @@ void SPObject::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node * / SPObject* object = this; SPObject *ochild = object->get_child_by_repr(child); - g_return_if_fail(ochild != NULL); - SPObject *prev = new_ref ? object->get_child_by_repr(new_ref) : NULL; + g_return_if_fail(ochild != nullptr); + SPObject *prev = new_ref ? object->get_child_by_repr(new_ref) : nullptr; object->reorder(ochild, prev); ochild->_position_changed_signal.emit(ochild); } @@ -668,11 +668,11 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) { // stuff externally modified to have no id. object->clone_original = document->getObjectById(repr->attribute("id")); - for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != NULL; rchild = rchild->next()) { + for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != nullptr; rchild = rchild->next()) { const std::string typeString = NodeTraits::get_type_string(*rchild); SPObject* child = SPFactory::createObject(typeString); - if (child == NULL) { + if (child == nullptr) { // Currenty, there are many node types that do not have // corresponding classes in the SPObject tree. // (rdf:RDF, inkscape:clipboard, ...) @@ -681,7 +681,7 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) { } object->attach(child, object->lastChild()); - sp_object_unref(child, NULL); + sp_object_unref(child, nullptr); child->invoke_build(document, rchild, object->cloned); } @@ -699,12 +699,12 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns //g_assert(object != NULL); //g_assert(SP_IS_OBJECT(object)); - g_assert(document != NULL); - g_assert(repr != NULL); + g_assert(document != nullptr); + g_assert(repr != nullptr); - g_assert(this->document == NULL); - g_assert(this->repr == NULL); - g_assert(this->getId() == NULL); + g_assert(this->document == nullptr); + g_assert(this->repr == nullptr); + g_assert(this->getId() == nullptr); /* Bookkeeping */ @@ -727,7 +727,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns if (!document->isSeeking()) { { gchar *realid = sp_object_get_unique_id(this, id); - g_assert(realid != NULL); + g_assert(realid != nullptr); this->document->bindObjectToId(realid, this); SPObjectImpl::setId(this, realid); @@ -735,7 +735,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns } /* Redefine ID, if required */ - if ((id == NULL) || (strcmp(id, this->getId()) != 0)) { + if ((id == nullptr) || (strcmp(id, this->getId()) != 0)) { this->repr->setAttribute("id", this->getId()); } } else if (id) { @@ -748,7 +748,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns } } } else { - g_assert(this->getId() == NULL); + g_assert(this->getId() == nullptr); } @@ -790,7 +790,7 @@ SPObject* SPObject::nthChild(unsigned index) { counter++; } } - return NULL; + return nullptr; } void SPObject::addChild(Inkscape::XML::Node *child, Inkscape::XML::Node * prev) @@ -815,15 +815,15 @@ void SPObject::releaseReferences() { if (!cloned) { if (this->id) { - this->document->bindObjectToId(this->id, NULL); + this->document->bindObjectToId(this->id, nullptr); } g_free(this->id); - this->id = NULL; + this->id = nullptr; g_free(this->_default_label); - this->_default_label = NULL; + this->_default_label = nullptr; - this->document->bindObjectToRepr(this->repr, NULL); + this->document->bindObjectToRepr(this->repr, nullptr); Inkscape::GC::release(this->repr); } else { @@ -835,8 +835,8 @@ void SPObject::releaseReferences() { // this->style = sp_style_unref(this->style); // } - this->document = NULL; - this->repr = NULL; + this->document = nullptr; + this->repr = nullptr; } @@ -897,7 +897,7 @@ void SPObject::set(unsigned int key, gchar const* value) { //XML Tree being used here. if ( !object->cloned && object->getRepr()->type() == Inkscape::XML::ELEMENT_NODE ) { SPDocument *document=object->document; - SPObject *conflict=NULL; + SPObject *conflict=nullptr; gchar const *new_id = value; @@ -907,20 +907,20 @@ void SPObject::set(unsigned int key, gchar const* value) { if ( conflict && conflict != object ) { if (!document->isSeeking()) { - sp_object_ref(conflict, NULL); + sp_object_ref(conflict, nullptr); // give the conflicting object a new ID - gchar *new_conflict_id = sp_object_get_unique_id(conflict, NULL); + gchar *new_conflict_id = sp_object_get_unique_id(conflict, nullptr); conflict->getRepr()->setAttribute("id", new_conflict_id); g_free(new_conflict_id); - sp_object_unref(conflict, NULL); + sp_object_unref(conflict, nullptr); } else { - new_id = NULL; + new_id = nullptr; } } if (object->getId()) { - document->bindObjectToId(object->getId(), NULL); - SPObjectImpl::setId(object, 0); + document->bindObjectToId(object->getId(), nullptr); + SPObjectImpl::setId(object, nullptr); } if (new_id) { @@ -929,7 +929,7 @@ void SPObject::set(unsigned int key, gchar const* value) { } g_free(object->_default_label); - object->_default_label = NULL; + object->_default_label = nullptr; } break; case SP_ATTR_INKSCAPE_LABEL: @@ -937,10 +937,10 @@ void SPObject::set(unsigned int key, gchar const* value) { if (value) { object->_label = g_strdup(value); } else { - object->_label = NULL; + object->_label = nullptr; } g_free(object->_default_label); - object->_default_label = NULL; + object->_default_label = nullptr; break; case SP_ATTR_INKSCAPE_COLLECT: if ( value && !strcmp(value, "always") ) { @@ -987,10 +987,10 @@ void SPObject::readAttr(gchar const *key) { //g_assert(object != NULL); //g_assert(SP_IS_OBJECT(object)); - g_assert(key != NULL); + g_assert(key != nullptr); //XML Tree being used here. - g_assert(this->getRepr() != NULL); + g_assert(this->getRepr() != nullptr); unsigned int keyid = sp_attribute_lookup(key); if (keyid != SP_ATTR_INVALID) { @@ -1032,7 +1032,7 @@ static gchar const *sp_xml_get_space_string(unsigned int space) case SP_XML_SPACE_PRESERVE: return "preserve"; default: - return NULL; + return nullptr; } } @@ -1044,7 +1044,7 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML if (!repr && (flags & SP_OBJECT_WRITE_BUILD)) { repr = this->getRepr()->duplicate(doc); if (!( flags & SP_OBJECT_WRITE_EXT )) { - repr->setAttribute("inkscape:collect", NULL); + repr->setAttribute("inkscape:collect", nullptr); } } else if (repr) { repr->setAttribute("id", this->getId()); @@ -1060,7 +1060,7 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML { repr->setAttribute("inkscape:collect", "always"); } else { - repr->setAttribute("inkscape:collect", NULL); + repr->setAttribute("inkscape:collect", nullptr); } if (style) { @@ -1078,7 +1078,7 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML } if( s.empty() ) { - repr->setAttribute("style", NULL); + repr->setAttribute("style", nullptr); } else { repr->setAttribute("style", s.c_str()); } @@ -1138,14 +1138,14 @@ Inkscape::XML::Node * SPObject::updateRepr(unsigned int flags) #ifdef OBJECT_TRACE objectTrace( "SPObject::updateRepr 1", false ); #endif - return NULL; + return nullptr; } } else { /* cloned objects have no repr */ #ifdef OBJECT_TRACE objectTrace( "SPObject::updateRepr 1", false ); #endif - return NULL; + return nullptr; } } @@ -1155,14 +1155,14 @@ Inkscape::XML::Node * SPObject::updateRepr(Inkscape::XML::Document *doc, Inkscap objectTrace( "SPObject::updateRepr 2" ); #endif - g_assert(doc != NULL); + g_assert(doc != nullptr); if (cloned) { /* cloned objects have no repr */ #ifdef OBJECT_TRACE objectTrace( "SPObject::updateRepr 2", false ); #endif - return NULL; + return nullptr; } if (!(flags & SP_OBJECT_WRITE_BUILD) && !repr) { @@ -1183,7 +1183,7 @@ Inkscape::XML::Node * SPObject::updateRepr(Inkscape::XML::Document *doc, Inkscap void SPObject::requestDisplayUpdate(unsigned int flags) { - g_return_if_fail( this->document != NULL ); + g_return_if_fail( this->document != nullptr ); if (update_in_progress) { g_print("WARNING: Requested update while update in progress, counter = %d\n", update_in_progress); @@ -1276,7 +1276,7 @@ void SPObject::updateDisplay(SPCtx *ctx, unsigned int flags) void SPObject::requestModified(unsigned int flags) { - g_return_if_fail( this->document != NULL ); + g_return_if_fail( this->document != nullptr ); /* requestModified must be used only to set one of SP_OBJECT_MODIFIED_FLAG or * SP_OBJECT_CHILD_MODIFIED_FLAG */ @@ -1340,10 +1340,10 @@ void SPObject::emitModified(unsigned int flags) gchar const *SPObject::getTagName(SPException *ex) const { - g_assert(repr != NULL); + g_assert(repr != nullptr); /* If exception is not clear, return */ if (!SP_EXCEPTION_IS_OK(ex)) { - return NULL; + return nullptr; } /// \todo fixme: Exception if object is NULL? */ @@ -1353,10 +1353,10 @@ gchar const *SPObject::getTagName(SPException *ex) const gchar const *SPObject::getAttribute(gchar const *key, SPException *ex) const { - g_assert(this->repr != NULL); + g_assert(this->repr != nullptr); /* If exception is not clear, return */ if (!SP_EXCEPTION_IS_OK(ex)) { - return NULL; + return nullptr; } /// \todo fixme: Exception if object is NULL? */ @@ -1366,7 +1366,7 @@ gchar const *SPObject::getAttribute(gchar const *key, SPException *ex) const void SPObject::setAttribute(gchar const *key, gchar const *value, SPException *ex) { - g_assert(this->repr != NULL); + g_assert(this->repr != nullptr); /* If exception is not clear, return */ g_return_if_fail(SP_EXCEPTION_IS_OK(ex)); @@ -1377,13 +1377,13 @@ void SPObject::setAttribute(gchar const *key, gchar const *value, SPException *e void SPObject::setAttribute(char const *key, Glib::ustring const &value, SPException *ex) { - setAttribute(key, value.empty() ? NULL : value.c_str(), ex); + setAttribute(key, value.empty() ? nullptr : value.c_str(), ex); } void SPObject::setAttribute(Glib::ustring const &key, Glib::ustring const &value, SPException *ex) { - setAttribute( key.empty() ? NULL : key.c_str(), - value.empty() ? NULL : value.c_str(), ex); + setAttribute( key.empty() ? nullptr : key.c_str(), + value.empty() ? nullptr : value.c_str(), ex); } @@ -1394,12 +1394,12 @@ void SPObject::removeAttribute(gchar const *key, SPException *ex) /// \todo fixme: Exception if object is NULL? */ //XML Tree being used here. - getRepr()->setAttribute(key, NULL, false); + getRepr()->setAttribute(key, nullptr, false); } bool SPObject::storeAsDouble( gchar const *key, double *val ) const { - g_assert(this->getRepr()!= NULL); + g_assert(this->getRepr()!= nullptr); return sp_repr_get_double(((Inkscape::XML::Node *)(this->getRepr())),key,val); } @@ -1416,15 +1416,15 @@ sp_object_get_unique_id(SPObject *object, //XML Tree being used here. gchar const *name = object->getRepr()->name(); - g_assert(name != NULL); + g_assert(name != nullptr); gchar const *local = strchr(name, ':'); if (local) { name = local + 1; } - if (id != NULL) { - if (object->document->getObjectById(id) == NULL) { + if (id != nullptr) { + if (object->document->getObjectById(id) == nullptr) { return g_strdup(id); } } @@ -1438,7 +1438,7 @@ sp_object_get_unique_id(SPObject *object, do { ++count; g_snprintf(count_buf, count_buflen, "%lu", count); - } while ( object->document->getObjectById(buf) != NULL ); + } while ( object->document->getObjectById(buf) != nullptr ); return buf; } @@ -1448,7 +1448,7 @@ gchar const * SPObject::getStyleProperty(gchar const *key, gchar const *def) con { //g_return_val_if_fail(object != NULL, NULL); //g_return_val_if_fail(SP_IS_OBJECT(object), NULL); - g_return_val_if_fail(key != NULL, NULL); + g_return_val_if_fail(key != nullptr, NULL); //XML Tree being used here. gchar const *style = getRepr()->attribute("style"); @@ -1456,7 +1456,7 @@ gchar const * SPObject::getStyleProperty(gchar const *key, gchar const *def) con size_t const len = strlen(key); char const *p; while ( (p = strstr(style, key)) - != NULL ) + != nullptr ) { p += len; while ((*p <= ' ') && *p) { @@ -1540,7 +1540,7 @@ bool SPObject::setDesc(gchar const *desc, bool verbatim) char * SPObject::getTitleOrDesc(gchar const *svg_tagname) const { - char *result = NULL; + char *result = nullptr; SPObject *elem = findFirstChild(svg_tagname); if ( elem ) { //This string copy could be avoided by changing @@ -1565,7 +1565,7 @@ bool SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool } } if (just_whitespace) { - value = NULL; + value = nullptr; } } // Don't stomp on mark-up if there is no real change. @@ -1583,8 +1583,8 @@ bool SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool SPObject *elem = findFirstChild(svg_tagname); - if (value == NULL) { - if (elem == NULL) { + if (value == nullptr) { + if (elem == nullptr) { return false; } // delete the title/description(s) @@ -1597,11 +1597,11 @@ bool SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool Inkscape::XML::Document *xml_doc = document->getReprDoc(); - if (elem == NULL) { + if (elem == nullptr) { // create a new 'title' or 'desc' element, putting it at the // beginning (in accordance with the spec's recommendations) Inkscape::XML::Node *xml_elem = xml_doc->createElement(svg_tagname); - repr->addChild(xml_elem, NULL); + repr->addChild(xml_elem, nullptr); elem = document->getObjectByRepr(xml_elem); Inkscape::GC::release(xml_elem); } diff --git a/src/object/sp-object.h b/src/object/sp-object.h index f969e0c0a..3b083761e 100644 --- a/src/object/sp-object.h +++ b/src/object/sp-object.h @@ -137,7 +137,7 @@ public: * \pre object points to real object * @todo need to move this to be a member of SPObject. */ -SPObject *sp_object_ref(SPObject *object, SPObject *owner=NULL); +SPObject *sp_object_ref(SPObject *object, SPObject *owner=nullptr); /** * Decrease reference count of object, with possible debugging and @@ -148,7 +148,7 @@ SPObject *sp_object_ref(SPObject *object, SPObject *owner=NULL); * \pre object points to real object * @todo need to move this to be a member of SPObject. */ -SPObject *sp_object_unref(SPObject *object, SPObject *owner=NULL); +SPObject *sp_object_unref(SPObject *object, SPObject *owner=nullptr); /** * Increase weak refcount. @@ -287,7 +287,7 @@ public: typedef Inkscape::Util::ForwardPointerIterator<SPObject const, ParentIteratorStrategy> ConstParentIterator; bool isSiblingOf(SPObject const *object) const { - if (object == NULL) return false; + if (object == nullptr) return false; return this->parent && this->parent == object->parent; } @@ -510,7 +510,7 @@ public: assert(successor != NULL); assert(_successor == NULL); assert(successor->_successor == NULL); - sp_object_ref(successor, NULL); + sp_object_ref(successor, nullptr); _successor = successor; } @@ -696,20 +696,20 @@ public: unsigned getPosition(); - char const * getAttribute(char const *name,SPException *ex=NULL) const; + char const * getAttribute(char const *name,SPException *ex=nullptr) const; void appendChild(Inkscape::XML::Node *child); - void addChild(Inkscape::XML::Node *child,Inkscape::XML::Node *prev=NULL); + void addChild(Inkscape::XML::Node *child,Inkscape::XML::Node *prev=nullptr); /** * Call virtual set() function of object. */ void setKeyValue(unsigned int key, char const *value); - void setAttribute( char const *key, char const *value, SPException *ex=NULL); - void setAttribute( char const *key, Glib::ustring const &value, SPException *ex=NULL); - void setAttribute(Glib::ustring const &key, Glib::ustring const &value, SPException *ex=NULL); + void setAttribute( char const *key, char const *value, SPException *ex=nullptr); + void setAttribute( char const *key, Glib::ustring const &value, SPException *ex=nullptr); + void setAttribute(Glib::ustring const &key, Glib::ustring const &value, SPException *ex=nullptr); /** * Read value of key attribute from XML node into object. @@ -718,7 +718,7 @@ public: char const *getTagName(SPException *ex) const; - void removeAttribute(char const *key, SPException *ex=NULL); + void removeAttribute(char const *key, SPException *ex=nullptr); /** * Returns an object style property. diff --git a/src/object/sp-offset.cpp b/src/object/sp-offset.cpp index dbb5d15e4..9f9297077 100644 --- a/src/object/sp-offset.cpp +++ b/src/object/sp-offset.cpp @@ -87,15 +87,15 @@ static bool use_slow_but_correct_offset_method = false; SPOffset::SPOffset() : SPShape() { this->rad = 1.0; - this->original = NULL; - this->originalPath = NULL; + this->original = nullptr; + this->originalPath = nullptr; this->knotSet = false; this->sourceDirty=false; this->isUpdating=false; // init various connections - this->sourceHref = NULL; - this->sourceRepr = NULL; - this->sourceObject = NULL; + this->sourceHref = nullptr; + this->sourceRepr = nullptr; + this->sourceObject = nullptr; // set up the uri reference this->sourceRef = new SPUseReference(this); @@ -122,7 +122,7 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) { //in all the below lines in the block while it shouldn't be. gchar const *oldA = this->getRepr()->attribute("sodipodi:radius"); this->getRepr()->setAttribute("inkscape:radius",oldA); - this->getRepr()->setAttribute("sodipodi:radius",NULL); + this->getRepr()->setAttribute("sodipodi:radius",nullptr); this->readAttr( "inkscape:radius" ); } @@ -132,7 +132,7 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) { } else { gchar const *oldA = this->getRepr()->attribute("sodipodi:original"); this->getRepr()->setAttribute("inkscape:original",oldA); - this->getRepr()->setAttribute("sodipodi:original",NULL); + this->getRepr()->setAttribute("sodipodi:original",nullptr); this->readAttr( "inkscape:original" ); } @@ -155,7 +155,7 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) { free(nA); - this->getRepr()->setAttribute("inkscape:href",NULL); + this->getRepr()->setAttribute("inkscape:href",nullptr); } this->readAttr( "xlink:href" ); @@ -182,7 +182,7 @@ Inkscape::XML::Node* SPOffset::write(Inkscape::XML::Document *xml_doc, Inkscape: // Make sure the offset has curve SPCurve *curve = SP_SHAPE (this)->getCurve(); - if (curve == NULL) { + if (curve == nullptr) { this->set_shape(); } @@ -205,8 +205,8 @@ void SPOffset::release() { delete ((Path *) this->originalPath); } - this->original = NULL; - this->originalPath = NULL; + this->original = nullptr; + this->originalPath = nullptr; sp_offset_quit_listening(this); @@ -214,7 +214,7 @@ void SPOffset::release() { g_free(this->sourceHref); - this->sourceHref = NULL; + this->sourceHref = nullptr; this->sourceRef->detach(); SPShape::release(); @@ -230,14 +230,14 @@ void SPOffset::set(unsigned int key, const gchar* value) { { case SP_ATTR_INKSCAPE_ORIGINAL: case SP_ATTR_SODIPODI_ORIGINAL: - if (value == NULL) { + if (value == nullptr) { } else { if (this->original) { free (this->original); delete ((Path *) this->originalPath); - this->original = NULL; - this->originalPath = NULL; + this->original = nullptr; + this->originalPath = nullptr; } this->original = strdup (value); @@ -272,13 +272,13 @@ void SPOffset::set(unsigned int key, const gchar* value) { case SP_ATTR_INKSCAPE_HREF: case SP_ATTR_XLINK_HREF: - if ( value == NULL ) { + if ( value == nullptr ) { sp_offset_quit_listening(this); if ( this->sourceHref ) { g_free(this->sourceHref); } - this->sourceHref = NULL; + this->sourceHref = nullptr; this->sourceRef->detach(); } else { if ( this->sourceHref && ( strcmp(value, this->sourceHref) == 0 ) ) { @@ -339,7 +339,7 @@ gchar* SPOffset::description() const { } void SPOffset::set_shape() { - if ( this->originalPath == NULL ) { + if ( this->originalPath == nullptr ) { // oops : no path?! (the offset object should do harakiri) return; } @@ -359,7 +359,7 @@ void SPOffset::set_shape() { if ( res_d ) { Geom::PathVector pv = sp_svg_read_pathv(res_d); SPCurve *c = new SPCurve(pv); - g_assert(c != NULL); + g_assert(c != nullptr); this->setCurveInsync (c); this->setCurveBeforeLPE(c); @@ -539,7 +539,7 @@ void SPOffset::set_shape() { if ( nPartSurf >= 0 ) { // inversion de la surface -> disparait delete parts[i]; - parts[i]=NULL; + parts[i]=nullptr; } else { } @@ -576,7 +576,7 @@ void SPOffset::set_shape() { if ( nPartSurf >= 0 ) { // inversion de la surface -> disparait delete parts[i]; - parts[i]=NULL; + parts[i]=nullptr; } else { } @@ -649,7 +649,7 @@ void SPOffset::set_shape() { delete theRes; } { - char *res_d = NULL; + char *res_d = nullptr; if (orig->descr_cmd.size() <= 1) { @@ -667,7 +667,7 @@ void SPOffset::set_shape() { Geom::PathVector pv = sp_svg_read_pathv(res_d); SPCurve *c = new SPCurve(pv); - g_assert(c != NULL); + g_assert(c != nullptr); this->setCurveInsync (c); this->setCurveBeforeLPE(c); @@ -774,7 +774,7 @@ vectors_are_clockwise (Geom::Point A, Geom::Point B, Geom::Point C) double sp_offset_distance_to_original (SPOffset * offset, Geom::Point px) { - if (offset == NULL || offset->originalPath == NULL || ((Path *) offset->originalPath)->descr_cmd.size() <= 1) { + if (offset == nullptr || offset->originalPath == nullptr || ((Path *) offset->originalPath)->descr_cmd.size() <= 1) { return 1.0; } @@ -936,7 +936,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px) { (*px) = Geom::Point(0, 0); - if (offset == NULL) { + if (offset == nullptr) { return; } @@ -948,7 +948,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px) SPCurve *curve = SP_SHAPE (offset)->getCurve(); - if (curve == NULL) + if (curve == nullptr) { // CPPIFY //offset->set_shape(); @@ -956,7 +956,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px) curve = SP_SHAPE (offset)->getCurve(); - if (curve == NULL) + if (curve == nullptr) return; } @@ -988,7 +988,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px) // the listening functions static void sp_offset_start_listening(SPOffset *offset,SPObject* to) { - if ( to == NULL ) { + if ( to == nullptr ) { return; } @@ -1002,7 +1002,7 @@ static void sp_offset_start_listening(SPOffset *offset,SPObject* to) static void sp_offset_quit_listening(SPOffset *offset) { - if ( offset->sourceObject == NULL ) { + if ( offset->sourceObject == nullptr ) { return; } @@ -1010,8 +1010,8 @@ static void sp_offset_quit_listening(SPOffset *offset) offset->_delete_connection.disconnect(); offset->_transformed_connection.disconnect(); - offset->sourceRepr = NULL; - offset->sourceObject = NULL; + offset->sourceRepr = nullptr; + offset->sourceObject = nullptr; } static void @@ -1083,7 +1083,7 @@ sp_offset_delete_self(SPObject */*deleted*/, SPOffset *offset) g_free(offset->sourceHref); } - offset->sourceHref = NULL; + offset->sourceHref = nullptr; offset->sourceRef->detach(); } else if (mode == SP_CLONE_ORPHANS_DELETE) { offset->deleteObject(); @@ -1104,7 +1104,7 @@ sp_offset_source_modified (SPObject */*iSource*/, guint flags, SPItem *item) static void refresh_offset_source(SPOffset* offset) { - if ( offset == NULL ) { + if ( offset == nullptr ) { return; } @@ -1114,12 +1114,12 @@ refresh_offset_source(SPOffset* offset) // The bad case: no d attribute. Must check that it's an SPShape and then take the outline. SPObject *refobj=offset->sourceObject; - if ( refobj == NULL ) { + if ( refobj == nullptr ) { return; } SPItem *item = SP_ITEM (refobj); - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE (item)) { curve = SP_SHAPE (item)->getCurve (); @@ -1131,7 +1131,7 @@ refresh_offset_source(SPOffset* offset) return; } - if (curve == NULL) { + if (curve == nullptr) { return; } @@ -1162,7 +1162,7 @@ refresh_offset_source(SPOffset* offset) orig->Fill (theShape, 0); css = sp_repr_css_attr (offset->sourceRepr , "style"); - val = sp_repr_css_property (css, "fill-rule", NULL); + val = sp_repr_css_property (css, "fill-rule", nullptr); if (val && strcmp (val, "nonzero") == 0) { @@ -1208,7 +1208,7 @@ sp_offset_get_source (SPOffset *offset) } } - return NULL; + return nullptr; } diff --git a/src/object/sp-paint-server.cpp b/src/object/sp-paint-server.cpp index 958078012..3e685ad24 100644 --- a/src/object/sp-paint-server.cpp +++ b/src/object/sp-paint-server.cpp @@ -66,7 +66,7 @@ bool SPPaintServer::isValid() const Inkscape::DrawingPattern *SPPaintServer::show(Inkscape::Drawing &/*drawing*/, unsigned int /*key*/, Geom::OptRect /*bbox*/) { - return NULL; + return nullptr; } void SPPaintServer::hide(unsigned int /*key*/) @@ -79,7 +79,7 @@ void SPPaintServer::setBBox(unsigned int /*key*/, Geom::OptRect const &/*bbox*/) cairo_pattern_t* SPPaintServer::pattern_new(cairo_t * /*ct*/, Geom::OptRect const &/*bbox*/, double /*opacity*/) { - return NULL; + return nullptr; } /* diff --git a/src/object/sp-paint-server.h b/src/object/sp-paint-server.h index 23d0399af..4cd61bcda 100644 --- a/src/object/sp-paint-server.h +++ b/src/object/sp-paint-server.h @@ -87,7 +87,7 @@ PaintServer *chase_hrefs(PaintServer *src, sigc::slot<bool, PaintServer const *> if ( p2 == p1 ) { /* We've been here before, so return NULL to indicate that no matching gradient found * in the chain. */ - return NULL; + return nullptr; } } } diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp index de31b45e2..51fa549e7 100644 --- a/src/object/sp-path.cpp +++ b/src/object/sp-path.cpp @@ -196,15 +196,15 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) { this->readAttr( "d" ); /* d is a required attribute */ - char const *d = this->getAttribute("d", NULL); + char const *d = this->getAttribute("d", nullptr); - if (d == NULL) { + if (d == nullptr) { // First see if calculating the path effect will generate "d": this->update_patheffect(true); - d = this->getAttribute("d", NULL); + d = this->getAttribute("d", nullptr); // I guess that didn't work, now we have nothing useful to write ("") - if (d == NULL) { + if (d == nullptr) { this->setKeyValue( sp_attribute_lookup("d"), ""); } } @@ -228,7 +228,7 @@ void SPPath::set(unsigned int key, const gchar* value) { curve->unref(); } } else { - this->setCurveBeforeLPE(NULL); + this->setCurveBeforeLPE(nullptr); } sp_lpe_item_update_patheffect(this, true, true); @@ -244,7 +244,7 @@ void SPPath::set(unsigned int key, const gchar* value) { curve->unref(); } } else { - this->setCurve(NULL); + this->setCurve(nullptr); } break; @@ -285,16 +285,16 @@ g_message("sp_path_write writes 'd' attribute"); repr->setAttribute("d", str); g_free(str); } else { - repr->setAttribute("d", NULL); + repr->setAttribute("d", nullptr); } if (flags & SP_OBJECT_WRITE_EXT) { - if ( this->_curve_before_lpe != NULL ) { + if ( this->_curve_before_lpe != nullptr ) { gchar *str = sp_svg_write_path(this->_curve_before_lpe->get_pathvector()); repr->setAttribute("inkscape:original-d", str); g_free(str); } else { - repr->setAttribute("inkscape:original-d", NULL); + repr->setAttribute("inkscape:original-d", nullptr); } } diff --git a/src/object/sp-pattern.cpp b/src/object/sp-pattern.cpp index ebe78d63c..911f0873a 100644 --- a/src/object/sp-pattern.cpp +++ b/src/object/sp-pattern.cpp @@ -92,7 +92,7 @@ void SPPattern::release() this->_modified_connection.disconnect(); this->ref->detach(); delete this->ref; - this->ref = NULL; + this->ref = nullptr; } SPPaintServer::release(); @@ -222,7 +222,7 @@ void SPPattern::set(unsigned int key, const gchar *value) void SPPattern::_getChildren(std::list<SPObject *> &l) { - for (SPPattern *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->firstChild()) { // find the first one with children for (auto& child: pat_i->children) { l.push_back(&child); @@ -248,13 +248,13 @@ void SPPattern::update(SPCtx *ctx, unsigned int flags) for (SPObjectIterator it = l.begin(); it != l.end(); ++it) { SPObject *child = *it; - sp_object_ref(child, NULL); + sp_object_ref(child, nullptr); if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->updateDisplay(ctx, flags); } - sp_object_unref(child, NULL); + sp_object_unref(child, nullptr); } } @@ -274,13 +274,13 @@ void SPPattern::modified(unsigned int flags) for (SPObjectIterator it = l.begin(); it != l.end(); ++it) { SPObject *child = *it; - sp_object_ref(child, NULL); + sp_object_ref(child, nullptr); if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } - sp_object_unref(child, NULL); + sp_object_unref(child, nullptr); } } @@ -337,7 +337,7 @@ SPPattern *SPPattern::_chain() const Glib::ustring parent_ref = Glib::ustring::compose("#%1", getRepr()->attribute("id")); repr->setAttribute("xlink:href", parent_ref); - defsrepr->addChild(repr, NULL); + defsrepr->addChild(repr, nullptr); const gchar *child_id = repr->attribute("id"); SPObject *child = document->getObjectById(child_id); g_assert(SP_IS_PATTERN(child)); @@ -411,7 +411,7 @@ const gchar *SPPattern::produce(const std::vector<Inkscape::XML::Node *> &reprs, dup_transform = Geom::identity(); dup_transform *= move; - copy->doWriteTransform(dup_transform, NULL, false); + copy->doWriteTransform(dup_transform, nullptr, false); } Inkscape::GC::release(repr); @@ -420,7 +420,7 @@ const gchar *SPPattern::produce(const std::vector<Inkscape::XML::Node *> &reprs, SPPattern *SPPattern::rootPattern() { - for (SPPattern *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->firstChild()) { // find the first one with children return pat_i; } @@ -436,7 +436,7 @@ SPPattern *SPPattern::rootPattern() SPPattern::PatternUnits SPPattern::patternUnits() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_pattern_units_set) return pat_i->_pattern_units; } @@ -445,7 +445,7 @@ SPPattern::PatternUnits SPPattern::patternUnits() const SPPattern::PatternUnits SPPattern::patternContentUnits() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_pattern_content_units_set) return pat_i->_pattern_content_units; } @@ -454,7 +454,7 @@ SPPattern::PatternUnits SPPattern::patternContentUnits() const Geom::Affine const &SPPattern::getTransform() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_pattern_transform_set) return pat_i->_pattern_transform; } @@ -463,7 +463,7 @@ Geom::Affine const &SPPattern::getTransform() const gdouble SPPattern::x() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_x._set) return pat_i->_x.computed; } @@ -472,7 +472,7 @@ gdouble SPPattern::x() const gdouble SPPattern::y() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_y._set) return pat_i->_y.computed; } @@ -481,7 +481,7 @@ gdouble SPPattern::y() const gdouble SPPattern::width() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_width._set) return pat_i->_width.computed; } @@ -490,7 +490,7 @@ gdouble SPPattern::width() const gdouble SPPattern::height() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_height._set) return pat_i->_height.computed; } @@ -500,7 +500,7 @@ gdouble SPPattern::height() const Geom::OptRect SPPattern::viewbox() const { Geom::OptRect viewbox; - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->viewBox_set) { viewbox = pat_i->viewBox; break; @@ -537,13 +537,13 @@ cairo_pattern_t *SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b bool visible = opacity >= 1e-3; if (!visible) { - return NULL; + return nullptr; } /* Show items */ - SPPattern *shown = NULL; + SPPattern *shown = nullptr; - for (SPPattern *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { // find the first one with item children if (pat_i && SP_IS_OBJECT(pat_i) && pat_i->_hasItemChildren()) { shown = pat_i; diff --git a/src/object/sp-polygon.cpp b/src/object/sp-polygon.cpp index b2a0c1480..90bc0c731 100644 --- a/src/object/sp-polygon.cpp +++ b/src/object/sp-polygon.cpp @@ -69,7 +69,7 @@ Inkscape::XML::Node* SPPolygon::write(Inkscape::XML::Document *xml_doc, Inkscape /* We can safely write points here, because all subclasses require it too (Lauris) */ /* While saving polygon element without points attribute _curve is NULL (see bug 1202753) */ - if (this->_curve != NULL) { + if (this->_curve != nullptr) { gchar *str = sp_svg_write_polygon(this->_curve->get_pathvector()); repr->setAttribute("points", str); g_free(str); @@ -91,7 +91,7 @@ static gboolean polygon_get_value(gchar const **p, gdouble *v) return false; } - gchar *e = NULL; + gchar *e = nullptr; *v = g_ascii_strtod(*p, &e); if (e == *p) { diff --git a/src/object/sp-polyline.cpp b/src/object/sp-polyline.cpp index 3be4700eb..aa8dab7e2 100644 --- a/src/object/sp-polyline.cpp +++ b/src/object/sp-polyline.cpp @@ -46,7 +46,7 @@ void SPPolyLine::set(unsigned int key, const gchar* value) { hascpt = FALSE; cptr = value; - eptr = NULL; + eptr = nullptr; while (TRUE) { gdouble x, y; diff --git a/src/object/sp-rect.cpp b/src/object/sp-rect.cpp index 08c3df4fd..783ad309a 100644 --- a/src/object/sp-rect.cpp +++ b/src/object/sp-rect.cpp @@ -198,8 +198,8 @@ const char* SPRect::displayName() const { void SPRect::set_shape() { if ((this->height.computed < 1e-18) || (this->width.computed < 1e-18)) { - this->setCurveInsync(NULL); - this->setCurveBeforeLPE(NULL); + this->setCurveInsync(nullptr); + this->setCurveBeforeLPE(nullptr); return; } diff --git a/src/object/sp-root.cpp b/src/object/sp-root.cpp index 3f31588cc..d1c4b4d35 100644 --- a/src/object/sp-root.cpp +++ b/src/object/sp-root.cpp @@ -30,7 +30,7 @@ SPRoot::SPRoot() : SPGroup(), SPViewBox() { - this->onload = NULL; + this->onload = nullptr; static Inkscape::Version const zero_version(0, 0); @@ -44,7 +44,7 @@ SPRoot::SPRoot() : SPGroup(), SPViewBox() this->width.unset(SVGLength::PERCENT, 1.0, 1.0); this->height.unset(SVGLength::PERCENT, 1.0, 1.0); - this->defs = NULL; + this->defs = nullptr; } SPRoot::~SPRoot() @@ -91,7 +91,7 @@ void SPRoot::build(SPDocument *document, Inkscape::XML::Node *repr) void SPRoot::release() { - this->defs = NULL; + this->defs = nullptr; SPGroup::release(); } @@ -191,7 +191,7 @@ void SPRoot::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) void SPRoot::remove_child(Inkscape::XML::Node *child) { if (this->defs && (this->defs->getRepr() == child)) { - SPObject *iter = 0; + SPObject *iter = nullptr; // We search for first remaining <defs> node - it is not beautiful, but works for (auto& child: children) { @@ -204,7 +204,7 @@ void SPRoot::remove_child(Inkscape::XML::Node *child) if (!iter) { /* we should probably create a new <defs> here? */ - this->defs = NULL; + this->defs = nullptr; } } @@ -285,7 +285,7 @@ void SPRoot::update(SPCtx *ctx, guint flags) SPGroup::update((SPCtx *) &rctx, flags); /* As last step set additional transform of drawing group */ - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); g->setChildTransform(this->c2p); } diff --git a/src/object/sp-script.cpp b/src/object/sp-script.cpp index 144c8d76a..45cf25bbf 100644 --- a/src/object/sp-script.cpp +++ b/src/object/sp-script.cpp @@ -15,7 +15,7 @@ #include "attributes.h" SPScript::SPScript() : SPObject() { - this->xlinkhref = NULL; + this->xlinkhref = nullptr; } SPScript::~SPScript() { diff --git a/src/object/sp-shape.cpp b/src/object/sp-shape.cpp index 1708ecfb3..cb636c100 100644 --- a/src/object/sp-shape.cpp +++ b/src/object/sp-shape.cpp @@ -51,11 +51,11 @@ static void sp_shape_update_marker_view (SPShape *shape, Inkscape::DrawingItem * SPShape::SPShape() : SPLPEItem() { for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) { - this->_marker[i] = NULL; + this->_marker[i] = nullptr; } - this->_curve = NULL; - this->_curve_before_lpe = NULL; + this->_curve = nullptr; + this->_curve_before_lpe = nullptr; } SPShape::~SPShape() { @@ -88,7 +88,7 @@ void SPShape::release() { for (int i = 0; i < SP_MARKER_LOC_QTY; i++) { if (this->_marker[i]) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { sp_marker_hide(_marker[i], v->arenaitem->key() + i); } @@ -138,7 +138,7 @@ void SPShape::update(SPCtx* ctx, guint flags) { double const aw = 1.0 / ictx->i2vp.descrim(); this->style->stroke_width.computed = this->style->stroke_width.value * aw; - for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) { + for (SPItemView *v = ((SPItem *) (this))->display; v != nullptr; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); if (hasMarkers()) { this->context_style = this->style; @@ -156,7 +156,7 @@ void SPShape::update(SPCtx* ctx, guint flags) { if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) { /* This is suboptimal, because changing parent style schedules recalculation */ /* But on the other hand - how can we know that parent does not tie style and transform */ - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); if (flags & SP_OBJECT_MODIFIED_FLAG) { @@ -168,7 +168,7 @@ void SPShape::update(SPCtx* ctx, guint flags) { if (this->hasMarkers ()) { /* Dimension marker views */ - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new (SP_MARKER_LOC_QTY)); } @@ -183,12 +183,12 @@ void SPShape::update(SPCtx* ctx, guint flags) { } /* Update marker views */ - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { sp_shape_update_marker_view (this, v->arenaitem); } // Marker selector needs this here or marker previews are not rendered. - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); sh->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children. @@ -397,7 +397,7 @@ void SPShape::modified(unsigned int flags) { SPLPEItem::modified(flags); if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); if (hasMarkers()) { this->context_style = this->style; @@ -760,12 +760,12 @@ void SPShape::update_patheffect(bool write) } if (write && success) { Inkscape::XML::Node *repr = this->getRepr(); - if (c_lpe != NULL) { + if (c_lpe != nullptr) { gchar *str = sp_svg_write_path(c_lpe->get_pathvector()); repr->setAttribute("d", str); g_free(str); } else { - repr->setAttribute("d", NULL); + repr->setAttribute("d", nullptr); } } c_lpe->unref(); @@ -823,7 +823,7 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /* void SPShape::hide(unsigned int key) { for (int i = 0; i < SP_MARKER_LOC_QTY; ++i) { if (_marker[i]) { - for (SPItemView* v = display; v != NULL; v = v->next) { + for (SPItemView* v = display; v != nullptr; v = v->next) { if (key == v->key) { sp_marker_hide(_marker[i], v->arenaitem->key() + i); } @@ -845,7 +845,7 @@ int SPShape::hasMarkers() const specified, then all three should appear. */ // Ignore markers for objects which are inside markers themselves. - for (SPObject *parent = this->parent; parent != NULL; parent = parent->parent) { + for (SPObject *parent = this->parent; parent != nullptr; parent = parent->parent) { if (dynamic_cast<SPMarker *>(parent)) { return 0; } @@ -925,13 +925,13 @@ static void sp_shape_marker_release (SPObject *marker, SPShape *shape) { SPItem *item = dynamic_cast<SPItem *>(shape); - g_return_if_fail(item != NULL); + g_return_if_fail(item != nullptr); for (int i = 0; i < SP_MARKER_LOC_QTY; i++) { if (marker == shape->_marker[i]) { SPItemView *v; /* Hide marker */ - for (v = item->display; v != NULL; v = v->next) { + for (v = item->display; v != nullptr; v = v->next) { sp_marker_hide(shape->_marker[i], v->arenaitem->key() + i); } /* Detach marker */ @@ -963,7 +963,7 @@ void sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value) { SPShape *shape = dynamic_cast<SPShape *>(object); - g_return_if_fail(shape != NULL); + g_return_if_fail(shape != nullptr); if (key > SP_MARKER_LOC_END) { return; @@ -980,7 +980,7 @@ sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value) shape->_modified_connect[key].disconnect(); /* Hide marker */ - for (v = shape->display; v != NULL; v = v->next) { + for (v = shape->display; v != nullptr; v = v->next) { sp_marker_hide(shape->_marker[key], v->arenaitem->key() + key); } @@ -1082,7 +1082,7 @@ SPCurve * SPShape::getCurve(unsigned int owner) const return _curve->copy(); } - return NULL; + return nullptr; } /** @@ -1097,7 +1097,7 @@ SPCurve * SPShape::getCurveBeforeLPE(unsigned int owner) const } return _curve_before_lpe->copy(); } - return NULL; + return nullptr; } /** @@ -1116,7 +1116,7 @@ SPCurve * SPShape::getCurveForEdit(unsigned int owner) const } void SPShape::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const { - if (this->_curve == NULL) { + if (this->_curve == nullptr) { return; } diff --git a/src/object/sp-spiral.cpp b/src/object/sp-spiral.cpp index e17ddb10d..37e68d7c2 100644 --- a/src/object/sp-spiral.cpp +++ b/src/object/sp-spiral.cpp @@ -78,7 +78,7 @@ Inkscape::XML::Node* SPSpiral::write(Inkscape::XML::Document *xml_doc, Inkscape: // Nulls might be possible if this called iteratively if (!this->_curve) { //g_warning("sp_spiral_write(): No path to copy\n"); - return NULL; + return nullptr; } char *d = sp_svg_write_path(this->_curve->get_pathvector()); @@ -118,7 +118,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) { * N.B. atof/sscanf/strtod consider "nan" and "inf" * to be valid numbers. */ - this->exp = g_ascii_strtod (value, NULL); + this->exp = g_ascii_strtod (value, nullptr); this->exp = CLAMP (this->exp, 0.0, 1000.0); } else { this->exp = 1.0; @@ -129,7 +129,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) { case SP_ATTR_SODIPODI_REVOLUTION: if (value) { - this->revo = g_ascii_strtod (value, NULL); + this->revo = g_ascii_strtod (value, nullptr); this->revo = CLAMP (this->revo, 0.05, 1024.0); } else { this->revo = 3.0; @@ -148,7 +148,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) { case SP_ATTR_SODIPODI_ARGUMENT: if (value) { - this->arg = g_ascii_strtod (value, NULL); + this->arg = g_ascii_strtod (value, nullptr); /** \todo * FIXME: We still need some bounds on arg, for * numerical reasons. E.g., we don't want inf or NaN, @@ -166,7 +166,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) { case SP_ATTR_SODIPODI_T0: if (value) { - this->t0 = g_ascii_strtod (value, NULL); + this->t0 = g_ascii_strtod (value, nullptr); this->t0 = CLAMP (this->t0, 0.0, 0.999); /** \todo * Have shared constants for the allowable bounds for @@ -260,7 +260,7 @@ void SPSpiral::fitAndDraw(SPCurve* c, double dstep, Geom::Point darray[], Geom:: /** \todo * We should use better algorithm to specify maximum error. */ - depth = Geom::bezier_fit_cubic_full (bezier, NULL, darray, SAMPLE_SIZE, + depth = Geom::bezier_fit_cubic_full (bezier, nullptr, darray, SAMPLE_SIZE, hat1, hat2, SPIRAL_TOLERANCE*SPIRAL_TOLERANCE, FITTING_MAX_BEZIERS); @@ -576,14 +576,14 @@ void SPSpiral::getPolar(gdouble t, gdouble* rad, gdouble* arg) const { bool SPSpiral::isInvalid() const { gdouble rad; - this->getPolar(0.0, &rad, NULL); + this->getPolar(0.0, &rad, nullptr); if (rad < 0.0 || rad > SP_HUGE) { g_print("rad(t=0)=%g\n", rad); return true; } - this->getPolar(1.0, &rad, NULL); + this->getPolar(1.0, &rad, nullptr); if (rad < 0.0 || rad > SP_HUGE) { g_print("rad(t=1)=%g\n", rad); diff --git a/src/object/sp-star.cpp b/src/object/sp-star.cpp index da00080a3..fdb85e392 100644 --- a/src/object/sp-star.cpp +++ b/src/object/sp-star.cpp @@ -87,7 +87,7 @@ Inkscape::XML::Node* SPStar::write(Inkscape::XML::Document *xml_doc, Inkscape::X repr->setAttribute("d", d); g_free(d); } else { - repr->setAttribute("d", NULL); + repr->setAttribute("d", nullptr); } // CPPIFY: see header file SPShape::write(xml_doc, repr, flags); @@ -112,7 +112,7 @@ void SPStar::set(unsigned int key, const gchar* value) { break; case SP_ATTR_SODIPODI_CX: - if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->center[Geom::X]) || + if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->center[Geom::X]) || (unit == SVGLength::EM) || (unit == SVGLength::EX) || (unit == SVGLength::PERCENT)) { @@ -123,7 +123,7 @@ void SPStar::set(unsigned int key, const gchar* value) { break; case SP_ATTR_SODIPODI_CY: - if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->center[Geom::Y]) || + if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->center[Geom::Y]) || (unit == SVGLength::EM) || (unit == SVGLength::EX) || (unit == SVGLength::PERCENT)) { @@ -134,7 +134,7 @@ void SPStar::set(unsigned int key, const gchar* value) { break; case SP_ATTR_SODIPODI_R1: - if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->r[0]) || + if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->r[0]) || (unit == SVGLength::EM) || (unit == SVGLength::EX) || (unit == SVGLength::PERCENT)) { @@ -146,7 +146,7 @@ void SPStar::set(unsigned int key, const gchar* value) { break; case SP_ATTR_SODIPODI_R2: - if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->r[1]) || + if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->r[1]) || (unit == SVGLength::EM) || (unit == SVGLength::EX) || (unit == SVGLength::PERCENT)) { @@ -158,7 +158,7 @@ void SPStar::set(unsigned int key, const gchar* value) { case SP_ATTR_SODIPODI_ARG1: if (value) { - this->arg[0] = g_ascii_strtod (value, NULL); + this->arg[0] = g_ascii_strtod (value, nullptr); } else { this->arg[0] = 0.0; } @@ -168,7 +168,7 @@ void SPStar::set(unsigned int key, const gchar* value) { case SP_ATTR_SODIPODI_ARG2: if (value) { - this->arg[1] = g_ascii_strtod (value, NULL); + this->arg[1] = g_ascii_strtod (value, nullptr); } else { this->arg[1] = 0.0; } @@ -188,7 +188,7 @@ void SPStar::set(unsigned int key, const gchar* value) { case SP_ATTR_INKSCAPE_ROUNDED: if (value) { - this->rounded = g_ascii_strtod (value, NULL); + this->rounded = g_ascii_strtod (value, nullptr); } else { this->rounded = 0.0; } @@ -198,7 +198,7 @@ void SPStar::set(unsigned int key, const gchar* value) { case SP_ATTR_INKSCAPE_RANDOMIZED: if (value) { - this->randomized = g_ascii_strtod (value, NULL); + this->randomized = g_ascii_strtod (value, nullptr); } else { this->randomized = 0.0; } @@ -452,7 +452,7 @@ void SPStar::set_shape() { void sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized) { - g_return_if_fail (star != NULL); + g_return_if_fail (star != nullptr); g_return_if_fail (SP_IS_STAR (star)); star->sides = CLAMP(sides, 3, 1024); diff --git a/src/object/sp-stop.cpp b/src/object/sp-stop.cpp index 58746c951..d016e6366 100644 --- a/src/object/sp-stop.cpp +++ b/src/object/sp-stop.cpp @@ -24,7 +24,7 @@ #include "svg/css-ostringstream.h" SPStop::SPStop() : SPObject() { - this->path_string = NULL; + this->path_string = nullptr; this->offset = 0.0; this->currentColor = false; @@ -152,8 +152,8 @@ Inkscape::XML::Node* SPStop::write(Inkscape::XML::Document* xml_doc, Inkscape::X } os << ";stop-opacity:" << opacity; repr->setAttribute("style", os.str().c_str()); - repr->setAttribute("stop-color", NULL); - repr->setAttribute("stop-opacity", NULL); + repr->setAttribute("stop-color", nullptr); + repr->setAttribute("stop-opacity", nullptr); sp_repr_set_css_double(repr, "offset", this->offset); /* strictly speaking, offset an SVG <number> rather than a CSS one, but exponents make no sense * for offset proportions. */ @@ -167,7 +167,7 @@ Inkscape::XML::Node* SPStop::write(Inkscape::XML::Document* xml_doc, Inkscape::X // A stop might have some non-stop siblings SPStop* SPStop::getNextStop() { - SPStop *result = 0; + SPStop *result = nullptr; for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) { if (SP_IS_STOP(obj)) { @@ -179,7 +179,7 @@ SPStop* SPStop::getNextStop() { } SPStop* SPStop::getPrevStop() { - SPStop *result = 0; + SPStop *result = nullptr; for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) { // The closest previous SPObject that is an SPStop *should* be ourself. @@ -215,7 +215,7 @@ SPColor SPStop::getEffectiveColor() const { SPColor ret; if (currentColor) { - char const *str = getStyleProperty("color", NULL); + char const *str = getStyleProperty("color", nullptr); /* Default value: arbitrarily black. (SVG1.1 and CSS2 both say that the initial * value depends on user agent, and don't give any further restrictions that I can * see.) */ @@ -237,7 +237,7 @@ guint32 SPStop::get_rgba32() const { * value depends on user agent, and don't give any further restrictions that I can * see.) */ if (this->currentColor) { - char const *str = this->getStyleProperty("color", NULL); + char const *str = this->getStyleProperty("color", nullptr); if (str) { rgb0 = sp_svg_read_color(str, rgb0); diff --git a/src/object/sp-string.cpp b/src/object/sp-string.cpp index df57a5a80..a01b05e8f 100644 --- a/src/object/sp-string.cpp +++ b/src/object/sp-string.cpp @@ -139,7 +139,7 @@ void SPString::read_content() { } break; default: - if( white_space && (!string.empty() || (getPrev() != NULL))) { + if( white_space && (!string.empty() || (getPrev() != nullptr))) { string += ' '; } string += c; @@ -149,7 +149,7 @@ void SPString::read_content() { } // End loop // Insert white space at end if more text follows - if (white_space && getRepr()->next() != NULL) { // can't use SPObject::getNext() when the SPObject tree is still being built + if (white_space && getRepr()->next() != nullptr) { // can't use SPObject::getNext() when the SPObject tree is still being built string += ' '; } diff --git a/src/object/sp-style-elem.cpp b/src/object/sp-style-elem.cpp index f1e66ae45..c273c844f 100644 --- a/src/object/sp-style-elem.cpp +++ b/src/object/sp-style-elem.cpp @@ -63,7 +63,7 @@ child_add_rm_cb(Inkscape::XML::Node *, Inkscape::XML::Node *, Inkscape::XML::Nod void *const data) { SPObject *obj = reinterpret_cast<SPObject *>(data); - g_assert(data != NULL); + g_assert(data != nullptr); obj->read_content(); } @@ -72,7 +72,7 @@ content_changed_cb(Inkscape::XML::Node *, gchar const *, gchar const *, void *const data) { SPObject *obj = reinterpret_cast<SPObject *>(data); - g_assert(data != NULL); + g_assert(data != nullptr); obj->read_content(); obj->document->getRoot()->emitModified( SP_OBJECT_MODIFIED_CASCADE ); } @@ -83,7 +83,7 @@ child_order_changed_cb(Inkscape::XML::Node *, Inkscape::XML::Node *, void *const data) { SPObject *obj = reinterpret_cast<SPObject *>(data); - g_assert(data != NULL); + g_assert(data != nullptr); obj->read_content(); } @@ -114,7 +114,7 @@ concat_children(Inkscape::XML::Node const &repr) { Glib::ustring ret; // effic: Initialising ret to a reasonable starting size could speed things up. - for (Inkscape::XML::Node const *rch = repr.firstChild(); rch != NULL; rch = rch->next()) { + for (Inkscape::XML::Node const *rch = repr.firstChild(); rch != nullptr; rch = rch->next()) { if ( rch->type() == TEXT_NODE ) { ret += rch->content(); } @@ -140,7 +140,7 @@ struct ParseTmp ParseTmp(CRStyleSheet *const stylesheet, SPDocument *const document) : stylesheet(stylesheet), stmtType(NO_STMT), - currStmt(NULL), + currStmt(nullptr), document(document), magic(ParseTmp_magic) { } @@ -170,7 +170,7 @@ import_style_cb (CRDocHandler *a_handler, // Get document g_return_if_fail(a_handler && a_uri); - g_return_if_fail(a_handler->app_data != NULL); + g_return_if_fail(a_handler->app_data != nullptr); ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); @@ -193,7 +193,7 @@ import_style_cb (CRDocHandler *a_handler, Inkscape::IO::Resource::get_filename (document->getURI(), a_uri->stryng->str); // Parse file - CRStyleSheet *stylesheet = cr_stylesheet_new (NULL); + CRStyleSheet *stylesheet = cr_stylesheet_new (nullptr); CRParser *parser = parser_init(stylesheet, document); CRStatus const parse_status = cr_parser_parse_file (parser, reinterpret_cast<const guchar *>(import_file.c_str()), CR_UTF_8); @@ -205,7 +205,7 @@ import_style_cb (CRDocHandler *a_handler, } // Need to delete ParseTmp created by parser_init() - CRDocHandler *sac_handler = NULL; + CRDocHandler *sac_handler = nullptr; cr_parser_get_sac_handler (parser, &sac_handler); ParseTmp *parse_new = reinterpret_cast<ParseTmp *>(sac_handler->app_data); cr_parser_destroy(parser); @@ -231,16 +231,16 @@ start_selector_cb(CRDocHandler *a_handler, CRSelector *a_sel_list) { g_return_if_fail(a_handler && a_sel_list); - g_return_if_fail(a_handler->app_data != NULL); + g_return_if_fail(a_handler->app_data != nullptr); ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); - if ( (parse_tmp.currStmt != NULL) + if ( (parse_tmp.currStmt != nullptr) || (parse_tmp.stmtType != NO_STMT) ) { g_warning("Expecting currStmt==NULL and stmtType==0 (NO_STMT) at start of ruleset, but found currStmt=%p, stmtType=%u", static_cast<void *>(parse_tmp.currStmt), unsigned(parse_tmp.stmtType)); // fixme: Check whether we need to unref currStmt if non-NULL. } - CRStatement *ruleset = cr_statement_new_ruleset(parse_tmp.stylesheet, a_sel_list, NULL, NULL); + CRStatement *ruleset = cr_statement_new_ruleset(parse_tmp.stylesheet, a_sel_list, nullptr, nullptr); g_return_if_fail(ruleset && ruleset->type == RULESET_STMT); parse_tmp.stmtType = NORMAL_RULESET_STMT; parse_tmp.currStmt = ruleset; @@ -251,7 +251,7 @@ end_selector_cb(CRDocHandler *a_handler, CRSelector *a_sel_list) { g_return_if_fail(a_handler && a_sel_list); - g_return_if_fail(a_handler->app_data != NULL); + g_return_if_fail(a_handler->app_data != nullptr); ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); CRStatement *const ruleset = parse_tmp.currStmt; @@ -270,7 +270,7 @@ end_selector_cb(CRDocHandler *a_handler, ruleset->kind.ruleset->sel_list, a_sel_list); } - parse_tmp.currStmt = NULL; + parse_tmp.currStmt = nullptr; parse_tmp.stmtType = NO_STMT; } @@ -278,15 +278,15 @@ static void start_font_face_cb(CRDocHandler *a_handler, CRParsingLocation *) { - g_return_if_fail(a_handler->app_data != NULL); + g_return_if_fail(a_handler->app_data != nullptr); ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); - if (parse_tmp.stmtType != NO_STMT || parse_tmp.currStmt != NULL) { + if (parse_tmp.stmtType != NO_STMT || parse_tmp.currStmt != nullptr) { g_warning("Expecting currStmt==NULL and stmtType==0 (NO_STMT) at start of @font-face, but found currStmt=%p, stmtType=%u", static_cast<void *>(parse_tmp.currStmt), unsigned(parse_tmp.stmtType)); // fixme: Check whether we need to unref currStmt if non-NULL. } - CRStatement *font_face_rule = cr_statement_new_at_font_face_rule (parse_tmp.stylesheet, NULL); + CRStatement *font_face_rule = cr_statement_new_at_font_face_rule (parse_tmp.stylesheet, nullptr); g_return_if_fail(font_face_rule && font_face_rule->type == AT_FONT_FACE_RULE_STMT); parse_tmp.stmtType = FONT_FACE_STMT; parse_tmp.currStmt = font_face_rule; @@ -295,7 +295,7 @@ start_font_face_cb(CRDocHandler *a_handler, static void end_font_face_cb(CRDocHandler *a_handler) { - g_return_if_fail(a_handler->app_data != NULL); + g_return_if_fail(a_handler->app_data != nullptr); ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); @@ -329,7 +329,7 @@ end_font_face_cb(CRDocHandler *a_handler) } // Add ttf or otf fonts. - CRDeclaration const *cur = NULL; + CRDeclaration const *cur = nullptr; for (cur = font_face_rule->kind.font_face_rule->decl_list; cur; cur = cur->next) { if (cur->property && cur->property->stryng && @@ -364,7 +364,7 @@ end_font_face_cb(CRDocHandler *a_handler) } } - parse_tmp.currStmt = NULL; + parse_tmp.currStmt = nullptr; parse_tmp.stmtType = NO_STMT; } @@ -376,7 +376,7 @@ property_cb(CRDocHandler *const a_handler, { // std::cout << "property_cb: Entrance: " << a_name->stryng->str << ": " << cr_term_to_string(a_value) << std::endl; g_return_if_fail(a_handler && a_name); - g_return_if_fail(a_handler->app_data != NULL); + g_return_if_fail(a_handler->app_data != nullptr); ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); @@ -422,7 +422,7 @@ parser_init(CRStyleSheet *const stylesheet, SPDocument *const document) { sac_handler->end_font_face = end_font_face_cb; sac_handler->property = property_cb; - CRParser *parser = cr_parser_new (NULL); + CRParser *parser = cr_parser_new (nullptr); cr_parser_set_sac_handler(parser, sac_handler); return parser; @@ -449,10 +449,10 @@ void SPStyleElem::read_content() { // style element would correspond to document->style_sheet, while // laters ones are chained on using style_sheet->next). - document->style_sheet = cr_stylesheet_new (NULL); + document->style_sheet = cr_stylesheet_new (nullptr); CRParser *parser = parser_init(document->style_sheet, document); - CRDocHandler *sac_handler = NULL; + CRDocHandler *sac_handler = nullptr; cr_parser_get_sac_handler (parser, &sac_handler); ParseTmp *parse_tmp = reinterpret_cast<ParseTmp *>(sac_handler->app_data); @@ -470,7 +470,7 @@ void SPStyleElem::read_content() { cr_cascade_set_sheet (document->style_cascade, document->style_sheet, ORIGIN_AUTHOR); } else { cr_stylesheet_destroy (document->style_sheet); - document->style_sheet = NULL; + document->style_sheet = nullptr; if (parse_status != CR_PARSING_ERROR) { g_printerr("parsing error code=%u\n", unsigned(parse_status)); /* Better than nothing. TODO: Improve libcroco's error handling. At a minimum, add a @@ -497,7 +497,7 @@ rec_add_listener(Inkscape::XML::Node &repr, Inkscape::XML::NodeEventVector const *const fns, void *const data) { repr.addListener(fns, data); - for (Inkscape::XML::Node *child = repr.firstChild(); child != NULL; child = child->next()) { + for (Inkscape::XML::Node *child = repr.firstChild(); child != nullptr; child = child->next()) { rec_add_listener(*child, fns, data); } } @@ -511,7 +511,7 @@ void SPStyleElem::build(SPDocument *document, Inkscape::XML::Node *repr) { static Inkscape::XML::NodeEventVector const nodeEventVector = { child_add_rm_cb, // child_added child_add_rm_cb, // child_removed - NULL, // attr_changed + nullptr, // attr_changed content_changed_cb, // content_changed child_order_changed_cb, // order_changed }; diff --git a/src/object/sp-switch.cpp b/src/object/sp-switch.cpp index d6ab1e904..88f3c46c7 100644 --- a/src/object/sp-switch.cpp +++ b/src/object/sp-switch.cpp @@ -21,7 +21,7 @@ #include <sigc++/adaptors/bind.h> SPSwitch::SPSwitch() : SPGroup() { - this->_cached_item = 0; + this->_cached_item = nullptr; } SPSwitch::~SPSwitch() { @@ -29,7 +29,7 @@ SPSwitch::~SPSwitch() { } SPObject *SPSwitch::_evaluateFirst() { - SPObject *first = 0; + SPObject *first = nullptr; for (auto& child: children) { if (SP_IS_ITEM(&child) && sp_item_evaluate(SP_ITEM(&child))) { @@ -48,7 +48,7 @@ std::vector<SPObject*> SPSwitch::_childList(bool add_ref, SPObject::Action actio SPObject *child = _evaluateFirst(); std::vector<SPObject*> x; - if (NULL == child) + if (nullptr == child) return x; if (add_ref) { @@ -120,11 +120,11 @@ void SPSwitch::_releaseItem(SPObject *obj, SPSwitch *selection) void SPSwitch::_releaseLastItem(SPObject *obj) { - if (NULL == this->_cached_item || this->_cached_item != obj) + if (nullptr == this->_cached_item || this->_cached_item != obj) return; this->_release_connection.disconnect(); - this->_cached_item = NULL; + this->_cached_item = nullptr; } void SPSwitch::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags) { diff --git a/src/object/sp-symbol.cpp b/src/object/sp-symbol.cpp index 55b5101af..07e6f660e 100644 --- a/src/object/sp-symbol.cpp +++ b/src/object/sp-symbol.cpp @@ -77,7 +77,7 @@ void SPSymbol::update(SPCtx *ctx, guint flags) { SPGroup::update((SPCtx *) &rctx, flags); // As last step set additional transform of drawing group - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); g->setChildTransform(this->c2p); } @@ -109,7 +109,7 @@ Inkscape::XML::Node* SPSymbol::write(Inkscape::XML::Document *xml_doc, Inkscape: } Inkscape::DrawingItem* SPSymbol::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { - Inkscape::DrawingItem *ai = 0; + Inkscape::DrawingItem *ai = nullptr; if (this->cloned) { // Cloned <symbol> is actually renderable diff --git a/src/object/sp-tag-use-reference.cpp b/src/object/sp-tag-use-reference.cpp index bb03c120a..c4de4a068 100644 --- a/src/object/sp-tag-use-reference.cpp +++ b/src/object/sp-tag-use-reference.cpp @@ -35,20 +35,20 @@ static void sp_usepath_delete_self(SPObject *deleted, SPTagUsePath *offset); SPTagUsePath::SPTagUsePath(SPObject* i_owner):SPTagUseReference(i_owner) { owner=i_owner; - originalPath = NULL; + originalPath = nullptr; sourceDirty=false; - sourceHref = NULL; - sourceRepr = NULL; - sourceObject = NULL; + sourceHref = nullptr; + sourceRepr = nullptr; + sourceObject = nullptr; _changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_usepath_href_changed), this)); // listening to myself, this should be virtual instead - user_unlink = NULL; + user_unlink = nullptr; } SPTagUsePath::~SPTagUsePath(void) { delete originalPath; - originalPath = NULL; + originalPath = nullptr; _changed_connection.disconnect(); // to do before unlinking @@ -59,7 +59,7 @@ SPTagUsePath::~SPTagUsePath(void) void SPTagUsePath::link(char *to) { - if ( to == NULL ) { + if ( to == nullptr ) { quit_listening(); unlink(); } else { @@ -83,14 +83,14 @@ void SPTagUsePath::unlink(void) { g_free(sourceHref); - sourceHref = NULL; + sourceHref = nullptr; detach(); } void SPTagUsePath::start_listening(SPObject* to) { - if ( to == NULL ) { + if ( to == nullptr ) { return; } sourceObject = to; @@ -101,12 +101,12 @@ SPTagUsePath::start_listening(SPObject* to) void SPTagUsePath::quit_listening(void) { - if ( sourceObject == NULL ) { + if ( sourceObject == nullptr ) { return; } _delete_connection.disconnect(); - sourceRepr = NULL; - sourceObject = NULL; + sourceRepr = nullptr; + sourceObject = nullptr; } static void diff --git a/src/object/sp-tag-use.cpp b/src/object/sp-tag-use.cpp index 1312b923f..c3fbfee7e 100644 --- a/src/object/sp-tag-use.cpp +++ b/src/object/sp-tag-use.cpp @@ -31,7 +31,7 @@ SPTagUse::SPTagUse() { - href = NULL; + href = nullptr; //new (_changed_connection) sigc::connection; ref = new SPTagUseReference(this); @@ -43,12 +43,12 @@ SPTagUse::~SPTagUse() if (child) { detach(child); - child = NULL; + child = nullptr; } ref->detach(); delete ref; - ref = 0; + ref = nullptr; _changed_connection.~connection(); //FIXME why? } @@ -70,13 +70,13 @@ SPTagUse::release() if (child) { detach(child); - child = NULL; + child = nullptr; } _changed_connection.disconnect(); g_free(href); - href = NULL; + href = nullptr; ref->detach(); @@ -93,7 +93,7 @@ SPTagUse::set(unsigned key, gchar const *value) /* No change, do nothing. */ } else { g_free(href); - href = NULL; + href = nullptr; if (value) { // First, set the href field, because sp_tag_use_href_changed will need it. href = g_strdup(value); @@ -152,7 +152,7 @@ SPItem * SPTagUse::root() orig = SP_TAG_USE(orig)->child; } if (!orig || !SP_IS_ITEM(orig)) - return NULL; + return nullptr; return SP_ITEM(orig); } @@ -169,7 +169,7 @@ SPTagUse::href_changed(SPObject */*old_ref*/, SPObject */*ref*/) if (child_) { child = child_; attach(child_, lastChild()); - sp_object_unref(child_, 0); + sp_object_unref(child_, nullptr); child_->invoke_build(this->document, childrepr, TRUE); } @@ -179,7 +179,7 @@ SPTagUse::href_changed(SPObject */*old_ref*/, SPObject */*ref*/) SPItem * SPTagUse::get_original() { - SPItem *ref_ = NULL; + SPItem *ref_ = nullptr; if (ref) { ref_ = ref->getObject(); } diff --git a/src/object/sp-tag.cpp b/src/object/sp-tag.cpp index d331e6b18..b06a02fd1 100644 --- a/src/object/sp-tag.cpp +++ b/src/object/sp-tag.cpp @@ -22,7 +22,7 @@ */ void SPTag::moveTo(SPObject *target, gboolean intoafter) { - Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL ); + Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : nullptr ); Inkscape::XML::Node *our_ref = getRepr(); gboolean first = FALSE; @@ -43,7 +43,7 @@ void SPTag::moveTo(SPObject *target, gboolean intoafter) { if (intoafter) { // Move this inside of the target at the end our_ref->parent()->removeChild(our_ref); - target_ref->addChild(our_ref, NULL); + target_ref->addChild(our_ref, nullptr); } else if (target_ref->parent() != our_ref->parent()) { // Change in parent, need to remove and add our_ref->parent()->removeChild(our_ref); @@ -122,7 +122,7 @@ SPTag::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flag if (_expanded) { repr->setAttribute("inkscape:expanded", "true"); } else { - repr->setAttribute("inkscape:expanded", NULL); + repr->setAttribute("inkscape:expanded", nullptr); } } SPObject::write(doc, repr, flags); diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp index 93694e844..bd0df6381 100644 --- a/src/object/sp-text.cpp +++ b/src/object/sp-text.cpp @@ -101,7 +101,7 @@ void SPText::set(unsigned int key, const gchar* value) { this->style->line_height.value = this->style->line_height.computed = sp_svg_read_percentage (value, 1.0); } // Remove deprecated attribute - this->getRepr()->setAttribute("sodipodi:linespacing", NULL); + this->getRepr()->setAttribute("sodipodi:linespacing", nullptr); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG); break; @@ -184,7 +184,7 @@ void SPText::update(SPCtx *ctx, guint flags) { Geom::OptRect paintbox = this->geometricBounds(); - for (SPItemView* v = this->display; v != NULL; v = v->next) { + for (SPItemView* v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); this->_clearFlow(g); g->setStyle(this->style, this->parent->style); @@ -210,7 +210,7 @@ void SPText::modified(guint flags) { if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) { Geom::OptRect paintbox = this->geometricBounds(); - for (SPItemView* v = this->display; v != NULL; v = v->next) { + for (SPItemView* v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); this->_clearFlow(g); g->setStyle(this->style, this->parent->style); @@ -246,12 +246,12 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X continue; } - Inkscape::XML::Node *crepr = NULL; + Inkscape::XML::Node *crepr = nullptr; if (SP_IS_STRING(&child)) { crepr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str()); } else { - crepr = child.updateRepr(xml_doc, NULL, flags); + crepr = child.updateRepr(xml_doc, nullptr, flags); } if (crepr) { @@ -260,7 +260,7 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X } for (auto i=l.rbegin();i!=l.rend();++i) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -310,7 +310,7 @@ Inkscape::DrawingItem* SPText::show(Inkscape::Drawing &drawing, unsigned /*key*/ void SPText::hide(unsigned int key) { - for (SPItemView* v = this->display; v != NULL; v = v->next) { + for (SPItemView* v = this->display; v != nullptr; v = v->next) { if (v->key == key) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); this->_clearFlow(g); @@ -353,7 +353,7 @@ void SPText::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape:: // of this point depending on the text alignment (left vs. right) Inkscape::Text::Layout const *layout = te_get_layout(this); - if (layout != NULL && layout->outputExists()) { + if (layout != nullptr && layout->outputExists()) { boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { @@ -440,7 +440,7 @@ unsigned SPText::_buildLayoutInput(SPObject *root, Inkscape::Text::Layout::Optio if (style->shape_inside.set ) { // Find union of all exclusion shapes - Shape *exclusion_shape = NULL; + Shape *exclusion_shape = nullptr; if(style->shape_subtract.set) { exclusion_shape = _buildExclusionShape(); } @@ -748,7 +748,7 @@ void SPText::rebuildLayout() for (auto& child: children) { if (SP_IS_TEXTPATH(&child)) { SPTextPath const *textpath = SP_TEXTPATH(&child); - if (textpath->originalPath != NULL) { + if (textpath->originalPath != nullptr) { #if DEBUG_TEXTLAYOUT_DUMPASTEXT g_print("%s", layout.dumpAsText().c_str()); #endif @@ -874,7 +874,7 @@ bool TextTagAttributes::readSingleAttribute(unsigned key, gchar const *value, SP // FIXME: sp_svg_length_list_read() amalgamates repeated separators. This prevents unset values. *attr_vector = sp_svg_length_list_read(value); - if( (update_x || update_y) && style != NULL && viewport != NULL ) { + if( (update_x || update_y) && style != nullptr && viewport != nullptr ) { double const w = viewport->width(); double const h = viewport->height(); double const em = style->font_size.computed; @@ -929,13 +929,13 @@ void TextTagAttributes::writeSingleAttributeLength(Inkscape::XML::Node *node, gc if (length._set) { node->setAttribute(key, length.write().c_str()); } else - node->setAttribute(key, NULL); + node->setAttribute(key, nullptr); } void TextTagAttributes::writeSingleAttributeVector(Inkscape::XML::Node *node, gchar const *key, std::vector<SVGLength> const &attr_vector) { if (attr_vector.empty()) - node->setAttribute(key, NULL); + node->setAttribute(key, nullptr); else { Glib::ustring string; @@ -983,11 +983,11 @@ void TextTagAttributes::setFirstXY(Geom::Point &point) void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs *output, Inkscape::Text::Layout::OptionalTextTagAttrs const &parent_attrs, unsigned parent_attrs_offset, bool copy_xy, bool copy_dxdyrotate) const { - mergeSingleAttribute(&output->x, parent_attrs.x, parent_attrs_offset, copy_xy ? &attributes.x : NULL); - mergeSingleAttribute(&output->y, parent_attrs.y, parent_attrs_offset, copy_xy ? &attributes.y : NULL); - mergeSingleAttribute(&output->dx, parent_attrs.dx, parent_attrs_offset, copy_dxdyrotate ? &attributes.dx : NULL); - mergeSingleAttribute(&output->dy, parent_attrs.dy, parent_attrs_offset, copy_dxdyrotate ? &attributes.dy : NULL); - mergeSingleAttribute(&output->rotate, parent_attrs.rotate, parent_attrs_offset, copy_dxdyrotate ? &attributes.rotate : NULL); + mergeSingleAttribute(&output->x, parent_attrs.x, parent_attrs_offset, copy_xy ? &attributes.x : nullptr); + mergeSingleAttribute(&output->y, parent_attrs.y, parent_attrs_offset, copy_xy ? &attributes.y : nullptr); + mergeSingleAttribute(&output->dx, parent_attrs.dx, parent_attrs_offset, copy_dxdyrotate ? &attributes.dx : nullptr); + mergeSingleAttribute(&output->dy, parent_attrs.dy, parent_attrs_offset, copy_dxdyrotate ? &attributes.dy : nullptr); + mergeSingleAttribute(&output->rotate, parent_attrs.rotate, parent_attrs_offset, copy_dxdyrotate ? &attributes.rotate : nullptr); if (attributes.textLength._set) { // only from current node, this is not inherited from parent output->textLength.value = attributes.textLength.value; output->textLength.computed = attributes.textLength.computed; @@ -1000,7 +1000,7 @@ void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs * void TextTagAttributes::mergeSingleAttribute(std::vector<SVGLength> *output_list, std::vector<SVGLength> const &parent_list, unsigned parent_offset, std::vector<SVGLength> const *overlay_list) { output_list->clear(); - if (overlay_list == NULL) { + if (overlay_list == nullptr) { if (parent_list.size() > parent_offset) { output_list->reserve(parent_list.size() - parent_offset); diff --git a/src/object/sp-tref-reference.h b/src/object/sp-tref-reference.h index 0cad4e912..bff49e3d5 100644 --- a/src/object/sp-tref-reference.h +++ b/src/object/sp-tref-reference.h @@ -27,7 +27,7 @@ typedef unsigned int GQuark; class SPTRefReference : public Inkscape::URIReference, public Inkscape::XML::NodeObserver { public: - SPTRefReference(SPObject *owner) : URIReference(owner), subtreeObserved(NULL) { + SPTRefReference(SPObject *owner) : URIReference(owner), subtreeObserved(nullptr) { updateObserver(); } diff --git a/src/object/sp-tref.cpp b/src/object/sp-tref.cpp index eae852a89..ef81a1128 100644 --- a/src/object/sp-tref.cpp +++ b/src/object/sp-tref.cpp @@ -47,9 +47,9 @@ static void sp_tref_href_changed(SPObject *old_ref, SPObject *ref, SPTRef *tref) static void sp_tref_delete_self(SPObject *deleted, SPTRef *self); SPTRef::SPTRef() : SPItem() { - this->stringChild = NULL; + this->stringChild = nullptr; - this->href = NULL; + this->href = nullptr; this->uriOriginalRef = new SPTRefReference(this); this->_changed_connection = @@ -78,7 +78,7 @@ void SPTRef::release() { this->_changed_connection.disconnect(); g_free(this->href); - this->href = NULL; + this->href = nullptr; this->uriOriginalRef->detach(); @@ -95,14 +95,14 @@ void SPTRef::set(unsigned int key, const gchar* value) { if ( !value ) { // No value g_free(this->href); - this->href = NULL; + this->href = nullptr; this->uriOriginalRef->detach(); } else if ((this->href && strcmp(value, this->href) != 0) || (!this->href)) { // Value has changed if ( this->href ) { g_free(this->href); - this->href = NULL; + this->href = nullptr; } this->href = g_strdup(value); @@ -193,13 +193,13 @@ Geom::OptRect SPTRef::bbox(Geom::Affine const &transform, SPItem::BBoxType type) parent_text = parent_text->parent; } - if (parent_text == NULL) { + if (parent_text == nullptr) { return bbox; } // get the bbox of our portion of the layout bbox = SP_TEXT(parent_text)->layout.bounds(transform, - sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, NULL) - 1); + sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, nullptr) - 1); // Add stroke width // FIXME this code is incorrect @@ -251,7 +251,7 @@ sp_tref_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPTRef *tref) if (tref->stringChild) { tref->detach(tref->stringChild); - tref->stringChild = NULL; + tref->stringChild = nullptr; } // Ensure that we are referring to a legitimate object @@ -282,7 +282,7 @@ sp_tref_delete_self(SPObject */*deleted*/, SPTRef *self) */ SPObject * SPTRef::getObjectReferredTo(void) { - SPObject *referredObject = NULL; + SPObject *referredObject = nullptr; if (uriOriginalRef) { referredObject = uriOriginalRef->getObject(); @@ -295,7 +295,7 @@ SPObject * SPTRef::getObjectReferredTo(void) * Return the object referred to via the URI reference */ SPObject const *SPTRef::getObjectReferredTo() const { - SPObject *referredObject = NULL; + SPObject *referredObject = nullptr; if (uriOriginalRef) { referredObject = uriOriginalRef->getObject(); @@ -391,7 +391,7 @@ void sp_tref_update_text(SPTRef *tref) if (tref->stringChild) { tref->detach(tref->stringChild); - tref->stringChild = NULL; + tref->stringChild = nullptr; } // Create the node and SPString to be the tref's child @@ -402,7 +402,7 @@ void sp_tref_update_text(SPTRef *tref) // Add this SPString as a child of the tref tref->attach(tref->stringChild, tref->lastChild()); - sp_object_unref(tref->stringChild, NULL); + sp_object_unref(tref->stringChild, nullptr); (tref->stringChild)->invoke_build(tref->document, newStringRepr, TRUE); Inkscape::GC::release(newStringRepr); @@ -446,7 +446,7 @@ build_string_from_root(Inkscape::XML::Node *root, Glib::ustring *retString) SPObject * sp_tref_convert_to_tspan(SPObject *obj) { - SPObject * new_tspan = NULL; + SPObject * new_tspan = nullptr; //////////////////// // BASE CASE @@ -472,7 +472,7 @@ sp_tref_convert_to_tspan(SPObject *obj) // Create a new string child for the tspan Inkscape::XML::Node *new_string_repr = tref->stringChild->getRepr()->duplicate(xml_doc); - new_tspan_repr->addChild(new_string_repr, NULL); + new_tspan_repr->addChild(new_string_repr, nullptr); //SPObject * new_string_child = document->getObjectByRepr(new_string_repr); diff --git a/src/object/sp-tspan.cpp b/src/object/sp-tspan.cpp index 175e5da3f..4df068c98 100644 --- a/src/object/sp-tspan.cpp +++ b/src/object/sp-tspan.cpp @@ -148,12 +148,12 @@ Geom::OptRect SPTSpan::bbox(Geom::Affine const &transform, SPItem::BBoxType type parent_text = parent_text->parent; } - if (parent_text == NULL) { + if (parent_text == nullptr) { return bbox; } // get the bbox of our portion of the layout - bbox = SP_TEXT(parent_text)->layout.bounds(transform, sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, NULL) - 1); + bbox = SP_TEXT(parent_text)->layout.bounds(transform, sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, nullptr) - 1); if (!bbox) { return bbox; @@ -180,10 +180,10 @@ Inkscape::XML::Node* SPTSpan::write(Inkscape::XML::Document *xml_doc, Inkscape:: std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node* c_repr=NULL; + Inkscape::XML::Node* c_repr=nullptr; if ( SP_IS_TSPAN(&child) || SP_IS_TREF(&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_TEXTPATH(&child) ) { //c_repr = child.updateRepr(xml_doc, NULL, flags); // shouldn't happen } else if ( SP_IS_STRING(&child) ) { @@ -196,7 +196,7 @@ Inkscape::XML::Node* SPTSpan::write(Inkscape::XML::Document *xml_doc, Inkscape:: } for (auto i = l.rbegin(); i!= l.rend(); ++i) { - repr->addChild((*i), NULL); + repr->addChild((*i), nullptr); Inkscape::GC::release(*i); } } else { @@ -229,7 +229,7 @@ void refresh_textpath_source(SPTextPath* offset); SPTextPath::SPTextPath() : SPItem() { this->startOffset._set = false; this->side = SP_TEXT_PATH_SIDE_LEFT; - this->originalPath = NULL; + this->originalPath = nullptr; this->isUpdating=false; // set up the uri reference @@ -253,7 +253,7 @@ void SPTextPath::build(SPDocument *doc, Inkscape::XML::Node *repr) { bool no_content = true; - for (Inkscape::XML::Node* rch = repr->firstChild() ; rch != NULL; rch = rch->next()) { + for (Inkscape::XML::Node* rch = repr->firstChild() ; rch != nullptr; rch = rch->next()) { if ( rch->type() == Inkscape::XML::TEXT_NODE ) { no_content = false; @@ -264,7 +264,7 @@ void SPTextPath::build(SPDocument *doc, Inkscape::XML::Node *repr) { if ( no_content ) { Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node* rch = xml_doc->createTextNode(""); - repr->addChild(rch, NULL); + repr->addChild(rch, nullptr); } SPItem::build(doc, repr); @@ -277,7 +277,7 @@ void SPTextPath::release() { delete this->originalPath; } - this->originalPath = NULL; + this->originalPath = nullptr; SPItem::release(); } @@ -357,7 +357,7 @@ void SPTextPath::update(SPCtx *ctx, guint flags) { void refresh_textpath_source(SPTextPath* tp) { - if ( tp == NULL ) { + if ( tp == nullptr ) { return; } @@ -432,10 +432,10 @@ Inkscape::XML::Node* SPTextPath::write(Inkscape::XML::Document *xml_doc, Inkscap std::vector<Inkscape::XML::Node *> l; for (auto& child: children) { - Inkscape::XML::Node* c_repr=NULL; + Inkscape::XML::Node* c_repr=nullptr; if ( SP_IS_TSPAN(&child) || SP_IS_TREF(&child) ) { - c_repr = child.updateRepr(xml_doc, NULL, flags); + c_repr = child.updateRepr(xml_doc, nullptr, flags); } else if ( SP_IS_TEXTPATH(&child) ) { //c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen } else if ( SP_IS_STRING(&child) ) { @@ -448,7 +448,7 @@ Inkscape::XML::Node* SPTextPath::write(Inkscape::XML::Document *xml_doc, Inkscap } for( auto i = l.rbegin(); i != l.rend(); ++i ) { - repr->addChild(*i, NULL); + repr->addChild(*i, nullptr); Inkscape::GC::release(*i); } } else { @@ -478,7 +478,7 @@ SPItem *sp_textpath_get_path_item(SPTextPath *tp) return refobj; } } - return NULL; + return nullptr; } void sp_textpath_to_text(SPObject *tp) @@ -507,7 +507,7 @@ void sp_textpath_to_text(SPObject *tp) // remove the old repr from under textpath tp->getRepr()->removeChild(*i); // put its copy under text - text->getRepr()->addChild(copy, NULL); // fixme: copy id + text->getRepr()->addChild(copy, nullptr); // fixme: copy id } //remove textpath diff --git a/src/object/sp-use-reference.cpp b/src/object/sp-use-reference.cpp index d35bdf579..d5fdfc01a 100644 --- a/src/object/sp-use-reference.cpp +++ b/src/object/sp-use-reference.cpp @@ -38,12 +38,12 @@ SPUsePath::SPUsePath(SPObject* i_owner):SPUseReference(i_owner) owner=i_owner; originalPath = nullptr; sourceDirty=false; - sourceHref = NULL; - sourceRepr = NULL; - sourceObject = NULL; + sourceHref = nullptr; + sourceRepr = nullptr; + sourceObject = nullptr; _changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_usepath_href_changed), this)); // listening to myself, this should be virtual instead - user_unlink = NULL; + user_unlink = nullptr; } SPUsePath::~SPUsePath(void) @@ -61,7 +61,7 @@ SPUsePath::~SPUsePath(void) void SPUsePath::link(char *to) { - if ( to == NULL ) { + if ( to == nullptr ) { quit_listening(); unlink(); } else { @@ -85,14 +85,14 @@ void SPUsePath::unlink(void) { g_free(sourceHref); - sourceHref = NULL; + sourceHref = nullptr; detach(); } void SPUsePath::start_listening(SPObject* to) { - if ( to == NULL ) { + if ( to == nullptr ) { return; } sourceObject = to; @@ -105,14 +105,14 @@ SPUsePath::start_listening(SPObject* to) void SPUsePath::quit_listening(void) { - if ( sourceObject == NULL ) { + if ( sourceObject == nullptr ) { return; } _modified_connection.disconnect(); _delete_connection.disconnect(); _transformed_connection.disconnect(); - sourceRepr = NULL; - sourceObject = NULL; + sourceRepr = nullptr; + sourceObject = nullptr; } static void @@ -203,7 +203,7 @@ void SPUsePath::refresh_source() } SPObject *refobj = sourceObject; - if ( refobj == NULL ) return; + if ( refobj == nullptr ) return; SPItem *item = SP_ITEM(refobj); diff --git a/src/object/sp-use.cpp b/src/object/sp-use.cpp index af61e392b..6ee4be4b2 100644 --- a/src/object/sp-use.cpp +++ b/src/object/sp-use.cpp @@ -46,8 +46,8 @@ SPUse::SPUse() : SPItem(), SPDimensions(), - child(NULL), - href(NULL), + child(nullptr), + href(nullptr), ref(new SPUseReference(this)), _delete_connection(), _changed_connection(), @@ -66,12 +66,12 @@ SPUse::SPUse() SPUse::~SPUse() { if (this->child) { this->detach(this->child); - this->child = NULL; + this->child = nullptr; } this->ref->detach(); delete this->ref; - this->ref = 0; + this->ref = nullptr; } void SPUse::build(SPDocument *document, Inkscape::XML::Node *repr) { @@ -91,7 +91,7 @@ void SPUse::build(SPDocument *document, Inkscape::XML::Node *repr) { void SPUse::release() { if (this->child) { this->detach(this->child); - this->child = NULL; + this->child = nullptr; } this->_delete_connection.disconnect(); @@ -99,7 +99,7 @@ void SPUse::release() { this->_transformed_connection.disconnect(); g_free(this->href); - this->href = NULL; + this->href = nullptr; this->ref->detach(); @@ -133,7 +133,7 @@ void SPUse::set(unsigned int key, const gchar* value) { /* No change, do nothing. */ } else { g_free(this->href); - this->href = NULL; + this->href = nullptr; if (value) { // First, set the href field, because SPUse::href_changed will need it. @@ -241,9 +241,9 @@ gchar* SPUse::description() const { if (child) { if ( dynamic_cast<SPSymbol *>(child) ) { if (child->title()) { - return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", child->title()))).c_str()); + return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "Symbol", child->title()))).c_str()); } else if (child->getAttribute("id")) { - return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", child->getAttribute("id")))).c_str()); + return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "Symbol", child->getAttribute("id")))).c_str()); } else { return g_strdup_printf(_("called %s"), _("Unnamed Symbol")); } @@ -506,7 +506,7 @@ void SPUse::href_changed() { if (this->child) { this->detach(this->child); - this->child = NULL; + this->child = nullptr; } if (this->href) { @@ -526,7 +526,7 @@ void SPUse::href_changed() { this->child->invoke_build(this->document, childrepr, TRUE); - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingItem *ai = this->child->invoke_show(v->arenaitem->drawing(), v->key, v->flags); if (ai) { @@ -595,7 +595,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { if (childflags || (this->child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { SPItem const *chi = dynamic_cast<SPItem const *>(child); - g_assert(chi != NULL); + g_assert(chi != nullptr); cctx.i2doc = chi->transform * ictx->i2doc; cctx.i2vp = chi->transform * ictx->i2vp; this->child->updateDisplay((SPCtx *)&cctx, childflags); @@ -607,7 +607,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { SPItem::update(ctx, flags); if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); this->context_style = this->style; g->setStyle(this->style, this->context_style); @@ -615,7 +615,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { } /* As last step set additional transform of arena group */ - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); Geom::Affine t(Geom::Translate(this->x.computed, this->y.computed)); g->setChildTransform(t); @@ -631,7 +631,7 @@ void SPUse::modified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { + for (SPItemView *v = this->display; v != nullptr; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); this->context_style = this->style; g->setStyle(this->style, this->context_style); @@ -653,7 +653,7 @@ SPItem *SPUse::unlink() { Inkscape::XML::Node *repr = this->getRepr(); if (!repr) { - return NULL; + return nullptr; } Inkscape::XML::Node *parent = repr->parent(); @@ -664,18 +664,18 @@ SPItem *SPUse::unlink() { SPItem *orig = this->root(); if (!orig) { - return NULL; + return nullptr; } // Calculate the accumulated transform, starting from the original. Geom::Affine t = this->get_root_transform(); - Inkscape::XML::Node *copy = NULL; + Inkscape::XML::Node *copy = nullptr; if (dynamic_cast<SPSymbol *>(orig)) { // make a group, copy children copy = xml_doc->createElement("svg:g"); - for (Inkscape::XML::Node *child = orig->getRepr()->firstChild() ; child != NULL; child = child->next()) { + for (Inkscape::XML::Node *child = orig->getRepr()->firstChild() ; child != nullptr; child = child->next()) { Inkscape::XML::Node *newchild = child->duplicate(xml_doc); copy->appendChild(newchild); } @@ -706,17 +706,17 @@ SPItem *SPUse::unlink() { Inkscape::GC::release(repr); // Remove tiled clone attrs. - copy->setAttribute("inkscape:tiled-clone-of", NULL); - copy->setAttribute("inkscape:tile-w", NULL); - copy->setAttribute("inkscape:tile-h", NULL); - copy->setAttribute("inkscape:tile-cx", NULL); - copy->setAttribute("inkscape:tile-cy", NULL); + copy->setAttribute("inkscape:tiled-clone-of", nullptr); + copy->setAttribute("inkscape:tile-w", nullptr); + copy->setAttribute("inkscape:tile-h", nullptr); + copy->setAttribute("inkscape:tile-cx", nullptr); + copy->setAttribute("inkscape:tile-cy", nullptr); // Establish the succession and let go of our object. this->setSuccessor(unlinked); SPItem *item = dynamic_cast<SPItem *>(unlinked); - g_assert(item != NULL); + g_assert(item != nullptr); // Set the accummulated transform. { @@ -729,7 +729,7 @@ SPItem *SPUse::unlink() { } SPItem *SPUse::get_original() { - SPItem *ref = NULL; + SPItem *ref = nullptr; if (this->ref){ ref = this->ref->getObject(); diff --git a/src/object/uri-references.cpp b/src/object/uri-references.cpp index 43dc996df..b4af31278 100644 --- a/src/object/uri-references.cpp +++ b/src/object/uri-references.cpp @@ -29,21 +29,21 @@ namespace Inkscape { URIReference::URIReference(SPObject *owner) : _owner(owner) - , _owner_document(NULL) - , _obj(NULL) - , _uri(NULL) + , _owner_document(nullptr) + , _obj(nullptr) + , _uri(nullptr) { - g_assert(_owner != NULL); + g_assert(_owner != nullptr); /* FIXME !!! attach to owner's destroy signal to clean up in case */ } URIReference::URIReference(SPDocument *owner_document) - : _owner(NULL) + : _owner(nullptr) , _owner_document(owner_document) - , _obj(NULL) - , _uri(NULL) + , _obj(nullptr) + , _uri(nullptr) { - g_assert(_owner_document != NULL); + g_assert(_owner_document != nullptr); } URIReference::~URIReference() { detach(); } @@ -109,7 +109,7 @@ bool URIReference::_acceptObject(SPObject *obj) const void URIReference::attach(const URI &uri) { - SPDocument *document = NULL; + SPDocument *document = nullptr; // Attempt to get the document that contains the URI if (_owner) { @@ -134,7 +134,7 @@ void URIReference::attach(const URI &uri) if (!path.empty()) { document = document->createChildDoc(path); } else { - document = NULL; + document = nullptr; } } if (!document) { @@ -153,7 +153,7 @@ void URIReference::attach(const URI &uri) /* for now this handles the minimal xpointer form that SVG 1.0 * requires of us */ - gchar *id = NULL; + gchar *id = nullptr; if (!strncmp(fragment, "xpointer(", 9)) { /* FIXME !!! this is wasteful */ /* FIXME: It looks as though this is including "))" in the id. I suggest moving @@ -189,14 +189,14 @@ void URIReference::detach() { _connection.disconnect(); delete _uri; - _uri = NULL; - _setObject(NULL); + _uri = nullptr; + _setObject(nullptr); } void URIReference::_setObject(SPObject *obj) { if (obj && !_acceptObject(obj)) { - obj = NULL; + obj = nullptr; } if (obj == _obj) @@ -224,7 +224,7 @@ void URIReference::_setObject(SPObject *obj) void URIReference::_release(SPObject *obj) { g_assert(_obj == obj); - _setObject(NULL); + _setObject(nullptr); } } /* namespace Inkscape */ @@ -233,7 +233,7 @@ void URIReference::_release(SPObject *obj) SPObject *sp_css_uri_reference_resolve(SPDocument *document, const gchar *uri) { - SPObject *ref = NULL; + SPObject *ref = nullptr; if (document && uri && (strncmp(uri, "url(", 4) == 0)) { gchar *trimmed = extract_uri(uri); @@ -248,7 +248,7 @@ SPObject *sp_css_uri_reference_resolve(SPDocument *document, const gchar *uri) SPObject *sp_uri_reference_resolve(SPDocument *document, const gchar *uri) { - SPObject *ref = NULL; + SPObject *ref = nullptr; if (uri && (*uri == '#')) { ref = document->getObjectById(uri + 1); diff --git a/src/object/uri.cpp b/src/object/uri.cpp index 881b322b4..91878512a 100644 --- a/src/object/uri.cpp +++ b/src/object/uri.cpp @@ -61,7 +61,7 @@ URI::Impl::Impl(xmlURIPtr uri) URI::Impl::~Impl() { if (_uri) { xmlFreeURI(_uri); - _uri = NULL; + _uri = nullptr; } } @@ -76,7 +76,7 @@ void URI::Impl::unreference() { } bool URI::Impl::isOpaque() const { - bool opq = !isRelative() && (getOpaque() != NULL); + bool opq = !isRelative() && (getOpaque() != nullptr); return opq; } @@ -136,7 +136,7 @@ const gchar *URI::Impl::getOpaque() const { gchar *URI::to_native_filename(gchar const* uri) { - gchar *filename = NULL; + gchar *filename = nullptr; URI tmp(uri); filename = tmp.toNativeFilename(); return filename; @@ -173,7 +173,7 @@ gchar *URI::toNativeFilename() const { if (isRelativePath()) { return uriString; } else { - gchar *filename = g_filename_from_uri(uriString, NULL, NULL); + gchar *filename = g_filename_from_uri(uriString, nullptr, nullptr); g_free(uriString); if (filename) { return filename; @@ -216,7 +216,7 @@ URI URI::fromUtf8( gchar const* path ) { /* TODO !!! proper error handling */ URI URI::from_native_filename(gchar const *path) { - gchar *uri = g_filename_to_uri(path, NULL, NULL); + gchar *uri = g_filename_to_uri(path, nullptr, nullptr); URI result(uri); g_free( uri ); return result; @@ -230,7 +230,7 @@ gchar *URI::Impl::toString() const { xmlFree(string); return glib_string; } else { - return NULL; + return nullptr; } } diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index ac212388b..a785bf949 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -97,14 +97,14 @@ ObjectSet::combine(bool skip_undo) // remember the position, id, transform and style of the topmost path, they will be assigned to the combined one gint position = 0; - char const *id = NULL; - char const *transform = NULL; - char const *style = NULL; - char const *path_effect = NULL; + char const *id = nullptr; + char const *transform = nullptr; + char const *style = nullptr; + char const *path_effect = nullptr; - SPCurve* curve = NULL; - SPItem *first = NULL; - Inkscape::XML::Node *parent = NULL; + SPCurve* curve = nullptr; + SPItem *first = nullptr; + Inkscape::XML::Node *parent = nullptr; if (did) { clear(); @@ -124,7 +124,7 @@ ObjectSet::combine(bool skip_undo) } SPCurve *c = path->getCurveForEdit(); - if (first == NULL) { // this is the topmost path + if (first == nullptr) { // this is the topmost path first = item; parent = first->getRepr()->parent(); position = first->getRepr()->position(); @@ -226,7 +226,7 @@ ObjectSet::breakApart(bool skip_undo) } SPCurve *curve = path->getCurveForEdit(); - if (curve == NULL) { + if (curve == nullptr) { continue; } did = true; @@ -369,7 +369,7 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>& bool did = false; for (std::vector<SPItem*>::const_iterator i = items.begin(); i != items.end(); ++i){ SPItem *item = *i; - g_assert(item != NULL); + g_assert(item != nullptr); SPDocument *document = item->document; SPGroup *group = dynamic_cast<SPGroup *>(item); @@ -400,7 +400,7 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>& if (lpeitem) { selected.erase(remove(selected.begin(), selected.end(), item), selected.end()); lpeitem->removeAllPathEffects(true); - SPObject *elemref = NULL; + SPObject *elemref = nullptr; if (elemref = document->getObjectById(id)) { //If the LPE item is a shape is converted to a path so we need to reupdate the item @@ -412,7 +412,7 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>& SPPath *path = dynamic_cast<SPPath *>(item); if (path) { // remove connector attributes - if (item->getAttribute("inkscape:connector-type") != NULL) { + if (item->getAttribute("inkscape:connector-type") != nullptr) { item->removeAttribute("inkscape:connection-start"); item->removeAttribute("inkscape:connection-end"); item->removeAttribute("inkscape:connector-type"); @@ -495,7 +495,7 @@ Inkscape::XML::Node * sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) { if (!item) - return NULL; + return nullptr; Inkscape::XML::Document *xml_doc = item->getRepr()->document(); @@ -526,7 +526,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) /* Whole text's style */ Glib::ustring style_str = - item->style->write( SP_STYLE_FLAG_IFDIFF, SP_STYLE_SRC_UNSET, item->parent ? item->parent->style : NULL); // TODO investigate possibility + item->style->write( SP_STYLE_FLAG_IFDIFF, SP_STYLE_SRC_UNSET, item->parent ? item->parent->style : nullptr); // TODO investigate possibility g_repr->setAttribute("style", style_str.c_str()); Inkscape::Text::Layout::iterator iter = te_get_layout(item)->begin(); @@ -537,8 +537,8 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) break; /* This glyph's style */ - SPObject const *pos_obj = 0; - void *rawptr = 0; + SPObject const *pos_obj = nullptr; + void *rawptr = nullptr; te_get_layout(item)->getSourceOfCharacter(iter, &rawptr); if (!rawptr || !SP_IS_OBJECT(rawptr)) // no source for glyph, abort break; @@ -547,7 +547,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) pos_obj = pos_obj->parent; // SPStrings don't have style } Glib::ustring style_str = - pos_obj->style->write( SP_STYLE_FLAG_IFDIFF, SP_STYLE_SRC_UNSET, pos_obj->parent ? pos_obj->parent->style : NULL); // TODO investigate possibility + pos_obj->style->write( SP_STYLE_FLAG_IFDIFF, SP_STYLE_SRC_UNSET, pos_obj->parent ? pos_obj->parent->style : nullptr); // TODO investigate possibility // get path from iter to iter_next: SPCurve *curve = te_get_layout(item)->convertToCurves(iter, iter_next); @@ -580,7 +580,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) return g_repr; } - SPCurve *curve = NULL; + SPCurve *curve = nullptr; { SPShape *shape = dynamic_cast<SPShape *>(item); if (shape) { @@ -589,14 +589,14 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) } if (!curve) - return NULL; + return nullptr; // Prevent empty paths from being added to the document // otherwise we end up with zomby markup in the SVG file if(curve->is_empty()) { curve->unref(); - return NULL; + return nullptr; } Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); @@ -605,7 +605,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) /* Style */ Glib::ustring style_str = - item->style->write( SP_STYLE_FLAG_IFDIFF, SP_STYLE_SRC_UNSET, item->parent ? item->parent->style : NULL); // TODO investigate possibility + item->style->write( SP_STYLE_FLAG_IFDIFF, SP_STYLE_SRC_UNSET, item->parent ? item->parent->style : nullptr); // TODO investigate possibility repr->setAttribute("style", style_str.c_str()); /* Mask */ diff --git a/src/perspective-line.cpp b/src/perspective-line.cpp index cf40e4c60..50770d857 100644 --- a/src/perspective-line.cpp +++ b/src/perspective-line.cpp @@ -16,7 +16,7 @@ namespace Box3D { PerspectiveLine::PerspectiveLine (Geom::Point const &pt, Proj::Axis const axis, Persp3D *persp) : Line (pt, persp3d_get_VP(persp, axis).affine(), true) { - g_assert (persp != NULL); + g_assert (persp != nullptr); if (!persp3d_get_VP(persp, axis).is_finite()) { Proj::Pt2 vp(persp3d_get_VP(persp, axis)); diff --git a/src/preferences.cpp b/src/preferences.cpp index 69601f9a9..6725c1314 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -36,7 +36,7 @@ namespace Inkscape { static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib::ustring & errMsg ); static void migrateDetails( Inkscape::XML::Document *from, Inkscape::XML::Document *to ); -static Inkscape::XML::Document *migrateFromDoc = 0; +static Inkscape::XML::Document *migrateFromDoc = nullptr; // TODO clean up. Function copied from file.cpp: // what gets passed here is not actually an URI... it is an UTF-8 encoded filename (!) @@ -46,10 +46,10 @@ static void file_add_recent(gchar const *uri) g_warning("file_add_recent: uri == NULL"); } else { GtkRecentManager *recent = gtk_recent_manager_get_default(); - gchar *fn = g_filename_from_utf8(uri, -1, NULL, NULL, NULL); + gchar *fn = g_filename_from_utf8(uri, -1, nullptr, nullptr, nullptr); if (fn) { if (g_file_test(fn, G_FILE_TEST_EXISTS)) { - gchar *uriToAdd = g_filename_to_uri(fn, NULL, NULL); + gchar *uriToAdd = g_filename_to_uri(fn, nullptr, nullptr); if (uriToAdd) { gtk_recent_manager_add_item(recent, uriToAdd); g_free(uriToAdd); @@ -84,8 +84,8 @@ private: Preferences::Preferences() : _prefs_filename(""), - _prefs_doc(0), - _errorHandler(0), + _prefs_doc(nullptr), + _errorHandler(nullptr), _writable(false), _hasError(false) { @@ -115,7 +115,7 @@ Preferences::~Preferences() */ void Preferences::_loadDefaults() { - _prefs_doc = sp_repr_read_mem(preferences_skeleton, PREFERENCES_SKELETON_SIZE, NULL); + _prefs_doc = sp_repr_read_mem(preferences_skeleton, PREFERENCES_SKELETON_SIZE, nullptr); } /** @@ -132,7 +132,7 @@ void Preferences::_load() // 1. Does the file exist? if (!g_file_test(_prefs_filename.c_str(), G_FILE_TEST_EXISTS)) { - char *_prefs_dir = Inkscape::IO::Resource::profile_path(NULL); + char *_prefs_dir = Inkscape::IO::Resource::profile_path(nullptr); // No - we need to create one. // Does the profile directory exist? if (!g_file_test(_prefs_dir, G_FILE_TEST_EXISTS)) { @@ -147,7 +147,7 @@ void Preferences::_load() return; } // create some subdirectories for user stuff - char const *user_dirs[] = {"extensions", "fonts", "icons", "keys", "palettes", "templates", NULL}; + char const *user_dirs[] = {"extensions", "fonts", "icons", "keys", "palettes", "templates", nullptr}; for (int i=0; user_dirs[i]; ++i) { // XXX Why are we doing this here? shouldn't this be an IO load item? char *dir = Inkscape::IO::Resource::profile_path(user_dirs[i]); @@ -165,7 +165,7 @@ void Preferences::_load() return; } // The profile dir exists and is valid. - if (!g_file_set_contents(_prefs_filename.c_str(), preferences_skeleton, PREFERENCES_SKELETON_SIZE, NULL)) { + if (!g_file_set_contents(_prefs_filename.c_str(), preferences_skeleton, PREFERENCES_SKELETON_SIZE, nullptr)) { // The write failed. //_reportError(Glib::ustring::compose(_("Failed to create the preferences file %1."), // Glib::filename_to_utf8(_prefs_filename)), not_saved); @@ -209,28 +209,28 @@ static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib Glib::filename_to_utf8(prefsFilename).c_str()); errMsg = msg; g_free(msg); - return 0; + return nullptr; } // 3. Is the file readable? - gchar *prefs_xml = NULL; gsize len = 0; - if (!g_file_get_contents(prefsFilename.c_str(), &prefs_xml, &len, NULL)) { + gchar *prefs_xml = nullptr; gsize len = 0; + if (!g_file_get_contents(prefsFilename.c_str(), &prefs_xml, &len, nullptr)) { gchar *msg = g_strdup_printf(_("The preferences file %s could not be read."), Glib::filename_to_utf8(prefsFilename).c_str()); errMsg = msg; g_free(msg); - return 0; + return nullptr; } // 4. Is it valid XML? - Inkscape::XML::Document *prefs_read = sp_repr_read_mem(prefs_xml, len, NULL); + Inkscape::XML::Document *prefs_read = sp_repr_read_mem(prefs_xml, len, nullptr); g_free(prefs_xml); if (!prefs_read) { gchar *msg = g_strdup_printf(_("The preferences file %s is not a valid XML document."), Glib::filename_to_utf8(prefsFilename).c_str()); errMsg = msg; g_free(msg); - return 0; + return nullptr; } // 5. Basic sanity check: does the root element have a correct name? @@ -240,7 +240,7 @@ static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib errMsg = msg; g_free(msg); Inkscape::GC::release(prefs_read); - return 0; + return nullptr; } return prefs_read; @@ -319,8 +319,8 @@ void Preferences::migrate( std::string const& legacyDir, std::string const& pref Glib::ustring docId("documents"); Glib::ustring recentId("recent"); Inkscape::XML::Node *node = oldPrefs->root(); - Inkscape::XML::Node *child = 0; - Inkscape::XML::Node *recentNode = 0; + Inkscape::XML::Node *child = nullptr; + Inkscape::XML::Node *recentNode = nullptr; if (node->attribute("version")) { node->setAttribute("version", "1"); } @@ -349,13 +349,13 @@ void Preferences::migrate( std::string const& legacyDir, std::string const& pref } migrateFromDoc = oldPrefs; //Inkscape::GC::release(oldPrefs); - oldPrefs = 0; + oldPrefs = nullptr; } else { g_warning( "%s", errMsg.c_str() ); } } g_free(oldPrefFile); - oldPrefFile = 0; + oldPrefFile = nullptr; } } @@ -393,7 +393,7 @@ std::vector<Glib::ustring> Preferences::getAllDirs(Glib::ustring const &path) Inkscape::XML::Node *node = _getNode(path, false); if (node) { for (Inkscape::XML::NodeSiblingIterator i = node->firstChild(); i; ++i) { - if (i->attribute("id") == NULL) { + if (i->attribute("id") == nullptr) { continue; } temp.push_back(path + '/' + i->attribute("id")); @@ -510,11 +510,11 @@ void Preferences::remove(Glib::ustring const &pref_path) } else { //Handle to remove also attributes in path not only the container node // verify path g_assert( pref_path.at(0) == '/' ); - if (_prefs_doc == NULL){ + if (_prefs_doc == nullptr){ return; } node = _prefs_doc->root(); - Inkscape::XML::Node *child = NULL; + Inkscape::XML::Node *child = nullptr; gchar **splits = g_strsplit(pref_path.c_str(), "/", 0); if ( splits ) { for (int part_i = 0; splits[part_i]; ++part_i) { @@ -523,7 +523,7 @@ void Preferences::remove(Glib::ustring const &pref_path) continue; } if (!node->firstChild()) { - node->setAttribute(splits[part_i], NULL); + node->setAttribute(splits[part_i], nullptr); g_strfreev(splits); return; } @@ -553,7 +553,7 @@ public: Preferences::Observer::Observer(Glib::ustring const &path) : observed_path(path), - _data(0) + _data(nullptr) { } @@ -656,7 +656,7 @@ void Preferences::removeObserver(Observer &o) if ( _observer_map.find(&o) != _observer_map.end() ) { Inkscape::XML::Node *node = o._data->_node; _ObserverData *priv_data = o._data; - o._data = 0; + o._data = nullptr; if (priv_data->_is_attr) { node->removeObserver( *(_observer_map[&o]) ); @@ -665,7 +665,7 @@ void Preferences::removeObserver(Observer &o) } delete priv_data; - priv_data = 0; + priv_data = nullptr; delete _observer_map[&o]; _observer_map.erase(&o); } @@ -690,11 +690,11 @@ Inkscape::XML::Node *Preferences::_getNode(Glib::ustring const &pref_key, bool c // No longer necessary, can cause problems with input devices which have a dot in the name // g_assert( pref_key.find('.') == Glib::ustring::npos ); - if (_prefs_doc == NULL){ - return NULL; + if (_prefs_doc == nullptr){ + return nullptr; } Inkscape::XML::Node *node = _prefs_doc->root(); - Inkscape::XML::Node *child = NULL; + Inkscape::XML::Node *child = nullptr; gchar **splits = g_strsplit(pref_key.c_str(), "/", 0); if ( splits ) { @@ -705,7 +705,7 @@ Inkscape::XML::Node *Preferences::_getNode(Glib::ustring const &pref_key, bool c } for (child = node->firstChild(); child; child = child->next()) { - if (child->attribute("id") == NULL) { + if (child->attribute("id") == nullptr) { continue; } if (!strcmp(splits[part_i], child->attribute("id"))) { @@ -727,12 +727,12 @@ Inkscape::XML::Node *Preferences::_getNode(Glib::ustring const &pref_key, bool c node = child; } g_strfreev(splits); - splits = 0; + splits = nullptr; return node; } else { g_strfreev(splits); - splits = 0; - return NULL; + splits = nullptr; + return nullptr; } } @@ -751,12 +751,12 @@ void Preferences::_getRawValue(Glib::ustring const &path, gchar const *&result) // retrieve the attribute Inkscape::XML::Node *node = _getNode(node_key, false); - if ( node == NULL ) { - result = NULL; + if ( node == nullptr ) { + result = nullptr; } else { gchar const *attr = node->attribute(attr_key.c_str()); - if ( attr == NULL ) { - result = NULL; + if ( attr == nullptr ) { + result = nullptr; } else { result = attr; } @@ -802,7 +802,7 @@ int Preferences::_extractInt(Entry const &v) double Preferences::_extractDouble(Entry const &v) { gchar const *s = static_cast<gchar const *>(v._value); - return g_ascii_strtod(s, NULL); + return g_ascii_strtod(s, nullptr); } double Preferences::_extractDouble(Entry const &v, Glib::ustring const &requested_unit) @@ -909,11 +909,11 @@ void Preferences::unload(bool save) _instance->save(); } delete _instance; - _instance = NULL; + _instance = nullptr; } } -Preferences *Preferences::_instance = NULL; +Preferences *Preferences::_instance = nullptr; } // namespace Inkscape diff --git a/src/preferences.h b/src/preferences.h index 88fdd864c..9ac007528 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -122,7 +122,7 @@ public: friend class Preferences; // Preferences class has to access _value public: ~Entry() {} - Entry() : _pref_path(""), _value(NULL) {} // needed to enable use in maps + Entry() : _pref_path(""), _value(nullptr) {} // needed to enable use in maps Entry(Entry const &other) : _pref_path(other._pref_path), _value(other._value) {} /** @@ -130,7 +130,7 @@ public: * * @return If false, the default value will be returned by the getters. */ - bool isValid() const { return _value != NULL; } + bool isValid() const { return _value != nullptr; } /** * Interpret the preference as a Boolean value. diff --git a/src/prefix.cpp b/src/prefix.cpp index 14fdd04df..7ba6d16f4 100644 --- a/src/prefix.cpp +++ b/src/prefix.cpp @@ -223,7 +223,7 @@ GPrivate* br_thread_key = (GPrivate *)NULL; #else /* !BR_THREADS */ -static char *br_last_value = (char*)NULL; +static char *br_last_value = (char*)nullptr; static void br_free_last_value () @@ -316,10 +316,10 @@ br_strcat (const char *str1, const char *str2) static char * br_strndup (char *str, size_t size) { - char *result = (char*)NULL; + char *result = (char*)nullptr; size_t len; - br_return_val_if_fail (str != (char*)NULL, (char*)NULL); + br_return_val_if_fail (str != (char*)nullptr, (char*)nullptr); len = strlen (str); if (!len) return strdup (""); @@ -348,7 +348,7 @@ br_extract_dir (const char *path) const char *end; char *result; - br_return_val_if_fail (path != (char*)NULL, (char*)NULL); + br_return_val_if_fail (path != (char*)nullptr, (char*)nullptr); end = strrchr (path, '/'); if (!end) return strdup ("."); @@ -384,7 +384,7 @@ br_extract_prefix (const char *path) const char *end; char *tmp, *result; - br_return_val_if_fail (path != (char*)NULL, (char*)NULL); + br_return_val_if_fail (path != (char*)nullptr, (char*)nullptr); if (!*path) return strdup ("/"); end = strrchr (path, '/'); diff --git a/src/print.cpp b/src/print.cpp index 593e506b6..efdfe392b 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -121,8 +121,8 @@ void sp_print_document_to_file(SPDocument *doc, gchar const *filename) mod->finish(); /* Release drawing items */ (mod->base)->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // should be deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // should be deleted by invoke_hide /* end */ mod->set_param_string("destination", oldoutput); diff --git a/src/profile-manager.cpp b/src/profile-manager.cpp index 6cd83839c..252e011a9 100644 --- a/src/profile-manager.cpp +++ b/src/profile-manager.cpp @@ -29,7 +29,7 @@ ProfileManager::ProfileManager(SPDocument *document) : ProfileManager::~ProfileManager() { _resource_connection.disconnect(); - _doc = 0; + _doc = nullptr; } void ProfileManager::_resourcesChanged() @@ -71,11 +71,11 @@ void ProfileManager::_resourcesChanged() ColorProfile* ProfileManager::find(gchar const* name) { - ColorProfile* match = 0; + ColorProfile* match = nullptr; if ( name ) { - unsigned int howMany = childCount(NULL); + unsigned int howMany = childCount(nullptr); for ( unsigned int index = 0; index < howMany; index++ ) { - SPObject *obj = nthChildOf(NULL, index); + SPObject *obj = nthChildOf(nullptr, index); ColorProfile* prof = reinterpret_cast<ColorProfile*>(obj); if (prof && (prof->name && !strcmp(name, prof->name))) { match = prof; diff --git a/src/proj_pt.cpp b/src/proj_pt.cpp index 311b9a034..bb340f425 100644 --- a/src/proj_pt.cpp +++ b/src/proj_pt.cpp @@ -25,15 +25,15 @@ Pt2::Pt2(const char *coord_str) { return; } char **coords = g_strsplit(coord_str, ":", 0); - if (coords[0] == NULL || coords[1] == NULL || coords[2] == NULL) { + if (coords[0] == nullptr || coords[1] == nullptr || coords[2] == nullptr) { g_strfreev (coords); g_warning ("Malformed coordinate string.\n"); return; } - pt[0] = g_ascii_strtod(coords[0], NULL); - pt[1] = g_ascii_strtod(coords[1], NULL); - pt[2] = g_ascii_strtod(coords[2], NULL); + pt[0] = g_ascii_strtod(coords[0], nullptr); + pt[1] = g_ascii_strtod(coords[1], nullptr); + pt[2] = g_ascii_strtod(coords[2], nullptr); g_strfreev (coords); } @@ -73,17 +73,17 @@ Pt3::Pt3(const char *coord_str) { return; } char **coords = g_strsplit(coord_str, ":", 0); - if (coords[0] == NULL || coords[1] == NULL || - coords[2] == NULL || coords[3] == NULL) { + if (coords[0] == nullptr || coords[1] == nullptr || + coords[2] == nullptr || coords[3] == nullptr) { g_strfreev (coords); g_warning ("Malformed coordinate string.\n"); return; } - pt[0] = g_ascii_strtod(coords[0], NULL); - pt[1] = g_ascii_strtod(coords[1], NULL); - pt[2] = g_ascii_strtod(coords[2], NULL); - pt[3] = g_ascii_strtod(coords[3], NULL); + pt[0] = g_ascii_strtod(coords[0], nullptr); + pt[1] = g_ascii_strtod(coords[1], nullptr); + pt[2] = g_ascii_strtod(coords[2], nullptr); + pt[3] = g_ascii_strtod(coords[3], nullptr); } void diff --git a/src/rdf.cpp b/src/rdf.cpp index f06459a41..2d85fa48a 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -83,7 +83,7 @@ Bag example: */ struct rdf_double_t rdf_license_empty [] = { - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_cc_a [] = { @@ -92,7 +92,7 @@ struct rdf_double_t rdf_license_cc_a [] = { { "cc:requires", "http://creativecommons.org/ns#Notice", }, { "cc:requires", "http://creativecommons.org/ns#Attribution", }, { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_cc_a_sa [] = { @@ -102,7 +102,7 @@ struct rdf_double_t rdf_license_cc_a_sa [] = { { "cc:requires", "http://creativecommons.org/ns#Attribution", }, { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", }, { "cc:requires", "http://creativecommons.org/ns#ShareAlike", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_cc_a_nd [] = { @@ -110,7 +110,7 @@ struct rdf_double_t rdf_license_cc_a_nd [] = { { "cc:permits", "http://creativecommons.org/ns#Distribution", }, { "cc:requires", "http://creativecommons.org/ns#Notice", }, { "cc:requires", "http://creativecommons.org/ns#Attribution", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_cc_a_nc [] = { @@ -120,7 +120,7 @@ struct rdf_double_t rdf_license_cc_a_nc [] = { { "cc:requires", "http://creativecommons.org/ns#Attribution", }, { "cc:prohibits", "http://creativecommons.org/ns#CommercialUse", }, { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_cc_a_nc_sa [] = { @@ -131,7 +131,7 @@ struct rdf_double_t rdf_license_cc_a_nc_sa [] = { { "cc:prohibits", "http://creativecommons.org/ns#CommercialUse", }, { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", }, { "cc:requires", "http://creativecommons.org/ns#ShareAlike", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_cc_a_nc_nd [] = { @@ -140,14 +140,14 @@ struct rdf_double_t rdf_license_cc_a_nc_nd [] = { { "cc:requires", "http://creativecommons.org/ns#Notice", }, { "cc:requires", "http://creativecommons.org/ns#Attribution", }, { "cc:prohibits", "http://creativecommons.org/ns#CommercialUse", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_pd [] = { { "cc:permits", "http://creativecommons.org/ns#Reproduction", }, { "cc:permits", "http://creativecommons.org/ns#Distribution", }, { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_freeart [] = { @@ -157,7 +157,7 @@ struct rdf_double_t rdf_license_freeart [] = { { "cc:requires", "http://creativecommons.org/ns#ShareAlike", }, { "cc:requires", "http://creativecommons.org/ns#Notice", }, { "cc:requires", "http://creativecommons.org/ns#Attribution", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_double_t rdf_license_ofl [] = { @@ -170,7 +170,7 @@ struct rdf_double_t rdf_license_ofl [] = { { "cc:requires", "http://scripts.sil.org/pub/OFL/ShareAlike", }, { "cc:requires", "http://scripts.sil.org/pub/OFL/DerivativeRenaming", }, { "cc:requires", "http://scripts.sil.org/pub/OFL/BundlingWhenSelling", }, - { NULL, NULL } + { nullptr, nullptr } }; struct rdf_license_t rdf_licenses [] = { @@ -219,7 +219,7 @@ struct rdf_license_t rdf_licenses [] = { rdf_license_ofl, }, - { NULL, NULL, rdf_license_empty, } + { nullptr, nullptr, rdf_license_empty, } }; #define XML_TAG_NAME_SVG "svg:svg" @@ -298,8 +298,8 @@ struct rdf_work_entity_t rdf_work_entities [] = { N_("XML fragment for the RDF 'License' section"), RDF_FORMAT_MULTILINE, RDF_EDIT_SPECIAL, }, - { NULL, NULL, NULL, RDF_CONTENT, - NULL, RDF_FORMAT_LINE, RDF_EDIT_HARDCODED, + { nullptr, nullptr, nullptr, RDF_CONTENT, + nullptr, RDF_FORMAT_LINE, RDF_EDIT_HARDCODED, } }; @@ -362,7 +362,7 @@ struct rdf_work_entity_t *rdf_find_entity(gchar const * name) if (strcmp(entity->name,name)==0) break; } if (entity->name) return entity; - return NULL; + return nullptr; } /* @@ -486,27 +486,27 @@ rdf_string(struct rdf_t * rdf) const gchar *RDFImpl::getReprText( Inkscape::XML::Node const * repr, struct rdf_work_entity_t const & entity ) { - g_return_val_if_fail (repr != NULL, NULL); - static gchar * bag = NULL; - gchar * holder = NULL; + g_return_val_if_fail (repr != nullptr, NULL); + static gchar * bag = nullptr; + gchar * holder = nullptr; - Inkscape::XML::Node const * temp = NULL; + Inkscape::XML::Node const * temp = nullptr; switch (entity.datatype) { case RDF_CONTENT: temp = repr->firstChild(); - if ( temp == NULL ) return NULL; + if ( temp == nullptr ) return nullptr; return temp->content(); case RDF_AGENT: temp = sp_repr_lookup_name ( repr, "cc:Agent", 1 ); - if ( temp == NULL ) return NULL; + if ( temp == nullptr ) return nullptr; temp = sp_repr_lookup_name ( temp, "dc:title", 1 ); - if ( temp == NULL ) return NULL; + if ( temp == nullptr ) return nullptr; temp = temp->firstChild(); - if ( temp == NULL ) return NULL; + if ( temp == nullptr ) return nullptr; return temp->content(); @@ -519,13 +519,13 @@ const gchar *RDFImpl::getReprText( Inkscape::XML::Node const * repr, struct rdf_ case RDF_BAG: /* clear the static string. yucky. */ if (bag) g_free(bag); - bag = NULL; + bag = nullptr; temp = sp_repr_lookup_name ( repr, "rdf:Bag", 1 ); - if ( temp == NULL ) { + if ( temp == nullptr ) { /* backwards compatible: read contents */ temp = repr->firstChild(); - if ( temp == NULL ) return NULL; + if ( temp == nullptr ) return nullptr; return temp->content(); } @@ -551,24 +551,24 @@ const gchar *RDFImpl::getReprText( Inkscape::XML::Node const * repr, struct rdf_ default: break; } - return NULL; + return nullptr; } unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, struct rdf_work_entity_t const & entity, gchar const * text ) { - g_return_val_if_fail ( repr != NULL, 0); - g_return_val_if_fail ( text != NULL, 0); - gchar * str = NULL; - gchar** strlist = NULL; + g_return_val_if_fail ( repr != nullptr, 0); + g_return_val_if_fail ( text != nullptr, 0); + gchar * str = nullptr; + gchar** strlist = nullptr; int i; - Inkscape::XML::Node * temp=NULL; + Inkscape::XML::Node * temp=nullptr; Inkscape::XML::Node * parent=repr; Inkscape::XML::Document * xmldoc = parent->document(); - g_return_val_if_fail (xmldoc != NULL, FALSE); + g_return_val_if_fail (xmldoc != nullptr, FALSE); // set document's title element to the RDF title if (!strcmp(entity.name, "title")) { @@ -581,9 +581,9 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, switch (entity.datatype) { case RDF_CONTENT: temp = parent->firstChild(); - if ( temp == NULL ) { + if ( temp == nullptr ) { temp = xmldoc->createTextNode( text ); - g_return_val_if_fail (temp != NULL, FALSE); + g_return_val_if_fail (temp != nullptr, FALSE); parent->appendChild(temp); Inkscape::GC::release(temp); @@ -597,9 +597,9 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, case RDF_AGENT: temp = sp_repr_lookup_name ( parent, "cc:Agent", 1 ); - if ( temp == NULL ) { + if ( temp == nullptr ) { temp = xmldoc->createElement ( "cc:Agent" ); - g_return_val_if_fail (temp != NULL, FALSE); + g_return_val_if_fail (temp != nullptr, FALSE); parent->appendChild(temp); Inkscape::GC::release(temp); @@ -607,9 +607,9 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, parent = temp; temp = sp_repr_lookup_name ( parent, "dc:title", 1 ); - if ( temp == NULL ) { + if ( temp == nullptr ) { temp = xmldoc->createElement ( "dc:title" ); - g_return_val_if_fail (temp != NULL, FALSE); + g_return_val_if_fail (temp != nullptr, FALSE); parent->appendChild(temp); Inkscape::GC::release(temp); @@ -617,9 +617,9 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, parent = temp; temp = parent->firstChild(); - if ( temp == NULL ) { + if ( temp == nullptr ) { temp = xmldoc->createTextNode( text ); - g_return_val_if_fail (temp != NULL, FALSE); + g_return_val_if_fail (temp != nullptr, FALSE); parent->appendChild(temp); Inkscape::GC::release(temp); @@ -641,14 +641,14 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, case RDF_BAG: /* find/create the rdf:Bag item */ temp = sp_repr_lookup_name ( parent, "rdf:Bag", 1 ); - if ( temp == NULL ) { + if ( temp == nullptr ) { /* backward compatibility: drop the dc:subject contents */ while ( (temp = parent->firstChild()) ) { parent->removeChild(temp); } temp = xmldoc->createElement ( "rdf:Bag" ); - g_return_val_if_fail (temp != NULL, FALSE); + g_return_val_if_fail (temp != nullptr, FALSE); parent->appendChild(temp); Inkscape::GC::release(temp); @@ -665,13 +665,13 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, for (i = 0; (str = strlist[i]); i++) { temp = xmldoc->createElement ( "rdf:li" ); - g_return_val_if_fail (temp != NULL, 0); + g_return_val_if_fail (temp != nullptr, 0); parent->appendChild(temp); Inkscape::GC::release(temp); Inkscape::XML::Node * child = xmldoc->createTextNode( g_strstrip(str) ); - g_return_val_if_fail (child != NULL, 0); + g_return_val_if_fail (child != nullptr, 0); temp->appendChild(child); Inkscape::GC::release(child); @@ -715,7 +715,7 @@ void RDFImpl::ensureParentIsMetadata( SPDocument *doc, Inkscape::XML::Node *node Inkscape::XML::Node const *RDFImpl::getRdfRootRepr( SPDocument const * doc ) { - Inkscape::XML::Node const *rdf = 0; + Inkscape::XML::Node const *rdf = nullptr; if ( !doc ) { g_critical("Null doc passed to getRdfRootRepr()"); } else if ( !doc->getReprDoc() ) { @@ -729,7 +729,7 @@ Inkscape::XML::Node const *RDFImpl::getRdfRootRepr( SPDocument const * doc ) Inkscape::XML::Node *RDFImpl::ensureRdfRootRepr( SPDocument * doc ) { - Inkscape::XML::Node *rdf = 0; + Inkscape::XML::Node *rdf = nullptr; if ( !doc ) { g_critical("Null doc passed to ensureRdfRootRepr()"); } else if ( !doc->getReprDoc() ) { @@ -742,7 +742,7 @@ Inkscape::XML::Node *RDFImpl::ensureRdfRootRepr( SPDocument * doc ) g_critical("Unable to locate svg element."); } else { Inkscape::XML::Node * parent = sp_repr_lookup_name( svg, XML_TAG_NAME_METADATA ); - if ( parent == NULL ) { + if ( parent == nullptr ) { parent = doc->getReprDoc()->createElement( XML_TAG_NAME_METADATA ); if ( !parent ) { g_critical("Unable to create metadata element"); @@ -776,7 +776,7 @@ Inkscape::XML::Node *RDFImpl::ensureRdfRootRepr( SPDocument * doc ) Inkscape::XML::Node const *RDFImpl::getXmlRepr( SPDocument const * doc, gchar const * name ) { - Inkscape::XML::Node const * xml = 0; + Inkscape::XML::Node const * xml = nullptr; if ( !doc ) { g_critical("Null doc passed to getXmlRepr()"); } else if ( !doc->getReprDoc() ) { @@ -801,7 +801,7 @@ Inkscape::XML::Node *RDFImpl::getXmlRepr( SPDocument * doc, gchar const * name ) Inkscape::XML::Node *RDFImpl::ensureXmlRepr( SPDocument * doc, gchar const * name ) { - Inkscape::XML::Node * xml = 0; + Inkscape::XML::Node * xml = nullptr; if ( !doc ) { g_critical("Null doc passed to ensureXmlRepr()"); } else if ( !doc->getReprDoc() ) { @@ -830,7 +830,7 @@ Inkscape::XML::Node *RDFImpl::ensureXmlRepr( SPDocument * doc, gchar const * nam Inkscape::XML::Node const *RDFImpl::getWorkRepr( SPDocument const * doc, gchar const * name ) { - Inkscape::XML::Node const * item = 0; + Inkscape::XML::Node const * item = nullptr; if ( !doc ) { g_critical("Null doc passed to getWorkRepr()"); } else if ( !doc->getReprDoc() ) { @@ -848,7 +848,7 @@ Inkscape::XML::Node const *RDFImpl::getWorkRepr( SPDocument const * doc, gchar c Inkscape::XML::Node *RDFImpl::ensureWorkRepr( SPDocument * doc, gchar const * name ) { - Inkscape::XML::Node * item = 0; + Inkscape::XML::Node * item = nullptr; if ( !doc ) { g_critical("Null doc passed to ensureWorkRepr()"); } else if ( !doc->getReprDoc() ) { @@ -878,7 +878,7 @@ Inkscape::XML::Node *RDFImpl::ensureWorkRepr( SPDocument * doc, gchar const * na // Public API: const gchar *rdf_get_work_entity(SPDocument const * doc, struct rdf_work_entity_t * entity) { - const gchar *result = 0; + const gchar *result = nullptr; if ( !doc ) { g_critical("Null doc passed to rdf_get_work_entity()"); } else if ( entity ) { @@ -893,7 +893,7 @@ const gchar *rdf_get_work_entity(SPDocument const * doc, struct rdf_work_entity_ const gchar *RDFImpl::getWorkEntity(SPDocument const * doc, struct rdf_work_entity_t & entity) { - gchar const *result = 0; + gchar const *result = nullptr; Inkscape::XML::Node const * item = getWorkRepr( doc, entity.tag ); if ( item ) { @@ -948,8 +948,8 @@ unsigned int RDFImpl::setWorkEntity(SPDocument * doc, struct rdf_work_entity_t & static bool rdf_match_license(Inkscape::XML::Node const *repr, struct rdf_license_t const *license) { - g_assert ( repr != NULL ); - g_assert ( license != NULL ); + g_assert ( repr != nullptr ); + g_assert ( license != nullptr ); bool result=TRUE; #ifdef DEBUG_MATCH @@ -968,7 +968,7 @@ rdf_match_license(Inkscape::XML::Node const *repr, struct rdf_license_t const *l current = current->next() ) { gchar const * attr = current->attribute("rdf:resource"); - if ( attr == NULL ) continue; + if ( attr == nullptr ) continue; #ifdef DEBUG_MATCH printf("\texamining '%s' => '%s'\n", current->name(), attr); @@ -1044,15 +1044,15 @@ struct rdf_license_t *RDFImpl::getLicense(SPDocument *document) // (Fixes https://bugs.launchpad.net/inkscape/+bug/372427) struct rdf_work_entity_t *entity = rdf_find_entity("license_uri"); - if (entity == NULL) { + if (entity == nullptr) { g_critical("Can't find internal entity structure for 'license_uri'"); - return NULL; + return nullptr; } const gchar *uri = getWorkEntity(document, *entity); - struct rdf_license_t * license_by_uri = NULL; + struct rdf_license_t * license_by_uri = nullptr; - if (uri != NULL) { + if (uri != nullptr) { for (struct rdf_license_t * license = rdf_licenses; license->name; license++) { if (g_strcmp0(uri, license->uri) == 0) { license_by_uri = license; @@ -1068,7 +1068,7 @@ struct rdf_license_t *RDFImpl::getLicense(SPDocument *document) // sp_metadata_build() then the right place to put the call to sort out // any RDF mess? - struct rdf_license_t * license_by_properties = NULL; + struct rdf_license_t * license_by_properties = nullptr; Inkscape::XML::Node const *repr = getXmlRepr( document, XML_TAG_NAME_LICENSE ); if (repr) { @@ -1080,7 +1080,7 @@ struct rdf_license_t *RDFImpl::getLicense(SPDocument *document) } } - if (license_by_uri != NULL && license_by_properties != NULL) { + if (license_by_uri != nullptr && license_by_properties != nullptr) { // Both property and structure, use property if (license_by_uri != license_by_properties) { // TODO: this should be a user-visible warning, but how? @@ -1101,13 +1101,13 @@ struct rdf_license_t *RDFImpl::getLicense(SPDocument *document) return license_by_uri; } - else if (license_by_uri != NULL) { + else if (license_by_uri != nullptr) { // Only cc:license property, set structure for backward compatibility setLicense(document, license_by_uri); return license_by_uri; } - else if (license_by_properties != NULL) { + else if (license_by_properties != nullptr) { // Only cc:License structure // TODO: this could be a user-visible warning too g_warning("No %s metadata found, derived license URI from %s: %s", @@ -1121,7 +1121,7 @@ struct rdf_license_t *RDFImpl::getLicense(SPDocument *document) } // No license info at all - return NULL; + return nullptr; } // Public API: @@ -1156,7 +1156,7 @@ void RDFImpl::setLicense(SPDocument * doc, struct rdf_license_t const * license) for (struct rdf_double_t const * detail = license->details; detail->name; detail++) { Inkscape::XML::Node * child = doc->getReprDoc()->createElement( detail->name ); - g_assert ( child != NULL ); + g_assert ( child != nullptr ); child->setAttribute("rdf:resource", detail->resource ); repr->appendChild(child); @@ -1172,7 +1172,7 @@ struct rdf_entity_default_t { struct rdf_entity_default_t rdf_defaults[] = { { "format", "image/svg+xml", }, { "type", "http://purl.org/dc/dcmitype/StillImage", }, - { NULL, NULL, } + { nullptr, nullptr, } }; // Public API: @@ -1184,10 +1184,10 @@ void rdf_set_defaults( SPDocument * doc ) void RDFImpl::setDefaults( SPDocument * doc ) { - g_assert( doc != NULL ); + g_assert( doc != nullptr ); // Create metadata node if it doesn't already exist - if (!sp_item_group_get_child_by_name( doc->getRoot(), NULL, + if (!sp_item_group_get_child_by_name( doc->getRoot(), nullptr, XML_TAG_NAME_METADATA)) { if ( !doc->getReprDoc()) { g_critical("XML doc is null."); @@ -1196,7 +1196,7 @@ void RDFImpl::setDefaults( SPDocument * doc ) Inkscape::XML::Node * rnew = doc->getReprDoc()->createElement(XML_TAG_NAME_METADATA); // insert into the document - doc->getReprRoot()->addChild(rnew, NULL); + doc->getReprRoot()->addChild(rnew, nullptr); // clean up Inkscape::GC::release(rnew); @@ -1206,9 +1206,9 @@ void RDFImpl::setDefaults( SPDocument * doc ) // install defaults for ( struct rdf_entity_default_t * rdf_default = rdf_defaults; rdf_default->name; rdf_default++) { struct rdf_work_entity_t * entity = rdf_find_entity( rdf_default->name ); - g_assert( entity != NULL ); + g_assert( entity != nullptr ); - if ( getWorkEntity( doc, *entity ) == NULL ) { + if ( getWorkEntity( doc, *entity ) == nullptr ) { setWorkEntity( doc, *entity, rdf_default->text ); } } diff --git a/src/removeoverlap.cpp b/src/removeoverlap.cpp index 06e7b81e6..bf9c362e2 100644 --- a/src/removeoverlap.cpp +++ b/src/removeoverlap.cpp @@ -32,7 +32,7 @@ struct Record { Geom::Point midpoint; Rectangle * vspc_rect; - Record() : item(0), vspc_rect(0) {} + Record() : item(nullptr), vspc_rect(nullptr) {} Record(SPItem * i, Geom::Point m, Rectangle * r) : item(i), midpoint(m), vspc_rect(r) {} }; diff --git a/src/resource-manager.cpp b/src/resource-manager.cpp index 4fdc45ff0..4ca4c4e0b 100644 --- a/src/resource-manager.cpp +++ b/src/resource-manager.cpp @@ -360,7 +360,7 @@ bool ResourceManagerImpl::fixupBrokenLinks(SPDocument *doc) ir->setAttribute( "xlink:href", mapping[href].c_str() ); if ( ir->attribute( "sodipodi:absref" ) ) { - ir->setAttribute( "sodipodi:absref", 0 ); // Remove this attribute + ir->setAttribute( "sodipodi:absref", nullptr ); // Remove this attribute } SPObject *updated = doc->getObjectByRepr(ir); @@ -414,7 +414,7 @@ bool ResourceManagerImpl::searchUpwards( std::string const &base, std::string co } -static ResourceManagerImpl* theInstance = 0; +static ResourceManagerImpl* theInstance = nullptr; ResourceManager::ResourceManager() : Glib::Object() diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 47fdffb28..94b11f863 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -18,10 +18,10 @@ #include "display/canvas-bpath.h" #include "display/curve.h" -Inkscape::Rubberband *Inkscape::Rubberband::_instance = NULL; +Inkscape::Rubberband *Inkscape::Rubberband::_instance = nullptr; Inkscape::Rubberband::Rubberband(SPDesktop *dt) - : _desktop(dt), _rect(NULL), _touchpath(NULL), _started(false) + : _desktop(dt), _rect(nullptr), _touchpath(nullptr), _started(false) { _points.clear(); _mode = RUBBERBAND_MODE_RECT; @@ -32,12 +32,12 @@ void Inkscape::Rubberband::delete_canvas_items() { if (_rect) { SPCanvasItem *temp = _rect; - _rect = NULL; + _rect = nullptr; sp_canvas_item_destroy(temp); } if (_touchpath) { SPCanvasItem *temp = _touchpath; - _touchpath = NULL; + _touchpath = nullptr; sp_canvas_item_destroy(temp); } } @@ -96,8 +96,8 @@ void Inkscape::Rubberband::move(Geom::Point const &p) } if (_mode == RUBBERBAND_MODE_RECT) { - if (_rect == NULL) { - _rect = static_cast<CtrlRect *>(sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, NULL)); + if (_rect == nullptr) { + _rect = static_cast<CtrlRect *>(sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, nullptr)); _rect->setShadow(1, 0xffffffff); } _rect->setRectangle(Geom::Rect(_start, _end)); @@ -107,8 +107,8 @@ void Inkscape::Rubberband::move(Geom::Point const &p) sp_canvas_item_hide(_touchpath); } else if (_mode == RUBBERBAND_MODE_TOUCHPATH) { - if (_touchpath == NULL) { - _touchpath = sp_canvas_bpath_new(_desktop->getSketch(), NULL); + if (_touchpath == nullptr) { + _touchpath = sp_canvas_bpath_new(_desktop->getSketch(), nullptr); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(_touchpath), 0xff0000ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(_touchpath), 0, SP_WIND_RULE_NONZERO); } @@ -136,7 +136,7 @@ Geom::OptRect Inkscape::Rubberband::getRectangle() const Inkscape::Rubberband *Inkscape::Rubberband::get(SPDesktop *desktop) { - if (_instance == NULL) { + if (_instance == nullptr) { _instance = new Inkscape::Rubberband(desktop); } diff --git a/src/selcue.cpp b/src/selcue.cpp index 8ef3aa03a..375156412 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -87,7 +87,7 @@ void Inkscape::SelCue::_updateItemBboxes(Inkscape::Preferences *prefs) return; } - g_return_if_fail(_selection != NULL); + g_return_if_fail(_selection != nullptr); int prefs_bbox = prefs->getBool("/tools/bounding_box"); @@ -142,7 +142,7 @@ void Inkscape::SelCue::_newItemBboxes() return; } - g_return_if_fail(_selection != NULL); + g_return_if_fail(_selection != nullptr); int prefs_bbox = prefs->getBool("/tools/bounding_box"); @@ -153,7 +153,7 @@ void Inkscape::SelCue::_newItemBboxes() Geom::OptRect const b = (prefs_bbox == 0) ? item->desktopVisualBounds() : item->desktopGeometricBounds(); - SPCanvasItem* box = NULL; + SPCanvasItem* box = nullptr; if (b) { if (mode == MARK) { @@ -175,7 +175,7 @@ void Inkscape::SelCue::_newItemBboxes() } else if (mode == BBOX) { box = sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRLRECT, - NULL); + nullptr); SP_CTRLRECT(box)->setRectangle(*b); SP_CTRLRECT(box)->setColor(0x000000a0, 0, 0); @@ -205,10 +205,10 @@ void Inkscape::SelCue::_newTextBaselines() for (auto l=ll.begin();l!=ll.end();++l) { SPItem *item = *l; - SPCanvasItem* baseline_point = NULL; + SPCanvasItem* baseline_point = nullptr; if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline Inkscape::Text::Layout const *layout = te_get_layout(item); - if (layout != NULL && layout->outputExists()) { + if (layout != nullptr && layout->outputExists()) { boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { baseline_point = sp_canvas_item_new(_desktop->getControls(), SP_TYPE_CTRL, @@ -240,7 +240,7 @@ void Inkscape::SelCue::_boundingBoxPrefsChanged(int prefs_bbox) return; } - g_return_if_fail(_selection != NULL); + g_return_if_fail(_selection != nullptr); _updateItemBboxes(mode, prefs_bbox); } diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 128a4712f..3ecefadde 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -169,7 +169,7 @@ void SelectionHelper::selectAllInAll(SPDesktop *dt) void SelectionHelper::selectNone(SPDesktop *dt) { - NodeTool *nt = NULL; + NodeTool *nt = nullptr; if (tools_isactive(dt, TOOLS_NODES)) { nt = static_cast<NodeTool*>(dt->event_context); } @@ -345,7 +345,7 @@ static std::vector<Inkscape::XML::Node*> sp_selection_paste_impl(SPDocument *doc Inkscape::XML::Document *xml_doc = doc->getReprDoc(); SPItem *parentItem = dynamic_cast<SPItem *>(parent); - g_assert(parentItem != NULL); + g_assert(parentItem != nullptr); std::vector<Inkscape::XML::Node*> copied; // add objects to document @@ -377,12 +377,12 @@ static std::vector<Inkscape::XML::Node*> sp_selection_paste_impl(SPDocument *doc static void sp_selection_delete_impl(std::vector<SPItem*> const &items, bool propagate = true, bool propagate_descendants = true) { for (std::vector<SPItem*>::const_iterator i = items.begin(); i != items.end(); ++i) { - sp_object_ref(*i, NULL); + sp_object_ref(*i, nullptr); } for (std::vector<SPItem*>::const_iterator i = items.begin(); i != items.end(); ++i) { SPItem *item = *i; item->deleteObject(propagate, propagate_descendants); - sp_object_unref(item, NULL); + sp_object_unref(item, nullptr); } } @@ -572,7 +572,7 @@ void sp_edit_clear_all(Inkscape::Selection *selection) selection->clear(); SPGroup *group = dynamic_cast<SPGroup *>(selection->layers()->currentLayer()); - g_return_if_fail(group != NULL); + g_return_if_fail(group != nullptr); std::vector<SPItem*> items = sp_item_group_item_list(group); for(unsigned int i = 0; i < items.size(); i++){ @@ -800,7 +800,7 @@ void ObjectSet::popFromGroup(){ selection_display_message(desktop(), Inkscape::WARNING_MESSAGE, _("Selection <b>not in a group</b>.")); return; } - if (parent_group->firstChild()->getNext() == NULL) { + if (parent_group->firstChild()->getNext() == nullptr) { std::vector<SPItem*> children; sp_item_group_ungroup(static_cast<SPGroup*>(parent_group), children, false); } @@ -925,17 +925,17 @@ static SPGroup * sp_item_list_common_parent_group(const SPItemRange &items) { if (items.empty()) { - return NULL; + return nullptr; } SPObject *parent = items.front()->parent; // Strictly speaking this CAN happen, if user selects <svg> from Inkscape::XML editor if (!dynamic_cast<SPGroup *>(parent)) { - return NULL; + return nullptr; } for (auto item=items.begin();item!=items.end();++item) { if((*item)==items.front())continue; if ((*item)->parent != parent) { - return NULL; + return nullptr; } } @@ -958,7 +958,7 @@ enclose_items(std::vector<SPItem*> const &items) // TODO determine if this is intentionally different from SPObject::getPrev() static SPObject *prev_sibling(SPObject *child) { - SPObject *prev = 0; + SPObject *prev = nullptr; if ( child && dynamic_cast<SPGroup *>(child->parent) ) { prev = child->getPrev(); } @@ -1230,11 +1230,11 @@ take_style_from_item(SPObject *object) // write the complete cascaded style, context-free SPCSSAttr *css = sp_css_attr_from_object(object, SP_STYLE_FLAG_ALWAYS); - if (css == NULL) - return NULL; + if (css == nullptr) + return nullptr; if ((dynamic_cast<SPGroup *>(object) && object->firstChild()) || - (dynamic_cast<SPText *>(object) && object->firstChild() && object->firstChild()->getNext() == NULL)) { + (dynamic_cast<SPText *>(object) && object->firstChild() && object->firstChild()->getNext() == nullptr)) { // if this is a text with exactly one tspan child, merge the style of that tspan as well // If this is a group, merge the style of its topmost (last) child with style auto list = object->children | boost::adaptors::reversed; @@ -1621,7 +1621,7 @@ void ObjectSet::applyAffine(Geom::Affine const &affine, bool set_i2d, bool compe && includes( sp_textpath_get_path_item(dynamic_cast<SPTextPath *>(item->firstChild())) )); // ...both a flowtext and its frame? - bool transform_flowtext_with_frame = (dynamic_cast<SPFlowtext *>(item) && includes( dynamic_cast<SPFlowtext *>(item)->get_frame(NULL))); // (only the first frame is checked so far) + bool transform_flowtext_with_frame = (dynamic_cast<SPFlowtext *>(item) && includes( dynamic_cast<SPFlowtext *>(item)->get_frame(nullptr))); // (only the first frame is checked so far) // ...both an offset and its source? bool transform_offset_with_source = (dynamic_cast<SPOffset *>(item) && dynamic_cast<SPOffset *>(item)->sourceHref) && includes( sp_offset_get_source(dynamic_cast<SPOffset *>(item)) ); @@ -1632,7 +1632,7 @@ void ObjectSet::applyAffine(Geom::Affine const &affine, bool set_i2d, bool compe if (Inkscape::UI::Tools::cc_item_is_connector(item)) { SPPath *path = dynamic_cast<SPPath *>(item); if (path) { - SPItem *attItem[2] = {0, 0}; + SPItem *attItem[2] = {nullptr, nullptr}; path->connEndPair.getAttachedItems(attItem); for (int n = 0; n < 2; ++n) { if (!includes(attItem[n])) { @@ -1668,7 +1668,7 @@ void ObjectSet::applyAffine(Geom::Affine const &affine, bool set_i2d, bool compe for (auto& itm: region.children) { SPUse *use = dynamic_cast<SPUse *>(&itm); if ( use ) { - use->doWriteTransform(item->transform.inverse(), NULL, compensate); + use->doWriteTransform(item->transform.inverse(), nullptr, compensate); } } } @@ -1743,7 +1743,7 @@ void ObjectSet::applyAffine(Geom::Affine const &affine, bool set_i2d, bool compe if (set_i2d) { item->set_i2d_affine(item->i2dt_affine() * (Geom::Affine)affine); } - item->doWriteTransform(item->transform, NULL, compensate); + item->doWriteTransform(item->transform, nullptr, compensate); } if (adjust_transf_center) { // The transformation center should not be touched in case of pasting or importing, which is allowed by this if clause @@ -1761,7 +1761,7 @@ void ObjectSet::removeTransform() { auto items = xmlNodes(); for (auto l=items.begin();l!=items.end() ;++l) { - (*l)->setAttribute("transform", NULL, false); + (*l)->setAttribute("transform", nullptr, false); } if(document()) @@ -2126,7 +2126,7 @@ std::vector<SPItem*> sp_get_same_style(SPItem *sel, std::vector<SPItem*> &src, S * to get the transformed stroke width */ std::vector<SPItem*> objects; - SPStyle *sel_style_for_width = NULL; + SPStyle *sel_style_for_width = nullptr; if (type == SP_STROKE_STYLE_WIDTH || type == SP_STROKE_STYLE_ALL || type==SP_STYLE_ALL ) { objects.push_back(sel); sel_style_for_width = new SPStyle(SP_ACTIVE_DOCUMENT); @@ -2183,7 +2183,7 @@ std::vector<SPItem*> sp_get_same_style(SPItem *sel, std::vector<SPItem*> &src, S } } - if( sel_style_for_width != NULL ) delete sel_style_for_width; + if( sel_style_for_width != nullptr ) delete sel_style_for_width; return matches; } @@ -2350,7 +2350,7 @@ typedef struct ListReverse { typedef std::list<SPObject *> *Iterator; static Iterator children(SPObject *o) { - return make_list(o, NULL); + return make_list(o, nullptr); } static Iterator siblings_after(SPObject *o) { return make_list(o->parent, o); @@ -2388,7 +2388,7 @@ SPItem *next_item(SPDesktop *desktop, std::vector<SPObject *> &path, SPObject *r typename D::Iterator children; typename D::Iterator iter; - SPItem *found=NULL; + SPItem *found=nullptr; if (!path.empty()) { SPObject *object=path.back(); @@ -2465,7 +2465,7 @@ SPItem *next_item_from_list(SPDesktop *desktop, std::vector<SPItem*> const &item void sp_selection_item_next(SPDesktop *desktop) { - g_return_if_fail(desktop != NULL); + g_return_if_fail(desktop != nullptr); Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -2495,8 +2495,8 @@ void sp_selection_item_prev(SPDesktop *desktop) { SPDocument *document = desktop->getDocument(); - g_return_if_fail(document != NULL); - g_return_if_fail(desktop != NULL); + g_return_if_fail(document != nullptr); + g_return_if_fail(desktop != nullptr); Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -2582,7 +2582,7 @@ void scroll_to_show_item(SPDesktop *desktop, SPItem *item) void ObjectSet::clone() { - if (document() == NULL) { + if (document() == nullptr) { return; } @@ -2693,7 +2693,7 @@ bool ObjectSet::unlink(const bool skip_undo) tmp_set.set(item); Inkscape::URIReference *clip = item->clip_ref; Inkscape::URIReference *mask = item->mask_ref; - if ((NULL != clip) && (NULL != clip->getObject())) { + if ((nullptr != clip) && (nullptr != clip->getObject())) { SPUse * clipuse = dynamic_cast<SPUse *>(clip->getObject()); if (clipuse) { tmp_set.unsetMask(true,true); @@ -2702,7 +2702,7 @@ bool ObjectSet::unlink(const bool skip_undo) } new_select.push_back(tmp_set.singleItem()); } - else if ((NULL != mask) && (NULL != mask->getObject())) { + else if ((nullptr != mask) && (nullptr != mask->getObject())) { SPUse * maskuse = dynamic_cast<SPUse *>(mask->getObject()); if (maskuse) { tmp_set.unsetMask(false,true); @@ -2730,7 +2730,7 @@ bool ObjectSet::unlink(const bool skip_undo) continue; } - SPItem *unlink = NULL; + SPItem *unlink = nullptr; SPUse *use = dynamic_cast<SPUse *>(item); if (use) { unlink = use->unlink(); @@ -2741,7 +2741,7 @@ bool ObjectSet::unlink(const bool skip_undo) } } else /*if (SP_IS_TREF(use))*/ { unlink = dynamic_cast<SPItem *>(sp_tref_convert_to_tspan(item)); - g_assert(unlink != NULL); + g_assert(unlink != nullptr); } unlinked = true; @@ -2812,7 +2812,7 @@ void ObjectSet::cloneOriginal() return; } - SPItem *original = NULL; + SPItem *original = nullptr; SPUse *use = dynamic_cast<SPUse *>(item); if (use) { original = use->get_original(); @@ -2822,19 +2822,19 @@ void ObjectSet::cloneOriginal() original = sp_offset_get_source(offset); } else { 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 (text && textpath) { original = sp_textpath_get_path_item(textpath); } else { SPFlowtext *flowtext = dynamic_cast<SPFlowtext *>(item); if (flowtext) { - original = flowtext->get_frame(NULL); // first frame only + original = flowtext->get_frame(nullptr); // first frame only } } } } - if (original == NULL) { // it's an object that we don't know what to do with + if (original == nullptr) { // it's an object that we don't know what to do with if(desktop()) desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, error); return; @@ -2889,7 +2889,7 @@ void ObjectSet::cloneOriginalPathLPE(bool allow_transforms) { Inkscape::SVGOStringStream os; - SPObject * firstItem = NULL; + SPObject * firstItem = nullptr; auto items_= items(); bool multiple = false; for (auto i=items_.begin();i!=items_.end();++i){ @@ -2920,7 +2920,7 @@ void ObjectSet::cloneOriginalPathLPE(bool allow_transforms) lpe_repr->setAttribute("method", method_str); gchar const *allow_transforms_str = allow_transforms ? "true" : "false"; lpe_repr->setAttribute("allow_transforms", allow_transforms_str); - document()->getDefs()->getRepr()->addChild(lpe_repr, NULL); // adds to <defs> and assigns the 'id' attribute + document()->getDefs()->getRepr()->addChild(lpe_repr, nullptr); // adds to <defs> and assigns the 'id' attribute std::string lpe_id_href = std::string("#") + lpe_repr->attribute("id"); Inkscape::GC::release(lpe_repr); @@ -2954,7 +2954,7 @@ void ObjectSet::cloneOriginalPathLPE(bool allow_transforms) void ObjectSet::toMarker(bool apply) { // sp_selection_tile has similar code - if (desktop() == NULL) { // TODO: We should not need desktop for that. + if (desktop() == nullptr) { // TODO: We should not need desktop for that. // Someone get rid of the dt2doc() call. return; } @@ -3126,7 +3126,7 @@ void ObjectSet::toSymbol() // Find out if we have a single group bool single_group = false; - SPGroup *the_group = NULL; + SPGroup *the_group = nullptr; Geom::Affine transform; if( items_.size() == 1 ) { SPObject *object = items_[0]; @@ -3200,7 +3200,7 @@ void ObjectSet::toSymbol() symbol_repr->setAttribute("inkscape:transform-center-y", the_group->getAttribute("inkscape:transform-center-y")); - the_group->setAttribute("style", NULL); + the_group->setAttribute("style", nullptr); } @@ -3226,7 +3226,7 @@ void ObjectSet::toSymbol() g_free(title); Inkscape::XML::Node *repr = (*i)->getRepr(); repr->parent()->removeChild(repr); - symbol_repr->addChild(repr, NULL); + symbol_repr->addChild(repr, nullptr); } if( single_group && transform.isTranslation() ) { @@ -3275,7 +3275,7 @@ void ObjectSet::unSymbol() // Make sure we have only one object in selection. // Require that we really have a <symbol>. - if( symbol == NULL || !dynamic_cast<SPSymbol *>( symbol )) { + if( symbol == nullptr || !dynamic_cast<SPSymbol *>( symbol )) { if(desktop()) desktop()->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select only one <b>symbol</b> in Symbol dialog to convert to group.")); return; @@ -3300,8 +3300,8 @@ void ObjectSet::unSymbol() if( children.size() == 1 ) { SPObject *object = children[0]; if ( dynamic_cast<SPGroup *>( object ) ) { - if( object->getAttribute("style") == NULL || - object->getAttribute("class") == NULL ) { + if( object->getAttribute("style") == nullptr || + object->getAttribute("class") == nullptr ) { group->setAttribute("transform", object->getAttribute("transform")); children = object->childList(false); @@ -3312,7 +3312,7 @@ void ObjectSet::unSymbol() for (std::vector<SPObject*>::const_reverse_iterator i=children.rbegin();i!=children.rend();++i){ Inkscape::XML::Node *repr = (*i)->getRepr(); repr->parent()->removeChild(repr); - group->addChild(repr,NULL); + group->addChild(repr,nullptr); } // Copy relevant attributes @@ -3344,7 +3344,7 @@ void ObjectSet::unSymbol() void ObjectSet::tile(bool apply) { // toMarker has similar code - if (desktop() == NULL) { //same remark as in toMarker: no good reason to have this. + if (desktop() == nullptr) { //same remark as in toMarker: no good reason to have this. return; } @@ -3557,7 +3557,7 @@ void ObjectSet::getExportHints(Glib::ustring &filename, float *xdpi, float *ydpi if (xdpi_search) { dpi_string = repr->attribute("inkscape:export-xdpi"); - if (dpi_string != NULL) { + if (dpi_string != nullptr) { *xdpi = atof(dpi_string); xdpi_search = FALSE; } @@ -3565,7 +3565,7 @@ void ObjectSet::getExportHints(Glib::ustring &filename, float *xdpi, float *ydpi if (ydpi_search) { dpi_string = repr->attribute("inkscape:export-ydpi"); - if (dpi_string != NULL) { + if (dpi_string != nullptr) { *ydpi = atof(dpi_string); ydpi_search = FALSE; } @@ -3587,12 +3587,12 @@ void sp_document_get_export_hints(SPDocument *doc, Glib::ustring &filename, floa filename.clear(); } gchar const *dpi_string = repr->attribute("inkscape:export-xdpi"); - if (dpi_string != NULL) { + if (dpi_string != nullptr) { *xdpi = atof(dpi_string); } dpi_string = repr->attribute("inkscape:export-ydpi"); - if (dpi_string != NULL) { + if (dpi_string != nullptr) { *ydpi = atof(dpi_string); } } @@ -3646,12 +3646,12 @@ void ObjectSet::createBitmapCopy() g_strcanon(basename, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.=+~$#@^&!?", '_'); // Build the complete path by adding document base dir, if set, otherwise home dir - gchar *directory = NULL; + gchar *directory = nullptr; if ( doc->getURI() ) { directory = g_path_get_dirname( doc->getURI() ); } - if (directory == NULL) { - directory = Inkscape::IO::Resource::homedir_path(NULL); + if (directory == nullptr) { + directory = Inkscape::IO::Resource::homedir_path(nullptr); } gchar *filepath = g_build_filename(directory, basename, NULL); g_free(directory); @@ -3698,7 +3698,7 @@ void ObjectSet::createBitmapCopy() unsigned height =(unsigned) floor(bbox->height() * Inkscape::Util::Quantity::convert(res, "px", "in")); // Find out if we have to run an external filter - gchar const *run = NULL; + gchar const *run = nullptr; Glib::ustring filter = prefs->getString("/options/createbitmap/filter"); if (!filter.empty()) { // filter command is given; @@ -3708,7 +3708,7 @@ void ObjectSet::createBitmapCopy() if (param1[param1.length() - 1] == '%') { // if the param string ends with %, interpret it as a percentage of the image's max dimension gchar p1[256]; - g_ascii_dtostr(p1, 256, ceil(g_ascii_strtod(param1.data(), NULL) * MAX(width, height) / 100)); + g_ascii_dtostr(p1, 256, ceil(g_ascii_strtod(param1.data(), nullptr) * MAX(width, height) / 100)); // the first param is always the image filename, the second is param1 run = g_strdup_printf("%s \"%s\" %s", filter.data(), filepath, p1); } else { @@ -3748,7 +3748,7 @@ void ObjectSet::createBitmapCopy() bbox->max()[Geom::X], bbox->max()[Geom::Y], width, height, res, res, (guint32) 0xffffff00, - NULL, NULL, + nullptr, nullptr, true, /*bool force_overwrite,*/ items_); @@ -4054,7 +4054,7 @@ void ObjectSet::setClipGroup() Inkscape::GC::release(group); } - gchar const *mask_id = NULL; + gchar const *mask_id = nullptr; if (apply_clip_path) { mask_id = SPClipPath::create(mask_items_dup, doc); } else { @@ -4121,7 +4121,7 @@ void ObjectSet::unsetMask(const bool apply_clip_path, const bool skip_undo) { if (remove_original) { // remember referenced mask/clippath, so orphaned masks can be moved back to document SPItem *item = *i; - Inkscape::URIReference *uri_ref = NULL; + Inkscape::URIReference *uri_ref = nullptr; if (apply_clip_path) { uri_ref = item->clip_ref; @@ -4130,7 +4130,7 @@ void ObjectSet::unsetMask(const bool apply_clip_path, const bool skip_undo) { } // collect distinct mask object (and associate with item to apply transform) - if ((NULL != uri_ref) && (NULL != uri_ref->getObject())) { + if ((nullptr != uri_ref) && (nullptr != uri_ref->getObject())) { referenced_objects[uri_ref->getObject()] = item; } } @@ -4161,10 +4161,10 @@ void ObjectSet::unsetMask(const bool apply_clip_path, const bool skip_undo) { copy->setAttribute("d", copy->attribute("inkscape:original-d")); } else if (copy->attribute("inkscape:original-d")) { copy->setAttribute("d", copy->attribute("inkscape:original-d")); - copy->setAttribute("inkscape:original-d", NULL); + copy->setAttribute("inkscape:original-d", nullptr); } else if (!copy->attribute("inkscape:path-effect") && !SP_IS_PATH(&child)) { - copy->setAttribute("d", NULL); - copy->setAttribute("inkscape:original-d", NULL); + copy->setAttribute("d", nullptr); + copy->setAttribute("inkscape:original-d", nullptr); } items_to_move.push_back(copy); } @@ -4227,7 +4227,7 @@ void ObjectSet::unsetMask(const bool apply_clip_path, const bool skip_undo) { */ bool ObjectSet::fitCanvas(bool with_margins, bool skip_undo) { - g_return_val_if_fail(document() != NULL, false); + g_return_val_if_fail(document() != nullptr, false); if (isEmpty()) { if(desktop()) @@ -4248,7 +4248,7 @@ bool ObjectSet::fitCanvas(bool with_margins, bool skip_undo) void ObjectSet::swapFillStroke() { - if (desktop() == NULL) { + if (desktop() == nullptr) { return; } @@ -4323,7 +4323,7 @@ void ObjectSet::swapFillStroke() bool fit_canvas_to_drawing(SPDocument *doc, bool with_margins) { - g_return_val_if_fail(doc != NULL, false); + g_return_val_if_fail(doc != nullptr, false); doc->ensureUpToDate(); SPItem const *const root = doc->getRoot(); @@ -4351,11 +4351,11 @@ verb_fit_canvas_to_drawing(SPDesktop *desktop) * ui/dialog/page-sizer. */ void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) { - g_return_if_fail(desktop != NULL); + g_return_if_fail(desktop != nullptr); SPDocument *doc = desktop->getDocument(); - g_return_if_fail(doc != NULL); - g_return_if_fail(desktop->selection != NULL); + g_return_if_fail(doc != nullptr); + g_return_if_fail(desktop->selection != nullptr); bool const changed = ( desktop->selection->isEmpty() ? fit_canvas_to_drawing(doc, true) diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index caa83fb94..9cc7c0928 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -112,7 +112,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select _context.set(Inkscape::NORMAL_MESSAGE, _when_nothing); } else { SPItem *item = items[0]; - g_assert(item != NULL); + g_assert(item != nullptr); SPObject *layer = selection->layers()->layerForObject(item); SPObject *root = selection->layers()->currentRoot(); @@ -143,7 +143,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select // Parent name SPObject *parent = item->parent; gchar const *parent_label = parent->getId(); - gchar *parent_name = NULL; + gchar *parent_name = nullptr; if (parent_label) { char *quoted_parent_label = xml_quote_strdup(parent_label); parent_name = g_strdup_printf(_("<i>%s</i>"), quoted_parent_label); @@ -175,7 +175,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select if (items.size()==1) { // one item char *item_desc = item->detailedDescription(); - bool isUse = dynamic_cast<SPUse *>(item) != NULL; + bool isUse = dynamic_cast<SPUse *>(item) != nullptr; if (isUse && dynamic_cast<SPSymbol *>(item->firstChild())) { _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", item_desc, in_phrase, @@ -185,7 +185,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select item_desc, in_phrase, _("Remove from symbols tray to edit symbol")); } else { - SPOffset *offset = (isUse) ? NULL : dynamic_cast<SPOffset *>(item); + SPOffset *offset = (isUse) ? nullptr : dynamic_cast<SPOffset *>(item); if (isUse || (offset && offset->sourceHref)) { _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", item_desc, in_phrase, @@ -224,7 +224,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select g_free(terms); // indicate all, some, or none filtered - gchar *filt_str = NULL; + gchar *filt_str = nullptr; int n_filt = count_filtered(items); //all filtered if (n_filt) { filt_str = g_strdup_printf(ngettext("; <i>%d filtered object</i> ", @@ -236,11 +236,11 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s%s. %s.", objects_str, filt_str, in_phrase, _when_selected); if (objects_str) { g_free(objects_str); - objects_str = 0; + objects_str = nullptr; } if (filt_str) { g_free(filt_str); - filt_str = 0; + filt_str = nullptr; } } diff --git a/src/selection.cpp b/src/selection.cpp index f17b2efb1..66c960953 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -41,14 +41,14 @@ namespace Inkscape { Selection::Selection(LayerModel *layers, SPDesktop *desktop): ObjectSet(desktop), _layers(layers), - _selection_context(NULL), + _selection_context(nullptr), _flags(0), _idle(0) { } Selection::~Selection() { - _layers = NULL; + _layers = nullptr; if (_idle) { g_source_remove(_idle); _idle = 0; @@ -60,7 +60,7 @@ Selection::~Selection() { void Selection::_schedule_modified(SPObject */*obj*/, guint flags) { if (!this->_idle) { /* Request handling to be run in _idle loop */ - this->_idle = g_idle_add_full(SP_SELECTION_UPDATE_PRIORITY, GSourceFunc(&Selection::_emit_modified), this, NULL); + this->_idle = g_idle_add_full(SP_SELECTION_UPDATE_PRIORITY, GSourceFunc(&Selection::_emit_modified), this, nullptr); } /* Collect all flags */ @@ -87,9 +87,9 @@ void Selection::_emitModified(guint flags) { void Selection::_emitChanged(bool persist_selection_context/* = false */) { if (persist_selection_context) { - if (NULL == _selection_context) { + if (nullptr == _selection_context) { _selection_context = _layers->currentLayer(); - sp_object_ref(_selection_context, NULL); + sp_object_ref(_selection_context, nullptr); _context_release_connection = _selection_context->connectRelease(sigc::mem_fun(*this, &Selection::_releaseContext)); } } else { @@ -102,17 +102,17 @@ void Selection::_emitChanged(bool persist_selection_context/* = false */) { void Selection::_releaseContext(SPObject *obj) { - if (NULL == _selection_context || _selection_context != obj) + if (nullptr == _selection_context || _selection_context != obj) return; _context_release_connection.disconnect(); - sp_object_unref(_selection_context, NULL); - _selection_context = NULL; + sp_object_unref(_selection_context, nullptr); + _selection_context = nullptr; } SPObject *Selection::activeContext() { - if (NULL != _selection_context) + if (nullptr != _selection_context) return _selection_context; return _layers->currentLayer(); } @@ -120,7 +120,7 @@ SPObject *Selection::activeContext() { std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPoints(SnapPreferences const *snapprefs) const { std::vector<Inkscape::SnapCandidatePoint> p; - if (snapprefs != NULL){ + if (snapprefs != nullptr){ SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs snapprefs_dummy.setTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER, false); // locally disable snapping to the item center auto items = const_cast<Selection *>(this)->items(); @@ -140,11 +140,11 @@ std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPoints(SnapPreferenc } SPObject *Selection::_objectForXMLNode(Inkscape::XML::Node *repr) const { - g_return_val_if_fail(repr != NULL, NULL); + g_return_val_if_fail(repr != nullptr, NULL); gchar const *id = repr->attribute("id"); - g_return_val_if_fail(id != NULL, NULL); + g_return_val_if_fail(id != nullptr, NULL); SPObject *object=_layers->getDocument()->getObjectById(id); - g_return_val_if_fail(object != NULL, NULL); + g_return_val_if_fail(object != nullptr, NULL); return object; } @@ -194,7 +194,7 @@ Selection::setBackup () { SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDocument *document = SP_ACTIVE_DOCUMENT; - Inkscape::UI::Tools::NodeTool *tool = 0; + Inkscape::UI::Tools::NodeTool *tool = nullptr; if (desktop) { Inkscape::UI::Tools::ToolBase *ec = desktop->event_context; if (INK_IS_NODE_TOOL(ec)) { @@ -257,7 +257,7 @@ Selection::restoreBackup() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDocument *document = SP_ACTIVE_DOCUMENT; - Inkscape::UI::Tools::NodeTool *tool = 0; + Inkscape::UI::Tools::NodeTool *tool = nullptr; if (desktop) { Inkscape::UI::Tools::ToolBase *ec = desktop->event_context; if (INK_IS_NODE_TOOL(ec)) { diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 0a341bf83..5c7482530 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -121,7 +121,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _snap_bbox_type = !prefs_bbox ? SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX; - g_return_if_fail(desktop != NULL); + g_return_if_fail(desktop != nullptr); _updateVolatileState(); _current_relative_affine.setIdentity(); @@ -187,26 +187,26 @@ Inkscape::SelTrans::~SelTrans() for (int i = 0; i < NUMHANDS; i++) { knot_unref(knots[i]); - knots[i] = NULL; + knots[i] = nullptr; } if (_norm) { sp_canvas_item_destroy(_norm); - _norm = NULL; + _norm = nullptr; } if (_grip) { sp_canvas_item_destroy(_grip); - _grip = NULL; + _grip = nullptr; } for (int i = 0; i < 4; i++) { if (_l[i]) { sp_canvas_item_destroy(_l[i]); - _l[i] = NULL; + _l[i] = nullptr; } } for (unsigned i = 0; i < _items.size(); i++) { - sp_object_unref(_items[i], NULL); + sp_object_unref(_items[i], nullptr); } _items.clear(); @@ -271,7 +271,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s auto items= _desktop->selection->items(); for (auto iter=items.begin();iter!=items.end(); ++iter) { - SPItem *it = static_cast<SPItem*>(sp_object_ref(*iter, NULL)); + SPItem *it = static_cast<SPItem*>(sp_object_ref(*iter, nullptr)); _items.push_back(it); _items_const.push_back(it); _items_affines.push_back(it->i2dt_affine()); @@ -424,7 +424,7 @@ void Inkscape::SelTrans::ungrab() _updateVolatileState(); for (unsigned i = 0; i < _items.size(); i++) { - sp_object_unref(_items[i], NULL); + sp_object_unref(_items[i], nullptr); } sp_canvas_item_hide(_norm); diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index 5c2aa3e39..2f83133dc 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -66,16 +66,16 @@ sp_shortcut_invoke(unsigned int shortcut, Inkscape::UI::View::View *view) if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); return true; } } return false; } -static std::map<unsigned int, Inkscape::Verb * > *verbs = NULL; -static std::map<Inkscape::Verb *, unsigned int> *primary_shortcuts = NULL; -static std::map<Inkscape::Verb *, unsigned int> *user_shortcuts = NULL; +static std::map<unsigned int, Inkscape::Verb * > *verbs = nullptr; +static std::map<Inkscape::Verb *, unsigned int> *primary_shortcuts = nullptr; +static std::map<Inkscape::Verb *, unsigned int> *user_shortcuts = nullptr; void sp_shortcut_init() { @@ -254,7 +254,7 @@ void sp_shortcuts_delete_all_from_file() { char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keys file %s", filename); return; @@ -278,7 +278,7 @@ void sp_shortcuts_delete_all_from_file() { } - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); } @@ -290,10 +290,10 @@ Inkscape::XML::Document *sp_shortcut_create_template_file(char const *filename) "<keys name=\"My custom shortcuts\">" "</keys>"; - Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), NULL); - sp_repr_save_file(doc, filename, NULL); + Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), nullptr); + sp_repr_save_file(doc, filename, nullptr); - return sp_repr_read_file(filename, NULL); + return sp_repr_read_file(filename, nullptr); } /* @@ -311,7 +311,7 @@ void sp_shortcut_get_file_names(std::vector<Glib::ustring> *names, std::vector<G for(auto &filename: filenames) { Glib::ustring label = Glib::path_get_basename(filename); - XML::Document *doc = sp_repr_read_file(filename.c_str(), NULL); + XML::Document *doc = sp_repr_read_file(filename.c_str(), nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", filename.c_str()); continue; @@ -456,14 +456,14 @@ bool sp_shortcut_file_import() { void sp_shortcut_file_import_do(char const *importname) { - XML::Document *doc=sp_repr_read_file(importname, NULL); + XML::Document *doc=sp_repr_read_file(importname, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", importname); return; } char const *filename = get_path(USER, KEYS, "default.xml"); - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); @@ -474,13 +474,13 @@ void sp_shortcut_file_export_do(char const *exportname) { char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", filename); return; } - sp_repr_save_file(doc, exportname, NULL); + sp_repr_save_file(doc, exportname, nullptr); GC::release(doc); } @@ -498,7 +498,7 @@ void sp_shortcut_delete_from_file(char const * /*action*/, unsigned int const sh char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", filename); return; @@ -556,7 +556,7 @@ void sp_shortcut_delete_from_file(char const * /*action*/, unsigned int const sh iter = iter->next(); } - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); @@ -566,7 +566,7 @@ void sp_shortcut_add_to_file(char const *action, unsigned int const shortcut) { char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s, creating ....", filename); doc = sp_shortcut_create_template_file(filename); @@ -611,13 +611,13 @@ void sp_shortcut_add_to_file(char const *action, unsigned int const shortcut) { doc->root()->appendChild(newnode); } - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); } static void read_shortcuts_file(char const *filename, bool const is_user_set) { - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keys file %s", filename); return; @@ -730,7 +730,7 @@ sp_shortcut_unset(unsigned int const shortcut) /* Maintain the invariant that sp_shortcut_get_primary(v) returns either 0 or a valid shortcut for v. */ if (verb) { - (*verbs)[shortcut] = 0; + (*verbs)[shortcut] = nullptr; unsigned int const old_primary = (*primary_shortcuts)[verb]; if (old_primary == shortcut) { @@ -743,7 +743,7 @@ sp_shortcut_unset(unsigned int const shortcut) GtkAccelGroup * sp_shortcut_get_accel_group() { - static GtkAccelGroup *accel_group = NULL; + static GtkAccelGroup *accel_group = nullptr; if (!accel_group) { accel_group = gtk_accel_group_new (); @@ -872,7 +872,7 @@ gchar *sp_shortcut_get_label(unsigned int shortcut) * g_object_new(GTK_TYPE_ACCEL_LABEL, NULL) followed by * gtk_label_set_text_with_mnemonic(lbl, str). */ - gchar *result = 0; + gchar *result = nullptr; if (shortcut != GDK_KEY_VoidSymbol) { result = gtk_accelerator_get_label( sp_shortcut_get_key(shortcut), diff --git a/src/snap.cpp b/src/snap.cpp index 26d548040..4ea761fe3 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -45,10 +45,10 @@ SnapManager::SnapManager(SPNamedView const *v) : snapprefs(), _named_view(v), _rotation_center_source_items(std::vector<SPItem*>()), - _guide_to_ignore(NULL), - _desktop(NULL), + _guide_to_ignore(nullptr), + _desktop(nullptr), _snapindicator(true), - _unselected_nodes(NULL) + _unselected_nodes(nullptr) { } @@ -145,7 +145,7 @@ void SnapManager::preSnap(Inkscape::SnapCandidatePoint const &p, bool to_paths_o if (_snapindicator) { _snapindicator = false; // prevent other methods from drawing a snap indicator; we want to control this here Inkscape::SnappedPoint s = freeSnap(p, Geom::OptRect(), to_paths_only); - g_assert(_desktop != NULL); + g_assert(_desktop != nullptr); if (s.getSnapped()) { _desktop->snapindicator->set_new_snaptarget(s, true); } else { @@ -183,7 +183,7 @@ Geom::Point SnapManager::multipleOfGridPitch(Geom::Point const &t, Geom::Point c Geom::Point const t_offset = t + grid->origin; IntermSnapResults isr; // Only the first three parameters are being used for grid snappers - snapper->freeSnap(isr, Inkscape::SnapCandidatePoint(t_offset, Inkscape::SNAPSOURCE_GRID_PITCH),Geom::OptRect(), NULL, NULL); + snapper->freeSnap(isr, Inkscape::SnapCandidatePoint(t_offset, Inkscape::SNAPSOURCE_GRID_PITCH),Geom::OptRect(), nullptr, nullptr); // Find the best snap for this grid, including intersections of the grid-lines bool old_val = _snapindicator; _snapindicator = false; @@ -407,7 +407,7 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point &origin_or_vector, b IntermSnapResults isr; SnapperList snappers = getSnappers(); for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { - (*i)->freeSnap(isr, candidate, Geom::OptRect(), NULL, NULL); + (*i)->freeSnap(isr, candidate, Geom::OptRect(), nullptr, nullptr); } Inkscape::SnappedPoint const s = findBestSnap(candidate, isr, false); @@ -435,7 +435,7 @@ void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) SnapperList snappers = getSnappers(); for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { - (*i)->constrainedSnap(isr, candidate, Geom::OptRect(), cl, NULL, NULL); + (*i)->constrainedSnap(isr, candidate, Geom::OptRect(), cl, nullptr, nullptr); } Inkscape::SnappedPoint const s = findBestSnap(candidate, isr, false); @@ -488,7 +488,7 @@ Inkscape::SnappedPoint SnapManager::findBestSnap(Inkscape::SnapCandidatePoint co bool allowOffScreen, bool to_path_only) const { - g_assert(_desktop != NULL); + g_assert(_desktop != nullptr); /* std::cout << "Type and number of snapped constraints: " << std::endl; @@ -658,8 +658,8 @@ void SnapManager::setup(SPDesktop const *desktop, std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes, SPGuide *guide_to_ignore) { - g_assert(desktop != NULL); - if (_desktop != NULL) { + g_assert(desktop != nullptr); + if (_desktop != nullptr) { g_warning("The snapmanager has been set up before, but unSetup() hasn't been called afterwards. It possibly held invalid pointers"); } _items_to_ignore.clear(); @@ -677,8 +677,8 @@ void SnapManager::setup(SPDesktop const *desktop, std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes, SPGuide *guide_to_ignore) { - g_assert(desktop != NULL); - if (_desktop != NULL) { + g_assert(desktop != nullptr); + if (_desktop != nullptr) { g_warning("The snapmanager has been set up before, but unSetup() hasn't been called afterwards. It possibly held invalid pointers"); } _items_to_ignore = items_to_ignore; @@ -695,8 +695,8 @@ void SnapManager::setupIgnoreSelection(SPDesktop const *desktop, std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes, SPGuide *guide_to_ignore) { - g_assert(desktop != NULL); - if (_desktop != NULL) { + g_assert(desktop != nullptr); + if (_desktop != nullptr) { // Someone has been naughty here! This is dangerous g_warning("The snapmanager has been set up before, but unSetup() hasn't been called afterwards. It possibly held invalid pointers"); } @@ -779,7 +779,7 @@ void SnapManager::displaySnapsource(Inkscape::SnapCandidatePoint const &p) const bool p_is_a_bbox = t & Inkscape::SNAPSOURCE_BBOX_CATEGORY; bool p_is_other = (t & Inkscape::SNAPSOURCE_OTHERS_CATEGORY) || (t & Inkscape::SNAPSOURCE_DATUMS_CATEGORY); - g_assert(_desktop != NULL); + g_assert(_desktop != nullptr); if (snapprefs.getSnapEnabledGlobally() && (p_is_other || (p_is_a_node && snapprefs.isTargetSnappable(Inkscape::SNAPTARGET_NODE_CATEGORY)) || (p_is_a_bbox && snapprefs.isTargetSnappable(Inkscape::SNAPTARGET_BBOX_CATEGORY)))) { _desktop->snapindicator->set_new_snapsource(p); } else { diff --git a/src/snap.h b/src/snap.h index 2d84b889c..18865935e 100644 --- a/src/snap.h +++ b/src/snap.h @@ -112,9 +112,9 @@ public: */ void setup(SPDesktop const *desktop, bool snapindicator = true, - SPItem const *item_to_ignore = NULL, - std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = NULL, - SPGuide *guide_to_ignore = NULL); + SPItem const *item_to_ignore = nullptr, + std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = nullptr, + SPGuide *guide_to_ignore = nullptr); /** * Prepare the snap manager for the actual snapping, which includes building a list of snap targets @@ -134,18 +134,18 @@ public: void setup(SPDesktop const *desktop, bool snapindicator, std::vector<SPItem const *> &items_to_ignore, - std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = NULL, - SPGuide *guide_to_ignore = NULL); + std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = nullptr, + SPGuide *guide_to_ignore = nullptr); void setupIgnoreSelection(SPDesktop const *desktop, bool snapindicator = true, - std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = NULL, - SPGuide *guide_to_ignore = NULL); + std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = nullptr, + SPGuide *guide_to_ignore = nullptr); void unSetup() {_rotation_center_source_items.clear(); - _guide_to_ignore = NULL; - _desktop = NULL; - _unselected_nodes = NULL;} + _guide_to_ignore = nullptr; + _desktop = nullptr; + _unselected_nodes = nullptr;} // If we're dragging a rotation center, then setRotationCenterSource() stores the parent item // of this rotation center; this reference is used to make sure that we do not snap a rotation diff --git a/src/snapped-curve.cpp b/src/snapped-curve.cpp index 1f6165813..38c2b6855 100644 --- a/src/snapped-curve.cpp +++ b/src/snapped-curve.cpp @@ -39,7 +39,7 @@ Inkscape::SnappedCurve::SnappedCurve() _distance = Geom::infinity(); _tolerance = 1; _always_snap = false; - _curve = NULL; + _curve = nullptr; _second_distance = Geom::infinity(); _second_tolerance = 1; _second_always_snap = false; diff --git a/src/snapper.cpp b/src/snapper.cpp index 5ef619c0b..2223d7609 100644 --- a/src/snapper.cpp +++ b/src/snapper.cpp @@ -23,7 +23,7 @@ Inkscape::Snapper::Snapper(SnapManager *sm, Geom::Coord const /*t*/) : _snap_enabled(true), _snap_visible_only(true) { - g_assert(_snapmanager != NULL); + g_assert(_snapmanager != nullptr); } /** diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp index 641585d6f..2b0c94afa 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -125,12 +125,12 @@ GdkCursor *sp_cursor_from_xpm(char const *const *xpm, guint32 fill, guint32 stro } #endif - pixbuf = gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, NULL); + pixbuf = gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, nullptr); } else { pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)xpm); } - if (pixbuf != NULL) { + if (pixbuf != nullptr) { cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, hot_x, hot_y); g_object_unref(pixbuf); } else { diff --git a/src/sp-guide-attachment.h b/src/sp-guide-attachment.h index 98b3d7bc9..b135a1b93 100644 --- a/src/sp-guide-attachment.h +++ b/src/sp-guide-attachment.h @@ -10,7 +10,7 @@ public: public: SPGuideAttachment() : - item(static_cast<SPItem *>(0)), + item(static_cast<SPItem *>(nullptr)), snappoint_ix(0) { } diff --git a/src/sp-guide-constraint.h b/src/sp-guide-constraint.h index 29f47f45a..a3dc68259 100644 --- a/src/sp-guide-constraint.h +++ b/src/sp-guide-constraint.h @@ -10,7 +10,7 @@ public: public: explicit SPGuideConstraint() : - g(static_cast<SPGuide *>(0)), + g(static_cast<SPGuide *>(nullptr)), snappoint_ix(0) { } diff --git a/src/sp-item-notify-moveto.cpp b/src/sp-item-notify-moveto.cpp index 52a76e55f..567b30a39 100644 --- a/src/sp-item-notify-moveto.cpp +++ b/src/sp-item-notify-moveto.cpp @@ -30,7 +30,7 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin return_if_fail( dir_lensq != 0 ); std::vector<Inkscape::SnapCandidatePoint> snappoints; - item.getSnappoints(snappoints, NULL); + item.getSnappoints(snappoints, nullptr); return_if_fail( snappoint_ix < int(snappoints.size()) ); double const pos0 = dot(dir, snappoints[snappoint_ix].getPoint()); diff --git a/src/splivarot.cpp b/src/splivarot.cpp index d8c5d929f..08cf9584a 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -139,7 +139,7 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat Shape *theShape = new Shape; Path *res = new Path; res->SetBackData(false); - Path::cut_position *toCut=NULL; + Path::cut_position *toCut=nullptr; int nbToCut=0; if ( bop == bool_op_inters || bop == bool_op_union || bop == bool_op_diff || bop == bool_op_symdiff ) { @@ -269,8 +269,8 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat } } - int* nesting=NULL; - int* conts=NULL; + int* nesting=nullptr; + int* conts=nullptr; int nbNest=0; // pour compenser le swap juste avant if ( bop == bool_op_slice ) { @@ -372,7 +372,7 @@ BoolOpErrors Inkscape::ObjectSet::pathBoolOp(bool_op bop, const bool skip_undo, Inkscape::XML::Node *a = il.front()->getRepr(); Inkscape::XML::Node *b = il.back()->getRepr(); - if (a == NULL || b == NULL) { + if (a == nullptr || b == nullptr) { return ERR_Z_ORDER; } @@ -386,7 +386,7 @@ BoolOpErrors Inkscape::ObjectSet::pathBoolOp(bool_op bop, const bool skip_undo, // objects are not in parent/child relationship; // find their lowest common ancestor Inkscape::XML::Node *parent = LCA(a, b); - if (parent == NULL) { + if (parent == nullptr) { return ERR_Z_ORDER; } @@ -436,7 +436,7 @@ BoolOpErrors Inkscape::ObjectSet::pathBoolOp(bool_op bop, const bool skip_undo, } SPCSSAttr *css = sp_repr_css_attr(reinterpret_cast<SPObject *>(il[0])->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) { origWind[curOrig]= fill_nonZero; } else if (val && strcmp(val, "evenodd") == 0) { @@ -446,7 +446,7 @@ BoolOpErrors Inkscape::ObjectSet::pathBoolOp(bool_op bop, const bool skip_undo, } originaux[curOrig] = Path_for_item(*l, true, true); - if (originaux[curOrig] == NULL || originaux[curOrig]->descr_cmd.size() <= 1) + if (originaux[curOrig] == nullptr || originaux[curOrig]->descr_cmd.size() <= 1) { for (int i = curOrig; i >= 0; i--) delete originaux[i]; return DONE_NO_ACTION; @@ -469,7 +469,7 @@ BoolOpErrors Inkscape::ObjectSet::pathBoolOp(bool_op bop, const bool skip_undo, Shape *theShape = new Shape; Path *res = new Path; res->SetBackData(false); - Path::cut_position *toCut=NULL; + Path::cut_position *toCut=nullptr; int nbToCut=0; if ( bop == bool_op_inters || bop == bool_op_union || bop == bool_op_diff || bop == bool_op_symdiff ) { @@ -650,8 +650,8 @@ BoolOpErrors Inkscape::ObjectSet::pathBoolOp(bool_op bop, const bool skip_undo, } } - int* nesting=NULL; - int* conts=NULL; + int* nesting=nullptr; + int* conts=nullptr; int nbNest=0; // pour compenser le swap juste avant if ( bop == bool_op_slice ) { @@ -938,7 +938,7 @@ void item_outline_add_marker( SPObject const *marker_object, Geom::Affine marker */ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only) { - Geom::PathVector *ret_pathv = NULL; + Geom::PathVector *ret_pathv = nullptr; if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) { return ret_pathv; @@ -949,13 +949,13 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only) return ret_pathv; } - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE(item)) { curve = SP_SHAPE(item)->getCurve(); } else if (SP_IS_TEXT(item)) { curve = SP_TEXT(item)->getNormalizedBpath(); } - if (curve == NULL) { + if (curve == nullptr) { return ret_pathv; } @@ -1183,19 +1183,19 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) return did; - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE(item)) { curve = SP_SHAPE(item)->getCurve(); - if (curve == NULL) + if (curve == nullptr) return did; } if (SP_IS_TEXT(item)) { curve = SP_TEXT(item)->getNormalizedBpath(); - if (curve == NULL) + if (curve == nullptr) return did; } - g_assert(curve != NULL); + g_assert(curve != nullptr); if (curve->get_pathvector().empty()) { return did; @@ -1217,16 +1217,16 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) // (i.e., properties defined in style sheet or by attributes). // Stroke - SPCSSAttr *ncss = 0; + SPCSSAttr *ncss = nullptr; { ncss = sp_css_attr_from_style(i_style, SP_STYLE_FLAG_ALWAYS | SP_STYLE_FLAG_IFSRC); - gchar const *s_val = sp_repr_css_property(ncss, "stroke", NULL); - gchar const *s_opac = sp_repr_css_property(ncss, "stroke-opacity", NULL); - opacity = sp_repr_css_property(ncss, "opacity", NULL); - filter = sp_repr_css_property(ncss, "filter", NULL); + gchar const *s_val = sp_repr_css_property(ncss, "stroke", nullptr); + gchar const *s_opac = sp_repr_css_property(ncss, "stroke-opacity", nullptr); + opacity = sp_repr_css_property(ncss, "opacity", nullptr); + filter = sp_repr_css_property(ncss, "filter", nullptr); sp_repr_css_set_property(ncss, "stroke", "none"); - sp_repr_css_set_property(ncss, "filter", NULL); - sp_repr_css_set_property(ncss, "opacity", NULL); + sp_repr_css_set_property(ncss, "filter", nullptr); + sp_repr_css_set_property(ncss, "opacity", nullptr); sp_repr_css_set_property(ncss, "stroke-opacity", "1.0"); sp_repr_css_set_property(ncss, "fill", s_val); if ( s_opac ) { @@ -1240,13 +1240,13 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) } // Fill - SPCSSAttr *ncsf = 0; + SPCSSAttr *ncsf = nullptr; { ncsf = sp_css_attr_from_style(i_style, SP_STYLE_FLAG_ALWAYS | SP_STYLE_FLAG_IFSRC); sp_repr_css_set_property(ncsf, "stroke", "none"); sp_repr_css_set_property(ncsf, "stroke-opacity", "1.0"); - sp_repr_css_set_property(ncsf, "filter", NULL); - sp_repr_css_set_property(ncsf, "opacity", NULL); + sp_repr_css_set_property(ncsf, "filter", nullptr); + sp_repr_css_set_property(ncsf, "opacity", nullptr); sp_repr_css_unset_property(ncsf, "marker-start"); sp_repr_css_unset_property(ncsf, "marker-mid"); sp_repr_css_unset_property(ncsf, "marker-end"); @@ -1260,7 +1260,7 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) Path *orig = new Path; Path *res = new Path; SPCurve *curvetemp = curve_for_item(item); - if (curvetemp == NULL) { + if (curvetemp == nullptr) { curve->unref(); return did; } @@ -1379,7 +1379,7 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether //The stroke - Inkscape::XML::Node *stroke = NULL; + Inkscape::XML::Node *stroke = nullptr; if( !item->style->stroke.noneSet ){ SPDocument * doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); @@ -1409,7 +1409,7 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) g_repr->setPosition(pos > 0 ? pos : 0); //The fill - Inkscape::XML::Node *fill = NULL; + Inkscape::XML::Node *fill = nullptr; if (!legacy) { // gchar const *f_val = sp_repr_css_property(ncsf, "fill", NULL); if( !item->style->fill.noneSet ){ @@ -1441,7 +1441,7 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) SPShape *shape = SP_SHAPE(item); Geom::PathVector const & pathv = curve->get_pathvector(); - Inkscape::XML::Node *markers = NULL; + Inkscape::XML::Node *markers = nullptr; if(SP_SHAPE(item)->hasMarkers ()) { if (!legacy) { markers = xml_doc->createElement("svg:g"); @@ -1528,7 +1528,7 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) } } - gchar const *paint_order = sp_repr_css_property(ncss, "paint-order", NULL); + gchar const *paint_order = sp_repr_css_property(ncss, "paint-order", nullptr); SPIPaintOrder temp; temp.read( paint_order ); bool unique = false; @@ -1620,7 +1620,7 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) did = true; } - Inkscape::XML::Node *out = NULL; + Inkscape::XML::Node *out = nullptr; if (!fill && !markers && did) { out = stroke; } else if (!fill && !stroke && did) { @@ -1661,11 +1661,11 @@ sp_item_path_outline(SPItem *item, SPDesktop *desktop, bool legacy) if (title) { g_free(title); - title = 0; + title = nullptr; } if (desc) { g_free(desc); - desc = 0; + desc = nullptr; } delete res; @@ -1765,11 +1765,11 @@ void sp_selected_path_create_updating_inset(SPDesktop *desktop) void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updating) { - SPCurve *curve = NULL; + SPCurve *curve = nullptr; Inkscape::Selection *selection = desktop->getSelection(); SPItem *item = selection->singleItem(); - if (item == NULL || ( !SP_IS_SHAPE(item) && !SP_IS_TEXT(item) ) ) { + if (item == nullptr || ( !SP_IS_SHAPE(item) && !SP_IS_TEXT(item) ) ) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Selected object is <b>not a path</b>, cannot inset/outset.")); return; } @@ -1782,7 +1782,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool curve = SP_TEXT(item)->getNormalizedBpath(); } - if (curve == NULL) { + if (curve == nullptr) { return; } @@ -1812,7 +1812,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool } Path *orig = Path_for_item(item, true, false); - if (orig == NULL) + if (orig == nullptr) { g_free(style); curve->unref(); @@ -1830,7 +1830,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool 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); @@ -1884,7 +1884,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool gchar *str = res->svg_dump_path(); repr->setAttribute("inkscape:original", str); g_free(str); - str = 0; + str = nullptr; if ( updating ) { @@ -1895,7 +1895,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool repr->setAttribute("xlink:href", uri); g_free((void *) uri); } else { - repr->setAttribute("inkscape:href", NULL); + repr->setAttribute("inkscape:href", nullptr); } repr->setAttribute("style", style); @@ -1962,7 +1962,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) std::vector<SPItem*> il(selection->items().begin(), selection->items().end()); for (std::vector<SPItem*>::const_iterator l = il.begin(); l != il.end(); l++){ SPItem *item = *l; - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item) && !SP_IS_FLOWTEXT(item)) continue; @@ -1976,7 +1976,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) curve = SP_TEXT(item)->getNormalizedBpath(); } - if (curve == NULL) + if (curve == nullptr) continue; Geom::Affine const transform(item->transform); @@ -2014,7 +2014,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) } Path *orig = Path_for_item(item, false); - if (orig == NULL) { + if (orig == nullptr) { g_free(style); curve->unref(); continue; @@ -2031,7 +2031,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) 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); @@ -2178,7 +2178,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, // get path to simplify (note that the path *before* LPE calculation is needed) Path *orig = Path_for_item_before_LPE(item, false); - if (orig == NULL) { + if (orig == nullptr) { return false; } @@ -2437,7 +2437,7 @@ sp_selected_path_simplify(SPDesktop *desktop) bool Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who) { - if (who == NULL || a == NULL) + if (who == nullptr || a == nullptr) return false; if (who == a) return true; @@ -2464,8 +2464,8 @@ Path_for_item(SPItem *item, bool doTransformation, bool transformFull) { SPCurve *curve = curve_for_item(item); - if (curve == NULL) - return NULL; + if (curve == nullptr) + return nullptr; Geom::PathVector *pathv = pathvector_for_curve(item, curve, doTransformation, transformFull, Geom::identity(), Geom::identity()); curve->unref(); @@ -2497,8 +2497,8 @@ Path_for_item_before_LPE(SPItem *item, bool doTransformation, bool transformFull { SPCurve *curve = curve_for_item_before_LPE(item); - if (curve == NULL) - return NULL; + if (curve == nullptr) + return nullptr; Geom::PathVector *pathv = pathvector_for_curve(item, curve, doTransformation, transformFull, Geom::identity(), Geom::identity()); curve->unref(); @@ -2517,8 +2517,8 @@ Path_for_item_before_LPE(SPItem *item, bool doTransformation, bool transformFull Geom::PathVector* pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull, Geom::Affine extraPreAffine, Geom::Affine extraPostAffine) { - if (curve == NULL) - return NULL; + if (curve == nullptr) + return nullptr; Geom::PathVector *dest = new Geom::PathVector; *dest = curve->get_pathvector(); // Make a copy; must be freed by the caller! @@ -2543,9 +2543,9 @@ pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool t SPCurve* curve_for_item(SPItem *item) { if (!item) - return NULL; + return nullptr; - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE(item)) { if (SP_IS_PATH(item)) { curve = SP_PATH(item)->getCurveForEdit(); @@ -2572,9 +2572,9 @@ SPCurve* curve_for_item(SPItem *item) SPCurve* curve_for_item_before_LPE(SPItem *item) { if (!item) - return NULL; + return nullptr; - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (SP_IS_SHAPE(item)) { curve = SP_SHAPE(item)->getCurveForEdit(); } diff --git a/src/style-enums.h b/src/style-enums.h index 4ea656794..24ebda5d1 100644 --- a/src/style-enums.h +++ b/src/style-enums.h @@ -322,28 +322,28 @@ struct SPStyleEnum { static SPStyleEnum const enum_fill_rule[] = { {"nonzero", SP_WIND_RULE_NONZERO}, {"evenodd", SP_WIND_RULE_EVENODD}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_stroke_linecap[] = { {"butt", SP_STROKE_LINECAP_BUTT}, {"round", SP_STROKE_LINECAP_ROUND}, {"square", SP_STROKE_LINECAP_SQUARE}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_stroke_linejoin[] = { {"miter", SP_STROKE_LINEJOIN_MITER}, {"round", SP_STROKE_LINEJOIN_ROUND}, {"bevel", SP_STROKE_LINEJOIN_BEVEL}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_style[] = { {"normal", SP_CSS_FONT_STYLE_NORMAL}, {"italic", SP_CSS_FONT_STYLE_ITALIC}, {"oblique", SP_CSS_FONT_STYLE_OBLIQUE}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_size[] = { @@ -356,13 +356,13 @@ static SPStyleEnum const enum_font_size[] = { {"xx-large", SP_CSS_FONT_SIZE_XX_LARGE}, {"smaller", SP_CSS_FONT_SIZE_SMALLER}, {"larger", SP_CSS_FONT_SIZE_LARGER}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_variant[] = { {"normal", SP_CSS_FONT_VARIANT_NORMAL}, {"small-caps", SP_CSS_FONT_VARIANT_SMALL_CAPS}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_weight[] = { @@ -379,7 +379,7 @@ static SPStyleEnum const enum_font_weight[] = { {"bold", SP_CSS_FONT_WEIGHT_BOLD}, {"lighter", SP_CSS_FONT_WEIGHT_LIGHTER}, {"bolder", SP_CSS_FONT_WEIGHT_BOLDER}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_stretch[] = { @@ -394,7 +394,7 @@ static SPStyleEnum const enum_font_stretch[] = { {"ultra-expanded", SP_CSS_FONT_STRETCH_ULTRA_EXPANDED}, {"narrower", SP_CSS_FONT_STRETCH_NARROWER}, {"wider", SP_CSS_FONT_STRETCH_WIDER}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_variant_ligatures[] = { @@ -408,14 +408,14 @@ static SPStyleEnum const enum_font_variant_ligatures[] = { {"no-discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NODISCRETIONARY}, {"no-historical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NOHISTORICAL}, {"no-contextual", SP_CSS_FONT_VARIANT_LIGATURES_NOCONTEXTUAL}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_variant_position[] = { {"normal", SP_CSS_FONT_VARIANT_POSITION_NORMAL}, {"sub", SP_CSS_FONT_VARIANT_POSITION_SUB}, {"super", SP_CSS_FONT_VARIANT_POSITION_SUPER}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_variant_caps[] = { @@ -426,7 +426,7 @@ static SPStyleEnum const enum_font_variant_caps[] = { {"all-petite-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE}, {"unicase", SP_CSS_FONT_VARIANT_CAPS_UNICASE}, {"titling", SP_CSS_FONT_VARIANT_CAPS_TITLING}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_variant_numeric[] = { @@ -439,7 +439,7 @@ static SPStyleEnum const enum_font_variant_numeric[] = { {"stacked-fractions", SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS}, {"ordinal", SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL}, {"slashed-zero", SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_variant_alternates[] = { @@ -451,7 +451,7 @@ static SPStyleEnum const enum_font_variant_alternates[] = { {"swash", SP_CSS_FONT_VARIANT_ALTERNATES_SWASH}, {"ornaments", SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS}, {"annotation", SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_font_variant_east_asian[] = { @@ -465,7 +465,7 @@ static SPStyleEnum const enum_font_variant_east_asian[] = { {"full-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH}, {"proportional-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH}, {"ruby", SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_text_align[] = { @@ -475,7 +475,7 @@ static SPStyleEnum const enum_text_align[] = { {"right", SP_CSS_TEXT_ALIGN_RIGHT}, {"center", SP_CSS_TEXT_ALIGN_CENTER}, {"justify", SP_CSS_TEXT_ALIGN_JUSTIFY}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_text_transform[] = { @@ -483,14 +483,14 @@ static SPStyleEnum const enum_text_transform[] = { {"uppercase", SP_CSS_TEXT_TRANSFORM_UPPERCASE}, {"lowercase", SP_CSS_TEXT_TRANSFORM_LOWERCASE}, {"none", SP_CSS_TEXT_TRANSFORM_NONE}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_text_anchor[] = { {"start", SP_CSS_TEXT_ANCHOR_START}, {"middle", SP_CSS_TEXT_ANCHOR_MIDDLE}, {"end", SP_CSS_TEXT_ANCHOR_END}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_white_space[] = { @@ -499,13 +499,13 @@ static SPStyleEnum const enum_white_space[] = { {"nowrap", SP_CSS_WHITE_SPACE_NOWRAP }, {"pre-wrap", SP_CSS_WHITE_SPACE_PREWRAP}, {"pre-line", SP_CSS_WHITE_SPACE_PRELINE}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_direction[] = { {"ltr", SP_CSS_DIRECTION_LTR}, {"rtl", SP_CSS_DIRECTION_RTL}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_writing_mode[] = { @@ -527,7 +527,7 @@ static SPStyleEnum const enum_writing_mode[] = { {"horizontal-tb", SP_CSS_WRITING_MODE_LR_TB}, // This is correct, 'direction' distinguishes between 'lr' and 'rl'. {"vertical-rl", SP_CSS_WRITING_MODE_TB_RL}, {"vertical-lr", SP_CSS_WRITING_MODE_TB_LR}, - {NULL, -1} + {nullptr, -1} }; // CSS WRITING MODES 3 @@ -535,7 +535,7 @@ static SPStyleEnum const enum_text_orientation[] = { {"mixed", SP_CSS_TEXT_ORIENTATION_MIXED}, // Default {"upright", SP_CSS_TEXT_ORIENTATION_UPRIGHT}, {"sideways", SP_CSS_TEXT_ORIENTATION_SIDEWAYS}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_baseline[] = { @@ -548,21 +548,21 @@ static SPStyleEnum const enum_baseline[] = { {"middle", SP_CSS_BASELINE_MIDDLE}, {"text-before-edge", SP_CSS_BASELINE_TEXT_BEFORE_EDGE}, {"text-after-edge", SP_CSS_BASELINE_TEXT_AFTER_EDGE}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_baseline_shift[] = { {"baseline", SP_CSS_BASELINE_SHIFT_BASELINE}, {"sub", SP_CSS_BASELINE_SHIFT_SUB}, {"super", SP_CSS_BASELINE_SHIFT_SUPER}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_visibility[] = { {"hidden", SP_CSS_VISIBILITY_HIDDEN}, {"collapse", SP_CSS_VISIBILITY_COLLAPSE}, {"visible", SP_CSS_VISIBILITY_VISIBLE}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_overflow[] = { @@ -570,14 +570,14 @@ static SPStyleEnum const enum_overflow[] = { {"hidden", SP_CSS_OVERFLOW_HIDDEN}, {"scroll", SP_CSS_OVERFLOW_SCROLL}, {"auto", SP_CSS_OVERFLOW_AUTO}, - {NULL, -1} + {nullptr, -1} }; // CSS Compositing and Blending Level 1 static SPStyleEnum const enum_isolation[] = { {"auto", SP_CSS_ISOLATION_AUTO}, {"isolate", SP_CSS_ISOLATION_ISOLATE}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_blend_mode[] = { @@ -597,7 +597,7 @@ static SPStyleEnum const enum_blend_mode[] = { {"saturation", SP_CSS_BLEND_SATURATION}, {"color", SP_CSS_BLEND_COLOR}, {"luminosity", SP_CSS_BLEND_LUMINOSITY}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_display[] = { @@ -618,7 +618,7 @@ static SPStyleEnum const enum_display[] = { {"table-column", SP_CSS_DISPLAY_TABLE_COLUMN}, {"table-cell", SP_CSS_DISPLAY_TABLE_CELL}, {"table-caption", SP_CSS_DISPLAY_TABLE_CAPTION}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_shape_rendering[] = { @@ -626,14 +626,14 @@ static SPStyleEnum const enum_shape_rendering[] = { {"optimizeSpeed", SP_CSS_SHAPE_RENDERING_OPTIMIZESPEED}, {"crispEdges", SP_CSS_SHAPE_RENDERING_CRISPEDGES}, {"geometricPrecision", SP_CSS_SHAPE_RENDERING_GEOMETRICPRECISION}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_color_rendering[] = { {"auto", SP_CSS_COLOR_RENDERING_AUTO}, {"optimizeSpeed", SP_CSS_COLOR_RENDERING_OPTIMIZESPEED}, {"optimizeQuality", SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_image_rendering[] = { @@ -642,7 +642,7 @@ static SPStyleEnum const enum_image_rendering[] = { {"optimizeQuality", SP_CSS_IMAGE_RENDERING_OPTIMIZEQUALITY}, {"crisp-edges", SP_CSS_IMAGE_RENDERING_CRISPEDGES}, {"pixelated", SP_CSS_IMAGE_RENDERING_PIXELATED}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_text_rendering[] = { @@ -650,32 +650,32 @@ static SPStyleEnum const enum_text_rendering[] = { {"optimizeSpeed", SP_CSS_TEXT_RENDERING_OPTIMIZESPEED}, {"optimizeLegibility", SP_CSS_TEXT_RENDERING_OPTIMIZELEGIBILITY}, {"geometricPrecision", SP_CSS_TEXT_RENDERING_GEOMETRICPRECISION}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_enable_background[] = { {"accumulate", SP_CSS_BACKGROUND_ACCUMULATE}, {"new", SP_CSS_BACKGROUND_NEW}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_clip_rule[] = { {"nonzero", SP_WIND_RULE_NONZERO}, {"evenodd", SP_WIND_RULE_EVENODD}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_color_interpolation[] = { {"auto", SP_CSS_COLOR_INTERPOLATION_AUTO}, {"sRGB", SP_CSS_COLOR_INTERPOLATION_SRGB}, {"linearRGB", SP_CSS_COLOR_INTERPOLATION_LINEARRGB}, - {NULL, -1} + {nullptr, -1} }; static SPStyleEnum const enum_vector_effect[] = { {"none", SP_VECTOR_EFFECT_NONE}, {"non-scaling-stroke", SP_VECTOR_EFFECT_NON_SCALING_STROKE}, - {NULL, -1} + {nullptr, -1} }; diff --git a/src/style-internal.cpp b/src/style-internal.cpp index 6178b30b4..f1d672fce 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -408,7 +408,7 @@ SPILength::merge( const SPIBase* const parent ) { switch (p->unit) { case SP_CSS_UNIT_EM: case SP_CSS_UNIT_EX: - g_assert( &style->font_size != NULL && &p->style->font_size != NULL ); + g_assert( &style->font_size != nullptr && &p->style->font_size != nullptr ); value *= p->style->font_size.computed / style->font_size.computed; /** \todo * FIXME: Have separate ex ratio parameter. @@ -1142,7 +1142,7 @@ SPIString::read( gchar const *str ) { if (!strcmp(str, "inherit")) { set = true; inherit = true; - value = NULL; + value = nullptr; } else { set = true; inherit = false; @@ -1197,7 +1197,7 @@ void SPIString::clear() { SPIBase::clear(); g_free( value ); - value = NULL; + value = nullptr; if( value_default ) value = strdup( value_default ); } @@ -1230,8 +1230,8 @@ SPIString::merge( const SPIBase* const parent ) { bool SPIString::operator==(const SPIBase& rhs) { if( const SPIString* r = dynamic_cast<const SPIString*>(&rhs) ) { - if( value == NULL && r->value == NULL ) return (SPIBase::operator==(rhs)); - if( value == NULL || r->value == NULL ) return false; + if( value == nullptr && r->value == nullptr ) return (SPIBase::operator==(rhs)); + if( value == nullptr || r->value == nullptr ) return false; return (strcmp(value, r->value) == 0 && SPIBase::operator==(rhs)); } else { @@ -1378,7 +1378,7 @@ SPIPaint::~SPIPaint() { if( value.href ) { clear(); delete value.href; - value.href = NULL; + value.href = nullptr; } } @@ -1418,13 +1418,13 @@ SPIPaint::read( gchar const *str ) { // FIXME: THE FOLLOWING CODE SHOULD BE PUT IN A PRIVATE FUNCTION FOR REUSE gchar *uri = extract_uri( str, &str ); - if(uri == NULL || uri[0] == '\0') { + if(uri == nullptr || uri[0] == '\0') { std::cerr << "SPIPaint::read: url is empty or invalid" << std::endl; } else if (!style ) { std::cerr << "SPIPaint::read: url with empty SPStyle pointer" << std::endl; } else { set = true; - SPDocument *document = (style->object) ? style->object->document : NULL; + SPDocument *document = (style->object) ? style->object->document : nullptr; // Create href if not done already if (!value.href && document) { @@ -1483,7 +1483,7 @@ SPIPaint::read( gchar const *str ) { SVGICCColor* tmp = new SVGICCColor(); if ( ! sp_svg_read_icc_color( str, &str, tmp ) ) { delete tmp; - tmp = 0; + tmp = nullptr; } value.color.icc = tmp; } @@ -1676,7 +1676,7 @@ SPIPaint::operator==(const SPIBase& rhs) { } if ( this->isPaintserver() ) { - if( this->value.href == NULL || r->value.href == NULL || + if( this->value.href == nullptr || r->value.href == nullptr || this->value.href->getObject() != r->value.href->getObject() ) { return false; } @@ -1863,7 +1863,7 @@ SPIFilter::~SPIFilter() { if( href ) { clear(); delete href; - href = NULL; + href = nullptr; } } @@ -1881,7 +1881,7 @@ SPIFilter::read( gchar const *str ) { set = true; } else if (strneq(str, "url", 3)) { gchar *uri = extract_uri(str); - if(uri == NULL || uri[0] == '\0') { + if(uri == nullptr || uri[0] == '\0') { std::cerr << "SPIFilter::read: url is empty or invalid" << std::endl; return; } else if (!style) { @@ -2036,7 +2036,7 @@ SPIDashArray::read( gchar const *str ) { // std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("[,\\s]+", str ); - gchar *e = NULL; + gchar *e = nullptr; bool LineSolid = true; while (e != str && *str != '\0') { /* TODO: Should allow <length> rather than just a unitless (px) number. */ @@ -2576,7 +2576,7 @@ void SPIBaselineShift::cascade( const SPIBase* const parent ) { if( const SPIBaselineShift* p = dynamic_cast<const SPIBaselineShift*>(parent) ) { SPIFontSize *pfont_size = &(p->style->font_size); - g_assert( pfont_size != NULL ); + g_assert( pfont_size != nullptr ); if( !set || inherit ) { computed = p->computed; // Shift relative to parent shift, corrected below @@ -3050,7 +3050,7 @@ SPITextDecoration::write( guint const flags, SPStyleSrc const &style_src_req, SP void SPITextDecoration::cascade( const SPIBase* const parent ) { if( const SPITextDecoration* p = dynamic_cast<const SPITextDecoration*>(parent) ) { - if( style_td == NULL ) { + if( style_td == nullptr ) { style_td = p->style_td; } } else { @@ -3062,7 +3062,7 @@ SPITextDecoration::cascade( const SPIBase* const parent ) { void SPITextDecoration::merge( const SPIBase* const parent ) { if( const SPITextDecoration* p = dynamic_cast<const SPITextDecoration*>(parent) ) { - if( style_td == NULL ) { + if( style_td == nullptr ) { style_td = p->style_td; } } else { diff --git a/src/style-internal.h b/src/style-internal.h index 504aa73db..a34c07501 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -132,7 +132,7 @@ public: inherit(false), important(false), style_src(SP_STYLE_SRC_STYLE_PROP), // Default to property, see bug 1662285. - style(NULL) + style(nullptr) {} virtual ~SPIBase() @@ -182,7 +182,7 @@ public: virtual const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const = 0; + SPIBase const *const base = nullptr ) const = 0; virtual void clear() { set = false, inherit = false, important = false; } @@ -249,7 +249,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); value = value_default; @@ -331,7 +331,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); value = value_default; @@ -404,7 +404,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); unit = SP_CSS_UNIT_NONE, value = value_default; @@ -461,7 +461,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPILength::clear(); normal = true; @@ -509,7 +509,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); axes.clear(); @@ -549,7 +549,7 @@ class SPIEnum : public SPIBase public: SPIEnum() : SPIBase( "anonymous_enum" ), - enums( NULL ), + enums( nullptr ), value(0), computed(0) {} @@ -579,7 +579,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); value = value_default, computed = computed_default; @@ -621,7 +621,7 @@ class SPIEnumBits : public SPIEnum public: SPIEnumBits() : - SPIEnum( "anonymous_enumbits", NULL ) + SPIEnum( "anonymous_enumbits", nullptr ) {} SPIEnumBits( Glib::ustring const &name, SPStyleEnum const *enums, unsigned value = 0, bool inherits = true ) : @@ -634,7 +634,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; }; @@ -648,7 +648,7 @@ class SPILigatures : public SPIEnum public: SPILigatures() : - SPIEnum( "anonymous_enumligatures", NULL ) + SPIEnum( "anonymous_enumligatures", nullptr ) {} SPILigatures( Glib::ustring const &name, SPStyleEnum const *enums) : @@ -661,7 +661,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; }; @@ -672,7 +672,7 @@ class SPINumeric : public SPIEnum public: SPINumeric() : - SPIEnum( "anonymous_enumnumeric", NULL ) + SPIEnum( "anonymous_enumnumeric", nullptr ) {} SPINumeric( Glib::ustring const &name, SPStyleEnum const *enums) : @@ -685,7 +685,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; }; @@ -696,7 +696,7 @@ class SPIEastAsian : public SPIEnum public: SPIEastAsian() : - SPIEnum( "anonymous_enumeastasian", NULL ) + SPIEnum( "anonymous_enumeastasian", nullptr ) {} SPIEastAsian( Glib::ustring const &name, SPStyleEnum const *enums) : @@ -709,7 +709,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; }; @@ -721,14 +721,14 @@ class SPIString : public SPIBase public: SPIString() : SPIBase( "anonymous_string" ), - value(NULL) + value(nullptr) {} // TODO probably want to avoid gchar* and c-style strings. - SPIString( Glib::ustring const &name, gchar const* value_default_in = NULL ) + SPIString( Glib::ustring const &name, gchar const* value_default_in = nullptr ) : SPIBase( name ), - value(NULL), - value_default(value_default_in ? g_strdup(value_default_in) : NULL) + value(nullptr), + value_default(value_default_in ? g_strdup(value_default_in) : nullptr) {} ~SPIString() override { @@ -739,7 +739,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override; // TODO check about value and value_default void cascade( const SPIBase* const parent ) override; void merge( const SPIBase* const parent ) override; @@ -748,8 +748,8 @@ public: SPIBase::operator=(rhs); g_free(value); g_free(value_default); - value = rhs.value ? g_strdup(rhs.value) : NULL; - value_default = rhs.value_default ? g_strdup(rhs.value_default) : NULL; + value = rhs.value ? g_strdup(rhs.value) : nullptr; + value_default = rhs.value_default ? g_strdup(rhs.value_default) : nullptr; return *this; } @@ -787,7 +787,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); value.color.set(0); @@ -852,7 +852,7 @@ public: paintOrigin( SP_CSS_PAINT_ORIGIN_NORMAL ), colorSet(false), noneSet(false) { - value.href = NULL; + value.href = nullptr; clear(); } @@ -860,16 +860,16 @@ public: : SPIBase( name ), colorSet(false), noneSet(false) { - value.href = NULL; + value.href = nullptr; clear(); // Sets defaults } ~SPIPaint() override; // Clear and delete href. void read( gchar const *str ) override; - virtual void read( gchar const *str, SPStyle &style, SPDocument *document = 0); + virtual void read( gchar const *str, SPStyle &style, SPDocument *document = nullptr); const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override; virtual void reset( bool init ); // Used internally when reading or cascading void cascade( const SPIBase* const parent ) override; @@ -907,7 +907,7 @@ public: } bool isPaintserver() const { - return (value.href) ? value.href->getObject() : 0; + return (value.href) ? value.href->getObject() : nullptr; } void setColor( float r, float g, float b ) { @@ -958,7 +958,7 @@ class SPIPaintOrder : public SPIBase public: SPIPaintOrder() : SPIBase( "paint-order" ), - value(NULL) { + value(nullptr) { this->clear(); } @@ -969,7 +969,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); for( unsigned i = 0; i < PAINT_ORDER_LAYERS; ++i ) { @@ -977,7 +977,7 @@ public: layer_set[i] = false; } g_free(value); - value = NULL; + value = nullptr; } void cascade( const SPIBase* const parent ) override; void merge( const SPIBase* const parent ) override; @@ -1022,7 +1022,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); values.clear(); @@ -1055,14 +1055,14 @@ class SPIFilter : public SPIBase public: SPIFilter() : SPIBase( "filter", false ), - href(NULL) + href(nullptr) {} ~SPIFilter() override; void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override; void cascade( const SPIBase* const parent ) override; void merge( const SPIBase* const parent ) override; @@ -1107,7 +1107,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); type = SP_FONT_SIZE_LITERAL, unit = SP_CSS_UNIT_NONE, @@ -1164,7 +1164,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); } @@ -1209,7 +1209,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); type=SP_BASELINE_SHIFT_LITERAL, unit=SP_CSS_UNIT_NONE, @@ -1266,7 +1266,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); underline = false, overline = false, line_through = false, blink = false; @@ -1314,7 +1314,7 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); solid = true, isdouble = false, dotted = false, dashed = false, wavy = false; @@ -1362,7 +1362,7 @@ class SPITextDecoration : public SPIBase public: SPITextDecoration() : SPIBase( "text-decoration" ), - style_td( NULL ) + style_td( nullptr ) {} ~SPITextDecoration() override @@ -1371,10 +1371,10 @@ public: void read( gchar const *str ) override; const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPIBase const *const base = NULL ) const override; + SPIBase const *const base = nullptr ) const override; void clear() override { SPIBase::clear(); - style_td = NULL; + style_td = nullptr; } void cascade( const SPIBase* const parent ) override; diff --git a/src/style.cpp b/src/style.cpp index ae3b86d1c..aba98a498 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -549,17 +549,17 @@ SPStyle::clear() { fill_ps_modified_connection.disconnect(); if (fill.value.href) { delete fill.value.href; - fill.value.href = NULL; + fill.value.href = nullptr; } stroke_ps_modified_connection.disconnect(); if (stroke.value.href) { delete stroke.value.href; - stroke.value.href = NULL; + stroke.value.href = nullptr; } filter_modified_connection.disconnect(); if (filter.href) { delete filter.href; - filter.href = NULL; + filter.href = nullptr; } if (document) { @@ -585,7 +585,7 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) { // << (object?(object->getId()?object->getId():"id null"):"object null") << " " // << (repr?(repr->name()?repr->name():"no name"):"repr null") // << std::endl; - g_assert(repr != NULL); + g_assert(repr != nullptr); g_assert(!object || (object->getRepr() == repr)); // // Uncomment to verify that we don't need to call clear. @@ -603,7 +603,7 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) { /* 1. Style attribute */ // std::cout << " MERGING STYLE ATTRIBUTE" << std::endl; gchar const *val = repr->attribute("style"); - if( val != NULL && *val ) { + if( val != nullptr && *val ) { _mergeString( val ); } @@ -643,7 +643,7 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) { // std::cout << "SPStyle::read(): reading via repr->parent()" << std::endl; if( repr->parent() ) { SPStyle *parent = new SPStyle(); - parent->read( NULL, repr->parent() ); + parent->read( nullptr, repr->parent() ); cascade( parent ); delete parent; } @@ -662,11 +662,11 @@ SPStyle::readFromObject( SPObject *object ) { // std::cout << "SPStyle::readFromObject: "<< (object->getId()?object->getId():"null")<< std::endl; - g_return_if_fail(object != NULL); + g_return_if_fail(object != nullptr); g_return_if_fail(SP_IS_OBJECT(object)); Inkscape::XML::Node *repr = object->getRepr(); - g_return_if_fail(repr != NULL); + g_return_if_fail(repr != nullptr); read( object, repr ); } @@ -692,7 +692,7 @@ SPStyle::readFromPrefs(Glib::ustring const &path) { tempnode->setAttribute(i->getEntryName().data(), i->getString().data()); } - read( NULL, tempnode ); + read( nullptr, tempnode ); Inkscape::GC::release(tempnode); Inkscape::GC::release(tempdoc); @@ -706,7 +706,7 @@ SPStyle::readIfUnset( gint id, gchar const *val, SPStyleSrc const &source ) { // std::cout << "SPStyle::readIfUnset: Entrance: " << id << ": " << (val?val:"null") << std::endl; // To Do: If it is not too slow, use std::map instead of std::vector inorder to remove switch() // (looking up SP_PROP_xxxx already uses a hash). - g_return_if_fail(val != NULL); + g_return_if_fail(val != nullptr); switch (id) { case SP_ATTR_D: @@ -1044,10 +1044,10 @@ SPStyle::write( guint const flags, SPStyleSrc const &style_src_req, SPStyle cons Glib::ustring style_string; for(std::vector<SPIBase*>::size_type i = 0; i != _properties.size(); ++i) { - if( base != NULL ) { + if( base != nullptr ) { style_string += _properties[i]->write( flags, style_src_req, base->_properties[i] ); } else { - style_string += _properties[i]->write( flags, style_src_req, NULL ); + style_string += _properties[i]->write( flags, style_src_req, nullptr ); } } // for(SPPropMap::iterator i = _propmap.begin(); i != _propmap.end(); ++i ) { @@ -1203,7 +1203,7 @@ SPStyle::_mergeProps( CRPropList *const props ) { // In reverse order, as later declarations to take precedence over earlier ones. if (props) { _mergeProps( cr_prop_list_get_next( props ) ); - CRDeclaration *decl = NULL; + CRDeclaration *decl = nullptr; cr_prop_list_get_decl(props, &decl); _mergeDecl( decl, SP_STYLE_SRC_STYLE_SHEET ); } @@ -1214,12 +1214,12 @@ SPStyle::_mergeObjectStylesheet( SPObject const *const object ) { // std::cout << "SPStyle::_mergeObjectStylesheet: " << (object->getId()?object->getId():"null") << std::endl; - static CRSelEng *sel_eng = NULL; + static CRSelEng *sel_eng = nullptr; if (!sel_eng) { sel_eng = sp_repr_sel_eng(); } - CRPropList *props = NULL; + CRPropList *props = nullptr; //XML Tree being directly used here while it shouldn't be. CRStatus status = cr_sel_eng_get_matched_properties_from_cascade(sel_eng, @@ -1328,7 +1328,7 @@ static void sp_style_object_release(SPObject *object, SPStyle *style) { (void)object; // TODO - style->object = NULL; + style->object = nullptr; } // Internal @@ -1448,7 +1448,7 @@ sp_style_stroke_paint_server_ref_changed(SPObject *old_ref, SPObject *ref, SPSty SPStyle * sp_style_ref(SPStyle *style) { - g_return_val_if_fail(style != NULL, NULL); + g_return_val_if_fail(style != nullptr, NULL); style->style_ref(); // Increase ref count @@ -1462,10 +1462,10 @@ sp_style_ref(SPStyle *style) SPStyle * sp_style_unref(SPStyle *style) { - g_return_val_if_fail(style != NULL, NULL); + g_return_val_if_fail(style != nullptr, NULL); if (style->style_unref() < 1) { delete style; - return NULL; + return nullptr; } return style; } @@ -1627,7 +1627,7 @@ sp_style_set_property_url (SPObject *item, gchar const *property, SPObject *link { Inkscape::XML::Node *repr = item->getRepr(); - if (repr == NULL) return; + if (repr == nullptr) return; SPCSSAttr *css = sp_repr_css_attr_new(); if (linked) { @@ -1668,124 +1668,124 @@ sp_style_unset_property_attrs(SPObject *o) } if (style->opacity.set) { - repr->setAttribute("opacity", NULL); + repr->setAttribute("opacity", nullptr); } if (style->color.set) { - repr->setAttribute("color", NULL); + repr->setAttribute("color", nullptr); } if (style->color_interpolation.set) { - repr->setAttribute("color-interpolation", NULL); + repr->setAttribute("color-interpolation", nullptr); } if (style->color_interpolation_filters.set) { - repr->setAttribute("color-interpolation-filters", NULL); + repr->setAttribute("color-interpolation-filters", nullptr); } if (style->solid_color.set) { - repr->setAttribute("solid-color", NULL); + repr->setAttribute("solid-color", nullptr); } if (style->solid_opacity.set) { - repr->setAttribute("solid-opacity", NULL); + repr->setAttribute("solid-opacity", nullptr); } if (style->vector_effect.set) { - repr->setAttribute("vector-effect", NULL); + repr->setAttribute("vector-effect", nullptr); } if (style->fill.set) { - repr->setAttribute("fill", NULL); + repr->setAttribute("fill", nullptr); } if (style->fill_opacity.set) { - repr->setAttribute("fill-opacity", NULL); + repr->setAttribute("fill-opacity", nullptr); } if (style->fill_rule.set) { - repr->setAttribute("fill-rule", NULL); + repr->setAttribute("fill-rule", nullptr); } if (style->stroke.set) { - repr->setAttribute("stroke", NULL); + repr->setAttribute("stroke", nullptr); } if (style->stroke_width.set) { - repr->setAttribute("stroke-width", NULL); + repr->setAttribute("stroke-width", nullptr); } if (style->stroke_linecap.set) { - repr->setAttribute("stroke-linecap", NULL); + repr->setAttribute("stroke-linecap", nullptr); } if (style->stroke_linejoin.set) { - repr->setAttribute("stroke-linejoin", NULL); + repr->setAttribute("stroke-linejoin", nullptr); } if (style->marker.set) { - repr->setAttribute("marker", NULL); + repr->setAttribute("marker", nullptr); } if (style->marker_start.set) { - repr->setAttribute("marker-start", NULL); + repr->setAttribute("marker-start", nullptr); } if (style->marker_mid.set) { - repr->setAttribute("marker-mid", NULL); + repr->setAttribute("marker-mid", nullptr); } if (style->marker_end.set) { - repr->setAttribute("marker-end", NULL); + repr->setAttribute("marker-end", nullptr); } if (style->stroke_opacity.set) { - repr->setAttribute("stroke-opacity", NULL); + repr->setAttribute("stroke-opacity", nullptr); } if (style->stroke_dasharray.set) { - repr->setAttribute("stroke-dasharray", NULL); + repr->setAttribute("stroke-dasharray", nullptr); } if (style->stroke_dashoffset.set) { - repr->setAttribute("stroke-dashoffset", NULL); + repr->setAttribute("stroke-dashoffset", nullptr); } if (style->paint_order.set) { - repr->setAttribute("paint-order", NULL); + repr->setAttribute("paint-order", nullptr); } if (style->font_specification.set) { - repr->setAttribute("-inkscape-font-specification", NULL); + repr->setAttribute("-inkscape-font-specification", nullptr); } if (style->font_family.set) { - repr->setAttribute("font-family", NULL); + repr->setAttribute("font-family", nullptr); } if (style->text_anchor.set) { - repr->setAttribute("text-anchor", NULL); + repr->setAttribute("text-anchor", nullptr); } if (style->white_space.set) { - repr->setAttribute("white-space", NULL); + repr->setAttribute("white-space", nullptr); } if (style->shape_inside.set) { - repr->setAttribute("shape-inside", NULL); + repr->setAttribute("shape-inside", nullptr); } if (style->shape_subtract.set) { - repr->setAttribute("shape-subtract", NULL); + repr->setAttribute("shape-subtract", nullptr); } if (style->shape_padding.set) { - repr->setAttribute("shape-padding", NULL); + repr->setAttribute("shape-padding", nullptr); } if (style->shape_margin.set) { - repr->setAttribute("shape-margin", NULL); + repr->setAttribute("shape-margin", nullptr); } if (style->inline_size.set) { - repr->setAttribute("inline-size", NULL); + repr->setAttribute("inline-size", nullptr); } if (style->writing_mode.set) { - repr->setAttribute("writing-mode", NULL); + repr->setAttribute("writing-mode", nullptr); } if (style->text_orientation.set) { - repr->setAttribute("text-orientation", NULL); + repr->setAttribute("text-orientation", nullptr); } if (style->filter.set) { - repr->setAttribute("filter", NULL); + repr->setAttribute("filter", nullptr); } if (style->enable_background.set) { - repr->setAttribute("enable-background", NULL); + repr->setAttribute("enable-background", nullptr); } if (style->clip_rule.set) { - repr->setAttribute("clip-rule", NULL); + repr->setAttribute("clip-rule", nullptr); } if (style->color_rendering.set) { - repr->setAttribute("color-rendering", NULL); + repr->setAttribute("color-rendering", nullptr); } if (style->image_rendering.set) { - repr->setAttribute("image-rendering", NULL); + repr->setAttribute("image-rendering", nullptr); } if (style->shape_rendering.set) { - repr->setAttribute("shape-rendering", NULL); + repr->setAttribute("shape-rendering", nullptr); } if (style->text_rendering.set) { - repr->setAttribute("text-rendering", NULL); + repr->setAttribute("text-rendering", nullptr); } } @@ -1797,7 +1797,7 @@ sp_style_unset_property_attrs(SPObject *o) SPCSSAttr * sp_css_attr_from_style(SPStyle const *const style, guint const flags) { - g_return_val_if_fail(style != NULL, NULL); + g_return_val_if_fail(style != nullptr, NULL); g_return_val_if_fail(((flags & SP_STYLE_FLAG_IFSET) || (flags & SP_STYLE_FLAG_ALWAYS)), NULL); @@ -1818,7 +1818,7 @@ SPCSSAttr *sp_css_attr_from_object(SPObject *object, guint const flags) g_return_val_if_fail(((flags == SP_STYLE_FLAG_IFSET) || (flags == SP_STYLE_FLAG_ALWAYS) ), NULL); - SPCSSAttr * result = 0; + SPCSSAttr * result = nullptr; if (object->style) { result = sp_css_attr_from_style(object->style, flags); } @@ -1832,48 +1832,48 @@ SPCSSAttr *sp_css_attr_from_object(SPObject *object, guint const flags) SPCSSAttr * sp_css_attr_unset_text(SPCSSAttr *css) { - sp_repr_css_set_property(css, "font", NULL); - sp_repr_css_set_property(css, "-inkscape-font-specification", NULL); - sp_repr_css_set_property(css, "font-size", NULL); - sp_repr_css_set_property(css, "font-size-adjust", NULL); // not implemented yet - sp_repr_css_set_property(css, "font-style", NULL); - sp_repr_css_set_property(css, "font-variant", NULL); - sp_repr_css_set_property(css, "font-weight", NULL); - sp_repr_css_set_property(css, "font-stretch", NULL); - sp_repr_css_set_property(css, "font-family", NULL); - sp_repr_css_set_property(css, "text-indent", NULL); - sp_repr_css_set_property(css, "text-align", NULL); - sp_repr_css_set_property(css, "line-height", NULL); - sp_repr_css_set_property(css, "letter-spacing", NULL); - sp_repr_css_set_property(css, "word-spacing", NULL); - sp_repr_css_set_property(css, "text-transform", NULL); - sp_repr_css_set_property(css, "direction", NULL); - sp_repr_css_set_property(css, "writing-mode", NULL); - sp_repr_css_set_property(css, "text-orientation", NULL); - sp_repr_css_set_property(css, "text-anchor", NULL); - sp_repr_css_set_property(css, "white-space", NULL); - sp_repr_css_set_property(css, "shape-inside", NULL); - sp_repr_css_set_property(css, "shape-subtract", NULL); - sp_repr_css_set_property(css, "shape-padding", NULL); - sp_repr_css_set_property(css, "shape-margin", NULL); - sp_repr_css_set_property(css, "inline-size", NULL); - sp_repr_css_set_property(css, "kerning", NULL); // not implemented yet - sp_repr_css_set_property(css, "dominant-baseline", NULL); // not implemented yet - sp_repr_css_set_property(css, "alignment-baseline", NULL); // not implemented yet - sp_repr_css_set_property(css, "baseline-shift", NULL); - - sp_repr_css_set_property(css, "text-decoration", NULL); - sp_repr_css_set_property(css, "text-decoration-line", NULL); - sp_repr_css_set_property(css, "text-decoration-color", NULL); - sp_repr_css_set_property(css, "text-decoration-style", NULL); - - sp_repr_css_set_property(css, "font-variant-ligatures", NULL); - sp_repr_css_set_property(css, "font-variant-position", NULL); - sp_repr_css_set_property(css, "font-variant-caps", NULL); - sp_repr_css_set_property(css, "font-variant-numeric", NULL); - sp_repr_css_set_property(css, "font-variant-alternates", NULL); - sp_repr_css_set_property(css, "font-variant-east-asian", NULL); - sp_repr_css_set_property(css, "font-feature-settings", NULL); + sp_repr_css_set_property(css, "font", nullptr); + sp_repr_css_set_property(css, "-inkscape-font-specification", nullptr); + sp_repr_css_set_property(css, "font-size", nullptr); + sp_repr_css_set_property(css, "font-size-adjust", nullptr); // not implemented yet + sp_repr_css_set_property(css, "font-style", nullptr); + sp_repr_css_set_property(css, "font-variant", nullptr); + sp_repr_css_set_property(css, "font-weight", nullptr); + sp_repr_css_set_property(css, "font-stretch", nullptr); + sp_repr_css_set_property(css, "font-family", nullptr); + sp_repr_css_set_property(css, "text-indent", nullptr); + sp_repr_css_set_property(css, "text-align", nullptr); + sp_repr_css_set_property(css, "line-height", nullptr); + sp_repr_css_set_property(css, "letter-spacing", nullptr); + sp_repr_css_set_property(css, "word-spacing", nullptr); + sp_repr_css_set_property(css, "text-transform", nullptr); + sp_repr_css_set_property(css, "direction", nullptr); + sp_repr_css_set_property(css, "writing-mode", nullptr); + sp_repr_css_set_property(css, "text-orientation", nullptr); + sp_repr_css_set_property(css, "text-anchor", nullptr); + sp_repr_css_set_property(css, "white-space", nullptr); + sp_repr_css_set_property(css, "shape-inside", nullptr); + sp_repr_css_set_property(css, "shape-subtract", nullptr); + sp_repr_css_set_property(css, "shape-padding", nullptr); + sp_repr_css_set_property(css, "shape-margin", nullptr); + sp_repr_css_set_property(css, "inline-size", nullptr); + sp_repr_css_set_property(css, "kerning", nullptr); // not implemented yet + sp_repr_css_set_property(css, "dominant-baseline", nullptr); // not implemented yet + sp_repr_css_set_property(css, "alignment-baseline", nullptr); // not implemented yet + sp_repr_css_set_property(css, "baseline-shift", nullptr); + + sp_repr_css_set_property(css, "text-decoration", nullptr); + sp_repr_css_set_property(css, "text-decoration-line", nullptr); + sp_repr_css_set_property(css, "text-decoration-color", nullptr); + sp_repr_css_set_property(css, "text-decoration-style", nullptr); + + sp_repr_css_set_property(css, "font-variant-ligatures", nullptr); + sp_repr_css_set_property(css, "font-variant-position", nullptr); + sp_repr_css_set_property(css, "font-variant-caps", nullptr); + sp_repr_css_set_property(css, "font-variant-numeric", nullptr); + sp_repr_css_set_property(css, "font-variant-alternates", nullptr); + sp_repr_css_set_property(css, "font-variant-east-asian", nullptr); + sp_repr_css_set_property(css, "font-feature-settings", nullptr); return css; } @@ -1886,26 +1886,26 @@ sp_css_attr_unset_text(SPCSSAttr *css) SPCSSAttr * sp_css_attr_unset_blacklist(SPCSSAttr *css) { - sp_repr_css_set_property(css, "color", NULL); - sp_repr_css_set_property(css, "clip-rule", NULL); - sp_repr_css_set_property(css, "d", NULL); - sp_repr_css_set_property(css, "display", NULL); - sp_repr_css_set_property(css, "overflow", NULL); - sp_repr_css_set_property(css, "visibility", NULL); - sp_repr_css_set_property(css, "isolation", NULL); - sp_repr_css_set_property(css, "mix-blend-mode", NULL); - sp_repr_css_set_property(css, "color-interpolation", NULL); - sp_repr_css_set_property(css, "color-interpolation-filters", NULL); - sp_repr_css_set_property(css, "solid-color", NULL); - sp_repr_css_set_property(css, "solid-opacity", NULL); - sp_repr_css_set_property(css, "fill-rule", NULL); - sp_repr_css_set_property(css, "filter-blend-mode", NULL); - sp_repr_css_set_property(css, "filter-gaussianBlur-deviation", NULL); - sp_repr_css_set_property(css, "color-rendering", NULL); - sp_repr_css_set_property(css, "image-rendering", NULL); - sp_repr_css_set_property(css, "shape-rendering", NULL); - sp_repr_css_set_property(css, "text-rendering", NULL); - sp_repr_css_set_property(css, "enable-background", NULL); + sp_repr_css_set_property(css, "color", nullptr); + sp_repr_css_set_property(css, "clip-rule", nullptr); + sp_repr_css_set_property(css, "d", nullptr); + sp_repr_css_set_property(css, "display", nullptr); + sp_repr_css_set_property(css, "overflow", nullptr); + sp_repr_css_set_property(css, "visibility", nullptr); + sp_repr_css_set_property(css, "isolation", nullptr); + sp_repr_css_set_property(css, "mix-blend-mode", nullptr); + sp_repr_css_set_property(css, "color-interpolation", nullptr); + sp_repr_css_set_property(css, "color-interpolation-filters", nullptr); + sp_repr_css_set_property(css, "solid-color", nullptr); + sp_repr_css_set_property(css, "solid-opacity", nullptr); + sp_repr_css_set_property(css, "fill-rule", nullptr); + sp_repr_css_set_property(css, "filter-blend-mode", nullptr); + sp_repr_css_set_property(css, "filter-gaussianBlur-deviation", nullptr); + sp_repr_css_set_property(css, "color-rendering", nullptr); + sp_repr_css_set_property(css, "image-rendering", nullptr); + sp_repr_css_set_property(css, "shape-rendering", nullptr); + sp_repr_css_set_property(css, "text-rendering", nullptr); + sp_repr_css_set_property(css, "enable-background", nullptr); return css; } @@ -1914,7 +1914,7 @@ sp_css_attr_unset_blacklist(SPCSSAttr *css) static bool is_url(char const *p) { - if (p == NULL) + if (p == nullptr) return false; /** \todo * FIXME: I'm not sure if this applies to SVG as well, but CSS2 says any URIs @@ -1934,17 +1934,17 @@ SPCSSAttr * sp_css_attr_unset_uris(SPCSSAttr *css) { // All properties that may hold <uri> or <paint> according to SVG 1.1 - if (is_url(sp_repr_css_property(css, "clip-path", NULL))) sp_repr_css_set_property(css, "clip-path", NULL); - if (is_url(sp_repr_css_property(css, "color-profile", NULL))) sp_repr_css_set_property(css, "color-profile", NULL); - if (is_url(sp_repr_css_property(css, "cursor", NULL))) sp_repr_css_set_property(css, "cursor", NULL); - if (is_url(sp_repr_css_property(css, "filter", NULL))) sp_repr_css_set_property(css, "filter", NULL); - if (is_url(sp_repr_css_property(css, "marker", NULL))) sp_repr_css_set_property(css, "marker", NULL); - if (is_url(sp_repr_css_property(css, "marker-start", NULL))) sp_repr_css_set_property(css, "marker-start", NULL); - if (is_url(sp_repr_css_property(css, "marker-mid", NULL))) sp_repr_css_set_property(css, "marker-mid", NULL); - if (is_url(sp_repr_css_property(css, "marker-end", NULL))) sp_repr_css_set_property(css, "marker-end", NULL); - if (is_url(sp_repr_css_property(css, "mask", NULL))) sp_repr_css_set_property(css, "mask", NULL); - if (is_url(sp_repr_css_property(css, "fill", NULL))) sp_repr_css_set_property(css, "fill", NULL); - if (is_url(sp_repr_css_property(css, "stroke", NULL))) sp_repr_css_set_property(css, "stroke", NULL); + if (is_url(sp_repr_css_property(css, "clip-path", nullptr))) sp_repr_css_set_property(css, "clip-path", nullptr); + if (is_url(sp_repr_css_property(css, "color-profile", nullptr))) sp_repr_css_set_property(css, "color-profile", nullptr); + if (is_url(sp_repr_css_property(css, "cursor", nullptr))) sp_repr_css_set_property(css, "cursor", nullptr); + if (is_url(sp_repr_css_property(css, "filter", nullptr))) sp_repr_css_set_property(css, "filter", nullptr); + if (is_url(sp_repr_css_property(css, "marker", nullptr))) sp_repr_css_set_property(css, "marker", nullptr); + if (is_url(sp_repr_css_property(css, "marker-start", nullptr))) sp_repr_css_set_property(css, "marker-start", nullptr); + if (is_url(sp_repr_css_property(css, "marker-mid", nullptr))) sp_repr_css_set_property(css, "marker-mid", nullptr); + if (is_url(sp_repr_css_property(css, "marker-end", nullptr))) sp_repr_css_set_property(css, "marker-end", nullptr); + if (is_url(sp_repr_css_property(css, "mask", nullptr))) sp_repr_css_set_property(css, "mask", nullptr); + if (is_url(sp_repr_css_property(css, "fill", nullptr))) sp_repr_css_set_property(css, "fill", nullptr); + if (is_url(sp_repr_css_property(css, "stroke", nullptr))) sp_repr_css_set_property(css, "stroke", nullptr); return css; } @@ -1957,14 +1957,14 @@ static void sp_css_attr_scale_property_single(SPCSSAttr *css, gchar const *property, double ex, bool only_with_units = false) { - gchar const *w = sp_repr_css_property(css, property, NULL); + gchar const *w = sp_repr_css_property(css, property, nullptr); if (w) { - gchar *units = NULL; + gchar *units = nullptr; double wd = g_ascii_strtod(w, &units) * ex; if (w == units) {// nothing converted, non-numeric value return; } - if (only_with_units && (units == NULL || *units == '\0' || *units == '%' || *units == 'e')) { + if (only_with_units && (units == nullptr || *units == '\0' || *units == '%' || *units == 'e')) { // only_with_units, but no units found, so do nothing. // 'e' matches 'em' or 'ex' return; @@ -1982,16 +1982,16 @@ sp_css_attr_scale_property_single(SPCSSAttr *css, gchar const *property, static void sp_css_attr_scale_property_list(SPCSSAttr *css, gchar const *property, double ex) { - gchar const *string = sp_repr_css_property(css, property, NULL); + gchar const *string = sp_repr_css_property(css, property, nullptr); if (string) { Inkscape::CSSOStringStream os; gchar **a = g_strsplit(string, ",", 10000); bool first = true; - for (gchar **i = a; i != NULL; i++) { + for (gchar **i = a; i != nullptr; i++) { gchar *w = *i; - if (w == NULL) + if (w == nullptr) break; - gchar *units = NULL; + gchar *units = nullptr; double wd = g_ascii_strtod(w, &units) * ex; if (w == units) {// nothing converted, non-numeric value ("none" or "inherit"); do nothing g_strfreev(a); diff --git a/src/style.h b/src/style.h index c01f5d883..07dd329d6 100644 --- a/src/style.h +++ b/src/style.h @@ -44,7 +44,7 @@ class SPStyle { public: - SPStyle(SPDocument *document = NULL, SPObject *object = NULL);// document is ignored if valid object given + SPStyle(SPDocument *document = nullptr, SPObject *object = nullptr);// document is ignored if valid object given ~SPStyle(); void clear(); void read(SPObject *object, Inkscape::XML::Node *repr); @@ -53,7 +53,7 @@ public: void readIfUnset( int id, char const *val, SPStyleSrc const &source = SP_STYLE_SRC_STYLE_PROP ); Glib::ustring write( unsigned int const flags = SP_STYLE_FLAG_IFSET, SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, - SPStyle const *const base = NULL ) const; + SPStyle const *const base = nullptr ) const; void cascade( SPStyle const *const parent ); void merge( SPStyle const *const parent ); void mergeString( char const *const p ); @@ -307,17 +307,17 @@ public: */ sigc::signal<void, SPObject *, SPObject *> signal_stroke_ps_changed; - SPObject *getFilter() { return (filter.href) ? filter.href->getObject() : NULL; } - SPObject const *getFilter() const { return (filter.href) ? filter.href->getObject() : NULL; } - char const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : NULL; } + SPObject *getFilter() { return (filter.href) ? filter.href->getObject() : nullptr; } + SPObject const *getFilter() const { return (filter.href) ? filter.href->getObject() : nullptr; } + char const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : nullptr; } - SPPaintServer *getFillPaintServer() { return (fill.value.href) ? fill.value.href->getObject() : NULL; } - SPPaintServer const *getFillPaintServer() const { return (fill.value.href) ? fill.value.href->getObject() : NULL; } - char const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : NULL; } + SPPaintServer *getFillPaintServer() { return (fill.value.href) ? fill.value.href->getObject() : nullptr; } + SPPaintServer const *getFillPaintServer() const { return (fill.value.href) ? fill.value.href->getObject() : nullptr; } + char const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : nullptr; } - SPPaintServer *getStrokePaintServer() { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; } - SPPaintServer const *getStrokePaintServer() const { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; } - char const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : NULL; } + SPPaintServer *getStrokePaintServer() { return (stroke.value.href) ? stroke.value.href->getObject() : nullptr; } + SPPaintServer const *getStrokePaintServer() const { return (stroke.value.href) ? stroke.value.href->getObject() : nullptr; } + char const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : nullptr; } /** * Return a font feature string useful for Pango. diff --git a/src/svg-view-slideshow.cpp b/src/svg-view-slideshow.cpp index 430fd9ce5..ba59be2ef 100644 --- a/src/svg-view-slideshow.cpp +++ b/src/svg-view-slideshow.cpp @@ -52,8 +52,8 @@ SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, bool full_scr , _fullscreen(full_screen) , _timer(timer) , _scale(scale) - , _view(NULL) - , _ctrlwin(NULL) + , _view(nullptr) + , _ctrlwin(nullptr) { // setup initial document Gdk::Rectangle monitor_geometry = Inkscape::UI::get_monitor_geometry_primary(); // TODO: is inkview always launched on primary monitor? @@ -184,7 +184,7 @@ void SPSlideShow::show_next() { waiting_cursor(); - SPDocument *doc = NULL; + SPDocument *doc = nullptr; while (!doc && (_current < _slides.size() - 1)) { doc = SPDocument::createNewDoc ((_slides[++_current]).c_str(), TRUE, false); } @@ -200,7 +200,7 @@ void SPSlideShow::show_prev() { waiting_cursor(); - SPDocument *doc = NULL; + SPDocument *doc = nullptr; while (!doc && (_current > 0)) { doc = SPDocument::createNewDoc ((_slides[--_current]).c_str(), TRUE, false); } @@ -216,7 +216,7 @@ void SPSlideShow::goto_first() { waiting_cursor(); - SPDocument *doc = NULL; + SPDocument *doc = nullptr; int current = 0; while ( !doc && (current < _slides.size() - 1)) { doc = SPDocument::createNewDoc((_slides[current++]).c_str(), TRUE, false); @@ -234,7 +234,7 @@ void SPSlideShow::goto_last() { waiting_cursor(); - SPDocument *doc = NULL; + SPDocument *doc = nullptr; int current = _slides.size() - 1; while (!doc && (current >= 0)) { doc = SPDocument::createNewDoc((_slides[current--]).c_str(), TRUE, false); @@ -260,7 +260,7 @@ bool SPSlideShow::timer_callback() bool SPSlideShow::ctrlwin_delete (GdkEventAny */*event*/) { if(_ctrlwin) delete _ctrlwin; - _ctrlwin = NULL; + _ctrlwin = nullptr; return true; } diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp index 7c72686b4..fa2988166 100644 --- a/src/svg-view-widget.cpp +++ b/src/svg-view-widget.cpp @@ -70,7 +70,7 @@ static void sp_svg_view_widget_init(SPSVGSPViewWidget *vw) vw->maxheight = 400.0; /* ScrolledWindow */ - vw->sw = gtk_scrolled_window_new (NULL, NULL); + vw->sw = gtk_scrolled_window_new (nullptr, nullptr); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(vw->sw), GTK_SHADOW_NONE); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vw->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (vw), vw->sw); @@ -86,7 +86,7 @@ static void sp_svg_view_widget_init(SPSVGSPViewWidget *vw) "SPCanvas {\n" " background-color: white;\n" "}\n", - -1, NULL); + -1, nullptr); gtk_style_context_add_provider(style_context, GTK_STYLE_PROVIDER(css_provider), @@ -96,7 +96,7 @@ static void sp_svg_view_widget_init(SPSVGSPViewWidget *vw) gtk_widget_show (vw->canvas); /* View */ - parent = sp_canvas_item_new(SP_CANVAS(vw->canvas)->getRoot(), SP_TYPE_CANVAS_GROUP, NULL); + parent = sp_canvas_item_new(SP_CANVAS(vw->canvas)->getRoot(), SP_TYPE_CANVAS_GROUP, nullptr); Inkscape::UI::View::View *view = Inkscape::GC::release(new SPSVGView (SP_CANVAS_GROUP (parent))); sp_view_widget_set_view (SP_VIEW_WIDGET (vw), view); } @@ -108,7 +108,7 @@ static void sp_svg_view_widget_dispose(GObject *object) { SPSVGSPViewWidget *vw = SP_SVG_VIEW_WIDGET (object); - vw->canvas = NULL; + vw->canvas = nullptr; if (G_OBJECT_CLASS(sp_svg_view_widget_parent_class)->dispose) { G_OBJECT_CLASS(sp_svg_view_widget_parent_class)->dispose(object); @@ -208,9 +208,9 @@ GtkWidget *sp_svg_view_widget_new(SPDocument *doc) { GtkWidget *widget; - g_return_val_if_fail (doc != NULL, NULL); + g_return_val_if_fail (doc != nullptr, NULL); - widget = (GtkWidget*)g_object_new (SP_TYPE_SVG_VIEW_WIDGET, NULL); + widget = (GtkWidget*)g_object_new (SP_TYPE_SVG_VIEW_WIDGET, nullptr); reinterpret_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW (widget))->setDocument (doc); diff --git a/src/svg-view.cpp b/src/svg-view.cpp index d5ade229a..4632454e7 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -37,7 +37,7 @@ SPSVGView::SPSVGView(SPCanvasGroup *parent) _height = 0.0; _dkey = 0; - _drawing = 0; + _drawing = nullptr; _parent = parent; } @@ -46,7 +46,7 @@ SPSVGView::~SPSVGView() if (doc() && _drawing) { doc()->getRoot()->invoke_hide(_dkey); - _drawing = NULL; + _drawing = nullptr; } } @@ -118,7 +118,7 @@ void SPSVGView::mouseover() void SPSVGView::mouseout() { GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(SP_CANVAS_ITEM(_drawing)->canvas)); - gdk_window_set_cursor(window, NULL); + gdk_window_set_cursor(window, nullptr); } //---------------------------------------------------------------- @@ -132,7 +132,7 @@ static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, G static gboolean active = FALSE; SPEvent spev; - SPItem *spitem = (ai) ? (static_cast<SPItem*>(ai->data())) : 0; + SPItem *spitem = (ai) ? (static_cast<SPItem*>(ai->data())) : nullptr; switch (event->type) { case GDK_BUTTON_PRESS: @@ -147,7 +147,7 @@ static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, G if (active && (event->button.x == x) && (event->button.y == y)) { spev.type = SP_EVENT_ACTIVATE; - if ( spitem != 0 ) + if ( spitem != nullptr ) { spitem->emitEvent (spev); } @@ -161,7 +161,7 @@ static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, G case GDK_ENTER_NOTIFY: spev.type = SP_EVENT_MOUSEOVER; spev.data = svgview; - if ( spitem != 0 ) + if ( spitem != nullptr ) { spitem->emitEvent (spev); } @@ -169,7 +169,7 @@ static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, G case GDK_LEAVE_NOTIFY: spev.type = SP_EVENT_MOUSEOUT; spev.data = svgview; - if ( spitem != 0 ) + if ( spitem != nullptr ) { spitem->emitEvent (spev); } @@ -188,7 +188,7 @@ void SPSVGView::setDocument(SPDocument *document) } if (!_drawing) { - _drawing = sp_canvas_item_new (_parent, SP_TYPE_CANVAS_ARENA, NULL); + _drawing = sp_canvas_item_new (_parent, SP_TYPE_CANVAS_ARENA, nullptr); g_signal_connect (G_OBJECT (_drawing), "arena_event", G_CALLBACK (arena_handler), this); } diff --git a/src/svg/svg-affine.cpp b/src/svg/svg-affine.cpp index 76d89579d..e357a2471 100644 --- a/src/svg/svg-affine.cpp +++ b/src/svg/svg-affine.cpp @@ -33,7 +33,7 @@ sp_svg_transform_read(gchar const *str, Geom::Affine *transform) int n_args; size_t key_len; - if (str == NULL) return false; + if (str == nullptr) return false; Geom::Affine a(Geom::identity()); @@ -173,7 +173,7 @@ sp_svg_transform_write(Geom::Affine const &transform) if (transform.isIdentity()) { // We are more or less identity, so no transform attribute needed: - return NULL; + return nullptr; } else if (transform.isScale()) { // We are more or less a uniform scale strcpy (c + p, "scale("); diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index 1f26d02b1..5d8a5c448 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -210,7 +210,7 @@ static std::map<string, unsigned long> sp_svg_create_color_hash(); guint32 sp_svg_read_color(gchar const *str, guint32 const dfl) { - return sp_svg_read_color(str, NULL, dfl); + return sp_svg_read_color(str, nullptr, dfl); } static guint32 internal_sp_svg_read_color(gchar const *str, gchar const **end_ptr, guint32 def) @@ -218,7 +218,7 @@ static guint32 internal_sp_svg_read_color(gchar const *str, gchar const **end_pt static std::map<string, unsigned long> colors; guint32 val = 0; - if (str == NULL) return def; + if (str == nullptr) return def; while ((*str <= ' ') && *str) str++; if (!*str) return def; @@ -437,7 +437,7 @@ static void rgb24_to_css(char *const buf, unsigned const rgb24) * restricted set because the only component values are {00,80,ff}, other than silver 0xc0c0c0. */ - char const *src = NULL; + char const *src = nullptr; switch (rgb24) { /* Extracted mechanically from the table at * http://www.w3.org/TR/REC-html40/types.html#h-6.5 .*/ @@ -598,7 +598,7 @@ bool sp_svg_read_icc_color( gchar const *str, gchar const **end_ptr, SVGICCColor if ( good ) { while ( *str && *str != ')' ) { if ( g_ascii_isdigit(*str) || *str == '.' || *str == '-' || *str == '+') { - gchar* endPtr = 0; + gchar* endPtr = nullptr; gdouble dbl = g_ascii_strtod( str, &endPtr ); if ( !errno ) { if ( dest ) { @@ -645,7 +645,7 @@ bool sp_svg_read_icc_color( gchar const *str, gchar const **end_ptr, SVGICCColor bool sp_svg_read_icc_color( gchar const *str, SVGICCColor* dest ) { - return sp_svg_read_icc_color(str, NULL, dest); + return sp_svg_read_icc_color(str, nullptr, dest); } diff --git a/src/svg/svg-length.cpp b/src/svg/svg-length.cpp index b3468d49c..a4cf82983 100644 --- a/src/svg/svg-length.cpp +++ b/src/svg/svg-length.cpp @@ -187,7 +187,7 @@ bool SVGLength::read(gchar const *str) SVGLength::Unit u; float v; float c; - if (!sp_svg_length_read_lff(str, &u, &v, &c, NULL)) { + if (!sp_svg_length_read_lff(str, &u, &v, &c, nullptr)) { return false; } @@ -213,7 +213,7 @@ bool SVGLength::readAbsolute(gchar const *str) SVGLength::Unit u; float v; float c; - if (!sp_svg_length_read_lff(str, &u, &v, &c, NULL)) { + if (!sp_svg_length_read_lff(str, &u, &v, &c, nullptr)) { return false; } @@ -238,7 +238,7 @@ unsigned int sp_svg_length_read_computed_absolute(gchar const *str, float *lengt SVGLength::Unit unit; float computed; - if (!sp_svg_length_read_lff(str, &unit, NULL, &computed, NULL)) { + if (!sp_svg_length_read_lff(str, &unit, nullptr, &computed, nullptr)) { // failed to read return 0; } @@ -316,7 +316,7 @@ So after the number, the string does not necessarily have a \0 or a unit, it mig *computed = v; } if (next) { - *next = NULL; // no more values + *next = nullptr; // no more values } return 1; } else if (!g_ascii_isalnum(e[0])) { @@ -443,7 +443,7 @@ unsigned int sp_svg_length_read_ldd(gchar const *str, SVGLength::Unit *unit, dou { float a; float b; - unsigned int r = sp_svg_length_read_lff(str, unit, &a, &b, NULL); + unsigned int r = sp_svg_length_read_lff(str, unit, &a, &b, nullptr); if (r) { if (value) { *value = a; @@ -529,7 +529,7 @@ void SVGLength::update(double em, double ex, double scale) double sp_svg_read_percentage(char const *str, double def) { - if (str == NULL) { + if (str == nullptr) { return def; } diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index b26293801..4d8a250e9 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -49,7 +49,7 @@ flowtext_in_selection(Inkscape::Selection *selection) if (SP_IS_FLOWTEXT(*i)) return *i; } - return NULL; + return nullptr; } static SPItem * @@ -60,7 +60,7 @@ text_or_flowtext_in_selection(Inkscape::Selection *selection) if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) return *i; } - return NULL; + return nullptr; } static SPItem * @@ -71,7 +71,7 @@ shape_in_selection(Inkscape::Selection *selection) if (SP_IS_SHAPE(*i)) return *i; } - return NULL; + return nullptr; } void @@ -139,7 +139,7 @@ text_put_on_path() // remove transform from text, but recursively scale text's fontsize by the expansion SP_TEXT(text)->_adjustFontsizeRecursive (text, text->transform.descrim()); - text->getRepr()->setAttribute("transform", NULL); + text->getRepr()->setAttribute("transform", nullptr); // make a list of text children std::vector<Inkscape::XML::Node *> text_reprs; @@ -158,26 +158,26 @@ text_put_on_path() } else if (text_alignment == Inkscape::Text::Layout::CENTER) { textpath->setAttribute("startOffset", "50%"); } - text->getRepr()->addChild(textpath, NULL); + text->getRepr()->addChild(textpath, nullptr); for (auto i=text_reprs.rbegin();i!=text_reprs.rend();++i) { // Make a copy of each text child Inkscape::XML::Node *copy = (*i)->duplicate(xml_doc); // We cannot have multiline in textpath, so remove line attrs from tspans if (!strcmp(copy->name(), "svg:tspan")) { - copy->setAttribute("sodipodi:role", NULL); - copy->setAttribute("x", NULL); - copy->setAttribute("y", NULL); + copy->setAttribute("sodipodi:role", nullptr); + copy->setAttribute("x", nullptr); + copy->setAttribute("y", nullptr); } // remove the old repr from under text text->getRepr()->removeChild(*i); // put its copy into under textPath - textpath->addChild(copy, NULL); // fixme: copy id + textpath->addChild(copy, nullptr); // fixme: copy id } // x/y are useless with textpath, and confuse Batik 1.5 - text->getRepr()->setAttribute("x", NULL); - text->getRepr()->setAttribute("y", NULL); + text->getRepr()->setAttribute("x", nullptr); + text->getRepr()->setAttribute("y", nullptr); DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Put text on path")); @@ -222,9 +222,9 @@ text_remove_from_path() static void text_remove_all_kerns_recursively(SPObject *o) { - o->getRepr()->setAttribute("dx", NULL); - o->getRepr()->setAttribute("dy", NULL); - o->getRepr()->setAttribute("rotate", NULL); + o->getRepr()->setAttribute("dx", nullptr); + o->getRepr()->setAttribute("dy", nullptr); + o->getRepr()->setAttribute("rotate", nullptr); // if x contains a list, leave only the first value gchar const *x = o->getRepr()->attribute("x"); @@ -305,7 +305,7 @@ text_flow_into_shape() if (SP_IS_TEXT(text)) { // remove transform from text, but recursively scale text's fontsize by the expansion SP_TEXT(text)->_adjustFontsizeRecursive(text, text->transform.descrim()); - text->getRepr()->setAttribute("transform", NULL); + text->getRepr()->setAttribute("transform", nullptr); } Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); @@ -409,7 +409,7 @@ text_unflow () // font size multiplier double ex = (flowtext->transform).descrim(); - if (sp_te_get_string_multiline(flowtext) == NULL) { // flowtext is empty + if (sp_te_get_string_multiline(flowtext) == nullptr) { // flowtext is empty continue; } @@ -430,7 +430,7 @@ text_unflow () /* 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); gchar *text_string = sp_te_get_string_multiline(flowtext); Inkscape::XML::Node *text_repr = xml_doc->createTextNode(text_string); // FIXME: transfer all formatting!!! diff --git a/src/text-editing.cpp b/src/text-editing.cpp index ec9b82235..fc8129088 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -50,7 +50,7 @@ Inkscape::Text::Layout const * te_get_layout (SPItem const *item) } else if (SP_IS_FLOWTEXT (item)) { return &(SP_FLOWTEXT(item)->layout); } - return NULL; + return nullptr; } static void te_update_layout_now (SPItem *item) @@ -115,7 +115,7 @@ std::vector<Geom::Point> sp_te_create_selection_quads(SPItem const *item, Inksca if (start == end) return std::vector<Geom::Point>(); Inkscape::Text::Layout const *layout = te_get_layout(item); - if (layout == NULL) + if (layout == nullptr) return std::vector<Geom::Point>(); return layout->createSelectionShape(start, end, transform); @@ -133,24 +133,24 @@ sp_te_get_cursor_coords (SPItem const *item, Inkscape::Text::Layout::iterator co SPStyle const * sp_te_style_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position) { SPObject const *pos_obj = sp_te_object_at_position(text, position); - SPStyle *result = (pos_obj) ? pos_obj->style : 0; + SPStyle *result = (pos_obj) ? pos_obj->style : nullptr; return result; } SPObject const * sp_te_object_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position) { Inkscape::Text::Layout const *layout = te_get_layout(text); - if (layout == NULL) { - return NULL; + if (layout == nullptr) { + return nullptr; } - SPObject const *pos_obj = 0; - void *rawptr = 0; + SPObject const *pos_obj = nullptr; + void *rawptr = nullptr; layout->getSourceOfCharacter(position, &rawptr); pos_obj = SP_OBJECT(rawptr); - if (pos_obj == 0) { + if (pos_obj == nullptr) { pos_obj = text; } - while (pos_obj->style == NULL) { + while (pos_obj->style == nullptr) { pos_obj = pos_obj->parent; // not interested in SPStrings } return pos_obj; @@ -214,14 +214,14 @@ static TextTagAttributes* attributes_for_object(SPObject *object) return &SP_TREF(object)->attributes; if (SP_IS_TEXTPATH(object)) return &SP_TEXTPATH(object)->attributes; - return NULL; + return nullptr; } static const char * span_name_for_text_object(SPObject const *object) { if (SP_IS_TEXT(object)) return "svg:tspan"; else if (SP_IS_FLOWTEXT(object)) return "svg:flowSpan"; - return NULL; + return nullptr; } unsigned sp_text_get_length(SPObject const *item) @@ -311,9 +311,9 @@ static Inkscape::XML::Node* duplicate_node_without_children(Inkscape::XML::Docum return xml_doc->createPI(old_node->name(), old_node->content()); case Inkscape::XML::DOCUMENT_NODE: - return NULL; // this had better never happen + return nullptr; // this had better never happen } - return NULL; + return nullptr; } /** returns the sum of the (recursive) lengths of all the SPStrings prior @@ -396,16 +396,16 @@ Inkscape::Text::Layout::iterator sp_te_insert_line (SPItem *item, Inkscape::Text SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Text::Layout const *layout = te_get_layout(item); - SPObject *split_obj = 0; + SPObject *split_obj = nullptr; Glib::ustring::iterator split_text_iter; if (position != layout->end()) { - void *rawptr = 0; + void *rawptr = nullptr; layout->getSourceOfCharacter(position, &rawptr, &split_text_iter); split_obj = SP_OBJECT(rawptr); } - if (split_obj == 0 || is_line_break_object(split_obj)) { - if (split_obj == 0) split_obj = item->lastChild(); + if (split_obj == nullptr || is_line_break_object(split_obj)) { + if (split_obj == nullptr) split_obj = item->lastChild(); if (SP_IS_TREF(split_obj)) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, tref_edit_message); @@ -464,7 +464,7 @@ static SPString* sp_te_seek_next_string_recursive(SPObject *start_obj) break; // don't cross line breaks } } - return NULL; + return nullptr; } /** inserts the given characters into the given string and inserts @@ -495,7 +495,7 @@ an iterator pointing just after the inserted text. */ Inkscape::Text::Layout::iterator sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gchar const *utf8) { - if (!g_utf8_validate(utf8,-1,NULL)) { + if (!g_utf8_validate(utf8,-1,nullptr)) { g_warning("Trying to insert invalid utf8"); return position; } @@ -503,8 +503,8 @@ sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gch SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Text::Layout const *layout = te_get_layout(item); - SPObject *source_obj = 0; - void *rawptr = 0; + SPObject *source_obj = nullptr; + void *rawptr = nullptr; Glib::ustring::iterator iter_text; // we want to insert after the previous char, not before the current char. // it makes a difference at span boundaries @@ -537,7 +537,7 @@ sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gch while (SP_IS_FLOWREGION(source_obj) || SP_IS_FLOWREGIONEXCLUDE(source_obj)) { source_obj = source_obj->getNext(); } - if (source_obj == NULL) { + if (source_obj == nullptr) { source_obj = item; } } @@ -552,10 +552,10 @@ sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gch if (source_obj) { // never fails SPString *string_item = sp_te_seek_next_string_recursive(source_obj); - if (string_item == NULL) { + if (string_item == nullptr) { // need to add an SPString in this (pathological) case Inkscape::XML::Node *rstring = xml_doc->createTextNode(""); - source_obj->getRepr()->addChild(rstring, NULL); + source_obj->getRepr()->addChild(rstring, nullptr); Inkscape::GC::release(rstring); g_assert(SP_IS_STRING(source_obj->firstChild())); string_item = SP_STRING(source_obj->firstChild()); @@ -590,7 +590,7 @@ static void move_child_nodes(Inkscape::XML::Node *from_repr, Inkscape::XML::Node Inkscape::XML::Node *child = prepend ? from_repr->lastChild() : from_repr->firstChild(); Inkscape::GC::anchor(child); from_repr->removeChild(child); - if (prepend) to_repr->addChild(child, NULL); + if (prepend) to_repr->addChild(child, nullptr); else to_repr->appendChild(child); Inkscape::GC::release(child); } @@ -600,7 +600,7 @@ static void move_child_nodes(Inkscape::XML::Node *from_repr, Inkscape::XML::Node \a one and \a two. It will never return anything higher than \a text. */ static SPObject* get_common_ancestor(SPObject *text, SPObject *one, SPObject *two) { - if (one == NULL || two == NULL) + if (one == nullptr || two == nullptr) return text; SPObject *common_ancestor = one; if (SP_IS_STRING(common_ancestor)) @@ -629,7 +629,7 @@ ones that have just been moved and sets \a next_is_sibling accordingly. */ static SPObject* delete_line_break(SPObject *root, SPObject *item, bool *next_is_sibling) { Inkscape::XML::Node *this_repr = item->getRepr(); - SPObject *next_item = NULL; + SPObject *next_item = nullptr; unsigned moved_char_count = sp_text_get_length(item) - 1; // the -1 is because it's going to count the line break /* some sample cases (the div is the item to be deleted, the * represents where to put the new span): @@ -648,7 +648,7 @@ static SPObject* delete_line_break(SPObject *root, SPObject *item, bool *next_is new_span_repr->setAttribute("rotate", a); SPObject *following_item = item; - while (following_item->getNext() == NULL) { + while (following_item->getNext() == nullptr) { following_item = following_item->parent; g_assert(following_item != root); } @@ -657,18 +657,18 @@ static SPObject* delete_line_break(SPObject *root, SPObject *item, bool *next_is SPObject *new_parent_item; if (SP_IS_STRING(following_item)) { new_parent_item = following_item->parent; - new_parent_item->getRepr()->addChild(new_span_repr, following_item->getPrev() ? following_item->getPrev()->getRepr() : NULL); + new_parent_item->getRepr()->addChild(new_span_repr, following_item->getPrev() ? following_item->getPrev()->getRepr() : nullptr); next_item = following_item; *next_is_sibling = true; } else { new_parent_item = following_item; next_item = new_parent_item->firstChild(); *next_is_sibling = true; - if (next_item == NULL) { + if (next_item == nullptr) { next_item = new_parent_item; *next_is_sibling = false; } - new_parent_item->getRepr()->addChild(new_span_repr, NULL); + new_parent_item->getRepr()->addChild(new_span_repr, nullptr); } // work around a bug in sp_style_write_difference() which causes the difference @@ -681,7 +681,7 @@ static SPObject* delete_line_break(SPObject *root, SPObject *item, bool *next_is for ( ; attrs ; attrs++) { gchar const *key = g_quark_to_string(attrs->key); gchar const *this_attr = this_node_attrs_inherited->attribute(key); - if ((this_attr == NULL || strcmp(attrs->value, this_attr)) && this_node_attrs->attribute(key) == NULL) + if ((this_attr == nullptr || strcmp(attrs->value, this_attr)) && this_node_attrs->attribute(key) == nullptr) this_node_attrs->setAttribute(key, this_attr); } sp_repr_css_attr_unref(this_node_attrs_inherited); @@ -719,7 +719,7 @@ static void erase_from_spstring(SPString *string_item, Glib::ustring::iterator i char_index += sum_sibling_text_lengths_before(parent_item); parent_item = parent_item->parent; TextTagAttributes *attributes = attributes_for_object(parent_item); - if (attributes == NULL) { + if (attributes == nullptr) { break; } @@ -752,20 +752,20 @@ sp_te_delete (SPItem *item, Inkscape::Text::Layout::iterator const &start, SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Text::Layout const *layout = te_get_layout(item); - SPObject *start_item = 0, *end_item = 0; - void *rawptr = 0; + SPObject *start_item = nullptr, *end_item = nullptr; + void *rawptr = nullptr; Glib::ustring::iterator start_text_iter, end_text_iter; layout->getSourceOfCharacter(iter_pair.first, &rawptr, &start_text_iter); start_item = SP_OBJECT(rawptr); layout->getSourceOfCharacter(iter_pair.second, &rawptr, &end_text_iter); end_item = SP_OBJECT(rawptr); - if (start_item == 0) { + if (start_item == nullptr) { return success; // start is at end of text } if (is_line_break_object(start_item)) { move_to_end_of_paragraph(&start_item, &start_text_iter); } - if (end_item == 0) { + if (end_item == nullptr) { end_item = item->lastChild(); move_to_end_of_paragraph(&end_item, &end_text_iter); } else if (is_line_break_object(end_item)) { @@ -823,7 +823,7 @@ sp_te_delete (SPItem *item, Inkscape::Text::Layout::iterator const &start, do { bool is_sibling = true; next_item = sub_item->getNext(); - if (next_item == NULL) { + if (next_item == nullptr) { next_item = sub_item->parent; is_sibling = false; } @@ -878,9 +878,9 @@ sp_te_get_string_multiline (SPItem const *text) Glib::ustring string; bool pending_line_break = false; - if (!SP_IS_TEXT(text) && !SP_IS_FLOWTEXT(text)) return NULL; + if (!SP_IS_TEXT(text) && !SP_IS_FLOWTEXT(text)) return nullptr; sp_te_get_ustring_multiline(text, &string, &pending_line_break); - if (string.empty()) return NULL; + if (string.empty()) return nullptr; return strdup(string.data()); } @@ -903,8 +903,8 @@ sp_te_get_string_multiline (SPItem const *text, Inkscape::Text::Layout::iterator Glib::ustring result; // not a particularly fast piece of code. I'll optimise it if people start to notice. for ( ; first < last ; first.nextCharacter()) { - SPObject *char_item = 0; - void *rawptr = 0; + SPObject *char_item = nullptr; + void *rawptr = nullptr; Glib::ustring::iterator text_iter; layout->getSourceOfCharacter(first, &rawptr, &text_iter); char_item = SP_OBJECT(rawptr); @@ -920,7 +920,7 @@ sp_te_get_string_multiline (SPItem const *text, Inkscape::Text::Layout::iterator void sp_te_set_repr_text_multiline(SPItem *text, gchar const *str) { - g_return_if_fail (text != NULL); + g_return_if_fail (text != nullptr); g_return_if_fail (SP_IS_TEXT(text) || SP_IS_FLOWTEXT(text)); Inkscape::XML::Document *xml_doc = text->getRepr()->document(); @@ -963,16 +963,16 @@ sp_te_set_repr_text_multiline(SPItem *text, gchar const *str) rtspan = xml_doc->createElement("svg:flowPara"); } Inkscape::XML::Node *rstr = xml_doc->createTextNode(p); - rtspan->addChild(rstr, NULL); + rtspan->addChild(rstr, nullptr); Inkscape::GC::release(rstr); repr->appendChild(rtspan); Inkscape::GC::release(rtspan); } - p = (e) ? e + 1 : NULL; + p = (e) ? e + 1 : nullptr; } if (is_textpath) { Inkscape::XML::Node *rstr = xml_doc->createTextNode(content); - repr->addChild(rstr, NULL); + repr->addChild(rstr, nullptr); Inkscape::GC::release(rstr); } @@ -987,19 +987,19 @@ which represents the iterator \a position. */ TextTagAttributes* text_tag_attributes_at_position(SPItem *item, Inkscape::Text::Layout::iterator const &position, unsigned *char_index) { - if (item == NULL || char_index == NULL || !SP_IS_TEXT(item)) { - return NULL; // flowtext doesn't support kerning yet + if (item == nullptr || char_index == nullptr || !SP_IS_TEXT(item)) { + return nullptr; // flowtext doesn't support kerning yet } SPText *text = SP_TEXT(item); - SPObject *source_item = 0; - void *rawptr = 0; + SPObject *source_item = nullptr; + void *rawptr = nullptr; Glib::ustring::iterator source_text_iter; text->layout.getSourceOfCharacter(position, &rawptr, &source_text_iter); source_item = SP_OBJECT(rawptr); if (!SP_IS_STRING(source_item)) { - return NULL; + return nullptr; } Glib::ustring *string = &SP_STRING(source_item)->string; *char_index = sum_sibling_text_lengths_before(source_item); @@ -1077,12 +1077,12 @@ sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator cons Geom::Affine t (text->i2doc_affine()); factor = factor / t.descrim(); Inkscape::Text::Layout const *layout = te_get_layout(text); - if (layout == NULL) return; - SPObject *source_item = 0; - void *rawptr = 0; + if (layout == nullptr) return; + SPObject *source_item = nullptr; + void *rawptr = nullptr; layout->getSourceOfCharacter(std::min(start, end), &rawptr); source_item = SP_OBJECT(rawptr); - if (source_item == 0) { + if (source_item == nullptr) { return; } gdouble degrees = (180/M_PI) * atan2(pixels, source_item->parent->style->font_size.computed / factor); @@ -1095,7 +1095,7 @@ sp_te_adjust_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &star { unsigned char_index; TextTagAttributes *attributes = text_tag_attributes_at_position(text, std::min(start, end), &char_index); - if (attributes == NULL) return; + if (attributes == nullptr) return; if (start != end) { for (Inkscape::Text::Layout::iterator it = std::min(start, end) ; it != std::max(start, end) ; it.nextCharacter()) { @@ -1113,7 +1113,7 @@ void sp_te_set_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &st { unsigned char_index = 0; TextTagAttributes *attributes = text_tag_attributes_at_position(text, std::min(start, end), &char_index); - if (attributes != NULL) { + if (attributes != nullptr) { if (start != end) { for (Inkscape::Text::Layout::iterator it = std::min(start, end) ; it != std::max(start, end) ; it.nextCharacter()) { attributes = text_tag_attributes_at_position(text, it, &char_index); @@ -1133,19 +1133,19 @@ void sp_te_set_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &st void sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble by) { - g_return_if_fail (text != NULL); + g_return_if_fail (text != nullptr); g_return_if_fail (SP_IS_TEXT(text) || SP_IS_FLOWTEXT(text)); Inkscape::Text::Layout const *layout = te_get_layout(text); gdouble val; - SPObject *source_obj = 0; - void *rawptr = 0; + SPObject *source_obj = nullptr; + void *rawptr = nullptr; unsigned nb_let; layout->getSourceOfCharacter(std::min(start, end), &rawptr); source_obj = SP_OBJECT(rawptr); - if (source_obj == 0) { // end of text + if (source_obj == nullptr) { // end of text source_obj = text->lastChild(); } if (SP_IS_STRING(source_obj)) { @@ -1317,7 +1317,7 @@ void sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator const &/*start*/, Inkscape::Text::Layout::iterator const &/*end*/, SPDesktop *desktop, gdouble by) { // TODO: use start and end iterators to delineate the area to be affected - g_return_if_fail (text != NULL); + g_return_if_fail (text != nullptr); g_return_if_fail (SP_IS_TEXT(text) || SP_IS_FLOWTEXT(text)); Inkscape::Text::Layout const *layout = te_get_layout(text); @@ -1376,7 +1376,7 @@ static void overwrite_style_with_string(SPObject *item, gchar const *style_strin style.mergeString(item_style_string); } Glib::ustring new_style_string = style.write(); - item->getRepr()->setAttribute("style", new_style_string.empty() ? NULL : new_style_string.c_str()); + item->getRepr()->setAttribute("style", new_style_string.empty() ? nullptr : new_style_string.c_str()); } // Move to style.h? @@ -1429,13 +1429,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; @@ -1449,12 +1449,12 @@ static void apply_css_recursive(SPObject *o, SPCSSAttr const *css) sp_repr_css_change(o->getRepr(), const_cast<SPCSSAttr*>(css), "style"); for (auto& child: o->children) { - if (sp_repr_css_property(const_cast<SPCSSAttr*>(css), "opacity", NULL) != NULL) { + if (sp_repr_css_property(const_cast<SPCSSAttr*>(css), "opacity", nullptr) != nullptr) { // Unset properties which are accumulating and thus should not be set recursively. // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group. SPCSSAttr *css_recurse = sp_repr_css_attr_new(); sp_repr_css_merge(css_recurse, const_cast<SPCSSAttr*>(css)); - sp_repr_css_set_property(css_recurse, "opacity", NULL); + sp_repr_css_set_property(css_recurse, "opacity", nullptr); apply_css_recursive(&child, css_recurse); sp_repr_css_attr_unref(css_recurse); } else { @@ -1470,7 +1470,7 @@ objects to the beginning or end respectively. \a span_object_name is the name of the xml for a text span (ie tspan or flowspan). */ static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const *css, SPObject *start_item, Glib::ustring::iterator start_text_iter, SPObject *end_item, Glib::ustring::iterator end_text_iter, char const *span_object_name) { - bool passed_start = start_item == NULL ? true : false; + bool passed_start = start_item == nullptr ? true : false; Inkscape::XML::Document *xml_doc = common_ancestor->document->getReprDoc(); for (SPObject *child = common_ancestor->firstChild() ; child ; child = child->getNext()) { @@ -1480,7 +1480,7 @@ static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const * if (passed_start) { if (end_item && child->isAncestorOf(end_item)) { - recursively_apply_style(child, css, NULL, start_text_iter, end_item, end_text_iter, span_object_name); + recursively_apply_style(child, css, nullptr, start_text_iter, end_item, end_text_iter, span_object_name); break; } // apply style @@ -1494,7 +1494,7 @@ static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const * Inkscape::XML::Node *child_span = xml_doc->createElement(span_object_name); sp_repr_css_set(child_span, const_cast<SPCSSAttr*>(css), "style"); // better hope that prototype wasn't nonconst for a good reason SPObject *prev_item = child->getPrev(); - Inkscape::XML::Node *prev_repr = prev_item ? prev_item->getRepr() : NULL; + Inkscape::XML::Node *prev_repr = prev_item ? prev_item->getRepr() : nullptr; if (child == start_item || child == end_item) { surround_entire_string = false; @@ -1656,7 +1656,7 @@ static bool tidy_operator_repeated_spans(SPObject **item, bool /*has_text_decora { SPObject *first = *item; SPObject *second = first->getNext(); - if (second == NULL) return false; + if (second == nullptr) return false; Inkscape::XML::Node *first_repr = first->getRepr(); Inkscape::XML::Node *second_repr = second->getRepr(); @@ -1677,8 +1677,8 @@ static bool tidy_operator_repeated_spans(SPObject **item, bool /*has_text_decora if (is_line_break_object(second)) return false; gchar const *first_style = first_repr->attribute("style"); gchar const *second_style = second_repr->attribute("style"); - if (!((first_style == NULL && second_style == NULL) - || (first_style != NULL && second_style != NULL && !strcmp(first_style, second_style)))) + if (!((first_style == nullptr && second_style == nullptr) + || (first_style != nullptr && second_style != nullptr && !strcmp(first_style, second_style)))) return false; // all our tests passed: do the merge @@ -1751,7 +1751,7 @@ static bool redundant_double_nesting_processor(SPObject **item, SPObject *child, return false; } - Inkscape::XML::Node *insert_after_repr = 0; + Inkscape::XML::Node *insert_after_repr = nullptr; if (!prepend) { insert_after_repr = (*item)->getRepr(); } else if ((*item)->getPrev()) { @@ -1822,7 +1822,7 @@ static bool redundant_semi_nesting_processor(SPObject **item, SPObject *child, b Inkscape::XML::Node *new_span = xml_doc->createElement((*item)->getRepr()->name()); if (prepend) { SPObject *prev = (*item)->getPrev(); - (*item)->parent->getRepr()->addChild(new_span, prev ? prev->getRepr() : NULL); + (*item)->parent->getRepr()->addChild(new_span, prev ? prev->getRepr() : nullptr); } else { (*item)->parent->getRepr()->addChild(new_span, (*item)->getRepr()); } @@ -1973,7 +1973,7 @@ static bool tidy_xml_tree_recursively(SPObject *root, bool has_text_decoration) }; bool changes = false; - for (SPObject *child = root->firstChild() ; child != NULL ; ) { + for (SPObject *child = root->firstChild() ; child != nullptr ; ) { if (SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child) || SP_IS_TREF(child)) { child = child->getNext(); continue; @@ -2012,14 +2012,14 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta last = start; } Inkscape::Text::Layout const *layout = te_get_layout(text); - SPObject *start_item = 0, *end_item = 0; - void *rawptr = 0; + SPObject *start_item = nullptr, *end_item = nullptr; + void *rawptr = nullptr; Glib::ustring::iterator start_text_iter, end_text_iter; layout->getSourceOfCharacter(first, &rawptr, &start_text_iter); start_item = SP_OBJECT(rawptr); layout->getSourceOfCharacter(last, &rawptr, &end_text_iter); end_item = SP_OBJECT(rawptr); - if (start_item == 0) { + if (start_item == nullptr) { return; // start is at end of text } if (is_line_break_object(start_item)) { @@ -2028,7 +2028,7 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta if (is_line_break_object(end_item)) { end_item = end_item->getNext(); } - if (end_item == 0) { + if (end_item == nullptr) { end_item = text; } diff --git a/src/text-tag-attributes.h b/src/text-tag-attributes.h index 2cf7a8bde..18edf1267 100644 --- a/src/text-tag-attributes.h +++ b/src/text-tag-attributes.h @@ -149,7 +149,7 @@ private: /** Does mergeInto() for one member of #attributes. If \a overlay_list is NULL then it does a simple copy of parent elements, starting at \a parent_offset. */ - static void mergeSingleAttribute(std::vector<SVGLength> *output_list, std::vector<SVGLength> const &parent_list, unsigned parent_offset, std::vector<SVGLength> const *overlay_list = NULL); + static void mergeSingleAttribute(std::vector<SVGLength> *output_list, std::vector<SVGLength> const &parent_list, unsigned parent_offset, std::vector<SVGLength> const *overlay_list = nullptr); /// Does the work for erase(). static void eraseSingleAttribute(std::vector<SVGLength> *attr_vector, unsigned start_index, unsigned n); diff --git a/src/trace/filterset.cpp b/src/trace/filterset.cpp index f6c025956..db6d16eea 100644 --- a/src/trace/filterset.cpp +++ b/src/trace/filterset.cpp @@ -48,7 +48,7 @@ GrayMap *grayMapGaussian(GrayMap *me) GrayMap *newGm = GrayMapCreate(width, height); if (!newGm) - return NULL; + return nullptr; for (int y = 0 ; y<height ; y++) { @@ -98,7 +98,7 @@ RgbMap *rgbMapGaussian(RgbMap *me) RgbMap *newGm = RgbMapCreate(width, height); if (!newGm) - return NULL; + return nullptr; for (int y = 0 ; y<height ; y++) { @@ -178,7 +178,7 @@ static GrayMap *grayMapSobel(GrayMap *gm, GrayMap *newGm = GrayMapCreate(width, height); if (!newGm) - return NULL; + return nullptr; for (int y = 0 ; y<height ; y++) { @@ -353,11 +353,11 @@ GrayMap * grayMapCanny(GrayMap *gm, double lowThreshold, double highThreshold) { if (!gm) - return NULL; + return nullptr; GrayMap *cannyGm = grayMapSobel(gm, lowThreshold, highThreshold); if (!cannyGm) - return NULL; + return nullptr; /*cannyGm->writePPM(cannyGm, "canny.ppm");*/ return cannyGm; diff --git a/src/trace/imagemap-gdk.cpp b/src/trace/imagemap-gdk.cpp index 298414074..db8bbdd99 100644 --- a/src/trace/imagemap-gdk.cpp +++ b/src/trace/imagemap-gdk.cpp @@ -10,7 +10,7 @@ GrayMap *gdkPixbufToGrayMap(GdkPixbuf *buf) { if (!buf) - return NULL; + return nullptr; int width = gdk_pixbuf_get_width(buf); int height = gdk_pixbuf_get_height(buf); @@ -20,7 +20,7 @@ GrayMap *gdkPixbufToGrayMap(GdkPixbuf *buf) GrayMap *grayMap = GrayMapCreate(width, height); if (!grayMap) - return NULL; + return nullptr; //### Fill in the odd cells with RGB values int x,y; @@ -46,19 +46,19 @@ GrayMap *gdkPixbufToGrayMap(GdkPixbuf *buf) GdkPixbuf *grayMapToGdkPixbuf(GrayMap *grayMap) { if (!grayMap) - return NULL; + return nullptr; guchar *pixdata = (guchar *) malloc(sizeof(guchar) * grayMap->width * grayMap->height * 3); if (!pixdata) - return NULL; + return nullptr; int n_channels = 3; int rowstride = grayMap->width * 3; GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB, 0, 8, grayMap->width, grayMap->height, - rowstride, (GdkPixbufDestroyNotify)g_free, NULL); + rowstride, (GdkPixbufDestroyNotify)g_free, nullptr); //### Fill in the odd cells with RGB values int x,y; @@ -87,7 +87,7 @@ GdkPixbuf *grayMapToGdkPixbuf(GrayMap *grayMap) PackedPixelMap *gdkPixbufToPackedPixelMap(GdkPixbuf *buf) { if (!buf) - return NULL; + return nullptr; int width = gdk_pixbuf_get_width(buf); int height = gdk_pixbuf_get_height(buf); @@ -97,7 +97,7 @@ PackedPixelMap *gdkPixbufToPackedPixelMap(GdkPixbuf *buf) PackedPixelMap *ppMap = PackedPixelMapCreate(width, height); if (!ppMap) - return NULL; + return nullptr; //### Fill in the cells with RGB values int x,y; @@ -130,7 +130,7 @@ PackedPixelMap *gdkPixbufToPackedPixelMap(GdkPixbuf *buf) RgbMap *gdkPixbufToRgbMap(GdkPixbuf *buf) { if (!buf) - return NULL; + return nullptr; int width = gdk_pixbuf_get_width(buf); int height = gdk_pixbuf_get_height(buf); @@ -140,7 +140,7 @@ RgbMap *gdkPixbufToRgbMap(GdkPixbuf *buf) RgbMap *rgbMap = RgbMapCreate(width, height); if (!rgbMap) - return NULL; + return nullptr; //### Fill in the cells with RGB values int x,y; @@ -175,19 +175,19 @@ RgbMap *gdkPixbufToRgbMap(GdkPixbuf *buf) GdkPixbuf *indexedMapToGdkPixbuf(IndexedMap *iMap) { if (!iMap) - return NULL; + return nullptr; guchar *pixdata = (guchar *) malloc(sizeof(guchar) * iMap->width * iMap->height * 3); if (!pixdata) - return NULL; + return nullptr; int n_channels = 3; int rowstride = iMap->width * 3; GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB, 0, 8, iMap->width, iMap->height, - rowstride, (GdkPixbufDestroyNotify)g_free, NULL); + rowstride, (GdkPixbufDestroyNotify)g_free, nullptr); //### Fill in the cells with RGB values int x,y; diff --git a/src/trace/imagemap.cpp b/src/trace/imagemap.cpp index a8d8a8c8f..e2e97d5ec 100644 --- a/src/trace/imagemap.cpp +++ b/src/trace/imagemap.cpp @@ -65,7 +65,7 @@ GrayMap *GrayMapCreate(int width, int height) GrayMap *me = (GrayMap *)malloc(sizeof(GrayMap)); if (!me) - return NULL; + return nullptr; /** methods **/ me->setPixel = gSetPixel; @@ -81,7 +81,7 @@ GrayMap *GrayMapCreate(int width, int height) if (!me->pixels) { free(me); - return NULL; + return nullptr; } me->rows = (unsigned long **) malloc(sizeof(unsigned long *) * height); @@ -89,7 +89,7 @@ GrayMap *GrayMapCreate(int width, int height) { free(me->pixels); free(me); - return NULL; + return nullptr; } unsigned long *row = me->pixels; @@ -179,7 +179,7 @@ PackedPixelMap *PackedPixelMapCreate(int width, int height) PackedPixelMap *me = (PackedPixelMap *)malloc(sizeof(PackedPixelMap)); if (!me) - return NULL; + return nullptr; /** methods **/ me->setPixel = ppSetPixel; @@ -195,13 +195,13 @@ PackedPixelMap *PackedPixelMapCreate(int width, int height) me->pixels = (unsigned long *) malloc(sizeof(unsigned long) * width * height); if (!me->pixels){ free(me); - return NULL; + return nullptr; } me->rows = (unsigned long **) malloc(sizeof(unsigned long *) * height); if (!me->rows){ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check free(me); - return NULL; + return nullptr; } unsigned long *row = me->pixels; @@ -288,7 +288,7 @@ RgbMap *RgbMapCreate(int width, int height) RgbMap *me = (RgbMap *)malloc(sizeof(RgbMap)); if (!me){ - return NULL; + return nullptr; } /** methods **/ @@ -305,13 +305,13 @@ RgbMap *RgbMapCreate(int width, int height) me->pixels = (RGB *) malloc(sizeof(RGB) * width * height); if (!me->pixels){ free(me); - return NULL; + return nullptr; } me->rows = (RGB **) malloc(sizeof(RGB *) * height); if (!me->rows){ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check free(me); - return NULL; + return nullptr; } RGB *row = me->pixels; @@ -398,7 +398,7 @@ IndexedMap *IndexedMapCreate(int width, int height) IndexedMap *me = (IndexedMap *)malloc(sizeof(IndexedMap)); if (!me) - return NULL; + return nullptr; /** methods **/ me->setPixel = iSetPixel; @@ -414,13 +414,13 @@ IndexedMap *IndexedMapCreate(int width, int height) me->pixels = (unsigned int *) malloc(sizeof(unsigned int) * width * height); if (!me->pixels){ free(me); - return NULL; + return nullptr; } me->rows = (unsigned int **) malloc(sizeof(unsigned int *) * height); if (!me->rows){ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check free(me); - return NULL; + return nullptr; } unsigned int *row = me->pixels; diff --git a/src/trace/pool.h b/src/trace/pool.h index 88fd82bcd..b4693d941 100644 --- a/src/trace/pool.h +++ b/src/trace/pool.h @@ -62,9 +62,9 @@ class pool { { cblock = 0; size = sizeof(T) > sizeof(void *) ? sizeof(T) : sizeof(void *); - next = NULL; + next = nullptr; for (int k = 0; k < 64; k++) { - block[k] = NULL; + block[k] = nullptr; } } diff --git a/src/trace/potrace/bitmap.h b/src/trace/potrace/bitmap.h index 7b5a94bb1..a47de24d0 100644 --- a/src/trace/potrace/bitmap.h +++ b/src/trace/potrace/bitmap.h @@ -63,12 +63,12 @@ static inline potrace_bitmap_t *bm_new(int w, int h) { /* check for overflow error */ if (size < 0 || (h != 0 && dy != 0 && size / h / dy != BM_WORDSIZE)) { errno = ENOMEM; - return NULL; + return nullptr; } bm = (potrace_bitmap_t *) malloc(sizeof(potrace_bitmap_t)); if (!bm) { - return NULL; + return nullptr; } bm->w = w; bm->h = h; @@ -76,7 +76,7 @@ static inline potrace_bitmap_t *bm_new(int w, int h) { bm->map = (potrace_word *) malloc(size); if (!bm->map) { free(bm); - return NULL; + return nullptr; } return bm; } @@ -94,7 +94,7 @@ static inline potrace_bitmap_t *bm_dup(const potrace_bitmap_t *bm) { potrace_bitmap_t *bm1 = bm_new(bm->w, bm->h); ptrdiff_t size = (ptrdiff_t)bm->dy * (ptrdiff_t)bm->h * (ptrdiff_t)BM_WORDSIZE; if (!bm1) { - return NULL; + return nullptr; } memcpy(bm1->map, bm->map, size); return bm1; diff --git a/src/trace/potrace/inkscape-potrace.cpp b/src/trace/potrace/inkscape-potrace.cpp index b438be248..86658653a 100644 --- a/src/trace/potrace/inkscape-potrace.cpp +++ b/src/trace/potrace/inkscape-potrace.cpp @@ -207,9 +207,9 @@ static long writePaths(PotraceTracingEngine *engine, potrace_path_t *plist, static GrayMap *filter(PotraceTracingEngine &engine, GdkPixbuf * pixbuf) { if (!pixbuf) - return NULL; + return nullptr; - GrayMap *newGm = NULL; + GrayMap *newGm = nullptr; /*### Color quantization -- banding ###*/ if (engine.getTraceType() == TRACE_QUANT) @@ -281,9 +281,9 @@ static GrayMap *filter(PotraceTracingEngine &engine, GdkPixbuf * pixbuf) static IndexedMap *filterIndexed(PotraceTracingEngine &engine, GdkPixbuf * pixbuf) { if (!pixbuf) - return NULL; + return nullptr; - IndexedMap *newGm = NULL; + IndexedMap *newGm = nullptr; RgbMap *gm = gdkPixbufToRgbMap(pixbuf); if (engine.getMultiScanSmooth()) @@ -326,7 +326,7 @@ PotraceTracingEngine::preview(Glib::RefPtr<Gdk::Pixbuf> thePixbuf) { IndexedMap *gm = filterIndexed(*this, pixbuf); if (!gm) - return Glib::RefPtr<Gdk::Pixbuf>(NULL); + return Glib::RefPtr<Gdk::Pixbuf>(nullptr); Glib::RefPtr<Gdk::Pixbuf> newBuf = Glib::wrap(indexedMapToGdkPixbuf(gm), false); @@ -339,7 +339,7 @@ PotraceTracingEngine::preview(Glib::RefPtr<Gdk::Pixbuf> thePixbuf) { GrayMap *gm = filter(*this, pixbuf); if (!gm) - return Glib::RefPtr<Gdk::Pixbuf>(NULL); + return Glib::RefPtr<Gdk::Pixbuf>(nullptr); Glib::RefPtr<Gdk::Pixbuf> newBuf = Glib::wrap(grayMapToGdkPixbuf(gm), false); diff --git a/src/trace/quantize.cpp b/src/trace/quantize.cpp index c386c0ee9..a7868fd03 100644 --- a/src/trace/quantize.cpp +++ b/src/trace/quantize.cpp @@ -165,10 +165,10 @@ inline int childIndex(RGB rgb) inline Ocnode *ocnodeNew(pool<Ocnode> *pool) { Ocnode *node = pool->draw(); - node->ref = NULL; - node->parent = NULL; + node->ref = nullptr; + node->parent = nullptr; node->nchild = 0; - for (int i = 0; i < 8; i++) node->child[i] = NULL; + for (int i = 0; i < 8; i++) node->child[i] = nullptr; node->mi = 0; return node; } @@ -363,7 +363,7 @@ static void ocnodeStrip(pool<Ocnode> *pool, Ocnode **ref, int *count, unsigned l if (!node->mi) ocnodeMi(node); //mi generation may be required if (node->mi > lvl) return; //leaf is above strip level ocnodeFree(pool, node); - *ref = NULL; + *ref = nullptr; (*count)--; } else @@ -373,7 +373,7 @@ static void ocnodeStrip(pool<Ocnode> *pool, Ocnode **ref, int *count, unsigned l node->nchild = 0; node->nleaf = 0; node->mi = 0; - Ocnode **lonelychild = NULL; + Ocnode **lonelychild = nullptr; for (int i = 0; i < 8; i++) if (node->child[i]) { ocnodeStrip(pool, &node->child[i], count, lvl); @@ -402,7 +402,7 @@ static void ocnodeStrip(pool<Ocnode> *pool, Ocnode **ref, int *count, unsigned l node->nleaf = 1; ocnodeMi(node); ocnodeFree(pool, *lonelychild); - *lonelychild = NULL; + *lonelychild = nullptr; } else { @@ -444,21 +444,21 @@ static void octreeBuildArea(pool<Ocnode> *pool, RgbMap *rgbmap, Ocnode **ref, { int dx = x2 - x1, dy = y2 - y1; int xm = x1 + dx/2, ym = y1 + dy/2; - Ocnode *ref1 = NULL; - Ocnode *ref2 = NULL; + Ocnode *ref1 = nullptr; + Ocnode *ref2 = nullptr; if (dx == 1 && dy == 1) ocnodeLeaf(pool, ref, rgbmap->getPixel(rgbmap, x1, y1)); else if (dx > dy) { octreeBuildArea(pool, rgbmap, &ref1, x1, y1, xm, y2, ncolor); octreeBuildArea(pool, rgbmap, &ref2, xm, y1, x2, y2, ncolor); - octreeMerge(pool, NULL, ref, ref1, ref2); + octreeMerge(pool, nullptr, ref, ref1, ref2); } else { octreeBuildArea(pool, rgbmap, &ref1, x1, y1, x2, ym, ncolor); octreeBuildArea(pool, rgbmap, &ref2, x1, ym, x2, y2, ncolor); - octreeMerge(pool, NULL, ref, ref1, ref2); + octreeMerge(pool, nullptr, ref, ref1, ref2); } //octreePrune(ref, 2*ncolor); @@ -472,7 +472,7 @@ static void octreeBuildArea(pool<Ocnode> *pool, RgbMap *rgbmap, Ocnode **ref, static Ocnode *octreeBuild(pool<Ocnode> *pool, RgbMap *rgbmap, int ncolor) { //create the octree - Ocnode *node = NULL; + Ocnode *node = nullptr; octreeBuildArea(pool, rgbmap, &node, 0, 0, rgbmap->width, rgbmap->height, ncolor @@ -549,11 +549,11 @@ IndexedMap *rgbMapQuantize(RgbMap *rgbmap, int ncolor) assert(rgbmap); assert(ncolor > 0); - IndexedMap *newmap = 0; + IndexedMap *newmap = nullptr; pool<Ocnode> pool; - Ocnode *tree = 0; + Ocnode *tree = nullptr; try { tree = octreeBuild(&pool, rgbmap, ncolor); } diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index 9df4e561c..9501da3c4 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -344,8 +344,8 @@ SioxImage::SioxImage(unsigned int widthArg, unsigned int heightArg) */ SioxImage::SioxImage(const SioxImage &other) { - pixdata = NULL; - cmdata = NULL; + pixdata = nullptr; + cmdata = nullptr; assign(other); } @@ -654,14 +654,14 @@ GdkPixbuf *SioxImage::getGdkPixbuf() guchar *pixdata = (guchar *) malloc(sizeof(guchar) * width * height * n_channels); if (!pixdata) - return NULL; + return nullptr; int rowstride = width * n_channels; GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB, has_alpha, 8, width, height, - rowstride, NULL, NULL); + rowstride, nullptr, nullptr); //### Fill in the cells with RGB values int row = 0; @@ -728,14 +728,14 @@ const float Siox::CERTAIN_BACKGROUND_CONFIDENCE=0.0f; * Construct a Siox engine */ Siox::Siox() : - sioxObserver(0), + sioxObserver(nullptr), keepGoing(true), width(0), height(0), pixelCount(0), - image(0), - cm(0), - labelField(0) + image(nullptr), + cm(nullptr), + labelField(nullptr) { init(); } @@ -749,9 +749,9 @@ Siox::Siox(SioxObserver *observer) : width(0), height(0), pixelCount(0), - image(0), - cm(0), - labelField(0) + image(nullptr), + cm(nullptr), + labelField(nullptr) { init(); } diff --git a/src/trace/siox.h b/src/trace/siox.h index fa18ac238..6f3f89a83 100644 --- a/src/trace/siox.h +++ b/src/trace/siox.h @@ -388,7 +388,7 @@ public: * used to point to a C++ object or C state object, to delegate * callback processing to something else. Use NULL to ignore. */ - SioxObserver(void *contextArg) : context(NULL) + SioxObserver(void *contextArg) : context(nullptr) { context = contextArg; } /** diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index bd52d7a57..a76be208e 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -49,7 +49,7 @@ SPImage *Tracer::getSelectedSPImage() if (!desktop) { g_warning("Trace: No active desktop"); - return NULL; + return nullptr; } Inkscape::MessageStack *msgStack = desktop->getMessageStack(); @@ -60,12 +60,12 @@ SPImage *Tracer::getSelectedSPImage() char *msg = _("Select an <b>image</b> to trace"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); //g_warning(msg); - return NULL; + return nullptr; } if (sioxEnabled) { - SPImage *img = NULL; + SPImage *img = nullptr; auto list = sel->items(); std::vector<SPItem *> items; sioxShapes.clear(); @@ -94,7 +94,7 @@ SPImage *Tracer::getSelectedSPImage() { char *msg = _("Select only one <b>image</b> to trace"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); - return NULL; + return nullptr; } img = SP_IMAGE(item); } @@ -112,7 +112,7 @@ SPImage *Tracer::getSelectedSPImage() { char *msg = _("Select one image and one or more shapes above it"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); - return NULL; + return nullptr; } return img; } @@ -125,7 +125,7 @@ SPImage *Tracer::getSelectedSPImage() char *msg = _("Select an <b>image</b> to trace"); //same as above msgStack->flash(Inkscape::ERROR_MESSAGE, msg); //g_warning(msg); - return NULL; + return nullptr; } if (!SP_IS_IMAGE(item)) @@ -133,7 +133,7 @@ SPImage *Tracer::getSelectedSPImage() char *msg = _("Select an <b>image</b> to trace"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); //g_warning(msg); - return NULL; + return nullptr; } SPImage *img = SP_IMAGE(item); @@ -215,7 +215,7 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr<Gd if (!desktop) { g_warning("%s", _("Trace: No active desktop")); - return Glib::RefPtr<Gdk::Pixbuf>(NULL); + return Glib::RefPtr<Gdk::Pixbuf>(nullptr); } Inkscape::MessageStack *msgStack = desktop->getMessageStack(); @@ -226,7 +226,7 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr<Gd char *msg = _("Select an <b>image</b> to trace"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); //g_warning(msg); - return Glib::RefPtr<Gdk::Pixbuf>(NULL); + return Glib::RefPtr<Gdk::Pixbuf>(nullptr); } Inkscape::DrawingItem *aImg = img->get_arenaitem(desktop->dkey); @@ -313,7 +313,7 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr<Gd if (!result.isValid()) { g_warning("%s", _("Invalid SIOX result")); - return Glib::RefPtr<Gdk::Pixbuf>(NULL); + return Glib::RefPtr<Gdk::Pixbuf>(nullptr); } //result.writePPM("siox2.ppm"); @@ -334,10 +334,10 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::getSelectedImage() SPImage *img = getSelectedSPImage(); if (!img) - return Glib::RefPtr<Gdk::Pixbuf>(NULL); + return Glib::RefPtr<Gdk::Pixbuf>(nullptr); if (!img->pixbuf) - return Glib::RefPtr<Gdk::Pixbuf>(NULL); + return Glib::RefPtr<Gdk::Pixbuf>(nullptr); GdkPixbuf *raw_pb = img->pixbuf->getPixbufRaw(false); GdkPixbuf *trace_pb = gdk_pixbuf_copy(raw_pb); @@ -408,7 +408,7 @@ void Tracer::traceThread() char *msg = _("Trace: No active document"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); //g_warning(msg); - engine = NULL; + engine = nullptr; return; } SPDocument *doc = SP_ACTIVE_DOCUMENT; @@ -418,7 +418,7 @@ void Tracer::traceThread() SPImage *img = getSelectedSPImage(); if (!img) { - engine = NULL; + engine = nullptr; return; } @@ -440,7 +440,7 @@ void Tracer::traceThread() char *msg = _("Trace: Image has no bitmap data"); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); //g_warning(msg); - engine = NULL; + engine = nullptr; return; } @@ -455,7 +455,7 @@ void Tracer::traceThread() //### Check if we should stop if (!keepGoing || nrPaths<1) { - engine = NULL; + engine = nullptr; return; } @@ -498,7 +498,7 @@ void Tracer::traceThread() //#OK. Now let's start making new nodes Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); - Inkscape::XML::Node *groupRepr = NULL; + Inkscape::XML::Node *groupRepr = nullptr; //# if more than 1, make a <g>roup of <path>s if (nrPaths > 1) @@ -519,7 +519,7 @@ void Tracer::traceThread() pathRepr->setAttribute("d", result.getPathData().c_str()); if (nrPaths > 1) - groupRepr->addChild(pathRepr, NULL); + groupRepr->addChild(pathRepr, nullptr); else par->addChild(pathRepr, imgRepr); @@ -549,7 +549,7 @@ void Tracer::traceThread() //## inform the document, so we can undo DocumentUndo::done(doc, SP_VERB_SELECTION_TRACE, _("Trace bitmap")); - engine = NULL; + engine = nullptr; char *msg = g_strdup_printf(_("Trace: Done. %ld nodes created"), totalNodeCount); msgStack->flash(Inkscape::NORMAL_MESSAGE, msg); diff --git a/src/trace/trace.h b/src/trace/trace.h index b6b7684d0..790298261 100644 --- a/src/trace/trace.h +++ b/src/trace/trace.h @@ -167,7 +167,7 @@ public: */ Tracer() { - engine = NULL; + engine = nullptr; sioxEnabled = false; } 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() diff --git a/src/unclump.cpp b/src/unclump.cpp index e461df701..26efe10de 100644 --- a/src/unclump.cpp +++ b/src/unclump.cpp @@ -196,7 +196,7 @@ Closest to item among others static SPItem *unclump_closest (SPItem *item, std::list<SPItem*> &others) { double min = HUGE_VAL; - SPItem *closest = NULL; + SPItem *closest = nullptr; for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();++i) { SPItem *other = *i; @@ -220,7 +220,7 @@ Most distant from item among others static SPItem *unclump_farest (SPItem *item, std::list<SPItem*> &others) { double max = -HUGE_VAL; - SPItem *farest = NULL; + SPItem *farest = nullptr; for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();++i) { SPItem *other = *i; diff --git a/src/unicoderange.cpp b/src/unicoderange.cpp index 5a9c4b331..2adb26311 100644 --- a/src/unicoderange.cpp +++ b/src/unicoderange.cpp @@ -54,7 +54,7 @@ int UnicodeRange::add_range(gchar* val){ // val+=i; count+=i; } else { - r.end=NULL; + r.end=nullptr; } this->range.push_back(r); return count+1; diff --git a/src/util/ege-appear-time-tracker.cpp b/src/util/ege-appear-time-tracker.cpp index 456d702ab..ec24bbd32 100644 --- a/src/util/ege-appear-time-tracker.cpp +++ b/src/util/ege-appear-time-tracker.cpp @@ -81,7 +81,7 @@ AppearTimeTracker::~AppearTimeTracker() { if ( _timer ) { g_timer_destroy(_timer); - _timer = 0; + _timer = nullptr; } unhookHandler( _mapId, _topMost ); diff --git a/src/util/expression-evaluator.cpp b/src/util/expression-evaluator.cpp index 0a2dd6d50..47c54a995 100644 --- a/src/util/expression-evaluator.cpp +++ b/src/util/expression-evaluator.cpp @@ -51,7 +51,7 @@ EvaluatorToken::EvaluatorToken() } ExpressionEvaluator::ExpressionEvaluator(const char *string, Unit const *unit) : - string(g_locale_to_utf8(string,-1,0,0,0)), + string(g_locale_to_utf8(string,-1,nullptr,nullptr,nullptr)), unit(unit) { current_token.type = TOKEN_END; @@ -76,24 +76,24 @@ ExpressionEvaluator::ExpressionEvaluator(const char *string, Unit const *unit) : **/ EvaluatorQuantity ExpressionEvaluator::evaluate() { - if (!g_utf8_validate(string, -1, NULL)) { - throw EvaluatorException("Invalid UTF8 string", NULL); + if (!g_utf8_validate(string, -1, nullptr)) { + throw EvaluatorException("Invalid UTF8 string", nullptr); } EvaluatorQuantity result = EvaluatorQuantity(); EvaluatorQuantity default_unit_factor; // Empty expression evaluates to 0 - if (acceptToken(TOKEN_END, NULL)) { + if (acceptToken(TOKEN_END, nullptr)) { return result; } result = evaluateExpression(); // There should be nothing left to parse by now - isExpected(TOKEN_END, 0); + isExpected(TOKEN_END, nullptr); - resolveUnit(NULL, &default_unit_factor, unit); + resolveUnit(nullptr, &default_unit_factor, unit); // Entire expression is dimensionless, apply default unit if applicable if ( result.dimension == 0 && default_unit_factor.dimension != 0 ) { @@ -112,7 +112,7 @@ EvaluatorQuantity ExpressionEvaluator::evaluateExpression() // Continue evaluating terms, chained with + or -. for (subtract = FALSE; - acceptToken('+', NULL) || (subtract = acceptToken('-', NULL)); + acceptToken('+', nullptr) || (subtract = acceptToken('-', nullptr)); subtract = FALSE) { EvaluatorQuantity new_term = evaluateTerm(); @@ -121,7 +121,7 @@ EvaluatorQuantity ExpressionEvaluator::evaluateExpression() if ( new_term.dimension != evaluated_terms.dimension ) { EvaluatorQuantity default_unit_factor; - resolveUnit(NULL, &default_unit_factor, unit); + resolveUnit(nullptr, &default_unit_factor, unit); if ( new_term.dimension == 0 && evaluated_terms.dimension == default_unit_factor.dimension ) @@ -150,7 +150,7 @@ EvaluatorQuantity ExpressionEvaluator::evaluateTerm() EvaluatorQuantity evaluated_exp_terms = evaluateExpTerm(); for ( division = false; - acceptToken('*', NULL) || (division = acceptToken('/', NULL)); + acceptToken('*', nullptr) || (division = acceptToken('/', nullptr)); division = false ) { EvaluatorQuantity new_exp_term = evaluateExpTerm(); @@ -171,7 +171,7 @@ EvaluatorQuantity ExpressionEvaluator::evaluateExpTerm() { EvaluatorQuantity evaluated_signed_factors = evaluateSignedFactor(); - while(acceptToken('^', NULL)) { + while(acceptToken('^', nullptr)) { EvaluatorQuantity new_signed_factor = evaluateSignedFactor(); if (new_signed_factor.dimension == 0) { @@ -191,8 +191,8 @@ EvaluatorQuantity ExpressionEvaluator::evaluateSignedFactor() EvaluatorQuantity result; bool negate = FALSE; - if (!acceptToken('+', NULL)) { - negate = acceptToken ('-', NULL); + if (!acceptToken('+', nullptr)) { + negate = acceptToken ('-', nullptr); } result = evaluateFactor(); @@ -214,9 +214,9 @@ EvaluatorQuantity ExpressionEvaluator::evaluateFactor() } else if (acceptToken(TOKEN_NUM, &consumed_token)) { evaluated_factor.value = consumed_token.value.fl; - } else if (acceptToken('(', NULL)) { + } else if (acceptToken('(', nullptr)) { evaluated_factor = evaluateExpression(); - isExpected(')', 0); + isExpected(')', nullptr); } else { throwError("Expected number or '('"); } @@ -279,7 +279,7 @@ void ExpressionEvaluator::parseNextToken() acceptTokenCount(1, s[0]); } else { // Attempt to parse a numeric value - char *endptr = NULL; + char *endptr = nullptr; gdouble value = g_strtod(s, &endptr); if ( endptr && endptr != s ) { diff --git a/src/util/expression-evaluator.h b/src/util/expression-evaluator.h index c912f248b..bb29d7f26 100644 --- a/src/util/expression-evaluator.h +++ b/src/util/expression-evaluator.h @@ -133,7 +133,7 @@ public: class ExpressionEvaluator { public: - ExpressionEvaluator(const char *string, Unit const *unit = NULL); + ExpressionEvaluator(const char *string, Unit const *unit = nullptr); EvaluatorQuantity evaluate(); diff --git a/src/util/forward-pointer-iterator.h b/src/util/forward-pointer-iterator.h index 4d1cfa413..4f8e88637 100644 --- a/src/util/forward-pointer-iterator.h +++ b/src/util/forward-pointer-iterator.h @@ -61,7 +61,7 @@ public: return old; } - operator bool() const { return _p != NULL; } + operator bool() const { return _p != nullptr; } private: pointer _p; diff --git a/src/util/list.h b/src/util/list.h index 563b6091c..ea2fa871e 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -60,7 +60,7 @@ public: typedef typename Traits::Reference<value_type>::RValue const_reference; typedef typename Traits::Reference<value_type>::Pointer pointer; - List() : _cell(NULL) {} + List() : _cell(nullptr) {} explicit List(const_reference value, List const &next=List()) : _cell(new ListCell<T>(value, next._cell)) {} @@ -157,7 +157,7 @@ public: typedef typename Traits::Reference<value_type>::RValue const_reference; typedef typename Traits::Reference<value_type>::Pointer pointer; - List() : _cell(NULL) {} + List() : _cell(nullptr) {} List(const_reference value, List const &next=List()) : _cell(new ListCell<T &>(value, next._cell)) {} diff --git a/src/util/share.cpp b/src/util/share.cpp index d5d93fc75..a9c648d6c 100644 --- a/src/util/share.cpp +++ b/src/util/share.cpp @@ -17,12 +17,12 @@ namespace Inkscape { namespace Util { ptr_shared share_string(char const *string) { - g_return_val_if_fail(string != NULL, share_unsafe(NULL)); + g_return_val_if_fail(string != nullptr, share_unsafe(nullptr)); return share_string(string, std::strlen(string)); } ptr_shared share_string(char const *string, std::size_t length) { - g_return_val_if_fail(string != NULL, share_unsafe(NULL)); + g_return_val_if_fail(string != nullptr, share_unsafe(nullptr)); char *new_string=new (GC::ATOMIC) char[length+1]; std::memcpy(new_string, string, length); new_string[length] = 0; diff --git a/src/util/share.h b/src/util/share.h index 6e98c5258..a2672afa4 100644 --- a/src/util/share.h +++ b/src/util/share.h @@ -23,7 +23,7 @@ namespace Util { class ptr_shared { public: - ptr_shared() : _string(NULL) {} + ptr_shared() : _string(nullptr) {} ptr_shared(ptr_shared const &other) : _string(other._string) {} operator char const *() const { return _string; } diff --git a/src/util/units.cpp b/src/util/units.cpp index cd7b66ba8..7854abf77 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -462,7 +462,7 @@ void UnitParser::on_text(Ctx &ctx, Glib::ustring const &text) unit.abbr = text; } else if (element == "factor") { // TODO make sure we use the right conversion - unit.factor = g_ascii_strtod(text.c_str(), NULL); + unit.factor = g_ascii_strtod(text.c_str(), nullptr); } else if (element == "description") { unit.description = text; } diff --git a/src/util/ziptool.cpp b/src/util/ziptool.cpp index b8253627c..e5ece00e4 100644 --- a/src/util/ziptool.cpp +++ b/src/util/ziptool.cpp @@ -1588,7 +1588,7 @@ bool GzipFile::write() putByte( 8); //compression method putByte(0x08); //flags. say we have a crc and file name - unsigned long ltime = (unsigned long) time(NULL); + unsigned long ltime = (unsigned long) time(nullptr); putLong(ltime); //xfl @@ -2235,7 +2235,7 @@ ZipEntry *ZipFile::addFile(const std::string &fileName, if (!ze->readFile(fileName, comment)) { delete ze; - return NULL; + return nullptr; } entries.push_back(ze); return ze; diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index de4e834bd..eed4cd48e 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -155,7 +155,7 @@ static void vp_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui drag->draggers.erase(std::remove(drag->draggers.begin(), drag->draggers.end(), dragger), drag->draggers.end()); delete dragger; - dragger = NULL; + dragger = nullptr; // ... and merge any duplicate perspectives d_new->mergePerspectives(); @@ -268,7 +268,7 @@ std::list<SPBox3D *> VanishingPoint::selectedBoxes(Inkscape::Selection *sel) VPDragger::VPDragger(VPDrag *parent, Geom::Point p, VanishingPoint &vp) : parent(parent) - , knot(NULL) + , knot(nullptr) , point(p) , point_original(p) , dragging_started(false) @@ -276,7 +276,7 @@ VPDragger::VPDragger(VPDrag *parent, Geom::Point p, VanishingPoint &vp) { if (vp.is_finite()) { // create the knot - this->knot = new SPKnot(SP_ACTIVE_DESKTOP, NULL); + this->knot = new SPKnot(SP_ACTIVE_DESKTOP, nullptr); this->knot->setMode(SP_KNOT_MODE_XOR); this->knot->setFill(VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL); this->knot->setStroke(0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff); @@ -319,7 +319,7 @@ void VPDragger::updateTip() { if (this->knot && this->knot->tip) { g_free(this->knot->tip); - this->knot->tip = NULL; + this->knot->tip = nullptr; } guint num = this->numberOfBoxes(); @@ -389,7 +389,7 @@ VanishingPoint *VPDragger::findVPWithBox(SPBox3D *box) return &(*vp); } } - return NULL; + return nullptr; } std::set<VanishingPoint *, less_ptr> VPDragger::VPsOfSelectedBoxes() @@ -534,7 +534,7 @@ VPDragger *VPDrag::getDraggerFor(VanishingPoint const &vp) } } } - return NULL; + return nullptr; } void VPDrag::printDraggers() @@ -560,7 +560,7 @@ void VPDrag::updateDraggers() } this->draggers.clear(); - g_return_if_fail(this->selection != NULL); + g_return_if_fail(this->selection != nullptr); auto itemlist = this->selection->items(); for (auto i = itemlist.begin(); i != itemlist.end(); ++i) { @@ -592,7 +592,7 @@ void VPDrag::updateLines() if (this->show_lines == 0) return; - g_return_if_fail(this->selection != NULL); + g_return_if_fail(this->selection != nullptr); auto itemlist = this->selection->items(); for (auto i = itemlist.begin(); i != itemlist.end(); ++i) { @@ -621,8 +621,8 @@ void VPDrag::updateBoxHandles() } Inkscape::UI::Tools::ToolBase *ec = INKSCAPE.active_event_context(); - g_assert(ec != NULL); - if (ec->shape_editor != NULL) { + g_assert(ec != nullptr); + if (ec->shape_editor != nullptr) { ec->shape_editor->update_knotholder(); } } diff --git a/src/vanishing-point.h b/src/vanishing-point.h index b4c2f7917..afefa613e 100644 --- a/src/vanishing-point.h +++ b/src/vanishing-point.h @@ -41,7 +41,7 @@ enum VPState { // FIXME: Don't store the box in the VP but rather the perspective (and link the box to it)!! class VanishingPoint { public: - VanishingPoint() : my_counter(VanishingPoint::global_counter++), _persp(NULL), _axis(Proj::NONE) {} + VanishingPoint() : my_counter(VanishingPoint::global_counter++), _persp(nullptr), _axis(Proj::NONE) {} VanishingPoint(Persp3D *persp, Proj::Axis axis) : my_counter(VanishingPoint::global_counter++), _persp(persp), _axis(axis) {} VanishingPoint(const VanishingPoint &other) : my_counter(VanishingPoint::global_counter++), _persp(other._persp), _axis(other._axis) {} diff --git a/src/verbs.cpp b/src/verbs.cpp index 5e4ce8725..0abb51303 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -367,11 +367,11 @@ Verb::VerbIDTable Verb::_verb_ids; * in the \c _verbs hashtable which is indexed by the \c code. */ Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image, gchar const *group) : - _actions(0), + _actions(nullptr), _id(id), _name(name), _tip(tip), - _full_tip(0), + _full_tip(nullptr), _shortcut(0), _image(image), _code(0), @@ -399,7 +399,7 @@ Verb::~Verb(void) if (_full_tip) { g_free(_full_tip); - _full_tip = 0; + _full_tip = nullptr; } } @@ -414,7 +414,7 @@ Verb::~Verb(void) SPAction *Verb::make_action(Inkscape::ActionContext const & /*context*/) { //std::cout << "make_action" << std::endl; - return NULL; + return nullptr; } /** @@ -597,7 +597,7 @@ SPAction *Verb::make_action_helper(Inkscape::ActionContext const & context, void action = sp_action_new(context, _id, _(_name), _(_tip), _image, this); - if (action == NULL) return NULL; + if (action == nullptr) return nullptr; action->signal_perform.connect( sigc::bind( @@ -631,9 +631,9 @@ SPAction *Verb::make_action_helper(Inkscape::ActionContext const & context, void */ SPAction *Verb::get_action(Inkscape::ActionContext const & context) { - SPAction *action = NULL; + SPAction *action = nullptr; - if ( _actions == NULL ) { + if ( _actions == nullptr ) { _actions = new ActionTable; } ActionTable::iterator action_found = _actions->find(context.getView()); @@ -644,14 +644,14 @@ SPAction *Verb::get_action(Inkscape::ActionContext const & context) action = this->make_action(context); // if (action == NULL) printf("Hmm, NULL in %s\n", _name); - if (action == NULL) printf("Hmm, NULL in %s\n", _name); + if (action == nullptr) printf("Hmm, NULL in %s\n", _name); if (!_default_sensitive) { sp_action_set_sensitive(action, 0); } else { for (ActionTable::iterator cur_action = _actions->begin(); - cur_action != _actions->end() && context.getView() != NULL; + cur_action != _actions->end() && context.getView() != nullptr; ++cur_action) { - if (cur_action->first != NULL && cur_action->first->doc() == context.getDocument()) { + if (cur_action->first != nullptr && cur_action->first->doc() == context.getDocument()) { sp_action_set_sensitive(action, cur_action->second->sensitive); break; } @@ -667,7 +667,7 @@ SPAction *Verb::get_action(Inkscape::ActionContext const & context) /* static */ bool Verb::ensure_desktop_valid(SPAction *action) { - if (sp_action_get_desktop(action) != NULL) { + if (sp_action_get_desktop(action) != nullptr) { return true; } g_printerr("WARNING: ignoring verb %s - GUI required for this verb.\n", action->id); @@ -677,17 +677,17 @@ bool Verb::ensure_desktop_valid(SPAction *action) void Verb::sensitive(SPDocument *in_doc, bool in_sensitive) { // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive); - if (_actions != NULL) { + if (_actions != nullptr) { for (ActionTable::iterator cur_action = _actions->begin(); cur_action != _actions->end(); ++cur_action) { - if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) { + if (in_doc == nullptr || (cur_action->first != nullptr && cur_action->first->doc() == in_doc)) { sp_action_set_sensitive(cur_action->second, in_sensitive ? 1 : 0); } } } - if (in_doc == NULL) { + if (in_doc == nullptr) { _default_sensitive = in_sensitive; } @@ -699,20 +699,20 @@ void Verb::sensitive(SPDocument *in_doc, bool in_sensitive) */ gchar const *Verb::get_tip(void) { - gchar const *result = 0; + gchar const *result = nullptr; if (_tip) { unsigned int shortcut = sp_shortcut_get_primary(this); if ( (shortcut != _shortcut) || !_full_tip) { if (_full_tip) { g_free(_full_tip); - _full_tip = 0; + _full_tip = nullptr; } _shortcut = shortcut; gchar* shortcutString = sp_shortcut_get_label(shortcut); if (shortcutString) { _full_tip = g_strdup_printf("%s (%s)", _(_tip), shortcutString); g_free(shortcutString); - shortcutString = 0; + shortcutString = nullptr; } else { _full_tip = g_strdup(_(_tip)); } @@ -726,11 +726,11 @@ gchar const *Verb::get_tip(void) void Verb::name(SPDocument *in_doc, Glib::ustring in_name) { - if (_actions != NULL) { + if (_actions != nullptr) { for (ActionTable::iterator cur_action = _actions->begin(); cur_action != _actions->end(); ++cur_action) { - if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) { + if (in_doc == nullptr || (cur_action->first != nullptr && cur_action->first->doc() == in_doc)) { sp_action_set_name(cur_action->second, in_name); } } @@ -749,7 +749,7 @@ Verb::name(SPDocument *in_doc, Glib::ustring in_name) */ void Verb::delete_view(Inkscape::UI::View::View *view) { - if (_actions == NULL) return; + if (_actions == nullptr) return; if (_actions->empty()) return; #if 0 @@ -809,7 +809,7 @@ void Verb::delete_all_view(Inkscape::UI::View::View *view) */ Verb *Verb::get_search(unsigned int code) { - Verb *verb = NULL; + Verb *verb = nullptr; VerbTable::iterator verb_found = _verbs.find(code); if (verb_found != _verbs.end()) { @@ -830,14 +830,14 @@ Verb *Verb::get_search(unsigned int code) */ Verb *Verb::getbyid(gchar const *id, bool verbose) { - Verb *verb = NULL; + Verb *verb = nullptr; VerbIDTable::iterator verb_found = _verb_ids.find(id); if (verb_found != _verb_ids.end()) { verb = verb_found->second; } - if (verb == NULL + if (verb == nullptr #if !HAVE_POTRACE // Squash warning about disabled features && strcmp(id, "ToolPaintBucket") != 0 @@ -882,7 +882,7 @@ void FileVerb::perform(SPAction *action, void *data) SPDesktop *desktop = sp_action_get_desktop(action); Gtk::Window *parent = desktop->getToplevel(); - g_assert(parent != NULL); + g_assert(parent != nullptr); switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_FILE_NEW: @@ -890,7 +890,7 @@ void FileVerb::perform(SPAction *action, void *data) break; case SP_VERB_FILE_OPEN: prefs->setString("/options/openmethod/value", "open"); - sp_file_open_dialog(*parent, NULL, NULL); + sp_file_open_dialog(*parent, nullptr, nullptr); prefs->setString("/options/openmethod/value", "done"); break; case SP_VERB_FILE_REVERT: @@ -899,13 +899,13 @@ void FileVerb::perform(SPAction *action, void *data) prefs->setString("/options/openmethod/value", "done"); break; case SP_VERB_FILE_SAVE: - sp_file_save(*parent, NULL, NULL); + sp_file_save(*parent, nullptr, nullptr); break; case SP_VERB_FILE_SAVE_AS: - sp_file_save_as(*parent, NULL, NULL); + sp_file_save_as(*parent, nullptr, nullptr); break; case SP_VERB_FILE_SAVE_A_COPY: - sp_file_save_a_copy(*parent, NULL, NULL); + sp_file_save_a_copy(*parent, nullptr, nullptr); break; case SP_VERB_FILE_SAVE_TEMPLATE: Inkscape::UI::Dialog::SaveTemplate::save_document_as_template(*parent); @@ -936,7 +936,7 @@ void FileVerb::perform(SPAction *action, void *data) INKSCAPE.switch_desktops_prev(); break; case SP_VERB_FILE_CLOSE_VIEW: - sp_ui_close_view(NULL); + sp_ui_close_view(nullptr); break; case SP_VERB_FILE_TEMPLATES: prefs->setString("/options/openmethod/value", "template"); @@ -1236,7 +1236,7 @@ void SelectionVerb::perform(SPAction *action, void *data) // The remaining operations require a desktop g_return_if_fail(ensure_desktop_valid(action)); - g_assert(dt->_dlg_mgr != NULL); + g_assert(dt->_dlg_mgr != nullptr); switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_SELECTION_TEXTTOPATH: @@ -1400,7 +1400,7 @@ void LayerVerb::perform(SPAction *action, void *data) } SPItem *layer=SP_ITEM(dt->currentLayer()); - g_return_if_fail(layer != NULL); + g_return_if_fail(layer != nullptr); SPObject *old_pos = layer->getNext(); @@ -1420,7 +1420,7 @@ void LayerVerb::perform(SPAction *action, void *data) } if ( layer->getNext() != old_pos ) { - char const *message = NULL; + char const *message = nullptr; Glib::ustring description = ""; switch (verb) { case SP_VERB_LAYER_TO_TOP: @@ -1478,7 +1478,7 @@ void LayerVerb::perform(SPAction *action, void *data) if (survivor == old_layer->lastChild()) { //oops: layer_fns messed up. BADLY. - survivor = NULL; + survivor = nullptr; } // Deleting the old layer before switching layers is a hack to trigger the // listeners of the deletion event (as happens when old_layer is deleted using the @@ -1677,7 +1677,7 @@ void TagVerb::perform( SPAction *action, void *data) switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_TAG_NEW: static int tag_suffix=1; - id=NULL; + id=nullptr; do { g_free(id); id = g_strdup_printf(_("Set %d"), tag_suffix++); @@ -1688,7 +1688,7 @@ void TagVerb::perform( SPAction *action, void *data) repr->setAttribute("id", id); g_free(id); - dt->doc()->getDefs()->addChild(repr, NULL); + dt->doc()->getDefs()->addChild(repr, nullptr); Inkscape::DocumentUndo::done(dt->doc(), SP_VERB_DIALOG_TAGS, _("Create new selection set")); break; default: @@ -2186,7 +2186,7 @@ void DialogVerb::perform(SPAction *action, void *data) g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - g_assert(dt->_dlg_mgr != NULL); + g_assert(dt->_dlg_mgr != nullptr); switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_DIALOG_PROTOTYPE: @@ -2310,7 +2310,7 @@ void HelpVerb::perform(SPAction *action, void *data) { g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - g_assert(dt->_dlg_mgr != NULL); + g_assert(dt->_dlg_mgr != nullptr); switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_HELP_ABOUT: @@ -2350,42 +2350,42 @@ void TutorialVerb::perform(SPAction *action, void *data) // TRANSLATORS: If you have translated the tutorial-basic.en.svgz file to your language, // then translate this string as "tutorial-basic.LANG.svgz" (where LANG is your language // code); otherwise leave as "tutorial-basic.svg". - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-basic.svg")); break; case SP_VERB_TUTORIAL_SHAPES: // TRANSLATORS: See "tutorial-basic.svg" comment. - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-shapes.svg")); break; case SP_VERB_TUTORIAL_ADVANCED: // TRANSLATORS: See "tutorial-basic.svg" comment. - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-advanced.svg")); break; #if HAVE_POTRACE case SP_VERB_TUTORIAL_TRACING: // TRANSLATORS: See "tutorial-basic.svg" comment. - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-tracing.svg")); break; #endif case SP_VERB_TUTORIAL_TRACING_PIXELART: - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing-pixelart.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-tracing-pixelart.svg")); break; case SP_VERB_TUTORIAL_CALLIGRAPHY: // TRANSLATORS: See "tutorial-basic.svg" comment. - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-calligraphy.svg")); break; case SP_VERB_TUTORIAL_INTERPOLATE: // TRANSLATORS: See "tutorial-basic.svg" comment. - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-interpolate.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-interpolate.svg")); break; case SP_VERB_TUTORIAL_DESIGN: // TRANSLATORS: See "tutorial-basic.svg" comment. - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-elements.svg")); break; case SP_VERB_TUTORIAL_TIPS: // TRANSLATORS: See "tutorial-basic.svg" comment. - sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg")); + sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-tips.svg")); break; default: break; @@ -2438,7 +2438,7 @@ void EffectLastVerb::perform(SPAction *action, void *data) Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect(); - if (effect == NULL) return; + if (effect == nullptr) return; switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_EFFECT_LAST_PREF: @@ -2597,8 +2597,8 @@ void LockAndHideVerb::perform(SPAction *action, void *data) // these must be in the same order as the SP_VERB_* enum in "verbs.h" Verb *Verb::_base_verbs[] = { // Header - new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL, NULL), - new Verb(SP_VERB_NONE, "None", NC_("Verb", "None"), N_("Does nothing"), NULL, NULL), + new Verb(SP_VERB_INVALID, nullptr, nullptr, nullptr, nullptr, nullptr), + new Verb(SP_VERB_NONE, "None", NC_("Verb", "None"), N_("Does nothing"), nullptr, nullptr), // File new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("_New"), N_("Create new document from the default template"), @@ -2612,9 +2612,9 @@ Verb *Verb::_base_verbs[] = { new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."), N_("Save document under a new name"), INKSCAPE_ICON("document-save-as")), new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."), - N_("Save a copy of the document under a new name"), NULL ), + N_("Save a copy of the document under a new name"), nullptr ), new FileVerb(SP_VERB_FILE_SAVE_TEMPLATE, "FileSaveTemplate", N_("Save template ..."), - N_("Save a copy of the document as template"), NULL ), + N_("Save a copy of the document as template"), nullptr ), new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"), INKSCAPE_ICON("document-print")), // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions) @@ -2650,25 +2650,25 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"), N_("Apply the style of the copied object to selection"), INKSCAPE_ICON("edit-paste-style")), new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"), - N_("Scale selection to match the size of the copied object"), NULL), + N_("Scale selection to match the size of the copied object"), nullptr), new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"), - N_("Scale selection horizontally to match the width of the copied object"), NULL), + N_("Scale selection horizontally to match the width of the copied object"), nullptr), new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"), - N_("Scale selection vertically to match the height of the copied object"), NULL), + N_("Scale selection vertically to match the height of the copied object"), nullptr), new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"), - N_("Scale each selected object to match the size of the copied object"), NULL), + N_("Scale each selected object to match the size of the copied object"), nullptr), new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"), - N_("Scale each selected object horizontally to match the width of the copied object"), NULL), + N_("Scale each selected object horizontally to match the width of the copied object"), nullptr), new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"), - N_("Scale each selected object vertically to match the height of the copied object"), NULL), + N_("Scale each selected object vertically to match the height of the copied object"), nullptr), new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"), N_("Paste objects from clipboard to the original location"), INKSCAPE_ICON("edit-paste-in-place")), new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "PasteLivePathEffect", N_("Paste Path _Effect"), - N_("Apply the path effect of the copied object to selection"), NULL), + N_("Apply the path effect of the copied object to selection"), nullptr), new EditVerb(SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, "RemoveLivePathEffect", N_("Remove Path _Effect"), - N_("Remove any path effects from selected objects"), NULL), + N_("Remove any path effects from selected objects"), nullptr), new EditVerb(SP_VERB_EDIT_REMOVE_FILTER, "RemoveFilter", N_("_Remove Filters"), - N_("Remove any filters from selected objects"), NULL), + N_("Remove any filters from selected objects"), nullptr), new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"), N_("Delete selection"), INKSCAPE_ICON("edit-delete")), new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"), @@ -2680,25 +2680,25 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_UNLINK_CLONE_RECURSIVE, "EditUnlinkCloneRecursive", N_("Unlink Clones _recursively"), N_("Unlink all clones in the selection, even if they are in groups."), INKSCAPE_ICON("edit-clone-unlink")), new EditVerb(SP_VERB_EDIT_RELINK_CLONE, "EditRelinkClone", N_("Relink to Copied"), - N_("Relink the selected clones to the object currently on the clipboard"), NULL), + N_("Relink the selected clones to the object currently on the clipboard"), nullptr), new EditVerb(SP_VERB_EDIT_CLONE_SELECT_ORIGINAL, "EditCloneSelectOriginal", N_("Select _Original"), N_("Select the object to which the selected clone is linked"), INKSCAPE_ICON("edit-select-original")), new EditVerb(SP_VERB_EDIT_CLONE_ORIGINAL_PATH_LPE, "EditCloneOriginalPathLPE", N_("Clone original path (LPE)"), - N_("Creates a new path, applies the Clone original LPE, and refers it to the selected path"), NULL), + N_("Creates a new path, applies the Clone original LPE, and refers it to the selected path"), nullptr), new EditVerb(SP_VERB_EDIT_SELECTION_2_MARKER, "ObjectsToMarker", N_("Objects to _Marker"), - N_("Convert selection to a line marker"), NULL), + N_("Convert selection to a line marker"), nullptr), new EditVerb(SP_VERB_EDIT_SELECTION_2_GUIDES, "ObjectsToGuides", N_("Objects to Gu_ides"), - N_("Convert selected objects to a collection of guidelines aligned with their edges"), NULL), + N_("Convert selected objects to a collection of guidelines aligned with their edges"), nullptr), new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"), - N_("Convert selection to a rectangle with tiled pattern fill"), NULL), + N_("Convert selection to a rectangle with tiled pattern fill"), nullptr), new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"), - N_("Extract objects from a tiled pattern fill"), NULL), + N_("Extract objects from a tiled pattern fill"), nullptr), new EditVerb(SP_VERB_EDIT_SYMBOL, "ObjectsToSymbol", N_("Group to Symbol"), - N_("Convert group to a symbol"), NULL), + N_("Convert group to a symbol"), nullptr), new EditVerb(SP_VERB_EDIT_UNSYMBOL, "ObjectsFromSymbol", N_("Symbol to Group"), - N_("Extract group from a symbol"), NULL), + N_("Extract group from a symbol"), nullptr), new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"), - N_("Delete all objects from document"), NULL), + N_("Delete all objects from document"), nullptr), new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"), N_("Select all objects or all nodes"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"), @@ -2716,22 +2716,22 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"), N_("Invert selection (unselect what is selected and select everything else)"), INKSCAPE_ICON("edit-select-invert")), new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"), - N_("Invert selection in all visible and unlocked layers"), NULL), + N_("Invert selection in all visible and unlocked layers"), nullptr), new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"), - N_("Select next object or node"), NULL), + N_("Select next object or node"), nullptr), new EditVerb(SP_VERB_EDIT_SELECT_PREV, "EditSelectPrev", N_("Select Previous"), - N_("Select previous object or node"), NULL), + N_("Select previous object or node"), nullptr), new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"), N_("Deselect any selected objects or nodes"), INKSCAPE_ICON("edit-select-none")), new EditVerb(SP_VERB_EDIT_DELETE_ALL_GUIDES, "EditRemoveAllGuides", N_("Delete All Guides"), - N_("Delete all the guides in the document"), NULL), - new EditVerb(SP_VERB_EDIT_GUIDES_TOGGLE_LOCK, "EditGuidesToggleLock", N_("Lock All Guides"), N_("Toggle lock of all guides in the document"), NULL), + N_("Delete all the guides in the document"), nullptr), + new EditVerb(SP_VERB_EDIT_GUIDES_TOGGLE_LOCK, "EditGuidesToggleLock", N_("Lock All Guides"), N_("Toggle lock of all guides in the document"), nullptr), new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("Create _Guides Around the Page"), - N_("Create four guides aligned with the page borders"), NULL), + N_("Create four guides aligned with the page borders"), nullptr), new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next path effect parameter"), N_("Show next editable path effect parameter"), INKSCAPE_ICON("path-effect-parameter-next")), new EditVerb(SP_VERB_EDIT_SWAP_FILL_STROKE, "EditSwapFillStroke", N_("Swap fill and stroke"), - N_("Swap fill and stroke of an object"), NULL), + N_("Swap fill and stroke of an object"), nullptr), // Selection new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"), @@ -2799,10 +2799,10 @@ Verb *Verb::_base_verbs[] = { N_("Outset selected paths"), INKSCAPE_ICON("path-outset")), new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen", N_("O_utset Path by 1 px"), - N_("Outset selected paths by 1 px"), NULL), + N_("Outset selected paths by 1 px"), nullptr), new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10", N_("O_utset Path by 10 px"), - N_("Outset selected paths by 10 px"), NULL), + N_("Outset selected paths by 10 px"), nullptr), // TRANSLATORS: "inset": contract a shape by offsetting the object's path, // i.e. by displacing it perpendicular to the path in each point. // See also the Advanced Tutorial for explanation. @@ -2810,10 +2810,10 @@ Verb *Verb::_base_verbs[] = { N_("Inset selected paths"), INKSCAPE_ICON("path-inset")), new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen", N_("I_nset Path by 1 px"), - N_("Inset selected paths by 1 px"), NULL), + N_("Inset selected paths by 1 px"), nullptr), new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10", N_("I_nset Path by 10 px"), - N_("Inset selected paths by 10 px"), NULL), + N_("Inset selected paths by 10 px"), nullptr), new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset", N_("D_ynamic Offset"), N_("Create a dynamic offset object"), INKSCAPE_ICON("path-offset-dynamic")), new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset", @@ -2875,21 +2875,21 @@ Verb *Verb::_base_verbs[] = { new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"), N_("Delete the current layer"), INKSCAPE_ICON("layer-delete")), new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"), - N_("Solo the current layer"), NULL), + N_("Solo the current layer"), nullptr), new LayerVerb(SP_VERB_LAYER_SHOW_ALL, "LayerShowAll", N_("_Show all layers"), - N_("Show all the layers"), NULL), + N_("Show all the layers"), nullptr), new LayerVerb(SP_VERB_LAYER_HIDE_ALL, "LayerHideAll", N_("_Hide all layers"), - N_("Hide all the layers"), NULL), + N_("Hide all the layers"), nullptr), new LayerVerb(SP_VERB_LAYER_LOCK_ALL, "LayerLockAll", N_("_Lock all layers"), - N_("Lock all the layers"), NULL), + N_("Lock all the layers"), nullptr), new LayerVerb(SP_VERB_LAYER_LOCK_OTHERS, "LayerLockOthers", N_("Lock/Unlock _other layers"), - N_("Lock all the other layers"), NULL), + N_("Lock all the other layers"), nullptr), new LayerVerb(SP_VERB_LAYER_UNLOCK_ALL, "LayerUnlockAll", N_("_Unlock all layers"), - N_("Unlock all the layers"), NULL), + N_("Unlock all the layers"), nullptr), new LayerVerb(SP_VERB_LAYER_TOGGLE_LOCK, "LayerToggleLock", N_("_Lock/Unlock Current Layer"), - N_("Toggle lock on current layer"), NULL), + N_("Toggle lock on current layer"), nullptr), new LayerVerb(SP_VERB_LAYER_TOGGLE_HIDE, "LayerToggleHide", N_("_Show/hide Current Layer"), - N_("Toggle visibility of current layer"), NULL), + N_("Toggle visibility of current layer"), nullptr), // Object new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90\xc2\xb0 CW"), @@ -2901,7 +2901,7 @@ Verb *Verb::_base_verbs[] = { // must use UTF-8, not HTML entities for special characters. N_("Rotate selection 90\xc2\xb0 counter-clockwise"), INKSCAPE_ICON("object-rotate-left")), new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"), - N_("Remove transformations from object"), NULL), + N_("Remove transformations from object"), nullptr), new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"), N_("Convert selected object to path"), INKSCAPE_ICON("object-to-path")), new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"), @@ -2917,26 +2917,26 @@ Verb *Verb::_base_verbs[] = { N_("Flip _Vertical"), N_("Flip selected objects vertically"), INKSCAPE_ICON("object-flip-vertical")), new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"), - N_("Apply mask to selection (using the topmost object as mask)"), NULL), + N_("Apply mask to selection (using the topmost object as mask)"), nullptr), new ObjectVerb(SP_VERB_OBJECT_SET_INVERSE_MASK, "ObjectSetInverseMask", N_("_Set Inverse (LPE)"), - N_("Apply inverse mask to selection (using the topmost object as mask)"), NULL), + N_("Apply inverse mask to selection (using the topmost object as mask)"), nullptr), new ObjectVerb(SP_VERB_OBJECT_EDIT_MASK, "ObjectEditMask", N_("_Edit"), N_("Edit mask"), INKSCAPE_ICON("path-mask-edit")), new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"), - N_("Remove mask from selection"), NULL), + N_("Remove mask from selection"), nullptr), new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"), - N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL), + N_("Apply clipping path to selection (using the topmost object as clipping path)"), nullptr), new ObjectVerb(SP_VERB_OBJECT_SET_INVERSE_CLIPPATH, "ObjectSetInverseClipPath", N_("_Set Inverse (LPE)"), - N_("Apply inverse clipping path to selection (using the topmost object as clipping path)"), NULL), + N_("Apply inverse clipping path to selection (using the topmost object as clipping path)"), nullptr), new ObjectVerb(SP_VERB_OBJECT_CREATE_CLIP_GROUP, "ObjectCreateClipGroup", N_("Create Cl_ip Group"), - N_("Creates a clip group using the selected objects as a base"), NULL), + N_("Creates a clip group using the selected objects as a base"), nullptr), new ObjectVerb(SP_VERB_OBJECT_EDIT_CLIPPATH, "ObjectEditClipPath", N_("_Edit"), N_("Edit clipping path"), INKSCAPE_ICON("path-clip-edit")), new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"), - N_("Remove clipping path from selection"), NULL), + N_("Remove clipping path from selection"), nullptr), // Tag new TagVerb(SP_VERB_TAG_NEW, "TagNew", N_("_New"), - N_("Create new selection set"), NULL), + N_("Create new selection set"), nullptr), // Tools new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", NC_("ContextVerb", "Select"), N_("Select and transform objects"), INKSCAPE_ICON("tool-pointer")), @@ -2983,60 +2983,60 @@ Verb *Verb::_base_verbs[] = { #endif new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", NC_("ContextVerb", "LPE Edit"), - N_("Edit Path Effect parameters"), NULL), + N_("Edit Path Effect parameters"), nullptr), new ContextVerb(SP_VERB_CONTEXT_ERASER, "ToolEraser", NC_("ContextVerb", "Eraser"), N_("Erase existing paths"), INKSCAPE_ICON("draw-eraser")), new ContextVerb(SP_VERB_CONTEXT_LPETOOL, "ToolLPETool", NC_("ContextVerb", "LPE Tool"), N_("Do geometric constructions"), "draw-geometry"), // Tool prefs new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"), - N_("Open Preferences for the Selector tool"), NULL), + N_("Open Preferences for the Selector tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"), - N_("Open Preferences for the Node tool"), NULL), + N_("Open Preferences for the Node tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_TWEAK_PREFS, "TweakPrefs", N_("Tweak Tool Preferences"), - N_("Open Preferences for the Tweak tool"), NULL), + N_("Open Preferences for the Tweak tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_SPRAY_PREFS, "SprayPrefs", N_("Spray Tool Preferences"), - N_("Open Preferences for the Spray tool"), NULL), + N_("Open Preferences for the Spray tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"), - N_("Open Preferences for the Rectangle tool"), NULL), + N_("Open Preferences for the Rectangle tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_3DBOX_PREFS, "3DBoxPrefs", N_("3D Box Preferences"), - N_("Open Preferences for the 3D Box tool"), NULL), + N_("Open Preferences for the 3D Box tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"), - N_("Open Preferences for the Ellipse tool"), NULL), + N_("Open Preferences for the Ellipse tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"), - N_("Open Preferences for the Star tool"), NULL), + N_("Open Preferences for the Star tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"), - N_("Open Preferences for the Spiral tool"), NULL), + N_("Open Preferences for the Spiral tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"), - N_("Open Preferences for the Pencil tool"), NULL), + N_("Open Preferences for the Pencil tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"), - N_("Open Preferences for the Pen tool"), NULL), + N_("Open Preferences for the Pen tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"), - N_("Open Preferences for the Calligraphy tool"), NULL), + N_("Open Preferences for the Calligraphy tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"), - N_("Open Preferences for the Text tool"), NULL), + N_("Open Preferences for the Text tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"), - N_("Open Preferences for the Gradient tool"), NULL), + N_("Open Preferences for the Gradient tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_MESH_PREFS, "Mesh_Prefs", N_("Mesh Preferences"), - N_("Open Preferences for the Mesh tool"), NULL), + N_("Open Preferences for the Mesh tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"), - N_("Open Preferences for the Zoom tool"), NULL), + N_("Open Preferences for the Zoom tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_MEASURE_PREFS, "MeasurePrefs", N_("Measure Preferences"), - N_("Open Preferences for the Measure tool"), NULL), + N_("Open Preferences for the Measure tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"), - N_("Open Preferences for the Dropper tool"), NULL), + N_("Open Preferences for the Dropper tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"), - N_("Open Preferences for the Connector tool"), NULL), + N_("Open Preferences for the Connector tool"), nullptr), #if HAVE_POTRACE new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"), - N_("Open Preferences for the Paint Bucket tool"), NULL), + N_("Open Preferences for the Paint Bucket tool"), nullptr), #endif new ContextVerb(SP_VERB_CONTEXT_ERASER_PREFS, "EraserPrefs", N_("Eraser Preferences"), - N_("Open Preferences for the Eraser tool"), NULL), + N_("Open Preferences for the Eraser tool"), nullptr), new ContextVerb(SP_VERB_CONTEXT_LPETOOL_PREFS, "LPEToolPrefs", N_("LPE Tool Preferences"), - N_("Open Preferences for the LPETool tool"), NULL), + N_("Open Preferences for the LPETool tool"), nullptr), // Zoom new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), INKSCAPE_ICON("zoom-in")), @@ -3060,57 +3060,57 @@ Verb *Verb::_base_verbs[] = { new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"), N_("Zoom to fit selection in window"), INKSCAPE_ICON("zoom-fit-selection")), - new ZoomVerb(SP_VERB_ROTATE_CW, "RotateClockwise", N_("Rotate Clockwise"), N_("Rotate canvas clockwise"), NULL), - new ZoomVerb(SP_VERB_ROTATE_CCW, "RotateCounterClockwise", N_("Rotate Counter-Clockwise"), N_("Rotate canvas counter-clockwise"), NULL), - new ZoomVerb(SP_VERB_ROTATE_ZERO, "RotateZero", N_("Reset Rotation"), N_("Reset canvas rotation to zero"), NULL), + new ZoomVerb(SP_VERB_ROTATE_CW, "RotateClockwise", N_("Rotate Clockwise"), N_("Rotate canvas clockwise"), nullptr), + new ZoomVerb(SP_VERB_ROTATE_CCW, "RotateCounterClockwise", N_("Rotate Counter-Clockwise"), N_("Rotate canvas counter-clockwise"), nullptr), + new ZoomVerb(SP_VERB_ROTATE_ZERO, "RotateZero", N_("Reset Rotation"), N_("Reset canvas rotation to zero"), nullptr), new ZoomVerb(SP_VERB_FLIP_HORIZONTAL, "FlipHorizontal", N_("Flip Horizontally"), N_("Flip canvas horizontally"), INKSCAPE_ICON("object-flip-horizontal")), new ZoomVerb(SP_VERB_FLIP_VERTICAL, "FlipVertical", N_("Flip Vertically"), N_("Flip canvas vertically"), INKSCAPE_ICON("object-flip-vertical")), - new ZoomVerb(SP_VERB_FLIP_NONE, "FlipNone", N_("Reset Flip"), N_("Undo any flip"), NULL), + new ZoomVerb(SP_VERB_FLIP_NONE, "FlipNone", N_("Reset Flip"), N_("Undo any flip"), nullptr), // WHY ARE THE FOLLOWING ZoomVerbs??? // View - new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), NULL), - new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), NULL), + new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), nullptr), new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("Page _Grid"), N_("Show or hide the page grid"), INKSCAPE_ICON("show-grid")), new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), INKSCAPE_ICON("show-guides")), new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Enable snapping"), INKSCAPE_ICON("snap")), - new ZoomVerb(SP_VERB_TOGGLE_COMMANDS_TOOLBAR, "ToggleCommandsToolbar", N_("_Commands Bar"), N_("Show or hide the Commands bar (under the menu)"), NULL), - new ZoomVerb(SP_VERB_TOGGLE_SNAP_TOOLBAR, "ToggleSnapToolbar", N_("Sn_ap Controls Bar"), N_("Show or hide the snapping controls"), NULL), - new ZoomVerb(SP_VERB_TOGGLE_TOOL_TOOLBAR, "ToggleToolToolbar", N_("T_ool Controls Bar"), N_("Show or hide the Tool Controls bar"), NULL), - new ZoomVerb(SP_VERB_TOGGLE_TOOLBOX, "ToggleToolbox", N_("_Toolbox"), N_("Show or hide the main toolbox (on the left)"), NULL), - new ZoomVerb(SP_VERB_TOGGLE_PALETTE, "TogglePalette", N_("_Palette"), N_("Show or hide the color palette"), NULL), - new ZoomVerb(SP_VERB_TOGGLE_STATUSBAR, "ToggleStatusbar", N_("_Statusbar"), N_("Show or hide the statusbar (at the bottom of the window)"), NULL), + new ZoomVerb(SP_VERB_TOGGLE_COMMANDS_TOOLBAR, "ToggleCommandsToolbar", N_("_Commands Bar"), N_("Show or hide the Commands bar (under the menu)"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_SNAP_TOOLBAR, "ToggleSnapToolbar", N_("Sn_ap Controls Bar"), N_("Show or hide the snapping controls"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_TOOL_TOOLBAR, "ToggleToolToolbar", N_("T_ool Controls Bar"), N_("Show or hide the Tool Controls bar"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_TOOLBOX, "ToggleToolbox", N_("_Toolbox"), N_("Show or hide the main toolbox (on the left)"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_PALETTE, "TogglePalette", N_("_Palette"), N_("Show or hide the color palette"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_STATUSBAR, "ToggleStatusbar", N_("_Statusbar"), N_("Show or hide the statusbar (at the bottom of the window)"), nullptr), new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"), INKSCAPE_ICON("view-fullscreen")), new ZoomVerb(SP_VERB_FULLSCREENFOCUS, "FullScreenFocus", N_("Fullscreen & Focus Mode"), N_("Stretch this document window to full screen"), INKSCAPE_ICON("view-fullscreen")), new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), N_("Remove excess toolbars to focus on drawing"), - NULL), + nullptr), new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"), INKSCAPE_ICON("window-new")), new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"), - N_("New View Preview"), NULL/*"view_new_preview"*/), + N_("New View Preview"), nullptr/*"view_new_preview"*/), new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"), - N_("Switch to normal display mode"), NULL), + N_("Switch to normal display mode"), nullptr), new ZoomVerb(SP_VERB_VIEW_MODE_NO_FILTERS, "ViewModeNoFilters", N_("No _Filters"), - N_("Switch to normal display without filters"), NULL), + N_("Switch to normal display without filters"), nullptr), new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"), - N_("Switch to outline (wireframe) display mode"), NULL), + N_("Switch to outline (wireframe) display mode"), nullptr), new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"), - N_("Toggle between normal and outline display modes"), NULL), + N_("Toggle between normal and outline display modes"), nullptr), new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_NORMAL, "ViewColorModeNormal", N_("_Normal"), - N_("Switch to normal color display mode"), NULL), + N_("Switch to normal color display mode"), nullptr), new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_GRAYSCALE, "ViewColorModeGrayscale", N_("_Grayscale"), - N_("Switch to grayscale display mode"), NULL), + N_("Switch to grayscale display mode"), nullptr), // new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_PRINT_COLORS_PREVIEW, "ViewColorModePrintColorsPreview", N_("_Print Colors Preview"), // N_("Switch to print colors preview mode"), NULL), new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_TOGGLE, "ViewColorModeToggle", N_("_Toggle"), - N_("Toggle between normal and grayscale color display modes"), NULL), + N_("Toggle between normal and grayscale color display modes"), nullptr), new ZoomVerb(SP_VERB_VIEW_CMS_TOGGLE, "ViewCmsToggle", N_("Color-managed view"), N_("Toggle color-managed display for this document window"), INKSCAPE_ICON("color-management")), @@ -3170,7 +3170,7 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."), N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON("dialog-input-devices")), new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."), - N_("Query information about extensions"), NULL), + N_("Query information about extensions"), nullptr), new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."), N_("View Layers"), INKSCAPE_ICON("dialog-layers")), new DialogVerb(SP_VERB_DIALOG_OBJECTS, "DialogObjects", N_("Object_s..."), @@ -3178,22 +3178,22 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_TAGS, "DialogTags", N_("Selection se_ts..."), N_("View Tags"), INKSCAPE_ICON("edit-select-all-layers")), new DialogVerb(SP_VERB_DIALOG_STYLE, "DialogStyle", N_("Style Dialog..."), - N_("View Style Dialog"), NULL), + N_("View Style Dialog"), nullptr), new DialogVerb(SP_VERB_DIALOG_CSS, "DialogCss", N_("Css Dialog..."), - N_("View Css Dialog"), NULL), + N_("View Css Dialog"), nullptr), new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path E_ffects ..."), N_("Manage, edit, and apply path effects"), INKSCAPE_ICON("dialog-path-effects")), new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter _Editor..."), N_("Manage, edit, and apply SVG filters"), INKSCAPE_ICON("dialog-filters")), new DialogVerb(SP_VERB_DIALOG_SVG_FONTS, "DialogSVGFonts", N_("SVG Font Editor..."), - N_("Edit SVG fonts"), NULL), + N_("Edit SVG fonts"), nullptr), new DialogVerb(SP_VERB_DIALOG_PRINT_COLORS_PREVIEW, "DialogPrintColorsPreview", N_("Print Colors..."), - N_("Select which color separations to render in Print Colors Preview rendermode"), NULL), + N_("Select which color separations to render in Print Colors Preview rendermode"), nullptr), new DialogVerb(SP_VERB_DIALOG_EXPORT, "DialogExport", N_("_Export PNG Image..."), N_("Export this document or a selection as a PNG image"), INKSCAPE_ICON("document-export")), // Help new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"), - N_("Information on Inkscape extensions"), NULL), + N_("Information on Inkscape extensions"), nullptr), new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"), N_("Memory usage information"), INKSCAPE_ICON("dialog-memory")), new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"), @@ -3203,67 +3203,67 @@ Verb *Verb::_base_verbs[] = { // Tutorials new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"), - N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/), + N_("Getting started with Inkscape"), nullptr/*"tutorial_basic"*/), new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"), - N_("Using shape tools to create and edit shapes"), NULL), + N_("Using shape tools to create and edit shapes"), nullptr), new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"), - N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/), + N_("Advanced Inkscape topics"), nullptr/*"tutorial_advanced"*/), #if HAVE_POTRACE // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize) new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"), - N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/), + N_("Using bitmap tracing"), nullptr/*"tutorial_tracing"*/), #endif new TutorialVerb(SP_VERB_TUTORIAL_TRACING_PIXELART, "TutorialsTracingPixelArt", N_("Inkscape: Tracing Pixel Art"), - N_("Using Trace Pixel Art dialog"), NULL), + N_("Using Trace Pixel Art dialog"), nullptr), new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"), - N_("Using the Calligraphy pen tool"), NULL), + N_("Using the Calligraphy pen tool"), nullptr), new TutorialVerb(SP_VERB_TUTORIAL_INTERPOLATE, "TutorialsInterpolate", N_("Inkscape: _Interpolate"), - N_("Using the interpolate extension"), NULL/*"tutorial_interpolate"*/), + N_("Using the interpolate extension"), nullptr/*"tutorial_interpolate"*/), new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"), - N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/), + N_("Principles of design in the tutorial form"), nullptr/*"tutorial_design"*/), new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"), - N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/), + N_("Miscellaneous tips and tricks"), nullptr/*"tutorial_tips"*/), // Effect -- renamed Extension new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Exte_nsion"), - N_("Repeat the last extension with the same settings"), NULL), + N_("Repeat the last extension with the same settings"), nullptr), new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("_Previous Extension Settings..."), - N_("Repeat the last extension with new settings"), NULL), + N_("Repeat the last extension with new settings"), nullptr), // Fit Page new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"), - N_("Fit the page to the current selection"), NULL), + N_("Fit the page to the current selection"), nullptr), new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"), - N_("Fit the page to the drawing"), NULL), + N_("Fit the page to the drawing"), nullptr), new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("_Resize Page to Selection"), - N_("Fit the page to the current selection or the drawing if there is no selection"), NULL), + N_("Fit the page to the current selection or the drawing if there is no selection"), nullptr), // LockAndHide new LockAndHideVerb(SP_VERB_UNLOCK_ALL, "UnlockAll", N_("Unlock All"), - N_("Unlock all objects in the current layer"), NULL), + N_("Unlock all objects in the current layer"), nullptr), new LockAndHideVerb(SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, "UnlockAllInAllLayers", N_("Unlock All in All Layers"), - N_("Unlock all objects in all layers"), NULL), + N_("Unlock all objects in all layers"), nullptr), new LockAndHideVerb(SP_VERB_UNHIDE_ALL, "UnhideAll", N_("Unhide All"), - N_("Unhide all objects in the current layer"), NULL), + N_("Unhide all objects in the current layer"), nullptr), new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"), - N_("Unhide all objects in all layers"), NULL), + N_("Unhide all objects in all layers"), nullptr), // Color Management new EditVerb(SP_VERB_EDIT_LINK_COLOR_PROFILE, "LinkColorProfile", N_("Link Color Profile"), - N_("Link an ICC color profile"), NULL), + N_("Link an ICC color profile"), nullptr), new EditVerb(SP_VERB_EDIT_REMOVE_COLOR_PROFILE, "RemoveColorProfile", N_("Remove Color Profile"), - N_("Remove a linked ICC color profile"), NULL), + N_("Remove a linked ICC color profile"), nullptr), // Scripting new ContextVerb(SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, "AddExternalScript", - N_("Add External Script"), N_("Add an external script"), NULL), + N_("Add External Script"), N_("Add an external script"), nullptr), new ContextVerb(SP_VERB_EDIT_ADD_EMBEDDED_SCRIPT, "AddEmbeddedScript", - N_("Add Embedded Script"), N_("Add an embedded script"), NULL), + N_("Add Embedded Script"), N_("Add an embedded script"), nullptr), new ContextVerb(SP_VERB_EDIT_EMBEDDED_SCRIPT, "EditEmbeddedScript", - N_("Edit Embedded Script"), N_("Edit an embedded script"), NULL), + N_("Edit Embedded Script"), N_("Edit an embedded script"), nullptr), new ContextVerb(SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, "RemoveExternalScript", - N_("Remove External Script"), N_("Remove an external script"), NULL), + N_("Remove External Script"), N_("Remove an external script"), nullptr), new ContextVerb(SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, "RemoveEmbeddedScript", - N_("Remove Embedded Script"), N_("Remove an embedded script"), NULL), + N_("Remove Embedded Script"), N_("Remove an embedded script"), nullptr), // Align new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, "AlignHorizontalRightToAnchor", N_("Align right edges of objects to the left edge of the anchor"), N_("Align right edges of objects to the left edge of the anchor"), INKSCAPE_ICON("align-horizontal-right-to-anchor")), @@ -3290,7 +3290,7 @@ Verb *Verb::_base_verbs[] = { // Footer - new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL, NULL) + new Verb(SP_VERB_LAST, " '\"invalid id", nullptr, nullptr, nullptr, nullptr) }; std::vector<Inkscape::Verb *> diff --git a/src/verbs.h b/src/verbs.h index 68ded5d72..afef793a1 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -431,9 +431,9 @@ private: to find the different verbs in the hash map. */ struct ltstr { bool operator()(const char* s1, const char* s2) const { - if ( (s1 == NULL) && (s2 != NULL) ) { + if ( (s1 == nullptr) && (s2 != nullptr) ) { return true; - } else if (s1 == NULL || s2 == NULL) { + } else if (s1 == nullptr || s2 == nullptr) { return false; } else { return strcmp(s1, s2) < 0; @@ -532,7 +532,7 @@ public: protected: - SPAction *make_action_helper (Inkscape::ActionContext const & context, void (*perform_fun)(SPAction *, void *), void *in_pntr = NULL); + SPAction *make_action_helper (Inkscape::ActionContext const & context, void (*perform_fun)(SPAction *, void *), void *in_pntr = nullptr); virtual SPAction *make_action (Inkscape::ActionContext const & context); public: @@ -564,11 +564,11 @@ public: char const * tip, char const * image, char const * group) : - _actions(0), + _actions(nullptr), _id(id), _name(name), _tip(tip), - _full_tip(0), + _full_tip(nullptr), _shortcut(0), _image(image), _code(code), @@ -616,8 +616,8 @@ public: static void delete_all_view (Inkscape::UI::View::View * view); void delete_view (Inkscape::UI::View::View * view); - void sensitive (SPDocument * in_doc = NULL, bool in_sensitive = true); - void name (SPDocument * in_doc = NULL, Glib::ustring in_name = ""); + void sensitive (SPDocument * in_doc = nullptr, bool in_sensitive = true); + void name (SPDocument * in_doc = nullptr, Glib::ustring in_name = ""); // Yes, multiple public, protected and private sections are bad. We'll clean that up later protected: diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index 7dcfc9771..7ebc20b6f 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -47,8 +47,8 @@ static void sp_button_class_init(SPButtonClass *klass) static void sp_button_init(SPButton *button) { - button->action = NULL; - button->doubleclick_action = NULL; + button->action = nullptr; + button->doubleclick_action = nullptr; new (&button->c_set_active) sigc::connection(); new (&button->c_set_sensitive) sigc::connection(); @@ -66,10 +66,10 @@ static void sp_button_dispose(GObject *object) SPButton *button = SP_BUTTON(object); if (button->action) { - sp_button_set_action(button, NULL); + sp_button_set_action(button, nullptr); } if (button->doubleclick_action) { - sp_button_set_doubleclick_action(button, NULL); + sp_button_set_doubleclick_action(button, nullptr); } button->c_set_active.~connection(); @@ -136,7 +136,7 @@ static gint sp_button_process_event(SPButton *button, GdkEvent *event) switch (event->type) { case GDK_2BUTTON_PRESS: if (button->doubleclick_action) { - sp_action_perform(button->doubleclick_action, NULL); + sp_action_perform(button->doubleclick_action, nullptr); } return TRUE; break; @@ -150,13 +150,13 @@ static gint sp_button_process_event(SPButton *button, GdkEvent *event) static void sp_button_perform_action(SPButton *button, gpointer /*data*/) { if (button->action) { - sp_action_perform(button->action, NULL); + sp_action_perform(button->action, nullptr); } } GtkWidget *sp_button_new(GtkIconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action) { - SPButton *button = SP_BUTTON(g_object_new(SP_TYPE_BUTTON, NULL)); + SPButton *button = SP_BUTTON(g_object_new(SP_TYPE_BUTTON, nullptr)); button->type = type; button->lsize = CLAMP(size, GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_DIALOG); @@ -251,15 +251,15 @@ static void sp_button_set_composed_tooltip(GtkWidget *widget, SPAction *action) } } else { // no action - gtk_widget_set_tooltip_text(widget, NULL); + gtk_widget_set_tooltip_text(widget, nullptr); } } GtkWidget *sp_button_new_from_data(GtkIconSize size, SPButtonType type, Inkscape::UI::View::View *view, const gchar *name, const gchar *tip) { - SPAction *action = sp_action_new(Inkscape::ActionContext(view), name, name, tip, name, 0); - GtkWidget *button = sp_button_new(size, type, action, NULL); + SPAction *action = sp_action_new(Inkscape::ActionContext(view), name, name, tip, name, nullptr); + GtkWidget *button = sp_button_new(size, type, action, nullptr); g_object_unref(action); return button; } diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp index ed2dbe321..37bf08b3d 100644 --- a/src/widgets/dash-selector.cpp +++ b/src/widgets/dash-selector.cpp @@ -43,9 +43,9 @@ static double dash_1_2[] = {1.0, 2.0, -1.0}; static double dash_1_4[] = {1.0, 4.0, -1.0}; static size_t BD_LEN = 7; // must correspond to the number of entries in the next line -static double *builtin_dashes[] = {dash_0, dash_1_1, dash_2_1, dash_4_1, dash_1_2, dash_1_4, NULL}; +static double *builtin_dashes[] = {dash_0, dash_1_1, dash_2_1, dash_4_1, dash_1_2, dash_1_4, nullptr}; -static double **dashes = NULL; +static double **dashes = nullptr; SPDashSelector::SPDashSelector() : preview_width(80), @@ -143,7 +143,7 @@ void SPDashSelector::init_dashes() { for(i=0;i<15;i++){ d[i]=i; } // have to put something in there, this is a pattern hopefully nobody would choose d[15]=-1.0; // final terminator - dashes[++pos] = NULL; + dashes[++pos] = nullptr; } } @@ -222,7 +222,7 @@ void SPDashSelector::get_dash(int *ndash, double **dash, double *off) if (ndash) *ndash = 0; if (dash) - *dash = NULL; + *dash = nullptr; if (off) *off = 0.0; } diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 850253c00..3c15bf3a5 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -129,7 +129,7 @@ public: CMSPrefWatcher() : _dpw(*this), _spw(*this), - _tracker(ege_color_prof_tracker_new(0)) + _tracker(ege_color_prof_tracker_new(nullptr)) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); g_signal_connect( G_OBJECT(_tracker), "modified", G_CALLBACK(hook), this ); @@ -188,7 +188,7 @@ private: #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void CMSPrefWatcher::hook(EgeColorProfTracker * /*tracker*/, gint monitor, CMSPrefWatcher * /*watcher*/) { - unsigned char* buf = 0; + unsigned char* buf = nullptr; guint len = 0; ege_color_prof_tracker_get_profile_for( monitor, reinterpret_cast<gpointer*>(&buf), &len ); @@ -225,7 +225,7 @@ void CMSPrefWatcher::_setCmsSensitive(bool enabled) #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } -static CMSPrefWatcher* watcher = NULL; +static CMSPrefWatcher* watcher = nullptr; void SPDesktopWidget::setMessage (Inkscape::MessageType type, const gchar *message) @@ -261,7 +261,7 @@ SPDesktopWidget::window_get_pointer() return Geom::Point(x, y); } -static GTimer *overallTimer = 0; +static GTimer *overallTimer = nullptr; /** * Registers SPDesktopWidget class and returns its type number. @@ -272,15 +272,15 @@ GType SPDesktopWidget::getType(void) if (!type) { GTypeInfo info = { sizeof(SPDesktopWidgetClass), - 0, // base_init - 0, // base_finalize + nullptr, // base_init + nullptr, // base_finalize (GClassInitFunc)sp_desktop_widget_class_init, - 0, // class_finalize - 0, // class_data + nullptr, // class_finalize + nullptr, // class_data sizeof(SPDesktopWidget), 0, // n_preallocs (GInstanceInitFunc)SPDesktopWidget::init, - 0 // value_table + nullptr // value_table }; type = g_type_register_static(SP_TYPE_VIEW_WIDGET, "SPDesktopWidget", &info, static_cast<GTypeFlags>(0)); // Begin a timer to watch for the first desktop to appear on-screen @@ -330,8 +330,8 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) new (&dtw->modified_connection) sigc::connection(); - dtw->window = 0; - dtw->desktop = NULL; + dtw->window = nullptr; + dtw->desktop = nullptr; dtw->_interaction_disabled_counter = 0; /* Main table */ @@ -386,7 +386,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) // Lock guides button dtw->guides_lock = sp_button_new_from_data( GTK_ICON_SIZE_MENU, SP_BUTTON_TYPE_TOGGLE, - NULL, + nullptr, INKSCAPE_ICON("object-locked"), _("Toggle lock of all guides in the document")); auto guides_lock_style_provider = Gtk::CssProvider::create(); @@ -446,7 +446,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) // Sticky zoom button dtw->sticky_zoom = sp_button_new_from_data ( GTK_ICON_SIZE_MENU, SP_BUTTON_TYPE_TOGGLE, - NULL, + nullptr, INKSCAPE_ICON("zoom-original"), _("Zoom drawing if window size changes")); gtk_widget_set_name(dtw->sticky_zoom, "StickyZoom"); @@ -470,7 +470,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) } dtw->cms_adjust = sp_button_new_from_data( GTK_ICON_SIZE_MENU, SP_BUTTON_TYPE_TOGGLE, - NULL, + nullptr, INKSCAPE_ICON("color-management"), tip ); gtk_widget_set_name(dtw->cms_adjust, "CMS_Adjust"); @@ -516,7 +516,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) "SPCanvas {\n" " background-color: white;\n" "}\n", - -1, NULL); + -1, nullptr); gtk_style_context_add_provider(style_context, GTK_STYLE_PROVIDER(css_provider), @@ -542,8 +542,8 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) /* Prevent the paned from catching F6 and F8 by unsetting the default callbacks */ if (GtkPanedClass *paned_class = GTK_PANED_CLASS (G_OBJECT_GET_CLASS (paned->gobj()))) { - paned_class->cycle_child_focus = NULL; - paned_class->cycle_handle_focus = NULL; + paned_class->cycle_child_focus = nullptr; + paned_class->cycle_handle_focus = nullptr; } paned->set_hexpand(true); @@ -573,13 +573,13 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) FALSE, FALSE, 0); // Layer Selector - dtw->layer_selector = new Inkscape::Widgets::LayerSelector(NULL); + dtw->layer_selector = new Inkscape::Widgets::LayerSelector(nullptr); // FIXME: need to unreference on container destruction to avoid leak dtw->layer_selector->reference(); gtk_box_pack_start(GTK_BOX(dtw->statusbar), GTK_WIDGET(dtw->layer_selector->gobj()), FALSE, FALSE, 1); // Select Status - dtw->select_status = gtk_label_new (NULL); + dtw->select_status = gtk_label_new (nullptr); gtk_widget_set_name( dtw->select_status, "SelectStatus"); gtk_label_set_ellipsize (GTK_LABEL(dtw->select_status), PANGO_ELLIPSIZE_END); #if GTK_CHECK_VERSION(3,10,0) @@ -666,8 +666,8 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_widget_set_halign(label_y, GTK_ALIGN_START); gtk_grid_attach(GTK_GRID(dtw->coord_status), label_x, 1, 0, 1, 1); gtk_grid_attach(GTK_GRID(dtw->coord_status), label_y, 1, 1, 1, 1); - dtw->coord_status_x = gtk_label_new(NULL); - dtw->coord_status_y = gtk_label_new(NULL); + dtw->coord_status_x = gtk_label_new(nullptr); + dtw->coord_status_y = gtk_label_new(nullptr); gtk_label_set_markup( GTK_LABEL(dtw->coord_status_x), "<tt> 0.00 </tt>" ); gtk_label_set_markup( GTK_LABEL(dtw->coord_status_y), "<tt> 0.00 </tt>" ); @@ -717,7 +717,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) } else { g_timer_destroy(overallTimer); } - overallTimer = 0; + overallTimer = nullptr; } // Ensure that ruler ranges are updated correctly whenever the canvas table @@ -735,7 +735,7 @@ static void sp_desktop_widget_dispose(GObject *object) { SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (object); - if (dtw == NULL) { + if (dtw == nullptr) { return; } @@ -749,14 +749,14 @@ static void sp_desktop_widget_dispose(GObject *object) // Zoom g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK(sp_dtw_zoom_input), dtw); g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK(sp_dtw_zoom_output), dtw); - g_signal_handlers_disconnect_matched (G_OBJECT (dtw->zoom_status), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, dtw->zoom_status); + g_signal_handlers_disconnect_matched (G_OBJECT (dtw->zoom_status), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, dtw->zoom_status); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK (sp_dtw_zoom_value_changed), dtw); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK (sp_dtw_zoom_populate_popup), dtw); // Rotation g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->rotation_status), (gpointer) G_CALLBACK(sp_dtw_rotation_input), dtw); g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->rotation_status), (gpointer) G_CALLBACK(sp_dtw_rotation_output), dtw); - g_signal_handlers_disconnect_matched (G_OBJECT (dtw->rotation_status), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, dtw->rotation_status); + g_signal_handlers_disconnect_matched (G_OBJECT (dtw->rotation_status), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, dtw->rotation_status); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->rotation_status), (gpointer) G_CALLBACK (sp_dtw_rotation_value_changed), dtw); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->rotation_status), (gpointer) G_CALLBACK (sp_dtw_rotation_populate_popup), dtw); @@ -764,13 +764,13 @@ static void sp_desktop_widget_dispose(GObject *object) g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->canvas), (gpointer) G_CALLBACK (sp_desktop_widget_event), dtw); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->canvas_tbl), (gpointer) G_CALLBACK (canvas_tbl_size_allocate), dtw); - dtw->layer_selector->setDesktop(NULL); + dtw->layer_selector->setDesktop(nullptr); dtw->layer_selector->unreference(); INKSCAPE.remove_desktop(dtw->desktop); // clears selection and event_context dtw->modified_connection.disconnect(); dtw->desktop->destroy(); Inkscape::GC::release (dtw->desktop); - dtw->desktop = NULL; + dtw->desktop = nullptr; } dtw->modified_connection.~connection(); @@ -962,7 +962,7 @@ sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dt // and passed on by the canvas acetate (I think). --bb if ((event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) && !dtw->canvas->_current_item) { - return sp_desktop_root_handler (NULL, event, dtw->desktop); + return sp_desktop_root_handler (nullptr, event, dtw->desktop); } } @@ -1083,7 +1083,7 @@ sp_dtw_desktop_deactivate (SPDesktopWidget */*dtw*/) bool SPDesktopWidget::shutdown() { - g_assert(desktop != NULL); + g_assert(desktop != nullptr); if (INKSCAPE.sole_desktop_for_document(*desktop)) { SPDocument *doc = desktop->doc(); @@ -1136,7 +1136,7 @@ SPDesktopWidget::shutdown() } /* Code to check data loss */ bool allow_data_loss = FALSE; - while (doc->getReprRoot()->attribute("inkscape:dataloss") != NULL && allow_data_loss == FALSE) { + while (doc->getReprRoot()->attribute("inkscape:dataloss") != nullptr && allow_data_loss == FALSE) { Gtk::Window *toplevel_window = Glib::wrap(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(this)))); Glib::ustring message = g_markup_printf_escaped( _("<span weight=\"bold\" size=\"larger\">The file \"%s\" was saved with a format that may cause data loss!</span>\n\n" @@ -1222,8 +1222,8 @@ SPDesktopWidget::shutdown() void SPDesktopWidget::requestCanvasUpdate() { // ^^ also this->desktop != 0 - g_return_if_fail(this->desktop != NULL); - g_return_if_fail(this->desktop->main != NULL); + g_return_if_fail(this->desktop != nullptr); + g_return_if_fail(this->desktop->main != nullptr); gtk_widget_queue_draw (GTK_WIDGET (SP_CANVAS_ITEM (this->desktop->main)->canvas)); } @@ -1541,7 +1541,7 @@ SPDesktopWidget::setToolboxFocusTo (const gchar* label) void SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) { - GtkAdjustment *a = NULL; + GtkAdjustment *a = nullptr; gpointer hb = sp_search_by_data_recursive (aux_toolbox, (gpointer) id); if (hb && GTK_IS_WIDGET(hb)) { if (GTK_IS_SPIN_BUTTON(hb)) @@ -1589,7 +1589,7 @@ SPDesktopWidget::isToolboxButtonActive (const gchar* id) void SPDesktopWidget::setToolboxPosition(Glib::ustring const& id, GtkPositionType pos) { // Note - later on these won't be individual member variables. - GtkWidget* toolbox = 0; + GtkWidget* toolbox = nullptr; if (id == "ToolToolbar") { toolbox = tool_toolbox; } else if (id == "AuxToolbar") { @@ -1643,7 +1643,7 @@ SPViewWidget *sp_desktop_widget_new( SPNamedView *namedview ) SPDesktopWidget* SPDesktopWidget::createInstance(SPNamedView *namedview) { - SPDesktopWidget *dtw = static_cast<SPDesktopWidget*>(g_object_new(SP_TYPE_DESKTOP_WIDGET, NULL)); + SPDesktopWidget *dtw = static_cast<SPDesktopWidget*>(g_object_new(SP_TYPE_DESKTOP_WIDGET, nullptr)); dtw->dt2r = 1. / namedview->display_units->factor; @@ -1752,11 +1752,11 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) continue; gpointer t = sp_search_by_data_recursive(GTK_WIDGET(j->gobj()), (gpointer) "tracker"); - if (t == NULL) // didn't find any tracker data + if (t == nullptr) // didn't find any tracker data continue; UnitTracker *tracker = reinterpret_cast<UnitTracker*>( t ); - if (tracker == NULL) // it's null when inkscape is first opened + if (tracker == nullptr) // it's null when inkscape is first opened continue; tracker->setActiveUnit( nv->display_units ); @@ -1769,7 +1769,7 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) gtk_widget_set_tooltip_text(this->vruler_box, gettext(nv->display_units->name_plural.c_str())); sp_desktop_widget_update_rulers(this); - ToolboxFactory::updateSnapToolbox(this->desktop, 0, this->snap_toolbox); + ToolboxFactory::updateSnapToolbox(this->desktop, nullptr, this->snap_toolbox); } } @@ -1828,7 +1828,7 @@ sp_dtw_zoom_input (GtkSpinButton *spin, gdouble *new_val, gpointer /*data*/) *comma = '.'; } - char *oldlocale = g_strdup (setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup (setlocale(LC_NUMERIC, nullptr)); setlocale (LC_NUMERIC, "C"); gdouble new_typed = atof (b); setlocale (LC_NUMERIC, oldlocale); @@ -2029,7 +2029,7 @@ sp_dtw_rotation_input (GtkSpinButton *spin, gdouble *new_val, gpointer /*data*/) *comma = '.'; } - char *oldlocale = g_strdup (setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup (setlocale(LC_NUMERIC, nullptr)); setlocale (LC_NUMERIC, "C"); gdouble new_value = atof (b); setlocale (LC_NUMERIC, oldlocale); diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 92d670019..4744752dc 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -158,9 +158,9 @@ struct SPDesktopWidget { { return _dtw->shutdown(); } void destroy() override { - if(_dtw->window != NULL) + if(_dtw->window != nullptr) delete _dtw->window; - _dtw->window = NULL; + _dtw->window = nullptr; } void requestCanvasUpdate() override diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp index 38d5173fa..f12cecc7f 100644 --- a/src/widgets/eek-preview.cpp +++ b/src/widgets/eek-preview.cpp @@ -87,7 +87,7 @@ static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr); G_DEFINE_TYPE(EekPreview, eek_preview, GTK_TYPE_DRAWING_AREA); -static GtkWidgetClass* parent_class = 0; +static GtkWidgetClass* parent_class = nullptr; void eek_preview_set_color( EekPreview* preview, int r, int g, int b ) { @@ -114,7 +114,7 @@ eek_preview_set_pixbuf(EekPreview *preview, if (priv->scaled) { g_object_unref(priv->scaled); - priv->scaled = NULL; + priv->scaled = nullptr; } priv->scaledW = gdk_pixbuf_get_width(priv->previewPixbuf); @@ -567,7 +567,7 @@ static void eek_preview_class_init( EekPreviewClass *klass ) G_TYPE_FROM_CLASS( klass ), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), G_STRUCT_OFFSET( EekPreviewClass, clicked ), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); eek_preview_signals[ALTCLICKED_SIGNAL] = @@ -575,7 +575,7 @@ static void eek_preview_class_init( EekPreviewClass *klass ) G_TYPE_FROM_CLASS( klass ), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), G_STRUCT_OFFSET( EekPreviewClass, clicked ), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT ); @@ -584,7 +584,7 @@ static void eek_preview_class_init( EekPreviewClass *klass ) PROP_FOCUS, g_param_spec_boolean( "focus-on-click", - NULL, + nullptr, "flag to grab focus when clicked", TRUE, (GParamFlags)(G_PARAM_READWRITE | G_PARAM_CONSTRUCT) @@ -704,14 +704,14 @@ eek_preview_init(EekPreview *preview) priv->size = PREVIEW_SIZE_SMALL; priv->ratio = 100; priv->border = BORDER_NONE; - priv->previewPixbuf = 0; - priv->scaled = 0; + priv->previewPixbuf = nullptr; + priv->scaled = nullptr; } GtkWidget* eek_preview_new(void) { - return GTK_WIDGET( g_object_new( EEK_PREVIEW_TYPE, NULL ) ); + return GTK_WIDGET( g_object_new( EEK_PREVIEW_TYPE, nullptr ) ); } /* diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp index e922bcc00..ba120c310 100644 --- a/src/widgets/ege-adjustment-action.cpp +++ b/src/widgets/ege-adjustment-action.cpp @@ -72,7 +72,7 @@ static void ege_adjustment_action_defocus( EgeAdjustmentAction* action ); static void egeAct_free_description( gpointer data, gpointer user_data ); static void egeAct_free_all_descriptions( EgeAdjustmentAction* action ); -static EgeCreateAdjWidgetCB gFactoryCb = 0; +static EgeCreateAdjWidgetCB gFactoryCb = nullptr; static GQuark gDataName = 0; enum { @@ -90,7 +90,7 @@ static const gchar *floogles[] = { INKSCAPE_ICON("go-down"), INKSCAPE_ICON("help-about"), INKSCAPE_ICON("go-up"), - 0}; + nullptr}; typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr; @@ -204,7 +204,7 @@ static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ) g_param_spec_string( "self-id", "Self ID", "Marker for self pointer", - 0, + nullptr, (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) ); g_object_class_install_property( objClass, @@ -259,30 +259,30 @@ void ege_adjustment_action_set_compact_tool_factory( EgeCreateAdjWidgetCB factor static void ege_adjustment_action_init( EgeAdjustmentAction* action ) { action->private_data = EGE_ADJUSTMENT_ACTION_GET_PRIVATE( action ); - action->private_data->adj = 0; - action->private_data->focusWidget = 0; + action->private_data->adj = nullptr; + action->private_data->focusWidget = nullptr; action->private_data->climbRate = 0.0; action->private_data->digits = 2; action->private_data->epsilon = 0.009; action->private_data->format = g_strdup_printf("%%0.%df%%s%%s", action->private_data->digits); - action->private_data->selfId = 0; - action->private_data->toolPost = 0; + action->private_data->selfId = nullptr; + action->private_data->toolPost = nullptr; action->private_data->lastVal = 0.0; action->private_data->step = 0.0; action->private_data->page = 0.0; action->private_data->appearanceMode = APPEARANCE_NONE; action->private_data->transferFocus = FALSE; //action->private_data->descriptions = 0; - action->private_data->appearance = 0; - action->private_data->iconId = 0; + action->private_data->appearance = nullptr; + action->private_data->iconId = nullptr; action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR; - action->private_data->unitTracker = NULL; + action->private_data->unitTracker = nullptr; } static void ege_adjustment_action_finalize( GObject* object ) { - EgeAdjustmentAction* action = 0; - g_return_if_fail( object != NULL ); + EgeAdjustmentAction* action = nullptr; + g_return_if_fail( object != nullptr ); g_return_if_fail( IS_EGE_ADJUSTMENT_ACTION(object) ); action = EGE_ADJUSTMENT_ACTION( object ); @@ -510,7 +510,7 @@ static void egeAct_free_description( gpointer data, gpointer user_data ) { EgeAdjustmentDescr* descr = (EgeAdjustmentDescr*)data; if ( descr->descr ) { g_free( descr->descr ); - descr->descr = 0; + descr->descr = nullptr; } g_free( descr ); } @@ -519,7 +519,7 @@ static void egeAct_free_description( gpointer data, gpointer user_data ) { static void egeAct_free_all_descriptions( EgeAdjustmentAction* action ) { for(auto i:action->private_data->descriptions) { - egeAct_free_description(i,0); + egeAct_free_description(i,nullptr); } for(auto i:action->private_data->descriptions) { g_free(i); @@ -555,7 +555,7 @@ void ege_adjustment_action_set_descriptions( EgeAdjustmentAction* action, gchar guint i = 0; for ( i = 0; i < count; i++ ) { EgeAdjustmentDescr* descr = g_new0( EgeAdjustmentDescr, 1 ); - descr->descr = descriptions[i] ? g_strdup( descriptions[i] ) : 0; + descr->descr = descriptions[i] ? g_strdup( descriptions[i] ) : nullptr; descr->value = values[i]; action->private_data->descriptions.push_back(descr); std::sort(action->private_data->descriptions.begin(),action->private_data->descriptions.end()); @@ -629,8 +629,8 @@ static void process_menu_action( GtkWidget* obj, gpointer data ) static void create_single_menu_item( GCallback toggleCb, int val, GtkWidget* menu, EgeAdjustmentAction* act, GtkWidget** dst, Gtk::RadioMenuItem::Group *group, gdouble num, gboolean active ) { - char* str = 0; - EgeAdjustmentDescr* marker = 0; + char* str = nullptr; + EgeAdjustmentDescr* marker = nullptr; std::vector<EgeAdjustmentDescr*> cur = act->private_data->descriptions; for (auto descr:cur) { @@ -682,7 +682,7 @@ static int flush_explicit_items( std::vector<EgeAdjustmentDescr*> descriptions, create_single_menu_item( toggleCb, val + ( std::find(act->private_data->descriptions.begin(),act->private_data->descriptions.end(),descr) - act->private_data->descriptions.begin() ) , menu, act, dst, group, descr->value, FALSE ); } pos--; - descr = (pos<0) ? descriptions[pos] : NULL; + descr = (pos<0) ? descriptions[pos] : nullptr; } return pos; @@ -693,7 +693,7 @@ static GtkWidget* create_popup_number_menu( EgeAdjustmentAction* act ) GtkWidget* menu = gtk_menu_new(); Gtk::RadioMenuItem::Group group; - GtkWidget* single = 0; + GtkWidget* single = nullptr; std::vector<EgeAdjustmentDescr*> list = act->private_data->descriptions; int addOns = list.size() - 1; @@ -749,12 +749,12 @@ static GtkWidget* create_popup_number_menu( EgeAdjustmentAction* act ) static GtkWidget* create_menu_item( GtkAction* action ) { - GtkWidget* item = 0; + GtkWidget* item = nullptr; if ( IS_EGE_ADJUSTMENT_ACTION(action) ) { EgeAdjustmentAction* act = EGE_ADJUSTMENT_ACTION( action ); GValue value; - GtkWidget* subby = 0; + GtkWidget* subby = nullptr; memset( &value, 0, sizeof(value) ); g_value_init( &value, G_TYPE_STRING ); @@ -811,11 +811,11 @@ static gboolean event_cb( EgeAdjustmentAction* act, GdkEvent* evt ) static GtkWidget* create_tool_item( GtkAction* action ) { - GtkWidget* item = 0; + GtkWidget* item = nullptr; if ( IS_EGE_ADJUSTMENT_ACTION(action) ) { EgeAdjustmentAction* act = EGE_ADJUSTMENT_ACTION( action ); - GtkWidget* spinbutton = 0; + GtkWidget* spinbutton = nullptr; auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); GValue value; @@ -833,7 +833,7 @@ static GtkWidget* create_tool_item( GtkAction* action ) gtk_widget_set_size_request(spinbutton, 100, -1); } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { - spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 ); + spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, nullptr ); gtk_scale_button_set_adjustment( GTK_SCALE_BUTTON(spinbutton), act->private_data->adj ); gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); } else { @@ -969,8 +969,8 @@ static gboolean process_tab( GtkWidget* widget, int direction ) { gboolean handled = FALSE; GtkWidget* parent = gtk_widget_get_parent(widget); - GtkWidget* gp = parent ? gtk_widget_get_parent(parent) : 0; - GtkWidget* ggp = gp ? gtk_widget_get_parent(gp) : 0; + GtkWidget* gp = parent ? gtk_widget_get_parent(parent) : nullptr; + GtkWidget* ggp = gp ? gtk_widget_get_parent(gp) : nullptr; if ( ggp && GTK_IS_TOOLBAR(ggp) ) { std::vector<Gtk::Widget*> kids = Glib::wrap(GTK_CONTAINER(ggp))->get_children(); @@ -1017,7 +1017,7 @@ gboolean keypress_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) guint key = 0; gdk_keymap_translate_keyboard_state( Gdk::Display::get_default()->get_keymap(), event->hardware_keycode, (GdkModifierType)event->state, - 0, &key, 0, 0, 0 ); + 0, &key, nullptr, nullptr, nullptr ); switch ( key ) { case GDK_KEY_Escape: diff --git a/src/widgets/ege-output-action.cpp b/src/widgets/ege-output-action.cpp index e7d74a25f..847a4f0a1 100644 --- a/src/widgets/ege-output-action.cpp +++ b/src/widgets/ege-output-action.cpp @@ -163,14 +163,14 @@ void ege_output_action_set_property( GObject* obj, guint propId, const GValue *v GtkWidget* create_tool_item( GtkAction* action ) { - GtkWidget* item = 0; + GtkWidget* item = nullptr; if ( IS_EGE_OUTPUT_ACTION(action) ) { GValue value; auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - GtkWidget* lbl = 0; + GtkWidget* lbl = nullptr; memset( &value, 0, sizeof(value) ); g_value_init( &value, G_TYPE_STRING ); @@ -183,7 +183,7 @@ GtkWidget* create_tool_item( GtkAction* action ) gtk_container_add( GTK_CONTAINER(hb), lbl ); if ( EGE_OUTPUT_ACTION(action)->private_data->useMarkup ) { - lbl = gtk_label_new(NULL); + lbl = gtk_label_new(nullptr); gtk_label_set_markup( GTK_LABEL(lbl), sss ? sss : " " ); } else { lbl = gtk_label_new( sss ? sss : " " ); @@ -211,7 +211,7 @@ void fixup_labels( GObject *gobject, GParamSpec *arg1, gpointer user_data ) if ( arg1 && arg1->name && (strcmp("label", arg1->name) == 0) ) { GSList* proxies = gtk_action_get_proxies( GTK_ACTION(gobject) ); - gchar* str = 0; + gchar* str = nullptr; g_object_get( gobject, "label", &str, NULL ); Glib::ustring str2(str); (void)user_data; diff --git a/src/widgets/ege-paint-def.cpp b/src/widgets/ege-paint-def.cpp index 8e0ec9352..b9b184638 100644 --- a/src/widgets/ege-paint-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -198,7 +198,7 @@ void PaintDef::getMIMEData(std::string const & type, char*& dest, int& len, int& format = 8; } else { // nothing - dest = 0; + dest = nullptr; len = 0; } } diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index e1c1ad6d0..2e35659dd 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -127,8 +127,8 @@ Gtk::Widget *Inkscape::Widgets::createStyleWidget( FillOrStroke kind ) FillNStroke::FillNStroke( FillOrStroke k ) : Gtk::VBox(), kind(k), - desktop(0), - psel(0), + desktop(nullptr), + psel(nullptr), lastDrag(0), dragId(0), update(false), @@ -167,7 +167,7 @@ FillNStroke::~FillNStroke() g_source_remove(dragId); dragId = 0; } - psel = 0; + psel = nullptr; selectModifiedConn.disconnect(); subselChangedConn.disconnect(); selectChangedConn.disconnect(); @@ -206,7 +206,7 @@ void FillNStroke::setDesktop(SPDesktop *desktop) if (desktop && desktop->selection) { selectChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &FillNStroke::performUpdate))); subselChangedConn = desktop->connectToolSubselectionChanged(sigc::hide(sigc::mem_fun(*this, &FillNStroke::performUpdate))); - eventContextConn = desktop->connectEventContextChanged(sigc::hide(sigc::bind(sigc::mem_fun(*this, &FillNStroke::eventContextCB), (Inkscape::UI::Tools::ToolBase *)NULL))); + eventContextConn = desktop->connectEventContextChanged(sigc::hide(sigc::bind(sigc::mem_fun(*this, &FillNStroke::eventContextCB), (Inkscape::UI::Tools::ToolBase *)nullptr))); // Must check flags, so can't call performUpdate() directly. selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &FillNStroke::selectionModifiedCB))); @@ -358,7 +358,7 @@ void FillNStroke::setFillrule( SPPaintSelector::FillRule mode ) sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; DocumentUndo::done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE, _("Change fill rule")); @@ -425,7 +425,7 @@ void FillNStroke::dragFromPaint() // Assume a base 15.625ms resolution on the timer. if (!dragId && lastDrag && when && ((when - lastDrag) < 32)) { // local change, do not update from selection - dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 33, dragDelayCB, this, 0); + dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 33, dragDelayCB, this, nullptr); } if (dragId) { @@ -442,7 +442,7 @@ void FillNStroke::dragFromPaint() case SPPaintSelector::MODE_SOLID_COLOR: { // local change, do not update from selection - dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 100, dragDelayCB, this, 0); + dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 100, dragDelayCB, this, nullptr); psel->setFlatColor( desktop, (kind == FILL) ? "fill" : "stroke", (kind == FILL) ? "fill-opacity" : "stroke-opacity" ); DocumentUndo::maybeDone(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Set fill color") : _("Set stroke color")); @@ -505,7 +505,7 @@ void FillNStroke::updateFromPaint() sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Remove fill") : _("Remove stroke")); @@ -551,7 +551,7 @@ void FillNStroke::updateFromPaint() : SP_GRADIENT_TYPE_RADIAL ); bool createSwatch = (psel->mode == SPPaintSelector::MODE_SWATCH); - SPCSSAttr *css = 0; + SPCSSAttr *css = nullptr; if (kind == FILL) { // HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs css = sp_repr_css_attr_new(); @@ -617,7 +617,7 @@ void FillNStroke::updateFromPaint() if (css) { sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; } DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, @@ -631,7 +631,7 @@ void FillNStroke::updateFromPaint() if (!items.empty()) { SPGradientType const gradient_type = SP_GRADIENT_TYPE_MESH; - SPCSSAttr *css = 0; + SPCSSAttr *css = nullptr; if (kind == FILL) { // HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs css = sp_repr_css_attr_new(); @@ -717,7 +717,7 @@ void FillNStroke::updateFromPaint() if (css) { sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; } DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, @@ -776,7 +776,7 @@ void FillNStroke::updateFromPaint() } sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; g_free(urltext); } // end if @@ -806,7 +806,7 @@ void FillNStroke::updateFromPaint() sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Unset fill") : _("Unset stroke")); diff --git a/src/widgets/gimp/ruler.cpp b/src/widgets/gimp/ruler.cpp index 8d73ada3b..f4f1a2f29 100644 --- a/src/widgets/gimp/ruler.cpp +++ b/src/widgets/gimp/ruler.cpp @@ -241,7 +241,7 @@ sp_ruler_class_init (SPRulerClass *klass) gtk_widget_class_install_style_property (widget_class, g_param_spec_double ("font-scale", - NULL, NULL, + nullptr, nullptr, 0.0, G_MAXDOUBLE, DEFAULT_RULER_FONT_SCALE, @@ -262,7 +262,7 @@ sp_ruler_init (SPRuler *ruler) priv->position = 0; priv->max_size = 0; - priv->backing_store = NULL; + priv->backing_store = nullptr; priv->backing_store_valid = FALSE; priv->last_pos_rect.x = 0; @@ -498,7 +498,7 @@ sp_ruler_unrealize(GtkWidget *widget) if (priv->backing_store) { cairo_surface_destroy (priv->backing_store); - priv->backing_store = NULL; + priv->backing_store = nullptr; } priv->backing_store_valid = FALSE; @@ -506,13 +506,13 @@ sp_ruler_unrealize(GtkWidget *widget) if (priv->layout) { g_object_unref (priv->layout); - priv->layout = NULL; + priv->layout = nullptr; } if (priv->input_window) { gdk_window_destroy (priv->input_window); - priv->input_window = NULL; + priv->input_window = nullptr; } GTK_WIDGET_CLASS (sp_ruler_parent_class)->unrealize (widget); @@ -577,7 +577,7 @@ sp_ruler_size_request (GtkWidget *widget, gint size; layout = sp_ruler_get_layout (widget, "0123456789"); - pango_layout_get_pixel_extents (layout, &ink_rect, NULL); + pango_layout_get_pixel_extents (layout, &ink_rect, nullptr); size = 2 + ink_rect.height * 1.7; @@ -617,7 +617,7 @@ sp_ruler_style_updated (GtkWidget *widget) if (priv->layout) { g_object_unref (priv->layout); - priv->layout = NULL; + priv->layout = nullptr; } } @@ -773,7 +773,7 @@ sp_ruler_update_position (SPRuler *ruler, gdouble upper; gtk_widget_get_allocation (GTK_WIDGET (ruler), &allocation); - sp_ruler_get_range (ruler, &lower, &upper, NULL); + sp_ruler_get_range (ruler, &lower, &upper, nullptr); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { @@ -827,7 +827,7 @@ gtk_widget_get_translation_to_window (GtkWidget *widget, *y += px; } - if (w == NULL) + if (w == nullptr) { *x = 0; *y = 0; @@ -1031,7 +1031,7 @@ sp_ruler_set_position (SPRuler *ruler, priv->pos_redraw_idle_id = g_idle_add_full (G_PRIORITY_LOW, sp_ruler_idle_queue_pos_redraw, - ruler, NULL); + ruler, nullptr); } } } @@ -1087,7 +1087,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) gint text_size; gint pos; gdouble max_size; - Inkscape::Util::Unit const *unit = NULL; + Inkscape::Util::Unit const *unit = nullptr; SPRulerMetric ruler_metric = ruler_metric_general; /* The metric to use for this unit system */ PangoLayout *layout; PangoRectangle logical_rect, ink_rect; @@ -1251,7 +1251,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { pango_layout_set_text (layout, unit_str, -1); - pango_layout_get_extents (layout, &logical_rect, NULL); + pango_layout_get_extents (layout, &logical_rect, nullptr); cairo_move_to (cr, pos + 2, @@ -1267,7 +1267,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) { digit_str[0] = unit_str[j]; pango_layout_set_text (layout, digit_str, 1); - pango_layout_get_extents (layout, NULL, &logical_rect); + pango_layout_get_extents (layout, nullptr, &logical_rect); cairo_move_to (cr, border.left + 1, @@ -1337,7 +1337,7 @@ sp_ruler_get_pos_rect (SPRuler *ruler, rect.width = rect.height / 2 + 1; } - sp_ruler_get_range (ruler, &lower, &upper, NULL); + sp_ruler_get_range (ruler, &lower, &upper, nullptr); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { diff --git a/src/widgets/gradient-image.cpp b/src/widgets/gradient-image.cpp index 65b1a6733..aae0cc063 100644 --- a/src/widgets/gradient-image.cpp +++ b/src/widgets/gradient-image.cpp @@ -57,7 +57,7 @@ sp_gradient_image_init (SPGradientImage *image) { gtk_widget_set_has_window (GTK_WIDGET(image), FALSE); - image->gradient = NULL; + image->gradient = nullptr; new (&image->release_connection) sigc::connection(); new (&image->modified_connection) sigc::connection(); @@ -70,7 +70,7 @@ static void sp_gradient_image_destroy(GtkWidget *object) if (image->gradient) { image->release_connection.disconnect(); image->modified_connection.disconnect(); - image->gradient = NULL; + image->gradient = nullptr; } image->release_connection.~connection(); @@ -125,7 +125,7 @@ static gboolean sp_gradient_image_draw(GtkWidget *widget, cairo_t *ct) GtkWidget * sp_gradient_image_new (SPGradient *gradient) { - SPGradientImage *image = SP_GRADIENT_IMAGE(g_object_new(SP_TYPE_GRADIENT_IMAGE, NULL)); + SPGradientImage *image = SP_GRADIENT_IMAGE(g_object_new(SP_TYPE_GRADIENT_IMAGE, nullptr)); sp_gradient_image_set_gradient (image, gradient); @@ -254,7 +254,7 @@ sp_gradient_image_gradient_release (SPObject *, SPGradientImage *image) image->modified_connection.disconnect(); } - image->gradient = NULL; + image->gradient = nullptr; sp_gradient_image_update (image); } diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index db2d7f028..230282e6d 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -67,28 +67,28 @@ static void sp_gradient_selector_class_init(SPGradientSelectorClass *klass) G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET (SPGradientSelectorClass, grabbed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[DRAGGED] = g_signal_new ("dragged", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET (SPGradientSelectorClass, dragged), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[RELEASED] = g_signal_new ("released", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET (SPGradientSelectorClass, released), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[CHANGED] = g_signal_new ("changed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET (SPGradientSelectorClass, changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -120,7 +120,7 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) sel->gradientSpread = SP_GRADIENT_SPREAD_PAD; /* Vectors */ - sel->vectors = sp_gradient_vector_selector_new (NULL, NULL); + sel->vectors = sp_gradient_vector_selector_new (nullptr, nullptr); SPGradientVectorSelector *gvs = SP_GRADIENT_VECTOR_SELECTOR(sel->vectors); sel->store = gvs->store; sel->columns = gvs->columns; @@ -223,11 +223,11 @@ static void sp_gradient_selector_dispose(GObject *object) if (sel->icon_renderer) { delete sel->icon_renderer; - sel->icon_renderer = NULL; + sel->icon_renderer = nullptr; } if (sel->text_renderer) { delete sel->text_renderer; - sel->text_renderer = NULL; + sel->text_renderer = nullptr; } if ((G_OBJECT_CLASS(sp_gradient_selector_parent_class))->dispose) { @@ -244,7 +244,7 @@ void SPGradientSelector::setSpread(SPGradientSpread spread) GtkWidget *sp_gradient_selector_new() { - SPGradientSelector *sel = SP_GRADIENT_SELECTOR(g_object_new (SP_TYPE_GRADIENT_SELECTOR, NULL)); + SPGradientSelector *sel = SP_GRADIENT_SELECTOR(g_object_new (SP_TYPE_GRADIENT_SELECTOR, nullptr)); return GTK_WIDGET(sel); } @@ -361,7 +361,7 @@ void SPGradientSelector::onTreeSelection() return; } - SPGradient *obj = NULL; + SPGradient *obj = nullptr; /* Single selection */ Gtk::TreeModel::iterator iter = sel->get_selected(); if ( iter ) { @@ -370,7 +370,7 @@ void SPGradientSelector::onTreeSelection() } if (obj) { - sp_gradient_selector_vector_set (NULL, SP_GRADIENT(obj), this); + sp_gradient_selector_vector_set (nullptr, SP_GRADIENT(obj), this); } } @@ -451,7 +451,7 @@ void SPGradientSelector::setVector(SPDocument *doc, SPGradient *vector) gtk_widget_set_sensitive(edit, FALSE); } if (add) { - gtk_widget_set_sensitive(add, (doc != NULL)); + gtk_widget_set_sensitive(add, (doc != nullptr)); } if (del) { gtk_widget_set_sensitive(del, FALSE); @@ -472,7 +472,7 @@ static void sp_gradient_selector_vector_set(SPGradientVectorSelector * /*gvs*/, if (!sel->blocked) { sel->blocked = TRUE; gr = sp_gradient_ensure_vector_normalized (gr); - sel->setVector((gr) ? gr->document : 0, gr); + sel->setVector((gr) ? gr->document : nullptr, gr); g_signal_emit (G_OBJECT (sel), signals[CHANGED], 0, gr); sel->blocked = FALSE; } @@ -487,7 +487,7 @@ sp_gradient_selector_delete_vector_clicked (GtkWidget */*w*/, SPGradientSelector return; } - SPGradient *obj = NULL; + SPGradient *obj = nullptr; /* Single selection */ Gtk::TreeModel::iterator iter = selection->get_selected(); if ( iter ) { @@ -516,7 +516,7 @@ sp_gradient_selector_edit_vector_clicked (GtkWidget */*w*/, SPGradientSelector * 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 ); } } } @@ -533,14 +533,14 @@ sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *s SPGradient *gr = sp_gradient_vector_selector_get_gradient( SP_GRADIENT_VECTOR_SELECTOR (sel->vectors)); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::XML::Node *repr = NULL; + Inkscape::XML::Node *repr = nullptr; if (gr) { repr = gr->getRepr()->duplicate(xml_doc); // Rename the new gradients id to be similar to the cloned gradients Glib::ustring old_id = gr->getId(); rename_id(gr, old_id); - doc->getDefs()->getRepr()->addChild(repr, NULL); + doc->getDefs()->getRepr()->addChild(repr, nullptr); } else { repr = xml_doc->createElement("svg:linearGradient"); Inkscape::XML::Node *stop = xml_doc->createElement("svg:stop"); @@ -553,7 +553,7 @@ sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *s stop->setAttribute("style", "stop-color:#fff;stop-opacity:1;"); repr->appendChild(stop); Inkscape::GC::release(stop); - doc->getDefs()->getRepr()->addChild(repr, NULL); + doc->getDefs()->getRepr()->addChild(repr, nullptr); gr = SP_GRADIENT(doc->getObjectByRepr(repr)); } diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 412f0b7e2..26f3fc505 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -87,7 +87,7 @@ unsigned long sp_gradient_to_hhssll(SPGradient *gr); static guint signals[LAST_SIGNAL] = {0}; // TODO FIXME kill these globals!!! -static GtkWidget *dlg = NULL; +static GtkWidget *dlg = nullptr; static win_data wd; static gint x = -1000, y = -1000, w = 0, h = 0; // impossible original values to make sure they are read from prefs static Glib::ustring const prefs_path = "/dialogs/gradienteditor/"; @@ -102,7 +102,7 @@ static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass G_TYPE_FROM_CLASS(gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(SPGradientVectorSelectorClass, vector_set), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); @@ -119,8 +119,8 @@ static void sp_gradient_vector_selector_init(SPGradientVectorSelector *gvs) gvs->swatched = false; - gvs->doc = NULL; - gvs->gr = NULL; + gvs->doc = nullptr; + gvs->gr = nullptr; new (&gvs->gradient_release_connection) sigc::connection(); new (&gvs->defs_release_connection) sigc::connection(); @@ -139,13 +139,13 @@ static void sp_gradient_vector_selector_destroy(GtkWidget *object) if (gvs->gr) { gvs->gradient_release_connection.disconnect(); gvs->tree_select_connection.disconnect(); - gvs->gr = NULL; + gvs->gr = nullptr; } if (gvs->doc) { gvs->defs_release_connection.disconnect(); gvs->defs_modified_connection.disconnect(); - gvs->doc = NULL; + gvs->doc = nullptr; } gvs->gradient_release_connection.~connection(); @@ -165,7 +165,7 @@ GtkWidget *sp_gradient_vector_selector_new(SPDocument *doc, SPGradient *gr) g_return_val_if_fail(!gr || SP_IS_GRADIENT(gr), NULL); g_return_val_if_fail(!gr || (gr->document == doc), NULL); - gvs = static_cast<GtkWidget*>(g_object_new(SP_TYPE_GRADIENT_VECTOR_SELECTOR, NULL)); + gvs = static_cast<GtkWidget*>(g_object_new(SP_TYPE_GRADIENT_VECTOR_SELECTOR, nullptr)); if (doc) { sp_gradient_vector_selector_set_gradient(SP_GRADIENT_VECTOR_SELECTOR(gvs), doc, gr); @@ -184,9 +184,9 @@ void sp_gradient_vector_selector_set_gradient(SPGradientVectorSelector *gvs, SPD // (gr ? gr->isSolid() : -1)); static gboolean suppress = FALSE; - g_return_if_fail(gvs != NULL); + g_return_if_fail(gvs != nullptr); g_return_if_fail(SP_IS_GRADIENT_VECTOR_SELECTOR(gvs)); - g_return_if_fail(!gr || (doc != NULL)); + g_return_if_fail(!gr || (doc != nullptr)); g_return_if_fail(!gr || SP_IS_GRADIENT(gr)); g_return_if_fail(!gr || (gr->document == doc)); g_return_if_fail(!gr || gr->hasStops()); @@ -195,12 +195,12 @@ void sp_gradient_vector_selector_set_gradient(SPGradientVectorSelector *gvs, SPD /* Disconnect signals */ if (gvs->gr) { gvs->gradient_release_connection.disconnect(); - gvs->gr = NULL; + gvs->gr = nullptr; } if (gvs->doc) { gvs->defs_release_connection.disconnect(); gvs->defs_modified_connection.disconnect(); - gvs->doc = NULL; + gvs->doc = nullptr; } // Connect signals @@ -219,7 +219,7 @@ void sp_gradient_vector_selector_set_gradient(SPGradientVectorSelector *gvs, SPD // Harder case - keep document, rebuild list and stuff // fixme: (Lauris) suppress = TRUE; - sp_gradient_vector_selector_set_gradient(gvs, NULL, NULL); + sp_gradient_vector_selector_set_gradient(gvs, nullptr, nullptr); sp_gradient_vector_selector_set_gradient(gvs, doc, gr); suppress = FALSE; g_signal_emit(G_OBJECT(gvs), signals[VECTOR_SET], 0, gr); @@ -229,7 +229,7 @@ void sp_gradient_vector_selector_set_gradient(SPGradientVectorSelector *gvs, SPD SPDocument *sp_gradient_vector_selector_get_document(SPGradientVectorSelector *gvs) { - g_return_val_if_fail(gvs != NULL, NULL); + g_return_val_if_fail(gvs != nullptr, NULL); g_return_val_if_fail(SP_IS_GRADIENT_VECTOR_SELECTOR(gvs), NULL); return gvs->doc; @@ -237,7 +237,7 @@ SPDocument *sp_gradient_vector_selector_get_document(SPGradientVectorSelector *g SPGradient *sp_gradient_vector_selector_get_gradient(SPGradientVectorSelector *gvs) { - g_return_val_if_fail(gvs != NULL, NULL); + g_return_val_if_fail(gvs != nullptr, NULL); g_return_val_if_fail(SP_IS_GRADIENT_VECTOR_SELECTOR(gvs), NULL); return gvs->gr; @@ -365,7 +365,7 @@ static SPGradient * gr_item_get_gradient(SPItem *item, gboolean fillorstroke) } } - return NULL; + return nullptr; } /* @@ -382,7 +382,7 @@ void gr_get_usage_counts(SPDocument *doc, std::map<SPGradient *, gint> *mapUsage for (auto item:all_list) { if (!item->getId()) continue; - SPGradient *gr = NULL; + SPGradient *gr = nullptr; gr = gr_item_get_gradient(item, true); // fill if (gr) { mapUsageCount->count(gr) > 0 ? (*mapUsageCount)[gr] += 1 : (*mapUsageCount)[gr] = 1; @@ -399,7 +399,7 @@ static void sp_gvs_gradient_release(SPObject */*obj*/, SPGradientVectorSelector /* Disconnect gradient */ if (gvs->gr) { gvs->gradient_release_connection.disconnect(); - gvs->gr = NULL; + gvs->gr = nullptr; } /* Rebuild GUI */ @@ -408,7 +408,7 @@ static void sp_gvs_gradient_release(SPObject */*obj*/, SPGradientVectorSelector static void sp_gvs_defs_release(SPObject */*defs*/, SPGradientVectorSelector *gvs) { - gvs->doc = NULL; + gvs->doc = nullptr; gvs->defs_release_connection.disconnect(); gvs->defs_modified_connection.disconnect(); @@ -416,7 +416,7 @@ static void sp_gvs_defs_release(SPObject */*defs*/, SPGradientVectorSelector *gv /* Disconnect gradient as well */ if (gvs->gr) { gvs->gradient_release_connection.disconnect(); - gvs->gr = NULL; + gvs->gr = nullptr; } /* Rebuild GUI */ @@ -463,7 +463,7 @@ static void grad_edit_dia_stop_added_or_removed(Inkscape::XML::Node */*repr*/, I { GtkWidget *vb = GTK_WIDGET(data); SPGradient *gradient = static_cast<SPGradient *>(g_object_get_data(G_OBJECT(vb), "gradient")); - update_stop_list(vb, gradient, NULL); + update_stop_list(vb, gradient, nullptr); } //FIXME!!! We must also listen to attr changes on all children (i.e. stops) too, @@ -473,15 +473,15 @@ static Inkscape::XML::NodeEventVector grad_edit_dia_repr_events = { grad_edit_dia_stop_added_or_removed, /* child_added */ grad_edit_dia_stop_added_or_removed, /* child_removed */ - NULL, /* attr_changed*/ - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* attr_changed*/ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; static void verify_grad(SPGradient *gradient) { int i = 0; - SPStop *stop = NULL; + SPStop *stop = nullptr; /* count stops */ for (auto& ochild: gradient->children) { if (SP_IS_STOP(&ochild)) { @@ -502,13 +502,13 @@ static void verify_grad(SPGradient *gradient) child = xml_doc->createElement("svg:stop"); sp_repr_set_css_double(child, "offset", 0.0); child->setAttribute("style", os.str().c_str()); - gradient->getRepr()->addChild(child, NULL); + gradient->getRepr()->addChild(child, nullptr); Inkscape::GC::release(child); child = xml_doc->createElement("svg:stop"); sp_repr_set_css_double(child, "offset", 1.0); child->setAttribute("style", os.str().c_str()); - gradient->getRepr()->addChild(child, NULL); + gradient->getRepr()->addChild(child, nullptr); Inkscape::GC::release(child); return; } @@ -586,7 +586,7 @@ static void update_stop_list( GtkWidget *vb, SPGradient *gradient, SPStop *new_s } /* Set history */ - if (new_stop == NULL) { + if (new_stop == nullptr) { gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box) , 0); } else { select_stop_in_list(vb, gradient, new_stop); @@ -618,18 +618,18 @@ static void sp_grad_edit_combo_box_changed (GtkComboBox * /*widget*/, GtkWidget 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; @@ -654,7 +654,7 @@ static void sp_grad_edit_combo_box_changed (GtkComboBox * /*widget*/, GtkWidget static SPStop *get_selected_stop( GtkWidget *vb) { - SPStop *stop = NULL; + SPStop *stop = nullptr; GtkWidget *combo_box = static_cast<GtkWidget *>(g_object_get_data(G_OBJECT(vb), "combo_box")); if (combo_box) { GtkTreeIter iter; @@ -706,19 +706,19 @@ static void sp_grd_ed_add_stop(GtkWidget */*widget*/, GtkWidget *vb) return; } - Inkscape::XML::Node *new_stop_repr = NULL; + Inkscape::XML::Node *new_stop_repr = nullptr; SPStop *next = stop->getNextStop(); - if (next == NULL) { + if (next == nullptr) { SPStop *prev = stop->getPrevStop(); - if (prev != NULL) { + if (prev != nullptr) { next = stop; stop = prev; } } - if (next != NULL) { + if (next != nullptr) { new_stop_repr = stop->getRepr()->duplicate(gradient->getRepr()->document()); gradient->getRepr()->addChild(new_stop_repr, stop->getRepr()); } else { @@ -782,7 +782,7 @@ static void sp_grd_ed_del_stop(GtkWidget */*widget*/, GtkWidget *vb) gradient->getRepr()->removeChild(stop->getRepr()); sp_gradient_vector_widget_load_gradient(vb, gradient); - update_stop_list(GTK_WIDGET(vb), gradient, NULL); + update_stop_list(GTK_WIDGET(vb), gradient, nullptr); DocumentUndo::done(gradient->document, SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop")); } @@ -795,7 +795,7 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s GtkWidget *vb, *w, *f; - g_return_val_if_fail(gradient != NULL, NULL); + g_return_val_if_fail(gradient != nullptr, NULL); g_return_val_if_fail(SP_IS_GRADIENT(gradient), NULL); vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, PAD); @@ -827,7 +827,7 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s gtk_box_pack_start(GTK_BOX(vb), combo_box, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(vb), "combo_box", combo_box); - update_stop_list(GTK_WIDGET(vb), gradient, NULL); + update_stop_list(GTK_WIDGET(vb), gradient, nullptr); g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(sp_grad_edit_combo_box_changed), vb); @@ -861,13 +861,13 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s gtk_widget_show(l); /* Adjustment */ - GtkAdjustment *Offset_adj = NULL; + GtkAdjustment *Offset_adj = nullptr; Offset_adj= GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 1.0, 0.01, 0.01, 0.0)); g_object_set_data(G_OBJECT(vb), "offset", Offset_adj); SPStop *stop = get_selected_stop(vb); if (!stop) { - return NULL; + return nullptr; } gtk_adjustment_set_value(Offset_adj, stop->offset); @@ -940,7 +940,7 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s GtkWidget * sp_gradient_vector_editor_new(SPGradient *gradient, SPStop *stop) { - if (dlg == NULL) { + if (dlg == nullptr) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); dlg = sp_window_new(_("Gradient editor"), TRUE); @@ -973,7 +973,7 @@ GtkWidget * sp_gradient_vector_editor_new(SPGradient *gradient, SPStop *stop) wd.stop = 0; GObject *obj = G_OBJECT(dlg); - sigc::connection *conn = NULL; + sigc::connection *conn = nullptr; conn = new sigc::connection(INKSCAPE.signal_activate_desktop.connect(sigc::bind(sigc::ptr_fun(&sp_transientize_callback), &wd))); g_object_set_data(obj, "desktop-activate-connection", conn); @@ -984,7 +984,7 @@ GtkWidget * sp_gradient_vector_editor_new(SPGradient *gradient, SPStop *stop) conn = new sigc::connection(INKSCAPE.signal_shut_down.connect( sigc::hide_return( - sigc::bind(sigc::ptr_fun(&sp_gradient_vector_dialog_delete), (GtkWidget *) NULL, (GdkEvent *) NULL, (GtkWidget *) NULL) + sigc::bind(sigc::ptr_fun(&sp_gradient_vector_dialog_delete), (GtkWidget *) nullptr, (GdkEvent *) nullptr, (GtkWidget *) nullptr) ))); g_object_set_data(obj, "shutdown-connection", conn); @@ -1017,7 +1017,7 @@ GtkWidget * sp_gradient_vector_editor_new(SPGradient *gradient, SPStop *stop) gtk_main_do_event(reinterpret_cast<GdkEvent*>(&event)); g_object_unref(G_OBJECT(event.window)); - g_assert(dlg == NULL); + g_assert(dlg == nullptr); sp_gradient_vector_editor_new(gradient, stop); } @@ -1040,8 +1040,8 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien modified_connection = static_cast<sigc::connection *>(g_object_get_data(G_OBJECT(widget), "gradient_modified_connection")); if (old) { - g_assert( release_connection != NULL ); - g_assert( modified_connection != NULL ); + g_assert( release_connection != nullptr ); + g_assert( modified_connection != nullptr ); release_connection->disconnect(); modified_connection->disconnect(); sp_signal_disconnect_by_data(old, widget); @@ -1059,11 +1059,11 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien } else { if (release_connection) { delete release_connection; - release_connection = NULL; + release_connection = nullptr; } if (modified_connection) { delete modified_connection; - modified_connection = NULL; + modified_connection = nullptr; } } @@ -1094,14 +1094,14 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien GtkWidget *w = static_cast<GtkWidget *>(g_object_get_data(G_OBJECT(widget), "preview")); sp_gradient_image_set_gradient(SP_GRADIENT_IMAGE(w), gradient); - update_stop_list(GTK_WIDGET(widget), gradient, NULL); + update_stop_list(GTK_WIDGET(widget), gradient, nullptr); // Once the user edits a gradient, it stops being auto-collectable if (gradient->getRepr()->attribute("inkscape:collect")) { SPDocument *document = gradient->document; bool saved = DocumentUndo::getUndoSensitive(document); DocumentUndo::setUndoSensitive(document, false); - gradient->getRepr()->setAttribute("inkscape:collect", NULL); + gradient->getRepr()->setAttribute("inkscape:collect", nullptr); DocumentUndo::setUndoSensitive(document, saved); } } else { // no gradient, disable everything @@ -1136,7 +1136,7 @@ static void sp_gradient_vector_dialog_destroy(GtkWidget * /*object*/, gpointer / conn->disconnect(); delete conn; - wd.win = dlg = NULL; + wd.win = dlg = nullptr; wd.stop = 0; } @@ -1170,8 +1170,8 @@ static void sp_gradient_vector_widget_destroy(GtkWidget *object, gpointer /*data sigc::connection *modified_connection = static_cast<sigc::connection *>(g_object_get_data(G_OBJECT(object), "gradient_modified_connection")); if (gradient) { - g_assert( release_connection != NULL ); - g_assert( modified_connection != NULL ); + g_assert( release_connection != nullptr ); + g_assert( modified_connection != nullptr ); release_connection->disconnect(); modified_connection->disconnect(); sp_signal_disconnect_by_data(gradient, object); @@ -1184,13 +1184,13 @@ static void sp_gradient_vector_widget_destroy(GtkWidget *object, gpointer /*data SelectedColor *selected_color = static_cast<SelectedColor *>(g_object_get_data(G_OBJECT(object), "cselector")); if (selected_color) { delete selected_color; - g_object_set_data(G_OBJECT(object), "cselector", NULL); + g_object_set_data(G_OBJECT(object), "cselector", nullptr); } } static void sp_gradient_vector_gradient_release(SPObject */*object*/, GtkWidget *widget) { - sp_gradient_vector_widget_load_gradient(widget, NULL); + sp_gradient_vector_widget_load_gradient(widget, nullptr); } static void sp_gradient_vector_gradient_modified(SPObject *object, guint /*flags*/, GtkWidget *widget) @@ -1267,7 +1267,7 @@ static void sp_gradient_vector_color_changed(Inkscape::UI::SelectedColor *select /* Set start parameters */ /* We rely on normalized vector, i.e. stops HAVE to exist */ - g_return_if_fail(ngr->getFirstStop() != NULL); + g_return_if_fail(ngr->getFirstStop() != nullptr); SPStop *stop = get_selected_stop(GTK_WIDGET(object)); if (!stop) { diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index b51b276b9..793f37384 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -72,7 +72,7 @@ SPDocument *sp_gradient_vector_selector_get_document (SPGradientVectorSelector * SPGradient *sp_gradient_vector_selector_get_gradient (SPGradientVectorSelector *gvs); /* fixme: rethink this (Lauris) */ -GtkWidget *sp_gradient_vector_editor_new (SPGradient *gradient, SPStop *stop = NULL); +GtkWidget *sp_gradient_vector_editor_new (SPGradient *gradient, SPStop *stop = nullptr); guint32 sp_average_color(guint32 c1, guint32 c2, gdouble p = 0.5); diff --git a/src/widgets/ink-action.cpp b/src/widgets/ink-action.cpp index dae214656..5adb69ac6 100644 --- a/src/widgets/ink-action.cpp +++ b/src/widgets/ink-action.cpp @@ -63,7 +63,7 @@ static void ink_action_class_init( InkActionClass* klass ) static void ink_action_init( InkAction* action ) { action->private_data = INK_ACTION_GET_PRIVATE( action ); - action->private_data->iconId = 0; + action->private_data->iconId = nullptr; action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR; } diff --git a/src/widgets/ink-comboboxentry-action.cpp b/src/widgets/ink-comboboxentry-action.cpp index 133ae7878..5aace3f34 100644 --- a/src/widgets/ink-comboboxentry-action.cpp +++ b/src/widgets/ink-comboboxentry-action.cpp @@ -287,7 +287,7 @@ ink_comboboxentry_action_class_init (Ink_ComboBoxEntry_ActionClass *klass) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(Ink_ComboBoxEntry_ActionClass, changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -296,7 +296,7 @@ ink_comboboxentry_action_class_init (Ink_ComboBoxEntry_ActionClass *klass) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(Ink_ComboBoxEntry_ActionClass, activated), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -306,19 +306,19 @@ static void ink_comboboxentry_action_init (Ink_ComboBoxEntry_Action *action) { action->active = -1; action->text = strdup(""); - action->entry_completion = NULL; - action->indicator = NULL; + action->entry_completion = nullptr; + action->indicator = nullptr; action->popup = false; - action->info = NULL; - action->info_cb = NULL; + action->info = nullptr; + action->info_cb = nullptr; action->info_cb_id = 0; action->info_cb_blocked = false; - action->warning = NULL; - action->warning_cb = NULL; + action->warning = nullptr; + action->warning_cb = nullptr; action->warning_cb_id = 0; action->warning_cb_blocked = false; - action->altx_name = NULL; - action->focusWidget = NULL; + action->altx_name = nullptr; + action->focusWidget = nullptr; } Ink_ComboBoxEntry_Action *ink_comboboxentry_action_new (const gchar *name, @@ -332,7 +332,7 @@ Ink_ComboBoxEntry_Action *ink_comboboxentry_action_new (const gchar *name, void *separator_func, GtkWidget *focusWidget) { - g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (name != nullptr, NULL); return (Ink_ComboBoxEntry_Action*)g_object_new (INK_COMBOBOXENTRY_TYPE_ACTION, "name", name, @@ -351,15 +351,15 @@ Ink_ComboBoxEntry_Action *ink_comboboxentry_action_new (const gchar *name, // Create a widget for a toolbar. GtkWidget* create_tool_item( GtkAction* action ) { - GtkWidget* item = 0; + GtkWidget* item = nullptr; if ( INK_COMBOBOXENTRY_IS_ACTION( action ) && INK_COMBOBOXENTRY_ACTION(action)->model ) { Ink_ComboBoxEntry_Action* ink_comboboxentry_action = INK_COMBOBOXENTRY_ACTION( action ); gchar *action_name = g_strdup( gtk_action_get_name( action ) ); - gchar *combobox_name = g_strjoin( NULL, action_name, "_combobox", NULL ); - gchar *entry_name = g_strjoin( NULL, action_name, "_entry", NULL ); + gchar *combobox_name = g_strjoin( nullptr, action_name, "_combobox", NULL ); + gchar *entry_name = g_strjoin( nullptr, action_name, "_entry", NULL ); g_free( action_name ); item = GTK_WIDGET( gtk_tool_item_new() ); @@ -386,10 +386,10 @@ GtkWidget* create_tool_item( GtkAction* action ) g_signal_connect( G_OBJECT(comboBoxEntry), "changed", G_CALLBACK(combo_box_changed_cb), action ); // Optionally add separator function... - if( ink_comboboxentry_action->separator_func != NULL ) { + if( ink_comboboxentry_action->separator_func != nullptr ) { gtk_combo_box_set_row_separator_func( ink_comboboxentry_action->combobox, GtkTreeViewRowSeparatorFunc (ink_comboboxentry_action->separator_func), - NULL, NULL ); + nullptr, nullptr ); } // FIXME: once gtk3 migration is done this can be removed @@ -397,19 +397,19 @@ GtkWidget* create_tool_item( GtkAction* action ) gtk_widget_show_all (comboBoxEntry); // Optionally add formatting... - if( ink_comboboxentry_action->cell_data_func != NULL ) { + if( ink_comboboxentry_action->cell_data_func != nullptr ) { GtkCellRenderer *cell = gtk_cell_renderer_text_new(); gtk_cell_layout_clear( GTK_CELL_LAYOUT( comboBoxEntry ) ); gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( comboBoxEntry ), cell, true ); gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT( comboBoxEntry ), cell, GtkCellLayoutDataFunc (ink_comboboxentry_action->cell_data_func), - NULL, NULL ); + nullptr, nullptr ); } // Optionally widen the combobox width... which widens the drop-down list in list mode. if( ink_comboboxentry_action->extra_width > 0 ) { GtkRequisition req; - gtk_widget_get_preferred_size(GTK_WIDGET(ink_comboboxentry_action->combobox), &req, NULL); + gtk_widget_get_preferred_size(GTK_WIDGET(ink_comboboxentry_action->combobox), &req, nullptr); gtk_widget_set_size_request( GTK_WIDGET( ink_comboboxentry_action->combobox ), req.width + ink_comboboxentry_action->extra_width, -1 ); } @@ -460,7 +460,7 @@ GtkWidget* create_tool_item( GtkAction* action ) // Create a drop-down menu. GtkWidget* create_menu_item( GtkAction* action ) { - GtkWidget* item = 0; + GtkWidget* item = nullptr; item = GTK_ACTION_CLASS(ink_comboboxentry_action_parent_class)->create_menu_item( action ); g_warning( "ink_comboboxentry_action: create_menu_item not implemented" ); @@ -535,7 +535,7 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* act } bool set = false; - if( action->warning != NULL ) { + if( action->warning != nullptr ) { Glib::ustring missing = check_comma_separated_text( action ); if( !missing.empty() ) { gtk_entry_set_icon_from_icon_name( action->entry, @@ -570,7 +570,7 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* act } } - if( !set && action->info != NULL ) { + if( !set && action->info != nullptr ) { gtk_entry_set_icon_from_icon_name( GTK_ENTRY(action->entry), GTK_ENTRY_ICON_SECONDARY, INKSCAPE_ICON("edit-select-all") ); @@ -600,7 +600,7 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* act if( !set ) { gtk_entry_set_icon_from_icon_name( GTK_ENTRY(action->entry), GTK_ENTRY_ICON_SECONDARY, - NULL ); + nullptr ); } } @@ -626,7 +626,7 @@ void ink_comboboxentry_action_set_extra_width( Ink_ComboBoxEntry_Action* action, // Widget may not have been created.... if( action->combobox ) { GtkRequisition req; - gtk_widget_get_preferred_size(GTK_WIDGET(action->combobox), &req, NULL); + gtk_widget_get_preferred_size(GTK_WIDGET(action->combobox), &req, nullptr); gtk_widget_set_size_request( GTK_WIDGET( action->combobox ), req.width + action->extra_width, -1 ); } } @@ -662,7 +662,7 @@ void ink_comboboxentry_action_popup_disable( Ink_ComboBoxEntry_Action* action ) if( action->entry_completion ) { gtk_widget_destroy(GTK_WIDGET(action->entry_completion)); - action->entry_completion = 0; + action->entry_completion = nullptr; } } void ink_comboboxentry_action_set_tooltip( Ink_ComboBoxEntry_Action* action, const gchar* tooltip ) { @@ -748,7 +748,7 @@ gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* ta if( check ) { // Get text from list entry - gchar* text = 0; + gchar* text = nullptr; gtk_tree_model_get( action->model, &iter, 0, &text, -1 ); // Column 0 if( !ignore_case ) { @@ -801,7 +801,7 @@ static Glib::ustring check_comma_separated_text( Ink_ComboBoxEntry_Action* actio gchar** tokens = g_strsplit( action->text, ",", 0 ); gint i = 0; - while( tokens[i] != NULL ) { + while( tokens[i] != nullptr ) { // Remove any surrounding white space. g_strstrip( tokens[i] ); @@ -842,7 +842,7 @@ static void combo_box_changed_cb( GtkComboBox* widget, gpointer data ) { GtkTreeIter iter; if( gtk_combo_box_get_active_iter( GTK_COMBO_BOX( action->combobox ), &iter ) ) { - gchar* text = 0; + gchar* text = nullptr; gtk_tree_model_get( action->model, &iter, 0, &text, -1 ); gtk_entry_set_text( action->entry, text ); @@ -885,7 +885,7 @@ static gboolean match_selected_cb( GtkEntryCompletion* /*widget*/, GtkTreeModel* GtkEntry *entry = action->entry; if( entry) { - gchar *family = 0; + gchar *family = nullptr; gtk_tree_model_get(model, iter, 0, &family, -1); // Set text in GtkEntry @@ -924,7 +924,7 @@ gboolean keypress_cb( GtkWidget * /*widget*/, GdkEventKey *event, gpointer data Ink_ComboBoxEntry_Action* action = INK_COMBOBOXENTRY_ACTION( data ); gdk_keymap_translate_keyboard_state( Gdk::Display::get_default()->get_keymap(), event->hardware_keycode, (GdkModifierType)event->state, - 0, &key, 0, 0, 0 ); + 0, &key, nullptr, nullptr, nullptr ); switch ( key ) { diff --git a/src/widgets/ink-comboboxentry-action.h b/src/widgets/ink-comboboxentry-action.h index 04b66e8fe..9faf44268 100644 --- a/src/widgets/ink-comboboxentry-action.h +++ b/src/widgets/ink-comboboxentry-action.h @@ -79,9 +79,9 @@ Ink_ComboBoxEntry_Action *ink_comboboxentry_action_new ( const gchar *name, GtkTreeModel *model, gint entry_width = -1, gint extra_width = -1, - gpointer cell_data_func = NULL, - gpointer separator_func = NULL, - GtkWidget* focusWidget = NULL); + gpointer cell_data_func = nullptr, + gpointer separator_func = nullptr, + GtkWidget* focusWidget = nullptr); GtkTreeModel *ink_comboboxentry_action_get_model( Ink_ComboBoxEntry_Action* action ); GtkComboBox *ink_comboboxentry_action_get_comboboxentry( Ink_ComboBoxEntry_Action* action ); diff --git a/src/widgets/ink-radio-action.cpp b/src/widgets/ink-radio-action.cpp index e2bf828ce..611e0c624 100644 --- a/src/widgets/ink-radio-action.cpp +++ b/src/widgets/ink-radio-action.cpp @@ -61,7 +61,7 @@ static void ink_radio_action_class_init( InkRadioActionClass* klass ) static void ink_radio_action_init( InkRadioAction* action ) { action->private_data = INK_RADIO_ACTION_GET_PRIVATE( action ); - action->private_data->iconId = 0; + action->private_data->iconId = nullptr; action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR; } diff --git a/src/widgets/ink-toggle-action.cpp b/src/widgets/ink-toggle-action.cpp index 200d0d558..467f0f24c 100644 --- a/src/widgets/ink-toggle-action.cpp +++ b/src/widgets/ink-toggle-action.cpp @@ -63,7 +63,7 @@ static void ink_toggle_action_class_init( InkToggleActionClass* klass ) static void ink_toggle_action_init( InkToggleAction* action ) { action->private_data = INK_TOGGLE_ACTION_GET_PRIVATE( action ); - action->private_data->iconId = 0; + action->private_data->iconId = nullptr; action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR; } @@ -169,11 +169,11 @@ static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action ) gtk_widget_set_vexpand(child, FALSE); gtk_tool_button_set_icon_widget(button, child); } else { - gchar *label = 0; + gchar *label = nullptr; g_object_get( G_OBJECT(action), "short_label", &label, NULL ); gtk_tool_button_set_label( button, label ); g_free( label ); - label = 0; + label = nullptr; } } else { // For now trigger a warning but don't do anything else diff --git a/src/widgets/ink-tool-menu-action.cpp b/src/widgets/ink-tool-menu-action.cpp index 44c09147b..d1d9501b4 100644 --- a/src/widgets/ink-tool-menu-action.cpp +++ b/src/widgets/ink-tool-menu-action.cpp @@ -23,7 +23,7 @@ ink_tool_menu_action_new (const gchar *name, const gchar *inkId, GtkIconSize size ) { - g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (name != nullptr, NULL); GObject* obj = (GObject*)g_object_new( INK_TOOL_MENU_ACTION_TYPE, "name", name, diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 991d81d4a..3fcd40bdf 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -127,7 +127,7 @@ static bool isPaintModeGradient(SPPaintSelector::Mode mode) static SPGradientSelector *getGradientFromData(SPPaintSelector const *psel) { - SPGradientSelector *grad = 0; + SPGradientSelector *grad = nullptr; if (psel->mode == SPPaintSelector::MODE_SWATCH) { SwatchSelector *swatchsel = static_cast<SwatchSelector*>(g_object_get_data(G_OBJECT(psel->selector), "swatch-selector")); if (swatchsel) { @@ -150,42 +150,42 @@ sp_paint_selector_class_init(SPPaintSelectorClass *klass) G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPPaintSelectorClass, mode_changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); psel_signals[GRABBED] = g_signal_new("grabbed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPPaintSelectorClass, grabbed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); psel_signals[DRAGGED] = g_signal_new("dragged", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPPaintSelectorClass, dragged), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); psel_signals[RELEASED] = g_signal_new("released", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPPaintSelectorClass, released), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); psel_signals[CHANGED] = g_signal_new("changed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPPaintSelectorClass, changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); psel_signals[FILLRULE_CHANGED] = g_signal_new("fillrule_changed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPPaintSelectorClass, fillrule_changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); @@ -237,7 +237,7 @@ sp_paint_selector_init(SPPaintSelector *psel) gtk_box_pack_end(GTK_BOX(psel->style), psel->fillrulebox, FALSE, FALSE, 0); GtkWidget *w; - psel->evenodd = gtk_radio_button_new(NULL); + psel->evenodd = gtk_radio_button_new(nullptr); gtk_button_set_relief(GTK_BUTTON(psel->evenodd), GTK_RELIEF_NONE); gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(psel->evenodd), FALSE); // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty @@ -290,16 +290,16 @@ static void sp_paint_selector_dispose(GObject *object) SPPaintSelector *psel = SP_PAINT_SELECTOR(object); // clean up our long-living pattern menu - g_object_set_data(G_OBJECT(psel),"patternmenu",NULL); + g_object_set_data(G_OBJECT(psel),"patternmenu",nullptr); #ifdef WITH_MESH // clean up our long-living mesh menu - g_object_set_data(G_OBJECT(psel),"meshmenu",NULL); + g_object_set_data(G_OBJECT(psel),"meshmenu",nullptr); #endif if (psel->selected_color) { delete psel->selected_color; - psel->selected_color = NULL; + psel->selected_color = nullptr; } if ((G_OBJECT_CLASS(sp_paint_selector_parent_class))->dispose) @@ -358,7 +358,7 @@ sp_paint_selector_show_fillrule(SPPaintSelector *psel, bool is_fill) gtk_widget_show_all(psel->fillrulebox); } else { gtk_widget_destroy(psel->fillrulebox); - psel->fillrulebox = NULL; + psel->fillrulebox = nullptr; } } } @@ -366,7 +366,7 @@ sp_paint_selector_show_fillrule(SPPaintSelector *psel, bool is_fill) SPPaintSelector *sp_paint_selector_new(FillOrStroke kind) { - SPPaintSelector *psel = static_cast<SPPaintSelector*>(g_object_new(SP_TYPE_PAINT_SELECTOR, NULL)); + SPPaintSelector *psel = static_cast<SPPaintSelector*>(g_object_new(SP_TYPE_PAINT_SELECTOR, nullptr)); psel->setMode(SPPaintSelector::MODE_MULTIPLE); @@ -472,7 +472,7 @@ void SPPaintSelector::setSwatch(SPGradient *vector ) SwatchSelector *swatchsel = static_cast<SwatchSelector*>(g_object_get_data(G_OBJECT(selector), "swatch-selector")); if (swatchsel) { - swatchsel->setVector( (vector) ? vector->document : 0, vector ); + swatchsel->setVector( (vector) ? vector->document : nullptr, vector ); } } @@ -486,7 +486,7 @@ void SPPaintSelector::setGradientLinear(SPGradient *vector) SPGradientSelector *gsel = getGradientFromData(this); gsel->setMode(SPGradientSelector::MODE_LINEAR); - gsel->setVector((vector) ? vector->document : 0, vector); + gsel->setVector((vector) ? vector->document : nullptr, vector); } void SPPaintSelector::setGradientRadial(SPGradient *vector) @@ -500,7 +500,7 @@ void SPPaintSelector::setGradientRadial(SPGradient *vector) gsel->setMode(SPGradientSelector::MODE_RADIAL); - gsel->setVector((vector) ? vector->document : 0, vector); + gsel->setVector((vector) ? vector->document : nullptr, vector); } #ifdef WITH_MESH @@ -550,7 +550,7 @@ void SPPaintSelector::getColorAlpha(SPColor &color, gfloat &alpha) const SPGradient *SPPaintSelector::getGradientVector() { - SPGradient* vect = 0; + SPGradient* vect = nullptr; if (isPaintModeGradient(mode)) { SPGradientSelector *gsel = getGradientFromData(this); @@ -574,7 +574,7 @@ void SPPaintSelector::pushAttrsToGradient( SPGradient *gr ) const static void sp_paint_selector_clear_frame(SPPaintSelector *psel) { - g_return_if_fail( psel != NULL); + g_return_if_fail( psel != nullptr); if (psel->selector) { @@ -582,14 +582,14 @@ sp_paint_selector_clear_frame(SPPaintSelector *psel) //The widget is hidden first so it can recognize that it should not process signals from notebook child gtk_widget_set_visible(psel->selector, false); gtk_widget_destroy(psel->selector); - psel->selector = NULL; + psel->selector = nullptr; } } static void sp_paint_selector_set_mode_empty(SPPaintSelector *psel) { - sp_paint_selector_set_style_buttons(psel, NULL); + sp_paint_selector_set_style_buttons(psel, nullptr); gtk_widget_set_sensitive(psel->style, FALSE); sp_paint_selector_clear_frame(psel); @@ -600,7 +600,7 @@ sp_paint_selector_set_mode_empty(SPPaintSelector *psel) static void sp_paint_selector_set_mode_multiple(SPPaintSelector *psel) { - sp_paint_selector_set_style_buttons(psel, NULL); + sp_paint_selector_set_style_buttons(psel, nullptr); gtk_widget_set_sensitive(psel->style, TRUE); sp_paint_selector_clear_frame(psel); @@ -803,7 +803,7 @@ static std::vector<SPMeshGradient *> ink_mesh_list_get (SPDocument *source) { std::vector<SPMeshGradient *> pl; - if (source == NULL) + if (source == nullptr) return pl; @@ -861,7 +861,7 @@ static void sp_mesh_list_from_doc(GtkWidget *combo, SPDocument * /*current_doc*/ static void ink_mesh_menu_populate_menu(GtkWidget *combo, SPDocument *doc) { - static SPDocument *meshes_doc = NULL; + static SPDocument *meshes_doc = nullptr; // If we ever add a list of canned mesh gradients, uncomment following: @@ -875,7 +875,7 @@ ink_mesh_menu_populate_menu(GtkWidget *combo, SPDocument *doc) // } // suck in from current doc - sp_mesh_list_from_doc ( combo, NULL, doc, meshes_doc ); + sp_mesh_list_from_doc ( combo, nullptr, doc, meshes_doc ); // add separator // { @@ -939,7 +939,7 @@ void SPPaintSelector::updateMeshList( SPMeshGradient *mesh ) } GtkWidget *combo = GTK_WIDGET(g_object_get_data(G_OBJECT(this), "meshmenu")); - g_assert( combo != NULL ); + g_assert( combo != nullptr ); /* Clear existing menu if any */ GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo)); @@ -956,7 +956,7 @@ void SPPaintSelector::updateMeshList( SPMeshGradient *mesh ) // Find this mesh and set it active in the combo_box GtkTreeIter iter ; - gchar *meshid = NULL; + gchar *meshid = nullptr; bool valid = gtk_tree_model_get_iter_first (store, &iter); if (!valid) { return; @@ -982,7 +982,7 @@ static void sp_paint_selector_set_mode_mesh(SPPaintSelector *psel, SPPaintSelect } gtk_widget_set_sensitive(psel->style, TRUE); - GtkWidget *tbl = NULL; + GtkWidget *tbl = nullptr; if (psel->mode == SPPaintSelector::MODE_GRADIENT_MESH) { /* Already have mesh menu */ @@ -1005,7 +1005,7 @@ static void sp_paint_selector_set_mode_mesh(SPPaintSelector *psel, SPPaintSelect */ GtkListStore *store = gtk_list_store_new (COMBO_N_COLS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_BOOLEAN); GtkWidget *combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); - gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo), SPPaintSelector::isSeparator, NULL, NULL); + gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo), SPPaintSelector::isSeparator, nullptr, nullptr); GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); gtk_cell_renderer_set_padding (renderer, 2, 0); @@ -1027,7 +1027,7 @@ static void sp_paint_selector_set_mode_mesh(SPPaintSelector *psel, SPPaintSelect { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - auto l = gtk_label_new(NULL); + auto l = gtk_label_new(nullptr); gtk_label_set_markup(GTK_LABEL(l), _("Use the <b>Mesh tool</b> to modify the mesh.")); gtk_label_set_line_wrap(GTK_LABEL(l), true); gtk_widget_set_size_request(l, 180, -1); @@ -1055,8 +1055,8 @@ SPMeshGradient *SPPaintSelector::getMeshGradient() GtkWidget *combo = GTK_WIDGET(g_object_get_data(G_OBJECT(this), "meshmenu")); /* no mesh menu if we were just selected */ - if ( combo == NULL ) { - return NULL; + if ( combo == nullptr ) { + return nullptr; } GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo)); @@ -1064,19 +1064,19 @@ SPMeshGradient *SPPaintSelector::getMeshGradient() GtkTreeIter iter; if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX(combo), &iter) || !gtk_list_store_iter_is_valid(GTK_LIST_STORE(store), &iter)) { - return NULL; + return nullptr; } - gchar *meshid = NULL; + gchar *meshid = nullptr; gboolean stockid = FALSE; - gchar *label = NULL; + gchar *label = nullptr; gtk_tree_model_get (store, &iter, COMBO_COL_LABEL, &label, COMBO_COL_STOCK, &stockid, COMBO_COL_MESH, &meshid, -1); // std::cout << " .. meshid: " << (meshid?meshid:"null") << " label: " << (label?label:"null") << std::endl; - if (meshid == NULL) { - return NULL; + if (meshid == nullptr) { + return nullptr; } - SPMeshGradient *mesh = 0; + SPMeshGradient *mesh = nullptr; if (strcmp(meshid, "none")){ gchar *mesh_name; @@ -1137,7 +1137,7 @@ static std::vector<SPPattern*> ink_pattern_list_get (SPDocument *source) { std::vector<SPPattern *> pl; - if (source == NULL) + if (source == nullptr) return pl; std::vector<SPObject *> patterns = source->getResourceList("pattern"); @@ -1199,10 +1199,10 @@ static void sp_pattern_list_from_doc(GtkWidget *combo, SPDocument * /*current_do static void ink_pattern_menu_populate_menu(GtkWidget *combo, SPDocument *doc) { - static SPDocument *patterns_doc = NULL; + static SPDocument *patterns_doc = nullptr; // find and load patterns.svg - if (patterns_doc == NULL) { + if (patterns_doc == nullptr) { char *patterns_source = g_build_filename(INKSCAPE_PATTERNSDIR, "patterns.svg", NULL); if (Inkscape::IO::file_test(patterns_source, G_FILE_TEST_IS_REGULAR)) { patterns_doc = SPDocument::createNewDoc(patterns_source, FALSE); @@ -1211,7 +1211,7 @@ ink_pattern_menu_populate_menu(GtkWidget *combo, SPDocument *doc) } // suck in from current doc - sp_pattern_list_from_doc ( combo, NULL, doc, patterns_doc ); + sp_pattern_list_from_doc ( combo, nullptr, doc, patterns_doc ); // add separator { @@ -1225,7 +1225,7 @@ ink_pattern_menu_populate_menu(GtkWidget *combo, SPDocument *doc) // suck in from patterns.svg if (patterns_doc) { doc->ensureUpToDate(); - sp_pattern_list_from_doc ( combo, doc, patterns_doc, NULL ); + sp_pattern_list_from_doc ( combo, doc, patterns_doc, nullptr ); } } @@ -1274,7 +1274,7 @@ void SPPaintSelector::updatePatternList( SPPattern *pattern ) return; } GtkWidget *combo = GTK_WIDGET(g_object_get_data(G_OBJECT(this), "patternmenu")); - g_assert( combo != NULL ); + g_assert( combo != nullptr ); /* Clear existing menu if any */ GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo)); @@ -1291,7 +1291,7 @@ void SPPaintSelector::updatePatternList( SPPattern *pattern ) // Find this pattern and set it active in the combo_box GtkTreeIter iter ; - gchar *patid = NULL; + gchar *patid = nullptr; bool valid = gtk_tree_model_get_iter_first (store, &iter); if (!valid) { return; @@ -1318,7 +1318,7 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel gtk_widget_set_sensitive(psel->style, TRUE); - GtkWidget *tbl = NULL; + GtkWidget *tbl = nullptr; if (psel->mode == SPPaintSelector::MODE_PATTERN) { /* Already have pattern menu */ @@ -1341,7 +1341,7 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel */ GtkListStore *store = gtk_list_store_new (COMBO_N_COLS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_BOOLEAN); GtkWidget *combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); - gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo), SPPaintSelector::isSeparator, NULL, NULL); + gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo), SPPaintSelector::isSeparator, nullptr, nullptr); GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); gtk_cell_renderer_set_padding (renderer, 2, 0); @@ -1363,7 +1363,7 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - auto l = gtk_label_new(NULL); + auto l = gtk_label_new(nullptr); gtk_label_set_markup(GTK_LABEL(l), _("Use the <b>Node tool</b> to adjust position, scale, and rotation of the pattern on canvas. Use <b>Object > Pattern > Objects to Pattern</b> to create a new pattern from selection.")); gtk_label_set_line_wrap(GTK_LABEL(l), true); gtk_widget_set_size_request(l, 180, -1); @@ -1393,14 +1393,14 @@ gboolean SPPaintSelector::isSeparator (GtkTreeModel *model, GtkTreeIter *iter, g SPPattern *SPPaintSelector::getPattern() { - SPPattern *pat = 0; + SPPattern *pat = nullptr; g_return_val_if_fail((mode == MODE_PATTERN) , NULL); GtkWidget *combo = GTK_WIDGET(g_object_get_data(G_OBJECT(this), "patternmenu")); /* no pattern menu if we were just selected */ - if ( combo == NULL ) { - return NULL; + if ( combo == nullptr ) { + return nullptr; } GtkTreeModel *store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo)); @@ -1409,15 +1409,15 @@ SPPattern *SPPaintSelector::getPattern() GtkTreeIter iter; if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX(combo), &iter) || !gtk_list_store_iter_is_valid(GTK_LIST_STORE(store), &iter)) { - return NULL; + return nullptr; } - gchar *patid = NULL; + gchar *patid = nullptr; gboolean stockid = FALSE; - gchar *label = NULL; + gchar *label = nullptr; gtk_tree_model_get (store, &iter, COMBO_COL_LABEL, &label, COMBO_COL_STOCK, &stockid, COMBO_COL_PATTERN, &patid, -1); - if (patid == NULL) { - return NULL; + if (patid == nullptr) { + return nullptr; } if (strcmp(patid, "none")){ @@ -1439,7 +1439,7 @@ SPPattern *SPPaintSelector::getPattern() } if (pat && !SP_IS_PATTERN(pat)) { - pat = 0; + pat = nullptr; } return pat; diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp index d89e6296c..043eb93cc 100644 --- a/src/widgets/sp-attribute-widget.cpp +++ b/src/widgets/sp-attribute-widget.cpp @@ -65,9 +65,9 @@ static void sp_attribute_table_object_release (SPObject */*object*/, SPAttribute SPAttributeTable::SPAttributeTable () : - _object(NULL), + _object(nullptr), blocked(false), - table(NULL), + table(nullptr), _attributes(), _entries(), modified_connection(), @@ -76,9 +76,9 @@ SPAttributeTable::SPAttributeTable () : } SPAttributeTable::SPAttributeTable (SPObject *object, std::vector<Glib::ustring> &labels, std::vector<Glib::ustring> &attributes, GtkWidget* parent) : - _object(NULL), + _object(nullptr), blocked(false), - table(NULL), + table(nullptr), _attributes(), _entries(), modified_connection(), @@ -101,7 +101,7 @@ void SPAttributeTable::clear(void) { Gtk::Widget *w = ch[i]; ch.pop_back(); - if (w != NULL) + if (w != nullptr) { try { @@ -118,14 +118,14 @@ void SPAttributeTable::clear(void) _entries.clear(); delete table; - table = NULL; + table = nullptr; } if (_object) { modified_connection.disconnect(); release_connection.disconnect(); - _object = NULL; + _object = nullptr; } } @@ -151,7 +151,7 @@ void SPAttributeTable::set_object(SPObject *object, // Create table table = new Gtk::Grid(); - if (!(parent == NULL)) + if (!(parent == nullptr)) gtk_container_add(GTK_CONTAINER(parent), (GtkWidget*)table->gobj()); // Fill rows @@ -208,7 +208,7 @@ void SPAttributeTable::change_object(SPObject *object) { modified_connection.disconnect(); release_connection.disconnect(); - _object = NULL; + _object = nullptr; } _object = object; @@ -295,7 +295,7 @@ static void sp_attribute_table_object_release (SPObject */*object*/, SPAttribute { std::vector<Glib::ustring> labels; std::vector<Glib::ustring> attributes; - spat->set_object (NULL, labels, attributes, NULL); + spat->set_object (nullptr, labels, attributes, nullptr); } /* diff --git a/src/widgets/sp-color-selector.cpp b/src/widgets/sp-color-selector.cpp index 8a30b276b..6ee827fb8 100644 --- a/src/widgets/sp-color-selector.cpp +++ b/src/widgets/sp-color-selector.cpp @@ -36,7 +36,7 @@ G_DEFINE_TYPE(SPColorSelector, sp_color_selector, GTK_TYPE_BOX); void sp_color_selector_class_init( SPColorSelectorClass *klass ) { - static const gchar* nameset[] = {N_("Unnamed"), 0}; + static const gchar* nameset[] = {N_("Unnamed"), nullptr}; GObjectClass *object_class = G_OBJECT_CLASS(klass); GtkWidgetClass *widget_class; widget_class = GTK_WIDGET_CLASS(klass); @@ -45,28 +45,28 @@ void sp_color_selector_class_init( SPColorSelectorClass *klass ) G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPColorSelectorClass, grabbed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); csel_signals[DRAGGED] = g_signal_new( "dragged", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPColorSelectorClass, dragged), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); csel_signals[RELEASED] = g_signal_new( "released", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPColorSelectorClass, released), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); csel_signals[CHANGED] = g_signal_new( "changed", G_TYPE_FROM_CLASS(object_class), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), G_STRUCT_OFFSET(SPColorSelectorClass, changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); @@ -97,7 +97,7 @@ void sp_color_selector_dispose(GObject *object) if ( csel->base ) { delete csel->base; - csel->base = 0; + csel->base = nullptr; } if ((G_OBJECT_CLASS(sp_color_selector_parent_class))->dispose ) { @@ -119,7 +119,7 @@ GtkWidget *sp_color_selector_new( GType selector_type ) { g_return_val_if_fail( g_type_is_a( selector_type, SP_TYPE_COLOR_SELECTOR ), NULL ); - SPColorSelector *csel = SP_COLOR_SELECTOR( g_object_new( selector_type, NULL ) ); + SPColorSelector *csel = SP_COLOR_SELECTOR( g_object_new( selector_type, nullptr ) ); return GTK_WIDGET( csel ); } @@ -183,7 +183,7 @@ void ColorSelector::setColorAlpha( const SPColor& color, gfloat alpha, bool emit #ifdef DUMP_CHANGE_INFO g_message("ColorSelector::setColorAlpha( this=%p, %f, %f, %f, %s, %f, %s) in %s", this, color.v.c[0], color.v.c[1], color.v.c[2], (color.icc?color.icc->colorProfile.c_str():"<null>"), alpha, (emit?"YES":"no"), FOO_NAME(_csel)); #endif - g_return_if_fail( _csel != NULL ); + g_return_if_fail( _csel != nullptr ); g_return_if_fail( ( 0.0 <= alpha ) && ( alpha <= 1.0 ) ); #ifdef DUMP_CHANGE_INFO diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp index 707e62c12..fab39544b 100644 --- a/src/widgets/sp-widget.cpp +++ b/src/widgets/sp-widget.cpp @@ -81,7 +81,7 @@ sp_widget_class_init(SPWidgetClass *klass) G_TYPE_FROM_CLASS(object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(SPWidgetClass, construct), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -89,7 +89,7 @@ sp_widget_class_init(SPWidgetClass *klass) G_TYPE_FROM_CLASS(object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(SPWidgetClass, change_selection), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); @@ -98,7 +98,7 @@ sp_widget_class_init(SPWidgetClass *klass) G_TYPE_FROM_CLASS(object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(SPWidgetClass, modify_selection), - NULL, NULL, + nullptr, nullptr, sp_marshal_VOID__POINTER_UINT, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT); @@ -107,7 +107,7 @@ sp_widget_class_init(SPWidgetClass *klass) G_TYPE_FROM_CLASS(object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(SPWidgetClass, set_selection), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); @@ -148,7 +148,7 @@ void SPWidgetImpl::dispose(GObject *object) } delete spw->_impl; - spw->_impl = 0; + spw->_impl = nullptr; if (G_OBJECT_CLASS(sp_widget_parent_class)->dispose) { G_OBJECT_CLASS(sp_widget_parent_class)->dispose(object); @@ -300,11 +300,11 @@ void SPWidgetImpl::setSelection(Selection *selection) GtkWidget *sp_widget_new_global() { - SPWidget *spw = reinterpret_cast<SPWidget*>(g_object_new(SP_TYPE_WIDGET, NULL)); + SPWidget *spw = reinterpret_cast<SPWidget*>(g_object_new(SP_TYPE_WIDGET, nullptr)); if (!SPWidgetImpl::constructGlobal(spw)) { g_object_unref(spw); - spw = 0; + spw = nullptr; } return reinterpret_cast<GtkWidget *>(spw); diff --git a/src/widgets/sp-xmlview-attr-list.cpp b/src/widgets/sp-xmlview-attr-list.cpp index e99605b97..720856ba5 100644 --- a/src/widgets/sp-xmlview-attr-list.cpp +++ b/src/widgets/sp-xmlview-attr-list.cpp @@ -25,16 +25,16 @@ static void sp_xmlview_attr_list_destroy(GtkWidget * object); static void event_attr_changed (Inkscape::XML::Node * repr, const gchar * name, const gchar * old_value, const gchar * new_value, bool is_interactive, gpointer data); static Inkscape::XML::NodeEventVector repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ event_attr_changed, - NULL, /* content_changed */ - NULL /* order_changed */ + nullptr, /* content_changed */ + nullptr /* order_changed */ }; GtkWidget *sp_xmlview_attr_list_new (Inkscape::XML::Node * repr) { - SPXMLViewAttrList * attr_list = SP_XMLVIEW_ATTR_LIST(g_object_new(SP_TYPE_XMLVIEW_ATTR_LIST, NULL)); + SPXMLViewAttrList * attr_list = SP_XMLVIEW_ATTR_LIST(g_object_new(SP_TYPE_XMLVIEW_ATTR_LIST, nullptr)); attr_list->store = gtk_list_store_new (ATTR_N_COLS, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING ); gtk_tree_view_set_model (GTK_TREE_VIEW(attr_list), GTK_TREE_MODEL(attr_list->store)); @@ -90,7 +90,7 @@ void sp_xmlview_attr_list_class_init (SPXMLViewAttrListClass * klass) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SPXMLViewAttrListClass, row_changed), - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); @@ -99,8 +99,8 @@ void sp_xmlview_attr_list_class_init (SPXMLViewAttrListClass * klass) void sp_xmlview_attr_list_init (SPXMLViewAttrList * list) { - list->store = NULL; - list->repr = NULL; + list->store = nullptr; + list->repr = nullptr; } void sp_xmlview_attr_list_destroy(GtkWidget * object) @@ -110,7 +110,7 @@ void sp_xmlview_attr_list_destroy(GtkWidget * object) list = SP_XMLVIEW_ATTR_LIST (object); g_object_unref(list->store); - sp_xmlview_attr_list_set_repr (list, NULL); + sp_xmlview_attr_list_set_repr (list, nullptr); GTK_WIDGET_CLASS(sp_xmlview_attr_list_parent_class)->destroy (object); } @@ -121,7 +121,7 @@ void sp_xmlview_attr_list_select_row_by_key(SPXMLViewAttrList * list, const gcha gboolean match = false; gboolean valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL(list->store), &iter ); while ( valid ) { - gchar *n = 0; + gchar *n = nullptr; gtk_tree_model_get (GTK_TREE_MODEL(list->store), &iter, ATTR_COL_NAME, &n, -1); if (!strcmp(n, name)) { match = true; @@ -157,7 +157,7 @@ event_attr_changed (Inkscape::XML::Node * /*repr*/, gboolean valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL(list->store), &iter ); gboolean match = false; while ( valid ) { - gchar *n = 0; + gchar *n = nullptr; gtk_tree_model_get (GTK_TREE_MODEL(list->store), &iter, ATTR_COL_NAME, &n, -1); if (!strcmp(n, name)) { match = true; @@ -177,7 +177,7 @@ event_attr_changed (Inkscape::XML::Node * /*repr*/, } else { gtk_list_store_remove (list->store, &iter); } - } else if (new_value != NULL) { + } else if (new_value != nullptr) { gtk_list_store_append (list->store, &iter); gtk_list_store_set (list->store, &iter, ATTR_COL_NAME, name, ATTR_COL_VALUE, new_value, ATTR_COL_ATTR, g_quark_from_string (name), -1); } diff --git a/src/widgets/sp-xmlview-content.cpp b/src/widgets/sp-xmlview-content.cpp index 6e59ba3cd..6fc08c4ac 100644 --- a/src/widgets/sp-xmlview-content.cpp +++ b/src/widgets/sp-xmlview-content.cpp @@ -30,17 +30,17 @@ void sp_xmlview_content_changed (GtkTextBuffer *tb, SPXMLViewContent *text); static void event_content_changed (Inkscape::XML::Node * repr, const gchar * old_content, const gchar * new_content, gpointer data); static Inkscape::XML::NodeEventVector repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ - NULL, /* attr_changed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ + nullptr, /* attr_changed */ event_content_changed, - NULL /* order_changed */ + nullptr /* order_changed */ }; GtkWidget *sp_xmlview_content_new(Inkscape::XML::Node * repr) { - GtkTextBuffer *tb = gtk_text_buffer_new(NULL); - SPXMLViewContent *text = SP_XMLVIEW_CONTENT(g_object_new(SP_TYPE_XMLVIEW_CONTENT, NULL)); + GtkTextBuffer *tb = gtk_text_buffer_new(nullptr); + SPXMLViewContent *text = SP_XMLVIEW_CONTENT(g_object_new(SP_TYPE_XMLVIEW_CONTENT, nullptr)); gtk_text_view_set_buffer (GTK_TEXT_VIEW (text), tb); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text), GTK_WRAP_CHAR); @@ -83,7 +83,7 @@ void sp_xmlview_content_class_init(SPXMLViewContentClass * klass) void sp_xmlview_content_init (SPXMLViewContent *text) { - text->repr = NULL; + text->repr = nullptr; text->blocked = FALSE; } @@ -91,7 +91,7 @@ void sp_xmlview_content_destroy(GtkWidget * object) { SPXMLViewContent * text = SP_XMLVIEW_CONTENT (object); - sp_xmlview_content_set_repr (text, NULL); + sp_xmlview_content_set_repr (text, nullptr); GTK_WIDGET_CLASS (sp_xmlview_content_parent_class)->destroy (object); } @@ -111,7 +111,7 @@ event_content_changed (Inkscape::XML::Node * /*repr*/, const gchar * /*old_conte } else { gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)), "", 0); } - gtk_text_view_set_editable (GTK_TEXT_VIEW (text), new_content != NULL); + gtk_text_view_set_editable (GTK_TEXT_VIEW (text), new_content != nullptr); text->blocked = FALSE; } diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp index 3f8cc6063..6b8db59ab 100644 --- a/src/widgets/sp-xmlview-tree.cpp +++ b/src/widgets/sp-xmlview-tree.cpp @@ -54,48 +54,48 @@ static const Inkscape::XML::NodeEventVector element_repr_events = { element_child_added, element_child_removed, element_attr_changed, - NULL, /* content_changed */ + nullptr, /* content_changed */ element_order_changed }; static const Inkscape::XML::NodeEventVector text_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ - NULL, /* attr_changed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ + nullptr, /* attr_changed */ text_content_changed, - NULL /* order_changed */ + nullptr /* order_changed */ }; static const Inkscape::XML::NodeEventVector comment_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ - NULL, /* attr_changed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ + nullptr, /* attr_changed */ comment_content_changed, - NULL /* order_changed */ + nullptr /* order_changed */ }; static const Inkscape::XML::NodeEventVector pi_repr_events = { - NULL, /* child_added */ - NULL, /* child_removed */ - NULL, /* attr_changed */ + nullptr, /* child_added */ + nullptr, /* child_removed */ + nullptr, /* attr_changed */ pi_content_changed, - NULL /* order_changed */ + nullptr /* order_changed */ }; GtkWidget *sp_xmlview_tree_new(Inkscape::XML::Node * repr, void * /*factory*/, void * /*data*/) { - SPXMLViewTree *tree = SP_XMLVIEW_TREE(g_object_new (SP_TYPE_XMLVIEW_TREE, NULL)); + SPXMLViewTree *tree = SP_XMLVIEW_TREE(g_object_new (SP_TYPE_XMLVIEW_TREE, nullptr)); tree->store = gtk_tree_store_new (STORE_N_COLS, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER); // Detach the model from the view until all the data is loaded g_object_ref(tree->store); - gtk_tree_view_set_model(GTK_TREE_VIEW(tree), NULL); + gtk_tree_view_set_model(GTK_TREE_VIEW(tree), nullptr); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(tree), FALSE); gtk_tree_view_set_reorderable (GTK_TREE_VIEW(tree), TRUE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW(tree), TRUE); - gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(tree), search_equal_func, NULL, NULL); + gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(tree), search_equal_func, nullptr, nullptr); GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes ("", renderer, "text", STORE_TEXT_COL, NULL); @@ -124,7 +124,7 @@ void sp_xmlview_tree_class_init(SPXMLViewTreeClass * klass) G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, - NULL, NULL, + nullptr, nullptr, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); @@ -133,7 +133,7 @@ void sp_xmlview_tree_class_init(SPXMLViewTreeClass * klass) void sp_xmlview_tree_init (SPXMLViewTree * tree) { - tree->repr = NULL; + tree->repr = nullptr; tree->blocked = 0; tree->dndactive = FALSE; } @@ -142,7 +142,7 @@ void sp_xmlview_tree_destroy(GtkWidget * object) { SPXMLViewTree * tree = SP_XMLVIEW_TREE (object); - sp_xmlview_tree_set_repr (tree, NULL); + sp_xmlview_tree_set_repr (tree, nullptr); GTK_WIDGET_CLASS(sp_xmlview_tree_parent_class)->destroy (object); } @@ -153,27 +153,27 @@ void sp_xmlview_tree_destroy(GtkWidget * object) GtkTreeRowReference * add_node (SPXMLViewTree * tree, GtkTreeIter *parent, GtkTreeIter *before, Inkscape::XML::Node * repr) { - NodeData * data = NULL; + NodeData * data = nullptr; const Inkscape::XML::NodeEventVector * vec; static const gchar *default_text[] = { "???" }; - g_assert (tree != NULL); - g_assert (repr != NULL); + g_assert (tree != nullptr); + g_assert (repr != nullptr); if (before && !gtk_tree_store_iter_is_valid(tree->store, before)) { - before = NULL; + before = nullptr; } GtkTreeIter iter; gtk_tree_store_insert_before (tree->store, &iter, parent, before); if (!gtk_tree_store_iter_is_valid(tree->store, &iter)) { - return NULL; + return nullptr; } GtkTreeRowReference *rowref = tree_iter_to_ref (tree, &iter); data = node_data_new (tree, &iter, rowref, repr); - g_assert (data != NULL); + g_assert (data != nullptr); gtk_tree_store_set (tree->store, &iter, STORE_TEXT_COL, default_text, STORE_DATA_COL, data, STORE_REPR_COL, repr, -1); @@ -186,13 +186,13 @@ add_node (SPXMLViewTree * tree, GtkTreeIter *parent, GtkTreeIter *before, Inksca } else if ( repr->type() == Inkscape::XML::ELEMENT_NODE ) { vec = &element_repr_events; } else { - vec = NULL; + vec = nullptr; } if (vec) { /* cheat a little to get the id updated properly */ if (repr->type() == Inkscape::XML::ELEMENT_NODE) { - element_attr_changed (repr, "id", NULL, NULL, false, data); + element_attr_changed (repr, "id", nullptr, nullptr, false, data); } sp_repr_add_listener (repr, vec, data); sp_repr_synthesize_events (repr, vec, data); @@ -344,7 +344,7 @@ void on_drag_data_received(GtkWidget * /*wgt*/, GdkDragContext * /*context*/, in return; } - GtkTreeModel *model = 0; + GtkTreeModel *model = nullptr; GtkTreeIter iter; GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { @@ -352,7 +352,7 @@ void on_drag_data_received(GtkWidget * /*wgt*/, GdkDragContext * /*context*/, in tree->dndactive = TRUE; GtkTreeIter parent_iter; - GtkTreeRowReference *parent_ref = NULL; + GtkTreeRowReference *parent_ref = nullptr; if (gtk_tree_model_iter_parent(model, &parent_iter, &iter)) { parent_ref = tree_iter_to_ref (tree, &parent_iter); } @@ -398,7 +398,7 @@ void on_row_changed(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *it // Find the sibling node before iter GtkTreeIter before_iter; - Inkscape::XML::Node *before_repr = NULL; + Inkscape::XML::Node *before_repr = nullptr; GtkTreeIter tmp_iter; gboolean valid = gtk_tree_model_iter_children(tree_model, &tmp_iter, &new_parent); @@ -538,7 +538,7 @@ gboolean tree_model_iter_compare(GtkTreeModel* store, GtkTreeIter * iter1, GtkTr */ gboolean do_drag_motion(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer user_data) { - GtkTreePath *path = NULL; + GtkTreePath *path = nullptr; GtkTreeViewDropPosition pos; gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW(widget), x, y, &path, &pos); @@ -585,7 +585,7 @@ sp_xmlview_tree_set_repr (SPXMLViewTree * tree, Inkscape::XML::Node * repr) * Instead just unref the old and create a new store. */ //gtk_tree_store_clear(tree->store); - gtk_tree_view_set_model(GTK_TREE_VIEW(tree), NULL); + gtk_tree_view_set_model(GTK_TREE_VIEW(tree), nullptr); g_object_unref(tree->store); tree->store = gtk_tree_store_new (STORE_N_COLS, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER); gtk_tree_view_set_model (GTK_TREE_VIEW(tree), GTK_TREE_MODEL(tree->store)); @@ -596,7 +596,7 @@ sp_xmlview_tree_set_repr (SPXMLViewTree * tree, Inkscape::XML::Node * repr) if (repr) { GtkTreeRowReference * rowref; Inkscape::GC::anchor(repr); - rowref = add_node (tree, NULL, NULL, repr); + rowref = add_node (tree, nullptr, nullptr, repr); // Set the tree model here, after all data is inserted gtk_tree_view_set_model (GTK_TREE_VIEW(tree), GTK_TREE_MODEL(tree->store)); @@ -604,7 +604,7 @@ sp_xmlview_tree_set_repr (SPXMLViewTree * tree, Inkscape::XML::Node * repr) GtkTreePath *path = gtk_tree_row_reference_get_path(rowref); 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.5, 0.0); + gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(tree), path, nullptr, true, 0.5, 0.0); gtk_tree_path_free(path); } } @@ -635,10 +635,10 @@ sp_xmlview_tree_get_repr_node (SPXMLViewTree * tree, Inkscape::XML::Node * repr, NodeData anode; anode.tree = tree; anode.repr = repr; - anode.rowref = NULL; + anode.rowref = nullptr; gtk_tree_model_foreach(GTK_TREE_MODEL(tree->store), foreach_func, &anode); - if (anode.rowref != NULL) { + if (anode.rowref != nullptr) { tree_ref_to_iter(tree, iter, anode.rowref); return TRUE; } @@ -666,10 +666,10 @@ gboolean foreach_func(GtkTreeModel *model, GtkTreePath * /*path*/, GtkTreeIter * */ gboolean search_equal_func(GtkTreeModel *model, gint /*column*/, const gchar *key, GtkTreeIter *iter, gpointer /*search_data*/) { - gchar *text = 0; + gchar *text = nullptr; gtk_tree_model_get(model, iter, STORE_TEXT_COL, &text, -1); - gboolean match = (strstr(text, key) != NULL); + gboolean match = (strstr(text, key) != nullptr); g_free(text); diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index 992f1f6b7..0dc041f80 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -32,8 +32,8 @@ Gtk::Label * spw_label(Gtk::Grid *table, const gchar *label_text, int col, int row, Gtk::Widget* target) { Gtk::Label *label_widget = new Gtk::Label(); - g_assert(label_widget != NULL); - if (target != NULL) + g_assert(label_widget != nullptr); + if (target != nullptr) { label_widget->set_text_with_mnemonic(label_text); label_widget->set_mnemonic_widget(*target); @@ -69,7 +69,7 @@ Gtk::HBox * spw_hbox(Gtk::Grid * table, int width, int col, int row) { /* Create a new hbox with a 4-pixel spacing between children */ Gtk::HBox *hb = new Gtk::HBox(false, 4); - g_assert(hb != NULL); + g_assert(hb != nullptr); hb->show(); hb->set_hexpand(); hb->set_halign(Gtk::ALIGN_FILL); @@ -94,7 +94,7 @@ sp_set_font_size_recursive (GtkWidget *w, gpointer font) gtk_css_provider_load_from_data(css_provider, css_data.str().c_str(), - -1, NULL); + -1, nullptr); auto style_context = gtk_widget_get_style_context(w); gtk_style_context_add_provider(style_context, @@ -128,7 +128,7 @@ sp_set_font_size_smaller (GtkWidget *w) */ gpointer sp_search_by_data_recursive(GtkWidget *w, gpointer key) { - gpointer r = NULL; + gpointer r = nullptr; if (w && G_IS_OBJECT(w)) { r = g_object_get_data(G_OBJECT(w), (gchar *) key); @@ -143,7 +143,7 @@ gpointer sp_search_by_data_recursive(GtkWidget *w, gpointer key) } } - return NULL; + return nullptr; } /** @@ -151,7 +151,7 @@ gpointer sp_search_by_data_recursive(GtkWidget *w, gpointer key) */ GtkWidget *sp_search_by_value_recursive(GtkWidget *w, gchar *key, gchar *value) { - gchar *r = NULL; + gchar *r = nullptr; if (w && G_IS_OBJECT(w)) { r = (gchar *) g_object_get_data(G_OBJECT(w), key); @@ -166,7 +166,7 @@ GtkWidget *sp_search_by_value_recursive(GtkWidget *w, gchar *key, gchar *value) } } - return NULL; + return nullptr; } /* diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index 95a8ce078..191d215f3 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -53,7 +53,7 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) : set_model(marker_store); pack_start(image_renderer, false); set_cell_data_func(image_renderer, sigc::mem_fun(*this, &MarkerComboBox::prepareImageRenderer)); - gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, NULL, NULL); + gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, nullptr, nullptr); empty_image = new Gtk::Image(); empty_image->set_from_icon_name("no-marker", Gtk::ICON_SIZE_SMALL_TOOLBAR); @@ -138,7 +138,7 @@ MarkerComboBox::init_combo() if (updating) return; - const gchar *active = NULL; + const gchar *active = nullptr; if (get_active()) { active = get_active()->get_value(marker_columns.marker); } @@ -152,11 +152,11 @@ MarkerComboBox::init_combo() row[marker_columns.history] = false; row[marker_columns.separator] = false; set_sensitive(false); - set_current(NULL); + set_current(nullptr); return; } - static SPDocument *markers_doc = NULL; + static SPDocument *markers_doc = nullptr; // add separator Gtk::TreeModel::Row row_sep = *(marker_store->append()); @@ -171,7 +171,7 @@ MarkerComboBox::init_combo() sp_marker_list_from_doc(doc, true); // find and load markers.svg - if (markers_doc == NULL) { + if (markers_doc == nullptr) { char *markers_source = g_build_filename(INKSCAPE_MARKERSDIR, "markers.svg", NULL); if (Inkscape::IO::file_test(markers_source, G_FILE_TEST_IS_REGULAR)) { markers_doc = SPDocument::createNewDoc(markers_source, FALSE); @@ -199,13 +199,13 @@ void MarkerComboBox::set_current(SPObject *marker) { updating = true; - if (marker != NULL) { + if (marker != nullptr) { gchar *markname = g_strdup(marker->getRepr()->attribute("id")); set_selected(markname); g_free (markname); } else { - set_selected(NULL); + set_selected(nullptr); } updating = false; @@ -220,7 +220,7 @@ const gchar * MarkerComboBox::get_active_marker_uri() const gchar *markid = get_active()->get_value(marker_columns.marker); if (!markid) { - return NULL; + return nullptr; } gchar const *marker = ""; @@ -308,7 +308,7 @@ void MarkerComboBox::sp_marker_list_from_doc(SPDocument *source, gboolean histor std::vector<SPMarker *> MarkerComboBox::get_marker_list (SPDocument *source) { std::vector<SPMarker *> ml; - if (source == NULL) + if (source == nullptr) return ml; SPDefs *defs = source->getDefs(); @@ -446,8 +446,8 @@ MarkerComboBox::create_marker_image(unsigned psize, gchar const *mname, { // Retrieve the marker named 'mname' from the source SVG document SPObject const *marker = source->getObjectById(mname); - if (marker == NULL) { - return NULL; + if (marker == nullptr) { + return nullptr; } // Create a copy repr of the marker with id="sample" @@ -509,8 +509,8 @@ MarkerComboBox::create_marker_image(unsigned psize, gchar const *mname, sandbox->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); sandbox->ensureUpToDate(); - if (object == NULL || !SP_IS_ITEM(object)) { - return NULL; // sandbox broken? + if (object == nullptr || !SP_IS_ITEM(object)) { + return nullptr; // sandbox broken? } SPItem *item = SP_ITEM(object); @@ -518,7 +518,7 @@ MarkerComboBox::create_marker_image(unsigned psize, gchar const *mname, Geom::OptRect dbox = item->documentVisualBounds(); if (!dbox) { - return NULL; + return nullptr; } /* Update to renderable state */ diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index b127efcff..53b094206 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -74,7 +74,7 @@ SPObject* getMarkerObj(gchar const *n, SPDocument *doc) } if (*p == '\0' || p[1] == '\0') { - return NULL; + return nullptr; } p++; @@ -84,7 +84,7 @@ SPObject* getMarkerObj(gchar const *n, SPDocument *doc) } if (p[c] == '\0') { - return NULL; + return nullptr; } gchar* b = g_strdup(p); @@ -122,7 +122,7 @@ StrokeStyle::StrokeStyleButton::StrokeStyleButton(Gtk::RadioButtonGroup &grp, auto px = Gtk::manage(new Gtk::Image()); px->set_from_icon_name(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR); - g_assert(px != NULL); + g_assert(px != nullptr); px->show(); add(*px); } @@ -150,13 +150,13 @@ StrokeStyle::StrokeStyle() : capSquare(), dashSelector(), update(false), - desktop(0), + desktop(nullptr), selectChangedConn(), selectModifiedConn(), startMarkerConn(), midMarkerConn(), endMarkerConn(), - _old_unit(NULL) + _old_unit(nullptr) { Gtk::HBox *hb; Gtk::HBox *f = new Gtk::HBox(false, 0); @@ -210,7 +210,7 @@ StrokeStyle::StrokeStyle() : i++; /* Dash */ - spw_label(table, _("Dashes:"), 0, i, NULL); //no mnemonic for now + spw_label(table, _("Dashes:"), 0, i, nullptr); //no mnemonic for now //decide what to do: // implement a set_mnemonic_source function in the // SPDashSelector class, so that we do not have to @@ -230,7 +230,7 @@ StrokeStyle::StrokeStyle() : // TRANSLATORS: Path markers are an SVG feature that allows you to attach arbitrary shapes // (arrowheads, bullets, faces, whatever) to the start, end, or middle nodes of a path. - spw_label(table, _("Markers:"), 0, i, NULL); + spw_label(table, _("Markers:"), 0, i, nullptr); hb = spw_hbox(table, 1, 1, i); i++; @@ -267,7 +267,7 @@ StrokeStyle::StrokeStyle() : /* Join type */ // TRANSLATORS: The line join style specifies the shape to be used at the // corners of paths. It can be "miter", "round" or "bevel". - spw_label(table, _("Join:"), 0, i, NULL); + spw_label(table, _("Join:"), 0, i, nullptr); hb = spw_hbox(table, 3, 1, i); @@ -318,7 +318,7 @@ StrokeStyle::StrokeStyle() : /* Cap type */ // TRANSLATORS: cap type specifies the shape for the ends of lines //spw_label(t, _("_Cap:"), 0, i); - spw_label(table, _("Cap:"), 0, i, NULL); + spw_label(table, _("Cap:"), 0, i, nullptr); hb = spw_hbox(table, 3, 1, i); @@ -349,7 +349,7 @@ StrokeStyle::StrokeStyle() : /* Paint order */ // TRANSLATORS: Paint order determines the order the 'fill', 'stroke', and 'markers are painted. - spw_label(table, _("Order:"), 0, i, NULL); + spw_label(table, _("Order:"), 0, i, nullptr); hb = spw_hbox(table, 4, 1, i); @@ -433,8 +433,8 @@ StrokeStyle::makeRadioButton(Gtk::RadioButtonGroup &grp, StrokeStyleButtonType button_type, gchar const *stroke_style) { - g_assert(icon != NULL); - g_assert(hb != NULL); + g_assert(icon != nullptr); + g_assert(hb != nullptr); StrokeStyleButton *tb = new StrokeStyleButton(grp, icon, button_type, stroke_style); @@ -505,7 +505,7 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, } sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; spw->update = false; }; @@ -579,7 +579,7 @@ SPObject * StrokeStyle::forkMarker(SPObject *marker, int loc, SPItem *item) { if (!item || !marker) { - return NULL; + return nullptr; } gchar const *marker_id = SPMarkerNames[loc].key; @@ -609,7 +609,7 @@ StrokeStyle::forkMarker(SPObject *marker, int loc, SPItem *item) sp_repr_css_change_recursive(item->getRepr(), css_item, "style"); sp_repr_css_attr_unref(css_item); - css_item = 0; + css_item = nullptr; return marker; } @@ -692,7 +692,7 @@ StrokeStyle::setMarkerColor(SPObject *marker, int loc, SPItem *item) endMarkerCombo->update_marker_image(mid); sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; } @@ -751,7 +751,7 @@ StrokeStyle::setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style) style->stroke_dashoffset.value / style->stroke_width.computed : style->stroke_dashoffset.value); } else { - dsel->set_dash(0, NULL, 0.0); + dsel->set_dash(0, nullptr, 0.0); } } @@ -761,7 +761,7 @@ StrokeStyle::setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style) void StrokeStyle::setJoinType (unsigned const jointype) { - Gtk::RadioButton *tb = NULL; + Gtk::RadioButton *tb = nullptr; switch (jointype) { case SP_STROKE_LINEJOIN_MITER: tb = joinMiter; @@ -787,7 +787,7 @@ StrokeStyle::setJoinType (unsigned const jointype) void StrokeStyle::setCapType (unsigned const captype) { - Gtk::RadioButton *tb = NULL; + Gtk::RadioButton *tb = nullptr; switch (captype) { case SP_STROKE_LINECAP_BUTT: tb = capButt; @@ -857,7 +857,7 @@ StrokeStyle::updateLine() update = true; - Inkscape::Selection *sel = desktop ? desktop->getSelection() : NULL; + Inkscape::Selection *sel = desktop ? desktop->getSelection() : nullptr; FillOrStroke kind = GPOINTER_TO_INT(get_data("kind")) ? FILL : STROKE; @@ -926,19 +926,19 @@ StrokeStyle::updateLine() if (! is_query_style_updateable(result_join)) { setJoinType(query.stroke_linejoin.value); } else { - setJoinButtons(NULL); + setJoinButtons(nullptr); } if (! is_query_style_updateable(result_cap)) { setCapType (query.stroke_linecap.value); } else { - setCapButtons(NULL); + setCapButtons(nullptr); } if (! is_query_style_updateable(result_order)) { setPaintOrder (query.paint_order.value); } else { - setPaintOrder (NULL); + setPaintOrder (nullptr); } if (!sel || sel->isEmpty()) @@ -982,7 +982,7 @@ StrokeStyle::setScaledDash(SPCSSAttr *css, sp_repr_css_set_property(css, "stroke-dashoffset", osoffset.str().c_str()); } else { sp_repr_css_set_property(css, "stroke-dasharray", "none"); - sp_repr_css_set_property(css, "stroke-dashoffset", NULL); + sp_repr_css_set_property(css, "stroke-dashoffset", nullptr); } } @@ -1061,7 +1061,7 @@ StrokeStyle::scaleLine() sp_desktop_set_style (desktop, css, false); sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, _("Set stroke style")); @@ -1151,7 +1151,7 @@ void StrokeStyle::buttonToggledCB(StrokeStyleButton *tb, StrokeStyle *spw) } sp_repr_css_attr_unref(css); - css = 0; + css = nullptr; DocumentUndo::done(spw->desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Set stroke style")); } @@ -1240,7 +1240,7 @@ StrokeStyle::updateAllMarkers(std::vector<SPItem*> const &objects, bool skip_und combo->setDesktop(desktop); - if (object->style->marker_ptrs[keyloc[i].loc]->value != NULL && !all_texts) { + if (object->style->marker_ptrs[keyloc[i].loc]->value != nullptr && !all_texts) { // If the object has this type of markers, // Extract the name of the marker that the object uses @@ -1263,7 +1263,7 @@ StrokeStyle::updateAllMarkers(std::vector<SPItem*> const &objects, bool skip_und } } else { - combo->set_current(NULL); + combo->set_current(nullptr); } } diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h index 274cc2b47..049782517 100644 --- a/src/widgets/stroke-style.h +++ b/src/widgets/stroke-style.h @@ -84,7 +84,7 @@ struct { gchar const *key; gint value; } const SPMarkerNames[] = { {"marker-mid", SP_MARKER_LOC_MID}, {"marker-end", SP_MARKER_LOC_END}, {"", SP_MARKER_LOC_QTY}, - {NULL, -1} + {nullptr, -1} }; /** diff --git a/src/widgets/swatch-selector.cpp b/src/widgets/swatch-selector.cpp index 3bfa83cd9..286dcc610 100644 --- a/src/widgets/swatch-selector.cpp +++ b/src/widgets/swatch-selector.cpp @@ -25,7 +25,7 @@ namespace Widgets SwatchSelector::SwatchSelector() : Gtk::VBox(), - _gsel(0), + _gsel(nullptr), _updating_color(false) { using Inkscape::UI::Widget::ColorNotebook; @@ -52,7 +52,7 @@ SwatchSelector::SwatchSelector() : SwatchSelector::~SwatchSelector() { - _gsel = 0; + _gsel = nullptr; } SPGradientSelector *SwatchSelector::getGradientSelector() @@ -124,7 +124,7 @@ void SwatchSelector::connectchangedHandler( GCallback handler, void *data ) void SwatchSelector::setVector(SPDocument */*doc*/, SPGradient *vector) { //GtkVBox * box = gobj(); - _gsel->setVector((vector) ? vector->document : 0, vector); + _gsel->setVector((vector) ? vector->document : nullptr, vector); if ( vector && vector->isSolid() ) { SPStop* stop = vector->getFirstStop(); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index c340e5291..7b3df3337 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -171,7 +171,7 @@ static struct { { "/tools/gradient", "gradient_tool", SP_VERB_CONTEXT_GRADIENT, SP_VERB_CONTEXT_GRADIENT_PREFS }, { "/tools/mesh", "mesh_tool", SP_VERB_CONTEXT_MESH, SP_VERB_CONTEXT_MESH_PREFS }, { "/tools/dropper", "dropper_tool", SP_VERB_CONTEXT_DROPPER, SP_VERB_CONTEXT_DROPPER_PREFS }, - { NULL, NULL, 0, 0 } + { nullptr, nullptr, 0, 0 } }; static struct { @@ -184,56 +184,56 @@ static struct { gchar const *swatch_tool; gchar const *swatch_tip; } const aux_toolboxes[] = { - { "/tools/select", "select_toolbox", 0, sp_select_toolbox_prep, "SelectToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/nodes", "node_toolbox", 0, sp_node_toolbox_prep, "NodeToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/tweak", "tweak_toolbox", 0, sp_tweak_toolbox_prep, "TweakToolbar", + { "/tools/select", "select_toolbox", nullptr, sp_select_toolbox_prep, "SelectToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/nodes", "node_toolbox", nullptr, sp_node_toolbox_prep, "NodeToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/tweak", "tweak_toolbox", nullptr, sp_tweak_toolbox_prep, "TweakToolbar", SP_VERB_CONTEXT_TWEAK_PREFS, "/tools/tweak", N_("Color/opacity used for color tweaking")}, - { "/tools/spray", "spray_toolbox", 0, sp_spray_toolbox_prep, "SprayToolbar", - SP_VERB_INVALID, 0, 0}, + { "/tools/spray", "spray_toolbox", nullptr, sp_spray_toolbox_prep, "SprayToolbar", + SP_VERB_INVALID, nullptr, nullptr}, { "/tools/zoom", "zoom_toolbox", Inkscape::UI::Toolbar::ZoomToolbar::create, nullptr, "ZoomToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/measure", "measure_toolbox", 0, sp_measure_toolbox_prep, "MeasureToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/shapes/star", "star_toolbox", 0, sp_star_toolbox_prep, "StarToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/measure", "measure_toolbox", nullptr, sp_measure_toolbox_prep, "MeasureToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/shapes/star", "star_toolbox", nullptr, sp_star_toolbox_prep, "StarToolbar", SP_VERB_CONTEXT_STAR_PREFS, "/tools/shapes/star", N_("Style of new stars")}, - { "/tools/shapes/rect", "rect_toolbox", 0, sp_rect_toolbox_prep, "RectToolbar", + { "/tools/shapes/rect", "rect_toolbox", nullptr, sp_rect_toolbox_prep, "RectToolbar", SP_VERB_CONTEXT_RECT_PREFS, "/tools/shapes/rect", N_("Style of new rectangles")}, - { "/tools/shapes/3dbox", "3dbox_toolbox", 0, box3d_toolbox_prep, "3DBoxToolbar", + { "/tools/shapes/3dbox", "3dbox_toolbox", nullptr, box3d_toolbox_prep, "3DBoxToolbar", SP_VERB_CONTEXT_3DBOX_PREFS, "/tools/shapes/3dbox", N_("Style of new 3D boxes")}, - { "/tools/shapes/arc", "arc_toolbox", 0, sp_arc_toolbox_prep, "ArcToolbar", + { "/tools/shapes/arc", "arc_toolbox", nullptr, sp_arc_toolbox_prep, "ArcToolbar", SP_VERB_CONTEXT_ARC_PREFS, "/tools/shapes/arc", N_("Style of new ellipses")}, - { "/tools/shapes/spiral", "spiral_toolbox", 0, sp_spiral_toolbox_prep, "SpiralToolbar", + { "/tools/shapes/spiral", "spiral_toolbox", nullptr, sp_spiral_toolbox_prep, "SpiralToolbar", SP_VERB_CONTEXT_SPIRAL_PREFS, "/tools/shapes/spiral", N_("Style of new spirals")}, - { "/tools/freehand/pencil", "pencil_toolbox", 0, sp_pencil_toolbox_prep, "PencilToolbar", + { "/tools/freehand/pencil", "pencil_toolbox", nullptr, sp_pencil_toolbox_prep, "PencilToolbar", SP_VERB_CONTEXT_PENCIL_PREFS, "/tools/freehand/pencil", N_("Style of new paths created by Pencil")}, - { "/tools/freehand/pen", "pen_toolbox", 0, sp_pen_toolbox_prep, "PenToolbar", + { "/tools/freehand/pen", "pen_toolbox", nullptr, sp_pen_toolbox_prep, "PenToolbar", SP_VERB_CONTEXT_PEN_PREFS, "/tools/freehand/pen", N_("Style of new paths created by Pen")}, - { "/tools/calligraphic", "calligraphy_toolbox", 0, sp_calligraphy_toolbox_prep,"CalligraphyToolbar", + { "/tools/calligraphic", "calligraphy_toolbox", nullptr, sp_calligraphy_toolbox_prep,"CalligraphyToolbar", SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "/tools/calligraphic", N_("Style of new calligraphic strokes")}, - { "/tools/eraser", "eraser_toolbox", 0, sp_eraser_toolbox_prep,"EraserToolbar", + { "/tools/eraser", "eraser_toolbox", nullptr, sp_eraser_toolbox_prep,"EraserToolbar", SP_VERB_CONTEXT_ERASER_PREFS, "/tools/eraser", _("TBD")}, - { "/tools/lpetool", "lpetool_toolbox", 0, sp_lpetool_toolbox_prep, "LPEToolToolbar", + { "/tools/lpetool", "lpetool_toolbox", nullptr, sp_lpetool_toolbox_prep, "LPEToolToolbar", SP_VERB_CONTEXT_LPETOOL_PREFS, "/tools/lpetool", _("TBD")}, // If you change TextToolbar here, change it also in desktop-widget.cpp - { "/tools/text", "text_toolbox", 0, sp_text_toolbox_prep, "TextToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/dropper", "dropper_toolbox", 0, sp_dropper_toolbox_prep, "DropperToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/connector", "connector_toolbox", 0, sp_connector_toolbox_prep, "ConnectorToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/gradient", "gradient_toolbox", 0, sp_gradient_toolbox_prep, "GradientToolbar", - SP_VERB_INVALID, 0, 0}, - { "/tools/mesh", "mesh_toolbox", 0, sp_mesh_toolbox_prep, "MeshToolbar", - SP_VERB_INVALID, 0, 0}, + { "/tools/text", "text_toolbox", nullptr, sp_text_toolbox_prep, "TextToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/dropper", "dropper_toolbox", nullptr, sp_dropper_toolbox_prep, "DropperToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/connector", "connector_toolbox", nullptr, sp_connector_toolbox_prep, "ConnectorToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/gradient", "gradient_toolbox", nullptr, sp_gradient_toolbox_prep, "GradientToolbar", + SP_VERB_INVALID, nullptr, nullptr}, + { "/tools/mesh", "mesh_toolbox", nullptr, sp_mesh_toolbox_prep, "MeshToolbar", + SP_VERB_INVALID, nullptr, nullptr}, #if HAVE_POTRACE - { "/tools/paintbucket", "paintbucket_toolbox", 0, sp_paintbucket_toolbox_prep, "PaintbucketToolbar", + { "/tools/paintbucket", "paintbucket_toolbox", nullptr, sp_paintbucket_toolbox_prep, "PaintbucketToolbar", SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "/tools/paintbucket", N_("Style of Paint Bucket fill objects")}, #else { "/tools/paintbucket", "paintbucket_toolbox", 0, NULL, "PaintbucketToolbar", SP_VERB_NONE, "/tools/paintbucket", N_("Disabled")}, #endif - { NULL, NULL, NULL, NULL, NULL, SP_VERB_INVALID, NULL, NULL } + { nullptr, nullptr, nullptr, nullptr, nullptr, SP_VERB_INVALID, nullptr, nullptr } }; @@ -293,7 +293,7 @@ Glib::RefPtr<VerbAction> VerbAction::create(Inkscape::Verb* verb, Inkscape::Verb } VerbAction::VerbAction(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view) : - Gtk::Action(Glib::ustring(verb->get_id()), verb->get_image(), Glib::ustring(g_dpgettext2(NULL, "ContextVerb", verb->get_name())), Glib::ustring(_(verb->get_tip()))), + Gtk::Action(Glib::ustring(verb->get_id()), verb->get_image(), Glib::ustring(g_dpgettext2(nullptr, "ContextVerb", verb->get_name())), Glib::ustring(_(verb->get_tip()))), verb(verb), verb2(verb2), view(view), @@ -316,7 +316,7 @@ Gtk::Widget* VerbAction::create_tool_item_vfunc() { // Gtk::Widget* widg = Gtk::Action::create_tool_item_vfunc(); GtkIconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/tools/small"); - GtkWidget* toolbox = 0; + GtkWidget* toolbox = nullptr; GtkToolItem *button_toolitem = sp_toolbox_button_item_new_from_verb_with_doubleclick( toolbox, toolboxSize, SP_BUTTON_TYPE_TOGGLE, verb, @@ -369,7 +369,7 @@ void VerbAction::on_activate() if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); if ( action ) { - sp_action_perform(action, 0); + sp_action_perform(action, nullptr); } } } @@ -391,8 +391,8 @@ void purge_repr_listener( GObject* /*obj*/, GObject* tbl ) if (oldrepr) { // remove old listener sp_repr_remove_listener_by_data(oldrepr, tbl); Inkscape::GC::release(oldrepr); - oldrepr = 0; - g_object_set_data( tbl, "repr", NULL ); + oldrepr = nullptr; + g_object_set_data( tbl, "repr", nullptr ); } } @@ -459,14 +459,14 @@ GtkToolItem * sp_toolbox_button_item_new_from_verb_with_doubleclick(GtkWidget *t { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); if (!action) { - return NULL; + return nullptr; } SPAction *doubleclick_action; if (doubleclick_verb) { doubleclick_action = doubleclick_verb->get_action(Inkscape::ActionContext(view)); } else { - doubleclick_action = NULL; + doubleclick_action = nullptr; } /* fixme: Handle sensitive/unsensitive */ @@ -501,13 +501,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 ); @@ -587,7 +587,7 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto GtkIconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small"); Glib::RefPtr<Gtk::ActionGroup> mainActions; - if (desktop == NULL) + if (desktop == nullptr) { return mainActions; } @@ -636,7 +636,7 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto static GtkWidget* toolboxNewCommon( GtkWidget* tb, BarId id, GtkPositionType /*handlePos*/ ) { - g_object_set_data(G_OBJECT(tb), "desktop", NULL); + g_object_set_data(G_OBJECT(tb), "desktop", nullptr); gtk_widget_set_sensitive(tb, FALSE); @@ -729,7 +729,7 @@ EgeAdjustmentAction * create_adjustment_action( gchar const *name, g_signal_connect( G_OBJECT(adj), "value-changed", G_CALLBACK(callback), dataKludge ); - EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, 0, climb, digits, unit_tracker ); + EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, nullptr, climb, digits, unit_tracker ); if ( shortLabel ) { g_object_set( act, "short_label", shortLabel, NULL ); } @@ -770,8 +770,8 @@ void ToolboxFactory::setToolboxDesktop(GtkWidget *toolbox, SPDesktop *desktop) BarId id = static_cast<BarId>( GPOINTER_TO_INT(g_object_get_data(G_OBJECT(toolbox), BAR_ID_KEY)) ); - SetupFunction setup_func = 0; - UpdateFunction update_func = 0; + SetupFunction setup_func = nullptr; + UpdateFunction update_func = nullptr; switch (id) { case BAR_TOOL: @@ -832,7 +832,7 @@ static void setupToolboxCommon( GtkWidget *toolbox, Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GtkUIManager* mgr = gtk_ui_manager_new(); - GError* err = 0; + GError* err = nullptr; GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL; @@ -859,7 +859,7 @@ static void setupToolboxCommon( GtkWidget *toolbox, gtk_orientable_set_orientation (GTK_ORIENTABLE(toolBar), orientation); gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolBar), TRUE); - g_object_set_data(G_OBJECT(toolBar), "desktop", NULL); + g_object_set_data(G_OBJECT(toolBar), "desktop", nullptr); GtkWidget* child = gtk_bin_get_child(GTK_BIN(toolbox)); if ( child ) { @@ -956,7 +956,7 @@ void update_tool_toolbox( SPDesktop *desktop, ToolBase *eventcontext, GtkWidget { gchar const *const tname = ( eventcontext ? eventcontext->getPrefsPath().c_str() //g_type_name(G_OBJECT_TYPE(eventcontext)) - : NULL ); + : nullptr ); Glib::RefPtr<Gtk::ActionGroup> mainActions = create_or_fetch_actions( desktop ); for (int i = 0 ; tools[i].type_name ; i++ ) { @@ -977,7 +977,7 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) GtkSizeGroup* grouper = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); Glib::RefPtr<Gtk::ActionGroup> mainActions = create_or_fetch_actions( desktop ); GtkUIManager* mgr = gtk_ui_manager_new(); - GError *err = 0; + GError *err = nullptr; gtk_ui_manager_insert_action_group( mgr, mainActions->gobj(), 0 ); Glib::ustring filename = get_filename(UIS, "select-toolbar.ui"); @@ -1002,8 +1002,8 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) aux_toolboxes[i].prep_func( desktop, mainActions->gobj(), G_OBJECT(kludge) ); } else { - GtkWidget *sub_toolbox = 0; - if (aux_toolboxes[i].create_func == NULL) { + GtkWidget *sub_toolbox = nullptr; + if (aux_toolboxes[i].create_func == nullptr) { sub_toolbox = sp_empty_toolbox_new(desktop); } else { sub_toolbox = aux_toolboxes[i].create_func(desktop); @@ -1029,7 +1029,7 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) gchar* tmp = g_strdup_printf( "/ui/%s", aux_toolboxes[i].ui_name ); GtkWidget* toolBar = gtk_ui_manager_get_widget( mgr, tmp ); g_free( tmp ); - tmp = 0; + tmp = nullptr; if ( prefs->getBool( "/toolbox/icononly", true) ) { gtk_toolbar_set_style( GTK_TOOLBAR(toolBar), GTK_TOOLBAR_ICONS ); @@ -1041,7 +1041,7 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) gtk_grid_attach( GTK_GRID(holder), toolBar, 0, 0, 1, 1); if ( aux_toolboxes[i].swatch_verb_id != SP_VERB_INVALID ) { - Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch( NULL, _(aux_toolboxes[i].swatch_tip) ); + Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch( nullptr, _(aux_toolboxes[i].swatch_tip) ); swatch->setDesktop( desktop ); swatch->setClickVerb( aux_toolboxes[i].swatch_verb_id ); swatch->setWatchedTool( aux_toolboxes[i].swatch_tool, true ); @@ -1081,7 +1081,7 @@ void update_aux_toolbox(SPDesktop * /*desktop*/, ToolBase *eventcontext, GtkWidg { gchar const *tname = ( eventcontext ? eventcontext->getPrefsPath().c_str() //g_type_name(G_OBJECT_TYPE(eventcontext)) - : NULL ); + : nullptr ); for (int i = 0 ; aux_toolboxes[i].type_name ; i++ ) { GtkWidget *sub_toolbox = GTK_WIDGET(g_object_get_data(G_OBJECT(toolbox), aux_toolboxes[i].data_name)); if (tname && !strcmp(tname, aux_toolboxes[i].type_name)) { @@ -1112,11 +1112,11 @@ static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data poi } gpointer ptr = g_object_get_data(G_OBJECT(data), "desktop"); - g_assert(ptr != NULL); + g_assert(ptr != nullptr); SPDesktop *dt = reinterpret_cast<SPDesktop*>(ptr); SPNamedView *nv = dt->getNamedView(); - if (nv == NULL) { + if (nv == nullptr) { g_warning("No namedview specified (in toggle_snap_callback)!"); return; } @@ -1124,7 +1124,7 @@ static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data poi SPDocument *doc = nv->document; Inkscape::XML::Node *repr = nv->getRepr(); - if (repr == NULL) { + if (repr == nullptr) { g_warning("This namedview doesn't have a xml representation attached!"); return; } @@ -1442,11 +1442,11 @@ Glib::ustring ToolboxFactory::getToolboxName(GtkWidget* toolbox) void ToolboxFactory::updateSnapToolbox(SPDesktop *desktop, ToolBase * /*eventcontext*/, GtkWidget *toolbox) { - g_assert(desktop != NULL); - g_assert(toolbox != NULL); + g_assert(desktop != nullptr); + g_assert(toolbox != nullptr); SPNamedView *nv = desktop->getNamedView(); - if (nv == NULL) { + if (nv == nullptr) { g_warning("Namedview cannot be retrieved (in updateSnapToolbox)!"); return; } diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h index a1dc0770b..47a5639de 100644 --- a/src/widgets/toolbox.h +++ b/src/widgets/toolbox.h @@ -82,7 +82,7 @@ public: * @param callback function to invoke when changes are pushed. * @param cbData data to be passed on to the callback function. */ - PrefPusher( GtkToggleAction *act, Glib::ustring const &path, void (*callback)(GObject*) = 0, GObject *cbData = 0 ); + PrefPusher( GtkToggleAction *act, Glib::ustring const &path, void (*callback)(GObject*) = nullptr, GObject *cbData = nullptr ); /** * Destructor that unregisters the preference callback. @@ -135,7 +135,7 @@ void delete_connection(GObject * /*obj*/, sigc::connection *connection); gdouble lower, gdouble upper, gdouble step, gdouble page, gchar const** descrLabels, gdouble const* descrValues, guint descrCount, void (*callback)(GtkAdjustment *, GObject *), - Inkscape::UI::Widget::UnitTracker *unit_tracker = NULL, + Inkscape::UI::Widget::UnitTracker *unit_tracker = nullptr, gdouble climb = 0.1, guint digits = 3, double factor = 1.0 ); #endif /* !SEEN_TOOLBOX_H */ diff --git a/src/xml/croco-node-iface.cpp b/src/xml/croco-node-iface.cpp index 6bd5a6920..f9bb66532 100644 --- a/src/xml/croco-node-iface.cpp +++ b/src/xml/croco-node-iface.cpp @@ -31,7 +31,7 @@ static CRXMLNodePtr get_prev(CRXMLNodePtr cn) if (n_pos) { return n->parent()->nthChild(n_pos - 1); } else { - return NULL; + return nullptr; } } diff --git a/src/xml/event.cpp b/src/xml/event.cpp index d0ba10e08..ecb6d0130 100644 --- a/src/xml/event.cpp +++ b/src/xml/event.cpp @@ -38,7 +38,7 @@ sp_repr_begin_transaction (Inkscape::XML::Document *doc) EventTracker<SimpleEvent<Event::XML> > tracker("begin-transaction"); - g_assert(doc != NULL); + g_assert(doc != nullptr); doc->beginTransaction(); } @@ -51,7 +51,7 @@ sp_repr_rollback (Inkscape::XML::Document *doc) EventTracker<SimpleEvent<Event::XML> > tracker("rollback"); - g_assert(doc != NULL); + g_assert(doc != nullptr); doc->rollback(); } @@ -64,7 +64,7 @@ sp_repr_commit (Inkscape::XML::Document *doc) EventTracker<SimpleEvent<Event::XML> > tracker("commit"); - g_assert(doc != NULL); + g_assert(doc != nullptr); doc->commit(); } @@ -77,7 +77,7 @@ sp_repr_commit_undoable (Inkscape::XML::Document *doc) EventTracker<SimpleEvent<Event::XML> > tracker("commit"); - g_assert(doc != NULL); + g_assert(doc != nullptr); return doc->commitUndoable(); } @@ -184,7 +184,7 @@ void Inkscape::XML::replay_log_to_observer( Inkscape::XML::NodeObserver &observer ) { List<Inkscape::XML::Event const &> reversed = - reverse_list<Inkscape::XML::Event::ConstIterator>(log, NULL); + reverse_list<Inkscape::XML::Event::ConstIterator>(log, nullptr); for ( ; reversed ; ++reversed ) { reversed->replayOne(observer); } @@ -410,7 +410,7 @@ public: static Glib::ustring node_to_string(Node const &node) { Glib::ustring result; - char const *type_name=NULL; + char const *type_name=nullptr; switch (node.type()) { case Inkscape::XML::DOCUMENT_NODE: type_name = "Document"; diff --git a/src/xml/helper-observer.cpp b/src/xml/helper-observer.cpp index 022cad965..048d878a2 100644 --- a/src/xml/helper-observer.cpp +++ b/src/xml/helper-observer.cpp @@ -8,12 +8,12 @@ namespace XML { // Very simple observer that just emits a signal if anything happens to a node SignalObserver::SignalObserver() - : _oldsel(NULL) + : _oldsel(nullptr) {} SignalObserver::~SignalObserver() { - set(NULL); // if _oldsel!=nullptr, remove observer and decrease refcount + set(nullptr); // if _oldsel!=nullptr, remove observer and decrease refcount } // Add this observer to the SPObject and remove it from any previous object @@ -27,7 +27,7 @@ void SignalObserver::set(SPObject* o) _oldsel->getRepr()->removeObserver(*this); } sp_object_unref(_oldsel); - _oldsel = NULL; + _oldsel = nullptr; } if(o) { if (o->getRepr()) { diff --git a/src/xml/log-builder.cpp b/src/xml/log-builder.cpp index 12577cf69..0b17e41c4 100644 --- a/src/xml/log-builder.cpp +++ b/src/xml/log-builder.cpp @@ -22,12 +22,12 @@ namespace XML { void LogBuilder::discard() { sp_repr_free_log(_log); - _log = NULL; + _log = nullptr; } Event *LogBuilder::detach() { Event *log=_log; - _log = NULL; + _log = nullptr; return log; } diff --git a/src/xml/log-builder.h b/src/xml/log-builder.h index 8b0f6662d..d6505ddcb 100644 --- a/src/xml/log-builder.h +++ b/src/xml/log-builder.h @@ -32,7 +32,7 @@ class Node; */ class LogBuilder { public: - LogBuilder() : _log(NULL) {} + LogBuilder() : _log(nullptr) {} ~LogBuilder() { discard(); } /** @name Manipulate the recorded event log diff --git a/src/xml/node-fns.cpp b/src/xml/node-fns.cpp index e1506e3f2..18b12075d 100644 --- a/src/xml/node-fns.cpp +++ b/src/xml/node-fns.cpp @@ -42,7 +42,7 @@ bool id_permitted_internal_memoized(GQuark qname) { } bool id_permitted(Node const *node) { - g_return_val_if_fail(node != NULL, false); + g_return_val_if_fail(node != nullptr, false); if ( node->type() != ELEMENT_NODE ) { return false; @@ -62,14 +62,14 @@ Node *previous_node(Node *node) { using Inkscape::Algorithms::find_if_before; if ( !node || !node->parent() ) { - return NULL; + return nullptr; } Node *previous=find_if_before<NodeSiblingIterator>( - node->parent()->firstChild(), NULL, node_matches(*node) + node->parent()->firstChild(), nullptr, node_matches(*node) ); - g_assert(previous == NULL + g_assert(previous == nullptr ? node->parent()->firstChild() == node : previous->next() == node); diff --git a/src/xml/node-fns.h b/src/xml/node-fns.h index f6b1173db..c18201ff4 100644 --- a/src/xml/node-fns.h +++ b/src/xml/node-fns.h @@ -33,10 +33,10 @@ bool id_permitted(Node const *node); * @relates Inkscape::XML::Node */ inline Node *next_node(Node *node) { - return ( node ? node->next() : NULL ); + return ( node ? node->next() : nullptr ); } inline Node const *next_node(Node const *node) { - return ( node ? node->next() : NULL ); + return ( node ? node->next() : nullptr ); } //@} @@ -65,10 +65,10 @@ inline Node const *previous_node(Node const *node) { * @relates Inkscape::XML::Node */ inline Node *parent_node(Node *node) { - return ( node ? node->parent() : NULL ); + return ( node ? node->parent() : nullptr ); } inline Node const *parent_node(Node const *node) { - return ( node ? node->parent() : NULL ); + return ( node ? node->parent() : nullptr ); } //@} diff --git a/src/xml/node-iterators.h b/src/xml/node-iterators.h index 389d70be0..4e4b92b4d 100644 --- a/src/xml/node-iterators.h +++ b/src/xml/node-iterators.h @@ -20,13 +20,13 @@ namespace XML { struct NodeSiblingIteratorStrategy { static Node const *next(Node const *node) { - return ( node ? node->next() : NULL ); + return ( node ? node->next() : nullptr ); } }; struct NodeParentIteratorStrategy { static Node const *next(Node const *node) { - return ( node ? node->parent() : NULL ); + return ( node ? node->parent() : nullptr ); } }; diff --git a/src/xml/node.h b/src/xml/node.h index 85d9f6f12..3f19e8fa1 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -208,13 +208,13 @@ public: void setAttribute(char const *key, Glib::ustring const &value, bool is_interactive=false) { - setAttribute(key, value.empty() ? NULL : value.c_str(), is_interactive); + setAttribute(key, value.empty() ? nullptr : value.c_str(), is_interactive); } void setAttribute(Glib::ustring const &key, Glib::ustring const &value, bool is_interactive=false) { - setAttribute( key.empty() ? NULL : key.c_str(), - value.empty() ? NULL : value.c_str(), is_interactive); + setAttribute( key.empty() ? nullptr : key.c_str(), + value.empty() ? nullptr : value.c_str(), is_interactive); } //@} diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index 072a9b6e4..630882ed3 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -276,7 +276,7 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b std::string new_href = sp_relative_path_from_path(abs_href, new_abs_base); ir->setAttribute("sodipodi:absref", ( spns ? abs_href.c_str() - : NULL )); + : nullptr )); if (!Glib::path_is_absolute(new_href)) { #ifdef WIN32 /* Native Windows path separators are replaced with / so that the href @@ -285,7 +285,7 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b #endif ir->setAttribute("xlink:href", new_href.c_str()); } else { - ir->setAttribute("xlink:href", g_filename_to_uri(new_href.c_str(), NULL, NULL)); + ir->setAttribute("xlink:href", g_filename_to_uri(new_href.c_str(), nullptr, nullptr)); } /* impl: I assume that if !spns then any existing sodipodi:absref is about to get diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index f0b7e0d8d..9a0ba48de 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -59,7 +59,7 @@ static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const * */ SPCSSAttr *sp_repr_css_attr_new() { - static Inkscape::XML::Document *attr_doc=NULL; + static Inkscape::XML::Document *attr_doc=nullptr; if (!attr_doc) { attr_doc = new Inkscape::XML::SimpleDocument(); } @@ -71,7 +71,7 @@ SPCSSAttr *sp_repr_css_attr_new() */ void sp_repr_css_attr_unref(SPCSSAttr *css) { - g_assert(css != NULL); + g_assert(css != nullptr); Inkscape::GC::release((Node *) css); } @@ -83,8 +83,8 @@ void sp_repr_css_attr_unref(SPCSSAttr *css) */ SPCSSAttr *sp_repr_css_attr(Node *repr, gchar const *attr) { - g_assert(repr != NULL); - g_assert(attr != NULL); + g_assert(repr != nullptr); + g_assert(attr != nullptr); SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_add_components(css, repr, attr); @@ -104,21 +104,21 @@ SPCSSAttr *sp_repr_css_attr_parse_color_to_fill(const Glib::ustring &text) char *str = const_cast<char *>(text.data()); bool attempt_alpha = false; if ( !str || ( *str == '\0' ) ) { - return NULL; // this is OK due to boolean short-circuit + return nullptr; // this is OK due to boolean short-circuit } // those conditionals guard against parsing e.g. the string "fab" as "fab000" // (incomplete color) and "45fab71" as "45fab710" (incomplete alpha) if ( *str == '#' ) { if ( len < 7 ) { - return NULL; + return nullptr; } if ( len >= 9 ) { attempt_alpha = true; } } else { if ( len < 6 ) { - return NULL; + return nullptr; } if ( len >= 8 ) { attempt_alpha = true; @@ -158,7 +158,7 @@ SPCSSAttr *sp_repr_css_attr_parse_color_to_fill(const Glib::ustring &text) sp_repr_css_set_property(color_css, "fill-opacity", opcss.str().data()); return color_css; } - return NULL; + return nullptr; } @@ -181,8 +181,8 @@ static void sp_repr_css_attr_inherited_recursive(SPCSSAttr *css, Node *repr, gch */ SPCSSAttr *sp_repr_css_attr_inherited(Node *repr, gchar const *attr) { - g_assert(repr != NULL); - g_assert(attr != NULL); + g_assert(repr != nullptr); + g_assert(attr != nullptr); SPCSSAttr *css = sp_repr_css_attr_new(); @@ -198,9 +198,9 @@ SPCSSAttr *sp_repr_css_attr_inherited(Node *repr, gchar const *attr) */ static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const *attr) { - g_assert(css != NULL); - g_assert(repr != NULL); - g_assert(attr != NULL); + g_assert(css != nullptr); + g_assert(repr != nullptr); + g_assert(attr != nullptr); char const *data = repr->attribute(attr); sp_repr_css_attr_add_from_string(css, data); @@ -212,11 +212,11 @@ static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const * */ char const *sp_repr_css_property(SPCSSAttr *css, gchar const *name, gchar const *defval) { - g_assert(css != NULL); - g_assert(name != NULL); + g_assert(css != nullptr); + g_assert(name != nullptr); char const *attr = ((Node *)css)->attribute(name); - return ( attr == NULL + return ( attr == nullptr ? defval : attr ); } @@ -226,8 +226,8 @@ char const *sp_repr_css_property(SPCSSAttr *css, gchar const *name, gchar const */ bool sp_repr_css_property_is_unset(SPCSSAttr *css, gchar const *name) { - g_assert(css != NULL); - g_assert(name != NULL); + g_assert(css != nullptr); + g_assert(name != nullptr); char const *attr = ((Node *)css)->attribute(name); return (attr && !strcmp(attr, "inkscape:unset")); @@ -239,8 +239,8 @@ bool sp_repr_css_property_is_unset(SPCSSAttr *css, gchar const *name) */ void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value) { - g_assert(css != NULL); - g_assert(name != NULL); + g_assert(css != nullptr); + g_assert(name != nullptr); ((Node *) css)->setAttribute(name, value, false); } @@ -250,8 +250,8 @@ void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *va */ void sp_repr_css_unset_property(SPCSSAttr *css, gchar const *name) { - g_assert(css != NULL); - g_assert(name != NULL); + g_assert(css != nullptr); + g_assert(name != nullptr); ((Node *) css)->setAttribute(name, "inkscape:unset", false); } @@ -261,8 +261,8 @@ void sp_repr_css_unset_property(SPCSSAttr *css, gchar const *name) */ double sp_repr_css_double_property(SPCSSAttr *css, gchar const *name, double defval) { - g_assert(css != NULL); - g_assert(name != NULL); + g_assert(css != nullptr); + g_assert(name != nullptr); double val = defval; sp_repr_get_double((Node *) css, name, &val); @@ -297,9 +297,9 @@ void sp_repr_css_write_string(SPCSSAttr *css, Glib::ustring &str) */ void sp_repr_css_set(Node *repr, SPCSSAttr *css, gchar const *attr) { - g_assert(repr != NULL); - g_assert(css != NULL); - g_assert(attr != NULL); + g_assert(repr != nullptr); + g_assert(css != nullptr); + g_assert(attr != nullptr); Glib::ustring value; sp_repr_css_write_string(css, value); @@ -332,8 +332,8 @@ void sp_repr_css_print(SPCSSAttr *css) */ void sp_repr_css_merge(SPCSSAttr *dst, SPCSSAttr *src) { - g_assert(dst != NULL); - g_assert(src != NULL); + g_assert(dst != nullptr); + g_assert(src != nullptr); dst->mergeFrom(src, ""); } @@ -428,7 +428,7 @@ static void sp_repr_css_merge_from_decl_list(SPCSSAttr *css, CRDeclaration const */ void sp_repr_css_attr_add_from_string(SPCSSAttr *css, gchar const *p) { - if (p != NULL) { + if (p != nullptr) { CRDeclaration *const decl_list = cr_declaration_parse_list_from_buf(reinterpret_cast<guchar const *>(p), CR_UTF_8); if (decl_list) { @@ -445,9 +445,9 @@ void sp_repr_css_attr_add_from_string(SPCSSAttr *css, gchar const *p) */ void sp_repr_css_change(Node *repr, SPCSSAttr *css, gchar const *attr) { - g_assert(repr != NULL); - g_assert(css != NULL); - g_assert(attr != NULL); + g_assert(repr != nullptr); + g_assert(css != nullptr); + g_assert(attr != nullptr); SPCSSAttr *current = sp_repr_css_attr(repr, attr); sp_repr_css_merge(current, css); @@ -458,13 +458,13 @@ void sp_repr_css_change(Node *repr, SPCSSAttr *css, gchar const *attr) void sp_repr_css_change_recursive(Node *repr, SPCSSAttr *css, gchar const *attr) { - g_assert(repr != NULL); - g_assert(css != NULL); - g_assert(attr != NULL); + g_assert(repr != nullptr); + g_assert(css != nullptr); + g_assert(attr != nullptr); sp_repr_css_change(repr, css, attr); - for (Node *child = repr->firstChild(); child != NULL; child = child->next()) { + for (Node *child = repr->firstChild(); child != nullptr; child = child->next()) { sp_repr_css_change_recursive(child, css, attr); } } diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 519b30cd4..0fdd891a2 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -72,16 +72,16 @@ class XmlSource { public: XmlSource() - : filename(0), - encoding(0), - fp(NULL), + : filename(nullptr), + encoding(nullptr), + fp(nullptr), firstFewLen(0), LoadEntities(false), cachedData(), cachedPos(0), dummy("x"), - instr(NULL), - gzin(NULL) + instr(nullptr), + gzin(nullptr) { for (int k=0;k<4;k++) { @@ -93,7 +93,7 @@ public: close(); if ( encoding ) { g_free(encoding); - encoding = 0; + encoding = nullptr; } } @@ -138,7 +138,7 @@ int XmlSource::setFile(char const *filename, bool load_entities=false) if ( (some >= 2) && (firstFew[0] == 0x1f) && (firstFew[1] == 0x8b) ) { //g_message(" the file being read is gzip'd. extract it"); fclose(fp); - fp = 0; + fp = nullptr; fp = Inkscape::IO::fopen_utf8name(filename, "r"); instr = new Inkscape::IO::UriInputStream(fp, dummy); gzin = new Inkscape::IO::GzipInputStream(*instr); @@ -198,14 +198,14 @@ int XmlSource::setFile(char const *filename, bool load_entities=false) GRegex *regex = g_regex_new( "<!ENTITY\\s+[^>\\s]+\\s+(SYSTEM|PUBLIC\\s+\"[^>\"]+\")\\s+\"[^>\"]+\"\\s*>", - G_REGEX_CASELESS, G_REGEX_MATCH_NEWLINE_ANY, NULL); + G_REGEX_CASELESS, G_REGEX_MATCH_NEWLINE_ANY, nullptr); g_regex_match (regex, this->cachedData.c_str(), G_REGEX_MATCH_NEWLINE_ANY, &info); while (g_match_info_matches (info)) { if (g_match_info_fetch_pos (info, 1, &start, &end)) this->cachedData.erase(start, end - start); - g_match_info_next (info, NULL); + g_match_info_next (info, nullptr); } g_match_info_free(info); g_regex_unref(regex); @@ -302,17 +302,17 @@ int XmlSource::close() if ( gzin ) { gzin->close(); delete gzin; - gzin = 0; + gzin = nullptr; } if ( instr ) { instr->close(); - fp = 0; + fp = nullptr; delete instr; - instr = 0; + instr = nullptr; } if ( fp ) { fclose(fp); - fp = 0; + fp = nullptr; } return 0; } @@ -323,15 +323,15 @@ int XmlSource::close() */ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) { - xmlDocPtr doc = 0; - Document * rdoc = 0; + xmlDocPtr doc = nullptr; + Document * rdoc = nullptr; xmlSubstituteEntitiesDefault(1); - g_return_val_if_fail(filename != NULL, NULL); + g_return_val_if_fail(filename != nullptr, NULL); if (!Inkscape::IO::file_test(filename, G_FILE_TEST_EXISTS)) { g_warning("Can't open file: %s (doesn't exist)", filename); - return NULL; + return nullptr; } /* fixme: A file can disappear at any time, including between now and when we actually try to * open it. Get rid of the above test once we're sure that we correctly handle @@ -340,10 +340,10 @@ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) // TODO: bulia, please look over gsize bytesRead = 0; gsize bytesWritten = 0; - GError* error = NULL; + GError* error = nullptr; // TODO: need to replace with our own fopen and reading gchar* localFilename = g_filename_from_utf8(filename, -1, &bytesRead, &bytesWritten, &error); - g_return_val_if_fail(localFilename != NULL, NULL); + g_return_val_if_fail(localFilename != nullptr, NULL); Inkscape::IO::dump_fopen_call(filename, "N"); @@ -383,14 +383,14 @@ Document *sp_repr_read_mem (const gchar * buffer, gint length, const gchar *defa xmlSubstituteEntitiesDefault(1); - g_return_val_if_fail (buffer != NULL, NULL); + g_return_val_if_fail (buffer != nullptr, NULL); int parser_options = XML_PARSE_HUGE | XML_PARSE_RECOVER; parser_options |= XML_PARSE_NONET; // TODO: should we allow network access? // proper solution would be to check the preference "/options/externalresources/xml/allow_net_access" // as done in XmlSource::readXml which gets called by the analogous sp_repr_read_file() // but sp_repr_read_mem() seems to be called in locations where Inkscape::Preferences::get() fails badly - doc = xmlReadMemory (const_cast<gchar *>(buffer), length, NULL, NULL, parser_options); + doc = xmlReadMemory (const_cast<gchar *>(buffer), length, nullptr, nullptr, parser_options); rdoc = sp_repr_do_read (doc, default_ns); if (doc) { @@ -465,20 +465,20 @@ void promote_to_namespace(Node *repr, const gchar *prefix) { */ Document *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns) { - if (doc == NULL) { - return NULL; + if (doc == nullptr) { + return nullptr; } xmlNodePtr node=xmlDocGetRootElement (doc); - if (node == NULL) { - return NULL; + if (node == nullptr) { + return nullptr; } std::map<std::string, std::string> prefix_map; Document *rdoc = new Inkscape::XML::SimpleDocument(); - Node *root=NULL; - for ( node = doc->children ; node != NULL ; node = node->next ) { + Node *root=nullptr; + for ( node = doc->children ; node != nullptr ; node = node->next ) { if (node->type == XML_ELEMENT_NODE) { Node *repr=sp_repr_svg_read_node(rdoc, node, default_ns, prefix_map); rdoc->appendChild(repr); @@ -487,7 +487,7 @@ Document *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns) if (!root) { root = repr; } else { - root = NULL; + root = nullptr; break; } } else if ( node->type == XML_COMMENT_NODE || node->type == XML_PI_NODE ) { @@ -497,7 +497,7 @@ Document *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns) } } - if (root != NULL) { + if (root != nullptr) { /* promote elements of some XML documents that don't use namespaces * into their default namespace */ if ( default_ns && !strchr(root->name(), ':') ) { @@ -535,11 +535,11 @@ gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *nam prefix_map[reinterpret_cast<const char*>(prefix)] = reinterpret_cast<const char*>(ns->href); } else { - prefix = NULL; + prefix = nullptr; } } else { - prefix = NULL; + prefix = nullptr; } if (prefix) { @@ -557,8 +557,8 @@ static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gc if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE) { - if (node->content == NULL || *(node->content) == '\0') { - return NULL; // empty text node + if (node->content == nullptr || *(node->content) == '\0') { + return nullptr; // empty text node } // Since libxml2 2.9.0, only element nodes are checked, thus check parent. @@ -571,7 +571,7 @@ static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gc ; // skip all whitespace if (!(*p)) { // this is an all-whitespace node, and preserve == default - return NULL; // we do not preserve all-whitespace nodes unless we are asked to + return nullptr; // we do not preserve all-whitespace nodes unless we are asked to } // We keep track of original node type so that CDATA sections are preserved on output. @@ -589,14 +589,14 @@ static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gc } if (node->type == XML_ENTITY_DECL) { - return NULL; + return nullptr; } sp_repr_qualified_name (c, 256, node->ns, node->name, default_ns, prefix_map); Node *repr = xml_doc->createElement(c); /* TODO remember node->ns->prefix if node->ns != NULL */ - for (prop = node->properties; prop != NULL; prop = prop->next) { + for (prop = node->properties; prop != nullptr; prop = prop->next) { if (prop->children) { sp_repr_qualified_name (c, 256, prop->ns, prop->name, default_ns, prefix_map); repr->setAttribute(c, reinterpret_cast<gchar*>(prop->children->content)); @@ -608,7 +608,7 @@ static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gc repr->setContent(reinterpret_cast<gchar*>(node->content)); } - for (child = node->xmlChildrenNode; child != NULL; child = child->next) { + for (child = node->xmlChildrenNode; child != nullptr; child = child->next) { Node *crepr = sp_repr_svg_read_node (xml_doc, child, default_ns, prefix_map); if (crepr) { repr->appendChild(crepr); @@ -660,7 +660,7 @@ Glib::ustring sp_repr_save_buf(Document *doc) Inkscape::IO::StringOutputStream souts; Inkscape::IO::OutputStreamWriter outs(souts); - sp_repr_save_writer(doc, &outs, SP_INKSCAPE_NS_URI, 0, 0); + sp_repr_save_writer(doc, &outs, SP_INKSCAPE_NS_URI, nullptr, nullptr); outs.close(); Glib::ustring buf = souts.getString(); @@ -675,7 +675,7 @@ void sp_repr_save_stream(Document *doc, FILE *fp, gchar const *default_ns, bool { Inkscape::URI dummy("x"); Inkscape::IO::UriOutputStream bout(fp, dummy); - Inkscape::IO::GzipOutputStream *gout = compress ? new Inkscape::IO::GzipOutputStream(bout) : NULL; + Inkscape::IO::GzipOutputStream *gout = compress ? new Inkscape::IO::GzipOutputStream(bout) : nullptr; Inkscape::IO::OutputStreamWriter *out = compress ? new Inkscape::IO::OutputStreamWriter( *gout ) : new Inkscape::IO::OutputStreamWriter( bout ); sp_repr_save_writer(doc, out, default_ns, old_href_abs_base, new_href_abs_base); @@ -710,7 +710,7 @@ bool sp_repr_save_rebased_file(Document *doc, gchar const *const filename, gchar Inkscape::IO::dump_fopen_call( filename, "B" ); FILE *file = Inkscape::IO::fopen_utf8name(filename, "w"); - if (file == NULL) { + if (file == nullptr) { return false; } @@ -744,7 +744,7 @@ bool sp_repr_save_rebased_file(Document *doc, gchar const *const filename, gchar */ bool sp_repr_save_file(Document *doc, gchar const *const filename, gchar const *default_ns) { - return sp_repr_save_rebased_file(doc, filename, default_ns, NULL, NULL); + return sp_repr_save_rebased_file(doc, filename, default_ns, nullptr, nullptr); } @@ -864,7 +864,7 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out, { using Inkscape::Util::ptr_shared; - g_assert(repr != NULL); + g_assert(repr != nullptr); // Clean unnecessary attributes and stype properties. (Controlled by preferences.) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -882,7 +882,7 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out, Glib::QueryQuark elide_prefix=GQuark(0); if ( default_ns && ns_map.find(GQuark(0)) == ns_map.end() ) { - elide_prefix = g_quark_from_string(sp_xml_ns_uri_prefix(default_ns, NULL)); + elide_prefix = g_quark_from_string(sp_xml_ns_uri_prefix(default_ns, nullptr)); } List<AttributeRecord const> attributes=repr->attributeList(); @@ -964,10 +964,10 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, gchar const *old_href_base, gchar const *new_href_base ) { - Node *child = 0; + Node *child = nullptr; bool loose = false; - g_return_if_fail (repr != NULL); + g_return_if_fail (repr != nullptr); if ( indent_level > 16 ) { indent_level = 16; @@ -993,7 +993,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, // if this is a <text> element, suppress formatting whitespace // for its content and children: gchar const *xml_space_attr = repr->attribute("xml:space"); - if (xml_space_attr != NULL && !strcmp(xml_space_attr, "preserve")) { + if (xml_space_attr != nullptr && !strcmp(xml_space_attr, "preserve")) { add_whitespace = false; } @@ -1017,7 +1017,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, } loose = TRUE; - for (child = repr->firstChild() ; child != NULL; child = child->next()) { + for (child = repr->firstChild() ; child != nullptr; child = child->next()) { if (child->type() == Inkscape::XML::TEXT_NODE) { loose = FALSE; break; @@ -1028,7 +1028,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, if (loose && add_whitespace) { out.writeString( "\n" ); } - for (child = repr->firstChild(); child != NULL; child = child->next()) { + for (child = repr->firstChild(); child != nullptr; child = child->next()) { sp_repr_write_stream(child, out, ( loose ? indent_level + 1 : 0 ), add_whitespace, elide_prefix, inlineattrs, indent, old_href_base, new_href_base); diff --git a/src/xml/repr-sorting.cpp b/src/xml/repr-sorting.cpp index 09a39acb2..75fb74166 100644 --- a/src/xml/repr-sorting.cpp +++ b/src/xml/repr-sorting.cpp @@ -14,7 +14,7 @@ Inkscape::XML::Node const *LCA(Inkscape::XML::Node const *a, Inkscape::XML::Node { using Inkscape::Algorithms::longest_common_suffix; Inkscape::XML::Node const *ancestor = longest_common_suffix<Inkscape::XML::NodeConstParentIterator>( - a, b, NULL, &same_repr); + a, b, nullptr, &same_repr); bool OK = false; if (ancestor) { if (ancestor->type() != Inkscape::XML::DOCUMENT_NODE) { @@ -24,7 +24,7 @@ Inkscape::XML::Node const *LCA(Inkscape::XML::Node const *a, Inkscape::XML::Node if ( OK ) { return ancestor; } else { - return NULL; + return nullptr; } } @@ -36,7 +36,7 @@ Inkscape::XML::Node *LCA(Inkscape::XML::Node *a, Inkscape::XML::Node *b) Inkscape::XML::Node const *AncetreFils(Inkscape::XML::Node const *descendent, Inkscape::XML::Node const *ancestor) { - Inkscape::XML::Node const *result = 0; + Inkscape::XML::Node const *result = nullptr; if ( descendent && ancestor ) { if (descendent->parent() == ancestor) { result = descendent; diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 6da1233db..7946eebfc 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -71,7 +71,7 @@ static char *sp_xml_ns_auto_prefix(char const *uri); * SPXMLNs */ -static SPXMLNs *namespaces=NULL; +static SPXMLNs *namespaces=nullptr; /* * There are the prefixes to use for the XML namespaces defined @@ -134,7 +134,7 @@ static void sp_xml_ns_register_defaults() defaults[10].uri = g_quark_from_static_string(SP_OLD_CC_NS_URI); defaults[10].prefix = g_quark_from_static_string("cc"); - defaults[10].next = NULL; + defaults[10].next = nullptr; namespaces = &defaults[0]; } @@ -169,14 +169,14 @@ gchar const *sp_xml_ns_uri_prefix(gchar const *uri, gchar const *suggested) { char const *prefix; - if (!uri) return NULL; + if (!uri) return nullptr; if (!namespaces) { sp_xml_ns_register_defaults(); } GQuark const key = g_quark_from_string(uri); - prefix = NULL; + prefix = nullptr; for ( SPXMLNs *iter=namespaces ; iter ; iter = iter->next ) { if ( iter->uri == key ) { prefix = g_quark_to_string(iter->prefix); @@ -210,7 +210,7 @@ gchar const *sp_xml_ns_uri_prefix(gchar const *uri, gchar const *suggested) } ns = g_new(SPXMLNs, 1); - g_assert( ns != NULL ); + g_assert( ns != nullptr ); ns->uri = g_quark_from_string(uri); ns->prefix = g_quark_from_string(new_prefix); @@ -230,14 +230,14 @@ gchar const *sp_xml_ns_prefix_uri(gchar const *prefix) SPXMLNs *iter; char const *uri; - if (!prefix) return NULL; + if (!prefix) return nullptr; if (!namespaces) { sp_xml_ns_register_defaults(); } GQuark const key = g_quark_from_string(prefix); - uri = NULL; + uri = nullptr; for ( iter = namespaces ; iter ; iter = iter->next ) { if ( iter->prefix == key ) { uri = g_quark_to_string(iter->uri); @@ -268,7 +268,7 @@ int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::No // Find the lowest common ancestor(LCA) Inkscape::XML::Node const *ancestor = LCA(first, second); - g_assert(ancestor != NULL); + g_assert(ancestor != nullptr); if (ancestor == first) { return 1; @@ -324,7 +324,7 @@ Inkscape::XML::Node *sp_repr_lookup_child(Inkscape::XML::Node *repr, gchar const *key, gchar const *value) { - g_return_val_if_fail(repr != NULL, NULL); + g_return_val_if_fail(repr != nullptr, NULL); for ( Inkscape::XML::Node *child = repr->firstChild() ; child ; child = child->next() ) { gchar const *child_value = child->attribute(key); if ( (child_value == value) || @@ -333,14 +333,14 @@ Inkscape::XML::Node *sp_repr_lookup_child(Inkscape::XML::Node *repr, return child; } } - return NULL; + return nullptr; } Inkscape::XML::Node const *sp_repr_lookup_name( Inkscape::XML::Node const *repr, gchar const *name, gint maxdepth ) { - Inkscape::XML::Node const *found = 0; - g_return_val_if_fail(repr != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); + Inkscape::XML::Node const *found = nullptr; + g_return_val_if_fail(repr != nullptr, NULL); + g_return_val_if_fail(name != nullptr, NULL); GQuark const quark = g_quark_from_string(name); @@ -369,8 +369,8 @@ std::vector<Inkscape::XML::Node const *> sp_repr_lookup_name_many( Inkscape::XML { std::vector<Inkscape::XML::Node const *> nodes; std::vector<Inkscape::XML::Node const *> found; - g_return_val_if_fail(repr != NULL, nodes); - g_return_val_if_fail(name != NULL, nodes); + g_return_val_if_fail(repr != nullptr, nodes); + g_return_val_if_fail(name != nullptr, nodes); GQuark const quark = g_quark_from_string(name); @@ -398,10 +398,10 @@ std::vector<Inkscape::XML::Node const *> sp_repr_lookup_name_many( Inkscape::XML */ bool sp_repr_is_meta_element(const Inkscape::XML::Node *node) { - if (node == NULL) return false; + if (node == nullptr) return false; if (node->type() != Inkscape::XML::ELEMENT_NODE) return false; gchar const *name = node->name(); - if (name == NULL) return false; + if (name == nullptr) return false; if (!std::strcmp(name, "svg:title")) return true; if (!std::strcmp(name, "svg:desc")) return true; if (!std::strcmp(name, "svg:metadata")) return true; @@ -418,13 +418,13 @@ unsigned int sp_repr_get_boolean(Inkscape::XML::Node *repr, gchar const *key, un { gchar const *v; - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); - g_return_val_if_fail(val != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); + g_return_val_if_fail(val != nullptr, FALSE); v = repr->attribute(key); - if (v != NULL) { + if (v != nullptr) { if (!g_ascii_strcasecmp(v, "true") || !g_ascii_strcasecmp(v, "yes" ) || !g_ascii_strcasecmp(v, "y" ) || @@ -444,13 +444,13 @@ unsigned int sp_repr_get_int(Inkscape::XML::Node *repr, gchar const *key, int *v { gchar const *v; - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); - g_return_val_if_fail(val != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); + g_return_val_if_fail(val != nullptr, FALSE); v = repr->attribute(key); - if (v != NULL) { + if (v != nullptr) { *val = atoi(v); return TRUE; } @@ -460,14 +460,14 @@ unsigned int sp_repr_get_int(Inkscape::XML::Node *repr, gchar const *key, int *v unsigned int sp_repr_get_double(Inkscape::XML::Node *repr, gchar const *key, double *val) { - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); - g_return_val_if_fail(val != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); + g_return_val_if_fail(val != nullptr, FALSE); gchar const *v = repr->attribute(key); - if (v != NULL) { - *val = g_ascii_strtod(v, NULL); + if (v != nullptr) { + *val = g_ascii_strtod(v, nullptr); return TRUE; } @@ -476,8 +476,8 @@ unsigned int sp_repr_get_double(Inkscape::XML::Node *repr, gchar const *key, dou unsigned int sp_repr_set_boolean(Inkscape::XML::Node *repr, gchar const *key, unsigned int val) { - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); repr->setAttribute(key, (val) ? "true" : "false"); return true; @@ -487,8 +487,8 @@ unsigned int sp_repr_set_int(Inkscape::XML::Node *repr, gchar const *key, int va { gchar c[32]; - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); g_snprintf(c, 32, "%d", val); @@ -503,8 +503,8 @@ unsigned int sp_repr_set_int(Inkscape::XML::Node *repr, gchar const *key, int va */ unsigned int sp_repr_set_css_double(Inkscape::XML::Node *repr, gchar const *key, double val) { - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); Inkscape::CSSOStringStream os; os << val; @@ -520,8 +520,8 @@ unsigned int sp_repr_set_css_double(Inkscape::XML::Node *repr, gchar const *key, */ unsigned int sp_repr_set_svg_double(Inkscape::XML::Node *repr, gchar const *key, double val) { - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); g_return_val_if_fail(val==val, FALSE);//tests for nan Inkscape::SVGOStringStream os; @@ -538,8 +538,8 @@ unsigned int sp_repr_set_svg_double(Inkscape::XML::Node *repr, gchar const *key, */ unsigned int sp_repr_set_svg_length(Inkscape::XML::Node *repr, gchar const *key, SVGLength &val) { - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); repr->setAttribute(key, val.write()); return true; @@ -547,8 +547,8 @@ unsigned int sp_repr_set_svg_length(Inkscape::XML::Node *repr, gchar const *key, unsigned sp_repr_set_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point const & val) { - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); Inkscape::SVGOStringStream os; os << val[Geom::X] << "," << val[Geom::Y]; @@ -559,20 +559,20 @@ unsigned sp_repr_set_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Po unsigned int sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point *val) { - g_return_val_if_fail(repr != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); - g_return_val_if_fail(val != NULL, FALSE); + g_return_val_if_fail(repr != nullptr, FALSE); + g_return_val_if_fail(key != nullptr, FALSE); + g_return_val_if_fail(val != nullptr, FALSE); gchar const *v = repr->attribute(key); - g_return_val_if_fail(v != NULL, FALSE); + g_return_val_if_fail(v != nullptr, FALSE); gchar ** strarray = g_strsplit(v, ",", 2); if (strarray && strarray[0] && strarray[1]) { double newx, newy; - newx = g_ascii_strtod(strarray[0], NULL); - newy = g_ascii_strtod(strarray[1], NULL); + newx = g_ascii_strtod(strarray[0], nullptr); + newy = g_ascii_strtod(strarray[1], nullptr); g_strfreev (strarray); *val = Geom::Point(newx, newy); return TRUE; diff --git a/src/xml/repr.h b/src/xml/repr.h index ecc5c02a6..632b1f28a 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -56,18 +56,18 @@ Inkscape::XML::Document *sp_repr_read_mem(char const *buffer, int length, char c void sp_repr_write_stream(Inkscape::XML::Node *repr, Inkscape::IO::Writer &out, int indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix, int inlineattrs, int indent, - char const *old_href_base = NULL, - char const *new_href_base = NULL); + char const *old_href_base = nullptr, + char const *new_href_base = nullptr); Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const char *default_ns); Glib::ustring sp_repr_save_buf(Inkscape::XML::Document *doc); // TODO convert to std::string void sp_repr_save_stream(Inkscape::XML::Document *doc, FILE *to_file, - char const *default_ns = NULL, bool compress = false, - char const *old_href_base = NULL, - char const *new_href_base = NULL); + char const *default_ns = nullptr, bool compress = false, + char const *old_href_base = nullptr, + char const *new_href_base = nullptr); -bool sp_repr_save_file(Inkscape::XML::Document *doc, char const *filename, char const *default_ns=NULL); +bool sp_repr_save_file(Inkscape::XML::Document *doc, char const *filename, char const *default_ns=nullptr); bool sp_repr_save_rebased_file(Inkscape::XML::Document *doc, char const *filename_utf8, char const *default_ns, char const *old_base, char const *new_base_filename); diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index a1a7127cc..13cf10783 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -166,11 +166,11 @@ SimpleNode::SimpleNode(int code, Document *document) : Node(), _name(code), _attributes(), _child_count(0), _cached_positions_valid(false) { - g_assert(document != NULL); + g_assert(document != nullptr); this->_document = document; - this->_parent = this->_next = NULL; - this->_first_child = this->_last_child = NULL; + this->_parent = this->_next = nullptr; + this->_first_child = this->_last_child = nullptr; _observers.add(_subtree_observers); } @@ -182,14 +182,14 @@ SimpleNode::SimpleNode(SimpleNode const &node, Document *document) _child_count(node._child_count), _cached_positions_valid(node._cached_positions_valid) { - g_assert(document != NULL); + g_assert(document != nullptr); _document = document; - _parent = _next = NULL; - _first_child = _last_child = NULL; + _parent = _next = nullptr; + _first_child = _last_child = nullptr; for ( SimpleNode *child = node._first_child ; - child != NULL ; child = child->_next ) + child != nullptr ; child = child->_next ) { SimpleNode *child_copy=dynamic_cast<SimpleNode *>(child->duplicate(document)); @@ -222,7 +222,7 @@ gchar const *SimpleNode::content() const { } gchar const *SimpleNode::attribute(gchar const *name) const { - g_return_val_if_fail(name != NULL, NULL); + g_return_val_if_fail(name != nullptr, NULL); GQuark const key = g_quark_from_string(name); @@ -234,11 +234,11 @@ gchar const *SimpleNode::attribute(gchar const *name) const { } } - return NULL; + return nullptr; } unsigned SimpleNode::position() const { - g_return_val_if_fail(_parent != NULL, 0); + g_return_val_if_fail(_parent != nullptr, 0); return _parent->_childPosition(*this); } @@ -265,7 +265,7 @@ Node *SimpleNode::nthChild(unsigned index) { } bool SimpleNode::matchAttributeName(gchar const *partial_name) const { - g_return_val_if_fail(partial_name != NULL, false); + g_return_val_if_fail(partial_name != nullptr, false); for ( List<AttributeRecord const> iter = _attributes ; iter ; ++iter ) @@ -319,19 +319,19 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_ gchar* cleaned_value = g_strdup( value ); // Only check elements in SVG name space and don't block setting attribute to NULL. - if( element.substr(0,4) == "svg:" && value != NULL) { + if( element.substr(0,4) == "svg:" && value != nullptr) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if( prefs->getBool("/options/svgoutput/check_on_editing") ) { gchar const *id_char = attribute("id"); - Glib::ustring id = (id_char == NULL ? "" : id_char ); + Glib::ustring id = (id_char == nullptr ? "" : id_char ); unsigned int flags = sp_attribute_clean_get_prefs(); bool attr_warn = flags & SP_ATTR_CLEAN_ATTR_WARN; bool attr_remove = flags & SP_ATTR_CLEAN_ATTR_REMOVE; // Check attributes - if( (attr_warn || attr_remove) && value != NULL ) { + if( (attr_warn || attr_remove) && value != nullptr ) { bool is_useful = sp_attribute_check_attribute( element, id, name, attr_warn ); if( !is_useful && attr_remove ) { g_free( cleaned_value ); @@ -468,8 +468,8 @@ void SimpleNode::removeChild(Node *generic_child) { _cached_positions_valid = false; } - child->_next = NULL; - child->_setParent(NULL); + child->_next = nullptr; + child->_setParent(nullptr); _child_count--; _document->logger()->notifyChildRemoved(*this, *child, ref); @@ -527,12 +527,12 @@ void SimpleNode::changeOrder(Node *generic_child, Node *generic_ref) { } void SimpleNode::setPosition(int pos) { - g_return_if_fail(_parent != NULL); + g_return_if_fail(_parent != nullptr); // a position beyond the end of the list means the end of the list; // a negative position is the same as an infinitely large position - SimpleNode *ref=NULL; + SimpleNode *ref=nullptr; for ( SimpleNode *sibling = _parent->_first_child ; sibling && pos ; sibling = sibling->_next ) { @@ -582,11 +582,11 @@ void SimpleNode::synthesizeEvents(NodeEventVector const *vector, void *data) { for ( List<AttributeRecord const> iter = _attributes ; iter ; ++iter ) { - vector->attr_changed(this, g_quark_to_string(iter->key), NULL, iter->value, false, data); + vector->attr_changed(this, g_quark_to_string(iter->key), nullptr, iter->value, false, data); } } if (vector->child_added) { - SimpleNode *ref = NULL; + SimpleNode *ref = nullptr; for ( SimpleNode *child = this->_first_child ; child ; child = child->_next ) { @@ -595,7 +595,7 @@ void SimpleNode::synthesizeEvents(NodeEventVector const *vector, void *data) { } } if (vector->content_changed) { - vector->content_changed(this, NULL, this->_content, data); + vector->content_changed(this, nullptr, this->_content, data); } } @@ -618,7 +618,7 @@ void SimpleNode::recursivePrintTree(unsigned level) { } else { std::cout << name() << std::endl; } - for (SimpleNode *child = _first_child; child != NULL; child = child->_next) { + for (SimpleNode *child = _first_child; child != nullptr; child = child->_next) { child->recursivePrintTree( level+1 ); } } @@ -637,17 +637,17 @@ Node *SimpleNode::root() { return child; } } - return NULL; + return nullptr; } else if ( parent->type() == ELEMENT_NODE ) { return parent; } else { - return NULL; + return nullptr; } } void SimpleNode::cleanOriginal(Node *src, gchar const *key){ std::vector<Node *> to_delete; - for ( Node *child = this->firstChild() ; child != NULL ; child = child->next() ) + for ( Node *child = this->firstChild() ; child != nullptr ; child = child->next() ) { gchar const *id = child->attribute(key); if (id) { @@ -715,8 +715,8 @@ bool SimpleNode::equal(Node const *other, bool recursive) { } void SimpleNode::mergeFrom(Node const *src, gchar const *key, bool extension, bool clean) { - g_return_if_fail(src != NULL); - g_return_if_fail(key != NULL); + g_return_if_fail(src != nullptr); + g_return_if_fail(key != nullptr); g_assert(src != this); setContent(src->content()); @@ -729,7 +729,7 @@ void SimpleNode::mergeFrom(Node const *src, gchar const *key, bool extension, bo cleanOriginal(srcp, key); } - for ( Node const *child = src->firstChild() ; child != NULL ; child = child->next() ) + for ( Node const *child = src->firstChild() ; child != nullptr ; child = child->next() ) { gchar const *id = child->attribute(key); if (id) { |
