summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswprint.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-22 14:05:41 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-22 14:05:41 +0200
commitb55285a77da0e0b829e4ce8d7e09debaabc68e15 (patch)
treef622559ef65bbdd3e1c5bdb06098a8f89eec0563 /app/wlib/mswlib/mswprint.c
parentd3897ce090dbeb220ed2c782f095597e417cf3cc (diff)
parentd1ae75703e1ed81d65ea16946dcdb77e7a13adc9 (diff)
Merge branch 'feature/upstream' into develop
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 )
-{
-}