drag+drop group highlight changes, fileref tweaks + warn, tweak awdw for ref/edl...
authorGood Guy <good1.2guy@gmail.com>
Wed, 15 Jan 2020 01:24:54 +0000 (18:24 -0700)
committerGood Guy <good1.2guy@gmail.com>
Wed, 15 Jan 2020 01:24:54 +0000 (18:24 -0700)
17 files changed:
cinelerra-5.1/cinelerra/appearanceprefs.C
cinelerra-5.1/cinelerra/appearanceprefs.h
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/loadfile.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/patchgui.C
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/cinelerra/preferences.h
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/wwindow.C
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/bcwindowbase.h
cinelerra-5.1/po/de.po
cinelerra-5.1/po/es.po
cinelerra-5.1/po/fr.po
cinelerra-5.1/po/it.po
cinelerra-5.1/po/ru.po

index b3718b7..6de4840 100644 (file)
@@ -214,6 +214,9 @@ void AppearancePrefs::create_objects()
        BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
        add_subwindow(bdwr_warn);
        y += bdwr_warn->get_h() + ys5;
+       UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
+       add_subwindow(warn_ref);
+       y += warn_ref->get_h() + ys5;
 
        x = get_w() / 3 + xs30;
        y = y1;
@@ -628,6 +631,20 @@ int BD_WarnRoot::handle_event()
        return 1;
 }
 
+UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
+       _("Warn on creating file references"))
+{
+       this->pwindow = pwindow;
+}
+
+int UseWarnFileRef::handle_event()
+{
+       pwindow->thread->preferences->warn_fileref = get_value();
+       return 1;
+}
+
+
 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
  : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
        _("Popups activate on button up"))
index 6c2473d..8c3ddae 100644 (file)
@@ -271,6 +271,14 @@ public:
        PreferencesWindow *pwindow;
 };
 
+class UseWarnFileRef : public BC_CheckBox
+{
+public:
+       UseWarnFileRef(PreferencesWindow *pwindow, int x, int y);
+       int handle_event();
+       PreferencesWindow *pwindow;
+};
+
 class PopupMenuBtnup : public BC_CheckBox
 {
 public:
index cabbbc0..dc884e5 100644 (file)
@@ -918,16 +918,25 @@ void AssetPicon::create_objects()
        int is_clip = 0;
 
        if( this->indexable ) {
-               fs.extract_name(name, indexable->path);
-               set_text(name);
-               if( this->indexable->is_asset )
+               char *cp = name;
+               if( this->indexable->is_asset ) {
                        asset = (Asset *)indexable;
-               else
+                       if( asset->format == FILE_REF ) {
+                               cp += sprintf(cp, "ref:");
+                               set_color(get_color() ^ 0x5599CC);
+                       }
+               }
+               else {
                        edl = (EDL *)indexable;
+                       cp += sprintf(cp, "edl:");
+                       set_color(get_color() ^ 0xCC9955);
+               }
+               fs.extract_name(cp, indexable->path);
+               set_text(name);
        }
        else if( this->edl ) {
                edl = this->edl;
-               set_text(strcpy(name, edl->local_session->clip_title));
+               strcpy(name, edl->local_session->clip_title);
                set_text(name);
                is_clip = 1;
        }
@@ -2068,10 +2077,6 @@ void AWindowGUI::update_asset_list()
                if( !exists ) {
                        AssetPicon *picon = new AssetPicon(mwindow,
                                this, current);
-                       if( current->format == FILE_REF ) {
-                               int color = picon->get_color();
-                               picon->set_color(color ^ 0x5599CC);
-                       }
                        new_assets.append(picon);
                }
        }
index 1b86ae7..e40f716 100644 (file)
@@ -36,6 +36,7 @@
 #include "mainsession.h"
 #include "mwindow.h"
 #include "mwindowgui.h"
+#include "preferences.h"
 #include "theme.h"
 
 
@@ -95,7 +96,6 @@ BC_Window* LoadFileThread::new_gui()
        sprintf(default_path, "~");
        mwindow->defaults->get("DEFAULT_LOADPATH", default_path);
        load_mode = mwindow->defaults->get("LOAD_MODE", load_mode);
-       edl_mode = mwindow->defaults->get("LOAD_EDL_MODE", edl_mode);
 
        mwindow->gui->lock_window("LoadFileThread::new_gui");
        window = new LoadFileWindow(mwindow, this, default_path);
@@ -118,8 +118,10 @@ void LoadFileThread::load_apply()
 {
        mwindow->defaults->update("DEFAULT_LOADPATH", window->get_submitted_path());
        mwindow->defaults->update("LOAD_MODE", load_mode);
-       mwindow->defaults->update("LOAD_EDL_MODE", edl_mode);
-
+       if( edl_mode == LOADMODE_EDL_FILEREF )
+               mwindow->show_warning(
+                       &mwindow->preferences->warn_fileref,
+                       _("Other projects can change this project"));
        ArrayList<char*> path_list;
        path_list.set_array_delete();
 
@@ -188,6 +190,8 @@ void LoadFileWindow::create_objects()
 
        int x = get_w() / 2 - LoadMode::calculate_w(this, mwindow->theme) / 2;
        int y = get_y_margin();
+// always start as clip to match historical behavior
+       thread->edl_mode = LOADMODE_EDL_CLIP;
        loadmode = new LoadMode(mwindow, this, x, y,
                &thread->load_mode, &thread->edl_mode, 0, 1);
        loadmode->create_objects();
@@ -267,7 +271,6 @@ int LoadPrevious::handle_event()
        path_list.set_array_delete();
        char *out_path;
        int load_mode = mwindow->defaults->get("LOAD_MODE", LOADMODE_REPLACE);
-       int edl_mode = mwindow->defaults->get("LOAD_EDL_MODE", LOADMODE_EDL_CLIP);
 
        path_list.append(out_path = new char[strlen(path) + 1]);
        strcpy(out_path, path);
@@ -277,7 +280,6 @@ int LoadPrevious::handle_event()
        path_list.remove_all_objects();
 
        mwindow->defaults->update("LOAD_MODE", load_mode);
-       mwindow->defaults->update("LOAD_EDL_MODE", edl_mode);
        mwindow->save_backup();
        mwindow->session->changes_made = 0;
        return 1;
index bd75cbb..c63c25b 100644 (file)
@@ -2139,14 +2139,12 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
                        session->group_number += groups;
                        switch( edl_mode ) {
                        case LOADMODE_EDL_CLIP: {
-                               sprintf(new_edl->local_session->clip_title, _("Clip %d"),
-                                       session->clip_number++);
-                               char string[BCSTRLEN];
-                               time_t t;  time(&t);
-                               ctime_r(&t, string);
-                               snprintf(new_edl->local_session->clip_notes,
-                                       sizeof(new_edl->local_session->clip_notes),
-                                       +("%sFrom: %s"), string, filename);
+                               strcpy(new_edl->local_session->clip_title,
+                                       filenames->get(i));
+                                       struct stat st;
+                               time_t t = !stat(filenames->get(i),&st) ?
+                                               st.st_mtime : time(&t);
+                               ctime_r(&t, new_edl->local_session->clip_notes);
                                switch( load_mode ) {
                                case LOADMODE_REPLACE:
                                case LOADMODE_REPLACE_CONCATENATE:
index 169ff60..e77c7db 100644 (file)
@@ -386,6 +386,7 @@ int RecordPatch::button_press_event()
                        get_resources()->text_background :
                        get_resources()->text_background_disarmed);
                patch->title->set_text_row(0);
+               mwindow->gui->draw_overlays(1);
                return 1;
        }
        return 0;
index ba69bd4..2b3f76f 100644 (file)
@@ -93,6 +93,7 @@ Preferences::Preferences()
        warn_indexes = 1;
        warn_version = 1;
        warn_stack = 1;
+       warn_fileref = 1;
        bd_warn_root = 1;
        popupmenu_btnup = 1;
        grab_input_focus = 1;
@@ -217,6 +218,7 @@ void Preferences::copy_from(Preferences *that)
        warn_indexes = that->warn_indexes;
        warn_version = that->warn_version;
        warn_stack = that->warn_stack;
+       warn_fileref = that->warn_fileref;
        bd_warn_root = that->bd_warn_root;
        popupmenu_btnup = that->popupmenu_btnup;
        grab_input_focus = that->grab_input_focus;
@@ -365,6 +367,7 @@ int Preferences::load_defaults(BC_Hash *defaults)
        warn_indexes = defaults->get("WARN_INDEXES", warn_indexes);
        warn_version = defaults->get("WARN_VERSION", warn_version);
        warn_stack = defaults->get("WARN_STACK", warn_stack);
+       warn_fileref = defaults->get("WARN_FILEREF", warn_fileref);
        bd_warn_root = defaults->get("BD_WARN_ROOT", bd_warn_root);
        popupmenu_btnup = defaults->get("POPUPMENU_BTNUP", popupmenu_btnup);
        grab_input_focus = defaults->get("GRAB_FOCUS", grab_input_focus);
@@ -511,6 +514,7 @@ int Preferences::save_defaults(BC_Hash *defaults)
        defaults->update("WARN_INDEXES", warn_indexes);
        defaults->update("WARN_VERSION", warn_version);
        defaults->update("WARN_STACK", warn_stack);
+       defaults->update("WARN_FILEREF", warn_fileref);
        defaults->update("BD_WARN_ROOT", bd_warn_root);
        defaults->update("POPUPMENU_BTNUP", popupmenu_btnup);
        defaults->update("GRAB_FOCUS", grab_input_focus);
index f20a791..e076457 100644 (file)
@@ -119,6 +119,7 @@ public:
        int warn_indexes;
        int warn_version;
        int warn_stack;
+       int warn_fileref;
        int bd_warn_root;
 // grab input focus on enter notify
        int grab_input_focus;
index f89bdab..2ac5ccc 100644 (file)
@@ -1680,9 +1680,16 @@ void TrackCanvas::draw_selected(int x, int y, int w, int h)
 
 void TrackCanvas::draw_selected_edits(EDL *edl, int dx, int dy, int color0, int color1)
 {
+       int dropping = 0;
        for( Track *track=edl->tracks->first; track; track=track->next ) {
+               if( !track->record && color1 < 0 ) {
+                       if( dropping )
+                               dy -= track->vertical_span(mwindow->theme);
+                       continue;
+               }
                for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
                        if( !edit->is_selected ) continue;
+                       dropping = 1;
                        int64_t x, y, w, h;
                        edit_dimensions(edit, x, y, w, h);
                        x += dx;  y += dy;
@@ -1691,10 +1698,10 @@ void TrackCanvas::draw_selected_edits(EDL *edl, int dx, int dy, int color0, int
                        set_opaque();
                        int inner = color1 < 0 ? color0 : !edit->group_id ? color0 :
                                mwindow->get_group_color(edit->group_id);
-                       set_color(inner);
-                       draw_selected(x, y, w, h);
                        int outer = color1 < 0 ? color0 : !edit->group_id ? color1 : inner;
-                       set_color(outer);
+                       set_color(track->record ? inner : outer);
+                       draw_selected(x, y, w, h);
+                       set_color(track->record ? outer : inner);
                        draw_selected(x-1, y-1, w+2, h+2);
                        draw_selected(x-2, y-2, w+1, h+1);
                }
@@ -5045,25 +5052,29 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
        return result;
 }
 
-
+// returns -1=doesnt fit, 1=fits, 0=fits but overwrites
 int TrackCanvas::test_track_group(EDL *group, Track *first_track, double &pos)
 {
+       int intersects = 0;
        Track *src = group->tracks->first;
        for( Track *track=first_track; track && src; track=track->next ) {
-               if( !track->record ) continue;
+               if( !track->record ) return -1;
                if( src->data_type != track->data_type ) return -1;
                for( Edit *src_edit=src->edits->first; src_edit; src_edit=src_edit->next ) {
                        if( src_edit->silence() ) continue;
-                       if( edit_intersects(track, src_edit, pos) ) return 0;
+                       if( !intersects && edit_intersects(track, src_edit, pos) )
+                               intersects = 1;
                }
                src = src->next;
        }
-       return !src ? 1 : 0;
+       return src ? -1 : !intersects ? 1 : 0;
 }
 
 int TrackCanvas::edit_intersects(Track *track, Edit *src_edit, double &pos)
 {
        if( pos < 0 ) { pos = 0;  return 1; }
+       int pane_no = pane->number;
+       int cur_pix = track->edl->get_position_cursorx(pos, pane_no);
        int64_t src_start = src_edit->startproject;
        int64_t src_end = src_start + src_edit->length;
        double new_start = src_edit->track->from_units(src_start) + pos;
@@ -5076,6 +5087,7 @@ int TrackCanvas::edit_intersects(Track *track, Edit *src_edit, double &pos)
                if( edit_start >= trk_end ) continue;
                int64_t edit_end = edit_start + edit->length;
                if( trk_start >= edit_end ) continue;
+
                int64_t lt_dist = labs(trk_end - edit_start);
                int64_t rt_dist = labs(edit_end - trk_start);
                int64_t position;
@@ -5093,7 +5105,10 @@ int TrackCanvas::edit_intersects(Track *track, Edit *src_edit, double &pos)
                        if( lt_dist > rt_dist )
                                position -= src_end;
                }
-               pos = edit->track->from_units(position);
+               double new_pos = edit->track->from_units(position);
+               int new_pix = track->edl->get_position_cursorx(new_pos, pane_no);
+               if( abs(new_pix-cur_pix) < HANDLE_W )
+                       pos = new_pos;
                return 1;
        }
        return 0;
index 4bb2399..5dfa358 100644 (file)
@@ -91,6 +91,7 @@ void WWindowGUI::create_objects()
        x = get_w() - BC_CancelButton::calculate_w() - xS(10);
        add_subwindow(new BC_CancelButton(x, y));
        show_window();
+       raise_window();
        unlock_window();
 }
 
index a12d71f..e861238 100644 (file)
@@ -4214,6 +4214,8 @@ void BC_WindowBase::set_force_tooltip(int v)
 
 int BC_WindowBase::raise_window(int do_flush)
 {
+       if( hidden ) return 1;
+       if( wait_viewable(500) ) return 1;
        XRaiseWindow(top_level->display, win);
        if(do_flush) XFlush(top_level->display);
        return 0;
@@ -4630,3 +4632,15 @@ void BC_WindowBase::focus()
                XSetInputFocus(top_level->display, top_level->win, RevertToParent, CurrentTime);
 }
 
+int BC_WindowBase::wait_viewable(int ms)
+{
+       Timer timer;
+       XWindowAttributes xwa;
+       do {
+               XGetWindowAttributes(top_level->display, top_level->win, &xwa);
+               if( xwa.map_state == IsViewable ) return 1;
+               usleep(10000);
+       } while( timer.get_difference() < ms );
+       return 0;
+}
+
index a38437b..7e36cd6 100644 (file)
@@ -504,6 +504,7 @@ public:
        void slide_down(int distance);
        void flicker(int n=3, int ms=66);
        void focus();
+       int wait_viewable(int ms);
 
        int cycle_textboxes(int amount);
 
index c85082f..edaa83f 100644 (file)
@@ -5852,7 +5852,7 @@ msgid "Nest sequence"
 msgstr "Nest-Sequenz"
 
 #: cinelerra/loadmode.C:118 cinelerra/loadmode.C:167
-msgid "Insertion strategy:"
+msgid "Load strategy:"
 msgstr "Einfügestrategie:"
 
 #: cinelerra/localsession.C:63
index 511d462..4fa976f 100644 (file)
@@ -5717,7 +5717,7 @@ msgid "Nest sequence"
 msgstr "Secuencia de anidado"
 
 #: cinelerra/loadmode.C:118 cinelerra/loadmode.C:167
-msgid "Insertion strategy:"
+msgid "Load strategy:"
 msgstr "Estrategia de inserción:"
 
 #: cinelerra/localsession.C:63
index e30d373..183c600 100644 (file)
@@ -5450,7 +5450,7 @@ msgid "Nest sequence"
 msgstr "Séquence Nest"
 
 #: cinelerra/loadmode.C:82 cinelerra/loadmode.C:102
-msgid "Insertion strategy:"
+msgid "Load strategy:"
 msgstr "Stratégie d'insertion :"
 
 #: cinelerra/localsession.C:63
index b011478..1d1064b 100644 (file)
@@ -4295,7 +4295,7 @@ msgid "Nest sequence"
 msgstr "Sequenza Nest"
 
 #: cinelerra//loadmode.C:82 cinelerra//loadmode.C:102
-msgid "Insertion strategy:"
+msgid "Load strategy:"
 msgstr "Modalità Inserimento:"
 
 #: cinelerra//localsession.C:63
index 686701e..7f1ed4a 100644 (file)
@@ -5768,7 +5768,7 @@ msgid "Nest sequence"
 msgstr "Вложенная последовательность"
 
 #: cinelerra/loadmode.C:118 cinelerra/loadmode.C:167
-msgid "Insertion strategy:"
+msgid "Load strategy:"
 msgstr "Стратегия открытия:"
 
 #: cinelerra/localsession.C:63