Cursor tweaks and code cleanup

- CursorManager code cleanup.
- Diagonal and flat curve cursors now use our bundled cursor icons.
  Icons are now less intrusive, allowing you to see what's going on
  under them as you manipulate the nodes.
- New small crosshair icon for curves.
This commit is contained in:
Morgan Hardwood
2018-08-28 23:45:48 +02:00
parent 54ff8788e6
commit 8bc0df571e
7 changed files with 333 additions and 141 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

View File

@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
viewBox="0 0 16 16"
version="1.1"
id="SVGRoot"
inkscape:export-filename="/tmp/template.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
inkscape:version="0.92.2 2405546, 2018-03-11"
sodipodi:docname="crosshair-small.svg">
<sodipodi:namedview
id="base"
pagecolor="#E0E1E2"
bordercolor="#666768"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="12.732386"
inkscape:cx="13.503561"
inkscape:cy="7.5035611"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1019"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:grid-bbox="true"
inkscape:pagecheckerboard="false"
inkscape:snap-bbox="true"
inkscape:bbox-nodes="true"
inkscape:snap-others="false"
inkscape:object-nodes="false"
inkscape:snap-grids="true"
inkscape:snap-bbox-midpoints="false"
inkscape:snap-global="true">
<inkscape:grid
type="xygrid"
id="grid1374"
originx="1"
originy="1"
empspacing="7"
dotted="false" />
</sodipodi:namedview>
<defs
id="defs815" />
<metadata
id="metadata818">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:creator>
<cc:Agent>
<dc:title>Maciej Dworak</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:rights>
<dc:description>RawTherapee icon.</dc:description>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1"
transform="translate(0,-8)">
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
d="M 55,16 H 65 M 60,11 V 21"
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4977" />
<path
id="path4979"
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 22.521364,16.478636 h 10 m -5,-5 v 10"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.7;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2a7fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M -12.015625,9.9863281 A 1.0001,1.0001 0 0 0 -13,11 v 2.173828 A 3,3 0 0 1 -12,13 a 3,3 0 0 1 1,0.175781 V 11 A 1.0001,1.0001 0 0 0 -12.015625,9.9863281 Z M -17,15 a 1.0001,1.0001 0 1 0 0,2 h 2.173828 A 3,3 0 0 1 -15,16 a 3,3 0 0 1 0.175781,-1 z m 7.826172,0 A 3,3 0 0 1 -9,16 3,3 0 0 1 -9.175781,17 H -7 a 1.0001,1.0001 0 1 0 0,-2 z M -13,18.824219 V 21 a 1.0001,1.0001 0 1 0 2,0 V 18.826172 A 3,3 0 0 1 -12,19 3,3 0 0 1 -13,18.824219 Z"
id="path4981"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
d="M 39,16 H 49 M 44,11 V 21"
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4983" />
<path
inkscape:connector-curvature="0"
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 8,19.985759 v 1.999999"
id="path836" />
<path
inkscape:connector-curvature="0"
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 8,9.9857565 10e-8,2.0000015"
id="path832" />
<path
inkscape:connector-curvature="0"
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 12.014242,16.000001 h 1.999999"
id="path830" />
<path
inkscape:connector-curvature="0"
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 2.0142425,16 H 3.9930053"
id="path4981-3" />
<path
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m -32.5,20 v 2.5"
id="path1509"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M -32.5,10.5 V 13"
id="path1505"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m -29,16.5 h 2.5"
id="path1503"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="opacity:0.7;fill:none;fill-rule:evenodd;stroke:#2a7fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M -38.5,16.5 H -36"
id="path840"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -36,50 +36,45 @@ void CursorManager::init (Glib::RefPtr<Gdk::Window> mainWindow)
#endif
cResizeWidth = Gdk::Cursor::create (display, Gdk::SB_H_DOUBLE_ARROW);
cResizeHeight = Gdk::Cursor::create (display, Gdk::SB_V_DOUBLE_ARROW);
cResizeTopLeft = Gdk::Cursor::create (display, Gdk::TOP_LEFT_CORNER);
cResizeTopRight = Gdk::Cursor::create (display, Gdk::TOP_RIGHT_CORNER);
cResizeBottomLeft = Gdk::Cursor::create (display, Gdk::BOTTOM_LEFT_CORNER);
cResizeBottomRight = Gdk::Cursor::create (display, Gdk::BOTTOM_RIGHT_CORNER);
cCropDraw = Gdk::Cursor::create (display, Gdk::CROSSHAIR);
cCropSelection = Gdk::Cursor::create (display, Gdk::STAR); // ?
cLeftTanMove = Gdk::Cursor::create (display, Gdk::SB_LEFT_ARROW);
cRightTanMove = Gdk::Cursor::create (display, Gdk::SB_RIGHT_ARROW);
cAdd = Gdk::Cursor::create (display, Gdk::PLUS);
cWait = Gdk::Cursor::create (display, Gdk::CLOCK);
Glib::RefPtr<Gdk::Pixbuf> crosshair = RTImage::createFromFile ("crosshair-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> handOpen = RTImage::createFromFile ("hand-open-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> handClosed = RTImage::createFromFile ("hand-closed-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> cropDraw = RTImage::createFromFile ("crop-point-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> resizeWidth = RTImage::createFromFile ("node-move-x-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> resizeHeight = RTImage::createFromFile ("node-move-y-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> resizeTopLeft = RTImage::createFromFile ("node-move-nw-se-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> resizeTopRight = RTImage::createFromFile ("node-move-sw-ne-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> resizeBottomLeft = RTImage::createFromFile ("node-move-sw-ne-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> resizeBottomRight = RTImage::createFromFile ("node-move-nw-se-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> add = RTImage::createFromFile("crosshair-small.png");
Glib::RefPtr<Gdk::Pixbuf> colPick = RTImage::createFromFile("color-picker-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> colPickAdd = RTImage::createFromFile("color-picker-add-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> cropDraw = RTImage::createFromFile("crop-point-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> crosshair = RTImage::createFromFile("crosshair-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> empty = RTImage::createFromFile("empty.png");
Glib::RefPtr<Gdk::Pixbuf> move2D = RTImage::createFromFile ("node-move-xy-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> handClosed = RTImage::createFromFile("hand-closed-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> handOpen = RTImage::createFromFile("hand-open-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveBL = RTImage::createFromFile("node-move-sw-ne-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveBR = RTImage::createFromFile("node-move-nw-se-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveL = RTImage::createFromFile("node-move-x-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveR = RTImage::createFromFile("node-move-x-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveTL = RTImage::createFromFile("node-move-nw-se-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveTR = RTImage::createFromFile("node-move-sw-ne-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveX = RTImage::createFromFile("node-move-x-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveXY = RTImage::createFromFile("node-move-xy-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> moveY = RTImage::createFromFile("node-move-y-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> rotate = RTImage::createFromFile("rotate-aroundnode-hicontrast.png");
Glib::RefPtr<Gdk::Pixbuf> wait = RTImage::createFromFile("gears.png"); // Currently unused, create *-hicontrast once used.
cCrosshair = crosshair ? Gdk::Cursor::create (cAdd->get_display(), crosshair, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cHandOpen = handOpen ? Gdk::Cursor::create (cAdd->get_display(), handOpen, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cHandClosed = handClosed ? Gdk::Cursor::create (cAdd->get_display(), handClosed, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cCropDraw = cropDraw ? Gdk::Cursor::create (cAdd->get_display(), cropDraw, 3, 3) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cResizeWidth = resizeWidth ? Gdk::Cursor::create (cAdd->get_display(), resizeWidth, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cResizeHeight = resizeHeight ? Gdk::Cursor::create (cAdd->get_display(), resizeHeight, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cResizeTopLeft = resizeTopLeft ? Gdk::Cursor::create (cAdd->get_display(), resizeTopLeft, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cResizeTopRight = resizeTopRight ? Gdk::Cursor::create (cAdd->get_display(), resizeTopRight, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cResizeBottomLeft = resizeBottomLeft ? Gdk::Cursor::create (cAdd->get_display(), resizeBottomLeft, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cResizeBottomRight = resizeBottomRight ? Gdk::Cursor::create (cAdd->get_display(), resizeBottomRight, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2);
cWB = colPick ? Gdk::Cursor::create (cAdd->get_display(), colPick, 4, 21) : Gdk::Cursor::create (cAdd->get_display(), Gdk::ARROW);
cAddPicker = colPickAdd ? Gdk::Cursor::create (cAdd->get_display(), colPickAdd, 4, 21) : Gdk::Cursor::create (cAdd->get_display(), Gdk::ARROW);
cHidden = empty ? Gdk::Cursor::create (cAdd->get_display(), empty, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::FLEUR);
cMove2D = move2D ? Gdk::Cursor::create (cAdd->get_display(), move2D, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::FLEUR);
cRotate = rotate ? Gdk::Cursor::create (cAdd->get_display(), rotate, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::CIRCLE);
cAdd = add ? Gdk::Cursor::create(display, add, 8, 8) : Gdk::Cursor::create(display, Gdk::PLUS);
cAddPicker = colPickAdd ? Gdk::Cursor::create(display, colPickAdd, 4, 21) : Gdk::Cursor::create(display, Gdk::PLUS);
cCropDraw = cropDraw ? Gdk::Cursor::create(display, cropDraw, 3, 3) : Gdk::Cursor::create(display, Gdk::DIAMOND_CROSS);
cCrosshair = crosshair ? Gdk::Cursor::create(display, crosshair, 12, 12) : Gdk::Cursor::create(display, Gdk::CROSSHAIR);
cEmpty = empty ? Gdk::Cursor::create(display, empty, 12, 12) : Gdk::Cursor::create(display, Gdk::BLANK_CURSOR);
cHandClosed = handClosed ? Gdk::Cursor::create(display, handClosed, 12, 12) : Gdk::Cursor::create(display, Gdk::HAND1);
cHandOpen = handOpen ? Gdk::Cursor::create(display, handOpen, 12, 12) : Gdk::Cursor::create(display, Gdk::HAND2);
cMoveBL = moveBL ? Gdk::Cursor::create(display, moveBL, 12, 12) : Gdk::Cursor::create(display, Gdk::BOTTOM_LEFT_CORNER);
cMoveBR = moveBR ? Gdk::Cursor::create(display, moveBR, 12, 12) : Gdk::Cursor::create(display, Gdk::BOTTOM_RIGHT_CORNER);
cMoveL = moveL ? Gdk::Cursor::create(display, moveL, 12, 12) : Gdk::Cursor::create(display, Gdk::SB_LEFT_ARROW);
cMoveR = moveR ? Gdk::Cursor::create(display, moveR, 12, 12) : Gdk::Cursor::create(display, Gdk::SB_RIGHT_ARROW);
cMoveTL = moveTL ? Gdk::Cursor::create(display, moveTL, 12, 12) : Gdk::Cursor::create(display, Gdk::TOP_LEFT_CORNER);
cMoveTR = moveTR ? Gdk::Cursor::create(display, moveTR, 12, 12) : Gdk::Cursor::create(display, Gdk::TOP_RIGHT_CORNER);
cMoveX = moveX ? Gdk::Cursor::create(display, moveX, 12, 12) : Gdk::Cursor::create(display, Gdk::SB_H_DOUBLE_ARROW);
cMoveXY = moveXY ? Gdk::Cursor::create(display, moveXY, 12, 12) : Gdk::Cursor::create(display, Gdk::FLEUR);
cMoveY = moveY ? Gdk::Cursor::create(display, moveY, 12, 12) : Gdk::Cursor::create(display, Gdk::SB_V_DOUBLE_ARROW);
cRotate = rotate ? Gdk::Cursor::create(display, rotate, 12, 12) : Gdk::Cursor::create(display, Gdk::EXCHANGE);
cWB = colPick ? Gdk::Cursor::create(display, colPick, 4, 21) : Gdk::Cursor::create(display, Gdk::TARGET);
cWait = wait ? Gdk::Cursor::create(display, wait, 12, 12) : Gdk::Cursor::create(display, Gdk::CLOCK);
window = mainWindow;
}
@@ -87,59 +82,87 @@ void CursorManager::init (Glib::RefPtr<Gdk::Window> mainWindow)
/* Set the cursor of the given window */
void CursorManager::setCursor (Glib::RefPtr<Gdk::Window> window, CursorShape shape)
{
if (shape == CSArrow)
// set_cursor without any arguments to select system default
switch (shape)
{
window->set_cursor ();
} else if (shape == CSCrosshair) {
window->set_cursor (cCrosshair);
} else if (shape == CSHandOpen) {
window->set_cursor (cHandOpen);
} else if (shape == CSHandClosed) {
window->set_cursor (cHandClosed);
} else if (shape == CSMove) {
window->set_cursor (cHandClosed);
} else if (shape == CSResizeWidth) {
window->set_cursor (cResizeWidth);
} else if (shape == CSResizeHeight) {
window->set_cursor (cResizeHeight);
} else if (shape == CSResizeDiagonal) {
window->set_cursor (cMove2D);
} else if (shape == CSResizeTopLeft) {
window->set_cursor (cResizeTopLeft);
} else if (shape == CSResizeTopRight) {
window->set_cursor (cResizeTopRight);
} else if (shape == CSResizeBottomLeft) {
window->set_cursor (cResizeBottomLeft);
} else if (shape == CSResizeBottomRight) {
window->set_cursor (cResizeBottomRight);
} else if (shape == CSMove2D) {
window->set_cursor (cMove2D);
} else if (shape == CSMove1DH) {
window->set_cursor (cResizeWidth);
} else if (shape == CSMove1DV) {
window->set_cursor (cResizeHeight);
} else if (shape == CSMoveRotate) {
window->set_cursor (cRotate);
} else if (shape == CSSpotWB) {
window->set_cursor (cWB);
} else if (shape == CSAddColPicker) {
case CursorShape::CSAddColPicker:
window->set_cursor(cAddPicker);
} else if (shape == CSCropSelect) {
break;
case CursorShape::CSArrow:
window->set_cursor(); // set_cursor without any arguments to select system default
break;
case CursorShape::CSCropSelect:
window->set_cursor(cCropDraw);
} else if (shape == CSMoveLeft) {
window->set_cursor (cLeftTanMove);
} else if (shape == CSMoveRight) {
window->set_cursor (cRightTanMove);
} else if (shape == CSStraighten) {
break;
case CursorShape::CSCrosshair:
window->set_cursor(cCrosshair);
break;
case CursorShape::CSEmpty:
window->set_cursor(cEmpty);
break;
case CursorShape::CSHandClosed:
window->set_cursor(cHandClosed);
break;
case CursorShape::CSHandOpen:
window->set_cursor(cHandOpen);
break;
case CursorShape::CSMove:
window->set_cursor(cHandClosed);
break;
case CursorShape::CSMove1DH:
window->set_cursor(cMoveX);
break;
case CursorShape::CSMove1DV:
window->set_cursor(cMoveY);
break;
case CursorShape::CSMove2D:
window->set_cursor(cMoveXY);
break;
case CursorShape::CSMoveLeft:
window->set_cursor(cMoveL);
break;
case CursorShape::CSMoveRight:
window->set_cursor(cMoveR);
break;
case CursorShape::CSMoveRotate:
window->set_cursor(cRotate);
} else if (shape == CSWait) {
window->set_cursor (cWait);
} else if (shape == CSPlus) {
break;
case CursorShape::CSPlus:
window->set_cursor(cAdd);
} else if (shape == CSEmpty) {
window->set_cursor (cHidden);
break;
case CursorShape::CSResizeBottomLeft:
window->set_cursor(cMoveBL);
break;
case CursorShape::CSResizeBottomRight:
window->set_cursor(cMoveBR);
break;
case CursorShape::CSResizeDiagonal:
window->set_cursor(cMoveXY);
break;
case CursorShape::CSResizeHeight:
window->set_cursor(cMoveY);
break;
case CursorShape::CSResizeTopLeft:
window->set_cursor(cMoveTL);
break;
case CursorShape::CSResizeTopRight:
window->set_cursor(cMoveTR);
break;
case CursorShape::CSResizeWidth:
window->set_cursor(cMoveX);
break;
case CursorShape::CSSpotWB:
window->set_cursor(cWB);
break;
case CursorShape::CSStraighten:
window->set_cursor(cRotate);
break;
case CursorShape::CSUndefined:
break;
case CursorShape::CSWait:
window->set_cursor(cWait);
break;
default:
window->set_cursor(cCrosshair);
}
}

View File

@@ -22,60 +22,57 @@
#include <gtkmm.h>
enum CursorShape {
CSUndefined,
CSAddColPicker,
CSArrow,
CSCropSelect,
CSCrosshair,
CSHandOpen,
CSEmpty,
CSHandClosed,
CSHandOpen,
CSMove,
CSMoveLeft,
CSMoveRight,
CSResizeWidth,
CSResizeHeight,
CSResizeDiagonal,
CSResizeTopLeft,
CSResizeTopRight,
CSResizeBottomLeft,
CSResizeBottomRight,
CSMove2D,
CSMove1DH,
CSMove1DV,
CSMove2D,
CSMoveLeft,
CSMoveRight,
CSMoveRotate,
CSSpotWB,
CSAddColPicker,
CSCropSelect,
CSStraighten,
CSPlus,
CSWait,
CSEmpty
CSResizeBottomLeft,
CSResizeBottomRight,
CSResizeDiagonal,
CSResizeHeight,
CSResizeTopLeft,
CSResizeTopRight,
CSResizeWidth,
CSSpotWB,
CSStraighten,
CSUndefined,
CSWait
};
class CursorManager
{
private:
Glib::RefPtr<Gdk::Cursor> cResizeWidth;
Glib::RefPtr<Gdk::Cursor> cResizeHeight;
Glib::RefPtr<Gdk::Cursor> cResizeTopLeft;
Glib::RefPtr<Gdk::Cursor> cResizeTopRight;
Glib::RefPtr<Gdk::Cursor> cResizeBottomLeft;
Glib::RefPtr<Gdk::Cursor> cResizeBottomRight;
Glib::RefPtr<Gdk::Cursor> cCropDraw;
Glib::RefPtr<Gdk::Cursor> cCropMove;
Glib::RefPtr<Gdk::Cursor> cLeftTanMove;
Glib::RefPtr<Gdk::Cursor> cRightTanMove;
Glib::RefPtr<Gdk::Cursor> cNormal;
Glib::RefPtr<Gdk::Cursor> cCropSelection;
Glib::RefPtr<Gdk::Cursor> cAdd;
Glib::RefPtr<Gdk::Cursor> cWait;
Glib::RefPtr<Gdk::Cursor> cCrosshair;
Glib::RefPtr<Gdk::Cursor> cHandOpen;
Glib::RefPtr<Gdk::Cursor> cHandClosed;
Glib::RefPtr<Gdk::Cursor> cWB;
Glib::RefPtr<Gdk::Cursor> cAddPicker;
Glib::RefPtr<Gdk::Cursor> cHidden;
Glib::RefPtr<Gdk::Cursor> cMove2D;
Glib::RefPtr<Gdk::Cursor> cCropDraw;
Glib::RefPtr<Gdk::Cursor> cCrosshair;
Glib::RefPtr<Gdk::Cursor> cHandClosed;
Glib::RefPtr<Gdk::Cursor> cHandOpen;
Glib::RefPtr<Gdk::Cursor> cEmpty;
Glib::RefPtr<Gdk::Cursor> cMoveBL;
Glib::RefPtr<Gdk::Cursor> cMoveBR;
Glib::RefPtr<Gdk::Cursor> cMoveL;
Glib::RefPtr<Gdk::Cursor> cMoveR;
Glib::RefPtr<Gdk::Cursor> cMoveTL;
Glib::RefPtr<Gdk::Cursor> cMoveTR;
Glib::RefPtr<Gdk::Cursor> cMoveX;
Glib::RefPtr<Gdk::Cursor> cMoveY;
Glib::RefPtr<Gdk::Cursor> cMoveXY;
Glib::RefPtr<Gdk::Cursor> cRotate;
Glib::RefPtr<Gdk::Cursor> cWB;
Glib::RefPtr<Gdk::Cursor> cWait;
Glib::RefPtr<Gdk::Display> display;
Glib::RefPtr<Gdk::Window> window;

View File

@@ -559,7 +559,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event)
getCursorPosition(Gdk::EventType(event->type), event->motion.is_hint != 0, int(event->button.x), int(event->button.y), Gdk::ModifierType(event->button.state));
findClosestPoint();
new_type = CSMove;
new_type = CSMove2D; // Shown when dragging a node.
if (distanceX > minDistanceX) {
if (mod_type & GDK_CONTROL_MASK) {
@@ -735,7 +735,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event)
}
if (distanceX <= minDistanceX) {
new_type = CSMove;
new_type = CSMove2D; // Shown on node release.
lit_point = closest_point;
} else {
new_type = CSPlus;
@@ -799,7 +799,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event)
lit_point = -1;
} else if (distanceX <= minDistanceX) {
// the cursor is close to an existing point
new_type = CSMove;
new_type = CSPlus; // Shown when hovering over node snapping distance (not necessarily over node).
lit_point = closest_point;
} else {
// the cursor is inside the graph but away from existing points

View File

@@ -630,7 +630,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
switch (area) {
case (FCT_Area_Insertion):
new_type = CSMove;
new_type = CSMove2D; // Shown when adding a new node in a blank area, both click and drag.
/* insert a new control point */
if (num > 0) {
@@ -681,7 +681,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
break;
case (FCT_Area_Point):
new_type = CSMove;
new_type = CSMove2D; // Shown when node clicked and dragged.
editedHandle = FCT_EditedHandle_CPoint;
ugpX = curve.x.at(lit_point);
ugpY = curve.y.at(lit_point);
@@ -689,7 +689,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
case (FCT_Area_H):
case (FCT_Area_V):
new_type = CSMove;
new_type = CSMove2D; // Shown when vertical line clicked, not dragged.
editedHandle = FCT_EditedHandle_CPointUD;
ugpX = curve.x.at(lit_point);
ugpY = curve.y.at(lit_point);
@@ -876,7 +876,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
break;
case (FCT_Area_Point):
new_type = CSMove;
new_type = CSMove2D; // Shown when node released.
break;
case (FCT_Area_H):
@@ -884,7 +884,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
break;
case (FCT_Area_V):
new_type = CSMove;
new_type = CSMove2D; // Shown when line released.
break;
case (FCT_Area_LeftTan):
@@ -1008,7 +1008,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
//new_type = CSMove;
//break;
case (FCT_Area_V):
new_type = CSMove;
new_type = CSPlus; // Shown when hovering over vertical line.
break;
case (FCT_Area_H):