From 012754cfe29bf1811270178290f6d8bb393066d5 Mon Sep 17 00:00:00 2001 From: oyvang Date: Wed, 11 Feb 2015 15:33:45 +0100 Subject: [PATCH] dunno what i have done --- juci/juci.cc | 1 - juci/keybindings.cc | 3 +++ juci/menu.cc | 17 ++++++++++++----- juci/menu.h | 2 ++ juci/window.cc | 5 ++++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/juci/juci.cc b/juci/juci.cc index 5b206f6..6284f51 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -7,7 +7,6 @@ int main(int argc, char *argv[]) { argc, argv, "no.sout.juci"); - // app->set_flags(Gio::APPLICATION_NON_UNIQUE); Window window; return app->run(window); diff --git a/juci/keybindings.cc b/juci/keybindings.cc index c112c0a..438da61 100644 --- a/juci/keybindings.cc +++ b/juci/keybindings.cc @@ -4,11 +4,14 @@ Keybindings::Controller::Controller() { action_group_ = Gtk::ActionGroup::create(); ui_manager_ = Gtk::UIManager::create(); + } + Keybindings::Controller::~Controller(){ } void Keybindings::Controller::set_ui_manager_action_group(Glib::RefPtr action_group) { + ui_manager_->insert_action_group(action_group); } void Keybindings::Controller::set_ui_manger_string(std::string ui_string) { diff --git a/juci/menu.cc b/juci/menu.cc index 2fcd916..7fdeb9c 100644 --- a/juci/menu.cc +++ b/juci/menu.cc @@ -38,6 +38,7 @@ Menu::Model::Model() { " " " " " " + " " " " " " " "; @@ -81,14 +82,12 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : [this]() { OnFileNewEmptyfile(); }); - keybindings_.action_group()->add(Gtk::Action::create("FileNewCC", - Gtk::Stock::NEW, "New cc file", "Create a new cc file"), + keybindings_.action_group()->add(Gtk::Action::create("FileNewCC", "New cc file"), Gtk::AccelKey("c"), [this]() { - OnFileNewCCFile(); + OnFileNewCCFile(); }); - keybindings_.action_group()->add(Gtk::Action::create("FileNewH", - Gtk::Stock::NEW, "New h file", "Create a new h file"), + keybindings_.action_group()->add(Gtk::Action::create("FileNewH","New h file" ), Gtk::AccelKey("h"), [this]() { OnFileNewHeaderFile(); @@ -152,6 +151,12 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : [this]() { OnHelpAbout(); }); + keybindings_.action_group()->add(Gtk::Action::create("HelpHide"), + Gtk::AccelKey("K"), + [this]() { + OnHelpAbout(); + }); + /* END help menu */ @@ -159,6 +164,8 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : keybindings_.ui_manager()->add_ui_from_string(menu_model_.ui_string()); keybindings_.ui_manager()->insert_action_group(keybindings_.action_group()); + + } Menu::Controller::~Controller() { diff --git a/juci/menu.h b/juci/menu.h index 1eea96e..b8db48a 100644 --- a/juci/menu.h +++ b/juci/menu.h @@ -31,6 +31,8 @@ namespace Menu { protected: Gtk::Box view_; }; // class View + + // controller class Controller { public: diff --git a/juci/window.cc b/juci/window.cc index b16c80a..d602a74 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -2,7 +2,7 @@ Window::Window() : window_box_(Gtk::ORIENTATION_VERTICAL), - menu_(keybindings_) { + menu_(keybindings_){ set_title("juCi++"); set_default_size(600, 600); add(window_box_); @@ -16,6 +16,9 @@ Window::Window() : window_box_.pack_start(menu_.view(), Gtk::PACK_SHRINK); window_box_.pack_start(source().view()); show_all_children(); + //TODO(Oyvang, Forgi, Zalox) Find a better solution to hide menu items and still have the keybinding + keybindings_.action_group()->get_action("HelpHide")->set_visible(false); + show(); } Source::Controller& Window::source() {