src/interface/vapiGtkMacro.c

Ir para a documentação deste ficheiro.
00001 #include <gtk/gtk.h>
00002 #include "vapiMacro.h"
00003 #include "vapiGtkMacro.h"
00004 #include "vapiGtkInterface.h"
00005 #include "vapiImagesAux.h"
00006 #include "vapiImages.h"
00007 #include "vapiGtkImages.h"
00008 #include "vapiMacroList.h"
00009 #include "vapiMacroXML.h"
00010 #ifndef VAPI_WITHOUT_INTERFACE
00011 #include "vapiGtkEventsMacros.h"
00012 #endif
00013 
00014 void
00015 vapiGtkApplyMacroThread (vMacroThread * MacroThread)
00016 {
00017         vImages *tempImages = vImagesInit ();
00018 
00019         tempImages = vapiImagesAuxCloneImages (MacroThread->Images);
00020         vapiApplyMacro (MacroThread->MacroHeader, tempImages, vTRUE, vFALSE);
00021         vapiGtkMacroRunningStop ();
00022         vapiImagesSetActual (MacroThread->Images, tempImages->Actual);
00023         vapiImagesSetOriginal (MacroThread->Images, tempImages->Original);
00024         free (tempImages);
00025         g_thread_exit (NULL);
00026 }
00027 
00028 vMacroThread *
00029 vapiGtkMacroThreadNew (vMacroHeader * MacroHeader, vImages * Images)
00030 {
00031         vMacroThread *MacroThread = malloc (sizeof (vMacroThread));
00032         MacroThread->Images = Images;
00033         MacroThread->MacroHeader = MacroHeader;
00034         return MacroThread;
00035 }
00036 
00037 vBoolean
00038 vapiGtkMacroCheckSelected ()
00039 {
00040         if (!(SelectedMacro >= 0))
00041         {
00042                 v_error_ui ("Não foi seleccionada nenhuma Macro");
00043                 return vTRUE;
00044         }
00045         return vFALSE;
00046 }
00047 
00048 gboolean
00049 vapiGtkMacroTestXMLFileOpen (const GtkFileFilterInfo * filter_info,
00050                              gpointer data)
00051 {
00052         if (g_strrstr (filter_info->filename, ".xml") == NULL)
00053         {
00054                 return FALSE;
00055         }
00056         if (vapiMacroFromXMLSetName (filter_info->filename) == NULL)
00057         {
00058                 return FALSE;
00059         }
00060         else
00061         {
00062                 return TRUE;
00063         }
00064 }
00065 
00066 gboolean
00067 vapiGtkMacroTestXMLFileSave (const GtkFileFilterInfo * filter_info,
00068                              gpointer data)
00069 {
00070         if (g_strrstr (filter_info->filename, ".xml") == NULL)
00071         {
00072                 return FALSE;
00073         }
00074         else
00075         {
00076                 return TRUE;
00077         }
00078 }
00079 
00080 
00081 GtkFileFilter *
00082 vapiGtkMacroFileFilterOpen ()
00083 {
00084         GtkFileFilter *MacroFileFilter = gtk_file_filter_new ();
00085         gtk_file_filter_add_pattern (MacroFileFilter, "*.xml");
00086 
00087         gtk_file_filter_set_name (MacroFileFilter, "Vapi Macro *.xml");
00088 
00089 
00090         gtk_file_filter_add_custom (MacroFileFilter,
00091                                     GTK_FILE_FILTER_FILENAME,
00092                                     &vapiGtkMacroTestXMLFileOpen, NULL, NULL);
00093 
00094         return MacroFileFilter;
00095 }
00096 
00097 GtkFileFilter *
00098 vapiGtkMacroFileFilterSave ()
00099 {
00100         GtkFileFilter *MacroFileFilter = gtk_file_filter_new ();
00101         gtk_file_filter_add_pattern (MacroFileFilter, "*.xml");
00102 
00103         gtk_file_filter_set_name (MacroFileFilter, "Vapi Macro *.xml");
00104         gtk_file_filter_add_custom (MacroFileFilter,
00105                                     GTK_FILE_FILTER_FILENAME,
00106                                     &vapiGtkMacroTestXMLFileSave, NULL, NULL);
00107 
00108         return MacroFileFilter;
00109 }
00110 
00111 void
00112 vapiGtkApplyMacroUntilThread (vMacroThread * MacroThread)
00113 {
00114         vImages *tempImages = vImagesInit ();
00115 
00116         tempImages = vapiImagesAuxCloneImages (MacroThread->Images);
00117 
00118         vapiApplyMacroUntil (MacroThread->MacroHeader, tempImages,
00119                              MacroThread->Until);
00120         vapiGtkMacroRunningStop ();
00121         free (tempImages);
00122         g_thread_exit (NULL);
00123 }

Gerado em Tue Jul 24 10:34:58 2007 para Vapi por  doxygen 1.5.1