pcb 4.1.1
An interactive printed circuit board layout editor.

gui-top-window.c File Reference

This handles creation of the top level window and all its widgets. More...

#include <unistd.h>
#include "ghid-layer-selector.h"
#include "ghid-route-style-selector.h"
#include "gtkhid.h"
#include "gui.h"
#include "hid.h"
#include "../hidint.h"
#include "hid/common/hid_resource.h"
#include "action.h"
#include "autoplace.h"
#include "autoroute.h"
#include "buffer.h"
#include "change.h"
#include "copy.h"
#include "create.h"
#include "crosshair.h"
#include "draw.h"
#include "error.h"
#include "file.h"
#include "find.h"
#include "gpcb-menu.h"
#include "insert.h"
#include "line.h"
#include "mymem.h"
#include "misc.h"
#include "move.h"
#include "pcb-printf.h"
#include "polygon.h"
#include "rats.h"
#include "remove.h"
#include "report.h"
#include "resource.h"
#include "rotate.h"
#include "rubberband.h"
#include "search.h"
#include "select.h"
#include "set.h"
#include "undo.h"
#include "vendor.h"
#include "free_atexit.h"
#include "gui-icons-mode-buttons.data"
#include "gui-icons-misc.data"
#include "gui-trackball.h"
Include dependency graph for gui-top-window.c:

Go to the source code of this file.

Data Structures

struct  ModeButton
 Mode buttons. More...

Defines

#define N_HOTKEY_ACTIONS   (sizeof (ghid_hotkey_actions) / sizeof (ghid_hotkey_actions[0]))

Functions

static GtkWidget * ghid_load_menus (void)
void menu_toggle_update_cb (GtkAction *act, const char *tflag, const char *aflag)
 Callback for ghid_main_menu_update_toggle_state ().
void ghid_update_toggle_flags ()
 sync the menu checkboxes with actual pcb state.
static void h_adjustment_changed_cb (GtkAdjustment *adj, GhidGui *g)
static void v_adjustment_changed_cb (GtkAdjustment *adj, GhidGui *g)
static gint top_window_configure_event_cb (GtkWidget *widget, GdkEventConfigure *ev, GHidPort *port)
static void info_bar_response_cb (GtkInfoBar *info_bar, gint response_id, GhidGui *_gui)
static void close_file_modified_externally_prompt (void)
static void show_file_modified_externally_prompt (void)
static bool check_externally_modified (void)
static gboolean top_window_enter_cb (GtkWidget *widget, GdkEvent *event, GHidPort *port)
static void ghid_menu_cb (GtkAction *action, const Resource *node)
 Menu action callback function.
void ghid_hotkey_cb (int which)
 Accelerator callback for accelerators gtk tries to hide from us.
static void update_board_mtime_from_disk (void)
void ghid_sync_with_new_layout (void)
 Sync toggle states that were saved with the layout and notify the config code to update Settings values it manages.
void ghid_notify_save_pcb (const char *filename, bool done)
void ghid_notify_filename_changed (void)
void layer_process (gchar **color_string, char **text, int *set, int i)
 Takes the index into the layers and produces the text string for the layer and if the layer is currently visible or not.
static void layer_selector_select_callback (GHidLayerSelector *ls, int layer, gpointer d)
 Callback for GHidLayerSelector layer selection.
static void layer_selector_rename_callback (GHidLayerSelector *ls, int layer_id, char *new_name, void *userdata)
 Callback for GHidLayerSelector layer renaming.
static void layer_selector_toggle_callback (GHidLayerSelector *ls, int layer, gpointer d)
 Callback for GHidLayerSelector layer toggling.
void ghid_install_accel_groups (GtkWindow *window, GhidGui *gui)
 Install menu bar and accelerator groups.
void ghid_remove_accel_groups (GtkWindow *window, GhidGui *gui)
 Remove menu bar and accelerator groups.
void ghid_window_set_name_label (gchar *name)
 Refreshes the window title bar and sets the PCB name to the window title bar or to a seperate label.
static void grid_units_button_cb (GtkWidget *widget, gpointer data)
static void absolute_label_size_req_cb (GtkWidget *widget, GtkRequisition *req, gpointer data)
 The two following callbacks are used to keep the absolute and relative cursor labels from growing and shrinking as you move the cursor around.
static void relative_label_size_req_cb (GtkWidget *widget, GtkRequisition *req, gpointer data)
static void make_cursor_position_labels (GtkWidget *hbox, GHidPort *port)
static void make_virtual_layer_buttons (GtkWidget *layer_selector)
 Add "virtual layers" to a layer selector.
const gchar * get_layer_color (gint layer)
 Callback for ghid_layer_selector_update_colors.
void ghid_layer_buttons_color_update (void)
 Update a layer selector's color scheme.
static void make_layer_buttons (GtkWidget *layersel)
 Populate a layer selector with all layers Gtk is aware of.
gboolean get_layer_delete (gint layer)
 Callback for ghid_layer_selector_delete_layers.
void ghid_layer_buttons_update (void)
 Synchronize layer selector widget with current PCB state.
static void route_styles_edited_cb (GHidRouteStyleSelector *rss, gboolean save, gpointer data)
 Called when user clicks OK on route style dialog.
