gschem

o_circle.c File Reference

#include <config.h>
#include <stdio.h>
#include <math.h>
#include "gschem.h"
Include dependency graph for o_circle.c:

Go to the source code of this file.

Typedefs

typedef void(* FILL_FUNC )(GSCHEM_TOPLEVEL *w_current, COLOR *color, CIRCLE *circle, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)

Functions

static void o_circle_fill_hollow (GSCHEM_TOPLEVEL *w_current, COLOR *color, CIRCLE *circle, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Placeholder filling function.
static void o_circle_fill_fill (GSCHEM_TOPLEVEL *w_current, COLOR *color, CIRCLE *circle, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Fill inside of circle with a solid pattern.
static void o_circle_fill_hatch (GSCHEM_TOPLEVEL *w_current, COLOR *color, CIRCLE *circle, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Fill inside of circle with single line pattern.
static void o_circle_fill_mesh (GSCHEM_TOPLEVEL *w_current, COLOR *color, CIRCLE *circle, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Fill inside of circle with mesh pattern.
void o_circle_draw (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 Draw a circle on the screen.
void o_circle_invalidate_rubber (GSCHEM_TOPLEVEL *w_current)
void o_circle_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
 Draw a circle described by OBJECT with translation.
void o_circle_start (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 Start process to input a new circle.
void o_circle_end (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 End the input of a circle.
void o_circle_motion (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 Draw temporary circle while dragging edge.
void o_circle_draw_rubber (GSCHEM_TOPLEVEL *w_current)
 Draw circle from GSCHEM_TOPLEVEL object.
void o_circle_draw_grips (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 Draw grip marks on circle.

Typedef Documentation

typedef void(* FILL_FUNC)(GSCHEM_TOPLEVEL *w_current, COLOR *color, CIRCLE *circle, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)

Definition at line 31 of file o_circle.c.


Function Documentation

static void o_circle_fill_hollow ( GSCHEM_TOPLEVEL w_current,
COLOR *  color,
CIRCLE *  circle,
gint  fill_width,
gint  angle1,
gint  pitch1,
gint  angle2,
gint  pitch2 
) [static]
Function Description
This function does nothing. It has the same prototype as all the filling functions. It prevent from making a difference between filling in function o_circle_draw().

The unit for width, pitch1 and pitch2 is pixel and unit for angle1 and angle2 is degree.

Parameters:
[in]w_currentSchematic top level
[in]colorCircle fill color.
[in]circleCircle to be drawn
[in]fill_width
[in]angle11st angle for pattern.
[in]pitch11st pitch for pattern.
[in]angle22nd angle for pattern.
[in]pitch22nd pitch for pattern.

Definition at line 56 of file o_circle.c.

static void o_circle_fill_fill ( GSCHEM_TOPLEVEL w_current,
COLOR *  color,
CIRCLE *  circle,
gint  fill_width,
gint  angle1,
gint  pitch1,
gint  angle2,
gint  pitch2 
) [static]
Function Description
This function fills the inside of the circle with a solid pattern. Parameters angle1, pitch1 and angle2, pitch2 and width are unused here but kept for compatibility with other circle filling functions.

The circle is described by the coordinates of its center and its radius. Please not that it is not the way GDK take it. Translation is made afterward.

The unit for width, pitch1 and pitch2 is pixel and unit for angle1 and angle2 is degree.

Parameters:
[in]w_currentSchematic top level
[in]colorCircle fill color.
[in]circleCircle to be drawn
[in]fill_width
[in]angle1(unused)
[in]pitch1(unused)
[in]angle2(unused)
[in]pitch2(unused)

Definition at line 88 of file o_circle.c.

static void o_circle_fill_hatch ( GSCHEM_TOPLEVEL w_current,
COLOR *  color,
CIRCLE *  circle,
gint  fill_width,
gint  angle1,
gint  pitch1,
gint  angle2,
gint  pitch2 
) [static]
Function Description
This function fills the inside of the circle with a pattern made of lines. The lines are drawn inside the circle with an angle angle1 from the horizontal. The distance between two of these lines is given by pitch1 and their width by width. Parameters angle2, pitch2 are unused here but kept for compatibility with other circle filling functions.

The circle is described by the coordinates of its center and its radius. Please not that it is not the way GDK take it. Translation is made afterward.

The unit for width, pitch1 and pitch2 is pixel and unit for angle1 and angle2 is degree.

The only attribute of line here is its width from the parameter width.

Negative or null values for pitch1 are not allowed as it leads to an endless loop.

Parameters:
[in]w_currentSchematic top level
[in]colorCircle fill color.
[in]circleCircle to be drawn
[in]fill_width
[in]angle11st angle for pattern.
[in]pitch11st pitch for pattern.
[in]angle2(unused)
[in]pitch2(unused)

Definition at line 128 of file o_circle.c.

Here is the call graph for this function:

static void o_circle_fill_mesh ( GSCHEM_TOPLEVEL w_current,
COLOR *  color,
CIRCLE *  circle,
gint  fill_width,
gint  angle1,
gint  pitch1,
gint  angle2,
gint  pitch2 
) [static]
Function Description
This function fills the inside of the circle with a pattern made of set of parallel lines in two directions. The first set is drawn inside the circle with an angle angle1 from the horizontal. The distance between two of these lines is given by pitch1. The second set is drawn inside the circle with an angle angle2 from the horizontal. The distance between two of these lines is given by pitch2. Every lines have the same width given by width.

The unit for width, pitch1 and pitch2 is pixel and unit for angle1 and angle2 is degree.

This function simply makes two successive calls to the function o_circle_fill_hatch() respectively with angle1, pitch1 and angle2, pitch2 for parameters.

Parameters:
[in]w_currentSchematic top level
[in]colorCircle fill color.
[in]circleCircle to be drawn
[in]fill_width
[in]angle11st angle for pattern.
[in]pitch11st pitch for pattern.
[in]angle22nd angle for pattern.
[in]pitch22nd pitch for pattern.

Definition at line 181 of file o_circle.c.

Here is the call graph for this function:

void o_circle_draw ( GSCHEM_TOPLEVEL w_current,
OBJECT *  o_current 
)
Function Description
This function is used to draw a circle on screen. The circle is described by the OBJECT which is referred by o_current. The display is done according to the current state, given by the GSCHEM_TOPLEVEL object pointed by w_current.

It first checks if the OBJECT pointed is valid or not. If not it returns and do not output anything. That should never happen though.

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]o_currentCircle OBJECT to draw.

Definition at line 208 of file o_circle.c.

Here is the call graph for this function:

void o_circle_invalidate_rubber ( GSCHEM_TOPLEVEL w_current)
Todo:
Finish function documentation!!!
Function Description

Definition at line 319 of file o_circle.c.

Here is the call graph for this function:

void o_circle_draw_place ( GSCHEM_TOPLEVEL w_current,
int  dx,
int  dy,
OBJECT *  o_current 
)
Function Description
This function draws the circle object described by *o_current translated by the vector (dx,dy). The translation vector is in world unit.

The circle is displayed with the color of the object.

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]dxDelta x coordinate for circle.
[in]dyDelta y coordinate for circle.
[in]o_currentCircle OBJECT to draw.
Todo:
add in offsets, get rid of global diffs_x,y

Definition at line 346 of file o_circle.c.

Here is the call graph for this function:

void o_circle_start ( GSCHEM_TOPLEVEL w_current,
int  w_x,
int  w_y 
)
Function Description
This function starts the process to input a new circle. Parameters for this circle are pu into/extracted from the w_current toplevel structure. w_x and w_y are current coordinates of the mouse pointer in world units.

The first step of the circle input is to set the center of the arc. This center is kept in (w_current->first_wx,w_current->first_wy).

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]w_xCurrent x coordinate of pointer in world units.
[in]w_yCurrent y coordinate of pointer in world units.

Definition at line 374 of file o_circle.c.

Here is the call graph for this function:

void o_circle_end ( GSCHEM_TOPLEVEL w_current,
int  w_x,
int  w_y 
)
Function Description
This function ends the input of the radius of the circle. The (w_x,w_y) point is taken as the other end of the radius segment, i.e. on the circle. The distance between this point and the center is the radius of the circle. w_x and w_y are in world coords.

The center has previously been input and saved as (w_current->first_wx,w_current->first_wy).

The temporary circle drawn during the input of the radius is erased. A new object is allocated, initialized and linked in the object list. This new object is finally drawn.

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]w_x(unused)
[in]w_y(unused)

Definition at line 407 of file o_circle.c.

Here is the call graph for this function:

void o_circle_motion ( GSCHEM_TOPLEVEL w_current,
int  w_x,
int  w_y 
)
Function Description
This function draws a circle according to its internal representation and allows the modification of its radius. The radius is updated according to the current mouse position in w_x and w_y. It draws a full circle and the horizontal segment of the radius in the right half of the circle.

The previous temporary circle is erased, the radius is then computed and updated and finally a new temporary circle is drawn.

The arc is internally described by :

*
(w_current->first_wx,w_current->first_wy) as its center ;
*
w_current->distance as its radius.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]w_xCurrent x coordinate of pointer in world units.
[in]w_yCurrent y coordinate of pointer in world units.

Definition at line 459 of file o_circle.c.

Here is the call graph for this function:

void o_circle_draw_rubber ( GSCHEM_TOPLEVEL w_current)
Function Description
This function draws the circle from the variables in the GSCHEM_TOPLEVEL structure *w_current. The center of the circle is at (w_current->first_wx, w_current->first_wy) and its radius is in w_current->distance.

It draws a horizontal radius segment on the right half of the circle and the circle with the selection color.

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.

Definition at line 494 of file o_circle.c.

Here is the call graph for this function:

void o_circle_draw_grips ( GSCHEM_TOPLEVEL w_current,
OBJECT *  o_current 
)
Function Description
This function draws the grip that match the circle object *o_current.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]o_currentCircle OBJECT to draw grip points on.

Definition at line 518 of file o_circle.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines