#ifndef SEEN_SP_CANVAS_H
#define SEEN_SP_CANVAS_H
/**
* @file
* SPCanvas, SPCanvasBuf.
*/
/*
* Authors:
* Federico Mena <federico@nuclecu.unam.mx>
* Raph Levien <raph@gimp.org>
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon A. Cruz <jon@joncruz.org>
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
*
* Copyright (C) 1998 The Free Software Foundation
* Copyright (C) 2002 Lauris Kaplinski
* Copyright (C) 2016 Google Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdint.h>
struct SPCanvas;
struct SPCanvasItem;
struct SPCanvasGroup;
enum {
};
/**
* Structure used when rendering canvas items.
*/
struct SPCanvasBuf {
unsigned char *buf;
int buf_rowstride;
bool is_empty;
};
// SPCanvas -------------------------------------------------
struct PaintRectSetup;
/**
* Port of GnomeCanvas for inkscape needs.
*/
struct SPCanvas {
/// Scrolls canvas to specific position (cx and cy are measured in screen pixels).
/// Synchronously updates the canvas if necessary.
void updateNow();
/// Queues a redraw of rectangular canvas area.
void requestUpdate();
void forceFullRedrawAfterInterruptions(unsigned int count);
void endForcedFullRedraws();
SPCanvasGroup *getRoot();
void setBackgroundCheckerboard();
/// Returns new canvas as widget.
/// Emits an event for an item in the canvas, be it the current
/// item, grabbed item, or focused item, as appropriate.
/// Re-picks the current item in the canvas, based on the event's
void shutdownTransients();
/// Allocates a new tile array for the canvas, copying overlapping tiles from the old array
/// Marks the specified area as dirty (requiring redraw)
/// Marks the whole widget for redraw
void dirtyAll();
/// Invokes update, paint, and repick on canvas.
int doUpdate();
/**
* Paint the given rect, recursively subdividing the region until it is the size of a single
* buffer.
*
* @return true if the drawing completes
*/
/// Draws a specific rectangular part of the canvas.
/// @return true if the rectangle painting succeeds.
/// Repaints the areas in the canvas that need it.
/// @return true if all the dirty parts have been redrawn
int paint();
/// Idle handler for the canvas that deals with pending updates and redraws.
/// Convenience function to add an idle handler to a canvas.
void addIdle();
void removeIdle();
// GTK virtual functions.
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
/**
* Scroll event handler for the canvas.
*
* @todo FIXME: generate motion events to re-select items.
*/
#if !GTK_CHECK_VERSION(3,0,0)
#endif
// Data members: ----------------------------------------------------------
bool _is_dragging;
double _dx0;
double _dy0;
/// Image surface storing the contents of the widget
/// Area of the widget that has up-to-date content
/// Widget background, defaults to white
/// Last known modifier state, for deferred repick when a button is down.
int _state;
/** The item containing the mouse pointer, or NULL if none. */
/** Item that is about to become current (used to track deletions and such). */
/** Item that holds a pointer grab, or NULL if none. */
/** Event mask specified when grabbing an item. */
/** If non-NULL, the currently focused item. */
/** Event on which selection of current item is based. */
int _close_enough;
int _forced_redraw_count;
int _forced_redraw_limit;
/** For use by internal pick_current_item() function. */
/** For use by internal pick_current_item() function. */
// In most tools Inkscape only generates enter and leave events
// on the current item, but no other enter events if a mouse button
// is depressed -- see function pickCurrentItem(). Some tools
// may wish the canvas to generate to all enter events, (e.g., the
// connector tool). If so, they may temporarily set this flag to
// 'true'.
bool _gen_all_enter_events;
/** For scripting, sometimes we want to delay drawing. */
bool _drawing_disabled;
int _rendermode;
int _colorrendermode;
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
bool _enable_cms_display_adj;
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
bool _is_scrolling;
};
void sp_canvas_window_to_world(SPCanvas const *canvas, double winx, double winy, double *worldx, double *worldy);
void sp_canvas_world_to_window(SPCanvas const *canvas, double worldx, double worldy, double *winx, double *winy);
#endif // SEEN_SP_CANVAS_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :