diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-10-18 18:06:35 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-10-18 18:06:35 +0000 |
| commit | 9158a2ccc3f6238e3f511d078b4d0ef942f30e9b (patch) | |
| tree | cb4a833c8d624bfb1d36052c8088c4f835cfb031 /src/ui | |
| parent | Fix SVG formatting (EMF import): (diff) | |
| parent | Translations. Latvian translation update by Jānis Eisaks. (diff) | |
| download | inkscape-9158a2ccc3f6238e3f511d078b4d0ef942f30e9b.tar.gz inkscape-9158a2ccc3f6238e3f511d078b4d0ef942f30e9b.zip | |
merge from trunk (r11808)
(bzr r11668.1.30)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/symbols.cpp | 43 | ||||
| -rw-r--r-- | src/ui/previewholder.cpp | 22 | ||||
| -rw-r--r-- | src/ui/previewholder.h | 1 | ||||
| -rw-r--r-- | src/ui/tool/node.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/dock.cpp | 12 |
5 files changed, 57 insertions, 23 deletions
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 21a178b57..82af60fc2 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -435,7 +435,6 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, Inkscape::Drawing* drawing, unsigned /*visionkey*/) { - // Retrieve the symbol named 'symbol_id' from the source SVG document SPObject const* symbol = source->getObjectById(symbol_id); if (symbol == NULL) { @@ -465,6 +464,8 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, style = source->getReprRoot()->attribute("style"); } } + // Last ditch effort to provide some default styling + if( !style ) style = "fill:#bbbbbb;stroke:#808080"; // This is for display in Symbols dialog only if( style ) { @@ -498,15 +499,6 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPItem *item = SP_ITEM(object_temp); - // Find object's bbox in document. - // Note symbols can have own viewport... ignore for now. - //Geom::OptRect dbox = item->geometricBounds(); - Geom::OptRect dbox = item->documentVisualBounds(); - // if (!dbox) { - // //std::cout << " No dbox" << std::endl; - // //return NULL; - // } - Glib::ustring previewSizeString = previewSize->get_active_text(); unsigned psize = atol( previewSizeString.c_str() ); @@ -520,22 +512,40 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, //Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(svg_preview_cache.get_preview_from_cache(key)); Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::RefPtr<Gdk::Pixbuf>(0); + // Find object's bbox in document. + // Note symbols can have own viewport... ignore for now. + //Geom::OptRect dbox = item->geometricBounds(); + Geom::OptRect dbox = item->documentVisualBounds(); + if (!dbox) { + //std::cout << " No dbox" << std::endl; + return pixbuf; + } + if (!pixbuf) { /* Scale symbols to fit */ double scale = 1.0; + double width = dbox->width(); + double height = dbox->height(); + if( width == 0.0 ) { + width = 1.0; + } + if( height == 0.0 ) { + height = 1.0; + } + switch (previewScaleRow) { case 0: /* Fit */ - scale = psize/std::max(dbox->width(),dbox->height()); + scale = psize/std::max(width,height); break; case 1: /* Fit width */ - scale = psize/dbox->width(); + scale = psize/width; break; case 2: /* Fit height */ - scale = psize/dbox->height(); + scale = psize/height; break; default: scale = atof( previewScaleString.c_str() ); @@ -560,8 +570,7 @@ SPDocument* SymbolsDialog::symbols_preview_doc() "<svg xmlns=\"http://www.w3.org/2000/svg\"" " xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"" " xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"" -" xmlns:xlink=\"http://www.w3.org/1999/xlink\"" -" style=\"fill:none;stroke:black;stroke-width:2\">" +" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" " <defs id=\"defs\">" " <symbol id=\"the_symbol\"/>" " </defs>" @@ -582,10 +591,6 @@ void SymbolsDialog::setTargetDesktop(SPDesktop *desktop) } } - } //namespace Dialogs } //namespace UI } //namespace Inkscape - - - diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 0dac18665..0b280ccb9 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -17,6 +17,7 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/sizegroup.h> #include <gtkmm/scrollbar.h> +#include <gtkmm/adjustment.h> #define COLUMNS_FOR_SMALL 16 #define COLUMNS_FOR_LARGE 8 @@ -56,9 +57,30 @@ PreviewHolder::PreviewHolder() : PreviewHolder::~PreviewHolder() { + } +bool PreviewHolder::on_scroll_event(GdkEventScroll *event) +{ + // Scroll horizontally by page on mouse wheel +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> adj = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hadjustment(); +#else + Gtk::Adjustment *adj = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hadjustment(); +#endif + + if (!adj) { + return FALSE; + } + + int move = (event->direction == GDK_SCROLL_DOWN) ? adj->get_page_size() : -adj->get_page_size(); + + double value = std::min(adj->get_upper() - move, adj->get_value() + move ); + adj->set_value(value); + + return FALSE; +} void PreviewHolder::clear() { diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index 8363498a6..4c591bfaf 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -46,6 +46,7 @@ public: protected: virtual void on_size_allocate( Gtk::Allocation& allocation ); + virtual bool on_scroll_event(GdkEventScroll*); // virtual void on_size_request( Gtk::Requisition* requisition ); diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index bda410856..dc6e0fbae 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -293,7 +293,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) Geom::Point parent_pos = _parent->position(); Geom::Point origin = _last_drag_origin(); SnapManager &sm = _desktop->namedview->snap_manager; - bool snap = sm.someSnapperMightSnap(); + bool snap = held_shift(*event) ? false : sm.someSnapperMightSnap(); boost::optional<Inkscape::Snapper::SnapConstraint> ctrl_constraint; // with Alt, preserve length diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index a7dabef1c..a38a93fb1 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -81,9 +81,15 @@ Dock::Dock(Gtk::Orientation orientation) static_cast<GdlSwitcherStyle>(prefs->getIntLimited("/options/dock/switcherstyle", GDL_SWITCHER_STYLE_BOTH, 0, 4)); - g_object_set (GDL_DOCK_OBJECT(_gdl_dock)->master, - "switcher-style", gdl_switcher_style, - NULL); + GdlDockMaster* master = NULL; + + g_object_get(GDL_DOCK_OBJECT(_gdl_dock), + "master", &master, + NULL); + + g_object_set(master, + "switcher-style", gdl_switcher_style, + NULL); GdlDockBarStyle gdl_dock_bar_style = static_cast<GdlDockBarStyle>(prefs->getIntLimited("/options/dock/dockbarstyle", |
