mask tweaks, focus follows centroid, gradient/colorpicker rework, no hard edges in...
authorGood Guy <good1.2guy@gmail.com>
Fri, 28 Jun 2019 02:50:50 +0000 (20:50 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 28 Jun 2019 02:50:50 +0000 (20:50 -0600)
30 files changed:
cinelerra-5.1/cinelerra/asset.C
cinelerra-5.1/cinelerra/asset.h
cinelerra-5.1/cinelerra/asset.inc
cinelerra-5.1/cinelerra/assetedit.C
cinelerra-5.1/cinelerra/assetedit.h
cinelerra-5.1/cinelerra/assetedit.inc
cinelerra-5.1/cinelerra/colorpicker.C
cinelerra-5.1/cinelerra/colorpicker.h
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/cwindowtool.C
cinelerra-5.1/cinelerra/editpopup.C
cinelerra-5.1/cinelerra/edits.C
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/fileffmpeg.C
cinelerra-5.1/cinelerra/filegif.C
cinelerra-5.1/cinelerra/formatpresets.C
cinelerra-5.1/cinelerra/interlacemodes.C
cinelerra-5.1/cinelerra/interlacemodes.h
cinelerra-5.1/cinelerra/mainmenu.C
cinelerra-5.1/cinelerra/mainmenu.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/new.h
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/vmodule.C
cinelerra-5.1/guicast/bctoggle.h
cinelerra-5.1/plugins/gradient/gradient.C
cinelerra-5.1/plugins/gradient/gradient.h

index e2fc242..eebc6f2 100644 (file)
@@ -95,9 +95,7 @@ int Asset::init_values()
 
        jpeg_quality = 80;
        aspect_ratio = -1;
-       interlace_autofixoption = ILACE_AUTOFIXOPTION_AUTO;
        interlace_mode = ILACE_MODE_UNDETECTED;
-       interlace_fixmethod = ILACE_FIXMETHOD_NONE;
 
        mp3_bitrate = 224;
        ampeg_bitrate = 256;
@@ -198,9 +196,7 @@ void Asset::copy_format(Asset *asset, int do_index)
        mp3_bitrate = asset->mp3_bitrate;
        use_header = asset->use_header;
        aspect_ratio = asset->aspect_ratio;
-       interlace_autofixoption = asset->interlace_autofixoption;
        interlace_mode = asset->interlace_mode;
-       interlace_fixmethod = asset->interlace_fixmethod;
 
        video_data = asset->video_data;
        layers = asset->layers;
@@ -342,9 +338,7 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl)
                result = (layers == asset.layers &&
                        program == asset.program &&
                        frame_rate == asset.frame_rate &&
-                       asset.interlace_autofixoption == interlace_autofixoption &&
                        asset.interlace_mode    == interlace_mode &&
-                       interlace_fixmethod     == asset.interlace_fixmethod &&
                        width == asset.width &&
                        height == asset.height &&
                        !strcmp(vcodec, asset.vcodec) &&
@@ -497,15 +491,9 @@ int Asset::read_video(FileXML *file)
        mov_sphere = file->tag.get_property("MOV_SPHERE", 0);
        jpeg_sphere = file->tag.get_property("JPEG_SPHERE", 0);
        single_frame = file->tag.get_property("SINGLE_FRAME", (int64_t)0);
-
-       interlace_autofixoption = file->tag.get_property("INTERLACE_AUTOFIX",0);
-
        ilacemode_to_xmltext(string, ILACE_MODE_NOTINTERLACED);
        interlace_mode = ilacemode_from_xmltext(file->tag.get_property("INTERLACE_MODE",string), ILACE_MODE_NOTINTERLACED);
 
-       ilacefixmethod_to_xmltext(string, ILACE_FIXMETHOD_NONE);
-       interlace_fixmethod = ilacefixmethod_from_xmltext(file->tag.get_property("INTERLACE_FIXMETHOD",string), ILACE_FIXMETHOD_NONE);
-
        return 0;
 }
 
@@ -649,14 +637,9 @@ int Asset::write_video(FileXML *file)
        file->tag.set_property("JPEG_SPHERE", jpeg_sphere);
        file->tag.set_property("SINGLE_FRAME", single_frame);
 
-       file->tag.set_property("INTERLACE_AUTOFIX", interlace_autofixoption);
-
        ilacemode_to_xmltext(string, interlace_mode);
        file->tag.set_property("INTERLACE_MODE", string);
 
-       ilacefixmethod_to_xmltext(string, interlace_fixmethod);
-       file->tag.set_property("INTERLACE_FIXMETHOD", string);
-
        file->append_tag();
        if(video_data)
                file->tag.set_title("/VIDEO");
@@ -767,10 +750,7 @@ void Asset::load_defaults(BC_Hash *defaults,
 
        jpeg_quality = GET_DEFAULT("JPEG_QUALITY", jpeg_quality);
        aspect_ratio = GET_DEFAULT("ASPECT_RATIO", aspect_ratio);
-
-       interlace_autofixoption = ILACE_AUTOFIXOPTION_AUTO;
        interlace_mode          = ILACE_MODE_UNDETECTED;
-       interlace_fixmethod     = ILACE_FIXMETHOD_UPONE;
 
 // MPEG format information
        vmpeg_iframe_distance = GET_DEFAULT("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
index c853d7a..0a2372c 100644 (file)
@@ -167,9 +167,7 @@ public:
        double aspect_ratio;
 
 // for the interlace mode
-       int interlace_autofixoption;
        int interlace_mode;
-       int interlace_fixmethod;
 // for jpeg compression
        int jpeg_quality;
 
index 2b73d0b..341447c 100644 (file)
@@ -23,6 +23,5 @@
 #define ASSET_INC
 
 class Asset;
-class InterlacefixmethodItem;
 
 #endif
index c587563..432b78c 100644 (file)
@@ -190,7 +190,7 @@ int AssetEdit::window_height()
        int h = 128 + 64;
        if( indexable->have_audio() ) h += 200;
        if( indexable->have_video() ) {
-               h += 210;
+               h += 160;
                if( indexable->is_asset ) {
                        Asset *asset = (Asset *)indexable;
                        if( File::can_scale_input(asset) )
@@ -240,9 +240,6 @@ void AssetEditWindow::create_objects()
        int vmargin;
        FileSystem fs;
        BC_Title *title;
-       BC_TextBox  *textboxw;
-       BC_ListBox  *listboxw;
-       Interlaceautofix *ilacefixoption_chkboxw;
        Asset *asset = 0;
        EDL *nested_edl = 0;
 
@@ -519,37 +516,14 @@ void AssetEditWindow::create_objects()
                        y += title->get_h() + 5;
                }
 
-               // --------------------
-               add_subwindow(title = new BC_Title(x1, y, _("Fix interlacing:")));
-               add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
-               y += ilacefixoption_chkboxw->get_h() + 5;
-               // --------------------
                add_subwindow(title = new BC_Title(x1, y, _("Asset's interlacing:")));
-               add_subwindow(textboxw = new AssetEditILacemode(this, "", ILACE_ASSET_MODEDEFAULT, x2, y, 200));
-               ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
-               add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
-                                                       textboxw,
-                                                       &asset_edit->changed_params->interlace_mode,
-                                                       (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
-                                                       ilacefixoption_chkboxw,
-                                                       x2 + textboxw->get_w(),
-                                                       y));
-               ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
-               y += textboxw->get_h() + 5;
-
-               // --------------------
-               add_subwindow(title = new BC_Title(x1, y, _("Interlace correction:")));
-               add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", ILACE_FIXDEFAULT, x2, y, 200));
-               ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
-               add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow,
-                                                       textboxw,
-                                                       &asset_edit->changed_params->interlace_fixmethod,
-                                                       (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
-                                                       x2 + textboxw->get_w(),
-                                                       y));
-               ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
-               ilacefixoption_chkboxw->showhideotherwidgets();
-               y += textboxw->get_h() + 5;
+               ilacemode_to_text(string, asset->interlace_mode);
+               AssetEditILacemode *edit_ilace_mode;
+               add_subwindow(edit_ilace_mode = new AssetEditILacemode(this, string, x2, y, 160));
+               add_subwindow(new AssetEditInterlacemodePulldown(mwindow, edit_ilace_mode,
+                               &asset_edit->changed_params->interlace_mode,
+                               (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
+                               x2 + edit_ilace_mode->get_w(), y));
        }
 
        add_subwindow(new BC_OKButton(this));
@@ -614,130 +588,25 @@ int AssetEditFRate::handle_event()
        return 1;
 }
 
-Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
- : BC_CheckBox(x, y,
-       fwindow->asset_edit->changed_params->interlace_autofixoption,
-       _("Automatically Fix Interlacing"))
-{
-       this->fwindow = fwindow;
-       this->mwindow = mwindow;
-}
-
-Interlaceautofix::~Interlaceautofix()
-{
-}
-
-int Interlaceautofix::handle_event()
-{
-       Asset *asset = fwindow->asset_edit->changed_params;
-       asset->interlace_autofixoption = get_value();
-       showhideotherwidgets();
-       return 1;
-}
-
-void Interlaceautofix::showhideotherwidgets()
-{
-  int thevalue = get_value();
-
-       Asset *asset = fwindow->asset_edit->changed_params;
-       if( thevalue == ILACE_AUTOFIXOPTION_AUTO ) {
-               this->ilacemode_textbox->enable();
-               this->ilacemode_listbox->enable();
-               this->ilacefixmethod_textbox->disable();
-               this->ilacefixmethod_listbox->disable();
-               int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,asset->interlace_mode);
-               ilacefixmethod_to_text(string, xx);
-               this->ilacefixmethod_textbox->update(string);
-       }
-       if( thevalue == ILACE_AUTOFIXOPTION_MANUAL ) {
-               this->ilacemode_textbox->disable();
-               this->ilacemode_listbox->disable();
-               this->ilacefixmethod_textbox->enable();
-               this->ilacefixmethod_listbox->enable();
-               ilacefixmethod_to_text(string, asset->interlace_fixmethod);
-               this->ilacefixmethod_textbox->update(string);
-         }
-}
-
-InterlacefixmethodItem::InterlacefixmethodItem(const char *text, int value)
- : BC_ListBoxItem(text)
-{
-       this->value = value;
-}
-
-InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow,
-               BC_TextBox *output_text, int *output_value,
-               ArrayList<BC_ListBoxItem*> *data, int x, int y)
- : BC_ListBox(x, y, 200, 150, LISTBOX_TEXT, data, 0, 0, 1, 0, 1)
-{
-       this->mwindow = mwindow;
-       this->output_text = output_text;
-       this->output_value = output_value;
-       output_text->update(interlacefixmethod_to_text());
-}
-
-int InterlacefixmethodPulldown::handle_event()
-{
-       output_text->update(get_selection(0, 0)->get_text());
-       *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
-       return 1;
-}
-
-const char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
-{
-       ilacefixmethod_to_text(this->string,*output_value);
-       return (this->string);
-}
 
-AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
+AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, const char *text, int x, int y, int w)
  : BC_TextBox(x, y, w, 1, text)
 {
        this->fwindow = fwindow;
-       this->thedefault = thedefault;
-}
-
-int AssetEditILaceautofixoption::handle_event()
-{
-       Asset *asset = fwindow->asset_edit->changed_params;
-       asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
-       return 1;
-}
-
-
-AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
- : BC_TextBox(x, y, w, 1, text)
-{
-       this->fwindow = fwindow;
-       this->thedefault = thedefault;
 }
 
 int AssetEditILacemode::handle_event()
 {
        Asset *asset = fwindow->asset_edit->changed_params;
-       asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
+       asset->interlace_mode = ilacemode_from_text(get_text(), ILACE_ASSET_MODEDEFAULT);
        return 1;
 }
 
 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow,
-               BC_TextBox *output_text,
-               int *output_value,
-               ArrayList<BC_ListBoxItem*> *data,
-               Interlaceautofix *fixoption_chkboxw,
-               int x,
-               int y)
- : BC_ListBox(x,
-       y,
-       200,
-       150,
-       LISTBOX_TEXT,
-       data,
-       0,
-       0,
-       1,
-       0,
-       1)
-{
-       this->fixoption_chkbox = fixoption_chkboxw;
+               BC_TextBox *output_text, int *output_value,
+               ArrayList<BC_ListBoxItem*> *data, int x, int y)
+ : BC_ListBox(x, y, 160, 80, LISTBOX_TEXT, data, 0, 0, 1, 0, 1)
+{
        this->mwindow = mwindow;
        this->output_text = output_text;
        this->output_value = output_value;
@@ -748,7 +617,6 @@ int AssetEditInterlacemodePulldown::handle_event()
 {
        output_text->update(get_selection(0, 0)->get_text());
        *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
-       fixoption_chkbox->showhideotherwidgets();
        return 1;
 }
 
@@ -758,20 +626,6 @@ char* AssetEditInterlacemodePulldown::interlacemode_to_text()
        return (this->string);
 }
 
-AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
- : BC_TextBox(x, y, w, 1, text)
-{
-       this->fwindow = fwindow;
-       this->thedefault = thedefault;
-}
-
-int AssetEditILacefixmethod::handle_event()
-{
-       Asset *asset = fwindow->asset_edit->changed_params;
-       asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
-       return 1;
-}
-
 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
  : BC_TextBox(x, y, 100, 1, text)
 {
index 47a5916..d742629 100644 (file)
@@ -147,43 +147,11 @@ public:
        AssetEditWindow *fwindow;
 };
 
-class Interlaceautofix : public BC_CheckBox
-{
-public:
-       Interlaceautofix(MWindow *mwindow, AssetEditWindow *fwindow,
-               int x, int y);
-       ~Interlaceautofix();
-       int handle_event();
-
-       void showhideotherwidgets();
-
-       AssetEditWindow* fwindow;
-       MWindow *mwindow;
-
-       BC_TextBox *ilacemode_textbox;
-       BC_ListBox *ilacemode_listbox;
-       BC_TextBox *ilacefixmethod_textbox;
-       BC_ListBox *ilacefixmethod_listbox;
-private:
-       char string[BCTEXTLEN];
-};
-
-class AssetEditILaceautofixoption : public BC_TextBox
-{
-public:
-       AssetEditILaceautofixoption(AssetEditWindow *fwindow,
-               char *text, int thedefault, int x, int y, int w);
-
-       int handle_event();
-       int thedefault;
-       AssetEditWindow *fwindow;
-};
-
 class AssetEditILacemode : public BC_TextBox
 {
 public:
        AssetEditILacemode(AssetEditWindow *fwindow,
-               const char *text, int thedefault, int x, int y, int w);
+               const char *text, int x, int y, int w);
        int handle_event();
        int thedefault;
        AssetEditWindow *fwindow;
@@ -194,30 +162,16 @@ class AssetEditInterlacemodePulldown : public BC_ListBox
 public:
        AssetEditInterlacemodePulldown(MWindow *mwindow,
                BC_TextBox *output_text, int *output_value,
-               ArrayList<BC_ListBoxItem*> *data,
-               Interlaceautofix *fixoption_chkbox,
-               int x, int y);
+               ArrayList<BC_ListBoxItem*> *data, int x, int y);
        int handle_event();
        char* interlacemode_to_text();
        MWindow *mwindow;
        BC_TextBox *output_text;
        int *output_value;
-       Interlaceautofix *fixoption_chkbox;
 private:
        char string[BCTEXTLEN];
 };
 
-class AssetEditILacefixmethod : public BC_TextBox
-{
-public:
-       AssetEditILacefixmethod(AssetEditWindow *fwindow,
-               const char *text, int thedefault, int x, int y, int w);
-
-       int handle_event();
-       int thedefault;
-       AssetEditWindow *fwindow;
-};
-
 class AssetEditHeader : public BC_TextBox
 {
 public:
index 2c7675e..8c25e5f 100644 (file)
@@ -30,11 +30,8 @@ class AssetEditFormat;
 class AssetEditChannels;
 class AssetEditRate;
 class AssetEditFRate;
-class Interlaceautofix;
-class AssetEditILaceautofixoption;
 class AssetEditILacemode;
 class AssetEditInterlacemodePulldown;
-class AssetEditILacefixmethod;
 class AssetEditHeader;
 class AssetEditByteOrderLOHI;
 class AssetEditByteOrderHILO;
index 927807b..b910b9f 100644 (file)
@@ -1237,6 +1237,13 @@ void ColorButton::close_picker()
        delete color_picker;  color_picker = 0;
 }
 
+void ColorButton::update_gui(int color, int alpha)
+{
+       if( color_picker )
+               color_picker->update_gui(color, alpha);
+       update_gui(color | (~alpha<<24));
+}
+
 void ColorButton::update_gui(int color)
 {
        set_color(color);
@@ -1259,10 +1266,16 @@ void ColorButtonPicker::handle_done_event(int result)
        color_button->handle_done_event(result);
 }
 
-int ColorButtonPicker::handle_new_color(int color, int alpha)
+void ColorButtonPicker::update(int color, int alpha)
 {
        color_button->color = color;
+       color_button->alpha = alpha;
        color_button->color_thread->update_lock->unlock();
+}
+
+int ColorButtonPicker::handle_new_color(int color, int alpha)
+{
+       update(color, alpha);
        color_button->handle_new_color(color, alpha);
        return 1;
 }
@@ -1270,10 +1283,15 @@ int ColorButtonPicker::handle_new_color(int color, int alpha)
 void ColorButtonPicker::update_gui()
 {
        color_button->lock_window("ColorButtonPicker::update_gui");
-       color_button->update_gui(color_button->color);
+       color_button->update_gui(color_button->color, color_button->alpha);
        color_button->unlock_window();
 }
 
+void ColorButtonPicker::update_gui(int color, int alpha)
+{
+       ColorPicker::update_gui(color, alpha);
+}
+
 ColorButtonThread::ColorButtonThread(ColorButton *color_button)
  : Thread(1, 0, 0)
 {
@@ -1337,7 +1355,7 @@ void ColorBoxButton::handle_done_event(int result)
 }
 void ColorBoxButton::create_objects()
 {
-       update_gui(color);
+       update_gui(color, alpha);
 }
 
 void ColorBoxButton::set_color(int color)
@@ -1399,7 +1417,7 @@ void ColorCircleButton::handle_done_event(int result)
 }
 void ColorCircleButton::create_objects()
 {
-       update_gui(color);
+       update_gui(color, alpha);
 }
 
 void ColorCircleButton::set_color(int color)
index 5f8b133..1fffa25 100644 (file)
@@ -365,6 +365,7 @@ public:
        virtual void handle_done_event(int result);
 
        void close_picker();
+       void update_gui(int color, int alpha);
        void update_gui(int color);
        int handle_event();
 
@@ -382,9 +383,11 @@ class ColorButtonPicker : public ColorPicker
 public:
        ColorButtonPicker(ColorButton *color_button);
        ~ColorButtonPicker();
+       void update(int color, int alpha);
        int handle_new_color(int color, int alpha);
        void handle_done_event(int result);
        void update_gui();
+       void update_gui(int color, int alpha);
 
        ColorButton *color_button;
 };
index 99c395b..27a0651 100644 (file)
@@ -1791,6 +1791,8 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                        cvs_win->draw_line(cx,cy-d, cx, cy+d);
                        cvs_win->set_line_width(0);
                        cvs_win->set_color(WHITE);
+                       if( !mask_gui->focused )
+                               mask_gui->set_focused(0, cx, cy);
                }
 //printf("CWindowCanvas::do_mask 1\n");
        }
@@ -2084,25 +2086,25 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                        case CWINDOW_MASK_ROTATE:
                                rotate = 1;
                        case CWINDOW_MASK_SCALE: {
-                               int button_no = get_buttonpress();
-                               double scale = button_no == WHEEL_UP ? 1.02 : 0.98;
-                               double theta = button_no == WHEEL_UP ? M_PI/360. : -M_PI/360.;
-                               float st = sin(theta), ct = cos(theta);
-                               float cx = 0, cy = 0;
-                               int n = mask_points.size();
-                               if( mask_gui && mask_gui->focused ) {
-                                       cx = atof(mask_gui->focus_x->get_text());
-                                       cy = atof(mask_gui->focus_y->get_text());
+                               if( !mask_gui || !mask_points.size() ) break;
+                               if( mask_gui->focused ) {
+                                       gui->x_origin = atof(mask_gui->focus_x->get_text());
+                                       gui->y_origin = atof(mask_gui->focus_y->get_text());
                                }
-                               else if( n > 0 ) {
+                               else {
+                                       float cx = 0, cy = 0;
+                                       int n = mask_points.size();
                                        for( int i=0; i<n; ++i ) {
                                                MaskPoint *point = mask_points.values[i];
                                                cx += point->x;  cy += point->y;
                                        }
                                        cx /= n;  cy /= n;
+                                       mask_gui->set_focused(0, cx, cy);
                                }
-                               gui->x_origin = cx;
-                               gui->y_origin = cy;
+                               int button_no = get_buttonpress();
+                               double scale = button_no == WHEEL_UP ? 1.02 : 0.98;
+                               double theta = button_no == WHEEL_UP ? M_PI/360. : -M_PI/360.;
+                               float st = sin(theta), ct = cos(theta);
                                for( int i=0; i<mask_points.size(); ++i ) {
                                        MaskPoint *point = mask_points.values[i];
                                        float px = point->x - gui->x_origin;
@@ -2203,11 +2205,7 @@ int CWindowCanvas::do_mask_focus()
        CWindowMaskGUI *mask_gui = (CWindowMaskGUI*) gui->tool_panel->tool_gui;
        float cx = get_cursor_x(), cy = get_cursor_y();
        canvas_to_output(mwindow->edl, 0, cx, cy);
-       get_canvas()->unlock_window();
-       mask_gui->lock_window("CWindowCanvas::do_mask_focus");
        mask_gui->set_focused(1, cx, cy);
-       mask_gui->unlock_window();
-       get_canvas()->lock_window("CWindowCanvas::do_mask_focus");
        return 1;
 }
 
index 295f5c1..80122c5 100644 (file)
@@ -1739,7 +1739,7 @@ CWindowMaskUnclear::CWindowMaskUnclear(MWindow *mwindow,
 {
        this->mwindow = mwindow;
        this->gui = gui;
-       set_tooltip(_("Show mask"));
+       set_tooltip(_("Show/Hide mask"));
 }
 
 int CWindowMaskUnclear::handle_event()
@@ -2362,11 +2362,11 @@ int CWindowMaskClrMask::handle_event()
        if( track ) {
                mwindow->undo->update_undo_before(_("del masks"), 0);
                ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->clear_all();
-               gui->update();
-               gui->update_preview();
                mwindow->undo->update_undo_after(_("del masks"), LOAD_AUTOMATION);
        }
 
+       gui->update();
+       gui->update_preview(1);
        return 1;
 }
 
@@ -2390,7 +2390,7 @@ int CWindowMaskGangFeather::handle_event()
 
 CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread)
  : CWindowToolGUI(mwindow, thread,
-       _(PROGRAM_NAME ": Mask"), 400, 660)
+       _(PROGRAM_NAME ": Mask"), 420, 680)
 {
        this->mwindow = mwindow;
        this->thread = thread;
@@ -2451,7 +2451,7 @@ void CWindowMaskGUI::create_objects()
        add_subwindow(title = new BC_Title(x, y, _("Select:")));
        int bw = 0, bh = 0;
        BC_CheckBox::calculate_extents(this, &bw, &bh);
-       int bdx = bw + margin;
+       int bdx = bw + 2*margin;
        x2 = x1;
        for( int i=0; i<SUBMASKS; x2+=bdx, ++i ) {
                int v = i == mwindow->edl->session->cwindow_mask ? 1 : 0;
@@ -2605,6 +2605,7 @@ void CWindowMaskGUI::update()
        MaskPoint *point;
 //printf("CWindowMaskGUI::update 1\n");
        get_keyframe(track, autos, keyframe, mask, point, 0);
+       mwindow->cwindow->mask_track_id = track ? track->get_id() : -1;
        mask_on_track->set_back_color(!track || track->record ?
                get_resources()->text_background :
                get_resources()->text_background_disarmed);
@@ -2684,9 +2685,15 @@ void CWindowMaskGUI::handle_event()
 
 void CWindowMaskGUI::set_focused(int v, float cx, float cy)
 {
+       CWindowGUI *cgui = mwindow->cwindow->gui;
+       cgui->unlock_window();
+       lock_window("CWindowMaskGUI::set_focused");
+       if( focused != v )
+               focus->update(focused = v);
        focus_x->update(cx);
        focus_y->update(cy);
-       focus->update(focused = v);
+       unlock_window();
+       cgui->lock_window("CWindowCanvas::set_focused");
 }
 
 void CWindowMaskGUI::update_buttons(MaskAuto *keyframe, int k)
index 0f2c964..11299c2 100644 (file)
@@ -97,8 +97,7 @@ EditPopupClearSelect::EditPopupClearSelect(MWindow *mwindow, EditPopup *popup)
 
 int EditPopupClearSelect::handle_event()
 {
-       mwindow->edl->tracks->clear_selected_edits();
-       popup->gui->draw_overlays(1);
+       mwindow->clear_select();
        return 1;
 }
 
index 74bd416..8c8901b 100644 (file)
@@ -245,7 +245,7 @@ Edit* Edits::split_edit(int64_t position)
        new_edit->copy_from(edit);
        new_edit->length = new_edit->startproject + new_edit->length - position;
        edit->length = position - edit->startproject;
-       if( !new_edit->length 
+       if( !new_edit->length || edit->silence() )
                new_edit->hard_left = new_edit->hard_right = 0;
        else if( !edit->length )
                edit->hard_left = edit->hard_right = 0;
index 640092d..fd481ce 100644 (file)
@@ -41,7 +41,6 @@
 #include "keyframe.h"
 #include "keyframes.h"
 #include "indexstate.h"
-#include "interlacemodes.h"
 #include "labels.h"
 #include "localsession.h"
 #include "maskautos.h"
@@ -1437,14 +1436,7 @@ if( debug ) printf("EDL::get_use_vconsole %d\n", __LINE__);
            asset->height != session->output_h )
                return 1;
 
-
 if( debug ) printf("EDL::get_use_vconsole %d\n", __LINE__);
-// Asset and output device must have same resulting de-interlacing method
-       if( ilaceautofixmethod2(session->interlace_mode,
-           asset->interlace_autofixoption, asset->interlace_mode,
-           asset->interlace_fixmethod) != ILACE_FIXMETHOD_NONE )
-               return 1;
-
 // If we get here the frame is going to be directly copied.  Whether it is
 // decompressed in hardware depends on the colormodel.
        return 0;
index f7ad943..268f3be 100644 (file)
@@ -18,6 +18,7 @@
 #include "fileffmpeg.h"
 #include "filesystem.h"
 #include "indexfile.h"
+#include "interlacemodes.h"
 #include "language.h"
 #include "mainerror.h"
 #include "mainprogress.h"
index 6462fdc..6f4e3e4 100644 (file)
@@ -25,7 +25,6 @@
 #include "filegif.h"
 #include "gif_lib.h"
 #include "mainerror.h"
-#include "interlacemodes.h"
 #include "vframe.h"
 
 #include <stdlib.h>
index 2ec72fb..ab96782 100644 (file)
@@ -26,7 +26,6 @@
 #include "mwindow.h"
 #include "new.h"
 #include "setformat.h"
-#include "interlacemodes.h"
 
 
 FormatPresets::FormatPresets(MWindow *mwindow,
index cb2c74d..a77d0c5 100644 (file)
 
 #include "interlacemodes.h"
 
-// AUTO FIX METHOD ====================
-
-void ilaceautofixoption_to_text(char *string, int autofixoption)
-{
-       const char *cp = 0;
-       switch(autofixoption) {
-       case ILACE_AUTOFIXOPTION_AUTO:          cp = ILACE_AUTOFIXOPTION_AUTO_T;        break;
-       case ILACE_AUTOFIXOPTION_MANUAL:        cp = ILACE_AUTOFIXOPTION_MANUAL_T;      break;
-       default: cp = ILACE_UNKNOWN_T;  break;
-       }
-       strcpy(string, _(cp));
-}
-
-int ilaceautofixoption_from_text(const char *text, int thedefault)
-{
-       if(!strcasecmp(text, _(ILACE_AUTOFIXOPTION_AUTO_T)))    return ILACE_AUTOFIXOPTION_AUTO;
-       if(!strcasecmp(text, _(ILACE_AUTOFIXOPTION_MANUAL_T)))  return ILACE_AUTOFIXOPTION_MANUAL;
-       return thedefault;
-}
-
-// INTERLACE MODE ====================
-
 void ilacemode_to_text(char *string, int ilacemode)
 {
        const char *cp = 0;
@@ -97,99 +75,3 @@ int ilacemode_from_xmltext(const char *text, int thedefault)
        return thedefault;
 }
 
-// INTERLACE FIX METHOD ====================
-
-void ilacefixmethod_to_text(char *string, int fixmethod)
-{
-       const char *cp = 0;
-       switch(fixmethod) {
-       case ILACE_FIXMETHOD_NONE:      cp = ILACE_FIXMETHOD_NONE_T;    break;
-       case ILACE_FIXMETHOD_UPONE:     cp = ILACE_FIXMETHOD_UPONE_T;   break;
-       case ILACE_FIXMETHOD_DOWNONE:   cp = ILACE_FIXMETHOD_DOWNONE_T; break;
-       default: cp = ILACE_UNKNOWN_T;  break;
-       }
-       strcpy(string, _(cp));
-}
-
-int ilacefixmethod_from_text(const char *text, int thedefault)
-{
-       if(!strcasecmp(text, _(ILACE_FIXMETHOD_NONE_T)))        return ILACE_FIXMETHOD_NONE;
-       if(!strcasecmp(text, _(ILACE_FIXMETHOD_UPONE_T)))       return ILACE_FIXMETHOD_UPONE;
-       if(!strcasecmp(text, _(ILACE_FIXMETHOD_DOWNONE_T)))     return ILACE_FIXMETHOD_DOWNONE;
-       return thedefault;
-}
-
-void ilacefixmethod_to_xmltext(char *string, int fixmethod)
-{
-       switch(fixmethod) {
-       case ILACE_FIXMETHOD_NONE:      strcpy(string, ILACE_FIXMETHOD_NONE_XMLT);      return;
-       case ILACE_FIXMETHOD_UPONE:     strcpy(string, ILACE_FIXMETHOD_UPONE_XMLT);     return;
-       case ILACE_FIXMETHOD_DOWNONE:   strcpy(string, ILACE_FIXMETHOD_DOWNONE_XMLT);   return;
-       }
-       strcpy(string, ILACE_UNKNOWN_T);
-}
-
-int ilacefixmethod_from_xmltext(const char *text, int thedefault)
-{
-       if(!strcasecmp(text, ILACE_FIXMETHOD_NONE_XMLT))        return ILACE_FIXMETHOD_NONE;
-       if(!strcasecmp(text, ILACE_FIXMETHOD_UPONE_XMLT))       return ILACE_FIXMETHOD_UPONE;
-       if(!strcasecmp(text, ILACE_FIXMETHOD_DOWNONE_XMLT))     return ILACE_FIXMETHOD_DOWNONE;
-       return thedefault;
-}
-
-int  ilaceautofixmethod(int projectmode, int assetmode)
-{
-       if (projectmode == assetmode)
-               return ILACE_FIXMETHOD_NONE;
-       if( (projectmode == ILACE_MODE_BOTTOM_FIRST && assetmode == ILACE_MODE_TOP_FIRST ) ||
-           (projectmode == ILACE_MODE_TOP_FIRST  && assetmode == ILACE_MODE_BOTTOM_FIRST) )
-               return ILACE_FIXDEFAULT;
-       // still to implement anything else...
-       return ILACE_FIXMETHOD_NONE;
-}
-
-int  ilaceautofixmethod2(int projectilacemode, int assetautofixoption, int assetilacemode, int assetfixmethod)
-{
-       if (assetautofixoption == ILACE_AUTOFIXOPTION_AUTO)
-               return (ilaceautofixmethod(projectilacemode, assetilacemode));
-       return (assetfixmethod);
-}
-
-int ilace_bc_to_yuv4mpeg(int ilacemode)
-{
-       switch (ilacemode) {
-       case ILACE_MODE_UNDETECTED:     return(Y4M_UNKNOWN);
-       case ILACE_MODE_TOP_FIRST:      return(Y4M_ILACE_TOP_FIRST);
-       case ILACE_MODE_BOTTOM_FIRST: return(Y4M_ILACE_BOTTOM_FIRST);
-       case ILACE_MODE_NOTINTERLACED: return(Y4M_ILACE_NONE);
-       }
-       return(Y4M_UNKNOWN);
-}
-
-int ilace_yuv4mpeg_to_bc(int ilacemode)
-{
-       switch (ilacemode) {
-       case Y4M_UNKNOWN:               return (ILACE_MODE_UNDETECTED);
-       case Y4M_ILACE_NONE:            return (ILACE_MODE_NOTINTERLACED);
-       case Y4M_ILACE_TOP_FIRST:       return (ILACE_MODE_TOP_FIRST);
-       case Y4M_ILACE_BOTTOM_FIRST:    return (ILACE_MODE_BOTTOM_FIRST);
-//     case Y4M_ILACE_MIXED:           return (ILACE_MODE_UNDETECTED);  // fixme!!
-       }
-       return (ILACE_MODE_UNDETECTED);
-}
-
-
-void ilace_yuv4mpeg_mode_to_text(char *string, int ilacemode)
-{
-       const char *cp = 0;
-       switch(ilacemode) {
-       case Y4M_UNKNOWN:             cp = ILACE_Y4M_UKNOWN_T;       break;
-       case Y4M_ILACE_NONE:          cp = ILACE_Y4M_NONE_T;         break;
-       case Y4M_ILACE_TOP_FIRST:     cp = ILACE_Y4M_TOP_FIRST_T;    break;
-       case Y4M_ILACE_BOTTOM_FIRST:  cp = ILACE_Y4M_BOTTOM_FIRST_T; break;
-//     case Y4M_ILACE_MIXED:         cp = ILACE_Y4M_MIXED_T;        break;
-       default: cp = ILACE_UNKNOWN_T;  break;
-       }
-       strcpy(string, _(cp));
-}
-
index f063397..4dadb91 100644 (file)
 
 #define ILACE_UNKNOWN_T      N_("Error!")
 
-//Interlace Automatic fixing options
-#define ILACE_AUTOFIXOPTION_MANUAL     0
-#define ILACE_AUTOFIXOPTION_MANUAL_T   N_("Manual compensation using selection")
-#define ILACE_AUTOFIXOPTION_AUTO       1
-#define ILACE_AUTOFIXOPTION_AUTO_T     N_("Automatic compensation using modes")
-//Note: Do not change what the numbers mean as this will make backward-compatability have erroraneous settings.
-
 //Interlace Modes
 #define ILACE_MODE_UNDETECTED         0
 #define ILACE_MODE_UNDETECTED_XMLT    "UNKNOWN"
 #define ILACE_Y4M_BOTTOM_FIRST_T   N_("interlaced, bottom-field first")
 #define ILACE_Y4M_MIXED_T          N_("mixed, \"refer to frame header\"")
 
-void ilaceautofixoption_to_text(char *string, int autofixoption);
-int  ilaceautofixoption_from_text(const char *text, int thedefault);
-
 void ilacemode_to_text(char *string, int ilacemode);
 int  ilacemode_from_text(const char *text, int thedefault);
 void ilacemode_to_xmltext(char *string, int ilacemode);
 int  ilacemode_from_xmltext(const char *text, int thedefault);
 
-void ilacefixmethod_to_text(char *string, int fixmethod);
-int  ilacefixmethod_from_text(const char *text, int thedefault);
-void ilacefixmethod_to_xmltext(char *string, int fixmethod);
-int  ilacefixmethod_from_xmltext(const char *text, int thedefault);
-
-
-int  ilaceautofixmethod(int projectilacemode, int assetilacemode);
-int  ilaceautofixmethod2(int projectilacemode, int assetautofixoption, int assetilacemode, int assetfixmethod);
-
 int ilace_bc_to_yuv4mpeg(int ilacemode);
 int ilace_yuv4mpeg_to_bc(int ilacemode);
 
index 52cfe6e..9fe3c29 100644 (file)
@@ -979,8 +979,9 @@ void EditClearMenu::create_objects()
        add_submenu(clear_sub_menu = new EditClearSubMenu(this));
        clear_sub_menu->add_item(new Clear(mwindow));
        clear_sub_menu->add_item(new MuteSelection(mwindow));
-       clear_sub_menu->add_item(new ClearHardEdges(mwindow));
+       clear_sub_menu->add_item(new ClearSelect(mwindow));
        clear_sub_menu->add_item(new ClearLabels(mwindow));
+       clear_sub_menu->add_item(new ClearHardEdges(mwindow));
 };
 
 Clear::Clear(MWindow *mwindow)
@@ -1048,6 +1049,19 @@ int ClearLabels::handle_event()
        return 1;
 }
 
+ClearSelect::ClearSelect(MWindow *mwindow) : BC_MenuItem(_("Clear Select"),"Ctrl-Shift-A",'A')
+{
+       set_ctrl(1);
+       set_shift(1);
+       this->mwindow = mwindow;
+}
+
+int ClearSelect::handle_event()
+{
+       mwindow->clear_select();
+       return 1;
+}
+
 CutCommercials::CutCommercials(MWindow *mwindow) : BC_MenuItem(_("Cut ads"))
 {
        this->mwindow = mwindow;
index ccb9d25..a883383 100644 (file)
@@ -414,6 +414,14 @@ public:
        MWindow *mwindow;
 };
 
+class ClearSelect : public BC_MenuItem
+{
+public:
+       ClearSelect(MWindow *mwindow);
+       int handle_event();
+       MWindow *mwindow;
+};
+
 class CutCommercials : public BC_MenuItem
 {
 public:
index 323243a..0661591 100644 (file)
@@ -361,7 +361,6 @@ MWindow::~MWindow()
        colormodels.remove_all_objects();
        interlace_project_modes.remove_all_objects();
        interlace_asset_modes.remove_all_objects();
-       interlace_asset_fixmethods.remove_all_objects();
        sighandler->terminate();
        delete sighandler;
        delete run_lock;
@@ -1531,9 +1530,6 @@ void MWindow::init_menus()
 #define ILACEASSETMODELISTADD(x) ilacemode_to_text(string, x); \
                            interlace_asset_modes.append(new InterlacemodeItem(string, x));
 
-#define ILACEFIXMETHODLISTADD(x) ilacefixmethod_to_text(string, x); \
-                           interlace_asset_fixmethods.append(new InterlacefixmethodItem(string, x));
-
        // Interlacing Modes
        ILACEASSETMODELISTADD(ILACE_MODE_UNDETECTED); // Not included in the list for the project options.
 
@@ -1546,11 +1542,6 @@ void MWindow::init_menus()
        ILACEASSETMODELISTADD(ILACE_MODE_NOTINTERLACED);
        ILACEPROJECTMODELISTADD(ILACE_MODE_NOTINTERLACED);
 
-       // Interlacing Fixing Methods
-       ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_NONE);
-       ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_UPONE);
-       ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_DOWNONE);
-
        mixers_align = new MixersAlign(this);
 }
 
