picon dirs, new cinfinity picons, plugin info, rework text drawing, show msg, compres...
[goodguy/history.git] / cinelerra-5.1 / guicast / bcpopupmenu.C
index 71a172e43b62acbc9bf5edfe63a3c9565740b57c..8421a6bf46ef675f8a8ae11cbd173b1f976a022c 100644 (file)
@@ -94,7 +94,9 @@ BC_PopupMenu::BC_PopupMenu(int x,
 
 BC_PopupMenu::~BC_PopupMenu()
 {
-       if(menu_popup) delete menu_popup;
+       use_title = 0;
+       deactivate();
+       delete menu_popup;
        for(int i = 0; i < TOTAL_IMAGES; i++)
        {
                if(images[i]) delete images[i];
@@ -289,6 +291,7 @@ int BC_PopupMenu::activate_menu()
 {
        if( !get_button_down() || !BC_WindowBase::get_resources()->popupmenu_btnup )
                return menu_activate();
+       top_level->active_popup_menu = this;
        pending = 1;
        return 0;
 }
@@ -326,7 +329,7 @@ int BC_PopupMenu::menu_activate()
                popup_down = 1;
                if(use_title) draw_title(1);
        }
-       return 0;
+       return 1;
 }
 
 int BC_PopupMenu::deactivate_menu()
@@ -354,12 +357,11 @@ int BC_PopupMenu::focus_out_event()
 
 int BC_PopupMenu::repeat_event(int64_t duration)
 {
-       if( status == BUTTON_HI && !tooltip_done &&
+       if( status == BUTTON_HI &&
                tooltip_text && tooltip_text[0] != 0 &&
                duration == top_level->get_resources()->tooltip_delay )
        {
                show_tooltip();
-               tooltip_done = 1;
                return 1;
        }
        return 0;
@@ -484,7 +486,6 @@ int BC_PopupMenu::cursor_enter_event()
 {
        if(is_event_win() && use_title)
        {
-               tooltip_done = 0;
                if(top_level->button_down)
                {
                        status = BUTTON_DN;
@@ -503,25 +504,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 && top_level->event_win == 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())
-                       {
+               else {
+                       if(cursor_inside()) {
                                highlighted = 1;
                                draw_title(1);
                                result = 1;