Adobe.com
Contents Suites Classes Class Index Member Index

AITool.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 /*
00004  *        Name: AITool.h
00005  *      Author:
00006  *        Date:
00007  *     Purpose: Adobe Illustrator Tool Suite.
00008  *
00009  * ADOBE SYSTEMS INCORPORATED
00010  * Copyright 1986-2017 Adobe Systems Incorporated.
00011  * All rights reserved.
00012  *
00013  * NOTICE:  Adobe permits you to use, modify, and distribute this file
00014  * in accordance with the terms of the Adobe license agreement
00015  * accompanying it. If you have received this file from a source other
00016  * than Adobe, then your use, modification, or distribution of it
00017  * requires the prior written permission of Adobe.
00018  *
00019  */
00020 
00021 
00022 /*******************************************************************************
00023  **
00024  **     Imports
00025  **
00026  **/
00027 
00028 #include "AITypes.h"
00029 #include "AIArt.h"
00030 #include "AIEvent.h"
00031 #include "AIFixedMath.h"
00032 #include "AIPlugin.h"
00033 #include "AIToolNames.h"
00034 #include "ASHelp.h"
00035 #include "AIColor.h"
00036 
00037 #ifndef FLT_MAX
00038 #include <float.h>
00039 #endif
00040 
00041 #include "AIHeaderBegin.h"
00042 
00046 /*******************************************************************************
00047  **
00048  ** Constants
00049  **
00050  **/
00051 
00052 #define kAIToolSuite                    "AI Tool Suite"
00053 #define kAIToolSuiteVersion19   AIAPI_VERSION(19)
00054 #define kAIToolSuiteVersion             kAIToolSuiteVersion19
00055 #define kAIToolVersion                  kAIToolSuiteVersion
00056 
00064 #define kAIEffectiveToolChangedNotifier                 "AI Effective Tool Changed Notifier"
00065 
00069 #define kAIUserToolChangedNotifier              "AI User Tool Changed Notifier"
00070 
00075 #define kAIToolSelectedNotifier                 "AI Tool Selected Notifier"
00076 
00078 #define kAIToolDeselectedNotifier               "AI Tool Deselected Notifier"
00079 
00082 #define kAIInvalidateByScrollNotifier           "AI Invalidate By Scroll Notifier"
00083 
00089 #define kAIToolClearStateNotifier               "AI Tool Clear State Notifier"
00090 
00093 #define kAIToolTitleChangedNotifier             "AI Tool Title Changed Notifier"
00094 
00096 #define kAIToolTooltipChangedNotifier   "AI Tool Tooltip Changed Notifier"
00097 
00099 #define kAIToolHelpIDChangedNotifier    "AI Tool Help ID Changed Notifier"
00100 
00102 #define kAIToolIconChangedNotifier      "AI Tool Icon Resources Changed Notifier"
00103 
00105 #define kAIToolChangedNotifier                  "AI Tool Changed Notifier"
00106 
00108 #define kAIToolWindowChangedNotifier    "AI Tool Window Changed Notifier"
00109 
00111 #define kAIToolSuspendNotifier                  "AI Tool Suspend Notifier"
00112 
00114 #define kAIToolResumeNotifier                   "AI Tool Resume Notifier"
00115 
00117 #define kAIToolTabletPointerTypeChangedNotifier "AI Tablet Pointer Type Changed Notifier"
00118 
00120 #define kAIToolModifiersChangedNotifier "AI Tool Modifiers Changed Notifier"
00121 
00125 #define kAIToolSuspendedBySpacebarNotifier      "AI Tool Suspended by Spacebar Notifier"
00126 
00129 #define kAIToolResumedBySpacebarNotifier        "AI Tool Resumed by Spacebar Notifier"
00130 
00137 #define kAIToolSuspendedByCmdKeyNotifier        "AI Tool Suspended by Cmd Key Notifier"
00138 
00143 #define kAIToolResumedByCmdKeyNotifier  "AI Tool Resumed by Cmd Key Notifier"
00144 
00145 
00146 // Notifiers sent by built-in tools
00147 
00152 #define kAIEyedropperDragNotifier               "AI Eyedropper Drag Notifier"
00153 
00157 #define kCallerRadialDevice                             "AI Radial Device"
00158 
00162 #define kSelectorAIRadialDeviceRotated  "Radial Device Rotated"
00163 
00167 #define kSelectorAIRadialDeviceClicked  "Radial Device Clicked"
00168 
00171 #define kCallerAITool                                   "AI Tool"
00172 
00177 #define kSelectorAIEditToolOptions              "AI Edit Options"
00178 
00182 #define kSelectorAITrackToolCursor              "AI Track Cursor"
00183 
00186 #define kSelectorAIToolMouseDown                "AI Mouse Down"
00187 
00191 #define kSelectorAIToolMouseDrag                "AI Mouse Drag"
00192 
00196 #define kSelectorAIToolMouseUp                  "AI Mouse Up"
00197 
00200 #define kSelectorAISelectTool                   "AI Select"
00201 
00204 #define kSelectorAIDeselectTool                 "AI Deselect"
00205 
00209 #define kSelectorAIReselectTool                 "AI Reselect"
00210 
00212 #define kSelectorAIToolDecreaseDiameter "AI Decrease Diameter"
00213 
00215 #define kSelectorAIToolIncreaseDiameter "AI Increase Diameter"
00216 
00225 #define kSelectorAIAlternateSelectionToolQuery  "AI Alternate Selection Tool Query"
00226 
00231 #define kSelectorAIAlternateSelectionToolActivate "AI Alternate Selection Tool Activate"
00232 
00236 #define kSelectorAIAlternateSelectionToolDeActivate "AI Alternate Selection Tool DeActivate"
00237 
00241 #define kAcceptAlternateSelectionToolReply              'ASTR'
00242 
00247 #define kSelectorAIToolDrawDryInk                       "AI Tool Draw Dry Ink"
00248 
00249 //  Brush tools share these options, so if you add new ones,
00250 //      make sure they do not overlap with the brush tool options defined in
00251 //      AIBrushMgr.h, which start at 1L<<16 and go up.
00252 
00255 enum AIToolOptions {
00259         kToolWantsToTrackCursorOption           = (1<<0),
00264         kToolDoesntWantAutoScrollOption         = (1<<1),
00272         kToolWantsBufferedDraggingOption        = (1<<2),
00277         kToolMaintainEditContextOption          = (1<<3),
00280         kToolIsTextToolOption                           = (1<<4),
00284         kToolWantsToChangeDiameterOption                                = (1<<5),
00290         kToolWantsAlternateSelectionTool        = (1<<6),
00291 
00299         kToolWantsHiddenToolOption   = (1<<7),
00300 
00304         kToolDoesntWantSoftSelectionOption   = (1<<8),
00305 
00308         kToolWantsOSHandleInk = (1<<9),
00309 
00312         kToolHasAlternateAction = (1<<10),
00313 
00316         kToolWantsRadialDeviceEvents = (1 << 11),
00317 
00320         kToolDoesntWantArtStyleExecutionSuspender = (1 << 12),
00321 
00324         kToolHasItsOwnDragLoop = (1 << 13)
00325 
00326 };
00327 
00328 
00339 enum AIToolInfoVariable {
00340         kInfoPageX = 0,
00341         kInfoPageY,
00342         kInfoSizeX,
00343         kInfoSizeY,
00344         kInfoDistance,
00345         kInfoVectorAngle,
00346         kInfoScaleX,
00347         kInfoScaleY,
00348         kInfoZoom,
00349         kInfoCornerRoundness,
00350         kInfoRotAngle,
00351         kInfoShearAngle,
00352         kInfoFontAndSize,
00353         kInfoTrackOrKern,
00354         kInfoRawRotAngle,
00355         kInfoDocX,
00356         kInfoDocY,
00357         kInfoText1,
00358         kInfoText2,
00359         kInfoText3,
00360         kInfoText4,
00361         kInfoText5,
00362         kInfoText6,
00363         kInfoLongText3,
00365         kInfoTextX,
00366         kInfoTextY,
00367         kInfoTextW,
00368         kInfoTextH,
00369 
00370         kInfoNumVars,
00371         kInfoBlank,
00372 
00373         // new in AI 12
00374         kInfoTextUnicode1,
00375         kInfoTextUnicode2,
00376         kInfoTextUnicode3,
00377         kInfoTextUnicode4,
00378         kInfoTextUnicode5,
00379         kInfoTextUnicode6,
00380         kInfoLongTextUnicode1,
00381         kInfoLongTextUnicode2,
00382         kInfoLongTextUnicode3,
00383 
00384         // overlayed items.
00385         kInfoLongText1 = kInfoFontAndSize,
00386         kInfoLongText2 = kInfoTrackOrKern,
00387 
00388 
00389         kInfoEndOfList = -1      // Use this to terminate the infoVars list
00390 };
00391 
00394 #define kNoTool -2
00395 
00398 typedef ai::int16 AIToolType;
00399 
00403 #define kPluginToolOffset 1000
00404 
00407 #define kToolCantTrackCursorErr         'TLTK'
00408 
00409 //ToolTime for GetToolNullEventInterval. This type is to be deprecated ASAP.
00410 // <<LET ME KNOW IF THIS DOESN'T HAPPEN>>
00411 typedef double AIToolTime; //Time in Seconds
00412 
00413 #define kToolTimeDurationSecond            ((AIToolTime)1.0)
00414 #define kToolTimeDurationMillisecond       ((AIToolTime)(kToolTimeDurationSecond/1000))
00415 #define kToolTimeDurationNoWait            ((AIToolTime)0.0)
00416 #define kToolTimeDurationForever           ((AIToolTime)(-1.0))
00417 
00418 #define kToolNormalIconDictKey                          "ToolNormalIconDictKey"
00419 #define kToolDarkNormalIconDictKey                      "ToolDarkNormalIconDictKey"
00420 
00421 
00422 /*******************************************************************************
00423  **
00424  ** Types
00425  **
00426  **/
00427 
00430 typedef struct _t_AIToolOpaque *AIToolHandle;
00431 
00434 struct AIEffectiveToolChangeData
00435 {
00437         const char*                     currentToolName;
00439         const char*                     lastToolName;
00443         AIBoolean                       isToolChangeTemporary;
00446         AIToolHandle            currentToolHandle;
00450         AIToolHandle            lastToolHandle;
00452         AIToolType                      currentToolNum;
00454         AIToolType                      lastToolNum;
00455 };
00456 
00458 struct AIAddToolData {
00460     ai::UnicodeString title;
00462     ai::UnicodeString tooltip;
00464         ai::uint32 normalIconResID = 0;
00466         ai::uint32 darkIconResID = 0;
00470         AIToolType sameGroupAs = 0;
00474         AIToolType sameToolsetAs = 0;
00475         /* Specifies the type of the incoming icons 
00476                 enum IconType in AITypes.h*/
00477         ai::IconType iconType = ai::IconType::kPNG;
00478 };
00479 
00481 typedef struct _AIDataStack *AIDataStackRef;
00482 
00484 struct AIAddToolDataPrivate {
00486     ai::UnicodeString title;
00488     ai::UnicodeString tooltip;
00490         AIDataStackRef iconResourceDictionary;
00494         AIToolType sameGroupAs = 0;
00498         AIToolType sameToolsetAs = 0;
00499         /* Specifies the type of the incoming icons
00500            enum IconType in AITypes.h*/
00501         ai::IconType iconType = ai::IconType::kInvalid;
00502 };
00503 
00506 typedef ai::int16 AIToolTabletPointerType;
00507 
00510 enum AIToolTabletPointerTypeValue
00511 {
00512         kAIToolTabletPointerTypeUnknown = 0,
00514         kAIToolTabletPointerTypePen,
00516         kAIToolTabletPointerTypeCursor,
00518         kAIToolTabletPointerTypeEraser
00519 };
00520 
00523 typedef ai::int16 AIToolPressure;
00526 enum AIToolPressureValue
00527 {
00529         kAIMaxToolPressure = 255,
00531         kAIMinToolPressure = 0,
00533         kAINormalToolPressure = 127
00534 };
00535 
00538 typedef ai::int16 AIToolAngle;
00541 enum AIToolAngleValue
00542 {
00544         kAIToolAngle0 = 0,
00545         kAIToolAngle90 = 90,
00546         kAIToolAngleNegative179 = -179,
00547         kAIToolAngle180 = 180,
00548         kAIToolAngle360 = 360,
00549 
00551         kAIToolMinBearing = kAIToolAngleNegative179,
00552         kAIToolMaxBearing = kAIToolAngle180,
00553         kAIToolNormalBearing = kAIToolAngle0,
00554 
00556         kAIToolMinRotation = kAIToolAngleNegative179,
00557         kAIToolMaxRotation = kAIToolAngle180,
00558         kAIToolNormalRotation = kAIToolAngle0,
00559 
00562         kAIToolMinTilt = kAIToolAngle0,
00563         kAIToolMaxTilt = kAIToolAngle90,
00564         kAIToolNormalTilt = kAIToolMinTilt
00565 };
00568 enum AITabletCapabilities
00569 {
00570         /* X-coordinate in the tablet coordinate space. */
00571         kXCoordinate                    =               1 << 0,
00572         /* Y-coordinate in the tablet coordinate space. */
00573         kYCoordinate                    =               1 << 1,
00574         /* Z-coordinate or the distance of the pen tip from the tablet. */
00575         kZCoordinate                    =               1 << 2,
00576         /* Pressure of pen tip perpendicular to tablet surface. */
00577         kNormalPressure                 =               1 << 3,
00578         /* Pressure of the pen tip along the plane of the tablet surface. */
00579         kTangentPressure                =               1 << 4,
00580         /* Angle between the axis of pen and the surface of the tablet. */
00581         kAltitudeOrientation    =               1 << 5,
00582         /* Clockwise rotation of the cursor around the z-axis through a full circular range. */
00583         kAzimuthOrientation             =               1 << 6,
00584         /* Clockwise rotation of the cursor around its own axis. */
00585         kTwistOrientation               =               1 << 7
00586 };
00587 
00588 
00589 enum AIToolMessageFlags
00590 {
00591         /*Indicates that it is a simulated Tool Message of InkStrokes*/
00592         kAIToolMsgInkSimulationFlag                             =               1 << 0,
00593         kAIToolMsgModifierKeyPressedDuringInk   =               1 << 1,
00594         
00595         /*Indicates that it is a tool drag over message*/
00596         kAIToolMsgIsDragOver                                    =               1 << 2
00597 };
00598 
00600 struct AIEventHistoryData
00601 {
00603         AIPoint position;
00605         AIToolPressure stylusWheel;
00607         AIToolAngle tilt;
00609         AIToolAngle bearing;
00611         AIToolAngle rotation;
00612 };
00614 struct AIToolMessage {
00616         SPMessageData d;
00621         AIToolHandle tool;
00623         AIRealPoint cursor;
00627         AIToolPressure pressure;
00630         AIEvent *event;
00632         AIToolPressure stylusWheel;
00634         AIToolAngle tilt;
00636         AIToolAngle bearing;
00638         AIToolAngle rotation;
00639         
00641         ai::int32       flags;
00643         ai::AutoBuffer<AIEventHistoryData> eventHistoryData;
00644 };
00645 
00647 struct AIRadialDeviceMessage
00648 {
00650         SPMessageData d;
00651         
00656         AIToolHandle tool = nullptr;
00657 
00659         AIReal rotation = 0.0;
00660 };
00661 
00663 struct AIToolNotifyData {
00666         AIToolHandle tool;
00667 };
00668 
00670 struct AIEyedropperDragNotifyData {
00672         AIEvent event;
00674         AIBoolean pathStyleChanged;
00675 };
00676 
00677 struct AIDocumentInkParams
00678 {
00679         enum PenTipShape
00680         {
00681                 kPenTipShapeCircle,
00682                 kPenTipShapeRectangle
00683         };
00684         PenTipShape fShape;
00685         AIColor fColor;
00686         AIPoint fSize;
00687         ai::AutoBuffer<ai::uint32> fModifiersList;
00688         AIReal  fRotation;
00689         AIBoolean fSupportPressure;
00690         AIBoolean fCustomModifierHandling;      // Specifying it as true turns off direct ink when a mod key is pressed.
00691         enum PressureBasedVariant
00692         {
00693                 kPressuteBasedVariantNone = 1 << 0,
00694                 kPressuteBasedVariantDia = 1 << 1,
00695                 kPressuteBasedVariantRoundness = 1 << 2,
00696                 kPressuteBasedVariantAngle = 1 << 3,
00697         };
00698         ai::int32 fPressureBasedVariants;
00699         AIDocumentInkParams() :fShape(kPenTipShapeCircle)
00700         {
00701                 fColor.kind = kThreeColor;
00702                 fColor.c.rgb.red = 0.0f;
00703                 fColor.c.rgb.green = 0.0f;
00704                 fColor.c.rgb.blue = 0.0f;
00705                 fSize.h = 1;
00706                 fSize.v = 1;
00707                 fRotation = 0.0f;
00708                 fSupportPressure = false;
00709                 fPressureBasedVariants = 0;
00710                 fCustomModifierHandling = false;
00711         }
00712 };
00713 
00714 
00715 struct AIDocumentInkPoint
00716 {
00717         AIRealPoint              fLocation;
00718         AIToolPressure   fPressure;
00719         AIToolPressure   fStylusWheel;
00720         AIToolAngle              fRotation;
00721         AIToolPressure   fBearing;
00722         AIToolPressure   fTilt;
00723 
00724         AIDocumentInkPoint()
00725         {
00726                 fLocation.h = 0.0;
00727                 fLocation.v = 0;
00728                 fPressure = 0;
00729                 fStylusWheel = kAIToolMinRotation;
00730                 fBearing = kAIToolMinBearing;
00731                 fRotation = kAIToolMinRotation;
00732                 fTilt = kAIToolMinTilt;
00733         }
00734 };
00735 
00737 struct AIToolDryInkMessage {
00739         SPMessageData d;
00740 
00742         ai::int32       flags = 0;
00743 
00748         AIToolHandle tool;
00749 
00751         AIEvent *event;
00752 
00753         ai::AutoBuffer<AIDocumentInkPoint> inkStrokes;
00754 
00755         AIToolDryInkMessage() :tool(0), event(nullptr)
00756         {}
00757 };
00758 
00759 
00760 /*******************************************************************************
00761  **
00762  **     Suite
00763  **
00764  **/
00765 
00862 struct AIToolSuite {
00863 
00874     AIAPI AIErr (*AddTool) ( SPPluginRef self, const char *name,
00875                 const AIAddToolData &data, ai::int32 options,
00876                 AIToolHandle *tool );
00877     
00879     AIAPI AIErr (*AddToolPrivate) ( SPPluginRef self, const char *name,
00880         const AIAddToolDataPrivate &data, ai::int32 options,
00881         AIToolHandle *tool );
00882     
00891     AIAPI AIErr (*GetToolName) ( AIToolHandle tool, char **name );
00892 
00900         AIAPI AIErr (*GetToolOptions) ( AIToolHandle tool, ai::int32 *options );
00901 
00908         AIAPI AIErr (*SetToolOptions) ( AIToolHandle tool, ai::int32 options );
00909 
00915         AIAPI AIErr (*GetToolPlugin) ( AIToolHandle tool, SPPluginRef *plugin );
00916 
00923         AIAPI AIErr (*GetSelectedTool) ( AIToolHandle *tool );
00924 
00930         AIAPI AIErr (*SetSelectedTool) ( AIToolHandle tool );
00931 
00936         AIAPI AIErr (*CountTools) ( ai::int32 *count );
00937 
00943         AIAPI AIErr (*GetNthTool) ( ai::int32 n, AIToolHandle *tool );
00944 
00953         AIAPI AIErr (*GetToolHandleFromNumber) ( AIToolType toolNum,  AIToolHandle *tool );
00954 
00962     AIAPI AIErr (*GetToolNumberFromName) ( const char *name, AIToolType *toolNum );
00963 
00969         AIAPI AIErr (*GetToolNumberFromHandle) ( AIToolHandle tool, AIToolType *toolNum );
00970 
00977     AIAPI AIErr (*GetToolNameFromNumber) ( AIToolType toolNum, char **name );
00978 
00985     AIAPI AIErr (*GetToolTitle) ( AIToolHandle tool, ai::UnicodeString& title );
00986 
00991     AIAPI AIErr (*SetToolTitle) ( AIToolHandle tool, ai::UnicodeString title );
00992 
00993 
00999     AIAPI AIErr (*GetTooltip) ( AIToolHandle tool, ai::UnicodeString& tooltip );
01000 
01005     AIAPI AIErr (*SetTooltip) ( AIToolHandle tool, ai::UnicodeString tooltip );
01006 
01016         AIAPI AIErr (*SetToolInfoVars) ( AIToolHandle tool, const ai::int32 infoVars[] );
01017 
01053         AIAPI AIErr (*SetToolInfoVarValues) ( const ai::int32 *infoVars,  void **values );
01054 
01060         AIAPI AIErr (*SystemHasPressure) ( AIBoolean *hasPressure );
01061 
01063         AIAPI AIErr (*GetToolNullEventInterval) (AIToolHandle tool, AIToolTime *outTime);
01064 
01066         AIAPI AIErr (*SetToolNullEventInterval) (AIToolHandle tool, AIToolTime inTime);
01067 
01074         AIAPI AIErr (*SetSoftSelectedTool) ( AIToolHandle tool );
01075 
01083         AIAPI AIErr (*IsSoftModeSelection) ( AIBoolean *isSoftMode );
01084 
01091     AIAPI AIErr (*GetAlternateSelectionToolName) (AIToolHandle tool, char **name);
01092 
01099     AIAPI AIErr (*SetAlternateSelectionToolName) (AIToolHandle tool, const char* alternateTool);
01100     
01109     AIAPI AIErr (*GetCurrentToolName) ( const char **name );
01110 
01114         AIAPI AIErr (*GetCurrentToolNumber) ( AIToolType *toolNum );
01115 
01125         AIAPI AIErr (*GetCurrentEffectiveTool) ( AIToolHandle *tool );
01126 
01134     AIAPI AIErr (*GetCurrentEffectiveToolName) ( const char **name );
01135 
01140         AIAPI AIErr (*GetCurrentEffectiveToolNumber) ( AIToolType *toolNum );
01141 
01150     AIAPI AIToolType (*GetLastUsedSelectionTool) ( const char **name );
01151 
01158     AIAPI AIErr (*SetSelectedToolByName) ( const char *name );
01159     
01163         AIAPI AIErr (*SetSelectedToolByNumber) ( AIToolType toolNum );
01164 
01169         AIAPI AIErr (*GetTabletHardwareCapabilities) ( ai::int32* hardwareCapabilities );
01170 
01176     AIAPI AIErr (*SetToolIcons) (AIToolHandle tool, const char *normalIconResourceName, const char *darkNormalIconResourceName);
01177 
01183     AIAPI AIErr(*GetToolIcons) (const AIToolHandle tool, char **normalIconResourceName, char **darkNormalIconResourceName);
01184 
01187         AIAPI AIErr(*SetDocumentInkParams)(const AIToolHandle tool, const AIDocumentInkParams& inDocInkParams);
01188 
01192         AIAPI AIErr (*GetToolOptionsFromNumber) (AIToolType toolNum, ai::int32 *options);
01193 
01199     AIAPI AIErr (*GetToolOptionsFromName) (const char *toolName, ai::int32 *options);
01200 };
01201 
01202 
01203 #include "AIHeaderEnd.h"


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