PIPS
xv_select.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/notice.h>
#include <xview/text.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "database.h"
#include "misc.h"
#include "pipsdbm.h"
#include "pipsmake.h"
#include "top-level.h"
#include "wpips.h"
#include "resources.h"
+ Include dependency graph for xv_select.c:

Go to the source code of this file.

Enumerations

enum  { WPIPS_MAX_MODULE_MENU_SIZE = 50 }
 Maximum size of the module menu of the main frame: More...
 

Functions

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: More...
 
success end_directory_notify (char *dir)
 
void end_directory_text_notify (Panel_item text_item, Event *event)
 
void direct_change_directory ()
 FC: uses an external wish script I do not know how to activate this function safely... More...
 
Menu generate_directory_menu ()
 
void prompt_user_not_allowed_to_change_directory (Panel_item text_item, Event *event)
 
void start_directory_notify (Menu menu, Menu_item menu_item)
 
void enable_change_directory ()
 
void disable_change_directory ()
 
static void restore_enable_change_directory_state ()
 
void disable_workspace_create_or_open ()
 
void enable_workspace_create_or_open ()
 
void disable_workspace_delete_or_open ()
 
void enable_workspace_delete_or_open ()
 
void disable_workspace_close ()
 
void enable_workspace_close ()
 
void restore_enable_workspace_close_state ()
 
void disable_module_selection ()
 
void enable_module_selection ()
 
void end_delete_workspace_notify (char *name)
 
void cancel_delete_workspace_notify ()
 
void start_delete_workspace_notify (Menu menu, Menu_item menu_item)
 
void start_create_workspace_notify (Menu menu, Menu_item menu_item)
 
void cancel_create_workspace_notify (Panel_item item, Event *event)
 
success continue_create_workspace_notify (char *name)
 
void user_prompt_not_a_valid_workspace_name (char *workspace_name)
 
void end_create_workspace_notify (gen_array_t files)
 
void end_open_workspace_notify (string name)
 
void cancel_open_workspace_notify ()
 
void open_workspace_notify (Menu menu, Menu_item menu_item)
 
success close_workspace_notify (Menu menu, Menu_item menu_item)
 
void open_or_create_workspace (char *workspace_name_original)
 To be used with schoose_create_abbrev_menu_with_text from the main panel: More...
 
Menu generate_workspace_menu ()
 To use with schoose_create_abbrev_menu_with_text: More...
 
void end_select_module_notify (string name)
 
void cancel_select_module_notify ()
 
void select_module_notify (Menu menu, Menu_item menu_item)
 
Menu generate_module_menu ()
 To use with schoose_create_abbrev_menu_with_text: More...
 
void create_select_menu ()
 

Variables

Menu_item directory_menu_item
 
static char * workspace_name_to_create
 
bool wpips_close_workspace_menu_inactive
 To enable or disable the menu items generated by generate_module_menu(): More...
 
bool wpips_close_workspace_menu_inactive_old
 
bool wpips_create_workspace_menu_inactive
 
bool wpips_open_workspace_menu_inactive
 
bool wpips_delete_workspace_menu_inactive
 
bool wpips_change_directory_inactive
 
bool wpips_change_directory_inactive_old
 
static Menu_item create_pgm
 
static Menu_item open_pgm
 
static Menu_item close_pgm
 
static Menu_item module_item
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Maximum size of the module menu of the main frame:

Enumerator
WPIPS_MAX_MODULE_MENU_SIZE 

Definition at line 63 of file xv_select.c.

63  {
65 };
@ WPIPS_MAX_MODULE_MENU_SIZE
Definition: xv_select.c:64

Function Documentation

◆ cancel_create_workspace_notify()

void cancel_create_workspace_notify ( Panel_item  item,
Event *  event 
)

Re'tablit le droit d'ouvrir ou de cre'er un autre worspace :

Definition at line 477 of file xv_select.c.

479 {
480  /* Re'tablit le droit d'ouvrir ou de cre'er un autre worspace : */
484  cancel_query_notify(item, event);
485  show_workspace();
486 }
void cancel_query_notify(GtkWidget *widget, gpointer data)
hides a window...
Definition: gtk_query.c:118
void show_workspace()
Definition: gtk_status.c:123
void enable_workspace_create_or_open()
Definition: xv_select.c:264
void enable_change_directory()
Definition: xv_select.c:201
void enable_workspace_delete_or_open()
Definition: xv_select.c:293

References cancel_query_notify(), enable_change_directory(), enable_workspace_create_or_open(), enable_workspace_delete_or_open(), and show_workspace().

Referenced by continue_create_workspace_notify(), and start_create_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel_delete_workspace_notify()

void cancel_delete_workspace_notify ( )

Nothing to do.

Definition at line 408 of file xv_select.c.

409 {
410  /* Nothing to do. */
415 }
static void restore_enable_change_directory_state()
Definition: xv_select.c:235
void restore_enable_workspace_close_state()
Definition: xv_select.c:323

References enable_workspace_create_or_open(), enable_workspace_delete_or_open(), restore_enable_change_directory_state(), and restore_enable_workspace_close_state().

Referenced by start_delete_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel_open_workspace_notify()

void cancel_open_workspace_notify ( )

Definition at line 656 of file xv_select.c.

References enable_change_directory(), enable_workspace_create_or_open(), and show_workspace().

Referenced by open_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel_select_module_notify()

void cancel_select_module_notify ( void  )

Definition at line 915 of file xv_select.c.

916 {
917 }

Referenced by select_module_notify().

+ Here is the caller graph for this function:

◆ close_workspace_notify()

success close_workspace_notify ( Menu  menu,
Menu_item  menu_item 
)

The close has been successful:

close_log_file();

It is the only place to enable a directory change, after a close workspace:

Tell Emacs the new module list, that is nothing in fact:

Definition at line 702 of file xv_select.c.

704 {
705  success return_value;
706 
707  return_value = close_workspace(FALSE);
708  debug(1, "close_workspace_notify", "return_value = %d\n", return_value);
709 
710  if (return_value ) {
711  /* The close has been successful: */
712  /* close_log_file(); */
714 
715  edit_close_notify(menu, menu_item);
716 
719 
720  /* It is the only place to enable a directory change, after a close
721  workspace: */
723 
725  /* Tell Emacs the new module list, that is nothing in fact: */
727  }
728 
730  show_workspace();
731  show_module();
733 
734  return return_value;
735 }
bool close_workspace(bool is_quit)
Definition: dbm.c:346
void send_the_names_of_the_available_modules_to_emacs(void)
Tell Emacs about what are the modules available in the current workspace, if any:
Definition: emacs.c:137
bool success
Definition: gpips-local.h:59
void edit_close_notify(GtkWidget *widget, gpointer data)
Definition: gtk_edit2.c:436
void display_memory_usage()
Definition: gtk_status.c:84
void show_module()
Definition: gtk_status.c:134
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
Definition: gtk_utils.c:89
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
Frame schoose_frame
Definition: wpips-local.h:38
void initialize_wpips_hpfc_hack_for_fabien_and_from_fabien()
Definition: xv_compile.c:214
void disable_module_selection()
Definition: xv_select.c:330
void disable_workspace_close()
Definition: xv_select.c:304

