diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-07-21 22:19:53 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-07-21 22:19:53 +0000 |
| commit | 34d08da015358e09229ebd7f01744432901bdc47 (patch) | |
| tree | 5766107cc843557a0fab0c9bda889311ba41d9fc | |
| parent | Fixing some icons dont redraw (diff) | |
| download | inkscape-34d08da015358e09229ebd7f01744432901bdc47.tar.gz inkscape-34d08da015358e09229ebd7f01744432901bdc47.zip | |
Fixing coding style
| -rw-r--r-- | src/desktop.cpp | 3 | ||||
| -rw-r--r-- | src/helper/icon-loader.cpp | 25 | ||||
| -rw-r--r-- | src/helper/icon-loader.h | 8 | ||||
| -rw-r--r-- | src/inkscape.cpp | 12 | ||||
| -rw-r--r-- | src/inkscape.h | 2 | ||||
| -rw-r--r-- | src/io/resource.cpp | 13 | ||||
| -rw-r--r-- | src/io/resource.h | 14 | ||||
| -rw-r--r-- | src/live_effects/parameter/togglebutton.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 152 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 12 | ||||
| -rw-r--r-- | src/ui/interface.cpp | 19 | ||||
| -rw-r--r-- | src/ui/interface.h | 2 | ||||
| -rw-r--r-- | src/ui/widget/anchor-selector.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/preferences-widget.cpp | 23 | ||||
| -rw-r--r-- | src/ui/widget/preferences-widget.h | 10 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.h | 53 |
17 files changed, 164 insertions, 194 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index 8becdef55..7b72524cc 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1573,8 +1573,7 @@ SPDesktop::onResized (double /*x*/, double /*y*/) /** * Redraw callback; queues Gtk redraw; connected by View. */ -void -SPDesktop::storeDesktopPosition() +void SPDesktop::storeDesktopPosition() { if (main) { _widget->storeDesktopPosition(); diff --git a/src/helper/icon-loader.cpp b/src/helper/icon-loader.cpp index 3a7d459b3..e514343a3 100644 --- a/src/helper/icon-loader.cpp +++ b/src/helper/icon-loader.cpp @@ -45,13 +45,11 @@ Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) if (icon_name == "gtk-preferences") { icon_name = "preferences-system"; } - sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", - 0x000000ff)); - Gdk::RGBA color; - color.set(colornamed); + sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", 0x000000ff)); + Gdk::RGBA color; + color.set(colornamed); Gtk::IconInfo iconinfo = - iconTheme->lookup_icon(icon_name + Glib::ustring("-symbolic"), size, - Gtk::ICON_LOOKUP_FORCE_SIZE); + iconTheme->lookup_icon(icon_name + Glib::ustring("-symbolic"), size, Gtk::ICON_LOOKUP_FORCE_SIZE); if (bool(iconinfo)) { // TODO: view if we need parametrice other colors bool was_symbolic = false; @@ -123,20 +121,21 @@ Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_size) return image; } -std::pair<Glib::RefPtr<Gtk::RadioAction>, Gdk::RGBA > sp_set_radioaction_icon(Gtk::RadioAction::Group group, Glib::ustring icon_name, Glib::ustring label, Glib::ustring tooltip) +std::pair<Glib::RefPtr<Gtk::RadioAction>, Gdk::RGBA> sp_set_radioaction_icon(Gtk::RadioAction::Group group, + Glib::ustring icon_name, + Glib::ustring label, Glib::ustring tooltip) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/theme/symbolicIcons", false)) { icon_name = icon_name + Glib::ustring("-symbolic"); } - + Glib::RefPtr<Gtk::RadioAction> action = - Gtk::RadioAction::create_with_icon_name (group, "Anonymous", icon_name.c_str(), label.c_str(), tooltip.c_str()); - Gtk::ToolItem* item = action->create_tool_item(); - Gdk::RGBA color; + Gtk::RadioAction::create_with_icon_name(group, "Anonymous", icon_name.c_str(), label.c_str(), tooltip.c_str()); + Gtk::ToolItem *item = action->create_tool_item(); + Gdk::RGBA color; gchar colornamed[64]; - sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", - 0x000000ff)); + sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", 0x000000ff)); color.set(colornamed); return std::make_pair(action, color); } diff --git a/src/helper/icon-loader.h b/src/helper/icon-loader.h index ef7dbd110..02b748163 100644 --- a/src/helper/icon-loader.h +++ b/src/helper/icon-loader.h @@ -11,9 +11,8 @@ * */ #include <gdkmm/pixbuf.h> -#include <gtkmm/image.h> #include <gtkmm/box.h> -#include <gtkmm/radioaction.h> +#include <gtkmm/image.h> #include <gtkmm/radioaction.h> Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size); @@ -24,5 +23,8 @@ Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gint size); Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_sice); Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_sice); Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_sice); -std::pair<Glib::RefPtr<Gtk::RadioAction>,Gdk::RGBA > sp_set_radioaction_icon(Gtk::RadioAction::Group group, Glib::ustring icon_name, Glib::ustring label, Glib::ustring tooltip); +std::pair<Glib::RefPtr<Gtk::RadioAction>, Gdk::RGBA> sp_set_radioaction_icon(Gtk::RadioAction::Group group, + Glib::ustring icon_name, + Glib::ustring label, + Glib::ustring tooltip); #endif // SEEN_INK_STOCK_ITEMS_H diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 13283b03d..9be033494 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -410,8 +410,7 @@ Application::add_style_sheet() #if GTK_CHECK_VERSION(3, 16, 0) // Gtk::CssProviderError not defined until 3.16. 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()); } #else catch (...) { @@ -419,8 +418,8 @@ Application::add_style_sheet() #endif Gtk::StyleContext::add_provider_for_screen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - //we want a tiny file with 3 or 4 lines, so we can loada witout removing context - //is more undertable than record previously applyed + // we want a tiny file with 3 or 4 lines, so we can loada witout removing context + // is more undertable than record previously applyed Glib::ustring style = get_filename(UIS, "style.css"); if (!style.empty()) { auto provider = Gtk::CssProvider::create(); @@ -477,8 +476,9 @@ Application::Application(const char* argv, bool use_gui) : /* Load the preferences and menus */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - g_object_set (gtk_settings_get_default (), "gtk-theme-name", prefs->getString("/theme/gtkTheme").c_str(), NULL); - g_object_set (gtk_settings_get_default (), "gtk-application-prefer-dark-theme", prefs->getBool("/theme/darkTheme", false), NULL); + g_object_set(gtk_settings_get_default(), "gtk-theme-name", prefs->getString("/theme/gtkTheme").c_str(), NULL); + g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", + prefs->getBool("/theme/darkTheme", false), NULL); InkErrorHandler* handler = new InkErrorHandler(use_gui); prefs->setErrorHandler(handler); { diff --git a/src/inkscape.h b/src/inkscape.h index ec9fc9b84..59532b2f6 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -201,7 +201,7 @@ public: void add_style_sheet(); void add_icon_theme(); -private: + private: static Inkscape::Application * _S_inst; Application(const char* argv0, bool use_gui); diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 127b92b76..65fd01d0e 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -318,27 +318,28 @@ void get_filenames_from_path(std::vector<Glib::ustring> &files, Glib::ustring pa * path - The directory to parse, will add nothing if directory doesn't exist * exclusions - Exclude files that exactly match these names. */ -void get_foldernames_from_path(std::vector<Glib::ustring> &folders, Glib::ustring path, std::vector<const char *> exclusions) +void get_foldernames_from_path(std::vector<Glib::ustring> &folders, Glib::ustring path, + std::vector<const char *> exclusions) { - if(!Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { + if (!Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { return; } Glib::Dir dir(path); std::string file = dir.read_name(); - while (!file.empty()){ + while (!file.empty()) { // If not extensions are specified, don't reject ANY files. bool reject = false; // Reject any file which matches the exclusions. - for (auto &exc: exclusions) { - reject |= Glib::str_has_prefix(file, exc); + for (auto &exc : exclusions) { + reject |= Glib::str_has_prefix(file, exc); } // Reject any filename which isn't a regular file Glib::ustring filename = Glib::build_filename(path, file); - if(Glib::file_test(filename, Glib::FILE_TEST_IS_DIR) && !reject) { + if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR) && !reject) { folders.push_back(filename); } file = dir.read_name(); diff --git a/src/io/resource.h b/src/io/resource.h index f70e55447..d86eda51a 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -79,23 +79,19 @@ std::vector<Glib::ustring> get_filenames(Glib::ustring path, std::vector<const char *> extensions={}, std::vector<const char *> exclusions={}); -std::vector<Glib::ustring> get_foldernames(Type type, - std::vector<const char *> exclusions={}); +std::vector<Glib::ustring> get_foldernames(Type type, std::vector<const char *> exclusions = {}); -std::vector<Glib::ustring> get_foldernames(Domain domain, Type type, - std::vector<const char *> exclusions={}); +std::vector<Glib::ustring> get_foldernames(Domain domain, Type type, std::vector<const char *> exclusions = {}); -std::vector<Glib::ustring> get_foldernames(Glib::ustring path, - std::vector<const char *> exclusions={}); +std::vector<Glib::ustring> get_foldernames(Glib::ustring path, std::vector<const char *> exclusions = {}); void get_filenames_from_path(std::vector<Glib::ustring> &files, Glib::ustring path, std::vector<const char *> extensions={}, std::vector<const char *> exclusions={}); -void get_foldernames_from_path(std::vector<Glib::ustring> &files, - Glib::ustring path, - std::vector<const char *> exclusions={}); +void get_foldernames_from_path(std::vector<Glib::ustring> &files, Glib::ustring path, + std::vector<const char *> exclusions = {}); char *profile_path(const char *filename); diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index be75555db..c92e1c437 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -111,7 +111,7 @@ ToggleButtonParam::param_newWidget() } gtk_widget_show(box_button); GtkWidget *icon_button = nullptr; - if(!value){ + if (!value) { icon_button = GTK_WIDGET(sp_get_icon_image(_icon_inactive, _icon_size)); } else { icon_button = GTK_WIDGET(sp_get_icon_image(_icon_active, _icon_size)); @@ -163,7 +163,7 @@ ToggleButtonParam::refresh_button() Gtk::Image *im = dynamic_cast<Gtk::Image*>(children[0]); Gtk::IconSize is(_icon_size); if (!im) return; - if(!value){ + if (!value) { im = sp_get_icon_image(_icon_inactive, is); } else { im = sp_get_icon_image(_icon_active, is); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 7e6e516ae..de6a6e262 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -19,14 +19,14 @@ #include "inkscape-preferences.h" +#include <gio/gio.h> #include <glibmm/i18n.h> -#include <glibmm/miscutils.h> #include <glibmm/markup.h> +#include <glibmm/miscutils.h> +#include <gtk/gtksettings.h> #include <gtkmm/main.h> -#include <gtkmm/recentmanager.h> #include <gtkmm/recentinfo.h> -#include <gtk/gtksettings.h> -#include <gio/gio.h> +#include <gtkmm/recentmanager.h> #include "cms-system.h" #include "document.h" @@ -52,8 +52,8 @@ #include "object/color-profile.h" #include "style.h" -#include "ui/widget/style-swatch.h" #include "ui/interface.h" +#include "ui/widget/style-swatch.h" #ifdef HAVE_ASPELL # include <aspell.h> @@ -340,7 +340,7 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const _("Remember the style of the (first) selected object as this tool's style")); } -//static void changeTheme() +// static void changeTheme() //{ // sp_ui_reload(); //} @@ -580,38 +580,34 @@ void InkscapePreferences::initPageTools() #endif // WITH_LPETOOL } -gchar * _inkscape_get_theme_dir (void) +gchar *_inkscape_get_theme_dir(void) { - const gchar *var; + const gchar *var; - var = g_getenv ("GTK_DATA_PREFIX"); - if (var == NULL) - var = g_getenv ("GTK_PATH"); - return g_build_filename (var, "share", "themes", NULL); + var = g_getenv("GTK_DATA_PREFIX"); + if (var == NULL) + var = g_getenv("GTK_PATH"); + return g_build_filename(var, "share", "themes", NULL); } -static void -_inkscape_fill_gtk (const gchar *path, - GHashTable *t) +static void _inkscape_fill_gtk(const gchar *path, GHashTable *t) { - const gchar *dir_entry; - GDir *dir = g_dir_open (path, 0, NULL); + const gchar *dir_entry; + GDir *dir = g_dir_open(path, 0, NULL); - if (!dir) - return; + if (!dir) + return; - while ((dir_entry = g_dir_read_name (dir))) - { - gchar *filename = g_build_filename (path, dir_entry, "gtk-3.0", "gtk.css", NULL); + while ((dir_entry = g_dir_read_name(dir))) { + gchar *filename = g_build_filename(path, dir_entry, "gtk-3.0", "gtk.css", NULL); - if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) && - !g_hash_table_contains (t, dir_entry)) - g_hash_table_add (t, g_strdup (dir_entry)); + if (g_file_test(filename, G_FILE_TEST_IS_REGULAR) && !g_hash_table_contains(t, dir_entry)) + g_hash_table_add(t, g_strdup(dir_entry)); - g_free (filename); + g_free(filename); } - g_dir_close (dir); + g_dir_close(dir); } @@ -745,8 +741,8 @@ void InkscapePreferences::initPageUI() _("Selects whether the dockbar switcher will show text labels, icons, or both"), false); } - //Theme - _page_theme.add_group_header( _("Theme changes, require restart")); + // Theme + _page_theme.add_group_header(_("Theme changes, require restart")); { GHashTable *t; GHashTableIter iter; @@ -754,54 +750,51 @@ void InkscapePreferences::initPageUI() gchar **builtin_themes; GList *list, *l; guint i; - const gchar * const *dirs; + const gchar *const *dirs; - t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + t = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); /* Builtin themes */ - builtin_themes = g_resources_enumerate_children ("/org/gtk/libgtk/theme", G_RESOURCE_LOOKUP_FLAGS_NONE, NULL); - for (i = 0; builtin_themes[i] != NULL; i++) - { - if (g_str_has_suffix (builtin_themes[i], "/")) - g_hash_table_add (t, g_strndup (builtin_themes[i], strlen (builtin_themes[i]) - 1)); + builtin_themes = g_resources_enumerate_children("/org/gtk/libgtk/theme", G_RESOURCE_LOOKUP_FLAGS_NONE, NULL); + for (i = 0; builtin_themes[i] != NULL; i++) { + if (g_str_has_suffix(builtin_themes[i], "/")) + g_hash_table_add(t, g_strndup(builtin_themes[i], strlen(builtin_themes[i]) - 1)); } - g_strfreev (builtin_themes); + g_strfreev(builtin_themes); - path = _inkscape_get_theme_dir (); - _inkscape_fill_gtk (path, t); - g_free (path); + path = _inkscape_get_theme_dir(); + _inkscape_fill_gtk(path, t); + g_free(path); - path = g_build_filename (g_get_user_data_dir (), "themes", NULL); - _inkscape_fill_gtk (path, t); - g_free (path); + path = g_build_filename(g_get_user_data_dir(), "themes", NULL); + _inkscape_fill_gtk(path, t); + g_free(path); - path = g_build_filename (g_get_home_dir (), ".themes", NULL); - _inkscape_fill_gtk (path, t); - g_free (path); + path = g_build_filename(g_get_home_dir(), ".themes", NULL); + _inkscape_fill_gtk(path, t); + g_free(path); - dirs = g_get_system_data_dirs (); - for (i = 0; dirs[i]; i++) - { - path = g_build_filename (dirs[i], "themes", NULL); - _inkscape_fill_gtk (path, t); - g_free (path); + dirs = g_get_system_data_dirs(); + for (i = 0; dirs[i]; i++) { + path = g_build_filename(dirs[i], "themes", NULL); + _inkscape_fill_gtk(path, t); + g_free(path); } - + list = NULL; - g_hash_table_iter_init (&iter, t); - while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL)) - list = g_list_insert_sorted (list, theme, (GCompareFunc)strcmp); + g_hash_table_iter_init(&iter, t); + while (g_hash_table_iter_next(&iter, (gpointer *)&theme, NULL)) + list = g_list_insert_sorted(list, theme, (GCompareFunc)strcmp); std::vector<Glib::ustring> labels; std::vector<Glib::ustring> values; - for (l = list; l; l = l->next) - { + for (l = list; l; l = l->next) { theme = (gchar *)l->data; labels.push_back(Glib::ustring(theme)); values.push_back(Glib::ustring(theme)); } - g_list_free (list); - g_hash_table_destroy (t); + g_list_free(list); + g_hash_table_destroy(t); _gtk_theme.init("/theme/gtkTheme", labels, values, "Adwaita"); _page_theme.add_line(false, _("Change Gtk theme:"), _gtk_theme, "", "", false); @@ -809,25 +802,24 @@ void InkscapePreferences::initPageUI() { using namespace Inkscape::IO::Resource; - auto files = get_foldernames(ICONS, {"application"}); + auto files = get_foldernames(ICONS, { "application" }); std::vector<Glib::ustring> labels; std::vector<Glib::ustring> values; - for(auto &filename: files) { + for (auto &filename : files) { // from https://stackoverflow.com/questions/8520560/get-a-file-name-from-a-path#8520871 // Maybe we can link boost path utilities // Remove directory if present. // Do this before extension removal incase directory has a period character. const size_t last_slash_idx = filename.find_last_of("\\/"); - if (std::string::npos != last_slash_idx) - { + if (std::string::npos != last_slash_idx) { filename.erase(0, last_slash_idx + 1); } labels.push_back(filename); values.push_back(filename); } - std::sort(labels.begin(), labels.end()); - std::sort(values.begin(), values.end()); + std::sort(labels.begin(), labels.end()); + std::sort(values.begin(), values.end()); labels.erase(unique(labels.begin(), labels.end()), labels.end()); values.erase(unique(values.begin(), values.end()), values.end()); _icon_theme.init("/theme/iconTheme", labels, values, "hicolor"); @@ -841,27 +833,27 @@ void InkscapePreferences::initPageUI() _symbolic_color.init(_("Color for symbolic icons:"), "/theme/symbolicColor", 0x000000ff); _page_theme.add_line(false, _("Color for symbolic icons:"), _symbolic_color, "", "", true); { - Glib::ustring sizeLabels[] = {C_("Icon size", "Larger"), C_("Icon size", "Large"), C_("Icon size", "Small"), C_("Icon size", "Smaller")}; - int sizeValues[] = {3, 0, 1, 2}; + Glib::ustring sizeLabels[] = { C_("Icon size", "Larger"), C_("Icon size", "Large"), C_("Icon size", "Small"), + C_("Icon size", "Smaller") }; + int sizeValues[] = { 3, 0, 1, 2 }; // "Larger" is 3 to not break existing preference files. Should fix in GTK3 - _misc_small_tools.init( "/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); - _page_theme.add_line( false, _("Toolbox icon size:"), _misc_small_tools, "", - _("Set the size for the tool icons (requires restart)"), false); + _misc_small_tools.init("/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0); + _page_theme.add_line(false, _("Toolbox icon size:"), _misc_small_tools, "", + _("Set the size for the tool icons (requires restart)"), false); - _misc_small_toolbar.init( "/toolbox/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); - _page_theme.add_line( false, _("Control bar icon size:"), _misc_small_toolbar, "", - _("Set the size for the icons in tools' control bars to use (requires restart)"), false); + _misc_small_toolbar.init("/toolbox/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0); + _page_theme.add_line(false, _("Control bar icon size:"), _misc_small_toolbar, "", + _("Set the size for the icons in tools' control bars to use (requires restart)"), false); - _misc_small_secondary.init( "/toolbox/secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1 ); - _page_theme.add_line( false, _("Secondary toolbar icon size:"), _misc_small_secondary, "", - _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); + _misc_small_secondary.init("/toolbox/secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1); + _page_theme.add_line(false, _("Secondary toolbar icon size:"), _misc_small_secondary, "", + _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); } Glib::ustring const label = _("Now"); Glib::ustring const tooltip = _("A bit slow process"); - _apply_theme = new UI::Widget::Button(label,tooltip); - _page_theme.add_line( false, _("Apply theme"), *_apply_theme, "", - _("Apply theme"), false); + _apply_theme = new UI::Widget::Button(label, tooltip); + _page_theme.add_line(false, _("Apply theme"), *_apply_theme, "", _("Apply theme"), false); _apply_theme->signal_clicked().connect(sigc::ptr_fun(sp_ui_reload)); this->AddPage(_page_theme, _("Theme"), iter_ui, PREFS_PAGE_UI_THEME); // Windows diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index d172687fa..152ecf6cd 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -240,15 +240,15 @@ protected: UI::Widget::PrefCheckButton _t_node_delete_preserves_shape; UI::Widget::PrefColorPicker _t_node_pathoutline_color; - UI::Widget::PrefCombo _gtk_theme; - UI::Widget::PrefCombo _icon_theme; + UI::Widget::PrefCombo _gtk_theme; + UI::Widget::PrefCombo _icon_theme; UI::Widget::PrefCheckButton _dark_theme; UI::Widget::PrefCheckButton _symbolic_icons; UI::Widget::PrefColorPicker _symbolic_color; - UI::Widget::PrefCombo _misc_small_toolbar; - UI::Widget::PrefCombo _misc_small_secondary; - UI::Widget::PrefCombo _misc_small_tools; - UI::Widget::Button *_apply_theme; + UI::Widget::PrefCombo _misc_small_toolbar; + UI::Widget::PrefCombo _misc_small_secondary; + UI::Widget::PrefCombo _misc_small_tools; + UI::Widget::Button *_apply_theme; UI::Widget::PrefRadioButton _win_dockable; UI::Widget::PrefRadioButton _win_floating; diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 89f2c3d8a..99fbbc23c 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -263,29 +263,28 @@ sp_ui_new_view() sp_namedview_update_layers_from_document(static_cast<SPDesktop*>(dtw->view)); } -void -sp_ui_reload() +void sp_ui_reload() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int window_geometry = prefs->getInt("/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_NONE); - g_object_set (gtk_settings_get_default (), "gtk-theme-name", prefs->getString("/theme/gtkTheme").c_str(), NULL); - g_object_set (gtk_settings_get_default (), "gtk-application-prefer-dark-theme", prefs->getBool("/theme/darkTheme", false), NULL); + g_object_set(gtk_settings_get_default(), "gtk-theme-name", prefs->getString("/theme/gtkTheme").c_str(), NULL); + g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", + prefs->getBool("/theme/darkTheme", false), NULL); prefs->setInt("/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_LAST); prefs->save(); std::list<SPDesktop *> desktops; INKSCAPE.get_all_desktops(desktops); std::list<SPDesktop *>::iterator i = desktops.begin(); - while (i != desktops.end()) - { - SPDesktop * dt = *i; + while (i != desktops.end()) { + SPDesktop *dt = *i; if (dt == nullptr) { ++i; continue; } dt->storeDesktopPosition(); - SPDocument *document; + SPDocument *document; SPViewWidget *dtw; document = dt->getDocument(); @@ -300,8 +299,8 @@ sp_ui_reload() continue; } sp_create_window(dtw, TRUE); - sp_namedview_window_from_document(static_cast<SPDesktop*>(dtw->view)); - sp_namedview_update_layers_from_document(static_cast<SPDesktop*>(dtw->view)); + sp_namedview_window_from_document(static_cast<SPDesktop *>(dtw->view)); + sp_namedview_update_layers_from_document(static_cast<SPDesktop *>(dtw->view)); dt->destroyWidget(); i++; } diff --git a/src/ui/interface.h b/src/ui/interface.h index 90d86bea7..fcaa9801a 100644 --- a/src/ui/interface.h +++ b/src/ui/interface.h @@ -45,7 +45,7 @@ void sp_ui_close_view (GtkWidget *widget); void sp_ui_new_view (); -void sp_ui_reload (); +void sp_ui_reload(); /** * @todo TODO: not yet working. To be re-enabled (by adding to menu) once it works. diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index fc7c15f21..0873f9a84 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -20,7 +20,7 @@ void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& b Gtk::Image *buttonIcon = Gtk::manage(sp_get_icon_image(icon, Gtk::ICON_SIZE_SMALL_TOOLBAR)); buttonIcon->show(); - button.set_relief(Gtk::RELIEF_NONE); + button.set_relief(Gtk::RELIEF_NONE); button.show(); button.add(*buttonIcon); button.set_can_focus(false); diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 09656a800..7e9335a8a 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -634,13 +634,14 @@ void PrefCombo::init(Glib::ustring const &prefs_path, this->set_active(row); } -void PrefCombo::init(Glib::ustring const &prefs_path, - std::vector<Glib::ustring> labels, std::vector<int> values, int default_value) +void PrefCombo::init(Glib::ustring const &prefs_path, std::vector<Glib::ustring> labels, std::vector<int> values, + int default_value) { size_t labels_size = labels.size(); size_t values_size = values.size(); if (values_size != labels_size) { - std::cout << "PrefCombo::" << "Diferent number of values/labels in " << prefs_path << std::endl; + std::cout << "PrefCombo::" + << "Diferent number of values/labels in " << prefs_path << std::endl; return; } _prefs_path = prefs_path; @@ -648,8 +649,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, int row = 0; int value = prefs->getInt(_prefs_path, default_value); - for (int i = 0 ; i < labels_size; ++i) - { + for (int i = 0; i < labels_size; ++i) { this->append(labels[i]); _values.push_back(values[i]); if (value == values[i]) @@ -658,26 +658,25 @@ void PrefCombo::init(Glib::ustring const &prefs_path, this->set_active(row); } -void PrefCombo::init(Glib::ustring const &prefs_path, - std::vector<Glib::ustring> labels, std::vector<Glib::ustring> values, Glib::ustring default_value) +void PrefCombo::init(Glib::ustring const &prefs_path, std::vector<Glib::ustring> labels, + std::vector<Glib::ustring> values, Glib::ustring default_value) { size_t labels_size = labels.size(); size_t values_size = values.size(); if (values_size != labels_size) { - std::cout << "PrefCombo::" << "Diferent number of values/labels in " << prefs_path << std::endl; + std::cout << "PrefCombo::" + << "Diferent number of values/labels in " << prefs_path << std::endl; return; } _prefs_path = prefs_path; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int row = 0; Glib::ustring value = prefs->getString(_prefs_path); - if(value.empty()) - { + if (value.empty()) { value = default_value; } - for (int i = 0 ; i < labels_size; ++i) - { + for (int i = 0; i < labels_size; ++i) { this->append(labels[i]); _ustr_values.push_back(values[i]); if (value == values[i]) diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index f75079c77..5036a1c50 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -185,13 +185,13 @@ public: * Initialize a combo box. * with vectors. */ - void init(Glib::ustring const &prefs_path, - std::vector<Glib::ustring> labels, std::vector<int> values, int default_value); + void init(Glib::ustring const &prefs_path, std::vector<Glib::ustring> labels, std::vector<int> values, + int default_value); - void init(Glib::ustring const &prefs_path, - std::vector<Glib::ustring> labels, std::vector<Glib::ustring> values, Glib::ustring default_value); + void init(Glib::ustring const &prefs_path, std::vector<Glib::ustring> labels, std::vector<Glib::ustring> values, + Glib::ustring default_value); -protected: + protected: Glib::ustring _prefs_path; std::vector<int> _values; std::vector<Glib::ustring> _ustr_values; ///< string key values used optionally instead of numeric _values diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 41a7c41b4..1626655ff 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1202,8 +1202,8 @@ SPDesktopWidget::shutdown() /** * \store dessktop position */ -void -SPDesktopWidget::storeDesktopPosition() { +void SPDesktopWidget::storeDesktopPosition() +{ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool maxed = desktop->is_maximized(); bool full = desktop->is_fullscreen(); diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index d3917a505..40d194bb3 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -163,41 +163,24 @@ struct SPDesktopWidget { _dtw->window = nullptr; } - void storeDesktopPosition() override - { _dtw->storeDesktopPosition(); } - void requestCanvasUpdate() override - { _dtw->requestCanvasUpdate(); } - void requestCanvasUpdateAndWait() override - { _dtw->requestCanvasUpdateAndWait(); } - void enableInteraction() override - { _dtw->enableInteraction(); } - void disableInteraction() override - { _dtw->disableInteraction(); } - void activateDesktop() override - { sp_dtw_desktop_activate (_dtw); } - void deactivateDesktop() override - { sp_dtw_desktop_deactivate (_dtw); } - void updateRulers() override - { sp_desktop_widget_update_rulers (_dtw); } - void updateScrollbars (double scale) override - { sp_desktop_widget_update_scrollbars (_dtw, scale); } - void toggleRulers() override - { sp_desktop_widget_toggle_rulers (_dtw); } - void toggleScrollbars() override - { sp_desktop_widget_toggle_scrollbars (_dtw); } - void toggleColorProfAdjust() override - { sp_desktop_widget_toggle_color_prof_adj(_dtw); } - bool colorProfAdjustEnabled() override - { return sp_desktop_widget_color_prof_adj_enabled(_dtw); } - void updateZoom() override - { sp_desktop_widget_update_zoom (_dtw); } - void letZoomGrabFocus() override - { _dtw->letZoomGrabFocus(); } - void updateRotation() override - { sp_desktop_widget_update_rotation (_dtw); } - void setToolboxFocusTo (const gchar * id) override - { _dtw->setToolboxFocusTo (id); } - void setToolboxAdjustmentValue (const gchar *id, double val) override + void storeDesktopPosition() override { _dtw->storeDesktopPosition(); } + void requestCanvasUpdate() override { _dtw->requestCanvasUpdate(); } + void requestCanvasUpdateAndWait() override { _dtw->requestCanvasUpdateAndWait(); } + void enableInteraction() override { _dtw->enableInteraction(); } + void disableInteraction() override { _dtw->disableInteraction(); } + void activateDesktop() override { sp_dtw_desktop_activate(_dtw); } + void deactivateDesktop() override { sp_dtw_desktop_deactivate(_dtw); } + void updateRulers() override { sp_desktop_widget_update_rulers(_dtw); } + void updateScrollbars(double scale) override { sp_desktop_widget_update_scrollbars(_dtw, scale); } + void toggleRulers() override { sp_desktop_widget_toggle_rulers(_dtw); } + void toggleScrollbars() override { sp_desktop_widget_toggle_scrollbars(_dtw); } + void toggleColorProfAdjust() override { sp_desktop_widget_toggle_color_prof_adj(_dtw); } + bool colorProfAdjustEnabled() override { return sp_desktop_widget_color_prof_adj_enabled(_dtw); } + void updateZoom() override { sp_desktop_widget_update_zoom(_dtw); } + void letZoomGrabFocus() override { _dtw->letZoomGrabFocus(); } + void updateRotation() override { sp_desktop_widget_update_rotation(_dtw); } + void setToolboxFocusTo(const gchar *id) override { _dtw->setToolboxFocusTo(id); } + void setToolboxAdjustmentValue(const gchar *id, double val) override { _dtw->setToolboxAdjustmentValue (id, val); } void setToolboxSelectOneValue (gchar const *id, int val) override { _dtw->setToolboxSelectOneValue (id, val); } |
