Browse Source

Gtk::Stock is depricated, so removed these. Cut/Paste/Copy now also works in entries. Redo now has key binding shift-control-z, which is most common. Also keys now use <primary> instead of <control> and thus is more platform independent.

merge-requests/365/head
eidheim 11 years ago
parent
commit
c92e095a85
  1. 5
      juci/config.cc
  2. 38
      juci/config.json
  3. 2
      juci/entrybox.cc
  4. 1
      juci/entrybox.h
  5. 6
      juci/menu.cc
  6. 23
      juci/notebook.cc

5
juci/config.cc

@ -84,11 +84,6 @@ void MainConfig::GenerateKeybindings() {
boost::property_tree::ptree keys_json = cfg_.get_child("keybindings");
for (auto &i : keys_json) {
auto key=i.second.get_value<std::string>();
#ifdef __APPLE__
auto pos=key.find("<control>");
if(pos!=std::string::npos)
key.replace(pos, 9, "<meta>");
#endif
menu->key_map[i.first] = key;
}
DEBUG("Keybindings fetched");

38
juci/config.json

@ -43,25 +43,25 @@
"tab_char": "<space>"
},
"keybindings": {
"new_file": "<control>n",
"open_folder": "<control><alt>o",
"open_file": "<control>o",
"save": "<control>s",
"save_as": "<control><shift>s",
"quit": "<control>q",
"split_window": "<control><alt>s",
"close_tab": "<control>w",
"edit_copy": "<control>c",
"edit_cut": "<control>x",
"edit_paste": "<control>v",
"edit_undo": "<control>z",
"edit_redo": "<control>y",
"edit_find": "<control>f",
"source_goto_declaration": "<control>d",
"source_goto_method": "<control>m",
"source_rename": "<control>r",
"compile_and_run": "<control>Return",
"compile": "<control><shift>Return"
"new_file": "<primary>n",
"open_folder": "<primary><alt>o",
"open_file": "<primary>o",
"save": "<primary>s",
"save_as": "<primary><shift>s",
"quit": "<primary>q",
"split_window": "<primary><alt>s",
"close_tab": "<primary>w",
"edit_copy": "<primary>c",
"edit_cut": "<primary>x",
"edit_paste": "<primary>v",
"edit_undo": "<primary>z",
"edit_redo": "<primary><shift>z",
"edit_find": "<primary>f",
"source_goto_declaration": "<primary>d",
"source_goto_method": "<primary>m",
"source_rename": "<primary>r",
"compile_and_run": "<primary>Return",
"compile": "<primary><shift>Return"
},
"directoryfilter": {
"ignore": [

2
juci/entrybox.cc

@ -40,7 +40,7 @@ EntryBox::EntryBox() : Gtk::Box(Gtk::ORIENTATION_VERTICAL), upper_box(Gtk::ORIEN
}
void EntryBox::clear() {
hide();
Gtk::Box::hide();
entries.clear();
buttons.clear();
toggle_buttons.clear();

1
juci/entrybox.h

@ -33,6 +33,7 @@ public:
Gtk::Box upper_box;
Gtk::Box lower_box;
void clear();
void hide() {clear();}
void show();
std::list<Entry> entries;
std::list<Button> buttons;

6
juci/menu.cc

@ -6,15 +6,15 @@ Menu::Menu() : box(Gtk::ORIENTATION_VERTICAL) {
ui_manager = Gtk::UIManager::create();
action_group->add(Gtk::Action::create("FileNew", "New File"));
action_group->add(Gtk::Action::create("EditMenu", Gtk::Stock::EDIT));
action_group->add(Gtk::Action::create("EditMenu", "Edit"));
action_group->add(Gtk::Action::create("WindowMenu", "_Window"));
action_group->add(Gtk::Action::create("WindowSplitWindow", "Split window"), Gtk::AccelKey(key_map["split_window"]), [this]() {
});
action_group->add(Gtk::Action::create("ProjectMenu", "P_roject"));
action_group->add(Gtk::Action::create("SourceMenu", "_Source"));
action_group->add(Gtk::Action::create("PluginMenu", "_Plugins"));
action_group->add(Gtk::Action::create("HelpMenu", Gtk::Stock::HELP));
action_group->add(Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT), [this]() {
action_group->add(Gtk::Action::create("HelpMenu", "Help"));
action_group->add(Gtk::Action::create("HelpAbout", "About"), [this]() {
});
}

23
juci/notebook.cc

@ -43,7 +43,7 @@ void Notebook::Controller::CreateKeybindings() {
INFO("Notebook create signal handlers");
directories.m_TreeView.signal_row_activated().connect(sigc::mem_fun(*this, &Notebook::Controller::OnDirectoryNavigation));
menu->action_group->add(Gtk::Action::create("FileMenu", Gtk::Stock::FILE));
menu->action_group->add(Gtk::Action::create("FileMenu", "File"));
menu->action_group->add(Gtk::Action::create("FileNewFile", "New file"), Gtk::AccelKey(menu->key_map["new_file"]), [this]() {
OnFileNewFile();
@ -55,17 +55,32 @@ void Notebook::Controller::CreateKeybindings() {
show_search_and_replace();
});
menu->action_group->add(Gtk::Action::create("EditCopy", "Copy"), Gtk::AccelKey(menu->key_map["edit_copy"]), [this]() {
if (Pages() != 0) {
auto window=(Gtk::Window*)view.get_toplevel();
auto widget=window->get_focus();
if(auto entry=dynamic_cast<Gtk::Entry*>(widget))
entry->copy_clipboard();
else {
if (Pages() != 0)
CurrentSourceView()->get_buffer()->copy_clipboard(clipboard);
}
});
menu->action_group->add(Gtk::Action::create("EditCut", "Cut"), Gtk::AccelKey(menu->key_map["edit_cut"]), [this]() {
if (Pages() != 0) {
auto window=(Gtk::Window*)view.get_toplevel();
auto widget=window->get_focus();
if(auto entry=dynamic_cast<Gtk::Entry*>(widget))
entry->cut_clipboard();
else {
if (Pages() != 0)
CurrentSourceView()->get_buffer()->cut_clipboard(clipboard);
}
});
menu->action_group->add(Gtk::Action::create("EditPaste", "Paste"), Gtk::AccelKey(menu->key_map["edit_paste"]), [this]() {
if (Pages() != 0) {
auto window=(Gtk::Window*)view.get_toplevel();
auto widget=window->get_focus();
if(auto entry=dynamic_cast<Gtk::Entry*>(widget))
entry->paste_clipboard();
else {
if (Pages() != 0)
CurrentSourceView()->get_buffer()->paste_clipboard(clipboard);
}
});

Loading…
Cancel
Save