📄 main.pas
字号:
end
else
begin
Form_ViewComboBox.Enabled := True;
Form_ViewComboBox.ItemIndex := 0;
end;
end;
stringList.Free;
RefreshFormInfo;
end;
//This method refreshes all controls that are dependent on the selected View
//The method is called when the currently selected view changes. (meaning when the view-pulldownbox changes)
procedure TMainForm.RefreshFormInfo;
var stringList : TStringList;
tmpView : TView;
i : Integer;
begin
if (Form_ViewComboBox.ItemIndex = -1) then
begin
Form_FieldsVisibleCheckListBox.Clear;
Form_FieldsVisibleCheckListBox.Enabled := false;
FormWidthEd.Text := '';
FormWidthEd.Enabled := false;
FormHeightEd.Text := '';
FormHeightEd.Enabled := false;
FormXEd.Text := '';
FormXEd.Enabled := false;
FormYEd.Text := '';
FormYEd.Enabled := false;
end
else
begin
tmpView := TView(Form_ViewComboBox.Items.Objects[Form_ViewComboBox.ItemIndex]);
stringList := TStringList.Create;
tmpView.GetFormSortedColumns(stringList);
Form_FieldsVisibleCheckListBox.Enabled := True;
Form_FieldsVisibleCheckListBox.Items.Assign(stringList);
for i:=0 to Form_FieldsVisibleCheckListBox.Items.Count-1 do
begin
Form_FieldsVisibleCheckListBox.Checked[i] := SW_Column(stringList.Objects[i]).selectedForForm;
end;
stringList.Clear;
FormWidthEd.Enabled := true;
FormWidthEd.Text := IntToStr(tmpView.FormWidth);
FormHeightEd.Enabled := true;
FormHeightEd.Text := IntToStr(tmpView.FormHeight);
FormXEd.Enabled := true;
FormXEd.Text := IntToStr(tmpView.FormX);
FormYEd.Enabled := True;
FormYEd.Text := IntToStr(tmpView.FormY);;
end;
RefreshFormColInfo;
end;
//This method refreshes all controls that are dependent on the selected Column
procedure TMainForm.RefreshFormColInfo;
var cInd : Integer;
column : SW_Column;
tmpView: TView;
begin
cInd := Form_FieldsVisibleCheckListBox.ItemIndex;
if (cInd = -1) then
begin
Form_ColNameEd.Text := '';
Form_ColNameEd.Enabled := false;
Form_ColWidthEd.Text := '';
Form_ColWidthEd.Enabled := false;
Form_FixedWidthCheckBox.Enabled := false;
exit;
end;
column := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd]);
tmpView := TView(Form_ViewComboBox.Items.Objects[Form_ViewComboBox.ItemIndex]);
//we show the correct values, but the user cannot change them
if (column.selectedForForm = false) then
begin
Form_ColNameEd.Text := column.FormName;
Form_ColNameEd.Enabled := false;
Form_FixedWidthCheckBox.Enabled := false;
if (column.FormWidth = -1) then
begin
Form_ColWidthEd.Text := '200';
Form_FixedWidthCheckBox.Checked := false;
end
else
begin
Form_ColWidthEd.Text := IntToStr(column.FormWidth);
Form_FixedWidthCheckBox.Checked := true;
end;
Form_ColWidthEd.Enabled := false;
end
else
begin
Form_ColNameEd.Enabled := true;
Form_FixedWidthCheckBox.Enabled:= true;
//We have to differentiate between the column of a mainTable, joinTable, or nmTable
if (tmpView.Table = column.Table) then
begin
Form_ColNameEd.Text := column.FormName;
if (column.FormWidth = -1) then
begin
Form_FixedWidthCheckBox.Checked := false;
Form_ColWidthEd.Enabled := false;
Form_ColWidthEd.Text := '200';
end
else
begin
Form_FixedWidthCheckBox.Checked := true;
Form_ColWidthEd.Enabled := true;
Form_ColWidthEd.Text := IntToStr(column.FormWidth);
end;
end
else if (tmpView.JoinTables.IndexOf(column.Table) <> -1) then //if it is the column of a join-table
begin
Form_ColNameEd.Text := column.Table.Join_ColumnName;
if (column.Table.Join_Width = -1) then
begin
Form_FixedWidthCheckBox.Checked := false;
Form_ColWidthEd.Enabled := false;
Form_ColWidthEd.Text := '200';
end
else
begin
Form_FixedWidthCheckBox.Checked := true;
Form_ColWidthEd.Enabled := true;
Form_ColWidthEd.Text := IntToStr(column.Table.Join_Width);
end;
end
else if (tmpView.NMTables.IndexOf(column.Table) <> -1) then //if it is the column of an NM-table
begin
Form_ColNameEd.Text := column.FormName;
if (column.Table.NM_Width = -1) then
begin
Form_FixedWidthCheckBox.Checked := false;
Form_ColWidthEd.Enabled := false;
Form_ColWidthEd.Text := '200';
end
else
begin
Form_FixedWidthCheckBox.Checked := true;
Form_ColWidthEd.Enabled := true;
Form_ColWidthEd.Text := IntToStr(column.Table.NM_Width);
end;
end;
end;
if (Output.InputComplete) then
ActivateRun
else
DeactivateRun;
end;
procedure TMainForm.Form_ColNameEdExit(Sender: TObject);
var cInd : Integer;
column : SW_Column;
tmpView:TView;
begin
cInd := Form_FieldsVisibleCheckListBox.ItemIndex;
if (cInd = -1) then exit;
if (Form_ViewComboBox.ItemIndex = -1) then exit;
column := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd]);
tmpView := TView(Form_ViewComboBox.Items.Objects[Form_ViewComboBox.ItemIndex]);
//We have to differentiate if it is the colum of a mainTable, joinTable, or nmTable
if (tmpView.Table = column.Table) then
begin
column.FormName := Form_ColnameEd.Text;
end
else if (tmpView.JoinTables.IndexOf(column.Table) <> -1) then //if it is the column of a join-table
begin
column.Table.Join_ColumnName := Form_ColnameEd.Text;
end
else if (tmpView.NMTables.IndexOf(column.Table) <> -1) then //if it is the column of an NM-table
begin
column.FormName := Form_ColnameEd.Text;
end;
end;
procedure TMainForm.Form_ColWidthEdExit(Sender: TObject);
var cInd : Integer;
column : SW_Column;
tmpView:TView;
begin
cInd := Form_FieldsVisibleCheckListBox.ItemIndex;
if (cInd = -1) then exit;
if (Form_ViewComboBox.ItemIndex = -1) then exit;
column := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd]);
tmpView := TView(Form_ViewComboBox.Items.Objects[Form_ViewComboBox.ItemIndex]);
//this method is also called from TakeSettings
if (Form_FixedWidthCheckBox.Checked = false) then exit;
//We have to differentiate if it is the colum of a mainTable, joinTable, or nmTable
if (tmpView.Table = column.Table) then
begin
column.FormWidth:= StrToInt(Form_ColWidthEd.Text);
end
else if (tmpView.JoinTables.IndexOf(column.Table) <> -1) then //if it is the column of a join-table
begin
column.Table.Join_Width:= StrToInt(Form_ColWidthEd.Text);
end
else if (tmpView.NMTables.IndexOf(column.Table) <> -1) then //if it is the column of an NM-table
begin
column.Table.NM_Width:= StrToInt(Form_ColWidthEd.Text);
end;
end;
procedure TMainForm.Form_GroupComboBoxChange(Sender: TObject);
begin
RefreshFormTab;
end;
procedure TMainForm.Form_ViewComboBoxChange(Sender: TObject);
begin
RefreshFormInfo;
end;
procedure TMainForm.Form_FieldsVisibleCheckListBoxClickCheck(Sender: TObject);
var col : SW_Column;
begin
col := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[Form_FieldsVisibleCheckListBox.ItemIndex]);
col.ToggleFormSelected;
RefreshFormColInfo;
end;
procedure TMainForm.Form_FieldsVisibleCheckListBoxClick(Sender: TObject);
begin
RefreshFormColInfo;
end;
procedure TMainForm.Form_FixedWidthCheckBoxClick(Sender: TObject);
var cInd : Integer;
column : SW_Column;
tmpView: TView;
begin
cInd := Form_FieldsVisibleCheckListBox.ItemIndex;
assert (cInd <> -1);
assert (Form_ViewComboBox.ItemIndex <> -1);
column := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd]);
tmpView := TView(Form_ViewComboBox.Items.Objects[Form_ViewComboBox.ItemIndex]);
if (Form_FixedWidthCheckBox.Checked) then
begin
Form_ColWidthEd.Enabled := True;
if (column.FormWidth = -1) then //supply a default value
begin
Form_ColWidthEd.Text := '200';
if (tmpView.Table = column.Table) then
column.FormWidth := 200
else if (tmpView.JoinTables.IndexOf(column.Table) <> -1) then //if it is the column of a join-table
column.Table.Join_Width:= 200
else if (tmpView.NMTables.IndexOf(column.Table) <> -1) then //if it is the column of an NM-table
column.Table.NM_Width:= 200;
end
else
begin
if (tmpView.Table = column.Table) then
Form_ColWidthEd.Text := IntToStr(column.formWidth)
else if (tmpView.JoinTables.IndexOf(column.Table) <> -1) then //if it is the column of a join-table
Form_ColWidthEd.Text := IntToStr(column.Table.Join_Width)
else if (tmpView.NMTables.IndexOf(column.Table) <> -1) then //if it is the column of an NM-table
Form_ColWidthEd.Text := IntToStr(column.Table.NM_Width);
end;
end
else
begin
Form_ColWidthEd.Enabled := false;
if (tmpView.Table = column.Table) then
column.FormWidth := -1
else if (tmpView.JoinTables.IndexOf(column.Table) <> -1) then //if it is the column of a join-table
column.Table.Join_Width:= -1
else if (tmpView.NMTables.IndexOf(column.Table) <> -1) then //if it is the column of an NM-table
column.Table.NM_Width:= -1;
end;
end;
procedure TMainForm.FormYEdExit(Sender: TObject);
var vInd :Integer;
tmpView : TView;
begin
vInd := Form_ViewComboBox.ItemIndex;
if (vInd = -1) then exit;
tmpView := TView(Form_ViewComboBox.Items.Objects[vInd]);
tmpView.FormY := StrToInt(FormYEd.Text);
end;
procedure TMainForm.FormXEdExit(Sender: TObject);
var vInd :Integer;
tmpView : TView;
begin
vInd := Form_ViewComboBox.ItemIndex;
if (vInd = -1) then exit;
tmpView := TView(Form_ViewComboBox.Items.Objects[vInd]);
tmpView.FormX := StrToInt(FormXEd.Text);
end;
procedure TMainForm.FormHeightEdExit(Sender: TObject);
var vInd :Integer;
tmpView : TView;
begin
vInd := Form_ViewComboBox.ItemIndex;
if (vInd = -1) then exit;
tmpView := TView(Form_ViewComboBox.Items.Objects[vInd]);
tmpView.FormHeight := StrToInt(FormHeightEd.Text);
end;
procedure TMainForm.FormWidthEdExit(Sender: TObject);
var vInd :Integer;
tmpView : TView;
begin
vInd := Form_ViewComboBox.ItemIndex;
if (vInd = -1) then exit;
tmpView := TView(Form_ViewComboBox.Items.Objects[vInd]);
tmpView.FormWidth := StrToInt(FormWidthEd.Text);
end;
procedure TMainForm.Form_UpBtnClick(Sender: TObject);
var cInd,vInd : Integer;
view: TView;
col1,col2 : SW_Column;
begin
cInd := Form_FieldsVisibleCheckListBox.ItemIndex;
if (cInd = -1) or (cInd-1 = -1) then exit;
vInd := Form_ViewComboBox.ItemIndex;
assert(vInd <> -1);
view := TView(Form_ViewComboBox.Items.Objects[vInd]);
col1 := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd]);
col2 := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd-1]);
view.ExchangeFormSortedColumns(cInd, cInd-1);
//Form_FieldsVisibleCheckListBox.Items.Exchange(cInd, cInd-1);
Form_FieldsVisibleCheckListBox.Items[cInd] := col2.table.name+'.'+col2.name;
Form_FieldsVisibleCheckListBox.Items[cInd-1] := col1.Table.name+'.'+col1.name;
Form_FieldsVisibleCheckListBox.Items.Objects[cInd] := col2;
Form_FieldsVisibleCheckListBox.Items.Objects[cInd-1] := col1;
Form_FieldsVisibleChecklistBox.Checked[cInd]:=col2.selectedForForm;
Form_FieldsVisibleChecklistBox.Checked[cInd-1]:=col1.selectedForForm;
Form_FieldsVisibleCheckListBox.Selected[cInd]:= false;
Form_FieldsVisibleCheckListBox.Selected[cInd-1] := true;
end;
procedure TMainForm.Form_DownBtnClick(Sender: TObject);
var cInd,vInd : Integer;
view: TView;
col1,col2 : SW_Column;
begin
cInd := Form_FieldsVisibleCheckListBox.ItemIndex;
if (cInd = -1) or (cInd+1 >= Form_FieldsVisibleCheckListBox.Items.Count) then exit;
vInd := Form_ViewComboBox.ItemIndex;
assert(vInd <> -1);
view := TView(Form_ViewComboBox.Items.Objects[vInd]);
col1 := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd]);
col2 := SW_Column(Form_FieldsVisibleCheckListBox.Items.Objects[cInd+1]);
view.ExchangeFormSortedColumns(cInd, cInd+1);
//Form_FieldsVisibleCheckListBox.Items.Exchange(cInd, cInd+1);
Form_FieldsVisibleCheckListBox.Items[cInd] := col2.table.name+'.'+col2.name;
Form_FieldsVisibleCheckListBox.Items[cInd+1] := col1.Table.name+'.'+col1.name;
Form_FieldsVisibleCheckListBox.Items.Objects[cInd] := col2;
Form_FieldsVisibleCheckListBox.Items.Objects[cInd+1] := col1;
Form_FieldsVisibleChecklistBox.Checked[cInd]:=col2.selectedForForm;
Form_FieldsVisibleChecklistBox.Checked[cInd+1]:=col1.selectedForForm;
Form_FieldsVisibleCheckListBox.Selected[cInd]:= false;
Form_FieldsVisibleCheckListBox.Selected[cInd+1] := true;
end;
procedure TMainForm.About1Click(Sender: TObject);
begin
SplashForm := TSplashForm.Create(nil);
SplashForm.VersionLbl.Caption:=Version;
SplashForm.ShowModal;
SplashForm.Release;
end;
procedure TMainForm.PageControlTreeViewChange(Sender: TObject;
Node: TTreeNode);
begin
PageControl.ActivePageIndex:=PageControlTreeView.Selected.AbsoluteIndex;
PageControlTitleLbl.Caption:=PageControlTreeView.Selected.Text;
end;
procedure TMainForm.SaveMIClick(Sender: TObject);
begin
SaveBtnClick(self);
end;
procedure TMainForm.SaveBtnClick(Sender: TObject);
var mydata: TEERPluginData;
stringList :TStringList;
theData: IXMLSWF_DataType;
document : IXMLDocument;
xmlString : String;
begin
//unfortunately the onclick-event is processed before OnExit-Events that
//logically happened before the click
TakeSettings;
theData := NewSWF_Data;
Output.SaveToXmlNode(theData);
document := theData.OwnerDocument;
//save the xml-information into a normal string
document.SaveToXml(xmlString);
//now replace all occurrencies of '<' and '>' in the string
// xmlString := DMMain.ReplaceString(xmlString,'<','\111');
// xmlString := DMMain.ReplaceString(xmlString,'>','\112');
//save the date
stringList := TStringList.Create;
stringList.Add(xmlString);
//check first if we already have an entry
mydata:=EERModel.GetPluginDataById('SimpleWebFront', 0);
if (mydata <> nil) then
begin
mydata.Params := stringList;
end
else
begin
mydata:=EERModel.AddPluginData('SimpleWebFront', 0);
mydata.Params := stringList;
end;
EERModel.SaveToFile(xmlFilename);
StatusBar.SimpleText := SaveSuccessful + xmlFilename;
end;
procedure TMainForm.CloseBtnClick(Sender: TObject);
begin
Close;
end;
procedure TMainForm.ReportingBugs1Click(Sender: TObject);
begin
DialogBugsForm := TDialogBugsForm.Create(nil);
try
DialogBugsForm.ShowModal();
finally
DialogBugsForm.Release;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -