From 08134b0b984a69d964c7b4fb792cd4091feff6d1 Mon Sep 17 00:00:00 2001 From: oyvang Date: Wed, 11 Feb 2015 09:21:02 +0100 Subject: [PATCH 1/3] fixed comments --- juci/menu.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/juci/menu.cc b/juci/menu.cc index e71d574..2f9b1e9 100644 --- a/juci/menu.cc +++ b/juci/menu.cc @@ -7,7 +7,7 @@ Menu::Model::Model() { ui_string_ = - " " + " " " " " " " " @@ -47,9 +47,9 @@ Menu::Model::Model() { Menu::Model::~Model() { } -/***********************************/ -/* VIEW */ -/***********************************/ + +// VIEW + Menu::View::View(Gtk::Orientation orientation) : view_(orientation) { @@ -86,6 +86,7 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : [this]() { OnFileNewCCFile(); }); + keybindings_.action_group()->add(Gtk::Action::create("FileNewH", Gtk::Stock::NEW, "New h file", "Create a new h file"), Gtk::AccelKey("h"), @@ -183,7 +184,7 @@ void Menu::Controller::OnFileNewCCFile() { } void Menu::Controller::OnFileNewHeaderFile() { - std::cout << "New cc file clicked" << std::endl; + std::cout << "New header file clicked" << std::endl; //TODO(Oyvang) Legg til funksjon } From 22408b7f225208667414a7559981b3f1ec78c9a4 Mon Sep 17 00:00:00 2001 From: oyvang Date: Wed, 11 Feb 2015 10:02:33 +0100 Subject: [PATCH 2/3] Fixed view pointers to ref --- juci/juci.h | 3 ++- juci/menu.cc | 8 ++++++-- juci/menu.h | 4 ++-- juci/window.cc | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/juci/juci.h b/juci/juci.h index 715d466..6eb5018 100644 --- a/juci/juci.h +++ b/juci/juci.h @@ -14,7 +14,8 @@ public: Gtk::Box window_box_; std::shared_ptr source(); private: - Menu::Controller menu; + Keybindings::Controller keybindings_; + Menu::Controller menu_; Source::Controller source_; /*signal handler*/ void onSystemQuit(); diff --git a/juci/menu.cc b/juci/menu.cc index c396404..f784407 100644 --- a/juci/menu.cc +++ b/juci/menu.cc @@ -55,10 +55,10 @@ Menu::View::View(Gtk::Orientation orientation) : } -Glib::RefPtr Menu::View::view( +Gtk::Box& Menu::View::view( Glib::RefPtr ui_manager) { view_.pack_start(*ui_manager->get_widget("/MenuBar"), Gtk::PACK_SHRINK); - return Glib::RefPtr(&view_); + return view_; } Menu::View::~View() { @@ -169,6 +169,10 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : Menu::Controller::~Controller() { } +Gtk::Box& Menu::Controller::view() { + return menu_view_.view(keybindings_.ui_manager()); +} + void Menu::Controller::OnFileNewEmptyfile() { std::cout << "New file clicked" << std::endl; //TODO(Oyvang) Legg til funksjon diff --git a/juci/menu.h b/juci/menu.h index 9c5be84..caa9e98 100644 --- a/juci/menu.h +++ b/juci/menu.h @@ -19,7 +19,7 @@ namespace Menu { public: explicit View(Gtk::Orientation orient); virtual ~View(); - Glib::RefPtr view(Glib::RefPtr ui_manager); + Gtk::Box& view(Glib::RefPtr ui_manager); protected: Gtk::Box view_; @@ -29,7 +29,7 @@ namespace Menu { public: explicit Controller(Keybindings::Controller keybindings); virtual ~Controller(); - + Gtk::Box& view(); private: Keybindings::Controller keybindings_; View menu_view_; diff --git a/juci/window.cc b/juci/window.cc index 2fb07c7..9170d53 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -2,13 +2,13 @@ Window::Window() : window_box_(Gtk::ORIENTATION_HORIZONTAL), - menu() { + menu_(keybindings_) { set_title("example juCi++"); set_default_size(600, 600); // window_box_.add(*source_.sourceview()); add(window_box_); - add_accel_group(menu.ui_manager()->get_accel_group()); - window_box_.pack_start(menu.view()); + add_accel_group(keybindings_.ui_manager()->get_accel_group()); + window_box_.pack_start(menu_.view()); show_all_children(); } From a2f3df919254e4886a82d2345bb90e89a7b9922d Mon Sep 17 00:00:00 2001 From: oyvang Date: Wed, 11 Feb 2015 10:11:28 +0100 Subject: [PATCH 3/3] removed quit function --- juci/menu.cc | 2 +- juci/window.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/juci/menu.cc b/juci/menu.cc index f784407..9d028f2 100644 --- a/juci/menu.cc +++ b/juci/menu.cc @@ -191,7 +191,7 @@ void Menu::Controller::OnFileNewHeaderFile() { void Menu::Controller::OnSystemQuit() { //TODO(Oyvang, Zalox, Forgie) Add everything that needs to be done before quiting /*Quit the system*/ - Gtk::Main::quit(); //TODO(Oyvang, Zalox, Forgie) methode is depricated, find a better solution. + } void Menu::Controller::OnPluginAddSnippet() { diff --git a/juci/window.cc b/juci/window.cc index 9170d53..4e27b3b 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -10,6 +10,7 @@ Window::Window() : add_accel_group(keybindings_.ui_manager()->get_accel_group()); window_box_.pack_start(menu_.view()); show_all_children(); + } std::shared_ptr Window::source() {