Adobe.com
Contents Suites Classes Class Index Member Index

AIUser.h

Go to the documentation of this file.
00001 #ifndef __AIUser__
00002 #define __AIUser__
00003 
00004 /*
00005  *        Name: AIUser.h
00006  *   $Revision: 15 $
00007  *      Author:
00008  *        Date:
00009  *     Purpose: Adobe Illustrator User Utilities Suite.
00010  *
00011  * ADOBE SYSTEMS INCORPORATED
00012  * Copyright 2016 Adobe Systems Incorporated.
00013  * All rights reserved.
00014  *
00015  * NOTICE:  Adobe permits you to use, modify, and distribute this file
00016  * in accordance with the terms of the Adobe license agreement
00017  * accompanying it. If you have received this file from a source other
00018  * than Adobe, then your use, modification, or distribution of it
00019  * requires the prior written permission of Adobe.
00020  *
00021  */
00022 
00023 
00024 /*******************************************************************************
00025  **
00026  **     Imports
00027  **
00028  **/
00029 
00030 #ifndef __AIArt__
00031 #include "AIArt.h"
00032 #endif
00033 
00034 #ifndef __AITypes__
00035 #include "AITypes.h"
00036 #endif
00037 
00038 #ifndef __AIColor__
00039 #include "AIColor.h"
00040 #endif
00041 
00042 #ifndef __AIMenu__
00043 #include "AIMenu.h"
00044 #endif
00045 
00046 #ifndef __AIFileFormat__
00047 #include "AIFileFormat.h"
00048 #endif
00049 
00050 #ifndef __AIDocumentView__
00051 #include "AIDocumentView.h"
00052 #endif
00053 
00054 #include "IAIFilePath.hpp"
00055 #include "IAILocale.h"
00056 
00057 #include "AIHeaderBegin.h"
00058 
00062 /************************************************************************s*******
00063  **
00064  **     Constants
00065  **
00066  **/
00067 
00068 // v.14.0
00069 #define kAIUserSuite                            "AI User Suite"
00070 #define kAIUserSuiteVersion14           AIAPI_VERSION(14)
00071 #define kAIUserSuiteVersion                     kAIUserSuiteVersion14
00072 #define kAIUserVersion                          kAIUserSuiteVersion
00073 
00074 #if Macintosh || MSWindows
00075 #define kAIMacUserSuite                         "AI Mac User Suite"
00076 #define kAIMacUserSuiteVersion7         AIAPI_VERSION(7)
00077 #define kAIMacUserSuiteVersion          kAIMacUserSuiteVersion7
00078 #define kAIMacUserVersion                       kAIMacUserSuiteVersion
00079 #endif
00080 
00082 enum {
00084         kShortUnits,
00086         kLongSingularUnits,
00088         kLongPluralUnits
00089 };
00090 
00095 enum AIAnswer {
00096         kAIAnswer_No = 0,
00097         kAIAnswer_Yes,
00098         kAIAnswer_Cancel,
00099         kAIAnswer_Invalid =  0xFFFFFFFF
00100 };
00101 
00107 enum AIValidationStage
00108 {
00110         kAIValidationStage_interactive = 0,
00112         kAIValidationStage_onOk = 1
00113 };
00114 
00119 enum AIPredefinedCursor
00120 {
00121         kAIIBeamCursorID = -1,
00122         kAICrossCursorID = -2,
00123         kAIWaitCursorID = -3,
00124         kAIArrowCursorID = -4
00125 };
00126 
00129 #define kUnknownUnitsErr                '?UNT'
00130 
00133 #define kApplicationNotFoundErr 'App?'
00134 
00137 #define kObjectNotLinkedErr             '!Lnk'
00138 
00139 
00141 typedef ai::uint32 AIUserDateTime;
00142 
00144 typedef struct _t_Opaque_AIResourceManagerHandle *AIResourceManagerHandle;
00145 
00153 typedef AIBoolean (*IsValidInputProc) (AIValidationStage validationStage, const ai::UnicodeString &input, ai::UnicodeString &errorStr, void *userdata);
00154 
00156 #define kAIUniversalLocaleFormat                0x0000
00157 
00158 #define kAIResourceLocaleFormat                 0x0001
00159 
00160 #define kAISystemLocaleFormat                   0x0002
00161 
00164 #define kAIShortDateFormat                              0x0000
00165 
00167 #define kAILongDateFormat                               0x0100
00168 
00171 #define kAIAbbrevDateFormat                             0x0200
00172 
00174 #define kAIShortTimeFormat                              0x0000
00175 
00177 #define kAILongTimeFormat                               0x0100
00178 
00179 
00180 /*******************************************************************************
00181  **
00182  **     Types
00183  **
00184  **/
00185 
00240 struct AIAutoNameGenerator
00241 {
00242 
00245         ai::int32 maximumLength;
00246 
00248         AIBoolean uniqueNames;
00249 
00251     ai::UnicodeString baseName;
00252 
00255         ai::int32 nextNewNameIndex;
00256 
00267     AIAPI AIErr (*HasName) (AIAutoNameGenerator &self, const ai::UnicodeString &name, AIBoolean &hasit);
00268 };
00269 
00270 
00271 
00272 
00276 struct AIFileDialogFilters
00277 {
00282         void AddFilter(const ai::UnicodeString &desc);
00283 
00284 
00292         void AddFilter(const ai::UnicodeString &desc, const ai::UnicodeString &pattern);
00293 
00300         const ai::UnicodeString &GetFilter() const;
00301 
00302 private:
00303         ai::UnicodeString filterStr;
00304 };
00305 
00309 struct AIExpressionOptions
00310 {
00315         ai::uint32 unit;
00316 
00318         AIDouble minValue;
00319 
00321         AIDouble maxValue;
00322 
00325         AIDouble oldValue;
00326 
00328         ai::uint32 precision;
00329 
00330 };
00331 
00339 struct AIUserSuite {
00340 
00347         AIAPI AIBoolean (*Cancel) ( void );
00348 
00355         AIAPI void (*UpdateProgress) ( ai::int32 current, ai::int32 max );
00356 
00362         AIAPI void (*SetProgressText) ( const ai::UnicodeString& text );
00363 
00367         AIAPI void (*CloseProgress) ( void );
00368 
00378     AIAPI void (*AIRealToString) ( AIReal value, ai::int16 precision, ai::UnicodeString& string );
00379 
00387         AIAPI void (*StringToAIReal) ( const ai::UnicodeString& string, AIReal *value );
00397     AIAPI void (*IUAIRealToString) ( AIReal value, ai::int16 precision, ai::UnicodeString& string );
00398     
00409     AIAPI void (*IUAIRealToStringWithLocale) ( AIReal value, ai::int16 precision, ai::UnicodeString& string, const ai::LocaleID locale );
00410 
00418         AIAPI void (*IUStringToAIReal) ( const ai::UnicodeString& string, AIReal *value );
00419 
00432         AIAPI AIErr (*IUAIRealToStringUnits) ( AIReal value, ai::int32 precision, ai::UnicodeString& string );
00433 
00445         AIAPI void (*IUStringUnitsToAIReal) ( const ai::UnicodeString& string, AIReal *value );
00446 
00456     AIAPI AIErr (*GetUnitsString) ( ai::int16 format, ai::UnicodeString& string );
00457 
00464         AIAPI AIErr (*GetGlobalObjectDisplayName)( ai::UnicodeString& name );
00465 
00472         AIAPI AIErr (*EditInOriginalApp) ( AIArtHandle art );
00473 
00476         AIAPI AIErr (*AppIdle) ( void );
00477 
00482         AIAPI AIErr (*BuildDirectoryMenu) ( AIPlatformMenuHandle menu, const ai::FilePath &fileSpec);
00483 
00488         AIAPI AIErr (*GetIndexedDirectorySpec) ( ai::FilePath &fileSpec, ai::int32 index);
00489 
00493         AIAPI AIErr (*RevealTheFile) ( const ai::FilePath &fileSpec);
00494 
00498         AIAPI void (*DisableProgressCancel) ( void );
00499 
00508         AIAPI AIBoolean (*OKToAllocateMemory) ( void );
00509 
00510         // Introduced in AI 11
00514         AIAPI AIErr (*GetDateAndTime)(AIUserDateTime *outValue);
00515 
00516         /* Formats a date into a Unicode string.
00517                         @param inValue The date to format, or \c NULL to format the current date-time value.
00518                         @param formatFlag The format to use, one of:
00519                                 <br> \c #kAIShortDateFormat
00520                                 <br> \c #kAILongDateFormat
00521                                 <br> \c #kAIAbbrevDateFormat
00522                         @param dateStringUS [out] A buffer in which to return the formatted date string.
00523                 */
00524         AIAPI AIErr (*GetDateString)(const AIUserDateTime *inValue, const ai::int32 formatFlag, ai::UnicodeString& dateStringUS);
00525 
00526         /* Formats a time into a Unicode string.
00527                         @param inValue The time to format, or \c NULL to format the current date-time value.
00528                         @param formatFlag The format to use, one of:
00529                                 <br> \c #kAIShortTimeFormat
00530                                 <br> \c #kAILongTimeFormat
00531                         @param dateStringUS [out] A buffer in which to return the formatted time string.
00532                 */
00533         AIAPI AIErr (*GetTimeString)(const AIUserDateTime *inValue, const ai::int32 formatFlag, ai::UnicodeString& dateStringUS);
00534 
00539         AIAPI AIErr (*GetYear)(const AIUserDateTime *inValue, int *year);
00540 
00545         AIAPI AIErr (*GetMonth)(const AIUserDateTime *inValue, int *month);
00546 
00551         AIAPI AIErr (*GetDay)(const AIUserDateTime *inValue, int *day);
00552 
00557         AIAPI AIErr (*GetHour)(const AIUserDateTime *inValue, int *hour);
00558 
00563         AIAPI AIErr (*GetMinute)(const AIUserDateTime *inValue, int *minute);
00564 
00569         AIAPI AIErr (*GetSecond)(const AIUserDateTime *inValue, int *second);
00570 
00575         AIAPI AIErr (*GetDayOfWeek)(const AIUserDateTime *inValue, int *dayOfWeek);
00576 
00581         AIAPI AIErr (*LaunchApp)(const ai::FilePath &spFileSpec, ASBoolean openDoc);
00582 
00589         AIAPI AIErr (*NextName) (AIAutoNameGenerator &set, ai::UnicodeString &name);
00590 
00598     AIAPI AIErr (*CopyOfName) (AIAutoNameGenerator &set, const ai::UnicodeString &original, ai::UnicodeString &copy);
00599 
00609         AIAPI AIErr (*SameName) (const ai::UnicodeString &name1, const ai::UnicodeString &name2, AIBoolean &same);
00610 
00611 
00619         AIAPI AIErr (*PutFileDialog)(const ai::UnicodeString &title, const AIFileDialogFilters*, const ai::UnicodeString &defaultName, ai::FilePath &ioFilePath);
00620 
00627         AIAPI AIErr (*GetFileDialog)(const ai::UnicodeString &title, const AIFileDialogFilters*, ai::FilePath &ioFilePath);
00628 
00634         AIAPI AIErr (*GetDirectoryDialog)(const ai::UnicodeString &title, ai::FilePath &ioFilePath);
00635 
00645         AIAPI AIBoolean (*OKCancelAlert) (const ai::UnicodeString& msg, AIBoolean defaultOk, const char* dontShowKey);
00646 
00654         AIAPI void (*WarningAlert) (const ai::UnicodeString& msg, const char* dontShowKey);
00655 
00663         AIAPI void (*MessageAlertEx) (const ai::UnicodeString& msg, const char* dontShowKey);
00664 
00673         AIAPI AIAnswer (*QuestionAlert)(const ai::UnicodeString &msg);
00674 
00683         AIAPI AIAnswer (*YesNoAlert)(const ai::UnicodeString &msg);
00684 
00692         AIAPI void (*ErrorAlert)(const ai::UnicodeString &msg);
00693 
00701         AIAPI void (*MessageAlert)(const ai::UnicodeString &msg);
00702 
00709         AIAPI AIBoolean (*ChooseFromOSColorPicker) (const AIPoint &inLocation,
00710                 const AIRGBColor& inColor, AIRGBColor* outColor);
00711 
00728         AIAPI AIErr (*EvaluateExpression)(const ai::UnicodeString& expr, const AIExpressionOptions& options, ai::UnicodeString& evaluatedExpr,
00729                 AIBoolean & isChanged , AIDouble& numericValue);
00730 
00746         AIAPI AIErr (*GetInputFromUser) ( const ai::UnicodeString &title, const ai::UnicodeString* messageText, const ai::UnicodeString &label, ai::UnicodeString& ioField, IsValidInputProc validator, void *userdata, ai::int32 maxInputChars);
00747 
00754         AIAPI AIErr (*CreateCursorResourceMgr)(SPPluginRef, AIResourceManagerHandle* inRscMgr);
00755 
00762         AIAPI AIErr (*SetCursor)(ai::int32 cursorID, AIResourceManagerHandle inRscMgr);
00763 
00768         AIAPI AIErr (*DisposeCursorResourceMgr)(AIResourceManagerHandle);
00769 
00773         AIAPI AIErr (*GetAILanguageCode)(ai::UnicodeString& lang);
00774     
00780         AIAPI AIReal (*GetMaximumScaleFactorOnSystem)();
00781 
00782 
00786         AIAPI AIReal(*GetArtToViewScaleFactor)(AIDocumentViewHandle view);
00787 
00788 
00793         AIAPI AIErr(*LaunchFolder)(ai::FilePath folderPath);
00794 
00795 };
00796 
00797 
00798 
00799 /*
00800         Inline members
00801 */
00802         inline void AIFileDialogFilters::AddFilter(const ai::UnicodeString &desc)
00803         {
00804                 AddFilter(desc, ai::UnicodeString("*"));
00805         }
00806 
00807         inline void AIFileDialogFilters::AddFilter(const ai::UnicodeString &desc, const ai::UnicodeString &pattern)
00808         {
00809                 if (!desc.empty() && !pattern.empty())
00810                 {
00811                         const ai::UnicodeString::size_type len = filterStr.length();
00812                         if (len)
00813                                 filterStr.erase(len-1); // erase one null of the previous double null terminators
00814                         filterStr.append(desc);
00815                         filterStr.append(1, 0);
00816                         filterStr.append(pattern);
00817                         filterStr.append(2, 0);
00818                 }
00819         }
00820 
00821         inline const ai::UnicodeString &AIFileDialogFilters::GetFilter() const
00822         {
00823                 return filterStr;
00824         }
00825 
00826 #include "AIHeaderEnd.h"
00827 
00828 
00829 #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