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 b3718b755876affa5e6f5ff72dbc5a43ec8c2690..6de484032743ebb25625eefcfca6487ef72f1232 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 6c2473d6affc7227fbcd63a2ab1e6dc6f05fa062..8c3ddaecc6b596035ff0c7c1df83c31214af0190 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 cabbbc06fb1c86eda270c8bfed0c13ccb83a2027..dc884e55896a2d0729c7d07a58f15d7ab97dae87 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 1b86ae7bcaa78a3faf4749d6eaaab783f00b3077..e40f716109a14005ba1a0e4ea716afdea5f5ffdb 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 bd75cbbac482ef4196b6bce9407d31febefdb27c..c63c25bee2c8815e68d24684ef61758701388667 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 169ff60049ed24d843c783cb91fce92bfb4eb2ab..e77c7db509603b31a79fa402cb2391c956bcde8b 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 ba69bd48cb2245bc461976b84764440e7e4605fb..2b3f76fa9ac94184aaa2f3f708b22d2f0f849b0e 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 f20a791be9ef9efcd9eeeb7a8164c70be6711f85..e076457494a576a99e148558d4313318dda8dee5 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 f89bdab5a744522d46b645d6b4c5f7ff85691a3e..2ac5cccd290e6ee2c899d990b0ea5e5640df1679 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 4bb239909031c0c6b408e12ee34c09a4a9fa4938..5dfa3586020b56cefe0b7bc1c13c53f557cb63a2 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 a12d71f66fa61ee900eaceb936753b41c2f11c4b..e861238e388e177a041b093407513421cb1ea8c9 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 a38437bd77c87edc59460826182a108d8c46f12e..7e36cd67131e341a69715b2b7cb856db12c0102e 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 c85082f654239c551fb4cdf7d9cc991ea3bd872b..edaa83fac6adfcde7750c56799ca2556889ee1e4 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 511d462499a82cf67301e9a9042b5753000116fc..4fa976fc343fea5bb3412c3ea4d1b0e4a90792b9 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 e30d3730b1c87227df2d4cbc51ba7025eee8dea1..183c600fdb2e2ee0f69529e3199541ff00e208b9 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 b011478f774027e34e05a6e93557b7efd67968c9..1d1064bda1ea9b79a32403ed797f06c2ae1697db 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 686701ec93119f9f129ad4b1e1ebaafc2b1c37e3..7f1ed4a9273c335675a644fa2462a937208246bc 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