pcb 4.1.1
An interactive printed circuit board layout editor.

gui-config.c File Reference

#include "gui.h"
#include "hid.h"
#include "../hidint.h"
#include "gtkhid.h"
#include "global.h"
#include "action.h"
#include "change.h"
#include "file.h"
#include "error.h"
#include "draw.h"
#include "misc.h"
#include "pcb-printf.h"
#include "set.h"
Include dependency graph for gui-config.c:

Go to the source code of this file.

Data Structures

struct  ConfigAttribute
struct  ConfigColor

Defines

#define PCB_CONFIG_DIR   ".pcb"
#define PCB_CONFIG_FILE   "preferences"
#define PCB_COLORS_DIR   "colors"
#define INCR_ENTRY(row, name, family, type, msg)

Enumerations

enum  ConfigType {
  CONFIG_Boolean, CONFIG_Integer, CONFIG_Coord, CONFIG_Real,
  CONFIG_String, CONFIG_Unused
}
enum  ColorTypes { MISC_COLOR, MISC_SELECTED_COLOR, LAYER_COLOR, LAYER_SELECTED_COLOR }
enum  { CONFIG_NAME_COLUMN, CONFIG_PAGE_COLUMN, N_CONFIG_COLUMNS }

Functions

int MoveLayerAction (int argc, char **argv, int x, int y)
void save_increments (const Increments *mm, const Increments *mil)
void ghid_set_special_colors (HID_Attribute *ha)
static gboolean dup_core_string (gchar **dst, const gchar *src)
static FILE * config_file_open (gchar *mode)
static ConfigAttributelookup_config_attribute (gchar *name, gboolean if_null_value)
void ghid_config_init (void)
static gint parse_option_line (gchar *line, gchar **option_result, gchar **arg_result)
static gboolean set_config_attribute (gchar *option, gchar *arg)
static void config_file_read (void)
static void config_colors_write (gchar *path)
static gboolean config_colors_read (gchar *path)
static gchar * expand_dir (gchar *dir)
static void add_to_paths_list (GList **list, gchar *path_string)
static void parse_optionv (gint *argc, gchar ***argv, gboolean from_cmd_line)
static void load_rc_file (gchar *path)
static void load_rc_files (void)
void ghid_config_files_read (gint *argc, gchar ***argv)
void ghid_config_files_write (void)
static void config_command_window_toggle_cb (GtkToggleButton *button, gpointer data)
static void config_compact_horizontal_toggle_cb (GtkToggleButton *button, gpointer data)
static void config_compact_vertical_toggle_cb (GtkToggleButton *button, gpointer data)
static void config_general_toggle_cb (GtkToggleButton *button, void *setting)
static void config_backup_spin_button_cb (GtkSpinButton *spin_button, gpointer data)
static void config_history_spin_button_cb (GtkSpinButton *spin_button, gpointer data)
static void config_general_tab_create (GtkWidget *tab_vbox)
static void config_general_apply (void)
static void config_sizes_apply (void)
static void text_spin_button_cb (GtkSpinButton *spin, void *dst)
static void coord_entry_cb (GHidCoordEntry *ce, void *dst)
static void config_sizes_tab_create (GtkWidget *tab_vbox)
static void increment_spin_button_cb (GHidCoordEntry *ce, void *dst)
static void config_increments_tab_create (GtkWidget *tab_vbox)
static void config_library_apply (void)
static void config_library_tab_create (GtkWidget *tab_vbox)
static void config_layer_groups_radio_button_cb (GtkToggleButton *button, gpointer data)
static gchar * make_layer_group_string (LayerGroupType *lg)
static void config_layers_apply (void)
static void config_layer_group_button_state_update (void)
static void layer_name_entry_cb (GtkWidget *entry, gpointer data)
void ghid_config_groups_changed (void)
static void edit_layer_button_cb (GtkWidget *widget, gchar *data)
static void config_layers_tab_create (GtkWidget *tab_vbox)
void ghid_config_layer_name_update (gchar *name, gint layer)
static void config_colors_tab_create (GtkWidget *tab_vbox)
static void config_color_file_set_label (void)
static void config_color_defaults_cb (gpointer data)
static void config_color_load_cb (gpointer data)
static void config_color_save_cb (gpointer data)
static void config_color_set_cb (GtkWidget *button, ConfigColor *cc)
static void config_color_button_create (GtkWidget *box, ConfigColor *cc)
static GtkWidget * config_page_create (GtkTreeStore *tree, GtkTreeIter *iter, GtkNotebook *notebook)
void ghid_config_handle_units_changed (void)
void ghid_config_text_scale_update (void)
static void config_close_cb (gpointer data)
static void config_destroy_cb (gpointer data)
static void config_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
void ghid_config_window_show (void)

