WWDC2000 Session 127

Transcript

Kind: captions
Language: en
please welcome David Rice Mac OS 10
applications technology manager thank
you welcome to session 127 cocoa update
I know they've got a lot of material to
tell you about since I you last we're
using cocoa so without delay i'm just
going to bring a Leo's around stage
please welcome and manager of the cocoa
framework team David well good afternoon
it's sort of lights I guess but not much
more left of today okay so I am I'll we
go through the manager of the cocoa
frameworks yes so today's topics are
we're going to talk about the state of
cocoa today that's just a few minutes
and then we're going to talk about
what's new in cocoa basically what has
changed since the last time work
together which was last WWDC and we're
also going to talk a few minutes about
some of the upcoming changes things we
have planned over then for the next few
months next to you know in the next few
releases so first few slides about state
of cocoa so what has been happening well
the big thing as you might imagine was
aqua it's a app kit is all user
interface classes a lot of user
interface widgets and abstractions and
helper classes and implementing Coco was
a big big task for us I think we're very
happy to deliver it in Macworld and have
a great demo and then since then we were
obviously doing a lot more enhancements
and polish and that's that's been a big
task for us and a big part of this talk
will be about the Aqua we also have been
continuing to integrate better with the
components in Mac OS 10 last time we're
together we talked about how we
integrated with the new kernel and VPS
going away and courts in its place and
since then Finder has been more
established we now have the new Finder
instead of workspace the carbon api's
are more established and the carbon
their carbon applications and stuff in
the system and so we've been updating
the coco frameworks to work more with
these elements we've also been
implementing new features based on
feedback and various other sources some
features that will
about today and we're obviously even
also fixing bugs and improving
performance obviously changing the
system moving components putting new
components and introduces bugs and
performance issues and we've been
constantly battling those okay so one
thing to note about cocoa is that in Mac
OS 10 in DP for cocoa is being used in a
large and an increasing number of
applications so here is a here's some of
them I mean as you know male texted it
grabbed some of the old favorites
preview address book is a new one which
lets you manipulate your address books
to be used in mail and other other cases
and also notice image capture if you are
at Mac os10 keynotes Bertrand's keynote
Christine showed you the image capture
framework and she showed you the app
that uses the image capture framework
and she took a picture of you all and
the image capture app is also for
instance a Coco app that uses the image
capture framework which is a brand new
framework available to Coco and carbon
applications in administration side we
have assistant multiple users that's a
new app and you know terminal installer
old stuff and developer applications we
have the new project builder which is a
Coco app obviously the robe objects
project builder and interface builder
are all Coco applications ok so one
interesting topic is an objective see
what happens to objective-c moving
forward and as you might imagine and
you've probably seen this and noticed
this in in the various developer
previews we are adding new api's and we
are adding new features and we are
exposing them in both Java in
objective-c so we have not stopped
improving objective-c
and we do intensive support objective-c
for the foreseeable future so if you
want to write objective King you can and
and you can as you can imagine
internally at Apple we're writing
applications in both Java and Objective
C we both you know obviously want to be
banging on both stacks and both both
api's and we're going to improve both so
internally we're using both API to write
apps and it's possible to write large
big applications full featured in using
both of these languages okay so now on
to what's new in cocoa here we're just
going to go through some of the changes
the new api's and so on and so forth
this is going to be the bulk of the talk
okay we're going to go through changes
in aqua and changes that having the
finder in the system have brought us and
then some of the changes brought on with
the ports and the OpenGL the new graphic
subsystems in the system and also the
umbrella frameworks which you've heard
about in some of the other sessions and
then we'll also cover a few of the other
new interesting features that was added
since last available DC so aqua if you
are at Donna Lindsey's talk on Monday
you heard all about the design
philosophy behind aqua and you saw some
of the some of the really deep thought
that one is the sum of those elements in
aqua and it is the new user experience
for mac OS hand it is the user
experience you know it's not very
critical changeable what we hope to
happen make it no great if aqua impacts
user experience in multiple ways it
changes the look and feel of existing
controls and also their sizes and
layouts in some cases it also introduces
some new interactions the changes some
of the way menus are laid out and so on
so the changes in the look and layout
includes for instance the new system
font the new system font that's used in
aqua is lucida grande 13 points and so
that's the font you've been seeing in
all of the applications there's
obviously a new background pattern a lot
of you know that can you see it up there
there it is magnified our back
pattern this is a you know in the
backgrounds of Windows and so on in the
backgrounds of menus we have larger
controls now turns out controls are not
taller but in some cases they're wider
because the buttons for instance it had
longer end caps so the cancel and okay
but since both ends up being somewhat
wider but they're most cases they're not
taller than they were in the platinum
space they also have updated inter
control spacing some of the spacing
rules between controls have been updated
fine-tuned and you can read about these
in the Aqua layout guidelines another
thing we've changed is the window frames
and shadows don't look at the cat look
at the borders and you can see you know
there's nice little buttons and so on
and we've introduced those into aqua and
also the semi-transparent inactive
titles and also semi-transparent menus
are also new and aqua in the interaction
area we've changed a bunch of things for
instance the menu layout currently the
application menu has application centric
elements file menu edit menu etc so some
of the elements have moved around from
where they were in mac OS x server and
mac OS 9 we have pulsating buttons I
couldn't make powerpoint pulp lies and
try very hard so imagine sheets we have
sheets and you've seen demos of those
will go over those today we have drawers
we have dynamic resizing as you resize
that window the contents reflow on the
fly similarly with split views as we
move the split bar up and down in a
blizzard pain the both sides redraw
dynamically on the fly and we finally of
course have the dock which is a very
visible design of the element of the
user experience so some of these changes
are automatically picked up by the
applications you know you don't have to
do any work for those for instance
pulsating buttons if you had a button
which was set to be the default button
in a window it will now pulse state as
opposed to draw a darker ring around it
the new system font is also picked up if
you are correctly using the message font
which used to be charcoal it will now be
lucid a grande except the size is not
automatically picked up so that's one
element that's not automatic the dynamic
resizing of Windows but bars that's all
automatic
you know most reviews implement draw
active the most views are quite proper
in how they refresh themselves so
dynamic resizing just works and window
frames and shadows to you know we showed
those window frames for the most part
most def not care about the window
frames they're just focused on the
content so things should work fine some
of the changes are not so automatic new
control sizes and layout if the buttons
have gotten wider as you know nibs don't
automatically pick those up so your
buttons might get clipped at the edges
whoops the menu layout is not
automatically picked up so the quit
items and stuff don't move to the first
menu and sheets and drawers are new
features that you have to take exclusive
advantage of for your app to use them
but interface builder can help so we
have added some feature in the interface
builder where it will update your nib to
a certain degree and it helps with the
menu layout it helps with control sizing
and layout and also helps with the fonts
you can find the feature in this menu
you can't miss it because the menu is
quite large anyway but there's an item
that says apply layout guidelines to
window I do want to show a quick demo of
this can switch to demo one please okay
so let me go into the nibs okay so what
I'm going to do is I'm just going to
open a few nibs show you how they looked
in the old world and show you what
happens to them when they're edited one
of them is this nip here in order other
title bar this is being open image
program so this is the way things used
to look in mac OS x server it's been a
long time since some of us have seen
this but you know this is a one of the
preferences panels i will now open this
in interface builder so as you can see
when you open it in interface builder
it already ended up doing some of the
work for you it looses that is used
where health of our charcoal was being
used because that's already set to be
the message fund however notice that
this button looks a bit tight compared
to what aqua would like to see so if we
go to the interface builder that big
menu they apply layout guidelines to
window the window will grow now one
thing it doesn't actually do is grow the
window but the contents grow if you make
the window bigger you'll see that the
start button is now a more aesthetically
pleasing wider end cap type button' the
text has changed to be 13 point or
larger and these two radio buttons have
space themselves a little apart to fit
the guidelines that's one case let's
close that one okay another case here is
this services controller again let's
open this is the way it looked this is I
think again in the in the Preferences
panel and if we open this one turns out
to be actually look almost good enough
even in aqua without any changes you'll
notice again the button is clipped again
if we go ahead and say apply UI
guidelines things just scroll now notice
that this command does do a pretty good
job in some cases but in other cases
where alignments are involved it will
not go ahead and necessarily keep the
alignment that's because it doesn't know
that these two elements are related to
each other so in those cases you know do
that or whatever you would like in some
cases it will actually be worse but it
is pretty good that in that it fixes
fonts and a lot of other subtle things
that would be very hard to get to so let
me also open one more here there you go
there's a sound panel this one opens up
and the sliders end up getting clipped a
lot because they got lot fatter since
since last time apply UI guidelines and
you notice all these end up looking good
the Buddhist button gets cooked a bit
again a little little tweaking will fix
that okay so one thing that this does is
if it sees lucid if it sees message font
at 12 point it will fix it up the
message from fonte at 13 another hack we
added in there is if it sees Helvetica
s12 it will actually change that to
message font at 13 point because a lot
of old nibs which were created before we
added the dynamic font feature tended to
use health
12 and we finally said 99 / some of the
cases cases the person really meant
message font so we're changing those as
well but if you're for instance excuse
to use charcoal or if you extra spew
some other fun those will not be updated
or if you use message want a 20-point
for instance it will remain 20-point
okay can we switch back to slides please
slide thank you okay so one other thing
to note here is we have this concept of
platform specific resources where you
can have the same nib file but optimized
for one platform or the other to
differentiate Mac os10 from mac OS x
server we have added the use of these
prefixes or suffixes so if you for
instance have a sketch document that nib
a nib file which is your generate nib
file if you want to have a version
that's optimized for mac OS and server
you could add the dash macintosh suffix
onto that and it will be opened it will
be used correctly on mac OS and server
so this is of interest you know to
applications where your compound for
both platforms and you want to maintain
resources for both and these can even
coexist in the Resources directory
obviously because of this naming scheme
okay so drawers now let's talk about
some of the drawer features and some of
the API that you can use to control them
so drawers are views that popping them
out from sides of a window and now you
will see one of the wonders of power
point here is a male window and there's
a drawer I'd like to see them again
drawer okay so PowerPoint turns out to
have some hidden nice little features so
the drawers are attached to the parents
window so they're like a separate window
on the side but when you move the parent
window they move with it and they're
implemented as a subclass of nsobject so
they're not a window or a panel there
abstracted away from that so the
commonly used API is in this drawer are
these guys you can imagine that you want
to have an API to open a drawer closed a
drawer and these are target action
methods so you would connect it to your
button or whatever menu item that
controls the drawer you can also tell a
drawer to open in a certain edge left
right bottom whatever
you can set the parents windows set the
content view these basically determine
where a drawer is attached and what the
contents are you can also set a
preffered preferred edge so when Oakland
is called this indicates which side the
drawer should open on and you can also
ask for the state and ask for which edge
it's on now notice that drawer can
actually be in three states closed open
and in transition and that's because it
actually takes time to open and during
that time your app can still be active
the user can still be doing things now
it turns out interface builder does
provide support for drawers so you don't
actually have to use parents window
content window type methods you can
actually hook these up an interface
builder to your drawer which is actually
pretty good another also has delegates
as the delegate methods tell you
basically when the drawer is about to
open when it did open when it will open
that way if you have a drawer but you
don't want to populate the contents at
launch time you can wait till the
drawers about to be opened and populate
at that point so pretty straightforward
delegates API okay so now we'll talk a
little bit about sheets sheets are the
document modal panels on a window and
you saw the demos it does a little genie
effect to come down and it's also
attached to the window now the most the
most interesting aspect of sheets and
the hardest as well is the fact that
they are document modal what this means
is when that window when the window has
a sheet on it you can still interact
with the other windows in the
application you can even bring down
sheets in other windows and so on and
just goes against the model the modality
that we have introduced in NS
application and throughout the system
all these years because suddenly you're
not locking all the events to other
windows so one of the implications of
this is run modal method you know when
you say run mobile this panel run model
this alert and so on it now needs to
return immediately so the other sheets
can be brought down and other things
would happen otherwise you get into a
stack-based situation where one panel is
down another panel is down but if you
cancel this panel your your stack is
sort of screwed up and you don't know
what to do so the run modal has to
return immediately in the later point
call back needs to be sent to tell you
that the panel has been dismissed and
that's the model we move towards with
sheets so dp4 has the new API so
sportsheets there's the api's are in
three separate categories and there
might be a few more api's we're adding
going forward from here the api's are
currently there are API for the safe
panel which also apply to the open panel
I believe functions to run alert panels
doc modely so these are the simple three
two or one button alert panels and API
in an S application to run any window
doc mode early so you can have any panel
and run it model e this way and it'll be
attached to your window come down as a
sheet and so on so as an example i'm
going to show you the safe channel API
and explain to you how this one works
the safe panel API now if you remember
the old safe panel API it used to say
run model for directory and file and
basically you gave the first two
arguments that you would see here here
you see path and name now we've added
four more arguments of the method the
arguments are actually fairly
straightforward model for window that is
the window that the panel should be
attached to the model delegate is the
object that wants to hear about that
panel and the did and selector is the
selector that will be sent to that modal
delegate the model delegate is a
temporary one time delegate that gets
created on the only message it will get
is the did end selector when the panel
is dismissed so that's all those two are
finally we've added an argument that
represents arbitrary user info that you
can pass in there can be obstruct it can
be a dictionary it can be anything you
want it can be no sometimes we found
it's good to carry state between this
message in the design selector and just
a convenient way to do that so what
happens is this will put up the sheet
and that's it when the panel is
dismissed the did end selector you
specified will be called now note that
the didn't selector can be called
anything the interesting thing about
this collector is its signature meaning
which arguments it takes it can take a
sheet it takes a sheet basically sheet
that you're running model for it takes
the return code that's whether it was
canceled or okay or whatever it also
takes the content
info that you passed in in the first
place now the reason that the selector
can be named anything and you specify
this is sometimes in some context you
might bring up say found three different
ways and each one should really have a
different this end indication so that
you don't have to do if or whatever now
the alert channel API is also like the
old one except it's grown a few
arguments we also moved some of the
arguments around if you've ever used NS
whether whether it's called run modal
alerts or alert run model or one of
those it used to have the title then the
message then the buttons and then the
arguments for the message so what sort
of a the arguments were intermixed we've
moved the arguments around but basically
the title is the title of your alert the
three buttons default button altering
button other buttons appear next then
you get the doc window and the modal
delegate and it will end and did end
selectors in this case we have two
selectors one is shown to you before the
alert is dismissed the other one is sent
to you when the alert is business and
finally we have a context just like the
other case and at the end we have the
message a format string followed by all
the arguments like in the olden days
it's just we move those to the end and
they're all together now ok so the
implications of sheets goes beyond just
adding these methods it turns out what
do you do in methods which are which
I've traditionally put up panels to get
a response from the user and then
returned yes or no and those include
window should close for instance when
the user hits the close button typically
the delegate gets window should close
window should close puts up a panel the
user response save or don't save and
finally when the user is done that all
returns and that method returns yes or
no indicating that the window is safe to
close an application should terminate is
another one now these guys if they run
sheets the sheets will return
immediately and these guys they don't
know whether to return yes or no because
the operation is still ongoing ok so
currently the thought is if a panel
needs to be put up put up the panel in
return no indicating do not
the window do not terminate the
application then in the callback finally
once the user is done with that panel
you close the window or your terminate
the app that will again invoke the
delegate methods but at this time
because the document is saved it will go
through the yes path and return yes to
indicate it's safe to close and just
ends up working quite well so this is I
think what what you should be using in
these cases now in vp3 we had added some
sheet api's and we are deprecating those
they are there in DP for but you should
not use them they're marked that way in
the header file these are the run model
for window relative to window api's
which assume a model you call it and
then it returns type behavior so don't
use those methods now the api's we had
for a long time the run modal api's run
model for window those are going to stay
those will still run the modal panels at
mode early it appears in the middle of
the screen no that's like the old days
and there are still cases where those
are appropriate so those api's will stay
and you can use them now one thing to
note is in DP for NS document does not
make full use of the new api's although
NS documents will put up sheets and so
on it doesn't make use of a lot of the
newest features so in some cases you
might notice odd behavior the good news
is we are fixing that bug so if you're
having that enough document based app it
will be fixed in the next drop ok so let
me demo sheets for you now
well okay let's quit that let's quit
that okay so for one thing let me show
you in the context of text edit some of
the subtleties of sheets close this okay
so let me open a document i will go open
a release note so now i'm going to go
ahead and attempt to save this note that
this an HTML file and text it does not
save an HTML file so when you try to do
this to get this warning can't save HTML
should we save as RTF so this is like
the beginning of a chain of these doc
model panels note that while this is up
I can go in here and i can continue
typing i can even try to close this
window which will put up another panel
anyway it for instance down here if I
say supply a new name okay this now will
drop a safe channel for me to type in
and while this guy I can still type and
do other things in and here i can type
some file name for instance i can type a
file name that it won't be able to save
in because it's in flash and it will put
up another alert telling me couldn't
save as tested RTF during this whole
time these dis other windows are
accessible I can bring up new windows
and so on so basically you can see that
there's a chain of calls here that are
happening i will show you as this is an
example in the context of a small
simpler application now okay i actually
open a project
okay here we have a simple example let
me actually run it for you so here's our
simple example this example lets me type
and then lets me say that and so this is
basically a modal panel but it's doc
modal because I can bring up an about
panel while that's up and if I try to
save it to an illegal location or it
will let tell me that couldn't save and
it will let me try again by bringing up
the safe panel again so i'll just show
you the code for this little example
okay other than the administrivia at the
beginning we basically have the save as
method and this one creates a space
panel it sets the required file type and
then it's just begin sheets for
directory that's it and as you can see
it's fairly straightforward it runs
modely for the window specify self and
the selector is in save sheet that's it
so when the save file is done this
method will be called so and there's
this method here so this method is
pretty straightforward if the code is ok
meaning the user did not cancel this
just simply gets the file name out of
the face panel it attempts to save this
is just the local method we have which
attempts to save returns yes or no if
the save fails we go ahead and we put up
an alert panel and we say couldn't save
try again cancel and here we specify the
selector another one and can't save
alert and this method itself if the ok
button is pressed in the alert goes back
to call say that which is basically the
thing that started this so as you can
see instead of having what would
traditionally be a large method here it
gets broken up into three pieces with
the callbacks providing continuation
okay so can we go back to slides please
so pattern colors another thing we've
added is pattern colors as you know
we've added the pattern background
support and courts also has facilities
for patterns so we decided to bring the
patterns feature into NS color as a
publicly available feature so basically
you get enough color instances which
when painting use patterns instead of
solid colors to sport this we've added a
new color space the NS a-- pattern color
space and we've added two new methods
the color with pattern image and pattern
image so you give it an NX image no
matter what kind of image PDF JPEG TIFF
and it creates a enough color for you
and you can also ask for its pattern now
one thing to note about pattern colors
and this has always been true of enough
colors but I think it's good to repeat
this every few years pattern colors do
not have traditional components like red
green blue what this means if you have a
pattern color and you ask for the red
component that is an error because it
just does not have a red component in
the pattern color space the only
component is the parent image so if you
have some color and if you don't know
where that colors bin and you want to be
robust you should convert that color to
the calibrated RGB colour space if you
want to get the RGB and then ask for
thread component note that that call
might return null meaning this color
cannot be represented in RGB in which
case you should do whatever is
appropriate with the component you want
to do you should use black or you should
just use some other color so and this is
just good programming practice with
colors and so far we have this of course
with system colors which are also not
traditional RGB colors CMYK is even with
see my keys you can get into this case
we've also added the concept of a
control pins as you notice the buttons
are that lovely blue when they're active
or pulsating and the question might come
up if you try want to change that blue
of this if we change the tint or
whatever what should you do if you want
to have your own controls which are not
dundas button well we have instead of
using NS colors explicitly we've added
the concept of color tint and there's
two of them the default color tint which
represents all the blues that are around
the system and the clear control tint
which is also used for some controls
which appear clearer so basically you'd
set a buttons color by using these two
one of these two values and similarly if
you wanted to get the next color
corresponding to attend you would call
this enough color method which will
return to you that shade of blue which
then you can use to go ahead and create
other controls or whatever now note that
the flash method is actually not in DP
for so it's it's going to come as soon
as possible so the front panel just a
few words about that if the fog panel
now provides multiple panels in it
multiple panes and it allows you to
manage your favorites and manage
collections and we don't have any API
since ice yet but we're thinking that we
might at some point add API select
applications manage or add collections
of the fence fun panel dynamically and
one of there is no thing to note about
the spawn panel says no longer has a set
button so its immediate action on your
document we were not sure of this
changes first as to how it would behave
but it seems to act it seems to behave
very well it's zippy and it it makes
sense so I think it's going to be kept
that way the safe town also has some new
api's and some changes one of the big
changes is that when it's now pops up by
default it's small we call that the
simple mode or the unexpanded mode
there's new API that tells you whether
the face panels expanded or not and
there's also a delegate API that tells
you it's about to expand or it's about
to collapse and this would let you maybe
do more subscale things to the safe
panel like add more exists reviews or do
something if you know that it's about to
expand there's obviously also the API
that we showed you earlier for the new
doc model behavior okay so i'm going to
show you the font and space panels now
demo thank you
okay so let's close this window okay so
first the font panel there's the font
panel and you'll notice that there's a
pop up in here which lets you specify
collections and so on once if I select
the font here palatino 30 add to
favorites go to my favorites now I have
to because i already added one earlier i
can go back to the fonts i can choose
another font New York regular add to
favorites will be in my favorites in
here by one click I'm basically
selecting that font it's at a certain
font size certain families certain face
we also have the collections I have the
old fonts collection by default I can
add a new collection let's say I call it
nice font I can go ahead and choose
fonts from here palatino added in their
new york added in there Helvetica added
in there so when we go back to the fonts
painting all fonts give me everything
nice fonts give me basically a subset
that I've chosen and it's a good way to
categorize your plants especially if you
have a deaf
now i said i was going to demo the space
channel but i think you've already seen
the safe channel enough there's a safe
panel you can expand it there you go
that's the big version and that's a
small version one thing to note in the
big version is that there's an add to
favorite feature so if i go ahead and
for some reason let's say I want to go
system documentation developer I can add
that to the favorites it now starts
appearing in my favorite places so
that's just like the font panel allows
you to group the things you like to go
too often it's actually we also have
recent places so you can always get to a
place you visited recently so that's as
far as a safe panel and I was thinking I
should also show you one more thing
while I'm here so let's write hello
world let's give ourselves a nice big
font even maybe even make it bold and
let's bring up the color panel that's
one panel we haven't shown you before so
if I obviously change the color and drag
that does what you expect and I call it
talked about pattern colors earlier if
you go to the system color list you'll
notice that some colors are now pattern
because the control color and also a
window background color which appears
here are actually that pattern that you
see in the backgrounds of windows if I
choose that color by dragging on top of
my text it now starts drawing with the
pattern I mean as you can imagine no
codes changes and I know if you can see
that but you can certainly see this so
basically most well behaved code should
start adapting and using patterns no
problem and sketch also for instance
turns out to use patterns very well
there there will turn out to be some
problems in some cases for instance the
RTF specs does not let you store
patterns or colors so if you save the
Stars you have read it back the parents
will be gone but anyway again in some
use of text this might be fairly handy
to have patterns use pop up like this
okay that's just for that slides please
okay find your interaction now let's
talk about some of the new new features
added because of the presence of finder
and some more sub skate interaction with
the system reopen events f packaging
info.plist and icons are what I'm going
to talk about here so reopen event as
you know in the old Mac OS one of the
problems that users new users would get
into was they would close the last
document in an application then they
might switch another application switch
back and although the menu bar would
change to indicate they were in the new
application they might not know they
were in the new application because
there was no open window to indicate
this and this was solved in mac OS x
adding this concept of a reopen event
whenever you go back into an application
the application received this Apple
event which indicates the app you're
being reactivated do something
appropriate so Coco applications on 10
will receive this event we obviously
take care of it packages in some other
formats for you and one thing we do is
we send it to you in this delegate
method for another application
application should handle reopen has
visible windows so the idea with this is
you implement it to do something custom
in the case of reopening documents or
reactivating the has visible windows
flag tells you whether there are any
visible windows on the screen so if you
implemented this probably what we would
do is if has visible windows is no you
would go ahead and open a new document
or you might choose if your documents
were heavy weight instead to put up an
about panel or a new document creation
panel it's up to you if you do not
implement this method or if you
implement this method and return yes
which means you're not handling if the
application should handle it then we
will simply call the application open
untitled file delegate methods for you
which will create a new untitled
document and so this is something good
to add to your app if you want to be
sophisticated about this handling
so we have changed the appt packaging
since Mac os10 server in fact we change
this twice so this was what we had in
mac OS x server and in vp one text app
text edit and resources in DP to our
heart was in the right place what we
were a bit verbose we have sports files
executables macros can text it as
resources and I mean again the idea here
was to support multiple platforms
multiple executables and so on in DP
three we change this around a bit to
make the path a little shorter but again
the same functionality is available you
can have multiple executables multiple
platforms multiple localizations all the
same functionalities in there so that's
what we did in DP for DP three now you
might look at this and say how do you
support this well those of you who use
an ass bundle know in this bundle is
your friends it will protect you from
all of these all of these changes i
think scott forstall use the shoe shoe
store analogy which which is pretty
appropriate good news isn't DP for we
have not changed the packaging format
and the other good news is project
builder will build for you the new
packaging format by default so you go to
the project builder you create a new
application you build you get content /
mac OS / executable name which is what
you would want which is what the install
that will be the old project builder
project builder whoa does not build the
new format unless you specify this
bundle style key in the make file and
then even then it only builds it when
you do make install so if you're still
using old make files the old project
builder you might want to watch out for
this info.plist the info.plist is again
used by all bundles you've probably
heard about it many times in many
sessions its present in all the app
packages carbon or cocoa it's now an XML
file and the good news is the values for
these now can be directly set in project
builder instead of having to create a
custom info.plist and so on there's an
application settings pane which lets you
set these so some of the update is to
use some of the changes are important to
you as app developers are the CF bundle
name this is the short name for your
application and this is the thing that
appears in the menu bar as your app name
and again if even if your application is
called foo bar XV or if it is called
Adobe Photoshop p.m. version 5 points
for now you should come up with some
short name that allows you to just
clearly show what the app is without
taking up too much room this this string
is also shown in the above panel when
the about panels brought up if you're
using it the CF bundle identifier is a
new key this is again you heard about
this I'm sure its unique identifier Java
style it's one important thing about
this is not only does it uniquely
identify your bundle so you can sort
through the various bundles it will also
be used by user defaults as the app
domain name so I'm so saving user
defaults under the name text edit will
save them under combat Apple dot txt
edit which reduces the chances of
conflicts between various apps and
various companies and finally we have CF
bundle icon file which represents the
icon for your application and this is
now an icns file somewhat icns files
icons I now represent it as icns files I
think there's a session on icns files
and the various services that that
support it icns files have multiple
representations 128 x 128 which we're
seeing required because it's possible
that 120 x 120 icons appear in the
desktop in your dock and so on and you
want you want to look nice we're also
recommending 32 by 32 and I think also
60 miles 16 you can even add that as
well and that might appear in the list
mode and finder so these are Cena's
files have been you know it's actually
been obvious how to create these in the
past I think there are multiple
solutions now one of them which is on
your Mac os10 DP for CD is the icon
composer app which I'll show you then
there's a command-line tool you can take
a multi component tiff file uses
command-line tool and get a
multi-component icns file and there are
some third-party solutions are actually
now out there and they are pretty good
and you would also special in addition
to the apps icons you would also specify
the document icons the same way and you
would specify them in your info.plist ok
so now I'll show your icon composer
slides please
okay so icon composer it's in system
developer applications there you go I'm
supposed to bring up a finder window we
are in our home directory ok so I have a
bunch of images here let's look at this
one there you go that looks like a nice
icon so we'll drag that to this bucket
here now note that because this image is
much bigger than 128 x 128 it asks me
whether it should use a scaled version
and will say yes and it puts it here now
we should also maybe specify this as the
large version the 32 by 32 so let's drag
this one in there as well now you don't
have to do this I'm actually if you're
going to use the same one you don't have
to do this but I'm showing that this one
actually might be a bit too small at 32
by 32 you can't really tell you know
that cute little face so I have another
cat image here if we look at it you'll
see that it's just the head so maybe
we'll drag that one in there there you
go so now we have a nice ens thing icns
file with two components in it let's
save this file in our home directory or
in a documents directory will save it as
cat picture icns now one question that
comes up often as well how do you how do
you use this icon let's go ahead and
also attempt to do that go into project
builder create a new project new Koko
application let's call it test app I'm
not going to do anything to the app
except add an icon well first thing is
we have to go ahead and in our resources
add the file so go to our documents
folder cat picture that icns should be
added to our resources okay now we go
into our targets click on the test app
go to application settings and this is
where you're specifying info.plist keys
and we're simply going to specify that
we want cat pictures icns
to be the icon let's just build let's
see where this goes okay it's done so
let's run this okay so here's our app if
we look in the dock there it is test app
and it has the cute little cat know if I
wasn't that was as expected now I'll
show you one more thing let's go back
into word as we put our test application
where did we put our test application
anybody remember is a document okay oh
no I can't find my test application well
that's like I will find at some point I
just can't oh I can go back into project
builder and oh it's until the test app
oh ok well I think fine there is a
finder is not showing it to us but
that's okay I think you roll learned
okay let's go back to slide ok so the
graphics subsystem the we talked about
the graphics subsystem at last double
double DC and obviously the impact of
removing DPS and putting courts in its
place and a lot of that stuff was
actually fairly well scoped out last
time we have busy apat api's in this
image api's and so on Vlad that stuff is
in place 12 new things that we've added
since then is one is the PDF image rep
which we talked about last time and the
other one is some changes in NS image
that are fairly interesting and as PDF
image rep it is an image rep as you can
imagine it loads and displays PDF images
that's it so it's fairly simple allows
you enough image to do the same you can
set the page number as you know PDF
files can have multiple pages and you
can tell PDF in the drip set page 14 get
the page count as you might expect now
note that each page in a PDF image herb
has it can have a different size so
that's something to watch out for if
you're actually flipping through the
pages
now if you use a PDF in the drip through
NS image and just composite you'll get
only the first page court has the
ability to if you have some backing
store some memory it can composite from
that memory using certain compositing
operations and that's pretty good
because that means if you have some
image that you actually want to
composite you no longer have to create
an index window backing store for it
which is something NS image would do for
you what would occupy extra memory so NS
image will now avoid creating that
backing store window if it can and that
depends on a few few few you know what
compositing mode you're using where the
image came from and so on but it will
avoid creating it will not create that
cash if it can now if you find that this
is impacting your applications because
you are some are relying on it being
cash you can actually do so by calling
lock focus unlock focus first of course
if you call lock focus as an execution
of your application the image will be
cash because that is what you wanted
there are a few other things that will
make it cash which are implicit in the
API but if you find that your
application your images aren't showing
this is one thing you might want to
check into to see whether this caching
is causing that we haven't found any
problems so far but who knows OpenGL is
another new another new feature in in
the DP for and indeed Mac OS 10 so DP
for in DP for OpenGL comes in several
forms server libraries the OpenGL that
framework is the basic OpenGL
functionality all of the OpenGL api's
and so on and I believe these are in
terms of core graphics concepts there's
also a glut that framework for those of
you who know glut glut is the higher
application model for OpenGL
applications glut is actually
implemented using cocoa but because it's
it's own application model if you use
glutes you shouldn't be using cocoa
concepts in such a nap it's basically a
its own complete bill framework for
writing applications there's also the
AGL that framework which is the Apple GL
api's those api's allow a carbon app to
execute OpenGL on both nine and ten
we've added two new classes to the kit
OpenGL view and OpenGL
context opengl view is a subclass of
view for rendering opengl it's fairly
straightforward you can all in such
review you can only do opengl you can't
mix it with 2d at drawing you basically
over i draw rect and in there do opengl
an opengl context is the most more low
level access to the opengl concept there
you can do more stuff with opengl like
create a full screen window and so on
and change and tweak some other
parameters okay i'll show you a quick
demo of this I think those of you who've
been to move into dave sprinklers talkin
opengl might have also seen a similar
demo so let's ride terminal there we
don't want that opengl so we'll run this
application so there you go basically
just a coco application in there's an
opengl view that draws a teapot and you
can with another slider control the
aspects of that teapot you can make it
filled if you want if you want to change
the pattern use color so there you go
fairly straightforward you might ask how
about patterns well this demo doesn't
support that but you saw something quite
powerful with opengl and patterns and
steve demo so there's you can actually
go ahead and do that i thought i would
show you the quote for this close that
ok
okay so there you go it's basically
pretty small applications we have a
subclass of the OpenGL view and it with
frame we're sending a few parameters
with this probably will be on get rid of
the need to do this in the future in a
wake from nib we basically make the
current context and we set some
parameters about OpenGL that we want set
and then these are the target action
method set fill mode basically gets to
fill load and set needs display yes as
you would be doing in 2d drawing that
object color gets the color is convert
star GD properly and then it goes ahead
and sets the color in the OpenGL context
and also then says Seth needs display
set X angle set Y angle I cling to the
sliders we showed you and the draw rect
basically goes ahead and draws either a
solid teapot or a wire teapot based on
the clock setting up the fill flag so
this is a fairly new feature fairly
fresh you know use it let us know how it
works for you and let us know if there
any other additional features or bugs
that your encounter ok slides please ok
so umbrella frameworks you've heard
about umbrella frameworks and other
context I think because the concept
behind umbrella frameworks is to
simplify the developer view of Mac OS
can here's what umbrella frameworks look
like the concept is the concept is
simple if you're writing a BST POSIX
tool you linked against system that
framework if you're writing a tool that
needs to use core foundation or carbon
core in a file manager resource manager
and it's fun a CF bundle I'm sorry so on
you would link against core services
framework which will of course bring in
system application services brings all
of the graphics capabilities and so on
so if you have a back-end server that's
just those graphics but doesn't have any
UI that might be the layer for you
finally if you're a Coco app or a carbon
a few link against one off the top level
frameworks up there now why do they make
such a big deal of umbrella frameworks
well because in reality it turns out
that we have many many frameworks in the
system so here is what we actually what
the situation might look like you know
some break into three
Lincoln 25 some Lincoln 26 actually the
real picture is a lot more complicated
than that so actual contents may vary we
don't we don't want you to link against
app kit or foundation directly we don't
want you to link against the HTML
framework or the hltv toolbox or
quick-draw because those all have bring
in other frameworks it's not clear that
they will bring in the framework step
let's say you bring let's say you link
against a framework which as a side
effect brings another framework it's not
clear that that framework will always
continue bringing that framework so if
you're taking advantage of these
implicit bringing in the framework your
app might crash in a certain update so
here the idea is that these top-level
frameworks have a charter and if you
link against them your application
should continue working no matter how
the contents change so we'd like you to
use this picture now as a cocoa
application you should link against Coco
that framework which is the new
framework the new umbrella framework
cocoa framework and DP for brings with
it apt-get and foundation and it should
also bring in scripting at some point
which will do and that will sir be the
core cocoa frameworks on the system
cocoa also brings in the frameworks blow
it application services and core
services it also brings in some sub
frame works from carbon frame work
because obviously in the implementation
of the app kids rely on some carbon
teachers however we don't bring in all
of that blue box we just bring in some
of the sub frame works so don't rely on
carbon being there in the context of a
cocoa app just some pieces are there so
if you do need to use any carbon API is
that iron carbon that framework also
linked against the carbon that framework
yourself now one thing to watch out for
is name collisions currently we still
have a single we swinging start a single
level main space meaning if any library
defines a function that's the same as a
function we defined in your application
that is an error and the carbon frame
work because of some legacy api's has a
lot of api's which do not have prefixes
and which might actually be fairly
commonly named so if you find your app
not running after you build it on hand
that's one of the things to look at and
you'll usually get a warning from the
loader that this symbol had a collision
so now we'll quickly talk about some
other changes that we've introduced user
default user defaults now sports new
types and that's number and NS State now
one thing to note is before we only have
strings in addition to data array and
dictionary so when you wrote a number
out it would actually be written out as
a string so if you for instance did set
integer 40 and then you called object
for key you would get back in a string
if you happen to assume that was in a
string now that might break this is
probably something most people don't run
into but it's a good morning in any case
the default command has been enhanced
with some of these new options one thing
you can now do is specify host specific
preferences default host hostname will
let you set a preference for a given
host dash current host will let you set
a preference for this current host so
you don't have to know the name now note
that user defaults does not have API to
set or get host-based preferences based
on host we don't think it's a feature
that we widely used it also we don't
think it's necessary to expose that API
however if there is an host specific
thing stored in there for instance as a
result of printing subsystem or whatever
user defaults were correctly fetch it
and give it to you the default command
some of the other enhancements you can
now write dash in dash float dash rule
to explicitly specify the type dash
array allows you to specify arrays as
the values and keys and that's actually
better than trying to remember the
syntax from you know the olden days
another good feature is the array add
which adds to an existing array without
having to repeat all the elements so
these are some pretty nifty features you
can use read types as an option to see
the type of a given key and you can also
say defaults help and will give you all
of the options that are there so text
has a few new features one of them is
the inline as we type spelling checking
now as you can imagine the fuses the
existing mechanisms we had a spelling
checking api's with a possible to plug
in third party spell checkers in the
back end if use exactly the same
mechanism
by default it's off but it just takes
you know calling said continuous spell
check enabled yes to enable in the
context of any text object and you also
have a toggle message you might connect
to a menu item the text system can now
open Mac OS 8 9 simple text documents so
these documents can either be playing or
they can have a resource fork which
indicates attributes on the text so all
of the text storage methods that read
documents will now correctly understand
simple text documents so you can
actually try this in texted it open old
simple text documents now one thing we
don't do is we don't export this format
so you can't save this format if you try
to save you'll be warned you get a
warning that it should be RTF when
you're saving we've also adds a new
method on text to to sort of group
together love to reading functionality
and to be more efficient you specify a
URL to read file from you specify some
options and in return you get back to
info about the document you just read
the thing here is that it can also read
into an existing text storage which is
pretty nice you might not have to tear
down your text storage when you're
loading a document the options
dictionary the second argument can
include the base URL a default character
encoding default attributes and so on so
what this means is let's say you're a
file and you just want to read it you
could specify that it should be assumed
to be Mac Roman however if the Texas and
figures out that was something else it
will use instead now to find out what
encoding it really was it will be
returned to you in the third argument
document attributes and this comes in
handy when you're doing sub stated
encoding handling like texas actually
allows you to do the document attributes
viction airy will also return to the
document type witching which will tell
you whether it goes HTML RTF and so on
and so based on that you can make some
decisions ok input management input
management for Asian keyboards and stuff
you know when you switch to another
input method start typing Japanese that
now goes to the text services manager
which is shared facility under carbon
and cocoa which means the same input
management menu will now work for cocoa
and carbon apps
and you can switch keyboards and stuff
using the same facilities then the good
news here is the Coco api's have not
changed or been impacted so they will
continue working tooltips we now add
features the ability to do finer
granularity tooltips what I mean by that
is as you can see here thank you some
tool to fans out there yeah before you
because I have one tool tip for the
whole view and that was it so now you
can have tool tips on each cells it is
really good you can also have more
dynamic tool tips you can say here's a
wrecked I want to attract tool tips in
this Rex so whenever a tool tip is
supposed to come up meaning the mouse
enters that area in hovers for a while
the owner that specified there will get
a call that the method you see down
below that says give me the string to
show in this tool tip and that allows
you to basically do dynamic tool tips
for instance if the value of that field
is changing or whether you have to load
some key from a localization file this
allows you to delay that and so on so
it's it's fairly fancy okay so that it's
as far as the changes I'm going to talk
about you can refer to the release notes
we have a lot of information in there
the app get that HTML release note which
I open here shows the DP for changes
since dp3 to DP for we also have another
file that's fairly big it contains all
the changes since i believe next step 33
really but you know little summaries in
there it's called app gets pre DP for
that HTML not everything in here is
documented so you might want to scan
through this file backwards to make you
know when you're looking at certain
changes in classes to make sure you
don't miss anything foundation that
htmls also released note that that
refers to foundation changes we also
have examples as you know in systems
offer examples texted and sketch are
pretty up-to-date with lots of new
features so you can for instance look at
text at it as an example of full use of
sheets and so on okay so let's talk a
little bit about upcoming changes so
aqua polish if you went to Don Lindsay's
talk on aqua on Monday he definitely
refer to some areas of aqua that still
need tweaking polish and so on one of
those area is the single window mode
enhance
minutes we have some ideas on how to
make single window mode work better and
if it requires new api's or whatever
will certainly be introducing them as
soon as possible also if you notice
color wells about boxes a few of the
components do not yet have an aqua look
which will be introduced hopefully this
doesn't impact your code at all in any
way also the sheet handling api's we
might have to add sheet handling api's
in a few other places and maybe an S
document also will need to get a few
methods we haven't quite integrated the
whole set yet now the set that's there
should be enough for you to get started
on using sheets now other stuff we're
looking at and this is not coming
necessarily next month or in the next
three months or next update or whatever
but these are in our queue these are
important to us and want to get these to
you at some point more carbon and Java
integration ability to put carbon
widgets carbon panels and cocoa apps
ability to put Java beans for instance
in in cocoa apps these are important and
we're looking at this used to be able to
do this in Mac OS 10 server we now have
a totally new Java infrastructure so we
have to plug into that quicktime NS
movie view is not working in vp for but
that also that will certainly be working
as soon as possible in addition we'll be
looking at other quicktime integrations
for instance for image formats beyond
what NS image can sport we want to go to
cook time and load all the image formats
a QuickTime sports for you XML nibs if
you heard about the carbon sport and ID
we're using XML nibs there we definitely
plan to use that for cocoa applications
as well don't know the time frame
scripting wewe sports scripting and
we're strongly there are certain areas
where we haven't gone into yet record
ability being one of them so we were
certainly thinking about changes in
those areas and better
internationalisation I get this question
often and it's definitely something you
know near and dear my heart I definitely
want to do this basically the ability of
the text system to do bi-directional
text and use more some of the more
advanced features of the apple text
group is on our plate and we plan to
deliver that to you okay so in summary
basically there are a lot of lot of
advancements in cocoa and most of them
you will get for free we talked about
some of those and some require adoption
so you have
do do some work to get those one good
thing is many of the apps and macros can
are written in cocoa and we intend to
keep on going that way because Coco as
you know is giving us a good boost in in
productivity and so on so that's that's
a good good thing for us we're also have
a lot of enhancements an additional
features plan in the future so the group
the cocoa group the people who work on
napkins and foundation group has grown
recently it's highly energized group and
we're really excited about working on
these okay before I go to the roadmap I
have a question who knows what this is
who knows what this is who knows what's
an optical disc for huh this is text
arts by stone design corporation shift
in 1989 i believe
so you know I found this recently and
the amazing thing is you know this ship
I think very soon after next step 10
came out it's a fully you know shrink
wrap I believe it will shrink wrap right
i mean this is pretty predator the
program that came before create anyway
so we'll shrink wrap high-quality you
know nice program and it shipped very
soon after we ship the next system and
you know and despite a media cost of
fifty dollars so anyway and so since you
know this has come out we've got
underground a lot of changes Coco has
you know we've developed it over the
years and especially the last year's
opportunities are now great we have a
lot of Apple technologies quicktime
scripting we're integrating to Coco I
think those are very exciting a lot of
things that weren't able to give you
before and obviously the potential for
obviously potential for the millions of
desktops that Mac os10 will be on some
day I mean that I think that's really
exciting for developers who are doing
you know who's thinking of doing
third-party applications or we're
already doing them who are looking
forward to shipping out the shrink-wrap
version so I know that there are a lot
of you who have been you know doing
thinking of doing third-party
applications or doing vertical
applications and there's some of you who
probably brand-new who are just looking
at coco for first time anyone really
like a round of applause for all of the
cocoa developers who've stuck with us
throughout the years and you just like
watch totoro cuz
no no it's just it's really your energy
get that keeps us going at you know at
apple in the cocoa group and so we're
really excited to see everybody here ok
so the roadmap for sessions that you
might be interested in the cocoa
overview and cocoa and depth those are
the two sessions that basically cover
cocoa basics and some not so basics but
basically for people who haven't
necessarily seen cocoa before it already
happened yesterday the depth is tomorrow
using interface builder tomorrow morning
where we they'll talk about some of the
carbon features and some of the new
features they've added for cocoa the
court session we'll talk about the
courts public API is that you can use
and that's on friday and the aqua
feedback forum is on friday that's
that's likely to be somewhat exciting as
well with various people expressing
their pleasure at aqua ok so what should
i do with the clicker there it is ok ok
and so you can contact David Wright we
also setting up a mailing list cocoa
dash feedback at group that apple com if
you have any feedback or comments about
the API changes an appt Couture
foundation please send mail to that list
I'm in quite verified to set up yet so
don't do it in the next hour but it
should be there in a day or two ok so i
think i'm going to invite the QA team up