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:12 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:12 +0200
commite50482f994b6ebcce864a412111d376e99205cdb (patch)
treeff3192c6aaf213c4922521bed988e4ed4147f537 /app/wlib/mswlib/mswprint.c
parentd3897ce090dbeb220ed2c782f095597e417cf3cc (diff)
parentb623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff)
Update upstream source from tag 'upstream/5.2.0Beta2.1'
Update to upstream version '5.2.0Beta2.1' with Debian dir 1576f25f4c1496abfed44af31ead67d32c7be650
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 )
-{
-}