theme inout highlight color, drag timebar inout/labels
authorGood Guy <[email protected]>
Wed, 5 Sep 2018 16:30:33 +0000 (10:30 -0600)
committerGood Guy <[email protected]>
Wed, 5 Sep 2018 16:30:33 +0000 (10:30 -0600)
cinelerra-5.1/cinelerra/theme.C
cinelerra-5.1/cinelerra/theme.h
cinelerra-5.1/cinelerra/timebar.C
cinelerra-5.1/cinelerra/timebar.h

index 65865a24bb2f3ce5cee7a1672a68e9cee2a3fe89..f9e32f4999018a3588d442a758e9fa0c603dbc68 100644 (file)
@@ -78,6 +78,7 @@ Theme::Theme()
        BC_WindowBase::get_resources()->recursive_resizing = 0;
        audio_color = BLACK;
        fade_h = 22;
+       inout_highlight_color = GREEN;
        meter_h = 17;
        mode_h = 30;
        pan_h = 32;
index 47e54584a4ea221f3f5ee2c3117959ff6dd3da96..2c980bcb794c0862670d3c717c6810412a83e939 100644 (file)
@@ -188,6 +188,7 @@ public:
        int ctransport_x, ctransport_y;
        int czoom_x, czoom_y, czoom_w;
        int fade_h;
+       int inout_highlight_color;
        int loadfile_pad;
        int loadmode_w;
        int mbuttons_x, mbuttons_y, mbuttons_w, mbuttons_h;
index 10a095f9546edbb81a97c4a0a10ec38bca83a73c..755e8e4196e0a85779fd62199fed0c562da821c8 100644 (file)
@@ -71,6 +71,8 @@ LabelGUI::LabelGUI(MWindow *mwindow, TimeBar *timebar,
 
 LabelGUI::~LabelGUI()
 {
+       if( timebar->drag_label == this )
+               timebar->drag_label = 0;
 }
 
 int LabelGUI::get_y(MWindow *mwindow, TimeBar *timebar)
@@ -93,7 +95,7 @@ void LabelGUI::reposition(int flush)
 
 int LabelGUI::button_press_event()
 {
-       int result = 0;
+       int result = test_drag_label(1);
 
        if( this->is_event_win() && get_buttonpress() == 3 ) {
                if( label ) {
@@ -110,6 +112,38 @@ int LabelGUI::button_press_event()
        return result;
 }
 
+int LabelGUI::button_release_event()
+{
+       int ret = BC_Toggle::button_release_event();
+       test_drag_label(0);
+       return ret;
+}
+
+int LabelGUI::test_drag_label(int press)
+{
+       if( is_event_win() && get_buttonpress() == 1 ) {
+               switch( timebar->current_operation ) {
+               case TIMEBAR_NONE:
+                       if( press && get_value() ) {
+                               timebar->current_operation = TIMEBAR_DRAG_LABEL;
+                               timebar->drag_label = this;
+                               set_cursor(MOVE_CURSOR, 0, 0);
+                               mwindow->undo->update_undo_before(_("drag label"), this);
+                               return 1;
+                       }
+                       break;
+               case TIMEBAR_DRAG_LABEL:
+                       if( !press ) {
+                               timebar->current_operation = TIMEBAR_NONE;
+                               set_cursor(ARROW_CURSOR, 0, 0);
+                               mwindow->undo->update_undo_after(_("drag label"), LOAD_TIMEBAR);
+                       }
+                       break;
+               }
+       }
+       return 0;
+}
+
 int LabelGUI::handle_event()
 {
        timebar->select_label(position);
@@ -171,6 +205,7 @@ TimeBar::TimeBar(MWindow *mwindow, BC_WindowBase *gui,
 //printf("TimeBar::TimeBar %d %d %d %d\n", x, y, w, h);
        this->gui = gui;
        this->mwindow = mwindow;
+       this->drag_label = 0;
        label_edit = new LabelEdit(mwindow, mwindow->awindow, 0);
        pane = 0;
        highlighted = 0;
@@ -325,7 +360,7 @@ void TimeBar::draw_inout_highlight()
        int out_x = position_to_pixel(out_position);
        CLAMP(in_x, 0, get_w());
        CLAMP(out_x, 0, get_w());
-       set_color(GREEN);
+       set_color(mwindow->theme->inout_highlight_color);
        int lw = 5;
        set_line_width(lw);
        set_inverse();
@@ -767,6 +802,25 @@ int TimeBar::cursor_motion_event()
                                result = move_preview(redraw);
                        break;
 
+               case TIMEBAR_DRAG_LABEL:
+                       if( drag_label ) {
+                               int pixel = get_relative_cursor_x();
+                               double position = pixel_to_position(pixel);
+                               if( drag_label->label )
+                                       drag_label->label->position = position;
+                               else if( drag_label == in_point ) {
+                                       EDL *edl = get_edl();
+                                       edl->local_session->set_inpoint(position);
+                               }
+                               else if( drag_label == out_point ) {
+                                       EDL *edl = get_edl();
+                                       edl->local_session->set_outpoint(position);
+                               }
+                       }
+                       highlighted = 1;
+                       redraw = 1;
+                       break;
+
                default:
                        if( cursor_above() ) {
                                highlighted = 1;
index 54d952c45c5bf252377141da084b4f0adfedcc3b..e661e17e161e679e0d00ce84be2ccf920cb33ee6 100644 (file)
@@ -48,6 +48,7 @@ class PresentationGUI;
 #define TIMEBAR_DRAG_LEFT   2
 #define TIMEBAR_DRAG_RIGHT  3
 #define TIMEBAR_DRAG_CENTER 4
+#define TIMEBAR_DRAG_LABEL  5
 
 class LabelGUI : public BC_Toggle
 {
@@ -64,9 +65,11 @@ public:
        virtual int handle_event();
        static int get_y(MWindow *mwindow, TimeBar *timebar);
        void reposition(int flush = 1);
+       int test_drag_label(int press);
 
        Label *label;
        int button_press_event();
+       int button_release_event();
        MWindow *mwindow;
        VWindowGUI *gui;
        TimeBar *timebar;
@@ -189,6 +192,7 @@ public:
 
 // Operation started by a buttonpress
        int current_operation;
+       LabelGUI *drag_label;
 
 private:
        int get_preview_pixels(int &x1, int &x2);