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
22 #include "featheredits.h"
25 #include "mwindowgui.h"
28 #define _(String) gettext(String)
29 #define gettext_noop(String) String
30 #define N_(String) gettext_noop (String)
34 FeatherEdits::FeatherEdits(MWindow *mwindow, int audio, int video)
35 : BC_MenuItem(_("Feather Edits...")), Thread()
37 this->mwindow = mwindow;
42 int FeatherEdits::handle_event()
49 void FeatherEdits::run()
55 feather_samples = mwindow->get_feather(audio, video);
57 FeatherEditsWindow window(mwindow, feather_samples);
59 window.create_objects(audio, video);
60 result = window.run_window();
61 feather_samples = window.feather_samples;
66 mwindow->gui->lock_window();
67 // mwindow->undo->update_undo_edits(_("Feather"), 0);
69 mwindow->feather_edits(feather_samples, audio, video);
71 // mwindow->undo->update_undo_edits();
72 mwindow->gui->unlock_window();
77 FeatherEditsWindow::FeatherEditsWindow(MWindow *mwindow, long feather_samples)
78 : BC_Window(_(PROGRAM_NAME ": Feather Edits"),
79 mwindow->gui->get_abs_cursor_x(),
80 mwindow->gui->get_abs_cursor_y(),
84 this->feather_samples = feather_samples;
87 FeatherEditsWindow::~FeatherEditsWindow()
92 int FeatherEditsWindow::create_objects(int audio, int video)
100 add_subwindow(new BC_Title(x, y, _("Feather by how many samples:")));
102 add_subwindow(new BC_Title(x, y, _("Feather by how many frames:")));
106 sprintf(string, "%d", feather_samples);
107 add_subwindow(text = new FeatherEditsTextBox(this, string, x, y));
110 add_subwindow(new BC_OKButton(x, y));
111 add_subwindow(new BC_CancelButton(x, y));
115 FeatherEditsTextBox::FeatherEditsTextBox(FeatherEditsWindow *window, char *text, int x, int y)
116 : BC_TextBox(x, y, 100, 1, text)
118 this->window = window;
121 int FeatherEditsTextBox::handle_event()
123 window->feather_samples = atol(get_text());