summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswprint.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:00 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:00 +0200
commitb623f5953691b2a0614e6f1f4def86bdbb9a4113 (patch)
tree18102bd36f7e22eb2ba2b9f880e4cb29346f4cb8 /app/wlib/mswlib/mswprint.c
parent359b557176b9bb2ff1aed2082641eed39c358d0d (diff)
New upstream version 5.2.0Beta2.1upstream/5.2.0Beta2.1
Diffstat (limited to 'app/wlib/mswlib/mswprint.c')
-rw-r--r--app/wlib/mswlib/mswprint.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/app/wlib/mswlib/mswprint.c b/app/wlib/mswlib/mswprint.c
index 91f05ea..13756c7 100644
--- a/app/wlib/mswlib/mswprint.c
+++ b/app/wlib/mswlib/mswprint.c
@@ -27,7 +27,7 @@ struct tagPD printDlg;
#endif
static int printStatus = FALSE;
static DOCINFO docInfo;
-static double pageSizeW = 8.5, pageSizeH = 11.0;
+static double tBorder = 0.0, rBorder = 0.0, bBorder = 0.0, lBorder = 0.0;
static double physSizeW = 8.5, physSizeH = 11.0;
static int pageCount = -1;
@@ -66,10 +66,16 @@ void getPageDim( HDC hDc )
size_h = GetDeviceCaps( hDc, VERTSIZE );
print_d.w = res_w = GetDeviceCaps( hDc, HORZRES );
print_d.h = res_h = GetDeviceCaps( hDc, VERTRES );
+ double pageSizeW, pageSizeH;
pageSizeW = ((double)res_w)/print_d.wFactor;
pageSizeH = ((double)res_h)/print_d.hFactor;
physSizeW = ((double)dims.x)/print_d.wFactor;
physSizeH = ((double)dims.y)/print_d.hFactor;
+ // Get Borders/Margins - offs are the top, left borders
+ lBorder = ((double)offs.x)/print_d.hFactor;
+ tBorder = ((double)offs.y)/print_d.hFactor;
+ rBorder = physSizeW-pageSizeW-lBorder;
+ bBorder = physSizeH-pageSizeH-tBorder;
}
static wBool_t printInit( void )
@@ -83,6 +89,7 @@ static wBool_t printInit( void )
return printerOk;
}
initted = TRUE;
+ memset(&printDlg, 0, sizeof printDlg);
printDlg.lStructSize = sizeof printDlg;
printDlg.hwndOwner = NULL;
printDlg.Flags = PD_RETURNDC|PD_RETURNDEFAULT;
@@ -194,16 +201,36 @@ void wPrintSetup( wPrintSetupCallBack_p callback )
}
}
+const char* wPrintGetName()
+{
+ static char sPrinterName[100];
+ HANDLE hDevNames = printDlg.hDevNames;
+ DEVNAMES* pDevNames = GlobalLock(hDevNames);
+ if (pDevNames == NULL) {
+ strcpy(sPrinterName, "Printer");
+ }
+ else {
+ strncpy(sPrinterName, (char*)pDevNames + pDevNames->wDeviceOffset, sizeof sPrinterName - 1);
+ sPrinterName[sizeof sPrinterName - 1] = '\0';
+ }
+ GlobalUnlock( hDevNames );
+ return sPrinterName;
+}
-void wPrintGetPageSize( double *w, double *h )
+void wPrintGetMargins(
+ double * tMargin,
+ double * rMargin,
+ double * bMargin,
+ double * lMargin )
{
- printInit();
- *w = pageSizeW;
- *h = pageSizeH;
+ if ( tMargin ) *tMargin = tBorder;
+ if ( rMargin ) *rMargin = rBorder;
+ if ( bMargin ) *bMargin = bBorder;
+ if ( lMargin ) *lMargin = lBorder;
}
-void wPrintGetPhysSize( double *w, double *h )
+void wPrintGetPageSize( double *w, double *h )
{
printInit();
*w = physSizeW;
@@ -378,10 +405,3 @@ wBool_t wPrintNewMargin( const char * name, double t, double b, double l, double
{
return TRUE;
}
-
-void wPrintSetCallBacks(
- wAddPrinterCallBack_p newPrinter,
- wAddMarginCallBack_p newMargin,
- wAddFontAliasCallBack_p newFontAlias )
-{
-}