17 #ifndef XORN_STORAGE_H
18 #define XORN_STORAGE_H
68 xorn_revision_t rev, xorn_object_t ob);
70 xorn_revision_t rev, xorn_object_t ob);
74 xorn_revision_t rev, xorn_object_t ob,
75 xorn_object_t *attached_to_return,
76 unsigned int *position_return);
80 xorn_object_t **objects_return,
size_t *count_return);
82 xorn_revision_t rev, xorn_object_t ob,
83 xorn_object_t **objects_return,
size_t *count_return);
85 xorn_revision_t rev, xorn_selection_t sel,
86 xorn_object_t **objects_return,
size_t *count_return);
88 xorn_revision_t from_rev, xorn_revision_t to_rev,
89 xorn_object_t **objects_return,
size_t *count_return);
91 xorn_revision_t from_rev, xorn_revision_t to_rev,
92 xorn_object_t **objects_return,
size_t *count_return);
94 xorn_revision_t from_rev, xorn_revision_t to_rev,
95 xorn_object_t **objects_return,
size_t *count_return);
103 xorn_revision_t rev, xorn_object_t ob);
105 xorn_revision_t rev);
107 xorn_revision_t rev, xorn_selection_t sel);
109 xorn_selection_t sel, xorn_object_t ob);
111 xorn_selection_t sel, xorn_object_t ob);
113 xorn_selection_t sel0, xorn_selection_t sel1);
115 xorn_selection_t sel0, xorn_selection_t sel1);
117 xorn_selection_t sel0, xorn_selection_t sel1);
120 xorn_revision_t rev, xorn_selection_t sel);
122 xorn_revision_t rev, xorn_selection_t sel, xorn_object_t ob);
124 xorn_selection_t sel);
133 xorn_object_t attach_to, xorn_object_t insert_before);
136 xorn_selection_t sel);
139 xorn_revision_t src, xorn_object_t ob);
141 xorn_revision_t src, xorn_selection_t sel);
254 #define DECLARE_OBJECT_FUNCTIONS(type) \
255 const struct xornsch_##type *xornsch_get_##type##_data( \
256 xorn_revision_t rev, xorn_object_t ob); \
257 xorn_object_t xornsch_add_##type(xorn_revision_t rev, \
258 const struct xornsch_##type *data); \
259 int xornsch_set_##type##_data(xorn_revision_t rev, xorn_object_t ob, \
260 const struct xornsch_##type *data);
262 DECLARE_OBJECT_FUNCTIONS(arc)
263 DECLARE_OBJECT_FUNCTIONS(box)
264 DECLARE_OBJECT_FUNCTIONS(circle)
265 DECLARE_OBJECT_FUNCTIONS(component)
266 DECLARE_OBJECT_FUNCTIONS(line)
267 DECLARE_OBJECT_FUNCTIONS(net)
268 DECLARE_OBJECT_FUNCTIONS(path)
269 DECLARE_OBJECT_FUNCTIONS(picture)
270 DECLARE_OBJECT_FUNCTIONS(text)
272 #undef DECLARE_OBJECT_FUNCTIONS
276 #define DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, intype, outtype) \
277 void ns##_get_##name( \
278 xorn_revision_t rev, xorn_selection_t sel, \
279 xorn_attst_t *state_return, outtype value_return); \
280 int ns##_set_##name( \
281 xorn_revision_t rev, xorn_selection_t sel, \
283 xorn_selection_t ns##_select_by_##name( \
284 xorn_revision_t rev, intype value);
286 #define INT_ATTRIBUTE(ns, name) \
287 DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, int, int *)
288 #define BOOL_ATTRIBUTE(ns, name) \
289 DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, bool, bool *)
290 #define DOUBLE_ATTRIBUTE(ns, name) \
291 DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, double, double *)
292 #define DOUBLE2D_ATTRIBUTE(ns, name) \
293 DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, const struct xorn_double2d *, \
294 struct xorn_double2d *)
295 #define STRING_ATTRIBUTE(ns, name) \
296 DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, const struct xorn_string *, \
297 struct xorn_string *)
298 #define LINE_ATTRIBUTE(ns, name) \
299 DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, const struct xornsch_line_attr *,\
300 struct xornsch_line_attr *)
301 #define FILL_ATTRIBUTE(ns, name) \
302 DECLARE_ATTRIBUTE_FUNCTIONS(ns, name, const struct xornsch_fill_attr *,\
303 struct xornsch_fill_attr *)
305 INT_ATTRIBUTE(xornsch, alignment)
306 INT_ATTRIBUTE(xornsch, angle)
307 INT_ATTRIBUTE(xornsch, color)
308 FILL_ATTRIBUTE(xornsch, fill)
309 INT_ATTRIBUTE(xornsch, fill_angle0)
310 INT_ATTRIBUTE(xornsch, fill_angle1)
311 DOUBLE_ATTRIBUTE(xornsch, fill_pitch0)
312 DOUBLE_ATTRIBUTE(xornsch, fill_pitch1)
313 INT_ATTRIBUTE(xornsch, fill_type)
314 DOUBLE_ATTRIBUTE(xornsch, fill_width)
315 BOOL_ATTRIBUTE(xornsch, is_bus)
316 BOOL_ATTRIBUTE(xornsch, is_inverted)
317 BOOL_ATTRIBUTE(xornsch, is_pin)
318 LINE_ATTRIBUTE(xornsch, line)
319 INT_ATTRIBUTE(xornsch, line_cap_style)
320 DOUBLE_ATTRIBUTE(xornsch, line_dash_length)
321 DOUBLE_ATTRIBUTE(xornsch, line_dash_space)
322 INT_ATTRIBUTE(xornsch, line_dash_style)
323 DOUBLE_ATTRIBUTE(xornsch, line_width)
324 BOOL_ATTRIBUTE(xornsch, mirror)
325 STRING_ATTRIBUTE(xornsch, pathdata)
326 DOUBLE2D_ATTRIBUTE(xornsch, pos)
327 DOUBLE_ATTRIBUTE(xornsch, pos_x)
328 DOUBLE_ATTRIBUTE(xornsch, pos_y)
329 DOUBLE_ATTRIBUTE(xornsch, radius)
330 BOOL_ATTRIBUTE(xornsch, selectable)
331 INT_ATTRIBUTE(xornsch, show_name_value)
332 DOUBLE2D_ATTRIBUTE(xornsch, size)
333 DOUBLE_ATTRIBUTE(xornsch, size_x)
334 DOUBLE_ATTRIBUTE(xornsch, size_y)
335 INT_ATTRIBUTE(xornsch, startangle)
336 INT_ATTRIBUTE(xornsch, sweepangle)
337 STRING_ATTRIBUTE(xornsch, text)
338 INT_ATTRIBUTE(xornsch, text_size)
339 BOOL_ATTRIBUTE(xornsch, visibility)
342 #undef BOOL_ATTRIBUTE
343 #undef DOUBLE_ATTRIBUTE
344 #undef DOUBLE2D_ATTRIBUTE
345 #undef STRING_ATTRIBUTE
346 #undef LINE_ATTRIBUTE
347 #undef FILL_ATTRIBUTE
349 #undef DECLARE_ATTRIBUTE_FUNCTIONS
struct xorn_double2d size
Coordinates of the second end minus coordinates of the first end in mils.
struct xorn_double2d size
Size in mils.
xorn_selection_t xorn_select_none()
Create an empty selection.
int xorn_get_objects(xorn_revision_t rev, xorn_object_t **objects_return, size_t *count_return)
Return a list of all objects in a revision.
struct xornsch_line_attr line
Line style.
int xorn_relocate_object(xorn_revision_t rev, xorn_object_t ob, xorn_object_t attach_to, xorn_object_t insert_before)
Change the location of an object in the object structure of a transient revision. ...
void xorn_free_selection(xorn_selection_t sel)
Free the memory used for storing a selection.
struct xornsch_line_attr line
Line style.
struct xorn_revision * xorn_revision_t
Opaque type representing the contents of a file.
void(* decref)(void *ptr)
A function which is called when a copy of the pointer is deleted.
struct xornsch_line_attr line
Line style.
double dash_space
Space between dashes in mils.
struct xorn_double2d size
Coordinate of second end minus coordinate of first end in mils.
Schematic net segment, bus segment, or pin.
int angle
Rotation angle in degrees.
Arbitrary reference-counted pointer.
struct xorn_string pathdata
Path data.
void xorn_finalize_revision(xorn_revision_t rev)
Prevent further changes to a revision.
bool xorn_object_is_selected(xorn_revision_t rev, xorn_selection_t sel, xorn_object_t ob)
Return whether an object exists in a revision and is selected in a selection.
struct xorn_double2d size
Size in mils.
struct xornsch_fill_attr fill
Fill style.
int angle
Angle of the text in degrees.
double dash_length
Dash length in mils.
int angle0
First angle of fill in degrees.
const char * s
Pointer to the character data.
int xorn_get_object_location(xorn_revision_t rev, xorn_object_t ob, xorn_object_t *attached_to_return, unsigned int *position_return)
Get the location of an object in the object structure.
double width
Width of fill lines in mils.
bool xorn_object_exists_in_revision(xorn_revision_t rev, xorn_object_t ob)
Return whether an object exists in a revision.
int show_name_value
Attribute visibility control.
xorn_attst_t
Attribute status across multiple objects.
xorn_obtype_t xorn_get_object_type(xorn_revision_t rev, xorn_object_t ob)
Get the type of an object in a given revision.
xorn_selection_t xorn_select_excluding(xorn_selection_t sel, xorn_object_t ob)
Create a selection which contains all the objects in an existing selection minus a given object...
void(* incref)(void *ptr)
A function which is called when the pointer is copied.
double x
X coordinate or offset.
double y
Y coordinate or offset.
struct xornsch_line_attr line
Line style.
double radius
Radius of the circle in mils.
int xorn_get_selected_objects(xorn_revision_t rev, xorn_selection_t sel, xorn_object_t **objects_return, size_t *count_return)
Return a list of objects which are in a revision as well as in a selection.
struct xorn_selection * xorn_selection_t
Opaque type representing the identity of a set of objects.
bool selectable
Is the component selectable?
int xorn_get_added_objects(xorn_revision_t from_rev, xorn_revision_t to_rev, xorn_object_t **objects_return, size_t *count_return)
Return a list of objects which are in a revision but not in another.
int sweepangle
Amount the arc sweeps in degrees.
Schematic text or attribute.
double pitch1
Second pitch/spacing of fill in mils.
bool mirror
Is the component mirrored around the Y axis?
double pitch0
First pitch/spacing of fill in mils.
struct xorn_double2d pos
Coordinates of the origin of the text item in mils.
void xorn_free_revision(xorn_revision_t rev)
Free the memory associated with a revision.
struct xorn_double2d pos
Center coordinates in mils.
int angle1
Second angle of fill in degrees.
struct xorn_double2d pos
Coordinate of first end in mils.
struct xorn_double2d pos
Coordinates of the lower left corner in mils.
double width
Line width in mils.
struct xorn_pointer pixmap
Reference to the pixmap data.
struct xorn_double2d pos
Origin coordinates in mils.
int xorn_get_objects_attached_to(xorn_revision_t rev, xorn_object_t ob, xorn_object_t **objects_return, size_t *count_return)
Return a list of objects in a revision which are attached to a certain object.
int cap_style
Type of cap style.
void xorn_delete_selected_objects(xorn_revision_t rev, xorn_selection_t sel)
Delete some objects from a transient revision.
bool visibility
Visibility of the text.
double radius
Radius of the arc in mils.
xorn_selection_t xorn_copy_objects(xorn_revision_t dest, xorn_revision_t src, xorn_selection_t sel)
Copy some objects to a transient revision.
struct xorn_pointer symbol
Reference to the used symbol.
struct xorn_double2d pos
Coordinates of the first end in mils.
int xorn_get_removed_objects(xorn_revision_t from_rev, xorn_revision_t to_rev, xorn_object_t **objects_return, size_t *count_return)
Return a list of objects which are in a revision but not in another.
xorn_selection_t xorn_select_object(xorn_object_t ob)
Create a selection containing a single object.
int text_size
Size of the text in points.
xorn_selection_t xorn_select_all_except(xorn_revision_t rev, xorn_selection_t sel)
Create a selection containing all objects in a revision except those in a given selection.
xorn_selection_t xorn_select_including(xorn_selection_t sel, xorn_object_t ob)
Create a selection which contains all the objects in an existing selection plus a given object...
int angle
Rotation angle of the component in degrees.
xorn_selection_t xorn_select_attached_to(xorn_revision_t rev, xorn_object_t ob)
Create a selection containing all objects in a revision attached to a given object.
xorn_selection_t xorn_select_intersection(xorn_selection_t sel0, xorn_selection_t sel1)
Create a selection containing the objects in both given selections.
xorn_object_t xorn_add_object(xorn_revision_t rev, xorn_obtype_t type, const void *data)
Add a new object to a transient revision.
int startangle
Starting angle of the arc in degrees.
bool xorn_selection_is_empty(xorn_revision_t rev, xorn_selection_t sel)
Return whether a selection is empty in a given revision.
bool mirror
Mirrored or normal picture.
bool is_inverted
Invert the pin when writing to a gEDA symbol file.
bool xorn_revision_is_transient(xorn_revision_t rev)
Return whether a revision can be changed.
size_t len
Length of the string in bytes.
struct xornsch_line_attr line
Line style.
bool is_bus
Does the object describe a bus or bus pin?
void xorn_delete_object(xorn_revision_t rev, xorn_object_t ob)
Delete an object from a transient revision.
xorn_object_t xorn_copy_object(xorn_revision_t dest, xorn_revision_t src, xorn_object_t ob)
Copy an object to a transient revision.
xorn_selection_t xorn_select_all(xorn_revision_t rev)
Create a selection containing all objects in a revision.
const void * xorn_get_object_data(xorn_revision_t rev, xorn_object_t ob, xorn_obtype_t type)
Get a pointer to an object's data in a given revision.
Pair of double values indicating a coordinate or offset.
void * ptr
The actual pointer.
struct xorn_double2d pos
Center coordinates in mils.
int alignment
Alignment (i.e., relative location of the origin) of the text.
int dash_style
Type of dash style.
struct xorn_object * xorn_object_t
Opaque type representing the identity of an object.
struct xorn_string text
The text strings.
struct xornsch_fill_attr fill
Fill style.
bool is_pin
Does the object describe a pin?
xorn_revision_t xorn_new_revision(xorn_revision_t rev)
Create a new revision, either from scratch or by copying an existing one.
struct xornsch_fill_attr fill
Fill style.
xorn_obtype_t
Object types, each corresponding to a data structure.
int xorn_set_object_data(xorn_revision_t rev, xorn_object_t ob, xorn_obtype_t type, const void *data)
Set an object in a transient revision to the given object type and data.
xorn_selection_t xorn_select_difference(xorn_selection_t sel0, xorn_selection_t sel1)
Create a selection containing the objects contained in one given selection, but not the other...
struct xorn_double2d pos
Lower left hand coordinates in mils.
int xorn_get_modified_objects(xorn_revision_t from_rev, xorn_revision_t to_rev, xorn_object_t **objects_return, size_t *count_return)
Return a list of objects which exist in two revisions but have different type or data.
xorn_selection_t xorn_select_union(xorn_selection_t sel0, xorn_selection_t sel1)
Create a selection containing the objects in either given selection.