Changeset 92 for trunk


Ignore:
Timestamp:
Aug 3, 2006, 6:24:49 PM (15 years ago)
Author:
Eugene Romanenko
Message:

postscript printing updates, ability to abort PS generation, gcc support changes

Location:
trunk/Lucide/SOURCE
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/print.cpp

    r91 r92  
    8686        char *title;
    8787        PrintSetup *psetup;
    88         bool abortPrinting;
     88        boolean abortPrinting;
    8989        ProgressDlg *progressDlg;
    9090
     
    293293    double pheight = ( (double)( curForm.cy - mTop - mBottom ) / 25.4 ) * 72.0;
    294294
    295     char *tmpps = "TMPLUCID.PS";
     295    char tmpps[ CCHMAXPATHCOMP ] = "";
     296    char *tmpenv = getenv( "TMP" );
     297    strcpy( tmpps, ( tmpenv == NULL ) ? ".\\" : tmpenv );
     298    if ( tmpps[ strlen( tmpps ) - 1 ] != '\\' ) {
     299        strcat( tmpps, "\\" );
     300    }
     301    strcat( tmpps, "TMPLUCID.PS" );
     302
    296303    BOOL rc = doc->exportToPostScript( ev, tmpps, psetup->pgfrom-1, psetup->pgto-1,
    297                                        pwidth, pheight, false );
    298     if ( !rc ) {
    299         unlink( tmpps );
    300         return false;
    301     }
     304                                       pwidth, pheight, false, &abortPrinting );
     305
    302306    if ( abortPrinting ) {
    303307        unlink( tmpps );
    304308        return true;
     309    }
     310    if ( !rc ) {
     311        unlink( tmpps );
     312        return false;
    305313    }
    306314
     
    338346
    339347    bool splerr = false;
     348    char *pcl_prolog = "\x1b%-12345X@PJL JOB\n@PJL ENTER LANGUAGE = POSTSCRIPT \n";
     349    char *pcl_epilog = "\x1b%-12345X@PJL EOJ\n";
     350
     351    if ( !( rc = SplQmWrite( hspl, strlen( pcl_prolog ), pcl_prolog ) ) ) {
     352        splerr = true;
     353    }
     354
    340355    void *buf = malloc( PS_PRINT_BUF_SIZE );
    341356    int rd = 0;
     
    350365    fclose( f );
    351366    unlink( tmpps );
     367
     368    if ( !splerr ) {
     369        if ( !( rc = SplQmWrite( hspl, strlen( pcl_epilog ), pcl_epilog ) ) ) {
     370            splerr = true;
     371        }
     372    }
    352373
    353374    if ( splerr ) {
  • trunk/Lucide/SOURCE/plugins/ludjvu/ludjvu.cpp

    r91 r92  
    352352
    353353SOM_Scope boolean  SOMLINK exportToPostScript(LuDjvuDocument *somSelf,
    354                                                Environment *ev,
    355                                               string filename,
    356                                               long first_page,
    357                                               long last_page,
    358                                               double width, double height,
    359                                               boolean duplex)
     354                                    Environment *ev, string filename,
     355                                    long first_page, long last_page,
     356                                    double width, double height,
     357                                    boolean duplex, boolean* brkExport)
    360358{
    361359#ifdef __GNUC__
     
    373371
    374372    ddjvu_job_t *job = ddjvu_document_print( d->d_document, f, 1, optv );
    375     while ( !ddjvu_job_done( job ) ) {
     373    while ( !ddjvu_job_done( job ) && !(*brkExport) ) {
    376374        djvu_handle_events( d->d_context );
    377375    }
     
    409407                                   som3DestructCtrl* ctrl)
    410408{
    411     LuDjvuDocumentData *somThis; /* set in BeginDestructor */
     409    LuDjvuDocumentData *somThis; // set in BeginDestructor
    412410    somDestructCtrl globalCtrl;
    413411    somBooleanVector myMask;
  • trunk/Lucide/SOURCE/plugins/ludjvu/ludjvu.def

    r88 r92  
    33
    44IMPORTS
    5   __Z13somBuildClasslP24somStaticClassInfoStructll=som.somBuildClass
    6   __Z19somParentNumResolveP16somMethodTabListiPv=som.somParentNumResolve
    7   __Z16LuPixbufNewClassll=ludoc.LuPixbufNewClass
    8   __Z18LuDocumentNewClassll=ludoc.LuDocumentNewClass
     5        _LuDocumentNewClass=ludoc.LuDocumentNewClass
     6        _LuPixbufNewClass=ludoc.LuPixbufNewClass
     7        _somParentNumResolve=som.somParentNumResolve
     8        _somBuildClass=som.somBuildClass
     9        _somPrintf=som.somPrintf
    910
    1011EXPORTS
  • trunk/Lucide/SOURCE/plugins/ludjvu/ludjvu.xh

    r91 r92  
    4848
    4949/* The API to the LuDjvuDocument class object, and the methods it introduces. */
    50 SOMEXTERN struct LuDjvuDocumentClassDataStructure {
     50SOMEXTERNS struct LuDjvuDocumentClassDataStructure {
    5151        SOMClass *classObject;
    5252} SOMDLINK LuDjvuDocumentClassData;
     
    5454
    5555/* The API to parentMtabs for LuDjvuDocument, and the instance data it introduces. */
    56 SOMEXTERN struct LuDjvuDocumentCClassDataStructure {
     56SOMEXTERNS struct LuDjvuDocumentCClassDataStructure {
    5757        somMethodTabs parentMtab;
    5858        somDToken              instanceDataToken;
     
    6262 * -- Typedefs for LuDjvuDocument Method Procedures
    6363 */
    64 SOMEXTERNF {
     64SOMEXTERN {
    6565
    6666/*
     
    157157                double width,
    158158                double height,
    159                 boolean duplex);
     159                boolean duplex,
     160                boolean* brkExport);
    160161typedef somTP_LuDjvuDocument_exportToPostScript *somTD_LuDjvuDocument_exportToPostScript;
    161162typedef boolean   SOMLINK somTP_LuDjvuDocument_isHaveFontInfo(LuDjvuDocument *somSelf, Environment *ev);
     
    593594                double width,
    594595                double height,
    595                 boolean duplex)
     596                boolean duplex,
     597                boolean* brkExport)
    596598{
    597599   return SOM_ResolveD(this,LuDjvuDocument,LuDocument,exportToPostScript)
    598         (this, ev,filename,first_page,last_page,width,height,duplex);
     600        (this, ev,filename,first_page,last_page,width,height,duplex,brkExport);
    599601}
    600602
  • trunk/Lucide/SOURCE/plugins/ludjvu/ludjvu.xih

    r91 r92  
    647647                double width,
    648648                double height,
    649                 boolean duplex);
     649                boolean duplex,
     650                boolean* brkExport);
    650651static char *somMN_LuDjvuDocumentexportToPostScript = "LuDocument::exportToPostScript";
    651652static somId somId_LuDjvuDocumentexportToPostScript = &somMN_LuDjvuDocumentexportToPostScript;
     
    661662                double width,
    662663                double height,
    663                 boolean duplex);
     664                boolean duplex,
     665                boolean* brkExport);
    664666typedef somTP_xih_LuDjvuDocument_exportToPostScript *somTD_xih_LuDjvuDocument_exportToPostScript;
    665667/* define the parent method call macro */
    666668static somMethodProc* LuDjvuDocument_parent_LuDocument_exportToPostScript_resolved;
    667 #define LuDjvuDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex) \
     669#define LuDjvuDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport) \
    668670  ((( somTD_xih_LuDjvuDocument_exportToPostScript ) \
    669671      LuDjvuDocument_parent_LuDocument_exportToPostScript_resolved) \
    670         (somSelf,ev,filename,first_page,last_page,width,height,duplex))
     672        (somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport))
    671673/* define a variety of (possibly ambiguous) short forms */
    672674#ifndef SOMGD_pmc_parent_exportToPostScript
     
    686688  #endif
    687689#endif
    688 #define LuDjvuDocument_parents_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex) (\
    689    LuDjvuDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex))
     690#define LuDjvuDocument_parents_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport) (\
     691   LuDjvuDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport))
    690692
    691693/*
  • trunk/Lucide/SOURCE/plugins/ludoc/ludoc.cpp

    r91 r92  
    55 *     SOM incremental update: 2.24
    66 */
     7
    78
    89/* ***** BEGIN LICENSE BLOCK *****
     
    278279
    279280
    280 SOM_Scope boolean SOMLINK exportToPostScript(LuDocument *somSelf,
    281                                    Environment *ev,
    282                                    string filename, long first_page,
    283                                    long last_page, double width,
    284                                    double height, boolean duplex)
     281SOM_Scope boolean  SOMLINK exportToPostScript(LuDocument *somSelf,
     282                                               Environment *ev,
     283                                              string filename,
     284                                              long first_page,
     285                                              long last_page,
     286                                              double width, double height,
     287                                              boolean duplex,
     288                                              boolean* brkExport)
    285289{
    286290    // Abstract method does nothing
  • trunk/Lucide/SOURCE/plugins/ludoc/ludoc.idl

    r91 r92  
    309309     * duplex: whether to force duplex printing (on printers which
    310310     *         support this)
     311     * brkExport: pointer to boolean variable which must be checked
     312     *            during generating postscript, if it's TRUE - interrupt
     313     *            generation process.
    311314     *
    312315     * Create a new postscript file and render document to.
    313      * Return value: TRUE if PS document was generated successfully.
     316     * Return value: TRUE if PS document was generated successfully, or
     317     *               generation was interrupted, FALSE otherwise.
    314318     **/
    315319    boolean exportToPostScript( in string filename,
    316320                     in long first_page, in long last_page,
    317                      in double width, in double height, in boolean duplex );
     321                     in double width, in double height, in boolean duplex,
     322                     inout boolean brkExport );
    318323
    319324
  • trunk/Lucide/SOURCE/plugins/ludoc/ludoc.xh

    r91 r92  
    140140
    141141/* The API to the LuDocument class object, and the methods it introduces. */
    142 SOMEXTERN struct LuDocumentClassDataStructure {
     142SOMEXTERNS struct LuDocumentClassDataStructure {
    143143        SOMClass *classObject;
    144144        somMToken loadFile;
     
    178178
    179179/* The API to parentMtabs for LuDocument, and the instance data it introduces. */
    180 SOMEXTERN struct LuDocumentCClassDataStructure {
     180SOMEXTERNS struct LuDocumentCClassDataStructure {
    181181        somMethodTabs parentMtab;
    182182        somDToken              instanceDataToken;
     
    186186 * -- Typedefs for LuDocument Method Procedures
    187187 */
    188 SOMEXTERNF {
     188SOMEXTERN {
    189189typedef boolean   SOMLINK somTP_LuDocument_loadFile(LuDocument *somSelf, Environment *ev,
    190190                string filename,
     
    277277                double width,
    278278                double height,
    279                 boolean duplex);
     279                boolean duplex,
     280                boolean* brkExport);
    280281typedef somTP_LuDocument_exportToPostScript *somTD_LuDocument_exportToPostScript;
    281282typedef boolean   SOMLINK somTP_LuDocument_isHaveFontInfo(LuDocument *somSelf, Environment *ev);
     
    713714                double width,
    714715                double height,
    715                 boolean duplex)
     716                boolean duplex,
     717                boolean* brkExport)
    716718{
    717719   return SOM_ResolveD(this,LuDocument,LuDocument,exportToPostScript)
    718         (this, ev,filename,first_page,last_page,width,height,duplex);
     720        (this, ev,filename,first_page,last_page,width,height,duplex,brkExport);
    719721}
    720722
  • trunk/Lucide/SOURCE/plugins/ludoc/ludoc.xih

    r91 r92  
    555555                double width,
    556556                double height,
    557                 boolean duplex);
     557                boolean duplex,
     558                boolean* brkExport);
    558559#ifndef somMN_exportToPostScript_defined
    559560#define somMN_exportToPostScript_defined
     
    57057120, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
    571572
    572 static somMethodInfo exportToPostScriptMethodInfo = {11, 40, &exportToPostScriptFloatMap};
     573static somMethodInfo exportToPostScriptMethodInfo = {11, 44, &exportToPostScriptFloatMap};
    573574
    574575static somApRdInfo exportToPostScriptStubs = {0, 0, &exportToPostScriptMethodInfo};
  • trunk/Lucide/SOURCE/plugins/ludoc/luinode.xh

    r88 r92  
    5656
    5757/* The API to the LuIndexNode class object, and the methods it introduces. */
    58 SOMEXTERN struct LuIndexNodeClassDataStructure {
     58SOMEXTERNS struct LuIndexNodeClassDataStructure {
    5959        SOMClass *classObject;
    6060        somMToken LuIndexNodeInit;
     
    6767
    6868/* The API to parentMtabs for LuIndexNode, and the instance data it introduces. */
    69 SOMEXTERN struct LuIndexNodeCClassDataStructure {
     69SOMEXTERNS struct LuIndexNodeCClassDataStructure {
    7070        somMethodTabs parentMtab;
    7171        somDToken              instanceDataToken;
     
    7575 * -- Typedefs for LuIndexNode Method Procedures
    7676 */
    77 SOMEXTERNF {
     77SOMEXTERN {
    7878typedef void   SOMLINK somTP_LuIndexNode_LuIndexNodeInit(LuIndexNode *somSelf, Environment *ev,
    7979                somInitCtrl* ctrl,
  • trunk/Lucide/SOURCE/plugins/ludoc/lupixbuf.xh

    r88 r92  
    4848
    4949/* The API to the LuPixbuf class object, and the methods it introduces. */
    50 SOMEXTERN struct LuPixbufClassDataStructure {
     50SOMEXTERNS struct LuPixbufClassDataStructure {
    5151        SOMClass *classObject;
    5252        somMToken LuPixbufInit;
     
    6262
    6363/* The API to parentMtabs for LuPixbuf, and the instance data it introduces. */
    64 SOMEXTERN struct LuPixbufCClassDataStructure {
     64SOMEXTERNS struct LuPixbufCClassDataStructure {
    6565        somMethodTabs parentMtab;
    6666        somDToken              instanceDataToken;
     
    7070 * -- Typedefs for LuPixbuf Method Procedures
    7171 */
    72 SOMEXTERNF {
     72SOMEXTERN {
    7373typedef void   SOMLINK somTP_LuPixbuf_LuPixbufInit(LuPixbuf *somSelf, Environment *ev,
    7474                somInitCtrl* ctrl,
  • trunk/Lucide/SOURCE/plugins/lupoppler/lupoppler.cpp

    r91 r92  
    682682                                    long first_page, long last_page,
    683683                                    double width, double height,
    684                                     boolean duplex)
     684                                    boolean duplex, boolean* brkExport)
    685685{
    686686    if ( filename == NULL ) {
     
    705705        }
    706706
    707     for ( long i = first_page; i <= last_page; i++ ) {
     707        if ( *brkExport ) {
     708                delete out;
     709        return TRUE;
     710        }
     711       
     712    for ( long i = first_page; (i <= last_page) && !(*brkExport); i++ ) {
    708713        doc->displayPage( out, i + 1, 72.0, 72.0, 0, gFalse, gTrue, gFalse );
    709714    }
  • trunk/Lucide/SOURCE/plugins/lupoppler/lupoppler.xh

    r91 r92  
    157157                double width,
    158158                double height,
    159                 boolean duplex);
     159                boolean duplex,
     160                boolean* brkExport);
    160161typedef somTP_LuPopplerDocument_exportToPostScript *somTD_LuPopplerDocument_exportToPostScript;
    161162typedef boolean   SOMLINK somTP_LuPopplerDocument_isHaveFontInfo(LuPopplerDocument *somSelf, Environment *ev);
     
    593594                double width,
    594595                double height,
    595                 boolean duplex)
     596                boolean duplex,
     597                boolean* brkExport)
    596598{
    597599   return SOM_ResolveD(this,LuPopplerDocument,LuDocument,exportToPostScript)
    598         (this, ev,filename,first_page,last_page,width,height,duplex);
     600        (this, ev,filename,first_page,last_page,width,height,duplex,brkExport);
    599601}
    600602
  • trunk/Lucide/SOURCE/plugins/lupoppler/lupoppler.xih

    r91 r92  
    915915                double width,
    916916                double height,
    917                 boolean duplex);
     917                boolean duplex,
     918                boolean* brkExport);
    918919static char *somMN_LuPopplerDocumentexportToPostScript = "LuDocument::exportToPostScript";
    919920static somId somId_LuPopplerDocumentexportToPostScript = &somMN_LuPopplerDocumentexportToPostScript;
     
    929930                double width,
    930931                double height,
    931                 boolean duplex);
     932                boolean duplex,
     933                boolean* brkExport);
    932934typedef somTP_xih_LuPopplerDocument_exportToPostScript *somTD_xih_LuPopplerDocument_exportToPostScript;
    933935/* define the parent method call macro */
    934936static somMethodProc* LuPopplerDocument_parent_LuDocument_exportToPostScript_resolved;
    935 #define LuPopplerDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex) \
     937#define LuPopplerDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport) \
    936938  ((( somTD_xih_LuPopplerDocument_exportToPostScript ) \
    937939      LuPopplerDocument_parent_LuDocument_exportToPostScript_resolved) \
    938         (somSelf,ev,filename,first_page,last_page,width,height,duplex))
     940        (somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport))
    939941/* define a variety of (possibly ambiguous) short forms */
    940942#ifndef SOMGD_pmc_parent_exportToPostScript
     
    954956  #endif
    955957#endif
    956 #define LuPopplerDocument_parents_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex) (\
    957    LuPopplerDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex))
     958#define LuPopplerDocument_parents_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport) (\
     959   LuPopplerDocument_parent_LuDocument_exportToPostScript(somSelf,ev,filename,first_page,last_page,width,height,duplex,brkExport))
    958960
    959961/*
  • trunk/Lucide/SOURCE/sominc/cnvsomex.cmd

    r88 r92  
    99tmp = "tmp.tmp"
    1010
     11sstr = "SOMEXTERN struct"
     12sstrlen = LENGTH( sstr )
     13
    1114do while lines(f)
    1215        l=linein(f)
    13         if l="SOMEXTERN {" then l="SOMEXTERNF {"
     16        if SUBSTR(l,1,sstrlen)=sstr then do
     17                resstr = "SOMEXTERNS struct"||SUBSTR(l,sstrlen+1)
     18                l=resstr
     19        end
    1420        call lineout tmp, l
    1521end     
  • trunk/Lucide/SOURCE/sominc/somcls.api

    r88 r92  
    151151
    152152/* The API to the SOMClass class object, and the methods it introduces. */
    153 SOMEXTERN struct SOMClassClassDataStructure {
     153SOMEXTERNS struct SOMClassClassDataStructure {
    154154        SOMClass *classObject;
    155155        somMToken somNew;
     
    233233
    234234/* The API to parentMtabs for SOMClass, and the instance data it introduces. */
    235 SOMEXTERN struct SOMClassCClassDataStructure {
     235SOMEXTERNS struct SOMClassCClassDataStructure {
    236236        somMethodTabs parentMtab;
    237237        somDToken              instanceDataToken;
     
    241241 * -- Typedefs for SOMClass Method Procedures
    242242 */
    243 SOMEXTERNF {
     243SOMEXTERN {
    244244typedef long   SOMLINK somTP_SOMClass__get_somDataAlignment(SOMClass *somSelf);
    245245typedef somTP_SOMClass__get_somDataAlignment *somTD_SOMClass__get_somDataAlignment;
  • trunk/Lucide/SOURCE/sominc/somcls.xh

    r88 r92  
    196196
    197197/* The API to the SOMClass class object, and the methods it introduces. */
    198 SOMEXTERN struct SOMClassClassDataStructure {
     198SOMEXTERNS struct SOMClassClassDataStructure {
    199199        SOMClass *classObject;
    200200        somMToken somNew;
     
    278278
    279279/* The API to parentMtabs for SOMClass, and the instance data it introduces. */
    280 SOMEXTERN struct SOMClassCClassDataStructure {
     280SOMEXTERNS struct SOMClassCClassDataStructure {
    281281        somMethodTabs parentMtab;
    282282        somDToken              instanceDataToken;
  • trunk/Lucide/SOURCE/sominc/somcm.xh

    r88 r92  
    8585
    8686/* The API to the SOMClassMgr class object, and the methods it introduces. */
    87 SOMEXTERN struct SOMClassMgrClassDataStructure {
     87SOMEXTERNS struct SOMClassMgrClassDataStructure {
    8888        SOMClass *classObject;
    8989        somMToken somFindClsInFile;
     
    113113
    114114/* The API to parentMtabs for SOMClassMgr, and the instance data it introduces. */
    115 SOMEXTERN struct SOMClassMgrCClassDataStructure {
     115SOMEXTERNS struct SOMClassMgrCClassDataStructure {
    116116        somMethodTabs parentMtab;
    117117        somDToken              instanceDataToken;
     
    121121 * -- Typedefs for SOMClassMgr Method Procedures
    122122 */
    123 SOMEXTERNF {
     123SOMEXTERN {
    124124typedef SOMClass*   SOMLINK somTP_SOMClassMgr_somLoadClassFile(SOMClassMgr *somSelf,
    125125                somId classId,
  • trunk/Lucide/SOURCE/sominc/somltype.h

    r88 r92  
    4646#ifndef SOMEXTERN
    4747  #ifdef __cplusplus
    48         #ifdef __GNUC__
    49             #define SOMEXTERN extern
    50         #else
    51             #define SOMEXTERN extern "C"
    52         #endif
     48    #define SOMEXTERN extern "C"
    5349    #ifdef __STR__
    5450      #undef __STR__
     
    5955#endif
    6056
    61 #ifndef SOMEXTERNF
    62   #ifdef __cplusplus
    63     #define SOMEXTERNF extern "C"
     57#ifndef SOMEXTERNS
     58  #ifdef __GNUC__
     59    #define SOMEXTERNS extern
    6460  #else
    65     #define SOMEXTERNF extern
     61    #define SOMEXTERNS extern "C"
    6662  #endif
    6763#endif
  • trunk/Lucide/SOURCE/sominc/somobj.xh

    r88 r92  
    152152
    153153/* The API to the SOMObject class object, and the methods it introduces. */
    154 SOMEXTERN struct SOMObjectClassDataStructure {
     154SOMEXTERNS struct SOMObjectClassDataStructure {
    155155        SOMClass *classObject;
    156156        somMToken somInit;
     
    190190
    191191/* The API to parentMtabs for SOMObject, and the instance data it introduces. */
    192 SOMEXTERN struct SOMObjectCClassDataStructure {
     192SOMEXTERNS struct SOMObjectCClassDataStructure {
    193193        somMethodTabs parentMtab;
    194194        somDToken              instanceDataToken;
     
    198198 * -- Typedefs for SOMObject Method Procedures
    199199 */
    200 SOMEXTERNF {
     200SOMEXTERN {
    201201typedef void   SOMLINK somTP_SOMObject_somDefaultInit(SOMObject *somSelf,
    202202                som3InitCtrl* ctrl);
Note: See TracChangeset for help on using the changeset viewer.