Changeset 87 for trunk/Lucide


Ignore:
Timestamp:
Jul 25, 2006, 5:22:20 PM (15 years ago)
Author:
Eugene Romanenko
Message:

'Go to page' dialog, some play with djvu plugin.

Location:
trunk/Lucide
Files:
16 edited

Legend:

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

    r76 r87  
    2727MENU_NEXT_PAGE=Next page\t+
    2828MENU_LAST_PAGE=Last page
    29 MENU_GO_TO_PAGE=Go to page...
     29MENU_GO_TO_PAGE=Go to page...\tCtrl+N
    3030MENU_VIEW=~View
    3131MENU_FIT_WINDOW=Fit in window
     
    110110#
    111111FIND_FIND=Find
    112 FIND_FIND_WHAT=~Find what:
     112FIND_FIND_WHAT=~Find what
    113113FIND_MATCH_CASE=~Match case
    114114FIND_OK=~OK
     
    136136#
    137137SD_SETTINGS=Settings
    138 SD_DEFAULT_PAGE_LAYOUT=Default Page Layout:
    139 SD_DEFAULT_ZOOM=Default Zoom:
     138SD_DEFAULT_PAGE_LAYOUT=Default Page Layout
     139SD_DEFAULT_ZOOM=Default Zoom
    140140SD_OK=~OK
    141141SD_CANCEL=~Cancel
     142
     143#
     144# 'Go to page' dialog
     145#
     146GTP_GOTOPAGE=Go to page
     147GTP_PAGE=Page
     148GTP_OF=of %d
     149GTP_OK=~OK
     150GTP_CANCEL=~Cancel
  • trunk/Lucide/BIN/Lucide_de.lng

    r82 r87  
    2727MENU_NEXT_PAGE=N„chste Seite\t+
    2828MENU_LAST_PAGE=Letzte Seite
    29 MENU_GO_TO_PAGE=Gehe zu Seite...
     29MENU_GO_TO_PAGE=Gehe zu Seite...\tStrg+N
    3030MENU_VIEW=~Anzeige
    3131MENU_FIT_WINDOW=Ganze Seite
     
    110110#
    111111FIND_FIND=Suchen
    112 FIND_FIND_WHAT=~Suchbegriff:
     112FIND_FIND_WHAT=~Suchbegriff
    113113FIND_MATCH_CASE=~Groá-/Kleinschreibung beachten
    114114FIND_OK=~OK
     
    136136#
    137137SD_SETTINGS=Einstellungen
    138 SD_DEFAULT_PAGE_LAYOUT=Standard Seitenlayout:
    139 SD_DEFAULT_ZOOM=Standard-Zoom:
     138SD_DEFAULT_PAGE_LAYOUT=Standard Seitenlayout
     139SD_DEFAULT_ZOOM=Standard-Zoom
    140140SD_OK=~OK
    141141SD_CANCEL=~Abbruch
  • trunk/Lucide/BIN/Lucide_fr.lng

    r72 r87  
    2727MENU_LAST_PAGE=DerniŠre page
    2828MENU_GO_TO_PAGE=Aller
    29  la page...
     29 la page...\tCtrl+N
    3030MENU_VIEW=~Affichage
    3131MENU_FIT_WINDOW=Adapter
     
    111111#
    112112FIND_FIND=Recherche
    113 FIND_FIND_WHAT=~Quoi chercher :
     113FIND_FIND_WHAT=~Quoi chercher
    114114FIND_MATCH_CASE=~Respecter la casse
    115115FIND_OK=~OK
     
    129129#
    130130AD_ABOUT=Infos produit
    131 AD_COPYRIGHTS=Copyrights here.
    132131AD_OK=OK
  • trunk/Lucide/BIN/Lucide_ru.lng

    r2 r87  
    33#
    44
    5 MENU_FILE=~” ©«
    65MENU_OPEN=Žâªàëâì...\tCtrl+O
    76MENU_SAVE_AS=‘®åà ­šâì ª ª...
  • trunk/Lucide/BIN/Lucide_sv.lng

    r72 r87  
    2626MENU_NEXT_PAGE=N„sta sida\t+
    2727MENU_LAST_PAGE=Sista sidan
    28 MENU_GO_TO_PAGE=G† till sidan...
     28MENU_GO_TO_PAGE=G† till sidan...\tCtrl+N
    2929MENU_VIEW=~Visa
    3030MENU_FIT_WINDOW=Passa f”nster
     
    107107#
    108108FIND_FIND=Finn
    109 FIND_FIND_WHAT=~Finn vad:
     109FIND_FIND_WHAT=~Finn vad
    110110FIND_MATCH_CASE=~Matcha stor/liten bokstav
    111111FIND_OK=~OK
  • trunk/Lucide/SOURCE/gui/Lucide.rc

    r72 r87  
    100100    "G", CM_FINDAGAIN, CONTROL
    101101    "g", CM_FINDAGAIN, CONTROL
     102    "N", CM_GOTOPAGE, CONTROL
     103    "n", CM_GOTOPAGE, CONTROL
    102104    VK_F11, CM_MAXVIEW, VIRTUALKEY
    103105END
  • trunk/Lucide/SOURCE/gui/Lucide_res.H

    r72 r87  
    125125#define IDC_DEFZOOM                     11
    126126
     127#define IDD_GOTOPAGE            1007
     128#define IDC_PAGE                        10
     129#define IDC_PAGES                       11
     130
    127131#endif // __LUCIDE_RES_H
  • trunk/Lucide/SOURCE/gui/dialogs.rc

    r76 r87  
    9191                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    9292        END
    93 
    9493END
    9594
     
    114113END
    115114
     115
     116DLGTEMPLATE IDD_GOTOPAGE
     117BEGIN
     118        DIALOG "GTP_GOTOPAGE", -1, 6, 116, 162, 49, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR
     119        BEGIN
     120                CONTROL "GTP_PAGE", -1, 5, 31, 45, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     121                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     122                CONTROL "", IDC_PAGE, 54, 31, 48, 10, WC_SPINBUTTON, SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     123                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     124                CONTROL "", IDC_PAGES, 106, 31, 52, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     125                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     126                DEFPUSHBUTTON "GTP_OK", DID_OK, 28, 7, 51, 14
     127                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     128                PUSHBUTTON "GTP_CANCEL", DID_CANCEL, 88, 7, 51, 14
     129                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     130        END
     131END
     132
  • trunk/Lucide/SOURCE/gui/docViewer.h

    r86 r87  
    6969        void close();
    7070        void goToPage( long page );
    71         long getCurrentPage() { return currentpage; }
     71        long getCurrentPage() { return currentpage; }  // Zero based
    7272        void setZoom( double _zoom );
    7373        double getZoom() { return zoom; }
  • trunk/Lucide/SOURCE/gui/findDlg.cpp

    r35 r87  
    2222 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    2323 * in which case the provisions of the LGPL are applicable instead of those
    24  * above. If you wish to allow use of your version of this file only under the 
     24 * above. If you wish to allow use of your version of this file only under the
    2525 * terms of the LGPL, and not to allow others to use your version of this file
    2626 * under the terms of the CDDL, indicate your decision by deleting the
    2727 * provisions above and replace them with the notice and other provisions
    2828 * required by the LGPL. If you do not delete the provisions above, a recipient
    29  * may use your version of this file under the terms of any one of the CDDL 
     29 * may use your version of this file under the terms of any one of the CDDL
    3030 * or the LGPL.
    3131 *
     
    3535#define INCL_WIN
    3636#include <os2.h>
     37
     38#include <stdio.h>
    3739
    3840#include "findDlg.h"
    3941#include "Lucide_res.h"
    4042#include "luutils.h"
     43#include "messages.h"
    4144
    4245#define MAXSEARCHLENGTH 100
     
    115118
    116119
     120//
     121// ------------------ GotoDlg ---------------------
     122//
     123
     124GotoDlg::GotoDlg( HWND hWndFrame, long _pages, long _curpage )
     125{
     126    hFrame  = hWndFrame;
     127    page    = -1;
     128    pages   = _pages;
     129    curpage = _curpage;
     130}
     131
     132GotoDlg::~GotoDlg()
     133{
     134}
     135
     136ULONG GotoDlg::showDialog()
     137{
     138    return WinDlgBox( HWND_DESKTOP, hFrame, gotoDlgProc,
     139                      NULLHANDLE, IDD_GOTOPAGE, this );
     140}
     141
     142
     143
     144MRESULT EXPENTRY GotoDlg::gotoDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
     145{
     146    // This is a static method, so we don't know which instantiation we're
     147    // dealing with. But we can get a pseudo-this from the parameter to
     148    // WM_INITDLG, which we therafter store with the window and retrieve
     149    // as follows:
     150    GotoDlg *_this = (GotoDlg *)WinQueryWindowULong( hwnd, QWL_USER );
     151
     152    switch (msg)
     153    {
     154
     155        // Dialog has just been created
     156        case WM_INITDLG:
     157        {
     158            // Save the mp2 into our user data so that subsequent calls have
     159            // access to the parent C++ object
     160            WinSetWindowULong( hwnd, QWL_USER, (ULONG)mp2 );
     161            _this = (GotoDlg *)mp2;
     162            localizeDialog( hwnd );
     163            centerWindow( _this->hFrame, hwnd );
     164
     165            WinSendDlgItemMsg( hwnd, IDC_PAGE, SPBM_SETLIMITS,
     166                               MPFROMLONG( _this->pages ), MPFROMLONG( 1 ) );
     167            WinSendDlgItemMsg( hwnd, IDC_PAGE, SPBM_SETCURRENTVALUE,
     168                               MPFROMLONG( _this->curpage ), MPVOID );
     169            char *pgfrm = newstrdupL( GTP_OF );
     170            char pgnum[ 32 ];
     171            snprintf( pgnum, sizeof( pgnum ), pgfrm, _this->pages );
     172            delete pgfrm;
     173            WinSetDlgItemText( hwnd, IDC_PAGES, pgnum );
     174            return (MRESULT)FALSE;
     175        }
     176
     177        case WM_COMMAND:
     178            switch (SHORT1FROMMP(mp1))
     179            {
     180                case DID_OK:
     181                    {
     182                        LONG spbmValue = 0;
     183                        BOOL rc = (BOOL)WinSendDlgItemMsg( hwnd, IDC_PAGE, SPBM_QUERYVALUE,
     184                                            MPFROMP( &spbmValue ),
     185                                            MPFROM2SHORT( 0, SPBQ_UPDATEIFVALID ) );
     186
     187                        if ( rc && ( spbmValue > 0 ) ) {
     188                            _this->page = spbmValue;
     189                        }
     190                        WinDismissDlg( hwnd, DID_OK );
     191                    }
     192                    return (MRESULT)FALSE;
     193
     194                case DID_CANCEL:
     195                    WinDismissDlg( hwnd, DID_CANCEL );
     196                    return (MRESULT)FALSE;
     197            };
     198            return (MRESULT)FALSE;
     199    }
     200    return WinDefDlgProc( hwnd, msg, mp1, mp2 );
     201}
     202
  • trunk/Lucide/SOURCE/gui/findDlg.h

    r35 r87  
    5656};
    5757
     58class GotoDlg
     59{
     60    public:
     61        GotoDlg( HWND hWndFrame, long _pages, long _curpage );
     62        virtual ~GotoDlg();
     63
     64        ULONG showDialog();
     65        long getPage() { return page; }
     66
     67    private:
     68
     69        static MRESULT EXPENTRY gotoDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
     70
     71        HWND hFrame;
     72        long page;
     73        long pages;
     74        long curpage;
     75};
     76
    5877#endif // __FINDDLG_H
  • trunk/Lucide/SOURCE/gui/lucide.cpp

    r86 r87  
    113113    delete pgfrm;
    114114    WinSetDlgItemText( hToolBar, TBID_OFPAGES, pgnum );
    115     WinSendDlgItemMsg( hToolBar, TBID_PAGENUM, SPBM_SETLIMITS, (MPARAM)pages, (MPARAM)1 );
     115    WinSendDlgItemMsg( hToolBar, TBID_PAGENUM, SPBM_SETLIMITS,
     116                       MPFROMLONG( pages ), MPFROMLONG( 1 ) );
    116117}
    117118
    118119void Lucide::checkNavigationMenus()
    119120{
     121    WinEnableMenuItem( hWndMenu, CM_GOTOPAGE, TRUE );
    120122    BOOL enfirst = ( docViewer->getCurrentPage() != 0 );
    121123    BOOL enlast = ( docViewer->getCurrentPage() != ( doc->getPageCount( ev ) - 1 ) );
     
    655657                    return (MRESULT)FALSE;
    656658
     659                case CM_GOTOPAGE:
     660                {
     661                    GotoDlg *d = new GotoDlg( hWndFrame, doc->getPageCount( ev ),
     662                                                docViewer->getCurrentPage() + 1 );
     663                    if ( d->showDialog() == DID_OK ) {
     664                        long pg = d->getPage();
     665                        if ( pg > 0 ) {
     666                            Lucide::goToPage( pg - 1 );
     667                        }
     668                    }
     669                    delete d;
     670                    return (MRESULT)FALSE;
     671                }
     672
    657673                case CM_FITWINDOW:
    658674                    Lucide::setZoom( -2 );
  • trunk/Lucide/SOURCE/gui/messages.cpp

    r64 r87  
    8989const char *FIND_SEARCH_PAGE_OF = "FIND_SEARCH_PAGE_OF";
    9090const char *FIND_NOT_FOUND      = "FIND_NOT_FOUND";
     91
     92// 'Go to page' dialog
     93const char *GTP_OF = "GTP_OF";
  • trunk/Lucide/SOURCE/gui/messages.h

    r64 r87  
    8989extern const char *FIND_NOT_FOUND;
    9090
     91// 'Go to page' dialog
     92extern const char *GTP_OF;
     93
    9194
    9295#endif // __MESSAGES_H
  • trunk/Lucide/SOURCE/gui/toolbar.cpp

    r64 r87  
    182182                                     WS_VISIBLE|SPBS_MASTER|SPBS_NUMERICONLY|SPBS_JUSTCENTER,
    183183                                     0,0,0,0, hToolBar, HWND_TOP, TBID_PAGENUM, NULL, NULL );
    184     WinSendMsg( cs.ctrlHandle, SPBM_SETLIMITS, (MPARAM)0, (MPARAM)0 );
     184    WinSendMsg( cs.ctrlHandle, SPBM_SETLIMITS, MPFROMLONG( 0 ), MPFROMLONG( 0 ) );
    185185    WinSetPresParam( cs.ctrlHandle, PP_FONTNAMESIZE, deffontlen, deffont );
    186186    cs.cx = 50;
  • trunk/Lucide/SOURCE/plugins/ludjvu/ludjvu.cpp

    r86 r87  
    4242#include <ddjvuapi.h>
    4343#endif
     44#ifdef __GNUC__
     45#define __min(a,b)  (((a) < (b)) ? (a) : (b))
     46#endif
    4447
    4548#define SCALE_FACTOR 0.2
Note: See TracChangeset for help on using the changeset viewer.