PIPS
xv_help.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/text.h>
#include "genC.h"
#include "top-level.h"
#include "wpips.h"
#include "xv_sizes.h"
#include "misc.h"
+ Include dependency graph for xv_help.c:

Go to the source code of this file.

Macros

#define min(a, b)   ((a) < (b) ? (a) : (b))
 
#define HELP_LINES   32
 
#define PIPS_DOCUMENTATION_URL   "http://www.cri.ensmp.fr/pips"
 The URL of the PIPS documentation at the École des Mines de Paris: More...
 

Functions

void display_help (char *topic)
 
static void close_help_notify (Panel_item item, Event *event)
 
void create_help_window ()
 
static void help_notify (Menu menu, Menu_item menu_item)
 
static void help_launch_pips_netscape (Menu menu, Menu_item menu_item)
 
static void help_launch_pips_xmosaic (Menu menu, Menu_item menu_item)
 
void create_help_menu ()
 

Variables

static Panel_item lines [HELP_LINES]
 
static gen_array_t help_list = (gen_array_t) NULL
 GRRRRRRRR FC. More...
 

Macro Definition Documentation

◆ HELP_LINES

#define HELP_LINES   32

Definition at line 46 of file xv_help.c.

◆ min

#define min (   a,
 
)    ((a) < (b) ? (a) : (b))

Definition at line 45 of file xv_help.c.

◆ PIPS_DOCUMENTATION_URL

#define PIPS_DOCUMENTATION_URL   "http://www.cri.ensmp.fr/pips"

The URL of the PIPS documentation at the École des Mines de Paris:

Definition at line 49 of file xv_help.c.

Function Documentation

◆ close_help_notify()

static void close_help_notify ( Panel_item  item,
Event *  event 
)
static

Definition at line 80 of file xv_help.c.

82 {
85 }
void gen_array_full_free(gen_array_t a)
Definition: array.c:77
GtkWidget * help_frame
Definition: gpips-local.h:43
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
Definition: gtk_utils.c:89
struct _gen_array_chunk_t * gen_array_t
Definition: newgen_array.h:24
static gen_array_t help_list
GRRRRRRRR FC.
Definition: xv_help.c:52

References gen_array_full_free(), help_frame, help_list, and hide_window().

Referenced by create_help_window().

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

◆ create_help_menu()

void create_help_menu ( )

Just a separator:

Align the Help button with the Quit button: XV_X, xv_get(quit_button, XV_X),

Definition at line 140 of file xv_help.c.

141 {
142  Menu menu;
143 
144  menu = xv_create(XV_NULL, MENU_COMMAND_MENU,
145  MENU_TITLE_ITEM,
146  "The PIPS documentation",
147  MENU_GEN_PIN_WINDOW, main_frame, "Help Menu",
148  MENU_ITEM,
149  MENU_STRING, "A few introductory words...",
150  MENU_CLIENT_DATA, strdup("Introduction"),
151  MENU_NOTIFY_PROC, help_notify,
152  NULL,
153  MENU_ITEM,
154  MENU_STRING, "A few words about \"Workspace\"...",
155  MENU_CLIENT_DATA, strdup("Workspace"),
156  MENU_NOTIFY_PROC, help_notify,
157  NULL,
158  MENU_ITEM,
159  MENU_STRING, "A few words about \"Module\"...",
160  MENU_CLIENT_DATA, strdup("Module"),
161  MENU_NOTIFY_PROC, help_notify,
162  NULL,
163  MENU_ITEM,
164  MENU_STRING, "A few words about \"Directory\"...",
165  MENU_CLIENT_DATA, strdup("Directory"),
166  MENU_NOTIFY_PROC, help_notify,
167  NULL,
168  MENU_ITEM,
169  MENU_STRING, "A few words about \"View\"...",
170  MENU_CLIENT_DATA, strdup("View"),
171  MENU_NOTIFY_PROC, help_notify,
172  NULL,
173  MENU_ITEM,
174  MENU_STRING, "A few words about \"Transform/Edit\"...",
175  MENU_CLIENT_DATA, strdup("Transform/Edit"),
176  MENU_NOTIFY_PROC, help_notify,
177  NULL,
178  MENU_ITEM,
179  MENU_STRING, "A few words about \"Compile\"...",
180  MENU_CLIENT_DATA, strdup("Compile"),
181  MENU_NOTIFY_PROC, help_notify,
182  NULL,
183  MENU_ITEM,
184  MENU_STRING, "A few words about \"Options\"...",
185  MENU_CLIENT_DATA, strdup("Options"),
186  MENU_NOTIFY_PROC, help_notify,
187  NULL,
188  MENU_ITEM,
189  MENU_STRING, "A few words about \"Log\"...",
190  MENU_CLIENT_DATA, strdup("Log"),
191  MENU_NOTIFY_PROC, help_notify,
192  NULL,
193  /* Just a separator: */
195  MENU_ACTION_ITEM, "The PIPS documentation on Internet with Netscape...",
197  MENU_ACTION_ITEM, "The PIPS documentation on Internet with XMosaic...",
199  NULL);
200 
201  (void) xv_create(main_panel, PANEL_BUTTON,
202  PANEL_LABEL_STRING, "Help ",
203  PANEL_ITEM_MENU, menu,
204  /* Align the Help button with the Quit button:
205  XV_X, xv_get(quit_button, XV_X), */
206  NULL);
207 }
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60
char * strdup()
Panel main_panel
Definition: wpips.c:63
#define WPIPS_MENU_SEPARATOR
Define the menu separator:
Definition: wpips-local.h:94
static void help_launch_pips_xmosaic(Menu menu, Menu_item menu_item)
Definition: xv_help.c:132
static void help_notify(Menu menu, Menu_item menu_item)
Definition: xv_help.c:116
static void help_launch_pips_netscape(Menu menu, Menu_item menu_item)
Definition: xv_help.c:124