References close_workspace(), debug(), disable_module_selection(), disable_workspace_close(), display_memory_usage(), edit_close_notify(), enable_change_directory(), enable_workspace_create_or_open(), hide_window(), initialize_wpips_hpfc_hack_for_fabien_and_from_fabien(), schoose_frame, send_the_names_of_the_available_modules_to_emacs(), show_module(), and show_workspace().

Referenced by create_select_menu(), end_delete_workspace_notify(), generate_workspace_menu(), open_or_create_workspace(), and start_create_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ continue_create_workspace_notify()

success continue_create_workspace_notify ( char *  name)

Is the name a valid workspace name?

Code added to confirm for a database destruction before opening a database with the same name. RK 18/05/1993.

Send to emacs if we are in the emacs mode:

To avoid passing the name through mchoose():

Only one Fortran program: use it without user confirmation.

Memory leak if mchoose exit...

If it failed, cancel the creation:

Definition at line 490 of file xv_select.c.

491 {
492  gen_array_t fortran_list;
493  int fortran_list_length = 0;
494 
495  /* Is the name a valid workspace name? */
496  if (! workspace_name_p(name)) {
498  }
499  else
500  {
501  fortran_list = gen_array_make(0);
502  pips_get_fortran_list(fortran_list);
503  fortran_list_length = gen_array_nitems(fortran_list);
504 
505  if (fortran_list_length == 0) {
506  prompt_user("No Fortran files in this directory");
507  }
508  else {
509  /* Code added to confirm for a database destruction before
510  opening a database with the same name.
511  RK 18/05/1993. */
512  if (workspace_exists_p(name))
513  {
514  int result;
515  /* Send to emacs if we are in the emacs mode: */
516  if (wpips_emacs_mode)
517  send_notice_prompt_to_emacs("The database",
518  name,
519  "already exists!",
520  "Do you really want to remove it?",
521  NULL);
522  result = notice_prompt(xv_find(main_frame, WINDOW, 0),
523  NULL,
524  NOTICE_MESSAGE_STRINGS,
525  "The database", name, "already exists!",
526  "Do you really want to remove it?",
527  NULL,
528  NOTICE_BUTTON_YES,
529  "Yes, remove the database",
530  NOTICE_BUTTON_NO, "No, cancel",
531  NULL);
532  if (result == NOTICE_NO)
533  goto continue_create_workspace_notify_failed;
534  }
535 
537 
538  /* To avoid passing the name through mchoose(): */
540 
541  if (fortran_list_length == 1) {
542  /* Only one Fortran program: use it without user
543  confirmation. */
544  user_log("There is only one Fortran program in the current directory.\n"
545  "\tCreating the workspace \"%s\" from the file \"%s\"...\n",
546  name,
547  gen_array_item(fortran_list, 0));
548  end_create_workspace_notify(fortran_list);
549  }
550  else {
551  mchoose("Create Workspace",
552  fortran_list,
554  (void (*)(void)) cancel_create_workspace_notify);
555  }
556  /* Memory leak if mchoose exit... */
557  gen_array_full_free(fortran_list);
558 
559  return(TRUE);
560  }
561  }
562 
563  /* If it failed, cancel the creation: */
564  continue_create_workspace_notify_failed:
565  cancel_create_workspace_notify((Panel_item)NULL, (Event*)NULL);
566 
567  return FALSE;
568 }
void user_log(const char *format,...)
Definition: message.c:234
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 wpips_emacs_mode
Here are all the stuff to interface Pips with Emacs.
Definition: emacs.c:65
void send_notice_prompt_to_emacs(char *first_line,...)
Definition: emacs.c:220
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60
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
bool workspace_exists_p(const char *)
Definition: workspace.c:266
bool workspace_name_p(const char *)
workspace.c
Definition: workspace.c:46
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 user_prompt_not_a_valid_workspace_name(char *workspace_name)
Definition: xv_select.c:572
void cancel_create_workspace_notify(Panel_item item, Event *event)
Definition: xv_select.c:477
static char * workspace_name_to_create
Definition: xv_select.c:70
void disable_workspace_create_or_open()
Definition: xv_select.c:248
void end_create_workspace_notify(gen_array_t files)
Definition: xv_select.c:583

References cancel_create_workspace_notify(), disable_workspace_create_or_open(), end_create_workspace_notify(), gen_array_full_free(), gen_array_item(), gen_array_make(), gen_array_nitems(), main_frame, mchoose(), pips_get_fortran_list(), prompt_user(), send_notice_prompt_to_emacs(), user_log(), user_prompt_not_a_valid_workspace_name(), workspace_exists_p(), workspace_name_p(), workspace_name_to_create, and wpips_emacs_mode.

Referenced by open_or_create_workspace(), and start_create_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_select_menu()

void create_select_menu ( )

Exchange of the order of create_pgm & open_pgm on the screen for ergonomic reasons. :-) RK, 19/02/1993.

Exchange of the order of start_directory_notify & module_item on the screen for ergonomic reasons. :-) RK, 19/02/1993.

Now all the functionality of the select menu are on the status panel but I could reinstall the select menu later. Since I do not want do change the code, put the select menu in a dummy spare frame:

Definition at line 1016 of file xv_select.c.

1017 {
1018  Menu menu, pmenu;
1019 
1020  create_pgm = xv_create(XV_NULL, MENUITEM,
1021  MENU_STRING, "Create",
1022  MENU_NOTIFY_PROC, start_create_workspace_notify,
1023  MENU_RELEASE,
1024  NULL);
1025 
1026  open_pgm = xv_create(XV_NULL, MENUITEM,
1027  MENU_STRING, "Open",
1028  MENU_NOTIFY_PROC, open_workspace_notify,
1029  MENU_RELEASE,
1030  NULL);
1031 
1032  close_pgm = xv_create(XV_NULL, MENUITEM,
1033  MENU_STRING, "Close",
1034  MENU_NOTIFY_PROC, close_workspace_notify,
1035  MENU_INACTIVE, TRUE,
1036  MENU_RELEASE,
1037  NULL);
1038 
1039  module_item = xv_create(XV_NULL, MENUITEM,
1040  MENU_STRING, "Module",
1041  MENU_NOTIFY_PROC, select_module_notify,
1042  MENU_INACTIVE, TRUE,
1043  MENU_RELEASE,
1044  NULL);
1045 
1046  /* Exchange of the order of create_pgm & open_pgm on the screen
1047  for ergonomic reasons. :-) RK, 19/02/1993. */
1048  pmenu =
1049  xv_create(XV_NULL, MENU_COMMAND_MENU,
1050  MENU_TITLE_ITEM, "Deal with workspaces ",
1051  MENU_GEN_PIN_WINDOW, main_frame, "Workspace Menu",
1052  MENU_APPEND_ITEM, open_pgm,
1053  MENU_APPEND_ITEM, create_pgm,
1054  MENU_APPEND_ITEM, close_pgm,
1055  NULL);
1056 
1057  /* Exchange of the order of start_directory_notify &
1058  module_item on the screen for ergonomic reasons.
1059  :-) RK, 19/02/1993. */
1060  directory_menu_item = xv_create(XV_NULL, MENUITEM,
1061  MENU_ACTION_ITEM,
1062  "Directory",
1064  NULL);
1065 
1066  menu =
1067  xv_create(XV_NULL, MENU_COMMAND_MENU,
1068  MENU_TITLE_ITEM, "Selecting workspace & Fortran module ",
1069  MENU_GEN_PIN_WINDOW, main_frame, "Selection Menu",
1070  MENU_APPEND_ITEM, module_item,
1071  MENU_PULLRIGHT_ITEM, "Workspace", pmenu,
1072  MENU_APPEND_ITEM, directory_menu_item,
1073  NULL);
1074 
1075  /* Now all the functionality of the select menu are on the status
1076  panel but I could reinstall the select menu later. Since I do
1077  not want do change the code, put the select menu in a dummy
1078  spare frame: */
1079  /*
1080  (void) xv_create(main_panel, PANEL_BUTTON,
1081  PANEL_LABEL_STRING, "Select",
1082  PANEL_ITEM_MENU, menu,
1083  NULL);
1084  */
1085  {
1086  Frame select_button_frame;
1087  Panel select_button_panel;
1088 
1089  select_button_frame = xv_create(main_frame, FRAME,
1090  XV_SHOW, FALSE,
1091  NULL);
1092  select_button_panel = xv_create(select_button_frame, PANEL,
1093  NULL);
1094 
1095  (void) xv_create(select_button_panel, PANEL_BUTTON,
1096  PANEL_LABEL_STRING, "Select",
1097  PANEL_ITEM_MENU, menu,
1098  NULL);
1099  }
1100 }
void select_module_notify(Menu menu, Menu_item menu_item)
Definition: xv_select.c:920
static Menu_item create_pgm
Definition: xv_select.c:244
Menu_item directory_menu_item
Definition: xv_select.c:68
void start_create_workspace_notify(Menu menu, Menu_item menu_item)
Definition: xv_select.c:451
static Menu_item module_item
Definition: xv_select.c:244
void start_directory_notify(Menu menu, Menu_item menu_item)
Definition: xv_select.c:184
void open_workspace_notify(Menu menu, Menu_item menu_item)
Definition: xv_select.c:665
static Menu_item open_pgm
Definition: xv_select.c:244
success close_workspace_notify(Menu menu, Menu_item menu_item)
Definition: xv_select.c:702
static Menu_item close_pgm
Definition: xv_select.c:244

References close_pgm, close_workspace_notify(), create_pgm, directory_menu_item, main_frame, module_item, open_pgm, open_workspace_notify(), select_module_notify(), start_create_workspace_notify(), and start_directory_notify().

+ Here is the call graph for this function:

◆ direct_change_directory()

void direct_change_directory ( )

FC: uses an external wish script I do not know how to activate this function safely...

no cd in this state!

last was

generate_workspace_menu();

Definition at line 139 of file xv_select.c.

140 {
141  char newdir[MAXPATHLEN];
142  char * tmp = strdup("/tmp/wpips.dir.XXXXXX");
143  int i=0, c;
144  FILE * tmph;
145 
146  (void) mkstemp(tmp);
147 
149  return; /* no cd in this state! */
150 
151  safe_system(concatenate("wpips-changedir -- ", get_cwd(), " > ", tmp, NULL));
152 
153  tmph = safe_fopen(tmp, "r");
154  while ((c=getc(tmph))!=EOF && i<MAXPATHLEN)
155  newdir[i++]=c;
156  newdir[i-1]='\0'; /* last was \n */
157  safe_fclose(tmph, tmp);
158 
159  end_directory_notify(newdir);
160 
161  unlink(tmp); free(tmp);
162 
163  return /* generate_workspace_menu(); */ ;
164 }
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 *)
#define MAXPATHLEN
MAXPATHLEN is defined in <sys/param.h> for SunOS...
Definition: misc-local.h:203
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
char * strdup()
bool wpips_change_directory_inactive
Definition: xv_select.c:78
success end_directory_notify(char *dir)
Definition: xv_select.c:109

References concatenate(), end_directory_notify(), free(), get_cwd(), MAXPATHLEN, safe_fclose(), safe_fopen(), safe_system(), strdup(), and wpips_change_directory_inactive.

+ Here is the call graph for this function:

◆ disable_change_directory()

void disable_change_directory ( )

In order to warn the user as soon as possible that (s)he can't change the directory, notify for whatever character:

Definition at line 218 of file xv_select.c.

219 {
220  xv_set(directory_menu_item, MENU_INACTIVE, TRUE, NULL);
221 
222  /* In order to warn the user as soon as possible that (s)he can't
223  change the directory, notify for whatever character: */
225  PANEL_NOTIFY_LEVEL, PANEL_ALL,
227  PANEL_INACTIVE, TRUE,
228  NULL);
231 }
void prompt_user_not_allowed_to_change_directory(Panel_item text_item, Event *event)
Definition: xv_select.c:174
bool wpips_change_directory_inactive_old
Definition: xv_select.c:79
Panel_item directory_name_panel_item
Definition: xv_status.c:67

References directory_menu_item, directory_name_panel_item, prompt_user_not_allowed_to_change_directory(), wpips_change_directory_inactive, and wpips_change_directory_inactive_old.

Referenced by end_create_workspace_notify(), end_open_workspace_notify(), open_or_create_workspace(), restore_enable_change_directory_state(), start_create_workspace_notify(), and start_delete_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disable_module_selection()

void disable_module_selection ( )

Definition at line 330 of file xv_select.c.

331 {
332  xv_set(module_item, MENU_INACTIVE, TRUE, NULL);
333  xv_set(module_name_panel_item, PANEL_INACTIVE, TRUE, NULL);
338 }
void disable_compile_selection()
Definition: gtk_compile.c:74
void disable_view_selection()
Definition: gtk_edit2.c:505
void disable_option_selection()
Definition: gtk_props.c:130
void disable_transform_selection()
Definition: gtk_transform.c:91
Panel_item module_name_panel_item
Definition: xv_status.c:70

References disable_compile_selection(), disable_option_selection(), disable_transform_selection(), disable_view_selection(), module_item, and module_name_panel_item.

Referenced by close_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disable_workspace_close()

void disable_workspace_close ( )

For generate_module_menu():

Definition at line 304 of file xv_select.c.

305 {
306  xv_set(close_pgm, MENU_INACTIVE, TRUE, NULL);
308  /* For generate_module_menu(): */
310 }
bool wpips_close_workspace_menu_inactive_old
Definition: xv_select.c:74
bool wpips_close_workspace_menu_inactive
To enable or disable the menu items generated by generate_module_menu():
Definition: xv_select.c:73

References close_pgm, wpips_close_workspace_menu_inactive, and wpips_close_workspace_menu_inactive_old.

Referenced by close_workspace_notify(), start_delete_workspace_notify(), and user_prompt_not_a_valid_workspace_name().

+ Here is the caller graph for this function:

◆ disable_workspace_create_or_open()

void disable_workspace_create_or_open ( )

Definition at line 248 of file xv_select.c.

249 {
250  xv_set(create_pgm,
251  MENU_INACTIVE, TRUE,
252  NULL);
254  xv_set(open_pgm,
255  MENU_INACTIVE, TRUE,
256  NULL);
258  PANEL_INACTIVE, TRUE,
259  NULL);
260 }
bool wpips_create_workspace_menu_inactive
Definition: xv_select.c:75
Panel_item workspace_name_panel_item
Definition: xv_status.c:68

References create_pgm, open_pgm, workspace_name_panel_item, and wpips_create_workspace_menu_inactive.

Referenced by continue_create_workspace_notify(), open_workspace_notify(), start_create_workspace_notify(), and start_delete_workspace_notify().

+ Here is the caller graph for this function:

◆ disable_workspace_delete_or_open()

void disable_workspace_delete_or_open ( )

Avoid also to delete a workspace during a creation in case the name of the workspace is the same...

Definition at line 280 of file xv_select.c.

281 {
282  /* Avoid also to delete a workspace during a creation in case the
283  name of the workspace is the same... */
287  PANEL_INACTIVE, TRUE,
288  NULL);
289 }
bool wpips_delete_workspace_menu_inactive
Definition: xv_select.c:77
bool wpips_open_workspace_menu_inactive
Definition: xv_select.c:76

References workspace_name_panel_item, wpips_delete_workspace_menu_inactive, and wpips_open_workspace_menu_inactive.

Referenced by start_create_workspace_notify(), and start_delete_workspace_notify().

+ Here is the caller graph for this function:

◆ enable_change_directory()

void enable_change_directory ( )

Enable the normal notify mode: notify when return and so is typed:

Definition at line 201 of file xv_select.c.

202 {
203  xv_set(directory_menu_item, MENU_INACTIVE, FALSE, NULL);
204 
205  /* Enable the normal notify mode: notify when return and so is
206  typed: */
208  PANEL_NOTIFY_LEVEL, PANEL_SPECIFIED,
209  PANEL_NOTIFY_PROC, end_directory_text_notify,
210  PANEL_INACTIVE, FALSE,
211  NULL);
214 }
void end_directory_text_notify(Panel_item text_item, Event *event)
Definition: xv_select.c:129

References directory_menu_item, directory_name_panel_item, end_directory_text_notify(), wpips_change_directory_inactive, and wpips_change_directory_inactive_old.

Referenced by cancel_create_workspace_notify(), cancel_open_workspace_notify(), close_workspace_notify(), end_create_workspace_notify(), restore_enable_change_directory_state(), and user_prompt_not_a_valid_workspace_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enable_module_selection()

void enable_module_selection ( )

Well, after a workspace creation without automatic module selection successful, there is no module selected and thus the following menus are not very interestiong, except for the option part of the option selection. Anyway, there is a guard in each of these menu, so, just do nothing... :-)

Definition at line 342 of file xv_select.c.

343 {
344  xv_set(module_item, MENU_INACTIVE, FALSE, NULL);
345  xv_set(module_name_panel_item, PANEL_INACTIVE, FALSE, NULL);
346  /* Well, after a workspace creation without automatic module
347  selection successful, there is no module selected and thus the
348  following menus are not very interestiong, except for the option
349  part of the option selection. Anyway, there is a guard in each
350  of these menu, so, just do nothing... :-) */
355 }
void enable_compile_selection()
Definition: gtk_compile.c:78
void enable_view_selection()
Definition: gtk_edit2.c:509
void enable_option_selection()
Definition: gtk_props.c:134
void enable_transform_selection()
Definition: gtk_transform.c:95

References enable_compile_selection(), enable_option_selection(), enable_transform_selection(), enable_view_selection(), module_item, and module_name_panel_item.

Referenced by end_create_workspace_notify(), and end_open_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enable_workspace_close()

void enable_workspace_close ( )

For generate_module_menu():

Definition at line 314 of file xv_select.c.

315 {
316  xv_set(close_pgm, MENU_INACTIVE, FALSE, NULL);
317  /* For generate_module_menu(): */
319 }

References close_pgm, and wpips_close_workspace_menu_inactive.

Referenced by end_create_workspace_notify(), and end_open_workspace_notify().

+ Here is the caller graph for this function:

◆ enable_workspace_create_or_open()

void enable_workspace_create_or_open ( )

Definition at line 264 of file xv_select.c.

265 {
266  xv_set(create_pgm,
267  MENU_INACTIVE, FALSE,
268  NULL);
270  xv_set(open_pgm,
271  MENU_INACTIVE, FALSE,
272  NULL);
274  PANEL_INACTIVE, FALSE,
275  NULL);
276 }

References create_pgm, open_pgm, workspace_name_panel_item, and wpips_create_workspace_menu_inactive.

Referenced by cancel_create_workspace_notify(), cancel_delete_workspace_notify(), cancel_open_workspace_notify(), close_workspace_notify(), end_create_workspace_notify(), end_delete_workspace_notify(), end_open_workspace_notify(), and user_prompt_not_a_valid_workspace_name().

+ Here is the caller graph for this function:

◆ enable_workspace_delete_or_open()

void enable_workspace_delete_or_open ( )

Definition at line 293 of file xv_select.c.

294 {
298  PANEL_INACTIVE, FALSE,
299  NULL);
300 }

References workspace_name_panel_item, wpips_delete_workspace_menu_inactive, and wpips_open_workspace_menu_inactive.

Referenced by cancel_create_workspace_notify(), cancel_delete_workspace_notify(), end_create_workspace_notify(), and end_delete_workspace_notify().

+ Here is the caller graph for this function:

◆ end_create_workspace_notify()

void end_create_workspace_notify ( gen_array_t  files)

If the user click quickly on OK, be sure end_create_workspace_notify() is not reentrant by verifying something as not been opened already:

Is the name a valid workspace name?

The create workspace has been successful:

open_log_file();

The processing of user files has been successful:

Tell Emacs the new module list:

close_log_file();

The creation failed:

Definition at line 583 of file xv_select.c.

584 {
585  /* If the user click quickly on OK, be sure
586  end_create_workspace_notify() is not reentrant by verifying
587  something as not been opened already: */
588  if (db_get_current_workspace_name() == NULL) {
589  /* Is the name a valid workspace name? */
592  /* The create workspace has been successful: */
593  /* open_log_file(); */
595 
596  if (create_workspace(files)) {
597  /* The processing of user files has been successful: */
599 
600  show_workspace();
604 
607 
608  /* Tell Emacs the new module list: */
610 
612 
613  return;
614  }
615  else
616  /* close_log_file(); */
617  ;
618  }
619  }
620  else
622 
623  /* The creation failed: */
627 
629  }
630 }
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 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
void enable_module_selection()
Definition: xv_select.c:342
void disable_change_directory()
Definition: xv_select.c:218
void enable_workspace_close()
Definition: xv_select.c:314
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: xv_select.c:85

References create_workspace(), db_create_workspace(), db_get_current_workspace_name(), disable_change_directory(), display_memory_usage(), enable_change_directory(), enable_module_selection(), enable_workspace_close(), enable_workspace_create_or_open(), enable_workspace_delete_or_open(), select_a_module_by_default(), send_the_names_of_the_available_modules_to_emacs(), show_workspace(), user_prompt_not_a_valid_workspace_name(), workspace_name_p(), and workspace_name_to_create.

Referenced by continue_create_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end_delete_workspace_notify()

void end_delete_workspace_notify ( char *  name)

Send to emacs if we are in the emacs mode:

First close the workspace:

Hmm... This may put WPips in a strange state if close fails...

Definition at line 359 of file xv_select.c.

360 {
361  schoose_close();
362 
363  if (db_get_current_workspace_name() != NULL
364  && strcmp(db_get_current_workspace_name(), name) == 0)
365  {
366  int result;
367  /* Send to emacs if we are in the emacs mode: */
368  if (wpips_emacs_mode)
369  send_notice_prompt_to_emacs("The workspace",
370  name,
371  "is currently opened!",
372  "Do you really want to close and remove it ?",
373  NULL);
374  result = notice_prompt(xv_find(main_frame, WINDOW, 0),
375  NULL,
376  NOTICE_MESSAGE_STRINGS,
377  "The workspace",
378  name,
379  "is currently opened!",
380  "Do you really want to close and remove it ?",
381  NULL,
382  NOTICE_BUTTON_YES, "Yes, remove the database",
383  NOTICE_BUTTON_NO, "No, cancel",
384  NULL);
385  if (result == NOTICE_NO)
386  goto do_not_delete_the_workspace;
387 
388  /* First close the workspace: */
389  if (!close_workspace_notify((Menu)NULL, (Menu_item)NULL))
390  /* Hmm... This may put WPips in a strange state if close
391  fails... */
392  goto do_not_delete_the_workspace;
393  }
394 
395  (void) delete_workspace(name);
396 
397  do_not_delete_the_workspace:
402 
404 }
bool delete_workspace(const char *wname)
Definition: dbm.c:368
void schoose_close()
schoose_close() can be called even when schoose window is already closed.
Definition: gtk_schoose2.c:113

References close_workspace_notify(), db_get_current_workspace_name(), delete_workspace(), display_memory_usage(), enable_workspace_create_or_open(), enable_workspace_delete_or_open(), main_frame, restore_enable_change_directory_state(), restore_enable_workspace_close_state(), schoose_close(), send_notice_prompt_to_emacs(), and wpips_emacs_mode.

Referenced by start_delete_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end_directory_notify()

success end_directory_notify ( char *  dir)

