From a4de4732339bf38b5b225c533be1bdf60748f04a Mon Sep 17 00:00:00 2001 From: Good Guy Date: Fri, 7 Apr 2017 11:48:26 -0600 Subject: [PATCH] asset drag/drop to viewers, bluebanana bug, listbox fontlist highlight --- cinelerra-5.1/cinelerra/awindowgui.C | 9 +++- cinelerra-5.1/cinelerra/cwindowgui.C | 48 +++++++------------ cinelerra-5.1/cinelerra/cwindowgui.h | 1 + cinelerra-5.1/cinelerra/indexfile.C | 8 ++-- cinelerra-5.1/cinelerra/mainsession.C | 2 - cinelerra-5.1/cinelerra/mainsession.h | 5 +- cinelerra-5.1/cinelerra/vwindowgui.C | 29 ++++------- cinelerra-5.1/cinelerra/vwindowgui.h | 1 + cinelerra-5.1/guicast/bclistbox.C | 13 +++-- .../plugins/bluebanana/bluebananacolor.c | 6 +-- 10 files changed, 49 insertions(+), 73 deletions(-) diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index a0ffb857..89080802 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -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(); } } diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index d4e62eed..a5cee351 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -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(); diff --git a/cinelerra-5.1/cinelerra/cwindowgui.h b/cinelerra-5.1/cinelerra/cwindowgui.h index e090cdea..931047e5 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.h +++ b/cinelerra-5.1/cinelerra/cwindowgui.h @@ -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; }; diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C index b62379b2..02ecb66a 100644 --- a/cinelerra-5.1/cinelerra/indexfile.C +++ b/cinelerra-5.1/cinelerra/indexfile.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/mainsession.C b/cinelerra-5.1/cinelerra/mainsession.C index 61256910..b9c18df6 100644 --- a/cinelerra-5.1/cinelerra/mainsession.C +++ b/cinelerra-5.1/cinelerra/mainsession.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/mainsession.h b/cinelerra-5.1/cinelerra/mainsession.h index de08e5aa..81b2439f 100644 --- a/cinelerra-5.1/cinelerra/mainsession.h +++ b/cinelerra-5.1/cinelerra/mainsession.h @@ -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; diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index 7fcd82a2..4dbdff28 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -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(); diff --git a/cinelerra-5.1/cinelerra/vwindowgui.h b/cinelerra-5.1/cinelerra/vwindowgui.h index 1f57703e..51971a8a 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.h +++ b/cinelerra-5.1/cinelerra/vwindowgui.h @@ -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); }; diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 88d4b094..960226f8 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -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 *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); } diff --git a/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c b/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c index f770d878..e4321b3a 100644 --- a/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c +++ b/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c @@ -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; } -- 2.26.2