(no subject)
(no subject)
- Subject: (no subject)
- From: Raleigh Ledet <email@hidden>
- Date: Thu, 26 Jan 2006 14:53:06 -0800
Ricky, you are correct. The Ink API is only available through Carbon.
The only other ink aware application that I know of is inkBook
<http://www.magesw.com/inkbook>. I know inkBook is a cocoa app with
cocoa wrappers around the carbon ink API. If you do ANY work with the
Ink API, please be sure to file a feature request <http://
radar.apple.com> with Apple for native Cocoa support for the Ink API.
That said, here are some interesting facts about Cocoa, Tablets, and
Ink.
1) Besides pressures, Tablet data is not native to Cocoa until
10.4.0. Wacom has provided a helper class to work around this problem
and it can be found here: <http://www.wacomeng.com/devsupport/
mac.html> Go to the Samples and Downloads section and look at the
Cocoa Complex sample code. Feel free to email me any specific Tablet
Questions.
2) The Wacom Tablet driver has a "Toggle Ink" option that users can
set their side switches to. This will Toggle the "Ink Anywhere"
feature on and off globally.
3) If Ink is turned on, then the user must have had either a Tablet
or some other Ink Aware device attached to their system at some point
in time. We know this because the Ink Preference pane does not
display unless Ink is on, or an Ink Aware device is currently
attached to the system. This should be good enough to hide / show Ink
specific features.
4) Tablet Proximity events are a good way to see if the user is using
a tablet device. However, you may not get a proximity event after
your app is launched until the user takes the pen out of proximity
and back into proximity. If you see a proximity event and Ink is
turned off, then you may want to inform the user of your additional
features and direct them on how to turn ink on (offer to open the Ink
Pref pane for them).
5) Just because you get a proximity event, it does not mean that the
user is using a pen. Wacom mice, for example, also output proximity
data and tablet data. Ink does not handle tablet devices in relative
mode well and mice are generally in relative mode. If you are an ink
aware application, you may want to prevent Wacom mice from inking.
The type of transducer on the tablet can be determined by looking at
the pointerType of a proximity event. You also use the pointerType to
determine if the user is using the eraser end of a pen. (If you are
going to be Ink aware, be tablet aware and respect the eraser please.)
6) As you've discovered, the settings you make using the Ink API only
affect your application. And, they will also override any "Ink
Toggle" action described in 2 above. The idea is that the user can
turn Ink on, but turn Ink Anywhere off and your app will still work.
7) You become an Ink Aware application by calling
InkSetApplicationWritingMode (). Once you become an ink aware
application, you have complete control over ink anywhere while your
app is in the foreground. You determine if Inking is allowed or not
with the folowing: kInkWriteAnywhereInApp vs kInkWriteNowhereInApp.
Note: these two enums are dramatically different than
kInkWriteAnywhere and kInkWriteNowhere. The former set are used with
InkSetApplicationWritingMode() and the latter set results from
InkUserWritingMode() along with kInkWriteInInkAwareAppsOnly.
8) The only thing your app doesn't have control over is whether Ink
is actually on or off. If Ink is off, then the user will not be able
to ink.
9) Once you become an Ink Aware application, you remain one. If you
would like to rescind your app's ink aware status, file a Radar
request for this feature to be added to the Ink API.
10) There is one other way to control ink regardless of your ink
aware status. When a mouse down occurs, Ink sends an
kEventApplicationIsEventInInstantMouser event. In Cocoa, this is done
via the NSResponder's -shouldBeTreatedAsInkEvent: method. If you
return No from this NSResponder method, inking will not occur
regardless of the user's "Ink anywhere" setting or the application's
InkSetApplicationWritingMode() setting.
11) Once you set your app to kInkWriteAnywhereInApp, the user can Ink
anywhere in your app, even outside your app's windows! (respecting
the shouldBeTreatedAsInkEvent: method results of coarse). This may or
may not be the behavior you want. If it is great. If not, then you
must be a little more clever with your code. For example, inkBook
only allows you to ink in the lined area of the document window. From
what I gather, this is done by setting up NSTrackingRects and calling
InkSetApplicationWritingMode() with kInkWriteAnywhere, or
kInkWriteNowhere depending on the cursor moving in and out of
inkBook's "Inking" tracking Rect.
12) If you are an ink aware app, don't forget about Gestures!
13) Ink only works horizontally. The more vertical the word, the
worse the recognition accuracy.
14) There is no mechanism to provide training feedback to Ink.
15) There is no mechanism to provide ink with hints as to the type of
data to expect. For example, numbers, or a web address.
16) There is no mechanism (plugin architecture) to extend Ink's
recognition engine. Thus you can not write a recognition plugin to
recognize Japanese, or Math Symbols, or basic objects (circle,
square, start etc.).
17) File bugs and enhancement requests. This is perhaps the biggest
bit of advice I can give. If the Ink API is not letting you do what
you need to do, then let Apple know. The Ink API is still very young.
The more feedback we give Apple, the faster it will improve.
Wow, this turned out to be really long. Apologies.
raleigh
I have an application that I have been testing with Ink, and it
works fine, except that you need to switch between the "Write
Anywhere" mode and the cursor mode quite often, so when the user
has a tablet connected, I want to show them an extra item (probably
on the context menu) to change modes.
In the documentation I see lots of stuff about responding to events
etc, but I can't see the things I am looking for:
1. How do I know that they have a tablet connected?
2. How do I tell Ink to switch from Write Anywhere on to off and
back again?
I am targeting 10.3.9+
Your best shot at this would be to look at the Carbon APIs. I know
there are APIs to at least set the Ink modes as I use these in my app:
InkSetApplicationRecognitionMode
InkSetApplicationWritingMode
For the handling of Ink events, I also use Carbon (Carbon Event
APIs). There may be some event you can handle that would occur when
tablets are connected/disconnected.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
- Follow-Ups:
- Re: Ink
- From: Ricky Sharp <email@hidden>