Variables

static GList * config_color_list
static GList * lib_newlib_list
static gchar * lib_newlib_config
static gchar * board_size_override
static gchar * color_file
static gchar * config_dir
static gchar * color_dir
static ConfigAttribute config_attributes []
static GtkWidget * config_window
static GtkWidget * config_sizes_vbox
static GtkWidget * config_sizes_tab_vbox
static GtkWidget * config_text_spin_button
static GtkWidget * use_board_size_default_button
static GtkWidget * use_drc_sizes_default_button
static GtkWidget * use_increments_default_button
static Coord new_board_width
static Coord new_board_height
static GtkWidget * config_increments_vbox
static GtkWidget * config_increments_tab_vbox
static GtkWidget * library_newlib_entry
static GtkWidget * config_groups_table
static GtkWidget * config_groups_vbox
static GtkWidget * config_groups_window
static GtkWidget * layer_entry [MAX_LAYER]
static GtkWidget * group_button [MAX_ALL_LAYER][MAX_GROUP]
static gint config_layer_group [MAX_ALL_LAYER]
static LayerGroupType layer_groups
static LayerGroupTypelg_monitor
static gboolean groups_modified
static gboolean groups_holdoff
static gboolean layers_applying
static gchar * layer_info_text []
static GtkWidget * config_colors_vbox
static GtkWidget * config_colors_tab_vbox
static GtkWidget * config_colors_save_button
static GtkWidget * config_color_file_label
static GtkWidget * config_color_warn_label
static gboolean config_colors_modified
static GtkNotebook * config_notebook

Define Documentation

#define INCR_ENTRY (   row,
  name,
  family,
  type,
  msg 
)
Value:
gtk_table_attach_defaults (GTK_TABLE (table),   \
                             gtk_label_new (name),      \
                             0, 1, row, row + 1);       \
  ghid_table_coord_entry (table, row, 1, NULL,  \
                          incr_##family->type,  \
                          incr_##family->type##_min,    \
                          incr_##family->type##_max,    \
                          CE_SMALL, 0, increment_spin_button_cb,        \
                          &incr_##family->type, FALSE,  \
                          msg)

Referenced by config_increments_tab_create().

#define PCB_COLORS_DIR   "colors"

Definition at line 109 of file gui-config.c.

Referenced by config_file_open().

#define PCB_CONFIG_DIR   ".pcb"

Definition at line 107 of file gui-config.c.

Referenced by config_file_open().

#define PCB_CONFIG_FILE   "preferences"

Definition at line 108 of file gui-config.c.

Referenced by config_file_open().


Enumeration Type Documentation

anonymous enum
Enumerator:
CONFIG_NAME_COLUMN 
CONFIG_PAGE_COLUMN 
N_CONFIG_COLUMNS 

Definition at line 2054 of file gui-config.c.

enum ColorTypes
Enumerator:
MISC_COLOR 
MISC_SELECTED_COLOR 
LAYER_COLOR 
LAYER_SELECTED_COLOR 

Definition at line 80 of file gui-config.c.

enum ConfigType
Enumerator:
CONFIG_Boolean 
CONFIG_Integer 
CONFIG_Coord 
CONFIG_Real 
CONFIG_String 
CONFIG_Unused 

Definition at line 61 of file gui-config.c.


Function Documentation

static void add_to_paths_list ( GList **  list,
gchar *  path_string 
) [static]

Definition at line 570 of file gui-config.c.

References expand_dir().

Referenced by ghid_config_files_read().

Here is the call graph for this function:

static void config_backup_spin_button_cb ( GtkSpinButton *  spin_button,
gpointer  data 
) [static]

Definition at line 904 of file gui-config.c.

References SettingType::BackupInterval, GhidGui::config_modified, EnableAutosave(), ghidgui, Settings, and TRUE.

Referenced by config_general_tab_create().

Here is the call graph for this function:

static void config_close_cb ( gpointer  data) [static]
static void config_color_button_create ( GtkWidget *  box,
ConfigColor cc 
) [static]
static void config_color_file_set_label ( void  ) [static]
static void config_color_save_cb ( gpointer  data) [static]
static gboolean config_colors_read ( gchar *  path) [static]
static void config_colors_write ( gchar *  path) [static]
static void config_command_window_toggle_cb ( GtkToggleButton *  button,
gpointer  data 
) [static]

Definition at line 853 of file gui-config.c.

References GhidGui::command_entry_status_line_active, FALSE, ghid_command_use_command_window_sync(), ghidgui, TRUE, and GhidGui::use_command_window.

Referenced by config_general_tab_create().

Here is the call graph for this function:

static void config_compact_horizontal_toggle_cb ( GtkToggleButton *  button,
gpointer  data 
) [static]

Definition at line 877 of file gui-config.c.

References GhidGui::compact_horizontal, GhidGui::config_modified, ghid_set_status_line_label(), ghidgui, and TRUE.

Referenced by config_general_tab_create().

Here is the call graph for this function:

static void config_compact_vertical_toggle_cb ( GtkToggleButton *  button,
gpointer  data 
) [static]

Definition at line 887 of file gui-config.c.

References GhidGui::compact_vertical, GhidGui::config_modified, ghid_pack_mode_buttons(), ghidgui, and TRUE.

Referenced by config_general_tab_create().

Here is the call graph for this function:

static void config_destroy_cb ( gpointer  data) [static]
static FILE* config_file_open ( gchar *  mode) [static]

Definition at line 196 of file gui-config.c.

References color_dir, color_file, config_dir, dup_string(), f, homedir, MKDIR, PCB_COLORS_DIR, PCB_CONFIG_DIR, and PCB_CONFIG_FILE.

Referenced by config_file_read(), and ghid_config_files_write().

Here is the call graph for this function:

static void config_file_read ( void  ) [static]

Definition at line 475 of file gui-config.c.

References config_file_open(), f, getline(), n, parse_option_line(), and set_config_attribute().

Referenced by ghid_config_files_read().

Here is the call graph for this function:

static void config_general_apply ( void  ) [static]

Definition at line 966 of file gui-config.c.

References ghid_config_files_write().

Referenced by config_close_cb().

Here is the call graph for this function:

static void config_general_toggle_cb ( GtkToggleButton *  button,
void *  setting 
) [static]

Definition at line 897 of file gui-config.c.

References GhidGui::config_modified, ghidgui, and TRUE.

Referenced by config_general_tab_create().

static void config_history_spin_button_cb ( GtkSpinButton *  spin_button,
gpointer  data 
) [static]

Definition at line 912 of file gui-config.c.

References GhidGui::config_modified, ghidgui, GhidGui::history_size, and TRUE.

Referenced by config_general_tab_create().

static void config_increments_tab_create ( GtkWidget *  tab_vbox) [static]
static void config_layer_group_button_state_update ( void  ) [static]
static void config_layer_groups_radio_button_cb ( GtkToggleButton *  button,
gpointer  data 
) [static]
static void config_layers_tab_create ( GtkWidget *  tab_vbox) [static]
static void config_library_apply ( void  ) [static]

Definition at line 1260 of file gui-config.c.

References GhidGui::config_modified, dup_string(), ghid_entry_get_text(), ghidgui, lib_newlib_config, library_newlib_entry, and TRUE.

Referenced by config_close_cb().

Here is the call graph for this function:

static void config_library_tab_create ( GtkWidget *  tab_vbox) [static]

Definition at line 1268 of file gui-config.c.

References _, FALSE, ghid_category_vbox(), lib_newlib_config, library_newlib_entry, and TRUE.

Referenced by ghid_config_window_show().

Here is the call graph for this function:

static GtkWidget* config_page_create ( GtkTreeStore *  tree,
GtkTreeIter *  iter,
GtkNotebook *  notebook 
) [static]

Definition at line 2064 of file gui-config.c.

References CONFIG_PAGE_COLUMN, and FALSE.

Referenced by ghid_config_window_show().

static void config_selection_changed_cb ( GtkTreeSelection *  selection,
gpointer  data 
) [static]

Definition at line 2142 of file gui-config.c.

References config_notebook, and CONFIG_PAGE_COLUMN.

Referenced by ghid_config_window_show().

static void coord_entry_cb ( GHidCoordEntry ce,
void *  dst 
) [static]

Definition at line 1038 of file gui-config.c.

References GhidGui::config_modified, ghid_coord_entry_get_value(), ghidgui, and TRUE.

Referenced by config_sizes_tab_create().

Here is the call graph for this function:

static gboolean dup_core_string ( gchar **  dst,
const gchar *  src 
) [static]

Definition at line 181 of file gui-config.c.

References FALSE, and TRUE.

Referenced by config_color_defaults_cb(), config_layers_apply(), and layer_name_entry_cb().

static void edit_layer_button_cb ( GtkWidget *  widget,
gchar *  data 
) [static]

Definition at line 1673 of file gui-config.c.

References MoveLayerAction(), PCB, PCBType::RatDraw, and PCBType::SilkActive.

Referenced by config_layers_tab_create().

Here is the call graph for this function:

static gchar* expand_dir ( gchar *  dir) [static]

Definition at line 558 of file gui-config.c.

References s.

Referenced by add_to_paths_list(), CreateEdge(), and ghid_config_files_read().

void ghid_config_layer_name_update ( gchar *  name,
gint  layer 
)

Definition at line 1763 of file gui-config.c.

References config_layer_group_button_state_update(), config_window, FALSE, groups_modified, layer_entry, PCBType::LayerGroups, layers_applying, and PCB.

Here is the call graph for this function:

void ghid_config_text_scale_update ( void  )
static void increment_spin_button_cb ( GHidCoordEntry ce,
void *  dst 
) [static]

Definition at line 1166 of file gui-config.c.

References GhidGui::config_modified, ghid_coord_entry_get_value(), ghidgui, and TRUE.

Here is the call graph for this function:

static void layer_name_entry_cb ( GtkWidget *  entry,
gpointer  data 
) [static]

Definition at line 1528 of file gui-config.c.

References PCBType::Data, dup_core_string(), ghid_entry_get_text(), ghid_layer_buttons_update(), DataType::Layer, layer, LayerType::Name, and PCB.

Referenced by ghid_config_groups_changed().

Here is the call graph for this function:

static void load_rc_file ( gchar *  path) [static]

Definition at line 718 of file gui-config.c.

References f, FALSE, parse_option_line(), parse_optionv(), Settings, and SettingType::verbose.

Referenced by load_rc_files().

Here is the call graph for this function:

static void load_rc_files ( void  ) [static]

Definition at line 742 of file gui-config.c.

References load_rc_file(), and pcblibdir.

Referenced by ghid_config_files_read().

Here is the call graph for this function:

static ConfigAttribute* lookup_config_attribute ( gchar *  name,
gboolean  if_null_value 
) [static]

Definition at line 252 of file gui-config.c.

References ConfigAttribute::name, and ConfigAttribute::value.

