bugGNUstep - Bugs: bug #18970, NSToolbarItem setImage: scales...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #18970: NSToolbarItem setImage: scales image only on initial creation ?

Submitted by:  Paddy Smith <padski>
Submitted on:  Tue 06 Feb 2007 07:49:07 AM UTC  
 
Category: Gui/AppKitSeverity: 3 - Normal
Item Group: BugStatus: Invalid
Privacy: PublicAssigned to: Gregory John Casamento <gcasa>
Open/Closed: Declined

Fri 04 Jan 2008 01:22:42 PM UTC, comment #2:

Requested clarification and have not been able to reproduce this issue since.

Closed due to:

1) Cannot reproduce and
2) Lack of communication with original poster.

GJC

Gregory John Casamento <gcasa>
Project AdministratorIn charge of this item.
Sat 19 May 2007 03:52:45 PM UTC, comment #1:

I realize it's been a while, but would it be possible for you to attach an image file demonstrating the problem?

Gregory John Casamento <gcasa>
Project AdministratorIn charge of this item.
Tue 06 Feb 2007 07:49:07 AM UTC, original submission:

test code to show this effect when the images used are 128x128 pngs. The button changes the image on the toolbarItem, the second image appears unscaled.

AppController.h:

#include <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

@class NSWindow;
@class NSTextField;
@class NSNotification;

@interface AppController : NSWindowController
{
NSWindow *window;
BOOL readyToPlayStatus;
}
- (void)applicationWillFinishLaunching:(NSNotification *) not;
- (void)applicationDidFinishLaunching:(NSNotification *) not;
@end

AppController.m:

#include "AppController.h"
#include <AppKit/AppKit.h>

@interface AppController (AppControllerToolbar)

- (NSToolbarItem ) toolbar: (NSToolbar ) toolbar
itemForItemIdentifier: (NSString *) itemIdentifier
willBeInsertedIntoToolbar: (BOOL) flag;

- (NSArray ) toolbarAllowedItemIdentifiers: (NSToolbar) toolbar;

- (NSArray ) toolbarDefaultItemIdentifiers: (NSToolbar) toolbar;

- (BOOL) validateToolbarItem: (NSToolbarItem *) theItem;

@end

@implementation AppController (AppControllerToolbar)

- (NSToolbarItem ) toolbar: (NSToolbar ) toolbar
itemForItemIdentifier: (NSString *) itemIdentifier
willBeInsertedIntoToolbar: (BOOL) flag
{
NSToolbarItem *item;
if ([itemIdentifier isEqualToString: @"ready"]){
item = [[NSToolbarItem alloc] initWithItemIdentifier: itemIdentifier];
[item setLabel: @"Ready"];
[item setPaletteLabel: @"Toggle Ready"];
[item setImage: [NSImage imageNamed: @"toolbarStatusNotReady"]];
[item setTarget: self];
[item setAction: @selector(toggleReady:)];
}
return item;
}

- (NSArray ) toolbarAllowedItemIdentifiers: (NSToolbar) toolbar
{
return [NSArray arrayWithObjects: @"ready", nil];
}

- (NSArray ) toolbarDefaultItemIdentifiers: (NSToolbar) toolbar
{
return [NSArray arrayWithObjects: @"ready", nil];
}

- (BOOL) validateToolbarItem: (NSToolbarItem *) theItem { return YES; }

@end

@implementation AppController

- (void) toggleReady: (id) sender { NSLog(@"do stuff"); }

- (void) toggleReadyItem: (id) sender
{
NSToolbarItem *anItem;
NSEnumerator *enumerator = [[[window toolbar] items] objectEnumerator];
while (anItem = [ enumerator nextObject ]){
if([[anItem itemIdentifier] isEqualToString: @"ready"]){
if (readyToPlayStatus) {
readyToPlayStatus=NO;
[anItem setImage: [NSImage imageNamed: @"toolbarStatusReady"]];
}else{
readyToPlayStatus=YES;
[anItem setImage: [NSImage imageNamed: @"toolbarStatusNotReady"]];
}
}
}
}

- (void) applicationWillFinishLaunching: (NSNotification *) not
{
NSMenu *menu = [NSMenu new];
[menu addItemWithTitle: @"Quit"
action: @selector(terminate:)
keyEquivalent: @"q"];
[NSApp setMainMenu:menu];
RELEASE(menu);

window = [[NSWindow alloc] initWithContentRect: NSMakeRect(300, 300, 200, 100)
styleMask: (NSTitledWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask)
backing: NSBackingStoreBuffered
defer: YES];
[window setTitle: @"Test Toolbar"];

NSToolbar *aToolbar = [[NSToolbar alloc] initWithIdentifier: @"AppControllerToolbar"];
[aToolbar setDelegate: self];
[aToolbar setAllowsUserCustomization: YES];
[aToolbar setAutosavesConfiguration: YES];
[window setToolbar: aToolbar];
RELEASE(aToolbar);

readyToPlayStatus=NO;

NSButton *myButton= [[NSButton alloc] initWithFrame: NSMakeRect(30, 30, 80, 30)];
[myButton setTarget: self];
[myButton setAction: @selector(toggleReadyItem:)];
[[window contentView] addSubview: myButton];
RELEASE(myButton);

}

- (void) applicationDidFinishLaunching: (NSNotification *) not
{
[window makeKeyAndOrderFront: self];
}

- (void) dealloc
{
RELEASE(window);
[super dealloc];
}

@end

I'm using the gnustep in debian etch (ie: latest gnustep release), but with base from svn at 20061227.

Regards,
Paddy

Paddy Smith <padski>

 

Attached Files
file #12812:  gnustep_bug18970_example1.png added by padski (19KiB - image/png - on the left is an image correctly scaled, on the right an image which is green but otherwise the same, but not scaling the same.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gcasa (Posted a comment)
  • -unavailable- added by padski (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Jan 2008 01:22:42 PM UTCgcasaStatusIn Progress=>Invalid
      Open/ClosedOpen=>Declined
    Sun 20 May 2007 08:46:00 PM UTCpadskiAttached File-=>Added gnustep_bug18970_example1.png, #12812
    Sat 19 May 2007 03:53:12 PM UTCgcasaStatusNone=>In Progress
      Assigned toNone=>gcasa

    Back to the top


    Powered by Savane 3.1-cleanup1