Dock Icon

External developers... This forum's for you!

Dock Icon

Postby sctell » Tue Sep 20, 2011 11:14 pm

Is it possible to change the icon displayed in the dock.

I have an overlay window which does not show in the dock.

I want to display the dock icon for the project with the overlay.


All the best

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Dock Icon

Postby marksch » Tue Jan 17, 2012 3:06 pm

Hi Terry,

I wonder if it is possible to have two icons in the app package and rename them to switch their names and then use the shell function to run the touch command line utility. Or use a different icon to build your standalone.

It should also be possible to write an external to change the icon.

Kind regards,

Mark
We have time for new projects. Contact me at http://qery.us/du now and be first in line.

Biggest free icon collection ever: http://icons.qery.us
User avatar
marksch
 
Posts: 78
Joined: Fri Aug 22, 2008 4:51 am

Re: Dock Icon

Postby witness » Sat Jul 14, 2012 3:14 am

sctell wrote:Is it possible to change the icon displayed in the dock.

I have an overlay window which does not show in the dock.

I want to display the dock icon for the project with the overlay.


There are various APIs with "DockTile" in the name, both for Carbon and Cocoa. I believe these days you can even provide a Cocoa NSView to do the drawing. Otherwise it generally takes an NSImage or CGImage.

See NSDockTile, NSApplication -dockTile and NSApplication -setApplicationIconImage:.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are Everywhere..."
http://www.zathras.de
User avatar
witness
 
Posts: 57
Joined: Thu Jul 17, 2008 2:24 pm

Re: Dock Icon

Postby witness » Sat Jul 14, 2012 3:55 am

sctell wrote:Is it possible to change the icon displayed in the dock.


Oh, and Terry,

the Carbon calls would be SetApplicationDockTileImage(), OverlayApplicationDockTileImage() and RestoreApplicationDockTileImage() for the application's icon in the dock. If it's for a window, there only seem to be HIWindowCreateCollapsedDockTileContext() and HIWindowReleaseCollapsedDockTileContext(), which you can use to get a CGContext to draw your own image into. There seems to be no CGImage version of this.

The equivalent in Cocoa of that last one would be -setMiniwindowImage: or mucking with its -dockTile.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are Everywhere..."
http://www.zathras.de
User avatar
witness
 
Posts: 57
Joined: Thu Jul 17, 2008 2:24 pm

Re: Dock Icon

Postby sctell » Sat Jul 14, 2012 1:31 pm

witness wrote:Oh, and Terry,

the Carbon calls would be SetApplicationDockTileImage(), OverlayApplicationDockTileImage() and RestoreApplicationDockTileImage() for the application's icon in the dock. If it's for a window, there only seem to be HIWindowCreateCollapsedDockTileContext() and HIWindowReleaseCollapsedDockTileContext(), which you can use to get a CGContext to draw your own image into. There seems to be no CGImage version of this.

The equivalent in Cocoa of that last one would be -setMiniwindowImage: or mucking with its -dockTile.


Thanks for the information Uli....

I have however given up trying to get Cocoa overlay windows to work correctly with SC, they always seem to fall down somewhere with regard to the event loop.

The best solution to Cocoa goodies in SC seemed the HICocoaView but SC cannot work with these correctly as the windows are not composite.

So, I am sticking to solutions that don't involve a user interface or user interaction with a window.

I am currently working through an external that I am creating to do simple Scatter, Pie, Bar and Line charts all included in one external.

This uses a Cocoa window with NSView (hidden). All drawing is done in the Cocoa view.

A copy can be returned to SC as TIFF,PNG,PDF or to a file for placing in a cd grc.

This was the reason for my question about printing as I want to achieve high quality printing. This cannot be done with the image I return to SC as when you print the cd grc it is of poor quality whereas when I print the Cocoa view it is high quality. Two separate functions for page setup and print will sort the print issue with the added benefit that you get a sample image in the print dialogue in Cocoa that you do not get with SC's carbon print dialogue

Thanks again

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Dock Icon

Postby Dan_Kelleher » Sat Jul 14, 2012 2:07 pm

Terry,
I wonder if using a second off-screen much-larger window (graphic) that was only used for printing might be a mechanism for getting high quality printing. ?
-Dan
Daniel.Kelleher@umassmed.edu
SC4.7.3 OSX 10.7.2 Mac Pro
User avatar
Dan_Kelleher
 
Posts: 438
Joined: Sun Jul 06, 2008 2:45 pm
Location: Worcester (wouster as in would) Massachusetts USA

Re: Dock Icon

Postby sctell » Sat Jul 14, 2012 2:27 pm

Dan_Kelleher wrote:I wonder if using a second off-screen much-larger window (graphic) that was only used for printing might be a mechanism for getting high quality printing. ?


Hi Dan,

Yes, that is a work around that I have used before myself, draw the image much larger so that when you scale it down in the print process the resolution is satisfactory.

You don't need to do that with Cocoa as the drawing commands for want of a better description are like vector graphics and scaleable with no loss of clarity. So in my forthcoming external the chart images can be downloaded as PDF files and when you adjust them in preview they will scale correctly.

You can't do that with SC as when the image is placed in a cd grc and then you print the graphic your getting a rasterized image that is not scaleable hence the solution you have offered. This is not the case however with SC text fields which seem to behave differently. It is possible to draw charts with SC although you cannot rotate text so for example Y Axis labels which are usually rotated 90 degs are not possible. I have also found the rendering speed of charts is quite slow when compared to carrying out the actions in an external. This speed (or lack of) would be even greater if you were to produce a chart of say scale 4 (72dpi * 4 = 288dpi) for printing.

Thanks

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am


Return to Xcode and the Internals Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron