-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFMPluginHandlers.cpp
More file actions
150 lines (128 loc) · 5.03 KB
/
Copy pathFMPluginHandlers.cpp
File metadata and controls
150 lines (128 loc) · 5.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#include "FMPlugin.h"
#include "FMTemplate/FMTemplate.h"
////////////////////////////////////////////////////////////////////////////////
//
// Startup()
//
/////////////////////////////////////////////////////////////////////////////
//
// This function will get called once each time your plug-in needs to be
// initialized. That is during the FileMaker application startup, or right
// after clicking on the checkbox that enables your plug-in in the
// application's Preferences dialog.
//
// If your plug-in has any software or hardware requirements that might
// not be met, you should perform the necessary environment check here,
// and disable the plug-in if the environment is not sufficient.
//
// Return TRUE as a result from this function to enable the plug-in.
// If you decide that the plug-in should be disabled, return FALSE.
//
FMX_Boolean Startup()
{
FMX_Boolean enable = TRUE; // Enable the plug-in by default
// Write your initialization/environment check code here.
// Set the enable variable to FALSE if you want to disable the plug-in.
return enable; // Return TRUE to enable the plug-in
}
////////////////////////////////////////////////////////////////////////////////
//
// Shutdown()
//
/////////////////////////////////////////////////////////////////////////////
//
// When user disables your plug-in in the application's Preferences dialog
// or when he quits the FileMaker application, this will be the last function
// that will get called.
//
// If your plug-in allocates any system resources, such as memory, that
// remain allocated across multiple calls to the plug-in's functions, you
// should release the resources and perform any necessary cleanup in this
// function.
//
// Keep in mind that once deactivated, your plug-in can be re-activated
// in the application's Preferences dialog, so make sure you recover the
// plug-in into exactly the same state it was before getting activated for
// the first time.
//
// This function does not take any input parameters nor does it have to
// return any value as a result.
//
void Shutdown()
{
// Write your shutdown/cleanup code here.
// Don't forget to release any occupied system resources.
}
////////////////////////////////////////////////////////////////////////////////
//
// Preferences()
//
/////////////////////////////////////////////////////////////////////////////
//
// If you set the WANT_PREFERENCES constant in the FMTConfig.h file to 1,
// your plug-in will have an enabled "Configure..." button in the Plug-In
// pane of the application's Preferences dialog. When a user clicks on that
// button, the following function will get called. After then, you are
// supposed to display your plug-in's preferences dialog to let user modify
// your plug-in's preferences.
//
// If you don't want to use any user-configurable values in your plug-in,
// you should set the WANT_PREFERENCES constant to 0. Then the following
// function should never get called. Anyway, it is still a good idea to at
// least beep or display an error message in here, just for the case you
// forget to set the WANT_PREFERENCES constant to 0.
//
// This function does not take any input parameters nor does it have to
// return any value as a result.
//
#if WANT_PREFERENCES
void Preferences()
{
//XPLAT_ALERT("This plug-in does not have any configurable options");
}
#endif //WANT_PREFERENCES
////////////////////////////////////////////////////////////////////////////////
//
// SafeIdle()
// SemiSafeidle(idleLevel)
// UnsafeIdle()
//
/////////////////////////////////////////////////////////////////////////////
//
// If the WANT_IDLE constant is set to 1 in the FMTConfig.h file, and if
// your plug-in is enabled, these three functions will get called
// periodically when the FileMaker application has nothing else to do.
// There is no control over how often this will happen, so you should not
// rely on any specific frequency. Which of the three functions will actually
// get called depends on the current idle level.
//
// You can put any idle processing in the SafeIdle function, such as
// background activity, scheduled actions, etc., but you should return
// the control to FileMaker quickly as it is stuck while you are doing
// your idle processing. In general you have to be very careful about doing
// something in the SemiSafeIdle function and you should not have a reason
// to do anything in the UnsafeIdle function.
//
#if WANT_IDLE
void SafeIdle()
{
// The plug-in is at user idle time and can do idle processing
}
void SemiSafeIdle(FMX_IdleLevel idleLevel)
{
// FileMaker was nice to give you some processing time but it is
// doing something, so be careful and return as soon as possible
// Check idle state
switch (idleLevel)
{
case kFMXT_UserNotIdle:
case kFMXT_ScriptPaused:
case kFMXT_ScriptRunning:
break;
};// switch idleLevel
}
void UnsafeIdle()
{
// The plug-in should wait and do nothing at this time.
}
#endif //WANT_IDLE