Changeset 4d8b3700b700a33d958027e7baddd63f34917b8e

Show
Ignore:
Timestamp:
12/03/08 20:25:25 (7 months ago)
Author:
Felix Paul Kühne <fkuehne@videolan.org>
git-committer:
Felix Paul Kühne <fkuehne@videolan.org> 1205349925 +0100
git-parent:

[0274be8790164dccf71b9f4574b57a47e4a88c70]

git-author:
Felix Paul Kühne <fkuehne@videolan.org> 1205349925 +0100
Message:

Implemented the hotkey section of the Simple Preferences

plus a bit of code factorisation

Note that saving multi-key combinations will fail right now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extras/package/macosx/Resources/English.lproj/Preferences.nib/classes.nib

    r887efa4 r4d8b370  
    1 
    2     IBClasses = ( 
    3         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },  
    4         {CLASS = MPSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; },  
    5         {CLASS = NSDatePicker; LANGUAGE = ObjC; SUPERCLASS = NSControl; },  
    6         {CLASS = VLBrushedMetalImageView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; },  
    7         {CLASS = VLCApplication; LANGUAGE = ObjC; SUPERCLASS = NSApplication; },  
    8         {CLASS = VLCControllerWindow; LANGUAGE = ObjC; SUPERCLASS = NSWindow; },  
    9         {CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },  
    10         { 
    11             ACTIONS = {advancedToggle = id; closePrefs = id; resetAll = id; savePrefs = id; };  
    12             CLASS = VLCPrefs;  
    13             LANGUAGE = ObjC;  
    14             OUTLETS = { 
    15                 "o_advanced_ckb" = id;  
    16                 "o_cancel_btn" = id;  
    17                 "o_prefs_view" = id;  
    18                 "o_prefs_window" = id;  
    19                 "o_reset_btn" = id;  
    20                 "o_save_btn" = id;  
    21                 "o_title" = id;  
    22                 "o_tree" = id;  
    23             };  
    24             SUPERCLASS = NSObject;  
    25         },  
    26         { 
    27             ACTIONS = { 
    28                 audioSettingChanged = id;  
    29                 buttonAction = id;  
    30                 inputSettingChanged = id;  
    31                 interfaceSettingChanged = id;  
    32                 osdSettingChanged = id;  
    33                 videoSettingChanged = id;  
    34             };  
    35             CLASS = VLCSimplePrefs;  
    36             LANGUAGE = ObjC;  
    37             OUTLETS = { 
    38                 "o_audio_dolby_pop" = id;  
    39                 "o_audio_dolby_txt" = id;  
    40                 "o_audio_effects_box" = id;  
    41                 "o_audio_enable_ckb" = id;  
    42                 "o_audio_general_box" = id;  
    43                 "o_audio_headphone_ckb" = id;  
    44                 "o_audio_lang_fld" = id;  
    45                 "o_audio_lang_txt" = id;  
    46                 "o_audio_last_box" = id;  
    47                 "o_audio_last_ckb" = id;  
    48                 "o_audio_lastpwd_fld" = id;  
    49                 "o_audio_lastpwd_txt" = id;  
    50                 "o_audio_lastuser_fld" = id;  
    51                 "o_audio_lastuser_txt" = id;  
    52                 "o_audio_norm_ckb" = id;  
    53                 "o_audio_norm_fld" = id;  
    54                 "o_audio_spdif_ckb" = id;  
    55                 "o_audio_view" = id;  
    56                 "o_audio_visual_pop" = id;  
    57                 "o_audio_visual_txt" = id;  
    58                 "o_audio_vol_fld" = id;  
    59                 "o_audio_vol_sld" = id;  
    60                 "o_audio_vol_txt" = id;  
    61                 "o_input_access_box" = id;  
    62                 "o_input_avi_pop" = id;  
    63                 "o_input_avi_txt" = id;  
    64                 "o_input_bandwidth_ckb" = id;  
    65                 "o_input_cachelevel_pop" = id;  
    66                 "o_input_cachelevel_txt" = id;  
    67                 "o_input_caching_box" = id;  
    68                 "o_input_dump_ckb" = id;  
    69                 "o_input_httpproxy_fld" = id;  
    70                 "o_input_httpproxy_txt" = id;  
    71                 "o_input_mux_box" = id;  
    72                 "o_input_net_box" = id;  
    73                 "o_input_postproc_fld" = id;  
    74                 "o_input_postproc_txt" = id;  
    75                 "o_input_record_ckb" = id;  
    76                 "o_input_rtsp_ckb" = id;  
    77                 "o_input_serverport_fld" = id;  
    78                 "o_input_serverport_txt" = id;  
    79                 "o_input_timeshift_ckb" = id;  
    80                 "o_input_view" = id;  
    81                 "o_intf_art_pop" = id;  
    82                 "o_intf_art_txt" = id;  
    83                 "o_intf_embedded_ckb" = id;  
    84                 "o_intf_fspanel_ckb" = id;  
    85                 "o_intf_lang_pop" = id;  
    86                 "o_intf_lang_txt" = id;  
    87                 "o_intf_meta_ckb" = id;  
    88                 "o_intf_network_box" = id;  
    89                 "o_intf_view" = id;  
    90                 "o_osd_encoding_pop" = id;  
    91                 "o_osd_encoding_txt" = id;  
    92                 "o_osd_font_box" = id;  
    93                 "o_osd_font_btn" = id;  
    94                 "o_osd_font_color_pop" = id;  
    95                 "o_osd_font_color_txt" = id;  
    96                 "o_osd_font_effect_pop" = id;  
    97                 "o_osd_font_effect_txt" = id;  
    98                 "o_osd_font_fld" = id;  
    99                 "o_osd_font_size_pop" = id;  
    100                 "o_osd_font_size_txt" = id;  
    101                 "o_osd_font_txt" = id;  
    102                 "o_osd_lang_box" = id;  
    103                 "o_osd_lang_fld" = id;  
    104                 "o_osd_lang_txt" = id;  
    105                 "o_osd_osd_box" = id;  
    106                 "o_osd_osd_ckb" = id;  
    107                 "o_osd_view" = id;  
    108                 "o_sprefs_basicFull_matrix" = id;  
    109                 "o_sprefs_basic_box" = id;  
    110                 "o_sprefs_cancel_btn" = id;  
    111                 "o_sprefs_controls_box" = id;  
    112                 "o_sprefs_reset_btn" = id;  
    113                 "o_sprefs_save_btn" = id;  
    114                 "o_sprefs_win" = id;  
    115                 "o_video_black_ckb" = id;  
    116                 "o_video_device_pop" = id;  
    117                 "o_video_device_txt" = id;  
    118                 "o_video_display_box" = id;  
    119                 "o_video_enable_ckb" = id;  
    120                 "o_video_fullscreen_ckb" = id;  
    121                 "o_video_onTop_ckb" = id;  
    122                 "o_video_output_pop" = id;  
    123                 "o_video_output_txt" = id;  
    124                 "o_video_skipFrames_ckb" = id;  
    125                 "o_video_snap_box" = id;  
    126                 "o_video_snap_folder_btn" = id;  
    127                 "o_video_snap_folder_fld" = id;  
    128                 "o_video_snap_folder_txt" = id;  
    129                 "o_video_snap_format_pop" = id;  
    130                 "o_video_snap_format_txt" = id;  
    131                 "o_video_snap_prefix_fld" = id;  
    132                 "o_video_snap_prefix_txt" = id;  
    133                 "o_video_snap_seqnum_ckb" = id;  
    134                 "o_video_view" = id;  
    135             };  
    136             SUPERCLASS = NSObject;  
    137         } 
    138     );  
    139     IBVersion = 1;  
    140 
     1<?xml version="1.0" encoding="UTF-8"?> 
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
     3<plist version="1.0"> 
     4<dict> 
     5    <key>IBClasses</key> 
     6    <array> 
     7        <dict> 
     8            <key>CLASS</key> 
     9            <string>VLCHotkeyChangeWindow</string> 
     10            <key>LANGUAGE</key> 
     11            <string>ObjC</string> 
     12            <key>SUPERCLASS</key> 
     13            <string>NSWindow</string> 
     14        </dict> 
     15        <dict> 
     16            <key>CLASS</key> 
     17            <string>NSApplication</string> 
     18            <key>LANGUAGE</key> 
     19            <string>ObjC</string> 
     20            <key>SUPERCLASS</key> 
     21            <string>NSResponder</string> 
     22        </dict> 
     23        <dict> 
     24            <key>ACTIONS</key> 
     25            <dict> 
     26                <key>audioSettingChanged</key> 
     27                <string>id</string> 
     28                <key>buttonAction</key> 
     29                <string>id</string> 
     30                <key>hotkeySettingChanged</key> 
     31                <string>id</string> 
     32                <key>inputSettingChanged</key> 
     33                <string>id</string> 
     34                <key>interfaceSettingChanged</key> 
     35                <string>id</string> 
     36                <key>osdSettingChanged</key> 
     37                <string>id</string> 
     38                <key>videoSettingChanged</key> 
     39                <string>id</string> 
     40            </dict> 
     41            <key>CLASS</key> 
     42            <string>VLCSimplePrefs</string> 
     43            <key>LANGUAGE</key> 
     44            <string>ObjC</string> 
     45            <key>OUTLETS</key> 
     46            <dict> 
     47                <key>o_audio_dolby_pop</key> 
     48                <string>id</string> 
     49                <key>o_audio_dolby_txt</key> 
     50                <string>id</string> 
     51                <key>o_audio_effects_box</key> 
     52                <string>id</string> 
     53                <key>o_audio_enable_ckb</key> 
     54                <string>id</string> 
     55                <key>o_audio_general_box</key> 
     56                <string>id</string> 
     57                <key>o_audio_headphone_ckb</key> 
     58                <string>id</string> 
     59                <key>o_audio_lang_fld</key> 
     60                <string>id</string> 
     61                <key>o_audio_lang_txt</key> 
     62                <string>id</string> 
     63                <key>o_audio_last_box</key> 
     64                <string>id</string> 
     65                <key>o_audio_last_ckb</key> 
     66                <string>id</string> 
     67                <key>o_audio_lastpwd_fld</key> 
     68                <string>id</string> 
     69                <key>o_audio_lastpwd_txt</key> 
     70                <string>id</string> 
     71                <key>o_audio_lastuser_fld</key> 
     72                <string>id</string> 
     73                <key>o_audio_lastuser_txt</key> 
     74                <string>id</string> 
     75                <key>o_audio_norm_ckb</key> 
     76                <string>id</string> 
     77                <key>o_audio_norm_fld</key> 
     78                <string>id</string> 
     79                <key>o_audio_spdif_ckb</key> 
     80                <string>id</string> 
     81                <key>o_audio_view</key> 
     82                <string>id</string> 
     83                <key>o_audio_visual_pop</key> 
     84                <string>id</string> 
     85                <key>o_audio_visual_txt</key> 
     86                <string>id</string> 
     87                <key>o_audio_vol_fld</key> 
     88                <string>id</string> 
     89                <key>o_audio_vol_sld</key> 
     90                <string>id</string> 
     91                <key>o_audio_vol_txt</key> 
     92                <string>id</string> 
     93                <key>o_currentlyShownCategoryView</key> 
     94                <string>id</string> 
     95                <key>o_hotkeys_change_btn</key> 
     96                <string>id</string> 
     97                <key>o_hotkeys_change_cancel_btn</key> 
     98                <string>id</string> 
     99                <key>o_hotkeys_change_keys_lbl</key> 
     100                <string>id</string> 
     101                <key>o_hotkeys_change_lbl</key> 
     102                <string>id</string> 
     103                <key>o_hotkeys_change_ok_btn</key> 
     104                <string>id</string> 
     105                <key>o_hotkeys_change_taken_lbl</key> 
     106                <string>id</string> 
     107                <key>o_hotkeys_change_win</key> 
     108                <string>id</string> 
     109                <key>o_hotkeys_clear_btn</key> 
     110                <string>id</string> 
     111                <key>o_hotkeys_lbl</key> 
     112                <string>id</string> 
     113                <key>o_hotkeys_listbox</key> 
     114                <string>id</string> 
     115                <key>o_hotkeys_view</key> 
     116                <string>id</string> 
     117                <key>o_input_access_box</key> 
     118                <string>id</string> 
     119                <key>o_input_avi_pop</key> 
     120                <string>id</string> 
     121                <key>o_input_avi_txt</key> 
     122                <string>id</string> 
     123                <key>o_input_bandwidth_ckb</key> 
     124                <string>id</string> 
     125                <key>o_input_cachelevel_pop</key> 
     126                <string>id</string> 
     127                <key>o_input_cachelevel_txt</key> 
     128                <string>id</string> 
     129                <key>o_input_caching_box</key> 
     130                <string>id</string> 
     131                <key>o_input_dump_ckb</key> 
     132                <string>id</string> 
     133                <key>o_input_httpproxy_fld</key> 
     134                <string>id</string> 
     135                <key>o_input_httpproxy_txt</key> 
     136                <string>id</string> 
     137                <key>o_input_mux_box</key> 
     138                <string>id</string> 
     139                <key>o_input_net_box</key> 
     140                <string>id</string> 
     141                <key>o_input_postproc_fld</key> 
     142                <string>id</string> 
     143                <key>o_input_postproc_txt</key> 
     144                <string>id</string> 
     145                <key>o_input_record_ckb</key> 
     146                <string>id</string> 
     147                <key>o_input_rtsp_ckb</key> 
     148                <string>id</string> 
     149                <key>o_input_serverport_fld</key> 
     150                <string>id</string> 
     151                <key>o_input_serverport_txt</key> 
     152                <string>id</string> 
     153                <key>o_input_timeshift_ckb</key> 
     154                <string>id</string> 
     155                <key>o_input_view</key> 
     156                <string>id</string> 
     157                <key>o_intf_art_pop</key> 
     158                <string>id</string> 
     159                <key>o_intf_art_txt</key> 
     160                <string>id</string> 
     161                <key>o_intf_embedded_ckb</key> 
     162                <string>id</string> 
     163                <key>o_intf_fspanel_ckb</key> 
     164                <string>id</string> 
     165                <key>o_intf_lang_pop</key> 
     166                <string>id</string> 
     167                <key>o_intf_lang_txt</key> 
     168                <string>id</string> 
     169                <key>o_intf_meta_ckb</key> 
     170                <string>id</string> 
     171                <key>o_intf_network_box</key> 
     172                <string>id</string> 
     173                <key>o_intf_view</key> 
     174                <string>id</string> 
     175                <key>o_osd_encoding_pop</key> 
     176                <string>id</string> 
     177                <key>o_osd_encoding_txt</key> 
     178                <string>id</string> 
     179                <key>o_osd_font_box</key> 
     180                <string>id</string> 
     181                <key>o_osd_font_btn</key> 
     182                <string>id</string> 
     183                <key>o_osd_font_color_pop</key> 
     184                <string>id</string> 
     185                <key>o_osd_font_color_txt</key> 
     186                <string>id</string> 
     187                <key>o_osd_font_effect_pop</key> 
     188                <string>id</string> 
     189                <key>o_osd_font_effect_txt</key> 
     190                <string>id</string> 
     191                <key>o_osd_font_fld</key> 
     192                <string>id</string> 
     193                <key>o_osd_font_size_pop</key> 
     194                <string>id</string> 
     195                <key>o_osd_font_size_txt</key> 
     196                <string>id</string> 
     197                <key>o_osd_font_txt</key> 
     198                <string>id</string> 
     199                <key>o_osd_lang_box</key> 
     200                <string>id</string> 
     201                <key>o_osd_lang_fld</key> 
     202                <string>id</string> 
     203                <key>o_osd_lang_txt</key> 
     204                <string>id</string> 
     205                <key>o_osd_osd_box</key> 
     206                <string>id</string> 
     207                <key>o_osd_osd_ckb</key> 
     208                <string>id</string> 
     209                <key>o_osd_view</key> 
     210                <string>id</string> 
     211                <key>o_sprefs_basicFull_matrix</key> 
     212                <string>id</string> 
     213                <key>o_sprefs_basic_box</key> 
     214                <string>id</string> 
     215                <key>o_sprefs_cancel_btn</key> 
     216                <string>id</string> 
     217                <key>o_sprefs_controls_box</key> 
     218                <string>id</string> 
     219                <key>o_sprefs_reset_btn</key> 
     220                <string>id</string> 
     221                <key>o_sprefs_save_btn</key> 
     222                <string>id</string> 
     223                <key>o_sprefs_win</key> 
     224                <string>id</string> 
     225                <key>o_video_black_ckb</key> 
     226                <string>id</string> 
     227                <key>o_video_device_pop</key> 
     228                <string>id</string> 
     229                <key>o_video_device_txt</key> 
     230                <string>id</string> 
     231                <key>o_video_display_box</key> 
     232                <string>id</string> 
     233                <key>o_video_enable_ckb</key> 
     234                <string>id</string> 
     235                <key>o_video_fullscreen_ckb</key> 
     236                <string>id</string> 
     237                <key>o_video_onTop_ckb</key> 
     238                <string>id</string> 
     239                <key>o_video_output_pop</key> 
     240                <string>id</string> 
     241                <key>o_video_output_txt</key> 
     242                <string>id</string> 
     243                <key>o_video_skipFrames_ckb</key> 
     244                <string>id</string> 
     245                <key>o_video_snap_box</key> 
     246                <string>id</string> 
     247                <key>o_video_snap_folder_btn</key> 
     248                <string>id</string> 
     249                <key>o_video_snap_folder_fld</key> 
     250                <string>id</string> 
     251                <key>o_video_snap_folder_txt</key> 
     252                <string>id</string> 
     253                <key>o_video_snap_format_pop</key> 
     254                <string>id</string> 
     255                <key>o_video_snap_format_txt</key> 
     256                <string>id</string> 
     257                <key>o_video_snap_prefix_fld</key> 
     258                <string>id</string> 
     259                <key>o_video_snap_prefix_txt</key> 
     260                <string>id</string> 
     261                <key>o_video_snap_seqnum_ckb</key> 
     262                <string>id</string> 
     263                <key>o_video_view</key> 
     264                <string>id</string> 
     265            </dict> 
     266            <key>SUPERCLASS</key> 
     267            <string>NSObject</string> 
     268        </dict> 
     269        <dict> 
     270            <key>CLASS</key> 
     271            <string>FirstResponder</string> 
     272            <key>LANGUAGE</key> 
     273            <string>ObjC</string> 
     274            <key>SUPERCLASS</key> 
     275            <string>NSObject</string> 
     276        </dict> 
     277        <dict> 
     278            <key>CLASS</key> 
     279            <string>NSObject</string> 
     280            <key>LANGUAGE</key> 
     281            <string>ObjC</string> 
     282        </dict> 
     283        <dict> 
     284            <key>ACTIONS</key> 
     285            <dict> 
     286                <key>advancedToggle</key> 
     287                <string>id</string> 
     288                <key>closePrefs</key> 
     289                <string>id</string> 
     290                <key>resetAll</key> 
     291                <string>id</string> 
     292                <key>savePrefs</key> 
     293                <string>id</string> 
     294            </dict> 
     295            <key>CLASS</key> 
     296            <string>VLCPrefs</string> 
     297            <key>LANGUAGE</key> 
     298            <string>ObjC</string> 
     299            <key>OUTLETS</key> 
     300            <dict> 
     301                <key>o_advanced_ckb</key> 
     302                <string>id</string> 
     303                <key>o_cancel_btn</key> 
     304                <string>id</string> 
     305                <key>o_prefs_view</key> 
     306                <string>id</string> 
     307                <key>o_prefs_window</key> 
     308                <string>id</string> 
     309                <key>o_reset_btn</key> 
     310                <string>id</string> 
     311                <key>o_save_btn</key> 
     312                <string>id</string> 
     313                <key>o_title</key> 
     314                <string>id</string> 
     315                <key>o_tree</key> 
     316                <string>id</string> 
     317            </dict> 
     318            <key>SUPERCLASS</key> 
     319            <string>NSObject</string> 
     320        </dict> 
     321    </array> 
     322    <key>IBVersion</key> 
     323    <string>1</string> 
     324</dict> 
     325</plist> 
  • extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib

    r887efa4 r4d8b370  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
    33<plist version="1.0"> 
    44<dict> 
    5     <key>IBDocumentLocation</key> 
    6     <string>391 94 505 518 0 0 1280 778 </string> 
    7     <key>IBEditorPositions</key> 
    8     <dict> 
    9         <key>2311</key> 
    10         <string>345 406 590 264 0 0 1280 778 </string> 
    11         <key>2330</key> 
    12         <string>345 266 590 502 0 0 1280 778 </string> 
    13         <key>2440</key> 
    14         <string>345 343 590 389 0 0 1280 778 </string> 
    15         <key>2523</key> 
    16         <string>345 351 590 373 0 0 1280 778 </string> 
    17         <key>2562</key> 
    18         <string>345 310 590 455 0 0 1280 778 </string> 
    19     </dict> 
    205    <key>IBFramework Version</key> 
    21     <string>446.1</string> 
    22     <key>IBGroupedObjects</key> 
    23     <dict> 
    24         <key>1</key> 
    25         <array> 
    26             <string>2352</string> 
    27             <string>2353</string> 
    28         </array> 
    29     </dict> 
    30     <key>IBLastGroupID</key> 
    31     <string>3</string> 
    32     <key>IBLockedObjects</key> 
    33     <array> 
    34         <integer>2203</integer> 
    35         <integer>2208</integer> 
    36         <integer>2206</integer> 
    37         <integer>2199</integer> 
    38     </array> 
     6    <string>644</string> 
     7    <key>IBLastKnownRelativeProjectPath</key> 
     8    <string>../../vlc.xcodeproj</string> 
     9    <key>IBOldestOS</key> 
     10    <integer>5</integer> 
    3911    <key>IBOpenObjects</key> 
    4012    <array> 
    41         <integer>2265</integer> 
     13        <integer>2562</integer> 
     14        <integer>2410</integer> 
     15        <integer>2440</integer> 
    4216        <integer>2523</integer> 
    43         <integer>2562</integer> 
    44         <integer>2440</integer> 
     17        <integer>2678</integer> 
     18        <integer>2668</integer> 
    4519        <integer>2311</integer> 
    4620    </array> 
    4721    <key>IBSystem Version</key> 
    48     <string>8S2167</string> 
     22    <string>9C31</string> 
     23    <key>targetFramework</key> 
     24    <string>IBCocoaFramework</string> 
    4925</dict> 
    5026</plist> 
  • modules/gui/macosx/playlistinfo.m

    rd0d0541 r4d8b370  
    190190    char *psz_##foo = input_item_Get##bar ( p_item->p_input ); \ 
    191191    [self setMeta: psz_##foo forLabel: o_##foo##_txt]; \ 
    192     free( psz_##foo ); 
     192    FREENULL( psz_##foo ); 
    193193 
    194194    /* fill the other fields */ 
  • modules/gui/macosx/simple_prefs.h

    r887efa4 r4d8b370  
    5252    IBOutlet id o_audio_vol_txt; 
    5353 
     54    IBOutlet id o_hotkeys_change_btn; 
     55    IBOutlet id o_hotkeys_change_lbl; 
     56    IBOutlet id o_hotkeys_change_keys_lbl; 
     57    IBOutlet id o_hotkeys_change_taken_lbl; 
     58    IBOutlet id o_hotkeys_change_win; 
     59    IBOutlet id o_hotkeys_change_cancel_btn; 
     60    IBOutlet id o_hotkeys_change_ok_btn; 
     61    IBOutlet id o_hotkeys_clear_btn; 
     62    IBOutlet id o_hotkeys_lbl; 
     63    IBOutlet id o_hotkeys_listbox; 
     64    IBOutlet id o_hotkeys_view; 
     65 
    5466    IBOutlet id o_input_access_box; 
    5567    IBOutlet id o_input_avi_pop; 
     
    136148    BOOL b_osdSettingChanged; 
    137149    BOOL b_inputSettingChanged; 
     150    BOOL b_hotkeyChanged; 
    138151    id o_currentlyShownCategoryView; 
    139152 
    140153    NSToolbar *o_sprefs_toolbar; 
    141154    NSOpenPanel *o_selectFolderPanel; 
     155    NSArray *o_hotkeyDescriptions; 
     156    NSMutableArray *o_hotkeySettings; 
    142157 
    143158    intf_thread_t *p_intf; 
    144159} 
    145160+ (VLCSimplePrefs *)sharedInstance; 
     161- (NSString *)OSXKeyToString:(int)val; 
    146162 
    147163/* toolbar */ 
     
    184200 
    185201/* hotkeys */ 
     202- (IBAction)hotkeySettingChanged:(id)sender; 
     203- (void)showHotkeySettings; 
     204- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView; 
     205- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex; 
     206- (void)changeHotkeyTo: (NSString *)o_theNewKey; 
    186207 
    187208@end 
     209 
     210@interface VLCHotkeyChangeWindow : NSWindow 
     211 
     212- (void)keyDown:(NSEvent *)theEvent; 
     213 
     214@end 
  • modules/gui/macosx/simple_prefs.m

    r887efa4 r4d8b370  
    2424#import "simple_prefs.h" 
    2525#import "prefs.h" 
     26#import <vlc_keys.h> 
    2627 
    2728static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier"; 
     
    5859    [o_currentlyShownCategoryView release]; 
    5960    [o_sprefs_toolbar release]; 
    60      
     61 
     62    [o_hotkeySettings release]; 
     63    [o_hotkeyDescriptions release]; 
     64 
    6165    [super dealloc]; 
     66} 
     67 
     68 
     69- (NSString *)OSXKeyToString:(int)val 
     70{ 
     71    NSMutableString *o_temp_str = [[[NSMutableString alloc] init] autorelease]; 
     72    if( val & KEY_MODIFIER_CTRL ) 
     73        [o_temp_str appendString: @"Ctrl+"]; 
     74    if( val & KEY_MODIFIER_ALT ) 
     75        [o_temp_str appendString: @"Alt+"]; 
     76    if( val & KEY_MODIFIER_SHIFT ) 
     77        [o_temp_str appendString: @"Shift+"]; 
     78    if( val & KEY_MODIFIER_COMMAND ) 
     79        [o_temp_str appendString: @"Command+"]; 
     80     
     81    unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t); 
     82    for( unsigned int i = 0; i< i_keys; i++ ) 
     83    { 
     84        if( vlc_keys[i].i_key_code == (val& ~KEY_MODIFIER) ) 
     85        { 
     86            [o_temp_str appendString: [NSString stringWithUTF8String: vlc_keys[i].psz_key_string]]; 
     87        } 
     88    } 
     89    return o_temp_str; 
    6290} 
    6391 
     
    84112    NSToolbarItem *o_toolbarItem = nil; 
    85113     
     114    #define CreateToolbarItem( o_name, o_desc, o_img, sel ) \ 
     115    o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease]; \ 
     116    \ 
     117    [o_toolbarItem setLabel: o_name]; \ 
     118    [o_toolbarItem setPaletteLabel: o_desc]; \ 
     119    \ 
     120    [o_toolbarItem setToolTip: o_desc]; \ 
     121    [o_toolbarItem setImage: [NSImage imageNamed: o_img]]; \ 
     122    \ 
     123    [o_toolbarItem setTarget: self]; \ 
     124    [o_toolbarItem setAction: @selector( sel )]; \ 
     125    \ 
     126    [o_toolbarItem setEnabled: YES]; \ 
     127    [o_toolbarItem setAutovalidates: YES] 
     128     
    86129    if( [o_itemIdent isEqual: VLCIntfSettingToolbarIdentifier] ) 
    87130    { 
    88         o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease]; 
    89  
    90         [o_toolbarItem setLabel: _NS("Interface")]; 
    91         [o_toolbarItem setPaletteLabel: _NS("Interface settings")]; 
    92  
    93         [o_toolbarItem setToolTip: _NS("Interface settings")]; 
    94         [o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Interface_64"]]; 
    95  
    96         [o_toolbarItem setTarget: self]; 
    97         [o_toolbarItem setAction: @selector(showInterfaceSettings)]; 
    98  
    99         [o_toolbarItem setEnabled: YES]; 
    100         [o_toolbarItem setAutovalidates: YES]; 
     131        CreateToolbarItem( _NS("Interface"), _NS("Interface Settings"), @"spref_cone_Interface_64", showInterfaceSettings ); 
    101132    } 
    102133    else if( [o_itemIdent isEqual: VLCAudioSettingToolbarIdentifier] ) 
    103134    { 
    104         o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease]; 
    105  
    106         [o_toolbarItem setLabel: _NS("Audio")]; 
    107         [o_toolbarItem setPaletteLabel: _NS("General Audio settings")]; 
    108  
    109         [o_toolbarItem setToolTip: _NS("General Audio settings")]; 
    110         [o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Audio_64"]]; 
    111  
    112         [o_toolbarItem setTarget: self]; 
    113         [o_toolbarItem setAction: @selector(showAudioSettings)]; 
    114  
    115         [o_toolbarItem setEnabled: YES]; 
    116         [o_toolbarItem setAutovalidates: YES]; 
     135        CreateToolbarItem( _NS("Audio"), _NS("General Audio Settings"), @"spref_cone_Audio_64", showAudioSettings ); 
    117136    } 
    118137    else if( [o_itemIdent isEqual: VLCVideoSettingToolbarIdentifier] ) 
    119138    { 
    120         o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease]; 
    121  
    122         [o_toolbarItem setLabel: _NS("Video")]; 
    123         [o_toolbarItem setPaletteLabel: _NS("General Video settings")]; 
    124  
    125         [o_toolbarItem setToolTip: _NS("General Video settings")]; 
    126         [o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Video_64"]]; 
    127  
    128         [o_toolbarItem setTarget: self]; 
    129         [o_toolbarItem setAction: @selector(showVideoSettings)]; 
    130  
    131         [o_toolbarItem setEnabled: YES]; 
    132         [o_toolbarItem setAutovalidates: YES]; 
     139        CreateToolbarItem( _NS("Video"), _NS("General Video Settings"), @"spref_cone_Video_64", showVideoSettings ); 
    133140    } 
    134141    else if( [o_itemIdent isEqual: VLCOSDSettingToolbarIdentifier] ) 
    135142    { 
    136         o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease]; 
    137  
    138         [o_toolbarItem setLabel: _NS("Subtitles & OSD")]; 
    139         [o_toolbarItem setPaletteLabel: _NS("Subtitles & OSD settings")]; 
    140  
    141         [o_toolbarItem setToolTip: _NS("Subtitles & OSD settings")]; 
    142         [o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Subtitles_64"]]; 
    143  
    144         [o_toolbarItem setTarget: self]; 
    145         [o_toolbarItem setAction: @selector(showOSDSettings)]; 
    146  
    147         [o_toolbarItem setEnabled: YES]; 
    148         [o_toolbarItem setAutovalidates: YES]; 
     143        CreateToolbarItem( _NS("Subtitles & OSD"), _NS("Subtitles & OSD Settings"), @"spref_cone_Subtitles_64", showOSDSettings ); 
    149144    } 
    150145    else if( [o_itemIdent isEqual: VLCInputSettingToolbarIdentifier] ) 
    151146    { 
    152         o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease]; 
    153  
    154         [o_toolbarItem setLabel: _NS("Input & Codecs")]; 
    155         [o_toolbarItem setPaletteLabel: _NS("Input & Codec settings")]; 
    156  
    157         [o_toolbarItem setToolTip: _NS("Input & Codec settings")]; 
    158         [o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Input_64"]]; 
    159  
    160         [o_toolbarItem setTarget: self]; 
    161         [o_toolbarItem setAction: @selector(showInputSettings)]; 
    162  
    163         [o_toolbarItem setEnabled: YES]; 
    164         [o_toolbarItem setAutovalidates: YES]; 
     147        CreateToolbarItem( _NS("Input & Codecs"), _NS("Input & Codec settings"), @"spref_cone_Input_64", showInputSettings ); 
     148    } 
     149    else if( [o_itemIdent isEqual: VLCHotkeysSettingToolbarIdentifier] ) 
     150    { 
     151        CreateToolbarItem( _NS("Hotkeys"), _NS("Hotkeys settings"), @"spref_cone_Hotkeys_64", showHotkeySettings ); 
    165152    } 
    166153 
     
    171158{ 
    172159    return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,  
    173         VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil]; 
     160        VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil]; 
    174161} 
    175162 
     
    177164{ 
    178165    return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,  
    179         VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil]; 
     166        VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil]; 
    180167} 
    181168 
     
    183170{ 
    184171    return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,  
    185         VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, nil]; 
     172        VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, nil]; 
    186173} 
    187174 
     
    390377     * hotkeys settings * 
    391378     ********************/ 
     379    struct hotkey *p_hotkeys = p_intf->p_libvlc->p_hotkeys; 
     380    o_hotkeySettings = [[NSMutableArray alloc] init]; 
     381    NSMutableArray *o_tempArray_desc = [[NSMutableArray alloc] init]; 
     382    i = 1; 
     383 
     384    while( i < 100 ) 
     385    { 
     386        p_item = config_FindConfig( VLC_OBJECT(p_intf), p_hotkeys[i].psz_action ); 
     387        if( !p_item ) 
     388            break; 
     389 
     390        [o_tempArray_desc addObject: _NS( p_item->psz_text )]; 
     391        [o_hotkeySettings addObject: [self OSXKeyToString: p_item->value.i]]; 
     392 
     393        i++; 
     394    } 
     395    o_hotkeyDescriptions = [[NSArray alloc] initWithArray: o_tempArray_desc copyItems: YES]; 
     396    [o_tempArray_desc release]; 
     397    [o_hotkeys_listbox reloadData]; 
    392398} 
    393399 
     
    687693     * hotkeys settings * 
    688694     ********************/ 
     695    if( b_hotkeyChanged ) 
     696    { 
     697        struct hotkey *p_hotkeys = p_intf->p_libvlc->p_hotkeys; 
     698        i = 1; 
     699        while( i < [o_hotkeySettings count] ) // FIXME: this is ugly! 
     700        { 
     701            /* FIXME: this does only work for single keys!!! */ 
     702            config_PutInt( p_intf, p_hotkeys[i].psz_action, StringToKey( (char *)[[o_hotkeySettings objectAtIndex: i] UTF8String] ) ); 
     703 
     704            i++; 
     705        }         
     706         
     707        i = config_SaveConfigFile( p_intf, "main" ); 
     708         
     709        if( i != 0 ) 
     710        { 
     711            msg_Err( p_intf, "An error occured while saving the Hotkey settings using SimplePrefs" ); 
     712            i = 0; 
     713        } 
     714        b_hotkeyChanged = NO; 
     715    } 
    689716} 
    690717 
     
    837864} 
    838865 
     866- (IBAction)hotkeySettingChanged:(id)sender 
     867{ 
     868    if( sender == o_hotkeys_change_btn || sender == o_hotkeys_listbox ) 
     869    { 
     870        [o_hotkeys_change_lbl setStringValue: [NSString stringWithFormat: _NS("Press new keys for\n\"%@\""),  
     871                                               [o_hotkeyDescriptions objectAtIndex: [o_hotkeys_listbox selectedRow]]]]; 
     872        [o_hotkeys_change_keys_lbl setStringValue: [o_hotkeySettings objectAtIndex: [o_hotkeys_listbox selectedRow]]]; 
     873        [o_hotkeys_change_taken_lbl setStringValue: @""]; 
     874        [o_hotkeys_change_win setInitialFirstResponder: [o_hotkeys_change_win contentView]]; 
     875        [o_hotkeys_change_win makeFirstResponder: [o_hotkeys_change_win contentView]]; 
     876        [NSApp runModalForWindow: o_hotkeys_change_win]; 
     877    } 
     878    else if( sender == o_hotkeys_change_cancel_btn ) 
     879    { 
     880        [NSApp stopModal]; 
     881        [o_hotkeys_change_win close]; 
     882    } 
     883    else if( sender == o_hotkeys_change_ok_btn ) 
     884    { 
     885        int i_returnValue; 
     886        b_hotkeyChanged = YES; 
     887 
     888        i_returnValue = [o_hotkeySettings indexOfObject: [o_hotkeys_change_keys_lbl stringValue]]; 
     889        if( i_returnValue != NSNotFound ) 
     890            [o_hotkeySettings replaceObjectAtIndex: i_returnValue withObject: @"Unset"];         
     891 
     892        [o_hotkeySettings replaceObjectAtIndex: [o_hotkeys_listbox selectedRow] withObject: [o_hotkeys_change_keys_lbl stringValue]]; 
     893 
     894        [NSApp stopModal]; 
     895        [o_hotkeys_change_win close]; 
     896 
     897        [o_hotkeys_listbox reloadData]; 
     898    } 
     899    else if( sender == o_hotkeys_clear_btn ) 
     900    { 
     901        [o_hotkeySettings replaceObjectAtIndex: [o_hotkeys_listbox selectedRow] withObject: @"Unset"]; 
     902        [o_hotkeys_listbox reloadData]; 
     903        b_hotkeyChanged = YES; 
     904    } 
     905} 
     906 
     907- (void)showHotkeySettings 
     908{ 
     909    msg_Dbg( p_intf, "showing HotKey Settings" ); 
     910    [self showSettingsForCategory: o_hotkeys_view]; 
     911} 
     912 
    &nbs