libgeda

o_complex_basic.c File Reference

Functions for complex objects. More...

#include <config.h>
#include <stdio.h>
#include <math.h>
#include "libgeda_priv.h"
Include dependency graph for o_complex_basic.c:

Go to the source code of this file.

Functions

int world_get_single_object_bounds (TOPLEVEL *toplevel, OBJECT *o_current, int *rleft, int *rtop, int *rright, int *rbottom)
 Return the bounds of the given object.
int world_get_object_glist_bounds (TOPLEVEL *toplevel, const GList *head, int *left, int *top, int *right, int *bottom)
 Return the bounds of the given GList of objects.
void world_get_complex_bounds (TOPLEVEL *toplevel, OBJECT *complex, int *left, int *top, int *right, int *bottom)
 Queries the bounds of a complex object.
gboolean o_complex_get_position (TOPLEVEL *toplevel, gint *x, gint *y, OBJECT *object)
 get the position of the complex base point
static int o_complex_is_eligible_attribute (TOPLEVEL *toplevel, OBJECT *object)
 check whether an object is a attributes
int o_complex_is_embedded (OBJECT *o_current)
 get the embedded state of an complex object
GList * o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach)
 Get attributes eligible for promotion from inside a complex.
GList * o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object)
 Promote attributes from a complex OBJECT.
static void o_complex_remove_promotable_attribs (TOPLEVEL *toplevel, OBJECT *object)
 Delete or hide promotable from the passed OBJECT.
static void create_placeholder (TOPLEVEL *toplevel, OBJECT *new_node, int x, int y)
OBJECTo_complex_new (TOPLEVEL *toplevel, char type, int color, int x, int y, int angle, int mirror, const CLibSymbol *clib, const gchar *basename, int selectable)
OBJECTo_complex_new_embedded (TOPLEVEL *toplevel, char type, int color, int x, int y, int angle, int mirror, const gchar *basename, int selectable)
 create a new embedded object
void o_complex_recalc (TOPLEVEL *toplevel, OBJECT *o_current)
 update the visual boundaries of the complex object
OBJECTo_complex_read (TOPLEVEL *toplevel, const char buf[], unsigned int release_ver, unsigned int fileformat_ver, GError **err)
 read a complex object from a char buffer
char * o_complex_save (TOPLEVEL *toplevel, OBJECT *object)
 Create a string representation of the complex object.
void o_complex_translate_world (TOPLEVEL *toplevel, int dx, int dy, OBJECT *object)
 move a complex object
OBJECTo_complex_copy (TOPLEVEL *toplevel, OBJECT *o_current)
 Create a copy of a COMPLEX object.
void o_complex_rotate_world (TOPLEVEL *toplevel, int centerx, int centery, int angle, OBJECT *object)
void o_complex_mirror_world (TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object)
OBJECTo_complex_find_pin_by_attribute (OBJECT *object, char *name, char *wanted_value)
 Find a pin with a particular attribute.
void o_complex_check_symversion (TOPLEVEL *toplevel, OBJECT *object)
 check the symversion of a complex object
double o_complex_shortest_distance (OBJECT *object, int x, int y, int force_solid)
 Calculates the distance between the given point and the closest point on an object within the complex object.

Detailed Description

Complex objects are collections of primary objects.

Definition in file o_complex_basic.c.


Function Documentation

int world_get_single_object_bounds ( TOPLEVEL toplevel,
OBJECT o_current,
int *  rleft,
int *  rtop,
int *  rright,
int *  rbottom 
)
Given an object, calculate the bounds coordinates.
Parameters:
[in]toplevelThe toplevel structure.
[in]o_currentThe object to look the bounds for.
[out]rleftpointer to the left coordinate of the object.
[out]rtoppointer to the top coordinate of the object.
[out]rrightpointer to the right coordinate of the object.
[out]rbottompointer to the bottom coordinate of the object.
Returns:
If any bounds were found for the object
Return values:
0No bound was found
1Bound was found

Definition at line 57 of file o_complex_basic.c.

Here is the call graph for this function:

int world_get_object_glist_bounds ( TOPLEVEL toplevel,
const GList *  head,
int *  left,
int *  top,
int *  right,
int *  bottom 
)
Given a list of objects, calcule the bounds coordinates.
Parameters:
[in]toplevelThe TOPLEVEL structure.
[in]headThe list of objects to look the bounds for.
[out]leftpointer to the left coordinate of the object.
[out]toppointer to the top coordinate of the object.
[out]rightpointer to the right coordinate of the object.
[out]bottompointer to the bottom coordinate of the object.
Returns:
If any bounds were found for the list of objects
Return values:
0No bounds were found
1Bound was found

Definition at line 113 of file o_complex_basic.c.

Here is the call graph for this function:

void world_get_complex_bounds ( TOPLEVEL toplevel,
OBJECT complex,
int *  left,
int *  top,
int *  right,
int *  bottom 
)
Function Description
This function returns the bounding box of the complex object object.
Parameters:
[in]toplevelThe toplevel environment.
[in]complexThe complex object.
[out]leftThe leftmost edge of the bounding box (in world units).
[out]topThe upper edge of the bounding box (in world units).
[out]rightThe rightmost edge of the bounding box (in world units).
[out]bottomThe bottom edge of the bounding box (in screen units).

Definition at line 165 of file o_complex_basic.c.

Here is the call graph for this function:

gboolean o_complex_get_position ( TOPLEVEL toplevel,
gint *  x,
gint *  y,
OBJECT object 
)
Function Description
This function gets the position of the base point of a complex object.
Parameters:
[in]toplevelThe toplevel environment.
[out]xpointer to the x-position
[out]ypointer to the y-position
[in]objectThe object to get the position.
Returns:
TRUE if successfully determined the position, FALSE otherwise

Definition at line 187 of file o_complex_basic.c.

static int o_complex_is_eligible_attribute ( TOPLEVEL toplevel,
OBJECT object 
) [static]
Function Description
This function checks if an object should be promoted. An attribute object is promotable if it's promoted by default, or the user has configered it to promote an attribute.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]objectThe attribute object to check
Returns:
TRUE if the object is a eligible attribute, FALSE otherwise

Definition at line 205 of file o_complex_basic.c.

Here is the call graph for this function:

int o_complex_is_embedded ( OBJECT o_current)
Function Description
Checks and returns the status of the complex object.
Parameters:
o_currentThe object to check
Returns:
1 if embedded, 0 otherwise

Definition at line 245 of file o_complex_basic.c.

GList* o_complex_get_promotable ( TOPLEVEL toplevel,
OBJECT object,
int  detach 
)
Function Description
Returns a GList of OBJECTs which are eligible for promotion from within the passed complex OBJECT.

If detach is TRUE, the function removes these attribute objects from the prim_objs of the complex. If detach is FALSE, the OBJECTs are left in place.

Parameters:
[in]toplevelThe toplevel environment.
[in]objectThe complex object being modified.
[in]detachShould the attributes be detached?
Returns:
A linked list of OBJECTs to promote.

Definition at line 275 of file o_complex_basic.c.

Here is the call graph for this function:

GList* o_complex_promote_attribs ( TOPLEVEL toplevel,
OBJECT object 
)
Function Description
Selects promotable attributes from object, and returns a new #GList containing them (suitable for appending to a PAGE).
Parameters:
[in]toplevelThe TOPLEVEL environment.
[in]objectThe complex OBJECT to promote from.
Returns:
A #GList of promoted attributes.

Definition at line 319 of file o_complex_basic.c.

Here is the call graph for this function:

static void o_complex_remove_promotable_attribs ( TOPLEVEL toplevel,
OBJECT object 
) [static]
Function Description
Deletes or hides promotable attributes from the passed OBJECT. This is used when loading symbols during the load of a schematic from disk. The schematic will already contain local copies of symbol's promotable objects, so we delete or hide the symbol's copies.

Deletion / hiding is dependant on the setting of toplevel->keep_invisible. If true, attributes eligible for promotion are kept in memory but flagged as invisible.

Parameters:
[in]toplevelThe toplevel environment.
[in]objectThe complex object being altered.

Definition at line 374 of file o_complex_basic.c.

Here is the call graph for this function:

static void create_placeholder ( TOPLEVEL toplevel,
OBJECT new_node,
int  x,
int  y 
) [static]

Definition at line 398 of file o_complex_basic.c.

Here is the call graph for this function:

OBJECT* o_complex_new ( TOPLEVEL toplevel,
char  type,
int  color,
int  x,
int  y,
int  angle,
int  mirror,
const CLibSymbol clib,
const gchar *  basename,
int  selectable 
)
Function Description

Definition at line 481 of file o_complex_basic.c.

Here is the call graph for this function:

OBJECT* o_complex_new_embedded ( TOPLEVEL toplevel,
char  type,
int  color,
int  x,
int  y,
int  angle,
int  mirror,
const gchar *  basename,
int  selectable 
)
Function Description
This function creates a new embedded object.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]typeThe type of the object (usually OBJ_COMLEX)
[in]colorThe color of the object
[in]xThe x location of the complex object
[in]yThe y location of the complex object
[in]angleThe rotation angle
[in]mirrorThe mirror status
[in]basenameThe basic name the embedded was created of
[in]selectablewhether the object can be selected with the mouse
Returns:
a new complex object

Definition at line 568 of file o_complex_basic.c.

Here is the call graph for this function:

void o_complex_recalc ( TOPLEVEL toplevel,
OBJECT o_current 
)
Function Description
This function updates the boundaries of the object o_current.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]o_currentThe OBJECT to update

Definition at line 604 of file o_complex_basic.c.

Here is the call graph for this function:

OBJECT* o_complex_read ( TOPLEVEL toplevel,
const char  buf[],
unsigned int  release_ver,
unsigned int  fileformat_ver,
GError **  err 
)
Function Description
This function reads a complex object from the buffer buf. If the complex object was read successfully, a new object is allocated and appended to the object_list.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]bufa text buffer (usually a line of a schematic file)
[in]release_verThe release number gEDA
[in]fileformat_vera integer value of the file format
Returns:
The object list, or NULL on error.

Definition at line 638 of file o_complex_basic.c.

Here is the call graph for this function:

char* o_complex_save ( TOPLEVEL toplevel,
OBJECT object 
)
Function Description
This function takes a complex object and return a string according to the file format definition.
Parameters:
[in]toplevela TOPLEVEL structure
[in]objecta complex OBJECT
Returns:
the string representation of the complex OBJECT

Definition at line 718 of file o_complex_basic.c.

void o_complex_translate_world ( TOPLEVEL toplevel,
int  dx,
int  dy,
OBJECT object 
)
Function Description
This function changes the position of a complex object.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]dxThe x-distance to move the object
[in]dyThe y-distance to move the object
[in]objectThe complex OBJECT to be moved

Definition at line 753 of file o_complex_basic.c.

Here is the call graph for this function:

OBJECT* o_complex_copy ( TOPLEVEL toplevel,
OBJECT o_current 
)
Function Description
This function creates a copy of the complex object o_current.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]o_currentThe object that is copied
Returns:
a new COMPLEX object

Definition at line 776 of file o_complex_basic.c.

Here is the call graph for this function:

void o_complex_rotate_world ( TOPLEVEL toplevel,
int  centerx,
int  centery,
int  angle,
OBJECT object 
)
Todo:
Finish function documentation!!!
Function Description

Definition at line 829 of file o_complex_basic.c.

Here is the call graph for this function:

void o_complex_mirror_world ( TOPLEVEL toplevel,
int  world_centerx,
int  world_centery,
OBJECT object 
)
Todo:
Finish function documentation!!!
Function Description

Definition at line 867 of file o_complex_basic.c.

Here is the call graph for this function:

OBJECT* o_complex_find_pin_by_attribute ( OBJECT object,
char *  name,
char *  wanted_value 
)
Function Description
Search for a pin inside the given complex which has an attribute matching those passed.
Parameters:
[in]objectcomplex OBJECT whos pins to search.
[in]namethe attribute name to search for.
[in]wanted_valuethe attribute value to search for.
Returns:
The pin OBJECT with the given attribute, NULL otherwise.

Definition at line 914 of file o_complex_basic.c.

Here is the call graph for this function:

void o_complex_check_symversion ( TOPLEVEL toplevel,
OBJECT object 
)
Function Description
This function compares the symversion of a symbol with it's earlier saved symversion in a schematic. Major symversion changes are added to the toplevel object (toplevel->major_changed_refdes), minor changes are reported to the messaging system.
Parameters:
toplevelThe TOPLEVEL object
objectThe complex OBJECT

Definition at line 956 of file o_complex_basic.c.

Here is the call graph for this function:

double o_complex_shortest_distance ( OBJECT object,
int  x,
int  y,
int  force_solid 
)
Note:
When querying the distance to our child objects, we always force treating them as solid filled. We ignore the force_solid argument to this function.
Parameters:
[in]objectThe complex OBJECT.
[in]xThe x coordinate of the given point.
[in]yThe y coordinate of the given point.
[in]force_solidIf true, force treating the object as solid.
Returns:
The shortest distance from the object to the point. If the distance cannot be calculated, this function returns a really large number (G_MAXDOUBLE). With an invalid parameter, this function returns G_MAXDOUBLE.

Definition at line 1141 of file o_complex_basic.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines