X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmainerror.C;h=61ffa7c46b433c09611844598cd704b87cd70115;hb=c279e21fc2394a7908bbd1ba8c79b116fe9fb14a;hp=19169eb778ec972ba37cae87534d11fbe6e9a728;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mainerror.C b/cinelerra-5.1/cinelerra/mainerror.C index 19169eb7..61ffa7c4 100644 --- a/cinelerra-5.1/cinelerra/mainerror.C +++ b/cinelerra-5.1/cinelerra/mainerror.C @@ -64,32 +64,26 @@ MainErrorGUI::~MainErrorGUI() void MainErrorGUI::create_objects() { -SET_TRACE - + lock_window("MainErrorGUI::create_objects"); BC_Button *button; add_subwindow(button = new BC_OKButton(this)); int x = 10, y = 10; -SET_TRACE add_subwindow(title = new BC_Title(x, y, _("The following errors occurred:"))); y += title->get_h() + 5; -SET_TRACE - add_subwindow(list = new BC_ListBox(x, - y, - get_w() - 20, - button->get_y() - y - 5, - LISTBOX_TEXT, // Display text list or icons - &thread->errors, // Each column has an ArrayList of BC_ListBoxItems. - 0, // Titles for columns. Set to 0 for no titles - 0, // width of each column - 1, // Total columns. Only 1 in icon mode - 0, // Pixel of top of window. - 0, // If this listbox is a popup window with a button - LISTBOX_SINGLE, // Select one item or multiple items - ICON_LEFT, // Position of icon relative to text of each item + add_subwindow(list = new BC_ListBox(x, y, + get_w() - 20, button->get_y() - y - 5, + LISTBOX_TEXT, // Display text list or icons + &thread->errors, // Each column has an ArrayList of BC_ListBoxItems. + 0, // Titles for columns. Set to 0 for no titles + 0, // width of each column + 1, // Total columns. Only 1 in icon mode + 0, // Pixel of top of window. + 0, // If this listbox is a popup window with a button + LISTBOX_SINGLE, // Select one item or multiple items + ICON_LEFT, // Position of icon relative to text of each item 0)); -SET_TRACE show_window(); -SET_TRACE + unlock_window(); } int MainErrorGUI::resize_event(int w, int h) @@ -126,6 +120,7 @@ MainError::MainError(MWindow *mwindow) MainError::~MainError() { close_window(); + errors.remove_all_objects(); delete errors_lock; } @@ -149,8 +144,7 @@ void MainError::append_error(const char *string) { char *out_ptr = string2; // Indent remaining lines - if(!first_line) - { + if( !first_line ) { *out_ptr++ = ' '; *out_ptr++ = ' '; } @@ -164,8 +158,7 @@ void MainError::append_error(const char *string) errors.append(new BC_ListBoxItem(string2)); - if(*in_ptr == '\n') - { + if( *in_ptr == '\n' ) { in_ptr++; first_line = 0; } @@ -174,58 +167,34 @@ void MainError::append_error(const char *string) void MainError::show_error_local(const char *string) { -SET_TRACE // assume user won't get to closing the GUI here lock_window("MainError::show_error_local"); -SET_TRACE - if(get_gui()) - { -SET_TRACE + if( get_gui() ) { MainErrorGUI *gui = (MainErrorGUI*)get_gui(); gui->lock_window("MainError::show_error_local"); -SET_TRACE append_error(string); -SET_TRACE - gui->list->update(&errors, - 0, - 0, - 1, - gui->list->get_xposition(), - gui->list->get_yposition(), + gui->list->update(&errors, 0, 0, 1, + gui->list->get_xposition(), gui->list->get_yposition(), gui->list->get_highlighted_item(), // Flat index of item cursor is over 0, // set all autoplace flags to 1 1); -SET_TRACE + gui->raise_window(1); gui->unlock_window(); - unlock_window(); -SET_TRACE - start(); -SET_TRACE } - else - { - unlock_window(); -SET_TRACE + else { errors.remove_all_objects(); -SET_TRACE append_error(string); -SET_TRACE start(); -SET_TRACE } + unlock_window(); } void MainError::show_error(const char *string) { - if(main_error) - main_error->show_error_local(string); - else - { - printf("%s", string); - if(string[strlen(string) - 1] != '\n') - printf("\n"); - } + if( main_error ) main_error->show_error_local(string); + int len = strlen(string); + printf("%s%s", string, len>0 && string[len-1] == '\n' ? "" : "\n"); }