index 11d393c..b0cc09f 100644 (file)
@@ -350,6 +350,7 @@ public:
        int clear_labels(double start, double end);
        void clear_hard_edges();
        int clear_hard_edges(double start, double end);
+       void clear_select();
        void concatenate_tracks();
        int copy_flags(int copy_flags=COPY_CLIPBOARD);
        void copy();
@@ -582,7 +583,6 @@ public:
        ArrayList<ColormodelItem*> colormodels;
        ArrayList<InterlacemodeItem*>          interlace_project_modes;
        ArrayList<InterlacemodeItem*>          interlace_asset_modes;
-       ArrayList<InterlacefixmethodItem*>     interlace_asset_fixmethods;
 
        int reset_meters();
        void resync_guis();
index d3e5218..f9f9290 100644 (file)
@@ -434,6 +434,12 @@ int MWindow::clear_hard_edges(double start, double end)
        return 0;
 }
 
+void MWindow::clear_select()
+{
+       edl->tracks->clear_selected_edits();
+       gui->draw_overlays(1);
+}
+
 void MWindow::concatenate_tracks()
 {
        undo_before();
index dc511bd..d260378 100644 (file)
@@ -388,30 +388,4 @@ private:
        char string[BCTEXTLEN];
 };
 
-class InterlacefixmethodItem : public BC_ListBoxItem
-{
-public:
-       InterlacefixmethodItem(const char *text, int value);
-       int value;
-};
-
-class InterlacefixmethodPulldown : public BC_ListBox
-{
-public:
-       InterlacefixmethodPulldown(MWindow *mwindow,
-                                  BC_TextBox *output_text,
-                                  int *output_value,
-                                  ArrayList<BC_ListBoxItem*> *data,
-                                  int x,
-                                  int y);
-       int handle_event();
-       const char* interlacefixmethod_to_text();
-       MWindow *mwindow;
-       BC_TextBox *output_text;
-       int *output_value;
-private:
-       char string[BCTEXTLEN];
-};
-
-
 #endif
index 2413c4f..d536331 100644 (file)
@@ -1142,7 +1142,7 @@ int Track::blade(double position)
 {
        int64_t start = to_units(position, 0);
        Edit *edit = edits->split_edit(start);
-       if( !edit ) return 1;
+       if( !edit || edit->silence() ) return 1;
        edit->hard_left = 1;
        if( edit->previous ) edit->previous->hard_right = 1;
        return 0;
index 3f526fd..ab9cf97 100644 (file)
@@ -4801,7 +4801,7 @@ int TrackCanvas::do_edit_handles(int cursor_x, int cursor_y, int button_press,
                        update_overlay = 1;
                }
        }
-       else if( result < 0 ) {
+       else if( result < 0 && !edit_result->silence() ) {
                mwindow->undo->update_undo_before();
                if( !shift_down() ) {
                        if( handle_result == 0 )
index 1c32c3f..88d1c01 100644 (file)
@@ -56,7 +56,6 @@
 #include "vplugin.h"
 #include "vtrack.h"
 #include <string.h>
-#include "interlacemodes.h"
 #include "maskengine.h"
 #include "automation.h"
 
@@ -368,38 +367,6 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit,
 
 // printf("VModule::import_frame %d %f %d %f %d\n",
 // __LINE__, in_w, asset_w, in_h, asset_h);
-//
-//                     printf("VModule::import_frame 1 [ilace] Project: mode (%d) Asset: autofixoption (%d), mode (%d), method (%d)\n",
-//                     get_edl()->session->interlace_mode,
-//                     current_edit->asset->interlace_autofixoption,
-//                     current_edit->asset->interlace_mode,
-//                     current_edit->asset->interlace_fixmethod);
-
-                       // Determine the interlacing method to use.
-                       int interlace_fixmethod = !current_edit->asset ? ILACE_FIXMETHOD_NONE :
-                                ilaceautofixmethod2(get_edl()->session->interlace_mode,
-                                       current_edit->asset->interlace_autofixoption,
-                                       current_edit->asset->interlace_mode,
-                                       current_edit->asset->interlace_fixmethod);
-//
-//                     char string[BCTEXTLEN];
-//                     ilacefixmethod_to_text(string,interlace_fixmethod);
-//                     printf("VModule::import_frame 1 [ilace] Compensating by using: '%s'\n",string);
-
-                       // Compensate for the said interlacing...
-                       switch( interlace_fixmethod ) {
-                               case ILACE_FIXMETHOD_NONE:
-
-                               break;
-                               case ILACE_FIXMETHOD_UPONE:
-                                       out_y--;
-                               break;
-                               case ILACE_FIXMETHOD_DOWNONE:
-                                       out_y++;
-                               break;
-                               default:
-                                       printf("vmodule::importframe WARNING - unknown fix method for interlacing, no compensation in effect\n");
-                       }
 
 // file -> temp -> output
                        if( !EQUIV(in_x, 0) ||
index 6097913..c0b3756 100644 (file)
@@ -146,7 +146,7 @@ public:
        static int calculate_h(BC_WindowBase *gui, int font=MEDIUMFONT);
 
        static void calculate_extents(BC_WindowBase *gui, int *w, int *h,
-               const char *caption="", int font=MEDIUMFONT);
+               const char *caption=0, int font=MEDIUMFONT);
        int *value;
 };
 
index 826f817..8e3ac91 100644 (file)
@@ -141,13 +141,9 @@ GradientWindow::GradientWindow(GradientMain *plugin)
        center_y = 0;
        center_x_title = 0;
        center_y_title = 0;
-       in_color_thread = 0;
-       out_color_thread = 0;
 }
 GradientWindow::~GradientWindow()
 {
-       delete in_color_thread;
-       delete out_color_thread;
 }
 
 
@@ -170,7 +166,7 @@ void GradientWindow::create_objects()
        add_subwindow(rate = new GradientRate(plugin,
                        x + title->get_w() + margin, y));
        rate->create_objects();
-       y += rate->get_h() + margin;
+       y += rate->get_h() + 3*margin;
 
        int x1 = x, y1 = y;
        BC_Title *title1;
@@ -179,40 +175,33 @@ void GradientWindow::create_objects()
        BC_Title *title2;
        add_subwindow(title2 = new BC_Title(x, y, _("Outer radius:")));
 
-       add_subwindow(reset = new GradientReset(plugin, this, x, y+100));
-
        y = y1;
        x += MAX(title1->get_w(), title2->get_w()) + margin;
        add_subwindow(in_radius = new GradientInRadius(plugin, x, y));
        y += in_radius->get_h() + margin;
        add_subwindow(out_radius = new GradientOutRadius(plugin, x, y));
-       y += out_radius->get_h() + margin;
+       y += out_radius->get_h() + 3*margin;
 
        x = x1;
-       y1 = y;
-       add_subwindow(in_color = new GradientInColorButton(plugin, this, x, y));
-       y += COLOR_H + margin;
-
-       add_subwindow(out_color = new GradientOutColorButton(plugin, this, x, y));
-       x += MAX(in_color->get_w(), out_color->get_w()) + margin;
-       y = y1;
-
-       in_color_x = x;
-       in_color_y = y;
-       y += COLOR_H + margin;
-       out_color_x = x;
-       out_color_y = y;
-       in_color_thread = new GradientInColorThread(plugin, this);
-       out_color_thread = new GradientOutColorThread(plugin, this);
-       update_in_color();
-       update_out_color();
+       add_subwindow(title1 = new BC_Title(x, y, _("Inner Color:")));
+       y1 = y + COLOR_H+4 + 2*margin;
+       add_subwindow(title2 = new BC_Title(x, y1, _("Outer Color:")));
+       int x2 = x + MAX(title1->get_w(), title2->get_w()) + margin;
+       int in_rgb = plugin->config.get_in_color();
+       int in_a = plugin->config.in_a;
+       add_subwindow(in_color = new GradientInColorButton(plugin, this, x2+2, y+2, in_rgb, in_a));
+       draw_3d_border(x2,y, COLOR_W+4,COLOR_H+4, 1);
+       in_color->create_objects();
+
+       int out_rgb = plugin->config.get_out_color();
+       int out_a = plugin->config.out_a;
+       add_subwindow(out_color = new GradientOutColorButton(plugin, this, x2+2, y1+2, out_rgb, out_a));
+       draw_3d_border(x2,y1, COLOR_W+4,COLOR_H+4, 1);
+       out_color->create_objects();
+       y = y1 + COLOR_H+4 + 3*margin;
+
+       add_subwindow(reset = new GradientReset(plugin, this, x, y));
        update_shape();
-
-       draw_3d_border(in_color_x - 2, in_color_y - 2,
-               COLOR_W + 4, COLOR_H + 4, 1);
-
-       draw_3d_border(out_color_x - 2, out_color_y - 2,
-               COLOR_W + 4, COLOR_H + 4, 1);
        show_window();
 }
 
@@ -246,26 +235,10 @@ void GradientWindow::update_shape()
        show_window();
 }
 
-void GradientWindow::update_in_color()
-{
-//printf("GradientWindow::update_in_color 1 %08x\n", plugin->config.get_in_color());
-       set_color(plugin->config.get_in_color());
-       draw_box(in_color_x, in_color_y, COLOR_W, COLOR_H);
-       flash(in_color_x, in_color_y, COLOR_W, COLOR_H);
-}
-
-void GradientWindow::update_out_color()
-{
-//printf("GradientWindow::update_out_color 1 %08x\n", plugin->config.get_in_color());
-       set_color(plugin->config.get_out_color());
-       draw_box(out_color_x, out_color_y, COLOR_W, COLOR_H);
-       flash(out_color_x, out_color_y, COLOR_W, COLOR_H);
-}
-
 void GradientWindow::done_event(int result)
 {
-       in_color_thread->close_window();
-       out_color_thread->close_window();
+       in_color->close_picker();
+       out_color->close_picker();
 }
 
 GradientShape::GradientShape(GradientMain *plugin, GradientWindow *gui, int x, int y)
@@ -406,101 +379,96 @@ int GradientOutRadius::handle_event()
        return 1;
 }
 
-GradientInColorButton::GradientInColorButton(GradientMain *plugin, GradientWindow *window, int x, int y)
- : BC_GenericButton(x, y, _("Inner color:"))
+
+GradientInColorButton::GradientInColorButton(GradientMain *plugin, GradientWindow *gui,
+               int x, int y, int color, int alpha)
+ : ColorBoxButton(_("Inner color:"), x, y, COLOR_W, COLOR_H, color, alpha, 1)
 {
        this->plugin = plugin;
-       this->window = window;
+       this->gui = gui;
+       for( int i=0; i<3; ++i ) {
+               vframes[i] = new VFrame(COLOR_W, COLOR_H, BC_RGB888);
+               vframes[i]->clear_frame();
+       }
 }
 
-int GradientInColorButton::handle_event()
+GradientInColorButton::~GradientInColorButton()
 {
-       window->in_color_thread->start_window(
-               plugin->config.get_in_color(),
-               plugin->config.in_a);
-       return 1;
+       for( int i=0; i<3; ++i )
+               delete vframes[i];
 }
 
-
-GradientOutColorButton::GradientOutColorButton(GradientMain *plugin, GradientWindow *window, int x, int y)
- : BC_GenericButton(x, y, _("Outer color:"))
+void GradientInColorButton::handle_done_event(int result)
 {
-       this->plugin = plugin;
-       this->window = window;
+       if( result ) {
+               gui->lock_window("GradientInColorButton::handle_done_event");
+               update_gui(orig_color, orig_alpha);
+               gui->unlock_window();
+               handle_new_color(orig_color, orig_alpha);
+       }
 }
 
-int GradientOutColorButton::handle_event()
+int GradientInColorButton::handle_new_color(int color, int alpha)
 {
-       window->out_color_thread->start_window(
-               plugin->config.get_out_color(),
-               plugin->config.out_a);
+       plugin->config.in_r = (color & 0xff0000) >> 16;
+       plugin->config.in_g = (color & 0xff00) >> 8;
+       plugin->config.in_b = (color & 0xff);
+       plugin->config.in_a = alpha;
+       plugin->send_configure_change();
        return 1;
 }
 
-GradientReset::GradientReset(GradientMain *plugin, GradientWindow *window, int x, int y)
- : BC_GenericButton(x, y, _("Reset"))
+GradientOutColorButton::GradientOutColorButton(GradientMain *plugin, GradientWindow *gui,
+               int x, int y, int color, int alpha)
+ : ColorBoxButton(_("Outer color:"), x, y, COLOR_W, COLOR_H, color, alpha, 1)
 {
        this->plugin = plugin;
-       this->window = window;
+       this->gui = gui;
+       for( int i=0; i<3; ++i ) {
+               vframes[i] = new VFrame(COLOR_W, COLOR_H, BC_RGB888);
+               vframes[i]->clear_frame();
+       }
 }
 
