25 #include "pips_config.h"
30 #include <sys/param.h>
33 #include <sys/resource.h>
34 #include <xview/xview.h>
35 #include <xview/panel.h>
36 #include <xview/text.h>
42 #if (defined(TEXT_TYPE))
55 #include "resources.h"
56 #include "constants.h"
65 #include "wpips_view_menu_layout.h"
103 char * alternate_wpips_editor;
105 if (modulename == NULL) {
113 char * label = (
char *) xv_get(menu_item, MENU_STRING);
121 pips_assert(
"Resource related to the menu entry not found",
128 sprintf(file_name_in_database,
"%s/%s",
132 if ((alternate_wpips_editor = getenv(
"PIPS_WPIPS_EDITOR")) != NULL) {
134 sprintf(editor_command,
"%s %s &",
135 alternate_wpips_editor,
136 file_name_in_database);
137 system(editor_command);
142 prompt_user(
"None of the text-windows is available");
146 sprintf(string_filename,
"File: %s",
file_name);
147 sprintf(string_modulename,
"Module: %s", modulename);
150 xv_set(
edit_frame[win_nb], FRAME_LABEL,
"Pips Edit Facility",
151 FRAME_SHOW_FOOTER, TRUE,
152 FRAME_LEFT_FOOTER, string_filename,
153 FRAME_RIGHT_FOOTER, string_modulename,
157 TEXTSW_FILE, file_name_in_database,
158 TEXTSW_BROWSING, FALSE,
165 MENU_STRING,
"Lasts",
166 MENU_INACTIVE, FALSE,
186 #define DONT_TOUCH_WINDOW_ADDRESS 0
199 char title_string_beginning[] =
"Xview Pips Display Facility # ";
200 static char title_string[
sizeof(title_string_beginning) + 4];
202 (void) sprintf(title_string,
"%s%d",
214 static int candidate = 0;
217 if (the_same_as_previous)
223 if ((
bool)xv_get(
edit_textsw[candidate], TEXTSW_MODIFIED))
226 if ((
bool)xv_get(
check_box[candidate], PANEL_VALUE))
229 next = candidate + 1;
252 prompt_user(
"None of the text-windows is available");
255 (void) sprintf(busy_label,
"*Computing %s * ...", title_label);
259 FRAME_SHOW_FOOTER, TRUE,
260 FRAME_LEFT_FOOTER, busy_label,
261 FRAME_RIGHT_FOOTER, title_module_name,
278 char * title_module_name,
296 prompt_user(
"None of the text-windows is available");
302 FRAME_SHOW_FOOTER, TRUE,
303 FRAME_RIGHT_FOOTER, title_module_name,
310 TEXTSW_BROWSING, TRUE,
315 FRAME_LEFT_FOOTER, title_label,
322 MENU_STRING,
"Lasts",
323 MENU_INACTIVE, FALSE, NULL);
349 user_log(
"Displaying in a \"daVinci\" window...\n");
353 sprintf(a_buffer,
"pips_graph2daVinci %s",
file_name);
361 (void) sprintf(a_buffer,
"pips_graph2daVinci -launch_daVinci %s",
380 (void) sprintf(title_module_name,
"Module: %s",
404 (void) sprintf(title_module_name,
"Module: %s",
417 (void) sprintf(bank_view_name,
"%s (bank view)", label);
426 bank_view_name,
"WP65_bank",
483 pips_assert(
"Resource related to the menu entry not found",
509 pips_assert(
"Resource related to the menu entry not found",
521 char * label = (
char *) xv_get(menu_item, MENU_STRING);
534 if (! (
bool)xv_get(
edit_textsw[i], TEXTSW_MODIFIED))
538 if ((
bool)xv_get(
edit_textsw[i], TEXTSW_MODIFIED)) {
548 MENU_STRING,
"No Selection",
549 MENU_INACTIVE, TRUE, NULL);
560 xv_set(item, MENU_INACTIVE, TRUE, 0);
567 xv_set(item, MENU_INACTIVE, FALSE, 0);
573 void (* function_to_apply_on_each_panel_item)(Panel_item))
578 for(i = (
int) xv_get(
view_menu, MENU_NITEMS); i > 0; i--) {
579 Menu_item menu_item = (Menu_item) xv_get(
view_menu, MENU_NTH_ITEM, i);
581 if (!(
bool) xv_get(menu_item, MENU_TITLE)
584 && xv_get(menu_item, MENU_NOTIFY_PROC) != NULL)
585 function_to_apply_on_each_menu_item(menu_item);
590 Panel_item panel_item;
594 if ((Panel_item_type) xv_get(panel_item, PANEL_ITEM_CLASS) ==
596 function_to_apply_on_each_panel_item(panel_item);
625 TEXTSW_DISABLE_CD, TRUE,
626 TEXTSW_DISABLE_LOAD, TRUE,
634 check_box[i] = xv_create(panel, PANEL_CHECK_BOX,
635 PANEL_CHOICE_STRINGS,
"Retain this window", NULL,
642 window_fit_height(panel);
654 xv_create(NULL, MENUITEM,
655 MENU_STRING,
"No Selection",
662 xv_create(NULL, MENUITEM,
663 MENU_STRING,
"Close",
670 xv_create(NULL, MENUITEM,
676 xv_create(XV_NULL, MENU_COMMAND_MENU,
677 MENU_GEN_PIN_WINDOW,
main_frame,
"View & Edit Menu",
678 MENU_TITLE_ITEM,
"Viewing or editing a module ",
711 PANEL_LABEL_STRING,
"View",
void user_log(const char *format,...)
string db_get_current_module_name(void)
Also used to check whether set...
void ask_emacs_to_open_a_new_daVinci_context()
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:
void ask_emacs_to_display_a_graph(string file_name)
bool wpips_emacs_mode
Here are all the stuff to interface Pips with Emacs.
void send_view_to_emacs(char *view_name, char *the_file_name)
void send_module_name_to_emacs(char *some_text)
Here are all the methods used to send an object to Emacs:
const char * module_name(const char *s)
Return the module part of an entity name.
char * get_cwd(void)
returns the current working directory name.
#define SMALL_BUFFER_LENGTH
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
#define NO_TEXTSW_AVAILABLE
void set_pips_icon(Frame frame, char *icon_name, char *icon_text)
void execute_main_loop_command(gpips_main_loop_command_type command)
To ask pipsmake to stop as soon as possible:
void prompt_user(string a_printf_format,...)
void display_memory_usage()
GtkWidget * window_number
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define MAXPATHLEN
MAXPATHLEN is defined in <sys/param.h> for SunOS...
string concatenate(const char *,...)
Return the concatenation of the given strings.
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
#define db_get_file_resource
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
string get_dont_build_view_file(const char *)
string build_view_file(const char *)
view.c
void print_type(type)
For debugging.
#define MAX_NUMBER_OF_WPIPS_WINDOWS
How many display wondows can be opened :
#define INITIAL_NUMBER_OF_WPIPS_WINDOWS
#define WPIPS_MENU_SEPARATOR_ID
How it is specified in the layout .h:
Frame edit_frame[MAX_NUMBER_OF_WPIPS_WINDOWS]
@ WPIPS_EXECUTE_AND_DISPLAY
#define WPIPS_MENU_SEPARATOR
Define the menu separator:
int alloc_first_initialized_window(bool the_same_as_previous)
Find the first free window if any.
void wpips_display_graph_file_display(wpips_view_menu_layout_line *menu_line)
Use daVinci to display a graph information:
void wpips_execute_and_display_something_from_alias(char *alias_name)
To execute something and display some Pips output with wpips or epips by knowing its alias:
void create_edit_window()
char * compute_title_string(int window_number)
static Menu_item close_menu_item
void wpips_execute_and_display_something_outside_the_notifyer(wpips_view_menu_layout_line *menu_line)
bool wpips_view_marked_busy(char *title_module_name, char *title_label, char *icon_name, char *icon_title)
Mark a wpips or epips window as busy:
void view_notify(Menu menu, Menu_item menu_item)
static Menu_item current_selection_mi
static wpips_view_menu_layout_line wpips_view_menu_layout[]
Include the label names:
void execute_wpips_execute_and_display_something_outside_the_notifyer()
To execute something and display some Pips output with wpips or epips, called outside the notifyer:
void wpips_display_plain_file(wpips_view_menu_layout_line *menu_line)
Use some text viewer to display the resource:
void wpips_display_WP65_file(wpips_view_menu_layout_line *menu_line)
Mainly a hack to display 2 files in only one method for WP65...
void wpips_file_view(char *file_name, char *title_module_name, char *title_label, char *icon_name, char *icon_title)
Display a file in a wpips or epips window:
static wpips_view_menu_layout_line * execute_wpips_execute_and_display_something_outside_the_notifyer_menu_line
To pass the view name to execute_wpips_execute_and_display_something_outside_the_notifyer():
static Panel_item check_box[MAX_NUMBER_OF_WPIPS_WINDOWS]
void current_selection_notify(Menu menu, Menu_item menu_item)
void dont_touch_window_notify(Panel_item item, int value, Event *event)
static Menu_item sequential_view_menu_item
void wpips_execute_and_display_something(char *resource_name)
To execute something and display some Pips output with wpips or epips:
static bool dont_touch_window[MAX_NUMBER_OF_WPIPS_WINDOWS]
static Textsw edit_textsw[MAX_NUMBER_OF_WPIPS_WINDOWS]
void enable_menu_item(Menu_item item)
void edit_close_notify(Menu menu, Menu_item menu_item)
void disable_view_selection()
void enable_view_selection()
void disable_menu_item(Menu_item item)
Menu view_menu
The menu "View" on the main panel:
void edit_notify(Menu menu, Menu_item menu_item)
#define DONT_TOUCH_WINDOW_ADDRESS
int number_of_wpips_windows
void apply_on_each_view_item(void(*function_to_apply_on_each_menu_item)(Menu_item), void(*function_to_apply_on_each_panel_item)(Panel_item))
void enable_panel_item(Panel_item item)
void disable_panel_item(Panel_item item)
void unhide_window(Frame frame)
map a frame on the screen