Skip to content

Commit

Permalink
[M] Added displaying of not valid items, fixed method UpdateStatus of…
Browse files Browse the repository at this point in the history
… TOraItem, added form to edit TOraItem options.
  • Loading branch information
unknown authored and unknown committed May 12, 2016
1 parent 1d5cfa3 commit 4aadbc0
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 60 deletions.
4 changes: 3 additions & 1 deletion ORDESY.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ uses
uBaseList in 'uBaseList.pas' {fmBaseList},
uSchemeList in 'uSchemeList.pas' {fmSchemeList},
uSchemeDialog in 'uSchemeDialog.pas' {fmSchemeDialog},
uLazyTreeState in 'uLazyTreeState.pas';
uLazyTreeState in 'uLazyTreeState.pas',
uItemOptions in 'uItemOptions.pas' {fmItemOptions};

{$R *.res}

Expand All @@ -26,5 +27,6 @@ begin
Application.MainFormOnTaskbar := True;
Application.Title := 'OrDeSy';
Application.CreateForm(TfmMain, fmMain);
Application.CreateForm(TfmItemOptions, fmItemOptions);
Application.Run;
end.
7 changes: 5 additions & 2 deletions ORDESY.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
<Form>fmSchemeDialog</Form>
</DCCReference>
<DCCReference Include="uLazyTreeState.pas"/>
<DCCReference Include="uItemOptions.pas">
<Form>fmItemOptions</Form>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
Expand Down Expand Up @@ -94,7 +97,7 @@
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">1255</VersionInfo>
<VersionInfo Name="Build">1278</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
Expand All @@ -106,7 +109,7 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.1255</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.1278</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
Expand Down
Binary file modified ORDESY.res
Binary file not shown.
18 changes: 18 additions & 0 deletions uItemOptions.dfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
object fmItemOptions: TfmItemOptions
Left = 0
Top = 0
BorderStyle = bsSizeToolWin
Caption = 'Item Options'
ClientHeight = 320
ClientWidth = 383
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poMainFormCenter
PixelsPerInch = 96
TextHeight = 13
end
24 changes: 24 additions & 0 deletions uItemOptions.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
unit uItemOptions;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TfmItemOptions = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;

var
fmItemOptions: TfmItemOptions;

implementation

{$R *.dfm}

