Ignore:
Timestamp:
Mar 21, 2012, 12:54:06 PM (13 years ago)
Author:
chronos
Message:
  • Modified: Navigation menu moved to separated docked form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Client/Forms/UFormMain.pas

    r46 r49  
    2323    AToggleFullscreen: TAction;
    2424    AExit: TAction;
    25     AObjectEdit: TAction;
    26     AObjectDelete: TAction;
    27     AObjectGroupEdit: TAction;
    28     AObjectGroupAddObject: TAction;
    29     AObjectGroupAddGroup: TAction;
    30     AObjectGroupDelete: TAction;
    3125    ActionListItem: TActionList;
    3226    ImageListActions: TImageList;
    33     Label1: TLabel;
    34     MainMenu1: TMainMenu;
     27    MainMenuMain: TMainMenu;
    3528    MenuItem1: TMenuItem;
    36     MenuItem10: TMenuItem;
    3729    MenuItem11: TMenuItem;
    3830    MenuItem12: TMenuItem;
     
    4941    MenuItem3: TMenuItem;
    5042    MenuItem4: TMenuItem;
    51     MenuItem5: TMenuItem;
    52     MenuItem6: TMenuItem;
    53     MenuItem7: TMenuItem;
    54     MenuItem8: TMenuItem;
    55     MenuItem9: TMenuItem;
    5643    PanelMenu: TPanel;
    5744    PanelData: TPanel;
    58     PopupMenuObjectGroup: TPopupMenu;
    59     PopupMenuObject: TPopupMenu;
    6045    PopupMenuItem: TPopupMenu;
    6146    Splitter1: TSplitter;
     
    6752    ToolButton4: TToolButton;
    6853    ToolButton5: TToolButton;
    69     TreeView1: TTreeView;
    7054    procedure AAboutExecute(Sender: TObject);
    7155    procedure AConnectExecute(Sender: TObject);
     
    7357    procedure AExitExecute(Sender: TObject);
    7458    procedure AImportStructureExecute(Sender: TObject);
    75     procedure AObjectEditExecute(Sender: TObject);
    76     procedure AObjectGroupAddGroupExecute(Sender: TObject);
    77     procedure AObjectGroupDeleteExecute(Sender: TObject);
    78     procedure AObjectGroupEditExecute(Sender: TObject);
    7959    procedure ASettingsExecute(Sender: TObject);
    8060    procedure AToggleFullscreenExecute(Sender: TObject);
     
    8363    procedure FormDestroy(Sender: TObject);
    8464    procedure FormShow(Sender: TObject);
    85     procedure MenuItem17Click(Sender: TObject);
    86     procedure MenuItem19Click(Sender: TObject);
    87     procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
    88     procedure TreeView1DblClick(Sender: TObject);
    8965  private
    9066    OriginalBounds: TRect;
     
    9773    MainPanelForm: TItemListForm;
    9874    PersistentForm: TPersistentForm;
    99     TreeState: TTreeState;
    10075    Report: TReport;
    10176    procedure UpdateInterface;
    102     procedure LoadTree;
    10377  end;
    10478
     
    11993  UFormItemView, UFormItemEdit, UFormItemAdd, UFormLogin, UFormSetting, UApplicationInfo,
    12094  UCore, UFormImportStructure, UFormAbout, UFormLoginProfile, UChronisClientDirect,
    121   UChronisClient, UChronisClientMySQL, UChronisClientXMLRPC;
     95  UChronisClient, UChronisClientMySQL, UChronisClientXMLRPC, UFormMenu;
    12296
    12397{$R *.lfm}
     
    158132  MainPanelForm.ManualDock(PanelData, nil, alClient);
    159133  MainPanelForm.Align := alClient;
     134  FormMenu.ManualDock(PanelMenu, nil, alClient);
     135  FormMenu.Align := alClient;
     136  FormMenu.Show;
    160137end;
    161138
     
    181158procedure TMainForm.FormCreate(Sender: TObject);
    182159begin
    183   TreeState := TTreeState.Create;
    184160  Report := TReport.Create;
    185161  Report.Base := Core.System;
     
    192168  FreeAndNil(MainPanelForm);
    193169  FreeAndNil(Report);
    194   FreeAndNil(TreeState);
    195170  FreeAndNil(PersistentForm);
    196171end;
     
    201176  PersistentForm.Save(Self);
    202177  SaveToRegistry;
    203 end;
    204 
    205 procedure TMainForm.AObjectEditExecute(Sender: TObject);
    206 begin
    207 (*  if Assigned(TreeView1.Selected) then begin
    208     SelectedObjectId := 9;
    209     SelectedItem := Integer(TreeView1.Selected.Data);
    210     ItemEditForm.Show;
    211   end;*)
    212 end;
    213 
    214 procedure TMainForm.AObjectGroupAddGroupExecute(Sender: TObject);
    215 begin
    216 
    217 end;
    218 
    219 procedure TMainForm.AObjectGroupDeleteExecute(Sender: TObject);
    220 begin
    221 
    222 end;
    223 
    224 procedure TMainForm.AObjectGroupEditExecute(Sender: TObject);
    225 begin
    226 (*  if Assigned(TreeView1.Selected) then begin
    227     SelectedObjectId := 8;
    228     SelectedItem := Integer(TreeView1.Selected.Data);
    229     ItemEditForm.Show;
    230   end;*)
    231178end;
    232179
     
    302249      try
    303250        Core.System.Active := True;
    304         LoadTree;
     251        FormMenu.LoadTree;
    305252      except
    306253        on E: Exception do ShowMessage(E.Message);
     
    318265  if Core.System.Active then begin
    319266    Core.System.Active := False;
    320     TreeView1.Items.Clear;
     267    FormMenu.TreeViewMenu.Items.Clear;
    321268  end;
    322269  UpdateInterface;
     
    341288end;
    342289
    343 procedure TMainForm.MenuItem17Click(Sender: TObject);
    344 begin
    345   try
    346     LoginForm := TLoginForm.Create(MainForm);
    347     LoginForm.ShowModal;
    348   finally
    349     LoginForm.Free;
    350   end;
    351 end;
    352 
    353 procedure TMainForm.MenuItem19Click(Sender: TObject);
    354 begin
    355 
    356 end;
    357 
    358 procedure TMainForm.TreeView1Change(Sender: TObject; Node: TTreeNode);
    359 begin
    360   AObjectGroupDelete.Enabled := Assigned(TreeView1.Selected);
    361   AObjectGroupEdit.Enabled := Assigned(TreeView1.Selected);
    362   if Assigned(TreeView1.Selected) then begin
    363     if TreeView1.Selected.ImageIndex = 0 then begin
    364       TreeView1.PopupMenu := PopupMenuObjectGroup;
    365       PanelData.Visible := False;
    366     end;
    367     if TreeView1.Selected.ImageIndex = 1 then begin
    368       TreeView1.PopupMenu := PopupMenuObject;
    369       //LoadItemList;
    370     end;
    371   end;
    372 end;
    373 
    374 procedure TMainForm.TreeView1DblClick(Sender: TObject);
    375 begin
    376   if Assigned(TreeView1.Selected) then begin
    377     MainPanelForm.SelectedObject.Load(Integer(TreeView1.Selected.Data));
    378     MainPanelForm.Caption := MainPanelForm.SelectedObject.Name;
    379     MainPanelForm.Show;
    380     MainPanelForm.Reload;
    381     UpdateInterface;
    382   end;
    383 end;
    384 
    385 procedure TMainForm.LoadTree;
    386 var
    387   Groups: TListProxy;
    388   Obj: TObjectProxy;
    389   Objects: TListProxy;
    390   Obj2: TObjectProxy;
    391   I: Integer;
    392   O: Integer;
    393   NewNode: TTreeNode;
    394   NewObjectNode: TTreeNode;
    395 begin
    396   with TreeView1, Items do begin
    397     TreeState.SaveTree(TreeView1);
    398     Clear;
    399     AddChild(nil, SGroup);
    400     TopItem.ImageIndex := 0;
    401     TopItem.SelectedIndex := 0;
    402     try
    403       Groups := TListProxy.Create;
    404       Groups.Client := Core.System.Client;
    405       Groups.ObjectName := ObjectGroupTable;
    406       Groups.SchemaName := Core.System.Client.Schema;
    407       Groups.Load;
    408       for I := 0 to Groups.Objects.Count - 1 do begin
    409         Obj := TObjectProxy(Groups.Objects[I]);
    410         NewNode := AddChild(TopItem, Obj.Properties.Values['Name']);
    411         NewNode.ImageIndex := 0;
    412         NewNode.SelectedIndex := 0;
    413         NewNode.Data := Pointer(StrToInt(Obj.Properties.Values['Id']));
    414         try
    415           Objects := TListProxy.Create;
    416           Objects.Client := Core.System.Client;
    417           Objects.ObjectName := ObjectTable;
    418           Objects.SchemaName := Core.System.Client.Schema;
    419           Objects.Condition := '`Group`="' + Obj.Properties.Values['Id'] + '"';
    420           Objects.Load;
    421           for O := 0 to Objects.Objects.Count - 1 do begin
    422             Obj2 := TObjectProxy(Objects.Objects[O]);
    423             NewObjectNode := AddChild(NewNode, Obj2.Properties.Values['Name']);
    424             NewObjectNode.Data := Pointer(StrToInt(Obj2.Properties.Values['Id']));
    425             NewObjectNode.ImageIndex := 1;
    426             NewObjectNode.SelectedIndex := 1;
    427           end;
    428         finally
    429           Objects.Free;
    430         end;
    431       end;
    432       TopItem.Expand(True);
    433     finally
    434       Groups.Free;
    435     end;
    436     TreeState.LoadTree(TreeView1);
    437   end;
    438 end;
    439 
    440290end.
    441291
Note: See TracChangeset for help on using the changeset viewer.