- Timestamp:
- May 5, 2014, 3:33:31 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UFormMain.lfm
r11 r12 73 73 Action = AShowLog 74 74 end 75 object ToolButton5: TToolButton 76 Left = 93 77 Top = 2 78 Action = AOpenDir 79 DropdownMenu = PopupMenuOpenRecent 80 Style = tbsDropDown 81 end 82 object ToolButton6: TToolButton 83 Left = 128 84 Top = 2 85 Action = ACompare 86 DropdownMenu = PopupMenuCompareRecent 87 Style = tbsDropDown 88 end 75 89 end 76 90 object Memo1: TMemo … … 135 149 object MenuItem7: TMenuItem 136 150 Action = ACompare 151 Caption = 'Compare directory' 152 end 153 object MenuItemCompareRecent: TMenuItem 154 Caption = 'Compare recent' 137 155 end 138 156 object MenuItem9: TMenuItem … … 140 158 end 141 159 object MenuItem10: TMenuItem 142 Caption = 'Exit'160 Action = AExit 143 161 end 144 162 end … … 300 318 ShortCut = 16454 301 319 end 320 object AExit: TAction 321 Caption = 'Exit' 322 OnExecute = AExitExecute 323 ShortCut = 32883 324 end 302 325 end 303 326 object ImageList1: TImageList … … 468 491 } 469 492 end 470 object LastOpenedList 1: TLastOpenedList493 object LastOpenedListOpen: TLastOpenedList 471 494 MaxCount = 10 472 OnChange = LastOpenedList 1Change495 OnChange = LastOpenedListOpenChange 473 496 left = 144 474 497 top = 160 475 498 end 499 object PopupMenuOpenRecent: TPopupMenu 500 left = 194 501 top = 369 502 end 503 object PopupMenuCompareRecent: TPopupMenu 504 left = 192 505 top = 432 506 end 507 object LastOpenedListCompare: TLastOpenedList 508 MaxCount = 10 509 OnChange = LastOpenedListCompareChange 510 left = 144 511 top = 232 512 end 476 513 end -
trunk/UFormMain.pas
r11 r12 19 19 TFormMain = class(TForm) 20 20 ACompare: TAction; 21 AExit: TAction; 21 22 ASearch: TAction; 22 23 AShowList: TAction; … … 26 27 ActionList1: TActionList; 27 28 ImageList1: TImageList; 28 LastOpenedList1: TLastOpenedList; 29 LastOpenedListOpen: TLastOpenedList; 30 LastOpenedListCompare: TLastOpenedList; 29 31 MainMenu1: TMainMenu; 30 32 Memo1: TMemo; 31 33 MenuItem1: TMenuItem; 32 34 MenuItem10: TMenuItem; 35 MenuItemCompareRecent: TMenuItem; 33 36 MenuItem2: TMenuItem; 34 37 MenuItem3: TMenuItem; … … 40 43 MenuItem9: TMenuItem; 41 44 MenuItemOpenRecent: TMenuItem; 45 PopupMenuCompareRecent: TPopupMenu; 46 PopupMenuOpenRecent: TPopupMenu; 42 47 StatusBar1: TStatusBar; 43 48 ToolBar1: TToolBar; … … 46 51 ToolButton3: TToolButton; 47 52 ToolButton4: TToolButton; 53 ToolButton5: TToolButton; 54 ToolButton6: TToolButton; 48 55 TreeView1: TTreeView; 49 56 procedure ACompareExecute(Sender: TObject); 57 procedure AExitExecute(Sender: TObject); 50 58 procedure AOpenDirExecute(Sender: TObject); 51 59 procedure ASearchExecute(Sender: TObject); … … 53 61 procedure AShowLogExecute(Sender: TObject); 54 62 procedure AViemSystemExecute(Sender: TObject); 55 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);56 63 procedure FormCreate(Sender: TObject); 57 64 procedure FormDestroy(Sender: TObject); 58 65 procedure FormShow(Sender: TObject); 59 procedure LastOpenedList1Change(Sender: TObject); 66 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 67 procedure LastOpenedListCompareChange(Sender: TObject); 68 procedure LastOpenedListOpenChange(Sender: TObject); 60 69 procedure MenuItemOpenRecentClick(Sender: TObject); 61 70 procedure TreeView1SelectionChanged(Sender: TObject); … … 63 72 procedure DoLog(Text: string); 64 73 procedure OpenDir(Dir: string); 74 procedure CompareDir(Dir: string); 65 75 public 66 76 AutoOpen: Boolean; … … 85 95 begin 86 96 AutoOpen := True; 87 LastOpenedList1.LoadFromRegistry(RegContext(RootKey, RootPath)); 88 if AutoOpen and (LastOpenedList1.Items.Count > 0) then 89 OpenDir(LastOpenedList1.Items[0]) 97 LastOpenedListOpen.LoadFromRegistry(RegContext(RootKey, RootPath + '/OpenRecent')); 98 LastOpenedListCompare.LoadFromRegistry(RegContext(RootKey, RootPath + '/CompareRecent')); 99 if AutoOpen and (LastOpenedListOpen.Items.Count > 0) then 100 OpenDir(LastOpenedListOpen.Items[0]) 90 101 else Reload; 91 102 end; 92 103 93 procedure TFormMain.LastOpenedList1Change(Sender: TObject); 94 begin 95 LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, AOpenDirExecute); 104 procedure TFormMain.LastOpenedListCompareChange(Sender: TObject); 105 begin 106 LastOpenedListOpen.LoadToMenuItem(MenuItemCompareRecent, ACompareExecute); 107 LastOpenedListOpen.LoadToMenuItem(PopupMenuCompareRecent.Items, ACompareExecute); 108 end; 109 110 procedure TFormMain.LastOpenedListOpenChange(Sender: TObject); 111 begin 112 LastOpenedListOpen.LoadToMenuItem(MenuItemOpenRecent, AOpenDirExecute); 113 LastOpenedListOpen.LoadToMenuItem(PopupMenuOpenRecent.Items, AOpenDirExecute); 96 114 end; 97 115 … … 118 136 begin 119 137 Config.LoadFromDir(Dir); 120 LastOpenedList 1.AddItem(Dir);138 LastOpenedListOpen.AddItem(Dir); 121 139 Reload; 122 140 end; 123 141 124 procedure TFormMain.Reload; 125 var 126 Options: TLoadTreeOptions; 127 begin 128 TreeView1.Items.Clear; 129 if Assigned(Config.TopNode) then begin 130 TreeView1.Items.AddChild(nil, Config.TopNode.GetName); 131 Options := []; 132 if AViemSystem.Checked then Include(Options, toShowSystem); 133 Config.TopNode.LoadTreeNode(TreeView1.TopItem, Options); 134 TreeView1.TopItem.Expanded := True; 135 StatusBar1.Panels[0].Text := 'Count: ' + IntToStr(Config.TopNode.GetCount); 136 end else begin 137 StatusBar1.Panels[0].Text := ''; 138 end; 139 end; 140 141 procedure TFormMain.FocusTreeNode(Node: TMenuNode); 142 var 143 TreeNode: TTreeNode; 144 begin 145 TreeNode := TreeView1.Items.FindNodeWithData(Node); 146 if Assigned(TreeNode) then begin 147 TreeNode.Selected := True; 148 TreeNode.ExpandParents; 149 end; 150 end; 151 152 procedure TFormMain.AOpenDirExecute(Sender: TObject); 153 var 154 OutDir: string; 155 begin 156 if Sender is TMenuItem then begin 157 OpenDir(TMenuItem(Sender).Caption); 158 end; 159 if SelectDirectory('Select Linux source directory', Config.BaseDir, OutDir) then begin 160 OpenDir(OutDir); 161 end; 162 end; 163 164 procedure TFormMain.ASearchExecute(Sender: TObject); 165 begin 166 FormSearch.Show; 167 end; 168 169 procedure TFormMain.ACompareExecute(Sender: TObject); 142 procedure TFormMain.CompareDir(Dir: string); 170 143 var 171 144 List1, List2: TStringList; … … 180 153 Config2 := TConfigMenu.Create; 181 154 Config.TopNode.SaveToList(List1); 182 Config2.LoadFromDir( '/opt/elinos-D6.0/linux/linux-p4-3.0/');155 Config2.LoadFromDir(Dir); 183 156 Config2.TopNode.SaveToList(List2); 184 157 Config.CompareStringLists(List1, List2, Missing1, Missing2); … … 199 172 end; 200 173 174 procedure TFormMain.Reload; 175 var 176 Options: TLoadTreeOptions; 177 begin 178 TreeView1.Items.Clear; 179 if Assigned(Config.TopNode) then begin 180 TreeView1.Items.AddChild(nil, Config.TopNode.GetName); 181 Options := []; 182 if AViemSystem.Checked then Include(Options, toShowSystem); 183 Config.TopNode.LoadTreeNode(TreeView1.TopItem, Options); 184 TreeView1.TopItem.Expanded := True; 185 StatusBar1.Panels[0].Text := 'Count: ' + IntToStr(Config.TopNode.GetCount); 186 end else begin 187 StatusBar1.Panels[0].Text := ''; 188 end; 189 end; 190 191 procedure TFormMain.FocusTreeNode(Node: TMenuNode); 192 var 193 TreeNode: TTreeNode; 194 begin 195 TreeNode := TreeView1.Items.FindNodeWithData(Node); 196 if Assigned(TreeNode) then begin 197 TreeNode.Selected := True; 198 TreeNode.ExpandParents; 199 end; 200 end; 201 202 procedure TFormMain.AOpenDirExecute(Sender: TObject); 203 var 204 OutDir: string; 205 begin 206 if Sender is TMenuItem then begin 207 OpenDir(TMenuItem(Sender).Caption); 208 end else begin 209 if SelectDirectory('Select Linux source directory', Config.BaseDir, OutDir) then begin 210 OpenDir(OutDir); 211 end; 212 end; 213 end; 214 215 procedure TFormMain.ASearchExecute(Sender: TObject); 216 begin 217 FormSearch.Show; 218 end; 219 220 procedure TFormMain.ACompareExecute(Sender: TObject); 221 var 222 OutDir: string; 223 begin 224 if Sender is TMenuItem then begin 225 CompareDir(TMenuItem(Sender).Caption); 226 end else begin 227 if SelectDirectory('Select Linux source directory for compare', Config.BaseDir, OutDir) then begin 228 CompareDir(OutDir); 229 end; 230 end; 231 end; 232 233 procedure TFormMain.AExitExecute(Sender: TObject); 234 begin 235 Application.Terminate; 236 end; 237 201 238 procedure TFormMain.AShowListExecute(Sender: TObject); 202 239 begin … … 217 254 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 218 255 begin 219 LastOpenedList1.SaveToRegistry(RegContext(RootKey, RootPath)); 256 LastOpenedListOpen.SaveToRegistry(RegContext(RootKey, RootPath + '/OpenRecent')); 257 LastOpenedListCompare.SaveToRegistry(RegContext(RootKey, RootPath + '/CompareRecent')); 220 258 end; 221 259
Note:
See TracChangeset
for help on using the changeset viewer.