PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <xview/xview.h>
#include <xview/frame.h>
#include <xview/panel.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "top-level.h"
#include "database.h"
#include "misc.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "pipsmake.h"
#include "complexity_ri.h"
#include "constants.h"
#include "resources.h"
#include "properties.h"
#include "wpips.h"
Go to the source code of this file.
Data Structures | |
struct | option_type |
lint More... | |
Macros | |
#define | OPTION_PANEL_BUTTONS_ALIGNED |
#define | BSIZE_HERE (256) |
Functions | |
string | hash_get_key_by_value (hash_table htp, string svp) |
returns the first key which value is svp. More... | |
void | disable_panel_item (Panel_item item) |
void | enable_panel_item (Panel_item item) |
void | apply_on_each_option_item (void(*function_to_apply_on_each_menu_item)(Menu_item), void(*function_to_apply_on_each_panel_item)(Panel_item)) |
void | disable_option_selection () |
void | enable_option_selection () |
void | update_options () |
void | options_select (char *aliased_phase) |
The following procedure is never used ! I have removed it. More... | |
void | options_panel_notify (Panel_item item, int valeur, Event *event) |
"value" is already used for a typedef... More... | |
void | options_panel_to_view_menu_gateway (Panel_item item, Event *event) |
void | options_menu_notify (Menu menu, Menu_item menu_item) |
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: More... | |
void | build_options_menu_and_panel (Menu menu_options, Panel options_panel) |
Build the option menu by looking at the pipsmake.rc file and searching if there are several way to build a ressource: More... | |
void | build_aliases () |
void | display_or_hide_options_panel (Menu menu, Menu_item menu_item) |
static void | options_frame_done_procedure (Frame frame) |
Hide and restore the menu item to reopen the option panel: More... | |
void | create_options_menu_and_window () |
Variables | |
static Menu | smenu_options |
static Menu | options_menu |
static Menu_item | options_panel_menu_item |
Panel | options_panel |
static hash_table | aliases |
static char | display_options_panel [] = "Options panel..." |
static char | hide_options_panel [] = "Hide options panel" |
int | verbose_update_options = 1 |
Flag allowing update_options also to select a option : More... | |
#define BSIZE_HERE (256) |
Definition at line 660 of file xv_props.c.
#define OPTION_PANEL_BUTTONS_ALIGNED |
Definition at line 56 of file xv_props.c.
void apply_on_each_option_item | ( | void(*)(Menu_item) | function_to_apply_on_each_menu_item, |
void(*)(Panel_item) | function_to_apply_on_each_panel_item | ||
) |
Walk through items of menu_options
find resource corresponding to the item
Skip the title item:
It must be the pin item, or the item controlling the options panel.
Now walk through the options panel:
Only on the PANEL_CHOICE_STACK:
Definition at line 109 of file xv_props.c.
References display_options_panel, hide_options_panel, options_menu, and options_panel.
Referenced by disable_option_selection(), and enable_option_selection().
void build_aliases | ( | ) |
Definition at line 663 of file xv_props.c.
References aliases, BSIZE_HERE, buffer, fopen_config(), hash_get(), hash_put(), hash_string, hash_table_make(), HASH_UNDEFINED_VALUE, pips_internal_error, safe_fclose(), strdup(), and strupper().
Referenced by create_options_menu_and_window().
void build_options_menu_and_panel | ( | Menu | menu_options, |
Panel | options_panel | ||
) |
Build the option menu by looking at the pipsmake.rc file and searching if there are several way to build a ressource:
The option panel use the definition of the edit menu and so needs to be create after it:
walking thru rules
walking thru resources made by this particular rule
walking thru phase_by_made_htp
First, try to do some measurements on the options item to be able to sort and align menu items later:
Now generate an array of the Options:
Sort the Options:
Create the Options in the Option menu and option panel:
Create the sub-menu entry of an option:
PANEL_CLIENT_DATA is used to link the PANEL_CHOICE_STACK to its dual MENU_PULLRIGHT. RK, 11/06/1993.
Nothing selected yet:
Add a sub-option entry in the menu:
Attach the sub-menu to an Option menu:
... And in the Option panel:
Create the Option Item for this alias:
Attach the Option Item to the Option menu:
Add a link information from the sub_menu_option to the equivalent panel_choice_item for update_props():
Now we set the width of the PANEL_CHOICE_STACK items the same to have a nicer vertical alignment:
If I want something with the buttons vertically aligned:
It looks on my screen that this width is 8:7 larger. Apply a pifometric scaling factor... :-)
According to a suggestion from Guillaume Oget, it should be nice to be able to select a view also from the Option panel:
Find if the View menu has an item with the same value:
Do not create the menu item if it does not exist:
OK, there is also a View menu with the same name.
Shift a little bit the PANEL_LABEL to align with other text of the menu buttons:
Definition at line 373 of file xv_props.c.
References aliases, CAR, option_type::choices, compare_option_type_for_qsort(), CONS, gen_length(), gen_nconc(), hash_get(), hash_get_key_by_value(), HASH_MAP, hash_put(), hash_string, hash_table_make(), HASH_UNDEFINED_VALUE, makefile_rules, malloc(), MAPL, MAX, option_type::name, NIL, options_frame, options_menu_notify(), options_panel, options_panel_notify(), options_panel_to_view_menu_gateway(), parse_makefile(), RULE, rule_phase, rule_produced, smenu_options, STRING, view_menu, view_menu_item, VIRTUAL_RESOURCE, and virtual_resource_name.
Referenced by create_options_menu_and_window().
|
static |
The function used by qsort to compare 2 option_type structures according to their name string:
Definition at line 360 of file xv_props.c.
References x.
Referenced by build_options_menu_and_panel().
void create_options_menu_and_window | ( | ) |
RK, 11/06/1993. There is no room :
Trap the FRAME_DONE event:
Definition at line 728 of file xv_props.c.
References build_aliases(), build_options_menu_and_panel(), display_options_panel, display_or_hide_options_panel(), main_frame, main_panel, options_frame, options_frame_done_procedure(), options_menu, options_panel, and options_panel_menu_item.
void disable_option_selection | ( | ) |
Definition at line 151 of file xv_props.c.
References apply_on_each_option_item(), disable_menu_item(), and disable_panel_item().
void disable_panel_item | ( | Panel_item | item | ) |
Definition at line 95 of file xv_props.c.
Referenced by disable_option_selection(), and disable_view_selection().
void display_or_hide_options_panel | ( | Menu | menu, |
Menu_item | menu_item | ||
) |
Should be added : when the options panel is destroyed by the window manager, toggle the menu. RK, 7/6/93.
Definition at line 695 of file xv_props.c.
References display_options_panel, hide_options_panel, hide_window(), options_frame, and unhide_window().
Referenced by create_options_menu_and_window().
void enable_option_selection | ( | ) |
Definition at line 158 of file xv_props.c.
References apply_on_each_option_item(), enable_menu_item(), and enable_panel_item().
void enable_panel_item | ( | Panel_item | item | ) |
Definition at line 102 of file xv_props.c.
Referenced by enable_option_selection(), and enable_view_selection().
string hash_get_key_by_value | ( | hash_table | htp, |
string | svp | ||
) |
returns the first key which value is svp.
when not found, returns NULL
Definition at line 81 of file xv_props.c.
References HASH_MAP, and HASH_UNDEFINED_VALUE.
Referenced by build_options_menu_and_panel(), and update_options().
|
static |
Hide and restore the menu item to reopen the option panel:
Definition at line 720 of file xv_props.c.
References display_options_panel, hide_window(), options_frame, and options_panel_menu_item.
Referenced by create_options_menu_and_window().
void options_menu_notify | ( | Menu | menu, |
Menu_item | menu_item | ||
) |
Definition at line 349 of file xv_props.c.
References options_select().
Referenced by build_options_menu_and_panel().
void options_panel_notify | ( | Panel_item | item, |
int | valeur, | ||
Event * | event | ||
) |
"value" is already used for a typedef...
:-) RK, 11/06/1993.
Look at the corresponding (dual) item in the options menu to get the value. RK, 11/06/1993.
Argh ! MENU_NTH_ITEM begins from 1 but PANEL_VALUE begins from 0... RK, 02/07/1993.
Definition at line 316 of file xv_props.c.
References options_select(), and valeur().
Referenced by build_options_menu_and_panel().
void options_panel_to_view_menu_gateway | ( | Panel_item | item, |
Event * | event | ||
) |
Definition at line 339 of file xv_props.c.
References wpips_execute_and_display_something_from_alias().
Referenced by build_options_menu_and_panel().
void options_select | ( | char * | aliased_phase | ) |
The following procedure is never used ! I have removed it.
RK, 11/06/1993.
To have the options panel consistent with the real phase set : RK, 05/07/1993.
Definition at line 285 of file xv_props.c.
References activate(), aliases, db_get_current_workspace_name(), debug_off, debug_on, hash_get(), HASH_UNDEFINED_VALUE, pips_internal_error, prompt_user(), update_options(), user_log(), and verbose_update_options.
Referenced by options_menu_notify(), and options_panel_notify().
void update_options | ( | ) |
walk through items of menu_options
find resource corresponding to the item
Skip the title item:
It must be the pin item, or the item controlling the options panel. RK, 4/06/1993.
find special prop menu containing item corresponding to active phase
find active phase which produces resource res_true_n
There is no alias for currently selected phase: phase_true_n We have to activate another phase
It does not seem to work (the doc does not talk about xv_set for MENU_SELECTED by the way...):
Then, try harder :
walk through items of special_prop_m to select the activated one
Update the dual options panel entry :
Definition at line 165 of file xv_props.c.
References activate(), aliases, debug(), debug_off, debug_on, display_memory_usage(), display_options_panel, find_rule_by_resource(), hash_get(), hash_get_key_by_value(), HASH_UNDEFINED_VALUE, hide_options_panel, pips_internal_error, rule_phase, smenu_options, user_log(), user_warning, and verbose_update_options.
Referenced by options_select().
|
static |
Definition at line 71 of file xv_props.c.
Referenced by build_aliases(), build_options_menu_and_panel(), options_select(), and update_options().
|
static |
Definition at line 73 of file xv_props.c.
Referenced by apply_on_each_option_item(), create_options_menu_and_window(), display_or_hide_options_panel(), options_frame_done_procedure(), and update_options().
|
static |
Definition at line 74 of file xv_props.c.
Referenced by apply_on_each_option_item(), display_or_hide_options_panel(), and update_options().
|
static |
Definition at line 67 of file xv_props.c.
Referenced by apply_on_each_option_item(), and create_options_menu_and_window().
Panel options_panel |
Definition at line 69 of file xv_props.c.
Referenced by apply_on_each_option_item(), apply_on_each_view_item(), build_options_menu_and_panel(), and create_options_menu_and_window().
|
static |
Definition at line 68 of file xv_props.c.
Referenced by create_options_menu_and_window(), and options_frame_done_procedure().
|
static |
Definition at line 66 of file xv_props.c.
Referenced by build_options_menu_and_panel(), and update_options().
int verbose_update_options = 1 |
Flag allowing update_options also to select a option :
Definition at line 77 of file xv_props.c.
Referenced by options_select(), and update_options().