#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);
}