gattrib

s_object.c File Reference

Functions for manipulating OBJECTs. More...

#include <config.h>
#include <stdio.h>
#include <math.h>
#include <libgeda/libgeda.h>
#include "../include/struct.h"
#include "../include/prototype.h"
#include "../include/globals.h"
Include dependency graph for s_object.c:

Go to the source code of this file.

Defines

#define DEFAULT_TEXT_SIZE   10

Functions

void s_object_add_comp_attrib_to_object (TOPLEVEL *toplevel, OBJECT *o_current, char *new_attrib_name, char *new_attrib_value, gint visibility, gint show_name_value)
 Add an attribute to an OBJECT.
void s_object_add_net_attrib_to_object (TOPLEVEL *toplevel, OBJECT *o_current, char *new_attrib_name, char *new_attrib_value)
void s_object_add_pin_attrib_to_object (TOPLEVEL *toplevel, OBJECT *o_current, char *new_attrib_name, char *new_attrib_value)
 Add a new attribute to an pin OBJECT.
void s_object_replace_attrib_in_object (TOPLEVEL *toplevel, OBJECT *o_current, char *new_attrib_name, char *new_attrib_value, gint visibility, gint show_name_value)
 Replace attribute value in object.
void s_object_remove_attrib_in_object (TOPLEVEL *toplevel, OBJECT *o_current, char *new_attrib_name)
 Remove attribute from object.
OBJECT * s_object_attrib_add_attrib_in_object (TOPLEVEL *toplevel, char *text_string, int visibility, int show_name_value, OBJECT *object)
 Attach attribute to object.
void s_object_delete_text_object_in_object (TOPLEVEL *toplevel, OBJECT *text_object)
 Delete text object.
int s_object_has_sym_file (OBJECT *object)
 Ensure object has a symbol file.

Detailed Description

This file holds functions involved in manipulating the OBJECT data structure. OBJECT is defined in libgeda. An OBJECT is a graphical primitive normally used in gschem. Example OBJECTs: some text, a component (complex), a pin, a line, etc.

The functions herein are functions which I wrote as wrappers to the fcns in libgeda.

Definition in file s_object.c.


Define Documentation

#define DEFAULT_TEXT_SIZE   10

Definition at line 57 of file s_object.c.


Function Documentation

void s_object_add_comp_attrib_to_object ( TOPLEVEL *  toplevel,
OBJECT *  o_current,
char *  new_attrib_name,
char *  new_attrib_value,
gint  visibility,
gint  show_name_value 
)

This fcn adds a new attrib to o_current, when o_current is a component. It does it in the following way:

  1. It creates an object -- "attrib_graphic" -- and fills it in.
  2. It gets the position info from o_current's refdes attrib and calls o_text_new() to add position info and name=value string to attrib_graphic.
  3. It calls o_attrib_add() to wrap attrib_graphic with (attribute OBJECT )
    Parameters:
    toplevelTOPLEVEL structure
    o_currentpointer to object to add attribute to
    new_attrib_namename of the attribute to add
    new_attrib_valuevalue of the attribute to add
    visibilityIs the attribute visible?
    show_name_valueControl visibility of name and value.

Definition at line 81 of file s_object.c.

Here is the call graph for this function:

void s_object_add_net_attrib_to_object ( TOPLEVEL *  toplevel,
OBJECT *  o_current,
char *  new_attrib_name,
char *  new_attrib_value 
)
Todo:
This needs to be filled in.

Definition at line 111 of file s_object.c.

void s_object_add_pin_attrib_to_object ( TOPLEVEL *  toplevel,
OBJECT *  o_current,
char *  new_attrib_name,
char *  new_attrib_value 
)

Add a new attribute to o_current, when o_current is a pin. It does it in the following way:

  1. It creates an object -- "attrib_graphic" -- and fills it in.
  2. It gets the position info from o_current's refdes attrib and calls o_text_new() to add position info and name=value string to attrib_graphic.
  3. It calls o_attrib_add() to wrap attrib_graphic with (attribute OBJECT )
    Parameters:
    toplevelTOPLEVEL structure
    o_currentPointer to pin object
    new_attrib_nameName of attribute to add new_attrib_value Value of attribute to add
    Todo:
    Do I really need separate fcns for comps, nets, and pins???

Definition at line 139 of file s_object.c.

Here is the call graph for this function:

void s_object_replace_attrib_in_object ( TOPLEVEL *  toplevel,
OBJECT *  o_current,
char *  new_attrib_name,
char *  new_attrib_value,
gint  visibility,
gint  show_name_value 
)

Find the instance of attrib_name on o_current, and replace its value with the new_attrib_value.

Parameters:
toplevelTOPLEVEL object
o_currentobject to operate on
new_attrib_namename of attribute to replace
new_attrib_valuevalue to set attribute to
visibilityset visibility of attribute
show_name_valueset visibility of attribute name and value

Definition at line 172 of file s_object.c.

void s_object_remove_attrib_in_object ( TOPLEVEL *  toplevel,
OBJECT *  o_current,
char *  new_attrib_name 
)

Remove an attribute from an object.

Parameters:
toplevelTOPLEVEL structure
o_currentObject to remove attribute from
new_attrib_nameName of attribute to remove

Definition at line 237 of file s_object.c.

Here is the call graph for this function:

OBJECT* s_object_attrib_add_attrib_in_object ( TOPLEVEL *  toplevel,
char *  text_string,
int  visibility,
int  show_name_value,
OBJECT *  object 
)

Attach the name=value pair to the OBJECT "object". This function was stolen from gschem/src/o_attrib.c:o_attrib_add_attrib and hacked for gattrib.

Parameters:
toplevelTOPLEVEL to operate on
text_string
visibility
show_name_value
object
Returns:
pointer to the object
Todo:
Does it need to return OBJECT?

Definition at line 302 of file s_object.c.

void s_object_delete_text_object_in_object ( TOPLEVEL *  toplevel,
OBJECT *  text_object 
)

Delete the text object pointed to by text_object. This function was shamelessly stolen from gschem/src/o_delete.c and hacked for gattrib by SDB.

Parameters:
toplevelTOPLEVEL to be operated on
test_objecttext object to be deleted

Definition at line 397 of file s_object.c.

int s_object_has_sym_file ( OBJECT *  object)

This verifies that the object has a non-null symbol file.

Returns:
0 = valid symbol file, 1 = no symbol file found.

Definition at line 413 of file s_object.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines