r999: maintainers added to README_en.
[cinelerra_cv/mob.git] / cinelerra / featheredits.C
blobb28d41bff5027ef082cd5ced3fbc00b3cb913585
1 #include "featheredits.h"
2 #include "mainundo.h"
3 #include "mwindow.h"
4 #include "mwindowgui.h"
6 #include <libintl.h>
7 #define _(String) gettext(String)
8 #define gettext_noop(String) String
9 #define N_(String) gettext_noop (String)
13 FeatherEdits::FeatherEdits(MWindow *mwindow, int audio, int video)
14  : BC_MenuItem("Feather Edits..."), Thread()
15
16         this->mwindow = mwindow; 
17         this->audio = audio; 
18         this->video = video; 
21 int FeatherEdits::handle_event()
23         set_synchronous(0);
24         Thread::start();
28 void FeatherEdits::run()
30         int result;
31         long feather_samples;
33         {
34                 feather_samples = mwindow->get_feather(audio, video);
36                 FeatherEditsWindow window(mwindow, feather_samples);
38                 window.create_objects(audio, video);
39                 result = window.run_window();
40                 feather_samples = window.feather_samples;
41         }
43         if(!result)
44         {
45                 mwindow->gui->lock_window();
46 //              mwindow->undo->update_undo_edits(_("Feather"), 0);
47                 
48                 mwindow->feather_edits(feather_samples, audio, video);
50 //              mwindow->undo->update_undo_edits();
51                 mwindow->gui->unlock_window();
52         }
56 FeatherEditsWindow::FeatherEditsWindow(MWindow *mwindow, long feather_samples)
57  : BC_Window(PROGRAM_NAME ": Feather Edits", 
58         mwindow->gui->get_abs_cursor_x(), 
59         mwindow->gui->get_abs_cursor_y(), 
60         340, 
61         140)
63         this->feather_samples = feather_samples;
66 FeatherEditsWindow::~FeatherEditsWindow()
68         delete text;
71 int FeatherEditsWindow::create_objects(int audio, int video)
73         int x = 10;
74         int y = 10;
75         this->audio = audio;
76         this->video = video;
78         if(audio)
79                 add_subwindow(new BC_Title(x, y, _("Feather by how many samples:")));
80         else
81                 add_subwindow(new BC_Title(x, y, _("Feather by how many frames:")));
83         y += 20;
84         char string[1024];
85         sprintf(string, "%d", feather_samples);
86         add_subwindow(text = new FeatherEditsTextBox(this, string, x, y));
88         y += 20;
89         add_subwindow(new BC_OKButton(x, y));
90         add_subwindow(new BC_CancelButton(x, y));
91         return 0;
94 FeatherEditsTextBox::FeatherEditsTextBox(FeatherEditsWindow *window, char *text, int x, int y)
95  : BC_TextBox(x, y, 100, 1, text)
97         this->window = window;
100 int FeatherEditsTextBox::handle_event()
102         window->feather_samples = atol(get_text());
103         return 0;