dia r4016 - in trunk: . app lib objects/standard plug-ins plug-ins/cairo plug-ins/python plug-ins/wmf
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4016 - in trunk: . app lib objects/standard plug-ins plug-ins/cairo plug-ins/python plug-ins/wmf
- Date: Sun, 11 May 2008 13:25:48 +0100 (BST)
Author: hans
Date: Sun May 11 12:25:47 2008
New Revision: 4016
URL: http://svn.gnome.org/viewvc/dia?rev=4016&view=rev
Log:
2008-05-11 Hans Breuer <hans breuer org>
* lib/filer.h app/menus.c : changed signature of DiaCallbackFunc to
additionally take an optional file name
* plug-ins/cairo/diacairo-print.[ch] plug-ins/python/diamodule.c :
adapted to the new signature
* app/paginate_gdiprint.(h|cpp) : move to ...
plug-ins/wmf/paginate_gdiprint.(h|cpp) plug-ins/wmf/wmf.cpp : ...
and make it work as a plug-in, temporary registered as "Print (GDI)"
Added:
trunk/plug-ins/wmf/paginate_gdiprint.cpp
- copied, changed from r3992, /trunk/app/paginate_gdiprint.cpp
trunk/plug-ins/wmf/paginate_gdiprint.h
- copied, changed from r3992, /trunk/app/paginate_gdiprint.h
Removed:
trunk/app/paginate_gdiprint.cpp
trunk/app/paginate_gdiprint.h
Modified:
trunk/ChangeLog
trunk/app/menus.c
trunk/lib/filter.h
trunk/objects/standard/outline.c
trunk/plug-ins/cairo/diacairo-print.c
trunk/plug-ins/cairo/diacairo-print.h
trunk/plug-ins/makefile.msc
trunk/plug-ins/python/diamodule.c
trunk/plug-ins/wmf/wmf.cpp
Modified: trunk/app/menus.c
==============================================================================
--- trunk/app/menus.c (original)
+++ trunk/app/menus.c Sun May 11 12:25:47 2008
@@ -1294,6 +1294,6 @@
if (cbf->callback) {
DDisplay *ddisp = ddisplay_active();
DiagramData* diadata = ddisp ? ddisp->diagram->data : NULL;
- cbf->callback (diadata, 0, cbf->user_data);
+ cbf->callback (diadata, ddisp->diagram->filename, 0, cbf->user_data);
}
}
Modified: trunk/lib/filter.h
==============================================================================
--- trunk/lib/filter.h (original)
+++ trunk/lib/filter.h Sun May 11 12:25:47 2008
@@ -74,6 +74,7 @@
/* gets called as menu callback */
typedef void (* DiaCallbackFunc) (DiagramData *dia,
+ const gchar *filename, /* the original filename */
guint flags, /* further additions */
void* user_data);
Modified: trunk/objects/standard/outline.c
==============================================================================
--- trunk/objects/standard/outline.c (original)
+++ trunk/objects/standard/outline.c Sun May 11 12:25:47 2008
@@ -413,8 +413,9 @@
n = i;
}
}
- /* the last one */
- DIA_RENDERER_GET_CLASS (renderer)->draw_bezier (renderer, &pts[n], i - n - 1, &outline->line_color);
+ /* the last one, if there is one */
+ if (i - n - 1 > 0)
+ DIA_RENDERER_GET_CLASS (renderer)->draw_bezier (renderer, &pts[n], i - n - 1, &outline->line_color);
}
#if 0 /* returning NULL crashes Dia, the method must be NULL if there is nothing to do */
static DiaMenu *
Modified: trunk/plug-ins/cairo/diacairo-print.c
==============================================================================
--- trunk/plug-ins/cairo/diacairo-print.c (original)
+++ trunk/plug-ins/cairo/diacairo-print.c Sun May 11 12:25:47 2008
@@ -225,10 +225,11 @@
void
cairo_print_callback (DiagramData *data,
+ const gchar *filename,
guint flags, /* further additions */
void *user_data)
{
- GtkPrintOperation *op = create_print_operation (data, "diagram");
+ GtkPrintOperation *op = create_print_operation (data, filename ? filename : "diagram");
GtkPrintOperationResult res;
GError *error = NULL;
Modified: trunk/plug-ins/cairo/diacairo-print.h
==============================================================================
--- trunk/plug-ins/cairo/diacairo-print.h (original)
+++ trunk/plug-ins/cairo/diacairo-print.h Sun May 11 12:25:47 2008
@@ -11,6 +11,7 @@
void
cairo_print_callback (DiagramData *dia,
+ const gchar *filename,
guint flags, /* further additions */
void *user_data);
#endif
Modified: trunk/plug-ins/makefile.msc
==============================================================================
--- trunk/plug-ins/makefile.msc (original)
+++ trunk/plug-ins/makefile.msc Sun May 11 12:25:47 2008
@@ -1,7 +1,8 @@
!IFNDEF PACKAGE
# dummy sissi
-PLUGINS = gprint cairo cgm dxf hpgl metapost pgf pixbuf pstricks shape svg vdx wmf wpg xfig xslt
+PLUGINS = gprint cairo cgm dxf hpgl metapost pgf pixbuf \
+ postscript pstricks shape svg vdx wmf wpg xfig xslt
#broken since StdProp overhaul : diaimport
@@ -84,6 +85,23 @@
render_pstricks.obj
!ENDIF
+!IFDEF OBJ_postscript
+OBJECTS = \
+ render_eps.obj \
+ paginate_psprint.obj \
+!IFDEF USEFT2
+ diapsft2renderer.obj \
+!ENDIF
+ diapsrenderer.obj \
+ win32print.obj \
+ postscript.obj
+
+PKG_LINK = $(PKG_LINK) winspool.lib \
+!IFDEF USEFT2
+ $(PANGOFT2_LIBS) $(FREETYPE2_LIBS) \
+!ENDIF
+!ENDIF
+
!IFDEF OBJ_pgf
OBJECTS = \
pgf.obj \
@@ -113,8 +131,9 @@
!ENDIF
!IFDEF OBJ_wmf
-PKG_LINK = $(PKG_LINK) $(PANGOWIN32_LIBS)
+PKG_LINK = $(PKG_LINK) $(PANGOWIN32_LIBS) comdlg32.lib winspool.lib
OBJECTS = \
+ paginate_gdiprint.obj \
wmf.obj \
wmf_gdi.obj
!ENDIF
Modified: trunk/plug-ins/python/diamodule.c
==============================================================================
--- trunk/plug-ins/python/diamodule.c (original)
+++ trunk/plug-ins/python/diamodule.c Sun May 11 12:25:47 2008
@@ -326,7 +326,7 @@
* dia.register_action (or dia.register_callback)
*/
static void
-PyDia_callback_func (DiagramData *dia, guint flags, void *user_data)
+PyDia_callback_func (DiagramData *dia, const gchar *filename, guint flags, void *user_data)
{
PyObject *diaobj, *res, *arg, *func = user_data;
if (!func || !PyCallable_Check (func)) {
Copied: trunk/plug-ins/wmf/paginate_gdiprint.cpp (from r3992, /trunk/app/paginate_gdiprint.cpp)
==============================================================================
--- /trunk/app/paginate_gdiprint.cpp (original)
+++ trunk/plug-ins/wmf/paginate_gdiprint.cpp Sun May 11 12:25:47 2008
@@ -33,13 +33,10 @@
// it's so ugly --hb ;(
// include before, cause it has extern "C" already
-#if 1
-extern "C" {
-
#include "paginate_gdiprint.h"
-#include "diagram.h"
-#include "diagramdata.h"
+#if 1
+extern "C" {
#include "filter.h"
@@ -87,7 +84,7 @@
}
static void
-paginate_gdiprint(Diagram *dia, DiaExportFilter* pExp, W32::HANDLE hDC)
+paginate_gdiprint(DiagramData *data, DiaExportFilter* pExp, W32::HANDLE hDC)
{
Rectangle *extents;
gdouble width, height;
@@ -96,15 +93,15 @@
guint nobjs = 0;
/* the usable area of the page */
- width = dia->data->paper.width;
- height = dia->data->paper.height;
+ width = data->paper.width;
+ height = data->paper.height;
/* get extents, and make them multiples of width / height */
- extents = &dia->data->extents;
+ extents = &data->extents;
initx = extents->left;
inity = extents->top;
/* make page boundaries align with origin */
- if (!dia->data->paper.fitto) {
+ if (!data->paper.fitto) {
initx = floor(initx / width) * width;
inity = floor(inity / height) * height;
}
@@ -125,7 +122,7 @@
page_bounds.top = y;
page_bounds.bottom = y + height;
- nobjs += print_page(dia->data, pExp, hDC, &page_bounds, xpos, ypos);
+ nobjs += print_page(data, pExp, hDC, &page_bounds, xpos, ypos);
}
}
}
@@ -136,7 +133,7 @@
extern "C"
void
-diagram_print_gdi(Diagram *dia)
+diagram_print_gdi(DiagramData *data, const gchar *filename)
{
W32::PRINTDLG printDlg;
W32::DOCINFO docInfo;
@@ -171,7 +168,7 @@
if (pDevMode) {
/* initialize with Dia default */
pDevMode->dmFields |= DM_ORIENTATION;
- pDevMode->dmOrientation = dia->data->paper.is_portrait ?
+ pDevMode->dmOrientation = data->paper.is_portrait ?
DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
/* Maybe we could adjust the scaling here as well but are al of:
@@ -212,7 +209,7 @@
/* W32::GetDeviceCaps(print_dlg.hDC, RASTERCAPS) */
docInfo.cbSize = sizeof(W32::DOCINFO);
- docInfo.lpszDocName = dia->filename;
+ docInfo.lpszDocName = filename;
if (printDlg.Flags & PD_PRINTTOFILE)
docInfo.lpszOutput = "FILE:";
else
@@ -224,7 +221,7 @@
if (0 >= W32::StartDoc(printDlg.hDC, &docInfo))
ERROR_RETURN(W32::GetLastError());
for (i = 0; i < printDlg.nCopies; i++)
- paginate_gdiprint(dia, pExp, printDlg.hDC);
+ paginate_gdiprint(data, pExp, printDlg.hDC);
/* clean up */
if (0 >= W32::EndDoc(printDlg.hDC))
Copied: trunk/plug-ins/wmf/paginate_gdiprint.h (from r3992, /trunk/app/paginate_gdiprint.h)
==============================================================================
--- /trunk/app/paginate_gdiprint.h (original)
+++ trunk/plug-ins/wmf/paginate_gdiprint.h Sun May 11 12:25:47 2008
@@ -1,8 +1,8 @@
#ifndef _PAGINATE_GDIPRINT_H
#define _PAGINATE_GDIPRINT_H
-typedef struct _Diagram Diagram;
+#include "diagramdata.h"
-void diagram_print_gdi(Diagram *dia);
+extern "C" void diagram_print_gdi(DiagramData *data, const gchar* filename);
#endif
Modified: trunk/plug-ins/wmf/wmf.cpp
==============================================================================
--- trunk/plug-ins/wmf/wmf.cpp (original)
+++ trunk/plug-ins/wmf/wmf.cpp Sun May 11 12:25:47 2008
@@ -42,6 +42,8 @@
}
#endif
+#include "paginate_gdiprint.h"
+
#if defined HAVE_WINDOWS_H || defined G_OS_WIN32
namespace W32 {
// at least Rectangle conflicts ...
@@ -1376,6 +1378,25 @@
"emf"
};
+#ifdef G_OS_WIN32
+static void
+print_callback (DiagramData *data,
+ const gchar *filename,
+ guint flags,
+ void *user_data)
+{
+ diagram_print_gdi (data, filename);
+}
+
+static DiaCallbackFilter cb_gdi_print = {
+ "FilePrintGDI",
+ N_("Print (GDI) ..."),
+ "/DisplayMenu/File/FilePrint",
+ print_callback,
+ NULL
+};
+#endif
+
/* --- dia plug-in interface --- */
DIA_PLUGIN_CHECK_INIT
@@ -1396,6 +1417,8 @@
*/
filter_register_export(&wmf_export_filter);
filter_register_export(&emf_export_filter);
+
+ filter_register_callback (&cb_gdi_print);
#elif HAVE_LIBEMF
/* not sure if libEMF really saves EMF ;) */
filter_register_export(&emf_export_filter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]