From 9ca0945d8f4dc8119b38925b6fbb21adf457ff40 Mon Sep 17 00:00:00 2001 From: Vadim Date: Mon, 23 Nov 2015 22:03:09 +0200 Subject: [PATCH 1/8] fix access to data member through pointer --- src/directories.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/directories.cc b/src/directories.cc index b7e5c7e..b643579 100644 --- a/src/directories.cc +++ b/src/directories.cc @@ -215,7 +215,7 @@ void Directories::add_path(const boost::filesystem::path& dir_path, const Gtk::T bool already_added=false; if(*children) { for(auto &child: *children) { - if(child.get_value(column_record.name)==filename) { + if(child->get_value(column_record.name)==filename) { not_deleted.emplace(filename); already_added=true; break; From 6dd5bf8bde29e33b445dab73d188e9c7b103d527 Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 24 Nov 2015 00:21:00 +0200 Subject: [PATCH 2/8] use std::rgex instead boost::regex --- src/cmake.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/cmake.cc b/src/cmake.cc index 03c9004..cbcfa5c 100644 --- a/src/cmake.cc +++ b/src/cmake.cc @@ -1,18 +1,19 @@ #include "cmake.h" #include "singletons.h" #include "filesystem.h" -#include #include "dialogs.h" +#include + #include //TODO: remove using namespace std; //TODO: remove CMake::CMake(const boost::filesystem::path &path) { const auto find_cmake_project=[this](const boost::filesystem::path &cmake_path) { for(auto &line: filesystem::read_lines(cmake_path)) { - const boost::regex project_regex("^ *project *\\(.*$"); - boost::smatch sm; - if(boost::regex_match(line, sm, project_regex)) { + const std::regex project_regex("^ *project *\\(.*$"); + std::smatch sm; + if(std::regex_match(line, sm, project_regex)) { return true; } } @@ -142,9 +143,9 @@ void CMake::find_variables() { end_line=file.size(); if(end_line>start_line) { auto line=file.substr(start_line, end_line-start_line); - const boost::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$"); - boost::smatch sm; - if(boost::regex_match(line, sm, set_regex)) { + const std::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$"); + std::smatch sm; + if(std::regex_match(line, sm, set_regex)) { auto data=sm[2].str(); while(data.size()>0 && data.back()==' ') data.pop_back(); @@ -264,10 +265,10 @@ std::vector > > CMak end_line=file.size(); if(end_line>start_line) { auto line=file.substr(start_line, end_line-start_line); - const boost::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$"); - boost::smatch sm; - if(boost::regex_match(line, sm, function_regex)) { - auto data=sm[1].str(); + const std::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$"); + std::smatch sm; + if(std::regex_match(line, sm, function_regex)) { + auto data=sm[1].str(); while(data.size()>0 && data.back()==' ') data.pop_back(); auto parameters=get_function_parameters(data); From fe143399eae2b0fae0bfd964eebcf018eaa76013 Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 24 Nov 2015 00:34:44 +0200 Subject: [PATCH 3/8] add include guard --- src/files.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/files.h b/src/files.h index dc6e635..32f6fd2 100644 --- a/src/files.h +++ b/src/files.h @@ -1,3 +1,5 @@ +#ifndef JUCI_FILES_H_ +#define JUCI_FILES_H_ #include #define JUCI_VERSION "0.9.6" @@ -373,4 +375,4 @@ const std::string snippetpy = " output=getSnippet(theWord) \n" " juci.replaceWord(output) \n"; - +#endif // JUCI_FILES_H_ From 03ae90b411e4f3e768ae78061fd80ef288fc0602 Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 24 Nov 2015 02:02:03 +0200 Subject: [PATCH 4/8] override virtual functions from gtk::Application --- src/juci.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/juci.h b/src/juci.h index b34df62..5c8f6cd 100644 --- a/src/juci.h +++ b/src/juci.h @@ -8,9 +8,9 @@ class Application : public Gtk::Application { public: Application(); - int on_command_line(const Glib::RefPtr &cmd); - void on_activate(); - void on_startup(); + int on_command_line(const Glib::RefPtr &cmd) override; + void on_activate() override; + void on_startup() override; std::unique_ptr window; private: std::vector directories; From 9734ea89fc552787b0ba1689cec9bb6dc3aebbcb Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 24 Nov 2015 02:37:36 +0200 Subject: [PATCH 5/8] don't hide gtkmm interfaces! (gtkmm doc) --- src/window.cc | 2 +- src/window.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/window.cc b/src/window.cc index b157296..c53443c 100644 --- a/src/window.cc +++ b/src/window.cc @@ -683,7 +683,7 @@ bool Window::on_delete_event (GdkEventAny *event) { return true; } -void Window::hide() { +void Window::on_hide() { auto size=notebook.size(); for(int c=0;c Date: Tue, 24 Nov 2015 05:04:38 +0200 Subject: [PATCH 6/8] restore boost::regex --- src/cmake.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cmake.cc b/src/cmake.cc index cbcfa5c..0a9afdb 100644 --- a/src/cmake.cc +++ b/src/cmake.cc @@ -3,7 +3,7 @@ #include "filesystem.h" #include "dialogs.h" -#include +#include #include //TODO: remove using namespace std; //TODO: remove @@ -11,9 +11,9 @@ using namespace std; //TODO: remove CMake::CMake(const boost::filesystem::path &path) { const auto find_cmake_project=[this](const boost::filesystem::path &cmake_path) { for(auto &line: filesystem::read_lines(cmake_path)) { - const std::regex project_regex("^ *project *\\(.*$"); - std::smatch sm; - if(std::regex_match(line, sm, project_regex)) { + const boost::regex project_regex("^ *project *\\(.*$"); + boost::smatch sm; + if(boost::regex_match(line, sm, project_regex)) { return true; } } @@ -143,9 +143,9 @@ void CMake::find_variables() { end_line=file.size(); if(end_line>start_line) { auto line=file.substr(start_line, end_line-start_line); - const std::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$"); - std::smatch sm; - if(std::regex_match(line, sm, set_regex)) { + const boost::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$"); + boost::smatch sm; + if(boost::regex_match(line, sm, set_regex)) { auto data=sm[2].str(); while(data.size()>0 && data.back()==' ') data.pop_back(); @@ -265,9 +265,9 @@ std::vector > > CMak end_line=file.size(); if(end_line>start_line) { auto line=file.substr(start_line, end_line-start_line); - const std::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$"); - std::smatch sm; - if(std::regex_match(line, sm, function_regex)) { + const boost::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$"); + boost::smatch sm; + if(boost::regex_match(line, sm, function_regex)) { auto data=sm[1].str(); while(data.size()>0 && data.back()==' ') data.pop_back(); From 0117ab4696a0917f259cc5e4dfd5d8f3c7801c7f Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 24 Nov 2015 23:02:18 +0200 Subject: [PATCH 7/8] restore Window::hide --- src/window.cc | 2 +- src/window.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/window.cc b/src/window.cc index 6ba18f4..aa29431 100644 --- a/src/window.cc +++ b/src/window.cc @@ -682,7 +682,7 @@ bool Window::on_delete_event (GdkEventAny *event) { return true; } -void Window::on_hide() { +void Window::hide() { auto size=notebook.size(); for(int c=0;c Date: Thu, 26 Nov 2015 09:36:59 +0100 Subject: [PATCH 8/8] Fixed the hide override issue discussed in #91. We should also add override elsewhere when appropriate. --- src/cmake.cc | 3 +-- src/filesystem.h | 6 +++--- src/window.cc | 13 ++++--------- src/window.h | 6 ++---- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/cmake.cc b/src/cmake.cc index 0a9afdb..0501921 100644 --- a/src/cmake.cc +++ b/src/cmake.cc @@ -2,7 +2,6 @@ #include "singletons.h" #include "filesystem.h" #include "dialogs.h" - #include #include //TODO: remove @@ -268,7 +267,7 @@ std::vector > > CMak const boost::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$"); boost::smatch sm; if(boost::regex_match(line, sm, function_regex)) { - auto data=sm[1].str(); + auto data=sm[1].str(); while(data.size()>0 && data.back()==' ') data.pop_back(); auto parameters=get_function_parameters(data); diff --git a/src/filesystem.h b/src/filesystem.h index 46bcc67..10d51bb 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -1,5 +1,5 @@ -#ifndef JUCI_SOURCEFILE_H_ -#define JUCI_SOURCEFILE_H_ +#ifndef JUCI_FILESYSTEM_H_ +#define JUCI_FILESYSTEM_H_ #include #include #include @@ -26,4 +26,4 @@ public: static bool write(const boost::filesystem::path &path, Glib::RefPtr text_buffer) { return write(path.string(), text_buffer); } }; -#endif // JUCI_SOURCEFILE_H_ +#endif // JUCI_FILESYSTEM_H_ diff --git a/src/window.cc b/src/window.cc index aa29431..559e853 100644 --- a/src/window.cc +++ b/src/window.cc @@ -147,7 +147,7 @@ void Window::set_menu_actions() { notebook.open(Singleton::config->juci_home_path()/"config"/"config.json"); }); menu->add_action("quit", [this]() { - hide(); + close(); }); menu->add_action("new_file", [this]() { @@ -677,19 +677,14 @@ bool Window::on_key_press_event(GdkEventKey *event) { return Gtk::Window::on_key_press_event(event); } -bool Window::on_delete_event (GdkEventAny *event) { - hide(); - return true; -} - -void Window::hide() { +bool Window::on_delete_event(GdkEventAny *event) { auto size=notebook.size(); for(int c=0;ckill_async_executes(); - Gtk::Window::hide(); + return false; } void Window::search_and_replace_entry() { diff --git a/src/window.h b/src/window.h index 957b44d..d02f23c 100644 --- a/src/window.h +++ b/src/window.h @@ -11,9 +11,8 @@ public: Window(); Notebook notebook; -protected: - bool on_key_press_event(GdkEventKey *event); - bool on_delete_event (GdkEventAny *event); + bool on_key_press_event(GdkEventKey *event) override; + bool on_delete_event(GdkEventAny *event) override; private: Gtk::VPaned vpaned; @@ -29,7 +28,6 @@ private: void configure(); void set_menu_actions(); void activate_menu_items(bool activate=true); - void hide(); void search_and_replace_entry(); void set_tab_entry(); void goto_line_entry();