#include "gwindowgui.h"
#include "intauto.h"
#include "intautos.h"
+#include "keys.h"
#include "language.h"
#include "localsession.h"
#include "mainsession.h"
}
}
else if( h >= y2 ) {
- patchbay->add_subwindow(fade = new AFadePatch(mwindow, this, x1+x, y1+y,
- patchbay->get_w() - 10));
+ float v = mwindow->get_float_auto(this, AUTOMATION_FADE)->get_value();
+ patchbay->add_subwindow(fade = new AFadePatch(this, x1+x, y1+y,
+ patchbay->get_w() - 10, v));
}
y1 = y2;
return y1;
}
-void APatchGUI::synchronize_fade(float value_change)
+void APatchGUI::update_faders(float v)
{
- if( fade && !change_source ) {
- fade->update(fade->get_value() + value_change);
- fade->update_edl();
- }
-}
-
-
-
-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],
- mwindow->get_float_auto(patch, AUTOMATION_FADE)->get_value())
-{
- this->mwindow = mwindow;
- this->patch = patch;
-}
+ if( fade )
+ fade->update(v);
-float AFadePatch::update_edl()
-{
- FloatAuto *current;
+ change_source = 1;
double position = mwindow->edl->local_session->get_selectionstart(1);
- Autos *fade_autos = patch->atrack->automation->autos[AUTOMATION_FADE];
+ Autos *fade_autos = atrack->automation->autos[AUTOMATION_FADE];
int need_undo = !fade_autos->auto_exists_for_editing(position);
mwindow->undo->update_undo_before(_("fade"), need_undo ? 0 : this);
+ FloatAuto *current = (FloatAuto*)fade_autos->get_auto_for_editing(position);
+ float change = v - current->get_value();
+ current->set_value(v);
- current = (FloatAuto*)fade_autos->get_auto_for_editing(position);
+ if( track->gang && track->record )
+ patchbay->synchronize_faders(change, TRACK_AUDIO, track);
+ mwindow->undo->update_undo_after(_("fade"), LOAD_AUTOMATION);
+ change_source = 0;
- float result = get_value() - current->get_value();
- current->set_value(this->get_value());
+ mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->undo->update_undo_after(_("fade"), LOAD_AUTOMATION);
+ if( mwindow->edl->session->auto_conf->autos[AUTOMATION_FADE] ) {
+ mwindow->gui->draw_overlays(1);
+ }
+}
- return result;
+AFadePatch::AFadePatch(APatchGUI *patch, int x, int y, int w, float v)
+ : BC_FSlider(x, y, 0, w, w,
+ patch->mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_AUDIO_FADE],
+ patch->mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE],
+ v)
+{
+ this->patch = patch;
}
update(0.0);
set_tooltip(get_caption());
}
-
- patch->change_source = 1;
- float change = update_edl();
- if( patch->track->gang && patch->track->record )
- patch->patchbay->synchronize_faders(change, TRACK_AUDIO, patch->track);
- patch->change_source = 0;
-
- mwindow->sync_parameters(CHANGE_PARAMS);
-
- if( mwindow->edl->session->auto_conf->autos[AUTOMATION_FADE] ) {
- mwindow->gui->draw_overlays(1);
- }
+ patch->update_faders(get_value());
return 1;
}
AKeyFadePatch::AKeyFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y)
- : BC_SubWindow(x,y, patch->patchbay->get_w(),20,
- GWindowGUI::auto_colors[AUTOMATION_FADE])
+ : BC_SubWindow(x,y, 200,20, GWindowGUI::auto_colors[AUTOMATION_FADE])
{
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();
+ int x = 0, y = 0;
+ float v = mwindow->get_float_auto(patch, AUTOMATION_FADE)->get_value();
+ add_subwindow(akey_fade_text = new AKeyFadeText(this, x, y, 64, v));
+ x += akey_fade_text->get_w();
+ VFrame **lok_images = mwindow->theme->get_image_set("lok");
+ int w1 = get_w() - x - lok_images[0]->get_w();
+ add_subwindow(akey_fade_slider = new AKeyFadeSlider(this, x, y, w1, v));
+ x += akey_fade_slider->get_w();
+ add_subwindow(akey_fade_ok = new AKeyFadeOK(this, x, y, lok_images));
+ 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())
+void AKeyFadePatch::update(float v)
+{
+ akey_fade_text->update(v);
+ akey_fade_slider->update(v);
+ patch->update_faders(v);
+}
+
+AKeyFadeOK::AKeyFadeOK(AKeyFadePatch *akey_fade_patch, int x, int y, VFrame **images)
+ : BC_Button(x, y, images)
{
this->akey_fade_patch = akey_fade_patch;
}
-int AKeyFadeValue::button_release_event()
+int AKeyFadeOK::handle_event()
{
- AFadePatch::button_release_event();
- return 0;
+ MWindowGUI *mgui = akey_fade_patch->mwindow->gui;
+ delete mgui->keyvalue_popup;
+ mgui->keyvalue_popup = 0;
+ return 1;
}
-int AKeyFadeValue::handle_event()
+AKeyFadeText::AKeyFadeText(AKeyFadePatch *akey_fade_patch, int x, int y, int w, float v)
+ : BC_TextBox(x, y, w, 1, v, 1, MEDIUMFONT, 2)
{
- APatchGUI *patch = akey_fade_patch->patch;
- int ret = AFadePatch::handle_event();
- AFadePatch *fade = patch->fade;
- if( fade )
- fade->update(get_value());
- return ret;
+ this->akey_fade_patch = akey_fade_patch;
+}
+
+int AKeyFadeText::handle_event()
+{
+ float v = atof(get_text());
+ akey_fade_patch->update(v);
+ return get_keypress() != RETURN ? 1 :
+ akey_fade_patch->akey_fade_ok->handle_event();
+}
+
+AKeyFadeSlider::AKeyFadeSlider(AKeyFadePatch *akey_fade_patch, int x, int y, int w, float v)
+ : AFadePatch(akey_fade_patch->patch, x, y, w, v)
+{
+ this->akey_fade_patch = akey_fade_patch;
+}
+
+int AKeyFadeSlider::handle_event()
+{
+ float v = get_value();
+ akey_fade_patch->update(v);
+ return 1;
}
{
}
-int AKeyPanPatch::button_release_event()
-{
- APanPatch::button_release_event();
- return 0;
-}
-
int AKeyPanPatch::handle_event()
{
int ret = APanPatch::handle_event();
void create_objects();
int reposition(int x, int y);
int update(int x, int y);
- void synchronize_fade(float value_change);
+ void update_faders(float v);
ATrack *atrack;
AFadePatch *fade;
class AFadePatch : public BC_FSlider
{
public:
- AFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y, int w);
+ AFadePatch(APatchGUI *patch, int x, int y, int w, float v);
static FloatAuto* get_keyframe(MWindow *mwindow, APatchGUI *patch);
virtual int handle_event();
- float update_edl();
- MWindow *mwindow;
APatchGUI *patch;
};
public:
AKeyFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y);
void create_objects();
+ void update(float v);
MWindow *mwindow;
APatchGUI *patch;
- AKeyFadeValue *akey_fade_value;
+ AKeyFadeOK *akey_fade_ok;
+ AKeyFadeText *akey_fade_text;
+ AKeyFadeSlider *akey_fade_slider;
+};
+
+class AKeyFadeOK : public BC_Button
+{
+public:
+ AKeyFadeOK(AKeyFadePatch *akey_fade_patch, int x, int y, VFrame **images);
+ int handle_event();
+
+ AKeyFadePatch *akey_fade_patch;
+};
+
+class AKeyFadeText : public BC_TextBox
+{
+public:
+ AKeyFadeText(AKeyFadePatch *akey_fade_patch, int x, int y, int w, float v);
+ int handle_event();
+
+ AKeyFadePatch *akey_fade_patch;
};
-class AKeyFadeValue : public AFadePatch
+class AKeyFadeSlider : public AFadePatch
{
public:
- AKeyFadeValue(AKeyFadePatch *akey_fade_patch);
- int button_release_event();
+ AKeyFadeSlider(AKeyFadePatch *akey_fade_patch, int x, int y, int w, float v);
int handle_event();
AKeyFadePatch *akey_fade_patch;
{
public:
AKeyPanPatch(MWindow *mwindow, APatchGUI *patch);
- int button_release_event();
int handle_event();
};
class APatchGUI;
class AFadePatch;
class AKeyFadePatch;
-class AKeyFadeValue;
+class AKeyFadeOK;
+class AKeyFadeText;
+class AKeyFadeSlider;
class APanPatch;
class AKeyPanPatch;
class AMeterPatch;
+class AMixPatch;
#endif
#include "gwindow.h"
#include "gwindowgui.h"
#include "intauto.h"
+#include "keys.h"
#include "keyframe.h"
#include "keyframepopup.h"
#include "language.h"
#include "mwindow.h"
#include "patchbay.h"
#include "patchgui.h"
+#include "theme.h"
#include "timelinepane.h"
#include "track.h"
#include "vtrack.h"
int KeyMuteValue::button_release_event()
{
BC_CheckBox::button_release_event();
- return 0;
+ MWindowGUI *mgui = key_mute_patch->mwindow->gui;
+ delete mgui->keyvalue_popup;
+ mgui->keyvalue_popup = 0;
+ return 1;
}
-void KeyMuteValue::update_edl()
+int KeyMuteValue::handle_event()
{
MWindow *mwindow = key_mute_patch->mwindow;
PatchGUI *patch = key_mute_patch->patch;
+
+ patch->change_source = 1;
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);
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]) {
+ if( mwindow->edl->session->auto_conf->autos[AUTOMATION_MUTE] ) {
mwindow->gui->update_patchbay();
mwindow->gui->draw_overlays(1);
}
void KeySpeedPatch::create_objects()
{
- key_speed_slider = new KeySpeedValue(this);
- add_subwindow(key_speed_slider);
- key_speed_slider->activate();
+ int x = 0, y = 0;
+ float v = mwindow->get_float_auto(patch, AUTOMATION_SPEED)->get_value();
+ add_subwindow(key_speed_text = new KeySpeedText(this, x, y, 64, v));
+ x += key_speed_text->get_w();
+ VFrame **lok_images = mwindow->theme->get_image_set("lok");
+ int w1 = get_w() - x - lok_images[0]->get_w();
+ add_subwindow(key_speed_slider = new KeySpeedSlider(this, x, y, w1, v));
+ x += key_speed_slider->get_w();
+ add_subwindow(key_speed_ok = new KeySpeedOK(this, x, y, lok_images));
+ 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())
+int KeySpeedPatch::cursor_enter_event()
{
- this->key_speed_patch = key_speed_patch;
- key_speed_patch->mwindow->speed_before();
- set_precision(0.01);
+ if( is_event_win() )
+ mwindow->speed_before();
+ return 1;
}
-KeySpeedValue::~KeySpeedValue()
+int KeySpeedPatch::cursor_leave_event()
{
+ if( is_event_win() ) {
+ mwindow->speed_after(1);
+ mwindow->resync_guis();
+ }
+ return 1;
}
-int KeySpeedValue::button_release_event()
+void KeySpeedPatch::update(float v)
{
- BC_FSlider::button_release_event();
- key_speed_patch->mwindow->speed_after(1);
- key_speed_patch->mwindow->resync_guis();
- return 0;
+ key_speed_text->update(v);
+ key_speed_slider->update(v);
+ update_speed(v);
}
-void KeySpeedValue::update_edl()
+void KeySpeedPatch::update_speed(float v)
{
- MWindow *mwindow = key_speed_patch->mwindow;
- PatchGUI *patch = key_speed_patch->patch;
+ patch->change_source = 1;
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());
+ current->set_value(v);
mwindow->undo->update_undo_after(_("speed"), LOAD_AUTOMATION+LOAD_EDITS);
+ patch->change_source = 0;
+
+ mwindow->sync_parameters(CHANGE_PARAMS);
+ if(mwindow->edl->session->auto_conf->autos[AUTOMATION_SPEED]) {
+ mwindow->gui->draw_overlays(1);
+ }
}
-int KeySpeedValue::handle_event()
+KeySpeedOK::KeySpeedOK(KeySpeedPatch *key_speed_patch, int x, int y, VFrame **images)
+ : BC_Button(x, y, images)
+{
+ this->key_speed_patch = key_speed_patch;
+}
+
+int KeySpeedOK::handle_event()
{
MWindow *mwindow = key_speed_patch->mwindow;
- PatchGUI *patch = key_speed_patch->patch;
+ mwindow->speed_after(1);
+ mwindow->resync_guis();
+ MWindowGUI *mgui = mwindow->gui;
+ delete mgui->keyvalue_popup;
+ mgui->keyvalue_popup = 0;
+ return 1;
+}
+
+KeySpeedText::KeySpeedText(KeySpeedPatch *key_speed_patch, int x, int y, int w, float v)
+ : BC_TextBox(x, y, w, 1, v, 1, MEDIUMFONT, 2)
+{
+ this->key_speed_patch = key_speed_patch;
+}
+
+int KeySpeedText::handle_event()
+{
+ float v = atof(get_text());
+ key_speed_patch->update(v);
+ return get_keypress() != RETURN ? 1 :
+ key_speed_patch->key_speed_ok->handle_event();
+}
+
+KeySpeedSlider::KeySpeedSlider(KeySpeedPatch *key_speed_patch,
+ int x, int y, int w, float v)
+ : BC_FSlider(x, y, 0, w, w,
+ key_speed_patch->mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_SPEED],
+ key_speed_patch->mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_SPEED],
+ v)
+{
+ this->key_speed_patch = key_speed_patch;
+ key_speed_patch->mwindow->speed_before();
+ set_precision(0.01);
+}
+
+KeySpeedSlider::~KeySpeedSlider()
+{
+}
+
+int KeySpeedSlider::handle_event()
+{
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);
- }
+ key_speed_patch->update(get_value());
return 1;
}
class KeyframeHidePopup : public BC_PopupMenu
{
public:
- KeyframeHidePopup(MWindow *mwindow, MWindowGUI *gui);
- ~KeyframeHidePopup();
+ KeyframeHidePopup(MWindow *mwindow, MWindowGUI *gui);
+ ~KeyframeHidePopup();
- void create_objects();
+ void create_objects();
int update(Autos *autos);
MWindow *mwindow;
{
public:
KeyMuteValue(KeyMutePatch *key_mute_patch);
- void update_edl();
int button_release_event();
int handle_event();
public:
KeySpeedPatch(MWindow *mwindow, PatchGUI *patch, int x, int y);
void create_objects();
+ void update(float v);
+ void update_speed(float v);
+ int cursor_enter_event();
+ int cursor_leave_event();
MWindow *mwindow;
PatchGUI *patch;
- KeySpeedValue *key_speed_slider;
+ KeySpeedSlider *key_speed_slider;
+ KeySpeedText *key_speed_text;
+ KeySpeedOK *key_speed_ok;
};
-class KeySpeedValue : public BC_FSlider
+class KeySpeedOK : public BC_Button
{
public:
- KeySpeedValue(KeySpeedPatch *key_speed_patch);
- ~KeySpeedValue();
+ KeySpeedOK(KeySpeedPatch *key_speed_patch, int x, int y, VFrame **images);
+ int handle_event();
+
+ KeySpeedPatch *key_speed_patch;
+};
+
+class KeySpeedText : public BC_TextBox
+{
+public:
+ KeySpeedText(KeySpeedPatch *key_speed_patch, int x, int y, int w, float v);
+ int handle_event();
+
+ KeySpeedPatch *key_speed_patch;
+};
+
+class KeySpeedSlider : public BC_FSlider
+{
+public:
+ KeySpeedSlider(KeySpeedPatch *key_speed_patch,
+ int x, int y, int w, float v);
+ ~KeySpeedSlider();
- void update_edl();
int handle_event();
- int button_release_event();
KeySpeedPatch *key_speed_patch;
};
class KeyMutePatch;
class KeyMuteValue;
class KeySpeedPatch;
-class KeySpeedValue;
+class KeySpeedOK;
+class KeySpeedText;
+class KeySpeedSlider;
#endif
}
-int MWindowGUI::button_release_event()
-{
- if( keyvalue_popup ) {
- delete keyvalue_popup; keyvalue_popup = 0;
- }
- return 0;
-}
-
-
int MWindowGUI::repeat_event(int64_t duration)
{
// if(duration == 100)
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);
}
-
-
-
-
-
-
-
-
-
-
PlayPatch::PlayPatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
: BC_Toggle(x,
y,
show_window();
operation = new BC_Title(5,
get_h() - get_text_height(MEDIUMFONT) - 5,
- _("Loading..."));
+ _("Loading..."), MEDIUMFONT, GREEN);
add_subwindow(operation);
unlock_window();
}
int current_op = mwindow->session->current_operation, dragging = 0;
for( int i=0; !dragging && i<AUTOMATION_TOTAL; ++i )
if( current_op == auto_operations[i] ) dragging = 1;
+ if( dragging && !mwindow->session->drag_auto ) dragging = 0;
- if( keyframe_hairline == HAIRLINE_DRAGGING && dragging ) {
- if( mwindow->session->drag_auto && get_buttonpress() == 1 ) {
- draw_hairline(mwindow->session->drag_auto, RED);
- return;
- }
+ int autoidx = dragging && keyframe_hairline != HAIRLINE_ALWAYS ?
+ mwindow->session->drag_auto->autos->autoidx : -1;
+
+ if( get_buttonpress() == 1 && dragging &&
+ keyframe_hairline == HAIRLINE_DRAGGING ) {
+ draw_hairline(mwindow->session->drag_auto, RED, 1);
+ return;
}
if( keyframe_hairline == HAIRLINE_ALWAYS || ( get_buttonpress() == 2 &&
keyframe_hairline == HAIRLINE_DRAGGING && dragging ) ) {
- for( Track *track = mwindow->edl->tracks->first; track;
- track=track->next ) {
+ int show = dragging || keyframe_hairline == HAIRLINE_ALWAYS ? 1 : 0;
+ for( Track *track = mwindow->edl->tracks->first; track; track=track->next ) {
Automation *automation = track->automation;
for( int i=0; i<AUTOMATION_TOTAL; ++i ) {
if( !mwindow->edl->session->auto_conf->autos[i] ) continue;
// automation visible
Autos *autos = automation->autos[i];
if( !autos ) continue;
+ if( autoidx >= 0 && autos->autoidx != autoidx ) continue;
for( Auto *auto_keyframe=autos->first; auto_keyframe;
auto_keyframe = auto_keyframe->next ) {
- draw_hairline(auto_keyframe, BLUE);
+ draw_hairline(auto_keyframe, BLUE, show);
}
}
-
- if( dragging && mwindow->session->drag_auto ) {
- draw_hairline(mwindow->session->drag_auto, RED);
- }
}
+
+ if( dragging )
+ draw_hairline(mwindow->session->drag_auto, RED, 1);
}
}
return result;
}
-int TrackCanvas::draw_hairline(Auto *auto_keyframe, int color)
+int TrackCanvas::draw_hairline(Auto *auto_keyframe, int color, int show)
{
Track *track = auto_keyframe->autos->track;
- int autogrouptype = auto_keyframe->autos->get_type();
+ int autogrouptype = auto_keyframe->autos->autogrouptype;
int center_pixel;
double view_start, unit_start;
set_color(color);
draw_line(ax, 0, ax, get_h());
+
+ if( show ) {
+ char text[BCSTRLEN];
+ if( auto_keyframe->is_floatauto() ) {
+ FloatAuto *float_auto = (FloatAuto *)auto_keyframe;
+ sprintf(text, "%0.2f", float_auto->get_value());
+ }
+ else {
+ IntAuto *int_auto = (IntAuto *)auto_keyframe;
+ sprintf(text, "%d", int_auto->value);
+ }
+ int font = MEDIUMFONT;
+ int tw = get_text_width(font, text) + TOOLTIP_MARGIN * 2;
+ int th = get_text_height(font, text) + TOOLTIP_MARGIN * 2;
+ set_color(get_resources()->tooltip_bg_color);
+ ax += HANDLE_W/2;
+ ay += center_pixel + HANDLE_W/2;
+ draw_box(ax, ay, tw, th);
+ set_color(BLACK);
+ draw_rectangle(ax, ay, tw, th);
+ set_font(font);
+ ax += TOOLTIP_MARGIN;
+ ay += TOOLTIP_MARGIN + get_text_ascent(font);
+ draw_text(ax, ay, text);
+ }
return 0;
}
void draw_playback_cursor();
void draw_highlighting();
void draw_keyframe_reticle();
- int draw_hairline(Auto *auto_keyframe, int color);
+ int draw_hairline(Auto *auto_keyframe, int color, int show);
// User can either call draw or draw_overlays to copy a fresh
// canvas and just draw the overlays over it
#include "gwindowgui.h"
#include "intauto.h"
#include "intautos.h"
+#include "keys.h"
#include "language.h"
#include "localsession.h"
#include "mainsession.h"
}
}
else if( h >= y2 ) {
- patchbay->add_subwindow(fade = new VFadePatch(mwindow, this, x1+x, y1+y,
- patchbay->get_w() - 10));
+ int64_t v = mwindow->get_float_auto(this, AUTOMATION_FADE)->get_value();
+ patchbay->add_subwindow(fade = new VFadePatch(this, x1+x, y1+y,
+ patchbay->get_w() - 10, v));
}
y1 = y2;
return y1;
}
-
-void VPatchGUI::synchronize_fade(float value_change)
-{
- if( fade && !change_source ) {
- fade->update(Units::to_int64(fade->get_value() + value_change));
- fade->update_edl();
- }
-}
-
-
-VFadePatch::VFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y, int w)
+VFadePatch::VFadePatch(VPatchGUI *patch, int x, int y, int w, int64_t v)
: 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())
+ patch->mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE],
+ patch->mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE],
+ v)
{
- this->mwindow = mwindow;
this->patch = patch;
}
-float VFadePatch::update_edl()
+void VPatchGUI::update_faders(float v)
{
- FloatAuto *current;
+ if( fade )
+ fade->update(v);
+
+ change_source = 1;
double position = mwindow->edl->local_session->get_selectionstart(1);
- Autos *fade_autos = patch->vtrack->automation->autos[AUTOMATION_FADE];
+ Autos *fade_autos = vtrack->automation->autos[AUTOMATION_FADE];
int need_undo = !fade_autos->auto_exists_for_editing(position);
mwindow->undo->update_undo_before(_("fade"), need_undo ? 0 : this);
+ FloatAuto *current = (FloatAuto*)fade_autos->get_auto_for_editing(position);
+ float change = v - current->get_value();
+ current->set_value(v);
- current = (FloatAuto*)fade_autos->get_auto_for_editing(position);
-
- float result = get_value() - current->get_value();
- current->set_value(get_value());
-
+ if( track->gang && track->record )
+ patchbay->synchronize_faders(change, TRACK_AUDIO, track);
mwindow->undo->update_undo_after(_("fade"), LOAD_AUTOMATION);
+ change_source = 0;
+
+ mwindow->sync_parameters(CHANGE_PARAMS);
- return result;
+ if( mwindow->edl->session->auto_conf->autos[AUTOMATION_FADE] ) {
+ mwindow->gui->draw_overlays(1);
+ }
}
int VFadePatch::handle_event()
update(100);
set_tooltip(get_caption());
}
-
- patch->change_source = 1;
-
- float change = update_edl();
-
- if( patch->track->gang && patch->track->record )
- patch->patchbay->synchronize_faders(change, TRACK_VIDEO, patch->track);
-
- patch->change_source = 0;
-
-
- mwindow->gui->unlock_window();
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->gui->lock_window("VFadePatch::handle_event");
- if( mwindow->edl->session->auto_conf->autos[AUTOMATION_FADE] ) {
- mwindow->gui->draw_overlays(1);
- }
+ patch->update_faders(get_value());
return 1;
}
-
VKeyFadePatch::VKeyFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y)
- : BC_SubWindow(x,y, patch->patchbay->get_w(),20,
- GWindowGUI::auto_colors[AUTOMATION_FADE])
+ : BC_SubWindow(x,y, 200,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();
+ int x = 0, y = 0;
+ int64_t v = mwindow->get_float_auto(patch, AUTOMATION_FADE)->get_value();
+ add_subwindow(vkey_fade_text = new VKeyFadeText(this, x, y, 64, v));
+ x += vkey_fade_text->get_w();
+ VFrame **lok_images = mwindow->theme->get_image_set("lok");
+ int w1 = get_w() - x - lok_images[0]->get_w();
+ add_subwindow(vkey_fade_slider = new VKeyFadeSlider(this, x, y, w1, v));
+ x += vkey_fade_slider->get_w();
+ add_subwindow(vkey_fade_ok = new VKeyFadeOK(this, x, y, lok_images));
+ 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())
+void VKeyFadePatch::update(int64_t v)
+{
+ vkey_fade_text->update(v);
+ vkey_fade_slider->update(v);
+ patch->update_faders(v);
+}
+
+VKeyFadeOK::VKeyFadeOK(VKeyFadePatch *vkey_fade_patch, int x, int y, VFrame **images)
+ : BC_Button(x, y, images)
{
this->vkey_fade_patch = vkey_fade_patch;
}
-int VKeyFadeValue::button_release_event()
+int VKeyFadeOK::handle_event()
{
- VFadePatch::button_release_event();
- return 0;
+ MWindowGUI *mgui = vkey_fade_patch->mwindow->gui;
+ delete mgui->keyvalue_popup;
+ mgui->keyvalue_popup = 0;
+ return 1;
}
-int VKeyFadeValue::handle_event()
+VKeyFadeText::VKeyFadeText(VKeyFadePatch *vkey_fade_patch, int x, int y, int w, int64_t v)
+ : BC_TextBox(x, y, w, 1, v, 1, MEDIUMFONT)
{
- VPatchGUI *patch = vkey_fade_patch->patch;
- int ret = VFadePatch::handle_event();
- VFadePatch *fade = patch->fade;
- if( fade )
- fade->update(get_value());
- return ret;
+ this->vkey_fade_patch = vkey_fade_patch;
+}
+
+int VKeyFadeText::handle_event()
+{
+ int64_t v = atoi(get_text());
+ vkey_fade_patch->update(v);
+ return get_keypress() != RETURN ? 1 :
+ vkey_fade_patch->vkey_fade_ok->handle_event();
+}
+
+VKeyFadeSlider::VKeyFadeSlider(VKeyFadePatch *vkey_fade_patch,
+ int x, int y, int w, int64_t v)
+ : VFadePatch(vkey_fade_patch->patch, x,y, w, v)
+{
+ this->vkey_fade_patch = vkey_fade_patch;
+}
+
+int VKeyFadeSlider::handle_event()
+{
+ int64_t v = get_value();
+ vkey_fade_patch->update(v);
+ return 1;
}
{
}
-int VKeyModePatch::button_release_event()
-{
- VModePatch::button_release_event();
- return 0;
-}
-
int VKeyModePatch::handle_event()
{
int ret = VModePatch::handle_event();
#include "vpatchgui.inc"
#include "vtrack.inc"
-class VFadePatch;
-class VModePatch;
-
class VPatchGUI : public PatchGUI
{
public:
void create_objects();
int reposition(int x, int y);
int update(int x, int y);
- void synchronize_fade(float value_change);
+ void update_faders(float v);
VTrack *vtrack;
VModePatch *mode;
class VFadePatch : public BC_ISlider
{
public:
- VFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y, int w);
+ VFadePatch(VPatchGUI *patch, int x, int y, int w, int64_t v);
int handle_event();
- float update_edl();
- MWindow *mwindow;
VPatchGUI *patch;
};
public:
VKeyFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y);
void create_objects();
+ void update(int64_t v);
MWindow *mwindow;
VPatchGUI *patch;
- VKeyFadeValue *vkey_fade_value;
+ VKeyFadeOK *vkey_fade_ok;
+ VKeyFadeText *vkey_fade_text;
+ VKeyFadeSlider *vkey_fade_slider;
+};
+
+class VKeyFadeOK : public BC_Button
+{
+public:
+ VKeyFadeOK(VKeyFadePatch *vkey_fade_patch, int x, int y, VFrame **images);
+ int handle_event();
+
+ VKeyFadePatch *vkey_fade_patch;
+};
+
+class VKeyFadeText : public BC_TextBox
+{
+public:
+ VKeyFadeText(VKeyFadePatch *vkey_fade_patch, int x, int y, int w, int64_t v);
+ int handle_event();
+
+ VKeyFadePatch *vkey_fade_patch;
};
-class VKeyFadeValue : public VFadePatch
+class VKeyFadeSlider : public VFadePatch
{
public:
- VKeyFadeValue(VKeyFadePatch *vkey_fade_patch);
- int button_release_event();
+ VKeyFadeSlider(VKeyFadePatch *akey_fade_patch, int x, int y, int w, int64_t v);
int handle_event();
VKeyFadePatch *vkey_fade_patch;
{
public:
VKeyModePatch(MWindow *mwindow, VPatchGUI *patch);
- int button_release_event();
int handle_event();
};
class VPatchGUI;
class VFadePatch;
class VKeyFadePatch;
-class VKeyFadeValue;
+class VKeyFadeOK;
+class VKeyFadeText;
+class VKeyFadeSlider;
class VModePatch;
class VModePatchItem;
+class VModePatchSubMenu;
+class VModeSubMenuItem;
class VKeyModePatch;
+class VMixPatch;
#define MAX_VIDEO_FADE 100
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("channel.png",
editpanel_up, editpanel_hi, editpanel_dn,
"channel");
+ new_button("lok.png",
+ editpanel_up, editpanel_hi, editpanel_dn,
+ "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
editpanel_hi,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,
new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
+ new_button("lok.png", editpanel_up, editpanel_hi, editpanel_dn, "lok");
new_toggle("histogram_toggle.png",
editpanel_up,