Browse Source

Added label to Run Command, and some minor cleanup.

merge-requests/365/head
eidheim 10 years ago
parent
commit
97bae361f4
  1. 18
      src/notebook.cc
  2. 2
      src/source.cc
  3. 2
      src/source.h
  4. 8
      src/window.cc

18
src/notebook.cc

@ -89,7 +89,7 @@ void Notebook::open(const boost::filesystem::path &file_path) {
source_views.emplace_back(new Source::ClangView(file_path, project_path, language));
}
else
source_views.emplace_back(new Source::GenericView(file_path, language));
source_views.emplace_back(new Source::GenericView(file_path, "", language));
source_views.back()->on_update_status=[this](Source::View* view, const std::string &status) {
if(get_current_page()!=-1 && get_current_view()==view)
@ -191,13 +191,15 @@ bool Notebook::save(int page, bool reparse_needed) {
project_path=cmake.project_path;
}
}
for(auto source_view: source_views) {
if(auto source_clang_view=dynamic_cast<Source::ClangView*>(source_view)) {
if(project_path==source_clang_view->project_path) {
if(source_clang_view->restart_parse())
Singleton::terminal()->async_print("Reparsing "+source_clang_view->file_path.string()+"\n");
else
Singleton::terminal()->async_print("Error: failed to reparse "+source_clang_view->file_path.string()+". Please reopen the file manually.\n");
if(project_path!="") {
for(auto source_view: source_views) {
if(auto source_clang_view=dynamic_cast<Source::ClangView*>(source_view)) {
if(project_path==source_clang_view->project_path) {
if(source_clang_view->restart_parse())
Singleton::terminal()->async_print("Reparsing "+source_clang_view->file_path.string()+"\n");
else
Singleton::terminal()->async_print("Error: failed to reparse "+source_clang_view->file_path.string()+". Please reopen the file manually.\n");
}
}
}
}

2
src/source.cc

@ -1254,7 +1254,7 @@ std::vector<std::string> Source::View::spellcheck_get_suggestions(const Gtk::Tex
/////////////////////
//// GenericView ////
/////////////////////
Source::GenericView::GenericView(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language) : View(file_path, "", language) {
Source::GenericView::GenericView(const boost::filesystem::path &file_path, const boost::filesystem::path &project_path, Glib::RefPtr<Gsv::Language> language) : View(file_path, project_path, language) {
configure();
spellcheck_all=true;

2
src/source.h

@ -181,7 +181,7 @@ namespace Source {
static Glib::RefPtr<CompletionBuffer> create() {return Glib::RefPtr<CompletionBuffer>(new CompletionBuffer());}
};
public:
GenericView(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language);
GenericView(const boost::filesystem::path &file_path, const boost::filesystem::path &project_path, Glib::RefPtr<Gsv::Language> language);
void parse_language_file(Glib::RefPtr<CompletionBuffer> &completion_buffer, bool &has_context_class, const boost::property_tree::ptree &pt);
};

8
src/window.cc

@ -365,6 +365,12 @@ void Window::create_menu() {
});
menu.action_group->add(Gtk::Action::create("ProjectRunCommand", "Run Command"), Gtk::AccelKey(menu.key_map["run_command"]), [this]() {
entry_box.clear();
entry_box.labels.emplace_back();
auto label_it=entry_box.labels.begin();
label_it->update=[label_it](int state, const std::string& message){
label_it->set_text("Run Command directory order: file project path, file directory, opened directory, current directory");
};
label_it->update(0, "");
entry_box.entries.emplace_back(last_run_command, [this](const std::string& content){
if(content!="") {
last_run_command=content;
@ -777,7 +783,7 @@ void Window::rename_token_entry() {
entry_box.labels.emplace_back();
auto label_it=entry_box.labels.begin();
label_it->update=[label_it](int state, const std::string& message){
label_it->set_text("Warning: only opened and parsed tabs will have its content renamed, and modified files will be saved.");
label_it->set_text("Warning: only opened and parsed tabs will have its content renamed, and modified files will be saved");
};
label_it->update(0, "");
entry_box.entries.emplace_back(token->spelling, [this, token](const std::string& content){

Loading…
Cancel
Save