25 #include "pips_config.h"
29 char vcid_xv_props[] =
"$Id: gtk_props.c 23065 2016-03-02 09:05:50Z coelho $";
37 #include <sys/resource.h>
51 #include "constants.h"
52 #include "resources.h"
91 if (strcmp(vp, svp) == 0)
99 void (*func)(GtkWidget *);
100 func = (void(*)(GtkWidget *)) _func;
110 void (*func)(GtkWidget *);
111 func = (void(*)(GtkWidget *)) _func;
112 if (GTK_IS_COMBO_BOX(widget))
117 GtkWidget *),
void(* function_to_apply_on_each_frame_choice)(
120 gtk_container_foreach(GTK_CONTAINER(
options_menu), (GtkCallback)
122 function_to_apply_on_each_menu_item);
125 gtk_container_foreach(GTK_CONTAINER(
options_frame), (GtkCallback)
127 function_to_apply_on_each_frame_choice);
140 const char * child_resource_alias;
141 const char * phase_alias_n;
142 string res_true_n, phase_true_n;
143 GtkWidget * menu_options, *special_prop_menu;
152 GList * menu_options_children = gtk_container_get_children(GTK_CONTAINER(
154 for (i = 0; i < g_list_length(menu_options_children); i++) {
155 child = (GtkWidget *) g_list_nth_data(menu_options_children, i);
156 if (!GTK_IS_MENU_ITEM(child))
158 if (GTK_IS_SEPARATOR(child))
162 if (child_resource_alias == NULL || strcmp(child_resource_alias,
176 special_prop_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(child));
179 GList * spm_children = gtk_container_get_children(GTK_CONTAINER(
188 gtk_menu_set_active(GTK_MENU(special_prop_menu), 0);
189 spm_item = (GtkWidget *) g_list_nth_data(spm_children, 0);
193 "No alias available for selected phase `%s'; selecting `%s'\n",
194 phase_true_n, phase_alias_n);
203 debug(2,
"update_options",
204 "Rule `%s' selected to produce resource `%s'\n",
205 phase_alias_n, child_resource_alias);
209 for (j = g_list_length(spm_children) - 1; j >= 0; j--) {
210 const char * spm_item_label;
211 spm_item = (GtkWidget *) g_list_nth_data(spm_children, j);
212 if (!GTK_IS_MENU_ITEM(spm_item))
214 if (GTK_IS_SEPARATOR(spm_item))
217 debug(9,
"update_options",
"Menu item tested:\"%s\"\n",
219 if (strcmp(spm_item_label, phase_alias_n) == 0) {
220 gtk_menu_set_active(GTK_MENU(special_prop_menu), j);
224 if (GTK_IS_COMBO_BOX(combobox))
225 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), j);
228 user_log(
"Options: phase %s set on.\n", phase_alias_n);
229 debug(2,
"update_options",
230 "Rule `%s' selected to produce resource `%s'\n",
231 phase_alias_n, child_resource_alias);
235 g_list_free(spm_children);
237 g_list_free(menu_options_children);
250 prompt_user(
"No workspace opened. Options not accounted.\n");
255 user_log(
"Options: phase %s (%s) set on.\n", aliased_phase, phase);
268 char * aliased_phase = gtk_combo_box_get_active_text(GTK_COMBO_BOX(item));
273 const gchar * label = gtk_button_get_label(GTK_BUTTON(widget));
292 if (GTK_IS_MENU_ITEM(widget)) {
295 button = gtk_button_new_with_label(lav->
label);
296 gtk_box_pack_start(GTK_BOX(lav->
vbox), button, FALSE, FALSE, 5);
297 gtk_box_reorder_child(GTK_BOX(lav->
vbox), button, lav->
position + 1);
298 gtk_signal_connect(GTK_OBJECT(button),
"clicked", GTK_SIGNAL_FUNC(
308 if (GTK_IS_LABEL(widget)) {
309 label = gtk_label_get_text(GTK_LABEL(widget));
313 gtk_container_child_get_property(GTK_CONTAINER(lav->
vbox), widget,
314 "position", (GValue*)&(lav->
position));
315 gtk_container_foreach(GTK_CONTAINER(
view_menu), (GtkCallback)
325 GtkWidget * frame_vbox) {
331 int number_of_options = 0;
350 hash_put(phase_by_made_htp, vrn, (
char *)p);
369 }, phase_by_made_htp);
381 all_the_options[i].
name = alias1;
382 all_the_options[i].
choices = l;
385 }, phase_by_made_htp);
388 qsort((
char *) all_the_options, number_of_options,
sizeof(
option_type),
392 GtkWidget * table = gtk_table_new(number_of_options, 2, TRUE);
393 gtk_box_pack_start(GTK_BOX(frame_vbox), table, TRUE, FALSE, 0);
394 for (i = 0; i < number_of_options; i++) {
395 GtkWidget * sub_menu_option, *sub_menu_option_item;
397 GtkWidget * choices_combobox;
400 sub_menu_option = gtk_menu_new();
401 sub_menu_option_item = gtk_menu_item_new_with_label(
402 all_the_options[i].name);
403 gtk_menu_item_set_submenu(GTK_MENU_ITEM(sub_menu_option_item),
408 gtk_menu_append(GTK_MENU(menu_options), sub_menu_option_item);
412 choices_combobox = gtk_combo_box_new_text();
413 gtk_signal_connect(GTK_OBJECT(choices_combobox),
"changed",
415 gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new(
416 all_the_options[i].name), 0, 1, i, i + 1);
417 gtk_table_attach_defaults(GTK_TABLE(table), choices_combobox, 1, 2, i,
420 GtkWidget * subsubmenu_option_item;
428 subsubmenu_option_item = gtk_menu_item_new_with_label(alias2);
429 gtk_menu_append(GTK_MENU(sub_menu_option), subsubmenu_option_item);
430 g_signal_connect(GTK_OBJECT(subsubmenu_option_item),
"activate",
434 gtk_combo_box_append_text(GTK_COMBO_BOX(choices_combobox), alias2);
436 }, all_the_options[i].
choices);
441 gtk_widget_show(sub_menu_option_item);
442 gtk_widget_show_all(sub_menu_option);
443 gtk_widget_show_all(choices_combobox);
445 gtk_widget_show_all(table);
453 lav.
vbox = frame_vbox;
454 gtk_container_foreach(GTK_CONTAINER(
options_frame), (GtkCallback)
476 sscanf(
buffer,
"alias%s '%[^']", true_name, alias_name);
482 "\talias '%s' seems ambiguous "
483 "because of previous '%s'!\n", true_name, stored_name);
485 char * upper =
strdup(true_name);
493 const char *message_string;
519 vbox = gtk_vbox_new(FALSE, 0);
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
void user_log(const char *format,...)
const char * activate(const char *phase)
int safe_fclose(FILE *stream, const char *filename)
FILE * fopen_config(const char *canonical_name, const char *cproperty, const char *cenv)
GtkWidget * options_window
GtkWidget * main_window_menu_bar
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a list.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
GtkWidget * view_menu
The menu "View" on the main panel:
void disable_item(GtkWidget *item)
void gpips_execute_and_display_something_from_alias(const char *alias_name)
To execute something and display some Pips output with gpips by knowing its alias:
void enable_item(GtkWidget *item)
void prompt_user(string a_printf_format,...)
static hash_table menu_item_to_combo_box
void enable_option_selection()
static int compare_option_type_for_qsort(const void *x, const void *y)
The function used by qsort to compare 2 option_type structures according to their name string:
static GtkWidget * options_menu
void apply_on_each_options_frame_choice(GtkWidget *widget, gpointer _func)
static void options_window_done_procedure(GtkWidget *window, gpointer data)
Hide and restore the menu item to reopen the option panel:
void options_combo_box_change_callback(GtkWidget *item, gpointer data __attribute__((unused)))
"value" is already used for a typedef...
void apply_on_each_option_item(void(*function_to_apply_on_each_menu_item)(GtkWidget *), void(*function_to_apply_on_each_frame_choice)(GtkWidget *))
void apply_on_each_options_menu_item(GtkWidget *widget, gpointer _func)
int verbose_update_options
Flag allowing update_options also to select a option :
void create_options_menu_and_window()
static GtkWidget * smenu_options
static void synch_viewmenu_and_opframe_search_in_view(GtkWidget *widget, gpointer data)
void options_frame_to_view_menu_gateway(GtkWidget *widget, gpointer data __attribute__((unused)))
void build_options_menu_and_panel(GtkWidget *menu_options, GtkWidget *frame_vbox)
Build the option menu by looking at the pipsmake.rc file and searching if there are several way to bu...
static char hide_options_panel[]
static char display_options_panel[]
GtkWidget * options_frame
void disable_option_selection()
void options_menu_callback(GtkWidget *widget, gpointer data __attribute__((unused)))
void display_or_hide_options_frame(GtkWidget *menu_item, gpointer data)
static GtkWidget * options_frame_menu_item
void options_select(const char *aliased_phase)
static void synch_viewmenu_and_opframe(GtkWidget *widget, gpointer data)
static hash_table aliases
static GtkWidget * options_menu_item
string hash_get_key_by_value(hash_table htp, string svp)
returns the first key which value is svp.
void build_aliases()
Construct a table linking PIPS phase name to more human names, the aliases defined in pipsmake-rc....
void display_memory_usage()
const char * gpips_gtk_menu_item_get_label(GtkWidget *w)
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
void gpips_gtk_menu_item_set_label(GtkWidget *w, gchar *text)
hash_table hash_table_make(hash_key_type key_type, size_t size)
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
#define virtual_resource_name(x)
#define VIRTUAL_RESOURCE(x)
VIRTUAL_RESOURCE.
#define makefile_rules(x)
#define pips_internal_error
#define user_warning(fn,...)
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
string strupper(string, const char *)
#define HASH_MAP(k, v, code, ht)
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
makefile parse_makefile(void)
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
The structure used to build lists in NewGen.