|
|
|
@ -39,13 +39,9 @@ Glib::RefPtr<Gsv::Language> Source::guess_language(const std::string &file_path) |
|
|
|
Source::View::View(const std::string& file_path, const std::string& project_path): |
|
|
|
Source::View::View(const std::string& file_path, const std::string& project_path): |
|
|
|
file_path(file_path), project_path(project_path) { |
|
|
|
file_path(file_path), project_path(project_path) { |
|
|
|
set_smart_home_end(Gsv::SMART_HOME_END_BEFORE);
|
|
|
|
set_smart_home_end(Gsv::SMART_HOME_END_BEFORE);
|
|
|
|
set_show_line_numbers(Singleton::Config::source()->show_line_numbers); |
|
|
|
|
|
|
|
set_highlight_current_line(Singleton::Config::source()->highlight_current_line); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_source_buffer()->begin_not_undoable_action(); |
|
|
|
get_source_buffer()->begin_not_undoable_action(); |
|
|
|
juci::filesystem::read(file_path, get_buffer()); |
|
|
|
juci::filesystem::read(file_path, get_buffer()); |
|
|
|
get_source_buffer()->end_not_undoable_action(); |
|
|
|
get_source_buffer()->end_not_undoable_action(); |
|
|
|
|
|
|
|
|
|
|
|
get_buffer()->place_cursor(get_buffer()->get_iter_at_offset(0));
|
|
|
|
get_buffer()->place_cursor(get_buffer()->get_iter_at_offset(0));
|
|
|
|
search_settings = gtk_source_search_settings_new(); |
|
|
|
search_settings = gtk_source_search_settings_new(); |
|
|
|
gtk_source_search_settings_set_wrap_around(search_settings, true); |
|
|
|
gtk_source_search_settings_set_wrap_around(search_settings, true); |
|
|
|
@ -66,8 +62,8 @@ file_path(file_path), project_path(project_path) { |
|
|
|
style_scheme_manager->prepend_search_path(Singleton::style_dir()); |
|
|
|
style_scheme_manager->prepend_search_path(Singleton::style_dir()); |
|
|
|
|
|
|
|
|
|
|
|
auto scheme = style_scheme_manager->get_scheme(Singleton::Config::source()->theme); |
|
|
|
auto scheme = style_scheme_manager->get_scheme(Singleton::Config::source()->theme); |
|
|
|
|
|
|
|
|
|
|
|
if(scheme) { |
|
|
|
if(scheme) { |
|
|
|
scheme->_cpp_destruction_is_in_progress() |
|
|
|
|
|
|
|
get_source_buffer()->set_style_scheme(scheme); |
|
|
|
get_source_buffer()->set_style_scheme(scheme); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -279,12 +275,29 @@ clang::Index Source::ClangViewParse::clang_index(0, 0); |
|
|
|
|
|
|
|
|
|
|
|
Source::ClangViewParse::ClangViewParse(const std::string& file_path, const std::string& project_path): |
|
|
|
Source::ClangViewParse::ClangViewParse(const std::string& file_path, const std::string& project_path): |
|
|
|
Source::View(file_path, project_path) { |
|
|
|
Source::View(file_path, project_path) { |
|
|
|
override_font(Pango::FontDescription(Singleton::Config::source()->font)); |
|
|
|
INFO("Tagtable beeing filled"); |
|
|
|
override_background_color(Gdk::RGBA(Singleton::Config::source()->background)); |
|
|
|
|
|
|
|
override_background_color(Gdk::RGBA(Singleton::Config::source()->background_selected), Gtk::StateFlags::STATE_FLAG_SELECTED); |
|
|
|
|
|
|
|
for (auto &item : Singleton::Config::source()->tags) { |
|
|
|
for (auto &item : Singleton::Config::source()->tags) { |
|
|
|
|
|
|
|
auto scheme = get_source_buffer()->get_style_scheme(); |
|
|
|
|
|
|
|
auto style = scheme->get_style(item.second); |
|
|
|
|
|
|
|
if (style) { |
|
|
|
|
|
|
|
DEBUG("Style " + item.second + " found in style " + scheme->get_name()); |
|
|
|
|
|
|
|
auto tag = get_source_buffer()->create_tag(item.first); |
|
|
|
|
|
|
|
if (style->property_foreground_set()) |
|
|
|
|
|
|
|
tag->property_foreground() = style->property_foreground(); |
|
|
|
|
|
|
|
if (style->property_background_set()) |
|
|
|
|
|
|
|
tag->property_background() = style->property_background(); |
|
|
|
|
|
|
|
if (style->property_strikethrough_set()) |
|
|
|
|
|
|
|
tag->property_strikethrough() = style->property_strikethrough(); |
|
|
|
|
|
|
|
// // if (style->property_bold_set()) tag->property_weight() = style->property_bold();
|
|
|
|
|
|
|
|
// // if (style->property_italic_set()) tag->property_italic() = style->property_italic();
|
|
|
|
|
|
|
|
// // if (style->property_line_background_set()) tag->property_line_background() = style->property_line_background();
|
|
|
|
|
|
|
|
// // if (style->property_underline_set()) tag->property_underline() = style->property_underline();
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
DEBUG("Style " + item.second + " not found in " + scheme->get_name()); |
|
|
|
get_source_buffer()->create_tag(item.first)->property_foreground() = item.second; |
|
|
|
get_source_buffer()->create_tag(item.first)->property_foreground() = item.second; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
INFO("Tagtable filled");
|
|
|
|
|
|
|
|
|
|
|
|
//Create underline color tags for diagnostic warnings and errors:
|
|
|
|
//Create underline color tags for diagnostic warnings and errors:
|
|
|
|
auto diagnostic_tag=get_buffer()->get_tag_table()->lookup("diagnostic_warning"); |
|
|
|
auto diagnostic_tag=get_buffer()->get_tag_table()->lookup("diagnostic_warning"); |
|
|
|
@ -479,7 +492,7 @@ void Source::ClangViewParse::update_syntax() { |
|
|
|
buffer->remove_tag_by_name(tag, buffer->begin(), buffer->end()); |
|
|
|
buffer->remove_tag_by_name(tag, buffer->begin(), buffer->end()); |
|
|
|
last_syntax_tags.clear(); |
|
|
|
last_syntax_tags.clear(); |
|
|
|
for (auto &range : ranges) { |
|
|
|
for (auto &range : ranges) { |
|
|
|
std::string type = std::to_string(range.kind); |
|
|
|
auto type = std::to_string(range.kind); |
|
|
|
try { |
|
|
|
try { |
|
|
|
last_syntax_tags.emplace(Singleton::Config::source()->types.at(type)); |
|
|
|
last_syntax_tags.emplace(Singleton::Config::source()->types.at(type)); |
|
|
|
} catch (std::exception) { |
|
|
|
} catch (std::exception) { |
|
|
|
@ -490,6 +503,7 @@ void Source::ClangViewParse::update_syntax() { |
|
|
|
Gtk::TextIter end_iter = buffer->get_iter_at_offset(range.end_offset); |
|
|
|
Gtk::TextIter end_iter = buffer->get_iter_at_offset(range.end_offset); |
|
|
|
buffer->apply_tag_by_name(Singleton::Config::source()->types.at(type), |
|
|
|
buffer->apply_tag_by_name(Singleton::Config::source()->types.at(type), |
|
|
|
begin_iter, end_iter); |
|
|
|
begin_iter, end_iter); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|