static void route_style_changed_cb (GHidRouteStyleSelector *rss, RouteStyleType *rst, gpointer data)
 Called when a route style is selected.
void make_route_style_buttons (GHidRouteStyleSelector *rss)
 Configure the route style selector.
static void do_set_mode (int mode)
static void mode_toolbar_button_toggled_cb (GtkToggleButton *button, ModeButton *mb)
static void mode_button_toggled_cb (GtkWidget *widget, ModeButton *mb)
void ghid_mode_buttons_update (void)
void ghid_pack_mode_buttons (void)
static void make_mode_buttons_and_toolbar (GtkWidget **mode_frame, GtkWidget **mode_toolbar)
static gint delete_chart_cb (GtkWidget *widget, GdkEvent *event, GHidPort *port)
static void destroy_chart_cb (GtkWidget *widget, GHidPort *port)
static void get_widget_styles (GtkStyle **menu_bar_style, GtkStyle **tool_button_style, GtkStyle **tool_button_label_style)
static void do_fix_topbar_theming (void)
static void fix_topbar_theming (void)
 Attempt to produce a conststent style for our extra menu-bar items by copying aspects from the menu bar style set by the user's GTK theme.
static void ghid_build_pcb_top_window (void)
 Create the top_window contents.
void ghid_interface_input_signals_connect (void)
 Connect just the signals a g_main_loop() will need.
void ghid_interface_input_signals_disconnect (void)
 Disconnect just the signals a g_main_loop() will need.
void ghid_interface_set_sensitive (gboolean sensitive)
 We'll set the interface insensitive when a g_main_loop is running so the Gtk menus and buttons don't respond and interfere with the special entry the user needs to be doing.
static void ghid_init_icons (GHidPort *port)
 Initializes icon pixmap and also cursor bit maps.
void ghid_create_pcb_widgets (void)
static gboolean ghid_listener_cb (GIOChannel *source, GIOCondition condition, gpointer data)
static void ghid_create_listener (void)
 REGISTER_ATTRIBUTES (ghid_attribute_list)
void ghid_parse_arguments (int *argc, char ***argv)
 Create top level window for routines that will need top_window before ghid_create_pcb_widgets() is called.
void ghid_do_export (HID_Attr_Val *options)
static gboolean get_layer_visible_cb (int id)
 callback for.
gint LayersChanged (int argc, char **argv, Coord x, Coord y)
static int ToggleView (int argc, char **argv, Coord x, Coord y)
static int SelectLayer (int argc, char **argv, Coord x, Coord y)
 REGISTER_ACTIONS (gtk_topwindow_action_list)
char * get_menu_filename (void)
 Finds the gpcb-menu.res file.
static int AdjustStyle (int argc, char **argv, Coord x, Coord y)
static int EditLayerGroups (int argc, char **argv, Coord x, Coord y)

Variables

