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"
37 #include "mainsession.h"
38 #include "videowindow.h"
39 #include "videowindowgui.h"
42 Quit::Quit(MWindow *mwindow)
43 : BC_MenuItem(_("Quit"), "q", 'q'), Thread()
45 this->mwindow = mwindow;
48 void Quit::create_objects(Save *save)
53 int Quit::handle_event()
56 //printf("Quit::handle_event 1 %d\n", mwindow->session->changes_made);
57 Record *record = mwindow->gui->record;
58 if( mwindow->session->changes_made || mwindow->render->in_progress ||
59 record->capturing || record->recording || record->writing_file ) {
73 // Test execution conditions
74 Record *record = mwindow->gui->record;
75 if( record->capturing || record->recording || record->writing_file ) {
76 ErrorBox error(_(PROGRAM_NAME ": Error"),
77 mwindow->gui->get_abs_cursor_x(1),
78 mwindow->gui->get_abs_cursor_y(1));
79 error.create_objects(_("Can't quit while a recording is in progress."));
84 if(mwindow->render->thread->running())
86 ErrorBox error(_(PROGRAM_NAME ": Error"),
87 mwindow->gui->get_abs_cursor_x(1),
88 mwindow->gui->get_abs_cursor_y(1));
89 error.create_objects(_("Can't quit while a render is in progress."));
94 ConfirmQuitWindow confirm(mwindow);
95 confirm.create_objects(_("Save edit list before exiting?"));
96 result = confirm.run_window();
108 save->save_before_quit();