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

Go to the source code of this file.

Macros

#define QUICK_QUIT   "Quit without saving"
 
#define CLOSE_QUIT   "Close (save) the Workspace & Quit"
 
#define DELETE_QUIT   "Delete the Workspace & Quit"
 
#define CD_HACK_QUIT   "Change Directory (tcl/tk hack)"
 

Functions

void cd_notify (Menu menu, Menu_item menu_item)
 
void quit_notify (Menu menu, Menu_item menu_item)
 
void create_quit_button ()
 

Variables

Panel_item quit_button
 

Macro Definition Documentation

◆ CD_HACK_QUIT

#define CD_HACK_QUIT   "Change Directory (tcl/tk hack)"

Definition at line 50 of file xv_quit.c.

◆ CLOSE_QUIT

#define CLOSE_QUIT   "Close (save) the Workspace & Quit"

Definition at line 48 of file xv_quit.c.

◆ DELETE_QUIT

#define DELETE_QUIT   "Delete the Workspace & Quit"

Definition at line 49 of file xv_quit.c.

◆ QUICK_QUIT

#define QUICK_QUIT   "Quit without saving"

Definition at line 47 of file xv_quit.c.

Function Documentation

◆ cd_notify()

void cd_notify ( Menu  menu,
Menu_item  menu_item 
)

Definition at line 56 of file xv_quit.c.

57 {
59 }
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

References direct_change_directory().

Referenced by create_quit_button().

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

◆ create_quit_button()

void create_quit_button ( )

Definition at line 124 of file xv_quit.c.

125 {
126  Menu menu;
127 
128  menu = xv_create(XV_NULL, MENU_COMMAND_MENU,
129  MENU_ACTION_ITEM, CLOSE_QUIT, quit_notify,
130  MENU_ACTION_ITEM, QUICK_QUIT, quit_notify,
131  MENU_ACTION_ITEM, DELETE_QUIT, quit_notify,
132  MENU_ACTION_ITEM, CD_HACK_QUIT, cd_notify,
133  NULL);
134 
135  quit_button = xv_create(main_panel, PANEL_BUTTON,
136  PANEL_LABEL_STRING, "Quit ",
137  PANEL_ITEM_MENU, menu,
138  NULL);
139 }
Panel main_panel
Definition: wpips.c:63
Panel_item quit_button
Definition: xv_quit.c:52
#define CD_HACK_QUIT
Definition: xv_quit.c:50
#define DELETE_QUIT
Definition: xv_quit.c:49
void cd_notify(Menu menu, Menu_item menu_item)
Definition: xv_quit.c:56
#define QUICK_QUIT
Definition: xv_quit.c:47
void quit_notify(Menu menu, Menu_item menu_item)
Definition: xv_quit.c:62
#define CLOSE_QUIT
Definition: xv_quit.c:48

References CD_HACK_QUIT, cd_notify(), CLOSE_QUIT, DELETE_QUIT, main_panel, QUICK_QUIT, quit_button, and quit_notify().

+ Here is the call graph for this function:

◆ quit_notify()

void quit_notify ( Menu  menu,
Menu_item  menu_item 
)

Send to emacs if we are in the emacs mode:

Destroy all the windows (close open files)

Clear the log window to avoid the message about the edited state: clear_log_subwindow(NULL, NULL); Does not work... Quit: xv_destroy[_safe](main_frame);

Exit xv_main_loop() at top level:

Definition at line 62 of file xv_quit.c.

64 {
65  Event e;
66  int result;
67  string pn;
68 
69  if ((pn = db_get_current_workspace_name())) {
70  string fmt="Workspace %s not closed";
71  char str[SMALL_BUFFER_LENGTH];
72  string str1, str2, menu_string;
73 
74  str2 = "Do you really want to quit PIPS?";
75  menu_string=(string) xv_get(menu_item, MENU_STRING);
76  if (strcmp(menu_string,CLOSE_QUIT)==0)
77  str1=" ";
78  else
79  str1="-=< Resources can get lost! >=-";
80 
81  sprintf(str, fmt , pn);
82 
83  /* Send to emacs if we are in the emacs mode: */
84  if (wpips_emacs_mode)
85  send_notice_prompt_to_emacs(str, str1, str2, NULL);
86  result = notice_prompt(xv_find(main_frame, WINDOW, 0),
87  &e,
88  NOTICE_MESSAGE_STRINGS,
89  str, str1, str2,
90  NULL,
91  NOTICE_BUTTON_YES, menu_string,
92  NOTICE_BUTTON_NO, "Cancel",
93  NULL);
94  if (result == NOTICE_NO)
95  return;
96  else if (strcmp(menu_string, CLOSE_QUIT) == 0)
97  close_workspace(TRUE);
98  else if (strcmp(menu_string, DELETE_QUIT) == 0)
99  {
100  int win = 0;
101 
102  /* Destroy all the windows (close open files) */
103  for (win = 0; win < number_of_wpips_windows ; win++)
104  xv_destroy(edit_frame[win]);
105 
106  check_delete_workspace(pn, FALSE);
107  }
108 
109  }
110 
111  /* Clear the log window to avoid the message about the edited
112  state:
113  clear_log_subwindow(NULL, NULL);
114  Does not work...
115  Quit:
116  xv_destroy[_safe](main_frame);
117  */
118  /* Exit xv_main_loop() at top level: */
119  notify_stop();
120 }
bool close_workspace(bool is_quit)
Definition: dbm.c:346
bool check_delete_workspace(const char *wname, bool check)
Definition: dbm.c:375
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
#define SMALL_BUFFER_LENGTH
Definition: gpips-local.h:24
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60
char * string
STRING.
Definition: newgen_types.h:39
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
Frame edit_frame[MAX_NUMBER_OF_WPIPS_WINDOWS]
Definition: wpips-local.h:41
int number_of_wpips_windows
Definition: xv_edit2.c:77

References check_delete_workspace(), CLOSE_QUIT, close_workspace(), db_get_current_workspace_name(), DELETE_QUIT, edit_frame, main_frame, number_of_wpips_windows, send_notice_prompt_to_emacs(), SMALL_BUFFER_LENGTH, and wpips_emacs_mode.

Referenced by create_quit_button().

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

Variable Documentation

◆ quit_button

Panel_item quit_button

Definition at line 52 of file xv_quit.c.

Referenced by create_quit_button(), and create_status_subwindow().