if (dir != NULL) {

Definition at line 109 of file xv_select.c.

110 {
111  char *s;
112 
113 /* if (dir != NULL) {*/
114  if ((s = pips_change_directory(dir)) == NULL) {
115  user_log("Directory \"%s\" does not exist\n", dir);
116  prompt_user("Directory \"%s\" does not exist\n", dir);
117  show_directory();
118  return FALSE;
119  }
120  else {
121  user_log("Directory \"%s\" selected\n", dir);
122  show_directory();
123  return TRUE;
124  }
125 }
void show_directory()
Definition: gtk_status.c:118
string pips_change_directory(const char *)
Change to the given directory if it exists and return a canonical name.
Definition: source_file.c:142

References pips_change_directory(), prompt_user(), show_directory(), and user_log().

Referenced by direct_change_directory(), end_directory_text_notify(), and start_directory_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end_directory_text_notify()

void end_directory_text_notify ( Panel_item  text_item,
Event *  event 
)

Definition at line 129 of file xv_select.c.

131 {
132  (void) end_directory_notify((char *) xv_get(text_item, PANEL_VALUE));
133 }

References end_directory_notify().

Referenced by enable_change_directory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end_open_workspace_notify()

void end_open_workspace_notify ( string  name)

open_log_file();

Tell Emacs the new module list:

Definition at line 634 of file xv_select.c.

635 {
636  schoose_close();
637 
638  if ( open_workspace(name) ) {
639  /* open_log_file(); */
641  show_workspace();
645  /* Tell Emacs the new module list: */
647  }
648 
650 
652 }
bool open_workspace(const char *name)
should be: success (cf wpips.h)
Definition: dbm.c:309

References disable_change_directory(), display_memory_usage(), enable_module_selection(), enable_workspace_close(), enable_workspace_create_or_open(), open_workspace(), schoose_close(), select_a_module_by_default(), send_the_names_of_the_available_modules_to_emacs(), and show_workspace().

Referenced by open_or_create_workspace(), and open_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end_select_module_notify()

void end_select_module_notify ( string  name)

Definition at line 882 of file xv_select.c.

883 {
884  gen_array_t module_list = db_get_module_list();
885  int module_list_length = gen_array_nitems(module_list);
886 
887  if (module_list_length == 0)
888  {
889  prompt_user("No module available in this workspace.");
890  }
891  else
892  {
893  bool module_found = FALSE;
894  int i;
895 
896  for(i = 0; i < module_list_length; i++) {
897  string mn = gen_array_item(module_list, i);
898  if (strcmp(name, mn) == 0) {
899  module_found = TRUE;
900  break;
901  }
902  }
903  if (module_found)
904  lazy_open_module(name);
905  else
906  prompt_user("The module \"%s\" does not exist in this workspace.",
907  name);
908  }
909 
910  show_module();
912  gen_array_full_free(module_list);
913 }
bool lazy_open_module(const char *name)
Do not open a module already opened :
Definition: dbm.c:289
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

References db_get_module_list(), display_memory_usage(), gen_array_full_free(), gen_array_item(), gen_array_nitems(), lazy_open_module(), prompt_user(), and show_module().

Referenced by create_status_subwindow(), epips_select_module(), execute_workspace_creation_and_so_on_given_with_options(), select_a_module_by_default(), and select_module_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate_directory_menu()

Menu generate_directory_menu ( )

Definition at line 167 of file xv_select.c.

168 {
170 }
GtkWidget * generate_a_directory_menu(char *directory)

References generate_a_directory_menu(), and get_cwd().

+ Here is the call graph for this function:

◆ generate_module_menu()

Menu generate_module_menu ( )

To use with schoose_create_abbrev_menu_with_text:

The strdup'ed string will also be freed when the menu is discarded:

Definition at line 947 of file xv_select.c.

948 {
949  Menu menu;
950  int i;
951  menu = xv_create(XV_NULL, MENU,
952  MENU_TITLE_ITEM, " Select in the module list: ",
953  NULL);
954 
955  if (db_get_current_workspace_name() == NULL) {
956  xv_set(menu, MENU_APPEND_ITEM,
957  xv_create(XV_NULL, MENUITEM,
958  MENU_STRING, "* No workspace yet! *",
959  MENU_RELEASE,
960  MENU_INACTIVE, TRUE,
961  NULL),
962  NULL);
963  }
964  else {
965  gen_array_t module_list = db_get_module_list();
966  int module_list_length = gen_array_nitems(module_list);
967 
968  if (module_list_length == 0) {
969  xv_set(menu, MENU_APPEND_ITEM,
970  xv_create(XV_NULL, MENUITEM,
971  MENU_STRING,
972  "* No module available in this workspace *",
973  MENU_RELEASE,
974  MENU_INACTIVE, TRUE,
975  NULL),
976  NULL);
977  }
978  else if (module_list_length > WPIPS_MAX_MODULE_MENU_SIZE) {
979  xv_set(menu,
980  MENU_TITLE_ITEM,
981  " Too many modules. Click on the Module Chooser: ",
982  NULL);
983  xv_set(menu, MENU_APPEND_ITEM,
984  xv_create(XV_NULL, MENUITEM,
985  MENU_STRING, "Module Chooser",
986  MENU_NOTIFY_PROC, select_module_notify,
987  MENU_RELEASE,
988  NULL),
989  NULL);
990  user_warning("generate_a_directory_menu",
991  "Too many modules in this workspace. "
992  "Click on the Module Chooser\n");
993  }
994  else {
995  for(i = 0; i < module_list_length; i++) {
996  string mn = gen_array_item(module_list, i);
997  xv_set(menu, MENU_APPEND_ITEM,
998  xv_create(XV_NULL, MENUITEM,
999  MENU_STRING, strdup(mn),
1000  MENU_RELEASE,
1001  /* The strdup'ed string will also be
1002  freed when the menu is discarded: */
1003  MENU_RELEASE_IMAGE,
1004  NULL),
1005  NULL);
1006  }
1007  }
1008  gen_array_full_free(module_list);
1009  }
1010 
1011  return menu;
1012 }
#define user_warning(fn,...)
Definition: misc-local.h:262

References db_get_current_workspace_name(), db_get_module_list(), gen_array_full_free(), gen_array_item(), gen_array_nitems(), select_module_notify(), strdup(), user_warning, and WPIPS_MAX_MODULE_MENU_SIZE.

+ Here is the call graph for this function:

◆ generate_workspace_menu()

Menu generate_workspace_menu ( )

To use with schoose_create_abbrev_menu_with_text:

Replace the Select Workspace menu from the status window with the following items:

Always active since start_create_workspace_notify() does the close if necessary:

On can close only if there is something open:

Now complete with the list of the workspaces:

Well, since there is no workspace, there is nothing to delete...

The strdup'ed string will also be freed when the menu is discarded:

Definition at line 790 of file xv_select.c.

791 {
792  Menu menu;
793  Menu_item delete_menu_item;
794  int i;
795  gen_array_t workspace_list;
796  int workspace_list_length = 0;
797 
798  workspace_list = gen_array_make(0);
799  pips_get_workspace_list(workspace_list);
800  workspace_list_length = gen_array_nitems(workspace_list);
801 
802  menu = xv_create(XV_NULL, MENU,
803  MENU_TITLE_ITEM, " Select in the workspace list: ",
804  NULL);
805 
806  /* Replace the Select Workspace menu from the status window with
807  the following items: */
808  xv_set(menu, MENU_APPEND_ITEM,
809  xv_create(XV_NULL, MENUITEM,
810  MENU_STRING,
811  " Create Workspace...",
812  MENU_NOTIFY_PROC, start_create_workspace_notify,
813  MENU_RELEASE,
814  /* Always active since
815  start_create_workspace_notify() does the close
816  if necessary: */
818  NULL),
819  NULL);
820  xv_set(menu, MENU_APPEND_ITEM,
821  xv_create(XV_NULL, MENUITEM,
822  MENU_STRING,
823  " Close Workspace",
824  MENU_NOTIFY_PROC, close_workspace_notify,
825  MENU_RELEASE,
826  /* On can close only if there is something open: */
828  NULL),
829  NULL);
830  delete_menu_item = xv_create(XV_NULL, MENUITEM,
831  MENU_STRING,
832  " Delete Workspace...",
833  MENU_NOTIFY_PROC, start_delete_workspace_notify,
834  MENU_RELEASE,
836  NULL);
837 
838  xv_set(menu, MENU_APPEND_ITEM,
839  delete_menu_item,
840  NULL);
841 
842  /* Now complete with the list of the workspaces: */
843  if (workspace_list_length == 0) {
844  xv_set(menu, MENU_APPEND_ITEM,
845  xv_create(XV_NULL, MENUITEM,
846  MENU_STRING,
847  "* No workspace available in this directory *",
848  MENU_RELEASE,
849  MENU_INACTIVE, TRUE,
850  NULL),
851  NULL);
852  /* Well, since there is no workspace, there is nothing to
853  delete... */
854  xv_set(delete_menu_item,
855  MENU_INACTIVE, TRUE,
856  NULL);
857  }
858  else {
859  for(i = 0; i < workspace_list_length; i++)
860  {
861  string name = gen_array_item(workspace_list, i);
862  xv_set(menu, MENU_APPEND_ITEM,
863  xv_create(XV_NULL, MENUITEM,
864  MENU_STRING, strdup(name),
865  MENU_RELEASE,
866  /* The strdup'ed string will also be
867  freed when the menu is discarded: */
868  MENU_RELEASE_IMAGE,
869  MENU_INACTIVE, wpips_open_workspace_menu_inactive,
870  NULL),
871  NULL);
872  }
873  }
874 
875  gen_array_full_free(workspace_list);
876 
877  return menu;
878 }
void pips_get_workspace_list(gen_array_t)
cproto-generated files
Definition: source_file.c:74
void start_delete_workspace_notify(Menu menu, Menu_item menu_item)
Definition: xv_select.c:419

References close_workspace_notify(), gen_array_full_free(), gen_array_item(), gen_array_make(), gen_array_nitems(), pips_get_workspace_list(), start_create_workspace_notify(), start_delete_workspace_notify(), strdup(), wpips_close_workspace_menu_inactive, wpips_create_workspace_menu_inactive, wpips_delete_workspace_menu_inactive, and wpips_open_workspace_menu_inactive.

+ Here is the call graph for this function:

◆ open_or_create_workspace()

void open_or_create_workspace ( char *  workspace_name_original)

To be used with schoose_create_abbrev_menu_with_text from the main panel:

If close_workspace_notify() is called below, show_workspace() will set the name to "(* none *)" in the panel and workspace_name_original is directly a pointer to it !

Prompt the warning and restore the menu enable state:

There is an open workspace: close it first:

To choose between open or create, look for the an existing workspace with the same name:

OK, the workspace exists, open it:

The workspace does not exist, create it:

Definition at line 741 of file xv_select.c.

742 {
743  int i;
744  gen_array_t workspace_list;
745  int workspace_list_length = 0;
746  char workspace_name[SMALL_BUFFER_LENGTH];
747 
748  /* If close_workspace_notify() is called below, show_workspace() will
749  set the name to "(* none *)" in the panel and
750  workspace_name_original is directly a pointer to it ! */
751  (void) strncpy(workspace_name,
752  workspace_name_original,
753  sizeof(workspace_name) - 1);
754 
755  if (! workspace_name_p(workspace_name)) {
756  /* Prompt the warning and restore the menu enable state: */
758  show_workspace();
759  return;
760  }
761 
762  if (db_get_current_workspace_name() != NULL)
763  /* There is an open workspace: close it first: */
764  if (!close_workspace_notify((Menu) NULL, (Menu_item) NULL))
765  return;
766 
767  /* To choose between open or create, look for the an existing
768  workspace with the same name: */
769  workspace_list = gen_array_make(0);
770  pips_get_workspace_list(workspace_list);
771  workspace_list_length = gen_array_nitems(workspace_list);
772 
773  for(i = 0; i < workspace_list_length; i++) {
774  string name = gen_array_item(workspace_list, i);
775  if (strcmp(workspace_name, name) == 0) {
776  /* OK, the workspace exists, open it: */
777  end_open_workspace_notify(workspace_name);
778  return;
779  }
780  }
781  /* The workspace does not exist, create it: */
783  gen_array_full_free(workspace_list);
784  (void) continue_create_workspace_notify(workspace_name);
785 }
#define SMALL_BUFFER_LENGTH
Definition: gpips-local.h:24
void end_open_workspace_notify(string name)
Definition: xv_select.c:634
success continue_create_workspace_notify(char *name)
Definition: xv_select.c:490

References close_workspace_notify(), continue_create_workspace_notify(), db_get_current_workspace_name(), disable_change_directory(), end_open_workspace_notify(), gen_array_full_free(), gen_array_item(), gen_array_make(), gen_array_nitems(), pips_get_workspace_list(), show_workspace(), SMALL_BUFFER_LENGTH, user_prompt_not_a_valid_workspace_name(), and workspace_name_p().

+ Here is the call graph for this function:

◆ open_workspace_notify()

void open_workspace_notify ( Menu  menu,
Menu_item  menu_item 
)

There is only workspace: open it without asking confirmation to the user:

Choix initial sur le workspace courant si possible :

Definition at line 665 of file xv_select.c.

667 {
668  gen_array_t workspace_list;
669  int workspace_list_length = 0;
670 
671  workspace_list = gen_array_make(0);
672  pips_get_workspace_list(workspace_list);
673  workspace_list_length = gen_array_nitems(workspace_list);
674 
675  if (workspace_list_length == 0) {
676  prompt_user("No workspace available in this directory.");
677  }
678  else if (workspace_list_length == 1) {
679  /* There is only workspace: open it without asking confirmation
680  to the user: */
681  user_log("There is only one workspace in the current directory.\n"
682  "\tOpening the workspace \"%s\"...\n",
683  gen_array_item(workspace_list, 0));
684  end_open_workspace_notify(gen_array_item(workspace_list, 0));
685  }
686  else {
688 
689  schoose("Select Workspace",
690  workspace_list,
691  /* Choix initial sur le workspace courant si
692  possible : */
696  }
697  gen_array_full_free(workspace_list);
698 }
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 cancel_open_workspace_notify()
Definition: xv_select.c:656

References cancel_open_workspace_notify(), db_get_current_workspace_name(), disable_workspace_create_or_open(), end_open_workspace_notify(), gen_array_full_free(), gen_array_item(), gen_array_make(), gen_array_nitems(), pips_get_workspace_list(), prompt_user(), schoose(), and user_log().

Referenced by create_select_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prompt_user_not_allowed_to_change_directory()

void prompt_user_not_allowed_to_change_directory ( Panel_item  text_item,
Event *  event 
)

First untype whatever the user typed:

Definition at line 174 of file xv_select.c.

176 {
177  /* First untype whatever the user typed: */
178  show_directory();
179  prompt_user("You have to close the current workspace"
180  " before changing directory.");
181 }

References prompt_user(), and show_directory().

Referenced by disable_change_directory(), and start_directory_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restore_enable_change_directory_state()

static void restore_enable_change_directory_state ( )
static

Definition at line 235 of file xv_select.c.

236 {
239  else
241 }

References disable_change_directory(), enable_change_directory(), and wpips_change_directory_inactive_old.

Referenced by cancel_delete_workspace_notify(), and end_delete_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restore_enable_workspace_close_state()

void restore_enable_workspace_close_state ( )

◆ select_a_module_by_default()

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:

Ok, no current module, then find a main module (PROGRAM):

Ok, we got it ! Now we select it:

GO: show_module() has already been called so return now

Refresh the module name on the status window:

Definition at line 85 of file xv_select.c.

86 {
88 
89  if (module_name == NULL) {
90  /* Ok, no current module, then find a main module (PROGRAM): */
91  string main_module_name = get_first_main_module();
92 
93  if (!string_undefined_p(main_module_name)) {
94  /* Ok, we got it ! Now we select it: */
95  module_name = main_module_name;
96  user_log("Main module PROGRAM \"%s\" found.\n", module_name);
98  /* GO: show_module() has already been called so return now */
99  return;
100  }
101  }
102 
103  /* Refresh the module name on the status window: */
104  show_module();
105 }
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define string_undefined_p(s)
Definition: newgen_types.h:41
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 end_select_module_notify(string name)
Definition: xv_select.c:882

References db_get_current_module_name(), end_select_module_notify(), get_first_main_module(), module_name(), show_module(), string_undefined_p, and user_log().

Referenced by end_create_workspace_notify(), and end_open_workspace_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ select_module_notify()

void select_module_notify ( Menu  menu,
Menu_item  menu_item 
)

If there is no module... RK, 23/1/1993.

Affiche comme choix courant le module courant (c'est utile si on ferme la fenĂȘtre module entre temps) :

Definition at line 920 of file xv_select.c.

922 {
923  gen_array_t module_list = db_get_module_list();
924  int module_list_length = gen_array_nitems(module_list);
925 
926  if (module_list_length == 0)
927  {
928  /* If there is no module... RK, 23/1/1993. */
929  prompt_user("No module available in this workspace.");
930  }
931  else
932  schoose("Select Module",
933  module_list,
934  /* Affiche comme choix courant le module
935  courant (c'est utile si on ferme la fenĂȘtre
936  module entre temps) : */
940 
941  gen_array_full_free(module_list);
942 }
void cancel_select_module_notify()
Definition: xv_select.c:915

References cancel_select_module_notify(), db_get_current_module_name(), db_get_module_list(), end_select_module_notify(), gen_array_full_free(), gen_array_nitems(), prompt_user(), and schoose().

Referenced by create_select_menu(), and generate_module_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start_create_workspace_notify()

void start_create_workspace_notify ( Menu  menu,
Menu_item  menu_item 
)

There is an open workspace: close it first:

If it fails:

Pas la peine de faire quelque chose si on appuie sur cancel :

Definition at line 451 of file xv_select.c.

453 {
457 
458  if (db_get_current_workspace_name() != NULL)
459  /* There is an open workspace: close it first: */
460  if (!close_workspace_notify((Menu) NULL, (Menu_item) NULL)) {
461  /* If it fails: */
462  cancel_create_workspace_notify((Panel_item) NULL, (Event*)NULL);
463  return;
464  }
465 
466  start_query("Create Workspace",
467  "Enter workspace name: ",
468  "CreateWorkspace",
470  /* Pas la peine de faire quelque chose si on appuie
471  sur cancel : */
473 }
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 disable_workspace_delete_or_open()
Definition: xv_select.c:280

References cancel_create_workspace_notify(), close_workspace_notify(), continue_create_workspace_notify(), db_get_current_workspace_name(), disable_change_directory(), disable_workspace_create_or_open(), disable_workspace_delete_or_open(), and start_query().

Referenced by create_select_menu(), and generate_workspace_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start_delete_workspace_notify()

void start_delete_workspace_notify ( Menu  menu,
Menu_item  menu_item 
)

Choix initial sur le workspace courant si possible :

Definition at line 419 of file xv_select.c.

421 {
422  gen_array_t workspace_list;
423  int workspace_list_length = 0;
424 
425  workspace_list = gen_array_make(0);
426  pips_get_workspace_list(workspace_list);
427  workspace_list_length = gen_array_nitems(workspace_list);
428 
429  if (workspace_list_length == 0) {
430  prompt_user("No workspace available in this directory.");
431  }
432  else {
437 
438  schoose("Select the Workspace to Delete",
439  workspace_list,
440  /* Choix initial sur le workspace courant si
441  possible : */
445  }
446  gen_array_full_free(workspace_list);
447 }
void end_delete_workspace_notify(char *name)
Definition: xv_select.c:359
void cancel_delete_workspace_notify()
Definition: xv_select.c:408

References cancel_delete_workspace_notify(), db_get_current_workspace_name(), disable_change_directory(), disable_workspace_close(), disable_workspace_create_or_open(), disable_workspace_delete_or_open(), end_delete_workspace_notify(), gen_array_full_free(), gen_array_make(), gen_array_nitems(), pips_get_workspace_list(), prompt_user(), and schoose().

Referenced by generate_workspace_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start_directory_notify()

void start_directory_notify ( Menu  menu,
Menu_item  menu_item 
)

Definition at line 184 of file xv_select.c.

187 {
190  (Panel_item)NULL, (Event*)NULL);
191  else
192  start_query("Change Directory",
193  "Enter directory path: ",
194  "ChangeDirectory",
197 }

References cancel_query_notify(), db_get_current_workspace_name(), end_directory_notify(), prompt_user_not_allowed_to_change_directory(), and start_query().

Referenced by create_select_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ user_prompt_not_a_valid_workspace_name()

void user_prompt_not_a_valid_workspace_name ( char *  workspace_name)

Definition at line 572 of file xv_select.c.

573 {
574  prompt_user("The name \"%s\" is not a valid workspace name!\n",
575  workspace_name);
579 }

References disable_workspace_close(), enable_change_directory(), enable_workspace_create_or_open(), and prompt_user().

Referenced by continue_create_workspace_notify(), end_create_workspace_notify(), and open_or_create_workspace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ close_pgm

Menu_item close_pgm
static

◆ create_pgm

Menu_item create_pgm
static

◆ directory_menu_item

Menu_item directory_menu_item

◆ module_item

Menu_item module_item
static

◆ open_pgm

Menu_item open_pgm
static

◆ workspace_name_to_create

char* workspace_name_to_create
static

Definition at line 70 of file xv_select.c.

Referenced by continue_create_workspace_notify(), and end_create_workspace_notify().

◆ wpips_change_directory_inactive

bool wpips_change_directory_inactive

◆ wpips_change_directory_inactive_old

bool wpips_change_directory_inactive_old

◆ wpips_close_workspace_menu_inactive

bool wpips_close_workspace_menu_inactive

To enable or disable the menu items generated by generate_module_menu():

Definition at line 73 of file xv_select.c.

Referenced by disable_workspace_close(), enable_workspace_close(), generate_workspace_menu(), and restore_enable_workspace_close_state().

◆ wpips_close_workspace_menu_inactive_old

bool wpips_close_workspace_menu_inactive_old

Definition at line 74 of file xv_select.c.

Referenced by disable_workspace_close(), and restore_enable_workspace_close_state().

◆ wpips_create_workspace_menu_inactive

bool wpips_create_workspace_menu_inactive

◆ wpips_delete_workspace_menu_inactive

bool wpips_delete_workspace_menu_inactive

◆ wpips_open_workspace_menu_inactive

bool wpips_open_workspace_menu_inactive