#include "edl.h"
#include "edlsession.h"
#include "gwindowgui.h"
+#include "keys.h"
#include "language.h"
#include "localsession.h"
#include "mainmenu.h"
{
this->mwindow = mwindow;
color_thread = 0;
+ camera_xyz = 0;
+ projector_xyz = 0;
}
GWindowGUI::~GWindowGUI()
lock_window("GWindowGUI::start_color_thread");
}
-const char *GWindowGUI::other_text[NON_AUTOMATION_TOTAL] =
+const char *GWindowGUI::non_auto_text[NON_AUTOMATION_TOTAL] =
{
N_("Assets"),
N_("Titles"),
N_("Transitions"),
- N_("Plugin Keyframes")
+ N_("Plugin Keyframes"),
};
const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] =
{1, AUTOMATION_FADE},
{1, AUTOMATION_MUTE},
{1, AUTOMATION_SPEED},
+ {1, AUTOMATION_MODE},
+ {1, AUTOMATION_PAN},
+ {1, AUTOMATION_MASK},
+ {0, -1}, // bar
{1, AUTOMATION_CAMERA_X},
{1, AUTOMATION_CAMERA_Y},
{1, AUTOMATION_CAMERA_Z},
+ {-1, NONAUTOTOGGLES_CAMERA_XYZ},
+ {0, -1}, // bar
{1, AUTOMATION_PROJECTOR_X},
{1, AUTOMATION_PROJECTOR_Y},
{1, AUTOMATION_PROJECTOR_Z},
- {0, -1}, // bar
- {1, AUTOMATION_MODE},
- {1, AUTOMATION_PAN},
- {1, AUTOMATION_MASK},
+ {-1, NONAUTOTOGGLES_PROJECTOR_XYZ},
};
+const char *GWindowGUI::toggle_text(toggleinfo *tp)
+{
+ if( tp->isauto > 0 ) return _(auto_text[tp->ref]);
+ if( !tp->isauto ) return _(non_auto_text[tp->ref]);
+ return _("XYZ");
+}
+
void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h)
{
int temp1, temp2, temp3, temp4, temp5, temp6, temp7;
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;
+ int ref = tp->ref;
if( ref < 0 ) {
*h += get_resources()->bar_data->get_h() + 5;
continue;
BC_WindowBase::get_resources()->checkbox_images,
0, &temp1, ¤t_w, ¤t_h,
&temp2, &temp3, &temp4, &temp5, &temp6, &temp7,
- _(isauto ? auto_text[ref] : other_text[ref]),
- MEDIUMFONT);
+ toggle_text(tp), MEDIUMFONT);
current_w += current_h;
*w = MAX(current_w, *w);
*h += current_h + 5;
y += bar->get_h() + 5;
continue;
}
- 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;
- }
- const char *label = _(tp->isauto ? auto_text[tp->ref] : other_text[tp->ref]);
- int color = !tp->isauto ? -1 : auto_colors[tp->ref];
+ const char *label = toggle_text(tp);
+ int color = tp->isauto > 0 ? auto_colors[tp->ref] : WHITE;
GWindowToggle *toggle = new GWindowToggle(this, x, y, label, color, tp);
add_tool(toggles[i] = toggle);
- if( vframe )
- draw_vframe(vframe, get_w()-vframe->get_w()-10, y);
- else if( tp->isauto ) {
- int wh = toggle->get_h() - 4;
- GWindowColorButton *color_button =
- new GWindowColorButton(toggle, get_w()-wh-10, y+2, wh);
- add_tool(color_button);
- color_button->set_color(color);
- color_button->draw_face();
+ if( tp->isauto > 0 ) {
+ 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 ) {
+ int wh = toggle->get_h() - 4;
+ GWindowColorButton *color_button =
+ new GWindowColorButton(toggle, get_w()-wh-10, y+2, wh);
+ add_tool(color_button);
+ color_button->set_color(color);
+ color_button->draw_face();
+ }
+ else
+ draw_vframe(vframe, get_w()-vframe->get_w()-10, y);
+ }
+ else if( tp->isauto < 0 ) {
+ const char *accel = 0;
+ switch( ref ) {
+ case NONAUTOTOGGLES_CAMERA_XYZ:
+ camera_xyz = toggle;
+ accel = _("SHF+F1");
+ break;
+ case NONAUTOTOGGLES_PROJECTOR_XYZ:
+ projector_xyz = toggle;
+ accel = _("SHF+F2");
+ break;
+ }
+ if( accel ) {
+ int x1 = get_w() - BC_Title::calculate_w(this, accel) - 10;
+ add_subwindow(new BC_Title(x1, y, accel));
+ }
}
y += toggles[i]->get_h() + 5;
}
+ update_toggles(0);
unlock_window();
}
if( toggles[i] ) toggles[i]->update();
}
+ camera_xyz->set_value(check_xyz(AUTOMATION_CAMERA_X) > 0 ? 1 : 0);
+ projector_xyz->set_value(check_xyz(AUTOMATION_PROJECTOR_X) > 0 ? 1 : 0);
+
if(use_lock) unlock_window();
}
+void GWindowGUI::toggle_camera_xyz()
+{
+ int v = camera_xyz->get_value() ? 0 : 1;
+ camera_xyz->set_value(v);
+ xyz_check(AUTOMATION_CAMERA_X, v);
+ update_toggles(0);
+ update_mwindow();
+}
+
+void GWindowGUI::toggle_projector_xyz()
+{
+ int v = projector_xyz->get_value() ? 0 : 1;
+ projector_xyz->set_value(v);
+ xyz_check(AUTOMATION_PROJECTOR_X, v);
+ update_toggles(0);
+ update_mwindow();
+}
+
int GWindowGUI::translation_event()
{
mwindow->session->gwindow_x = get_x();
int GWindowGUI::keypress_event()
{
switch(get_keypress()) {
+ case KEY_F1:
+ if( shift_down() )
+ toggle_camera_xyz();
+ break;
+ case KEY_F2:
+ if( shift_down() )
+ toggle_projector_xyz();
+ break;
case 'w':
case 'W':
case '0':
return 0;
}
+int GWindowGUI::check_xyz(int group)
+{
+// returns 1=all set, -1=all clear, 0=mixed
+ int *autos = mwindow->edl->session->auto_conf->autos;
+ int v = autos[group], ret = v ? 1 : -1;
+ if( autos[group+1] != v || autos[group+2] != v ) ret = 0;
+ return ret;
+}
+void GWindowGUI::xyz_check(int group, int v)
+{
+ int *autos = mwindow->edl->session->auto_conf->autos;
+ autos[group+0] = v;
+ autos[group+1] = v;
+ autos[group+2] = v;
+}
+
+int* GWindowGUI::get_main_value(toggleinfo *info)
+{
+ if( info->isauto > 0 )
+ return &mwindow->edl->session->auto_conf->autos[info->ref];
+ if( !info->isauto ) {
+ switch( info->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;
+}
+
GWindowToggle::GWindowToggle(GWindowGUI *gui, int x, int y,
const char *text, int color, toggleinfo *info)
- : BC_CheckBox(x, y, *get_main_value(gui->mwindow, info), text, MEDIUMFONT, color)
+ : BC_CheckBox(x, y, 0, text, MEDIUMFONT, color)
{
this->gui = gui;
this->info = info;
int GWindowToggle::handle_event()
{
int value = get_value();
- *get_main_value(gui->mwindow, info) = value;
+ if( info->isauto >= 0 ) {
+ *gui->get_main_value(info) = value;
+ switch( info->ref ) {
+ case AUTOMATION_CAMERA_X:
+ case AUTOMATION_CAMERA_Y:
+ case AUTOMATION_CAMERA_Z: {
+ int v = gui->check_xyz(AUTOMATION_CAMERA_X);
+ gui->camera_xyz->set_value(v > 0 ? 1 : 0);
+ break; }
+ case AUTOMATION_PROJECTOR_X:
+ case AUTOMATION_PROJECTOR_Y:
+ case AUTOMATION_PROJECTOR_Z: {
+ int v = gui->check_xyz(AUTOMATION_PROJECTOR_X);
+ gui->projector_xyz->set_value(v > 0 ? 1 : 0);
+ break; }
+ }
+ }
+ else {
+ int group = -1;
+ switch( info->ref ) {
+ case NONAUTOTOGGLES_CAMERA_XYZ: group = AUTOMATION_CAMERA_X; break;
+ case NONAUTOTOGGLES_PROJECTOR_XYZ: group = AUTOMATION_PROJECTOR_X; break;
+ }
+ if( group >= 0 ) {
+ gui->xyz_check(group, value);
+ gui->update_toggles(0);
+ }
+ }
gui->update_mwindow();
-
// Update stuff in MWindow
unlock_window();
MWindow *mwindow = gui->mwindow;
mwindow->gui->lock_window("GWindowToggle::handle_event");
- if( info->isauto ) {
+ if( !info->isauto ) {
+ switch( info->ref ) {
+ case NON_AUTOMATION_ASSETS:
+ case NON_AUTOMATION_TITLES:
+ mwindow->gui->update(1, 1, 0, 0, 1, 0, 0);
+ break;
+
+ case NON_AUTOMATION_TRANSITIONS:
+ case NON_AUTOMATION_PLUGIN_AUTOS:
+ mwindow->gui->draw_overlays(1);
+ break;
+ }
+ }
+ else
+ mwindow->gui->draw_overlays(1);
+
+ if( value && info->isauto > 0 ) {
int autogroup_type = -1;
switch( info->ref ) {
case AUTOMATION_FADE:
autogroup_type = AUTOGROUPTYPE_ZOOM;
break;
}
- if( value && autogroup_type >= 0 ) {
+ if( autogroup_type >= 0 ) {
mwindow->edl->local_session->zoombar_showautotype = autogroup_type;
mwindow->gui->zoombar->update_autozoom();
}
- mwindow->gui->draw_overlays(1);
- }
- else {
- switch( info->ref ) {
- case NON_AUTOMATION_ASSETS:
- case NON_AUTOMATION_TITLES:
- mwindow->gui->update(1, 1, 0, 0, 1, 0, 0);
- break;
-
- case NON_AUTOMATION_TRANSITIONS:
- case NON_AUTOMATION_PLUGIN_AUTOS:
- mwindow->gui->draw_overlays(1);
- break;
- }
}
mwindow->gui->unlock_window();
return 1;
}
-int* GWindowToggle::get_main_value(MWindow *mwindow, toggleinfo *info)
-{
- if( info->isauto )
- return &mwindow->edl->session->auto_conf->autos[info->ref];
-
- switch( info->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()
{
- int *vp = get_main_value(gui->mwindow, info);
- if( !vp ) return;
- set_value(*vp);
+ int *vp = gui->get_main_value(info);
+ if( vp ) set_value(*vp);
}
void GWindowToggle::update_gui(int color)