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;
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;
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;
PopupMenu3:TPopupMenu;
drucken2:TMenuItem;
N19:TMenuItem;
drucken3:TMenuItem;
PopupMenu4:TPopupMenu;
drucken11:TMenuItem;
N20:TMenuItem;
verallgemeinern:TMenuItem;
insDetail1:TMenuItem;
drucken4:TMenuItem;
PopupMenu5:TPopupMenu;
drucken5:TMenuItem;
Zoomin:TToolButton;
Zoomout:TToolButton;
ZoomNormal: TToolButton;
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 SetWindowFonts;
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 ZoomChange(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;
firsthistory:
boolean;
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
do begin
ValueList.TitleCaptions[
0]:=
'Prozessor';
ValueList.TitleCaptions[
1]:=
'Erweiterungen';
//get extensions
getValueList();
getfileassociations();
end;
if Opt.R.Language=english
then begin
SwitchtoEnglish();
lang:=english;
end;
//
Frame11.Navigator.OnKeyUp:=TreeSelChange;
Frame11.Semantik.OnKeyUp:=TreeSelChange;
//
Filelist:=
nil;
Previewselected:=false;
Presentationdone:=false;
Indenting2.OnClick:=IndentingClick;
Previousselstart:=
0;
Previousfile:=
'';
firsthistory:=true;
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)<>
'' then begin //it must be a filename
PS:=
'';
for i:=
1 to ParamCount
do begin
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')
else if 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;
//------------------------------------------------------------------
//--
//SetWindowFonts --
//--
//------------------------------------------------------------------
procedure TModelFrame.SetWindowFonts;
var
F:TFont;
begin
F:=TFont.Create;
with F
do begin
Name:=Opt.R.FontName;
Style:=Opt.R.FontStyle;
Size:=Opt.R.FontSize;
Color:=Opt.R.FontColor;
end;
//fonts and colors
Frame11.Navigator.Font.Assign(F);
Frame11.Semantik.Font.Assign(F);
Frame11.Explorer.Font.Assign(F);
Frame11.Inspector.Font.Assign(F);
Frame21.Source.Font.Assign(F);
Frame21.Source.DefAttributes.Assign(F);
if Frame21.CFA<>
nil then
Frame21.CFA.Canvas.Font.Assign(F);
if Frame21.DFA<>
nil then
Frame21.DFA.Canvas.Font.Assign(F);
Frame21.measures.SelectAll;
Frame21.measures.Font.Assign(F);
Frame21.measures.DefAttributes.Assign(F);
Frame21.measures.SelLength:=
0;
Frame21.Funktion.SelectAll;
Frame21.Funktion.Font.Assign(F);
Frame21.Funktion.DefAttributes.Assign(F);
Frame21.Funktion.SelLength:=
0;
end;
//------------------------------------------------------------------
//--
//SetWinShow File Types --
//--
//------------------------------------------------------------------
procedure TModelFrame.ShowFileTypes;
var
i,j:
Integer;
M:TMenuItem;
Temp:JString;
Ft:
array of 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]
then begin
Temp:=Ft[j];
Ft[j]:=Ft[i];
Ft[i]:=Temp
end;
//create entries from history
For i:=
0 to length(extensions)-
1 do begin
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
do begin
M:=Dateityp1.items[i-
1];
M.Checked:=LowerCase(M.Caption)=LowerCase(FTyp);
end;
if pos(
'text',FTyp)>
0 then begin
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
do begin
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;
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
then begin
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;
Horizontalratio:=(
100*SplitterVertical.left)
div width;
Verticalratio:=(
100*SplitterHorizontal.Top)
div height;
Inspector1.Checked:=Opt.R.InspectorVisible;
//setFrame11Ratio();
//
SetWindowColors;
SetWindowFonts;
//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
then begin
Aktivierung1.Visible:=false;
Lizenzerwerben1.Visible:=false;
N10.Visible:=false;
end;
//-------------------------------------------------
//Limnitations of Standard Edition
//-------------------------------------------------
if not Opt.R.ExportEnabled
then begin
if Exportieren1<>
nil then
Exportieren1.enabled:=false;
if Importieren1<>
nil then
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
do begin
zz:=getpar(L,SN);
if L=S_Fil
then begin
i:=StrToInt(zz);
zz:=ExtractFileName(MDI.Source[i].Name);
end;
if (zz>
'')
then begin
ListItem:=items.Add;
ListItem.Caption:=wof(L);
ListItem.SubItems.Add(zz)
end
end;
end;
begin
if not Opening
then begin
if Inspector1.Checked
and(LTP<>
nil)
and(TT<>
nil)
and(TT.Text>
' ')
then begin
with Frame11.Inspector
do begin
ViewStyle:=vsReport;
SN:=Longeur(LTP,TT);
Inspectorkey:=SN;
if SN>
'' then begin
//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]
of char=
'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;
dur:=(Duration
div 1000)/
1;
if dur>
3 then
St:=MDI.Processor+
' ['+FloatToStr(dur)+
'sec] - '
else
St:=MDI.Processor+
' - ';
with Frame21
do begin
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')
else if 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 then begin
hex:=SelText[
1];
Ch:=
ord(hex[
1]);
hex:=
' X'''+hexen[Ch
div 16]+hexen[Ch
mod 16]+
'''';
St:=St+hex
end;
if IsDebuggerPresent
then begin
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
then begin
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 then begin
i:=
1;
P:=
0;
len:=length(Files);
while i<=len
do begin
if Files[i]=chr(Key_Linefeed)
then begin
P:=P+
1;
tthis:=
'';
end;
i:=i+
1;
end;
if P=
0 then
errorn(
68,
'Dateien korrupt, '+Files)
else begin
setlength(MDI.Source,P);
i:=
1;
P:=
0;
tthis:=
'';
while i<=len
do begin
if Files[i]<>chr(Key_Linefeed)
then begin
tthis:=tthis+Files[i]
end
else begin
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
do begin
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 then begin
Stat:=
'[~'+inttostr(totaltime)+
' sec]';
with Frame21
do
Opt.Statusline(PageControl1,statusbar1,Stat);
end;
//--------------------------------------------------
//check for limitations
//--------------------------------------------------
if (
not Opt.R.Activated)
and(filelen>maxfilesize)
then begin
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;
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
do begin
KeyVerbs:=PKeyVerbs;
CNav:=PNav;
GC.CStream:=PGCStream;
GD.CStream:=PGDStream;
CSem:=PSem;
CMes:=PMes;
CFun:=PFun;
Cattr:=Pattr;
if MDI.ReturnValue>
1 then begin
snil(CNav);
CSem:=
nil;
MDI.GC.CStream:=
nil;
MDI.GD.CStream:=
nil;
CFun:=
nil;
CMes:=
nil;
end
else begin
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);
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
do begin
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
if not FileExists(Fn)
then begin
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
else if (Fn<>Frame21.Source.LoadedFile)
and FileIsInUse(Fn)
then begin
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
else begin
//
if length(MDI.Source)>
0 then
SavetoHistory(Opt.R.Infile);
ll:=length(extensions)-
1;
found:=false;
i:=
0;
while not found
and(i<=ll)
do begin
isit:=(ispartof(Filex,extensions[i].ext)
and(Ft=
''))
or
(Ft=extensions[i].dllname);
if not found
and isit
then begin
//get content of file
MDI.filelength:=getFileLength(Fn);
if guesstime(MDI.filelength,true)
then begin
found:=true;
//process
MDI.Processor:=extensions[i].dllname;
globtim:=MDI.filelength
div 60;
LanguageProcessor(Fn,extensions[i].LexOnly,
ord(Opt.R.Sourceformat),
Ft);
TimeSet:=Now;
Frame11.Loader(Fn,IconImageList);
proctime(Opt.R.Timeper1000forFrame1,MDI.TFrame1,TimeSet,
MDI.filelength);
SplashForm1.Progress(
2);
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
then begin
Syntaxhervorhebung1.enabled:=true;
SyntaxHighLite.enabled:=true;
setl(Opt.R.Infile,Fn);
end
else if Filex=
'.rtf' then begin
Frame21.Source.Linenumbers:=Opt.R.Linenumbers;
Frame21.Source.Blocknumbers:=Opt.R.Blocknumbers;
Frame21.Source.LoadHighLites(Opt.R.Highlites);
FormattedFile(Fn);
end
else begin
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
if not 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;
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
then begin
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;
SetWindowFonts;
Frame21.Source.CreateHighlited(MDI.fnr);
Frame21.measures.markLinepos(
1,
1);
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
if not(errorcount>
0)
and(Opt<>
nil)
and not Closing
and not Opening
then begin
with MDI.GC
do
if CStream<>
nil then begin
width:=Opt.R.CFA.Sheet.width;
height:=Opt.R.CFA.Sheet.height;
VWidth:=
0;
VHeight:=
0;
ReDraw();
end;
with MDI.GD
do
if CStream<>
nil then begin
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
then begin
//remember perspective
if length(MDI.Source)>
0 then
SavetoHistory(MDI.Source[
0].Name);
//remember Size
if not Opt.R.ismax
then begin
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
do begin
Opt.R.CFA.Sheet.width:=VWidth;
Opt.R.CFA.Sheet.height:=VHeight;
end;
if Opt.R.DFA.Sheet.Visible
then
with MDI.GD
do begin
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;
if Frame31.height>
0 then
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
do begin
if extensions[i].ext<>
'*' then begin
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
then begin
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,
ofAllowMultiSelect];
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
then begin
Filex:=ExtractFileExt(OpenDialog.FileName);
isok:=LowerCase(Filex)<>
'.lnk';
if not isok
then begin
OpenDialog.InitialDir:=GetPathFromLink(OpenDialog.FileName);
OpenDialog.FileName:=
'';
OpenDialog.Filter:=Filters;
end;
end;
until isok
or not opendone;
//filename found?
if isok
then begin
if (OpenDialog.FileName<>Frame21.Source.LoadedFile)
then begin
Opt.R.Openindex:=OpenDialog.FilterIndex;
ProcessFile(OpenDialog.FileName,
'');
setl(Opt.R.LastFilter,OpenDialog.Filter[OpenDialog.FilterIndex]);
end;
end
end
else begin //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
do begin
for i:=
1 to HistMax
do
if History[i].FileName<>
'' then begin
if not FileExists(History[i].FileName)
then
for j:=i+
1 to HistMax
do begin
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=
'' then begin
j:=i+
1;
while (j<HistMax-
1)
and(History[j].FileName=
'')
do
j:=j+
1;
if History[j].FileName<>
'' then begin
History[i].FileName:=History[j].FileName;
History[j].FileName:=
'';
end;
end;
//remove empty libraries
for i:=
1 to 3 do
if ((Libraries[i]<>
'')
and not DirectoryExists(Libraries[i]))
then
Libraries[i]:=
'';
end;
end;
//------------------------------------------------------------------
//Function LoadfromHistory --
//--
//------------------------------------------------------------------
procedure TModelFrame.LoadfromHistory(Fn:JString);
var
i:
Integer;
PP:TPoint;
G:JString;
nw,nh:
Integer;
//nl,nt:integer;
begin
//search history
with Opt.R
do begin
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)
else if History[i].Per[F2].Node<>
0 then begin
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 firsthistory
and (nw>
0)
and(nh>
0)
then begin
//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();
firsthistory:=false;
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<>
'' then begin
if Sep=
'-' then begin
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)
then begin
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)
then begin
//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>
'')
then begin
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
do begin
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')
else begin
Edition.Caption:=
'Shareware'+
' '+
'Edition';
if not 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<>
'')
then begin
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
else if (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
if not Opening
then begin
setFrameStatus(Sender);
Speichern.enabled:=Frame21.Source.Modified;
end;
end;
//------------------------------------------------------------------
//Source Changed --
//--
//------------------------------------------------------------------
procedure TModelFrame.Frame21SourceSelectionChange(Sender:TObject);
begin
if not Opening
then begin
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
then begin
changed:=Frame11.LastNavSelected<>Frame11.Navigator.Selected;
Frame11.Navigator.SetFocus();
end
else if Sender=Frame11.Semantik
then begin
changed:=Frame11.LastSemSelected<>Frame11.Semantik.Selected;
Frame11.Semantik.SetFocus();
end
else
changed:=false;
Honeypot();
if changed
then begin
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 then begin
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
else begin
Blocknummern.Checked:=false;
end
end;
//------------------------------------------------------------------
//Function Setnavigation --
//--
//------------------------------------------------------------------
procedure TModelFrame.Setnavigation();
var
c:
Integer;
begin
if ViewList<>
nil then begin
Vor.enabled:=(ViewList.Next<>
nil);
Zur.enabled:=ViewList.Previous<>
nil;
end
else begin
Vor.enabled:=false;
Zur.enabled:=false;
end;
Home.enabled:=true;
if InSight(Opt.R.Source)
then begin
Ausschneiden.enabled:=Frame21.Source.SelLength>
0;
Einfuegen1.enabled:=length(Clipboard.AsText)>
0;
UndoButton.enabled:=Frame21.Source.Modified;
end
else begin
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)
then begin
Kopieren2.enabled:=Frame21.Source.SelLength>
0;
end
else begin
Kopieren2.enabled:=false;
end;
if InSight(Opt.R.CFA)
then begin
Auf.enabled:=(MDI.GC.Map<>
nil);
Ab.enabled:=(MDI.GC.Map=
nil);
end else if InSight(Opt.R.DFA)
then begin
Auf.enabled:=(MDI.GD.Map<>
nil);
Ab.enabled:=(MDI.GD.Map=
nil);
end
else begin
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:=Auf.enabled
or (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
then begin
RV:=ViewNav;
with Frame11.Navigator
do
if Selected<>
nil then
Node:=Selected.AbsoluteIndex;
end
else if ActivePage=Opt.R.Semantik.Sheet
then begin
RV:=ViewSem;
with Frame11.Semantik
do
if Selected<>
nil then
Node:=Selected.AbsoluteIndex;
end
else if ActivePage=Opt.R.Explorer.Sheet
then begin
RV:=ViewExplorer
end
else if ActivePage=Opt.R.Source.Sheet
then begin
RV:=ViewSource;
pos:=Frame21.Source.getPos();
end
else if ActivePage=Opt.R.CFA.Sheet
then begin
RV:=ViewCFA;
Node:=MDI.GC.Selected;
end
else if ActivePage=Opt.R.DFA.Sheet
then begin
RV:=ViewDFA;
Node:=MDI.GD.Selected;
end
else if ActivePage=Opt.R.measures.Sheet
then begin
RV:=ViewMeasures;
pos:=Frame21.measures.getPos();
end
else if ActivePage=Opt.R.Funktion.Sheet
then begin
RV:=ViewFunktion;
pos:=Frame21.Funktion.getPos();
end
else if ActivePage=Opt.R.Miniatur.Sheet
then begin
RV:=ViewMiniatur
end
else if ActivePage=Opt.R.Druckvorschau.Sheet
then begin
RV:=ViewDruckvorschau
end
else if ActivePage=Opt.R.Execution.Sheet
then begin
RV:=ViewExecution;
end;
end;
begin
if F=F1
then begin
getv(Frame11.PageControl1);
Viewof.width:=width;
Viewof.height:=height;
Viewof.Top:=Top;
Viewof.left:=left;
end
else if F=F2
then begin
getv(Frame21.PageControl1);
Viewof.width:=width;
Viewof.height:=height;
Viewof.Top:=Top;
Viewof.left:=left;
end
else if F=F3
then begin
getv(Frame31.PageControl1);
Viewof.width:=width;
Viewof.height:=height;
Viewof.Top:=Top;
Viewof.left:=left;
end;
Viewof.ActiveView:=RV;
Viewof.fnr:=Frame21.Source.LoadedFileNumber;
Viewof.SelLength:=Frame21.Source.SelLength;
pos.X:=pos.X-Frame21.Source.SelLength;
if pos.X<
1 then
pos.X:=
1;
Viewof.pos:=pos;
Viewof.Node:=Node;
end;
//------------------------------------------------------------------
//Function PushViews --
//--
//------------------------------------------------------------------
procedure TModelFrame.SaveView();
var
F:Frames;
P:Perspective;
isnull,viewchanged:
Boolean;
begin
//find current
for F:=F1
to F3
do
P[F]:=Viewof(F);
//check old state
isnull:=true;
viewchanged:=false;
if ViewList<>
nil then begin
for F:=F1
to F3
do
isnull:=isnull
and(ViewList.Per[F].Node=
0);
for F:=F1
to F3
do
viewchanged:=viewchanged
or(P[F].ActiveView<>ViewList.Per[F].ActiveView);
end;
//now select where to save it
if ViewList=
nil then
ViewList:=TFramestate.Create()
else if not isnull
or viewchanged
then begin
//leave it
ViewList.Next:=TFramestate.Create();
ViewList.Next.Previous:=ViewList;
ViewList:=ViewList.Next;
end;
//save it
ViewList.Per:=P;
Setnavigation();
end;
//------------------------------------------------------------------
//Function Backwards --
//--
//------------------------------------------------------------------
procedure TModelFrame.Backwards(Sender:TObject);
var
F:Frames;
Next:TFramestate;
begin
if ViewList<>
nil then
if ViewList.Previous<>
nil then begin
Next:=ViewList;
ViewList:=ViewList.Previous;
for F:=F1
to F3
do
Walk(Next,ViewList,F);
setFrameStatus(
nil);
end;
Setnavigation();
end;
//------------------------------------------------------------------
//Function Forwards --
//--
//------------------------------------------------------------------
procedure TModelFrame.Forwards(Sender:TObject);
var
F:Frames;
Prev:TFramestate;
begin
if ViewList<>
nil then
if ViewList.Next<>
nil then begin
Prev:=ViewList;
ViewList:=ViewList.Next;
for F:=F1
to F3
do
Walk(Prev,ViewList,F);
end;
Setnavigation();
end;
//------------------------------------------------------------------
//Function BAckwards --
//--
//------------------------------------------------------------------
procedure TModelFrame.Walk(Prev,this:TFramestate;F:Frames);
var
P:TPoint;
N:
Integer;
ll:
Integer;
begin
if (Prev<>
nil)
and(this<>
nil)
then begin
if Prev.Per[F].ActiveView<>this.Per[F].ActiveView
then
SetActivePage(F,this.Per[F].ActiveView);
if this.Per[F].fnr<>Prev.Per[F].fnr
then
Frame21.Source.CreateHighlited(this.Per[F].fnr);
if not eq(this.Per[F].pos,Prev.Per[F].pos)
or
(this.Per[F].Node<>Prev.Per[F].Node)
then begin
P:=this.Per[F].pos;
N:=this.Per[F].Node;
ll:=this.Per[F].SelLength;
case this.Per[F].ActiveView
of
ViewNav:
Frame11.FindPosition(Frame11.Navigator,P);
ViewSem:
Frame11.FindPosition(Frame11.Semantik,P);
ViewSource:
Frame21.Source.markWord(P.Y,P.X,ll);
ViewCFA:
MDI.GC.GraphPositbyNode(N,MDI.GC.im);
ViewDFA:
MDI.GD.GraphPositbyNode(N,MDI.GD.im);
ViewMeasures:
Frame21.measures.markLinepos(P.Y,P.X);
ViewFunktion:
Frame21.Funktion.markLinepos(P.Y,P.X);
end;
end;
end;
end;
//------------------------------------------------------------------
//Function Ab --
//--
//------------------------------------------------------------------
procedure TModelFrame.AbClick(Sender:TObject);
var
P:PGraphMap;
fin:Boolean;
begin
if InSight(Opt.R.CFA) then begin
P:=MDI.GC.Map;
fin:=
false;
if P<>nil then
if P.Map<>nil then
fin:=
true;
if not fin then begin
if MDI.GC.Map=nil then begin
if not MDI.GC.GraphCirclesCompress() then
MDI.GC.GraphWeightsCompress();
end
else
MDI.GC.GraphWeightsCompress()
end;
DrawBothImages;
end
else if InSight(Opt.R.DFA) then begin
P:=MDI.GD.Map;
fin:=
false;
if P<>nil then
if P.Map<>nil then
fin:=
true;
if not fin then begin
if MDI.GD.Map=nil then begin
if not MDI.GD.GraphCirclesCompress() then
MDI.GD.GraphWeightsCompress();
end
else
MDI.GD.GraphWeightsCompress();
end;
DrawBothImages;
end;
Setnavigation();
end;
//------------------------------------------------------------------------------
//experimentally save status
//------------------------------------------------------------------------------
procedure TModelFrame.SavetoSourcestack();
var
Fn:JString;
//i,ll:Integer;
begin
Fn:=Frame21.Source.LoadedFile;
if Filelist=nil then
Filelist:=TSourceStack.Create(Fn)
else begin
Filelist.Next:=TSourceStack.Create(Fn);
Filelist.Next.Previous:=Filelist;
Filelist:=Filelist.Next;
end;
Filelist.FileName:=Fn;
//inhibited
//if false then with Filelist do begin
//FileName:=Fn;
//RTFstream:=TMemoryStream.Create();
//RTFstream.Position:=0;
//Frame21.Source.lines.SaveToStream(RTFstream);
//if MDI.NavL<>nil then begin
//Navstream:=TMemoryStream.Create();
//Navstream.Position:=0;
//Frame11.Navigator.SaveToStream(Navstream);
//ll:=length(MDI.NavL^.items);
//new(Navlongstream);
//setlength(Navlongstream^.items,ll);
//for i:=0 to ll-1 do
//Navlongstream^.items[i]:=MDI.NavL^.items[i];
//end;
//if MDI.SEML<>nil then begin
//Semstream:=TMemoryStream.Create();
//Semstream.Position:=0;
//Frame11.Semantik.SaveToStream(Semstream);
//ll:=length(MDI.SEML^.items);
//new(Semlongstream);
//setlength(Semlongstream^.items,ll);
//for i:=0 to ll-1 do
//Semlongstream^.items[i]:=MDI.SEML^.items[i];
//end;
//end;
end;
//------------------------------------------------------------------------------
//experimentally load status
//------------------------------------------------------------------------------
procedure TModelFrame.LoadfromSourcestack();
var
//Fn:JString;
//i,ll:Integer;
Oldfilelist:TSourceStack;
begin
if Filelist<>nil then begin
ProcessFile(Filelist.FileName,
'');
//if false then with Filelist do begin
//RTFstream.Position:=0;
//Frame21.Source.lines.LoadFromStream(RTFstream);
//Frame21.Source.LoadedFile:=Fn;
//Frame21.Source.Repaint;
//if Navlongstream<>nil then begin
//Navstream.Position:=0;
//Frame11.Navigator.LoadFromStream(Navstream);
//if mdi.NavL=nil then
//new(mdi.NavL);
//ll:=length(Navlongstream^.items);
//setlength(MDI.NavL^.items,ll);
//for i:=0 to ll-1 do
//MDI.NavL.items[i]:=Navlongstream^.items[i];
//end;
//if Semlongstream<>nil then begin
//Semstream.Position:=0;
//Frame11.Semantik.LoadFromStream(Semstream);
//if mdi.SemL=nil then
//new(mdi.SemL);
//ll:=length(Semlongstream^.items);
//setlength(MDI.SEML^.items,ll);
//for i:=0 to ll-1 do
//MDI.SEML.items[i]:=Semlongstream^.items[i];
//end;
//ShowIDE();
//end;
Oldfilelist:=Filelist;
Filelist:=Filelist.Previous;
Oldfilelist.Free;
end;
end;
//------------------------------------------------------------------
//Function Auf --
//--
//------------------------------------------------------------------
procedure TModelFrame.AufClick(Sender:TObject);
begin
if InSight(Opt.R.Source)
and(Filelist<>nil) then begin
LoadfromSourcestack();
end
else if InSight(Opt.R.CFA) then
MDI.GC.GraphExpand()
else if InSight(Opt.R.DFA) then
MDI.GD.GraphExpand();
DrawBothImages;
Setnavigation();
end;
//------------------------------------------------------------------
//Function HintergrundFarbe --
//--
//------------------------------------------------------------------
procedure TModelFrame.FarbenClick(Sender:TObject);
begin
with ColorDialog
do begin
Caption:=Application.Title+
' '+Version_IDE;
ShowModal();
if ModalResult<>mrCancel then begin
SetWindowColors;
Frame21.Source.LoadHighLites(Opt.R.Highlites);
Frame21.Source.CreateHighlited(Frame21.Source.LoadedFileNumber);
DrawBothImages;
end;
end;
end;
//------------------------------------------------------------------
//--
//FormShow --
//--
//------------------------------------------------------------------
procedure TModelFrame.FormShow(Sender:TObject);
begin
Lizenz1.checklicense();
ProcessFile(Opt.R.Infile,
'');
setFrameStatus(nil);
Opening:=
false;
end;
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
procedure TModelFrame.ZoomChange(Sender:TObject);
begin
if (Sender=Zoomin) then
Frame31.ZoominClick(Sender)
else if (Sender=Zoomout) then
Frame31.ZoomoutClick(Sender)
else if (Sender=ZoomNormal) then
Frame31.ZoomNormalClick(Sender)
end;
//------------------------------------------------------------------
//Function Speichern --
//--
//------------------------------------------------------------------
procedure TModelFrame.SpeichernClick(Sender:TObject);
begin
with Frame21.Source
do begin
Cursor:=crHourGlass;
Save(
false);
ShowRedraw();
ProcessFile(MDI.Source[
0].Name,
'');
Cursor:=crDefault;
end;
end;
//------------------------------------------------------------------
//Function Speichern als --
//--
//------------------------------------------------------------------
procedure TModelFrame.SpeichernunterClick(Sender:TObject);
var
Filex,filnam:JString;
PP,fin,i:Integer;
begin
if InSight(Opt.R.Source) then begin
fin:=MakeFilters(Opt.R.Infile);
if SaveDialog=nil then
SaveDialog:=TSaveDialog.Create(self);
SaveDialog.InitialDir:=ExtractFilePath(Opt.R.Infile);
SaveDialog.Options:=[ofOverwritePrompt,ofPathMustExist,ofAllowMultiSelect];
SaveDialog.Filter:=Filters;
SaveDialog.FilterIndex:=fin;
filnam:=ExtractFileName(Frame21.Source.LoadedFile);
PP:=pos(
'.',filnam);
if PP>
0 then
filnam:=MidStr(filnam,
1,PP-
1);
SaveDialog.FileName:=filnam;
if SaveDialog.Execute then begin
if SaveDialog.FilterIndex>
2 then begin
Filex:=MidStr(extensions[SaveDialog.FilterIndex-
3].ext,
2,
10);
i:=
1;
while (i<length(Filex))
and(Filex[i]<>
';')
do
i:=i+
1;
if (Filex[i]=
';') then
Filex:=MidStr(Filex,
1,i-
1)
end
else
Filex:=ExtractFileExt(SaveDialog.FileName);
filnam:=SaveDialog.FileName;
if ExtractFileExt(filnam)=
'' then
filnam:=filnam+Filex;
if ExtractFileExt(filnam)=
'' then
filnam:=filnam+ExtractFileExt(Opt.R.Infile);
if filnam<>Opt.R.Infile then begin
//first reverse views
if Opt.R.Linenumbers then
Zeilennummern1Click(nil);
if Opt.R.Blocknumbers then
BlocknummernClick(nil);
Frame21.Source.PlainText:=
true;
Frame21.Source.SaveRtfTo(filnam);
Frame21.Source.Modified:=
false;
ProcessFile(filnam,
'')
end
else
errorn(
74,
'Derselbe Dateiname ist nicht g�ltig');
end;
end
else
Exportieren1Click(Sender);
end;
//------------------------------------------------------------------
//Function SyntaxHighlite --
//--
//------------------------------------------------------------------
procedure TModelFrame.Syntaxhighlight1Click(Sender:TObject);
Var
TP:TPageControl;
modi:Boolean;
begin
modi:=Frame21.Source.Modified;
Opt.R.SyntaxHighlight:=
not Opt.R.SyntaxHighlight;
Syntaxhervorhebung1.Checked:=Opt.R.SyntaxHighlight;
Frame21.Source.SyntaxHighlight:=Opt.R.SyntaxHighlight;
Frame21.Source.CreateHighlited(
0);
TP:=Opt.R.Source.Sheet.PageControl;
TP.ActivePage:=Opt.R.Source.Sheet;
Frame21.Source.Modified:=modi;
end;
//------------------------------------------------------------------
//verify Tab in parent --
//--
//------------------------------------------------------------------
procedure TModelFrame.SetAsParent(var Sheet:TTabSheet;F:Frames);
var
PageControl:TPageControl;
begin
if F=F1 then
PageControl:=Frame11.PageControl1
else if F=F2 then
PageControl:=Frame21.PageControl1
else if F=F3 then
PageControl:=Frame31.PageControl1
else
PageControl:=Frame11.PageControl1;
if Sheet<>nil then
if Sheet.PageControl<>PageControl then
Sheet.PageControl:=PageControl;
end;
//------------------------------------------------------------------
//verify Tab in parent --
//--
//------------------------------------------------------------------
procedure TModelFrame.SetActivePage(F:Frames;V:ViewType);
var
sh:TTabSheet;
begin
sh:=nil;
case V of
ViewNav:
sh:=Opt.R.Navigator.Sheet;
ViewSem:
sh:=Opt.R.Semantik.Sheet;
ViewExplorer:
sh:=Opt.R.Explorer.Sheet;
ViewSource:
sh:=Opt.R.Source.Sheet;
ViewCFA:
sh:=Opt.R.CFA.Sheet;
ViewDFA:
sh:=Opt.R.DFA.Sheet;
ViewMeasures:
sh:=Opt.R.measures.Sheet;
ViewFunktion:
sh:=Opt.R.Funktion.Sheet;
ViewMiniatur:
sh:=Opt.R.Miniatur.Sheet;
ViewDruckvorschau:
sh:=Opt.R.Druckvorschau.Sheet;
ViewExecution:
sh:=Opt.R.Execution.Sheet;
NoView:
sh:=nil;
end;
if sh<>nil then begin
SetAsParent(sh,F);
sh.PageControl.ActivePage:=sh;
sh.BringToFront
end;
end;
//------------------------------------------------------------------
//Function SetFrame --
//--
//------------------------------------------------------------------
procedure TModelFrame.SetFrameIndex(TS:TTabSheet);
Var
FR:Frames;
begin
FR:=F1;
if TS.Parent=Frame11.PageControl1 then
FR:=F1
else if TS.Parent=Frame21.PageControl1 then
FR:=F2
else if TS.Parent=Frame31.PageControl1 then
FR:=F3;
if Opt.R.Navigator.Sheet=TS then
Opt.R.Navigator.Frame:=FR
else if Opt.R.Semantik.Sheet=TS then
Opt.R.Semantik.Frame:=FR
else if Opt.R.Explorer.Sheet=TS then
Opt.R.Explorer.Frame:=FR
else if Opt.R.Source.Sheet=TS then
Opt.R.Source.Frame:=FR
else if Opt.R.CFA.Sheet=TS then
Opt.R.CFA.Frame:=FR
else if Opt.R.DFA.Sheet=TS then
Opt.R.DFA.Frame:=FR
else if Opt.R.measures.Sheet=TS then
Opt.R.measures.Frame:=FR
else if Opt.R.Funktion.Sheet=TS then
Opt.R.Funktion.Frame:=FR
else if Opt.R.Miniatur.Sheet=TS then
Opt.R.Miniatur.Frame:=FR
else if Opt.R.Druckvorschau.Sheet=TS then
Opt.R.Druckvorschau.Frame:=FR;
end;
//------------------------------------------------------------------------------
//Full Screen
//------------------------------------------------------------------------------
procedure TModelFrame.Vollbild1Click(Sender:TObject);
var
R:TRect;
begin
if not Vollbild1.Checked then begin
Borderstyle:=bsNone;
SizeRect.left:=left;
SizeRect.right:=left+width;
SizeRect.Top:=Top;
SizeRect.Bottom:=Top+height;
SystemParametersInfo(SPI_GETWORKAREA,
0,@R,
0);
SetBounds(R.left,R.Top,R.right-R.left,R.Bottom-R.Top);
Frame21.width:=width;
Panel1.Visible:=
false;
File1.Visible:=
false;
Edit1.Visible:=
false;
View1.Visible:=
false;
Navigation1.Visible:=
false;
Hilfe1.Visible:=
false;
Vollbild1.Checked:=
true;
MainMenu1.items.Visible:=
false;
DrawBothImages;
setFrame11Ratio();
Fullscr.left:=left+width-Fullscr.width;
Fullscr.Top:=Top;
Fullscr.Show;
end
else begin
Borderstyle:=bsSizeable;
R:=SizeRect;
SetBounds(R.left,R.Top,R.right-R.left,R.Bottom-R.Top);
Frame21.width:=width;
SizeRect.right:=
0;
Panel1.Visible:=
true;
MainMenu1.items.Visible:=
true;
File1.Visible:=
true;
Edit1.Visible:=
true;
View1.Visible:=
true;
Navigation1.Visible:=
true;
Hilfe1.Visible:=
true;
Vollbild1.Checked:=
false;
DrawBothImages;
Fullscr.Hide();
setFrame11Ratio();
end;
end;
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
procedure TModelFrame.HochformatClick(Sender:TObject);
begin
Frame31.HochformatClick(Sender);
end;
//------------------------------------------------------------------
//Function Homewards --
//--
//------------------------------------------------------------------
procedure TModelFrame.Homewards(Sender:TObject);
function outside():Boolean;
begin
result:=
false;
result:=result
or(Top+height>Screen.height);
result:=result
or(left+width>Screen.height);
end;
begin
if not InSight(Opt.R.Druckvorschau) then begin
//set varying frame info
Opt.R.Navigator.Frame:=F1;
Opt.R.Semantik.Frame:=F1;
Opt.R.Explorer.Frame:=F1;
Opt.R.Source.Frame:=F2;
Opt.R.CFA.Frame:=F2;
Opt.R.DFA.Frame:=F2;
Opt.R.measures.Frame:=F2;
Opt.R.Funktion.Frame:=F2;
Opt.R.Miniatur.Frame:=F3;
Opt.R.Druckvorschau.Frame:=F3;
//
//reset Frame3
SetAsParent(Opt.R.Navigator.Sheet,F1);
SetAsParent(Opt.R.Semantik.Sheet,F1);
SetAsParent(Opt.R.Explorer.Sheet,F1);
//
SetAsParent(Opt.R.Source.Sheet,F2);
SetAsParent(Opt.R.CFA.Sheet,F2);
SetAsParent(Opt.R.DFA.Sheet,F2);
SetAsParent(Opt.R.measures.Sheet,F2);
SetAsParent(Opt.R.Funktion.Sheet,F2);
//
SetAsParent(Opt.R.Miniatur.Sheet,F3);
SetAsParent(Opt.R.Druckvorschau.Sheet,F3);
//activate first tab
Frame11.PageControl1.ActivePageIndex:=
0;
Frame21.PageControl1.ActivePageIndex:=
0;
Frame31.PageControl1.ActivePageIndex:=
0;
//Init File again
LoadfromHistory(Opt.R.Infile);
Opt.R.InspectorHeight:=Frame11.height div
3;
//set widths
if outside() then begin
Top:=(
10*Screen.height)div
100;
height:=(
80*Screen.height)div
100;
left:=(
30*Screen.width)div
100;
width:=(
40*Screen.width)div
100;
end;
Frame11.width:=width div
4;
//repaint
with MDI.GC
do begin
VWidth:=width;
VHeight:=height;
VTop:=
0;
VLeft:=
0;
//reset graphs
VWidth:=
0;
VHeight:=
0;
end;
with MDI.GD
do begin
VWidth:=width;
VHeight:=height;
VTop:=
0;
VLeft:=
0;
//reset graphs
VWidth:=
0;
VHeight:=
0;
end;
//
Speichern.enabled:=Frame21.Source.Modified;
DrawBothImages();
ShowIDE();
//
if Frame21.Source.LoadedFileNumber<>
0 then
Frame21.Source.CreateHighlited(
0);
if Frame11.Visible then
Frame11.PageControl1.ActivePage.SetFocus;
Frame21.PageControl1.ActivePage.SetFocus;
end
else begin
Frame21.Source.ReadOnly:=Sourcestate;
ShowIDE();
end;
end;
//------------------------------------------------------------------
//Function Export CSV --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExportCSV(Outname:JString);
var
Strout:TextFile;
stop:Boolean;
TT:Integer;
tf,Txf,Txt,Txp,Txc,Fun,SO:JString;
begin
stop:=
false;
if InSight(Opt.R.Funktion) then begin
errorn(
75,
'Invalid Export');
stop:=
true
end;
if not stop then begin
AssignFile(Strout,Outname);
Rewrite(Strout);
TT:=
0;
while (TT<length(MDI.NavL.items))
do begin
if InSight(Opt.R.Navigator) then
tf:=MDI.NavL.items[TT].Text
else
tf:=MDI.SEML.items[TT].Text;
Fun:=Functor(tf);
Txf:=getpar(S_Fil,tf);
Txt:=getpar(S_Typ,tf);
Txp:=getpar(S_Lin,tf);
Txc:=getpar(S_Col,tf);
SO:=Txt+
','+Fun+
','+Txf+
','+Txp+
','+Txc;
Writeln(Strout,SO);
TT:=TT+
1;
end;
CloseFile(Strout)
end
end;
//------------------------------------------------------------------
//Function Export XML --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExportXML(Outname:JString);
const
headerascii=
'<?xml version="1.0" encoding="ascii" standalone="yes"?>';
headeriso=
'<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>';
dtdbeg=
'<!DOCTYPE tree [';
dtd0=
'<!ELEMENT tree (node*)>';
dtd1=
'<!ELEMENT node (name, file, type, pos, col)>';
dtd11=
'<!ELEMENT name (#PCDATA)>';
dtd12=
'<!ELEMENT file (#PCDATA)>';
dtd13=
'<!ELEMENT type (#PCDATA)>';
dtd14=
'<!ELEMENT pos (#PCDATA)>';
dtd15=
'<!ELEMENT col (#PCDATA)>';
dtdend=
']>';
var
Strout:TextFile;
stop:Boolean;
TT,tmax:Integer;
tf,Txf,Txt,Txp,Txc,Fun:JString;
function xmlcharset(S:JString):JString;
begin
S:=StringReplace(S,
'<',
'<',[rfReplaceAll]);
S:=StringReplace(S,
'&',
'&',[rfReplaceAll]);
S:=StringReplace(S,
'>',
'>',[rfReplaceAll]);
S:=StringReplace(S,
'"',
'"',[rfReplaceAll]);
S:=StringReplace(S,
'''',
''',[rfReplaceAll]);
xmlcharset:=S;
end;
begin
stop:=
false;
case Frame11.PageControl1.ActivePageIndex of
0:
;
1:
;
3:begin
errorn(
76,
'Invalid Export');
stop:=
true;
end;
end;
if not stop then begin
AssignFile(Strout,Outname);
Rewrite(Strout);
Writeln(Strout,headerascii);
Writeln(Strout,dtdbeg);
Writeln(Strout,dtd0);
Writeln(Strout,dtd1);
Writeln(Strout,dtd11);
Writeln(Strout,dtd12);
Writeln(Strout,dtd13);
Writeln(Strout,dtd14);
Writeln(Strout,dtd15);
Writeln(Strout,dtdend);
Writeln(Strout,
'<tree>');
TT:=
0;
if InSight(Opt.R.Navigator) then
tmax:=length(MDI.NavL.items)
else
tmax:=length(MDI.SEML.items);
while (TT<tmax)
do begin
if InSight(Opt.R.Navigator) then
tf:=MDI.NavL.items[TT].Text
else
tf:=MDI.SEML.items[TT].Text;
Fun:=Functor(tf);
Txf:=getpar(S_Fil,tf);
Txt:=getpar(S_Typ,tf);
Txp:=getpar(S_Lin,tf);
Txc:=getpar(S_Col,tf);
Writeln(Strout,
'<node>');
Writeln(Strout,
' <name>'+xmlcharset(Fun)+
'</name>');
Writeln(Strout,
' <file>'+xmlcharset(Txf)+
'</file>');
Writeln(Strout,
' <type>'+Txt+
'</type>');
Writeln(Strout,
' <line>'+Txp+
'</line>');
Writeln(Strout,
' <col>'+Txc+
'</col>');
Writeln(Strout,
'</node>');
TT:=TT+
1;
end;
Writeln(Strout,
'</tree>');
CloseFile(Strout)
end
end;
//------------------------------------------------------------------
//Function Export Text --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExportText(Outname:JString);
begin
case Frame21.PageControl1.ActivePageIndex of
0:
Frame21.Source.lines.savetofile(Outname);
1:
errorn(
77,
'Nicht vorgesehen');
2:
errorn(
78,
'Nicht vorgesehen');
3:
Frame21.measures.lines.savetofile(Outname);
4:
Frame21.Funktion.lines.savetofile(Outname);
end
end;
//------------------------------------------------------------------
//Function Export Text --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExportProgram(Outname:JString);
begin
case Frame21.PageControl1.ActivePageIndex of
0:
errorn(
79,
'Nicht vorgesehen');
1:
errorn(
80,
'Nicht vorgesehen');
2:
errorn(
81,
'Nicht vorgesehen');
3:
errorn(
82,
'Nicht vorgesehen');
4:
errorn(
83,
'Nicht vorgesehen');
end
end;
//------------------------------------------------------------------
//Function Export Image --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExportImage(Outname:JString);
begin
case Frame21.PageControl1.ActivePageIndex of
0:
errorn(
84,
'Nicht vorgesehen');
1:
Frame21.CFA.Picture.savetofile(Outname);
2:
Frame21.DFA.Picture.savetofile(Outname);
3:
errorn(
85,
'Nicht vorgesehen');
4:
errorn(
86,
'Nicht vorgesehen');
5:
errorn(
87,
'Nicht vorgesehen');
end
end;
//------------------------------------------------------------------
//Function Export Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.Exportieren1Click(Sender:TObject);
var
TFile,Current,NewExt,OldExt:JString;
PP:Integer;
begin
if SaveDialog=nil then
SaveDialog:=TSaveDialog.Create(self);
SaveDialog.InitialDir:=Opt.R.ExportDir;
SaveDialog.Options:=[ofOverwritePrompt,ofPathMustExist,ofExtensionDifferent];
SaveDialog.Filter:=
'XML Dateien (*.xml)|*.xml|'+
'CSV Dateien (*.csv)|*.csv|'+
'Dokumente (*.rtf)|*.rtf|'+
'Bilder (*.jpg)|*.jpg|'+
'Programm (*.java)|*.java';
TFile:=Opt.R.ExportDir+ExtractFileName(Opt.R.Infile);
OldExt:=ExtractFileExt(TFile);
TFile:=StringReplace(TFile,OldExt,
'',[rfReplaceAll]);
SaveDialog.FileName:=TFile;
TFile:=SaveDialog.FileName;
if InSight(Opt.R.Navigator) then
SaveDialog.FilterIndex:=
1
else if InSight(Opt.R.Semantik) then
SaveDialog.FilterIndex:=
1
else if InSight(Opt.R.Explorer) then
SaveDialog.FilterIndex:=
1
else if InSight(Opt.R.Source) then
SaveDialog.FilterIndex:=
3
else if InSight(Opt.R.CFA) then
SaveDialog.FilterIndex:=
4
else if InSight(Opt.R.DFA) then
SaveDialog.FilterIndex:=
4
else if InSight(Opt.R.measures) then
SaveDialog.FilterIndex:=
3
else if InSight(Opt.R.Funktion) then
SaveDialog.FilterIndex:=
3
else if InSight(Opt.R.Druckvorschau) then
SaveDialog.FilterIndex:=
5;
if SaveDialog.Execute then begin
case SaveDialog.FilterIndex of
1:
NewExt:=
'.xml';
2:
NewExt:=
'.csv';
3:
NewExt:=
'.rtf';
4:
NewExt:=
'.jpg';
5:
NewExt:=
'.java'
else begin
NewExt:=
'';
errorn(
88,
'falsches Filter');
end;
end;
TFile:=SaveDialog.FileName;
PP:=pos(
'.',ExtractFileName(TFile));
if PP<=
0 then
TFile:=TFile+NewExt
else begin
Current:=MidStr(LowerCase(ExtractFileName(TFile)),PP,length(NewExt));
if Current<>NewExt then begin
TFile:=StringReplace(TFile,Current,NewExt,[rfIgnoreCase]);
SaveDialog.FileName:=TFile;
end
end;
if (LowerCase(OldExt)<>NewExt)
and(NewExt=
'.java') then begin
inform(
45,
'noch nicht m�glich',
'');
end;
case SaveDialog.FilterIndex of
1:
ExportXML(SaveDialog.FileName+NewExt);
2:
ExportCSV(SaveDialog.FileName+NewExt);
3:
ExportText(SaveDialog.FileName+NewExt);
4:
ExportImage(SaveDialog.FileName+NewExt);
5:
ExportProgram(SaveDialog.FileName+NewExt)
else
errorn(
89,
'falsches Filter');
end;
setl(Opt.R.ExportDir,ExtractFileDir(SaveDialog.FileName)+
'\');
end;
end;
//------------------------------------------------------------------
//Function Import Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.Importieren1Click(Sender:TObject);
var
OpenDialog:TOpenDialog;
begin
OpenDialog:=TOpenDialog.Create(self);
OpenDialog.InitialDir:=Opt.R.ProgramDir;
OpenDialog.Options:=[ofReadOnly,ofFileMustExist];
OpenDialog.Filter:=
'CSV Dateien (*.csv)|*.csv|'+
'XML Files (*.xml)|*.xml';
OpenDialog.FilterIndex:=
1; { start the dialog showing all files }
if OpenDialog.Execute then
ProcessFile(OpenDialog.FileName,
'')
end;
//------------------------------------------------------------------
//Function Graph Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.GraphClick(Sender:TObject);
var
D:TPoint;
Sheet:TTabSheet;
Frame:TFrame;
FS:Frames;
Img:TImage;
GF:TGraph;
Node:Integer;
begin
Img:=Frame21.CFA;
GF:=MDI.GC;
if Sender=Frame21.DFA then begin
Img:=Frame21.DFA;
GF:=MDI.GD
end;
Sheet:=(Img.Parent.Parent as TTabSheet);
Frame:=(Img.Parent.Parent.Parent.Parent as TFrame);
if Frame=Frame21 then
FS:=F2
else if Frame=Frame31 then
FS:=F3
else
FS:=F1;
D:=Mouse.CursorPos;
D:=GraphCoordinates(GF,Sheet,Frame,D);
with Frame11
do
positbyPoint(ViewList.Per[FS].pos,
0);
Node:=Frame21.positbyPoint(D);
if Node>
0 then begin
if InSight(Opt.R.Navigator) then
UpDateInspector(MDI.NavL,Frame11.Navigator.Selected);
if InSight(Opt.R.Semantik) then
UpDateInspector(MDI.SEML,Frame11.Semantik.Selected);
end;
SaveView();
end;
//------------------------------------------------------------------
//--
//On mouse down in Graph --
//--
//------------------------------------------------------------------
function TModelFrame.GraphCoordinates(G:TGraph;var S:TTabSheet;var F:TFrame;
P:TPoint):TPoint;
var
Off,cvx,cvy:Integer;
SC:TScrollbox;
begin
cvx:=G.Sidelength div
2;
cvy:=G.Sidelength div
2;
if (G.YBorder>G.Sidelength div
2)
and(G.VHeight=G.height) then
cvy:=cvy+
2*G.YBorder
else
cvy:=cvy+G.VHeight*G.YBorder div G.height;
//it's a miracle
P.X:=P.X-S.left;
P.Y:=P.Y-S.Top;
P.X:=P.X-F.left;
P.Y:=P.Y-F.Top;
P.X:=P.X-self.left-cvx;
//corr term
P.Y:=P.Y-self.Top;
P.Y:=P.Y-cvy;
//corr term
if G.VLeft>
0 then begin
P.X:=P.X-G.VLeft;
P.Y:=P.Y-G.VTop;
end;
//showmessage('x='+inttostr(P.X)+' y='+inttostr(P.Y));
if S=Opt.R.CFA.Sheet then
SC:=Frame21.ScrollBox1
else
SC:=Frame21.ScrollBox2;
if SC.HorzScrollBar.Range>
0 then begin
Off:=(SC.HorzScrollBar.Position*G.VWidth)div SC.HorzScrollBar.Range;
P.X:=P.X+Off;
end;
if SC.VertScrollBar.Range>
0 then begin
Off:=(SC.VertScrollBar.Position*G.VHeight)div SC.VertScrollBar.Range;
P.Y:=P.Y+Off;
end;
GraphCoordinates:=P
end;
//------------------------------------------------------------------
//Function DFA Double Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.GraphDblClick(Sender:TObject);
var
D,P:TPoint;
Sheet:TTabSheet;
Frame:TFrame;
FS:Frames;
Img:TImage;
GF:TGraph;
se,Co:Integer;
Key:JString;
begin
Img:=Frame21.CFA;
GF:=MDI.GC;
if Sender=Frame21.DFA then begin
Img:=Frame21.DFA;
GF:=MDI.GD
end;
Sheet:=(Img.Parent.Parent as TTabSheet);
Frame:=(Img.Parent.Parent.Parent.Parent as TFrame);
if Frame=Frame21 then
FS:=F2
else if Frame=Frame31 then
FS:=F3
else
FS:=F1;
D:=Mouse.CursorPos;
D:=GraphCoordinates(GF,Sheet,Frame,D);
se:=GF.FindGraphNode(GF.im,D);
if se>
0 then begin
GF.Selected:=se;
Co:=GF.Maps(se).Tree;
if (Co>=
0)
and(Co<=length(GF.Content^.items)) then
Key:=GF.Content^.items[Co].Text;
with Frame11
do
positbyPoint(ViewList.Per[FS].pos,
0);
Opt.R.Source.Sheet.PageControl.ActivePage:=Opt.R.Source.Sheet;
//Frame21.Source.positbyNode(Key);
P:=Frame21.getPointfromNode(Key);
Frame21.Source.markLinepos(P.Y,P.X);
if InSight(Opt.R.Navigator) then
UpDateInspector(MDI.NavL,Frame11.Navigator.Selected);
if InSight(Opt.R.Semantik) then
UpDateInspector(MDI.SEML,Frame11.Semantik.Selected);
end;
end;
//------------------------------------------------------------------
//Function Find Search --
//--
//------------------------------------------------------------------
procedure TModelFrame.inslist(S:TextString;var TS:TextStrings);
var
i:Integer;
fou:Boolean;
begin
setl(S.S,trim(S.S));
if S.S>
'' then begin
fou:=
false;
for i:=
1 to length(TS)
do
if S.S=trim(TS[i].S) then begin
fou:=
true;
TS[i].Regular:=S.Regular
end;
if not fou then begin
for i:=length(TS) downto
2 do
TS[i]:=TS[i-
1];
TS[
1]:=S;
end;
end;
end;
//------------------------------------------------------------------
//-
//------------------------------------------------------------------
procedure TModelFrame.ComboBox1Notify();
begin
with SearchReplaceDialog
do begin
ComboBox1.OnChange:=ComboBox1Change;
ComboBox1.OnClick:=ComboBox1Click;
ComboBox1.OnDropDown:=ComboBox1Click;
end;
end;
//------------------------------------------------------------------
//-
//------------------------------------------------------------------
procedure TModelFrame.ContextIT1Click(Sender:TObject);
begin
if netallowed then
Browser(Handle,
'http://cococo.de/Context_IT_GmbH/index.jsp?content=software');
end;
//------------------------------------------------------------------
//-
//------------------------------------------------------------------
procedure TModelFrame.ComboBox1Click(Sender:TObject);
begin
with SearchReplaceDialog
do begin
ComboBox1.Color:=clWhite;
end;
end;
//------------------------------------------------------------------
//-
//------------------------------------------------------------------
procedure TModelFrame.ComboBox1Change(Sender:TObject);
begin
with SearchReplaceDialog
do begin
ComboBox1.Color:=clWhite;
CheckBox2.Checked:=FindinComboBox1(trim(ComboBox1.Text));
end;
end;
//------------------------------------------------------------------
//-
//------------------------------------------------------------------
function TModelFrame.initSearchReplace(Search,Replace:JString;regex:Boolean;
Kind:SeaRepFun):Boolean;
begin
with Frame21.Source,SearchReplaceDialog
do begin
Parsecheck:=
true;
setSearchString(Search,regex);
if Parsecheck then begin
//now searchstring=search
inslist(searchString,Opt.R.searchString);
ComboBox1Add(searchString);
setl(ReplaceString.S,Replace);
inslist(ReplaceString,Opt.R.ReplaceString);
end;
//beware of empty replcaement
if Kind<>FuncSearch then
if (Search=
'^')
and(Replace=
'')
or(Replace=
'\0') then
Parsecheck:=
false;
result:=Parsecheck
end;
end;
//------------------------------------------------------------------
//show search dialogue
//
//------------------------------------------------------------------
procedure TModelFrame.AskforSearchReplace();
var
i:Integer;
begin
with SearchReplaceDialog,Frame21.Source
do begin
//------------------------------------------------
ComboBox1.items.clear;
ComboBox2.items.clear;
for i:=
1 to length(Opt.R.searchString)
do
if Opt.R.searchString[i].S>
'' then
ComboBox1Add(Opt.R.searchString[i]);
for i:=
1 to length(Opt.R.ReplaceString)
do
if Opt.R.ReplaceString[i].S>
'' then
ComboBox2.items.Add(Opt.R.ReplaceString[i].S);
ComboBox1.Text:=searchString.S;
ComboBox2.Text:=Opt.R.ReplaceString[
1].S;
//------------------------------------------------
CheckBox1.Checked:=Frame21.Source.casesensitive;
CheckBox2.Checked:=FindinComboBox1(ComboBox1.Text);
ShowModal();
casesensitive:=CheckBox1.Checked;
regexpsearch:=CheckBox2.Checked;
end;
end;
//------------------------------------------------------------------
//Function Find
//on key down and upon button/menu click
//------------------------------------------------------------------
procedure TModelFrame.GuessEditortime(last:TDateTime;items:Integer;
var val:Integer);
var
N10,span,erg:real;
begin
if items>
10 then begin
N10:=items/
10;
span:=MilliSecondsBetween(Now,last);
erg:=span/N10;
val:=(trunc(
100*erg)div
100+val)div
2;
end;
end;
//------------------------------------------------------------------
//Function Find
//on key down and upon button/menu click
//------------------------------------------------------------------
procedure TModelFrame.SuchFunktion(Sender:TObject);
var
allcount,oldselstart,oldsellength,guessvalue:Integer;
isbutton:Boolean;
calctime:TDateTime;
//------------------------------------------------
procedure showsearch();
begin
with SearchReplaceDialog,Frame21.Source
do begin
Panel3.height:=
0;
Label4.width:=(SearchReplaceDialog.width-
3*Button1.width)div
3;
Button4.Visible:=
true;
button3.Visible:=
false;
ComboBox2.TabStop:=
false;
SearchReplaceDialog.height:=
2*Panel2.height+
30+Panel6.height;
end;
end;
//------------------------------------------------
begin
isbutton:=(Sender=Suchen);
with Frame21.Source,SearchReplaceDialog
do begin
ComboBox1Notify();
Opt.R.Source.Sheet.PageControl.ActivePage:=Opt.R.Source.Sheet;
if Frame21.Source.Visible then
Frame21.Source.SetFocus;
//------------------------------------------------
//first try repeated search or seltext search
//------------------------------------------------
if isbutton
and(SelText>
'') then
initSearchReplace(SelText,
'',
false,FuncSearch);
if not isbutton
and(searchString.S=
'')
and(SelText>
'') then
initSearchReplace(SelText,
'',
false,FuncSearch);
//------------------------------------------------
if (searchString.S>
'')
and not wrapped
and not isbutton then begin
SelStart:=SelStart+
1;
SearchReplace(FuncSearch);
if wrapped then begin
SelStart:=
0;
if foundat<
0 then
inform(
46,
'nicht gefunden',
'')
else
inform(
169,
'zum Dateianfang zur�ck',
'');
end
else if foundat<
0 then
inform(
46,
'nicht gefunden',
'')
end;
//------------------------------------------------
if (searchString.S=
'')
or wrapped
or isbutton then begin
showsearch();
AskforSearchReplace();
if ModalResult=mrOK then begin
Screen.Cursor:=crHourGlass;
repeat
if initSearchReplace(ComboBox1.Text,
'',regexpsearch,FuncSearch) then
begin
SearchReplace(FuncSearch);
if (foundat<
0) then
inform(
46,
'nicht gefunden',
'');
end
else begin
ComboBox1.Color:=ColorWarn;
AskforSearchReplace();
end;
until Parsecheck
or(ModalResult=mrCancel);
Screen.Cursor:=crDefault;
end
//------------------------------------------------
else if ModalResult=mrAll then begin
if (ComboBox1.Text>
'') then begin
Screen.Cursor:=crHourGlass;
with Frame21.Source
do begin
Cursor:=crHourGlass;
SelStart:=
0;
guessvalue:=Opt.R.Timeper10forSearch*MDI.filelength div
1000;
if (guessvalue>
20000) then
inform(
221,
'Die Aktion wird etwa einige Zeit dauern:',
inttostr(guessvalue));
calctime:=Now;
repeat
if initSearchReplace(ComboBox1.Text,
'',regexpsearch,FuncSearch)
then begin
oldselstart:=SelStart;
oldsellength:=SelLength;
allcount:=
0;
Cursor:=crHourGlass;
HideRedraw();
SelStart:=
0;
repeat
SearchReplace(FuncSearch);
if (foundat>=
0) then begin
allcount:=allcount+
1;
if not wrapped then
SelStart:=foundat;
end;
if foundat>=
0 then
SelStart:=SelStart+
1;
until (foundat<
0)
or wrapped;
GuessEditortime(calctime,allcount,Opt.R.Timeper10forSearch);
SelStart:=oldselstart;
SelLength:=oldsellength;
ShowRedraw();
ScrollLeft();
if (foundat>=
0) then
allcount:=allcount+
1;
inform(
147,
'Anzahl:',inttostr(allcount));
Cursor:=crDefault;
end
else begin
ComboBox1.Color:=ColorWarn;
AskforSearchReplace();
end;
until Parsecheck
or(ModalResult=mrCancel);
Screen.Cursor:=crDefault;
end
end;
end;
end;
end;
end;
//------------------------------------------------------------------
//Function replace --
//--
//------------------------------------------------------------------
procedure TModelFrame.Ersetzen1Click(Sender:TObject);
var
allcount,oldselstart,oldsellength,guessvalue:Integer;
isbutton:Boolean;
calctime:TDateTime;
//------------------------------------------------
procedure showreplace();
begin
with SearchReplaceDialog
do begin
Label4.width:=(SearchReplaceDialog.width-
3*Button1.width)div
3;
Panel3.height:=Panel2.height;
Button4.Visible:=
false;
button3.Visible:=
true;
ComboBox2.TabStop:=
true;
SearchReplaceDialog.height:=Panel1.height+
2*Panel2.height+
30+
Panel6.height;
end;
end;
//------------------------------------------------
begin
Opt.R.Source.Sheet.PageControl.ActivePage:=Opt.R.Source.Sheet;
isbutton:=(Sender=Ersetzen);
if Frame21.Source.Visible then
Frame21.Source.SetFocus;
with Frame21.Source
do
if isbutton
and(SelText>
'') then
initSearchReplace(SelText,
'',
false,FuncReplace);
with SearchReplaceDialog,Frame21.Source
do begin
ComboBox1Notify();
showreplace();
repeat
AskforSearchReplace();
if not(ComboBox1.Text<>ComboBox2.Text)
and(ComboBox1.Text<>
'') then begin
ComboBox1.Color:=ColorWarn;
ComboBox2.Color:=ColorWarn;
end;
until (ModalResult=mrCancel)
or(ComboBox1.Text<>ComboBox2.Text)
and
(ComboBox1.Text<>
'');
//------------------------------------------------
if ModalResult=mrOK then begin
Screen.Cursor:=crHourGlass;
repeat
if initSearchReplace(ComboBox1.Text,ComboBox2.Text,regexpsearch,
FuncReplace) then begin
SaveToUndoBuffer();
SearchReplace(FuncReplace);
if foundat<
0 then begin
errorn(
90,
'nicht gefunden');
end;
end
else begin
ComboBox1.Color:=ColorWarn;
ComboBox2.Color:=ColorWarn;
AskforSearchReplace();
end;
until Parsecheck
or(ModalResult=mrCancel);
Screen.Cursor:=crDefault;
end
//------------------------------------------------
else if ModalResult=mrAll then begin
if (ComboBox1.Text>
'') then begin
Screen.Cursor:=crHourGlass;
with Frame21.Source
do begin
HideRedraw();
allcount:=
0;
SaveToUndoBuffer();
guessvalue:=Opt.R.Timeper10forReplace*MDI.filelength div
1000;
if (guessvalue>
20000) then
inform(
222,
'Die Aktion wird einige Zeit dauern:',
inttostr(guessvalue));
calctime:=Now;
repeat
if initSearchReplace(ComboBox1.Text,ComboBox2.Text,regexpsearch,
FuncReplace) then begin
oldselstart:=SelStart;
oldsellength:=SelLength;
HideRedraw();
SelStart:=
0;
Cursor:=crHourGlass;
repeat
SearchReplace(FuncReplace);
if foundat>=
0 then
allcount:=allcount+
1;
until (foundat<
0)
or wrapped;
SelStart:=oldselstart;
SelLength:=oldsellength;
Cursor:=crDefault;
ShowRedraw();
ScrollLeft();
end
else begin
ComboBox1.Color:=ColorWarn;
ComboBox2.Color:=ColorWarn;
AskforSearchReplace();
end;
until Parsecheck
or(ModalResult=mrCancel);
GuessEditortime(calctime,allcount,Opt.R.Timeper10forReplace);
ShowRedraw();
inform(
188,
'Anzahl Ersetzungen:',inttostr(allcount));
SelStart:=
0;
Screen.Cursor:=crDefault;
end;
end;
end;
end;
end;
//------------------------------------------------------------------
//Function replace --
//--
//------------------------------------------------------------------
procedure TModelFrame.Ersetzenwiederholt1Click(Sender:TObject);
begin
with Frame21.Source
do begin
Screen.Cursor:=crHourGlass;
//Selstart:=Selstart+1;
SaveToUndoBuffer();
SearchReplace(FuncContReplace);
if wrapped then begin
SelStart:=
0;
inform(
170,
'zur�ck am Anfang der Datei',
'');
end;
Screen.Cursor:=crDefault;
end;
end;
//------------------------------------------------------------------
//Function Drucker Einstellung --
//--
//------------------------------------------------------------------
procedure TModelFrame.Druckereinstellung1Click(Sender:TObject);
var
PrinterSetupDialog:TPrinterSetupDialog;
begin
PrinterSetupDialog:=TPrinterSetupDialog.Create(self);
PrinterSetupDialog.Execute;
end;
//------------------------------------------------------------------
//Function Template --
//--
//------------------------------------------------------------------
procedure TModelFrame.TemplateClick(Sender:TObject);
begin
SamplesDialog.ShowModal;
if SamplesDialog.changed then begin
setlength(MDI.Source,
1);
MDI.Source[
0].Name:=SamplesDialog.NewfilNam;
MDI.Source[
0].Typ:=PLAIN;
setl(Opt.R.Infile,SamplesDialog.NewfilNam);
ProcessFile(SamplesDialog.NewfilNam,
'')
end;
end;
//------------------------------------------------------------------
//Function neu Version
//--
//------------------------------------------------------------------
procedure TModelFrame.NeueVersion1Click(Sender:TObject);
const
versionfile=
'version.txt';
msiext=
'.exe';
var
RemoteHost,TestHost,URI:JString;
loc:TextFile;
Vers:JString;
updresp:Boolean;
Site,Language,SaveDir:JString;
Setupfile:String;
begin
SaveDir:=OptionsFileDir(Application.Title);
if lang=english then
Language:=
'en'
else
Language:=
'de';
TestHost:=
'http://localhost:8084/Context_IT_GmbH/';
RemoteHost:=
'http://cococo.de/Context_IT_GmbH/';
URI:=
'updatesoftware?content=update&language='+Language+
'&product='+
Application.Title;
Setupfile:=Application.Title+
'Update'+msiext;
Vers:=
'';
if netallowed then begin
Screen.Cursor:=crHourGlass;
//check for test environmnet
Site:=RemoteHost+URI;
if not GetInetFile(Site+
'&info='+versionfile,SaveDir+versionfile) then
Site:=TestHost+URI;
//now do download
if GetInetFile(Site+
'&info='+versionfile,SaveDir+versionfile) then begin
//checknetwork();
AssignFile(loc,SaveDir+versionfile);
Reset(loc);
readln(loc,Vers);
CloseFile(loc);
if Vers>Version_IDE then begin
//OK, get remote setup file
updresp:=ask(
139,
'Datei herunterladen?',
'')=mrYes;
if updresp then begin
if GetInetFile(Site,SaveDir+Setupfile) then begin
Close;
Screen.Cursor:=crDefault;
Browser(Handle,SaveDir+Setupfile)
end
else
inform(
151,
'keine Setpdatei gefunden',
'');
end
else
inform(
150,
'nicht heruntergeladen',
'');
end
else
inform(
164,
'keine neuere Version gefunden als ',Version_IDE);
end
else
inform(
152,
'keine Verbindung gefunden',
'');
end;
Screen.Cursor:=crDefault;
end;
//------------------------------------------------------------------
//Function execute Batch command --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExecuteEnd(Sender:TObject);
var
Fn:JString;
i:Integer;
S1,S2:JString;
begin
Opt.R.Execution.Sheet.tabVisible:=
true;
Opt.R.Execution.Sheet.PageControl:=Frame21.PageControl1;
with MyThread
do begin
if (stderr=
'')
and(stdout=
'') then
stdout:=trans(lang,
48,
' Proze� wurde unterbrochen ...');
S1:=oemchars(stdout);
S2:=oemchars(stderr);
Frame31.executor.CreateString(S1,S2);
Fn:=commandstring;
i:=
2;
while (i<length(Fn))
and(Fn[i]<>
'"')
do
i:=i+
1;
Fn:=MidStr(Fn,
2,i-
2);
Fn:=ExtractFileName(Fn);
Frame31.executor.Hint:=trans(lang,
157,
'Ausf�hrung von')+crlf+Fn+crlf+trans
(lang,
158,
'um')+
' '+FormatDateTime(
'hh:mm:ss',Now);
Frame21.PageControl1.ActivePage:=Opt.R.Execution.Sheet;
Terminate();
end;
Execute.ImageIndex:=
31;
Screen.Cursor:=crDefault;
end;
//--------------------------------------------------------------
//licensecheck
//wirkungslos, es sei denn es w�re gehackt worden
//--------------------------------------------------------------
procedure TModelFrame.Honeypot();
begin
if (
not Opt.R.Activated)
and(globtim*
60>maxfilesize) then
exitprocess(
0);
end;
//------------------------------------------------------------------
//Function execute Batch command --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExecuteClick(Sender:TObject);
var
CurExt,ExFile,Parms,Command:JString;
i:Integer;
begin
if (MyThread<>nil)
and(Execute.ImageIndex=
47) then begin
MyThread.Terminate;
sleep(
500);
if not MyThread.Finished then
TerminateThread(MyThread.Handle,
0);
Execute.ImageIndex:=
31;
Screen.Cursor:=crDefault;
end
else begin ;
MyThread:=TMyThread.Create(
true);
Screen.Cursor:=crAppStart;
CurExt:=LowerCase(ExtractFileExt(Frame21.Source.LoadedFile));
if (InSight(Opt.R.Source)
and((CurExt=
'.bat')
or(CurExt=
'.cmd')))
or
(Opt.R.CommandFile>
'') then begin
if Frame21.Source.Modified then
Frame21.Source.Save(
true);
if ((CurExt=
'.bat')
or(CurExt=
'.cmd')) then
ExFile:=Frame21.Source.LoadedFile
else
ExFile:=Opt.R.CommandFile;
//---- parameters -------------------------------
//%1 = file path
//%2 = file name
//%3 = file name
//%4 = path
//-----------------------------------------------
ExFile:=
'"'+ExFile+
'"';
Parms:=
'"'+ExtractFilePath(Opt.R.Infile)+
'"';
Parms:=Parms+
' '+
'"'+ExtractFileName(Opt.R.Infile)+
'"';
for i:=
1 to length(Opt.R.Libraries)
do
if Opt.R.Libraries[i]<>
'' then
Parms:=Parms+
' '+
'"'+Opt.R.Libraries[i]+
'"';
Command:=ExFile+
' '+Parms;
//-----------------------------------------------
//now create and execute
//-----------------------------------------------
MyThread.FreeOnTerminate:=
false;
MyThread.OnTerminate:=ExecuteEnd;
MyThread.Stdin:=crlf+crlf;
MyThread.commandstring:=Command;
Execute.ImageIndex:=
47;
MyThread.Start();
end
end;
end;
//------------------------------------------------------------------
//menu exit --
//--
//------------------------------------------------------------------
procedure TModelFrame.Exit1Click(Sender:TObject);
begin
Close()
end;
//------------------------------------------------------------------
//Copy to Clipbrd
//--
//------------------------------------------------------------------
procedure TModelFrame.KopierenClick(Sender:TObject);
var
MyFormat:Word;
AData:Cardinal;
APalette:HPalette;
begin
if Frame21.Source.focused then begin
Frame21.Source.SaveToUndoBuffer();
Frame21.Source.CopyToClipboard
end
else if Frame21.measures.focused then
Frame21.measures.CopyToClipboard
else if Frame21.Funktion.focused then
Frame21.Funktion.CopyToClipboard
else if Frame21.LastClick=ViewCFA then begin
Frame21.CFA.Picture.SaveToClipBoardFormat(MyFormat,AData,APalette);
Clipboard.SetAsHandle(MyFormat,AData)
end
else if Frame21.LastClick=ViewDFA then begin
Frame21.DFA.Picture.SaveToClipBoardFormat(MyFormat,AData,APalette);
Clipboard.SetAsHandle(MyFormat,AData);
end;
end;
//------------------------------------------------------------------
//Function Select all --
//--
//------------------------------------------------------------------
procedure TModelFrame.Leerzeichen1Click(Sender:TObject);
begin
Opt.R.ShowSpaces:=
not Opt.R.ShowSpaces;
Leerzeichen1.Checked:=Opt.R.ShowSpaces;
Frame21.Source.CreateHighlited(Frame21.Source.LoadedFileNumber);
end;
//------------------------------------------------------------------
//Function Select all --
//--
//------------------------------------------------------------------
procedure TModelFrame.Lizenzerwerben1Click(Sender:TObject);
begin
if netallowed then
Browser(Handle,
'https://cococo.de/Context_IT_GmbH/index.jsp?content=license&detail='+
Application.Title);
end;
//------------------------------------------------------------------
//Function Select all --
//--
//------------------------------------------------------------------
procedure TModelFrame.LizenzzeigenClick(Sender:TObject);
var
Licname:JString;
begin
if lang=german then
Licname:=Opt.R.ProgramDir+
'Lizenz-deutsch.rtf'
else
Licname:=Opt.R.ProgramDir+
'license-english.rtf';
FormattedFile(Licname);
end;
//------------------------------------------------------------------
//Function Select all --
//--
//------------------------------------------------------------------
procedure TModelFrame.FormattedFile(Fn:JString);
begin
setlength(MDI.Source,
1);
setlength(Frame21.Source.Sources,
1);
MDI.Processor:=trans(lang,
160,
'RTF Text');
MDI.Source[
0].Name:=Fn;
MDI.Source[
0].Typ:=RTF;
Frame11.Navigator.items.clear;
Frame11.ScanSources(Frame11.Explorer);
Opt.R.Explorer.Sheet.PageControl.ActivePage:=Opt.R.Explorer.Sheet;
Frame21.Source.Sources[
0]:=MDI.Source[
0].Name;
Frame21.Source.CreateRTFReadOnly(
0);
Frame21.Source.ReadOnly:=
true;
setl(Opt.R.Infile,Fn);
end;
//------------------------------------------------------------------
//Function Select all --
//--
//------------------------------------------------------------------
procedure TModelFrame.Allesauswhlen1Click(Sender:TObject);
begin
if Frame21.Source.focused then
Frame21.Source.SelectAll
else if Frame21.measures.focused then
Frame21.measures.SelectAll
else if Frame21.Funktion.focused then
Frame21.Funktion.SelectAll;
end;
//------------------------------------------------------------------
//Function Cut --
//--
//------------------------------------------------------------------
procedure TModelFrame.Ausschneiden1Click(Sender:TObject);
var
ll,i,lins,P:Integer;
begin
if Frame21.PageControl1.ActivePageIndex=
0 then
with Frame21.Source
do begin
SaveToUndoBuffer();
P:=caretpos.Y;
CutToClipboard;
lins:=
0;
ll:=length(Clipbrd.Clipboard.AsText);
for i:=
0 to ll
do
if Clipbrd.Clipboard.AsText[i]=chr(Key_Return) then
lins:=lins+
1;
PositioningCorrect(P,lins);
DrawBothImages;
end;
end;
//------------------------------------------------------------------
//Paste from Clipbrd --
//--
//------------------------------------------------------------------
procedure TModelFrame.Einfuegen1Click(Sender:TObject);
var
ll,P:Integer;
begin
if InSight(Opt.R.Source) then
with Frame21.Source
do begin
SaveToUndoBuffer();
P:=caretpos.Y;
ll:=length(Clipbrd.Clipboard.AsText);
MaxLength:=MaxLength+ll;
PasteFromClipboard;
PositioningCorrect(P,lines.Count);
Setnavigation();
end;
end;
//------------------------------------------------------------------
//Function Mouse Wheel --
//--
//------------------------------------------------------------------
procedure TModelFrame.FormMouseWheel(Sender:TObject;Shift:TShiftState;
WheelDelta:Integer;MousePos:TPoint;var Handled:Boolean);
begin
if MouseOver(Opt.R.Navigator) then begin
with Frame11.Navigator
do begin
if not topitem.expanded then
TopItem.Expand(
true)
else
TopItem.Collapse(
true)
end;
end
else if MouseOver(Opt.R.Semantik) then begin
with Frame11.semantik
do begin
if not topitem.expanded then
TopItem.Expand(
true)
else
TopItem.Collapse(
true)
end;
end
else if MouseOver(Opt.R.Explorer) then begin
with Frame11.Explorer
do begin
if not topitem.expanded then
TopItem.Expand(
true)
else
TopItem.Collapse(
true)
end;
end
else if MouseOver(Opt.R.CFA) then begin
Frame21.Zoom(MDI.GC,Frame21.CFA,MDI.GC.CStream,WheelDelta,
Frame21.ScrollBox1);
MDI.GC.ReDraw();
with MDI.GC
do
if Selected>
0 then
GraphPositbyNode(Selected,Frame21.CFA);
end
else if MouseOver(Opt.R.DFA) then begin
Frame21.Zoom(MDI.GD,Frame21.DFA,MDI.GD.CStream,WheelDelta,
Frame21.ScrollBox2);
MDI.GD.ReDraw();
with MDI.GC
do
if Selected>
0 then
GraphPositbyNode(Selected,Frame21.DFA);
end
else if MouseOver(Opt.R.Source) then
Frame21.Source.Scroller(WheelDelta)
else if MouseOver(Opt.R.Funktion) then
Frame21.Funktion.Scroller(WheelDelta);
Handled:=
true;
end;
//------------------------------------------------------------------
//Function Explorer Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.ExplorerClick(Sender:TObject);
var
i,P:Integer;
begin
if Frame11.Explorer.items.Count>
0 then begin
P:=-
1;
for i:=
0 to length(MDI.Source)-
1 do
if Frame11.Explorer.Selected.Text=ExtractFileName(MDI.Source[i].Name) then
P:=i;
if (P>=
0)
and(Frame21.Source.LoadedFile<>MDI.Source[P].Name) then begin
Frame11.Explorer.Hint:=
'Explorer'+crlf+MDI.Source[P].Name;
Frame21.PageControl1.Pages[
0].Show;
if MDI.Source[P].Typ=RTF then
Frame21.Source.CreateHighlited(P)
else
Frame21.Source.CreatePlain(P);
end;
end;
end;
//------------------------------------------------------------------
//Function Set Frames --
//--
//------------------------------------------------------------------
procedure TModelFrame.GetFramePointers;
begin
//set Sheet pointers
Opt.R.Navigator.Sheet:=Frame11.PageControl1.Pages[
0];
Opt.R.Semantik.Sheet:=Frame11.PageControl1.Pages[
1];
Opt.R.Explorer.Sheet:=Frame11.PageControl1.Pages[
2];
Opt.R.Source.Sheet:=Frame21.PageControl1.Pages[
0];
Opt.R.CFA.Sheet:=Frame21.PageControl1.Pages[
1];
Opt.R.DFA.Sheet:=Frame21.PageControl1.Pages[
2];
Opt.R.measures.Sheet:=Frame21.PageControl1.Pages[
3];
Opt.R.Funktion.Sheet:=Frame21.PageControl1.Pages[
4];
Opt.R.Miniatur.Sheet:=Frame31.PageControl1.Pages[
0];
Opt.R.Druckvorschau.Sheet:=Frame31.PageControl1.Pages[
1];
Opt.R.Execution.Sheet:=Frame31.PageControl1.Pages[
2];
Opt.R.Inspector.Sheet:=Frame11.PageControl2.Pages[
0];
end;
//------------------------------------------------------------------
//Function Set Frames --
//--
//------------------------------------------------------------------
procedure TModelFrame.DistributeFrames;
begin
//
SetAsParent(Opt.R.Miniatur.Sheet,F3);
SetAsParent(Opt.R.Druckvorschau.Sheet,F3);
SetAsParent(Opt.R.Execution.Sheet,F3);
//
Frame31.MiniaturTab.tabVisible:=
false;
Frame31.DruckvorschauTab.tabVisible:=
false;
Frame31.ExecuteTab.tabVisible:=
false;
if MDI.Source[
0].Typ=PLAIN then begin
Frame11.Hide();
Frame31.Hide();
Simulation1.Hide;
//
SetAsParent(Opt.R.Navigator.Sheet,F1);
SetAsParent(Opt.R.Semantik.Sheet,F1);
SetAsParent(Opt.R.Explorer.Sheet,F1);
//
SetAsParent(Opt.R.Source.Sheet,F2);
SetAsParent(Opt.R.CFA.Sheet,F2);
SetAsParent(Opt.R.DFA.Sheet,F2);
//
SetAsParent(Opt.R.measures.Sheet,F3);
SetAsParent(Opt.R.Funktion.Sheet,F3);
//Assign Indices
SetActivePage(F2,ViewSource);
end
else if MDI.ReturnValue<=
1 then begin
Frame11.Show();
Frame21.Show();
Frame31.Show();
//Assign Parent Tabsheets
SetAsParent(Opt.R.Navigator.Sheet,F1);
SetAsParent(Opt.R.Semantik.Sheet,F1);
SetAsParent(Opt.R.Explorer.Sheet,F1);
//
SetAsParent(Opt.R.Source.Sheet,F2);
SetAsParent(Opt.R.CFA.Sheet,F2);
SetAsParent(Opt.R.DFA.Sheet,F2);
//
SetAsParent(Opt.R.Funktion.Sheet,F3);
SetAsParent(Opt.R.measures.Sheet,F3);
//
SetActivePage(F1,ViewNav);
SetActivePage(F2,ViewSource);
SetActivePage(F3,ViewFunktion);
//
if Opt.R.Edition>Standard then
Simulation1.Show;
end
else begin
Frame11.Show();
Frame21.Show();
Frame31.Hide();
//Assign Parent Tabsheets
SetAsParent(Opt.R.Navigator.Sheet,F1);
SetAsParent(Opt.R.Explorer.Sheet,F1);
SetAsParent(Opt.R.Source.Sheet,F2);
//
SetActivePage(F1,ViewNav);
SetActivePage(F2,ViewSource);
SetActivePage(F3,ViewFunktion);
//
Simulation1.Hide;
end;
if Frame11.width>
0 then
SplitterVertical.left:=Frame11.width;
end;
//--------------------------------------------------------------
//licensecheck
//wirkungslos, es sei denn es w�re gehackt worden
//--------------------------------------------------------------
procedure TModelFrame.Realcheck();
begin
if (
not Opt.R.Activated)
and(globtim*
60>maxfilesize) then
Close();
end;
//------------------------------------------------------------------
//Function Split Frame --
//
//------------------------------------------------------------------
procedure TModelFrame.SplitFrames(Sender:TObject);
var
TS:TTabSheet;
begin
SplitterVertical.left:=Opt.R.Frame1Width;
if not Frame31.Visible
and(PageCount(Frame21.PageControl1)>
1) then begin
//undo split
Frame31.Visible:=
true;
TS:=Frame21.PageControl1.ActivePage;
TS.PageControl:=Frame31.PageControl1;
with MDI.GC
do begin
VWidth:=
0;
VHeight:=
0;
end;
with MDI.GD
do begin
VWidth:=
0;
VHeight:=
0;
end;
DrawBothImages;
end
else begin
if (PageCount(Frame31.PageControl1)>
0) then
Frame31.Hide()
else begin
Frame31.Hide();
DrawBothImages();
end;
end;
end;
//------------------------------------------------------------------
//Function Frame 1 Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.PageControlChange(Sender:TObject);
begin
//special for Frame2
if (Sender as TPageControl)=Frame21.PageControl1 then begin
if (Frame21.PageControl1.ActivePage=Opt.R.Navigator.Sheet)
or
(Frame31.PageControl1.ActivePage=Opt.R.Navigator.Sheet) then
if InSight(Opt.R.Source) then
Frame21.Source.PositEditor();
if (Frame21.PageControl1.ActivePage=Opt.R.Funktion.Sheet)
or
(Frame31.PageControl1.ActivePage=Opt.R.Funktion.Sheet) then
if InSight(Opt.R.Funktion) then
Frame21.Funktion.PositEditor();
end;
SaveView();
Lizenz1.checklicense();
end;
//------------------------------------------------------------------
//Function Frame 1 Double Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.MaxFrame1(Sender:TObject);
begin
if Not Opt.R.Frame1Page1Max then begin
//maximize Frame11
Frame11.width:=width;
Frame11.height:=height;
Frame21.width:=
0;
Frame31.Visible:=
false;
Opt.R.Frame1Page1Max:=
true;
end
else begin
Opt.R.Frame1Page1Max:=
false;
Frame11.width:=Opt.R.Frame1Width;
Frame21.width:=width-Opt.R.Frame1Width-SplitterVertical.width;
Frame31.Visible:=
true;
end;
end;
//------------------------------------------------------------------
//Function Frame 2 Dbl Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.MaxFrame2(Sender:TObject);
begin
if Not Opt.R.Frame2Page1Max then begin
//maximize Frame11
Frame21.height:=height;
Frame11.width:=
0;
Frame11.Inspector.Hide;
Frame31.Hide();
if Opt.R.Druckvorschau.Sheet.tabVisible then begin
Frame31.setPreviewFull();
end;
Opt.R.Frame2Page1Max:=
true;
end
else begin
Opt.R.Frame2Page1Max:=
false;
Frame11.width:=Opt.R.Frame1Width;
Frame11.Inspector.Show;
Frame21.width:=width-Opt.R.Frame1Width-SplitterVertical.width;
Frame31.Show();
end;
end;
//------------------------------------------------------------------
//Function Frame 3 Dbl Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.MaxFrame3(Sender:TObject);
begin
if Not Opt.R.Frame3Page1Max then begin
//maximize Frame31
Frame11.Hide;
Frame21.Hide;
Frame31.height:=Frame21.height+Frame31.height;
Frame31.Align:=alClient;
Opt.R.Frame3Page1Max:=
true;
end
else begin
Opt.R.Frame3Page1Max:=
false;
Frame31.Align:=alBottom;
Frame11.Show;
Frame21.Show;
Frame31.Visible:=
true;
end;
end;
//------------------------------------------------------------------
//Set ShortCuts --
//--
//------------------------------------------------------------------
procedure TModelFrame.SetShortcuts;
begin
Vollbild1.ShortCut:=ShortCut(Key_escape,[]);
Hilfe2.ShortCut:=ShortCut(Opt.R.FuncHelp,[]);
Suchen1.ShortCut:=ShortCut(Opt.R.FuncSearch,[]);
Ersetzen1.ShortCut:=ShortCut(Opt.R.FuncReplace,[]);
Ersetzenwiederholt1.ShortCut:=ShortCut(Opt.R.FuncContReplace,[]);
end;
//------------------------------------------------------------------
//Function Optionen --
//--
//------------------------------------------------------------------
procedure TModelFrame.Optionen1Click(Sender:TObject);
var
SF:SourceFormats;
L1,L2,L3:String;
Syn,Bol,Dr,oldWrap,OldURL:Boolean;
Lt:Integer;
begin
with Opt
do begin
PageControl1.ActivePageIndex:=
0;
Caption:=Application.Title+
' '+Version_IDE;
Top:=Top;
left:=left;
width:=width;
height:=height;
//save current values
SF:=Opt.R.Sourceformat;
L1:=Opt.R.Libraries[
1];
L2:=Opt.R.Libraries[
2];
L3:=Opt.R.Libraries[
3];
Syn:=Opt.R.SyntaxHighlight;
Bol:=Opt.R.SyntaxBold;
Lt:=Opt.R.LineThickness;
Dr:=Opt.R.Drawgrid;
oldWrap:=Opt.R.wordwrap;
OldURL:=Opt.R.ShowURL;
Indentchars.Text:=inttostr(Opt.R.Indentchars);
//
ShowModal;
if okpressed then begin
SetShortcuts();
SetEditorOptions();
if (SF<>Opt.R.Sourceformat)
or(L1<>Opt.R.Libraries[
1])
or
(L2<>Opt.R.Libraries[
2])
or(L3<>Opt.R.Libraries[
3])
or
(oldWrap<>Opt.R.wordwrap)
or(OldURL<>Opt.R.ShowURL) then
ProcessFile(Opt.R.Infile,
'')
else begin
if (Syn<>Opt.R.SyntaxHighlight)
or(Bol<>Opt.R.SyntaxBold) then
Frame21.CreateSource(
0,SplashForm1);
if (Opt.R.LineThickness<>Lt)
or(Opt.R.Drawgrid<>Dr) then
DrawBothImages();
end;
end;
end;
end;
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
procedure TModelFrame.PDFButtonClick(Sender:TObject);
begin
Frame31.PDFButtonClick(Sender);
end;
//------------------------------------------------------------------
//Function Drag and Drop --
//--
//------------------------------------------------------------------
procedure TModelFrame.PageControlDragDrop(Sender,Source:TObject;X,Y:Integer);
var
PP:Integer;
PC,Org:TPageControl;
sh:TTabSheet;
begin
if Source is TPageControl then begin
PC:=(Sender as TPageControl);
Org:=(Source as TPageControl);
PC.EndDrag(
true);
Org.EndDrag(
true);
sh:=Org.ActivePage;
sh.PageControl:=PC;
PC.ActivePage:=sh;
PC.ActivePage:=sh;
PP:=PageCount(sh.PageControl);
if (PP=
0)
and(Org=Frame31.PageControl1) then
Frame31.Hide();
LastMousePos.X:=
0;
LastMousePos.Y:=
0;
if (sh=Opt.R.CFA.Sheet) then
MDI.GC.ReDraw()
else if (sh=Opt.R.DFA.Sheet) then
MDI.GD.ReDraw();
//redraw
DrawBothImages();
Speichern.enabled:=Frame21.Source.Modified;
end;
end;
//------------------------------------------------------------------
//Function Drag Over --
//--
//------------------------------------------------------------------
procedure TModelFrame.PageControlDragOver(Sender,Source:TObject;X,Y:Integer;
State:TDragState;var Accept:Boolean);
var
PC:TPageControl;
begin
Accept:=(Source is TPageControl);
if Accept then begin
PC:=(Source as TPageControl);
Accept:=(PageCount(PC)>
1);
end;
end;
//------------------------------------------------------------------
//Function Deafult Settings --
//--
//------------------------------------------------------------------
procedure TModelFrame.Simulation1Click(Sender:TObject);
begin
if InSight(Opt.R.CFA) then
with MDI.GC
do
GraphSimulateRepeated()
else if InSight(Opt.R.DFA) then
with MDI.GD
do
GraphSimulateRepeated()
end;
//------------------------------------------------------------------
//Function Frame 1 Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.NavigatorChange(Sender:TObject;Node:TTreeNode);
begin
if not(processing
or Opening) then begin
UpDateInspector(MDI.NavL,Frame11.Navigator.Selected);
setFrameStatus(Sender);
end;
end;
//------------------------------------------------------------------
//Function SplitterMoved --
//--
//------------------------------------------------------------------
procedure TModelFrame.SplitterVerticalMoved(Sender:TObject);
begin
if Opt.R.CFA.Frame in [F1,F2] then
with MDI.GC
do begin
VWidth:=
0;
VHeight:=
0;
end;
if Opt.R.DFA.Frame in [F1,F2] then
with MDI.GD
do begin
VWidth:=
0;
VHeight:=
0;
end;
if (Frame11.width<(
10*width)div
100) then begin
Frame11.width:=(
33*width)div
100;
SplitterVertical.left:=Frame11.width;
end;
Opt.R.Frame1Width:=Frame11.width;
Horizontalratio:=(
100*SplitterVertical.left)div width;
Verticalratio:=(
100*SplitterHorizontal.Top)div height;
DrawBothImages();
end;
//------------------------------------------------------------------
//resize --
//--
//------------------------------------------------------------------
procedure TModelFrame.FormResize(Sender:TObject);
const
tol=
20;
begin
if not(Opening
or Closing) then begin
Screen.Cursor:=crHourGlass;
if Frame11.width<(
10*width)div
100 then begin
Frame11.width:=(
33*width)div
100;
SplitterVertical.left:=Frame11.width;
end
else begin
Frame11.width:=(Horizontalratio*width)div
100;
SplitterVertical.left:=Frame11.width;
Frame11.height:=(Verticalratio*height)div
100;
SplitterHorizontal.Top:=Frame11.height;
end;
with MDI.GC do begin
VWidth:=
0;
VHeight:=
0;
end;
with MDI.GD do begin
VWidth:=
0;
VHeight:=
0;
end;
DrawBothImages;
if Frame31.height>
0 then
Opt.R.Frame3Height:=Frame31.height;
Horizontalratio:=(
100*SplitterVertical.left)div width;
Verticalratio:=(
100*SplitterHorizontal.Top)div height;
setFrame11Ratio();
Opt.R.ismax:=(abs(width-Screen.width)*abs(height-Screen.height)<tol*tol);
if InSight(Opt.R.Druckvorschau)and Opt.R.ismax then begin
Frame31.setPreviewFull();
end;
Frame11.Realign;
Screen.Cursor:=crDefault;
end;
end;//------------------------------------------------------------------
//Function Splitter Moved --
//--
//------------------------------------------------------------------
procedure TModelFrame.SplitterHorizontalMoved(Sender:TObject);
begin
if Opt.R.CFA.Frame<>Opt.R.DFA.Frame then begin
with MDI.GC do begin
VWidth:=
0;
VHeight:=
0;
end;
with MDI.GC do begin
VWidth:=
0;
VHeight:=
0;
end;
end
else if Opt.R.CFA.Frame=F3 then
with MDI.GC do begin
VWidth:=
0;
VHeight:=
0;
end
else if Opt.R.DFA.Frame=F3 then
with MDI.GD do begin
VWidth:=
0;
VHeight:=
0;
end;
if Frame31.height<(
10*height)div
100 then begin
//correct height
Frame31.height:=(
33*height)div
100;
SplitterHorizontal.Top:=height-Frame31.height;
end;
if Frame31.height>
0 then
Opt.R.Frame3Height:=Frame31.height;
Horizontalratio:=(
100*SplitterVertical.left)div width;
Verticalratio:=(
100*SplitterHorizontal.Top)div height;
setFrame11Ratio();
DrawBothImages;
end;
//------------------------------------------------------------------
//Sprache clicked --
//--
//------------------------------------------------------------------
procedure TModelFrame.Sprache1Click(Sender:TObject);
begin
if Opt.R.Language=english then
Opt.R.Language:=german
else if Opt.R.Language=german then
Opt.R.Language:=english;
if Opt.R.Language=english then
SwitchtoEnglish();
inform(
49,'Bitte neu starten','');
end;
//------------------------------------------------------------------
//Function Splitter Moved --
//--
//------------------------------------------------------------------
procedure TModelFrame.checkedition();
begin
if Opt.R.Edition<=Standard then
with Opt do begin
//ComboBox2.ItemIndex:=
1;
//ComboBox2.Enabled:=false;
ComboBox8.enabled:=false;
ComboBox7.enabled:=false;
Opt.R.ExportEnabled:=false;
end
else begin
Opt.R.ExportEnabled:=false;
end;
if Opt.R.Edition=Standard then begin
if Simulation1<>nil then
Simulation1.Hide;
if Simulation<>nil then begin
Simulation.Visible:=false;
end;
if Blocknummern<>nil then
Blocknummern.enabled:=false;
Importieren1.enabled:=false;
Exportieren1.enabled:=false;
end;
end;
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
procedure TModelFrame.ShowIDE();
var
i:Integer;
procedure tofront(PC:TPageControl);
begin
with PC do begin
i:=
0;
while i<=PageCount-
1 do begin
if Pages[i].tabVisible then begin
ActivePage:=Pages[i];
i:=PageCount
end;
i:=i+
1;
end;
end;
end;
begin
//--------------------------------------------
//revert presentation characters
//--------------------------------------------
if Previewselected or Presentationdone then begin
Frame21.Source.LoadFromUndoBuffer;
if Presentationdone then
Frame21.CreateSource(Frame21.Source.LoadedFileNumber,SplashForm1);
Frame21.Source.Mark();
Previewselected:=false;
Presentationdone:=false;
end;
//
DistributeFrames();
//
ToolBar1.Show();
ToolBar2.Hide();
ToolBar1.Align:=alClient;
ToolBar2.Align:=alLeft;
Drucken1.Visible:=false;
Druckvorschau.Visible:=true;
Edit1.enabled:=true;
Navigation1.enabled:=true;
Font2.enabled:=true;
Farben.enabled:=true;
Syntaxhervorhebung1.enabled:=true;
Zeilennummern1.enabled:=true;
Dateityp1.enabled:=true;
Sprache1.enabled:=true;
Druckvorschau.enabled:=true;
Optionen1.enabled:=true;
Speichere.enabled:=true;
Speichernunter.enabled:=true;
NeueVersion1.enabled:=true;
Feedback1.enabled:=true;
//another check
guesstime(MDI.filelength,false);
Honeypot();
//
SetAsParent(Opt.R.Miniatur.Sheet,F3);
SetAsParent(Opt.R.Druckvorschau.Sheet,F3);
Opt.R.Miniatur.Sheet.tabVisible:=false;
Opt.R.Miniatur.Sheet.tabVisible:=false;
//
with Frame11 do begin
NavigatorTab.tabVisible:=Navigator.items.Count>
1;
SemantikTab.tabVisible:=MDI.CSem<>nil;
ExplorerTab.tabVisible:=length(MDI.Source)>
1;
PageControl1.ActivePage:=Frame11.NavigatorTab;
ExplorerTab.tabVisible:=Explorer.items.Count>
1;
if Application.Title=Title_Elbe then begin
SemantikTab.tabVisible:=false;
ExplorerTab.tabVisible:=false;
end;
tofront(PageControl1);
if PageCount(PageControl1)=
0 then
Hide();
end;
//
with Frame21 do begin
SourceTab.tabVisible:=true;
CfaTab.tabVisible:=MDI.GC.CStream<>nil;
DfaTab.tabVisible:=MDI.GD.CStream<>nil;
MeasureTab.tabVisible:=MDI.CMes<>nil;
FunktionTab.tabVisible:=MDI.CFun<>nil;
PageControl1.ActivePage:=Frame21.SourceTab;
if Application.Title=Title_Elbe then begin
CfaTab.tabVisible:=false;
DfaTab.tabVisible:=false;
FunktionTab.tabVisible:=false;
end;
tofront(PageControl1);
end;
//
with Frame31 do begin
Show();
MiniaturTab.tabVisible:=false;
DruckvorschauTab.tabVisible:=false;
ExecuteTab.tabVisible:=false;
PageControl1.ActivePage:=Frame31.PageControl1.Pages[
0];
tofront(PageControl1);
end;
//
Speichern.enabled:=Frame21.Source.Modified;
Oeffnen.enabled:=true;
Template.enabled:=true;
ProvideExecutable();
//
if Opt.R.Frame1Width>
0 then
SplitterVertical.left:=Opt.R.Frame1Width;
//
setFrame3Ratio();
setFrame11Ratio();
setFrameStatus(nil);
//
if (Previousfile<>string(Opt.R.Infile)) then
LoadfromHistory(Opt.R.Infile)
else begin
DisplayHistory();
Frame21.Source.SelStart:=Previousselstart;
end;
//
checkedition();
//
if InSight(Opt.R.Source) then
Frame21.Source.SetFocus;
end;
//------------------------------------------------------------------
//Drucken --
//--
//------------------------------------------------------------------
procedure TModelFrame.ShowPreview();
var
i:Integer;
procedure hsh(TS:TTabSheet);
begin
if (TS<>Opt.R.Miniatur.Sheet)and(TS<>Opt.R.Druckvorschau.Sheet) then
TS.tabVisible:=false;
end;
begin
//
ToolBar1.Hide();
ToolBar2.Show();
ToolBar1.Align:=alLeft;
ToolBar2.Align:=alClient;
Drucken1.Visible:=true;
Druckvorschau.Visible:=false;
Edit1.enabled:=false;
Navigation1.enabled:=false;
Font2.enabled:=false;
Farben.enabled:=false;
Syntaxhervorhebung1.enabled:=false;
Zeilennummern1.enabled:=false;
Dateityp1.enabled:=false;
Sprache1.enabled:=false;
Druckvorschau.enabled:=false;
Optionen1.enabled:=false;
Speichere.enabled:=false;
Speichernunter.enabled:=false;
NeueVersion1.enabled:=false;
Feedback1.enabled:=false;
//
Honeypot();
//
Frame11.Show();
Frame21.Show();
Frame31.Hide();
//
for i:=
0 to Frame11.PageControl1.PageCount-
1 do
hsh(Frame11.PageControl1.Pages[i]);
for i:=
0 to Frame21.PageControl1.PageCount-
1 do
hsh(Frame21.PageControl1.Pages[i]);
for i:=
0 to Frame31.PageControl1.PageCount-
1 do
hsh(Frame31.PageControl1.Pages[i]);
//
SplitterHorizontal.Hide();
//
Frame11.Inspector.height:=
0;
Frame31.height:=
0;
//
SetAsParent(Opt.R.Miniatur.Sheet,F1);
SetAsParent(Opt.R.Druckvorschau.Sheet,F2);
//
Frame11.PageControl1.ActivePage:=Frame31.MiniaturTab;
Frame21.PageControl1.ActivePage:=Frame31.DruckvorschauTab;
//
Opt.R.Miniatur.Sheet.tabVisible:=true;
Opt.R.Druckvorschau.Sheet.tabVisible:=true;
//
with Frame31 do begin
ThumbnailPreview1.Hint:=trans(lang,
229,'Miniaturen');
Pagenavigator.Hint:=trans(lang,
230,'Seitennavigation');
PrintPreview1.Hint:=trans(lang,
231,'Vorschau');
end;
end;
//------------------------------------------------------------------
//decide upon Inspector height --
//--
//------------------------------------------------------------------
procedure TModelFrame.setFrame11Ratio();
begin
if Inspector1.Checked and(Application.Title=Title_Columbo) then begin
Frame11.SplitterInspector.Show();
Frame11.Inspector.Show();
if (Opt.R.InspectorHeight=
0)or
(Opt.R.InspectorHeight>(
2*Frame11.PageControl1.height)div
3)
then
Opt.R.InspectorHeight:=Frame11.height div
3;
Opt.R.InspectorHeight:=Frame11.height div
3;
UpDateInspector(MDI.NavL,Frame11.Navigator.Selected);
Frame11.PageControl1.height:=Frame11.height-Opt.R.InspectorHeight-
20-
15;
end
else begin
Frame11.SplitterInspector.Hide();
Opt.R.InspectorHeight:=Frame11.Inspector.height;
Frame11.Inspector.height:=
0;
Frame11.PageControl1.height:=Frame11.height-
20;
end;
end;
//------------------------------------------------------------------
//Drucken --
//--
//------------------------------------------------------------------
procedure TModelFrame.setFrame3Ratio();
begin
if PageCount(Frame31.PageControl1)>
0 then begin
Frame31.Show();
SplitterHorizontal.Show();
if Opt.R.Frame3Height<
10 then
Opt.R.Frame3Height:=height div
3;
Frame31.height:=Opt.R.Frame3Height;
end
else begin
Frame31.Hide();
SplitterHorizontal.Hide();
Frame31.height:=
0;
end;
end;
//------------------------------------------------------------------
//Drucken --
//--
//------------------------------------------------------------------
procedure TModelFrame.DruckvorschauClick(Sender:TObject);
function isfrom():ViewData;
begin
result:=Opt.R.Source;
if (Sender=drucken2) then begin
if InSight(Opt.R.Navigator) then
result:=Opt.R.Navigator
else if InSight(Opt.R.Semantik) then
result:=Opt.R.Semantik
else if InSight(Opt.R.Explorer) then
result:=Opt.R.Explorer
end
else if (Sender=drucken11) then begin
if InSight(Opt.R.CFA) then
result:=Opt.R.CFA
else if InSight(Opt.R.DFA) then
result:=Opt.R.DFA
end
else if (Sender=drucken3) then begin
if InSight(Opt.R.Source) then
result:=Opt.R.Source
else if InSight(Opt.R.Funktion) then
result:=Opt.R.Funktion
else if InSight(Opt.R.Execution) then
result:=Opt.R.Execution
end
else if (Sender=drucken4) then begin
if InSight(Opt.R.Funktion) then
result:=Opt.R.Funktion
else if InSight(Opt.R.measures) then
result:=Opt.R.measures
end
else if (Sender=drucken5) then begin
result:=Opt.R.Inspector
end
else if (Sender=Frame21.Source) then
result:=Opt.R.Source
else if (Sender=Frame31.executor) then
result:=Opt.R.Execution
else if (Sender=Frame21.Funktion) then
result:=Opt.R.Funktion
else if (Sender=Frame21.CFA) then
result:=Opt.R.CFA
else if (Sender=Frame21.DFA) then
result:=Opt.R.DFA
else if (Sender=Frame11.Navigator) then
result:=Opt.R.Navigator
else if (Sender=Frame11.Semantik) then
result:=Opt.R.Semantik
else if (Sender=Frame11.Explorer) then
result:=Opt.R.Explorer
else if InSight(Opt.R.Source) then
result:=Opt.R.Source
else if InSight(Opt.R.Execution) then
result:=Opt.R.Execution
else if InSight(Opt.R.Funktion) then
result:=Opt.R.Funktion
else if InSight(Opt.R.CFA) then
result:=Opt.R.CFA
else if InSight(Opt.R.DFA) then
result:=Opt.R.DFA
else if InSight(Opt.R.Navigator) then
result:=Opt.R.Navigator
else if InSight(Opt.R.Semantik) then
result:=Opt.R.Semantik
else if InSight(Opt.R.Explorer) then
result:=Opt.R.Explorer
else
result:=Opt.R.Source
end;
var
Orient:TPrinterOrientation;
RE:TRichEdit;
Img:TImage;
fa:Boolean;
Pty:PrintTypes;
vs:ViewData;
begin
if not InSight(Opt.R.Druckvorschau) then begin
//
Previewselected:=false;
if not MDI.Previewrepresentation and(length(Frame21.Source.SelText)>
120)
then begin
if ask(
232,'Nur den markierten Bereich ansehen/drucken?','')=mrYes then
begin
Previewselected:=true;
Frame21.Source.SaveToUndoBuffer;
Frame21.Source.CopyToClipboard;
Frame21.Source.lines.clear;
Frame21.Source.Refresh;
Frame21.Source.PasteFromClipboard;
end;
end;
//create pages
Pty:=Richtext;
RE:=Frame21.Source;
Img:=nil;
Sourcestate:=Frame21.Source.ReadOnly;
Frame21.Source.ReadOnly:=true;
vs:=isfrom();
if vs.Sheet=Opt.R.Source.Sheet then begin
Pty:=Richtext;
if MDI.Previewrepresentation then begin
Frame21.Source.hasRepresentation:=true;
Frame21.CreateSource(Frame21.Source.LoadedFileNumber,SplashForm1);
Frame21.Source.hasRepresentation:=false;
Presentationdone:=true;
end;
RE:=Frame21.Source;
end
else if vs.Sheet=Opt.R.Execution.Sheet then begin
Pty:=Richtext;
RE:=Frame31.executor;
end
else if vs.Sheet=Opt.R.CFA.Sheet then begin
Pty:=Imageview;
Img:=Frame21.CFA;
end
else if vs.Sheet=Opt.R.DFA.Sheet then begin
Pty:=Imageview;
Img:=Frame21.DFA;
end
else if vs.Sheet=Opt.R.measures.Sheet then begin
Pty:=Richtext;
RE:=Frame21.measures;
end
else if vs.Sheet=Opt.R.Navigator.Sheet then begin
Pty:=Richtext;
RE:=Frame31.executor;
Frame31.PrintTree(RE,Frame11.Navigator);
end
else if vs.Sheet=Opt.R.Semantik.Sheet then begin
Pty:=Richtext;
RE:=Frame31.executor;
Frame31.PrintTree(RE,Frame11.Semantik);
end
else if vs.Sheet=Opt.R.Explorer.Sheet then begin
Pty:=Richtext;
RE:=Frame31.executor;
Frame31.PrintTree(RE,Frame11.Explorer);
end
else if vs.Sheet=Opt.R.Funktion.Sheet then begin
Pty:=Richtext;
RE:=Frame21.Funktion;
end
else if vs.Sheet=Opt.R.Inspector.Sheet then begin
Pty:=Richtext;
RE:=Frame31.executor;
Frame11.PrintInspector(RE);
end;
//show them
ShowPreview();
if InSight(Opt.R.CFA) then
with MDI.GC do
Orient:=GraphOrientation()
else if InSight(Opt.R.DFA) then
with MDI.GD do
Orient:=GraphOrientation()
else
Orient:=Printer.Orientation;
Frame31.DruckenClick(Pty,RE,Img,Frame21.Source.LoadedFile);
//this does not fully work in dsPDF:
if Frame31.PrintPreview1.Orientation<>Orient then begin
if Orient=poLandscape then
Frame31.QuerformatClick(nil)
else
Frame31.HochformatClick(nil);
end;
//
fa:=Inspector1.Checked;
Inspector1.Checked:=false;
setFrame11Ratio();
Inspector1.Checked:=fa;
//
Frame11.PageControl1.ActivePage:=Opt.R.Miniatur.Sheet;
Frame21.PageControl1.ActivePage:=Opt.R.Druckvorschau.Sheet;
//
setFrameStatus(Sender);
end
else begin
Frame21.Source.ReadOnly:=Sourcestate;
ShowIDE();
end;
end;
//------------------------------------------------------------------
//Function Frame
1 Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.SemantikChange(Sender:TObject;Node:TTreeNode);
begin
UpDateInspector(MDI.SEML,Frame11.Semantik.Selected);
setFrameStatus(Sender);
end;
//------------------------------------------------------------------
//Function Inspector DoubleClick --
//--
//------------------------------------------------------------------
procedure TModelFrame.Frame11InspectorClick(Sender:TObject);
begin
Frame21.positbyNode(Inspectorkey,nil);
end;
//------------------------------------------------------------------
//Function Explorer Change --
//--
//------------------------------------------------------------------
procedure TModelFrame.Frame11ExplorerChange(Sender:TObject;Node:TTreeNode);
begin
setFrameStatus(Sender);
end;
//------------------------------------------------------------------
//Function Search Inspector --
//--
//------------------------------------------------------------------
procedure TModelFrame.Frame11InspectorKeyUp(Sender:TObject;var Key:Word;
Shift:TShiftState);
var
St:JString;
begin
St:=getpar(S_Lab,Inspectorkey);
if St<>'' then begin
with Frame21.Source do
initSearchReplace(St,'',false,FuncSearch);
if (Key=Opt.R.FuncHelp) then
Hilfe2Click(Sender)
else if InSight(Opt.R.Source) then begin
if Key=Opt.R.FuncReplace then
Ersetzen1Click(Sender);
Speichern.enabled:=Frame21.Source.Modified;
end
end;
end;
//------------------------------------------------------------------
//Check dragging --
//--
//------------------------------------------------------------------
procedure TModelFrame.PageControlMouseMove(Sender:TObject;Shift:TShiftState;
X,Y:Integer);
var
TP:TPageControl;
begin
if Sender<>nil then begin
TP:=(Sender as TPageControl);
if ssleft in Shift then
TP.BeginDrag(false,
10);
end;
end;
//------------------------------------------------------------------
//Function Frame
1 Click --
//--
//------------------------------------------------------------------
procedure TModelFrame.Frame11SemantikEnter(Sender:TObject);
begin
if Frame11.Semantik.Selected<>nil then
Frame11.Semantik.Hint:=HintBox(Frame11.Semantik.Selected.Text);
end;
//------------------------------------------------------------------
//--
//Mouse down in Source --
//--
//------------------------------------------------------------------
procedure TModelFrame.Frame11SplitterInspectorMoved(Sender:TObject);
begin
Opt.R.InspectorHeight:=Frame11.Inspector.height
end;
//------------------------------------------------------------------
//--
//Mouse down in Source --
//--
//------------------------------------------------------------------
procedure TModelFrame.SourceMouseDown(Sender:TObject;Button:TMouseButton;
Shift:TShiftState;X,Y:Integer);
var
se:TEde;
Rect:TPoint;
begin
se:=(Sender as TEde);
Frame21.TokenBox.Visible:=false;
Rect.X:=se.caretpos.X+
1;
Rect.Y:=se.caretpos.Y+
1;
Rect:=Frame21.Source.getPosMod(Rect);
//braucht viel Zeit
//Frame21.Source.Bracketing();
Speichern.enabled:=Frame21.Source.Modified;
SaveView();
Frame11.positbyPoint(Rect,MDI.fnr);
setFrameStatus(nil);
end;
//------------------------------------------------------------------
//--
//double click, try to find file --
//--
//------------------------------------------------------------------
procedure TModelFrame.SourceDblClick(Sender:TObject);
var
Fil,Word,fdir:JString;
procedure walkfile();
begin
SavetoSourcestack();
ProcessFile(Fil,'')
end;
begin
Frame21.Source.getCurrentWord();
Word:=Frame21.Source.CurrentWord;
fdir:=ExtractFilePath(Frame21.Source.LoadedFile);
Fil:=fdir+Word;
if FileExists(Fil) then
walkfile()
else if Opt.R.Libraries[
1]>'' then begin
Fil:=Opt.R.Libraries[
1]+Word;
if FileExists(Fil) then
walkfile()
else if Opt.R.Libraries[
2]>'' then begin
Fil:=Opt.R.Libraries[
2]+Word;
if FileExists(Fil) then
walkfile()
else if Opt.R.Libraries[
2]>'' then begin
Fil:=Opt.R.Libraries[
2]+Word;
if FileExists(Fil) then
walkfile()
end;
end;
end;
end;
//------------------------------------------------------------------
//--
//Mouse down in FullScreen --
//--
//------------------------------------------------------------------
procedure TModelFrame.FullscreenMouseDown(Sender:TObject;Button:TMouseButton;
Shift:TShiftState;X,Y:Integer);
begin
Vollbild1Click(Sender);
end;
//------------------------------------------------------------------
//Function FunktionMouseUp --
//--
//------------------------------------------------------------------
procedure TModelFrame.Frame21FunktionMouseUp(Sender:TObject;Button:TMouseButton;
Shift:TShiftState;X,Y:Integer);
var
Lin,Col,ll:Integer;
Str,Fn,LN:JString;
P:TPoint;
begin
With Frame21 do begin
SaveView();
Frame21.LastClick:=ViewFunktion;
//Key:=Frame21.FunktionMouseUp(Sender,Button,Shift,X,Y);
Lin:=Funktion.Perform(EM_LINEFROMCHAR,Funktion.SelStart,
0)+
1;
ll:=length(Source.lines.Text);
if Source.SelStart+
5<=ll then
Str:=MidStr(Source.lines.Text,Source.SelStart-
1,
5)
else
Str:='Undef';
Fn:=inttostr(Source.getFileNumber(Source.LoadedFile));
Col:=Funktion.caretpos.X+
1;
Funktion.Bracketing();
//find linenumber
Source.Hint:=HintBox(trans(lang,
21,'Zeile=')+inttostr(Lin)+crlf+trans(lang,
22,' Spalte=')+inttostr(Col));
LN:=memtreelong(Solution,Lin,Col);
if (Funktion.SelLength>
0)and(Funktion.SelLength<=KeyMax) then
with Frame21.Source do
initSearchReplace(MidStr(Funktion.Text,Funktion.SelStart+
1,
Funktion.SelLength),'',false,FuncSearch);
//
if LN<>'' then begin
if Opt.R.Funktion.Frame in [F2,F3] then
Frame11.positbyNode(LN,Frame21.Funktion);
if Opt.R.Funktion.Frame in [F1] then
Frame21.positbyNode(LN,Frame21.Funktion);
if Opt.R.Funktion.Frame<>Opt.R.Source.Frame then begin
P:=getPointfromNode(LN);
Source.markLinepos(P.Y,P.X);
end;
Frame21.Funktion.Hint:=HintBox(LN);
end;
end;
end;
//------------------------------------------------------------------//
//Thread Communicator //
//soll auf Statuszeile die Phase:Zeile anzeigen //
//------------------------------------------------------------------//
Procedure TModelFrame.DllWatcher(St:Boolean);
var
TH:TStatusThread;
begin
if St then begin
TH:=TStatusThread.Create(true);
LastThread:=TH;
TH.OnTerminate:=nil;
TH.Stp:=false;
TH.Tx:=@Frame21.statusbar1;
TH.Px:=@CStatus;
TH.Priority:=tpLower;
TH.Start;
//
1. resume = beginn, sonst = weitermachen
end//stoppen mit suspend oder terminate
else begin
TH:=LastThread;
TH.Stp:=true;
//TH.Suspend;
TH.Terminate;
sleep(
200);//wait for suspend
end
end;
//------------------------------------------------------------------//
//Thread Communicator //
//soll auf Statuszeile die Phase:Zeile anzeigen //
//------------------------------------------------------------------//
Procedure TModelFrame.SwitchtoEnglish();
begin
//------------------------------------------------------------------//
//menu
//------------------------------------------------------------------//
File1.Caption:='File';
Neu1.Caption:='New';
Oeffne.Caption:='Open';
Speichere.Caption:='Save';
Speichernunter.Caption:='Save as';
Importieren1.Caption:='Import';
Exportieren1.Caption:='Export';
Drucken1.Caption:='Print';
Druckvorschau.Caption:='Printpreview';
Exit1.Caption:='Exit';
//
Edit1.Caption:='Edit';
Undo.Caption:='Undo';
Ausschneiden1.Caption:='Cut';
Kopieren.Caption:='Copy';
Einfuegen1.Caption:='Paste';
Allesauswhlen1.Caption:='Select all';
Suchen1.Caption:='Search';
Ersetzen1.Caption:='Replace';
Ersetzenwiederholt1.Caption:='Replace again';
//
View1.Caption:='View';
Inspector1.Caption:='Inspector';
Split1.Caption:='Split';
Font2.Caption:='Font';
Farben.Caption:='Colors';
Leerzeichen1.Caption:='Blanks';
Default1.Caption:='Reset';
Syntaxhervorhebung1.Caption:='Syntax Highlight';
Zeilennummern1.Caption:='Linenumbers';
Blocknummern.Caption:='Blocknumbers';
Optionen1.Caption:='Options';
Vollbild1.Caption:='Fullscreen';
//
Navigation1.Caption:='Navigate';
Vor1.Caption:='Forward';
Zur1.Caption:='Backward';
Auf1.Caption:='Up';
Ab1.Caption:='Down';
Home1.Caption:='Home';
Simulation.Caption:='Simulate';
Execute1.Caption:='Execute';
//
Hilfe1.Caption:='Help';
Hilfe2.Caption:='Help';
Aktivierung1.Caption:='Activate';
Lizenzerwerben1.Caption:='Get full license';
//FeedBackDialog.Caption:='FeedBackDialogack';
NeueVersion1.Caption:='Update Software';
ber1.Caption:='About';
//
Opt.R.Navigator.Sheet.Caption:='Navigator';
Opt.R.Semantik.Sheet.Caption:='Semantics';
Opt.R.Explorer.Sheet.Caption:='Explorer';
Opt.R.Source.Sheet.Caption:='Source';
Opt.R.CFA.Sheet.Caption:='CFA';
Opt.R.DFA.Sheet.Caption:='DFA';
Opt.R.measures.Sheet.Caption:='Measures';
Opt.R.Funktion.Sheet.Caption:='Function';
Opt.R.Druckvorschau.Sheet.Caption:='Printpreview';
Opt.R.Miniatur.Sheet.Caption:='Miniatures';
//
Sprache1.Caption:='German Language';
//------------------------------------------------------------------//
//hints
//------------------------------------------------------------------//
Ab.Hint:='down';
Auf.Hint:='up';
Execute.Hint:='execute';
Home.Hint:='home';
Oeffnen.Hint:='open';
Oeffne2.Hint:='open';
Previewbutton.Hint:='print preview';
Simulation1.Hint:='simulate';
Speichern.Hint:='save';
Split.Hint:='split';
Neu1.Hint:='new file from template';
Template.Hint:=Neu1.Hint;
Vor.Hint:='forward';
Zur.Hint:='backward';
SwitchIDEPrint.Hint:='switch to IDE';
Suchen.Hint:='search';
Ersetzen.Hint:='replace';
Zeilennummern1.Hint:='line numbers';
SyntaxHighLite.Hint:='syntax highlite';
Indenting.Hint:='format source';
Zeilennummern.Hint:='show linenumbers';
ToolButton10.Hint:='full screen';
ToolButton12.Hint:=ToolButton10.Hint;
Vollbild1.Hint:=ToolButton10.Hint;
//
Hochformat.Hint:='portrait';
Drucken1.Hint:='print pages';
PrintButton.Hint:=Drucken1.Hint;
PDFButton.Hint:='save pages as PDF file';
Druckvorschau.Hint:='print preview';
Querformat.Hint:='landscape';
//
Kopieren2.Hint:='copy';
Einfuegen.Hint:='paste';
Ausschneiden.Hint:='cut';
Undo.Hint:='undo action';
UndoButton.Hint:=Undo.Hint;
//
Fullscr.Image1.Hint:='switch full screen';
Dateityp1.Caption:='File type';
ContextIT1.Caption:='Website cococo.de';
//------------------------------------------------------------------//
//dialogues
//------------------------------------------------------------------//
with Opt do begin
Label8.Caption:='COBOL dialect';
Label3.Caption:='Library
1';
Label4.Caption:='Library
2';
Label5.Caption:='Library
3';
label6.Caption:='Create backup';
Label7.Caption:='Line thickness';
Label9.Caption:='Graphics format';
label2.Caption:='Highlite type';
Label11.Caption:='Help key';
Label10.Caption:='Search key';
Label12.Caption:='Replace key';
Label13.Caption:='Replace again key';
Label1.Caption:='Batch command';
Label14.Caption:='Timeout (msec)';
Button2.Caption:='Cancel';
ComboBox1.items.clear;
ComboBox1.items.Add('yes');
ComboBox1.items.Add('no');
PageControl1.Pages[
0].Caption:='Basic options';
PageControl1.Pages[
1].Caption:='Internal file associations';
PageControl1.Pages[
2].Caption:='External file associations';
extlist.Columns[
0].Caption:='extension';
extlist.Columns[
1].Caption:='windows';
ValueList.TitleCaptions[
0]:='engine';
ValueList.TitleCaptions[
1]:='extensions';
Indentchars.Hint:='#chars of indenting on format';
combobox12.Hint:='allow to insert line breaks on format';
Button2.Caption:=trans(lang,
242,'Abbruch');
end;
//
with AboutDialog do begin
Caption:='About '+Application.Title;
Quellkodierung.Caption:='Version for several formal languages';
Label9.Caption:='The Source Inspector';
label2.Caption:='This software contains components from';
Label3.Caption:='Available physical memory';
Label4.Caption:='Total memory used';
Label11.Caption:='Memory usage of this program';
UserName.Caption:='user name';
end;
if pos('unbekannt',Opt.R.UserName)=
1 then
Opt.R.UserName:='unknown user';
//
with Lizenz1 do begin
Button1.Caption:='OK';
Button2.Caption:='cancel';
button3.Caption:='register';
Label1.Caption:='name';
label2.Caption:='activation code';
end;
//
with SamplesDialog do begin
Caption:='Template';
Label1.Caption:='Program type';
ComboBox1.Text:='not for this language';
Button2.Caption:='Cancel';
end;
//
with SamplesDialog do begin
Signatures[LeereDatei]:='empty file';
Signatures[Konsolprog]:='console program';
Signatures[Unterprog]:='subprogram';
Signatures[Copy]:='copy';
Signatures[Dateiprog]:='file programm';
Signatures[SQLProg]:='SQL program';
Signatures[CICSProg]:='CICS program';
Signatures[DLIProg]:='DLI program';
Signatures[OOProg]:='object oriented program';
end;
//
with SearchReplaceDialog do begin
Caption:='search/replace';
Label1.Caption:='search';
label2.Caption:='replace by';
Button2.Caption:='cancel';
button3.Caption:='replace all';
Button4.Caption:='find all';
CheckBox1.Caption:='case sensitive';
CheckBox2.Caption:='regular expression';
ComboBox1.Hint:='allowed metachars are .,^,$,[,]';
ComboBox2.Hint:='use \
0 for the found text';
end;
//
with ColorDialog do begin
Button2.Caption:=trans(lang,
242,'Abbruch');
button3.Caption:='reset all';
Label1.Caption:='background';
label2.Caption:='keyword';
Label3.Caption:='string';
Label4.Caption:='number';
Label5.Caption:='identifier';
label6.Caption:='other keyword';
Label7.Caption:='comment';
Label8.Caption:='other keyword';
Label9.Caption:='label';
Label10.Caption:='lexical';
end;
with PopupMenu1 do begin
rckgngig2.Caption:='undo';
ausschneiden2.Caption:='cut';
kopieren22.Caption:='copy';
allesauswhlen2.Caption:='select all';
einfgen2.Caption:='paste';
drucken3.Caption:='print';
end;
with PopupMenu2 do begin
kopieren3.Caption:='copy';
allesauswhlen3.Caption:='select all';
drucken4.Caption:='print';
end;
with PopupMenu3 do begin
drucken2.Caption:='print';
end;
with PopupMenu4 do begin
drucken11.Caption:='print';
insDetail1.Caption:='goto detail';
verallgemeinern.Caption:='one step up';
end;
with PopupMenu3 do begin
drucken5.Caption:='print';
end;
Zoomin.Hint:='zoom in';
ZoomNormal.Hint:='zoom to fit';
Zoomout.Hint:='zoom out';
end;
//------------------------------------------------------------------
//
//Ende dieser Quelle --
//
//------------------------------------------------------------------
end.