@@ -28,11 +28,37 @@ type HotKeyView() =
28
28
29
29
let settingsCheckbox key = checkBox( settingsProperty( key))
30
30
31
+ let dropDown ( prop : IProperty < string >, items : string list ) =
32
+ let combo = new ComboBox()
33
+
34
+ // First add items
35
+ combo.Items.AddRange( items |> List.toArray |> Array.map box)
36
+
37
+ // Then set initial value if exists, otherwise select first item
38
+ let initialIndex =
39
+ match items |> List.tryFindIndex ((=) prop.value) with
40
+ | Some index -> index
41
+ | None -> if combo.Items.Count > 0 then 0 else - 1
42
+
43
+ if initialIndex >= 0 then
44
+ combo.SelectedIndex <- initialIndex
45
+
46
+ combo.SelectedIndexChanged.Add( fun _ ->
47
+ if combo.SelectedIndex >= 0 then
48
+ prop.value <- combo.SelectedItem.ToString()
49
+ )
50
+
51
+ combo :> Control
52
+
53
+ let settingsDropDown key value = dropDown( settingsProperty( key), value)
54
+
31
55
let basicForm =
32
56
let fields = List2([
33
57
( " runAtStartup" , settingsCheckbox " runAtStartup" )
34
58
( " hideInactiveTabs" , settingsCheckbox " hideInactiveTabs" )
35
59
( " isTabbingEnabledForAllProcessesByDefault" , checkBox( prop< IFilterService, bool>( Services.filter, " isTabbingEnabledForAllProcessesByDefault" )))
60
+ ( " autoHide" , settingsCheckbox " autoHide" )
61
+ ( " alignment" , settingsDropDown " alignment" [ " Left" ; " Center" ; " Right" ])
36
62
])
37
63
" Basics" , UIHelper.form fields
38
64
@@ -63,21 +89,14 @@ type HotKeyView() =
63
89
editor.value <- Services.program.getHotKey( key)
64
90
editor.changed.Add <| fun () ->
65
91
Services.program.setHotKey key ( unbox< int>( editor.value))
66
-
67
- let checkBox ( prop : IProperty < bool >) =
68
- let checkbox = BoolEditor() :> IPropEditor
69
- checkbox.value <- box( prop.value)
70
- checkbox.changed.Add <| fun () -> prop.value <- unbox< bool>( checkbox.value)
71
- checkbox.control
72
-
73
- let settingsCheckbox key = checkBox( settingsProperty( key))
74
92
75
93
let fields = hotKeys.map <| fun ( key , text ) ->
76
94
let editor = editors.find key
77
95
text, editor.control
78
96
79
97
let fields = fields.prependList( List2([
80
98
( " enableCtrlNumberHotKey" , settingsCheckbox " enableCtrlNumberHotKey" )
99
+ ( " enableHoverActivate" , settingsCheckbox " enableHoverActivate" )
81
100
]))
82
101
83
102
" Switch Tabs" , UIHelper.form fields
0 commit comments