Skip to content

Commit

Permalink
improve warnings display
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Apr 23, 2024
1 parent 9958899 commit f1df71e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion gui/src/tascar_mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ bool tascar_window_t::on_timeout_blink()
else
blink = true;
draw.set_blink(blink);
if(TASCAR::get_warnings().size() > numlastwarnings) {
numlastwarnings = TASCAR::get_warnings().size();
on_menu_view_show_warnings();
}
bool has_warnings(text_warnings->get_buffer()->size());
Gdk::RGBA col;
if(has_warnings)
Expand Down Expand Up @@ -498,6 +502,7 @@ bool tascar_window_t::draw_scene(const Cairo::RefPtr<Cairo::Context>& cr)
void tascar_window_t::load(const std::string& fname)
{
get_warnings().clear();
numlastwarnings = 0;
scene_load(fname);
tascar_filename = fname;
sessionquit = false;
Expand Down Expand Up @@ -748,7 +753,7 @@ void tascar_window_t::on_menu_file_close()
{
try {
scene_destroy();
get_warnings().clear();
// get_warnings().clear();
#if defined(WEBKIT2GTK30) || defined(WEBKIT2GTK40)
webkit_web_view_try_close(news_view);
#endif
Expand Down Expand Up @@ -996,6 +1001,7 @@ void tascar_window_t::on_menu_file_reload()
{
try {
get_warnings().clear();
numlastwarnings = 0;
scene_load(tascar_filename);
sessionquit = false;
if(session) {
Expand Down Expand Up @@ -1068,6 +1074,7 @@ void tascar_window_t::on_menu_file_open()
std::string filename = dialog.get_filename();
try {
get_warnings().clear();
numlastwarnings = 0;
scene_load(filename);
tascar_filename = filename;
sessionquit = false;
Expand Down Expand Up @@ -1109,6 +1116,7 @@ void tascar_window_t::on_menu_file_open_example()
std::string filename = dialog.get_filename();
try {
get_warnings().clear();
numlastwarnings = 0;
scene_load(filename);
tascar_filename = filename;
sessionquit = false;
Expand Down
2 changes: 2 additions & 0 deletions gui/src/tascar_mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ class tascar_window_t : public scene_manager_t, public Gtk::Window
Gtk::Widget* news_viewpp;
#endif
uint32_t splash_timeout;

size_t numlastwarnings = 0;
};

#endif
Expand Down
6 changes: 5 additions & 1 deletion libtascar/src/tscconfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ namespace TASCAR {
std::string operator()(const std::string&, const std::string&) const;
void forceoverwrite(const std::string&, const std::string&);
void writeconfig(const std::vector<std::string>& keys);
~globalconfig_t();

private:
void readconfig(const std::string& fname);
Expand Down Expand Up @@ -243,7 +244,8 @@ void TASCAR::generate_plugin_documentation_tables(bool latex)
fname + "."
<< std::endl;
std::ofstream fh(fname);
fh << "\\definecolor{shadecolor}{RGB}{255,230,204}\\begin{snugshade}\n{\\footnotesize\n";
fh << "\\definecolor{shadecolor}{RGB}{255,230,204}\\begin{snugshade}\n{"
"\\footnotesize\n";
fh << "\\label{attrtab:" << elem.first << "}\n";
fh << "Attributes of ";
if(elem.second.type.empty())
Expand Down Expand Up @@ -692,6 +694,8 @@ TASCAR::globalconfig_t::globalconfig_t()
readconfig("${HOME}/.tascardefaults.xml");
}

TASCAR::globalconfig_t::~globalconfig_t() {}

void TASCAR::globalconfig_t::readconfig(const std::string& fname)
{
try {
Expand Down

0 comments on commit f1df71e

Please sign in to comment.