Browse Source

Fixed crash introduced in last commit, moved compile and compile and run to keybindings control(shift) enter instead of r. Using control-r for rename refactoring.

merge-requests/365/head
eidheim 11 years ago
parent
commit
e68ea923a4
  1. 9
      juci/config.json
  2. 1
      juci/menu.xml
  3. 13
      juci/notebook.cc
  4. 7
      juci/source.cc
  5. 4
      juci/source.h

9
juci/config.json

@ -57,10 +57,11 @@
"edit_undo": "<control>z",
"edit_redo": "<control>y",
"edit_find": "<control>f",
"goto_declaration": "<control>d",
"goto_method": "<control>m",
"compile_and_run": "<control><alt>r",
"compile": "<control>r"
"source_goto_declaration": "<control>d",
"source_goto_method": "<control>m",
"source_rename": "<control>r",
"compile_and_run": "<control>Return",
"compile": "<control><shift>Return"
},
"directoryfilter": {
"ignore": [

1
juci/menu.xml

@ -21,6 +21,7 @@
<menu action='SourceMenu'>
<menuitem action='SourceGotoDeclaration'/>
<menuitem action='SourceGotoMethod'/>
<menuitem action='SourceRename'/>
</menu>
<menu action='ProjectMenu'>
<menuitem action='ProjectCompileAndRun'/>

13
juci/notebook.cc

@ -89,7 +89,7 @@ void Notebook::Controller::CreateKeybindings() {
INFO("Done Redo");
});
menu->action_group->add(Gtk::Action::create("SourceGotoDeclaration", "Go to declaration"), Gtk::AccelKey(menu->key_map["goto_declaration"]), [this]() {
menu->action_group->add(Gtk::Action::create("SourceGotoDeclaration", "Go to declaration"), Gtk::AccelKey(menu->key_map["source_goto_declaration"]), [this]() {
if(CurrentPage()!=-1) {
if(CurrentSourceView()->get_declaration_location) {
auto location=CurrentSourceView()->get_declaration_location();
@ -104,13 +104,22 @@ void Notebook::Controller::CreateKeybindings() {
}
});
menu->action_group->add(Gtk::Action::create("SourceGotoMethod", "Go to method"), Gtk::AccelKey(menu->key_map["goto_method"]), [this]() {
menu->action_group->add(Gtk::Action::create("SourceGotoMethod", "Go to method"), Gtk::AccelKey(menu->key_map["source_goto_method"]), [this]() {
if(CurrentPage()!=-1) {
if(CurrentSourceView()->goto_method) {
CurrentSourceView()->goto_method();
}
}
});
menu->action_group->add(Gtk::Action::create("SourceRename", "Rename function/variable"), Gtk::AccelKey(menu->key_map["source_rename"]), [this]() {
if(CurrentPage()!=-1) {
if(CurrentSourceView()->get_token) {
auto token=CurrentSourceView()->get_token();
CurrentSourceView()->tag_similar_tokens(token);
}
}
});
INFO("Notebook signal handlers sucsess");
}

7
juci/source.cc

@ -897,8 +897,7 @@ Source::ClangViewAutocomplete(file_path, project_path) {
}
});
get_token=[this](){
std::string usr;
get_token=[this]() -> std::string {
if(clang_readable) {
for(auto &token: *clang_tokens) {
if(token.get_kind()==clang::Token_Identifier && token.has_type()) {
@ -906,12 +905,12 @@ Source::ClangViewAutocomplete(file_path, project_path) {
if(insert_offset>=token.offsets.first && insert_offset<=token.offsets.second) {
auto referenced=token.get_cursor().get_referenced();
if(referenced)
usr=referenced.get_usr();
return referenced.get_usr();
}
}
}
}
return usr;
return "";
};
tag_similar_tokens=[this](const std::string &usr){

4
juci/source.h

@ -66,9 +66,9 @@ public:
std::function<std::pair<std::string, unsigned>()> get_declaration_location;
std::function<void()> goto_method;
std::function<const std::string&()> get_token;
std::function<std::string()> get_token;
std::function<void(const std::string &token)> tag_similar_tokens;
std::function<void(const std::string &token)> rename_similar_tokens;
std::function<void(const std::string &token, const std::string &text)> rename_similar_tokens;
protected:
bool on_key_press_event(GdkEventKey* key);
private:

Loading…
Cancel
Save