00001 #include "cwindow.h"
00002 #include "edl.h"
00003 #include "keyframe.h"
00004 #include "keyframepopup.h"
00005 #include "language.h"
00006 #include "mainundo.h"
00007 #include "mwindow.h"
00008 #include "mwindowgui.h"
00009 #include "localsession.h"
00010 #include "cwindowgui.h"
00011 #include "cpanel.h"
00012 #include "patchbay.h"
00013 #include "patchgui.h"
00014 #include "apatchgui.h"
00015 #include "vpatchgui.h"
00016 #include "track.h"
00017 #include "maincursor.h"
00018 #include "bcwindowbase.h"
00019 #include "filexml.h"
00020 #include "edlsession.h"
00021 #include "autoconf.h"
00022
00023 KeyframePopup::KeyframePopup(MWindow *mwindow, MWindowGUI *gui)
00024 : BC_PopupMenu(0,
00025 0,
00026 0,
00027 "",
00028 0)
00029 {
00030 this->mwindow = mwindow;
00031 this->gui = gui;
00032 key_show = 0;
00033 key_delete = 0;
00034 key_copy = 0;
00035 }
00036
00037 KeyframePopup::~KeyframePopup()
00038 {
00039 }
00040
00041 void KeyframePopup::create_objects()
00042 {
00043 add_item(key_show = new KeyframePopupShow(mwindow, this));
00044 add_item(key_delete = new KeyframePopupDelete(mwindow, this));
00045 add_item(key_copy = new KeyframePopupCopy(mwindow, this));
00046 }
00047
00048 int KeyframePopup::update(Plugin *plugin, KeyFrame *keyframe)
00049 {
00050 this->keyframe_plugin = plugin;
00051 this->keyframe_auto = keyframe;
00052 this->keyframe_autos = 0;
00053 this->keyframe_automation = 0;
00054 return 0;
00055 }
00056
00057 int KeyframePopup::update(Automation *automation, Autos *autos, Auto *auto_keyframe)
00058 {
00059 this->keyframe_plugin = 0;
00060 this->keyframe_automation = automation;
00061 this->keyframe_autos = autos;
00062 this->keyframe_auto = auto_keyframe;
00063
00064
00065 double current_position = mwindow->edl->local_session->get_selectionstart(1);
00066 double new_position = keyframe_automation->track->from_units(keyframe_auto->position);
00067 mwindow->edl->local_session->set_selectionstart(new_position);
00068 mwindow->edl->local_session->set_selectionend(new_position);
00069 if (current_position != new_position)
00070 {
00071 mwindow->edl->local_session->set_selectionstart(new_position);
00072 mwindow->edl->local_session->set_selectionend(new_position);
00073 mwindow->gui->lock_window();
00074 mwindow->gui->update(1, 1, 1, 1, 1, 1, 0);
00075 mwindow->gui->unlock_window();
00076 }
00077 return 0;
00078 }
00079
00080 KeyframePopupDelete::KeyframePopupDelete(MWindow *mwindow, KeyframePopup *popup)
00081 : BC_MenuItem(_("Delete keyframe"))
00082 {
00083 this->mwindow = mwindow;
00084 this->popup = popup;
00085 }
00086
00087 KeyframePopupDelete::~KeyframePopupDelete()
00088 {
00089 }
00090
00091 int KeyframePopupDelete::handle_event()
00092 {
00093 delete popup->keyframe_auto;
00094 mwindow->save_backup();
00095 mwindow->undo->update_undo(_("delete keyframe"), LOAD_ALL);
00096
00097 mwindow->gui->update(0,
00098 1,
00099 0,
00100 0,
00101 0,
00102 0,
00103 0);
00104 mwindow->update_plugin_guis();
00105 mwindow->restart_brender();
00106 mwindow->sync_parameters(CHANGE_EDL);
00107
00108 return 1;
00109 }
00110
00111 KeyframePopupShow::KeyframePopupShow(MWindow *mwindow, KeyframePopup *popup)
00112 : BC_MenuItem(_("Show keyframe settings"))
00113 {
00114 this->mwindow = mwindow;
00115 this->popup = popup;
00116 }
00117
00118 KeyframePopupShow::~KeyframePopupShow()
00119 {
00120 }
00121
00122 int KeyframePopupShow::handle_event()
00123 {
00124 if (popup->keyframe_plugin)
00125 {
00126 mwindow->update_plugin_guis();
00127 mwindow->show_plugin(popup->keyframe_plugin);
00128 } else
00129 if (popup->keyframe_automation)
00130 {
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224 }
00225 return 1;
00226 }
00227
00228
00229
00230 KeyframePopupCopy::KeyframePopupCopy(MWindow *mwindow, KeyframePopup *popup)
00231 : BC_MenuItem(_("Copy keyframe"))
00232 {
00233 this->mwindow = mwindow;
00234 this->popup = popup;
00235 }
00236
00237 KeyframePopupCopy::~KeyframePopupCopy()
00238 {
00239 }
00240
00241 int KeyframePopupCopy::handle_event()
00242 {
00243
00244
00245
00246
00247
00248
00249 #if 0
00250 if (popup->keyframe_automation)
00251 {
00252 FileXML file;
00253 EDL *edl = mwindow->edl;
00254 Track *track = popup->keyframe_automation->track;
00255 int64_t position = popup->keyframe_auto->position;
00256 AutoConf autoconf;
00257
00258 autoconf.set_all(0);
00259 if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->projector_autos)
00260 autoconf.projector = 1;
00261 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->pzoom_autos)
00262 autoconf.pzoom = 1;
00263 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->camera_autos)
00264 autoconf.camera = 1;
00265 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->czoom_autos)
00266 autoconf.czoom = 1;
00267 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mode_autos)
00268 autoconf.mode = 1;
00269 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mask_autos)
00270 autoconf.mask = 1;
00271 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->pan_autos)
00272 autoconf.pan = 1;
00273 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->fade_autos)
00274 autoconf.fade = 1;
00275 else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mute_autos)
00276 autoconf.mute = 1;
00277
00278
00279
00280 file.tag.set_title("AUTO_CLIPBOARD");
00281 file.tag.set_property("LENGTH", 0);
00282 file.tag.set_property("FRAMERATE", edl->session->frame_rate);
00283 file.tag.set_property("SAMPLERATE", edl->session->sample_rate);
00284 file.append_tag();
00285 file.append_newline();
00286 file.append_newline();
00287
00288
00289
00290
00291
00292
00293
00294 file.tag.set_title("TRACK");
00295
00296 track->save_header(&file);
00297 file.append_tag();
00298 file.append_newline();
00299
00300 track->automation->copy(position,
00301 position,
00302 &file,
00303 0,
00304 0,
00305 &autoconf);
00306
00307
00308
00309 file.tag.set_title("/TRACK");
00310 file.append_tag();
00311 file.append_newline();
00312 file.append_newline();
00313 file.append_newline();
00314 file.append_newline();
00315
00316
00317
00318 file.tag.set_title("/AUTO_CLIPBOARD");
00319 file.append_tag();
00320 file.append_newline();
00321 file.terminate_string();
00322
00323 mwindow->gui->lock_window();
00324 mwindow->gui->get_clipboard()->to_clipboard(file.string,
00325 strlen(file.string),
00326 SECONDARY_SELECTION);
00327 mwindow->gui->unlock_window();
00328
00329 } else
00330 #endif
00331 mwindow->copy_automation();
00332 return 1;
00333 }
00334
00335
00336