Commit 7dd80de5 authored by David Fuhrmann's avatar David Fuhrmann

macosx: advanced prefs: remove scroll view from module list table view, fix layout

close #9971
parent 65a983cf
...@@ -2050,52 +2050,14 @@ else\ ...@@ -2050,52 +2050,14 @@ else\
} /* FOR i_module_index */ } /* FOR i_module_index */
module_list_free(p_list); module_list_free(p_list);
mainFrame.size.height = 30 + 20 * [o_modulearray count];
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN;
mainFrame.origin.y = 0;
if ([super initWithFrame: mainFrame item: _p_item] != nil) {
i_view_type = CONFIG_ITEM_MODULE_LIST;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */
if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text);
else
o_labelString = @"";
ADD_LABEL(o_label, mainFrame, 0, -3, o_labelString, o_tooltip)
[o_label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: o_label];
/* build the textfield */
if (p_item->value.psz)
o_textfieldString = _NS((char *)p_item->value.psz);
else
o_textfieldString = @"";
ADD_TEXTFIELD(o_textfield, mainFrame, [o_label frame].size.width + 2,
mainFrame.size.height - 22, mainFrame.size.width -
[o_label frame].size.width - 2, o_tooltip, o_textfieldString)
[o_textfield setAutoresizingMask:NSViewWidthSizable ];
[self addSubview: o_textfield];
{
NSRect s_rc = mainFrame;
s_rc.size.height = mainFrame.size.height - 30;
s_rc.size.width = mainFrame.size.width - 12;
s_rc.origin.x = 12;
s_rc.origin.y = 0;
o_scrollview = [[[NSScrollView alloc] initWithFrame: s_rc] retain];
[o_scrollview setDrawsBackground: NO];
[o_scrollview setBorderType: NSBezelBorder];
[o_scrollview setAutohidesScrollers:YES];
// First, initialize and draw the table view to get its height
NSRect s_rc = NSMakeRect(12, 10, mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN, 50);
// height is automatically increased as needed
NSTableView *o_tableview; NSTableView *o_tableview;
o_tableview = [[NSTableView alloc] initWithFrame : s_rc]; o_tableview = [[NSTableView alloc] initWithFrame : s_rc];
[o_tableview setUsesAlternatingRowBackgroundColors:YES]; [o_tableview setUsesAlternatingRowBackgroundColors:YES];
[o_tableview setHeaderView:nil]; [o_tableview setHeaderView:nil];
/* TODO: find a good way to fix the row height and text size*/
/* FIXME: support for multiple selection... */ /* FIXME: support for multiple selection... */
// [o_tableview setAllowsMultipleSelection:YES]; // [o_tableview setAllowsMultipleSelection:YES];
...@@ -2127,12 +2089,41 @@ else\ ...@@ -2127,12 +2089,41 @@ else\
[o_tableview setAction: @selector(tableChanged:)]; [o_tableview setAction: @selector(tableChanged:)];
[o_tableview sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask | [o_tableview sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask |
NSLeftMouseDraggedMask]; NSLeftMouseDraggedMask];
[o_scrollview setDocumentView: o_tableview];
}
[o_scrollview setAutoresizingMask:NSViewWidthSizable ];
[o_scrollview setAutohidesScrollers:YES];
[self addSubview: o_scrollview];
[o_tableview reloadData];
CGFloat tableview_height = [o_tableview frame].size.height;
mainFrame.size.height = 40 + tableview_height;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN;
mainFrame.origin.y = 0;
if ([super initWithFrame: mainFrame item: _p_item] != nil) {
i_view_type = CONFIG_ITEM_MODULE_LIST;
o_tooltip = [[VLCStringUtility sharedInstance] wrapString: _NS((char *)p_item->psz_longtext) toWidth: PREFS_WRAP];
/* add the label */
if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text);
else
o_labelString = @"";
ADD_LABEL(o_label, mainFrame, 0, -3, o_labelString, o_tooltip)
[o_label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: o_label];
/* build the textfield */
if (p_item->value.psz)
o_textfieldString = _NS((char *)p_item->value.psz);
else
o_textfieldString = @"";
ADD_TEXTFIELD(o_textfield, mainFrame, [o_label frame].size.width + 2,
mainFrame.size.height - 22, mainFrame.size.width -
[o_label frame].size.width - 2, o_tooltip, o_textfieldString)
[o_textfield setAutoresizingMask:NSViewWidthSizable ];
[self addSubview: o_textfield];
[self addSubview: o_tableview];
} }
return self; return self;
} }
......
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