summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/display/sp-canvas.cpp33
-rw-r--r--src/display/sp-canvas.h2
-rw-r--r--src/widgets/desktop-widget.cpp3
3 files changed, 35 insertions, 3 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 4b11fe707..bff1578df 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -980,6 +980,8 @@ static void sp_canvas_init(SPCanvas *canvas)
canvas->_forced_redraw_count = 0;
canvas->_forced_redraw_limit = -1;
+ canvas->_oversplit = false;
+ canvas->_spliter = Geom::OptIntRect();
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
canvas->_enable_cms_display_adj = false;
@@ -1528,7 +1530,26 @@ int SPCanvas::handle_motion(GtkWidget *widget, GdkEventMotion *event)
if (canvas->_root == nullptr) // canvas being deleted
return FALSE;
-
+
+ Geom::IntPoint cursor_pos = Geom::IntPoint(event->x,event->y);
+ if (canvas->_spliter && (*canvas->_spliter).contains(cursor_pos) && !canvas->_is_dragging) {
+ canvas->_oversplit = true;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ bool vertical = prefs->getBool("/window/splitcanvas/vertical", true);
+ GdkDisplay *display = gdk_display_get_default();
+ GdkCursor *cursor = nullptr;
+ if(vertical) {
+ cursor = gdk_cursor_new_from_name (display, "ew-resize");
+ } else {
+ cursor = gdk_cursor_new_from_name (display, "ns-resize");
+ }
+ if (cursor) {
+ gdk_window_set_cursor (gtk_widget_get_window(widget), cursor);
+ g_object_unref (cursor);
+ }
+ } else {
+ canvas->_oversplit = false;
+ }
canvas->_state = event->state;
canvas->pickCurrentItem(reinterpret_cast<GdkEvent *>(event));
status = canvas->emitEvent(reinterpret_cast<GdkEvent *>(event));
@@ -1949,10 +1970,10 @@ int SPCanvas::paint()
bool split = false;
bool inverse = prefs->getBool("/window/splitcanvas/inverse", false);
bool vertical = prefs->getBool("/window/splitcanvas/vertical", true);
+ double value = prefs->getDoubleLimited("/window/splitcanvas/value", 0.5, 0, 1);
double split_x = 1;
double split_y = 1;
if (desktop && desktop->splitMode()) {
- double value = split_x = prefs->getDoubleLimited("/window/splitcanvas/value", 0.5, 0, 1);
split = desktop->splitMode();
arena = SP_CANVAS_ARENA (desktop->drawing);
split_x = !vertical ? 1 : value;
@@ -1960,6 +1981,7 @@ int SPCanvas::paint()
}
GtkAllocation allocation;
gtk_widget_get_allocation(GTK_WIDGET(this), &allocation);
+
cairo_rectangle_int_t crect = { _x0, _y0, int(allocation.width * split_x), int(allocation.height * split_y)};
cairo_rectangle_int_t crect_outline = { _x0 + int(allocation.width * (1-split_x)), _y0 + int(allocation.height * (1-split_y)), int(allocation.width * split_x), int(allocation.height * split_y)};
cairo_region_t *to_draw = nullptr;
@@ -2007,6 +2029,13 @@ int SPCanvas::paint()
arena->drawing.setExact(exact);
arena->drawing.setRenderMode(rm);
}
+
+ if (desktop && desktop->splitMode()) {
+ split_x = int(allocation.width * split_x);
+ split_y = int(allocation.height * split_y);
+ _spliter = Geom::OptIntRect(_x0 + split_x - 1, _y0 + split_y - 1,_x0 + split_x + 1, _y0 + split_y - 1);
+ }
+
// we've had a full unaborted redraw, reset the full redraw counter
if (_forced_redraw_limit != -1) {
_forced_redraw_count = 0;
diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h
index 9459d633d..05443cb85 100644
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
@@ -174,6 +174,8 @@ public:
SPCanvasItem *_root;
bool _is_dragging;
+ bool _oversplit;
+ Geom::OptIntRect _spliter;
double _dx0;
double _dy0;
int _x0; ///< World coordinate of the leftmost pixels of window
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index f4507cbac..d5192db4b 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -27,6 +27,7 @@
#include <gtkmm/cssprovider.h>
#include <gtkmm/messagedialog.h>
+#include <gtkmm/paned.h>
#include <gdkmm/types.h>
#if GTK_CHECK_VERSION(3,20,0)
@@ -54,7 +55,6 @@
#include "extension/db.h"
#include "helper/action.h"
-#include "helper/icon-loader.h"
#include "object/sp-image.h"
#include "object/sp-namedview.h"
@@ -62,6 +62,7 @@
#include "ui/dialog/dialog-manager.h"
#include "ui/dialog/swatches.h"
+#include "ui/icon-loader.h"
#include "ui/icon-names.h"
#include "ui/interface.h"
#include "ui/tools/box3d-tool.h"