Referenced by ghid_config_init(), and set_config_attribute().

static gchar* make_layer_group_string ( LayerGroupType lg) [static]
int MoveLayerAction ( int  argc,
char **  argv,
int  x,
int  y 
)

Referenced by edit_layer_button_cb().

static gint parse_option_line ( gchar *  line,
gchar **  option_result,
gchar **  arg_result 
) [static]

Definition at line 354 of file gui-config.c.

References line, malloc(), and s.

Referenced by config_file_read(), and load_rc_file().

Here is the call graph for this function:

void save_increments ( const Increments mm,
const Increments mil 
)

Definition at line 439 of file main.c.

Referenced by config_sizes_apply().

static gboolean set_config_attribute ( gchar *  option,
gchar *  arg 
) [static]
static void text_spin_button_cb ( GtkSpinButton *  spin,
void *  dst 
) [static]

Definition at line 1030 of file gui-config.c.

References GhidGui::config_modified, ghid_set_status_line_label(), ghidgui, and TRUE.

Referenced by config_sizes_tab_create().

Here is the call graph for this function:


Variable Documentation

Definition at line 99 of file gui-config.c.

Referenced by ghid_config_files_read().

gchar * color_dir

Definition at line 111 of file gui-config.c.

Referenced by config_color_load_cb(), config_color_save_cb(), and config_file_open().

Definition at line 119 of file gui-config.c.

Definition at line 1783 of file gui-config.c.

Referenced by config_color_file_set_label(), and config_colors_tab_create().

GtkWidget* config_colors_vbox [static]
gchar* config_dir [static]

Definition at line 111 of file gui-config.c.

Referenced by config_file_open().

GtkWidget* config_groups_table [static]

Definition at line 1299 of file gui-config.c.

Referenced by config_close_cb(), config_destroy_cb(), and ghid_config_groups_changed().

GtkWidget * config_groups_window

Definition at line 1299 of file gui-config.c.

Referenced by config_close_cb(), config_destroy_cb(), and ghid_config_groups_changed().

GtkNotebook* config_notebook [static]

Definition at line 2061 of file gui-config.c.

Referenced by config_selection_changed_cb(), and ghid_config_window_show().

GtkWidget * config_sizes_tab_vbox

Definition at line 976 of file gui-config.c.

Referenced by config_sizes_tab_create(), and ghid_config_handle_units_changed().

Definition at line 976 of file gui-config.c.

Referenced by config_sizes_tab_create(), and ghid_config_text_scale_update().

GtkWidget* group_button[MAX_ALL_LAYER][MAX_GROUP] [static]
GtkWidget* layer_entry[MAX_LAYER] [static]

Definition at line 1310 of file gui-config.c.

Referenced by config_layers_apply().

gchar* layer_info_text[] [static]

Definition at line 1316 of file gui-config.c.

Referenced by config_layers_tab_create().

gboolean layers_applying

Definition at line 1314 of file gui-config.c.

Referenced by config_layers_apply(), and ghid_config_layer_name_update().

Definition at line 1310 of file gui-config.c.

gchar* lib_newlib_config [static]
GList * lib_newlib_list

Definition at line 97 of file gui-config.c.

Referenced by ghid_config_files_read().

GtkWidget* library_newlib_entry [static]

Definition at line 1257 of file gui-config.c.

Referenced by config_library_apply(), and config_library_tab_create().

Definition at line 983 of file gui-config.c.

Referenced by config_sizes_apply(), and config_sizes_tab_create().

Definition at line 983 of file gui-config.c.

Referenced by config_sizes_apply(), and config_sizes_tab_create().

GtkWidget* use_board_size_default_button [static]

Definition at line 979 of file gui-config.c.

Referenced by config_sizes_apply(), and config_sizes_tab_create().

Definition at line 979 of file gui-config.c.

Referenced by config_sizes_apply(), and config_sizes_tab_create().

Definition at line 979 of file gui-config.c.

Referenced by config_increments_tab_create(), and config_sizes_apply().