fix ctl-x cut, reorganize track/edit popup, pack cut fixes, paste plugin new feature...
authorGood Guy <good1.2guy@gmail.com>
Sun, 30 Dec 2018 01:57:18 +0000 (18:57 -0700)
committerGood Guy <good1.2guy@gmail.com>
Sun, 30 Dec 2018 01:57:18 +0000 (18:57 -0700)
cinelerra-5.1/cinelerra/editpopup.C
cinelerra-5.1/cinelerra/editpopup.h
cinelerra-5.1/cinelerra/editpopup.inc
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/mwindowgui.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/trackpopup.C
cinelerra-5.1/cinelerra/trackpopup.h
cinelerra-5.1/cinelerra/trackpopup.inc

index 9d943d87caf29e353c915e1f1ae69b092f383b8a..0f2c9645856e968b6ba99e21dd62199979082981 100644 (file)
@@ -38,7 +38,6 @@
 #include "mwindowgui.h"
 #include "plugindialog.h"
 #include "resizetrackthread.h"
-#include "theme.h"
 #include "track.h"
 #include "tracks.h"
 #include "trackcanvas.h"
@@ -73,10 +72,7 @@ void EditPopup::create_objects()
        add_item(new EditPopupMutePack(mwindow, this));
        add_item(new EditPopupPaste(mwindow, this));
        add_item(new EditPopupOverwrite(mwindow, this));
-       add_item(new EditPopupFindAsset(mwindow, this));
-       add_item(new EditPopupShow(mwindow, this));
-       add_item(new EditPopupUserTitle(mwindow, this));
-       add_item(new EditPopupTitleColor(mwindow, this));
+       add_item(new EditPopupOverwritePlugins(mwindow, this));
 }
 
 int EditPopup::activate_menu(Track *track, Edit *edit,
@@ -232,398 +228,26 @@ int EditPopupOverwrite::handle_event()
        return 1;
 }
 
