fix popup_menu icon placement, add layout_name feature, preset edit resize wdw fix...
authorGood Guy <good1.2guy@gmail.com>
Fri, 15 Mar 2019 21:08:54 +0000 (15:08 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 15 Mar 2019 21:08:54 +0000 (15:08 -0600)
20 files changed:
cinelerra-5.1/cinelerra/asset.C
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/canvas.C
cinelerra-5.1/cinelerra/keyframegui.C
cinelerra-5.1/cinelerra/mainmenu.C
cinelerra-5.1/cinelerra/mainmenu.h
cinelerra-5.1/cinelerra/mainmenu.inc
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindow.inc
cinelerra-5.1/cinelerra/mwindowgui.C
cinelerra-5.1/cinelerra/mwindowmove.C
cinelerra-5.1/cinelerra/preferences.inc
cinelerra-5.1/cinelerra/renderengine.C
cinelerra-5.1/cinelerra/vpatchgui.C
cinelerra-5.1/cinelerra/zoombar.C
cinelerra-5.1/guicast/bcmenuitem.h
cinelerra-5.1/plugins/theme_neophyte/data/shbtn_dn.png
cinelerra-5.1/plugins/theme_neophyte/data/shbtn_hi.png
cinelerra-5.1/plugins/theme_neophyte/data/shbtn_up.png

index ad5c5c8d7ead8e57994a41a2f63aa1454c3f66a8..e2fc242a2c49f73a5a911a11dfdc0cdc255ddfb9 100644 (file)
@@ -949,7 +949,7 @@ int Asset::dump(FILE *fp)
                video_data, layers, program, frame_rate, width, height,
                vcodec, aspect_ratio,string);
        fprintf(fp,"   video_length %jd repeat %d\n", video_length, single_frame);
-       printf("   mov_sphere=%d jpeg_sphere=%d\n", mov_sphere, jpeg_sphere);
+       fprintf(fp,"   mov_sphere=%d jpeg_sphere=%d\n", mov_sphere, jpeg_sphere);
        return 0;
 }
 
index a88acce6cc95473fa02a2da27cf60d092e69651a..265f31ae33ef61307d136ca586552f50b065bddd 100644 (file)
@@ -1490,7 +1490,7 @@ void AWindowGUI::create_objects()
                int nw = get_text_width(MEDIUMFONT, _(av_names[i]));
                if( tw < nw )  tw = nw;
        }
-       int pw = BC_PopupMenu::calculate_w(4, tw, -1) + 16;
+       int pw = BC_PopupMenu::calculate_w(4, tw, 1) + 16;
        const char *text = _(AVIconDrawing::avicon_names[vicon_drawing]);
        add_subwindow(avicon_drawing = new AVIconDrawing(this, fw, fy, pw, text));
        avicon_drawing->create_objects();
@@ -3335,7 +3335,7 @@ int AVIconDrawingItem::handle_event()
 int AVIconDrawing::draw_face(int dx, int color)
 {
        int ret = BC_PopupMenu::draw_face(dx, color);
-       if( agui->play_off ) {
+       if( agui->play_off && agui->vicon_drawing != AVICON_NO_PLAY ) {
                int lx = get_margin(), ly = get_h()/2;
                draw_line(lx,ly, get_w()-2*lx,ly);
        }
@@ -3343,7 +3343,7 @@ int AVIconDrawing::draw_face(int dx, int color)
 }
 
 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, int w, const char *text)
- : BC_PopupMenu(x-w, y, w, text, -1, 0, 4)
+ : BC_PopupMenu(x-w, y, w, text, 1, 0, 4)
 {
        this->agui = agui;
 }
index 14e4351db0e84d2fc13f97ed8cc749b0c2d33cf6..85316aaa5aefce2ad5b4b8b27c9fd9adca544ad3 100644 (file)
@@ -767,8 +767,7 @@ void Canvas::create_canvas()
                int x, y, w, h;
                wdw->get_fullscreen_geometry(x, y, w, h);
 
-               if( canvas_fullscreen )
-               {
+               if( canvas_fullscreen ) {
                        if( x != canvas_fullscreen->get_x() ||
                            y != canvas_fullscreen->get_y() ||
                            w != canvas_fullscreen->get_w() ||
@@ -777,26 +776,21 @@ void Canvas::create_canvas()
                                canvas_fullscreen = 0;
                        }
                }
-               if(!canvas_fullscreen)
-               {
+               if( !canvas_fullscreen )
                        canvas_fullscreen = new CanvasFullScreen(this, w, h);
-               }
-               else
-               {
-                       canvas_fullscreen->reposition_window(x, y);
-                       canvas_fullscreen->show_window();
-               }
+               canvas_fullscreen->show_window();
+               canvas_fullscreen->sync_display();
+               canvas_fullscreen->reposition_window(x, y);
        }
 
