#include "tracks.h"
#include "transportque.h"
#include "vframe.h"
-
+#include "zwindow.h"
PatchGUI::PatchGUI(MWindow *mwindow,
mute = 0;
expand = 0;
nudge = 0;
+ mix = 0;
change_source = 0;
- track_id = -1;
- if(track) track_id = track->get_id();
+ track_id = track ? track->get_id() : -1;
+ mixer = 0;
}
PatchGUI::~PatchGUI()
{
- if(title) delete title;
- if(record) delete record;
- if(play) delete play;
-// if(automate) delete automate;
- if(gang) delete gang;
- if(draw) delete draw;
- if(mute) delete mute;
- if(expand) delete expand;
- if(nudge) delete nudge;
+ delete title;
+ delete record;
+ delete play;
+// delete automate;
+ delete gang;
+ delete draw;
+ delete mute;
+ delete expand;
+ delete nudge;
+ delete mix;
}
void PatchGUI::create_objects()
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);
}
}
BC_Toggle *toggle,
int *output)
{
- if(toggle->shift_down())
- {
- int total_selected = mwindow->edl->tracks->total_of(type);
-
-// nothing previously selected
- if(total_selected == 0)
- {
- mwindow->edl->tracks->select_all(type,
- 1);
- }
- else
- if(total_selected == 1)
- {
-// this patch was previously the only one on
- if(*output)
- {
- mwindow->edl->tracks->select_all(type,
- 1);
- }
-// another patch was previously the only one on
- else
- {
- mwindow->edl->tracks->select_all(type,
- 0);
- *output = 1;
- }
- }
- else
- if(total_selected > 1)
- {
- mwindow->edl->tracks->select_all(type,
- 0);
- *output = 1;
- }
- toggle->set_value(*output);
+ if(toggle->shift_down()) {
+ int sense = type != Tracks::MUTE ? 1 : 0;
+ // all selected if nothing previously selected or
+ // if this patch was previously the only one selected
+ int total_type = mwindow->edl->tracks->total_of(type);
+ int total_selected = sense ? total_type :
+ mwindow->edl->tracks->total() - total_type;
+ int selected = !total_selected || (total_selected == 1 &&
+ *output == sense ) ? sense : 1-sense;
+ mwindow->edl->tracks->select_all(type, selected);
+ if( selected != sense ) *output = sense;
patchbay->drag_operation = type;
patchbay->new_status = 1;
get_value(),
this,
&patch->track->record);
+ patch->title->set_back_color(patch->track->record ?
+ get_resources()->text_background :
+ get_resources()->text_background_disarmed);
+ patch->title->set_text_row(0);
return 1;
}
return 0;
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)
}
-
-
-
TitlePatch::TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
- : BC_TextBox(x,
- y,
- patch->patchbay->get_w() - 10,
- 1,
- patch->track->title,
- 1, MEDIUMFONT, 1)
+ : BC_TextBox(x, y, patch->patchbay->get_w() - 10, 1,
+ patch->track->title, 1, MEDIUMFONT, 1)
{
this->mwindow = mwindow;
this->patch = patch;
+ set_back_color(patch->track->record ?
+ get_resources()->text_background :
+ get_resources()->text_background_disarmed);
+}
+
+void TitlePatch::update(const char *text)
+{
+ set_back_color(patch->track->record ?
+ get_resources()->text_background :
+ get_resources()->text_background_disarmed);
+ BC_TextBox::update(text);
}
int TitlePatch::handle_event()
}
-
-
-
-
-
-
-
NudgePatch::NudgePatch(MWindow *mwindow,
PatchGUI *patch,
int x,
void NudgePatch::set_value(int64_t value)
{
- mwindow->undo->update_undo_before(_("nudge"), this);
+ mwindow->undo->update_undo_before(_("nudge."), this);
patch->track->nudge = value;
if(patch->track->gang && patch->track->record)
patch->patchbay->synchronize_nudge(patch->track->nudge, patch->track);
- mwindow->undo->update_undo_after(_("nudge"), LOAD_PATCHES);
+ mwindow->undo->update_undo_after(_("nudge."), LOAD_PATCHES);
mwindow->gui->unlock_window();
if(patch->track->data_type == TRACK_VIDEO)
}
+MixPatch::MixPatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
+ : BC_Toggle(x, y, mwindow->theme->get_image_set("mixpatch_data"),
+ patch->mixer, "", 0, 0, 0)
+{
+ this->mwindow = mwindow;
+ this->patch = patch;
+}
+
+MixPatch::~MixPatch()
+{
+}
+
+int MixPatch::handle_event()
+{
+ int v = patch->track ? get_value() : 0;
+ if( patch->mixer != v ) {
+ if( patch->track )
+ mwindow->gui->update_mixers(patch->track, v);
+ else
+ update(v);
+ mwindow->update_mixer_tracks();
+ }
+ return 1;
+}
+void MixPatch::update(int v)
+{
+ patch->mixer = v;
+ BC_Toggle::update(v);
+}