From 258d9cb69d560f40961acdd20866e12e940c2f93 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sun, 16 Dec 2018 15:18:54 -0700 Subject: [PATCH] colorpicker rework, cin.desktop+shortcuts+license updates, edit titlebar colors+auto pref --- cinelerra-5.1/COPYING | 50 ++-- cinelerra-5.1/cinelerra/appearanceprefs.C | 16 + cinelerra-5.1/cinelerra/appearanceprefs.h | 8 + cinelerra-5.1/cinelerra/colorpicker.C | 282 +++++++++++++++++- cinelerra-5.1/cinelerra/colorpicker.h | 108 +++++-- cinelerra-5.1/cinelerra/colorpicker.inc | 28 ++ cinelerra-5.1/cinelerra/edit.C | 54 ++-- cinelerra-5.1/cinelerra/edit.h | 7 +- cinelerra-5.1/cinelerra/editpopup.C | 137 +++++++-- cinelerra-5.1/cinelerra/editpopup.h | 86 ++++-- cinelerra-5.1/cinelerra/editpopup.inc | 10 +- cinelerra-5.1/cinelerra/gwindowgui.C | 169 +---------- cinelerra-5.1/cinelerra/gwindowgui.h | 44 +-- cinelerra-5.1/cinelerra/mwindow.C | 8 + cinelerra-5.1/cinelerra/mwindow.h | 2 +- cinelerra-5.1/cinelerra/mwindowgui.C | 13 +- cinelerra-5.1/cinelerra/preferences.C | 4 + cinelerra-5.1/cinelerra/preferences.h | 3 +- cinelerra-5.1/cinelerra/preferencesthread.C | 12 +- cinelerra-5.1/cinelerra/resourcepixmap.C | 56 ++-- cinelerra-5.1/cinelerra/resourcepixmap.h | 2 + cinelerra-5.1/cinelerra/theme.C | 16 +- cinelerra-5.1/cinelerra/theme.h | 1 + cinelerra-5.1/doc/shortcuts.html | 66 ++++ cinelerra-5.1/image/cin.desktop | 3 +- cinelerra-5.1/info/plugins.txt | 6 +- .../plugins/sketcher/sketcherwindow.C | 160 +--------- .../plugins/sketcher/sketcherwindow.h | 45 +-- cinelerra-5.1/plugins/titler/titler.C | 1 - cinelerra-5.1/plugins/titler/titlerwindow.C | 117 +++----- cinelerra-5.1/plugins/titler/titlerwindow.h | 29 +- 31 files changed, 878 insertions(+), 665 deletions(-) diff --git a/cinelerra-5.1/COPYING b/cinelerra-5.1/COPYING index a3fa5380..d159169d 100644 --- a/cinelerra-5.1/COPYING +++ b/cinelerra-5.1/COPYING @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 19yy + Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -336,12 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. - -Also: - -cinfinity icons (c) by "sam" are licensed under a -Creative Commons Attribution 4.0 International License. -see: . - diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.C b/cinelerra-5.1/cinelerra/appearanceprefs.C index e27ebd02..a21fda26 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.C +++ b/cinelerra-5.1/cinelerra/appearanceprefs.C @@ -184,6 +184,9 @@ void AppearancePrefs::create_objects() UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1); add_subwindow(tip_win); y1 += tip_win->get_h() + 5; + AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x1, y1); + add_subwindow(autocolor_assets); + y1 += autocolor_assets->get_h() + 5; UseWarnIndecies *idx_win = new UseWarnIndecies(pwindow, x1, y1); add_subwindow(idx_win); y1 += idx_win->get_h() + 5; @@ -626,6 +629,19 @@ int ForwardRenderDisplacement::handle_event() return 1; } +AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y) + : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets, + _("Autocolor assets")) +{ + this->pwindow = pwindow; +} + +int AutocolorAssets::handle_event() +{ + pwindow->thread->preferences->autocolor_assets = get_value(); + return 1; +} + HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex) : BC_TextBox(x, y, 80, 1, hex) { diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.h b/cinelerra-5.1/cinelerra/appearanceprefs.h index e44c0025..51521664 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.h +++ b/cinelerra-5.1/cinelerra/appearanceprefs.h @@ -290,6 +290,14 @@ public: PreferencesWindow *pwindow; }; +class AutocolorAssets : public BC_CheckBox +{ +public: + AutocolorAssets(PreferencesWindow *pwindow, int x, int y); + int handle_event(); + PreferencesWindow *pwindow; +}; + class HighlightInverseColor : public BC_TextBox { public: diff --git a/cinelerra-5.1/cinelerra/colorpicker.C b/cinelerra-5.1/cinelerra/colorpicker.C index f3e87b35..76692f0d 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.C +++ b/cinelerra-5.1/cinelerra/colorpicker.C @@ -42,7 +42,7 @@ ColorPicker::ColorPicker(int do_alpha, const char *title) { this->title = title; this->do_alpha = do_alpha; - this->do_okcancel = 0; + this->ok_cancel = 0; this->output = this->orig_color = BLACK; this->alpha = this->orig_alpha = 255; } @@ -52,7 +52,7 @@ ColorPicker::~ColorPicker() close_window(); } -void ColorPicker::start_window(int output, int alpha, int do_okcancel) +void ColorPicker::start_window(int output, int alpha, int ok_cancel) { if( running() ) { ColorWindow *gui = (ColorWindow *)get_gui(); @@ -67,7 +67,7 @@ void ColorPicker::start_window(int output, int alpha, int do_okcancel) this->orig_alpha = alpha; this->output = output; this->alpha = alpha; - this->do_okcancel = do_okcancel; + this->ok_cancel = ok_cancel; start(); } @@ -80,7 +80,7 @@ BC_Window* ColorPicker::new_gui() int x = display_info.get_abs_cursor_x() + 25; int y = display_info.get_abs_cursor_y() - 100; int w = 540, h = 330; - if( do_okcancel ) + if( ok_cancel ) h += bmax(BC_OKButton::calculate_h(),BC_CancelButton::calculate_h()); int root_w = display_info.get_root_w(), root_h = display_info.get_root_h(); if( x+w > root_w ) x = root_w - w; @@ -107,7 +107,7 @@ void ColorPicker::update_gui(int output, int alpha) int ColorPicker::handle_new_color(int output, int alpha) { printf("ColorPicker::handle_new_color undefined.\n"); - return 0; + return 1; } @@ -221,10 +221,11 @@ void ColorWindow::create_objects() aph_a = new PaletteAPH(this, x,y+=40, aph, 0, 1); aph_a->create_objects(); aph_a->set_tooltip(_("Alpha")); } - if( thread->do_okcancel ) { + if( thread->ok_cancel ) { add_tool(new BC_OKButton(this)); add_tool(new BC_CancelButton(this)); } + thread->create_objects(this); update_display(); update_history(); @@ -246,7 +247,7 @@ void ColorWindow::change_values() int ColorWindow::close_event() { - set_done(thread->do_okcancel ? 1 : 0); + set_done(thread->ok_cancel ? 1 : 0); return 1; } @@ -1160,3 +1161,270 @@ int PaletteHistory::repeat_event(int64_t duration) return result; } + +ColorButton::ColorButton(const char *title, + int x, int y, int w, int h, + int color, int alpha, int ok_cancel) + : BC_Button(x, y, w, vframes) +{ + this->title = title; + this->color = this->orig_color = color; + this->alpha = this->orig_alpha = alpha; + this->ok_cancel = ok_cancel; + + for( int i=0; i<3; ++i ) { + vframes[i] = new VFrame(w, h, BC_RGBA8888); + vframes[i]->clear_frame(); + } + color_picker = 0; + color_thread = 0; +} + +ColorButton::~ColorButton() +{ + delete color_thread; + delete color_picker; + for( int i=0; i<3; ++i ) + delete vframes[i]; +} + +void ColorButton::set_color(int color) +{ + printf("ColorButton::set_color %06x\n", color); +} +void ColorButton::handle_done_event(int result) +{ + color_thread->stop(); +} +int ColorButton::handle_new_color(int color, int alpha) +{ + printf("ColorButton::handle_new_color %02x%06x\n", alpha, color); + return 1; +} + +int ColorButton::handle_event() +{ + unlock_window(); + delete color_picker; + color_picker = new ColorButtonPicker(this); + orig_color = color; orig_alpha = alpha; + color_picker->start_window(color, alpha, ok_cancel); + if( !color_thread ) + color_thread = new ColorButtonThread(this); + color_thread->start(); + lock_window("ColorButtonButton::start_color_thread"); + return 1; +} + +void ColorButton::close_picker() +{ + if( color_thread ) color_thread->stop(); + delete color_thread; color_thread = 0; + delete color_picker; color_picker = 0; +} + +void ColorButton::update_gui(int color) +{ + set_color(color); + draw_face(); +} + +ColorButtonPicker::ColorButtonPicker(ColorButton *color_button) + : ColorPicker(color_button->alpha >= 0 ? 1 : 0, color_button->title) +{ + this->color_button = color_button; +} + +ColorButtonPicker::~ColorButtonPicker() +{ +} + +void ColorButtonPicker::handle_done_event(int result) +{ + color_button->color_thread->stop(); + color_button->handle_done_event(result); +} + +int ColorButtonPicker::handle_new_color(int color, int alpha) +{ + color_button->color = color; + color_button->color_thread->update_lock->unlock(); + color_button->handle_new_color(color, alpha); + return 1; +} + +void ColorButtonPicker::update_gui() +{ + color_button->lock_window("ColorButtonPicker::update_gui"); + color_button->update_gui(color_button->color); + color_button->unlock_window(); +} + +ColorButtonThread::ColorButtonThread(ColorButton *color_button) + : Thread(1, 0, 0) +{ + this->color_button = color_button; + this->update_lock = new Condition(0,"ColorButtonThread::update_lock"); + done = 1; +} + +ColorButtonThread::~ColorButtonThread() +{ + stop(); + delete update_lock; +} + +void ColorButtonThread::start() +{ + if( done ) { + done = 0; + Thread::start(); + } +} + +void ColorButtonThread::stop() +{ + if( !done ) { + done = 1; + update_lock->unlock(); + join(); + } +} + +void ColorButtonThread::run() +{ + ColorButtonPicker *color_picker = color_button->color_picker; + color_picker->update_gui(); + while( !done ) { + update_lock->lock("ColorButtonThread::run"); + if( done ) break; + color_picker->update_gui(); + } +} + + +ColorBoxButton::ColorBoxButton(const char *title, + int x, int y, int w, int h, + int color, int alpha, int ok_cancel) + : ColorButton(title, x, y, w, h, color, alpha, ok_cancel) +{ +} +ColorBoxButton::~ColorBoxButton() +{ +} + +int ColorBoxButton::handle_new_color(int color, int alpha) +{ + return ColorButton::handle_new_color(color, alpha); +} +void ColorBoxButton::handle_done_event(int result) +{ + ColorButton::handle_done_event(result); +} +void ColorBoxButton::create_objects() +{ + update_gui(color); +} + +void ColorBoxButton::set_color(int color) +{ + this->color = color; + int r = (color>>16) & 0xff; + int g = (color>> 8) & 0xff; + int b = (color>> 0) & 0xff; + int color_model = vframes[0]->get_color_model(); + int bpp = BC_CModels::calculate_pixelsize(color_model); + for( int i=0; i<3; ++i ) { + VFrame *vframe = vframes[i]; + int ww = vframe->get_w(), hh = vframe->get_h(); + uint8_t **rows = vframe->get_rows(); + int rr = r, gg = g, bb = b; + switch( i ) { + case BUTTON_UP: + break; + case BUTTON_UPHI: + if( (rr+=48) > 0xff ) rr = 0xff; + if( (gg+=48) > 0xff ) gg = 0xff; + if( (bb+=48) > 0xff ) bb = 0xff; + break; + case BUTTON_DOWNHI: + if( (rr-=48) < 0x00 ) rr = 0x00; + if( (gg-=48) < 0x00 ) gg = 0x00; + if( (bb-=48) < 0x00 ) bb = 0x00; + break; + } + for( int y=0; y 3 ) rp[3] = 0xff; + rp += bpp; + } + } + } + set_images(vframes); +} + +ColorCircleButton::ColorCircleButton(const char *title, + int x, int y, int w, int h, + int color, int alpha, int ok_cancel) + : ColorButton(title, x, y, w, h, color, alpha, ok_cancel) +{ +} +ColorCircleButton::~ColorCircleButton() +{ +} +int ColorCircleButton::handle_new_color(int color, int alpha) +{ + return ColorButton::handle_new_color(color, alpha); +} +void ColorCircleButton::handle_done_event(int result) +{ + ColorButton::handle_done_event(result); +} +void ColorCircleButton::create_objects() +{ + update_gui(color); +} + +void ColorCircleButton::set_color(int color) +{ + this->color = color; + int r = (color>>16) & 0xff; + int g = (color>>8) & 0xff; + int b = (color>>0) & 0xff; + for( int i=0; i<3; ++i ) { + VFrame *vframe = vframes[i]; + int ww = vframe->get_w(), hh = vframe->get_h(); + int cx = (ww+1)/2, cy = hh/2; + double cc = (cx*cx + cy*cy) / 4.; + uint8_t *bp = vframe->get_data(), *dp = bp; + uint8_t *ep = dp + vframe->get_data_size(); + int rr = r, gg = g, bb = b; + int bpl = vframe->get_bytes_per_line(); + switch( i ) { + case BUTTON_UP: + break; + case BUTTON_UPHI: + if( (rr+=48) > 0xff ) rr = 0xff; + if( (gg+=48) > 0xff ) gg = 0xff; + if( (bb+=48) > 0xff ) bb = 0xff; + break; + case BUTTON_DOWNHI: + if( (rr-=48) < 0x00 ) rr = 0x00; + if( (gg-=48) < 0x00 ) gg = 0x00; + if( (bb-=48) < 0x00 ) bb = 0x00; + break; + } + while( dp < ep ) { + int yy = (dp-bp) / bpl, xx = ((dp-bp) % bpl) >> 2; + int dy = cy - yy, dx = cx - xx; + double s = dx*dx + dy*dy - cc; + double ss = s < 0 ? 1 : s >= cc ? 0 : 1 - s/cc; + int aa = ss * 0xff; + *dp++ = rr; *dp++ = gg; *dp++ = bb; *dp++ = aa; + } + } + set_images(vframes); +} + diff --git a/cinelerra-5.1/cinelerra/colorpicker.h b/cinelerra-5.1/cinelerra/colorpicker.h index ed3f5a95..a5d203d2 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.h +++ b/cinelerra-5.1/cinelerra/colorpicker.h @@ -27,6 +27,7 @@ #include "bctextbox.h" #include "bcsubwindow.h" #include "clip.h" +#include "colorpicker.inc" #include "condition.inc" #include "guicast.h" #include "mutex.inc" @@ -35,28 +36,6 @@ #define PALLETTE_HISTORY_SIZE 16 -class ColorWindow; -class PaletteWheel; -class PaletteWheelValue; -class PaletteOutput; -class PaletteHue; -class PaletteSat; -class PaletteVal; -class PaletteRed; -class PaletteGrn; -class PaletteBlu; -class PaletteLum; -class PaletteCr; -class PaletteCb; -class PaletteAlpha; -class PaletteHSV; -class PaletteRGB; -class PaletteYUV; -class PaletteAPH; -class PaletteHexButton; -class PaletteHex; -class PaletteGrabButton; -class PaletteHistory; class ColorPicker : public BC_DialogThread { @@ -64,14 +43,15 @@ public: ColorPicker(int do_alpha = 0, const char *title = 0); ~ColorPicker(); - void start_window(int output, int alpha, int do_okcancel=0); + void start_window(int output, int alpha, int ok_cancel=0); virtual int handle_new_color(int output, int alpha); void update_gui(int output, int alpha); BC_Window* new_gui(); + virtual void create_objects(ColorWindow *gui) {} int orig_color, orig_alpha; int output, alpha; - int do_alpha, do_okcancel; + int do_alpha, ok_cancel; const char *title; }; @@ -371,4 +351,84 @@ public: int button_down; }; +class ColorButton : public BC_Button +{ +public: + ColorButton(const char *title, + int x, int y, int w, int h, + int color, int alpha, int ok_cancel); + ~ColorButton(); + + virtual void set_color(int color); + virtual int handle_new_color(int color, int alpha); + virtual void handle_done_event(int result); + + void close_picker(); + void update_gui(int color); + int handle_event(); + + const char *title; + int color, alpha, ok_cancel; + int orig_color, orig_alpha; + + VFrame *vframes[3]; + ColorButtonPicker *color_picker; + ColorButtonThread *color_thread; +}; + +class ColorButtonPicker : public ColorPicker +{ +public: + ColorButtonPicker(ColorButton *color_button); + ~ColorButtonPicker(); + int handle_new_color(int color, int alpha); + void handle_done_event(int result); + void update_gui(); + + ColorButton *color_button; +}; + +class ColorButtonThread : public Thread +{ +public: + ColorButtonThread(ColorButton *color_button); + ~ColorButtonThread(); + + void start(); + void stop(); + void run(); + + ColorButton *color_button; + Condition *update_lock; + int done; +}; + +class ColorBoxButton : public ColorButton +{ +public: + ColorBoxButton(const char *title, + int x, int y, int w, int h, + int color, int alpha, int ok_cancel); + ~ColorBoxButton(); + void create_objects(); + + virtual int handle_new_color(int color, int alpha); + virtual void handle_done_event(int result); + void set_color(int color); +}; + +class ColorCircleButton : public ColorButton +{ +public: + ColorCircleButton(const char *title, + int x, int y, int w, int h, + int color, int alpha, int ok_cancel); + ~ColorCircleButton(); + void create_objects(); + + virtual int handle_new_color(int color, int alpha); + virtual void handle_done_event(int result); + void set_color(int color); +}; + #endif diff --git a/cinelerra-5.1/cinelerra/colorpicker.inc b/cinelerra-5.1/cinelerra/colorpicker.inc index 3442aae6..15b8fc2e 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.inc +++ b/cinelerra-5.1/cinelerra/colorpicker.inc @@ -23,5 +23,33 @@ #define COLORPICKER_INC class ColorPicker; +class ColorWindow; +class PaletteWheel; +class PaletteWheelValue; +class PaletteOutput; +class PaletteHue; +class PaletteSat; +class PaletteVal; +class PaletteRed; +class PaletteGrn; +class PaletteBlu; +class PaletteAlpha; +class PaletteLum; +class PaletteCr; +class PaletteCb; +class PaletteNum; +class PaletteRGB; +class PaletteYUV; +class PaletteHSV; +class PaletteAPH; +class PaletteHexButton; +class PaletteHex; +class PaletteGrabButton; +class PaletteHistory; +class ColorButton; +class ColorButtonPicker; +class ColorButtonThread; +class ColorBoxButton; +class ColorCircleButton; #endif diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index 489a9694..347e9408 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -86,6 +86,7 @@ void Edit::reset() is_selected = 0; hard_left = 0; hard_right = 0; + color = -1; } Indexable* Edit::get_source() @@ -141,6 +142,7 @@ int Edit::copy(int64_t start, file->tag.set_property("LENGTH", length_in_selection); file->tag.set_property("HARD_LEFT", hard_left); file->tag.set_property("HARD_RIGHT", hard_right); + file->tag.set_property("COLOR", color); if(user_title[0]) file->tag.set_property("USER_TITLE", user_title); //printf("Edit::copy 5\n"); @@ -249,6 +251,7 @@ void Edit::copy_from(Edit *edit) this->length = edit->length; this->hard_left = edit->hard_left; this->hard_right = edit->hard_right; + this->color = edit->color; strcpy (this->user_title, edit->user_title); if(edit->transition) @@ -324,8 +327,6 @@ int Edit::identical(Edit &edit) this->startsource == edit.startsource && this->startproject == edit.startproject && this->length == edit.length && - this->hard_left == edit.hard_left && - this->hard_right == edit.hard_right && this->transition == edit.transition && this->channel == edit.channel); return result; @@ -377,7 +378,7 @@ int Edit::dump(FILE *fp) asset, asset ? asset->path : ""); fflush(fp); - fprintf(fp," channel %d\n", channel); + fprintf(fp," channel %d, color %08x\n", channel, color); if(transition) { fprintf(fp," TRANSITION %p\n", transition); @@ -394,6 +395,7 @@ int Edit::load_properties(FileXML *file, int64_t &startproject) length = file->tag.get_property("LENGTH", (int64_t)0); hard_left = file->tag.get_property("HARD_LEFT", (int64_t)0); hard_right = file->tag.get_property("HARD_RIGHT", (int64_t)0); + color = file->tag.get_property("COLOR", (int64_t)-1); user_title[0] = 0; file->tag.get_property("USER_TITLE", user_title); this->startproject = startproject; @@ -751,34 +753,6 @@ int Edit::shift_end_out(int edit_mode, return 0; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - int Edit::popup_transition(float view_start, float zoom_units, int cursor_x, int cursor_y) { int64_t left, right, left_unit, right_unit; @@ -843,3 +817,21 @@ void Edit::get_title(char *title) } } +int Edit::get_hash_color() +{ + Indexable *idxbl = asset ? (Indexable*)asset : (Indexable*)nested_edl; + if( !idxbl ) return -1; + int v = 0; + for( uint8_t *bp=(uint8_t*)idxbl->path; *bp; ++bp ) v += *bp; + int color = 0x303030; + if( v & 0x01 ) color ^= 0x000040; + if( v & 0x02 ) color ^= 0x004000; + if( v & 0x04 ) color ^= 0x400000; + if( v & 0x08 ) color ^= 0x080000; + if( v & 0x10 ) color ^= 0x000800; + if( v & 0x20 ) color ^= 0x000008; + if( v & 0x40 ) color ^= 0x202020; + if( v & 0x80 ) color ^= 0x101010; + return color; +} + diff --git a/cinelerra-5.1/cinelerra/edit.h b/cinelerra-5.1/cinelerra/edit.h index e377c336..a23f92e1 100644 --- a/cinelerra-5.1/cinelerra/edit.h +++ b/cinelerra-5.1/cinelerra/edit.h @@ -134,7 +134,8 @@ public: int is_plugin, is_selected; // edge cannot be optimized int hard_left, hard_right; - +// title bar color + int color; // Transition if one is present at the beginning of this edit // This stores the length of the transition Transition *transition; @@ -168,6 +169,10 @@ public: float zoom_units) { return 0; } virtual int64_t get_source_end(int64_t default_); void get_title(char *title); +// edit title bar color + int get_title_color(); +// default edit title bar color + int get_hash_color(); int dump(FILE *fp=stdout); virtual int dump_derived() { return 0; } diff --git a/cinelerra-5.1/cinelerra/editpopup.C b/cinelerra-5.1/cinelerra/editpopup.C index c03653b1..cbe07b5d 100644 --- a/cinelerra-5.1/cinelerra/editpopup.C +++ b/cinelerra-5.1/cinelerra/editpopup.C @@ -38,6 +38,7 @@ #include "mwindowgui.h" #include "plugindialog.h" #include "resizetrackthread.h" +#include "theme.h" #include "track.h" #include "tracks.h" #include "trackcanvas.h" @@ -73,8 +74,9 @@ void EditPopup::create_objects() add_item(new EditPopupPaste(mwindow, this)); add_item(new EditPopupOverwrite(mwindow, this)); add_item(new EditPopupFindAsset(mwindow, this)); - add_item(new EditPopupTitle(mwindow, this)); add_item(new EditPopupShow(mwindow, this)); + add_item(new EditPopupUserTitle(mwindow, this)); + add_item(new EditPopupTitleColor(mwindow, this)); } int EditPopup::activate_menu(Track *track, Edit *edit, @@ -271,20 +273,20 @@ int EditPopupFindAsset::handle_event() } -EditPopupTitle::EditPopupTitle(MWindow *mwindow, EditPopup *popup) +EditPopupUserTitle::EditPopupUserTitle(MWindow *mwindow, EditPopup *popup) : BC_MenuItem(_("User title...")) { this->mwindow = mwindow; this->popup = popup; - dialog_thread = new EditTitleDialogThread(this); + dialog_thread = new EditUserTitleDialogThread(this); } -EditPopupTitle::~EditPopupTitle() +EditPopupUserTitle::~EditPopupUserTitle() { delete dialog_thread; } -int EditPopupTitle::handle_event() +int EditPopupUserTitle::handle_event() { if( popup->edit ) { dialog_thread->close_window(); @@ -295,49 +297,49 @@ int EditPopupTitle::handle_event() return 1; } -void EditTitleDialogThread::start(int wx, int wy) +void EditUserTitleDialogThread::start(int wx, int wy) { this->wx = wx; this->wy = wy; BC_DialogThread::start(); } -EditTitleDialogThread::EditTitleDialogThread(EditPopupTitle *edit_title) +EditUserTitleDialogThread::EditUserTitleDialogThread(EditPopupUserTitle *edit_title) { this->edit_title = edit_title; window = 0; } -EditTitleDialogThread::~EditTitleDialogThread() +EditUserTitleDialogThread::~EditUserTitleDialogThread() { close_window(); } -BC_Window* EditTitleDialogThread::new_gui() +BC_Window* EditUserTitleDialogThread::new_gui() { MWindow *mwindow = edit_title->mwindow; EditPopup *popup = edit_title->popup; - window = new EditPopupTitleWindow(mwindow, popup, wx, wy); + window = new EditPopupUserTitleWindow(mwindow, popup, wx, wy); window->create_objects(); return window; } -void EditTitleDialogThread::handle_close_event(int result) +void EditUserTitleDialogThread::handle_close_event(int result) { window = 0; } -void EditTitleDialogThread::handle_done_event(int result) +void EditUserTitleDialogThread::handle_done_event(int result) { if( result ) return; MWindow *mwindow = edit_title->mwindow; EditPopup *popup = edit_title->popup; strcpy(popup->edit->user_title, window->title_text->get_text()); - mwindow->gui->lock_window("EditTitleDialogThread::handle_done_event"); + mwindow->gui->lock_window("EditUserTitleDialogThread::handle_done_event"); mwindow->gui->draw_canvas(1, 0); mwindow->gui->flash_canvas(1); mwindow->gui->unlock_window(); } -EditPopupTitleWindow::EditPopupTitleWindow(MWindow *mwindow, +EditPopupUserTitleWindow::EditPopupUserTitleWindow(MWindow *mwindow, EditPopup *popup, int wx, int wy) : BC_Window(_(PROGRAM_NAME ": Set edit title"), wx, wy, 300, 130, 300, 130, 0, 0, 1) @@ -347,17 +349,19 @@ EditPopupTitleWindow::EditPopupTitleWindow(MWindow *mwindow, strcpy(new_text, !popup->edit ? "" : popup->edit->user_title); } -EditPopupTitleWindow::~EditPopupTitleWindow() +EditPopupUserTitleWindow::~EditPopupUserTitleWindow() { } -void EditPopupTitleWindow::create_objects() +void EditPopupUserTitleWindow::create_objects() { - lock_window("EditPopupTitleWindow::create_objects"); - int x = 10, y = 10; - add_subwindow(new BC_Title(x, y, _("User title:"))); - title_text = new EditPopupTitleText(this, mwindow, x+15, y+20, new_text); + lock_window("EditPopupUserTitleWindow::create_objects"); + int x = 10, y = 10, x1; + BC_Title *title = new BC_Title(x1=x, y, _("User title:")); + add_subwindow(title); x1 += title->get_w() + 10; + title_text = new EditPopupUserTitleText(this, mwindow, x1, y, new_text); add_subwindow(title_text); + add_tool(new BC_OKButton(this)); add_tool(new BC_CancelButton(this)); @@ -368,19 +372,19 @@ void EditPopupTitleWindow::create_objects() } -EditPopupTitleText::EditPopupTitleText(EditPopupTitleWindow *window, +EditPopupUserTitleText::EditPopupUserTitleText(EditPopupUserTitleWindow *window, MWindow *mwindow, int x, int y, const char *text) - : BC_TextBox(x, y, 250, 1, text) + : BC_TextBox(x, y, window->get_w()-x-15, 1, text) { this->window = window; this->mwindow = mwindow; } -EditPopupTitleText::~EditPopupTitleText() +EditPopupUserTitleText::~EditPopupUserTitleText() { } -int EditPopupTitleText::handle_event() +int EditPopupUserTitleText::handle_event() { if( get_keypress() == RETURN ) window->set_done(0); @@ -388,6 +392,91 @@ int EditPopupTitleText::handle_event() } +EditPopupTitleColor::EditPopupTitleColor(MWindow *mwindow, EditPopup *popup) + : BC_MenuItem(_("Bar Color...")) +{ + this->mwindow = mwindow; + this->popup = popup; + color_picker = 0; +} +EditPopupTitleColor::~EditPopupTitleColor() +{ + delete color_picker; +} + +int EditPopupTitleColor::handle_event() +{ + if( popup->edit ) { + int color = popup->mwindow->get_title_color(popup->edit); + if( color < 0 ) color = popup->mwindow->theme->get_color_title_bg(); + delete color_picker; + color_picker = new EditTitleColorPicker(popup); + color_picker->start_window(color, -1, 1); + } + return 1; +} + +EditTitleColorDefault::EditTitleColorDefault( + EditTitleColorPicker *color_picker, int x, int y) + : BC_GenericButton(x, y, _("default")) +{ + this->color_picker = color_picker; +} + +int EditTitleColorDefault::handle_event() +{ + int color = color_picker->popup->mwindow->theme->get_color_title_bg(); + color_picker->update_gui(color, -1); + return 1; +} + +EditTitleColorPicker::EditTitleColorPicker(EditPopup *popup) + : ColorPicker(0, _("Bar Color")) +{ + this->popup = popup; + color = -1; +} +EditTitleColorPicker::~EditTitleColorPicker() +{ +} +void EditTitleColorPicker::create_objects(ColorWindow *gui) +{ + int y = gui->get_h() - BC_CancelButton::calculate_h() - 50; + int x = gui->get_w() - BC_GenericButton::calculate_w(gui, _("default")) - 15; + gui->add_subwindow(new EditTitleColorDefault(this, x, y)); +} + +int EditTitleColorPicker::handle_new_color(int color, int alpha) +{ + this->color = color; + return 1; +} + +void EditTitleColorPicker::handle_done_event(int result) +{ + if( !result ) { + EDL *edl = popup->mwindow->edl; + int count = 0; + for( Track *track=edl->tracks->first; track; track=track->next ) { + if( !track->record ) continue; + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + if( !edit->is_selected ) continue; + edit->color = color; + ++count; + } + } + if( count ) + edl->tracks->clear_selected_edits(); + else + popup->edit->color = color; + } + MWindowGUI *mwindow_gui = popup->mwindow->gui; + mwindow_gui->lock_window("GWindowColorUpdate::run"); + mwindow_gui->draw_trackmovement(); + mwindow_gui->unlock_window(); +} + + EditPopupShow::EditPopupShow(MWindow *mwindow, EditPopup *popup) : BC_MenuItem(_("Show edit")) { diff --git a/cinelerra-5.1/cinelerra/editpopup.h b/cinelerra-5.1/cinelerra/editpopup.h index 13951ae9..f0ef10d6 100644 --- a/cinelerra-5.1/cinelerra/editpopup.h +++ b/cinelerra-5.1/cinelerra/editpopup.h @@ -24,6 +24,7 @@ #include "guicast.h" #include "edit.inc" +#include "colorpicker.h" #include "editpopup.inc" #include "mwindow.inc" #include "mwindowgui.inc" @@ -151,59 +152,96 @@ public: EditPopup *popup; }; -class EditPopupTitle : public BC_MenuItem +class EditPopupUserTitle : public BC_MenuItem { public: - EditPopupTitle(MWindow *mwindow, EditPopup *popup); - ~EditPopupTitle(); + EditPopupUserTitle(MWindow *mwindow, EditPopup *popup); + ~EditPopupUserTitle(); int handle_event(); MWindow *mwindow; EditPopup *popup; - EditTitleDialogThread *dialog_thread; + EditUserTitleDialogThread *dialog_thread; }; -class EditTitleDialogThread : public BC_DialogThread +class EditPopupUserTitleText : public BC_TextBox { public: - EditTitleDialogThread(EditPopupTitle *edit_title); - ~EditTitleDialogThread(); - BC_Window* new_gui(); - void start(int wx, int wy); + EditPopupUserTitleText(EditPopupUserTitleWindow *window, + MWindow *mwindow, int x, int y, const char *text); + ~EditPopupUserTitleText(); + int handle_event(); + + MWindow *mwindow; + EditPopupUserTitleWindow *window; +}; + +class EditPopupUserTitleWindow : public BC_Window +{ +public: + EditPopupUserTitleWindow(MWindow *mwindow, EditPopup *popup, int wx, int wy); + ~EditPopupUserTitleWindow(); + + void create_objects(); + void handle_close_event(int result); + + EditPopupUserTitleText *title_text; + MWindow *mwindow; + EditPopup *popup; + char new_text[BCTEXTLEN]; +}; + +class EditUserTitleDialogThread : public BC_DialogThread +{ +public: + EditUserTitleDialogThread(EditPopupUserTitle *edit_title); + ~EditUserTitleDialogThread(); + void handle_close_event(int result); void handle_done_event(int result); + BC_Window* new_gui(); + void start(int wx, int wy); int wx, wy; - EditPopupTitle *edit_title; - EditPopupTitleWindow *window; + EditPopupUserTitle *edit_title; + EditPopupUserTitleWindow *window; }; -class EditPopupTitleText : public BC_TextBox + +class EditPopupTitleColor : public BC_MenuItem { public: - EditPopupTitleText(EditPopupTitleWindow *window, - MWindow *mwindow, int x, int y, const char *text); - ~EditPopupTitleText(); + EditPopupTitleColor(MWindow *mwindow, EditPopup *popup); + ~EditPopupTitleColor(); + int handle_event(); MWindow *mwindow; - EditPopupTitleWindow *window; + EditPopup *popup; + EditTitleColorPicker *color_picker; }; -class EditPopupTitleWindow : public BC_Window +class EditTitleColorDefault : public BC_GenericButton { public: - EditPopupTitleWindow(MWindow *mwindow, EditPopup *popup, int wx, int wy); - ~EditPopupTitleWindow(); + EditTitleColorDefault(EditTitleColorPicker *color_picker, int x, int y); + int handle_event(); - void create_objects(); - void handle_close_event(int result); + EditTitleColorPicker *color_picker; +}; + +class EditTitleColorPicker : public ColorPicker +{ +public: + EditTitleColorPicker(EditPopup *popup); + ~EditTitleColorPicker(); + void create_objects(ColorWindow *gui); + int handle_new_color(int color, int alpha); + void handle_done_event(int result); - EditPopupTitleText *title_text; - MWindow *mwindow; EditPopup *popup; - char new_text[BCTEXTLEN]; + int color; }; diff --git a/cinelerra-5.1/cinelerra/editpopup.inc b/cinelerra-5.1/cinelerra/editpopup.inc index c1257ea0..df5eb844 100644 --- a/cinelerra-5.1/cinelerra/editpopup.inc +++ b/cinelerra-5.1/cinelerra/editpopup.inc @@ -33,10 +33,12 @@ class EditPopupMutePack; class EditPopupPaste; class EditPopupOverwrite; class EditPopupFindAsset; -class EditPopupTitle; -class EditTitleDialogThread; -class EditPopupTitleText; -class EditPopupTitleWindow; +class EditPopupUserTitle; +class EditPopupUserTitleText; +class EditPopupUserTitleWindow; +class EditUserTitleDialogThread; +class EditPopupTitleColor; +class EditTitleColorPicker; class EditPopupShow; class EditShowDialogThread; class EditPopupShowText; diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index ce888faf..81520f01 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -49,24 +49,12 @@ GWindowGUI::GWindowGUI(MWindow *mwindow, int w, int h) w, h, w, h, 0, 0, 1) { this->mwindow = mwindow; - color_thread = 0; camera_xyz = 0; projector_xyz = 0; } GWindowGUI::~GWindowGUI() { - delete color_thread; -} - -void GWindowGUI::start_color_thread(GWindowColorButton *color_button) -{ - unlock_window(); - delete color_thread; - color_thread = new GWindowColorThread(this, color_button); - int color = auto_colors[color_button->auto_toggle->info->ref]; - color_thread->start(color); - lock_window("GWindowGUI::start_color_thread"); } const char *GWindowGUI::non_auto_text[NON_AUTOMATION_TOTAL] = @@ -197,103 +185,39 @@ void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) *w += 20; } -GWindowColorButton::GWindowColorButton(GWindowToggle *auto_toggle, int x, int y, int w) - : BC_Button(x, y, w, vframes) +GWindowColorButton::GWindowColorButton(GWindowToggle *auto_toggle, + int x, int y, int w, int color) + : ColorCircleButton(auto_toggle->caption, x, y, w, w, color, -1, 1) { this->auto_toggle = auto_toggle; - this->color = 0; - for( int i=0; i<3; ++i ) { - vframes[i] = new VFrame(w, w, BC_RGBA8888); - vframes[i]->clear_frame(); - } + this->color = color; } GWindowColorButton::~GWindowColorButton() { - for( int i=0; i<3; ++i ) - delete vframes[i]; } -void GWindowColorButton::set_color(int color) +int GWindowColorButton::handle_new_color(int color, int alpha) { this->color = color; - int r = (color>>16) & 0xff; - int g = (color>>8) & 0xff; - int b = (color>>0) & 0xff; - for( int i=0; i<3; ++i ) { - VFrame *vframe = vframes[i]; - int ww = vframe->get_w(), hh = vframe->get_h(); - int cx = (ww+1)/2, cy = hh/2; - double cc = (cx*cx + cy*cy) / 4.; - uint8_t *bp = vframe->get_data(), *dp = bp; - uint8_t *ep = dp + vframe->get_data_size(); - int rr = r, gg = g, bb = b; - int bpl = vframe->get_bytes_per_line(); - switch( i ) { - case BUTTON_UP: - break; - case BUTTON_UPHI: - if( (rr+=48) > 0xff ) rr = 0xff; - if( (gg+=48) > 0xff ) gg = 0xff; - if( (bb+=48) > 0xff ) bb = 0xff; - break; - case BUTTON_DOWNHI: - if( (rr-=48) < 0x00 ) rr = 0x00; - if( (gg-=48) < 0x00 ) gg = 0x00; - if( (bb-=48) < 0x00 ) bb = 0x00; - break; - } - while( dp < ep ) { - int yy = (dp-bp) / bpl, xx = ((dp-bp) % bpl) >> 2; - int dy = cy - yy, dx = cx - xx; - double s = dx*dx + dy*dy - cc; - double ss = s < 0 ? 1 : s >= cc ? 0 : 1 - s/cc; - int aa = ss * 0xff; - *dp++ = rr; *dp++ = gg; *dp++ = bb; *dp++ = aa; - } - } - set_images(vframes); -} - -void GWindowColorButton::update_gui(int color) -{ - set_color(color); - draw_face(); -} - -GWindowColorThread::GWindowColorThread(GWindowGUI *gui, GWindowColorButton *color_button) - : ColorPicker(0, color_button->auto_toggle->caption) -{ - this->gui = gui; - this->color_button = color_button; - this->color = 0; - color_update = new GWindowColorUpdate(this); -} - -GWindowColorThread::~GWindowColorThread() -{ - delete color_update; -} - -void GWindowColorThread::start(int color) -{ - start_window(color, 0, 1); - color_update->start(); + color_thread->update_lock->unlock(); + return 1; } -void GWindowColorThread::handle_done_event(int result) +void GWindowColorButton::handle_done_event(int result) { - color_update->stop(); - int ref = color_button->auto_toggle->info->ref; + ColorCircleButton::handle_done_event(result); + int ref = auto_toggle->info->ref; + GWindowGUI *gui = auto_toggle->gui; gui->lock_window("GWindowColorThread::handle_done_event"); if( !result ) { GWindowGUI::auto_colors[ref] = color; - color_button->auto_toggle->update_gui(color); + auto_toggle->update_gui(color); gui->save_defaults(); } else { color = GWindowGUI::auto_colors[ref]; - color_button->update_gui(color); + update_gui(color); } gui->unlock_window(); MWindowGUI *mwindow_gui = gui->mwindow->gui; @@ -302,67 +226,6 @@ void GWindowColorThread::handle_done_event(int result) mwindow_gui->unlock_window(); } -int GWindowColorThread::handle_new_color(int color, int alpha) -{ - this->color = color; - color_update->update_lock->unlock(); - return 1; -} - -void GWindowColorThread::update_gui() -{ - gui->lock_window("GWindowColorThread::update_gui"); - color_button->update_gui(color); - gui->unlock_window(); -} - -GWindowColorUpdate::GWindowColorUpdate(GWindowColorThread *color_thread) - : Thread(1, 0, 0) -{ - this->color_thread = color_thread; - this->update_lock = new Condition(0,"GWindowColorUpdate::update_lock"); - done = 1; -} - -GWindowColorUpdate::~GWindowColorUpdate() -{ - stop(); - delete update_lock; -} - -void GWindowColorUpdate::start() -{ - if( done ) { - done = 0; - Thread::start(); - } -} - -void GWindowColorUpdate::stop() -{ - if( !done ) { - done = 1; - update_lock->unlock(); - join(); - } -} - -void GWindowColorUpdate::run() -{ - while( !done ) { - update_lock->lock("GWindowColorUpdate::run"); - if( done ) break; - color_thread->update_gui(); - } -} - - -int GWindowColorButton::handle_event() -{ - GWindowGUI *gui = auto_toggle->gui; - gui->start_color_thread(this); - return 1; -} void GWindowGUI::create_objects() { @@ -393,10 +256,9 @@ void GWindowGUI::create_objects() if( !vframe ) { int wh = toggle->get_h() - 4; GWindowColorButton *color_button = - new GWindowColorButton(toggle, get_w()-wh-10, y+2, wh); + new GWindowColorButton(toggle, get_w()-wh-10, y+2, wh, color); add_tool(color_button); - color_button->set_color(color); - color_button->draw_face(); + color_button->create_objects(); } else draw_vframe(vframe, get_w()-vframe->get_w()-10, y); @@ -480,7 +342,6 @@ int GWindowGUI::translation_event() int GWindowGUI::close_event() { - delete color_thread; color_thread = 0; hide_window(); mwindow->session->show_gwindow = 0; unlock_window(); diff --git a/cinelerra-5.1/cinelerra/gwindowgui.h b/cinelerra-5.1/cinelerra/gwindowgui.h index f243a228..302417cf 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.h +++ b/cinelerra-5.1/cinelerra/gwindowgui.h @@ -56,7 +56,6 @@ public: int translation_event(); int close_event(); int keypress_event(); - void start_color_thread(GWindowColorButton *color_button); void update_toggles(int use_lock); void toggle_camera_xyz(); void toggle_projector_xyz(); @@ -78,7 +77,6 @@ public: MWindow *mwindow; GWindowToggle *toggles[NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL]; - GWindowColorThread *color_thread; GWindowToggle *camera_xyz, *projector_xyz; }; @@ -101,50 +99,16 @@ public: GWindowColorButton *color_button; }; -class GWindowColorButton : public BC_Button +class GWindowColorButton : public ColorCircleButton { public: - GWindowColorButton(GWindowToggle *auto_toggle, int x, int y, int w); + GWindowColorButton(GWindowToggle *auto_toggle, + int x, int y, int w, int color); ~GWindowColorButton(); - - void set_color(int color); - void update_gui(int color); - int handle_event(); - - int color; - VFrame *vframes[3]; - GWindowToggle *auto_toggle; -}; - -class GWindowColorThread : public ColorPicker -{ -public: - GWindowColorThread(GWindowGUI *gui, GWindowColorButton *color_button); - ~GWindowColorThread(); - void start(int color); int handle_new_color(int color, int alpha); - void update_gui(); void handle_done_event(int result); - GWindowGUI *gui; - int color; - GWindowColorButton *color_button; - GWindowColorUpdate *color_update; -}; - -class GWindowColorUpdate : public Thread -{ -public: - GWindowColorUpdate(GWindowColorThread *color_thread); - ~GWindowColorUpdate(); - - void start(); - void stop(); - void run(); - - int done; - Condition *update_lock; - GWindowColorThread *color_thread; + GWindowToggle *auto_toggle; }; #endif diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index a84e11a1..77c1eba1 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -3292,6 +3292,14 @@ void MWindow::hide_keyframe_gui(Plugin *plugin) keyframe_gui_lock->unlock(); } +int MWindow::get_title_color(Edit *edit) +{ + int color = edit->color; + if( color < 0 && preferences->autocolor_assets ) + color = edit->get_hash_color(); + return color; +} + void MWindow::update_keyframe_guis() { // Send new configuration to keyframe GUI's diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 71d23568..ab2d8d58 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -310,7 +310,7 @@ public: void hide_keyframe_guis(); void hide_keyframe_gui(Plugin *plugin); void update_keyframe_guis(); - + int get_title_color(Edit *edit); // ============================= editing commands ======================== diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 71adc847..0f2ef123 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -1355,18 +1355,7 @@ int MWindowGUI::keypress_event() result = 1; break; - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: + case KEY_F1 ... KEY_F12: resend_event(mwindow->cwindow->gui); return 1; } diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index 744755dc..f0afe996 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -97,6 +97,7 @@ Preferences::Preferences() highlight_inverse = 0xffffff; yuv_color_space = BC_COLORS_BT601; yuv_color_range = BC_COLORS_JPEG; + autocolor_assets = 0; // Default brender asset brender_asset = new Asset; @@ -214,6 +215,7 @@ void Preferences::copy_from(Preferences *that) highlight_inverse = that->highlight_inverse; yuv_color_space = that->yuv_color_space; yuv_color_range = that->yuv_color_range; + autocolor_assets = that->autocolor_assets; renderfarm_nodes.remove_all_objects(); renderfarm_ports.remove_all(); renderfarm_enabled.remove_all(); @@ -352,6 +354,7 @@ int Preferences::load_defaults(BC_Hash *defaults) highlight_inverse = defaults->get("HIGHLIGHT_INVERSE", highlight_inverse); yuv_color_space = defaults->get("YUV_COLOR_SPACE", yuv_color_space); yuv_color_range = defaults->get("YUV_COLOR_RANGE", yuv_color_range); + autocolor_assets = defaults->get("AUTOCOLOR_ASSETS", autocolor_assets); use_brender = defaults->get("USE_BRENDER", use_brender); brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment); cache_size = defaults->get("CACHE_SIZE", cache_size); @@ -491,6 +494,7 @@ int Preferences::save_defaults(BC_Hash *defaults) defaults->update("HIGHLIGHT_INVERSE", highlight_inverse); defaults->update("YUV_COLOR_SPACE", yuv_color_space); defaults->update("YUV_COLOR_RANGE", yuv_color_range); + defaults->update("AUTOCOLOR_ASSETS", autocolor_assets); brender_asset->save_defaults(defaults, "BRENDER_", 1, 1, 1, 0, 0); defaults->update("USE_BRENDER", use_brender); defaults->update("BRENDER_FRAGMENT", brender_fragment); diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h index d6748183..b11a8f9f 100644 --- a/cinelerra-5.1/cinelerra/preferences.h +++ b/cinelerra-5.1/cinelerra/preferences.h @@ -131,7 +131,8 @@ public: // yuv color space/range int yuv_color_space; int yuv_color_range; - +// autocolor asset edit title + int autocolor_assets; // Default positions for channels int channel_positions[MAXCHANNELS][MAXCHANNELS]; diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index 28b5ecc3..6c4707dd 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -212,6 +212,9 @@ int PreferencesThread::apply_settings() (*this_aconfig != *aconfig) || (*this_vconfig != *vconfig) || !preferences->brender_asset->equivalent(*mwindow->preferences->brender_asset, 0, 1, edl); + if( preferences->autocolor_assets != mwindow->preferences->autocolor_assets ) + redraw_indexes = 1; + if( preferences->yuv_color_space != mwindow->preferences->yuv_color_space || preferences->yuv_color_range != mwindow->preferences->yuv_color_range ) { YUV::yuv.yuv_set_colors( @@ -343,9 +346,16 @@ int PreferencesThread::apply_settings() //printf("PreferencesThread::apply_settings 10\n"); } - if(redraw_times || redraw_overlays) + if(redraw_indexes) { mwindow->gui->lock_window("PreferencesThread::apply_settings 4"); + mwindow->gui->draw_trackmovement(); + mwindow->gui->unlock_window(); + } + + if(redraw_times || redraw_overlays || redraw_indexes) + { + mwindow->gui->lock_window("PreferencesThread::apply_settings 5"); mwindow->gui->flush(); mwindow->gui->unlock_window(); } diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index 2ffd86ca..e70c5fcd 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -46,6 +46,7 @@ #include "localsession.h" #include "mwindow.h" #include "mwindowgui.h" +#include "preferences.h" #include "renderengine.h" #include "resourcethread.h" #include "resourcepixmap.h" @@ -241,6 +242,32 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, SET_TRACE } + +VFrame *ResourcePixmap::change_title_color(VFrame *title_bg, int color, int bg_color) +{ + if( color < 0 || color == bg_color ) return title_bg; + int colormodel = title_bg->get_color_model(); + int bpp = BC_CModels::calculate_pixelsize(colormodel); + int tw = title_bg->get_w(), th = title_bg->get_h(); + VFrame *title_bar = new VFrame(tw, th, colormodel); + uint8_t br = (bg_color>>16), cr = (color>>16); + uint8_t bg = (bg_color>>8), cg = (color>>8); + uint8_t bb = (bg_color>>0), cb = (color>>0); + int dr = cr-br, dg = cg-bg, db = cb-bb; + uint8_t **bar_rows = title_bar->get_rows(); + uint8_t **rows = title_bg->get_rows(); + for( int y=0; y 3 ) *cp++ = *bp++; + } + } + return title_bar; +} + void ResourcePixmap::draw_title(TrackCanvas *canvas, Edit *edit, int64_t edit_x, int64_t edit_w, int64_t pixmap_x, int64_t pixmap_w) @@ -253,8 +280,17 @@ void ResourcePixmap::draw_title(TrackCanvas *canvas, if( x < 0 ) { w -= -x; x = 0; } if( w > pixmap_w ) w -= w - pixmap_w; - canvas->draw_3segmenth(x, 0, w, total_x, total_w, - mwindow->theme->get_image("title_bg_data"), this); + VFrame *title_bg = mwindow->theme->get_image("title_bg_data"); + VFrame *title_bar = title_bg; + int color = mwindow->get_title_color(edit), bg_color = -1; + if( color >= 0 ) { + bg_color = mwindow->theme->get_color_title_bg(); + if( bg_color == color ) color = -1; + } + if( color >= 0 && color != bg_color ) + title_bar = change_title_color(title_bg, color, bg_color); + canvas->draw_3segmenth(x, 0, w, total_x, total_w, title_bar, this); + if( title_bar != title_bg ) delete title_bar; // if( total_x > -BC_INFINITY ) { char title[BCTEXTLEN]; @@ -334,22 +370,6 @@ SET_TRACE } - - - - - - - - - - - - - - - - void ResourcePixmap::draw_audio_source(TrackCanvas *canvas, Edit *edit, int x, int w) { w++; diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.h b/cinelerra-5.1/cinelerra/resourcepixmap.h index 1a2e1827..40bb3b56 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.h +++ b/cinelerra-5.1/cinelerra/resourcepixmap.h @@ -60,6 +60,8 @@ public: // Called by ResourceThread to update pixmap void draw_wave(TrackCanvas *canvas, int x, double high, double low); + VFrame *change_title_color(VFrame *title_bg, + int color, int bg_color); void draw_title(TrackCanvas *canvas, Edit *edit, int64_t edit_x, int64_t edit_w, int64_t pixmap_x, int64_t pixmap_w); diff --git a/cinelerra-5.1/cinelerra/theme.C b/cinelerra-5.1/cinelerra/theme.C index 96f8b80f..5a1d95d6 100644 --- a/cinelerra-5.1/cinelerra/theme.C +++ b/cinelerra-5.1/cinelerra/theme.C @@ -1334,8 +1334,18 @@ void Theme::draw_setformat_bg(SetFormatWindow *window) } - - - +int Theme::get_color_title_bg() +{ + VFrame *title_bg = get_image("title_bg_data"); + int tw = title_bg->get_w(), th = title_bg->get_h(); + int colormodel = title_bg->get_color_model(); + int bpp = BC_CModels::calculate_pixelsize(colormodel); + uint8_t **rows = title_bg->get_rows(); + int cx = tw / 2, cy = th / 2; + uint8_t *bp = rows[cy] + cx * bpp; + int br = bp[0], bg = bp[1], bb = bp[2]; + int color = (br<<16) | (bg<<8) | (bb<<0); + return color; +} diff --git a/cinelerra-5.1/cinelerra/theme.h b/cinelerra-5.1/cinelerra/theme.h index 2c980bcb..028957cf 100644 --- a/cinelerra-5.1/cinelerra/theme.h +++ b/cinelerra-5.1/cinelerra/theme.h @@ -121,6 +121,7 @@ public: virtual void draw_setformat_bg(SetFormatWindow *window); virtual void build_menus(); + virtual int get_color_title_bg(); // unsigned char* get_image(char *title); void flush_images(); diff --git a/cinelerra-5.1/doc/shortcuts.html b/cinelerra-5.1/doc/shortcuts.html index e1289d3b..a5f7a81e 100644 --- a/cinelerra-5.1/doc/shortcuts.html +++ b/cinelerra-5.1/doc/shortcuts.html @@ -1104,6 +1104,72 @@

