Changeset 183 for trunk/Lucide/SOURCE


Ignore:
Timestamp:
Jan 21, 2007, 5:34:28 PM (15 years ago)
Author:
Eugene Romanenko
Message:

Odd/Even? printing for 'As Image' printing, pdf plugin: fix document title

Location:
trunk/Lucide/SOURCE
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/Lucide_res.H

    r177 r183  
    148148#define IDC_PGTO            19
    149149#define IDC_COPIES                      20
    150 #define IDC_TYPE_POSTSCRIPT     21
    151 #define IDC_TYPE_ASIMAGE        22
    152 #define IDC_PRINT_TO_FILE       23
    153 #define IDC_HIGHER_IMAGE_QUALITY        24
    154 #define IDC_PORTRAIT            25
    155 #define IDC_LANDSCAPE           26
    156 #define IDC_MLEFT                       27
    157 #define IDC_MRIGHT                      28
    158 #define IDC_MTOP                        29
    159 #define IDC_MBOTTOM                     30
    160 #define IDC_SELECTED_FORM       31
     150#define IDC_RANGE_EVEN_ODD_LABEL        21
     151#define IDC_RANGE_EVEN_ODD  22
     152#define IDC_TYPE_POSTSCRIPT     23
     153#define IDC_TYPE_ASIMAGE        24
     154#define IDC_PRINT_TO_FILE       25
     155#define IDC_HIGHER_IMAGE_QUALITY        26
     156#define IDC_PORTRAIT            27
     157#define IDC_LANDSCAPE           28
     158#define IDC_MLEFT                       29
     159#define IDC_MRIGHT                      30
     160#define IDC_MTOP                        31
     161#define IDC_MBOTTOM                     32
     162#define IDC_SELECTED_FORM       33
    161163
    162164#define IDD_PASSWORD        1009
  • trunk/Lucide/SOURCE/gui/dialogs.rc

    r177 r183  
    134134DLGTEMPLATE IDD_PRINT
    135135BEGIN
    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
     136        DIALOG "PD_TITLE", -1, 65, 13, 258, 223, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR
     137        BEGIN
     138                CONTROL "PD_PRINTER", -1, 2, 189, 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, 203, 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, 169, 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, 201, 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, 191, 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, 191, 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, 133, 253, 55, 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, 170, 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, 160, 106, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
     155                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     156                CONTROL "PD_RANGE_PAGES", IDC_RANGEPAGES, 9, 150, 90, 10, WC_BUTTON, BS_AUTORADIOBUTTON | WS_VISIBLE | WS_TABSTOP
     157                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     158                CONTROL "PD_FROM", IDC_LABELFROM, 102, 151, 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, 151, 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, 151, 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, 151, 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, 171, 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, 171, 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_RANGE_EVEN_ODD_LABEL", IDC_RANGE_EVEN_ODD_LABEL, 9, 138, 87, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     171                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     172                CONTROL "", IDC_RANGE_EVEN_ODD, 102, 104, 145, 43, WC_COMBOBOX, CBS_DROPDOWNLIST | ES_ANY | WS_VISIBLE | WS_GROUP | WS_TABSTOP
    169173                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    170174                CONTROL "PD_PRINT_TYPE", -1, 2, 91, 253, 40, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     
    204208                CONTROL "PD_SELECTED_FORM", -1, 9, 29, 101, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
    205209                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    206                 CONTROL "", IDC_SELECTED_FORM, 132, 29, 118, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     210                CONTROL "", IDC_SELECTED_FORM, 116, 29, 134, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
    207211                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    208212                DEFPUSHBUTTON "PD_BTNPRINT", DID_OK, 140, 5, 51, 14, WS_DISABLED
     
    211215                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    212216        END
     217
    213218END
    214219
  • trunk/Lucide/SOURCE/gui/messages.cpp

    r155 r183  
    116116const char *GTP_OF = "GTP_OF";
    117117
     118// Print dialog
     119const char *PD_RANGE_EVEN_ODD           = "PD_RANGE_EVEN_ODD";
     120const char *PD_RANGE_ODD                = "PD_RANGE_ODD";
     121const char *PD_RANGE_EVEN               = "PD_RANGE_EVEN";
     122const char *PD_WRONG_MARGINS            = "PD_WRONG_MARGINS";
    118123// Printing, other 'print'-related messages
    119 const char *PD_WRONG_MARGINS            = "PD_WRONG_MARGINS";
    120124const char *PRINT_PRINTING_PAGE_OF      = "PRINT_PRINTING_PAGE_OF";
    121125const char *PRINT_GENERATING_POSTSCRIPT = "PRINT_GENERATING_POSTSCRIPT";
  • trunk/Lucide/SOURCE/gui/messages.h

    r155 r183  
    116116extern const char *GTP_OF;
    117117
     118// Print dialog
     119extern const char *PD_RANGE_EVEN_ODD;
     120extern const char *PD_RANGE_ODD;
     121extern const char *PD_RANGE_EVEN;
     122extern const char *PD_WRONG_MARGINS;
    118123// Printing, other 'print'-related messages
    119124extern const char *PD_WRONG_MARGINS;
  • trunk/Lucide/SOURCE/gui/print.cpp

    r179 r183  
    125125}
    126126
     127static bool isPrintPageNum( PrintOddEven oddeven, long page )
     128{
     129    if ( oddeven == OEOdd ) {
     130        return ( ( page % 2 ) != 0 );
     131    }
     132    else if ( oddeven == OEEven ) {
     133        return ( ( page % 2 ) == 0 );
     134    }
     135    return true;
     136}
     137
     138static long countPagesToPrint( PrintOddEven oddeven, long pgfrom, long pgto )
     139{
     140    long r = 0;
     141    for ( long i = pgfrom; i <= pgto; i++ ) {
     142        if ( isPrintPageNum( oddeven, i ) ) {
     143            r++;
     144        }
     145    }
     146    return r;
     147}
     148
    127149bool LucidePrinting::doPmPrint( HAB lhab )
    128150{
     
    164186    DevEscape( hdcPrinter, DEVESC_STARTDOC, strlen(title), (PBYTE)title, NULL, NULL );
    165187
    166 
    167     long totalpages = abs( psetup->pgto - psetup->pgfrom ) + 1;
     188    long pgfrom = psetup->pgfrom;
     189    long pgto = psetup->pgto;
     190    if ( pgfrom > pgto ) {
     191        long tmp = pgfrom;
     192        pgfrom = pgto;
     193        pgto = tmp;
     194    }
     195
     196    long pagestoprint = countPagesToPrint( psetup->oddeven, pgfrom, pgto );
    168197    long pg = psetup->pgfrom;
    169     for ( long i = 0; i < totalpages; i++ )
     198    for ( long i = pgfrom, j = 1; i <= pgto; i++ )
    170199    {
    171         char *fmt = newstrdupL( PRINT_PRINTING_PAGE_OF );
    172         char *buf = new char[ 255 ];
    173         snprintf( buf, 255, fmt, pg, i + 1, totalpages );
    174         progressDlg->setText( buf );
    175         delete fmt;
    176         delete buf;
    177 
    178         printPagePm( pg - 1, hpsPrinter, &curForm );
    179 
    180         if ( pg != psetup->pgto ) {
    181             DevEscape( hdcPrinter, DEVESC_NEWFRAME, 0L, NULL, NULL, NULL );
     200        if ( isPrintPageNum( psetup->oddeven, pg ) )
     201        {
     202            char *fmt = newstrdupL( PRINT_PRINTING_PAGE_OF );
     203            char *buf = new char[ 255 ];
     204            snprintf( buf, 255, fmt, pg, j++, pagestoprint );
     205            progressDlg->setText( buf );
     206            delete fmt;
     207            delete buf;
     208
     209            printPagePm( pg - 1, hpsPrinter, &curForm );
     210
     211            if ( pg != psetup->pgto ) {
     212                DevEscape( hdcPrinter, DEVESC_NEWFRAME, 0L, NULL, NULL, NULL );
     213            }
    182214        }
    183215
  • trunk/Lucide/SOURCE/gui/print.h

    r164 r183  
    4242enum PrintRange { RangeAll = 0, RangeCurrent = 1, RangePages = 2 };
    4343enum PrintType { TypePostScript = 0, TypeAsImage = 1 };
     44enum PrintOddEven { OEOddEven = 0, OEOdd = 1, OEEven = 2 };
    4445
    4546struct PrintSetup
     
    5859    bool psToFile;
    5960    char psFile[ CCHMAXPATH ];
     61    PrintOddEven oddeven;
    6062};
    6163
  • trunk/Lucide/SOURCE/gui/printDlg.cpp

    r167 r183  
    4040#include <os2.h>
    4141
     42#include <string>
     43
    4244#include <ludoc.xh>
    4345
     
    475477            // Enum printer queues
    476478            _this->enumQueues( hwnd );
     479
     480            USHORT sEntry;
     481            HWND reo = WinWindowFromID( hwnd, IDC_RANGE_EVEN_ODD );
     482            WinSetWindowText( reo, getLocalizedString( PD_RANGE_EVEN_ODD ).c_str() );
     483            sEntry = (SHORT)WinInsertLboxItem( reo, LIT_END, getLocalizedString( PD_RANGE_EVEN_ODD ).c_str() );
     484            WinSendMsg( reo, LM_SETITEMHANDLE, MPFROMSHORT(sEntry), MPFROMLONG( OEOddEven ) );
     485            sEntry = (SHORT)WinInsertLboxItem( reo, LIT_END, getLocalizedString( PD_RANGE_ODD ).c_str() );
     486            WinSendMsg( reo, LM_SETITEMHANDLE, MPFROMSHORT(sEntry), MPFROMLONG( OEOdd ) );
     487            sEntry = (SHORT)WinInsertLboxItem( reo, LIT_END, getLocalizedString( PD_RANGE_EVEN ).c_str() );
     488            WinSendMsg( reo, LM_SETITEMHANDLE, MPFROMSHORT(sEntry), MPFROMLONG( OEEven ) );
    477489
    478490            HWND spin = WinWindowFromID( hwnd, IDC_MLEFT );
     
    531543                    WinEnableControl( hwnd, IDC_HIGHER_IMAGE_QUALITY,
    532544                                      asimg && _this->scalable && !_this->fixed );
     545                    WinEnableControl( hwnd, IDC_RANGE_EVEN_ODD_LABEL, asimg );
     546                    WinEnableControl( hwnd, IDC_RANGE_EVEN_ODD, asimg );
    533547                }
    534548                break;
     
    609623                        }
    610624                        _this->psetup->higherQuality = WinQueryButtonCheckstate( hwnd, IDC_HIGHER_IMAGE_QUALITY );
     625
     626                        _this->psetup->oddeven = OEOddEven;
     627                        if ( _this->psetup->ptype == TypeAsImage )
     628                        {
     629                            SHORT rc = (SHORT)WinSendDlgItemMsg( hwnd, IDC_RANGE_EVEN_ODD, LM_QUERYSELECTION,
     630                                                             MPFROMSHORT( LIT_CURSOR ), MPVOID );
     631                            if ( rc != LIT_NONE ) {
     632                                MRESULT r = WinSendDlgItemMsg( hwnd, IDC_RANGE_EVEN_ODD, LM_QUERYITEMHANDLE,
     633                                                           MPFROMSHORT( rc ), MPVOID );
     634                                _this->psetup->oddeven = (PrintOddEven)(int)r;
     635                            }
     636                        }
     637
    611638                        _this->psetup->psToFile = WinQueryButtonCheckstate( hwnd, IDC_PRINT_TO_FILE );
    612639
    613                         if ( _this->psetup->psToFile )
     640                        if ( ( _this->psetup->ptype == TypePostScript ) &&
     641                             _this->psetup->psToFile )
    614642                        {
    615643                            strcpy( _this->psetup->psFile, _this->filename );
  • trunk/Lucide/SOURCE/plugins/lupoppler/lupoppler.cpp

    r156 r183  
    10051005        size_t unilen = s->getLength() + 1;
    10061006        UniChar *unibuf = new UniChar[ unilen ];
     1007        memset( unibuf, 0, unilen * sizeof( UniChar ) );
    10071008        UniChar *tmpuni = unibuf;
    10081009        const char *from = s->getCString() + 2;
    1009         size_t fromlen = s->getLength() * 2;
     1010        size_t fromlen = s->getLength() - 2;
    10101011        UniUconvToUcs( objUniBe, (void **)&from, &fromlen, &tmpuni, &unilen, &cSubs );
    10111012        unilen = UniStrlen( unibuf );
Note: See TracChangeset for help on using the changeset viewer.