00001 #include "vapiGtkInterface.h"
00002 #include "vapiAux.h"
00003 #include "vapiGtkAux.h"
00004 #include "vapiGtkAuxWindow.h"
00005 #include "vapiMacroXML.h"
00006 #include "vapiGtkEventsOperations.h"
00007 #include "vapiGtkEventsMacros.h"
00008 #include "vapiGtkMacrosTables.h"
00009 #include "vapiGtkMacro.h"
00010
00018 void
00019 vapiGtkConnectEvents (vapiWidgetStruct * Widgets, vImages * Images,
00020 vCameraSettings * CameraSettings,
00021 vOperationList * OperationList, vMacroList * MacroList,
00022 GladeXML * xml)
00023 {
00024 vapiTemp1Struct *temp1 = malloc (sizeof (vapiTemp1Struct));
00025 vRefreshImage *RefreshImage = malloc (sizeof (vRefreshImage));
00026 vapiCalibrateCamera *calibrateCamera =
00027 malloc (sizeof (vapiCalibrateCamera));
00028 vapiCalibrateCameraCalculate *CalibrateCameraCalculate =
00029 malloc (sizeof (vapiCalibrateCameraCalculate));
00030 vapiGtkGetCoordinates *GetCoordinates;
00031
00032 GtkWidget *btApply;
00033 GtkWidget *btApplyMacro;
00034 GtkWidget *btOriginalImage;
00035 GtkWidget *btMatch;
00036 GtkWidget *btSaveImage;
00037 GtkWidget *btMacroDelete;
00038 GtkWidget *btMacroItemChange;
00039 GtkWidget *btAddMacroItem;
00040 GtkWidget *btAddMacroItemHere;
00041 GtkWidget *btDeleteMacroItem;
00042 GtkWidget *btMoveMacroItem;
00043 GtkWidget *btRefresh;
00044 GtkWidget *btSaveWorkImage;
00045 GtkWidget *toolbar;
00046 GtkWidget *cbMenuToolbarNames;
00047 GtkWidget *menuRefresh;
00048 GtkWidget *menuOriginal;
00049 GtkWidget *ebImWork;
00050 GtkWidget *ebImOriginal;
00051 GtkWidget *ebImActual;
00052 GtkWidget *ebSelectTemplate;
00053 GtkWidget *ebSelectRegion;
00054 GtkWidget *btSaveTemplate;
00055 GtkWidget *btSelectRegion;
00056 GtkWidget *winCalibrateCamera;
00057 GtkWidget *btCalibrateCamera;
00058 GtkWidget *btCalibrateTestDefinitions;
00059 GtkWidget *rbMenuCasosPatternMatchOk;
00060 GtkWidget *rbMenuCasosPatternMatchNOk1;
00061 GtkWidget *rbMenuCasosPatternMatchNOk2;
00062 GtkWidget *rbMenuCasosPatternSearchNOk;
00063 GtkWidget *rbMenuCasosPatternSearchOk;
00064 GtkWidget *btSaveOrigin;
00065
00066 vapi_loading_progress ("A definir estruturas Auxiliares");
00067
00068 GetCoordinates = malloc (sizeof (vapiGtkGetCoordinates));
00069
00070 GetCoordinates->Vertice[0].x = -1;
00071 GetCoordinates->Vertice[0].y = -1;
00072 GetCoordinates->Vertice[1].x = -1;
00073 GetCoordinates->Vertice[1].y = -1;
00074 GetCoordinates->Images = Images;
00075 GetCoordinates->imSelectTemplate = Widgets->imSelectTemplate;
00076 GetCoordinates->imSelectRegion = Widgets->imSelectRegion;
00077 temp1->CameraSettings = CameraSettings;
00078
00079 calibrateCamera->Images = Images;
00080 CalibrateCameraCalculate->CameraSettings = CameraSettings;
00081
00082 CalibrateCameraCalculate->xml = xml;
00083 CalibrateCameraCalculate->OperationList = OperationList;
00084 CalibrateCameraCalculate->Images = Images;
00085
00086
00087 temp1->Widgets = Widgets;
00088 temp1->Images = Images;
00089 temp1->OperationList = OperationList;
00090
00091 SelectedMacro = -1;
00092 SelectedMacroGlobal = -1;
00093
00094 temp1->GetCoordinates = GetCoordinates;
00095 temp1->MacroList = MacroList;
00096
00097
00098
00099 temp1->Widgets->OptionsFrame = 0;
00100 temp1->Widgets->OptionsList = NULL;
00101 temp1->Widgets->OptionsData = NULL;
00102
00103 RefreshImage->Temp = temp1;
00104
00105
00106
00107 temp1->imWork = NULL;
00108
00109
00110
00111
00112 ebImWork = glade_xml_get_widget (xml, "ebImWork");
00113 ebImOriginal = glade_xml_get_widget (xml, "ebOriginal");
00114 ebImActual = glade_xml_get_widget (xml, "ebImActual");
00115 ebSelectTemplate = glade_xml_get_widget (xml, "ebSelectTemplate");
00116 ebSelectRegion = glade_xml_get_widget (xml, "ebSelectRegion");
00117 GetCoordinates->stTemplateWindow =
00118 glade_xml_get_widget (xml, "stTemplateWindow");
00119 GetCoordinates->stSelectRegion =
00120 glade_xml_get_widget (xml, "stSelectRegion");
00121 GetCoordinates->txtTemplateFilename =
00122 glade_xml_get_widget (xml, "txtTemplateFilename");
00123 btSaveTemplate = glade_xml_get_widget (xml, "btSaveTemplate");
00124 btSelectRegion = glade_xml_get_widget (xml, "btSelectRegion");
00125 btApply = glade_xml_get_widget (xml, "Apply");
00126 btApplyMacro = glade_xml_get_widget (xml, "btApplyMacro");
00127 btMatch = glade_xml_get_widget (xml, "btMatch");
00128 btSaveImage = glade_xml_get_widget (xml, "btSaveImage");
00129 btMacroDelete = glade_xml_get_widget (xml, "btMacroDelete");
00130 btMacroItemChange = glade_xml_get_widget (xml, "btMacroItemChange");
00131 btOriginalImage = glade_xml_get_widget (xml, "btOriginalImage");
00132 btAddMacroItem = glade_xml_get_widget (xml, "btAddMacroItem");
00133 btAddMacroItemHere = glade_xml_get_widget (xml, "btAddMacroItemHere");
00134 btDeleteMacroItem = glade_xml_get_widget (xml, "btDeleteMacroItem");
00135 btMoveMacroItem = glade_xml_get_widget (xml, "btMoveMacroItem");
00136 btRefresh = glade_xml_get_widget (xml, "btRefresh");
00137 btSaveWorkImage = glade_xml_get_widget (xml, "btSaveWorkImage");
00138 menuRefresh = glade_xml_get_widget (xml, "menuRefresh");
00139 menuOriginal = glade_xml_get_widget (xml, "menuOriginal");
00140 toolbar = glade_xml_get_widget (xml, "toolbar");
00141 cbMenuToolbarNames = glade_xml_get_widget (xml, "cbMenuToolbarNames");
00142 winCalibrateCamera = glade_xml_get_widget (xml, "winCalibrateCamera");
00143 calibrateCamera->ImCalibrateOriginal =
00144 glade_xml_get_widget (xml, "imCalibrateOriginal");
00145 btCalibrateCamera = glade_xml_get_widget (xml, "btCalibrateCamera");
00146 btCalibrateTestDefinitions =
00147 glade_xml_get_widget (xml, "btCalibrateTestDefinitions");
00148 rbMenuCasosPatternMatchOk =
00149 glade_xml_get_widget (xml, "rbMenuCasosPatternMatchOk");
00150 rbMenuCasosPatternMatchNOk1 =
00151 glade_xml_get_widget (xml, "rbMenuCasosPatternMatchNOk1");
00152 rbMenuCasosPatternMatchNOk2 =
00153 glade_xml_get_widget (xml, "rbMenuCasosPatternMatchNOk2");
00154 rbMenuCasosPatternSearchOk =
00155 glade_xml_get_widget (xml, "rbMenuCasosPatternSearchOk");
00156 rbMenuCasosPatternSearchNOk =
00157 glade_xml_get_widget (xml, "rbMenuCasosPatternSearchNOk");
00158 btSaveOrigin = glade_xml_get_widget (xml, "btSaveOrigin");
00159
00160
00161
00162
00163
00164 vapi_loading_progress ("A definir Eventos da interface");
00165
00166
00167
00168
00169 vapiGtkWindowCalibrateCameraInitEvents (xml);
00170
00171
00172
00173
00174 g_signal_connect (G_OBJECT (btApply), "clicked",
00175 G_CALLBACK (vapiGtkOperationApply), temp1);
00176
00177 g_signal_connect (G_OBJECT (btApplyMacro), "clicked",
00178 G_CALLBACK (vapiGtkMacroApply), temp1);
00179
00180 g_signal_connect (G_OBJECT (Widgets->cbCam), "clicked",
00181 G_CALLBACK (vapiRefreshImageThread), RefreshImage);
00182
00183 g_signal_connect (G_OBJECT (Widgets->cbCam),
00184 "clicked", G_CALLBACK (vapiCamStop), RefreshImage);
00185
00186 g_signal_connect (G_OBJECT (Widgets->txtOperation), "changed",
00187 G_CALLBACK (vapiGtkOperationShowOptions), temp1);
00188
00189 g_signal_connect (G_OBJECT (btSaveImage), "clicked",
00190 G_CALLBACK (vapiGtkSaveImage), temp1->Images);
00191
00192 g_signal_connect (G_OBJECT (btAddMacroItem), "clicked",
00193 G_CALLBACK (vapiGtkMacroAppendItem), temp1);
00194
00195 g_signal_connect (G_OBJECT (btAddMacroItemHere), "clicked",
00196 G_CALLBACK (vapiGtkMacroInsertItem), temp1);
00197
00198 g_signal_connect (G_OBJECT (btDeleteMacroItem), "clicked",
00199 G_CALLBACK (vapiGtkMacroDeleteItem), temp1);
00200
00201
00202
00203 g_signal_connect (G_OBJECT (btMacroItemChange), "clicked",
00204 G_CALLBACK (vapiGtkMacroUpdateItemOptions), temp1);
00205
00206 g_signal_connect (G_OBJECT (btMacroDelete), "clicked",
00207 G_CALLBACK (vapiGtkMacroLauchDeleteDialog), NULL);
00208
00209
00210
00211 g_signal_connect (G_OBJECT (btRefresh), "clicked",
00212 G_CALLBACK (vapiGtkCbLoadStaticImage), temp1);
00213
00214 g_signal_connect (G_OBJECT (menuRefresh), "activate",
00215 G_CALLBACK (vapiGtkCbLoadStaticImage), temp1);
00216
00217 g_signal_connect (G_OBJECT (btOriginalImage), "clicked",
00218 G_CALLBACK (vapiGtkGetOriginal), temp1);
00219
00220 g_signal_connect (G_OBJECT (menuOriginal), "activate",
00221 G_CALLBACK (vapiGtkGetOriginal), temp1);
00222
00223 g_signal_connect (G_OBJECT (cbMenuToolbarNames), "activate",
00224 G_CALLBACK (vapiGtkToolbarStyle), toolbar);
00225
00226 g_signal_connect (G_OBJECT (btSaveWorkImage), "clicked",
00227 G_CALLBACK (vapiGtkSaveWorkImage), temp1);
00228
00229 g_signal_connect (G_OBJECT (ebImWork), "button-press-event",
00230 G_CALLBACK (vapiGtkSelectROIActual), temp1);
00231
00232 g_signal_connect (G_OBJECT (ebImActual), "button-press-event",
00233 G_CALLBACK (vapiGtkSelectROIActual), temp1);
00234
00235 g_signal_connect (G_OBJECT (ebSelectRegion), "button-press-event",
00236 G_CALLBACK (vapiGtkSelectRegion), GetCoordinates);
00237
00238
00239 g_signal_connect (G_OBJECT (ebSelectTemplate), "button-press-event",
00240 G_CALLBACK (vapiGtkGrabMouseLocation),
00241 GetCoordinates);
00242 g_signal_connect (G_OBJECT (ebSelectTemplate), "motion-notify-event",
00243 G_CALLBACK (vapiGtkTemplateDrag), GetCoordinates);
00244 g_signal_connect (G_OBJECT (btSaveTemplate), "clicked",
00245 G_CALLBACK (vapiGtkSaveTemplate), temp1);
00246 g_signal_connect (G_OBJECT (btSelectRegion), "clicked",
00247 G_CALLBACK (vapiGtkSaveSelectedRegion), temp1);
00248 g_signal_connect (G_OBJECT (winCalibrateCamera), "show",
00249 G_CALLBACK (vapiGtkWindowOnFocusCalibrateCamera),
00250 calibrateCamera);
00251 g_signal_connect (G_OBJECT (btCalibrateCamera), "clicked",
00252 G_CALLBACK (vapiGtkEventCalibrateCamera),
00253 CalibrateCameraCalculate);
00254 g_signal_connect (G_OBJECT (btCalibrateTestDefinitions), "clicked",
00255 G_CALLBACK
00256 (vapiGtkEventCalibrateCameraTestColourDefinitions),
00257 CalibrateCameraCalculate);
00258
00259
00260
00261 g_signal_connect_after (G_OBJECT (btSaveOrigin), "clicked",
00262 G_CALLBACK (vapiGtkCbLoadStaticImage), temp1);
00263
00264 }