r915:
[cinelerra_cv/mob.git] / cinelerra / mainerror.h
blob4c56e1f51c98342dc92177aec26634b7bf4a82f9
1 #ifndef MAINERROR_H
2 #define MAINERROR_H
5 #include "bcdialog.h"
6 #include "mainerror.inc"
7 #include "mutex.inc"
8 #include "mwindow.inc"
10 // This is needed for errors which are too verbose to fit in the
11 // status bar.
13 // Once created, it accumulates errors in a listbox until it's closed.
15 // Macro to enable the simplest possible error output
16 //#define eprintf(format, ...) {char error_string[1024]; sprintf(sprintf(error_string, "%s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__); MainError::show_error(error_string); }
17 // We have to use longer version if we want to gettext error messages
18 #define eprintf(...) {char error_string[1024]; sprintf(error_string, "%s: ", __PRETTY_FUNCTION__); sprintf(error_string + strlen(error_string), __VA_ARGS__); MainError::show_error(error_string); }
22 class MainErrorGUI : public BC_Window
24 public:
25 MainErrorGUI(MWindow *mwindow, MainError *thread, int x, int y);
26 ~MainErrorGUI();
28 void create_objects();
29 int resize_event(int w, int h);
31 MWindow *mwindow;
32 MainError *thread;
33 BC_ListBox *list;
34 BC_Title *title;
38 class MainError : public BC_DialogThread
40 public:
41 MainError(MWindow *mwindow);
42 ~MainError();
44 friend class MainErrorGUI;
46 BC_Window* new_gui();
49 // Display error message to command line or GUI, depending on what exists.
50 static void show_error(char *string);
53 private:
54 void show_error_local(char *string);
56 // Split errors into multiple lines based on carriage returns.
57 void append_error(char *string);
60 MWindow *mwindow;
61 ArrayList<BC_ListBoxItem*> errors;
62 Mutex *errors_lock;
64 // Main error dialog. Won't exist if no GUI.
65 static MainError *main_error;
71 #endif