#include "edl.h"
#include "edlsession.h"
#include "filesystem.h"
+#include "file.h"
#include "filexml.h"
#include "fonts.h"
#include "keys.h"
mwindow->session->vwindow_y,
mwindow->session->vwindow_w,
mwindow->session->vwindow_h,
- 100,
- 100,
- 1,
- 1,
- 0) // Hide it
+ xS(100), yS(100), 1, 1, 0) // Hide it
{
this->mwindow = mwindow;
this->vwindow = vwindow;
// source = 0;
strcpy(loaded_title, "");
highlighted = 0;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("Viewer Window");
}
VWindowGUI::~VWindowGUI()
{
- vwindow->playback_engine->interrupt_playback(1);
+ vwindow->stop_playback(1);
sources.remove_all_objects();
labels.remove_all_objects();
delete canvas;
void VWindowGUI::draw_wave()
{
- TransportCommand command;
+ TransportCommand command(mwindow->preferences);
command.command = NORMAL_FWD;
command.get_edl()->copy_all(vwindow->get_edl());
command.change_type = CHANGE_ALL;
for( int i=channels; --i>=0; ) delete samples[i];
delete render_engine;
- delete cache;
+ cache->remove_user();
delete canvas->refresh_frame;
canvas->refresh_frame = vframe;
- canvas->draw_refresh(1);
+ canvas->refresh(1);
}
void VWindowGUI::change_source(EDL *edl, const char *title)
mwindow->theme->vtransport_x,
mwindow->theme->vtransport_y);
transport->create_objects();
+ transport->set_transport(LOOP_MODE);
//printf("VWindowGUI::create_objects 1\n");
// add_subwindow(fps_title = new BC_Title(mwindow->theme->vedit_x, y, ""));
canvas = new VWindowCanvas(mwindow, this);
canvas->create_objects(mwindow->edl);
- canvas->use_vwindow();
-
-
+ char vsplash_path[BCTEXTLEN];
+ int vsplash_len = sizeof(vsplash_path)-1;
+ snprintf(vsplash_path, vsplash_len, "%s/vsplash.png", File::get_cindat_path());
+ VFrame *vsplash = VFramePng::vframe_png(vsplash_path);
+ if( vsplash ) {
+ BC_WindowBase *vcanvas = canvas->get_canvas();
+ vcanvas->draw_vframe(vsplash,
+ 0,0, vcanvas->get_w(), vcanvas->get_h(),
+ 0,0, vsplash->get_w(), vsplash->get_h(), 0);
+ vcanvas->flash(1);
+ delete vsplash;
+ }
//printf("VWindowGUI::create_objects 1\n");
add_subwindow(timebar = new VTimeBar(mwindow,
this,
case 'Z':
mwindow->redo_entry(this);
break;
- case 'f':
- unlock_window();
- if(mwindow->session->vwindow_fullscreen)
- canvas->stop_fullscreen();
- else
- canvas->start_fullscreen();
- lock_window("VWindowGUI::keypress_event 1");
- break;
+ case 'f': {
+ int on = canvas->get_fullscreen() ? 0 : 1;
+ canvas->set_fullscreen(on, 1);
+ break; }
case ESC:
- unlock_window();
- if(mwindow->session->vwindow_fullscreen)
- canvas->stop_fullscreen();
- lock_window("VWindowGUI::keypress_event 2");
+ canvas->set_fullscreen(0, 1);
break;
case KEY_F1:
case KEY_F2:
}
if( !result )
result = transport->keypress_event();
+ if( !result )
+ result = context_help_check_and_show();
return result;
}
-void VWindowGUI::stop_transport(const char *lock_msg)
-{
- if( !transport->is_stopped() ) {
- if( lock_msg ) unlock_window();
- transport->handle_transport(STOP, 1, 0, 0);
- if( lock_msg ) lock_window(lock_msg);
- }
-}
-
int VWindowGUI::button_press_event()
{
if( vwindow->get_edl() != 0 && canvas->get_canvas() &&
int need_highlight = cursor_above() && get_cursor_over_window() ? 1 : 0;
if( highlighted == need_highlight ) return;
highlighted = need_highlight;
- canvas->draw_refresh();
+ canvas->refresh(1);
}
int VWindowGUI::drag_stop()
if( highlighted &&
mwindow->session->current_operation == DRAG_ASSET ) {
highlighted = 0;
- canvas->draw_refresh();
+ canvas->refresh(1);
unlock_window();
Indexable *indexable =
return 0;
}
+void VWindowGUI::stop_transport()
+{
+ if( !transport->is_stopped() ) {
+ unlock_window();
+ transport->handle_transport(STOP, 1);
+ lock_window("VWindowGUI::panel_stop_transport");
+ }
+}
void VWindowGUI::update_meters()
{
0, // use_keyframe
1, // use_splice
1, // use_overwrite
- 0, // use_lift
- 0, // use_extract
1, // use_copy
0, // use_paste
0, // use_undo
0, // use_cut
0, // use_commerical
0, // use_goto
- 1) // use_clk2play
+ 1, // use_clk2play
+ 1, // use_scope
+ 0, // use_gang_tracks
+ 0) // use_timecode
{
this->mwindow = mwindow;
this->vwindow = vwindow;
{
}
-void VWindowEditing::copy_selection()
+#define relock_vm(s) \
+ vwindow->gui->unlock_window(); \
+ mwindow->gui->lock_window("VWindowEditing::" s)
+#define relock_mv(s) \
+ mwindow->gui->unlock_window(); \
+ vwindow->gui->lock_window("VWindowEditing::" s)
+
+double VWindowEditing::get_position()
{
- vwindow->copy(subwindow->shift_down());
+ EDL *edl = vwindow->get_edl();
+ double position = !edl ? 0 : edl->local_session->get_selectionstart(1);
+ return position;
}
-void VWindowEditing::splice_selection()
+void VWindowEditing::set_position(double position)
{
- if(vwindow->get_edl())
- {
- mwindow->gui->lock_window("VWindowEditing::splice_selection");
- mwindow->splice(vwindow->get_edl(), subwindow->shift_down());
- mwindow->gui->unlock_window();
+ EDL *edl = vwindow->get_edl();
+ if( !edl ) return;
+ if( get_position() != position ) {
+ if( position < 0 ) position = 0;
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ vwindow->update_position();
}
}
-void VWindowEditing::overwrite_selection()
+void VWindowEditing::set_click_to_play(int v)
{
- if(vwindow->get_edl())
- {
- mwindow->gui->lock_window("VWindowEditing::overwrite_selection");
- mwindow->overwrite(vwindow->get_edl(), subwindow->shift_down());
- mwindow->gui->unlock_window();
- }
+ click2play->update(v);
+ relock_vm("set_click_to_play");
+ mwindow->edl->session->vwindow_click2play = v;
+ mwindow->update_vwindow();
+ relock_mv("set_click_to_play");
}
-void VWindowEditing::toggle_label()
+void VWindowEditing::panel_stop_transport()
{
- if(vwindow->get_edl())
- {
- EDL *edl = vwindow->get_edl();
- edl->labels->toggle_label(edl->local_session->get_selectionstart(1),
- edl->local_session->get_selectionend(1));
- vwindow->gui->timebar->update(1);
- }
+ vwindow->gui->stop_transport();
}
-void VWindowEditing::prev_label(int cut)
+void VWindowEditing::panel_toggle_label()
{
- if(vwindow->get_edl())
- {
- EDL *edl = vwindow->get_edl();
- vwindow->gui->unlock_window();
- vwindow->playback_engine->interrupt_playback(1);
- vwindow->gui->lock_window("VWindowEditing::prev_label");
+ if( !vwindow->get_edl() ) return;
+ EDL *edl = vwindow->get_edl();
+ edl->labels->toggle_label(edl->local_session->get_selectionstart(1),
+ edl->local_session->get_selectionend(1));
+ vwindow->gui->timebar->update(1);
+}
- Label *current = edl->labels->prev_label(
- edl->local_session->get_selectionstart(1));
+void VWindowEditing::panel_next_label(int cut)
+{
+ if( !vwindow->get_edl() ) return;
+ vwindow->interrupt_playback(1);
+ EDL *edl = vwindow->get_edl();
+ Label *current = edl->labels->next_label(
+ edl->local_session->get_selectionstart(1));
+ double position = current ? current->position :
+ edl->tracks->total_length();
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ vwindow->update_position();
+ vwindow->gui->timebar->update(1);
+}
- if(!current)
- {
- edl->local_session->set_selectionstart(0);
- edl->local_session->set_selectionend(0);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- else
- {
- edl->local_session->set_selectionstart(current->position);
- edl->local_session->set_selectionend(current->position);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- }
+void VWindowEditing::panel_prev_label(int cut)
+{
+ if( !vwindow->get_edl() ) return;
+ vwindow->interrupt_playback(1);
+
+ EDL *edl = vwindow->get_edl();
+ Label *current = edl->labels->prev_label(
+ edl->local_session->get_selectionstart(1));
+ double position = !current ? 0 : current->position;
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ vwindow->update_position();
+ vwindow->gui->timebar->update(1);
}
-void VWindowEditing::next_label(int cut)
+void VWindowEditing::panel_prev_edit(int cut) {} // not used
+void VWindowEditing::panel_next_edit(int cut) {} // not used
+
+void VWindowEditing::panel_copy_selection()
{
- if(vwindow->get_edl())
- {
- EDL *edl = vwindow->get_edl();
- Label *current = edl->labels->next_label(
- edl->local_session->get_selectionstart(1));
- if(!current)
- {
- vwindow->gui->unlock_window();
- vwindow->playback_engine->interrupt_playback(1);
- vwindow->gui->lock_window("VWindowEditing::next_label 1");
-
- double position = edl->tracks->total_length();
- edl->local_session->set_selectionstart(position);
- edl->local_session->set_selectionend(position);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- else
- {
- vwindow->gui->unlock_window();
- vwindow->playback_engine->interrupt_playback(1);
- vwindow->gui->lock_window("VWindowEditing::next_label 2");
-
- edl->local_session->set_selectionstart(current->position);
- edl->local_session->set_selectionend(current->position);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- }
+ vwindow->copy(vwindow->gui->shift_down());
}
-double VWindowEditing::get_position()
+void VWindowEditing::panel_overwrite_selection()
{
- EDL *edl = vwindow->get_edl();
- double position = !edl ? 0 : edl->local_session->get_selectionstart(1);
- return position;
+ if( !vwindow->get_edl() ) return;
+ relock_vm("overwrite_selection");
+ mwindow->overwrite(vwindow->get_edl(), vwindow->gui->shift_down());
+ relock_mv("overwrite_selection");
}
-void VWindowEditing::set_position(double position)
+void VWindowEditing::panel_splice_selection()
{
- EDL *edl = vwindow->get_edl();
- if( !edl ) return;
- if( get_position() != position ) {
- if( position < 0 ) position = 0;
- edl->local_session->set_selectionstart(position);
- edl->local_session->set_selectionend(position);
- vwindow->update_position(CHANGE_NONE, 0, 1);
- }
+ if( !vwindow->get_edl() ) return;
+ relock_vm("splice_selection");
+ mwindow->splice(vwindow->get_edl(), vwindow->gui->shift_down());
+ relock_mv("splice_selection");
}
-void VWindowEditing::set_inpoint()
+void VWindowEditing::panel_set_inpoint()
{
vwindow->set_inpoint();
}
-void VWindowEditing::set_outpoint()
+void VWindowEditing::panel_set_outpoint()
{
vwindow->set_outpoint();
}
-void VWindowEditing::unset_inoutpoint()
+void VWindowEditing::panel_unset_inoutpoint()
{
vwindow->unset_inoutpoint();
}
-
-void VWindowEditing::to_clip()
+void VWindowEditing::panel_to_clip()
{
EDL *edl = vwindow->get_edl();
if( !edl ) return;
mwindow->to_clip(edl, _("viewer window: "), subwindow->shift_down());
}
+// not used
+void VWindowEditing::panel_cut() {}
+void VWindowEditing::panel_paste() {}
+void VWindowEditing::panel_fit_selection() {}
+void VWindowEditing::panel_fit_autos(int all) {}
+void VWindowEditing::panel_set_editing_mode(int mode) {}
+void VWindowEditing::panel_set_auto_keyframes(int v) {}
+void VWindowEditing::panel_set_span_keyframes(int v) {}
+void VWindowEditing::panel_set_labels_follow_edits(int v) {}
+void VWindowEditing::panel_set_gang_tracks(int v) {}
+
+
VWindowSource::VWindowSource(MWindow *mwindow, VWindowGUI *vwindow, int x, int y)
- : BC_PopupTextBox(vwindow,
- &vwindow->sources,
- "",
- x,
- y,
- 200,
- 200)
+ : BC_PopupTextBox(vwindow, &vwindow->sources, "",
+ x, y, xS(200), yS(200))
{
this->mwindow = mwindow;
this->vwindow = vwindow;
this->gui = gui;
}
+void VWindowCanvas::create_objects(EDL *edl)
+{
+ Canvas::create_objects(edl);
+ canvas_menu->add_item(new CanvasPopupRemoveSource(this));
+}
+
void VWindowCanvas::zoom_resize_window(float percentage)
{
EDL *edl = gui->vwindow->get_edl();
gui->resize_event(new_w, new_h);
}
+void VWindowCanvas::zoom_auto()
+{
+ EDL *edl = gui->vwindow->get_edl();
+ if(!edl) edl = mwindow->edl;
+ set_zoom(edl, 0);
+}
+
void VWindowCanvas::close_source()
{
- gui->unlock_window();
- gui->vwindow->playback_engine->interrupt_playback(1);
- gui->lock_window("VWindowCanvas::close_source");
+ gui->vwindow->interrupt_playback(1);
gui->vwindow->delete_source(1, 1);
}
+int VWindowCanvas::scope_on()
+{
+ EditPanelScopeDialog *scope_dialog = gui->edit_panel->scope_dialog;
+ if( !scope_dialog || !scope_dialog->scope_gui ) return 0;
+ if( scope_dialog->scope_gui->use_refresh ) return 0;
+ if( scope_dialog->scope_gui->use_release ) return 0;
+ return scope_dialog->running();
+}
+
+void VWindowCanvas::draw_scope(VFrame *output, int refresh)
+{
+ if( !output ) return;
+ EditPanelScopeDialog *scope_dialog = gui->edit_panel->scope_dialog;
+ if( !scope_dialog || !scope_dialog->scope_gui ) return;
+ if( scope_dialog->scope_gui->use_refresh && !refresh ) return;
+ if( scope_dialog->scope_gui->use_release && refresh >= 0 ) return;
+ scope_dialog->process(output);
+}
+
+int VWindowCanvas::button_release_event()
+{
+ BC_WindowBase *window = get_canvas();
+ if( window && !window->get_video_on() )
+ draw_scope(refresh_frame, -1);
+ return Canvas::button_release_event();
+}
void VWindowCanvas::draw_refresh(int flush)
{
+ if( !get_canvas()->get_video_on() ) {
+ int cw = get_canvas()->get_w(), ch = get_canvas()->get_h();
+ get_canvas()->clear_box(0, 0, cw, ch);
+ }
EDL *edl = gui->vwindow->get_edl();
-
- if(!get_canvas()->get_video_on()) get_canvas()->clear_box(0, 0, get_canvas()->get_w(), get_canvas()->get_h());
- if(!get_canvas()->get_video_on() && refresh_frame && edl)
- {
- float in_x1, in_y1, in_x2, in_y2;
- float out_x1, out_y1, out_x2, out_y2;
- get_transfers(edl,
- in_x1, in_y1, in_x2, in_y2,
- out_x1, out_y1, out_x2, out_y2);
+ if( refresh_frame && edl ) {
+ int ow = get_output_w(edl), oh = get_output_h(edl);
+ if( ow > 0 && oh > 0 ) {
+ float in_x1, in_y1, in_x2, in_y2;
+ float out_x1, out_y1, out_x2, out_y2;
+ get_transfers(edl,
+ in_x1, in_y1, in_x2, in_y2,
+ out_x1, out_y1, out_x2, out_y2);
// input scaled from session to refresh frame coordinates
- int ow = get_output_w(edl);
- int oh = get_output_h(edl);
- int rw = refresh_frame->get_w();
- int rh = refresh_frame->get_h();
- float xs = (float)rw / ow;
- float ys = (float)rh / oh;
- in_x1 *= xs; in_x2 *= xs;
- in_y1 *= ys; in_y2 *= ys;
- get_canvas()->draw_vframe(refresh_frame,
- (int)out_x1,
- (int)out_y1,
- (int)(out_x2 - out_x1),
- (int)(out_y2 - out_y1),
- (int)in_x1,
- (int)in_y1,
- (int)(in_x2 - in_x1),
- (int)(in_y2 - in_y1),
+ int rw = refresh_frame->get_w();
+ int rh = refresh_frame->get_h();
+ float xs = (float)rw / ow;
+ float ys = (float)rh / oh;
+ in_x1 *= xs; in_x2 *= xs;
+ in_y1 *= ys; in_y2 *= ys;
+ get_canvas()->draw_vframe(refresh_frame,
+ (int)out_x1, (int)out_y1,
+ (int)(out_x2 - out_x1), (int)(out_y2 - out_y1),
+ (int)in_x1, (int)in_y1,
+ (int)(in_x2 - in_x1), (int)(in_y2 - in_y1),
0);
+ }
}
-
- if(!get_canvas()->get_video_on())
- {
+ if( !get_canvas()->get_video_on() ) {
draw_overlays();
get_canvas()->flash(flush);
}
}
}
-int VWindowCanvas::get_fullscreen()
-{
- return mwindow->session->vwindow_fullscreen;
-}
-
-void VWindowCanvas::set_fullscreen(int value)
-{
- mwindow->session->vwindow_fullscreen = value;
-}
-