LCOV - code coverage report
Current view: top level - gui/source - gui_simple_message_to_user.c (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.67.0_covts Lines: 0.0 % 306 0
Test Date: 2025-11-06 17:22:08 Functions: 0.0 % 12 0

            Line data    Source code
       1              : /* File: gui_simple_message_to_user.c; Copyright and License: see below */
       2              : 
       3              : #include "gui_simple_message_to_user.h"
       4              : #include "gui_error_info_printer.h"
       5              : #include "u8/u8_trace.h"
       6              : #include "u8/u8_log.h"
       7              : #include "meta/meta_info.h"
       8              : #include "meta/meta_version.h"
       9              : #include "u8/u8_error.h"
      10              : #include <stdbool.h>
      11              : #include <assert.h>
      12              : 
      13            0 : void gui_simple_message_to_user_init ( gui_simple_message_to_user_t *this_, GtkWidget *text_label, GtkWidget *icon_image, const gui_resources_t *res )
      14              : {
      15            0 :     U8_TRACE_BEGIN();
      16            0 :     assert ( text_label != NULL );
      17            0 :     assert ( icon_image != NULL );
      18            0 :     assert ( res != NULL );
      19              : 
      20            0 :     (*this_).type_id = GUI_SIMPLE_MESSAGE_TYPE_NO_MESSAGE;
      21            0 :     (*this_).text_label = text_label;
      22            0 :     (*this_).icon_image = icon_image;
      23            0 :     (*this_).res = res;
      24              : 
      25            0 :     (*this_).private_temp_str = utf8stringbuf_new( (*this_).private_temp_buf, sizeof((*this_).private_temp_buf) );
      26            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
      27              : 
      28            0 :     U8_TRACE_END();
      29            0 : }
      30              : 
      31            0 : void gui_simple_message_to_user_destroy ( gui_simple_message_to_user_t *this_ )
      32              : {
      33            0 :     U8_TRACE_BEGIN();
      34              : 
      35            0 :     (*this_).text_label = NULL;
      36            0 :     (*this_).icon_image = NULL;
      37            0 :     (*this_).res = NULL;
      38              : 
      39            0 :     U8_TRACE_END();
      40            0 : }
      41              : 
      42            0 : void gui_simple_message_to_user_show_message ( gui_simple_message_to_user_t *this_,
      43              :                                                gui_simple_message_type_t type_id,
      44              :                                                gui_simple_message_content_t content_id )
      45              : {
      46            0 :     U8_TRACE_BEGIN();
      47              : 
      48              :     /* update type id: */
      49            0 :     (*this_).type_id = type_id;
      50            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
      51              : 
      52              :     /* update content text: */
      53            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
      54            0 :     switch ( content_id )
      55              :     {
      56            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_ABOUT:
      57              :         {
      58            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str),
      59              :                                       "This is " META_INFO_PROGRAM_NAME_STR " version "
      60              :                                     );
      61            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str),
      62              :                                       META_VERSION_STR
      63              :                                     );
      64            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str),
      65              :                                       "\n"
      66              :                                       "License: " META_INFO_LICENSE_STR " / "
      67              :                                       "Copyright: " META_INFO_COPYRIGHT_STR "\n"
      68              :                                       "Thanks to all who have contributed to improving and deploying this tool."
      69              :                                     );
      70              :         }
      71            0 :         break;
      72              : 
      73            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_STRING_TRUNCATED:
      74              :         {
      75            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "Maximum string length exceeded." );
      76              :         }
      77            0 :         break;
      78              : 
      79            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_NO_SELECTION:
      80              :         {
      81            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "Nothing selected." );
      82              :         }
      83            0 :         break;
      84              : 
      85            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_NO_FOCUS:
      86              :         {
      87            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "No element is focused." );
      88              :         }
      89            0 :         break;
      90              : 
      91            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_DELETING_NOT_POSSIBLE:
      92              :         {
      93            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "Some objects could not be deleted: They are still referenced/used." );
      94              :         }
      95            0 :         break;
      96              : 
      97            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_NO_MORE_UNDO:
      98              :         {
      99            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "No more actions to be un-done." );
     100              :         }
     101            0 :         break;
     102              : 
     103            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_UNDO_NOT_POSSIBLE:
     104              :         {
     105            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "No more actions can be un-done: undo list at limit." );
     106              :         }
     107            0 :         break;
     108              : 
     109            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_NO_MORE_REDO:
     110              :         {
     111            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "No more actions to be re-done." );
     112              :         }
     113            0 :         break;
     114              : 
     115            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_NO_INPUT_DATA:
     116              :         {
     117            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "No input data." );
     118              :         }
     119            0 :         break;
     120              : 
     121            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_SET_PARTLY_UNSUITABLE:
     122              :         {
     123            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "Operation cannot be performed on all elements in the set." );
     124              :         }
     125            0 :         break;
     126              : 
     127            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_WRITE_ERROR:
     128              :         {
     129            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "Database could not be written to the database file." );
     130              :         }
     131            0 :         break;
     132              : 
     133            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_ANCESTOR_IS_NOT_DESCENDANT:
     134              :         {
     135            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str),
     136              :                                       "An ancestor (parent/root) diagram cannot move to a descendant (child) location.\n"
     137              :                                       "Instead, try to move a descendant out to an ancestor or sibling location"
     138              :                                     );
     139              :         }
     140            0 :         break;
     141              : 
     142            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_DEBUG_MODE:
     143              :         {
     144            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str),
     145              :                                       "This software was compiled in DEBUG mode.\nIt may be slower than the RELEASE version.\n"
     146              :                                       "Confidential information may be printed to syslog."
     147              :                                     );
     148              :         }
     149            0 :         break;
     150              : 
     151            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_NO_RELATIONSHIPS:
     152              :         {
     153            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "The current diagram type does not allow one to create relationships." );
     154              :         }
     155            0 :         break;
     156              : 
     157            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_NO_FEATURES:
     158              :         {
     159            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "The current diagram type does not allow one to create features." );
     160              :         }
     161            0 :         break;
     162              : 
     163            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_FEATURELESS_CLASSIFIER:
     164              :         {
     165            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "The current classifier type does not allow one to create features." );
     166              :         }
     167            0 :         break;
     168              : 
     169            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_IS_ALWAYS_INSTANCE:
     170              :         {
     171            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "The current classifier type does not allow one to remove the instance flag." );
     172              :         }
     173            0 :         break;
     174              : 
     175            0 :         case GUI_SIMPLE_MESSAGE_CONTENT_DB_IS_READ_ONLY:
     176              :         {
     177            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "The database file is open in read only mode." );
     178              :         }
     179            0 :         break;
     180              : 
     181            0 :         default:
     182              :         {
     183            0 :             U8_LOG_ERROR("unexptected gui_simple_message_content_t");
     184              :         }
     185              :     }
     186            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     187            0 :     U8_LOG_EVENT( utf8stringbuf_get_string( &((*this_).private_temp_str) ) );
     188              : 
     189              :     /* show: */
     190            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     191            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     192              : 
     193            0 :     U8_TRACE_END();
     194            0 : }
     195              : 
     196            0 : void gui_simple_message_to_user_show_message_with_quantity ( gui_simple_message_to_user_t *this_,
     197              :                                                              gui_simple_message_type_t type_id,
     198              :                                                              const gui_simple_message_content_quantity_t *content_id,
     199              :                                                              int quantity )
     200              : {
     201            0 :     U8_TRACE_BEGIN();
     202            0 :     assert( content_id != NULL );
     203              : 
     204              :     /* update type id: */
     205            0 :     (*this_).type_id = type_id;
     206            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     207              : 
     208              :     /* update content text: */
     209            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     210            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_INCONSISTENT )
     211              :     {
     212            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_INCONSISTENT" );
     213            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Current database is inconsistent; errors: " );
     214            0 :         utf8stringbuf_append_int( &((*this_).private_temp_str), quantity );
     215              :     }
     216            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_MAX_WINDOWS_ALREADY_OPEN )
     217              :     {
     218            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_MAX_WINDOWS_ALREADY_OPEN" );
     219            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Maximum number of windows already open: " );
     220            0 :         utf8stringbuf_append_int( &((*this_).private_temp_str), quantity );
     221              :     }
     222              :     else
     223              :     {
     224            0 :         U8_LOG_ERROR("unexptected content_id");
     225            0 :         assert(false);
     226              :     }
     227            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     228              : 
     229              :     /* show: */
     230            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     231            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     232              : 
     233            0 :     U8_TRACE_END();
     234            0 : }
     235              : 
     236              : #if 0
     237              : /* REPLACED BY gui_simple_message_to_user_show_error_info */
     238              : void gui_simple_message_to_user_show_message_with_line ( gui_simple_message_to_user_t *this_,
     239              :                                                          gui_simple_message_type_t type_id,
     240              :                                                          const gui_simple_message_content_position_t *content_id,
     241              :                                                          int stream_line )
     242              : {
     243              :     U8_TRACE_BEGIN();
     244              :     assert( content_id != NULL );
     245              : 
     246              :     /* update type id: */
     247              :     (*this_).type_id = type_id;
     248              :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     249              : 
     250              :     /* update content text: */
     251              :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     252              :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_INVALID_INPUT_DATA )
     253              :     {
     254              :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_INVALID_INPUT_DATA" );
     255              :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Invalid input data at line " );
     256              :         utf8stringbuf_append_int( &((*this_).private_temp_str), stream_line );
     257              :     }
     258              :     else
     259              :     {
     260              :         U8_LOG_ERROR("unexptected content_id");
     261              :         assert(false);
     262              :     }
     263              :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     264              : 
     265              :     /* show: */
     266              :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     267              :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     268              : 
     269              :     U8_TRACE_END();
     270              : }
     271              : #endif
     272              : 
     273            0 : void gui_simple_message_to_user_show_message_with_name ( gui_simple_message_to_user_t *this_,
     274              :                                                          gui_simple_message_type_t type_id,
     275              :                                                          const gui_simple_message_content_name_t *content_id,
     276              :                                                          const char *name )
     277              : {
     278            0 :     U8_TRACE_BEGIN();
     279            0 :     assert( content_id != NULL );
     280            0 :     assert( name != NULL );
     281              : 
     282              :     /* update type id: */
     283            0 :     (*this_).type_id = type_id;
     284            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     285              : 
     286              :     /* update content text: */
     287            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     288            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_OPENED )
     289              :     {
     290            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_OPENED" );
     291            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Chosen database file could not be opened/created:\n" );
     292            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     293              :     }
     294            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_CREATEABLE )
     295              :     {
     296            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_CREATEABLE" );
     297            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str),
     298              :                                   "Database file could not be created, the parent directory is possibly read-only:\n"
     299              :                                 );
     300            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     301              :     }
     302            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_OPENED_WITH_ERROR )
     303              :     {
     304            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_OPENED_WITH_ERROR" );
     305            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Chosen database file opened/created with warning:\n" );
     306            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     307              :     }
     308            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_FILE_EXPORT_FAILED )
     309              :     {
     310            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_FILE_EXPORT_FAILED" );
     311            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Export failed, destination path: " );
     312            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     313              :     }
     314            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_NAME_NOT_UNIQUE )
     315              :     {
     316            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_NAME_NOT_UNIQUE" );
     317            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str),
     318              :                                   "Name already in use (use copy and paste to insert the existing object): "
     319              :                                 );
     320            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     321              :     }
     322            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_LOADING_WAIT )
     323              :     {
     324            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_LOADING_WAIT" );
     325            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Loading DB file ...\n" );
     326            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     327              :     }
     328            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_EXPORTING_WAIT )
     329              :     {
     330            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_EXPORTING_WAIT" );
     331            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Exporting files ...\n" );
     332            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     333              :     }
     334            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_WRITTEN )
     335              :     {
     336            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_WRITTEN" );
     337            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Database file written: " );
     338            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     339              :     }
     340            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_JSON_MODIFIED )
     341              :     {
     342            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_JSON_MODIFIED" );
     343            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Database file concurrently modified: " );
     344            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     345            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "\nThese changes will be overwritten when saving!" );
     346              :     }
     347              :     else
     348              :     {
     349            0 :         U8_LOG_ERROR("unexptected content_id");
     350            0 :         assert(false);
     351              :     }
     352            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     353            0 :     U8_TRACE_INFO_STR( "error at", name );
     354              : 
     355              :     /* show: */
     356            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     357            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     358              : 
     359            0 :     U8_TRACE_END();
     360            0 : }
     361              : 
     362            0 : void gui_simple_message_to_user_show_message_with_names ( gui_simple_message_to_user_t *this_,
     363              :                                                           gui_simple_message_type_t type_id,
     364              :                                                           const gui_simple_message_content_names_t *content_id,
     365              :                                                           const char *list_of_names )
     366              : {
     367            0 :     U8_TRACE_BEGIN();
     368            0 :     assert( content_id != NULL );
     369            0 :     assert( list_of_names != NULL );
     370              : 
     371              :     /* update type id: */
     372            0 :     (*this_).type_id = type_id;
     373            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     374              : 
     375              :     /* update content text: */
     376            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     377              :     {
     378            0 :         U8_LOG_ERROR("unexptected content_id");
     379            0 :         assert(false);
     380              :     }
     381              :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     382              : 
     383              :     /* show: */
     384              :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     385              :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     386              : 
     387              :     U8_TRACE_END();
     388              : }
     389              : 
     390            0 : void gui_simple_message_to_user_show_message_with_error ( gui_simple_message_to_user_t *this_,
     391              :                                                           gui_simple_message_type_t type_id,
     392              :                                                           const gui_simple_message_content_error_t *content_id,
     393              :                                                           const char *error_message )
     394              : {
     395            0 :     U8_TRACE_BEGIN();
     396            0 :     assert( content_id != NULL );
     397            0 :     assert( error_message != NULL );
     398              : 
     399              :     /* update type id: */
     400            0 :     (*this_).type_id = type_id;
     401            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     402              : 
     403              :     /* update content text: */
     404            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     405            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_NOT_YET_IMPLEMENTED )
     406              :     {
     407            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_NOT_YET_IMPLEMENTED" );
     408            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "This feature is not yet implemented: " );
     409            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), error_message );
     410              :     }
     411              :     else
     412              :     {
     413            0 :         U8_LOG_ERROR("unexptected content_id");
     414            0 :         assert(false);
     415              :     }
     416            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     417              : 
     418              :     /* show: */
     419            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     420            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     421              : 
     422            0 :     U8_TRACE_END();
     423            0 : }
     424              : 
     425              : const char *const (gui_simple_message_to_user_private_table_name[DATA_STAT_TABLE_MAX])
     426              :     = {"lifelines","classifiers","features","relationships","classifier-occurrences","diagrams"};
     427              : const char *const (gui_simple_message_to_user_private_series_name4change[DATA_STAT_SERIES_MAX])
     428              :     = {"created","modified","deleted","ignored","warning","error"};
     429              : const char *const (gui_simple_message_to_user_private_series_name4other[DATA_STAT_SERIES_MAX])
     430              :     = {"exported","un/selected","deleted","ignored","warning","error"};
     431              : 
     432            0 : void gui_simple_message_to_user_show_message_with_stat ( gui_simple_message_to_user_t *this_,
     433              :                                                          gui_simple_message_type_t type_id,
     434              :                                                          const gui_simple_message_content_stat_t *content_id,
     435              :                                                          const data_stat_t *stat
     436              :                                                        )
     437              : {
     438            0 :     U8_TRACE_BEGIN();
     439            0 :     assert( stat != NULL );
     440            0 :     assert( content_id != NULL );
     441            0 :     data_stat_trace( stat );
     442              : 
     443              :     /* update type id: */
     444            0 :     (*this_).type_id = type_id;
     445            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     446              : 
     447              :     /* update content text: */
     448            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     449            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_CUT_TO_CLIPBOARD )
     450              :     {
     451            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_CUT_TO_CLIPBOARD" );
     452            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Selection cut to clipboard: \n" );
     453            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, true, (*this_).private_temp_str );
     454              :     }
     455            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_COPY_TO_CLIPBOARD )
     456              :     {
     457            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_COPY_TO_CLIPBOARD" );
     458            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Selection copied to clipboard: \n" );
     459            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, true, (*this_).private_temp_str );
     460              :     }
     461            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_PASTE_FROM_CLIPBOARD )
     462              :     {
     463            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_PASTE_FROM_CLIPBOARD" );
     464            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Clipboard pasted: \n" );
     465            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     466              :     }
     467            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DELETE )
     468              :     {
     469            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DELETE" );
     470            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Selection deleted: \n" );
     471            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     472              :     }
     473            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_UNDO )
     474              :     {
     475            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_UNDO" );
     476            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Undo success: \n" );
     477            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     478              :     }
     479            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_REDO )
     480              :     {
     481            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_REDO" );
     482            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Redo success: \n" );
     483            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     484              :     }
     485            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_TYPE_CHANGE )
     486              :     {
     487            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_TYPE_CHANGE" );
     488            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Type changed: \n" );
     489            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     490              :     }
     491              :     else
     492              :     {
     493            0 :         U8_LOG_ERROR("unexptected content_id");
     494            0 :         assert(false);
     495              :     }
     496            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     497              : 
     498              :     /* show: */
     499            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     500            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     501              : 
     502            0 :     U8_TRACE_END();
     503            0 : }
     504              : 
     505            0 : void gui_simple_message_to_user_show_message_with_names_and_stat( gui_simple_message_to_user_t *this_,
     506              :                                                                   gui_simple_message_type_t type_id,
     507              :                                                                   const gui_simple_message_content_names_stat_t *content_id,
     508              :                                                                   const char *list_of_names,
     509              :                                                                   const data_stat_t *stat )
     510              : {
     511            0 :     U8_TRACE_BEGIN();
     512            0 :     assert( stat != NULL );
     513            0 :     assert( list_of_names != NULL );
     514            0 :     assert( content_id != NULL );
     515            0 :     data_stat_trace( stat );
     516              : 
     517              :     /* update type id: */
     518            0 :     (*this_).type_id = type_id;
     519            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     520              : 
     521              :     /* update content text: */
     522            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     523            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_EXPORT_FINISHED )
     524              :     {
     525            0 :         U8_LOG_EVENT_STR( "GUI_SIMPLE_MESSAGE_CONTENT_EXPORT_FINISHED", list_of_names );
     526            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Files exported, format: " );
     527            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), list_of_names );
     528            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "\n" );
     529            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, true, (*this_).private_temp_str );
     530            0 :         if ( 0 != data_stat_get_series_count ( stat, DATA_STAT_SERIES_WARNING ) )
     531              :         {
     532            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "\nFor details see comments in exported xmi file." );
     533              :         }
     534              :     }
     535              :     else
     536              :     {
     537            0 :         U8_LOG_ERROR("unexptected content_id");
     538            0 :         assert(false);
     539              :     }
     540            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     541              : 
     542              :     /* show: */
     543            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     544            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     545              : 
     546            0 :     U8_TRACE_END();
     547            0 : }
     548              : 
     549            0 : void gui_simple_message_to_user_private_append_stat ( gui_simple_message_to_user_t *this_,
     550              :                                                       const data_stat_t *stat,
     551              :                                                       bool alt_labels,
     552              :                                                       utf8stringbuf_t out_buf
     553              :                                                     )
     554              : {
     555            0 :     U8_TRACE_BEGIN();
     556            0 :     assert( stat != NULL );
     557              : 
     558            0 :     bool first_series = true;
     559            0 :     for ( int series_idx = 0; series_idx < DATA_STAT_SERIES_MAX; series_idx ++ )
     560              :     {
     561            0 :         if ( 0 != data_stat_get_series_count ( stat, series_idx ) )
     562              :         {
     563            0 :             if ( first_series )
     564              :             {
     565            0 :                 first_series = false;
     566              :             }
     567              :             else
     568              :             {
     569            0 :                 utf8stringbuf_append_str( &out_buf, "\n" );
     570              :             }
     571            0 :             const char *const series_name
     572              :                 = alt_labels
     573              :                 ? gui_simple_message_to_user_private_series_name4other[series_idx]
     574            0 :                 : gui_simple_message_to_user_private_series_name4change[series_idx];
     575            0 :             utf8stringbuf_append_str( &out_buf, series_name );
     576            0 :             utf8stringbuf_append_str( &out_buf, ": " );
     577              : 
     578            0 :             bool first_table = true;
     579            0 :             for ( int tables_idx = 0; tables_idx < DATA_STAT_TABLE_MAX; tables_idx ++ )
     580              :             {
     581            0 :                 uint_fast32_t cnt = data_stat_get_count ( stat, tables_idx, series_idx );
     582            0 :                 if ( 0 != cnt )
     583              :                 {
     584            0 :                     if ( first_table )
     585              :                     {
     586            0 :                         first_table = false;
     587              :                     }
     588              :                     else
     589              :                     {
     590            0 :                         utf8stringbuf_append_str( &out_buf, ", " );
     591              :                     }
     592            0 :                     const char *const table_name = gui_simple_message_to_user_private_table_name[tables_idx];
     593            0 :                     utf8stringbuf_append_str( &out_buf, table_name );
     594            0 :                     utf8stringbuf_append_str( &out_buf, ":" );
     595            0 :                     utf8stringbuf_append_int( &out_buf, cnt );
     596              :                 }
     597              :             }
     598              :         }
     599              :     }
     600            0 :     if ( 0 == data_stat_get_total_count ( stat ) )
     601              :     {
     602            0 :         utf8stringbuf_append_str( &out_buf, "0" );
     603              :     }
     604            0 :     U8_TRACE_INFO( utf8stringbuf_get_string( &out_buf ) );
     605              : 
     606            0 :     U8_TRACE_END();
     607            0 : }
     608              : 
     609            0 : void gui_simple_message_to_user_show_error_info ( gui_simple_message_to_user_t *this_, const u8_error_info_t *err_info )
     610              : {
     611            0 :     U8_TRACE_BEGIN();
     612              : 
     613              :     /* update type id: */
     614            0 :     (*this_).type_id = GUI_SIMPLE_MESSAGE_TYPE_ERROR;
     615            0 :     gui_simple_message_to_user_private_set_icon_image( this_, GUI_SIMPLE_MESSAGE_TYPE_ERROR );
     616              : 
     617              :     /* update content text: */
     618            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     619              :     {
     620              :         gui_error_info_printer_t my_err_info_printer;
     621            0 :         gui_error_info_printer_init( &my_err_info_printer );
     622            0 :         gui_error_info_printer_show_error_info( &my_err_info_printer, err_info, (*this_).private_temp_str );
     623            0 :         gui_error_info_printer_destroy( &my_err_info_printer );
     624              :     }
     625            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ) );
     626              : 
     627              :     /* show: */
     628            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     629            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     630              : 
     631            0 :     U8_TRACE_END();
     632            0 : }
     633              : 
     634            0 : void gui_simple_message_to_user_hide ( gui_simple_message_to_user_t *this_ )
     635              : {
     636            0 :     U8_TRACE_BEGIN();
     637              : 
     638            0 :     (*this_).type_id = GUI_SIMPLE_MESSAGE_TYPE_NO_MESSAGE;
     639            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), FALSE );
     640            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), FALSE );
     641              : 
     642            0 :     U8_TRACE_END();
     643            0 : }
     644              : 
     645              : 
     646              : /*
     647              : Copyright 2016-2025 Andreas Warnke
     648              : 
     649              : Licensed under the Apache License, Version 2.0 (the "License");
     650              : you may not use this file except in compliance with the License.
     651              : You may obtain a copy of the License at
     652              : 
     653              :     http://www.apache.org/licenses/LICENSE-2.0
     654              : 
     655              : Unless required by applicable law or agreed to in writing, software
     656              : distributed under the License is distributed on an "AS IS" BASIS,
     657              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     658              : See the License for the specific language governing permissions and
     659              : limitations under the License.
     660              : */
        

Generated by: LCOV version 2.0-1