PIPS
gtk_select.c
Go to the documentation of this file.
1 /*
2 
3  $Id: gtk_select.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <unistd.h>
31 
32 #include <sys/time.h>
33 #include <sys/resource.h>
34 
35 #if (defined(TEXT))
36 #undef TEXT
37 #endif
38 
39 #if (defined(TEXT_TYPE))
40 #undef TEXT_TYPE
41 #endif
42 
43 #include "genC.h"
44 #include "linear.h"
45 #include "ri.h"
46 #include "ri-util.h"
47 #include "database.h"
48 
49 #include "misc.h"
50 #include "pipsdbm.h"
51 #include "pipsmake.h"
52 #include "top-level.h"
53 
54 #include "resources.h"
55 #include "preprocessor.h"
56 
57 #undef test_undefined // also defined in glib included from gtk
58 #include <gtk/gtk.h>
59 #include "gpips.h"
60 
61 /* Maximum size of the module menu of the main frame: */
62 enum {
64 };
65 
66 GtkWidget * directory_menu_item;
67 
70 
71 success close_workspace_notify(GtkWidget * widget, gpointer data);
72 
73 /* To enable or disable the menu items generated by generate_module_menu(): */
80 
81 /* Try to select a main module (that is the PROGRAM in the Fortran
82  stuff) if no one is selected: */
85 
86  if (module_name == NULL) {
87  /* Ok, no current module, then find a main module (PROGRAM): */
88  string main_module_name = get_first_main_module();
89 
90  if (!string_undefined_p(main_module_name)) {
91  /* Ok, we got it ! Now we select it: */
92  module_name = main_module_name;
93  user_log("Main module PROGRAM \"%s\" found.\n", module_name);
95  /* GO: show_module() has already been called so return now */
96  return;
97  }
98  }
99  /* Refresh the module name on the status window: */
100  show_module();
101 }
102 
103 success end_directory_notify(const char * dir) {
104  char *s;
105 
106  /* if (dir != NULL) {*/
107  if ((s = pips_change_directory(dir)) == NULL) {
108  user_log("Directory \"%s\" does not exist\n", dir);
109  prompt_user("Directory \"%s\" does not exist\n", dir);
110  show_directory();
111  return FALSE;
112  } else {
113  user_log("Directory \"%s\" selected\n", dir);
114  show_directory();
115  return TRUE;
116  }
117 }
118 
119 void end_directory_text_notify(GtkWidget * text_item, gpointer data) {
120  (void) end_directory_notify(gtk_entry_get_text(GTK_ENTRY(text_item)));
121 }
122 
123 /* FC: uses an external wish script
124  * I do not know how to activate this function safely...
125  */
127  char newdir[MAXPATHLEN];
128  char * tmp = strdup("/tmp/gpips.dir.XXXXXX");
129  int i = 0, c;
130  FILE * tmph;
131 
132  (void) mkstemp(tmp);
133 
135  return; /* no cd in this state! */
136 
137  safe_system(concatenate("gpips-changedir -- ", get_cwd(), " > ", tmp, NULL));
138 
139  tmph = safe_fopen(tmp, "r");
140  while ((c = getc(tmph)) != EOF && i < MAXPATHLEN)
141  newdir[i++] = c;
142  newdir[i - 1] = '\0'; /* last was \n */
143  safe_fclose(tmph, tmp);
144 
145  end_directory_notify(newdir);
146 
147  unlink(tmp);
148  free(tmp);
149 
150  return /* generate_workspace_menu(); */;
151 }
152 
153 GtkWidget * generate_directory_menu() {
155 }
156 
158  gpointer data) {
159  /* First untype whatever the user typed: */
160  show_directory();
161  prompt_user("You have to close the current workspace"
162  " before changing directory.");
163 }
164 
165 void start_directory_notify(GtkWidget * widget, gpointer data) {
168  else
169  start_query("Change Directory", "Enter directory path: ",
170  "ChangeDirectory", end_directory_notify, cancel_query_notify);
171 }
172 
174  gtk_widget_set_sensitive(GTK_WIDGET(directory_menu_item), TRUE);
175 
176  /* Enable the normal notify mode: notify when return and so is
177  typed: */
178  gtk_widget_set_sensitive(GTK_WIDGET(directory_name_entry), TRUE);
179  g_signal_connect(G_OBJECT(directory_name_entry), "activate", G_CALLBACK(
181 
184 }
185 
187  gtk_widget_set_sensitive(GTK_WIDGET(directory_menu_item), FALSE);
188 
189  /* In order to warn the user as soon as possible that (s)he can't
190  change the directory, notify for whatever character: */
191  gtk_widget_set_sensitive(GTK_WIDGET(directory_name_entry), FALSE);
192  g_signal_connect(G_OBJECT(directory_name_entry), "activate", G_CALLBACK(
194 
197 }
198 
202  else
204 }
205 
207  gtk_widget_set_sensitive(GTK_WIDGET(create_menu_item), FALSE);
208  gtk_widget_set_sensitive(GTK_WIDGET(open_menu_item), FALSE);
209  gtk_widget_set_sensitive(GTK_WIDGET(workspace_name_entry), FALSE);
211 }
212 
214  gtk_widget_set_sensitive(GTK_WIDGET(create_menu_item), TRUE);
215  gtk_widget_set_sensitive(GTK_WIDGET(open_menu_item), TRUE);
216  gtk_widget_set_sensitive(GTK_WIDGET(workspace_name_entry), TRUE);
218 }
219 
221  /* Avoid also to delete a workspace during a creation in case the
222  name of the workspace is the same... */
225  gtk_widget_set_sensitive(GTK_WIDGET(workspace_name_entry), FALSE);
226 }
227 
231  gtk_widget_set_sensitive(GTK_WIDGET(workspace_name_entry), TRUE);
232 }
233 
235  gtk_widget_set_sensitive(GTK_WIDGET(close_menu_item), FALSE);
238  /* For generate_module_menu(): */
240 }
241 
243  gtk_widget_set_sensitive(GTK_WIDGET(close_menu_item), TRUE);
244  /* For generate_module_menu(): */
246 }
247 
251 }
252 
254  gtk_widget_set_sensitive(GTK_WIDGET(module_menu_item), FALSE);
255  gtk_widget_set_sensitive(GTK_WIDGET(module_name_entry), FALSE);
260 }
261 
263  gtk_widget_set_sensitive(GTK_WIDGET(module_menu_item), TRUE);
264  gtk_widget_set_sensitive(GTK_WIDGET(module_name_entry), TRUE);
265  /* Well, after a workspace creation without automatic module
266  selection successful, there is no module selected and thus the
267  following menus are not very interestiong, except for the option
268  part of the option selection. Anyway, there is a guard in each
269  of these menu, so, just do nothing... :-) */
274 }
275 
276 void end_delete_workspace_notify(const char * name) {
277  schoose_close();
278 
279  if (db_get_current_workspace_name() != NULL && strcmp(
280  db_get_current_workspace_name(), name) == 0) {
281  int result;
282 
283  GtkWidget * dialog = gtk_message_dialog_new(GTK_WINDOW(log_window),
284  GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO,
285  GTK_BUTTONS_YES_NO, "%s", concatenate("The workspace ", name,
286  " is currently opened!\n",
287  "Do you really want to close and remove it ?", NULL));
288  result = gtk_dialog_run(GTK_DIALOG(dialog));
289  gtk_widget_destroy(dialog);
290 
291  if (result == GTK_RESPONSE_NO || !close_workspace_notify(NULL, NULL))
292  goto do_not_delete_the_workspace;
293  }
294 
295  (void) delete_workspace(name);
296 
297  do_not_delete_the_workspace: enable_workspace_delete_or_open();
301 
303 }
304 
306  /* Nothing to do. */
311 }
312 
313 void start_delete_workspace_notify(GtkWidget * widget, gpointer data) {
314  gen_array_t workspace_list;
315  int workspace_list_length = 0;
316 
317  workspace_list = gen_array_make(0);
318  pips_get_workspace_list(workspace_list);
319  workspace_list_length = gen_array_nitems(workspace_list);
320 
321  if (workspace_list_length == 0) {
322  prompt_user("No workspace available in this directory.");
323  } else {
328 
329  schoose("Select the Workspace to Delete", workspace_list,
330  /* current workspace as default choice : */
333  }
334  gen_array_full_free(workspace_list);
335 }
336 
337 void start_create_workspace_notify(GtkWidget * widget, gpointer data) {
341 
342  if (db_get_current_workspace_name() != NULL)
343  /* There is an open workspace: close it first: */
344  if (!close_workspace_notify(NULL, NULL)) {
345  /* If it fails: */
346  cancel_create_workspace_notify(NULL, NULL);
347  return;
348  }
349 
350  start_query("Create Workspace", "Enter workspace name: ",
351  "CreateWorkspace", continue_create_workspace_notify,
352  /* Pas la peine de faire quelque chose si on appuie
353  sur cancel : */
355 }
356 
357 void cancel_create_workspace_notify(GtkWidget * widget, gpointer data) {
358  /* enable the rights (in the gui) to create or open a workspace : */
362  cancel_query_notify(widget, data);
363  show_workspace();
364 }
365 
367  gen_array_t fortran_list;
368  int fortran_list_length = 0;
369 
370  /* Is the name a valid workspace name? */
371  if (!workspace_name_p(name)) {
373  } else {
374  fortran_list = gen_array_make(0);
375  pips_get_fortran_list(fortran_list);
376  fortran_list_length = gen_array_nitems(fortran_list);
377 
378  if (fortran_list_length == 0) {
379  prompt_user("No Fortran files in this directory");
380  } else {
381  /* Code added to confirm for a database destruction before
382  opening a database with the same name.
383  RK 18/05/1993. */
384  if (workspace_exists_p(name)) {
385  int result;
386 
387  GtkWidget * dialog = gtk_message_dialog_new(GTK_WINDOW(
388  log_window), GTK_DIALOG_DESTROY_WITH_PARENT,
389  GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO, "%s", concatenate(
390  "The database ", name, " already exists!\n",
391  "Do you really want to remove it ?", NULL));
392  result = gtk_dialog_run(GTK_DIALOG(dialog));
393  gtk_widget_destroy(dialog);
394 
395  if (result == GTK_RESPONSE_NO) {
396  goto continue_create_workspace_notify_failed;
397  }
398  }
399 
401 
402  // On enregistre le nom du workspace qui va être créé dans l'entry associée
403  gtk_entry_set_text(GTK_ENTRY(workspace_name_entry), name);
404 
405  if (fortran_list_length == 1) {
406  /* Only one Fortran program: use it without user
407  confirmation. */
408  user_log(
409  "There is only one Fortran program in the current directory.\n"
410  "\tCreating the workspace \"%s\" from the file \"%s\"...\n",
411  name, gen_array_item(fortran_list, 0));
412  end_create_workspace_notify(fortran_list);
413  } else {
414  mchoose("Create Workspace", fortran_list,
416  (void(*)(void)) cancel_create_workspace_notify);
417  }
418  /* Memory leak if mchoose exit... */
419  gen_array_full_free(fortran_list);
420 
421  return (TRUE);
422  }
423  }
424 
425  /* If it failed, cancel the creation: */
426  continue_create_workspace_notify_failed: cancel_create_workspace_notify(
427  NULL, NULL);
428 
429  return FALSE;
430 }
431 
432 void user_prompt_not_a_valid_workspace_name(const char * workspace_name) {
433  prompt_user("The name \"%s\" is not a valid workspace name!\n",
434  workspace_name);
438 }
439 
441  /* If the user click quickly on OK, be sure
442  end_create_workspace_notify() is not reentrant by verifying
443  something as not been opened already: */
444  const char* workspace_name_to_create = gtk_entry_get_text(GTK_ENTRY(
446  if (db_get_current_workspace_name() == NULL) {
447  /* Is the name a valid workspace name? */
450  /* The create workspace has been successful: */
451  /* open_log_file(); */
453 
454  if (create_workspace(files)) {
455  /* The processing of user files has been successful: */
457 
458  show_workspace();
462 
465 
467 
468  return;
469  } else
470  /* close_log_file(); */
471  ;
472  }
473  } else
475 
476  /* The creation failed: */
480 
482  }
483 }
484 
485 void end_open_workspace_notify(const char* name) {
486  schoose_close();
487 
488  if (open_workspace(name)) {
489  /* open_log_file(); */
491  show_workspace();
495  }
496 
498 
500 }
501 
505  show_workspace();
506 }
507 
508 void open_workspace_notify(GtkWidget * widget, gpointer data) {
509  gen_array_t workspace_list;
510  int workspace_list_length = 0;
511 
512  workspace_list = gen_array_make(0);
513  pips_get_workspace_list(workspace_list);
514  workspace_list_length = gen_array_nitems(workspace_list);
515 
516  if (workspace_list_length == 0) {
517  prompt_user("No workspace available in this directory.");
518  } else if (workspace_list_length == 1) {
519  /* There is only workspace: open it without asking confirmation
520  to the user: */
521  user_log("There is only one workspace in the current directory.\n"
522  "\tOpening the workspace \"%s\"...\n", gen_array_item(
523  workspace_list, 0));
524  end_open_workspace_notify(gen_array_item(workspace_list, 0));
525  } else {
527 
528  schoose("Select Workspace", workspace_list,
529  /* Choix initial sur le workspace courant si
530  possible : */
533  }
534  gen_array_full_free(workspace_list);
535 }
536 
537 success close_workspace_notify(GtkWidget * widget, gpointer data) {
538  success return_value;
539 
540  return_value = close_workspace(FALSE);
541  debug(1, "close_workspace_notify", "return_value = %d\n", return_value);
542 
543  if (return_value) {
544  /* The close has been successful: */
545  /* close_log_file(); */
547 
548  edit_close_notify(NULL, NULL);
549 
552 
553  /* It is the only place to enable a directory change, after a close
554  workspace: */
556 
558  }
559 
560  hide_window(schoose_window, NULL, NULL);
561  show_workspace();
562  show_module();
564 
565  return return_value;
566 }
567 
568 /* To be used with schoose_create_abbrev_menu_with_text from the main
569  panel: */
570 void open_or_create_workspace(const char * workspace_name_original) {
571  int i;
572  gen_array_t workspace_list;
573  int workspace_list_length = 0;
574  char workspace_name[SMALL_BUFFER_LENGTH];
575 
576  /* If close_workspace_notify() is called below, show_workspace() will
577  set the name to "(* none *)" in the panel and
578  workspace_name_original is directly a pointer to it ! */
579  (void) strncpy(workspace_name, workspace_name_original,
580  sizeof(workspace_name) - 1);
581 
582  if (!workspace_name_p(workspace_name)) {
583  /* Prompt the warning and restore the menu enable state: */
585  show_workspace();
586  return;
587  }
588 
589  if (db_get_current_workspace_name() != NULL)
590  /* There is an open workspace: close it first: */
591  if (!close_workspace_notify(NULL, NULL))
592  return;
593 
594  /* To choose between open or create, look for the an existing
595  workspace with the same name: */
596  workspace_list = gen_array_make(0);
597  pips_get_workspace_list(workspace_list);
598  workspace_list_length = gen_array_nitems(workspace_list);
599 
600  for (i = 0; i < workspace_list_length; i++) {
601  string name = gen_array_item(workspace_list, i);
602  if (strcmp(workspace_name, name) == 0) {
603  /* OK, the workspace exists, open it: */
604  end_open_workspace_notify(workspace_name);
605  return;
606  }
607  }
608  /* The workspace does not exist, create it: */
610  gen_array_full_free(workspace_list);
611  (void) continue_create_workspace_notify(workspace_name);
612 }
613 
614 // "workspace name entry" is set to the value chosen in the choice menu
615 // and then we calls the callback associated to the activation of
616 // the "workspace name entry" thanks to the "activate" signal
617 // (opens or creates a workspace)
618 void select_workspace_notify(GtkWidget * w, gpointer data __attribute__((unused))) {
619  gtk_entry_set_text(GTK_ENTRY(workspace_name_entry),
621  g_signal_emit_by_name(workspace_name_entry, "activate");
622 }
623 
624 /* To use with schoose_create_abbrev_menu_with_text: */
625 GtkWidget * generate_workspace_menu() {
626  GtkWidget * menu;
627 
628  GtkWidget * delete_menu_item;
629  int i;
630  gen_array_t workspace_list;
631  int workspace_list_length = 0;
632 
633  workspace_list = gen_array_make(0);
634  pips_get_workspace_list(workspace_list);
635  workspace_list_length = gen_array_nitems(workspace_list);
636 
637  menu = gtk_menu_new();
638 
639  /* Replace the Select Workspace menu from the status window with
640  the following items: */
641  GtkWidget * temp_item;
642 
643  temp_item = gtk_menu_item_new_with_label("Create Workspace");
644  g_signal_connect(G_OBJECT(temp_item), "activate",
645  G_CALLBACK(start_create_workspace_notify), NULL);
646  gtk_menu_append(GTK_MENU(menu), temp_item);
647  gtk_widget_set_sensitive(temp_item, !gpips_create_workspace_menu_inactive);
648 
649  temp_item = gtk_menu_item_new_with_label("Close Workspace");
650  g_signal_connect(G_OBJECT(temp_item), "activate", G_CALLBACK(close_workspace_notify),
651  NULL);
652  gtk_menu_append(GTK_MENU(menu), temp_item);
653  gtk_widget_set_sensitive(temp_item, !gpips_close_workspace_menu_inactive);
654 
655  delete_menu_item = gtk_menu_item_new_with_label("Delete Workspace");
656  g_signal_connect(G_OBJECT(delete_menu_item), "activate",
657  G_CALLBACK(start_delete_workspace_notify), NULL);
658  gtk_menu_append(GTK_MENU(menu), delete_menu_item);
659  gtk_widget_set_sensitive(delete_menu_item,
661 
662  /* Now complete with the list of the workspaces: */
663  if (workspace_list_length == 0) {
664  temp_item = gtk_menu_item_new_with_label(
665  "* No workspace available in this directory *");
666  gtk_menu_append(GTK_MENU(menu), temp_item);
667  gtk_widget_set_sensitive(temp_item, FALSE);
668  /* Well, since there is no workspace, there is nothing to
669  delete... */
670  gtk_widget_set_sensitive(delete_menu_item, FALSE);
671  } else {
672  gtk_menu_append(GTK_MENU(menu), gtk_separator_menu_item_new());
673  for (i = 0; i < workspace_list_length; i++) {
674  string name = gen_array_item(workspace_list, i);
675  temp_item = gtk_menu_item_new_with_label(name);
676  gtk_menu_append(GTK_MENU(menu), temp_item);
677  g_signal_connect(G_OBJECT(temp_item), "activate",
678  G_CALLBACK(select_workspace_notify), NULL);
679  gtk_widget_set_sensitive(temp_item,
681  }
682  }
683 
684  gen_array_full_free(workspace_list);
685 
686  gtk_widget_show_all(menu);
687 
688  return menu;
689 }
690 
691 void end_select_module_callback(const char* name) {
692  gen_array_t module_list = db_get_module_list();
693  int module_list_length = gen_array_nitems(module_list);
694 
695  if (module_list_length == 0) {
696  prompt_user("No module available in this workspace.");
697  } else {
698  bool module_found = FALSE;
699  int i;
700 
701  for (i = 0; i < module_list_length; i++) {
702  string mn = gen_array_item(module_list, i);
703  if (strcmp(name, mn) == 0) {
704  module_found = TRUE;
705  break;
706  }
707  }
708  if (module_found)
709  lazy_open_module(name);
710  else
711  prompt_user("The module \"%s\" does not exist in this workspace.",
712  name);
713  }
714 
715  show_module();
717  gen_array_full_free(module_list);
718 }
719 
721 }
722 
723 void select_module_from_menubar_callback(GtkWidget * widget, gpointer data) {
724  gen_array_t module_list = db_get_module_list();
725  int module_list_length = gen_array_nitems(module_list);
726 
727  if (module_list_length == 0) {
728  /* If there is no module... RK, 23/1/1993. */
729  prompt_user("No module available in this workspace.");
730  } else
731  schoose("Select Module", module_list,
732  /* Affiche comme choix courant le module
733  courant (c'est utile si on ferme la fenï¿œtre
734  module entre temps) : */
737 
738  gen_array_full_free(module_list);
739 }
740 
741 static void select_module_from_status_menu_callback(GtkWidget * widget, gpointer data __attribute__((unused)))
742 {
743  const char * module_name = gpips_gtk_menu_item_get_label(widget);
744  gtk_entry_set_text(GTK_ENTRY(module_name_entry), module_name);
746 }
747 
748 /* participe à la génération du menu associés aux modules dans la fenetre principale */
749 GtkWidget * generate_module_menu() {
750  GtkWidget * menu;
751  int i;
752 
753  menu = gtk_menu_new();
754 
755  if (db_get_current_workspace_name() == NULL) {
756  GtkWidget * no_workspace_menu_item;
757  no_workspace_menu_item = gtk_menu_item_new_with_label(
758  "* No workspace yet! *");
759  gtk_widget_set_sensitive(no_workspace_menu_item, FALSE);
760  gtk_menu_append(GTK_MENU(menu), no_workspace_menu_item);
761  } else {
762  gen_array_t module_list = db_get_module_list();
763  int module_list_length = gen_array_nitems(module_list);
764 
765  if (module_list_length == 0) {
766  GtkWidget * no_workspace_menu_item;
767  no_workspace_menu_item = gtk_menu_item_new_with_label(
768  "* No module available in this workspace *");
769  gtk_widget_set_sensitive(no_workspace_menu_item, FALSE);
770  gtk_menu_append(GTK_MENU(menu), no_workspace_menu_item);
771  } else {
772  GtkWidget * module_menu_item;
773  for (i = 0; i < module_list_length; i++) {
774  string mn = gen_array_item(module_list, i);
775  module_menu_item = gtk_menu_item_new_with_label(mn);
776  gtk_menu_append(GTK_MENU(menu), module_menu_item);
777  g_signal_connect(G_OBJECT(module_menu_item), "activate",
778  G_CALLBACK(select_module_from_status_menu_callback), NULL);
779  }
780  }
781  gen_array_full_free(module_list);
782  }
783 
784  gtk_widget_show_all(menu);
785  return menu;
786 }
787 
789  GtkWidget *menu, *menu_item, *pmenu, *pmenu_item;
790 
791  create_menu_item = gtk_menu_item_new_with_label("Create");
792  g_signal_connect(G_OBJECT(create_menu_item), "activate", G_CALLBACK(
794 
795  open_menu_item = gtk_menu_item_new_with_label("Open");
796  g_signal_connect(G_OBJECT(open_menu_item), "activate", G_CALLBACK(
797  open_workspace_notify), NULL);
798 
799  close_menu_item = gtk_menu_item_new_with_label("Close");
800  g_signal_connect(G_OBJECT(close_menu_item), "activate", G_CALLBACK(
801  close_workspace_notify), NULL);
802  gtk_widget_set_sensitive(GTK_WIDGET(close_menu_item), FALSE);
803 
804  pmenu = gtk_menu_new();
805  gtk_menu_append(GTK_MENU(pmenu), open_menu_item);
806  gtk_menu_append(GTK_MENU(pmenu), create_menu_item);
807  gtk_menu_append(GTK_MENU(pmenu), close_menu_item);
808 
809  pmenu_item = gtk_menu_item_new_with_label("Deal with workspaces");
810  gtk_menu_item_set_submenu(GTK_MENU_ITEM(pmenu_item), pmenu);
811 
812  module_menu_item = gtk_menu_item_new_with_label("Module");
813  g_signal_connect(G_OBJECT(module_menu_item), "activate", G_CALLBACK(
815  gtk_widget_set_sensitive(GTK_WIDGET(module_menu_item), FALSE);
816 
817  directory_menu_item = gtk_menu_item_new_with_label("Directory");
818  g_signal_connect(G_OBJECT(directory_menu_item), "activate", G_CALLBACK(
819  start_directory_notify), NULL);
820 
821  menu = gtk_menu_new();
822  gtk_menu_append(GTK_MENU(menu), module_menu_item);
823  gtk_menu_append(GTK_MENU(menu), pmenu_item);
824  gtk_menu_append(GTK_MENU(menu), directory_menu_item);
825 
826  menu_item = gtk_menu_item_new_with_label("Selection Menu");
827  gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu);
828 
829  gtk_widget_show(menu_item);
830  gtk_widget_show_all(menu);
831 
832  gtk_menu_bar_append(GTK_MENU_BAR(main_window_menu_bar), menu_item);
833 }
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
Definition: 3dnow.h:3
void user_log(const char *format,...)
Definition: message.c:234
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
size_t gen_array_nitems(const gen_array_t a)
Definition: array.c:131
void gen_array_full_free(gen_array_t a)
Definition: array.c:77
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void * gen_array_item(const gen_array_t a, size_t i)
Definition: array.c:143
bool delete_workspace(const char *wname)
Definition: dbm.c:368
bool create_workspace(gen_array_t files)
FI: should be called "initialize_workspace()"; a previous call to db_create_workspace() is useful to ...
Definition: dbm.c:180
bool close_workspace(bool is_quit)
Definition: dbm.c:346
bool lazy_open_module(const char *name)
Do not open a module already opened :
Definition: dbm.c:289
bool open_workspace(const char *name)
should be: success (cf wpips.h)
Definition: dbm.c:309
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
char * get_cwd(void)
returns the current working directory name.
Definition: file.c:486
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
void free(void *)
GtkWidget * schoose_window
Definition: gpips-local.h:36
#define SMALL_BUFFER_LENGTH
Definition: gpips-local.h:24
GtkWidget * log_window
Definition: gpips-local.h:36
bool success
Definition: gpips-local.h:59
GtkWidget * main_window_menu_bar
Definition: gpips.c:62
GtkWidget * generate_a_directory_menu(char *directory)
gen_array_t db_get_module_list(void)
Get an array of all the modules (functions, procedures and compilation units) of a workspace.
Definition: database.c:1266
void disable_compile_selection()
Definition: gtk_compile.c:74
void initialize_gpips_hpfc_hack_for_fabien_and_from_fabien()
Definition: gtk_compile.c:154
void enable_compile_selection()
Definition: gtk_compile.c:78
void disable_view_selection()
Definition: gtk_edit2.c:505
void enable_view_selection()
Definition: gtk_edit2.c:509
void edit_close_notify(GtkWidget *widget, gpointer data)
Definition: gtk_edit2.c:436
void prompt_user(string a_printf_format,...)
Definition: gtk_log.c:66
void mchoose(char *title, gen_array_t array, void(*function_ok)(gen_array_t), void(*function_cancel)(void))
Definition: gtk_mchoose.c:212
void enable_option_selection()
Definition: gtk_props.c:134
void disable_option_selection()
Definition: gtk_props.c:130
void start_query(char *window_title, char *query_title, char *help_topic, success(*ok_func)(const char *), void(*cancel_func)(GtkWidget *, gpointer))
Definition: gtk_query.c:47
void cancel_query_notify(GtkWidget *widget, gpointer data)
hides a window...
Definition: gtk_query.c:118
void schoose(char *title, gen_array_t array, char *initial_choice, void(*function_for_ok)(const char *), void(*function_for_cancel)(void))
Definition: gtk_schoose2.c:150
void schoose_close()
schoose_close() can be called even when schoose window is already closed.
Definition: gtk_schoose2.c:113
void end_directory_text_notify(GtkWidget *text_item, gpointer data)
Definition: gtk_select.c:119
@ GPIPS_MAX_MODULE_MENU_SIZE
Definition: gtk_select.c:63
void prompt_user_not_allowed_to_change_directory(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:157
bool gpips_close_workspace_menu_inactive_old
Definition: gtk_select.c:75
void disable_module_selection()
Definition: gtk_select.c:253
static GtkWidget * close_menu_item
Definition: gtk_select.c:68
void enable_module_selection()
Definition: gtk_select.c:262
bool gpips_change_directory_inactive
Definition: gtk_select.c:78
static GtkWidget * create_menu_item
Definition: gtk_select.c:68
static GtkWidget * open_menu_item
Definition: gtk_select.c:68
void enable_workspace_create_or_open()
Definition: gtk_select.c:213
void disable_workspace_delete_or_open()
Definition: gtk_select.c:220
void start_directory_notify(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:165
GtkWidget * generate_module_menu()
participe Ã&#160; la génération du menu associés aux modules dans la fenetre principale
Definition: gtk_select.c:749
bool gpips_create_workspace_menu_inactive
Definition: gtk_select.c:76
bool gpips_change_directory_inactive_old
Definition: gtk_select.c:79
void disable_change_directory()
Definition: gtk_select.c:186
GtkWidget * directory_menu_item
Definition: gtk_select.c:66
bool gpips_open_workspace_menu_inactive
Definition: gtk_select.c:77
void enable_workspace_close()
Definition: gtk_select.c:242
void start_delete_workspace_notify(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:313
void create_select_menu()
Definition: gtk_select.c:788
GtkWidget * generate_workspace_menu()
To use with schoose_create_abbrev_menu_with_text:
Definition: gtk_select.c:625
void end_delete_workspace_notify(const char *name)
Definition: gtk_select.c:276
void select_a_module_by_default()
Try to select a main module (that is the PROGRAM in the Fortran stuff) if no one is selected:
Definition: gtk_select.c:83
static GtkWidget * module_menu_item
Definition: gtk_select.c:69
void cancel_select_module_notify(void)
Definition: gtk_select.c:720
void end_open_workspace_notify(const char *name)
Definition: gtk_select.c:485
void disable_workspace_create_or_open()
Definition: gtk_select.c:206
success end_directory_notify(const char *dir)
Definition: gtk_select.c:103
void end_select_module_callback(const char *name)
Definition: gtk_select.c:691
static void select_module_from_status_menu_callback(GtkWidget *widget, gpointer data __attribute__((unused)))
Definition: gtk_select.c:741
void end_create_workspace_notify(gen_array_t files)
Definition: gtk_select.c:440
bool gpips_close_workspace_menu_inactive
To enable or disable the menu items generated by generate_module_menu():
Definition: gtk_select.c:74
void user_prompt_not_a_valid_workspace_name(const char *workspace_name)
Definition: gtk_select.c:432
success close_workspace_notify(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:537
void start_create_workspace_notify(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:337
static void restore_enable_change_directory_state()
Definition: gtk_select.c:199
void enable_change_directory()
Definition: gtk_select.c:173
void cancel_open_workspace_notify()
Definition: gtk_select.c:502
void enable_workspace_delete_or_open()
Definition: gtk_select.c:228
void direct_change_directory()
FC: uses an external wish script I do not know how to activate this function safely....
Definition: gtk_select.c:126
void select_module_from_menubar_callback(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:723
void cancel_delete_workspace_notify()
Definition: gtk_select.c:305
success continue_create_workspace_notify(const char *name)
Definition: gtk_select.c:366
GtkWidget * generate_directory_menu()
Definition: gtk_select.c:153
void restore_enable_workspace_close_state()
Definition: gtk_select.c:248
void cancel_create_workspace_notify(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:357
void open_or_create_workspace(const char *workspace_name_original)
To be used with schoose_create_abbrev_menu_with_text from the main panel:
Definition: gtk_select.c:570
bool gpips_delete_workspace_menu_inactive
Definition: gtk_select.c:78
void open_workspace_notify(GtkWidget *widget, gpointer data)
Definition: gtk_select.c:508
void select_workspace_notify(GtkWidget *w, gpointer data __attribute__((unused)))
Definition: gtk_select.c:618
void disable_workspace_close()
Definition: gtk_select.c:234
GtkWidget * module_name_entry
Definition: gtk_status.c:76
void show_workspace()
Definition: gtk_status.c:123
GtkWidget * workspace_name_entry
Definition: gtk_status.c:75
void show_directory()
Definition: gtk_status.c:118
void display_memory_usage()
Definition: gtk_status.c:84
GtkWidget * directory_name_entry
Definition: gtk_status.c:74
void show_module()
Definition: gtk_status.c:134
void disable_transform_selection()
Definition: gtk_transform.c:91
void enable_transform_selection()
Definition: gtk_transform.c:95
const char * gpips_gtk_menu_item_get_label(GtkWidget *w)
Definition: gtk_utils.c:43
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
Definition: gtk_utils.c:89
#define MAXPATHLEN
MAXPATHLEN is defined in <sys/param.h> for SunOS...
Definition: misc-local.h:203
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
void safe_system(string)
system.c
Definition: system.c:38
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define string_undefined_p(s)
Definition: newgen_types.h:41
bool workspace_exists_p(const char *)
Definition: workspace.c:266
bool db_create_workspace(const char *)
Definition: workspace.c:282
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
bool workspace_name_p(const char *)
workspace.c
Definition: workspace.c:46
string get_first_main_module(void)
Should be able to handle Fortran applications, C applications and mixed Fortran/C applications.
Definition: pipsmake.c:1525
void pips_get_fortran_list(gen_array_t)
Select the true file with names ending in ".[fF]" and return a sorted arg list:
Definition: source_file.c:89
void pips_get_workspace_list(gen_array_t)
cproto-generated files
Definition: source_file.c:74
string pips_change_directory(const char *)
Change to the given directory if it exists and return a canonical name.
Definition: source_file.c:142
char * strdup()
static char * workspace_name_to_create
Definition: xv_select.c:70