textbox click policy prefs
authorGood Guy <good1.2guy@gmail.com>
Thu, 9 Feb 2017 20:00:36 +0000 (13:00 -0700)
committerGood Guy <good1.2guy@gmail.com>
Thu, 9 Feb 2017 20:00:36 +0000 (13:00 -0700)
cinelerra-5.1/cinelerra/interfaceprefs.C
cinelerra-5.1/cinelerra/interfaceprefs.h
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/guicast/bcresources.C
cinelerra-5.1/guicast/bctextbox.C
cinelerra-5.1/guicast/bcwindowbase.inc

index 3789bc1042bd941fc227c2118481c9a631060db8..fb58b22eea391a89394bb338bf8850096a4c029b 100644 (file)
@@ -146,9 +146,12 @@ void InterfacePrefs::create_objects()
        PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x1, y1);
        add_subwindow(pop_win);
        y1 += pop_win->get_h() + 5;
-       TextboxFocusPolicy *focus_policy = new TextboxFocusPolicy(pwindow, x1, y1);
-       add_subwindow(focus_policy);
-       y1 += focus_policy->get_h() + 5;
+       ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x1, y1);
+       add_subwindow(focus_activate);
+       y1 += focus_activate->get_h() + 5;
+       DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x1, y1);
+       add_subwindow(focus_deactivate);
+       y1 += focus_deactivate->get_h() + 5;
 
        if( y < y1 ) y = y1;
        y += 10;
@@ -746,16 +749,35 @@ int PopupMenuBtnup::handle_event()
        return 1;
 }
 
-TextboxFocusPolicy::TextboxFocusPolicy(PreferencesWindow *pwindow, int x, int y)
- : BC_CheckBox(x, y, pwindow->thread->preferences->textbox_focus_policy,
+ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
+       _("Click to activate text focus"))
+{
+       this->pwindow = pwindow;
+}
+
+int ActivateFocusPolicy::handle_event()
+{
+       if( get_value() )
+               pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
+       else
+               pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
+       return 1;
+}
+
+DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
        _("Click to deactivate text focus"))
 {
        this->pwindow = pwindow;
 }
 
-int TextboxFocusPolicy::handle_event()
+int DeactivateFocusPolicy::handle_event()
 {
-       pwindow->thread->preferences->textbox_focus_policy = get_value();
+       if( get_value() )
+               pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
+       else
+               pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
        return 1;
 }
 
index 17bf3508caf07f0ba7772445cf174aab27164005..a16cb750720b3f9872309d3fb91273fe5ac18adc 100644 (file)
@@ -335,10 +335,18 @@ public:
        PreferencesWindow *pwindow;
 };
 
-class TextboxFocusPolicy : public BC_CheckBox
+class ActivateFocusPolicy : public BC_CheckBox
 {
 public:
-       TextboxFocusPolicy(PreferencesWindow *pwindow, int x, int y);
+       ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y);
+       int handle_event();
+       PreferencesWindow *pwindow;
+};
+
+class DeactivateFocusPolicy : public BC_CheckBox
+{
+public:
+       DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y);
        int handle_event();
        PreferencesWindow *pwindow;
 };
index 950ddfc26eebcd398e84b2efa38775824ac07389..4b7a92aecf98b50de38953df03e80fb34c585fd3 100644 (file)
@@ -83,7 +83,7 @@ Preferences::Preferences()
        warn_version = 1;
        bd_warn_root = 1;
        popupmenu_btnup = 1;
-       textbox_focus_policy = LEAVE_DEACTIVATE;
+       textbox_focus_policy = 0;
        dvd_yuv420p_interlace = 0;
 
 // Default brender asset
index cd56baaf31158ad5913374206bba6e0253cb29c4..c97e802fe444431784d357347ab33679b5094cd3 100644 (file)
@@ -644,7 +644,7 @@ BC_Resources::BC_Resources()
        tooltip_delay = 1000;
        tooltip_bg_color = YELLOW;
        tooltips_enabled = 1;
-       textbox_focus_policy = LEAVE_DEACTIVATE;
+       textbox_focus_policy = 0;
 
        filebox_margin = 110;
        dirbox_margin = 90;
index e5ac51c652993ded444722e15c5d7ed9b80602f9..4eef5347d7a300369861f6e41e199911ec6bad21 100644 (file)
@@ -750,7 +750,8 @@ int BC_TextBox::focus_out_event()
 
 int BC_TextBox::cursor_enter_event()
 {
-       if(top_level->event_win == win && enabled)
+       if( top_level->event_win == win && enabled &&
+           !(top_level->get_resources()->textbox_focus_policy & CLICK_ACTIVATE) )
        {
                tooltip_done = 0;
                if( !active ) {
@@ -777,7 +778,7 @@ int BC_TextBox::cursor_leave_event()
                flash(1);
        }
        if( !suggestions_popup &&
-           top_level->get_resources()->textbox_focus_policy == LEAVE_DEACTIVATE )
+           !(top_level->get_resources()->textbox_focus_policy & CLICK_DEACTIVATE) )
                deactivate();
        return 0;
 }
@@ -901,7 +902,7 @@ int BC_TextBox::button_press_event()
                        if( suggestions_popup->button_press_event() )
                                return suggestions_popup->handle_event();
                }
-               else if( top_level->get_resources()->textbox_focus_policy == CLICK_DEACTIVATE )
+               else if( (top_level->get_resources()->textbox_focus_policy & CLICK_DEACTIVATE) )
                        deactivate();
        }
 
index d6c4f4951d13a56920fad770be7dbcc3fe4fe7b9..c0bcff5abff3a3e60d78acbf12db2c7703e9c599 100644 (file)
@@ -45,9 +45,9 @@ class BC_WindowList;
 #define MIDDLE_BUTTON 2
 #define RIGHT_BUTTON 3
 
-// textbox deactivate policy
-#define LEAVE_DEACTIVATE 0
-#define CLICK_DEACTIVATE 1
+// textbox policy mask
+#define CLICK_ACTIVATE 1
+#define CLICK_DEACTIVATE 2
 
 // Use single thread for all windows.
 // This is a bad idea because it's very slow.  Windows which share the same