r717: Made the highlighted text color of the menus WHITE
[cinelerra_cv/mob.git] / guicast / bcdialog.C
blob8b5b267132afc6dd1b601cc35edce26c2f77f22f
1 #include "bcdialog.h"
2 #include "condition.h"
3 #include "mutex.h"
9 BC_DialogThread::BC_DialogThread()
10  : Thread(1, 0, 0)
12         gui = 0;
13         startup_lock = new Condition(1, "BC_DialogThread::startup_lock");
14         window_lock = new Mutex("BC_DialogThread::window_lock");
17 BC_DialogThread::~BC_DialogThread()
19         startup_lock->lock("BC_DialogThread::~BC_DialogThread");
20         if(gui)
21         {
22                 gui->lock_window();
23                 gui->set_done(1);
24                 gui->unlock_window();
25         }
26         startup_lock->unlock();
27         Thread::join();
29         delete startup_lock;
30         delete window_lock;
33 void BC_DialogThread::start()
35         if(Thread::running())
36         {
37                 window_lock->lock("BC_DialogThread::start");
38                 if(gui)
39                 {
40                         gui->lock_window("BC_DialogThread::start");
41                         gui->raise_window(1);
42                         gui->unlock_window();
43                 }
44                 window_lock->unlock();
45                 return;
46         }
48 // Don't allow anyone else to create the window
49         startup_lock->lock("BC_DialogThread::start");
50         Thread::start();
52 // Wait for startup
53         startup_lock->lock("BC_DialogThread::start");
54         startup_lock->unlock();
57 void BC_DialogThread::run()
59         gui = new_gui();
60         startup_lock->unlock();
61         int result = gui->run_window();
63         handle_done_event(result);
65         window_lock->lock("BC_DialogThread::run");
66         delete gui;
67         gui = 0;
68         window_lock->unlock();
70         handle_close_event(result);
73 BC_Window* BC_DialogThread::new_gui()
75         printf("BC_DialogThread::new_gui called\n");
76         return 0;
79 BC_Window* BC_DialogThread::get_gui()
81         return gui;
84 void BC_DialogThread::handle_done_event(int result)
88 void BC_DialogThread::handle_close_event(int result)