00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <gtk/gtk.h>
00029 #include "config.h"
00030 #include "gxsm/plugin.h"
00031 #include "stdio.h"
00032
00033 #include "mathilbl.h"
00034
00035 static void islandlbl_init( void );
00036 static void islandlbl_about( void );
00037 static void islandlbl_query( void );
00038 static void islandlbl_configure(void);
00039 static void islandlbl_cleanup( void );
00040 void toggle_button_callback1( GtkWidget *widget, gpointer data);
00041 void toggle_button_callback2( GtkWidget *widget, gpointer data);
00042 void enter_callback( GtkWidget *widget, GtkWidget *entry );
00043
00044 GxsmPlugin islandlbl_pi = {
00045 NULL,
00046 NULL,
00047 0,
00048 NULL,
00049 "Islandlbl-M1S-ST",
00050 "+STM +AFM",
00051 NULL,
00052 "Markus Bierkandt and Percy Zahl",
00053 N_("_Math/_Statistics/"),
00054 "...",
00055 NULL,
00056 "no more info",
00057 NULL,
00058 NULL,
00059 islandlbl_init,
00060 islandlbl_query,
00061 islandlbl_about,
00062 islandlbl_configure,
00063 NULL,
00064 islandlbl_cleanup
00065 };
00066
00067 static const char *about_text = N_("Gxsm Islandlbl Plugin:\n"
00068 "Perform some Statistics: Island Labeling, counting, ...\n"
00069 "Mathroutines by Markus Bierkandt 2000,\n"
00070 "Pluginsupport by Percy Zahl 2000.");
00071
00072 GxsmPlugin *get_gxsm_plugin_info ( void ){
00073 islandlbl_pi.description = g_strdup_printf(N_("Gxsm MathOneArg islandlbl plugin %s"), VERSION);
00074 return &islandlbl_pi;
00075 }
00076
00077 static void islandlbl_query(void)
00078 {
00079 static GnomeUIInfo menuinfo[] = {
00080 { GNOME_APP_UI_ITEM,
00081 N_("Step Flaten"), N_("MB's super Step Flaten Algo"),
00082 (gpointer) App::math_onearg_callback, (gpointer) StepFlaten,
00083 NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK,
00084 0, GDK_CONTROL_MASK, NULL },
00085
00086 { GNOME_APP_UI_ITEM,
00087 N_("Kill step islands"), N_("kills and counts step islands"),
00088 (gpointer) App::math_onearg_callback, (gpointer) KillStepIslands,
00089 NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK,
00090 0, GDK_CONTROL_MASK, NULL },
00091
00092 { GNOME_APP_UI_ITEM,
00093 N_("IslandLabl"), N_("MB's island labeling tool"),
00094 (gpointer) App::math_onearg_callback, (gpointer) IslandLabl,
00095 NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BLANK,
00096 0, GDK_CONTROL_MASK, NULL },
00097
00098 GNOMEUIINFO_SEPARATOR,
00099 GNOMEUIINFO_END
00100 };
00101
00102 gnome_app_insert_menus(GNOME_APP(islandlbl_pi.app->getApp()), islandlbl_pi.menupath, menuinfo);
00103
00104 if(islandlbl_pi.status) g_free(islandlbl_pi.status);
00105 islandlbl_pi.status = g_strconcat(N_("Plugin query has attached "),
00106 islandlbl_pi.name,
00107 N_(": StepFlaten, KillStepIslands and IslandLabl are ready to use"),
00108 NULL);
00109 }
00110
00111
00112 static void islandlbl_init(void)
00113 {
00114 PI_DEBUG (DBG_L2, "Vorlage Plugin Init");
00115 filename = g_strdup("/tmp/test.asc");
00116 }
00117
00118 static void islandlbl_about(void)
00119 {
00120 const gchar *authors[] = { "Markus Bierkandt", "Percy Zahl", NULL};
00121 gtk_widget_show(gnome_about_new ( islandlbl_pi.name,
00122 VERSION,
00123 N_("(C) 2000 the Free Software Foundation"),
00124 about_text,
00125 authors,
00126 NULL, NULL, NULL
00127 ));
00128 }
00129
00130
00131
00132 void toggle_button_callback1( GtkWidget *widget, gpointer data)
00133 {
00134 if (GTK_TOGGLE_BUTTON (widget)->active){
00135 inter=1;
00136 printf("interaktiver Dialog enabled\n");
00137 }
00138 else{
00139 inter=0;
00140 printf("interaktiver Dialog disabled\n");
00141 }
00142 }
00143
00144 void toggle_button_callback2( GtkWidget *widget, gpointer data)
00145 {
00146 if (GTK_TOGGLE_BUTTON (widget)->active){
00147 save=1;
00148 printf("Dateiausgabe enabled\n");
00149 }
00150 else{
00151 save=0;
00152 printf("Dateiausgabe disabled\n");
00153 }
00154 }
00155
00156 void enter_callback( GtkWidget *widget, GtkWidget *entry )
00157 {
00158
00159
00160
00161 if (filename) g_free(filename);
00162 filename = g_strdup( gtk_entry_get_text(GTK_ENTRY(entry)));
00163 printf("Filename: %s\n", filename);
00164 }
00165
00166
00167 static void islandlbl_configure(void)
00168 {
00169 GtkWidget *dialog;
00170 GtkWidget *vbox, *fbox;
00171 GtkWidget *hbox, *hbox_check1, *hbox_check2, *hbox_entry, *entry;
00172 GtkWidget *checkbutton1, *checkbutton2;
00173 GtkWidget *input;
00174
00175 dialog = gnome_dialog_new(_("Monte-Carlo Auswertung Setup"),
00176 GNOME_STOCK_BUTTON_OK,
00177 NULL);
00178
00179 gnome_dialog_set_close(GNOME_DIALOG(dialog), FALSE);
00180 gnome_dialog_close_hides(GNOME_DIALOG(dialog), FALSE);
00181 gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
00182
00183 vbox = gtk_vbox_new (FALSE, 0);
00184 gtk_widget_show (vbox);
00185
00186 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),
00187 vbox, TRUE, TRUE, GNOME_PAD);
00188
00189
00190
00191
00192
00193
00194
00195 fbox = gtk_frame_new (N_("Default-Werte"));
00196 gtk_widget_show (fbox);
00197 gtk_container_add(GTK_CONTAINER(vbox), fbox);
00198
00199 vbox = gtk_vbox_new (FALSE, 0);
00200 gtk_widget_show (vbox);
00201 gtk_container_add (GTK_CONTAINER (fbox), vbox);
00202
00203
00204
00205 input = islandlbl_pi.app->mygtk_create_input("Stepamount", vbox, hbox);
00206 Gtk_EntryControl ECvar_sa(islandlbl_pi.app->xsm->Unity, "Value out of range !", &d_sa,
00207 0, 256, ".0f", input);
00208 input = islandlbl_pi.app->mygtk_create_input("periodische RB", vbox, hbox);
00209 Gtk_EntryControl ECvar_pr(islandlbl_pi.app->xsm->Unity, "Value out of range !", &d_pr,
00210 -1, 5, ".0f", input);
00211
00212
00213
00214 hbox_check1 = gtk_hbox_new (FALSE, 0);
00215 gtk_widget_show (hbox_check1);
00216 gtk_container_add (GTK_CONTAINER (vbox), hbox_check1);
00217
00218
00219 checkbutton1 = gtk_check_button_new_with_label("Interaktiver Dialog");
00220 gtk_box_pack_start (GTK_BOX (hbox_check1), checkbutton1, TRUE, TRUE, 0);
00221 gtk_widget_show (checkbutton1);
00222 gtk_signal_connect (GTK_OBJECT (checkbutton1), "clicked",
00223 GTK_SIGNAL_FUNC (toggle_button_callback1), NULL);
00224 if (inter==1) gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (checkbutton1), TRUE );
00225 else gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (checkbutton1), FALSE );
00226
00227
00228
00229 hbox_check2 = gtk_hbox_new (FALSE, 0);
00230 gtk_widget_show (hbox_check2);
00231 gtk_container_add (GTK_CONTAINER (vbox), hbox_check2);
00232
00233
00234 checkbutton2 = gtk_check_button_new_with_label("Ausgabe in Datei");
00235 gtk_box_pack_start (GTK_BOX (hbox_check2), checkbutton2, TRUE, TRUE, 0);
00236 gtk_widget_show (checkbutton2);
00237 gtk_signal_connect (GTK_OBJECT (checkbutton2), "clicked",
00238 GTK_SIGNAL_FUNC (toggle_button_callback2), NULL);
00239 if (save==1) gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (checkbutton2), TRUE );
00240 else gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (checkbutton2), FALSE );
00241
00242
00243 hbox_entry = gtk_hbox_new (FALSE, 0);
00244 gtk_widget_show (hbox_entry);
00245 gtk_container_add (GTK_CONTAINER (vbox), hbox_entry);
00246
00247 entry = gtk_entry_new_with_max_length (50);
00248 gtk_signal_connect (GTK_OBJECT (entry), "activate",
00249 GTK_SIGNAL_FUNC (enter_callback), entry);
00250 gtk_entry_set_text (GTK_ENTRY (entry), filename);
00251 gtk_box_pack_start (GTK_BOX (hbox_entry), entry, TRUE, TRUE, 0);
00252 gtk_widget_show (entry);
00253
00254 input = islandlbl_pi.app->mygtk_create_input("MC-Base:", vbox, hbox);
00255 Gtk_EntryControl ECvar_lbn(islandlbl_pi.app->xsm->Unity, "Value out of range !", &d_lbn,
00256 2., 10., ".0f", input);
00257
00258
00259 gtk_widget_show(dialog);
00260
00261 gnome_dialog_run_and_close(GNOME_DIALOG(dialog));
00262 }
00263
00264
00265
00266 static void islandlbl_cleanup( void ){
00267 PI_DEBUG (DBG_L2, "IslandLbl Plugin Cleanup");
00268 gchar *mp = g_strconcat(islandlbl_pi.menupath, N_("Step Flaten"), NULL);
00269 gnome_app_remove_menus (GNOME_APP( islandlbl_pi.app->getApp() ), mp, 4);
00270 g_free(mp);
00271 if (filename){
00272 g_free(filename);
00273 filename=NULL;
00274 }
00275 }