add mask color radio btn sel, fix del all mask btn, fix mask dflt kfrm draw name...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / cwindowtool.h
index 92fa72b9e6251fe01c899148a184624e2d9b7906..e6922e4b4f295d117b64d745c134cc6df1494052 100644 (file)
 
 #include "condition.inc"
 #include "cwindowgui.inc"
+#include "cwindowtool.inc"
 #include "guicast.h"
+#include "keyframe.inc"
 #include "maskauto.inc"
 #include "maskautos.inc"
 #include "mwindow.inc"
 
 
-class CWindowToolGUI;
-class CWindowCoord;
-class CWindowCurveToggle;
-
-
 // This common thread supports all the tool GUI's.
 class CWindowTool : public Thread
 {
@@ -96,8 +93,10 @@ public:
 class CWindowCoord : public BC_TumbleTextBox
 {
 public:
-       CWindowCoord(CWindowToolGUI *gui, int x, int y, float value, int logincrement);
-       CWindowCoord(CWindowToolGUI *gui, int x, int y, int value);
+       CWindowCoord(CWindowToolGUI *gui, int x, int y,
+                       float value, int logincrement);
+       CWindowCoord(CWindowToolGUI *gui, int x, int y,
+                       int value);
 
 // Calls the window's handle_event
        int handle_event();
@@ -108,7 +107,8 @@ public:
 class CWindowCropOK : public BC_GenericButton
 {
 public:
-       CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+       CWindowCropOK(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
 // Perform the cropping operation
        int handle_event();
        int keypress_event();
@@ -128,83 +128,206 @@ public:
        CWindowCoord *x1, *y1, *width, *height;
 };
 
-class CWindowMaskMode : public BC_PopupMenu
+class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
 {
 public:
-       CWindowMaskMode(MWindow *mwindow, CWindowToolGUI *gui, int x, int y, const char *text);
-       void create_objects();
+       CWindowMaskItems() {}
+       ~CWindowMaskItems() { remove_all_objects(); }
+};
+
+class CWindowMaskName : public BC_PopupTextBox
+{
+public:
+       CWindowMaskName(MWindow *mwindow, CWindowMaskGUI *gui,
+                       int x, int y, const char *text);
+       ~CWindowMaskName();
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+       CWindowMaskItems mask_items;
+
+       int handle_event();
+       void update_items(MaskAuto *keyframe);
+};
+
+class CWindowMaskDelMask : public BC_GenericButton
+{
+public:
+       CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
        int handle_event();
-       static char* mode_to_text(int mode);
-       int text_to_mode(char *text);
        MWindow *mwindow;
        CWindowToolGUI *gui;
 };
 
-class CWindowMaskDelete : public BC_GenericButton
+class CWindowMaskClrMask : public BC_Button
 {
 public:
-       CWindowMaskDelete(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+       CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui,
+                       int x, int y);
+       ~CWindowMaskClrMask();
+       static int calculate_w(MWindow *mwindow);
        int handle_event();
-       int keypress_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
+};
+
+class CWindowMaskButton : public BC_CheckBox
+{
+public:
+       CWindowMaskButton(MWindow *mwindow, CWindowMaskGUI *gui,
+                        int x, int y, int no, int v);
+       ~CWindowMaskButton();
+
+       int handle_event();
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+       int no;
 };
 
-class CWindowMaskCycleNext : public BC_GenericButton
+class CWindowMaskThumbler : public BC_Tumbler
 {
 public:
-       CWindowMaskCycleNext(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+       CWindowMaskThumbler(MWindow *mwindow, CWindowMaskGUI *gui,
+                       int x, int y);
+       ~CWindowMaskThumbler();
+       int handle_up_event();
+       int handle_down_event();
+       int do_event(int dir);
+
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+};
+
+class CWindowMaskFade : public BC_TumbleTextBox
+{
+public:
+       CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
+       ~CWindowMaskFade();
+       int update(float v);
+       int update_value(float v);
        int handle_event();
        MWindow *mwindow;
        CWindowToolGUI *gui;
 };
 
-class CWindowMaskCyclePrev : public BC_GenericButton
+class CWindowMaskFadeSlider : public BC_ISlider
 {
 public:
-       CWindowMaskCyclePrev(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+       CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
+               int x, int y, int w);
+       ~CWindowMaskFadeSlider();
        int handle_event();
+       int update(int64_t v);
+       char *get_caption() { return 0; }
        MWindow *mwindow;
        CWindowToolGUI *gui;
+       int stick;
+       float last_v;
+       Timer *timer;
 };
 
-class CWindowMaskNumber : public BC_TumbleTextBox
+class CWindowMaskGangFader : public BC_Toggle
 {
 public:
-       CWindowMaskNumber(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
-       ~CWindowMaskNumber();
+       CWindowMaskGangFader(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
+       ~CWindowMaskGangFader();
        int handle_event();
        MWindow *mwindow;
        CWindowToolGUI *gui;
 };
 
-
 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
 {
 public:
-       CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+       CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
        ~CWindowMaskAffectedPoint();
        int handle_event();
        MWindow *mwindow;
        CWindowToolGUI *gui;
 };
 
+class CWindowMaskFocus : public BC_CheckBox
+{
+public:
+       CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
+       ~CWindowMaskFocus();
+       int handle_event();
+       MWindow *mwindow;
+       CWindowToolGUI *gui;
+};
+
+class CWindowMaskDrawMarkers : public BC_CheckBox
+{
+public:
+       CWindowMaskDrawMarkers(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
+       ~CWindowMaskDrawMarkers();
+       int handle_event();
+       MWindow *mwindow;
+       CWindowToolGUI *gui;
+};
+
+class CWindowMaskDrawBoundary : public BC_CheckBox
+{
+public:
+       CWindowMaskDrawBoundary(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
+       ~CWindowMaskDrawBoundary();
+       int handle_event();
+       MWindow *mwindow;
+       CWindowToolGUI *gui;
+};
+
+class CWindowMaskDelPoint : public BC_GenericButton
+{
+public:
+       CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
+       int handle_event();
+       int keypress_event();
+       MWindow *mwindow;
+       CWindowToolGUI *gui;
+};
 
 class CWindowMaskFeather : public BC_TumbleTextBox
 {
 public:
-       CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+       CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
        ~CWindowMaskFeather();
+       int update(float v);
+       int update_value(float v);
+       int handle_event();
+       MWindow *mwindow;
+       CWindowToolGUI *gui;
+};
+
+class CWindowMaskFeatherSlider : public BC_FSlider
+{
+public:
+       CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
+               int x, int y, int w, float v);
+       ~CWindowMaskFeatherSlider();
        int handle_event();
+       int update(float v);
+       char *get_caption() { return 0; }
        MWindow *mwindow;
        CWindowToolGUI *gui;
+       int stick;
+       float last_v;
+       Timer *timer;
 };
 
-class CWindowMaskValue : public BC_ISlider
+class CWindowMaskGangFeather : public BC_Toggle
 {
 public:
-       CWindowMaskValue(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
-       ~CWindowMaskValue();
+       CWindowMaskGangFeather(MWindow *mwindow, CWindowToolGUI *gui,
+                       int x, int y);
+       ~CWindowMaskGangFeather();
        int handle_event();
        MWindow *mwindow;
        CWindowToolGUI *gui;
@@ -213,7 +336,8 @@ public:
 class CWindowMaskBeforePlugins : public BC_CheckBox
 {
 public:
-       CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y);
+       CWindowMaskBeforePlugins(CWindowToolGUI *gui,
+                       int x, int y);
        int handle_event();
        CWindowToolGUI *gui;
 };
@@ -221,7 +345,8 @@ public:
 class CWindowDisableOpenGLMasking : public BC_CheckBox
 {
 public:
-       CWindowDisableOpenGLMasking(CWindowToolGUI *gui, int x, int y);
+       CWindowDisableOpenGLMasking(CWindowToolGUI *gui,
+                       int x, int y);
        int handle_event();
        CWindowToolGUI *gui;
 };
@@ -233,27 +358,40 @@ public:
        ~CWindowMaskGUI();
        void create_objects();
        void update();
+       void set_focused(int v, float cx, float cy);
+       void update_buttons(MaskAuto *keyframe, int k);
        void handle_event();
        void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
                SubMask* &mask, MaskPoint* &point, int create_it);
        void update_preview();
 
+       CWindowMaskName *name;
+       CWindowMaskButton *mask_buttons[SUBMASKS];
+       CWindowMaskThumbler *mask_thumbler;
+       BC_Title *mask_blabels[SUBMASKS];
+       CWindowMaskDelMask *del_mask;
+       CWindowMaskClrMask *clr_mask;
+       CWindowMaskFade *fade;
+       CWindowMaskFadeSlider *fade_slider;
+       CWindowMaskGangFader *gang_fader;
+       CWindowMaskAffectedPoint *active_point;
+       CWindowMaskDelPoint *del_point;
        CWindowCoord *x, *y;
-       CWindowMaskMode *mode;
+       CWindowMaskFocus *focus;
+       int focused;
+       CWindowMaskDrawMarkers *draw_markers;
+       int markers;
+       CWindowMaskDrawBoundary *draw_boundary;
+       int boundary;
+       CWindowCoord *focus_x, *focus_y;
        CWindowMaskFeather *feather;
-       CWindowMaskDelete *delete_point;
-       CWindowMaskAffectedPoint *active_point;
-// Not necessary if all keyframes have same points
-//     CWindowMaskCycleNext *next_point;
-//     CWindowMaskCyclePrev *prev_point;
-       CWindowMaskNumber *number;
-       CWindowMaskValue *value;
+       CWindowMaskFeatherSlider *feather_slider;
+       CWindowMaskGangFeather *gang_feather;
        CWindowMaskBeforePlugins *apply_before_plugins;
        CWindowDisableOpenGLMasking *disable_opengl_masking;
 };
 
 
-class CWindowEyedropCheckBox;
 class CWindowEyedropGUI : public CWindowToolGUI
 {
 public:
@@ -309,7 +447,8 @@ private:
 class CWindowCameraLeft : public BC_Button
 {
 public:
-       CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
+       CWindowCameraLeft(MWindow *mwindow, CWindowCameraGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowCameraGUI *gui;
@@ -318,7 +457,8 @@ public:
 class CWindowCameraCenter : public BC_Button
 {
 public:
-       CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
+       CWindowCameraCenter(MWindow *mwindow, CWindowCameraGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowCameraGUI *gui;
@@ -327,7 +467,8 @@ public:
 class CWindowCameraRight : public BC_Button
 {
 public:
-       CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
+       CWindowCameraRight(MWindow *mwindow, CWindowCameraGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowCameraGUI *gui;
@@ -336,7 +477,8 @@ public:
 class CWindowCameraTop : public BC_Button
 {
 public:
-       CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
+       CWindowCameraTop(MWindow *mwindow, CWindowCameraGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowCameraGUI *gui;
@@ -345,7 +487,8 @@ public:
 class CWindowCameraMiddle : public BC_Button
 {
 public:
-       CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
+       CWindowCameraMiddle(MWindow *mwindow, CWindowCameraGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowCameraGUI *gui;
@@ -354,7 +497,8 @@ public:
 class CWindowCameraBottom : public BC_Button
 {
 public:
-       CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui, int x, int y);
+       CWindowCameraBottom(MWindow *mwindow, CWindowCameraGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowCameraGUI *gui;
@@ -379,7 +523,8 @@ private:
 class CWindowProjectorLeft : public BC_Button
 {
 public:
-       CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
+       CWindowProjectorLeft(MWindow *mwindow, CWindowProjectorGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowProjectorGUI *gui;
@@ -388,7 +533,8 @@ public:
 class CWindowProjectorCenter : public BC_Button
 {
 public:
-       CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
+       CWindowProjectorCenter(MWindow *mwindow, CWindowProjectorGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowProjectorGUI *gui;
@@ -397,7 +543,8 @@ public:
 class CWindowProjectorRight : public BC_Button
 {
 public:
-       CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
+       CWindowProjectorRight(MWindow *mwindow, CWindowProjectorGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowProjectorGUI *gui;
@@ -406,7 +553,8 @@ public:
 class CWindowProjectorTop : public BC_Button
 {
 public:
-       CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
+       CWindowProjectorTop(MWindow *mwindow, CWindowProjectorGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowProjectorGUI *gui;
@@ -415,7 +563,8 @@ public:
 class CWindowProjectorMiddle : public BC_Button
 {
 public:
-       CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
+       CWindowProjectorMiddle(MWindow *mwindow, CWindowProjectorGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowProjectorGUI *gui;
@@ -424,7 +573,8 @@ public:
 class CWindowProjectorBottom : public BC_Button
 {
 public:
-       CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui, int x, int y);
+       CWindowProjectorBottom(MWindow *mwindow, CWindowProjectorGUI *gui,
+                       int x, int y);
        int handle_event();
        MWindow *mwindow;
        CWindowProjectorGUI *gui;