pcb 4.1.1
An interactive printed circuit board layout editor.

ghid-coord-entry.c File Reference

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "gtkhid.h"
#include "gui.h"
#include "pcb-printf.h"
#include "ghid-coord-entry.h"
Include dependency graph for ghid-coord-entry.c:

Go to the source code of this file.

Data Structures

struct  _GHidCoordEntry
struct  _GHidCoordEntryClass

Enumerations

enum  { UNIT_CHANGE_SIGNAL, LAST_SIGNAL }

Functions

static void menu_item_activate_cb (GtkMenuItem *item, GHidCoordEntry *ce)
 Callback for "Change Unit" menu click.
static void ghid_coord_entry_popup_cb (GHidCoordEntry *ce, GtkMenu *menu, gpointer data)
 Callback for context menu creation.
static gboolean ghid_coord_entry_output_cb (GHidCoordEntry *ce, gpointer data)
 Callback for user output.
static gboolean ghid_coord_text_changed_cb (GHidCoordEntry *entry, gpointer data)
 Callback for user input.
static gboolean ghid_coord_value_changed_cb (GHidCoordEntry *ce, gpointer data)
 Callback for change in value (input or ^v clicks)
static void ghid_coord_entry_change_unit (GHidCoordEntry *ce, const Unit *new_unit)
 Change the unit used by a coord entry.
static void ghid_coord_entry_init (GHidCoordEntry *ce)
static void ghid_coord_entry_class_init (GHidCoordEntryClass *klass)
GType ghid_coord_entry_get_type (void)
GtkWidget * ghid_coord_entry_new (Coord min_val, Coord max_val, Coord value, const Unit *unit, enum ce_step_size step_size)
 Create a new GHidCoordEntry.
Coord ghid_coord_entry_get_value (GHidCoordEntry *ce)
 Gets a GHidCoordEntry's value, in pcb coords.
void ghid_coord_entry_set_value (GHidCoordEntry *ce, Coord val)
 Sets a GHidCoordEntry's value, in pcb coords.

Variables

static guint ghid_coord_entry_signals [LAST_SIGNAL] = { 0 }

Enumeration Type Documentation

anonymous enum
Enumerator:
UNIT_CHANGE_SIGNAL 
LAST_SIGNAL 

Definition at line 23 of file ghid-coord-entry.c.


Function Documentation

static void ghid_coord_entry_change_unit ( GHidCoordEntry ce,
const Unit new_unit 
) [static]

Change the unit used by a coord entry.

Parameters:
[in]ceThe entry to be acted on [in] new_unit The new unit to be used

Definition at line 151 of file ghid-coord-entry.c.

References CE_LARGE, CE_MEDIUM, CE_SMALL, CE_TINY, coord_to_unit(), unit::default_prec, _GHidCoordEntry::max_value, _GHidCoordEntry::min_value, unit::step_large, unit::step_medium, _GHidCoordEntry::step_size, unit::step_small, unit::step_tiny, unit::suffix, _GHidCoordEntry::unit, and _GHidCoordEntry::value.

Referenced by ghid_coord_entry_class_init().

Here is the call graph for this function:

static void ghid_coord_entry_class_init ( GHidCoordEntryClass klass) [static]

Definition at line 192 of file ghid-coord-entry.c.

References _GHidCoordEntryClass::change_unit, ghid_coord_entry_change_unit(), ghid_coord_entry_signals, and UNIT_CHANGE_SIGNAL.

Referenced by ghid_coord_entry_get_type().

Here is the call graph for this function:

GType ghid_coord_entry_get_type ( void  )

Definition at line 211 of file ghid-coord-entry.c.

References ghid_coord_entry_class_init(), and ghid_coord_entry_init().

Here is the call graph for this function:

Coord ghid_coord_entry_get_value ( GHidCoordEntry ce)

Gets a GHidCoordEntry's value, in pcb coords.

Definition at line 300 of file ghid-coord-entry.c.

References _GHidCoordEntry::value.

Referenced by coord_entry_cb(), ghid_route_style_selector_edit_dialog(), and increment_spin_button_cb().

static void ghid_coord_entry_init ( GHidCoordEntry ce) [static]

Definition at line 178 of file ghid-coord-entry.c.

References ghid_coord_entry_output_cb(), ghid_coord_entry_popup_cb(), ghid_coord_text_changed_cb(), and ghid_coord_value_changed_cb().

Referenced by ghid_coord_entry_get_type().

Here is the call graph for this function:

GtkWidget* ghid_coord_entry_new ( Coord  min_val,
Coord  max_val,
Coord  value,
const Unit unit,
enum ce_step_size  step_size 
)

Create a new GHidCoordEntry.

Parameters:
[in]min_valThe minimum allowed value, in pcb coords
[in]max_valThe maximum allowed value, in pcb coords
[in]valueThe default value, in pcb coords
[in]unitThe default unit
[in]step_sizeHow large the default increments should be
Returns:
a freshly-allocated GHidCoordEntry

Definition at line 250 of file ghid-coord-entry.c.

References CE_LARGE, CE_MEDIUM, CE_SMALL, CE_TINY, coord_to_unit(), unit::default_prec, FALSE, GHID_COORD_ENTRY_TYPE, _GHidCoordEntry::max_value, _GHidCoordEntry::min_value, unit::step_huge, unit::step_large, unit::step_medium, _GHidCoordEntry::step_size, unit::step_small, unit::step_tiny, unit::suffix, unit, _GHidCoordEntry::unit, and _GHidCoordEntry::value.

Referenced by _table_attach(), ghid_attribute_dialog(), ghid_coord_entry(), and ghid_table_coord_entry().

Here is the call graph for this function:

static gboolean ghid_coord_entry_output_cb ( GHidCoordEntry ce,
gpointer  data 
) [static]

Callback for user output.

Definition at line 95 of file ghid-coord-entry.c.

References unit::default_prec, pcb_g_strdup_printf(), unit::suffix, TRUE, and _GHidCoordEntry::unit.

Referenced by ghid_coord_entry_init().

Here is the call graph for this function:

static void ghid_coord_entry_popup_cb ( GHidCoordEntry ce,
GtkMenu *  menu,
gpointer  data 
) [static]

Callback for context menu creation.

Definition at line 62 of file ghid-coord-entry.c.

References _, get_n_units(), get_unit_list(), menu_item_activate_cb(), and n.

Referenced by ghid_coord_entry_init().

Here is the call graph for this function:

void ghid_coord_entry_set_value ( GHidCoordEntry ce,
Coord  val 
)

Sets a GHidCoordEntry's value, in pcb coords.

Definition at line 307 of file ghid-coord-entry.c.

References coord_to_unit(), and _GHidCoordEntry::unit.

Referenced by dialog_style_changed_cb().

Here is the call graph for this function:

static gboolean ghid_coord_text_changed_cb ( GHidCoordEntry entry,
gpointer  data 
) [static]

Callback for user input.

Definition at line 110 of file ghid-coord-entry.c.

References FALSE, get_unit_struct(), ghid_coord_entry_signals, _GHidCoordEntry::unit, UNIT_CHANGE_SIGNAL, unit_to_coord(), and _GHidCoordEntry::value.

Referenced by ghid_coord_entry_init(), and ghid_coord_value_changed_cb().

Here is the call graph for this function:

static gboolean ghid_coord_value_changed_cb ( GHidCoordEntry ce,
gpointer  data 
) [static]

Callback for change in value (input or ^v clicks)

Definition at line 132 of file ghid-coord-entry.c.

References FALSE, ghid_coord_text_changed_cb(), _GHidCoordEntry::unit, unit_to_coord(), and _GHidCoordEntry::value.

Referenced by ghid_coord_entry_init().

Here is the call graph for this function:

static void menu_item_activate_cb ( GtkMenuItem *  item,
GHidCoordEntry ce 
) [static]

Callback for "Change Unit" menu click.

Definition at line 52 of file ghid-coord-entry.c.

References get_unit_struct(), ghid_coord_entry_signals, and UNIT_CHANGE_SIGNAL.

Referenced by ghid_coord_entry_popup_cb().

Here is the call graph for this function:


Variable Documentation

guint ghid_coord_entry_signals[LAST_SIGNAL] = { 0 } [static]