add adams 4.6->4.6.1 (mostly)
[goodguy/history.git] / cinelerra-5.0 / cinelerra / mwindowgui.C
index 4e8ee78ddd1ddb9cb43cbac840add1954dd67e91..8c5b4726ac33d7f3b9f1c34bae2233223c7165b5 100644 (file)
@@ -25,6 +25,7 @@
 #include "bcdisplayinfo.h"
 #include "bchash.h"
 #include "bcsignals.h"
+#include "clip.h"
 #include "cwindowgui.h"
 #include "cwindow.h"
 #include "channelinfo.h"
@@ -58,8 +59,9 @@
 #include "renderengine.h"
 #include "resourcethread.h"
 #include "samplescroll.h"
-#include "swindow.h"
+#include "shbtnprefs.h"
 #include "statusbar.h"
+#include "swindow.h"
 #include "theme.h"
 #include "trackcanvas.h"
 #include "trackscroll.h"
 #include "vwindow.h"
 #include "zoombar.h"
 
-#define PANE_DRAG_MARGIN 50
+#define PANE_DRAG_MARGIN MAX(mwindow->theme->pane_w, mwindow->theme->pane_h)
 
 
 // the main window uses its own private colormap for video
 MWindowGUI::MWindowGUI(MWindow *mwindow)
- : BC_Window(PROGRAM_NAME ": Program"
+ : BC_Window(_(PROGRAM_NAME ": Program")
                mwindow->session->mwindow_x, 
                mwindow->session->mwindow_y, 
                mwindow->session->mwindow_w, 
@@ -258,7 +260,10 @@ void MWindowGUI::create_objects()
        
        if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
 
-       add_subwindow(mainmenu = new MainMenu(mwindow, this));
+       int x = get_w() - MainShBtns::calculate_w(0);
+       add_subwindow(mainmenu = new MainMenu(mwindow, this, x));
+       add_subwindow(mainshbtns = new MainShBtns(mwindow, x, 0));
+       mainshbtns->load(mwindow->preferences);
        mwindow->theme->get_mwindow_sizes(this, get_w(), get_h());
        mwindow->theme->draw_mwindow_bg(this);
        mainmenu->create_objects();
@@ -385,12 +390,59 @@ int MWindowGUI::resize_event(int w, int h)
        mwindow->session->mwindow_h = h;
        mwindow->theme->get_mwindow_sizes(this, w, h);
        mwindow->theme->draw_mwindow_bg(this);
-//     mainmenu->reposition_window(0, 0, w, mainmenu->get_h());
        mbuttons->resize_event();
        statusbar->resize_event();
        
        resource_thread->stop_draw(1);
        
+       if(total_panes() > 1)
+       {
+               if(horizontal_panes())
+               {
+//                     printf("MWindowGUI::resize_event %d %d %d\n", 
+//                             __LINE__,
+//                             pane[TOP_RIGHT_PANE]->x,
+//                             mwindow->theme->mcanvas_w - 
+//                                     BC_ScrollBar::get_span(SCROLL_VERT) - 
+//                                     PANE_DRAG_MARGIN);
+                       if(pane[TOP_RIGHT_PANE]->x >= mwindow->theme->mcanvas_w - 
+                               BC_ScrollBar::get_span(SCROLL_VERT) - 
+                               PANE_DRAG_MARGIN)
+                       {
+                               delete_x_pane(pane[TOP_RIGHT_PANE]->x);
+                               mwindow->edl->local_session->x_pane = -1;
+                       }
+               }
+               else
+               if(vertical_panes())
+               {
+                       if(pane[BOTTOM_LEFT_PANE]->y >= mwindow->theme->mzoom_y - 
+                               BC_ScrollBar::get_span(SCROLL_HORIZ) - 
+                               PANE_DRAG_MARGIN)
+                       {
+                               delete_y_pane(pane[BOTTOM_LEFT_PANE]->y);
+                               mwindow->edl->local_session->y_pane = -1;
+                       }
+               }
+               else
+               {
+                       if(pane[TOP_RIGHT_PANE]->x >= mwindow->theme->mcanvas_w - 
+                                       BC_ScrollBar::get_span(SCROLL_VERT) - 
+                                       PANE_DRAG_MARGIN)
+                       {
+                               delete_x_pane(pane[TOP_RIGHT_PANE]->x);
+                               mwindow->edl->local_session->x_pane = -1;
+                       }
+                       
+                       if(pane[BOTTOM_LEFT_PANE]->y >= mwindow->theme->mzoom_y - 
+                               BC_ScrollBar::get_span(SCROLL_HORIZ) - 
+                               PANE_DRAG_MARGIN)
+                       {
+                               delete_y_pane(pane[BOTTOM_LEFT_PANE]->y);
+                               mwindow->edl->local_session->y_pane = -1;
+                       }
+               }
+       }
        
        if(total_panes() == 1)
        {
@@ -465,10 +517,14 @@ int MWindowGUI::resize_event(int w, int h)
        zoombar->resize_event();
        pane_button->reposition_window(w - mwindow->theme->get_image_set("pane")[0]->get_w(), 
                mwindow->theme->mzoom_y + 1 - mwindow->theme->get_image_set("pane")[0]->get_h());
+       int x = get_w() - MainShBtns::calculate_w(0);
+       mainmenu->resize_event(x, mainmenu->get_h());
+       mainshbtns->reposition_window(x, 0);
 //     get_scrollbars(0);
 //     canvas->resize_event();
 //printf("MWindowGUI::resize_event %d\n", __LINE__);
-       flash(0);
+// required to get new widgets to appear after a pane deletion
+       show_window();
        return 0;
 }
 
@@ -539,7 +595,7 @@ void MWindowGUI::update_title(char *path)
        FileSystem fs;
        char filename[BCTEXTLEN], string[BCTEXTLEN];
        fs.extract_name(filename, path);
-       sprintf(string, PROGRAM_NAME ": %s", filename);
+       sprintf(string, _(PROGRAM_NAME ": %s"), filename);
        set_title(string);
 //printf("MWindowGUI::update_title %s\n", string);
        flush();