Changeset 138


Ignore:
Timestamp:
Oct 9, 2006, 5:32:58 PM (15 years ago)
Author:
Eugene Romanenko
Message:

Better solution for #78, move GUI to DLL, executor sets BeginLibPath? and loads GUI DLL (closes #78)

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

Legend:

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

    r127 r138  
    100100    WinSetWindowULong( hwnd, QWL_USER, (ULONG)ld );
    101101    HPS hps = WinGetPS( hwnd );
    102     ld->image = GpiLoadBitmap( hps, NULLHANDLE, IDB_LOGO, 0, 0 );
     102    ld->image = GpiLoadBitmap( hps, _hmod, IDB_LOGO, 0, 0 );
    103103    WinReleasePS( hps );
    104104    WinInvalidateRect( hwnd, NULL, FALSE );
     
    121121                WinSetDlgItemText( hwnd, IDT_LUCIDEVERSION, buf );
    122122
    123                 HPOINTER p = WinLoadPointer( HWND_DESKTOP, NULLHANDLE, IDP_HAND );
     123                HPOINTER p = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_HAND );
    124124                setLinkPointer( p );
    125125
     
    143143    hWndFrame = _hWndFrame;
    144144    WinDlgBox( HWND_DESKTOP, hWndFrame, AboutProc,
    145                NULLHANDLE, IDD_ABOUT, NULL );
     145               _hmod, IDD_ABOUT, NULL );
    146146}
    147147
  • trunk/Lucide/SOURCE/gui/docInfoDlg.cpp

    r35 r138  
    4040#include <ludoc.xh>
    4141
     42#include "globals.h"
    4243#include "luutils.h"
    4344#include "docInfoDlg.h"
     
    5960{
    6061    WinDlgBox( HWND_DESKTOP, hFrame, docInfoDlgProc,
    61                NULLHANDLE, IDD_DOCINFO, this );
     62               _hmod, IDD_DOCINFO, this );
    6263    delete this;
    6364}
  • trunk/Lucide/SOURCE/gui/docViewer.cpp

    r127 r138  
    126126    haveLinks = false;
    127127    links = NULL;
    128     handPtr = WinLoadPointer( HWND_DESKTOP, NULLHANDLE, IDP_HAND );
    129     zoomInPtr = WinLoadPointer( HWND_DESKTOP, NULLHANDLE, IDP_ZOOM_IN );
    130     zoomOutPtr = WinLoadPointer( HWND_DESKTOP, NULLHANDLE, IDP_ZOOM_OUT );
     128    handPtr = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_HAND );
     129    zoomInPtr = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_ZOOM_IN );
     130    zoomOutPtr = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_ZOOM_OUT );
    131131    // search
    132132    foundrects = NULL;
     
    137137    ULONG dfFlags = FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_NOBYTEALIGN;
    138138    hWndDocFrame = WinCreateStdWindow( hWndFrame, WS_VISIBLE, &dfFlags, NULL, NULL,
    139                                        WS_VISIBLE, NULLHANDLE, 0, NULL );
     139                                       WS_VISIBLE, _hmod, 0, NULL );
    140140    WinSetWindowULong( hWndDocFrame, QWL_USER, (ULONG)this );
    141141    oldFrameProc = WinSubclassWindow( hWndDocFrame, docFrameProc );
  • trunk/Lucide/SOURCE/gui/findDlg.cpp

    r87 r138  
    3838#include <stdio.h>
    3939
     40#include "globals.h"
    4041#include "findDlg.h"
    4142#include "Lucide_res.h"
     
    6061{
    6162    return WinDlgBox( HWND_DESKTOP, hFrame, findDlgProc,
    62                       NULLHANDLE, IDD_FIND, this );
     63                      _hmod, IDD_FIND, this );
    6364}
    6465
     
    137138{
    138139    return WinDlgBox( HWND_DESKTOP, hFrame, gotoDlgProc,
    139                       NULLHANDLE, IDD_GOTOPAGE, this );
     140                      _hmod, IDD_GOTOPAGE, this );
    140141}
    141142
  • trunk/Lucide/SOURCE/gui/fontsInfoDlg.cpp

    r99 r138  
    7474{
    7575    WinDlgBox( HWND_DESKTOP, hFrame, fontsInfoDlgProc,
    76                NULLHANDLE, IDD_FONTINFO, this );
     76               _hmod, IDD_FONTINFO, this );
    7777    delete this;
    7878}
  • trunk/Lucide/SOURCE/gui/lcd.c

    r130 r138  
    4545
    4646char lucideDir[ CCHMAXPATH ] = "";
    47 char lucideExe[ CCHMAXPATH ] = "";
     47
     48typedef APIRET (APIENTRY *LMain)(int argc, char **argv);
    4849
    4950int main( int argc, char *argv[] )
    5051{
     52    int result = 1;
    5153    char *last_slash;
     54    HMODULE hmod = NULLHANDLE;
     55
     56#ifdef __TEST__
     57    PPIB pib;
     58    PTIB tib;
     59    DosGetInfoBlocks(&tib, &pib);
     60    pib->pib_ultype = 3;
     61#endif
    5262
    5363    // fill lucide dir
     
    5969        *last_slash = 0;
    6070    }
    61     // fill lucide exe
    62     strcpy( lucideExe, lucideDir );
    63     strcat( lucideExe, "\\Lucide.exe" );
    6471
    6572    // set beginlibpath
    6673    DosSetExtLIBPATH( lucideDir, BEGIN_LIBPATH );
    6774
    68     // execute lucide
    69     execvp( lucideExe, (char const **)argv );
     75    if ( DosLoadModule( NULL, 0, "Lucide", &hmod ) == 0 )
     76    {
     77        PFN pfn = NULL;
     78        if ( DosQueryProcAddr( hmod, 0, "LucideMain", &pfn ) == 0 )
     79        {
     80            LMain LucideMain = (LMain)pfn;
     81            result = LucideMain( argc, argv );
     82        }
     83        DosFreeModule (hmod);
     84    }
    7085
    71     return 0;
     86    return result;
    7287}
    7388
  • trunk/Lucide/SOURCE/gui/lucide.cpp

    r132 r138  
    108108char        *Lucide::loadError                     = NULL;
    109109
     110HMODULE _hmod = NULLHANDLE;
     111
     112unsigned APIENTRY LibMain( unsigned hmod, unsigned termination )
     113{
     114    if ( termination ) {
     115        /* DLL is detaching from process */
     116    } else {
     117        /* DLL is attaching to process */
     118        _hmod = hmod;
     119    }
     120    return( 1 );
     121}
     122
    110123
    111124PFNWP pOldSplProc;
     
    805818int deffontlen = sizeof( deffont );
    806819
    807 int main( int argc, char **argv )
    808 {
    809 #ifdef __TEST__
    810     PPIB pib;
    811     PTIB tib;
    812     DosGetInfoBlocks(&tib, &pib);
    813     pib->pib_ultype = 3;
    814 #endif
    815 
     820extern "C" APIRET APIENTRY LucideMain( int argc, char *argv[] )
     821{
    816822    HMQ   hmq;
    817823    QMSG  qmsg;
     
    833839    title = newstrdupL( MSGS_MAIN_WIN_TITLE );
    834840    hWndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulFrameFlags, NULL, title,
    835                                     WS_SYNCPAINT|WS_VISIBLE, NULLHANDLE, IDI_MAIN_ICON, NULL );
     841                                    WS_SYNCPAINT|WS_VISIBLE, _hmod, IDI_MAIN_ICON, NULL );
    836842    hFrameSysmenu  = WinWindowFromID( hWndFrame, FID_SYSMENU );
    837843    hFrameTitlebar = WinWindowFromID( hWndFrame, FID_TITLEBAR );
    838844    hFrameMinMax   = WinWindowFromID( hWndFrame, FID_MINMAX );
    839     WinSetAccelTable( hab, WinLoadAccelTable( hab, NULLHANDLE, IDA_MAINACCEL ), hWndFrame );
    840     hWndMenu = WinLoadMenu( hWndFrame, NULLHANDLE, IDM_MAINMENU );
     845    WinSetAccelTable( hab, WinLoadAccelTable( hab, _hmod, IDA_MAINACCEL ), hWndFrame );
     846    hWndMenu = WinLoadMenu( hWndFrame, _hmod, IDM_MAINMENU );
    841847    localizeMenu( hWndMenu );
    842848    WinSetWindowUShort( hWndMenu, QWS_ID, FID_MENU );
  • trunk/Lucide/SOURCE/gui/makefile

    r130 r138  
    2020
    2121.CPP.OBJ:
    22      WPP386 @make.cfg -fo$@ $<
     22     WPP386 @make.cfg -xs -fo$@ $<
    2323
    2424.C.OBJ:
    25      WCC386 -zq -zp=4 -bm -sg -fo$@ $<
     25     WCC386 @make.cfg -fo$@ $<
    2626
    2727.idl.xh:
     
    2929
    3030
    31 all: make.cfg Lucide.exe lcd.exe
     31all: make.cfg lucide.dll Lucide.exe
    3232   DEL MAKE.CFG
    3333
     
    3939       print.obj stbrowser.obj
    4040
    41 Lucide.exe: $(OBJS) Lucide.res
     41lucide.dll: $(OBJS) lucide.res
    4242  copy &&|
    4343option quiet
    44 system $(BMODE)
    45 option map=$(OBJDIR)\lucide
     44system os2v2 dll initinstance terminstance
     45option map=$(OBJDIR)\lucide_dll
    4646option statics
    47 file $(OBJDIR)\Lucide.obj
     47file $(OBJDIR)\lucide.obj
    4848file $(OBJDIR)\luutils.obj
    4949file $(OBJDIR)\clipbrd.obj
     
    6969file $(OBJDIR)\messages.obj
    7070file $(OBJDIR)\stbrowser.obj
    71 name $(EXEDIR)\Lucide
     71name $(EXEDIR)\lucide
    7272lib ..\plugins\ludoc\ludoc
    7373lib somtk
     74export LucideMain
    7475| tmpmake.lnk >NUL
    7576    wlink @tmpmake.lnk
    76     RC -n $(OBJDIR)\Lucide.res $(EXEDIR)\Lucide.exe >NUL
     77    RC -n $(OBJDIR)\lucide.res $(EXEDIR)\lucide.dll >NUL
    7778    del tmpmake.lnk
    7879
    7980
    80 lcd.exe: lcd.obj lcd.res
     81Lucide.exe: lcd.obj lcd.res
    8182  copy &&|
    8283option quiet
    83 system os2v2_pm
    84 option map=$(OBJDIR)\lcd
     84system $(BMODE)
     85option map=$(OBJDIR)\lucide
    8586option statics
    8687file $(OBJDIR)\lcd.obj
    87 name $(EXEDIR)\lcd
     88name $(EXEDIR)\Lucide
    8889| tmpmake.lnk >NUL
    8990    wlink @tmpmake.lnk
    90     RC -n $(OBJDIR)\lcd.res $(EXEDIR)\lcd.exe >NUL
     91    RC -n $(OBJDIR)\lcd.res $(EXEDIR)\Lucide.exe >NUL
    9192    del tmpmake.lnk
    9293
     
    101102Lucide.cpp: ..\plugins\ludoc\ludoc.xh
    102103
    103 Lucide.obj:         Lucide.cpp         makefile
     104Lucide.obj:         Lucide.cpp
    104105luutils.obj:        luutils.cpp
    105106clipbrd.obj:        clipbrd.cpp
     
    125126wwbtn.obj:          wwbtn.c
    126127stbrowser.obj:      stbrowser.c
    127 lcd.obj:            lcd.c
     128lcd.obj:            lcd.c               makefile
    128129
    129130
     
    133134-zp=4
    134135-bm
    135 -xs
    136136-sg
    137137-DVERSION="$(VERSION)" 
  • trunk/Lucide/SOURCE/gui/pluginViewDlg.cpp

    r35 r138  
    3636#include <os2.h>
    3737
     38#include "globals.h"
    3839#include "luutils.h"
    3940#include "pluginViewDlg.h"
     
    6162{
    6263    WinDlgBox( HWND_DESKTOP, hFrame, pluginViewDlgProc,
    63                NULLHANDLE, IDD_VIEWPLUGINS, this );
     64               _hmod, IDD_VIEWPLUGINS, this );
    6465    delete this;
    6566}
  • trunk/Lucide/SOURCE/gui/printDlg.cpp

    r133 r138  
    7171{
    7272    return WinDlgBox( HWND_DESKTOP, hFrame, printDlgProc,
    73                       NULLHANDLE, IDD_PRINT, this );
     73                      _hmod, IDD_PRINT, this );
    7474}
    7575
  • trunk/Lucide/SOURCE/gui/progressDlg.cpp

    r61 r138  
    4040#include <stdio.h>
    4141
     42#include "globals.h"
    4243#include "luutils.h"
    4344#include "progressDlg.h"
     
    7273    threadData = _threadData;
    7374    WinDlgBox( HWND_DESKTOP, hFrame, progressDlgProc,
    74                NULLHANDLE, IDD_PROGRESS, this );
     75               _hmod, IDD_PROGRESS, this );
    7576}
    7677
  • trunk/Lucide/SOURCE/gui/settingsDlg.cpp

    r133 r138  
    5858{
    5959    WinDlgBox( HWND_DESKTOP, hFrame, settingsDlgProc,
    60                NULLHANDLE, IDD_SETTINGS, this );
     60               _hmod, IDD_SETTINGS, this );
    6161    delete this;
    6262}
  • trunk/Lucide/SOURCE/gui/toolbar.cpp

    r129 r138  
    160160    bs.bubbleHmod = NULLHANDLE;
    161161    bs.pictRes = IDB_OPEN;
    162     bs.pictHmod = NULLHANDLE;
     162    bs.pictHmod = _hmod;
    163163    bs.menuRes = 0;
    164164    bs.menuHmod = NULLHANDLE;
     
    172172    bs.bubbleHmod = NULLHANDLE;
    173173    bs.pictRes = IDB_PRINT;
    174     bs.pictHmod = NULLHANDLE;
     174    bs.pictHmod = _hmod;
    175175    bs.menuRes = 0;
    176176    bs.menuHmod = NULLHANDLE;
     
    186186    bs.bubbleHmod = NULLHANDLE;
    187187    bs.pictRes = IDB_NAVPANE;
    188     bs.pictHmod = NULLHANDLE;
     188    bs.pictHmod = _hmod;
    189189    bs.menuRes = 0;
    190190    bs.menuHmod = NULLHANDLE;
     
    200200    bs.bubbleHmod = NULLHANDLE;
    201201    bs.pictRes = IDB_FIRSTPAGE;
    202     bs.pictHmod = NULLHANDLE;
     202    bs.pictHmod = _hmod;
    203203    bs.menuRes = 0;
    204204    bs.menuHmod = NULLHANDLE;
     
    212212    bs.bubbleHmod = NULLHANDLE;
    213213    bs.pictRes = IDB_PREVPAGE;
    214     bs.pictHmod = NULLHANDLE;
     214    bs.pictHmod = _hmod;
    215215    bs.menuRes = 0;
    216216    bs.menuHmod = NULLHANDLE;
     
    253253    bs.bubbleHmod = NULLHANDLE;
    254254    bs.pictRes = IDB_NEXTPAGE;
    255     bs.pictHmod = NULLHANDLE;
     255    bs.pictHmod = _hmod;
    256256    bs.menuRes = 0;
    257257    bs.menuHmod = NULLHANDLE;
     
    265265    bs.bubbleHmod = NULLHANDLE;
    266266    bs.pictRes = IDB_LASTPAGE;
    267     bs.pictHmod = NULLHANDLE;
     267    bs.pictHmod = _hmod;
    268268    bs.menuRes = 0;
    269269    bs.menuHmod = NULLHANDLE;
     
    279279    bs.bubbleHmod = NULLHANDLE;
    280280    bs.pictRes = IDB_100PERC;
    281     bs.pictHmod = NULLHANDLE;
     281    bs.pictHmod = _hmod;
    282282    bs.menuRes = 0;
    283283    bs.menuHmod = NULLHANDLE;
     
    291291    bs.bubbleHmod = NULLHANDLE;
    292292    bs.pictRes = IDB_FITPAGE;
    293     bs.pictHmod = NULLHANDLE;
     293    bs.pictHmod = _hmod;
    294294    bs.menuRes = 0;
    295295    bs.menuHmod = NULLHANDLE;
     
    303303    bs.bubbleHmod = NULLHANDLE;
    304304    bs.pictRes = IDB_FITWIDTH;
    305     bs.pictHmod = NULLHANDLE;
     305    bs.pictHmod = _hmod;
    306306    bs.menuRes = 0;
    307307    bs.menuHmod = NULLHANDLE;
     
    329329    bs.bubbleHmod = NULLHANDLE;
    330330    bs.pictRes = IDB_FIND;
    331     bs.pictHmod = NULLHANDLE;
     331    bs.pictHmod = _hmod;
    332332    bs.menuRes = 0;
    333333    bs.menuHmod = NULLHANDLE;
     
    341341    bs.bubbleHmod = NULLHANDLE;
    342342    bs.pictRes = IDB_FINDAGAIN;
    343     bs.pictHmod = NULLHANDLE;
     343    bs.pictHmod = _hmod;
    344344    bs.menuRes = 0;
    345345    bs.menuHmod = NULLHANDLE;
     
    355355    bs.bubbleHmod = NULLHANDLE;
    356356    bs.pictRes = IDB_MGLASS;
    357     bs.pictHmod = NULLHANDLE;
     357    bs.pictHmod = _hmod;
    358358    bs.menuRes = 0;
    359359    bs.menuHmod = NULLHANDLE;
Note: See TracChangeset for help on using the changeset viewer.