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 | |
| 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')
36 files changed, 305 insertions, 258 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 93eea1e2a..e44eb757d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -526,6 +526,10 @@ endif() add_dependencies(inkscape inkscape_version) +if(WITH_DBUS) + add_dependencies(inkscape inkscape_dbus) +endif() + set(INKSCAPE_TARGET_LIBS # order from automake #sp_LIB diff --git a/src/desktop.cpp b/src/desktop.cpp index 331ab3351..d482d0d7f 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -111,7 +111,6 @@ SPDesktop::SPDesktop() : sketch( NULL ), controls( NULL ), tempgroup ( NULL ), - table( NULL ), page( NULL ), page_border( NULL ), current( NULL ), @@ -211,11 +210,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid g_signal_connect (G_OBJECT (main), "event", G_CALLBACK (sp_desktop_root_handler), this); /* This is the background the page sits on. */ - table = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, NULL); - SP_CTRLRECT(table)->setRectangle(Geom::Rect(Geom::Point(-80000, -80000), Geom::Point(80000, 80000))); - SP_CTRLRECT(table)->setColor(0x00000000, true, 0x00000000); - SP_CTRLRECT(table)->setCheckerboard( false ); - sp_canvas_item_move_to_z (table, 0); + canvas->setBackgroundColor(0xffffff00); page = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, NULL); ((CtrlRect *) page)->setColor(0x00000000, FALSE, 0x00000000); @@ -1733,17 +1728,11 @@ static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop) SPNamedView *nv=SP_NAMEDVIEW(obj); if (flags & SP_OBJECT_MODIFIED_FLAG) { - - /* Set page background */ - sp_canvas_item_show (desktop->table); if (nv->pagecheckerboard) { - ((CtrlRect *) desktop->table)->setCheckerboard( true ); - ((CtrlRect *) desktop->table)->setColor(0x00000000, true, nv->pagecolor ); // | 0xff); + desktop->canvas->setBackgroundCheckerboard(); } else { - ((CtrlRect *) desktop->table)->setCheckerboard( false ); - ((CtrlRect *) desktop->table)->setColor(0x00000000, true, nv->pagecolor | 0xff); + desktop->canvas->setBackgroundColor(nv->pagecolor); } - sp_canvas_item_move_to_z (desktop->table, 0); /* Show/hide page border */ if (nv->showborder) { @@ -1756,7 +1745,7 @@ static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop) } // place in the z-order stack if (nv->borderlayer == SP_BORDER_LAYER_BOTTOM) { - sp_canvas_item_move_to_z (desktop->page_border, 2); + sp_canvas_item_move_to_z (desktop->page_border, 1); } else { int order = sp_canvas_item_order (desktop->page_border); int morder = sp_canvas_item_order (desktop->drawing); diff --git a/src/desktop.h b/src/desktop.h index f1444ba7b..3652d4a97 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -174,7 +174,6 @@ public: SPCanvasGroup *sketch; SPCanvasGroup *controls; SPCanvasGroup *tempgroup; ///< contains temporary canvas items - SPCanvasItem *table; ///< outside-of-page background SPCanvasItem *page; ///< page background SPCanvasItem *page_border; ///< page border SPCSSAttr *current; ///< current style diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index ec99eca9a..366b3c7d1 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -250,7 +250,8 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event) arena->c = Geom::Point(event->crossing.x, event->crossing.y); /* fixme: Not sure abut this, but seems the right thing (Lauris) */ - arena->drawing.update(Geom::IntRect::infinite(), arena->ctx, DrawingItem::STATE_PICK, 0); + arena->drawing.update(Geom::IntRect::infinite(), arena->ctx, + DrawingItem::STATE_PICK | DrawingItem::STATE_BBOX, 0); arena->active = arena->drawing.pick(arena->c, arena->drawing.delta, arena->sticky); ret = sp_canvas_arena_send_event (arena, event); } @@ -269,7 +270,8 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event) arena->c = Geom::Point(event->motion.x, event->motion.y); /* fixme: Not sure abut this, but seems the right thing (Lauris) */ - arena->drawing.update(Geom::IntRect::infinite(), arena->ctx, DrawingItem::STATE_PICK); + arena->drawing.update(Geom::IntRect::infinite(), arena->ctx, + DrawingItem::STATE_PICK | DrawingItem::STATE_BBOX); new_arena = arena->drawing.pick(arena->c, arena->drawing.delta, arena->sticky); if (new_arena != arena->active) { GdkEventCrossing ec; diff --git a/src/display/nr-filter-tile.cpp b/src/display/nr-filter-tile.cpp index 7172f88ee..c151c8537 100644 --- a/src/display/nr-filter-tile.cpp +++ b/src/display/nr-filter-tile.cpp @@ -32,18 +32,6 @@ FilterTile::~FilterTile() void FilterTile::render_cairo(FilterSlot &slot) { - // FIX ME! - static bool tile_warning = false; - if (!tile_warning) { - g_warning("Renderer for feTile has non-optimal implementation, expect slowness and bugs."); - tile_warning = true; - } - - // Fixing isn't so easy as the Inkscape renderer breaks the canvas into "rendering" tiles for - // faster rendering. (The "rendering" tiles are not the same as the tiles in this primitive.) - // Only if the the feTile tile source falls inside the current "rendering" tile will the tile - // image be available. - // This input source contains only the "rendering" tile. cairo_surface_t *in = slot.getcairo(_input); diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 644da8d5a..decb14184 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -27,6 +27,7 @@ #include "helper/sp-marshal.h" #include <2geom/rect.h> #include <2geom/affine.h> +#include "display/cairo-utils.h" #include "display/sp-canvas.h" #include "display/sp-canvas-group.h" #include "preferences.h" @@ -37,6 +38,7 @@ #include "display/cairo-utils.h" #include "debug/gdk-event-latency-tracker.h" #include "desktop.h" +#include "color.h" using Inkscape::Debug::GdkEventLatencyTracker; @@ -959,6 +961,8 @@ static void sp_canvas_init(SPCanvas *canvas) canvas->_backing_store = NULL; canvas->_clean_region = cairo_region_create(); + canvas->_background = cairo_pattern_create_rgb(1, 1, 1); + canvas->_background_is_checkerboard = false; canvas->_forced_redraw_count = 0; canvas->_forced_redraw_limit = -1; @@ -972,10 +976,7 @@ static void sp_canvas_init(SPCanvas *canvas) void SPCanvas::shutdownTransients() { // Reset the clean region - if (_clean_region && !cairo_region_is_empty(_clean_region)) { - cairo_region_destroy(_clean_region); - _clean_region = cairo_region_create(); - } + dirtyAll(); if (_grabbed_item) { _grabbed_item = NULL; @@ -1006,6 +1007,10 @@ void SPCanvas::dispose(GObject *object) cairo_region_destroy(canvas->_clean_region); canvas->_clean_region = NULL; } + if (canvas->_background) { + cairo_pattern_destroy(canvas->_background); + canvas->_background = NULL; + } canvas->shutdownTransients(); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -1149,7 +1154,7 @@ void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation Geom::IntRect new_area = Geom::IntRect::from_xywh(canvas->_x0, canvas->_y0, allocation->width, allocation->height); - // resize backing store; the clean region does not change + // resize backing store cairo_surface_t *new_backing_store = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation->width, allocation->height); if (canvas->_backing_store) { @@ -1162,9 +1167,12 @@ void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation } canvas->_backing_store = new_backing_store; + // Clip the clean region to the new allocation + cairo_rectangle_int_t crect = { canvas->_x0, canvas->_y0, allocation->width, allocation->height }; + cairo_region_intersect_rectangle(canvas->_clean_region, &crect); + gtk_widget_set_allocation (widget, allocation); - // Schedule redraw of new region if (SP_CANVAS_ITEM_GET_CLASS (canvas->_root)->viewbox_changed) SP_CANVAS_ITEM_GET_CLASS (canvas->_root)->viewbox_changed (canvas->_root, new_area); @@ -1173,6 +1181,7 @@ void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation allocation->x, allocation->y, allocation->width, allocation->height); } + // Schedule redraw of any newly exposed regions canvas->addIdle(); } @@ -1527,44 +1536,23 @@ int SPCanvas::handle_motion(GtkWidget *widget, GdkEventMotion *event) void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect const &canvas_rect, int /*sw*/) { - GtkWidget *widget = GTK_WIDGET (this); - - // Mark the region clean - markRect(paint_rect, 0); - SPCanvasBuf buf; buf.buf = NULL; buf.buf_rowstride = 0; buf.rect = paint_rect; buf.visible_rect = canvas_rect; buf.is_empty = true; - //buf.ct = gdk_cairo_create(widget->window); // create temporary surface cairo_surface_t *imgs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, paint_rect.width(), paint_rect.height()); buf.ct = cairo_create(imgs); - //cairo_translate(buf.ct, -x0, -y0); - - // fix coordinates, clip all drawing to the tile and clear the background - //cairo_translate(buf.ct, paint_rect.left() - canvas->x0, paint_rect.top() - canvas->y0); - //cairo_rectangle(buf.ct, 0, 0, paint_rect.width(), paint_rect.height()); - //cairo_set_line_width(buf.ct, 3); - //cairo_set_source_rgba(buf.ct, 1.0, 0.0, 0.0, 0.1); - //cairo_stroke_preserve(buf.ct); - //cairo_clip(buf.ct); - -#if GTK_CHECK_VERSION(3,0,0) - GtkStyleContext *context = gtk_widget_get_style_context(widget); - gtk_render_background(context, buf.ct, 0, 0, paint_rect.width(), paint_rect.height()); -#else - GtkStyle *style = gtk_widget_get_style (widget); - gdk_cairo_set_source_color(buf.ct, &style->bg[GTK_STATE_NORMAL]); -#endif + cairo_save(buf.ct); + cairo_translate(buf.ct, -paint_rect.left(), -paint_rect.top()); + cairo_set_source(buf.ct, _background); cairo_set_operator(buf.ct, CAIRO_OPERATOR_SOURCE); - //cairo_rectangle(buf.ct, 0, 0, paint_rect.width(), paint_rec.height()); cairo_paint(buf.ct); - cairo_set_operator(buf.ct, CAIRO_OPERATOR_OVER); + cairo_restore(buf.ct); if (_root->visible) { SP_CANVAS_ITEM_GET_CLASS(_root)->render(_root, &buf); @@ -1608,8 +1596,8 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect cairo_destroy(xct); cairo_surface_destroy(imgs); - cairo_rectangle_int_t crect = { paint_rect.left(), paint_rect.right(), paint_rect.width(), paint_rect.height() }; - cairo_region_union_rectangle(_clean_region, &crect); + // Mark the painted rectangle clean + markRect(paint_rect, 0); gtk_widget_queue_draw_area(GTK_WIDGET(this), paint_rect.left() -_x0, paint_rect.top() - _y0, paint_rect.width(), paint_rect.height()); @@ -1799,8 +1787,14 @@ void SPCanvas::endForcedFullRedraws() gboolean SPCanvas::handle_draw(GtkWidget *widget, cairo_t *cr) { SPCanvas *canvas = SP_CANVAS(widget); + // Blit from the backing store, without regard for the clean region. + // This is necessary because GTK clears the widget for us, which causes + // severe flicker while drawing if we don't blit the old contents. + cairo_set_source_surface(cr, canvas->_backing_store, 0, 0); + cairo_paint(cr); + cairo_rectangle_list_t *rects = cairo_copy_clip_rectangle_list(cr); - cairo_region_t *draw_region = cairo_region_create(); + cairo_region_t *dirty_region = cairo_region_create(); for (int i = 0; i < rects->num_rectangles; i++) { cairo_rectangle_t rectangle = rects->rectangles[i]; @@ -1808,36 +1802,16 @@ gboolean SPCanvas::handle_draw(GtkWidget *widget, cairo_t *cr) { rectangle.width, rectangle.height); Geom::IntRect ir = dr.roundOutwards(); cairo_rectangle_int_t irect = { ir.left(), ir.top(), ir.width(), ir.height() }; - cairo_region_union_rectangle(draw_region, &irect); + cairo_region_union_rectangle(dirty_region, &irect); } cairo_rectangle_list_destroy(rects); - - cairo_region_t *draw_dirty = cairo_region_copy(draw_region); - cairo_region_subtract(draw_dirty, canvas->_clean_region); - cairo_region_intersect(draw_region, canvas->_clean_region); - - // Draw the clean portion - if (!cairo_region_is_empty(draw_region)) { - cairo_region_translate(draw_region, -canvas->_x0, -canvas->_y0); - cairo_save(cr); - int n_rects = cairo_region_num_rectangles(draw_region); - for (int i = 0; i < n_rects; ++i) { - cairo_rectangle_int_t crect; - cairo_region_get_rectangle(draw_region, i, &crect); - cairo_rectangle(cr, crect.x, crect.y, crect.width, crect.height); - } - cairo_clip(cr); - cairo_set_source_surface(cr, canvas->_backing_store, 0, 0); - cairo_paint(cr); - cairo_restore(cr); - } + cairo_region_subtract(dirty_region, canvas->_clean_region); // Render the dirty portion in the background - if (!cairo_region_is_empty(draw_dirty)) { + if (!cairo_region_is_empty(dirty_region)) { canvas->addIdle(); } - cairo_region_destroy(draw_region); - cairo_region_destroy(draw_dirty); + cairo_region_destroy(dirty_region); return TRUE; } @@ -1999,30 +1973,36 @@ void SPCanvas::scrollTo(double cx, double cy, unsigned int clear, bool is_scroll Geom::IntRect old_area = getViewboxIntegers(); Geom::IntRect new_area = old_area + Geom::IntPoint(dx, dy); - - _dx0 = cx; // here the 'd' stands for double, not delta! - _dy0 = cy; - _x0 = ix; - _y0 = iy; gtk_widget_get_allocation(&_widget, &allocation); + // adjust backing store contents assert(_backing_store); cairo_surface_t *new_backing_store = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation.width, allocation.height); cairo_t *cr = cairo_create(new_backing_store); - cairo_set_source_rgb(cr, 1, 1, 1); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); + // Paint the background + cairo_translate(cr, -ix, -iy); + cairo_set_source(cr, _background); cairo_paint(cr); - cairo_set_source_surface(cr, _backing_store, -dx, -dy); + // Copy the old backing store contents + cairo_set_source_surface(cr, _backing_store, _x0, _y0); + cairo_rectangle(cr, _x0, _y0, allocation.width, allocation.height); + cairo_clip(cr); cairo_paint(cr); cairo_destroy(cr); cairo_surface_destroy(_backing_store); _backing_store = new_backing_store; + _dx0 = cx; // here the 'd' stands for double, not delta! + _dy0 = cy; + _x0 = ix; + _y0 = iy; + + // Adjust the clean region if (clear) { - cairo_region_destroy(_clean_region); - _clean_region = cairo_region_create(); + dirtyAll(); } else { cairo_rectangle_int_t crect = { _x0, _y0, allocation.width, allocation.height }; cairo_region_intersect_rectangle(_clean_region, &crect); @@ -2070,6 +2050,35 @@ void SPCanvas::requestRedraw(int x0, int y0, int x1, int y1) addIdle(); } +void SPCanvas::setBackgroundColor(guint32 rgba) { + double new_r = SP_RGBA32_R_F(rgba); + double new_g = SP_RGBA32_G_F(rgba); + double new_b = SP_RGBA32_B_F(rgba); + if (!_background_is_checkerboard) { + double old_r, old_g, old_b; + cairo_pattern_get_rgba(_background, &old_r, &old_g, &old_b, NULL); + if (new_r == old_r && new_g == old_g && new_b == old_b) return; + } + if (_background) { + cairo_pattern_destroy(_background); + } + _background = cairo_pattern_create_rgb(new_r, new_g, new_b); + _background_is_checkerboard = false; + dirtyAll(); + addIdle(); +} + +void SPCanvas::setBackgroundCheckerboard() { + if (_background_is_checkerboard) return; + if (_background) { + cairo_pattern_destroy(_background); + } + _background = ink_cairo_pattern_create_checkerboard(); + _background_is_checkerboard = true; + dirtyAll(); + addIdle(); +} + /** * Sets world coordinates from win and canvas. */ @@ -2175,6 +2184,13 @@ void SPCanvas::dirtyRect(Geom::IntRect const &area) { markRect(area, 1); } +void SPCanvas::dirtyAll() { + if (_clean_region && !cairo_region_is_empty(_clean_region)) { + cairo_region_destroy(_clean_region); + _clean_region = cairo_region_create(); + } +} + void SPCanvas::markRect(Geom::IntRect const &area, uint8_t val) { cairo_rectangle_int_t crect = { area.left(), area.top(), area.width(), area.height() }; diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index a1f8d0a1a..171fdaf67 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -87,6 +87,9 @@ struct SPCanvas { Geom::IntRect getViewboxIntegers() const; SPCanvasGroup *getRoot(); + void setBackgroundColor(guint32 rgba); + void setBackgroundCheckerboard(); + /// Returns new canvas as widget. static GtkWidget *createAA(); @@ -105,7 +108,8 @@ private: /// Marks the specified area as dirty (requiring redraw) void dirtyRect(Geom::IntRect const &area); - /// Marks specific canvas rectangle as clean (val == 0) or dirty (otherwise) + /// Marks the whole widget for redraw + void dirtyAll(); void markRect(Geom::IntRect const &area, uint8_t val); /// Invokes update, paint, and repick on canvas. @@ -177,14 +181,18 @@ public: bool _is_dragging; double _dx0; double _dy0; - int _x0; - int _y0; + int _x0; ///< World coordinate of the leftmost pixels + int _y0; ///< World coordinate of the topmost pixels - /* Area that needs redrawing, stored as a microtile array */ + /// Image surface storing the contents of the widget cairo_surface_t *_backing_store; + /// Area of the widget that has up-to-date content cairo_region_t *_clean_region; + /// Widget background, defaults to white + cairo_pattern_t *_background; + bool _background_is_checkerboard; - /** Last known modifier state, for deferred repick when a button is down. */ + /// Last known modifier state, for deferred repick when a button is down. int _state; /** The item containing the mouse pointer, or NULL if none. */ diff --git a/src/document.cpp b/src/document.cpp index ae03b1ba1..7086fc0be 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -46,6 +46,7 @@ #include "widgets/desktop-widget.h" #include "desktop.h" #include "dir-util.h" +#include "display/drawing.h" #include "display/drawing-item.h" #include "document-private.h" #include "document-undo.h" @@ -1316,6 +1317,7 @@ SPItem *SPDocument::getItemFromListAtPointBottom(unsigned int dkey, SPGroup *gro if ( SP_IS_ITEM(o) ) { SPItem *item = SP_ITEM(o); Inkscape::DrawingItem *arenaitem = item->get_arenaitem(dkey); + arenaitem->drawing().update(); if (arenaitem && arenaitem->pick(p, delta, 1) != NULL && (take_insensitive || item->isVisibleAndUnlocked(dkey))) { if (find(list.begin(),list.end(),item)!=list.end() ) { @@ -1380,10 +1382,12 @@ static SPItem *find_item_at_point(std::deque<SPItem*> *nodes, unsigned int dkey, continue; } Inkscape::DrawingItem *arenaitem = child->get_arenaitem(dkey); - - if (arenaitem && arenaitem->pick(p, delta, 1) != NULL) { - seen = child; - break; + if (arenaitem) { + arenaitem->drawing().update(); + if (arenaitem->pick(p, delta, 1) != NULL) { + seen = child; + break; + } } } @@ -1413,6 +1417,7 @@ static SPItem *find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Poin if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) != SPGroup::LAYER ) { SPItem *child = SP_ITEM(o); Inkscape::DrawingItem *arenaitem = child->get_arenaitem(dkey); + arenaitem->drawing().update(); // seen remembers the last (topmost) of groups pickable at this point if (arenaitem && arenaitem->pick(p, delta, 1) != NULL) { diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index a8fd86d39..a5352d0ba 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -246,20 +246,7 @@ if(WITH_IMAGE_MAGICK) endif() if(WITH_DBUS) - list(APPEND extension_SRC - dbus/application-interface.cpp - dbus/dbus-init.cpp - dbus/document-interface.cpp - - # ------ - # Header - dbus/application-interface.h - dbus/dbus-init.h - dbus/document-interface.h - dbus/wrapper/inkscape-dbus-wrapper.h - ) - - include_directories(dbus) + add_subdirectory(dbus) endif() # add_inkscape_lib(extension_LIB "${extension_SRC}") diff --git a/src/extension/dbus/CMakeLists.txt b/src/extension/dbus/CMakeLists.txt new file mode 100644 index 000000000..ad9e1fd7d --- /dev/null +++ b/src/extension/dbus/CMakeLists.txt @@ -0,0 +1,29 @@ +if(WITH_DBUS) +include_directories(${CMAKE_BINARY_DIR}/src/extension/dbus) +set(dbus_SRC "") + list(APPEND dbus_SRC + application-interface.cpp + dbus-init.cpp + document-interface.cpp + ) + add_custom_target(inkscape_dbus + DEPENDS ${CMAKE_BINARY_DIR}/src/extension/dbus/application-server-glue.h ${CMAKE_BINARY_DIR}/src/extension/dbus/document-server-glue.h ${CMAKE_BINARY_DIR}/src/extension/dbus/document-client-glue.h + ) + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/src/extension/dbus/application-server-glue.h ${CMAKE_BINARY_DIR}/src/extension/dbus/document-server-glue.h ${CMAKE_BINARY_DIR}/src/extension/dbus/document-client-glue.h + DEPENDS ${CMAKE_SOURCE_DIR}/src/extension/dbus/application-interface.xml ${CMAKE_SOURCE_DIR}/src/extension/dbus/document-interface.xml + COMMAND dbus-binding-tool --mode=glib-server --output=${CMAKE_BINARY_DIR}/src/extension/dbus/application-server-glue.h --prefix=application_interface ${CMAKE_SOURCE_DIR}/src/extension/dbus/application-interface.xml + COMMAND dbus-binding-tool --mode=glib-server --output=${CMAKE_BINARY_DIR}/src/extension/dbus/document-server-glue.h --prefix=document_interface ${CMAKE_SOURCE_DIR}/src/extension/dbus/document-interface.xml + COMMAND dbus-binding-tool --mode=glib-client --output=${CMAKE_BINARY_DIR}/src/extension/dbus/document-client-glue.h --prefix=document_interface ${CMAKE_SOURCE_DIR}/src/extension/dbus/document-interface.xml + ) + set_source_files_properties( + ${CMAKE_BINARY_DIR}/src/extension/dbus/application-server-glue.h + PROPERTIES GENERATED TRUE) + set_source_files_properties( + ${CMAKE_BINARY_DIR}/src/extension/dbus/document-server-glue.h + PROPERTIES GENERATED TRUE) + set_source_files_properties( + ${CMAKE_BINARY_DIR}/src/extension/dbus/document-client-glue.h + PROPERTIES GENERATED TRUE) +add_inkscape_source("${dbus_SRC}") +endif() diff --git a/src/libgdl/gdl-dock-bar.c b/src/libgdl/gdl-dock-bar.c index 1d7b33b5f..c1fe21872 100644 --- a/src/libgdl/gdl-dock-bar.c +++ b/src/libgdl/gdl-dock-bar.c @@ -314,7 +314,7 @@ gdl_dock_bar_add_item (GdlDockBar *dockbar, } else if (pixbuf_icon) { image = gtk_image_new_from_pixbuf (pixbuf_icon); } else { - image = gtk_image_new_from_stock (GTK_STOCK_NEW, + image = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_SMALL_TOOLBAR); } gtk_box_pack_start (GTK_BOX (box), image, TRUE, TRUE, 0); diff --git a/src/libnrtype/Layout-TNG-Compute.cpp b/src/libnrtype/Layout-TNG-Compute.cpp index e862f0657..337d2a656 100644 --- a/src/libnrtype/Layout-TNG-Compute.cpp +++ b/src/libnrtype/Layout-TNG-Compute.cpp @@ -14,6 +14,7 @@ #include "svg/svg-length.h" #include "sp-object.h" #include "Layout-TNG-Scanline-Maker.h" +#include <limits> namespace Inkscape { namespace Text { @@ -1569,8 +1570,8 @@ bool Layout::Calculator::_buildChunksInScanRun(ParagraphInfo const ¶, new_span_height.computeEffective( new_span.start.iter_span->line_height_multiplier ); /* floating point 80-bit/64-bit rounding problems require epsilon. See discussion http://inkscape.gristle.org/2005-03-16.txt around 22:00 */ - if ( new_span_height.ascent > line_height->ascent + FLT_EPSILON || - new_span_height.descent > line_height->descent + FLT_EPSILON) { + if ( new_span_height.ascent > line_height->ascent + std::numeric_limits<float>::epsilon() || + new_span_height.descent > line_height->descent + std::numeric_limits<float>::epsilon() ) { // Take larger of each of the two ascents and two descents per CSS line_height->max(new_span_height); if (!_scanline_maker->canExtendCurrentScanline(*line_height)) { diff --git a/src/libnrtype/Layout-TNG-Scanline-Makers.cpp b/src/libnrtype/Layout-TNG-Scanline-Makers.cpp index dcc973a24..0d6112d19 100644 --- a/src/libnrtype/Layout-TNG-Scanline-Makers.cpp +++ b/src/libnrtype/Layout-TNG-Scanline-Makers.cpp @@ -11,6 +11,7 @@ #include "Layout-TNG-Scanline-Maker.h" #include "livarot/Shape.h" #include "livarot/float-line.h" +#include <limits> namespace Inkscape { namespace Text { @@ -43,7 +44,7 @@ std::vector<Layout::ScanlineMaker::ScanRun> Layout::InfiniteScanlineMaker::makeS { std::vector<ScanRun> runs(1); runs[0].x_start = _x; - runs[0].x_end = FLT_MAX; // we could use DBL_MAX, but this just seems safer + runs[0].x_end = std::numeric_limits<float>::max(); // we could use DBL_MAX, but this just seems safer runs[0].y = _y; _current_line_height = line_height; return runs; diff --git a/src/live_effects/parameter/originalpatharray.cpp b/src/live_effects/parameter/originalpatharray.cpp index 7e3a6f5fe..4ee068ebf 100644 --- a/src/live_effects/parameter/originalpatharray.cpp +++ b/src/live_effects/parameter/originalpatharray.cpp @@ -144,7 +144,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() { // Paste path to link button - Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_PASTE, Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon("gtk-stock", Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -156,7 +156,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() } { // Remove linked path - Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_REMOVE, Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon("gtk-remove", Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -168,7 +168,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() } { // Move Down - Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_GO_DOWN, Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( "gtk-go-down", Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -180,7 +180,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() } { // Move Down - Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_GO_UP, Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Widget *pIcon = Gtk::manage( sp_icon_get_icon( "gtk-go-up", Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index 8cdfbeb05..9c7c65140 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -86,6 +86,8 @@ static char const menus_skeleton[] = " <verb verb-id=\"EditInvert\" />\n" " <verb verb-id=\"EditDeselect\" />\n" " <separator/>\n" +" <verb verb-id=\"FitCanvasToSelectionOrDrawing\" />\n" +" <separator/>\n" " <verb verb-id=\"EditGuidesAroundPage\" />\n" " <verb verb-id=\"EditGuidesToggleLock\" check=\"yes\" />\n" " <verb verb-id=\"EditRemoveAllGuides\" />\n" @@ -188,6 +190,7 @@ static char const menus_skeleton[] = " <separator/>\n" " <verb verb-id=\"SelectionGroup\" />\n" " <verb verb-id=\"SelectionUnGroup\" />\n" +" <verb verb-id=\"SelectionUnGroupPopSelection\" />\n" " <separator/>\n" " <submenu name=\"" N_("Cli_p") "\">\n" " <verb verb-id=\"ObjectSetClipPath\" />\n" diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index e9a3af83a..7d32477a1 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -791,6 +791,38 @@ static gint clone_depth_descending(gconstpointer a, gconstpointer b) { return -1; } } + +void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDesktop *desktop) +{ + if (selection->isEmpty()) { + selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("<b>No objects selected</b> to pop out of group.")); + return; + } + std::vector<SPItem*> selection_list = selection->itemList(); + + std::vector<SPItem*>::const_iterator item = selection_list.begin(); // leaving this because it will be useful for + // future implementation of complex pop ungrouping + SPItem *obj = *item; + SPItem *parent_group = static_cast<SPItem*>(obj->parent); + if (!SP_IS_GROUP(parent_group) || SP_IS_LAYER(parent_group)) { + desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Selection <b>not in a group</b>.")); + return; + } + if (parent_group->firstChild()->getNext() == NULL) { + std::vector<SPItem*> children; + sp_item_group_ungroup(static_cast<SPGroup*>(parent_group), children, false); + } + else { + sp_selection_to_next_layer(desktop, 1); // suppress done + } + + parent_group->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_UNGROUP_POP_SELECTION, + _("Pop selection from group")); + +} + void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop) { diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 4bfa2c0aa..82b91c617 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -76,6 +76,7 @@ void sp_selection_untile(SPDesktop *desktop); void sp_selection_group(Inkscape::Selection *selection, SPDesktop *desktop); void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop); +void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDesktop *desktop); void sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop); void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop); diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index 18f03aa1b..379682668 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -274,6 +274,7 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::sioxProcessImage(SPImage *img, Glib::RefPtr<Gd for (aIter = arenaItems.begin() ; aIter!=arenaItems.end() ; ++aIter) { Inkscape::DrawingItem *arenaItem = *aIter; + arenaItem->drawing().update(); if (arenaItem->pick(point, 1.0f, 1)) { weHaveAHit = true; diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 7e9d8481a..b70cfcdd4 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1364,6 +1364,7 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) _list.append_column("#", _columns.count); _list.get_column(2)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); _list.get_column(2)->set_expand(false); + _list.get_column(2)->set_reorderable(true); sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _list.get_column(1)->set_resizable(true); @@ -1868,7 +1869,7 @@ void FilterEffectsDialog::PrimitiveList::update() if(f) { bool active_found = false; - _dialog._primitive_box.set_sensitive(true); + _dialog._primitive_box->set_sensitive(true); _dialog.update_filter_general_settings_view(); for(SPObject *prim_obj = f->children; prim_obj && SP_IS_FILTER_PRIMITIVE(prim_obj); @@ -1913,7 +1914,7 @@ void FilterEffectsDialog::PrimitiveList::update() } } else { - _dialog._primitive_box.set_sensitive(false); + _dialog._primitive_box->set_sensitive(false); set_size_request(-1, -1); } } @@ -2760,8 +2761,10 @@ FilterEffectsDialog::FilterEffectsDialog() // Initialize widget hierarchy #if WITH_GTKMM_3_0 Gtk::Paned* hpaned = Gtk::manage(new Gtk::Paned); + _primitive_box = Gtk::manage(new Gtk::Paned); #else Gtk::HPaned* hpaned = Gtk::manage(new Gtk::HPaned); + _primitive_box = Gtk::manage(new Gtk::VPaned); #endif Gtk::ScrolledWindow* sw_prims = Gtk::manage(new Gtk::ScrolledWindow); @@ -2769,25 +2772,40 @@ FilterEffectsDialog::FilterEffectsDialog() Gtk::HBox* infobox = Gtk::manage(new Gtk::HBox(/*homogeneous:*/false, /*spacing:*/4)); Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox); Gtk::VBox* vb_prims = Gtk::manage(new Gtk::VBox); + Gtk::VBox* vb_desc = Gtk::manage(new Gtk::VBox); + + Gtk::VBox* prim_vbox_p = Gtk::manage(new Gtk::VBox); + Gtk::VBox* prim_vbox_i = Gtk::manage(new Gtk::VBox); + _primitive_box->pack1(*prim_vbox_p); + _primitive_box->pack2(*prim_vbox_i); + _getContents()->add(*hpaned); hpaned->pack1(_filter_modifier); - hpaned->pack2(_primitive_box); - _primitive_box.pack_start(*sw_prims); - _primitive_box.pack_start(*sw_infobox, false, false); + hpaned->pack2(*_primitive_box); + prim_vbox_p->pack_start(*sw_prims, true, true); + prim_vbox_i->pack_start(*vb_prims, true, true); + sw_prims->add(_primitive_list); - sw_infobox->add(*vb_prims); - infobox->pack_start(_infobox_icon, false, false); - infobox->pack_start(_infobox_desc, false, false); + sw_infobox->add(*infobox); + + _infobox_icon.set_alignment(0, 0); + _infobox_desc.set_alignment(0, 0); + _infobox_desc.set_justify(Gtk::JUSTIFY_LEFT); _infobox_desc.set_line_wrap(true); - _infobox_desc.set_size_request(250, -1); - - vb_prims->pack_start(*hb_prims); - vb_prims->pack_start(*infobox); + _infobox_desc.set_size_request(200, -1); + + infobox->pack_start(_infobox_icon, false, false); + vb_desc->pack_start(_infobox_desc, true, true); + infobox->pack_start(*vb_desc, true, true); + + vb_prims->pack_start(*hb_prims, false, false); + vb_prims->pack_start(*sw_infobox, true, true); hb_prims->pack_start(_add_primitive, false, false); - hb_prims->pack_start(_add_primitive_type, false, false); - _getContents()->pack_start(_settings_tabs, false, false); + + hb_prims->pack_start(_add_primitive_type, true, true); + _getContents()->pack_start(_settings_tabs, true, true); _settings_tabs.append_page(_settings_tab1, _("Effect parameters")); _settings_tabs.append_page(_settings_tab2, _("Filter General Settings")); @@ -2801,7 +2819,7 @@ FilterEffectsDialog::FilterEffectsDialog() sw_prims->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); sw_prims->set_shadow_type(Gtk::SHADOW_IN); - sw_infobox->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER); + sw_infobox->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); // al_settings->set_padding(0, 0, 12, 0); // fr_settings->set_shadow_type(Gtk::SHADOW_NONE); @@ -3026,7 +3044,8 @@ void FilterEffectsDialog::update_primitive_infobox() g_assert(false); break; } - _infobox_icon.set_pixel_size(96); + //_infobox_icon.set_pixel_size(96); + _infobox_icon.set_pixel_size(64); } void FilterEffectsDialog::duplicate_primitive() diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 283abb5b0..90bde23cf 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -28,6 +28,8 @@ #include <gtkmm/notebook.h> #include <gtkmm/sizegroup.h> +#include <gtkmm/paned.h> + namespace Inkscape { namespace UI { namespace Dialog { @@ -279,7 +281,12 @@ private: Gtk::Image _infobox_icon; // View/add primitives - Gtk::VBox _primitive_box; +#if WITH_GTKMM_3_0 + Gtk::Paned* _primitive_box; +#else + Gtk::VPaned* _primitive_box; +#endif + UI::Widget::ComboBoxEnum<Inkscape::Filters::FilterPrimitiveType> _add_primitive_type; Gtk::Button _add_primitive; diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 891048beb..27694a9ac 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -1907,8 +1907,8 @@ ObjectsPanel::ObjectsPanel() : _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_RAISE, GTK_STOCK_GO_UP, _("Up"), (int)BUTTON_UP ) ); - _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_LOWER, GTK_STOCK_GO_DOWN, _("Down"), (int)BUTTON_DOWN ) ); + _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_RAISE, "gtk-go-up", _("Up"), (int)BUTTON_UP ) ); + _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_LOWER, "gtk-go-down", _("Down"), (int)BUTTON_DOWN ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index a16bbc472..3e2a2004c 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1523,6 +1523,12 @@ ContextMenu::ContextMenu(SPDesktop *desktop, SPItem *item) : MIParent.signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::LeaveGroup)); MIParent.show(); append(MIParent); + + /* Pop selection out of group */ + Gtk::MenuItem* miu = Gtk::manage(new Gtk::MenuItem(_("_Pop selection out of group"), 1)); + miu->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ActivateUngroupPopSelection)); + miu->show(); + append(*miu); } } } @@ -1920,6 +1926,12 @@ void ContextMenu::ActivateUngroup(void) sp_item_group_ungroup(static_cast<SPGroup*>(_item), children); _desktop->selection->setList(children); } + +void ContextMenu::ActivateUngroupPopSelection(void) +{ + sp_selection_ungroup_pop_selection(_desktop->selection, _desktop); +} + void ContextMenu::MakeAnchorMenu(void) { diff --git a/src/ui/interface.h b/src/ui/interface.h index 6fb74046f..52074f0f0 100644 --- a/src/ui/interface.h +++ b/src/ui/interface.h @@ -194,6 +194,7 @@ class ContextMenu : public Gtk::Menu /** * callback, is executed on clicking the anchor "Group" and "Ungroup" menu entry */ + void ActivateUngroupPopSelection(void); void ActivateUngroup(void); void ActivateGroup(void); diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 823e24a00..10294125d 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -48,7 +48,6 @@ AddToIcon::AddToIcon() : // // _property_pixbuf_add = Gtk::Widget:: - //property_stock_id() = GTK_STOCK_ADD; set_pixbuf(); } diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index dc89d233f..2a1fa352b 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -32,7 +32,6 @@ #include "util/reverse-list.h" #include "verbs.h" #include "widgets/icon.h" -#include "widgets/shrink-wrap-button.h" #include "xml/node-event-vector.h" #include "widgets/gradient-vector.h" @@ -114,7 +113,6 @@ LayerSelector::LayerSelector(SPDesktop *desktop) ); _visibility_toggle.set_relief(Gtk::RELIEF_NONE); - shrink_wrap_button(_visibility_toggle); _visibility_toggle.set_tooltip_text(_("Toggle current layer visibility")); pack_start(_visibility_toggle, Gtk::PACK_EXPAND_PADDING); @@ -135,7 +133,6 @@ LayerSelector::LayerSelector(SPDesktop *desktop) ); _lock_toggle.set_relief(Gtk::RELIEF_NONE); - shrink_wrap_button(_lock_toggle); _lock_toggle.set_tooltip_text(_("Lock or unlock current layer")); pack_start(_lock_toggle, Gtk::PACK_EXPAND_PADDING); diff --git a/src/verbs.cpp b/src/verbs.cpp index 7b128c172..299cfe8e7 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1150,6 +1150,9 @@ void SelectionVerb::perform(SPAction *action, void *data) case SP_VERB_SELECTION_UNGROUP: sp_selection_ungroup(selection, dt); break; + case SP_VERB_SELECTION_UNGROUP_POP_SELECTION: + sp_selection_ungroup_pop_selection(selection, dt); + break; default: handled = false; break; @@ -2559,6 +2562,8 @@ Verb *Verb::_base_verbs[] = { N_("Group selected objects"), INKSCAPE_ICON("object-group")), new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"), N_("Ungroup selected groups"), INKSCAPE_ICON("object-ungroup")), + new SelectionVerb(SP_VERB_SELECTION_UNGROUP_POP_SELECTION, "SelectionUnGroupPopSelection", N_("_Pop selected objects out of group"), + N_("Pop selected objects out of group"), INKSCAPE_ICON("object-ungroup-pop-selection")), new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"), N_("Put text on path"), INKSCAPE_ICON("text-put-on-path")), @@ -3000,7 +3005,7 @@ Verb *Verb::_base_verbs[] = { N_("Fit the page to the current selection"), NULL), new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"), N_("Fit the page to the drawing"), NULL), - new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"), + new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("_Resize Page to Selection"), N_("Fit the page to the current selection or the drawing if there is no selection"), NULL), // LockAndHide new LockAndHideVerb(SP_VERB_UNLOCK_ALL, "UnlockAll", N_("Unlock All"), diff --git a/src/verbs.h b/src/verbs.h index 4f453761e..ffb9b23d8 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -116,6 +116,7 @@ enum { SP_VERB_SELECTION_LOWER, SP_VERB_SELECTION_GROUP, SP_VERB_SELECTION_UNGROUP, + SP_VERB_SELECTION_UNGROUP_POP_SELECTION, SP_VERB_SELECTION_TEXTTOPATH, SP_VERB_SELECTION_TEXTFROMPATH, SP_VERB_SELECTION_REMOVE_KERNS, 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 */ |
