gschem

x_compselect.c File Reference

#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "gschem.h"
#include <gdk/gdkkeysyms.h>
#include "../include/gschem_dialog.h"
#include "../include/x_preview.h"
#include "../include/x_compselect.h"
Include dependency graph for x_compselect.c:

Go to the source code of this file.

Defines

#define COMPSELECT_FILTER_INTERVAL   200
 The time interval between request and actual filtering.

Enumerations

enum  compselect_view { VIEW_INUSE = 0, VIEW_CLIB }
enum  { PROP_SYMBOL = 1, PROP_BEHAVIOR, PROP_HIDDEN }
enum  { ATTRIBUTE_COLUMN_NAME = 0, ATTRIBUTE_COLUMN_VALUE, NUM_ATTRIBUTE_COLUMNS }

Functions

static enum compselect_view compselect_get_view (Compselect *compselect)
 Return currently active component-selector view.
static void x_compselect_callback_response (GtkDialog *dialog, gint arg1, gpointer user_data)
 Process the response returned by the component selection dialog.
void x_compselect_open (GSCHEM_TOPLEVEL *w_current)
 Opens a component selection dialog.
void x_compselect_close (GSCHEM_TOPLEVEL *w_current)
 Closes the component selection dialog.
void x_compselect_deselect (GSCHEM_TOPLEVEL *w_current)
static void compselect_class_init (CompselectClass *class)
static GObject * compselect_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params)
static void compselect_finalize (GObject *object)
static void compselect_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
static void compselect_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
static void inuse_treeview_set_cell_data (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
 Sets data for a particular cell of the in use treeview.
static void lib_treeview_set_cell_data (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
 Sets data for a particular cell of the library treeview.
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 gint sort_object_text (OBJECT *a, OBJECT *b)
 GCompareFunc to sort an text object list by the object strings.
void update_attributes_model (Compselect *compselect, TOPLEVEL *preview_toplevel)
 Update the model of the attributes treeview.
static void compselect_callback_tree_selection_changed (GtkTreeSelection *selection, gpointer user_data)
 Handles changes in the treeview selection.
static gboolean compselect_filter_timeout (gpointer data)
 Requests re-evaluation of the filter.
static void compselect_callback_filter_entry_changed (GtkEditable *editable, gpointer user_data)
 Callback function for the changed signal of the filter entry.
static void compselect_callback_filter_button_clicked (GtkButton *button, gpointer user_data)
 Handles a click on the clear button.
static void compselect_callback_behavior_changed (GtkOptionMenu *optionmenu, gpointer user_data)
 Handles changes of behavior.
static GtkTreeModel * create_inuse_tree_model (Compselect *compselect)
static GtkTreeModel * create_lib_tree_model (Compselect *compselect)
static void compselect_callback_refresh_library (GtkButton *button, gpointer user_data)
static GtkWidget * create_inuse_treeview (Compselect *compselect)
 Creates the treeview for the "In Use" view.
static GtkWidget * create_lib_treeview (Compselect *compselect)
 Creates the treeview for the "Library" view.
static GtkWidget * create_attributes_treeview (Compselect *compselect)
 Creates the treeview widget for the attributes.
static GtkWidget * create_behaviors_combo_box (void)
 Create the combo box for behaviors.
GType compselect_get_type ()
static void compselect_geometry_save (GschemDialog *dialog, GKeyFile *key_file, gchar *group_name)
 GschemDialog "geometry_save" class method handler.
static void compselect_geometry_restore (GschemDialog *dialog, GKeyFile *key_file, gchar *group_name)
 GschemDialog "geometry_restore" class method handler.
GType compselect_behavior_get_type (void)

Variables

static GObjectClass * compselect_parent_class = NULL

Define Documentation

#define COMPSELECT_FILTER_INTERVAL   200

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 57 of file x_compselect.c.


Enumeration Type Documentation

Enumerator:
VIEW_INUSE 
VIEW_CLIB 

Definition at line 60 of file x_compselect.c.

anonymous enum
Enumerator:
PROP_SYMBOL 
PROP_BEHAVIOR 
PROP_HIDDEN 

Definition at line 287 of file x_compselect.c.

anonymous enum
Enumerator:
ATTRIBUTE_COLUMN_NAME 
ATTRIBUTE_COLUMN_VALUE 
NUM_ATTRIBUTE_COLUMNS 

Definition at line 471 of file x_compselect.c.


Function Documentation

static enum compselect_view compselect_get_view ( Compselect compselect) [static]
Function Description
This function returns which one of the possible views is active in the component selector: VIEW_INUSE for the in-use view, or VIEW_CLIB for the component library view.
Todo:
FIXME: This function assumes the GtkNotebook pages displaying the views are in a specific order.
Parameters:
[in]compselectThe component selection dialog.
Returns:
The currently active view (from the compselect_view enum).

Definition at line 80 of file x_compselect.c.

static void x_compselect_callback_response ( GtkDialog *  dialog,
gint  arg1,
gpointer  user_data 
) [static]
Function Description
This function handles the response arg1 of the component selection dialog dialog.

Parameter user_data is a pointer on the relevant toplevel structure.

Parameters:
[in]dialogThe component selection dialog.
[in]arg1The response ID.
[in]user_dataA pointer on the GSCHEM_TOPLEVEL environment.

Definition at line 105 of file x_compselect.c.

Here is the call graph for this function:

void x_compselect_open ( GSCHEM_TOPLEVEL w_current)
Function Description
This function opens the component chooser dialog for toplevel if it is not already. In this last case, it only raises the dialog.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL environment.

Definition at line 207 of file x_compselect.c.

Here is the call graph for this function:

void x_compselect_close ( GSCHEM_TOPLEVEL w_current)
Function Description
This function closes the component chooser dialog associated with toplevel.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL environment.

Definition at line 254 of file x_compselect.c.

void x_compselect_deselect ( GSCHEM_TOPLEVEL w_current)

Definition at line 265 of file x_compselect.c.

Here is the call graph for this function:

static void compselect_class_init ( CompselectClass class) [static]

Definition at line 1320 of file x_compselect.c.

Here is the call graph for this function:

static GObject * compselect_constructor ( GType  type,
guint  n_construct_properties,
GObjectConstructParam *  construct_params 
) [static]

Definition at line 1360 of file x_compselect.c.

Here is the call graph for this function:

static void compselect_finalize ( GObject *  object) [static]

Definition at line 1491 of file x_compselect.c.

static void compselect_set_property ( GObject *  object,
guint  property_id,
const GValue *  value,
GParamSpec *  pspec 
) [static]

Definition at line 1504 of file x_compselect.c.

static void compselect_get_property ( GObject *  object,
guint  property_id,
GValue *  value,
GParamSpec *  pspec 
) [static]

Definition at line 1530 of file x_compselect.c.

Here is the call graph for this function:

static void inuse_treeview_set_cell_data ( GtkTreeViewColumn *  tree_column,
GtkCellRenderer *  cell,
GtkTreeModel *  tree_model,
GtkTreeIter *  iter,
gpointer  data 
) [static]
Function Description
This function determines what data is to be displayed in the "in use" symbol selection view.

The model is a list of symbols. s_clib_symbol_get_name() is called to get the text to display.

Definition at line 321 of file x_compselect.c.

static void lib_treeview_set_cell_data ( GtkTreeViewColumn *  tree_column,
GtkCellRenderer *  cell,
GtkTreeModel *  tree_model,
GtkTreeIter *  iter,
gpointer  data 
) [static]
Function Description
This function determines what data is to be displayed in the selection selection view.

The top level of the model contains sources, and the next symbols. s_clib_source_get_name() or s_clib_symbol_get_name() as appropriate is called to get the text to display.

Definition at line 343 of file x_compselect.c.

static gboolean lib_model_filter_visible_func ( GtkTreeModel *  model,
GtkTreeIter *  iter,
gpointer  data 
) [static]
Function Description
This is the function used to filter entries of the component selection tree.
Parameters:
[in]modelThe current selection in the treeview.
[in]iterAn iterator on a component or folder in the tree.
[in]dataThe component selection dialog.
Returns:
TRUE if item should be visible, FALSE otherwise.

Definition at line 377 of file x_compselect.c.

static void tree_row_activated ( GtkTreeView *  tree_view,
GtkTreePath *  path,
GtkTreeViewColumn *  column,
gpointer  user_data 
) [static]
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 occurred.
[in]user_dataThe component selection dialog.

Definition at line 439 of file x_compselect.c.

static gint sort_object_text ( OBJECT *  a,
OBJECT *  b 
) [static]

Definition at line 466 of file x_compselect.c.

void update_attributes_model ( Compselect compselect,
TOPLEVEL *  preview_toplevel 
)
Function Description
This function takes the toplevel attributes from the preview widget and puts them into the model of the attrtreeview widget.
Parameters:
[in]compselectThe dialog compselect
[in]preview_toplevelThe toplevel of the preview widget

Definition at line 485 of file x_compselect.c.

Here is the call graph for this function:

static void compselect_callback_tree_selection_changed ( GtkTreeSelection *  selection,
gpointer  user_data 
) [static]
Function Description
This is the callback function that is called every time the user select a row in either component treeview of the dialog.

If the selection is not a selection of a component (a directory name), it does nothing. Otherwise it retrieves the #CLibSymbol from the model.

It then emits the dialog's apply signal to let its parent know that a component has been selected.

Parameters:
[in]selectionThe current selection in the treeview.
[in]user_dataThe component selection dialog.

Definition at line 569 of file x_compselect.c.

Here is the call graph for this function:

static gboolean compselect_filter_timeout ( gpointer  data) [static]
Function Description
This is the timeout function for the filtering of component in the tree of the dialog.

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

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

Definition at line 625 of file x_compselect.c.

static void compselect_callback_filter_entry_changed ( GtkEditable *  editable,
gpointer  user_data 
) [static]
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 component list by re-evaluating filter at every changes.

Parameters:
[in]editableThe filter text entry.
[in]user_dataThe component selection dialog.

Definition at line 663 of file x_compselect.c.

Here is the call graph for this function:

static void compselect_callback_filter_button_clicked ( GtkButton *  button,
gpointer  user_data 
) [static]
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]buttonThe clear button
[in]user_dataThe component selection dialog.

Definition at line 704 of file x_compselect.c.

static void compselect_callback_behavior_changed ( GtkOptionMenu *  optionmenu,
gpointer  user_data 
) [static]
Function Description
This function is called every time the value of the option menu for behaviors is modified.

It emits the dialog's apply signal to let the parent know that the requested behavior for the next adding of a component has been changed.

Parameters:
[in]optionmenuThe behavior option menu.
[in]user_dataThe component selection dialog.

Definition at line 727 of file x_compselect.c.

static GtkTreeModel* create_inuse_tree_model ( Compselect compselect) [static]

Definition at line 744 of file x_compselect.c.

static GtkTreeModel* create_lib_tree_model ( Compselect compselect) [static]

Definition at line 776 of file x_compselect.c.

static void compselect_callback_refresh_library ( GtkButton *  button,
gpointer  user_data 
) [static]

Definition at line 821 of file x_compselect.c.

Here is the call graph for this function:

static GtkWidget* create_inuse_treeview ( Compselect compselect) [static]

Definition at line 868 of file x_compselect.c.

Here is the call graph for this function:

static GtkWidget* create_lib_treeview ( Compselect compselect) [static]

Definition at line 971 of file x_compselect.c.

Here is the call graph for this function:

static GtkWidget* create_attributes_treeview ( Compselect compselect) [static]

Definition at line 1146 of file x_compselect.c.

static GtkWidget* create_behaviors_combo_box ( void  ) [static]
Function Description
This function creates and returns a GtkComboBox for selecting the behavior when a component is added to the sheet.

Definition at line 1208 of file x_compselect.c.

GType compselect_get_type ( void  )

Definition at line 1231 of file x_compselect.c.

Here is the call graph for this function:

static void compselect_geometry_save ( GschemDialog dialog,
GKeyFile *  key_file,
gchar *  group_name 
) [static]
Function Description
Chain up to our parent's method to save the dialog's size and position, then save the dialog's current internal geometry.
Parameters:
[in]dialogThe GschemDialog to save the geometry of.
[in]key_fileThe GKeyFile to save the geometry data to.
[in]group_nameThe group name in the key file to store the data under.

Definition at line 1268 of file x_compselect.c.

Here is the call graph for this function:

static void compselect_geometry_restore ( GschemDialog dialog,
GKeyFile *  key_file,
gchar *  group_name 
) [static]
Function Description
Chain up to our parent's method to restore the dialog's size and position, then restore the dialog's current internal geometry.
Parameters:
[in]dialogThe GschemDialog to restore the geometry of.
[in]key_fileThe GKeyFile to save the geometry data to.
[in]group_nameThe group name in the key file to store the data under.

Definition at line 1298 of file x_compselect.c.

Here is the call graph for this function:

GType compselect_behavior_get_type ( void  )

Definition at line 1586 of file x_compselect.c.


Variable Documentation

GObjectClass* compselect_parent_class = NULL [static]

Definition at line 293 of file x_compselect.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines