Ver código fonte

ADD: Shift+Tab swith group (command: cm_NextGroup)

meteu 9 anos atrás
pai
commit
aa922772aa
5 arquivos alterados com 76 adições e 25 exclusões
  1. 15 4
      src/fmain.lfm
  2. 4 4
      src/fmain.lrt
  3. 14 11
      src/fmain.pas
  4. 1 0
      src/uglobs.pas
  5. 42 6
      src/umaincommands.pas

+ 15 - 4
src/fmain.lfm

@@ -1240,11 +1240,12 @@ object frmMain: TfrmMain
       Caption = 'Groups'
       object mnuNewGroup: TMenuItem
         Action = actNewGroup
-        Caption = 'New Group'
       end
       object mnuRestoreActiveGroup: TMenuItem
         Action = actRestoreActiveGroup
-        Caption = 'Restore Active Group'
+      end
+      object MenuItem1: TMenuItem
+        Action = actDeleteActiveGroup
       end
       object miLine34: TMenuItem
         Caption = '-'
@@ -2401,13 +2402,23 @@ object frmMain: TfrmMain
       OnExecute = actExecute
     end
     object actNewGroup: TAction
-      Caption = 'actNewGroup'
+      Category = 'Groups'
+      Caption = 'New Group'
       OnExecute = actExecute
     end
     object actRestoreActiveGroup: TAction
-      Caption = 'actRestoreActiveGroup'
+      Category = 'Groups'
+      Caption = 'Restore Active Group'
       OnExecute = actExecute
     end
+    object actNextGroup: TAction
+      Category = 'Groups'
+      Caption = 'Switch to next group'
+    end
+    object actDeleteActiveGroup: TAction
+      Category = 'Groups'
+      Caption = 'Delete active group'
+    end
   end
   object pmHotList: TPopupMenu
     Images = imgLstDirectoryHotlist

+ 4 - 4
src/fmain.lrt

@@ -42,8 +42,6 @@ TFRMMAIN.MNUTABOPTIONS.CAPTION=&Options
 TFRMMAIN.MILINE17.CAPTION=-
 TFRMMAIN.MILINE38.CAPTION=-
 TFRMMAIN.MNUGROUPS.CAPTION=Groups
-TFRMMAIN.MNUNEWGROUP.CAPTION=New Group
-TFRMMAIN.MNURESTOREACTIVEGROUP.CAPTION=Restore Active Group
 TFRMMAIN.MILINE34.CAPTION=-
 TFRMMAIN.MNUSHOW.CAPTION=&Show
 TFRMMAIN.MILINE33.CAPTION=-
@@ -229,8 +227,10 @@ TFRMMAIN.ACTCOUNTDIRCONTENT.CAPTION=Sho&w Occupied Space
 TFRMMAIN.ACTTOGGLEFULLSCREENCONSOLE.CAPTION=Toggle fullscreen mode console
 TFRMMAIN.ACTTREEVIEW.CAPTION=&Tree View Panel
 TFRMMAIN.ACTCLOSEDUPLICATETABS.CAPTION=Close Duplicate Tabs
-TFRMMAIN.ACTNEWGROUP.CAPTION=actNewGroup
-TFRMMAIN.ACTRESTOREACTIVEGROUP.CAPTION=actRestoreActiveGroup
+TFRMMAIN.ACTNEWGROUP.CAPTION=New Group
+TFRMMAIN.ACTRESTOREACTIVEGROUP.CAPTION=Restore Active Group
+TFRMMAIN.ACTNEXTGROUP.CAPTION=Switch to next group
+TFRMMAIN.ACTDELETEACTIVEGROUP.CAPTION=Delete active group
 TFRMMAIN.TBEDIT.CAPTION=Edit
 TFRMMAIN.TBDELETE.CAPTION=Delete
 TFRMMAIN.TBCHANGEDIR.CAPTION=CD

+ 14 - 11
src/fmain.pas

@@ -98,6 +98,8 @@ type
     actCopyPathNoSepOfFilesToClip: TAction;
     actDoAnyCmCommand: TAction;
     actCloseDuplicateTabs: TAction;
+    actDeleteActiveGroup: TAction;
+    actNextGroup: TAction;
     actNewGroup: TAction;
     actRestoreActiveGroup: TAction;
     actTreeView: TAction;
@@ -205,6 +207,7 @@ type
     lblRightDriveInfo: TLabel;
     lblLeftDriveInfo: TLabel;
     lblCommandPath: TLabel;
+    MenuItem1: TMenuItem;
     miLine34: TMenuItem;
 
     mnuRestoreActiveGroup: TMenuItem;
@@ -735,6 +738,7 @@ type
 
     procedure LoadGroupXml(AConfig: TXmlConfig; AGroupName: string);
     procedure SaveGroupXml(AConfig: TXmlConfig; AGroupName: string);
