diff --git a/juci/CMakeLists.txt b/juci/CMakeLists.txt index 4dcf244..b7a518e 100644 --- a/juci/CMakeLists.txt +++ b/juci/CMakeLists.txt @@ -3,7 +3,7 @@ set(project_name juci) set(module juci_to_python_api) project (${project_name}) add_definitions(-DBOOST_LOG_DYN_LINK) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -pthread") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -pthread -Wall -Wno-reorder") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/") #You are of course using Homebrew: diff --git a/juci/directories.cc b/juci/directories.cc index 199e4dd..6e8ca9e 100644 --- a/juci/directories.cc +++ b/juci/directories.cc @@ -43,8 +43,6 @@ list_dirs(const boost::filesystem::path& dir_path, unsigned row_id) { boost::filesystem::directory_iterator end_itr; - unsigned dir_counter = row_id; - unsigned file_counter = 0; Gtk::TreeModel::Row child; Gtk::TreeModel::Row row; DEBUG(""); @@ -82,7 +80,7 @@ list_dirs(const boost::filesystem::path& dir_path, int Directories::Controller::count(const std::string path) { int count = 0; - for (int i = 0; i < path.size(); i++) + for (size_t i = 0; i < path.size(); i++) if (path[i] == '/') count++; return count; diff --git a/juci/juci.cc b/juci/juci.cc index 1a6ec46..1ac98c6 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -16,7 +16,7 @@ int Juci::on_command_line(const Glib::RefPtr &cmd) char **argv = cmd->get_arguments(argc); ctx.parse(argc, argv); if(argc>=2) { - for(size_t c=1;cbuffer()->signal_changed().connect([this]() { if(text_vec_.at(CurrentPage())->is_saved) { - std::string path=text_vec_.at(CurrentPage())->view->file_path; + std::string path=CurrentTextView().file_path; size_t pos = path.find_last_of("/\\"); std::string filename=path; if(pos!=std::string::npos) @@ -328,12 +328,8 @@ Gtk::Notebook& Notebook::Controller::Notebook() { return view_.notebook(); } -std::string Notebook::Controller::CurrentPagePath(){ - return text_vec_.at(CurrentPage())->view->file_path; -} - bool Notebook::Controller:: OnSaveFile() { - std::string path=text_vec_.at(CurrentPage())->view->file_path; + std::string path=CurrentTextView().file_path; return OnSaveFile(path); } bool Notebook::Controller:: OnSaveFile(std::string path) { @@ -343,7 +339,7 @@ bool Notebook::Controller:: OnSaveFile(std::string path) { file.open (path); file << CurrentTextView().get_buffer()->get_text(); file.close(); - text_vec_.at(CurrentPage())->view->file_path=path; + CurrentTextView().file_path=path; size_t pos = path.find_last_of("/\\"); std::string filename=path; if(pos!=std::string::npos) @@ -373,8 +369,7 @@ std::string Notebook::Controller::OnSaveFileAs(){ case(Gtk::RESPONSE_OK): { DEBUG("get_filename()"); std::string path = dialog.get_filename(); - unsigned pos = path.find_last_of("/\\"); - return path; + return path; } case(Gtk::RESPONSE_CANCEL): { break; @@ -394,7 +389,7 @@ void Notebook::Controller::AskToSaveDialog() { false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO); dialog.set_secondary_text( "Do you want to save: " + - text_vec_.at(CurrentPage())->view->file_path+" ?"); + CurrentTextView().file_path+" ?"); DEBUG("AskToSaveDialog: run dialog"); int result = dialog.run(); diff --git a/juci/notebook.h b/juci/notebook.h index 597ec6f..8816b86 100644 --- a/juci/notebook.h +++ b/juci/notebook.h @@ -32,7 +32,6 @@ namespace Notebook { Source::View& CurrentTextView(); int CurrentPage(); Gtk::Notebook& Notebook(); - std::string CurrentPagePath(); void OnCloseCurrentPage(); std::string GetCursorWord(); void OnEditCopy(); diff --git a/juci/source.cc b/juci/source.cc index 1993db2..fee103f 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -268,7 +268,7 @@ get_compilation_commands() { std::vector arguments; for (auto &i : cmds) { std::vector lol = i.get_command_as_args(); - for (int a = 1; a < lol.size()-4; a++) { + for (size_t a = 1; a < lol.size()-4; a++) { arguments.emplace_back(lol[a]); } } @@ -439,7 +439,7 @@ bool Source::ClangView::on_key_press(GdkEventKey* key) { string line(get_line_before_insert()); std::smatch sm; if(std::regex_match(line, sm, bracket_regex)) { - size_t line_nr=get_source_buffer()->get_insert()->get_iter().get_line(); + int line_nr=get_source_buffer()->get_insert()->get_iter().get_line(); if((line_nr+1)get_line_count()) { string next_line=get_line(line_nr+1); std::smatch sm2; diff --git a/juci/terminal.cc b/juci/terminal.cc index d6b653d..c58c97b 100644 --- a/juci/terminal.cc +++ b/juci/terminal.cc @@ -8,7 +8,7 @@ Terminal::Config::Config() { } Terminal::Config::Config(Terminal::Config& original) : run_command_(original.run_command_){ - for (auto it = 0; it