1 /*****************************************************************************
2 * prefs_widgets.m: Preferences controls
3 *****************************************************************************
4 * Copyright (C) 2002-2007 the VideoLAN team
7 * Authors: Derk-Jan Hartman <hartman at videolan.org>
8 * Jérôme Decoodt <djc at videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
35 #include "prefs_widgets.h"
37 #define PREFS_WRAP 300
38 #define OFFSET_RIGHT 20
39 #define OFFSET_BETWEEN 2
41 #define UPWARDS_WHITE_ARROW "\xE2\x87\xA7"
42 #define OPTION_KEY "\xE2\x8C\xA5"
43 #define UP_ARROWHEAD "\xE2\x8C\x83"
44 #define PLACE_OF_INTEREST_SIGN "\xE2\x8C\x98"
46 #define POPULATE_A_KEY( o_menu, string, value ) \
50 o_mi = [[NSMenuItem alloc] initWithTitle:string \
51 action:nil keyEquivalent:@""]; \
52 [o_mi setKeyEquivalentModifierMask: \
54 [o_mi setAlternate: NO]; \
57 [o_menu addItem: o_mi]; \
59 o_mi = [[NSMenuItem alloc] initWithTitle: \
60 [[NSString stringWithUTF8String: \
62 ] stringByAppendingString: string] \
63 action:nil keyEquivalent:@""]; \
64 [o_mi setKeyEquivalentModifierMask: \
66 [o_mi setAlternate: YES]; \
68 KEY_MODIFIER_CTRL | ( value )]; \
69 [o_menu addItem: o_mi]; \
71 o_mi = [[NSMenuItem alloc] initWithTitle: \
72 [[NSString stringWithUTF8String: \
73 UP_ARROWHEAD OPTION_KEY \
74 ] stringByAppendingString: string] \
75 action:nil keyEquivalent:@""]; \
76 [o_mi setKeyEquivalentModifierMask: \
77 NSControlKeyMask | NSAlternateKeyMask]; \
78 [o_mi setAlternate: YES]; \
80 (KEY_MODIFIER_CTRL | KEY_MODIFIER_ALT) | ( value )]; \
81 [o_menu addItem: o_mi]; \
83 o_mi = [[NSMenuItem alloc] initWithTitle: \
84 [[NSString stringWithUTF8String: \
85 UP_ARROWHEAD UPWARDS_WHITE_ARROW \
86 ] stringByAppendingString: string] \
87 action:nil keyEquivalent:@""]; \
88 [o_mi setKeyEquivalentModifierMask: \
89 NSControlKeyMask | NSShiftKeyMask]; \
90 [o_mi setAlternate: YES]; \
92 (KEY_MODIFIER_CTRL | KEY_MODIFIER_SHIFT) | ( value )]; \
93 [o_menu addItem: o_mi]; \
95 o_mi = [[NSMenuItem alloc] initWithTitle: \
96 [[NSString stringWithUTF8String: \
97 UP_ARROWHEAD PLACE_OF_INTEREST_SIGN \
98 ] stringByAppendingString: string] \
99 action:nil keyEquivalent:@""]; \
100 [o_mi setKeyEquivalentModifierMask: \
101 NSControlKeyMask | NSCommandKeyMask]; \
102 [o_mi setAlternate: YES]; \
104 (KEY_MODIFIER_CTRL | KEY_MODIFIER_COMMAND) | ( value )]; \
105 [o_menu addItem: o_mi]; \
106 /* Ctrl+Alt+Shift */ \
107 o_mi = [[NSMenuItem alloc] initWithTitle: \
108 [[NSString stringWithUTF8String: \
109 UP_ARROWHEAD OPTION_KEY UPWARDS_WHITE_ARROW \
110 ] stringByAppendingString: string] \
111 action:nil keyEquivalent:@""]; \
112 [o_mi setKeyEquivalentModifierMask: \
113 NSControlKeyMask | NSAlternateKeyMask | NSShiftKeyMask]; \
114 [o_mi setAlternate: YES]; \
116 (KEY_MODIFIER_CTRL | KEY_MODIFIER_ALT | KEY_MODIFIER_SHIFT) | \
118 [o_menu addItem: o_mi]; \
119 /* Ctrl+Alt+Apple */ \
120 o_mi = [[NSMenuItem alloc] initWithTitle: \
121 [[NSString stringWithUTF8String: \
122 UP_ARROWHEAD OPTION_KEY PLACE_OF_INTEREST_SIGN \
123 ] stringByAppendingString: string] \
124 action:nil keyEquivalent:@""]; \
125 [o_mi setKeyEquivalentModifierMask: \
126 NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask]; \
127 [o_mi setAlternate: YES]; \
129 (KEY_MODIFIER_CTRL | KEY_MODIFIER_ALT | KEY_MODIFIER_COMMAND) | \
131 [o_menu addItem: o_mi]; \
132 /* Ctrl+Shift+Apple */ \
133 o_mi = [[NSMenuItem alloc] initWithTitle: \
134 [[NSString stringWithUTF8String: \
135 UP_ARROWHEAD UPWARDS_WHITE_ARROW PLACE_OF_INTEREST_SIGN \
136 ] stringByAppendingString: string] \
137 action:nil keyEquivalent:@""]; \
138 [o_mi setKeyEquivalentModifierMask: \
139 NSControlKeyMask | NSShiftKeyMask | NSCommandKeyMask]; \
140 [o_mi setAlternate: YES]; \
142 (KEY_MODIFIER_CTRL | KEY_MODIFIER_SHIFT | KEY_MODIFIER_COMMAND) | \
144 [o_menu addItem: o_mi]; \
145 /* Ctrl+Alt+Shift+Apple */ \
146 o_mi = [[NSMenuItem alloc] initWithTitle: \
147 [[NSString stringWithUTF8String: \
148 UP_ARROWHEAD OPTION_KEY UPWARDS_WHITE_ARROW \
149 PLACE_OF_INTEREST_SIGN \
150 ] stringByAppendingString: string] \
151 action:nil keyEquivalent:@""]; \
152 [o_mi setKeyEquivalentModifierMask: \
153 NSControlKeyMask | NSAlternateKeyMask | NSShiftKeyMask | \
155 [o_mi setAlternate: YES]; \
157 (KEY_MODIFIER_CTRL | KEY_MODIFIER_ALT | KEY_MODIFIER_SHIFT | \
158 KEY_MODIFIER_COMMAND) | ( value )]; \
159 [o_menu addItem: o_mi]; \
161 o_mi = [[NSMenuItem alloc] initWithTitle: \
162 [[NSString stringWithUTF8String: \
164 ] stringByAppendingString: string] \
165 action:nil keyEquivalent:@""]; \
166 [o_mi setKeyEquivalentModifierMask: \
167 NSAlternateKeyMask]; \
168 [o_mi setAlternate: YES]; \
170 KEY_MODIFIER_ALT | ( value )]; \
171 [o_menu addItem: o_mi]; \
173 o_mi = [[NSMenuItem alloc] initWithTitle: \
174 [[NSString stringWithUTF8String: \
175 OPTION_KEY UPWARDS_WHITE_ARROW \
176 ] stringByAppendingString: string] \
177 action:nil keyEquivalent:@""]; \
178 [o_mi setKeyEquivalentModifierMask: \
179 NSAlternateKeyMask | NSShiftKeyMask]; \
180 [o_mi setAlternate: YES]; \
182 (KEY_MODIFIER_ALT | KEY_MODIFIER_SHIFT) | ( value )]; \
183 [o_menu addItem: o_mi]; \
185 o_mi = [[NSMenuItem alloc] initWithTitle: \
186 [[NSString stringWithUTF8String: \
187 OPTION_KEY PLACE_OF_INTEREST_SIGN \
188 ] stringByAppendingString: string] \
189 action:nil keyEquivalent:@""]; \
190 [o_mi setKeyEquivalentModifierMask: \
191 NSAlternateKeyMask | NSCommandKeyMask]; \
192 [o_mi setAlternate: YES]; \
194 (KEY_MODIFIER_ALT | KEY_MODIFIER_COMMAND) | ( value )]; \
195 [o_menu addItem: o_mi]; \
196 /* Alt+Shift+Apple */ \
197 o_mi = [[NSMenuItem alloc] initWithTitle: \
198 [[NSString stringWithUTF8String: \
199 OPTION_KEY UPWARDS_WHITE_ARROW PLACE_OF_INTEREST_SIGN \
200 ] stringByAppendingString: string] \
201 action:nil keyEquivalent:@""]; \
202 [o_mi setKeyEquivalentModifierMask: \
203 NSAlternateKeyMask | NSShiftKeyMask | NSCommandKeyMask]; \
204 [o_mi setAlternate: YES]; \
206 (KEY_MODIFIER_ALT | KEY_MODIFIER_SHIFT | KEY_MODIFIER_COMMAND) | \
208 [o_menu addItem: o_mi]; \
210 o_mi = [[NSMenuItem alloc] initWithTitle: \
211 [[NSString stringWithUTF8String: \
212 UPWARDS_WHITE_ARROW \
213 ] stringByAppendingString: string] \
214 action:nil keyEquivalent:@""]; \
215 [o_mi setKeyEquivalentModifierMask: \
217 [o_mi setAlternate: YES]; \
219 KEY_MODIFIER_SHIFT | ( value )]; \
220 [o_menu addItem: o_mi]; \
222 o_mi = [[NSMenuItem alloc] initWithTitle: \
223 [[NSString stringWithUTF8String: \
224 UPWARDS_WHITE_ARROW PLACE_OF_INTEREST_SIGN \
225 ] stringByAppendingString: string] \
226 action:nil keyEquivalent:@""]; \
227 [o_mi setKeyEquivalentModifierMask: \
228 NSShiftKeyMask | NSCommandKeyMask]; \
229 [o_mi setAlternate: YES]; \
231 (KEY_MODIFIER_SHIFT | KEY_MODIFIER_COMMAND) | ( value )]; \
232 [o_menu addItem: o_mi]; \
234 o_mi = [[NSMenuItem alloc] initWithTitle: \
235 [[NSString stringWithUTF8String: \
236 PLACE_OF_INTEREST_SIGN \
237 ] stringByAppendingString: string] \
238 action:nil keyEquivalent:@""]; \
239 [o_mi setKeyEquivalentModifierMask: \
241 [o_mi setAlternate: YES]; \
243 KEY_MODIFIER_COMMAND | ( value )]; \
244 [o_menu addItem: o_mi]; \
247 #define ADD_LABEL( o_label, superFrame, x_offset, my_y_offset, label ) \
249 NSRect s_rc = superFrame; \
250 s_rc.size.height = 17; \
251 s_rc.origin.x = x_offset - 3; \
252 s_rc.origin.y = superFrame.size.height - 17 + my_y_offset; \
253 o_label = [[[NSTextField alloc] initWithFrame: s_rc] retain]; \
254 [o_label setDrawsBackground: NO]; \
255 [o_label setBordered: NO]; \
256 [o_label setEditable: NO]; \
257 [o_label setSelectable: NO]; \
258 [o_label setStringValue: label]; \
259 [o_label setFont:[NSFont systemFontOfSize:0]]; \
260 [o_label sizeToFit]; \
263 #define ADD_TEXTFIELD( o_textfield, superFrame, x_offset, my_y_offset, \
264 my_width, tooltip, init_value ) \
266 NSRect s_rc = superFrame; \
267 s_rc.origin.x = x_offset; \
268 s_rc.origin.y = my_y_offset; \
269 s_rc.size.height = 22; \
270 s_rc.size.width = my_width; \
271 o_textfield = [[[NSTextField alloc] initWithFrame: s_rc] retain]; \
272 [o_textfield setFont:[NSFont systemFontOfSize:0]]; \
273 [o_textfield setToolTip: tooltip]; \
274 [o_textfield setStringValue: init_value]; \
277 #define ADD_COMBO( o_combo, superFrame, x_offset, my_y_offset, x2_offset, \
280 NSRect s_rc = superFrame; \
281 s_rc.origin.x = x_offset + 2; \
282 s_rc.origin.y = my_y_offset; \
283 s_rc.size.height = 26; \
284 s_rc.size.width = superFrame.size.width + 2 - s_rc.origin.x - \
286 o_combo = [[[NSComboBox alloc] initWithFrame: s_rc] retain]; \
287 [o_combo setFont:[NSFont systemFontOfSize:0]]; \
288 [o_combo setToolTip: tooltip]; \
289 [o_combo setUsesDataSource:TRUE]; \
290 [o_combo setDataSource:self]; \
291 [o_combo setNumberOfVisibleItems:10]; \
292 [o_combo setCompletes:YES]; \
295 #define ADD_RIGHT_BUTTON( o_button, superFrame, x_offset, my_y_offset, \
298 NSRect s_rc = superFrame; \
299 o_button = [[[NSButton alloc] initWithFrame: s_rc] retain]; \
300 [o_button setButtonType: NSMomentaryPushInButton]; \
301 [o_button setBezelStyle: NSRoundedBezelStyle]; \
302 [o_button setTitle: title]; \
303 [o_button setFont:[NSFont systemFontOfSize:0]]; \
304 [o_button sizeToFit]; \
305 s_rc = [o_button frame]; \
306 s_rc.origin.x = superFrame.size.width - [o_button frame].size.width - 6;\
307 s_rc.origin.y = my_y_offset - 6; \
308 s_rc.size.width += 12; \
309 [o_button setFrame: s_rc]; \
310 [o_button setToolTip: tooltip]; \
311 [o_button setTarget: self]; \
312 [o_button setAction: @selector(openFileDialog:)]; \
315 #define ADD_POPUP( o_popup, superFrame, x_offset, my_y_offset, x2_offset, \
318 NSRect s_rc = superFrame; \
319 s_rc.origin.x = x_offset - 1; \
320 s_rc.origin.y = my_y_offset; \
321 s_rc.size.height = 26; \
322 s_rc.size.width = superFrame.size.width + 2 - s_rc.origin.x - \
324 o_popup = [[[NSPopUpButton alloc] initWithFrame: s_rc] retain]; \
325 [o_popup setFont:[NSFont systemFontOfSize:0]]; \
326 [o_popup setToolTip: tooltip]; \
329 #define ADD_STEPPER( o_stepper, superFrame, x_offset, my_y_offset, tooltip, \
332 NSRect s_rc = superFrame; \
333 s_rc.origin.x = x_offset; \
334 s_rc.origin.y = my_y_offset; \
335 s_rc.size.height = 23; \
336 s_rc.size.width = 23; \
337 o_stepper = [[[NSStepper alloc] initWithFrame: s_rc] retain]; \
338 [o_stepper setFont:[NSFont systemFontOfSize:0]]; \
339 [o_stepper setToolTip: tooltip]; \
340 [o_stepper setMaxValue: higher]; \
341 [o_stepper setMinValue: lower]; \
342 [o_stepper setTarget: self]; \
343 [o_stepper setAction: @selector(stepperChanged:)]; \
344 [o_stepper sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask | \
345 NSLeftMouseDraggedMask]; \
348 #define ADD_SLIDER( o_slider, superFrame, x_offset, my_y_offset, my_width, \
349 tooltip, lower, higher ) \
351 NSRect s_rc = superFrame; \
352 s_rc.origin.x = x_offset; \
353 s_rc.origin.y = my_y_offset; \
354 s_rc.size.height = 21; \
355 s_rc.size.width = my_width; \
356 o_slider = [[[NSSlider alloc] initWithFrame: s_rc] retain]; \
357 [o_slider setFont:[NSFont systemFontOfSize:0]]; \
358 [o_slider setToolTip: tooltip]; \
359 [o_slider setMaxValue: higher]; \
360 [o_slider setMinValue: lower]; \
363 #define ADD_CHECKBOX( o_checkbox, superFrame, x_offset, my_y_offset, label, \
364 tooltip, init_value, position ) \
366 NSRect s_rc = superFrame; \
367 s_rc.size.height = 18; \
368 s_rc.origin.x = x_offset - 2; \
369 s_rc.origin.y = superFrame.size.height - 18 + my_y_offset; \
370 o_checkbox = [[[NSButton alloc] initWithFrame: s_rc] retain]; \
371 [o_checkbox setFont:[NSFont systemFontOfSize:0]]; \
372 [o_checkbox setButtonType: NSSwitchButton]; \
373 [o_checkbox setImagePosition: position]; \
374 [o_checkbox setIntValue: init_value]; \
375 [o_checkbox setTitle: label]; \
376 [o_checkbox setToolTip: tooltip]; \
377 [o_checkbox sizeToFit]; \
380 @implementation VLCConfigControl
381 - (id)initWithFrame: (NSRect)frame
383 return [self initWithFrame: frame
387 - (id)initWithFrame: (NSRect)frame
388 item: (module_config_t *)_p_item
390 self = [super initWithFrame: frame];
395 psz_name = strdup( p_item->psz_name );
397 i_type = p_item->i_type;
399 b_advanced = p_item->b_advanced;
400 [self setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin ];
405 - (void)setYPos:(int)i_yPos
407 NSRect frame = [self frame];
408 frame.origin.y = i_yPos;
409 [self setFrame:frame];
414 if( o_label ) [o_label release];
415 if( psz_name ) free( psz_name );
419 + (int)calcVerticalMargin: (int)i_curItem lastItem: (int)i_lastItem
424 case CONFIG_ITEM_STRING:
427 case CONFIG_ITEM_STRING:
430 case CONFIG_ITEM_STRING_LIST:
433 case CONFIG_ITEM_FILE:
436 case CONFIG_ITEM_MODULE:
439 case CONFIG_ITEM_INTEGER:
442 case CONFIG_ITEM_RANGED_INTEGER:
445 case CONFIG_ITEM_BOOL:
448 case CONFIG_ITEM_KEY_BEFORE_10_3:
451 case CONFIG_ITEM_KEY_AFTER_10_3:
454 case CONFIG_ITEM_MODULE_LIST:
462 case CONFIG_ITEM_STRING_LIST:
465 case CONFIG_ITEM_STRING:
468 case CONFIG_ITEM_STRING_LIST:
471 case CONFIG_ITEM_FILE:
474 case CONFIG_ITEM_MODULE:
477 case CONFIG_ITEM_INTEGER:
480 case CONFIG_ITEM_RANGED_INTEGER:
483 case CONFIG_ITEM_BOOL:
486 case CONFIG_ITEM_KEY_BEFORE_10_3:
489 case CONFIG_ITEM_KEY_AFTER_10_3:
492 case CONFIG_ITEM_MODULE_LIST:
500 case CONFIG_ITEM_FILE:
503 case CONFIG_ITEM_STRING:
506 case CONFIG_ITEM_STRING_LIST:
509 case CONFIG_ITEM_FILE:
512 case CONFIG_ITEM_MODULE:
515 case CONFIG_ITEM_INTEGER:
518 case CONFIG_ITEM_RANGED_INTEGER:
521 case CONFIG_ITEM_BOOL:
524 case CONFIG_ITEM_KEY_BEFORE_10_3:
527 case CONFIG_ITEM_KEY_AFTER_10_3:
530 case CONFIG_ITEM_MODULE_LIST:
538 case CONFIG_ITEM_MODULE:
541 case CONFIG_ITEM_STRING:
544 case CONFIG_ITEM_STRING_LIST:
547 case CONFIG_ITEM_FILE:
550 case CONFIG_ITEM_MODULE:
553 case CONFIG_ITEM_INTEGER:
556 case CONFIG_ITEM_RANGED_INTEGER:
559 case CONFIG_ITEM_BOOL:
562 case CONFIG_ITEM_KEY_BEFORE_10_3:
565 case CONFIG_ITEM_KEY_AFTER_10_3:
568 case CONFIG_ITEM_MODULE_LIST:
576 case CONFIG_ITEM_INTEGER:
579 case CONFIG_ITEM_STRING:
582 case CONFIG_ITEM_STRING_LIST:
585 case CONFIG_ITEM_FILE:
588 case CONFIG_ITEM_MODULE:
591 case CONFIG_ITEM_INTEGER:
594 case CONFIG_ITEM_RANGED_INTEGER:
597 case CONFIG_ITEM_BOOL:
600 case CONFIG_ITEM_KEY_BEFORE_10_3:
603 case CONFIG_ITEM_KEY_AFTER_10_3:
606 case CONFIG_ITEM_MODULE_LIST:
614 case CONFIG_ITEM_RANGED_INTEGER:
617 case CONFIG_ITEM_STRING:
620 case CONFIG_ITEM_STRING_LIST:
623 case CONFIG_ITEM_FILE:
626 case CONFIG_ITEM_MODULE:
629 case CONFIG_ITEM_INTEGER:
632 case CONFIG_ITEM_RANGED_INTEGER:
635 case CONFIG_ITEM_BOOL:
638 case CONFIG_ITEM_KEY_BEFORE_10_3:
641 case CONFIG_ITEM_KEY_AFTER_10_3:
644 case CONFIG_ITEM_MODULE_LIST:
652 case CONFIG_ITEM_BOOL:
655 case CONFIG_ITEM_STRING:
658 case CONFIG_ITEM_STRING_LIST:
661 case CONFIG_ITEM_FILE:
664 case CONFIG_ITEM_MODULE:
667 case CONFIG_ITEM_INTEGER:
670 case CONFIG_ITEM_RANGED_INTEGER:
673 case CONFIG_ITEM_BOOL:
676 case CONFIG_ITEM_KEY_BEFORE_10_3:
679 case CONFIG_ITEM_KEY_AFTER_10_3:
682 case CONFIG_ITEM_MODULE_LIST:
690 case CONFIG_ITEM_KEY_BEFORE_10_3:
693 case CONFIG_ITEM_STRING:
696 case CONFIG_ITEM_STRING_LIST:
699 case CONFIG_ITEM_FILE:
702 case CONFIG_ITEM_MODULE:
705 case CONFIG_ITEM_INTEGER:
708 case CONFIG_ITEM_RANGED_INTEGER:
711 case CONFIG_ITEM_BOOL:
714 case CONFIG_ITEM_KEY_BEFORE_10_3:
717 case CONFIG_ITEM_KEY_AFTER_10_3:
720 case CONFIG_ITEM_MODULE_LIST:
728 case CONFIG_ITEM_KEY_AFTER_10_3:
731 case CONFIG_ITEM_STRING:
734 case CONFIG_ITEM_STRING_LIST:
737 case CONFIG_ITEM_FILE:
740 case CONFIG_ITEM_MODULE:
743 case CONFIG_ITEM_INTEGER:
746 case CONFIG_ITEM_RANGED_INTEGER:
749 case CONFIG_ITEM_BOOL:
752 case CONFIG_ITEM_KEY_BEFORE_10_3:
755 case CONFIG_ITEM_KEY_AFTER_10_3:
758 case CONFIG_ITEM_MODULE_LIST:
766 case CONFIG_ITEM_MODULE_LIST:
769 case CONFIG_ITEM_STRING:
772 case CONFIG_ITEM_STRING_LIST:
775 case CONFIG_ITEM_FILE:
778 case CONFIG_ITEM_MODULE:
781 case CONFIG_ITEM_INTEGER:
784 case CONFIG_ITEM_RANGED_INTEGER:
787 case CONFIG_ITEM_BOOL:
790 case CONFIG_ITEM_KEY_BEFORE_10_3:
793 case CONFIG_ITEM_KEY_AFTER_10_3:
796 case CONFIG_ITEM_MODULE_LIST:
811 + (VLCConfigControl *)newControl: (module_config_t *)_p_item
812 withView: (NSView *)o_parent_view
814 VLCConfigControl *p_control = NULL;
815 /* Skip depracated options */
816 if( _p_item->psz_current )
821 switch( _p_item->i_type )
823 case CONFIG_ITEM_STRING:
824 if( !_p_item->i_list )
826 p_control = [[StringConfigControl alloc]
827 initWithItem: _p_item
828 withView: o_parent_view];
832 p_control = [[StringListConfigControl alloc]
833 initWithItem: _p_item
834 withView: o_parent_view];
837 case CONFIG_ITEM_FILE:
838 case CONFIG_ITEM_DIRECTORY:
839 p_control = [[FileConfigControl alloc]
840 initWithItem: _p_item
841 withView: o_parent_view];
843 case CONFIG_ITEM_MODULE:
844 case CONFIG_ITEM_MODULE_CAT:
845 p_control = [[ModuleConfigControl alloc]
846 initWithItem: _p_item
847 withView: o_parent_view];
849 case CONFIG_ITEM_INTEGER:
850 if( _p_item->i_list )
852 p_control = [[IntegerListConfigControl alloc]
853 initWithItem: _p_item
854 withView: o_parent_view];
856 else if( _p_item->min.i != 0 || _p_item->max.i != 0 )
858 p_control = [[RangedIntegerConfigControl alloc]
859 initWithItem: _p_item
860 withView: o_parent_view];
864 p_control = [[IntegerConfigControl alloc]
865 initWithItem: _p_item
866 withView: o_parent_view];
869 case CONFIG_ITEM_BOOL:
870 p_control = [[BoolConfigControl alloc]
871 initWithItem: _p_item
872 withView: o_parent_view];
874 case CONFIG_ITEM_FLOAT:
875 if( _p_item->min.f != 0 || _p_item->max.f != 0 )
877 p_control = [[RangedFloatConfigControl alloc]
878 initWithItem: _p_item
879 withView: o_parent_view];
883 p_control = [[FloatConfigControl alloc]
884 initWithItem: _p_item
885 withView: o_parent_view];
888 case CONFIG_ITEM_KEY:
889 p_control = [[KeyConfigControl alloc]
890 initWithItem: _p_item
891 withView: o_parent_view];
893 case CONFIG_ITEM_MODULE_LIST:
894 case CONFIG_ITEM_MODULE_LIST_CAT:
895 p_control = [[ModuleListConfigControl alloc]
896 initWithItem: _p_item
897 withView: o_parent_view];
905 - (NSString *)getName
907 return [[VLCMain sharedInstance] localizedString: psz_name];
935 - (char *)stringValue
943 switch( p_item->i_type )
945 case CONFIG_ITEM_STRING:
946 case CONFIG_ITEM_FILE:
947 case CONFIG_ITEM_DIRECTORY:
948 case CONFIG_ITEM_MODULE:
949 case CONFIG_ITEM_MODULE_LIST:
950 case CONFIG_ITEM_MODULE_LIST_CAT:
951 config_PutPsz( VLCIntf, psz_name, [self stringValue] );
953 case CONFIG_ITEM_KEY:
954 /* So you don't need to restart to have the changes take effect */
955 val.i_int = [self intValue];
956 var_Set( VLCIntf->p_libvlc, psz_name, val );
957 case CONFIG_ITEM_INTEGER:
958 case CONFIG_ITEM_BOOL:
959 config_PutInt( VLCIntf, psz_name, [self intValue] );
961 case CONFIG_ITEM_FLOAT:
962 config_PutFloat( VLCIntf, psz_name, [self floatValue] );
969 return [o_label frame].size.width;
972 - (void) alignWithXPosition:(int)i_xPos;
974 /* FIXME: not implemented atm, but created to shut up the warning
975 * about "method definition not found" -- FK @ 7/24/05 */
979 @implementation StringConfigControl
980 - (id) initWithItem: (module_config_t *)_p_item
981 withView: (NSView *)o_parent_view
983 NSRect mainFrame = [o_parent_view frame];
984 NSString *o_labelString, *o_textfieldString, *o_textfieldTooltip;
985 mainFrame.size.height = 22;
986 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
987 mainFrame.origin.x = LEFTMARGIN;
988 mainFrame.origin.y = 0;
990 if( [super initWithFrame: mainFrame item: _p_item] != nil )
992 i_view_type = CONFIG_ITEM_STRING;
994 if( p_item->psz_text )
995 o_labelString = [[VLCMain sharedInstance]
996 localizedString: (char *)p_item->psz_text];
998 o_labelString = [NSString stringWithString:@""];
999 ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString )
1000 [o_label setAutoresizingMask:NSViewNotSizable ];
1001 [self addSubview: o_label];
1003 /* build the textfield */
1004 o_textfieldTooltip = [[VLCMain sharedInstance] wrapString:
1005 [[VLCMain sharedInstance] localizedString: (char *)p_item->psz_longtext]
1006 toWidth: PREFS_WRAP];
1007 if( p_item->value.psz )
1008 o_textfieldString = [[VLCMain sharedInstance]
1009 localizedString: (char *)p_item->value.psz];
1011 o_textfieldString = [NSString stringWithString: @""];
1012 ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2,
1013 0, mainFrame.size.width - [o_label frame].size.width -
1014 2, o_textfieldTooltip, o_textfieldString )
1015 [o_textfield setAutoresizingMask:NSViewWidthSizable ];
1016 [self addSubview: o_textfield];
1021 - (void) alignWithXPosition:(int)i_xPos
1024 NSRect superFrame = [self frame];
1025 frame = [o_label frame];
1026 frame.origin.x = i_xPos - frame.size.width - 3;
1027 [o_label setFrame:frame];
1029 frame = [o_textfield frame];
1030 frame.origin.x = i_xPos + 2;
1031 frame.size.width = superFrame.size.width - frame.origin.x - 1;
1032 [o_textfield setFrame:frame];
1037 [o_textfield release];
1041 - (char *)stringValue
1043 return strdup( [[VLCMain sharedInstance] delocalizeString:
1044 [o_textfield stringValue]] );
1048 @implementation StringListConfigControl
1049 - (id) initWithItem: (module_config_t *)_p_item
1050 withView: (NSView *)o_parent_view
1052 NSRect mainFrame = [o_parent_view frame];
1053 NSString *o_labelString, *o_textfieldTooltip;
1054 mainFrame.size.height = 22;
1055 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
1056 mainFrame.origin.x = LEFTMARGIN;
1057 mainFrame.origin.y = 0;
1059 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1062 i_view_type = CONFIG_ITEM_STRING_LIST;
1064 if( p_item->psz_text )
1065 o_labelString = [[VLCMain sharedInstance]
1066 localizedString: (char *)p_item->psz_text];
1068 o_labelString = [NSString stringWithString:@""];
1069 ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString )
1070 [o_label setAutoresizingMask:NSViewNotSizable ];
1071 [self addSubview: o_label];
1073 /* build the textfield */
1074 o_textfieldTooltip = [[VLCMain sharedInstance] wrapString:
1075 [[VLCMain sharedInstance]
1076 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1077 ADD_COMBO( o_combo, mainFrame, [o_label frame].size.width,
1078 -2, 0, o_textfieldTooltip )
1079 [o_combo setAutoresizingMask:NSViewWidthSizable ];
1080 for( i_index = 0; i_index < p_item->i_list; i_index++ )
1081 if( p_item->value.psz &&
1082 !strcmp( p_item->value.psz, p_item->ppsz_list[i_index] ) )
1083 [o_combo selectItemAtIndex: i_index];
1084 [self addSubview: o_combo];
1089 - (void) alignWithXPosition:(int)i_xPos
1092 NSRect superFrame = [self frame];
1093 frame = [o_label frame];
1094 frame.origin.x = i_xPos - frame.size.width - 3;
1095 [o_label setFrame:frame];
1097 frame = [o_combo frame];
1098 frame.origin.x = i_xPos + 2;
1099 frame.size.width = superFrame.size.width - frame.origin.x + 2;
1100 [o_combo setFrame:frame];
1109 - (char *)stringValue
1111 if( [o_combo indexOfSelectedItem] >= 0 )
1112 return strdup( p_item->ppsz_list[[o_combo indexOfSelectedItem]] );
1114 return strdup( [[VLCMain sharedInstance]
1115 delocalizeString: [o_combo stringValue]] );
1119 @implementation StringListConfigControl (NSComboBoxDataSource)
1120 - (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox
1122 return p_item->i_list;
1125 - (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)i_index
1127 if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] )
1129 return [[VLCMain sharedInstance]
1130 localizedString: (char *)p_item->ppsz_list_text[i_index]];
1131 } else return [[VLCMain sharedInstance]
1132 localizedString: (char *)p_item->ppsz_list[i_index]];
1136 @implementation FileConfigControl
1137 - (id) initWithItem: (module_config_t *)_p_item
1138 withView: (NSView *)o_parent_view
1140 NSRect mainFrame = [o_parent_view frame];
1141 NSString *o_labelString, *o_buttonTooltip, *o_textfieldString;
1142 NSString *o_textfieldTooltip;
1143 mainFrame.size.height = 46;
1144 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
1145 mainFrame.origin.x = LEFTMARGIN;
1146 mainFrame.origin.y = 0;
1148 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1150 i_view_type = CONFIG_ITEM_FILE;
1152 /* is it a directory */
1153 b_directory = ( [self getType] == CONFIG_ITEM_DIRECTORY ) ? YES : NO;
1156 if( p_item->psz_text )
1157 o_labelString = [[VLCMain sharedInstance]
1158 localizedString: (char *)p_item->psz_text];
1160 o_labelString = [NSString stringWithString:@""];
1161 ADD_LABEL( o_label, mainFrame, 0, 3, o_labelString )
1162 [o_label setAutoresizingMask:NSViewNotSizable ];
1163 [self addSubview: o_label];
1165 /* build the button */
1166 o_buttonTooltip = [[VLCMain sharedInstance]
1167 wrapString: [[VLCMain sharedInstance]
1168 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1169 ADD_RIGHT_BUTTON( o_button, mainFrame, 0, 0, o_buttonTooltip,
1171 [o_button setAutoresizingMask:NSViewMinXMargin ];
1172 [self addSubview: o_button];
1174 /* build the textfield */
1175 o_textfieldTooltip = [[VLCMain sharedInstance] wrapString:
1176 [[VLCMain sharedInstance]
1177 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1178 if( p_item->value.psz )
1179 o_textfieldString = [NSString stringWithFormat: @"%s", (char *)p_item->value.psz];
1181 o_textfieldString = [NSString stringWithString: @""];
1182 ADD_TEXTFIELD( o_textfield, mainFrame, 12, 2, mainFrame.size.width -
1183 8 - [o_button frame].size.width,
1184 o_textfieldTooltip, o_textfieldString )
1185 [o_textfield setAutoresizingMask:NSViewWidthSizable ];
1186 [self addSubview: o_textfield];
1191 - (void) alignWithXPosition:(int)i_xPos
1198 [o_textfield release];
1203 - (IBAction)openFileDialog: (id)sender
1205 NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
1207 [o_open_panel setTitle: (b_directory)?
1208 _NS("Select a directory"):_NS("Select a file")];
1209 [o_open_panel setPrompt: _NS("Select")];
1210 [o_open_panel setAllowsMultipleSelection: NO];
1211 [o_open_panel setCanChooseFiles: !b_directory];
1212 [o_open_panel setCanChooseDirectories: b_directory];
1213 [o_open_panel beginSheetForDirectory:nil
1216 modalForWindow:[sender window]
1218 didEndSelector: @selector(pathChosenInPanel:
1224 - (void)pathChosenInPanel:(NSOpenPanel *)o_sheet
1225 withReturn:(int)i_return_code contextInfo:(void *)o_context_info
1227 if( i_return_code == NSOKButton )
1229 NSString *o_path = [[o_sheet filenames] objectAtIndex: 0];
1230 [o_textfield setStringValue: o_path];
1234 - (char *)stringValue
1236 if( [[o_textfield stringValue] length] != 0)
1237 return strdup( [[o_textfield stringValue] fileSystemRepresentation] );
1243 @implementation ModuleConfigControl
1244 - (id) initWithItem: (module_config_t *)_p_item
1245 withView: (NSView *)o_parent_view
1247 NSRect mainFrame = [o_parent_view frame];
1248 NSString *o_labelString, *o_popupTooltip;
1249 mainFrame.size.height = 22;
1250 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
1251 mainFrame.origin.x = LEFTMARGIN;
1252 mainFrame.origin.y = 0;
1254 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1259 i_view_type = CONFIG_ITEM_MODULE;
1262 if( p_item->psz_text )
1263 o_labelString = [[VLCMain sharedInstance]
1264 localizedString: (char *)p_item->psz_text];
1266 o_labelString = [NSString stringWithString:@""];
1267 ADD_LABEL( o_label, mainFrame, 0, -1, o_labelString )
1268 [o_label setAutoresizingMask:NSViewNotSizable ];
1269 [self addSubview: o_label];
1271 /* build the popup */
1272 o_popupTooltip = [[VLCMain sharedInstance] wrapString:
1273 [[VLCMain sharedInstance]
1274 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1275 ADD_POPUP( o_popup, mainFrame, [o_label frame].size.width,
1276 -2, 0, o_popupTooltip )
1277 [o_popup setAutoresizingMask:NSViewWidthSizable ];
1278 [o_popup addItemWithTitle: _NS("Default")];
1279 [[o_popup lastItem] setTag: -1];
1280 [o_popup selectItem: [o_popup lastItem]];
1282 /* build a list of available modules */
1283 p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
1284 for( i_index = 0; i_index < p_list->i_count; i_index++ )
1286 p_parser = (module_t *)p_list->p_values[i_index].p_object;
1288 if( p_item->i_type == CONFIG_ITEM_MODULE )
1290 if( !strcmp( p_parser->psz_capability,
1291 p_item->psz_type ) )
1293 NSString *o_description = [[VLCMain sharedInstance]
1294 localizedString: (char *)p_parser->psz_longname];
1295 [o_popup addItemWithTitle: o_description];
1297 if( p_item->value.psz &&
1298 !strcmp( p_item->value.psz, p_parser->psz_object_name ) )
1299 [o_popup selectItem:[o_popup lastItem]];
1306 if( !strcmp( p_parser->psz_object_name, "main" ) )
1309 for ( i = 0; i < p_parser->confsize; i++ )
1311 module_config_t *p_config = p_parser->p_config + i;
1312 /* Hack: required subcategory is stored in i_min */
1313 if( p_config->i_type == CONFIG_SUBCATEGORY &&
1314 p_config->value.i == p_item->min.i )
1316 NSString *o_description = [[VLCMain sharedInstance]
1317 localizedString: (char *)p_parser->psz_longname];
1318 [o_popup addItemWithTitle: o_description];
1320 if( p_item->value.psz && !strcmp(p_item->value.psz,
1321 p_parser->psz_object_name) )
1322 [o_popup selectItem:[o_popup lastItem]];
1327 vlc_list_release( p_list );
1328 [self addSubview: o_popup];
1333 - (void) alignWithXPosition:(int)i_xPos
1336 NSRect superFrame = [self frame];
1337 frame = [o_label frame];
1338 frame.origin.x = i_xPos - frame.size.width - 3;
1339 [o_label setFrame:frame];
1341 frame = [o_popup frame];
1342 frame.origin.x = i_xPos - 1;
1343 frame.size.width = superFrame.size.width - frame.origin.x + 2;
1344 [o_popup setFrame:frame];
1353 - (char *)stringValue
1355 NSString *newval = [o_popup titleOfSelectedItem];
1356 char *returnval = NULL;
1361 p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
1362 for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ )
1364 p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
1366 if( p_item->i_type == CONFIG_ITEM_MODULE )
1368 if( !strcmp( p_parser->psz_capability,
1369 p_item->psz_type ) )
1371 NSString *o_description = [[VLCMain sharedInstance]
1372 localizedString: (char *)p_parser->psz_longname];
1373 if( [newval isEqualToString: o_description] )
1375 returnval = strdup(p_parser->psz_object_name);
1384 if( !strcmp( p_parser->psz_object_name, "main" ) )
1387 for ( i = 0; i < p_parser->confsize; i++ )
1389 module_config_t *p_config = p_parser->p_config + i;
1390 /* Hack: required subcategory is stored in i_min */
1391 if( p_config->i_type == CONFIG_SUBCATEGORY &&
1392 p_config->value.i == p_item->min.i )
1394 NSString *o_description = [[VLCMain sharedInstance]
1395 localizedString: (char *)p_parser->psz_longname];
1396 if( [newval isEqualToString: o_description] )
1398 returnval = strdup(p_parser->psz_object_name);
1405 vlc_list_release( p_list );
1410 @implementation IntegerConfigControl
1411 - (id) initWithItem: (module_config_t *)_p_item
1412 withView: (NSView *)o_parent_view
1414 NSRect mainFrame = [o_parent_view frame];
1415 NSString *o_labelString, *o_tooltip;
1416 mainFrame.size.height = 23;
1417 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
1418 mainFrame.origin.x = LEFTMARGIN;
1419 mainFrame.origin.y = 0;
1421 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1423 i_view_type = CONFIG_ITEM_INTEGER;
1425 o_tooltip = [[VLCMain sharedInstance] wrapString:
1426 [[VLCMain sharedInstance]
1427 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1430 if( p_item->psz_text )
1431 o_labelString = [[VLCMain sharedInstance]
1432 localizedString: (char *)p_item->psz_text];
1434 o_labelString = [NSString stringWithString:@""];
1435 ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString )
1436 [o_label setAutoresizingMask:NSViewNotSizable ];
1437 [self addSubview: o_label];
1439 /* build the stepper */
1440 ADD_STEPPER( o_stepper, mainFrame, mainFrame.size.width - 19,
1441 0, o_tooltip, -1600, 1600)
1442 [o_stepper setIntValue: p_item->value.i];
1443 [o_stepper setAutoresizingMask:NSViewMaxXMargin ];
1444 [self addSubview: o_stepper];
1446 ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
1447 1, 49, o_tooltip, @"" )
1448 [o_textfield setIntValue: p_item->value.i];
1449 [o_textfield setDelegate: self];
1450 [[NSNotificationCenter defaultCenter] addObserver: self
1451 selector: @selector(textfieldChanged:)
1452 name: NSControlTextDidChangeNotification
1453 object: o_textfield];
1454 [o_textfield setAutoresizingMask:NSViewMaxXMargin ];
1455 [self addSubview: o_textfield];
1460 - (void) alignWithXPosition:(int)i_xPos
1463 frame = [o_label frame];
1464 frame.origin.x = i_xPos - frame.size.width - 3;
1465 [o_label setFrame:frame];
1467 frame = [o_textfield frame];
1468 frame.origin.x = i_xPos + 2;
1469 [o_textfield setFrame:frame];
1471 frame = [o_stepper frame];
1472 frame.origin.x = i_xPos + [o_textfield frame].size.width + 5;
1473 [o_stepper setFrame:frame];
1478 [o_stepper release];
1479 [o_textfield release];
1483 - (IBAction)stepperChanged:(id)sender
1485 [o_textfield setIntValue: [o_stepper intValue]];
1488 - (void)textfieldChanged:(NSNotification *)o_notification
1490 [o_stepper setIntValue: [o_textfield intValue]];
1495 return [o_textfield intValue];
1500 @implementation IntegerListConfigControl
1502 - (id) initWithItem: (module_config_t *)_p_item
1503 withView: (NSView *)o_parent_view
1505 NSRect mainFrame = [o_parent_view frame];
1506 NSString *o_labelString, *o_textfieldTooltip;
1507 mainFrame.size.height = 22;
1508 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
1509 mainFrame.origin.x = LEFTMARGIN;
1510 mainFrame.origin.y = 0;
1512 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1515 i_view_type = CONFIG_ITEM_STRING_LIST;
1518 if( p_item->psz_text )
1519 o_labelString = [[VLCMain sharedInstance]
1520 localizedString: (char *)p_item->psz_text];
1522 o_labelString = [NSString stringWithString:@""];
1523 ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString )
1524 [o_label setAutoresizingMask:NSViewNotSizable ];
1525 [self addSubview: o_label];
1527 /* build the textfield */
1528 o_textfieldTooltip = [[VLCMain sharedInstance] wrapString:
1529 [[VLCMain sharedInstance]
1530 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1531 ADD_COMBO( o_combo, mainFrame, [o_label frame].size.width,
1532 -2, 0, o_textfieldTooltip )
1533 [o_combo setAutoresizingMask:NSViewWidthSizable ];
1534 for( i_index = 0; i_index < p_item->i_list; i_index++ )
1536 if( p_item->value.i == p_item->pi_list[i_index] )
1538 [o_combo selectItemAtIndex: i_index];
1541 [self addSubview: o_combo];
1546 - (void) alignWithXPosition:(int)i_xPos
1549 NSRect superFrame = [self frame];
1550 frame = [o_label frame];
1551 frame.origin.x = i_xPos - frame.size.width - 3;
1552 [o_label setFrame:frame];
1554 frame = [o_combo frame];
1555 frame.origin.x = i_xPos + 2;
1556 frame.size.width = superFrame.size.width - frame.origin.x + 2;
1557 [o_combo setFrame:frame];
1568 if( [o_combo indexOfSelectedItem] >= 0 )
1569 return p_item->pi_list[[o_combo indexOfSelectedItem]];
1571 return [o_combo intValue];
1575 @implementation IntegerListConfigControl (NSComboBoxDataSource)
1576 - (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox
1578 return p_item->i_list;
1581 - (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)i_index
1583 if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] )
1584 return [[VLCMain sharedInstance]
1585 localizedString: (char *)p_item->ppsz_list_text[i_index]];
1587 return [NSString stringWithFormat: @"%i", p_item->pi_list[i_index]];
1591 @implementation RangedIntegerConfigControl
1592 - (id) initWithItem: (module_config_t *)_p_item
1593 withView: (NSView *)o_parent_view
1595 NSRect mainFrame = [o_parent_view frame];
1596 NSString *o_labelString, *o_tooltip;
1597 mainFrame.size.height = 50;
1598 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
1599 mainFrame.origin.x = LEFTMARGIN;
1600 mainFrame.origin.y = 0;
1602 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1604 i_view_type = CONFIG_ITEM_RANGED_INTEGER;
1607 if( p_item->psz_text )
1608 o_labelString = [[VLCMain sharedInstance]
1609 localizedString: (char *)p_item->psz_text];
1611 o_labelString = [NSString stringWithString:@""];
1612 ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString )
1613 [o_label setAutoresizingMask:NSViewNotSizable ];
1614 [self addSubview: o_label];
1616 /* build the textfield */
1617 o_tooltip = [[VLCMain sharedInstance] wrapString:
1618 [[VLCMain sharedInstance]
1619 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1620 ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2,
1621 28, 49, o_tooltip, @"" )
1622 [o_textfield setIntValue: p_item->value.i];
1623 [o_textfield setAutoresizingMask:NSViewMaxXMargin ];
1624 [o_textfield setDelegate: self];
1625 [[NSNotificationCenter defaultCenter] addObserver: self
1626 selector: @selector(textfieldChanged:)
1627 name: NSControlTextDidChangeNotification
1628 object: o_textfield];
1629 [self addSubview: o_textfield];
1631 /* build the mintextfield */
1632 ADD_LABEL( o_textfield_min, mainFrame, 12, -30, @"-8888" )
1633 [o_textfield_min setIntValue: p_item->min.i];
1634 [o_textfield_min setAutoresizingMask:NSViewMaxXMargin ];
1635 [o_textfield_min setAlignment:NSRightTextAlignment];
1636 [self addSubview: o_textfield_min];
1638 /* build the maxtextfield */
1639 ADD_LABEL( o_textfield_max, mainFrame,
1640 mainFrame.size.width - 31, -30, @"8888" )
1641 [o_textfield_max setIntValue: p_item->max.i];
1642 [o_textfield_max setAutoresizingMask:NSViewMinXMargin ];
1643 [self addSubview: o_textfield_max];
1645 /* build the slider */
1646 ADD_SLIDER( o_slider, mainFrame, [o_textfield_min frame].origin.x +
1647 [o_textfield_min frame].size.width + 6, -1, mainFrame.size.width -
1648 [o_textfield_max frame].size.width -
1649 [o_textfield_max frame].size.width - 14 -
1650 [o_textfield_min frame].origin.x, o_tooltip,
1651 p_item->min.i, p_item->max.i )
1652 [o_slider setIntValue: p_item->value.i];
1653 [o_slider setAutoresizingMask:NSViewWidthSizable ];
1654 [o_slider setTarget: self];
1655 [o_slider setAction: @selector(sliderChanged:)];
1656 [o_slider sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask |
1657 NSLeftMouseDraggedMask];
1658 [self addSubview: o_slider];
1664 - (void) alignWithXPosition:(int)i_xPos
1667 frame = [o_label frame];
1668 frame.origin.x = i_xPos - frame.size.width - 3;
1669 [o_label setFrame:frame];
1671 frame = [o_textfield frame];
1672 frame.origin.x = i_xPos + 2;
1673 [o_textfield setFrame:frame];
1678 [o_textfield release];
1679 [o_textfield_min release];
1680 [o_textfield_max release];
1685 - (IBAction)sliderChanged:(id)sender
1687 [o_textfield setIntValue: [o_slider intValue]];
1690 - (void)textfieldChanged:(NSNotification *)o_notification
1692 [o_slider setIntValue: [o_textfield intValue]];
1697 return [o_slider intValue];
1701 @implementation FloatConfigControl
1702 - (id) initWithItem: (module_config_t *)_p_item
1703 withView: (NSView *)o_parent_view
1705 NSRect mainFrame = [o_parent_view frame];
1706 NSString *o_labelString, *o_tooltip;
1707 mainFrame.size.height = 23;
1708 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
1709 mainFrame.origin.x = LEFTMARGIN;
1710 mainFrame.origin.y = 0;
1712 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1714 i_view_type = CONFIG_ITEM_INTEGER;
1716 o_tooltip = [[VLCMain sharedInstance] wrapString:
1717 [[VLCMain sharedInstance]
1718 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1721 if( p_item->psz_text )
1722 o_labelString = [[VLCMain sharedInstance]
1723 localizedString: (char *)p_item->psz_text];
1725 o_labelString = [NSString stringWithString:@""];
1726 ADD_LABEL( o_label, mainFrame, 0, -2, o_labelString )
1727 [o_label setAutoresizingMask:NSViewNotSizable ];
1728 [self addSubview: o_label];
1730 /* build the stepper */
1731 ADD_STEPPER( o_stepper, mainFrame, mainFrame.size.width - 19,
1732 0, o_tooltip, -1600, 1600)
1733 [o_stepper setFloatValue: p_item->value.f];
1734 [o_stepper setAutoresizingMask:NSViewMaxXMargin ];
1735 [self addSubview: o_stepper];
1737 /* build the textfield */
1738 ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
1739 1, 49, o_tooltip, @"" )
1740 [o_textfield setFloatValue: p_item->value.f];
1741 [o_textfield setDelegate: self];
1742 [[NSNotificationCenter defaultCenter] addObserver: self
1743 selector: @selector(textfieldChanged:)
1744 name: NSControlTextDidChangeNotification
1745 object: o_textfield];
1746 [o_textfield setAutoresizingMask:NSViewMaxXMargin ];
1747 [self addSubview: o_textfield];
1752 - (void) alignWithXPosition:(int)i_xPos
1755 frame = [o_label frame];
1756 frame.origin.x = i_xPos - frame.size.width - 3;
1757 [o_label setFrame:frame];
1759 frame = [o_textfield frame];
1760 frame.origin.x = i_xPos + 2;
1761 [o_textfield setFrame:frame];
1763 frame = [o_stepper frame];
1764 frame.origin.x = i_xPos + [o_textfield frame].size.width + 5;
1765 [o_stepper setFrame:frame];
1770 [o_stepper release];
1771 [o_textfield release];
1775 - (IBAction)stepperChanged:(id)sender
1777 [o_textfield setFloatValue: [o_stepper floatValue]];
1780 - (void)textfieldChanged:(NSNotification *)o_notification
1782 [o_stepper setFloatValue: [o_textfield floatValue]];
1787 return [o_stepper floatValue];
1791 @implementation RangedFloatConfigControl
1792 - (id) initWithItem: (module_config_t *)_p_item
1793 withView: (NSView *)o_parent_view
1795 NSRect mainFrame = [o_parent_view frame];
1796 NSString *o_labelString, *o_tooltip;
1797 mainFrame.size.height = 50;
1798 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
1799 mainFrame.origin.x = LEFTMARGIN;
1800 mainFrame.origin.y = 0;
1802 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1804 i_view_type = CONFIG_ITEM_RANGED_INTEGER;
1807 if( p_item->psz_text )
1808 o_labelString = [[VLCMain sharedInstance]
1809 localizedString: (char *)p_item->psz_text];
1811 o_labelString = [NSString stringWithString:@""];
1812 ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString )
1813 [o_label setAutoresizingMask:NSViewNotSizable ];
1814 [self addSubview: o_label];
1816 /* build the textfield */
1817 o_tooltip = [[VLCMain sharedInstance] wrapString:
1818 [[VLCMain sharedInstance]
1819 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1820 ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2,
1821 28, 49, o_tooltip, @"" )
1822 [o_textfield setFloatValue: p_item->value.f];
1823 [o_textfield setAutoresizingMask:NSViewMaxXMargin ];
1824 [o_textfield setDelegate: self];
1825 [[NSNotificationCenter defaultCenter] addObserver: self
1826 selector: @selector(textfieldChanged:)
1827 name: NSControlTextDidChangeNotification
1828 object: o_textfield];
1829 [self addSubview: o_textfield];
1831 /* build the mintextfield */
1832 ADD_LABEL( o_textfield_min, mainFrame, 12, -30, @"-8888" )
1833 [o_textfield_min setFloatValue: p_item->min.f];
1834 [o_textfield_min setAutoresizingMask:NSViewMaxXMargin ];
1835 [o_textfield_min setAlignment:NSRightTextAlignment];
1836 [self addSubview: o_textfield_min];
1838 /* build the maxtextfield */
1839 ADD_LABEL( o_textfield_max, mainFrame, mainFrame.size.width - 31,
1841 [o_textfield_max setFloatValue: p_item->max.f];
1842 [o_textfield_max setAutoresizingMask:NSViewMinXMargin ];
1843 [self addSubview: o_textfield_max];
1845 /* build the slider */
1846 ADD_SLIDER( o_slider, mainFrame, [o_textfield_min frame].origin.x +
1847 [o_textfield_min frame].size.width + 6, -1, mainFrame.size.width -
1848 [o_textfield_max frame].size.width -
1849 [o_textfield_max frame].size.width - 14 -
1850 [o_textfield_min frame].origin.x, o_tooltip, p_item->min.f,
1852 [o_slider setFloatValue: p_item->value.f];
1853 [o_slider setAutoresizingMask:NSViewWidthSizable ];
1854 [o_slider setTarget: self];
1855 [o_slider setAction: @selector(sliderChanged:)];
1856 [o_slider sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask |
1857 NSLeftMouseDraggedMask];
1858 [self addSubview: o_slider];
1864 - (void) alignWithXPosition:(int)i_xPos
1867 frame = [o_label frame];
1868 frame.origin.x = i_xPos - frame.size.width - 3;
1869 [o_label setFrame:frame];
1871 frame = [o_textfield frame];
1872 frame.origin.x = i_xPos + 2;
1873 [o_textfield setFrame:frame];
1878 [o_textfield release];
1879 [o_textfield_min release];
1880 [o_textfield_max release];
1885 - (IBAction)sliderChanged:(id)sender
1887 [o_textfield setFloatValue: [o_slider floatValue]];
1890 - (void)textfieldChanged:(NSNotification *)o_notification
1892 [o_slider setFloatValue: [o_textfield floatValue]];
1897 return [o_slider floatValue];
1902 @implementation BoolConfigControl
1904 - (id) initWithItem: (module_config_t *)_p_item
1905 withView: (NSView *)o_parent_view
1907 NSRect mainFrame = [o_parent_view frame];
1908 NSString *o_labelString, *o_tooltip;
1909 mainFrame.size.height = 17;
1910 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
1911 mainFrame.origin.x = LEFTMARGIN;
1912 mainFrame.origin.y = 0;
1914 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1916 i_view_type = CONFIG_ITEM_BOOL;
1918 /* add the checkbox */
1919 o_tooltip = [[VLCMain sharedInstance]
1920 wrapString: [[VLCMain sharedInstance]
1921 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1922 ADD_CHECKBOX( o_checkbox, mainFrame, 0,
1923 0, @"", o_tooltip, p_item->value.i, NSImageLeft)
1924 [o_checkbox setAutoresizingMask:NSViewNotSizable ];
1925 [self addSubview: o_checkbox];
1927 if( p_item->psz_text )
1928 o_labelString = [[VLCMain sharedInstance]
1929 localizedString: (char *)p_item->psz_text];
1931 o_labelString = [NSString stringWithString:@""];
1932 ADD_LABEL( o_label, mainFrame, [o_checkbox frame].size.width, 0, o_labelString )
1933 [o_label setAutoresizingMask:NSViewNotSizable ];
1934 [self addSubview: o_label];
1941 [o_checkbox release];
1947 return [o_checkbox intValue];
1952 @implementation KeyConfigControl
1953 - (id) initWithItem: (module_config_t *)_p_item
1954 withView: (NSView *)o_parent_view
1956 NSRect mainFrame = [o_parent_view frame];
1957 NSString *o_labelString, *o_tooltip;
1958 mainFrame.size.height = 22;
1959 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
1960 mainFrame.origin.x = LEFTMARGIN;
1961 mainFrame.origin.y = 0;
1963 if( [super initWithFrame: mainFrame item: _p_item] != nil )
1965 i_view_type = CONFIG_ITEM_KEY_AFTER_10_3;
1968 if( p_item->psz_text )
1969 o_labelString = [[VLCMain sharedInstance]
1970 localizedString: (char *)p_item->psz_text];
1972 o_labelString = [NSString stringWithString:@""];
1973 ADD_LABEL( o_label, mainFrame, 0, -1, o_labelString )
1974 [o_label setAutoresizingMask:NSViewNotSizable ];
1975 [self addSubview: o_label];
1977 /* build the popup */
1978 o_tooltip = [[VLCMain sharedInstance] wrapString:
1979 [[VLCMain sharedInstance]
1980 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
1981 ADD_POPUP( o_popup, mainFrame, [o_label frame].origin.x +
1982 [o_label frame].size.width + 3,
1984 [o_popup setAutoresizingMask:NSViewWidthSizable ];
1986 if( o_keys_menu == nil )
1989 o_keys_menu = [[NSMenu alloc] initWithTitle: @"Keys Menu"];
1990 for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++)
1991 if( vlc_keys[i].psz_key_string && *vlc_keys[i].psz_key_string )
1992 POPULATE_A_KEY( o_keys_menu,
1993 [NSString stringWithCString:vlc_keys[i].psz_key_string]
1994 , vlc_keys[i].i_key_code)
1996 [o_popup setMenu:[o_keys_menu copyWithZone:nil]];
1997 [o_popup selectItem:[[o_popup menu] itemWithTag:p_item->value.i]];
1998 [self addSubview: o_popup];
2004 - (void) alignWithXPosition:(int)i_xPos
2007 NSRect superFrame = [self frame];
2008 frame = [o_label frame];
2009 frame.origin.x = i_xPos - frame.size.width - 3;
2010 [o_label setFrame:frame];
2012 frame = [o_popup frame];
2013 frame.origin.x = i_xPos - 1;
2014 frame.size.width = superFrame.size.width - frame.origin.x + 2;
2015 [o_popup setFrame:frame];
2026 return [o_popup selectedTag];
2030 @implementation ModuleListConfigControl
2031 - (id) initWithItem: (module_config_t *)_p_item
2032 withView: (NSView *)o_parent_view
2034 if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
2038 //Fill our array to know how may items we have...
2042 NSRect mainFrame = [o_parent_view frame];
2043 NSString *o_labelString, *o_textfieldString, *o_tooltip;
2045 o_modulearray = [[NSMutableArray alloc] initWithCapacity:10];
2046 /* build a list of available modules */
2047 p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
2048 for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ )
2051 p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
2053 if( !strcmp( p_parser->psz_object_name, "main" ) )
2056 for ( i = 0; i < p_parser->confsize; i++ )
2058 module_config_t *p_config = p_parser->p_config + i;
2059 NSString *o_modulelongname, *o_modulename;
2060 NSNumber *o_moduleenabled = nil;
2062 /* Hack: required subcategory is stored in i_min */
2063 if( p_config->i_type == CONFIG_SUBCATEGORY &&
2064 p_config->value.i == _p_item->min.i )
2066 o_modulelongname = [NSString stringWithUTF8String:
2067 p_parser->psz_longname];
2068 o_modulename = [NSString stringWithUTF8String:
2069 p_parser->psz_object_name];
2071 if( _p_item->value.psz &&
2072 strstr( _p_item->value.psz, p_parser->psz_object_name ) )
2073 o_moduleenabled = [NSNumber numberWithBool:YES];
2075 o_moduleenabled = [NSNumber numberWithBool:NO];
2077 [o_modulearray addObject:[NSMutableArray
2078 arrayWithObjects: o_modulename, o_modulelongname,
2079 o_moduleenabled, nil]];
2083 vlc_list_release( p_list );
2085 mainFrame.size.height = 30 + 18 * [o_modulearray count];
2086 mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
2087 mainFrame.origin.x = LEFTMARGIN;
2088 mainFrame.origin.y = 0;
2089 if( [super initWithFrame: mainFrame item: _p_item] != nil )
2091 i_view_type = CONFIG_ITEM_MODULE_LIST;
2094 if( p_item->psz_text )
2095 o_labelString = [[VLCMain sharedInstance]
2096 localizedString: (char *)p_item->psz_text];
2098 o_labelString = [NSString stringWithString:@""];
2099 ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString )
2100 [o_label setAutoresizingMask:NSViewNotSizable ];
2101 [self addSubview: o_label];
2103 /* build the textfield */
2104 o_tooltip = [[VLCMain sharedInstance] wrapString:
2105 [[VLCMain sharedInstance]
2106 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
2107 if( p_item->value.psz )
2108 o_textfieldString = [[VLCMain sharedInstance]
2109 localizedString: (char *)p_item->value.psz];
2111 o_textfieldString = [NSString stringWithString: @""];
2112 ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2,
2113 mainFrame.size.height - 22, mainFrame.size.width -
2114 [o_label frame].size.width - 2, o_tooltip, o_textfieldString )
2115 [o_textfield setAutoresizingMask:NSViewWidthSizable ];
2116 [self addSubview: o_textfield];
2120 NSRect s_rc = mainFrame;
2121 s_rc.size.height = mainFrame.size.height - 30;
2122 s_rc.size.width = mainFrame.size.width - 12;
2125 o_scrollview = [[[NSScrollView alloc] initWithFrame: s_rc] retain];
2126 [o_scrollview setDrawsBackground: NO];
2127 [o_scrollview setBorderType: NSBezelBorder];
2128 [o_scrollview setAutohidesScrollers:YES];
2130 NSTableView *o_tableview;
2131 o_tableview = [[NSTableView alloc] initWithFrame : s_rc];
2132 [o_tableview setUsesAlternatingRowBackgroundColors:YES];
2133 [o_tableview setHeaderView:nil];
2134 /* TODO: find a good way to fix the row height and text size*/
2135 /* FIXME: support for multiple selection... */
2136 // [o_tableview setAllowsMultipleSelection:YES];
2138 NSCell *o_headerCell = [[NSCell alloc] initTextCell:@"Enabled"];
2139 NSCell *o_dataCell = [[NSButtonCell alloc] init];
2140 [(NSButtonCell*)o_dataCell setButtonType:NSSwitchButton];
2141 [o_dataCell setTitle:@""];
2142 [o_dataCell setFont:[NSFont systemFontOfSize:0]];
2143 NSTableColumn *o_tableColumn = [[NSTableColumn alloc]
2144 initWithIdentifier:[NSString stringWithCString: "Enabled"]];
2145 [o_tableColumn setHeaderCell: o_headerCell];
2146 [o_tableColumn setDataCell: o_dataCell];
2147 [o_tableColumn setWidth:17];
2148 [o_tableview addTableColumn: o_tableColumn];
2150 o_headerCell = [[NSCell alloc] initTextCell:@"Module Name"];
2151 o_dataCell = [[NSTextFieldCell alloc] init];
2152 [o_dataCell setFont:[NSFont systemFontOfSize:12]];
2153 o_tableColumn = [[NSTableColumn alloc]
2154 initWithIdentifier:[NSString stringWithCString: "Module"]];
2155 [o_tableColumn setHeaderCell: o_headerCell];
2156 [o_tableColumn setDataCell: o_dataCell];
2157 [o_tableColumn setWidth:388 - 17];
2158 [o_tableview addTableColumn: o_tableColumn];
2159 [o_tableview registerForDraggedTypes:[NSArray arrayWithObjects:
2160 @"VLC media player module", nil]];
2162 [o_tableview setDataSource:self];
2163 [o_tableview setTarget: self];
2164 [o_tableview setAction: @selector(tableChanged:)];
2165 [o_tableview sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask |
2166 NSLeftMouseDraggedMask];
2167 [o_scrollview setDocumentView: o_tableview];
2169 [o_scrollview setAutoresizingMask:NSViewWidthSizable ];
2170 [self addSubview: o_scrollview];
2177 - (void) alignWithXPosition:(int)i_xPos
2182 - (IBAction)tableChanged:(id)sender
2184 NSString *o_newstring = @"";
2186 for( i = 0 ; i < [o_modulearray count] ; i++ )
2187 if( [[[o_modulearray objectAtIndex:i] objectAtIndex:2]
2190 o_newstring = [o_newstring stringByAppendingString:
2191 [[o_modulearray objectAtIndex:i] objectAtIndex:0]];
2192 o_newstring = [o_newstring stringByAppendingString:@":"];
2195 [o_textfield setStringValue: [o_newstring
2196 substringToIndex: ([o_newstring length])?[o_newstring length] - 1:0]];
2201 [o_scrollview release];
2206 - (char *)stringValue
2208 return strdup( [[o_textfield stringValue] UTF8String] );
2213 @implementation ModuleListConfigControl (NSTableDataSource)
2215 - (BOOL)tableView:(NSTableView*)table writeRows:(NSArray*)rows
2216 toPasteboard:(NSPasteboard*)pb
2218 // We only want to allow dragging of selected rows.
2219 NSEnumerator *iter = [rows objectEnumerator];
2221 while ((row = [iter nextObject]) != nil)
2223 if (![table isRowSelected:[row intValue]])
2227 [pb declareTypes:[NSArray
2228 arrayWithObject:@"VLC media player module"] owner:nil];
2229 [pb setPropertyList:rows forType:@"VLC media player module"];
2233 - (NSDragOperation)tableView:(NSTableView*)table
2234 validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
2235 proposedDropOperation:(NSTableViewDropOperation)op
2237 // Make drops at the end of the table go to the end.
2240 row = [table numberOfRows];
2241 op = NSTableViewDropAbove;
2242 [table setDropRow:row dropOperation:op];
2245 // We don't ever want to drop onto a row, only between rows.
2246 if (op == NSTableViewDropOn)
2247 [table setDropRow:(row+1) dropOperation:NSTableViewDropAbove];
2248 return NSTableViewDropAbove;
2251 - (BOOL)tableView:(NSTableView*)table acceptDrop:(id <NSDraggingInfo>)info
2252 row:(int)dropRow dropOperation:(NSTableViewDropOperation)op;
2254 NSPasteboard *pb = [info draggingPasteboard];
2255 NSDragOperation srcMask = [info draggingSourceOperationMask];
2262 // Intra-table drag - data is the array of rows.
2263 if (!accepted && (array =
2264 [pb propertyListForType:@"VLC media player module"]) != NULL)
2266 NSEnumerator *iter = nil;
2268 BOOL isCopy = (srcMask & NSDragOperationMove) ? NO:YES;
2270 iter = [array objectEnumerator];
2271 while ((val = [iter nextObject]) != NULL)
2273 NSArray *o_tmp = [[o_modulearray objectAtIndex:
2274 [val intValue]] mutableCopyWithZone:nil];
2275 [o_modulearray removeObject:o_tmp];
2276 [o_modulearray insertObject:o_tmp
2277 atIndex:(dropRow>[val intValue]) ? dropRow - 1 : dropRow];
2281 // Select the newly-dragged items.
2282 iter = [array objectEnumerator];
2284 [table deselectAll:self];
2286 [self tableChanged:self];
2287 [table setNeedsDisplay:YES];
2288 // Indicate that we finished the drag.
2292 [table setNeedsDisplay:YES];
2296 // An exception occurred. Uh-oh. Update the track table so that
2297 // it stays consistent, and re-raise the exception.
2299 [localException raise];
2300 [table setNeedsDisplay:YES];
2306 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
2308 return [o_modulearray count];
2311 - (id)tableView:(NSTableView *)aTableView
2312 objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
2314 if( [[aTableColumn identifier] isEqualToString:
2315 [NSString stringWithCString:"Enabled"]] )
2316 return [[o_modulearray objectAtIndex:rowIndex] objectAtIndex:2];
2317 if( [[aTableColumn identifier] isEqualToString:
2318 [NSString stringWithCString:"Module"]] )
2319 return [[o_modulearray objectAtIndex:rowIndex] objectAtIndex:1];
2324 - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject
2325 forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
2327 [[o_modulearray objectAtIndex:rowIndex] replaceObjectAtIndex:2
2328 withObject: anObject];