load fn from resources, del kfrm speed update, svg exec cmd/file win fixes, undo...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / keyframepopup.C
index 293e1852054753d3a91167d0f6e21880ec5fad8c..cef8b2701a62e2aaeaba0f724d493f3426242d65 100644 (file)
@@ -2,21 +2,21 @@
 /*
  * CINELERRA
  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  */
 
 #include "apatchgui.h"
@@ -25,7 +25,7 @@
 #include "autos.h"
 #include "bcwindowbase.h"
 #include "cpanel.h"
-#include "cwindowgui.h" 
+#include "cwindowgui.h"
 #include "cwindow.h"
 #include "edl.h"
 #include "edlsession.h"
@@ -44,7 +44,7 @@
 #include "mwindowgui.h"
 #include "mwindow.h"
 #include "patchbay.h"
-#include "patchgui.h" 
+#include "patchgui.h"
 #include "timelinepane.h"
 #include "track.h"
 #include "vtrack.h"
@@ -125,7 +125,7 @@ int KeyframePopup::update(Automation *automation, Autos *autos, Auto *auto_keyfr
                mwindow->edl->local_session->set_selectionstart(new_position);
                mwindow->edl->local_session->set_selectionend(new_position);
                mwindow->gui->lock_window();
-               mwindow->gui->update(1, 1, 1, 1, 1, 1, 0);      
+               mwindow->gui->update(1, 1, 1, 1, 1, 1, 0);
                mwindow->gui->unlock_window();
        }
        return 0;
@@ -187,7 +187,9 @@ KeyframePopupDelete::~KeyframePopupDelete()
 int KeyframePopupDelete::handle_event()
 {
        mwindow->undo->update_undo_before(_("delete keyframe"), 0);
+       mwindow->speed_before();
        delete popup->keyframe_auto;
+       mwindow->speed_after(1);
        mwindow->undo->update_undo_after(_("delete keyframe"), LOAD_ALL);
 
        mwindow->save_backup();
@@ -229,22 +231,6 @@ KeyframePopupShow::~KeyframePopupShow()
 {
 }
 
-PatchGUI *KeyframePopupShow::get_patchgui(Track *track)
-{
-       PatchGUI *patchgui = 0;
-       TimelinePane **panes = mwindow->gui->pane;
-       for( int i=0; i<TOTAL_PANES && !patchgui; ++i ) {
-               if( !panes[i] ) continue;
-               PatchBay *patchbay = panes[i]->patchbay;
-               if( !patchbay ) continue;
-               for( int j=0; j<patchbay->patches.total && !patchgui; ++j ) {
-                       if( patchbay->patches.values[j]->track == track )
-                               patchgui = patchbay->patches.values[j];
-               }
-       }
-       return patchgui;
-}
-
 int KeyframePopupShow::handle_event()
 {
        MWindowGUI *mgui = mwindow->gui;
@@ -271,7 +257,7 @@ int KeyframePopupShow::handle_event()
                case AUTOMATION_PROJECTOR_X:
                case AUTOMATION_PROJECTOR_Y:
                case AUTOMATION_PROJECTOR_Z: {
-                       cgui->set_operation(CWINDOW_PROJECTOR); 
+                       cgui->set_operation(CWINDOW_PROJECTOR);
                        break; }
 
                case AUTOMATION_MASK: {
@@ -280,7 +266,7 @@ int KeyframePopupShow::handle_event()
 
                default: {
                        show_window = 0;
-                       PatchGUI *patchgui = get_patchgui(popup->keyframe_automation->track);
+                       PatchGUI *patchgui = mwindow->get_patchgui(popup->keyframe_automation->track);
                        if( !patchgui ) break;
 
                        switch( popup->keyframe_autos->autoidx ) {
@@ -438,9 +424,7 @@ int KeyframePopupCopy::handle_event()
                file.terminate_string();
 
                mwindow->gui->lock_window();
-               mwindow->gui->get_clipboard()->to_clipboard(file.string, 
-                       strlen(file.string), 
-                       SECONDARY_SELECTION);
+               mwindow->gui->to_clipboard(file.string, strlen(file.string), SECONDARY_SELECTION);
                mwindow->gui->unlock_window();
 
        } else
@@ -452,8 +436,8 @@ int KeyframePopupCopy::handle_event()
 
 
 KeyframePopupCurveMode::KeyframePopupCurveMode(
-       MWindow *mwindow, 
-       KeyframePopup *popup, 
+       MWindow *mwindow,
+       KeyframePopup *popup,
        int curve_mode)
  : BC_MenuItem( get_labeltext(curve_mode))
 {
@@ -485,18 +469,18 @@ void KeyframePopupCurveMode::toggle_mode(FloatAuto *keyframe)
 
 int KeyframePopupCurveMode::handle_event()
 {
-       if (popup->keyframe_autos && 
+       if (popup->keyframe_autos &&
            popup->keyframe_autos->get_type() == AUTOMATION_TYPE_FLOAT)
        {
                mwindow->undo->update_undo_before(_("change keyframe curve mode"), 0);
                ((FloatAuto*)popup->keyframe_auto)->
                        change_curve_mode((FloatAuto::t_mode)curve_mode);
-               
+
                // if we switched to some "auto" mode, this may imply a
                // real change to parameters, so this needs to be undoable...
                mwindow->undo->update_undo_after(_("change keyframe curve mode"), LOAD_ALL);
                mwindow->save_backup();
-               
+
                mwindow->gui->update(0, 1, 0,0,0,0,0); // incremental redraw for canvas
                mwindow->cwindow->update(0,0, 1, 0,0); // redraw tool window in compositor
                mwindow->update_plugin_guis();
@@ -640,6 +624,7 @@ KeySpeedValue::KeySpeedValue(KeySpeedPatch *key_speed_patch)
        key_speed_patch->mwindow->get_float_auto(key_speed_patch->patch, AUTOMATION_SPEED)->get_value())
 {
        this->key_speed_patch = key_speed_patch;
+       key_speed_patch->mwindow->speed_before();
        set_precision(0.01);
 }
 
@@ -650,6 +635,8 @@ KeySpeedValue::~KeySpeedValue()
 int KeySpeedValue::button_release_event()
 {
        BC_FSlider::button_release_event();
+       key_speed_patch->mwindow->speed_after(1);
+       key_speed_patch->mwindow->resync_guis();
        return 0;
 }
 
@@ -663,7 +650,7 @@ void KeySpeedValue::update_edl()
        mwindow->undo->update_undo_before(_("speed"), need_undo ? 0 : this);
        FloatAuto *current = (FloatAuto*)speed_autos->get_auto_for_editing(position);
        current->set_value(get_value());
-       mwindow->undo->update_undo_after(_("speed"), LOAD_AUTOMATION);
+       mwindow->undo->update_undo_after(_("speed"), LOAD_AUTOMATION+LOAD_EDITS);
 }
 
 int KeySpeedValue::handle_event()