TuttleOFX
1
|
00001 #ifndef _ofxMessage_h_ 00002 #define _ofxMessage_h_ 00003 00004 #include "ofxCore.h" 00005 00006 /* 00007 * Software License : 00008 * 00009 * Copyright (c) 2003-2009, The Open Effects Association Ltd. All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions are met: 00013 * 00014 * Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * Neither the name The Open Effects Association Ltd, nor the names of its 00020 * contributors may be used to endorse or promote products derived from this 00021 * software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00024 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00025 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00026 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00027 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00028 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00029 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00030 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00032 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 #define kOfxMessageSuite "OfxMessageSuite" 00041 00042 00043 /** @brief String used to type fatal error messages 00044 * 00045 * Fatal error messages should only be posted by a plugin when it can no longer continue operation. 00046 */ 00047 #define kOfxMessageFatal "OfxMessageFatal" 00048 00049 /** @brief String used to type error messages 00050 * 00051 * Ordinary error messages should be posted when there is an error in operation that is recoverable by 00052 * user intervention. 00053 */ 00054 #define kOfxMessageError "OfxMessageError" 00055 00056 /** @brief String used to type warning messages 00057 * 00058 * Warnings indicate states that allow for operations to proceed, but are not necessarily optimal. 00059 */ 00060 #define kOfxMessageWarning "OfxMessageWarning" 00061 00062 /** @brief String used to type simple ordinary messages 00063 * 00064 * Ordinary messages simply convey information from the plugin directly to the user. 00065 */ 00066 #define kOfxMessageMessage "OfxMessageMessage" 00067 00068 /** @brief String used to type log messages 00069 * 00070 * Log messages are written out to a log and not to the end user. 00071 */ 00072 #define kOfxMessageLog "OfxMessageLog" 00073 00074 /** @brief String used to type yes/no messages 00075 * 00076 * The host is to enter a modal state which waits for the user to respond yes or no. 00077 * The OfxMessageSuiteV1::message function which posted the message will only return after 00078 * the user responds. When asking a question, the OfxStatus code returned by the message function will be, 00079 * - kOfxStatReplyYes - if the user replied 'yes' to the question 00080 * - kOfxStatReplyNo - if the user replied 'no' to the question 00081 * - some error code if an error was encounterred 00082 * 00083 * It is an error to post a question message if the plugin is not in an interactive session. 00084 */ 00085 #define kOfxMessageQuestion "OfxMessageQuestion" 00086 00087 /** @brief The OFX suite that allows a plug-in to pass messages back to a user. The V2 suite extends on this 00088 in a backwards compatible manner. 00089 */ 00090 typedef struct OfxMessageSuiteV1 { 00091 00092 /** @brief Post a message on the host, using printf style varargs 00093 * 00094 * \arg handle - effect handle (descriptor or instance) the message should be associated with, may be null 00095 * \arg messageType - string describing the kind of message to post, one of the kOfxMessageType* constants 00096 * \arg messageId - plugin specified id to associate with this message. If overriding the message in XML resource, the message is identified with this, this may be NULL, or "", in which case no override will occur, 00097 * \arg format - printf style format string 00098 * \arg ... - printf style varargs list to print 00099 * 00100 * \returns 00101 * - ::kOfxStatOK - if the message was sucessfully posted 00102 * - ::kOfxStatReplyYes - if the message was of type kOfxMessageQuestion and the user reply yes 00103 * - ::kOfxStatReplyNo - if the message was of type kOfxMessageQuestion and the user reply no 00104 * - ::kOfxStatFailed - if the message could not be posted for some reason 00105 * 00106 */ 00107 OfxStatus ( *message )( void* handle, 00108 const char* messageType, 00109 const char* messageId, 00110 const char* format, 00111 ... ); 00112 00113 } OfxMessageSuiteV1; 00114 00115 /** @brief The OFX suite that allows a plug-in to pass messages back to a user. 00116 * 00117 * This extends OfxMessageSuiteV1, and should be considered a replacement to version 1. 00118 * 00119 * Note that this suite has been extended in backwards compatible manner, so that a host can return this struct 00120 * for both V1 and V2. 00121 */ 00122 typedef struct OfxMessageSuiteV2 { 00123 00124 /** @brief Post a transient message on the host, using printf style varargs. Same as the V1 message suite call. 00125 * 00126 * \arg handle - effect handle (descriptor or instance) the message should be associated with, may be null 00127 * \arg messageType - string describing the kind of message to post, one of the kOfxMessageType* constants 00128 * \arg messageId - plugin specified id to associate with this message. If overriding the message in XML resource, the message is identified with this, this may be NULL, or "", in which case no override will occur, 00129 * \arg format - printf style format string 00130 * \arg ... - printf style varargs list to print 00131 * 00132 * \returns 00133 * - ::kOfxStatOK - if the message was sucessfully posted 00134 * - ::kOfxStatReplyYes - if the message was of type kOfxMessageQuestion and the user reply yes 00135 * - ::kOfxStatReplyNo - if the message was of type kOfxMessageQuestion and the user reply no 00136 * - ::kOfxStatFailed - if the message could not be posted for some reason 00137 */ 00138 OfxStatus (*message)(void *handle, 00139 const char *messageType, 00140 const char *messageId, 00141 const char *format, 00142 ...); 00143 00144 /** @brief Post a persistent message on an effect, using printf style varargs, and set error states. New for V2 message suite. 00145 * 00146 * \arg handle - effect instance handle the message should be associated with, may NOT be null, 00147 * \arg messageType - string describing the kind of message to post, should be one of... 00148 * - kOfxMessageError 00149 * - kOfxMessageWarning 00150 * - kOfxMessageMessage 00151 * \arg messageId - plugin specified id to associate with this message. If overriding the message in XML resource, the message is identified with this, this may be NULL, or "", in which case no override will occur, 00152 * \arg format - printf style format string 00153 * \arg ... - printf style varargs list to print 00154 * 00155 * \returns 00156 * - ::kOfxStatOK - if the message was sucessfully posted 00157 * - ::kOfxStatErrBadHandle - the handle was rubbish 00158 * - ::kOfxStatFailed - if the message could not be posted for some reason 00159 * 00160 * Persistent messages are associated with an effect handle until explicitly cleared by an effect. So if an error message is posted the error state, and associated message will persist and be displayed on the effect appropriately. (eg: draw a node in red on a node based compostor and display the message when clicked on). 00161 * 00162 * If \e messageType is error or warning, associated error states should be flagged on host applications. Posting an error message implies that the host cannot proceeed, a warning allows the host to proceed, whilst a simple message should have no stop anything. 00163 */ 00164 OfxStatus (*setPersistentMessage)(void *handle, 00165 const char *messageType, 00166 const char *messageId, 00167 const char *format, 00168 ...); 00169 00170 00171 /** @brief Clears any persistent message on an effect handle that was set by OfxMessageSuiteV2::setPersistentMessage. New for V2 message suite. 00172 * 00173 * \arg handle - effect instance handle messages should be cleared from. 00174 * \arg handle - effect handle (descriptor or instance) 00175 * 00176 * \returns 00177 * - ::kOfxStatOK - if the message was sucessfully cleared 00178 * - ::kOfxStatErrBadHandle - the handle was rubbish 00179 * - ::kOfxStatFailed - if the message could not be cleared for some reason 00180 * 00181 * Clearing a message will clear any associated error state. 00182 */ 00183 OfxStatus (*clearPersistentMessage)(void *handle); 00184 00185 } OfxMessageSuiteV2; 00186 00187 /** @file ofxMessage.h 00188 * This file contains the Host API for end user message communication. 00189 */ 00190 00191 #ifdef __cplusplus 00192 } 00193 #endif 00194 00195 #endif