Changeset 61 for trunk/NewView


Ignore:
Timestamp:
Jan 14, 2007, 8:02:42 PM (19 years ago)
Author:
RBRi
Message:

another refactoring step for cleaning up the command line handling

Location:
trunk/NewView
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/DebugUnit.pas

    r55 r61  
    2626  // -- Logging --
    2727  Type
    28     LogAspect = (LogStartup, LogShutdown, LogSettings, LogParse, LogDisplay, LogSearch, LogViewStub);
     28    LogAspect = (LogStartup, LogShutdown, LogSettings, LogParse, LogDisplay, LogSearch, LogViewStub, LogObjConstDest);
    2929    LogAspects = SET OF LogAspect;
    3030
     
    4646const
    4747  activeLogAspects : LogAspects = [
    48                                         LogStartup
     48                                        LogStartup,
    4949//                                        LogShutdown,
    5050//                                        LogSettings,
     
    5252//                                        LogDisplay,
    5353//                                        LogSearch,
    54 //                                        LogViewStub
     54                                        LogViewStub,
     55                                        LogObjConstDest
    5556                                  ];
    5657
     
    6465  Begin
    6566    Case aLogAspect of
    66       LogStartup  :  result := 'Startup';
    67       LogShutdown :  result := 'Start';
    68       LogSettings :  result := 'Settings';
    69       LogParse    :  result := 'Parse';
    70       LogDisplay  :  result := 'Display';
    71       LogSearch   :  result := 'Search';
    72       LogViewStub :  result := 'ViewStub';
    73       else           result := 'Unknown';
     67      LogStartup      :  result := 'Startup';
     68      LogShutdown     :  result := 'Start';
     69      LogSettings     :  result := 'Settings';
     70      LogParse        :  result := 'Parse';
     71      LogDisplay      :  result := 'Display';
     72      LogSearch       :  result := 'Search';
     73      LogViewStub     :  result := 'ViewStub';
     74      LogObjConstDest :  result := 'ObjConstDest';
     75      else               result := 'Unknown';
    7476      end;
    7577  End;
  • trunk/NewView/GlobalFilelistUnit.pas

    r32 r61  
    5050
    5151uses
     52  DebugUnit,
    5253  ACLStringUtility,
    5354  SysUtils;
     
    5556constructor TGlobalFilelist.Create;
    5657begin
     58  LogEvent(LogObjConstDest, '+ TGlobalFilelist.Create');
     59
    5760  FMem := TSuballocatedSharedMemory.Create( 'NEWVIEW_GLOBAL_FILELIST',
    5861                                            GLOBAL_FILELIST_SIZE,
     
    6871destructor TGlobalFilelist.Destroy;
    6972begin
     73  LogEvent(LogObjConstDest, '- TGlobalFilelist.Destroy');
     74
    7075  FMem.Destroy;
    7176  FMutex.Destroy;
  • trunk/NewView/MainForm.pas

    r60 r61  
    813813Var
    814814  MainForm: TMainForm;
     815  CmdLineParameters : TCmdLineParameters;
    815816
    816817Implementation
     
    22702271    Lines.Add('');
    22712272    Lines.Add('parsed infos:');
     2273
    22722274    Lines.Add('getShowUsageFlag: ' + boolToStr(CmdLineParameters.getShowUsageFlag));
    22732275    Lines.Add('getSearchFlag: ' + boolToStr(CmdLineParameters.getSearchFlag));
  • trunk/NewView/NewView.spr

    r44 r61  
    1717[Breakpoints]
    1818
    19 Breakpoint0=.\MAINFORM.PAS|2271
     19Breakpoint0=.\MAINFORM.PAS|4261
    2020
    2121[Browser Files]
     
    6060File37=CUSTOMHEADERCONTROL
    6161File38=MULTICOLUMNLISTBOX
    62 File39=ACLPROFILE
    63 File40=ACLFINDFUNCTIONS
    64 File41=ACLFILEUTILITY
    65 File42=ACLLANGUAGEUNIT
    66 File43=GENERICTHREAD
    67 File44=STRINGUTILSUNIT
    68 File45=DEBUGUNIT
    69 File46=CMDLINEPARAMETERUNIT
    70 File47=SPLITBAR
    71 File48=CONTROLSCROLLING
    72 File49=OUTLINE2
    73 File50=CANVASFONTMANAGER
    74 File51=RICHTEXTDOCUMENTUNIT
    75 File52=RICHTEXTSTYLEUNIT
    76 File53=CLIPBRD
    77 File54=RICHTEXTLAYOUTUNIT
    78 File55=CONTROLSUTILITY
    79 File56=RICHTEXTDISPLAYUNIT
    80 File57=RICHTEXTVIEW
    81 File58=CUSTOMLISTBOX
    82 File59=IPFFILEFORMATUNIT
    83 File60=HELPWINDOWDIMENSIONS
    84 File61=ASTRINGUTILITYUNIT
    85 File62=SETTINGSUNIT
    86 File63=HELPTOPIC
    87 File64=CUSTOMMEMO
    88 File65=SYSTEMICONUNIT
    89 File66=ACLMESSAGEFORM
    90 File67=ACLDIALOGS
    91 File68=HELPBITMAP
    92 File69=SEARCHTABLE
    93 File70=HELPFILE
    94 File71=HELPWINDOWUNIT
    95 File72=NAVIGATEPOINTUNIT
    96 File73=MISCUNIT
    97 File74=HELPMANAGERUNIT
    98 File75=TEXTSEARCHQUERY
    99 File76=TABSET2UNIT
    100 File77=RUNPROGRAMUNIT
    101 File78=RICHTEXTPRINTUNIT
    102 File79=INFORMATIONFORMUNIT
    103 File80=COLORMAPPING
    104 File81=COLORWHEEL
    105 File82=CUSTOMFONTDIALOG
    106 File83=BSEDEV
    107 File84=DRIVEINFOUNIT
    108 File85=BITMAPUTILITY
    109 File86=CUSTOMFILECONTROLS
    110 File87=FILEDIALOGFORM
    111 File88=OPTIONSFORM
    112 File89=VERSIONUNIT
    113 File90=WEBBROWSERUNIT
    114 File91=PRODUCTINFORMATIONFORMUNIT
    115 File92=NOTEFORM
    116 File93=LED
    117 File94=SEARCHUNIT
    118 File95=SEARCHDIRECTORIESFORMUNIT
    119 File96=GLOBALSEARCHFORM
    120 File97=BOOKMARKSFORMUNIT
    121 File98=PRINTDIALOGUNIT
    122 File99=GLOBALFILELISTUNIT
    123 File100=STARTUPUNIT
    124 File101=MAINFORM
     62File39=ACLFINDFUNCTIONS
     63File40=ACLFILEUTILITY
     64File41=ACLLANGUAGEUNIT
     65File42=GENERICTHREAD
     66File43=STRINGUTILSUNIT
     67File44=DEBUGUNIT
     68File45=CMDLINEPARAMETERUNIT
     69File46=SPLITBAR
     70File47=CONTROLSCROLLING
     71File48=OUTLINE2
     72File49=CANVASFONTMANAGER
     73File50=RICHTEXTDOCUMENTUNIT
     74File51=RICHTEXTSTYLEUNIT
     75File52=CLIPBRD
     76File53=RICHTEXTLAYOUTUNIT
     77File54=CONTROLSUTILITY
     78File55=RICHTEXTDISPLAYUNIT
     79File56=RICHTEXTVIEW
     80File57=CUSTOMLISTBOX
     81File58=IPFFILEFORMATUNIT
     82File59=HELPWINDOWDIMENSIONS
     83File60=ASTRINGUTILITYUNIT
     84File61=SETTINGSUNIT
     85File62=HELPTOPIC
     86File63=CUSTOMMEMO
     87File64=SYSTEMICONUNIT
     88File65=ACLMESSAGEFORM
     89File66=ACLDIALOGS
     90File67=HELPBITMAP
     91File68=SEARCHTABLE
     92File69=HELPFILE
     93File70=HELPWINDOWUNIT
     94File71=NAVIGATEPOINTUNIT
     95File72=MISCUNIT
     96File73=HELPMANAGERUNIT
     97File74=TEXTSEARCHQUERY
     98File75=TABSET2UNIT
     99File76=RUNPROGRAMUNIT
     100File77=RICHTEXTPRINTUNIT
     101File78=INFORMATIONFORMUNIT
     102File79=COLORMAPPING
     103File80=COLORWHEEL
     104File81=CUSTOMFONTDIALOG
     105File82=BSEDEV
     106File83=DRIVEINFOUNIT
     107File84=BITMAPUTILITY
     108File85=CUSTOMFILECONTROLS
     109File86=FILEDIALOGFORM
     110File87=OPTIONSFORM
     111File88=VERSIONUNIT
     112File89=WEBBROWSERUNIT
     113File90=PRODUCTINFORMATIONFORMUNIT
     114File91=NOTEFORM
     115File92=LED
     116File93=SEARCHUNIT
     117File94=SEARCHDIRECTORIESFORMUNIT
     118File95=GLOBALSEARCHFORM
     119File96=BOOKMARKSFORMUNIT
     120File97=PRINTDIALOGUNIT
     121File98=GLOBALFILELISTUNIT
     122File99=STARTUPUNIT
     123File100=MAINFORM
    125124
    126125[Compiler Options]
     
    152151[Directories]
    153152
    154 LastDir=P:\NEWVIEW_DEV\Components
     153LastDir=P:\NEWVIEW_DEV\NEWVIEW
    155154OutDir=P:\newview_dev\build\newview
    156155LibDir=P:\newview_dev\build\sibyl\lib;P:\newview_dev\build\components;P:\newview_dev\build\library
     
    170169[Find History]
    171170
    172 Find0=profile
    173 Find1=CmdLineParameters
    174 Find2=tmpCmdLineParameters
    175 Find3=Startup
    176 Find4=searchtext
    177 Find5=color
    178 Find6=beta3
    179 Find7=StrDoubleQuote
    180 Find8=quote
    181 Find9=t
    182 Find10=impl
    183 Find11=rbri
    184 Find12=url
    185 Find13=TSerializableStringList
    186 Find14=StrUnDoubleQuote
    187 Find15=FullDoubleQuote
     171Find0=getOwn
     172Find1=rbri
     173Find2=FindDefaultLanguageHelpFile
     174Find3=GetOwnHelpFileName
     175Find4=Filenames
     176Find5=getSearchFlag
     177Find6=parseCmdLine
     178Find7=Profile
     179Find8=profile
     180Find9=CmdLineParameters
     181Find10=tmpCmdLineParameters
     182Find11=Startup
     183Find12=searchtext
     184Find13=color
     185Find14=beta3
     186Find15=StrDoubleQuote
    188187
    189188[General]
     
    194193CompLibName=D:\progs\Sibyl\Bin\CompLib.dll
    195194Win32CompLibName=D:\progs\Sibyl\Bin\CompLib.dll
    196 RunParameter=p:\newview_dev\test\rendering\rendering.hlp
     195RunParameter=-h
    197196InActiveLanguages=
    198197CurrentLanguage=Default
     
    201200[Last Closed Files]
    202201
    203 File0=.\unittests\cmdlineparameterunittests.pas
    204 File1=.\VersionUnit.pas
    205 File2=..\.\Library\ACLStringUtility.pas
    206 File3=..\.\SIBYL\RTL\SYSTEM.PAS
    207 File4=.\HelpFile.pas
     202File0=..\.\SIBYL\RTL\SYSTEM.PAS
     203File1=.\HelpFile.pas
     204File2=.\SettingsUnit.pas
     205File3=.\SearchUnit.pas
     206File4=.\GlobalSearchForm.pas
     207File5=..\.\Library\ACLProfile.pas
    208208
    209209[Last Open Files]
     
    215215File0.Height=481
    216216File0.Column=1
    217 File0.Line=5
     217File0.Line=2295
    218218File1=.\NewView.pas
    219219File1.Left=-4
     
    228228File2.Width=1243
    229229File2.Height=481
    230 File2.Column=1
    231 File2.Line=1232
     230File2.Column=31
     231File2.Line=251
    232232File3=..\.\LIBRARY\RunProgramUnit.pas
    233233File3.Left=-4
     
    242242File4.Width=1243
    243243File4.Height=481
    244 File4.Column=40
    245 File4.Line=280
     244File4.Column=15
     245File4.Line=31
    246246File5=.\StartupUnit.pas
    247247File5.Left=-4
     
    249249File5.Width=1243
    250250File5.Height=481
    251 File5.Column=13
    252 File5.Line=319
     251File5.Column=37
     252File5.Line=166
    253253File6=.\CmdLineParameterUnit.pas
    254254File6.Left=-4
     
    256256File6.Width=1243
    257257File6.Height=481
    258 File6.Column=26
    259 File6.Line=162
     258File6.Column=12
     259File6.Line=105
    260260File7=.\DebugUnit.pas
    261261File7.Left=-4
     
    263263File7.Width=1243
    264264File7.Height=481
    265 File7.Column=1
    266 File7.Line=31
    267 File8=..\.\Library\ACLProfile.pas
     265File7.Column=51
     266File7.Line=48
     267File8=.\HelpManagerUnit.pas
    268268File8.Left=-4
    269269File8.Bottom=-5
    270270File8.Width=1243
    271271File8.Height=481
    272 File8.Column=21
    273 File8.Line=43
    274 File9=..\.\Components\ACLLanguageUnit.pas
    275 File9.Left=-4
    276 File9.Bottom=-5
    277 File9.Width=1243
    278 File9.Height=481
    279 File9.Column=3
    280 File9.Line=799
     272File8.Column=13
     273File8.Line=51
    281274
    282275[Linker Options]
     
    299292MainFile0=.\NewView.pas
    300293MainFile0.Ext=.EXE
    301 MainFile0.Checksum=26624
     294MainFile0.Checksum=26368
    302295MainFile0.Expanded=False
    303296MainFile0.File0=.\BookmarksFormUnit.pas
     
    369362MainFile0.Dependency37=..\.\components\CUSTOMHEADERCONTROL.PAS
    370363MainFile0.Dependency38=..\.\components\MULTICOLUMNLISTBOX.PAS
    371 MainFile0.Dependency39=..\.\library\ACLPROFILE.PAS
    372 MainFile0.Dependency40=..\.\library\ACLFINDFUNCTIONS.PAS
    373 MainFile0.Dependency41=..\.\library\ACLFILEUTILITY.PAS
    374 MainFile0.Dependency42=..\.\components\ACLLANGUAGEUNIT.PAS
    375 MainFile0.Dependency43=..\.\components\GENERICTHREAD.PAS
    376 MainFile0.Dependency44=.\STRINGUTILSUNIT.PAS
    377 MainFile0.Dependency45=.\DEBUGUNIT.PAS
    378 MainFile0.Dependency46=.\CMDLINEPARAMETERUNIT.PAS
    379 MainFile0.Dependency47=..\.\components\SPLITBAR.PAS
    380 MainFile0.Dependency48=..\.\components\CONTROLSCROLLING.PAS
    381 MainFile0.Dependency49=..\.\components\OUTLINE2.PAS
    382 MainFile0.Dependency50=..\.\components\CANVASFONTMANAGER.PAS
    383 MainFile0.Dependency51=..\.\components\RICHTEXTDOCUMENTUNIT.PAS
    384 MainFile0.Dependency52=..\.\components\RICHTEXTSTYLEUNIT.PAS
    385 MainFile0.Dependency53=..\.\sibyl\spcc\CLIPBRD.PAS
    386 MainFile0.Dependency54=..\.\components\RICHTEXTLAYOUTUNIT.PAS
    387 MainFile0.Dependency55=..\.\components\CONTROLSUTILITY.PAS
    388 MainFile0.Dependency56=..\.\components\RICHTEXTDISPLAYUNIT.PAS
    389 MainFile0.Dependency57=..\.\components\RICHTEXTVIEW.PAS
    390 MainFile0.Dependency58=..\.\components\CUSTOMLISTBOX.PAS
    391 MainFile0.Dependency59=.\IPFFILEFORMATUNIT.PAS
    392 MainFile0.Dependency60=.\HELPWINDOWDIMENSIONS.PAS
    393 MainFile0.Dependency61=..\.\library\ASTRINGUTILITYUNIT.PAS
    394 MainFile0.Dependency62=.\SETTINGSUNIT.PAS
    395 MainFile0.Dependency63=.\HELPTOPIC.PAS
    396 MainFile0.Dependency64=..\.\components\CUSTOMMEMO.PAS
    397 MainFile0.Dependency65=..\.\components\SYSTEMICONUNIT.PAS
    398 MainFile0.Dependency66=..\.\components\ACLMESSAGEFORM.PAS
    399 MainFile0.Dependency67=..\.\components\ACLDIALOGS.PAS
    400 MainFile0.Dependency68=.\HELPBITMAP.PAS
    401 MainFile0.Dependency69=.\SEARCHTABLE.PAS
    402 MainFile0.Dependency70=.\HELPFILE.PAS
    403 MainFile0.Dependency71=.\HELPWINDOWUNIT.PAS
    404 MainFile0.Dependency72=.\NAVIGATEPOINTUNIT.PAS
    405 MainFile0.Dependency73=.\MISCUNIT.PAS
    406 MainFile0.Dependency74=.\HELPMANAGERUNIT.PAS
    407 MainFile0.Dependency75=.\TEXTSEARCHQUERY.PAS
    408 MainFile0.Dependency76=..\.\components\TABSET2UNIT.PAS
    409 MainFile0.Dependency77=..\.\library\RUNPROGRAMUNIT.PAS
    410 MainFile0.Dependency78=..\.\components\RICHTEXTPRINTUNIT.PAS
    411 MainFile0.Dependency79=.\INFORMATIONFORMUNIT.PAS
    412 MainFile0.Dependency80=..\.\components\COLORMAPPING.PAS
    413 MainFile0.Dependency81=..\.\components\COLORWHEEL.PAS
    414 MainFile0.Dependency82=..\.\components\CUSTOMFONTDIALOG.PAS
    415 MainFile0.Dependency83=..\.\sibyl\rtl\BSEDEV.PAS
    416 MainFile0.Dependency84=..\.\components\DRIVEINFOUNIT.PAS
    417 MainFile0.Dependency85=..\.\components\BITMAPUTILITY.PAS
    418 MainFile0.Dependency86=..\.\components\CUSTOMFILECONTROLS.PAS
    419 MainFile0.Dependency87=.\FILEDIALOGFORM.PAS
    420 MainFile0.Dependency88=.\OPTIONSFORM.PAS
    421 MainFile0.Dependency89=.\VERSIONUNIT.PAS
    422 MainFile0.Dependency90=..\.\components\WEBBROWSERUNIT.PAS
    423 MainFile0.Dependency91=.\PRODUCTINFORMATIONFORMUNIT.PAS
    424 MainFile0.Dependency92=.\NOTEFORM.PAS
    425 MainFile0.Dependency93=.\SEARCHUNIT.PAS
    426 MainFile0.Dependency94=.\SEARCHDIRECTORIESFORMUNIT.PAS
    427 MainFile0.Dependency95=.\GLOBALSEARCHFORM.PAS
    428 MainFile0.Dependency96=.\BOOKMARKSFORMUNIT.PAS
    429 MainFile0.Dependency97=.\PRINTDIALOGUNIT.PAS
    430 MainFile0.Dependency98=.\GLOBALFILELISTUNIT.PAS
    431 MainFile0.Dependency99=.\STARTUPUNIT.PAS
    432 MainFile0.Dependency100=.\MAINFORM.PAS
    433 MainFile0.Dependency101=.\NewView.scu
     364MainFile0.Dependency39=..\.\library\ACLFINDFUNCTIONS.PAS
     365MainFile0.Dependency40=..\.\library\ACLFILEUTILITY.PAS
     366MainFile0.Dependency41=..\.\components\ACLLANGUAGEUNIT.PAS
     367MainFile0.Dependency42=..\.\components\GENERICTHREAD.PAS
     368MainFile0.Dependency43=.\STRINGUTILSUNIT.PAS
     369MainFile0.Dependency44=.\DEBUGUNIT.PAS
     370MainFile0.Dependency45=.\CMDLINEPARAMETERUNIT.PAS
     371MainFile0.Dependency46=..\.\components\SPLITBAR.PAS
     372MainFile0.Dependency47=..\.\components\CONTROLSCROLLING.PAS
     373MainFile0.Dependency48=..\.\components\OUTLINE2.PAS
     374MainFile0.Dependency49=..\.\components\CANVASFONTMANAGER.PAS
     375MainFile0.Dependency50=..\.\components\RICHTEXTDOCUMENTUNIT.PAS
     376MainFile0.Dependency51=..\.\components\RICHTEXTSTYLEUNIT.PAS
     377MainFile0.Dependency52=..\.\sibyl\spcc\CLIPBRD.PAS
     378MainFile0.Dependency53=..\.\components\RICHTEXTLAYOUTUNIT.PAS
     379MainFile0.Dependency54=..\.\components\CONTROLSUTILITY.PAS
     380MainFile0.Dependency55=..\.\components\RICHTEXTDISPLAYUNIT.PAS
     381MainFile0.Dependency56=..\.\components\RICHTEXTVIEW.PAS
     382MainFile0.Dependency57=..\.\components\CUSTOMLISTBOX.PAS
     383MainFile0.Dependency58=.\IPFFILEFORMATUNIT.PAS
     384MainFile0.Dependency59=.\HELPWINDOWDIMENSIONS.PAS
     385MainFile0.Dependency60=..\.\library\ASTRINGUTILITYUNIT.PAS
     386MainFile0.Dependency61=.\SETTINGSUNIT.PAS
     387MainFile0.Dependency62=.\HELPTOPIC.PAS
     388MainFile0.Dependency63=..\.\components\CUSTOMMEMO.PAS
     389MainFile0.Dependency64=..\.\components\SYSTEMICONUNIT.PAS
     390MainFile0.Dependency65=..\.\components\ACLMESSAGEFORM.PAS
     391MainFile0.Dependency66=..\.\components\ACLDIALOGS.PAS
     392MainFile0.Dependency67=.\HELPBITMAP.PAS
     393MainFile0.Dependency68=.\SEARCHTABLE.PAS
     394MainFile0.Dependency69=.\HELPFILE.PAS
     395MainFile0.Dependency70=.\HELPWINDOWUNIT.PAS
     396MainFile0.Dependency71=.\NAVIGATEPOINTUNIT.PAS
     397MainFile0.Dependency72=.\MISCUNIT.PAS
     398MainFile0.Dependency73=.\HELPMANAGERUNIT.PAS
     399MainFile0.Dependency74=.\TEXTSEARCHQUERY.PAS
     400MainFile0.Dependency75=..\.\components\TABSET2UNIT.PAS
     401MainFile0.Dependency76=..\.\library\RUNPROGRAMUNIT.PAS
     402MainFile0.Dependency77=..\.\components\RICHTEXTPRINTUNIT.PAS
     403MainFile0.Dependency78=.\INFORMATIONFORMUNIT.PAS
     404MainFile0.Dependency79=..\.\components\COLORMAPPING.PAS
     405MainFile0.Dependency80=..\.\components\COLORWHEEL.PAS
     406MainFile0.Dependency81=..\.\components\CUSTOMFONTDIALOG.PAS
     407MainFile0.Dependency82=..\.\sibyl\rtl\BSEDEV.PAS
     408MainFile0.Dependency83=..\.\components\DRIVEINFOUNIT.PAS
     409MainFile0.Dependency84=..\.\components\BITMAPUTILITY.PAS
     410MainFile0.Dependency85=..\.\components\CUSTOMFILECONTROLS.PAS
     411MainFile0.Dependency86=.\FILEDIALOGFORM.PAS
     412MainFile0.Dependency87=.\OPTIONSFORM.PAS
     413MainFile0.Dependency88=.\VERSIONUNIT.PAS
     414MainFile0.Dependency89=..\.\components\WEBBROWSERUNIT.PAS
     415MainFile0.Dependency90=.\PRODUCTINFORMATIONFORMUNIT.PAS
     416MainFile0.Dependency91=.\NOTEFORM.PAS
     417MainFile0.Dependency92=.\SEARCHUNIT.PAS
     418MainFile0.Dependency93=.\SEARCHDIRECTORIESFORMUNIT.PAS
     419MainFile0.Dependency94=.\GLOBALSEARCHFORM.PAS
     420MainFile0.Dependency95=.\BOOKMARKSFORMUNIT.PAS
     421MainFile0.Dependency96=.\PRINTDIALOGUNIT.PAS
     422MainFile0.Dependency97=.\GLOBALFILELISTUNIT.PAS
     423MainFile0.Dependency98=.\STARTUPUNIT.PAS
     424MainFile0.Dependency99=.\MAINFORM.PAS
     425MainFile0.Dependency100=.\NewView.scu
    434426
    435427[Replace History]
  • trunk/NewView/StartupUnit.pas

    r58 r61  
    1313  OS2Def,
    1414  Classes,
    15   ACLString,
    1615  GlobalFilelistUnit,
    1716  SharedMemoryUnit,
     
    2423function AccessSharedMemory: TSuballocatedSharedMemory;
    2524
    26 // Returns true if the program should be started as normal.
    27 // False if it should immediately exit.
    28 function Startup: boolean;
    29 
    3025// Look for any items that are actually specifiying environment
    3126// variables, and expand them to the contents of the variables
     
    3732// the help and bookshelf paths.
    3833Function FindHelpFile( FileName: string ): string;
     34Procedure PostNewViewTextMessage( Window: HWND;
     35                                  MessageType: ULONG;
     36                                  s: string );
    3937
    4038var
    41   CmdLineParameters: TCmdLineParameters;
    4239  SharedMemory: TSubAllocatedSharedMemory;
    4340  GlobalFilelist: TGlobalFilelist;
     
    5047  DebugUnit,
    5148  PMWin,
    52   ACLUtility,
    5349  ACLStringUtility,
    5450  ACLFileUtility,
    55   AStringUtilityUnit,
    5651  HelpManagerUnit;
    5752
     
    167162
    168163
    169 // If another instance already has the files open
    170 // activate it and return true.
    171 function FindExistingWindow: HWND;
    172 var
    173   FileItems: TStringList;
    174   Filenames: TStringList;
    175   FullFilePath: string;
    176   i: longint;
    177 
    178   FileWindow: HWND;
    179 begin
    180   Result := NULLHANDLE;
    181 
    182   if length(CmdLineParameters.getInterpretedFileNames) = 0 then
    183     // not loading files; nothing to check
    184     exit;
    185 
    186   FileItems := TStringList.Create;
    187   Filenames := TStringList.Create;
    188 
    189   StringToList(CmdLineParameters.getInterpretedFileNames, FileItems, '+' );
    190   TranslateIPFEnvironmentVars( FileItems, FileNames );
    191 
    192   for i := 0 to FileNames.Count - 1 do
    193   begin
    194     FullFilePath := FindHelpFile( Filenames[ i ] );
    195     if FullFilePath <> '' then
    196     begin
    197       FileWindow := GlobalFilelist.FindFile( FullFilePath );
    198 
    199       if FileWindow = NULLHANDLE then
    200       begin
    201         // not found - stop searching.
    202         Result := NULLHANDLE; // no match
    203         break;
    204       end;
    205 
    206       // found it
    207 
    208       // is it the same as any previous match?
    209       if Result <> NULLHANDLE then
    210       begin
    211         if FileWindow <> Result then
    212         begin
    213           // no, so we don't have a match.
    214           // NOTE: We just excluded something: if the same file is
    215           // open in multiple windows then we may not check all combinations
    216           Result := NULLHANDLE; // no match
    217           break;
    218         end;
    219       end
    220       else
    221       begin
    222         // no match yet - store this one
    223         Result := FileWindow;
    224       end;
    225 
    226     end;
    227   end;
    228 
    229   Filenames.Destroy;
    230   FileItems.Destroy;
    231 
    232 end;
    233 
    234164function AccessSharedMemory: TSuballocatedSharedMemory;
    235165begin
     
    253183end;
    254184
    255 function Startup: boolean;
    256 var
    257   tmpCmdLine: String;
    258   ExistingWindow: HWND;
    259 begin
    260   // open shared memory
    261   SharedMemory := AccessSharedMemory;
    262 
    263   // get access to the system-global filelist
    264   GlobalFilelist := TGlobalFilelist.Create;
    265 
    266   // parse parameters into Parameters object
    267   tmpCmdLine := nativeOS2GetCmdLineParameter;
    268 
    269   CmdLineParameters := TCmdLineParameters.Create;
    270   CmdLineParameters.parseCmdLine(tmpCmdLine);
    271 
    272   ExistingWindow := FindExistingWindow;
    273 
    274   if ExistingWindow <> NULLHANDLE then
    275   begin
    276     // want to exit without running fully
    277     Result := false;
    278 
    279     // destroy global list - nobody else will
    280     GlobalFilelist.Destroy;
    281 
    282     WinSetFocus( HWND_DESKTOP, ExistingWindow );
    283 
    284     // topic search
    285     if not CmdLineParameters.getSearchFlag
    286        AND not CmdLineParameters.getGlobalSearchFlag
    287        AND (CmdLineParameters.getInterpretedSearchText <> '')
    288     then
    289     begin
    290       PostNewViewTextMessage( ExistingWindow,
    291                               NHM_SEARCH,
    292                               CmdLineParameters.getInterpretedSearchText);
    293     end;
    294 
    295     if CmdLineParameters.getGlobalSearchFlag then
    296     begin
    297       PostNewViewTextMessage( ExistingWindow,
    298                               NHM_GLOBAL_SEARCH,
    299                               CmdLineParameters.getInterpretedSearchText);
    300     end;
    301 
    302     if CmdLineParameters.getShowUsageFlag then
    303     begin
    304       WinPostMsg( ExistingWindow,
    305                NHM_SHOW_USAGE,
    306                0,
    307                0 );
    308     end;
    309 
    310     if CmdLineParameters.getHelpManagerFlag then
    311     begin
    312       // tell the new help manager instance to talk to the
    313       // other viewer
    314       WinPostMsg( CmdLineParameters.getHelpManagerWindow,
    315                NHM_VIEWER_READY,
    316                ExistingWindow,
    317                0 );
    318     end;
    319 
    320   end
    321   else
    322   begin
    323     // run as normal
    324     Result := true;
    325   end;
    326 end;
    327185
    328186Initialization
  • trunk/NewView/ViewStub.pas

    r57 r61  
    1212  PmWin,
    1313  SysUtils,
     14  Classes,
    1415  DebugUnit,
     16  GlobalFilelistUnit,
    1517  CmdLineParameterUnit,
     18  HelpManagerUnit,
     19  StringUtilsUnit,
    1620  StartupUnit;
    1721
     
    4549
    4650var
    47     tmpCmdLine : String;
    48     tmpPCharCmdLine : PChar;
     51  tmpCmdLine : String;
     52  tmpPCharCmdLine : PChar;
     53  tmpCmdLineParameters: TCmdLineParameters;
     54  tmpExistingWindow: HWND;
     55
     56
     57  // If another instance already has the files open
     58  // activate it and return true.
     59  Function FindExistingWindow(aCmdLineParameters : TCmdLineParameters) : HWND;
     60  var
     61    tmpFileItems: TStringList;
     62    tmpFilenames: TStringList;
     63    tmpFullFilePath: string;
     64    i: longint;
     65
     66    FileWindow: HWND;
     67  begin
     68    result := NULLHANDLE;
     69
     70    if aCmdLineParameters.getInterpretedFileNames = '' then
     71      // not loading files; nothing to check
     72      exit;
     73
     74    tmpFileItems := TStringList.Create;
     75    tmpFilenames := TStringList.Create;
     76
     77    StrExtractStrings(tmpFileItems, aCmdLineParameters.getInterpretedFileNames, ['+'], #0);
     78    TranslateIPFEnvironmentVars(tmpFileItems, tmpFileNames );
     79
     80    for i := 0 to tmpFileNames.Count - 1 do
     81    begin
     82      tmpFullFilePath := FindHelpFile( tmpFilenames[ i ] );
     83      if tmpFullFilePath <> '' then
     84      begin
     85        FileWindow := GlobalFilelist.FindFile(tmpFullFilePath);
     86
     87        if FileWindow = NULLHANDLE then
     88        begin
     89          // not found - stop searching.
     90          Result := NULLHANDLE; // no match
     91          break;
     92        end;
     93
     94        // found it
     95
     96        // is it the same as any previous match?
     97        if Result <> NULLHANDLE then
     98        begin
     99          if FileWindow <> Result then
     100          begin
     101            // no, so we don't have a match.
     102            // NOTE: We just excluded something: if the same file is
     103            // open in multiple windows then we may not check all combinations
     104            Result := NULLHANDLE; // no match
     105            break;
     106          end;
     107        end
     108        else
     109        begin
     110          // no match yet - store this one
     111          result := FileWindow;
     112        end;
     113      end;
     114    end;
     115
     116    tmpFilenames.Destroy;
     117    tmpFileItems.Destroy;
     118  end;
     119
     120
    49121
    50122Begin
    51123  LogEvent(LogViewStub, 'Starting' );
    52124
    53   if Startup then
     125  // open shared memory
     126  SharedMemory := AccessSharedMemory;
     127
     128  // get access to the system-global filelist
     129  GlobalFilelist := TGlobalFilelist.Create;
     130
     131  // parse parameters into Parameters object
     132  tmpCmdLine := nativeOS2GetCmdLineParameter;
     133
     134  tmpCmdLineParameters := TCmdLineParameters.Create;
     135  tmpCmdLineParameters.parseCmdLine(tmpCmdLine);
     136
     137  tmpExistingWindow := FindExistingWindow(tmpCmdLineParameters);
     138
     139  if tmpExistingWindow = NULLHANDLE then
    54140  begin
    55141    // Want a new instance.
    56 
    57     tmpCmdLine := nativeOS2GetCmdLineParameter;
     142    LogEvent(LogViewStub, 'Starting a new NewView instance');
     143
    58144    tmpPCharCmdLine := StrAlloc(length(tmpCmdLine) + 1);
    59145    StrPCopy(tmpPCharCmdLine, tmpCmdLine);
    60146
     147    LogEvent(LogViewStub, 'CmdLine for NewView exe: ' + tmpCmdLine);
    61148    // set up details for launching newview
    62149    With Details do
     
    83170
    84171    StrDispose(tmpPCharCmdLine);
     172  end
     173  else
     174  begin
     175    // the file is already opend in a running instance
     176    LogEvent(LogViewStub, 'Adequate running NewView instance found');
     177
     178    WinSetFocus( HWND_DESKTOP, tmpExistingWindow );
     179
     180    // search and topic search
     181    // topic search is also handled this way
     182    // at the moment there is no support for a
     183    // seperate window message
     184    if not tmpCmdLineParameters.getGlobalSearchFlag
     185       AND (tmpCmdLineParameters.getInterpretedSearchText <> '')
     186    then
     187    begin
     188      PostNewViewTextMessage( tmpExistingWindow,
     189                              NHM_SEARCH,
     190                              tmpCmdLineParameters.getInterpretedSearchText);
     191    end;
     192
     193    if tmpCmdLineParameters.getGlobalSearchFlag then
     194    begin
     195      PostNewViewTextMessage( tmpExistingWindow,
     196                              NHM_GLOBAL_SEARCH,
     197                              tmpCmdLineParameters.getInterpretedSearchText);
     198    end;
     199
     200    if tmpCmdLineParameters.getShowUsageFlag then
     201    begin
     202      WinPostMsg( tmpExistingWindow,
     203               NHM_SHOW_USAGE,
     204               0,
     205               0 );
     206    end;
     207
     208    if tmpCmdLineParameters.getHelpManagerFlag then
     209    begin
     210      // tell the new help manager instance to talk to the
     211      // other viewer
     212      WinPostMsg( tmpCmdLineParameters.getHelpManagerWindow,
     213               NHM_VIEWER_READY,
     214               tmpExistingWindow,
     215               0 );
     216    end;
    85217
    86218  end;
     219
     220  // destroy global list
     221  GlobalFilelist.Destroy;
     222
     223  tmpCmdLineParameters.Destroy;
    87224  LogEvent(LogViewStub, 'Finished' );
    88225End.
Note: See TracChangeset for help on using the changeset viewer.