end.
23 changes: 12 additions & 11 deletions uMain.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -196,31 +196,32 @@ object fmMain: TfmMain
object miProject: TMenuItem
Caption = 'Project'
object miAddProject: TMenuItem
Caption = 'Add project'
Caption = 'Add'
OnClick = AddProject
end
object miEditProject: TMenuItem
Caption = 'Edit project'
Caption = 'Edit'
OnClick = EditProject
end
object miModule: TMenuItem
Caption = 'Module'
object AddModule1: TMenuItem
Caption = 'Add Module'
Caption = 'Add'
OnClick = AddModule
end
object miModuleList: TMenuItem
Caption = 'Module List'
object miEditModule: TMenuItem
Caption = 'Edit'
OnClick = EditModule
end
end
object miItem: TMenuItem
Caption = 'Item'
object miWrapItem: TMenuItem
Caption = 'Wrap item'
Caption = 'Wrap'
OnClick = WrapItem
end
object miDeployItem: TMenuItem
Caption = 'Deploy Item'
Caption = 'Deploy'
end
object miItemList: TMenuItem
Caption = 'Item list'
Expand All @@ -237,22 +238,22 @@ object fmMain: TfmMain
object miBase: TMenuItem
Caption = 'Base'
object miAddBase: TMenuItem
Caption = 'Add base'
Caption = 'Add'
OnClick = AddBase
end
object miBaseList: TMenuItem
Caption = 'Base list'
Caption = 'List'
OnClick = miBaseListClick
end
end
object miScheme: TMenuItem
Caption = 'Scheme'
object miAddScheme: TMenuItem
Caption = 'Add scheme'
Caption = 'Add'
OnClick = miAddSchemeClick
end
object miSchemeList: TMenuItem
Caption = 'Scheme list'
Caption = 'List'
OnClick = miSchemeListClick
end
end
Expand Down
136 changes: 95 additions & 41 deletions uMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ TfmMain = class(TForm)
mmoDesc: TMemo;
miSavechanges: TMenuItem;
miModule: TMenuItem;
miModuleList: TMenuItem;
miEditModule: TMenuItem;
AddModule1: TMenuItem;
miAddBase: TMenuItem;
miItem: TMenuItem;
Expand All @@ -82,6 +82,7 @@ TfmMain = class(TForm)
procedure ppmMainPopup(Sender: TObject);
procedure AddProject(Sender: TObject);
procedure EditProject(Sender: TObject);
procedure UpdateStatus(Sender: TObject);
procedure DeleteProject(Sender: TObject);
procedure WrapItem(Sender: TObject);
procedure AddModule(Sender: TObject);
Expand All @@ -106,7 +107,6 @@ TfmMain = class(TForm)
AppOptions: TOptions;
TreeStateList: TLazyStateList;
ProjectList: TORDESYProjectList;
//procedure WMWindowPosChanged(var aMessage: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED;
function CanPopup(const aTag: integer; aObject: Pointer): boolean;
procedure SaveFormSize(const aWidth, aHeight: integer);
procedure PrepareGUI;
Expand Down Expand Up @@ -169,6 +169,8 @@ procedure TfmMain.DeleteModule(Sender: TObject);
reply: word;
Project: TORDESYProject;
begin
if not Assigned(tvMain.Selected) or not Assigned(tvMain.Selected.Data) or not (TObject(tvMain.Selected.Data) is TORDESYModule) then
Exit;
Project:= TORDESYProject(TORDESYModule(tvMain.Selected.Data).ProjectRef);
reply:= MessageBox(Handle, PChar('Delete module?' + #13#10), PChar('Confirm'), 36);
if reply = IDYES then
Expand Down Expand Up @@ -252,7 +254,7 @@ procedure TfmMain.EditBase(aBase: TOraBase);

procedure TfmMain.EditModule(Sender: TObject);
begin
if ShowModuleEditDialog(TORDESYModule(tvMain.Selected.Data)) then
if Assigned(tvMain.Selected) and Assigned(tvMain.Selected.Data) and (TObject(tvMain.Selected.Data) is TORDESYModule) and ShowModuleEditDialog(TORDESYModule(tvMain.Selected.Data)) then
UpdateGUI;
end;

Expand Down Expand Up @@ -653,6 +655,8 @@ procedure TfmMain.PrepareGUI;
ItemMenu: TMenuItem;
MenuItem: TMenuItem;
iOption: string;
NotValidIcon: TIcon;
ValidIcon: TBitmap;
begin
try
edtUserName.Text:= AppOptions.UserName;
Expand All @@ -679,13 +683,31 @@ procedure TfmMain.PrepareGUI;
on E: Exception do
begin
{$IFDEF Debug}
AddToLog(ClassName + ' | PrepareGUI | ' + E.Message);
MessageBox(Application.Handle, PChar(ClassName + ' | PrepareGUI | ' + E.Message), PChar(Application.Title + ' - Error'), 48);
AddToLog(ClassName + ' | PrepareGUI_Options | ' + E.Message);
MessageBox(Application.Handle, PChar(ClassName + ' | PrepareGUI_Options | ' + E.Message), PChar(Application.Title + ' - Error'), 48);
{$ELSE}
MessageBox(Application.Handle, PChar(E.Message), PChar(Application.Title + ' - Error'), 48);
{$ENDIF}
end;
end;
// -- Not Valid Icons
try
NotValidIcon:= TIcon.Create;
ValidIcon:= TBitmap.Create;
imlMain.GetIcon(1, NotValidIcon);
imlMain.GetBitmap(9, ValidIcon);
ValidIcon.Canvas.Draw(0, 0, NotValidIcon);
imlMain.Add(ValidIcon, nil);
imlMain.GetBitmap(14, ValidIcon);
ValidIcon.Canvas.Draw(0, 0, NotValidIcon);
imlMain.Add(ValidIcon, nil);
imlMain.GetBitmap(15, ValidIcon);
ValidIcon.Canvas.Draw(0, 0, NotValidIcon);
imlMain.Add(ValidIcon, nil);
finally
NotValidIcon.Free;
ValidIcon.Free;
end;
// -----------------------------------------Project Popup 1-10
ProjectMenu:= TMenuItem.Create(ppmMain);
ProjectMenu.Caption:= 'Project';
Expand All @@ -705,6 +727,12 @@ procedure TfmMain.PrepareGUI;
ProjectMenu.Add(MenuItem);
//
MenuItem:= TMenuItem.Create(ppmMain);
MenuItem.OnClick:= UpdateStatus;
MenuItem.Caption:= 'Update status';
MenuItem.Tag:= 1;
ProjectMenu.Add(MenuItem);
//
MenuItem:= TMenuItem.Create(ppmMain);
MenuItem.OnClick:= DeleteProject;
MenuItem.Caption:= 'Delete';
MenuItem.Tag:= 1;
Expand Down Expand Up @@ -943,38 +971,51 @@ procedure TfmMain.tvMainExpanded(Sender: TObject; Node: TTreeNode);
procedure TfmMain.tvMainGetImageIndex(Sender: TObject; Node: TTreeNode);
begin
try
Node.SelectedIndex:= Node.ImageIndex;
if TObject(Node.Data) is TOraItem then
case TOraItem(Node.Data).ItemType of
OraProcedure:
begin
Node.ImageIndex:= 15;
end;
OraFunction:
begin
Node.ImageIndex:= 14;
end;
OraPackage:
begin
Node.ImageIndex:= 9;
end;
end
else if TObject(Node.Data) is TOraScheme then
Node.ImageIndex:= 52
else if TObject(Node.Data) is TOraBase then
Node.ImageIndex:= 50
else if TObject(Node.Data) is TORDESYModule then
if Node.HasChildren and Node.Expanded then
Node.ImageIndex:= 55
else
Node.ImageIndex:= 54
else if TObject(Node.Data) is TORDESYProject then
if Node.HasChildren and Node.Expanded then
Node.ImageIndex:= 59
else
Node.ImageIndex:= 58
else if (Node.Data = nil) and (Node.Text = '?') then
Node.ImageIndex:= 0;
try
Node.SelectedIndex:= Node.ImageIndex;
if TObject(Node.Data) is TOraItem then
case TOraItem(Node.Data).ItemType of
OraProcedure:
begin
if TOraItem(Node.Data).Valid then
Node.ImageIndex:= 15
else
Node.ImageIndex:= 66;
end;
OraFunction:
begin
if TOraItem(Node.Data).Valid then
Node.ImageIndex:= 14
else
Node.ImageIndex:= 65;
end;
OraPackage:
begin
if TOraItem(Node.Data).Valid then
Node.ImageIndex:= 9
else
Node.ImageIndex:= 64;
end;
end
else if TObject(Node.Data) is TOraScheme then
Node.ImageIndex:= 52
else if TObject(Node.Data) is TOraBase then
Node.ImageIndex:= 50
else if TObject(Node.Data) is TORDESYModule then
if Node.HasChildren and Node.Expanded then
Node.ImageIndex:= 55
else
Node.ImageIndex:= 54
else if TObject(Node.Data) is TORDESYProject then
if Node.HasChildren and Node.Expanded then
Node.ImageIndex:= 59
else
Node.ImageIndex:= 58
else if (Node.Data = nil) and (Node.Text = '?') then
Node.ImageIndex:= 0;
finally

end;
except
on E: Exception do
begin
Expand All @@ -995,11 +1036,24 @@ procedure TfmMain.UpdateGUI;
TreeStateList.AppendState(tvMain);
end;

{procedure TfmMain.WMWindowPosChanged(var aMessage: TWMWindowPosChanged);
procedure TfmMain.UpdateStatus(Sender: TObject);
var
iM, iI: integer;
iProject: TORDESYProject;
iModule: TORDESYModule;
iItem: TOraItem;
begin
inherited;
SaveFormSize(fmMain.Width, fmMain.Height);
end;}
if Assigned(tvMain.Selected) and Assigned(tvMain.Selected.Data) and (TObject(tvMain.Selected.Data) is TORDESYProject) then
begin
iProject:= TORDESYProject(tvMain.Selected.Data);
for iM := 0 to iProject.ModuleCount - 1 do
begin
iModule:= iProject.GetModuleByIndex(iM);
for iI := 0 to iModule.OraItemCount - 1 do
iModule.GetOraItemByIndex(iI).UpdateStatus;
end;
end;
end;

procedure TfmMain.WrapItem(Sender: TObject);
var
Expand Down
Loading

0 comments on commit 4aadbc0

Please sign in to comment.