diff --git a/toonz/sources/include/tools/cursors.h b/toonz/sources/include/tools/cursors.h index 558341b..5c017cb 100644 --- a/toonz/sources/include/tools/cursors.h +++ b/toonz/sources/include/tools/cursors.h @@ -18,6 +18,8 @@ enum { CURSOR_QUESTION, #endif PenCursor, + PenLargeCursor, + PenCrosshairCursor, BenderCursor, CutterCursor, DistortCursor, @@ -31,8 +33,6 @@ enum { MagnetCursor, PanCursor, PickerCursor, - PickerCursorLine, - PickerCursorArea, PumpCursor, RotCursor, RotTopLeft, @@ -56,13 +56,11 @@ enum { SplineEditorCursorAdd, TrackerCursor, ForbiddenCursor, - EditFxCursor, NormalEraserCursor, RectEraserCursor, PickerCursorOrganize, - PickerRGB, PickerRGBWhite, FillCursorL, @@ -70,13 +68,19 @@ enum { MoveEWCursor, MoveNSCursor, DisableCursor, - MoveZCursor, ScaleGlobalCursor, - ScaleHVCursor, - FxGadgetCursor, RulerModifyCursor, RulerNewCursor, + // Base cursors with fixed set of decorations. See below + FxGadgetCursorBase, + EditFxCursorBase, + MoveZCursorBase, + PickerCursorLineBase, + PickerCursorAreaBase, + PickerRGBBase, + ScaleHVCursorBase, + // extra options for decorating the cursor Ex_Negate = 0x100, // used for black bg Ex_FreeHand = 0x200, @@ -84,7 +88,25 @@ enum { Ex_Rectangle = 0x800, Ex_Line = 0x1000, Ex_Area = 0x2000, - Ex_Fill_NoAutopaint = 0x4000 + Ex_Fill_NoAutopaint = 0x4000, + Ex_FX = 0x8000, + Ex_Z = 0x10000, + Ex_StyleLine = 0x20000, + Ex_StyleArea = 0x40000, + Ex_RGB = 0x80000, + Ex_HV = 0x100000, + + // This section is for cursors that have fixed text that needs to + // be handled separately when flipping for left-handed cursors. + // The base gets flipped, but a left-handed version of text will be + // used instead of flipped. + FxGadgetCursor = FxGadgetCursorBase | Ex_FX, + EditFxCursor = EditFxCursorBase | Ex_FX, + MoveZCursor = MoveZCursorBase | Ex_Z, + PickerCursorLine = PickerCursorLineBase | Ex_StyleLine, + PickerCursorArea = PickerCursorAreaBase | Ex_StyleArea, + PickerRGB = PickerRGBBase | Ex_RGB, + ScaleHVCursor = ScaleHVCursorBase | Ex_HV }; } // namespace diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index e6c0eb5..a40476b 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -390,6 +390,15 @@ public: return m_dropdownShortcutsCycleOptions; } + void setCursorBrushType(std::string brushType); + QString getCursorBrushType() const { return m_cursorBrushType; } + + void setCursorBrushStyle(std::string brushStyle); + QString getCursorBrushStyle() const { return m_cursorBrushStyle; } + + void enableCursorOutline(bool on); + bool isCursorOutlineEnabled() const { return m_cursorOutlineEnabled; } + // Xsheet tab void setXsheetStep(int step); //!< Sets the step used for the next/prev //! step commands. @@ -694,6 +703,11 @@ private: // release version check bool m_latestVersionCheckEnabled = true; + // Cursor settings + QString m_cursorBrushType; + QString m_cursorBrushStyle; + bool m_cursorOutlineEnabled = false; + private: Preferences(); ~Preferences(); diff --git a/toonz/sources/tnztools/Resources/brush_crosshair.png b/toonz/sources/tnztools/Resources/brush_crosshair.png new file mode 100644 index 0000000..7f50a27 Binary files /dev/null and b/toonz/sources/tnztools/Resources/brush_crosshair.png differ diff --git a/toonz/sources/tnztools/Resources/brush_large.png b/toonz/sources/tnztools/Resources/brush_large.png new file mode 100644 index 0000000..b2c3511 Binary files /dev/null and b/toonz/sources/tnztools/Resources/brush_large.png differ diff --git a/toonz/sources/tnztools/Resources/edit_FX_notext.png b/toonz/sources/tnztools/Resources/edit_FX_notext.png new file mode 100644 index 0000000..45879b7 Binary files /dev/null and b/toonz/sources/tnztools/Resources/edit_FX_notext.png differ diff --git a/toonz/sources/tnztools/Resources/ex_FX.png b/toonz/sources/tnztools/Resources/ex_FX.png new file mode 100644 index 0000000..f1d869f Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_FX.png differ diff --git a/toonz/sources/tnztools/Resources/ex_FX_left.png b/toonz/sources/tnztools/Resources/ex_FX_left.png new file mode 100644 index 0000000..8a7921f Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_FX_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_area_left.png b/toonz/sources/tnztools/Resources/ex_area_left.png new file mode 100644 index 0000000..2cff8e8 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_area_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_fill_no_autopaint_left.png b/toonz/sources/tnztools/Resources/ex_fill_no_autopaint_left.png new file mode 100644 index 0000000..c70843e Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_fill_no_autopaint_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_freehand_left.png b/toonz/sources/tnztools/Resources/ex_freehand_left.png new file mode 100644 index 0000000..36c093d Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_freehand_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_hv.png b/toonz/sources/tnztools/Resources/ex_hv.png new file mode 100644 index 0000000..b10eb5b Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_hv.png differ diff --git a/toonz/sources/tnztools/Resources/ex_hv_left.png b/toonz/sources/tnztools/Resources/ex_hv_left.png new file mode 100644 index 0000000..3391ed2 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_hv_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_line_left.png b/toonz/sources/tnztools/Resources/ex_line_left.png new file mode 100644 index 0000000..c5ea060 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_line_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_polyline_left.png b/toonz/sources/tnztools/Resources/ex_polyline_left.png new file mode 100644 index 0000000..6a24cab Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_polyline_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_rectangle_left.png b/toonz/sources/tnztools/Resources/ex_rectangle_left.png new file mode 100644 index 0000000..eb13c86 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_rectangle_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_rgb.png b/toonz/sources/tnztools/Resources/ex_rgb.png new file mode 100644 index 0000000..0ae693e Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_rgb.png differ diff --git a/toonz/sources/tnztools/Resources/ex_rgb_left.png b/toonz/sources/tnztools/Resources/ex_rgb_left.png new file mode 100644 index 0000000..2584426 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_rgb_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_style_area.png b/toonz/sources/tnztools/Resources/ex_style_area.png new file mode 100644 index 0000000..a285a73 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_style_area.png differ diff --git a/toonz/sources/tnztools/Resources/ex_style_area_left.png b/toonz/sources/tnztools/Resources/ex_style_area_left.png new file mode 100644 index 0000000..2d84792 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_style_area_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_style_line.png b/toonz/sources/tnztools/Resources/ex_style_line.png new file mode 100644 index 0000000..fd4a682 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_style_line.png differ diff --git a/toonz/sources/tnztools/Resources/ex_style_line_left.png b/toonz/sources/tnztools/Resources/ex_style_line_left.png new file mode 100644 index 0000000..3bd624c Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_style_line_left.png differ diff --git a/toonz/sources/tnztools/Resources/ex_z.png b/toonz/sources/tnztools/Resources/ex_z.png new file mode 100644 index 0000000..fdea088 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_z.png differ diff --git a/toonz/sources/tnztools/Resources/ex_z_left.png b/toonz/sources/tnztools/Resources/ex_z_left.png new file mode 100644 index 0000000..d240244 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_z_left.png differ diff --git a/toonz/sources/tnztools/Resources/move_z_notext.png b/toonz/sources/tnztools/Resources/move_z_notext.png new file mode 100644 index 0000000..605e935 Binary files /dev/null and b/toonz/sources/tnztools/Resources/move_z_notext.png differ diff --git a/toonz/sources/tnztools/Resources/scale_hv_notext.png b/toonz/sources/tnztools/Resources/scale_hv_notext.png new file mode 100644 index 0000000..6696019 Binary files /dev/null and b/toonz/sources/tnztools/Resources/scale_hv_notext.png differ diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp index 8a98c4b..2671078 100644 --- a/toonz/sources/tnztools/brushtool.cpp +++ b/toonz/sources/tnztools/brushtool.cpp @@ -2255,6 +2255,9 @@ void BrushTool::draw() { if (getApplication()->getCurrentObject()->isSpline()) return; + // If toggled off, don't draw brush outline + if (!Preferences::instance()->isCursorOutlineEnabled()) return; + // Draw the brush outline - change color when the Ink / Paint check is // activated if ((ToonzCheck::instance()->getChecks() & ToonzCheck::eInk) || diff --git a/toonz/sources/tnztools/cursormanager.cpp b/toonz/sources/tnztools/cursormanager.cpp index b4b6130..f0c0640 100644 --- a/toonz/sources/tnztools/cursormanager.cpp +++ b/toonz/sources/tnztools/cursormanager.cpp @@ -4,6 +4,8 @@ #include "tools/tool.h" #include "tools/cursors.h" +#include "../toonz/preferences.h" + #include #include #include @@ -17,64 +19,74 @@ const struct { int cursorType; const char *pixmapFilename; int x, y; + bool flippable; } cursorInfo[] = { - {ToolCursor::PenCursor, "brush", 16, 16}, - {ToolCursor::BenderCursor, "bender", 10, 7}, - {ToolCursor::CutterCursor, "cutter", 6, 24}, // 12,20}, - {ToolCursor::EraserCursor, "eraser", 7, 21}, // 15,16}, - {ToolCursor::DistortCursor, "selection_distort", 11, 6}, - {ToolCursor::FillCursor, "fill", 3, 26}, - {ToolCursor::MoveCursor, "move", 15, 15}, - {ToolCursor::MoveEWCursor, "move_ew", 15, 15}, - {ToolCursor::MoveNSCursor, "move_ns", 15, 15}, - {ToolCursor::DisableCursor, "disable", 15, 15}, - {ToolCursor::MoveZCursor, "move_z", 15, 15}, - {ToolCursor::FxGadgetCursor, "edit_FX", 7, 7}, - {ToolCursor::FlipHCursor, "flip_h", 15, 15}, - {ToolCursor::FlipVCursor, "flip_v", 15, 15}, - {ToolCursor::IronCursor, "iron", 15, 15}, - {ToolCursor::LevelSelectCursor, "level_select", 7, 4}, - {ToolCursor::MagnetCursor, "magnet", 18, 18}, - {ToolCursor::PanCursor, "pan", 18, 19}, - - {ToolCursor::PickerCursorLine, "picker_style_line", 7, 22}, - {ToolCursor::PickerCursorArea, "picker_style_area", 7, 22}, - {ToolCursor::PickerCursor, "picker_style", 7, 22}, - - {ToolCursor::PumpCursor, "pump", 16, 23}, - {ToolCursor::RotCursor, "rot", 15, 15}, - {ToolCursor::RotTopLeft, "rot_top_left", 15, 15}, - {ToolCursor::RotBottomRight, "rot_bottom_right", 15, 15}, - {ToolCursor::RotBottomLeft, "rot_bottom_left", 15, 15}, - {ToolCursor::RotateCursor, "rotate", 15, 19}, - {ToolCursor::ScaleCursor, "scale", 15, 15}, - {ToolCursor::ScaleInvCursor, "scale_inv", 15, 15}, - {ToolCursor::ScaleHCursor, "scale_h", 15, 15}, - {ToolCursor::ScaleVCursor, "scale_v", 15, 15}, - {ToolCursor::EditFxCursor, "edit_FX", 11, 6}, - {ToolCursor::ScaleGlobalCursor, "scale_global", 15, 15}, - {ToolCursor::ScaleHVCursor, "scale_hv", 15, 15}, - {ToolCursor::StrokeSelectCursor, "stroke_select", 11, 6}, - {ToolCursor::TapeCursor, "tape", 4, 23}, - {ToolCursor::TrackerCursor, "tracker", 12, 15}, - {ToolCursor::TypeInCursor, "type_in", 16, 19}, - {ToolCursor::TypeOutCursor, "type_out", 16, 19}, - {ToolCursor::ZoomCursor, "zoom", 14, 14}, - {ToolCursor::PinchCursor, "pinch_curve", 10, 18}, - {ToolCursor::PinchAngleCursor, "pinch_angle", 6, 16}, - {ToolCursor::PinchWaveCursor, "pinch_wave", 6, 16}, - {ToolCursor::SplineEditorCursor, "stroke_select", 11, 6}, - {ToolCursor::SplineEditorCursorAdd, "selection_add", 11, 6}, - {ToolCursor::SplineEditorCursorSelect, "selection_convert", 11, 6}, - {ToolCursor::NormalEraserCursor, "normaleraser", 3, 26}, - {ToolCursor::RectEraserCursor, "recteraser", 3, 26}, - {ToolCursor::PickerCursorOrganize, "picker_style_organize", 7, 22}, - {ToolCursor::PickerRGB, "picker_rgb", 7, 22}, - {ToolCursor::PickerRGBWhite, "picker_rgb_white", 7, 22}, - {ToolCursor::FillCursorL, "karasu", 7, 25}, - {ToolCursor::RulerModifyCursor, "ruler_modify", 7, 7}, - {ToolCursor::RulerNewCursor, "ruler_new", 7, 7}, - {0, 0, 0, 0}}; + {ToolCursor::PenCursor, "brush", 16, 15, false}, + {ToolCursor::PenLargeCursor, "brush_large", 16, 15, false}, + {ToolCursor::PenCrosshairCursor, "brush_crosshair", 16, 15, false}, + {ToolCursor::BenderCursor, "bender", 9, 7, true}, + {ToolCursor::CutterCursor, "cutter", 6, 24, true}, // 12,20, ???}, + {ToolCursor::EraserCursor, "eraser", 7, 21, true}, // 15,16, ???}, + {ToolCursor::DistortCursor, "selection_distort", 11, 6, true}, + {ToolCursor::FillCursor, "fill", 3, 26, true}, + {ToolCursor::MoveCursor, "move", 15, 15, false}, + {ToolCursor::MoveEWCursor, "move_ew", 15, 15, false}, + {ToolCursor::MoveNSCursor, "move_ns", 15, 15, false}, + {ToolCursor::DisableCursor, "disable", 15, 15, false}, + {ToolCursor::MoveZCursor, "", 0, 0, false}, + {ToolCursor::MoveZCursorBase, "move_z_notext", 15, 15, false}, + {ToolCursor::FxGadgetCursor, "", 0, 0, false}, + {ToolCursor::FxGadgetCursorBase, "edit_FX_notext", 11, 6, true}, + {ToolCursor::FlipHCursor, "flip_h", 15, 15, false}, + {ToolCursor::FlipVCursor, "flip_v", 15, 15, false}, + {ToolCursor::IronCursor, "iron", 15, 15, true}, + {ToolCursor::LevelSelectCursor, "level_select", 7, 3, true}, + {ToolCursor::MagnetCursor, "magnet", 18, 18, true}, + {ToolCursor::PanCursor, "pan", 17, 17, true}, + + {ToolCursor::PickerCursorLine, "", 0, 0, false}, + {ToolCursor::PickerCursorLineBase, "picker_style", 7, 22, true}, + {ToolCursor::PickerCursorArea, "", 0, 0, false}, + {ToolCursor::PickerCursorAreaBase, "picker_style", 7, 22, true}, + {ToolCursor::PickerCursor, "picker_style", 7, 22, true}, + + {ToolCursor::PumpCursor, "pump", 16, 23, false}, + {ToolCursor::RotCursor, "rot", 15, 15, false}, + {ToolCursor::RotTopLeft, "rot_top_left", 15, 15, false}, + {ToolCursor::RotBottomRight, "rot_bottom_right", 15, 15, false}, + {ToolCursor::RotBottomLeft, "rot_bottom_left", 15, 15, false}, + {ToolCursor::RotateCursor, "rotate", 15, 19, true}, + {ToolCursor::ScaleCursor, "scale", 15, 15, false}, + {ToolCursor::ScaleInvCursor, "scale_inv", 15, 15, false}, + {ToolCursor::ScaleHCursor, "scale_h", 15, 15, false}, + {ToolCursor::ScaleVCursor, "scale_v", 15, 15, false}, + {ToolCursor::EditFxCursor, "", 0, 0, false}, + {ToolCursor::EditFxCursorBase, "edit_FX_notext", 11, 6, true}, + {ToolCursor::ScaleGlobalCursor, "scale_global", 15, 15, false}, + {ToolCursor::ScaleHVCursor, "", 0, 0, false}, + {ToolCursor::ScaleHVCursorBase, "scale_hv_notext", 15, 15, false}, + {ToolCursor::StrokeSelectCursor, "stroke_select", 11, 6, true}, + {ToolCursor::TapeCursor, "tape", 4, 23, true}, + {ToolCursor::TrackerCursor, "tracker", 16, 15, false}, + {ToolCursor::TypeInCursor, "type_in", 16, 19, false}, + {ToolCursor::TypeOutCursor, "type_out", 16, 19, false}, + {ToolCursor::ZoomCursor, "zoom", 14, 14, true}, + {ToolCursor::PinchCursor, "pinch_curve", 6, 16, true}, + {ToolCursor::PinchAngleCursor, "pinch_angle", 6, 16, true}, + {ToolCursor::PinchWaveCursor, "pinch_wave", 6, 16, true}, + {ToolCursor::SplineEditorCursor, "stroke_select", 11, 6, true}, + {ToolCursor::SplineEditorCursorAdd, "selection_add", 11, 6, true}, + {ToolCursor::SplineEditorCursorSelect, "selection_convert", 11, 6, true}, + {ToolCursor::NormalEraserCursor, "normaleraser", 7, 19, true}, + {ToolCursor::RectEraserCursor, "recteraser", 3, 26, true}, + {ToolCursor::PickerCursorOrganize, "picker_style_organize", 7, 22, true}, + {ToolCursor::PickerRGB, "", 0, 0, false}, + {ToolCursor::PickerRGBBase, "picker_style", 7, 22, true}, + {ToolCursor::PickerRGBWhite, "picker_rgb_white", 7, 22, true}, + {ToolCursor::FillCursorL, "karasu", 7, 25, true}, + {ToolCursor::RulerModifyCursor, "ruler_modify", 7, 7, true}, + {ToolCursor::RulerNewCursor, "ruler_new", 7, 7, true}, + {0, 0, 0, 0, false}}; struct CursorData { QPixmap pixmap; @@ -90,6 +102,12 @@ const struct { {ToolCursor::Ex_Line, "ex_line"}, {ToolCursor::Ex_Area, "ex_area"}, {ToolCursor::Ex_Fill_NoAutopaint, "ex_fill_no_autopaint"}, + {ToolCursor::Ex_FX, "ex_FX"}, + {ToolCursor::Ex_Z, "ex_z"}, + {ToolCursor::Ex_StyleLine, "ex_style_line"}, + {ToolCursor::Ex_StyleArea, "ex_style_area"}, + {ToolCursor::Ex_RGB, "ex_rgb"}, + {ToolCursor::Ex_HV, "ex_hv"}, {0, 0}}; }; @@ -100,6 +118,7 @@ const struct { class CursorManager { // singleton std::map m_cursors; + std::map m_cursorsLeft; CursorManager() {} @@ -109,15 +128,17 @@ public: return &_instance; } - void doDecoration(QPixmap &pixmap, int decorationFlag) { + void doDecoration(QPixmap &pixmap, int decorationFlag, bool useLeft) { if (decorationFlag == 0) return; if (decorationFlag > ToolCursor::Ex_Negate) { QPainter p(&pixmap); p.setCompositionMode(QPainter::CompositionMode_SourceOver); for (int i = 0; decorateInfo[i].pixmapFilename; i++) if (decorationFlag & decorateInfo[i].decorateType) { - QString path = - QString(":Resources/") + decorateInfo[i].pixmapFilename + ".png"; + QString leftStr = ""; + if (useLeft) leftStr = "_left"; + QString path = QString(":Resources/") + + decorateInfo[i].pixmapFilename + leftStr + ".png"; p.drawPixmap(0, 0, QPixmap(path)); } } @@ -132,12 +153,49 @@ public: const CursorData &getCursorData(int cursorType) { // se e' gia' in tabella lo restituisco std::map::iterator it; - it = m_cursors.find(cursorType); - if (it != m_cursors.end()) return it->second; + + if (Preferences::instance()->getCursorBrushStyle() == "Simple") + cursorType = ToolCursor::PenCursor; + + if (cursorType == ToolCursor::PenCursor) { + QString brushType = Preferences::instance()->getCursorBrushType(); + if (brushType == "Large") + cursorType = ToolCursor::PenLargeCursor; + else if (brushType == "Crosshair") + cursorType = ToolCursor::PenCrosshairCursor; + } + + bool useLeft = + (Preferences::instance()->getCursorBrushStyle() == "Left-Handed"); + if (useLeft) { + it = m_cursorsLeft.find(cursorType); + if (it != m_cursorsLeft.end()) return it->second; + } else { + it = m_cursors.find(cursorType); + if (it != m_cursors.end()) return it->second; + } int decorationsFlag = cursorType & ~(0xFF); int baseCursorType = cursorType & 0xFF; + if (baseCursorType == ToolCursor::CURSOR_ARROW) { + CursorData data; + QCursor leftArrow(Qt::ArrowCursor); + data.pixmap = leftArrow.pixmap(); + data.x = leftArrow.hotSpot().x(); + data.y = leftArrow.hotSpot().y(); + + if (useLeft) { + QImage target = (&data.pixmap)->toImage(); + (&data.pixmap)->convertFromImage(target.mirrored(true, false)); + data.x = data.pixmap.width() - data.x - 1; + it = m_cursorsLeft.insert(std::make_pair(cursorType, data)).first; + } else + it = m_cursors.insert(std::make_pair(cursorType, data)).first; + + return it->second; + } + // provo a cercarlo in cursorInfo[] int i; for (i = 0; cursorInfo[i].pixmapFilename; i++) @@ -146,10 +204,23 @@ public: QString(":Resources/") + cursorInfo[i].pixmapFilename + ".png"; CursorData data; data.pixmap = QPixmap(path); - if (decorationsFlag != 0) doDecoration(data.pixmap, decorationsFlag); - data.x = cursorInfo[i].x; - data.y = cursorInfo[i].y; - it = m_cursors.insert(std::make_pair(cursorType, data)).first; + if (data.pixmap.isNull()) + data = getCursorData(ToolCursor::CURSOR_ARROW); + else { + data.x = cursorInfo[i].x; + data.y = cursorInfo[i].y; + if (useLeft && cursorInfo[i].flippable) { + QImage target = (&data.pixmap)->toImage(); + (&data.pixmap)->convertFromImage(target.mirrored(true, false)); + data.x = data.pixmap.width() - cursorInfo[i].x - 1; + } + if (decorationsFlag != 0) + doDecoration(data.pixmap, decorationsFlag, useLeft); + } + if (useLeft) + it = m_cursorsLeft.insert(std::make_pair(cursorType, data)).first; + else + it = m_cursors.insert(std::make_pair(cursorType, data)).first; return it->second; } // niente da fare. uso un default @@ -157,7 +228,10 @@ public: static const QPixmap standardCursorPixmap("cursors/hook.png"); data.pixmap = standardCursorPixmap; data.x = data.y = 0; - it = m_cursors.insert(std::make_pair(cursorType, data)).first; + if (useLeft) + it = m_cursorsLeft.insert(std::make_pair(cursorType, data)).first; + else + it = m_cursors.insert(std::make_pair(cursorType, data)).first; return it->second; } @@ -165,9 +239,11 @@ public: // assert(cursorType!=0); QCursor cursor; - if (cursorType == ToolCursor::CURSOR_ARROW) - cursor = Qt::ArrowCursor; - else if (cursorType == ToolCursor::ForbiddenCursor) + /* +if (cursorType == ToolCursor::CURSOR_ARROW) + cursor = Qt::ArrowCursor; +else */ + if (cursorType == ToolCursor::ForbiddenCursor) cursor = Qt::ForbiddenCursor; else { const CursorData &data = getCursorData(cursorType); diff --git a/toonz/sources/tnztools/edittool.cpp b/toonz/sources/tnztools/edittool.cpp index 5fade5b..3bb49b0 100644 --- a/toonz/sources/tnztools/edittool.cpp +++ b/toonz/sources/tnztools/edittool.cpp @@ -1207,7 +1207,7 @@ void EditTool::drawMainHandle() { TAffine parentAff = xsh->getParentPlacement(objId, frame); TAffine aff = xsh->getPlacement(objId, frame); TPointD center = Stage::inch * xsh->getCenter(objId, frame); - int devPixRatio = getDevPixRatio(); + int devPixRatio = getDevPixRatio(); // the gadget appears on the center of the level. orientation and dimension // are independent of the movement of the level glPushMatrix(); diff --git a/toonz/sources/tnztools/fingertool.cpp b/toonz/sources/tnztools/fingertool.cpp index 0838d00..7b2c6cf 100644 --- a/toonz/sources/tnztools/fingertool.cpp +++ b/toonz/sources/tnztools/fingertool.cpp @@ -21,6 +21,7 @@ #include "toonz/stage2.h" #include "toonz/ttileset.h" #include "toonz/rasterstrokegenerator.h" +#include "toonz/preferences.h" #include "tgl.h" #include "tenv.h" @@ -339,6 +340,9 @@ void FingerTool::draw() { return; } + // If toggled off, don't draw brush outline + if (!Preferences::instance()->isCursorOutlineEnabled()) return; + TToonzImageP ti = (TToonzImageP)getImage(false); if (!ti) return; TRasterP ras = ti->getRaster(); diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp index f5832bc..e970d75 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.cpp +++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp @@ -25,6 +25,7 @@ #include "toonz/tstageobject.h" #include "toonz/palettecontroller.h" #include "toonz/mypaintbrushstyle.h" +#include "toonz/preferences.h" // TnzCore includes #include "tgl.h" @@ -487,6 +488,9 @@ void FullColorBrushTool::mouseMove(const TPointD &pos, const TMouseEvent &e) { void FullColorBrushTool::draw() { if (TRasterImageP ri = TRasterImageP(getImage(false))) { + // If toggled off, don't draw brush outline + if (!Preferences::instance()->isCursorOutlineEnabled()) return; + TRasterP ras = ri->getRaster(); double alpha = 1.0; diff --git a/toonz/sources/tnztools/fullcolorerasertool.cpp b/toonz/sources/tnztools/fullcolorerasertool.cpp index 3917031..4ff46de 100644 --- a/toonz/sources/tnztools/fullcolorerasertool.cpp +++ b/toonz/sources/tnztools/fullcolorerasertool.cpp @@ -21,6 +21,7 @@ #include "toonz/stage2.h" #include "toonz/levelproperties.h" #include "toonz/strokegenerator.h" +#include "toonz/preferences.h" // TnzBase includes #include "tenv.h" @@ -898,6 +899,9 @@ void FullColorEraserTool::draw() { TRasterImageP img = (TRasterImageP)getImage(false); if (!img) return; if (m_eraseType.getValue() == NORMALERASE) { + // If toggled off, don't draw brush outline + if (!Preferences::instance()->isCursorOutlineEnabled()) return; + glColor3d(1.0, 0.0, 0.0); tglDrawCircle(m_brushPos, (m_size.getValue() + 1) * 0.5); } else if (m_eraseType.getValue() == RECTERASE) { diff --git a/toonz/sources/tnztools/hooktool.cpp b/toonz/sources/tnztools/hooktool.cpp index dbcec8a..f7a8d87 100644 --- a/toonz/sources/tnztools/hooktool.cpp +++ b/toonz/sources/tnztools/hooktool.cpp @@ -337,9 +337,11 @@ void HookTool::draw() { TPixel32 balloonColor(200, 220, 205, 200); TPoint balloonOffset(20, 20); std::string hookName = std::to_string(i + 1); - drawBalloon(p0, hookName, balloonColor, balloonOffset, getPixelSize(), false, &balloons); + drawBalloon(p0, hookName, balloonColor, balloonOffset, getPixelSize(), + false, &balloons); if (!linked) - drawBalloon(p1, hookName, balloonColor, balloonOffset, getPixelSize(), false, &balloons); + drawBalloon(p1, hookName, balloonColor, balloonOffset, getPixelSize(), + false, &balloons); } // draw snapped hook balloon if (m_snappedReason != "") { diff --git a/toonz/sources/tnztools/paintbrushtool.cpp b/toonz/sources/tnztools/paintbrushtool.cpp index ca50063..c755b30 100644 --- a/toonz/sources/tnztools/paintbrushtool.cpp +++ b/toonz/sources/tnztools/paintbrushtool.cpp @@ -20,6 +20,7 @@ #include "toonz/stage2.h" #include "toonz/ttileset.h" #include "toonz/rasterstrokegenerator.h" +#include "toonz/preferences.h" #include "tgl.h" #include "tenv.h" @@ -356,6 +357,9 @@ void PaintBrushTool::draw() { /*-- MouseLeave時にBrushTipが描かれるのを防止する --*/ if (m_pointSize == -1) return; + // If toggled off, don't draw brush outline + if (!Preferences::instance()->isCursorOutlineEnabled()) return; + TToonzImageP ti = (TToonzImageP)getImage(false); if (!ti) return; TRasterP ras = ti->getRaster(); diff --git a/toonz/sources/tnztools/rastererasertool.cpp b/toonz/sources/tnztools/rastererasertool.cpp index 28148cd..3e9bcb6 100644 --- a/toonz/sources/tnztools/rastererasertool.cpp +++ b/toonz/sources/tnztools/rastererasertool.cpp @@ -28,6 +28,7 @@ #include "toonz/tpalettehandle.h" #include "toonz/tobjecthandle.h" #include "toonz/tcolumnhandle.h" +#include "toonz/preferences.h" // TnzBase includes #include "tenv.h" @@ -662,6 +663,9 @@ void EraserTool::draw() { drawRect(m_selectingRect, color, 0xFFFF, true); } if (m_eraseType.getValue() == NORMALERASE) { + // If toggled off, don't draw brush outline + if (!Preferences::instance()->isCursorOutlineEnabled()) return; + TToonzImageP image(img); TRasterP ras = image->getRaster(); int lx = ras->getLx(); @@ -1654,11 +1658,10 @@ void EraserTool::storeUndoAndRefresh() { TUndoManager::manager()->add(new RasterBluredEraserUndo( m_tileSet, m_points, TTool::getApplication()->getCurrentLevelStyleIndex(), - m_currentStyle.getValue(), - TTool::getApplication() - ->getCurrentLevel() - ->getLevel() - ->getSimpleLevel(), + m_currentStyle.getValue(), TTool::getApplication() + ->getCurrentLevel() + ->getLevel() + ->getSimpleLevel(), m_workingFrameId.isEmptyFrame() ? getCurrentFid() : m_workingFrameId, m_toolSize.getValue(), m_hardness.getValue() * 0.01, m_colorType.getValue())); diff --git a/toonz/sources/tnztools/tnztools.qrc b/toonz/sources/tnztools/tnztools.qrc index 1895073..98c61bc 100644 --- a/toonz/sources/tnztools/tnztools.qrc +++ b/toonz/sources/tnztools/tnztools.qrc @@ -51,10 +51,34 @@ Resources/ruler_modify.png Resources/ruler_new.png Resources/ex_freehand.png + Resources/ex_freehand_left.png Resources/ex_polyline.png + Resources/ex_polyline_left.png Resources/ex_rectangle.png + Resources/ex_rectangle_left.png Resources/ex_line.png + Resources/ex_line_left.png Resources/ex_area.png + Resources/ex_area_left.png Resources/ex_fill_no_autopaint.png + Resources/ex_fill_no_autopaint_left.png + Resources/edit_FX_notext.png + Resources/move_z_notext.png + Resources/scale_hv_notext.png + Resources/ex_FX.png + Resources/ex_FX_left.png + Resources/ex_hv.png + Resources/ex_hv_left.png + Resources/ex_rgb.png + Resources/ex_rgb_left.png + Resources/ex_style_area.png + Resources/ex_style_area_left.png + Resources/ex_style_line.png + Resources/ex_style_line_left.png + Resources/ex_z.png + Resources/ex_z_left.png + Resources/brush_large.png + Resources/brush_crosshair.png + Resources/tracker.png \ No newline at end of file diff --git a/toonz/sources/tnztools/vectorerasertool.cpp b/toonz/sources/tnztools/vectorerasertool.cpp index 244c090..ee04710 100644 --- a/toonz/sources/tnztools/vectorerasertool.cpp +++ b/toonz/sources/tnztools/vectorerasertool.cpp @@ -17,6 +17,7 @@ #include "toonz/strokegenerator.h" #include "toonz/txshsimplelevel.h" #include "toonz/stage2.h" +#include "toonz/preferences.h" // TnzBase includes #include "tenv.h" @@ -429,6 +430,9 @@ void EraserTool::draw() { drawRect(m_selectingRect, color, 0xFFFF, true); } if (m_eraseType.getValue() == NORMAL_ERASE) { + // If toggled off, don't draw brush outline + if (!Preferences::instance()->isCursorOutlineEnabled()) return; + tglColor(TPixel32(255, 0, 255)); tglDrawCircle(m_brushPos, m_pointSize); } diff --git a/toonz/sources/tnztools/vectortapetool.cpp b/toonz/sources/tnztools/vectortapetool.cpp index c5dd5a9..3fba465 100644 --- a/toonz/sources/tnztools/vectortapetool.cpp +++ b/toonz/sources/tnztools/vectortapetool.cpp @@ -717,9 +717,8 @@ public: std::vector *fillInformation = new std::vector; ImageUtils::getFillingInformationOverlappingArea( - vi, *fillInformation, - vi->getStroke(m_strokeIndex1)->getBBox() + - vi->getStroke(m_strokeIndex2)->getBBox()); + vi, *fillInformation, vi->getStroke(m_strokeIndex1)->getBBox() + + vi->getStroke(m_strokeIndex2)->getBBox()); doTape(vi, fillInformation, m_joinStrokes.getValue()); diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index e8824bf..46a04d3 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -2052,6 +2052,8 @@ void MainWindow::defineActions() { RightClickMenuCommandType); createToggle(MI_ZeroThick, tr("Zero Thick Lines"), "Shift+/", false, RightClickMenuCommandType); + createToggle(MI_CursorOutline, tr("Toggle Cursor Size Outline"), "", false, + RightClickMenuCommandType); createRightClickMenuAction(MI_ToggleCurrentTimeIndicator, tr("Toggle Current Time Indicator"), ""); diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h index f2502ea..92e4dc4 100644 --- a/toonz/sources/toonz/menubarcommandids.h +++ b/toonz/sources/toonz/menubarcommandids.h @@ -233,6 +233,7 @@ #define MI_FullScreenWindow "MI_FullScreenWindow" #define MI_OnionSkin "MI_OnionSkin" #define MI_ZeroThick "MI_ZeroThick" +#define MI_CursorOutline "MI_CursorOutline" //#define MI_LoadResourceFile "MI_LoadResourceFile" #define MI_DuplicateFile "MI_DuplicateFile" diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 4da7636..cc03d35 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1182,6 +1182,20 @@ void PreferencesPopup::onEnableAutoStretch(int index) { m_pref->enableAutoStretch(index == Qt::Checked); } +//----------------------------------------------------------------------------- + +void PreferencesPopup::onCursorBrushTypeChanged(const QString &text) { + m_pref->setCursorBrushType(text.toStdString()); +} + +void PreferencesPopup::onCursorBrushStyleChanged(const QString &text) { + m_pref->setCursorBrushStyle(text.toStdString()); +} + +void PreferencesPopup::onCursorOutlineChanged(int index) { + m_pref->enableCursorOutline(index == Qt::Checked); +} + //********************************************************************************** // PrefencesPopup's constructor //********************************************************************************** @@ -1381,6 +1395,24 @@ PreferencesPopup::PreferencesPopup() CheckBox *useSaveboxToLimitFillingOpCB = new CheckBox(tr("Use the TLV Savebox to Limit Filling Operations"), this); + QStringList brushTypes; + // options should not be translatable as they are used as key strings + brushTypes << "Small" + << "Large" + << "Crosshair"; + QComboBox *cursorBrushTypeOptions = new QComboBox(this); + cursorBrushTypeOptions->addItems(brushTypes); + + QStringList brushStyles; + brushStyles << "Default" + << "Left-Handed" + << "Simple"; + QComboBox *cursorBrushStyleOptions = new QComboBox(this); + cursorBrushStyleOptions->addItems(brushStyles); + + CheckBox *cursorOutlineCB = + new CheckBox(tr("Show Cursor Size Outlines"), this); + //--- Xsheet ------------------------------ categoryList->addItem(tr("Xsheet")); @@ -1772,6 +1804,12 @@ PreferencesPopup::PreferencesPopup() multiLayerStylePickerCB->setChecked(m_pref->isMultiLayerStylePickerEnabled()); useSaveboxToLimitFillingOpCB->setChecked(m_pref->getFillOnlySavebox()); + cursorBrushTypeOptions->setCurrentIndex( + cursorBrushTypeOptions->findText(m_pref->getCursorBrushType())); + cursorBrushStyleOptions->setCurrentIndex( + cursorBrushStyleOptions->findText(m_pref->getCursorBrushStyle())); + cursorOutlineCB->setChecked(m_pref->isCursorOutlineEnabled()); + //--- Xsheet ------------------------------ xsheetAutopanDuringPlaybackCB->setChecked(m_pref->isXsheetAutopanEnabled()); m_cellsDragBehaviour->addItem(tr("Cells Only")); @@ -2274,26 +2312,59 @@ PreferencesPopup::PreferencesPopup() //--- Tools --------------------------- QWidget *toolsBox = new QWidget(this); - QGridLayout *toolsFrameLay = new QGridLayout(); + QVBoxLayout *toolsFrameLay = new QVBoxLayout(); toolsFrameLay->setMargin(15); - toolsFrameLay->setHorizontalSpacing(15); - toolsFrameLay->setVerticalSpacing(10); + toolsFrameLay->setSpacing(10); { - toolsFrameLay->addWidget(new QLabel(tr("Dropdown Shortcuts:")), 0, 0, + QGridLayout *ToolsTopLay = new QGridLayout(); + ToolsTopLay->setVerticalSpacing(10); + ToolsTopLay->setHorizontalSpacing(15); + ToolsTopLay->setMargin(0); + { + ToolsTopLay->addWidget(new QLabel(tr("Dropdown Shortcuts:")), 0, 0, Qt::AlignRight | Qt::AlignVCenter); - toolsFrameLay->addWidget(m_dropdownShortcutsCycleOptionsCB, 0, 1); - toolsFrameLay->addWidget(useSaveboxToLimitFillingOpCB, 1, 0, 1, 3, + ToolsTopLay->addWidget(m_dropdownShortcutsCycleOptionsCB, 0, 1); + ToolsTopLay->addWidget(useSaveboxToLimitFillingOpCB, 1, 0, 1, 3, Qt::AlignLeft | Qt::AlignVCenter); - toolsFrameLay->addWidget(multiLayerStylePickerCB, 2, 0, 1, 3, + ToolsTopLay->addWidget(multiLayerStylePickerCB, 2, 0, 1, 3, Qt::AlignLeft | Qt::AlignVCenter); + + toolsFrameLay->addLayout(ToolsTopLay, 0); + + QGroupBox *cursorStyleGroupBox = + new QGroupBox(tr("Cursor Options"), this); + QVBoxLayout *cursorStylesLay = new QVBoxLayout(); + cursorStylesLay->setMargin(10); + cursorStylesLay->setSpacing(10); + { + QGridLayout *cursorStylesGridLay = new QGridLayout(); + cursorStylesGridLay->setMargin(0); + cursorStylesGridLay->setHorizontalSpacing(15); + cursorStylesGridLay->setVerticalSpacing(10); + { + cursorStylesGridLay->addWidget(new QLabel(tr("Basic Cursor Type:")), + 0, 0, + Qt::AlignRight | Qt::AlignVCenter); + cursorStylesGridLay->addWidget(cursorBrushTypeOptions, 0, 1); + + cursorStylesGridLay->addWidget(new QLabel(tr("Cursor Style:")), 1, + 0, + Qt::AlignRight | Qt::AlignVCenter); + cursorStylesGridLay->addWidget(cursorBrushStyleOptions, 1, 1); + + cursorStylesGridLay->addWidget(cursorOutlineCB, 2, 0, 1, 3, + Qt::AlignLeft | Qt::AlignVCenter); + } + cursorStylesLay->addLayout(cursorStylesGridLay, 0); + + cursorStyleGroupBox->setLayout(cursorStylesLay); + } + ToolsTopLay->addWidget(cursorStyleGroupBox, 3, 0, 1, 3); + } + toolsFrameLay->addLayout(ToolsTopLay, 0); + + toolsFrameLay->addStretch(1); } - toolsFrameLay->setColumnStretch(0, 0); - toolsFrameLay->setColumnStretch(1, 0); - toolsFrameLay->setColumnStretch(2, 1); - toolsFrameLay->setRowStretch(0, 0); - toolsFrameLay->setRowStretch(1, 0); - toolsFrameLay->setRowStretch(2, 0); - toolsFrameLay->setRowStretch(3, 1); toolsBox->setLayout(toolsFrameLay); stackedWidget->addWidget(toolsBox); @@ -2746,6 +2817,14 @@ PreferencesPopup::PreferencesPopup() SLOT(onMultiLayerStylePickerChanged(int))); ret = ret && connect(useSaveboxToLimitFillingOpCB, SIGNAL(stateChanged(int)), this, SLOT(onGetFillOnlySavebox(int))); + ret = ret && connect(cursorBrushTypeOptions, + SIGNAL(currentIndexChanged(const QString &)), this, + SLOT(onCursorBrushTypeChanged(const QString &))); + ret = ret && connect(cursorBrushStyleOptions, + SIGNAL(currentIndexChanged(const QString &)), this, + SLOT(onCursorBrushStyleChanged(const QString &))); + ret = ret && connect(cursorOutlineCB, SIGNAL(stateChanged(int)), this, + SLOT(onCursorOutlineChanged(int))); //--- Xsheet ---------------------- ret = ret && connect(xsheetAutopanDuringPlaybackCB, SIGNAL(stateChanged(int)), diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index db41128..91ed6ae 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -208,6 +208,9 @@ private slots: void onLutPathChanged(); void onCheckLatestVersionChanged(bool); void onEnableAutoStretch(int index); + void onCursorBrushTypeChanged(const QString &text); + void onCursorBrushStyleChanged(const QString &text); + void onCursorOutlineChanged(int); }; //********************************************************************************** diff --git a/toonz/sources/toonz/sceneviewercontextmenu.cpp b/toonz/sources/toonz/sceneviewercontextmenu.cpp index 94ef1c3..fe03e9b 100644 --- a/toonz/sources/toonz/sceneviewercontextmenu.cpp +++ b/toonz/sources/toonz/sceneviewercontextmenu.cpp @@ -206,6 +206,9 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent) if (!parent->isPreviewEnabled()) ZeroThickToggleGui::addZeroThickCommand(this); + // Brush size outline + CursorOutlineToggleGui::addCursorOutlineCommand(this); + // preview if (parent->isPreviewEnabled()) { addSeparator(); @@ -475,4 +478,42 @@ void ZeroThickToggleGui::ZeroThickToggleHandler::activate() { void ZeroThickToggleGui::ZeroThickToggleHandler::deactivate() { ZeroThickToggle::enableZeroThick(false); -} \ No newline at end of file +} + +class CursorOutlineToggle : public MenuItemHandler { +public: + CursorOutlineToggle() : MenuItemHandler(MI_CursorOutline) {} + void execute() { + QAction *action = CommandManager::instance()->getAction(MI_CursorOutline); + if (!action) return; + bool checked = action->isChecked(); + enableCursorOutline(checked); + } + + static void enableCursorOutline(bool enable = true) { + Preferences::instance()->enableCursorOutline(enable); + } +} CursorOutlineToggle; + +void CursorOutlineToggleGui::addCursorOutlineCommand(QMenu *menu) { + static CursorOutlineToggleHandler switcher; + if (Preferences::instance()->isCursorOutlineEnabled()) { + QAction *hideCursorOutline = + menu->addAction(QString(QObject::tr("Hide cursor size outline"))); + menu->connect(hideCursorOutline, SIGNAL(triggered()), &switcher, + SLOT(deactivate())); + } else { + QAction *showCursorOutline = + menu->addAction(QString(QObject::tr("Show cursor size outline"))); + menu->connect(showCursorOutline, SIGNAL(triggered()), &switcher, + SLOT(activate())); + } +} + +void CursorOutlineToggleGui::CursorOutlineToggleHandler::activate() { + CursorOutlineToggle::enableCursorOutline(true); +} + +void CursorOutlineToggleGui::CursorOutlineToggleHandler::deactivate() { + CursorOutlineToggle::enableCursorOutline(false); +} diff --git a/toonz/sources/toonz/sceneviewercontextmenu.h b/toonz/sources/toonz/sceneviewercontextmenu.h index b4e05b0..41d9985 100644 --- a/toonz/sources/toonz/sceneviewercontextmenu.h +++ b/toonz/sources/toonz/sceneviewercontextmenu.h @@ -53,4 +53,17 @@ public slots: } // Namespace ZeroThickToggleGui +namespace CursorOutlineToggleGui { +void addCursorOutlineCommand(QMenu *menu); + +class CursorOutlineToggleHandler : public QObject { + Q_OBJECT + +public slots: + void activate(); + void deactivate(); +}; + +} // Namespace CursorOutlineToggleGui + #endif diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 5d54100..989f437 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -339,7 +339,10 @@ Preferences::Preferences() , m_pathAliasPriority(ProjectFolderOnly) , m_functionEditorToggle(ShowGraphEditorInPopup) , m_currentTimelineEnabled(true) - , m_enableAutoStretch(true) { + , m_enableAutoStretch(true) + , m_cursorBrushType("Small") + , m_cursorBrushStyle("Default") + , m_cursorOutlineEnabled(true) { TCamera camera; m_defLevelType = PLI_XSHLEVEL; m_defLevelWidth = camera.getSize().lx; @@ -691,6 +694,18 @@ Preferences::Preferences() m_latestVersionCheckEnabled); getValue(*m_settings, "EnableAutoStretch", m_enableAutoStretch); + + QString brushType; + brushType = m_settings->value("cursorBrushType").toString(); + if (brushType != "") m_cursorBrushType = brushType; + setCursorBrushType(m_cursorBrushType.toStdString()); + + QString brushStyle; + brushStyle = m_settings->value("cursorBrushStyle").toString(); + if (brushStyle != "") m_cursorBrushStyle = brushStyle; + setCursorBrushStyle(m_cursorBrushStyle.toStdString()); + + getValue(*m_settings, "cursorOutlineEnabled", m_cursorOutlineEnabled); } //----------------------------------------------------------------- @@ -1688,3 +1703,18 @@ void Preferences::enableAutoStretch(bool on) { m_enableAutoStretch = on; m_settings->setValue("EnableAutoStretch", on ? "1" : "0"); } + +void Preferences::setCursorBrushType(std::string brushType) { + m_cursorBrushType = QString::fromStdString(brushType); + m_settings->setValue("cursorBrushType", m_cursorBrushType); +} + +void Preferences::setCursorBrushStyle(std::string brushStyle) { + m_cursorBrushStyle = QString::fromStdString(brushStyle); + m_settings->setValue("cursorBrushStyle", m_cursorBrushStyle); +} + +void Preferences::enableCursorOutline(bool on) { + m_cursorOutlineEnabled = on; + m_settings->setValue("cursorOutlineEnabled", on ? "1" : "0"); +}