Browse Source

Preference cleanup: added missing prefix to some menu item key names, and removed clang_types from preferences

merge-requests/365/head
eidheim 8 years ago
parent
commit
2587698565
  1. 2
      CMakeLists.txt
  2. 6
      src/config.cc
  3. 1
      src/config.h
  4. 51
      src/files.h
  5. 36
      src/menu.cc
  6. 26
      src/source_clang.cc
  7. 1
      src/source_clang.h
  8. 38
      src/window.cc

2
CMakeLists.txt

@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 2.8.8) cmake_minimum_required (VERSION 2.8.8)
project(juci) project(juci)
set(JUCI_VERSION "1.4.0.2") set(JUCI_VERSION "1.4.0.3")
set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_NAME "jucipp")
set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>")

6
src/config.cc

@ -171,12 +171,6 @@ void Config::read(const boost::property_tree::ptree &cfg) {
source.wrap_lines = source_json.get<bool>("wrap_lines"); source.wrap_lines = source_json.get<bool>("wrap_lines");
source.highlight_current_line = source_json.get<bool>("highlight_current_line"); source.highlight_current_line = source_json.get<bool>("highlight_current_line");
source.show_line_numbers = source_json.get<bool>("show_line_numbers"); source.show_line_numbers = source_json.get<bool>("show_line_numbers");
for (auto &i : source_json.get_child("clang_types")) {
try {
source.clang_types[std::stoi(i.first)] = i.second.get_value<std::string>();
}
catch(const std::exception &) {}
}
source.clang_format_style = source_json.get<std::string>("clang_format_style"); source.clang_format_style = source_json.get<std::string>("clang_format_style");
source.clang_usages_threads = static_cast<unsigned>(source_json.get<int>("clang_usages_threads")); source.clang_usages_threads = static_cast<unsigned>(source_json.get<int>("clang_usages_threads"));
auto pt_doc_search=cfg.get_child("documentation_searches"); auto pt_doc_search=cfg.get_child("documentation_searches");

1
src/config.h

@ -85,7 +85,6 @@ public:
bool highlight_current_line; bool highlight_current_line;
bool show_line_numbers; bool show_line_numbers;
std::unordered_map<int, std::string> clang_types;
std::string clang_format_style; std::string clang_format_style;
unsigned clang_usages_threads; unsigned clang_usages_threads;

51
src/files.h

@ -58,20 +58,6 @@ R"RAW(
"wrap_lines": false, "wrap_lines": false,
"highlight_current_line": true, "highlight_current_line": true,
"show_line_numbers": true, "show_line_numbers": true,
"clang_types": {
"8": "def:function",
"21": "def:function",
"22": "def:identifier",
"24": "def:function",
"25": "def:function",
"43": "def:type",
"44": "def:type",
"45": "def:type",
"46": "def:identifier",
"109": "def:string",
"702": "def:statement",
"705": "def:comment"
},
"clang_format_style_comment": "IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html", "clang_format_style_comment": "IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html",
"clang_format_style": "ColumnLimit: 0, MaxEmptyLinesToKeep: 2, SpaceBeforeParens: Never, NamespaceIndentation: All, BreakBeforeBraces: Custom, BraceWrapping: {BeforeElse: true, BeforeCatch: true}", "clang_format_style": "ColumnLimit: 0, MaxEmptyLinesToKeep: 2, SpaceBeforeParens: Never, NamespaceIndentation: All, BreakBeforeBraces: Custom, BraceWrapping: {BeforeElse: true, BeforeCatch: true}",
"clang_usages_threads_comment": "The number of threads used in finding usages in unparsed files. -1 corresponds to the number of cores available, and 0 disables the search", "clang_usages_threads_comment": "The number of threads used in finding usages in unparsed files. -1 corresponds to the number of cores available, and 0 disables the search",
@ -85,21 +71,20 @@ R"RAW(
"keybindings": { "keybindings": {
"preferences": "<primary>comma", "preferences": "<primary>comma",
"quit": "<primary>q", "quit": "<primary>q",
"new_file": "<primary>n", "file_new_file": "<primary>n",
"new_folder": "<primary><shift>n", "file_new_folder": "<primary><shift>n",
"open_file": "<primary>o", "file_open_file": "<primary>o",
"open_folder": "<primary><shift>o", "file_open_folder": "<primary><shift>o",
"reload_file": "", "file_reload_file": "",
"save": "<primary>s", "file_save": "<primary>s",
"save_as": "<primary><shift>s", "file_save_as": "<primary><shift>s",
"print": "", "file_print": "",
"edit_undo": "<primary>z", "edit_undo": "<primary>z",
"edit_redo": "<primary><shift>z", "edit_redo": "<primary><shift>z",
"edit_cut": "<primary>x", "edit_cut": "<primary>x",
"edit_copy": "<primary>c", "edit_copy": "<primary>c",
"edit_paste": "<primary>v", "edit_paste": "<primary>v",
"edit_find": "<primary>f", "edit_find": "<primary>f",
"edit_set_tab": "",
"source_spellcheck": "", "source_spellcheck": "",
"source_spellcheck_clear": "", "source_spellcheck_clear": "",
"source_spellcheck_next_error": "<primary><shift>e", "source_spellcheck_next_error": "<primary><shift>e",
@ -128,11 +113,11 @@ R"RAW(
"source_goto_next_diagnostic": "<primary>e", "source_goto_next_diagnostic": "<primary>e",
"source_apply_fix_its": "<control>space", "source_apply_fix_its": "<control>space",
"project_set_run_arguments": "", "project_set_run_arguments": "",
"compile_and_run": "<primary>Return", "project_compile_and_run": "<primary>Return",
"compile": "<primary><shift>Return", "project_compile": "<primary><shift>Return",
"run_command": "<alt>Return", "project_run_command": "<alt>Return",
"kill_last_running": "<primary>Escape", "project_kill_last_running": "<primary>Escape",
"force_kill_last_running": "<primary><shift>Escape", "project_force_kill_last_running": "<primary><shift>Escape",
"debug_set_run_arguments": "", "debug_set_run_arguments": "",
"debug_start_continue": "<primary>y", "debug_start_continue": "<primary>y",
"debug_stop": "<primary><shift>y", "debug_stop": "<primary><shift>y",
@ -147,15 +132,15 @@ R"RAW(
"debug_goto_stop": "<primary><shift>l",)RAW" "debug_goto_stop": "<primary><shift>l",)RAW"
#ifdef __linux #ifdef __linux
R"RAW( R"RAW(
"next_tab": "<primary>Tab", "window_next_tab": "<primary>Tab",
"previous_tab": "<primary><shift>Tab",)RAW" "window_previous_tab": "<primary><shift>Tab",)RAW"
#else #else
R"RAW( R"RAW(
"next_tab": "<primary><alt>Right", "window_next_tab": "<primary><alt>Right",
"previous_tab": "<primary><alt>Left",)RAW" "window_previous_tab": "<primary><alt>Left",)RAW"
#endif #endif
R"RAW( R"RAW(
"close_tab": "<primary>w", "window_close_tab": "<primary>w",
"window_toggle_split": "",)RAW" "window_toggle_split": "",)RAW"
#ifdef __APPLE__ #ifdef __APPLE__
R"RAW( R"RAW(

36
src/menu.cc

@ -113,54 +113,54 @@ const Glib::ustring menu_xml= R"RAW(<interface>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_New _File</attribute> <attribute name='label' translatable='yes'>_New _File</attribute>
<attribute name='action'>app.new_file</attribute> <attribute name='action'>app.file_new_file</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_New _Folder</attribute> <attribute name='label' translatable='yes'>_New _Folder</attribute>
<attribute name='action'>app.new_folder</attribute> <attribute name='action'>app.file_new_folder</attribute>
</item> </item>
<submenu> <submenu>
<attribute name='label' translatable='yes'>_New _Project</attribute> <attribute name='label' translatable='yes'>_New _Project</attribute>
<item> <item>
<attribute name='label' translatable='no'>C</attribute> <attribute name='label' translatable='no'>C</attribute>
<attribute name='action'>app.new_project_c</attribute> <attribute name='action'>app.file_new_project_c</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='no'>C++</attribute> <attribute name='label' translatable='no'>C++</attribute>
<attribute name='action'>app.new_project_cpp</attribute> <attribute name='action'>app.file_new_project_cpp</attribute>
</item> </item>
</submenu> </submenu>
</section> </section>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_Open _File</attribute> <attribute name='label' translatable='yes'>_Open _File</attribute>
<attribute name='action'>app.open_file</attribute> <attribute name='action'>app.file_open_file</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Open _Folder</attribute> <attribute name='label' translatable='yes'>_Open _Folder</attribute>
<attribute name='action'>app.open_folder</attribute> <attribute name='action'>app.file_open_folder</attribute>
</item> </item>
</section> </section>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_Reload _File</attribute> <attribute name='label' translatable='yes'>_Reload _File</attribute>
<attribute name='action'>app.reload_file</attribute> <attribute name='action'>app.file_reload_file</attribute>
</item> </item>
</section> </section>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_Save</attribute> <attribute name='label' translatable='yes'>_Save</attribute>
<attribute name='action'>app.save</attribute> <attribute name='action'>app.file_save</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Save _As</attribute> <attribute name='label' translatable='yes'>_Save _As</attribute>
<attribute name='action'>app.save_as</attribute> <attribute name='action'>app.file_save_as</attribute>
</item> </item>
</section> </section>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_Print</attribute> <attribute name='label' translatable='yes'>_Print</attribute>
<attribute name='action'>app.print</attribute> <attribute name='action'>app.file_print</attribute>
</item> </item>
</section> </section>
</submenu> </submenu>
@ -343,11 +343,11 @@ const Glib::ustring menu_xml= R"RAW(<interface>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Compile _and _Run</attribute> <attribute name='label' translatable='yes'>_Compile _and _Run</attribute>
<attribute name='action'>app.compile_and_run</attribute> <attribute name='action'>app.project_compile_and_run</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Compile</attribute> <attribute name='label' translatable='yes'>_Compile</attribute>
<attribute name='action'>app.compile</attribute> <attribute name='action'>app.project_compile</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Recreate _Build</attribute> <attribute name='label' translatable='yes'>_Recreate _Build</attribute>
@ -357,15 +357,15 @@ const Glib::ustring menu_xml= R"RAW(<interface>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_Run _Command</attribute> <attribute name='label' translatable='yes'>_Run _Command</attribute>
<attribute name='action'>app.run_command</attribute> <attribute name='action'>app.project_run_command</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Kill _Last _Process</attribute> <attribute name='label' translatable='yes'>_Kill _Last _Process</attribute>
<attribute name='action'>app.kill_last_running</attribute> <attribute name='action'>app.project_kill_last_running</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Force _Kill _Last _Process</attribute> <attribute name='label' translatable='yes'>_Force _Kill _Last _Process</attribute>
<attribute name='action'>app.force_kill_last_running</attribute> <attribute name='action'>app.project_force_kill_last_running</attribute>
</item> </item>
</section> </section>
</submenu> </submenu>
@ -439,15 +439,15 @@ const Glib::ustring menu_xml= R"RAW(<interface>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_Next _Tab</attribute> <attribute name='label' translatable='yes'>_Next _Tab</attribute>
<attribute name='action'>app.next_tab</attribute> <attribute name='action'>app.window_next_tab</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Previous _Tab</attribute> <attribute name='label' translatable='yes'>_Previous _Tab</attribute>
<attribute name='action'>app.previous_tab</attribute> <attribute name='action'>app.window_previous_tab</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>_Close _Tab</attribute> <attribute name='label' translatable='yes'>_Close _Tab</attribute>
<attribute name='action'>app.close_tab</attribute> <attribute name='action'>app.window_close_tab</attribute>
</item> </item>
</section> </section>
<section> <section>

26
src/source_clang.cc

@ -21,7 +21,7 @@ Source::ClangViewParse::ClangViewParse(const boost::filesystem::path &file_path,
Usages::Clang::erase_cache(file_path); Usages::Clang::erase_cache(file_path);
auto tag_table=get_buffer()->get_tag_table(); auto tag_table=get_buffer()->get_tag_table();
for (auto &item : Config::get().source.clang_types) { for (auto &item : clang_types()) {
if(!tag_table->lookup(item.second)) { if(!tag_table->lookup(item.second)) {
get_buffer()->create_tag(item.second); get_buffer()->create_tag(item.second);
} }
@ -55,7 +55,7 @@ void Source::ClangViewParse::configure() {
auto scheme = get_source_buffer()->get_style_scheme(); auto scheme = get_source_buffer()->get_style_scheme();
auto tag_table=get_buffer()->get_tag_table(); auto tag_table=get_buffer()->get_tag_table();
for (auto &item : Config::get().source.clang_types) { for (auto &item : clang_types()) {
auto tag = get_buffer()->get_tag_table()->lookup(item.second); auto tag = get_buffer()->get_tag_table()->lookup(item.second);
if(tag) { if(tag) {
auto style = scheme->get_style(item.second); auto style = scheme->get_style(item.second);
@ -208,11 +208,29 @@ void Source::ClangViewParse::soft_reparse(bool delayed) {
}, delayed?1000:0); }, delayed?1000:0);
} }
const std::unordered_map<int, std::string> &Source::ClangViewParse::clang_types() {
static std::unordered_map<int, std::string> types{
{8, "def:function"},
{21, "def:function"},
{22, "def:identifier"},
{24, "def:function"},
{25, "def:function"},
{43, "def:type"},
{44, "def:type"},
{45, "def:type"},
{46, "def:identifier"},
{109, "def:string"},
{702, "def:statement"},
{705, "def:comment"}
};
return types;
}
void Source::ClangViewParse::update_syntax() { void Source::ClangViewParse::update_syntax() {
auto buffer=get_buffer(); auto buffer=get_buffer();
const auto apply_tag=[this, buffer](const std::pair<clangmm::Offset, clangmm::Offset> &offsets, int type) { const auto apply_tag=[this, buffer](const std::pair<clangmm::Offset, clangmm::Offset> &offsets, int type) {
auto type_it=Config::get().source.clang_types.find(type); auto type_it=clang_types().find(type);
if(type_it!=Config::get().source.clang_types.end()) { if(type_it!=clang_types().end()) {
last_syntax_tags.emplace(type_it->second); last_syntax_tags.emplace(type_it->second);
Gtk::TextIter begin_iter = buffer->get_iter_at_line_index(offsets.first.line-1, offsets.first.index-1); Gtk::TextIter begin_iter = buffer->get_iter_at_line_index(offsets.first.line-1, offsets.first.index-1);
Gtk::TextIter end_iter = buffer->get_iter_at_line_index(offsets.second.line-1, offsets.second.index-1); Gtk::TextIter end_iter = buffer->get_iter_at_line_index(offsets.second.line-1, offsets.second.index-1);

1
src/source_clang.h

@ -45,6 +45,7 @@ namespace Source {
private: private:
Glib::ustring parse_thread_buffer; Glib::ustring parse_thread_buffer;
static const std::unordered_map<int, std::string> &clang_types();
void update_syntax(); void update_syntax();
std::set<std::string> last_syntax_tags; std::set<std::string> last_syntax_tags;

38
src/window.cc

@ -148,7 +148,7 @@ void Window::set_menu_actions() {
close(); close();
}); });
menu.add_action("new_file", [this]() { menu.add_action("file_new_file", [this]() {
boost::filesystem::path path = Dialog::new_file(Notebook::get().get_current_folder()); boost::filesystem::path path = Dialog::new_file(Notebook::get().get_current_folder());
if(path!="") { if(path!="") {
if(boost::filesystem::exists(path)) { if(boost::filesystem::exists(path)) {
@ -168,7 +168,7 @@ void Window::set_menu_actions() {
} }
} }
}); });
menu.add_action("new_folder", [this]() { menu.add_action("file_new_folder", [this]() {
auto time_now=std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); auto time_now=std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
boost::filesystem::path path = Dialog::new_folder(Notebook::get().get_current_folder()); boost::filesystem::path path = Dialog::new_folder(Notebook::get().get_current_folder());
if(path!="" && boost::filesystem::exists(path)) { if(path!="" && boost::filesystem::exists(path)) {
@ -184,7 +184,7 @@ void Window::set_menu_actions() {
Directories::get().select(path); Directories::get().select(path);
} }
}); });
menu.add_action("new_project_c", [this]() { menu.add_action("file_new_project_c", [this]() {
boost::filesystem::path project_path = Dialog::new_folder(Notebook::get().get_current_folder()); boost::filesystem::path project_path = Dialog::new_folder(Notebook::get().get_current_folder());
if(project_path!="") { if(project_path!="") {
auto project_name=project_path.filename().string(); auto project_name=project_path.filename().string();
@ -216,7 +216,7 @@ void Window::set_menu_actions() {
Terminal::get().print("Error: Could not create project "+project_path.string()+"\n", true); Terminal::get().print("Error: Could not create project "+project_path.string()+"\n", true);
} }
}); });
menu.add_action("new_project_cpp", [this]() { menu.add_action("file_new_project_cpp", [this]() {
boost::filesystem::path project_path = Dialog::new_folder(Notebook::get().get_current_folder()); boost::filesystem::path project_path = Dialog::new_folder(Notebook::get().get_current_folder());
if(project_path!="") { if(project_path!="") {
auto project_name=project_path.filename().string(); auto project_name=project_path.filename().string();
@ -249,7 +249,7 @@ void Window::set_menu_actions() {
} }
}); });
menu.add_action("open_file", [this]() { menu.add_action("file_open_file", [this]() {
auto folder_path=Notebook::get().get_current_folder(); auto folder_path=Notebook::get().get_current_folder();
if(auto view=Notebook::get().get_current_view()) { if(auto view=Notebook::get().get_current_view()) {
if(!Directories::get().path.empty() && !filesystem::file_in_path(view->file_path, Directories::get().path)) if(!Directories::get().path.empty() && !filesystem::file_in_path(view->file_path, Directories::get().path))
@ -259,13 +259,13 @@ void Window::set_menu_actions() {
if(path!="") if(path!="")
Notebook::get().open(path); Notebook::get().open(path);
}); });
menu.add_action("open_folder", [this]() { menu.add_action("file_open_folder", [this]() {
auto path = Dialog::open_folder(Notebook::get().get_current_folder()); auto path = Dialog::open_folder(Notebook::get().get_current_folder());
if (path!="" && boost::filesystem::exists(path)) if (path!="" && boost::filesystem::exists(path))
Directories::get().open(path); Directories::get().open(path);
}); });
menu.add_action("reload_file", [this]() { menu.add_action("file_reload_file", [this]() {
if(auto view=Notebook::get().get_current_view()) { if(auto view=Notebook::get().get_current_view()) {
Gtk::MessageDialog dialog(*static_cast<Gtk::Window*>(get_toplevel()), "Reload file!", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO); Gtk::MessageDialog dialog(*static_cast<Gtk::Window*>(get_toplevel()), "Reload file!", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO);
dialog.set_default_response(Gtk::RESPONSE_YES); dialog.set_default_response(Gtk::RESPONSE_YES);
@ -299,7 +299,7 @@ void Window::set_menu_actions() {
} }
}); });
menu.add_action("save", [this]() { menu.add_action("file_save", [this]() {
if(auto view=Notebook::get().get_current_view()) { if(auto view=Notebook::get().get_current_view()) {
if(Notebook::get().save_current()) { if(Notebook::get().save_current()) {
if(view->file_path==Config::get().home_juci_path/"config"/"config.json") { if(view->file_path==Config::get().home_juci_path/"config"/"config.json") {
@ -312,7 +312,7 @@ void Window::set_menu_actions() {
} }
} }
}); });
menu.add_action("save_as", [this]() { menu.add_action("file_save_as", [this]() {
if(auto view=Notebook::get().get_current_view()) { if(auto view=Notebook::get().get_current_view()) {
auto path = Dialog::save_file_as(view->file_path); auto path = Dialog::save_file_as(view->file_path);
if(path!="") { if(path!="") {
@ -331,7 +331,7 @@ void Window::set_menu_actions() {
} }
}); });
menu.add_action("print", [this]() { menu.add_action("file_print", [this]() {
if(auto view=Notebook::get().get_current_view()) { if(auto view=Notebook::get().get_current_view()) {
auto print_operation=Gtk::PrintOperation::create(); auto print_operation=Gtk::PrintOperation::create();
auto print_compositor=Gsv::PrintCompositor::create(*view); auto print_compositor=Gsv::PrintCompositor::create(*view);
@ -948,7 +948,7 @@ void Window::set_menu_actions() {
}); });
EntryBox::get().show(); EntryBox::get().show();
}); });
menu.add_action("compile_and_run", [this]() { menu.add_action("project_compile_and_run", [this]() {
if(Project::compiling || Project::debugging) { if(Project::compiling || Project::debugging) {
Info::get().print("Compile or debug in progress"); Info::get().print("Compile or debug in progress");
return; return;
@ -961,7 +961,7 @@ void Window::set_menu_actions() {
Project::current->compile_and_run(); Project::current->compile_and_run();
}); });
menu.add_action("compile", [this]() { menu.add_action("project_compile", [this]() {
if(Project::compiling || Project::debugging) { if(Project::compiling || Project::debugging) {
Info::get().print("Compile or debug in progress"); Info::get().print("Compile or debug in progress");
return; return;
@ -985,7 +985,7 @@ void Window::set_menu_actions() {
Project::current->recreate_build(); Project::current->recreate_build();
}); });
menu.add_action("run_command", [this]() { menu.add_action("project_run_command", [this]() {
EntryBox::get().clear(); EntryBox::get().clear();
EntryBox::get().labels.emplace_back(); EntryBox::get().labels.emplace_back();
auto label_it=EntryBox::get().labels.begin(); auto label_it=EntryBox::get().labels.begin();
@ -1013,10 +1013,10 @@ void Window::set_menu_actions() {
EntryBox::get().show(); EntryBox::get().show();
}); });
menu.add_action("kill_last_running", [this]() { menu.add_action("project_kill_last_running", [this]() {
Terminal::get().kill_last_async_process(); Terminal::get().kill_last_async_process();
}); });
menu.add_action("force_kill_last_running", [this]() { menu.add_action("project_force_kill_last_running", [this]() {
Terminal::get().kill_last_async_process(true); Terminal::get().kill_last_async_process(true);
}); });
@ -1141,13 +1141,13 @@ void Window::set_menu_actions() {
Project::debug_update_status(""); Project::debug_update_status("");
#endif #endif
menu.add_action("next_tab", [this]() { menu.add_action("window_next_tab", [this]() {
Notebook::get().next(); Notebook::get().next();
}); });
menu.add_action("previous_tab", [this]() { menu.add_action("window_previous_tab", [this]() {
Notebook::get().previous(); Notebook::get().previous();
}); });
menu.add_action("close_tab", [this]() { menu.add_action("window_close_tab", [this]() {
if(Notebook::get().get_current_view()) if(Notebook::get().get_current_view())
Notebook::get().close_current(); Notebook::get().close_current();
}); });
@ -1172,7 +1172,7 @@ void Window::activate_menu_items() {
auto &menu = Menu::get(); auto &menu = Menu::get();
auto view=Notebook::get().get_current_view(); auto view=Notebook::get().get_current_view();
menu.actions["reload_file"]->set_enabled(view); menu.actions["file_reload_file"]->set_enabled(view);
menu.actions["source_spellcheck"]->set_enabled(view); menu.actions["source_spellcheck"]->set_enabled(view);
menu.actions["source_spellcheck_clear"]->set_enabled(view); menu.actions["source_spellcheck_clear"]->set_enabled(view);
menu.actions["source_spellcheck_next_error"]->set_enabled(view); menu.actions["source_spellcheck_next_error"]->set_enabled(view);

Loading…
Cancel
Save