3 #include "confirmquit.h"
5 #include "levelwindow.h"
6 #include "levelwindowgui.h"
9 #include "mwindowgui.h"
14 #include "mainsession.h"
15 #include "videowindow.h"
16 #include "videowindowgui.h"
20 #define _(String) gettext(String)
21 #define gettext_noop(String) String
22 #define N_(String) gettext_noop (String)
24 Quit::Quit(MWindow *mwindow)
25 : BC_MenuItem(_("Quit"), "q", 'q'), Thread()
27 this->mwindow = mwindow;
29 int Quit::create_objects(Save *save)
35 int Quit::handle_event()
38 //printf("Quit::handle_event 1 %d\n", mwindow->session->changes_made);
39 if(mwindow->session->changes_made ||
40 mwindow->gui->mainmenu->record->current_state ||
41 mwindow->render->in_progress)
47 mwindow->gui->unlock_window();
48 mwindow->interrupt_indexes();
49 mwindow->gui->set_done(0);
50 mwindow->gui->lock_window();
58 // Test execution conditions
59 if(mwindow->gui->mainmenu->record->current_state == RECORD_CAPTURING)
61 ErrorBox error(PROGRAM_NAME ": Error",
62 mwindow->gui->get_abs_cursor_x(1),
63 mwindow->gui->get_abs_cursor_y(1));
64 error.create_objects(_("Can't quit while a recording is in progress."));
69 if(mwindow->render->running())
71 ErrorBox error(PROGRAM_NAME ": Error",
72 mwindow->gui->get_abs_cursor_x(1),
73 mwindow->gui->get_abs_cursor_y(1));
74 error.create_objects(_("Can't quit while a render is in progress."));
80 //printf("Quit::run 1\n");
84 //printf("Quit::run 2\n");
85 ConfirmQuitWindow confirm(mwindow);
86 //printf("Quit::run 2\n");
87 confirm.create_objects(_("Save edit list before exiting?"));
88 //printf("Quit::run 2\n");
89 result = confirm.run_window();
90 //printf("Quit::run 2\n");
92 //printf("Quit::run 3\n");
99 mwindow->interrupt_indexes();
100 // Last command in program
101 mwindow->gui->set_done(0);
110 save->save_before_quit();