pluginclient cr=apply in option value textbox, add loop_mode for vwdw
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / editpanel.C
index 7eca7192a496b21df673ba28cd776f4908a22982..41394277fc1de8aa66199a9567005c8e821c5089 100644 (file)
@@ -75,7 +75,8 @@ EditPanel::EditPanel(MWindow *mwindow,
        int use_commercial,
        int use_goto,
        int use_clk2play,
-       int use_scope)
+       int use_scope,
+       int use_gang_tracks)
 {
        this->window_id = window_id;
        this->editing_mode = editing_mode;
@@ -98,6 +99,7 @@ EditPanel::EditPanel(MWindow *mwindow,
        this->use_goto = use_goto;
        this->use_clk2play = use_clk2play;
        this->use_scope = use_scope;
+       this->use_gang_tracks = use_gang_tracks;
 
        this->x = x;
        this->y = y;
@@ -117,6 +119,7 @@ EditPanel::EditPanel(MWindow *mwindow,
        this->nextlabel = 0;
        this->prevedit = 0;
        this->nextedit = 0;
+       this->gang_tracks = 0;
        this->undo = 0;
        this->redo = 0;
        this->meter_panel = 0;
@@ -157,6 +160,7 @@ void EditPanel::update()
                        mwindow->edl->session->vwindow_click2play ;
                click2play->set_value(value);
        }
+       if( gang_tracks ) gang_tracks->update(mwindow->edl->session->gang_tracks);
        if( meters ) {
                if( is_cwindow() ) {
                        meters->update(mwindow->edl->session->cwindow_meter);
@@ -171,19 +175,16 @@ void EditPanel::update()
 
 int EditPanel::calculate_w(MWindow *mwindow, int use_keyframe, int total_buttons)
 {
-       int result = 0;
-       int button_w = mwindow->theme->get_image_set("ibeam")[0]->get_w();
-       if( use_keyframe ) {
+       int button_w = xS(24); // mwindow->theme->get_image_set("meters")[0]->get_w();
+       int result = button_w * total_buttons;
+       if( use_keyframe )
                result += 2*(button_w + mwindow->theme->toggle_margin);
-       }
-
-       result += button_w * total_buttons;
        return result;
 }
 
 int EditPanel::calculate_h(MWindow *mwindow)
 {
-       return mwindow->theme->get_image_set("ibeam")[0]->get_h();
+       return mwindow->theme->get_image_set("meters")[0]->get_h();
 }
 
 void EditPanel::create_buttons()
@@ -262,16 +263,6 @@ void EditPanel::create_buttons()
                x1 += paste->get_w();
        }
 
-       if( use_meters ) {
-               if( meter_panel ) {
-                       meters = new MeterShow(mwindow, meter_panel, x1, y1);
-                       subwindow->add_subwindow(meters);
-                       x1 += meters->get_w();
-               }
-               else
-                       printf("EditPanel::create_objects: meter_panel == 0\n");
-       }
-
        if( use_labels ) {
                labelbutton = new EditLabelbutton(mwindow, this, x1, y1);
                subwindow->add_subwindow(labelbutton);
@@ -331,6 +322,22 @@ void EditPanel::create_buttons()
                scope_dialog = new EditPanelScopeDialog(mwindow, this);
        }
 
+       if( use_gang_tracks ) {
+               gang_tracks = new EditPanelGangTracks(mwindow, this, x1, y1-yS(1));
+               subwindow->add_subwindow(gang_tracks);
+               x1 += gang_tracks->get_w();
+       }
+
+       if( use_meters ) {
+               if( meter_panel ) {
+                       meters = new MeterShow(mwindow, meter_panel, x1, y1);
+                       subwindow->add_subwindow(meters);
+                       x1 += meters->get_w();
+               }
+               else
+                       printf("EditPanel::create_objects: meter_panel == 0\n");
+       }
+
        if( use_commercial ) {
                commercial = new EditCommercial(mwindow, this, x1, y1);
                subwindow->add_subwindow(commercial);
@@ -396,11 +403,6 @@ void EditPanel::reposition_buttons(int x, int y)
                x1 += paste->get_w();
        }
 
-       if( use_meters ) {
-               meters->reposition_window(x1, y1);
-               x1 += meters->get_w();
-       }
-
        if( use_labels ) {
                labelbutton->reposition_window(x1, y1);
                x1 += labelbutton->get_w();
@@ -446,6 +448,11 @@ void EditPanel::reposition_buttons(int x, int y)
                scope->reposition_window(x1, y1-yS(1));
                x1 += scope->get_w();
        }
+
+       if( use_meters ) {
+               meters->reposition_window(x1, y1);
+               x1 += meters->get_w();
+       }
 }
 
 void EditPanel::create_objects()
@@ -1167,6 +1174,10 @@ EditPanelScopeDialog::~EditPanelScopeDialog()
        delete gui_lock;
 }
 
+void EditPanelScopeDialog::handle_close_event(int result)
+{
+       scope_gui = 0;
+}
 void EditPanelScopeDialog::handle_done_event(int result)
 {
        gui_lock->lock("EditPanelScopeDialog::handle_done_event");
@@ -1202,7 +1213,7 @@ EditPanelScopeGUI::EditPanelScopeGUI(MWindow *mwindow, EditPanelScopeDialog *dia
  : ScopeGUI(mwindow->theme,
        mwindow->session->scope_x, mwindow->session->scope_y,
        mwindow->session->scope_w, mwindow->session->scope_h,
-       mwindow->preferences->processors)
+       mwindow->get_cpus())
 {
        this->mwindow = mwindow;
        this->dialog = dialog;
@@ -1220,6 +1231,12 @@ void EditPanelScopeGUI::create_objects()
        use_vector = session->use_vector;
        use_hist_parade = session->use_hist_parade;
        use_wave_parade = session->use_wave_parade;
+       use_wave_gain = session->use_wave_gain;
+       use_vect_gain = session->use_vect_gain;
+       use_smooth = session->use_smooth;
+       use_refresh = session->use_refresh;
+       use_release = session->use_release;
+       use_graticule = session->use_graticule;
        ScopeGUI::create_objects();
 }
 
@@ -1231,6 +1248,12 @@ void EditPanelScopeGUI::toggle_event()
        session->use_vector = use_vector;
        session->use_hist_parade = use_hist_parade;
        session->use_wave_parade = use_wave_parade;
+       session->use_wave_gain = use_wave_gain;
+       session->use_vect_gain = use_vect_gain;
+       session->use_smooth = use_smooth;
+       session->use_refresh = use_refresh;
+       session->use_release = use_release;
+       session->use_graticule = use_graticule;
 }
 
 int EditPanelScopeGUI::translation_event()
@@ -1291,3 +1314,55 @@ int EditPanelScope::handle_event()
        return 1;
 }
 
