|
|
|
@ -1,25 +1,10 @@ |
|
|
|
#include "menu.h" |
|
|
|
#include "menu.h" |
|
|
|
|
|
|
|
|
|
|
|
/***********************************/ |
|
|
|
|
|
|
|
/* MODEL */ |
|
|
|
|
|
|
|
/***********************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Menu::Model::Model() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Menu::Model::~Model() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// VIEW
|
|
|
|
// VIEW
|
|
|
|
|
|
|
|
|
|
|
|
Menu::View::View(Gtk::Orientation orientation) : |
|
|
|
Menu::View::View(Gtk::Orientation orientation) : |
|
|
|
view_(orientation) { |
|
|
|
view_(orientation) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}// view controller
|
|
|
|
|
|
|
|
|
|
|
|
Gtk::Box &Menu::View::view( |
|
|
|
Gtk::Box &Menu::View::view( |
|
|
|
Glib::RefPtr<Gtk::UIManager> ui_manager) { |
|
|
|
Glib::RefPtr<Gtk::UIManager> ui_manager) { |
|
|
|
@ -27,19 +12,15 @@ Gtk::Box &Menu::View::view( |
|
|
|
return view_; |
|
|
|
return view_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Menu::View::~View() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************/ |
|
|
|
// CONTROLLER
|
|
|
|
/* CONTROLLER */ |
|
|
|
|
|
|
|
/***********************************/ |
|
|
|
|
|
|
|
Menu::Controller::Controller(Keybindings::Controller keybindings) : |
|
|
|
Menu::Controller::Controller(Keybindings::Controller keybindings) : |
|
|
|
menu_view_(Gtk::ORIENTATION_VERTICAL), |
|
|
|
menu_view_(Gtk::ORIENTATION_VERTICAL), |
|
|
|
menu_model_(), |
|
|
|
|
|
|
|
keybindings_(keybindings) { |
|
|
|
keybindings_(keybindings) { |
|
|
|
/* Add action to menues */ |
|
|
|
/* Add action to menues */ |
|
|
|
/* START file menu */ |
|
|
|
/* START file menu */ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileMenu", Gtk::Stock::FILE)); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileMenu", |
|
|
|
|
|
|
|
Gtk::Stock::FILE)); |
|
|
|
/* File->New files */ |
|
|
|
/* File->New files */ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNew", "New")); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNew", "New")); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNewStandard", |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNewStandard", |
|
|
|
@ -47,63 +28,78 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnFileNewEmptyfile(); |
|
|
|
OnFileNewEmptyfile(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNewCC", "New cc file"), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNewCC", |
|
|
|
|
|
|
|
"New cc file"), |
|
|
|
Gtk::AccelKey("<control><alt>c"), |
|
|
|
Gtk::AccelKey("<control><alt>c"), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnFileNewCCFile(); |
|
|
|
OnFileNewCCFile(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNewH","New h file" ), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileNewH", |
|
|
|
|
|
|
|
"New h file"), |
|
|
|
Gtk::AccelKey("<control><alt>h"), |
|
|
|
Gtk::AccelKey("<control><alt>h"), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnFileNewHeaderFile(); |
|
|
|
OnFileNewHeaderFile(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
/* File-> New files end */ |
|
|
|
/* File-> New files end */ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFile", Gtk::Stock::OPEN), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFile", |
|
|
|
|
|
|
|
Gtk::Stock::OPEN), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnFileOpenFile(); |
|
|
|
OnFileOpenFile(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFolder", "Open folder"), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFolder", |
|
|
|
|
|
|
|
"Open folder"), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnFileOpenFolder(); |
|
|
|
OnFileOpenFolder(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
/* END file menu */ |
|
|
|
/* END file menu */ |
|
|
|
/* START edit menu */ |
|
|
|
/* START edit menu */ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditMenu", Gtk::Stock::EDIT)); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditMenu", |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditCopy", Gtk::Stock::COPY), |
|
|
|
Gtk::Stock::EDIT)); |
|
|
|
|
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditCopy", |
|
|
|
|
|
|
|
Gtk::Stock::COPY), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnEditCopy(); |
|
|
|
OnEditCopy(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditCut", Gtk::Stock::CUT), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditCut", |
|
|
|
|
|
|
|
Gtk::Stock::CUT), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnEditCut(); |
|
|
|
OnEditCut(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditPaste", Gtk::Stock::PASTE), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditPaste", |
|
|
|
|
|
|
|
Gtk::Stock::PASTE), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnEditPaste(); |
|
|
|
OnEditPaste(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditFind", Gtk::Stock::FIND), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("EditFind", |
|
|
|
|
|
|
|
Gtk::Stock::FIND), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnEditFind(); |
|
|
|
OnEditFind(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
/* END edit menu */ |
|
|
|
/* END edit menu */ |
|
|
|
/* START window menu */ |
|
|
|
/* START window menu */ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("WindowMenu", "_Window")); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("WindowMenu", |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("WindowCloseTab", "Close tab"), |
|
|
|
"_Window")); |
|
|
|
|
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("WindowCloseTab", |
|
|
|
|
|
|
|
"Close tab"), |
|
|
|
Gtk::AccelKey("<control>w"), |
|
|
|
Gtk::AccelKey("<control>w"), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnWindowCloseTab(); |
|
|
|
OnWindowCloseTab(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("WindowSplitWindow", "Split window"), |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("WindowSplitWindow", |
|
|
|
|
|
|
|
"Split window"), |
|
|
|
Gtk::AccelKey("<control><alt>S"), |
|
|
|
Gtk::AccelKey("<control><alt>S"), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnWindowSplitWindow(); |
|
|
|
OnWindowSplitWindow(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
/* END window menu */ |
|
|
|
/* END window menu */ |
|
|
|
/* START Plugin menu */ |
|
|
|
/* START Plugin menu */ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("PluginMenu", "_Plugins")); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("PluginMenu", |
|
|
|
|
|
|
|
"_Plugins")); |
|
|
|
/*Plugin->snippet*/ |
|
|
|
/*Plugin->snippet*/ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("PluginSnippet", "Snippet")); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("PluginSnippet", |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("PluginAddSnippet", "Add snippet"), |
|
|
|
"Snippet")); |
|
|
|
|
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("PluginAddSnippet", |
|
|
|
|
|
|
|
"Add snippet"), |
|
|
|
Gtk::AccelKey("<alt>space"), |
|
|
|
Gtk::AccelKey("<alt>space"), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnPluginAddSnippet(); |
|
|
|
OnPluginAddSnippet(); |
|
|
|
@ -111,8 +107,10 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : |
|
|
|
/* End snippet */ |
|
|
|
/* End snippet */ |
|
|
|
/* END plugin menu */ |
|
|
|
/* END plugin menu */ |
|
|
|
/* START help menu */ |
|
|
|
/* START help menu */ |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("HelpMenu", Gtk::Stock::HELP)); |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("HelpMenu", |
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT), |
|
|
|
Gtk::Stock::HELP)); |
|
|
|
|
|
|
|
keybindings_.action_group_menu()->add(Gtk::Action::create("HelpAbout", |
|
|
|
|
|
|
|
Gtk::Stock::ABOUT), |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnHelpAbout(); |
|
|
|
OnHelpAbout(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -123,8 +121,6 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : |
|
|
|
[this]() { |
|
|
|
[this]() { |
|
|
|
OnHelpAbout(); |
|
|
|
OnHelpAbout(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
keybindings_.BuildMenu(); |
|
|
|
keybindings_.BuildMenu(); |
|
|
|
keybindings_.BuildHiddenMenu(); |
|
|
|
keybindings_.BuildHiddenMenu(); |
|
|
|
|
|
|
|
|
|
|
|
@ -135,8 +131,6 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Menu::Controller::~Controller() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gtk::Box &Menu::Controller::view() { |
|
|
|
Gtk::Box &Menu::Controller::view() { |
|
|
|
return menu_view_.view(keybindings_.ui_manager_menu()); |
|
|
|
return menu_view_.view(keybindings_.ui_manager_menu()); |
|
|
|
@ -158,7 +152,8 @@ void Menu::Controller::OnFileNewHeaderFile() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Menu::Controller::OnPluginAddSnippet() { |
|
|
|
void Menu::Controller::OnPluginAddSnippet() { |
|
|
|
std::cout << "Add snipper" << std::endl; //TODO(Forgi add you snippet magic code)
|
|
|
|
//TODO(Forgi add you snippet magic code)
|
|
|
|
|
|
|
|
std::cout << "Add snipper" << std::endl; |
|
|
|
juci_api::py::LoadPlugin("snippet"); |
|
|
|
juci_api::py::LoadPlugin("snippet"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|