-EditPopupFindAsset::EditPopupFindAsset(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Find in Resources"))
+EditPopupOverwritePlugins::EditPopupOverwritePlugins(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Overwrite Plugins"),_("Ctrl-Shift-P"),'P')
 {
        this->mwindow = mwindow;
        this->popup = popup;
+       set_ctrl(1);
+       set_shift(1);
 }
 
-int EditPopupFindAsset::handle_event()
-{
-       Edit *edit = popup->edit;
-       if( edit ) {
-               Indexable *idxbl = (Indexable *)edit->asset;
-               if( !idxbl ) idxbl = (Indexable *)edit->nested_edl;
-               if( idxbl ) {
-                       AWindowGUI *agui = mwindow->awindow->gui;
-                       agui->lock_window("EditPopupFindAsset::handle_event");
-                       AssetPicon *picon = 0;
-                       for( int i=0, n=agui->assets.size(); i<n; ++i ) {
-                               AssetPicon *ap = (AssetPicon *)agui->assets[i];
-                               int found = ap->indexable && ( idxbl == ap->indexable ||
-                                       !strcmp(idxbl->path, ap->indexable->path) );
-                               if( found && !picon ) picon = ap;
-                               ap->set_selected(found);
-                       }
-                       if( picon ) {
-                               int selected_folder = picon->indexable->folder_no;
-                               mwindow->edl->session->awindow_folder = selected_folder;
-                               for( int i=0,n=agui->folders.size(); i<n; ++i ) {
-                                       AssetPicon *folder_item = (AssetPicon *)agui->folders[i];
-                                       int selected = folder_item->foldernum == selected_folder ? 1 : 0;
-                                       folder_item->set_selected(selected);
-                               }
-                       }
-                       agui->unlock_window();
-                       agui->async_update_assets();
-               }
-       }
-       return 1;
-}
-
-
-EditPopupUserTitle::EditPopupUserTitle(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("User title..."))
-{
-       this->mwindow = mwindow;
-       this->popup = popup;
-       dialog_thread = new EditUserTitleDialogThread(this);
-}
-
-EditPopupUserTitle::~EditPopupUserTitle()
-{
-       delete dialog_thread;
-}
-
-int EditPopupUserTitle::handle_event()
-{
-       if( popup->edit ) {
-               dialog_thread->close_window();
-               int wx = mwindow->gui->get_abs_cursor_x(0) - 400 / 2;
-               int wy = mwindow->gui->get_abs_cursor_y(0) - 500 / 2;
-               dialog_thread->start(wx, wy);
-       }
-       return 1;
-}
-
-void EditUserTitleDialogThread::start(int wx, int wy)
-{
-       this->wx = wx;  this->wy = wy;
-       BC_DialogThread::start();
-}
-
-EditUserTitleDialogThread::EditUserTitleDialogThread(EditPopupUserTitle *edit_title)
-{
-       this->edit_title = edit_title;
-       window = 0;
-}
-EditUserTitleDialogThread::~EditUserTitleDialogThread()
-{
-       close_window();
-}
-
-BC_Window* EditUserTitleDialogThread::new_gui()
-{
-       MWindow *mwindow = edit_title->mwindow;
-       EditPopup *popup = edit_title->popup;
-       window = new EditPopupUserTitleWindow(mwindow, popup, wx, wy);
-       window->create_objects();
-       return window;
-}
-
-void EditUserTitleDialogThread::handle_close_event(int result)
-{
-       window = 0;
-}
-
-void EditUserTitleDialogThread::handle_done_event(int result)
-{
-       if( result ) return;
-       MWindow *mwindow = edit_title->mwindow;
-       EditPopup *popup = edit_title->popup;
-       EDL *edl = mwindow->edl;
-       const char *text = window->title_text->get_text();
-       int count = 0;
-       for( Track *track=edl->tracks->first; track; track=track->next ) {
-               if( !track->record ) continue;
-               for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
-                       if( !edit->is_selected ) continue;
-                       strcpy(edit->user_title, text);
-                       ++count;
-               }
-       }
-       if( count )
-               edl->tracks->clear_selected_edits();
-       else if( popup->edit ) {
-               strcpy(popup->edit->user_title, text);
-       }
-       mwindow->gui->lock_window("EditUserTitleDialogThread::handle_done_event");
-       mwindow->gui->draw_canvas(1, 0);
-       mwindow->gui->flash_canvas(1);
-       mwindow->gui->unlock_window();
-}
-
-EditPopupUserTitleWindow::EditPopupUserTitleWindow(MWindow *mwindow,
-               EditPopup *popup, int wx, int wy)
- : BC_Window(_(PROGRAM_NAME ": Set edit title"), wx, wy,
-       300, 130, 300, 130, 0, 0, 1)
-{
-       this->mwindow = mwindow;
-       this->popup = popup;
-       strcpy(new_text, !popup->edit ? "" : popup->edit->user_title);
-}
-
-EditPopupUserTitleWindow::~EditPopupUserTitleWindow()
-{
-}
-
-void EditPopupUserTitleWindow::create_objects()
-{
-       lock_window("EditPopupUserTitleWindow::create_objects");
-       int x = 10, y = 10, x1;
-       BC_Title *title = new BC_Title(x1=x, y, _("User title:"));
-       add_subwindow(title);  x1 += title->get_w() + 10;
-       title_text = new EditPopupUserTitleText(this, mwindow, x1, y, new_text);
-       add_subwindow(title_text);
-
-       add_tool(new BC_OKButton(this));
-       add_tool(new BC_CancelButton(this));
-
-
-       show_window();
-       flush();
-       unlock_window();
-}
-
-
-EditPopupUserTitleText::EditPopupUserTitleText(EditPopupUserTitleWindow *window,
-       MWindow *mwindow, int x, int y, const char *text)
- : BC_TextBox(x, y, window->get_w()-x-15, 1, text)
-{
-       this->window = window;
-       this->mwindow = mwindow;
-}
-
-EditPopupUserTitleText::~EditPopupUserTitleText()
-{
-}
-
-int EditPopupUserTitleText::handle_event()
-{
-       if( get_keypress() == RETURN )
-               window->set_done(0);
-       return 1;
-}
-
-
-EditPopupTitleColor::EditPopupTitleColor(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Bar Color..."))
-{
-       this->mwindow = mwindow;
-       this->popup = popup;
-       color_picker = 0;
-}
-EditPopupTitleColor::~EditPopupTitleColor()
-{
-       delete color_picker;
-}
-
-int EditPopupTitleColor::handle_event()
-{
-       if( popup->edit ) {
-               int color = popup->mwindow->get_title_color(popup->edit);
-               if( !color ) color = popup->mwindow->theme->get_color_title_bg();
-               delete color_picker;
-               color_picker = new EditTitleColorPicker(popup, color);
-               int alpha = (~color>>24) & 0xff;
-               color_picker->start_window(color & 0xffffff, alpha, 1);
-       }
-       return 1;
-}
-
-EditTitleColorDefault::EditTitleColorDefault(
-       EditTitleColorPicker *color_picker, int x, int y)
- : BC_GenericButton(x, y, _("default"))
-{
-       this->color_picker = color_picker;
-}
-
-int EditTitleColorDefault::handle_event()
-{
-       const unsigned color = 0, alpha = 0xff;
-       color_picker->color = color | (~alpha << 24);
-       color_picker->update_gui(color, alpha);
-       return 1;
-}
-
-EditTitleColorPicker::EditTitleColorPicker(EditPopup *popup, int color)
- : ColorPicker(1, _("Bar Color"))
-{
-       this->popup = popup;
-       this->color = color;
-}
-EditTitleColorPicker::~EditTitleColorPicker()
-{
-}
-void EditTitleColorPicker::create_objects(ColorWindow *gui)
-{
-       int y = gui->get_h() - BC_CancelButton::calculate_h() + 10;
-       int x = gui->get_w() - BC_CancelButton::calculate_w() - 10;
-       x -= BC_GenericButton::calculate_w(gui, _("default")) + 15;
-       gui->add_subwindow(new EditTitleColorDefault(this, x, y));
-}
-
-int EditTitleColorPicker::handle_new_color(int color, int alpha)
-{
-       this->color = color | (~alpha << 24);
-       return 1;
-}
-
-void EditTitleColorPicker::handle_done_event(int result)
-{
-       if( !result ) {
-               EDL *edl = popup->mwindow->edl;
-               int count = 0;
-               for( Track *track=edl->tracks->first; track; track=track->next ) {
-                       if( !track->record ) continue;
-                       for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
-                               if( !edit->is_selected ) continue;
-                               edit->color = color;
-                               ++count;
-                       }
-               }
-               if( count )
-                       edl->tracks->clear_selected_edits();
-               else
-                       popup->edit->color = color;
-       }
-       MWindowGUI *mwindow_gui = popup->mwindow->gui;
-       mwindow_gui->lock_window("GWindowColorUpdate::run");
-       mwindow_gui->draw_trackmovement();
-       mwindow_gui->unlock_window();
-}
-
-
-EditPopupShow::EditPopupShow(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Show edit"))
-{
-       this->mwindow = mwindow;
-       this->popup = popup;
-       dialog_thread = new EditShowDialogThread(this);
-}
-
-EditPopupShow::~EditPopupShow()
-{
-       delete dialog_thread;
-}
-
-int EditPopupShow::handle_event()
+int EditPopupOverwritePlugins::handle_event()
 {
-       if( popup->edit ) {
-               dialog_thread->close_window();
-               int wx = mwindow->gui->get_abs_cursor_x(0) - 400 / 2;
-               int wy = mwindow->gui->get_abs_cursor_y(0) - 500 / 2;
-               dialog_thread->start(wx, wy);
+       mwindow->paste_clipboard(popup->track, popup->position, 1, 0,
+                       mwindow->edl->session->labels_follow_edits,
+                       mwindow->edl->session->autos_follow_edits,
+                       mwindow->edl->session->plugins_follow_edits);
+       mwindow->edl->tracks->clear_selected_edits();
+       if( mwindow->session->current_operation == DROP_TARGETING ) {
+               mwindow->session->current_operation = NO_OPERATION;
+               popup->gui->update_cursor();
        }
        return 1;
 }
 
-void EditShowDialogThread::start(int wx, int wy)
-{
-       this->wx = wx;  this->wy = wy;
-       BC_DialogThread::start();
-}
-
-EditShowDialogThread::EditShowDialogThread(EditPopupShow *edit_show)
-{
-       this->edit_show = edit_show;
-       window = 0;
-}
-EditShowDialogThread::~EditShowDialogThread()
-{
-       close_window();
-}
-
-BC_Window* EditShowDialogThread::new_gui()
-{
-       MWindow *mwindow = edit_show->mwindow;
-       EditPopup *popup = edit_show->popup;
-       window = new EditPopupShowWindow(mwindow, popup, wx, wy);
-       window->create_objects();
-       return window;
-}
-
-void EditShowDialogThread::handle_close_event(int result)
-{
-       window = 0;
-}
-
-EditPopupShowWindow::EditPopupShowWindow(MWindow *mwindow,
-               EditPopup *popup, int wx, int wy)
- : BC_Window(_(PROGRAM_NAME ": Show edit"), wx, wy,
-       300, 220, 300, 220, 0, 0, 1)
-{
-       this->mwindow = mwindow;
-       this->popup = popup;
-}
-
-EditPopupShowWindow::~EditPopupShowWindow()
-{
-}
-
-void EditPopupShowWindow::create_objects()
-{
-       lock_window("EditPopupShowWindow::create_objects");
-       int x = 10, y = 10;
-       BC_Title *title;
-       char text[BCTEXTLEN];
-       Edit *edit = popup->edit;
-       Track *track = edit->track;
-       sprintf(text, _("Track %d:"), mwindow->edl->tracks->number_of(track)+1);
-       add_subwindow(title = new BC_Title(x, y, text));
-       int x1 = x + title->get_w() + 10;
-       int tw = get_w() - x1 - 20;
-       truncate_text(text, track->title, tw);
-       add_subwindow(new BC_Title(x1, y, text));
-       y += title->get_h() + 5;
-       sprintf(text, _("Edit %d:"), track->edits->number_of(edit)+1);
-       add_subwindow(title = new BC_Title(x, y, text));
-       char edit_title[BCTEXTLEN];
-       edit->get_title(edit_title);
-       truncate_text(text, edit_title, tw);
-       add_subwindow(new BC_Title(x1, y, text));
-       y += title->get_h() + 5;
-
-       EDLSession *session = mwindow->edl->session;
-       int time_format = session->time_format;
-       int sample_rate = session->sample_rate;
-       double frame_rate = session->frame_rate;
-       double frames_per_foot = session->frames_per_foot;
-
-       double startsource = track->from_units(edit->startsource);
-       double startproject = track->from_units(edit->startproject);
-       double length = track->from_units(edit->length);
-
-       char text_startsource[BCSTRLEN];
-       char text_startproject[BCSTRLEN];
-       char text_length[BCSTRLEN];
-       sprintf(text, _("StartSource: %s\nStartProject: %s\nLength: %s\n"),
-               Units::totext(text_startsource, startsource,
-                       time_format, sample_rate, frame_rate, frames_per_foot),
-               Units::totext(text_startproject, startproject,
-                       time_format, sample_rate, frame_rate, frames_per_foot),
-               Units::totext(text_length, length,
-                       time_format, sample_rate, frame_rate, frames_per_foot));
-       show_text = new EditPopupShowText(this, mwindow, x+15, y+10, text);
-       add_subwindow(show_text);
-       add_tool(new BC_OKButton(this));
-
-       show_window();
-       flush();
-       unlock_window();
-}
-
-
-EditPopupShowText::EditPopupShowText(EditPopupShowWindow *window,
-       MWindow *mwindow, int x, int y, const char *text)
- : BC_TextBox(x, y, 250, 4, text)
-{
-       this->window = window;
-       this->mwindow = mwindow;
-}
-
-EditPopupShowText::~EditPopupShowText()
-{
-}
-
index 90fd9ace60da540d1a2f74f31d2dbe3a463f2145..ce16db69f3423d151daf47df23736399755a044e 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "guicast.h"
 #include "edit.inc"
-#include "colorpicker.h"
 #include "editpopup.inc"
 #include "mwindow.inc"
 #include "mwindowgui.inc"
@@ -143,155 +142,12 @@ public:
        EditPopup *popup;
 };
 
-class EditPopupFindAsset : public BC_MenuItem
+class EditPopupOverwritePlugins : public BC_MenuItem
 {
 public:
-       EditPopupFindAsset(MWindow *mwindow, EditPopup *popup);
+       EditPopupOverwritePlugins(MWindow *mwindow, EditPopup *popup);
        int handle_event();
-       MWindow *mwindow;
-       EditPopup *popup;
-};
-
-class EditPopupUserTitle : public BC_MenuItem
-{
-public:
-       EditPopupUserTitle(MWindow *mwindow, EditPopup *popup);
-       ~EditPopupUserTitle();
-
-       int handle_event();
-
-       MWindow *mwindow;
-       EditPopup *popup;
-       EditUserTitleDialogThread *dialog_thread;
-};
-
-class EditPopupUserTitleText : public BC_TextBox
-{
-public:
-       EditPopupUserTitleText(EditPopupUserTitleWindow *window,
-               MWindow *mwindow, int x, int y, const char *text);
-       ~EditPopupUserTitleText();
-       int handle_event();
-
-       MWindow *mwindow;
-       EditPopupUserTitleWindow *window;
-};
-
-class EditPopupUserTitleWindow : public BC_Window
-{
-public:
-       EditPopupUserTitleWindow(MWindow *mwindow, EditPopup *popup, int wx, int wy);
-       ~EditPopupUserTitleWindow();
-
-       void create_objects();
-       void handle_close_event(int result);
-
-       EditPopupUserTitleText *title_text;
-       MWindow *mwindow;
-       EditPopup *popup;
-       char new_text[BCTEXTLEN];
-};
-
-class EditUserTitleDialogThread : public BC_DialogThread
-{
-public:
-       EditUserTitleDialogThread(EditPopupUserTitle *edit_title);
-       ~EditUserTitleDialogThread();
-
-       void handle_close_event(int result);
-       void handle_done_event(int result);
-       BC_Window* new_gui();
-       void start(int wx, int wy);
-
-       int wx, wy;
-       EditPopupUserTitle *edit_title;
-       EditPopupUserTitleWindow *window;
-};
-
-
-class EditPopupTitleColor : public BC_MenuItem
-{
-public:
-       EditPopupTitleColor(MWindow *mwindow, EditPopup *popup);
-       ~EditPopupTitleColor();
-
-       int handle_event();
-
-       MWindow *mwindow;
-       EditPopup *popup;
-       EditTitleColorPicker *color_picker;
-};
-
-class EditTitleColorDefault : public BC_GenericButton
-{
-public:
-       EditTitleColorDefault(EditTitleColorPicker *color_picker, int x, int y);
-       int handle_event();
-
-       EditTitleColorPicker *color_picker;
-};
-
-class EditTitleColorPicker : public ColorPicker
-{
-public:
-       EditTitleColorPicker(EditPopup *popup, int color);
-       ~EditTitleColorPicker();
-       void create_objects(ColorWindow *gui);
-       int handle_new_color(int color, int alpha);
-       void handle_done_event(int result);
-
-       EditPopup *popup;
-       int color;
-};
-
-
-class EditPopupShow : public BC_MenuItem
-{
-public:
-       EditPopupShow(MWindow *mwindow, EditPopup *popup);
-       ~EditPopupShow();
-
-       int handle_event();
-
-       MWindow *mwindow;
-       EditPopup *popup;
-       EditShowDialogThread *dialog_thread;
-};
-
-class EditShowDialogThread : public BC_DialogThread
-{
-public:
-       EditShowDialogThread(EditPopupShow *edit_show);
-       ~EditShowDialogThread();
-       BC_Window* new_gui();
-       void start(int wx, int wy);
-       void handle_close_event(int result);
-
-       int wx, wy;
-       EditPopupShow *edit_show;
-       EditPopupShowWindow *window;
-};
-
-class EditPopupShowText : public BC_TextBox
-{
-public:
-       EditPopupShowText(EditPopupShowWindow *window,
-               MWindow *mwindow, int x, int y, const char *text);
-       ~EditPopupShowText();
-
-       EditPopupShowWindow *window;
-       MWindow *mwindow;
-};
-
-class EditPopupShowWindow : public BC_Window
-{
-public:
-       EditPopupShowWindow(MWindow *mwindow, EditPopup *popup, int wx, int wy);
-       ~EditPopupShowWindow();
-
-       void create_objects();
 
-       EditPopupShowText *show_text;
        MWindow *mwindow;
        EditPopup *popup;
 };
index df5eb84488497f06e0f3524d4d5822a91183db17..c5c69ea8b4be6215ffcbe28d1ad47f2dd88b66d6 100644 (file)
@@ -32,16 +32,6 @@ class EditPopupMute;
 class EditPopupMutePack;
 class EditPopupPaste;
 class EditPopupOverwrite;
-class EditPopupFindAsset;
-class EditPopupUserTitle;
-class EditPopupUserTitleText;
-class EditPopupUserTitleWindow;
-class EditUserTitleDialogThread;
-class EditPopupTitleColor;
-class EditTitleColorPicker;
-class EditPopupShow;
-class EditShowDialogThread;
-class EditPopupShowText;
-class EditPopupShowWindow;
+class EditPopupOverwritePlugins;
 
 #endif
index 102c975bc3139520e45b884fa69c864bafe4482f..6f2b7e5865f784b8b30fd580b3b63553ca83ced6 100644 (file)
@@ -795,20 +795,24 @@ int EDL::clear(double start, double end,
        return 0;
 }
 
-class Zone { public: Track *track; int64_t start, end; };
+static int dead_edit_cmp(Edit**ap, Edit**bp)
+{
+       Edit *a = *ap, *b = *bp;
+       if( a->track != b->track ) return 0;
+       return a->startproject > b->startproject ? -1 : 1;
+}
 
 void EDL::delete_edits(ArrayList<Edit*> *edits, int collapse)
 {
+       edits->sort(dead_edit_cmp);
        if( session->labels_follow_edits )
                delete_edit_labels(edits, collapse);
-       ArrayList<Zone> zones;
        for( int i=0; i<edits->size(); ++i ) {
                Edit *edit = edits->get(i);
                Track *track = edit->track;
                int64_t start = edit->startproject;
-               int64_t end = start + edit->length;
-               Zone &zone = zones.append();
-               zone.track = track;  zone.start = start;  zone.end = end;
+               int64_t length = edit->length;
+               int64_t end = start + length;
                if( session->autos_follow_edits ) {
                        track->automation->clear(start, end, 0, collapse);
                }
@@ -820,15 +824,12 @@ void EDL::delete_edits(ArrayList<Edit*> *edits, int collapse)
                                        plugin_set->paste_silence(start, end);
                        }
                }
-               track->optimize();
-       }
-       for( int i=0; i<zones.size(); ++i ) {
-               Zone &zone = zones[i];
-               Track *track = zone.track;
-               int64_t start = zone.start, end = zone.end;
-               track->edits->clear(start, end);
-               if( !collapse )
-                       track->edits->paste_silence(start, end);
+               Edit *dead_edit = edit;
+               if( collapse ) {
+                       while( (edit=edit->next) )
+                               edit->startproject -= length;
+               }
+               delete dead_edit;
                track->optimize();
        }
        optimize();
index e11d3399f6eb409e1b2ec473b4ab4bfa0822b3c3..a69a3a506661292a76654aa1d62655409595e604 100644 (file)
@@ -405,6 +405,10 @@ public:
        void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
 // 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
                int behaviour);