+    procedure DeleteGroupXml(AConfig: TXmlConfig; AGroupName: string);
 
     procedure CreateGroupsMainMenuItems; // add menu items on FormCreate if file 'groups.xml' is exists
     procedure ToggleConsole;
@@ -4392,13 +4396,7 @@ end;
 procedure TfrmMain.LoadGroupXml(AConfig: TXmlConfig;
   AGroupName: string);
 var
-  sPath, sViewType: String;
-  iActiveTab: Integer;
-  Page: TFileViewPage;
-  AFileView: TFileView;
-  AFileViewFlags: TFileViewFlags;
-  aFileSource: IFileSource;
-  aParentNode,RootNode, TabNode, ViewNode: TXmlNode;
+  aParentNode: TXmlNode;
 begin
 
   // 1) Verify - is the AGroupName exist in brunch GroupsNameBank?
@@ -4421,10 +4419,7 @@ end;
 procedure TfrmMain.SaveGroupXml(AConfig: TXmlConfig;
   AGroupName: string);
 var
-  I: Integer;
-  TabsSection: String;
-  Page: TFileViewPage;
-  ParentNode,RootNode, TabNode, ViewNode: TXmlNode;
+  ParentNode: TXmlNode;
 begin
 
   // 1) Write New group name to brunch GroupsNameBank
@@ -4439,6 +4434,14 @@ begin
 
 end;
 
+procedure TfrmMain.DeleteGroupXml(AConfig: TXmlConfig; AGroupName: string);
+var
+  ParentNode,RootNode, TabNode, ViewNode: TXmlNode;
+begin
+  ParentNode := AConfig.FindNode(AConfig.RootNode, 'GroupsNameBank', True);
+
+end;
+
 procedure TfrmMain.ToggleConsole;
 begin
   if gTermWindow then

+ 1 - 0
src/uglobs.pas

@@ -848,6 +848,7 @@ begin
       AddIfNotExists(['Ctrl+Home'],[],'cm_ChangeDirToHome');
       AddIfNotExists(['Ctrl+Left'],[],'cm_TransferLeft');
       AddIfNotExists(['Ctrl+Right'],[],'cm_TransferRight');
+      AddIfNotExists(['Shift+Tab'],[],'cm_NextGroup');
     end;
 
   HMForm := HotMan.Forms.FindOrCreate('Viewer');

+ 42 - 6
src/umaincommands.pas

@@ -186,10 +186,9 @@ type
 
    procedure cm_NewGroup(const Params: array of string);
    procedure cm_RestoreActiveGroup(const Params: array of string);
-   procedure cm_SaveGroup(const Params: array of string);
-   procedure cm_LoadGroup(const Params: array of string);
-
-
+   procedure cm_DeleteActiveGroup(const Params: array of string);
+   procedure cm_NextGroup(const Params: array of string);
+   procedure cm_PrevGroup(const Params: array of string);
 
 
    procedure cm_SetTabOptionNormal(const Params: array of string);
@@ -1597,17 +1596,54 @@ begin
   end;
 end;
 
+procedure TMainCommands.cm_DeleteActiveGroup(const Params: array of string);
+var
+   Config: TXmlConfig;
+begin
+  try
+    Config:= TXmlConfig.Create('groups.xml', True);
+    // Del active group in XML
+    frmMain.DeleteGroupXml(Config,frmMain.LastActiveGroup);
+  except
+    on E: Exception do
+      msgError(E.Message);
+  end;
+end;
+
 
-procedure TMainCommands.cm_SaveGroup(const Params: array of string);
+procedure TMainCommands.cm_NextGroup(const Params: array of string);
+var
+  iAct,iStart,cnt:integer;
+  cItem:TMenuItem;
 begin
+  // Found index of first Group
+  iStart:=frmMain.mnuGroups.IndexOfCaption('-')+1;
+  if iStart>=frmMain.mnuGroups.Count then exit;  // if no groups - exit
+
+  // Found index of ative group
+  iAct:=frmMain.mnuGroups.IndexOfCaption(frmMain.LastActiveGroup);
+
+  cnt:=frmMain.mnuGroups.Count;
+  if iAct<iStart then iAct:=iStart else
+  if iAct<=(frmMain.mnuGroups.Count-2) then iAct:=iAct+1 else
+  if iAct=(frmMain.mnuGroups.Count-1) then iAct:=iStart;
 
+  // Set new active group
+  frmMain.LastActiveGroup:=frmMain.mnuGroups.Items[iAct].Caption;
+
+  // and update it
+  cm_RestoreActiveGroup([]);
 end;
 
-procedure TMainCommands.cm_LoadGroup(const Params: array of string);
+
+procedure TMainCommands.cm_PrevGroup(const Params: array of string);
 begin
 
 end;
 
+
+
+
 procedure TMainCommands.cm_SetTabOptionNormal(const Params: array of string);
 begin
   with frmMain.ActiveNotebook.ActivePage do