pcb 4.1.1
An interactive printed circuit board layout editor.

gui-library-window.c File Reference

#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"
Include dependency graph for gui-library-window.c:

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 Documentation

#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().


Enumeration Type Documentation

anonymous enum
Enumerator:
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.


Function Documentation

static GtkTreeModel* create_lib_tree_model ( GhidLibraryWindow library_window) [static]
void ghid_library_window_create ( GHidPort out)

Creates a library dialog.

Function Description
This function create the library dialog if it is not already created. It does not show the dialog, use ghid_library_window_show for that.

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().

Here is the call graph for this function:

GType ghid_library_window_get_type ( void  )

Definition at line 962 of file gui-library-window.c.

References library_window_class_init().

Here is the call graph for this function:

void ghid_library_window_show ( GHidPort out,
gboolean  raise 
)

Show the library dialog.

Function Description
This function show the library dialog, creating it if it is not already created, and presents it to the user (brings it to the front with focus).

Definition at line 204 of file gui-library-window.c.

References ghid_library_window_create(), and library_window.

Referenced by DoWindows().

Here is the call graph for this function:

static gboolean lib_model_filter_visible_func ( GtkTreeModel *  model,
GtkTreeIter *  iter,
gpointer  data 
) [static]

Determines visibility of items of the library treeview.

Function Description
This is the function used to filter entries of the footprint selection tree.
Parameters:
[in]modelThe current selection in the treeview.
[in]iterAn iterator on a footprint or folder in the tree.
[in]dataThe library dialog.
Returns:
TRUE if item should be visible, FALSE otherwise.

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.

Function Description
This is the callback function called every time the user press the clear button associated with the filter.

It resets the filter entry, indirectly causing re-evaluation of the filter on the list of symbols to update the display.

Parameters:
[in]editableThe filter text entry.
[in]user_dataThe 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.

Function Description
This function monitors changes in the entry filter of the dialog.

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.

Parameters:
[in]editableThe filter text entry.
[in]user_dataThe 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().

Here is the call graph for this function:

static void library_window_callback_response ( GtkDialog *  dialog,
gint  arg1,
gpointer  user_data 
) [static]

Process the response returned by the library dialog.

Function Description
This function handles the response arg1 of the library dialog dialog.

Parameter user_data is a pointer on the relevant toplevel structure.

Parameters:
[in]dialogThe library dialog.
[in]arg1The 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.

Function Description
This is the callback function that is called every time the user select a row the library treeview of the dialog.

If the selection is not a selection of a footprint, it does nothing. Otherwise it updates the preview and Element data.

Parameters:
[in]selectionThe current selection in the treeview.
[in]user_dataThe 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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static gint library_window_configure_event_cb ( GtkWidget *  widget,
GdkEventConfigure *  ev,
gpointer  data 
) [static]
static GObject* library_window_constructor ( GType  type,
guint  n_construct_properties,
GObjectConstructParam *  construct_params 
) [static]
static gboolean library_window_filter_timeout ( gpointer  data) [static]

Requests re-evaluation of the filter.

Function Description
This is the timeout function for the filtering of footprint in the tree of the dialog.

The timeout this callback is attached to is removed after the function.

Parameters:
[in]dataThe library dialog.
Returns:
FALSE to remove the timeout.

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().

Here is the call graph for this function:

static void library_window_finalize ( GObject *  object) [static]
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.

Function Description
Component row activated handler: As a convenince to the user, expand / contract any node with children.
Parameters:
[in]tree_viewThe component treeview.
[in]pathThe GtkTreePath to the activated row.
[in]columnThe GtkTreeViewColumn in which the activation occurre
[in]user_dataThe 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.

Function Description
Keypress activation handler: If CTRL-C is pressed, copy footprint name into the clipboard.
Parameters:
[in]tree_viewThe component treeview.
[in]eventThe GdkEventKey with keypress info.
[in]user_dataNot used.
Returns:
TRUE if CTRL-C event was handled, FALSE otherwise.

Definition at line 321 of file gui-library-window.c.

References FALSE, MENU_NAME_COLUMN, and TRUE.

Referenced by create_lib_treeview().


Variable Documentation