+ + Drag/Drop + Clear Select + Ctrl-Shift-A + Delselect all selected edits + + + Edits + Copy + Ctrl-c + Copy selected edits into copy buffer + + +
+ Cut + Ctrl-x + Delete selected edits/put in buffer/collapse + + +
+ Mute + Ctrl-m + Delete selected edits/put in buffer/insert space + + +
+ Copy Pack + Ctrl-Shift-C + Copy selected edits and pack together + + +
+ Cut Pack + Ctrl-z + Delete selected edits/put in buffer/collapse + + +
+ Mute Pack + Ctrl-Shift-M + Delete selected edits/put in buffer/insert space + + +
+ Paste + Ctrl-v + Paste (splice) buffer at insertion point or reticle + + +
+ Overwrite + Ctrl-b + Paste (overwrite) buffer at insertion pt/reticle + + +
+
+ Ctrl and Drag + Move a single edit elsewhere + + +
+
+
+
+ FFMpeg probes early - FFMPEG early diff --git a/cinelerra-5.1/image/cin.desktop b/cinelerra-5.1/image/cin.desktop index 3ccfb7ae..07c2c493 100644 --- a/cinelerra-5.1/image/cin.desktop +++ b/cinelerra-5.1/image/cin.desktop @@ -2,7 +2,8 @@ Name=cin Comment=MultiMedia Editor Comment[fr]=Éditeur multimédia -Categories=AudioVideo;AudioVideoEditing;X-Multimedia; +Categories=AudioVideo;AudioVideoEditing; +Encoding=UTF-8 Exec=cin Icon=cin Terminal=false diff --git a/cinelerra-5.1/info/plugins.txt b/cinelerra-5.1/info/plugins.txt index 82ed0261..0955ba52 100644 --- a/cinelerra-5.1/info/plugins.txt +++ b/cinelerra-5.1/info/plugins.txt @@ -281,7 +281,7 @@ F_eq: Adjusts brightness, contrast, gamma and saturation. F_entropy: Measure video frames entropy. F_erosion: Applies erosion effect. F_fade: Fade in/out input video. -F_fftdnoiz: Denoise rames using 3D FFT. +F_fftdnoiz: Denoise frames using 3D FFT. F_fftfilt: Apply arbitrary expressions to pixels in frequency domain. F_field: Extract a field from the input video. F_fieldorder: Set the field order. @@ -480,8 +480,8 @@ F_extrastereo: Increases difference between stereo audio F_flanger: Applies a flanging effect to the audio. F_haas: Apply Haas Stereo Enhancer for a more natural sounding pan effect or more clarity in the center of the mix. With this filter - applied to mono signals it give some directionality and stretches - its stereo image + applied to mono signals it gives some directionality and stretches + its stereo image. F_highpass: Applies a high-pass filter with 3dB point frequency. F_hilbert: Generate a Hilbert transform FIR coefficients. F_loudnorm: EBU R128 loudness normalization. diff --git a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C index 33f5d575..7cbf15dd 100644 --- a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C +++ b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C @@ -96,8 +96,9 @@ void SketcherCurvePen::update(int pen) } -SketcherCurveColor::SketcherCurveColor(SketcherWindow *gui, int x, int y, int w, int h) - : BC_Button(x, y, w, vframes) +SketcherCurveColor::SketcherCurveColor(SketcherWindow *gui, + int x, int y, int w, int h, int color, int alpha) + : ColorBoxButton(_("Curve Color"), x, y, w, h, color, alpha, 1) { this->gui = gui; this->color = CV_COLOR; @@ -113,82 +114,9 @@ SketcherCurveColor::~SketcherCurveColor() delete vframes[i]; } -void SketcherCurveColor::set_color(int color) +void SketcherCurveColor::handle_done_event(int result) { - this->color = color; - int r = (color>>16) & 0xff; - int g = (color>>8) & 0xff; - int b = (color>>0) & 0xff; - for( int i=0; i<3; ++i ) { - VFrame *vframe = vframes[i]; - int ww = vframe->get_w(), hh = vframe->get_h(); - uint8_t **rows = vframe->get_rows(); - int rr = r, gg = g, bb = b; - switch( i ) { - case BUTTON_UP: - break; - case BUTTON_UPHI: - if( (rr+=48) > 0xff ) rr = 0xff; - if( (gg+=48) > 0xff ) gg = 0xff; - if( (bb+=48) > 0xff ) bb = 0xff; - break; - case BUTTON_DOWNHI: - if( (rr-=48) < 0x00 ) rr = 0x00; - if( (gg-=48) < 0x00 ) gg = 0x00; - if( (bb-=48) < 0x00 ) bb = 0x00; - break; - } - for( int y=0; ystart_color_thread(this); - return 1; -} - -SketcherCurveColorPicker::SketcherCurveColorPicker(SketcherWindow *gui, SketcherCurveColor *color_button) - : ColorPicker(1, _("Color")) -{ - this->gui = gui; - this->color_button = color_button; - this->color = CV_COLOR; - color_update = new SketcherCurveColorThread(this); -} - -SketcherCurveColorPicker::~SketcherCurveColorPicker() -{ - delete color_update; -} - -void SketcherCurveColorPicker::start(int color) -{ - this->color = color; - int alpha = (~color>>24) & 0xff; - start_window(color & 0xffffff, alpha, 1); - color_update->start(); -} - -void SketcherCurveColorPicker::handle_done_event(int result) -{ - color_update->stop(); - gui->lock_window("SketcherCurveColorPicker::handle_done_event"); - if( result ) { color = orig_color | (~orig_alpha<<24); } - color_button->update_gui(color); - gui->unlock_window(); + if( result ) color = orig_color | (~orig_alpha<<24); SketcherConfig &config = gui->plugin->config; int ci = config.cv_selected; if( ci >= 0 && ci < config.curves.size() ) { @@ -199,17 +127,11 @@ void SketcherCurveColorPicker::handle_done_event(int result) } } -int SketcherCurveColorPicker::handle_new_color(int color, int alpha) +int SketcherCurveColor::handle_new_color(int color, int alpha) { - this->color = color | (~alpha<<24); - color_update->update_lock->unlock(); - return 1; -} - -void SketcherCurveColorPicker::update_gui() -{ - gui->lock_window("SketcherCurveColorPicker::update_gui"); - color_button->update_gui(color); + color |= ~alpha<<24; this->color = color; + gui->lock_window("SketcherCurveColor::update_gui"); + update_gui(color); SketcherConfig &config = gui->plugin->config; int ci = config.cv_selected; if( ci >= 0 ) { @@ -219,46 +141,7 @@ void SketcherCurveColorPicker::update_gui() gui->send_configure_change(); } gui->unlock_window(); -} - -SketcherCurveColorThread::SketcherCurveColorThread(SketcherCurveColorPicker *color_picker) - : Thread(1, 0, 0) -{ - this->color_picker = color_picker; - this->update_lock = new Condition(0,"SketcherCurveColorThread::update_lock"); - done = 1; -} - -SketcherCurveColorThread::~SketcherCurveColorThread() -{ - stop(); - delete update_lock; -} - -void SketcherCurveColorThread::start() -{ - if( done ) { - done = 0; - Thread::start(); - } -} - -void SketcherCurveColorThread::stop() -{ - if( !done ) { - done = 1; - update_lock->unlock(); - join(); - } -} - -void SketcherCurveColorThread::run() -{ - while( !done ) { - update_lock->lock("SketcherCurveColorThread::run"); - if( done ) break; - color_picker->update_gui(); - } + return 1; } @@ -382,7 +265,7 @@ SketcherWindow::SketcherWindow(Sketcher *plugin) this->plugin = plugin; this->title_pen = 0; this->curve_pen = 0; this->title_color = 0; this->curve_color = 0; - this->color_picker = 0; this->drag = 0; + this->drag = 0; this->new_curve = 0; this->del_curve = 0; this->curve_up = 0; this->curve_dn = 0; this->title_x = 0; this->point_x = 0; @@ -410,7 +293,6 @@ SketcherWindow::~SketcherWindow() delete curve_width; delete point_x; delete point_y; - delete color_picker; } void SketcherWindow::create_objects() @@ -467,10 +349,9 @@ void SketcherWindow::create_objects() curve_pen = new SketcherCurvePen(this, x1, y, cv->pen); add_subwindow(curve_pen); dy = bmax(dy,curve_pen->get_h()); curve_pen->create_objects(); - curve_color = new SketcherCurveColor(this, x2, y, COLOR_W, COLOR_H); + curve_color = new SketcherCurveColor(this, x2, y, COLOR_W, COLOR_H, + cv->color&0xffffff, (~cv->color>>24)&0xff); add_subwindow(curve_color); dy = bmax(dy,curve_color->get_h()); - curve_color->set_color(cv->color); - curve_color->draw_face(); y += dy + margin; dy = 0; curve_list->update(ci); @@ -577,7 +458,6 @@ void SketcherWindow::create_objects() void SketcherWindow::done_event(int result) { - delete color_picker; color_picker = 0; } void SketcherWindow::send_configure_change() @@ -854,20 +734,6 @@ int SketcherWindow::keypress_event() return 0; } -void SketcherWindow::start_color_thread(SketcherCurveColor *color_button) -{ - unlock_window(); - delete color_picker; - color_picker = new SketcherCurveColorPicker(this, color_button); - int color = CV_COLOR, ci = plugin->config.cv_selected; - if( ci >= 0 && ci < plugin->config.curves.size() ) { - SketcherCurve *cv = plugin->config.curves[ci]; - color = cv->color; - } - color_picker->start(color); - lock_window("SketcherWindow::start_color_thread"); -} - SketcherCurveList::SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y) : BC_ListBox(x, y, 360, 130, LISTBOX_TEXT) diff --git a/cinelerra-5.1/plugins/sketcher/sketcherwindow.h b/cinelerra-5.1/plugins/sketcher/sketcherwindow.h index 71c8ac45..5b4d8cce 100644 --- a/cinelerra-5.1/plugins/sketcher/sketcherwindow.h +++ b/cinelerra-5.1/plugins/sketcher/sketcherwindow.h @@ -33,8 +33,6 @@ class SketcherCurveType; class SketcherCurvePenItem; class SketcherCurvePen; class SketcherCurveColor; -class SketcherCurveColorPicker; -class SketcherCurveColorThread; class SketcherNewCurve; class SketcherDelCurve; class SketcherCurveUp; @@ -98,50 +96,19 @@ public: int pen; }; -class SketcherCurveColor : public BC_Button +class SketcherCurveColor : public ColorBoxButton { public: - SketcherCurveColor(SketcherWindow *gui, int x, int y, int w, int h); + SketcherCurveColor(SketcherWindow *gui, + int x, int y, int w, int h, int color, int alpha); ~SketcherCurveColor(); - void set_color(int color); - void update_gui(int color); - int handle_event(); - - int color; - VFrame *vframes[3]; - SketcherWindow *gui; -}; - -class SketcherCurveColorPicker : public ColorPicker -{ -public: - SketcherCurveColorPicker(SketcherWindow *gui, SketcherCurveColor *curve_color); - ~SketcherCurveColorPicker(); - void start(int color); int handle_new_color(int color, int alpha); - void update_gui(); void handle_done_event(int result); - SketcherWindow *gui; int color; - SketcherCurveColor *color_button; - SketcherCurveColorThread *color_update; -}; - -class SketcherCurveColorThread : public Thread -{ -public: - SketcherCurveColorThread(SketcherCurveColorPicker *color_picker); - ~SketcherCurveColorThread(); - - void start(); - void stop(); - void run(); - - SketcherCurveColorPicker *color_picker; - int done; - Condition *update_lock; + VFrame *vframes[3]; + SketcherWindow *gui; }; class SketcherNewCurve : public BC_GenericButton @@ -391,7 +358,6 @@ public: void create_objects(); void done_event(int result); void update_gui(); - void start_color_thread(SketcherCurveColor *curve_color); int grab_event(XEvent *event); int do_grab_event(XEvent *event); int grab_button_press(XEvent *event); @@ -405,7 +371,6 @@ public: SketcherCurveType *curve_type; SketcherCurvePen *curve_pen; SketcherCurveColor *curve_color; - SketcherCurveColorPicker *color_picker; SketcherNewCurve *new_curve; SketcherDelCurve *del_curve; SketcherCurveUp *curve_up; diff --git a/cinelerra-5.1/plugins/titler/titler.C b/cinelerra-5.1/plugins/titler/titler.C index d0f4f681..79b90a7a 100644 --- a/cinelerra-5.1/plugins/titler/titler.C +++ b/cinelerra-5.1/plugins/titler/titler.C @@ -2465,7 +2465,6 @@ void TitleMain::update_gui() window->lock_window("TitleMain::update_gui"); window->update(); window->unlock_window(); - window->color_thread->update_gui(config.color, 0); } } } diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.C b/cinelerra-5.1/plugins/titler/titlerwindow.C index 9245368f..04f1ef69 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.C +++ b/cinelerra-5.1/plugins/titler/titlerwindow.C @@ -79,8 +79,6 @@ TitleWindow::TitleWindow(TitleMain *client) fonts_popup = 0; png_popup = 0; - color_x = color_y = 0; - outline_color_x = outline_color_y = 0; drag_dx = drag_dy = dragging = 0; cur_ibeam = -1; @@ -92,10 +90,8 @@ TitleWindow::TitleWindow(TitleMain *client) encoding_title = 0; encoding = 0; color_button = 0; - color_thread = 0; + outline_button = 0; color_popup = 0; - outline_color_button = 0; - outline_color_thread = 0; motion_title = 0; motion = 0; line_pitch = 0; @@ -123,8 +119,6 @@ TitleWindow::TitleWindow(TitleMain *client) void TitleWindow::done_event(int result) { drag->drag_deactivate(); - delete color_thread; color_thread = 0; - delete outline_color_thread; outline_color_thread = 0; delete color_popup; color_popup = 0; delete png_popup; png_popup = 0; @@ -132,8 +126,6 @@ void TitleWindow::done_event(int result) TitleWindow::~TitleWindow() { - delete color_thread; - delete outline_color_thread; delete color_popup; delete png_popup; for( int i=0; iget_h() + 10; - color_x = x3; color_y = y = y1; - color_thread = new TitleColorThread(client, this, 0); - x1 = color_x + COLOR_W + 2*margin; - y1 = color_y + 5; + add_tool(color_button_title = new BC_Title(x3, y1+10, _("Color:"))); + x1 = x3 + color_button_title->get_w() + 30; add_tool(color_button = new TitleColorButton(client, this, x1, y1)); - y += COLOR_H + 5; - outline_color_x = x3; outline_color_y = y; - outline_color_thread = new TitleColorThread(client, this, 1); - y1 = outline_color_y + 5; - add_tool(outline_color_button = new TitleOutlineColorButton(client, this, x1, y1)); + y1 += color_button->get_h() + 10; + add_tool(outline_button_title = new BC_Title(x3, y1+10, _("Outline:"))); + add_tool(outline_button = new TitleOutlineColorButton(client, this, x1, y1)); x = 10; y = y2; add_tool(outline_title = new BC_Title(x, y, _("Outline:"))); @@ -447,8 +434,10 @@ int TitleWindow::resize_event(int w, int h) pitch_title->reposition_window(pitch_title->get_x(), pitch_title->get_y()); pitch->reposition_window(pitch->get_x(), pitch->get_y()); + color_button_title->reposition_window(color_button_title->get_x(), color_button_title->get_y()); color_button->reposition_window(color_button->get_x(), color_button->get_y()); - outline_color_button->reposition_window(outline_color_button->get_x(), outline_color_button->get_y()); + outline_button_title->reposition_window(outline_button_title->get_x(), outline_button_title->get_y()); + outline_button->reposition_window(outline_button->get_x(), outline_button->get_y()); motion_title->reposition_window(motion_title->get_x(), motion_title->get_y()); motion->reposition_window(motion->get_x(), motion->get_y()); loop->reposition_window(loop->get_x(), loop->get_y()); @@ -546,16 +535,8 @@ int TitleWindow::insert_ibeam(const char *txt, int ofs) void TitleWindow::update_color() { -//printf("TitleWindow::update_color %x\n", client->config.color); - set_color(client->config.color); - draw_box(color_x, color_y, COLOR_W, COLOR_H); - flash(color_x, color_y, COLOR_W, COLOR_H); - set_color(client->config.outline_color); - draw_box(outline_color_x, outline_color_y, COLOR_W, COLOR_H); - set_color(BLACK); - draw_rectangle(color_x, color_y, COLOR_W, COLOR_H); - draw_rectangle(outline_color_x, outline_color_y, COLOR_W, COLOR_H); - flash(outline_color_x, outline_color_y, COLOR_W, COLOR_H); + color_button->update_gui(client->config.color); + outline_button->update_gui(client->config.outline_color); } void TitleWindow::update_justification() @@ -782,29 +763,48 @@ int TitlePitch::handle_event() } TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y) - : BC_GenericButton(x, y, _("Text Color...")) + : ColorCircleButton(_("Text Color"), x, y, COLOR_W, COLOR_H, + client->config.color, client->config.alpha, 1) { this->client = client; this->window = window; } -int TitleColorButton::handle_event() +int TitleColorButton::handle_new_color(int output, int alpha) { - window->color_thread->start_window(client->config.color, - client->config.alpha, 1); + client->config.color = output; + client->config.alpha = alpha; + window->send_configure_change(); return 1; } +void TitleColorButton::handle_done_event(int result) +{ + if( result ) { + handle_new_color(orig_color, orig_alpha); + update_gui(orig_color); + } +} + TitleOutlineColorButton::TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y) - : BC_GenericButton(x, y, _("Outline color...")) + : ColorCircleButton(_("Outline Color"), x, y, COLOR_W, COLOR_H, + client->config.outline_color, client->config.outline_alpha, 1) { this->client = client; this->window = window; } -int TitleOutlineColorButton::handle_event() +int TitleOutlineColorButton::handle_new_color(int output, int alpha) { - window->outline_color_thread->start_window(client->config.outline_color, - client->config.outline_alpha, 1); + client->config.outline_color = output; + client->config.outline_alpha = alpha; + window->send_configure_change(); return 1; } +void TitleOutlineColorButton::handle_done_event(int result) +{ + if( result ) { + handle_new_color(orig_color, orig_alpha); + update_gui(orig_color); + } +} TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y) @@ -1209,47 +1209,6 @@ int TitleBottom::handle_event() return 1; } - - -TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline) - : ColorPicker(1, is_outline? _("Outline Color") : _("Text Color")) -{ - this->client = client; - this->window = window; - this->is_outline = is_outline; -} - -int TitleColorThread::handle_new_color(int output, int alpha) -{ - if( is_outline ) { - client->config.outline_color = output; - client->config.outline_alpha = alpha; - } - else { - client->config.color = output; - client->config.alpha = alpha; - } - - window->lock_window("TitleColorThread::handle_new_color"); - window->update_color(); - window->flush(); - window->unlock_window(); - - window->send_configure_change(); - return 1; -} - -void TitleColorThread::handle_done_event(int result) -{ - if( result ) { - client->config.color = orig_color; - client->config.alpha = orig_alpha; - handle_new_color(orig_color, orig_alpha); - window->update_color(); - window->send_configure_change(); - } -} - TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y) : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->config.drag, client->config.title_x, client->config.title_y, diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.h b/cinelerra-5.1/plugins/titler/titlerwindow.h index 4dcaa6dd..10ca4724 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.h +++ b/cinelerra-5.1/plugins/titler/titlerwindow.h @@ -24,9 +24,7 @@ #include "guicast.h" -class TitleThread; class TitleWindow; -class TitleInterlace; #include "colorpicker.h" #include "dragcheckbox.h" @@ -64,7 +62,6 @@ class TitleCenter; class TitleRight;class TitleTop; class TitleMid; class TitleBottom; -class TitleColorThread; class TitleSpeed; class TitleTimecode; class TitleTimecodeFormat; @@ -143,10 +140,10 @@ public: TitlePitch *pitch; BC_Title *encoding_title; TitleEncoding *encoding; + BC_Title *color_button_title; TitleColorButton *color_button; - TitleColorThread *color_thread; - TitleOutlineColorButton *outline_color_button; - TitleColorThread *outline_color_thread; + BC_Title *outline_button_title; + TitleOutlineColorButton *outline_button; BC_Title *motion_title; TitleMotion *motion; TitleLinePitch *line_pitch; @@ -279,19 +276,21 @@ public: TitleWindow *window; }; -class TitleColorButton : public BC_GenericButton +class TitleColorButton : public ColorCircleButton { public: TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y); - int handle_event(); + int handle_new_color(int output, int alpha); + void handle_done_event(int result); TitleMain *client; TitleWindow *window; }; -class TitleOutlineColorButton : public BC_GenericButton +class TitleOutlineColorButton : public ColorCircleButton { public: TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y); - int handle_event(); + int handle_new_color(int output, int alpha); + void handle_done_event(int result); TitleMain *client; TitleWindow *window; }; @@ -498,16 +497,6 @@ public: TitleMain *client; TitleWindow *window; }; -class TitleColorThread : public ColorPicker -{ -public: - TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline); - virtual int handle_new_color(int output, int alpha); - void handle_done_event(int result); - TitleMain *client; - TitleWindow *window; - int is_outline; -}; class TitleBackground : public BC_CheckBox { public: -- 2.26.2