1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-08 20:34:05 +02:00

Reorganize global context menu items into a sub-menu

This commit is contained in:
chylex 2016-09-04 13:10:32 +02:00
parent f41523c1b2
commit 1450cc24a3

View File

@ -4,12 +4,14 @@
namespace TweetDck.Core.Handling{
class ContextMenuBrowser : ContextMenuBase{
private const int MenuSettings = 26600;
private const int MenuPlugins = 26005;
private const int MenuAbout = 26601;
private const int MenuMute = 26602;
private const int MenuCopyTweetUrl = 26603;
private const int MenuCopyTweetEmbeddedUrl = 26604;
private const int MenuGlobal = 26600;
private const int MenuMute = 26601;
private const int MenuSettings = 26602;
private const int MenuPlugins = 26003;
private const int MenuAbout = 26604;
private const int MenuCopyTweetUrl = 26610;
private const int MenuCopyTweetEmbeddedUrl = 26611;
private readonly FormBrowser form;
@ -40,15 +42,17 @@ public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser br
RemoveSeparatorIfLast(model);
model.AddSeparator();
}
model.AddItem(CefMenuCommand.Reload, "Reload");
model.AddCheckItem((CefMenuCommand)MenuMute, "Mute notifications");
model.SetChecked((CefMenuCommand)MenuMute, Program.UserConfig.MuteNotifications);
model.AddSeparator();
model.AddItem((CefMenuCommand)MenuSettings, "Settings");
model.AddItem((CefMenuCommand)MenuPlugins, "Plugins");
model.AddItem((CefMenuCommand)MenuAbout, "About "+Program.BrandName);
IMenuModel globalMenu = model.Count == 0 ? model : model.AddSubMenu((CefMenuCommand)MenuGlobal, Program.BrandName);
globalMenu.AddItem(CefMenuCommand.Reload, "Reload browser");
globalMenu.AddCheckItem((CefMenuCommand)MenuMute, "Mute notifications");
globalMenu.SetChecked((CefMenuCommand)MenuMute, Program.UserConfig.MuteNotifications);
globalMenu.AddSeparator();
globalMenu.AddItem((CefMenuCommand)MenuSettings, "Settings");
globalMenu.AddItem((CefMenuCommand)MenuPlugins, "Plugins");
globalMenu.AddItem((CefMenuCommand)MenuAbout, "About "+Program.BrandName);
}
public override bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags){