PIPS
gtk_help.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "genC.h"
#include "top-level.h"
#include "misc.h"
#include <gtk/gtk.h>
#include "gpips.h"
+ Include dependency graph for gtk_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 (GtkWidget *widget, gpointer *data)
 
void create_help_window ()
 
static void help_notify (GtkWidget *widget, gpointer data)
 
static void help_launch_pips_firefox (GtkWidget *widget, gpointer data)
 
void create_help_menu ()
 

Variables

static GtkWidget * lines [HELP_LINES]
 
static gen_array_t help_list = (gen_array_t) NULL
 GRRRRRRRR FC. More...
 
static char * menu_data []
 

Macro Definition Documentation

◆ HELP_LINES

#define HELP_LINES   32

Definition at line 43 of file gtk_help.c.

◆ min

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

Definition at line 42 of file gtk_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 46 of file gtk_help.c.

Function Documentation

◆ close_help_notify()

static void close_help_notify ( GtkWidget *  widget,
gpointer *  data 
)
static

Definition at line 73 of file gtk_help.c.

73  {
75  hide_window(help_window, NULL, NULL);
76 }
void gen_array_full_free(gen_array_t a)
Definition: array.c:77
GtkWidget * help_window
Definition: gpips-local.h:37
static gen_array_t help_list
GRRRRRRRR FC.
Definition: gtk_help.c:48
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

References gen_array_full_free(), help_list, help_window, 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 ( )

Definition at line 132 of file gtk_help.c.

132  {
133  guint i;
134  GtkWidget *help_menu, *help_menu_item;
135  help_menu = gtk_menu_new();
136  help_menu_item = gtk_menu_item_new_with_label("Help");
137  gtk_menu_item_set_submenu(GTK_MENU_ITEM(help_menu_item), help_menu);
138 
139  GtkWidget * menu_item;
140  for (i = 0; i < 9; i++) {
141  menu_item = gtk_menu_item_new_with_label(menu_data[i * 2]);
142  g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(
143  help_notify), menu_data[i * 2 + 1]);
144  gtk_menu_append(GTK_MENU(help_menu), menu_item);
145  }
146 
147  gtk_menu_append(GTK_MENU(help_menu), gtk_separator_menu_item_new());
148 
149  menu_item = gtk_menu_item_new_with_label(
150  "The PIPS documentation on Internet with Firefox...");
151  g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(
152  help_launch_pips_firefox), NULL);
153  gtk_menu_append(GTK_MENU(help_menu), menu_item);
154 
155  gtk_widget_show(help_menu_item);
156  gtk_widget_show_all(help_menu);
157  gtk_menu_bar_append(main_window_menu_bar, help_menu_item);
158 }
GtkWidget * main_window_menu_bar
Definition: gpips.c:62
static char * menu_data[]
Definition: gtk_help.c:122
static void help_launch_pips_firefox(GtkWidget *widget, gpointer data)
Definition: gtk_help.c:119
static void help_notify(GtkWidget *widget, gpointer data)
Definition: gtk_help.c:114

References help_launch_pips_firefox(), help_notify(), main_window_menu_bar, and menu_data.

Referenced by create_menus().

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

◆ create_help_window()

void create_help_window ( )

Definition at line 78 of file gtk_help.c.

