3 #include "confirmquit.h"
6 #include "levelwindow.h"
7 #include "levelwindowgui.h"
10 #include "mwindowgui.h"
11 #include "playback3d.h"
16 #include "mainsession.h"
17 #include "videowindow.h"
18 #include "videowindowgui.h"
21 Quit::Quit(MWindow *mwindow)
22 : BC_MenuItem(_("Quit"), "q", 'q'), Thread()
24 this->mwindow = mwindow;
26 int Quit::create_objects(Save *save)
32 int Quit::handle_event()
35 //printf("Quit::handle_event 1 %d\n", mwindow->session->changes_made);
36 if(mwindow->session->changes_made ||
37 mwindow->gui->mainmenu->record->current_state ||
38 mwindow->render->in_progress)
44 mwindow->gui->unlock_window();
45 mwindow->interrupt_indexes();
46 // mwindow->gui->set_done(0);
47 // BC_WindowBase::get_resources()->synchronous->quit();
48 mwindow->playback_3d->quit();
49 mwindow->gui->lock_window();
57 // Test execution conditions
58 if(mwindow->gui->mainmenu->record->current_state == RECORD_CAPTURING)
60 ErrorBox error(PROGRAM_NAME ": Error",
61 mwindow->gui->get_abs_cursor_x(1),
62 mwindow->gui->get_abs_cursor_y(1));
63 error.create_objects(_("Can't quit while a recording is in progress."));
68 if(mwindow->render->running())
70 ErrorBox error(PROGRAM_NAME ": Error",
71 mwindow->gui->get_abs_cursor_x(1),
72 mwindow->gui->get_abs_cursor_y(1));
73 error.create_objects(_("Can't quit while a render is in progress."));
79 //printf("Quit::run 1\n");
83 //printf("Quit::run 2\n");
84 ConfirmQuitWindow confirm(mwindow);
85 //printf("Quit::run 2\n");
86 confirm.create_objects(_("Save edit list before exiting?"));
87 //printf("Quit::run 2\n");
88 result = confirm.run_window();
89 //printf("Quit::run 2\n");
91 //printf("Quit::run 3\n");
98 mwindow->interrupt_indexes();
99 // Last command in program
100 // mwindow->gui->set_done(0);
101 // BC_WindowBase::get_resources()->synchronous->quit();
102 mwindow->playback_3d->quit();
111 save->save_before_quit();