add gif ffmpeg format, changes for drag auto color boxes
authorGood Guy <good1.2guy@gmail.com>
Sun, 24 Feb 2019 21:35:52 +0000 (14:35 -0700)
committerGood Guy <good1.2guy@gmail.com>
Sun, 24 Feb 2019 21:35:52 +0000 (14:35 -0700)
cinelerra-5.1/cinelerra/statusbar.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/zoombar.C
cinelerra-5.1/cinelerra/zoombar.h
cinelerra-5.1/ffmpeg/video/gif.dfl [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/gif.gif [new file with mode: 0644]
cinelerra-5.1/guicast/bcpopupmenu.C
cinelerra-5.1/guicast/bcpopupmenu.h

index 4e86de5916f346b2926d6826cc33993d39dba551..6a0d622148658707f57eea0481add80b4a3bcee2 100644 (file)
@@ -105,7 +105,23 @@ void StatusBar::resize_event()
 
 void StatusBar::show_message(const char *text, int color)
 {
-       if( color < 0 ) color = mwindow->theme->message_normal;
+       int mx = mwindow->theme->mstatus_message_x;
+       int my = mwindow->theme->mstatus_message_y;
+       int tx = status_text->get_x(), th = status_text->get_h();
+       if( color >= 0 ) {
+               set_color(color);
+               int bb = th/4, bh = th - bb*2;
+               draw_box(mx+bb,my+bb, bh,bh);
+               flash(mx,my, th,th);  mx += 5;
+               if( (mx+=th) != tx )
+                       status_text->reposition_window(mx, my);
+       }
+       else if( tx != mx ) {
+               draw_top_background(get_parent(), mx,my, th,th);
+               flash(mx,my, th,th);
+               status_text->reposition_window(mx, my);
+       }
+       color = mwindow->theme->message_normal;
        status_text->set_color(color);
        status_text->update(text);
 }
index b9dd38841d4c7562a92849b52632ffcdd4457bbb..6e6eb3b2727a35b78dd3525fb7385e3874cd863b 100644 (file)
@@ -5322,6 +5322,7 @@ int TrackCanvas::button_press_event()
                                if( do_keyframes(cursor_x, cursor_y,
                                        0, get_buttonpress(), new_cursor,
                                        update_cursor, rerender) ) break;
+                               update_message = 1;
 // Test edit boundaries
                                if( do_edit_handles(cursor_x, cursor_y,
                                        1, rerender, update_overlay, new_cursor,
@@ -5342,7 +5343,6 @@ int TrackCanvas::button_press_event()
 
                                if( do_tracks(cursor_x, cursor_y, 1) ) break;
 
-                               update_message = 1;
                                result = 0;
                        } while(0);
                        else if( ibeam_mode() ) do {
@@ -5358,6 +5358,7 @@ int TrackCanvas::button_press_event()
                                        update_overlay = 1;
                                        break;
                                }
+                               update_message = 1;
 // Test edit boundaries
                                if( do_edit_handles(cursor_x, cursor_y,
                                        1, rerender, update_overlay, new_cursor, update_cursor) ) break;
@@ -5375,7 +5376,6 @@ int TrackCanvas::button_press_event()
                                if( get_buttonpress() != LEFT_BUTTON ) break;
                                rerender = start_selection(position);
                                mwindow->session->current_operation = SELECT_REGION;
-                               update_message = 1;
                                update_cursor = 1;
                        } while(0);
                }
index 79ecfd9cdf7da2bd319f77e06c9c3b93e22c954d..6ed44a6d1d85d55ff85703c89b878b831e2c96e2 100644 (file)
@@ -186,7 +186,7 @@ void ZoomBar::update_autozoom(int color)
        }
        auto_zoom_text->update(string);
        const char *group_name = AutoTypeMenu::to_text(autogroup_type);
-       auto_type->set_text(group_name, color);
+       auto_type->set_text(group_name);
 }
 
 
@@ -440,7 +440,7 @@ int AutoZoom::handle_down_event()
 
 
 AutoTypeMenu::AutoTypeMenu(MWindow *mwindow, ZoomBar *zoombar, int x, int y, int wid)
      : BC_PopupMenu(x, y, wid, to_text(mwindow->edl->local_session->zoombar_showautotype), 1)
+ : BC_PopupMenu(x, y, wid, to_text(mwindow->edl->local_session->zoombar_showautotype), 1)
 {
        this->mwindow = mwindow;
        this->zoombar = zoombar;
@@ -481,6 +481,20 @@ int AutoTypeMenu::from_text(char *text)
        return AUTOGROUPTYPE_INT255;
 }
 
+int AutoTypeMenu::draw_face(int dx)
+{
+       BC_PopupMenu::draw_face(dx);
+       int color = mwindow->edl->local_session->zoombar_showautocolor;
+       if( color >= 0 ) {
+               set_color(color);
+               int margin = get_margin();
+               int mx = margin+5, my = 3*margin/8;
+               int bh = get_h() - 2*my;
+               draw_box(mx,my, bh,bh);
+       }
+       return 1;
+}
+
 int AutoTypeMenu::handle_event()
 {
        mwindow->edl->local_session->zoombar_showautotype = from_text(this->get_text());
index 6c95a3b1d1d7eec33a75d933e407ec86974a2dd5..e2331e241a4e24a06a3e9f582e954f443e7f886c 100644 (file)
@@ -113,6 +113,7 @@ public:
        void create_objects();
        static const char* to_text(int shape);
        static int from_text(char *text);
+       int draw_face(int dx);
        int handle_event();
        MWindow *mwindow;
        ZoomBar *zoombar;
diff --git a/cinelerra-5.1/ffmpeg/video/gif.dfl b/cinelerra-5.1/ffmpeg/video/gif.dfl
new file mode 100644 (file)
index 0000000..9fcb061
--- /dev/null
@@ -0,0 +1 @@
+gif.gif
diff --git a/cinelerra-5.1/ffmpeg/video/gif.gif b/cinelerra-5.1/ffmpeg/video/gif.gif
new file mode 100644 (file)
index 0000000..d4b8979
--- /dev/null
@@ -0,0 +1,3 @@
+gif gif
+# full duration would require probe to read entire file
+# use file.opts with duration=<secs> to read animations
index 7ef71aec6d419ff487ace3979b0e4d7857e2fd84..80a02f6adc3b92790919763d1d06470efbbdfa07 100644 (file)
 #define TRIANGLE_H 10
 
 
-BC_PopupMenu::BC_PopupMenu(int x,
-               int y,
-               int w,
-               const char *text,
-               int use_title,
-               VFrame **data,
-               int margin)
+BC_PopupMenu::BC_PopupMenu(int x, int y, int w, const char *text,
+               int use_title, VFrame **data, int margin)
  : BC_SubWindow(x, y, 0, 0, -1)
 {
        highlighted = popup_down = 0;
@@ -57,21 +52,15 @@ BC_PopupMenu::BC_PopupMenu(int x,
                BC_WindowBase::get_resources()->popupmenu_margin;
        this->use_title = use_title;
        strcpy(this->text, text);
-       for(int i = 0; i < TOTAL_IMAGES; i++)
-       {
-               images[i] = 0;
-       }
+       for( int i=0; i<TOTAL_IMAGES; ++i ) images[i] = 0;
        this->data = data;
        this->w_argument = w;
        status = BUTTON_UP;
        pending = 0;
 }
 
-BC_PopupMenu::BC_PopupMenu(int x,
-               int y,
-               const char *text,
-               int use_title,
-               VFrame **data)
+BC_PopupMenu::BC_PopupMenu(int x, int y, const char *text,
+               int use_title, VFrame **data)
  : BC_SubWindow(x, y, 0, -1, -1)
 {
        highlighted = popup_down = 0;
@@ -80,10 +69,7 @@ BC_PopupMenu::BC_PopupMenu(int x,
        this->margin = BC_WindowBase::get_resources()->popupmenu_margin;
        this->use_title = use_title;
        strcpy(this->text, text);
-       for(int i = 0; i < TOTAL_IMAGES; i++)
-       {
-               images[i] = 0;
-       }
+       for( int i=0; i<TOTAL_IMAGES; ++i ) images[i] = 0;
        this->data = data;
        this->w_argument = -1;
        status = BUTTON_UP;
@@ -95,10 +81,7 @@ BC_PopupMenu::~BC_PopupMenu()
        use_title = 0;
        deactivate();
        delete menu_popup;
-       for(int i = 0; i < TOTAL_IMAGES; i++)
-       {
-               if(images[i]) delete images[i];
-       }
+       for( int i=0; i<TOTAL_IMAGES; ++i ) delete images[i];
 }
 
 char* BC_PopupMenu::get_text()
@@ -106,55 +89,45 @@ char* BC_PopupMenu::get_text()
        return text;
 }
 
-void BC_PopupMenu::set_text(const char *text, int color)
+void BC_PopupMenu::set_text(const char *text)
 {
-       if(use_title)
-       {
+       if( use_title ) {
                strcpy(this->text, text);
-               draw_title(1, color);
+               draw_title(1);
        }
 }
 
 void BC_PopupMenu::set_icon(BC_Pixmap *icon)
 {
-       if(use_title)
-       {
+       if( use_title ) {
                this->icon = icon;
-               if(menu_popup) draw_title(1);
+               if( menu_popup ) draw_title(1);
        }
 }
 
 int BC_PopupMenu::initialize()
 {
-       if(use_title)
-       {
-               if(data)
+       if( use_title ) {
+               if( data )
                        set_images(data);
                else
-               if(BC_WindowBase::get_resources()->popupmenu_images)
+               if( BC_WindowBase::get_resources()->popupmenu_images )
                        set_images(BC_WindowBase::get_resources()->popupmenu_images);
                else
                        set_images(BC_WindowBase::get_resources()->generic_button_images);
        }
-       else
+       else {
 // Move outside window if no title
-       {
-               x = -10;
-               y = -10;
-               w = 10;
-               h = 10;
+               x = -10;  y = -10;
+               w = 10;   h = 10;
        }
 
        BC_SubWindow::initialize();
 
        menu_popup = new BC_MenuPopup;
-       menu_popup->initialize(top_level,
-               0,
-               0,
-               0,
-               this);
+       menu_popup->initialize(top_level, 0, 0, 0, this);
 
-       if(use_title) draw_title(0);
+       if( use_title ) draw_title(0);
 
        return 0;
 }
@@ -162,19 +135,16 @@ int BC_PopupMenu::initialize()
 int BC_PopupMenu::set_images(VFrame **data)
 {
        BC_Resources *resources = get_resources();
-       for(int i = 0; i < 3; i++)
-       {
-               if(images[i]) delete images[i];
+       for( int i=0; i<3; ++i ) {
+               delete images[i];
                images[i] = new BC_Pixmap(parent_window, data[i], PIXMAP_ALPHA);
        }
 
-       if(w_argument >= 0)
-               w = w_argument +
-                       margin +
+       if( w_argument >= 0 )
+               w = w_argument + margin +
                        resources->popupmenu_triangle_margin;
        else
-               w = get_text_width(MEDIUMFONT, text) +
-                       margin +
+               w = get_text_width(MEDIUMFONT, text) + margin +
                        resources->popupmenu_triangle_margin;
 
        h = images[BUTTON_UP]->get_h();
@@ -190,14 +160,9 @@ int BC_PopupMenu::calculate_w(int w_argument)
 
 int BC_PopupMenu::calculate_h(VFrame **data)
 {
-       if(data)
-               ;
-       else
-       if(BC_WindowBase::get_resources()->popupmenu_images)
-               data = BC_WindowBase::get_resources()->popupmenu_images;
-       else
-               data = BC_WindowBase::get_resources()->generic_button_images;
-
+       if( !data ) data = BC_WindowBase::get_resources()->popupmenu_images ?
+               BC_WindowBase::get_resources()->popupmenu_images :
+               BC_WindowBase::get_resources()->generic_button_images ;
 
        return data[BUTTON_UP]->get_h();
 }
@@ -230,9 +195,14 @@ BC_MenuItem* BC_PopupMenu::get_item(int i)
        return menu_popup->menu_items.values[i];
 }
 
-int BC_PopupMenu::draw_title(int flush, int color)
+int BC_PopupMenu::get_margin()
+{
+       return margin;
+}
+
+int BC_PopupMenu::draw_face(int dx)
 {
-       if(!use_title) return 0;
+       if( !use_title ) return 0;
        BC_Resources *resources = get_resources();
 
 // Background
@@ -240,48 +210,47 @@ int BC_PopupMenu::draw_title(int flush, int color)
        draw_3segmenth(0, 0, w, images[status]);
 
 // Overlay text
-       if( color < 0 ) color = get_resources()->popup_title_text;
-       set_color(color);
-       int offset = 0;
-       if(status == BUTTON_DN)
-               offset = 1;
-       if(!icon)
-       {
+       set_color(get_resources()->popup_title_text);
+       int offset = status == BUTTON_DN ? 1 : 0;
+       int available_w = get_w() - margin*2 - resources->popupmenu_triangle_margin;
+       if( !icon ) {
                set_font(MEDIUMFONT);
                char truncated[BCTEXTLEN];
-               int available_w = get_w() - margin * 2 - resources->popupmenu_triangle_margin;
                truncate_text(truncated, text, available_w);
 
                BC_WindowBase::draw_center_text(
-                       available_w / 2 + margin + offset,
-                       (int)((float)get_h() / 2 + get_text_ascent(MEDIUMFONT) / 2 - 2) + offset,
+                       dx + available_w/2 + margin + offset,
+                       (int)((float)get_h()/2 + get_text_ascent(MEDIUMFONT)/2 - 2) + offset,
                        truncated);
        }
 
-       if(icon)
-       {
+       if( icon ) {
                draw_pixmap(icon,
-                       (get_w() - margin * 2 - resources->popupmenu_triangle_margin) / 2 + margin + offset - icon->get_w() / 2 ,
-                       get_h() / 2 - icon->get_h() / 2 + offset);
+                       available_w/ 2 + margin + offset - icon->get_w()/2 ,
+                       get_h()/2 - icon->get_h()/2 + offset);
        }
 
        if( use_title >= 0 )
-               draw_triangle_down_flat(get_w() - margin - resources->popupmenu_triangle_margin,
-                       get_h() / 2 - TRIANGLE_H / 2, TRIANGLE_W, TRIANGLE_H);
+               draw_triangle_down_flat(available_w + margin,
+                       get_h()/2 - TRIANGLE_H/2, TRIANGLE_W, TRIANGLE_H);
+       return 1;
+}
 
+int BC_PopupMenu::draw_title(int flush)
+{
+       draw_face(0);
        flash(flush);
        return 0;
 }
 
 int BC_PopupMenu::deactivate()
 {
-       if(popup_down)
-       {
+       if( popup_down ) {
                top_level->active_popup_menu = 0;
                popup_down = 0;
                menu_popup->deactivate_menu();
 
-               if(use_title) draw_title(1);    // draw the title
+               if( use_title ) draw_title(1);    // draw the title
        }
        return 0;
 }
@@ -298,23 +267,20 @@ int BC_PopupMenu::activate_menu()
 int BC_PopupMenu::menu_activate()
 {
        pending = 0;
-       if( !popup_down )
-       {
+       if( !popup_down ) {
                int x = this->x;
                int y = this->y;
 
                top_level->deactivate();
                top_level->active_popup_menu = this;
-               if(!use_title)
-               {
+               if( !use_title ) {
                        x = top_level->get_abs_cursor_x(0) - get_w();
                        y = top_level->get_abs_cursor_y(0) - get_h();
                        button_press_x = top_level->cursor_x;
                        button_press_y = top_level->cursor_y;
                }
 
-               if(use_title)
-               {
+               if( use_title ) {
                        Window tempwin;
                        int new_x, new_y;
                        XTranslateCoordinates(top_level->display,
@@ -326,7 +292,7 @@ int BC_PopupMenu::menu_activate()
                else
                        menu_popup->activate_menu(x+3, y+3, w, h, 0, 1);
                popup_down = 1;
-               if(use_title) draw_title(1);
+               if( use_title ) draw_title(1);
        }
        return 1;
 }
@@ -358,8 +324,7 @@ int BC_PopupMenu::repeat_event(int64_t duration)
 {
        if( status == BUTTON_HI &&
                tooltip_text && tooltip_text[0] != 0 &&
-               duration == top_level->get_resources()->tooltip_delay )
-       {
+               duration == top_level->get_resources()->tooltip_delay ) {
                show_tooltip();
                return 1;
        }
@@ -369,37 +334,35 @@ int BC_PopupMenu::repeat_event(int64_t duration)
 int BC_PopupMenu::button_press_event()
 {
        int result = 0;
-       if(get_buttonpress() == 1 &&
+       if( get_buttonpress() == 1 &&
                is_event_win() &&
-               use_title)
-       {
+               use_title ) {
                top_level->hide_tooltip();
-               if(status == BUTTON_HI || status == BUTTON_UP) status = BUTTON_DN;
+               if( status == BUTTON_HI || status == BUTTON_UP ) status = BUTTON_DN;
                activate_menu();
                draw_title(1);
                return 1;
        }
 
        // Scrolling section
-       if (is_event_win()
+       ifis_event_win()
                && (get_buttonpress() == 4 || get_buttonpress() == 5)
-               && menu_popup->total_items() > 1 )
-       {
+               && menu_popup->total_items() > 1  ) {
                int theval = -1;
-               for (int i = 0; i < menu_popup->total_items(); i++) {
-                       if (!strcmp(menu_popup->menu_items.values[i]->get_text(),get_text())) {
-                               theval=i;
+               for( int i=0; i<menu_popup->total_items(); ++i ) {
+                       if( !strcmp(menu_popup->menu_items.values[i]->get_text(),get_text()) ) {
+                               theval = i;
                                break;
                        }
                }
 
-               if (theval == -1)                  theval=0;
-               else if (get_buttonpress() == 4)   theval--;
-               else if (get_buttonpress() == 5)   theval++;
+               if( theval == -1 ) theval = 0;
+               else if( get_buttonpress() == 4 ) --theval;
+               else if( get_buttonpress() == 5 ) ++theval;
 
-               if (theval < 0)
-                       theval=0;
-               if (theval >= menu_popup->total_items())
+               if( theval < 0 )
+                       theval = 0;
+               else if( theval >= menu_popup->total_items() )
                        theval = menu_popup->total_items() - 1;
 
                BC_MenuItem *tmp = menu_popup->menu_items.values[theval];
@@ -408,8 +371,7 @@ int BC_PopupMenu::button_press_event()
                if( !result )
                        result = this->handle_event();
        }
-       if(popup_down)
-       {
+       if( popup_down ) {
 // Menu is down so dispatch to popup.
                menu_popup->dispatch_button_press();
                result = 1;
@@ -423,11 +385,9 @@ int BC_PopupMenu::button_release_event()
 // try the title
        int result = 0;
 
-       if(is_event_win() && use_title)
-       {
+       if( is_event_win() && use_title ) {
                hide_tooltip();
-               if(status == BUTTON_DN)
-               {
+               if( status == BUTTON_DN ) {
                        status = BUTTON_HI;
                        draw_title(1);
                }
@@ -456,15 +416,14 @@ int BC_PopupMenu::button_release_event()
 int BC_PopupMenu::translation_event()
 {
 //printf("BC_PopupMenu::translation_event 1\n");
-       if(popup_down) menu_popup->dispatch_translation_event();
+       if( popup_down ) menu_popup->dispatch_translation_event();
        return 0;
 }
 
 int BC_PopupMenu::cursor_leave_event()
 {
 
-       if(status == BUTTON_HI && use_title)
-       {
+       if( status == BUTTON_HI && use_title ) {
                status = BUTTON_UP;
                draw_title(1);
                hide_tooltip();
@@ -485,14 +444,12 @@ int BC_PopupMenu::cursor_leave_event()
 
 int BC_PopupMenu::cursor_enter_event()
 {
-       if(is_event_win() && use_title)
-       {
-               if(top_level->button_down)
-               {
+       if( is_event_win() && use_title ) {
+               if( top_level->button_down ) {
                        status = BUTTON_DN;
                }
                else
-               if(status == BUTTON_UP)
+               if( status == BUTTON_UP )
                        status = BUTTON_HI;
                draw_title(1);
        }
@@ -505,19 +462,19 @@ int BC_PopupMenu::cursor_motion_event()
        int result = 0;
 
 // This menu is down.
-       if(popup_down) {
+       if( popup_down ) {
                result = menu_popup->dispatch_motion_event();
        }
 
-       if(!result && use_title && is_event_win()) {
-               if(highlighted) {
-                       if(!cursor_inside()) {
+       if( !result && use_title && is_event_win() ) {
+               if( highlighted ) {
+                       if( !cursor_inside() ) {
                                highlighted = 0;
                                draw_title(1);
                        }
                }
                else {
-                       if(cursor_inside()) {
+                       if( cursor_inside() ) {
                                highlighted = 1;
                                draw_title(1);
                                result = 1;
@@ -531,25 +488,19 @@ int BC_PopupMenu::cursor_motion_event()
 int BC_PopupMenu::drag_start_event()
 {
 //printf("BC_PopupMenu::drag_start_event %d\n", popup_down);
-       if(popup_down) return 1;
+       if( popup_down ) return 1;
        return 0;
 }
 
 int BC_PopupMenu::drag_stop_event()
 {
-       if(popup_down) return 1;
+       if( popup_down ) return 1;
        return 0;
 }
 
 int BC_PopupMenu::drag_motion_event()
 {
-       if(popup_down) return 1;
+       if( popup_down ) return 1;
        return 0;
 }
 
-
-
-
-
-
-
index db79d20211d82aab797d50bd18c1e15eb052c292..fbf44e747ebd275ee2b7a482329c643679d85b61 100644 (file)
@@ -56,6 +56,7 @@ public:
        static int calculate_w(int w_argument);
        static int calculate_h(VFrame **data = 0);
        virtual int handle_event() { return 0; };
+       virtual int draw_face(int dx);
        char* get_text();
        int initialize();
        int add_item(BC_MenuItem *item);
@@ -63,12 +64,13 @@ public:
        int remove_item(BC_MenuItem *item);
        int total_items();
        BC_MenuItem* get_item(int i);
+       int get_margin();
 // Set title of menu
-       void set_text(const char *text, int color=-1);
+       void set_text(const char *text);
 // Set icon of menu.  Disables text.
        void set_icon(BC_Pixmap *pixmap);
 // Draw title of menu
-       int draw_title(int flush, int color=-1);
+       int draw_title(int flush);
        int reposition_window(int x, int y);
        int deactivate();
        int activate_menu();