win32.cpp revision 840c7e40984a84ece8179242a97caa01b52810d9
#define __SP_MODULE_WIN32_C__
/*
* Windows stuff
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* This code is in public domain
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <libnr/nr-macros.h>
#include <libnr/nr-matrix.h>
#include "display/nr-arena-item.h"
#include "display/nr-arena.h"
#include "document.h"
#include "win32.h"
/* Initialization */
namespace Inkscape {
namespace Extension {
namespace Internal {
static unsigned int SPWin32Modal = FALSE;
/**
* Callback function.. not a method
*/
static void
{
if (SPWin32Modal) {
/* Win32 widget is modal, filter events */
case GDK_NOTHING:
case GDK_DELETE:
case GDK_SCROLL:
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
case GDK_DRAG_STATUS:
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
case GDK_DROP_START:
case GDK_DROP_FINISHED:
return;
break;
default:
break;
}
}
}
void
{
}
void
PrintWin32::finish (void)
{
}
#define SP_FOREIGN_MAX_ITER 10
/**
* Callback function.. not a method
*/
{
int cdown = 0;
}
}
/* Platform detection */
{
static OSVERSIONINFOA osver;
if ( !initialized )
{
initialized = TRUE;
if (result)
{
}
// If we can't even call to get the version, fall back to ANSI API
}
return is_wide;
}
/* Printing */
PrintWin32::PrintWin32 (void)
{
/* Nothing here */
}
PrintWin32::~PrintWin32 (void)
{
}
/**
* Callback function.. not a method
*/
{
#if 0
int cdown = 0;
}
#endif
return 0;
}
unsigned int
{
sizeof (PRINTDLG),
NULL, /* hwndOwner */
NULL, /* hDevMode */
NULL, /* hDevNames */
NULL, /* hDC */
1, 1, 1, 1, /* nFromPage, nToPage, nMinPage, nMaxPage */
1, /* nCoies */
NULL, /* hInstance */
0, /* lCustData */
};
SPWin32Modal = TRUE;
#if 0
if (caps & RC_BANDING) {
printf ("needs banding\n");
}
printf ("does bitblt\n");
}
if (caps & RC_DIBTODEV) {
printf ("does dibtodev\n");
}
if (caps & RC_STRETCHDIB) {
printf ("does stretchdib\n");
}
#endif
}
}
return TRUE;
}
unsigned int
{
sizeof (DOCINFO),
NULL, /* lpszDocName */
NULL, /* lpszOutput */
NULL, /* lpszDatatype */
0 /* DI_APPBANDING */ /* fwType */
};
int res;
SPWin32Modal = TRUE;
return 0;
}
unsigned int
{
unsigned char *px;
BITMAPINFO bmInfo = {
{
sizeof (BITMAPINFOHEADER), // bV4Size
64, // biWidth
64, // biHeight
1, // biPlanes
32, // biBitCount
BI_RGB, // biCompression
0, // biSizeImage
2835, // biXPelsPerMeter
2835, // biYPelsPerMeter
0, // biClrUsed
0 // biClrImportant
},
{ { 0, 0, 0, 0 } } // bmiColors
};
//RECT wrect;
int res;
SPWin32Modal = TRUE;
// Number of pixels per logical inch
// Size in pixels of the printable area
// Top left corner of prontable area
// Size in pixels of the printable area
// Scaling from document to device
// We simply map document 0,0 to physical page 0,0
// Calculate printable area in device coordinates
sheight = 64;
/* Printing goes here */
int num_rows;
int i;
/* Set area of interest */
/* Update to renderable state */
nr_arena_item_invoke_update (mod->root, &bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
nr_pixblock_setup_extern (&pb, NR_PIXBLOCK_MODE_R8G8B8A8N, bbox.x0, bbox.y0, bbox.x1, bbox.y1, px, 4 * (bbox.x1 - bbox.x0), FALSE, FALSE);
/* Blitter goes here */
/* Render */
/* Swap red and blue channels; we use RGBA, whereas
* the Win32 GDI uses BGRx.
*/
}
px,
&bmInfo,
SRCCOPY);
/* Blitter ends here */
}
return 0;
}
/* File dialogs */
char *
{
char fnbuf[4096] = {0};
OPENFILENAME ofn = {
sizeof (OPENFILENAME),
NULL, /* hwndOwner */
NULL, /* hInstance */
NULL, /* lpstrCustomFilter */
0, /* nMaxCustFilter */
1, /* nFilterIndex */
fnbuf, /* lpstrFile */
sizeof (fnbuf), /* nMaxFile */
NULL, /* lpstrFileTitle */
0, /* nMaxFileTitle */
0, /* nFileOffset */
0, /* nFileExtension */
NULL, /* lpstrDefExt */
0, /* lCustData */
NULL, /* lpfnHook */
NULL /* lpTemplateName */
};
int retval;
SPWin32Modal = TRUE;
if (!retval) {
int errcode;
return NULL;
}
}
char *
{
return NULL;
}
char *
{
char fnbuf[4096] = {0};
OPENFILENAME ofn = {
sizeof (OPENFILENAME),
NULL, /* hwndOwner */
NULL, /* hInstance */
"Inkscape SVG (*.svg)\0*\0Plain SVG (*.svg)\0*\0", /* lpstrFilter */
NULL, /* lpstrCustomFilter */
0, /* nMaxCustFilter */
1, /* nFilterIndex */
fnbuf, /* lpstrFile */
sizeof (fnbuf), /* nMaxFile */
NULL, /* lpstrFileTitle */
0, /* nMaxFileTitle */
"Save document to file", /* lpstrTitle */
OFN_HIDEREADONLY, /* Flags */
0, /* nFileOffset */
0, /* nFileExtension */
NULL, /* lpstrDefExt */
0, /* lCustData */
NULL, /* lpfnHook */
NULL /* lpTemplateName */
};
int retval;
SPWin32Modal = TRUE;
if (!retval) {
int errcode;
return NULL;
}
}
#include "clear-n_.h"
void
PrintWin32::init (void)
{
/* SVG in */
"<param name=\"textToPath\" type=\"boolean\">true</param>\n"
"<print/>\n"
"</inkscape-extension>", new PrintWin32());
return;
}
} /* namespace Internal */
} /* namespace Extension */
} /* namespace Inkscape */