pcb 4.1.1
An interactive printed circuit board layout editor.

ghid-layer-selector.h File Reference

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
Include dependency graph for ghid-layer-selector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define GHID_LAYER_SELECTOR_TYPE   (ghid_layer_selector_get_type ())
#define GHID_LAYER_SELECTOR(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_LAYER_SELECTOR_TYPE, GHidLayerSelector))
#define GHID_LAYER_SELECTOR_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_LAYER_SELECTOR_TYPE, GHidLayerSelectorClass))
#define IS_GHID_LAYER_SELECTOR(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_LAYER_SELECTOR_TYPE))
#define IS_GHID_LAYER_SELECTOR_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_LAYER_SELECTOR_TYPE))

Typedefs

typedef struct _GHidLayerSelector GHidLayerSelector
typedef struct
_GHidLayerSelectorClass 
GHidLayerSelectorClass

Functions

GType ghid_layer_selector_get_type (void)
GtkWidget * ghid_layer_selector_new (void)
 Create a new GHidLayerSelector.
void ghid_layer_selector_add_layer (GHidLayerSelector *ls, gint user_id, const gchar *name, const gchar *color_string, gboolean visible, gboolean selectable, gboolean renameable)
 Add a layer to a GHidLayerSelector.
gint ghid_layer_selector_install_pick_items (GHidLayerSelector *ls, GtkMenuShell *shell, gint pos)
 Install the "Current Layer" menu items for a layer selector.
gint ghid_layer_selector_install_view_items (GHidLayerSelector *ls, GtkMenuShell *shell, gint pos)
 Install the "Shown Layers" menu items for a layer selector.
GtkAccelGroup * ghid_layer_selector_get_accel_group (GHidLayerSelector *ls)
 Returns the GtkAccelGroup of a layer selector.
void ghid_layer_selector_toggle_layer (GHidLayerSelector *ls, gint user_id)
 Toggle a layer's visibility.
void ghid_layer_selector_select_layer (GHidLayerSelector *ls, gint user_id)
 Select a layer.
gboolean ghid_layer_selector_select_next_visible (GHidLayerSelector *ls)
 Selects the next visible layer.
void ghid_layer_selector_make_selected_visible (GHidLayerSelector *ls)
 Makes the selected layer visible.
void ghid_layer_selector_update_colors (GHidLayerSelector *ls, const gchar *(*callback)(int user_id))
 Sets the colors of all layers in a layer-selector.
void ghid_layer_selector_delete_layers (GHidLayerSelector *ls, gboolean(*callback)(int user_id))
 Deletes layers from a layer selector.
void ghid_layer_selector_show_layers (GHidLayerSelector *ls, gboolean(*callback)(int user_id))
 Sets the visibility toggle-state of all layers.

Define Documentation

#define GHID_LAYER_SELECTOR (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_LAYER_SELECTOR_TYPE, GHidLayerSelector))
#define GHID_LAYER_SELECTOR_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_LAYER_SELECTOR_TYPE, GHidLayerSelectorClass))

Definition at line 12 of file ghid-layer-selector.h.

#define GHID_LAYER_SELECTOR_TYPE   (ghid_layer_selector_get_type ())

Definition at line 10 of file ghid-layer-selector.h.

Referenced by ghid_layer_selector_new().

#define IS_GHID_LAYER_SELECTOR (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_LAYER_SELECTOR_TYPE))

Definition at line 13 of file ghid-layer-selector.h.

#define IS_GHID_LAYER_SELECTOR_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_LAYER_SELECTOR_TYPE))

Definition at line 14 of file ghid-layer-selector.h.


Typedef Documentation

Definition at line 16 of file ghid-layer-selector.h.

Definition at line 17 of file ghid-layer-selector.h.


Function Documentation

void ghid_layer_selector_add_layer ( GHidLayerSelector ls,
gint  user_id,
const gchar *  name,
const gchar *  color_string,
gboolean  visible,
gboolean  selectable,
gboolean  renameable 
)

Add a layer to a GHidLayerSelector.

