$(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT))
ln -f -s ../bin/$(WANT_CIN) ci
-$(CUTADS): $(CUTOBJS) $(CUTLIBS)
+$(CUTADS): $(CUTOBJS) $(CUTLIBS) $(LIBRARIES)
@echo g++ -o $@ $(CUTOBJS)
@g++ $(CFLAGS) -pthread -o $@ $(CUTOBJS) $(CUTLIBS) $(LIBS)
$(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(CUTADS) $(CUTADS).debuginfo)
*/
#include "apatchgui.h"
-#include "apatchgui.inc"
#include "atrack.h"
#include "autoconf.h"
#include "automation.h"
#include "edlsession.h"
#include "floatauto.h"
#include "floatautos.h"
+#include "gwindowgui.h"
+#include "intauto.h"
+#include "intautos.h"
#include "language.h"
#include "localsession.h"
#include "mainundo.h"
AFadePatch::AFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y, int w)
- : BC_FSlider(x,
- y,
- 0,
- w,
- w,
- mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_AUDIO_FADE],
- mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE],
- get_keyframe(mwindow, patch)->get_value())
+ : BC_FSlider(x, y, 0, w, w,
+ mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_AUDIO_FADE],
+ mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE],
+ mwindow->get_float_auto(patch, AUTOMATION_FADE)->get_value())
{
this->mwindow = mwindow;
this->patch = patch;
return 1;
}
-FloatAuto* AFadePatch::get_keyframe(MWindow *mwindow, APatchGUI *patch)
+AKeyFadePatch::AKeyFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y)
+ : BC_SubWindow(x,y, patch->patchbay->get_w(),20,
+ GWindowGUI::auto_colors[AUTOMATION_FADE])
{
- Auto *current = 0;
- double unit_position = mwindow->edl->local_session->get_selectionstart(1);
- unit_position = mwindow->edl->align_to_frame(unit_position, 0);
- unit_position = patch->atrack->to_units(unit_position, 0);
-
- FloatAutos *ptr = (FloatAutos*)patch->atrack->automation->autos[AUTOMATION_FADE];
- return (FloatAuto*)ptr->get_prev_auto(
- (long)unit_position,
- PLAY_FORWARD,
- current);
+ this->mwindow = mwindow;
+ this->patch = patch;
+}
+
+void AKeyFadePatch::create_objects()
+{
+ akey_fade_value = new AKeyFadeValue(this);
+ add_subwindow(akey_fade_value);
+ akey_fade_value->activate();
+ show_window();
+}
+
+AKeyFadeValue::AKeyFadeValue(AKeyFadePatch *akey_fade_patch)
+ : AFadePatch(akey_fade_patch->mwindow, akey_fade_patch->patch,
+ 0,0, akey_fade_patch->get_w())
+{
+ this->akey_fade_patch = akey_fade_patch;
+}
+
+int AKeyFadeValue::button_release_event()
+{
+ AFadePatch::button_release_event();
+ return 0;
+}
+
+int AKeyFadeValue::handle_event()
+{
+ APatchGUI *patch = akey_fade_patch->patch;
+ int ret = AFadePatch::handle_event();
+ AFadePatch *fade = patch->fade;
+ if( fade )
+ fade->update(get_value());
+ return ret;
}
APanPatch::APanPatch(MWindow *mwindow, APatchGUI *patch, int x, int y)
- : BC_Pan(x,
- y,
- PAN_RADIUS,
- MAX_PAN,
- mwindow->edl->session->audio_channels,
- mwindow->edl->session->achannel_positions,
- get_keyframe(mwindow, patch)->handle_x,
- get_keyframe(mwindow, patch)->handle_y,
- get_keyframe(mwindow, patch)->values)
+ : BC_Pan(x, y, PAN_RADIUS, MAX_PAN,
+ mwindow->edl->session->audio_channels,
+ mwindow->edl->session->achannel_positions,
+ mwindow->get_pan_auto(patch)->handle_x,
+ mwindow->get_pan_auto(patch)->handle_y,
+ mwindow->get_pan_auto(patch)->values)
{
this->mwindow = mwindow;
this->patch = patch;
return 1;
}
-PanAuto* APanPatch::get_keyframe(MWindow *mwindow, APatchGUI *patch)
+AKeyPanPatch::AKeyPanPatch(MWindow *mwindow, APatchGUI *patch)
+ : APanPatch(mwindow, patch, -1,-1)
{
- Auto *current = 0;
- double unit_position = mwindow->edl->local_session->get_selectionstart(1);
- unit_position = mwindow->edl->align_to_frame(unit_position, 0);
- unit_position = patch->atrack->to_units(unit_position, 0);
-
- PanAutos *ptr = (PanAutos*)patch->atrack->automation->autos[AUTOMATION_PAN];
- return (PanAuto*)ptr->get_prev_auto(
- (long)unit_position,
- PLAY_FORWARD,
- current);
}
+int AKeyPanPatch::button_release_event()
+{
+ APanPatch::button_release_event();
+ return 0;
+}
+int AKeyPanPatch::handle_event()
+{
+ int ret = APanPatch::handle_event();
+ APanPatch *pan = patch->pan;
+ if( pan )
+ pan->update(get_stick_x(), get_stick_y());
+ return ret;
+}
AMeterPatch::AMeterPatch(MWindow *mwindow, APatchGUI *patch, int x, int y)
return 0;
}
-
-
-
-
#include "panauto.inc"
#include "patchgui.h"
-class AFadePatch;
-class APanPatch;
-class AMeterPatch;
class APatchGUI : public PatchGUI
{
public:
AFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y, int w);
static FloatAuto* get_keyframe(MWindow *mwindow, APatchGUI *patch);
- int handle_event();
+ virtual int handle_event();
float update_edl();
MWindow *mwindow;
APatchGUI *patch;
};
+class AKeyFadePatch : public BC_SubWindow
+{
+public:
+ AKeyFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y);
+ void create_objects();
+
+ MWindow *mwindow;
+ APatchGUI *patch;
+ AKeyFadeValue *akey_fade_value;
+};
+
+class AKeyFadeValue : public AFadePatch
+{
+public:
+ AKeyFadeValue(AKeyFadePatch *akey_fade_patch);
+ int button_release_event();
+ int handle_event();
+
+ AKeyFadePatch *akey_fade_patch;
+};
+
+
class APanPatch : public BC_Pan
{
public:
APanPatch(MWindow *mwindow, APatchGUI *patch, int x, int y);
static PanAuto* get_keyframe(MWindow *mwindow, APatchGUI *patch);
- int handle_event();
+ virtual int handle_event();
MWindow *mwindow;
APatchGUI *patch;
};
+class AKeyPanPatch : public APanPatch
+{
+public:
+ AKeyPanPatch(MWindow *mwindow, APatchGUI *patch);
+ int button_release_event();
+ int handle_event();
+};
+
class AMeterPatch : public BC_Meter
{
public:
APatchGUI *patch;
};
-
#endif
#define MAX_AUDIO_FADE 6
+class APatchGUI;
+class AFadePatch;
+class AKeyFadePatch;
+class AKeyFadeValue;
+class APanPatch;
+class AKeyPanPatch;
+class AMeterPatch;
#endif
Auto* Autos::get_auto_for_editing(double position)
{
- if(position < 0)
- {
+ if(position < 0) {
position = edl->local_session->get_selectionstart(1);
}
Auto *result = 0;
position = edl->align_to_frame(position, 0);
-
-
-
-
//printf("Autos::get_auto_for_editing %p %p\n", first, default_auto);
- if(edl->session->auto_keyframes)
- {
- result = insert_auto(track->to_units(position, 0));
- }
- else
- result = get_prev_auto(track->to_units(position, 0),
- PLAY_FORWARD,
- result);
+ result = edl->session->auto_keyframes ?
+ insert_auto(track->to_units(position, 0)) :
+ get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result);
//printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result);
return result;
// 0 if after all autos
Auto* nearest_before(int64_t position); // return nearest auto before or 0
Auto* nearest_after(int64_t position); // return nearest auto after or 0
-
- Auto *selected;
- int skip_selected; // if selected was added
- int64_t selected_position, selected_position_; // original position for moves
- double selected_value, selected_value_; // original position for moves
- float virtual_h; // height cursor moves to cover entire range when track height is less than this
- int virtual_center;
- int stack_number;
- int stack_total;
};
-
-
-
-
-
#endif
SET_TRACE
// Mandatory folders
- folders.append(picon = new AssetPicon(mwindow, this, AEFFECT_FOLDER));
+ folders.append(picon = new AssetPicon(mwindow, this, _(AEFFECT_FOLDER)));
picon->persistent = 1;
- folders.append(picon = new AssetPicon(mwindow, this, VEFFECT_FOLDER));
+ folders.append(picon = new AssetPicon(mwindow, this, _(VEFFECT_FOLDER)));
picon->persistent = 1;
- folders.append(picon = new AssetPicon(mwindow, this, ATRANSITION_FOLDER));
+ folders.append(picon = new AssetPicon(mwindow, this, _(ATRANSITION_FOLDER)));
picon->persistent = 1;
- folders.append(picon = new AssetPicon(mwindow, this, VTRANSITION_FOLDER));
+ folders.append(picon = new AssetPicon(mwindow, this, _(VTRANSITION_FOLDER)));
picon->persistent = 1;
- folders.append(picon = new AssetPicon(mwindow, this, LABEL_FOLDER));
+ folders.append(picon = new AssetPicon(mwindow, this, _(LABEL_FOLDER)));
picon->persistent = 1;
- folders.append(picon = new AssetPicon(mwindow, this, CLIP_FOLDER));
+ folders.append(picon = new AssetPicon(mwindow, this, _(CLIP_FOLDER)));
picon->persistent = 1;
- folders.append(picon = new AssetPicon(mwindow, this, MEDIA_FOLDER));
+ folders.append(picon = new AssetPicon(mwindow, this, _(MEDIA_FOLDER)));
picon->persistent = 1;
create_label_folder();
}
//printf("Canvas::get_scrollbars 1 %d %d\n", get_xscroll(), get_yscroll());
- if(use_scrollbars)
- {
+ if( use_scrollbars ) {
w_needed = edl->session->output_w;
h_needed = edl->session->output_h;
get_zooms(edl, 0, zoom_x, zoom_y, conformed_w, conformed_h);
//printf("Canvas::get_scrollbars 2 %d %d\n", get_xscroll(), get_yscroll());
-// while(!done)
-// {
- w_visible = (int)(canvas_w / zoom_x);
- h_visible = (int)(canvas_h / zoom_y);
-// done = 1;
-
-// if(w_needed > w_visible)
- if(1)
- {
- if(!need_xscroll)
- {
- need_xscroll = 1;
- canvas_h -= BC_ScrollBar::get_span(SCROLL_HORIZ);
-// done = 0;
- }
- }
- else
- need_xscroll = 0;
+ w_visible = (int)(canvas_w / zoom_x);
+ h_visible = (int)(canvas_h / zoom_y);
+ if( w_needed > w_visible ) {
+ need_xscroll = 1;
+ canvas_h -= BC_ScrollBar::get_span(SCROLL_HORIZ);
+ }
-// if(h_needed > h_visible)
- if(1)
- {
- if(!need_yscroll)
- {
- need_yscroll = 1;
- canvas_w -= BC_ScrollBar::get_span(SCROLL_VERT);
-// done = 0;
- }
- }
- else
- need_yscroll = 0;
-// }
+ if( h_needed > h_visible ) {
+ need_yscroll = 1;
+ canvas_w -= BC_ScrollBar::get_span(SCROLL_VERT);
+ }
//printf("Canvas::get_scrollbars %d %d %d %d %d %d\n", canvas_w, canvas_h, w_needed, h_needed, w_visible, h_visible);
//printf("Canvas::get_scrollbars 3 %d %d\n", get_xscroll(), get_yscroll());
h_visible = (int)(canvas_h / zoom_y);
}
- if(need_xscroll)
- {
- if(!xscroll)
- {
- subwindow->add_subwindow(xscroll =
- new CanvasXScroll(edl, this, canvas_x, canvas_y + canvas_h,
- w_needed, get_xscroll(), w_visible, canvas_w));
+ if( need_xscroll ) {
+ if( !xscroll ) {
+ xscroll = new CanvasXScroll(edl, this, canvas_x, canvas_y + canvas_h,
+ w_needed, get_xscroll(), w_visible, canvas_w);
+ subwindow->add_subwindow(xscroll);
xscroll->show_window(0);
}
else
xscroll->reposition_window(canvas_x, canvas_y + canvas_h, canvas_w);
- if(xscroll->get_length() != w_needed ||
- xscroll->get_handlelength() != w_visible)
+ if( xscroll->get_length() != w_needed ||
+ xscroll->get_handlelength() != w_visible )
xscroll->update_length(w_needed, get_xscroll(), w_visible, 0);
}
- else
- {
- if( xscroll ) { delete xscroll; xscroll = 0; }
+ else if( xscroll ) {
+ delete xscroll; xscroll = 0;
}
//printf("Canvas::get_scrollbars 4 %d %d\n", get_xscroll(), get_yscroll());
- if(need_yscroll)
- {
- if(!yscroll)
- {
- subwindow->add_subwindow(yscroll =
- new CanvasYScroll(edl, this, canvas_x + canvas_w, canvas_y,
- h_needed, get_yscroll(), h_visible, canvas_h));
+ if( need_yscroll ) {
+ if( !yscroll ) {
+ yscroll = new CanvasYScroll(edl, this, canvas_x + canvas_w, canvas_y,
+ h_needed, get_yscroll(), h_visible, canvas_h);
+ subwindow->add_subwindow(yscroll);
yscroll->show_window(0);
}
else
yscroll->reposition_window(canvas_x + canvas_w, canvas_y, canvas_h);
- if(yscroll->get_length() != edl->session->output_h ||
- yscroll->get_handlelength() != h_visible)
+ if( yscroll->get_length() != edl->session->output_h ||
+ yscroll->get_handlelength() != h_visible )
yscroll->update_length(h_needed, get_yscroll(), h_visible, 0);
}
- else
- {
- if( yscroll ) { delete yscroll; yscroll = 0; }
+ else if( yscroll ) {
+ delete yscroll; yscroll = 0;
}
//printf("Canvas::get_scrollbars 5 %d %d\n", get_xscroll(), get_yscroll());
}
// Convert position to frames if cursor alignment is enabled
double EDL::align_to_frame(double position, int round)
{
-//printf("EDL::align_to_frame 1 %f\n", position);
- if(session->cursor_on_frames)
- {
-// Seconds -> Frames
- double temp = (double)position * session->frame_rate;
-//printf("EDL::align_to_frame 2 %f\n", temp);
-
-// Assert some things
- if(session->sample_rate == 0)
- printf("EDL::align_to_frame: sample_rate == 0\n");
-
- if(session->frame_rate == 0)
- printf("EDL::align_to_frame: frame_rate == 0\n");
-
-// Round frames
-// Always round down negative numbers
-// but round up only if requested
- if(round)
- {
- temp = Units::round(temp);
- }
- else
- {
-// if(temp < 0)
-// {
-// temp -= 0.5;
-// }
-// else
- temp = Units::to_int64(temp);
- }
-//printf("EDL::align_to_frame 3 %f\n", temp);
-
-// Frames -> Seconds
- temp /= session->frame_rate;
-
-//printf("EDL::align_to_frame 5 %f\n", temp);
-
- return temp;
+ if( session->cursor_on_frames && session->frame_rate > 0 ) {
+ double frame_no = position * session->frame_rate;
+ int64_t frame_pos = frame_no + (round ? 0.5 : 1e-6);
+ double pos = frame_pos / session->frame_rate;
+ if( !EQUIV(pos, position) ) position = pos;
}
-//printf("EDL::align_to_frame 3 %d\n", position);
-
-
return position;
}
// Mandatory folders
-#define AEFFECT_FOLDER "Audio Effects"
-#define VEFFECT_FOLDER "Video Effects"
-#define ATRANSITION_FOLDER "Audio Transitions"
-#define VTRANSITION_FOLDER "Video Transitions"
+#define AEFFECT_FOLDER N_("Audio Effects")
+#define VEFFECT_FOLDER N_("Video Effects")
+#define ATRANSITION_FOLDER N_("Audio Transitions")
+#define VTRANSITION_FOLDER N_("Video Transitions")
-#define LABEL_FOLDER "Labels"
+#define LABEL_FOLDER N_("Labels")
// Default folders
-#define CLIP_FOLDER "Clips"
-#define MEDIA_FOLDER "Media"
+#define CLIP_FOLDER N_("Clips")
+#define MEDIA_FOLDER N_("Media")
#include "mainsession.h"
#include "mwindow.h"
#include "mwindowgui.h"
+#include "theme.h"
#include "trackcanvas.h"
GWindowGUI::GWindowGUI(MWindow *mwindow, int w, int h)
: BC_Window(_(PROGRAM_NAME ": Overlays"),
- mwindow->session->gwindow_x, mwindow->session->gwindow_y,
+ mwindow->session->gwindow_x, mwindow->session->gwindow_y,
w, h, w, h, 0, 0, 1)
{
this->mwindow = mwindow;
}
-static const char *other_text[NON_AUTOMATION_TOTAL] =
+const char *GWindowGUI::other_text[NON_AUTOMATION_TOTAL] =
{
"Assets",
"Titles",
"Plugin Autos"
};
-static const char *auto_text[AUTOMATION_TOTAL] =
+const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] =
{
"Mute",
"Camera X",
"Speed"
};
+int GWindowGUI::auto_colors[AUTOMATION_TOTAL] =
+{
+ PINK,
+ RED,
+ GREEN,
+ BLUE,
+ LTPINK,
+ LTGREEN,
+ LTBLUE,
+ LTPURPLE,
+ 0,
+ 0,
+ 0,
+ ORANGE,
+};
+
static toggleinfo toggle_order[] =
{
{0, NON_AUTOMATION_ASSETS},
{0, NON_AUTOMATION_TITLES},
{0, NON_AUTOMATION_TRANSITIONS},
+ {0, NON_AUTOMATION_PLUGIN_AUTOS},
+ {0, -1}, // bar
{1, AUTOMATION_FADE},
{1, AUTOMATION_MUTE},
- {1, AUTOMATION_MODE},
- {1, AUTOMATION_PAN},
- {0, NON_AUTOMATION_PLUGIN_AUTOS},
- {1, AUTOMATION_MASK},
{1, AUTOMATION_SPEED},
{1, AUTOMATION_CAMERA_X},
{1, AUTOMATION_CAMERA_Y},
{1, AUTOMATION_PROJECTOR_X},
{1, AUTOMATION_PROJECTOR_Y},
{1, AUTOMATION_PROJECTOR_Z},
+ {1, AUTOMATION_MODE},
+ {1, AUTOMATION_PAN},
+ {1, AUTOMATION_MASK},
};
void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h)
*w = 10;
*h = 10;
- for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++)
- {
+ for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) {
+ toggleinfo *tp = &toggle_order[i];
+ int isauto = tp->isauto, ref = tp->ref;
+ if( ref < 0 ) {
+ *h += get_resources()->bar_data->get_h() + 5;
+ continue;
+ }
BC_Toggle::calculate_extents(gui,
BC_WindowBase::get_resources()->checkbox_images,
0, &temp1, ¤t_w, ¤t_h,
&temp2, &temp3, &temp4, &temp5, &temp6, &temp7,
- _(toggle_order[i].isauto ?
- auto_text[toggle_order[i].ref] :
- other_text[toggle_order[i].ref]), MEDIUMFONT);
+ _(isauto ? auto_text[ref] : other_text[ref]),
+ MEDIUMFONT);
*w = MAX(current_w, *w);
*h += current_h + 5;
}
int x = 10, y = 10;
lock_window("GWindowGUI::create_objects 1");
-
- for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++)
- {
- add_tool(toggles[i] = new GWindowToggle(mwindow,
- this,
- x,
- y,
- toggle_order[i]));
+ for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) {
+ toggleinfo *tp = &toggle_order[i];
+ int ref = tp->ref;
+ if( ref < 0 ) {
+ BC_Bar *bar = new BC_Bar(x,y,get_w()-x-10);
+ add_tool(bar);
+ toggles[i] = 0;
+ y += bar->get_h() + 5;
+ continue;
+ }
+ toggles[i] = new GWindowToggle(mwindow, this, x, y, *tp);
+ add_tool(toggles[i]);
+ VFrame *vframe = 0;
+ switch( ref ) {
+ case AUTOMATION_MODE: vframe = mwindow->theme->modekeyframe_data; break;
+ case AUTOMATION_PAN: vframe = mwindow->theme->pankeyframe_data; break;
+ case AUTOMATION_MASK: vframe = mwindow->theme->maskkeyframe_data; break;
+ }
+ if( vframe )
+ draw_vframe(vframe, get_w()-vframe->get_w()-10, y);
y += toggles[i]->get_h() + 5;
}
unlock_window();
{
if(use_lock) lock_window("GWindowGUI::update_toggles");
- for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++)
- {
- toggles[i]->update();
+ for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) {
+ if( toggles[i] ) toggles[i]->update();
}
if(use_lock) unlock_window();
int GWindowGUI::keypress_event()
{
- switch(get_keypress())
- {
- case 'w':
- case 'W':
- if(ctrl_down())
- {
- close_event();
- return 1;
- }
- break;
+ switch(get_keypress()) {
+ case 'w':
+ case 'W':
+ case '0':
+ if( ctrl_down() ) {
+ close_event();
+ return 1;
+ }
+ break;
}
return 0;
}
-
-
-
-
GWindowToggle::GWindowToggle(MWindow *mwindow,
GWindowGUI *gui, int x, int y, toggleinfo toggleinf)
: BC_CheckBox(x, y, *get_main_value(mwindow, toggleinf),
- _((toggleinf.isauto ? auto_text[toggleinf.ref] : other_text[toggleinf.ref])))
+ _((toggleinf.isauto ?
+ GWindowGUI::auto_text[toggleinf.ref] :
+ GWindowGUI::other_text[toggleinf.ref])),
+ MEDIUMFONT,
+ !toggleinf.isauto ? -1 : GWindowGUI::auto_colors[toggleinf.ref])
{
this->mwindow = mwindow;
this->gui = gui;
int* GWindowToggle::get_main_value(MWindow *mwindow, toggleinfo toggleinf)
{
- if(toggleinf.isauto)
- {
+ if( toggleinf.isauto )
return &mwindow->edl->session->auto_conf->autos[toggleinf.ref];
- }
- else
- {
- switch(toggleinf.ref)
- {
- case NON_AUTOMATION_ASSETS:
- return &mwindow->edl->session->show_assets;
- case NON_AUTOMATION_TITLES:
- return &mwindow->edl->session->show_titles;
- case NON_AUTOMATION_TRANSITIONS:
- return &mwindow->edl->session->auto_conf->transitions;
- case NON_AUTOMATION_PLUGIN_AUTOS:
- return &mwindow->edl->session->auto_conf->plugins;
- }
+
+ switch(toggleinf.ref) {
+ case NON_AUTOMATION_ASSETS: return &mwindow->edl->session->show_assets;
+ case NON_AUTOMATION_TITLES: return &mwindow->edl->session->show_titles;
+ case NON_AUTOMATION_TRANSITIONS: return &mwindow->edl->session->auto_conf->transitions;
+ case NON_AUTOMATION_PLUGIN_AUTOS: return &mwindow->edl->session->auto_conf->plugins;
}
return 0;
}
void GWindowToggle::update()
{
- set_value(*get_main_value(mwindow, toggleinf));
+ int *vp = get_main_value(mwindow, toggleinf);
+ if( !vp ) return;
+ set_value(*vp);
}
NONAUTOTOGGLES_TITLES,
NONAUTOTOGGLES_TRANSITIONS,
NONAUTOTOGGLES_PLUGIN_AUTOS,
+ NONAUTOTOGGLES_BAR,
NONAUTOTOGGLES_COUNT
};
void update_toggles(int use_lock);
void update_mwindow();
+ static const char *other_text[];
+ static const char *auto_text[];
+ static int auto_colors[];
+
MWindow *mwindow;
GWindowToggle *toggles[NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL];
};
*/
#include "apatchgui.h"
+#include "atrack.h"
#include "autoconf.h"
#include "autos.h"
#include "bcwindowbase.h"
#include "edl.h"
#include "edlsession.h"
#include "filexml.h"
+#include "floatauto.h"
#include "gwindow.h"
#include "gwindowgui.h"
+#include "intauto.h"
#include "keyframe.h"
#include "keyframepopup.h"
#include "language.h"
#include "mwindow.h"
#include "patchbay.h"
#include "patchgui.h"
+#include "timelinepane.h"
#include "track.h"
-#include "vpatchgui.h"
+#include "vtrack.h"
KeyframePopup::KeyframePopup(MWindow *mwindow, MWindowGUI *gui)
: BC_PopupMenu(0, 0, 0, "", 0)
void KeyframePopup::create_objects()
{
- add_item(key_hide = new KeyframePopupHide(mwindow, this));
add_item(key_show = new KeyframePopupShow(mwindow, this));
+ add_item(key_hide = new KeyframePopupHide(mwindow, this));
add_item(key_delete = new KeyframePopupDelete(mwindow, this));
add_item(key_copy = new KeyframePopupCopy(mwindow, this));
int KeyframePopup::update(Plugin *plugin, KeyFrame *keyframe)
{
+ key_show->set_text(_("Show Plugin Settings"));
this->keyframe_plugin = plugin;
this->keyframe_auto = keyframe;
this->keyframe_autos = 0;
int KeyframePopup::update(Automation *automation, Autos *autos, Auto *auto_keyframe)
{
+ key_show->set_text(_(GWindowGUI::auto_text[autos->autoidx]));
this->keyframe_plugin = 0;
this->keyframe_automation = automation;
this->keyframe_autos = autos;
mwindow->save_backup();
mwindow->gui->update(0, 1, // 1 for incremental drawing. 2 for full refresh
- 0, 0, 0, 0, 0);
+ 0, 0, 0, 0, 0);
mwindow->update_plugin_guis();
mwindow->restart_brender();
mwindow->sync_parameters(CHANGE_EDL);
{
}
+PatchGUI *KeyframePopupShow::get_patchgui(Track *track)
+{
+ PatchGUI *patchgui = 0;
+ TimelinePane **panes = mwindow->gui->pane;
+ for( int i=0; i<TOTAL_PANES && !patchgui; ++i ) {
+ if( !panes[i] ) continue;
+ PatchBay *patchbay = panes[i]->patchbay;
+ if( !patchbay ) continue;
+ for( int j=0; j<patchbay->patches.total && !patchgui; ++j ) {
+ if( patchbay->patches.values[j]->track == track )
+ patchgui = patchbay->patches.values[j];
+ }
+ }
+ return patchgui;
+}
+
int KeyframePopupShow::handle_event()
{
- if (popup->keyframe_plugin)
- {
+ MWindowGUI *mgui = mwindow->gui;
+ CWindowGUI *cgui = mwindow->cwindow->gui;
+ int cx = mgui->get_relative_cursor_x()+15, cy = mgui->get_relative_cursor_y()-15;
+ delete mgui->keyvalue_popup;
+ mgui->keyvalue_popup = 0;
+
+ if( popup->keyframe_plugin ) {
mwindow->update_plugin_guis();
mwindow->show_plugin(popup->keyframe_plugin);
}
else if( popup->keyframe_automation ) {
-/*
-
- mwindow->cwindow->gui->lock_window();
+ cgui->lock_window();
int show_window = 1;
- if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->projector_autos ||
- popup->keyframe_autos == (Autos *)popup->keyframe_automation->pzoom_autos)
-
- {
- mwindow->cwindow->gui->set_operation(CWINDOW_PROJECTOR);
- } else
- if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->camera_autos ||
- popup->keyframe_autos == (Autos *)popup->keyframe_automation->czoom_autos)
-
- {
- mwindow->cwindow->gui->set_operation(CWINDOW_CAMERA);
- } else
- if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mode_autos)
-
- {
- // no window to be shown
- show_window = 0;
- // first find the appropriate patchgui
- PatchBay *patchbay = mwindow->gui->patchbay;
- PatchGUI *patchgui = 0;
- for (int i = 0; i < patchbay->patches.total; i++)
- if (patchbay->patches.values[i]->track == popup->keyframe_automation->track)
- patchgui = patchbay->patches.values[i];
- if (patchgui != 0)
- {
-// FIXME: repositioning of the listbox needs support in guicast
-// int cursor_x = popup->get_relative_cursor_x();
-// int cursor_y = popup->get_relative_cursor_y();
-// vpatchgui->mode->reposition_window(cursor_x, cursor_y);
-
-
-// Open the popup menu
- VPatchGUI *vpatchgui = (VPatchGUI *)patchgui;
- vpatchgui->mode->activate_menu();
- }
- } else
- if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mask_autos)
-
- {
- mwindow->cwindow->gui->set_operation(CWINDOW_MASK);
- } else
- if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->pan_autos)
-
- {
- // no window to be shown
+
+ switch( popup->keyframe_autos->autoidx ) {
+ case AUTOMATION_CAMERA_X:
+ case AUTOMATION_CAMERA_Y:
+ case AUTOMATION_CAMERA_Z: {
+ cgui->set_operation(CWINDOW_CAMERA);
+ break; }
+
+ case AUTOMATION_PROJECTOR_X:
+ case AUTOMATION_PROJECTOR_Y:
+ case AUTOMATION_PROJECTOR_Z: {
+ cgui->set_operation(CWINDOW_PROJECTOR);
+ break; }
+
+ case AUTOMATION_MASK: {
+ cgui->set_operation(CWINDOW_MASK);
+ break; }
+
+ default: {
show_window = 0;
- // first find the appropriate patchgui
- PatchBay *patchbay = mwindow->gui->patchbay;
- PatchGUI *patchgui = 0;
- for (int i = 0; i < patchbay->patches.total; i++)
- if (patchbay->patches.values[i]->track == popup->keyframe_automation->track)
- patchgui = patchbay->patches.values[i];
- if (patchgui != 0)
- {
-// Open the popup menu at current mouse position
- APatchGUI *apatchgui = (APatchGUI *)patchgui;
- int cursor_x = popup->get_relative_cursor_x();
- int cursor_y = popup->get_relative_cursor_y();
- apatchgui->pan->activate(cursor_x, cursor_y);
+ PatchGUI *patchgui = get_patchgui(popup->keyframe_automation->track);
+ if( !patchgui ) break;
+
+ switch( popup->keyframe_autos->autoidx ) {
+ case AUTOMATION_MODE: {
+ VKeyModePatch *mode = new VKeyModePatch(mwindow, (VPatchGUI *)patchgui);
+ mgui->add_subwindow(mode);
+ mode->create_objects();
+ mode->activate_menu();
+ mgui->keyvalue_popup = mode;
+ break; }
+
+ case AUTOMATION_PAN: {
+ AKeyPanPatch *pan = new AKeyPanPatch(mwindow, (APatchGUI *)patchgui);
+ mgui->add_subwindow(pan);
+ pan->create_objects();
+ pan->activate(cx, cy);
+ mgui->keyvalue_popup = pan;
+ break; }
+
+ case AUTOMATION_FADE: {
+ switch( patchgui->data_type ) {
+ case TRACK_AUDIO: {
+ AKeyFadePatch *fade = new AKeyFadePatch(mwindow, (APatchGUI *)patchgui, cx, cy);
+ mgui->add_subwindow(fade);
+ fade->create_objects();
+ mgui->keyvalue_popup = fade;
+ break; }
+ case TRACK_VIDEO: {
+ VKeyFadePatch *fade = new VKeyFadePatch(mwindow, (VPatchGUI *)patchgui, cx, cy);
+ mgui->add_subwindow(fade);
+ fade->create_objects();
+ mgui->keyvalue_popup = fade;
+ break; }
+ }
+ break; }
+
+ case AUTOMATION_SPEED: {
+ KeySpeedPatch *speed = new KeySpeedPatch(mwindow, patchgui, cx, cy);
+ mgui->add_subwindow(speed);
+ speed->create_objects();
+ mgui->keyvalue_popup = speed;
+ break; }
+
+ case AUTOMATION_MUTE: {
+ KeyMutePatch *mute = new KeyMutePatch(mwindow, (APatchGUI *)patchgui, cx, cy);
+ mgui->add_subwindow(mute);
+ mute->create_objects();
+ mgui->keyvalue_popup = mute;
+ break; }
}
-
-
- } else
- if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->fade_autos)
-
- {
- // no window to be shown, so do nothing
- // IDEA: open window for fading
- show_window = 0;
- } else
- if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mute_autos)
-
- {
- // no window to be shown, so do nothing
- // IDEA: directly switch
- show_window = 0;
- } else;
-
+ break; }
+ }
// ensure bringing to front
- if (show_window)
- {
- ((CPanelToolWindow *)(mwindow->cwindow->gui->composite_panel->operation[CWINDOW_TOOL_WINDOW]))->set_shown(0);
- ((CPanelToolWindow *)(mwindow->cwindow->gui->composite_panel->operation[CWINDOW_TOOL_WINDOW]))->set_shown(1);
+ if( show_window ) {
+ mwindow->show_cwindow();
+ CPanelToolWindow *panel_tool_window =
+ (CPanelToolWindow *)cgui->composite_panel->operation[CWINDOW_TOOL_WINDOW];
+ panel_tool_window->set_shown(0);
+ panel_tool_window->set_shown(1);
}
- mwindow->cwindow->gui->unlock_window();
-
-
-*/
+ cgui->unlock_window();
}
return 1;
}
we want to copy just keyframe under cursor, NOT all keyframes at this frame
- very hard to do, so this is good approximation for now...
*/
-
+
#if 0
if (popup->keyframe_automation)
{
else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->camera_autos)
autoconf.camera = 1;
else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->czoom_autos)
- autoconf.czoom = 1;
+ autoconf.czoom = 1;
else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mode_autos)
autoconf.mode = 1;
else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mask_autos)
autoconf.mask = 1;
else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->pan_autos)
- autoconf.pan = 1;
+ autoconf.pan = 1;
else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->fade_autos)
autoconf.fade = 1;
else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mute_autos)
- autoconf.mute = 1;
+ autoconf.mute = 1;
// now create a clipboard
file.append_newline();
file.append_newline();
-/* track->copy_automation(position,
- position,
+/* track->copy_automation(position,
+ position,
&file,
0,
0);
file.append_tag();
file.append_newline();
- track->automation->copy(position,
- position,
+ track->automation->copy(position,
+ position,
&file,
0,
0,
&autoconf);
-
-
-
file.tag.set_title("/TRACK");
file.append_tag();
file.append_newline();
file.append_newline();
file.append_newline();
-
-
file.tag.set_title("/AUTO_CLIPBOARD");
file.append_tag();
file.append_newline();
void KeyframeHidePopup::create_objects()
{
- add_item(new KeyframeHideItem(mwindow, this));
+ add_item(new KeyframeHideItem(mwindow, this));
}
int KeyframeHidePopup::update(Autos *autos)
return 1;
}
+
+
+KeyMutePatch::KeyMutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
+ : BC_SubWindow(x, y, 100, 20, GWindowGUI::auto_colors[AUTOMATION_MUTE])
+{
+ this->mwindow = mwindow;
+ this->patch = patch;
+}
+
+void KeyMutePatch::create_objects()
+{
+ key_mute_checkbox = new KeyMuteValue(this);
+ add_subwindow(key_mute_checkbox);
+ key_mute_checkbox->activate();
+ show_window();
+}
+
+KeyMuteValue::KeyMuteValue(KeyMutePatch *key_mute_patch)
+ : BC_CheckBox(0,0, key_mute_patch->mwindow->
+ get_int_auto(key_mute_patch->patch, AUTOMATION_MUTE)->value,
+ _("Mute"), MEDIUMFONT, RED)
+{
+ this->key_mute_patch = key_mute_patch;
+}
+
+int KeyMuteValue::button_release_event()
+{
+ BC_CheckBox::button_release_event();
+ return 0;
+}
+
+void KeyMuteValue::update_edl()
+{
+ MWindow *mwindow = key_mute_patch->mwindow;
+ PatchGUI *patch = key_mute_patch->patch;
+ double position = mwindow->edl->local_session->get_selectionstart(1);
+ Autos *mute_autos = patch->track->automation->autos[AUTOMATION_MUTE];
+ int need_undo = !mute_autos->auto_exists_for_editing(position);
+ mwindow->undo->update_undo_before(_("mute"), need_undo ? 0 : this);
+ IntAuto *current = (IntAuto*)mute_autos->get_auto_for_editing(position);
+ current->value = this->get_value();
+ mwindow->undo->update_undo_after(_("mute"), LOAD_AUTOMATION);
+}
+
+int KeyMuteValue::handle_event()
+{
+ MWindow *mwindow = key_mute_patch->mwindow;
+ PatchGUI *patch = key_mute_patch->patch;
+ patch->change_source = 1;
+ update_edl();
+ patch->change_source = 0;
+ mwindow->sync_parameters(CHANGE_PARAMS);
+ if(mwindow->edl->session->auto_conf->autos[AUTOMATION_MUTE]) {
+ mwindow->gui->update_patchbay();
+ mwindow->gui->draw_overlays(1);
+ }
+ return 1;
+}
+
+KeySpeedPatch::KeySpeedPatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
+ : BC_SubWindow(x,y, 200,20, GWindowGUI::auto_colors[AUTOMATION_SPEED])
+{
+ this->mwindow = mwindow;
+ this->patch = patch;
+}
+
+void KeySpeedPatch::create_objects()
+{
+ key_speed_slider = new KeySpeedValue(this);
+ add_subwindow(key_speed_slider);
+ key_speed_slider->activate();
+ show_window();
+}
+
+KeySpeedValue::KeySpeedValue(KeySpeedPatch *key_speed_patch)
+ : BC_FSlider(0,0, 0, key_speed_patch->get_w(), key_speed_patch->get_w(),
+ key_speed_patch->mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_SPEED],
+ key_speed_patch->mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_SPEED],
+ key_speed_patch->mwindow->get_float_auto(key_speed_patch->patch, AUTOMATION_SPEED)->get_value())
+{
+ this->key_speed_patch = key_speed_patch;
+ set_precision(0.01);
+}
+
+KeySpeedValue::~KeySpeedValue()
+{
+}
+
+int KeySpeedValue::button_release_event()
+{
+ BC_FSlider::button_release_event();
+ return 0;
+}
+
+void KeySpeedValue::update_edl()
+{
+ MWindow *mwindow = key_speed_patch->mwindow;
+ PatchGUI *patch = key_speed_patch->patch;
+ double position = mwindow->edl->local_session->get_selectionstart(1);
+ Autos *speed_autos = patch->track->automation->autos[AUTOMATION_SPEED];
+ int need_undo = !speed_autos->auto_exists_for_editing(position);
+ mwindow->undo->update_undo_before(_("speed"), need_undo ? 0 : this);
+ FloatAuto *current = (FloatAuto*)speed_autos->get_auto_for_editing(position);
+ current->set_value(get_value());
+ mwindow->undo->update_undo_after(_("speed"), LOAD_AUTOMATION);
+}
+
+int KeySpeedValue::handle_event()
+{
+ MWindow *mwindow = key_speed_patch->mwindow;
+ PatchGUI *patch = key_speed_patch->patch;
+ if( shift_down() ) {
+ update(1.0);
+ set_tooltip(get_caption());
+ }
+
+ patch->change_source = 1;
+ update_edl();
+ patch->change_source = 0;
+ mwindow->sync_parameters(CHANGE_PARAMS);
+ if(mwindow->edl->session->auto_conf->autos[AUTOMATION_SPEED]) {
+ mwindow->gui->draw_overlays(1);
+ }
+ return 1;
+}
+
#ifndef KEYFRAMEPOPUP_H
#define KEYFRAMEPOPUP_H
+#include "apatchgui.h"
#include "guicast.h"
#include "mwindow.inc"
#include "mwindowgui.inc"
+#include "patchgui.inc"
#include "plugin.inc"
#include "plugindialog.inc"
#include "keyframe.inc"
public:
KeyframePopupShow(MWindow *mwindow, KeyframePopup *popup);
~KeyframePopupShow();
+ PatchGUI *get_patchgui(Track *track);
int handle_event();
MWindow *mwindow;
KeyframeHidePopup *popup;
};
+class KeyMutePatch : public BC_SubWindow
+{
+public:
+ KeyMutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y);
+ void create_objects();
+
+ MWindow *mwindow;
+ PatchGUI *patch;
+ KeyMuteValue *key_mute_checkbox;
+};
+
+class KeyMuteValue : public BC_CheckBox
+{
+public:
+ KeyMuteValue(KeyMutePatch *key_mute_patch);
+ void update_edl();
+ int button_release_event();
+ int handle_event();
+
+ KeyMutePatch *key_mute_patch;
+};
+
+class KeySpeedPatch : public BC_SubWindow
+{
+public:
+ KeySpeedPatch(MWindow *mwindow, PatchGUI *patch, int x, int y);
+ void create_objects();
+
+ MWindow *mwindow;
+ PatchGUI *patch;
+ KeySpeedValue *key_speed_slider;
+};
+
+class KeySpeedValue : public BC_FSlider
+{
+public:
+ KeySpeedValue(KeySpeedPatch *key_speed_patch);
+ ~KeySpeedValue();
+
+ void update_edl();
+ int handle_event();
+ int button_release_event();
+
+ KeySpeedPatch *key_speed_patch;
+};
+
#endif
class KeyframePopup;
class KeyframePopupDelete;
+class KeyframePopupHide;
class KeyframePopupShow;
class KeyframePopupCopy;
class KeyframePopupCurveMode;
class KeyframePopupEdit;
-class KeyframePopupHide;
class KeyframeHidePopup;
-
+class KeyframeHideItem;
+class KeyMutePatch;
+class KeyMuteValue;
+class KeySpeedPatch;
+class KeySpeedValue;
+
#endif
automation_mins[AUTOGROUPTYPE_VIDEO_FADE] = 0;
automation_maxs[AUTOGROUPTYPE_VIDEO_FADE] = 100;
- automation_mins[AUTOGROUPTYPE_ZOOM] = 0.001;
- automation_maxs[AUTOGROUPTYPE_ZOOM] = 4;
+ automation_mins[AUTOGROUPTYPE_ZOOM] = 0.005;
+ automation_maxs[AUTOGROUPTYPE_ZOOM] = 5.000;
- automation_mins[AUTOGROUPTYPE_SPEED] = 0.05;
- automation_maxs[AUTOGROUPTYPE_SPEED] = 3;
+ automation_mins[AUTOGROUPTYPE_SPEED] = 0.005;
+ automation_maxs[AUTOGROUPTYPE_SPEED] = 5.000;
automation_mins[AUTOGROUPTYPE_X] = -100;
automation_maxs[AUTOGROUPTYPE_X] = 100;
ShowGWindow::ShowGWindow(MWindow *mwindow)
- : BC_MenuItem(_("Show Overlays"))
+ : BC_MenuItem(_("Show Overlays"), _("Ctrl-0"), '0')
{
this->mwindow = mwindow;
+ set_ctrl(1);
set_checked(mwindow->session->show_gwindow);
}
int ShowGWindow::handle_event()
{
- mwindow->show_gwindow();
+ if( !mwindow->session->show_gwindow )
+ mwindow->show_gwindow();
+ else
+ mwindow->hide_gwindow();
+ set_checked(mwindow->session->show_gwindow);
return 1;
}
#include "asset.h"
#include "assets.h"
+#include "atrack.h"
#include "audioalsa.h"
#include "autos.h"
#include "awindowgui.h"
#include "file.h"
#include "filesystem.h"
#include "filexml.h"
+#include "floatautos.h"
#include "framecache.h"
#include "gwindow.h"
#include "gwindowgui.h"
#include "keyframegui.h"
#include "indexfile.h"
+#include "intautos.h"
#include "interlacemodes.h"
#include "language.h"
#include "levelwindowgui.h"
#include "mwindow.h"
#include "nestededls.h"
#include "new.h"
+#include "panautos.h"
#include "patchbay.h"
#include "playback3d.h"
#include "playbackengine.h"
#include "transition.h"
#include "transportque.h"
#include "vframe.h"
+#include "vtrack.h"
#include "versioninfo.h"
#include "videodevice.inc"
#include "videowindow.h"
strcpy(plugin_path, path); delete [] path;
printf("init ladspa index: %s\n", plugin_dir);
FILE *fp = fopen(index_path,"w");
- if( !fp ) {
+ if( !fp ) {
fprintf(stderr,_("MWindow::init_ladspa_index: "
"can't create plugin index: %s\n"), index_path);
return 1;
}
fprintf(fp, "%d\n", PLUGIN_FILE_VERSION);
fprintf(fp, "%s\n", plugin_dir);
- init_plugin_index(mwindow, preferences, fp, plugin_path);
+ init_plugin_index(mwindow, preferences, fp, plugin_path);
fclose(fp);
return 0;
}
void MWindow::stop_playback(int wait)
{
int locked = gui->get_window_lock();
- if( locked ) gui->unlock_window();
+ if( locked ) gui->unlock_window();
cwindow->playback_engine->que->send_command(STOP,
CHANGE_NONE,
vwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0);
vwindow->playback_engine->interrupt_playback(wait);
}
- if( locked ) gui->lock_window("MWindow::stop_playback");
+ if( locked ) gui->lock_window("MWindow::stop_playback");
}
int MWindow::load_filenames(ArrayList<char*> *filenames,
gui->mainmenu->show_gwindow->set_checked(1);
}
+void MWindow::hide_gwindow()
+{
+ session->show_gwindow = 0;
+
+ gwindow->gui->lock_window("MWindow::show_gwindow");
+ gwindow->gui->hide_window();
+ gwindow->gui->unlock_window();
+}
void MWindow::show_lwindow()
{
void MWindow::dump_exe(FILE *fp)
{
- char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN];
- sprintf(proc_path, "/proc/%d/exe", (int)getpid());
+ char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN];
+ sprintf(proc_path, "/proc/%d/exe", (int)getpid());
- int ret = -1, n = 100;
+ int ret = -1, n = 100;
for( int len; (len=readlink(proc_path, exe_path, sizeof(exe_path)))>0; --n ) {
exe_path[len] = 0; strcpy(proc_path, exe_path);
ret = 0;
EDLSession *session = edl->session;
double old_framerate = session->frame_rate;
double old_samplerate = session->sample_rate;
+ int old_auto_keyframes = session->auto_keyframes;
+ session->auto_keyframes = 0;
int result = file->open_file(preferences, asset, 1, 0);
if( !result && delete_tracks > 0 )
undo->update_undo_before();
edl->resample(old_samplerate, session->sample_rate, TRACK_AUDIO);
}
delete file;
+ session->auto_keyframes = old_auto_keyframes;
if( !result && delete_tracks > 0 ) {
save_backup();
undo->update_undo_after(_("select asset"), LOAD_ALL);
plugindb->get(i)->dump(fp);
}
+FloatAuto* MWindow::get_float_auto(PatchGUI *patch,int idx)
+{
+ Auto *current = 0;
+ double unit_position = edl->local_session->get_selectionstart(1);
+ unit_position = patch->track->to_units(unit_position, 0);
+
+ FloatAutos *ptr = (FloatAutos*)patch->track->automation->autos[idx];
+ return (FloatAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current);
+}
+
+IntAuto* MWindow::get_int_auto(PatchGUI *patch,int idx)
+{
+ Auto *current = 0;
+ double unit_position = edl->local_session->get_selectionstart(1);
+ unit_position = patch->track->to_units(unit_position, 0);
+
+ IntAutos *ptr = (IntAutos*)patch->track->automation->autos[idx];
+ return (IntAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current);
+}
+
+PanAuto* MWindow::get_pan_auto(PatchGUI *patch)
+{
+ Auto *current = 0;
+ double unit_position = edl->local_session->get_selectionstart(1);
+ unit_position = patch->track->to_units(unit_position, 0);
+
+ PanAutos *ptr = (PanAutos*)patch->track->automation->autos[AUTOMATION_PAN];
+ return (PanAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current);
+}
+
+
#include <stdio.h>
#include <stdint.h>
+#include "apatchgui.h"
#include "arraylist.h"
#include "asset.inc"
#include "assets.inc"
#include "transition.inc"
#include "transportque.inc"
#include "videowindow.inc"
+#include "vpatchgui.h"
#include "vwindow.inc"
#include "wwindow.inc"
#include "wavecache.inc"
void show_lwindow();
void show_cwindow();
void show_gwindow();
+ void hide_gwindow();
int tile_windows(int window_config);
char *get_cwindow_display();
// void set_titles(int value);
int paste_default_keyframe();
int clear_default_keyframe();
+ FloatAuto* get_float_auto(PatchGUI *patch,int idx);
+ IntAuto* get_int_auto(PatchGUI *patch,int idx);
+ PanAuto* get_pan_auto(PatchGUI *patch);
+
int modify_edithandles();
int modify_pluginhandles();
void finish_modify_handles();
plugin_menu = 0;
keyframe_menu = 0;
keyframe_hide = 0;
+ keyvalue_popup = 0;
transition_menu = 0;
remote_control = 0;
cwindow_remote_handler = 0;
delete cwindow_remote_handler;
delete record_remote_handler;
delete remote_control;
+ delete keyvalue_popup;
// delete samplescroll;
// delete trackscroll;
for(int i = 0; i < TOTAL_PANES; i++)
}
-
-
-
-
-
-
-
-
-
-
-
-
-
+int MWindowGUI::button_release_event()
+{
+ if( keyvalue_popup ) {
+ delete keyvalue_popup; keyvalue_popup = 0;
+ }
+ return 0;
+}
int MWindowGUI::repeat_event(int64_t duration)
return result;
}
-
int MWindowGUI::keyboard_listener(BC_WindowBase *wp)
{
return key_listener(wp->get_keypress());
int PaneButton::button_release_event()
{
mwindow->gui->stop_pane_drag();
-
int result = BC_Button::button_release_event();
return result;
}
int translation_event();
int resize_event(int w, int h); // handle a resize event
+ int button_release_event();
int keypress_event();
int keyboard_listener(BC_WindowBase *wp);
int key_listener(int key);
PluginPopup *plugin_menu;
KeyframePopup *keyframe_menu;
KeyframeHidePopup *keyframe_hide;
+ BC_SubWindow *keyvalue_popup;
TransitionPopup *transition_menu;
MainClock *mainclock;
BC_DragWindow *drag_popup;
-
// PatchBay *patchbay;
// MTimeBar *timebar;
// SampleScroll *samplescroll;
record->update(track->record);
gang->update(track->gang);
draw->update(track->draw);
- mute->update(mute->get_keyframe(mwindow, this)->value);
+ mute->update(mwindow->get_int_auto(this, AUTOMATION_MUTE)->value);
expand->update(track->expand_view);
}
}
MutePatch::MutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
: BC_Toggle(x, y,
mwindow->theme->get_image_set("mutepatch_data"),
- get_keyframe(mwindow, patch)->value,
+ mwindow->get_int_auto(patch, AUTOMATION_MUTE)->value,
"",
0,
0,
return result;
}
-IntAuto* MutePatch::get_keyframe(MWindow *mwindow, PatchGUI *patch)
-{
- Auto *current = 0;
- double unit_position = mwindow->edl->local_session->get_selectionstart(1);
- unit_position = mwindow->edl->align_to_frame(unit_position, 0);
- unit_position = patch->track->to_units(unit_position, 0);
- return (IntAuto*)patch->track->automation->autos[AUTOMATION_MUTE]->get_prev_auto(
- (int64_t)unit_position,
- PLAY_FORWARD,
- current);
-}
-
-
-
-
-
-
-
-
-
-
ExpandPatch::ExpandPatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
MutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y);
int button_press_event();
int button_release_event();
- static IntAuto* get_keyframe(MWindow *mwindow, PatchGUI *patch);
MWindow *mwindow;
PatchGUI *patch;
};
#include "edlsession.h"
#include "floatauto.h"
#include "floatautos.h"
+#include "gwindowgui.h"
#include "indexstate.h"
#include "intauto.h"
#include "intautos.h"
}
}
-static int auto_colors[AUTOMATION_TOTAL] =
-{
- BLUE,
- RED,
- GREEN,
- BLUE,
- RED,
- GREEN,
- BLUE,
- WHITE,
- 0,
- 0,
- 0,
- WHITE
-};
-
// The operations which correspond to each automation type
-static int auto_operations[AUTOMATION_TOTAL] =
+int TrackCanvas::auto_operations[AUTOMATION_TOTAL] =
{
DRAG_MUTE,
DRAG_CAMERA_X,
auto_keyframe, grouptype);
result = do_float_autos(track, autos,
- cursor_x, cursor_y, draw,
- buttonpress, 0, 0, auto_colors[i],
+ cursor_x, cursor_y, draw, buttonpress,
+ 0, 0, GWindowGUI::auto_colors[i],
auto_keyframe, grouptype);
break; }
buttonpress, 1, 1, MDGREY,
auto_keyframe);
result = do_int_autos(track, autos,
- cursor_x, cursor_y, draw,
- buttonpress, 0, 0, auto_colors[i],
+ cursor_x, cursor_y, draw, buttonpress,
+ 0, 0, GWindowGUI::auto_colors[i],
auto_keyframe);
break; }
}
ArrayList<PluginOn*> plugin_on_toggles;
ArrayList<PluginShow*> plugin_show_toggles;
-
-
+ static int auto_operations[];
// event handlers
void draw_paste_destination();
#include "edlsession.h"
#include "floatauto.h"
#include "floatautos.h"
+#include "gwindowgui.h"
#include "intauto.h"
#include "intautos.h"
#include "language.h"
}
else
{
- FloatAuto *previous = 0, *next = 0;
- double unit_position = mwindow->edl->local_session->get_selectionstart(1);
- unit_position = mwindow->edl->align_to_frame(unit_position, 0);
- unit_position = vtrack->to_units(unit_position, 0);
- int value = (int)((FloatAutos*)vtrack->automation->autos[AUTOMATION_FADE])->get_value(
- (int64_t)unit_position, PLAY_FORWARD, previous, next);
- fade->update(fade->get_w(), value,
+ fade->update(fade->get_w(), mwindow->get_float_auto(this, AUTOMATION_FADE)->get_value(),
mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE],
mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE]);
-// fade->update((int)fade->get_keyframe(mwindow, this)->value);
}
}
else
}
else
{
- mode->update(mode->get_keyframe(mwindow, this)->value);
+ mode->update(mwindow->get_int_auto(this, AUTOMATION_MODE)->value);
nudge->update();
}
}
VFadePatch::VFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y, int w)
- : BC_ISlider(x,
- y,
- 0,
- w,
- w,
- mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE],
- mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE],
- (int64_t)get_keyframe(mwindow, patch)->get_value())
+ : BC_ISlider(x, y, 0, w, w,
+ mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE],
+ mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE],
+ (int64_t)mwindow->get_float_auto(patch,AUTOMATION_FADE)->get_value())
{
this->mwindow = mwindow;
this->patch = patch;
return 1;
}
-FloatAuto* VFadePatch::get_keyframe(MWindow *mwindow, VPatchGUI *patch)
+
+VKeyFadePatch::VKeyFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y)
+ : BC_SubWindow(x,y, patch->patchbay->get_w(),20,
+ GWindowGUI::auto_colors[AUTOMATION_FADE])
+{
+ this->mwindow = mwindow;
+ this->patch = patch;
+}
+
+void VKeyFadePatch::create_objects()
+{
+ vkey_fade_value = new VKeyFadeValue(this);
+ add_subwindow(vkey_fade_value);
+ vkey_fade_value->activate();
+ show_window();
+}
+
+VKeyFadeValue::VKeyFadeValue(VKeyFadePatch *vkey_fade_patch)
+ : VFadePatch(vkey_fade_patch->mwindow, vkey_fade_patch->patch,
+ 0,0, vkey_fade_patch->get_w())
+{
+ this->vkey_fade_patch = vkey_fade_patch;
+}
+
+int VKeyFadeValue::button_release_event()
+{
+ VFadePatch::button_release_event();
+ return 0;
+}
+
+int VKeyFadeValue::handle_event()
{
- double unit_position = mwindow->edl->local_session->get_selectionstart(1);
- unit_position = mwindow->edl->align_to_frame(unit_position, 0);
- unit_position = patch->vtrack->to_units(unit_position, 0);
- Auto *current = 0;
-
- return (FloatAuto*)patch->vtrack->automation->autos[AUTOMATION_FADE]->get_prev_auto(
- (int64_t)unit_position,
- PLAY_FORWARD,
- current);
+ VPatchGUI *patch = vkey_fade_patch->patch;
+ int ret = VFadePatch::handle_event();
+ VFadePatch *fade = patch->fade;
+ if( fade )
+ fade->update(get_value());
+ return ret;
}
+
VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y)
- : BC_PopupMenu(x,
- y,
- patch->patchbay->mode_icons[0]->get_w() + 20,
- "",
- 1,
- mwindow->theme->get_image_set("mode_popup", 0),
- 10)
+ : BC_PopupMenu(x, y, patch->patchbay->mode_icons[0]->get_w() + 20,
+ "", 1, mwindow->theme->get_image_set("mode_popup", 0), 10)
{
this->mwindow = mwindow;
this->patch = patch;
- this->mode = get_keyframe(mwindow, patch)->value;
+ this->mode = mwindow->get_int_auto(patch, AUTOMATION_MODE)->value;
set_icon(patch->patchbay->mode_to_icon(this->mode));
set_tooltip(_("Overlay mode"));
}
+VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch)
+ : BC_PopupMenu(0, 0, 0, "", 0)
+{
+ this->mwindow = mwindow;
+ this->patch = patch;
+ this->mode = mwindow->get_int_auto(patch, AUTOMATION_MODE)->value;
+}
+
+
int VModePatch::handle_event()
{
// Set menu items
return 1;
}
-IntAuto* VModePatch::get_keyframe(MWindow *mwindow, VPatchGUI *patch)
-{
- Auto *current = 0;
- double unit_position = mwindow->edl->local_session->get_selectionstart(1);
- unit_position = mwindow->edl->align_to_frame(unit_position, 0);
- unit_position = patch->vtrack->to_units(unit_position, 0);
-
- return (IntAuto*)patch->vtrack->automation->autos[AUTOMATION_MODE]->get_prev_auto(
- (int64_t)unit_position,
- PLAY_FORWARD,
- current);
-}
-
-
void VModePatch::create_objects()
{
for( int mode=0; mode<TRANSFER_TYPES; ++mode )
popup->handle_event();
return 1;
}
+
+
+VKeyModePatch::VKeyModePatch(MWindow *mwindow, VPatchGUI *patch)
+ : VModePatch(mwindow, patch)
+{
+}
+
+int VKeyModePatch::button_release_event()
+{
+ VModePatch::button_release_event();
+ return 0;
+}
+
+int VKeyModePatch::handle_event()
+{
+ int ret = VModePatch::handle_event();
+ VModePatch *mode = patch->mode;
+ if( mode )
+ mode->update(this->mode);
+ return ret;
+}
+
+
+
VFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y, int w);
int handle_event();
float update_edl();
- static FloatAuto* get_keyframe(MWindow *mwindow, VPatchGUI *patch);
MWindow *mwindow;
VPatchGUI *patch;
};
+class VKeyFadePatch : public BC_SubWindow
+{
+public:
+ VKeyFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y);
+ void create_objects();
+
+ MWindow *mwindow;
+ VPatchGUI *patch;
+ VKeyFadeValue *vkey_fade_value;
+};
+
+class VKeyFadeValue : public VFadePatch
+{
+public:
+ VKeyFadeValue(VKeyFadePatch *vkey_fade_patch);
+ int button_release_event();
+ int handle_event();
+
+ VKeyFadePatch *vkey_fade_patch;
+};
+
class VModePatch : public BC_PopupMenu
{
public:
VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y);
+ VModePatch(MWindow *mwindow, VPatchGUI *patch);
int handle_event();
void create_objects(); // add initial items
static const char* mode_to_text(int mode);
- static IntAuto* get_keyframe(MWindow *mwindow, VPatchGUI *patch);
void update(int mode);
MWindow *mwindow;
int mode;
};
+class VKeyModePatch : public VModePatch
+{
+public:
+ VKeyModePatch(MWindow *mwindow, VPatchGUI *patch);
+ int button_release_event();
+ int handle_event();
+};
+
#endif
#ifndef VPATCHGUI_INC
#define VPATCHGUI_INC
-
-
class VPatchGUI;
+class VFadePatch;
+class VKeyFadePatch;
+class VKeyFadeValue;
+class VModePatch;
+class VModePatchItem;
+class VKeyModePatch;
#define MAX_VIDEO_FADE 100
-
#endif