[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Application icon size in the open and save dialogs
From: |
Philippe Roussel |
Subject: |
Re: Application icon size in the open and save dialogs |
Date: |
Mon, 14 Mar 2011 15:05:26 +0100 |
Le lundi 14 mars 2011 à 13:24 +0100, Fred Kiefer a écrit :
> Am 14.03.2011 09:48, schrieb Philippe Roussel:
> > Hi,
> >
> > The image shown in NSSavePanel has a size of 48x48 pixels. The
> > application image could be of a different size, resize it.
> >
> > Maybe a copy of applicationIconImage should be made before setting the
> > image size ?
> >
> > Philippe
> >
> > Index: Source/NSSavePanel.m
> > ===================================================================
> > --- Source/NSSavePanel.m (révision 32563)
> > +++ Source/NSSavePanel.m (copie de travail)
> > @@ -344,6 +344,7 @@
> > r = NSMakeRect (8, 261, 48, 48);
> > button = [[NSButton alloc] initWithFrame: r];
> > image = [[NSApplication sharedApplication] applicationIconImage];
> > + [image setSize:NSMakeSize(48,48)];
> > [button setImage: image];
> > [button setBordered: NO];
> > [button setEnabled: NO];
>
> Yes, if we go that way we will have to use a copy of the image here.
> What I don't like about image copies is that we wont get noticed if the
> original image changes. Why are we using an NSButton here in the first
> place? Wouldn't an NSImageView that scales the image work as well?
For no good reason that I can see.
The following patch works well.
Philippe
Index: Source/NSSavePanel.m
===================================================================
--- Source/NSSavePanel.m (révision 32568)
+++ Source/NSSavePanel.m (copie de travail)
@@ -181,6 +181,7 @@
NSBox *bar;
NSButton *button;
NSImage *image;
+ NSImageView *imageView;
NSRect r;
id lastKeyView;
@@ -342,17 +343,12 @@
[_browser setTarget: _okButton];
r = NSMakeRect (8, 261, 48, 48);
- button = [[NSButton alloc] initWithFrame: r];
image = [[NSApplication sharedApplication] applicationIconImage];
- [button setImage: image];
- [button setBordered: NO];
- [button setEnabled: NO];
- [[button cell] setImageDimsWhenDisabled: NO];
- [button setImagePosition: NSImageOnly];
- [button setAutoresizingMask: NSViewMinYMargin];
- [button setTag: NSFileHandlingPanelImageButton];
- [_topView addSubview: button];
- [button release];
+ imageView = [[NSImageView alloc] initWithFrame: r];
+ [imageView setAutoresizingMask: NSViewMinYMargin];
+ [imageView setImage:image];
+ [_topView addSubview: imageView];
+ [imageView release];
r = NSMakeRect (67, 276, 200, 14);
_titleField = [[NSTextField alloc] initWithFrame: r];