asset drag/drop to viewers, bluebanana bug, listbox fontlist highlight
authorGood Guy <good1.2guy@gmail.com>
Fri, 7 Apr 2017 17:48:26 +0000 (11:48 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 7 Apr 2017 17:48:26 +0000 (11:48 -0600)
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/cwindowgui.h
cinelerra-5.1/cinelerra/indexfile.C
cinelerra-5.1/cinelerra/mainsession.C
cinelerra-5.1/cinelerra/mainsession.h
cinelerra-5.1/cinelerra/vwindowgui.C
cinelerra-5.1/cinelerra/vwindowgui.h
cinelerra-5.1/guicast/bclistbox.C
cinelerra-5.1/plugins/bluebanana/bluebananacolor.c

index a0ffb857e16caba8c56cb53b485f3dd5076e598e..89080802a7868c054ff3ca4da49cbd74d7de3783 100644 (file)
@@ -1758,12 +1758,17 @@ int AWindowAssets::drag_stop_event()
 
        if(!result)
        {
-               for(int i = 0; i < mwindow->vwindows.size(); i++)
+               for(int i = 0; !result && i < mwindow->vwindows.size(); i++)
                {
                        VWindow *vwindow = mwindow->vwindows.get(i);
+                       if( !vwindow ) continue;
                        if( !vwindow->is_running() ) continue;
+                       if( vwindow->gui->is_hidden() ) continue;
                        vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
-                       result = vwindow->gui->drag_stop();
+                       if( vwindow->gui->cursor_above() &&
+                           vwindow->gui->get_cursor_over_window() ) {
+                               result = vwindow->gui->drag_stop();
+                       }
                        vwindow->gui->unlock_window();
                }
        }
index d4e62eed5ea5e6b80b51768b305211ec36a54cc2..a5cee3517b579fa86795cb4015625b3093413a75 100644 (file)
@@ -109,6 +109,7 @@ CWindowGUI::CWindowGUI(MWindow *mwindow, CWindow *cwindow)
        inactive = 0;
        crop_translate = 0;
        eyedrop_visible = 0;
+       highlighted = 0;
 }
 
 CWindowGUI::~CWindowGUI()
@@ -570,43 +571,26 @@ void CWindowGUI::drag_motion()
 {
        if(get_hidden()) return;
 
-       if(mwindow->session->current_operation == DRAG_ASSET ||
-               mwindow->session->current_operation == DRAG_VTRANSITION ||
-               mwindow->session->current_operation == DRAG_VEFFECT)
-       {
-               int old_status = mwindow->session->ccanvas_highlighted;
-               int cursor_x = get_relative_cursor_x();
-               int cursor_y = get_relative_cursor_y();
-
-               mwindow->session->ccanvas_highlighted = get_cursor_over_window() &&
-                       cursor_x >= canvas->x &&
-                       cursor_x < canvas->x + canvas->w &&
-                       cursor_y >= canvas->y &&
-                       cursor_y < canvas->y + canvas->h;
-
-
-               if(old_status != mwindow->session->ccanvas_highlighted)
-                       canvas->draw_refresh();
-       }
+       if(mwindow->session->current_operation != DRAG_ASSET &&
+               mwindow->session->current_operation != DRAG_VTRANSITION &&
+               mwindow->session->current_operation != DRAG_VEFFECT) return;
+       int need_highlight = cursor_above() && get_cursor_over_window();
+       if( highlighted == need_highlight ) return;
+       highlighted = need_highlight;
+       canvas->draw_refresh();
 }
 
 int CWindowGUI::drag_stop()
 {
        int result = 0;
        if(get_hidden()) return 0;
-
-       if((mwindow->session->current_operation == DRAG_ASSET ||
-               mwindow->session->current_operation == DRAG_VTRANSITION ||
-               mwindow->session->current_operation == DRAG_VEFFECT) &&
-               mwindow->session->ccanvas_highlighted)
-       {
-// Hide highlighting
-               mwindow->session->ccanvas_highlighted = 0;
-               canvas->draw_refresh();
-               result = 1;
-       }
-       else
-               return 0;
+       if( !highlighted ) return 0;
+       if( mwindow->session->current_operation != DRAG_ASSET &&
+           mwindow->session->current_operation != DRAG_VTRANSITION &&
+           mwindow->session->current_operation != DRAG_VEFFECT) return 0;
+       highlighted = 0;
+       canvas->draw_refresh();
+       result = 1;
 
        if(mwindow->session->current_operation == DRAG_ASSET)
        {
@@ -2287,7 +2271,7 @@ void CWindowCanvas::draw_overlays()
                get_canvas()->set_opaque();
        }
 
-       if(mwindow->session->ccanvas_highlighted)
+       if(gui->highlighted)
        {
                get_canvas()->set_color(WHITE);
                get_canvas()->set_inverse();
index e090cdea92bc9d6bd3b861eb71c9851d533c403b..931047e599f6d621a5ff38c26a86ee77dacfe017 100644 (file)
@@ -153,6 +153,7 @@ public:
 // Must recalculate the origin when pressing shift.
 // Switch toggle on and off to recalculate origin.
        int translating_zoom;
+       int highlighted;
 };
 
 
index b62379b2c71108630c1d5f23fb33464da23c7462..02ecb66aceaa8e705e216e997baf712edb49c735 100644 (file)
@@ -866,12 +866,12 @@ int IndexFile::read_info(Indexable *test_indexable)
 // Read the file format & index state.
                if(test_indexable->is_asset)
                {
-                       Asset *asset = (Asset*)test_indexable;
-                       asset->read(&xml);
-
+                       Asset asset, *test_asset = (Asset *)test_indexable;
+                       asset.read(&xml);
 //printf("IndexFile::read_info %d %f\n", __LINE__, asset->get_frame_rate());
 
-                       if(asset->format == FILE_UNKNOWN)
+                       if( asset.format == FILE_UNKNOWN ||
+                           test_asset->format != asset.format )
                        {
 if(debug) printf("IndexFile::read_info %d\n", __LINE__);
                                return 1;
index 61256910e0f3772246184802984450b506c803fe..b9c18df6d360d2d9f45eb7f0c5c118421ca7671e 100644 (file)
@@ -42,8 +42,6 @@ MainSession::MainSession(MWindow *mwindow)
        track_highlighted = 0;
        plugin_highlighted = 0;
        pluginset_highlighted = 0;
-       vcanvas_highlighted = 0;
-       ccanvas_highlighted = 0;
        edit_highlighted = 0;
        current_operation = NO_OPERATION;
        drag_pluginservers = new ArrayList<PluginServer*>;
index de08e5aae9a56f2ea2327ae96067bfd3723f574a..81b2439ff3e30f9fabaa645ea5c16d9a8aa259f8 100644 (file)
@@ -38,6 +38,7 @@
 #include "pluginset.inc"
 #include "pluginserver.inc"
 #include "track.inc"
+#include "vwindowgui.inc"
 
 // Options not in EDL but not changed in preferences
 class MainSession
@@ -66,10 +67,6 @@ public:
        PluginSet *pluginset_highlighted;
 // The plugin after the point where the plugin is going to be dropped.
        Plugin *plugin_highlighted;
-// Viewer canvas highlighted
-       int vcanvas_highlighted;
-// Compositor canvas highlighted
-       int ccanvas_highlighted;
 // Current drag operation
        int current_operation;
 
index 7fcd82a264e75877385cb637e512a61fe6e4978c..4dbdff28fefc77e1c37b5b791b39dd7ac9eaf63c 100644 (file)
@@ -76,6 +76,7 @@ VWindowGUI::VWindowGUI(MWindow *mwindow, VWindow *vwindow)
        meters = 0;
 //     source = 0;
        strcpy(loaded_title, "");
+       highlighted = 0;
 }
 
 VWindowGUI::~VWindowGUI()
@@ -394,34 +395,20 @@ void VWindowGUI::drag_motion()
 // Window hidden
        if(get_hidden()) return;
        if(mwindow->session->current_operation != DRAG_ASSET) return;
-
-       int old_status = mwindow->session->vcanvas_highlighted;
-
-       int cursor_x = get_relative_cursor_x();
-       int cursor_y = get_relative_cursor_y();
-
-       mwindow->session->vcanvas_highlighted = (get_cursor_over_window() &&
-               cursor_x >= canvas->x &&
-               cursor_x < canvas->x + canvas->w &&
-               cursor_y >= canvas->y &&
-               cursor_y < canvas->y + canvas->h);
-
-
-//printf("VWindowGUI::drag_motion 1 %d %d %d %d %d\n", __LINE__,
-// mwindow->session->vcanvas_highlighted, get_cursor_over_window(), cursor_x, cursor_y);
-
-       if(old_status != mwindow->session->vcanvas_highlighted)
-               canvas->draw_refresh();
+       int need_highlight = cursor_above() && get_cursor_over_window() ? 1 : 0;
+       if( highlighted == need_highlight ) return;
+       highlighted = need_highlight;
+       canvas->draw_refresh();
 }
 
 int VWindowGUI::drag_stop()
 {
        if(get_hidden()) return 0;
 
-       if(mwindow->session->vcanvas_highlighted &&
+       if(highlighted &&
                mwindow->session->current_operation == DRAG_ASSET)
        {
-               mwindow->session->vcanvas_highlighted = 0;
+               highlighted = 0;
                canvas->draw_refresh();
 
                Indexable *indexable = mwindow->session->drag_assets->size() ?
@@ -878,7 +865,7 @@ void VWindowCanvas::draw_refresh(int flush)
 
 void VWindowCanvas::draw_overlays()
 {
-       if(mwindow->session->vcanvas_highlighted)
+       if( gui->highlighted )
        {
                get_canvas()->set_color(WHITE);
                get_canvas()->set_inverse();
index 1f57703ed470076412b70cfb051bfe75ed983a62..51971a8a49d189b7034b46cef81335c0f354f55e 100644 (file)
@@ -91,6 +91,7 @@ public:
        VWindowInPoint *in_point;
        VWindowOutPoint *out_point;
        char loaded_title[BCTEXTLEN];
+       int highlighted;
 private:
        void get_scrollbars(int &canvas_x, int &canvas_y, int &canvas_w, int &canvas_h);
 };
index 88d4b09470a8337a470f11f664f26b9e7edbf945..960226f8bfffc43116fb4134706efaef1555186b 100644 (file)
@@ -1362,6 +1362,8 @@ int BC_ListBox::get_text_mask(BC_ListBoxItem *item,
        {
                w = get_text_width(MEDIUMFONT, item->text) + LISTBOX_MARGIN * 2;
                h = row_height;
+               int ih = get_icon_h(item);
+               if( h < ih ) h = ih;
        }
        return 0;
 }
@@ -4404,9 +4406,14 @@ void BC_ListBox::draw_text_recursive(ArrayList<BC_ListBoxItem*> *data,
                                gui->set_color(row_color);
                                gui->draw_box(x, y, column_width, h);
                                gui->set_color(BLACK);
-                               int yy = y, xx = x + column_width-1;
-                               gui->draw_line(x, yy, xx, yy);
-                               yy = y + row_height;
+                               int xx = x + column_width-1;
+                               gui->draw_line(x, y, xx, y);
+                               int hh = row_height;
+                               if( display_format == LISTBOX_ICON_LIST ) {
+                                       int ih = get_icon_h(item);
+                                       if( ih > hh ) hh = ih;
+                               }
+                               int yy = y + hh-1;
                                gui->draw_line(x, yy, xx, yy);
                        }
 
index f770d878775053e2f266952d73091abefdada7d4..e4321b3ab7b8e697ffbaa132910ffde87c57bd55 100644 (file)
@@ -281,11 +281,7 @@ static inline void RGB_to_rgbF(float *R, float *G, float *B, float *S, float F,
 
 static inline void Aal_to_alpF(float *S, float F, float *row, int w, int bpp){
   if(S){
-    while(w--){
-      float a = *S*F;
-      row[3] = a;
-      row+=bpp;
-    }
+    while(w--){ row[3] = *S++ * F; row+=bpp; }
   }else{
     float a = F;
     while(w--){ row[3] = a; row+=bpp; }