Skip to content

Commit 7e5fc1c

Browse files
author
SlavaRa
authored
Merge pull request #145 from SlavaRa/develop
closes #144
2 parents 235b8dd + e9815b1 commit 7e5fc1c

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

QuickNavigate/Helpers/FormHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class ShortcutId
135135
public const string RecentProjects = "QuickNavigate.RecentProjects";
136136
public const string GotoNextMember = "QuickNavigate.GotoNextMember";
137137
public const string GotoPreviousMember = "QuickNavigate.GotoPreviousMember";
138+
public const string GotoNextTab = "QuickNavigate.GotoNextTab";
139+
public const string GotoPreviousTab = "QuickNavigate.GotoPreviousTab";
138140
}
139141

140142
class QuickContextMenuItem

QuickNavigate/PluginMain.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,15 @@ public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
123123
}
124124
break;
125125
case EventType.Keys:
126-
var ke = e as KeyEvent;
127-
if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoPreviousMember))
126+
var value = ((KeyEvent) e).Value;
127+
if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoPreviousMember))
128128
GotoPreviousMember();
129-
else if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoNextMember))
129+
else if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoNextMember))
130130
GotoNextMember();
131+
else if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoPreviousTab))
132+
GotoPreviousTab();
133+
else if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoNextTab))
134+
GotoNextTab();
131135
break;
132136
}
133137
}
@@ -198,6 +202,8 @@ void CreateMenuItems()
198202
menu.DropDownItems.Add(item);
199203
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoNextMember, Keys.None);
200204
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoPreviousMember, Keys.None);
205+
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoPreviousTab, Keys.None);
206+
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoNextTab, Keys.None);
201207
}
202208

203209
/// <summary>
@@ -388,6 +394,24 @@ static List<MemberModel> GetCurrentFileMembers()
388394
return result;
389395
}
390396

397+
static void GotoPreviousTab()
398+
{
399+
var documents = PluginBase.MainForm.Documents;
400+
if (documents.Length < 2) return;
401+
var index = Array.IndexOf(documents, PluginBase.MainForm.CurrentDocument) - 1;
402+
if (index == -1) index = documents.Length - 1;
403+
documents[index].Activate();
404+
}
405+
406+
static void GotoNextTab()
407+
{
408+
var documents = PluginBase.MainForm.Documents;
409+
if (documents.Length < 2) return;
410+
var index = Array.IndexOf(documents, PluginBase.MainForm.CurrentDocument) + 1;
411+
if (index == documents.Length) index = 0;
412+
documents[index].Activate();
413+
}
414+
391415
#endregion
392416

393417
static void SetDocumentClass([NotNull] MemberModel model)

0 commit comments

Comments
 (0)