|
|
|
@ -803,6 +803,21 @@ bool Window::on_key_press_event(GdkEventKey *event) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Window::on_delete_event(GdkEventAny *event) { |
|
|
|
bool Window::on_delete_event(GdkEventAny *event) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
boost::property_tree::ptree pt_root, pt_files; |
|
|
|
|
|
|
|
pt_root.put("folder", Directories::get().path.string()); |
|
|
|
|
|
|
|
for(int c=0;c<notebook.size();c++) { |
|
|
|
|
|
|
|
boost::property_tree::ptree pt_child; |
|
|
|
|
|
|
|
pt_child.put("", notebook.get_view(c)->file_path.string()); |
|
|
|
|
|
|
|
pt_files.push_back(std::make_pair("", pt_child)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pt_root.add_child("files", pt_files); |
|
|
|
|
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
|
|
|
|
pt_root.put("current_file", notebook.get_current_view()->file_path.string()); |
|
|
|
|
|
|
|
boost::property_tree::write_json((Config::get().juci_home_path()/"last_session.json").string(), pt_root); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch(const std::exception &) {} |
|
|
|
|
|
|
|
|
|
|
|
auto size=notebook.size(); |
|
|
|
auto size=notebook.size(); |
|
|
|
for(int c=0;c<size;c++) { |
|
|
|
for(int c=0;c<size;c++) { |
|
|
|
if(!notebook.close_current_page()) |
|
|
|
if(!notebook.close_current_page()) |
|
|
|
@ -876,34 +891,39 @@ void Window::search_and_replace_entry() { |
|
|
|
replace_entry_it->signal_changed().connect([this, replace_entry_it](){ |
|
|
|
replace_entry_it->signal_changed().connect([this, replace_entry_it](){ |
|
|
|
last_replace=replace_entry_it->get_text(); |
|
|
|
last_replace=replace_entry_it->get_text(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
EntryBox::get().buttons.emplace_back("↑", [this](){ |
|
|
|
EntryBox::get().buttons.emplace_back("↑", [this](){ |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
notebook.get_current_view()->search_backward(); |
|
|
|
notebook.get_current_view()->search_backward(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
EntryBox::get().buttons.back().set_tooltip_text("Find previous\n\nShortcut: press Shift+Enter in the search field"); |
|
|
|
EntryBox::get().buttons.back().set_tooltip_text("Find Previous (shortcut: ⇧Enter in entry)"); |
|
|
|
EntryBox::get().buttons.emplace_back("⇄", [this, replace_entry_it](){ |
|
|
|
EntryBox::get().buttons.emplace_back("⇄", [this, replace_entry_it](){ |
|
|
|
if(notebook.get_current_page()!=-1) { |
|
|
|
if(notebook.get_current_page()!=-1) { |
|
|
|
notebook.get_current_view()->replace_forward(replace_entry_it->get_text()); |
|
|
|
notebook.get_current_view()->replace_forward(replace_entry_it->get_text()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
EntryBox::get().buttons.back().set_tooltip_text("Replace current selection\n\nShortcut: press Enter in the replacement field"); |
|
|
|
EntryBox::get().buttons.back().set_tooltip_text("Replace Next (shortcut: Enter in entry)"); |
|
|
|
EntryBox::get().buttons.emplace_back("↓", [this](){ |
|
|
|
EntryBox::get().buttons.emplace_back("↓", [this](){ |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
notebook.get_current_view()->search_forward(); |
|
|
|
notebook.get_current_view()->search_forward(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
EntryBox::get().buttons.back().set_tooltip_text("Find next\n\nShortcut: press Enter in the search field"); |
|
|
|
EntryBox::get().buttons.back().set_tooltip_text("Find Next (shortcut: Enter in entry)"); |
|
|
|
EntryBox::get().buttons.emplace_back("Replace all", [this, replace_entry_it](){ |
|
|
|
EntryBox::get().buttons.emplace_back("Replace All", [this, replace_entry_it](){ |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
notebook.get_current_view()->replace_all(replace_entry_it->get_text()); |
|
|
|
notebook.get_current_view()->replace_all(replace_entry_it->get_text()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
EntryBox::get().toggle_buttons.emplace_back("Match case"); |
|
|
|
EntryBox::get().buttons.back().set_tooltip_text("Replace All"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EntryBox::get().toggle_buttons.emplace_back("Aa"); |
|
|
|
|
|
|
|
EntryBox::get().toggle_buttons.back().set_tooltip_text("Match Case"); |
|
|
|
EntryBox::get().toggle_buttons.back().set_active(case_sensitive_search); |
|
|
|
EntryBox::get().toggle_buttons.back().set_active(case_sensitive_search); |
|
|
|
EntryBox::get().toggle_buttons.back().on_activate=[this, search_entry_it](){ |
|
|
|
EntryBox::get().toggle_buttons.back().on_activate=[this, search_entry_it](){ |
|
|
|
case_sensitive_search=!case_sensitive_search; |
|
|
|
case_sensitive_search=!case_sensitive_search; |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
if(notebook.get_current_page()!=-1) |
|
|
|
notebook.get_current_view()->search_highlight(search_entry_it->get_text(), case_sensitive_search, regex_search); |
|
|
|
notebook.get_current_view()->search_highlight(search_entry_it->get_text(), case_sensitive_search, regex_search); |
|
|
|
}; |
|
|
|
}; |
|
|
|
EntryBox::get().toggle_buttons.emplace_back("Use regex"); |
|
|
|
EntryBox::get().toggle_buttons.emplace_back(".*"); |
|
|
|
|
|
|
|
EntryBox::get().toggle_buttons.back().set_tooltip_text("Use Regex"); |
|
|
|
EntryBox::get().toggle_buttons.back().set_active(regex_search); |
|
|
|
EntryBox::get().toggle_buttons.back().set_active(regex_search); |
|
|
|
EntryBox::get().toggle_buttons.back().on_activate=[this, search_entry_it](){ |
|
|
|
EntryBox::get().toggle_buttons.back().on_activate=[this, search_entry_it](){ |
|
|
|
regex_search=!regex_search; |
|
|
|
regex_search=!regex_search; |
|
|
|
|