From f4c1a2481cce9faa9297db635dc90338fc826bc7 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 5 Jul 2015 13:13:30 +0200 Subject: [PATCH] Added singleton.*, at the moment only Source::Config made singleton. Tooltips now have yellow background. Also some cleanup. --- juci/CMakeLists.txt | 2 ++ juci/config.cc | 26 ++++++++------- juci/config.h | 2 +- juci/config.json | 1 + juci/notebook.cc | 6 ++-- juci/notebook.h | 2 -- juci/singletons.cc | 3 ++ juci/singletons.h | 20 ++++++++++++ juci/source.cc | 80 +++++++++++++++++++++++---------------------- juci/source.h | 14 ++++---- juci/tooltips.cc | 4 ++- juci/window.cc | 51 ++++++++++++++--------------- juci/window.h | 12 +++---- 13 files changed, 124 insertions(+), 99 deletions(-) create mode 100644 juci/singletons.cc create mode 100644 juci/singletons.h diff --git a/juci/CMakeLists.txt b/juci/CMakeLists.txt index 0fae989..b8474db 100644 --- a/juci/CMakeLists.txt +++ b/juci/CMakeLists.txt @@ -127,6 +127,8 @@ add_executable(${project_name} terminal.cc tooltips.h tooltips.cc + singletons.h + singletons.cc ) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/juci/config.cc b/juci/config.cc index 22418eb..6024824 100644 --- a/juci/config.cc +++ b/juci/config.cc @@ -2,7 +2,7 @@ #include "logging.h" MainConfig::MainConfig() : - keybindings_cfg(), source_cfg() { + keybindings_cfg() { INFO("Reading config file"); boost::property_tree::json_parser::read_json("config.json", cfg_); INFO("Config file read"); @@ -13,6 +13,7 @@ MainConfig::MainConfig() : } void MainConfig::GenerateSource() { + auto source_cfg=Singletons::Config::source(); DEBUG("Fetching source cfg"); // boost::property_tree::ptree auto source_json = cfg_.get_child("source"); @@ -22,30 +23,33 @@ void MainConfig::GenerateSource() { auto visual_json = source_json.get_child("visual"); for (auto &i : visual_json) { if (i.first == "background") { - source_cfg.background = i.second.get_value(); + source_cfg->background = i.second.get_value(); + } + if (i.first == "background_tooltips") { + source_cfg->background_tooltips = i.second.get_value(); } if (i.first == "show_line_numbers") { - source_cfg.show_line_numbers = i.second.get_value() == "1" ? true : false; + source_cfg->show_line_numbers = i.second.get_value() == "1" ? true : false; } if (i.first == "highlight_current_line") { - source_cfg.highlight_current_line = i.second.get_value() == "1" ? true : false; + source_cfg->highlight_current_line = i.second.get_value() == "1" ? true : false; } if (i.first == "font") { - source_cfg.font = i.second.get_value(); + source_cfg->font = i.second.get_value(); } } - source_cfg.tab_size = source_json.get("tab_size"); - for (unsigned c = 0; c < source_cfg.tab_size; c++) { - source_cfg.tab+=" "; + source_cfg->tab_size = source_json.get("tab_size"); + for (unsigned c = 0; c < source_cfg->tab_size; c++) { + source_cfg->tab+=" "; } for (auto &i : colors_json) { - source_cfg.tags[i.first]=i.second.get_value(); + source_cfg->tags[i.first]=i.second.get_value(); } for (auto &i : syntax_json) { - source_cfg.types[i.first]=i.second.get_value(); + source_cfg->types[i.first]=i.second.get_value(); } for (auto &i : extensions_json) { - source_cfg.extensions.emplace_back(i.second.get_value()); + source_cfg->extensions.emplace_back(i.second.get_value()); } DEBUG("Source cfg fetched"); } diff --git a/juci/config.h b/juci/config.h index bbe03cf..c6913fc 100644 --- a/juci/config.h +++ b/juci/config.h @@ -4,6 +4,7 @@ #include #include #include +#include "singletons.h" #include "keybindings.h" #include "source.h" #include "directories.h" @@ -11,7 +12,6 @@ class MainConfig { public: - Source::Config source_cfg; Terminal::Config terminal_cfg; Keybindings::Config keybindings_cfg; Directories::Config dir_cfg; diff --git a/juci/config.json b/juci/config.json index 61d9721..a831e64 100644 --- a/juci/config.json +++ b/juci/config.json @@ -34,6 +34,7 @@ ], "visual": { "background": "white", + "background_tooltips": "yellow", "font": "Monospace", "show_line_numbers": 1, "highlight_current_line": 1 diff --git a/juci/notebook.cc b/juci/notebook.cc index 6c0d90f..1398225 100644 --- a/juci/notebook.cc +++ b/juci/notebook.cc @@ -11,11 +11,9 @@ Notebook::View::View() { Notebook::Controller::Controller(Keybindings::Controller& keybindings, Terminal::Controller& terminal, - Source::Config& source_cfg, Directories::Config& dir_cfg) : terminal(terminal), - directories(dir_cfg), - source_config(source_cfg) { + directories(dir_cfg) { INFO("Create notebook"); refClipboard_ = Gtk::Clipboard::get(); view.pack1(directories.widget(), true, true); @@ -173,7 +171,7 @@ Notebook::Controller::~Controller() { void Notebook::Controller::OnOpenFile(std::string path) { INFO("Notebook open file"); INFO("Notebook create page"); - text_vec_.emplace_back(new Source::Controller(source_config, path, project_path, terminal)); + text_vec_.emplace_back(new Source::Controller(path, project_path, terminal)); scrolledtext_vec_.push_back(new Gtk::ScrolledWindow()); editor_vec_.push_back(new Gtk::HBox()); scrolledtext_vec_.back()->add(*text_vec_.back()->view); diff --git a/juci/notebook.h b/juci/notebook.h index 5aba1bf..8ff76b1 100644 --- a/juci/notebook.h +++ b/juci/notebook.h @@ -24,7 +24,6 @@ namespace Notebook { public: Controller(Keybindings::Controller& keybindings, Terminal::Controller& terminal, - Source::Config& config, Directories::Config& dir_cfg); ~Controller(); Source::View& CurrentTextView(); @@ -51,7 +50,6 @@ namespace Notebook { Glib::RefPtr m_refBuilder; Glib::RefPtr refActionGroup; Terminal::Controller& terminal; - Source::Config& source_config; std::vector scrolledtext_vec_; std::vector editor_vec_; diff --git a/juci/singletons.cc b/juci/singletons.cc new file mode 100644 index 0000000..eaa2909 --- /dev/null +++ b/juci/singletons.cc @@ -0,0 +1,3 @@ +#include "singletons.h" + +std::unique_ptr Singletons::Config::source_=std::unique_ptr(new Source::Config()); diff --git a/juci/singletons.h b/juci/singletons.h new file mode 100644 index 0000000..6098094 --- /dev/null +++ b/juci/singletons.h @@ -0,0 +1,20 @@ +#ifndef JUCI_SINGLETONS_H_ +#define JUCI_SINGLETONS_H_ + +#include "keybindings.h" +#include "source.h" +#include "directories.h" +#include "terminal.h" + +namespace Singletons { + class Config { + public: + static Source::Config *source() { + return source_.get(); + } + private: + static std::unique_ptr source_; + }; +} + +#endif // JUCI_SINGLETONS_H_ diff --git a/juci/source.cc b/juci/source.cc index f75fb72..4e10d05 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -7,6 +7,7 @@ #include #include #include "selectiondialog.h" +#include "singletons.h" bool Source::Config::legal_extension(std::string e) const { std::transform(e.begin(), e.end(),e.begin(), ::tolower); @@ -21,17 +22,23 @@ bool Source::Config::legal_extension(std::string e) const { ////////////// //// View //// ////////////// -Source::View::View(const Source::Config& config, const std::string& file_path, const std::string& project_path): -config(config), file_path(file_path), project_path(project_path) { +Source::View::View(const std::string& file_path, const std::string& project_path): +file_path(file_path), project_path(project_path) { Gsv::init(); set_smart_home_end(Gsv::SMART_HOME_END_BEFORE); - set_show_line_numbers(config.show_line_numbers); - set_highlight_current_line(config.highlight_current_line); + set_show_line_numbers(Singletons::Config::source()->show_line_numbers); + set_highlight_current_line(Singletons::Config::source()->highlight_current_line); sourcefile s(file_path); get_source_buffer()->get_undo_manager()->begin_not_undoable_action(); get_source_buffer()->set_text(s.get_content()); get_source_buffer()->get_undo_manager()->end_not_undoable_action(); search_start = search_end = this->get_buffer()->end(); + + override_font(Pango::FontDescription(Singletons::Config::source()->font)); + override_background_color(Gdk::RGBA(Singletons::Config::source()->background)); + for (auto &item : Singletons::Config::source()->tags) { + get_source_buffer()->create_tag(item.first)->property_foreground() = item.second; + } } string Source::View::get_line(size_t line_number) { @@ -52,7 +59,8 @@ string Source::View::get_line_before_insert() { //Basic indentation bool Source::View::on_key_press(GdkEventKey* key) { - const std::regex spaces_regex(std::string("^(")+config.tab_char+"*).*$"); + auto config=Singletons::Config::source(); + const std::regex spaces_regex(std::string("^(")+config->tab_char+"*).*$"); //Indent as in next or previous line if(key->keyval==GDK_KEY_Return && key->state==0) { int line_nr=get_source_buffer()->get_insert()->get_iter().get_line(); @@ -83,7 +91,7 @@ bool Source::View::on_key_press(GdkEventKey* key) { int line_end=selection_end.get_line(); for(int line=line_start;line<=line_end;line++) { Gtk::TextIter line_it = get_source_buffer()->get_iter_at_line(line); - get_source_buffer()->insert(line_it, config.tab); + get_source_buffer()->insert(line_it, config->tab); } return true; } @@ -96,7 +104,7 @@ bool Source::View::on_key_press(GdkEventKey* key) { for(int line_nr=line_start;line_nr<=line_end;line_nr++) { string line=get_line(line_nr); - if(!(line.size()>=config.tab_size && line.substr(0, config.tab_size)==config.tab)) + if(!(line.size()>=config->tab_size && line.substr(0, config->tab_size)==config->tab)) return true; } @@ -104,7 +112,7 @@ bool Source::View::on_key_press(GdkEventKey* key) { Gtk::TextIter line_it = get_source_buffer()->get_iter_at_line(line_nr); Gtk::TextIter line_plus_it=line_it; - for(unsigned c=0;ctab_size;c++) line_plus_it++; get_source_buffer()->erase(line_it, line_plus_it); } @@ -119,7 +127,7 @@ bool Source::View::on_key_press(GdkEventKey* key) { string previous_line=get_line(line_nr-1); smatch sm; if(std::regex_match(previous_line, sm, spaces_regex)) { - if(line==sm[1] || line==(std::string(sm[1])+config.tab) || (line+config.tab==sm[1])) { + if(line==sm[1] || line==(std::string(sm[1])+config->tab) || (line+config->tab==sm[1])) { Gtk::TextIter line_it = get_source_buffer()->get_iter_at_line(line_nr); get_source_buffer()->erase(line_it, insert_it); } @@ -134,15 +142,9 @@ bool Source::View::on_key_press(GdkEventKey* key) { ////////////////// clang::Index Source::ClangView::clang_index(0, 0); -Source::ClangView::ClangView(const Source::Config& config, const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal): -Source::View(config, file_path, project_path), terminal(terminal), -parse_thread_go(true), parse_thread_mapped(false), parse_thread_stop(false) { - override_font(Pango::FontDescription(config.font)); - override_background_color(Gdk::RGBA(config.background)); - for (auto &item : config.tags) { - get_source_buffer()->create_tag(item.first)->property_foreground() = item.second; - } - +Source::ClangView::ClangView(const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal): +Source::View(file_path, project_path), terminal(terminal), +parse_thread_go(true), parse_thread_mapped(false), parse_thread_stop(false) { int start_offset = get_source_buffer()->begin().get_offset(); int end_offset = get_source_buffer()->end().get_offset(); auto buffer_map=get_buffer_map(); @@ -332,7 +334,7 @@ void Source::ClangView::update_syntax(const std::vector &ranges) for (auto &range : ranges) { std::string type = std::to_string(range.kind); try { - config.types.at(type); + Singletons::Config::source()->types.at(type); } catch (std::exception) { continue; } @@ -347,7 +349,7 @@ void Source::ClangView::update_syntax(const std::vector &ranges) buffer->get_iter_at_line_offset(linum_start, begin); Gtk::TextIter end_iter = buffer->get_iter_at_line_offset(linum_end, end); - buffer->apply_tag_by_name(config.types.at(type), + buffer->apply_tag_by_name(Singletons::Config::source()->types.at(type), begin_iter, end_iter); } } @@ -550,10 +552,11 @@ bool Source::ClangView::on_key_release(GdkEventKey* key) { //Clang indentation //TODO: replace indentation methods with a better implementation or maybe use libclang bool Source::ClangView::on_key_press(GdkEventKey* key) { - const std::regex bracket_regex(std::string("^(")+config.tab_char+"*).*\\{ *$"); - const std::regex no_bracket_statement_regex(std::string("^(")+config.tab_char+"*)(if|for|else if|catch|while) *\\(.*[^;}] *$"); - const std::regex no_bracket_no_para_statement_regex(std::string("^(")+config.tab_char+"*)(else|try|do) *$"); - const std::regex spaces_regex(std::string("^(")+config.tab_char+"*).*$"); + auto config=Singletons::Config::source(); + const std::regex bracket_regex(std::string("^(")+config->tab_char+"*).*\\{ *$"); + const std::regex no_bracket_statement_regex(std::string("^(")+config->tab_char+"*)(if|for|else if|catch|while) *\\(.*[^;}] *$"); + const std::regex no_bracket_no_para_statement_regex(std::string("^(")+config->tab_char+"*)(else|try|do) *$"); + const std::regex spaces_regex(std::string("^(")+config->tab_char+"*).*$"); //Indent depending on if/else/etc and brackets if(key->keyval==GDK_KEY_Return && key->state==0) { @@ -565,35 +568,35 @@ bool Source::ClangView::on_key_press(GdkEventKey* key) { string next_line=get_line(line_nr+1); std::smatch sm2; if(std::regex_match(next_line, sm2, spaces_regex)) { - if(sm2[1].str()==sm[1].str()+config.tab) { - get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config.tab); + if(sm2[1].str()==sm[1].str()+config->tab) { + get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config->tab); scroll_to(get_source_buffer()->get_insert()); return true; } } } - get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config.tab+"\n"+sm[1].str()+"}"); + get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config->tab+"\n"+sm[1].str()+"}"); auto insert_it = get_source_buffer()->get_insert()->get_iter(); - for(size_t c=0;ctab_size+sm[1].str().size();c++) insert_it--; scroll_to(get_source_buffer()->get_insert()); get_source_buffer()->place_cursor(insert_it); return true; } else if(std::regex_match(line, sm, no_bracket_statement_regex)) { - get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config.tab); + get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config->tab); scroll_to(get_source_buffer()->get_insert()); return true; } else if(std::regex_match(line, sm, no_bracket_no_para_statement_regex)) { - get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config.tab); + get_source_buffer()->insert_at_cursor("\n"+sm[1].str()+config->tab); scroll_to(get_source_buffer()->get_insert()); return true; } else if(std::regex_match(line, sm, spaces_regex)) { std::smatch sm2; size_t line_nr=get_source_buffer()->get_insert()->get_iter().get_line(); - if(line_nr>0 && sm[1].str().size()>=config.tab_size) { + if(line_nr>0 && sm[1].str().size()>=config->tab_size) { string previous_line=get_line(line_nr-1); if(!std::regex_match(previous_line, sm2, bracket_regex)) { if(std::regex_match(previous_line, sm2, no_bracket_statement_regex)) { @@ -613,15 +616,15 @@ bool Source::ClangView::on_key_press(GdkEventKey* key) { //Indent left when writing } on a new line else if(key->keyval==GDK_KEY_braceright) { string line=get_line_before_insert(); - if(line.size()>=config.tab_size) { + if(line.size()>=config->tab_size) { for(auto c: line) { - if(c!=config.tab_char) + if(c!=config->tab_char) return false; } Gtk::TextIter insert_it = get_source_buffer()->get_insert()->get_iter(); Gtk::TextIter line_it = get_source_buffer()->get_iter_at_line(insert_it.get_line()); Gtk::TextIter line_plus_it=line_it; - for(unsigned c=0;ctab_size;c++) line_plus_it++; get_source_buffer()->erase(line_it, line_plus_it); @@ -638,15 +641,14 @@ bool Source::ClangView::on_key_press(GdkEventKey* key) { // Source::Controller::Controller() // Constructor for Controller -Source::Controller::Controller(const Source::Config &config, - const std::string& file_path, std::string project_path, Terminal::Controller& terminal) { +Source::Controller::Controller(const std::string& file_path, std::string project_path, Terminal::Controller& terminal) { if(project_path=="") { project_path=boost::filesystem::path(file_path).parent_path().string(); } - if (config.legal_extension(file_path.substr(file_path.find_last_of(".") + 1))) - view=std::unique_ptr(new ClangView(config, file_path, project_path, terminal)); + if (Singletons::Config::source()->legal_extension(file_path.substr(file_path.find_last_of(".") + 1))) + view=std::unique_ptr(new ClangView(file_path, project_path, terminal)); else - view=std::unique_ptr(new GenericView(config, file_path, project_path)); + view=std::unique_ptr(new GenericView(file_path, project_path)); INFO("Source Controller with childs constructed"); } diff --git a/juci/source.h b/juci/source.h index 03c4db5..e9a1ac3 100644 --- a/juci/source.h +++ b/juci/source.h @@ -19,7 +19,7 @@ namespace Source { bool legal_extension(std::string e) const ; unsigned tab_size; bool show_line_numbers, highlight_current_line; - std::string tab, background, font; + std::string tab, background, background_tooltips, font; char tab_char=' '; std::vector extensions; std::unordered_map tags, types; @@ -59,21 +59,20 @@ namespace Source { class View : public Gsv::View { public: - View(const Source::Config& config, const std::string& file_path, const std::string& project_path); + View(const std::string& file_path, const std::string& project_path); std::string get_line(size_t line_number); std::string get_line_before_insert(); std::string file_path; std::string project_path; Gtk::TextIter search_start, search_end; protected: - const Source::Config& config; bool on_key_press(GdkEventKey* key); }; // class View class GenericView : public View { public: - GenericView(const Source::Config& config, const std::string& file_path, const std::string& project_path): - View(config, file_path, project_path) { + GenericView(const std::string& file_path, const std::string& project_path): + View(file_path, project_path) { signal_key_press_event().connect(sigc::mem_fun(*this, &Source::GenericView::on_key_press), false); } private: @@ -84,7 +83,7 @@ namespace Source { class ClangView : public View { public: - ClangView(const Source::Config& config, const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal); + ClangView(const std::string& file_path, const std::string& project_path, Terminal::Controller& terminal); ~ClangView(); // inits the syntax highligthing on file open void init_syntax_highlighting(const std::map @@ -132,8 +131,7 @@ namespace Source { class Controller { public: - Controller(const Source::Config &config, - const std::string& file_path, std::string project_path, Terminal::Controller& terminal); + Controller(const std::string& file_path, std::string project_path, Terminal::Controller& terminal); Glib::RefPtr buffer(); bool is_saved = true; diff --git a/juci/tooltips.cc b/juci/tooltips.cc index d06fdaa..130e4cf 100644 --- a/juci/tooltips.cc +++ b/juci/tooltips.cc @@ -1,5 +1,5 @@ #include "tooltips.h" -#include +#include "singletons.h" Gdk::Rectangle Tooltips::drawn_tooltips_rectangle=Gdk::Rectangle(); @@ -46,11 +46,13 @@ void Tooltip::adjust() { tooltip_widget=std::unique_ptr(new Gtk::TextView(this->get_buffer())); tooltip_widget->set_editable(false); + tooltip_widget->override_background_color(Gdk::RGBA(Singletons::Config::source()->background_tooltips)); window->add(*tooltip_widget); auto layout=Pango::Layout::create(tooltip_widget->get_pango_context()); layout->set_text(tooltip_widget->get_buffer()->get_text()); layout->get_pixel_size(tooltip_width, tooltip_height); + tooltip_height+=2; } int root_x, root_y; diff --git a/juci/window.cc b/juci/window.cc index 0494c5d..72b3ed2 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -3,65 +3,64 @@ Window::Window() : window_box_(Gtk::ORIENTATION_VERTICAL), - main_config_(), - keybindings_(main_config_.keybindings_cfg), - terminal(main_config_.terminal_cfg), - notebook(keybindings(), terminal, - main_config_.source_cfg, - main_config_.dir_cfg), - menu_(keybindings()), - api_(menu_, notebook) { + main_config(), + keybindings(main_config.keybindings_cfg), + terminal(main_config.terminal_cfg), + notebook(keybindings, terminal, + main_config.dir_cfg), + menu(keybindings), + api(menu, notebook) { INFO("Create Window"); set_title("juCi++"); set_default_size(600, 400); set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK); add(window_box_); - keybindings_.action_group_menu()->add(Gtk::Action::create("FileQuit", + keybindings.action_group_menu()->add(Gtk::Action::create("FileQuit", "Quit juCi++"), - Gtk::AccelKey(keybindings_.config_ + Gtk::AccelKey(keybindings.config_ .key_map()["quit"]), [this]() { OnWindowHide(); }); - keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFile", + keybindings.action_group_menu()->add(Gtk::Action::create("FileOpenFile", "Open file"), - Gtk::AccelKey(keybindings_.config_ + Gtk::AccelKey(keybindings.config_ .key_map()["open_file"]), [this]() { OnOpenFile(); }); - keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFolder", + keybindings.action_group_menu()->add(Gtk::Action::create("FileOpenFolder", "Open folder"), - Gtk::AccelKey(keybindings_.config_ + Gtk::AccelKey(keybindings.config_ .key_map()["open_folder"]), [this]() { OnFileOpenFolder(); }); - keybindings_. + keybindings. action_group_menu()-> add(Gtk::Action::create("FileSaveAs", "Save as"), - Gtk::AccelKey(keybindings_.config_ + Gtk::AccelKey(keybindings.config_ .key_map()["save_as"]), [this]() { SaveFileAs(); }); - keybindings_. + keybindings. action_group_menu()-> add(Gtk::Action::create("FileSave", "Save"), - Gtk::AccelKey(keybindings_.config_ + Gtk::AccelKey(keybindings.config_ .key_map()["save"]), [this]() { SaveFile(); }); - keybindings_. + keybindings. action_group_menu()-> add(Gtk::Action::create("ProjectCompileAndRun", "Compile And Run"), - Gtk::AccelKey(keybindings_.config_ + Gtk::AccelKey(keybindings.config_ .key_map()["compile_and_run"]), [this]() { SaveFile(); @@ -83,11 +82,11 @@ Window::Window() : } }); - keybindings_. + keybindings. action_group_menu()-> add(Gtk::Action::create("ProjectCompile", "Compile"), - Gtk::AccelKey(keybindings_.config_ + Gtk::AccelKey(keybindings.config_ .key_map()["compile"]), [this]() { SaveFile(); @@ -106,11 +105,11 @@ Window::Window() : } }); - add_accel_group(keybindings_.ui_manager_menu()->get_accel_group()); - add_accel_group(keybindings_.ui_manager_hidden()->get_accel_group()); - keybindings_.BuildMenu(); + add_accel_group(keybindings.ui_manager_menu()->get_accel_group()); + add_accel_group(keybindings.ui_manager_hidden()->get_accel_group()); + keybindings.BuildMenu(); - window_box_.pack_start(menu_.view(), Gtk::PACK_SHRINK); + window_box_.pack_start(menu.view(), Gtk::PACK_SHRINK); window_box_.pack_start(notebook.entry, Gtk::PACK_SHRINK); paned_.set_position(300); diff --git a/juci/window.h b/juci/window.h index dd63e6a..782029a 100644 --- a/juci/window.h +++ b/juci/window.h @@ -10,19 +10,17 @@ class Window : public Gtk::Window { public: Window(); - MainConfig& main_config() { return main_config_; } // std::string OnSaveFileAs(); Gtk::Box window_box_; virtual ~Window() { } - MainConfig main_config_; - Keybindings::Controller keybindings_; - Menu::Controller menu_; + MainConfig main_config; + Keybindings::Controller keybindings; + Menu::Controller menu; Notebook::Controller notebook; Terminal::Controller terminal; - PluginApi api_; - - Keybindings::Controller& keybindings() { return keybindings_; } + PluginApi api; + private: std::mutex running; Gtk::VPaned paned_;