gschem

x_autonumber.c File Reference

#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include "gschem.h"
#include <gdk/gdkkeysyms.h>
Include dependency graph for x_autonumber.c:

Go to the source code of this file.

Data Structures

struct  autonumber_text_t
 Stored state of the autonumber text dialog. More...
struct  autonumber_slot_t

Defines

#define GLADE_HOOKUP_OBJECT(component, widget, name)
#define HISTORY_LENGTH   15
 How many entries to keep in the "Search text" combo box.

Typedefs

typedef struct autonumber_text_t AUTONUMBER_TEXT
typedef struct autonumber_slot_t AUTONUMBER_SLOT

Enumerations

enum  {
  AUTONUMBER_SORT_DIAGONAL, AUTONUMBER_SORT_YX, AUTONUMBER_SORT_YX_REV, AUTONUMBER_SORT_XY,
  AUTONUMBER_SORT_XY_REV, AUTONUMBER_SORT_FILE
}
enum  { AUTONUMBER_IGNORE, AUTONUMBER_RENUMBER, AUTONUMBER_RESPECT }
enum  { SCOPE_SELECTED, SCOPE_PAGE, SCOPE_HIERARCHY }

Functions

gint autonumber_sort_numbers (gconstpointer a, gconstpointer b)
 GCompareFunc function to sort a list with g_list_sort().
gint autonumber_sort_xy (gconstpointer a, gconstpointer b)
 GCompareFunc function to sort text objects by there location.
gint autonumber_sort_xy_rev (gconstpointer a, gconstpointer b)
 GCompareFunc function to sort text objects by there location.
int autonumber_sort_yx (gconstpointer a, gconstpointer b)
 GCompareFunc function to sort text objects by there location.
int autonumber_sort_yx_rev (gconstpointer a, gconstpointer b)
 GCompareFunc function to sort text objects by there location.
int autonumber_sort_diagonal (gconstpointer a, gconstpointer b)
 GCompareFunc function to sort text objects by there location.
gint freeslot_compare (gconstpointer a, gconstpointer b)
 GCompareFunc function to acces AUTONUMBER_SLOT object in a GList.
void freeslot_print (GList *list)
 Prints a GList of AUTONUMBER_SLOT elements.
void autonumber_clear_database (AUTONUMBER_TEXT *autotext)
 Function to clear the databases of used parts.
gint autonumber_match (AUTONUMBER_TEXT *autotext, OBJECT *o_current, gint *number)
 Function to test, whether the OBJECT matches the autotext criterias.
void autonumber_get_used (GSCHEM_TOPLEVEL *w_current, AUTONUMBER_TEXT *autotext)
 Creates a list of already numbered objects and slots.
void autonumber_get_new_numbers (AUTONUMBER_TEXT *autotext, OBJECT *o_current, gint *number, gint *slot)
 Gets or generates free numbers for the autonumbering process.
void autonumber_remove_number (AUTONUMBER_TEXT *autotext, OBJECT *o_current)
 Removes the number from the element.
void autonumber_apply_new_text (AUTONUMBER_TEXT *autotext, OBJECT *o_current, gint number, gint slot)
 Changes the number OBJECT element. Changes the slot attribute.
void autonumber_text_autonumber (AUTONUMBER_TEXT *autotext)
 Handles all the options of the autonumber text dialog.
GtkWidget * lookup_widget (GtkWidget *widget, const gchar *widget_name)
 Finds a widget by its name given a pointer to its parent.
void autonumber_sortorder_create (GSCHEM_TOPLEVEL *w_current, GtkWidget *sort_order)
 Put the icons and the text into the sortorder combobox.
GList * autonumber_history_add (GList *history, gchar *text)
 Adds a line to the search text history list.
AUTONUMBER_TEXTautonumber_init_state ()
 Allocate and initialize the state structure.
void autonumber_set_state (AUTONUMBER_TEXT *autotext)
 Restore the settings for the autonumber text dialog.
void autonumber_get_state (AUTONUMBER_TEXT *autotext)
 Get the settings from the autonumber text dialog.
void autonumber_text_response (GtkWidget *widget, gint response, AUTONUMBER_TEXT *autotext)
 response callback for the autonumber text dialog
void autonumber_removenum_toggled (GtkWidget *opt_removenum, AUTONUMBER_TEXT *autotext)
 Callback that activates or deactivates "overwrite existing numbers" check box.
GtkWidget * autonumber_create_dialog (GSCHEM_TOPLEVEL *w_current)
 Creates the autonumber text dialog.
void autonumber_text_dialog (GSCHEM_TOPLEVEL *w_current)
 Create or restore the autonumber text dialog.

Define Documentation

#define GLADE_HOOKUP_OBJECT (   component,
  widget,
  name 
)
Value:
g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

Definition at line 39 of file x_autonumber.c.

#define HISTORY_LENGTH   15

Definition at line 44 of file x_autonumber.c.


Typedef Documentation

Definition at line 68 of file x_autonumber.c.

Definition at line 110 of file x_autonumber.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
AUTONUMBER_SORT_DIAGONAL 
AUTONUMBER_SORT_YX 
AUTONUMBER_SORT_YX_REV 
AUTONUMBER_SORT_XY 
AUTONUMBER_SORT_XY_REV 
AUTONUMBER_SORT_FILE 

Definition at line 47 of file x_autonumber.c.

anonymous enum
Enumerator:
AUTONUMBER_IGNORE 
AUTONUMBER_RENUMBER 
AUTONUMBER_RESPECT 

Definition at line 56 of file x_autonumber.c.

anonymous enum
Enumerator:
SCOPE_SELECTED 
SCOPE_PAGE 
SCOPE_HIERARCHY 

Definition at line 62 of file x_autonumber.c.


Function Documentation

gint autonumber_sort_numbers ( gconstpointer  a,
gconstpointer  b 
)
Function Description
Compares the integer values of the gconstpointers a and b.
Returns:
-1 if a<b, 1 if a>b, 0 if a==b

Definition at line 128 of file x_autonumber.c.

gint autonumber_sort_xy ( gconstpointer  a,
gconstpointer  b 
)
Function Description
This Funcion takes two OBJECT* arguments and compares the location of the two text objects. The first sort criteria is the x location, the second sort criteria is the y location. The Function is used as GCompareFunc by g_list_sort().

Definition at line 143 of file x_autonumber.c.

gint autonumber_sort_xy_rev ( gconstpointer  a,
gconstpointer  b 
)
Function Description
This funcion takes two OBJECT* arguments and compares the location of the two text objects. The first sort criteria is the x location, the second sort criteria is the y location. This function sorts the objects in reverse order. The function is used as GCompareFunc by g_list_sort().

Definition at line 166 of file x_autonumber.c.

int autonumber_sort_yx ( gconstpointer  a,
gconstpointer  b 
)
Function Description
This funcion takes two OBJECT* arguments and compares the location of the two text objects. The first sort criteria is the y location, the second sort criteria is the x location. The function is used as GCompareFunc by g_list_sort().

Definition at line 188 of file x_autonumber.c.

int autonumber_sort_yx_rev ( gconstpointer  a,
gconstpointer  b 
)
Function Description
This Funcion takes two OBJECT* arguments and compares the location of the two text objects. The first sort criteria is the y location, the second sort criteria is the x location. This function sorts the objects in reverse order. The function is used as GCompareFunc by g_list_sort().

Definition at line 211 of file x_autonumber.c.

int autonumber_sort_diagonal ( gconstpointer  a,
gconstpointer  b 
)
Function Description
This Funcion takes two OBJECT* arguments and compares the location of the two text objects. The sort criteria is the combined x- and the y-location. The function sorts from top left to bottom right. The function is used as GCompareFunc by g_list_sort().

Definition at line 233 of file x_autonumber.c.

gint freeslot_compare ( gconstpointer  a,
gconstpointer  b 
)
Function Description
This Funcion takes two AUTONUMBER_SLOT* arguments and compares them. Sorting criteria is are the AUTONUMBER_SLOT members: first the symbolname, than the number and last the slotnr. If the number or the slotnr is set to zero it acts as a wildcard. The function is used as GCompareFunc by GList functions.

Definition at line 251 of file x_autonumber.c.

void freeslot_print ( GList *  list)
Function Description
This funcion prints the elements of a GList that contains AUTONUMBER_SLOT elements It is only used for debugging purposes.

Definition at line 284 of file x_autonumber.c.

void autonumber_clear_database ( AUTONUMBER_TEXT autotext)
Function Descriptions
Just remove the list of used numbers, used slots and free slots.

Definition at line 300 of file x_autonumber.c.

gint autonumber_match ( AUTONUMBER_TEXT autotext,
OBJECT *  o_current,
gint *  number 
)
Function Description
The criterias are those of the autonumber text dialog. The function decides whether the OBJECT has to be renumberd, ignored or taken care of when renumbering all other objects.
Returns:
one of these integer values: AUTONUMBER_IGNORE, AUTONUMBER_RESPECT or AUTONUMBER_RENUMBER and the current number of the text object in *number.

Definition at line 328 of file x_autonumber.c.

void autonumber_get_used ( GSCHEM_TOPLEVEL w_current,
AUTONUMBER_TEXT autotext 
)
Function Description
This function collects the used numbers of a single schematic page. The used element numbers are stored in a GList container inside the AUTONUMBER_TEXT struct. The slotting container is a little bit different. It stores free slots of multislotted symbols, that were used only partially. The criterias are derivated from the autonumber dialog entries.

Definition at line 388 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_get_new_numbers ( AUTONUMBER_TEXT autotext,
OBJECT *  o_current,
gint *  number,
gint *  slot 
)
Function Description
This function gets or generates new numbers for the OBJECT o_current. It uses the element numbers used_numbers and the list of the free slots free_slots of the AUTONUMBER_TEXT struct.
Returns:
The new number is returned into the number parameter. slot is set if autoslotting is active, else it is set to zero.

Definition at line 482 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_remove_number ( AUTONUMBER_TEXT autotext,
OBJECT *  o_current 
)

This function updates the text content of the o_current object.

Parameters:
autotextPointer to the state structure
o_currentPointer to the object from which to remove the number

Definition at line 569 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_apply_new_text ( AUTONUMBER_TEXT autotext,
OBJECT *  o_current,
gint  number,
gint  slot 
)
Function Description
This function updates the text content of the o_current object. If the slot value is not zero. It updates the slot attribut of the complex element that is also the parent object of the o_current element.

Definition at line 603 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_text_autonumber ( AUTONUMBER_TEXT autotext)
Function Description
This function is the master of all autonumber code. It receives the options of the the autonumber text dialog in an AUTONUMBER_TEXT structure. First it collects all pages of a hierarchical schematic. Second it gets all matching text elements for the searchtext. Then it renumbers all text elements of all schematic pages. The renumbering follows the rules of the parameters given in the autonumber text dialog.

Definition at line 631 of file x_autonumber.c.

Here is the call graph for this function:

GtkWidget* lookup_widget ( GtkWidget *  widget,
const gchar *  widget_name 
)
Parameters:
widgetPointer to the parent widget.
widget_nameName of the widget.
Returns:
Pointer to the widget or NULL if not found.

Definition at line 830 of file x_autonumber.c.

void autonumber_sortorder_create ( GSCHEM_TOPLEVEL w_current,
GtkWidget *  sort_order 
)
Function Description
Load all bitmaps for the combobox and store them together with the label in a GtkListStore.

Definition at line 845 of file x_autonumber.c.

GList* autonumber_history_add ( GList *  history,
gchar *  text 
)

Function makes sure that: 1) There are no duplicates in the list and 2) the last search text is always at the top of the list.

Definition at line 903 of file x_autonumber.c.

AUTONUMBER_TEXT* autonumber_init_state ( )
Returns:
Pointer to the allocated structure or NULL on error.

Definition at line 943 of file x_autonumber.c.

void autonumber_set_state ( AUTONUMBER_TEXT autotext)
Parameters:
autotextPointer to the state struct.

Definition at line 998 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_get_state ( AUTONUMBER_TEXT autotext)

Get the settings from the autonumber text dialog and store it in the AUTONUMBER_TEXT structure.

Parameters:
autotextPointer to the state struct.

Definition at line 1060 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_text_response ( GtkWidget *  widget,
gint  response,
AUTONUMBER_TEXT autotext 
)
Function Description
The function just closes the dialog if the close button is pressed or the user closes the dialog window. Triggering the apply button will call the autonumber action functions.

Definition at line 1106 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_removenum_toggled ( GtkWidget *  opt_removenum,
AUTONUMBER_TEXT autotext 
)

This gets called each time "remove numbers" check box gets clicked.

Definition at line 1138 of file x_autonumber.c.

Here is the call graph for this function:

GtkWidget* autonumber_create_dialog ( GSCHEM_TOPLEVEL w_current)

Dialog is not shown. No callbacks are registered. This is basically unmodified code returned by Glade.

Only modification was the following substitution:

s/create_pixmap (autonumber_text, "\(.*\)")/autonumber_create_pixmap("gschem-\1", w_current)/

and addition of the "w_current" parameter.

Parameters:
w_currentPointer to the top level struct.
Returns:
Pointer to the dialog window.

Definition at line 1170 of file x_autonumber.c.

Here is the call graph for this function:

void autonumber_text_dialog ( GSCHEM_TOPLEVEL w_current)

If the function is called the first time the dialog is created. If the dialog is only in background it is moved to the foreground.

Parameters:
w_currentPointer to the top level struct

Definition at line 1373 of file x_autonumber.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines