#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()
int y1 = 0;
- if(x != this->x || y != this->y)
- {
- this->x = x;
- this->y = y;
+ if( x != this->x || y != this->y ) {
+ this->x = x; this->y = y;
- if(title)
- {
-TRACE("PatchGUI::reposition 1\n");
+ if( title )
title->reposition_window(title->get_x(), y1 + y, 0);
-TRACE("PatchGUI::reposition 2\n");
- }
+ if( expand )
+ expand->reposition_window(expand->get_x(), y1 + y);
y1 += mwindow->theme->title_h;
- if(play)
- {
-TRACE("PatchGUI::reposition 3\n");
+ if( play ) {
play->reposition_window(play->get_x(), y1 + y);
x1 += play->get_w();
-TRACE("PatchGUI::reposition 4\n");
record->reposition_window(record->get_x(), y1 + y);
x1 += record->get_w();
-TRACE("PatchGUI::reposition 5\n");
// automate->reposition_window(x1, y1 + y);
// x1 += automate->get_w();
gang->reposition_window(gang->get_x(), y1 + y);
x1 += gang->get_w();
-TRACE("PatchGUI::reposition 6\n");
draw->reposition_window(draw->get_x(), y1 + y);
x1 += draw->get_w();
-TRACE("PatchGUI::reposition 7\n");
mute->reposition_window(mute->get_x(), y1 + y);
x1 += mute->get_w();
-TRACE("PatchGUI::reposition 8\n");
-
- if(expand)
- {
-TRACE("PatchGUI::reposition 9\n");
-// VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data");
-// int x = patchbay->get_w() - 10 - expandpatch_data[0]->get_w();
- expand->reposition_window(
- expand->get_x(),
- y1 + y);
-TRACE("PatchGUI::reposition 10\n");
- x1 += expand->get_w();
-TRACE("PatchGUI::reposition 11\n");
- }
}
y1 += mwindow->theme->play_h;
}
- else
- {
- y1 += mwindow->theme->title_h;
- y1 += mwindow->theme->play_h;
+ else {
+ if( title )
+ y1 += mwindow->theme->title_h;
+ if( play )
+ y1 += mwindow->theme->play_h;
}
return y1;
int x1 = 0;
//printf("PatchGUI::update 10\n");
- if(title)
- {
- if(h - y1 < 0)
- {
- delete title;
- title = 0;
+ int y2 = y1 + mwindow->theme->title_h;
+ if( title ) {
+ if( h < y2 ) {
+ delete title; title = 0;
+ delete expand; expand = 0;
}
- else
- {
+ else {
title->update(track->title);
+ expand->update(track->expand_view);
}
}
- else
- if(h - y1 >= 0)
- {
- patchbay->add_subwindow(title = new TitlePatch(mwindow, this, x1 + x, y1 + y));
+ else if( h >= y2 ) {
+ VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data");
+ int x2 = patchbay->get_w() - expandpatch_data[0]->get_w() - 5;
+ patchbay->add_subwindow(title = new TitlePatch(mwindow, this, x1 + x, y1 + y, x2-x1-5));
+ patchbay->add_subwindow(expand = new ExpandPatch(mwindow, this, x2, y1 + y));
}
- y1 += mwindow->theme->title_h;
- if(play)
- {
- if(h - y1 < mwindow->theme->play_h)
- {
+ if( title )
+ y1 = y2;
+
+ y2 = y1 + mwindow->theme->play_h;
+ if( play ) {
+ if( h < y2 ) {
delete play; play = 0;
delete record; record = 0;
delete gang; gang = 0;
delete draw; draw = 0;
delete mute; mute = 0;
- delete expand; expand = 0;
}
- else
- {
+ else {
play->update(track->play);
record->update(track->record);
gang->update(track->gang);
draw->update(track->draw);
mute->update(mwindow->get_int_auto(this, AUTOMATION_MUTE)->value);
- expand->update(track->expand_view);
}
}
- else
- if(h - y1 >= mwindow->theme->play_h)
- {
+ else if( h >= y2 ) {
patchbay->add_subwindow(play = new PlayPatch(mwindow, this, x1 + x, y1 + y));
//printf("PatchGUI::update %d %d\n", __LINE__, play->get_h());
x1 += play->get_w();
x1 += draw->get_w();
patchbay->add_subwindow(mute = new MutePatch(mwindow, this, x1 + x, y1 + y));
x1 += mute->get_w();
-
- VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data");
- patchbay->add_subwindow(expand = new ExpandPatch(mwindow,
- this,
- patchbay->get_w() - 10 - expandpatch_data[0]->get_w(),
- y1 + y));
- x1 += expand->get_w();
}
- y1 += mwindow->theme->play_h;
+ if( play )
+ y1 = y2;
//UNTRACE
return y1;
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;
}
-
-
-
-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)
+TitlePatch::TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y, int w)
+ : BC_TextBox(x, y, w, 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,
}
+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);
+}