Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
66bf046e
Commit
66bf046e
authored
Mar 15, 2005
by
Jérome Decoodt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work on MacOS preferences. Need to be completed, improved, and debugged...
parent
b68c1a2b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
461 additions
and
328 deletions
+461
-328
modules/gui/macosx/prefs.h
modules/gui/macosx/prefs.h
+2
-0
modules/gui/macosx/prefs.m
modules/gui/macosx/prefs.m
+241
-131
modules/gui/macosx/prefs_widgets.h
modules/gui/macosx/prefs_widgets.h
+8
-4
modules/gui/macosx/prefs_widgets.m
modules/gui/macosx/prefs_widgets.m
+210
-193
No files found.
modules/gui/macosx/prefs.h
View file @
66bf046e
...
...
@@ -27,6 +27,7 @@
int
i_object_id
;
VLCTreeItem
*
o_parent
;
NSMutableArray
*
o_children
;
int
i_object_category
;
}
+
(
VLCTreeItem
*
)
rootItem
;
...
...
@@ -35,6 +36,7 @@
-
(
int
)
getObjectID
;
-
(
NSString
*
)
getName
;
-
(
BOOL
)
hasPrefs
:(
NSString
*
)
o_module_name
;
-
(
NSView
*
)
showView
:(
NSScrollView
*
)
o_prefs_view
;
@end
...
...
modules/gui/macosx/prefs.m
View file @
66bf046e
...
...
@@ -46,8 +46,12 @@
#include <sys/param.h>
/* for MAXPATHLEN */
#include <string.h>
#include <vlc/vlc.h>
#include <vlc_config_cat.h>
#include "intf.h"
#include "prefs.h"
#include "prefs_widgets.h"
#include "vlc_keys.h"
/*****************************************************************************
...
...
@@ -144,8 +148,10 @@ static VLCPrefs *_o_sharedMainInstance = nil;
if
(
i_return
==
NSAlertAlternateReturn
)
{
config_ResetAll
(
p_intf
);
[
self
showViewForID
:
[[
o_tree
itemAtRow
:[
o_tree
selectedRow
]]
getObjectID
]
[[
o_tree
itemAtRow
:[
o_tree
selectedRow
]]
showView
:
o_prefs_view
];
/* [self showViewForID: [[o_tree itemAtRow:[o_tree selectedRow]] getObjectID]
andName: [[o_tree itemAtRow:[o_tree selectedRow]] getName]];
*/
}
}
...
...
@@ -154,8 +160,10 @@ static VLCPrefs *_o_sharedMainInstance = nil;
b_advanced
=
!
b_advanced
;
[
o_advanced_ckb
setState
:
b_advanced
];
/* refresh the view of the current treeitem */
/* [self showViewForID: [[o_tree itemAtRow:[o_tree selectedRow]] getObjectID]
andName: [[o_tree itemAtRow:[o_tree selectedRow]] getName]]; */
[[
o_tree
itemAtRow
:[
o_tree
selectedRow
]]
showView
:
o_prefs_view
];
/* [self showViewForID: [[o_tree itemAtRow:[o_tree selectedRow]] getObjectID]
andName: [[o_tree itemAtRow:[o_tree selectedRow]] getName]];
*/
}
-
(
void
)
loadConfigTree
...
...
@@ -169,9 +177,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
/* update the document view to the view of the selected tree item */
-
(
void
)
outlineViewSelectionDidChange
:(
NSNotification
*
)
o_notification
{
/*
[self showViewForID: [[o_tree itemAtRow:[o_tree selectedRow]] getObjectID]
andName: [[o_tree itemAtRow:[o_tree selectedRow]] getName]];*/
[[
o_tree
itemAtRow
:[
o_tree
selectedRow
]]
showView
:
o_prefs_view
];
}
@end
...
...
@@ -202,7 +208,7 @@ static VLCTreeItem *o_root_item = nil;
#define IsALeafNode ((id)-1)
-
(
id
)
initWithName
:
(
NSString
*
)
o_item_name
ID
:
(
int
)
i_id
parent
:(
VLCTreeItem
*
)
o_parent_item
-
(
id
)
initWithName
:
(
NSString
*
)
o_item_name
ID
:
(
int
)
i_id
parent
:(
VLCTreeItem
*
)
o_parent_item
children
:(
NSMutableArray
*
)
o_children_array
whithCategory
:
(
int
)
i_category
{
self
=
[
super
init
];
...
...
@@ -211,12 +217,14 @@ static VLCTreeItem *o_root_item = nil;
o_name
=
[
o_item_name
copy
];
i_object_id
=
i_id
;
o_parent
=
o_parent_item
;
o_children
=
o_children_array
;
i_object_category
=
i_category
;
}
return
(
self
);
}
+
(
VLCTreeItem
*
)
rootItem
{
if
(
o_root_item
==
nil
)
o_root_item
=
[[
VLCTreeItem
alloc
]
initWithName
:
@"main"
ID
:
0
parent
:
nil
];
if
(
o_root_item
==
nil
)
o_root_item
=
[[
VLCTreeItem
alloc
]
initWithName
:
@"main"
ID
:
0
parent
:
nil
children
:
[[
NSMutableArray
alloc
]
initWithCapacity
:
10
]
whithCategory
:
-
1
];
return
o_root_item
;
}
...
...
@@ -231,13 +239,15 @@ static VLCTreeItem *o_root_item = nil;
* Loads children incrementally */
-
(
NSArray
*
)
children
{
if
(
o_children
==
NULL
)
if
(
o_children
==
IsALeafNode
)
return
o_children
;
if
(
[
o_children
count
]
==
0
)
{
intf_thread_t
*
p_intf
=
VLCIntf
;
vlc_list_t
*
p_list
;
module_t
*
p_module
=
NULL
;
module_config_t
*
p_item
;
int
i_index
,
j
;
int
i_index
;
/* List the modules */
p_list
=
vlc_list_find
(
p_intf
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
...
...
@@ -262,40 +272,35 @@ static VLCTreeItem *o_root_item = nil;
if
(
i_index
<
p_list
->
i_count
)
{
/* We found the main module */
/* Enumerate config categories and store a reference so we can
* generate their config panel them when it is asked by the user. */
VLCTreeItem
*
p_last_category
=
NULL
;
p_item
=
p_module
->
p_config
;
o_children
=
[[
NSMutableArray
alloc
]
initWithCapacity
:
10
];
if
(
p_item
)
do
{
NSString
*
o_child_name
;
switch
(
p_item
->
i_type
)
{
case
CONFIG_HINT_CATEGORY
:
o_child_name
=
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
];
[
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
o_child_name
ID:
p_module
->
i_object_id
parent
:
self
]];
case
CONFIG_CATEGORY
:
o_child_name
=
[[
VLCMain
sharedInstance
]
localizedString
:
config_CategoryNameGet
(
p_item
->
i_value
)
];
p_last_category
=
[
VLCTreeItem
alloc
];
[
o_children
addObject
:[
p_last_category
initWithName
:
o_child_name
ID:
p_item
->
i_value
parent
:
self
children
:[[
NSMutableArray
alloc
]
initWithCapacity
:
10
]
whithCategory
:
p_item
-
p_module
->
p_config
]];
break
;
case
CONFIG_SUBCATEGORY
:
o_child_name
=
[[
VLCMain
sharedInstance
]
localizedString
:
config_CategoryNameGet
(
p_item
->
i_value
)
];
[
p_last_category
->
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
o_child_name
ID:
p_item
->
i_value
parent
:
p_last_category
children
:[[
NSMutableArray
alloc
]
initWithCapacity
:
10
]
whithCategory
:
p_item
-
p_module
->
p_config
]];
break
;
default:
break
;
}
}
while
(
p_item
->
i_type
!=
CONFIG_HINT_END
&&
p_item
++
);
}
while
(
p_item
->
i_type
!=
CONFIG_HINT_END
&&
p_item
++
);
/* Add the modules item */
[
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
_NS
(
"Modules"
)
ID:
0
parent
:
self
]];
}
else
{
o_children
=
IsALeafNode
;
}
}
else
if
(
[[
self
getName
]
isEqualToString
:
_NS
(
"Modules"
)]
)
{
/* Build a tree of the plugins */
/* Add the capabilities */
o_children
=
[[
NSMutableArray
alloc
]
initWithCapacity
:
10
];
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
{
p_module
=
(
module_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
...
...
@@ -304,121 +309,73 @@ static VLCTreeItem *o_root_item = nil;
if
(
!
strcmp
(
p_module
->
psz_object_name
,
"main"
)
)
continue
;
/* Exclude empty modules */
/* Exclude empty plugins (submodules don't have config options, they
* are stored in the parent module) */
if
(
p_module
->
b_submodule
)
continue
;
else
p_item
=
p_module
->
p_config
;
if
(
!
p_item
)
continue
;
int
i_category
=
-
1
;
int
i_subcategory
=
-
1
;
int
i_options
=
0
;
do
{
if
(
p_item
->
i_type
&
CONFIG_ITEM
)
break
;
}
while
(
p_item
->
i_type
!=
CONFIG_HINT_END
&&
p_item
++
);
if
(
p_item
->
i_type
==
CONFIG_HINT_END
)
continue
;
/* Create the capability tree if it doesn't already exist */
NSString
*
o_capability
;
o_capability
=
[[
VLCMain
sharedInstance
]
localizedString
:
p_module
->
psz_capability
];
if
(
!
p_module
->
psz_capability
||
!*
p_module
->
psz_capability
)
{
/* Empty capability ? Let's look at the submodules */
module_t
*
p_submodule
;
for
(
j
=
0
;
j
<
p_module
->
i_children
;
j
++
)
{
p_submodule
=
(
module_t
*
)
p_module
->
pp_children
[
j
];
if
(
p_submodule
->
psz_capability
&&
*
p_submodule
->
psz_capability
)
{
o_capability
=
[[
VLCMain
sharedInstance
]
localizedString
:
p_submodule
->
psz_capability
];
BOOL
b_found
=
FALSE
;
for
(
j
=
0
;
j
<
(
int
)[
o_children
count
];
j
++
)
if
(
p_item
->
i_type
==
CONFIG_CATEGORY
)
{
if
(
[[[
o_children
objectAtIndex
:
j
]
getName
]
isEqualToString
:
o_capability
]
)
{
b_found
=
TRUE
;
break
;
i_category
=
p_item
->
i_value
;
}
}
if
(
!
b_found
)
else
if
(
p_item
->
i_type
==
CONFIG_SUBCATEGORY
)
{
[
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
o_capability
ID:
0
parent
:
self
]];
i_subcategory
=
p_item
->
i_value
;
}
}
}
}
BOOL
b_found
=
FALSE
;
for
(
j
=
0
;
j
<
(
int
)[
o_children
count
];
j
++
)
{
if
(
[[[
o_children
objectAtIndex
:
j
]
getName
]
isEqualToString
:
o_capability
]
)
if
(
p_item
->
i_type
&
CONFIG_ITEM
)
i_options
++
;
if
(
i_options
>
0
&&
i_category
>=
0
&&
i_subcategory
>=
0
)
{
b_found
=
TRUE
;
break
;
}
}
if
(
!
b_found
)
{
[
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
o_capability
ID:
0
parent
:
self
]];
}
}
}
else
if
(
[[
o_parent
getName
]
isEqualToString
:
_NS
(
"Modules"
)]
)
{
/* Now add the modules */
o_children
=
[[
NSMutableArray
alloc
]
initWithCapacity
:
10
];
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
{
p_module
=
(
module_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
}
while
(
p_item
->
i_type
!=
CONFIG_HINT_END
&&
p_item
++
);
if
(
!
i_options
)
continue
;
/* Exclude the main module */
if
(
!
strcmp
(
p_module
->
psz_object_name
,
"main"
)
)
continue
;
/* Find the right category item */
/* Exclude empty modules */
p_item
=
p_module
->
p_config
;
if
(
!
p_item
)
continue
;
do
long
cookie
;
vlc_bool_t
b_found
=
VLC_FALSE
;
int
i
;
VLCTreeItem
*
p_category_item
,
*
p_subcategory_item
;
for
(
i
=
0
;
i
<
[
o_children
count
]
;
i
++
)
{
if
(
p_item
->
i_type
&
CONFIG_ITEM
)
p_category_item
=
[
o_children
objectAtIndex
:
i
];
if
(
p_category_item
->
i_object_id
==
i_category
)
{
b_found
=
VLC_TRUE
;
break
;
}
while
(
p_item
->
i_type
!=
CONFIG_HINT_END
&&
p_item
++
);
if
(
p_item
->
i_type
==
CONFIG_HINT_END
)
continue
;
}
if
(
!
b_found
)
continue
;
/* Check the capability */
NSString
*
o_capability
;
o_capability
=
[[
VLCMain
sharedInstance
]
localizedString
:
p_module
->
psz_capability
];
if
(
!
p_module
->
psz_capability
||
!*
p_module
->
psz_capability
)
{
/* Empty capability ? Let's look at the submodules */
module_t
*
p_submodule
;
for
(
j
=
0
;
j
<
p_module
->
i_children
;
j
++
)
/* Find subcategory item */
b_found
=
VLC_FALSE
;
cookie
=
-
1
;
for
(
i
=
0
;
i
<
[
p_category_item
->
o_children
count
]
;
i
++
)
{
p_submodule
=
(
module_t
*
)
p_module
->
pp_children
[
j
];
if
(
p_submodule
->
psz_capability
&&
*
p_submodule
->
psz_capabilit
y
)
p_subcategory_item
=
[
p_category_item
->
o_children
objectAtIndex
:
i
];
if
(
p_subcategory_item
->
i_object_id
==
i_subcategor
y
)
{
o_capability
=
[[
VLCMain
sharedInstance
]
localizedString
:
p_submodule
->
psz_capability
];
if
(
[
o_capability
isEqualToString
:
[
self
getName
]]
)
{
[
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_module
->
psz_object_name
]
ID:
p_module
->
i_object_id
parent
:
self
]];
}
}
b_found
=
VLC_TRUE
;
break
;
}
}
else
if
(
[
o_capability
isEqualToString
:
[
self
getName
]]
)
{
[
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
if
(
!
b_found
)
p_subcategory_item
=
p_category_item
;
[
p_subcategory_item
->
o_children
addObject
:[[
VLCTreeItem
alloc
]
initWithName
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_module
->
psz_object_name
]
ID:
p_module
->
i_object_id
parent
:
self
]];
}
}
ID:
p_module
->
i_object_id
parent
:
p_subcategory_item
children
:
IsALeafNode
whithCategory
:
-
1
]];
}
else
{
/* all the other stuff are leafs */
o_children
=
IsALeafNode
;
}
vlc_list_release
(
p_list
);
}
...
...
@@ -474,6 +431,159 @@ static VLCTreeItem *o_root_item = nil;
return
(
NO
);
}
-
(
NSView
*
)
showView
:(
NSScrollView
*
)
o_prefs_view
{
fprintf
(
stderr
,
"[%s] showView
\n
"
,
[
o_name
UTF8String
]
);
vlc_list_t
*
p_list
;
intf_thread_t
*
p_intf
=
VLCIntf
;
module_t
*
p_parser
;
module_config_t
*
p_item
,
*
p_first_item
;
NSView
*
o_view
;
NSRect
s_rc
;
/* rect */
NSTextField
*
o_text_field
;
/* input field / label */
NSRect
s_vrc
;
/* view rect */
NSString
*
o_module_name
;
int
i_pos
,
i_module_tag
;
NSPoint
o_pos
;
vlc_bool_t
b_advanced
=
VLC_TRUE
;
s_vrc
=
[[
o_prefs_view
contentView
]
bounds
];
s_vrc
.
size
.
height
-=
4
;
o_view
=
[[
NSView
alloc
]
initWithFrame
:
s_vrc
];
p_list
=
vlc_list_find
(
p_intf
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
/* Get a pointer to the module */
if
(
i_object_category
==
-
1
)
{
p_parser
=
(
module_t
*
)
vlc_object_get
(
p_intf
,
i_object_id
);
if
(
!
p_parser
||
p_parser
->
i_object_type
!=
VLC_OBJECT_MODULE
)
{
/* 0OOoo something went really bad */
vlc_list_release
(
p_list
);
return
o_view
;
}
o_module_name
=
[
NSString
stringWithUTF8String
:
p_parser
->
psz_object_name
];
fprintf
(
stderr
,
"showView: going to show [%d] %s
\n
"
,
i_object_id
,
p_parser
->
psz_object_name
);
p_first_item
=
p_item
=
p_parser
->
p_config
;
}
else
{
int
i_index
;
if
(
!
p_list
)
return
o_view
;
/*
* Find the main module
*/
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
{
p_parser
=
(
module_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
if
(
!
strcmp
(
p_parser
->
psz_object_name
,
"main"
)
)
break
;
}
if
(
p_parser
==
NULL
)
{
msg_Err
(
p_intf
,
"could not find the main module in our preferences"
);
return
o_view
;
}
p_first_item
=
p_item
=
(
p_parser
->
p_config
+
i_object_category
);
}
o_view
=
nil
;
i_module_tag
=
3
;
/* These defines should come from "Apple Human Interface Guidelines" */
#define X_ORIGIN 20
#define Y_ORIGIN 17
#define Y_INTER 8
/* Init View */
s_vrc
=
[[
o_prefs_view
contentView
]
bounds
];
s_vrc
.
size
.
height
-=
4
;
o_view
=
[[
VLCFlippedView
alloc
]
initWithFrame
:
s_vrc
];
[
o_view
setAutoresizingMask
:
NSViewWidthSizable
];
o_pos
.
x
=
X_ORIGIN
;
o_pos
.
y
=
Y_ORIGIN
;
BOOL
b_right_cat
=
TRUE
;
if
(
p_item
)
do
;
while
(
(
p_item
->
i_type
==
CONFIG_CATEGORY
||
p_item
->
i_type
==
CONFIG_SUBCATEGORY
)
&&
p_item
++
);
if
(
p_item
)
do
{
fprintf
(
stderr
,
"Category: %d
\n
"
,
p_item
->
i_type
);
if
(
p_item
->
i_type
==
CONFIG_HINT_CATEGORY
)
{
if
(
!
strcmp
(
p_parser
->
psz_object_name
,
"main"
)
&&
[
o_name
isEqualToString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]]
)
b_right_cat
=
TRUE
;
else
if
(
strcmp
(
p_parser
->
psz_object_name
,
"main"
)
)
b_right_cat
=
TRUE
;
else
b_right_cat
=
FALSE
;
}
else
if
(
p_item
->
i_type
==
CONFIG_HINT_END
&&
!
strcmp
(
p_parser
->
psz_object_name
,
"main"
)
)
b_right_cat
=
FALSE
;
if
(
(
p_item
->
b_advanced
&&
!
b_advanced
)
||
!
b_right_cat
)
{
continue
;
}
fprintf
(
stderr
,
"Creating view for: %s
\n
"
,
p_item
->
psz_name
);
VLCConfigControl
*
o_control
=
nil
;
switch
(
p_item
->
i_type
)
{
case
CONFIG_ITEM_STRING
:
{
if
(
!
p_item
->
i_list
)
o_control
=
[
StringConfigControl
newControl
:
p_item
withView:
o_view
withObject
:
p_intf
offset
:
o_pos
];
else
o_control
=
[
StringListConfigControl
newControl
:
p_item
withView:
o_view
withObject
:
p_intf
offset
:
o_pos
];
}
break
;
case
CONFIG_ITEM_FILE
:
case
CONFIG_ITEM_DIRECTORY
:
{
o_control
=
[
FileConfigControl
newControl
:
p_item
withView
:
o_view
withObject:
p_intf
offset
:
o_pos
];
}
break
;
case
CONFIG_ITEM_INTEGER
:
{
if
(
!
p_item
->
i_list
)
o_control
=
[
IntegerConfigControl
newControl
:
p_item
withView:
o_view
withObject
:
p_intf
offset
:
o_pos
];
else
if
(
p_item
->
i_min
!=
0
||
p_item
->
i_max
!=
0
)
o_control
=
[
RangedIntegerConfigControl
newControl
:
p_item
withView:
o_view
withObject
:
p_intf
offset
:
o_pos
];
else
o_control
=
[
IntegerListConfigControl
newControl
:
p_item
withView:
o_view
withObject
:
p_intf
offset
:
o_pos
];
}
break
;
case
CONFIG_ITEM_KEY
:
{
o_control
=
[
KeyConfigControl
newControl
:
p_item
withView
:
o_view
withObject
:
p_intf
offset
:
o_pos
];
}
break
;
}
if
(
o_control
!=
nil
)
{
[
o_view
addSubview
:
o_control
];
o_pos
.
y
+=
[
o_control
frame
].
size
.
height
+
Y_INTER
;
}
#undef Y_ORIGIN
#undef X_ORIGIN
}
while
(
p_item
->
i_type
!=
CONFIG_HINT_END
&&
p_item
->
i_type
!=
CONFIG_CATEGORY
&&
p_item
->
i_type
!=
CONFIG_SUBCATEGORY
&&
p_item
++
);
vlc_object_release
(
p_parser
);
vlc_list_release
(
p_list
);
[
o_prefs_view
setDocumentView
:
o_view
];
[
o_prefs_view
setNeedsDisplay
:
TRUE
];
return
o_view
;
}
@end
...
...
modules/gui/macosx/prefs_widgets.h
View file @
66bf046e
...
...
@@ -22,16 +22,18 @@
*****************************************************************************/
@interface
VLCConfigControl
:
NS
Box
@interface
VLCConfigControl
:
NS
View
{
vlc_object_t
*
p_this
;
module_config_t
*
p_item
;
char
*
psz_name
;
NSTextField
*
o_label
;
int
i_type
;
vlc_bool_t
b_advanced
;
NSView
*
contentView
;
}
+
(
VLCConfigControl
*
)
newControl
:
(
module_config_t
*
)
p_item
withView
:
(
NSView
*
)
o_parent_view
withObject
:
(
vlc_object_t
*
)
p_this
;
+
(
VLCConfigControl
*
)
newControl
:
(
module_config_t
*
)
p_item
withView
:
(
NSView
*
)
o_parent_view
withObject
:
(
vlc_object_t
*
)
p_this
offset
:(
NSPoint
)
offset
;
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
;
-
(
NSString
*
)
getName
;
-
(
int
)
getType
;
...
...
@@ -50,6 +52,7 @@
}
@end
#if 0
@interface ModuleConfigControl : VLCConfigControl
{
...
...
@@ -57,7 +60,7 @@
}
@end
#endif
@interface
StringConfigControl
:
VLCConfigControl
{
NSTextField
*
o_textfield
;
...
...
@@ -71,7 +74,6 @@
}
@end
@interface
FileConfigControl
:
VLCConfigControl
{
NSTextField
*
o_textfield
;
...
...
@@ -114,6 +116,7 @@
-
(
void
)
textfieldChanged
:(
NSNotification
*
)
o_notification
;
@end
#if 0
@interface FloatConfigControl : VLCConfigControl
{
...
...
@@ -142,3 +145,4 @@
}
@end
#endif
\ No newline at end of file
modules/gui/macosx/prefs_widgets.m
View file @
66bf046e
...
...
@@ -35,7 +35,7 @@
#define PREFS_WRAP 300
#define OFFSET_RIGHT 20
#define OFFSET_BETWEEN
10
#define OFFSET_BETWEEN
2
@implementation
VLCConfigControl
...
...
@@ -47,7 +47,7 @@
}
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
self
=
[
super
initWithFrame
:
frame
];
...
...
@@ -55,6 +55,7 @@
if
(
self
!=
nil
)
{
p_this
=
_p_this
;
p_item
=
_p_item
;
o_label
=
NULL
;
psz_name
=
strdup
(
p_item
->
psz_name
);
i_type
=
p_item
->
i_type
;
...
...
@@ -72,67 +73,68 @@
}
+
(
VLCConfigControl
*
)
newControl
:
(
module_config_t
*
)
p_item
withView
:
(
NSView
*
)
o_parent_view
withObject
:
(
vlc_object_t
*
)
_p_this
+
(
VLCConfigControl
*
)
newControl
:
(
module_config_t
*
)
_p_item
withView
:
(
NSView
*
)
o_parent_view
withObject
:
(
vlc_object_t
*
)
_p_this
offset
:(
NSPoint
)
offset
{
VLCConfigControl
*
p_control
=
NULL
;
NSRect
frame
=
[
o_parent_view
bounds
];
switch
(
p_item
->
i_type
)
NSRect
frame
=
[
o_parent_view
frame
];
/*FIXME: Why do we need to divide by two ??? */
frame
.
origin
.
x
=
offset
.
x
;
frame
.
origin
.
y
=
offset
.
y
;
frame
.
size
.
width
-=
OFFSET_RIGHT
;
switch
(
_p_item
->
i_type
)
{
#if 0
case CONFIG_ITEM_MODULE:
p_control
=
[[
ModuleConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control = [[ModuleConfigControl alloc] initWithFrame: frame item:
_
p_item withObject: _p_this ];
break;
#endif
case
CONFIG_ITEM_STRING
:
if
(
!
p_item
->
i_list
)
if
(
!
_
p_item
->
i_list
)
{
p_control
=
[[
StringConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control
=
[[
StringConfigControl
alloc
]
initWithFrame
:
frame
item
:
_
p_item
withObject
:
_p_this
];
}
else
{
p_control
=
[[
StringListConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control
=
[[
StringListConfigControl
alloc
]
initWithFrame
:
frame
item
:
_
p_item
withObject
:
_p_this
];
}
break
;
case
CONFIG_ITEM_FILE
:
case
CONFIG_ITEM_DIRECTORY
:
p_control
=
[[
FileConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control
=
[[
FileConfigControl
alloc
]
initWithFrame
:
frame
item
:
_
p_item
withObject
:
_p_this
];
break
;
case
CONFIG_ITEM_INTEGER
:
if
(
p_item
->
i_list
)
if
(
_
p_item
->
i_list
)
{
p_control
=
[[
IntegerListConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control
=
[[
IntegerListConfigControl
alloc
]
initWithFrame
:
frame
item
:
_
p_item
withObject
:
_p_this
];
}
else
if
(
p_item
->
i_min
!=
0
||
p_item
->
i_max
!=
0
)
else
if
(
_p_item
->
i_min
!=
0
||
_
p_item
->
i_max
!=
0
)
{
p_control
=
[[
RangedIntegerConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control
=
[[
RangedIntegerConfigControl
alloc
]
initWithFrame
:
frame
item
:
_
p_item
withObject
:
_p_this
];
}
else
{
p_control
=
[[
IntegerConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control
=
[[
IntegerConfigControl
alloc
]
initWithFrame
:
frame
item
:
_
p_item
withObject
:
_p_this
];
}
break
;
case
CONFIG_ITEM_KEY
:
p_control
=
[[
KeyConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control
=
[[
KeyConfigControl
alloc
]
initWithFrame
:
frame
item
:
_
p_item
withObject
:
_p_this
];
break
;
#if 0
case CONFIG_ITEM_FLOAT:
if
(
p_item
->
f_min
!=
0
||
p_item
->
f_max
!=
0
)
if(
_p_item->f_min != 0 || _
p_item->f_max != 0 )
{
p_control
=
[[
RangedFloatConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control = [[RangedFloatConfigControl alloc] initWithFrame: frame item:
_
p_item withObject: _p_this ];
}
else
{
p_control
=
[[
FloatConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control = [[FloatConfigControl alloc] initWithFrame: frame item:
_
p_item withObject: _p_this ];
}
break;
case CONFIG_ITEM_BOOL:
p_control
=
[[
BoolConfigControl
alloc
]
initWithFrame
:
frame
item
:
p_item
withObject
:
_p_this
];
p_control = [[BoolConfigControl alloc] initWithFrame: frame item:
_
p_item withObject: _p_this ];
break;
#endif
default:
break
;
}
...
...
@@ -141,7 +143,7 @@
-
(
NSString
*
)
getName
{
return
[
NSApp
localizedString
:
psz_name
];
return
[
[
VLCMain
sharedInstance
]
localizedString
:
psz_name
];
}
-
(
int
)
getType
...
...
@@ -171,16 +173,15 @@
@end
@implementation
KeyConfigControl
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
frame
.
size
.
height
=
80
;
if
(
self
=
[
super
initWithFrame
:
frame
item
:
p_item
withObject:
_p_this
]
)
if
(
(
self
=
[
super
initWithFrame
:
frame
item
:
_
p_item
withObject:
_p_this
]
)
)
{
NSRect
s_rc
=
frame
;
unsigned
int
i
;
...
...
@@ -192,7 +193,7 @@
NSButtonCell
*
o_current_cell
=
[
o_cells
objectAtIndex
:
i
];
[
o_current_cell
setButtonType
:
NSSwitchButton
];
[
o_current_cell
setControlSize
:
NSSmallControlSize
];
[
o_matrix
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]
forCell
:
o_current_cell
];
[
o_matrix
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]
forCell
:
o_current_cell
];
switch
(
i
)
{
...
...
@@ -216,7 +217,7 @@
}
[
o_matrix
sizeToCells
];
[
o_matrix
setAutoresizingMask
:
NSViewMaxXMargin
];
[
[
self
contentView
]
addSubview
:
o_matrix
];
[
self
addSubview
:
o_matrix
];
/* add the combo box */
s_rc
.
origin
.
x
+=
[
o_matrix
frame
].
size
.
width
+
OFFSET_BETWEEN
;
...
...
@@ -225,17 +226,17 @@
o_combo
=
[[[
NSComboBox
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_combo
setAutoresizingMask
:
NSViewMaxXMargin
];
[
o_combo
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_combo
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
for
(
i
=
0
;
i
<
sizeof
(
vlc_keys
)
/
sizeof
(
key_descriptor_t
);
i
++
)
{
if
(
vlc_keys
[
i
].
psz_key_string
&&
*
vlc_keys
[
i
].
psz_key_string
)
[
o_combo
addItemWithObjectValue
:
[
NSApp
localizedString
:
vlc_keys
[
i
].
psz_key_string
]];
[
o_combo
addItemWithObjectValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
vlc_keys
[
i
].
psz_key_string
]];
}
[
o_combo
setStringValue
:
[
NSApp
localizedString
:
KeyToString
((
((
unsigned
int
)
p_item
->
i_value
)
&
~
KEY_MODIFIER
))]];
[
[
self
contentView
]
addSubview
:
o_combo
];
[
o_combo
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
KeyToString
((
((
unsigned
int
)
p_item
->
i_value
)
&
~
KEY_MODIFIER
))]];
[
self
addSubview
:
o_combo
];
/* add the label */
s_rc
.
origin
.
y
+=
50
;
...
...
@@ -246,10 +247,10 @@
[
o_label
setEditable
:
NO
];
[
o_label
setSelectable
:
NO
];
if
(
p_item
->
psz_text
)
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_label
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]];
[
o_label
sizeToFit
];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview
:
o_label
];
[
o_label
setAutoresizingMask
:
NSViewMaxXMargin
];
}
return
self
;
...
...
@@ -298,6 +299,7 @@
@end
#if 0
@implementation ModuleConfigControl
...
...
@@ -321,10 +323,10 @@
[o_label setEditable: NO];
[o_label setSelectable: NO];
if ( p_item->psz_text )
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[o_label setStringValue: [
[VLCMain sharedInstance]
localizedString: p_item->psz_text]];
[o_label sizeToFit];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview: o_label];
[o_label setAutoresizingMask:NSViewMaxXMargin ];
/* build the popup */
...
...
@@ -332,10 +334,10 @@
s_rc.size.width = 200;
o_popup = [[[NSPopUpButton alloc] initWithFrame: s_rc] retain];
[
[
self
contentView
]
addSubview
:
o_popup
];
[
self
addSubview: o_popup];
[o_popup setAutoresizingMask:NSViewMinXMargin ];
[
o_popup
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[o_popup setToolTip: [
[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]];
[o_popup addItemWithTitle: _NS("Default")];
[[o_popup lastItem] setTag: -1];
[o_popup selectItem: [o_popup lastItem]];
...
...
@@ -404,18 +406,20 @@
}
@end
#endif
@implementation
StringConfigControl
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
frame
.
size
.
height
=
22
;
if
(
self
=
[
super
initWithFrame
:
frame
item
:
p_item
withObject:
_p_this
]
)
if
(
(
self
=
[
super
initWithFrame
:
frame
item
:
_
p_item
withObject:
_p_this
]
)
)
{
NSRect
s_rc
=
frame
;
s_rc
.
size
.
height
=
17
;
s_rc
.
origin
.
x
=
0
;
s_rc
.
origin
.
y
=
3
;
/* add the label */
o_label
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_label
setDrawsBackground
:
NO
];
...
...
@@ -423,22 +427,25 @@
[
o_label
setEditable
:
NO
];
[
o_label
setSelectable
:
NO
];
if
(
p_item
->
psz_text
)
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_label
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]];
[
o_label
sizeToFit
];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview
:
o_label
];
[
o_label
setAutoresizingMask
:
NSViewMaxXMargin
];
/* build the textfield */
s_rc
.
origin
.
x
=
s_rc
.
size
.
width
-
200
-
OFFSET_RIGHT
;
s_rc
.
origin
.
y
=
0
;
s_rc
.
size
.
height
=
22
;
s_rc
.
size
.
width
=
200
;
o_textfield
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_textfield
setAutoresizingMask
:
NSViewMinXMargin
|
NSViewWidthSizable
];
[
o_textfield
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_textfield
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_value
]];
[[
self
contentView
]
addSubview
:
o_textfield
];
[
o_textfield
setToolTip
:
[[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
if
(
p_item
->
psz_value
)
[
o_textfield
setStringValue
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_value
]];
[
self
addSubview
:
o_textfield
];
}
return
self
;
}
...
...
@@ -459,15 +466,18 @@
@implementation
StringListConfigControl
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
frame
.
size
.
height
=
2
0
;
if
(
self
=
[
super
initWithFrame
:
frame
item
:
p_item
withObject:
_p_this
]
)
frame
.
size
.
height
=
2
4
;
if
(
(
self
=
[
super
initWithFrame
:
frame
item
:
_
p_item
withObject:
_p_this
]
)
)
{
NSRect
s_rc
=
frame
;
int
i_index
;
s_rc
.
size
.
height
=
17
;
s_rc
.
origin
.
x
=
0
;
s_rc
.
origin
.
y
=
5
;
/* add the label */
o_label
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
...
...
@@ -476,14 +486,16 @@
[
o_label
setEditable
:
NO
];
[
o_label
setSelectable
:
NO
];
if
(
p_item
->
psz_text
)
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_label
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]];
[
o_label
sizeToFit
];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview
:
o_label
];
[
o_label
setAutoresizingMask
:
NSViewMaxXMargin
];
/* build the textfield */
s_rc
.
origin
.
x
=
s_rc
.
size
.
width
-
200
-
OFFSET_RIGHT
;
s_rc
.
origin
.
y
=
0
;
s_rc
.
size
.
height
=
26
;
s_rc
.
size
.
width
=
200
;
o_combo
=
[[[
NSComboBox
alloc
]
initWithFrame
:
s_rc
]
retain
];
...
...
@@ -492,6 +504,7 @@
[
o_combo
setUsesDataSource
:
TRUE
];
[
o_combo
setDataSource
:
self
];
[
o_combo
setNumberOfVisibleItems
:
10
];
[
o_combo
setCompletes
:
YES
];
for
(
i_index
=
0
;
i_index
<
p_item
->
i_list
;
i_index
++
)
{
if
(
p_item
->
psz_value
&&
!
strcmp
(
p_item
->
psz_value
,
p_item
->
ppsz_list
[
i_index
]
)
)
...
...
@@ -500,8 +513,8 @@
}
}
[
o_combo
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_combo
];
[
o_combo
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
self
addSubview
:
o_combo
];
}
return
self
;
}
...
...
@@ -514,9 +527,6 @@
-
(
char
*
)
stringValue
{
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
if
(
[
o_combo
indexOfSelectedItem
]
>=
0
)
return
strdup
(
p_item
->
ppsz_list
[[
o_combo
indexOfSelectedItem
]]
);
else
...
...
@@ -529,38 +539,32 @@
-
(
int
)
numberOfItemsInComboBox
:(
NSComboBox
*
)
aComboBox
{
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
return
p_item
->
i_list
;
}
-
(
id
)
comboBox
:(
NSComboBox
*
)
aComboBox
objectValueForItemAtIndex
:(
int
)
i_index
{
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
if
(
p_item
->
ppsz_list_text
&&
p_item
->
ppsz_list_text
[
i_index
]
)
{
return
[
NSApp
localizedString
:
p_item
->
ppsz_list_text
[
i_index
]];
}
else
return
[
NSApp
localizedString
:
p_item
->
ppsz_list
[
i_index
]];
return
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
ppsz_list_text
[
i_index
]];
}
else
return
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
ppsz_list
[
i_index
]];
}
@end
@implementation
FileConfigControl
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
frame
.
size
.
height
=
49
;
if
(
self
=
[
super
initWithFrame
:
frame
item
:
p_item
withObject:
_p_this
]
)
frame
.
size
.
height
=
53
;
if
(
(
self
=
[
super
initWithFrame
:
frame
item
:
_
p_item
withObject:
_p_this
]
)
)
{
NSRect
s_rc
=
frame
;
s_rc
.
origin
.
y
=
29
;
s_rc
.
size
.
height
=
20
;
s_rc
.
size
.
height
=
17
;
s_rc
.
origin
.
x
=
0
;
s_rc
.
origin
.
y
=
36
;
/* is it a directory */
b_directory
=
(
[
self
getType
]
==
CONFIG_ITEM_DIRECTORY
)
?
YES
:
NO
;
...
...
@@ -572,41 +576,45 @@
[
o_label
setEditable
:
NO
];
[
o_label
setSelectable
:
NO
];
if
(
p_item
->
psz_text
)
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_label
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]];
[
o_label
sizeToFit
];
[
self
addSubview
:
o_label
];
[
o_label
setAutoresizingMask
:
NSViewMaxXMargin
];
[[
self
contentView
]
addSubview
:
o_label
];
/* build the button */
s_rc
.
origin
.
y
=
s_rc
.
origin
.
x
=
0
;
s_rc
.
size
.
height
=
2
2
;
s_rc
.
origin
.
y
=
0
;
s_rc
.
size
.
height
=
3
2
;
o_button
=
[[[
NSButton
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_button
setButtonType
:
NSMomentaryPushInButton
];
[
o_button
setBezelStyle
:
NSRoundedBezelStyle
];
[
o_button
setTitle
:
_NS
(
"Browse..."
)];
/*TODO: enlarge a bit the button...*/
[
o_button
sizeToFit
];
[
o_button
setAutoresizingMask
:
NSViewMinXMargin
];
[
o_button
setFrameOrigin
:
NSMakePoint
(
s_rc
.
size
.
width
-
[
o_button
frame
].
size
.
width
-
OFFSET_RIGHT
,
s_rc
.
origin
.
y
)];
[
o_button
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_button
frame
].
size
.
width
-
OFFSET_RIGHT
/
2
,
s_rc
.
origin
.
y
)];
[
o_button
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_button
setTarget
:
self
];
[
o_button
setAction
:
@selector
(
openFileDialog
:)];
s_rc
.
origin
.
x
=
15
;
s_rc
.
origin
.
y
=
6
;
s_rc
.
size
.
height
=
22
;
s_rc
.
size
.
width
=
s_rc
.
size
.
width
-
OFFSET_BETWEEN
-
[
o_button
frame
].
size
.
width
-
OFFSET_RIGHT
;
s_rc
.
size
.
width
=
s_rc
.
size
.
width
-
OFFSET_BETWEEN
-
[
o_button
frame
].
size
.
width
-
OFFSET_RIGHT
/
2
-
s_rc
.
origin
.
x
;
o_textfield
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_textfield
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_value
]];
[
o_textfield
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
if
(
p_item
->
psz_value
)
[
o_textfield
setStringValue
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_value
]];
[
o_textfield
setToolTip
:
[[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_textfield
setAutoresizingMask
:
NSViewWidthSizable
];
[
[
self
contentView
]
addSubview
:
o_textfield
];
[
[
self
contentView
]
addSubview
:
o_button
];
[
self
addSubview
:
o_textfield
];
[
self
addSubview
:
o_button
];
}
return
self
;
}
...
...
@@ -622,11 +630,11 @@
{
NSOpenPanel
*
o_open_panel
=
[
NSOpenPanel
openPanel
];
[
o_open_panel
setTitle
:
_NS
(
"Select a file or directory
"
)];
[
o_open_panel
setTitle
:
(
b_directory
)?
_NS
(
"Select a directory"
):
_NS
(
"Select a file
"
)];
[
o_open_panel
setPrompt
:
_NS
(
"Select"
)];
[
o_open_panel
setAllowsMultipleSelection
:
NO
];
[
o_open_panel
setCanChooseFiles
:
YES
];
[
o_open_panel
setCanChooseDirectories
:
b_
advanced
];
[
o_open_panel
setCanChooseFiles
:
!
b_directory
];
[
o_open_panel
setCanChooseDirectories
:
b_
directory
];
[
o_open_panel
beginSheetForDirectory
:
nil
file:
nil
types:
nil
...
...
@@ -656,15 +664,17 @@
@implementation
IntegerConfigControl
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
frame
.
size
.
height
=
2
2
;
if
(
self
=
[
super
initWithFrame
:
frame
item
:
p_item
withObject:
_p_this
]
)
frame
.
size
.
height
=
2
5
;
if
(
(
self
=
[
super
initWithFrame
:
frame
item
:
_
p_item
withObject:
_p_this
]
)
)
{
NSRect
s_rc
=
frame
;
s_rc
.
size
.
height
=
17
;
s_rc
.
origin
.
x
=
0
;
s_rc
.
origin
.
y
=
6
;
/* add the label */
o_label
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_label
setDrawsBackground
:
NO
];
...
...
@@ -672,14 +682,16 @@
[
o_label
setEditable
:
NO
];
[
o_label
setSelectable
:
NO
];
if
(
p_item
->
psz_text
)
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_label
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]];
[
o_label
sizeToFit
];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview
:
o_label
];
[
o_label
setAutoresizingMask
:
NSViewMaxXMargin
];
/* build the stepper */
s_rc
.
origin
.
x
=
s_rc
.
size
.
width
-
13
-
OFFSET_RIGHT
;
s_rc
.
origin
.
x
=
s_rc
.
size
.
width
-
16
-
OFFSET_RIGHT
;
s_rc
.
origin
.
y
=
0
;
s_rc
.
size
.
height
=
21
;
o_stepper
=
[[[
NSStepper
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_stepper
sizeToFit
];
...
...
@@ -691,24 +703,26 @@
[
o_stepper
setTarget
:
self
];
[
o_stepper
setAction
:
@selector
(
stepperChanged
:)];
[
o_stepper
sendActionOn
:
NSLeftMouseUpMask
|
NSLeftMouseDownMask
|
NSLeftMouseDraggedMask
];
[
o_stepper
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_stepper
];
[
o_stepper
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
self
addSubview
:
o_stepper
];
/* build the textfield */
s_rc
.
origin
.
x
=
s_rc
.
size
.
width
-
60
-
OFFSET_BETWEEN
-
13
-
OFFSET_RIGHT
;
s_rc
.
size
.
width
=
60
;
s_rc
.
origin
.
x
=
s_rc
.
size
.
width
-
42
-
OFFSET_BETWEEN
-
19
-
OFFSET_RIGHT
;
s_rc
.
origin
.
y
=
3
;
s_rc
.
size
.
width
=
42
;
s_rc
.
size
.
height
=
22
;
o_textfield
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_textfield
setAutoresizingMask
:
NSViewMinXMargin
|
NSViewWidthSizable
];
[
o_textfield
setIntValue
:
p_item
->
i_value
];
[
o_textfield
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_textfield
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_textfield
setDelegate
:
self
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector:
@selector
(
textfieldChanged
:)
name:
NSControlTextDidChangeNotification
object:
o_textfield
];
[
[
self
contentView
]
addSubview
:
o_textfield
];
[
self
addSubview
:
o_textfield
];
}
return
self
;
}
...
...
@@ -740,15 +754,18 @@
@implementation
IntegerListConfigControl
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
frame
.
size
.
height
=
2
0
;
if
(
self
=
[
super
initWithFrame
:
frame
item
:
p_item
withObject:
_p_this
]
)
frame
.
size
.
height
=
2
4
;
if
(
(
self
=
[
super
initWithFrame
:
frame
item
:
_
p_item
withObject:
_p_this
]
)
)
{
NSRect
s_rc
=
frame
;
int
i_index
;
s_rc
.
size
.
height
=
17
;
s_rc
.
origin
.
x
=
0
;
s_rc
.
origin
.
y
=
5
;
/* add the label */
o_label
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
...
...
@@ -757,14 +774,16 @@
[
o_label
setEditable
:
NO
];
[
o_label
setSelectable
:
NO
];
if
(
p_item
->
psz_text
)
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_label
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]];
[
o_label
sizeToFit
];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview
:
o_label
];
[
o_label
setAutoresizingMask
:
NSViewMaxXMargin
];
/* build the textfield */
s_rc
.
origin
.
x
=
s_rc
.
size
.
width
-
200
-
OFFSET_RIGHT
;
s_rc
.
origin
.
y
=
0
;
s_rc
.
size
.
height
=
26
;
s_rc
.
size
.
width
=
200
;
o_combo
=
[[[
NSComboBox
alloc
]
initWithFrame
:
s_rc
]
retain
];
...
...
@@ -773,6 +792,7 @@
[
o_combo
setUsesDataSource
:
TRUE
];
[
o_combo
setDataSource
:
self
];
[
o_combo
setNumberOfVisibleItems
:
10
];
[
o_combo
setCompletes
:
YES
];
for
(
i_index
=
0
;
i_index
<
p_item
->
i_list
;
i_index
++
)
{
if
(
p_item
->
i_value
==
p_item
->
pi_list
[
i_index
]
)
...
...
@@ -781,8 +801,8 @@
}
}
[
o_combo
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_combo
];
[
o_combo
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
self
addSubview
:
o_combo
];
}
return
self
;
}
...
...
@@ -795,9 +815,6 @@
-
(
int
)
intValue
{
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
if
(
[
o_combo
indexOfSelectedItem
]
>=
0
)
return
p_item
->
pi_list
[[
o_combo
indexOfSelectedItem
]];
else
...
...
@@ -810,20 +827,14 @@
-
(
int
)
numberOfItemsInComboBox
:(
NSComboBox
*
)
aComboBox
{
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
return
p_item
->
i_list
;
}
-
(
id
)
comboBox
:(
NSComboBox
*
)
aComboBox
objectValueForItemAtIndex
:(
int
)
i_index
{
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
if
(
p_item
->
ppsz_list_text
&&
p_item
->
ppsz_list_text
[
i_index
]
)
{
return
[
NSApp
localizedString
:
p_item
->
ppsz_list_text
[
i_index
]];
return
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
ppsz_list_text
[
i_index
]];
}
else
return
[
NSString
stringWithFormat
:
@"%i"
,
p_item
->
pi_list
[
i_index
]];
}
...
...
@@ -832,17 +843,17 @@
@implementation
RangedIntegerConfigControl
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
item
:
(
module_config_t
*
)
p_item
item
:
(
module_config_t
*
)
_
p_item
withObject
:
(
vlc_object_t
*
)
_p_this
{
frame
.
size
.
height
=
5
0
;
if
(
self
=
[
super
initWithFrame
:
frame
item
:
p_item
withObject:
_p_this
]
)
frame
.
size
.
height
=
5
1
;
if
(
(
self
=
[
super
initWithFrame
:
frame
item
:
_
p_item
withObject:
_p_this
]
)
)
{
NSRect
s_rc
=
frame
;
s_rc
.
size
.
height
=
20
;
s_rc
.
origin
.
y
=
3
0
;
s_rc
.
size
.
height
=
17
;
s_rc
.
origin
.
x
=
0
;
s_rc
.
origin
.
y
=
32
;
/* add the label */
o_label
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_label
setDrawsBackground
:
NO
];
...
...
@@ -850,16 +861,33 @@
[
o_label
setEditable
:
NO
];
[
o_label
setSelectable
:
NO
];
if
(
p_item
->
psz_text
)
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_label
setStringValue
:
[
[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_text
]];
[
o_label
sizeToFit
];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview
:
o_label
];
[
o_label
setAutoresizingMask
:
NSViewMaxXMargin
];
/* current value textfield */
s_rc
.
size
.
height
=
22
;
s_rc
.
size
.
width
=
40
;
s_rc
.
origin
.
x
=
[
o_label
frame
].
size
.
width
+
OFFSET_RIGHT
;
s_rc
.
origin
.
y
=
29
;
o_textfield
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_textfield
setAutoresizingMask
:
NSViewMinXMargin
];
[
o_textfield
setIntValue
:
p_item
->
i_value
];
[
o_textfield
setToolTip
:
[[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
o_textfield
setDelegate
:
self
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector:
@selector
(
textfieldChanged
:)
name:
NSControlTextDidChangeNotification
object:
o_textfield
];
[
self
addSubview
:
o_textfield
];
/* build the slider */
/* min value textfield */
s_rc
.
origin
.
x
=
15
;
s_rc
.
origin
.
y
=
0
;
s_rc
.
origin
.
x
=
0
;
s_rc
.
size
.
width
=
40
;
o_textfield_min
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
...
...
@@ -868,30 +896,13 @@
[
o_textfield_min
setBordered
:
NO
];
[
o_textfield_min
setEditable
:
NO
];
[
o_textfield_min
setSelectable
:
NO
];
[
o_textfield_min
setIntValue
:
p_item
->
i_min
];
[
o_textfield_min
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[[
self
contentView
]
addSubview
:
o_textfield_min
];
/* the slider */
s_rc
.
size
.
width
=
[[
self
contentView
]
bounds
].
size
.
width
-
OFFSET_RIGHT
-
2
*
OFFSET_BETWEEN
-
3
*
40
;
s_rc
.
origin
.
x
=
40
+
OFFSET_BETWEEN
;
o_slider
=
[[[
NSStepper
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_slider
setAutoresizingMask
:
NSViewWidthSizable
];
[
o_slider
setMaxValue
:
p_item
->
i_max
];
[
o_slider
setMinValue
:
p_item
->
i_min
];
[
o_slider
setIntValue
:
p_item
->
i_value
];
[
o_slider
setTarget
:
self
];
[
o_slider
setAction
:
@selector
(
sliderChanged
:)];
[
o_slider
sendActionOn
:
NSLeftMouseUpMask
|
NSLeftMouseDownMask
|
NSLeftMouseDraggedMask
];
[
o_slider
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[[
self
contentView
]
addSubview
:
o_slider
];
[
o_textfield_min
setToolTip
:
[[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
self
addSubview
:
o_textfield_min
];
/* max value textfield */
s_rc
.
size
.
width
=
40
;
s_rc
.
origin
.
x
=
[
[
self
contentView
]
bounds
].
size
.
width
-
OFFSET_RIGHT
-
OFFSET_BETWEEN
-
2
*
40
;
s_rc
.
origin
.
x
=
[
self
bounds
].
size
.
width
-
OFFSET_RIGHT
-
40
;
o_textfield_max
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_textfield_max
setAutoresizingMask
:
NSViewMinXMargin
];
...
...
@@ -900,26 +911,29 @@
[
o_textfield_max
setBordered
:
NO
];
[
o_textfield_max
setEditable
:
NO
];
[
o_textfield_max
setSelectable
:
NO
];
[
o_textfield_max
setAlignment
:
NSRightTextAlignment
];
[
o_textfield_max
setIntValue
:
p_item
->
i_max
];
[
o_textfield_max
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_textfield_max
];
[
o_textfield_max
setToolTip
:
[
[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
self
addSubview
:
o_textfield_max
];
/* current value textfield */
s_rc
.
size
.
width
=
40
;
s_rc
.
origin
.
x
=
[[
self
contentView
]
bounds
].
size
.
width
-
OFFSET_RIGHT
-
40
;
/* the slider */
s_rc
.
size
.
height
=
21
;
s_rc
.
size
.
width
=
[
self
bounds
].
size
.
width
-
OFFSET_RIGHT
-
2
*
OFFSET_BETWEEN
-
2
*
40
;
s_rc
.
origin
.
x
=
40
+
OFFSET_BETWEEN
;
s_rc
.
origin
.
y
=
1
;
o_
textfield
=
[[[
NSTextField
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_
textfield
setAutoresizingMask
:
NSViewMinXMargin
];
o_
slider
=
[[[
NSSlider
alloc
]
initWithFrame
:
s_rc
]
retain
];
[
o_
slider
setAutoresizingMask
:
NSViewWidthSizable
];
[
o_
textfield
setIntValue
:
p_item
->
i_value
];
[
o_
textfield
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]
];
[
o_
textfield
setDelegate
:
self
];
[
[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector:
@selector
(
textfieldChanged
:)
name:
NSControlTextDidChangeNotification
object:
o_textfield
];
[
[
self
contentView
]
addSubview
:
o_textfield
];
[
o_
slider
setMaxValue
:
p_item
->
i_max
];
[
o_
slider
setMinValue
:
p_item
->
i_min
];
[
o_
slider
setIntValue
:
p_item
->
i_value
];
[
o_slider
setTarget
:
self
];
[
o_slider
setAction
:
@selector
(
sliderChanged
:)];
[
o_slider
sendActionOn
:
NSLeftMouseUpMask
|
NSLeftMouseDownMask
|
NSLeftMouseDraggedMask
];
[
o_slider
setToolTip
:
[[
VLCMain
sharedInstance
]
wrapString
:
[[
VLCMain
sharedInstance
]
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]
];
[
self
addSubview
:
o_slider
];
}
return
self
;
...
...
@@ -950,6 +964,7 @@
}
@end
#if 0
@implementation FloatConfigControl
...
...
@@ -970,10 +985,10 @@
[o_label setEditable: NO];
[o_label setSelectable: NO];
if( p_item->psz_text )
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[o_label setStringValue: [
[VLCMain sharedInstance]
localizedString: p_item->psz_text]];
[o_label sizeToFit];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview: o_label];
[o_label setAutoresizingMask:NSViewMaxXMargin ];
/* build the textfield */
...
...
@@ -984,8 +999,8 @@
[o_textfield setAutoresizingMask:NSViewMinXMargin | NSViewWidthSizable ];
[o_textfield setFloatValue: p_item->f_value];
[
o_textfield
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_textfield
];
[o_textfield setToolTip: [
[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]];
[
self
addSubview: o_textfield];
}
return self;
}
...
...
@@ -1024,10 +1039,10 @@
[o_label setEditable: NO];
[o_label setSelectable: NO];
if( p_item->psz_text )
[
o_label
setStringValue
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[o_label setStringValue: [
[VLCMain sharedInstance]
localizedString: p_item->psz_text]];
[o_label sizeToFit];
[
[
self
contentView
]
addSubview
:
o_label
];
[
self
addSubview: o_label];
[o_label setAutoresizingMask:NSViewMaxXMargin ];
/* build the slider */
...
...
@@ -1044,11 +1059,11 @@
[o_textfield_min setSelectable: NO];
[o_textfield_min setFloatValue: p_item->f_min];
[
o_textfield_min
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_textfield_min
];
[o_textfield_min setToolTip: [
[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]];
[
self
addSubview: o_textfield_min];
/* the slider */
s_rc
.
size
.
width
=
[
[
self
contentView
]
bounds
].
size
.
width
-
OFFSET_RIGHT
-
2
*
OFFSET_BETWEEN
-
3
*
40
;
s_rc.size.width = [
self
bounds].size.width - OFFSET_RIGHT - 2*OFFSET_BETWEEN - 3*40;
s_rc.origin.x = 40 + OFFSET_BETWEEN;
o_slider = [[[NSStepper alloc] initWithFrame: s_rc] retain];
...
...
@@ -1060,12 +1075,12 @@
[o_slider setTarget: self];
[o_slider setAction: @selector(sliderChanged:)];
[o_slider sendActionOn:NSLeftMouseUpMask|NSLeftMouseDownMask|NSLeftMouseDraggedMask];
[
o_slider
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_slider
];
[o_slider setToolTip: [
[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]];
[
self
addSubview: o_slider];
/* max value textfield */
s_rc.size.width = 40;
s_rc
.
origin
.
x
=
[
[
self
contentView
]
bounds
].
size
.
width
-
OFFSET_RIGHT
-
OFFSET_BETWEEN
-
2
*
40
;
s_rc.origin.x = [
self
bounds].size.width - OFFSET_RIGHT - OFFSET_BETWEEN - 2*40;
o_textfield_max = [[[NSTextField alloc] initWithFrame: s_rc] retain];
[o_textfield_max setAutoresizingMask:NSViewMinXMargin ];
...
...
@@ -1076,24 +1091,24 @@
[o_textfield_max setSelectable: NO];
[o_textfield_max setFloatValue: p_item->f_max];
[
o_textfield_max
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_textfield_max
];
[o_textfield_max setToolTip: [
[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]];
[
self
addSubview: o_textfield_max];
/* current value textfield */
s_rc.size.width = 40;
s_rc
.
origin
.
x
=
[
[
self
contentView
]
bounds
].
size
.
width
-
OFFSET_RIGHT
-
40
;
s_rc.origin.x = [
self
bounds].size.width - OFFSET_RIGHT - 40;
o_textfield = [[[NSTextField alloc] initWithFrame: s_rc] retain];
[o_textfield setAutoresizingMask:NSViewMinXMargin];
[o_textfield setFloatValue: p_item->f_value];
[
o_textfield
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[o_textfield setToolTip: [
[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]];
[o_textfield setDelegate: self];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(textfieldChanged:)
name: NSControlTextDidChangeNotification
object: o_textfield];
[
[
self
contentView
]
addSubview
:
o_textfield
];
[
self
addSubview: o_textfield];
}
return self;
...
...
@@ -1142,9 +1157,9 @@
o_checkbox = [[[NSButton alloc] initWithFrame: s_rc] retain];
[o_checkbox setButtonType: NSSwitchButton];
[o_checkbox setIntValue: p_item->i_value];
[
o_checkbox
setTitle
:
[
NSApp
localizedString
:
p_item
->
psz_text
]];
[
o_checkbox
setToolTip
:
[
NSApp
wrapString
:
[
NSApp
localizedString
:
p_item
->
psz_longtext
]
toWidth
:
PREFS_WRAP
]];
[
[
self
contentView
]
addSubview
:
o_checkbox
];
[o_checkbox setTitle: [
[VLCMain sharedInstance]
localizedString: p_item->psz_text]];
[o_checkbox setToolTip: [
[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]];
[
self
addSubview: o_checkbox];
}
return self;
}
...
...
@@ -1161,3 +1176,5 @@
}
@end
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment