home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turbo Toolbox
/
Turbo_Toolbox.iso
/
dtx9203
/
naxos
/
source
/
naxos.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-02-08
|
29KB
|
978 lines
{$A+,B-,D-,E-,F-,G-,I-,L-,N-,O-,R-,S-,V+,X+}
{$M 16384,32767,653000}
(*--------------------------------------------------------*)
(* NAXOS.PAS *)
(* (C) 1992 DMV-Verlag & Peper, Zissis, Tossounidis *)
(* Compiler: Turbo Pascal 6.0 *)
(*--------------------------------------------------------*)
(* Für die Neucompilation ohne Änderungen werden die *)
(* deutschen Versionen der Turbo-Vision Standardunits *)
(* benötigt. *)
(*--------------------------------------------------------*)
PROGRAM NaxosIDE;
USES Dos, Objects, Drivers, Memory, Views, Menus, Dialogs,
StdDlgd, MsgBox, Gadgets, App, Rechner,
Buffers, EditD, AsciiTab, Color_D;
CONST
Version = '1.01 BETA1';
Release = '20.03.1992';
HeapSize = 32 * (1024 DIV 16);
Compiler : STRING[80] = 'NX.EXE';
Switches : STRING[32] = ' -M';
COptionen : WORD = 3;
Debugger : STRING[32] = 'DEBUG.EXE';
DebCmd1 : STRING[32] = '';
DebCmd2 : STRING[32] = '';
cmOpen = 200;
cmNew = 201;
cmChangeDir = 202;
cmDosShell = 203;
cmCalculator = 204;
cmShowClip = 205;
cmRun = 206;
cmCompile = 207;
cmAscii = 208;
cmDebug = 209;
cmInfo = 210;
cmLogo = 211;
cmFarbe = 212;
cmDebOpt = 213;
cmComOpt = 214;
cmsOpt = 215;
cmLopt = 216;
TYPE
CnfDat = RECORD
cOptionen : WORD;
Debugger : STRING[32];
DebCmd1 : STRING[32];
DebCmd2 : STRING[32];
Farben : tPalette;
END;
DBGDat = RECORD
Debugger : STRING[32];
DebCmd1 : STRING[32];
DebCmd2 : STRING[32];
END;
VAR
Event : tEvent;
InfFile : FNameStr;
SysPfad : DirStr;
ef : TEXT;
MaxErr,i : BYTE;
ErrMsg : ARRAY[0..154] OF STRING[40];
CNFDaten : CnfDat;
DBGDaten : DBGDat;
CrtReg : WORD ABSOLUTE $0040:$0063;
DTA : POINTER;
Result : RECORD
CASE BOOLEAN OF
TRUE : ( ErrorPos: WORD;
ErrorWort: STRING[16] );
FALSE: ( Main, Here, s0, r0, Zeilen, Bytes: WORD );
END;
TYPE
pCnf = ^Cnf;
Cnf = OBJECT(tObject)
Data : CnfDat;
CONSTRUCTOR Init(VAR x:CnfDat);
CONSTRUCTOR Load(VAR s:tStream);
PROCEDURE Store (VAR s:tStream);
END;
CONSTRUCTOR Cnf.Init(VAR x:CnfDat);
BEGIN
Data := x;
END;
CONSTRUCTOR Cnf.Load(VAR s:tStream);
BEGIN
s.Read(Data,SizeOf(Data));
END;
PROCEDURE Cnf.Store(VAR s:tStream);
BEGIN
s.Write(Data,SizeOf(Data));
END;
CONST
rCnf : tStreamRec = (
OBJType : 1100;
VmtLink: Ofs(TypeOf(Cnf)^);
Load: @Cnf.Load;
Store: @Cnf.Store );
TYPE
PWin = ^tWin;
tWin = OBJECT(tWindow) END;
pbut = ^tBut;
tBut = OBJECT(tButton) END;
pEditorApp = ^tEditorApp;
tEditorApp = OBJECT(tApplication)
Clock : pClockView;
Heap : pHeapView;
CONSTRUCTOR Init;
DESTRUCTOR Done; VIRTUAL;
PROCEDURE HandleEvent(VAR Event: tEvent); VIRTUAL;
PROCEDURE Idle;VIRTUAL;
PROCEDURE InitMenuBar; VIRTUAL;
PROCEDURE InitStatusLine; VIRTUAL;
PROCEDURE OutOfMemory; VIRTUAL;
END;
VAR
EditorApp : tEditorApp;
ClipWindow : pEditWindow;
sFileName : FNameStr;
FUNCTION ExecDialog(p: pDialog; Data: POINTER): WORD;
VAR
Result: WORD;
BEGIN
Result := cmCancel;
p := pDialog(Application^.ValidView(p));
IF p <> NIL THEN
BEGIN
IF Data <> NIL THEN p^.SetData(Data^);
Result := DeskTop^.ExecView(p);
IF (Result <> cmCancel) AND (Data <> NIL) THEN
p^.GetData(Data^);
Dispose(p, Done);
END;
ExecDialog := Result;
END;
FUNCTION CreateFindDialog: pDialog;
VAR
d : pDialog;
Control: pView;
r : tRect;
BEGIN
r.Assign(0, 0, 38, 12);
d := New(pDialog, Init(r, 'Finden'));
WITH d^ DO
BEGIN
Options := Options OR ofCentered;
r.Assign(3, 3, 32, 4);
Control := New(pInputLine, Init(r, 80));
Insert(Control);
r.Assign(2, 2, 18, 3);
Insert(New(pLabel, Init(r, '~T~ext eingeben', Control)));
r.Assign(32, 3, 35, 4);
Insert(New(pHistory, Init(r, pInputLine(Control), 10)));
r.Assign(3, 5, 35, 7);
Insert(New(pCheckBoxes, Init(r,
NewSItem('~G~roß/Kleinschreibung',
NewSItem('~N~ur ganze Worte', NIL)))));
r.Assign(14, 9, 24, 11);
Insert(New(pButton, Init(r, 'O~K~', cmOk, bfDefault)));
Inc(r.A.x, 12); Inc(r.B.x, 13);
Insert(New(pButton, Init(r, 'Abbruch', cmCancel, bfNormal)));
SelectNext(FALSE);
END;
CreateFindDialog := d;
END;
FUNCTION CreateReplaceDialog: pDialog;
VAR
d : pDialog;
Control: pView;
r : tRect;
BEGIN
r.Assign(0, 0, 40, 16);
d := New(pDialog, Init(r, 'Ersetzen'));
WITH d^ DO
BEGIN
Options := Options OR ofCentered;
r.Assign(3, 3, 34, 4);
Control := New(pInputLine, Init(r, 80));
Insert(Control);
r.Assign(2, 2, 18, 3);
Insert(New(pLabel, Init(r, '~T~ext eingeben', Control)));
r.Assign(34, 3, 37, 4);
Insert(New(pHistory, Init(r, pInputLine(Control), 10)));
r.Assign(3, 6, 34, 7);
Control := New(pInputLine, Init(r, 80));
Insert(Control);
r.Assign(2, 5, 18, 6);
Insert(New(pLabel, Init(r, '~E~rsetzen durch', Control)));
r.Assign(34, 6, 37, 7);
Insert(New(pHistory, Init(r, pInputLine(Control), 11)));
r.Assign(3, 8, 37, 12);
Insert(New(pCheckBoxes, Init(r,
NewSItem('~G~roß/Kleinschreibung',
NewSItem('~N~ur ganze Worte',
NewSItem('~M~it Abfrage',
NewSItem('~A~lle ersetzen', NIL)))))));
r.Assign(17, 13, 27, 15);
Insert(New(pButton, Init(r, 'O~K~', cmOk, bfDefault)));
r.Assign(28, 13, 39, 15);
Insert(New(pButton, Init(r, 'Abbruch', cmCancel,
bfNormal)));
SelectNext(FALSE);
END;
CreateReplaceDialog := d;
END;
FUNCTION DoEditDialog(Dialog: INTEGER;
Info : POINTER): WORD; FAR;
VAR
r: tRect;
t: tPoint;
BEGIN
CASE Dialog OF
edOutOfMemory:
DoEditDialog :=
MessageBox('Nicht genug Speicher für diese Operation',
NIL, mfError + mfOkButton);
edReadError:
DoEditDialog := MessageBox('Fehler beim Lesen der Datei %s.',
@Info, mfError + mfOkButton);
edWriteError:
DoEditDialog := MessageBox('Fehler beim Schreiben der Datei %s.',
@Info, mfError + mfOkButton);
edCreateError:
DoEditDialog := MessageBox('Fehler beim Anlegen der Datei %s.',
@Info, mfError + mfOkButton);
edSaveModify:
DoEditDialog := MessageBox('%s wurde verändert. Speichern ?',
@Info, mfInformation + mfYesNoCancel);
edSaveUntitled:
DoEditDialog := MessageBox('Unbenannte Datei speichern ?',
NIL, mfInformation + mfYesNoCancel);
edSaveAs:
DoEditDialog := ExecDialog(New(pFileDialog, Init('*.*',
'Speichern als', '~N~ame', fdOkButton, 101)), Info);
edFind:
DoEditDialog := ExecDialog(CreateFindDialog, Info);
edSearchFailed:
DoEditDialog := MessageBox('Suchtext nicht gefunden.',
NIL, mfError + mfOkButton);
edReplace:
DoEditDialog := ExecDialog(CreateReplaceDialog, Info);
edReplacePrompt:
BEGIN
{ Avoid placing the dialog on the same line as the cursor }
r.Assign(0, 1, 40, 8);
r.Move((DeskTop^.Size.x - r.B.x) DIV 2, 0);
DeskTop^.MakeGlobal(r.B, t);
Inc(t.y);
IF tPoint(Info).y <= t.y THEN
r.Move(0, DeskTop^.Size.y - r.B.y - 2);
DoEditDialog := MessageBoxRect(r, 'Ersetzen ?',
NIL, mfYesNoCancel + mfInformation);
END;
END;
END;
FUNCTION OpenEditor(FileName: FNameStr;
Visible: BOOLEAN): pEditWindow;
VAR
p: pView;
r: tRect;
BEGIN
DeskTop^.GetExtent(r);
p := Application^.ValidView(New(pEditWindow,
Init(r, FileName, wnNoNumber)));
IF NOT Visible THEN p^.Hide;
DeskTop^.Insert(p);
OpenEditor := pEditWindow(p);
END;
CONSTRUCTOR tEditorApp.Init;
VAR
fn:STRING;
h: WORD;
r: tRect;
Event : tEvent;
BEGIN
h := PtrRec(HeapEnd).Seg - PtrRec(HeapPtr).Seg;
IF h > HeapSize THEN
BufHeapSize := h - HeapSize ELSE BufHeapSize := 0;
InitBuffers;
tApplication.Init;
RegisterType(rCnf);
Event.what := evCommand;
Event.command := cmLopt;
HandleEvent(Event);
DisableCommands([cmSave, cmSaveAs, cmCut,
cmCopy, cmPaste, cmClear,
cmUndo, cmFind, cmReplace,
cmSearchAgain, cmCompile,
cmRun, cmDebug, cmInfo]);
EditorDialog := DoEditDialog;
ClipWindow := OpenEditor('', FALSE);
IF ClipWindow <> NIL THEN
BEGIN
Clipboard := ClipWindow^.Editor;
Clipboard^.CanUndo := FALSE;
END;
Event.what := evCommand;
GetExtent(r);
r.A.x := r.B.x - 9;
r.B.y := r.A.y + 1;
Clock := New(pClockView, Init(r));
Insert(Clock);
IF ParamCount > 0 THEN BEGIN
fn := ParamStr(1);
IF Pos('.', fn) = 0 THEN fn := fn+'.FTH';
OpenEditor(fn,TRUE)
END ELSE
Event.command := MessageBox(#3'NAXOS-COMPILER V ' + Version
+ #13#3'(C) 1992 DMV-Verlag & Peper, Zissis, Tossounidis'
+ #13#3 + Release, NIL, 2 + mfOkButton);
END;
DESTRUCTOR tEditorApp.Done;
BEGIN
tApplication.Done;
DoneBuffers;
END;
PROCEDURE tEditorApp.HandleEvent(VAR Event: tEvent);
VAR InFile : TEXT;
PROCEDURE FileOpen;
VAR
FileName: FNameStr;
BEGIN
sFileName := '*.FTH';
IF ExecDialog(New(pFileDialog, Init('*.FTH', 'Datei öffnen',
'~N~ame', fdOpenButton, 100)), @sFileName) <> cmCancel THEN
OpenEditor(sFileName, TRUE);
DisableCommands([cmDebug, cmRun, cmInfo]);
EnableCommands([cmCompile]);
END;
PROCEDURE FileNew;
BEGIN
OpenEditor('', TRUE);
DisableCommands([cmDebug, cmRun, cmInfo]);
EnableCommands([cmCompile]);
END;
PROCEDURE ChangeDir;
BEGIN
ExecDialog(New(pChDirDialog, Init(cdNormal, 0)), NIL);
END;
PROCEDURE DosShell;
BEGIN
DoneSysError;
DoneEvents;
DoneVideo;
DoneMemory;
SetMemTop(Ptr(BufHeapPtr, 0));
PrintStr('Geben Sie EXIT ein um in die Oberfläche zurückzukehren...');
SwapVectors;
Exec(GetEnv('COMSPEC'), '');
SwapVectors;
SetMemTop(Ptr(BufHeapEnd, 0));
InitMemory;
InitVideo;
InitEvents;
InitSysError;
Redraw;
END;
FUNCTION Hex(n, l: INTEGER): STRING;
{ n in l-stellige Hexzahl wandeln }
VAR
i, z: INTEGER;
s : STRING;
BEGIN
s := '';
FOR i := 1 TO l DO BEGIN
z := n AND 15; { Ziffer bilden }
IF z > 9 THEN z := z + 7;
s := Chr(z + 48) + s;
n := n SHR 4; { Division durch 16 }
END;
Hex := s;
END;
FUNCTION Dez(n: WORD): STRING;
VAR
s: STRING;
BEGIN
Str(n:5,s);
Dez := s;
END;
PROCEDURE GetInfo;
VAR
Msg: STRING;
f: TEXT;
Main, Here,
s0, r0,
Zeilen, Bytes: WORD;
p: PathStr;
d: DirStr;
n: NameStr;
e: ExtStr;
BEGIN
FSplit(IDEFileName,d,n,e);
Msg := 'Quelldatei : ' + n + e + #13 +
#3 + 'Zeilen: ' + Dez(Result.Zeilen) +
' Bytes: ' + Dez(Result.Bytes) + #13 +
#3 + 'MAIN : ' + Hex(Result.Main, 4) +
' HERE : ' + Hex(Result.Here, 4) + #13 +
#3 + 'S0 : ' + Hex(Result.s0, 4) +
' R0 : ' + Hex(Result.r0, 4);
Event.what := evCommand;
Event.command := MessageBox(#3 + Msg,
NIL, mfInformation + mfOkButton);
HandleEvent(Event);
END;
PROCEDURE Comp;
VAR
Msg, s1 : STRING;
ErrWort : STRING[20];
ds : WORD;
Win : pWin;
but : pbut;
r : tRect;
x, y : WORD;
BEGIN
r.Assign(20, 7, 60, 16);
Win := New(PWin, Init(r, 'Compiliere', 0));
Win^.Palette := wpGrayWindow;
Win^.Flags := 4;
DeskTop^.Insert(Win);
SetMemTop(Ptr(BufHeapPtr, 0));
SwapVectors;
Exec(SysPfad + Compiler, IDEFileName + ' ' + Switches);
SwapVectors;
Move(DTA^, Result, 19);
Event.what := evCommand;
Event.command := cmPrev;
HandleEvent(Event);
Win^.Done;
ds := DosExitCode;
IF ds<>0 THEN BEGIN
ds := ds - 100;
Str(ds:3, Msg);
IF (ds <> 0) AND (ds <= MaxErr) THEN
Msg := ErrMsg[ds]
ELSE
Msg := Msg + ' = Unbekannter Fehler';
IF ds = 155 THEN Msg := 'Abbruch';
IF ds < 100 THEN BEGIN
Msg := Dez(ds) + ' bei' + Dez(Result.ErrorPos) +
#13#3 + Msg + #13#3 + Result.ErrorWort;
END;
Event.what := evCommand;
Event.command := MessageBox(#3 + Msg + #13#3 +
'Weiter mit ESC', NIL, mfError);
HandleEvent(Event);
IF ds < 100 THEN BEGIN
Event.what := evCommand;
Event.command := cmTextGoto;
Event.Infoword := Result.ErrorPos;
HandleEvent(Event);
END;
END ELSE BEGIN
EnableCommands([cmDebug, cmRun, cmInfo]);
GetInfo;
END;
SetMemTop(Ptr(BufHeapEnd, 0));
Redraw;
END;
PROCEDURE FileRun;
VAR
LfName : FNameStr;
BEGIN
DoneSysError;
DoneEvents;
DoneVideo;
DoneMemory;
SetMemTop(Ptr(BufHeapPtr, 0));
SwapVectors;
LfName := Copy(IDEFileName, 1, Pos('.', IDEFileName)) + 'COM';
Exec(LfName, '');
SwapVectors;
SetMemTop(Ptr(BufHeapEnd, 0));
InitMemory;
InitVideo;
InitEvents;
InitSysError;
Redraw;
END;
PROCEDURE Debug;
VAR
LfName: STRING;
BEGIN
DoneSysError;
DoneEvents;
DoneVideo;
DoneMemory;
SetMemTop(Ptr(BufHeapPtr, 0));
SwapVectors;
LfName := Copy(IDEFileName,1,Pos('.', IDEFileName)) + 'COM';
Exec(Debugger, ' ' + DebCmd1 + ' ' + LfName + ' ' + DebCmd2);
SwapVectors;
SetMemTop(Ptr(BufHeapEnd, 0));
InitMemory;
InitVideo;
InitEvents;
InitSysError;
Redraw;
END;
PROCEDURE ShowClip;
BEGIN
ClipWindow^.Select;
ClipWindow^.Show;
END;
PROCEDURE Tile;
VAR
r: tRect;
BEGIN
DeskTop^.GetExtent(r);
DeskTop^.Tile(r);
END;
PROCEDURE Cascade;
VAR
r: tRect;
BEGIN
DeskTop^.GetExtent(r);
DeskTop^.Cascade(r);
END;
PROCEDURE Calculator;
BEGIN
DeskTop^.Insert(ValidView(New(pCalculator, Init)));
END;
PROCEDURE AsciiTab;
VAR
p: pAsciiChart;
BEGIN
p := New(pAsciiChart, Init);
DeskTop^.Insert(ValidView(p));
END;
PROCEDURE GetLogo;
BEGIN
MessageBox(#3'NAXOS-COMPILER V ' + Version +
#13#3'(C) 1992 DMV-Verlag & Peper, Zissis, Tossounidis' +
#13#3 + Release, NIL, 2 + mfOkButton);
END;
PROCEDURE Farben;
VAR
d: pColorDialog;
BEGIN
d := New(pColorDialog, Init('',
ColorGroup('Menue',
ColorItem('Normal', 2,
ColorItem('Inaktiv', 3,
ColorItem('Shortcut', 4,
ColorItem('Selektiert', 5,
ColorItem('Selektiert inaktiv', 6,
ColorItem('Shortcut selektiert', 7, NIL)))))),
ColorGroup('Dialog/Rechner',
ColorItem('Rahmen/Hintergrund', 33,
ColorItem('Rahmen-Icon', 34,
ColorItem('Rollbalken', 35,
ColorItem('Rollbalkenpfeile', 36,
ColorItem('Statischer Text', 37,
ColorItem('Label normal', 38,
ColorItem('Label selektiert', 39,
ColorItem('Label shortcut', 40,
ColorItem('Button normal', 41,
ColorItem('Button default', 42,
ColorItem('Button selektiert', 43,
ColorItem('Button inaktiv', 44,
ColorItem('Button shortcut', 45,
ColorItem('Button Schatten', 46,
ColorItem('Cluster normal', 47,
ColorItem('Cluster selektiert', 48,
ColorItem('Cluster shortcut', 49,
ColorItem('Eingabe normal', 50,
ColorItem('Eingabe selektiert', 51,
ColorItem('Eingabepfeil', 52,
ColorItem('History button', 53,
ColorItem('History sides', 54,
ColorItem('History bar page', 55,
ColorItem('History bar icons', 56,
ColorItem('Liste normal', 57,
ColorItem('Liste fokusiert', 58,
ColorItem('List selektiert', 59,
ColorItem('Listentrennung', 60,
ColorItem('Information', 61,
NIL))))))))))))))))))))))))))))),
ColorGroup('Editor-Fenster',
ColorItem('Rahmen passiv', 8,
ColorItem('Rahmen aktiv', 9,
ColorItem('Rahmen-Icon', 10,
ColorItem('Rollbalken', 11,
ColorItem('Rollbalkenpfeile', 12,
ColorItem('Text', 13, NIL)))))),
ColorGroup('Ascii-Tabelle',
ColorItem('Rahmen passiv', 24,
ColorItem('Rahmen aktiv', 25,
ColorItem('Rahmen-Icon', 26,
ColorItem('Rollbalken', 27,
ColorItem('Rollbalkenpfeile', 28,
ColorItem('Text', 29, NIL)))))),
NIL))))));
IF ValidView(d) <> NIL THEN
BEGIN
d^.SetData(Application^.GetPalette^);
IF DeskTop^.ExecView(d) <> cmCancel THEN BEGIN
Application^.GetPalette^ := d^.Pal;
DoneMemory; { Dispose all group buffers }
Redraw; { Redraw application with new palette }
END;
Dispose(d, Done);
END;
END;
PROCEDURE DebOpt;
TYPE
DebDialog = ^tDialog;
pbut = ^tButton;
zle = ^tInputLine;
VAR
Dialog : DebDialog;
r : tRect;
Control : WORD;
Dummy : WORD;
Zeile1,
Zeile2,
Zeile3 : zle;
BEGIN
DBGDaten.Debugger := Debugger;
DBGDaten.DebCmd1 := DebCmd1;
DBGDaten.DebCmd2 := DebCmd2;
r.Assign(10, 4, 70, 19);
Dialog := New(DebDialog, Init(r, 'Debug-Optionen'));
WITH Dialog^ DO
BEGIN
r.Assign(23, 3, 57, 4);
Zeile1 := (New(pInputLine, Init(r, 32)));
Insert(Zeile1);
r.Assign(5, 3, 20, 4);
Insert(New(pLabel, Init(r, 'DEBUGGER :', Zeile1)));
r.Assign(23, 5, 57, 6);
Zeile2 := (New(pInputLine,Init(r, 32)));
Insert(Zeile2);
r.Assign(5, 5, 20, 6);
Insert(New(pLabel, Init(r, 'PARAMETER 1 :', Zeile2)));
r.Assign(23,7,57,8);
Zeile3 := (New(pInputLine, Init(r, 32)));
Insert(Zeile3);
r.Assign(5, 7, 20, 8);
Insert(New(pLabel, Init(r, 'PARAMETER 2 :', Zeile3)));
r.Assign(5, 12, 19, 14);
Insert(New(pbut, Init(r, 'Cancel', cmCancel, bfNormal)));
r.Assign(40, 12, 54, 14);
Insert(New(pbut, Init(r, '~O~K', cmOk, bfDefault)));
END;
Dialog^.SetData(DBGDaten);
Control := DeskTop^.ExecView(Dialog);
IF Control <> cmCancel THEN BEGIN
Dialog^.GetData(DBGDaten);
END;
Debugger := DBGDaten.Debugger;
DebCmd1 := DBGDaten.DebCmd1;
DebCmd2 := DBGDaten.DebCmd2;
Dispose(Dialog, Done);
END;
PROCEDURE ComOpt;
TYPE
ComDIALOG = ^tDialog;
pSchalter = ^tCheckBoxes;
pbut = ^tButton;
VAR
Dialog : ComDIALOG;
r : tRect;
Schalter : pSchalter;
Control : WORD;
BEGIN
r.Assign(30, 5, 65, 20);
Dialog := New(ComDIALOG, Init(r, 'Compiler-Optionen'));
WITH Dialog^ DO
BEGIN
r.Assign(20, 11, 30, 13);
Insert(New(pbut, Init(r, '~O~K', cmOk, bfDefault)));
r.Assign(4, 11, 14, 13);
Insert(New(pbut,Init(r, 'Cancel', cmCancel, bfNormal)));
r.Assign(5,4,28,9);
Schalter := New(pSchalter,Init(r,
NewSItem('~C~ode erzeugen',
NewSItem('~M~AP-File erzeugen',
NewSItem('~O~ptimierung ein ',
NewSItem('~I~ntermediärsource',
NIL))))
));
Insert(Schalter);
END;
Dialog^.SetData(COptionen);
Control := DeskTop^.ExecView(Dialog);
IF Control <> cmCancel THEN Dialog^.GetData(cOptionen);
IF (cOptionen AND $3) = 0 THEN Switches := ' -N';
IF (cOptionen AND $3) = 1 THEN Switches := '';
IF (cOptionen AND $3) = 2 THEN Switches := ' -N -M';
IF (cOptionen AND $3) = 3 THEN Switches := ' -M';
IF (cOptionen AND $4) = 0 THEN Compiler := 'NX.EXE'
ELSE Compiler := 'NXO.EXE';
IF (cOptionen AND $C) = $C THEN Switches := Switches + ' -D';
Dispose(Dialog, Done);
END;
PROCEDURE OptSave;
VAR
s: pBufStream;
x: pCnf;
BEGIN
CNFDaten.COptionen := COptionen;
CNFDaten.Debugger := Debugger;
CNFDaten.DebCmd1 := DebCmd1;
CNFDaten.DebCmd2 := DebCmd2;
CNFDaten.Farben := Application^.GetPalette^;
s := New(pBufStream, Init('NAXOS.CNF', stCreate, 1024));
x := New(pCnf, Init(CNFDaten));
s^.put(x);
Dispose(s, Done);
Dispose(x, Done);
END;
PROCEDURE OptLoad;
VAR
s: pBufStream;
x: pCnf;
f: FILE;
BEGIN
Assign(f, 'NAXOS.CNF');
{$I-} Reset(f); {$I+}
IF IOResult = 0 THEN BEGIN
Close(f);
s := New(pBufStream, Init('NAXOS.CNF', stOpenRead, 1024));
x := New(pCnf, Init(CNFDaten));
x := pCnf(s^.get);
CNFDaten := x^.Data;
COptionen := CNFDaten.COptionen;
Debugger := CNFDaten.Debugger;
DebCmd1 := CNFDaten.DebCmd1;
DebCmd2 := CNFDaten.DebCmd2;
Application^.GetPalette^ := CNFDaten.Farben;
Redraw;
Dispose(x,Done);
Dispose(s,Done);
IF (COptionen AND $3) = 0 THEN Switches := ' -N';
IF (COptionen AND $3) = 1 THEN Switches := '';
IF (COptionen AND $3) = 2 THEN Switches := ' -N -M';
IF (COptionen AND $3) = 3 THEN Switches := ' -M';
IF (COptionen AND $4) = 0 THEN Compiler := 'NX.EXE'
ELSE Compiler := 'NXO.EXE';
IF (COptionen AND $C) = $C THEN Switches := Switches + ' -D';
END;
END;
BEGIN
tApplication.HandleEvent(Event);
CASE Event.what OF
evCommand:
CASE Event.command OF
cmOpen : FileOpen;
cmNew : FileNew;
cmChangeDir : ChangeDir;
cmDosShell : DosShell;
cmCalculator: Calculator;
cmShowClip : ShowClip;
cmTile : Tile;
cmCascade : Cascade;
cmCompile : BEGIN
Event.what := evCommand;
Event.command := cmSave;
HandleEvent(Event);
Comp;
END;
cmRun : FileRun;
cmAscii : AsciiTab;
cmDebug : Debug;
cmInfo : GetInfo;
cmLogo : GetLogo;
cmFarbe : Farben;
cmDebOpt : DebOpt;
cmComOpt : ComOpt;
cmsOpt : OptSave;
cmLopt : OptLoad;
ELSE
Exit;
END;
ELSE
Exit;
END;
ClearEvent(Event);
END;
PROCEDURE tEditorApp.Idle;
FUNCTION IsTileable(p: pView): BOOLEAN; FAR;
BEGIN
IsTileable := p^.Options AND ofTileable <> 0;
END;
BEGIN
tApplication.Idle;
Clock^.Update;
InfFile := Copy(IDEFileName, 1, Pos('.', IDEFileName) - 1) + '.INF';
IF DeskTop^.FirstThat(@IsTileable) <> NIL THEN
EnableCommands([cmTile, cmCascade])
ELSE
DisableCommands([cmTile, cmCascade]);
IF IDEFileName = '' THEN DisableCommands([cmCompile,
cmRun,
cmDebug,
cmInfo])
ELSE EnableCommands([cmCompile]);
END;
PROCEDURE tEditorApp.InitMenuBar;
VAR
r: tRect;
BEGIN
GetExtent(r);
r.B.y := r.A.y + 1;
MenuBar := New(pMenuBar, Init(r, NewMenu(
NewSubMenu('~'#240'~', hcNoContext, NewMenu(
NewItem('~T~aschenrechner', '', kbNoKey,
cmCalculator, hcNoContext,
NewItem('A~S~CII-Tabelle', '', kbNoKey,
cmAscii, hcNoContext,
NewLine(
NewItem('~A~bout','', kbNoKey,
cmLogo, hcNoContext, NIL))))),
NewSubMenu('~D~atei', hcNoContext, NewMenu(
NewItem('~L~aden...', 'F3', kbF3, cmOpen, hcNoContext,
NewItem('~N~eu', '', kbNoKey, cmNew, hcNoContext,
NewItem('~S~peichern', 'F2', kbF2, cmSave, hcNoContext,
NewItem('S~p~eichern als ...', '', kbNoKey, cmSaveAs, hcNoContext,
NewLine(
NewItem('~V~erzeichnis wechseln...', '',
kbNoKey, cmChangeDir, hcNoContext,
NewItem('~D~OS shell', '', kbNoKey, cmDosShell, hcNoContext,
NewItem('~E~nde', 'Alt-X', kbAltX, cmQuit, hcNoContext,
NIL))))))))),
NewSubMenu('~E~ditieren', hcNoContext, NewMenu(
NewItem('~Z~urück', '', kbNoKey, cmUndo, hcNoContext,
NewLine(
NewItem('~A~usschneiden', 'Shift-Del', kbShiftDel, cmCut, hcNoContext,
NewItem('~K~opieren', 'Ctrl-Ins', kbCtrlIns, cmCopy, hcNoContext,
NewItem('~E~insetzen', 'Shift-Ins', kbShiftIns, cmPaste, hcNoContext,
NewItem('~N~otizblock zeigen', '', kbNoKey, cmShowClip, hcNoContext,
NewLine(
NewItem('~L~öschen', 'Ctrl-Del', kbCtrlDel, cmClear, hcNoContext,
NIL))))))))),
NewSubMenu('~S~uchen', hcNoContext, NewMenu(
NewItem('~F~inden...', '', kbNoKey, cmFind, hcNoContext,
NewItem('~E~rsetzen...', '', kbNoKey, cmReplace, hcNoContext,
NewItem('~S~uche wiederholen', '', kbNoKey, cmSearchAgain, hcNoContext,
NIL)))),
NewSubMenu('~C~ompilieren',hcNoContext,NewMenu(
NewItem('~R~un','Ctrl-F9', kbCtrlF9, cmRun, hcNoContext,
NewItem('~C~ompilieren','F9', kbF9, cmCompile, hcNoContext,
NewItem('~I~nformation','Alt-F9', kbAltF9, cmInfo, hcNoContext,
NIL)))),
NewItem('De~b~ug','',kbF7, cmDebug, hcNoContext,
NewSubMenu('~F~enster', hcNoContext, NewMenu(
NewItem('~B~ewegen','Ctrl-F5', kbCtrlF5, cmResize, hcNoContext,
NewItem('~Z~oom', 'F5', kbF5, cmZoom, hcNoContext,
NewItem('~N~ebeneinander', '', kbNoKey, cmTile, hcNoContext,
NewItem('~U~ebereinander', '', kbNoKey, cmCascade, hcNoContext,
NewItem('Nächstes ~F~enster', 'F6', kbF6, cmNext, hcNoContext,
NewItem('~V~orheriges Fenster', 'Shift-F6', kbShiftF6, cmPrev, hcNoContext,
NewItem('~S~chließen', 'Alt-F3', kbAltF3, cmClose, hcNoContext,
NIL)))))))),
NewSubMenu('~O~ptionen',hcNoContext,NewMenu(
NewItem('~F~arben wählen...','',kbNoKey,cmFarbe,hcNoContext,
NewItem('~D~ebugger...','',kbNoKey,cmDebOpt,hcNoContext,
NewItem('~C~ompiler...','',kbNoKey,cmComOpt,hcNoContext,
NewLine(
NewItem('Einstellungen ~s~peichern','',kbNoKey,cmsOpt,hcNoContext,
NewItem('Einstellungen ~l~aden','',kbNoKey,cmLopt,hcNoContext,
NIL))))))),
NIL)))))))))))
END;
PROCEDURE tEditorApp.InitStatusLine;
VAR
r: tRect;
BEGIN
GetExtent(r);
r.A.y := r.B.y - 1;
New(StatusLine, Init(r,
NewStatusDef(0, $FFFF,
NewStatusKey('~F2~ Speichern', kbF2, cmSave,
NewStatusKey('~F3~ Laden', kbF3, cmOpen,
NewStatusKey('~Alt-F3~ Schließen', kbAltF3, cmClose,
NewStatusKey('~F5~ Zoom', kbF5, cmZoom,
NewStatusKey('~F6~ Next', kbF6, cmNext,
NewStatusKey('~F10~ Menü', kbF10, cmMenu,
NewStatusKey('', kbCtrlF5, cmResize,
NIL))))))),
NIL)));
END;
PROCEDURE tEditorApp.OutOfMemory;
BEGIN
MessageBox('Nicht genug Speicherplatz für diese Operation.',
NIL, mfError + mfOkButton);
END;
BEGIN
DTA := Ptr($B800,140);
IF CrtReg=$03B4 THEN DTA := Ptr($B000,140);
SysPfad := GetEnv('NAXOS');
IF SysPfad='' THEN BEGIN
WriteLn('NAXOS V', Version,
' : Environment Variable NAXOS nicht gesetzt !', #7);
Halt(0);
END ELSE SysPfad := SysPfad + '\';
Assign(ef, SysPfad + 'ERROR.MSG');
{$I-} Reset(ef); {$I+}
MaxErr := 0;
IF IOResult = 0 THEN BEGIN
ReadLn(ef, MaxErr);
FOR i:= 1 TO MaxErr DO ReadLn(ef, ErrMsg[i]);
Close(ef);
END;
EditorApp.Init;
EditorApp.Run;
EditorApp.Done;
END.
(*--------------------------------------------------------*)
(* Ende von NAXOS.PAS *)