From 0e3c551c53f438dcbef7203a88b2f6d0476f9e7e Mon Sep 17 00:00:00 2001 From: tedjk Date: Mon, 18 May 2015 16:05:15 +0200 Subject: [PATCH 1/3] added custom keyindings where stock gtk bindings were used. --- juci/api_ext.cc | 15 +++++++++++++++ juci/config.json | 2 ++ juci/menu.cc | 2 +- juci/menu.xml | 2 +- juci/notebook.cc | 12 ++++++------ juci/window.cc | 6 ++++-- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/juci/api_ext.cc b/juci/api_ext.cc index e69de29..9b8b1ba 100644 --- a/juci/api_ext.cc +++ b/juci/api_ext.cc @@ -0,0 +1,15 @@ +#include "api.h" + +BOOST_PYTHON_MODULE(juci_to_python_api) { + using namespace boost::python; + // plugin inclusion + def("addMenuElement", &libjuci::AddMenuElement); + def("addSubMenuElement", &libjuci::AddSubMenuElement); + def("loadPlugin", &libjuci::LoadPlugin); + def("initPlugin", &libjuci::InitPlugin); + + // text editing + def("replaceLine", &libjuci::ReplaceLine); + def("replaceWord", &libjuci::ReplaceWord); + def("getWord", &libjuci::GetWord); + } // module::juci_to_python_api diff --git a/juci/config.json b/juci/config.json index ca3fa5c..8a557f7 100644 --- a/juci/config.json +++ b/juci/config.json @@ -32,10 +32,12 @@ }, "keybindings": { "split_window": "s", + "new_file": "n", "new_h_file": "h", "new_cc_file": "c", "close_tab": "w", "open_folder": "o", + "open_file": "o", "edit_undo": "z", "save": "s", "save_as": "s", diff --git a/juci/menu.cc b/juci/menu.cc index 4fba192..0f09906 100644 --- a/juci/menu.cc +++ b/juci/menu.cc @@ -15,7 +15,7 @@ Menu::Controller::Controller(Keybindings::Controller& keybindings) : menu_view_(Gtk::ORIENTATION_VERTICAL), keybindings_(keybindings) { keybindings_.action_group_menu()->add(Gtk::Action::create("FileNew", - Gtk::Stock::FILE)); + "New File")); keybindings_.action_group_menu()->add(Gtk::Action::create("EditMenu", Gtk::Stock::EDIT)); keybindings_.action_group_menu()->add(Gtk::Action::create("WindowMenu", diff --git a/juci/menu.xml b/juci/menu.xml index eb7bd04..dbe4b12 100644 --- a/juci/menu.xml +++ b/juci/menu.xml @@ -6,7 +6,7 @@ - + diff --git a/juci/notebook.cc b/juci/notebook.cc index 6992658..14ed7b8 100644 --- a/juci/notebook.cc +++ b/juci/notebook.cc @@ -42,17 +42,17 @@ void Notebook::Controller::CreateKeybindings(Keybindings::Controller Gtk::Stock::FILE)); keybindings.action_group_menu()-> - add(Gtk::Action::create("FileNewStandard", - Gtk::Stock::NEW, - "New empty file", - "Create a new file"), + add(Gtk::Action::create("FileNewStandard", + "New empty file"), + Gtk::AccelKey(keybindings.config_ + .key_map()["new_file"]), [this]() { is_new_file_ = true; OnFileNewEmptyfile(); }); keybindings.action_group_menu()-> add(Gtk::Action::create("FileNewCC", - "New cc file"), + "New source file"), Gtk::AccelKey(keybindings.config_ .key_map()["new_cc_file"]), [this]() { @@ -61,7 +61,7 @@ void Notebook::Controller::CreateKeybindings(Keybindings::Controller }); keybindings.action_group_menu()-> add(Gtk::Action::create("FileNewH", - "New h file"), + "New header file"), Gtk::AccelKey(keybindings.config_ .key_map()["new_h_file"]), [this]() { diff --git a/juci/window.cc b/juci/window.cc index 201d4bc..7504fb7 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -21,7 +21,9 @@ Window::Window() : OnWindowHide(); }); keybindings_.action_group_menu()->add(Gtk::Action::create("FileOpenFile", - Gtk::Stock::OPEN), + "Open file"), + Gtk::AccelKey(keybindings_.config_ + .key_map()["open_file"]), [this]() { OnOpenFile(); }); @@ -42,7 +44,7 @@ Window::Window() : }); keybindings_.action_group_menu()->add(Gtk::Action::create("FileSave", - "Save"), + "Save file"), Gtk::AccelKey(keybindings_.config_ .key_map()["save"]), [this]() { From 08bf0cf806d850ea9bbe4a54ccb21770c7f98af9 Mon Sep 17 00:00:00 2001 From: tedjk Date: Mon, 18 May 2015 16:21:48 +0200 Subject: [PATCH 2/3] removed all stock gtk bindings. --- juci/config.json | 14 ++++++++++---- juci/notebook.cc | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/juci/config.json b/juci/config.json index 8a557f7..a97637f 100644 --- a/juci/config.json +++ b/juci/config.json @@ -31,16 +31,22 @@ ] }, "keybindings": { - "split_window": "s", "new_file": "n", "new_h_file": "h", - "new_cc_file": "c", - "close_tab": "w", + "new_cc_file": "c", "open_folder": "o", "open_file": "o", - "edit_undo": "z", "save": "s", "save_as": "s", + + "split_window": "s", + "close_tab": "w", + + "edit_copy": "c", + "edit_cut": "x", + "edit_paste": "v", + "edit_undo": "z", + "edit_find": "f", "compile_and_run": "r", "compile": "r" }, diff --git a/juci/notebook.cc b/juci/notebook.cc index 14ed7b8..45ba31f 100644 --- a/juci/notebook.cc +++ b/juci/notebook.cc @@ -78,7 +78,9 @@ void Notebook::Controller::CreateKeybindings(Keybindings::Controller }); keybindings.action_group_menu()-> add(Gtk::Action::create("EditFind", - Gtk::Stock::FIND), + "Find"), + Gtk::AccelKey(keybindings.config_ + .key_map()["edit_find"]), [this]() { is_new_file_ = false; OnEditSearch(); @@ -86,19 +88,26 @@ void Notebook::Controller::CreateKeybindings(Keybindings::Controller }); keybindings.action_group_menu()-> add(Gtk::Action::create("EditCopy", - Gtk::Stock::COPY), + "Copy"), + Gtk::AccelKey(keybindings.config_ + .key_map()["edit_copy"]), + [this]() { OnEditCopy(); }); keybindings.action_group_menu()-> add(Gtk::Action::create("EditCut", - Gtk::Stock::CUT), + "Cut"), + Gtk::AccelKey(keybindings.config_ + .key_map()["edit_cut"]), [this]() { OnEditCut(); }); keybindings.action_group_menu()-> add(Gtk::Action::create("EditPaste", - Gtk::Stock::PASTE), + "Paste"), + Gtk::AccelKey(keybindings.config_ + .key_map()["edit_paste"]), [this]() { OnEditPaste(); }); From d93b864fdb1f5bb8812444d872a8ac46335af328 Mon Sep 17 00:00:00 2001 From: tedjk Date: Mon, 18 May 2015 16:50:56 +0200 Subject: [PATCH 3/3] removed the last stock gtk binding --- juci/config.json | 1 + juci/window.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/juci/config.json b/juci/config.json index a97637f..9b3e661 100644 --- a/juci/config.json +++ b/juci/config.json @@ -38,6 +38,7 @@ "open_file": "o", "save": "s", "save_as": "s", + "quit": "q", "split_window": "s", "close_tab": "w", diff --git a/juci/window.cc b/juci/window.cc index 7504fb7..bf084f1 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -16,7 +16,9 @@ Window::Window() : set_default_size(600, 400); add(window_box_); keybindings_.action_group_menu()->add(Gtk::Action::create("FileQuit", - Gtk::Stock::QUIT), + "Quit juCi++"), + Gtk::AccelKey(keybindings_.config_ + .key_map()["quit"]), [this]() { OnWindowHide(); });