From b663e272e7f39063a5c1bf744038ded0a7566990 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Sun, 6 Nov 2022 21:37:50 -0800 Subject: Speed up test/table open time Only showing table's callbacks after table is initialized. We're only interested in user interaction. --- test/table.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'test/table.cxx') 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(); -- cgit v1.2.3