pcb 4.1.1
An interactive printed circuit board layout editor.
|
#include "gui.h"
#include "global.h"
#include "buffer.h"
#include "data.h"
#include "set.h"
#include <gdk/gdkkeysyms.h>
#include "gui-pinout-preview.h"
#include "gui-library-window.h"
Go to the source code of this file.
Defines | |
#define | LIBRARY_FILTER_INTERVAL 200 |
The time interval between request and actual filtering. | |
Enumerations | |
enum | { MENU_TOPPATH_COLUMN, MENU_SUBPATH_COLUMN, MENU_NAME_COLUMN, MENU_LIBRARY_COLUMN, MENU_ENTRY_COLUMN, N_MENU_COLUMNS } |
Functions | |
static gint | library_window_configure_event_cb (GtkWidget *widget, GdkEventConfigure *ev, gpointer data) |
static void | library_window_callback_response (GtkDialog *dialog, gint arg1, gpointer user_data) |
Process the response returned by the library dialog. | |
void | ghid_library_window_create (GHidPort *out) |
Creates a library dialog. | |
void | ghid_library_window_show (GHidPort *out, gboolean raise) |
Show the library dialog. | |
static gboolean | lib_model_filter_visible_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data) |
Determines visibility of items of the library treeview. | |
static void | tree_row_activated (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) |
Handles activation (e.g. double-clicking) of a component row. | |
static gboolean | tree_row_key_pressed (GtkTreeView *tree_view, GdkEventKey *event, gpointer user_data) |
Handles CTRL-C keypress in the TreeView. | |
static void | library_window_callback_tree_selection_changed (GtkTreeSelection *selection, gpointer user_data) |
Handles changes in the treeview selection. | |
static void | maybe_expand_toplevel_node (GtkTreeView *tree_view) |
If there is only one toplevel node, expand it. | |
static gboolean | library_window_filter_timeout (gpointer data) |
Requests re-evaluation of the filter. | |
static void | library_window_callback_filter_entry_changed (GtkEditable *editable, gpointer user_data) |
Callback function for the changed signal of the filter entry. | |
static void | library_window_callback_filter_button_clicked (GtkButton *button, gpointer user_data) |
Handles a click on the clear button. | |
static GtkTreeModel * | create_lib_tree_model (GhidLibraryWindow *library_window) |
static GtkWidget * | create_lib_treeview (GhidLibraryWindow *library_window) |
Creates the treeview for the "Library" view. | |
static GObject * | library_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) |
static void | library_window_finalize (GObject *object) |
static void | library_window_class_init (GhidLibraryWindowClass *klass) |
GType | ghid_library_window_get_type () |
Variables | |
static GtkWidget * | library_window |
static GObjectClass * | library_window_parent_class = NULL |
#define LIBRARY_FILTER_INTERVAL 200 |
The time interval between request and actual filtering.
This constant is the time-lag between user modifications in the filter entry and the actual evaluation of the filter which ultimately update the display. It helps reduce the frequency of evaluation of the filter as user types.
Unit is milliseconds.
Definition at line 85 of file gui-library-window.c.
Referenced by library_window_callback_filter_entry_changed().
anonymous enum |
MENU_TOPPATH_COLUMN | |
MENU_SUBPATH_COLUMN | |
MENU_NAME_COLUMN | |
MENU_LIBRARY_COLUMN | |
MENU_ENTRY_COLUMN | |
N_MENU_COLUMNS |
Definition at line 102 of file gui-library-window.c.
static GtkTreeModel* create_lib_tree_model | ( | GhidLibraryWindow * | library_window | ) | [static] |
Definition at line 544 of file gui-library-window.c.
References END_LOOP, ENTRY_LOOP, FALSE, Library, MENU_ENTRY_COLUMN, MENU_LIBRARY_COLUMN, MENU_LOOP, MENU_NAME_COLUMN, MENU_SUBPATH_COLUMN, MENU_TOPPATH_COLUMN, N_MENU_COLUMNS, and TRUE.
Referenced by create_lib_treeview().
static GtkWidget* create_lib_treeview | ( | GhidLibraryWindow * | library_window | ) | [static] |
Creates the treeview for the "Library" view.
Definition at line 682 of file gui-library-window.c.
References _, _GhidLibraryWindow::button_clear, create_lib_tree_model(), _GhidLibraryWindow::entry_filter, FALSE, _GhidLibraryWindow::filter_timeout, lib_model_filter_visible_func(), library_window_callback_filter_button_clicked(), library_window_callback_filter_entry_changed(), library_window_callback_tree_selection_changed(), _GhidLibraryWindow::libtreeview, maybe_expand_toplevel_node(), MENU_NAME_COLUMN, tree_row_activated(), tree_row_key_pressed(), and TRUE.
Referenced by library_window_constructor().
void ghid_library_window_create | ( | GHidPort * | out | ) |
Creates a library dialog.
Definition at line 152 of file gui-library-window.c.
References _, SettingType::AutoPlace, GHID_LIBRARY_WINDOW, GHID_TYPE_LIBRARY_WINDOW, ghidgui, library_window, library_window_callback_response(), library_window_configure_event_cb(), GhidGui::library_window_height, GhidGui::library_window_width, and Settings.
Referenced by ghid_library_window_show().
GType ghid_library_window_get_type | ( | void | ) |
Definition at line 962 of file gui-library-window.c.
References library_window_class_init().
void ghid_library_window_show | ( | GHidPort * | out, |
gboolean | raise | ||
) |
Show the library dialog.
Definition at line 204 of file gui-library-window.c.
References ghid_library_window_create(), and library_window.
Referenced by DoWindows().
static gboolean lib_model_filter_visible_func | ( | GtkTreeModel * | model, |
GtkTreeIter * | iter, | ||
gpointer | data | ||
) | [static] |
Determines visibility of items of the library treeview.
[in] | model | The current selection in the treeview. |
[in] | iter | An iterator on a footprint or folder in the tree. |
[in] | data | The library dialog. |
Definition at line 226 of file gui-library-window.c.
References _GhidLibraryWindow::entry_filter, FALSE, GHID_IS_LIBRARY_WINDOW, library_window, MENU_NAME_COLUMN, and TRUE.
Referenced by create_lib_treeview().
static void library_window_callback_filter_button_clicked | ( | GtkButton * | button, |
gpointer | user_data | ||
) | [static] |
Handles a click on the clear button.
It resets the filter entry, indirectly causing re-evaluation of the filter on the list of symbols to update the display.
[in] | editable | The filter text entry. |
[in] | user_data | The library dialog. |
Definition at line 528 of file gui-library-window.c.
References _GhidLibraryWindow::entry_filter, GHID_LIBRARY_WINDOW, and library_window.
Referenced by create_lib_treeview().
static void library_window_callback_filter_entry_changed | ( | GtkEditable * | editable, |
gpointer | user_data | ||
) | [static] |
Callback function for the changed signal of the filter entry.
It specifically manages the sensitivity of the clear button of the entry depending on its contents. It also requests an update of the footprint list by re-evaluating filter at every changes.
[in] | editable | The filter text entry. |
[in] | user_data | The library dialog. |
Definition at line 489 of file gui-library-window.c.
References _GhidLibraryWindow::button_clear, _GhidLibraryWindow::entry_filter, _GhidLibraryWindow::filter_timeout, GHID_LIBRARY_WINDOW, LIBRARY_FILTER_INTERVAL, library_window, and library_window_filter_timeout().
Referenced by create_lib_treeview().
static void library_window_callback_response | ( | GtkDialog * | dialog, |
gint | arg1, | ||
gpointer | user_data | ||
) | [static] |
Process the response returned by the library dialog.
Parameter user_data is a pointer on the relevant toplevel structure.
[in] | dialog | The library dialog. |
[in] | arg1 | The response ID. |
[in] | user_data |
Definition at line 126 of file gui-library-window.c.
References library_window.
Referenced by ghid_library_window_create().
static void library_window_callback_tree_selection_changed | ( | GtkTreeSelection * | selection, |
gpointer | user_data | ||
) | [static] |
Handles changes in the treeview selection.
If the selection is not a selection of a footprint, it does nothing. Otherwise it updates the preview and Element data.
[in] | selection | The current selection in the treeview. |
[in] | user_data | The library dialog. |
Definition at line 365 of file gui-library-window.c.
References LibraryEntryType::AllocatedMemory, EMPTY, library_window, LoadElementToBuffer(), MENU_ENTRY_COLUMN, LibraryEntryType::Package, PASTEBUFFER, PASTEBUFFER_MODE, _GhidLibraryWindow::preview, SetMode(), LibraryEntryType::Template, and LibraryEntryType::Value.
Referenced by create_lib_treeview().
static void library_window_class_init | ( | GhidLibraryWindowClass * | klass | ) | [static] |
Definition at line 950 of file gui-library-window.c.
References library_window_constructor(), library_window_finalize(), and library_window_parent_class.
Referenced by ghid_library_window_get_type().
static gint library_window_configure_event_cb | ( | GtkWidget * | widget, |
GdkEventConfigure * | ev, | ||
gpointer | data | ||
) | [static] |
Definition at line 89 of file gui-library-window.c.
References GhidGui::config_modified, FALSE, ghidgui, GhidGui::library_window_height, GhidGui::library_window_width, and TRUE.
Referenced by ghid_library_window_create().
static GObject* library_window_constructor | ( | GType | type, |
guint | n_construct_properties, | ||
GObjectConstructParam * | construct_params | ||
) | [static] |
Definition at line 846 of file gui-library-window.c.
References _, create_lib_treeview(), FALSE, GHID_LIBRARY_WINDOW, GHID_TYPE_PINOUT_PREVIEW, _GhidLibraryWindow::hpaned, library_window, library_window_parent_class, _GhidLibraryWindow::preview, TRUE, and _GhidLibraryWindow::viewtabs.
Referenced by library_window_class_init().
static gboolean library_window_filter_timeout | ( | gpointer | data | ) | [static] |
Requests re-evaluation of the filter.
The timeout this callback is attached to is removed after the function.
[in] | data | The library dialog. |
Definition at line 448 of file gui-library-window.c.
References _GhidLibraryWindow::entry_filter, FALSE, _GhidLibraryWindow::filter_timeout, GHID_LIBRARY_WINDOW, library_window, _GhidLibraryWindow::libtreeview, and maybe_expand_toplevel_node().
Referenced by library_window_callback_filter_entry_changed().
static void library_window_finalize | ( | GObject * | object | ) | [static] |
Definition at line 935 of file gui-library-window.c.
References _GhidLibraryWindow::filter_timeout, GHID_LIBRARY_WINDOW, and library_window_parent_class.
Referenced by library_window_class_init().
static void maybe_expand_toplevel_node | ( | GtkTreeView * | tree_view | ) | [static] |
If there is only one toplevel node, expand it.
Definition at line 422 of file gui-library-window.c.
References FALSE.
Referenced by create_lib_treeview(), and library_window_filter_timeout().
static void tree_row_activated | ( | GtkTreeView * | tree_view, |
GtkTreePath * | path, | ||
GtkTreeViewColumn * | column, | ||
gpointer | user_data | ||
) | [static] |
Handles activation (e.g. double-clicking) of a component row.
[in] | tree_view | The component treeview. |
[in] | path | The GtkTreePath to the activated row. |
[in] | column | The GtkTreeViewColumn in which the activation occurre |
[in] | user_data | The component selection dialog. |
Definition at line 290 of file gui-library-window.c.
References FALSE.
Referenced by create_lib_treeview().
static gboolean tree_row_key_pressed | ( | GtkTreeView * | tree_view, |
GdkEventKey * | event, | ||
gpointer | user_data | ||
) | [static] |
Handles CTRL-C keypress in the TreeView.
[in] | tree_view | The component treeview. |
[in] | event | The GdkEventKey with keypress info. |
[in] | user_data | Not used. |
Definition at line 321 of file gui-library-window.c.
References FALSE, MENU_NAME_COLUMN, and TRUE.
Referenced by create_lib_treeview().
GtkWidget* library_window [static] |
Definition at line 70 of file gui-library-window.c.
Referenced by ghid_library_window_create(), ghid_library_window_show(), lib_model_filter_visible_func(), library_window_callback_filter_button_clicked(), library_window_callback_filter_entry_changed(), library_window_callback_response(), library_window_callback_tree_selection_changed(), library_window_constructor(), and library_window_filter_timeout().
GObjectClass* library_window_parent_class = NULL [static] |
Definition at line 212 of file gui-library-window.c.
Referenced by library_window_class_init(), library_window_constructor(), and library_window_finalize().