rework histogram_bezier, init wm icon set_icon(gg), update de.po+msg/txt master
authorGood Guy <good1.2guy@gmail.com>
Sun, 28 Oct 2018 18:36:26 +0000 (12:36 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sun, 28 Oct 2018 18:36:26 +0000 (12:36 -0600)
16 files changed:
cinelerra-5.1/cinelerra/pluginclient.C
cinelerra-5.1/guicast/bcresources.C
cinelerra-5.1/guicast/bcresources.h
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/images/default_icon.png [new file with mode: 0644]
cinelerra-5.1/guicast/images/default_icon_png.h [new file with mode: 0644]
cinelerra-5.1/guicast/linklist.h
cinelerra-5.1/msg/txt
cinelerra-5.1/plugins/histogram_bezier/bistogram.C
cinelerra-5.1/plugins/histogram_bezier/bistogram.h
cinelerra-5.1/plugins/histogram_bezier/bistogram.inc
cinelerra-5.1/plugins/histogram_bezier/bistogramconfig.C
cinelerra-5.1/plugins/histogram_bezier/bistogramconfig.h
cinelerra-5.1/plugins/histogram_bezier/bistogramwindow.C
cinelerra-5.1/plugins/histogram_bezier/bistogramwindow.h
cinelerra-5.1/po/de.po

index 7f1fdd04323959926339ba8bc5ad108803b207ea..606f83d95af6ce007aa7d685d5a6fbb730761af3 100644 (file)
@@ -81,6 +81,8 @@ void PluginClientThread::run()
        if(window) {
                window->lock_window("PluginClientThread::run");
                window->create_objects();
        if(window) {
                window->lock_window("PluginClientThread::run");
                window->create_objects();
+               VFrame *picon = client->server->get_picon();
+               if( picon ) window->set_icon(picon);
                window->unlock_window();
 
 /* Only set it here so tracking doesn't update it until everything is created. */
                window->unlock_window();
 
 /* Only set it here so tracking doesn't update it until everything is created. */
index 5746e6c20ff895fad571e8fc994a408e4bd5ff21..43a713e7a47ac80d49929fdebdca4bb09e83f8db 100644 (file)
@@ -360,6 +360,7 @@ VFrame *BC_Resources::default_progress_images[2] = { 0, };
 VFrame *BC_Resources::default_medium_7segment[20] = { 0, };
 VFrame *BC_Resources::default_vscroll_data[10] = { 0, };
 VFrame *BC_Resources::default_hscroll_data[10] = { 0, };
 VFrame *BC_Resources::default_medium_7segment[20] = { 0, };
 VFrame *BC_Resources::default_vscroll_data[10] = { 0, };
 VFrame *BC_Resources::default_hscroll_data[10] = { 0, };
+VFrame *BC_Resources::default_icon_img = 0;
 
 BC_Resources::BC_Resources()
 {
 
 BC_Resources::BC_Resources()
 {
@@ -712,6 +713,9 @@ new_vframes(10,default_vscroll_data,
        new VFramePng(vscroll_right_hi_png),
        new VFramePng(vscroll_right_dn_png));
 
        new VFramePng(vscroll_right_hi_png),
        new VFramePng(vscroll_right_dn_png));
 
+#include "images/default_icon_png.h"
+       default_icon_img = new VFramePng(default_icon_png);
+
        type_to_icon = default_type_to_icon;
        bar_data = default_bar;
        check = default_check_image;
        type_to_icon = default_type_to_icon;
        bar_data = default_bar;
        check = default_check_image;
@@ -723,6 +727,7 @@ new_vframes(10,default_vscroll_data,
        listbox_dn = default_listbox_dn;
        hscroll_data = default_hscroll_data;
        vscroll_data = default_vscroll_data;
        listbox_dn = default_listbox_dn;
        hscroll_data = default_hscroll_data;
        vscroll_data = default_vscroll_data;
+       default_icon = default_icon_img;
 
        listbox_title_overlap = 0;
        listbox_title_margin = 0;
 
        listbox_title_overlap = 0;
        listbox_title_margin = 0;
@@ -954,6 +959,7 @@ BC_Resources::~BC_Resources()
                fontlist->remove_all_objects();
                delete fontlist;
        }
                fontlist->remove_all_objects();
                delete fontlist;
        }
+       delete default_icon_img;
        finit_font_defs();
 }
 
        finit_font_defs();
 }
 
index f2339ed05be716fd1a718adcd24226abb6d5c984..369d196c5734e4e8bb987af9fa6c90c2b3005e2a 100644 (file)
@@ -185,6 +185,8 @@ public:
        static VFrame *bg_image;
        static VFrame *menu_bg;
 
        static VFrame *bg_image;
        static VFrame *menu_bg;
 
+// default icon
+       VFrame *default_icon;
 // Buttons
        VFrame **ok_images;
        VFrame **cancel_images;
 // Buttons
        VFrame **ok_images;
        VFrame **cancel_images;
@@ -402,6 +404,7 @@ public:
        static VFrame *default_medium_7segment[20];
        static VFrame *default_vscroll_data[10];
        static VFrame *default_hscroll_data[10];
        static VFrame *default_medium_7segment[20];
        static VFrame *default_vscroll_data[10];
        static VFrame *default_hscroll_data[10];
+       static VFrame *default_icon_img;
 
 // Make VFrame use shm
        int vframe_shm;
 
 // Make VFrame use shm
        int vframe_shm;
index 621c560acb4b5363df11985e77aca1a13a934847..1ef0d5939cc8e697ae71ffe3a94b2bbcdc894b3b 100644 (file)
@@ -62,7 +62,6 @@
 #include <X11/XF86keysym.h>
 #include <X11/Sunkeysym.h>
 
 #include <X11/XF86keysym.h>
 #include <X11/Sunkeysym.h>
 
-
 BC_ResizeCall::BC_ResizeCall(int w, int h)
 {
        this->w = w;
 BC_ResizeCall::BC_ResizeCall(int w, int h)
 {
        this->w = w;
@@ -547,6 +546,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title
                                PropModeReplace, (unsigned char *)&XGroupLeader, true);
                }
                init_im();
                                PropModeReplace, (unsigned char *)&XGroupLeader, true);
                }
                init_im();
+               set_icon(get_resources()->default_icon);
        }
 
 #ifdef HAVE_LIBXXF86VM
        }
 
 #ifdef HAVE_LIBXXF86VM
