#include "automation.h"
#include "bccolors.h"
+#include "bctimer.h"
#include "clip.h"
#include "condition.h"
#include "cpanel.h"
CWindowCoord::CWindowCoord(CWindowToolGUI *gui, int x, int y, float value, int log_increment = 0)
- : BC_TumbleTextBox(gui, (float)value, (float)-65536, (float)65536, x, y, 100)
+ : BC_TumbleTextBox(gui, (float)value, (float)-65536, (float)65536, x, y, 100, 3)
{
this->gui = gui;
set_log_floatincrement(log_increment);
}
CWindowCoord::CWindowCoord(CWindowToolGUI *gui, int x, int y, int value)
- : BC_TumbleTextBox(gui, (int64_t)value, (int64_t)-65536, (int64_t)65536, x, y, 100)
+ : BC_TumbleTextBox(gui, (int64_t)value, (int64_t)-65536, (int64_t)65536, x, y, 100, 3)
{
this->gui = gui;
}
mwindow->edl->session->crop_y2 = atol(height->get_text()) +
mwindow->edl->session->crop_y1;
update();
- mwindow->cwindow->gui->lock_window("CWindowCropGUI::handle_event");
- mwindow->cwindow->gui->canvas->draw_refresh();
- mwindow->cwindow->gui->unlock_window();
+ mwindow->cwindow->gui->canvas->redraw(1);
}
void CWindowCropGUI::update()
int CWindowCurveToggle::handle_event()
{
- FloatAuto *x=0, *y=0, *z=0;
Track *track = mwindow->cwindow->calculate_affected_track();
-
- if(track)
- { mwindow->cwindow->calculate_affected_autos(&x, &y, &z,
- track, cfg.use_camera, 0,0,0); // don't create new keyframe
-
- if(x) x->change_curve_mode(cfg.mode);
- if(y) y->change_curve_mode(cfg.mode);
- if(z) z->change_curve_mode(cfg.mode);
+ if(track) {
+ FloatAuto *x=0, *y=0, *z=0;
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x, &y, &z, cfg.use_camera, 0,0,0); // don't create new keyframe
+ if( x ) x->change_curve_mode(cfg.mode);
+ if( y ) y->change_curve_mode(cfg.mode);
+ if( z ) z->change_curve_mode(cfg.mode);
gui->update();
gui->update_preview();
{
int x = 10, y = 10, x1;
Track *track = mwindow->cwindow->calculate_affected_track();
- FloatAuto *x_auto = 0;
- FloatAuto *y_auto = 0;
- FloatAuto *z_auto = 0;
+ FloatAuto *x_auto = 0, *y_auto = 0, *z_auto = 0;
BC_Title *title;
BC_Button *button;
lock_window("CWindowCameraGUI::create_objects");
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- &y_auto, &z_auto, track, 1, 0, 0, 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, &y_auto, &z_auto, 1, 0, 0, 0);
}
add_subwindow(title = new BC_Title(x, y, "X:"));
void CWindowCameraGUI::update_preview()
{
- mwindow->gui->lock_window("CWindowCameraGUI::update_preview");
- mwindow->restart_brender();
- mwindow->gui->draw_overlays(1);
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->gui->unlock_window();
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- mwindow->cwindow->gui->lock_window("CWindowCameraGUI::update_preview");
- mwindow->cwindow->gui->canvas->draw_refresh();
- mwindow->cwindow->gui->unlock_window();
+ CWindowGUI *cgui = mwindow->cwindow->gui;
+ cgui->lock_window("CWindowCameraGUI::update_preview");
+ cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
+ cgui->unlock_window();
}
FloatAuto *y_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
-
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- &y_auto,
- &z_auto,
- track,
- 1,
- 0,
- 0,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, &y_auto, &z_auto, 1, 0, 0, 0);
}
if(x_auto)
FloatAuto *x_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- 0,
- &z_auto,
- track,
- 1,
- 1,
- 0,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, 0, &z_auto, 1, 1, 0, 0);
}
if(x_auto && z_auto)
FloatAuto *x_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- 0,
- &z_auto,
- track,
- 1,
- 1,
- 0,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, 0, &z_auto, 1, 1, 0, 0);
}
if(x_auto && z_auto)
FloatAuto *y_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(0,
- &y_auto,
- &z_auto,
- track,
- 1,
- 0,
- 1,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ 0, &y_auto, &z_auto, 1, 0, 1, 0);
}
if(y_auto && z_auto)
FloatAuto *y_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(0,
- &y_auto,
- &z_auto,
- track,
- 1,
- 0,
- 1,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ 0, &y_auto, &z_auto, 1, 0, 1, 0);
}
if(y_auto && z_auto)
BC_Button *button;
lock_window("CWindowProjectorGUI::create_objects");
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- &y_auto,
- &z_auto,
- track,
- 0,
- 0,
- 0,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, &y_auto, &z_auto, 0, 0, 0, 0);
}
add_subwindow(title = new BC_Title(x, y, "X:"));
void CWindowProjectorGUI::update_preview()
{
- mwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- mwindow->cwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
- mwindow->cwindow->gui->canvas->draw_refresh();
- mwindow->cwindow->gui->unlock_window();
+ CWindowGUI *cgui = mwindow->cwindow->gui;
+ cgui->lock_window("CWindowProjectorGUI::update_preview");
+ cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
+ cgui->unlock_window();
}
void CWindowProjectorGUI::handle_event()
FloatAuto *y_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
-
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- &y_auto,
- &z_auto,
- track,
- 0,
- 0,
- 0,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, &y_auto, &z_auto, 0, 0, 0, 0);
}
if(x_auto)
FloatAuto *x_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- 0,
- &z_auto,
- track,
- 0,
- 1,
- 0,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, 0, &z_auto, 0, 1, 0, 0);
}
if(x_auto && z_auto)
{
FloatAuto *x_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(&x_auto,
- 0,
- &z_auto,
- track,
- 0,
- 1,
- 0,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ &x_auto, 0, &z_auto, 0, 1, 0, 0);
}
if(x_auto && z_auto)
FloatAuto *y_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(0,
- &y_auto,
- &z_auto,
- track,
- 0,
- 0,
- 1,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ 0, &y_auto, &z_auto, 0, 0, 1, 0);
}
if(y_auto && z_auto)
FloatAuto *y_auto = 0;
FloatAuto *z_auto = 0;
Track *track = mwindow->cwindow->calculate_affected_track();
- if(track)
- {
- mwindow->cwindow->calculate_affected_autos(0,
- &y_auto,
- &z_auto,
- track,
- 0,
- 0,
- 1,
- 0);
+ if( track ) {
+ mwindow->cwindow->calculate_affected_autos(track,
+ 0, &y_auto, &z_auto, 0, 0, 1, 0);
}
if(y_auto && z_auto)
}
-CWindowMaskMode::CWindowMaskMode(MWindow *mwindow,
+CWindowMaskName::CWindowMaskName(MWindow *mwindow,
CWindowToolGUI *gui, int x, int y, const char *text)
- : BC_PopupMenu(x, y, 220, text, 1)
+ : BC_PopupTextBox(gui, 0, text, x, y, 100, 160)
{
this->mwindow = mwindow;
this->gui = gui;
}
-void CWindowMaskMode::create_objects()
+CWindowMaskName::~CWindowMaskName()
{
- add_item(new BC_MenuItem(mode_to_text(MASK_MULTIPLY_ALPHA)));
- add_item(new BC_MenuItem(mode_to_text(MASK_SUBTRACT_ALPHA)));
}
-char* CWindowMaskMode::mode_to_text(int mode)
+int CWindowMaskName::handle_event()
{
- switch(mode)
- {
- case MASK_MULTIPLY_ALPHA:
- return _("Multiply alpha");
- break;
-
- case MASK_SUBTRACT_ALPHA:
- return _("Subtract alpha");
- break;
+ Track *track;
+ MaskAutos *autos;
+ MaskAuto *keyframe;
+ SubMask *mask;
+ MaskPoint *point;
+//printf("CWindowMaskGUI::update 1\n");
+ ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+ if( track ) {
+ int k = get_number();
+ if( k < 0 ) k = mwindow->edl->session->cwindow_mask;
+ else mwindow->edl->session->cwindow_mask = k;
+ if( k >= 0 && k < mask_items.size() ) {
+ mask_items[k]->set_text(get_text());
+ update_list(&mask_items);
+ }
+#ifdef USE_KEYFRAME_SPANNING
+ MaskAuto temp_keyframe(mwindow->edl, autos);
+ temp_keyframe.copy_data(keyframe);
+ SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
+ memset(submask->name, 0, sizeof(submask->name));
+ strncpy(submask->name, get_text(), sizeof(submask->name)-1);
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->update_parameter(&temp_keyframe);
+#else
+ for(MaskAuto *current = (MaskAuto*)autos->default_auto; current; ) {
+ SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask);
+ memset(submask->name, 0, sizeof(submask->name));
+ strncpy(submask->name, get_text(), sizeof(submask->name));
+ current = current == (MaskAuto*)autos->default_auto ?
+ (MaskAuto*)autos->first : (MaskAuto*)NEXT;
+ }
+#endif
+ gui->update();
+ gui->update_preview();
}
-
- return _("Subtract alpha");
+ return 1;
}
-int CWindowMaskMode::text_to_mode(char *text)
+void CWindowMaskName::update_items(MaskAuto *keyframe)
{
- if(!strcasecmp(text, _("Multiply alpha")))
- return MASK_MULTIPLY_ALPHA;
- else
- if(!strcasecmp(text, _("Subtract alpha")))
- return MASK_SUBTRACT_ALPHA;
+ mask_items.remove_all_objects();
+ int sz = keyframe->masks.size();
+ for( int i=0; i<sz; ++i ) {
+ SubMask *sub_mask = keyframe->masks.get(i);
+ char *text = sub_mask->name;
+ mask_items.append(new BC_ListBoxItem(text));
+ }
+ update_list(&mask_items);
+}
- return MASK_SUBTRACT_ALPHA;
+
+CWindowMaskDelMask::CWindowMaskDelMask(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y)
+ : BC_GenericButton(x, y, _("Delete"))
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Delete mask"));
}
-int CWindowMaskMode::handle_event()
+int CWindowMaskDelMask::handle_event()
{
MaskAutos *autos;
MaskAuto *keyframe;
Track *track;
MaskPoint *point;
SubMask *mask;
+ int total_points;
+
// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
- if(track)
- {
- mwindow->undo->update_undo_before(_("mask mode"), 0);
+
+ if( track ) {
+ mwindow->undo->update_undo_before(_("mask delete"), 0);
+
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
MaskAuto temp_keyframe(mwindow->edl, autos);
temp_keyframe.copy_data(keyframe);
-// Update parameter
- temp_keyframe.mode = text_to_mode(get_text());
+ SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
+ submask->points.remove_all_objects();
+ total_points = 0;
// Commit change to span of keyframes
- autos->update_parameter(&temp_keyframe);
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->update_parameter(&temp_keyframe);
#else
- ((MaskAuto*)autos->default_auto)->mode =
- text_to_mode(get_text());
+ for(MaskAuto *current = (MaskAuto*)autos->default_auto; current; ) {
+ SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask);
+ submask->points.clear();
+ current = current == (MaskAuto*)autos->default_auto ?
+ (MaskAuto*)autos->first : (MaskAuto*)NEXT;
+ }
+ total_points = 0;
#endif
- mwindow->undo->update_undo_after(_("mask mode"), LOAD_AUTOMATION);
+ if( mwindow->cwindow->gui->affected_point >= total_points )
+ mwindow->cwindow->gui->affected_point =
+ total_points > 0 ? total_points-1 : 0;
+
+ gui->update();
+ gui->update_preview();
+ mwindow->undo->update_undo_after(_("mask delete"), LOAD_AUTOMATION);
}
-//printf("CWindowMaskMode::handle_event 1\n");
- gui->update_preview();
return 1;
}
-
-
-
-
-
-
-
-CWindowMaskDelete::CWindowMaskDelete(MWindow *mwindow,
- CWindowToolGUI *gui,
- int x,
- int y)
+CWindowMaskDelPoint::CWindowMaskDelPoint(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y)
: BC_GenericButton(x, y, _("Delete"))
{
this->mwindow = mwindow;
this->gui = gui;
+ set_tooltip(_("Delete point"));
}
-int CWindowMaskDelete::handle_event()
+int CWindowMaskDelPoint::handle_event()
{
MaskAutos *autos;
MaskAuto *keyframe;
Track *track;
MaskPoint *point;
SubMask *mask;
- int total_points = 0;
+ int total_points;
// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
-
- if(track)
- {
- mwindow->undo->update_undo_before(_("mask delete"), 0);
+ if( track ) {
+ mwindow->undo->update_undo_before(_("point delete"), 0);
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
temp_keyframe.copy_data(keyframe);
// Update parameter
SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
- if( shift_down() )
- submask->points.remove_all_objects();
-
- for(int i = mwindow->cwindow->gui->affected_point;
- i < submask->points.total - 1;
- i++)
- {
- *submask->points.values[i] = *submask->points.values[i + 1];
- }
-
- if(submask->points.total)
- {
- submask->points.remove_object(
- submask->points.values[submask->points.total - 1]);
+ int i = mwindow->cwindow->gui->affected_point;
+ for( ; i<submask->points.total-1; ++i )
+ *submask->points.values[i] = *submask->points.values[i+1];
+ if( submask->points.total > 0 ) {
+ point = submask->points.values[submask->points.total-1];
+ submask->points.remove_object(point);
}
total_points = submask->points.total;
// Commit change to span of keyframes
((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->update_parameter(&temp_keyframe);
#else
- for(MaskAuto *current = (MaskAuto*)autos->default_auto;
- current; )
- {
+ MaskAuto *current = (MaskAuto*)autos->default_auto;
+ while( current ) {
SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask);
- if( shift_down() )
- submask->points.remove_all_objects();
-
- for(int i = mwindow->cwindow->gui->affected_point;
- i < submask->points.total - 1;
- i++)
- {
- *submask->points.values[i] = *submask->points.values[i + 1];
- }
-
- if(submask->points.total)
- {
- submask->points.remove_object(
- submask->points.values[submask->points.total - 1]);
+ int i = mwindow->cwindow->gui->affected_point;
+ for( ; i<submask->points.total-1; ++i ) {
+ *submask->points.values[i] = *submask->points.values[i+1];
+ if( submask->points.total > 0 ) {
+ point = submask->points.values[submask->points.total-1];
+ submask->points.remove_object(point);
}
total_points = submask->points.total;
-
- if(current == (MaskAuto*)autos->default_auto)
- current = (MaskAuto*)autos->first;
- else
- current = (MaskAuto*)NEXT;
+ current = current == (MaskAuto*)autos->default_auto ?
+ (MaskAuto*)autos->first : (MaskAuto*)NEXT;
}
#endif
if( mwindow->cwindow->gui->affected_point >= total_points )
mwindow->undo->update_undo_after(_("mask delete"), LOAD_AUTOMATION);
}
-
return 1;
}
-int CWindowMaskDelete::keypress_event()
+int CWindowMaskDelPoint::keypress_event()
{
- if(get_keypress() == BACKSPACE ||
- get_keypress() == DELETE)
+ if( get_keypress() == BACKSPACE ||
+ get_keypress() == DELETE )
return handle_event();
return 0;
}
-// CWindowMaskCycleNext::CWindowMaskCycleNext(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
-// : BC_GenericButton(x, y, _("Cycle next"))
-// {
-// this->mwindow = mwindow;
-// this->gui = gui;
-// }
-// int CWindowMaskCycleNext::handle_event()
-// {
-// MaskAuto *keyframe;
-// MaskAutos *autos;
-// Track *track;
-// MaskPoint *point;
-// SubMask *mask;
-// ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
-//
-// MaskPoint *temp;
-//
-// // Should apply to all keyframes
-// if(keyframe && mask->points.total)
-// {
-// temp = mask->points.values[0];
-//
-// for(int i = 0; i < mask->points.total - 1; i++)
-// {
-// mask->points.values[i] = mask->points.values[i + 1];
-// }
-// mask->points.values[mask->points.total - 1] = temp;
-//
-// mwindow->cwindow->gui->affected_point--;
-// if(mwindow->cwindow->gui->affected_point < 0)
-// mwindow->cwindow->gui->affected_point = mask->points.total - 1;
-//
-// gui->update();
-// gui->update_preview();
-// }
-//
-// return 1;
-// }
-//
-// CWindowMaskCyclePrev::CWindowMaskCyclePrev(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
-// : BC_GenericButton(x, y, _("Cycle prev"))
-// {
-// this->mwindow = mwindow;
-// this->gui = gui;
-// }
-// int CWindowMaskCyclePrev::handle_event()
-// {
-// MaskAuto *keyframe;
-// MaskAutos *autos;
-// Track *track;
-// MaskPoint *point;
-// SubMask *mask;
-// ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
-//
-// // Should apply to all keyframes
-// MaskPoint *temp;
-// if(keyframe && mask->points.total)
-// {
-// temp = mask->points.values[mask->points.total - 1];
-//
-// for(int i = mask->points.total - 1; i > 0; i--)
-// {
-// mask->points.values[i] = mask->points.values[i - 1];
-// }
-// mask->points.values[0] = temp;
-//
-// mwindow->cwindow->gui->affected_point++;
-// if(mwindow->cwindow->gui->affected_point >= mask->points.total)
-// mwindow->cwindow->gui->affected_point = 0;
-//
-// gui->update();
-// gui->update_preview();
-// }
-// return 1;
-// }
-
-
-CWindowMaskNumber::CWindowMaskNumber(MWindow *mwindow,
- CWindowToolGUI *gui,
- int x,
- int y)
- : BC_TumbleTextBox(gui,
- (int64_t)mwindow->edl->session->cwindow_mask,
- (int64_t)0,
- (int64_t)SUBMASKS - 1,
- x,
- y,
- 100)
-{
- this->mwindow = mwindow;
- this->gui = gui;
-}
-
-CWindowMaskNumber::~CWindowMaskNumber()
-{
-}
-
-int CWindowMaskNumber::handle_event()
-{
- mwindow->edl->session->cwindow_mask = atol(get_text());
- gui->update();
- gui->update_preview();
- return 1;
-}
CWindowMaskAffectedPoint::CWindowMaskAffectedPoint(MWindow *mwindow,
}
+CWindowMaskFocus::CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
+ : BC_CheckBox(x, y, ((CWindowMaskGUI*)gui)->focused, _("Focus"))
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+}
+CWindowMaskFocus::~CWindowMaskFocus()
+{
+}
+int CWindowMaskFocus::handle_event()
+{
+ ((CWindowMaskGUI*)gui)->focused = get_value();
+ gui->update();
+ gui->update_preview();
+ return 1;
+}
CWindowMaskFeather::CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_TumbleTextBox(gui,
- (int64_t)0,
- (int64_t)0,
- (int64_t)0xff,
- x,
- y,
- 100)
+ : BC_TumbleTextBox(gui, 0, 0, 0xff, x, y, 64, 2)
{
this->mwindow = mwindow;
this->gui = gui;
CWindowMaskFeather::~CWindowMaskFeather()
{
}
-int CWindowMaskFeather::handle_event()
+
+int CWindowMaskFeather::update(float v)
+{
+ CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->feather_slider->update(v);
+ return BC_TumbleTextBox::update(v);
+}
+
+int CWindowMaskFeather::update_value(float v)
{
MaskAutos *autos;
MaskAuto *keyframe;
// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe,
mask, point, create_it);
-
- if(track)
- {
+ if( track ) {
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
MaskAuto temp_keyframe(mwindow->edl, autos);
temp_keyframe.copy_data(keyframe);
// Update parameter
- temp_keyframe.feather = atof(get_text());
+ temp_keyframe.feather = v;
// Commit change to span of keyframes
autos->update_parameter(&temp_keyframe);
#else
- keyframe->feather = atof(get_text());
+ keyframe->feather = v;
#endif
gui->update_preview();
return 1;
}
+int CWindowMaskFeather::handle_event()
+{
+ float v = atof(get_text());
+ CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->feather_slider->update(v);
+ return mask_gui->feather->update_value(v);
+}
+
+CWindowMaskFeatherSlider::CWindowMaskFeatherSlider(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y, int w, float v)
+ : BC_FSlider(x, y, 0, w, w, 0.f, 255.f, v)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_precision(0.01);
+}
+
+CWindowMaskFeatherSlider::~CWindowMaskFeatherSlider()
+{
+}
-CWindowMaskValue::CWindowMaskValue(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_ISlider(x,
- y,
- 0,
- 200,
- 200,
- 0,
- 100,
- 0)
+int CWindowMaskFeatherSlider::handle_event()
+{
+ float v = get_value();
+ CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->feather->update(v);
+ return mask_gui->feather->update_value(v);
+}
+
+int CWindowMaskFeatherSlider::update(float v)
+{
+ return BC_FSlider::update(v);
+}
+
+CWindowMaskFade::CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
+ : BC_TumbleTextBox(gui, 0, -100.f, 100.f, x, y, 64, 2)
{
this->mwindow = mwindow;
this->gui = gui;
}
+CWindowMaskFade::~CWindowMaskFade()
+{
+}
-CWindowMaskValue::~CWindowMaskValue()
+int CWindowMaskFade::update(float v)
{
+ CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->fade_slider->update(v);
+ return BC_TumbleTextBox::update(v);
}
-int CWindowMaskValue::handle_event()
+int CWindowMaskFade::update_value(float v)
{
MaskAutos *autos;
MaskAuto *keyframe;
int create_it = 1;
#endif
- mwindow->undo->update_undo_before(_("mask value"), this);
+ mwindow->undo->update_undo_before(_("mask fade"), this);
+
+// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe,
- mask, point, create_it);
+ mask, point, create_it);
+ if( track ) {
+#ifdef USE_KEYFRAME_SPANNING
+// Create temp keyframe
+ MaskAuto temp_keyframe(mwindow->edl, autos);
+ temp_keyframe.copy_data(keyframe);
+// Update parameter
+ temp_keyframe.value = v;
+// Commit change to span of keyframes
+ autos->update_parameter(&temp_keyframe);
+#else
+ keyframe->value = v;
+#endif
- if(track)
- {
+ gui->update_preview();
+ }
+
+ mwindow->undo->update_undo_after(_("mask fade"), LOAD_AUTOMATION);
+ return 1;
+}
+
+int CWindowMaskFade::handle_event()
+{
+ float v = atof(get_text());
+ CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->fade_slider->update(v);
+ return mask_gui->fade->update_value(v);
+}
+
+CWindowMaskFadeSlider::CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
+ int x, int y, int w)
+ : BC_ISlider(x, y, 0, w, w, -200, 200, 0)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ timer = new Timer();
+ stick = 0;
+}
+
+CWindowMaskFadeSlider::~CWindowMaskFadeSlider()
+{
+ delete timer;
+}
+
+int CWindowMaskFadeSlider::handle_event()
+{
+ float v = 100*get_value()/200;
+ if( !v && !stick )
+ stick = 16;
+ else if( stick > 0 ) {
+ int64_t ms = timer->get_difference();
+ if( ms < 1000 ) {
+ --stick;
+ if( get_value() == 0 ) return 1;
+ update(v = 0);
+ }
+ else
+ stick = 0;
+ }
+ timer->update();
+ CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->fade->BC_TumbleTextBox::update(v);
+ return mask_gui->fade->update_value(v);
+}
+
+int CWindowMaskFadeSlider::update(int64_t v)
+{
+ return BC_ISlider::update(200*v/100);
+}
+
+CWindowMaskMode::CWindowMaskMode(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y)
+ : BC_Toggle(x, y, mwindow->theme->mask_mode_toggle, 0)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Subtract/Multiply Alpha"));
+}
+
+CWindowMaskMode::~CWindowMaskMode()
+{
+}
+
+int CWindowMaskMode::handle_event()
+{
+ MaskAutos *autos;
+ MaskAuto *keyframe;
+ Track *track;
+ MaskPoint *point;
+ SubMask *mask;
+// Get existing keyframe
+ ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+ if( track ) {
+ mwindow->undo->update_undo_before(_("mask mode"), 0);
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
MaskAuto temp_keyframe(mwindow->edl, autos);
temp_keyframe.copy_data(keyframe);
// Update parameter
- temp_keyframe.value = get_value();
+ temp_keyframe.mode = get_value();
// Commit change to span of keyframes
autos->update_parameter(&temp_keyframe);
#else
- keyframe->value = get_value();
+ ((MaskAuto*)autos->default_auto)->mode = get_value();
#endif
+ mwindow->undo->update_undo_after(_("mask mode"), LOAD_AUTOMATION);
}
+//printf("CWindowMaskMode::handle_event 1\n");
gui->update_preview();
- mwindow->undo->update_undo_after(_("mask value"), LOAD_AUTOMATION);
return 1;
}
-
CWindowMaskBeforePlugins::CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y)
: BC_CheckBox(x,
y,
}
+CWindowMaskClrMask::CWindowMaskClrMask(MWindow *mwindow,
+ CWindowMaskGUI *gui, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("reset_button"))
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Delete all masks"));
+}
+CWindowMaskClrMask::~CWindowMaskClrMask()
+{
+}
+int CWindowMaskClrMask::calculate_w(MWindow *mwindow)
+{
+ VFrame *vfrm = *mwindow->theme->get_image_set("reset_button");
+ return vfrm->get_w();
+}
+int CWindowMaskClrMask::handle_event()
+{
+ MaskAutos *autos;
+ MaskAuto *keyframe;
+ Track *track;
+ MaskPoint *point;
+ SubMask *mask;
+
+// Get existing keyframe
+ ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+
+ if( track ) {
+ mwindow->undo->update_undo_before(_("del masks"), 0);
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->clear_all();
+ gui->update();
+ gui->update_preview();
+ mwindow->undo->update_undo_after(_("del masks"), LOAD_AUTOMATION);
+ }
+ return 1;
+}
+
+CWindowMaskClrFeather::CWindowMaskClrFeather(MWindow *mwindow,
+ CWindowMaskGUI *gui, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("reset_button"))
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Zero Feather"));
+}
+CWindowMaskClrFeather::~CWindowMaskClrFeather()
+{
+}
+int CWindowMaskClrFeather::handle_event()
+{
+ float v = 0;
+ CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->feather->update(v);
+ mask_gui->feather_slider->update(v);
+ return mask_gui->feather->update_value(v);
+}
CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread)
: CWindowToolGUI(mwindow, thread,
- _(PROGRAM_NAME ": Mask"), 330, 320)
+ _(PROGRAM_NAME ": Mask"), 360, 440)
{
this->mwindow = mwindow;
this->thread = thread;
- number = 0;
active_point = 0;
+ fade = 0;
feather = 0;
+ focused = 0;
}
CWindowMaskGUI::~CWindowMaskGUI()
{
lock_window("CWindowMaskGUI::~CWindowMaskGUI");
- delete number;
delete active_point;
+ delete fade;
delete feather;
unlock_window();
}
void CWindowMaskGUI::create_objects()
{
int x = 10, y = 10, margin = mwindow->theme->widget_border;
+ int clr_x = get_w()-x - CWindowMaskClrMask::calculate_w(mwindow);
+ int del_x = clr_x-margin - CWindowMaskDelMask::calculate_w(this,_("Delete"));
//MaskAuto *keyframe = 0;
//Track *track = mwindow->cwindow->calculate_affected_track();
//if(track)
lock_window("CWindowMaskGUI::create_objects");
BC_Title *title;
- add_subwindow(title = new BC_Title(x, y, _("Mode:")));
- add_subwindow(mode = new CWindowMaskMode(mwindow,
- this, x + title->get_w() + margin, y, ""));
- mode->create_objects();
- y += mode->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Value:")));
- add_subwindow(value = new CWindowMaskValue(mwindow, this, x + title->get_w() + margin, y));
- y += value->get_h() + margin;
- add_subwindow(delete_point = new CWindowMaskDelete(mwindow, this, x, y));
- int x1 = x + delete_point->get_w() + 2*margin;
- add_subwindow(title = new BC_Title(x1, y, _("Point:")));
- x1 += title->get_w() + margin;
- active_point = new CWindowMaskAffectedPoint(mwindow, this, x1, y);
- active_point->create_objects();
- y += delete_point->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Mask number:")));
- number = new CWindowMaskNumber(mwindow,
- this, x + title->get_w() + margin, y);
- number->create_objects();
- y += number->get_h() + margin;
+ add_subwindow(title = new BC_Title(x, y, _("Mask:")));
+ int x1 = x + 70;
+ name = new CWindowMaskName(mwindow, this, x1, y, "");
+ name->create_objects();
+ add_subwindow(clr_mask = new CWindowMaskClrMask(mwindow, this, clr_x, y));
+ add_subwindow(del_mask = new CWindowMaskDelMask(mwindow, this, del_x, y));
+ y += name->get_h() + margin;
+ add_subwindow(title = new BC_Title(x, y, _("Fade:")));
+ fade = new CWindowMaskFade(mwindow, this, x1, y);
+ fade->create_objects();
+ int x2 = x1 + fade->get_w() + 2*margin;
+ int w2 = clr_x-2*margin - x2;
+ add_subwindow(fade_slider = new CWindowMaskFadeSlider(mwindow, this, x2, y, w2));
+ add_subwindow(mode = new CWindowMaskMode(mwindow, this, clr_x, y));
+ y += fade->get_h() + margin;
add_subwindow(title = new BC_Title(x, y, _("Feather:")));
- feather = new CWindowMaskFeather(mwindow,
- this, x + title->get_w() + margin, y);
+ feather = new CWindowMaskFeather(mwindow, this, x1, y);
feather->create_objects();
- y += feather->get_h() + margin;
+ x2 = x1 + feather->get_w() + margin;
+ w2 = clr_x - 2*margin - x2;
+ feather_slider = new CWindowMaskFeatherSlider(mwindow, this, x2, y, w2, 0);
+ add_subwindow(feather_slider);
+ add_subwindow(new CWindowMaskClrFeather(mwindow, this, clr_x, y));
+ y += feather->get_h() + 3*margin;
+
+ add_subwindow(title = new BC_Title(x, y, _("Point:")));
+ active_point = new CWindowMaskAffectedPoint(mwindow, this, x1, y);
+ active_point->create_objects();
+ add_subwindow(del_point = new CWindowMaskDelPoint(mwindow, this, del_x, y));
+ y += active_point->get_h() + margin;
add_subwindow(title = new BC_Title(x, y, "X:"));
- x += title->get_w() + margin;
- this->x = new CWindowCoord(this, x, y, (float)0.0);
+ this->x = new CWindowCoord(this, x1, y, (float)0.0);
this->x->create_objects();
- x += this->x->get_w() + margin;
+ y += this->x->get_h() + margin;
add_subwindow(title = new BC_Title(x, y, "Y:"));
- x += title->get_w() + margin;
- this->y = new CWindowCoord(this, x, y, (float)0.0);
+ this->y = new CWindowCoord(this, x1, y, (float)0.0);
this->y->create_objects();
-
- x = 10;
y += this->y->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Press Shift to move an end point")));
- y += title->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Press Ctrl to move a control point")));
- y += title->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Shift+click Delete to delete the mask")));
- y += title->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Press Alt to translate the mask")));
- y += 30;
+ BC_Bar *bar;
+ add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x));
+ y += bar->get_h() + margin;
+ add_subwindow(title = new BC_Title(x, y, "X:"));
+ focus_x = new CWindowCoord(this, x1, y, (float)0.0);
+ focus_x->create_objects();
+ add_subwindow(focus = new CWindowMaskFocus(mwindow, this, del_x, y));
+ y += focus_x->get_h() + margin;
+ add_subwindow(title = new BC_Title(x, y, "Y:"));
+ focus_y = new CWindowCoord(this, x1, y, (float)0.0);
+ focus_y->create_objects();
+ y += focus_x->get_h() + margin;
add_subwindow(this->apply_before_plugins = new CWindowMaskBeforePlugins(this, 10, y));
- y += this->apply_before_plugins->get_h() + margin;
+ y += this->apply_before_plugins->get_h();
add_subwindow(this->disable_opengl_masking = new CWindowDisableOpenGLMasking(this, 10, y));
-
+ y += this->disable_opengl_masking->get_h() + margin;
+ add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x));
+ y += bar->get_h() + margin;
+
+ y += margin;
+ add_subwindow(title = new BC_Title(x, y, _(
+ "Shift+LMB: move an end point\n"
+ "Ctrl+LMB: move a control point\n"
+ "Alt+LMB: to drag translate the mask\n"
+ "Shift+Key Delete to delete the mask\n"
+ "Wheel Up/Dn: rotate around pointer\n"
+ "Shift+Wheel Up/Dn: scale around pointer\n"
+ "Shift+MMB: Toggle focus center at pointer")));
update();
unlock_window();
}
if(mask)
{
- feather->update((int64_t)autos->get_feather(position_i, PLAY_FORWARD));
- value->update((int64_t)autos->get_value(position_i, PLAY_FORWARD));
- apply_before_plugins->update((int64_t)keyframe->apply_before_plugins);
- disable_opengl_masking->update((int64_t)keyframe->disable_opengl_masking);
+ feather->update(autos->get_feather(position_i, PLAY_FORWARD));
+ fade->update(autos->get_value(position_i, PLAY_FORWARD));
+ apply_before_plugins->update(keyframe->apply_before_plugins);
+ disable_opengl_masking->update(keyframe->disable_opengl_masking);
}
}
//printf("CWindowMaskGUI::update 1\n");
active_point->update((int64_t)mwindow->cwindow->gui->affected_point);
- number->update((int64_t)mwindow->edl->session->cwindow_mask);
+ const char *text = "";
+ if( keyframe ) {
+ name->update_items(keyframe);
+ int k = mwindow->edl->session->cwindow_mask;
+ if( k >= 0 && k < keyframe->masks.size() )
+ text = keyframe->masks[k]->name;
+ }
+ name->update(text);
//printf("CWindowMaskGUI::update 1\n");
- if(track)
- {
+ if( track ) {
#ifdef USE_KEYFRAME_SPANNING
- mode->set_text(
- CWindowMaskMode::mode_to_text(keyframe->mode));
+ mode->update(keyframe->mode);
#else
- mode->set_text(
- CWindowMaskMode::mode_to_text(((MaskAuto*)autos->default_auto)->mode));
+ mode->set_text(((MaskAuto*)autos->default_auto)->mode);
#endif
}
//printf("CWindowMaskGUI::update 2\n");
void CWindowMaskGUI::update_preview()
{
- mwindow->gui->lock_window("CWindowMaskGUI::update_preview");
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- mwindow->cwindow->gui->lock_window("CWindowMaskGUI::update_preview");
- mwindow->cwindow->gui->canvas->draw_refresh();
- mwindow->cwindow->gui->unlock_window();
+ unlock_window();
+ CWindowGUI *cgui = mwindow->cwindow->gui;
+ cgui->lock_window("CWindowMaskGUI::update_preview");
+ cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
+ cgui->unlock_window();
+ lock_window("CWindowMaskGUI::update_preview");
}
+void CWindowMaskGUI::set_focused(int v, float cx, float cy)
+{
+ focus_x->update(cx);
+ focus_y->update(cy);
+ focus->update(focused = v);
+}
CWindowRulerGUI::CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread)
: CWindowToolGUI(mwindow,