X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fdocument.h;h=a5cc3b855bf794efe47e31fb4d4a248417ea0b52;hb=7a1aa487fd405063c8aea5e19fed056f1ace3d75;hp=9739b69719baca6dbc9a4c38e76c87387b1e67cc;hpb=535b1596de71acb960a629b0f34f0d2171a34348;p=inkscape.git diff --git a/src/document.h b/src/document.h index 9739b6971..a5cc3b855 100644 --- a/src/document.h +++ b/src/document.h @@ -27,6 +27,9 @@ #include "gc-finalized.h" #include "gc-anchored.h" #include +#include "verbs.h" +#include +#include namespace Avoid { class Router; @@ -42,95 +45,126 @@ namespace Inkscape { struct Application; class Selection; class UndoStackObserver; + class EventLog; + class ProfileManager; namespace XML { class Document; class Node; } } +class SP3DBox; +class Persp3D; + +namespace Proj { + class TransfMat3x4; +} + class SPDocumentPrivate; /// Typed SVG document implementation. struct SPDocument : public Inkscape::GC::Managed<>, public Inkscape::GC::Finalized, - public Inkscape::GC::Anchored + public Inkscape::GC::Anchored { - typedef sigc::signal IDChangedSignal; - typedef sigc::signal ResourcesChangedSignal; - typedef sigc::signal ModifiedSignal; - typedef sigc::signal URISetSignal; - typedef sigc::signal ResizedSignal; - typedef sigc::signal ReconstructionStart; - typedef sigc::signal ReconstructionFinish; + typedef sigc::signal IDChangedSignal; + typedef sigc::signal ResourcesChangedSignal; + typedef sigc::signal ModifiedSignal; + typedef sigc::signal URISetSignal; + typedef sigc::signal ResizedSignal; + typedef sigc::signal ReconstructionStart; + typedef sigc::signal ReconstructionFinish; + typedef sigc::signal CommitSignal; + + SPDocument(); + virtual ~SPDocument(); + + unsigned int keepalive : 1; + unsigned int virgin : 1; ///< Has the document never been touched? + unsigned int modified_since_save : 1; + + Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document + Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document + SPObject *root; ///< Our SPRoot + CRCascade *style_cascade; + + gchar *uri; ///< URI string or NULL + gchar *base; + gchar *name; - SPDocument(); - ~SPDocument(); + SPDocumentPrivate *priv; - unsigned int keepalive : 1; - unsigned int virgin : 1; ///< Has the document never been touched? + /// Last action key + const gchar *actionkey; + /// Handler ID + guint modified_id; - Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document - Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document - SPObject *root; ///< Our SPRoot - CRCascade *style_cascade; + Inkscape::ProfileManager* profileManager; - gchar *uri; ///< URI string or NULL - gchar *base; - gchar *name; + // Instance of the connector router + Avoid::Router *router; - SPDocumentPrivate *priv; + GSList *perspectives; - /// Last action key - const gchar *actionkey; - /// Handler ID - guint modified_id; + Persp3D *current_persp3d; // "currently active" perspective (e.g., newly created boxes are attached to this one) - // Instance of the connector router - Avoid::Router *router; + GSList *_collection_queue; - sigc::connection connectModified(ModifiedSignal::slot_type slot); - sigc::connection connectURISet(URISetSignal::slot_type slot); - sigc::connection connectResized(ResizedSignal::slot_type slot); + void add_persp3d (Persp3D * const persp); + void remove_persp3d (Persp3D * const persp); - void bindObjectToId(gchar const *id, SPObject *object); - SPObject *getObjectById(gchar const *id); - sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot); + sigc::connection connectModified(ModifiedSignal::slot_type slot); + sigc::connection connectURISet(URISetSignal::slot_type slot); + sigc::connection connectResized(ResizedSignal::slot_type slot); +sigc::connection connectCommit(CommitSignal::slot_type slot); - void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object); - SPObject *getObjectByRepr(Inkscape::XML::Node *repr); + void bindObjectToId(gchar const *id, SPObject *object); + SPObject *getObjectById(gchar const *id); + sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot); + + void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object); + SPObject *getObjectByRepr(Inkscape::XML::Node *repr); Glib::ustring getLanguage(); - void queueForOrphanCollection(SPObject *object); - void collectOrphans(); + void queueForOrphanCollection(SPObject *object); + void collectOrphans(); + + void _emitModified(); + + void addUndoObserver(Inkscape::UndoStackObserver& observer); + void removeUndoObserver(Inkscape::UndoStackObserver& observer); - void _emitModified(); + bool _updateDocument(); - GSList *_collection_queue; + /// Are we currently in a transition between two "known good" states of the document? + bool isSeeking() const; - void addUndoObserver(Inkscape::UndoStackObserver& observer); - void removeUndoObserver(Inkscape::UndoStackObserver& observer); + bool isModifiedSinceSave() const { return modified_since_save; } + void setModifiedSinceSave(bool modified = true) { + modified_since_save = modified; + } private: - SPDocument(SPDocument const &); // no copy - void operator=(SPDocument const &); // no assign + SPDocument(SPDocument const &); // no copy + void operator=(SPDocument const &); // no assign public: - sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot); - sigc::connection connectReconstructionFinish (ReconstructionFinish::slot_type slot); - void emitReconstructionStart (void); - void emitReconstructionFinish (void); + sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot); + sigc::connection connectReconstructionFinish (ReconstructionFinish::slot_type slot); + void emitReconstructionStart (void); + void emitReconstructionFinish (void); - void reset_key (void *dummy); - sigc::connection _selection_changed_connection; - sigc::connection _desktop_activated_connection; + unsigned long serial() const; + void reset_key (void *dummy); + sigc::connection _selection_changed_connection; + sigc::connection _desktop_activated_connection; - void fitToRect(NRRect const & rect); + void fitToRect(NR::Rect const &rect); }; SPDocument *sp_document_new (const gchar *uri, unsigned int keepalive, bool make_new = false); SPDocument *sp_document_new_from_mem (const gchar *buffer, gint length, unsigned int keepalive); -SPDocument *sp_document_new_dummy(); SPDocument *sp_document_ref (SPDocument *doc); SPDocument *sp_document_unref (SPDocument *doc); @@ -167,8 +201,8 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit * Undo & redo */ -void sp_document_set_undo_sensitive (SPDocument * document, gboolean sensitive); -gboolean sp_document_get_undo_sensitive (SPDocument const * document); +void sp_document_set_undo_sensitive (SPDocument * document, bool sensitive); +bool sp_document_get_undo_sensitive (SPDocument const * document); void sp_document_clear_undo (SPDocument * document); void sp_document_clear_redo (SPDocument * document); @@ -184,8 +218,8 @@ void sp_document_request_modified (SPDocument *doc); gint sp_document_ensure_up_to_date (SPDocument *doc); /* Save all previous actions to stack, as one undo step */ -void sp_document_done (SPDocument *document); -void sp_document_maybe_done (SPDocument *document, const gchar *key); +void sp_document_done (SPDocument *document, unsigned int event_type, Glib::ustring event_description); +void sp_document_maybe_done (SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description); void sp_document_reset_key (Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base); /* Cancel (and revert) current unsaved actions */ @@ -224,7 +258,8 @@ GSList * sp_document_items_in_box(SPDocument *document, unsigned int dkey, NR::R GSList * sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, NR::Rect const &box); SPItem* sp_document_item_from_list_at_point_bottom (unsigned int dkey, SPGroup *group, const GSList *list, NR::Point const p, bool take_insensitive = false); SPItem * sp_document_item_at_point (SPDocument *document, unsigned int key, NR::Point const p, gboolean into_groups, SPItem *upto = NULL); -SPItem * sp_document_group_at_point (SPDocument *document, unsigned int key, NR::Point const p); +GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector points); +SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, NR::Point const p); void sp_document_set_uri (SPDocument *document, const gchar *uri); void sp_document_resized_signal_emit (SPDocument *doc, gdouble width, gdouble height); @@ -232,3 +267,14 @@ void sp_document_resized_signal_emit (SPDocument *doc, gdouble width, gdouble he unsigned int vacuum_document (SPDocument *document); #endif + +/* + 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:encoding=utf-8:textwidth=99 :