Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicorePlugin.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_PLUGIN__
8#define __HDI_CORE_PLUGIN__
9
10#include <vector>
11
12#include "hdicoreMain.h"
13
17#define HDI_CORE_PLUGIN hdi::core::Plugin::instance()
18
19namespace hdi
20{
21 namespace core
22 {
23 class Callback;
24 class Dispatcher;
25 class MenuItem;
26 class ModalDialog;
27 class Tool;
28
34 class Plugin
35 {
36 public:
37 typedef std::vector<byte> ByteVector;
38
39 #if defined(HDI_CORE_AIP_MODE)
44 {
45 NoOptions = 0,
46 AutoSelectsResultsOption = 1 << 0,
47 RetainsPartialPathSelectionOption = 1 << 1
48 };
49
54 {
55 UnknownUndoContext = 0,
56
57 // A standard undo context results in the addition of a new transaction which can be undone/redone
58 // by the user
59 StandardUndoContext = 10,
60
61 // A silent context does not cause redos to be discarded and is skipped over when undoing and
62 // redoing. An example is a selection change.
63 SilentUndoContext = 20,
64
65 // An appended context is like a standard context, except that it is combined with the preceding
66 // transaction. It does not appear as a separate transaction. Used, for example, to collect
67 // sequential changes to the color of an object into a single undo/redo transaction.
68 AppendUndoContext = 30
69 };
70 #endif
71 // HDI_CORE_AIP_MODE
72
80 static Plugin* const instance();
81
93 virtual SPPluginRef spPluginRef() const;
94
102 PlatformPluginPtr platformPlugin() const;
103
111 virtual std::string filePath() const;
112
120 virtual std::string fileName() const;
121
129 virtual std::string name() const;
130
138 virtual void setName(const std::string& name_);
139
140 #if defined(HDI_CORE_AIP_MODE)
148 virtual Options options() const;
149
157 virtual void setOptions(const Options options_);
158 #endif
159 // HDI_CORE_AIP_MODE
160
168 virtual Dispatcher* const dispatcher() const;
169
170 #if defined(HDI_CORE_AIP_MODE)
178 virtual Tool* const currentTool() const;
179
185 virtual void undo() const;
186
195 virtual bool setUndoKind(const UndoContext uc_);
196
205 virtual void setUndoRedoNames(const std::string& undo_, const std::string& redo_);
206 #endif
207 // HDI_CORE_AIP_MODE
208
221 virtual bool resourceData(const int32_t type_, const int16_t id_, ByteVector& data__) const;
222
235 virtual bool resourceData(
236 const int32_t type_,
237 const std::string& name_,
238 ByteVector& data__
239 ) const;
240
241 #if defined(HDI_CORE_AIP_MODE)
252 virtual bool toolsSnapToArt() const;
253
261 virtual void setToolsSnapToArt(const bool snap_);
262
273 virtual bool toolsSnapToArtBounds() const;
274
282 virtual void setToolsSnapToArtBounds(const bool snap_);
283
294 virtual bool toolsSnapToArtboard() const;
295
303 virtual void setToolsSnapToArtboard(const bool snap_);
304
316 virtual bool toolsSnapToGrids() const;
317
326 virtual void setToolsSnapToGrids(const bool snap_);
327 #endif
328 // HDI_CORE_AIP_MODE
329
337 virtual bool startingUp() const;
338
346 virtual bool hasStartedUp() const;
347
355 virtual bool postStartingUp() const;
356
364 virtual bool hasPostStartedUp() const;
365
366 #if defined(HDI_CORE_AIP_MODE)
374 virtual bool preShuttingDown() const;
375
383 virtual bool hasPreShutdown() const;
384 #endif
385 // HDI_CORE_AIP_MODE
386
394 virtual bool shuttingDown() const;
395
403 virtual bool hasShutdown() const;
404
415 virtual std::ostream* const loggingStream(const std::string& name_) const;
416
429 virtual void setLoggingStream(const std::string& name_, std::ostream* const str_);
430
438 virtual Callback* const startupCallback() const;
439
447 virtual void setStartupCallback(const Callback& cb_);
448
456 virtual Callback* const postStartupCallback() const;
457
465 virtual void setPostStartupCallback(const Callback& cb_);
466
467 #if defined(HDI_CORE_AIP_MODE)
475 virtual Callback* const preShutdownCallback() const;
476
484 virtual void setPreShutdownCallback(const Callback& cb_);
485 #endif
486 // HDI_CORE_AIP_MODE
487
495 virtual Callback* const shutdownCallback() const;
496
504 virtual void setShutdownCallback(const Callback& cb_);
505
506 #if defined(HDI_CORE_AIP_MODE)
514 virtual Callback* const menuItemSelectedCallback() const;
515
523 virtual void setMenuItemSelectedCallback(const Callback& cb_);
524
533 virtual Callback* const menuItemsUpdateCallback() const;
534
543 virtual void setMenuItemsUpdateCallback(const Callback& cb_);
544 #endif
545 // HDI_CORE_AIP_MODE
546
555 virtual Callback* const brightnessAdjustedCallback() const;
556
565 virtual void setBrightnessAdjustedCallback(const Callback& cb_);
566
567 #if defined(HDI_CORE_AIP_MODE)
576 virtual Callback* const toolPreSelectedCallback() const;
577
586 virtual void setToolPreSelectedCallback(const Callback& cb_);
587
596 virtual Callback* const toolPostSelectedCallback() const;
597
606 virtual void setToolPostSelectedCallback(const Callback& cb_);
607
616 virtual Callback* const toolPreDeselectedCallback() const;
617
626 virtual void setToolPreDeselectedCallback(const Callback& cb_);
627
636 virtual Callback* const toolPostDeselectedCallback() const;
637
646 virtual void setToolPostDeselectedCallback(const Callback& cb_);
647
656 virtual Callback* const toolPreReselectedCallback() const;
657
666 virtual void setToolPreReselectedCallback(const Callback& cb_);
667
676 virtual Callback* const toolPostReselectedCallback() const;
677
686 virtual void setToolPostReselectedCallback(const Callback& cb_);
687
696 virtual Callback* const toolPreTrackedCallback() const;
697
706 virtual void setToolPreTrackedCallback(const Callback& cb_);
707
716 virtual Callback* const toolPostTrackedCallback() const;
717
726 virtual void setToolPostTrackedCallback(const Callback& cb_);
727
736 virtual Callback* const toolPreMouseDownCallback() const;
737
746 virtual void setToolPreMouseDownCallback(const Callback& cb_);
747
756 virtual Callback* const toolPostMouseDownCallback() const;
757
766 virtual void setToolPostMouseDownCallback(const Callback& cb_);
767
776 virtual Callback* const toolPreDraggedCallback() const;
777
786 virtual void setToolPreDraggedCallback(const Callback& cb_);
787
796 virtual Callback* const toolPostDraggedCallback() const;
797
806 virtual void setToolPostDraggedCallback(const Callback& cb_);
807
816 virtual Callback* const toolPreMouseUpCallback() const;
817
826 virtual void setToolPreMouseUpCallback(const Callback& cb_);
827
836 virtual Callback* const toolPostMouseUpCallback() const;
837
846 virtual void setToolPostMouseUpCallback(const Callback& cb_);
847
857
867
877
887
897
907
917
927
936 virtual Callback* const toolPreEditedCallback() const;
937
946 virtual void setToolPreEditedCallback(const Callback& cb_);
947
956 virtual Callback* const toolPostEditedCallback() const;
957
966 virtual void setToolPostEditedCallback(const Callback& cb_);
967 #endif
968 // HDI_CORE_AIP_MODE
969
985 virtual ModalDialog* const aboutBox() const;
986
1002 virtual void setAboutBox(const ModalDialog& dialog_);
1003
1004 #if defined(HDI_CORE_PSP_MODE)
1013 virtual Callback* const aboutBoxShowingCallback() const;
1014
1023 virtual void setAboutBoxShowingCallback(const Callback& cb_);
1024 #endif
1025 // HDI_CORE_PSP_MODE
1026
1040 virtual ModalDialog* const prefsDialog() const;
1041
1055 virtual void setPrefsDialog(const ModalDialog& dialog_);
1056
1057 #if defined(HDI_CORE_AIP_MODE)
1071 virtual MenuItem* const aboutMenuItem() const;
1072
1087 virtual void setAboutMenuItem(const MenuItem& mi_);
1088 #endif
1089 // HDI_CORE_AIP_MODE
1090
1104 virtual MenuItem* const prefsMenuItem() const;
1105
1120 virtual void setPrefsMenuItem(const MenuItem& mi_);
1121
1122
1123 private:
1124 #if defined(HDI_CORE_AIP_MODE)
1125 friend __MainError (::PluginMain) (const char*, const char*, void*);
1126 #elif defined(HDI_CORE_PSP_MODE)
1127 #if defined(MAC_ENV)
1128 friend void (::hdicoreDylibUnloading) ();
1129 #endif
1130
1131 friend __MainError (::ActionsPluginMain) (const char*, const char*, void*);
1132 friend void (::AcquirePluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1133 friend void (::ExportPluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1134 friend void (::ExtensionPluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1135 friend void (::FilterPluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1136 friend void (::FormatPluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1137 friend void (::MeasurementPluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1138 friend void (::PickerPluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1139 friend void (::SelectionPluginMain) (const int16_t, void*, intptr_t*, int16_t*);
1140 #endif
1141
1145 enum __StartupError
1146 {
1147 __NoStartupError = 0,
1148 __CantLockPluginError = 1000,
1149 __CantSetPluginNameError = 1010,
1150 __BadApplicationVersionError = 1020,
1151 __WrongPluginBinaryError = 1030,
1152 __WrongInstallLocationError = 1040,
1153 __CantLoadPrefsError = 1050,
1154 __CantSetupToolsError = 1060,
1155 __CantSetupNotifiersError = 1070,
1156 __CantSetupAnnotatorsError = 1080,
1157 __CantSetupTimersError = 1090,
1158 __CustomStartupErrorOffset = 1000000
1159 };
1160
1164 enum __PostStartupError
1165 {
1166 __NoPostStartupError = 0,
1167 __CustomPostStartupErrorOffset = 2000000
1168 };
1169
1173 enum __PreShutdownError
1174 {
1175 __NoPreShutdownError = 0,
1176 __CustomPreShutdownErrorOffset = 3000000
1177 };
1178
1182 enum __ShutdownError
1183 {
1184 __NoShutdownError = 0,
1185 __CantUnlockPluginError = 4000,
1186 __CustomShutdownErrorOffset = 4000000
1187 };
1188
1192 static Plugin* __instance;
1193
1197 void* __data;
1198
1204 Plugin();
1205
1211 Plugin(const Plugin&);
1212
1218 Plugin(const void*, const std::string&);
1219
1225 virtual ~Plugin();
1226
1232 Plugin& operator=(const Plugin& rhs_);
1233
1239 __StartupError __startup();
1240
1246 __PostStartupError __postStartup();
1247
1248 #if defined(HDI_CORE_AIP_MODE)
1254 __PreShutdownError __preShutdown();
1255 #endif
1256 // HDI_CORE_AIP_MODE
1257
1263 __ShutdownError __shutdown();
1264
1265 #if defined(HDI_CORE_PSP_MODE)
1271 void __aboutBoxShow();
1272 #endif
1273 // HDI_CORE_PSP_MODE
1274 };
1275 }
1276}
1277
1278#if defined(HDI_CORE_AIP_MODE)
1280 const hdi::core::Plugin::Options lhs_,
1282 );
1283
1284 hdi::core::Plugin::Options& operator|=(
1287 );
1288#endif
1289// HDI_CORE_AIP_MODE
1290
1291#endif
1292// __HDI_CORE_PLUGIN__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Class through which all messages ultimately pass; holds registered callbacks for messages,...
Definition: hdicoreDispatcher.h:34
Wraps around an application menu item to allow for selection callbacks, en/disabling,...
Definition: hdicoreMenuItem.h:26
Used to create and display a modal dialog to the user, blocking input to other UI elements.
Definition: hdicoreModalDialog.h:25
Base plugin class; the heart of any plugin project.
Definition: hdicorePlugin.h:35
virtual void setMenuItemSelectedCallback(const Callback &cb_)
Sets the callback that's called when a user selects one of the plugin's menu items.
virtual void setToolPostEditedCallback(const Callback &cb_)
Sets the callback that's called just after a tool is double-clicked in the toolbar (i....
virtual Callback *const toolPostDiameterDecreasedCallback() const
Gets the callback that's called just after the '[' key is hit while a tool is selected (i....
virtual void setToolPreEditedCallback(const Callback &cb_)
Sets the callback that's called just before a tool is double-clicked in the toolbar (i....
virtual std::string fileName() const
Gets the name of the plugin file at runtime.
virtual Callback *const toolPostDraggedCallback() const
Gets the callback that's called just after the mouse button is down and the cursor moves (i....
virtual bool hasPostStartedUp() const
Gets whether the plugin has already completed post-starting up.
virtual void undo() const
Undoes the last set of artwork changes by this specific plugin.
virtual void setPrefsDialog(const ModalDialog &dialog_)
Sets the global prefs modal dialog for the plugin.
virtual Callback *const toolPreMouseDownCallback() const
Gets the callback that's called just before the mouse button goes down (i.e. the tool's mouse down ca...
virtual Callback *const preShutdownCallback() const
Gets the callback that's called just before the plugin will shutdown.
virtual Callback *const postStartupCallback() const
Gets the callback that's called just after the plugin has started up.
virtual void setPreShutdownCallback(const Callback &cb_)
Sets the callback that's called just before the plugin will shutdown.
virtual ModalDialog *const aboutBox() const
Gets the about box modal dialog for the plugin.
virtual void setToolsSnapToArt(const bool snap_)
Sets whether tools belonging to this plugin should snap the cursor to artwork.
virtual void setToolPostMouseUpCallback(const Callback &cb_)
Sets the callback that's called just after the mouse button comes up (i.e. the tool's mouse up callba...
virtual Callback *const toolPostDiameterIncreasedCallback() const
Gets the callback that's called just after the ']' key is hit while a tool is selected (i....
virtual Callback *const toolPreMouseUpCallback() const
Gets the callback that's called just before the mouse button comes up (i.e. the tool's mouse up callb...
virtual Callback *const toolPreDiameterIncreasedCallback() const
Gets the callback that's called just before the ']' key is hit while a tool is selected (i....
virtual void setName(const std::string &name_)
Sets the plugin name.
virtual void setToolPostMouseDownCallback(const Callback &cb_)
Sets the callback that's called just after the mouse button goes down (i.e. the tool's mouse down cal...
virtual Callback *const menuItemsUpdateCallback() const
Gets the callback that's called when a user hovers over menu groups that will show this plugin's menu...
virtual MenuItem *const prefsMenuItem() const
Gets the global prefs menu item for the plugin.
virtual Callback *const toolPostDeselectedCallback() const
Gets the callback that's called just after a tool is deselected (i.e. the tool's deselection callback...
virtual bool hasStartedUp() const
Gets whether the plugin has already completed starting up.
virtual bool resourceData(const int32_t type_, const std::string &name_, ByteVector &data__) const
Acquires a byte vector for a given resource.
virtual void setToolPostTrackedCallback(const Callback &cb_)
Sets the callback that's called just after the cursor moves (with the mouse button released; i....
virtual void setToolPreDraggedCallback(const Callback &cb_)
Sets the callback that's called just before the mouse button is down and the cursor moves (i....
virtual void setToolPreDiameterDecreasedCallback(const Callback &cb_)
Sets the callback that's called just before the '[' key is hit while a tool is selected (i....
virtual void setShutdownCallback(const Callback &cb_)
Sets the callback that's called when the plugin is shutting down.
virtual SPPluginRef spPluginRef() const
Gets the plugin ref around which the target object is wrapped.
virtual Callback *const toolPostMouseDownCallback() const
Gets the callback that's called just after the mouse button goes down (i.e. the tool's mouse down cal...
virtual void setAboutBox(const ModalDialog &dialog_)
Sets the about box modal dialog for the plugin.
virtual bool resourceData(const int32_t type_, const int16_t id_, ByteVector &data__) const
Acquires a byte vector for a given resource.
virtual bool toolsSnapToGrids() const
Gets whether tools belonging to this plugin should snap the cursor to the Illustrator gridlines.
virtual void setUndoRedoNames(const std::string &undo_, const std::string &redo_)
Sets the text for the Undo and Redo menu items, which Illustrator uses as needed.
virtual bool shuttingDown() const
Gets whether the plugin is in the process of shutting down.
virtual bool startingUp() const
Gets whether the plugin is in the process of starting up.
virtual bool toolsSnapToArt() const
Gets whether tools belonging to this plugin should snap the cursor to artwork.
virtual bool hasPreShutdown() const
Gets whether the plugin has already completed pre-shutting down.
virtual Callback *const toolPreSelectedCallback() const
Gets the callback that's called just before a tool is selected from the toolbar (i....
virtual Callback *const menuItemSelectedCallback() const
Gets the callback that's called when a user selects one of the plugin's menu items.
virtual void setToolPostReselectedCallback(const Callback &cb_)
Sets the callback that's called just after a tool is reselected (i.e. the tool's reselection callback...
virtual bool postStartingUp() const
Gets whether the plugin is in the process of post-starting up.
virtual Callback *const startupCallback() const
Gets the callback that's called when the plugin is starting up.
virtual bool setUndoKind(const UndoContext uc_)
Changes the undo context to another type.
virtual Callback *const shutdownCallback() const
Gets the callback that's called when the plugin is shutting down.
virtual void setToolsSnapToArtBounds(const bool snap_)
Sets whether tools belonging to this plugin should snap the cursor to artwork bounds.
virtual void setToolPreDiameterIncreasedCallback(const Callback &cb_)
Sets the callback that's called just before the ']' key is hit while a tool is selected (i....
virtual void setToolsSnapToGrids(const bool snap_)
Sets whether tools belonging to this plugin should snap the cursor to the Illustrator gridlines.
virtual Callback *const toolPostMouseUpCallback() const
Gets the callback that's called just after the mouse button comes up (i.e. the tool's mouse up callba...
virtual bool toolsSnapToArtboard() const
Gets whether tools belonging to this plugin should snap the cursor to the artboard edges.
virtual void setBrightnessAdjustedCallback(const Callback &cb_)
Sets the callback that's called when the brightness of the app UI is changed via the app preference d...
virtual void setToolPreDeselectedCallback(const Callback &cb_)
Sets the callback that's called just before a tool is deselected (i.e. the tool's deselection callbac...
virtual void setToolPostDiameterIncreasedCallback(const Callback &cb_)
Sets the callback that's called just after the ']' key is hit while a tool is selected (i....
virtual void setToolsSnapToArtboard(const bool snap_)
Sets whether tools belonging to this plugin should snap the cursor to the artboard edges.
virtual void setLoggingStream(const std::string &name_, std::ostream *const str_)
Sets the logging stream, by name, for debugging output for the plugin.
PlatformPluginPtr platformPlugin() const
Gets a pointer to the platform object representing the current Plugin instance.
virtual void setMenuItemsUpdateCallback(const Callback &cb_)
Sets the callback that's called when a user hovers over menu groups that will show this plugin's menu...
virtual Callback *const toolPostSelectedCallback() const
Gets the callback that's called just after a tool is selected from the toolbar (i....
virtual Callback *const toolPostTrackedCallback() const
Gets the callback that's called just after the cursor moves (with the mouse button released; i....
virtual Tool *const currentTool() const
Gets a pointer to the currently selected tool.
virtual Callback *const toolPreEditedCallback() const
Gets the callback that's called just before a tool is double-clicked in the toolbar (i....
virtual Dispatcher *const dispatcher() const
Convenience method to return the Dispatcher instance.
virtual Options options() const
Gets the plugin's options.
virtual std::string filePath() const
Gets the full path of the plugin file at runtime.
static Plugin *const instance()
Allows access to the singleton Plugin instance object.
virtual void setToolPreSelectedCallback(const Callback &cb_)
Sets the callback that's called just before a tool is selected from the toolbar (i....
friend __MainError() PluginMain(const char *, const char *, void *)
Main entry point for all plugins (required by Illustrator). This is called whenever a plugin should p...
virtual Callback *const brightnessAdjustedCallback() const
Gets the callback that's called when the brightness of the app UI is changed via the app preference d...
virtual void setToolPostDraggedCallback(const Callback &cb_)
Sets the callback that's called just after the mouse button is down and the cursor moves (i....
virtual MenuItem *const aboutMenuItem() const
Gets the about box menu item for the plugin.
virtual void setToolPostDiameterDecreasedCallback(const Callback &cb_)
Sets the callback that's called just after the '[' key is hit while a tool is selected (i....
Options
Allows for configuration of various plug-in behaviors.
Definition: hdicorePlugin.h:44
virtual void setOptions(const Options options_)
Sets the plugin's options.
virtual void setToolPostDeselectedCallback(const Callback &cb_)
Sets the callback that's called just after a tool is deselected (i.e. the tool's deselection callback...
virtual bool hasShutdown() const
Gets whether the plugin has already completed shutting down.
virtual Callback *const toolPreReselectedCallback() const
Gets the callback that's called just before a tool is reselected (i.e. the tool's reselection callbac...
virtual void setPostStartupCallback(const Callback &cb_)
Sets the callback that's called just after the plugin has started up.
virtual void setToolPreReselectedCallback(const Callback &cb_)
Sets the callback that's called just before a tool is reselected (i.e. the tool's reselection callbac...
UndoContext
Allows for setting of the undo context to other behaviors.
Definition: hdicorePlugin.h:54
virtual Callback *const toolPostEditedCallback() const
Gets the callback that's called just after a tool is double-clicked in the toolbar (i....
virtual Callback *const toolPostReselectedCallback() const
Gets the callback that's called just after a tool is reselected (i.e. the tool's reselection callback...
virtual void setAboutMenuItem(const MenuItem &mi_)
Sets the about box menu item for the plugin.
virtual Callback *const toolPreDeselectedCallback() const
Gets the callback that's called just before a tool is deselected (i.e. the tool's deselection callbac...
virtual std::ostream *const loggingStream(const std::string &name_) const
Gets a logging stream, by name, for debugging output for the plugin.
virtual bool toolsSnapToArtBounds() const
Gets whether tools belonging to this plugin should snap the cursor to artwork bounds.
virtual void setToolPreTrackedCallback(const Callback &cb_)
Sets the callback that's called just before the cursor moves (with the mouse button released; i....
virtual bool preShuttingDown() const
Gets whether the plugin is in the process of pre-shutting down.
virtual Callback *const toolPreTrackedCallback() const
Gets the callback that's called just before the cursor moves (with the mouse button released; i....
virtual void setToolPostSelectedCallback(const Callback &cb_)
Sets the callback that's called just after a tool is selected from the toolbar (i....
virtual void setStartupCallback(const Callback &cb_)
Sets the callback that's called when the plugin is starting up.
virtual std::string name() const
Gets the plugin name.
virtual Callback *const toolPreDiameterDecreasedCallback() const
Gets the callback that's called just before the '[' key is hit while a tool is selected (i....
virtual Callback *const toolPreDraggedCallback() const
Gets the callback that's called just before the mouse button is down and the cursor moves (i....
virtual ModalDialog *const prefsDialog() const
Gets the global prefs modal dialog for the plugin.
virtual void setToolPreMouseDownCallback(const Callback &cb_)
Sets the callback that's called just before the mouse button goes down (i.e. the tool's mouse down ca...
virtual void setPrefsMenuItem(const MenuItem &mi_)
Sets the global prefs menu item for the plugin.
virtual void setToolPreMouseUpCallback(const Callback &cb_)
Sets the callback that's called just before the mouse button comes up (i.e. the tool's mouse up callb...
Base class for all tools; stores hit data, cursor loc, dialogs, etc.; receives tool-related messages.
Definition: hdicoreTool.h:35
Header file for various plugin entry points.