summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-11-10 03:53:52 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-12-01 16:17:15 +0000
commit4d1ba71e8d611170cf35345343f82de639db9aa4 (patch)
tree5e78b4cdec9bbd1862a492746ff2b9d1b3f6e772 /src
parentWorking with canvas to split (diff)
downloadinkscape-4d1ba71e8d611170cf35345343f82de639db9aa4.tar.gz
inkscape-4d1ba71e8d611170cf35345343f82de639db9aa4.zip
Handling cursor for dragin split
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp59
-rw-r--r--src/desktop.h5
-rw-r--r--src/display/sp-canvas.cpp12
3 files changed, 69 insertions, 7 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index b3065c2d4..7cb90ebb2 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -910,6 +910,62 @@ Geom::Rect SPDesktop::get_display_area() const
return viewbox * Geom::Scale(1. / scale, _doc2dt[3] / scale);
}
+guint
+SPDesktop::get_hruler_thickness()
+{
+ Gtk::Window *parent = getToplevel();
+ if (parent) {
+ SPDesktopWidget *dtw = static_cast<SPDesktopWidget *>(parent->get_data("desktopwidget"));
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(dtw->hruler, &allocation);
+ return allocation.height;
+ }
+ return 0;
+}
+
+guint
+SPDesktop::get_vruler_thickness()
+{
+ Gtk::Window *parent = getToplevel();
+ if (parent) {
+ SPDesktopWidget *dtw = static_cast<SPDesktopWidget *>(parent->get_data("desktopwidget"));
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(dtw->vruler, &allocation);
+ return allocation.width;
+ }
+ return 0;
+}
+
+guint
+SPDesktop::get_hscrool_thickness()
+{
+ Gtk::Window *parent = getToplevel();
+ if (parent) {
+ SPDesktopWidget *dtw = static_cast<SPDesktopWidget *>(parent->get_data("desktopwidget"));
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(dtw->hscrollbar, &allocation);
+ return allocation.height;
+ }
+ return 0;
+}
+
+guint
+SPDesktop::get_vscrool_thickness()
+{
+ Gtk::Window *parent = getToplevel();
+ if (parent) {
+ SPDesktopWidget *dtw = static_cast<SPDesktopWidget *>(parent->get_data("desktopwidget"));
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(dtw->vscrollbar_box, &allocation);
+ return allocation.width;
+ }
+ return 0;
+}
+
+ int get_hruler_thickness();
+ int get_vruler_thickness();
+ int get_vscrool_thickness();
+ int get_hscrool_thickness();
/**
* Zoom keeping the point 'c' fixed in the desktop window.
@@ -1555,7 +1611,8 @@ void SPDesktop::toggleSplitMode()
dtw->splitCanvas(_split_canvas);
GtkAllocation allocation;
gtk_widget_get_allocation(GTK_WIDGET(dtw->canvas), &allocation);
- getCanvas()->requestRedraw(getCanvas()->_x0, getCanvas()->_y0, getCanvas()->_x0 + allocation.width, getCanvas()->_y0 + allocation.height);
+ SPCanvas * canvas = getCanvas();
+ canvas->requestRedraw(canvas->_x0, canvas->_y0, canvas->_x0 + allocation.width, canvas->_y0 + allocation.height);
}
}
diff --git a/src/desktop.h b/src/desktop.h
index 82ce3e1d6..1d291bea5 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -438,7 +438,10 @@ public:
bool shutdown() override;
void mouseover() override {}
void mouseout() override {}
-
+ guint get_hruler_thickness();
+ guint get_vruler_thickness();
+ guint get_vscrool_thickness();
+ guint get_hscrool_thickness();
virtual bool onDeleteUI (GdkEventAny*);
virtual bool onWindowStateEvent (GdkEventWindowState* event);
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index ae7427f69..b9c09bec1 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -1994,11 +1994,13 @@ int SPCanvas::paint()
arena = SP_CANVAS_ARENA (desktop->drawing);
split_x = !vertical ? 1 : value;
split_y = vertical ? 1 : value;
- Geom::IntCoord coord1x = allocation.x + (int(allocation.width * (1-split_x))) - 1;
- Geom::IntCoord coord1y = allocation.y + (int(allocation.height * (1-split_y))) - 1;
- Geom::IntCoord coord2x = allocation.x + (int(allocation.width * split_x)) + 1;
- Geom::IntCoord coord2y = allocation.y + (int(allocation.height * split_y)) + 1;
- _spliter = Geom::OptIntRect(coord1x, coord1y, coord2x, coord2y);
+ guint hruler_gap = desktop->get_hruler_thickness();
+ guint vruler_gap = desktop->get_vruler_thickness();
+ Geom::IntCoord coord1x = allocation.x + (int(allocation.width * (1-split_x))) - 1 - vruler_gap;
+ Geom::IntCoord coord1y = allocation.y + (int(allocation.height * (1-split_y))) - 1 - hruler_gap;
+ Geom::IntCoord coord2x = allocation.x + (int(allocation.width * split_x)) + 1 - vruler_gap;
+ Geom::IntCoord coord2y = allocation.y + (int(allocation.height * split_y)) + 1 - hruler_gap;
+ _spliter = Geom::OptIntRect(coord1x, coord1y, coord2x, coord2y);
}
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)};