summaryrefslogtreecommitdiffstats
path: root/src/ui/view
diff options
context:
space:
mode:
authorAndrew Higginson <at.higginson@gmail.com>2011-12-27 21:04:47 +0000
committerAndrew <at.higginson@gmail.com>2011-12-27 21:04:47 +0000
commit80960b623a99aae1402ab651b2974ef544ed3b03 (patch)
treeba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/ui/view
parenttry to fix bug (diff)
parentGDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff)
downloadinkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz
inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip
merged with trunk so I can build again...
(bzr r10092.1.36)
Diffstat (limited to 'src/ui/view')
-rw-r--r--src/ui/view/CMakeLists.txt10
-rw-r--r--src/ui/view/edit-widget-interface.h15
-rw-r--r--src/ui/view/view-widget.cpp43
-rw-r--r--src/ui/view/view-widget.h49
-rw-r--r--src/ui/view/view.cpp18
-rw-r--r--src/ui/view/view.h24
6 files changed, 74 insertions, 85 deletions
diff --git a/src/ui/view/CMakeLists.txt b/src/ui/view/CMakeLists.txt
deleted file mode 100644
index 5c96bc40e..000000000
--- a/src/ui/view/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-SET(ui_view_SRC
-desktop.cpp
-desktop-events.cpp
-desktop-handles.cpp
-desktop-style.cpp
-edit.cpp
-edit-widget.cpp
-view.cpp
-view-widget.cpp
-)
diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h
index 919b570dd..ba29d6225 100644
--- a/src/ui/view/edit-widget-interface.h
+++ b/src/ui/view/edit-widget-interface.h
@@ -1,8 +1,4 @@
-/**
- * \file
- *
- * Abstract base class for all EditWidget implementations.
- *
+/*
* Authors:
* Ralf Stephan <ralf@ark.in-berlin.de>
* John Bintz <jcoswell@coswellproductions.org>
@@ -16,9 +12,9 @@
#ifndef INKSCAPE_UI_VIEW_EDIT_WIDGET_IFACE_H
#define INKSCAPE_UI_VIEW_EDIT_WIDGET_IFACE_H
-#include "libnr/nr-point.h"
#include "message.h"
#include <gtkmm/window.h>
+#include <2geom/point.h>
namespace Inkscape { namespace UI { namespace Widget { class Dock; } } }
@@ -26,6 +22,9 @@ namespace Inkscape {
namespace UI {
namespace View {
+/**
+ * Abstract base class for all EditWidget implementations.
+ */
struct EditWidgetInterface
{
EditWidgetInterface() {}
@@ -137,6 +136,10 @@ struct EditWidgetInterface
/// Message widget will get no content
virtual void setMessage (Inkscape::MessageType type, gchar const* msg) = 0;
+
+ /** Show an info dialog with the given message */
+ virtual bool showInfoDialog( Glib::ustring const &message ) = 0;
+
/// Open yes/no dialog with warning text and confirmation question.
virtual bool warnDialog (gchar*) = 0;
diff --git a/src/ui/view/view-widget.cpp b/src/ui/view/view-widget.cpp
index cf0f55f2c..7876928f7 100644
--- a/src/ui/view/view-widget.cpp
+++ b/src/ui/view/view-widget.cpp
@@ -1,6 +1,4 @@
-/** \file
- * SPViewWidget implementation.
- *
+/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ralf Stephan <ralf@ark.in-berlin.de>
@@ -16,7 +14,7 @@
//using namespace Inkscape::UI::View;
-/* SPViewWidget */
+// SPViewWidget
static void sp_view_widget_class_init(SPViewWidgetClass *vwc);
static void sp_view_widget_init(SPViewWidget *widget);
@@ -24,25 +22,21 @@ static void sp_view_widget_destroy(GtkObject *object);
static GtkEventBoxClass *widget_parent_class;
-/**
- * Registers the SPViewWidget class with Glib and returns its type number.
- */
-GtkType sp_view_widget_get_type(void)
+GType sp_view_widget_get_type(void)
{
- static GtkType type = 0;
- //TODO: switch to GObject
- // GtkType and such calls were deprecated a while back with the
- // introduction of GObject as a separate layer, with GType instead. --JonCruz
+ static GType type = 0;
if (!type) {
- GtkTypeInfo info = {
- (gchar*) "SPViewWidget",
- sizeof(SPViewWidget),
+ GTypeInfo info = {
sizeof(SPViewWidgetClass),
- (GtkClassInitFunc) sp_view_widget_class_init,
- (GtkObjectInitFunc) sp_view_widget_init,
- NULL, NULL, NULL
- };
- type = gtk_type_unique(GTK_TYPE_EVENT_BOX, &info);
+ NULL, NULL,
+ (GClassInitFunc) sp_view_widget_class_init,
+ NULL, NULL,
+ sizeof(SPViewWidget),
+ 0,
+ (GInstanceInitFunc) sp_view_widget_init,
+ NULL
+ };
+ type = g_type_register_static (GTK_TYPE_EVENT_BOX, "SPViewWidget", &info, (GTypeFlags)0);
}
return type;
@@ -55,7 +49,7 @@ static void sp_view_widget_class_init(SPViewWidgetClass *vwc)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS(vwc);
- widget_parent_class = (GtkEventBoxClass*) gtk_type_class(GTK_TYPE_EVENT_BOX);
+ widget_parent_class = (GtkEventBoxClass*) g_type_class_peek_parent(vwc);
object_class->destroy = sp_view_widget_destroy;
}
@@ -90,10 +84,6 @@ static void sp_view_widget_destroy(GtkObject *object)
Inkscape::GC::request_early_collection();
}
-/**
- * Connects widget to view's 'resized' signal and calls virtual set_view()
- * function.
- */
void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view)
{
g_return_if_fail(vw != NULL);
@@ -110,9 +100,6 @@ void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view)
}
}
-/**
- * Calls the virtual shutdown() function of the SPViewWidget.
- */
bool sp_view_widget_shutdown(SPViewWidget *vw)
{
g_return_val_if_fail(vw != NULL, TRUE);
diff --git a/src/ui/view/view-widget.h b/src/ui/view/view-widget.h
index 9b5e9c4a8..668f9d19a 100644
--- a/src/ui/view/view-widget.h
+++ b/src/ui/view/view-widget.h
@@ -1,9 +1,7 @@
#ifndef INKSCAPE_UI_VIEW_VIEWWIDGET_H
#define INKSCAPE_UI_VIEW_VIEWWIDGET_H
-/** \file
- * A widget is the UI context for a document view.
- *
+/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ralf Stephan <ralf@ark.in-berlin.de>
@@ -14,33 +12,48 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include <gtk/gtkeventbox.h>
+#include <gtk/gtk.h>
namespace Inkscape {
- namespace UI {
- namespace View {
- class View;
- }}}
+namespace UI {
+namespace View {
+class View;
+} // namespace View
+} // namespace UI
+} // namespace Inkscape
+
class SPViewWidget;
class SPNamedView;
#define SP_TYPE_VIEW_WIDGET (sp_view_widget_get_type ())
-#define SP_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_VIEW_WIDGET, SPViewWidget))
-#define SP_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_VIEW_WIDGET, SPViewWidgetClass))
-#define SP_IS_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_VIEW_WIDGET))
-#define SP_IS_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_VIEW_WIDGET))
+#define SP_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_VIEW_WIDGET, SPViewWidget))
+#define SP_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_VIEW_WIDGET, SPViewWidgetClass))
+#define SP_IS_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_VIEW_WIDGET))
+#define SP_IS_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_VIEW_WIDGET))
#define SP_VIEW_WIDGET_VIEW(w) (SP_VIEW_WIDGET (w)->view)
#define SP_VIEW_WIDGET_DOCUMENT(w) (SP_VIEW_WIDGET (w)->view ? ((SPViewWidget *) (w))->view->doc : NULL)
-GType sp_view_widget_get_type (void);
+/**
+ * Registers the SPViewWidget class with Glib and returns its type number.
+ */
+GType sp_view_widget_get_type(void);
-void sp_view_widget_set_view (SPViewWidget *vw, Inkscape::UI::View::View *view);
+/**
+ * Connects widget to view's 'resized' signal and calls virtual set_view()
+ * function.
+ */
+void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view);
-/// Allows presenting 'save changes' dialog, FALSE - continue, TRUE - cancel
-bool sp_view_widget_shutdown (SPViewWidget *vw);
+/**
+ * Allows presenting 'save changes' dialog, FALSE - continue, TRUE - cancel.
+ * Calls the virtual shutdown() function of the SPViewWidget.
+ */
+bool sp_view_widget_shutdown(SPViewWidget *vw);
-/// Create a new SPViewWidget (which happens to be a SPDesktopWidget).
-SPViewWidget *sp_desktop_widget_new (SPNamedView *namedview);
+/**
+ * Create a new SPViewWidget (which happens to be a SPDesktopWidget).
+ */
+SPViewWidget *sp_desktop_widget_new(SPNamedView *namedview);
/**
* SPViewWidget is a GUI widget that contain a single View. It is also
diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp
index f05e024d1..e13976cc4 100644
--- a/src/ui/view/view.cpp
+++ b/src/ui/view/view.cpp
@@ -1,6 +1,4 @@
-/** \file
- * View implementation
- *
+/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ralf Stephan <ralf@ark.in-berlin.de>
@@ -16,7 +14,7 @@
# include "config.h"
#endif
-#include "libnr/nr-point.h"
+#include <2geom/point.h>
#include "document.h"
#include "view.h"
#include "message-stack.h"
@@ -78,9 +76,6 @@ View::View()
_message_changed_connection = _message_stack->connectChanged (sigc::bind (sigc::ptr_fun (&_onStatusMessage), this));
}
-/**
- * Deletes and nulls all View message stacks and disconnects it from signals.
- */
View::~View()
{
_close();
@@ -127,15 +122,6 @@ void View::requestRedraw()
_redraw_requested_signal.emit();
}
-/**
- * Disconnects the view from the document signals, connects the view
- * to a new one, and emits the _document_set_signal on the view.
- *
- * This is code comon to all subclasses and called from their
- * setDocument() methods after they are done.
- *
- * \param doc The new document to connect the view to.
- */
void View::setDocument(SPDocument *doc) {
g_return_if_fail(doc != NULL);
diff --git a/src/ui/view/view.h b/src/ui/view/view.h
index e6853555f..6ed9f476c 100644
--- a/src/ui/view/view.h
+++ b/src/ui/view/view.h
@@ -1,9 +1,6 @@
#ifndef INKSCAPE_UI_VIEW_VIEW_H
#define INKSCAPE_UI_VIEW_VIEW_H
-
-/** \file
- * Abstract base class for all SVG document views
- *
+/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ralf Stephan <ralf@ark.in-berlin.de>
@@ -14,14 +11,13 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include <gdk/gdktypes.h>
+#include <gdk/gdk.h>
#include <stddef.h>
#include <sigc++/connection.h>
#include "message.h"
#include "gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
-#include <libnr/nr-forward.h>
#include <2geom/forward.h>
/**
@@ -65,7 +61,7 @@ namespace Inkscape {
/**
* View is an abstract base class of all UI document views. This
* includes both the editing window and the SVG preview, but does not
- * include the non-UI RGBA buffer-based NRArena nor the XML editor or
+ * include the non-UI RGBA buffer-based Inkscape::Drawing nor the XML editor or
* similar views. The View base class has very little functionality of
* its own.
*/
@@ -76,6 +72,10 @@ class View : public GC::Managed<>,
public:
View();
+
+ /**
+ * Deletes and nulls all View message stacks and disconnects it from signals.
+ */
virtual ~View();
void close() { _close(); }
@@ -114,6 +114,16 @@ protected:
Inkscape::MessageContext *_tips_message_context;
virtual void _close();
+
+ /**
+ * Disconnects the view from the document signals, connects the view
+ * to a new one, and emits the _document_set_signal on the view.
+ *
+ * This is code comon to all subclasses and called from their
+ * setDocument() methods after they are done.
+ *
+ * @param doc The new document to connect the view to.
+ */
virtual void setDocument(SPDocument *doc);
sigc::signal<void,double,double> _position_set_signal;