pcb 4.1.1
An interactive printed circuit board layout editor.
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include "xincludes.h"
#include "global.h"
#include "data.h"
#include "error.h"
#include "misc.h"
#include "pcb-printf.h"
#include "hid.h"
#include "../hidint.h"
#include "hid/common/hid_resource.h"
#include "resource.h"
#include "lesstif.h"
#include "mymem.h"
#include "layerflags.h"
#include "pcb-menu.h"
Go to the source code of this file.
Data Structures | |
struct | LayerButtons |
struct | WidgetFlagType |
struct | ToggleItem |
struct | acc_table_t |
Defines | |
#define | R_OK 4 |
#define | stdarg(t, v) XtSetArg(args[n], t, v), n++ |
#define | LB_SILK (MAX_LAYER + BOTTOM_SILK_LAYER) |
#define | LB_RATS (MAX_LAYER + 1) |
#define | LB_NUMPICK (LB_RATS+1) |
#define | LB_PINS (MAX_ALL_LAYER) |
#define | LB_VIAS (MAX_ALL_LAYER + 1) |
#define | LB_BACK (MAX_ALL_LAYER + 2) |
#define | LB_MASK (MAX_ALL_LAYER + 3) |
#define | LB_NUM (MAX_ALL_LAYER + 4) |
#define | dump_multi(x, a, b, c) |
#define | KM(m) ((m) & ~M_Multi) |
Typedefs | |
typedef struct ToggleItem | ToggleItem |
typedef struct acc_table_t | acc_table_t |
Functions | |
static void | note_accelerator (char *acc, Resource *node) |
static void | note_widget_flag (Widget w, char *type, char *name) |
static int | GetXY (int argc, char **argv, Coord x, Coord y) |
Get a coordinate. | |
static int | Debug (int argc, char **argv, Coord x, Coord y) |
static int | Return (int argc, char **argv, Coord x, Coord y) |
static int | DumpKeys (int argc, char **argv, Coord x, Coord y) |
static int | LayersChanged (int argc, char **argv, Coord x, Coord y) |
static void | show_one_layer_button (int layer, int set) |
static void | layer_button_callback (Widget w, int layer, XmPushButtonCallbackStruct *pbcs) |
static void | layerpick_button_callback (Widget w, int layer, XmPushButtonCallbackStruct *pbcs) |
static int | SelectLayer (int argc, char **argv, Coord x, Coord y) |
static int | ToggleView (int argc, char **argv, Coord x, Coord y) |
static void | insert_layerview_buttons (Widget menu) |
static void | insert_layerpick_buttons (Widget menu) |
void | lesstif_update_widget_flags () |
static void | radio_callback (Widget toggle, ToggleItem *me, XmToggleButtonCallbackStruct *cbs) |
int | lesstif_button_event (Widget w, XEvent *e) |
void | lesstif_get_xy (const char *message) |
void | lesstif_get_coords (const char *msg, Coord *px, Coord *py) |
static void | callback (Widget w, Resource *node, XmPushButtonCallbackStruct *pbcs) |
static int | acc_sort (const void *va, const void *vb) |
static int | DumpKeys2 () |
static acc_table_t * | find_or_create_acc (char mods, char key, KeySym sym, acc_table_t **table, int *n_ents) |
static int | acc_sort_rev (const void *va, const void *vb) |
| |
int | lesstif_key_event (XKeyEvent *e) |
static void | add_resource_to_menu (Widget menu, Resource *node, XtCallbackProc callback) |
Widget | lesstif_menu (Widget parent, char *name, Arg *margs, int mn) |
void | lesstif_uninit_menu (void) |
Variables | |
static Colormap | cmap |
static Arg | args [30] |
static int | n |
static const char | getxy_syntax [] = "GetXY()" |
static const char | getxy_help [] = "Get a coordinate." |
static const char | debug_syntax [] = "Debug(...)" |
static const char | debug_help [] = "Debug action." |
static const char | debugxy_syntax [] = "DebugXY(...)" |
static const char | debugxy_help [] = "Debug action, with coordinates" |
static const char | return_syntax [] = "Return(0|1)" |
static const char | return_help [] = "Simulate a passing or failing action." |
static const char | dumpkeys_syntax [] = "DumpKeys()" |
static const char | dumpkeys_help [] = "Dump Lesstif key bindings." |
static int | do_dump_keys = 0 |
static LayerButtons * | layer_button_list = 0 |
static int | num_layer_buttons = 0 |
static int | fg_colors [LB_NUM] |
static int | bg_color |
Widget | lesstif_m_layer |
static const char | selectlayer_syntax [] = "SelectLayer(1..MAXLAYER|Silk|Rats)" |
static const char | selectlayer_help [] = "Select which layer is the current layer." |
static const char | toggleview_syntax [] = "ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)" |
static const char | toggleview_help [] = "Toggle the visibility of the specified layer or layer group." |
static WidgetFlagType * | wflags = 0 |
static int | n_wflags = 0 |
static int | max_wflags = 0 |
HID_Action | lesstif_menu_action_list [] |
static ToggleItem * | toggle_items = 0 |
static int | need_xy = 0 |
static int | have_xy = 0 |
static int | action_x |
static int | action_y |
static acc_table_t * | acc_table |
static int | acc_num = 0 |
static acc_table_t * | cur_table = 0 |
static int | cur_ntable = 0 |
char * | lesstif_pcbmenu_path |
Definition at line 1107 of file menu.c.
Referenced by lesstif_key_event().
Referenced by lesstif_key_event().
#define LB_BACK (MAX_ALL_LAYER + 2) |
Definition at line 191 of file menu.c.
Referenced by insert_layerview_buttons(), layer_button_callback(), LayersChanged(), and ToggleView().
#define LB_MASK (MAX_ALL_LAYER + 3) |
Definition at line 192 of file menu.c.
Referenced by insert_layerview_buttons(), layer_button_callback(), LayersChanged(), and ToggleView().
#define LB_NUM (MAX_ALL_LAYER + 4) |
Definition at line 193 of file menu.c.
Referenced by insert_layerview_buttons(), and LayersChanged().
#define LB_NUMPICK (LB_RATS+1) |
Definition at line 187 of file menu.c.
Referenced by insert_layerpick_buttons(), layerpick_button_callback(), and LayersChanged().
#define LB_PINS (MAX_ALL_LAYER) |
Definition at line 189 of file menu.c.
Referenced by insert_layerview_buttons(), layer_button_callback(), LayersChanged(), and ToggleView().
#define LB_RATS (MAX_LAYER + 1) |
Definition at line 186 of file menu.c.
Referenced by insert_layerpick_buttons(), insert_layerview_buttons(), layer_button_callback(), layerpick_button_callback(), LayersChanged(), SelectLayer(), and ToggleView().
#define LB_SILK (MAX_LAYER + BOTTOM_SILK_LAYER) |
Definition at line 185 of file menu.c.
Referenced by insert_layerpick_buttons(), insert_layerview_buttons(), layer_button_callback(), layerpick_button_callback(), LayersChanged(), SelectLayer(), and ToggleView().
#define LB_VIAS (MAX_ALL_LAYER + 1) |
Definition at line 190 of file menu.c.
Referenced by insert_layerview_buttons(), layer_button_callback(), LayersChanged(), and ToggleView().
#define R_OK 4 |
Definition at line 35 of file menu.c.
Referenced by get_menu_filename(), and lesstif_menu().
Definition at line 42 of file menu.c.
Referenced by add_resource_to_menu(), callback(), insert_layerpick_buttons(), insert_layerview_buttons(), layerpick_button_callback(), LayersChanged(), lesstif_get_xy(), and show_one_layer_button().
typedef struct acc_table_t acc_table_t |
typedef struct ToggleItem ToggleItem |
static int acc_sort | ( | const void * | va, |
const void * | vb | ||
) | [static] |
Definition at line 912 of file menu.c.
References acc_table_t::a, acc_table_t::key_char, M_Multi, acc_table_t::mods, and acc_table_t::u.
Referenced by DumpKeys2().
static int acc_sort_rev | ( | const void * | va, |
const void * | vb | ||
) | [static] |
We sort these such that the ones with explicit modifiers come before the ones with implicit modifiers. That way, a Shift<Key>Code gets chosen before a <Key>Code.
Definition at line 1121 of file menu.c.
References acc_table_t::a, acc_table_t::key_char, M_Multi, acc_table_t::mods, and acc_table_t::u.
Referenced by lesstif_key_event().
static void add_resource_to_menu | ( | Widget | menu, |
Resource * | node, | ||
XtCallbackProc | callback | ||
) | [static] |
Definition at line 1261 of file menu.c.
References args, Resource::c, callback(), ToggleItem::callback, display, do_color(), FLAG_S, Resource::flags, ToggleItem::group, insert_layerpick_buttons(), insert_layerview_buttons(), ToggleItem::item, lesstif_insert_style_buttons(), malloc(), n, ResourceVal::name, ToggleItem::next, ToggleItem::node, note_accelerator(), note_widget_flag(), radio_callback(), resource_subres(), resource_type, resource_value(), stdarg, ResourceVal::subres, toggle_items, Resource::v, ResourceVal::value, ToggleItem::w, and XmStringCreatePCB().
Referenced by lesstif_menu().
static void callback | ( | Widget | w, |
Resource * | node, | ||
XmPushButtonCallbackStruct * | pbcs | ||
) | [static] |
Definition at line 851 of file menu.c.
References action_x, args, Resource::c, display, have_xy, hid_parse_actions(), lesstif_need_idle_proc(), lesstif_show_crosshair(), n, resource_type, stdarg, Resource::v, ResourceVal::value, and work_area.
Referenced by add_resource_to_menu(), g_cclosure_user_marshal_VOID__INT_STRING(), ghid_layer_selector_delete_layers(), ghid_layer_selector_show_layers(), ghid_layer_selector_update_colors(), lesstif_menu(), and PolygonHoles().
Definition at line 116 of file menu.c.
References PCBType::Data, DataType::Layer, layertype_to_string(), max_copper_layer, LayerType::Name, PCB, pcb_printf(), SILK_LAYER, and LayerType::Type.
Definition at line 177 of file menu.c.
References do_dump_keys.
static int DumpKeys2 | ( | ) | [static] |
Definition at line 925 of file menu.c.
References acc_table_t::a, acc_num, acc_sort(), M_Alt, M_Ctrl, M_Shift, mod(), mods, resource_type, acc_table_t::u, and u().
Referenced by lesstif_menu().
static acc_table_t* find_or_create_acc | ( | char | mods, |
char | key, | ||
KeySym | sym, | ||
acc_table_t ** | table, | ||
int * | n_ents | ||
) | [static] |
Definition at line 960 of file menu.c.
References acc_table_t::a, acc_table_t::key_char, M_Multi, malloc(), max, mods, acc_table_t::mods, realloc(), and acc_table_t::u.
Referenced by note_accelerator().
Get a coordinate.
Each action is registered with a flag for the core ("need_coord_msg") that says whether it requires an X,Y location from the user, and if so, provides a prompt for that X,Y location.
The GUIs display that prompt while waiting for the user to click.
GetXY() is a "filler" action which exists *only* to request an X,Y click from the user, for actions that don't (or optionally) need coords, or don't have a message appropriate for the case being issued (i.e. if there are multiple actions to be executed, the GetXY() might be appropriate for the *group* results, not the first action that happens to need a coordinate).
The catch is that the core asks for the X,Y click *before* the action is called, so there's no way for any argument to GetXY() to have any effect.
The string "printed" is the empty one in the struct where GetXY() is registered.
static void insert_layerpick_buttons | ( | Widget | menu | ) | [static] |
Definition at line 627 of file menu.c.
References args, FLAG_V, Resource::flags, LayerButtons::is_pick, layerpick_button_callback(), LayersChanged(), LB_NUMPICK, LB_RATS, LB_SILK, malloc(), max_copper_layer, n, note_accelerator(), num_layer_buttons, realloc(), resource_add_val(), resource_create(), s, stdarg, LayerButtons::w, and XmStringCreatePCB().
Referenced by add_resource_to_menu().
static void insert_layerview_buttons | ( | Widget | menu | ) | [static] |
Definition at line 552 of file menu.c.
References args, FLAG_V, Resource::flags, LayerButtons::is_pick, layer_button_callback(), LayersChanged(), LB_BACK, LB_MASK, LB_NUM, LB_PINS, LB_RATS, LB_SILK, LB_VIAS, malloc(), max_copper_layer, n, note_accelerator(), note_widget_flag(), num_layer_buttons, realloc(), resource_add_val(), resource_create(), s, stdarg, LayerButtons::w, and XmStringCreatePCB().
Referenced by add_resource_to_menu().
static void layer_button_callback | ( | Widget | w, |
int | layer, | ||
XmPushButtonCallbackStruct * | pbcs | ||
) | [static] |
Definition at line 368 of file menu.c.
References PCBType::Data, PCBType::ElementOn, LayerGroupType::Entries, GetLayerGroupNumberByNumber(), PCBType::InvisibleObjectsOn, layer, DataType::Layer, PCBType::LayerGroups, LB_BACK, LB_MASK, LB_PINS, LB_RATS, LB_SILK, LB_VIAS, lesstif_invalidate_all(), max_copper_layer, LayerGroupType::Number, LayerType::On, PCB, PCBType::PinOn, PCBType::RatOn, show_one_layer_button(), TEST_FLAG, TOGGLE_FLAG, and PCBType::ViaOn.
Referenced by insert_layerview_buttons(), and ToggleView().
static void layerpick_button_callback | ( | Widget | w, |
int | layer, | ||
XmPushButtonCallbackStruct * | pbcs | ||
) | [static] |
Definition at line 418 of file menu.c.
References args, bg_color, ChangeGroupVisibility(), PCBType::Data, fg_colors, LayerButtons::is_pick, layer, DataType::Layer, LB_NUMPICK, LB_RATS, LB_SILK, lesstif_invalidate_all(), lesstif_m_layer, max_copper_layer, n, LayerType::Name, num_layer_buttons, PCB, PCBType::RatDraw, PCBType::SilkActive, stdarg, LayerButtons::w, and XmStringCreatePCB().
Referenced by insert_layerpick_buttons(), and SelectLayer().
Definition at line 209 of file menu.c.
References args, SettingType::BackgroundColor, bg_color, LayerType::Color, PCBType::Data, SettingType::ElementColor, PCBType::ElementColor, PCBType::ElementOn, fg_colors, SettingType::InvisibleObjectsColor, PCBType::InvisibleObjectsColor, PCBType::InvisibleObjectsOn, LayerButtons::is_pick, DataType::Layer, SettingType::LayerColor, LayerStack, LB_BACK, LB_MASK, LB_NUM, LB_NUMPICK, LB_PINS, LB_RATS, LB_SILK, LB_VIAS, lesstif_m_layer, lesstif_parse_color(), lesstif_update_layer_groups(), SettingType::MaskColor, PCBType::MaskColor, max_copper_layer, n, LayerType::Name, num_layer_buttons, LayerType::On, PCB, SettingType::PinColor, PCBType::PinColor, PCBType::PinOn, SettingType::RatColor, PCBType::RatColor, PCBType::RatDraw, PCBType::RatOn, s, Settings, PCBType::SilkActive, stdarg, TEST_FLAG, SettingType::ViaColor, PCBType::ViaColor, PCBType::ViaOn, LayerButtons::w, and XmStringCreatePCB().
int lesstif_button_event | ( | Widget | w, |
XEvent * | e | ||
) |
Definition at line 842 of file menu.c.
References action_x, have_xy, lesstif_coords_to_pcb(), and lesstif_get_xy().
Referenced by hid_lesstif_init().
void lesstif_get_xy | ( | const char * | message | ) |
Definition at line 819 of file menu.c.
References app_context, args, display, have_xy, m_click, n, stdarg, and XmStringCreatePCB().
Referenced by lesstif_get_coords().
int lesstif_key_event | ( | XKeyEvent * | e | ) |
Definition at line 1134 of file menu.c.
References acc_table_t::a, acc_num, acc_sort_rev(), acc_table, action_x, acc_table_t::c, cur_ntable, cur_table, dump_multi, have_xy, hid_parse_actions(), KM, lesstif_log(), M_Alt, M_Ctrl, M_Multi, M_Shift, mods, resource_type, acc_table_t::u, u(), and work_area.
Referenced by work_area_input().
Widget lesstif_menu | ( | Widget | parent, |
char * | name, | ||
Arg * | margs, | ||
int | mn | ||
) |
Definition at line 1451 of file menu.c.
References add_resource_to_menu(), callback(), cmap, Concat(), display, do_dump_keys, DumpKeys2(), filename, homedir, lesstif_pcbmenu_path, load_mouse_resource(), Message(), R_OK, resource_parse(), resource_subres(), and screen.
Referenced by lesstif_do_export().
void lesstif_uninit_menu | ( | void | ) |
void lesstif_update_widget_flags | ( | void | ) |
Definition at line 722 of file menu.c.
References args, hid_get_flag(), n_wflags, and WidgetFlagType::oldval.
Referenced by idle_proc().
static void note_accelerator | ( | char * | acc, |
Resource * | node | ||
) | [static] |
Definition at line 996 of file menu.c.
References acc_table_t::a, acc_num, acc_table, acc_table_t::c, find_or_create_acc(), M_Alt, M_Ctrl, M_Multi, M_Shift, mods, node, and acc_table_t::u.
Referenced by add_resource_to_menu(), insert_layerpick_buttons(), and insert_layerview_buttons().
static void note_widget_flag | ( | Widget | w, |
char * | type, | ||
char * | name | ||
) | [static] |
Definition at line 707 of file menu.c.
References WidgetFlagType::flagname, max_wflags, n_wflags, WidgetFlagType::oldval, realloc(), WidgetFlagType::w, and WidgetFlagType::xres.
Referenced by add_resource_to_menu(), and insert_layerview_buttons().
static void radio_callback | ( | Widget | toggle, |
ToggleItem * | me, | ||
XmToggleButtonCallbackStruct * | cbs | ||
) | [static] |
Definition at line 785 of file menu.c.
References ToggleItem::callback, ToggleItem::group, ToggleItem::item, ToggleItem::next, ToggleItem::node, and ToggleItem::w.
Referenced by add_resource_to_menu().
Definition at line 469 of file menu.c.
References PCBType::Data, DataType::Layer, layerpick_button_callback(), LB_RATS, LB_SILK, max_copper_layer, LayerType::Name, and PCB.
static void show_one_layer_button | ( | int | layer, |
int | set | ||
) | [static] |
Definition at line 343 of file menu.c.
References args, bg_color, fg_colors, LayerButtons::is_pick, n, num_layer_buttons, stdarg, and LayerButtons::w.
Referenced by layer_button_callback().
Definition at line 512 of file menu.c.
References PCBType::Data, DataType::Layer, layer_button_callback(), LB_BACK, LB_MASK, LB_PINS, LB_RATS, LB_SILK, LB_VIAS, max_copper_layer, LayerType::Name, PCB, and SILK_LAYER.
int acc_num = 0 [static] |
Definition at line 909 of file menu.c.
Referenced by DumpKeys2(), lesstif_key_event(), and note_accelerator().
acc_table_t* acc_table [static] |
Definition at line 908 of file menu.c.
Referenced by lesstif_key_event(), and note_accelerator().
int action_x |
Definition at line 782 of file menu.c.
Referenced by callback(), lesstif_button_event(), lesstif_get_coords(), and lesstif_key_event().
Arg args[30] [static] |
Definition at line 40 of file menu.c.
Referenced by add_resource_to_menu(), callback(), insert_layerpick_buttons(), insert_layerview_buttons(), layerpick_button_callback(), LayersChanged(), lesstif_get_xy(), lesstif_update_widget_flags(), and show_one_layer_button().
int bg_color [static] |
Definition at line 204 of file menu.c.
Referenced by layerpick_button_callback(), LayersChanged(), and show_one_layer_button().
Colormap cmap [static] |
Definition at line 38 of file menu.c.
Referenced by lesstif_menu().
int cur_ntable = 0 [static] |
Definition at line 1111 of file menu.c.
Referenced by lesstif_key_event().
acc_table_t* cur_table = 0 [static] |
Definition at line 1110 of file menu.c.
Referenced by lesstif_key_event().
const char debug_help[] = "Debug action." [static] |
const char debug_syntax[] = "Debug(...)" [static] |
const char debugxy_help[] = "Debug action, with coordinates" [static] |
const char debugxy_syntax[] = "DebugXY(...)" [static] |
int do_dump_keys = 0 [static] |
Definition at line 175 of file menu.c.
Referenced by DumpKeys(), and lesstif_menu().
const char dumpkeys_help[] = "Dump Lesstif key bindings." [static] |
const char dumpkeys_syntax[] = "DumpKeys()" [static] |
int fg_colors[LB_NUM] [static] |
Definition at line 203 of file menu.c.
Referenced by layerpick_button_callback(), LayersChanged(), and show_one_layer_button().
const char getxy_help[] = "Get a coordinate." [static] |
const char getxy_syntax[] = "GetXY()" [static] |
int have_xy = 0 |
Definition at line 782 of file menu.c.
Referenced by callback(), lesstif_button_event(), lesstif_get_coords(), lesstif_get_xy(), and lesstif_key_event().
LayerButtons* layer_button_list = 0 [static] |
Widget lesstif_m_layer |
Definition at line 162 of file hid/lesstif/main.c.
Referenced by layerpick_button_callback(), LayersChanged(), and lesstif_do_export().
{ {"DumpKeys", 0, DumpKeys, dumpkeys_help, dumpkeys_syntax}, {"Debug", 0, Debug, debug_help, debug_syntax}, {"DebugXY", "Click X,Y for Debug", Debug, debugxy_help, debugxy_syntax}, {"GetXY", "", GetXY, getxy_help, getxy_syntax}, {"Return", 0, Return, return_help, return_syntax}, {"LayersChanged", 0, LayersChanged, layerschanged_help, layerschanged_syntax}, {"ToggleView", 0, ToggleView, toggleview_help, toggleview_syntax}, {"SelectLayer", 0, SelectLayer, selectlayer_help, selectlayer_syntax} }
char* lesstif_pcbmenu_path |
Definition at line 231 of file hid/lesstif/main.c.
Referenced by lesstif_menu().
int max_wflags = 0 [static] |
Definition at line 704 of file menu.c.
Referenced by note_widget_flag().
int n [static] |
Definition at line 41 of file menu.c.
Referenced by add_resource_to_menu(), callback(), insert_layerpick_buttons(), insert_layerview_buttons(), layerpick_button_callback(), LayersChanged(), lesstif_get_xy(), and show_one_layer_button().
int n_wflags = 0 [static] |
Definition at line 703 of file menu.c.
Referenced by lesstif_update_widget_flags(), and note_widget_flag().
int num_layer_buttons = 0 [static] |
Definition at line 202 of file menu.c.
Referenced by insert_layerpick_buttons(), insert_layerview_buttons(), layerpick_button_callback(), LayersChanged(), and show_one_layer_button().
const char return_help[] = "Simulate a passing or failing action." [static] |
const char return_syntax[] = "Return(0|1)" [static] |
const char selectlayer_help[] = "Select which layer is the current layer." [static] |
const char selectlayer_syntax[] = "SelectLayer(1..MAXLAYER|Silk|Rats)" [static] |
ToggleItem* toggle_items = 0 [static] |
Definition at line 780 of file menu.c.
Referenced by add_resource_to_menu().
const char toggleview_help[] = "Toggle the visibility of the specified layer or layer group." [static] |
const char toggleview_syntax[] = "ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)" [static] |
WidgetFlagType* wflags = 0 [static] |