diff options
| -rw-r--r-- | share/ui/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | share/ui/Makefile.am | 1 | ||||
| -rw-r--r-- | share/ui/style.css | 55 | ||||
| -rw-r--r-- | src/main.cpp | 34 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 1 | ||||
| -rw-r--r-- | src/widgets/ruler.cpp | 15 |
6 files changed, 92 insertions, 16 deletions
diff --git a/share/ui/CMakeLists.txt b/share/ui/CMakeLists.txt index 89b9f9b0f..5e9db74cf 100644 --- a/share/ui/CMakeLists.txt +++ b/share/ui/CMakeLists.txt @@ -1,3 +1,3 @@ -file(GLOB _FILES "*.xml" "*.rc") +file(GLOB _FILES "*.xml" "*.rc" "*.css") install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/ui) diff --git a/share/ui/Makefile.am b/share/ui/Makefile.am index 7195af0cb..1e55ea58f 100644 --- a/share/ui/Makefile.am +++ b/share/ui/Makefile.am @@ -4,6 +4,7 @@ uidir = $(datadir)/inkscape/ui ui_DATA = \ keybindings.rc \ menus-bars.xml \ + style.css \ toolbox.xml \ units.xml diff --git a/share/ui/style.css b/share/ui/style.css new file mode 100644 index 000000000..41b8ba426 --- /dev/null +++ b/share/ui/style.css @@ -0,0 +1,55 @@ + +/* GTK3 WIDGET STYLING */ + +/* + * Keep in order of: + * General -> Specific + * Order of default appearance + * Top -> Bottom (e.g. Selector Tool, Node Tool, ...) + * Left -> Right + * + * We need a standardized naming scheme. + */ + +/* Lightest to darkest based on linear rgb */ +@define-color bg_color0 #ffffff; /* White */ +@define-color bg_color05 #f8f8f8; /* Slightly off white */ +@define-color bg_color1 #f0f0f0; +@define-color bg_color2 #e0e0e0; +@define-color bg_color3 #d0d0d0; +@define-color bg_color4 #bbbbbb; /* 50% Gray */ +@define-color bg_color5 #a5a5a5; +@define-color bg_color6 #898989; +@define-color bg_color7 #636363; +@define-color bg_color8 #000000; /* Black */ + +GtkWidget { +/* font-size: 12pt; */ +} + +SPRuler { + background-color: @bg_color05; +} + +SPCanvas { + background-color: @bg_color0; +} + +combobox window.popup scrolledwindow treeview separator { + -GtkWidget-wide-separators: true; + -GtkWidget-separator-height: 6; +} + +#font_selector_family { + -GtkWidget-wide-separators: true; + -GtkWidget-separator-height: 6; +} + +#TextFontFamilyAction_combobox { + -GtkComboBox-appears-as-list: true; +} + +#guides_lock { + padding: 0; +} + diff --git a/src/main.cpp b/src/main.cpp index 840643a90..99e3ccfe6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,6 +52,11 @@ #include <glib-object.h> #include <gtk/gtk.h> +#if GTK_CHECK_VERSION(3,0,0) +#include <gtkmm/cssprovider.h> +#include <gdkmm/screen.h> +#endif + #include "inkgc/gc-core.h" #ifdef AND @@ -1051,6 +1056,35 @@ sp_main_gui(int argc, char const **argv) #endif g_free(usericondir); + +#if GTK_CHECK_VERSION(3,0,0) + // Add style sheet (GTK3) + Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default(); + + Glib::ustring inkscape_style = INKSCAPE_UIDIR; + inkscape_style += "/style.css"; + // std::cout << "CSS Stylesheet Inkscape: " << inkscape_style << std::endl; + Glib::RefPtr<Gtk::CssProvider> provider = Gtk::CssProvider::create(); + try { + provider->load_from_path (inkscape_style); + } + catch (const Gtk::CssProviderError& ex) + { + std::cerr << "CSSProviderError::load_from_path(): failed to load: " << inkscape_style << "\n (" << ex.what() << ")" << std::endl; + } + Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + Glib::ustring user_style = Inkscape::Application::profile_path("ui/style.css"); + // std::cout << "CSS Stylesheet User: " << user_style << std::endl; + Glib::RefPtr<Gtk::CssProvider> provider2 = Gtk::CssProvider::create(); + try { + provider2->load_from_path (user_style); + } + catch (const Gtk::CssProviderError& ex) + {} + Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); +#endif + gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); Inkscape::Debug::log_display_config(); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index fe724a964..1a4fcccf4 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -404,6 +404,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) Glib::RefPtr<Gtk::CssProvider> guides_lock_style_provider = Gtk::CssProvider::create(); guides_lock_style_provider->load_from_data("GtkWidget { padding-left: 0; padding-right: 0; padding-top: 0; padding-bottom: 0; }"); Gtk::Widget * wnd = Glib::wrap(dtw->guides_lock); + wnd->set_name("guides_lock"); Glib::RefPtr<Gtk::StyleContext> context = wnd->get_style_context(); context->add_provider(guides_lock_style_provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); #endif diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 5c715b0be..bcab535f9 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -282,21 +282,6 @@ sp_ruler_init (SPRuler *ruler) priv->pos_redraw_idle_id = 0; priv->font_scale = DEFAULT_RULER_FONT_SCALE; - -#if GTK_CHECK_VERSION(3,0,0) - // Hard code off-white for the moment. Where is @bg_color defined? - const gchar *str = - "SPRuler {\n" -// " background-color: @bg_color;\n" - " background-color: #f8f8f8;\n" - "}\n"; - GtkCssProvider *css = gtk_css_provider_new (); - gtk_css_provider_load_from_data (css, str, -1, NULL); - gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (ruler)), - GTK_STYLE_PROVIDER (css), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (css); -#endif } static void |
