4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "confirmquit.h"
27 #include "levelwindow.h"
28 #include "levelwindowgui.h"
31 #include "mwindowgui.h"
32 #include "playback3d.h"
33 #include "preferences.h"
38 #include "mainsession.h"
39 #include "videowindow.h"
40 #include "videowindowgui.h"
43 Quit::Quit(MWindow *mwindow)
44 : BC_MenuItem(_("Quit"), "q", 'q'), Thread()
46 this->mwindow = mwindow;
49 void Quit::create_objects(Save *save)
54 int Quit::handle_event()
57 //printf("Quit::handle_event 1 %d\n", mwindow->session->changes_made);
58 Record *record = mwindow->gui->record;
59 if( !mwindow->preferences->perpetual_session &&
60 ( mwindow->session->changes_made || mwindow->render->in_progress ||
61 record->capturing || record->recording || record->writing_file ) ) {
75 // Test execution conditions
76 Record *record = mwindow->gui->record;
77 if( record->capturing || record->recording || record->writing_file ) {
78 ErrorBox error(_(PROGRAM_NAME ": Error"),
79 mwindow->gui->get_abs_cursor_x(1),
80 mwindow->gui->get_abs_cursor_y(1));
81 error.create_objects(_("Can't quit while a recording is in progress."));
86 if(mwindow->render->thread->running())
88 ErrorBox error(_(PROGRAM_NAME ": Error"),
89 mwindow->gui->get_abs_cursor_x(1),
90 mwindow->gui->get_abs_cursor_y(1));
91 error.create_objects(_("Can't quit while a render is in progress."));
96 ConfirmQuitWindow confirm(mwindow);
97 confirm.create_objects(_("Save edit list before exiting?"));
98 result = confirm.run_window();
110 save->save_before_quit();