r1053: Add Russian translation.
[cinelerra_cv.git] / guicast / bcdialog.C
blob920c1d567da0bba8e16d98c7c90d7b7fd53da4dc
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::lock_window(char *location)
35         window_lock->lock(location);
38 void BC_DialogThread::unlock_window()
40         window_lock->unlock();
43 void BC_DialogThread::start()
45         if(Thread::running())
46         {
47                 window_lock->lock("BC_DialogThread::start");
48                 if(gui)
49                 {
50                         gui->lock_window("BC_DialogThread::start");
51                         gui->raise_window(1);
52                         gui->unlock_window();
53                 }
54                 window_lock->unlock();
55                 return;
56         }
58 // Don't allow anyone else to create the window
59         startup_lock->lock("BC_DialogThread::start");
60         Thread::start();
62 // Wait for startup
63         startup_lock->lock("BC_DialogThread::start");
64         startup_lock->unlock();
67 void BC_DialogThread::run()
69         gui = new_gui();
70         startup_lock->unlock();
71         int result = gui->run_window();
73         handle_done_event(result);
75         window_lock->lock("BC_DialogThread::run");
76         delete gui;
77         gui = 0;
78         window_lock->unlock();
80         handle_close_event(result);
83 BC_Window* BC_DialogThread::new_gui()
85         printf("BC_DialogThread::new_gui called\n");
86         return 0;
89 BC_Window* BC_DialogThread::get_gui()
91         return gui;
94 void BC_DialogThread::handle_done_event(int result)
98 void BC_DialogThread::handle_close_event(int result)