Changeset 133 for trunk/Lucide/SOURCE


Ignore:
Timestamp:
Sep 27, 2006, 5:08:37 PM (15 years ago)
Author:
Eugene Romanenko
Message:

cleanup, small fixes

Location:
trunk/Lucide/SOURCE/gui
Files:
4 edited

Legend:

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

    r114 r133  
    6666    for ( int i = 0; i < NUM_ESCAPES; i++ )
    6767    {
    68         const char *r_c = r.c_str();
    69         char *p = strstr( r_c, escapes[i][0] );
    70         if ( p != NULL )
    71         {
    72             int len = strlen( r_c ) + 1;
    73             char *tmp = new char[ len ];
    74             memset( tmp, 0, len );
    75             memcpy( tmp, r_c, p - r_c );
    76             strcat( tmp, escapes[i][1] );
    77             strcat( tmp, p + strlen( escapes[i][0] ) );
    78             r = tmp;
    79             delete tmp;
     68        int startpos = 0;
     69        int findpos = -1;
     70        while ( ( findpos = r.find( escapes[i][0], startpos ) ) != -1 ) {
     71            r.replace( findpos, 2, escapes[i][1] );
     72            startpos = findpos + 1;
    8073        }
    8174    }
  • trunk/Lucide/SOURCE/gui/luutils.cpp

    r88 r133  
    6060}
    6161
    62 void DestroyGraphicsBuffer( HPS hpsBuffer, HDC hdcBuffer )
    63 {
    64     if( hpsBuffer && hdcBuffer )
    65     {
    66         HBITMAP hbm = GpiSetBitmap( hpsBuffer, NULLHANDLE );
    67 
    68         if ( hbm != NULLHANDLE ) {
    69             GpiDeleteBitmap( hbm );
    70         }
    71 
    72         GpiDestroyPS( hpsBuffer );
    73         DevCloseDC( hdcBuffer );
    74 
    75         hpsBuffer = hdcBuffer = NULLHANDLE;
    76     }
    77 }
    78 
    79 void BlitGraphicsBuffer( HPS hps, HPS hpsBuffer, PRECTL prclPaint )
    80 {
    81     POINTL aptl[ 3 ];
    82 
    83     aptl[ 0 ].x = prclPaint->xLeft;
    84     aptl[ 0 ].y = prclPaint->yBottom;
    85     aptl[ 1 ].x = prclPaint->xRight;
    86     aptl[ 1 ].y = prclPaint->yTop;
    87     aptl[ 2 ].x = prclPaint->xLeft;
    88     aptl[ 2 ].y = prclPaint->yBottom;
    89 
    90     GpiBitBlt( hps, hpsBuffer, 3L, aptl, ROP_SRCCOPY, BBO_IGNORE );
    91 }
    9262
    9363BOOL CreateGraphicsBuffer( HAB hab, PRECTL prectl, HPS hps,
     
    159129}
    160130
     131void BlitGraphicsBuffer( HPS hps, HPS hpsBuffer, PRECTL prclPaint )
     132{
     133    POINTL aptl[ 3 ];
     134
     135    aptl[ 0 ].x = prclPaint->xLeft;
     136    aptl[ 0 ].y = prclPaint->yBottom;
     137    aptl[ 1 ].x = prclPaint->xRight;
     138    aptl[ 1 ].y = prclPaint->yTop;
     139    aptl[ 2 ].x = prclPaint->xLeft;
     140    aptl[ 2 ].y = prclPaint->yBottom;
     141
     142    GpiBitBlt( hps, hpsBuffer, 3L, aptl, ROP_SRCCOPY, BBO_IGNORE );
     143}
     144
     145void DestroyGraphicsBuffer( HPS hpsBuffer, HDC hdcBuffer )
     146{
     147    if( hpsBuffer && hdcBuffer )
     148    {
     149        HBITMAP hbm = GpiSetBitmap( hpsBuffer, NULLHANDLE );
     150
     151        if ( hbm != NULLHANDLE ) {
     152            GpiDeleteBitmap( hbm );
     153        }
     154
     155        GpiDestroyPS( hpsBuffer );
     156        DevCloseDC( hdcBuffer );
     157
     158        hpsBuffer = hdcBuffer = NULLHANDLE;
     159    }
     160}
     161
    161162
    162163char *newstrdup( const char *s )
     
    197198    }
    198199
    199     if ( pIniName == NULL )  // ¯šè¥¬ ¢ user profile
    200     {
     200    if ( pIniName == NULL ) { // ¯šè¥¬ ¢ user profile
    201201        hini = HINI_USER;
    202202    }
    203     else
    204     {
     203    else {
    205204        hini = PrfOpenProfile( WinQueryAnchorBlock( hwnd ), pIniName );
    206205    }
     
    210209        if ( PrfQueryProfileData( hini, pAppName, pKeyName, &wp, &ulWpSize ) )
    211210        {
    212             if ( wp.Swp.fl & SWP_MAXIMIZE )  SwpOptions |= SWP_MAXIMIZE;
    213             else if ( wp.Swp.fl & SWP_MINIMIZE )  SwpOptions |= SWP_MINIMIZE;
     211            if ( wp.Swp.fl & SWP_MAXIMIZE ) {
     212                SwpOptions |= SWP_MAXIMIZE;
     213            }
     214            else if ( wp.Swp.fl & SWP_MINIMIZE ) {
     215                SwpOptions |= SWP_MINIMIZE;
     216            }
    214217
    215218            if ( min ) {
     
    232235                sy = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
    233236
    234                 if ( wp.Swp.x > sx )  wp.Swp.x = sx - wp.Swp.cx;
    235                 if ( wp.Swp.y > sy )  wp.Swp.y = sy - wp.Swp.cy;
     237                if ( wp.Swp.x > sx ) {
     238                    wp.Swp.x = sx - wp.Swp.cx;
     239                }
     240                if ( wp.Swp.y > sy ) {
     241                    wp.Swp.y = sy - wp.Swp.cy;
     242                }
    236243            }
    237244
     
    249256        }
    250257
    251         if ( pIniName != NULL )  PrfCloseProfile( hini );
     258        if ( pIniName != NULL ) {
     259            PrfCloseProfile( hini );
     260        }
    252261    }
    253262    return rval;
     
    448457    char *fitwidthtext = newstrdupL( TBHINT_FIT_WIDTH );
    449458    WinSetWindowText( lbox, actsizetext );
    450     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( actsizetext ) );
    451     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( fitwindtext ) );
    452     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( fitwidthtext ) );
    453     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "12.5%" ) );
    454     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "25%" ) );
    455     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "50%" ) );
    456     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "100%" ) );
    457     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "125%" ) );
    458     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "150%" ) );
    459     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "200%" ) );
    460     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "300%" ) );
    461     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "400%" ) );
    462     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "800%" ) );
    463     WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "1600%" ) );
     459    WinInsertLboxItem( lbox, LIT_END, actsizetext );
     460    WinInsertLboxItem( lbox, LIT_END, fitwindtext );
     461    WinInsertLboxItem( lbox, LIT_END, fitwidthtext );
     462    WinInsertLboxItem( lbox, LIT_END, "12.5%" );
     463    WinInsertLboxItem( lbox, LIT_END, "25%" );
     464    WinInsertLboxItem( lbox, LIT_END, "50%" );
     465    WinInsertLboxItem( lbox, LIT_END, "100%" );
     466    WinInsertLboxItem( lbox, LIT_END, "125%" );
     467    WinInsertLboxItem( lbox, LIT_END, "150%" );
     468    WinInsertLboxItem( lbox, LIT_END, "200%" );
     469    WinInsertLboxItem( lbox, LIT_END, "300%" );
     470    WinInsertLboxItem( lbox, LIT_END, "400%" );
     471    WinInsertLboxItem( lbox, LIT_END, "800%" );
     472    WinInsertLboxItem( lbox, LIT_END, "1600%" );
    464473
    465474    HPS hps = WinGetPS( lbox );
  • trunk/Lucide/SOURCE/gui/printDlg.cpp

    r123 r133  
    129129    for ( ULONG i = 0; i < cReturned; i++ )
    130130    {
    131         sEntry = (SHORT)WinSendMsg( list, LM_INSERTITEM, MPFROMSHORT(LIT_END),
    132                                     MPFROMP( pQueueInfo[i].pszComment ) );
     131        sEntry = (SHORT)WinInsertLboxItem( list, LIT_END, pQueueInfo[i].pszComment );
    133132        WinSendMsg( list, LM_SETITEMHANDLE,
    134133                    MPFROMSHORT(sEntry), MPFROMP( &(pQueueInfo[i]) ) );
  • trunk/Lucide/SOURCE/gui/settingsDlg.cpp

    r91 r133  
    6464static void setZoomCombo( HWND combo, SHORT cbind, double zoom )
    6565{
    66     if ( cbind != -1 )
    67     {
     66    if ( cbind != -1 ) {
    6867        char buf[ 255 ] = "";
    69         WinSendMsg( combo, LM_QUERYITEMTEXT,
    70                     MPFROM2SHORT( cbind, sizeof( buf ) ), MPFROMP( buf ) );
     68        WinQueryLboxItemText( combo, cbind, buf, sizeof( buf ) );
    7169        WinSetWindowText( combo, buf );
    7270    }
    7371
    74     if ( zoom != 0 )
    75     {
     72    if ( zoom != 0 ) {
    7673        std::string z = str( zoom * 100.0 ) + "%";
    7774        WinSetWindowText( combo, z.c_str() );
     
    106103            std::string spage = getLocalizedString( SD_SINGLE_PAGE );
    107104            std::string cont = getLocalizedString( SD_CONTINUOUS );
    108             WinSendMsg( hLayout, LM_INSERTITEM, MPFROMSHORT(LIT_END),
    109                         MPFROMP( spage.c_str() ) );
    110             WinSendMsg( hLayout, LM_INSERTITEM, MPFROMSHORT(LIT_END),
    111                         MPFROMP( cont.c_str() ) );
     105            WinInsertLboxItem( hLayout, LIT_END, spage.c_str() );
     106            WinInsertLboxItem( hLayout, LIT_END, cont.c_str() );
    112107            if ( _this->settings->layout == SinglePage ) {
    113108                WinSetWindowText( hLayout, spage.c_str() );
Note: See TracChangeset for help on using the changeset viewer.