home *** CD-ROM | disk | FTP | other *** search
- {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
- CHANGE LANGUAGE
-
- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
- procedure ChangeLanguage ( NewLanguage : string ) ;
- {===================================================================
- ===================================================================}
- procedure Dump ;
- begin
- if MenuBox <> NIL then
- begin
- DisposeMenu ( MenuBox^.Menu ) ;
- Dispose ( MenuBox , Done ) ;
- MenuBox := NIL ;
- end ;
- if MenuBar <> NIL then
- begin
- Application^.Delete ( MenuBar ) ;
- Dispose ( MenuBar , Done ) ;
- MenuBar := NIL ;
- end ;
- if StatusLine <> NIL then
- begin
- Application^.Delete ( StatusLine ) ;
- Dispose ( StatusLine , Done ) ;
- StatusLine := NIL ;
- end ;
- end ;
- {===================================================================
- ===================================================================}
- procedure Place ;
- begin
- if PLanguage <> NIL then
- DisposeStr ( PLanguage ) ;
- PLanguage := NewStr ( NewLanguage ) ;
- CalcHelp ( PLanguage^ ) ;
- {$IFDEF code}
- {$ELSE}
- MenuBoxName := 'MENUBOX_' + PLanguage^ ;
- MenuBarName := 'MENUBAR_' + PLanguage^ ;
- StatusLineName := 'STATUSLINE_' + PLanguage^ ;
- HintName := 'HINT_' + PLanguage^ ;
- MenuBox := PMenuBox ( RezFile^.Get ( MenuBoxName ) ) ;
- Application^.InitMenuBar ;
- Application^.InitStatusLine ;
- {$ENDIF}
- if MenuBar <> NIL then
- Application^.Insert ( MenuBar ) ;
- if StatusLine <> NIL then
- Application^.Insert ( StatusLine ) ;
- DefaultHint := PLanguage^ ;
- if StatusLine <> NIL then
- StatusLine^.DrawView ;
- Message ( Application ,
- evBroadcast ,
- cmCommandSetChanged ,
- NIL ) ;
- end ;
- {===================================================================
- ===================================================================}
- procedure English ;
- begin
- Dump ;
- {$IFDEF code}
- MenuBox := InitMenuBoxENGLISH ;
- MenuBar := InitMenuBarENGLISH ;
- StatusLine := InitStatusLineENGLISH ;
- {$ENDIF}
- Place ;
- end ;
- {===================================================================
- ===================================================================}
- procedure German ;
- begin
- Dump ;
- {$IFDEF code}
- MenuBox := InitMenuBoxGERMAN ;
- MenuBar := InitMenuBarGERMAN ;
- StatusLine := InitStatusLineGERMAN ;
- {$ENDIF}
- Place ;
- end ;
- {===================================================================
- ===================================================================}
- procedure Spanish ;
- begin
- Dump ;
- {$IFDEF code}
- MenuBox := InitMenuBoxSPANISH ;
- MenuBar := InitMenuBarSPANISH ;
- StatusLine := InitStatusLineSPANISH ;
- {$ENDIF}
- Place ;
- end ;
- {===================================================================
- ===================================================================}
- procedure French ;
- begin
- Dump ;
- {$IFDEF code}
- MenuBox := InitMenuBoxFRENCH ;
- MenuBar := InitMenuBarFRENCH ;
- StatusLine := InitStatusLineFRENCH ;
- {$ENDIF}
- Place ;
- end ;
- {===================================================================
- ===================================================================}
- procedure Dutch ;
- begin
- Dump ;
- {$IFDEF code}
- MenuBox := InitMenuBoxDUTCH ;
- MenuBar := InitMenuBarDUTCH ;
- StatusLine := InitStatusLineDUTCH ;
- {$ENDIF}
- Place ;
- end ;
- {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- PROCESS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
- begin
- if NewLanguage = 'GERMAN' then German else
- if NewLanguage = 'SPANISH' then Spanish else
- if NewLanguage = 'FRENCH' then French else
- if NewLanguage = 'DUTCH' then Dutch else
- begin
- NewLanguage := 'ENGLISH' ;
- English ;
- end ;
- end ;
- {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
- APPLICATION METHODS
-
- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
- {===================================================================
-
- IDLE
-
- ===================================================================}
- procedure TGenericApp.Idle ;
- begin
- if CommandSetChanged then
- begin
- if Desktop^.Current = NIL then
- DisableCommands ( [ cmPrint , cmTile , cmCascade ] )
- else
- EnableCommands ( [ cmPrint , cmTile , cmCascade ] ) ;
- if not HiResScreen or ( Screenmode = smMono ) then
- Application^.DisableCommands ( [ cmVideoMode ] ) ;
- end ;
- TApplication.Idle ;
- end ;
- {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
- INIT
-
- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
- {===================================================================
-
- PRE
-
- ===================================================================}
- procedure TGenericApp.PreInit ;
- begin
- VersionCode := '0.92' ;
- PushScreen ;
- ReserveForData ( 32 * ( 1024 div 16 ) ) ;
- InitBuffers ;
- EDITORS.EditorDialog := EditorDialog ;
- {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Allow access to "ReadOnly" files (else loads blank & overwrites!)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
- if Lo ( DosVersion ) >= 3 then
- FileMode := $20 { OPEN Read_Only + Deny_Write }
- else
- FileMode := $0 ; { ATTR: Read_Only }
- end ;
- {===================================================================
-
- POST
-
- ===================================================================}
- procedure TGenericApp.PostInit ;
- begin
- CalcHelp ( 'ENGLISH' ) ;
- {$IFDEF code}
- MenuBox := InitMenuBoxENGLISH ;
- {$ELSE}
- MenuBox := PMenuBox ( RezFile^.Get ( MenuBoxName ) ) ;
- {$ENDIF}
- if not HiResScreen then
- Application^.DisableCommands ( [ cmVideoMode ] ) ;
- CreateClipboard ;
-
- LoadConfig ;
- if PLanguage <> NIL then
- ChangeLanguage ( PLanguage^ ) ;
-
- LoadDesktopFrom ( Names.DSK ) ;
- if ParamCount > 0 then
- begin
- hdClearDesktop ;
- CommandLineOpen ;
- end ;
- if Desktop^.Current = NIL then
- begin
- OpenEditor ( '' , TRUE ) ;
- ForceEvent ( evCommand , cmAbout ) ;
- end ;
- end ;
- {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
- DONE
-
- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
- {===================================================================
-
- PRE
-
- ===================================================================}
- procedure TGenericApp.PreDone ;
- begin
- SaveDesktopTo ( Names.DSK , 'BABEL.EXE Multi-Language Editor - Desktop File' ) ;
- SaveConfig ;
- if PLanguage <> NIL then
- DisposeStr ( PLanguage ) ;
- DisposeMenu ( MenuBox^.Menu ) ;
- Dispose ( MenuBox , Done ) ;
- MenuBox := NIL ;
- end ;
- {===================================================================
-
- POST
-
- ===================================================================}
- procedure TGenericApp.PostDone ;
- begin
- PopScreen ;
- CopyrightMsg ;
- end ;
-