+       void paste_edits(EDL *clip, Track *first_track, double position, int overwrite,
+               int edit_edits, int edit_labels, int edit_autos, int edit_plugins);
+       void paste_clipboard(Track *first_track, double position, int overwrite,
+               int edit_edits, int edit_labels, int edit_autos, int edit_plugins);
        void move_group(EDL *group, Track *first_track, double position);
 // Move effect to position
        void move_effect(Plugin *plugin, Track *track, int64_t position);
index 1ce258fc4c8a77d9c1725bd4ef9a2d07a4f6b46f..9711719aea4164ec700e5d67f92866ec3715529c 100644 (file)
@@ -958,14 +958,12 @@ EDL *MWindow::selected_edits_to_clip(int packed,
                        if( !new_track )
                                new_track = new_edl->add_new_track(track->data_type);
                        int64_t edit_pos = edit_start_pos - start_pos;
-                       if( !packed ) {
-                               if( edit_pos > startproject ) {
-                                       Edit *silence = new Edit(new_edl, new_track);
-                                       silence->startproject = startproject;
-                                       silence->length = edit_pos - startproject;
-                                       new_track->edits->append(silence);
-                                       startproject = edit_pos;
-                               }
+                       if( !packed && edit_pos > startproject ) {
+                               Edit *silence = new Edit(new_edl, new_track);
+                               silence->startproject = startproject;
+                               silence->length = edit_pos - startproject;
+                               new_track->edits->append(silence);
+                               startproject = edit_pos;
                        }
                        int64_t clip_start_pos = startproject;
                        Edit *clip_edit = new Edit(new_edl, new_track);
@@ -1036,7 +1034,7 @@ EDL *MWindow::selected_edits_to_clip(int packed,
                                                        plugin_end_pos = edit_end_pos;
                                                if( plugin_start_pos >= plugin_end_pos ) continue;
                                                int64_t plugin_pos = plugin_start_pos - start_pos;
-                                               if( plugin_pos > startplugin ) {
+                                               if( !packed && plugin_pos > startplugin ) {
                                                        Plugin *silence = new Plugin(new_edl, new_track, "");
                                                        silence->startproject = startplugin;
                                                        silence->length = plugin_pos - startplugin;
@@ -1052,15 +1050,17 @@ EDL *MWindow::selected_edits_to_clip(int packed,
                                                KeyFrames *keyframes = plugin->keyframes;
                                                KeyFrames *new_keyframes = new_plugin->keyframes;
                                                new_keyframes->default_auto->copy_from(keyframes->default_auto);
-                                               new_keyframes->default_auto->position = startplugin;
+                                               new_keyframes->default_auto->position = new_plugin->startproject;
                                                KeyFrame *keyframe = (KeyFrame*)keyframes->first;
                                                for( ; keyframe; keyframe=(KeyFrame*)keyframe->next ) {
                                                        if( keyframe->position < edit_start_pos ) continue;
                                                        if( keyframe->position >= edit_end_pos ) break;
                                                        KeyFrame *clip_keyframe = new KeyFrame(new_edl, new_keyframes);
                                                        clip_keyframe->copy_from(keyframe);
-                                                       int64_t clip_position = keyframe->position - start_pos;
-                                                       clip_keyframe->position = clip_position;
+                                                       int64_t key_position = keyframe->position - start_pos;
+                                                       if( packed )
+                                                               key_position += new_plugin->startproject - plugin_pos;
+                                                       clip_keyframe->position = key_position;
                                                        new_keyframes->append(clip_keyframe);
                                                }
                                        }
@@ -1153,40 +1153,56 @@ void MWindow::move_edits(ArrayList<Edit*> *edits,
        gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
 }
 
-void MWindow::move_group(EDL *group, Track *first_track, double position)
-{
-       undo->update_undo_before();
-       ArrayList<Edit *>edits;
-       edl->tracks->get_selected_edits(&edits);
-       edl->delete_edits(&edits, 0);
-       Track *src = group->tracks->first;
+void MWindow::paste_edits(EDL *clip, Track *first_track, double position, int overwrite,
+               int edit_edits, int edit_labels, int edit_autos, int edit_plugins)
+{
+       if( edit_labels ) {
+               Label *edl_label = edl->labels->first;
+               for( Label *label=clip->labels->first; label; label=label->next ) {
+                       double label_pos = position + label->position;
+                       int exists = 0;
+                       while( edl_label &&
+                               !(exists=edl->equivalent(edl_label->position, label_pos)) &&
+                               edl_label->position < position ) edl_label = edl_label->next;
+                       if( exists ) continue;
+                       edl->labels->insert_before(edl_label,
+                               new Label(edl, edl->labels, label_pos, label->textstr));
+               }
+       }
+
+       if( !first_track )
+               first_track = edl->tracks->first;
+       Track *src = clip->tracks->first;
        for( Track *track=first_track; track && src; track=track->next ) {
                if( !track->record ) continue;
                int64_t pos = track->to_units(position, 0);
-               for( Edit *edit=src->edits->first; edit; edit=edit->next ) {
-                       if( edit->silence() ) continue;
-                       int64_t start = pos + edit->startproject;
-                       int64_t end = start + edit->length;
-                       track->edits->clear(start, end);
-                       Edit *dst = track->edits->insert_new_edit(start);
-                       dst->copy_from(edit);
-                       dst->startproject = start;
-                       dst->is_selected = 1;
-                       while( (dst=dst->next) != 0 )
-                               dst->startproject += edit->length;
+               if( edit_edits ) {
+                       for( Edit *edit=src->edits->first; edit; edit=edit->next ) {
+                               if( edit->silence() ) continue;
+                               int64_t start = pos + edit->startproject;
+                               int64_t end = start + edit->length;
+                               if( overwrite )
+                                       track->edits->clear(start, end);
+                               Edit *dst = track->edits->insert_new_edit(start);
+                               dst->copy_from(edit);
+                               dst->startproject = start;
+                               dst->is_selected = 1;
+                               while( (dst=dst->next) != 0 )
+                                       dst->startproject += edit->length;
+                       }
                }
-               if( edl->session->autos_follow_edits ) {
+               if( edit_autos ) {
                        for( int i=0; i<AUTOMATION_TOTAL; ++i ) {
                                Autos *src_autos = src->automation->autos[i];
                                if( !src_autos ) continue;
                                Autos *autos = track->automation->autos[i];
                                for( Auto *aut0=src_autos->first; aut0; aut0=aut0->next ) {
-                                       int64_t position = pos + aut0->position;
-                                       autos->insert_auto(position, aut0);
+                                       int64_t auto_pos = pos + aut0->position;
+                                       autos->insert_auto(auto_pos, aut0);
                                }
                        }
                }
-               if( edl->session->plugins_follow_edits ) {
+               if( edit_plugins ) {
                        for( int i=0; i<src->plugin_set.size(); ++i ) {
                                PluginSet *plugin_set = src->plugin_set[i];
                                if( !plugin_set ) continue;
@@ -1202,15 +1218,16 @@ void MWindow::move_group(EDL *group, Track *first_track, double position)
                                for( ; plugin; plugin=(Plugin *)plugin->next ) {
                                        int64_t start = pos + plugin->startproject;
                                        int64_t end = start + plugin->length;
-                                       dst_plugin_set->clear(start, end, 1);
+                                       if( overwrite )
+                                               dst_plugin_set->clear(start, end, 1);
                                        Plugin *dst = dst_plugin_set->insert_plugin(
                                                plugin->title, start, end-start,
                                                plugin->plugin_type, &plugin->shared_location,
                                                (KeyFrame*)plugin->keyframes->default_auto, 0);
                                        KeyFrame *keyframe = (KeyFrame*)plugin->keyframes->first;
                                        for( ; keyframe; keyframe=(KeyFrame*)keyframe->next ) {
-                                               int64_t position = pos + keyframe->position;
-                                               dst->keyframes->insert_auto(position, keyframe);
+                                               int64_t keyframe_pos = pos + keyframe->position;
+                                               dst->keyframes->insert_auto(keyframe_pos, keyframe);
                                        }
                                }
                        }
@@ -1218,6 +1235,43 @@ void MWindow::move_group(EDL *group, Track *first_track, double position)
                track->optimize();
                src = src->next;
        }
+}
+
+void MWindow::paste_clipboard(Track *first_track, double position, int overwrite,
+               int edit_edits, int edit_labels, int edit_autos, int edit_plugins)
+{
+       int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
+       if( !len ) return;
+       char *string = new char[len];
+       gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
+       FileXML file;
+       file.read_from_string(string);
+       delete [] string;
+       EDL *clip = new EDL();
+       clip->create_objects();
+       if( !clip->load_xml(&file, LOAD_ALL) ) {
+               undo->update_undo_before();
+               paste_edits(clip, first_track, position, overwrite,
+                       edit_edits, edit_labels, edit_autos, edit_plugins);
+               save_backup();
+               undo->update_undo_after(_("paste clip"), LOAD_ALL);
+               restart_brender();
+               cwindow->refresh_frame(CHANGE_EDL);
+
+               update_plugin_guis();
+               gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
+       }
+       clip->remove_user();
+}
+
+void MWindow::move_group(EDL *group, Track *first_track, double position)
+{
+       undo->update_undo_before();
+
+       ArrayList<Edit *>edits;
+       edl->tracks->get_selected_edits(&edits);
+       edl->delete_edits(&edits, 0);
+       paste_edits(group, first_track, position, 1, 1, 1, 1, 1);
 // big debate over whether to do this, must either clear selected, or no tweaking
 //     edl->tracks->clear_selected_edits();
 
index 743c721cf2fcd6f6cc1aba24d3e11348556df200..2b59a6361279e285891bf262ca0117baca25adf2 100644 (file)
@@ -36,6 +36,7 @@
 #include "edl.h"
 #include "edlsession.h"
 #include "filesystem.h"
+#include "filexml.h"
 #include "keyframepopup.h"
 #include "keys.h"
 #include "language.h"
@@ -1172,7 +1173,7 @@ int MWindowGUI::keypress_event()
        if( result ) return result;
 
        Track *this_track = 0, *first_track = 0;
-       int collapse = 0, packed = 0, overwrite = 0;
+       int collapse = 0, packed = 0, overwrite = 0, plugins = 0;
        double position = 0;
 
        switch( get_keypress() ) {
@@ -1202,6 +1203,8 @@ int MWindowGUI::keypress_event()
                mwindow->selected_edits_to_clipboard(packed);
                result = 1;
                break;
+       case 'P':
+               plugins = 1;
        case 'b':
                overwrite = -1; // fall thru
        case 'v':
@@ -1222,7 +1225,10 @@ int MWindowGUI::keypress_event()
                }
                else
                        position = mwindow->edl->local_session->get_selectionstart();
-               mwindow->paste(position, first_track, 0, overwrite);
+               if( !plugins )
+                       mwindow->paste(position, first_track, 0, overwrite);
+               else
+                       mwindow->paste_clipboard(first_track, position, 1, 0, 1, 1, 1);
                mwindow->edl->tracks->clear_selected_edits();
                draw_overlays(1);
                result = 1;
@@ -1241,8 +1247,7 @@ int MWindowGUI::keypress_event()
                result = 1;
                break;
 
-       case '1': case '2': case '3': case '4':
-       case '5': case '6': case '7': case '8':
+       case '1' ... '8':
                if( !alt_down() || shift_down() ) break;
                if( !mwindow->select_asset(get_keypress()-'1',1) )
                        result = 1;
index 3d152c71bfa5eb6bc272a7eabfd878699f3bb6ed..bdeb77135ea7b78b35eb8c5044c9e74f8e156027 100644 (file)
@@ -4844,27 +4844,23 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
                        if(cursor_x >= edit_x && cursor_x < edit_x + edit_w &&
                                cursor_y >= edit_y && cursor_y < edit_y + edit_h) {
                                if( button_press && get_buttonpress() == LEFT_BUTTON ) {
-                                       if( get_double_click() ) {
-                                               mwindow->edl->tracks->clear_selected_edits();
+                                       if( get_double_click() && (ctrl_down() ||
+                                            mwindow->edl->session->editing_mode == EDITING_IBEAM) ) {
+// Select duration of edit
                                                double start = edit->track->from_units(edit->startproject);
                                                start = mwindow->edl->align_to_frame(start, 0);
                                                mwindow->edl->local_session->set_selectionstart(start);
-                                               if( ctrl_down() ) {
-// Select duration of edit
-                                                       double end = edit->track->from_units(edit->startproject+edit->length);
-                                                       end = mwindow->edl->align_to_frame(end, 0);
-                                                       mwindow->edl->local_session->set_selectionend(end);
-                                                       mwindow->edl->tracks->select_affected_edits(
-                                                               edit->track->from_units(edit->startproject),
-                                                               edit->track, 1);
-                                               }
-                                               else {
-                                                       mwindow->edl->local_session->set_selectionend(start);
-                                                       edit->set_selected(1);
-                                               }
+                                               double end = edit->track->from_units(edit->startproject+edit->length);
+                                               end = mwindow->edl->align_to_frame(end, 0);
+                                               mwindow->edl->local_session->set_selectionend(end);
+                                               mwindow->edl->tracks->clear_selected_edits();
+                                               mwindow->edl->tracks->select_affected_edits(
+                                                       edit->track->from_units(edit->startproject),
+                                                       edit->track, 1);
                                                result = 1;
                                        }
-                                       else if( mwindow->edl->session->editing_mode == EDITING_ARROW ) {
+                                       else if( mwindow->edl->session->editing_mode == EDITING_ARROW ||
+                                                ctrl_down() ) {
                                                mwindow->session->drag_edit = edit;
                                                mwindow->session->current_operation = GROUP_TOGGLE;
                                                result = 1;
@@ -4882,11 +4878,17 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
                                        mwindow->session->drag_position =
                                                mwindow->edl->get_cursor_position(cursor_x, pane->number);
                                        drag_start = 0; // if unselected "fast" drag
-                                       if( !ctrl_down() && !edit->silence() && !edit->is_selected ) {
+                                       if( !edit->silence() && !edit->is_selected ) {
                                                mwindow->edl->tracks->clear_selected_edits();
-                                               mwindow->edl->tracks->select_affected_edits(
-                                                       edit->track->from_units(edit->startproject),
-                                                       edit->track, 1);
+                                               if( ctrl_down() ) {
+                                                       double start = edit->track->from_units(edit->startproject);
+                                                       mwindow->edl->local_session->set_selectionend(start);
+                                                       edit->set_selected(1);
+                                               }
+                                               else
+                                                       mwindow->edl->tracks->select_affected_edits(
+                                                               edit->track->from_units(edit->startproject),
+                                                               edit->track, 1);
                                                drag_start = 1;
                                        }
 // Construct list of all affected edits
index e1b55dbdbb15fb80dcd46d0cb92d435f10ff7479..f6f0e315190d845d13c9641835e88db40329dc0e 100644 (file)
@@ -23,6 +23,8 @@
 #include "assets.h"
 #include "awindow.h"
 #include "awindowgui.h"
+#include "edit.h"
+#include "edits.h"
 #include "edl.h"
 #include "edlsession.h"
 #include "file.h"
@@ -35,6 +37,7 @@
 #include "mwindowgui.h"
 #include "plugindialog.h"
 #include "resizetrackthread.h"
+#include "theme.h"
 #include "track.h"
 #include "tracks.h"
 #include "trackpopup.h"
@@ -65,6 +68,10 @@ void TrackPopup::create_objects()
        add_item(new TrackMoveDown(mwindow, this));
        add_item(new TrackPopupDeleteTrack(mwindow, this));
        add_item(new TrackPopupAddTrack(mwindow, this));
+       add_item(new TrackPopupFindAsset(mwindow, this));
+       add_item(new TrackPopupShow(mwindow, this));
+       add_item(new TrackPopupUserTitle(mwindow, this));
+       add_item(new TrackPopupTitleColor(mwindow, this));
        resize_option = 0;
        matchsize_option = 0;
 }
@@ -218,3 +225,398 @@ int TrackPopupAddTrack::handle_event()
        return 1;
 }
 
+TrackPopupFindAsset::TrackPopupFindAsset(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Find in Resources"))
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+}
+
+int TrackPopupFindAsset::handle_event()
+{
+       Edit *edit = popup->edit;
+       if( edit ) {
+               Indexable *idxbl = (Indexable *)edit->asset;
+               if( !idxbl ) idxbl = (Indexable *)edit->nested_edl;
+               if( idxbl ) {
+                       AWindowGUI *agui = mwindow->awindow->gui;
+                       agui->lock_window("TrackPopupFindAsset::handle_event");
+                       AssetPicon *picon = 0;
+                       for( int i=0, n=agui->assets.size(); i<n; ++i ) {
+                               AssetPicon *ap = (AssetPicon *)agui->assets[i];
+                               int found = ap->indexable && ( idxbl == ap->indexable ||
+                                       !strcmp(idxbl->path, ap->indexable->path) );
+                               if( found && !picon ) picon = ap;
+                               ap->set_selected(found);
+                       }
+                       if( picon ) {
+                               int selected_folder = picon->indexable->folder_no;
+                               mwindow->edl->session->awindow_folder = selected_folder;
+                               for( int i=0,n=agui->folders.size(); i<n; ++i ) {
+                                       AssetPicon *folder_item = (AssetPicon *)agui->folders[i];
+                                       int selected = folder_item->foldernum == selected_folder ? 1 : 0;
+                                       folder_item->set_selected(selected);
+                               }
+                       }
+                       agui->unlock_window();
+                       agui->async_update_assets();
+               }
+       }
+       return 1;
+}
+
+
+TrackPopupUserTitle::TrackPopupUserTitle(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("User title..."))
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+       dialog_thread = new TrackUserTitleDialogThread(this);
+}
+
+TrackPopupUserTitle::~TrackPopupUserTitle()
+{
+       delete dialog_thread;
+}
+
+int TrackPopupUserTitle::handle_event()
+{
+       if( popup->edit ) {
+               dialog_thread->close_window();
+               int wx = mwindow->gui->get_abs_cursor_x(0) - 400 / 2;
+               int wy = mwindow->gui->get_abs_cursor_y(0) - 500 / 2;
+               dialog_thread->start(wx, wy);
+       }
+       return 1;
+}
+
+void TrackUserTitleDialogThread::start(int wx, int wy)
+{
+       this->wx = wx;  this->wy = wy;
+       BC_DialogThread::start();
+}
+
+TrackUserTitleDialogThread::TrackUserTitleDialogThread(TrackPopupUserTitle *edit_title)
+{
+       this->edit_title = edit_title;
+       window = 0;
+}
+TrackUserTitleDialogThread::~TrackUserTitleDialogThread()
+{
+       close_window();
+}
+
+BC_Window* TrackUserTitleDialogThread::new_gui()
+{
+       MWindow *mwindow = edit_title->mwindow;
+       TrackPopup *popup = edit_title->popup;
+       window = new TrackPopupUserTitleWindow(mwindow, popup, wx, wy);
+       window->create_objects();
+       return window;
+}
+
+void TrackUserTitleDialogThread::handle_close_event(int result)
+{
+       window = 0;
+}
+
+void TrackUserTitleDialogThread::handle_done_event(int result)
+{
+       if( result ) return;
+       MWindow *mwindow = edit_title->mwindow;
+       TrackPopup *popup = edit_title->popup;
+       EDL *edl = mwindow->edl;
+       const char *text = window->title_text->get_text();
+       int count = 0;
+       for( Track *track=edl->tracks->first; track; track=track->next ) {
+               if( !track->record ) continue;
+               for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+                       if( !edit->is_selected ) continue;
+                       strcpy(edit->user_title, text);
+                       ++count;
+               }
+       }
+       if( count )
+               edl->tracks->clear_selected_edits();
+       else if( popup->edit ) {
+               strcpy(popup->edit->user_title, text);
+       }
+       mwindow->gui->lock_window("TrackUserTitleDialogThread::handle_done_event");
+       mwindow->gui->draw_canvas(1, 0);
+       mwindow->gui->flash_canvas(1);
+       mwindow->gui->unlock_window();
+}
+
+TrackPopupUserTitleWindow::TrackPopupUserTitleWindow(MWindow *mwindow,
+               TrackPopup *popup, int wx, int wy)
+ : BC_Window(_(PROGRAM_NAME ": Set edit title"), wx, wy,
+       300, 130, 300, 130, 0, 0, 1)
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+       strcpy(new_text, !popup->edit ? "" : popup->edit->user_title);
+}
+
+TrackPopupUserTitleWindow::~TrackPopupUserTitleWindow()
+{
+}
+
+void TrackPopupUserTitleWindow::create_objects()
+{
+       lock_window("TrackPopupUserTitleWindow::create_objects");
+       int x = 10, y = 10, x1;
+       BC_Title *title = new BC_Title(x1=x, y, _("User title:"));
+       add_subwindow(title);  x1 += title->get_w() + 10;
+       title_text = new TrackPopupUserTitleText(this, mwindow, x1, y, new_text);
+       add_subwindow(title_text);
+
+       add_tool(new BC_OKButton(this));
+       add_tool(new BC_CancelButton(this));
+
+
+       show_window();
+       flush();
+       unlock_window();
+}
+
+
+TrackPopupUserTitleText::TrackPopupUserTitleText(TrackPopupUserTitleWindow *window,
+       MWindow *mwindow, int x, int y, const char *text)
+ : BC_TextBox(x, y, window->get_w()-x-15, 1, text)
+{
+       this->window = window;
+       this->mwindow = mwindow;
+}
+
+TrackPopupUserTitleText::~TrackPopupUserTitleText()
+{
+}
+
+int TrackPopupUserTitleText::handle_event()
+{
+       if( get_keypress() == RETURN )
+               window->set_done(0);
+       return 1;
+}
+
+
+TrackPopupTitleColor::TrackPopupTitleColor(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Bar Color..."))
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+       color_picker = 0;
+}
+TrackPopupTitleColor::~TrackPopupTitleColor()
+{
+       delete color_picker;
+}
+
+int TrackPopupTitleColor::handle_event()
+{
+       if( popup->edit ) {
+               int color = popup->mwindow->get_title_color(popup->edit);
+               if( !color ) color = popup->mwindow->theme->get_color_title_bg();
+               delete color_picker;
+               color_picker = new TrackTitleColorPicker(popup, color);
+               int alpha = (~color>>24) & 0xff;
+               color_picker->start_window(color & 0xffffff, alpha, 1);
+       }
+       return 1;
+}
+
+TrackTitleColorDefault::TrackTitleColorDefault(
+       TrackTitleColorPicker *color_picker, int x, int y)
+ : BC_GenericButton(x, y, _("default"))
+{
+       this->color_picker = color_picker;
+}
+
+int TrackTitleColorDefault::handle_event()
+{
+       const unsigned color = 0, alpha = 0xff;
+       color_picker->color = color | (~alpha << 24);
+       color_picker->update_gui(color, alpha);
+       return 1;
+}
+
+TrackTitleColorPicker::TrackTitleColorPicker(TrackPopup *popup, int color)
+ : ColorPicker(1, _("Bar Color"))
+{
+       this->popup = popup;
+       this->color = color;
+}
+TrackTitleColorPicker::~TrackTitleColorPicker()
+{
+}
+void TrackTitleColorPicker::create_objects(ColorWindow *gui)
+{
+       int y = gui->get_h() - BC_CancelButton::calculate_h() + 10;
+       int x = gui->get_w() - BC_CancelButton::calculate_w() - 10;
+       x -= BC_GenericButton::calculate_w(gui, _("default")) + 15;
+       gui->add_subwindow(new TrackTitleColorDefault(this, x, y));
+}
+
+int TrackTitleColorPicker::handle_new_color(int color, int alpha)
+{
+       this->color = color | (~alpha << 24);
+       return 1;
+}
+
+void TrackTitleColorPicker::handle_done_event(int result)
+{
+       if( !result ) {
+               EDL *edl = popup->mwindow->edl;
+               int count = 0;
+               for( Track *track=edl->tracks->first; track; track=track->next ) {
+                       if( !track->record ) continue;
+                       for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+                               if( !edit->is_selected ) continue;
+                               edit->color = color;
+                               ++count;
+                       }
+               }
+               if( count )
+                       edl->tracks->clear_selected_edits();
+               else
+                       popup->edit->color = color;
+       }
+       MWindowGUI *mwindow_gui = popup->mwindow->gui;
+       mwindow_gui->lock_window("GWindowColorUpdate::run");
+       mwindow_gui->draw_trackmovement();
+       mwindow_gui->unlock_window();
+}
+
+
+TrackPopupShow::TrackPopupShow(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Show edit"))
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+       dialog_thread = new TrackShowDialogThread(this);
+}
+
+TrackPopupShow::~TrackPopupShow()
+{
+       delete dialog_thread;
+}
+
+int TrackPopupShow::handle_event()
+{
+       if( popup->edit ) {
+               dialog_thread->close_window();
+               int wx = mwindow->gui->get_abs_cursor_x(0) - 400 / 2;
+               int wy = mwindow->gui->get_abs_cursor_y(0) - 500 / 2;
+               dialog_thread->start(wx, wy);
+       }
+       return 1;
+}
+
+void TrackShowDialogThread::start(int wx, int wy)
+{
+       this->wx = wx;  this->wy = wy;
+       BC_DialogThread::start();
+}
+
+TrackShowDialogThread::TrackShowDialogThread(TrackPopupShow *edit_show)
+{
+       this->edit_show = edit_show;
+       window = 0;
+}
+TrackShowDialogThread::~TrackShowDialogThread()
+{
+       close_window();
+}
+
+BC_Window* TrackShowDialogThread::new_gui()
+{
+       MWindow *mwindow = edit_show->mwindow;
+       TrackPopup *popup = edit_show->popup;
+       window = new TrackPopupShowWindow(mwindow, popup, wx, wy);
+       window->create_objects();
+       return window;
+}
+
+void TrackShowDialogThread::handle_close_event(int result)
+{
+       window = 0;
+}
+
+TrackPopupShowWindow::TrackPopupShowWindow(MWindow *mwindow,
+               TrackPopup *popup, int wx, int wy)
+ : BC_Window(_(PROGRAM_NAME ": Show edit"), wx, wy,
+       300, 220, 300, 220, 0, 0, 1)
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+}
+
+TrackPopupShowWindow::~TrackPopupShowWindow()
+{
+}
+
+void TrackPopupShowWindow::create_objects()
+{
+       lock_window("TrackPopupShowWindow::create_objects");
+       int x = 10, y = 10;
+       BC_Title *title;
+       char text[BCTEXTLEN];
+       Edit *edit = popup->edit;
+       Track *track = edit->track;
+       sprintf(text, _("Track %d:"), mwindow->edl->tracks->number_of(track)+1);
+       add_subwindow(title = new BC_Title(x, y, text));
+       int x1 = x + title->get_w() + 10;
+       int tw = get_w() - x1 - 20;
+       truncate_text(text, track->title, tw);
+       add_subwindow(new BC_Title(x1, y, text));
+       y += title->get_h() + 5;
+       sprintf(text, _("Edit %d:"), track->edits->number_of(edit)+1);
+       add_subwindow(title = new BC_Title(x, y, text));
+       char edit_title[BCTEXTLEN];
+       edit->get_title(edit_title);
+       truncate_text(text, edit_title, tw);
+       add_subwindow(new BC_Title(x1, y, text));
+       y += title->get_h() + 5;
+
+       EDLSession *session = mwindow->edl->session;
+       int time_format = session->time_format;
+       int sample_rate = session->sample_rate;
+       double frame_rate = session->frame_rate;
+       double frames_per_foot = session->frames_per_foot;
+
+       double startsource = track->from_units(edit->startsource);
+       double startproject = track->from_units(edit->startproject);
+       double length = track->from_units(edit->length);
+
+       char text_startsource[BCSTRLEN];
+       char text_startproject[BCSTRLEN];
+       char text_length[BCSTRLEN];
+       sprintf(text, _("StartSource: %s\nStartProject: %s\nLength: %s\n"),
+               Units::totext(text_startsource, startsource,
+                       time_format, sample_rate, frame_rate, frames_per_foot),
+               Units::totext(text_startproject, startproject,
+                       time_format, sample_rate, frame_rate, frames_per_foot),
+               Units::totext(text_length, length,
+                       time_format, sample_rate, frame_rate, frames_per_foot));
+       show_text = new TrackPopupShowText(this, mwindow, x+15, y+10, text);
+       add_subwindow(show_text);
+       add_tool(new BC_OKButton(this));
+
+       show_window();
+       flush();
+       unlock_window();
+}
+
+
+TrackPopupShowText::TrackPopupShowText(TrackPopupShowWindow *window,
+       MWindow *mwindow, int x, int y, const char *text)
+ : BC_TextBox(x, y, 250, 4, text)
+{
+       this->window = window;
+       this->mwindow = mwindow;
+}
+
+TrackPopupShowText::~TrackPopupShowText()
+{
+}
+
index 539385e039f188d7a67d8d71eff550da3fddc912..b8042f34db4fbdb719b3eaf021a8b8fa2f7f5eb1 100644 (file)
@@ -23,6 +23,7 @@
 #define __TRACKPOPUP_H__
 
 #include "guicast.h"
+#include "colorpicker.h"
 #include "mwindow.inc"
 #include "mwindowgui.inc"
 #include "plugindialog.inc"
@@ -92,16 +93,6 @@ public:
        TrackPopup *popup;
 };
 
-class TrackPopupFindAsset : public BC_MenuItem
-{
-public:
-       TrackPopupFindAsset(MWindow *mwindow, TrackPopup *popup);
-       int handle_event();
-       MWindow *mwindow;
-       TrackPopup *popup;
-};
-
-
 class TrackAttachEffect : public BC_MenuItem
 {
 public:
@@ -139,5 +130,157 @@ public:
        TrackPopup *popup;
 };
 
+class TrackPopupFindAsset : public BC_MenuItem
+{
+public:
+       TrackPopupFindAsset(MWindow *mwindow, TrackPopup *popup);
+       int handle_event();
+       MWindow *mwindow;
+       TrackPopup *popup;
+};
+
+class TrackPopupUserTitle : public BC_MenuItem
+{
+public:
+       TrackPopupUserTitle(MWindow *mwindow, TrackPopup *popup);
+       ~TrackPopupUserTitle();
+
+       int handle_event();
+
+       MWindow *mwindow;
+       TrackPopup *popup;
+       TrackUserTitleDialogThread *dialog_thread;
+};
+
+class TrackPopupUserTitleText : public BC_TextBox
+{
+public:
+       TrackPopupUserTitleText(TrackPopupUserTitleWindow *window,
+               MWindow *mwindow, int x, int y, const char *text);
+       ~TrackPopupUserTitleText();
+       int handle_event();
+
+       MWindow *mwindow;
+       TrackPopupUserTitleWindow *window;
+};
+
+class TrackPopupUserTitleWindow : public BC_Window
+{
+public:
+       TrackPopupUserTitleWindow(MWindow *mwindow, TrackPopup *popup, int wx, int wy);
+       ~TrackPopupUserTitleWindow();
+
+       void create_objects();
+       void handle_close_event(int result);
+
+       TrackPopupUserTitleText *title_text;
+       MWindow *mwindow;
+       TrackPopup *popup;
+       char new_text[BCTEXTLEN];
+};
+
+class TrackUserTitleDialogThread : public BC_DialogThread
+{
+public:
+       TrackUserTitleDialogThread(TrackPopupUserTitle *edit_title);
+       ~TrackUserTitleDialogThread();
+
+       void handle_close_event(int result);
+       void handle_done_event(int result);
+       BC_Window* new_gui();
+       void start(int wx, int wy);
+
+       int wx, wy;
+       TrackPopupUserTitle *edit_title;
+       TrackPopupUserTitleWindow *window;
+};
+
+
+class TrackPopupTitleColor : public BC_MenuItem
+{
+public:
+       TrackPopupTitleColor(MWindow *mwindow, TrackPopup *popup);
+       ~TrackPopupTitleColor();
+
+       int handle_event();
+
+       MWindow *mwindow;
+       TrackPopup *popup;
+       TrackTitleColorPicker *color_picker;
+};
+
+class TrackTitleColorDefault : public BC_GenericButton
+{
+public:
+       TrackTitleColorDefault(TrackTitleColorPicker *color_picker, int x, int y);
+       int handle_event();
+
+       TrackTitleColorPicker *color_picker;
+};
+
+class TrackTitleColorPicker : public ColorPicker
+{
+public:
+       TrackTitleColorPicker(TrackPopup *popup, int color);
+       ~TrackTitleColorPicker();
+       void create_objects(ColorWindow *gui);
+       int handle_new_color(int color, int alpha);
+       void handle_done_event(int result);
+
+       TrackPopup *popup;
+       int color;
+};
+
+
+class TrackPopupShow : public BC_MenuItem
+{
+public:
+       TrackPopupShow(MWindow *mwindow, TrackPopup *popup);
+       ~TrackPopupShow();
+
+       int handle_event();
+
+       MWindow *mwindow;
+       TrackPopup *popup;
+       TrackShowDialogThread *dialog_thread;
+};
+
+class TrackShowDialogThread : public BC_DialogThread
+{
+public:
+       TrackShowDialogThread(TrackPopupShow *edit_show);
+       ~TrackShowDialogThread();
+       BC_Window* new_gui();
+       void start(int wx, int wy);
+       void handle_close_event(int result);
+
+       int wx, wy;
+       TrackPopupShow *edit_show;
+       TrackPopupShowWindow *window;
+};
+
+class TrackPopupShowText : public BC_TextBox
+{
+public:
+       TrackPopupShowText(TrackPopupShowWindow *window,
+               MWindow *mwindow, int x, int y, const char *text);
+       ~TrackPopupShowText();
+
+       TrackPopupShowWindow *window;
+       MWindow *mwindow;
+};
+
+class TrackPopupShowWindow : public BC_Window
+{
+public:
+       TrackPopupShowWindow(MWindow *mwindow, TrackPopup *popup, int wx, int wy);
+       ~TrackPopupShowWindow();
+
+       void create_objects();
+
+       TrackPopupShowText *show_text;
+       MWindow *mwindow;
+       TrackPopup *popup;
+};
 
 #endif
index 435e6dca19a660042b48d347dc6885d1d982651f..4dcf32871a6c92569b93e61f45d413e54ddc43c2 100644 (file)
@@ -29,7 +29,19 @@ class TrackPopupDeleteTrack;
 class TrackPopupAddTrack;
 class TrackPopupFindAsset;
 class TrackAttachEffect;
-class TrackMoveTrackUp;
-class TrackMoveTrackDown;
+class TrackMoveUp;
+class TrackMoveDown;
+class TrackPopupFindAsset;
+class TrackPopupUserTitle;
+class TrackPopupUserTitleText;
+class TrackPopupUserTitleWindow;
+class TrackUserTitleDialogThread;
+class TrackPopupTitleColor;
+class TrackTitleColorDefault;
+class TrackTitleColorPicker;
+class TrackPopupShow;
+class TrackShowDialogThread;
+class TrackPopupShowText;
+class TrackPopupShowWindow;
 
 #endif