-
-       if(!video_on)
-       {
+       if( !video_on ) {
                get_canvas()->lock_window("Canvas::create_canvas 1");
                draw_refresh();
                get_canvas()->unlock_window();
        }
 
-       if(video_on) get_canvas()->start_video();
+       if( video_on )
+               get_canvas()->start_video();
 
        get_canvas()->lock_window("Canvas::create_canvas 2");
        get_canvas()->focus();
index 49c9022900ce2e35620e8d0fdc00346af5c8f46c..03c8804b58b9c87bc171d063ef39c3fadd285e04 100644 (file)
@@ -74,6 +74,7 @@ KeyFrameThread::~KeyFrameThread()
 
 
 #ifdef EDIT_KEYFRAME
+
 void KeyFrameThread::update_values()
 {
 // Get the current selection before deleting the tables
@@ -139,8 +140,8 @@ void KeyFrameThread::update_values()
        }
        mwindow->gui->unlock_window();
 }
-#endif
 
+#endif
 
 void KeyFrameThread::start_window(Plugin *plugin, KeyFrame *keyframe)
 {
@@ -378,6 +379,7 @@ void KeyFrameThread::apply_preset(const char *title, int is_factory)
 }
 
 #ifdef EDIT_KEYFRAME
+
 void KeyFrameThread::apply_value()
 {
        const char *text = 0, *data = 0;
@@ -446,25 +448,16 @@ printf("KeyFrameThread::apply_value %d: plugin doesn't exist\n", __LINE__);
        get_gui()->lock_window("KeyFrameThread::apply_value");
        delete hash;
 }
-#endif
 
+#endif
 
 
-KeyFrameWindow::KeyFrameWindow(MWindow *mwindow,
-       KeyFrameThread *thread,
-       int x,
-       int y,
-       char *title_string)
- : BC_Window(title_string, 
-       x,
-       y,
-       mwindow->session->keyframedialog_w, 
-       mwindow->session->keyframedialog_h, 
-       320, 
-       240,
-       1,
-       0,
-       1)
+KeyFrameWindow::KeyFrameWindow(MWindow *mwindow, KeyFrameThread *thread,
+               int x, int y, char *title_string)
+ : BC_Window(title_string, x, y,
+               mwindow->session->keyframedialog_w, 
+               mwindow->session->keyframedialog_h, 
+               320, 240, 1, 0, 1)
 {
        this->mwindow = mwindow;
        this->thread = thread;
@@ -481,42 +474,40 @@ void KeyFrameWindow::create_objects()
 
 #ifdef EDIT_KEYFRAME
 
-
-       add_subwindow(title1 = new BC_Title(theme->keyframe_list_x,
-               theme->keyframe_list_y - BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) - 
-                       theme->widget_border, _("Keyframe parameters:"), LARGEFONT));
-       add_subwindow(keyframe_list = new KeyFrameList(thread,
-               this,
-               theme->keyframe_list_x,
-               theme->keyframe_list_y,
-               theme->keyframe_list_w, 
-               theme->keyframe_list_h));
+       int ky = theme->keyframe_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       add_subwindow(title1 = new BC_Title(theme->keyframe_list_x, ky,
+                       _("Keyframe parameters:"), LARGEFONT));
+       add_subwindow(keyframe_list = new KeyFrameList(thread, this,
+               theme->keyframe_list_x, theme->keyframe_list_y,
+               theme->keyframe_list_w, theme->keyframe_list_h));
 //     add_subwindow(title2 = new BC_Title(theme->keyframe_text_x,
-//             theme->keyframe_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border,
-//             _("Global Text:")));
-//     add_subwindow(keyframe_text = new KeyFrameText(thread,
-//             this,
-//             theme->keyframe_text_x,
-//             theme->keyframe_text_y,
+//             theme->keyframe_text_y - theme->widget_border -
+//                     BC_Title::calculate_h(this, "P"), _("Global Text:")));
+//     add_subwindow(keyframe_text = new KeyFrameText(thread, this,
+//             theme->keyframe_text_x, theme->keyframe_text_y,
 //             theme->keyframe_text_w));
-       add_subwindow(title3 = new BC_Title(theme->keyframe_value_x,
-               theme->keyframe_value_y - BC_Title::calculate_h(this, (char*)"P") -
-                       theme->widget_border, _("Edit value:")));
+       int ey = theme->keyframe_value_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "P");
+       add_subwindow(title3 = new BC_Title(theme->keyframe_value_x, ey,
+                       _("Edit value:")));
        add_subwindow(value_text = new KeyFrameValue(thread, this,
                theme->keyframe_value_x, theme->keyframe_value_y, theme->keyframe_value_w));
        add_subwindow(all_toggle = new KeyFrameAll(thread, this, 
                theme->keyframe_all_x, theme->keyframe_all_y));
 
 #endif
-       add_subwindow(title4 = new BC_Title(theme->presets_list_x, theme->presets_list_y - 
-                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) - 
-                       theme->widget_border, _("Presets:"), LARGEFONT));
+       int ty = theme->presets_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       add_subwindow(title4 = new BC_Title(theme->presets_list_x, ty,
+                       _("Presets:"), LARGEFONT));
        add_subwindow(preset_list = new KeyFramePresetsList(thread, this,
                theme->presets_list_x, theme->presets_list_y,
                theme->presets_list_w, theme->presets_list_h));
-       add_subwindow(title5 = new BC_Title(theme->presets_text_x,
-               theme->presets_text_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border,
-               _("Preset title:")));
+       int py = theme->presets_text_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "Py");
+       add_subwindow(title5 = new BC_Title(theme->presets_text_x, py,
+                       _("Preset title:")));
        add_subwindow(preset_text = new KeyFramePresetsText(thread, this,
                theme->presets_text_x, theme->presets_text_y, theme->presets_text_w));
        add_subwindow(delete_preset = new KeyFramePresetsDelete(thread, this,
@@ -546,8 +537,6 @@ void KeyFrameWindow::update_editing()
        }
 }
 
-
-
 int KeyFrameWindow::resize_event(int w, int h)
 {
        Theme *theme = mwindow->theme;
@@ -556,35 +545,33 @@ int KeyFrameWindow::resize_event(int w, int h)
        theme->get_keyframedialog_sizes(this);
 
 #ifdef EDIT_KEYFRAME
-
-       title1->reposition_window(theme->keyframe_list_x,
-               theme->keyframe_list_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
+       int ky = theme->keyframe_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       title1->reposition_window(theme->keyframe_list_x, ky);
 //     title2->reposition_window(theme->keyframe_text_x,
-//             theme->keyframe_text_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
-       title3->reposition_window(theme->keyframe_value_x,
-               theme->keyframe_value_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
-       keyframe_list->reposition_window(theme->keyframe_list_x,
-               theme->keyframe_list_y,
-               theme->keyframe_list_w, 
-               theme->keyframe_list_h);
-//     text->reposition_window(theme->keyframe_text_x,
-//             theme->keyframe_text_y,
-//             theme->keyframe_text_w);
+//             theme->keyframe_text_y - theme->widget_border -;
+//                     BC_Title::calculate_h(this, (char*)"P"));
+       int ey = theme->keyframe_value_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "P");
+       title3->reposition_window(theme->keyframe_value_x, ey);
+       keyframe_list->reposition_window(theme->keyframe_list_x, theme->keyframe_list_y,
+                       theme->keyframe_list_w, theme->keyframe_list_h);
+//     text->reposition_window(theme->keyframe_text_x, theme->keyframe_text_y,
+//                     theme->keyframe_text_w);
        value_text->reposition_window(theme->keyframe_value_x,
                theme->keyframe_value_y,
                theme->keyframe_value_w);
        all_toggle->reposition_window(theme->keyframe_all_x,
                theme->keyframe_all_y);
 
-#endif // EDIT_KEYFRAME
-
-
-
+       int ty = theme->presets_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       title4->reposition_window(theme->presets_list_x, ty);
+       int py = theme->presets_text_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "Py");
+       title5->reposition_window(theme->presets_text_x, py);
+#endif
 
-       title4->reposition_window(theme->presets_list_x,
-               theme->presets_list_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
-       title5->reposition_window(theme->presets_text_x,
-               theme->presets_text_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
        preset_list->reposition_window(theme->presets_list_x,
                theme->presets_list_y,
                theme->presets_list_w, 
@@ -607,7 +594,6 @@ int KeyFrameWindow::resize_event(int w, int h)
 
 #ifdef EDIT_KEYFRAME
 
-
 KeyFrameList::KeyFrameList(KeyFrameThread *thread,
        KeyFrameWindow *window, int x, int y, int w, int h)
  : BC_ListBox(x, y, w, h, LISTBOX_TEXT, thread->keyframe_data,
@@ -639,8 +625,6 @@ int KeyFrameList::column_resize_event()
 }
 
 
-
-
 // KeyFrameText::KeyFrameText(KeyFrameThread *thread,
 //     KeyFrameWindow *window,
 //     int x,
@@ -661,8 +645,6 @@ int KeyFrameList::column_resize_event()
 //     return 0;
 // }
 
-
-
 KeyFrameValue::KeyFrameValue(KeyFrameThread *thread,
        KeyFrameWindow *window,
        int x,
@@ -684,16 +666,9 @@ int KeyFrameValue::handle_event()
        return 0;
 }
 
-
-
-
-
 KeyFrameAll::KeyFrameAll(KeyFrameThread *thread,
-       KeyFrameWindow *window,
-       int x,
-       int y)
- : BC_CheckBox(x, 
-       y, 
+               KeyFrameWindow *window, int x, int y)
+ : BC_CheckBox(x, y, 
        thread->mwindow->session->keyframedialog_all, 
        _("Apply to all selected keyframes"))
 {
@@ -710,26 +685,9 @@ int KeyFrameAll::handle_event()
 #endif // EDIT_KEYFRAME
 
 
-
-
-
-
-
-
-
-
 KeyFramePresetsList::KeyFramePresetsList(KeyFrameThread *thread,
-       KeyFrameWindow *window,
-       int x,
-       int y,
-       int w, 
-       int h)
- : BC_ListBox(x, 
-               y, 
-               w, 
-               h,
-               LISTBOX_TEXT,
-               thread->presets_data)
+       KeyFrameWindow *window, int x, int y, int w, int h)
+ : BC_ListBox(x, y, w, h, LISTBOX_TEXT, thread->presets_data)
 {
        this->thread = thread;
        this->window = window;
@@ -815,12 +773,6 @@ int KeyFramePresetsSave::handle_event()
 }
 
 
-
-
-
-
-
-
 KeyFramePresetsApply::KeyFramePresetsApply(KeyFrameThread *thread,
        KeyFrameWindow *window,
        int x,
index da1dbd3396365457ed0f73271f1c52374940e128..2fb2fcf9f73345dcd5c01a595c427ad1681222e1 100644 (file)
@@ -1617,10 +1617,10 @@ int TileMixers::handle_event()
 }
 
 
-LoadLayoutItem::LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey)
+LoadLayoutItem::LoadLayoutItem(LoadLayout *load_layout, const char *text, int idx, int hotkey)
  : BC_MenuItem(text, "", hotkey)
 {
-       this->no = no;
+       this->idx = idx;
        this->load_layout = load_layout;
        if( hotkey ) {
                char hot_txt[BCSTRLEN];
@@ -1630,16 +1630,19 @@ LoadLayoutItem::LoadLayoutItem(LoadLayout *load_layout, const char *text, int no
        }
 }
 
+
 int LoadLayoutItem::handle_event()
 {
        MWindow *mwindow = load_layout->mwindow;
        switch( load_layout->action ) {
        case LAYOUT_LOAD:
-               mwindow->load_layout(no);
-               break;
-       case LAYOUT_SAVE:
-               mwindow->save_layout(no);
+               mwindow->load_layout(layout_file);
                break;
+       case LAYOUT_SAVE: {
+               int wx = 0, wy = 0;
+               mwindow->gui->get_abs_cursor(wx, wy);
+               load_layout->layout_dialog->start_confirm_dialog(wx, wy, idx);
+               break; }
        }
        return 1;
 }
@@ -1649,19 +1652,185 @@ LoadLayout::LoadLayout(MWindow *mwindow, const char *text, int action)
 {
        this->mwindow = mwindow;
        this->action = action;
+       this->layout_dialog = new LoadLayoutDialog(this);
+}
+
+LoadLayout::~LoadLayout()
+{
+       delete layout_dialog;
 }
 
 void LoadLayout::create_objects()
 {
        BC_SubMenu *layout_submenu = new BC_SubMenu();
        add_submenu(layout_submenu);
-       for( int i=1; i<=4; ++i ) {
+
+       for( int i=0; i<LAYOUTS_MAX; ++i ) {
                char text[BCSTRLEN];
-               sprintf(text, _("Layout %d"), i);
-               LoadLayoutItem *load_layout_item =
-                       new LoadLayoutItem(this, text, i,
-                               action==LAYOUT_LOAD ? KEY_F1-1+i : 0);
-               layout_submenu->add_submenuitem(load_layout_item);
+               sprintf(text, _("Layout %d"), i+1);
+               LoadLayoutItem *item = new LoadLayoutItem(this, text, i,
+                               action==LAYOUT_LOAD ? KEY_F1+i : 0);
+               layout_submenu->add_submenuitem(item);
        }
 }
 
+int LoadLayout::activate_submenu()
+{
+       update();
+       return BC_MenuItem::activate_submenu();
+}
+
+void LoadLayout::update()
+{
+       FileSystem fs;
+       fs.set_filter("layout*_rc");
+       int ret = fs.update(File::get_config_path());
+       int sz = !ret ? fs.dir_list.size() : 0;
+       BC_SubMenu *layout_submenu = get_submenu();
+
+       for( int i=0; i<LAYOUTS_MAX; ++i ) {
+               LoadLayoutItem* item = (LoadLayoutItem *)
+                       layout_submenu->get_item(i);
+               char layout_text[BCSTRLEN];  layout_text[0] = 0;
+               int n = sz, id = i+1;
+               while( --n >= 0 ) {
+                       char *np = fs.dir_list[n]->name;
+                       char *cp = strrchr(np, '_'), *bp = 0;
+                       int no = strtol(np+6, &bp, 10);
+                       if( no != id || !bp ) continue;
+                       if( bp == cp ) {  n = -1;  break; }
+                       if( *bp++ == '_' && bp < cp && !strcmp(cp, "_rc") ) {
+                               int k = cp - bp;  char *tp = layout_text;
+                               if( k > LAYOUT_NAME_LEN ) k = LAYOUT_NAME_LEN;
+                               while( --k >= 0 ) *tp++ = *bp++;
+                               *tp = 0;
+                               break;
+                       }
+               }
+               strcpy(item->layout_text, layout_text);
+               char *lp = item->layout_file;
+               int k = sprintf(lp, LAYOUT_FILE, id);
+               if( n >= 0 && layout_text[0] )
+                       sprintf(lp + k-2, "%s_rc", layout_text);
+               else
+                       sprintf(layout_text, _("Layout %d"), id);
+               item->set_text(layout_text);
+       }
+}
+
+LoadLayoutDialog::LoadLayoutDialog(LoadLayout *load_layout)
+{
+       this->load_layout = load_layout;
+       wx = 0;  wy = 0;
+       idx = -1;
+       lgui = 0;
+}
+
+LoadLayoutDialog::~LoadLayoutDialog()
+{
+       close_window();
+}
+
+void LoadLayoutDialog::handle_done_event(int result)
+{
+       if( result ) return;
+       char layout_file[BCSTRLEN];
+       BC_SubMenu *layout_submenu = load_layout->get_submenu();
+       LoadLayoutItem* item =
+               (LoadLayoutItem *) layout_submenu->get_item(idx);
+       snprintf(layout_file, sizeof(layout_file), "%s", item->layout_file);
+       load_layout->mwindow->delete_layout(layout_file);
+       int k = sprintf(layout_file, LAYOUT_FILE, idx+1);
+       const char *text = lgui->name_text->get_text();
+       if( text[0] )
+               snprintf(layout_file + k-2, sizeof(layout_file)-k+2, "%s_rc", text);
+       load_layout->mwindow->save_layout(layout_file);
+}
+
+void LoadLayoutDialog::handle_close_event(int result)
+{
+       lgui = 0;
+}
+
+BC_Window *LoadLayoutDialog::new_gui()
+{
+       lgui = new LoadLayoutConfirm(this, wx, wy);
+       lgui->create_objects();
+       return lgui;
+}
+
+void LoadLayoutDialog::start_confirm_dialog(int wx, int wy, int idx)
+{
+       close_window();
+       this->wx = wx;  this->wy = wy;
+       this->idx = idx;
+       start();
+}
+
+LoadLayoutNameText::LoadLayoutNameText(LoadLayoutConfirm *confirm,
+               int x, int y, int w, const char *text)
+ : BC_TextBox(x, y, w, 1, text)
+{
+       this->confirm = confirm;
+}
+
+LoadLayoutNameText::~LoadLayoutNameText()
+{
+}
+
+int LoadLayoutNameText::handle_event()
+{
+       const char *text = get_text();
+       int len = strlen(text), k = 0;
+       char new_text[BCTEXTLEN];
+       for( int i=0; i<len; ++i ) {
+               int ch = text[i];
+               if( (ch>='A' && ch<='Z') || (ch>='a' && ch<='z') ||
+                   (ch>='0' && ch<='9') || ch=='_' )
+                       new_text[k++] = ch;
+       }
+       new_text[k] = 0;  len = k;
+       int i = len - LAYOUT_NAME_LEN;
+       if( i >= 0 ) {
+               k = 0;
+               while( i < len ) new_text[k++] = new_text[i++];
+               new_text[k] = 0;
+       }
+       update(new_text);
+       return 1;
+}
+
+LoadLayoutConfirm::LoadLayoutConfirm(LoadLayoutDialog *layout_dialog, int x, int y)
+ : BC_Window(_(PROGRAM_NAME ": Layout"), x, y, 300,140, 300,140, 0)
+{
+       this->layout_dialog = layout_dialog;
+}
+
+LoadLayoutConfirm::~LoadLayoutConfirm()
+{
+}
+
+void LoadLayoutConfirm::create_objects()
+{
+       lock_window("LoadLayoutConfirm::create_objects");
+       int x = 10, y = 10, pad = 10;
+       BC_SubMenu *layout_submenu = layout_dialog->load_layout->get_submenu();
+       LoadLayoutItem *item = (LoadLayoutItem *)
+               layout_submenu->get_item(layout_dialog->idx);
+       BC_Title *title;
+       add_subwindow(title = new BC_Title(x, y, _("Layout Name:")));
+       int x1 = x + title->get_w() + 10;
+       add_subwindow(title = new BC_Title(x1, y, item->get_text()));
+       y += title->get_h() + pad;
+       add_subwindow(name_text = new LoadLayoutNameText(this,
+               x, y, get_w()-x-20, item->layout_text));
+       y += name_text->get_h();
+       x1 = x + 80;
+       char legend[BCTEXTLEN];
+       sprintf(legend, _("a-z,A-Z,0-9_ only, %dch max"), LAYOUT_NAME_LEN);
+       add_subwindow(title = new BC_Title(x1, y, legend));
+       add_subwindow(new BC_OKButton(this));
+       add_subwindow(new BC_CancelButton(this));
+       unlock_window();
+}
+
index 2e965f41bcda8dd747026e5ae2ce547fbbe05b76..64c86591c8d741968e6f007b5bbad4dfb8f9d46f 100644 (file)
@@ -721,7 +721,9 @@ public:
        LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey);
        int handle_event();
 
-       int no;
+       int idx;
+       char layout_text[BCSTRLEN];
+       char layout_file[BCSTRLEN];
        LoadLayout *load_layout;
 };
 
@@ -729,10 +731,53 @@ class LoadLayout : public BC_MenuItem
 {
 public:
        LoadLayout(MWindow *mwindow, const char *text, int action);
+       ~LoadLayout();
        void create_objects();
+       void update();
+       int activate_submenu();
 
        MWindow *mwindow; 
+       LoadLayoutDialog *layout_dialog;
        int action;
 };
 
+class LoadLayoutDialog : public BC_DialogThread
+{
+public:
+       LoadLayoutDialog(LoadLayout *load_layout);
+       ~LoadLayoutDialog();
+
+       void start_confirm_dialog(int wx, int wy, int idx);
+       void handle_done_event(int result);
+       void handle_close_event(int result);
+       BC_Window* new_gui();
+
+       LoadLayout *load_layout;
+       LoadLayoutConfirm *lgui;
+       int wx, wy, idx;
+};
+
+class LoadLayoutNameText : public BC_TextBox
+{
+public:
+       LoadLayoutNameText(LoadLayoutConfirm *confirm,
+               int x, int y, int w, const char *text);
+       ~LoadLayoutNameText();
+
+       int handle_event();
+
+       LoadLayoutConfirm *confirm;
+};
+
+class LoadLayoutConfirm : public BC_Window
+{
+public:
+       LoadLayoutConfirm(LoadLayoutDialog *load_dialog, int x, int y);
+       ~LoadLayoutConfirm();
+       void create_objects();
+
+       LoadLayoutDialog *layout_dialog;
+       LoadLayoutNameText *name_text;
+};
+
 #endif
index e372c2b678313e469e865d6b6403d3a34989bffb..81dd0c10ff0c71604266d1ec1732834116c7d949 100644 (file)
 #ifndef MAINMENU_INC
 #define MAINMENU_INC
 
-class MainMenu;
 #define MENUBARPIXELS 25
 
-class AEffectMenu;
-class LabelsFollowEdits;
-class PluginsFollowEdits;
-class KeyframesFollowEdits;
-class CursorOnFrames;
-class TypelessKeyframes;
-class SetBRenderActive;
-class LoopPlayback;
-class Redo;
-class ShowVWindow;
-class ShowAWindow;
-class ShowGWindow;
-class ShowCWindow;
-class ShowLWindow;
-class Undo;
-class KeyframeCurveType;
-class KeyframeCurveTypeMenu;
-class KeyframeCurveTypeItem;
-class SplitX;
-class SplitY;
-class MixerViewer;
-class LoadLayoutItem;
-class LoadLayout;
 class MainMenu;
 class Undo;
 class MainDumpsSubMenu;
@@ -119,5 +95,8 @@ class SplitY;
 class MixerViewer;
 class LoadLayoutItem;
 class LoadLayout;
+class LoadLayoutDialog;
+class LoadLayoutNameText;
+class LoadLayoutConfirm;
 
 #endif
index 979d7e87e88a823b5f212e059772df3fbc71e475..da6056d91674465fa5e6c19b94b3ecdb10a7b22a 100644 (file)
@@ -2920,25 +2920,30 @@ void MWindow::restore_windows()
        gui->focus();
 }
 
-void MWindow::save_layout(int no)
+void MWindow::load_layout(const char *layout)
 {
-       char layout_path[BCTEXTLEN];
-       snprintf(layout_path, sizeof(layout_path), "%s/" LAYOUT_FILE,
-               File::get_config_path(), no);
-       session->save_file(layout_path);
-}
-
-void MWindow::load_layout(int no)
-{
-       char layout_path[BCTEXTLEN];
-       snprintf(layout_path, sizeof(layout_path), "%s/" LAYOUT_FILE,
-               File::get_config_path(), no);
-       session->load_file(layout_path);
+       char path[BCTEXTLEN];
+       snprintf(path, sizeof(path), "%s/%s", File::get_config_path(), layout);
+       session->load_file(path);
        restore_windows();
        gui->default_positions();
        save_defaults();
 }
 
+void MWindow::save_layout(const char *layout)
+{
+       char path[BCTEXTLEN];
+       snprintf(path, sizeof(path), "%s/%s", File::get_config_path(), layout);
+       session->save_file(path);
+}
+
+void MWindow::delete_layout(const char *layout)
+{
+       char path[BCTEXTLEN];
+       snprintf(path, sizeof(path), "%s/%s", File::get_config_path(), layout);
+       unlink(path);
+}
+
 int MWindow::tile_windows(int window_config)
 {
        int need_reload = 0;
index e2a0a73b9ba18bd6ec76c2c665e149d5ed279d58..3add4e79cb38ac02a7a0eec06164992059c3225c 100644 (file)
@@ -140,8 +140,9 @@ public:
        void show_gwindow();
        void hide_gwindow();
        void restore_windows();
-       void save_layout(int no);
-       void load_layout(int no);
+       void load_layout(const char *layout);
+       void save_layout(const char *layout);
+       void delete_layout(const char *layout);
        int tile_windows(int window_config);
        char *get_cwindow_display();
        void set_screens(int value);
index 017ca2e2cddfec00ea0d9a247c0757049fe9f8e6..8e3f97bd86d8c61a2e405177f4f05f59b63ffa61 100644 (file)
@@ -95,6 +95,7 @@ N_("Cinelerra: File format")
 N_("Cinelerra: File Format")
 N_("Cinelerra: Goto position")
 N_("Cinelerra: Label Info")
+N_("Cinelerra: Layout")
 N_("Cinelerra: Levels")
 N_("Cinelerra: Load")
 N_("Cinelerra: Loading")
index 7cdd58f72b5711af5df8a0c385d3429fcf36dab2..b3209c83c8f6fef173db821913a59d9339f4256e 100644 (file)
@@ -270,7 +270,7 @@ void MWindowGUI::create_objects()
 
        if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
 
-       int x = get_w() - MainShBtns::calculate_w(0);
+       int x = get_w() - MainShBtns::calculate_w(-1, 0, -1);
        add_subwindow(mainmenu = new MainMenu(mwindow, this, x));
        mainmenu->create_objects();
        add_subwindow(mainshbtns = new MainShBtns(mwindow, x, -1));
@@ -411,7 +411,7 @@ int MWindowGUI::resize_event(int w, int h)
 //printf("MWindowGUI::resize_event %d\n", __LINE__);
        mwindow->session->mwindow_w = w;
        mwindow->session->mwindow_h = h;
-       int x = w - MainShBtns::calculate_w(0);
+       int x = w - MainShBtns::calculate_w(-1, 0, -1);
        mainmenu->resize_event(x, mainmenu->get_h());
        mainshbtns->reposition_window(x, -1);
        mwindow->theme->get_mwindow_sizes(this, w, h);
index d64b6c1b6504873dc414eb2d102aa9e3e0de3985..9d8dae5cd919e009517bd2548c88e4155fcab25c 100644 (file)
@@ -500,21 +500,10 @@ int MWindow::goto_start()
 
 int MWindow::goto_position(double position)
 {
-       TimelinePane *pane = gui->get_focused_pane();
-       int64_t old_view_start = edl->local_session->view_start[pane->number];
-       edl->local_session->set_selectionstart(position);
-       edl->local_session->set_selectionend(position);
-       find_cursor();
-       int64_t new_view_start = edl->local_session->view_start[pane->number];
-       if(new_view_start != old_view_start)
-               samplemovement(new_view_start, pane->number);
-       update_plugin_guis();
-       gui->update_patchbay();
-       gui->update_cursor();
+       position = edl->align_to_frame(position, 0);
+       if( position < 0 ) position = 0;
+       select_point(position);
        gui->activate_timeline();
-       gui->zoombar->update();
-       gui->update_timebar(1);
-       cwindow->update(1, 0, 0, 0, 1);
        return 0;
 }
 
index d1a30f952e5bafa7ce82c0640cafdf01b56220f2..00686a4512293248f3dac1f98c80e52b86787f9a 100644 (file)
@@ -27,6 +27,8 @@
 #define BACKUP_FILE "backup.xml"
 #define BACKUP_FILE1 "backup.prev"
 #define LAYOUT_FILE "layout%d_rc"
+#define LAYOUT_NAME_LEN 8
+#define LAYOUTS_MAX 4
 #define DEFAULT_LV2_PATH CINDAT_DIR "/lv2"
 #define FFMPEG_EARLY_TIP _("Currently: Try FFMpeg first\n   Click to: Try FFMpeg last")
 #define FFMPEG_LATE_TIP  _("Currently: Try FFMpeg last\n   Click to: Try FFMpeg first")
index faba961583a5ce347196f77099a9d006f9a6960e..aa16aafaca6a4347c93cee82d0f0e35de91a906d 100644 (file)
@@ -467,12 +467,12 @@ void RenderEngine::run()
 
        close_output();
 
-       if( playback_engine && playback_engine->is_playing_back ) {
-               double position = interrupted ?
-                       playback_engine->get_tracking_position() :
-                       command->get_direction() == PLAY_FORWARD ?
-                               command->end_position :
-                               command->start_position;
+       if( playback_engine ) {
+               double position = command->single_frame() ? command->playbackstart :
+                       playback_engine->is_playing_back && !interrupted ?
+                               ( command->get_direction() == PLAY_FORWARD ?
+                                       command->end_position : command->start_position ) :
+                               playback_engine->get_tracking_position() ;
                if( command->displacement ) {
                        position -= 1./command->get_edl()->session->frame_rate;
                        if( position < 0 ) position = 0;
index 5fa6eb94355e40854b483fca6637c6221de9f0ae..f5c572d81b55263789c0987ad0550a500fff4396 100644 (file)
@@ -258,7 +258,7 @@ int VKeyFadeSlider::handle_event()
 
 VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y)
  : BC_PopupMenu(x, y, patch->patchbay->mode_icons[0]->get_w() + 20,
-       "", 1, mwindow->theme->get_image_set("mode_popup", 0), 10)
+       "", 1, mwindow->theme->get_image_set("mode_popup", 0), 0)
 {
        this->mwindow = mwindow;
        this->patch = patch;
index e98f7002b98dbc4c9a9bf65981803e99899709ce..51d0df733e3fab5ae79e61b4bac651af1939f811 100644 (file)
@@ -489,7 +489,7 @@ int AutoTypeMenu::draw_face(int dx, int color)
        if( color >= 0 ) {
                set_color(color);
                int margin = get_margin();
-               int mx = margin+4, my = 3*margin/8;
+               int mx = margin+8, my = 3*margin/8;
                int bh = get_h() - 2*my;
                draw_box(mx,my, bh,bh);
        }
index 5b40a05cbedb696935940be7f2d62861f76a4447..5c04b0fab7a673afe82832750cf893caa6e45ea1 100644 (file)
@@ -52,8 +52,8 @@ public:
        int set_alt(int value = 1);
        void set_ctrl(int value = 1);
 
-       int deactivate_submenus(BC_MenuPopup *exclude);
-       int activate_submenu();
+       virtual int deactivate_submenus(BC_MenuPopup *exclude);
+       virtual int activate_submenu();
        virtual int handle_event() { return 0; };
        int dispatch_button_press();
        int dispatch_button_release(int &redraw);
index 5b1e133b1a65948cfc9d4d80946781c3691aeaeb..ebb6e276451b88be7d3532222ab52e64da835bb5 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_neophyte/data/shbtn_dn.png and b/cinelerra-5.1/plugins/theme_neophyte/data/shbtn_dn.png differ
index 3bba6408de03216f8930e4b2340e281b9c66be56..b9e4a60b4616680c52939eb65957764194269967 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_neophyte/data/shbtn_hi.png and b/cinelerra-5.1/plugins/theme_neophyte/data/shbtn_hi.png differ
index 07731825d3a4be7f741a3166e6e5fd1eacc8f548..7267a3e5463d4bfa8ab390c3859b9788811b2214 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_neophyte/data/shbtn_up.png and b/cinelerra-5.1/plugins/theme_neophyte/data/shbtn_up.png differ