Function Description
This function adds an entry to a GHidLayerSelector, which will appear in the layer-selection list as well as visibility and selection menus (assuming this is a selectable layer). For the first 20 layers, keyboard accelerators will be added for selection/visibility toggling.

If the user_id passed already exists in the layer selector, that layer will have its data overwritten with the new stuff.

Parameters:
[in]lsThe selector to be acted on
[in]user_idAn ID used to identify the layer; will be passed to selection/visibility callbacks
[in]nameThe name of the layer; will be used on selector and menus
[in]color_stringThe color of the layer on selector
[in]visibileWhether the layer is visible
[in]selectableWhether the layer appears in menus and can be selected
[in]renameableWhether the layer is renameable

Definition at line 582 of file ghid-layer-selector.c.

References _GHidLayerSelector::accel_available, _GHidLayerSelector::accel_group, _layer::accel_index, action, _GHidLayerSelector::action_group, COLOR_COL, EDITABLE_COL, FALSE, FONT_COL, free_ldata(), _GHidLayerSelector::list_store, menu_pick_cb(), menu_view_cb(), _GHidLayerSelector::n_actions, _layer::pick_action, _layer::pick_item, _GHidLayerSelector::radio_group, _layer::rref, SELECTABLE_COL, SEPARATOR_COL, STRUCT_COL, TEXT_COL, TRUE, USER_ID_COL, _layer::view_action, _layer::view_item, and VISIBLE_COL.

Referenced by make_layer_buttons(), and make_virtual_layer_buttons().

Here is the call graph for this function:

void ghid_layer_selector_delete_layers ( GHidLayerSelector ls,
gboolean(*)(int user_id)  callback 
)

Deletes layers from a layer selector.

Function Description
Deletes layers according to a callback function: a return value of TRUE means delete, FALSE means leave it alone. Do not try to delete all layers using this function; with nothing left to select, pcb will likely go into an infinite recursion between hid_action() and g_signal().

Separators will be deleted if the layer AFTER them is deleted.

Parameters:
[in]lsThe selector to be acted on
[in]callbackTakes the user_id of the layer and returns a boolean

Definition at line 1022 of file ghid-layer-selector.c.

References callback(), FALSE, free_ldata(), _GHidLayerSelector::list_store, SEPARATOR_COL, STRUCT_COL, and USER_ID_COL.

Referenced by ghid_layer_buttons_update().

Here is the call graph for this function:

GtkAccelGroup* ghid_layer_selector_get_accel_group ( GHidLayerSelector ls)

Returns the GtkAccelGroup of a layer selector.

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

Definition at line 820 of file ghid-layer-selector.c.

References _GHidLayerSelector::accel_group.

Referenced by ghid_install_accel_groups(), and ghid_remove_accel_groups().

GType ghid_layer_selector_get_type ( void  )

Definition at line 525 of file ghid-layer-selector.c.

References ghid_layer_selector_class_init(), and ghid_layer_selector_init().

Here is the call graph for this function:

gint ghid_layer_selector_install_pick_items ( GHidLayerSelector ls,
GtkMenuShell *  shell,
gint  pos 
)

Install the "Current Layer" menu items for a layer selector.

Function Description
Takes a menu shell and installs menu items for layer selection in the shell, at the given position.
Parameters:
[in]lsThe 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 750 of file ghid-layer-selector.c.

References action, _GHidLayerSelector::list_store, n, _layer::pick_action, _layer::pick_item, and STRUCT_COL.

Referenced by ghid_main_menu_install_layer_selector().

gint ghid_layer_selector_install_view_items ( GHidLayerSelector ls,
GtkMenuShell *  shell,
gint  pos 
)

Install the "Shown Layers" menu items for a layer selector.

Function Description
Takes a menu shell and installs menu items for layer selection in the shell, at the given position.
Parameters:
[in]lsThe 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 787 of file ghid-layer-selector.c.

References action, _GHidLayerSelector::list_store, n, STRUCT_COL, _layer::view_action, and _layer::view_item.

Referenced by ghid_main_menu_install_layer_selector().

