summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2019-01-09 10:35:17 +0000
committerTavmjong Bah <tavmjong@free.fr>2019-01-09 10:35:17 +0000
commit7f5d2af69c85e840274dda25a20aa63031a26b2c (patch)
tree84ea7938d55ec7ea8db58eb11be9617377c405d3 /src
parentRemove helper/window.h helper/window.cpp (diff)
downloadinkscape-7f5d2af69c85e840274dda25a20aa63031a26b2c.tar.gz
inkscape-7f5d2af69c85e840274dda25a20aa63031a26b2c.zip
First baby step in adding InkscapeWindow (Gtk::ApplicationWindow)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/inkscape-window.cpp47
-rw-r--r--src/inkscape-window.h55
-rw-r--r--src/ui/interface.cpp13
4 files changed, 110 insertions, 10 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5e4ca8fc8..a2ed83c20 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -216,6 +216,11 @@ set(inkscape_SRC
vanishing-point.h
verbs.h
version.h
+
+ # TEMP Need to detangle inkscape-view from ui/interface.cpp
+ inkscape-window.h
+ inkscape-window.cpp
+
)
# -----------------------------------------------------------------------------
diff --git a/src/inkscape-window.cpp b/src/inkscape-window.cpp
new file mode 100644
index 000000000..3d60a3e65
--- /dev/null
+++ b/src/inkscape-window.cpp
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/**
+ * @file
+ * Inkscape - An SVG editor.
+ */
+/*
+ * Authors:
+ * Tavmjong Bah
+ *
+ * Copyright (C) 2018 Authors
+ *
+ * The contents of this file may be used under the GNU General Public License Version 2 or later.
+ * Read the file 'COPYING' for more information.
+ *
+ */
+
+
+#include "inkscape-window.h"
+#include "inkscape.h" // SP_ACTIVE_DESKTOP
+#include "shortcuts.h"
+
+InkscapeWindow::InkscapeWindow()
+{
+
+ // Callbacks
+ signal_key_press_event().connect(sigc::mem_fun(*this, &InkscapeWindow::key_press), false);
+
+ // Actions
+}
+
+bool
+InkscapeWindow::key_press(GdkEventKey* event)
+{
+ unsigned shortcut = sp_shortcut_get_for_event(event);
+ return sp_shortcut_invoke (shortcut, SP_ACTIVE_DESKTOP); // We should own desktop.
+}
+
+/*
+ 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 :
diff --git a/src/inkscape-window.h b/src/inkscape-window.h
new file mode 100644
index 000000000..ecf4fd553
--- /dev/null
+++ b/src/inkscape-window.h
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/**
+ * @file
+ * Inkscape - An SVG editor.
+ */
+/*
+ * Authors:
+ * Tavmjong Bah
+ *
+ * Copyright (C) 2018 Authors
+ *
+ * The contents of this file may be used under the GNU General Public License Version 2 or later.
+ * Read the file 'COPYING' for more information.
+ *
+ */
+
+#ifndef INKSCAPE_WINDOW_H
+#define INKSCAPE_WINDOW_H
+
+#include <gtkmm.h>
+
+class SPDocument;
+
+namespace Inkscape {
+namespace UI {
+namespace View {
+// class SVGViewWidget;
+}
+}
+}
+
+
+class InkscapeWindow : public Gtk::ApplicationWindow {
+
+public:
+ InkscapeWindow();
+
+private:
+
+ // Callbacks
+ bool key_press(GdkEventKey* event);
+};
+
+#endif // INKSCAPE_WINDOW_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 :
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index b02186152..c68ee0d2d 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -32,6 +32,7 @@
#include "file.h"
#include "gradient-drag.h"
#include "inkscape.h"
+#include "inkscape-window.h"
#include "message-context.h"
#include "message-stack.h"
#include "preferences.h"
@@ -140,23 +141,14 @@ static void sp_ui_menu_item_set_name(GtkWidget *data,
Glib::ustring const &name);
static void sp_recent_open(GtkRecentChooser *, gpointer);
-static bool sp_on_window_key_press(GdkEventKey* event)
-{
- unsigned shortcut = 0;
- shortcut = sp_shortcut_get_for_event(event);
- return sp_shortcut_invoke (shortcut, SP_ACTIVE_DESKTOP);
-}
-
void
sp_create_window(SPViewWidget *vw, bool editable)
{
g_return_if_fail(vw != nullptr);
g_return_if_fail(SP_IS_VIEW_WIDGET(vw));
- Gtk::Window *win = new Gtk::Window(Gtk::WINDOW_TOPLEVEL);
+ InkscapeWindow* win = new InkscapeWindow();
win->set_resizable(true);
- win->signal_key_press_event().connect(sigc::ptr_fun(&sp_on_window_key_press));
-
gtk_container_add(GTK_CONTAINER(win->gobj()), GTK_WIDGET(vw));
gtk_widget_show(GTK_WIDGET(vw));
@@ -200,6 +192,7 @@ sp_create_window(SPViewWidget *vw, bool editable)
}
}
+ // TODO Drop targets beglong on canvas, not window.
if ( completeDropTargets == nullptr || completeDropTargetsCount == 0 )
{
std::vector<Glib::ustring> types;