Adobe.com
Contents Suites Classes Class Index Member Index

AITool.h

Go to the documentation of this file.
00001 #ifndef __AITool__
00002 #define __AITool__
00003 
00004 /*
00005  *        Name: AITool.h
00006  *      Author:
00007  *        Date:
00008  *     Purpose: Adobe Illustrator Tool Suite.
00009  *
00010  * ADOBE SYSTEMS INCORPORATED
00011  * Copyright 1986-2011 Adobe Systems Incorporated.
00012  * All rights reserved.
00013  *
00014  * NOTICE:  Adobe permits you to use, modify, and distribute this file
00015  * in accordance with the terms of the Adobe license agreement
00016  * accompanying it. If you have received this file from a source other
00017  * than Adobe, then your use, modification, or distribution of it
00018  * requires the prior written permission of Adobe.
00019  *
00020  */
00021 
00022 
00023 /*******************************************************************************
00024  **
00025  **     Imports
00026  **
00027  **/
00028 
00029 #ifndef __AITypes__
00030 #include "AITypes.h"
00031 #endif
00032 
00033 #ifndef __AIArt__
00034 #include "AIArt.h"
00035 #endif
00036 
00037 #ifndef __AIEvent__
00038 #include "AIEvent.h"
00039 #endif
00040 
00041 #ifndef __AIFixedMath__
00042 #include "AIFixedMath.h"
00043 #endif
00044 
00045 #ifndef __AIPlugin__
00046 #include "AIPlugin.h"
00047 #endif
00048 
00049 #ifndef __AIToolNames__
00050 #include "AIToolNames.h"
00051 #endif
00052 
00053 
00054 #ifndef __ASHelp__
00055 #include "ASHelp.h"
00056 #endif
00057 
00058 #ifndef __AIColor__
00059 #include "AIColor.h"
00060 #endif
00061 
00062 #ifndef FLT_MAX
00063 #include <float.h>
00064 #endif
00065 
00066 #include "AIHeaderBegin.h"
00070 /*******************************************************************************
00071  **
00072  ** Constants
00073  **
00074  **/
00075 
00076 #define kAIToolSuite                    "AI Tool Suite"
00077 #define kAIToolSuiteVersion16   AIAPI_VERSION(16)
00078 #define kAIToolSuiteVersion             kAIToolSuiteVersion16
00079 #define kAIToolVersion                  kAIToolSuiteVersion
00080 
00086 #define kAIEffectiveToolChangedNotifier                 "AI Effective Tool Changed Notifier"
00087 
00091 #define kAIUserToolChangedNotifier              "AI User Tool Changed Notifier"
00092 
00097 #define kAIToolSelectedNotifier                 "AI Tool Selected Notifier"
00098 
00100 #define kAIToolDeselectedNotifier               "AI Tool Deselected Notifier"
00101 
00104 #define kAIInvalidateByScrollNotifier           "AI Invalidate By Scroll Notifier"
00105 
00111 #define kAIToolClearStateNotifier               "AI Tool Clear State Notifier"
00112 
00115 #define kAIToolTitleChangedNotifier             "AI Tool Title Changed Notifier"
00116 
00118 #define kAIToolTooltipChangedNotifier   "AI Tool Tooltip Changed Notifier"
00119 
00121 #define kAIToolHelpIDChangedNotifier    "AI Tool Help ID Changed Notifier"
00122 
00124 #define kAIToolIconChangedNotifier      "AI Tool Icon Resources Changed Notifier"
00125 
00127 #define kAIToolChangedNotifier                  "AI Tool Changed Notifier"
00128 
00130 #define kAIToolWindowChangedNotifier    "AI Tool Window Changed Notifier"
00131 
00133 #define kAIToolSuspendNotifier                  "AI Tool Suspend Notifier"
00134 
00136 #define kAIToolResumeNotifier                   "AI Tool Resume Notifier"
00137 
00139 #define kAIToolTabletPointerTypeChangedNotifier "AI Tablet Pointer Type Changed Notifier"
00140 
00142 #define kAIToolModifiersChangedNotifier "AI Tool Modifiers Changed Notifier"
00143 
00147 #define kAIToolSuspendedBySpacebarNotifier      "AI Tool Suspended by Spacebar Notifier"
00148 
00151 #define kAIToolResumedBySpacebarNotifier        "AI Tool Resumed by Spacebar Notifier"
00152 
00159 #define kAIToolSuspendedByCmdKeyNotifier        "AI Tool Suspended by Cmd Key Notifier"
00160 
00165 #define kAIToolResumedByCmdKeyNotifier  "AI Tool Resumed by Cmd Key Notifier"
00166 
00167 
00168 // Notifiers sent by built-in tools
00169 
00174 #define kAIEyedropperDragNotifier               "AI Eyedropper Drag Notifier"
00175 
00178 #define kCallerAITool                                   "AI Tool"
00179 
00184 #define kSelectorAIEditToolOptions              "AI Edit Options"
00185 
00189 #define kSelectorAITrackToolCursor              "AI Track Cursor"
00190 
00193 #define kSelectorAIToolMouseDown                "AI Mouse Down"
00194 
00198 #define kSelectorAIToolMouseDrag                "AI Mouse Drag"
00199 
00203 #define kSelectorAIToolMouseUp                  "AI Mouse Up"
00204 
00207 #define kSelectorAISelectTool                   "AI Select"
00208 
00211 #define kSelectorAIDeselectTool                 "AI Deselect"
00212 
00216 #define kSelectorAIReselectTool                 "AI Reselect"
00217 
00219 #define kSelectorAIToolDecreaseDiameter "AI Decrease Diameter"
00220 
00222 #define kSelectorAIToolIncreaseDiameter "AI Increase Diameter"
00223 
00232 #define kSelectorAIAlternateSelectionToolQuery  "AI Alternate Selection Tool Query"
00233 
00238 #define kSelectorAIAlternateSelectionToolActivate "AI Alternate Selection Tool Activate"
00239 
00243 #define kSelectorAIAlternateSelectionToolDeActivate "AI Alternate Selection Tool DeActivate"
00244 
00248 #define kAcceptAlternateSelectionToolReply              'ASTR'
00249 
00254 #define kSelectorAIToolDrawDryInk                       "AI Tool Draw Dry Ink"
00255 
00256 //  Brush tools share these options, so if you add new ones,
00257 //      make sure they do not overlap with the brush tool options defined in
00258 //      AIBrushMgr.h, which start at 1L<<16 and go up.
00259 
00262 enum AIToolOptions {
00266         kToolWantsToTrackCursorOption           = (1<<0),
00271         kToolDoesntWantAutoScrollOption         = (1<<1),
00279         kToolWantsBufferedDraggingOption        = (1<<2),
00284         kToolMaintainEditContextOption          = (1<<3),
00287         kToolIsTextToolOption                           = (1<<4),
00291         kToolWantsToChangeDiameterOption                                = (1<<5),
00297         kToolWantsAlternateSelectionTool        = (1<<6),
00298 
00306         kToolWantsHiddenToolOption   = (1<<7),
00307 
00311         kToolDoesntWantSoftSelectionOption   = (1<<8),
00312 
00315         kToolWantsOSHandleInk = (1<<9)
00316 
00317 };
00318 
00319 
00330 enum AIToolInfoVariable {
00331         kInfoPageX = 0,
00332         kInfoPageY,
00333         kInfoSizeX,
00334         kInfoSizeY,
00335         kInfoDistance,
00336         kInfoVectorAngle,
00337         kInfoScaleX,
00338         kInfoScaleY,
00339         kInfoZoom,
00340         kInfoCornerRoundness,
00341         kInfoRotAngle,
00342         kInfoShearAngle,
00343         kInfoFontAndSize,
00344         kInfoTrackOrKern,
00345         kInfoRawRotAngle,
00346         kInfoDocX,
00347         kInfoDocY,
00348         kInfoText1,
00349         kInfoText2,
00350         kInfoText3,
00351         kInfoText4,
00352         kInfoText5,
00353         kInfoText6,
00354         kInfoLongText3,
00356         kInfoTextX,
00357         kInfoTextY,
00358         kInfoTextW,
00359         kInfoTextH,
00360 
00361         kInfoNumVars,
00362         kInfoBlank,
00363 
00364         // new in AI 12
00365         kInfoTextUnicode1,
00366         kInfoTextUnicode2,
00367         kInfoTextUnicode3,
00368         kInfoTextUnicode4,
00369         kInfoTextUnicode5,
00370         kInfoTextUnicode6,
00371         kInfoLongTextUnicode1,
00372         kInfoLongTextUnicode2,
00373         kInfoLongTextUnicode3,
00374 
00375         // overlayed items.
00376         kInfoLongText1 = kInfoFontAndSize,
00377         kInfoLongText2 = kInfoTrackOrKern,
00378 
00379 
00380         kInfoEndOfList = -1      // Use this to terminate the infoVars list
00381 };
00382 
00385 #define kNoTool -2
00386 
00389 typedef short AIToolType;
00390 
00394 #define kPluginToolOffset 1000
00395 
00398 #define kToolCantTrackCursorErr         'TLTK'
00399 
00400 //ToolTime for GetToolNullEventInterval. This type is to be deprecated ASAP.
00401 // <<LET ME KNOW IF THIS DOESN'T HAPPEN>>
00402 typedef double AIToolTime; //Time in Seconds
00403 
00404 #define kToolTimeDurationSecond            ((AIToolTime)1.0)
00405 #define kToolTimeDurationMillisecond       ((AIToolTime)(kToolTimeDurationSecond/1000))
00406 #define kToolTimeDurationNoWait            ((AIToolTime)0.0)
00407 #define kToolTimeDurationForever           ((AIToolTime)(-1.0))
00408 
00409 #define kToolNormalIconDictKey                          "ToolNormalIconDictKey"
00410 #define kToolDarkNormalIconDictKey                      "ToolDarkNormalIconDictKey"
00411 
00412 
00413 /*******************************************************************************
00414  **
00415  ** Types
00416  **
00417  **/
00418 
00421 typedef struct _t_AIToolOpaque *AIToolHandle;
00422 
00425 struct AIEffectiveToolChangeData
00426 {
00428         const char*                     currentToolName;
00430         const char*                     lastToolName;
00434         AIBoolean                       isToolChangeTemporary;
00437         AIToolHandle            currentToolHandle;
00441         AIToolHandle            lastToolHandle;
00442 };
00443 
00445 struct AIAddToolData {
00447         const char *title;
00449         const char *tooltip;
00451         ASHelpID helpID;
00453         ai::uint32 normalIconResID;
00455         ai::uint32 darkIconResID;
00459         AIToolType sameGroupAs;
00463         AIToolType sameToolsetAs;
00464 };
00465 
00467 typedef struct _AIDataStack *AIDataStackRef;
00468 
00470 struct AIAddToolDataPrivate {
00472         const char *title;
00474         const char *tooltip;
00476         ASHelpID helpID;
00478         AIDataStackRef iconResourceDictionary;
00482         AIToolType sameGroupAs;
00486         AIToolType sameToolsetAs;
00487 };
00488 
00491 typedef ai::int16 AIToolTabletPointerType;
00492 
00495 enum AIToolTabletPointerTypeValue
00496 {
00497         kAIToolTabletPointerTypeUnknown = 0,
00499         kAIToolTabletPointerTypePen,
00501         kAIToolTabletPointerTypeCursor,
00503         kAIToolTabletPointerTypeEraser
00504 };
00505 
00508 typedef ai::int16 AIToolPressure;
00511 enum AIToolPressureValue
00512 {
00514         kAIMaxToolPressure = 255,
00516         kAIMinToolPressure = 0,
00518         kAINormalToolPressure = 127
00519 };
00520 
00523 typedef ai::int16 AIToolAngle;
00526 enum AIToolAngleValue
00527 {
00529         kAIToolAngle0 = 0,
00530         kAIToolAngle90 = 90,
00531         kAIToolAngleNegative179 = -179,
00532         kAIToolAngle180 = 180,
00533         kAIToolAngle360 = 360,
00534 
00536         kAIToolMinBearing = kAIToolAngleNegative179,
00537         kAIToolMaxBearing = kAIToolAngle180,
00538         kAIToolNormalBearing = kAIToolAngle0,
00539 
00541         kAIToolMinRotation = kAIToolAngleNegative179,
00542         kAIToolMaxRotation = kAIToolAngle180,
00543         kAIToolNormalRotation = kAIToolAngle0,
00544 
00547         kAIToolMinTilt = kAIToolAngle0,
00548         kAIToolMaxTilt = kAIToolAngle90,
00549         kAIToolNormalTilt = kAIToolMinTilt
00550 };
00553 enum AITabletCapabilities
00554 {
00555         /* X-coordinate in the tablet coordinate space. */
00556         kXCoordinate                    =               1 << 0,
00557         /* Y-coordinate in the tablet coordinate space. */
00558         kYCoordinate                    =               1 << 1,
00559         /* Z-coordinate or the distance of the pen tip from the tablet. */
00560         kZCoordinate                    =               1 << 2,
00561         /* Pressure of pen tip perpendicular to tablet surface. */
00562         kNormalPressure                 =               1 << 3,
00563         /* Pressure of the pen tip along the plane of the tablet surface. */
00564         kTangentPressure                =               1 << 4,
00565         /* Angle between the axis of pen and the surface of the tablet. */
00566         kAltitudeOrientation    =               1 << 5,
00567         /* Clockwise rotation of the cursor around the z-axis through a full circular range. */
00568         kAzimuthOrientation             =               1 << 6,
00569         /* Clockwise rotation of the cursor around its own axis. */
00570         kTwistOrientation               =               1 << 7
00571 };
00572 
00573 
00574 enum AIToolMessageFlags
00575 {
00576         /*Indicates that it is a simulated Tool Message of InkStrokes*/
00577         kAIToolMsgInkSimulationFlag     =               1 << 0
00578 };
00579 
00581 struct AIEventHistoryData
00582 {
00584         AIPoint position;
00586         AIToolPressure stylusWheel;
00588         AIToolAngle tilt;
00590         AIToolAngle bearing;
00592         AIToolAngle rotation;
00593 };
00595 struct AIToolMessage {
00597         SPMessageData d;
00602         AIToolHandle tool;
00604         AIRealPoint cursor;
00608         AIToolPressure pressure;
00611         AIEvent *event;
00613         AIToolPressure stylusWheel;
00615         AIToolAngle tilt;
00617         AIToolAngle bearing;
00619         AIToolAngle rotation;
00620         
00622         ai::int32       flags;
00624         ai::AutoBuffer<AIEventHistoryData> eventHistoryData;
00625 };
00626 
00628 struct AIToolNotifyData {
00631         AIToolHandle tool;
00632 };
00633 
00635 struct AIEyedropperDragNotifyData {
00637         AIEvent event;
00639         AIBoolean pathStyleChanged;
00640 };
00641 
00642 struct AIDocumentInkParams
00643 {
00644         enum PenTipShape
00645         {
00646                 kPenTipShapeCircle,
00647                 kPenTipShapeRectangle
00648         };
00649         PenTipShape fShape;
00650         AIColor fColor;
00651         AIPoint fSize;
00652 
00653         AIDocumentInkParams() :fShape(kPenTipShapeCircle)
00654         {
00655                 fColor.kind = kThreeColor;
00656                 fColor.c.rgb.red = 0.0f;
00657                 fColor.c.rgb.green = 0.0f;
00658                 fColor.c.rgb.blue = 0.0f;
00659                 fSize.h = 1;
00660                 fSize.v = 1;
00661         }
00662 };
00663 
00664 
00665 struct AIDocumentInkPoint
00666 {
00667         AIRealPoint              fLocation;
00668         AIToolPressure   fPressure;
00669         AIToolPressure   fStylusWheel;
00670         AIToolAngle              fRotation;
00671         AIToolPressure   fBearing;
00672         AIToolPressure   fTilt;
00673 
00674         AIDocumentInkPoint()
00675         {
00676                 fLocation.h = 0.0;
00677                 fLocation.v = 0;
00678                 fPressure = 0;
00679                 fStylusWheel = kAIToolMinRotation;
00680                 fBearing = kAIToolMinBearing;
00681                 fRotation = kAIToolMinRotation;
00682                 fTilt = kAIToolMinTilt;
00683         }
00684 };
00685 
00687 struct AIToolDryInkMessage {
00689         SPMessageData d;
00694         AIToolHandle tool;
00695 
00697         AIEvent *event;
00698 
00699         ai::AutoBuffer<AIDocumentInkPoint> inkStrokes;
00700 
00701         AIToolDryInkMessage() :tool(0), event(nil)
00702         {}
00703 };
00704 
00705 
00706 /*******************************************************************************
00707  **
00708  **     Suite
00709  **
00710  **/
00711 
00809 struct AIToolSuite {
00810 
00821         AIAPI AIErr (*AddTool) ( SPPluginRef self, const char *name,
00822                                 AIAddToolData *data, ai::int32 options,
00823                                 AIToolHandle *tool );
00824 
00826         AIAPI AIErr (*AddToolPrivate) ( SPPluginRef self, const char *name,
00827                 AIAddToolDataPrivate *data, ai::int32 options,
00828                 AIToolHandle *tool );
00829 
00836         AIAPI AIErr (*GetToolName) ( AIToolHandle tool, char **name );
00837 
00845         AIAPI AIErr (*GetToolOptions) ( AIToolHandle tool, ai::int32 *options );
00846 
00853         AIAPI AIErr (*SetToolOptions) ( AIToolHandle tool, ai::int32 options );
00854 
00860         AIAPI AIErr (*GetToolPlugin) ( AIToolHandle tool, SPPluginRef *plugin );
00861 
00868         AIAPI AIErr (*GetSelectedTool) ( AIToolHandle *tool );
00869 
00875         AIAPI AIErr (*SetSelectedTool) ( AIToolHandle tool );
00876 
00881         AIAPI AIErr (*CountTools) ( ai::int32 *count );
00882 
00888         AIAPI AIErr (*GetNthTool) ( ai::int32 n, AIToolHandle *tool );
00889 
00898         AIAPI AIErr (*GetToolHandleFromNumber) ( AIToolType toolNum,  AIToolHandle *tool );
00899 
00907         AIAPI AIErr (*GetToolNumberFromName) ( const char *name, AIToolType *toolNum );
00908 
00914         AIAPI AIErr (*GetToolNumberFromHandle) ( AIToolHandle tool, AIToolType *toolNum );
00915 
00922         AIAPI AIErr (*GetToolNameFromNumber) ( AIToolType toolNum, char **name );
00923 
00930         AIAPI AIErr (*GetToolTitle) ( AIToolHandle tool, char **title );
00931 
00936         AIAPI AIErr (*SetToolTitle) ( AIToolHandle tool, const char *title );
00937 
00938 
00944         AIAPI AIErr (*GetTooltip) ( AIToolHandle tool, char **tooltip );
00945 
00950         AIAPI AIErr (*SetTooltip) ( AIToolHandle tool, const char *tooltip );
00951 
00957         AIAPI AIErr (*GetToolHelpID) ( AIToolHandle tool, ASHelpID *helpID );
00958 
00963         AIAPI AIErr (*SetToolHelpID) ( AIToolHandle tool, ASHelpID helpID );
00964 
00974         AIAPI AIErr (*SetToolInfoVars) ( AIToolHandle tool, const ai::int32 infoVars[] );
00975 
01011         AIAPI AIErr (*SetToolInfoVarValues) ( const ai::int32 *infoVars,  void **values );
01012 
01018         AIAPI AIErr (*SystemHasPressure) ( AIBoolean *hasPressure );
01019 
01020         // New for AI10
01021 
01023         AIAPI AIErr (*GetToolNullEventInterval) (AIToolHandle tool, AIToolTime *outTime);
01024 
01026         AIAPI AIErr (*SetToolNullEventInterval) (AIToolHandle tool, AIToolTime inTime);
01027 
01028         // New for AI13
01029 
01036         AIAPI AIErr (*SetSoftSelectedTool) ( AIToolHandle tool );
01037 
01045         AIAPI AIErr (*IsSoftModeSelection) ( AIBoolean *isSoftMode );
01046 
01053         AIAPI AIErr (*GetAlternateSelectionToolName) (AIToolHandle tool, char **name);
01054 
01061         AIAPI AIErr (*SetAlternateSelectionToolName) (AIToolHandle tool, const char* alternateTool);
01062 
01063         // New for AI16: support for plug-in access to built-in tools
01064 
01071         AIAPI AIErr (*GetCurrentToolName) ( const char **name );
01072 
01078         AIAPI AIErr(*GetCurrentEffectiveToolName) (const char **name);
01079 
01088         AIAPI AIToolType (*GetLastUsedSelectionTool) ( const char **name );
01089 
01094         AIAPI AIErr (*SetSelectedToolByName) ( const char *name );
01095 
01101         AIAPI AIErr (*GetTabletHardwareCapabilities) ( ai::int32* hardwareCapabilities );
01102 
01108         AIAPI AIErr (*SetToolIcons) (AIToolHandle tool, const char *normalIconResourceName, const char *darkNormalIconResourceName);
01109 
01115         AIAPI AIErr(*GetToolIcons) (const AIToolHandle tool, char **normalIconResourceName, char **darkNormalIconResourceName);
01116 
01119         AIAPI AIErr(*SetDocumentInkParams)(const AIToolHandle tool, const AIDocumentInkParams& inDocInkParams);
01120 };
01121 
01122 
01123 #include "AIHeaderEnd.h"
01124 
01125 
01126 #endif


Contents Suites Classes Class Index Member Index
Adobe Solutions Network
 
Copyright © 2016 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks