A footprint preview widget. More...
Go to the source code of this file.
Functions | |
static void | preview_close_cb (GtkWidget *widget, GtkWidget *preview_window) |
Close the preview window (destroy the preview widget). | |
static gboolean | preview_configure_event (GtkWidget *widget, GdkEventConfigure *event) |
Create a new backing pixmap of the appropriate size. | |
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) |
Draw an arc on the preview pixmap. | |
static void | preview_draw_background (GtkWidget *widget, gdouble x, gdouble y) |
Draw a white background (rectangle) on the screen. | |
static void | preview_draw_line (GtkWidget *widget, preview_line line) |
Draw a line on the preview pixmap. | |
static void | preview_draw_pad (GtkWidget *widget) |
Draw a pad on the preview pixmap. | |
static void | preview_draw_pin (GtkWidget *widget) |
Draw a pin on the preview pixmap. | |
static void | preview_draw_polygon (GtkWidget *widget, preview_polygon polygon) |
Draw a pin on the preview pixmap. | |
static void | preview_draw_rectangle (GtkWidget *widget, preview_rectangle rectangle) |
Draws a rectangle on the preview canvas. | |
static gboolean | preview_expose_event (GtkWidget *widget, GdkEventExpose *event) |
Redraw the screen from the backing pixmap. | |
int | preview_create_window (gchar *footprint_name, gint width, gint height) |
Create a preview window containing a pixmap with the footprint. |
A footprint preview widget.
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.c.
static void preview_close_cb | ( | GtkWidget * | widget, | |
GtkWidget * | preview_window | |||
) | [static] |
Close the preview window (destroy the preview widget).
widget | : is the caller widget. | |
preview_window | : is the widget to be closed. |
Definition at line 37 of file preview.c.
Referenced by preview_create_window().
static gboolean preview_configure_event | ( | GtkWidget * | widget, | |
GdkEventConfigure * | event | |||
) | [static] |
Create a new backing pixmap of the appropriate size.
TRUE
when function is completed. widget | : is the (drawable) widget to contain the image. | |
event | : is the configure event passed from the caller. |
Definition at line 55 of file preview.c.
References pixmap.
Referenced by preview_create_window().
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.
footprint_name | : is the footprint type. | |
width | : is width of the pixmap. | |
height | : is height of the pixmap. |
Definition at line 681 of file preview.c.
References preview_close_cb(), preview_configure_event(), preview_delete_event(), and preview_expose_event().
void preview_delete_event | ( | GtkWidget * | widget, | |
GdkEvent * | event | |||
) |
static void preview_draw_arc | ( | GtkWidget * | widget, | |
preview_arc | arc | |||
) | [static] |
Draw an arc on the preview pixmap.
Draws an arc or a filled 'pie slice'.
The arc is defined by the bounding rectangle of the entire ellipse, and the start and end angles of the part of the ellipse to be drawn.
widget | : is the toplevel widget containing the drawable. | |
arc | : is a preview arc. |
Definition at line 444 of file preview.c.
References preview_arc::angle1, preview_arc::angle2, preview_arc::drawable, preview_arc::filled, preview_arc::gc, preview_arc::height, preview_arc::width, preview_arc::x, and preview_arc::y.
static void preview_draw_background | ( | GtkWidget * | widget, | |
gdouble | x, | |||
gdouble | y | |||
) | [static] |
static void preview_draw_line | ( | GtkWidget * | widget, | |
preview_line | line | |||
) | [static] |
Draw a line on the preview pixmap.
Draws a line, using the foreground color and other attributes of the GdkGC.
widget | : is the toplevel widget containing the drawable. | |
line | : is a preview line. |
Definition at line 520 of file preview.c.
References preview_line::drawable, preview_line::gc, preview_line::x1, preview_line::x2, preview_line::y1, and preview_line::y2.
static void preview_draw_pad | ( | GtkWidget * | widget | ) | [static] |
static void preview_draw_pin | ( | GtkWidget * | widget | ) | [static] |
static void preview_draw_polygon | ( | GtkWidget * | widget, | |
preview_polygon | polygon | |||
) | [static] |
Draw a pin on the preview pixmap.
widget | : is the toplevel widget containing the drawable. | |
polygon | : is a preview polygon. |
Definition at line 577 of file preview.c.
References preview_polygon::drawable, preview_polygon::filled, preview_polygon::gc, preview_polygon::npoints, and preview_polygon::points.
static void preview_draw_rectangle | ( | GtkWidget * | widget, | |
preview_rectangle | rectangle | |||
) | [static] |
Draws a rectangle on the preview canvas.
Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the GdkGC.
A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle outlined.
Calling gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20) results in a filled rectangle 20 pixels wide and 20 pixels high.
Calling gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20) results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which makes it 21 pixels wide and 21 pixels high.
widget | : is the toplevel widget containing the drawable. | |
rectangle | : is a preview rectangle. |
Definition at line 615 of file preview.c.
References preview_rectangle::drawable, preview_rectangle::filled, preview_rectangle::gc, preview_rectangle::height, preview_rectangle::width, preview_rectangle::x, and preview_rectangle::y.
static gboolean preview_expose_event | ( | GtkWidget * | widget, | |
GdkEventExpose * | event | |||
) | [static] |
Redraw the screen from the backing pixmap.
FALSE
when function is completed. widget | : is the toplevel widget containing the drawable. | |
event | : is the event passed from the caller. |
Definition at line 647 of file preview.c.
References pixmap.
Referenced by preview_create_window().
int preview_set_fg_color | ( | GdkGC * | gc, | |
const char * | color_name | |||
) |
int preview_set_fill_mode | ( | GdkGC * | gc, | |
GdkFill | fill_mode | |||
) |
Set the fill mode of the Graphics Context.
EXIT_SUCCESS
when function is completed, EXIT_FAILURE
when an eror occurred. gc | : is the Graphics Context. | |
fill_mode | : determines how primitives are drawn. Valid values are:
|
int preview_set_line_cap | ( | GdkGC * | gc, | |
GdkCapStyle | line_cap | |||
) |
Set the line capsulation of the Graphics Context.
EXIT_SUCCESS
when function is completed, EXIT_FAILURE
when an eror occurs. gc | : is the Graphics Context. | |
line_cap | : determines how the end of lines are drawn. Valid values are:
|
int preview_set_line_style | ( | GdkGC * | gc, | |
GdkLineStyle | line_style | |||
) |
Set the line style of the Graphics Context.
EXIT_SUCCESS
when function is completed, EXIT_FAILURE
when an eror occurs. gc | : is the Graphics Context. | |
line_style | : determines how lines are drawn. Valid values are:
|
int preview_set_line_width | ( | GdkGC * | gc, | |
gint | line_width | |||
) |
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.
EXIT_SUCCESS
when function is completed, EXIT_FAILURE
when an eror occurs. 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:
| |
line_style | : determines how lines are drawn. Valid values are:
| |
fill_mode | : determines how primitives are drawn. Valid values are:
|
Definition at line 348 of file preview.c.
References preview_set_fg_color(), preview_set_fill_mode(), preview_set_line_cap(), preview_set_line_style(), and preview_set_line_width().