diff --git a/toonz/sources/include/tools/cursors.h b/toonz/sources/include/tools/cursors.h index 16eec82..fce7f2a 100644 --- a/toonz/sources/include/tools/cursors.h +++ b/toonz/sources/include/tools/cursors.h @@ -60,42 +60,12 @@ enum { NormalEraserCursor, RectEraserCursor, - RectEraserCursorWhite, - FillCursorWhite, - TapeCursorWhite, - PickerCursorWhite, - PickerCursorWhiteLine, - PickerCursorWhiteArea, PickerCursorOrganize, - PickerCursorWhiteOrganize, PickerRGB, PickerRGBWhite, - FillCursorF, - FillCursorFWhite, - FillCursorP, - FillCursorPWhite, - FillCursorR, - FillCursorRWhite, - - FillCursorA, - FillCursorAWhite, - FillCursorAF, - FillCursorAFWhite, - FillCursorAP, - FillCursorAPWhite, - FillCursorAR, - FillCursorARWhite, - FillCursorL, - FillCursorLWhite, - FillCursorLF, - FillCursorLFWhite, - FillCursorLP, - FillCursorLPWhite, - FillCursorLR, - FillCursorLRWhite, MoveEWCursor, MoveNSCursor, @@ -105,7 +75,15 @@ enum { ScaleHVCursor, FxGadgetCursor, RulerModifyCursor, - RulerNewCursor + RulerNewCursor, + + // extra options for decorating the cursor + Ex_Negate = 0x100, // used for black bg + Ex_FreeHand = 0x200, + Ex_PolyLine = 0x400, + Ex_Rectangle = 0x800, + Ex_Line = 0x1000, + Ex_Area = 0x2000 }; } // namespace diff --git a/toonz/sources/tnztools/Resources/ex_area.png b/toonz/sources/tnztools/Resources/ex_area.png new file mode 100644 index 0000000..0bb477b Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_area.png differ diff --git a/toonz/sources/tnztools/Resources/ex_freehand.png b/toonz/sources/tnztools/Resources/ex_freehand.png new file mode 100644 index 0000000..03f4106 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_freehand.png differ diff --git a/toonz/sources/tnztools/Resources/ex_line.png b/toonz/sources/tnztools/Resources/ex_line.png new file mode 100644 index 0000000..2b5f4a4 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_line.png differ diff --git a/toonz/sources/tnztools/Resources/ex_polyline.png b/toonz/sources/tnztools/Resources/ex_polyline.png new file mode 100644 index 0000000..5a85884 Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_polyline.png differ diff --git a/toonz/sources/tnztools/Resources/ex_rectangle.png b/toonz/sources/tnztools/Resources/ex_rectangle.png new file mode 100644 index 0000000..d114a5a Binary files /dev/null and b/toonz/sources/tnztools/Resources/ex_rectangle.png differ diff --git a/toonz/sources/tnztools/Resources/fill.png b/toonz/sources/tnztools/Resources/fill.png index ab2f9d0..4087552 100644 Binary files a/toonz/sources/tnztools/Resources/fill.png and b/toonz/sources/tnztools/Resources/fill.png differ diff --git a/toonz/sources/tnztools/Resources/fill_a.png b/toonz/sources/tnztools/Resources/fill_a.png deleted file mode 100644 index 2fb3705..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_a_f.png b/toonz/sources/tnztools/Resources/fill_a_f.png deleted file mode 100644 index f75eba2..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a_f.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_a_f_white.png b/toonz/sources/tnztools/Resources/fill_a_f_white.png deleted file mode 100644 index a97688a..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a_f_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_a_p.png b/toonz/sources/tnztools/Resources/fill_a_p.png deleted file mode 100644 index 30c0c8a..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a_p.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_a_p_white.png b/toonz/sources/tnztools/Resources/fill_a_p_white.png deleted file mode 100644 index 227bff0..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a_p_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_a_r.png b/toonz/sources/tnztools/Resources/fill_a_r.png deleted file mode 100644 index 739a168..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a_r.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_a_r_white.png b/toonz/sources/tnztools/Resources/fill_a_r_white.png deleted file mode 100644 index 97347a5..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a_r_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_a_white.png b/toonz/sources/tnztools/Resources/fill_a_white.png deleted file mode 100644 index e9edc2b..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_a_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_f.png b/toonz/sources/tnztools/Resources/fill_f.png deleted file mode 100644 index 8cff607..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_f.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_f_white.png b/toonz/sources/tnztools/Resources/fill_f_white.png deleted file mode 100644 index 9dcb684..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_f_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_p.png b/toonz/sources/tnztools/Resources/fill_p.png deleted file mode 100644 index e11ac5b..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_p.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_p_white.png b/toonz/sources/tnztools/Resources/fill_p_white.png deleted file mode 100644 index 6cdcff4..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_p_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_r.png b/toonz/sources/tnztools/Resources/fill_r.png deleted file mode 100644 index fcc8ea6..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_r.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_r_white.png b/toonz/sources/tnztools/Resources/fill_r_white.png deleted file mode 100644 index a61421c..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_r_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/fill_white.png b/toonz/sources/tnztools/Resources/fill_white.png deleted file mode 100644 index 5514ea7..0000000 Binary files a/toonz/sources/tnztools/Resources/fill_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/karasu.png b/toonz/sources/tnztools/Resources/karasu.png index ed0e39c..dee1093 100644 Binary files a/toonz/sources/tnztools/Resources/karasu.png and b/toonz/sources/tnztools/Resources/karasu.png differ diff --git a/toonz/sources/tnztools/Resources/karasu_f.png b/toonz/sources/tnztools/Resources/karasu_f.png deleted file mode 100644 index c2cf80e..0000000 Binary files a/toonz/sources/tnztools/Resources/karasu_f.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/karasu_f_white.png b/toonz/sources/tnztools/Resources/karasu_f_white.png deleted file mode 100644 index 9ad844b..0000000 Binary files a/toonz/sources/tnztools/Resources/karasu_f_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/karasu_p.png b/toonz/sources/tnztools/Resources/karasu_p.png deleted file mode 100644 index ed963d6..0000000 Binary files a/toonz/sources/tnztools/Resources/karasu_p.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/karasu_p_white.png b/toonz/sources/tnztools/Resources/karasu_p_white.png deleted file mode 100644 index a4cac63..0000000 Binary files a/toonz/sources/tnztools/Resources/karasu_p_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/karasu_r.png b/toonz/sources/tnztools/Resources/karasu_r.png deleted file mode 100644 index b110e2a..0000000 Binary files a/toonz/sources/tnztools/Resources/karasu_r.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/karasu_r_white.png b/toonz/sources/tnztools/Resources/karasu_r_white.png deleted file mode 100644 index e1044ec..0000000 Binary files a/toonz/sources/tnztools/Resources/karasu_r_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/karasu_white.png b/toonz/sources/tnztools/Resources/karasu_white.png deleted file mode 100644 index b5266eb..0000000 Binary files a/toonz/sources/tnztools/Resources/karasu_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/normaleraser.png b/toonz/sources/tnztools/Resources/normaleraser.png index 68107c7..33015a3 100644 Binary files a/toonz/sources/tnztools/Resources/normaleraser.png and b/toonz/sources/tnztools/Resources/normaleraser.png differ diff --git a/toonz/sources/tnztools/Resources/picker_style_white.png b/toonz/sources/tnztools/Resources/picker_style_white.png deleted file mode 100644 index a9cd68d..0000000 Binary files a/toonz/sources/tnztools/Resources/picker_style_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/picker_style_white_area.png b/toonz/sources/tnztools/Resources/picker_style_white_area.png deleted file mode 100644 index 6292c37..0000000 Binary files a/toonz/sources/tnztools/Resources/picker_style_white_area.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/picker_style_white_line.png b/toonz/sources/tnztools/Resources/picker_style_white_line.png deleted file mode 100644 index 86221a3..0000000 Binary files a/toonz/sources/tnztools/Resources/picker_style_white_line.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/picker_style_white_organize.png b/toonz/sources/tnztools/Resources/picker_style_white_organize.png deleted file mode 100644 index 5e58682..0000000 Binary files a/toonz/sources/tnztools/Resources/picker_style_white_organize.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/recteraser.png b/toonz/sources/tnztools/Resources/recteraser.png index 9efd794..1bd963f 100644 Binary files a/toonz/sources/tnztools/Resources/recteraser.png and b/toonz/sources/tnztools/Resources/recteraser.png differ diff --git a/toonz/sources/tnztools/Resources/recteraser_white.png b/toonz/sources/tnztools/Resources/recteraser_white.png deleted file mode 100644 index 385b2e9..0000000 Binary files a/toonz/sources/tnztools/Resources/recteraser_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/Resources/tape.png b/toonz/sources/tnztools/Resources/tape.png index 6a8bc95..cc91d3c 100644 Binary files a/toonz/sources/tnztools/Resources/tape.png and b/toonz/sources/tnztools/Resources/tape.png differ diff --git a/toonz/sources/tnztools/Resources/tape_white.png b/toonz/sources/tnztools/Resources/tape_white.png deleted file mode 100644 index 6755b7a..0000000 Binary files a/toonz/sources/tnztools/Resources/tape_white.png and /dev/null differ diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp index 36bd645..956e7d2 100644 --- a/toonz/sources/tnztools/brushtool.cpp +++ b/toonz/sources/tnztools/brushtool.cpp @@ -2489,7 +2489,9 @@ BrushData::BrushData() , m_join(0) , m_miter(0) , m_modifierSize(0.0) - , m_modifierOpacity(0.0) {} + , m_modifierOpacity(0.0) + , m_modifierEraser(0.0) + , m_modifierLockAlpha(0.0) {} //---------------------------------------------------------------------------------------------------------- @@ -2510,7 +2512,9 @@ BrushData::BrushData(const std::wstring &name) , m_join(0) , m_miter(0) , m_modifierSize(0.0) - , m_modifierOpacity(0.0) {} + , m_modifierOpacity(0.0) + , m_modifierEraser(0.0) + , m_modifierLockAlpha(0.0) {} //---------------------------------------------------------------------------------------------------------- @@ -2560,6 +2564,12 @@ void BrushData::saveData(TOStream &os) { os.openChild("Modifier_Opacity"); os << m_modifierOpacity; os.closeChild(); + os.openChild("Modifier_Eraser"); + os << (int)m_modifierEraser; + os.closeChild(); + os.openChild("Modifier_LockAlpha"); + os << (int)m_modifierLockAlpha; + os.closeChild(); } //---------------------------------------------------------------------------------------------------------- @@ -2599,6 +2609,10 @@ void BrushData::loadData(TIStream &is) { is >> m_modifierSize, is.matchEndTag(); else if (tagName == "Modifier_Opacity") is >> m_modifierOpacity, is.matchEndTag(); + else if (tagName == "Modifier_Eraser") + is >> val, m_modifierEraser = val, is.matchEndTag(); + else if (tagName == "Modifier_LockAlpha") + is >> val, m_modifierLockAlpha = val, is.matchEndTag(); else is.skipCurrentTag(); } diff --git a/toonz/sources/tnztools/brushtool.h b/toonz/sources/tnztools/brushtool.h index de16f05..2c484d2 100644 --- a/toonz/sources/tnztools/brushtool.h +++ b/toonz/sources/tnztools/brushtool.h @@ -42,6 +42,7 @@ struct BrushData final : public TPersist { bool m_selective, m_pencil, m_breakAngles, m_pressure; int m_cap, m_join, m_miter; double m_modifierSize, m_modifierOpacity; + bool m_modifierEraser, m_modifierLockAlpha; BrushData(); BrushData(const std::wstring &name); diff --git a/toonz/sources/tnztools/cursormanager.cpp b/toonz/sources/tnztools/cursormanager.cpp index 323ba47..9cf1fd7 100644 --- a/toonz/sources/tnztools/cursormanager.cpp +++ b/toonz/sources/tnztools/cursormanager.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace { @@ -22,7 +23,7 @@ const struct { {ToolCursor::CutterCursor, "cutter", 6, 24}, // 12,20}, {ToolCursor::EraserCursor, "eraser", 7, 21}, // 15,16}, {ToolCursor::DistortCursor, "selection_distort", 11, 6}, - {ToolCursor::FillCursor, "fill", 6, 23}, + {ToolCursor::FillCursor, "fill", 3, 26}, {ToolCursor::MoveCursor, "move", 15, 15}, {ToolCursor::MoveEWCursor, "move_ew", 15, 15}, {ToolCursor::MoveNSCursor, "move_ns", 15, 15}, @@ -54,7 +55,7 @@ const struct { {ToolCursor::ScaleGlobalCursor, "scale_global", 15, 15}, {ToolCursor::ScaleHVCursor, "scale_hv", 15, 15}, {ToolCursor::StrokeSelectCursor, "stroke_select", 11, 6}, - {ToolCursor::TapeCursor, "tape", 9, 23}, + {ToolCursor::TapeCursor, "tape", 4, 23}, {ToolCursor::TrackerCursor, "tracker", 12, 15}, {ToolCursor::TypeInCursor, "type_in", 16, 19}, {ToolCursor::TypeOutCursor, "type_out", 16, 19}, @@ -65,41 +66,12 @@ const struct { {ToolCursor::SplineEditorCursor, "stroke_select", 11, 6}, {ToolCursor::SplineEditorCursorAdd, "selection_add", 11, 6}, {ToolCursor::SplineEditorCursorSelect, "selection_convert", 11, 6}, - {ToolCursor::NormalEraserCursor, "normaleraser", 10, 21}, - {ToolCursor::RectEraserCursor, "recteraser", 10, 21}, - {ToolCursor::RectEraserCursorWhite, "recteraser_white", 10, 21}, - {ToolCursor::FillCursorWhite, "fill_white", 6, 23}, - {ToolCursor::TapeCursorWhite, "tape_white", 9, 23}, - {ToolCursor::PickerCursorWhiteLine, "picker_style_white_line", 7, 22}, - {ToolCursor::PickerCursorWhiteArea, "picker_style_white_area", 7, 22}, - {ToolCursor::PickerCursorWhite, "picker_style_white", 7, 22}, + {ToolCursor::NormalEraserCursor, "normaleraser", 3, 26}, + {ToolCursor::RectEraserCursor, "recteraser", 3, 26}, {ToolCursor::PickerCursorOrganize, "picker_style_organize", 7, 22}, - {ToolCursor::PickerCursorWhiteOrganize, "picker_style_white_organize", 7, - 22}, {ToolCursor::PickerRGB, "picker_rgb", 7, 22}, {ToolCursor::PickerRGBWhite, "picker_rgb_white", 7, 22}, - {ToolCursor::FillCursorF, "fill_f", 6, 23}, - {ToolCursor::FillCursorFWhite, "fill_f_white", 6, 23}, - {ToolCursor::FillCursorP, "fill_p", 6, 23}, - {ToolCursor::FillCursorPWhite, "fill_p_white", 6, 23}, - {ToolCursor::FillCursorR, "fill_r", 6, 23}, - {ToolCursor::FillCursorRWhite, "fill_r_white", 6, 23}, - {ToolCursor::FillCursorA, "fill_a", 6, 23}, - {ToolCursor::FillCursorAWhite, "fill_a_white", 6, 23}, - {ToolCursor::FillCursorAF, "fill_a_f", 6, 23}, - {ToolCursor::FillCursorAFWhite, "fill_a_f_white", 6, 23}, - {ToolCursor::FillCursorAP, "fill_a_p", 6, 23}, - {ToolCursor::FillCursorAPWhite, "fill_a_p_white", 6, 23}, - {ToolCursor::FillCursorAR, "fill_a_r", 6, 23}, - {ToolCursor::FillCursorARWhite, "fill_a_r_white", 6, 23}, - {ToolCursor::FillCursorL, "karasu", 6, 23}, - {ToolCursor::FillCursorLWhite, "karasu_white", 6, 23}, - {ToolCursor::FillCursorLF, "karasu_f", 6, 23}, - {ToolCursor::FillCursorLFWhite, "karasu_f_white", 6, 23}, - {ToolCursor::FillCursorLP, "karasu_p", 6, 23}, - {ToolCursor::FillCursorLPWhite, "karasu_p_white", 6, 23}, - {ToolCursor::FillCursorLR, "karasu_r", 6, 23}, - {ToolCursor::FillCursorLRWhite, "karasu_r_white", 6, 23}, + {ToolCursor::FillCursorL, "karasu", 7, 25}, {ToolCursor::RulerModifyCursor, "ruler_modify", 7, 7}, {ToolCursor::RulerNewCursor, "ruler_new", 7, 7}, {0, 0, 0, 0}}; @@ -108,6 +80,16 @@ struct CursorData { QPixmap pixmap; int x, y; }; + +const struct { + int decorateType; + const char *pixmapFilename; +} decorateInfo[] = {{ToolCursor::Ex_FreeHand, "ex_freehand"}, + {ToolCursor::Ex_PolyLine, "ex_polyline"}, + {ToolCursor::Ex_Rectangle, "ex_rectangle"}, + {ToolCursor::Ex_Line, "ex_line"}, + {ToolCursor::Ex_Area, "ex_area"}, + {0, 0}}; }; //============================================================================= @@ -126,22 +108,47 @@ public: return &_instance; } + void doDecoration(QPixmap &pixmap, int decorationFlag) { + 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"; + p.drawPixmap(0, 0, QPixmap(path)); + } + } + // negate + if (decorationFlag & ToolCursor::Ex_Negate) { + QImage img = pixmap.toImage(); + img.invertPixels(QImage::InvertRgb); // leave the alpha channel unchanged + pixmap = QPixmap::fromImage(img); + } + } + 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; + + int decorationsFlag = cursorType & ~(0xFF); + int baseCursorType = cursorType & 0xFF; + // provo a cercarlo in cursorInfo[] int i; for (i = 0; cursorInfo[i].pixmapFilename; i++) - if (cursorType == cursorInfo[i].cursorType) { + if (baseCursorType == cursorInfo[i].cursorType) { QString path = QString(":Resources/") + cursorInfo[i].pixmapFilename + ".png"; CursorData data; data.pixmap = QPixmap(path); - data.x = cursorInfo[i].x; - data.y = cursorInfo[i].y; - it = m_cursors.insert(std::make_pair(cursorType, data)).first; + 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; return it->second; } // niente da fare. uso un default diff --git a/toonz/sources/tnztools/filltool.cpp b/toonz/sources/tnztools/filltool.cpp index 542df42..584dfb0 100644 --- a/toonz/sources/tnztools/filltool.cpp +++ b/toonz/sources/tnztools/filltool.cpp @@ -1775,48 +1775,23 @@ FillTool::FillTool(int targetType) //----------------------------------------------------------------------------- int FillTool::getCursorId() const { - bool isBlackBG = ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg; - - if (m_colorType.getValue() == LINES) { - if (m_fillType.getValue() == NORMALFILL) - return (isBlackBG) ? ToolCursor::FillCursorLWhite - : ToolCursor::FillCursorL; - else if (m_fillType.getValue() == FREEHANDFILL) - return (isBlackBG) ? ToolCursor::FillCursorLFWhite - : ToolCursor::FillCursorLF; - else if (m_fillType.getValue() == POLYLINEFILL) - return (isBlackBG) ? ToolCursor::FillCursorLPWhite - : ToolCursor::FillCursorLP; - else // Rect - return (isBlackBG) ? ToolCursor::FillCursorLRWhite - : ToolCursor::FillCursorLR; - } else if (m_colorType.getValue() == AREAS) { - if (m_fillType.getValue() == NORMALFILL) - return (isBlackBG) ? ToolCursor::FillCursorAWhite - : ToolCursor::FillCursorA; - else if (m_fillType.getValue() == FREEHANDFILL) - return (isBlackBG) ? ToolCursor::FillCursorAFWhite - : ToolCursor::FillCursorAF; - else if (m_fillType.getValue() == POLYLINEFILL) - return (isBlackBG) ? ToolCursor::FillCursorAPWhite - : ToolCursor::FillCursorAP; - else // Rect - return (isBlackBG) ? ToolCursor::FillCursorARWhite - : ToolCursor::FillCursorAR; - } else // line&areas - { - if (m_fillType.getValue() == NORMALFILL) - return (isBlackBG) ? ToolCursor::FillCursorWhite : ToolCursor::FillCursor; - else if (m_fillType.getValue() == FREEHANDFILL) - return (isBlackBG) ? ToolCursor::FillCursorFWhite - : ToolCursor::FillCursorF; - else if (m_fillType.getValue() == POLYLINEFILL) - return (isBlackBG) ? ToolCursor::FillCursorPWhite - : ToolCursor::FillCursorP; - else // Rect - return (isBlackBG) ? ToolCursor::FillCursorRWhite - : ToolCursor::FillCursorR; - } + int ret; + if (m_colorType.getValue() == LINES) + ret = ToolCursor::FillCursorL; + else { + ret = ToolCursor::FillCursor; + if (m_colorType.getValue() == AREAS) ret = ret | ToolCursor::Ex_Area; + } + if (m_fillType.getValue() == FREEHANDFILL) + ret = ret | ToolCursor::Ex_FreeHand; + else if (m_fillType.getValue() == POLYLINEFILL) + ret = ret | ToolCursor::Ex_PolyLine; + else if (m_fillType.getValue() == RECTFILL) + ret = ret | ToolCursor::Ex_Rectangle; + + if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg) + ret = ret | ToolCursor::Ex_Negate; + return ret; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp index fd4e7ac..5ae90c0 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.cpp +++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp @@ -51,6 +51,8 @@ TEnv::DoubleVar FullcolorMinOpacity("FullcolorMinOpacity", 100); TEnv::DoubleVar FullcolorMaxOpacity("FullcolorMaxOpacity", 100); TEnv::DoubleVar FullcolorModifierSize("FullcolorModifierSize", 0); TEnv::DoubleVar FullcolorModifierOpacity("FullcolorModifierOpacity", 100); +TEnv::IntVar FullcolorModifierEraser("FullcolorModifierEraser", 0); +TEnv::IntVar FullcolorModifierLockAlpha("FullcolorModifierLockAlpha", 0); //---------------------------------------------------------------------------------- @@ -115,6 +117,8 @@ FullColorBrushTool::FullColorBrushTool(std::string name) , m_hardness("Hardness:", 0, 100, 100) , m_modifierSize("ModifierSize", -3, 3, 0, true) , m_modifierOpacity("ModifierOpacity", 0, 100, 100, true) + , m_modifierEraser("ModifierEraser", false) + , m_modifierLockAlpha("ModifierLockAlpha", false) , m_preset("Preset:") , m_minCursorThick(0) , m_maxCursorThick(0) @@ -132,6 +136,8 @@ FullColorBrushTool::FullColorBrushTool(std::string name) m_prop.bind(m_opacity); m_prop.bind(m_modifierSize); m_prop.bind(m_modifierOpacity); + m_prop.bind(m_modifierEraser); + m_prop.bind(m_modifierLockAlpha); m_prop.bind(m_pressure); m_prop.bind(m_preset); @@ -172,6 +178,8 @@ void FullColorBrushTool::updateTranslation() { m_preset.setQStringName(tr("Preset:")); m_modifierSize.setQStringName(tr("Size")); m_modifierOpacity.setQStringName(tr("Opacity")); + m_modifierEraser.setQStringName(tr("Eraser")); + m_modifierLockAlpha.setQStringName(tr("Lock Alpha")); } //--------------------------------------------------------------------------------------------------- @@ -191,6 +199,8 @@ void FullColorBrushTool::onActivate() { m_hardness.setValue(FullcolorBrushHardness); m_modifierSize.setValue(FullcolorModifierSize); m_modifierOpacity.setValue(FullcolorModifierOpacity); + m_modifierEraser.setValue(FullcolorModifierEraser ? true : false); + m_modifierLockAlpha.setValue(FullcolorModifierLockAlpha ? true : false); } setWorkAndBackupImages(); @@ -568,6 +578,8 @@ bool FullColorBrushTool::onPropertyChanged(std::string propertyName) { FullcolorMaxOpacity = m_opacity.getValue().second; FullcolorModifierSize = m_modifierSize.getValue(); FullcolorModifierOpacity = m_modifierOpacity.getValue(); + FullcolorModifierEraser = m_modifierEraser.getValue() ? 1 : 0; + FullcolorModifierLockAlpha = m_modifierLockAlpha.getValue() ? 1 : 0; updateCurrentStyle(); @@ -625,6 +637,8 @@ void FullColorBrushTool::loadPreset() { m_pressure.setValue(preset.m_pressure); m_modifierSize.setValue(preset.m_modifierSize); m_modifierOpacity.setValue(preset.m_modifierOpacity); + m_modifierEraser.setValue(preset.m_modifierEraser); + m_modifierLockAlpha.setValue(preset.m_modifierLockAlpha); } catch (...) { } } @@ -635,14 +649,16 @@ void FullColorBrushTool::addPreset(QString name) { // Build the preset BrushData preset(name.toStdWString()); - preset.m_min = m_thickness.getValue().first; - preset.m_max = m_thickness.getValue().second; - preset.m_hardness = m_hardness.getValue(); - preset.m_opacityMin = m_opacity.getValue().first; - preset.m_opacityMax = m_opacity.getValue().second; - preset.m_pressure = m_pressure.getValue(); - preset.m_modifierSize = m_modifierSize.getValue(); - preset.m_modifierOpacity = m_modifierOpacity.getValue(); + preset.m_min = m_thickness.getValue().first; + preset.m_max = m_thickness.getValue().second; + preset.m_hardness = m_hardness.getValue(); + preset.m_opacityMin = m_opacity.getValue().first; + preset.m_opacityMax = m_opacity.getValue().second; + preset.m_pressure = m_pressure.getValue(); + preset.m_modifierSize = m_modifierSize.getValue(); + preset.m_modifierOpacity = m_modifierOpacity.getValue(); + preset.m_modifierEraser = m_modifierEraser.getValue(); + preset.m_modifierLockAlpha = m_modifierLockAlpha.getValue(); // Pass the preset to the manager m_presetsManager.addPreset(preset); @@ -821,6 +837,8 @@ void FullColorBrushTool::applyToonzBrushSettings(mypaint::Brush &mypaintBrush) { double modifierSize = m_modifierSize.getValue() * log(2.0); double modifierOpacity = 0.01 * m_modifierOpacity.getValue(); + bool modifierEraser = m_modifierEraser.getValue(); + bool modifierLockAlpha = m_modifierLockAlpha.getValue(); TPixelD color = PixelConverter::from(m_currentColor); double colorH = 0.0; @@ -841,6 +859,14 @@ void FullColorBrushTool::applyToonzBrushSettings(mypaint::Brush &mypaintBrush) { mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_COLOR_H, colorH / 360.0); mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_COLOR_S, colorS); mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_COLOR_V, colorV); + + if (modifierEraser) { + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_ERASER, 1.0); + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_LOCK_ALPHA, 0.0); + } else if (modifierLockAlpha) { + // lock-alpha already disables eraser + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_LOCK_ALPHA, 1.0); + } } else { applyClassicToonzBrushSettings(mypaintBrush); } diff --git a/toonz/sources/tnztools/fullcolorbrushtool.h b/toonz/sources/tnztools/fullcolorbrushtool.h index d4bf729..b4039af 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.h +++ b/toonz/sources/tnztools/fullcolorbrushtool.h @@ -88,6 +88,8 @@ protected: TDoubleProperty m_hardness; TDoubleProperty m_modifierSize; TDoubleProperty m_modifierOpacity; + TBoolProperty m_modifierEraser; + TBoolProperty m_modifierLockAlpha; TEnumProperty m_preset; TPixel32 m_currentColor; diff --git a/toonz/sources/tnztools/rastererasertool.cpp b/toonz/sources/tnztools/rastererasertool.cpp index 9cedad2..264a896 100644 --- a/toonz/sources/tnztools/rastererasertool.cpp +++ b/toonz/sources/tnztools/rastererasertool.cpp @@ -690,12 +690,28 @@ void EraserTool::draw() { //---------------------------------------------------------------------- int EraserTool::getCursorId() const { + int ret; if (m_eraseType.getValue() == NORMALERASE) - return ToolCursor::NormalEraserCursor; - else if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg) - return ToolCursor::RectEraserCursorWhite; - else - return ToolCursor::RectEraserCursor; + ret = ToolCursor::NormalEraserCursor; + else { + ret = ToolCursor::RectEraserCursor; + + if (m_eraseType.getValue() == FREEHANDERASE) + ret = ret | ToolCursor::Ex_FreeHand; + else if (m_eraseType.getValue() == POLYLINEERASE) + ret = ret | ToolCursor::Ex_PolyLine; + else if (m_eraseType.getValue() == RECTERASE) + ret = ret | ToolCursor::Ex_Rectangle; + } + + if (m_colorType.getValue() == LINES) + ret = ret | ToolCursor::Ex_Line; + else if (m_colorType.getValue() == AREAS) + ret = ret | ToolCursor::Ex_Area; + + if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg) + ret = ret | ToolCursor::Ex_Negate; + return ret; } //---------------------------------------------------------------------- diff --git a/toonz/sources/tnztools/rastertapetool.cpp b/toonz/sources/tnztools/rastertapetool.cpp index 0f927ce..e39992b 100644 --- a/toonz/sources/tnztools/rastertapetool.cpp +++ b/toonz/sources/tnztools/rastertapetool.cpp @@ -671,10 +671,19 @@ public: //---------------------------------------------------------------------- int getCursorId() const override { + int ret = ToolCursor::TapeCursor; + + if (m_closeType.getValue() == FREEHAND_CLOSE) + ret = ret | ToolCursor::Ex_FreeHand; + else if (m_closeType.getValue() == POLYLINE_CLOSE) + ret = ret | ToolCursor::Ex_PolyLine; + else if (m_closeType.getValue() == RECT_CLOSE) + ret = ret | ToolCursor::Ex_Rectangle; + if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg) - return ToolCursor::TapeCursorWhite; - else - return ToolCursor::TapeCursor; + ret = ret | ToolCursor::Ex_Negate; + + return ret; } //---------------------------------------------------------------------- diff --git a/toonz/sources/tnztools/stylepickertool.cpp b/toonz/sources/tnztools/stylepickertool.cpp index 29a81a0..663b347 100644 --- a/toonz/sources/tnztools/stylepickertool.cpp +++ b/toonz/sources/tnztools/stylepickertool.cpp @@ -212,22 +212,20 @@ void StylePickerTool::mouseMove(const TPointD &pos, const TMouseEvent &e) { } int StylePickerTool::getCursorId() const { - bool isBlackBG = ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg; - + int ret; /* in case the "organize palette" option is active */ if (m_organizePalette.getValue()) - return (isBlackBG) ? ToolCursor::PickerCursorWhiteOrganize - : ToolCursor::PickerCursorOrganize; - - if (m_colorType.getValue() == LINES) - return (isBlackBG) ? ToolCursor::PickerCursorWhiteLine - : ToolCursor::PickerCursorLine; + ret = ToolCursor::PickerCursorOrganize; + else if (m_colorType.getValue() == LINES) + ret = ToolCursor::PickerCursorLine; else if (m_colorType.getValue() == AREAS) - return (isBlackBG) ? ToolCursor::PickerCursorWhiteArea - : ToolCursor::PickerCursorArea; + ret = ToolCursor::PickerCursorArea; else // line&areas - return (isBlackBG) ? ToolCursor::PickerCursorWhite - : ToolCursor::PickerCursor; + ret = ToolCursor::PickerCursor; + + if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg) + ret = ret | ToolCursor::Ex_Negate; + return ret; } bool StylePickerTool::onPropertyChanged(std::string propertyName) { diff --git a/toonz/sources/tnztools/tnztools.qrc b/toonz/sources/tnztools/tnztools.qrc index 1b5b91b..154613d 100644 --- a/toonz/sources/tnztools/tnztools.qrc +++ b/toonz/sources/tnztools/tnztools.qrc @@ -44,39 +44,16 @@ Resources/scale_hv.png Resources/normaleraser.png Resources/recteraser.png - Resources/recteraser_white.png - Resources/fill_white.png - Resources/tape_white.png - Resources/picker_style_white_line.png - Resources/picker_style_white_area.png - Resources/picker_style_white.png Resources/picker_style_organize.png - Resources/picker_style_white_organize.png Resources/picker_rgb.png - Resources/picker_rgb_white.png - Resources/fill_f.png - Resources/fill_f_white.png - Resources/fill_p.png - Resources/fill_p_white.png - Resources/fill_r.png - Resources/fill_r_white.png - Resources/fill_a.png - Resources/fill_a_white.png - Resources/fill_a_f.png - Resources/fill_a_f_white.png - Resources/fill_a_p.png - Resources/fill_a_p_white.png - Resources/fill_a_r.png - Resources/fill_a_r_white.png + Resources/picker_rgb_white.png Resources/karasu.png - Resources/karasu_white.png - Resources/karasu_f.png - Resources/karasu_f_white.png - Resources/karasu_p.png - Resources/karasu_p_white.png - Resources/karasu_r.png - Resources/karasu_r_white.png Resources/ruler_modify.png Resources/ruler_new.png + Resources/ex_freehand.png + Resources/ex_polyline.png + Resources/ex_rectangle.png + Resources/ex_line.png + Resources/ex_area.png \ No newline at end of file diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cpp index 79ee344..902f72c 100644 --- a/toonz/sources/tnztools/tooloptions.cpp +++ b/toonz/sources/tnztools/tooloptions.cpp @@ -306,8 +306,10 @@ void ToolOptionControlBuilder::visit(TBoolProperty *p) { std::string actionName = "A_ToolOption_" + p->getId(); QAction *a = CommandManager::instance()->getAction(actionName.c_str()); if (a) { + a->setCheckable(true); control->addAction(a); - QObject::connect(a, SIGNAL(triggered()), control, SLOT(doClick())); + QObject::connect(a, SIGNAL(triggered(bool)), control, + SLOT(doClick(bool))); } } hLayout()->addSpacing(5); @@ -553,10 +555,11 @@ ArrowToolOptionsBox::ArrowToolOptionsBox( m_lockNSCenterCheckbox = new ToolOptionCheckbox(m_tool, lockProp, toolHandle, this); - TBoolProperty *prop = + TBoolProperty *globalKeyProp = dynamic_cast(m_pg->getProperty("Global Key")); - if (prop) - m_globalKey = new ToolOptionCheckbox(m_tool, prop, toolHandle, this); + if (globalKeyProp) + m_globalKey = + new ToolOptionCheckbox(m_tool, globalKeyProp, toolHandle, this); m_lockEWPosCheckbox->setObjectName("EditToolLockButton"); m_lockNSPosCheckbox->setObjectName("EditToolLockButton"); @@ -812,6 +815,16 @@ ArrowToolOptionsBox::ArrowToolOptionsBox( connect(m_maintainCombo, SIGNAL(currentIndexChanged(int)), m_scaleVField, SLOT(onScaleTypeChanged(int))); } + + if (globalKeyProp) { + std::string actionName = "A_ToolOption_" + globalKeyProp->getId(); + QAction *a = CommandManager::instance()->getAction(actionName.c_str()); + if (a) { + a->setCheckable(true); + m_globalKey->addAction(a); + connect(a, SIGNAL(triggered(bool)), m_globalKey, SLOT(doClick(bool))); + } + } } //----------------------------------------------------------------------------- diff --git a/toonz/sources/tnztools/tooloptionscontrols.cpp b/toonz/sources/tnztools/tooloptionscontrols.cpp index 1a93c28..06c9b1d 100644 --- a/toonz/sources/tnztools/tooloptionscontrols.cpp +++ b/toonz/sources/tnztools/tooloptionscontrols.cpp @@ -102,6 +102,11 @@ ToolOptionCheckbox::ToolOptionCheckbox(TTool *tool, TBoolProperty *property, void ToolOptionCheckbox::updateStatus() { bool check = m_property->getValue(); + + if (!actions().isEmpty() && actions()[0]->isCheckable() && + actions()[0]->isChecked() != check) + actions()[0]->setChecked(check); + if (isChecked() == check) return; setCheckState(check ? Qt::Checked : Qt::Unchecked); @@ -117,11 +122,16 @@ void ToolOptionCheckbox::nextCheckState() { //----------------------------------------------------------------------------- -void ToolOptionCheckbox::doClick() { +void ToolOptionCheckbox::doClick(bool checked) { if (m_toolHandle && m_toolHandle->getTool() != m_tool) return; // active only if the belonging combo-viewer is visible if (!isInVisibleViewer(this)) return; - click(); + + if (isChecked() == checked) return; + + setChecked(checked); + m_property->setValue(checked); + notifyTool(); } //============================================================================= diff --git a/toonz/sources/tnztools/tooloptionscontrols.h b/toonz/sources/tnztools/tooloptionscontrols.h index f3a26cd..c55f417 100644 --- a/toonz/sources/tnztools/tooloptionscontrols.h +++ b/toonz/sources/tnztools/tooloptionscontrols.h @@ -93,7 +93,7 @@ public: ToolHandle *toolHandle = 0, QWidget *parent = 0); void updateStatus() override; public slots: - void doClick(); + void doClick(bool); protected: void nextCheckState() override; diff --git a/toonz/sources/tnztools/vectortapetool.cpp b/toonz/sources/tnztools/vectortapetool.cpp index 0bcba57..5869536 100644 --- a/toonz/sources/tnztools/vectortapetool.cpp +++ b/toonz/sources/tnztools/vectortapetool.cpp @@ -752,10 +752,11 @@ public: } int getCursorId() const override { + int ret = ToolCursor::TapeCursor; + if (m_type.getValue() == RECT) ret = ret | ToolCursor::Ex_Rectangle; if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg) - return ToolCursor::TapeCursorWhite; - else - return ToolCursor::TapeCursor; + ret = ret | ToolCursor::Ex_Negate; + return ret; } } vectorTapeTool; diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt index e169bab..816032e 100644 --- a/toonz/sources/toonz/CMakeLists.txt +++ b/toonz/sources/toonz/CMakeLists.txt @@ -431,7 +431,7 @@ elseif(BUILD_ENV_UNIXLIKE) set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES} ${OPENBLAS_LIB}) if(BUILD_TARGET_WIN) - set(EXTRA_LIBS ${EXTRA_LIBS} Qt5::WinMain -lstrmiids) + set(EXTRA_LIBS ${EXTRA_LIBS} Qt5::WinMain -lstrmiids -mwindows) endif() target_link_libraries( diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp index ef7676d..0a8b4b4 100644 --- a/toonz/sources/toonz/cellselection.cpp +++ b/toonz/sources/toonz/cellselection.cpp @@ -1326,40 +1326,18 @@ void TCellSelection::enableCommands() { bool TCellSelection::isEnabledCommand( std::string commandId) { // static function - static QList commands = {MI_Autorenumber, - MI_Reverse, - MI_Swing, - MI_Random, - MI_Increment, - MI_ResetStep, - MI_IncreaseStep, - MI_DecreaseStep, - MI_Step2, - MI_Step3, - MI_Step4, - MI_Each2, - MI_Each3, - MI_Each4, - MI_Rollup, - MI_Rolldown, - MI_TimeStretch, - MI_CloneLevel, - MI_SetKeyframes, - MI_Copy, - MI_Paste, - MI_PasteInto, - MI_Cut, - MI_Clear, - MI_Insert, - MI_PasteInto, - MI_Reframe1, - MI_Reframe2, - MI_Reframe3, - MI_Reframe4, - MI_ReframeWithEmptyInbetweens, - MI_Undo, - MI_Redo, - MI_PasteNumbers}; + static QList commands = { + MI_Autorenumber, MI_Reverse, MI_Swing, + MI_Random, MI_Increment, MI_ResetStep, + MI_IncreaseStep, MI_DecreaseStep, MI_Step2, + MI_Step3, MI_Step4, MI_Each2, + MI_Each3, MI_Each4, MI_Rollup, + MI_Rolldown, MI_TimeStretch, MI_CloneLevel, + MI_SetKeyframes, MI_Copy, MI_Paste, + MI_PasteInto, MI_Cut, MI_Clear, + MI_Insert, MI_Reframe1, MI_Reframe2, + MI_Reframe3, MI_Reframe4, MI_ReframeWithEmptyInbetweens, + MI_Undo, MI_Redo, MI_PasteNumbers}; return commands.contains(commandId); } diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp index 74e80b3..18091ac 100644 --- a/toonz/sources/toonz/xshcellviewer.cpp +++ b/toonz/sources/toonz/xshcellviewer.cpp @@ -2582,9 +2582,9 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected) { if (isCellSelected) { menu.addAction(cmdManager->getAction(MI_LevelSettings)); + menu.addSeparator(); if (!soundCellsSelected) { - //- force reframe QMenu *reframeSubMenu = new QMenu(tr("Reframe"), this); { reframeSubMenu->addAction(cmdManager->getAction(MI_Reframe1)); @@ -2614,22 +2614,32 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected) { } menu.addMenu(eachSubMenu); - menu.addSeparator(); - - menu.addAction(cmdManager->getAction(MI_Reverse)); - menu.addAction(cmdManager->getAction(MI_Swing)); - menu.addAction(cmdManager->getAction(MI_Random)); - menu.addAction(cmdManager->getAction(MI_Dup)); + QMenu *editCellNumbersMenu = new QMenu(tr("Edit Cell Numbers"), this); + { + editCellNumbersMenu->addAction(cmdManager->getAction(MI_Reverse)); + editCellNumbersMenu->addAction(cmdManager->getAction(MI_Swing)); + editCellNumbersMenu->addAction(cmdManager->getAction(MI_Random)); + editCellNumbersMenu->addAction(cmdManager->getAction(MI_Dup)); + editCellNumbersMenu->addAction(cmdManager->getAction(MI_Rollup)); + editCellNumbersMenu->addAction(cmdManager->getAction(MI_Rolldown)); + editCellNumbersMenu->addAction(cmdManager->getAction(MI_TimeStretch)); + editCellNumbersMenu->addAction( + cmdManager->getAction(MI_AutoInputCellNumber)); + } + menu.addMenu(editCellNumbersMenu); - menu.addAction(cmdManager->getAction(MI_Rollup)); - menu.addAction(cmdManager->getAction(MI_Rolldown)); - menu.addAction(cmdManager->getAction(MI_TimeStretch)); - menu.addAction(cmdManager->getAction(MI_AutoInputCellNumber)); menu.addSeparator(); menu.addAction(cmdManager->getAction(MI_Autorenumber)); } - menu.addAction(cmdManager->getAction(MI_ReplaceLevel)); - menu.addAction(cmdManager->getAction(MI_ReplaceParentDirectory)); + + QMenu *replaceLevelMenu = new QMenu(tr("Replace Level"), this); + menu.addMenu(replaceLevelMenu); + + replaceLevelMenu->addAction(cmdManager->getAction(MI_ReplaceLevel)); + + replaceLevelMenu->addAction( + cmdManager->getAction(MI_ReplaceParentDirectory)); + { // replace with another level in scene cast std::vector levels; @@ -2639,7 +2649,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected) { ->getLevelSet() ->listLevels(levels); if (!levels.empty()) { - QMenu *replaceMenu = menu.addMenu(tr("Replace")); + QMenu *replaceMenu = replaceLevelMenu->addMenu(tr("Replace with")); connect(replaceMenu, SIGNAL(triggered(QAction *)), this, SLOT(onReplaceByCastedLevel(QAction *))); for (int i = 0; i < (int)levels.size(); i++) { @@ -2662,14 +2672,31 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected) { if (!soundCellsSelected) { if (selectionContainTlvImage(m_viewer->getCellSelection(), m_viewer->getXsheet())) - menu.addAction(cmdManager->getAction(MI_RevertToCleanedUp)); + replaceLevelMenu->addAction( + cmdManager->getAction(MI_RevertToCleanedUp)); if (selectionContainLevelImage(m_viewer->getCellSelection(), m_viewer->getXsheet())) - menu.addAction(cmdManager->getAction(MI_RevertToLastSaved)); + replaceLevelMenu->addAction( + cmdManager->getAction(MI_RevertToLastSaved)); menu.addAction(cmdManager->getAction(MI_SetKeyframes)); } menu.addSeparator(); + menu.addAction(cmdManager->getAction(MI_Cut)); + menu.addAction(cmdManager->getAction(MI_Copy)); + menu.addAction(cmdManager->getAction(MI_Paste)); + + QMenu *pasteSpecialMenu = new QMenu(tr("Paste Special"), this); + { + pasteSpecialMenu->addAction(cmdManager->getAction(MI_PasteInto)); + pasteSpecialMenu->addAction(cmdManager->getAction(MI_PasteNumbers)); + } + menu.addMenu(pasteSpecialMenu); + + menu.addAction(cmdManager->getAction(MI_Clear)); + menu.addAction(cmdManager->getAction(MI_Insert)); + menu.addSeparator(); + TXshSimpleLevel *sl = TApp::instance()->getCurrentLevel()->getSimpleLevel(); if (sl || soundCellsSelected) menu.addAction(cmdManager->getAction(MI_FileInfo)); @@ -2679,11 +2706,17 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected) { menu.addSeparator(); if (selectionContainRasterImage(m_viewer->getCellSelection(), m_viewer->getXsheet())) { - menu.addAction(cmdManager->getAction(MI_AdjustLevels)); - menu.addAction(cmdManager->getAction(MI_LinesFade)); - menu.addAction(cmdManager->getAction(MI_BrightnessAndContrast)); - menu.addAction(cmdManager->getAction(MI_Antialias)); - menu.addAction(cmdManager->getAction(MI_CanvasSize)); + QMenu *editImageMenu = new QMenu(tr("Edit Image"), this); + { + editImageMenu->addAction(cmdManager->getAction(MI_AdjustLevels)); + editImageMenu->addAction(cmdManager->getAction(MI_LinesFade)); + editImageMenu->addAction( + cmdManager->getAction(MI_BrightnessAndContrast)); + editImageMenu->addAction(cmdManager->getAction(MI_Antialias)); + editImageMenu->addAction(cmdManager->getAction(MI_CanvasSize)); + } + menu.addMenu(editImageMenu); + } else if (selectionContainTlvImage(m_viewer->getCellSelection(), m_viewer->getXsheet())) menu.addAction(cmdManager->getAction(MI_CanvasSize)); @@ -2691,7 +2724,6 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected) { menu.addSeparator(); if (!soundCellsSelected) menu.addAction(cmdManager->getAction(MI_ImportMagpieFile)); - menu.addAction(cmdManager->getAction(MI_PasteNumbers)); } //----------------------------------------------------------------------------- /*! replace level with another level in the cast diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp index 9aa6540..9a15bf1 100644 --- a/toonz/sources/toonzlib/orientation.cpp +++ b/toonz/sources/toonzlib/orientation.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using std::pair;