dia r4056 - in trunk: . app lib plug-ins plug-ins/libart
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4056 - in trunk: . app lib plug-ins plug-ins/libart
- Date: Fri, 30 May 2008 14:00:36 +0000 (UTC)
Author: hans
Date: Fri May 30 14:00:36 2008
New Revision: 4056
URL: http://svn.gnome.org/viewvc/dia?rev=4056&view=rev
Log:
2008-05-30 Hans Breuer <hans breuer org>
[
Moved libart rendering and it's PNG export to a plug-in
Not build on Linux for the moment
]
* plug-ins/libart/dialibartrenderer.[hc] : from lib/*
* plug-ins/libart/export_png.c : moved from app/*
* plug-ins/libart/render_libart.[hc] : moved from app/*
* lib/dialogs.[hc] : moved from app/*
* app/app_procs.[hc] : parse_size moved to plug-in
* app/display.c : dynamically create the aa renderer like it is done
for the cairo renderer
* app/Makefile.am app/makefile.msc plug-ins/makefile.msc
lib/libdia.def lib/Makefile.am lib/makefile.msc : adapted
* plug-ins/libart/Makefile.am : build it on Linux (untested)
app/menus.c : View/Antialiased currently always enabled
Added:
trunk/lib/dialogs.c
- copied unchanged from r4055, /trunk/app/dialogs.c
trunk/lib/dialogs.h
- copied unchanged from r4055, /trunk/app/dialogs.h
trunk/plug-ins/libart/
trunk/plug-ins/libart/Makefile.am
trunk/plug-ins/libart/dialibartrenderer.c
- copied, changed from r4055, /trunk/lib/dialibartrenderer.c
trunk/plug-ins/libart/dialibartrenderer.h
- copied unchanged from r4055, /trunk/lib/dialibartrenderer.h
trunk/plug-ins/libart/export_png.c
- copied, changed from r4055, /trunk/app/export_png.c
trunk/plug-ins/libart/render_libart.c
- copied unchanged from r4055, /trunk/app/render_libart.c
trunk/plug-ins/libart/render_libart.h
- copied unchanged from r4055, /trunk/app/render_libart.h
Removed:
trunk/app/dialogs.c
trunk/app/dialogs.h
trunk/app/export_png.c
trunk/app/render_libart.c
trunk/app/render_libart.h
trunk/lib/dialibartrenderer.c
trunk/lib/dialibartrenderer.h
Modified:
trunk/ChangeLog
trunk/app/Makefile.am
trunk/app/app_procs.c
trunk/app/app_procs.h
trunk/app/display.c
trunk/app/makefile.msc
trunk/app/menus.c
trunk/lib/Makefile.am
trunk/lib/libdia.def
trunk/lib/makefile.msc
trunk/plug-ins/makefile.msc
Modified: trunk/app/Makefile.am
==============================================================================
--- trunk/app/Makefile.am (original)
+++ trunk/app/Makefile.am Fri May 30 14:00:36 2008
@@ -95,15 +95,12 @@
properties.h \
defaults.c \
defaults.h \
- render_libart.c \
- render_libart.h \
undo.c \
undo.h \
object_ops.c \
object_ops.h \
layer_dialog.c \
layer_dialog.h \
- export_png.c \
commands.c \
commands.h \
app_procs.c \
@@ -182,8 +179,6 @@
sheets_dialog.h \
sheets_dialog_callbacks.c \
sheets_dialog_callbacks.h \
- dialogs.c \
- dialogs.h \
autosave.c \
autosave.h \
authors.h \
Modified: trunk/app/app_procs.c
==============================================================================
--- trunk/app/app_procs.c (original)
+++ trunk/app/app_procs.c Fri May 30 14:00:36 2008
@@ -78,10 +78,6 @@
#include "exit_dialog.h"
#include "newgroup.h"
-#if defined(HAVE_LIBPNG) && defined(HAVE_LIBART)
-extern DiaExportFilter png_export_filter;
-#endif
-
static void
integrated_ui_create_initial_diagrams_callback (GtkWidget *widget,
gpointer user_data);
@@ -1139,10 +1135,6 @@
/* register export filters */
/* Standard Dia format */
filter_register_export(&dia_export_filter);
-#if defined(HAVE_LIBPNG) && defined(HAVE_LIBART)
- /* PNG with libart rendering */
- filter_register_export(&png_export_filter);
-#endif
return DIA_PLUGIN_INIT_OK;
}
@@ -1248,23 +1240,6 @@
}
}
-/* parses a string of the form "[0-9]*x[0-9]*" and transforms it into
- two long values width and height. */
-void
-parse_size(gchar *size, long *width, long *height)
-{
- if (size) {
- gchar** array = g_strsplit(size, "x", 3);
- *width = (array[0])? strtol(array[0], NULL, 10): 0;
- *height = (array[1])? strtol(array[1], NULL, 10): 0;
- g_strfreev(array);
- }
- else {
- *width = 0;
- *height = 0;
- }
-}
-
int app_is_embedded(void)
{
return 0;
Modified: trunk/app/app_procs.h
==============================================================================
--- trunk/app/app_procs.h (original)
+++ trunk/app/app_procs.h Fri May 30 14:00:36 2008
@@ -35,10 +35,6 @@
gboolean app_is_interactive(void);
-/* parses a string of the form "[0-9]*x[0-9]*" and transforms it into
- two long values width and height. */
-void parse_size(gchar *size, long *width, long *height);
-
void dia_redirect_console (void);
#endif /* APP_PROCS_H */
Modified: trunk/app/display.c
==============================================================================
--- trunk/app/display.c (original)
+++ trunk/app/display.c Fri May 30 14:00:36 2008
@@ -48,7 +48,7 @@
#include "load_save.h"
#include "dia-props.h"
#include "render_gdk.h"
-#include "render_libart.h"
+#include "diatransform.h"
static GHashTable *display_ht = NULL;
static GdkCursor *current_cursor = NULL;
@@ -1023,9 +1023,19 @@
NULL);
return renderer;
} else {
- /* fallback: built-in libart renderer */
- return new_libart_renderer (dia_transform_new (&ddisp->visible,
- &ddisp->zoom_factor), 1);
+ GType libart_renderer_type = g_type_from_name ("DiaLibartRenderer");
+ if (libart_renderer_type) {
+ DiaRenderer *renderer = g_object_new(libart_renderer_type, NULL);
+ g_object_set (renderer,
+ "transform", dia_transform_new (&ddisp->visible, &ddisp->zoom_factor),
+ NULL);
+ return renderer;
+ } else {
+ /* we really should not come here but instead disable the menu command earlier */
+ message_warning (_("No anti-aliased renderer found"));
+ /* fallback: built-in libart renderer */
+ return new_gdk_renderer (ddisp);
+ }
}
}
@@ -1063,9 +1073,7 @@
{
if (ddisp->renderer==NULL) {
if (ddisp->aa_renderer)
- ddisp->renderer = new_libart_renderer(
- dia_transform_new (&ddisp->visible,
- &ddisp->zoom_factor), 1);
+ ddisp->renderer = new_aa_renderer (ddisp);
else
ddisp->renderer = new_gdk_renderer(ddisp);
}
Modified: trunk/app/makefile.msc
==============================================================================
--- trunk/app/makefile.msc (original)
+++ trunk/app/makefile.msc Fri May 30 14:00:36 2008
@@ -35,14 +35,12 @@
diagram_tree_menu.obj \
diagram_tree_menu_callbacks.obj \
diagram_tree_window.obj \
- dialogs.obj \
diapagelayout.obj \
dia-props.obj \
disp_callbacks.obj \
display.obj \
dynamic_refresh.obj \
exit_dialog.obj \
- export_png.obj \
filedlg.obj \
find-and-replace.obj \
grid.obj \
@@ -66,7 +64,6 @@
properties.obj \
recent_files.obj \
render_gdk.obj \
- render_libart.obj \
scroll_tool.obj \
select.obj \
sheets.obj \
Modified: trunk/app/menus.c
==============================================================================
--- trunk/app/menus.c (original)
+++ trunk/app/menus.c Fri May 30 14:00:36 2008
@@ -242,14 +242,7 @@
#else
{ "ViewFullscreen", NULL, N_("Fullscr_een"), "F11", NULL, G_CALLBACK (view_fullscreen_callback) },
#endif
-#ifdef HAVE_LIBART
{ "ViewAntialiased", NULL, N_("_AntiAliased"), NULL, NULL, G_CALLBACK (view_aa_callback) },
-#else
- /* we must have all actions registered to avoid configuration specific ui-files and crashing in GTK+,
- * see: http://bugzilla.gnome.org/show_bug.cgi?id=396161
- */
- { "ViewAntialiased", NULL, N_("_AntiAliased"), NULL, NULL, NULL },
-#endif
{ "ViewShowgrid", NULL, N_("Show _Grid"), NULL, NULL, G_CALLBACK (view_visible_grid_callback) },
{ "ViewSnaptogrid", NULL, N_("_Snap To Grid"), NULL, NULL, G_CALLBACK (view_snap_to_grid_callback) },
{ "ViewSnaptoobjects", NULL, N_("Snap To _Objects"), NULL, NULL, G_CALLBACK (view_snap_to_objects_callback) },
Modified: trunk/lib/Makefile.am
==============================================================================
--- trunk/lib/Makefile.am (original)
+++ trunk/lib/Makefile.am Fri May 30 14:00:36 2008
@@ -99,6 +99,8 @@
beziershape.h \
objchange.c \
objchange.h \
+ dialogs.c \
+ dialogs.h \
widgets.c \
widgets.h \
units.c \
Modified: trunk/lib/libdia.def
==============================================================================
--- trunk/lib/libdia.def (original)
+++ trunk/lib/libdia.def Fri May 30 14:00:36 2008
@@ -258,8 +258,10 @@
dia_image_width
dia_interactive_renderer_interface_get_type
- dia_libart_renderer_get_type
-
+
+ dialog_make
+ dialog_add_spinbutton
+
dia_line_chooser_new
dia_line_style_selector_get_linestyle
@@ -690,3 +692,9 @@
dia_object_get_enclosing_box
calculate_object_edge
+
+; exported for libart renderer only
+ dia_font_pop_context
+ dia_font_push_context
+ dia_transform_coords_double
+ text_line_adjust_layout_line
\ No newline at end of file
Modified: trunk/lib/makefile.msc
==============================================================================
--- trunk/lib/makefile.msc (original)
+++ trunk/lib/makefile.msc Fri May 30 14:00:36 2008
@@ -15,7 +15,6 @@
!IFDEF USEFT2
-DHAVE_FREETYPE $(FREETYPE2_CFLAGS) \
!ENDIF
- -DHAVE_LIBART $(LIBART_CFLAGS) \
-DLIBDIA_COMPILATION
# in GTK_CFLAGS: $(GLIB_CFLAGS)
@@ -25,7 +24,6 @@
$(PANGOFT2_LIBS) \
!ENDIF
$(LIBXML2_LIBS) $(ZLIB_LIBS) \
- $(LIBART_LIBS) \
$(GDK_PIXBUF_LIBS) \
$(INTL_LIBS)
@@ -55,6 +53,7 @@
debug.obj \
diaarrowchooser.obj \
dialinechooser.obj \
+ dialogs.obj \
diatransform.obj \
dia_dirs.obj \
dia_image.obj \
@@ -65,7 +64,6 @@
diagdkrenderer.obj \
diagtkfontsel.obj \
diainteractiverenderer.obj \
- dialibartrenderer.obj \
diarenderer.obj \
diasvgrenderer.obj \
dynamic_obj.obj \
Added: trunk/plug-ins/libart/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/plug-ins/libart/Makefile.am Fri May 30 14:00:36 2008
@@ -0,0 +1,20 @@
+
+plugin_sources = \
+ dialibart.c \
+ dialibartrenderer.c \
+ dialibartrenderer.h \
+ render_libart.h \
+ render_libart.c \
+ export_png.c
+
+pkglib_LTLIBRARIES = libart_filter.la
+
+EXTRA_DIST =
+
+libart_filter_la_SOURCES = $(plugin_sources)
+
+libart_filter_la_LDFLAGS = -export-dynamic -module -avoid-version
+
+libart_filter_la_LIBADD = $(LIBART_LIBS) $(LIBPNG_LIBS)
+
+INCLUDES = -I$(srcdir)/../../lib $(GTK_CFLAGS) $(DEBUG_FLAGS) $(LIBART_CFLAGS) $(LIBPNG_CFLAGS)
Copied: trunk/plug-ins/libart/dialibartrenderer.c (from r4055, /trunk/lib/dialibartrenderer.c)
==============================================================================
--- /trunk/lib/dialibartrenderer.c (original)
+++ trunk/plug-ins/libart/dialibartrenderer.c Fri May 30 14:00:36 2008
@@ -1400,6 +1400,46 @@
return object_type;
}
+enum {
+ PROP_0,
+ PROP_TRANSFORM
+};
+
+static void
+dia_libart_interactive_renderer_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ DiaLibartRenderer *renderer = DIA_LIBART_RENDERER (object);
+
+ switch (prop_id) {
+ case PROP_TRANSFORM:
+ renderer->transform = g_value_get_pointer(value);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+dia_libart_interactive_renderer_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ DiaLibartRenderer *renderer = DIA_LIBART_RENDERER (object);
+
+ switch (prop_id) {
+ case PROP_TRANSFORM:
+ g_value_set_pointer (value, renderer->transform);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static void
dia_libart_renderer_class_init (DiaLibartRendererClass *klass)
{
@@ -1410,6 +1450,16 @@
gobject_class->finalize = renderer_finalize;
+ gobject_class->set_property = dia_libart_interactive_renderer_set_property;
+ gobject_class->get_property = dia_libart_interactive_renderer_get_property;
+
+ g_object_class_install_property (gobject_class,
+ PROP_TRANSFORM,
+ g_param_spec_pointer ("transform",
+ _("Renderer transformation"),
+ _("Transform pointer"),
+ G_PARAM_READWRITE));
+
/* Here we set the functions that we define for this renderer. */
renderer_class->get_width_pixels = get_width_pixels;
renderer_class->get_height_pixels = get_height_pixels;
Copied: trunk/plug-ins/libart/export_png.c (from r4055, /trunk/app/export_png.c)
==============================================================================
--- /trunk/app/export_png.c (original)
+++ trunk/plug-ins/libart/export_png.c Fri May 30 14:00:36 2008
@@ -27,6 +27,7 @@
#include <png.h>
#include <string.h>
#include <errno.h>
+#include <stdlib.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
@@ -36,9 +37,27 @@
#include "render_libart.h"
#include "dialibartrenderer.h"
#include "message.h"
-#include "app_procs.h"
#include "dialogs.h"
+
+/* parses a string of the form "[0-9]*x[0-9]*" and transforms it into
+ two long values width and height. */
+static void
+parse_size(gchar *size, long *width, long *height)
+{
+ if (size) {
+ gchar** array = g_strsplit(size, "x", 3);
+ *width = (array[0])? strtol(array[0], NULL, 10): 0;
+ *height = (array[1])? strtol(array[1], NULL, 10): 0;
+ g_strfreev(array);
+ }
+ else {
+ *width = 0;
+ *height = 0;
+ }
+}
+
+
/* the dots per centimetre to render this diagram at */
/* this matches the setting `100%' setting in dia. */
#define DPCM 20
@@ -91,7 +110,7 @@
width = (guint32) ((ext->right - ext->left) * DPCM * data->paper.scaling);
height = (guint32) ((ext->bottom - ext->top) * DPCM * data->paper.scaling);
- if (app_is_interactive()) {
+ if (button != NULL) {
/* We don't want multiple clicks:) */
gtk_widget_hide(export_png_dialog);
@@ -165,7 +184,7 @@
}
/* the compiler said these may be clobbered by setjmp, so we set it again
* here. */
- if (app_is_interactive()) {
+ if (button != NULL) {
imagewidth = gtk_spin_button_get_value_as_int(export_png_width_entry);
imageheight = gtk_spin_button_get_value_as_int(export_png_height_entry);
} else {
@@ -235,7 +254,7 @@
error:
g_object_unref(renderer);
- if (app_is_interactive()) {
+ if (button != NULL) {
gtk_signal_disconnect_by_data(GTK_OBJECT(export_png_okay_button),
userdata);
gtk_signal_disconnect_by_data(GTK_OBJECT(export_png_cancel_button),
@@ -298,7 +317,7 @@
the same time will lead to confusion.
*/
- if (export_png_dialog == NULL && app_is_interactive()) {
+ if (export_png_dialog == NULL && user_data == NULL) {
/* Create a dialog */
export_png_dialog = dialog_make(_("PNG Export Options"),
_("Export"), NULL,
@@ -326,7 +345,7 @@
cbdata->data = data;
cbdata->filename = g_strdup(filename);
- if (app_is_interactive()) {
+ if (user_data == NULL) {
/* Find the default size */
width = (guint32) ((ext->right - ext->left) * DPCM * data->paper.scaling);
height = (guint32) ((ext->bottom - ext->top) * DPCM * data->paper.scaling);
Modified: trunk/plug-ins/makefile.msc
==============================================================================
--- trunk/plug-ins/makefile.msc (original)
+++ trunk/plug-ins/makefile.msc Fri May 30 14:00:36 2008
@@ -1,7 +1,7 @@
!IFNDEF PACKAGE
# dummy sissi
-PLUGINS = gprint cairo cgm dxf hpgl metapost pgf pixbuf \
+PLUGINS = gprint cairo cgm dxf hpgl libart metapost pgf pixbuf \
postscript pstricks shape svg vdx wmf wpg xfig xslt
#broken since StdProp overhaul : diaimport
@@ -73,6 +73,16 @@
!ENDIF
+!IFDEF OBJ_libart
+PKG_CFLAGS = $(PKG_CFLAGS) -DHAVE_LIBART -DHAVE_LIBPNG $(LIBART_CFLAGS) $(PNG_CFLAGS)
+PKG_LINK = $(PKG_LINK) $(LIBART_LIBS) $(PNG_LIBS)
+OBJECTS = \
+ dialibart.obj \
+ export_png.obj \
+ render_libart.obj \
+ dialibartrenderer.obj
+!ENDIF
+
!IFDEF OBJ_metapost
OBJECTS = \
metapost.obj \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]