diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-06-20 14:42:18 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-07-08 21:04:15 +0000 |
| commit | 9df35b1574826f2cc82b311df5aa9de3b116e28e (patch) | |
| tree | e9fe3b1897807184b4573c691dbd8252cc6e6078 | |
| parent | Add coloring default to theme (diff) | |
| download | inkscape-9df35b1574826f2cc82b311df5aa9de3b116e28e.tar.gz inkscape-9df35b1574826f2cc82b311df5aa9de3b116e28e.zip | |
Coding Style Fixes
| -rw-r--r-- | clang_format_diff | 196 | ||||
| -rw-r--r-- | src/inkscape.cpp | 19 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 28 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 3 | ||||
| -rw-r--r-- | src/ui/icon-loader.cpp | 6 | ||||
| -rw-r--r-- | src/ui/widget/color-picker.cpp | 9 |
6 files changed, 231 insertions, 30 deletions
diff --git a/clang_format_diff b/clang_format_diff new file mode 100644 index 000000000..a71250b9c --- /dev/null +++ b/clang_format_diff @@ -0,0 +1,196 @@ +--- src/ui/dialog/inkscape-preferences.cpp (before formatting) ++++ src/ui/dialog/inkscape-preferences.cpp (after formatting) +@@ -640,7 +640,8 @@ + } + } + +-void InkscapePreferences::resetIconsColors() { ++void InkscapePreferences::resetIconsColors() ++{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (!prefs->getBool("/theme/symbolicIcons", false)) { + _symbolic_base_colors.set_sensitive(false); +@@ -690,7 +691,8 @@ + } + + +-void InkscapePreferences::get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, guint32 &colorsetwarning, guint32 &colorseterror) ++void InkscapePreferences::get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, ++ guint32 &colorsetwarning, guint32 &colorseterror) + { + using namespace Inkscape::IO::Resource; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); +@@ -787,7 +789,8 @@ + } + } + +-void InkscapePreferences::changeIconsColors() { ++void InkscapePreferences::changeIconsColors() ++{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (!prefs->getBool("/theme/symbolicDefaultColors", true)) { + Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); +@@ -811,14 +814,16 @@ + try { + INKSCAPE.colorizeprovider->load_from_data(css_str); + } catch (const Gtk::CssProviderError &ex) { +- g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), ex.what().c_str()); ++ g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), ++ ex.what().c_str()); + } + Gtk::StyleContext::add_provider_for_screen(screen, INKSCAPE.colorizeprovider, +- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); +- } +-} +- +-void InkscapePreferences::toggleSymbolic() { ++ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); ++ } ++} ++ ++void InkscapePreferences::toggleSymbolic() ++{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Gtk::Window *window = SP_ACTIVE_DESKTOP->getToplevel(); + if (prefs->getBool("/theme/symbolicIcons", false)) { +@@ -1103,7 +1108,8 @@ + _symbolic_base_colors.init(_("Use default colors for icons"), "/theme/symbolicDefaultColors", true); + _symbolic_base_colors.signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::resetIconsColors)); + _page_theme.add_line(true, "", _symbolic_base_colors, "", "", true); +- _symbolic_base_color.init(_("Color for symbolic icons:"), "/theme/" + themeiconname + "/symbolicBaseColor", 0x2E3436ff); ++ _symbolic_base_color.init(_("Color for symbolic icons:"), "/theme/" + themeiconname + "/symbolicBaseColor", ++ 0x2E3436ff); + _symbolic_success_color.init(_("Color for symbolic success icons:"), + "/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff); + _symbolic_warning_color.init(_("Color for symbolic warning icons:"), +@@ -1133,8 +1139,9 @@ + icon_buttons_hight->pack_start(_symbolic_success_color, true, true, 4); + icon_buttons_hight->pack_start(_symbolic_warning_color, true, true, 4); + icon_buttons_hight->pack_start(_symbolic_error_color, true, true, 4); +- _page_theme.add_line(false,"", *icon_buttons_hight, _("Highlights"), +- _("Highlights colors, some symbolic icon themes use it. Some icons changes need reload"), false); ++ _page_theme.add_line(false, "", *icon_buttons_hight, _("Highlights"), ++ _("Highlights colors, some symbolic icon themes use it. Some icons changes need reload"), ++ false); + Gtk::Box *icon_buttons_def = Gtk::manage(new Gtk::Box()); + _theme_decide_color.set_label(_("Theme default colors")); + _theme_decide_color.set_tooltip_text(_("Defaul colors from theme)")); +@@ -1142,7 +1149,8 @@ + icon_buttons_def->pack_start(_theme_decide_color, true, true, 4); + resetIconsColors(); + _page_theme.add_line(false, "", *icon_buttons_def, "", +- _("Reset theme colors, some symbolic icon themes use it. Some icons changes need reload"), false); ++ _("Reset theme colors, some symbolic icon themes use it. Some icons changes need reload"), ++ false); + { + Glib::ustring sizeLabels[] = { C_("Icon size", "Larger"), C_("Icon size", "Large"), C_("Icon size", "Small"), + C_("Icon size", "Smaller") }; +--- src/ui/widget/color-picker.cpp (before formatting) ++++ src/ui/widget/color-picker.cpp (after formatting) +@@ -66,16 +66,11 @@ + _colorSelectorDialog.get_content_area()->pack_start ( + *_color_selector, true, true, 0); + _color_selector->show(); +- + } + +-void ColorPicker::setTransientFor(Glib::RefPtr<Gdk::Window> transientwindow) { +- _transientwindow = transientwindow; +-} ++void ColorPicker::setTransientFor(Glib::RefPtr<Gdk::Window> transientwindow) { _transientwindow = transientwindow; } + +-void ColorPicker::setSensitive(bool sensitive) { +- set_sensitive(sensitive); +-} ++void ColorPicker::setSensitive(bool sensitive) { set_sensitive(sensitive); } + + void ColorPicker::setRgba32 (guint32 rgba) + { +--- src/ui/icon-loader.cpp (before formatting) ++++ src/ui/icon-loader.cpp (after formatting) +@@ -70,8 +70,10 @@ + if (!prefs->getBool("/theme/symbolicDefaultColors", true)) { + Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); + guint32 colorsetbase = prefs->getInt("/theme/" + themeiconname + "/symbolicBaseColor", 0x2E3436ff); +- guint32 colorsetsuccess = prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff); +- guint32 colorsetwarning = prefs->getInt("/theme/" + themeiconname + "/symbolicWarningColor", 0xF57900ff); ++ guint32 colorsetsuccess = ++ prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff); ++ guint32 colorsetwarning = ++ prefs->getInt("/theme/" + themeiconname + "/symbolicWarningColor", 0xF57900ff); + guint32 colorseterror = prefs->getInt("/theme/" + themeiconname + "/symbolicErrorColor", 0xcc0000ff); + gchar colornamed[64]; + gchar colornamedsuccess[64]; +--- src/inkscape.cpp (before formatting) ++++ src/inkscape.cpp (after formatting) +@@ -56,8 +56,8 @@ + + #include "svg/svg-color.h" + ++#include "object/sp-root.h" + #include "object/sp-style-elem.h" +-#include "object/sp-root.h" + + #include "ui/dialog/debug.h" + #include "ui/tools/tool-base.h" +@@ -501,7 +501,7 @@ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); + guint32 colorsetbase = 0x2E3436ff; +- guint32 colorsetbase_inverse = colorsetbase^ 0xffffff00; ++ guint32 colorsetbase_inverse = colorsetbase ^ 0xffffff00; + guint32 colorsetsuccess = 0x4AD589ff; + guint32 colorsetwarning = 0xF57900ff; + guint32 colorseterror = 0xcc0000ff; +@@ -538,8 +538,7 @@ + /** + * \brief Add our CSS style sheets + */ +-void +-Application::add_gtk_css() ++void Application::add_gtk_css() + { + using namespace Inkscape::IO::Resource; + // Add style sheet (GTK3) +@@ -626,23 +625,23 @@ + { + SPDocument *document = SP_ACTIVE_DOCUMENT; + Inkscape::XML::Node *root = document->getReprRoot(); +- std::vector <Inkscape::XML::Node *> styles; ++ std::vector<Inkscape::XML::Node *> styles; + for (unsigned i = 0; i < root->childCount(); ++i) { +- Inkscape::XML::Node * child = root->nthChild(i); +- if (child && strcmp(child->name(),"svg:style") == 0) { +- styles.insert(styles.begin(),child); ++ Inkscape::XML::Node *child = root->nthChild(i); ++ if (child && strcmp(child->name(), "svg:style") == 0) { ++ styles.insert(styles.begin(), child); + } + } + if (forceupd || styles.size() > 1) { + document->setStyleSheet(nullptr); + for (auto style : styles) { +- gchar const * id = style->attribute("id"); ++ gchar const *id = style->attribute("id"); + if (id) { + SPStyleElem *styleelem = dynamic_cast<SPStyleElem *>(document->getObjectById(id)); + styleelem->read_content(); + } + } +- document->getRoot()->emitModified( SP_OBJECT_MODIFIED_CASCADE ); ++ document->getRoot()->emitModified(SP_OBJECT_MODIFIED_CASCADE); + } + } + +--- src/ui/dialog/inkscape-preferences.h (before formatting) ++++ src/ui/dialog/inkscape-preferences.h (after formatting) +@@ -599,7 +599,8 @@ + void resetIconsColors(); + void themeIconsColors(); + void changeIconsColor(guint32 /*color*/) { changeIconsColors(); } +- void get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, guint32 &colorsetwarning, guint32 &colorseterror); ++ void get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, guint32 &colorsetwarning, ++ guint32 &colorseterror); + + InkscapePreferences(); + InkscapePreferences(InkscapePreferences const &d); diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 418285c4c..503c33f33 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -59,8 +59,8 @@ #include "svg/svg-color.h" -#include "object/sp-style-elem.h" #include "object/sp-root.h" +#include "object/sp-style-elem.h" #include "ui/dialog/debug.h" #include "ui/tools/tool-base.h" @@ -504,7 +504,7 @@ Glib::ustring Application::get_symbolic_colors() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); guint32 colorsetbase = 0x2E3436ff; - guint32 colorsetbase_inverse = colorsetbase^ 0xffffff00; + guint32 colorsetbase_inverse = colorsetbase ^ 0xffffff00; guint32 colorsetsuccess = 0x4AD589ff; guint32 colorsetwarning = 0xF57900ff; guint32 colorseterror = 0xcc0000ff; @@ -541,8 +541,7 @@ Glib::ustring Application::get_symbolic_colors() /** * \brief Add our CSS style sheets */ -void -Application::add_gtk_css() +void Application::add_gtk_css() { using namespace Inkscape::IO::Resource; // Add style sheet (GTK3) @@ -629,23 +628,23 @@ void Application::readStyleSheets(bool forceupd) { SPDocument *document = SP_ACTIVE_DOCUMENT; Inkscape::XML::Node *root = document->getReprRoot(); - std::vector <Inkscape::XML::Node *> styles; + std::vector<Inkscape::XML::Node *> styles; for (unsigned i = 0; i < root->childCount(); ++i) { - Inkscape::XML::Node * child = root->nthChild(i); - if (child && strcmp(child->name(),"svg:style") == 0) { - styles.insert(styles.begin(),child); + Inkscape::XML::Node *child = root->nthChild(i); + if (child && strcmp(child->name(), "svg:style") == 0) { + styles.insert(styles.begin(), child); } } if (forceupd || styles.size() > 1) { document->setStyleSheet(nullptr); for (auto style : styles) { - gchar const * id = style->attribute("id"); + gchar const *id = style->attribute("id"); if (id) { SPStyleElem *styleelem = dynamic_cast<SPStyleElem *>(document->getObjectById(id)); styleelem->read_content(); } } - document->getRoot()->emitModified( SP_OBJECT_MODIFIED_CASCADE ); + document->getRoot()->emitModified(SP_OBJECT_MODIFIED_CASCADE); } } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 1ae581365..669d39c2d 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -640,7 +640,8 @@ void InkscapePreferences::symbolicThemeCheck() } } -void InkscapePreferences::resetIconsColors() { +void InkscapePreferences::resetIconsColors() +{ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (!prefs->getBool("/theme/symbolicIcons", false)) { _symbolic_base_colors.set_sensitive(false); @@ -690,7 +691,8 @@ void InkscapePreferences::resetIconsColors() { } -void InkscapePreferences::get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, guint32 &colorsetwarning, guint32 &colorseterror) +void InkscapePreferences::get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, + guint32 &colorsetwarning, guint32 &colorseterror) { using namespace Inkscape::IO::Resource; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -787,7 +789,8 @@ void InkscapePreferences::themeIconsColors() } } -void InkscapePreferences::changeIconsColors() { +void InkscapePreferences::changeIconsColors() +{ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (!prefs->getBool("/theme/symbolicDefaultColors", true)) { Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); @@ -811,14 +814,16 @@ void InkscapePreferences::changeIconsColors() { try { INKSCAPE.colorizeprovider->load_from_data(css_str); } catch (const Gtk::CssProviderError &ex) { - g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), ex.what().c_str()); + g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), + ex.what().c_str()); } Gtk::StyleContext::add_provider_for_screen(screen, INKSCAPE.colorizeprovider, - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } } -void InkscapePreferences::toggleSymbolic() { +void InkscapePreferences::toggleSymbolic() +{ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Gtk::Window *window = SP_ACTIVE_DESKTOP->getToplevel(); if (prefs->getBool("/theme/symbolicIcons", false)) { @@ -1105,7 +1110,8 @@ void InkscapePreferences::initPageUI() _symbolic_base_colors.init(_("Use default colors for icons"), "/theme/symbolicDefaultColors", true); _symbolic_base_colors.signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::resetIconsColors)); _page_theme.add_line(true, "", _symbolic_base_colors, "", "", true); - _symbolic_base_color.init(_("Color for symbolic icons:"), "/theme/" + themeiconname + "/symbolicBaseColor", 0x2E3436ff); + _symbolic_base_color.init(_("Color for symbolic icons:"), "/theme/" + themeiconname + "/symbolicBaseColor", + 0x2E3436ff); _symbolic_success_color.init(_("Color for symbolic success icons:"), "/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff); _symbolic_warning_color.init(_("Color for symbolic warning icons:"), @@ -1135,8 +1141,9 @@ void InkscapePreferences::initPageUI() icon_buttons_hight->pack_start(_symbolic_success_color, true, true, 4); icon_buttons_hight->pack_start(_symbolic_warning_color, true, true, 4); icon_buttons_hight->pack_start(_symbolic_error_color, true, true, 4); - _page_theme.add_line(false,"", *icon_buttons_hight, _("Highlights"), - _("Highlights colors, some symbolic icon themes use it. Some icons changes need reload"), false); + _page_theme.add_line(false, "", *icon_buttons_hight, _("Highlights"), + _("Highlights colors, some symbolic icon themes use it. Some icons changes need reload"), + false); Gtk::Box *icon_buttons_def = Gtk::manage(new Gtk::Box()); _theme_decide_color.set_label(_("Theme default colors")); _theme_decide_color.set_tooltip_text(_("Defaul colors from theme)")); @@ -1144,7 +1151,8 @@ void InkscapePreferences::initPageUI() icon_buttons_def->pack_start(_theme_decide_color, true, true, 4); resetIconsColors(); _page_theme.add_line(false, "", *icon_buttons_def, "", - _("Reset theme colors, some symbolic icon themes use it. Some icons changes need reload"), false); + _("Reset theme colors, some symbolic icon themes use it. Some icons changes need reload"), + false); { Glib::ustring sizeLabels[] = { C_("Icon size", "Larger"), C_("Icon size", "Large"), C_("Icon size", "Small"), C_("Icon size", "Smaller") }; diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index beb49fa84..592877796 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -599,7 +599,8 @@ private: void resetIconsColors(); void themeIconsColors(); void changeIconsColor(guint32 /*color*/) { changeIconsColors(); } - void get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, guint32 &colorsetwarning, guint32 &colorseterror); + void get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, guint32 &colorsetwarning, + guint32 &colorseterror); InkscapePreferences(); InkscapePreferences(InkscapePreferences const &d); diff --git a/src/ui/icon-loader.cpp b/src/ui/icon-loader.cpp index a94dd0be1..68d3b6beb 100644 --- a/src/ui/icon-loader.cpp +++ b/src/ui/icon-loader.cpp @@ -70,8 +70,10 @@ Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) if (!prefs->getBool("/theme/symbolicDefaultColors", true)) { Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); guint32 colorsetbase = prefs->getInt("/theme/" + themeiconname + "/symbolicBaseColor", 0x2E3436ff); - guint32 colorsetsuccess = prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff); - guint32 colorsetwarning = prefs->getInt("/theme/" + themeiconname + "/symbolicWarningColor", 0xF57900ff); + guint32 colorsetsuccess = + prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff); + guint32 colorsetwarning = + prefs->getInt("/theme/" + themeiconname + "/symbolicWarningColor", 0xF57900ff); guint32 colorseterror = prefs->getInt("/theme/" + themeiconname + "/symbolicErrorColor", 0xcc0000ff); gchar colornamed[64]; gchar colornamedsuccess[64]; diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index 4b8febce0..692d216c7 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -66,16 +66,11 @@ void ColorPicker::setupDialog(const Glib::ustring &title) _colorSelectorDialog.get_content_area()->pack_start ( *_color_selector, true, true, 0); _color_selector->show(); - } -void ColorPicker::setTransientFor(Glib::RefPtr<Gdk::Window> transientwindow) { - _transientwindow = transientwindow; -} +void ColorPicker::setTransientFor(Glib::RefPtr<Gdk::Window> transientwindow) { _transientwindow = transientwindow; } -void ColorPicker::setSensitive(bool sensitive) { - set_sensitive(sensitive); -} +void ColorPicker::setSensitive(bool sensitive) { set_sensitive(sensitive); } void ColorPicker::setRgba32 (guint32 rgba) { |
