diff --git a/ORDESY.dpr b/ORDESY.dpr
index 9a4828c..b75e9c1 100644
--- a/ORDESY.dpr
+++ b/ORDESY.dpr
@@ -12,7 +12,8 @@ uses
uHash in 'uHash.pas',
uWrap in 'uWrap.pas',
uBaseList in 'uBaseList.pas' {fmBaseList},
- uSchemeList in 'uSchemeList.pas' {fmSchemeList};
+ uSchemeList in 'uSchemeList.pas' {fmSchemeList},
+ uSchemeDialog in 'uSchemeDialog.pas' {fmSchemeDialog};
{$R *.res}
diff --git a/ORDESY.dproj b/ORDESY.dproj
index 1d1d576..c82731d 100644
--- a/ORDESY.dproj
+++ b/ORDESY.dproj
@@ -58,6 +58,9 @@
+
+
+
Base
@@ -90,7 +93,7 @@
1
0
0
- 866
+ 914
False
False
False
@@ -102,7 +105,7 @@
- 1.0.0.866
+ 1.0.0.914
diff --git a/ORDESY.res b/ORDESY.res
index 02fc918..3c5f1c4 100644
Binary files a/ORDESY.res and b/ORDESY.res differ
diff --git a/uMain.dfm b/uMain.dfm
index 288dab1..ee9b247 100644
--- a/uMain.dfm
+++ b/uMain.dfm
@@ -114,7 +114,7 @@ object fmMain: TfmMain
Height = 347
Align = alClient
TabOrder = 3
- object gbInfo: TGroupBox
+ object gbxInfo: TGroupBox
Left = 1
Top = 1
Width = 330
diff --git a/uMain.pas b/uMain.pas
index 446e3c1..fca2958 100644
--- a/uMain.pas
+++ b/uMain.pas
@@ -4,15 +4,15 @@
btn - TButton
pnl - TPanel
lbl - TLabel
-gpb - TGroupBox
+gbx - TGroupBox
+cbx - TComboBox
+lbx - TListBox
spl - TSplitter
mmo - TMemo
tv - TTreeView
mm - TMainMenu
mi - TMenuItem
fm - TForm
-cbx - TComboBox
-lbx - TListBox
}
unit uMain;
@@ -24,7 +24,8 @@ interface
{$IFDEF Debug}
uLog,
{$ENDIF}
- uORDESY, uExplode, uShellFuncs, uProjectDialogs, uOptions, uWrap, uBaseList,
+ uORDESY, uExplode, uShellFuncs, uOptions, uWrap,
+ uSchemeDialog, uBaseList, uSchemeList, uProjectDialogs, // Dialogs
// Delphi Modules
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ExtCtrls, ComCtrls, ToolWin, ImgList, Buttons;
@@ -58,7 +59,7 @@ TfmMain = class(TForm)
miBase: TMenuItem;
miBaseList: TMenuItem;
ppmMain: TPopupMenu;
- gbInfo: TGroupBox;
+ gbxInfo: TGroupBox;
edName: TEdit;
lblName: TLabel;
lblDescription: TLabel;
@@ -90,6 +91,7 @@ TfmMain = class(TForm)
procedure AddBase(Sender: TObject);
procedure OnEditBase(Sender: TObject);
procedure EditBase(aBase: TOraBase);
+ procedure DeleteBase(Sender: TObject);
procedure tvMainClick(Sender: TObject);
procedure miFileClick(Sender: TObject);
procedure miSavechangesClick(Sender: TObject);
@@ -114,6 +116,22 @@ implementation
{$R *.dfm}
+procedure TfmMain.DeleteBase(Sender: TObject);
+var
+ reply: word;
+ ProjectList: TORDESYProjectList;
+begin
+ ProjectList:= TORDESYProjectList(TOraBase(tvMain.Selected.Data).ProjectListRef);
+ reply:= MessageBox(Handle, PChar('Delete base?' + #13#10 + 'Deleting base will affect on all projects.'), PChar('Confirm'), 36);
+ if reply = IDYES then
+ begin
+ ProjectList.RemoveBaseById(TOraBase(tvMain.Selected.Data).Id);
+ tvMain.Selected.Data:= nil;
+ tvMain.Deselect(tvMain.Selected);
+ UpdateGUI;
+ end;
+end;
+
procedure TfmMain.DeleteModule(Sender: TObject);
var
reply: word;
@@ -123,9 +141,9 @@ procedure TfmMain.DeleteModule(Sender: TObject);
reply:= MessageBox(Handle, PChar('Delete module?' + #13#10), PChar('Confirm'), 36);
if reply = IDYES then
begin
- tvMain.Deselect(tvMain.Selected);
Project.RemoveModuleById(TORDESYModule(tvMain.Selected.Data).Id);
tvMain.Selected.Data:= nil;
+ tvMain.Deselect(tvMain.Selected);
UpdateGUI;
end;
end;
@@ -139,9 +157,9 @@ procedure TfmMain.DeleteProject(Sender: TObject);
reply:= MessageBox(Handle, PChar('Delete project?' + #13#10), PChar('Confirm'), 36);
if reply = IDYES then
begin
- tvMain.Deselect(tvMain.Selected);
ProjectList.RemoveProjectById(Project.Id);
tvMain.Selected.Data:= nil;
+ tvMain.Deselect(tvMain.Selected);
UpdateGUI;
end;
end;
@@ -396,22 +414,54 @@ procedure TfmMain.miSavechangesClick(Sender: TObject);
end;
procedure TfmMain.OnEditBase(Sender: TObject);
+var
+ BaseName: string;
+label
+ retry;
begin
- //
+ try
+ retry:
+ BaseName:= TOraBase(tvMain.Selected.Data).Name;
+ if InputQuery('Edit base', 'Change base name:', BaseName) then
+ begin
+ if (BaseName <> '') and (Length(BaseName) <= 255) then
+ begin
+ TOraBase(tvMain.Selected.Data).Name:= BaseName;
+ UpdateGUI;
+ end
+ else
+ goto retry;
+ end;
+ except
+ on E: Exception do
+ begin
+ {$IFDEF Debug}
+ AddToLog(ClassName + ' | AddBase | ' + E.Message);
+ MessageBox(Application.Handle, PChar(ClassName + ' | AddBase | ' + E.Message), PChar(Application.Title + ' - Error'), 48);
+ {$ELSE}
+ MessageBox(Application.Handle, PChar(E.Message), PChar(Application.Title + ' - Error'), 48);
+ {$ENDIF}
+ end;
+ end;
end;
procedure TfmMain.AddBase(Sender: TObject);
var
BaseName: string;
+label
+ retry;
begin
try
+ retry:
if InputQuery('Add base', 'Enter base name:', BaseName) then
begin
if (BaseName <> '') and (Length(BaseName) <= 255) then
begin
ProjectList.AddOraBase(TOraBase.Create(ProjectList ,ProjectList.GetFreeBaseId, BaseName));
UpdateGUI;
- end;
+ end
+ else
+ goto retry;
end;
except
on E: Exception do
@@ -431,15 +481,15 @@ function TfmMain.CanPopup(const aTag: integer; aObject: Pointer): boolean;
Result:= false;
if aObject <> nil then
begin
- if (TObject(aObject) is TORDESYProject) and (aTag >= 0) and (aTag <= 10) then
+ if (TObject(aObject) is TORDESYProject) and (aTag >= 1) and (aTag <= 10) or (aTag = 0) then
Result:= true;
- if (TObject(aObject) is TORDESYModule) and (aTag >= 5) and (aTag <= 15) then
+ if (TObject(aObject) is TORDESYModule) and (aTag >= 5) and (aTag <= 15) or (aTag = 0) then
Result:= true;
- if (TObject(aObject) is TOraBase) and (aTag >= 10) and (aTag <= 20) then
+ if (TObject(aObject) is TOraBase) and (aTag >= 10) and (aTag <= 20) or (aTag = 0) then
Result:= true;
- if (TObject(aObject) is TOraScheme) and (aTag >= 15) and (aTag <= 25) then
+ if (TObject(aObject) is TOraScheme) and (aTag >= 15) and (aTag <= 25) or (aTag = 0) then
Result:= True;
- if (TObject(aObject) is TOraItem) and (aTag >= 20) and (aTag <= 30) then
+ if (TObject(aObject) is TOraItem) and (aTag >= 20) and (aTag <= 30) or (aTag = 0) then
Result:= true;
end
else
@@ -544,66 +594,16 @@ procedure TfmMain.PrepareGUI;
BaseMenu.Add(MenuItem);
//
MenuItem:= TMenuItem.Create(ppmMain);
- //MenuItem.OnClick:= EditBase;
+ MenuItem.OnClick:= OnEditBase;
MenuItem.Caption:= 'Edit base';
MenuItem.Tag:= 16;
BaseMenu.Add(MenuItem);
- // -----------------------------------------Module popup 11-20
- {MenuItem:= TMenuItem.Create(ppmMain);
- MenuItem.OnClick:= AddModule;
- MenuItem.Caption:= 'Add base';
- MenuItem.Tag:= 11;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);}
- // -----------------------------------------Base popup 21-30
- {MenuItem:= TMenuItem.Create(ppmMain);
- MenuItem.OnClick:= AddBase;
- MenuItem.Caption:= 'Add base';
- MenuItem.Tag:= 21;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);
- //
- MenuItem:= TMenuItem.Create(ppmMain);
- //MenuItem.OnClick:= miCreateProject.OnClick;
- MenuItem.Caption:= 'Edit base';
- MenuItem.Tag:= 22;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);
- //
- MenuItem:= TMenuItem.Create(ppmMain);
- //MenuItem.OnClick:= miCreateProject.OnClick;
- MenuItem.Caption:= 'Delete base';
- MenuItem.Tag:= 23;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);}
- // -----------------------------------------Scheme popup 31-40
- {MenuItem:= TMenuItem.Create(ppmMain);
- //MenuItem.OnClick:= miCreateProject.OnClick;
- MenuItem.Caption:= 'Add scheme';
- MenuItem.Tag:= 31;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);
- //
- MenuItem:= TMenuItem.Create(ppmMain);
- //MenuItem.OnClick:= EditScheme
- MenuItem.Caption:= 'Edit scheme';
- MenuItem.Tag:= 32;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);
- //
- MenuItem:= TMenuItem.Create(ppmMain);
- MenuItem.OnClick:= WrapItem;
- MenuItem.Caption:= 'Wrap item';
- MenuItem.Tag:= 33;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);
- //
- MenuItem:= TMenuItem.Create(ppmMain);
- //MenuItem.OnClick:= EditScheme
- MenuItem.Caption:= 'Delete scheme';
- MenuItem.Tag:= 34;
- MenuItem.Visible:= false;
- ppmMain.Items.Add(MenuItem);}
+ //
+ MenuItem:= TMenuItem.Create(ppmMain);
+ MenuItem.OnClick:= DeleteBase;
+ MenuItem.Caption:= 'Delete base';
+ MenuItem.Tag:= 16;
+ BaseMenu.Add(MenuItem);
except
on E: Exception do
begin
diff --git a/uProjectDialogs.dfm b/uProjectDialogs.dfm
index 24cddf9..4db93a8 100644
--- a/uProjectDialogs.dfm
+++ b/uProjectDialogs.dfm
@@ -60,7 +60,7 @@ object fmProjectCreate: TfmProjectCreate
Anchors = [akLeft, akBottom]
Caption = 'Date:'
end
- object gpbProjectName: TGroupBox
+ object gbxProjectName: TGroupBox
Left = 0
Top = 0
Width = 414
@@ -81,7 +81,7 @@ object fmProjectCreate: TfmProjectCreate
TabOrder = 0
end
end
- object gpbDescription: TGroupBox
+ object gbxDescription: TGroupBox
Left = 0
Top = 49
Width = 414
diff --git a/uProjectDialogs.pas b/uProjectDialogs.pas
index 7d5bbdf..d7d36e8 100644
--- a/uProjectDialogs.pas
+++ b/uProjectDialogs.pas
@@ -10,9 +10,9 @@ interface
type
TfmProjectCreate = class(TForm)
pnlMain: TPanel;
- gpbProjectName: TGroupBox;
+ gbxProjectName: TGroupBox;
edtProjectName: TEdit;
- gpbDescription: TGroupBox;
+ gbxDescription: TGroupBox;
mmDescription: TMemo;
lblCreatorHead: TLabel;
lblCreator: TLabel;
@@ -25,7 +25,7 @@ TfmProjectCreate = class(TForm)
procedure btnCreateClick(Sender: TObject);
end;
-function ShowProjectCreateDialog(const aCreator: string; var aProjectList: TORDESYProjectList): boolean;
+function ShowProjectCreateDialog(const aCreator: string; aProjectList: TORDESYProjectList): boolean;
function ShowProjectEditDialog(aProject: TORDESYProject): boolean;
function ShowModuleCreateDialog(aProject: TORDESYProject): boolean;
function ShowModuleEditDialog(aModule: TORDESYModule): boolean;
@@ -34,7 +34,7 @@ implementation
{$R *.dfm}
-function ShowProjectCreateDialog(const aCreator: string; var aProjectList: TORDESYProjectList): boolean;
+function ShowProjectCreateDialog(const aCreator: string; aProjectList: TORDESYProjectList): boolean;
var
dTimer: TTimer;
begin
diff --git a/uSchemeDialog.dfm b/uSchemeDialog.dfm
new file mode 100644
index 0000000..6cd595d
--- /dev/null
+++ b/uSchemeDialog.dfm
@@ -0,0 +1,112 @@
+object fmSchemeDialog: TfmSchemeDialog
+ Left = 0
+ Top = 0
+ BorderStyle = bsSizeToolWin
+ Caption = 'Add scheme'
+ ClientHeight = 138
+ ClientWidth = 214
+ Color = clBtnFace
+ Constraints.MinHeight = 162
+ Constraints.MinWidth = 222
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ OldCreateOrder = False
+ Position = poMainFormCenter
+ OnClose = FormClose
+ PixelsPerInch = 96
+ TextHeight = 13
+ object pnlMain: TPanel
+ Left = 0
+ Top = 0
+ Width = 214
+ Height = 138
+ Align = alClient
+ BevelOuter = bvNone
+ TabOrder = 0
+ ExplicitHeight = 168
+ DesignSize = (
+ 214
+ 138)
+ object gbxLogin: TGroupBox
+ Left = 0
+ Top = 0
+ Width = 214
+ Height = 49
+ Align = alTop
+ Caption = 'Login:'
+ TabOrder = 0
+ ExplicitWidth = 426
+ DesignSize = (
+ 214
+ 49)
+ object edtLogin: TEdit
+ Left = 7
+ Top = 17
+ Width = 200
+ Height = 24
+ Anchors = [akLeft, akTop, akRight]
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -13
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ TabOrder = 0
+ ExplicitWidth = 234
+ end
+ end
+ object gbxPass: TGroupBox
+ Left = 0
+ Top = 49
+ Width = 214
+ Height = 49
+ Align = alTop
+ Caption = 'Password:'
+ TabOrder = 1
+ ExplicitLeft = 2
+ ExplicitTop = 15
+ ExplicitWidth = 230
+ DesignSize = (
+ 214
+ 49)
+ object edtPass: TEdit
+ Left = 7
+ Top = 17
+ Width = 200
+ Height = 24
+ Anchors = [akLeft, akTop, akRight]
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -13
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ TabOrder = 0
+ end
+ end
+ object btnCancel: TButton
+ Left = 16
+ Top = 104
+ Width = 75
+ Height = 25
+ Anchors = [akRight, akBottom]
+ Caption = 'Cancel'
+ ModalResult = 2
+ TabOrder = 2
+ end
+ object btnSave: TButton
+ Left = 120
+ Top = 104
+ Width = 75
+ Height = 25
+ Anchors = [akRight, akBottom]
+ Caption = 'Save'
+ ModalResult = 1
+ TabOrder = 3
+ OnClick = btnSaveClick
+ end
+ end
+end
diff --git a/uSchemeDialog.pas b/uSchemeDialog.pas
new file mode 100644
index 0000000..fbb5521
--- /dev/null
+++ b/uSchemeDialog.pas
@@ -0,0 +1,85 @@
+unit uSchemeDialog;
+
+interface
+
+uses
+ // ORDESY Modules
+ {$IFDEF Debug}
+ uLog,
+ {$ENDIF}
+ uORDESY,
+ // Delphi Modules
+ Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+ Dialogs, StdCtrls, ExtCtrls;
+
+type
+ TfmSchemeDialog = class(TForm)
+ pnlMain: TPanel;
+ gbxLogin: TGroupBox;
+ gbxPass: TGroupBox;
+ edtPass: TEdit;
+ edtLogin: TEdit;
+ btnCancel: TButton;
+ btnSave: TButton;
+ procedure FormClose(Sender: TObject; var Action: TCloseAction);
+ procedure btnSaveClick(Sender: TObject);
+ end;
+
+function ShowSchemeCreateDialog(aProjectList: TORDESYProjectList): boolean;
+function ShowSchemeEditDialog(aScheme: TOraScheme): boolean;
+
+implementation
+
+{$R *.dfm}
+
+function ShowSchemeCreateDialog(aProjectList: TORDESYProjectList): boolean;
+begin
+ with TfmSchemeDialog.Create(Application) do
+ try
+ Caption:= 'Add scheme';
+ if ShowModal = mrOk then
+ begin
+ aProjectList.AddOraScheme(TOraScheme.Create(aProjectList, aProjectList.GetFreeSchemeId, edtLogin.Text, edtPass.Text));
+ end;
+ finally
+ Free;
+ end;
+end;
+
+function ShowSchemeEditDialog(aScheme: TOraScheme): boolean;
+begin
+ with TfmSchemeDialog.Create(Application) do
+ try
+ Caption:= 'Edit scheme';
+ edtLogin.Text:= aScheme.Login;
+ edtPass.Text:= aScheme.Pass;
+ if ShowModal = mrOk then
+ begin
+ aScheme.Login:= edtLogin.Text;
+ aScheme.Pass:= edtPass.Text;
+ end;
+ finally
+ Free;
+ end;
+end;
+
+procedure TfmSchemeDialog.btnSaveClick(Sender: TObject);
+begin
+ if (edtLogin.Text = '') or (Length(edtLogin.Text) > 255) then
+ begin
+ ModalResult:= mrNone;
+ raise Exception.Create('Incorrect scheme name, empty or more than 255 characters!');
+ end;
+ if (Length(edtPass.Text) > 255) then
+ begin
+ ModalResult:= mrNone;
+ raise Exception.Create('Incorrect scheme password, more than 255 characters!');
+ end;
+end;
+
+procedure TfmSchemeDialog.FormClose(Sender: TObject; var Action: TCloseAction);
+begin
+ Action:= caFree;
+end;
+
+end.