gschem

o_box.c File Reference

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

Go to the source code of this file.

Defines

#define GET_BOX_WIDTH(w)   abs((w)->second_wx - (w)->first_wx)
#define GET_BOX_HEIGHT(w)   abs((w)->second_wy - (w)->first_wy)
#define GET_BOX_LEFT(w)   min((w)->first_wx, (w)->second_wx)
#define GET_BOX_TOP(w)   max((w)->first_wy, (w)->second_wy)

Typedefs

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

Functions

static void o_box_fill_hollow (GSCHEM_TOPLEVEL *w_current, COLOR *color, BOX *box, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Placeholder filling function.
static void o_box_fill_fill (GSCHEM_TOPLEVEL *w_current, COLOR *color, BOX *box, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Fill inside of box with a solid pattern.
static void o_box_fill_hatch (GSCHEM_TOPLEVEL *w_current, COLOR *color, BOX *box, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Fill inside of box with single line pattern.
static void o_box_fill_mesh (GSCHEM_TOPLEVEL *w_current, COLOR *color, BOX *box, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2)
 Fill inside of box with mesh pattern.
void o_box_draw (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 Draw a box on the screen.
void o_box_invalidate_rubber (GSCHEM_TOPLEVEL *w_current)
void o_box_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
 Draw a box described by OBJECT with translation.
void o_box_start (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 Start process to input a new box.
void o_box_end (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 End the input of a box.
void o_box_motion (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 Draw temporary box while dragging edge.
void o_box_draw_rubber (GSCHEM_TOPLEVEL *w_current)
 Draw box from GSCHEM_TOPLEVEL object.
void o_box_draw_grips (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 Draw grip marks on box.

Define Documentation

#define GET_BOX_WIDTH (   w)    abs((w)->second_wx - (w)->first_wx)

Definition at line 30 of file o_box.c.

#define GET_BOX_HEIGHT (   w)    abs((w)->second_wy - (w)->first_wy)

Definition at line 32 of file o_box.c.

#define GET_BOX_LEFT (   w)    min((w)->first_wx, (w)->second_wx)

Definition at line 34 of file o_box.c.

#define GET_BOX_TOP (   w)    max((w)->first_wy, (w)->second_wy)

Definition at line 36 of file o_box.c.


Typedef Documentation

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

Definition at line 39 of file o_box.c.


Function Documentation

static void o_box_fill_hollow ( GSCHEM_TOPLEVEL w_current,
COLOR *  color,
BOX *  box,
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_box_draw().
Parameters:
[in]w_currentSchematic top level
[in]colorBox fill color.
[in]boxBox definition
[in]fill_widthBOX pattern 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 61 of file o_box.c.

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

The box is defined in the same way as it is in GDK : one point and the width and height of the box.

All parameters are given in pixel.

Parameters:
[in]w_currentSchematic top level
[in]colorBox fill color.
[in]boxBox definition
[in]fill_widthBOX pattern fill width.
[in]angle1(unused)
[in]pitch1(unused)
[in]angle2(unused)
[in]pitch2(unused)

Definition at line 91 of file o_box.c.

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

The box is defined in the same way as it is in GDK : one point and the width and height of the box.

All parameters are given in pixel.

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

Parameters:
[in]w_currentSchematic top level
[in]colorBox fill color.
[in]boxBox definition
[in]fill_widthBOX pattern fill width.
[in]angle11st angle for pattern.
[in]pitch11st pitch for pattern.
[in]angle2(unused)
[in]pitch2(unused)

Definition at line 127 of file o_box.c.

Here is the call graph for this function:

static void o_box_fill_mesh ( GSCHEM_TOPLEVEL w_current,
COLOR *  color,
BOX *  box,
gint  fill_width,
gint  angle1,
gint  pitch1,
gint  angle2,
gint  pitch2 
) [static]
Function Description
This function fills the inside of the box with a pattern made of two sets of parallel lines in two directions. The first set is drawn inside the box 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 box 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 be fill_width.

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

Parameters:
[in]w_currentSchematic top level
[in]colorBox fill color.
[in]boxBox definition
[in]fill_widthBOX pattern 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 176 of file o_box.c.

Here is the call graph for this function:

void o_box_draw ( GSCHEM_TOPLEVEL w_current,
OBJECT *  o_current 
)
Function Description
This function is used to draw a box on screen. The box is described in the OBJECT which is referred by o_current. The box is displayed according to the current state, described in 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_currentBOX OBJECT to draw.

Definition at line 200 of file o_box.c.

Here is the call graph for this function:

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

Definition at line 327 of file o_box.c.

Here is the call graph for this function:

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

The box is displayed with the color of the object.

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

Definition at line 353 of file o_box.c.

Here is the call graph for this function:

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

The first step is to input one corner of the box. This corner is (w_x,w_y) snapped to the grid and saved in w_current->first_wx and w_current->first_wy.

The other corner will be saved in (w_current->second_wx, w_current->second_wy).

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

Definition at line 386 of file o_box.c.

Here is the call graph for this function:

void o_box_end ( GSCHEM_TOPLEVEL w_current,
int  w_x,
int  w_y 
)
Function Description
This function ends the input of the second corner of a box. The (w_x,w_y) point is set to be this second corner. The box is then defined by (w_current->first_wx,w_current->first_wy and (w_current->second_wx,w_current->second_wy. w_x and w_y are in screen unit.

The temporary box is erased ; a new box object is allocated, initialized and linked to the object list ; The object is finally drawn on the current sheet.

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 412 of file o_box.c.

Here is the call graph for this function:

void o_box_motion ( GSCHEM_TOPLEVEL w_current,
int  w_x,
int  w_y 
)
Function Description
This function is used to draw the box while dragging one of its edge or angle. It erases the previous temporary box drawn before, and draws a new updated one. w_x and w_y are the new position of the mobile point, ie the mouse.

The old values are inside the w_current pointed structure. Old width, height and left and top values are recomputed by the corresponding macros.

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 481 of file o_box.c.

Here is the call graph for this function:

void o_box_draw_rubber ( GSCHEM_TOPLEVEL w_current)
Function Description
This function draws the box from the variables in the GSCHEM_TOPLEVEL structure *w_current. One corner of the box is at (w_current->first_wx, w_current->first_wy) and the second corner is at (w_current->second_wx,w_current->second_wy.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.

Definition at line 515 of file o_box.c.

Here is the call graph for this function:

void o_box_draw_grips ( GSCHEM_TOPLEVEL w_current,
OBJECT *  o_current 
)
Function Description
This function draws four grips on the corners of the box described by *o_current.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]o_currentBox OBJECT to draw grip points on.

Definition at line 532 of file o_box.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines