summaryrefslogtreecommitdiffstats
path: root/src/dialogs
diff options
context:
space:
mode:
authorBryce Harrington <bryce@bryceharrington.org>2007-02-20 06:01:42 +0000
committerbryce <bryce@users.sourceforge.net>2007-02-20 06:01:42 +0000
commit3378ccec49e794417fb8c2dfc81f32cebd8f9dfd (patch)
tree6c75be35b9e5105f93480a1e4efae59eb05157dc /src/dialogs
parentfix the order of searching for linked image file to match that of inkscape it... (diff)
downloadinkscape-3378ccec49e794417fb8c2dfc81f32cebd8f9dfd.tar.gz
inkscape-3378ccec49e794417fb8c2dfc81f32cebd8f9dfd.zip
Partial fix for bug 980157.
This commit disables the code that prevents stock markers from appearing at the top of the marker menu, as discussed in the bug report. Additionally, this patch factors out the pixmap rendering code, which is nearly identical to the rendering code in icon.cpp (and perhaps elsewhere). (bzr r2401)
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/stroke-style.cpp75
1 files changed, 14 insertions, 61 deletions
diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp
index 3db6c62ee..bab57b679 100644
--- a/src/dialogs/stroke-style.cpp
+++ b/src/dialogs/stroke-style.cpp
@@ -35,9 +35,9 @@
#include "sp-linear-gradient.h"
#include "sp-radial-gradient.h"
#include "marker.h"
-#include <sp-pattern.h>
-#include <widgets/paint-selector.h>
-#include <widgets/dash-selector.h>
+#include "sp-pattern.h"
+#include "widgets/paint-selector.h"
+#include "widgets/dash-selector.h"
#include "style.h"
#include "gradient-chemistry.h"
#include "sp-namedview.h"
@@ -56,9 +56,11 @@
#include "widgets/icon.h"
#include "helper/stock-items.h"
#include "io/sys.h"
+#include "ui/cache/svg_preview_cache.h"
#include "dialogs/stroke-style.h"
+
/* Paint */
static void sp_stroke_style_paint_construct(SPWidget *spw, SPPaintSelector *psel);
@@ -550,7 +552,7 @@ sp_stroke_radio_button(GtkWidget *tb, char const *icon,
* preview images of each marker in the marker menu.
*/
static GtkWidget *
-sp_marker_prev_new(unsigned size, gchar const *mname,
+sp_marker_prev_new(unsigned psize, gchar const *mname,
SPDocument *source, SPDocument *sandbox,
gchar *menu_id, NRArena const *arena, unsigned visionkey, NRArenaItem *root)
{
@@ -594,66 +596,12 @@ sp_marker_prev_new(unsigned size, gchar const *mname,
}
/* Update to renderable state */
- NRMatrix t;
double sf = 0.8;
- nr_matrix_set_scale(&t, sf, sf);
- nr_arena_item_set_transform(root, &t);
- NRGC gc(NULL);
- nr_matrix_set_identity(&gc.transform);
- nr_arena_item_invoke_update( root, NULL, &gc,
- NR_ARENA_ITEM_STATE_ALL,
- NR_ARENA_ITEM_STATE_NONE );
-
- /* Item integer bbox in points */
- NRRectL ibox;
- ibox.x0 = (int) floor(sf * dbox.min()[NR::X] + 0.5);
- ibox.y0 = (int) floor(sf * dbox.min()[NR::Y] + 0.5);
- ibox.x1 = (int) floor(sf * dbox.max()[NR::X] + 0.5);
- ibox.y1 = (int) floor(sf * dbox.max()[NR::Y] + 0.5);
-
- /* Find visible area */
- int width = ibox.x1 - ibox.x0;
- int height = ibox.y1 - ibox.y0;
- int dx = size;
- int dy = size;
- dx=(dx - width)/2; // watch out for size, since 'unsigned'-'signed' can cause problems if the result is negative
- dy=(dy - height)/2;
-
- NRRectL area;
- area.x0 = ibox.x0 - dx;
- area.y0 = ibox.y0 - dy;
- area.x1 = area.x0 + size;
- area.y1 = area.y0 + size;
-
- /* Actual renderable area */
- NRRectL ua;
- ua.x0 = MAX(ibox.x0, area.x0);
- ua.y0 = MAX(ibox.y0, area.y0);
- ua.x1 = MIN(ibox.x1, area.x1);
- ua.y1 = MIN(ibox.y1, area.y1);
-
- /* Set up pixblock */
- guchar *px = g_new(guchar, 4 * size * size);
- memset(px, 0x00, 4 * size * size);
-
- /* Render */
- NRPixBlock B;
- nr_pixblock_setup_extern( &B, NR_PIXBLOCK_MODE_R8G8B8A8N,
- ua.x0, ua.y0, ua.x1, ua.y1,
- px + 4 * size * (ua.y0 - area.y0) +
- 4 * (ua.x0 - area.x0),
- 4 * size, FALSE, FALSE );
- nr_arena_item_invoke_render( root, &ua, &B,
- NR_ARENA_ITEM_RENDER_NO_CACHE );
- nr_pixblock_release(&B);
+ GdkPixbuf* pixbuf = render_pixbuf(root, sf, dbox, psize);
// Create widget
- GtkWidget *pb = gtk_image_new_from_pixbuf(gdk_pixbuf_new_from_data(px,
- GDK_COLORSPACE_RGB,
- TRUE,
- 8, size, size, size * 4,
- (GdkPixbufDestroyNotify)g_free,
- NULL));
+ GtkWidget *pb = gtk_image_new_from_pixbuf(get_pixbuf(pixbuf));
+
return pb;
}
@@ -753,6 +701,10 @@ sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sour
if (!SP_IS_MARKER(ml->data))
continue;
+/*
+ Bug 980157 wants to have stock markers show up at the top of the dropdown menu
+ Thus we can skip all of this code, which simply looks for duplicate stock markers
+
Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) ml->data);
bool stock_dupe = false;
@@ -767,6 +719,7 @@ sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sour
if (stock_dupe) // stock item, dont add to list from current doc
continue;
+*/
// Add to the list of markers we really do wish to show
clean_ml = g_slist_prepend (clean_ml, ml->data);