Commit ade1ff28 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: GUI demo of Simple Preferences showing the Interface and Audio...

macosx: GUI demo of Simple Preferences showing the Interface and Audio categories. Feedback is welcome.
parent bcca390d
......@@ -304,6 +304,7 @@
"o_mi_show_all" = id;
"o_mi_slower" = id;
"o_mi_snapshot" = id;
"o_mi_sprefs" = id;
"o_mi_stop" = id;
"o_mi_subtitle" = id;
"o_mi_title" = id;
......
......@@ -25,13 +25,13 @@
<array/>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>2197</integer>
<integer>1789</integer>
<integer>2769</integer>
<integer>21</integer>
<integer>2730</integer>
<integer>29</integer>
<integer>2416</integer>
<integer>1789</integer>
<integer>29</integer>
<integer>2197</integer>
</array>
<key>IBSystem Version</key>
<string>8S2167</string>
......
......@@ -2,6 +2,7 @@
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = MPSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; },
{CLASS = NSDatePicker; LANGUAGE = ObjC; SUPERCLASS = NSControl; },
{
ACTIONS = {showPanel = id; };
CLASS = VLAboutBox;
......@@ -441,6 +442,54 @@
"o_tree" = id;
};
SUPERCLASS = NSObject;
},
{
ACTIONS = {audioSettingChanged = id; buttonAction = id; interfaceSettingChanged = id; };
CLASS = VLCSimplePrefs;
LANGUAGE = ObjC;
OUTLETS = {
"o_audio_dolby_pop" = id;
"o_audio_dolby_txt" = id;
"o_audio_effects_box" = id;
"o_audio_enable_ckb" = id;
"o_audio_general_box" = id;
"o_audio_headphone_ckb" = id;
"o_audio_lang_fld" = id;
"o_audio_lang_txt" = id;
"o_audio_last_box" = id;
"o_audio_last_ckb" = id;
"o_audio_lastpwd_fld" = id;
"o_audio_lastpwd_txt" = id;
"o_audio_lastuser_fld" = id;
"o_audio_lastuser_txt" = id;
"o_audio_norm_ckb" = id;
"o_audio_norm_fld" = id;
"o_audio_spdif_ckb" = id;
"o_audio_view" = id;
"o_audio_visual_pop" = id;
"o_audio_visual_txt" = id;
"o_audio_vol_fld" = id;
"o_audio_vol_sld" = id;
"o_audio_vol_txt" = id;
"o_intf_art_pop" = id;
"o_intf_art_txt" = id;
"o_intf_black_ckb" = id;
"o_intf_embvout_ckb" = id;
"o_intf_fspanel_ckb" = id;
"o_intf_lang_pop" = id;
"o_intf_lang_txt" = id;
"o_intf_meta_ckb" = id;
"o_intf_network_box" = id;
"o_intf_view" = id;
"o_sprefs_basicFull_matrix" = id;
"o_sprefs_basic_box" = id;
"o_sprefs_cancel_btn" = id;
"o_sprefs_controls_box" = id;
"o_sprefs_reset_btn" = id;
"o_sprefs_save_btn" = id;
"o_sprefs_win" = id;
};
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
......
......@@ -3,9 +3,26 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>179 90 505 518 0 0 1280 1002 </string>
<string>398 124 505 518 0 0 1280 778 </string>
<key>IBEditorPositions</key>
<dict>
<key>2311</key>
<string>310 385 660 305 0 0 1280 778 </string>
<key>2330</key>
<string>190 210 660 502 0 0 1280 778 </string>
</dict>
<key>IBFramework Version</key>
<string>439.0</string>
<string>446.1</string>
<key>IBGroupedObjects</key>
<dict>
<key>1</key>
<array>
<string>2352</string>
<string>2353</string>
</array>
</dict>
<key>IBLastGroupID</key>
<string>2</string>
<key>IBLockedObjects</key>
<array>
<integer>2203</integer>
......@@ -15,9 +32,10 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>1530</integer>
<integer>2265</integer>
<integer>2330</integer>
</array>
<key>IBSystem Version</key>
<string>8C46</string>
<string>8S2167</string>
</dict>
</plist>
......@@ -68,6 +68,12 @@
C2F2A707095AE51700018C74 /* play_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A703095AE51600018C74 /* play_embedded_blue.png */; };
C2F2A708095AE51700018C74 /* skip_forward_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A704095AE51600018C74 /* skip_forward_embedded_blue.png */; };
C2F2A709095AE51700018C74 /* skip_previous_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A705095AE51600018C74 /* skip_previous_embedded_blue.png */; };
CC0B723D0D54F2B000448E00 /* spref_cone_Audio_64.png in Resources */ = {isa = PBXBuildFile; fileRef = CC0B72370D54F2B000448E00 /* spref_cone_Audio_64.png */; };
CC0B723E0D54F2B000448E00 /* spref_cone_Hotkeys_64.png in Resources */ = {isa = PBXBuildFile; fileRef = CC0B72380D54F2B000448E00 /* spref_cone_Hotkeys_64.png */; };
CC0B723F0D54F2B100448E00 /* spref_cone_Input_64.png in Resources */ = {isa = PBXBuildFile; fileRef = CC0B72390D54F2B000448E00 /* spref_cone_Input_64.png */; };
CC0B72400D54F2B100448E00 /* spref_cone_Interface_64.png in Resources */ = {isa = PBXBuildFile; fileRef = CC0B723A0D54F2B000448E00 /* spref_cone_Interface_64.png */; };
CC0B72410D54F2B100448E00 /* spref_cone_Subtitles_64.png in Resources */ = {isa = PBXBuildFile; fileRef = CC0B723B0D54F2B000448E00 /* spref_cone_Subtitles_64.png */; };
CC0B72420D54F2B100448E00 /* spref_cone_Video_64.png in Resources */ = {isa = PBXBuildFile; fileRef = CC0B723C0D54F2B000448E00 /* spref_cone_Video_64.png */; };
CC1941250B9C1F8400635F6B /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1941240B9C1F8400635F6B /* QTKit.framework */; };
CC1AC1BC0A7BDA41002478C3 /* InteractionErrorPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */; };
CC1B4B4D09A8CF9E0078AD2E /* Interaction.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */; };
......@@ -1067,6 +1073,12 @@
C2F2A703095AE51600018C74 /* play_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = play_embedded_blue.png; path = Resources/play_embedded_blue.png; sourceTree = "<group>"; };
C2F2A704095AE51600018C74 /* skip_forward_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skip_forward_embedded_blue.png; path = Resources/skip_forward_embedded_blue.png; sourceTree = "<group>"; };
C2F2A705095AE51600018C74 /* skip_previous_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skip_previous_embedded_blue.png; path = Resources/skip_previous_embedded_blue.png; sourceTree = "<group>"; };
CC0B72370D54F2B000448E00 /* spref_cone_Audio_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Audio_64.png; path = Resources/spref_cone_Audio_64.png; sourceTree = "<group>"; };
CC0B72380D54F2B000448E00 /* spref_cone_Hotkeys_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Hotkeys_64.png; path = Resources/spref_cone_Hotkeys_64.png; sourceTree = "<group>"; };
CC0B72390D54F2B000448E00 /* spref_cone_Input_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Input_64.png; path = Resources/spref_cone_Input_64.png; sourceTree = "<group>"; };
CC0B723A0D54F2B000448E00 /* spref_cone_Interface_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Interface_64.png; path = Resources/spref_cone_Interface_64.png; sourceTree = "<group>"; };
CC0B723B0D54F2B000448E00 /* spref_cone_Subtitles_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Subtitles_64.png; path = Resources/spref_cone_Subtitles_64.png; sourceTree = "<group>"; };
CC0B723C0D54F2B000448E00 /* spref_cone_Video_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Video_64.png; path = Resources/spref_cone_Video_64.png; sourceTree = "<group>"; };
CC1941240B9C1F8400635F6B /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = "<absolute>"; };
CC1AC1BB0A7BDA41002478C3 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/InteractionErrorPanel.nib; sourceTree = "<group>"; };
CC1B4B4C09A8CF9E0078AD2E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Interaction.nib; sourceTree = "<group>"; };
......@@ -1107,6 +1119,8 @@
CC6EDD4F0B9CA2140096068A /* eyetv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eyetv.h; path = ../../modules/gui/macosx/eyetv.h; sourceTree = SOURCE_ROOT; };
CC6EDD500B9CA2140096068A /* eyetv.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = eyetv.m; path = ../../modules/gui/macosx/eyetv.m; sourceTree = SOURCE_ROOT; };
CC962E2C0CC7992800A56695 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
CCB24D5D0D54BBAE004D780C /* simple_prefs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = simple_prefs.m; path = ../../modules/gui/macosx/simple_prefs.m; sourceTree = SOURCE_ROOT; };
CCB24D5E0D54BBAE004D780C /* simple_prefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = simple_prefs.h; path = ../../modules/gui/macosx/simple_prefs.h; sourceTree = SOURCE_ROOT; };
CCC593780AB4A9FB0004FF52 /* embeddedwindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = embeddedwindow.h; path = ../../modules/gui/macosx/embeddedwindow.h; sourceTree = SOURCE_ROOT; };
CCC593790AB4A9FB0004FF52 /* embeddedwindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = embeddedwindow.m; path = ../../modules/gui/macosx/embeddedwindow.m; sourceTree = SOURCE_ROOT; };
CCCB86C00ACFDFB300CF1E10 /* fs_time_slider.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = fs_time_slider.png; path = Resources/fs_time_slider.png; sourceTree = "<group>"; };
......@@ -1208,6 +1222,7 @@
8ECA7E520563CD9500DFC000 /* Controller */,
F69B0CA602E24F6401A80112 /* InfoPlist.strings */,
8EBF3FA303F13FFB0059A3A7 /* vlc.scriptSuite */,
CC0B71E00D54F0DD00448E00 /* simple prefs (taken from qt4) */,
8EBF3FA503F140960059A3A7 /* vlc.scriptTerminology */,
8EDAC3430440F72D0059A3A7 /* README.MacOSX.rtf */,
);
......@@ -1266,6 +1281,8 @@
2AEF857709A5FEC900130822 /* fspanel.m */,
CC6EDD4F0B9CA2140096068A /* eyetv.h */,
CC6EDD500B9CA2140096068A /* eyetv.m */,
CCB24D5D0D54BBAE004D780C /* simple_prefs.m */,
CCB24D5E0D54BBAE004D780C /* simple_prefs.h */,
);
name = Classes;
sourceTree = "<group>";
......@@ -1346,6 +1363,19 @@
name = Controller;
sourceTree = "<group>";
};
CC0B71E00D54F0DD00448E00 /* simple prefs (taken from qt4) */ = {
isa = PBXGroup;
children = (
CC0B72370D54F2B000448E00 /* spref_cone_Audio_64.png */,
CC0B72380D54F2B000448E00 /* spref_cone_Hotkeys_64.png */,
CC0B72390D54F2B000448E00 /* spref_cone_Input_64.png */,
CC0B723A0D54F2B000448E00 /* spref_cone_Interface_64.png */,
CC0B723B0D54F2B000448E00 /* spref_cone_Subtitles_64.png */,
CC0B723C0D54F2B000448E00 /* spref_cone_Video_64.png */,
);
name = "simple prefs (taken from qt4)";
sourceTree = "<group>";
};
CC33C26C0D257958008C4683 /* embedded */ = {
isa = PBXGroup;
children = (
......@@ -1642,6 +1672,12 @@
CC33C25F0D2578F5008C4683 /* stop_graphite.png in Resources */,
CC33C2600D2578F5008C4683 /* volumeslider_graphite.png in Resources */,
CC33C2610D2578F5008C4683 /* fullscreen_graphite.png in Resources */,
CC0B723D0D54F2B000448E00 /* spref_cone_Audio_64.png in Resources */,
CC0B723E0D54F2B000448E00 /* spref_cone_Hotkeys_64.png in Resources */,
CC0B723F0D54F2B100448E00 /* spref_cone_Input_64.png in Resources */,
CC0B72400D54F2B100448E00 /* spref_cone_Interface_64.png in Resources */,
CC0B72410D54F2B100448E00 /* spref_cone_Subtitles_64.png in Resources */,
CC0B72420D54F2B100448E00 /* spref_cone_Video_64.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -31,6 +31,8 @@ SOURCES_macosx = \
prefs.h \
prefs_widgets.h \
prefs_widgets.m \
simple_prefs.h \
simple_prefs.m \
output.h \
output.m \
vout.m \
......
......@@ -97,6 +97,7 @@ struct intf_sys_t
{
intf_thread_t *p_intf; /* The main intf object */
id o_prefs; /* VLCPrefs */
id o_sprefs; /* VLCSimplePrefs */
id o_about; /* VLAboutBox */
id o_open; /* VLCOpen */
id o_wizard; /* VLCWizard */
......@@ -161,6 +162,7 @@ struct intf_sys_t
IBOutlet id o_mi_about;
IBOutlet id o_mi_prefs;
IBOutlet id o_mi_sprefs;
IBOutlet id o_mi_checkForUpdate;
IBOutlet id o_mi_add_intf;
IBOutlet id o_mu_add_intf;
......@@ -309,6 +311,8 @@ struct intf_sys_t
- (void)controlTintChanged;
- (id)getControls;
- (id)getSimplePreferences;
- (id)getPreferences;
- (id)getPlaylist;
- (id)getInfo;
- (id)getWizard;
......
......@@ -49,6 +49,7 @@
#import "update.h"
#import "AppleRemote.h"
#import "eyetv.h"
#import "simple_prefs.h"
#import <vlc_input.h>
......@@ -808,7 +809,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{
o_str = [[[NSString alloc] initWithUTF8String: psz] autorelease];
if ( o_str == NULL )
if( o_str == NULL )
{
msg_Err( VLCIntf, "could not translate: %s", psz );
return( @"" );
......@@ -826,7 +827,7 @@ static VLCMain *_o_sharedMainInstance = nil;
/* When user click in the Dock icon our double click in the finder */
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)hasVisibleWindows
{
if (!hasVisibleWindows)
if(!hasVisibleWindows)
[o_window makeKeyAndOrderFront:self];
return YES;
......@@ -836,7 +837,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{
#ifdef UPDATE_CHECK
/* Check for update silently on startup */
if ( !nib_update_loaded )
if( !nib_update_loaded )
nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner:self];
// FIXME
......@@ -864,7 +865,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (void)computerWillSleep: (NSNotification *)notification
{
/* Pause */
if ( p_intf->p_sys->i_play_status == PLAYING_S )
if( p_intf->p_sys->i_play_status == PLAYING_S )
{
vlc_value_t val;
val.i_int = config_GetInt( p_intf, "key-play-pause" );
......@@ -876,7 +877,7 @@ static VLCMain *_o_sharedMainInstance = nil;
increase/decrease as long as the user holds the left/right, plus/minus button */
- (void) executeHoldActionForRemoteButton: (NSNumber*) buttonIdentifierNumber
{
if (b_remote_button_hold)
if(b_remote_button_hold)
{
switch([buttonIdentifierNumber intValue])
{
......@@ -893,7 +894,7 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_controls volumeDown: self];
break;
}
if (b_remote_button_hold)
if(b_remote_button_hold)
{
/* trigger event */
[self performSelector:@selector(executeHoldActionForRemoteButton:)
......@@ -911,7 +912,7 @@ static VLCMain *_o_sharedMainInstance = nil;
switch( buttonIdentifier )
{
case kRemoteButtonPlay:
if (count >= 2) {
if(count >= 2) {
[o_controls toogleFullscreen:self];
} else {
[o_controls play: self];
......@@ -957,7 +958,7 @@ static VLCMain *_o_sharedMainInstance = nil;
allowLossyConversion: NO];
char * psz_string;
if ( o_data == nil )
if( o_data == nil )
{
o_data = [id dataUsingEncoding: NSUTF8StringEncoding
allowLossyConversion: YES];
......@@ -1007,7 +1008,7 @@ static VLCMain *_o_sharedMainInstance = nil;
effectiveRange: &effectiveRange];
charRange = [o_layout_manager characterRangeForGlyphRange: effectiveRange
actualGlyphRange: &effectiveRange];
if ([o_wrapped lineRangeForRange:
if([o_wrapped lineRangeForRange:
NSMakeRange(charRange.location + breaksInserted, charRange.length)].length > charRange.length) {
[o_wrapped insertString: @"\n" atIndex: NSMaxRange(charRange) + breaksInserted];
breaksInserted++;
......@@ -1081,62 +1082,79 @@ static VLCMain *_o_sharedMainInstance = nil;
- (id)getControls
{
if ( o_controls )
{
if( o_controls )
return o_controls;
}
return nil;
}
- (id)getSimplePreferences
{
if( !o_sprefs )
return nil;
if( !nib_prefs_loaded )
nib_prefs_loaded = [NSBundle loadNibNamed:@"Preferences" owner: self];
return o_sprefs;
}
- (id)getPreferences
{
if( !o_prefs )
return nil;
if( !nib_prefs_loaded )
nib_prefs_loaded = [NSBundle loadNibNamed:@"Preferences" owner: self];
return o_prefs;
}
- (id)getPlaylist
{
if( o_playlist )
return o_playlist;
return nil;
}
- (id)getInfo
{
if ( o_info )
{
if( o_info )
return o_info;
}
return nil;
}
- (id)getWizard
{
if ( o_wizard )
{
if( o_wizard )
return o_wizard;
}
return nil;
}
- (id)getBookmarks
{
if ( o_bookmarks )
{
if( o_bookmarks )
return o_bookmarks;
}
return nil;
}
- (id)getEmbeddedList
{
if( o_embedded_list )
{
return o_embedded_list;
}
return nil;
}
- (id)getInteractionList
{
if( o_interaction_list )
{
return o_interaction_list;
}
return nil;
}
......@@ -1145,7 +1163,6 @@ static VLCMain *_o_sharedMainInstance = nil;
if( o_main_pgbar )
return o_main_pgbar;
msg_Err( p_intf, "main interface progress bar item wasn't found" );
return nil;
}
......@@ -1165,6 +1182,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{
if( o_eyetv )
return o_eyetv;
return nil;
}
......@@ -1437,7 +1455,7 @@ static VLCMain *_o_sharedMainInstance = nil;
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
if( p_aout != NULL )
{
[o_controls setupVarMenuItem: o_mi_channels target: (vlc_object_t *)p_aout
var: "audio-channels" selector: @selector(toggleVar:)];
......@@ -1453,7 +1471,7 @@ static VLCMain *_o_sharedMainInstance = nil;
vout_thread_t * p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if ( p_vout != NULL )
if( p_vout != NULL )
{
vlc_object_t * p_dec_obj;
......@@ -1473,7 +1491,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(vlc_object_t *)p_vout,
VLC_OBJECT_DECODER,
FIND_PARENT );
if ( p_dec_obj != NULL )
if( p_dec_obj != NULL )
{
[o_controls setupVarMenuItem: o_mi_ffmpeg_pp target:
(vlc_object_t *)p_dec_obj var:"ffmpeg-pp-q" selector:
......@@ -1729,7 +1747,7 @@ static VLCMain *_o_sharedMainInstance = nil;
returnedValue );
/* save the prefs if they were changed in the extended panel */
if (o_extended && [o_extended getConfigChanged])
if(o_extended && [o_extended getConfigChanged])
{
[o_extended savePrefs];
}
......@@ -1834,7 +1852,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenFile:(id)sender
{
if ( !nib_open_loaded )
if( !nib_open_loaded )
{
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib];
......@@ -1846,7 +1864,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenFileGeneric:(id)sender
{
if ( !nib_open_loaded )
if( !nib_open_loaded )
{
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib];
......@@ -1858,7 +1876,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenDisc:(id)sender
{
if ( !nib_open_loaded )
if( !nib_open_loaded )
{
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib];
......@@ -1870,7 +1888,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenNet:(id)sender
{
if ( !nib_open_loaded )
if( !nib_open_loaded )
{
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib];
......@@ -1882,7 +1900,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)showWizard:(id)sender
{
if ( !nib_wizard_loaded )
if( !nib_wizard_loaded )
{
nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
[o_wizard initStrings];
......@@ -1896,11 +1914,11 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)showExtended:(id)sender
{
if ( o_extended == nil )
if( o_extended == nil )
{
o_extended = [[VLCExtended alloc] init];
}
if ( !nib_extended_loaded )
if( !nib_extended_loaded )
{
nib_extended_loaded = [NSBundle loadNibNamed:@"Extended" owner:self];
[o_extended initStrings];
......@@ -1912,11 +1930,11 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)showSFilters:(id)sender
{
if ( o_sfilters == nil )
if( o_sfilters == nil )
{
o_sfilters = [[VLCsFilters alloc] init];
}
if ( !nib_sfilters_loaded )
if( !nib_sfilters_loaded )
{
nib_sfilters_loaded = [NSBundle loadNibNamed:@"SFilters" owner:self];
[o_sfilters initStrings];
......@@ -1929,13 +1947,13 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)showBookmarks:(id)sender
{
/* we need the wizard-nib for the bookmarks's extract functionality */
if ( !nib_wizard_loaded )
if( !nib_wizard_loaded )
{
nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
[o_wizard initStrings];
}
if ( !nib_bookmarks_loaded )
if( !nib_bookmarks_loaded )
nib_bookmarks_loaded = [NSBundle loadNibNamed:@"Bookmarks" owner:self];
[o_bookmarks showBookmarks];
......@@ -1962,17 +1980,23 @@ static VLCMain *_o_sharedMainInstance = nil;
if( !nib_prefs_loaded )
nib_prefs_loaded = [NSBundle loadNibNamed:@"Preferences" owner: self];
[o_prefs showPrefs];
if( sender == o_mi_sprefs )
{
o_sprefs = [[VLCSimplePrefs alloc] init];
[o_sprefs showSimplePrefs];
}
else
[o_prefs showPrefs];
}
#ifdef UPDATE_CHECK
- (IBAction)checkForUpdate:(id)sender
{/* FIXME
{
if( !nib_update_loaded )
nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner:self];
[o_update showUpdateWindow];
*/}
}
#endif
- (IBAction)viewHelp:(id)sender
......@@ -2030,7 +2054,7 @@ static VLCMain *_o_sharedMainInstance = nil;
stringByExpandingTildeInPath];
if ( [[NSFileManager defaultManager] fileExistsAtPath: o_path ] )
if( [[NSFileManager defaultManager] fileExistsAtPath: o_path ] )
{
[[NSWorkspace sharedWorkspace] openFile: o_path
withApplication: @"Console"];
......@@ -2084,14 +2108,14 @@ static VLCMain *_o_sharedMainInstance = nil;
b_restore_size = true;
b_small_window = YES; /* we know we are small, make sure this is actually set (see case below) */
/* make large */
if ( o_size_with_playlist.height > 200 )
if( o_size_with_playlist.height > 200 )
{
o_rect.size.height = o_size_with_playlist.height;
} else {
o_rect.size.height = 500;
}
if ( o_size_with_playlist.width > [o_window minSize].width )
if( o_size_with_playlist.width > [o_window minSize].width )
{
o_rect.size.width = o_size_with_playlist.width;
} else {
......@@ -2105,10 +2129,10 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_window minSize].height;
NSRect screenRect = [[o_window screen] visibleFrame];
if ( !NSContainsRect( screenRect, o_rect ) ) {
if ( NSMaxX(o_rect) > NSMaxX(screenRect) )
if( !NSContainsRect( screenRect, o_rect ) ) {
if( NSMaxX(o_rect) > NSMaxX(screenRect) )
o_rect.origin.x = ( NSMaxX(screenRect) - o_rect.size.width );
if ( NSMinY(o_rect) < NSMinY(screenRect) )
if( NSMinY(o_rect) < NSMinY(screenRect) )
o_rect.origin.y = ( NSMinY(screenRect) );
}
......@@ -2125,7 +2149,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_rect.origin.y = [o_window frame].origin.y +
[o_window frame].size.height - [o_window minSize].height;
if ( b_restore_size )
if( b_restore_size )
o_rect = o_restore_rect;
[o_playlist_view setAutoresizesSubviews: NO];
......
......@@ -271,192 +271,182 @@ static VLCTreeItem *o_root_item = nil;
if( [ o_children count] == 0 )
{
intf_thread_t *p_intf = VLCIntf;
vlc_list_t *p_list;
module_t *p_module = NULL;
module_t *p_parser;
int i_index = 0;
module_config_t *p_item,
*p_end;
int i_index = 0;
/* List the modules */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
if( !p_list ) return nil;
/* get parser */
p_parser = (module_t *)p_list->p_values[i_index].p_object;
if( [[self getName] isEqualToString: @"main"] )
/* Build the tree for the main module */
const module_t *p_module = NULL;
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
if( !p_list ) return NULL;
for( unsigned i = 0; p_module == NULL; i++ )
{
/*
* Find the main module
*/
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_module = (module_t *)p_list->p_values[i_index].p_object;
if( !strcmp( module_GetObjName( p_module ), "main" ) )
break;
}
if( p_module == NULL )
{
msg_Err( p_intf,
"could not load the preferences" );
return nil;
}
if( i_index < p_list->i_count )
assert (i < (unsigned)p_list->i_count);
const module_t *p_main = (module_t *)p_list->p_values[i].p_object;
if( strcmp( module_GetObjName( p_main ), "main" ) == 0 )
p_module = p_main;
}
VLCTreeItem *p_last_category = NULL;
unsigned int i_confsize;
module_config_t *const p_config = module_GetConfig (p_module, &i_confsize);
p_end = p_item + i_confsize;
for (size_t i = 0; i < i_confsize; i++)
{
p_item = p_config + i;
NSString *o_child_name;
NSString *o_child_title;
NSString *o_child_help;
switch( p_item->i_type )
{
/* 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;
unsigned int i_confsize;
p_item = module_GetConfig( p_parser, &i_confsize );
p_end = p_item + i_confsize;
o_children = [[NSMutableArray alloc] initWithCapacity:10];
if( p_item ) do
{
NSString *o_child_name;
NSString *o_child_title;
NSString *o_child_help;
switch( p_item->i_type )
{
case CONFIG_CATEGORY:
if( p_item->value.i == -1 ) break;
case CONFIG_CATEGORY:
if( p_item->value.i == -1 ) break;
o_child_name = [[VLCMain sharedInstance]
o_child_name = [[VLCMain sharedInstance]
localizedString: config_CategoryNameGet( p_item->value.i )];
o_child_title = o_child_name;
o_child_help = [[VLCMain sharedInstance]
o_child_title = o_child_name;
o_child_help = [[VLCMain sharedInstance]
localizedString: config_CategoryHelpGet( p_item->value.i )];
p_last_category = [VLCTreeItem alloc];
[o_children addObject:[p_last_category
p_last_category = [VLCTreeItem alloc];
[o_children addObject:[p_last_category
initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->value.i
parent:self
children:[[NSMutableArray alloc]
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->value.i
parent:self
children:[[NSMutableArray alloc]
initWithCapacity:10]
whithCategory: p_item - module_GetConfig( p_module, &i_confsize )]];
break;
case CONFIG_SUBCATEGORY:
if( p_item->value.i == -1 ) break;
if( p_item->value.i != SUBCAT_PLAYLIST_GENERAL &&
p_item->value.i != SUBCAT_VIDEO_GENERAL &&
p_item->value.i != SUBCAT_INPUT_GENERAL &&
p_item->value.i != SUBCAT_INTERFACE_GENERAL &&
p_item->value.i != SUBCAT_SOUT_GENERAL &&
p_item->value.i != SUBCAT_ADVANCED_MISC &&
p_item->value.i != SUBCAT_AUDIO_GENERAL )
{
o_child_name = [[VLCMain sharedInstance]
whithCategory: p_item - module_GetConfig( p_module, &i_confsize )]];
break;
case CONFIG_SUBCATEGORY:
if( p_item->value.i == -1 ) break;
/* Special cases: move the main subcategories to the parent cat*/
if( p_item->value.i != SUBCAT_PLAYLIST_GENERAL &&
p_item->value.i != SUBCAT_VIDEO_GENERAL &&
p_item->value.i != SUBCAT_INPUT_GENERAL &&
p_item->value.i != SUBCAT_INTERFACE_GENERAL &&
p_item->value.i != SUBCAT_SOUT_GENERAL &&
p_item->value.i != SUBCAT_ADVANCED_MISC &&
p_item->value.i != SUBCAT_AUDIO_GENERAL )
{
o_child_name = [[VLCMain sharedInstance]
localizedString: config_CategoryNameGet( p_item->value.i ) ];
o_child_title = o_child_name;
o_child_help = [[VLCMain sharedInstance]
o_child_title = o_child_name;
o_child_help = [[VLCMain sharedInstance]
localizedString: config_CategoryHelpGet( p_item->value.i ) ];
[p_last_category->o_children
[p_last_category->o_children
addObject:[[VLCTreeItem alloc]
initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->value.i
parent:p_last_category
children:[[NSMutableArray alloc]
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->value.i
parent:p_last_category
children:[[NSMutableArray alloc]
initWithCapacity:10]
whithCategory: p_item - module_GetConfig( p_parser, &i_confsize )]];
}
break;
default:
break;
whithCategory: p_item - module_GetConfig( p_module, &i_confsize )]];
continue;
}
} while( p_item < p_end && p_item++ );
}
break;
/* Build a tree of the plugins */
/* Add the capabilities */
for( i_index = 0; i_index < p_list->i_count; i_index++ )
default:
break;
}
}
module_PutConfig (p_config);
/* Build the tree of plugins */
/* Build a tree of the plugins */
/* Add the capabilities */
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
unsigned int confsize;
p_module = (module_t *)p_list->p_values[i_index].p_object;
/* Exclude the main module */
if( !strcmp( module_GetObjName( p_module ), "main" ) )
continue;
/* Exclude empty plugins (submodules don't have config */
/* options, they are stored in the parent module) */
// Does not work
// if( modules_IsSubModule( p_module ) )
// continue;
p_item = module_GetConfig( p_module, &confsize );
if( !p_item ) continue;
int i_category = -1;
int i_subcategory = -1;
int i_options = 0;
do
{
unsigned int confsize;
p_module = (module_t *)p_list->p_values[i_index].p_object;
/* Exclude the main module */
if( !strcmp( module_GetObjName( p_module ), "main" ) )
continue;
/* Exclude empty plugins (submodules don't have config */
/* options, they are stored in the parent module) */
// Does not work
// if( modules_IsSubModule( p_module ) )
// continue;
p_item = module_GetConfig( p_module, &confsize );
if( !p_item ) continue;
int i_category = -1;
int i_subcategory = -1;
int i_options = 0;
do
{
if( p_item->i_type == CONFIG_CATEGORY )
i_category = p_item->value.i;
else if( p_item->i_type == CONFIG_SUBCATEGORY )
i_subcategory = p_item->value.i;
if( p_item->i_type & CONFIG_ITEM )
i_options ++;
if( i_options > 0 && i_category >= 0 && i_subcategory >= 0 )
break;
} while( p_item < p_end && p_item++ );
if( !i_options ) continue;
/* Find the right category item */
long cookie;
vlc_bool_t b_found = VLC_FALSE;
unsigned int i;
VLCTreeItem* p_category_item, * p_subcategory_item;
for (i = 0 ; i < [o_children count] ; i++)
if( p_item->i_type == CONFIG_CATEGORY )
i_category = p_item->value.i;
else if( p_item->i_type == CONFIG_SUBCATEGORY )
i_subcategory = p_item->value.i;
if( p_item->i_type & CONFIG_ITEM )
i_options ++;
if( i_options > 0 && i_category >= 0 && i_subcategory >= 0 )
break;
} while( p_item < p_end && p_item++ );
if( !i_options ) continue;
/* Find the right category item */
long cookie;
vlc_bool_t b_found = VLC_FALSE;
unsigned int i;
VLCTreeItem* p_category_item, * p_subcategory_item;
for (i = 0 ; i < [o_children count] ; i++)
{
p_category_item = [o_children objectAtIndex: i];
if( p_category_item->i_object_id == i_category )
{
p_category_item = [o_children objectAtIndex: i];
if( p_category_item->i_object_id == i_category )
{
b_found = VLC_TRUE;
break;
}
b_found = VLC_TRUE;
break;
}
if( !b_found ) continue;
/* Find subcategory item */
b_found = VLC_FALSE;
cookie = -1;
for (i = 0 ; i < [p_category_item->o_children count] ; i++)
{
p_subcategory_item = [p_category_item->o_children
}
if( !b_found ) continue;
/* Find subcategory item */
b_found = VLC_FALSE;
cookie = -1;
for (i = 0 ; i < [p_category_item->o_children count] ; i++)
{
p_subcategory_item = [p_category_item->o_children
objectAtIndex: i];
if( p_subcategory_item->i_object_id == i_subcategory )
{
b_found = VLC_TRUE;
break;
}
if( p_subcategory_item->i_object_id == i_subcategory )
{
b_found = VLC_TRUE;
break;
}
if( !b_found )
p_subcategory_item = p_category_item;
[p_subcategory_item->o_children addObject:[[VLCTreeItem alloc]
}
if( !b_found )
p_subcategory_item = p_category_item;
[p_subcategory_item->o_children addObject:[[VLCTreeItem alloc]
initWithName:[[VLCMain sharedInstance]
localizedString: module_GetName( p_module, VLC_FALSE ) ]
withTitle:[[VLCMain sharedInstance]
withTitle:[[VLCMain sharedInstance]
localizedString: module_GetLongName( p_module ) ]
withHelp: @""
ID: ((vlc_object_t*)p_module)->i_object_id
parent:p_subcategory_item
children:IsALeafNode
whithCategory: -1]];
}
withHelp: @""
ID: ((vlc_object_t*)p_module)->i_object_id
parent:p_subcategory_item
children:IsALeafNode
whithCategory: -1]];
}
vlc_list_release( p_list );
}
vlc_list_release( p_list );
}
return o_children;
}
......
/*****************************************************************************
* simple_prefs.h: Simple Preferences for Mac OS X
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id:$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface VLCSimplePrefs : NSObject
{
IBOutlet id o_audio_dolby_pop;
IBOutlet id o_audio_dolby_txt;
IBOutlet id o_audio_effects_box;
IBOutlet id o_audio_enable_ckb;
IBOutlet id o_audio_general_box;
IBOutlet id o_audio_headphone_ckb;
IBOutlet id o_audio_lang_fld;
IBOutlet id o_audio_lang_txt;
IBOutlet id o_audio_last_box;
IBOutlet id o_audio_last_ckb;
IBOutlet id o_audio_lastpwd_fld;
IBOutlet id o_audio_lastpwd_txt;
IBOutlet id o_audio_lastuser_fld;
IBOutlet id o_audio_lastuser_txt;
IBOutlet id o_audio_norm_ckb;
IBOutlet id o_audio_norm_fld;
IBOutlet id o_audio_spdif_ckb;
IBOutlet id o_audio_view;
IBOutlet id o_audio_visual_pop;
IBOutlet id o_audio_visual_txt;
IBOutlet id o_audio_vol_fld;
IBOutlet id o_audio_vol_sld;
IBOutlet id o_audio_vol_txt;
IBOutlet id o_intf_art_pop;
IBOutlet id o_intf_art_txt;
IBOutlet id o_intf_black_ckb;
IBOutlet id o_intf_embvout_ckb;
IBOutlet id o_intf_fspanel_ckb;
IBOutlet id o_intf_lang_pop;
IBOutlet id o_intf_lang_txt;
IBOutlet id o_intf_meta_ckb;
IBOutlet id o_intf_network_box;
IBOutlet id o_intf_view;
IBOutlet id o_sprefs_basic_box;
IBOutlet id o_sprefs_basicFull_matrix;
IBOutlet id o_sprefs_cancel_btn;
IBOutlet id o_sprefs_controls_box;
IBOutlet id o_sprefs_reset_btn;
IBOutlet id o_sprefs_save_btn;
IBOutlet id o_sprefs_win;
BOOL b_audioSettingChanged;
BOOL b_intfSettingChanged;
id o_currentlyShownCategoryView;
NSToolbar *o_sprefs_toolbar;
intf_thread_t *p_intf;
}
+ (VLCSimplePrefs *)sharedInstance;
- (NSToolbarItem *) toolbar: (NSToolbar *)o_toolbar
itemForItemIdentifier: (NSString *)o_itemIdent
willBeInsertedIntoToolbar: (BOOL)b_willBeInserted;
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar;
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar;
- (void)initStrings;
- (void)showSimplePrefs;
- (IBAction)buttonAction:(id)sender;
- (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return
contextInfo:(void *)o_context;
/* interface */
- (IBAction)interfaceSettingChanged:(id)sender;
- (void)showInterfaceSettings;
/* audio */
- (IBAction)audioSettingChanged:(id)sender;
- (void)showAudioSettings;
/* video */
/* subtitles */
/* input & codecs */
/* hotkeys */
@end
/*****************************************************************************
* simple_prefs.m: Simple Preferences for Mac OS X
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id:$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "intf.h"
#import <vlc/vlc.h>
#import "simple_prefs.h"
#import "prefs.h"
static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier";
static NSString* VLCIntfSettingToolbarIdentifier = @"Intf Settings Item Identifier";
static NSString* VLCAudioSettingToolbarIdentifier = @"Audio Settings Item Identifier";
@implementation VLCSimplePrefs
static VLCSimplePrefs *_o_sharedInstance = nil;
+ (VLCSimplePrefs *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
- (id)init
{
if (_o_sharedInstance) {
[self dealloc];
} else {
p_intf = VLCIntf;
_o_sharedInstance = [super init];
}
return _o_sharedInstance;
}
- (void)dealloc
{
[o_currentlyShownCategoryView release];
[o_sprefs_toolbar release];
[super dealloc];
}
- (void)awakeFromNib
{
[self initStrings];
o_sprefs_toolbar = [[[NSToolbar alloc] initWithIdentifier: VLCSPrefsToolbarIdentifier] autorelease];
[o_sprefs_toolbar setAllowsUserCustomization: NO];
[o_sprefs_toolbar setAutosavesConfiguration: NO];
[o_sprefs_toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel];
[o_sprefs_toolbar setSizeMode: NSToolbarSizeModeRegular];
[o_sprefs_toolbar setDelegate: self];
[o_sprefs_win setToolbar: o_sprefs_toolbar];
}
- (NSToolbarItem *) toolbar: (NSToolbar *)o_sprefs_toolbar
itemForItemIdentifier: (NSString *)o_itemIdent
willBeInsertedIntoToolbar: (BOOL)b_willBeInserted
{
NSToolbarItem *o_toolbarItem = nil;
if( [o_itemIdent isEqual: VLCIntfSettingToolbarIdentifier] )
{
o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease];
[o_toolbarItem setLabel: _NS("Interface")];
[o_toolbarItem setPaletteLabel: _NS("Interface settings")];
[o_toolbarItem setToolTip: _NS("Interface settings")];
[o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Interface_64"]];
[o_toolbarItem setTarget: self];
[o_toolbarItem setAction: @selector(showInterfaceSettings)];
[o_toolbarItem setEnabled: YES];
[o_toolbarItem setAutovalidates: YES];
}
else if( [o_itemIdent isEqual: VLCAudioSettingToolbarIdentifier] )
{
o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease];
[o_toolbarItem setLabel: _NS("Audio")];
[o_toolbarItem setPaletteLabel: _NS("General Audio settings")];
[o_toolbarItem setToolTip: _NS("General Audio settings")];
[o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Audio_64"]];
[o_toolbarItem setTarget: self];
[o_toolbarItem setAction: @selector(showAudioSettings)];
[o_toolbarItem setEnabled: YES];
[o_toolbarItem setAutovalidates: YES];
}
return o_toolbarItem;
}
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
{
return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
}
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
{
return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
}
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{
return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
}
- (void)initStrings
{
[o_sprefs_reset_btn setEnabled: NO];
msg_Warn( p_intf, "localisation of the simple preferences not implemented!" );
}
- (void)showSimplePrefs
{
/* we want to show the interface settings, if no category was chosen */
if( [o_sprefs_toolbar selectedItemIdentifier] == nil )
{
[o_sprefs_toolbar setSelectedItemIdentifier: VLCIntfSettingToolbarIdentifier];
[self showInterfaceSettings];
}
[o_sprefs_win makeKeyAndOrderFront: self];
}
- (IBAction)buttonAction:(id)sender
{
if( sender == o_sprefs_cancel_btn )
[o_sprefs_win orderOut: sender];
else if( sender == o_sprefs_save_btn )
{
msg_Warn( p_intf, "sprefs saving not implemented, your changes have no effect!" );
[o_sprefs_win orderOut: sender];
}
else if( sender == o_sprefs_reset_btn )
NSBeginInformationalAlertSheet( _NS("Reset Preferences"), _NS("Cancel"),
_NS("Continue"), nil, o_sprefs_win, self,
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil,
_NS("Beware this will reset the VLC media player preferences.\n"
"Are you sure you want to continue?") );
else if( sender == o_sprefs_basicFull_matrix )
{
[o_sprefs_win orderOut: self];
[[[VLCMain sharedInstance] getPreferences] showPrefs];
/* TODO: reset our selector controls here */
}
else
msg_Err( p_intf, "unknown buttonAction sender" );
}
- (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return
contextInfo:(void *)o_context
{
if( i_return == NSAlertAlternateReturn )
{
config_ResetAll( p_intf );
/* TODO: we need to reset our views here */
}
}
- (void)showSettingsForCategory: (id)o_new_category_view
{
msg_Dbg( p_intf, "switching to another category" );
NSRect o_win_rect, o_view_rect, o_old_view_rect;
o_win_rect = [o_sprefs_win frame];
o_view_rect = [o_new_category_view frame];
if( o_currentlyShownCategoryView != nil )
{
/* restore our window's height, if we've shown another category previously */
o_old_view_rect = [o_currentlyShownCategoryView frame];
o_win_rect.size.height = o_win_rect.size.height - o_old_view_rect.size.height;
/* remove our previous category view */
[o_currentlyShownCategoryView removeFromSuperviewWithoutNeedingDisplay];
}
o_win_rect.size.height = o_win_rect.size.height + o_view_rect.size.height;
[o_sprefs_win displayIfNeeded];
[o_sprefs_win setFrame: o_win_rect display:YES animate: YES];
[o_new_category_view setFrame: NSMakeRect( 0,
[o_sprefs_controls_box frame].size.height,
o_view_rect.size.width,
o_view_rect.size.height )];
[o_new_category_view setNeedsDisplay: YES];
[o_new_category_view setAutoresizesSubviews: YES];
[[o_sprefs_win contentView] addSubview: o_new_category_view];
/* keep our current category for further reference */
[o_currentlyShownCategoryView release];
o_currentlyShownCategoryView = o_new_category_view;
[o_currentlyShownCategoryView retain];
}
- (IBAction)interfaceSettingChanged:(id)sender
{
}
- (void)showInterfaceSettings
{
msg_Dbg( p_intf, "showing interface settings" );
[self showSettingsForCategory: o_intf_view];
}
- (IBAction)audioSettingChanged:(id)sender
{
}
- (void)showAudioSettings
{
msg_Dbg( p_intf, "showing audio settings" );
[self showSettingsForCategory: o_audio_view];
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment