gschem

o_arc.c File Reference

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

Go to the source code of this file.

Functions

void o_arc_draw (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 Draw an arc on the screen.
void o_arc_invalidate_rubber (GSCHEM_TOPLEVEL *w_current)
void o_arc_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
 Draw an arc described by OBJECT with translation.
void o_arc_start (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 Start process to input a new arc.
void o_arc_end1 (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 End the input of an arc.
void o_arc_end4 (GSCHEM_TOPLEVEL *w_current, int radius, int start_angle, int end_angle)
 Ends the process of arc input.
void o_arc_motion (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y, int whichone)
 Draw an arc using one angle modification.
void o_arc_draw_rubber (GSCHEM_TOPLEVEL *w_current)
 Draw arc from GSCHEM_TOPLEVEL object.
void o_arc_draw_grips (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 Draw grip marks on arc.

Function Documentation

void o_arc_draw ( GSCHEM_TOPLEVEL w_current,
OBJECT *  o_current 
)
Function Description
This function is used to draw an arc on screen. The arc is described in the object which is referred by o_current. The arc is displayed according to the current state, described in the GSCHEM_TOPLEVEL object pointed by w_current.

It first checkes if the object 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_currentThe arc OBJECT to draw.

Definition at line 44 of file o_arc.c.

Here is the call graph for this function:

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

Definition at line 75 of file o_arc.c.

Here is the call graph for this function:

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

The arc is displayed with the color of the object.

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]dxDelta x coordinate for arc.
[in]dyDelta y coordinate for arc.
[in]o_currentArc OBJECT to draw.

Definition at line 100 of file o_arc.c.

Here is the call graph for this function:

void o_arc_start ( GSCHEM_TOPLEVEL w_current,
int  w_x,
int  w_y 
)
Function Description
This function starts the process to input a new arc. Parameters for this arc are put into/extracted from the w_current toplevel structure. w_x and w_y are current coordinates of the pointer in screen unit.

First step of the arc input is to set the radius of the arc. The center of the arc is kept in (w_current->first_wx,w_current->first_wy). The radius of the arc is in w_current->distance.

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 129 of file o_arc.c.

Here is the call graph for this function:

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

At the end of this function, the center of the arc is at (w_current->first_wx,w_current->first_wy) and its radius is w_current->distance.

The two angles needs to be input to fully define the arc.

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

Definition at line 163 of file o_arc.c.

Here is the call graph for this function:

void o_arc_end4 ( GSCHEM_TOPLEVEL w_current,
int  radius,
int  start_angle,
int  end_angle 
)
Function Description
The o_arc_end4() function ends the process of the input of an arc. start_angle and end_angle are the start and end angle of the arc in degrees. The partial internal representation of the arc, i.e. the center and the radius of the arc, are converted in world units. A new object is created and linked to the object list.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]radiusRadius of the arc
[in]start_angleStart of angle in degrees.
[in]end_angleEnd of angle in degrees.

Definition at line 197 of file o_arc.c.

Here is the call graph for this function:

void o_arc_motion ( GSCHEM_TOPLEVEL w_current,
int  w_x,
int  w_y,
int  whichone 
)
Function Description
This function draws an arc according to its internal representation and allows the modification of one of its angle. The start or end angle of the arc is updated according to whichone with the angle that the current pointer and the arc center are making with the horizontal.

The previous temporary arc is erased, the angle is then computed and updated and finally a new temporary arc with the new angle 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.
*
w_current->second_wx and w_current->second_wx as its start and end angle respectively.
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.
[in]whichoneWhich angle to change.

whichone can have one of the following values:

ARC_RADIUS
at the center of the arc. This grip is used to modify the radius of the arc.
ARC_START_ANGLE
at one end of the arc. It corresponds to the starting angle of the arc.
ARC_END_ANGLE
at the other end of the arc. It corresponds to the ending angle of the arc.

Definition at line 258 of file o_arc.c.

Here is the call graph for this function:

void o_arc_draw_rubber ( GSCHEM_TOPLEVEL w_current)
Function Description
This function draws the arc from the variables in the GSCHEM_TOPLEVEL structure *w_current. The center of the arc is at (w_current->first_wx, w_current->first_wy), its radius equal to w_current->distance, and the start and end angle are given by w_current->second_wx and w_current->second_wy.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.

Definition at line 318 of file o_arc.c.

Here is the call graph for this function:

void o_arc_draw_grips ( GSCHEM_TOPLEVEL w_current,
OBJECT *  o_current 
)
Function Description
This function draws three grips on the center and on the ends of the arc object described by *o_current.
Parameters:
[in]w_currentThe GSCHE_TOPLEVEL object.
[in]o_currentArc OBJECT to draw grip points on.

Definition at line 353 of file o_arc.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines