[vlc-commits] [Git][videolan/vlc][master] 4 commits: macosx: Set size of slider in prefs_widgets.m to NSControlSizeSmall, avoiding clipping
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Mon May 15 09:09:42 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
d63a5eb0 by Claudio Cambra at 2023-05-15T06:59:12+00:00
macosx: Set size of slider in prefs_widgets.m to NSControlSizeSmall, avoiding clipping
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
65bc3e1b by Claudio Cambra at 2023-05-15T06:59:12+00:00
macosx: Fix stepper sizing issues in preferences
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
d18c18ea by Claudio Cambra at 2023-05-15T06:59:12+00:00
macosx: Fix indentation in ADD_SECURETEXTFIELD macro
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
28f23301 by Claudio Cambra at 2023-05-15T06:59:12+00:00
macosx: Remove use of LEFTMARGIN and RIGHTMARGIN macros in prefs_widgets in favour of use of VLCLibraryUIUnits
- - - - -
1 changed file:
- modules/gui/macosx/preferences/prefs_widgets.m
Changes:
=====================================
modules/gui/macosx/preferences/prefs_widgets.m
=====================================
@@ -37,17 +37,16 @@
#include <vlc_plugin.h>
#include <vlc_actions.h>
+#include "library/VLCLibraryUIUnits.h"
#include "main/VLCMain.h"
#include "extensions/NSString+Helpers.h"
#include "preferences/prefs_widgets.h"
-NSString *VLCPrefsWidgetModuleDragType = @"VLC media player module";
+NSString * const VLCPrefsWidgetModuleDragType = @"VLC media player module";
#define CONFIG_ITEM_STRING_LIST (CONFIG_ITEM_STRING + 10)
#define CONFIG_ITEM_RANGED_INTEGER (CONFIG_ITEM_INTEGER + 10)
-#define LEFTMARGIN 18
-#define RIGHTMARGIN 18
#define PREFS_WRAP 300
#define OFFSET_RIGHT 20
#define OFFSET_BETWEEN 2
@@ -274,15 +273,15 @@ NSString *VLCPrefsWidgetModuleDragType = @"VLC media player module";
#define ADD_SECURETEXTFIELD(o_textfield, superFrame, x_offset, my_y_offset, \
my_width, tooltip, init_value) \
{ \
-NSRect s_rc = superFrame; \
-s_rc.origin.x = x_offset; \
-s_rc.origin.y = my_y_offset; \
-s_rc.size.height = 22; \
-s_rc.size.width = my_width; \
-o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
-[o_textfield setFont:[NSFont systemFontOfSize:0]]; \
-[o_textfield setToolTip: tooltip]; \
-[o_textfield setStringValue: init_value]; \
+ NSRect s_rc = superFrame; \
+ s_rc.origin.x = x_offset; \
+ s_rc.origin.y = my_y_offset; \
+ s_rc.size.height = 22; \
+ s_rc.size.width = my_width; \
+ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
+ [o_textfield setFont:[NSFont systemFontOfSize:0]]; \
+ [o_textfield setToolTip: tooltip]; \
+ [o_textfield setStringValue: init_value]; \
}
#define ADD_COMBO(o_combo, superFrame, x_offset, my_y_offset, x2_offset, \
@@ -343,7 +342,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
NSRect s_rc = superFrame; \
s_rc.origin.x = x_offset; \
s_rc.origin.y = my_y_offset; \
- s_rc.size.height = 23; \
+ s_rc.size.height = 24; \
s_rc.size.width = 23; \
o_stepper = [[NSStepper alloc] initWithFrame: s_rc]; \
[o_stepper setFont:[NSFont systemFontOfSize:0]]; \
@@ -354,6 +353,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
[o_stepper setAction: @selector(stepperChanged:)]; \
[o_stepper sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask | \
NSLeftMouseDraggedMask]; \
+ [o_stepper sizeToFit]; \
}
#define ADD_SLIDER(o_slider, superFrame, x_offset, my_y_offset, my_width, \
@@ -369,6 +369,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
[o_slider setToolTip: tooltip]; \
[o_slider setMaxValue: higher]; \
[o_slider setMinValue: lower]; \
+ [o_slider setControlSize: NSControlSizeSmall]; \
}
#define ADD_CHECKBOX(o_checkbox, superFrame, x_offset, my_y_offset, label, \
@@ -415,6 +416,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
} else {
psz_name = NULL;
}
+
[self setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin ];
}
return (self);
@@ -915,11 +917,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *o_textfieldString, *o_textfieldTooltip;
mainFrame.size.height = 22;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -992,11 +997,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *o_textfieldTooltip;
mainFrame.size.height = 22;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin + 1;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame: mainFrame item:p_item]) {
@@ -1093,11 +1101,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *o_itemTooltip, *o_textfieldString;
mainFrame.size.height = 46;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -1133,7 +1144,6 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (void) alignWithXPosition:(int)i_xPos
{
- ;
}
- (IBAction)openFileDialog:(id)sender
@@ -1181,11 +1191,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *o_popupTooltip;
mainFrame.size.height = 22;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin + 1;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -1306,6 +1319,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
{
NSTextField *o_textfield;
NSStepper *o_stepper;
+
}
@end
@@ -1313,11 +1327,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *toolTip;
- mainFrame.size.height = 23;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.height = 24;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin + 1;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -1402,11 +1419,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *o_textfieldTooltip;
mainFrame.size.height = 22;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin + 1;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -1492,11 +1512,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *toolTip;
mainFrame.size.height = 50;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame: mainFrame item:p_item]) {
@@ -1604,11 +1627,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *toolTip;
- mainFrame.size.height = 23;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.height = 24;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin + 1;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -1695,11 +1721,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *toolTip;
mainFrame.size.height = 50;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -1804,11 +1833,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *toolTip;
mainFrame.size.height = 17;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
self = [super initWithFrame:mainFrame item:p_item];
@@ -1851,11 +1883,14 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString, *toolTip;
mainFrame.size.height = 22;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin + 1;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
@@ -2027,9 +2062,12 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
} /* FOR i_module_index */
module_list_free(p_list);
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
// First, initialize and draw the table view to get its height
// width is increased a little to fix horizontal auto-sizing
- NSRect s_rc = NSMakeRect(12, 10, mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 18, 50);
+ NSRect s_rc = NSMakeRect(12, 10, mainFrame.size.width - leftMargin - rightMargin + 18, 50);
// height is automatically increased as needed
o_tableview = [[NSTableView alloc] initWithFrame : s_rc];
[o_tableview setUsesAlternatingRowBackgroundColors:YES];
@@ -2072,8 +2110,8 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
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.size.width = mainFrame.size.width - leftMargin - rightMargin;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
self.frame = mainFrame;
@@ -2245,11 +2283,14 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ const NSUInteger leftMargin = [VLCLibraryUIUnits largeSpacing];
+ const NSUInteger rightMargin = [VLCLibraryUIUnits largeSpacing];
+
NSRect mainFrame = [parentView frame];
NSString *labelString;
mainFrame.size.height = 17;
- mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
- mainFrame.origin.x = LEFTMARGIN;
+ mainFrame.size.width = mainFrame.size.width - leftMargin - rightMargin;
+ mainFrame.origin.x = leftMargin;
mainFrame.origin.y = 0;
if (self = [super initWithFrame:mainFrame item:p_item]) {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c772bf60bb31d64975cf956f1a3f311a02a17643...28f23301f6124be1bcf92a6dad44de03844b723e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c772bf60bb31d64975cf956f1a3f311a02a17643...28f23301f6124be1bcf92a6dad44de03844b723e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list