References help_launch_pips_netscape(), help_launch_pips_xmosaic(), help_notify(), main_frame, main_panel, strdup(), and WPIPS_MENU_SEPARATOR.

+ Here is the call graph for this function:

◆ create_help_window()

void create_help_window ( )

Definition at line 90 of file xv_help.c.

91 {
92  int i;
93  Panel help_panel;
94 
95  help_panel = xv_create(help_frame, PANEL,
96  NULL);
97 
98  for (i = 0; i < HELP_LINES; i++) {
99  lines[i] = xv_create(help_panel, PANEL_MESSAGE,
100  XV_X, 15,
101  XV_Y, 15*(i+1),
102  0);
103  }
104 
105  (void) xv_create(help_panel, PANEL_BUTTON,
106  PANEL_LABEL_STRING, "CLOSE",
107  XV_X, HELP_WIDTH/2-28,
108  XV_Y, 15*(HELP_LINES+1),
109  PANEL_NOTIFY_PROC, close_help_notify,
110  0);
111 
112 
113 }
#define HELP_WIDTH
Definition: gtk_sizes.h:40
Panel help_panel
Definition: wpips-local.h:51
static void close_help_notify(Panel_item item, Event *event)
Definition: xv_help.c:80
#define HELP_LINES
Definition: xv_help.c:46
static Panel_item lines[HELP_LINES]
Definition: xv_help.c:51

References close_help_notify(), help_frame, HELP_LINES, help_panel, HELP_WIDTH, and lines.

+ Here is the call graph for this function:

◆ display_help()

void display_help ( char *  topic)

lazy

Definition at line 55 of file xv_help.c.

56 {
57  int i, n;
58 
59  if (!help_list) /* lazy */
61 
62  get_help_topic(topic, help_list);
64 
65  for (i = 0; i < min(HELP_LINES, n); i++) {
66  xv_set(lines[i], PANEL_LABEL_STRING,
67  gen_array_item(help_list, i), 0);
68  }
69 
70  for (i = min(HELP_LINES, n); i < HELP_LINES; i++) {
71  xv_set(lines[i], PANEL_LABEL_STRING, "", 0);
72  }
73 
75 }
size_t gen_array_nitems(const gen_array_t a)
Definition: array.c:131
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
void get_help_topic(string topic, gen_array_t array)
Definition: help.c:64
#define min(a, b)
Definition: xv_help.c:45
void unhide_window(Frame frame)
map a frame on the screen
Definition: xv_utils.c:55

References gen_array_item(), gen_array_make(), gen_array_nitems(), get_help_topic(), help_frame, HELP_LINES, help_list, lines, min, and unhide_window().

Referenced by help_notify().

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

◆ help_launch_pips_netscape()

static void help_launch_pips_netscape ( Menu  menu,
Menu_item  menu_item 
)
static

Definition at line 124 of file xv_help.c.

126 {
127  system("netscape " PIPS_DOCUMENTATION_URL " &");
128 }
#define PIPS_DOCUMENTATION_URL
The URL of the PIPS documentation at the École des Mines de Paris:
Definition: xv_help.c:49

References PIPS_DOCUMENTATION_URL.

Referenced by create_help_menu().

+ Here is the caller graph for this function:

◆ help_launch_pips_xmosaic()

static void help_launch_pips_xmosaic ( Menu  menu,
Menu_item  menu_item 
)
static

Definition at line 132 of file xv_help.c.

134 {
135  system("xmosaic " PIPS_DOCUMENTATION_URL " &");
136 }

References PIPS_DOCUMENTATION_URL.

Referenced by create_help_menu().

+ Here is the caller graph for this function:

◆ help_notify()

static void help_notify ( Menu  menu,
Menu_item  menu_item 
)
static

Definition at line 116 of file xv_help.c.

118 {
119  display_help((char *) xv_get(menu_item, MENU_CLIENT_DATA));
120 }
void display_help(char *topic)
Definition: xv_help.c:55

References display_help().

Referenced by create_help_menu().

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

Variable Documentation

◆ help_list

gen_array_t help_list = (gen_array_t) NULL
static

GRRRRRRRR FC.

Definition at line 52 of file xv_help.c.

Referenced by close_help_notify(), and display_help().

◆ lines

Panel_item lines[HELP_LINES]
static

Definition at line 51 of file xv_help.c.

Referenced by create_help_window(), and display_help().