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.70.5_covts Lines: 0.0 % 310 0
Test Date: 2026-05-28 21:31:40 Functions: 0.0 % 11 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            0 : void gui_simple_message_to_user_show_message_with_name ( gui_simple_message_to_user_t *this_,
     237              :                                                          gui_simple_message_type_t type_id,
     238              :                                                          const gui_simple_message_content_name_t *content_id,
     239              :                                                          const char *name )
     240              : {
     241            0 :     U8_TRACE_BEGIN();
     242            0 :     assert( content_id != NULL );
     243            0 :     assert( name != NULL );
     244              : 
     245              :     /* update type id: */
     246            0 :     (*this_).type_id = type_id;
     247            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     248              : 
     249              :     /* update content text: */
     250            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     251            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_OPENED )
     252              :     {
     253            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_OPENED" );
     254            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Chosen database file could not be opened/created:\n" );
     255            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     256              :     }
     257            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_CREATEABLE )
     258              :     {
     259            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_NOT_CREATEABLE" );
     260            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str),
     261              :                                   "Database file could not be created, the parent directory is possibly read-only:\n"
     262              :                                 );
     263            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     264              :     }
     265            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_OPENED_WITH_ERROR )
     266              :     {
     267            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_OPENED_WITH_ERROR" );
     268            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Chosen database file opened/created with warning:\n" );
     269            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     270              :     }
     271            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_FILE_EXPORT_FAILED )
     272              :     {
     273            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_FILE_EXPORT_FAILED" );
     274            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Export failed, destination path: " );
     275            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     276              :     }
     277            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_NAME_NOT_UNIQUE )
     278              :     {
     279            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_NAME_NOT_UNIQUE" );
     280            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str),
     281              :                                   "Name already in use (use copy and paste to insert the existing object): "
     282              :                                 );
     283            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     284              :     }
     285            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_LOADING_WAIT )
     286              :     {
     287            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_LOADING_WAIT" );
     288            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Loading DB file ...\n" );
     289            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     290              :     }
     291            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_EXPORTING_WAIT )
     292              :     {
     293            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_EXPORTING_WAIT" );
     294            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Exporting files ...\n" );
     295            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     296              :     }
     297            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_WRITTEN )
     298              :     {
     299            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_WRITTEN" );
     300            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Database file written: " );
     301            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     302              :     }
     303            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_JSON_MODIFIED )
     304              :     {
     305            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_JSON_MODIFIED" );
     306            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Database file concurrently modified: " );
     307            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     308            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "\nThese changes will be overwritten!" );
     309              :     }
     310            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_LOCKED )
     311              :     {
     312            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_LOCKED" );
     313            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Database file is locked: " );
     314            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     315            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str),
     316              :                                   "\nIf the file is not used concurrently, either open the .tmp-cfu file or delete it."
     317              :                                 );
     318              :     }
     319              :     else
     320              :     {
     321            0 :         U8_LOG_ERROR("unexptected content_id");
     322            0 :         assert(false);
     323              :     }
     324            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     325            0 :     U8_TRACE_INFO_STR( "error at", name );
     326              : 
     327              :     /* show: */
     328            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     329            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     330              : 
     331            0 :     U8_TRACE_END();
     332            0 : }
     333              : 
     334            0 : void gui_simple_message_to_user_show_message_with_error ( gui_simple_message_to_user_t *this_,
     335              :                                                           gui_simple_message_type_t type_id,
     336              :                                                           const gui_simple_message_content_error_t *content_id,
     337              :                                                           const char *error_message )
     338              : {
     339            0 :     U8_TRACE_BEGIN();
     340            0 :     assert( content_id != NULL );
     341            0 :     assert( error_message != NULL );
     342              : 
     343              :     /* update type id: */
     344            0 :     (*this_).type_id = type_id;
     345            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     346              : 
     347              :     /* update content text: */
     348            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     349            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_NOT_YET_IMPLEMENTED )
     350              :     {
     351            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_NOT_YET_IMPLEMENTED" );
     352            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "This feature is not yet implemented: " );
     353            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), error_message );
     354              :     }
     355              :     else
     356              :     {
     357            0 :         U8_LOG_ERROR("unexptected content_id");
     358            0 :         assert(false);
     359              :     }
     360            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     361              : 
     362              :     /* show: */
     363            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     364            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     365              : 
     366            0 :     U8_TRACE_END();
     367            0 : }
     368              : 
     369              : const char *const (gui_simple_message_to_user_private_table_name[DATA_STAT_TABLE_MAX])
     370              :     = {"lifelines","classifiers","features","relationships","classifier-occurrences","diagrams"};
     371              : const char *const (gui_simple_message_to_user_private_series_name4change[DATA_STAT_SERIES_MAX])
     372              :     = {"created","modified","deleted","ignored","warning","error"};
     373              : const char *const (gui_simple_message_to_user_private_series_name4other[DATA_STAT_SERIES_MAX])
     374              :     = {"exported","un/selected","deleted","ignored","warning","error"};
     375              : 
     376            0 : void gui_simple_message_to_user_show_message_with_stat ( gui_simple_message_to_user_t *this_,
     377              :                                                          gui_simple_message_type_t type_id,
     378              :                                                          const gui_simple_message_content_stat_t *content_id,
     379              :                                                          const data_stat_t *stat
     380              :                                                        )
     381              : {
     382            0 :     U8_TRACE_BEGIN();
     383            0 :     assert( stat != NULL );
     384            0 :     assert( content_id != NULL );
     385            0 :     data_stat_trace( stat );
     386              : 
     387              :     /* update type id: */
     388            0 :     (*this_).type_id = type_id;
     389            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     390              : 
     391              :     /* update content text: */
     392            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     393            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_CUT_TO_CLIPBOARD )
     394              :     {
     395            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_CUT_TO_CLIPBOARD" );
     396            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Selection cut to clipboard: \n" );
     397            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, true, (*this_).private_temp_str );
     398              :     }
     399            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_COPY_TO_CLIPBOARD )
     400              :     {
     401            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_COPY_TO_CLIPBOARD" );
     402            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Selection copied to clipboard: \n" );
     403            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, true, (*this_).private_temp_str );
     404              :     }
     405            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_PASTE_FROM_CLIPBOARD )
     406              :     {
     407            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_PASTE_FROM_CLIPBOARD" );
     408            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Clipboard pasted: \n" );
     409            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     410              :     }
     411            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DELETE )
     412              :     {
     413            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DELETE" );
     414            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Selection deleted: \n" );
     415            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     416              :     }
     417            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_UNDO )
     418              :     {
     419            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_UNDO" );
     420            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Undo success: \n" );
     421            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     422              :     }
     423            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_REDO )
     424              :     {
     425            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_REDO" );
     426            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Redo success: \n" );
     427            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     428              :     }
     429            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_TYPE_CHANGE )
     430              :     {
     431            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_TYPE_CHANGE" );
     432            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Type changed: \n" );
     433            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     434              :     }
     435              :     else
     436              :     {
     437            0 :         U8_LOG_ERROR("unexptected content_id");
     438            0 :         assert(false);
     439              :     }
     440            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     441              : 
     442              :     /* show: */
     443            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     444            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     445              : 
     446            0 :     U8_TRACE_END();
     447            0 : }
     448              : 
     449            0 : void gui_simple_message_to_user_show_message_with_name_and_stat( gui_simple_message_to_user_t *this_,
     450              :                                                                  gui_simple_message_type_t type_id,
     451              :                                                                  const gui_simple_message_content_name_stat_t *content_id,
     452              :                                                                  const char *name,
     453              :                                                                  const data_stat_t *stat )
     454              : {
     455            0 :     U8_TRACE_BEGIN();
     456            0 :     assert( stat != NULL );
     457            0 :     assert( name != NULL );
     458            0 :     assert( content_id != NULL );
     459            0 :     data_stat_trace( stat );
     460              : 
     461              :     /* update type id: */
     462            0 :     (*this_).type_id = type_id;
     463            0 :     gui_simple_message_to_user_private_set_icon_image( this_, type_id );
     464              : 
     465              :     /* update content text: */
     466            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     467            0 :     if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_EXPORT_FINISHED )
     468              :     {
     469            0 :         U8_LOG_EVENT_STR( "GUI_SIMPLE_MESSAGE_CONTENT_EXPORT_FINISHED", name );
     470            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Files exported, format: " );
     471            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     472            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "\n" );
     473            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, true, (*this_).private_temp_str );
     474            0 :         if ( 0 != data_stat_get_series_count ( stat, DATA_STAT_SERIES_WARNING ) )
     475              :         {
     476            0 :             utf8stringbuf_append_str( &((*this_).private_temp_str), "\nFor details see comments in exported xmi file." );
     477              :         }
     478              :     }
     479            0 :     else if ( content_id == GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_OPENED )
     480              :     {
     481            0 :         U8_LOG_EVENT( "GUI_SIMPLE_MESSAGE_CONTENT_DB_FILE_OPENED" );
     482            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "Database file opened: " );
     483            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), name );
     484            0 :         utf8stringbuf_append_str( &((*this_).private_temp_str), "\n" );
     485            0 :         gui_simple_message_to_user_private_append_stat( this_, stat, false, (*this_).private_temp_str );
     486              :     }
     487              :     else
     488              :     {
     489            0 :         U8_LOG_ERROR("unexpected content_id");
     490            0 :         assert(false);
     491              :     }
     492            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ));
     493              : 
     494              :     /* show: */
     495            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     496            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     497              : 
     498            0 :     U8_TRACE_END();
     499            0 : }
     500              : 
     501              : const int GUI_SIMPLE_MESSAGE_TO_USER_STAT_ORDER[ DATA_STAT_TABLE_MAX ] = {
     502              :     DATA_STAT_TABLE_DIAGRAM,
     503              :     DATA_STAT_TABLE_DIAGRAMELEMENT,
     504              :     DATA_STAT_TABLE_CLASSIFIER,
     505              :     DATA_STAT_TABLE_FEATURE,
     506              :     DATA_STAT_TABLE_LIFELINE,
     507              :     DATA_STAT_TABLE_RELATIONSHIP
     508              : };
     509              : 
     510            0 : void gui_simple_message_to_user_private_append_stat ( gui_simple_message_to_user_t *this_,
     511              :                                                       const data_stat_t *stat,
     512              :                                                       bool alt_labels,
     513              :                                                       utf8stringbuf_t out_buf
     514              :                                                     )
     515              : {
     516            0 :     U8_TRACE_BEGIN();
     517            0 :     assert( stat != NULL );
     518              : 
     519            0 :     bool first_series = true;
     520            0 :     for ( int series_idx = 0; series_idx < DATA_STAT_SERIES_MAX; series_idx ++ )
     521              :     {
     522            0 :         if ( 0 != data_stat_get_series_count ( stat, series_idx ) )
     523              :         {
     524            0 :             if ( first_series )
     525              :             {
     526            0 :                 first_series = false;
     527              :             }
     528              :             else
     529              :             {
     530            0 :                 utf8stringbuf_append_str( &out_buf, "\n" );
     531              :             }
     532            0 :             const char *const series_name
     533              :                 = alt_labels
     534              :                 ? gui_simple_message_to_user_private_series_name4other[series_idx]
     535            0 :                 : gui_simple_message_to_user_private_series_name4change[series_idx];
     536            0 :             utf8stringbuf_append_str( &out_buf, series_name );
     537            0 :             utf8stringbuf_append_str( &out_buf, ": " );
     538              : 
     539            0 :             bool first_table = true;
     540            0 :             for ( int tables_run = 0; tables_run < DATA_STAT_TABLE_MAX; tables_run ++ )
     541              :             {
     542            0 :                 const int tables_idx = GUI_SIMPLE_MESSAGE_TO_USER_STAT_ORDER[ tables_run ];
     543            0 :                 assert( tables_idx < DATA_STAT_TABLE_MAX );
     544            0 :                 uint_fast32_t cnt = data_stat_get_count ( stat, tables_idx, series_idx );
     545            0 :                 if ( 0 != cnt )
     546              :                 {
     547            0 :                     if ( first_table )
     548              :                     {
     549            0 :                         first_table = false;
     550              :                     }
     551              :                     else
     552              :                     {
     553            0 :                         utf8stringbuf_append_str( &out_buf, ", " );
     554              :                     }
     555            0 :                     const char *const table_name = gui_simple_message_to_user_private_table_name[tables_idx];
     556            0 :                     utf8stringbuf_append_str( &out_buf, table_name );
     557            0 :                     utf8stringbuf_append_str( &out_buf, ":" );
     558            0 :                     utf8stringbuf_append_int( &out_buf, cnt );
     559              :                 }
     560              :             }
     561              :         }
     562              :     }
     563            0 :     if ( 0 == data_stat_get_total_count ( stat ) )
     564              :     {
     565            0 :         utf8stringbuf_append_str( &out_buf, "0" );
     566              :     }
     567            0 :     U8_TRACE_INFO( utf8stringbuf_get_string( &out_buf ) );
     568              : 
     569            0 :     U8_TRACE_END();
     570            0 : }
     571              : 
     572            0 : void gui_simple_message_to_user_show_error_info ( gui_simple_message_to_user_t *this_, const u8_error_info_t *err_info )
     573              : {
     574            0 :     U8_TRACE_BEGIN();
     575              : 
     576              :     /* update type id: */
     577            0 :     (*this_).type_id = GUI_SIMPLE_MESSAGE_TYPE_ERROR;
     578            0 :     gui_simple_message_to_user_private_set_icon_image( this_, GUI_SIMPLE_MESSAGE_TYPE_ERROR );
     579              : 
     580              :     /* update content text: */
     581            0 :     utf8stringbuf_clear( &((*this_).private_temp_str) );
     582              :     {
     583              :         gui_error_info_printer_t my_err_info_printer;
     584            0 :         gui_error_info_printer_init( &my_err_info_printer );
     585            0 :         gui_error_info_printer_show_error_info( &my_err_info_printer, err_info, (*this_).private_temp_str );
     586            0 :         gui_error_info_printer_destroy( &my_err_info_printer );
     587              :     }
     588            0 :     gtk_label_set_text ( GTK_LABEL( (*this_).text_label ), utf8stringbuf_get_string( &((*this_).private_temp_str) ) );
     589              : 
     590              :     /* show: */
     591            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), TRUE );
     592            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), TRUE );
     593              : 
     594            0 :     U8_TRACE_END();
     595            0 : }
     596              : 
     597            0 : void gui_simple_message_to_user_hide ( gui_simple_message_to_user_t *this_ )
     598              : {
     599            0 :     U8_TRACE_BEGIN();
     600              : 
     601            0 :     (*this_).type_id = GUI_SIMPLE_MESSAGE_TYPE_NO_MESSAGE;
     602            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).text_label ), FALSE );
     603            0 :     gtk_widget_set_visible( GTK_WIDGET ( (*this_).icon_image ), FALSE );
     604              : 
     605            0 :     U8_TRACE_END();
     606            0 : }
     607              : 
     608              : 
     609              : /*
     610              : Copyright 2016-2026 Andreas Warnke
     611              : 
     612              : Licensed under the Apache License, Version 2.0 (the "License");
     613              : you may not use this file except in compliance with the License.
     614              : You may obtain a copy of the License at
     615              : 
     616              :     http://www.apache.org/licenses/LICENSE-2.0
     617              : 
     618              : Unless required by applicable law or agreed to in writing, software
     619              : distributed under the License is distributed on an "AS IS" BASIS,
     620              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     621              : See the License for the specific language governing permissions and
     622              : limitations under the License.
     623              : */
        

Generated by: LCOV version 2.0-1