00001 #include "vapiGtkInterface.h" 00002 #include "vapiAux.h" 00003 #include "vapiImagesAux.h" 00004 #include "vapiOperationOptions.h" 00005 #include "vapiGtkAux.h" 00006 #include "vapiOperationsDefault.h" 00007 #include "vapiOperationOptions.h" 00008 #include "vapiGtkOptions.h" 00009 #include "vapiGtkOptionsOperations.h" 00010 #include "vapiGtkMemory.h" 00011 #include "vapiGtkEventsMacros.h" 00012 00013 void 00014 vapiGtkOperationApply (GtkWidget * widget, vapiTemp1Struct * temp) 00015 { 00016 vapiWidgetStruct *Widgets = temp->Widgets; 00017 vOptions *options; 00018 vEffect *Operation; 00019 vMacroResult *FakePreviousResult; 00020 vImages *tempImages; 00021 Operation = 00022 vapiGetOperationFromTxtOperation (temp->Widgets->txtOperation, 00023 temp->OperationList); 00024 if (vapiGtkAuxCheckOperation (Operation)) 00025 { 00026 return; 00027 } 00028 options = vapiOperationOptionsInit (Operation); 00029 vapiGtkOptionsGetOptions (options, Operation->OptionsSettings, 00030 &vapiGtkOptionsGetOptionsCustomOperations, 00031 &temp->Widgets->OptionsData); 00032 if (vapiCheckOperations 00033 (Operation, options, (vMacroList *) temp->MacroList)) 00034 { 00035 vOperationOptionsFree (options, Operation); 00036 return; 00037 } 00038 tempImages = vImagesInit (); 00039 tempImages->Original = temp->Images->Original; 00040 tempImages->Actual = vapiImagesSameSize (temp->Images->Actual, 0); 00041 cvCopy (temp->Images->Actual, tempImages->Actual, NULL); 00042 00043 FakePreviousResult = vapiMacroResultInit (); 00044 00045 00046 vapiApplyOperation (tempImages, Operation, options, 00047 FakePreviousResult); 00048 00049 vapiGtkMemoryFreeImWork ((IplImage *) temp->imWork); 00050 temp->imWork = tempImages->Actual; 00051 00052 vapiGtkPutImage (Widgets->imActual, tempImages->Actual); 00053 vapiGtkPutImage (Widgets->imWork, temp->Images->Actual); 00054 00055 free (tempImages); 00056 vOperationOptionsFree (options, Operation); 00057 vResultFree (FakePreviousResult); 00058 } 00059 00060 00061 void 00062 vapiGtkOperationShowOptions (GtkWidget * widget, vapiTemp1Struct * temp) 00063 { 00064 vMacroItem *FakeItem; 00065 vOptions *FakeOptions; 00066 GList **Lists[3]; 00067 00068 Lists[0] = &temp->Widgets->OptionsList; 00069 Lists[1] = &temp->Widgets->OptionsData; 00070 Lists[2] = &temp->Widgets->OptionsEvents; 00071 00072 FakeItem = malloc (sizeof (vMacroItem)); 00073 00074 FakeItem->Operation = 00075 vapiGetOperationFromTxtOperation (temp->Widgets->txtOperation, 00076 temp->OperationList); 00077 00078 if (FakeItem->Operation == NULL) 00079 { 00080 vapiGtkMemoryFreeOptionsFrame (temp); 00081 free (FakeItem); 00082 return; 00083 } 00084 00085 FakeOptions = vapiOperationOptionsInit (FakeItem->Operation); 00086 00087 FakeItem->Options = FakeOptions; 00088 00089 vapiGtkOptionsCreate (temp->Widgets->OptionsParent, 00090 &temp->Widgets->OptionsFrame, Lists, 00091 FakeOptions, 00092 FakeItem->Operation->OptionsSettings, 00093 &vapiGtkOptionsCreateCustomOperations, 00094 G_CALLBACK (vapiGtkOperationApply), temp); 00095 00096 vapiGtkOptionsPopulate (FakeItem->Options, 00097 FakeItem->Operation->OptionsSettings, Lists, 00098 &vapiGtkOptionsPopulateCustomOperations); 00099 00100 vOperationOptionsFree (FakeOptions, FakeItem->Operation); 00101 00102 free (FakeItem); 00103 }