Skip to content

Commit

Permalink
Merge pull request #145 from SlavaRa/develop
Browse files Browse the repository at this point in the history
closes #144
  • Loading branch information
SlavaRa authored Jun 11, 2016
2 parents 235b8dd + e9815b1 commit 7e5fc1c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions QuickNavigate/Helpers/FormHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class ShortcutId
public const string RecentProjects = "QuickNavigate.RecentProjects";
public const string GotoNextMember = "QuickNavigate.GotoNextMember";
public const string GotoPreviousMember = "QuickNavigate.GotoPreviousMember";
public const string GotoNextTab = "QuickNavigate.GotoNextTab";
public const string GotoPreviousTab = "QuickNavigate.GotoPreviousTab";
}

class QuickContextMenuItem
Expand Down
30 changes: 27 additions & 3 deletions QuickNavigate/PluginMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
}
break;
case EventType.Keys:
var ke = e as KeyEvent;
if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoPreviousMember))
var value = ((KeyEvent) e).Value;
if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoPreviousMember))
GotoPreviousMember();
else if (ke.Value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoNextMember))
else if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoNextMember))
GotoNextMember();
else if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoPreviousTab))
GotoPreviousTab();
else if (value == PluginBase.MainForm.GetShortcutItemKeys(ShortcutId.GotoNextTab))
GotoNextTab();
break;
}
}
Expand Down Expand Up @@ -198,6 +202,8 @@ void CreateMenuItems()
menu.DropDownItems.Add(item);
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoNextMember, Keys.None);
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoPreviousMember, Keys.None);
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoPreviousTab, Keys.None);
PluginBase.MainForm.RegisterShortcutItem(ShortcutId.GotoNextTab, Keys.None);
}

/// <summary>
Expand Down Expand Up @@ -388,6 +394,24 @@ static List<MemberModel> GetCurrentFileMembers()
return result;
}

static void GotoPreviousTab()
{
var documents = PluginBase.MainForm.Documents;
if (documents.Length < 2) return;
var index = Array.IndexOf(documents, PluginBase.MainForm.CurrentDocument) - 1;
if (index == -1) index = documents.Length - 1;
documents[index].Activate();
}

static void GotoNextTab()
{
var documents = PluginBase.MainForm.Documents;
if (documents.Length < 2) return;
var index = Array.IndexOf(documents, PluginBase.MainForm.CurrentDocument) + 1;
if (index == documents.Length) index = 0;
documents[index].Activate();
}

#endregion

static void SetDocumentClass([NotNull] MemberModel model)
Expand Down

0 comments on commit 7e5fc1c

Please sign in to comment.