-int GradientReset::handle_event()
+GradientOutColorButton::~GradientOutColorButton()
 {
-       plugin->config.reset();
-       window->update_gui();
-       plugin->send_configure_change();
-       return 1;
+       for( int i=0; i<3; ++i )
+               delete vframes[i];
 }
 
-GradientInColorThread::GradientInColorThread(GradientMain *plugin,
-       GradientWindow *window)
- : ColorPicker(1, _("Inner color"))
+void GradientOutColorButton::handle_done_event(int result)
 {
-       this->plugin = plugin;
-       this->window = window;
+       if( result ) {
+               gui->lock_window("GradientInColorButton::handle_done_event");
+               update_gui(orig_color, orig_alpha);
+               gui->unlock_window();
+               handle_new_color(orig_color, orig_alpha);
+       }
 }
 
-int GradientInColorThread::handle_new_color(int output, int alpha)
+int GradientOutColorButton::handle_new_color(int color, int alpha)
 {
-       plugin->config.in_r = (output & 0xff0000) >> 16;
-       plugin->config.in_g = (output & 0xff00) >> 8;
-       plugin->config.in_b = (output & 0xff);
-       plugin->config.in_a = alpha;
-
-       window->lock_window("GradientInColorThread::handle_new_color");
-       window->update_in_color();
-       window->flush();
-       window->unlock_window();
+       plugin->config.out_r = (color & 0xff0000) >> 16;
+       plugin->config.out_g = (color & 0xff00) >> 8;
+       plugin->config.out_b = (color & 0xff);
+       plugin->config.out_a = alpha;
        plugin->send_configure_change();
-//printf("GradientInColorThread::handle_event 1 %d %d %d %d %d %d %d %d\n",
-// plugin->config.in_r, plugin->config.in_g, plugin->config.in_b, plugin->config.in_a,
-// plugin->config.out_r, plugin->config.out_g, plugin->config.out_b, plugin->config.out_a);
        return 1;
 }
 
 
-GradientOutColorThread::GradientOutColorThread(GradientMain *plugin,
-       GradientWindow *window)
- : ColorPicker(1, _("Outer color"))
+GradientReset::GradientReset(GradientMain *plugin, GradientWindow *window, int x, int y)
+ : BC_GenericButton(x, y, _("Reset"))
 {
        this->plugin = plugin;
        this->window = window;
 }
 
-int GradientOutColorThread::handle_new_color(int output, int alpha)
+int GradientReset::handle_event()
 {
-       plugin->config.out_r = (output & 0xff0000) >> 16;
-       plugin->config.out_g = (output & 0xff00) >> 8;
-       plugin->config.out_b = (output & 0xff);
-       plugin->config.out_a = alpha;
-       window->lock_window("GradientOutColorThread::handle_new_color");
-       window->update_out_color();
-       window->flush();
-       window->unlock_window();
+       plugin->config.reset();
+       window->update_gui();
        plugin->send_configure_change();
-//printf("GradientOutColorThread::handle_event 1 %d %d %d %d %d %d %d %d\n",
-// plugin->config.in_r, plugin->config.in_g, plugin->config.in_b, plugin->config.in_a,
-// plugin->config.out_r, plugin->config.out_g, plugin->config.out_b, plugin->config.out_a);
        return 1;
 }
 
@@ -606,10 +574,13 @@ void GradientMain::update_gui()
 {
        if( !thread ) return;
        if( !load_configuration() ) return;
-       ((GradientWindow*)thread->window)->lock_window("GradientMain::update_gui");
-       GradientWindow *window = (GradientWindow *)thread->window;
-       window->update_gui();
-       window->unlock_window();
+       thread->window->lock_window("GradientMain::update_gui");
+       if( load_configuration() ) {
+               GradientWindow *window = (GradientWindow *)thread->window;
+               window->update_gui();
+               window->flush();
+       }
+       thread->window->unlock_window();
 }
 
 void GradientWindow::update_gui()
@@ -622,13 +593,9 @@ void GradientWindow::update_gui()
        if( angle ) angle->update(config.angle);
        if( center_x ) center_x->update(config.center_x);
        if( center_y ) center_y->update(config.center_y);
-       update_in_color();
-       update_out_color();
        update_shape();
-       unlock_window();
-       in_color_thread->update_gui(config.get_in_color(), config.in_a);
-       out_color_thread->update_gui(config.get_out_color(), config.out_a);
-       lock_window("GradientWindow::update_gui");
+       in_color->update_gui(config.get_in_color(), config.in_a);
+       out_color->update_gui(config.get_out_color(), config.out_a);
 }
 
 
index 25a3a4d..f49af42 100644 (file)
@@ -152,56 +152,46 @@ public:
        GradientMain *plugin;
 };
 
-class GradientInColorButton : public BC_GenericButton
+class GradientInColorButton : public ColorBoxButton
 {
 public:
-       GradientInColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
-       int handle_event();
-       GradientMain *plugin;
-       GradientWindow *window;
-};
+       GradientInColorButton(GradientMain *plugin, GradientWindow *gui,
+               int x, int y, int color, int alpha);
+       ~GradientInColorButton();
 
+       int handle_new_color(int color, int alpha);
+       void handle_done_event(int result);
 
-class GradientOutColorButton : public BC_GenericButton
-{
-public:
-       GradientOutColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
-       int handle_event();
        GradientMain *plugin;
-       GradientWindow *window;
+       GradientWindow *gui;
+       VFrame *vframes[3];
 };
 
-class GradientReset : public BC_GenericButton
+class GradientOutColorButton : public ColorBoxButton
 {
 public:
-       GradientReset(GradientMain *plugin, GradientWindow *window, int x, int y);
-       int handle_event();
-       GradientMain *plugin;
-       GradientWindow *window;
-};
+       GradientOutColorButton(GradientMain *plugin, GradientWindow *gui,
+               int x, int y, int color, int alpha);
+       ~GradientOutColorButton();
 
+       int handle_new_color(int color, int alpha);
+       void handle_done_event(int result);
 
-class GradientInColorThread : public ColorPicker
-{
-public:
-       GradientInColorThread(GradientMain *plugin, GradientWindow *window);
-       virtual int handle_new_color(int output, int alpha);
        GradientMain *plugin;
-       GradientWindow *window;
+       GradientWindow *gui;
+       VFrame *vframes[3];
 };
 
-
-class GradientOutColorThread : public ColorPicker
+class GradientReset : public BC_GenericButton
 {
 public:
-       GradientOutColorThread(GradientMain *plugin, GradientWindow *window);
-       virtual int handle_new_color(int output, int alpha);
+       GradientReset(GradientMain *plugin, GradientWindow *window, int x, int y);
+       int handle_event();
        GradientMain *plugin;
        GradientWindow *window;
 };
 
 
-
 class GradientWindow : public PluginClientWindow
 {
 public:
@@ -209,8 +199,6 @@ public:
        ~GradientWindow();
 
        void create_objects();
-       void update_in_color();
-       void update_out_color();
        void update_gui();
        void update_shape();
        void done_event(int result);
@@ -223,8 +211,6 @@ public:
        GradientInColorButton *in_color;
        GradientOutColorButton *out_color;
        GradientReset *reset;
-       GradientInColorThread *in_color_thread;
-       GradientOutColorThread *out_color_thread;
        GradientShape *shape;
        BC_Title *shape_title;
        GradientCenterX *center_x;
@@ -232,17 +218,10 @@ public:
        BC_Title *center_y_title;
        GradientCenterY *center_y;
        GradientRate *rate;
-       int in_color_x, in_color_y;
-       int out_color_x, out_color_y;
        int shape_x, shape_y;
 };
 
 
-
-
-
-
-
 class GradientMain : public PluginVClient
 {
 public: