Changeset 49 for trunk/Client/Forms/UFormMain.pas
- Timestamp:
- Mar 21, 2012, 12:54:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Client/Forms/UFormMain.pas
r46 r49 23 23 AToggleFullscreen: TAction; 24 24 AExit: TAction; 25 AObjectEdit: TAction;26 AObjectDelete: TAction;27 AObjectGroupEdit: TAction;28 AObjectGroupAddObject: TAction;29 AObjectGroupAddGroup: TAction;30 AObjectGroupDelete: TAction;31 25 ActionListItem: TActionList; 32 26 ImageListActions: TImageList; 33 Label1: TLabel; 34 MainMenu1: TMainMenu; 27 MainMenuMain: TMainMenu; 35 28 MenuItem1: TMenuItem; 36 MenuItem10: TMenuItem;37 29 MenuItem11: TMenuItem; 38 30 MenuItem12: TMenuItem; … … 49 41 MenuItem3: TMenuItem; 50 42 MenuItem4: TMenuItem; 51 MenuItem5: TMenuItem;52 MenuItem6: TMenuItem;53 MenuItem7: TMenuItem;54 MenuItem8: TMenuItem;55 MenuItem9: TMenuItem;56 43 PanelMenu: TPanel; 57 44 PanelData: TPanel; 58 PopupMenuObjectGroup: TPopupMenu;59 PopupMenuObject: TPopupMenu;60 45 PopupMenuItem: TPopupMenu; 61 46 Splitter1: TSplitter; … … 67 52 ToolButton4: TToolButton; 68 53 ToolButton5: TToolButton; 69 TreeView1: TTreeView;70 54 procedure AAboutExecute(Sender: TObject); 71 55 procedure AConnectExecute(Sender: TObject); … … 73 57 procedure AExitExecute(Sender: TObject); 74 58 procedure AImportStructureExecute(Sender: TObject); 75 procedure AObjectEditExecute(Sender: TObject);76 procedure AObjectGroupAddGroupExecute(Sender: TObject);77 procedure AObjectGroupDeleteExecute(Sender: TObject);78 procedure AObjectGroupEditExecute(Sender: TObject);79 59 procedure ASettingsExecute(Sender: TObject); 80 60 procedure AToggleFullscreenExecute(Sender: TObject); … … 83 63 procedure FormDestroy(Sender: TObject); 84 64 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);89 65 private 90 66 OriginalBounds: TRect; … … 97 73 MainPanelForm: TItemListForm; 98 74 PersistentForm: TPersistentForm; 99 TreeState: TTreeState;100 75 Report: TReport; 101 76 procedure UpdateInterface; 102 procedure LoadTree;103 77 end; 104 78 … … 119 93 UFormItemView, UFormItemEdit, UFormItemAdd, UFormLogin, UFormSetting, UApplicationInfo, 120 94 UCore, UFormImportStructure, UFormAbout, UFormLoginProfile, UChronisClientDirect, 121 UChronisClient, UChronisClientMySQL, UChronisClientXMLRPC ;95 UChronisClient, UChronisClientMySQL, UChronisClientXMLRPC, UFormMenu; 122 96 123 97 {$R *.lfm} … … 158 132 MainPanelForm.ManualDock(PanelData, nil, alClient); 159 133 MainPanelForm.Align := alClient; 134 FormMenu.ManualDock(PanelMenu, nil, alClient); 135 FormMenu.Align := alClient; 136 FormMenu.Show; 160 137 end; 161 138 … … 181 158 procedure TMainForm.FormCreate(Sender: TObject); 182 159 begin 183 TreeState := TTreeState.Create;184 160 Report := TReport.Create; 185 161 Report.Base := Core.System; … … 192 168 FreeAndNil(MainPanelForm); 193 169 FreeAndNil(Report); 194 FreeAndNil(TreeState);195 170 FreeAndNil(PersistentForm); 196 171 end; … … 201 176 PersistentForm.Save(Self); 202 177 SaveToRegistry; 203 end;204 205 procedure TMainForm.AObjectEditExecute(Sender: TObject);206 begin207 (* if Assigned(TreeView1.Selected) then begin208 SelectedObjectId := 9;209 SelectedItem := Integer(TreeView1.Selected.Data);210 ItemEditForm.Show;211 end;*)212 end;213 214 procedure TMainForm.AObjectGroupAddGroupExecute(Sender: TObject);215 begin216 217 end;218 219 procedure TMainForm.AObjectGroupDeleteExecute(Sender: TObject);220 begin221 222 end;223 224 procedure TMainForm.AObjectGroupEditExecute(Sender: TObject);225 begin226 (* if Assigned(TreeView1.Selected) then begin227 SelectedObjectId := 8;228 SelectedItem := Integer(TreeView1.Selected.Data);229 ItemEditForm.Show;230 end;*)231 178 end; 232 179 … … 302 249 try 303 250 Core.System.Active := True; 304 LoadTree;251 FormMenu.LoadTree; 305 252 except 306 253 on E: Exception do ShowMessage(E.Message); … … 318 265 if Core.System.Active then begin 319 266 Core.System.Active := False; 320 TreeView1.Items.Clear;267 FormMenu.TreeViewMenu.Items.Clear; 321 268 end; 322 269 UpdateInterface; … … 341 288 end; 342 289 343 procedure TMainForm.MenuItem17Click(Sender: TObject);344 begin345 try346 LoginForm := TLoginForm.Create(MainForm);347 LoginForm.ShowModal;348 finally349 LoginForm.Free;350 end;351 end;352 353 procedure TMainForm.MenuItem19Click(Sender: TObject);354 begin355 356 end;357 358 procedure TMainForm.TreeView1Change(Sender: TObject; Node: TTreeNode);359 begin360 AObjectGroupDelete.Enabled := Assigned(TreeView1.Selected);361 AObjectGroupEdit.Enabled := Assigned(TreeView1.Selected);362 if Assigned(TreeView1.Selected) then begin363 if TreeView1.Selected.ImageIndex = 0 then begin364 TreeView1.PopupMenu := PopupMenuObjectGroup;365 PanelData.Visible := False;366 end;367 if TreeView1.Selected.ImageIndex = 1 then begin368 TreeView1.PopupMenu := PopupMenuObject;369 //LoadItemList;370 end;371 end;372 end;373 374 procedure TMainForm.TreeView1DblClick(Sender: TObject);375 begin376 if Assigned(TreeView1.Selected) then begin377 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 var387 Groups: TListProxy;388 Obj: TObjectProxy;389 Objects: TListProxy;390 Obj2: TObjectProxy;391 I: Integer;392 O: Integer;393 NewNode: TTreeNode;394 NewObjectNode: TTreeNode;395 begin396 with TreeView1, Items do begin397 TreeState.SaveTree(TreeView1);398 Clear;399 AddChild(nil, SGroup);400 TopItem.ImageIndex := 0;401 TopItem.SelectedIndex := 0;402 try403 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 begin409 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 try415 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 begin422 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 finally429 Objects.Free;430 end;431 end;432 TopItem.Expand(True);433 finally434 Groups.Free;435 end;436 TreeState.LoadTree(TreeView1);437 end;438 end;439 440 290 end. 441 291
Note:
See TracChangeset
for help on using the changeset viewer.