diff options
| author | Moritz Eberl <moritz@semiodesk.com> | 2016-04-16 17:24:08 +0000 |
|---|---|---|
| committer | Moritz Eberl <moritz@semiodesk.com> | 2016-04-16 17:24:08 +0000 |
| commit | 69cb9b68955f341000342bcf3b90cfd4c41a1fd8 (patch) | |
| tree | b6061c25987d6300bd03189c03259d66bab7c0b6 /src/widgets | |
| parent | Added Sebastian Faubels helper scripts for windows. (diff) | |
| parent | CMake build: builds with WITH_DBUS (diff) | |
| download | inkscape-69cb9b68955f341000342bcf3b90cfd4c41a1fd8.tar.gz inkscape-69cb9b68955f341000342bcf3b90cfd4c41a1fd8.zip | |
merge and fixed build
(bzr r14761.1.11)
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/widgets/Makefile_insert | 2 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 5 | ||||
| -rw-r--r-- | src/widgets/font-selector.cpp | 17 | ||||
| -rw-r--r-- | src/widgets/icon.cpp | 6 | ||||
| -rw-r--r-- | src/widgets/shrink-wrap-button.cpp | 65 | ||||
| -rw-r--r-- | src/widgets/shrink-wrap-button.h | 35 | ||||
| -rw-r--r-- | src/widgets/spw-utilities.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/text-toolbar.cpp | 18 |
9 files changed, 46 insertions, 106 deletions
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 8cb6e947f..225afe317 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -38,7 +38,6 @@ set(widgets_SRC paint-selector.cpp ruler.cpp select-toolbar.cpp - shrink-wrap-button.cpp sp-attribute-widget.cpp sp-color-selector.cpp sp-widget.cpp @@ -94,7 +93,6 @@ set(widgets_SRC paint-selector.h ruler.h select-toolbar.h - shrink-wrap-button.h sp-attribute-widget.h sp-color-selector.h sp-widget.h diff --git a/src/widgets/Makefile_insert b/src/widgets/Makefile_insert index 2ee0f7002..c9f04de14 100644 --- a/src/widgets/Makefile_insert +++ b/src/widgets/Makefile_insert @@ -72,8 +72,6 @@ ink_common_sources += \ widgets/ruler.h \ widgets/select-toolbar.cpp \ widgets/select-toolbar.h \ - widgets/shrink-wrap-button.cpp \ - widgets/shrink-wrap-button.h \ widgets/spray-toolbar.cpp \ widgets/spray-toolbar.h \ widgets/spiral-toolbar.cpp \ diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 759be551f..fe724a964 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1698,8 +1698,11 @@ void SPDesktopWidget::setToolboxPosition(Glib::ustring const& id, GtkPositionTyp case GTK_POS_TOP: case GTK_POS_BOTTOM: if ( gtk_widget_is_ancestor(toolbox, hbox) ) { + // Removing a widget can reduce ref count to zero + g_object_ref(G_OBJECT(toolbox)); gtk_container_remove(GTK_CONTAINER(hbox), toolbox); gtk_container_add(GTK_CONTAINER(vbox), toolbox); + g_object_unref(G_OBJECT(toolbox)); gtk_box_set_child_packing(GTK_BOX(vbox), toolbox, FALSE, TRUE, 0, GTK_PACK_START); } ToolboxFactory::setOrientation(toolbox, GTK_ORIENTATION_HORIZONTAL); @@ -1707,8 +1710,10 @@ void SPDesktopWidget::setToolboxPosition(Glib::ustring const& id, GtkPositionTyp case GTK_POS_LEFT: case GTK_POS_RIGHT: if ( !gtk_widget_is_ancestor(toolbox, hbox) ) { + g_object_ref(G_OBJECT(toolbox)); gtk_container_remove(GTK_CONTAINER(vbox), toolbox); gtk_container_add(GTK_CONTAINER(hbox), toolbox); + g_object_unref(G_OBJECT(toolbox)); gtk_box_set_child_packing(GTK_BOX(hbox), toolbox, FALSE, TRUE, 0, GTK_PACK_START); if (pos == GTK_POS_LEFT) { gtk_box_reorder_child( GTK_BOX(hbox), toolbox, 0 ); diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 943434868..aefcb2e81 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -159,9 +159,24 @@ static void sp_font_selector_init(SPFontSelector *fsel) /* Muck with style, see text-toolbar.cpp */ gtk_widget_set_name( GTK_WIDGET(fsel->family_treeview), "font_selector_family" ); + +#if GTK_CHECK_VERSION(3,0,0) + GtkCssProvider *css_provider = gtk_css_provider_new(); + gtk_css_provider_load_from_data(css_provider, + "#font_selector_family {\n" + " -GtkWidget-wide-separators: true;\n" + " -GtkWidget-separator-height: 6;\n" + "}\n", + -1, NULL); + + GdkScreen *screen = gdk_screen_get_default(); + gtk_style_context_add_provider_for_screen(screen, + GTK_STYLE_PROVIDER(css_provider), + GTK_STYLE_PROVIDER_PRIORITY_USER); +#else gtk_rc_parse_string ( "widget \"*font_selector_family\" style \"fontfamily-separator-style\""); - +#endif Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance(); Glib::RefPtr<Gtk::ListStore> store = fontlister->get_font_list(); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index f998cd66d..010b3a6fb 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -280,7 +280,13 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr) GtkAllocation allocation; GtkRequisition requisition; gtk_widget_get_allocation(widget, &allocation); + +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_preferred_size(widget, &requisition, NULL); +#else gtk_widget_get_requisition(widget, &requisition); +#endif + int x = floor(allocation.x + ((allocation.width - requisition.width) * 0.5)); int y = floor(allocation.y + ((allocation.height - requisition.height) * 0.5)); int width = gdk_pixbuf_get_width(image); diff --git a/src/widgets/shrink-wrap-button.cpp b/src/widgets/shrink-wrap-button.cpp deleted file mode 100644 index 941a0466c..000000000 --- a/src/widgets/shrink-wrap-button.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Inkscape::Widgets::shrink_wrap_button - shrink a button to minimum size - * - * Authors: - * MenTaLguY <mental@rydia.net> - * - * Copyright (C) 2004 MenTaLguY - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gtkmm/button.h> -#include <gtk/gtk.h> - -#include "shrink-wrap-button.h" - -namespace Inkscape { -namespace Widgets { - -void shrink_wrap_button(Gtk::Button &button) { - button.set_border_width(0); - button.set_can_focus(false); - button.set_can_default(false); - - Gtk::Widget* child = button.get_child(); - Gtk::Requisition req_min; - - if (child) { -#if WITH_GTKMM_3_0 - Gtk::Requisition req_nat; - child->get_preferred_size(req_min, req_nat); -#else - req_min = child->size_request(); -#endif - } else { - req_min.width = 0; - req_min.height = 0; - } - - // TODO: Use Gtk::StyleContext instead - GtkStyle* style = gtk_widget_get_style(GTK_WIDGET(button.gobj())); - - req_min.width += 2 + 2 * std::max(2, style->xthickness); - req_min.height += 2 + 2 * std::max(2, style->ythickness); - - button.set_size_request(req_min.width, req_min.height); -} - -} -} - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/shrink-wrap-button.h b/src/widgets/shrink-wrap-button.h deleted file mode 100644 index ca9153aea..000000000 --- a/src/widgets/shrink-wrap-button.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Inkscape::Widgets::shrink_wrap_button - shrink a button to minimum size - * - * Authors: - * MenTaLguY <mental@rydia.net> - * - * Copyright (C) 2004 MenTaLguY - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#ifndef SEEN_INKSCAPE_WIDGETS_SHRINK_WRAP_BUTTON_H -#define SEEN_INKSCAPE_WIDGETS_SHRINK_WRAP_BUTTON_H - -namespace Gtk { class Button; } - -namespace Inkscape { -namespace Widgets { - -void shrink_wrap_button(Gtk::Button &button); - -} -} - -#endif -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index 89ab76585..5500e1068 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -94,9 +94,9 @@ spw_label_old(GtkWidget *table, const gchar *label_text, int col, int row) gtk_widget_show (label_widget); #if GTK_CHECK_VERSION(3,0,0) +#if GTK_CHECK_VERSION(3,12,0) gtk_widget_set_margin_start(label_widget, 4); gtk_widget_set_margin_end(label_widget, 4); -#if GTK_CHECK_VERSION(3,12,0) #else gtk_widget_set_margin_left(label_widget, 4); gtk_widget_set_margin_right(label_widget, 4); diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 661fc6fa9..23acb74af 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -1562,6 +1562,23 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje g_object_set_data( holder, "TextFontFamilyAction", act ); // Change style of drop-down from menu to list +#if GTK_CHECK_VERSION(3,0,0) + GtkCssProvider *css_provider = gtk_css_provider_new(); + gtk_css_provider_load_from_data(css_provider, + "#TextFontFamilyAction_combobox {\n" + " -GtkComboBox-appears-as-list: true;\n" + "}\n" + "combobox window.popup scrolledwindow treeview separator {\n" + " -GtkWidget-wide-separators: true;\n" + " -GtkWidget-separator-height: 6;\n" + "}\n", + -1, NULL); + + GdkScreen *screen = gdk_screen_get_default(); + gtk_style_context_add_provider_for_screen(screen, + GTK_STYLE_PROVIDER(css_provider), + GTK_STYLE_PROVIDER_PRIORITY_USER); +#else gtk_rc_parse_string ( "style \"dropdown-as-list-style\"\n" "{\n" @@ -1574,6 +1591,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje " GtkWidget::separator-height = 6\n" "}\n" "widget \"*gtk-combobox-popup-window.GtkScrolledWindow.GtkTreeView\" style \"fontfamily-separator-style\""); +#endif } /* Font size */ |