diff --git a/cinelerra-5.1/guicast/images/default_icon.png b/cinelerra-5.1/guicast/images/default_icon.png
new file mode 100644 (file)
index 0000000..6070443
Binary files /dev/null and b/cinelerra-5.1/guicast/images/default_icon.png differ
diff --git a/cinelerra-5.1/guicast/images/default_icon_png.h b/cinelerra-5.1/guicast/images/default_icon_png.h
new file mode 100644 (file)
index 0000000..c430263
--- /dev/null
@@ -0,0 +1,134 @@
+#ifndef DEFAULT_ICON_PNG_H
+#define DEFAULT_ICON_PNG_H
+
+static unsigned char default_icon_png[] = 
+{
+       0x00, 0x00, 0x07, 0xc3, 
+       0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 
+       0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x08, 0x06, 0x00, 0x00, 0x00, 0x57, 0x02, 0xf9, 
+       0x87, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 
+       0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 
+       0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 
+       0x07, 0xe2, 0x0a, 0x1b, 0x00, 0x11, 0x08, 0x07, 0xf2, 0x73, 0x34, 0x00, 0x00, 0x07, 0x50, 0x49, 
+       0x44, 0x41, 0x54, 0x68, 0xde, 0xd5, 0x5a, 0xbf, 0xcb, 0x75, 0x47, 0x11, 0x7e, 0x9e, 0xd9, 0xbd, 
+       0x1f, 0x82, 0x08, 0x16, 0x29, 0x2c, 0x2c, 0x62, 0x91, 0xc6, 0x42, 0x22, 0x04, 0xa2, 0x85, 0xc4, 
+       0x74, 0x62, 0x21, 0x29, 0x4c, 0xad, 0x58, 0xa5, 0xb5, 0xb7, 0x10, 0xfc, 0x17, 0x42, 0x48, 0xfc, 
+       0x07, 0x6c, 0x82, 0x95, 0x45, 0x0a, 0x0b, 0x0b, 0x95, 0x58, 0x88, 0x60, 0x4c, 0x5a, 0xc5, 0x52, 
+       0x14, 0xc4, 0x0f, 0x89, 0x79, 0xdf, 0x7b, 0xcf, 0x58, 0xcc, 0xec, 0xee, 0xec, 0xec, 0xde, 0xf7, 
+       0xc7, 0xd7, 0x7d, 0x17, 0x0e, 0xe7, 0x9c, 0xbd, 0x7b, 0xce, 0xce, 0x8f, 0x67, 0x9e, 0x9d, 0x99, 
+       0x7b, 0x09, 0x40, 0xf1, 0x1c, 0x7f, 0x04, 0xcf, 0xf9, 0xa7, 0xe2, 0xbd, 0x57, 0xfe, 0x83, 0x03, 
+       0xc0, 0xa1, 0xc0, 0x59, 0x15, 0x67, 0x05, 0x6e, 0xfd, 0xfa, 0x46, 0xd1, 0xef, 0xdb, 0xf5, 0xff, 
+       0x2e, 0x7e, 0xf6, 0xfb, 0x1b, 0x10, 0xb7, 0x0a, 0x5c, 0x14, 0xb8, 0x51, 0xe2, 0xe2, 0xf3, 0x0f, 
+       0x1f, 0x57, 0x65, 0x7f, 0xbf, 0x2a, 0xa0, 0x20, 0x54, 0xcd, 0xf1, 0x24, 0xed, 0x0c, 0xbb, 0x17, 
+       0x00, 0x02, 0x42, 0x60, 0x63, 0x02, 0x40, 0x7c, 0xbc, 0x90, 0xfe, 0x7d, 0x38, 0x84, 0xd5, 0x66, 
+       0xaa, 0x3f, 0xe1, 0x37, 0x04, 0xc0, 0xf6, 0x22, 0x55, 0x90, 0x03, 0x69, 0x14, 0x00, 0x87, 0x2d, 
+       0x44, 0x00, 0x74, 0x01, 0xe8, 0x0b, 0x5c, 0x00, 0x08, 0x4d, 0x48, 0x9f, 0x0a, 0xb6, 0x67, 0x5d, 
+       0x60, 0x5b, 0x0b, 0xf6, 0xde, 0x71, 0xeb, 0xeb, 0x8e, 0x43, 0x00, 0x08, 0xfd, 0x9a, 0x58, 0x14, 
+       0x20, 0xb4, 0x82, 0x42, 0x33, 0x4f, 0x03, 0x15, 0xed, 0x9e, 0x63, 0x00, 0x54, 0x40, 0xc4, 0x85, 
+       0xbd, 0xd8, 0xcb, 0xfa, 0x82, 0x6a, 0xcf, 0xb4, 0x57, 0x70, 0xf2, 0xf0, 0x98, 0xd8, 0xc6, 0x15, 
+       0xc3, 0x66, 0x4d, 0x09, 0x4e, 0xb3, 0x15, 0x42, 0x5f, 0x13, 0x43, 0x78, 0xfa, 0x78, 0x52, 0xa2, 
+       0xba, 0x55, 0x09, 0xe8, 0x10, 0xba, 0x29, 0xc5, 0x8d, 0x55, 0xda, 0x82, 0xdd, 0xf2, 0xae, 0x60, 
+       0xb7, 0x1a, 0x09, 0x1e, 0x3e, 0x8f, 0xb0, 0xeb, 0xa6, 0x64, 0x13, 0x5e, 0xc3, 0x7b, 0x36, 0x56, 
+       0x27, 0x87, 0xc5, 0x67, 0x4f, 0x28, 0x0a, 0xcd, 0xf3, 0xc5, 0x9e, 0xaf, 0xc1, 0x9d, 0xc3, 0x13, 
+       0xec, 0x4a, 0x01, 0x6c, 0x8a, 0x04, 0x08, 0xf1, 0x00, 0x44, 0x08, 0x51, 0xbb, 0x1e, 0x56, 0xf6, 
+       0x67, 0xe8, 0x10, 0xd3, 0x31, 0x5f, 0x93, 0x77, 0xe8, 0xf8, 0x19, 0x10, 0x9c, 0x2d, 0x9e, 0xe1, 
+       0x52, 0x38, 0x14, 0x11, 0x02, 0x05, 0x49, 0x81, 0x06, 0x17, 0x00, 0x43, 0x11, 0x1d, 0x16, 0x46, 
+       0x0b, 0xa8, 0xcb, 0xc0, 0x65, 0x0b, 0x1b, 0xa1, 0x2b, 0x83, 0x11, 0x0f, 0x2d, 0x28, 0x8f, 0xf8, 
+       0x8e, 0x2b, 0xf8, 0x9f, 0xac, 0x0f, 0x80, 0x4c, 0x70, 0x61, 0x54, 0x44, 0x5b, 0x00, 0xa3, 0x00, 
+       0xd5, 0x54, 0x0b, 0x31, 0xd0, 0x04, 0xa0, 0xd3, 0x43, 0xb4, 0x10, 0xe3, 0xc2, 0x0e, 0x0b, 0x11, 
+       0x17, 0xb2, 0x29, 0xe8, 0xf8, 0x6d, 0xf3, 0x04, 0x16, 0x1f, 0xe4, 0x1c, 0x1a, 0x0b, 0x24, 0x37, 
+       0x70, 0x11, 0x72, 0x08, 0x6f, 0xe6, 0x36, 0xcb, 0x13, 0x28, 0x50, 0x14, 0x61, 0x85, 0x36, 0x9f, 
+       0xa9, 0xce, 0x0b, 0xb8, 0x05, 0x0e, 0x75, 0x25, 0x0e, 0x85, 0x28, 0x0d, 0x12, 0xd1, 0xba, 0xd1, 
+       0xf2, 0x31, 0x1e, 0x9c, 0x26, 0x7b, 0x1c, 0x5c, 0xd9, 0x81, 0xb8, 0x83, 0x4d, 0xbb, 0x16, 0x13, 
+       0x58, 0x00, 0xd4, 0x10, 0x17, 0x03, 0x42, 0x5a, 0xa3, 0xd9, 0x9d, 0xac, 0x31, 0x51, 0x2b, 0x23, 
+       0x66, 0x9d, 0x27, 0x19, 0xa9, 0x8f, 0x23, 0x78, 0xd1, 0x82, 0x57, 0x53, 0xb0, 0x7b, 0x1c, 0x0c, 
+       0x52, 0xe2, 0x22, 0x7c, 0xf6, 0x88, 0x09, 0xab, 0xa0, 0x70, 0x56, 0x8a, 0x13, 0xbd, 0xd6, 0x89, 
+       0xdf, 0x3a, 0x56, 0x43, 0x30, 0x63, 0xf3, 0xe2, 0xe9, 0xde, 0xf7, 0x8b, 0xc3, 0xbf, 0x6b, 0x70, 
+       0xe9, 0x50, 0xea, 0xde, 0x99, 0x85, 0x5f, 0xf0, 0x9f, 0xac, 0x5e, 0x7a, 0xb0, 0x1a, 0xf3, 0x4c, 
+       0xe3, 0x63, 0xbe, 0x29, 0xd0, 0xc1, 0xd3, 0xac, 0xee, 0x0c, 0x83, 0x8b, 0x2e, 0x96, 0x8e, 0x2c, 
+       0x44, 0x1d, 0xf0, 0xb0, 0x98, 0x18, 0xde, 0x50, 0xbf, 0x57, 0xcc, 0x1e, 0x4b, 0x3b, 0x84, 0xed, 
+       0x2f, 0x01, 0x16, 0xc2, 0x21, 0x64, 0xe1, 0xf0, 0x44, 0x11, 0x4e, 0xdf, 0x75, 0x05, 0x94, 0x58, 
+       0x38, 0x2e, 0x6e, 0x62, 0x50, 0x74, 0xba, 0x14, 0x1d, 0x1c, 0x8d, 0x6b, 0x41, 0xc8, 0x1c, 0x07, 
+       0x2b, 0xe4, 0x62, 0x20, 0xe7, 0x9d, 0xb6, 0x30, 0x58, 0x3f, 0x62, 0x5e, 0x06, 0x85, 0x06, 0x5a, 
+       0x1d, 0x31, 0x30, 0x79, 0x61, 0xb7, 0x4b, 0x36, 0x8a, 0xb8, 0xa0, 0xb3, 0x93, 0x2c, 0x0a, 0x70, 
+       0x66, 0x93, 0x6c, 0x72, 0x72, 0xec, 0xc0, 0x81, 0xfb, 0xc5, 0x37, 0xbd, 0xd2, 0xbc, 0x20, 0xc9, 
+       0x1b, 0x04, 0x84, 0xea, 0x8a, 0x70, 0x28, 0xda, 0x3c, 0x10, 0x09, 0x68, 0xf1, 0x75, 0xa6, 0x3e, 
+       0x5e, 0xd9, 0x91, 0xc3, 0xbd, 0x00, 0x50, 0xce, 0xd4, 0xa8, 0x3e, 0x47, 0x97, 0xe0, 0x1f, 0x82, 
+       0x96, 0x74, 0x1d, 0xc7, 0x6a, 0x3f, 0x1b, 0xbd, 0x2e, 0x1e, 0xe8, 0xc6, 0x77, 0x22, 0x8a, 0x09, 
+       0x4b, 0xe7, 0x7f, 0x35, 0x69, 0x7a, 0xaa, 0x90, 0x15, 0xb9, 0x23, 0x3d, 0x40, 0x53, 0x8a, 0x03, 
+       0x9d, 0x4c, 0x56, 0xee, 0x67, 0xb1, 0xeb, 0x1a, 0x84, 0x2f, 0xd1, 0x43, 0x54, 0x54, 0xa1, 0xb3, 
+       0x50, 0x42, 0x8e, 0xfa, 0x02, 0xff, 0xfd, 0x8c, 0xf8, 0xe9, 0x87, 0xa7, 0x47, 0x27, 0xe8, 0xdf, 
+       0xf9, 0xea, 0x19, 0x14, 0x9d, 0x04, 0xff, 0xe4, 0xef, 0x15, 0xff, 0x78, 0xca, 0x47, 0xbd, 0xe7, 
+       0xc5, 0x17, 0x14, 0xaf, 0xbe, 0x74, 0x31, 0x25, 0x00, 0x54, 0x49, 0xfb, 0x81, 0xed, 0xc8, 0x62, 
+       0x10, 0x4a, 0xf0, 0xf9, 0xeb, 0xbf, 0xe5, 0x99, 0x84, 0x07, 0x80, 0x0f, 0x3e, 0xa9, 0x3d, 0xd0, 
+       0x49, 0xe0, 0x37, 0x1f, 0x9f, 0x1e, 0x2d, 0x3c, 0x00, 0xfc, 0xed, 0x9f, 0xc4, 0xbf, 0x9e, 0x12, 
+       0x45, 0x80, 0x5a, 0xc6, 0x51, 0xaa, 0x1d, 0xd5, 0x8e, 0x00, 0xa1, 0x10, 0x07, 0xef, 0xfe, 0x79, 
+       0x78, 0xe6, 0x27, 0xdf, 0xbc, 0x41, 0x2d, 0xc0, 0xed, 0xd1, 0x8a, 0x16, 0x2f, 0x64, 0x2e, 0x76, 
+       0xff, 0x99, 0x17, 0x33, 0x9f, 0x9e, 0x81, 0x5f, 0x7e, 0xf4, 0x24, 0x92, 0x57, 0x67, 0xab, 0xf6, 
+       0x79, 0xfd, 0x6b, 0xb7, 0xbe, 0xcb, 0x5b, 0x30, 0x32, 0xb1, 0x4b, 0x75, 0xe8, 0xbc, 0xff, 0x7b, 
+       0x5b, 0xff, 0xd7, 0x7f, 0x29, 0xf8, 0xd1, 0x6b, 0xe7, 0x0e, 0xa9, 0x1c, 0x13, 0x13, 0x84, 0x3a, 
+       0x8c, 0x68, 0x02, 0x76, 0x26, 0x15, 0xd7, 0x8e, 0x33, 0xd6, 0x5a, 0x61, 0xd3, 0x12, 0xbd, 0x22, 
+       0x5c, 0x03, 0x3e, 0x95, 0xdb, 0x3d, 0xc5, 0x66, 0x48, 0x99, 0x13, 0xfe, 0x25, 0x55, 0xb9, 0xa5, 
+       0xac, 0x71, 0x12, 0xe8, 0xb5, 0xa2, 0x25, 0x89, 0x57, 0x4b, 0x7b, 0x0e, 0xda, 0x9c, 0x8a, 0x13, 
+       0x1d, 0xd9, 0x28, 0x01, 0x14, 0x51, 0x7c, 0xff, 0xe5, 0x1b, 0x5c, 0x00, 0x9c, 0x7b, 0x69, 0x92, 
+       0x84, 0x91, 0x28, 0xbc, 0x76, 0x4f, 0x34, 0x2f, 0x54, 0x31, 0xcb, 0xfe, 0xe0, 0xf5, 0xb3, 0x05, 
+       0xb1, 0xac, 0x2c, 0x74, 0x5a, 0x76, 0xe2, 0xb4, 0x89, 0xdd, 0xa9, 0x48, 0xf4, 0x80, 0x47, 0xa9, 
+       0x1c, 0xe8, 0x85, 0x4a, 0x3f, 0x54, 0x2d, 0x19, 0x4c, 0x10, 0x12, 0xfa, 0x4e, 0xde, 0xac, 0x28, 
+       0x4e, 0x8b, 0x2e, 0xe8, 0x49, 0x88, 0x52, 0x86, 0xe0, 0x51, 0x81, 0x53, 0x54, 0x64, 0x52, 0x00, 
+       0x0f, 0xe8, 0xac, 0x04, 0x14, 0xc5, 0xb4, 0xf8, 0xe7, 0x7f, 0x78, 0xb2, 0x9d, 0xfe, 0xc6, 0xd7, 
+       0x6f, 0x00, 0x28, 0x94, 0xdc, 0x7b, 0xa0, 0x61, 0xba, 0xd8, 0xd8, 0xaf, 0x3e, 0x3c, 0xe1, 0xd3, 
+       0xdb, 0xfd, 0xd2, 0x3f, 0xfe, 0xee, 0xf0, 0xc6, 0x26, 0x2b, 0xad, 0xf7, 0xd3, 0x01, 0xd7, 0x0d, 
+       0x6e, 0x87, 0xef, 0x05, 0xeb, 0xb0, 0x1c, 0x66, 0xa7, 0x80, 0xb8, 0xf0, 0x22, 0x26, 0x18, 0xef, 
+       0x20, 0xa9, 0x2a, 0xea, 0xf0, 0xe2, 0x1d, 0x1e, 0x78, 0xa0, 0x0e, 0x79, 0xf0, 0xad, 0x6f, 0xdc, 
+       0x78, 0x0b, 0x06, 0xb8, 0xb9, 0x10, 0xbf, 0xf8, 0xe3, 0xa9, 0x2b, 0x20, 0x9b, 0x07, 0x85, 0x9e, 
+       0x94, 0x89, 0xa7, 0x0b, 0x7e, 0xbc, 0xf9, 0xad, 0x5b, 0xb3, 0x72, 0x31, 0x01, 0xdf, 0xf9, 0x60, 
+       0x50, 0x78, 0x2d, 0x2d, 0x3e, 0x74, 0x4e, 0xf8, 0x2c, 0x75, 0xb9, 0x5f, 0x01, 0xc1, 0x95, 0x44, 
+       0x2f, 0xdc, 0x4b, 0x82, 0x96, 0x14, 0x4f, 0xaf, 0x37, 0x41, 0x2c, 0x62, 0xc1, 0x5b, 0x5d, 0x91, 
+       0x2a, 0x6d, 0x1c, 0x38, 0xf9, 0x75, 0x66, 0xa1, 0x1a, 0x82, 0xb8, 0x4c, 0x85, 0x8f, 0xd6, 0x6d, 
+       0x26, 0x5a, 0x03, 0x95, 0x5e, 0x54, 0x51, 0x53, 0x4a, 0x1c, 0x8b, 0x8f, 0xf6, 0x39, 0x42, 0x42, 
+       0xd5, 0x3c, 0x90, 0x51, 0xd6, 0xac, 0xce, 0x98, 0x9c, 0x15, 0x8e, 0x80, 0x2d, 0x26, 0x60, 0xfb, 
+       0x7c, 0xae, 0x02, 0xa7, 0x32, 0x53, 0x67, 0x3c, 0x13, 0xa8, 0x9d, 0x12, 0x1b, 0x1d, 0x2a, 0x80, 
+       0xb7, 0x5e, 0x3e, 0xe3, 0xed, 0x3f, 0x99, 0x77, 0x7e, 0xf6, 0xdb, 0x27, 0x8f, 0xde, 0x45, 0x09, 
+       0x63, 0x21, 0x4d, 0xee, 0x7a, 0xff, 0x77, 0x8f, 0x7b, 0xd7, 0x0f, 0xbf, 0x7d, 0x59, 0x36, 0xb1, 
+       0x51, 0x13, 0x5b, 0x3f, 0x61, 0xfb, 0xe0, 0x57, 0xbe, 0x78, 0xe0, 0xc5, 0xcf, 0x3f, 0x5b, 0xb3, 
+       0xf2, 0x4b, 0x5f, 0xf0, 0x4e, 0x1e, 0xac, 0x97, 0xf8, 0xbd, 0x57, 0x6e, 0x9f, 0xb9, 0xf1, 0xf9, 
+       0xe5, 0x17, 0x8e, 0x1e, 0x2f, 0x22, 0x83, 0x86, 0x43, 0xfa, 0x4d, 0xbc, 0xf3, 0xda, 0xd3, 0x9e, 
+       0x0f, 0x1d, 0x56, 0xd6, 0xf6, 0xc3, 0x7a, 0x9c, 0x56, 0x02, 0xdc, 0x1e, 0xda, 0xfb, 0x9e, 0x17, 
+       0xa0, 0x07, 0xef, 0xd9, 0x0a, 0xb7, 0x3e, 0x2f, 0x3e, 0xaf, 0xa1, 0x85, 0x62, 0x42, 0x8c, 0x00, 
+       0x3e, 0x79, 0x70, 0x9e, 0xea, 0x08, 0xe6, 0x53, 0xc3, 0x7b, 0xa5, 0x9d, 0x73, 0x0a, 0x11, 0x21, 
+       0x84, 0x4d, 0x2a, 0x01, 0xbd, 0x9b, 0xd2, 0xa6, 0xfa, 0x39, 0xa4, 0xd8, 0xbb, 0x34, 0x5a, 0xe2, 
+       0x2e, 0xce, 0x84, 0xfb, 0x56, 0x1e, 0x46, 0xeb, 0xca, 0xc8, 0x8b, 0x8a, 0xb3, 0x55, 0x91, 0x2b, 
+       0xd5, 0x59, 0x23, 0x0e, 0x45, 0x5d, 0x52, 0x04, 0xd5, 0xa9, 0xa5, 0xe9, 0x3d, 0xa0, 0xdc, 0x37, 
+       0x5a, 0x32, 0x8d, 0xa5, 0x76, 0x60, 0xcc, 0xff, 0xdd, 0x03, 0xec, 0x67, 0x35, 0x6f, 0x94, 0x21, 
+       0x7c, 0x0d, 0x30, 0x99, 0xe6, 0x30, 0x95, 0x92, 0xb1, 0xb9, 0x3b, 0x6d, 0x64, 0x51, 0x70, 0xbd, 
+       0x2e, 0xfc, 0xa6, 0x4a, 0x9c, 0xbc, 0x30, 0x75, 0xdd, 0xb2, 0x07, 0x82, 0xb5, 0xe9, 0xbc, 0x1e, 
+       0x61, 0x35, 0x79, 0x85, 0xe1, 0x9c, 0xea, 0xe6, 0xee, 0x65, 0x6d, 0xb9, 0x50, 0x4c, 0x17, 0xa2, 
+       0x94, 0x3b, 0xe1, 0xe3, 0x3c, 0x4d, 0x1d, 0x8b, 0x4d, 0xe1, 0x8e, 0x14, 0x78, 0x51, 0xa8, 0x98, 
+       0x89, 0x76, 0xef, 0xc8, 0x5c, 0xc4, 0x33, 0x41, 0x88, 0xf7, 0x7a, 0x60, 0x03, 0xa1, 0xfb, 0x72, 
+       0xa4, 0xc8, 0xff, 0xba, 0x53, 0xa0, 0x29, 0x21, 0xe9, 0x5a, 0x3c, 0x2e, 0x92, 0x17, 0x28, 0xed, 
+       0xf0, 0x56, 0x3b, 0x37, 0x1d, 0x10, 0x6d, 0x41, 0x9c, 0x3c, 0x90, 0x85, 0xca, 0xbb, 0x11, 0x97, 
+       0x2e, 0x73, 0x52, 0x4a, 0xc7, 0x1e, 0xc0, 0xa4, 0x40, 0xae, 0x07, 0xd8, 0x6b, 0x64, 0x1d, 0x6d, 
+       0xc8, 0xb6, 0xd9, 0xed, 0xe6, 0xaf, 0xeb, 0xd7, 0x5e, 0xc8, 0x2f, 0x4a, 0x5c, 0xcb, 0x52, 0x75, 
+       0x4e, 0x33, 0x2e, 0x3d, 0x88, 0x47, 0x1b, 0x4e, 0x03, 0xb6, 0x26, 0xeb, 0xa5, 0x42, 0x86, 0xf7, 
+       0x1d, 0xa1, 0xe9, 0xd5, 0xae, 0xbb, 0x73, 0x8f, 0xe0, 0x01, 0xe5, 0x46, 0x09, 0xdc, 0x2d, 0xfc, 
+       0x83, 0x12, 0x3f, 0x06, 0xcb, 0x06, 0x25, 0x32, 0xbd, 0x4e, 0xd6, 0x76, 0x80, 0x4f, 0x56, 0x97, 
+       0xb5, 0x1d, 0xef, 0x3c, 0x3d, 0x20, 0xa4, 0x5c, 0xd9, 0x48, 0xf5, 0x51, 0xf9, 0x43, 0x6a, 0x37, 
+       0xa7, 0x8c, 0x30, 0x98, 0x4f, 0x92, 0x32, 0x8b, 0x62, 0x59, 0xd0, 0x4d, 0x4c, 0x3a, 0x89, 0xd4, 
+       0x45, 0xc8, 0xfb, 0x64, 0xd6, 0xab, 0x35, 0xc0, 0xe8, 0x90, 0xf5, 0x16, 0xd2, 0x2e, 0x00, 0x99, 
+       0xae, 0x65, 0x66, 0x2b, 0x6e, 0x1a, 0x4b, 0xdc, 0x31, 0x8a, 0x19, 0xba, 0x8e, 0x7e, 0x50, 0x68, 
+       0x68, 0x69, 0x83, 0x15, 0x08, 0xd5, 0x35, 0x8a, 0xf5, 0x8a, 0x03, 0x44, 0xac, 0x75, 0xa8, 0xcc, 
+       0x50, 0x8a, 0xbf, 0x3b, 0xcc, 0xde, 0xc8, 0xf1, 0x91, 0xa1, 0x26, 0xf1, 0xb9, 0x14, 0xaf, 0xcc, 
+       0x1e, 0x50, 0xac, 0x5d, 0x39, 0xd0, 0x94, 0xd0, 0xd0, 0xb9, 0x7b, 0x48, 0x1b, 0xb2, 0x5b, 0x4e, 
+       0x66, 0x0f, 0x64, 0xa1, 0xaf, 0xb6, 0xad, 0xaf, 0x59, 0x9e, 0x53, 0x07, 0x4e, 0x5a, 0xd2, 0x38, 
+       0x35, 0x77, 0x35, 0x8e, 0xe9, 0x1d, 0x66, 0xbf, 0x2f, 0x8a, 0xb3, 0x10, 0x1b, 0x1e, 0x24, 0x57, 
+       0x65, 0xc8, 0x7d, 0x39, 0xbb, 0xa0, 0x88, 0x90, 0xfe, 0xab, 0xf9, 0x2a, 0xf4, 0x18, 0x07, 0xf6, 
+       0xf7, 0x87, 0x3e, 0xbc, 0x0c, 0xe5, 0xee, 0xcf, 0x0d, 0x9b, 0x5f, 0x6c, 0x62, 0xeb, 0x7e, 0x75, 
+       0xdb, 0xe6, 0xaf, 0x06, 0x19, 0x16, 0x0d, 0xc3, 0x47, 0x8a, 0x09, 0x2b, 0x53, 0x74, 0xb0, 0x13, 
+       0x1f, 0x4a, 0xa5, 0x09, 0xff, 0x29, 0x90, 0xef, 0x7b, 0x09, 0xef, 0x5e, 0x4a, 0xa0, 0x4a, 0xfb, 
+       0xff, 0x42, 0xc4, 0x78, 0xe8, 0x74, 0xa9, 0xc6, 0x4c, 0x93, 0xbb, 0x34, 0xe9, 0x31, 0x0d, 0x8d, 
+       0xbd, 0x34, 0x1c, 0x3f, 0x41, 0xe1, 0x01, 0x21, 0xb6, 0x66, 0x66, 0xcf, 0xef, 0xe7, 0xff, 0xb2, 
+       0x21, 0x40, 0xe9, 0x3a, 0xfa, 0x5e, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 
+       0x42, 0x60, 0x82
+};
+
+#endif
index 25eeaf2f8a38788422931b0d9d14b4d3e9606f2d..0c580defded3c95b8ff8836fbdf562c98ebd9792 100644 (file)
@@ -18,7 +18,6 @@ public:
 template<class TYPE>
 class List {
        TYPE *split(int (*cmpr)(TYPE *a, TYPE *b),TYPE *l, TYPE *r);
 template<class TYPE>
 class List {
        TYPE *split(int (*cmpr)(TYPE *a, TYPE *b),TYPE *l, TYPE *r);
-       void sort(int (*cmpr)(TYPE *a, TYPE *b),TYPE *ll, TYPE *rr);
        static int cmpr(TYPE *a, TYPE *b) {
                if( *a == *b ) return 0;
                return *a > *b ? 1 : -1;
        static int cmpr(TYPE *a, TYPE *b) {
                if( *a == *b ) return 0;
                return *a > *b ? 1 : -1;
@@ -44,8 +43,8 @@ public:
                return p ? i : -1;
        }
        void swap(TYPE *item1, TYPE *item2);
                return p ? i : -1;
        }
        void swap(TYPE *item1, TYPE *item2);
-       void sort(int (*cmp)(TYPE *a, TYPE *b) = 0) {
-               return sort(cmp ? cmp : cmpr,0,0); }
+       void sort(TYPE *ap=0, TYPE *bp=0) { return sort(cmpr,ap,bp); }
+       void sort(int (*cmp)(TYPE *a, TYPE *b), TYPE *ap=0, TYPE *bp=0);
        List() { first = last = 0; }
        virtual ~List() { while(last) delete last; }
 };
        List() { first = last = 0; }
        virtual ~List() { while(last) delete last; }
 };
index 9a0e51a6b59a1a8be08d7348385b940a7c2e690d..222bc738475e19cd6a564babbb94d5853f32fa37 100644 (file)
@@ -6,15 +6,25 @@ Email cinelerra@lists.cinelerra-cv.org 4 help.
 For usage help, refer to the following:
   https://cinelerra-cv.org/docs/cinelerra_cv_manual_en.html
   https://cinelerra-cv.org/five/Features5.pdf
 For usage help, refer to the following:
   https://cinelerra-cv.org/docs/cinelerra_cv_manual_en.html
   https://cinelerra-cv.org/five/Features5.pdf
-  http://beccatoria.dreamwidth.org/144288.html#cutid2
   http://g-raffa.eu/Cinelerra/HOWTO/basics.html
   http://g-raffa.eu/Cinelerra/HOWTO/basics.html
-Cinfinity icons selected in Preferences (Creative Common
-  By https://creativecommons.org/licenses/by/3.0/)
+Cinfinity icons selected in Preferences Sam (CC BY 3.0,
+  https://creativecommons.org/licenses/by/3.0/)
+Neophyte theme selected in Preferences by Olaf Wolff (CC BY 4.0,
+  https://creativecommons.org/licenses/by/4.0/)
+.
+Oct 2018 New features of note:
+  Title plugin has unlimited number of characters allowed.
+  Histogram Bezier bug fixes and some improvements applied.
+  Trim Feature enhancement with drag handle and split look.
+  Additional ffmpeg plugins available (FF icon for now).
+  Dynamic keyframes implemented so can use large numbers.
+  Color correction+others highlighted with expand subtrees.
+  Autos, like fade, allow for textbox input & tooltip values.
 .
 Sept 2018 New Features of note:
   Motion plugins now have more visible stippled lines.
   New Export Project option; h26x_mp3 audio format available,
 .
 Sept 2018 New Features of note:
   Motion plugins now have more visible stippled lines.
   New Export Project option; h26x_mp3 audio format available,
-  Overlays Winow toggle on/off XYZ for Camera/Projector. 
+  Overlays Winow toggle on/off XYZ for Camera/Projector.
   Patchbay Expander icon moved up to allow for better usage.
 .
 July/Aug 2018 New Features of note:
   Patchbay Expander icon moved up to allow for better usage.
 .
 July/Aug 2018 New Features of note:
index 1f786f957d287155156f4e26ca15037807846bfc..2ad9c17dfa66e239a467047948e0bf9f1352a08a 100644 (file)
@@ -49,10 +49,8 @@ REGISTER_PLUGIN(HistogramMain)
 HistogramMain::HistogramMain(PluginServer *server)
  : PluginVClient(server)
 {
 HistogramMain::HistogramMain(PluginServer *server)
  : PluginVClient(server)
 {
-
        engine = 0;
        engine = 0;
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
                lookup[i] = 0;
                smoothed[i] = 0;
                linear[i] = 0;
                lookup[i] = 0;
                smoothed[i] = 0;
                linear[i] = 0;
@@ -63,19 +61,24 @@ HistogramMain::HistogramMain(PluginServer *server)
        dragging_point = 0;
        input = 0;
        output = 0;
        dragging_point = 0;
        input = 0;
        output = 0;
+       slots = 0;
 }
 
 HistogramMain::~HistogramMain()
 {
 }
 
 HistogramMain::~HistogramMain()
 {
+       reset();
+}
 
 
-       for(int i = 0; i < HISTOGRAM_MODES;i++)
-       {
-               delete [] lookup[i];
-               delete [] smoothed[i];
-               delete [] linear[i];
-               delete [] accum[i];
+void HistogramMain::reset()
+{
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
+               delete [] lookup[i];    lookup[i] = 0;
+               delete [] smoothed[i];  smoothed[i] = 0;
+               delete [] linear[i];    linear[i] = 0;
+               delete [] accum[i];     accum[i] = 0;
        }
        }
-       delete engine;
+       delete engine;  engine = 0;
+       slots = 0;
 }
 
 const char* HistogramMain::plugin_title() { return N_("Histogram Bezier"); }
 }
 
 const char* HistogramMain::plugin_title() { return N_("Histogram Bezier"); }
@@ -89,12 +92,10 @@ void HistogramMain::render_gui(void *data)
 {
        if(thread)
        {
 {
        if(thread)
        {
-               calculate_histogram((VFrame*)data);
-
-               if(config.automatic)
-               {
-                       calculate_automatic((VFrame*)data);
-               }
+               VFrame *input = (VFrame *)data;
+               calculate_histogram(input);
+               if( config.automatic )
+                       calculate_automatic(input);
 
                HistogramWindow *window = (HistogramWindow *)thread->window;
                window->lock_window("HistogramMain::render_gui");
 
                HistogramWindow *window = (HistogramWindow *)thread->window;
                window->lock_window("HistogramMain::render_gui");
@@ -133,8 +134,7 @@ void HistogramMain::save_data(KeyFrame *keyframe)
        char string[BCTEXTLEN];
 
 
        char string[BCTEXTLEN];
 
 
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
                sprintf(string, "OUTPUT_MIN_%d", i);
                output.tag.set_property(string, config.output_min[i]);
                sprintf(string, "OUTPUT_MAX_%d", i);
                sprintf(string, "OUTPUT_MIN_%d", i);
                output.tag.set_property(string, config.output_min[i]);
                sprintf(string, "OUTPUT_MAX_%d", i);
@@ -155,16 +155,14 @@ void HistogramMain::save_data(KeyFrame *keyframe)
 
 
 
 
 
 
-       for(int j = 0; j < HISTOGRAM_MODES; j++)
-       {
+       for( int j=0; j<HISTOGRAM_MODES; ++j ) {
                output.tag.set_title("POINTS");
                output.append_tag();
                output.append_newline();
 
 
                HistogramPoint *current = config.points[j].first;
                output.tag.set_title("POINTS");
                output.append_tag();
                output.append_newline();
 
 
                HistogramPoint *current = config.points[j].first;
-               while(current)
-               {
+               while( current ) {
                        output.tag.set_title("POINT");
                        output.tag.set_property("X", current->x);
                        output.tag.set_property("Y", current->y);
                        output.tag.set_title("POINT");
                        output.tag.set_property("X", current->x);
                        output.tag.set_property("Y", current->y);
@@ -202,63 +200,41 @@ void HistogramMain::read_data(KeyFrame *keyframe)
        int current_input_mode = 0;
 
 
        int current_input_mode = 0;
 
 
-       while(!result)
-       {
-               result = input.read_tag();
-
-               if(!result)
-               {
-                       if(input.tag.title_is("HISTOGRAM"))
-                       {
-                               char string[BCTEXTLEN];
-                               for(int i = 0; i < HISTOGRAM_MODES; i++)
-                               {
-                                       sprintf(string, "OUTPUT_MIN_%d", i);
-                                       config.output_min[i] = input.tag.get_property(string, config.output_min[i]);
-                                       sprintf(string, "OUTPUT_MAX_%d", i);
-                                       config.output_max[i] = input.tag.get_property(string, config.output_max[i]);
+       while( !(result = input.read_tag()) ) {
+               if( input.tag.title_is("HISTOGRAM") ) {
+                       char string[BCTEXTLEN];
+                       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
+                               sprintf(string, "OUTPUT_MIN_%d", i);
+                               config.output_min[i] = input.tag.get_property(string, config.output_min[i]);
+                               sprintf(string, "OUTPUT_MAX_%d", i);
+                               config.output_max[i] = input.tag.get_property(string, config.output_max[i]);
 //printf("HistogramMain::read_data %d %f %d\n", config.input_min[i], config.input_mid[i], config.input_max[i]);
 //printf("HistogramMain::read_data %d %f %d\n", config.input_min[i], config.input_mid[i], config.input_max[i]);
-                               }
-                               config.automatic = input.tag.get_property("AUTOMATIC", config.automatic);
-                               config.threshold = input.tag.get_property("THRESHOLD", config.threshold);
-                               config.split = input.tag.get_property("SPLIT", config.split);
-                               config.smoothMode = input.tag.get_property("INTERPOLATION", config.smoothMode);
                        }
                        }
-                       else
-                       if(input.tag.title_is("POINTS"))
-                       {
-                               if(current_input_mode < HISTOGRAM_MODES)
-                               {
-                                       HistogramPoints *points = &config.points[current_input_mode];
-                                       while(points->last)
-                                               delete points->last;
-                                       while(!result)
-                                       {
-                                               result = input.read_tag();
-                                               if(!result)
-                                               {
-                                                       if(input.tag.title_is("/POINTS"))
-                                                       {
-                                                               break;
-                                                       }
-                                                       else
-                                                       if(input.tag.title_is("POINT"))
-                                                       {
-                                                               points->insert(
-                                                                       input.tag.get_property("X", 0.0),
-                                                                       input.tag.get_property("Y", 0.0));
-                                                               points->last->gradient =
-                                                                       input.tag.get_property("GRADIENT", 1.0);
-                                                               points->last->xoffset_left =
-                                                                       input.tag.get_property("XOFFSET_LEFT", -0.02);
-                                                               points->last->xoffset_right =
-                                                                       input.tag.get_property("XOFFSET_RIGHT", 0.02);
-                                                       }
-                                               }
+                       config.automatic = input.tag.get_property("AUTOMATIC", config.automatic);
+                       config.threshold = input.tag.get_property("THRESHOLD", config.threshold);
+                       config.split = input.tag.get_property("SPLIT", config.split);
+                       config.smoothMode = input.tag.get_property("INTERPOLATION", config.smoothMode);
+               }
+               else if( input.tag.title_is("POINTS") ) {
+                       if( current_input_mode < HISTOGRAM_MODES ) {
+                               HistogramPoints *points = &config.points[current_input_mode];
+                               while( points->last )
+                                       delete points->last;
+                               while( !(result = input.read_tag()) ) {
+                                       if( input.tag.title_is("/POINTS") ) break;
+                                       if(input.tag.title_is("POINT") ) {
+                                               points->insert(
+                                                       input.tag.get_property("X", 0.0),
+                                                       input.tag.get_property("Y", 0.0));
+                                               points->last->gradient =
+                                                       input.tag.get_property("GRADIENT", 1.0);
+                                               points->last->xoffset_left =
+                                                       input.tag.get_property("XOFFSET_LEFT", -0.02);
+                                               points->last->xoffset_right =
+                                                       input.tag.get_property("XOFFSET_RIGHT", 0.02);
                                        }
                                        }
-
                                }
                                }
-                               current_input_mode++;
+                               ++current_input_mode;
                        }
                }
        }
                        }
                }
        }
@@ -297,8 +273,8 @@ float HistogramMain::calculate_linear(float input,
                HistogramPoints *points = &config.points[subscript];
                HistogramPoint *current = points->first;
                int done = 0;
                HistogramPoints *points = &config.points[subscript];
                HistogramPoint *current = points->first;
                int done = 0;
-               while(current && !done) {
-                       if(current->x > input) {
+               while( current && !done ) {
+                       if( current->x > input ) {
                                x2 = current->x;
                                y2 = current->y;
                                grad2 = current->gradient;
                                x2 = current->x;
                                y2 = current->y;
                                grad2 = current->gradient;
@@ -311,8 +287,8 @@ float HistogramMain::calculate_linear(float input,
 
                current = points->last;
                done = 0;
 
                current = points->last;
                done = 0;
-               while(current && !done) {
-                       if(current->x <= input) {
+               while( current && !done ) {
+                       if( current->x <= input ) {
                                x1 = current->x;
                                y1 = current->y;
                                grad1 = current->gradient;
                                x1 = current->x;
                                y1 = current->y;
                                grad1 = current->gradient;
@@ -323,24 +299,18 @@ float HistogramMain::calculate_linear(float input,
                                current = PREVIOUS;
                }
 
                                current = PREVIOUS;
                }
 
-
-
-
-               if(!EQUIV(x2 - x1, 0))
-               {
-                 if (config.smoothMode == HISTOGRAM_LINEAR)
+               if( !EQUIV(x2 - x1, 0) ) {
+                 if( config.smoothMode == HISTOGRAM_LINEAR )
                        output = (input - x1) * (y2 - y1) / (x2 - x1) + y1;
                        output = (input - x1) * (y2 - y1) / (x2 - x1) + y1;
-                 else if (config.smoothMode == HISTOGRAM_POLYNOMINAL)
-                 {
+                 else if( config.smoothMode == HISTOGRAM_POLYNOMINAL ) {
                        /* Construct third grade polynom between every two points */
                        float dx = x2 - x1;
                        float dy = y2 - y1;
                        float delx = input - x1;
                        output = (grad2 * dx + grad1 * dx - 2*dy) / (dx * dx * dx) * delx * delx * delx +
                        /* Construct third grade polynom between every two points */
                        float dx = x2 - x1;
                        float dy = y2 - y1;
                        float delx = input - x1;
                        output = (grad2 * dx + grad1 * dx - 2*dy) / (dx * dx * dx) * delx * delx * delx +
-                        (3*dy - 2* grad1*dx - grad2*dx) / (dx * dx) * delx * delx + grad1*delx + y1;
+                               (3*dy - 2* grad1*dx - grad2*dx) / (dx * dx) * delx * delx + grad1*delx + y1;
                  }
                  }
-                 else if (config.smoothMode == HISTOGRAM_BEZIER)
-                 {
+                 else if( config.smoothMode == HISTOGRAM_BEZIER ) {
                        /* Using standart DeCasteljau algorithm */
                        float y1right = y1 + grad1 * x1right;
                        float y2left = y2 + grad2 * x2left;
                        /* Using standart DeCasteljau algorithm */
                        float y1right = y1 + grad1 * x1right;
                        float y2left = y2 + grad2 * x2left;
@@ -361,7 +331,7 @@ float HistogramMain::calculate_linear(float input,
        }
 
 // Apply value curve
        }
 
 // Apply value curve
-       if(use_value) {
+       if( use_value ) {
                output = calculate_linear(output, HISTOGRAM_VALUE, 0);
        }
 
                output = calculate_linear(output, HISTOGRAM_VALUE, 0);
        }
 
@@ -376,12 +346,14 @@ float HistogramMain::calculate_linear(float input,
 
 float HistogramMain::calculate_smooth(float input, int subscript)
 {
 
 float HistogramMain::calculate_smooth(float input, int subscript)
 {
-       float x_f = (input - HIST_MIN_INPUT) * HISTOGRAM_SLOTS / FLOAT_RANGE;
+       int bins = slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
+       int bins1 = bins-1;
+       float x_f = (input - HIST_MIN_INPUT) * bins / FLOAT_RANGE;
        int x_i1 = (int)x_f;
        int x_i2 = x_i1 + 1;
        int x_i1 = (int)x_f;
        int x_i2 = x_i1 + 1;
-       CLAMP(x_i1, 0, HISTOGRAM_SLOTS-1);
-       CLAMP(x_i2, 0, HISTOGRAM_SLOTS-1);
-       CLAMP(x_f, 0, HISTOGRAM_SLOTS-1);
+       CLAMP(x_i1, 0, bins1);
+       CLAMP(x_i2, 0, bins1);
+       CLAMP(x_f, 0, bins1);
 
        float smooth1 = smoothed[subscript][x_i1];
        float smooth2 = smoothed[subscript][x_i2];
 
        float smooth1 = smoothed[subscript][x_i1];
        float smooth2 = smoothed[subscript][x_i2];
@@ -393,39 +365,47 @@ float HistogramMain::calculate_smooth(float input, int subscript)
 
 void HistogramMain::calculate_histogram(VFrame *data)
 {
 
 void HistogramMain::calculate_histogram(VFrame *data)
 {
+       int color_model = data->get_color_model();
+       int pix_sz = BC_CModels::calculate_pixelsize(color_model);
+       int comp_sz = pix_sz / BC_CModels::components(color_model);
+       int needed_slots = comp_sz > 1 ? 0x10000 : 0x100;
+       if( slots != needed_slots ) {
+               reset();
+               slots = needed_slots;
+       }
+       int bins = slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
+       if( !accum[0] ) {
+               for( int i=0; i<HISTOGRAM_MODES; ++i )
+                       accum[i] = new int[bins];
+       }
 
 
-       if(!engine) engine = new HistogramEngine(this,
-               get_project_smp() + 1,
-               get_project_smp() + 1);
-
-       if(!accum[0])
-       {
-               for(int i = 0; i < HISTOGRAM_MODES; i++)
-                       accum[i] = new int[HISTOGRAM_SLOTS];
+       if( !engine ) {
+               int cpus = data->get_w() * data->get_h() * pix_sz / 0x80000 + 2;
+               int smps = get_project_smp();
+               if( cpus > smps ) cpus = smps;
+               engine = new HistogramEngine(this, cpus, cpus);
        }
        engine->process_packages(HistogramEngine::HISTOGRAM, data);
 
        }
        engine->process_packages(HistogramEngine::HISTOGRAM, data);
 
-       for(int i = 0; i < engine->get_total_clients(); i++) {
+       for( int i=0; i<engine->get_total_clients(); ++i ) {
                HistogramUnit *unit = (HistogramUnit*)engine->get_client(i);
                HistogramUnit *unit = (HistogramUnit*)engine->get_client(i);
-               if(i == 0) {
-                       for(int j = 0; j < HISTOGRAM_MODES; j++)
-                               memcpy(accum[j], unit->accum[j], sizeof(int) * HISTOGRAM_SLOTS);
+               if( i == 0 ) {
+                       for( int j=0; j<HISTOGRAM_MODES; ++j )
+                               memcpy(accum[j], unit->accum[j], sizeof(int)*bins);
                }
                else {
                }
                else {
-                       for(int j = 0; j < HISTOGRAM_MODES; j++) {
-                               int *out = accum[j];
-                               int *in = unit->accum[j];
-                               for(int k = 0; k < HISTOGRAM_SLOTS; k++)
-                                       out[k] += in[k];
+                       for( int j=0; j<HISTOGRAM_MODES; ++j ) {
+                               int *out = accum[j], *in = unit->accum[j];
+                               for( int k=0; k<bins; ++k ) out[k] += in[k];
                        }
                }
        }
 
 // Remove top and bottom from calculations.  Doesn't work in high
 // precision colormodels.
                        }
                }
        }
 
 // Remove top and bottom from calculations.  Doesn't work in high
 // precision colormodels.
-       for(int i = 0; i < HISTOGRAM_MODES; i++) {
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
                accum[i][0] = 0;
                accum[i][0] = 0;
-               accum[i][HISTOGRAM_SLOTS - 1] = 0;
+               accum[i][bins-1] = 0;
        }
 }
 
        }
 }
 
@@ -434,9 +414,10 @@ void HistogramMain::calculate_automatic(VFrame *data)
 {
        calculate_histogram(data);
        config.reset_points();
 {
        calculate_histogram(data);
        config.reset_points();
+       int bins = slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
 
 // Do each channel
 
 // Do each channel
-       for(int i = 0; i < 3; i++) {
+       for( int i=0; i<3; ++i ) {
                int *accum = this->accum[i];
                int pixels = data->get_w() * data->get_h();
                float white_fraction = 1.0 - (1.0 - config.threshold) / 2;
                int *accum = this->accum[i];
                int pixels = data->get_w() * data->get_h();
                float white_fraction = 1.0 - (1.0 - config.threshold) / 2;
@@ -444,22 +425,21 @@ void HistogramMain::calculate_automatic(VFrame *data)
                int total = 0;
                float max_level = 1.0;
                float min_level = 0.0;
                int total = 0;
                float max_level = 1.0;
                float min_level = 0.0;
-
 // Get histogram slot above threshold of pixels
 // Get histogram slot above threshold of pixels
-               for(int j = 0; j < HISTOGRAM_SLOTS; j++) {
+               for( int j=0; j<bins; ++j ) {
                        total += accum[j];
                        total += accum[j];
-                       if(total >= threshold) {
-                               max_level = (float)j / HISTOGRAM_SLOTS * FLOAT_RANGE + HIST_MIN_INPUT;
+                       if( total >= threshold ) {
+                               max_level = (float)j/bins * FLOAT_RANGE + HIST_MIN_INPUT;
                                break;
                        }
                }
 
 // Get slot below 99% of pixels
                total = 0;
                                break;
                        }
                }
 
 // Get slot below 99% of pixels
                total = 0;
-               for(int j = HISTOGRAM_SLOTS - 1; j >= 0; j--) {
+               for( int j=bins; --j>=0; ) {
                        total += accum[j];
                        total += accum[j];
-                       if(total >= threshold) {
-                               min_level = (float)j / HISTOGRAM_SLOTS * FLOAT_RANGE + HIST_MIN_INPUT;
+                       if( total >= threshold ) {
+                               min_level = (float)j/bins * FLOAT_RANGE + HIST_MIN_INPUT;
                                break;
                        }
                }
                                break;
                        }
                }
@@ -470,21 +450,24 @@ void HistogramMain::calculate_automatic(VFrame *data)
 
 int HistogramMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
 {
 
 int HistogramMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
 {
-SET_TRACE
-       int need_reconfigure = load_configuration();
-SET_TRACE
-
-       if(!engine) engine = new HistogramEngine(this,
-               get_project_smp() + 1,
-               get_project_smp() + 1);
        this->input = input_ptr;
        this->output = output_ptr;
 
        this->input = input_ptr;
        this->output = output_ptr;
 
-       send_render_gui(input_ptr);
+       int need_reconfigure = load_configuration();
+       int color_model = input->get_color_model();
+       int pix_sz = BC_CModels::calculate_pixelsize(color_model);
+       int comp_sz = pix_sz / BC_CModels::components(color_model);
+       int needed_slots = comp_sz > 1 ? 0x10000 : 0x100;
+       if( slots != needed_slots ) {
+               reset();
+               slots = needed_slots;
+               need_reconfigure = 1;
+       }
+
+       send_render_gui(input);
 
 
-       if(input_ptr->get_rows()[0] != output_ptr->get_rows()[0])
-       {
-               output_ptr->copy_from(input_ptr);
+       if( input->get_rows()[0] != output_ptr->get_rows()[0] ) {
+               output_ptr->copy_from(input);
        }
 
 SET_TRACE
        }
 
 SET_TRACE
@@ -496,17 +479,23 @@ SET_TRACE
        if( need_reconfigure ) {
 SET_TRACE
 // Calculate new curves
        if( need_reconfigure ) {
 SET_TRACE
 // Calculate new curves
-               if(config.automatic) {
+               if( config.automatic ) {
                        calculate_automatic(input);
                }
 SET_TRACE
 
 // Generate transfer tables for integer colormodels.
                        calculate_automatic(input);
                }
 SET_TRACE
 
 // Generate transfer tables for integer colormodels.
-               for(int i = 0; i < 3; i++)
+               for( int i=0; i<3; ++i )
                        tabulate_curve(i, 1);
 SET_TRACE
        }
 
                        tabulate_curve(i, 1);
 SET_TRACE
        }
 
+       if( !engine ) {
+               int cpus = input->get_w() * input->get_h() * pix_sz / 0x80000 + 2;
+               int smps = get_project_smp();
+               if( cpus > smps ) cpus = smps;
+               engine = new HistogramEngine(this, cpus, cpus);
+       }
 // Apply histogram
        engine->process_packages(HistogramEngine::APPLY, input);
 
 // Apply histogram
        engine->process_packages(HistogramEngine::APPLY, input);
 
@@ -516,48 +505,36 @@ SET_TRACE
 
 void HistogramMain::tabulate_curve(int subscript, int use_value)
 {
 
 void HistogramMain::tabulate_curve(int subscript, int use_value)
 {
-       int i;
+       int bins = slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
        if(!lookup[subscript])
        if(!lookup[subscript])
-               lookup[subscript] = new int[HISTOGRAM_SLOTS];
+               lookup[subscript] = new int[bins];
        if(!smoothed[subscript])
        if(!smoothed[subscript])
-               smoothed[subscript] = new float[HISTOGRAM_SLOTS];
+               smoothed[subscript] = new float[bins];
        if(!linear[subscript])
        if(!linear[subscript])
-               linear[subscript] = new float[HISTOGRAM_SLOTS];
+               linear[subscript] = new float[bins];
 
        float *current_smooth = smoothed[subscript];
        float *current_linear = linear[subscript];
 
 // Make linear curve
 
        float *current_smooth = smoothed[subscript];
        float *current_linear = linear[subscript];
 
 // Make linear curve
-       for(i = 0; i < HISTOGRAM_SLOTS; i++) {
-               float input = (float)i / HISTOGRAM_SLOTS * FLOAT_RANGE + HIST_MIN_INPUT;
+       for( int i=0; i<bins; ++i ) {
+               float input = (float)i/bins * FLOAT_RANGE + HIST_MIN_INPUT;
                current_linear[i] = calculate_linear(input, subscript, use_value);
        }
 // Make smooth curve
        //float prev = 0.0;
                current_linear[i] = calculate_linear(input, subscript, use_value);
        }
 // Make smooth curve
        //float prev = 0.0;
-       for(i = 0; i < HISTOGRAM_SLOTS; i++)
-       {
+       for( int i=0; i<bins; ++i ) {
 //             current_smooth[i] = current_linear[i] * 0.001 +
 //                     prev * 0.999;
                current_smooth[i] = current_linear[i];
 //             prev = current_smooth[i];
        }
 // Generate lookup tables for integer colormodels
 //             current_smooth[i] = current_linear[i] * 0.001 +
 //                     prev * 0.999;
                current_smooth[i] = current_linear[i];
 //             prev = current_smooth[i];
        }
 // Generate lookup tables for integer colormodels
-       if(input)
-       {
-               switch(input->get_color_model())
-               {
-                       case BC_RGB888:
-                       case BC_RGBA8888:
-                               for(i = 0; i < 0x100; i++)
-                                       lookup[subscript][i] =
-                                               (int)(calculate_smooth((float)i / 0xff, subscript) * 0xff);
-                               break;
-// All other integer colormodels are converted to 16 bit RGB
-                       default:
-                               for(i = 0; i < 0x10000; i++)
-                                       lookup[subscript][i] =
-                                               (int)(calculate_smooth((float)i / 0xffff, subscript) * 0xffff);
-                               break;
+       if( input ) {
+               int slots1 = slots-1;
+               for( int i=0; i<slots; ++i ) {
+                       lookup[subscript][i] =
+                               (int)(calculate_smooth((float)i/slots1, subscript) * slots1);
                }
        }
 }
                }
        }
 }
@@ -573,47 +550,38 @@ HistogramUnit::HistogramUnit(HistogramEngine *server,
 {
        this->plugin = plugin;
        this->server = server;
 {
        this->plugin = plugin;
        this->server = server;
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-               accum[i] = new int[HISTOGRAM_SLOTS];
+       int bins = plugin->slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
+       for( int i=0; i<HISTOGRAM_MODES; ++i )
+               accum[i] = new int[bins];
 }
 
 HistogramUnit::~HistogramUnit()
 {
 }
 
 HistogramUnit::~HistogramUnit()
 {
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
+       for( int i=0; i<HISTOGRAM_MODES; ++i )
                delete [] accum[i];
 }
 
 void HistogramUnit::process_package(LoadPackage *package)
 {
        HistogramPackage *pkg = (HistogramPackage*)package;
                delete [] accum[i];
 }
 
 void HistogramUnit::process_package(LoadPackage *package)
 {
        HistogramPackage *pkg = (HistogramPackage*)package;
-
-       if(server->operation == HistogramEngine::HISTOGRAM)
-       {
+       int bins = plugin->slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
+       int bins1 = bins-1;
+       int slots1 = -HISTOGRAM_MIN * (plugin->slots-1) / 100;
+       if( server->operation == HistogramEngine::HISTOGRAM ) {
 
 #define HISTOGRAM_HEAD(type) \
 { \
 
 #define HISTOGRAM_HEAD(type) \
 { \
-       for(int i = pkg->start; i < pkg->end; i++) \
-       { \
+       for( int i=pkg->start; i<pkg->end; ++i ) { \
                type *row = (type*)data->get_rows()[i]; \
                type *row = (type*)data->get_rows()[i]; \
-               for(int j = 0; j < w; j++) \
-               {
+               for( int j=0; j<w; ++j ) {
 
 #define HISTOGRAM_TAIL(components) \
 
 #define HISTOGRAM_TAIL(components) \
-/*                     v = (r * 76 + g * 150 + b * 29) >> 8; */ \
-                       v = MAX(r, g); \
-                       v = MAX(v, b); \
-                       r += -HISTOGRAM_MIN * 0xffff / 100; \
-                       g += -HISTOGRAM_MIN * 0xffff / 100; \
-                       b += -HISTOGRAM_MIN * 0xffff / 100; \
-                       v += -HISTOGRAM_MIN * 0xffff / 100; \
-                       CLAMP(r, 0, HISTOGRAM_SLOTS-1); \
-                       CLAMP(g, 0, HISTOGRAM_SLOTS-1); \
-                       CLAMP(b, 0, HISTOGRAM_SLOTS-1); \
-                       CLAMP(v, 0, HISTOGRAM_SLOTS-1); \
-                       accum_r[r]++; \
-                       accum_g[g]++; \
-                       accum_b[b]++; \
-                       accum_v[v]++; \
+                       v = MAX(r, g); v = MAX(v, b); v += slots1; \
+                       r += slots1;  g += slots1;  b += slots1; \
+                       CLAMP(r, 0, bins1);  ++accum_r[r]; \
+                       CLAMP(g, 0, bins1);  ++accum_g[g]; \
+                       CLAMP(b, 0, bins1);  ++accum_b[b]; \
+                       CLAMP(v, 0, bins1);  ++accum_v[v]; \
                        row += components; \
                } \
        } \
                        row += components; \
                } \
        } \
@@ -628,99 +596,77 @@ void HistogramUnit::process_package(LoadPackage *package)
                int *accum_v = accum[HISTOGRAM_VALUE];
                int r, g, b, y, u, v;
 
                int *accum_v = accum[HISTOGRAM_VALUE];
                int r, g, b, y, u, v;
 
-               switch(data->get_color_model())
-               {
-                       case BC_RGB888:
-                               HISTOGRAM_HEAD(unsigned char)
-                               r = (row[0] << 8) | row[0];
-                               g = (row[1] << 8) | row[1];
-                               b = (row[2] << 8) | row[2];
-                               HISTOGRAM_TAIL(3)
-                               break;
-                       case BC_RGB_FLOAT:
-                               HISTOGRAM_HEAD(float)
-                               r = (int)(row[0] * 0xffff);
-                               g = (int)(row[1] * 0xffff);
-                               b = (int)(row[2] * 0xffff);
-                               HISTOGRAM_TAIL(3)
-                               break;
-                       case BC_YUV888:
-                               HISTOGRAM_HEAD(unsigned char)
-                               y = (row[0] << 8) | row[0];
-                               u = (row[1] << 8) | row[1];
-                               v = (row[2] << 8) | row[2];
-                               YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
-                               HISTOGRAM_TAIL(3)
-                               break;
-                       case BC_RGBA8888:
-                               HISTOGRAM_HEAD(unsigned char)
-                               r = (row[0] << 8) | row[0];
-                               g = (row[1] << 8) | row[1];
-                               b = (row[2] << 8) | row[2];
-                               HISTOGRAM_TAIL(4)
-                               break;
-                       case BC_RGBA_FLOAT:
-                               HISTOGRAM_HEAD(float)
-                               r = (int)(row[0] * 0xffff);
-                               g = (int)(row[1] * 0xffff);
-                               b = (int)(row[2] * 0xffff);
-                               HISTOGRAM_TAIL(4)
-                               break;
-                       case BC_YUVA8888:
-                               HISTOGRAM_HEAD(unsigned char)
-                               y = (row[0] << 8) | row[0];
-                               u = (row[1] << 8) | row[1];
-                               v = (row[2] << 8) | row[2];
-                               YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
-                               HISTOGRAM_TAIL(4)
-                               break;
-                       case BC_RGB161616:
-                               HISTOGRAM_HEAD(uint16_t)
-                               r = row[0];
-                               g = row[1];
-                               b = row[2];
-                               HISTOGRAM_TAIL(3)
-                               break;
-                       case BC_YUV161616:
-                               HISTOGRAM_HEAD(uint16_t)
-                               y = row[0];
-                               u = row[1];
-                               v = row[2];
-                               YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
-                               HISTOGRAM_TAIL(3)
-                               break;
-                       case BC_RGBA16161616:
-                               HISTOGRAM_HEAD(uint16_t)
-                               r = row[0];
-                               g = row[1];
-                               b = row[2];
-                               HISTOGRAM_TAIL(3)
-                               break;
-                       case BC_YUVA16161616:
-                               HISTOGRAM_HEAD(uint16_t)
-                               y = row[0];
-                               u = row[1];
-                               v = row[2];
-                               YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
-                               HISTOGRAM_TAIL(4)
-                               break;
+               switch( data->get_color_model() ) {
+               case BC_RGB888:
+                       HISTOGRAM_HEAD(unsigned char)
+                       r = row[0]; g = row[1]; b = row[2];
+                       HISTOGRAM_TAIL(3)
+                       break;
+               case BC_RGB_FLOAT:
+                       HISTOGRAM_HEAD(float)
+                       r = (int)(row[0] * 0xffff);
+                       g = (int)(row[1] * 0xffff);
+                       b = (int)(row[2] * 0xffff);
+                       HISTOGRAM_TAIL(3)
+                       break;
+               case BC_YUV888:
+                       HISTOGRAM_HEAD(unsigned char)
+                       y = row[0]; u = row[1]; v = row[2];
+                       YUV::yuv.yuv_to_rgb_8(r, g, b, y, u, v);
+                       HISTOGRAM_TAIL(3)
+                       break;
+               case BC_RGBA8888:
+                       HISTOGRAM_HEAD(unsigned char)
+                       r = row[0]; g = row[1]; b = row[2];
+                       HISTOGRAM_TAIL(4)
+                       break;
+               case BC_RGBA_FLOAT:
+                       HISTOGRAM_HEAD(float)
+                       r = (int)(row[0] * 0xffff);
+                       g = (int)(row[1] * 0xffff);
+                       b = (int)(row[2] * 0xffff);
+                       HISTOGRAM_TAIL(4)
+                       break;
+               case BC_YUVA8888:
+                       HISTOGRAM_HEAD(unsigned char)
+                       y = row[0]; u = row[1]; v = row[2];
+                       YUV::yuv.yuv_to_rgb_8(r, g, b, y, u, v);
+                       HISTOGRAM_TAIL(4)
+                       break;
+               case BC_RGB161616:
+                       HISTOGRAM_HEAD(uint16_t)
+                       r = row[0]; g = row[1]; b = row[2];
+                       HISTOGRAM_TAIL(3)
+                       break;
+               case BC_YUV161616:
+                       HISTOGRAM_HEAD(uint16_t)
+                       y = row[0]; u = row[1]; v = row[2];
+                       YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
+                       HISTOGRAM_TAIL(3)
+                       break;
+               case BC_RGBA16161616:
+                       HISTOGRAM_HEAD(uint16_t)
+                       r = row[0]; g = row[1]; b = row[2];
+                       HISTOGRAM_TAIL(3)
+                       break;
+               case BC_YUVA16161616:
+                       HISTOGRAM_HEAD(uint16_t)
+                       y = row[0]; u = row[1]; v = row[2];
+                       YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
+                       HISTOGRAM_TAIL(4)
+                       break;
                }
        }
        else
                }
        }
        else
-       if(server->operation == HistogramEngine::APPLY)
-       {
-
-
+       if( server->operation == HistogramEngine::APPLY ) {
 
 #define PROCESS(type, components) \
 { \
 
 #define PROCESS(type, components) \
 { \
-       for(int i = pkg->start; i < pkg->end; i++) \
-       { \
+       for( int i=pkg->start; i<pkg->end; ++i ) { \
                type *row = (type*)input->get_rows()[i]; \
                type *row = (type*)input->get_rows()[i]; \
-               for(int j = 0; j < w; j++) \
-               { \
+               for( int j=0; j<w; ++j ) { \
                        if ( plugin->config.split && ((j + i * w / h) < w) ) \
                        if ( plugin->config.split && ((j + i * w / h) < w) ) \
-                       continue; \
+                               continue; \
                        row[0] = lookup_r[row[0]]; \
                        row[1] = lookup_g[row[1]]; \
                        row[2] = lookup_b[row[2]]; \
                        row[0] = lookup_r[row[0]]; \
                        row[1] = lookup_g[row[1]]; \
                        row[2] = lookup_b[row[2]]; \
@@ -731,49 +677,22 @@ void HistogramUnit::process_package(LoadPackage *package)
 
 #define PROCESS_YUV(type, components, max) \
 { \
 
 #define PROCESS_YUV(type, components, max) \
 { \
-       for(int i = pkg->start; i < pkg->end; i++) \
-       { \
+       for( int i=pkg->start; i<pkg->end; ++i ) { \
                type *row = (type*)input->get_rows()[i]; \
                type *row = (type*)input->get_rows()[i]; \
-               for(int j = 0; j < w; j++) \
-               { \
+               for( int j=0; j<w; ++j ) { \
                        if ( plugin->config.split && ((j + i * w / h) < w) ) \
                        if ( plugin->config.split && ((j + i * w / h) < w) ) \
-                       continue; \
-/* Convert to 16 bit RGB */ \
-                       if(max == 0xff) \
-                       { \
-                               y = (row[0] << 8) | row[0]; \
-                               u = (row[1] << 8) | row[1]; \
-                               v = (row[2] << 8) | row[2]; \
-                       } \
+                               continue; \
+                       y = row[0]; u = row[1]; v = row[2]; \
+                       if( max == 0xff ) \
+                               YUV::yuv.yuv_to_rgb_8(r, g, b, y, u, v); \
                        else \
                        else \
-                       { \
-                               y = row[0]; \
-                               u = row[1]; \
-                               v = row[2]; \
-                       } \
- \
-                       YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); \
- \
-/* Look up in RGB domain */ \
-                       r = lookup_r[r]; \
-                       g = lookup_g[g]; \
-                       b = lookup_b[b]; \
- \
-/* Convert to 16 bit YUV */ \
-                       YUV::yuv.rgb_to_yuv_16(r, g, b, y, u, v); \
- \
-                       if(max == 0xff) \
-                       { \
-                               row[0] = y >> 8; \
-                               row[1] = u >> 8; \
-                               row[2] = v >> 8; \
-                       } \
+                               YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); \
+                       r = lookup_r[r]; g = lookup_g[g]; b = lookup_b[b]; \
+                       if( max == 0xff ) \
+                               YUV::yuv.rgb_to_yuv_8(r, g, b, y, u, v); \
                        else \
                        else \
-                       { \
-                               row[0] = y; \
-                               row[1] = u; \
-                               row[2] = v; \
-                       } \
+                               YUV::yuv.rgb_to_yuv_16(r, g, b, y, u, v); \
+                       row[0] = y; row[1] = u; row[2] = v; \
                        row += components; \
                } \
        } \
                        row += components; \
                } \
        } \
@@ -781,25 +700,16 @@ void HistogramUnit::process_package(LoadPackage *package)
 
 #define PROCESS_FLOAT(components) \
 { \
 
 #define PROCESS_FLOAT(components) \
 { \
-       for(int i = pkg->start; i < pkg->end; i++) \
-       { \
+       for( int i=pkg->start; i<pkg->end; ++i ) { \
                float *row = (float*)input->get_rows()[i]; \
                float *row = (float*)input->get_rows()[i]; \
-               for(int j = 0; j < w; j++) \
-               { \
+               for( int j=0; j<w; ++j ) { \
                        if ( plugin->config.split && ((j + i * w / h) < w) ) \
                        if ( plugin->config.split && ((j + i * w / h) < w) ) \
-                       continue; \
-                       float r = row[0]; \
-                       float g = row[1]; \
-                       float b = row[2]; \
- \
+                               continue; \
+                       float r = row[0], g = row[1], b = row[2]; \
                        r = plugin->calculate_smooth(r, HISTOGRAM_RED); \
                        g = plugin->calculate_smooth(g, HISTOGRAM_GREEN); \
                        b = plugin->calculate_smooth(b, HISTOGRAM_BLUE); \
                        r = plugin->calculate_smooth(r, HISTOGRAM_RED); \
                        g = plugin->calculate_smooth(g, HISTOGRAM_GREEN); \
                        b = plugin->calculate_smooth(b, HISTOGRAM_BLUE); \
- \
-                       row[0] = r; \
-                       row[1] = g; \
-                       row[2] = b; \
- \
+                       row[0] = r; row[1] = g; row[2] = b; \
                        row += components; \
                } \
        } \
                        row += components; \
                } \
        } \
@@ -813,50 +723,44 @@ void HistogramUnit::process_package(LoadPackage *package)
                int *lookup_g = plugin->lookup[1];
                int *lookup_b = plugin->lookup[2];
                int r, g, b, y, u, v;
                int *lookup_g = plugin->lookup[1];
                int *lookup_b = plugin->lookup[2];
                int r, g, b, y, u, v;
-               switch(input->get_color_model())
-               {
-                       case BC_RGB888:
-                               PROCESS(unsigned char, 3)
-                               break;
-                       case BC_RGB_FLOAT:
-                               PROCESS_FLOAT(3);
-                               break;
-                       case BC_RGBA8888:
-                               PROCESS(unsigned char, 4)
-                               break;
-                       case BC_RGBA_FLOAT:
-                               PROCESS_FLOAT(4);
-                               break;
-                       case BC_RGB161616:
-                               PROCESS(uint16_t, 3)
-                               break;
-                       case BC_RGBA16161616:
-                               PROCESS(uint16_t, 4)
-                               break;
-                       case BC_YUV888:
-                               PROCESS_YUV(unsigned char, 3, 0xff)
-                               break;
-                       case BC_YUVA8888:
-                               PROCESS_YUV(unsigned char, 4, 0xff)
-                               break;
-                       case BC_YUV161616:
-                               PROCESS_YUV(uint16_t, 3, 0xffff)
-                               break;
-                       case BC_YUVA16161616:
-                               PROCESS_YUV(uint16_t, 4, 0xffff)
-                               break;
+               switch( input->get_color_model() ) {
+               case BC_RGB888:
+                       PROCESS(unsigned char, 3)
+                       break;
+               case BC_RGB_FLOAT:
+                       PROCESS_FLOAT(3);
+                       break;
+               case BC_RGBA8888:
+                       PROCESS(unsigned char, 4)
+                       break;
+               case BC_RGBA_FLOAT:
+                       PROCESS_FLOAT(4);
+                       break;
+               case BC_RGB161616:
+                       PROCESS(uint16_t, 3)
+                       break;
+               case BC_RGBA16161616:
+                       PROCESS(uint16_t, 4)
+                       break;
+               case BC_YUV888:
+                       PROCESS_YUV(unsigned char, 3, 0xff)
+                       break;
+               case BC_YUVA8888:
+                       PROCESS_YUV(unsigned char, 4, 0xff)
+                       break;
+               case BC_YUV161616:
+                       PROCESS_YUV(uint16_t, 3, 0xffff)
+                       break;
+               case BC_YUVA16161616:
+                       PROCESS_YUV(uint16_t, 4, 0xffff)
+                       break;
                }
        }
 }
 
 
                }
        }
 }
 
 
-
-
-
-
 HistogramEngine::HistogramEngine(HistogramMain *plugin,
 HistogramEngine::HistogramEngine(HistogramMain *plugin,
-       int total_clients,
-       int total_packages)
+               int total_clients, int total_packages)
  : LoadServer(total_clients, total_packages)
 {
        this->plugin = plugin;
  : LoadServer(total_clients, total_packages)
 {
        this->plugin = plugin;
@@ -864,26 +768,19 @@ HistogramEngine::HistogramEngine(HistogramMain *plugin,
 
 void HistogramEngine::init_packages()
 {
 
 void HistogramEngine::init_packages()
 {
-       switch(operation) {
-               case HISTOGRAM:
-                       total_size = data->get_h();
-                       break;
-               case APPLY:
-                       total_size = data->get_h();
-                       break;
-       }
-
-       for(int i = 0; i < get_total_packages(); i++) {
+       total_size = data->get_h();
+       for( int i=0,start=0,n=get_total_packages(); i<n; ) {
                HistogramPackage *package = (HistogramPackage*)get_package(i);
                HistogramPackage *package = (HistogramPackage*)get_package(i);
-               package->start = total_size * i / get_total_packages();
-               package->end = total_size * (i + 1) / get_total_packages();
+               package->start = start;
+               package->end = start = (total_size * ++i)/ n;
        }
 
        }
 
+       int bins = plugin->slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
 // Initialize clients here in case some don't get run.
 // Initialize clients here in case some don't get run.
-       for(int i = 0; i < get_total_clients(); i++) {
+       for( int i=0; i<get_total_clients(); ++i ) {
                HistogramUnit *unit = (HistogramUnit*)get_client(i);
                HistogramUnit *unit = (HistogramUnit*)get_client(i);
-               for(int i = 0; i < HISTOGRAM_MODES; i++)
-                       bzero(unit->accum[i], sizeof(int) * HISTOGRAM_SLOTS);
+               for( int i=0; i<HISTOGRAM_MODES; ++i )
+                       bzero(unit->accum[i], sizeof(int)*bins);
        }
 
 }
        }
 
 }
index 2a3849d5a6b6671b0e867fd964e168e740a2d99a..ae933b06c7cf3a0b9691d17ffd7cb36be35eaaa5 100644 (file)
@@ -44,6 +44,7 @@ class HistogramMain : public PluginVClient
 public:
        HistogramMain(PluginServer *server);
        ~HistogramMain();
 public:
        HistogramMain(PluginServer *server);
        ~HistogramMain();
+       void reset();
 
        int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
        int is_realtime();
 
        int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
        int is_realtime();
@@ -78,6 +79,8 @@ public:
        int current_point;
 // Current channel being viewed
        int mode;
        int current_point;
 // Current channel being viewed
        int mode;
+// total histogram bins
+       int slots;
        int dragging_point;
        int point_x_offset;
        int point_y_offset;
        int dragging_point;
        int point_x_offset;
        int point_y_offset;
index d75b032a54e652d3b22f1b6e2b3ad74523b1a4e9..835772ae5acd4060abe0d56053139d31e221a141 100644 (file)
@@ -34,8 +34,7 @@
 #define HISTOGRAM_VALUE 3
 
 // Number of divisions in histogram.
 #define HISTOGRAM_VALUE 3
 
 // Number of divisions in histogram.
-// 65536 + min and max range to speed up the tabulation
-#define HISTOGRAM_SLOTS 0x13333
+// slots = (256 for 8bit or 65536) + min and max range to speed up the tabulation
 #define FLOAT_RANGE 1.2
 // Minimum value in percentage
 #define HISTOGRAM_MIN -10
 #define FLOAT_RANGE 1.2
 // Minimum value in percentage
 #define HISTOGRAM_MIN -10
index 88c4911d9fd2c13de66fcd3f78b493a940addf2f..368cce72260ce1a8c787849999387aab06413fcb 100644 (file)
 #include <math.h>
 
 
 #include <math.h>
 
 
-
-
 HistogramPoint::HistogramPoint()
  : ListItem<HistogramPoint>()
 {
 HistogramPoint::HistogramPoint()
  : ListItem<HistogramPoint>()
 {
+       x = 0;  y = 0;
+       xoffset_left = -0.05;
+       xoffset_right = 0.05;
+       gradient = 1.0;
+
 }
 
 HistogramPoint::~HistogramPoint()
 }
 
 HistogramPoint::~HistogramPoint()
@@ -39,15 +42,35 @@ HistogramPoint::~HistogramPoint()
 
 int HistogramPoint::equivalent(HistogramPoint *src)
 {
 
 int HistogramPoint::equivalent(HistogramPoint *src)
 {
-       return EQUIV(x, src->x) && EQUIV(y, src->y) && EQUIV(gradient, src->gradient);
+       return EQUIV(x, src->x) && EQUIV(y, src->y) &&
+               EQUIV(xoffset_left, src->xoffset_left) &&
+               EQUIV(xoffset_right, src->xoffset_right) &&
+               EQUIV(gradient, src->gradient);
 }
 
 }
 
+void HistogramPoint::copy_from(HistogramPoint *that)
+{
+       x = that->x;  y = that->y;
+       xoffset_left = that->xoffset_left;
+       xoffset_right = that->xoffset_right;
+       gradient = that->gradient;
 
 
+}
 
 
 HistogramPoints::HistogramPoints()
  : List<HistogramPoint>()
 {
 
 
 HistogramPoints::HistogramPoints()
  : List<HistogramPoint>()
 {
+       clear();
+}
+
+HistogramPoints::~HistogramPoints()
+{
+}
+
+void HistogramPoints::clear()
+{
+       while( last ) delete last;
        insert(0.0,0.0);
        first->gradient = 1.0;
        first->xoffset_left = 0.0;
        insert(0.0,0.0);
        first->gradient = 1.0;
        first->xoffset_left = 0.0;
@@ -56,11 +79,6 @@ HistogramPoints::HistogramPoints()
        last->gradient = 1.0;
        last->xoffset_left = -0.05;
        last->xoffset_right = 0.0;
        last->gradient = 1.0;
        last->xoffset_left = -0.05;
        last->xoffset_right = 0.0;
-
-}
-
-HistogramPoints::~HistogramPoints()
-{
 }
 
 HistogramPoint* HistogramPoints::insert(float x, float y)
 }
 
 HistogramPoint* HistogramPoints::insert(float x, float y)
@@ -68,40 +86,27 @@ HistogramPoint* HistogramPoints::insert(float x, float y)
        HistogramPoint *current = first;
 
 // Get existing point after new point
        HistogramPoint *current = first;
 
 // Get existing point after new point
-       while(current)
-       {
-               if(current->x > x)
-                       break;
-               else
-                       current = NEXT;
+       while( current ) {
+               if( current->x > x ) break;
+               current = NEXT;
        }
 
 // Insert new point before current point
        HistogramPoint *new_point = new HistogramPoint;
        }
 
 // Insert new point before current point
        HistogramPoint *new_point = new HistogramPoint;
-       if(current)
-       {
+       if( current )
                insert_before(current, new_point);
                insert_before(current, new_point);
-       }
        else
        else
-// Append new point to list
-       {
                append(new_point);
                append(new_point);
-       }
 
        new_point->x = x;
        new_point->y = y;
 
        new_point->x = x;
        new_point->y = y;
-       new_point->xoffset_left = -0.05;
-       new_point->xoffset_right = 0.05;
-
-
        return new_point;
 }
 
 void HistogramPoints::boundaries()
 {
        HistogramPoint *current = first;
        return new_point;
 }
 
 void HistogramPoints::boundaries()
 {
        HistogramPoint *current = first;
-       while(current)
-       {
+       while( current ) {
                CLAMP(current->x, 0.0, 1.0);
                CLAMP(current->y, 0.0, 1.0);
                current = NEXT;
                CLAMP(current->x, 0.0, 1.0);
                CLAMP(current->y, 0.0, 1.0);
                current = NEXT;
@@ -112,14 +117,13 @@ int HistogramPoints::equivalent(HistogramPoints *src)
 {
        HistogramPoint *current_this = first;
        HistogramPoint *current_src = src->first;
 {
        HistogramPoint *current_this = first;
        HistogramPoint *current_src = src->first;
-       while(current_this && current_src)
-       {
+       while( current_this && current_src ) {
                if(!current_this->equivalent(current_src)) return 0;
                current_this = current_this->next;
                current_src = current_src->next;
        }
 
                if(!current_this->equivalent(current_src)) return 0;
                current_this = current_this->next;
                current_src = current_src->next;
        }
 
-       return !current_this ^ !current_src ? 0 : 1;
+       return current_this || current_src ? 0 : 1;
 }
 
 void HistogramPoints::copy_from(HistogramPoints *src)
 }
 
 void HistogramPoints::copy_from(HistogramPoints *src)
@@ -127,48 +131,62 @@ void HistogramPoints::copy_from(HistogramPoints *src)
        while(last)
                delete last;
        HistogramPoint *current = src->first;
        while(last)
                delete last;
        HistogramPoint *current = src->first;
-       while(current)
-       {
+       while( current ) {
                HistogramPoint *new_point = new HistogramPoint;
                HistogramPoint *new_point = new HistogramPoint;
-               new_point->x = current->x;
-               new_point->y = current->y;
+               new_point->copy_from(current);
                append(new_point);
                current = NEXT;
        }
 }
 
                append(new_point);
                current = NEXT;
        }
 }
 
-void HistogramPoints::interpolate(HistogramPoints *prev,
-       HistogramPoints *next,
-       double prev_scale,
-       double next_scale)
+int HistogramPoints::cmprx(HistogramPoint *ap, HistogramPoint *bp)
+{
+       return ap->x < bp->x ? -1 : ap->x == bp->x ? 0 : 1;
+}
+
+void HistogramPoints::interpolate(HistogramPoints *prev, HistogramPoints *next,
+               double prev_scale, double next_scale)
 {
 {
-       HistogramPoint *current = first;
        HistogramPoint *current_prev = prev->first;
        HistogramPoint *current_next = next->first;
 
        HistogramPoint *current_prev = prev->first;
        HistogramPoint *current_next = next->first;
 
-       while(current && current_prev && current_next)
-       {
-               current->x = current_prev->x * prev_scale +
-                       current_next->x * next_scale;
-               current->y = current_prev->y * prev_scale +
-                       current_next->y * next_scale;
-               current = NEXT;
-               current_prev = current_prev->next;
-               current_next = current_next->next;
+       HistogramPoint *current = first;
+       while( current_prev || current_next ) {
+               if( !current ) {
+                       current = new HistogramPoint;
+                       append(current);
+               }
+               if( !current_next ) {
+                       current->copy_from(current_prev);
+                       current_prev = current_prev->next;
+               }
+               else if( !current_prev ) {
+                       current->copy_from(current_next);
+                       current_next = current_next->next;
+               }
+               else {
+                       current->x = current_prev->x * prev_scale +
+                                       current_next->x * next_scale;
+                       current->y = current_prev->y * prev_scale +
+                                       current_next->y * next_scale;
+                       current->gradient = current_prev->gradient * prev_scale +
+                                       current_next->gradient * next_scale;
+                       current->xoffset_left = current_prev->xoffset_left * prev_scale +
+                                       current_next->xoffset_left * next_scale;
+                       current->xoffset_right = current_prev->xoffset_right * prev_scale +
+                                       current_next->xoffset_right * next_scale;
+                       current_prev = current_prev->next;
+                       current_next = current_next->next;
+               }
+               current = current->next;
        }
        }
-}
-
-
-
-
-
-
-
-
-
-
-
 
 
+       while( current ) {
+               HistogramPoint *next_point = current->next;
+               delete current;  current = next_point;
+       }
+       sort(cmprx);
+}
 
 
 HistogramConfig::HistogramConfig()
 
 
 HistogramConfig::HistogramConfig()
@@ -179,16 +197,12 @@ HistogramConfig::HistogramConfig()
 void HistogramConfig::reset(int do_mode)
 {
        reset_points();
 void HistogramConfig::reset(int do_mode)
 {
        reset_points();
-
-
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
+       for( int i = 0; i < HISTOGRAM_MODES; i++ ) {
                output_min[i] = 0.0;
                output_max[i] = 1.0;
        }
 
                output_min[i] = 0.0;
                output_max[i] = 1.0;
        }
 
-       if(do_mode)
-       {
+       if( do_mode ) {
                automatic = 0;
                threshold = 1.0;
                split = 0;
                automatic = 0;
                threshold = 1.0;
                split = 0;
@@ -198,21 +212,14 @@ void HistogramConfig::reset(int do_mode)
 
 void HistogramConfig::reset_points()
 {
 
 void HistogramConfig::reset_points()
 {
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
-               while(points[i].last) delete points[i].last;
-               points[i].insert(0.0,0.0);
-               points[i].last->gradient = 1.0;
-               points[i].insert(1.0,1.0);
-               points[i].last->gradient = 1.0;
-       }
+       for( int i=0; i<HISTOGRAM_MODES; ++i )
+               points[i].clear();
 }
 
 
 void HistogramConfig::boundaries()
 {
 }
 
 
 void HistogramConfig::boundaries()
 {
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
                points[i].boundaries();
                CLAMP(output_min[i], HIST_MIN_INPUT, HIST_MAX_INPUT);
                CLAMP(output_max[i], HIST_MIN_INPUT, HIST_MAX_INPUT);
                points[i].boundaries();
                CLAMP(output_min[i], HIST_MIN_INPUT, HIST_MAX_INPUT);
                CLAMP(output_max[i], HIST_MIN_INPUT, HIST_MAX_INPUT);
@@ -224,23 +231,23 @@ void HistogramConfig::boundaries()
 
 int HistogramConfig::equivalent(HistogramConfig &that)
 {
 
 int HistogramConfig::equivalent(HistogramConfig &that)
 {
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
-               if(!points[i].equivalent(&that.points[i]) ||
-                       !EQUIV(output_min[i], that.output_min[i]) ||
-                       !EQUIV(output_max[i], that.output_max[i])) return 0;
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
+               if( !points[i].equivalent(&that.points[i]) ||
+                   !EQUIV(output_min[i], that.output_min[i]) ||
+                   !EQUIV(output_max[i], that.output_max[i]) ) return 0;
        }
 
        }
 
-       if(automatic != that.automatic ||
-               !EQUIV(threshold, that.threshold)) return 0;
+       if( automatic != that.automatic ||
+           split != that.split ||
+           smoothMode != that.smoothMode ||
+           !EQUIV(threshold, that.threshold) ) return 0;
 
        return 1;
 }
 
 void HistogramConfig::copy_from(HistogramConfig &that)
 {
 
        return 1;
 }
 
 void HistogramConfig::copy_from(HistogramConfig &that)
 {
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
                points[i].copy_from(&that.points[i]);
                output_min[i] = that.output_min[i];
                output_max[i] = that.output_max[i];
                points[i].copy_from(&that.points[i]);
                output_min[i] = that.output_min[i];
                output_max[i] = that.output_max[i];
@@ -252,17 +259,13 @@ void HistogramConfig::copy_from(HistogramConfig &that)
        smoothMode = that.smoothMode;
 }
 
        smoothMode = that.smoothMode;
 }
 
-void HistogramConfig::interpolate(HistogramConfig &prev,
-       HistogramConfig &next,
-       int64_t prev_frame,
-       int64_t next_frame,
-       int64_t current_frame)
+void HistogramConfig::interpolate(HistogramConfig &prev, HistogramConfig &next,
+       int64_t prev_frame, int64_t next_frame, int64_t current_frame)
 {
        double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
        double prev_scale = 1.0 - next_scale;
 
 {
        double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
        double prev_scale = 1.0 - next_scale;
 
-       for(int i = 0; i < HISTOGRAM_MODES; i++)
-       {
+       for( int i=0; i<HISTOGRAM_MODES; ++i ) {
                points[i].interpolate(&prev.points[i], &next.points[i], prev_scale, next_scale);
                output_min[i] = prev.output_min[i] * prev_scale + next.output_min[i] * next_scale;
                output_max[i] = prev.output_max[i] * prev_scale + next.output_max[i] * next_scale;
                points[i].interpolate(&prev.points[i], &next.points[i], prev_scale, next_scale);
                output_min[i] = prev.output_min[i] * prev_scale + next.output_min[i] * next_scale;
                output_max[i] = prev.output_max[i] * prev_scale + next.output_max[i] * next_scale;
@@ -277,20 +280,19 @@ void HistogramConfig::interpolate(HistogramConfig &prev,
 
 void HistogramConfig::dump()
 {
 
 void HistogramConfig::dump()
 {
-       for(int j = 0; j < HISTOGRAM_MODES; j++)
-       {
-               printf("HistogramConfig::dump mode=%d\n", j);
+       printf("HistogramConfig::dump: automatic=%d, threshold=%f, split=%d, smoothMode=%d\n",
+               automatic, threshold, split, smoothMode);
+       static const char *mode_name[] = { "red","grn","blu","val" };
+       for( int j=0; j<HISTOGRAM_MODES; ++j ) {
+               printf("mode[%s]:\n", mode_name[j]);
                HistogramPoints *points = &this->points[j];
                HistogramPoint *current = points->first;
                HistogramPoints *points = &this->points[j];
                HistogramPoint *current = points->first;
-               while(current)
-               {
-                       printf("%f,%f ", current->x, current->y);
+               while( current ) {
+                       printf("%f,%f (@%f l%f,r%f)\n", current->x, current->y,
+                               current->gradient, current->xoffset_left, current->xoffset_right);
                        fflush(stdout);
                        current = NEXT;
                }
                        fflush(stdout);
                        current = NEXT;
                }
-               printf("\n");
        }
 }
 
        }
 }
 
-
-
index bcfb98489624a4edeae27c5def5d81d243e8fa1a..c93aa55c7a86b9962581688925a82dab817ec4ca 100644 (file)
@@ -35,6 +35,7 @@ public:
        ~HistogramPoint();
 
        int equivalent(HistogramPoint *src);
        ~HistogramPoint();
 
        int equivalent(HistogramPoint *src);
+       void copy_from(HistogramPoint *that);
        float x, y;
        float gradient;
        float xoffset_left;
        float x, y;
        float gradient;
        float xoffset_left;
@@ -50,13 +51,13 @@ public:
 
 // Insert new point
        HistogramPoint* insert(float x, float y);
 
 // Insert new point
        HistogramPoint* insert(float x, float y);
+       void clear();
        int equivalent(HistogramPoints *src);
        void boundaries();
        void copy_from(HistogramPoints *src);
        int equivalent(HistogramPoints *src);
        void boundaries();
        void copy_from(HistogramPoints *src);
-       void interpolate(HistogramPoints *prev,
-               HistogramPoints *next,
-               double prev_scale,
-               double next_scale);
+       static int cmprx(HistogramPoint *ap, HistogramPoint *bp);
+       void interpolate(HistogramPoints *prev, HistogramPoints *next,
+               double prev_scale, double next_scale);
 };
 
 class HistogramConfig
 };
 
 class HistogramConfig
index 8aa9c49ec03fea62f6ffa33c889e9278c75ef584..8d23ff4a872b5171aa0c3243696ecb0ccbaa1dad 100644 (file)
@@ -62,55 +62,35 @@ void HistogramWindow::create_objects()
        max_picon = create_pixmap(&max_picon_image);
        mid_picon = create_pixmap(&mid_picon_image);
        min_picon = create_pixmap(&min_picon_image);
        max_picon = create_pixmap(&max_picon_image);
        mid_picon = create_pixmap(&mid_picon_image);
        min_picon = create_pixmap(&min_picon_image);
-       add_subwindow(mode_v = new HistogramMode(plugin,
-               x,
-               y,
-               HISTOGRAM_VALUE,
-               _("Value")));
-       x += 70;
-       add_subwindow(mode_r = new HistogramMode(plugin,
-               x,
-               y,
-               HISTOGRAM_RED,
-               _("Red")));
-       x += 70;
-       add_subwindow(mode_g = new HistogramMode(plugin,
-               x,
-               y,
-               HISTOGRAM_GREEN,
-               _("Green")));
-       x += 70;
-       add_subwindow(mode_b = new HistogramMode(plugin,
-               x,
-               y,
-               HISTOGRAM_BLUE,
-               _("Blue")));
-//     x += 70;
-//     add_subwindow(mode_a = new HistogramMode(plugin,
-//             x,
-//             y,
-//             HISTOGRAM_ALPHA,
-//             _("Alpha")));
+       add_subwindow(mode_v = new HistogramMode(plugin, x, y,
+               HISTOGRAM_VALUE, _("Value")));
+       x += 80;
+       add_subwindow(mode_r = new HistogramMode(plugin, x, y,
+               HISTOGRAM_RED, _("Red")));
+       x += 80;
+       add_subwindow(mode_g = new HistogramMode(plugin, x, y,
+               HISTOGRAM_GREEN, _("Green")));
+       x += 80;
+       add_subwindow(mode_b = new HistogramMode(plugin, x, y,
+               HISTOGRAM_BLUE, _("Blue")));
+//     x += 80;
+//     add_subwindow(mode_a = new HistogramMode(plugin, x, y,
+//             HISTOGRAM_ALPHA, _("Alpha")));
+
+       x = get_w() - HistogramClear::calculate_w(this, _("Clear")) - 15;
+       add_subwindow(clear = new HistogramClear(plugin, x, y, _("Clear")));
 
        x = x1;
        y += 30;
        add_subwindow(title = new BC_Title(x, y, _("Input X:")));
        x += title->get_w() + 10;
 
        x = x1;
        y += 30;
        add_subwindow(title = new BC_Title(x, y, _("Input X:")));
        x += title->get_w() + 10;
-       input_x = new HistogramInputText(plugin,
-               this,
-               x,
-               y,
-               1);
+       input_x = new HistogramInputText(plugin, this, x, y, 1);
        input_x->create_objects();
 
        x += input_x->get_w() + 10;
        add_subwindow(title = new BC_Title(x, y, _("Input Y:")));
        x += title->get_w() + 10;
        input_x->create_objects();
 
        x += input_x->get_w() + 10;
        add_subwindow(title = new BC_Title(x, y, _("Input Y:")));
        x += title->get_w() + 10;
-       input_y = new HistogramInputText(plugin,
-               this,
-               x,
-               y,
-               0);
+       input_y = new HistogramInputText(plugin, this, x, y, 0);
        input_y->create_objects();
 
        y += 30;
        input_y->create_objects();
 
        y += 30;
@@ -122,78 +102,48 @@ void HistogramWindow::create_objects()
        title2_x = x + (int)(canvas_w * -HIST_MIN_INPUT / FLOAT_RANGE);
        title3_x = x + (int)(canvas_w * (1.0 - HIST_MIN_INPUT) / FLOAT_RANGE);
        title4_x = x + (int)(canvas_w);
        title2_x = x + (int)(canvas_w * -HIST_MIN_INPUT / FLOAT_RANGE);
        title3_x = x + (int)(canvas_w * (1.0 - HIST_MIN_INPUT) / FLOAT_RANGE);
        title4_x = x + (int)(canvas_w);
-       add_subwindow(canvas = new HistogramCanvas(plugin,
-               this,
-               x,
-               y,
-               canvas_w,
-               canvas_h));
+       add_subwindow(canvas = new HistogramCanvas(plugin, this,
+                       x, y, canvas_w, canvas_h));
        draw_canvas_overlay();
        canvas->flash();
 
        y += canvas->get_h() + 1;
        draw_canvas_overlay();
        canvas->flash();
 
        y += canvas->get_h() + 1;
-       add_subwindow(new BC_Title(title1_x,
-               y,
-               "-10%"));
-       add_subwindow(new BC_Title(title2_x,
-               y,
-               "0%"));
-       add_subwindow(new BC_Title(title3_x - get_text_width(MEDIUMFONT, "100"),
-               y,
-               "100%"));
-       add_subwindow(new BC_Title(title4_x - get_text_width(MEDIUMFONT, "110"),
-               y,
-               "110%"));
+       add_subwindow(new BC_Title(title1_x, y, "-10%"));
+       add_subwindow(new BC_Title(title2_x, y, "0%"));
+       add_subwindow(new BC_Title(title3_x - get_text_width(MEDIUMFONT, "100"), y, "100%"));
+       add_subwindow(new BC_Title(title4_x - get_text_width(MEDIUMFONT, "110"), y, "110%"));
 
        y += 20;
        add_subwindow(title = new BC_Title(x, y, _("Output min:")));
        x += title->get_w() + 10;
 
        y += 20;
        add_subwindow(title = new BC_Title(x, y, _("Output min:")));
        x += title->get_w() + 10;
-       output_min = new HistogramOutputText(plugin,
-               this,
-               x,
-               y,
-               &plugin->config.output_min[plugin->mode]);
+       output_min = new HistogramOutputText(plugin, this,
+               x, y, &plugin->config.output_min[plugin->mode]);
        output_min->create_objects();
        x += output_min->get_w() + 10;
        add_subwindow(new BC_Title(x, y, _("Output Max:")));
        x += title->get_w() + 10;
        output_min->create_objects();
        x += output_min->get_w() + 10;
        add_subwindow(new BC_Title(x, y, _("Output Max:")));
        x += title->get_w() + 10;
-       output_max = new HistogramOutputText(plugin,
-               this,
-               x,
-               y,
-               &plugin->config.output_max[plugin->mode]);
+       output_max = new HistogramOutputText(plugin, this,
+               x, y, &plugin->config.output_max[plugin->mode]);
        output_max->create_objects();
 
        x = x1;
        y += 30;
 
        output_max->create_objects();
 
        x = x1;
        y += 30;
 
-       add_subwindow(output = new HistogramSlider(plugin,
-               this,
-               x,
-               y,
-               get_w() - 20,
-               30,
-               0));
+       add_subwindow(output = new HistogramSlider(plugin, this,
+               x, y, get_w() - 20, 30, 0));
        output->update();
        y += 40;
 
 
        output->update();
        y += 40;
 
 
-       add_subwindow(automatic = new HistogramAuto(plugin,
-               x,
-               y));
+       add_subwindow(automatic = new HistogramAuto(plugin, x, y));
 
        x += 120;
 
        x += 120;
-       add_subwindow(new HistogramReset(plugin,
-               x,
-               y));
+       add_subwindow(new HistogramReset(plugin, x, y));
        x += 100;
        add_subwindow(new BC_Title(x, y, _("Threshold:")));
        x += 100;
        x += 100;
        add_subwindow(new BC_Title(x, y, _("Threshold:")));
        x += 100;
-       threshold = new HistogramOutputText(plugin,
-               this,
-               x,
-               y,
-               &plugin->config.threshold);
+       threshold = new HistogramOutputText(plugin, this,
+               x, y, &plugin->config.threshold);
        threshold->create_objects();
        x = x1;
        y += 40;
        threshold->create_objects();
        x = x1;
        y += 40;
@@ -208,18 +158,22 @@ void HistogramWindow::create_objects()
        show_window();
 }
 
        show_window();
 }
 
+int HistogramWindow::delete_current_point()
+{
+       if( plugin->current_point < 0 ) return 0;
+       HistogramPoint *current =
+               plugin->config.points[plugin->mode].get_item_number(plugin->current_point);
+       delete current;
+       plugin->current_point = -1;
+       return 1;
+}
+
 int HistogramWindow::keypress_event()
 {
        int result = 0;
 int HistogramWindow::keypress_event()
 {
        int result = 0;
-       if(get_keypress() == BACKSPACE ||
-               get_keypress() == DELETE)
-       {
-               if(plugin->current_point >= 0)
-               {
-                       HistogramPoint *current =
-                               plugin->config.points[plugin->mode].get_item_number(plugin->current_point);
-                       delete current;
-                       plugin->current_point = -1;
+       if( get_keypress() == BACKSPACE ||
+           get_keypress() == DELETE ) {
+               if( delete_current_point() ) {
                        update_input();
                        update_canvas();
                        plugin->send_configure_change();
                        update_input();
                        update_canvas();
                        plugin->send_configure_change();
@@ -234,9 +188,11 @@ void HistogramWindow::update(int do_input)
        automatic->update(plugin->config.automatic);
        threshold->update(plugin->config.threshold);
        update_mode();
        automatic->update(plugin->config.automatic);
        threshold->update(plugin->config.threshold);
        update_mode();
-
-       if(do_input) update_input();
+       split->set_value(plugin->config.split);
+       if( do_input ) update_input();
        update_output();
        update_output();
+       if( smoothModeChoser->set_mode(plugin->config.smoothMode) )
+               update_canvas();
 }
 
 void HistogramWindow::update_input()
 }
 
 void HistogramWindow::update_input()
@@ -271,17 +227,12 @@ void HistogramWindow::draw_canvas_overlay()
 
 // Draw output line
        canvas->set_color(0xffff00);
 
 // Draw output line
        canvas->set_color(0xffff00);
-       for(int i = 0; i < canvas_w; i++)
-       {
-               float input = (float)i /
-                               canvas_w *
-                               FLOAT_RANGE +
-                               HIST_MIN_INPUT;
+       for( int i=0; i<canvas_w; ++i ) {
+               float input = (float)i / canvas_w * FLOAT_RANGE + HIST_MIN_INPUT;
                float output = plugin->calculate_smooth(input, plugin->mode);
 
                int y2 = canvas_h - (int)(output * canvas_h);
                float output = plugin->calculate_smooth(input, plugin->mode);
 
                int y2 = canvas_h - (int)(output * canvas_h);
-               if(i > 0)
-               {
+               if( i > 0 ) {
                        canvas->draw_line(i - 1, y1, i, y2);
                }
                y1 = y2;
                        canvas->draw_line(i - 1, y1, i, y2);
                }
                y1 = y2;
@@ -291,8 +242,7 @@ void HistogramWindow::draw_canvas_overlay()
 // Draw output points
        HistogramPoint *current = plugin->config.points[plugin->mode].first;
        int number = 0;
 // Draw output points
        HistogramPoint *current = plugin->config.points[plugin->mode].first;
        int number = 0;
-       while(current)
-       {
+       while( current ) {
                canvas->set_color(0x00ff00);
                int x = (int)((current->x - HIST_MIN_INPUT) * canvas_w / FLOAT_RANGE);
                int y = (int)(canvas_h - current->y * canvas_h);
                canvas->set_color(0x00ff00);
                int x = (int)((current->x - HIST_MIN_INPUT) * canvas_w / FLOAT_RANGE);
                int y = (int)(canvas_h - current->y * canvas_h);
@@ -307,7 +257,7 @@ void HistogramWindow::draw_canvas_overlay()
 //Draw gradients
                if (plugin->config.smoothMode > HISTOGRAM_LINEAR) {
                        int x1,x2,y1,y2;
 //Draw gradients
                if (plugin->config.smoothMode > HISTOGRAM_LINEAR) {
                        int x1,x2,y1,y2;
-                       canvas->set_color(0x0000ff);
+                       canvas->set_color(0xffffff);
                        x2 = (int)((current->x + current->xoffset_right - HIST_MIN_INPUT) * canvas_w / FLOAT_RANGE);
                        x1 = (int)((current->x + current->xoffset_left - HIST_MIN_INPUT) * canvas_w / FLOAT_RANGE);
                        y2 = (int)(canvas_h - (current->y + current->xoffset_right * current->gradient) * canvas_h);
                        x2 = (int)((current->x + current->xoffset_right - HIST_MIN_INPUT) * canvas_w / FLOAT_RANGE);
                        x1 = (int)((current->x + current->xoffset_left - HIST_MIN_INPUT) * canvas_w / FLOAT_RANGE);
                        y2 = (int)(canvas_h - (current->y + current->xoffset_right * current->gradient) * canvas_h);
@@ -316,7 +266,7 @@ void HistogramWindow::draw_canvas_overlay()
                        x1 = x - (title3_x - title2_x)/20;
                        y1 = y + (int)(current->gradient * (float)(canvas_h)/20.0);
                        y2 = y - (int)(current->gradient * (float)(canvas_h)/20.0);
                        x1 = x - (title3_x - title2_x)/20;
                        y1 = y + (int)(current->gradient * (float)(canvas_h)/20.0);
                        y2 = y - (int)(current->gradient * (float)(canvas_h)/20.0);
-//                     int y2 = (int)(canvas_h - canvas_h * (current->y + current->gradient /10));*/
+                       int y2 = (int)(canvas_h - canvas_h * (current->y + current->gradient /10));*/
                        canvas->draw_line(x1,y1,x2,y2);
 
                        canvas->draw_circle(x1 - BOX_SIZE / 4, y1 - BOX_SIZE / 4, BOX_SIZE/2, BOX_SIZE/2);
                        canvas->draw_line(x1,y1,x2,y2);
 
                        canvas->draw_circle(x1 - BOX_SIZE / 4, y1 - BOX_SIZE / 4, BOX_SIZE/2, BOX_SIZE/2);
@@ -330,54 +280,47 @@ void HistogramWindow::draw_canvas_overlay()
 
 // Draw 0 and 100% lines.
        canvas->set_color(0xff0000);
 
 // Draw 0 and 100% lines.
        canvas->set_color(0xff0000);
-       canvas->draw_line(title2_x - canvas->get_x(),
-               0,
-               title2_x - canvas->get_x(),
-               canvas_h);
-       canvas->draw_line(title3_x - canvas->get_x(),
-               0,
-               title3_x - canvas->get_x(),
-               canvas_h);
+       canvas->draw_line(title2_x - canvas->get_x(), 0,
+               title2_x - canvas->get_x(), canvas_h);
+       canvas->draw_line(title3_x - canvas->get_x(), 0,
+               title3_x - canvas->get_x(), canvas_h);
 }
 
 void HistogramWindow::update_canvas()
 {
 }
 
 void HistogramWindow::update_canvas()
 {
+       int bins = plugin->slots * (HISTOGRAM_MAX-HISTOGRAM_MIN)/100;
        int *accum = plugin->accum[plugin->mode];
        int *accum = plugin->accum[plugin->mode];
-       int accum_per_canvas_i = HISTOGRAM_SLOTS / canvas_w + 1;
-       float accum_per_canvas_f = (float)HISTOGRAM_SLOTS / canvas_w;
        int normalize = 0;
        int max = 0;
 
        int normalize = 0;
        int max = 0;
 
-       for(int i = 0; i < HISTOGRAM_SLOTS; i++)
-       {
-               if(accum && accum[i] > normalize) normalize = accum[i];
+       if( accum ) {
+               for( int i=0; i<bins; ++i )
+                       if( accum[i] > normalize )
+                               normalize = accum[i];
        }
 
 
        }
 
 
-       if(normalize)
-       {
-               for(int i = 0; i < canvas_w; i++)
-               {
-                       int accum_start = (int)(accum_per_canvas_f * i);
-                       int accum_end = accum_start + accum_per_canvas_i;
+       if( normalize ) {
+               int accum_start = 0;
+               for( int i=0; i<canvas_w; ++i ) {
+                       int accum_end = bins*i / canvas_w;
                        max = 0;
                        max = 0;
-                       for(int j = accum_start; j < accum_end; j++)
-                       {
+                       for( int j=accum_start; j<accum_end; ++j ) {
                                max = MAX(accum[j], max);
                        }
 
 //                     max = max * canvas_h / normalize;
                        max = (int)(log(max) / log(normalize) * canvas_h);
 
                                max = MAX(accum[j], max);
                        }
 
 //                     max = max * canvas_h / normalize;
                        max = (int)(log(max) / log(normalize) * canvas_h);
 
-                       canvas->set_color(0xffffff);
+                       canvas->set_color(0x333333);
                        canvas->draw_line(i, 0, i, canvas_h - max);
                        canvas->draw_line(i, 0, i, canvas_h - max);
-                       canvas->set_color(0x000000);
+                       canvas->set_color(0x848484);
                        canvas->draw_line(i, canvas_h - max, i, canvas_h);
                        canvas->draw_line(i, canvas_h - max, i, canvas_h);
+                       accum_start = accum_end;
                }
        }
                }
        }
-       else
-       {
-               canvas->set_color(0xffffff);
+       else {
+               canvas->set_color(0x333333);
                canvas->draw_box(0, 0, canvas_w, canvas_h);
        }
 
                canvas->draw_box(0, 0, canvas_w, canvas_h);
        }
 
@@ -387,23 +330,9 @@ void HistogramWindow::update_canvas()
 }
 
 
 }
 
 
-
-
-
-
-
-
-HistogramCanvas::HistogramCanvas(HistogramMain *plugin,
-       HistogramWindow *gui,
-       int x,
-       int y,
-       int w,
-       int h)
- : BC_SubWindow(x,
-       y,
-       w,
-       h,
-       0xffffff)
+HistogramCanvas::HistogramCanvas(HistogramMain *plugin, HistogramWindow *gui,
+       int x, int y, int w, int h)
+ : BC_SubWindow(x, y, w, h, 0x333333)
 {
        this->plugin = plugin;
        this->gui = gui;
 {
        this->plugin = plugin;
        this->gui = gui;
@@ -412,27 +341,23 @@ HistogramCanvas::HistogramCanvas(HistogramMain *plugin,
 int HistogramCanvas::button_press_event()
 {
        int result = 0;
 int HistogramCanvas::button_press_event()
 {
        int result = 0;
-       if(is_event_win() && cursor_inside())
-       {
-               if(!plugin->dragging_point)
-               {
+       if( is_event_win() && cursor_inside() ) {
+               if( !plugin->dragging_point ) {
                        HistogramPoint *new_point = 0;
                        gui->deactivate();
 // Search for existing point under cursor
                        HistogramPoint *current = plugin->config.points[plugin->mode].first;
                        plugin->current_point = -1;
                        int dragID = 0;
                        HistogramPoint *new_point = 0;
                        gui->deactivate();
 // Search for existing point under cursor
                        HistogramPoint *current = plugin->config.points[plugin->mode].first;
                        plugin->current_point = -1;
                        int dragID = 0;
-                       while(current)
-                       {
+                       while( current ) {
                                int x = (int)((current->x - HIST_MIN_INPUT) * gui->canvas_w / FLOAT_RANGE);
                                int y = (int)(gui->canvas_h - current->y * gui->canvas_h);
 
 /* Check for click on main point */
                                int x = (int)((current->x - HIST_MIN_INPUT) * gui->canvas_w / FLOAT_RANGE);
                                int y = (int)(gui->canvas_h - current->y * gui->canvas_h);
 
 /* Check for click on main point */
-                               if(get_cursor_x() >= x - BOX_SIZE / 2 &&
-                                       get_cursor_y() >= y - BOX_SIZE / 2 &&
-                                       get_cursor_x() < x + BOX_SIZE / 2 &&
-                                       get_cursor_y() < y + BOX_SIZE / 2)
-                               {
+                               if( get_cursor_x() >= x - BOX_SIZE / 2 &&
+                                   get_cursor_y() >= y - BOX_SIZE / 2 &&
+                                   get_cursor_x() < x + BOX_SIZE / 2 &&
+                                   get_cursor_y() < y + BOX_SIZE / 2 ) {
                                        plugin->current_point =
                                                plugin->config.points[plugin->mode].number_of(current);
                                        plugin->point_x_offset = get_cursor_x() - x;
                                        plugin->current_point =
                                                plugin->config.points[plugin->mode].number_of(current);
                                        plugin->point_x_offset = get_cursor_x() - x;
@@ -450,11 +375,10 @@ int HistogramCanvas::button_press_event()
                                  gui->canvas_h);
 
 /* Check for click on right handle */
                                  gui->canvas_h);
 
 /* Check for click on right handle */
-                               if(get_cursor_x() >= xright - BOX_SIZE / 2 &&
-                                  get_cursor_y() >= yright - BOX_SIZE / 2 &&
-                                  get_cursor_x() <  xright + BOX_SIZE / 2 &&
-                                  get_cursor_y() <  yright + BOX_SIZE / 2)
-                               {
+                               if( get_cursor_x() >= xright - BOX_SIZE / 2 &&
+                                   get_cursor_y() >= yright - BOX_SIZE / 2 &&
+                                   get_cursor_x() <  xright + BOX_SIZE / 2 &&
+                                   get_cursor_y() <  yright + BOX_SIZE / 2 ) {
                                        plugin->current_point =
                                                plugin->config.points[plugin->mode].number_of(current);
                                        plugin->point_x_offset = get_cursor_x() - xright;
                                        plugin->current_point =
                                                plugin->config.points[plugin->mode].number_of(current);
                                        plugin->point_x_offset = get_cursor_x() - xright;
@@ -469,11 +393,10 @@ int HistogramCanvas::button_press_event()
                                int yleft =
                                  (int)(gui->canvas_h - (current->y + current->xoffset_left * current->gradient) *
                                  gui->canvas_h);
                                int yleft =
                                  (int)(gui->canvas_h - (current->y + current->xoffset_left * current->gradient) *
                                  gui->canvas_h);
-                               if(get_cursor_x() >= xleft - BOX_SIZE / 2 &&
-                                  get_cursor_y() >= yleft - BOX_SIZE / 2 &&
-                                  get_cursor_x() <  xleft + BOX_SIZE / 2 &&
-                                  get_cursor_y() <  yleft + BOX_SIZE / 2)
-                               {
+                               if( get_cursor_x() >= xleft - BOX_SIZE / 2 &&
+                                   get_cursor_y() >= yleft - BOX_SIZE / 2 &&
+                                   get_cursor_x() <  xleft + BOX_SIZE / 2 &&
+                                   get_cursor_y() <  yleft + BOX_SIZE / 2 ) {
                                        plugin->current_point =
                                                plugin->config.points[plugin->mode].number_of(current);
                                        plugin->point_x_offset = get_cursor_x() - xleft;
                                        plugin->current_point =
                                                plugin->config.points[plugin->mode].number_of(current);
                                        plugin->point_x_offset = get_cursor_x() - xleft;
@@ -482,20 +405,13 @@ int HistogramCanvas::button_press_event()
                                        break;
                                }
 
                                        break;
                                }
 
-
                                current = NEXT;
                        }
 
                                current = NEXT;
                        }
 
-                       if(plugin->current_point < 0)
-                       {
+                       if( plugin->current_point < 0 ) {
 // Create new point under cursor
 // Create new point under cursor
-                               float current_x = (float)get_cursor_x() *
-                                       FLOAT_RANGE /
-                                       get_w() +
-                                       HIST_MIN_INPUT;
-                               float current_y = 1.0 -
-                                       (float)get_cursor_y() /
-                                       get_h();
+                               float current_x = (float)get_cursor_x() * FLOAT_RANGE / get_w() + HIST_MIN_INPUT;
+                               float current_y = 1.0 - (float)get_cursor_y() / get_h();
                                new_point =
                                        plugin->config.points[plugin->mode].insert(current_x, current_y);
                                plugin->current_point =
                                new_point =
                                        plugin->config.points[plugin->mode].insert(current_x, current_y);
                                plugin->current_point =
@@ -509,10 +425,8 @@ int HistogramCanvas::button_press_event()
 
                                HistogramPoint *current = plugin->config.points[plugin->mode].first;
                                int done = 0;
 
                                HistogramPoint *current = plugin->config.points[plugin->mode].first;
                                int done = 0;
-                               while(current && !done)
-                               {
-                                       if(current->x > current_x)
-                                       {
+                               while( current && !done ) {
+                                       if( current->x > current_x ) {
                                                x2 = current->x;
                                                y2 = current->y;
                                                done = 1;
                                                x2 = current->x;
                                                y2 = current->y;
                                                done = 1;
@@ -523,10 +437,8 @@ int HistogramCanvas::button_press_event()
 
                                current = plugin->config.points[plugin->mode].last;
                                done = 0;
 
                                current = plugin->config.points[plugin->mode].last;
                                done = 0;
-                               while(current && !done)
-                               {
-                                       if(current->x <= current_x)
-                                       {
+                               while( current && !done ) {
+                                       if( current->x <= current_x ) {
                                                x1 = current->x;
                                                y1 = current->y;
                                                done = 1;
                                                x1 = current->x;
                                                y1 = current->y;
                                                done = 1;
@@ -536,9 +448,13 @@ int HistogramCanvas::button_press_event()
                                }
                                new_point->gradient = (y2 - y1) / (x2 - x1);
                                dragID = 1;
                                }
                                new_point->gradient = (y2 - y1) / (x2 - x1);
                                dragID = 1;
-
                        }
                        }
-
+                       else if( dragID == 1 && get_buttonpress() == RIGHT_BUTTON ) {
+                               if( gui->delete_current_point() ) {
+                                       plugin->send_configure_change();
+                                       dragID = 0;
+                               }
+                       }
 
                        plugin->dragging_point = dragID;
                        result = 1;
 
                        plugin->dragging_point = dragID;
                        result = 1;
@@ -546,8 +462,7 @@ int HistogramCanvas::button_press_event()
                        plugin->config.boundaries();
                        gui->update_input();
                        gui->update_canvas();
                        plugin->config.boundaries();
                        gui->update_input();
                        gui->update_canvas();
-                       if(new_point)
-                       {
+                       if( new_point ) {
                                plugin->send_configure_change();
                        }
                }
                                plugin->send_configure_change();
                        }
                }
@@ -557,39 +472,31 @@ int HistogramCanvas::button_press_event()
 
 int HistogramCanvas::cursor_motion_event()
 {
 
 int HistogramCanvas::cursor_motion_event()
 {
-       if(plugin->dragging_point)
-       {
-               HistogramPoint * current_point = plugin->config.points[plugin->mode].get_item_number(plugin->current_point);
-
-               float current_x =
-                       (float)(get_cursor_x() - plugin->point_x_offset) *
-                       FLOAT_RANGE /
-                       get_w() +
-                       HIST_MIN_INPUT;
-               float current_y = 1.0 -
-                       (float)(get_cursor_y() - plugin->point_y_offset) /
-                       get_h();
-
-               switch(plugin->dragging_point)
-               {
-                 case 1: /* Main point dragged */
+       if( plugin->dragging_point ) {
+               HistogramPoints *mode_points = &plugin->config.points[plugin->mode];
+               HistogramPoint *current_point = mode_points->get_item_number(plugin->current_point);
+
+               float current_x =
+                       (float)(get_cursor_x() - plugin->point_x_offset) * FLOAT_RANGE / get_w() + HIST_MIN_INPUT;
+               float current_y = 1.0 - (float)(get_cursor_y() - plugin->point_y_offset) / get_h();
+
+               switch( plugin->dragging_point ) {
+               case 1: /* Main point dragged */
                        current_point->x = current_x;
                        current_point->y = current_y;
                        break;
                        current_point->x = current_x;
                        current_point->y = current_y;
                        break;
-                 case 2: /* Right control point dragged */
-                       if (current_x - current_point->x > 0)
-                       {
-                         current_point->xoffset_right = current_x - current_point->x;
-                         current_point->gradient = (current_y - current_point->y) / (current_x - current_point->x);
-                       }
-                       break;
-                 case 3: /* Left control point dragged */
-                       if (current_x - current_point->x < 0)
-                       {
-                         current_point->xoffset_left = current_x - current_point->x;
-                         current_point->gradient = (current_point->y - current_y) / (current_point->x - current_x);
-                       }
-                       break;
+               case 2: /* Right control point dragged */
+                       if( current_x - current_point->x > 0 ) {
+                               current_point->xoffset_right = current_x - current_point->x;
+                               current_point->gradient = (current_y - current_point->y) / (current_x - current_point->x);
+                       }
+                       break;
+               case 3: /* Left control point dragged */
+                       if( current_x - current_point->x < 0 ) {
+                               current_point->xoffset_left = current_x - current_point->x;
+                               current_point->gradient = (current_point->y - current_y) / (current_point->x - current_x);
+                       }
+                       break;
                }
 
                plugin->config.boundaries();
                }
 
                plugin->config.boundaries();
@@ -611,38 +518,30 @@ int HistogramCanvas::button_release_event()
                HistogramPoint *prev = PREVIOUS;
                HistogramPoint *next = NEXT;
 
                HistogramPoint *prev = PREVIOUS;
                HistogramPoint *next = NEXT;
 
-               if((prev && prev->x >= current->x) ||
-                       (next && next->x <= current->x))
-               {
+               if( (prev && prev->x >= current->x) ||
+                   (next && next->x <= current->x) ) {
                        delete current;
                        plugin->current_point = -1;
                        plugin->config.boundaries();
                        gui->update_input();
                        gui->update_canvas();
                        delete current;
                        plugin->current_point = -1;
                        plugin->config.boundaries();
                        gui->update_input();
                        gui->update_canvas();
-                       plugin->send_configure_change();
                }
 
                }
 
+               plugin->send_configure_change();
                plugin->dragging_point = 0;
        }
        return 0;
 }
 
 
                plugin->dragging_point = 0;
        }
        return 0;
 }
 
 
-
-
-
-
-
-HistogramReset::HistogramReset(HistogramMain *plugin,
-       int x,
-       int y)
+HistogramReset::HistogramReset(HistogramMain *plugin, int x, int y)
  : BC_GenericButton(x, y, _("Reset"))
 {
        this->plugin = plugin;
 }
 int HistogramReset::handle_event()
 {
  : BC_GenericButton(x, y, _("Reset"))
 {
        this->plugin = plugin;
 }
 int HistogramReset::handle_event()
 {
-       plugin->config.reset(0);
+       plugin->config.reset(1);
        HistogramWindow *window = (HistogramWindow *)plugin->thread->window;
        window->update(1);
        window->update_canvas();
        HistogramWindow *window = (HistogramWindow *)plugin->thread->window;
        window->update(1);
        window->update_canvas();
@@ -651,20 +550,8 @@ int HistogramReset::handle_event()
 }
 
 
 }
 
 
-
-
-
-
-
-
-
-HistogramSlider::HistogramSlider(HistogramMain *plugin,
-       HistogramWindow *gui,
-       int x,
-       int y,
-       int w,
-       int h,
-       int is_input)
+HistogramSlider::HistogramSlider(HistogramMain *plugin, HistogramWindow *gui,
+               int x, int y, int w, int h, int is_input)
  : BC_SubWindow(x, y, w, h)
 {
        this->plugin = plugin;
  : BC_SubWindow(x, y, w, h)
 {
        this->plugin = plugin;
@@ -680,34 +567,29 @@ int HistogramSlider::input_to_pixel(float input)
 
 int HistogramSlider::button_press_event()
 {
 
 int HistogramSlider::button_press_event()
 {
-       if(is_event_win() && cursor_inside())
-       {
+       if( is_event_win() && cursor_inside() ) {
 //             int w = get_w();
                int h = get_h();
                int half_h = get_h() / 2;
 
                gui->deactivate();
 
 //             int w = get_w();
                int h = get_h();
                int half_h = get_h() / 2;
 
                gui->deactivate();
 
-               if(operation == NONE)
-               {
+               if( operation == NONE ) {
                        int x1 = input_to_pixel(plugin->config.output_min[plugin->mode]) -
                                gui->mid_picon->get_w() / 2;
                        int x2 = x1 + gui->mid_picon->get_w();
                        int x1 = input_to_pixel(plugin->config.output_min[plugin->mode]) -
                                gui->mid_picon->get_w() / 2;
                        int x2 = x1 + gui->mid_picon->get_w();
-                       if(get_cursor_x() >= x1 && get_cursor_x() < x2 &&
-                               get_cursor_y() >= half_h && get_cursor_y() < h)
-                       {
+                       if( get_cursor_x() >= x1 && get_cursor_x() < x2 &&
+                           get_cursor_y() >= half_h && get_cursor_y() < h ) {
                                operation = DRAG_MIN_OUTPUT;
                        }
                }
 
                                operation = DRAG_MIN_OUTPUT;
                        }
                }
 
-               if(operation == NONE)
-               {
+               if( operation == NONE ) {
                        int x1 = input_to_pixel(plugin->config.output_max[plugin->mode]) -
                                gui->mid_picon->get_w() / 2;
                        int x2 = x1 + gui->mid_picon->get_w();
                        int x1 = input_to_pixel(plugin->config.output_max[plugin->mode]) -
                                gui->mid_picon->get_w() / 2;
                        int x2 = x1 + gui->mid_picon->get_w();
-                       if(get_cursor_x() >= x1 && get_cursor_x() < x2 &&
-                               get_cursor_y() >= half_h && get_cursor_y() < h)
-                       {
+                       if( get_cursor_x() >= x1 && get_cursor_x() < x2 &&
+                           get_cursor_y() >= half_h && get_cursor_y() < h ) {
                                operation = DRAG_MAX_OUTPUT;
                        }
                }
                                operation = DRAG_MAX_OUTPUT;
                        }
                }
@@ -718,70 +600,54 @@ int HistogramSlider::button_press_event()
 
 int HistogramSlider::button_release_event()
 {
 
 int HistogramSlider::button_release_event()
 {
-       if(operation != NONE)
-       {
-               operation = NONE;
-               return 1;
-       }
-       return 0;
+       if( operation == NONE ) return 0;
+       operation = NONE;
+       return 1;
 }
 
 int HistogramSlider::cursor_motion_event()
 {
 }
 
 int HistogramSlider::cursor_motion_event()
 {
-       if(operation != NONE)
-       {
-               float value = (float)get_cursor_x() / get_w() * FLOAT_RANGE + HIST_MIN_INPUT;
-               CLAMP(value, HIST_MIN_INPUT, HIST_MAX_INPUT);
-
-               switch(operation)
-               {
-                       case DRAG_MIN_OUTPUT:
-                               value = MIN(plugin->config.output_max[plugin->mode], value);
-                               plugin->config.output_min[plugin->mode] = value;
-                               break;
-                       case DRAG_MAX_OUTPUT:
-                               value = MAX(plugin->config.output_min[plugin->mode], value);
-                               plugin->config.output_max[plugin->mode] = value;
-                               break;
-               }
+       if( operation == NONE ) return 0;
 
 
-               plugin->config.boundaries();
-               gui->update_output();
+       float value = (float)get_cursor_x() / get_w() * FLOAT_RANGE + HIST_MIN_INPUT;
+       CLAMP(value, HIST_MIN_INPUT, HIST_MAX_INPUT);
 
 
-               plugin->send_configure_change();
-               return 1;
+       switch( operation ) {
+       case DRAG_MIN_OUTPUT:
+               value = MIN(plugin->config.output_max[plugin->mode], value);
+               plugin->config.output_min[plugin->mode] = value;
+               break;
+       case DRAG_MAX_OUTPUT:
+               value = MAX(plugin->config.output_min[plugin->mode], value);
+               plugin->config.output_max[plugin->mode] = value;
+               break;
        }
        }
-       return 0;
+
+       plugin->config.boundaries();
+       gui->update_output();
+
+       plugin->send_configure_change();
+       return 1;
 }
 
 void HistogramSlider::update()
 {
 }
 
 void HistogramSlider::update()
 {
-       int w = get_w();
-       int h = get_h();
+       int w = get_w(), h = get_h();
        int half_h = get_h() / 2;
 //     int quarter_h = get_h() / 4;
        int mode = plugin->mode;
        int half_h = get_h() / 2;
 //     int quarter_h = get_h() / 4;
        int mode = plugin->mode;
-       int r = 0xff;
-       int g = 0xff;
-       int b = 0xff;
+       int r = 0, g = 0, b = 0;
 
        clear_box(0, 0, w, h);
 
 
        clear_box(0, 0, w, h);
 
-       switch(mode)
-       {
-               case HISTOGRAM_RED:
-                       g = b = 0x00;
-                       break;
-               case HISTOGRAM_GREEN:
-                       r = b = 0x00;
-                       break;
-               case HISTOGRAM_BLUE:
-                       r = g = 0x00;
-                       break;
+       switch( mode ) {
+       case HISTOGRAM_RED:     r = 0xff;  break;
+       case HISTOGRAM_GREEN:   g = 0xff;  break;
+       case HISTOGRAM_BLUE:    b = 0xff;  break;
+       case HISTOGRAM_VALUE:   r = g = b = 0xff;  break;
        }
 
        }
 
-       for(int i = 0; i < w; i++)
-       {
+       for( int i=0; i<w; ++i ) {
                int color = (int)(i * 0xff / w);
                set_color(((r * color / 0xff) << 16) |
                        ((g * color / 0xff) << 8) |
                int color = (int)(i * 0xff / w);
                set_color(((r * color / 0xff) << 16) |
                        ((g * color / 0xff) << 8) |
@@ -790,14 +656,11 @@ void HistogramSlider::update()
                draw_line(i, 0, i, half_h);
        }
 
                draw_line(i, 0, i, half_h);
        }
 
-       float min;
-       float max;
-       min = plugin->config.output_min[plugin->mode];
-       max = plugin->config.output_max[plugin->mode];
-
+       float min = plugin->config.output_min[plugin->mode];
        draw_pixmap(gui->min_picon,
                input_to_pixel(min) - gui->min_picon->get_w() / 2,
                half_h + 1);
        draw_pixmap(gui->min_picon,
                input_to_pixel(min) - gui->min_picon->get_w() / 2,
                half_h + 1);
+       float max = plugin->config.output_max[plugin->mode];
        draw_pixmap(gui->max_picon,
                input_to_pixel(max) - gui->max_picon->get_w() / 2,
                half_h + 1);
        draw_pixmap(gui->max_picon,
                input_to_pixel(max) - gui->max_picon->get_w() / 2,
                half_h + 1);
@@ -807,16 +670,7 @@ void HistogramSlider::update()
 }
 
 
 }
 
 
-
-
-
-
-
-
-
-HistogramAuto::HistogramAuto(HistogramMain *plugin,
-       int x,
-       int y)
+HistogramAuto::HistogramAuto(HistogramMain *plugin, int x, int y)
  : BC_CheckBox(x, y, plugin->config.automatic, _("Automatic"))
 {
        this->plugin = plugin;
  : BC_CheckBox(x, y, plugin->config.automatic, _("Automatic"))
 {
        this->plugin = plugin;
@@ -830,11 +684,7 @@ int HistogramAuto::handle_event()
 }
 
 
 }
 
 
-
-
-HistogramSplit::HistogramSplit(HistogramMain *plugin,
-       int x,
-       int y)
+HistogramSplit::HistogramSplit(HistogramMain *plugin, int x, int y)
  : BC_CheckBox(x, y, plugin->config.split, _("Split picture"))
 {
        this->plugin = plugin;
  : BC_CheckBox(x, y, plugin->config.split, _("Split picture"))
 {
        this->plugin = plugin;
@@ -848,13 +698,8 @@ int HistogramSplit::handle_event()
 }
 
 
 }
 
 
-
-
-HistogramMode::HistogramMode(HistogramMain *plugin,
-       int x,
-       int y,
-       int value,
-       char *text)
+HistogramMode::HistogramMode(HistogramMain *plugin, int x, int y,
+       int value, const char *text)
  : BC_Radial(x, y, plugin->mode == value, text)
 {
        this->plugin = plugin;
  : BC_Radial(x, y, plugin->mode == value, text)
 {
        this->plugin = plugin;
@@ -865,10 +710,9 @@ int HistogramMode::handle_event()
        plugin->mode = value;
        plugin->current_point= -1;
        HistogramWindow *window = (HistogramWindow *)plugin->thread->window;
        plugin->mode = value;
        plugin->current_point= -1;
        HistogramWindow *window = (HistogramWindow *)plugin->thread->window;
-       window->update_canvas();
        window->update_mode();
        window->update_mode();
-       window->update_input();
        window->update_canvas();
        window->update_canvas();
+       window->update_input();
        window->update_output();
        window->output->update();
 //     plugin->send_configure_change();
        window->update_output();
        window->output->update();
 //     plugin->send_configure_change();
@@ -876,25 +720,31 @@ int HistogramMode::handle_event()
 }
 
 
 }
 
 
+HistogramClear::HistogramClear(HistogramMain *plugin, int x, int y, const char *text)
+ : BC_GenericButton(x, y, text)
+{
+       this->plugin = plugin;
+}
 
 
-
-
-
-
+int HistogramClear::handle_event()
+{
+       HistogramPoints *mode_points = &plugin->config.points[plugin->mode];
+       mode_points->clear();
+       plugin->config.output_min[plugin->mode] = 0.0;
+       plugin->config.output_max[plugin->mode] = 1.0;
+       HistogramWindow *window = (HistogramWindow *)plugin->thread->window;
+       window->update(1);
+       window->update_canvas();
+       plugin->send_configure_change();
+       return 1;
+}
 
 
 HistogramOutputText::HistogramOutputText(HistogramMain *plugin,
 
 
 HistogramOutputText::HistogramOutputText(HistogramMain *plugin,
-       HistogramWindow *gui,
-       int x,
-       int y,
-       float *output)
- : BC_TumbleTextBox(gui,
-               output ? (float)*output : 0.0,
-               (float)HIST_MIN_INPUT,
-               (float)HIST_MAX_INPUT,
-               x,
-               y,
-               60)
+       HistogramWindow *gui, int x, int y, float *output)
+ : BC_TumbleTextBox(gui, output ? (float)*output : 0.0,
+               (float)HIST_MIN_INPUT, (float)HIST_MAX_INPUT,
+               x, y, 60)
 {
        this->plugin = plugin;
        this->output = output;
 {
        this->plugin = plugin;
        this->output = output;
@@ -902,11 +752,9 @@ HistogramOutputText::HistogramOutputText(HistogramMain *plugin,
        set_increment(PRECISION);
 }
 
        set_increment(PRECISION);
 }
 
-
 int HistogramOutputText::handle_event()
 {
 int HistogramOutputText::handle_event()
 {
-       if(output)
-       {
+       if( output ) {
                *output = atof(get_text());
        }
 
                *output = atof(get_text());
        }
 
@@ -917,24 +765,11 @@ int HistogramOutputText::handle_event()
 }
 
 
 }
 
 
-
-
-
-
-
-
 HistogramInputText::HistogramInputText(HistogramMain *plugin,
 HistogramInputText::HistogramInputText(HistogramMain *plugin,
-       HistogramWindow *gui,
-       int x,
-       int y,
-       int do_x)
- : BC_TumbleTextBox(gui,
-               0.0,
-               (float)HIST_MIN_INPUT,
-               (float)HIST_MAX_INPUT,
-               x,
-               y,
-               60)
+       HistogramWindow *gui, int x, int y, int do_x)
+ : BC_TumbleTextBox(gui, 0.0,
+               (float)HIST_MIN_INPUT, (float)HIST_MAX_INPUT,
+               x, y, 60)
 {
        this->do_x = do_x;
        this->plugin = plugin;
 {
        this->do_x = do_x;
        this->plugin = plugin;
@@ -943,19 +778,15 @@ HistogramInputText::HistogramInputText(HistogramMain *plugin,
        set_increment(PRECISION);
 }
 
        set_increment(PRECISION);
 }
 
-
 int HistogramInputText::handle_event()
 {
 int HistogramInputText::handle_event()
 {
-       if(plugin->current_point >= 0 &&
-               plugin->current_point < plugin->config.points[plugin->mode].total())
-       {
-               HistogramPoint *point =
-                       plugin->config.points[plugin->mode].get_item_number(
-                               plugin->current_point);
+       if( plugin->current_point >= 0 &&
+           plugin->current_point < plugin->config.points[plugin->mode].total() ) {
+               HistogramPoints *mode_points = &plugin->config.points[plugin->mode];
+               HistogramPoint *point = mode_points->get_item_number(plugin->current_point);
 
 
-               if(point)
-               {
-                       if(do_x)
+               if( point ) {
+                       if( do_x )
                                point->x = atof(get_text());
                        else
                                point->y = atof(get_text());
                                point->x = atof(get_text());
                        else
                                point->y = atof(get_text());
@@ -973,28 +804,22 @@ int HistogramInputText::handle_event()
 
 void HistogramInputText::update()
 {
 
 void HistogramInputText::update()
 {
-       if(plugin->current_point >= 0 &&
-               plugin->current_point < plugin->config.points[plugin->mode].total())
-       {
-               HistogramPoint *point =
+       if( plugin->current_point >= 0 &&
+           plugin->current_point < plugin->config.points[plugin->mode].total() ) {
+               HistogramPoints *mode_points = &plugin->config.points[plugin->mode];
+               HistogramPoint *point = mode_points->get_item_number(plugin->current_point);
 
 
-                       plugin->config.points[plugin->mode].get_item_number(
-                               plugin->current_point);
-
-               if(point)
-               {
-                       if(do_x)
+               if( point ) {
+                       if( do_x )
                                BC_TumbleTextBox::update(point->x);
                        else
                                BC_TumbleTextBox::update(point->y);
                }
                                BC_TumbleTextBox::update(point->x);
                        else
                                BC_TumbleTextBox::update(point->y);
                }
-               else
-               {
+               else {
                        BC_TumbleTextBox::update((float)0.0);
                }
        }
                        BC_TumbleTextBox::update((float)0.0);
                }
        }
-       else
-       {
+       else {
                BC_TumbleTextBox::update((float)0.0);
        }
 
                BC_TumbleTextBox::update((float)0.0);
        }
 
@@ -1002,9 +827,7 @@ void HistogramInputText::update()
 
 
 HistogramSmoothMode::HistogramSmoothMode(HistogramMain*plugin,
 
 
 HistogramSmoothMode::HistogramSmoothMode(HistogramMain*plugin,
-       HistogramWindow *gui,
-       int x,
-       int y)
+       HistogramWindow *gui, int x, int y)
  : BC_PopupMenu(x, y, 120, to_text(plugin->config.smoothMode), 1)
 {
        this->plugin = plugin;
  : BC_PopupMenu(x, y, 120, to_text(plugin->config.smoothMode), 1)
 {
        this->plugin = plugin;
@@ -1019,47 +842,41 @@ void HistogramSmoothMode::create_objects()
 
 char* HistogramSmoothMode::to_text(int mode)
 {
 
 char* HistogramSmoothMode::to_text(int mode)
 {
-       switch(mode)
-       {
-               case HISTOGRAM_LINEAR:
-                       return _("Linear");
-               case HISTOGRAM_POLYNOMINAL:
-                       return _("Polynominal");
-               case HISTOGRAM_BEZIER:
-                       return _("Bezier");
+       switch( mode ) {
+       case HISTOGRAM_LINEAR:          return _("Linear");
+       case HISTOGRAM_POLYNOMINAL:     return _("Polynominal");
+       case HISTOGRAM_BEZIER:          return _("Bezier");
        }
        return _("None");
 }
        }
        return _("None");
 }
+int HistogramSmoothMode::set_mode(int mode)
+{
+       const char *tp = to_text(mode);
+       if( strcmp(tp, get_text()) ) {
+               set_text(tp);
+               return 1;
+       }
+       return 0;
+}
+
 
 int HistogramSmoothMode::from_text(char *text)
 {
 
 int HistogramSmoothMode::from_text(char *text)
 {
-       if(!strcmp(text, to_text(HISTOGRAM_LINEAR)))
-               return HISTOGRAM_LINEAR;
-       if(!strcmp(text, to_text(HISTOGRAM_POLYNOMINAL)))
-               return HISTOGRAM_POLYNOMINAL;
-       if(!strcmp(text, to_text(HISTOGRAM_BEZIER)))
-               return HISTOGRAM_BEZIER;
+       if( !strcmp(text, to_text(HISTOGRAM_LINEAR)) ) return HISTOGRAM_LINEAR;
+       if( !strcmp(text, to_text(HISTOGRAM_POLYNOMINAL)) ) return HISTOGRAM_POLYNOMINAL;
+       if( !strcmp(text, to_text(HISTOGRAM_BEZIER)) ) return HISTOGRAM_BEZIER;
        return HISTOGRAM_LINEAR;
 }
        return HISTOGRAM_LINEAR;
 }
+int HistogramSmoothMode::get_mode()
+{
+       return from_text(get_text());
+}
 
 int HistogramSmoothMode::handle_event()
 {
 
 int HistogramSmoothMode::handle_event()
 {
-       plugin->config.smoothMode = from_text(get_text());
+       plugin->config.smoothMode = get_mode();
        gui->update_canvas();
        plugin->send_configure_change();
        return 1;
 }
 
        gui->update_canvas();
        plugin->send_configure_change();
        return 1;
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
index 9a7bab4ea5e2de4b3edafe3dd7b18c91113636aa..5051607f0f5bda4fd5ff40bfe402d2fc727225db 100644 (file)
@@ -37,6 +37,8 @@ public:
                int x,
                int y);
        void create_objects();
                int x,
                int y);
        void create_objects();
+       int set_mode(int mode);
+       int get_mode();
        static char* to_text(int shape);
        static int from_text(char *text);
        int handle_event();
        static char* to_text(int shape);
        static int from_text(char *text);
        int handle_event();
@@ -97,16 +99,23 @@ public:
 class HistogramMode : public BC_Radial
 {
 public:
 class HistogramMode : public BC_Radial
 {
 public:
-       HistogramMode(HistogramMain *plugin,
-               int x,
-               int y,
-               int value,
-               char *text);
+       HistogramMode(HistogramMain *plugin, int x, int y,
+               int value, const char *text);
        int handle_event();
        int handle_event();
+
        HistogramMain *plugin;
        int value;
 };
 
        HistogramMain *plugin;
        int value;
 };
 
+class HistogramClear : public BC_GenericButton
+{
+public:
+       HistogramClear(HistogramMain *plugin, int x, int y, const char *text);
+       int handle_event();
+
+       HistogramMain *plugin;
+};
+
 class HistogramReset : public BC_GenericButton
 {
 public:
 class HistogramReset : public BC_GenericButton
 {
 public:
@@ -177,6 +186,7 @@ public:
        void draw_canvas_overlay();
        void update_input();
        void update_output();
        void draw_canvas_overlay();
        void update_input();
        void update_output();
+       int delete_current_point();
        int keypress_event();
 
        HistogramSlider *output;
        int keypress_event();
 
        HistogramSlider *output;
@@ -184,6 +194,7 @@ public:
        HistogramSplit *split;
        HistogramSmoothMode *smoothModeChoser;
        HistogramMode *mode_v, *mode_r, *mode_g, *mode_b /*,  *mode_a */;
        HistogramSplit *split;
        HistogramSmoothMode *smoothModeChoser;
        HistogramMode *mode_v, *mode_r, *mode_g, *mode_b /*,  *mode_a */;
+       HistogramClear *clear;
        HistogramOutputText *output_min;
        HistogramOutputText *output_max;
        HistogramOutputText *threshold;
        HistogramOutputText *output_min;
        HistogramOutputText *output_max;
        HistogramOutputText *threshold;
index ea8ff8e876f6373d51f8fede9e951b62d14b33d7..9f16c561be8c62a820a225b6f5d362a8318e8509 100644 (file)
@@ -4,7 +4,7 @@ msgstr ""
 "Project-Id-Version: cinelerra 5.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2018-10-23 19:01+0200\n"
 "Project-Id-Version: cinelerra 5.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2018-10-23 19:01+0200\n"
-"PO-Revision-Date: 2018-10-23 20:07+0200\n"
+"PO-Revision-Date: 2018-10-27 13:36+0200\n"
 "Last-Translator: Olaf <cinmail@womentie.de>\n"
 "Language-Team: Language-Team <cinelerra@lists.cinelerra-cv.org>\n"
 "Language: de\n"
 "Last-Translator: Olaf <cinmail@womentie.de>\n"
 "Language-Team: Language-Team <cinelerra@lists.cinelerra-cv.org>\n"
 "Language: de\n"
@@ -12209,6 +12209,8 @@ msgstr "Momentäre Hinweise"
 msgid "Ctrl or Shift to select multiple notes."
 msgstr "Strg oder Umschalt, um mehrere Noten auswählen."
 
 msgid "Ctrl or Shift to select multiple notes."
 msgstr "Strg oder Umschalt, um mehrere Noten auswählen."
 
+# Themen-Namen dürfen derzeit nicht übersetzt werden,
+# zudem handelt es sich um Eigennamen.
 #: plugins/theme_blond/blondtheme.C:71
 msgid "Blond"
 msgstr "Blond"
 #: plugins/theme_blond/blondtheme.C:71
 msgid "Blond"
 msgstr "Blond"
@@ -12219,11 +12221,11 @@ msgstr "Blond-cv"
 
 #: plugins/theme_blue_dot/bluedottheme.C:73
 msgid "Blue Dot"
 
 #: plugins/theme_blue_dot/bluedottheme.C:73
 msgid "Blue Dot"
-msgstr "Blauer Punkt"
+msgstr "Blue Dot"
 
 #: plugins/theme_bright/brighttheme.C:69
 msgid "Bright"
 
 #: plugins/theme_bright/brighttheme.C:69
 msgid "Bright"
-msgstr "Hell"
+msgstr "Bright"
 
 #: plugins/theme_hulk/hulktheme.C:72
 msgid "Hulk"
 
 #: plugins/theme_hulk/hulktheme.C:72
 msgid "Hulk"
@@ -12245,7 +12247,7 @@ msgstr "S.U.V."
 
 #: plugins/theme_unflat/unflattheme.C:66
 msgid "UnFlat"
 
 #: plugins/theme_unflat/unflattheme.C:66
 msgid "UnFlat"
-msgstr "UnEben"
+msgstr "UnFlat"
 
 #: plugins/threshold/thresholdwindow.C:310
 msgid "Low Color"
 
 #: plugins/threshold/thresholdwindow.C:310
 msgid "Low Color"