From b789965da5c37d26116ea5941d97bad1d83c2537 Mon Sep 17 00:00:00 2001 From: oyvang Date: Thu, 12 Feb 2015 10:50:28 +0100 Subject: [PATCH] fixed some google style issues --- juci/CMakeLists.txt | 1 - juci/juci.cc | 2 +- juci/keybindings.h | 8 +++- juci/menu.cc | 87 ++++++++++++++++++--------------------- juci/menu.h | 23 +---------- juci/notebook.cc | 0 juci/notebook.h | 0 juci/window.cc | 4 +- juci/{juci.h => window.h} | 3 +- 9 files changed, 53 insertions(+), 75 deletions(-) create mode 100644 juci/notebook.cc create mode 100644 juci/notebook.h rename juci/{juci.h => window.h} (89%) diff --git a/juci/CMakeLists.txt b/juci/CMakeLists.txt index ac95554..0374908 100644 --- a/juci/CMakeLists.txt +++ b/juci/CMakeLists.txt @@ -63,7 +63,6 @@ endif() # name of the executable on Windows will be example.exe add_executable(${project_name} #list of every needed file to create the executable - juci.h juci.cc keybindings menu diff --git a/juci/juci.cc b/juci/juci.cc index 6284f51..1cbdc8b 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -1,4 +1,4 @@ -#include "juci.h" +#include "window.h" diff --git a/juci/keybindings.h b/juci/keybindings.h index 02099f2..bac39b8 100644 --- a/juci/keybindings.h +++ b/juci/keybindings.h @@ -1,3 +1,7 @@ +//juCi++ class that holds every keybinding. +#ifndef JUCI_KEYBINDINGS_H_ +#define JUCI_KEYBINDINGS_H_ + #include "iostream" #include "gtkmm.h" @@ -49,4 +53,6 @@ namespace Keybindings { Keybindings::Model model_; }; -} \ No newline at end of file +} + +#endif // JUCI_KEYBINDINGS_H_ \ No newline at end of file diff --git a/juci/menu.cc b/juci/menu.cc index c8fb794..6736aea 100644 --- a/juci/menu.cc +++ b/juci/menu.cc @@ -1,25 +1,10 @@ #include "menu.h" -/***********************************/ -/* MODEL */ -/***********************************/ - - -Menu::Model::Model() { - - -} - -Menu::Model::~Model() { -} - - // VIEW - Menu::View::View(Gtk::Orientation orientation) : view_(orientation) { -} +}// view controller Gtk::Box &Menu::View::view( Glib::RefPtr ui_manager) { @@ -27,19 +12,15 @@ Gtk::Box &Menu::View::view( return view_; } -Menu::View::~View() { -} -/***********************************/ -/* CONTROLLER */ -/***********************************/ +// CONTROLLER Menu::Controller::Controller(Keybindings::Controller keybindings) : menu_view_(Gtk::ORIENTATION_VERTICAL), - menu_model_(), keybindings_(keybindings) { /* Add action to menues */ /* 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 */ keybindings_.action_group_menu()->add(Gtk::Action::create("FileNew", "New")); keybindings_.action_group_menu()->add(Gtk::Action::create("FileNewStandard", @@ -47,63 +28,78 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : [this]() { 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("c"), [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("h"), [this]() { OnFileNewHeaderFile(); }); /* 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]() { OnFileOpenFile(); }); - keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFolder", "Open folder"), + keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFolder", + "Open folder"), [this]() { OnFileOpenFolder(); }); /* END file menu */ /* START edit menu */ - keybindings_.action_group_menu()->add(Gtk::Action::create("EditMenu", Gtk::Stock::EDIT)); - keybindings_.action_group_menu()->add(Gtk::Action::create("EditCopy", Gtk::Stock::COPY), + keybindings_.action_group_menu()->add(Gtk::Action::create("EditMenu", + Gtk::Stock::EDIT)); + keybindings_.action_group_menu()->add(Gtk::Action::create("EditCopy", + Gtk::Stock::COPY), [this]() { 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]() { 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]() { 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]() { OnEditFind(); }); /* END edit menu */ /* START window menu */ - keybindings_.action_group_menu()->add(Gtk::Action::create("WindowMenu", "_Window")); - keybindings_.action_group_menu()->add(Gtk::Action::create("WindowCloseTab", "Close tab"), + keybindings_.action_group_menu()->add(Gtk::Action::create("WindowMenu", + "_Window")); + keybindings_.action_group_menu()->add(Gtk::Action::create("WindowCloseTab", + "Close tab"), Gtk::AccelKey("w"), [this]() { 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("S"), [this]() { OnWindowSplitWindow(); }); /* END window 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*/ - keybindings_.action_group_menu()->add(Gtk::Action::create("PluginSnippet", "Snippet")); - keybindings_.action_group_menu()->add(Gtk::Action::create("PluginAddSnippet", "Add snippet"), + keybindings_.action_group_menu()->add(Gtk::Action::create("PluginSnippet", + "Snippet")); + keybindings_.action_group_menu()->add(Gtk::Action::create("PluginAddSnippet", + "Add snippet"), Gtk::AccelKey("space"), [this]() { OnPluginAddSnippet(); @@ -111,8 +107,10 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : /* End snippet */ /* END plugin menu */ /* START help menu */ - keybindings_.action_group_menu()->add(Gtk::Action::create("HelpMenu", Gtk::Stock::HELP)); - keybindings_.action_group_menu()->add(Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT), + keybindings_.action_group_menu()->add(Gtk::Action::create("HelpMenu", + Gtk::Stock::HELP)); + keybindings_.action_group_menu()->add(Gtk::Action::create("HelpAbout", + Gtk::Stock::ABOUT), [this]() { OnHelpAbout(); }); @@ -123,8 +121,6 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : [this]() { OnHelpAbout(); }); - - keybindings_.BuildMenu(); keybindings_.BuildHiddenMenu(); @@ -135,8 +131,6 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) : } -Menu::Controller::~Controller() { -} Gtk::Box &Menu::Controller::view() { return menu_view_.view(keybindings_.ui_manager_menu()); @@ -158,7 +152,8 @@ void Menu::Controller::OnFileNewHeaderFile() { } 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"); } diff --git a/juci/menu.h b/juci/menu.h index 22745bd..8641bca 100644 --- a/juci/menu.h +++ b/juci/menu.h @@ -8,50 +8,29 @@ namespace Menu { - class Model { - public: - Model(); - - virtual ~Model(); - - std::string ui_string() { - return ui_string_; - } - - private: - std::string ui_string_; - }; // class Model - class View { public: explicit View(Gtk::Orientation orient); - virtual ~View(); - Gtk::Box &view(Glib::RefPtr ui_manager); protected: Gtk::Box view_; }; // class View - - // controller class Controller { public: explicit Controller(Keybindings::Controller keybindings); - virtual ~Controller(); - Gtk::Box &view(); private: Keybindings::Controller keybindings_; View menu_view_; - Model menu_model_; void OnFileNewEmptyfile(); - /*Signal handlers*/ + // Signal handlers void OnFileNewCCFile(); void OnFileNewHeaderFile(); diff --git a/juci/notebook.cc b/juci/notebook.cc new file mode 100644 index 0000000..e69de29 diff --git a/juci/notebook.h b/juci/notebook.h new file mode 100644 index 0000000..e69de29 diff --git a/juci/window.cc b/juci/window.cc index f1b5d3c..5a7ee49 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -1,4 +1,4 @@ -#include "juci.h" +#include "window.h" Window::Window() : window_box_(Gtk::ORIENTATION_VERTICAL), @@ -19,7 +19,7 @@ Window::Window() : window_box_.pack_start(source().view()); show_all_children(); -} +} // Window constructor Source::Controller& Window::source() { return source_; diff --git a/juci/juci.h b/juci/window.h similarity index 89% rename from juci/juci.h rename to juci/window.h index f7c1efb..c9f6a69 100644 --- a/juci/juci.h +++ b/juci/window.h @@ -1,4 +1,3 @@ -//juCi++ main header file #ifndef JUCI_JUCI_H_ #define JUCI_JUCI_H_ @@ -19,7 +18,7 @@ private: Source::Controller source_; Gtk::Box window_box_; - /*signal handler*/ + //signal handlers void OnSystemQuit(); };