![]() |
![]() |
![]() |
![]() |
struct | lglTemplate |
enum | lglTemplateFrameShape |
union | lglTemplateFrame |
struct | lglTemplateFrameAll |
struct | lglTemplateFrameRect |
struct | lglTemplateFrameEllipse |
struct | lglTemplateFrameRound |
struct | lglTemplateFrameCD |
struct | lglTemplateLayout |
enum | lglTemplateMarkupType |
union | lglTemplateMarkup |
struct | lglTemplateMarkupMargin |
struct | lglTemplateMarkupLine |
struct | lglTemplateMarkupCircle |
struct | lglTemplateMarkupRect |
struct | lglTemplateMarkupEllipse |
struct | lglTemplateOrigin |
lglTemplate * lgl_template_new (const gchar *brand
,const gchar *part
,const gchar *description
,const gchar *paper_id
,gdouble page_width
,gdouble page_height
);
Create a new template structure, with the given top-level attributes. The
created template will have no initial categories, or frames associated with
it. See lgl_template_add_category()
and lgl_template_add_frame()
to add
these.
lglTemplate * lgl_template_new_from_equiv (const gchar *brand
,const gchar *part
,const gchar *equiv_part
);
Create a new template structure based on an existing template. The created template will be a duplicate of the original template, except with the new part name/number.
lglTemplate *
lgl_template_dup (const lglTemplate *orig_template
);
This function duplicates a template structure.
void
lgl_template_free (lglTemplate *template
);
This function frees all memory associated with given template structure.
void lgl_template_add_category (lglTemplate *template
,const gchar *category_id
);
This function adds the given category ID to a templates category list.
void lgl_template_add_frame (lglTemplate *template
,lglTemplateFrame *frame
);
This function adds the given frame structure to the template. Once added, the frame structure belongs to the given template; do not attempt to free it.
Note: Currently glabels only supports a single frame per template.
gchar *
lgl_template_get_name (const lglTemplate *template
);
This function returns the name of the given template. The name is the concetenation of the brand and part name/number.
gboolean lgl_template_do_templates_match (const lglTemplate *template1
,const lglTemplate *template2
);
This function tests if the given templates match. This is a simple test that only tests the brand and part name/number. It does not test if they are actually identical.
gboolean lgl_template_does_brand_match (const lglTemplate *template
,const gchar *brand
);
This function tests if the brand of the template matches the given brand.
gboolean lgl_template_does_page_size_match (const lglTemplate *template
,const gchar *paper_id
);
This function tests if the page size of the template matches the given ID.
gboolean lgl_template_does_category_match (const lglTemplate *template
,const gchar *category_id
);
This function tests if the given template belongs to the given category ID.
gboolean lgl_template_are_templates_identical (const lglTemplate *template1
,const lglTemplate *template2
);
This function tests if the given templates have identical size and layout properties.
lglTemplateFrame * lgl_template_frame_rect_new (const gchar *id
,gdouble w
,gdouble h
,gdouble r
,gdouble x_waste
,gdouble y_waste
);
This function creates a new template frame for a rectangular label or card.
id |
ID of frame. (This should currently always be "0"). |
|
w |
width of frame in points. |
|
h |
height of frame in points. |
|
r |
radius of rounded corners in points. (Should be 0 for square corners.) |
|
x_waste |
Amount of overprint to allow in the horizontal direction. |
|
y_waste |
Amount of overprint to allow in the vertical direction. |
lglTemplateFrame * lgl_template_frame_ellipse_new (const gchar *id
,gdouble w
,gdouble h
,gdouble waste
);
This function creates a new template frame for an elliptical label or card.
lglTemplateFrame * lgl_template_frame_round_new (const gchar *id
,gdouble r
,gdouble waste
);
This function creates a new template frame for a round label.
lglTemplateFrame * lgl_template_frame_cd_new (const gchar *id
,gdouble r1
,gdouble r2
,gdouble w
,gdouble h
,gdouble waste
);
This function creates a new template frame for a CD/DVD label.
id |
ID of frame. (This should currently always be "0"). |
|
r1 |
outer radius of label in points. |
|
r2 |
radius of center hole in points. |
|
w |
clip width of frame in points for business card CDs. Should be 0 for no clipping. |
|
h |
clip height of frame in points for business card CDs. Should be 0 for no clipping. |
|
waste |
Amount of overprint to allow. |
lglTemplateFrame *
lgl_template_frame_dup (const lglTemplateFrame *orig_frame
);
This function duplicates a template frame structure.
void
lgl_template_frame_free (lglTemplateFrame *frame
);
This function frees all memory associated with given template frame structure.
void lgl_template_frame_add_layout (lglTemplateFrame *frame
,lglTemplateLayout *layout
);
This function adds a layout structure to the given template frame.
void lgl_template_frame_add_markup (lglTemplateFrame *frame
,lglTemplateMarkup *markup
);
This function adds a markup structure to the given template frame.
void lgl_template_frame_get_size (const lglTemplateFrame *frame
,gdouble *w
,gdouble *h
);
Get size (width and height) of given lglTemplateFrame in points.
frame |
lglTemplateFrame structure to query |
|
w |
pointer to location to receive width of frame |
|
h |
pointer to location to receive height of frame |
gint
lgl_template_frame_get_n_labels (const lglTemplateFrame *frame
);
Get total number of labels per sheet corresponding to the given frame.
lglTemplateOrigin *
lgl_template_frame_get_origins (const lglTemplateFrame *frame
);
Get an array of label origins for the given frame. These origins represent the
upper left hand corner of each label on a page corresponding to the given frame.
The origins will be ordered geometrically left to right and then top to bottom.
The array should be freed using g_free()
.
gchar *
lgl_template_frame_get_layout_description
(const lglTemplateFrame *frame
);
Get a description of the label layout including number of labels per sheet.
gchar * lgl_template_frame_get_size_description (const lglTemplateFrame *frame
,lglUnits units
);
Get a description of the label size.
lglTemplateLayout * lgl_template_layout_new (gint nx
,gint ny
,gdouble x0
,gdouble y0
,gdouble dx
,gdouble dy
);
This function creates a new layout structure with the given parameters.
nx |
Number of labels across. |
|
ny |
Number of labels down. |
|
x0 |
X coordinate of the top-left corner of the top-left label in the layout in points. |
|
y0 |
Y coordinate of the top-left corner of the top-left label in the layout in points. |
|
dx |
Horizontal pitch in points. This is the distance from left-edge to left-edge. |
|
dy |
Vertical pitch in points. This is the distance from top-edge to top-edge. |
lglTemplateLayout *
lgl_template_layout_dup (const lglTemplateLayout *orig_layout
);
This function duplicates a template layout structure.
void
lgl_template_layout_free (lglTemplateLayout *layout
);
This function frees all memory associated with given template layout structure.
lglTemplateMarkup *
lgl_template_markup_margin_new (gdouble size
);
This function creates a new margin markup structure.
lglTemplateMarkup * lgl_template_markup_line_new (gdouble x1
,gdouble y1
,gdouble x2
,gdouble y2
);
This function creates a new line markup structure.
lglTemplateMarkup * lgl_template_markup_circle_new (gdouble x0
,gdouble y0
,gdouble r
);
This function creates a new circle markup structure.
lglTemplateMarkup * lgl_template_markup_rect_new (gdouble x1
,gdouble y1
,gdouble w
,gdouble h
,gdouble r
);
This function creates a new rectangle markup structure.
lglTemplateMarkup * lgl_template_markup_ellipse_new (gdouble x1
,gdouble y1
,gdouble w
,gdouble h
);
This function creates a new ellipse markup structure.
lglTemplateMarkup *
lgl_template_markup_dup (const lglTemplateMarkup *orig_markup
);
This function duplicates a template markup structure.
void
lgl_template_markup_free (lglTemplateMarkup *markup
);
This function frees all memory associated with given template markup structure.
void
lgl_template_print (const lglTemplate *template
);
Print template details (for debugging purposes).
struct lglTemplate { gchar *brand; gchar *part; gchar *equiv_part; gchar *description; gchar *paper_id; gdouble page_width; gdouble page_height; /* Meta information. */ gchar *product_url; /* URL to manufacturer's product website. */ GList *category_ids; /* List of (gchar *) category ids. */ /* List of (lglTemplateFrame *) label frame structures. * Currently glabels only supports a single label frame per * template. */ GList *frames; };
struct lglTemplateFrameAll { /* Begin Common Fields */ lglTemplateFrameShape shape; gchar *id; /* Id, currently always "0" */ GList *layouts; /* List of lglTemplateLayouts */ GList *markups; /* List of lglTemplateMarkups */ /* End Common Fields */ };
struct lglTemplateFrameRect { /* Begin Common Fields */ lglTemplateFrameShape shape; /* Always LGL_TEMPLATE_FRAME_SHAPE_RECT. */ gchar *id; /* Id, currently always "0" */ GList *layouts; /* List of lglTemplateLayouts */ GList *markups; /* List of lglTemplateMarkups */ /* End Common Fields */ gdouble w; /* Width */ gdouble h; /* Height */ gdouble r; /* Corner radius */ gdouble x_waste; /* Amount of horiz overprint allowed. */ gdouble y_waste; /* Amount of vert overprint allowed. */ };
struct lglTemplateFrameEllipse { /* Begin Common Fields */ lglTemplateFrameShape shape; /* Always LGL_TEMPLATE_FRAME_SHAPE_ELLIPSE. */ gchar *id; /* Id, currently always "0" */ GList *layouts; /* List of lglTemplateLayouts */ GList *markups; /* List of lglTemplateMarkups */ /* End Common Fields */ gdouble w; /* Width */ gdouble h; /* Height */ gdouble waste; /* Amount of overprint allowed. */ };
struct lglTemplateFrameRound { /* Begin Common Fields */ lglTemplateFrameShape shape; /* Always LGL_TEMPLATE_FRAME_SHAPE_ROUND. */ gchar *id; /* Id, currently always "0" */ GList *layouts; /* List of lglTemplateLayouts */ GList *markups; /* List of lglTemplateMarkups */ /* End Common Fields */ gdouble r; /* Radius */ gdouble waste; /* Amount of overprint allowed. */ };
struct lglTemplateFrameCD { /* Begin Common Fields */ lglTemplateFrameShape shape; /* Always LGL_TEMPLATE_FRAME_SHAPE_CD. */ gchar *id; /* Id, currently always "0" */ GList *layouts; /* List of lglTemplateLayouts */ GList *markups; /* List of lglTemplateMarkups */ /* End Common Fields */ gdouble r1; /* Outer radius */ gdouble r2; /* Inner radius (hole) */ gdouble w; /* Clip width, business card CDs */ gdouble h; /* Clip height, business card CDs */ gdouble waste; /* Amount of overprint allowed. */ };
struct lglTemplateLayout { gint nx; /* Number of labels across */ gint ny; /* Number of labels up and down */ gdouble x0; /* Left of grid from left edge of paper */ gdouble y0; /* Top of grid from top edge of paper */ gdouble dx; /* Horizontal pitch of grid */ gdouble dy; /* Vertical pitch of grid */ };
struct lglTemplateMarkupMargin { lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_MARGIN */ gdouble size; /* Margin size */ };
struct lglTemplateMarkupLine { lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_LINE */ gdouble x1, y1; /* 1st endpoint */ gdouble x2, y2; /* 2nd endpoint */ };
struct lglTemplateMarkupCircle { lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_CIRCLE */ gdouble x0, y0; /* Center of circle */ gdouble r; /* Radius of circle */ };
struct lglTemplateMarkupRect { lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_RECT */ gdouble x1, y1; /* Upper left corner */ gdouble w, h; /* Width and height. */ gdouble r; /* Radius of corners. */ };