00001 #include <stdio.h>
00002 #include <stdarg.h>
00003 #include "vapiOperation.h"
00004 #include "vapiAux.h"
00005 #include "vapiTypes.h"
00006 #include "vapiOptionsSet.h"
00007
00012 vEffect *
00013 vapiOperationInit (const char *name, const char *Group,
00014 vOperationFunction func)
00015 {
00016
00017 vEffect *Operation = malloc (sizeof (vEffect));
00018 vEffectSettings *CustomOptionsSettings =
00019 malloc (sizeof (vEffectSettings));
00020 Operation->OptionsSettings = vapiOptionsSettingsInit ();
00021 Operation->OptionsSettings->CustomOptionsSettings =
00022 CustomOptionsSettings;
00023
00024 Operation->name = vapiReturnStringPointer (name);
00025 Operation->Group = vapiReturnStringPointer (Group);
00026 Operation->briefDescription = vapiReturnStringPointer (" ");
00027 Operation->longDescription = vapiReturnStringPointer (" ");
00028 Operation->func = func;
00029
00030
00031
00032 CustomOptionsSettings->HasOriginalOption = vFALSE;
00033 CustomOptionsSettings->MacrosNumber = 0;
00034 CustomOptionsSettings->runSeveralTimes = vFALSE;
00035 CustomOptionsSettings->NeedOfAuxImage = NoNeed;
00036 CustomOptionsSettings->repeatInside = vFALSE;
00037
00038 return Operation;
00039 }
00040
00041 void
00042 vapiOperationSettingsSetInt (vEffect * Operation, const char *name,
00043 const char *description, int min, int max,
00044 int defaultValue, int scale,
00045 vInterfaceType interfaceType)
00046 {
00047 vapiOptionsSetInt (Operation->OptionsSettings, name,
00048 description, min, max,
00049 defaultValue, scale, interfaceType);
00050 }
00051
00052 void
00053 vapiOperationSettingsSetFloat (vEffect * Operation, const char *name,
00054 const char *description, double min,
00055 double max, double defaultValue, double scale,
00056 vInterfaceType interfaceType)
00057 {
00058 vapiOptionsSetFloat (Operation->OptionsSettings, name,
00059 description, min,
00060 max, defaultValue, scale, interfaceType);
00061 }
00062
00063 void
00064 vapiOperationSettingsSetBoolean (vEffect * Operation, const char *name,
00065 const char *description,
00066 vBoolean defaultValue)
00067 {
00068 vapiOptionsSetBoolean (Operation->OptionsSettings, name,
00069 description, defaultValue);
00070
00071 }
00072
00073 void
00074 vapiOperationSettingsSetChoose (vEffect * Operation,
00075 const char *name, const char *description,
00076 int numberOfChoices, int defaultOption, ...)
00077 {
00078 va_list choices;
00079 va_start (choices, defaultOption);
00080 vapiOptionsSetChoose (Operation->OptionsSettings,
00081 name, description,
00082 numberOfChoices, defaultOption, choices);
00083 va_end (choices);
00084 }
00085
00086 void
00087 vapiOperationSettingsSetChar (vEffect * Operation, const char *name,
00088 const char *description)
00089 {
00090 vapiOptionsSetChar (Operation->OptionsSettings, name, description);
00091 }
00092
00093 void
00094 vapiOperationSettingsSetNeedOfAuxImage (vEffect * Operation,
00095 int NeedOfAuxImage)
00096 {
00097 ((vEffectSettings *) Operation->OptionsSettings->
00098 CustomOptionsSettings)->NeedOfAuxImage = NeedOfAuxImage;
00099 }
00100
00101 void
00102 vapiOperationSettingsSetRepeatInside (vEffect * Operation)
00103 {
00104 ((vEffectSettings *) Operation->OptionsSettings->
00105 CustomOptionsSettings)->repeatInside = vTRUE;
00106 }
00107
00108 void
00109 vapiOperationSettingsSetRunSeveralTimes (vEffect * Operation)
00110 {
00111 ((vEffectSettings *) Operation->OptionsSettings->
00112 CustomOptionsSettings)->runSeveralTimes = vTRUE;
00113 }
00114
00115 void
00116 vapiOperationSettingsSetMacros (vEffect * Operation, int MacrosNumber)
00117 {
00118 ((vEffectSettings *) Operation->OptionsSettings->
00119 CustomOptionsSettings)->MacrosNumber = MacrosNumber;
00120 }
00121
00122 void
00123 vapiOperationSettingsSetHasOriginalOption (vEffect * Operation)
00124 {
00125 ((vEffectSettings *) Operation->OptionsSettings->
00126 CustomOptionsSettings)->HasOriginalOption = vTRUE;
00127 }
00128
00129 void
00130 vapiOperationSettingsSetOperationBriefDescription (vEffect * Operation,
00131 const char
00132 *briefDescription)
00133 {
00134 free (Operation->briefDescription);
00135 Operation->briefDescription =
00136 vapiReturnStringPointer (briefDescription);
00137 }
00138
00139 void
00140 vapiOperationSettingsSetOperationLongDescription (vEffect * Operation,
00141 const char *longDescription)
00142 {
00143 free (Operation->longDescription);
00144 Operation->longDescription =
00145 vapiReturnStringPointer (longDescription);
00146 }