unit Modeler; //----------------------------------------------------------------- // //1. Bracketing ausgeschaltet //... // //----------------------------------------------------------------- interface //----------------------------------------------------------------- // //----------------------------------------------------------------- uses //----------------------------------------------------------------- //local //-----------------------------------------------------------------
GenDefs,OwnUtils,Frame11,Frame22,Frame33,Graphs,StatusThread,Command,
OptionClass,SearchReplace,AboutBox,Sample,ThreadExecute,Lizenz,
Utilities,Splash,Language,Natural,ColorDialog,MDIClass,Editor,FullScreen, //----------------------------------------------------------------- //global //-----------------------------------------------------------------
Forms,Menus,Dialogs,Extctrls,Controls,ComCtrls,StdCtrls,Classes,
Types,Messages,Graphics,ImgList,ToolWin; //------------------------------------------------------- //Types //------------------------------------------------------- type
TModelFrame= class(TForm)
MainMenu1:TMainMenu;
File1:TMenuItem;
Exit1:TMenuItem;
FontDialog:TFontDialog;
View1:TMenuItem;
Font2:TMenuItem;
Oeffne:TMenuItem;
Hilfe1:TMenuItem;
Hilfe2:TMenuItem;
ber1:TMenuItem;
Frame11:TFrame1;
Frame21:TFrame2;
Frame31:TFrame3;
SplitterVertical:TSplitter;
Farben:TMenuItem;
Speichere:TMenuItem;
Speichernunter:TMenuItem;
Syntaxhervorhebung1:TMenuItem;
Zeilennummern1:TMenuItem;
N2:TMenuItem;
N3:TMenuItem;
N4:TMenuItem;
N5:TMenuItem;
NeueVersion1:TMenuItem;
Druckvorschau:TMenuItem;
Edit1:TMenuItem;
Kopieren:TMenuItem;
Suchen1:TMenuItem;
Ausschneiden1:TMenuItem;
Einfuegen1:TMenuItem;
N6:TMenuItem;
Ersetzen1:TMenuItem;
N7:TMenuItem;
Allesauswhlen1:TMenuItem;
IconImageList:TImageList;
Default1:TMenuItem;
Navigation1:TMenuItem;
Vor1:TMenuItem;
Zur1:TMenuItem;
Home1:TMenuItem;
ToolBar1:TToolBar;
Oeffnen:TToolButton;
Template:TToolButton;
Speichern:TToolButton;
Zur:TToolButton;
Vor:TToolButton;
Home:TToolButton;
Split:TToolButton;
Previewbutton:TToolButton;
SaveDialog:TSaveDialog;
Optionen1:TMenuItem;
Simulation:TMenuItem;
Auf:TToolButton;
Ab:TToolButton;
Inspector1:TMenuItem;
Split1:TMenuItem;
N12:TMenuItem;
Neu1:TMenuItem;
N13:TMenuItem;
Blocknummern:TMenuItem;
SplitterHorizontal:TSplitter;
Auf1:TMenuItem;
Ab1:TMenuItem;
Ersetzenwiederholt1:TMenuItem;
Simulation1:TToolButton;
Exportieren1:TMenuItem;
Undo:TMenuItem;
N1:TMenuItem;
Aktivierung1:TMenuItem;
Execute1:TMenuItem;
Execute:TToolButton;
ZoomComboBox:TComboBox;
Hochformat:TToolButton;
Querformat:TToolButton;
PrintButton:TToolButton;
PDFButton:TToolButton;
Drucken1:TMenuItem;
Importieren1:TMenuItem;
N9:TMenuItem;
Leerzeichen1:TMenuItem;
ToolBar2:TToolBar;
Panel1:TPanel;
SwitchIDEPrint:TToolButton;
Sprache1:TMenuItem;
N8:TMenuItem;
Vollbild1:TMenuItem;
Suchen:TToolButton;
Ersetzen:TToolButton;
Zeilennummern:TToolButton;
SyntaxHighLite:TToolButton;
ToolButton1:TToolButton;
ToolButton2:TToolButton;
ToolButton3:TToolButton;
ToolButton4:TToolButton;
ApplicationIcons:TImageList;
ToolButton5:TToolButton;
ToolButton6:TToolButton;
ToolButton7:TToolButton;
ToolButton8:TToolButton;
ToolButton9:TToolButton;
PopupMenu1:TPopupMenu;
rckgngig2:TMenuItem;
ausschneiden2:TMenuItem;
kopieren22:TMenuItem;
einfgen2:TMenuItem;
N11:TMenuItem;
allesauswhlen2:TMenuItem;
N14:TMenuItem;
PopupMenu2:TPopupMenu;
allesauswhlen3:TMenuItem;
kopieren3:TMenuItem;
Kopieren2:TToolButton;
Ausschneiden:TToolButton;
Einfuegen:TToolButton;
ToolButton15:TToolButton;
UndoButton:TToolButton;
ToolButton10:TToolButton;
ToolButton12:TToolButton;
ToolButton13:TToolButton;
Lizenzerwerben1:TMenuItem;
ToolButton11:TToolButton;
Dateityp1:TMenuItem;
Oeffne2:TToolButton;
ToolButton14:TToolButton;
Feedback1:TMenuItem;
Indenting:TToolButton;
Indenting2:TMenuItem;
N15:TMenuItem;
ContextIT1:TMenuItem;
N16:TMenuItem;
N17:TMenuItem;
N10:TMenuItem;
N18:TMenuItem; procedure SemantikChange(Sender:TObject;Node:TTreeNode); procedure NavigatorChange(Sender:TObject;Node:TTreeNode); procedure GraphClick(Sender:TObject); procedure GraphDblClick(Sender:TObject); procedure FormMouseWheel(Sender:TObject;Shift:TShiftState;
WheelDelta:Integer;MousePos:TPoint;var Handled:Boolean); procedure Simulation1Click(Sender:TObject); procedure InspectorClick(Sender:TObject); Procedure UpDateInspector(LTP:PLongTexts;TT:TTreeNode); procedure AbClick(Sender:TObject); procedure AufClick(Sender:TObject); procedure SetFrameOptions; procedure SetWindowColors; procedure SetWindowFont; Procedure RepairHistory(); procedure DisplayHistory(); function findinHistory(F:JString):Integer; Procedure SavetoHistory(F:JString); procedure LoadfromHistory(Fn:JString); procedure sortHistory(); procedure Setnavigation(); procedure SaveView(); procedure NavGetImageIndex(Sender:TObject;Node:TTreeNode); procedure NavGetSelectedIndex(Sender:TObject;Node:TTreeNode); procedure Font2Click(Sender:TObject); function MakeFilters(filnam:JString):Integer; procedure OeffnenClick(Sender:TObject); procedure Hilfe2Click(Sender:TObject); procedure AboutClick(Sender:TObject); procedure SplitterVerticalMoved(Sender:TObject); procedure ProcessFile(Fn,Ft:JString); procedure TreeClick(Sender:TObject); procedure TreeSelChange(Sender:TObject;var Key:Word;Shift:TShiftState); procedure FarbenClick(Sender:TObject); procedure Zeilennummern1Click(Sender:TObject); procedure SpeichernunterClick(Sender:TObject); procedure Syntaxhighlight1Click(Sender:TObject); procedure Backwards(Sender:TObject); procedure Walk(Prev,this:TFramestate;F:Frames); procedure Forwards(Sender:TObject); procedure Homewards(Sender:TObject); function Viewof(F:Frames):FrameView; procedure DistributeFrames; procedure GetFramePointers; procedure SplitFrames(Sender:TObject); procedure DrawBothImages; procedure ExportCSV(Outname:JString); procedure ExportXML(Outname:JString); procedure ExportText(Outname:JString); procedure ExportProgram(Outname:JString); procedure ExportImage(Outname:JString); procedure Importieren1Click(Sender:TObject); procedure TreeDblClick(Sender:TObject); procedure MaxFrame1(Sender:TObject); procedure MaxFrame2(Sender:TObject); procedure MaxFrame3(Sender:TObject); procedure Druckereinstellung1Click(Sender:TObject); procedure TemplateClick(Sender:TObject); procedure NeueVersion1Click(Sender:TObject); procedure KopierenClick(Sender:TObject); procedure Allesauswhlen1Click(Sender:TObject); procedure Ausschneiden1Click(Sender:TObject); procedure Einfuegen1Click(Sender:TObject); procedure SuchFunktion(Sender:TObject); procedure Ersetzen1Click(Sender:TObject); procedure ExplorerClick(Sender:TObject); procedure PageControlChange(Sender:TObject); procedure SetShortcuts; procedure ShowFileTypes; procedure getCommandLineParameters(); procedure Optionen1Click(Sender:TObject); procedure PageControlDragDrop(Sender,Source:TObject;X,Y:Integer); procedure PageControlDragOver(Sender,Source:TObject;X,Y:Integer;
State:TDragState;var Accept:Boolean); procedure SetFrameIndex(TS:TTabSheet); procedure SetAsParent(var Sheet:TTabSheet;F:Frames); function getallFiles(Files:AnsiString):Integer; procedure Frame11SemantikEnter(Sender:TObject); Procedure DllWatcher(St:Boolean); procedure BlocknummernClick(Sender:TObject); procedure FormShow(Sender:TObject); procedure FormCreate(Sender:TObject); procedure FormClose(Sender:TObject;var Action:TCloseAction); procedure SplitterHorizontalMoved(Sender:TObject); procedure FeedBackDialogack1Click(Sender:TObject); procedure Ersetzenwiederholt1Click(Sender:TObject); procedure Frame11InspectorClick(Sender:TObject); procedure Frame11InspectorKeyUp(Sender:TObject;var Key:Word;
Shift:TShiftState); procedure Exportieren1Click(Sender:TObject); procedure FormResize(Sender:TObject); procedure SpeichernClick(Sender:TObject); procedure GraphMouseMove(Sender:TObject;Shift:TShiftState;X,Y:Integer); function GraphCoordinates(G:TGraph;var S:TTabSheet;var F:TFrame;
P:TPoint):TPoint; procedure FileTypeClick(Sender:TObject); procedure MarkFileTypes(FTyp:JString); procedure Honeypot();inline; procedure Realcheck();inline; procedure undoClick(Sender:TObject); procedure Aktivierung1Click(Sender:TObject); procedure ExecuteClick(Sender:TObject); procedure ExecuteEnd(Sender:TObject); procedure LizenzzeigenClick(Sender:TObject); procedure Frame21SourceChange(Sender:TObject); procedure ProvideExecutable(); procedure DruckvorschauClick(Sender:TObject); procedure HochformatClick(Sender:TObject); procedure QuerformatClick(Sender:TObject); procedure PDFButtonClick(Sender:TObject); procedure PrintButtonClick(Sender:TObject); procedure ZoomComboBoxChange(Sender:TObject); procedure Frame31PageNavigatorClick(Sender:TObject); procedure Leerzeichen1Click(Sender:TObject); procedure ShowPreview(); procedure ShowIDE(); procedure resetMDI(); procedure setFrameStatus(Sender:TObject); Procedure SwitchtoEnglish(); procedure Sprache1Click(Sender:TObject); procedure Vollbild1Click(Sender:TObject); procedure Exit1Click(Sender:TObject); procedure setFrame11Ratio(); procedure setFrame3Ratio(); procedure FormattedFile(Fn:JString); procedure Frame21FunktionKeyUp(Sender:TObject;var Key:Word;
Shift:TShiftState); procedure Frame11ExplorerChange(Sender:TObject;Node:TTreeNode); procedure SourceMouseDown(Sender:TObject;Button:TMouseButton;
Shift:TShiftState;X,Y:Integer); procedure SourceDblClick(Sender:TObject); procedure FullscreenMouseDown(Sender:TObject;Button:TMouseButton;
Shift:TShiftState;X,Y:Integer); procedure Frame21FunktionMouseUp(Sender:TObject;Button:TMouseButton;
Shift:TShiftState;X,Y:Integer); procedure Frame21SourceSelectionChange(Sender:TObject); procedure Frame11SplitterInspectorMoved(Sender:TObject); procedure PageControlMouseMove(Sender:TObject;Shift:TShiftState;
X,Y:Integer); procedure Feedback1Click(Sender:TObject); procedure SetActivePage(F:Frames;V:ViewType); procedure LanguageProcessor(Fn:JString;LexOnly:Boolean;cols:Integer;
forcedll:JString); destructor Destroy;override; procedure checkedition(); function guesstime(filelen:Integer;say:Boolean):Boolean;inline; procedure Lizenzerwerben1Click(Sender:TObject); procedure inslist(S:TextString;var TS:TextStrings); procedure ComboBox1Change(Sender:TObject); procedure ComboBox1Click(Sender:TObject); procedure ComboBox1Notify(); function initSearchReplace(Search,Replace:JString;regex:Boolean;
Kind:SeaRepFun):Boolean; procedure AskforSearchReplace(); procedure GuessEditortime(last:TDateTime;items:Integer;var val:Integer); procedure SavetoSourcestack(); procedure LoadfromSourcestack(); procedure IndentingClick(Sender:TObject); procedure ContextIT1Click(Sender:TObject); procedure SetEditorOptions; public //other dialogues
SearchReplaceDialog:TSearchReplace;
AboutDialog:TAboutBox;
SamplesDialog:TSamples;
ColorDialog:TColorForm;
Fullscr:TFullScreen1; //machine
WinProductId,CPU,IP,IPaddr,EthernetAddr:JString; //actual file infos
CStatus,ActDLLInfo:PAnsiChar; //llnav,llsem,llcfa,lldfa:Integer;
Duration:Integer;
Sep:JString; //mousecontrol
Mousepressed:Boolean;
Horizontalratio,Verticalratio:Integer; //checking
globtim:Integer; //drag&drop
SizeRect:TRect;
MouseButton:TMouseButton; //threads
MyThread:TMyThread;
LastThread:TStatusThread;
Sourcestate:Boolean;
Previousselstart:Integer;
Previousfile:JString; end; //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- var
ModelFrame:TModelFrame; //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- implementation uses //---------------------------------------------------------------------------- //specific //----------------------------------------------------------------------------
Windows,SysUtils,ColorGrd,Grids,ValEdit,
Buttons,SyncObjs,Math,Jpeg,Printers,ShellApi,
Clipbrd,StrUtils,DateUtils,WideStrings; //---------------------------------------------------------------------------- // //----------------------------------------------------------------------------
{$R *.dfm} //------------------------------------------------------------------ //-- //FormCreate -- //-- //------------------------------------------------------------------ procedure TModelFrame.FormCreate(Sender:TObject); var
Icf:TIcon; begin
Closing:=false;
Opening:=true;
processing:=false;
SaveDialog:=nil;
globtim:=0; //FeedBackDialog:=nil;
Sep:='-';
LastMousePos.X:=0;
LastMousePos.Y:=0;
Inspectorkey:=''; //DBAccess.password:=MidStr(DBAccess.user,2,3); //now create Dialogs
AboutDialog:=TAboutBox.Create(self);
SamplesDialog:=TSamples.Create(self);
SearchReplaceDialog:=TSearchReplace.Create(self);
ColorDialog:=TColorForm.Create(self);
Fullscr:=TFullScreen1.Create(self);
Fullscr.Image1.OnMouseDown:=FullscreenMouseDown;
Fullscr.Hide(); //licensing
Lizenz1.checklicense();
getCommandLineParameters(); //find file with license
lang:=Opt.R.Language;
Horizontalratio:=(100*SplitterVertical.left)div width;
Verticalratio:=(100*SplitterHorizontal.Top)div height;
Netflag:=false; //
Caption:=Application.Title+' '+Version_IDE; //get Icon
Icf:=TIcon.Create; if Application.Title=Title_Elbe then
ApplicationIcons.GetIcon(1,Icf) else
ApplicationIcons.GetIcon(0,Icf);
self.Icon.Assign(Icf);
AboutDialog.Icon.Assign(Icf);
Opt.Icon.Assign(Icf);
ColorDialog.Icon.Assign(Icf); //
MDI:=TDocument.Create;
MDI.GC:=TGraph.Create(Opt.R.FontSize,Opt.R.LineThickness,Opt.R.FontColor,
Opt.R.BackgroundColor,Opt.R.FontName,Opt.R.FontStyle,17,
trans(lang,145,'Kontrollflu�'));
MDI.GD:=TGraph.Create(Opt.R.FontSize,Opt.R.LineThickness,Opt.R.FontColor,
Opt.R.BackgroundColor,Opt.R.FontName,Opt.R.FontStyle,18,
trans(lang,146,'Datenflu�')); //
GetFramePointers;
SetFrameOptions;
RepairHistory();
MakeFilters(Opt.R.Infile); //Resize Splash
Opt.R.Activationstart:=Opt.R.Activated;
Frame21.Source.CreateBackup:=Opt.R.CreateBackup;
Frame21.Source.OnDblClick:=SourceDblClick; //language
Undo.Hint:='r�ckg�ngig machen';
Indenting.Hint:='CodeFormatierung'; with Opt dobegin
ValueList.TitleCaptions[0]:='Prozessor';
ValueList.TitleCaptions[1]:='Erweiterungen'; //get extensions
getValueList();
getfileassociations(); end; if Opt.R.Language=english thenbegin
SwitchtoEnglish();
lang:=english; end; //
Frame11.Navigator.OnKeyUp:=TreeSelChange;
Frame11.Semantik.OnKeyUp:=TreeSelChange; //
Filelist:=nil;
Previewselected:=false;
Presentationdone:=false;
Indenting2.OnClick:=IndentingClick;
Previousselstart:=0;
Previousfile:=''; end; //------------------------------------------------------------------ //-- //destroy -- //-- //------------------------------------------------------------------ destructor TModelFrame.Destroy; var
i:Integer; begin //---------------------------------------------------------------------- //free frames //----------------------------------------------------------------------
Closing:=true; //---------------------------------------------------------------------- for i:=0 to length(ADHAndle)-1 do
FreeLibrary(ADHAndle[i]); end; //------------------------------------------------------------------ //-- //parameters from command line //-- //------------------------------------------------------------------ procedure TModelFrame.getCommandLineParameters(); var
PS:JString;
i:Integer; begin //------------------------------------------------ //look for parameters and catenate them //------------------------------------------------ if ParamStr(1)<>''thenbegin//it must be a filename
PS:=''; for i:=1 to ParamCount dobegin if PS>''then
PS:=PS+' ';
PS:=PS+ParamStr(i); end;
setl(Opt.R.Infile,PS); end; end; //------------------------------------------------------------------ //-- //ProvideExecutable -- //-- //------------------------------------------------------------------ procedure TModelFrame.ProvideExecutable(); var
isf,isc:Boolean; begin
isf:=(LowerCase(ExtractFileExt(Frame21.Source.LoadedFile))='.bat')or
(LowerCase(ExtractFileExt(Frame21.Source.LoadedFile))='.cmd');
isc:=(Opt.R.CommandFile>''); if isf then
Execute1.Hint:=trans(lang,38,'Diese Datei ausf�hren') elseif isc then
Execute1.Hint:=trans(lang,39,'das vordefinierte Stapel-Kommando ausf�hren');
Execute.Hint:=Execute1.Hint;
Execute.enabled:=isf or isc;
Execute1.enabled:=Execute.enabled; end; //------------------------------------------------------------------ //-- //SetWindowColors -- //-- //------------------------------------------------------------------ procedure TModelFrame.SetWindowColors; begin //fonts and colors
Frame11.Navigator.Color:=Opt.R.BackgroundColor;
Frame11.Semantik.Color:=Opt.R.BackgroundColor;
Frame11.Explorer.Color:=Opt.R.BackgroundColor;
Frame21.Source.Color:=Opt.R.BackgroundColor;
Frame21.measures.Color:=Opt.R.BackgroundColor;
Frame21.Funktion.Color:=Opt.R.BackgroundColor;
Frame11.Inspector.Color:=Opt.R.BackgroundColor;
Frame31.ThumbnailPreview1.Color:=Opt.R.BackgroundColor;
Frame31.PrintPreview1.Color:=Opt.R.BackgroundColor; end; //------------------------------------------------------------------ //-- //SetWindowFont -- //-- //------------------------------------------------------------------ procedure TModelFrame.SetWindowFont; begin //fonts and colors
Frame11.Navigator.Font.Name:=Opt.R.FontName;
Frame11.Navigator.Font.Style:=Opt.R.FontStyle;
Frame11.Navigator.Font.Size:=Opt.R.FontSize;
Frame11.Semantik.Font.Name:=Opt.R.FontName;
Frame11.Semantik.Font.Style:=Opt.R.FontStyle;
Frame11.Semantik.Font.Size:=Opt.R.FontSize;
Frame11.Explorer.Font.Name:=Opt.R.FontName;
Frame11.Explorer.Font.Style:=Opt.R.FontStyle;
Frame11.Explorer.Font.Size:=Opt.R.FontSize;
Frame21.Source.Font.Name:=Opt.R.FontName;
Frame21.Source.Font.Size:=Opt.R.FontSize;
Frame21.Source.DefAttributes.Name:=Opt.R.FontName;
Frame21.Source.DefAttributes.Size:=Opt.R.FontSize;
Frame21.Source.DefAttributes.Color:=clLtGray; // with Frame21.measures.DefAttributes dobegin
Name:=Opt.R.FontName;
Style:=Opt.R.FontStyle;
Size:=Opt.R.FontSize; end; with Frame21.Funktion.DefAttributes dobegin
Name:=Opt.R.FontName;
Style:=Opt.R.FontStyle;
Size:=Opt.R.FontSize; end; end; //------------------------------------------------------------------ //-- //SetWinShow File Types -- //-- //------------------------------------------------------------------ procedure TModelFrame.ShowFileTypes; var
i,j:Integer;
M:TMenuItem;
Temp:JString;
Ft: arrayof JString; begin
setlength(Ft,length(extensions)); For i:=0 to length(extensions)-1 do
Ft[i]:=extensions[i].dllname; For i:=0 to length(extensions)-2 do For j:=i+1 to length(extensions)-1 do if Ft[i]>Ft[j] thenbegin
Temp:=Ft[j];
Ft[j]:=Ft[i];
Ft[i]:=Temp end; //create entries from history For i:=0 to length(extensions)-1 dobegin
M:=TMenuItem.Create(Dateityp1);
M.Caption:=Ft[i];
M.ImageIndex:=-1;
M.OnClick:=FileTypeClick;
Dateityp1.Add(M); end; //plain
M:=TMenuItem.Create(Dateityp1);
M.Caption:='-';
M.ImageIndex:=-1;
M.OnClick:=FileTypeClick;
Dateityp1.Add(M); //plain
M:=TMenuItem.Create(Dateityp1);
M.Caption:=trans(lang,172,'Rohtext');
M.ImageIndex:=-1;
M.OnClick:=FileTypeClick;
Dateityp1.Add(M); end; //------------------------------------------------------------------ //-- //Mark File Types -- //-- //------------------------------------------------------------------ procedure TModelFrame.MarkFileTypes(FTyp:JString); var
i,ll:Integer;
M:TMenuItem; begin //create entries from history
ll:=length(extensions)-1; For i:=1 to ll dobegin
M:=Dateityp1.items[i-1];
M.Checked:=LowerCase(M.Caption)=LowerCase(FTyp); end; if pos('text',FTyp)>0 thenbegin
M:=Dateityp1.items[ll+1];
M.Checked:=true end; end; //------------------------------------------------------------------ //Function FileType -- //-- //------------------------------------------------------------------ procedure TModelFrame.FileTypeClick(Sender:TObject); var
M:TMenuItem;
FileTyp:JString; begin
M:=(Sender as TMenuItem);
FileTyp:=M.Caption; if Frame21.Source.Modified then
Frame21.Source.Save(true);
ProcessFile(Opt.R.Infile,FileTyp); end; //------------------------------------------------------------------ //Function Oeffnen -- //-- //------------------------------------------------------------------ procedure TModelFrame.IndentingClick(Sender:TObject); begin if Frame21.Source.Indentingpossible then with Frame21.Source dobegin
doindent:=true;
CreateHighlited(LoadedFileNumber);
doindent:=false;
setFrameStatus(Sender) end; end; //------------------------------------------------------------------ //-- //SetEditorOptions -- //-- //------------------------------------------------------------------ procedure TModelFrame.SetEditorOptions; begin
Frame21.Source.casesensitive:=Opt.R.casesensitive;
Frame21.Source.doWordWrap:=Opt.R.wordwrap;
Frame21.Source.regexpsearch:=Opt.R.regularexp;
Frame21.Source.CreateBackup:=Opt.R.CreateBackup;
Frame21.Source.ShowURL:=Opt.R.ShowURL;
Frame21.Source.Indentchars:=Opt.R.Indentchars;
Frame21.Source.Artificiallines:=Opt.R.Artificiallines; end; //------------------------------------------------------------------ //-- //SetFrameOptions -- //-- //------------------------------------------------------------------ procedure TModelFrame.SetFrameOptions; begin //set buttons + controls
Frame31.PrintButton:=PrintButton;
Frame31.Hochformat:=Hochformat;
Frame31.Querformat:=Querformat;
Frame31.ZoomComboBox:=ZoomComboBox; if Opt.R.UserName=''then
Opt.R.UserName:='unbekannter Benutzer'; //Size of Modelframe
Top:=Opt.R.Top;
left:=Opt.R.left;
width:=Opt.R.width;
height:=Opt.R.height; if Application.Title=Title_Elbe thenbegin
Opt.R.InspectorVisible:=false;
Opt.R.Blocknumbers:=false;
Opt.R.InspectorVisible:=false;
Inspector1.Checked:=false;
Inspector1.Visible:=false;
Split.Hide();
Split1.Visible:=false;
N5.Visible:=false;
Blocknummern.Visible:=false;
Importieren1.Visible:=false;
Exportieren1.Visible:=false;
N2.Visible:=false;
Leerzeichen1.Visible:=false; end; //Splitter and Print and Inspector
Frame11.width:=Opt.R.Frame1Width;
Inspector1.Checked:=Opt.R.InspectorVisible; //setFrame11Ratio(); //
SetWindowColors;
SetWindowFont; //menu and toolbar
Zeilennummern1.Checked:=Opt.R.Linenumbers;
Blocknummern.Checked:=Opt.R.Blocknumbers;
Syntaxhervorhebung1.Checked:=Opt.R.SyntaxHighlight;
Leerzeichen1.Checked:=Opt.R.ShowSpaces;
SetEditorOptions(); //clear drag drop
Frame11.PageControl1.EndDrag(false);
Frame21.PageControl1.EndDrag(false);
Frame31.PageControl1.EndDrag(false); //set keys and activation menu item
SetShortcuts; if Opt.R.Activated thenbegin
Aktivierung1.Visible:=false;
Lizenzerwerben1.Visible:=false;
N10.Visible:=false; end; //------------------------------------------------- //Limnitations of Standard Edition //------------------------------------------------- ifnot Opt.R.ExportEnabled thenbegin if Exportieren1<>nilthen
Exportieren1.enabled:=false; if Importieren1<>nilthen
Importieren1.enabled:=false; end;
Opt.R.Frame1Page1Max:=false;
Opt.R.Frame2Page1Max:=false;
Opt.R.Frame3Page1Max:=false; //
ShowFileTypes(); end; //------------------------------------------------------------------ //-- //Change File -- //-- //------------------------------------------------------------------ procedure TModelFrame.UpDateInspector(LTP:PLongTexts;TT:TTreeNode); var
ListItem:TListItem;
SN:JString; function wof(X:JString):JString; var
ii:JString; begin
ii:=StringReplace(X,'-','',[rfReplaceAll]);
ii:=StringReplace(ii,'=','',[rfReplaceAll]);
wof:=ii end; procedure addi(L:JString); var
zz:JString;
i:Integer; begin with Frame11.Inspector dobegin
zz:=getpar(L,SN); if L=S_Fil thenbegin
i:=StrToInt(zz);
zz:=ExtractFileName(MDI.Source[i].Name); end; if (zz>'') thenbegin
ListItem:=items.Add;
ListItem.Caption:=wof(L);
ListItem.SubItems.Add(zz) end end; end; begin ifnot Opening thenbegin if Inspector1.Checked and(LTP<>nil)and(TT<>nil)and(TT.Text>' ') thenbegin with Frame11.Inspector dobegin
ViewStyle:=vsReport;
SN:=Longeur(LTP,TT);
Inspectorkey:=SN; if SN>''thenbegin //while items.Count>0 do
items.clear;
addi(S_Lab);
addi(S_Id);
addi(S_Typ);
addi(S_Bas);
addi(S_Fmt);
addi(S_Ref);
addi(S_Pos);
addi(S_Lin);
addi(S_Col);
addi(S_Fil); end;
Columns[1].width:=Frame11.width-Columns[0].width-10; end;
Frame11.Inspector.Hint:='Inspector '+HintBox(getpar(S_Lab,SN)); end; end; end; //-------------------------------------------------------------- //Page Navigator //-------------------------------------------------------------- procedure TModelFrame.Frame31PageNavigatorClick(Sender:TObject); begin
Frame31.PageNavigatorClick(Sender); end; //-------------------------------------------------------------- //splitter moved //-------------------------------------------------------------- procedure TModelFrame.setFrameStatus(Sender:TObject); const
hexen: array [0..15] ofchar='0123456789ABCDEF'; var
St,c,hex,RP,sst:JString;
dur:real;
P:TPoint;
Li,Co,Ch:Integer;
Insertmode:Boolean; begin
Caption:=Application.Title+' '+Version_IDE+' - '+ExtractFileName
(MDI.Source[MDI.fnr].Name);
St:=''; if Frame21.Source.LoadedFile<>Opt.R.Infile then
St:=Frame21.Source.LoadedFile; ifnot Frame31.Visible thenbegin
dur:=(Duration div 1000)/1; if dur>3 then
St:=MDI.Processor+' ['+FloatToStr(dur)+'sec] - ' else
St:=MDI.Processor+' - '; with Frame21 dobegin
Insertmode:=true;
P:=Frame21.Source.getPos();
Li:=P.Y;
Co:=P.X;
sst:=''; if IsDebuggerPresent then with Source do
sst:=' st='+inttostr(SelStart)+' cp='+inttostr(caretpos.X)
+','+inttostr(caretpos.Y);
St:=St+'['+inttostr(Li)+':'+inttostr(Co)+sst+']'; if Source.Modified then
St:=St+' '+trans(lang,173,'ge�ndert') elseif Source.ReadOnly then
St:=St+' '+trans(lang,174,'schreibgesch�tzt'); if Insertmode then
c:=' '+trans(lang,175,'Einf�gen') else
c:=' '+trans(lang,176,'Ersetzen'); end; with Frame21.Source do if length(SelText)=1 thenbegin
hex:=SelText[1];
Ch:=ord(hex[1]);
hex:=' X'''+hexen[Ch div 16]+hexen[Ch mod 16]+'''';
St:=St+hex end; end; if IsDebuggerPresent thenbegin
RP:=' P/F1/F2=/'+inttostr(MDI.TProc)+'/'+inttostr(MDI.TFrame1)+'/'+inttostr
(MDI.TFrame2);
St:=St+RP+Frame21.TimeRatio; end;
Speichern.enabled:=Frame21.Source.Modified;
Split.enabled:=PageCount(Frame21.PageControl1)>1;
Simulation1.enabled:=Opt.R.Cfa.Sheet.Visible or Opt.R.Dfa.Sheet.Visible; with Frame11 do
Opt.Statusline(PageControl1,statusbar1,''); with Frame21 do
Opt.Statusline(PageControl1,statusbar1,St); with Frame31 do
Opt.Statusline(PageControl1,statusbar1,'');
Setnavigation(); end; //-------------------------------------------------------------- //Inspectir //-------------------------------------------------------------- procedure TModelFrame.InspectorClick(Sender:TObject); begin if Application.Title=Title_Columbo thenbegin
Inspector1.Checked:=not Inspector1.Checked;
Frame11.Inspector.Visible:=Inspector1.Checked;
Frame11.SplitterInspector.Visible:=Inspector1.Checked; end;
setFrame11Ratio();
UpDateInspector(MDI.NavL,Frame11.Navigator.Selected); end; //------------------------------------------------------------------ //-- //get the files of a compilation/analysis -- //-- //------------------------------------------------------------------ function TModelFrame.getallFiles(Files:AnsiString):Integer; var
tthis:JString;
i,P,len:Integer; begin
P:=0; if length(Files)>0 thenbegin
i:=1;
P:=0;
len:=length(Files); while i<=len dobegin if Files[i]=chr(Key_Linefeed) thenbegin
P:=P+1;
tthis:=''; end;
i:=i+1; end; if P=0 then
errorn(68,'Dateien korrupt, '+Files) elsebegin
setlength(MDI.Source,P);
i:=1;
P:=0;
tthis:=''; while i<=len dobegin if Files[i]<>chr(Key_Linefeed) thenbegin
tthis:=tthis+Files[i] end elsebegin
MDI.Source[P].Name:=tthis;//bug im Delphi??
MDI.Source[P].Typ:=RTF;
P:=P+1;
tthis:=''; end;
i:=i+1; end; end; end;
getallFiles:=P end; //-------------------------------------------------------------- //Inspectir //-------------------------------------------------------------- procedure TModelFrame.resetMDI(); begin with MDI dobegin
CNav:=nil;
KeyVerbs:='';
MDI.GC.CStream:=nil;
MDI.GD.CStream:=nil;
CSem:=nil;
CMes:=nil;
CFun:=nil;
Cattr:=nil;
CStatus:=nil;
NavL:=nil;
SEML:=nil; end; end; //-------------------------------------------------------------- //Inspectir //-------------------------------------------------------------- function TModelFrame.guesstime(filelen:Integer;say:Boolean):Boolean; var
calctime1,calctime2,totaltime:Integer;
Stat:JString;
allow:Boolean; begin
allow:=true; //look at size
calctime1:=(filelen div unitofbytes)*Opt.R.Timeper1000forProcessing;
calctime2:=(filelen div unitofbytes)*
(Opt.R.Timeper1000forFrame1+Opt.R.Timeper1000forFrame2);
totaltime:=(calctime1+calctime2)div 10; if totaltime>3 thenbegin
Stat:='[~'+inttostr(totaltime)+' sec]'; with Frame21 do
Opt.Statusline(PageControl1,statusbar1,Stat); end; //-------------------------------------------------- //check for limitations //-------------------------------------------------- if (not Opt.R.Activated)and(filelen>maxfilesize) thenbegin if say then
inform(162,'Datei gr��er als '+inttostr(maxfilesize div 1024)+' kB.'+crlf+ 'Dieses ist eine eingeschr�nkte Version von '+Application.Title+'.'+
crlf+ ' Eine vollst�ndige Lizenz bekommen Sie unter Hilfe:Lizenz erwerben.', '');
allow:=false end;
result:=allow; end; //-------------------------------------------------------------- //Inspectir //-------------------------------------------------------------- procedure TModelFrame.LanguageProcessor(Fn:JString;LexOnly:Boolean;cols:Integer;
forcedll:JString); var
warntime:Integer;
TimeSet:TDateTime;
FilePath,FileName:JString;
Libraries:AnsiString;
DllEdition:JString;
LexLang:Integer;
PKeyVerbs,PNav,PGCStream,PGDStream,PSem,PMes,PFun,Pattr:PAnsiChar; procedure snil(var V:PAnsiChar); begin if (V<>nil) then if length(V)=0 then
V:=nil; end; procedure settonorm(); begin with MDI dobegin
KeyVerbs:=PKeyVerbs;
CNav:=PNav;
GC.CStream:=PGCStream;
GD.CStream:=PGDStream;
CSem:=PSem;
CMes:=PMes;
CFun:=PFun;
Cattr:=Pattr; if MDI.ReturnValue>1 thenbegin
snil(CNav);
CSem:=nil;
MDI.GC.CStream:=nil;
MDI.GD.CStream:=nil;
CFun:=nil;
CMes:=nil; end elsebegin
snil(CNav);
snil(CSem);
snil(GC.CStream);
snil(GD.CStream);
snil(CMes);
snil(CFun); end; end; end; begin
FilePath:=ExtractFilePath(Fn);
FileName:=ExtractFileName(Fn); //hide other windows
Screen.Cursor:=crHourGlass; //now set them to zero
resetMDI();
ActDLLInfo:=@Opt.R.cc;
warntime:=Opt.R.Timeout*1000;
DllEdition:=EditionStrings[Opt.R.Edition];
Libraries:=AnsiString(String(Opt.R.Libraries[1])+chr(Key_Linefeed)); if Opt.R.Libraries[2]<>''then
Libraries:=Libraries+AnsiString(Opt.R.Libraries[2])+AnsiString
(chr(Key_Linefeed)); if Opt.R.Libraries[3]<>''then
Libraries:=Libraries+AnsiString(Opt.R.Libraries[3]); //add language and lexonly marker
LexLang:=ord(LexOnly); if Opt.R.Language<>german then
LexLang:=LexLang+256;
SplashForm1.Init(60); with MDI do
MDI.ReturnValue:=dllcall(Opt.R.ProgramDir,Libraries,PKeyVerbs,FilePath,
FileName,LexLang,PNav,PGCStream,PGDStream,PSem,PMes,PFun,Pattr,cols,
DllEdition,CStatus,ActDLLInfo,warntime,forcedll);
settonorm();
getallFiles(Libraries);
SplashForm1.Progress(5);
TimeSet:=Now;
Frame11.Loader(Fn,IconImageList);
proctime(Opt.R.Timeper1000forFrame1,MDI.TFrame1,TimeSet,MDI.filelength);
SplashForm1.Progress(2); end; //------------------------------------------------------------------ //-- //Change File -- //-- //------------------------------------------------------------------ procedure TModelFrame.ProcessFile(Fn,Ft:JString); var
Filex:JString;
i,ll:Integer;
found,isit:Boolean;
TimeSet:TDateTime; begin
Previousselstart:=Frame21.Source.SelStart;
Screen.Cursor:=crHourGlass;
Indenting.Visible:=false;
Indenting2.Visible:=false;
N15.Visible:=Indenting.Visible;
processing:=true; //show Splash if Opening then
SplashForm1.SetInfo(Version_IDE) else
SplashForm1.SetInfo(trans(lang,23,'analysiere Datei'));
Filex:=LowerCase(ExtractFileExt(Fn));
errorcount:=0;
Lizenz1.checklicense(); // with MDI dobegin
Processor:=trans(lang,142,'Text');
TProc:=0;
TFrame1:=0;
TFrame2:=0;
NavL:=nil;
SEML:=nil;
filelength:=0; end; //wait for windows
Frame21.Source.clearstreams(); //now process file ifnot FileExists(Fn) thenbegin
MDI.GC.CStream:=nil;
MDI.GD.CStream:=nil;
MDI.CMes:=nil; //
setlength(MDI.Source,1);
MDI.Source[0].Name:='0';
MDI.Source[0].Typ:=PLAIN;
MDI.Source[0].Age:='';
Frame21.Source.CreateDummyFile();
Homewards(nil);
errorn(71,'Eingabedatei nicht gefunden'); end //check if in use by another process elseif (Fn<>Frame21.Source.LoadedFile)and FileIsInUse(Fn) thenbegin
MDI.GC.CStream:=nil;
MDI.GD.CStream:=nil;
MDI.CMes:=nil; //
setlength(MDI.Source,1);
MDI.Source[0].Name:='0';
MDI.Source[0].Typ:=PLAIN;
MDI.Source[0].Age:='';
Frame21.Source.CreateDummyFile();
Homewards(nil);
errorn(225,'Eingabedatei wird von einem anderem Proze� benutzt'); end elsebegin // if length(MDI.Source)>0 then
SavetoHistory(Opt.R.Infile);
ll:=length(extensions)-1;
found:=false;
i:=0; whilenot found and(i<=ll) dobegin
isit:=(ispartof(Filex,extensions[i].ext)and(Ft=''))or
(Ft=extensions[i].dllname); ifnot found and isit thenbegin //get content of file
MDI.filelength:=getFileLength(Fn); if guesstime(MDI.filelength,true) thenbegin
found:=true; //process
MDI.Processor:=extensions[i].dllname;
globtim:=MDI.filelength div 60;
TimeSet:=Now;
LanguageProcessor(Fn,extensions[i].LexOnly,ord(Opt.R.Sourceformat),
Ft);
proctime(Opt.R.Timeper1000forProcessing,MDI.TProc,TimeSet,
MDI.filelength);
TimeSet:=Now;
errorcount:=abs(MDI.ReturnValue);
MDI.Previewrepresentation:=extensions[i].Prettyprint;
Frame21.Loader(0,SplashForm1);
proctime(Opt.R.Timeper1000forFrame2,MDI.TFrame2,TimeSet,
MDI.filelength);
Blocknummern.enabled:=MDI.ReturnValue<=1;
Duration:=Frame21.SourceDuration+Frame21.CFADuration+
Frame21.DFADuration;
Indenting.Visible:=Frame21.Source.Indentingpossible;
Indenting2.Visible:=Indenting.Visible;
N15.Visible:=Indenting.Visible; end; end;
i:=i+1 end; if found thenbegin
Syntaxhervorhebung1.enabled:=true;
SyntaxHighLite.enabled:=true;
setl(Opt.R.Infile,Fn); end elseif Filex='.rtf'thenbegin
Frame21.Source.Linenumbers:=Opt.R.Linenumbers;
Frame21.Source.Blocknumbers:=Opt.R.Blocknumbers;
Frame21.Source.LoadHighLites(Opt.R.Highlites);
FormattedFile(Fn); end elsebegin
SplashForm1.Init(10);
SplashForm1.Progress(5);
resetMDI();
setlength(MDI.Source,1);
MDI.Source[0].Name:=Fn;
MDI.Source[0].Typ:=PLAIN;
Frame21.SourceNames(MDI);
Frame21.Source.casesensitive:=Opt.R.casesensitive;
Frame21.Source.doWordWrap:=Opt.R.wordwrap;
Frame21.Source.Linenumbers:=Opt.R.Linenumbers;
Frame21.Source.Blocknumbers:=Opt.R.Blocknumbers;
Frame21.Source.LoadHighLites(Opt.R.Highlites);
Frame21.Source.CreatePlain(0); if Frame21.Source.LoadedFormat=BIN then
MDI.Processor:=trans(lang,165,'Bin�rdaten');
Syntaxhervorhebung1.enabled:=false;
SyntaxHighLite.enabled:=false;
setl(Opt.R.Infile,Fn); end end; //Finished
Screen.Cursor:=crDefault; { Revient toujours � normal }
MarkFileTypes(MDI.Processor);
ShowIDE();
SplashForm1.Finish();
SplashForm1.SetMini();
processing:=false; //note file
Previousfile:=Opt.R.Infile; end; //------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TModelFrame.PrintButtonClick(Sender:TObject); begin ifnot InSight(Opt.R.Druckvorschau) then
DruckvorschauClick(Sender) else
Frame31.PrintButtonClick(Sender); end; //------------------------------------------------------------------ //Procedure GetImageIndex -- //-- //------------------------------------------------------------------ procedure TModelFrame.NavGetImageIndex(Sender:TObject;Node:TTreeNode); begin if Node.HasChildren then if Node.Expanded then
Node.ImageIndex:=ExpandedImage else
Node.ImageIndex:=CollapsedImage else
Node.ImageIndex:=HasChildrenImage; end; //------------------------------------------------------------------ //Procedure GetSelectedIndex -- //-- //------------------------------------------------------------------ procedure TModelFrame.NavGetSelectedIndex(Sender:TObject;Node:TTreeNode); begin
Node.SelectedIndex:=Node.ImageIndex; end; //------------------------------------------------------------------ //-- //FeedBackDialogack -- //-- //------------------------------------------------------------------ procedure TModelFrame.Feedback1Click(Sender:TObject); begin if netallowed then
Browser(Handle, 'https://cococo.de/Context_IT_GmbH/index.jsp?content=contact&topic='+
Application.Title+' '+Version_IDE); end; //------------------------------------------------------------------ //-- //FeedBackDialogack -- //-- //------------------------------------------------------------------ procedure TModelFrame.FeedBackDialogack1Click(Sender:TObject); begin
Feedback1Click(Sender); end; //------------------------------------------------------------------ //Procedure Font2Click -- //-- //------------------------------------------------------------------ procedure TModelFrame.Font2Click(Sender:TObject); var
modi:Boolean;
F:TFont; begin
FontDialog.Font.Name:=Opt.R.FontName;
FontDialog.Font.Color:=Opt.R.FontColor;
FontDialog.Font.Style:=Opt.R.FontStyle;
FontDialog.Font.Size:=Opt.R.FontSize; //nur proportionale Schriften zulassen
FontDialog.Options:=[fdFixedPitchOnly]; if FontDialog.Execute thenbegin
setl(Opt.R.FontName,FontDialog.Font.Name);
Opt.R.FontSize:=FontDialog.Font.Size;
Opt.R.FontStyle:=FontDialog.Font.Style;
Opt.R.FontColor:=FontDialog.Font.Color;
modi:=Frame21.Source.Modified;
SetWindowFont;
Frame21.Source.CreateHighlited(MDI.fnr);
Frame21.Source.Modified:=modi;
F:=TFont.Create();
F.Name:=Opt.R.FontName;
F.Size:=Opt.R.FontSize;
F.Style:=Opt.R.FontStyle;
F.Color:=Opt.R.FontColor;
Frame21.measures.RichAttributes(F);
Frame21.measures.markLinepos(1,1);
Frame21.Funktion.RichAttributes(F);
Frame21.Funktion.markLinepos(1,1);
DrawBothImages;
Frame21.Source.Modified:=modi; end end; //------------------------------------------------------------------ //Function LastView -- //-- //------------------------------------------------------------------ function LastView(i:Frames):ViewType; var
S:ViewType; begin
S:=NoView; if Opt.R.Navigator.Frame=i then
S:=ViewNav; if Opt.R.Semantik.Frame=i then
S:=ViewSem; if Opt.R.Explorer.Frame=i then
S:=ViewExplorer; if Opt.R.Source.Frame=i then
S:=ViewSource; if Opt.R.Cfa.Frame=i then
S:=ViewCFA; if Opt.R.Dfa.Frame=i then
S:=ViewDFA; if Opt.R.measures.Frame=i then
S:=ViewMeasures; if Opt.R.Funktion.Frame=i then
S:=ViewFunktion; if Opt.R.Miniatur.Frame=i then
S:=ViewMiniatur; if Opt.R.Druckvorschau.Frame=i then
S:=ViewDruckvorschau;
LastView:=S end; //------------------------------------------------------------------ //Function DrawBothImages -- //-- //------------------------------------------------------------------ procedure TModelFrame.DrawBothImages; begin ifnot(errorcount>0)and(Opt<>nil)andnot Closing andnot Opening thenbegin with MDI.GC do if CStream<>nilthenbegin
width:=Opt.R.Cfa.Sheet.width;
height:=Opt.R.Cfa.Sheet.height;
VWidth:=0;
VHeight:=0;
ReDraw(); end; with MDI.GD do if CStream<>nilthenbegin
width:=Opt.R.Dfa.Sheet.width;
height:=Opt.R.Dfa.Sheet.height;
VWidth:=0;
VHeight:=0;
ReDraw(); end; end; end; //------------------------------------------------------------------ //Function CanClose -- //-- //------------------------------------------------------------------ procedure TModelFrame.FormClose(Sender:TObject;var Action:TCloseAction); begin //save source if necessary
Action:=caNone; if Frame21.Source.Save(true)<>mrCancel thenbegin //remember perspective if length(MDI.Source)>0 then
SavetoHistory(MDI.Source[0].Name); //remember Size ifnot Opt.R.ismax thenbegin
Opt.R.width:=width;
Opt.R.height:=height;
Opt.R.Top:=Top;
Opt.R.left:=left;
Opt.R.ismax:=false; end;
Opt.R.inited:='J'; if Opt.R.Cfa.Sheet.Visible then with MDI.GC dobegin
Opt.R.Cfa.Sheet.width:=VWidth;
Opt.R.Cfa.Sheet.height:=VHeight; end; if Opt.R.Dfa.Sheet.Visible then with MDI.GD dobegin
Opt.R.Dfa.Sheet.width:=VWidth;
Opt.R.Dfa.Sheet.height:=VHeight; end; //
Opt.R.casesensitive:=Frame21.Source.casesensitive;
Opt.R.regularexp:=Frame21.Source.regexpsearch; //
Opt.R.Frame1Width:=SplitterVertical.left;
Opt.R.Frame3Height:=Frame31.height;
Opt.R.InspectorVisible:=Inspector1.Checked; if Inspector1.Checked then
Opt.R.InspectorHeight:=Frame11.Inspector.height; //
sortHistory();
Frame21.Source.flushstreams();
Action:=caFree; end; end; //------------------------------------------------------------------ //Function Filters -- //-- //------------------------------------------------------------------ function TModelFrame.MakeFilters(filnam:JString):Integer; var
i,ll:Integer;
A,Allfiles,ext,App:JString;
first:Boolean; begin
Filters:='';
App:=trans(lang,237,' Dateien');
result:=0;
ext:='*'+LowerCase(ExtractFileExt(filnam));
first:=true;
ll:=length(extensions)-1;
A:=trans(lang,43,'Quelldateien')+'|';
Allfiles:=trans(lang,156,'Alle Dateien')+'|'+'*.*'; for i:=0 to ll dobegin if extensions[i].ext<>'*'thenbegin if ispartof(ext,extensions[i].ext) then
result:=i+3; if first then
Filters:=extensions[i].longname+App else
Filters:=Filters+'|'+extensions[i].longname+App;
Filters:=Filters+'|';
Filters:=Filters+extensions[i].ext; if first then
A:=A+extensions[i].ext else
A:=A+';'+extensions[i].ext;
first:=false; end; end;
Filters:=A+'|'+Allfiles+'|'+Filters; end; //------------------------------------------------------------------ //Function Oeffnen -- //-- //------------------------------------------------------------------ procedure TModelFrame.OeffnenClick(Sender:TObject); var
OpenDialog:TOpenDialog;
se,sx:Integer;
S,Filex:JString;
MI,PA:TMenuItem;
isok,opendone:Boolean; begin If Sender=Oeffne thenbegin
MakeFilters(Opt.R.Infile);
OpenDialog:=TOpenDialog.Create(self);
OpenDialog.FileName:='';
OpenDialog.InitialDir:=ExtractFilePath(Frame21.Source.LoadedFile); if OpenDialog.InitialDir=''then
OpenDialog.InitialDir:=GetCurrentDir; //OpenDialog.Options:=OpenDialog.Options-[ofNoDereferenceLinks];
OpenDialog.Options:=OpenDialog.Options+[ofReadOnly,ofFileMustExist];
OpenDialog.Filter:='';
S:='';
Filex:=ExtractFileExt(Frame21.Source.LoadedFile);
OpenDialog.Filter:=Filters; if Opt.R.Openindex<0 then
OpenDialog.FilterIndex:=0 else
OpenDialog.FilterIndex:=Opt.R.Openindex; //now follow *.lnk files
isok:=false; repeat
opendone:=OpenDialog.Execute; if opendone thenbegin
Filex:=ExtractFileExt(OpenDialog.FileName);
isok:=LowerCase(Filex)<>'.lnk'; ifnot isok thenbegin
OpenDialog.InitialDir:=GetPathFromLink(OpenDialog.FileName);
OpenDialog.FileName:='';
OpenDialog.Filter:=Filters; end; end; until isok ornot opendone; //filename found? if isok thenbegin if (OpenDialog.FileName<>Frame21.Source.LoadedFile) thenbegin
Opt.R.Openindex:=OpenDialog.FilterIndex;
ProcessFile(OpenDialog.FileName,'');
setl(Opt.R.LastFilter,OpenDialog.Filter[OpenDialog.FilterIndex]); end; end end elsebegin//item out of list of files
MI:=(Sender as TMenuItem);
PA:=MI.Parent;
se:=PA.IndexOf(Exit1);
sx:=PA.IndexOf(MI);
S:=''; if sx-se-1>0 then
S:=Opt.R.History[sx-se-1].FileName;
ProcessFile(S,''); end; end; //------------------------------------------------------------------ //Function RepairHistory -- //-- do if file vanished //------------------------------------------------------------------ procedure TModelFrame.RepairHistory(); var
i,j:Integer; begin //remove vanished files with Opt.R dobegin for i:=1 to HistMax do if History[i].FileName<>''thenbegin ifnot FileExists(History[i].FileName) then for j:=i+1 to HistMax dobegin
History[j-1].FileName:=History[j].FileName;
History[j].FileName:=''; end; end; //remove empty entries for i:=1 to HistMax-1 do if History[i].FileName=''thenbegin
j:=i+1; while (j<HistMax-1)and(History[j].FileName='') do
j:=j+1; if History[j].FileName<>''thenbegin
History[i].FileName:=History[j].FileName;
History[j].FileName:=''; end; end; //remove empty libraries for i:=1 to 3 do if ((Libraries[i]<>'')andnot DirectoryExists(Libraries[i])) then
Libraries[i]:=''; end; end; //------------------------------------------------------------------ //Function LoadfromHistory -- //-- //------------------------------------------------------------------ procedure TModelFrame.LoadfromHistory(Fn:JString); var
i:Integer;
PP:TPoint;
G:JString;
nw,nh,nl,nt:Integer; begin //search history with Opt.R dobegin
ViewList.Free;
ViewList:=nil;
G:=ExtractFileName(Fn);
i:=findinHistory(Fn); if History[i].Per[F1].Node>=0 then with Frame11 do
positbyIndex(History[i].Per[F1].Node); if History[i].Per[F2].pos.Y>0 then
Frame21.positbyPoint(History[i].Per[F2].pos) elseif History[i].Per[F2].Node<>0 thenbegin
PP.X:=1;
PP.Y:=History[i].Per[F2].Node;
Frame21.positbyPoint(PP); end;
nw:=max(History[i].Per[F1].width,History[i].Per[F2].width);
nh:=max(History[i].Per[F1].height,History[i].Per[F2].height);
nt:=History[i].Per[F1].Top;
nl:=History[i].Per[F1].left; if (nw>0)and(nh>0) thenbegin
Top:=nt;
left:=nl;
width:=nw;
height:=nh; end;
SaveView(); end;
width:=Opt.R.width;
height:=Opt.R.height;
Top:=Opt.R.Top;
left:=Opt.R.left;
DisplayHistory(); end; //------------------------------------------------------------------ //Function DisplayHistory -- //-- //------------------------------------------------------------------ procedure TModelFrame.DisplayHistory(); var
i,se:Integer;
M:TMenuItem; function Short(F:JString):JString; var
S:JString; begin
S:=ExtractFilePath(F); if length(S)>8 then
S:=MidStr(S,1,8)+'...';
Short:=S+ExtractFileName(F); end; begin //remove old menuitems
se:=File1.IndexOf(Exit1); for i:=File1.Count downto se+2 do
File1.Remove(File1.items[i-1]); //create entries from history
Sep:='-'; For i:=1 to HistMax do if Opt.R.History[i].FileName<>''thenbegin if Sep='-'thenbegin
M:=TMenuItem.Create(File1);
M.Caption:=Sep;
File1.Add(M);
Sep:=''; end;
M:=TMenuItem.Create(File1);
M.Caption:=Short(Opt.R.History[i].FileName); if pos('.jcl',LowerCase(M.Caption))>0 then
M.ImageIndex:=JCLImage else
M.ImageIndex:=COBOLImage;
M.OnClick:=Oeffne.OnClick;
File1.Add(M); end; end; //------------------------------------------------------------------ //Function sortHistory -- //-- //------------------------------------------------------------------ procedure TModelFrame.sortHistory(); var
i,j:Integer;
zz:THistory; begin //sort by datetime and usage count For i:=1 to HistMax-1 do for j:=i+1 to HistMax do with Opt.R do if (History[i].DateTime<History[j].DateTime) thenbegin
zz:=History[j];
History[j]:=History[i];
History[i]:=zz; end; end; //------------------------------------------------------------------ //Function FidinHistory -- //-- //------------------------------------------------------------------ function TModelFrame.findinHistory(F:JString):Integer; var
i,j:Integer;
G:JString; begin
i:=1;
G:=ExtractFileName(F); while (Opt.R.History[i].FileName<>'')and
(LowerCase(Opt.R.History[i].FileName)<>LowerCase(F))and(i<HistMax) do
i:=i+1; if (i>HistMax) thenbegin //not found, rotate for j:=HistMax downto 2 do
Opt.R.History[j]:=Opt.R.History[j-1];
i:=1; end;
findinHistory:=i end; //------------------------------------------------------------------ //Function SavetoHistory -- //-- //------------------------------------------------------------------ procedure TModelFrame.SavetoHistory(F:JString); var
i:Integer;
G:JString; function Short(F:JString):JString; var
S:JString; begin
S:=ExtractFilePath(F); if length(S)>8 then
S:=MidStr(S,1,8)+'...';
Short:=S+ExtractFileName(F); end; begin if (F>'') thenbegin
SaveView();
G:=ExtractFileName(F);
i:=findinHistory(F);
setl(Opt.R.History[i].FileName,F);
Opt.R.History[i].Count:=0;
Opt.R.History[i].DateTime:=Now; if (ViewList<>nil) then
Opt.R.History[i].Per:=ViewList.Per; end;
DisplayHistory(); end; //------------------------------------------------------------------ //Function Activation -- //-- //------------------------------------------------------------------ procedure TModelFrame.Aktivierung1Click(Sender:TObject); begin
Lizenz1.TrytoActivate(false); end; //------------------------------------------------------------------ //Function Hilfe2 -- //-- //------------------------------------------------------------------ procedure TModelFrame.Hilfe2Click(Sender:TObject); begin //Achtung: *.hlp und *.cnt mitliefern //WinHelp(0,PChar(Application.helpfile),HELP_FINDER,0);
HtmlHelpW(0,PChar(Application.helpfile),0,0); end; //------------------------------------------------------------------ //Function �berClick -- //-- //------------------------------------------------------------------ procedure TModelFrame.AboutClick(Sender:TObject); begin with AboutDialog dobegin
Label1.Caption:=Application.Title+' '+Version;
DLLVersion:=String(ActDLLInfo);
Edition.Caption:=EditionStrings[Opt.R.Edition]+' '+'Edition'; if Opt.R.Activated then
ProduktId.Caption:=trans(lang,166,'g�ltige Lizenz f�r') elsebegin
Edition.Caption:='Shareware'+' '+'Edition'; ifnot Opt.R.Activated then
ProduktId.Caption:=trans(lang,163,'Dateigr��e begrenzt auf:')+inttostr
(maxfilesize div 1024)+' kB' end;
Caption:=trans(lang,167,'�ber ')+Application.Title;
ShowModal end end; //------------------------------------------------------------------ //Function GraphMouseMove -- //-- //------------------------------------------------------------------ procedure TModelFrame.GraphMouseMove(Sender:TObject;Shift:TShiftState;
X,Y:Integer); var
P:TPoint;
Frame:TFrame;
K:JString; begin
P.X:=X;
P.Y:=Y; if (Sender=Frame21.Cfa)and(MDI.GC.Selected<>0)and(MDI.GC.Hint<>'') thenbegin if sqr(MDI.GC.hintpos.X-P.X)+sqr(MDI.GC.hintpos.Y-P.Y)<sqr
(MDI.GC.Sidelength) then
Frame21.Cfa.Hint:=MDI.GC.Hint else
Frame21.Cfa.Hint:='';
Frame:=(Frame21.Cfa.Parent.Parent.Parent.Parent as TFrame);
P:=GraphCoordinates(MDI.GC,Opt.R.Cfa.Sheet,Frame,P);
K:=Frame21.positInfo(P,Sender); if Frame=Frame11 then
Frame11.statusbar1.SimpleText:=K; if Frame=Frame21 then
Frame21.statusbar1.SimpleText:=K; if Frame=Frame31 then
Frame31.statusbar1.SimpleText:=K;
MDI.GC.Hint:=K; end elseif (Sender=Frame21.Dfa)and(MDI.GD.Selected<>0)and(MDI.GD.Hint<>'') then begin if sqr(MDI.GD.hintpos.X-P.X)+sqr(MDI.GD.hintpos.Y-P.Y)<sqr
(MDI.GD.Sidelength) then
Frame21.Dfa.Hint:=MDI.GD.Hint else
Frame21.Dfa.Hint:='';
Frame:=(Frame21.Dfa.Parent.Parent.Parent.Parent as TFrame);
P:=GraphCoordinates(MDI.GD,Opt.R.Dfa.Sheet,Frame,P);
K:=Frame21.positInfo(P,Sender); if Frame=Frame11 then
Frame11.statusbar1.SimpleText:=K; if Frame=Frame21 then
Frame21.statusbar1.SimpleText:=K; if Frame=Frame31 then
Frame31.statusbar1.SimpleText:=K;
MDI.GD.Hint:=K; end; end; //------------------------------------------------------------------ //Key Pressed -- //-- //------------------------------------------------------------------ procedure TModelFrame.Frame21FunktionKeyUp(Sender:TObject;var Key:Word;
Shift:TShiftState); begin if length(Frame21.Funktion.SelText)>0 then
initSearchReplace(Frame21.Funktion.SelText,'',false,FuncSearch); end; //------------------------------------------------------------------ //Source Changed -- //-- //------------------------------------------------------------------ procedure TModelFrame.Frame21SourceChange(Sender:TObject); begin ifnot Opening thenbegin
setFrameStatus(Sender);
Speichern.enabled:=Frame21.Source.Modified; end; end; //------------------------------------------------------------------ //Source Changed -- //-- //------------------------------------------------------------------ procedure TModelFrame.Frame21SourceSelectionChange(Sender:TObject); begin ifnot Opening thenbegin
setFrameStatus(nil); end; end; //------------------------------------------------------------------ //Function Frame11NavClick -- //-- //------------------------------------------------------------------ procedure TModelFrame.TreeClick(Sender:TObject); var
Tree:TTreeView; begin
Tree:=Sender as TTreeView;
Tree.SetFocus();
Realcheck();
Frame11.TreeClick(Sender);
Frame21.positbyNode(Frame11.Key,Tree);
UpDateInspector(MDI.NavL,Frame11.Navigator.Selected);
Frame11.Navigator.Hint:=HintBox(Tree.Selected.Text);
SaveView(); end; //------------------------------------------------------------------ //Function Sem DblClick -- //-- //------------------------------------------------------------------ procedure TModelFrame.TreeDblClick(Sender:TObject); var
PC:TPageControl;
P:TPoint;
TV:TTreeView; begin
PC:=Opt.R.Source.Sheet.PageControl;
PC.ActivePage:=Opt.R.Source.Sheet;
TV:=(Sender as TTreeView); if Opt.R.Source.Frame=F1 then
PageControlChange(Frame11.PageControl1); if Opt.R.Source.Frame=F2 then
PageControlChange(Frame21.PageControl1); if Opt.R.Source.Frame=F3 then
PageControlChange(Frame31.PageControl1); //Frame21.Source.positbyNode(Frame11.Key)
P:=Frame21.getPointfromNode(Frame11.Key);
Frame21.positbyNode(Frame11.Key,TV); end; //------------------------------------------------------------------ //Function Frame11NavClick -- //-- //------------------------------------------------------------------ procedure TModelFrame.TreeSelChange(Sender:TObject;var Key:Word;
Shift:TShiftState); var
Tree:TTreeView;
changed:Boolean; begin if Sender=Frame11.Navigator thenbegin
changed:=Frame11.LastNavSelected<>Frame11.Navigator.Selected;
Frame11.Navigator.SetFocus(); end elseif Sender=Frame11.Semantik thenbegin
changed:=Frame11.LastSemSelected<>Frame11.Semantik.Selected;
Frame11.Semantik.SetFocus(); end else
changed:=false;
Honeypot(); if changed thenbegin
Tree:=Sender as TTreeView;
Frame11.TreeClick(Sender);
Frame21.positbyNode(Frame11.Key,Tree);
UpDateInspector(MDI.NavL,Frame11.Navigator.Selected);
Frame11.Navigator.Hint:=HintBox(Tree.Selected.Text);
SaveView(); end;
Frame11.LastNavSelected:=Frame11.Navigator.Selected;
Frame11.LastSemSelected:=Frame11.Semantik.Selected; end; //------------------------------------------------------------------ //Function LineNumbers -- //-- //------------------------------------------------------------------ procedure TModelFrame.Zeilennummern1Click(Sender:TObject); var
TP:TPageControl;
modi:Boolean; begin
modi:=Frame21.Source.Modified;
Opt.R.Linenumbers:=not Opt.R.Linenumbers; if Opt.R.Linenumbers then
Opt.R.Blocknumbers:=false;
Zeilennummern1.Checked:=Opt.R.Linenumbers;
Blocknummern.Checked:=Opt.R.Blocknumbers;
Frame21.Source.Linenumbers:=Opt.R.Linenumbers;
Frame21.Source.Blocknumbers:=Opt.R.Blocknumbers;
Frame21.Source.Mark();
TP:=Opt.R.Source.Sheet.PageControl;
TP.ActivePage:=Opt.R.Source.Sheet;
Frame21.Source.Modified:=modi; end; //------------------------------------------------------------------ //Function BtnSaveClick -- //-- //------------------------------------------------------------------ procedure TModelFrame.BlocknummernClick(Sender:TObject); var
TP:TPageControl;
modi:Boolean; begin if MDI.ReturnValue<=1 thenbegin
modi:=Frame21.Source.Modified;
Opt.R.Blocknumbers:=not Opt.R.Blocknumbers; if Opt.R.Blocknumbers then
Opt.R.Linenumbers:=false;
Blocknummern.Checked:=Opt.R.Blocknumbers;
Zeilennummern1.Checked:=Opt.R.Linenumbers;
Frame21.Source.Linenumbers:=Opt.R.Linenumbers;
Frame21.Source.Blocknumbers:=Opt.R.Blocknumbers;
Frame21.Source.Mark();
TP:=Opt.R.Source.Sheet.PageControl;
TP.ActivePage:=Opt.R.Source.Sheet;
Frame21.Source.Modified:=modi; end elsebegin
Blocknummern.Checked:=false; end end; //------------------------------------------------------------------ //Function Setnavigation -- //-- //------------------------------------------------------------------ procedure TModelFrame.Setnavigation(); var
c:Integer; begin if ViewList<>nilthenbegin
Vor.enabled:=(ViewList.Next<>nil);
Zur.enabled:=ViewList.Previous<>nil; end elsebegin
Vor.enabled:=false;
Zur.enabled:=false; end;
Home.enabled:=true; if InSight(Opt.R.Source) thenbegin
Ausschneiden.enabled:=Frame21.Source.SelLength>0;
Einfuegen1.enabled:=length(Clipboard.AsText)>0;
UndoButton.enabled:=Frame21.Source.Modified; end elsebegin
Ausschneiden.enabled:=false;
Einfuegen1.enabled:=false;
UndoButton.enabled:=false; end; if InSight(Opt.R.Source)or InSight(Opt.R.measures)or InSight(Opt.R.Funktion) thenbegin
Kopieren2.enabled:=Frame21.Source.SelLength>0; end elsebegin
Kopieren2.enabled:=false; end; if InSight(Opt.R.Cfa)or InSight(Opt.R.Dfa) thenbegin
Auf.enabled:=true;
Ab.enabled:=true; end elsebegin
Auf.enabled:=false;
Ab.enabled:=false; end;
c:=PageCount(Frame21.PageControl1);
Speichern.enabled:=Frame21.Source.Modified;
Split.enabled:=(c>1)or(Frame31.Visible);
Simulation1.enabled:=Opt.R.Cfa.Sheet.Visible or Opt.R.Dfa.Sheet.Visible; //
Auf.enabled:=Filelist<>nil; end; //------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TModelFrame.QuerformatClick(Sender:TObject); begin
Frame31.QuerformatClick(Sender); end; //------------------------------------------------------------------ //Function undo -- //-- //------------------------------------------------------------------ procedure TModelFrame.undoClick(Sender:TObject); begin
Frame21.Source.LoadFromUndoBuffer();
setFrameStatus(Sender); end; //------------------------------------------------------------------ //Function PushViews -- //-- //------------------------------------------------------------------ function TModelFrame.Viewof(F:Frames):FrameView; var
RV:ViewType;
pos:TPoint;
Node:Integer; procedure getv(PC:TPageControl); begin
pos.X:=0;
pos.Y:=0;
Node:=0; with PC do if ActivePage=Opt.R.Navigator.Sheet thenbegin
RV:=ViewNav; with Frame11.Navigator do if Selected<>nilthen
Node:=Selected.AbsoluteIndex; end elseif ActivePage=Opt.R.Semantik.Sheet thenbegin
RV:=ViewSem; with Frame11.Semantik do if Selected<>nilthen
--> --------------------
--> maximum size reached
--> --------------------
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.53Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.