void ghid_layer_selector_make_selected_visible ( GHidLayerSelector ls)

Makes the selected layer visible.

Function Description
Used to ensure hidden layers are not active; un-hides the currently selected layer.
Parameters:
[in]lsThe selector to be acted on

Definition at line 967 of file ghid-layer-selector.c.

References FALSE, _GHidLayerSelector::list_store, _GHidLayerSelector::selection, toggle_visibility(), and VISIBLE_COL.

Here is the call graph for this function:

GtkWidget* ghid_layer_selector_new ( void  )

Create a new GHidLayerSelector.

Returns:
a freshly-allocated GHidLayerSelector.

Definition at line 558 of file ghid-layer-selector.c.

References GHID_LAYER_SELECTOR_TYPE.

Referenced by ghid_build_pcb_top_window().

void ghid_layer_selector_select_layer ( GHidLayerSelector ls,
gint  user_id 
)

Select a layer.

Function Description
Select the layer indicated by user_id, emitting a layer-select signal.
Parameters:
[in]lsThe selector to be acted on
[in]user_idThe ID of the layer to be affected

Definition at line 891 of file ghid-layer-selector.c.

References _GHidLayerSelector::list_store, layer_data::ls, select_foreach_func(), and layer_data::user_id.

Referenced by ghid_layer_buttons_update(), and SelectLayer().

Here is the call graph for this function:

gboolean ghid_layer_selector_select_next_visible ( GHidLayerSelector ls)

Selects the next visible layer.

Function Description
Used to ensure hidden layers are not active; if the active layer is visible, this function is a noop. Otherwise, it will look for the next layer that IS visible, and select that. Failing that, it will return FALSE.
Parameters:
[in]lsThe selector to be acted on
Returns:
TRUE on success, FALSE if all selectable layers are hidden

Definition at line 914 of file ghid-layer-selector.c.

References FALSE, _GHidLayerSelector::list_store, SELECTABLE_COL, _GHidLayerSelector::selection, selection_changed_cb(), TRUE, and VISIBLE_COL.

Referenced by layer_selector_toggle_callback().

Here is the call graph for this function:

void ghid_layer_selector_show_layers ( GHidLayerSelector ls,
gboolean(*)(int user_id)  callback 
)

Sets the visibility toggle-state of all layers.

Function Description
Shows layers according to a callback function: a return value of TRUE means show, FALSE means hide.
Parameters:
[in]lsThe selector to be acted on
[in]callbackTakes the user_id of the layer and returns a boolean

Definition at line 1075 of file ghid-layer-selector.c.

References callback(), _GHidLayerSelector::list_store, SEPARATOR_COL, set_visibility(), STRUCT_COL, and USER_ID_COL.

Referenced by LayersChanged().

Here is the call graph for this function:

void ghid_layer_selector_toggle_layer ( GHidLayerSelector ls,
gint  user_id 
)

Toggle a layer's visibility.

Function Description
Toggle the layer indicated by user_id, emitting a layer-toggle signal.
Parameters:
[in]lsThe selector to be acted on
[in]user_idThe ID of the layer to be affected

Definition at line 855 of file ghid-layer-selector.c.

References _GHidLayerSelector::list_store, layer_data::ls, toggle_foreach_func(), and layer_data::user_id.

Referenced by ToggleView().

Here is the call graph for this function:

void ghid_layer_selector_update_colors ( GHidLayerSelector ls,
const gchar *(*)(int user_id)  callback 
)

Sets the colors of all layers in a layer-selector.

Function Description
Updates the colors of a layer selector via a callback mechanism: the user_id of each layer is passed to the callback function, which returns a color string to update the layer's color, or NULL to leave it alone.
Parameters:
[in]lsThe selector to be acted on
[in]callbackTakes the user_id of the layer and returns a color string

Definition at line 991 of file ghid-layer-selector.c.

References callback(), COLOR_COL, _GHidLayerSelector::list_store, layer_data::user_id, and USER_ID_COL.

Referenced by ghid_layer_buttons_color_update().

Here is the call graph for this function: