diff options
| author | Greg Ercolano <erco@seriss.com> | 2022-11-06 21:37:50 -0800 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2022-11-06 21:37:50 -0800 |
| commit | b663e272e7f39063a5c1bf744038ded0a7566990 (patch) | |
| tree | 9b697d14fcf9dfd11134fb30be31d519767addd0 | |
| parent | 8b72f0c6681d0d13506ff56985052b9a81760cdc (diff) | |
Speed up test/table open time
Only showing table's callbacks after table is initialized.
We're only interested in user interaction.
| -rw-r--r-- | test/table.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/table.cxx b/test/table.cxx index dbca2e89f..bbca5af1f 100644 --- a/test/table.cxx +++ b/test/table.cxx @@ -27,6 +27,7 @@ class DemoTable : public Fl_Table_Row private: Fl_Color cell_bgcolor; // color of cell's bg color Fl_Color cell_fgcolor; // color of cell's fg color + bool show_callbacks; // set to show callback msgs protected: void draw_cell(TableContext context, // table cell drawing @@ -39,6 +40,7 @@ public: { cell_bgcolor = FL_WHITE; cell_fgcolor = FL_BLACK; + show_callbacks = false; callback(&event_callback, (void*)this); end(); } @@ -47,6 +49,7 @@ public: Fl_Color GetCellBGColor() const { return(cell_bgcolor); } void SetCellFGColor(Fl_Color val) { cell_fgcolor = val; } void SetCellBGColor(Fl_Color val) { cell_bgcolor = val; } + void ShowCallbacks(bool val) { show_callbacks = val; } }; // Handle drawing all cells in table @@ -126,8 +129,9 @@ void DemoTable::event_callback2() C = callback_col(); TableContext context = callback_context(); const char *name = label() ? label() : "?"; - G_tty->printf("'%s' callback: Row=%d Col=%d Context=%d Event=%d InteractiveResize? %d\n", - name, R, C, (int)context, (int)Fl::event(), (int)is_interactive_resize()); + if ( show_callbacks ) + G_tty->printf("'%s' callback: Row=%d Col=%d Context=%d Event=%d InteractiveResize? %d\n", + name, R, C, (int)context, (int)Fl::event(), (int)is_interactive_resize()); } // GLOBAL TABLE WIDGET @@ -368,6 +372,9 @@ int main(int argc, char **argv) G_table->col_resize(1); G_table->col_width_all(80); + // After initialization, show table's callbacks + G_table->ShowCallbacks(true); + // Add children to window win.begin(); |
