diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-10-04 08:06:18 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-10-04 08:06:18 +0000 |
| commit | fec1be463b3950772422da45fe4655de40c864e7 (patch) | |
| tree | 2eeef78cb15a7fba9453cfc9c12067c0331818d5 /src/ui/widget | |
| parent | update based on patch 'changes_2012_09_27b.patch' (diff) | |
| parent | extensions. Extrude. allow selection of multiple objects (Bug 1055155) (diff) | |
| download | inkscape-fec1be463b3950772422da45fe4655de40c864e7.tar.gz inkscape-fec1be463b3950772422da45fe4655de40c864e7.zip | |
merge from trunk (r11734)
(bzr r11668.1.22)
Diffstat (limited to 'src/ui/widget')
| -rw-r--r-- | src/ui/widget/gimpspinscale.c | 9 | ||||
| -rw-r--r-- | src/ui/widget/panel.cpp | 14 | ||||
| -rw-r--r-- | src/ui/widget/panel.h | 6 | ||||
| -rw-r--r-- | src/ui/widget/selected-style.cpp | 70 | ||||
| -rw-r--r-- | src/ui/widget/selected-style.h | 9 |
5 files changed, 61 insertions, 47 deletions
diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index 1b7ac7bfe..df39b9644 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -432,7 +432,11 @@ static gboolean gdk_cairo_region (cr, event->region); cairo_clip (cr); +#if GTK_CHECK_VERSION(2, 24,0) w = gdk_window_get_width (event->window); +#else + gdk_drawable_get_size (event->window, &w, NULL); +#endif #endif @@ -682,7 +686,12 @@ gimp_spin_scale_change_value (GtkWidget *widget, gint width; gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); + +#if GTK_CHECK_VERSION(2, 24,0) width = gdk_window_get_width (text_window); +#else + gdk_drawable_get_size (text_window, &width, NULL); +#endif #endif diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 1f945ada6..42435f298 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -572,21 +572,21 @@ void Panel::_apply() g_warning("Apply button clicked for panel [Panel::_apply()]"); } -Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id) +Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id, bool pack_start) { Gtk::Button *button = new Gtk::Button(button_text); - _addResponseButton(button, response_id); + _addResponseButton(button, response_id, pack_start); return button; } -Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id) +Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id, bool pack_start) { Gtk::Button *button = new Gtk::Button(stock_id); - _addResponseButton(button, response_id); + _addResponseButton(button, response_id, pack_start); return button; } -void Panel::_addResponseButton(Gtk::Button *button, int response_id) +void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_start) { // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { @@ -597,6 +597,10 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id) _action_area->pack_end(*button); + if (pack_start) { + _action_area->set_child_secondary( *button , true); + } + if (response_id != 0) { // Re-emit clicked signals as response signals button->signal_clicked().connect(sigc::bind(_signal_response.make_slot(), response_id)); diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 2d92d65c9..b4cc04809 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -96,8 +96,8 @@ public: /* Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE * signals on click. */ - Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id); - Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id); + Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id, bool pack_start=false); + Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id, bool pack_start=false); void setDefaultResponse(int response_id); void setResponseSensitive(int response_id, bool setting); @@ -119,7 +119,7 @@ protected: virtual void _handleResponse(int response_id); /* Helper methods */ - void _addResponseButton(Gtk::Button *button, int response_id); + void _addResponseButton(Gtk::Button *button, int response_id, bool pack_start=false); Inkscape::Selection *_getSelection(); /** diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index a4313f677..e5992958b 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -23,6 +23,7 @@ #include "desktop-handles.h" #include "style.h" #include "desktop-style.h" +#include "sp-namedview.h" #include "sp-linear-gradient-fns.h" #include "sp-radial-gradient-fns.h" #include "sp-pattern.h" @@ -38,7 +39,6 @@ #include "sp-gradient.h" #include "svg/svg-color.h" #include "svg/css-ostringstream.h" -#include "helper/units.h" #include "event-context.h" #include "message-context.h" #include "verbs.h" @@ -144,10 +144,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_blocked (false), - _popup_px(_sw_group), - _popup_pt(_sw_group), - _popup_mm(_sw_group), - + _unit_mis(NULL), _sw_unit(NULL) { _drop[0] = _drop[1] = 0; @@ -298,34 +295,39 @@ SelectedStyle::SelectedStyle(bool /*layout*/) } { - _popup_px.add(*(new Gtk::Label(_("px"), 0.0, 0.5))); - _popup_px.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_popup_px)); - _popup_sw.attach(_popup_px, 0,1, 0,1); - - _popup_pt.add(*(new Gtk::Label(_("pt"), 0.0, 0.5))); - _popup_pt.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_popup_pt)); - _popup_sw.attach(_popup_pt, 0,1, 1,2); - - _popup_mm.add(*(new Gtk::Label(_("mm"), 0.0, 0.5))); - _popup_mm.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_popup_mm)); - _popup_sw.attach(_popup_mm, 0,1, 2,3); + int row = 0; + + // List of units should match with Fill/Stroke dialog stroke style width list + for (GSList *l = sp_unit_get_list(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE); l != NULL; l = l->next) { + SPUnit const *u = (SPUnit*)l->data; + Gtk::RadioMenuItem *mi = Gtk::manage(new Gtk::RadioMenuItem(_sw_group)); + mi->add(*(new Gtk::Label(u->abbr, 0.0, 0.5))); + _unit_mis = g_slist_append(_unit_mis, mi); + mi->signal_activate().connect(sigc::bind<SPUnitId>(sigc::mem_fun(*this, &SelectedStyle::on_popup_units), u->unit_id)); + _popup_sw.attach(*mi, 0,1, row, row+1); + row++; + } - _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, 3,4); + _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, row, row+1); + row++; for (guint i = 0; i < G_N_ELEMENTS(_sw_presets_str); ++i) { Gtk::MenuItem *mi = Gtk::manage(new Gtk::MenuItem()); mi->add(*(new Gtk::Label(_sw_presets_str[i], 0.0, 0.5))); mi->signal_activate().connect(sigc::bind<int>(sigc::mem_fun(*this, &SelectedStyle::on_popup_preset), i)); - _popup_sw.attach(*mi, 0,1, 4+i, 5+i); + _popup_sw.attach(*mi, 0,1, row, row+1); + row++; } - guint i = G_N_ELEMENTS(_sw_presets_str) + 5; - - _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, i,i+1); + _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, row, row+1); + row++; _popup_sw_remove.add(*(new Gtk::Label(_("Remove"), 0.0, 0.5))); _popup_sw_remove.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_stroke_remove)); - _popup_sw.attach(_popup_sw_remove, 0,1, i+1,i+2); + _popup_sw.attach(_popup_sw_remove, 0,1, row, row+1); + row++; + + sp_set_font_size_smaller (GTK_WIDGET(_popup_sw.gobj())); _popup_sw.show_all(); } @@ -447,7 +449,17 @@ SelectedStyle::setDesktop(SPDesktop *desktop) this ) )); - //_sw_unit = (SPUnit *) sp_desktop_namedview(desktop)->doc_units; + _sw_unit = (SPUnit *) sp_desktop_namedview(desktop)->doc_units; + + // Set the doc default unit active in the units list + gint length = g_slist_length(_unit_mis); + for (int i = 0; i < length; i++) { + Gtk::RadioMenuItem *mi = (Gtk::RadioMenuItem *) g_slist_nth_data(_unit_mis, i); + if (mi && mi->get_label() == Glib::ustring(_sw_unit->abbr)) { + mi->set_active(); + break; + } + } } void SelectedStyle::dragDataReceived( GtkWidget */*widget*/, @@ -887,16 +899,8 @@ SelectedStyle::on_opacity_click(GdkEventButton *event) return false; } -void SelectedStyle::on_popup_px() { - _sw_unit = (SPUnit *) &(sp_unit_get_by_id(SP_UNIT_PX)); - update(); -} -void SelectedStyle::on_popup_pt() { - _sw_unit = (SPUnit *) &(sp_unit_get_by_id(SP_UNIT_PT)); - update(); -} -void SelectedStyle::on_popup_mm() { - _sw_unit = (SPUnit *) &(sp_unit_get_by_id(SP_UNIT_MM)); +void SelectedStyle::on_popup_units(SPUnitId id) { + _sw_unit = (SPUnit *) &(sp_unit_get_by_id(id)); update(); } diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 542983b53..a9e9d7274 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -27,6 +27,7 @@ #include <sigc++/sigc++.h> #include "rotateable.h" +#include "helper/units.h" class SPDesktop; class SPUnit; @@ -250,12 +251,8 @@ protected: Gtk::Menu _popup_sw; Gtk::RadioButtonGroup _sw_group; - Gtk::RadioMenuItem _popup_px; - void on_popup_px(); - Gtk::RadioMenuItem _popup_pt; - void on_popup_pt(); - Gtk::RadioMenuItem _popup_mm; - void on_popup_mm(); + GSList *_unit_mis; + void on_popup_units(SPUnitId id); void on_popup_preset(int i); Gtk::MenuItem _popup_sw_remove; |
