Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
b7fc3b63
Commit
b7fc3b63
authored
Aug 23, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: Remove some #define abuses and assert() when casting a type.
parent
72b44bd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
47 deletions
+72
-47
modules/gui/macosx/simple_prefs.m
modules/gui/macosx/simple_prefs.m
+72
-47
No files found.
modules/gui/macosx/simple_prefs.m
View file @
b7fc3b63
...
@@ -140,27 +140,34 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
...
@@ -140,27 +140,34 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
nil
]
retain
];
nil
]
retain
];
}
}
#define CreateToolbarItem( o_name, o_desc, o_img, sel ) \
o_toolbarItem = create_toolbar_item(o_itemIdent, o_name, o_desc, o_img, self, @selector(sel));
static
inline
NSToolbarItem
*
create_toolbar_item
(
NSString
*
o_itemIdent
,
NSString
*
o_name
,
NSString
*
o_desc
,
NSString
*
o_img
,
id
target
,
SEL
selector
)
{
NSToolbarItem
*
o_toolbarItem
=
[[[
NSToolbarItem
alloc
]
initWithItemIdentifier
:
o_itemIdent
]
autorelease
];
\
[
o_toolbarItem
setLabel
:
o_name
];
[
o_toolbarItem
setPaletteLabel
:
o_desc
];
[
o_toolbarItem
setToolTip
:
o_desc
];
[
o_toolbarItem
setImage
:
[
NSImage
imageNamed
:
o_img
]];
[
o_toolbarItem
setTarget
:
target
];
[
o_toolbarItem
setAction
:
selector
];
[
o_toolbarItem
setEnabled
:
YES
];
[
o_toolbarItem
setAutovalidates
:
YES
];
return
o_toolbarItem
;
}
-
(
NSToolbarItem
*
)
toolbar
:
(
NSToolbar
*
)
o_sprefs_toolbar
-
(
NSToolbarItem
*
)
toolbar
:
(
NSToolbar
*
)
o_sprefs_toolbar
itemForItemIdentifier
:
(
NSString
*
)
o_itemIdent
itemForItemIdentifier
:
(
NSString
*
)
o_itemIdent
willBeInsertedIntoToolbar
:
(
BOOL
)
b_willBeInserted
willBeInsertedIntoToolbar
:
(
BOOL
)
b_willBeInserted
{
{
NSToolbarItem
*
o_toolbarItem
=
nil
;
NSToolbarItem
*
o_toolbarItem
=
nil
;
#define CreateToolbarItem( o_name, o_desc, o_img, sel ) \
o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease]; \
\
[o_toolbarItem setLabel: o_name]; \
[o_toolbarItem setPaletteLabel: o_desc]; \
\
[o_toolbarItem setToolTip: o_desc]; \
[o_toolbarItem setImage: [NSImage imageNamed: o_img]]; \
\
[o_toolbarItem setTarget: self]; \
[o_toolbarItem setAction: @selector( sel )]; \
\
[o_toolbarItem setEnabled: YES]; \
[o_toolbarItem setAutovalidates: YES]
if
(
[
o_itemIdent
isEqual
:
VLCIntfSettingToolbarIdentifier
]
)
if
(
[
o_itemIdent
isEqual
:
VLCIntfSettingToolbarIdentifier
]
)
{
{
CreateToolbarItem
(
_NS
(
"Interface"
),
_NS
(
"Interface Settings"
),
@"spref_cone_Interface_64"
,
showInterfaceSettings
);
CreateToolbarItem
(
_NS
(
"Interface"
),
_NS
(
"Interface Settings"
),
@"spref_cone_Interface_64"
,
showInterfaceSettings
);
...
@@ -645,46 +652,64 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
...
@@ -645,46 +652,64 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
}
}
}
}
-
(
void
)
saveChangedSettings
static
inline
void
save_int_list
(
intf_thread_t
*
p_intf
,
id
object
,
const
char
*
name
)
{
NSNumber
*
p_valueobject
;
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
name
);
p_valueobject
=
(
NSNumber
*
)[[
object
selectedItem
]
representedObject
];
assert
([
p_valueobject
isKindOfClass
:[
NSNumber
class
]]);
if
(
p_valueobject
)
config_PutInt
(
p_intf
,
name
,
[
p_valueobject
intValue
]
);
}
static
inline
void
save_string_list
(
intf_thread_t
*
p_intf
,
id
object
,
const
char
*
name
)
{
NSString
*
p_stringobject
;
module_config_t
*
p_item
;
p_item
=
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
name
);
p_stringobject
=
(
NSString
*
)[[
object
selectedItem
]
representedObject
];
assert
([
p_stringobject
isKindOfClass
:[
NSString
class
]]);
if
(
p_stringobject
)
config_PutPsz
(
p_intf
,
name
,
[
p_stringobject
UTF8String
]
);
}
static
inline
void
save_module_list
(
intf_thread_t
*
p_intf
,
id
object
,
const
char
*
name
)
{
{
module_config_t
*
p_item
;
module_config_t
*
p_item
;
vlc_list_t
*
p_list
;
module_t
*
p_parser
;
module_t
*
p_parser
;
vlc_list_t
*
p_list
;
p_item
=
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
name
);
p_list
=
vlc_list_find
(
VLCIntf
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
for
(
int
i_module_index
=
0
;
i_module_index
<
p_list
->
i_count
;
i_module_index
++
)
{
p_parser
=
(
module_t
*
)
p_list
->
p_values
[
i_module_index
].
p_object
;
if
(
p_item
->
i_type
==
CONFIG_ITEM_MODULE
&&
module_IsCapable
(
p_parser
,
p_item
->
psz_type
)
)
{
if
(
[[[
object
selectedItem
]
title
]
isEqualToString
:
_NS
(
module_GetLongName
(
p_parser
)
)]
)
{
config_PutPsz
(
p_intf
,
name
,
strdup
(
module_GetObjName
(
p_parser
)));
break
;
}
}
}
vlc_list_release
(
p_list
);
if
(
[[[
object
selectedItem
]
title
]
isEqualToString
:
_NS
(
"Default"
)]
)
config_PutPsz
(
p_intf
,
name
,
""
);
}
-
(
void
)
saveChangedSettings
{
char
*
psz_tmp
;
char
*
psz_tmp
;
int
i
;
int
i
;
NSNumber
*
p_valueobject
;
NSString
*
p_stringobject
;
NSString
*
p_stringobject
;
#define SaveIntList( object, name ) \
#define SaveIntList( object, name ) save_int_list( p_intf, object, name )
p_item = config_FindConfig( VLC_OBJECT(p_intf), name ); \
p_valueobject = (NSNumber *)[[object selectedItem] representedObject]; \
if( p_valueobject) config_PutInt( p_intf, name, [p_valueobject intValue] );
#define SaveStringList( object, name ) \
#define SaveStringList( object, name ) save_string_list( p_intf, object, name )
p_item = config_FindConfig( VLC_OBJECT(p_intf), name ); \
p_stringobject = (NSString *)[[object selectedItem] representedObject]; \
if( p_stringobject ) config_PutPsz( p_intf, name, [p_stringobject UTF8String] );
#define SaveModuleList( object, name ) \
#define SaveModuleList( object, name ) save_module_list( p_intf, object, name )
p_item = config_FindConfig( VLC_OBJECT(p_intf), name ); \
\
p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); \
for( int i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ ) \
{ \
p_parser = (module_t *)p_list->p_values[i_module_index].p_object; \
\
if( p_item->i_type == CONFIG_ITEM_MODULE && module_IsCapable( p_parser, p_item->psz_type ) ) \
{ \
if( [[[object selectedItem] title] isEqualToString: _NS( module_GetLongName( p_parser ) )] ) \
{ \
config_PutPsz( p_intf, name, strdup( module_GetObjName( p_parser ))); \
break; \
} \
} \
} \
vlc_list_release( p_list ); \
if( [[[object selectedItem] title] isEqualToString: _NS( "Default" )] ) \
config_PutPsz( p_intf, name, "" )
/**********************
/**********************
* interface settings *
* interface settings *
...
...
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