+const char *EditPanelGangTracks::gang_tips[TOTAL_GANGS] = {
+       N_("Currently: Gang None\n  Click to: Gang Channels"),
+       N_("Currently: Gang Channels\n  Click to: Gang Media"),
+       N_("Currently: Gang Media\n  Click to: Gang None"),
+};
+
+EditPanelGangTracks::EditPanelGangTracks(MWindow *mwindow, EditPanel *panel,
+               int x, int y)
+ : BC_Button(x, y, get_images(mwindow))
+{
+       this->mwindow = mwindow;
+       this->panel = panel;
+       int gang = mwindow->edl->session->gang_tracks;
+       set_tooltip(_(gang_tips[gang]));
+}
+
+EditPanelGangTracks::~EditPanelGangTracks()
+{
+}
+
+VFrame **EditPanelGangTracks::gang_images[TOTAL_GANGS];
+
+VFrame **EditPanelGangTracks::get_images(MWindow *mwindow)
+{
+       gang_images[GANG_NONE] = mwindow->theme->get_image_set("gang0");
+       gang_images[GANG_MEDIA] = mwindow->theme->get_image_set("gang1");
+       gang_images[GANG_CHANNELS] = mwindow->theme->get_image_set("gang2");
+       int gang = mwindow->edl->session->gang_tracks;
+       return gang_images[gang];
+}
+
+void EditPanelGangTracks::update(int gang)
+{
+       set_images(gang_images[gang]);
+       draw_face();
+       set_tooltip(_(gang_tips[gang]));
+}
+
+int EditPanelGangTracks::handle_event()
+{
+       int gang = mwindow->edl->session->gang_tracks;
+       if( !shift_down() ) {
+               if( ++gang > GANG_MEDIA ) gang = GANG_NONE;
+       }
+       else {
+               if( --gang < GANG_NONE ) gang = GANG_MEDIA;
+       }
+       update(gang);
+       panel->panel_set_gang_tracks(gang);
+       return 1;
+}
+