#include "language.h"
#include "localsession.h"
#include "mainclock.h"
+#include "mainsession.h"
#include "mainundo.h"
+#include "manualgoto.h"
#include "mbuttons.h"
#include "meterpanel.h"
#include "mwindow.h"
#include "mwindowgui.h"
#include "playbackengine.h"
+#include "preferences.h"
+#include "scopewindow.h"
#include "theme.h"
#include "timebar.h"
#include "trackcanvas.h"
#include "transportque.h"
+#include "vwindowgui.h"
#include "zoombar.h"
-#include "manualgoto.h"
int use_cut,
int use_commercial,
int use_goto,
- int use_clk2play)
+ int use_clk2play,
+ int use_scope)
{
this->window_id = window_id;
this->editing_mode = editing_mode;
this->use_commercial = use_commercial;
this->use_goto = use_goto;
this->use_clk2play = use_clk2play;
+ this->use_scope = use_scope;
this->x = x;
this->y = y;
this->arrow = 0;
this->ibeam = 0;
this->keyframe = 0;
+ this->span_keyframe = 0;
this->mangoto = 0;
this->click2play = 0;
+ this->scope = 0;
+ this->scope_dialog = 0;
locklabels = 0;
}
EditPanel::~EditPanel()
{
+ delete scope_dialog;
}
void EditPanel::set_meters(MeterPanel *meter_panel)
if( arrow ) arrow->update(new_editing_mode == EDITING_ARROW);
if( ibeam ) ibeam->update(new_editing_mode == EDITING_IBEAM);
if( keyframe ) keyframe->update(mwindow->edl->session->auto_keyframes);
+ if( span_keyframe ) span_keyframe->update(mwindow->edl->session->span_keyframes);
if( locklabels ) locklabels->set_value(mwindow->edl->session->labels_follow_edits);
if( click2play ) {
int value = !is_vwindow() ?
int EditPanel::calculate_w(MWindow *mwindow, int use_keyframe, int total_buttons)
{
- int result = 0;
- int button_w = mwindow->theme->get_image_set("ibeam")[0]->get_w();
- if( use_keyframe ) {
- result += button_w + mwindow->theme->toggle_margin;
- }
-
- result += button_w * total_buttons;
+ int button_w = xS(24); // mwindow->theme->get_image_set("meters")[0]->get_w();
+ int result = button_w * total_buttons;
+ if( use_keyframe )
+ result += 2*(button_w + mwindow->theme->toggle_margin);
return result;
}
int EditPanel::calculate_h(MWindow *mwindow)
{
- return mwindow->theme->get_image_set("ibeam")[0]->get_h();
+ return mwindow->theme->get_image_set("meters")[0]->get_h();
}
void EditPanel::create_buttons()
keyframe = new KeyFrameButton(mwindow, this, x1, y1);
subwindow->add_subwindow(keyframe);
x1 += keyframe->get_w();
+ span_keyframe = new SpanKeyFrameButton(mwindow, this, x1, y1);
+ subwindow->add_subwindow(span_keyframe);
+ x1 += span_keyframe->get_w();
}
if( use_locklabels ) {
x1 += paste->get_w();
}
- if( use_meters ) {
- if( meter_panel ) {
- meters = new MeterShow(mwindow, meter_panel, x1, y1);
- subwindow->add_subwindow(meters);
- x1 += meters->get_w();
- }
- else
- printf("EditPanel::create_objects: meter_panel == 0\n");
- }
-
if( use_labels ) {
labelbutton = new EditLabelbutton(mwindow, this, x1, y1);
subwindow->add_subwindow(labelbutton);
}
if( use_clk2play ) {
- click2play = new EditClick2Play(mwindow, this, x1, y1+5);
+ click2play = new EditClick2Play(mwindow, this, x1, y1+yS(3));
subwindow->add_subwindow(click2play);
x1 += click2play->get_w();
}
+ if( use_scope ) {
+ scope = new EditPanelScope(mwindow, this, x1, y1-yS(1));
+ subwindow->add_subwindow(scope);
+ x1 += scope->get_w();
+ scope_dialog = new EditPanelScopeDialog(mwindow, this);
+ }
+
+ if( use_meters ) {
+ if( meter_panel ) {
+ meters = new MeterShow(mwindow, meter_panel, x1, y1);
+ subwindow->add_subwindow(meters);
+ x1 += meters->get_w();
+ }
+ else
+ printf("EditPanel::create_objects: meter_panel == 0\n");
+ }
+
if( use_commercial ) {
commercial = new EditCommercial(mwindow, this, x1, y1);
subwindow->add_subwindow(commercial);
if( use_keyframe ) {
keyframe->reposition_window(x1, y1);
x1 += keyframe->get_w();
+ span_keyframe->reposition_window(x1, y1);
+ x1 += span_keyframe->get_w();
}
if( use_locklabels ) {
x1 += paste->get_w();
}
- if( use_meters ) {
- meters->reposition_window(x1, y1);
- x1 += meters->get_w();
- }
-
if( use_labels ) {
labelbutton->reposition_window(x1, y1);
x1 += labelbutton->get_w();
x1 += mangoto->get_w();
}
if( use_clk2play ) {
- click2play->reposition_window(x1, y1+5);
+ click2play->reposition_window(x1, y1+yS(3));
x1 += click2play->get_w();
}
+ if( use_scope ) {
+ scope->reposition_window(x1, y1-yS(1));
+ x1 += scope->get_w();
+ }
+
+ if( use_meters ) {
+ meters->reposition_window(x1, y1);
+ x1 += meters->get_w();
+ }
}
void EditPanel::create_objects()
return 0;
}
+//set_span_keyframes
+SpanKeyFrameButton::SpanKeyFrameButton(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Toggle(x, y,
+ mwindow->theme->get_image_set("spankeyframe"),
+ mwindow->edl->session->span_keyframes,
+ "", 0, 0, 0)
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ set_tooltip(_("Allow keyframe spanning"));
+}
+
+int SpanKeyFrameButton::handle_event()
+{
+ panel->panel_set_span_keyframes(get_value());
+ return 1;
+}
+
//set_labels_follow_edits
LockLabelsButton::LockLabelsButton(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Toggle(x, y,
return 1;
}
+
+EditPanelScopeDialog::EditPanelScopeDialog(MWindow *mwindow, EditPanel *panel)
+ : BC_DialogThread()
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ scope_gui = 0;
+ gui_lock = new Mutex("EditPanelScopeDialog::gui_lock");
+}
+
+EditPanelScopeDialog::~EditPanelScopeDialog()
+{
+ close_window();
+ delete gui_lock;
+}
+
+void EditPanelScopeDialog::handle_close_event(int result)
+{
+ scope_gui = 0;
+}
+void EditPanelScopeDialog::handle_done_event(int result)
+{
+ gui_lock->lock("EditPanelScopeDialog::handle_done_event");
+ scope_gui = 0;
+ gui_lock->unlock();
+
+ panel->subwindow->lock_window("EditPanelScopeDialog::handle_done_event");
+ panel->scope->update(0);
+ panel->subwindow->unlock_window();
+}
+
+BC_Window* EditPanelScopeDialog::new_gui()
+{
+ EditPanelScopeGUI *gui = new EditPanelScopeGUI(mwindow, this);
+ gui->create_objects();
+ scope_gui = gui;
+ return gui;
+}
+
+void EditPanelScopeDialog::process(VFrame *output_frame)
+{
+ if( panel->scope_dialog ) {
+ panel->scope_dialog->gui_lock->lock("EditPanelScopeDialog::process");
+ if( panel->scope_dialog->scope_gui ) {
+ EditPanelScopeGUI *gui = panel->scope_dialog->scope_gui;
+ gui->process(output_frame);
+ }
+ panel->scope_dialog->gui_lock->unlock();
+ }
+}
+
+EditPanelScopeGUI::EditPanelScopeGUI(MWindow *mwindow, EditPanelScopeDialog *dialog)
+ : ScopeGUI(mwindow->theme,
+ mwindow->session->scope_x, mwindow->session->scope_y,
+ mwindow->session->scope_w, mwindow->session->scope_h,
+ mwindow->get_cpus())
+{
+ this->mwindow = mwindow;
+ this->dialog = dialog;
+}
+
+EditPanelScopeGUI::~EditPanelScopeGUI()
+{
+}
+
+void EditPanelScopeGUI::create_objects()
+{
+ MainSession *session = mwindow->session;
+ use_hist = session->use_hist;
+ use_wave = session->use_wave;
+ use_vector = session->use_vector;
+ use_hist_parade = session->use_hist_parade;
+ use_wave_parade = session->use_wave_parade;
+ use_wave_gain = session->use_wave_gain;
+ use_vect_gain = session->use_vect_gain;
+ use_smooth = session->use_smooth;
+ use_refresh = session->use_refresh;
+ use_release = session->use_release;
+ use_graticule = session->use_graticule;
+ ScopeGUI::create_objects();
+}
+
+void EditPanelScopeGUI::toggle_event()
+{
+ MainSession *session = mwindow->session;
+ session->use_hist = use_hist;
+ session->use_wave = use_wave;
+ session->use_vector = use_vector;
+ session->use_hist_parade = use_hist_parade;
+ session->use_wave_parade = use_wave_parade;
+ session->use_wave_gain = use_wave_gain;
+ session->use_vect_gain = use_vect_gain;
+ session->use_smooth = use_smooth;
+ session->use_refresh = use_refresh;
+ session->use_release = use_release;
+ session->use_graticule = use_graticule;
+}
+
+int EditPanelScopeGUI::translation_event()
+{
+ ScopeGUI::translation_event();
+ MainSession *session = mwindow->session;
+ session->scope_x = get_x();
+ session->scope_y = get_y();
+ return 0;
+}
+
+int EditPanelScopeGUI::resize_event(int w, int h)
+{
+ ScopeGUI::resize_event(w, h);
+ MainSession *session = mwindow->session;
+ session->scope_w = w;
+ session->scope_h = h;
+ return 0;
+}
+
+EditPanelScope::EditPanelScope(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Toggle(x, y, mwindow->theme ?
+ mwindow->theme->get_image_set("scope_toggle") : 0, 0)
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ set_tooltip(_("View scope"));
+}
+
+EditPanelScope::~EditPanelScope()
+{
+}
+
+void EditPanelScopeGUI::update_scope()
+{
+ Canvas *canvas = 0;
+ if( dialog->panel->is_cwindow() ) {
+ CWindowGUI *cgui = (CWindowGUI *)dialog->panel->subwindow;
+ canvas = cgui->canvas;
+ }
+ else if( dialog->panel->is_vwindow() ) {
+ VWindowGUI *vgui = (VWindowGUI *)dialog->panel->subwindow;
+ canvas = vgui->canvas;
+ }
+ if( canvas && canvas->refresh_frame )
+ process(canvas->refresh_frame);
+}
+
+int EditPanelScope::handle_event()
+{
+ unlock_window();
+ int v = get_value();
+ if( v )
+ panel->scope_dialog->start();
+ else
+ panel->scope_dialog->close_window();
+ lock_window("EditPanelScope::handle_event");
+ return 1;
+}
+