78  {
79  guint i;
80  GtkWidget *vbox;
81  GtkWidget *close_button;
82  // help_panel = xv_create(help_frame, PANEL, NULL);
83  help_frame = gtk_frame_new(NULL);
84  gtk_container_add(GTK_CONTAINER(help_window), help_frame);
85 
86  // Literal translation from XV
87  // need to put in in a more gtk-like form
88  vbox = gtk_vbox_new(FALSE, 0);
89  for (i = 0; i < HELP_LINES; i++) {
90  // lines[i] = xv_create(help_panel, PANEL_MESSAGE, XV_X, 15, XV_Y, 15*
91  // (i +1),
92  // 0);
93  // }
94  lines[i] = gtk_label_new(NULL);
95  gtk_box_pack_start(GTK_BOX(vbox), lines[i], FALSE, FALSE, 0);
96  gtk_widget_show(lines[i]);
97  }
98  // xv_create(help_panel, PANEL_BUTTON, PANEL_LABEL_STRING, "CLOSE", XV_X,
99  // HELP_WIDTH / 2 - 28, XV_Y, 15* (HELP_LINES +1),
100  // PANEL_NOTIFY_PROC, close_help_notify,
101  // 0);
102  close_button = gtk_button_new_with_label("CLOSE");
103  gtk_box_pack_start(GTK_BOX(vbox), close_button, FALSE, FALSE, 15);
104  gtk_widget_show(close_button);
105 
106  gtk_container_add(GTK_CONTAINER(help_frame), vbox);
107 
108  gtk_signal_connect(GTK_OBJECT(close_button), "clicked", GTK_SIGNAL_FUNC(
109  close_help_notify), NULL);
110 
111  gtk_widget_show_all(help_frame);
112 }
GtkWidget * help_frame
Definition: gpips-local.h:43
#define HELP_LINES
Definition: gtk_help.c:43
static void close_help_notify(GtkWidget *widget, gpointer *data)
Definition: gtk_help.c:73
static GtkWidget * lines[HELP_LINES]
Definition: gtk_help.c:47

References close_help_notify(), help_frame, HELP_LINES, help_window, and lines.

Referenced by gpips_main(), and wpips_main().

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

◆ display_help()

void display_help ( char *  topic)

Definition at line 50 of file gtk_help.c.

50  {
51  int i, n;
52 
53  if(help_list != NULL)
55  // if (!help_list) /* lazy */
57 
58  get_help_topic(topic, help_list);
60 
61  for (i = 0; i < min(HELP_LINES, n); i++) {
62  gtk_label_set_text(GTK_LABEL(lines[i]), gen_array_item(help_list, i));
63  // xv_set(lines[i], PANEL_LABEL_STRING, gen_array_item(help_list, i), 0);
64  }
65 
66  for (i = min(HELP_LINES, n); i < HELP_LINES; i++) {
67  gtk_label_set_text(GTK_LABEL(lines[i]), "");
68  }
69 
70  gtk_widget_show_all(help_window);
71 }
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 gen_array_free(gen_array_t a)
Definition: array.c:70
#define min(a, b)
Definition: gtk_help.c:42
void get_help_topic(string topic, gen_array_t array)
Definition: help.c:64

References gen_array_free(), gen_array_item(), gen_array_make(), gen_array_nitems(), get_help_topic(), HELP_LINES, help_list, help_window, lines, and min.

Referenced by help_notify(), help_query_notify(), mchoose_help_notify(), and schoose_help_notify().

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

◆ help_launch_pips_firefox()

static void help_launch_pips_firefox ( GtkWidget *  widget,
gpointer  data 
)
static

Definition at line 119 of file gtk_help.c.

119  {
120  safe_system("firefox " PIPS_DOCUMENTATION_URL " &");
121 }
#define PIPS_DOCUMENTATION_URL
The URL of the PIPS documentation at the ï¿œcole des Mines de Paris:
Definition: gtk_help.c:46
void safe_system(string)
system.c
Definition: system.c:38

References PIPS_DOCUMENTATION_URL, and safe_system().

Referenced by create_help_menu().

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

◆ help_notify()

static void help_notify ( GtkWidget *  widget,
gpointer  data 
)
static

Definition at line 114 of file gtk_help.c.

114  {
115  // display_help((char *) xv_get(menu_item, MENU_CLIENT_DATA));
116  display_help((char *) data);
117 }
void display_help(char *topic)
Definition: gtk_help.c:50

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 48 of file gtk_help.c.

Referenced by close_help_notify(), and display_help().

◆ lines

GtkWidget* lines[HELP_LINES]
static

◆ menu_data

char* menu_data[]
static
Initial value:
= { "A few introductory words...", "Introduction",
"A few words about \"Workspace\"...", "Workspace",
"A few words about \"Module\"...", "Module",
"A few words about \"Directory\"...", "Directory",
"A few words about \"View\"...", "View",
"A few words about \"Transform/Edit\"...", "Transform/Edit",
"A few words about \"Compile\"...", "Compile",
"A few words about \"Options\"...", "Options",
"A few words about \"Log\"...", "Log" }

Definition at line 122 of file gtk_help.c.

Referenced by create_help_menu().