PCB-FPW developer documentation based on version: 0.0.11

Data Structures | Typedefs | Functions | Variables

preview.h File Reference

Header file for footprint preview widget functions. More...

Go to the source code of this file.

Data Structures

struct  preview_arc
 Struct containing all data to draw an arc on the preview canvas. More...
struct  preview_line
 Struct containing all data to draw a line on the preview canvas. More...
struct  preview_polygon
 Struct containing all data to draw a polygon on the preview canvas. More...
struct  preview_rectangle
 Struct containing all data to draw a rectangle on the preview canvas. More...

Typedefs

typedef struct preview_arcpreview_arc
 Struct containing all data to draw an arc on the preview canvas.
typedef struct preview_linepreview_line
 Struct containing all data to draw a line on the preview canvas.
typedef struct preview_polygonpreview_polygon
 Struct containing all data to draw a polygon on the preview canvas.
typedef struct preview_rectanglepreview_rectangle
 Struct containing all data to draw a rectangle on the preview canvas.

Functions

static void preview_close_cb (GtkWidget *widget, GtkWidget *preview_window)
static gboolean preview_configure_event (GtkWidget *widget, GdkEventConfigure *event)
void preview_delete_event (GtkWidget *widget, GdkEvent *event)
 Delete the window.
int preview_set_fg_color (GdkGC *gc, const char *color_name)
 Set the foreground color of the Graphics Context.
int preview_set_fill_mode (GdkGC *gc, GdkFill fill_mode)
 Set the fill mode of the Graphics Context.
int preview_set_line_cap (GdkGC *gc, GdkCapStyle line_cap)
 Set the line capsulation of the Graphics Context.
int preview_set_line_style (GdkGC *gc, GdkLineStyle line_style)
 Set the line style of the Graphics Context.
int preview_set_line_width (GdkGC *gc, gint line_width)
 Set the line width of the Graphics Context.
int preview_use_gc (GdkDrawable *drawable, GdkGC *gc, const char *color_name, gint line_width, GdkCapStyle line_cap, GdkLineStyle line_style, GdkFill fill_mode)
 Use a Graphics Context when drawing entities.
static void preview_draw_arc (GtkWidget *widget, preview_arc arc)
static void preview_draw_background (GtkWidget *widget, gdouble x, gdouble y)
static void preview_draw_line (GtkWidget *widget, preview_line line)
static void preview_draw_pad (GtkWidget *widget)
static void preview_draw_pin (GtkWidget *widget)
static void preview_draw_polygon (GtkWidget *widget, preview_polygon polygon)
static void preview_draw_rectangle (GtkWidget *widget, preview_rectangle rectangle)
static gboolean preview_expose_event (GtkWidget *widget, GdkEventExpose *event)
int preview_create_window (gchar *footprint_name, gint width, gint height)
 Create a preview window containing a pixmap with the footprint.

Variables

GdkPixmap * pixmap = NULL

Detailed Description

Header file for footprint preview widget functions.

Author:
Copyright (C) 2007, 2008, 2009, 2010 by Bert Timmerman <bert.timmerman@xs4all.nl>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Definition in file preview.h.


Typedef Documentation

typedef struct preview_arc * preview_arc

Struct containing all data to draw an arc on the preview canvas.

typedef struct preview_line * preview_line

Struct containing all data to draw a line on the preview canvas.

typedef struct preview_polygon * preview_polygon

Struct containing all data to draw a polygon on the preview canvas.

Struct containing all data to draw a rectangle on the preview canvas.


Function Documentation

int preview_create_window ( gchar *  footprint_name,
gint  width,
gint  height 
)

Create a preview window containing a pixmap with the footprint.

The footprint_name variable is used in the dialog title.

Returns:
0 when successfull.

The footprint_name variable is used in the dialog title.

Returns:
0 when successful.
Parameters:
footprint_name : is the footprint type.
width : is width of the pixmap.
height : is height of the pixmap.

Definition at line 679 of file preview_dialog.c.

References preview_close_cb(), preview_configure_event(), preview_delete_event(), and preview_expose_event().

Here is the call graph for this function:

void preview_delete_event ( GtkWidget *  widget,
GdkEvent *  event 
)

Delete the window.

Parameters:
widget : is the widget to be deleted.
event : is the delete event passed from the caller.

Definition at line 85 of file preview_dialog.c.

Referenced by preview_create_window().

int preview_set_fg_color ( GdkGC *  gc,
const char *  color_name 
)

Set the foreground color of the Graphics Context.

Returns:
EXIT_SUCCESS when function is completed, EXIT_FAILURE when an eror occurred.
Parameters:
gc : is the Graphics Context.
color_name : is a NULL terminated color name.

Definition at line 104 of file preview_dialog.c.

Referenced by preview_use_gc().

int preview_set_fill_mode ( GdkGC *  gc,
GdkFill  fill_mode 
)

Set the fill mode of the Graphics Context.

Returns:
EXIT_SUCCESS when function is completed, EXIT_FAILURE when an eror occurred.
Parameters:
gc : is the Graphics Context.
fill_mode : determines how primitives are drawn.
Valid values are:

  • GDK_SOLID : draw with the foreground color.
  • GDK_TILED : draw with a tiled pixmap.
  • GDK_STIPPLED : draw using the stipple bitmap.
    Pixels corresponding to bits in the stipple bitmap that are set will be drawn in the foreground color;
    pixels corresponding to bits that are not set will be left untouched.
  • GDK_OPAQUE_STIPPLED : draw using the stipple bitmap.
    Pixels corresponding to bits in the stipple bitmap that are set will be drawn in the foreground color;
    pixels corresponding to bits that are not set will be drawn with the background color.

Definition at line 140 of file preview_dialog.c.

Referenced by preview_use_gc().

int preview_set_line_cap ( GdkGC *  gc,
GdkCapStyle  line_cap 
)

Set the line capsulation of the Graphics Context.

Returns:
EXIT_SUCCESS when function is completed, EXIT_FAILURE when an eror occurs.
Parameters:
gc : is the Graphics Context.
line_cap : determines how the end of lines are drawn.
Valid values are:

  • GDK_CAP_NOT_LAST : the same as GDK_CAP_BUTT for lines of non-zero width.
    for zero width lines, the final point on the line will not be drawn.
  • GDK_CAP_BUTT : the ends of the lines are drawn squared off and extending to the coordinates of the end point.
  • GDK_CAP_ROUND : the ends of the lines are drawn as semicircles with the diameter equal to the line width and centered at the end point.
  • GDK_CAP_PROJECTING : the ends of the lines are drawn squared off and extending half the width of the line beyond the end point.

Definition at line 190 of file preview_dialog.c.

Referenced by preview_use_gc().

int preview_set_line_style ( GdkGC *  gc,
GdkLineStyle  line_style 
)

Set the line style of the Graphics Context.

Returns:
EXIT_SUCCESS when function is completed, EXIT_FAILURE when an eror occurs.
Parameters:
gc : is the Graphics Context.
line_style : determines how lines are drawn.
Valid values are:

  • GDK_LINE_SOLID : lines are drawn solid.
  • GDK_LINE_ON_OFF_DASH : even segments are drawn;
    odd segments are not drawn.
  • GDK_LINE_DOUBLE_DASH : even segments are normally.
    Odd segments are drawn in the background color if the fill style is GDK_SOLID, or in the background color masked by the stipple if the fill style is GDK_STIPPLED.

Definition at line 245 of file preview_dialog.c.

Referenced by preview_use_gc().

int preview_set_line_width ( GdkGC *  gc,
gint  line_width 
)

Set the line width of the Graphics Context.

Returns:
EXIT_SUCCESS when function is completed, EXIT_FAILURE when an eror occurs.
Parameters:
gc : is the Graphics Context.
line_width : is the line width in pixels [px].

Definition at line 297 of file preview_dialog.c.

Referenced by preview_use_gc().

int preview_use_gc ( GdkDrawable *  drawable,
GdkGC *  gc,
const char *  color_name,
gint  line_width,
GdkCapStyle  line_cap,
GdkLineStyle  line_style,
GdkFill  fill_mode 
)

Use a Graphics Context when drawing entities.

If the passed Graphics Context is NULL , create a Graphics Context.

Returns:
EXIT_SUCCESS when function is completed, EXIT_FAILURE when an eror occurs.
Parameters:
drawable : is an opaque structure representing an object that can be drawn onto.
This can be a GdkPixmap, a GdkBitmap, or a GdkWindow.
gc : is the Graphics Context.
color_name : is a NULL terminated color name.
line_width : is the line width in pixels [px].
line_cap : determines how the end of lines are drawn.
Valid values are:

  • GDK_CAP_NOT_LAST : the same as GDK_CAP_BUTT for lines of non-zero width.
    for zero width lines, the final point on the line will not be drawn.
  • GDK_CAP_BUTT : the ends of the lines are drawn squared off and extending to the coordinates of the end point.
  • GDK_CAP_ROUND : the ends of the lines are drawn as semicircles with the diameter equal to the line width and centered at the end point.
  • GDK_CAP_PROJECTING : the ends of the lines are drawn squared off and extending half the width of the line beyond the end point.
line_style : determines how lines are drawn.
Valid values are:

  • GDK_LINE_SOLID : lines are drawn solid.
  • GDK_LINE_ON_OFF_DASH : even segments are drawn;
    odd segments are not drawn.
  • GDK_LINE_DOUBLE_DASH : even segments are normally.
    Odd segments are drawn in the background color if the fill style is GDK_SOLID, or in the background color masked by the stipple if the fill style is GDK_STIPPLED.
fill_mode : determines how primitives are drawn.
Valid values are:

  • GDK_SOLID : draw with the foreground color.
  • GDK_TILED : draw with a tiled pixmap.
  • GDK_STIPPLED : draw using the stipple bitmap.
    Pixels corresponding to bits in the stipple bitmap that are set will be drawn in the foreground color;
    pixels corresponding to bits that are not set will be left untouched.
  • GDK_OPAQUE_STIPPLED : draw using the stipple bitmap.
    Pixels corresponding to bits in the stipple bitmap that are set will be drawn in the foreground color;
    pixels corresponding to bits that are not set will be drawn with the background color.

Definition at line 346 of file preview_dialog.c.

References preview_set_fg_color(), preview_set_fill_mode(), preview_set_line_cap(), preview_set_line_style(), and preview_set_line_width().

Here is the call graph for this function:


Variable Documentation

GdkPixmap* pixmap = NULL

Backing pixmap for drawing area

Definition at line 29 of file preview.h.