Commit 761bddc9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/prefs widgets: fix rendering

parent 50764eac
...@@ -414,12 +414,6 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -414,12 +414,6 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
return (self); return (self);
} }
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view;
{
return nil; // implemented by children only
}
- (void)setYPos:(int)i_yPos - (void)setYPos:(int)i_yPos
{ {
NSRect frame = [self frame]; NSRect frame = [self frame];
...@@ -770,84 +764,84 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -770,84 +764,84 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
} }
+ (VLCConfigControl *)newControl:(module_config_t *)_p_item + (VLCConfigControl *)newControl:(module_config_t *)_p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
VLCConfigControl *p_control = NULL; VLCConfigControl *control = NULL;
switch(_p_item->i_type) { switch(_p_item->i_type) {
case CONFIG_ITEM_STRING: case CONFIG_ITEM_STRING:
case CONFIG_ITEM_PASSWORD: case CONFIG_ITEM_PASSWORD:
if (!_p_item->list_count) { if (!_p_item->list_count) {
p_control = [[StringConfigControl alloc] control = [[StringConfigControl alloc]
initWithItem: _p_item initWithItem: _p_item
withView: o_parent_view]; withView: parentView];
} else { } else {
p_control = [[StringListConfigControl alloc] control = [[StringListConfigControl alloc]
initWithItem: _p_item initWithItem: _p_item
withView: o_parent_view]; withView: parentView];
} }
break; break;
case CONFIG_ITEM_LOADFILE: case CONFIG_ITEM_LOADFILE:
case CONFIG_ITEM_SAVEFILE: case CONFIG_ITEM_SAVEFILE:
case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_DIRECTORY:
p_control = [[FileConfigControl alloc] control = [[FileConfigControl alloc]
initWithItem: _p_item initWithItem: _p_item
withView: o_parent_view]; withView: parentView];
break; break;
case CONFIG_ITEM_MODULE: case CONFIG_ITEM_MODULE:
p_control = [[StringListConfigControl alloc] control = [[StringListConfigControl alloc]
initWithItem: _p_item initWithItem: _p_item
withView: o_parent_view]; withView: parentView];
break; break;
case CONFIG_ITEM_MODULE_CAT: case CONFIG_ITEM_MODULE_CAT:
p_control = [[ModuleConfigControl alloc] control = [[ModuleConfigControl alloc]
initWithItem: _p_item initWithItem: _p_item
withView: o_parent_view]; withView: parentView];
break; break;
case CONFIG_ITEM_INTEGER: case CONFIG_ITEM_INTEGER:
if (_p_item->list_count) if (_p_item->list_count)
p_control = [[IntegerListConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; control = [[IntegerListConfigControl alloc] initWithItem: _p_item withView: parentView];
else if ((_p_item->min.i != 0 || else if ((_p_item->min.i != 0 ||
_p_item->max.i != 0) && _p_item->max.i != 0) &&
(_p_item->min.i != INT_MIN || (_p_item->min.i != INT_MIN ||
_p_item->max.i != INT_MAX)) _p_item->max.i != INT_MAX))
p_control = [[RangedIntegerConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; control = [[RangedIntegerConfigControl alloc] initWithItem: _p_item withView: parentView];
else else
p_control = [[IntegerConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; control = [[IntegerConfigControl alloc] initWithItem: _p_item withView: parentView];
break; break;
case CONFIG_ITEM_BOOL: case CONFIG_ITEM_BOOL:
p_control = [[BoolConfigControl alloc] control = [[BoolConfigControl alloc] initWithItem: _p_item
initWithItem: _p_item withView: parentView];
withView: o_parent_view];
break; break;
case CONFIG_ITEM_FLOAT: case CONFIG_ITEM_FLOAT:
if ((_p_item->min.i != 0 || if ((_p_item->min.i != 0 ||
_p_item->max.i != 0) && _p_item->max.i != 0) &&
(_p_item->min.i != INT_MIN || (_p_item->min.i != INT_MIN ||
_p_item->max.i != INT_MAX)) _p_item->max.i != INT_MAX))
p_control = [[RangedFloatConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; control = [[RangedFloatConfigControl alloc] initWithItem: _p_item withView: parentView];
else else
p_control = [[FloatConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; control = [[FloatConfigControl alloc] initWithItem: _p_item withView: parentView];
break; break;
/* don't display keys in the advanced settings, since the current controls /* don't display keys in the advanced settings, since the current controls
are broken by design. The user is required to change hotkeys in the sprefs are broken by design. The user is required to change hotkeys in the sprefs
and can only change really advanced stuff here.. and can only change really advanced stuff here..
case CONFIG_ITEM_KEY: case CONFIG_ITEM_KEY:
p_control = [[KeyConfigControl alloc] control = [[KeyConfigControl alloc]
initWithItem: _p_item initWithItem: _p_item
withView: o_parent_view]; withView: parentView];
break; */ break; */
case CONFIG_ITEM_MODULE_LIST: case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_MODULE_LIST_CAT: case CONFIG_ITEM_MODULE_LIST_CAT:
p_control = [[ModuleListConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; control = [[ModuleListConfigControl alloc] initWithItem: _p_item withView: parentView];
break; break;
case CONFIG_SECTION: case CONFIG_SECTION:
p_control = [[SectionControl alloc] initWithItem: _p_item withView: o_parent_view]; control = [[SectionControl alloc] initWithItem: _p_item withView: parentView];
break; break;
default: default:
break; break;
} }
return p_control;
return control;
} }
- (NSString *)name - (NSString *)name
...@@ -924,11 +918,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -924,11 +918,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation StringConfigControl @implementation StringConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_textfieldString, *o_textfieldTooltip; NSString *labelString, *o_textfieldString, *o_textfieldTooltip;
mainFrame.size.height = 22; mainFrame.size.height = 22;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -944,10 +938,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -944,10 +938,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -3, o_labelString, o_textfieldTooltip) ADD_LABEL(self.label, mainFrame, 0, -3, labelString, o_textfieldTooltip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
...@@ -1011,11 +1005,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1011,11 +1005,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation StringListConfigControl @implementation StringListConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_textfieldTooltip; NSString *labelString, *o_textfieldTooltip;
mainFrame.size.height = 22; mainFrame.size.height = 22;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1031,10 +1025,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1031,10 +1025,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -3, o_labelString, o_textfieldTooltip) ADD_LABEL(self.label, mainFrame, 0, -3, labelString, o_textfieldTooltip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
...@@ -1115,11 +1109,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1115,11 +1109,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation FileConfigControl @implementation FileConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_itemTooltip, *o_textfieldString; NSString *labelString, *o_itemTooltip, *o_textfieldString;
mainFrame.size.height = 46; mainFrame.size.height = 46;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1135,10 +1129,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1135,10 +1129,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, 3, o_labelString, o_itemTooltip) ADD_LABEL(self.label, mainFrame, 0, 3, labelString, o_itemTooltip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
...@@ -1214,11 +1208,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1214,11 +1208,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation ModuleConfigControl @implementation ModuleConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_popupTooltip; NSString *labelString, *o_popupTooltip;
mainFrame.size.height = 22; mainFrame.size.height = 22;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1231,11 +1225,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1231,11 +1225,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -1, o_labelString, o_popupTooltip) ADD_LABEL(self.label, mainFrame, 0, -1, labelString, o_popupTooltip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
...@@ -1349,11 +1343,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1349,11 +1343,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation IntegerConfigControl @implementation IntegerConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_tooltip; NSString *labelString, *toolTip;
mainFrame.size.height = 23; mainFrame.size.height = 23;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1362,26 +1356,26 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1362,26 +1356,26 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
if ([super initWithFrame:mainFrame item:p_item] != nil) { if ([super initWithFrame:mainFrame item:p_item] != nil) {
self.viewType = CONFIG_ITEM_INTEGER; self.viewType = CONFIG_ITEM_INTEGER;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP]; toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -3, o_labelString, o_tooltip) ADD_LABEL(self.label, mainFrame, 0, -3, labelString, toolTip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
/* build the stepper */ /* build the stepper */
ADD_STEPPER(o_stepper, mainFrame, mainFrame.size.width - 19, ADD_STEPPER(o_stepper, mainFrame, mainFrame.size.width - 19,
0, o_tooltip, -100000, 100000) 0, toolTip, -100000, 100000)
[o_stepper setIntValue: p_item->value.i]; [o_stepper setIntValue: p_item->value.i];
[o_stepper setAutoresizingMask:NSViewMaxXMargin ]; [o_stepper setAutoresizingMask:NSViewMaxXMargin ];
[self addSubview: o_stepper]; [self addSubview: o_stepper];
ADD_TEXTFIELD(o_textfield, mainFrame, mainFrame.size.width - 19 - 52, ADD_TEXTFIELD(o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
1, 49, o_tooltip, @"") 1, 49, toolTip, @"")
[o_textfield setIntValue: p_item->value.i]; [o_textfield setIntValue: p_item->value.i];
[o_textfield setDelegate: self]; [o_textfield setDelegate: self];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
...@@ -1441,11 +1435,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1441,11 +1435,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@implementation IntegerListConfigControl @implementation IntegerListConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_textfieldTooltip; NSString *labelString, *o_textfieldTooltip;
mainFrame.size.height = 22; mainFrame.size.height = 22;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1458,10 +1452,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1458,10 +1452,10 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -3, o_labelString, o_textfieldTooltip) ADD_LABEL(self.label, mainFrame, 0, -3, labelString, o_textfieldTooltip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
...@@ -1534,11 +1528,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1534,11 +1528,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation RangedIntegerConfigControl @implementation RangedIntegerConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_tooltip; NSString *labelString, *toolTip;
mainFrame.size.height = 50; mainFrame.size.height = 50;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1547,20 +1541,20 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1547,20 +1541,20 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
if ([super initWithFrame: mainFrame item:p_item] != nil) { if ([super initWithFrame: mainFrame item:p_item] != nil) {
self.viewType = CONFIG_ITEM_RANGED_INTEGER; self.viewType = CONFIG_ITEM_RANGED_INTEGER;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP]; toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -3, o_labelString, o_tooltip) ADD_LABEL(self.label, mainFrame, 0, -3, labelString, toolTip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
/* build the textfield */ /* build the textfield */
ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2, ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2,
28, 49, o_tooltip, @"") 28, 49, toolTip, @"")
[o_textfield setIntValue: p_item->value.i]; [o_textfield setIntValue: p_item->value.i];
[o_textfield setAutoresizingMask:NSViewMaxXMargin ]; [o_textfield setAutoresizingMask:NSViewMaxXMargin ];
[o_textfield setDelegate: self]; [o_textfield setDelegate: self];
...@@ -1589,7 +1583,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1589,7 +1583,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
[o_textfield_min frame].size.width + 6, -1, mainFrame.size.width - [o_textfield_min frame].size.width + 6, -1, mainFrame.size.width -
[o_textfield_max frame].size.width - [o_textfield_max frame].size.width -
[o_textfield_max frame].size.width - 14 - [o_textfield_max frame].size.width - 14 -
[o_textfield_min frame].origin.x, o_tooltip, [o_textfield_min frame].origin.x, toolTip,
p_item->min.i, p_item->max.i) p_item->min.i, p_item->max.i)
[o_slider setIntValue: p_item->value.i]; [o_slider setIntValue: p_item->value.i];
[o_slider setAutoresizingMask:NSViewWidthSizable ]; [o_slider setAutoresizingMask:NSViewWidthSizable ];
...@@ -1647,11 +1641,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1647,11 +1641,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation FloatConfigControl @implementation FloatConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_tooltip; NSString *labelString, *toolTip;
mainFrame.size.height = 23; mainFrame.size.height = 23;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1660,27 +1654,27 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1660,27 +1654,27 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
if ([super initWithFrame:mainFrame item:p_item] != nil) { if ([super initWithFrame:mainFrame item:p_item] != nil) {
self.viewType = CONFIG_ITEM_INTEGER; self.viewType = CONFIG_ITEM_INTEGER;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP]; toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -2, o_labelString, o_tooltip) ADD_LABEL(self.label, mainFrame, 0, -2, labelString, toolTip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
/* build the stepper */ /* build the stepper */
ADD_STEPPER(o_stepper, mainFrame, mainFrame.size.width - 19, ADD_STEPPER(o_stepper, mainFrame, mainFrame.size.width - 19,
0, o_tooltip, -100000, 100000) 0, toolTip, -100000, 100000)
[o_stepper setFloatValue: p_item->value.f]; [o_stepper setFloatValue: p_item->value.f];
[o_stepper setAutoresizingMask:NSViewMaxXMargin ]; [o_stepper setAutoresizingMask:NSViewMaxXMargin ];
[self addSubview: o_stepper]; [self addSubview: o_stepper];
/* build the textfield */ /* build the textfield */
ADD_TEXTFIELD(o_textfield, mainFrame, mainFrame.size.width - 19 - 52, ADD_TEXTFIELD(o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
1, 49, o_tooltip, @"") 1, 49, toolTip, @"")
[o_textfield setFloatValue: p_item->value.f]; [o_textfield setFloatValue: p_item->value.f];
[o_textfield setDelegate: self]; [o_textfield setDelegate: self];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
...@@ -1741,11 +1735,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1741,11 +1735,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation RangedFloatConfigControl @implementation RangedFloatConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_tooltip; NSString *labelString, *toolTip;
mainFrame.size.height = 50; mainFrame.size.height = 50;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1754,20 +1748,20 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1754,20 +1748,20 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
if ([super initWithFrame:mainFrame item:p_item] != nil) { if ([super initWithFrame:mainFrame item:p_item] != nil) {
self.viewType = CONFIG_ITEM_RANGED_INTEGER; self.viewType = CONFIG_ITEM_RANGED_INTEGER;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP]; toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -3, o_labelString, o_tooltip) ADD_LABEL(self.label, mainFrame, 0, -3, labelString, toolTip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
/* build the textfield */ /* build the textfield */
ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2, ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2,
28, 49, o_tooltip, @"") 28, 49, toolTip, @"")
[o_textfield setFloatValue: p_item->value.f]; [o_textfield setFloatValue: p_item->value.f];
[o_textfield setAutoresizingMask:NSViewMaxXMargin ]; [o_textfield setAutoresizingMask:NSViewMaxXMargin ];
[o_textfield setDelegate: self]; [o_textfield setDelegate: self];
...@@ -1796,7 +1790,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1796,7 +1790,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
[o_textfield_min frame].size.width + 6, -1, mainFrame.size.width - [o_textfield_min frame].size.width + 6, -1, mainFrame.size.width -
[o_textfield_max frame].size.width - [o_textfield_max frame].size.width -
[o_textfield_max frame].size.width - 14 - [o_textfield_max frame].size.width - 14 -
[o_textfield_min frame].origin.x, o_tooltip, p_item->min.f, [o_textfield_min frame].origin.x, toolTip, p_item->min.f,
p_item->max.f) p_item->max.f)
[o_slider setFloatValue: p_item->value.f]; [o_slider setFloatValue: p_item->value.f];
[o_slider setAutoresizingMask:NSViewWidthSizable ]; [o_slider setAutoresizingMask:NSViewWidthSizable ];
...@@ -1853,30 +1847,32 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1853,30 +1847,32 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@implementation BoolConfigControl @implementation BoolConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_tooltip; NSString *labelString, *toolTip;
mainFrame.size.height = 17; mainFrame.size.height = 17;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
mainFrame.origin.y = 0; mainFrame.origin.y = 0;
if ([super initWithFrame:mainFrame item:p_item] != nil) { self = [super initWithFrame:mainFrame item:p_item];
if (self != nil) {
self.viewType = CONFIG_ITEM_BOOL; self.viewType = CONFIG_ITEM_BOOL;
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP]; toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the checkbox */ /* add the checkbox */
ADD_CHECKBOX(o_checkbox, mainFrame, 0, ADD_CHECKBOX(o_checkbox, mainFrame, 0,
0, o_labelString, o_tooltip, p_item->value.i, NSImageLeft) 0, labelString, toolTip, p_item->value.i, NSImageLeft)
[o_checkbox setAutoresizingMask:NSViewNotSizable ]; [o_checkbox setAutoresizingMask:NSViewNotSizable];
[self addSubview: o_checkbox]; [self addSubview: o_checkbox];
} }
return self; return self;
...@@ -1901,11 +1897,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1901,11 +1897,11 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation KeyConfigControl @implementation KeyConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_tooltip; NSString *labelString, *toolTip;
mainFrame.size.height = 22; mainFrame.size.height = 22;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1914,21 +1910,21 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1914,21 +1910,21 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
if ([super initWithFrame:mainFrame item:p_item] != nil) { if ([super initWithFrame:mainFrame item:p_item] != nil) {
self.viewType = CONFIG_ITEM_KEY; self.viewType = CONFIG_ITEM_KEY;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP]; toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -1, o_labelString, o_tooltip) ADD_LABEL(self.label, mainFrame, 0, -1, labelString, toolTip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
/* build the popup */ /* build the popup */
ADD_POPUP(o_popup, mainFrame, [self.label frame].origin.x + ADD_POPUP(o_popup, mainFrame, [self.label frame].origin.x +
[self.label frame].size.width + 3, [self.label frame].size.width + 3,
-2, 0, o_tooltip) -2, 0, toolTip)
[o_popup setAutoresizingMask:NSViewWidthSizable ]; [o_popup setAutoresizingMask:NSViewWidthSizable ];
if (o_keys_menu == nil) { if (o_keys_menu == nil) {
...@@ -1986,16 +1982,16 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \ ...@@ -1986,16 +1982,16 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
@end @end
@implementation ModuleListConfigControl @implementation ModuleListConfigControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
BOOL b_by_cat = p_item->i_type == CONFIG_ITEM_MODULE_LIST_CAT; BOOL b_by_cat = p_item->i_type == CONFIG_ITEM_MODULE_LIST_CAT;
//Fill our array to know how may items we have... //Fill our array to know how may items we have...
module_t *p_parser, **p_list; module_t *p_parser, **p_list;
size_t i_module_index; size_t i_module_index;
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_textfieldString, *o_tooltip; NSString *labelString, *o_textfieldString, *toolTip;
o_modulearray = [[NSMutableArray alloc] initWithCapacity:10]; o_modulearray = [[NSMutableArray alloc] initWithCapacity:10];
/* build a list of available modules */ /* build a list of available modules */
...@@ -2132,14 +2128,14 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\ ...@@ -2132,14 +2128,14 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
if ([super initWithFrame:mainFrame item:p_item] != nil) { if ([super initWithFrame:mainFrame item:p_item] != nil) {
self.viewType = CONFIG_ITEM_MODULE_LIST; self.viewType = CONFIG_ITEM_MODULE_LIST;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP]; toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
ADD_LABEL(self.label, mainFrame, 0, -3, o_labelString, o_tooltip) ADD_LABEL(self.label, mainFrame, 0, -3, labelString, toolTip)
[self.label setAutoresizingMask:NSViewNotSizable ]; [self.label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: self.label]; [self addSubview: self.label];
...@@ -2150,7 +2146,7 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\ ...@@ -2150,7 +2146,7 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
o_textfieldString = @""; o_textfieldString = @"";
ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2, ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2,
mainFrame.size.height - 22, mainFrame.size.width - mainFrame.size.height - 22, mainFrame.size.width -
[self.label frame].size.width - 2, o_tooltip, o_textfieldString) [self.label frame].size.width - 2, toolTip, o_textfieldString)
[o_textfield setAutoresizingMask:NSViewWidthSizable ]; [o_textfield setAutoresizingMask:NSViewWidthSizable ];
[self addSubview: o_textfield]; [self addSubview: o_textfield];
...@@ -2308,11 +2304,11 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex ...@@ -2308,11 +2304,11 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
@implementation SectionControl @implementation SectionControl
- (id)initWithitem:(module_config_t *)p_item - (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)o_parent_view withView:(NSView *)parentView
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [parentView frame];
NSString *o_labelString, *o_tooltip; NSString *labelString, *toolTip;
mainFrame.size.height = 17; mainFrame.size.height = 17;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -2321,15 +2317,15 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex ...@@ -2321,15 +2317,15 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
if ([super initWithFrame:mainFrame item:p_item] != nil) { if ([super initWithFrame:mainFrame item:p_item] != nil) {
/* add the label */ /* add the label */
if (p_item->psz_text) if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text); labelString = _NS((char *)p_item->psz_text);
else else
o_labelString = @""; labelString = @"";
NSDictionary *boldAttributes = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *boldAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont boldSystemFontOfSize:[NSFont systemFontSize]], [NSFont boldSystemFontOfSize:[NSFont systemFontSize]],
NSFontAttributeName, NSFontAttributeName,
nil]; nil];
NSAttributedString *o_bold_string = [[NSAttributedString alloc] initWithString: o_labelString attributes: boldAttributes]; NSAttributedString *o_bold_string = [[NSAttributedString alloc] initWithString: labelString attributes: boldAttributes];
ADD_LABEL(self.label, mainFrame, 1, 0, @"", @"") ADD_LABEL(self.label, mainFrame, 1, 0, @"", @"")
[self.label setAttributedStringValue: o_bold_string]; [self.label setAttributedStringValue: o_bold_string];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment