Example #1
0
/** redraw every node on the canvas from the buffer (without
 * necessarily reexamining the grid) */
void
Canvas::redraw ( void )
{
    DMESSAGE( "redrawing canvas" );

    if ( ! m.grid_drawn )
        draw();

    m.ruler_drawn = false;
    m.mapping_drawn = false;

    draw_mapping();
    draw_ruler();

    for ( int y = m.vp->h; y--; )
        for ( int x = m.vp->w; x--; )
        {
            cell_t c = m.previous[ x ][ y ];

            if ( c.shape > HEXAGON ) return;

            if ( m.vp->x + x == m.playhead )
                c.flags |= F_PLAYHEAD;

            gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, m.border_w,
                            c.shape, c.state, c.flags, c.color );
        }
}
Example #2
0
/* snap ruler back to origing (0,0) */
void
ruler_snap_origin(XEvent *event)
{
    clear_ruler();
    g_ruler_pos_x = g_ruler_pos_y = 0;
    draw_ruler(g_ruler_pos_x, g_ruler_pos_y);
    /* deactivate mouse dragging */
    mouse_motion = mouse_release = null_mouse;
    show_distance_from_ruler(event, False);
}
Example #3
0
/** draw ONLY those nodes necessary to bring the canvas up-to-date with the grid */
void
Canvas::draw ( void )
{
    DMESSAGE( "drawing canvas" );

    draw_mapping();
    draw_ruler();

    m.grid_drawn = true;

    m.grid->draw( this, m.vp->x, m.vp->y, m.vp->w, m.vp->h );
}
Example #4
0
void
drag_ruler_motion(XEvent *event)
{
    int loc_x, loc_y;
    if (event == NULL) { /* toggled via menu */
	/* hack to avoid redrawing ruler at last g_* positions when mode is
	   toggled on via menu, then off via keystroke */
	g_ruler_pos_x = g_ruler_pos_y = 0;
	return;
    }
    
    loc_x = event->xbutton.x;
    loc_y = event->xbutton.y;

    if (event->xbutton.window != mane.win) {
	Window dummy;
	(void)XTranslateCoordinates(DISP,
				    RootWindowOfScreen(SCRN), mane.win,
				    event->xbutton.x_root,
				    event->xbutton.y_root,
				    &loc_x,
				    &loc_y,
				    &dummy);
    }

    /* map everything below 0 to the origin */
    if (loc_x < 0)
	loc_x = 0;
    if (loc_y < 0)
	loc_y = 0;
    
    clear_ruler();
    draw_ruler(loc_x, loc_y);
    g_ruler_pos_x = loc_x;
    g_ruler_pos_y = loc_y;
}
Example #5
0
void
redraw_ruler(void)
{
    draw_ruler(g_ruler_pos_x, g_ruler_pos_y);
}