Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

callbacks.c

Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #  include <config.h>
00003 #endif
00004 
00005 #include <gnome.h>
00006 #include <math.h>
00007 
00008 #include "callbacks.h"
00009 #include "interface.h"
00010 #include "support.h"
00011 
00012 #include "fmaps.h"
00013 
00014 #include "gtkfmaps.h"
00015 
00016 #ifndef LIBPQ_H
00017 #  include "libpq-fe.h"
00018 #  define LIBPQ_H
00019 #endif
00020 
00021 #include <stdio.h>
00022 
00023 void
00024 on_import1_activate                    (GtkMenuItem     *menuitem,
00025                                         gpointer         user_data)
00026 {
00027 
00028 }
00029 
00030 
00031 void
00032 on_export1_activate                    (GtkMenuItem     *menuitem,
00033                                         gpointer         user_data)
00034 {
00035 
00036 }
00037 
00038 
00039 void
00040 on_exit1_activate                      (GtkMenuItem     *menuitem,
00041                                         gpointer         user_data)
00042 {
00043   fmaps_quit();
00044 }
00045 
00046 
00047 void
00048 on_cut1_activate                       (GtkMenuItem     *menuitem,
00049                                         gpointer         user_data)
00050 {
00051 
00052 }
00053 
00054 
00055 void
00056 on_copy1_activate                      (GtkMenuItem     *menuitem,
00057                                         gpointer         user_data)
00058 {
00059 
00060 }
00061 
00062 
00063 void
00064 on_paste1_activate                     (GtkMenuItem     *menuitem,
00065                                         gpointer         user_data)
00066 {
00067 
00068 }
00069 
00070 
00071 void
00072 on_clear1_activate                     (GtkMenuItem     *menuitem,
00073                                         gpointer         user_data)
00074 {
00075 
00076 }
00077 
00078 
00079 void
00080 on_properties1_activate                (GtkMenuItem     *menuitem,
00081                                         gpointer         user_data)
00082 {
00083 
00084 }
00085 
00086 
00087 void
00088 on_preferences_activate               (GtkMenuItem     *menuitem,
00089                                        gpointer         user_data)
00090 {
00091   GtkWidget *entry;
00092 
00093   dlgPreferences = create_dlgPreferences ();
00094   /* Initialise the default values */
00095   entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entryhost");
00096   if (pghost==NULL)
00097   {
00098     gtk_entry_set_text(GTK_ENTRY(entry),"");
00099   }
00100   else
00101   {
00102     gtk_entry_set_text(GTK_ENTRY(entry),pghost);
00103   }
00104   entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entryport");
00105   if (pgport==NULL)
00106   {
00107     gtk_entry_set_text(GTK_ENTRY(entry),"");
00108   }
00109   else
00110   {
00111     gtk_entry_set_text(GTK_ENTRY(entry),pgport);
00112   }
00113     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entryoption");
00114   if (pgoptions==NULL)
00115   {
00116     gtk_entry_set_text(GTK_ENTRY(entry),"");
00117   }
00118   else
00119   {
00120     gtk_entry_set_text(GTK_ENTRY(entry),pgoptions);
00121   }
00122     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entrydatabase");
00123   if (dbName==NULL)
00124   {
00125     gtk_entry_set_text(GTK_ENTRY(entry),"");
00126   }
00127   else
00128   {
00129     gtk_entry_set_text(GTK_ENTRY(entry),dbName);
00130   }
00131     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entrylogin");
00132   if (username==NULL)
00133   {
00134     gtk_entry_set_text(GTK_ENTRY(entry),"");
00135   }
00136   else
00137   {
00138     gtk_entry_set_text(GTK_ENTRY(entry),username);
00139   }
00140   entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entrypassword");
00141   if (password==NULL)
00142   {
00143     gtk_entry_set_text(GTK_ENTRY(entry),"");
00144   }
00145   else
00146   {
00147     gtk_entry_set_text(GTK_ENTRY(entry),password);
00148   }
00149   /* display the dialog */
00150   gtk_widget_show (dlgPreferences);
00151 }
00152 
00153 
00154 void
00155 on_about_activate                      (GtkMenuItem     *menuitem,
00156                                         gpointer         user_data)
00157 {
00158   GtkWidget *About;
00159   
00160   About = create_About ();
00161   gtk_widget_show (About);
00162 }
00163 
00164 void
00165 on_connectdb_activate                  (GtkMenuItem     *menuitem,
00166                                         gpointer         user_data)
00167 {
00168 
00169   FM_ConnectDB();
00170 
00171 }
00172 
00173 
00174 void
00175 on_butOK_clicked                       (GtkButton       *button,
00176                                         gpointer         user_data)
00177 {
00178   GtkWidget *entry;
00179   gchar *text;
00180 
00181   if (*(gchar *)(user_data)=='0' || *(gchar *)(user_data)=='1')
00182   {
00183     gnome_config_push_prefix(N_("FMaps/connection/"));
00184     /* host= */
00185     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entryhost");
00186     text=gtk_entry_get_text(GTK_ENTRY(entry));
00187     gnome_config_set_string("pghost",text);
00188     if (text==NULL || strcmp(text,"")==0)
00189     {
00190       pghost=NULL;
00191     }
00192     else
00193     {
00194       pghost=g_strdup(text);
00195     }
00196     /* port= */
00197     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entryport");
00198     text=gtk_entry_get_text(GTK_ENTRY(entry));
00199     gnome_config_set_string("pgport",text);
00200     if (text==NULL || strcmp(text,"")==0)
00201     {
00202       pgport=NULL;
00203     }
00204     else
00205     {
00206       pgport=g_strdup(text);
00207     }
00208     /* option= */
00209     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entryoption");
00210     text=gtk_entry_get_text(GTK_ENTRY(entry));
00211     gnome_config_set_string("pgoptions",text);
00212     if (text==NULL || strcmp(text,"")==0)
00213     {
00214       pgoptions=NULL;
00215     }
00216     else
00217     {
00218       pgoptions=g_strdup(text);
00219     }
00220     /* database= */
00221     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entrydatabase");
00222     text=gtk_entry_get_text(GTK_ENTRY(entry));
00223     gnome_config_set_string("dbName",text);
00224     if (text==NULL || strcmp(text,"")==0)
00225     {
00226       dbName=NULL;
00227     }
00228     else
00229     {
00230       dbName=g_strdup(text);
00231     }
00232     /* login= */
00233     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entrylogin");
00234     text=gtk_entry_get_text(GTK_ENTRY(entry));
00235     gnome_config_set_string("username",text);
00236     if (text==NULL || strcmp(text,"")==0)
00237     {
00238       username=NULL;
00239     }
00240     else
00241     {
00242       username=g_strdup(text);
00243     }
00244     /* password= */
00245     entry=gtk_object_get_data(GTK_OBJECT(dlgPreferences),"entrypassword");
00246     text=gtk_entry_get_text(GTK_ENTRY(entry));
00247     gnome_config_set_string("password",text);
00248     if (text==NULL || strcmp(text,"")==0)
00249     {
00250       password=NULL;
00251     }
00252     else
00253     {
00254       password=g_strdup(text);
00255     }
00256     gnome_config_sync();
00257     gnome_config_pop_prefix();
00258   }
00259   if (*(gchar *)(user_data)=='0' || *(gchar *)(user_data)=='2')
00260   {
00261     gtk_widget_destroy(dlgPreferences);
00262   }
00263 }
00264 
00265 
00266 
00267 
00268 
00269 void
00270 on_new_file1_activate                  (GtkMenuItem     *menuitem,
00271                                         gpointer         user_data)
00272 {
00273 
00274 }
00275 
00276 
00277 void
00278 on_open1_activate                      (GtkMenuItem     *menuitem,
00279                                         gpointer         user_data)
00280 {
00281 
00282 }
00283 
00284 
00285 void
00286 on_save1_activate                      (GtkMenuItem     *menuitem,
00287                                         gpointer         user_data)
00288 {
00289 
00290 }
00291 
00292 
00293 void
00294 on_save_as1_activate                   (GtkMenuItem     *menuitem,
00295                                         gpointer         user_data)
00296 {
00297 
00298 }
00299 
00300 
00301 void
00302 on_exit2_activate                      (GtkMenuItem     *menuitem,
00303                                         gpointer         user_data)
00304 {
00305 
00306 }
00307 
00308 
00309 void
00310 on_cut2_activate                       (GtkMenuItem     *menuitem,
00311                                         gpointer         user_data)
00312 {
00313 
00314 }
00315 
00316 
00317 void
00318 on_copy2_activate                      (GtkMenuItem     *menuitem,
00319                                         gpointer         user_data)
00320 {
00321 
00322 }
00323 
00324 
00325 void
00326 on_paste2_activate                     (GtkMenuItem     *menuitem,
00327                                         gpointer         user_data)
00328 {
00329 
00330 }
00331 
00332 
00333 void
00334 on_clear2_activate                     (GtkMenuItem     *menuitem,
00335                                         gpointer         user_data)
00336 {
00337 
00338 }
00339 
00340 
00341 void
00342 on_properties2_activate                (GtkMenuItem     *menuitem,
00343                                         gpointer         user_data)
00344 {
00345 
00346 }
00347 
00348 
00349 void
00350 on_preferences1_activate               (GtkMenuItem     *menuitem,
00351                                         gpointer         user_data)
00352 {
00353 
00354 }
00355 
00356 
00357 void
00358 on_about1_activate                     (GtkMenuItem     *menuitem,
00359                                         gpointer         user_data)
00360 {
00361 
00362 }
00363 
00364 
00365 
00366 
00367 
00368 void
00369 on_FMaps_destroy                       (GtkObject       *object,
00370                                         gpointer         user_data)
00371 {
00372   fmaps_quit();
00373 }
00374 
00375 
00376 void
00377 on_ctree_table_list_tree_select_row    (GtkCTree        *ctree,
00378                                         GList           *node,
00379                                         gint             column,
00380                                         gpointer         user_data)
00381 {
00382   gchar *buffer;
00383   PGresult *qryResult;
00384   gchar *col[1];
00385   gint result;
00386   guint8 spacing[1];
00387   gchar *coltext[3];
00388   gint nbtuples;
00389   gint i;
00390   GtkCTreeNode *gtktreenode;
00391   gchar *topic;
00392   FM_RowStatus *rowstatus;
00393   FM_RowStatus *subrowstatus;
00394   FM_RowStatus *newrowstatus;
00395 
00396   rowstatus = gtk_ctree_node_get_row_data(ctree,GTK_CTREE_NODE(node));
00397 
00398   if (rowstatus!=NULL && !rowstatus->expandedbefore)
00399   {
00400 
00401     result = gtk_ctree_node_get_pixtext(ctree,GTK_CTREE_NODE(node),0,col,spacing, NULL, NULL);
00402 
00403     topic = g_strchomp(*col);
00404     buffer=g_strdup_printf("SELECT DISTINCT meta_file_id,series from f_catalogue WHERE series='%s' ORDER BY meta_file_id",topic);
00405     qryResult = PQexec(conn,buffer);
00406     g_free(buffer);
00407 
00408     nbtuples = PQntuples(qryResult);
00409     gtktreenode = NULL;
00410 
00411     for (i=0;i<nbtuples;i++)
00412     {
00413       buffer = PQgetvalue(qryResult,i,0);
00414       coltext[0] = g_strdup(buffer);
00415       coltext[1] = NULL;
00416       coltext[2] = NULL;
00417       gtktreenode = gtk_ctree_insert_node(ctree,GTK_CTREE_NODE(node),gtktreenode,coltext,8,NULL,NULL,NULL,NULL,TRUE,FALSE);
00418       /*subrowstatus = gtk_ctree_node_get_row_data(ctree,GTK_CTREE_NODE(gtktreenode));*/
00419       subrowstatus=g_malloc(sizeof(FM_RowStatus));
00420       subrowstatus->expandedbefore=TRUE;
00421       subrowstatus->selectable=TRUE;
00422       subrowstatus->selected=FALSE;
00423       gtk_ctree_node_set_row_data_full(ctree,GTK_CTREE_NODE(gtktreenode),subrowstatus,g_free);
00424     }
00425     newrowstatus=g_malloc(sizeof(FM_RowStatus));
00426     newrowstatus->expandedbefore=TRUE;
00427     newrowstatus->selectable=FALSE;
00428     newrowstatus->selected=FALSE;
00429     gtk_ctree_node_set_row_data_full(ctree,GTK_CTREE_NODE(node),newrowstatus,g_free);
00430     gtk_ctree_expand(ctree,GTK_CTREE_NODE(node));
00431     gtk_ctree_unselect(ctree,GTK_CTREE_NODE(node));
00432 
00433     PQclear(qryResult);
00434     return;
00435   }
00436   if (rowstatus!=NULL && rowstatus->expandedbefore)
00437   {
00438 
00439     if (rowstatus->selectable)
00440     {
00441       newrowstatus=g_malloc(sizeof(FM_RowStatus));
00442       newrowstatus->expandedbefore=rowstatus->expandedbefore;
00443       newrowstatus->selectable=rowstatus->selectable;
00444       if (!rowstatus->selected)
00445       {
00446         newrowstatus->selected=TRUE;
00447       } else
00448       {
00449         newrowstatus->selected=FALSE;
00450       }
00451       gtk_ctree_node_set_row_data_full(ctree,GTK_CTREE_NODE(node),newrowstatus,g_free);
00452     } else
00453     {
00454       gtk_ctree_unselect(ctree,GTK_CTREE_NODE(node));
00455     }
00456   }
00457 }
00458 
00459 void
00460 on_ctree_table_list_tree_unselect_row  (GtkCTree        *ctree,
00461                                         GList           *node,
00462                                         gint             column,
00463                                         gpointer         user_data)
00464 {
00465 
00466   FM_RowStatus *rowstatus;
00467   FM_RowStatus *newrowstatus;
00468 
00469   rowstatus = gtk_ctree_node_get_row_data(ctree,GTK_CTREE_NODE(node));
00470 
00471   if (rowstatus!=NULL  && rowstatus->selectable && rowstatus->selected)
00472   {
00473     newrowstatus=g_malloc(sizeof(FM_RowStatus));
00474     newrowstatus->expandedbefore=rowstatus->expandedbefore;
00475     newrowstatus->selectable=rowstatus->selectable;
00476     newrowstatus->selected=FALSE;
00477     gtk_ctree_node_set_row_data_full(ctree,GTK_CTREE_NODE(node),newrowstatus,g_free);
00478   }
00479 
00480 }
00481 
00482 void
00483 on_Connect_clicked                     (GtkButton       *button,
00484                                         gpointer         user_data)
00485 {
00486 
00487   FM_ConnectDB();
00488 
00489 }
00490 
00491 
00492 void
00493 on_NewTable_clicked                    (GtkButton       *button,
00494                                         gpointer         user_data)
00495 {
00496 
00497   FM_Create_Map_Tables("coastfj");
00498 
00499 }
00500 
00501 
00502 void
00503 on_Map_clicked                         (GtkButton       *button,
00504                                         gpointer         user_data)
00505 {
00506   GtkWidget *MapWindow;
00507   GtkWidget *ctree;
00508   GtkCTreeNode *node;
00509   FM_RowStatus *rowstatus;
00510   gchar *col[1];
00511   gint result;
00512   guint8 spacing[1];
00513   GdkPixmap *pixmap[1];
00514   GdkBitmap *mask[1];
00515   gchar *tablename;
00516   GtkFMaps *fmapsw;
00517 
00518   ctree = gtk_object_get_data(GTK_OBJECT(Fmaps),"ctree_table_list");
00519 
00520 
00521   /* show the map window */
00522   MapWindow = create_MapWindow ();
00523   gtk_widget_show (MapWindow);
00524 
00525   fmapsw = gtk_object_get_data(GTK_OBJECT(MapWindow),"FMapsW");
00526 
00527   /* I don't know how to use gtk_ctree_find_by_row_data therefore I browse the list */
00528 
00529   node = gtk_ctree_node_nth(GTK_CTREE(ctree),0);
00530 
00531   while (node!=NULL)
00532   {
00533     rowstatus = gtk_ctree_node_get_row_data(GTK_CTREE(ctree),node);
00534 
00535     if (rowstatus!=NULL && rowstatus->selected)
00536     {
00537       result = gtk_ctree_node_get_pixtext(GTK_CTREE(ctree),node,0,col,spacing,pixmap,mask);
00538 
00539       tablename = g_strchomp(*col);
00540       gtk_fmaps_add_table(fmapsw,tablename,TRUE);
00541     }
00542     node=GTK_CTREE_NODE_NEXT(node);
00543   }
00544 
00545 
00546 }
00547 
00548 GtkWidget*
00549 create_gtk_fmaps (gchar *widget_name, gchar *string1, gchar *string2,
00550                 gint int1, gint int2)
00551 {
00552   GtkWidget *fmaps;
00553 
00554   g_return_val_if_fail(conn!=NULL,NULL);
00555 
00556   fmaps = gtk_fmaps_new(NULL,conn);
00557 
00558   return(fmaps);
00559 
00560 }
00561 
00562 
00563 void
00564 on_zoom_clicked                        (GtkButton       *button,
00565                                         gpointer         user_data)
00566 {
00567   GtkFMaps *fmapsw;
00568 
00569   g_return_if_fail (user_data != NULL);
00570 
00571   fmapsw = GTK_FMAPS(user_data);
00572   fmapsw->actionstatus=ACTION_ZOOM;
00573 
00574 }
00575 
00576 
00577 
00578 void
00579 on_map_projection_activate             (GtkMenuItem     *menuitem,
00580                                         gpointer         user_data)
00581 {
00582   GtkWidget *selectprojection;
00583 
00584   selectprojection=create_SelectProjection();
00585   gtk_widget_show(selectprojection);
00586 
00587 }
00588 
00589 
00590 void
00591 on_combo_projdatum_changed             (GtkEditable     *editable,
00592                                         gpointer         user_data)
00593 {
00594 
00595 }
00596 
00597 
00598 void
00599 on_selectprojOk_clicked                (GtkButton       *button,
00600                                         gpointer         user_data)
00601 {
00602   GtkWidget *selectprojection;
00603 
00604   selectprojection=lookup_widget(GTK_WIDGET(button),"SelectProjection");
00605 
00606   gtk_widget_destroy(selectprojection);
00607 
00608 
00609 }
00610 
00611 
00612 void
00613 on_selectprojApply_clicked             (GtkButton       *button,
00614                                         gpointer         user_data)
00615 {
00616 
00617 }
00618 
00619 
00620 void
00621 on_selectprojCancel_clicked            (GtkButton       *button,
00622                                         gpointer         user_data)
00623 {
00624 
00625 }
00626 
00627 
00628 void
00629 on_dlgCreateEllipsoidbuttonAdd_clicked (GtkButton       *button,
00630                                         gpointer         user_data)
00631 {
00632   GtkWidget *entryid;
00633   gchar *chentryid;
00634   GtkWidget *entryname;
00635   gchar *chentryname;
00636   GtkWidget *entrya;
00637   gchar *chentrya;
00638   GtkWidget *entryf;
00639   gchar *chentryf;
00640   gchar *buffer;
00641   PGresult *qryResult;
00642   GtkWidget *clist;
00643 
00644   g_return_if_fail(conn!=NULL);
00645 
00646   entryid=lookup_widget(GTK_WIDGET(button),"entryID");
00647   entryname=lookup_widget(GTK_WIDGET(button),"entryName");
00648   entrya=lookup_widget(GTK_WIDGET(button),"entrya");
00649   entryf=lookup_widget(GTK_WIDGET(button),"entryf");
00650 
00651   chentryid=gtk_entry_get_text(GTK_ENTRY(entryid));
00652   chentryname=gtk_entry_get_text(GTK_ENTRY(entryname));
00653   chentrya=gtk_entry_get_text(GTK_ENTRY(entrya));
00654   chentryf=gtk_entry_get_text(GTK_ENTRY(entryf));
00655 
00656   buffer=g_strdup_printf("INSERT INTO f_ellipsoid (ellipsoidid,name,a,f) VALUES(%s,'%s',%s,%s)",chentryid,chentryname,chentrya,chentryf);
00657   qryResult = PQexec(conn,buffer);
00658   g_free(buffer);
00659 
00660   /* refresh the list */
00661   clist=lookup_widget(GTK_WIDGET(button),"dlgCreateEllipsoidclistEllipsoid");
00662   FM_Rebuild_Clist(GTK_CLIST(clist),1);
00663 
00664 
00665 }
00666 
00667 
00668 void
00669 on_dlgCreateEllipsoidbuttonDelete_clicked
00670                                         (GtkButton       *button,
00671                                         gpointer         user_data)
00672 {
00673   GtkWidget *clist;
00674   gint row;
00675   gint result;
00676   gchar *buffer;
00677   PGresult *qryResult;
00678   gchar *col[4];
00679 
00680   g_return_if_fail(conn!=NULL);
00681 
00682   clist=lookup_widget(GTK_WIDGET(button),"dlgCreateEllipsoidclistEllipsoid");
00683 
00684   if (GTK_CLIST(clist)->selection!=NULL)
00685   {
00686     row=GPOINTER_TO_INT(GTK_CLIST(clist)->selection->data);
00687     result=gtk_clist_get_text(GTK_CLIST(clist),row,0,col);
00688 
00689     buffer=g_strdup_printf("DELETE FROM f_ellipsoid WHERE ellipsoidid=%d",atoi(col[0]));
00690     qryResult = PQexec(conn,buffer);
00691     g_free(buffer);
00692     PQclear(qryResult);
00693 
00694     /* refresh the list */
00695     FM_Rebuild_Clist(GTK_CLIST(clist),1);
00696 
00697   }
00698 
00699 }
00700 
00701 
00702 void
00703 on_fmaps_projection_edit_activate      (GtkMenuItem     *menuitem,
00704                                         gpointer         user_data)
00705 {
00706   GtkWidget *widget;
00707   GtkWidget *clist;
00708 
00709   /* No connection to database */
00710   if (conn==NULL)
00711   {
00712         FM_MessageBox(N_("No Connection to the Database"));
00713         return;
00714   }
00715   widget=create_dlgCreateProjection();
00716   clist=lookup_widget(widget,"clistProjection");
00717   FM_Rebuild_Clist(GTK_CLIST(clist),2);
00718   gtk_widget_show(widget);
00719 }
00720 
00721 
00722 void
00723 on_fmaps_datum_edit_activate           (GtkMenuItem     *menuitem,
00724                                         gpointer         user_data)
00725 {
00726   GtkWidget *dlgcreatedatum;
00727   GtkWidget *clist;
00728   GtkWidget *combo;
00729   GList *list;
00730   gint i;
00731   gchar *buffer;
00732   PGresult *qryResult;
00733   gint nbtuples;
00734 
00735   /* No connection to database */
00736   if (conn==NULL)
00737   {
00738         FM_MessageBox(N_("No Connection to the Database"));
00739         return;
00740   }
00741 
00742   dlgcreatedatum=create_dlgCreateDatum();
00743   clist=lookup_widget(dlgcreatedatum,"clistDatum");
00744 
00745   /* build the combo box */
00746   combo=lookup_widget(dlgcreatedatum,"comboEllipsoid");
00747 
00748   buffer=g_strdup("SELECT DISTINCT name FROM f_ellipsoid ORDER BY name");
00749   qryResult = PQexec(conn,buffer);
00750   g_free(buffer);
00751 
00752   list=NULL;
00753   nbtuples=PQntuples(qryResult);
00754   i=0;
00755   while(i<nbtuples)
00756   {
00757     buffer = PQgetvalue(qryResult,i,0);
00758     list=g_list_append(list,g_strdup(buffer));
00759     i++;
00760   }
00761 
00762   gtk_combo_set_popdown_strings(GTK_COMBO(combo),list);
00763   g_list_free(list);
00764 
00765   FM_Rebuild_Clist(GTK_CLIST(clist),0);
00766 
00767   gtk_widget_show(dlgcreatedatum);
00768 }
00769 
00770 
00771 void
00772 on_fmaps_ellipsoid_edit_activate       (GtkMenuItem     *menuitem,
00773                                         gpointer         user_data)
00774 {
00775   GtkWidget *dlgcreateellipsoid;
00776   GtkWidget *clist;
00777 
00778   /* No connection to database */
00779   if (conn==NULL)
00780   {
00781         FM_MessageBox(N_("No Connection to the Database"));
00782         return;
00783   }
00784 
00785   dlgcreateellipsoid=create_dlgCreateEllipsoid();
00786   clist=lookup_widget(dlgcreateellipsoid,"dlgCreateEllipsoidclistEllipsoid");
00787 
00788   FM_Rebuild_Clist(GTK_CLIST(clist),1);
00789 
00790 
00791   gtk_widget_show(dlgcreateellipsoid);
00792 
00793 }
00794 
00795 
00796 
00797 
00798 void
00799 on_dlgCreateEllipsoidbuttonClose_clicked
00800                                         (GtkButton       *button,
00801                                         gpointer         user_data)
00802 {
00803   GtkWidget *widget;
00804 
00805   widget=lookup_widget(GTK_WIDGET(button),"dlgCreateEllipsoid");
00806   gtk_widget_destroy(widget);
00807 }
00808 
00809 void
00810 on_fmaps_import_projection_activate    (GtkMenuItem     *menuitem,
00811                                         gpointer         user_data)
00812 {
00813   GtkWidget *fileselection;
00814 
00815   /* No connection to database */
00816   if (conn==NULL)
00817   {
00818         FM_MessageBox(N_("No Connection to the Database"));
00819         return;
00820   }
00821 
00822 
00823   fileselection=create_fileselection();
00824   gtk_widget_show(fileselection);
00825 
00826   fileselection_action=IMPORT_PROJECTION;
00827 }
00828 
00829 void
00830 on_fmaps_export_projection_activate    (GtkMenuItem     *menuitem,
00831                                         gpointer         user_data)
00832 {
00833   GtkWidget *fileselection;
00834 
00835   /* No connection to database */
00836   if (conn==NULL)
00837   {
00838         FM_MessageBox(N_("No Connection to the Database"));
00839         return;
00840   }
00841 
00842 
00843   fileselection=create_fileselection();
00844   gtk_widget_show(fileselection);
00845 
00846   fileselection_action=EXPORT_PROJECTION;
00847 }
00848 
00849 void
00850 on_fmaps_import_ellipsoid_activate     (GtkMenuItem     *menuitem,
00851                                         gpointer         user_data)
00852 {
00853   GtkWidget *fileselection;
00854 
00855   /* No connection to database */
00856   if (conn==NULL)
00857   {
00858         FM_MessageBox(N_("No Connection to the Database"));
00859         return;
00860   }
00861 
00862 
00863   fileselection=create_fileselection();
00864   gtk_widget_show(fileselection);
00865 
00866   fileselection_action=IMPORT_ELLIPSOID;
00867 }
00868 
00869 void
00870 on_fmaps_export_ellipsoid_activate     (GtkMenuItem     *menuitem,
00871                                         gpointer         user_data)
00872 {
00873   GtkWidget *fileselection;
00874 
00875   /* No connection to database */
00876   if (conn==NULL)
00877   {
00878         FM_MessageBox(N_("No Connection to the Database"));
00879         return;
00880   }
00881 
00882 
00883   fileselection=create_fileselection();
00884   gtk_widget_show(fileselection);
00885 
00886   fileselection_action=EXPORT_ELLIPSOID;
00887 
00888 }
00889 
00890 void
00891 on_fileselection_ok_button_clicked     (GtkButton       *button,
00892                                         gpointer         user_data)
00893 {
00894   gchar *name;
00895   GtkWidget *fileselection;
00896 
00897   fileselection=lookup_widget(GTK_WIDGET(button),"fileselection");
00898   name=g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileselection)));
00899   gtk_widget_destroy(fileselection);
00900 
00901   /* No filename */
00902   if (name==NULL || name=="")
00903   {
00904         return;
00905   }
00906 
00907   switch(fileselection_action)
00908   {
00909   case EXPORT_ELLIPSOID:
00910         FM_Export_Ellipsoid(conn,name);
00911         break;
00912   case IMPORT_ELLIPSOID:
00913         FM_Import_Ellipsoid(conn,name);
00914         break;
00915   case EXPORT_DATUM:
00916         FM_Export_Datum(conn,name);
00917         break;
00918   case IMPORT_DATUM:
00919         FM_Import_Datum(conn,name);
00920         break;
00921   case EXPORT_PROJECTION:
00922         FM_Export_Projection(conn,name);
00923         break;
00924   case IMPORT_PROJECTION:
00925         FM_Import_Projection(conn,name);
00926         break;
00927   case EXPORT_MIFMID:
00928         break;          
00929   case IMPORT_MIFMID:
00930         FM_Import_MIFMID(conn,name);
00931         FM_Rebuild_Directory();
00932         break;  
00933   case EXPORT_SHAPEFILE:
00934     break;
00935   case IMPORT_SHAPEFILE:
00936     FM_Import_ShapeFile(conn,name);
00937     FM_Rebuild_Directory();
00938     break;              
00939   }
00940   g_free(name);
00941 
00942 }
00943 
00944 
00945 void
00946 on_fileselection_cancel_button_clicked (GtkButton       *button,
00947                                         gpointer         user_data)
00948 {
00949   GtkWidget *widget;
00950 
00951   widget=lookup_widget(GTK_WIDGET(button),"fileselection");
00952   gtk_widget_destroy(widget);
00953 }
00954 
00955 
00956 
00957 
00958 
00959 void
00960 on_dlgCreateDatumbuttonDelete_clicked  (GtkButton       *button,
00961                                         gpointer         user_data)
00962 {
00963   GtkWidget *clist;
00964   gint row;
00965   gint result;
00966   gchar *buffer;
00967   PGresult *qryResult;
00968   gchar *col[12];
00969 
00970   g_return_if_fail(conn!=NULL);
00971 
00972   clist=lookup_widget(GTK_WIDGET(button),"clistDatum");
00973 
00974   if (GTK_CLIST(clist)->selection!=NULL)
00975   {
00976     row=GPOINTER_TO_INT(GTK_CLIST(clist)->selection->data);
00977     result=gtk_clist_get_text(GTK_CLIST(clist),row,0,col);
00978 
00979     buffer=g_strdup_printf("DELETE FROM f_datum WHERE datumid=%d",atoi(col[0]));
00980     qryResult = PQexec(conn,buffer);
00981     g_free(buffer);
00982     PQclear(qryResult);
00983   }
00984 
00985   /* refresh the list */
00986   clist=lookup_widget(GTK_WIDGET(button),"clistDatum");
00987   FM_Rebuild_Clist(GTK_CLIST(clist),0);
00988 
00989 
00990 
00991 }
00992 
00993 
00994 void
00995 on_dlgCreateDatumbuttonAdd_clicked     (GtkButton       *button,
00996                                         gpointer         user_data)
00997 {
00998   GtkWidget *entryid;
00999   gchar *chentryid;
01000   GtkWidget *entryname;
01001   gchar *chentryname;
01002   GtkWidget *entrytype;
01003   gchar *chentrytype;
01004   GtkFMapsDatumType ientrytype;
01005   GtkWidget *entryellipsoid;
01006   gchar *chentryellipsoid;
01007   gint ientryellipsoid;
01008   GtkWidget *entrydx;
01009   gchar *chentrydx;
01010   GtkWidget *entrydy;
01011   gchar *chentrydy;
01012   GtkWidget *entrydz;
01013   gchar *chentrydz;
01014   GtkWidget *entryox;
01015   gchar *chentryox;
01016   GtkWidget *entryoy;
01017   gchar *chentryoy;
01018   GtkWidget *entryoz;
01019   gchar *chentryoz;
01020   GtkWidget *entryscale;
01021   gchar *chentryscale;
01022   GtkWidget *entrypm;
01023   gchar *chentrypm;
01024   gchar *buffer;
01025   PGresult *qryResult;
01026   gint nbtuples;
01027   GtkWidget *clist;
01028 
01029   g_return_if_fail(conn!=NULL);
01030 
01031   entryid=lookup_widget(GTK_WIDGET(button),"entryID");
01032   entryname=lookup_widget(GTK_WIDGET(button),"entryName");
01033   entrytype=lookup_widget(GTK_WIDGET(button),"dlgCreateDatumcomboentryType");
01034   entryellipsoid=lookup_widget(GTK_WIDGET(button),"combo_entryEllipsoid");
01035   entrydx=lookup_widget(GTK_WIDGET(button),"entrydx");
01036   entrydy=lookup_widget(GTK_WIDGET(button),"entrydy");
01037   entrydz=lookup_widget(GTK_WIDGET(button),"entrydz");
01038   entryox=lookup_widget(GTK_WIDGET(button),"entryox");
01039   entryoy=lookup_widget(GTK_WIDGET(button),"entryoy");
01040   entryoz=lookup_widget(GTK_WIDGET(button),"entryoz");
01041   entryscale=lookup_widget(GTK_WIDGET(button),"entryScale");
01042   entrypm=lookup_widget(GTK_WIDGET(button),"entryPM");
01043 
01044   chentryid=gtk_entry_get_text(GTK_ENTRY(entryid));
01045   chentryname=gtk_entry_get_text(GTK_ENTRY(entryname));
01046   chentrytype=gtk_entry_get_text(GTK_ENTRY(entrytype));
01047   chentryellipsoid=gtk_entry_get_text(GTK_ENTRY(entryellipsoid));
01048   chentrydx=gtk_entry_get_text(GTK_ENTRY(entrydx));
01049   chentrydy=gtk_entry_get_text(GTK_ENTRY(entrydy));
01050   chentrydz=gtk_entry_get_text(GTK_ENTRY(entrydz));
01051   chentryox=gtk_entry_get_text(GTK_ENTRY(entryox));
01052   chentryoy=gtk_entry_get_text(GTK_ENTRY(entryoy));
01053   chentryoz=gtk_entry_get_text(GTK_ENTRY(entryoz));
01054   chentryscale=gtk_entry_get_text(GTK_ENTRY(entryscale));
01055   chentrypm=gtk_entry_get_text(GTK_ENTRY(entrypm));
01056 
01057   /* processtype */
01058   ientrytype=DAT_NONE;
01059   if(strcmp(chentrytype,"Molendensky")==0)
01060   {
01061     ientrytype=DAT_MOLENDENSKY;
01062   }else if(strcmp(chentrytype,"Bursa-Wolfe")==0)
01063   {
01064     ientrytype=DAT_BURSA_WOLFE;
01065   }
01066 
01067   /* retreive ellipsoidid */
01068   buffer=g_strdup_printf("SELECT DISTINCT ellipsoidid FROM f_ellipsoid WHERE name='%s'",chentryellipsoid);
01069   qryResult = PQexec(conn,buffer);
01070   g_free(buffer);
01071   nbtuples = PQntuples(qryResult);
01072   ientryellipsoid=0;
01073   if (nbtuples!=0)
01074   {
01075     ientryellipsoid = atoi(PQgetvalue(qryResult,0,0));
01076   }
01077 
01078   buffer=g_strdup_printf("INSERT INTO f_datum (datumid,name,type,ellipsoidid,dx,dy,dz,ox,oy,oz,scale,pm) VALUES (%s,'%s',%d,%d,%s,%s,%s,%s,%s,%s,%s,%s)",chentryid,chentryname,ientrytype,ientryellipsoid,chentrydx,chentrydy,chentrydz,chentryox,chentryoy,chentryoz,chentryscale,chentrypm);
01079   qryResult = PQexec(conn,buffer);
01080   g_free(buffer);
01081 
01082   /* refresh the list */
01083   clist=lookup_widget(GTK_WIDGET(button),"clistDatum");
01084   FM_Rebuild_Clist(GTK_CLIST(clist),0);
01085 
01086 }
01087 
01088 
01089 void
01090 on_dlgCreateDatumbuttonClose_clicked   (GtkButton       *button,
01091                                         gpointer         user_data)
01092 {
01093   GtkWidget *widget;
01094 
01095   widget=lookup_widget(GTK_WIDGET(button),"dlgCreateDatum");
01096   gtk_widget_destroy(widget);
01097 }
01098 
01099 
01100 void
01101 on_fmaps_import_datum_activate         (GtkMenuItem     *menuitem,
01102                                         gpointer         user_data)
01103 {
01104   GtkWidget *fileselection;
01105 
01106   /* No connection to database */
01107   if (conn==NULL)
01108   {
01109         FM_MessageBox(N_("No Connection to the Database"));
01110         return;
01111   }
01112 
01113 
01114   fileselection=create_fileselection();
01115   gtk_widget_show(fileselection);
01116 
01117   fileselection_action=IMPORT_DATUM;
01118 }
01119 
01120 
01121 void
01122 on_fmaps_export_datum_activate         (GtkMenuItem     *menuitem,
01123                                         gpointer         user_data)
01124 {
01125   GtkWidget *fileselection;
01126 
01127   /* No connection to database */
01128   if (conn==NULL)
01129   {
01130         FM_MessageBox(N_("No Connection to the Database"));
01131         return;
01132   }
01133 
01134 
01135   fileselection=create_fileselection();
01136   gtk_widget_show(fileselection);
01137 
01138   fileselection_action=EXPORT_DATUM;
01139 }
01140 
01141 void
01142 on_dlgCreateDatumcomboentryType_changed
01143                                         (GtkEditable     *editable,
01144                                         gpointer         user_data)
01145 {
01146   GtkWidget *entrytype;
01147   GtkWidget *widget;
01148   gchar *chentrytype;
01149 
01150   widget=NULL;
01151   entrytype=lookup_widget(GTK_WIDGET(editable),"dlgCreateDatumcomboentryType");
01152   chentrytype=gtk_entry_get_text(GTK_ENTRY(entrytype));
01153 
01154   if (strcmp(chentrytype,"Molendensky")==0)
01155   {
01156     widget=lookup_widget(GTK_WIDGET(editable),"entrydx");
01157     gtk_widget_show(widget);
01158     widget=lookup_widget(GTK_WIDGET(editable),"entrydy");
01159     gtk_widget_show(widget);
01160     widget=lookup_widget(GTK_WIDGET(editable),"entrydz");
01161     gtk_widget_show(widget);
01162     widget=lookup_widget(GTK_WIDGET(editable),"entryox");
01163     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01164     gtk_widget_hide(widget);
01165     widget=lookup_widget(GTK_WIDGET(editable),"entryoy");
01166     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01167     gtk_widget_hide(widget);
01168     widget=lookup_widget(GTK_WIDGET(editable),"entryoz");
01169     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01170     gtk_widget_hide(widget);
01171     widget=lookup_widget(GTK_WIDGET(editable),"entryScale");
01172     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01173     gtk_widget_hide(widget);
01174     widget=lookup_widget(GTK_WIDGET(editable),"entryPM");
01175     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01176     gtk_widget_hide(widget);
01177 
01178   } else if (strcmp(chentrytype,"Bursa-Wolfe")==0)
01179   {
01180     widget=lookup_widget(GTK_WIDGET(editable),"entrydx");
01181     gtk_widget_show(widget);
01182     widget=lookup_widget(GTK_WIDGET(editable),"entrydy");
01183     gtk_widget_show(widget);
01184     widget=lookup_widget(GTK_WIDGET(editable),"entrydz");
01185     gtk_widget_show(widget);
01186     widget=lookup_widget(GTK_WIDGET(editable),"entryox");
01187     gtk_widget_show(widget);
01188     widget=lookup_widget(GTK_WIDGET(editable),"entryoy");
01189     gtk_widget_show(widget);
01190     widget=lookup_widget(GTK_WIDGET(editable),"entryoz");
01191     gtk_widget_show(widget);
01192     widget=lookup_widget(GTK_WIDGET(editable),"entryScale");
01193     gtk_widget_show(widget);
01194     widget=lookup_widget(GTK_WIDGET(editable),"entryPM");
01195     gtk_widget_show(widget);
01196 
01197   } else /* NONE */
01198   {
01199     widget=lookup_widget(GTK_WIDGET(editable),"entrydx");
01200     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01201     gtk_widget_hide(widget);
01202     widget=lookup_widget(GTK_WIDGET(editable),"entrydy");
01203     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01204     gtk_widget_hide(widget);
01205     widget=lookup_widget(GTK_WIDGET(editable),"entrydz");
01206     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01207     gtk_widget_hide(widget);
01208     widget=lookup_widget(GTK_WIDGET(editable),"entryox");
01209     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01210     gtk_widget_hide(widget);
01211     widget=lookup_widget(GTK_WIDGET(editable),"entryoy");
01212     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01213     gtk_widget_hide(widget);
01214     widget=lookup_widget(GTK_WIDGET(editable),"entryoz");
01215     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01216     gtk_widget_hide(widget);
01217     widget=lookup_widget(GTK_WIDGET(editable),"entryScale");
01218     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01219     gtk_widget_hide(widget);
01220     widget=lookup_widget(GTK_WIDGET(editable),"entryPM");
01221     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01222     gtk_widget_hide(widget);
01223   }
01224 
01225 }
01226 
01227 
01228 void
01229 on_dlgCreateProjectioncomboentryType_changed
01230                                         (GtkEditable     *editable,
01231                                         gpointer         user_data)
01232 {
01233   GtkWidget *entrytype;
01234   GtkWidget *widget;
01235   gchar *chentrytype;
01236   gint i;
01237   gchar *buffer;
01238 
01239   widget=NULL;
01240   entrytype=lookup_widget(GTK_WIDGET(editable),"dlgCreateProjectioncomboentryType");
01241   chentrytype=gtk_entry_get_text(GTK_ENTRY(entrytype));
01242 
01243   /* Clear everything */
01244   for(i=1;i<=10;i++)
01245   {
01246     buffer=g_strdup_printf("entryPar%d",i);
01247     widget=lookup_widget(GTK_WIDGET(editable),buffer);
01248     gtk_entry_set_text(GTK_ENTRY(widget),"0");
01249     gtk_widget_hide(widget);
01250     g_free(buffer);
01251   }
01252 
01253   /* Build back */
01254   if (strcmp(chentrytype,"Longitude/Latitude")==0)
01255   {
01256   } else if (strcmp(chentrytype,"Mercator")==0)
01257   {
01258     widget=lookup_widget(GTK_WIDGET(editable),"entryPar1");
01259     gtk_widget_show(widget);
01260     widget=lookup_widget(GTK_WIDGET(editable),"entryPar2");
01261     gtk_widget_show(widget);
01262   } else
01263   {
01264   }
01265 }
01266 
01267 
01268 void
01269 on_dlgCreateProjectionbuttonDelete_clicked
01270                                         (GtkButton       *button,
01271                                         gpointer         user_data)
01272 {
01273   GtkWidget *clist;
01274   gint row;
01275   gint result;
01276   gchar *buffer;
01277   PGresult *qryResult;
01278   gchar *col[13];
01279 
01280   g_return_if_fail(conn!=NULL);
01281 
01282   clist=lookup_widget(GTK_WIDGET(button),"clistProjection");
01283 
01284   if (GTK_CLIST(clist)->selection!=NULL)
01285   {
01286     row=GPOINTER_TO_INT(GTK_CLIST(clist)->selection->data);
01287     result=gtk_clist_get_text(GTK_CLIST(clist),row,0,col);
01288 
01289     buffer=g_strdup_printf("DELETE FROM f_projection WHERE projid=%d",atoi(col[0]));
01290     qryResult = PQexec(conn,buffer);
01291     g_free(buffer);
01292     PQclear(qryResult);
01293   }
01294 
01295   /* refresh the list */
01296   clist=lookup_widget(GTK_WIDGET(button),"clistProjection");
01297   FM_Rebuild_Clist(GTK_CLIST(clist),2);
01298 }
01299 
01300 
01301 void
01302 on_dlgCreateProjectionbuttonAdd_clicked
01303                                         (GtkButton       *button,
01304                                         gpointer         user_data)
01305 {
01306   GtkWidget *entryid;
01307   gchar *chentryid;
01308   GtkWidget *entryname;
01309   gchar *chentryname;
01310   GtkWidget *entrytype;
01311   gchar *chentrytype;
01312   gint ientrytype;
01313   GtkWidget *entryPar1;
01314   gchar *chentryPar1;
01315   GtkWidget *entryPar2;
01316   gchar *chentryPar2;
01317   GtkWidget *entryPar3;
01318   gchar *chentryPar3;
01319   GtkWidget *entryPar4;
01320   gchar *chentryPar4;
01321   GtkWidget *entryPar5;
01322   gchar *chentryPar5;
01323   GtkWidget *entryPar6;
01324   gchar *chentryPar6;
01325   GtkWidget *entryPar7;
01326   gchar *chentryPar7;
01327   GtkWidget *entryPar8;
01328   gchar *chentryPar8;
01329   GtkWidget *entryPar9;
01330   gchar *chentryPar9;
01331   GtkWidget *entryPar10;
01332   gchar *chentryPar10;
01333 
01334   gchar *buffer;
01335   PGresult *qryResult;
01336   GtkWidget *clist;
01337 
01338   g_return_if_fail(conn!=NULL);
01339 
01340   entryid=lookup_widget(GTK_WIDGET(button),"entryID");
01341   entryname=lookup_widget(GTK_WIDGET(button),"entryName");
01342   entrytype=lookup_widget(GTK_WIDGET(button),"dlgCreateProjectioncomboentryType");
01343   entryPar1=lookup_widget(GTK_WIDGET(button),"entryPar1");
01344   entryPar2=lookup_widget(GTK_WIDGET(button),"entryPar2");
01345   entryPar3=lookup_widget(GTK_WIDGET(button),"entryPar3");
01346   entryPar4=lookup_widget(GTK_WIDGET(button),"entryPar4");
01347   entryPar5=lookup_widget(GTK_WIDGET(button),"entryPar5");
01348   entryPar6=lookup_widget(GTK_WIDGET(button),"entryPar6");
01349   entryPar7=lookup_widget(GTK_WIDGET(button),"entryPar7");
01350   entryPar8=lookup_widget(GTK_WIDGET(button),"entryPar8");
01351   entryPar9=lookup_widget(GTK_WIDGET(button),"entryPar9");
01352   entryPar10=lookup_widget(GTK_WIDGET(button),"entryPar10");
01353 
01354   chentryid=gtk_entry_get_text(GTK_ENTRY(entryid));
01355   chentryname=gtk_entry_get_text(GTK_ENTRY(entryname));
01356   chentrytype=gtk_entry_get_text(GTK_ENTRY(entrytype));
01357   chentryPar1=gtk_entry_get_text(GTK_ENTRY(entryPar1));
01358   chentryPar2=gtk_entry_get_text(GTK_ENTRY(entryPar2));
01359   chentryPar3=gtk_entry_get_text(GTK_ENTRY(entryPar3));
01360   chentryPar4=gtk_entry_get_text(GTK_ENTRY(entryPar4));
01361   chentryPar5=gtk_entry_get_text(GTK_ENTRY(entryPar5));
01362   chentryPar6=gtk_entry_get_text(GTK_ENTRY(entryPar6));
01363   chentryPar7=gtk_entry_get_text(GTK_ENTRY(entryPar7));
01364   chentryPar8=gtk_entry_get_text(GTK_ENTRY(entryPar8));
01365   chentryPar9=gtk_entry_get_text(GTK_ENTRY(entryPar9));
01366   chentryPar10=gtk_entry_get_text(GTK_ENTRY(entryPar10));
01367 
01368   if (strcmp(chentrytype,"Longitude/Latitude")==0)
01369   {
01370     ientrytype=PROJ_LONLAT;
01371   } else if (strcmp(chentrytype,"Mercator")==0)
01372   {
01373     ientrytype=PROJ_MERCATOR;
01374   } else
01375   {
01376     ientrytype=PROJ_NONE;
01377   }
01378 
01379   buffer=g_strdup_printf("INSERT INTO f_projection (projid,name,type,par1,par2,par3,par4,par5,par6,par7,par8,par9,par10) VALUES (%s,'%s',%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",chentryid,chentryname,ientrytype,chentryPar1,chentryPar2,chentryPar3,chentryPar4,chentryPar5,chentryPar6,chentryPar7,chentryPar8,chentryPar9,chentryPar10);
01380   qryResult = PQexec(conn,buffer);
01381   g_free(buffer);
01382 
01383   /* refresh the list */
01384   clist=lookup_widget(GTK_WIDGET(button),"clistProjection");
01385   FM_Rebuild_Clist(GTK_CLIST(clist),2);
01386 
01387 }
01388 
01389 
01390 void
01391 on_dlgCreateProjectionbuttonClose_clicked
01392                                         (GtkButton       *button,
01393                                         gpointer         user_data)
01394 {
01395   GtkWidget *widget;
01396 
01397   widget=lookup_widget(GTK_WIDGET(button),"dlgCreateProjection");
01398   gtk_widget_destroy(widget);
01399 }
01400 
01401 
01402 
01403 
01404 
01405 void
01406 on_fmaps_import_mifmid_activate        (GtkMenuItem     *menuitem,
01407                                         gpointer         user_data)
01408 {
01409   GtkWidget *fileselection;
01410 
01411   /* No connection to database */
01412   if (conn==NULL)
01413   {
01414         FM_MessageBox(N_("No Connection to the Database"));
01415         return;
01416   }
01417 
01418 
01419   fileselection=create_fileselection();
01420   gtk_widget_show(fileselection);
01421 
01422   fileselection_action=IMPORT_MIFMID;
01423 }
01424 
01425 void
01426 on_fmaps_import_shapefile_activate     (GtkMenuItem     *menuitem,
01427                                         gpointer         user_data)
01428 {
01429   GtkWidget *fileselection;
01430 
01431   /* No connection to database */
01432   if (conn==NULL)
01433   {
01434         FM_MessageBox(N_("No Connection to the Database"));
01435         return;
01436   }
01437 
01438 
01439   fileselection=create_fileselection();
01440   gtk_widget_show(fileselection);
01441 
01442   fileselection_action=IMPORT_SHAPEFILE;
01443 }
01444 
01445 void
01446 on_tables2_activate                    (GtkMenuItem     *menuitem,
01447                                         gpointer         user_data)
01448 {
01449 
01450 }
01451 
01452 
01453 void
01454 on_deletetable_clicked                 (GtkButton       *button,
01455                                         gpointer         user_data)
01456 {
01457   GtkWidget *ctree;
01458   GtkCTreeNode *node;
01459   FM_RowStatus *rowstatus;
01460   gchar *col[1];
01461   gint result;
01462   gchar *tablename;
01463   gchar *buffer;
01464   PGresult *qryResult;
01465 
01466   ctree = gtk_object_get_data(GTK_OBJECT(Fmaps),"ctree_table_list");
01467 
01468   /* I still don't know how to use gtk_ctree_find_by_row_data therefore I browse the list */
01469 
01470   node = gtk_ctree_node_nth(GTK_CTREE(ctree),0);
01471 
01472   while (node!=NULL)
01473   {
01474     rowstatus = gtk_ctree_node_get_row_data(GTK_CTREE(ctree),node);
01475 
01476     if (rowstatus!=NULL && rowstatus->selected)
01477     {
01478       result = gtk_ctree_node_get_pixtext(GTK_CTREE(ctree),node,0,col,NULL,NULL,NULL);
01479 
01480       tablename = g_strchomp(*col);
01481       /* delete the table */
01482       
01483       /* delete tablename */
01484       buffer=g_strdup_printf("DROP TABLE %s",tablename);
01485       qryResult = PQexec(conn,buffer);
01486       g_free(buffer);
01487       PQclear(qryResult);
01488       
01489       /* delete geo_tablename */
01490       buffer=g_strdup_printf("DROP TABLE geo_%s",tablename);
01491       qryResult = PQexec(conn,buffer);
01492       g_free(buffer);
01493       PQclear(qryResult);
01494       
01495       /* delete tablename in metadata */
01496       buffer=g_strdup_printf("DELETE FROM f_catalogue WHERE meta_file_id='%s'",tablename);
01497       qryResult = PQexec(conn,buffer);
01498       g_free(buffer);
01499       PQclear(qryResult);      
01500       
01501     }
01502     node=GTK_CTREE_NODE_NEXT(node);
01503   }
01504   FM_Rebuild_Directory();
01505 }
01506 
01507                 
01508 void
01509 on_Browse_clicked                      (GtkButton       *button,
01510                                         gpointer         user_data)
01511 {
01512   GtkWidget *TableWindow;
01513   GtkWidget *ctree;
01514   GtkCTreeNode *node;
01515   FM_RowStatus *rowstatus;
01516   gchar *col[1];
01517   gint result;
01518   gchar *tablename;
01519   gchar *buffer;
01520 
01521   ctree = gtk_object_get_data(GTK_OBJECT(Fmaps),"ctree_table_list");
01522 
01523   /* I still don't know how to use gtk_ctree_find_by_row_data therefore I browse the list */
01524 
01525   node = gtk_ctree_node_nth(GTK_CTREE(ctree),0);
01526 
01527   while (node!=NULL)
01528   {
01529     rowstatus = gtk_ctree_node_get_row_data(GTK_CTREE(ctree),node);
01530 
01531     if (rowstatus!=NULL && rowstatus->selected)
01532     {
01533       result = gtk_ctree_node_get_pixtext(GTK_CTREE(ctree),node,0,col,NULL,NULL,NULL);
01534 
01535       tablename = g_strchomp(*col);
01536 
01537       /* show the table window */
01538       TableWindow = create_TableWindow ();
01539       buffer=g_strdup_printf("%s - Table",tablename);
01540       gtk_window_set_title(GTK_WINDOW(TableWindow),buffer);
01541       g_free(buffer);
01542       FM_Display_Table(TableWindow,tablename);
01543       gtk_widget_show (TableWindow);
01544 
01545     }
01546     node=GTK_CTREE_NODE_NEXT(node);
01547   }
01548 
01549 }
01550 
01551 
01552 void
01553 on_new_file2_activate                  (GtkMenuItem     *menuitem,
01554                                         gpointer         user_data)
01555 {
01556 
01557 }
01558 
01559 
01560 void
01561 on_open2_activate                      (GtkMenuItem     *menuitem,
01562                                         gpointer         user_data)
01563 {
01564 
01565 }
01566 
01567 
01568 void
01569 on_save2_activate                      (GtkMenuItem     *menuitem,
01570                                         gpointer         user_data)
01571 {
01572 
01573 }
01574 
01575 
01576 void
01577 on_save_as2_activate                   (GtkMenuItem     *menuitem,
01578                                         gpointer         user_data)
01579 {
01580 
01581 }
01582 
01583 
01584 void
01585 on_cut3_activate                       (GtkMenuItem     *menuitem,
01586                                         gpointer         user_data)
01587 {
01588 
01589 }
01590 
01591 
01592 void
01593 on_copy3_activate                      (GtkMenuItem     *menuitem,
01594                                         gpointer         user_data)
01595 {
01596 
01597 }
01598 
01599 
01600 void
01601 on_paste3_activate                     (GtkMenuItem     *menuitem,
01602                                         gpointer         user_data)
01603 {
01604 
01605 }
01606 
01607 
01608 void
01609 on_clear3_activate                     (GtkMenuItem     *menuitem,
01610                                         gpointer         user_data)
01611 {
01612 
01613 }
01614 
01615 
01616 void
01617 on_properties3_activate                (GtkMenuItem     *menuitem,
01618                                         gpointer         user_data)
01619 {
01620 
01621 }
01622 
01623 
01624 void
01625 on_preferences2_activate               (GtkMenuItem     *menuitem,
01626                                         gpointer         user_data)
01627 {
01628 
01629 }
01630 
01631 void
01632 on_TableWindow_exit_activate           (GtkMenuItem     *menuitem,
01633                                         gpointer         user_data)
01634 {
01635 
01636         /* code to close the TableWindow */
01637 
01638 }
01639 
01640 
01641 
01642 
01643 
01644 
01645 void
01646 on_MetaData_clicked                    (GtkButton       *button,
01647                                         gpointer         user_data)
01648 {
01649   GtkWidget *MetaDataWindow;
01650   GtkWidget *ctree;
01651   GtkCTreeNode *node;
01652   FM_RowStatus *rowstatus;
01653   gchar *col[1];
01654   gint result;
01655   guint8 spacing[1];
01656   GdkPixmap *pixmap[1];
01657   GdkBitmap *mask[1];
01658   gchar *tablename;
01659   gchar *buffer;
01660 
01661   ctree = gtk_object_get_data(GTK_OBJECT(Fmaps),"ctree_table_list");
01662 
01663   /* I still don't know how to use gtk_ctree_find_by_row_data therefore I browse the list */
01664 
01665   node = gtk_ctree_node_nth(GTK_CTREE(ctree),0);
01666 
01667   while (node!=NULL)
01668   {
01669     rowstatus = gtk_ctree_node_get_row_data(GTK_CTREE(ctree),node);
01670 
01671     if (rowstatus!=NULL && rowstatus->selected)
01672     {
01673       result = gtk_ctree_node_get_pixtext(GTK_CTREE(ctree),node,0,col,spacing,pixmap,mask);
01674 
01675       tablename = g_strchomp(*col);
01676       /* show the table window */
01677       MetaDataWindow = create_MetaDataWindow ();
01678       buffer=g_strdup_printf("%s - MetaData",tablename);
01679       gtk_window_set_title(GTK_WINDOW(MetaDataWindow),buffer);
01680       g_free(buffer);
01681       FM_Init_MetaData(MetaDataWindow);
01682       FM_Display_MetaData(MetaDataWindow,tablename);
01683       gtk_widget_show (MetaDataWindow);
01684     }
01685     node=GTK_CTREE_NODE_NEXT(node);
01686   }
01687 }
01688 
01689 
01690 void
01691 on_new_file3_activate                  (GtkMenuItem     *menuitem,
01692                                         gpointer         user_data)
01693 {
01694 
01695 }
01696 
01697 
01698 void
01699 on_open3_activate                      (GtkMenuItem     *menuitem,
01700                                         gpointer         user_data)
01701 {
01702 
01703 }
01704 
01705 
01706 void
01707 on_save3_activate                      (GtkMenuItem     *menuitem,
01708                                         gpointer         user_data)
01709 {
01710 
01711 }
01712 
01713 
01714 void
01715 on_save_as3_activate                   (GtkMenuItem     *menuitem,
01716                                         gpointer         user_data)
01717 {
01718 
01719 }
01720 
01721 
01722 void
01723 on_exit3_activate                      (GtkMenuItem     *menuitem,
01724                                         gpointer         user_data)
01725 {
01726 
01727 }
01728 
01729 
01730 void
01731 on_cut4_activate                       (GtkMenuItem     *menuitem,
01732                                         gpointer         user_data)
01733 {
01734 
01735 }
01736 
01737 
01738 void
01739 on_copy4_activate                      (GtkMenuItem     *menuitem,
01740                                         gpointer         user_data)
01741 {
01742 
01743 }
01744 
01745 
01746 void
01747 on_paste4_activate                     (GtkMenuItem     *menuitem,
01748                                         gpointer         user_data)
01749 {
01750 
01751 }
01752 
01753 
01754 void
01755 on_clear4_activate                     (GtkMenuItem     *menuitem,
01756                                         gpointer         user_data)
01757 {
01758 
01759 }
01760 
01761 
01762 void
01763 on_properties4_activate                (GtkMenuItem     *menuitem,
01764                                         gpointer         user_data)
01765 {
01766 
01767 }
01768 
01769 
01770 void
01771 on_preferences3_activate               (GtkMenuItem     *menuitem,
01772                                         gpointer         user_data)
01773 {
01774 
01775 }
01776 
01777 
01778 void
01779 on_about2_activate                     (GtkMenuItem     *menuitem,
01780                                         gpointer         user_data)
01781 {
01782 
01783 }
01784 
01785 
01786 void
01787 on_MetaData_Save_clicked               (GtkButton       *button,
01788                                         gpointer         user_data)
01789 {
01790         GtkWidget *metadatawindow;
01791         
01792   metadatawindow=lookup_widget(GTK_WIDGET(button),"MetaDataWindow");
01793   FM_Save_MetaData(metadatawindow);
01794   
01795 }
01796 
01797 
01798 void
01799 on_MetaData_Revert_clicked             (GtkButton       *button,
01800                                         gpointer         user_data)
01801 {
01802 
01803 }
01804 

Generated at Sat Jan 6 20:55:33 2001 for FMaps by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000