vicon placement tweak, bclistbox select fixes, new ctrl-a/s shortcuts
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mainmenu.C
index a94fb5894819aa649def542713bb147a18b5bc3f..11edba8fc44f8795f682bc275a23dc7289a5b88c 100644 (file)
@@ -36,6 +36,7 @@
 #include "dvdcreate.h"
 #include "edl.h"
 #include "edlsession.h"
+#include "file.h"
 #include "filesystem.h"
 #include "filexml.h"
 #include "floatauto.h"
@@ -216,10 +217,10 @@ void MainMenu::create_objects()
        settingsmenu->add_item(proxy = new ProxyMenuItem(mwindow));
        proxy->create_objects();
        mwindow->preferences_thread = preferences->thread;
+       settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
        settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
        settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
        settingsmenu->add_item(keyframes_follow_edits = new KeyframesFollowEdits(mwindow));
-       settingsmenu->add_item(cursor_on_frames = new CursorOnFrames(mwindow));
        settingsmenu->add_item(typeless_keyframes = new TypelessKeyframes(mwindow));
        settingsmenu->add_item(new BC_MenuItem("-"));
        settingsmenu->add_item(new SaveSettingsNow(mwindow));
@@ -248,11 +249,11 @@ void MainMenu::create_objects()
        viewmenu->add_item(mask_automation = new ShowAutomation(mwindow, _("Mask"), "8", AUTOMATION_MASK));
        viewmenu->add_item(speed_automation = new ShowAutomation(mwindow, _("Speed"), "9", AUTOMATION_SPEED));
 
-       camera_x = new ShowAutomation(mwindow, _("Camera X"), "Ctl-Shift-X", AUTOMATION_CAMERA_X);
+       camera_x = new ShowAutomation(mwindow, _("Camera X"), "Ctrl-Shift-X", AUTOMATION_CAMERA_X);
        camera_x->set_ctrl();  camera_x->set_shift();   viewmenu->add_item(camera_x);
-       camera_y = new ShowAutomation(mwindow, _("Camera Y"), "Ctl-Shift-Y", AUTOMATION_CAMERA_Y);
+       camera_y = new ShowAutomation(mwindow, _("Camera Y"), "Ctrl-Shift-Y", AUTOMATION_CAMERA_Y);
        camera_y->set_ctrl();  camera_y->set_shift();   viewmenu->add_item(camera_y);
-       camera_z = new ShowAutomation(mwindow, _("Camera Z"), "Ctl-Shift-Z", AUTOMATION_CAMERA_Z);
+       camera_z = new ShowAutomation(mwindow, _("Camera Z"), "Ctrl-Shift-Z", AUTOMATION_CAMERA_Z);
        camera_z->set_ctrl();  camera_z->set_shift();  viewmenu->add_item(camera_z);
        project_x = new ShowAutomation(mwindow, _("Projector X"), "Alt-Shift-X", AUTOMATION_PROJECTOR_X);
        project_x->set_alt();  project_x->set_shift();  viewmenu->add_item(project_x);
@@ -272,9 +273,15 @@ void MainMenu::create_objects()
        windowmenu->add_item(split_y = new SplitY(mwindow));
        windowmenu->add_item(mixer_viewer = new MixerViewer(mwindow));
        windowmenu->add_item(new TileMixers(mwindow));
-       windowmenu->add_item(new TileWindows(mwindow,_("Default positions"),-1,_("Ctrl-P"),'p'));
        windowmenu->add_item(new TileWindows(mwindow,_("Tile left"),0));
        windowmenu->add_item(new TileWindows(mwindow,_("Tile right"),1));
+       windowmenu->add_item(new BC_MenuItem("-"));
+
+       windowmenu->add_item(new TileWindows(mwindow,_("Default positions"),-1,_("Ctrl-P"),'p'));
+       windowmenu->add_item(load_layout = new LoadLayout(mwindow, _("Load layout..."),LAYOUT_LOAD));
+       load_layout->create_objects();
+       windowmenu->add_item(save_layout = new LoadLayout(mwindow, _("Save layout..."),LAYOUT_SAVE));
+       save_layout->create_objects();
 }
 
 int MainMenu::load_defaults(BC_Hash *defaults)
@@ -1353,10 +1360,11 @@ int KeyframesFollowEdits::handle_event()
 
 
 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
- : BC_MenuItem(_("Align cursor on frames"))
+ : BC_MenuItem(_("Align cursor on frames"),_("Ctrl-a"),'a')
 {
        this->mwindow = mwindow;
        set_checked(mwindow->edl->session->cursor_on_frames);
+       set_ctrl(1);
 }
 
 int CursorOnFrames::handle_event()
@@ -1382,7 +1390,8 @@ int TypelessKeyframes::handle_event()
 }
 
 
-ScrubSpeed::ScrubSpeed(MWindow *mwindow) : BC_MenuItem(_("Slow Shuttle"))
+ScrubSpeed::ScrubSpeed(MWindow *mwindow)
+ : BC_MenuItem(_("Slow Shuttle"))
 {
        this->mwindow = mwindow;
 }
@@ -1402,9 +1411,11 @@ int ScrubSpeed::handle_event()
        return 1;
 }
 
-SaveSettingsNow::SaveSettingsNow(MWindow *mwindow) : BC_MenuItem(_("Save settings now"))
+SaveSettingsNow::SaveSettingsNow(MWindow *mwindow)
+ : BC_MenuItem(_("Save settings now"),_("Ctrl-s"),'s')
 {
        this->mwindow = mwindow;
+       set_ctrl(1);
 }
 
 int SaveSettingsNow::handle_event()
@@ -1568,3 +1579,52 @@ int TileMixers::handle_event()
        return 1;
 }
 
+
+LoadLayoutItem::LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey)
+ : BC_MenuItem(text, "", hotkey)
+{
+       this->no = no;
+       this->load_layout = load_layout;
+       if( hotkey ) {
+               char hot_txt[BCSTRLEN];
+               sprintf(hot_txt, _("Ctrl-Shift+F%d"), hotkey-KEY_F1+1);
+               set_ctrl();  set_shift();
+               set_hotkey_text(hot_txt);
+       }
+}
+
+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);
+               break;
+       }
+       return 1;
+}
+
+LoadLayout::LoadLayout(MWindow *mwindow, const char *text, int action)
+ : BC_MenuItem(text)
+{
+       this->mwindow = mwindow;
+       this->action = action;
+}
+
+void LoadLayout::create_objects()
+{
+       BC_SubMenu *layout_submenu = new BC_SubMenu();
+       add_submenu(layout_submenu);
+       for( int i=1; i<=4; ++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);
+       }
+}
+