pcb 4.1.1
An interactive printed circuit board layout editor.

ghid-route-style-selector.c File Reference

#include <glib.h>
#include <glib-object.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "global.h"
#include "gtkhid.h"
#include "gui.h"
#include "pcb-printf.h"
#include "ghid-route-style-selector.h"
Include dependency graph for ghid-route-style-selector.c:

Go to the source code of this file.

Data Structures

struct  _GHidRouteStyleSelector
struct  _GHidRouteStyleSelectorClass
struct  _route_style
struct  _dialog

Enumerations

enum  { SELECT_STYLE_SIGNAL, STYLE_EDITED_SIGNAL, LAST_SIGNAL }
 

Signals exposed by the widget.

More...
enum  { TEXT_COL, DATA_COL, N_COLS }
 

Columns used for internal data store.

More...

Functions

struct _route_styleghid_route_style_selector_real_add_route_style (GHidRouteStyleSelector *rss, RouteStyleType *data, gboolean temp)
 Create a new GHidRouteStyleSelector.
static void ghid_route_style_selector_finalize (GObject *object)
 Clean up object before garbage collection.
static void init_radio_groups (GHidRouteStyleSelector *rss)
static void radio_select_cb (GtkToggleAction *action, GHidRouteStyleSelector *rss)
 Callback for user selection of a route style.
static void dialog_style_changed_cb (GtkComboBox *combo, struct _dialog *dialog)
 Callback for dialog box's combobox being changed.
static void _table_attach (GtkWidget *table, gint row, const gchar *label, GtkWidget **entry, Coord min, Coord max)
void ghid_route_style_selector_edit_dialog (GHidRouteStyleSelector *rss)
static void edit_button_cb (GtkButton *btn, GHidRouteStyleSelector *rss)
static void ghid_route_style_selector_init (GHidRouteStyleSelector *rss)
static void ghid_route_style_selector_class_init (GHidRouteStyleSelectorClass *klass)
GType ghid_route_style_selector_get_type (void)
GtkWidget * ghid_route_style_selector_new ()
 Create a new GHidRouteStyleSelector.
void ghid_route_style_selector_add_route_style (GHidRouteStyleSelector *rss, RouteStyleType *data)
 Adds a route style to a GHidRouteStyleSelector.
gint ghid_route_style_selector_install_items (GHidRouteStyleSelector *rss, GtkMenuShell *shell, gint pos)
 Install the "Route Style" menu items.
gboolean ghid_route_style_selector_select_style (GHidRouteStyleSelector *rss, RouteStyleType *rst)
 Selects a route style and emits a select-style signal.
GtkAccelGroup * ghid_route_style_selector_get_accel_group (GHidRouteStyleSelector *rss)
 Returns the GtkAccelGroup of a route style selector.
void ghid_route_style_selector_sync (GHidRouteStyleSelector *rss, Coord Thick, Coord Hole, Coord Diameter, Coord Keepaway)
 Sets a GHidRouteStyleSelector selection to given values.
void ghid_route_style_selector_empty (GHidRouteStyleSelector *rss)
 Removes all styles from a route style selector.

Variables

static gint action_count
 Global action creation counter.
static GtkVBox * ghid_route_style_selector_parent_class
static guint ghid_route_style_selector_signals [LAST_SIGNAL] = { 0 }

Enumeration Type Documentation

anonymous enum

Signals exposed by the widget.

Enumerator:
SELECT_STYLE_SIGNAL 
STYLE_EDITED_SIGNAL 
LAST_SIGNAL 

Definition at line 29 of file ghid-route-style-selector.c.

anonymous enum

Columns used for internal data store.

Enumerator:
TEXT_COL 
DATA_COL 
N_COLS 

Definition at line 36 of file ghid-route-style-selector.c.


Function Documentation

static void _table_attach ( GtkWidget *  table,
gint  row,
const gchar *  label,
GtkWidget **  entry,
Coord  min,
Coord  max 
) [static]

Definition at line 155 of file ghid-route-style-selector.c.

References CE_SMALL, ghid_coord_entry_new(), SettingType::grid_unit, and Settings.

Referenced by ghid_route_style_selector_edit_dialog().

Here is the call graph for this function:

static void dialog_style_changed_cb ( GtkComboBox *  combo,
struct _dialog dialog 
) [static]

Callback for dialog box's combobox being changed.

Function Description
When a different layer is selected, this function loads that layer's data into the dialog. Alternately, if the "New layer" option is selected, this loads a new name but no other data.
Parameters:
[in]comboThe combobox
[in]dialogThe rest of the widgets to be updated

Definition at line 126 of file ghid-route-style-selector.c.

References _, _dialog::clearance_entry, DATA_COL, RouteStyleType::Diameter, GHID_COORD_ENTRY, ghid_coord_entry_set_value(), RouteStyleType::Hole, RouteStyleType::Keepaway, _dialog::line_entry, _GHidRouteStyleSelector::model, RouteStyleType::Name, _dialog::name_entry, _dialog::rss, _route_style::rst, style, RouteStyleType::Thick, _dialog::via_hole_entry, and _dialog::via_size_entry.

Referenced by ghid_route_style_selector_edit_dialog().

Here is the call graph for this function:

static void edit_button_cb ( GtkButton *  btn,
GHidRouteStyleSelector rss 
) [static]

Definition at line 308 of file ghid-route-style-selector.c.

References ghid_route_style_selector_edit_dialog().

Referenced by ghid_route_style_selector_new().

Here is the call graph for this function:

void ghid_route_style_selector_add_route_style ( GHidRouteStyleSelector rss,
RouteStyleType data 
)

Adds a route style to a GHidRouteStyleSelector.

Function Description
Adds a new route style to be managed by this selector. Note that the route style object passed to this function will be updated directly.
Parameters:
[in]rssThe selector to be acted on
[in]dataPCB's route style object describing the style

Definition at line 497 of file ghid-route-style-selector.c.

References FALSE, and ghid_route_style_selector_real_add_route_style().

Referenced by make_route_style_buttons().

Here is the call graph for this function:

static void ghid_route_style_selector_class_init ( GHidRouteStyleSelectorClass klass) [static]
static void ghid_route_style_selector_finalize ( GObject *  object) [static]

Clean up object before garbage collection.

Definition at line 349 of file ghid-route-style-selector.c.

References _GHidRouteStyleSelector::accel_group, _GHidRouteStyleSelector::action_group, ghid_route_style_selector_empty(), and ghid_route_style_selector_parent_class.

Referenced by ghid_route_style_selector_class_init().

Here is the call graph for this function:

GtkAccelGroup* ghid_route_style_selector_get_accel_group ( GHidRouteStyleSelector rss)

Returns the GtkAccelGroup of a route style selector.

Function Description
Parameters:
[in]rssThe selector to be acted on
Returns:
the accel group of the selector

Definition at line 586 of file ghid-route-style-selector.c.

References _GHidRouteStyleSelector::accel_group.

Referenced by ghid_install_accel_groups(), and ghid_remove_accel_groups().

GType ghid_route_style_selector_get_type ( void  )

Definition at line 363 of file ghid-route-style-selector.c.

References ghid_route_style_selector_class_init(), and ghid_route_style_selector_init().

Here is the call graph for this function:

static void ghid_route_style_selector_init ( GHidRouteStyleSelector rss) [static]

Definition at line 315 of file ghid-route-style-selector.c.

Referenced by ghid_route_style_selector_get_type().

gint ghid_route_style_selector_install_items ( GHidRouteStyleSelector rss,
GtkMenuShell *  shell,
gint  pos 
)

Install the "Route Style" menu items.

Function Description
Takes a menu shell and installs menu items for route style selection in the shell, at the given position. Note that we aren't really guaranteed the ordering of these items, since our internal data structure is a hash table. This shouldn't be a problem.
Parameters:
[in]rssThe selector to be acted on
[in]shellThe menu to install the items in
[in]posThe position in the menu to install items
Returns:
the number of items installed

Definition at line 518 of file ghid-route-style-selector.c.

References _route_style::action, action, DATA_COL, _route_style::menu_item, _GHidRouteStyleSelector::model, n, and style.

Referenced by ghid_main_menu_install_route_style_selector().

struct _route_style * ghid_route_style_selector_real_add_route_style ( GHidRouteStyleSelector rss,
RouteStyleType data,
gboolean  temp 
) [read]
gboolean ghid_route_style_selector_select_style ( GHidRouteStyleSelector rss,
RouteStyleType rst 
)

Selects a route style and emits a select-style signal.

Parameters:
[in]rssThe selector to be acted on
[in]rstThe style to select
Returns:
TRUE if a style was selected, FALSE otherwise

Definition at line 550 of file ghid-route-style-selector.c.

References _route_style::action, _GHidRouteStyleSelector::active_style, DATA_COL, FALSE, ghid_route_style_selector_signals, _GHidRouteStyleSelector::model, _route_style::rst, SELECT_STYLE_SIGNAL, _route_style::sig_id, style, and TRUE.

Referenced by ghid_route_style_selector_edit_dialog(), and ghid_sync_with_new_layout().

void ghid_route_style_selector_sync ( GHidRouteStyleSelector rss,
Coord  Thick,
Coord  Hole,
Coord  Diameter,
Coord  Keepaway 
)

Sets a GHidRouteStyleSelector selection to given values.

Function Description
Given the line thickness, via size and clearance values of a route style, this function selects a route style with the given values. If there is no such style registered with the selector, nothing will happen. This function does not emit any signals.
Parameters:
[in]rssThe selector to be acted on
[in]ThickCoord to match selection to
[in]HoleCoord to match selection to
[in]DiameterCoord to match selection to
[in]KeepawayCoord to match selection to

Definition at line 605 of file ghid-route-style-selector.c.

References _route_style::action, _GHidRouteStyleSelector::active_style, DATA_COL, RouteStyleType::Diameter, FALSE, RouteStyleType::Hole, RouteStyleType::Keepaway, _GHidRouteStyleSelector::model, _GHidRouteStyleSelector::null_action, _route_style::rst, _route_style::sig_id, style, RouteStyleType::Thick, and TRUE.

Referenced by RouteStylesChanged().

static void radio_select_cb ( GtkToggleAction *  action,
GHidRouteStyleSelector rss 
) [static]

Variable Documentation

gint action_count [static]

Global action creation counter.

Definition at line 26 of file ghid-route-style-selector.c.

Referenced by ghid_route_style_selector_real_add_route_style(), and load_mouse_resource().