gschem

o_basic.c File Reference

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

Go to the source code of this file.

Defines

#define INVALIDATE_MARGIN   1

Functions

void o_redraw_rects (GSCHEM_TOPLEVEL *w_current, GdkRectangle *rectangles, int n_rectangles)
void o_redraw (GSCHEM_TOPLEVEL *w_current, GList *object_list, gboolean draw_selected)
void o_redraw_single (GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 Redraw an object on the screen.
int o_invalidate_rubber (GSCHEM_TOPLEVEL *w_current)
int o_redraw_cleanstates (GSCHEM_TOPLEVEL *w_current)
void o_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *object)
void o_glist_draw_place (GSCHEM_TOPLEVEL *w_current, int dx, int dy, GList *list)
void o_invalidate_rect (GSCHEM_TOPLEVEL *w_current, int x1, int y1, int x2, int y2)
 Invalidates a rectangular region of the on screen drawing area.
void o_invalidate_all (GSCHEM_TOPLEVEL *w_current)
 Invalidate the whole on-screen area.
void o_invalidate (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
 Invalidate on-screen area for an object.
void o_invalidate_glist (GSCHEM_TOPLEVEL *w_current, GList *list)
 Invalidate on-screen area for a GList of objects.
COLOR * o_drawing_color (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
 Returns the color an object should be drawn in.

Define Documentation

#define INVALIDATE_MARGIN   1

Definition at line 29 of file o_basic.c.


Function Documentation

void o_redraw_rects ( GSCHEM_TOPLEVEL w_current,
GdkRectangle *  rectangles,
int  n_rectangles 
)
Todo:
Lots of Gross code... needs lots of cleanup - mainly readability issues
Todo:
Finish function documentation!!!
Function Description

Definition at line 40 of file o_basic.c.

Here is the call graph for this function:

void o_redraw ( GSCHEM_TOPLEVEL w_current,
GList *  object_list,
gboolean  draw_selected 
)
Todo:
Finish function documentation!!!
Function Description

Definition at line 190 of file o_basic.c.

Here is the call graph for this function:

void o_redraw_single ( GSCHEM_TOPLEVEL w_current,
OBJECT *  o_current 
)
Function Description
This function will redraw a single object on the screen.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]o_currentThe OBJECT to redraw.

Definition at line 214 of file o_basic.c.

Here is the call graph for this function:

int o_invalidate_rubber ( GSCHEM_TOPLEVEL w_current)
Todo:
Finish function documentation!!!
Function Description

Definition at line 249 of file o_basic.c.

Here is the call graph for this function:

int o_redraw_cleanstates ( GSCHEM_TOPLEVEL w_current)
Todo:
Finish function documentation!!!
Function Description
This function is neccesary to make jumps between event_states. If we are inside an drawing action that created something on the dc, e.g. if we are drawing a box and then jump to line drawing without leaving the box drawing mode, there will remain some rubberbands on the screen. Usually a intermediate select state would clean (redraw) the screen.

Definition at line 319 of file o_basic.c.

Here is the call graph for this function:

void o_draw_place ( GSCHEM_TOPLEVEL w_current,
int  dx,
int  dy,
OBJECT *  object 
)
Todo:
Finish function documentation!!!
Function Description

Definition at line 422 of file o_basic.c.

Here is the call graph for this function:

void o_glist_draw_place ( GSCHEM_TOPLEVEL w_current,
int  dx,
int  dy,
GList *  list 
)
Todo:
Finish function documentation!!!
Function Description

Definition at line 454 of file o_basic.c.

Here is the call graph for this function:

void o_invalidate_rect ( GSCHEM_TOPLEVEL w_current,
int  x1,
int  y1,
int  x2,
int  y2 
)
Function Description

Given a pair of (x,y) coordinates in SCREEN units, invalidate the rectangular on-screen drawing area which has those two coordinate pairs as opposite corners of its region. This will cause that region to be blitted from the back-buffer once the mainloop reaches idle.

A margin, INVALIDATE_MARGIN is added to the invalidated region as a hacky workaround for rounding errors which may occur in the WORLD -> SCREEN coordinate transform. This margin may also be used to expand the invalidated region if anti-aliased drawing is ever used.

A further, larger margin is added to account for invalidating the size occupied by an object's grips.

If the GSCHEM_TOPLEVEL in question is not rendering to a GDK_WINDOW, (e.g. image export), this function call is a no-op. A test is used: GDK_IS_WINDOW(), which should be safe since in either case, w_current->window is a GObject. This is really a _HACK_, and should be fixed with a re-worked drawing model.

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL who's drawing area is being invalidated.
[in]x1X coord for corner 1 (SCREEN units)
[in]y1Y coord for corner 1 (SCREEN units)
[in]x2X coord for corner 2 (SCREEN units)
[in]y2Y coord for corner 2 (SCREEN units)

Definition at line 494 of file o_basic.c.

Here is the call graph for this function:

void o_invalidate_all ( GSCHEM_TOPLEVEL w_current)
Function Description
This function calls gdk_window_invalidate_rect() with a rect of NULL, causing the entire drawing area to be invalidated.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.

Definition at line 527 of file o_basic.c.

void o_invalidate ( GSCHEM_TOPLEVEL w_current,
OBJECT *  object 
)
Function Description
This function calls o_invalidate_rect() with the bounds of the passed OBJECT, converted to screen coordinates.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]objectThe OBJECT invalidated on screen.

Definition at line 542 of file o_basic.c.

Here is the call graph for this function:

void o_invalidate_glist ( GSCHEM_TOPLEVEL w_current,
GList *  list 
)
Function Description
This function calls o_invalidate_rect() with the bounds of the passed GList, converted to screen coordinates.
Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]listThe glist objects invalidated on screen.

Definition at line 565 of file o_basic.c.

Here is the call graph for this function:

COLOR* o_drawing_color ( GSCHEM_TOPLEVEL w_current,
OBJECT *  object 
)
Function Description
This function looks up and returns either the SELECT_COLOR, or the OBJECT's natural colour, as appropriate. If toplevel->override_color is set, that takes precedence.

The parent field of the OBJECT structure is used to recurse down and check whether the OBJECT being drawn is a prim_obj belonging to some selected OBJECT. If so, SELECT_COLOR is used.

As a convenience, the appropriate color index is looked up using x_color_lookup(), so that code is not duplicated in each drawing function.

Parameters:
[in]w_currentThe GSCHEM_TOPLEVEL object.
[in]objectThe OBJECT whos color to return.

Definition at line 597 of file o_basic.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines