Changeset 102 for trunk/Lucide


Ignore:
Timestamp:
Aug 25, 2006, 7:21:30 PM (15 years ago)
Author:
Eugene Romanenko
Message:

printer dialog and basic print features completed

Location:
trunk/Lucide
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/BIN/Lucide.lng

    r99 r102  
    166166PD_JOB_PROPERTIES=~Job properties
    167167PD_DRIVER_LABEL=Driver
    168 PD_PRINT_RANGE=Print ~range
     168PD_PRINT_RANGE_AND_COPIES=Print ~range and copies
    169169PD_RANGE_ALL=~All
    170170PD_RANGE_CURRENT_PAGE=C~urrent page
     
    172172PD_FROM=~From
    173173PD_TO=~To
     174PD_NUMBER_OF_COPIES=~Number of copies
    174175PD_PRINT_TYPE=Print type
    175176PD_TYPE_POSTSCRIPT=Post~script
    176177PD_TYPE_ASIMAGE=As ~image
    177178PD_HIGHER_IMAGE_QUALITY=~Higher image quality (slower and require more memory)
     179PD_PAGE_ORIENTATION=Page orientation
     180PD_PORTRAIT=Portrait
     181PD_LANDSCAPE=Landscape
     182PD_MARGINS=Margins (mm)
     183PD_MLEFT=Left
     184PD_MRIGHT=Right
     185PD_MTOP=Top
     186PD_MBOTTOM=Bottom
     187PD_SELECTED_FORM=Selected form
    178188PD_BTNPRINT=~Print
    179189PD_BTNCANCEL=~Cancel
     190PD_WRONG_MARGINS=Wrong margins!
    180191# other 'print'-related messages
    181192PRINT_PRINTING_PAGE_OF=Printing page %d of %d...
     
    183194PRINT_SPOOLING_POSTSCRIPT=Spooling postscript data...
    184195PRINT_FAILED=Print failed!
     196
  • trunk/Lucide/BIN/Lucide_de.lng

    r101 r102  
    162162PD_JOB_PROPERTIES=~Job-Eigenschaften
    163163PD_DRIVER_LABEL=Treiber
    164 PD_PRINT_RANGE=D~ruckbereich
     164#? PD_PRINT_RANGE_AND_COPIES=Print ~range and copies
    165165PD_RANGE_ALL=A~lles
    166166PD_RANGE_CURRENT_PAGE=A~ktuelle Seite
     
    168168PD_FROM=~Von
    169169PD_TO=B~is
     170#? PD_NUMBER_OF_COPIES=~Number of copies
    170171PD_PRINT_TYPE=Druckformat
    171172PD_TYPE_POSTSCRIPT=Post~script
  • trunk/Lucide/SOURCE/gui/Lucide_res.H

    r93 r102  
    139139#define IDC_LABELTO         18
    140140#define IDC_PGTO            19
    141 #define IDC_TYPE_POSTSCRIPT     201
    142 #define IDC_TYPE_ASIMAGE        21
    143 #define IDC_HIGHER_IMAGE_QUALITY        22
     141#define IDC_COPIES                      20
     142#define IDC_TYPE_POSTSCRIPT     21
     143#define IDC_TYPE_ASIMAGE        22
     144#define IDC_HIGHER_IMAGE_QUALITY        23
     145#define IDC_PORTRAIT            24
     146#define IDC_LANDSCAPE           25
     147#define IDC_MLEFT                       26
     148#define IDC_MRIGHT                      27
     149#define IDC_MTOP                        28
     150#define IDC_MBOTTOM                     29
     151#define IDC_SELECTED_FORM       30
    144152
    145153
  • trunk/Lucide/SOURCE/gui/dialogs.rc

    r90 r102  
    134134DLGTEMPLATE IDD_PRINT
    135135BEGIN
    136         DIALOG "PD_TITLE", -1, 67, 28, 258, 155, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR
    137         BEGIN
    138                 CONTROL "PD_PRINTER", -1, 2, 117, 253, 35, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
    139                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    140                 CONTROL "PD_NAME_LABEL", -1, 8, 134, 40, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
    141                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    142                 CONTROL "", IDC_PNAME, 53, 100, 115, 43, WC_COMBOBOX, CBS_DROPDOWNLIST | ES_ANY | WS_VISIBLE | WS_GROUP | WS_TABSTOP
    143                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    144                 CONTROL "PD_JOB_PROPERTIES", IDC_JOBPROPERTIES, 174, 132, 78, 13, WC_BUTTON, BS_PUSHBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_DISABLED
    145                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    146                 CONTROL "PD_DRIVER_LABEL", -1, 8, 121, 40, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
    147                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    148                 CONTROL "", IDC_PDESCRIPTION, 53, 121, 196, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
    149                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    150                 CONTROL "PD_PRINT_RANGE", -1, 2, 75, 253, 40, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
    151                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    152                 CONTROL "PD_RANGE_ALL", IDC_RANGEALL, 9, 97, 106, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP
    153                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    154                 CONTROL "PD_RANGE_CURRENT_PAGE", IDC_RANGECURRENT, 9, 87, 106, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
    155                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    156                 CONTROL "PD_RANGE_PAGES", IDC_RANGEPAGES, 9, 77, 90, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
    157                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    158                 CONTROL "PD_FROM", IDC_LABELFROM, 102, 78, 35, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP | WS_DISABLED
    159                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    160                 CONTROL "", IDC_PGFROM, 138, 78, 39, 12, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_DISABLED
    161                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    162                 CONTROL "PD_TO", IDC_LABELTO, 183, 78, 22, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP | WS_DISABLED
    163                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    164                 CONTROL "", IDC_PGTO, 208, 78, 39, 12, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_DISABLED
    165                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    166                 CONTROL "PD_PRINT_TYPE", -1, 2, 33, 253, 40, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
    167                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    168                 CONTROL "PD_TYPE_POSTSCRIPT", IDC_TYPE_POSTSCRIPT, 9, 55, 240, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP
    169                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    170                 CONTROL "PD_TYPE_ASIMAGE", IDC_TYPE_ASIMAGE, 9, 45, 240, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
    171                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    172                 CONTROL "PD_HIGHER_IMAGE_QUALITY", IDC_HIGHER_IMAGE_QUALITY, 19, 35, 230, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP
    173                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    174                 DEFPUSHBUTTON "PD_BTNPRINT", DID_OK, 135, 6, 51, 14, WS_DISABLED
    175                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    176                 PUSHBUTTON "PD_BTNCANCEL", DID_CANCEL, 193, 6, 51, 14
    177                 PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    178         END
    179 END
    180 
     136        DIALOG "PD_TITLE", -1, 67, 30, 258, 207, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR
     137        BEGIN
     138                CONTROL "PD_PRINTER", -1, 2, 173, 253, 32, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     139                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     140                CONTROL "PD_NAME_LABEL", -1, 8, 187, 40, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     141                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     142                CONTROL "", IDC_PNAME, 53, 153, 115, 43, WC_COMBOBOX, CBS_DROPDOWNLIST | ES_ANY | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     143                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     144                CONTROL "PD_JOB_PROPERTIES", IDC_JOBPROPERTIES, 174, 185, 78, 13, WC_BUTTON, BS_PUSHBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_DISABLED
     145                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     146                CONTROL "PD_DRIVER_LABEL", -1, 8, 175, 40, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     147                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     148                CONTROL "", IDC_PDESCRIPTION, 53, 175, 196, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     149                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     150                CONTROL "PD_PRINT_RANGE_AND_COPIES", -1, 2, 132, 253, 40, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     151                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     152                CONTROL "PD_RANGE_ALL", IDC_RANGEALL, 9, 154, 106, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     153                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     154                CONTROL "PD_RANGE_CURRENT_PAGE", IDC_RANGECURRENT, 9, 144, 106, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
     155                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     156                CONTROL "PD_RANGE_PAGES", IDC_RANGEPAGES, 9, 134, 90, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
     157                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     158                CONTROL "PD_FROM", IDC_LABELFROM, 102, 135, 35, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP | WS_DISABLED
     159                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     160                CONTROL "", IDC_PGFROM, 138, 135, 39, 9, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_DISABLED
     161                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     162                CONTROL "PD_TO", IDC_LABELTO, 183, 135, 22, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP | WS_DISABLED
     163                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     164                CONTROL "", IDC_PGTO, 208, 135, 39, 9, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_DISABLED
     165                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     166                CONTROL "PD_NUMBER_OF_COPIES", -1, 120, 155, 85, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     167                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     168                CONTROL "", IDC_COPIES, 208, 155, 39, 9, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     169                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     170                CONTROL "PD_PRINT_TYPE", -1, 2, 91, 253, 40, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     171                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     172                CONTROL "PD_TYPE_POSTSCRIPT", IDC_TYPE_POSTSCRIPT, 9, 113, 240, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     173                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     174                CONTROL "PD_TYPE_ASIMAGE", IDC_TYPE_ASIMAGE, 9, 103, 240, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
     175                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     176                CONTROL "PD_HIGHER_IMAGE_QUALITY", IDC_HIGHER_IMAGE_QUALITY, 19, 93, 230, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     177                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     178                CONTROL "PD_PAGE_ORIENTATION", -1, 2, 70, 253, 20, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     179                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     180                CONTROL "PD_PORTRAIT", IDC_PORTRAIT, 9, 72, 118, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     181                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     182                CONTROL "PD_LANDSCAPE", IDC_LANDSCAPE, 131, 72, 118, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
     183                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     184                CONTROL "PD_MARGINS", -1, 2, 26, 253, 43, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     185                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     186                CONTROL "PD_MLEFT", -1, 9, 53, 51, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     187                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     188                CONTROL "", IDC_MLEFT, 61, 53, 50, 9, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     189                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     190                CONTROL "PD_MRIGHT", -1, 132, 53, 51, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     191                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     192                CONTROL "", IDC_MRIGHT, 184, 53, 50, 9, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     193                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     194                CONTROL "PD_MTOP", -1, 9, 42, 51, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     195                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     196                CONTROL "", IDC_MTOP, 61, 42, 50, 9, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     197                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     198                CONTROL "PD_MBOTTOM", -1, 132, 42, 51, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     199                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     200                CONTROL "", IDC_MBOTTOM, 184, 42, 50, 9, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     201                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     202                CONTROL "PD_SELECTED_FORM", -1, 9, 29, 101, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     203                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     204                CONTROL "", IDC_SELECTED_FORM, 132, 29, 118, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     205                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     206                DEFPUSHBUTTON "PD_BTNPRINT", DID_OK, 140, 5, 51, 14, WS_DISABLED
     207                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     208                PUSHBUTTON "PD_BTNCANCEL", DID_CANCEL, 198, 5, 51, 14
     209                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     210        END
     211
     212END
     213
  • trunk/Lucide/SOURCE/gui/lucide.cpp

    r91 r102  
    3737#define INCL_SPL
    3838#define INCL_SPLDOSPRINT
     39#define INCL_DEV
    3940#include <os2.h>
    4041
  • trunk/Lucide/SOURCE/gui/makefile

    r91 r102  
    11.autodepend
    22
    3 TEST=0
     3TEST=1
    44VERSION=Beta 2.1
    55
  • trunk/Lucide/SOURCE/gui/messages.cpp

    r99 r102  
    101101
    102102// Printing, other 'print'-related messages
     103const char *PD_WRONG_MARGINS            = "PD_WRONG_MARGINS";
    103104const char *PRINT_PRINTING_PAGE_OF      = "PRINT_PRINTING_PAGE_OF";
    104105const char *PRINT_GENERATING_POSTSCRIPT = "PRINT_GENERATING_POSTSCRIPT";
  • trunk/Lucide/SOURCE/gui/messages.h

    r99 r102  
    101101
    102102// Printing, other 'print'-related messages
     103extern const char *PD_WRONG_MARGINS;
    103104extern const char *PRINT_PRINTING_PAGE_OF;
    104105extern const char *PRINT_GENERATING_POSTSCRIPT;
  • trunk/Lucide/SOURCE/gui/print.cpp

    r96 r102  
    6969#define HIGH_IMAGE_ZOOM     3.0
    7070#define PS_PRINT_BUF_SIZE   32768
    71 #define TEST_MARGIN         10
    7271
    7372
     
    134133{
    135134    CHAR         achDriverName[ DRIVERNAME_LENGTH ] = "";
     135    CHAR         achQueueProcParams[ 8 ] = "";
    136136    DEVOPENSTRUC dos   = { 0 };
    137137    SIZEL        sizel = { 0 };
     
    143143
    144144    // build a devopenstruct for the call to DevOpenDC
    145     dos.pszLogAddress = psetup->QueueInfo.pszName;              // 1
     145    dos.pszLogAddress      = psetup->QueueInfo.pszName;              // 1
    146146    strcpy( achDriverName, psetup->QueueInfo.pszDriverName );
    147147    achDriverName[ strcspn( achDriverName, "." ) ] = '\0';
    148     dos.pszDriverName = achDriverName;                          // 2
    149     dos.pdriv         = psetup->QueueInfo.pDriverData;          // 3
    150     dos.pszDataType   = "PM_Q_STD";                             // 4
    151 
    152     HDC hdcPrinter = DevOpenDC( lhab, OD_QUEUED, "*", 4L, (PDEVOPENDATA)&dos, NULLHANDLE );
     148    dos.pszDriverName      = achDriverName;                          // 2
     149    dos.pdriv              = psetup->QueueInfo.pDriverData;          // 3
     150    dos.pszDataType        = "PM_Q_STD";                             // 4
     151    dos.pszComment         = (PSZ)appName;                           // 5
     152    dos.pszQueueProcName   = NULL;                                   // 6
     153    snprintf( achQueueProcParams, sizeof( achQueueProcParams ), "COP=%d", psetup->copies );
     154    dos.pszQueueProcParams = achQueueProcParams;                     // 7
     155
     156    HDC hdcPrinter = DevOpenDC( lhab, OD_QUEUED, "*", 7L, (PDEVOPENDATA)&dos, NULLHANDLE );
    153157    if ( hdcPrinter == DEV_ERROR ) {
    154158        return false;
     
    205209
    206210    // Magrins
    207     LONG mLeft   = __max( TEST_MARGIN, pcurForm->xLeftClip );
    208     LONG mBottom = __max( TEST_MARGIN, pcurForm->yBottomClip );
    209     LONG mRight  = __max( TEST_MARGIN, pcurForm->cx - pcurForm->xRightClip );
    210     LONG mTop    = __max( TEST_MARGIN, pcurForm->cy - pcurForm->yTopClip );
     211    LONG mLeft   = __max( psetup->margin_left, pcurForm->xLeftClip );
     212    LONG mBottom = __max( psetup->margin_bottom, pcurForm->yBottomClip );
     213    LONG mRight  = __max( psetup->margin_right, pcurForm->cx - pcurForm->xRightClip );
     214    LONG mTop    = __max( psetup->margin_top, pcurForm->cy - pcurForm->yTopClip );
    211215
    212216    // Count paper page size in hi-metric
     
    274278{
    275279    CHAR         achDriverName[ DRIVERNAME_LENGTH ] = "";
     280    CHAR         achQueueProcParams[ 8 ] = "";
    276281    DEVOPENSTRUC dos   = { 0 };
    277282    SIZEL        sizel = { 0 };
     
    287292
    288293    // Magrins
    289     LONG mLeft   = __max( TEST_MARGIN, curForm.xLeftClip );
    290     LONG mBottom = __max( TEST_MARGIN, curForm.yBottomClip );
    291     LONG mRight  = __max( TEST_MARGIN, curForm.cx - curForm.xRightClip );
    292     LONG mTop    = __max( TEST_MARGIN, curForm.cy - curForm.yTopClip );
     294    LONG mLeft   = __max( psetup->margin_left, curForm.xLeftClip );
     295    LONG mBottom = __max( psetup->margin_bottom, curForm.yBottomClip );
     296    LONG mRight  = __max( psetup->margin_right, curForm.cx - curForm.xRightClip );
     297    LONG mTop    = __max( psetup->margin_top, curForm.cy - curForm.yTopClip );
    293298
    294299    // Count paper page size in 1/72 inches
     
    321326
    322327    // build a devopenstruct for the call to DevOpenDC
    323     dos.pszLogAddress = psetup->QueueInfo.pszName;              // 1
     328    dos.pszLogAddress      = psetup->QueueInfo.pszName;              // 1
    324329    strcpy( achDriverName, psetup->QueueInfo.pszDriverName );
    325330    achDriverName[ strcspn( achDriverName, "." ) ] = '\0';
    326     dos.pszDriverName = achDriverName;                          // 2
    327     dos.pdriv         = psetup->QueueInfo.pDriverData;          // 3
    328     dos.pszDataType   = "PM_Q_RAW";                             // 4
    329 
    330     HDC hdcPrinter = DevOpenDC( lhab, OD_QUEUED, "*", 4L, (PDEVOPENDATA)&dos, NULLHANDLE );
     331    dos.pszDriverName      = achDriverName;                          // 2
     332    dos.pdriv              = psetup->QueueInfo.pDriverData;          // 3
     333    dos.pszDataType        = "PM_Q_RAW";                             // 4
     334    dos.pszComment         = (PSZ)appName;                           // 5
     335    dos.pszQueueProcName   = NULL;                                   // 6
     336    snprintf( achQueueProcParams, sizeof( achQueueProcParams ), "COP=%d", psetup->copies );
     337    dos.pszQueueProcParams = achQueueProcParams;                     // 7
     338
     339    HDC hdcPrinter = DevOpenDC( lhab, OD_QUEUED, "*", 7L, (PDEVOPENDATA)&dos, NULLHANDLE );
    331340    if ( hdcPrinter == DEV_ERROR ) {
    332341        unlink( tmpps );
     
    393402    }
    394403
    395     //long lTech = 0;
    396     //DevQueryCaps( hdcPrinterInfo, CAPS_TECHNOLOGY, sizeof(long), &lTech );
    397     //somPrintf( "lTech: 0x%x\n", lTech );
    398 
    399404    LONG lForms = DevQueryHardcopyCaps( hdcPrinterInfo, 0, 0, NULL );
    400405    if ( lForms == DQHC_ERROR ) {
  • trunk/Lucide/SOURCE/gui/print.h

    r91 r102  
    5151    PrintType ptype;
    5252    bool higherQuality;
     53    long margin_top;
     54    long margin_left;
     55    long margin_bottom;
     56    long margin_right;
     57    int copies;
    5358};
    5459
  • trunk/Lucide/SOURCE/gui/printDlg.cpp

    r95 r102  
    4646#include "Lucide_res.h"
    4747#include "luutils.h"
     48#include "messages.h"
    4849
    4950
     
    5556    fixed       = _doc->isFixedImage( ev );
    5657    currentpage = _currentpage;
     58    pcurForm    = new HCINFO;
     59    memset( pcurForm, 0, sizeof( HCINFO ) );
    5760    psetup      = new PrintSetup;
    5861    memset( psetup, 0, sizeof( PrintSetup ) );
     
    6164PrintDlg::~PrintDlg()
    6265{
     66    delete pcurForm;
    6367    delete psetup;
    6468}
     
    9599                MPFROM2SHORT( IDC_TYPE_POSTSCRIPT, BN_CLICKED ),
    96100                MPFROMHWND( WinWindowFromID( hwnd, IDC_TYPE_POSTSCRIPT ) ) );
     101
     102    WinCheckButton( hwnd, isPortraitOrientation() ? IDC_PORTRAIT : IDC_LANDSCAPE, TRUE );
     103
     104    applyForm( hwnd );
    97105}
    98106
     
    133141
    134142
    135 void PrintDlg::showJobProperties()
     143void PrintDlg::showJobProperties( HWND hwnd )
    136144{
    137145    if ( psetup->QueueInfo.pszName[0] == 0 ) {
     
    168176    DevPostDeviceModes( hab, psetup->QueueInfo.pDriverData, achDriverName,
    169177                        achDeviceName, psetup->QueueInfo.pszPrinters, DPDM_POSTJOBPROP );
    170 }
    171 
    172 bool PrintDlg::isPostscriptDevice()
     178
     179    WinCheckButton( hwnd, isPortraitOrientation() ? IDC_PORTRAIT : IDC_LANDSCAPE, TRUE );
     180    applyForm( hwnd );
     181}
     182
     183HDC PrintDlg::getInfoDC()
    173184{
    174185    char *achDriverName = new char[ DRIVERNAME_LENGTH ];
    175 
    176186    // build a devopenstruct for the call to DevOpenDC
    177187    DEVOPENSTRUC *dos   = new DEVOPENSTRUC;
     
    183193    dos->pdriv = psetup->QueueInfo.pDriverData;                  // 3
    184194
     195    HDC hdcPrinterInfo = DevOpenDC( hab, OD_INFO, "*", 3L, (PDEVOPENDATA)dos, NULLHANDLE );
     196
     197    delete achDriverName;
     198    delete dos;
     199
     200    return hdcPrinterInfo;
     201}
     202
     203bool PrintDlg::isPostscriptDevice()
     204{
    185205    long lTech = 0;
    186     HDC hdcPrinterInfo = DevOpenDC( hab, OD_INFO, "*", 3L, (PDEVOPENDATA)dos, NULLHANDLE );
     206    HDC hdcPrinterInfo = getInfoDC();
    187207    if ( hdcPrinterInfo != DEV_ERROR ) {
    188208        DevQueryCaps( hdcPrinterInfo, CAPS_TECHNOLOGY, sizeof(long), &lTech );
    189209        DevCloseDC( hdcPrinterInfo );
    190210    }
    191 
    192     delete achDriverName;
    193     delete dos;
    194211    return ( lTech == CAPS_TECH_POSTSCRIPT );
     212}
     213
     214// **************************************************
     215// OpenWatcom headers doesn't have these declarations
     216// **************************************************
     217#ifndef DJP_SJ_ORIENTATION
     218typedef struct _djpItem
     219{
     220    ULONG       cb;
     221    ULONG       ulProperty;
     222    LONG        lType;
     223    ULONG       ulNumReturned;
     224    ULONG       ulValue;
     225} DJP_ITEM, *PDJP_ITEM;
     226
     227#define DJP_ALL                 1L
     228#define DJP_CURRENT             2L
     229#define DJP_NONE                0L
     230#define DJP_SJ_ORIENTATION      1L
     231
     232#define DJP_ORI_PORTRAIT        1L
     233#define DJP_ORI_LANDSCAPE       2L
     234#define DJP_ORI_REV_PORTRAIT    3L
     235#define DJP_ORI_REV_LANDSCAPE   4L
     236#endif
     237// **************************************************
     238
     239bool PrintDlg::isPortraitOrientation()
     240{
     241    bool rVal = true;
     242
     243    HDC hdcPrinterInfo = getInfoDC();
     244    if ( hdcPrinterInfo != DEV_ERROR )
     245    {
     246        DJP_ITEM djp[ 2 ] = { { 0 } };
     247
     248        // Get Orientation from Job Properties
     249        djp[0].cb = sizeof( DJP_ITEM );
     250        djp[0].ulProperty = DJP_SJ_ORIENTATION;
     251        djp[0].lType = DJP_CURRENT;
     252        djp[0].ulNumReturned = 1;
     253        djp[0].ulValue = 1;
     254
     255        djp[1].cb = sizeof( DJP_ITEM );
     256        djp[1].ulProperty = 0;
     257        djp[1].lType = DJP_NONE;
     258        djp[1].ulNumReturned = 1;
     259        djp[1].ulValue = 0;
     260
     261        LONG outSz = psetup->QueueInfo.pDriverData->cb;
     262        LONG rc = DevEscape( hdcPrinterInfo, DEVESC_QUERYJOBPROPERTIES,
     263                             sizeof( DJP_ITEM ) * 2, (PCHAR)djp,
     264                             &outSz, (PCHAR)psetup->QueueInfo.pDriverData );
     265
     266        if ( ( rc == DEV_OK ) || ( rc == DEV_WARNING ) )
     267        {
     268            if ( ( djp[0].lType != DJP_NONE ) &&
     269                 ( djp[0].ulProperty == DJP_SJ_ORIENTATION ) &&
     270                 ( djp[0].lType > 0 ) )
     271            {
     272                if ( ( djp[0].ulValue == DJP_ORI_LANDSCAPE ) ||
     273                     ( djp[0].ulValue == DJP_ORI_REV_LANDSCAPE ) ) {
     274                    rVal = false;
     275                }
     276            }
     277        }
     278
     279        DevCloseDC( hdcPrinterInfo );
     280    }
     281
     282    return rVal;
     283}
     284
     285
     286void PrintDlg::setPortraitOrientation( bool portrait, HWND hwnd )
     287{
     288    HDC hdcPrinterInfo = getInfoDC();
     289    if ( hdcPrinterInfo != DEV_ERROR )
     290    {
     291        DJP_ITEM djp[ 2 ] = { { 0 } };
     292
     293        // Set Orientation
     294        djp[0].cb = sizeof( DJP_ITEM );
     295        djp[0].ulProperty = DJP_SJ_ORIENTATION;
     296        djp[0].lType = DJP_CURRENT;
     297        djp[0].ulNumReturned = 1;
     298        djp[0].ulValue = portrait ? DJP_ORI_PORTRAIT : DJP_ORI_LANDSCAPE;
     299
     300        djp[1].cb = sizeof( DJP_ITEM );
     301        djp[1].ulProperty = 0;
     302        djp[1].lType = DJP_NONE;
     303        djp[1].ulNumReturned = 1;
     304        djp[1].ulValue = 0;
     305
     306        LONG outSz = psetup->QueueInfo.pDriverData->cb;
     307        DevEscape( hdcPrinterInfo, DEVESC_SETJOBPROPERTIES,
     308                   sizeof( DJP_ITEM ) * 2, (PCHAR)djp,
     309                   &outSz, (PCHAR)psetup->QueueInfo.pDriverData );
     310
     311        DevCloseDC( hdcPrinterInfo );
     312
     313        applyForm( hwnd );
     314    }
     315}
     316
     317
     318bool PrintDlg::queryCurrentForm()
     319{
     320    HDC hdcPrinterInfo = getInfoDC();
     321    if ( hdcPrinterInfo == DEV_ERROR ) {
     322        return false;
     323    }
     324
     325    LONG lForms = DevQueryHardcopyCaps( hdcPrinterInfo, 0, 0, NULL );
     326    if ( lForms == DQHC_ERROR ) {
     327        DevCloseDC( hdcPrinterInfo );
     328        return false;
     329    }
     330
     331    HCINFO *forms = new HCINFO[ lForms ];
     332    memset( forms, 0, sizeof( HCINFO ) * lForms );
     333    lForms = DevQueryHardcopyCaps( hdcPrinterInfo, 0, lForms, forms );
     334    if ( lForms == DQHC_ERROR ) {
     335        delete forms;
     336        DevCloseDC( hdcPrinterInfo );
     337        return false;
     338    }
     339
     340    for ( LONG i = 0; i < lForms; i++ ) {
     341        if ( forms[i].flAttributes & HCAPS_CURRENT ) {
     342            memcpy( pcurForm, &( forms[i] ), sizeof( HCINFO ) );
     343            break;
     344        }
     345    }
     346
     347    delete forms;
     348    DevCloseDC( hdcPrinterInfo );
     349    return true;
     350}
     351
     352void PrintDlg::applyForm( HWND hwnd )
     353{
     354    if ( queryCurrentForm() )
     355    {
     356        WinSetDlgItemText( hwnd, IDC_SELECTED_FORM, pcurForm->szFormname );
     357
     358        long margin_top_min    = pcurForm->cy - pcurForm->yTopClip;
     359        long margin_left_min   = pcurForm->xLeftClip;
     360        long margin_bottom_min = pcurForm->yBottomClip;
     361        long margin_right_min  = pcurForm->cx - pcurForm->xRightClip;
     362
     363        long margin_top_max    = pcurForm->cy - margin_bottom_min;
     364        long margin_left_max   = pcurForm->cx - margin_right_min;
     365        long margin_bottom_max = pcurForm->cy - margin_top_min;
     366        long margin_right_max  = pcurForm->cx - margin_left_min;
     367
     368        WinSendDlgItemMsg( hwnd, IDC_MTOP, SPBM_SETLIMITS,
     369                           MPFROMLONG( margin_top_max ), MPFROMLONG( margin_top_min ) );
     370        WinSendDlgItemMsg( hwnd, IDC_MTOP, SPBM_SETCURRENTVALUE,
     371                           MPFROMLONG( margin_top_min ), MPVOID );
     372        WinSendDlgItemMsg( hwnd, IDC_MLEFT, SPBM_SETLIMITS,
     373                           MPFROMLONG( margin_left_max ), MPFROMLONG( margin_left_min ) );
     374        WinSendDlgItemMsg( hwnd, IDC_MLEFT, SPBM_SETCURRENTVALUE,
     375                           MPFROMLONG( margin_left_min ), MPVOID );
     376        WinSendDlgItemMsg( hwnd, IDC_MBOTTOM, SPBM_SETLIMITS,
     377                           MPFROMLONG( margin_bottom_max ), MPFROMLONG( margin_bottom_min ) );
     378        WinSendDlgItemMsg( hwnd, IDC_MBOTTOM, SPBM_SETCURRENTVALUE,
     379                           MPFROMLONG( margin_bottom_min ), MPVOID );
     380        WinSendDlgItemMsg( hwnd, IDC_MRIGHT, SPBM_SETLIMITS,
     381                           MPFROMLONG( margin_right_max ), MPFROMLONG( margin_right_min ) );
     382        WinSendDlgItemMsg( hwnd, IDC_MRIGHT, SPBM_SETCURRENTVALUE,
     383                           MPFROMLONG( margin_right_min ), MPVOID );
     384
     385        //somPrintf( "cx %d, cy %d, xLeftClip %d, yBottomClip %d, xRightClip %d, yTopClip %d\n",
     386        //           pcurForm->cx, pcurForm->cy, pcurForm->xLeftClip, pcurForm->yBottomClip,
     387        //           pcurForm->xRightClip, pcurForm->yTopClip );
     388
     389    }
     390    else {
     391        WinSetDlgItemText( hwnd, IDC_SELECTED_FORM, "" );
     392    }
     393}
     394
     395
     396// do not allow round-trip on spins
     397static MRESULT EXPENTRY spinProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
     398{
     399    PFNWP oldSpinProc = (PFNWP)WinQueryWindowULong( hwnd, QWL_USER );
     400
     401    if ( msg == SPBM_SPINDOWN )
     402    {
     403        LONG upLimit = 0, lowLimit = 0, curVal = 0;
     404        WinSendMsg( hwnd, SPBM_QUERYLIMITS, MPFROMP( &upLimit ), MPFROMP( &lowLimit ) );
     405        WinSendMsg( hwnd, SPBM_QUERYVALUE, MPFROMP( &curVal ), MPFROM2SHORT( 0, SPBQ_DONOTUPDATE ) );
     406        if ( curVal <= lowLimit ) {
     407            return (MRESULT)TRUE;
     408        }
     409    }
     410    else if ( msg == SPBM_SPINUP )
     411    {
     412        LONG upLimit = 0, lowLimit = 0, curVal = 0;
     413        WinSendMsg( hwnd, SPBM_QUERYLIMITS, MPFROMP( &upLimit ), MPFROMP( &lowLimit ) );
     414        WinSendMsg( hwnd, SPBM_QUERYVALUE, MPFROMP( &curVal ), MPFROM2SHORT( 0, SPBQ_DONOTUPDATE ) );
     415        if ( curVal >= upLimit ) {
     416            return (MRESULT)TRUE;
     417        }
     418    }
     419
     420    return oldSpinProc( hwnd, msg, mp1, mp2 );
    195421}
    196422
     
    230456                               MPFROMLONG( pages ), MPVOID );
    231457
     458            // Number of copies
     459            WinSendDlgItemMsg( hwnd, IDC_COPIES, SPBM_SETLIMITS,
     460                               MPFROMLONG( 999 ), MPFROMLONG( 1 ) );
     461            WinSendDlgItemMsg( hwnd, IDC_COPIES, SPBM_SETCURRENTVALUE,
     462                               MPFROMLONG( 1 ), MPVOID );
     463
    232464            // Enum printer queues
    233465            _this->enumQueues( hwnd );
     466
     467            HWND spin = WinWindowFromID( hwnd, IDC_MLEFT );
     468            PFNWP proc = WinSubclassWindow( spin, spinProc );
     469            WinSetWindowULong( spin, QWL_USER, (ULONG)proc );
     470            spin = WinWindowFromID( hwnd, IDC_MRIGHT );
     471            proc = WinSubclassWindow( spin, spinProc );
     472            WinSetWindowULong( spin, QWL_USER, (ULONG)proc );
     473            spin = WinWindowFromID( hwnd, IDC_MTOP );
     474            proc = WinSubclassWindow( spin, spinProc );
     475            WinSetWindowULong( spin, QWL_USER, (ULONG)proc );
     476            spin = WinWindowFromID( hwnd, IDC_MBOTTOM );
     477            proc = WinSubclassWindow( spin, spinProc );
     478            WinSetWindowULong( spin, QWL_USER, (ULONG)proc );
    234479
    235480            return (MRESULT)FALSE;
     
    242487                case IDC_PNAME:
    243488                {
    244                     //somPrintf( "IDC_PNAME: %d\n", SHORT2FROMMP(mp1) );
    245 
    246489                    if ( SHORT2FROMMP(mp1) == CBN_LBSELECT )
    247490                    {
     
    278521                break;
    279522
     523                case IDC_PORTRAIT:
     524                case IDC_LANDSCAPE:
     525                {
     526                    bool portrait = WinQueryButtonCheckstate( hwnd, IDC_PORTRAIT );
     527                    _this->setPortraitOrientation( portrait, hwnd );
     528                }
     529                break;
     530
    280531            }
    281532        }
     
    286537            {
    287538                case IDC_JOBPROPERTIES:
    288                     _this->showJobProperties();
     539                    _this->showJobProperties( hwnd );
    289540                    return (MRESULT)FALSE;
    290541
    291542                case DID_OK:
    292543                    {
     544                        long ml = 0, mr = 0, mt = 0, mb = 0;
     545                        WinSendDlgItemMsg( hwnd, IDC_MLEFT, SPBM_QUERYVALUE, MPFROMP( &ml ), MPFROM2SHORT( 0, SPBQ_UPDATEIFVALID ) );
     546                        WinSendDlgItemMsg( hwnd, IDC_MRIGHT, SPBM_QUERYVALUE, MPFROMP( &mr ), MPFROM2SHORT( 0, SPBQ_UPDATEIFVALID ) );
     547                        WinSendDlgItemMsg( hwnd, IDC_MTOP, SPBM_QUERYVALUE, MPFROMP( &mt ), MPFROM2SHORT( 0, SPBQ_UPDATEIFVALID ) );
     548                        WinSendDlgItemMsg( hwnd, IDC_MBOTTOM, SPBM_QUERYVALUE, MPFROMP( &mb ), MPFROM2SHORT( 0, SPBQ_UPDATEIFVALID ) );
     549
     550                        if ( ( _this->pcurForm->cx < ( ml + mr ) ) ||
     551                             ( _this->pcurForm->cy < ( mt + mb ) ) )
     552                        {
     553                            char *wrongmargins = newstrdupL( PD_WRONG_MARGINS );
     554                            WinMessageBox( HWND_DESKTOP, _this->hFrame, wrongmargins, NULL,
     555                                           1, MB_OK | MB_ERROR | MB_MOVEABLE );
     556                            delete wrongmargins;
     557                            return (MRESULT)FALSE;  // Return, don't leave dialog
     558                        }
     559
     560                        _this->psetup->margin_left   = ml;
     561                        _this->psetup->margin_right  = mr;
     562                        _this->psetup->margin_top    = mt;
     563                        _this->psetup->margin_bottom = mb;
     564
     565                        LONG cp = 0;
     566                        WinSendDlgItemMsg( hwnd, IDC_COPIES, SPBM_QUERYVALUE, MPFROMP( &cp ), MPFROM2SHORT( 0, SPBQ_UPDATEIFVALID ) );
     567                        _this->psetup->copies = cp;
     568
    293569                        _this->psetup->range = RangeAll;
    294570                        _this->psetup->pgfrom = 1;
  • trunk/Lucide/SOURCE/gui/printDlg.h

    r95 r102  
    4040
    4141class LuDocument;
    42 struct PrintDlgInternalData;
    4342
    4443class PrintDlg
     
    5453
    5554        void enumQueues( HWND hwnd );
    56         void showJobProperties();
     55        void showJobProperties( HWND hwnd );
    5756        void setCurrentQInfo( HWND hwnd, PPRQINFO3 q );
     57        HDC getInfoDC();
    5858        bool isPostscriptDevice();
     59        bool isPortraitOrientation();
     60        void setPortraitOrientation( bool portrait, HWND hwnd );
     61        bool queryCurrentForm();
     62        void applyForm( HWND hwnd );
    5963        static MRESULT EXPENTRY printDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
    6064
     
    6569        long currentpage;
    6670        PPRQINFO3 pQueueInfo;
     71        PHCINFO pcurForm;
    6772        PrintSetup *psetup;
    6873};
    6974
     75
    7076#endif // __PRINTDLG_H
    7177
Note: See TracChangeset for help on using the changeset viewer.