3 #include "mwindowgui.h"
4 #include "playbackengine.h"
5 #include "preferences.h"
6 #include "mainsession.h"
7 #include "setframerate.h"
11 #define _(String) gettext(String)
12 #define gettext_noop(String) String
13 #define N_(String) gettext_noop (String)
15 SetFrameRate::SetFrameRate(MWindow *mwindow)
16 : BC_MenuItem(_("Frame rate..."))
18 this->mwindow = mwindow;
19 thread = new SetFrameRateThread(mwindow);
22 SetFrameRate::~SetFrameRate()
27 int SetFrameRate::handle_event() { thread->start(); }
29 SetFrameRateThread::SetFrameRateThread(MWindow *mwindow) : Thread()
31 this->mwindow = mwindow;
34 SetFrameRateThread::~SetFrameRateThread() {}
36 void SetFrameRateThread::run()
38 frame_rate = mwindow->session->frame_rate;
39 // scale_data = mwindow->defaults->get("FRAMERATESCALEDATA", 0);
42 SetFrameRateWindow window(mwindow, this);
43 window.create_objects();
44 int result = window.run_window();
47 mwindow->undo->update_undo_edits(_("Frame rate"), 0);
48 if(scale_data) mwindow->tracks->scale_time(frame_rate / mwindow->session->frame_rate, 1, 1, 1, 0, mwindow->tracks->total_samples());
49 mwindow->session->frame_rate = frame_rate;
50 mwindow->preferences->actual_frame_rate = frame_rate;
51 mwindow->undo->update_undo_edits();
52 mwindow->redraw_time_dependancies();
55 // mwindow->defaults->update("FRAMERATESCALEDATA", scale_data);
59 SetFrameRateWindow::SetFrameRateWindow(MWindow *mwindow, SetFrameRateThread *thread)
60 : BC_Window(PROGRAM_NAME ": Frame Rate",
61 mwindow->gui->get_abs_cursor_x(),
62 mwindow->gui->get_abs_cursor_y(),
66 this->thread = thread;
69 SetFrameRateWindow::~SetFrameRateWindow()
73 int SetFrameRateWindow::create_objects()
75 add_subwindow(new BC_Title(5, 5, _("Enter the frame rate to use:")));
76 add_subwindow(new BC_OKButton(10, get_h() - 40));
77 add_subwindow(new BC_CancelButton(get_w() - 100, get_h() - 40));
79 add_subwindow(new SetFrameRateTextBox(thread));
82 SetFrameRateTextBox::SetFrameRateTextBox(SetFrameRateThread *thread)
83 : BC_TextBox(10, 40, 100, 1, thread->frame_rate)
85 this->thread = thread;
88 int SetFrameRateTextBox::handle_event()
90 thread->frame_rate = atof(get_text());
93 SetFrameRateMoveData::SetFrameRateMoveData(SetFrameRateThread *thread)
94 : BC_CheckBox(120, 40, thread->scale_data, _("Scale data"))
96 this->thread = thread;
99 int SetFrameRateMoveData::handle_event()
101 thread->scale_data = get_value();