static bool ignore_layer_update
GhidGui _ghidgui
GhidGuighidgui = NULL
GHidPort ghid_port
GHidPortgport
static gchar * bg_image_file
struct {
   GtkAction *   action
   const Resource *   node
ghid_hotkey_actions [256]
static ModeButton mode_buttons []
static gint n_mode_buttons = G_N_ELEMENTS (mode_buttons)
static gulong button_press_handler
static gulong button_release_handler
static gulong scroll_event_handler
static gulong key_press_handler
static gulong key_release_handler
static int stdin_listen = 0
static char * pcbmenu_path = "gpcb-menu.res"
HID_Attribute ghid_attribute_list []
static const char toggleview_syntax []
static const char toggleview_help []
static const char selectlayer_syntax []
static const char selectlayer_help []
HID_Action gtk_topwindow_action_list []
static const char adjuststyle_syntax []
static const char adjuststyle_help []
static const char editlayergroups_syntax []
static const char editlayergroups_help []
HID_Action ghid_menu_action_list []

Detailed Description

This handles creation of the top level window and all its widgets.

Note:
Events for the Output.drawing_area widget are handled in a separate file gui-output-events.c

Some caveats with menu shorcut keys: Some keys are trapped out by Gtk and can't be used as shortcuts (eg. '|', TAB, etc). For these cases we have our own shortcut table and capture the keys and send the events there in ghid_port_key_press_cb().

Todo:
Figure out when we need to call this everytime ?
    ghid_set_status_line_label ();
Todo:
The old quit callback had:
    ghid_config_files_write ();
    hid_action ("Quit");
Todo:
What about stuff like this:
Set to ! because ActionDisplay toggles it
    Settings.DrawGrid = !gtk_toggle_action_get_active (action);
    ghidgui->config_modified = TRUE;
    hid_actionl ("Display", "Grid", "", NULL);
    ghid_set_status_line_label ();
 
Todo:
We need to do the status line thing. For example shift-alt-v to change the via size. Note: The status line label does not get updated properly until a zoom in/out.

Copyright.


PCB, interactive printed circuit board design

Copyright (C) 1994,1995,1996 Thomas Nau

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

This file was originally written by Bill Wilson for the PCB Gtk port. It was later heavily modified by Dan McMahill to provide user customized menus.

Definition in file gui-top-window.c.


Define Documentation

#define N_HOTKEY_ACTIONS   (sizeof (ghid_hotkey_actions) / sizeof (ghid_hotkey_actions[0]))

Definition at line 136 of file gui-top-window.c.

Referenced by ghid_load_menus(), and REGISTER_ACTIONS().


Function Documentation

static void absolute_label_size_req_cb ( GtkWidget *  widget,
GtkRequisition *  req,
gpointer  data 
) [static]

The two following callbacks are used to keep the absolute and relative cursor labels from growing and shrinking as you move the cursor around.

Definition at line 734 of file gui-top-window.c.

Referenced by make_cursor_position_labels().

static int AdjustStyle ( int  argc,
char **  argv,
Coord  x,
Coord  y 
) [static]

Definition at line 2261 of file gui-top-window.c.

References GHID_ROUTE_STYLE_SELECTOR, ghid_route_style_selector_edit_dialog(), and GhidGui::route_style_selector.

Here is the call graph for this function:

static bool check_externally_modified ( void  ) [static]

Definition at line 295 of file gui-top-window.c.

References PCBType::Filename, GhidGui::last_seen_mtime, GhidGui::our_mtime, and PCB.

Referenced by top_window_enter_cb().

static void close_file_modified_externally_prompt ( void  ) [static]
static gint delete_chart_cb ( GtkWidget *  widget,
GdkEvent *  event,
GHidPort port 
) [static]

Definition at line 1179 of file gui-top-window.c.

References ghid_config_files_write(), hid_action(), and TRUE.

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:

static void destroy_chart_cb ( GtkWidget *  widget,
GHidPort port 
) [static]

Definition at line 1192 of file gui-top-window.c.

References ghid_shutdown_renderer().

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:

static void do_fix_topbar_theming ( void  ) [static]
static void do_set_mode ( int  mode) [static]

Definition at line 1019 of file gui-top-window.c.

References ghid_mode_cursor(), SetMode(), and GhidGui::settings_mode.

Referenced by mode_button_toggled_cb(), and mode_toolbar_button_toggled_cb().

Here is the call graph for this function:

static int EditLayerGroups ( int  argc,
char **  argv,
Coord  x,
Coord  y 
) [static]

Definition at line 2286 of file gui-top-window.c.

References AFAIL, and hid_actionl().

Here is the call graph for this function:

static void fix_topbar_theming ( void  ) [static]

Attempt to produce a conststent style for our extra menu-bar items by copying aspects from the menu bar style set by the user's GTK theme.

Setup signal handlers to update our efforts if the user changes their theme whilst we are running.

Definition at line 1274 of file gui-top-window.c.

References do_fix_topbar_theming(), and GhidGui::top_bar_background.

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:

const gchar* get_layer_color ( gint  layer)

Callback for ghid_layer_selector_update_colors.

Definition at line 838 of file gui-top-window.c.

References layer_process().

Referenced by ghid_layer_buttons_color_update().

Here is the call graph for this function:

gboolean get_layer_delete ( gint  layer)

Callback for ghid_layer_selector_delete_layers.

Definition at line 880 of file gui-top-window.c.

References max_copper_layer.

Referenced by ghid_layer_buttons_update().

static gboolean get_layer_visible_cb ( int  id) [static]

callback for.

Definition at line 1901 of file gui-top-window.c.

References layer_process().

Referenced by LayersChanged().

Here is the call graph for this function:

char* get_menu_filename ( void  )

Finds the gpcb-menu.res file.

Definition at line 2147 of file gui-top-window.c.

References _, Concat(), homedir, Message(), pcbmenu_path, and R_OK.

Referenced by ghid_load_menus().

Here is the call graph for this function:

static void get_widget_styles ( GtkStyle **  menu_bar_style,
GtkStyle **  tool_button_style,
GtkStyle **  tool_button_label_style 
) [static]

Definition at line 1199 of file gui-top-window.c.

References GhidGui::menu_bar, and GhidGui::mode_toolbar.

Referenced by do_fix_topbar_theming().

static void ghid_build_pcb_top_window ( void  ) [static]

Create the top_window contents.

The config settings should be loaded before this is called.

Definition at line 1293 of file gui-top-window.c.

References GhidGui::creating, delete_chart_cb(), destroy_chart_cb(), GHidPort::drawing_area, FALSE, fix_topbar_theming(), ghid_drawing_area_expose_cb(), ghid_init_drawing_widget(), ghid_interface_input_signals_connect(), ghid_layer_selector_new(), ghid_load_menus(), ghid_pack_mode_buttons(), ghid_port, ghid_port_drawing_area_configure_event_cb(), ghid_port_drawing_realize_cb(), ghid_port_rotate(), ghid_port_window_enter_cb(), ghid_port_window_leave_cb(), ghid_port_window_motion_cb(), GHID_ROUTE_STYLE_SELECTOR, ghid_route_style_selector_new(), ghid_scrolled_vbox(), ghid_trackball_new(), ghid_view_2d(), GhidGui::h_adjustment, h_adjustment_changed_cb(), GhidGui::h_range, GhidGui::layer_selector, layer_selector_rename_callback(), layer_selector_select_callback(), layer_selector_toggle_callback(), GhidGui::left_toolbar, make_cursor_position_labels(), make_layer_buttons(), make_mode_buttons_and_toolbar(), make_route_style_buttons(), make_virtual_layer_buttons(), GhidGui::menu_bar, GhidGui::menu_hbox, GhidGui::menubar_toolbar_vbox, GhidGui::mode_buttons_frame, GhidGui::mode_toolbar, GhidGui::position_hbox, GhidGui::route_style_selector, GhidGui::status_line_hbox, GhidGui::status_line_label, GHidPort::tooltip_update_timeout_id, GhidGui::top_bar_background, GhidGui::top_hbox, GHidPort::top_window, top_window_configure_event_cb(), top_window_enter_cb(), trackball(), TRUE, GhidGui::v_adjustment, v_adjustment_changed_cb(), GhidGui::v_range, GhidGui::vbox_middle, and window.

Referenced by ghid_create_pcb_widgets().

Here is the call graph for this function:

static void ghid_create_listener ( void  ) [static]

Definition at line 1730 of file gui-top-window.c.

References ghid_listener_cb().

Referenced by ghid_do_export().

Here is the call graph for this function:

void ghid_create_pcb_widgets ( void  )
void ghid_hotkey_cb ( int  which)

Accelerator callback for accelerators gtk tries to hide from us.

Definition at line 387 of file gui-top-window.c.

References action, ghid_hotkey_actions, ghid_menu_cb(), and node.

Referenced by ghid_port_key_press_cb().

Here is the call graph for this function:

static void ghid_init_icons ( GHidPort port) [static]

Initializes icon pixmap and also cursor bit maps.

Definition at line 1621 of file gui-top-window.c.

References GHidPort::top_window, window, XC_clock_mask, XC_clock_source, XC_hand_mask, XC_hand_source, XC_lock_mask, and XC_lock_source.

Referenced by ghid_create_pcb_widgets().

void ghid_interface_input_signals_connect ( void  )

Connect just the signals a g_main_loop() will need.

Cursor and motion events still need to be handled by the top level loop, so don't connect/reconnect these. A g_main_loop will be running when PCB wants the user to select a location or if command entry is needed in the status line hbox. During these times normal button/key presses are intercepted, either by new signal handlers or the command_combo_box entry.

Definition at line 1545 of file gui-top-window.c.

References button_press_handler, button_release_handler, GHidPort::drawing_area, ghid_port_button_press_cb(), ghid_port_button_release_cb(), ghid_port_key_press_cb(), ghid_port_key_release_cb(), ghid_port_window_mouse_scroll_cb(), key_press_handler, key_release_handler, and scroll_event_handler.

Referenced by ghid_build_pcb_top_window(), ghid_command_entry_get(), and run_get_location_loop().

Here is the call graph for this function:

void ghid_interface_input_signals_disconnect ( void  )

Disconnect just the signals a g_main_loop() will need.

Cursor and motion events still need to be handled by the top level loop, so don't disconnect these. A g_main_loop will be running when PCB wants the user to select a location or if command entry is needed in the status line hbox. During these times normal button/key presses are intercepted, either by new signal handlers or the command_combo_box entry.

Definition at line 1579 of file gui-top-window.c.

References button_press_handler, button_release_handler, GHidPort::drawing_area, key_press_handler, key_release_handler, and scroll_event_handler.

Referenced by ghid_command_entry_get(), and run_get_location_loop().

void ghid_interface_set_sensitive ( gboolean  sensitive)

We'll set the interface insensitive when a g_main_loop is running so the Gtk menus and buttons don't respond and interfere with the special entry the user needs to be doing.

Definition at line 1610 of file gui-top-window.c.

References GhidGui::left_toolbar, and GhidGui::menu_hbox.

Referenced by ghid_command_entry_get(), and run_get_location_loop().

void ghid_layer_buttons_color_update ( void  )

Update a layer selector's color scheme.

Definition at line 849 of file gui-top-window.c.

References get_layer_color(), GHID_LAYER_SELECTOR, ghid_layer_selector_update_colors(), GhidGui::layer_selector, PCB, and pcb_colors_from_settings().

Referenced by config_color_defaults_cb(), config_color_load_cb(), and config_color_set_cb().

Here is the call graph for this function:

void ghid_layer_buttons_update ( void  )

Synchronize layer selector widget with current PCB state.

Called when user toggles layer visibility or changes drawing layer, or when layer visibility is changed programatically.

Definition at line 892 of file gui-top-window.c.

References get_layer_delete(), GHID_LAYER_SELECTOR, ghid_layer_selector_delete_layers(), ghid_layer_selector_select_layer(), GHID_MAIN_MENU, ghid_main_menu_install_layer_selector(), ignore_layer_update, layer, LAYER_BUTTON_RATS, LAYER_BUTTON_SILK, GhidGui::layer_selector, LayerStack, make_layer_buttons(), make_virtual_layer_buttons(), GhidGui::menu_bar, PCB, PCBType::RatDraw, and PCBType::SilkActive.

Referenced by config_layers_apply(), ghid_do_export(), layer_name_entry_cb(), layer_selector_rename_callback(), and LayersChanged().

Here is the call graph for this function:

static gboolean ghid_listener_cb ( GIOChannel *  source,
GIOCondition  condition,
gpointer  data 
) [static]

Definition at line 1673 of file gui-top-window.c.

References _, FALSE, gui, hid_parse_actions(), len, hid_st::log, status(), and TRUE.

Referenced by ghid_create_listener().

Here is the call graph for this function:

static void ghid_menu_cb ( GtkAction *  action,
const Resource node 
) [static]

Menu action callback function.

This is the main menu callback function. The callback receives the original Resource pointer containing the HID actions to be executed.

All hotkeys go through the menus which means they go through here. Some, such as tab, are caught by Gtk instead of passed here, so pcb calls this function directly through ghid_hotkey_cb() for them.

Parameters:
[in]Theaction that was activated.
[in]Themenu resource associated with the action.

Definition at line 356 of file gui-top-window.c.

References AdjustAttachedObjects(), Resource::c, ghid_invalidate_all(), ghid_mode_buttons_update(), ghid_set_status_line_label(), ghid_update_toggle_flags(), ghid_window_set_name_label(), hid_parse_actions(), PCBType::Name, PCB, resource_type, Resource::v, and ResourceVal::value.

Referenced by ghid_hotkey_cb(), and ghid_load_menus().

Here is the call graph for this function:

void ghid_notify_filename_changed ( void  )

Definition at line 455 of file gui-top-window.c.

References update_board_mtime_from_disk().

Referenced by REGISTER_FLAGS().

Here is the call graph for this function:

void ghid_notify_save_pcb ( const char *  filename,
bool  done 
)

Definition at line 443 of file gui-top-window.c.

References PCBType::Filename, PCB, and update_board_mtime_from_disk().

Referenced by REGISTER_FLAGS().

Here is the call graph for this function:

void ghid_pack_mode_buttons ( void  )
void ghid_parse_arguments ( int *  argc,
char ***  argv 
)
void ghid_remove_accel_groups ( GtkWindow *  window,
GhidGui gui 
)
void ghid_sync_with_new_layout ( void  )

Sync toggle states that were saved with the layout and notify the config code to update Settings values it manages.

Definition at line 427 of file gui-top-window.c.

References close_file_modified_externally_prompt(), ghid_config_handle_units_changed(), GHID_ROUTE_STYLE_SELECTOR, ghid_route_style_selector_select_style(), ghid_set_status_line_label(), ghid_window_set_name_label(), PCBType::Name, PCB, pcb_use_route_style(), GhidGui::route_style_selector, PCBType::RouteStyle, and update_board_mtime_from_disk().

Referenced by PCBChanged().

Here is the call graph for this function:

void ghid_update_toggle_flags ( void  )

sync the menu checkboxes with actual pcb state.

Definition at line 162 of file gui-top-window.c.

References GHID_MAIN_MENU, ghid_main_menu_update_toggle_state(), GhidGui::menu_bar, and menu_toggle_update_cb().

Referenced by ghid_create_pcb_widgets(), ghid_idle_cb(), and ghid_menu_cb().

Here is the call graph for this function:

void ghid_window_set_name_label ( gchar *  name)

Refreshes the window title bar and sets the PCB name to the window title bar or to a seperate label.

Definition at line 692 of file gui-top-window.c.

References _, PCBType::Changed, dup_string(), PCBType::Filename, filename, GhidGui::name_label_string, PCB, and GHidPort::top_window.

Referenced by ghid_handle_user_command(), ghid_menu_cb(), ghid_port_button_press_cb(), ghid_port_button_release_cb(), ghid_sync_with_new_layout(), layer_selector_rename_callback(), and PCBChanged().

Here is the call graph for this function:

static void grid_units_button_cb ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 719 of file gui-top-window.c.

References get_unit_struct(), SettingType::grid_unit, hid_actionl(), and Settings.

Referenced by make_cursor_position_labels().

Here is the call graph for this function:

static void h_adjustment_changed_cb ( GtkAdjustment *  adj,
GhidGui g 
) [static]

Definition at line 169 of file gui-top-window.c.

References GhidGui::adjustment_changed_holdoff, and ghid_port_ranges_changed().

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:

static void info_bar_response_cb ( GtkInfoBar *  info_bar,
gint  response_id,
GhidGui _gui 
) [static]

Definition at line 210 of file gui-top-window.c.

References GhidGui::info_bar, and RevertPCB().

Referenced by show_file_modified_externally_prompt().

Here is the call graph for this function:

static void layer_selector_rename_callback ( GHidLayerSelector ls,
int  layer_id,
char *  new_name,
void *  userdata 
) [static]

Callback for GHidLayerSelector layer renaming.

Definition at line 563 of file gui-top-window.c.

References PCBType::Changed, ghid_layer_buttons_update(), ghid_window_set_name_label(), layer, LAYER_PTR, PCBType::Name, LayerType::Name, PCB, and SetChangedFlag().

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:

static void layer_selector_select_callback ( GHidLayerSelector ls,
int  layer,
gpointer  d 
) [static]

Callback for GHidLayerSelector layer selection.

Definition at line 535 of file gui-top-window.c.

References ChangeGroupVisibility(), PCBType::ElementOn, ghid_invalidate_all(), hid_action(), ignore_layer_update, LAYER_BUTTON_RATS, LAYER_BUTTON_SILK, max_copper_layer, PCB, PCBType::RatDraw, PCBType::RatOn, PCBType::SilkActive, and TRUE.

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:

gint LayersChanged ( int  argc,
char **  argv,
Coord  x,
Coord  y 
)

Todo:
If a layer is moved it should retain its color. But layers currently can't do that because color info is not saved in the pcb file. So this makes a moved layer change its color to reflect the way it will be when the pcb is reloaded.

Definition at line 1909 of file gui-top-window.c.

References get_layer_visible_cb(), ghid_config_groups_changed(), ghid_layer_buttons_update(), GHID_LAYER_SELECTOR, ghid_layer_selector_show_layers(), GhidGui::layer_selector, GhidGui::menu_bar, PCB, and pcb_colors_from_settings().

Referenced by insert_layerpick_buttons(), and insert_layerview_buttons().

Here is the call graph for this function:

static void make_cursor_position_labels ( GtkWidget *  hbox,
GHidPort port 
) [static]
static void make_layer_buttons ( GtkWidget *  layersel) [static]

Populate a layer selector with all layers Gtk is aware of.

Definition at line 860 of file gui-top-window.c.

References GHID_LAYER_SELECTOR, ghid_layer_selector_add_layer(), layer_process(), max_copper_layer, and TRUE.

Referenced by ghid_build_pcb_top_window(), and ghid_layer_buttons_update().

Here is the call graph for this function:

static void make_mode_buttons_and_toolbar ( GtkWidget **  mode_frame,
GtkWidget **  mode_toolbar 
) [static]
static void make_virtual_layer_buttons ( GtkWidget *  layer_selector) [static]

Add "virtual layers" to a layer selector.

Definition at line 807 of file gui-top-window.c.

References FALSE, GHID_LAYER_SELECTOR, ghid_layer_selector_add_layer(), LAYER_BUTTON_FARSIDE, LAYER_BUTTON_MASK, LAYER_BUTTON_PINS, LAYER_BUTTON_RATS, LAYER_BUTTON_SILK, LAYER_BUTTON_VIAS, layer_process(), and TRUE.

Referenced by ghid_build_pcb_top_window(), and ghid_layer_buttons_update().

Here is the call graph for this function:

void menu_toggle_update_cb ( GtkAction *  act,
const char *  tflag,
const char *  aflag 
)

Callback for ghid_main_menu_update_toggle_state ().

Definition at line 144 of file gui-top-window.c.

References hid_get_flag().

Referenced by ghid_update_toggle_flags().

Here is the call graph for this function:

static void mode_button_toggled_cb ( GtkWidget *  widget,
ModeButton mb 
) [static]

Definition at line 1043 of file gui-top-window.c.

References do_set_mode(), ModeButton::mode, ModeButton::toolbar_button, and ModeButton::toolbar_button_cb_id.

Referenced by make_mode_buttons_and_toolbar().

Here is the call graph for this function:

static void mode_toolbar_button_toggled_cb ( GtkToggleButton *  button,
ModeButton mb 
) [static]

Definition at line 1027 of file gui-top-window.c.

References ModeButton::button, ModeButton::button_cb_id, do_set_mode(), and ModeButton::mode.

Referenced by make_mode_buttons_and_toolbar().

Here is the call graph for this function:

REGISTER_ATTRIBUTES ( ghid_attribute_list  )

Definition at line 1783 of file gui-top-window.c.

References ghid_attribute_list.

static void relative_label_size_req_cb ( GtkWidget *  widget,
GtkRequisition *  req,
gpointer  data 
) [static]

Definition at line 746 of file gui-top-window.c.

Referenced by make_cursor_position_labels().

static void route_style_changed_cb ( GHidRouteStyleSelector rss,
RouteStyleType rst,
gpointer  data 
) [static]

Called when a route style is selected.

Definition at line 943 of file gui-top-window.c.

References ghid_set_status_line_label(), and pcb_use_route_style().

Referenced by make_route_style_buttons().

Here is the call graph for this function:

static void route_styles_edited_cb ( GHidRouteStyleSelector rss,
gboolean  save,
gpointer  data 
) [static]
static int SelectLayer ( int  argc,
char **  argv,
Coord  x,
Coord  y 
) [static]
static void show_file_modified_externally_prompt ( void  ) [static]

Definition at line 230 of file gui-top-window.c.

References _, PCBType::Changed, close_file_modified_externally_prompt(), FALSE, PCBType::Filename, GhidGui::info_bar, info_bar_response_cb(), PCB, TRUE, and GhidGui::vbox_middle.

Referenced by top_window_enter_cb().

Here is the call graph for this function:

static int ToggleView ( int  argc,
char **  argv,
Coord  x,
Coord  y 
) [static]
static gint top_window_configure_event_cb ( GtkWidget *  widget,
GdkEventConfigure *  ev,
GHidPort port 
) [static]
static gboolean top_window_enter_cb ( GtkWidget *  widget,
GdkEvent *  event,
GHidPort port 
) [static]

Definition at line 332 of file gui-top-window.c.

References check_externally_modified(), FALSE, and show_file_modified_externally_prompt().

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:

static void update_board_mtime_from_disk ( void  ) [static]
static void v_adjustment_changed_cb ( GtkAdjustment *  adj,
GhidGui g 
) [static]

Definition at line 178 of file gui-top-window.c.

References GhidGui::adjustment_changed_holdoff, and ghid_port_ranges_changed().

Referenced by ghid_build_pcb_top_window().

Here is the call graph for this function:


Variable Documentation

Definition at line 128 of file gui-top-window.c.

Referenced by ghid_config_files_read().

const char adjuststyle_help[] [static]
Initial value:
    N_("Open the window which allows editing of the route styles.")

Definition at line 2251 of file gui-top-window.c.

const char adjuststyle_syntax[] [static]
Initial value:
    N_("AdjustStyle()\n")

Definition at line 2248 of file gui-top-window.c.

gchar* bg_image_file [static]

Definition at line 132 of file gui-top-window.c.

Referenced by ghid_create_pcb_widgets().

const char editlayergroups_help[] [static]
Initial value:
    N_("Open the preferences window which allows editing of the layer groups.")

Definition at line 2274 of file gui-top-window.c.

const char editlayergroups_syntax[] [static]
Initial value:
    N_("EditLayerGroups()\n")

Definition at line 2271 of file gui-top-window.c.

Initial value:
 {


  {"listen", N_("Listen for actions on stdin"),
   HID_Boolean, 0, 0, {0, 0, 0}, 0, &stdin_listen},
#define HA_listen 0


  {"bg-image", N_("Background Image"),
   HID_String, 0, 0, {0, 0, 0}, 0, &bg_image_file},
#define HA_bg_image 1


{"pcb-menu", N_("Location of gpcb-menu.res file"),
   HID_String, 0, 0, {0, PCBLIBDIR "/gpcb-menu.res", 0}, 0, &pcbmenu_path}
#define HA_pcbmenu 2
}

Definition at line 1745 of file gui-top-window.c.

Referenced by REGISTER_ATTRIBUTES().

struct { ... } ghid_hotkey_actions[256] [static]
Initial value:

Definition at line 2299 of file gui-top-window.c.

GhidGui * ghidgui = NULL

Definition at line 128 of file gui-top-window.c.

Referenced by command_combo_box_entry_create(), command_entry_activate_cb(), command_history_add(), command_window_disconnect_combobox(), config_backup_spin_button_cb(), config_color_defaults_cb(), config_color_load_cb(), config_color_save_cb(), config_command_window_toggle_cb(), config_compact_horizontal_toggle_cb(), config_compact_vertical_toggle_cb(), config_general_tab_create(), config_general_toggle_cb(), config_history_spin_button_cb(), config_layer_groups_radio_button_cb(), config_layers_apply(), config_library_apply(), config_sizes_apply(), coord_entry_cb(), draw_crosshair(), drc_window_configure_event_cb(), ghid_command_entry_get(), ghid_command_use_command_window_sync(), ghid_command_window_show(), ghid_config_files_read(), ghid_config_files_write(), ghid_config_handle_units_changed(), ghid_config_init(), ghid_control_is_pressed(), ghid_cursor_position_label_set_text(), ghid_cursor_position_relative_label_set_text(), ghid_draw_bg_image(), ghid_drc_window_show(), ghid_handle_user_command(), ghid_idle_cb(), ghid_keyref_window_show(), ghid_library_window_create(), ghid_log_window_create(), ghid_mod1_is_pressed(), ghid_netlist_window_create(), ghid_notify_gui_is_up(), ghid_port_ranges_changed(), ghid_port_ranges_scale(), ghid_port_window_enter_cb(), ghid_set_status_line_label(), ghid_shift_is_pressed(), ghid_status_line_set_text(), GhidNetlistChanged(), increment_spin_button_cb(), keyref_window_configure_event_cb(), layer_name_edited_cb(), layer_name_editing_canceled_cb(), layer_name_editing_started_cb(), library_window_configure_event_cb(), log_window_configure_event_cb(), netlist_window_configure_event_cb(), pan_common(), PanAction(), PCBChanged(), PointCursor(), Popup(), RouteStylesChanged(), ScrollAction(), and text_spin_button_cb().

Definition at line 130 of file gui-top-window.c.

Referenced by Benchmark(), Center(), CursorAction(), DoWindows(), draw_crosshair(), draw_dozen_cross(), draw_lead_user(), draw_right_cross(), draw_slanted_cross(), end_subcomposite(), flag_flipy(), ghid_cancel_lead_user(), ghid_command_entry_get(), ghid_corner_cursor(), ghid_draw_arc(), ghid_draw_bg_image(), ghid_draw_grid(), ghid_draw_line(), ghid_draw_rect(), ghid_drawing_area_expose_cb(), ghid_fill_circle(), ghid_fill_pcb_polygon(), ghid_fill_polygon(), ghid_fill_rect(), ghid_finish_debug_draw(), ghid_flip_view(), ghid_flush_debug_draw(), ghid_get_coords(), ghid_get_net_from_node_name(), ghid_get_pointer(), ghid_invalidate_all(), ghid_lead_user_to_location(), ghid_netlist_window_update(), ghid_note_event_location(), ghid_notify_crosshair_change(), ghid_notify_mark_change(), ghid_pan_view_abs(), ghid_pan_view_rel(), ghid_pinout_preview_constructed(), ghid_pinout_preview_expose(), ghid_port_button_press_cb(), ghid_port_drawing_area_configure_event_cb(), ghid_port_ranges_changed(), ghid_port_ranges_scale(), ghid_port_window_motion_cb(), ghid_render_pixmap(), ghid_request_debug_draw(), ghid_screen_update(), ghid_set_color(), ghid_set_crosshair(), ghid_set_layer(), ghid_set_line_cap(), ghid_set_line_width(), ghid_set_special_colors(), ghid_use_mask(), ghid_zoom_view_abs(), ghid_zoom_view_fit(), ghid_zoom_view_rel(), GhidNetlistPresent(), GhidNetlistShow(), gport_set_cursor(), layer_name_edited_cb(), layer_name_editing_canceled_cb(), layer_name_editing_started_cb(), make_progress_dialog(), node_get_node_from_name(), PanAction(), PCBChanged(), redraw_region(), REGISTER_ACTIONS(), row_activated_cb(), run_get_location_loop(), ScrollAction(), set_gl_color_for_gc(), set_special_grid_color(), start_subcomposite(), SwapSides(), and use_gc().

Initial value:

Definition at line 2048 of file gui-top-window.c.

Initial value:
 {
  {NULL, NULL, 0, 0, N_("via"), VIA_MODE, via,
    N_("create vias with <select mouse button>")},
  {NULL, NULL, 0, 0, N_("line"), LINE_MODE, line,
    N_("create a line segment, toggle draw modes with '/' or '.'")},
  {NULL, NULL, 0, 0, N_("arc"), ARC_MODE, arc,
    N_("create an arc segment")},
  {NULL, NULL, 0, 0, N_("text"), TEXT_MODE, text,
    N_("create a text")},
  {NULL, NULL, 0, 0, N_("rectangle"), RECTANGLE_MODE, rect,
    N_("create a filled rectangle")},
  {NULL, NULL, 0, 0, N_("polygon"), POLYGON_MODE, poly,
    N_("create a polygon, <shift>-P for closing the polygon")},
  {NULL, NULL, 0, 0, N_("polygonhole"), POLYGONHOLE_MODE, polyhole,
    N_("create a hole into an existing polygon")},
  {NULL, NULL, 0, 0, N_("buffer"), PASTEBUFFER_MODE, buf,
    N_("paste the selection from buffer into the layout")},
  {NULL, NULL, 0, 0, N_("remove"), REMOVE_MODE, del,
    N_("remove objects under the cursor")},
  {NULL, NULL, 0, 0, N_("rotate"), ROTATE_MODE, rot,
    N_("rotate a selection or object CCW, hold the <shift> key to rotate CW")},
  {NULL, NULL, 0, 0, N_("insertPoint"), INSERTPOINT_MODE, ins,
    N_("add points into existing lines and polygons")},
  {NULL, NULL, 0, 0, N_("thermal"), THERMAL_MODE, thrm,
    N_("create thermals with <select mouse button>, toggle thermal style with <Shift> <select mouse button>")},
  {NULL, NULL, 0, 0, N_("select"), ARROW_MODE, sel,
    N_("select, deselect or move objects or selections")},
  {NULL, NULL, 0, 0, N_("lock"), LOCK_MODE, lock,
    N_("lock or unlock an object")}
}

Definition at line 985 of file gui-top-window.c.

gint n_mode_buttons = G_N_ELEMENTS (mode_buttons) [static]

Definition at line 1016 of file gui-top-window.c.

Referenced by ghid_mode_buttons_update(), and make_mode_buttons_and_toolbar().

char* pcbmenu_path = "gpcb-menu.res" [static]

Definition at line 1743 of file gui-top-window.c.

Referenced by get_menu_filename().

const char selectlayer_help[] [static]
Initial value:
    N_("Select which layer is the current layer.")

Definition at line 2005 of file gui-top-window.c.

const char selectlayer_syntax[] [static]
Initial value:
    N_("SelectLayer(1..MAXLAYER|Silk|Rats)")

Definition at line 2002 of file gui-top-window.c.

int stdin_listen = 0 [static]

Definition at line 1742 of file gui-top-window.c.

Referenced by ghid_do_export().

const char toggleview_help[] [static]
Initial value:
    N_("Toggle the visibility of the specified layer or layer group.")

Definition at line 1933 of file gui-top-window.c.

const char toggleview_syntax[] [static]
Initial value:
    N_("ToggleView(1..MAXLAYER)\n"
       "ToggleView(layername)\n"
       "ToggleView(Silk|Rats|Pins|Vias|Mask|BackSide)")

Definition at line 1928 of file gui-top-window.c.