*/
#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"
FloatAutos *ptr = (FloatAutos*)atrack->automation->autos[AUTOMATION_FADE];
float value = ptr->get_value(
(long)unit_position,
- PLAY_FORWARD,
+ PLAY_FORWARD,
previous,
next);
fade->update(fade->get_w(),
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;
int AFadePatch::handle_event()
{
- if(shift_down())
+ if(shift_down())
{
update(0.0);
set_tooltip(get_caption());
patch->change_source = 1;
float change = update_edl();
- if(patch->track->gang && patch->track->record)
+ if(patch->track->gang && patch->track->record)
patch->patchbay->synchronize_faders(change, TRACK_AUDIO, patch->track);
patch->change_source = 0;
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])
+{
+ 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()
{
- 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);
+ 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;
int need_undo = !pan_autos->auto_exists_for_editing(position);
mwindow->undo->update_undo_before(_("pan"), need_undo ? 0 : this);
-
+
current = (PanAuto*)pan_autos->get_auto_for_editing(position);
current->handle_x = get_stick_x();
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)
- : BC_Meter(x,
- y,
- METER_HORIZ,
- patch->patchbay->get_w() - 10,
- mwindow->edl->session->min_meter_db,
- mwindow->edl->session->max_meter_db,
- mwindow->edl->session->meter_format,
+ : BC_Meter(x,
+ y,
+ METER_HORIZ,
+ patch->patchbay->get_w() - 10,
+ mwindow->edl->session->min_meter_db,
+ mwindow->edl->session->max_meter_db,
+ mwindow->edl->session->meter_format,
0,
-1)
{
return 0;
}
-
-
-
-