diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cpp index a67f8f1..49932d6 100644 --- a/toonz/sources/common/tvrender/tcolorstyles.cpp +++ b/toonz/sources/common/tvrender/tcolorstyles.cpp @@ -104,6 +104,7 @@ bool TColorStyle::operator==(const TColorStyle &cs) const { if (m_globalName != cs.getGlobalName()) return false; if (m_isEditedFromOriginal != cs.getIsEditedFlag()) return false; if (m_pickedPosition != cs.getPickedPosition()) return false; + if (m_flags != cs.getFlags()) return false; for (int p = 0; p < colorParamCount; ++p) if (getColorParamValue(p) != cs.getColorParamValue(p)) return false; diff --git a/toonz/sources/include/toonz/tpalettehandle.h b/toonz/sources/include/toonz/tpalettehandle.h index 2f0a27e..c2bdd1d 100644 --- a/toonz/sources/include/toonz/tpalettehandle.h +++ b/toonz/sources/include/toonz/tpalettehandle.h @@ -62,6 +62,8 @@ public: void notifyPaletteDirtyFlagChanged() { emit paletteDirtyFlagChanged(); } void notifyPaletteLockChanged() { emit paletteLockChanged(); } + void toggleAutopaint(); + public: signals: @@ -69,7 +71,7 @@ signals: void paletteChanged(); void paletteTitleChanged(); void colorStyleSwitched(); - void colorStyleChanged(); + void colorStyleChanged(bool); void colorStyleChangedOnMouseRelease(); void paletteDirtyFlagChanged(); void paletteLockChanged(); @@ -89,7 +91,7 @@ signals: void broadcastPaletteChanged(); void broadcastPaletteTitleChanged(); void broadcastColorStyleSwitched(); - void broadcastColorStyleChanged(); + void broadcastColorStyleChanged(bool); void broadcastColorStyleChangedOnMouseRelease(); }; diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h index d51601e..8a40c05 100644 --- a/toonz/sources/include/toonzqt/styleeditor.h +++ b/toonz/sources/include/toonzqt/styleeditor.h @@ -712,8 +712,8 @@ protected: protected slots: void onStyleSwitched(); - void onStyleChanged(); - void onCleanupStyleChanged(); + void onStyleChanged(bool isDragging); + void onCleanupStyleChanged(bool isDragging); void onOldStyleClicked(const TColorStyle &); // called (e.g.) by PaletteController when an other StyleEditor change the diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp index 752fbfb..5ae90c0 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.cpp +++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp @@ -226,9 +226,9 @@ void FullColorBrushTool::updateWorkAndBackupRasters(const TRect &rect) { TRasterP ras = ri->getRaster(); const int denominator = 8; - TRect enlargedRect = rect + m_lastRect; - int dx = (enlargedRect.getLx()-1)/denominator+1; - int dy = (enlargedRect.getLy()-1)/denominator+1; + TRect enlargedRect = rect + m_lastRect; + int dx = (enlargedRect.getLx() - 1) / denominator + 1; + int dy = (enlargedRect.getLy() - 1) / denominator + 1; if (m_lastRect.isEmpty()) { enlargedRect.x0 -= dx; @@ -236,7 +236,7 @@ void FullColorBrushTool::updateWorkAndBackupRasters(const TRect &rect) { enlargedRect.x1 += dx; enlargedRect.y1 += dy; - TRect _rect = enlargedRect*ras->getBounds(); + TRect _rect = enlargedRect * ras->getBounds(); if (_rect.isEmpty()) return; m_workRaster->extract(_rect)->copy(ras->extract(_rect)); @@ -247,10 +247,10 @@ void FullColorBrushTool::updateWorkAndBackupRasters(const TRect &rect) { if (enlargedRect.x1 > m_lastRect.x1) enlargedRect.x1 += dx; if (enlargedRect.y1 > m_lastRect.y1) enlargedRect.y1 += dy; - TRect _rect = enlargedRect*ras->getBounds(); + TRect _rect = enlargedRect * ras->getBounds(); if (_rect.isEmpty()) return; - TRect _lastRect = m_lastRect * ras->getBounds(); + TRect _lastRect = m_lastRect * ras->getBounds(); QList rects = ToolUtils::splitRect(_rect, _lastRect); for (int i = 0; i < rects.size(); i++) { m_workRaster->extract(rects[i])->copy(ras->extract(rects[i])); @@ -263,9 +263,7 @@ void FullColorBrushTool::updateWorkAndBackupRasters(const TRect &rect) { //-------------------------------------------------------------------------------------------------- -bool FullColorBrushTool::askRead(const TRect &rect) { - return askWrite(rect); -} +bool FullColorBrushTool::askRead(const TRect &rect) { return askWrite(rect); } //-------------------------------------------------------------------------------------------------- @@ -316,10 +314,11 @@ void FullColorBrushTool::leftButtonDown(const TPointD &pos, TPointD rasCenter = ras->getCenterD(); TPointD point(pos + rasCenter); - double pressure = m_enabledPressure && e.isTablet() ? e.m_pressure/255.0 : 0.5; + double pressure = + m_enabledPressure && e.isTablet() ? e.m_pressure / 255.0 : 0.5; - m_tileSet = new TTileSetFullColor(ras->getSize()); - m_tileSaver = new TTileSaverFullColor(ras, m_tileSet); + m_tileSet = new TTileSetFullColor(ras->getSize()); + m_tileSaver = new TTileSaverFullColor(ras, m_tileSet); mypaint::Brush mypaintBrush; applyToonzBrushSettings(mypaintBrush); @@ -329,14 +328,15 @@ void FullColorBrushTool::leftButtonDown(const TPointD &pos, m_strokeSegmentRect.empty(); m_toonz_brush->beginStroke(); m_toonz_brush->strokeTo(point, pressure, restartBrushTimer()); - TRect updateRect = m_strokeSegmentRect*ras->getBounds(); + TRect updateRect = m_strokeSegmentRect * ras->getBounds(); if (!updateRect.isEmpty()) ras->extract(updateRect)->copy(m_workRaster->extract(updateRect)); - TPointD thickOffset(m_maxCursorThick*0.5, m_maxCursorThick*0.5); + TPointD thickOffset(m_maxCursorThick * 0.5, m_maxCursorThick * 0.5); TRectD invalidateRect = convert(m_strokeSegmentRect) - rasCenter; invalidateRect += TRectD(m_brushPos - thickOffset, m_brushPos + thickOffset); - invalidateRect += TRectD(previousBrushPos - thickOffset, previousBrushPos + thickOffset); + invalidateRect += + TRectD(previousBrushPos - thickOffset, previousBrushPos + thickOffset); invalidate(invalidateRect.enlarge(2.0)); } @@ -350,21 +350,23 @@ void FullColorBrushTool::leftButtonDrag(const TPointD &pos, TRasterImageP ri = (TRasterImageP)getImage(true); if (!ri) return; - TRasterP ras = ri->getRaster(); + TRasterP ras = ri->getRaster(); TPointD rasCenter = ras->getCenterD(); TPointD point(pos + rasCenter); - double pressure = m_enabledPressure && e.isTablet() ? e.m_pressure/255.0 : 0.5; + double pressure = + m_enabledPressure && e.isTablet() ? e.m_pressure / 255.0 : 0.5; m_strokeSegmentRect.empty(); m_toonz_brush->strokeTo(point, pressure, restartBrushTimer()); - TRect updateRect = m_strokeSegmentRect*ras->getBounds(); + TRect updateRect = m_strokeSegmentRect * ras->getBounds(); if (!updateRect.isEmpty()) ras->extract(updateRect)->copy(m_workRaster->extract(updateRect)); - TPointD thickOffset(m_maxCursorThick*0.5, m_maxCursorThick*0.5); + TPointD thickOffset(m_maxCursorThick * 0.5, m_maxCursorThick * 0.5); TRectD invalidateRect = convert(m_strokeSegmentRect) - rasCenter; invalidateRect += TRectD(m_brushPos - thickOffset, m_brushPos + thickOffset); - invalidateRect += TRectD(previousBrushPos - thickOffset, previousBrushPos + thickOffset); + invalidateRect += + TRectD(previousBrushPos - thickOffset, previousBrushPos + thickOffset); invalidate(invalidateRect.enlarge(2.0)); } @@ -378,22 +380,24 @@ void FullColorBrushTool::leftButtonUp(const TPointD &pos, TRasterImageP ri = (TRasterImageP)getImage(true); if (!ri) return; - TRasterP ras = ri->getRaster(); + TRasterP ras = ri->getRaster(); TPointD rasCenter = ras->getCenterD(); TPointD point(pos + rasCenter); - double pressure = m_enabledPressure && e.isTablet() ? e.m_pressure/255.0 : 0.5; + double pressure = + m_enabledPressure && e.isTablet() ? e.m_pressure / 255.0 : 0.5; m_strokeSegmentRect.empty(); m_toonz_brush->strokeTo(point, pressure, restartBrushTimer()); m_toonz_brush->endStroke(); - TRect updateRect = m_strokeSegmentRect*ras->getBounds(); + TRect updateRect = m_strokeSegmentRect * ras->getBounds(); if (!updateRect.isEmpty()) ras->extract(updateRect)->copy(m_workRaster->extract(updateRect)); - TPointD thickOffset(m_maxCursorThick*0.5, m_maxCursorThick*0.5); + TPointD thickOffset(m_maxCursorThick * 0.5, m_maxCursorThick * 0.5); TRectD invalidateRect = convert(m_strokeSegmentRect) - rasCenter; invalidateRect += TRectD(m_brushPos - thickOffset, m_brushPos + thickOffset); - invalidateRect += TRectD(previousBrushPos - thickOffset, previousBrushPos + thickOffset); + invalidateRect += + TRectD(previousBrushPos - thickOffset, previousBrushPos + thickOffset); invalidate(invalidateRect.enlarge(2.0)); if (m_toonz_brush) { @@ -411,9 +415,9 @@ void FullColorBrushTool::leftButtonUp(const TPointD &pos, TXshSimpleLevelP simLevel = level->getSimpleLevel(); TFrameId frameId = getCurrentFid(); TRasterP subras = ras->extract(m_strokeRect)->clone(); - TUndoManager::manager()->add( - new FullColorBrushUndo(m_tileSet, simLevel.getPointer(), frameId, - m_isFrameCreated, subras, m_strokeRect.getP00())); + TUndoManager::manager()->add(new FullColorBrushUndo( + m_tileSet, simLevel.getPointer(), frameId, m_isFrameCreated, subras, + m_strokeRect.getP00())); } notifyImageChanged(); @@ -488,16 +492,16 @@ void FullColorBrushTool::draw() { if (TRasterImageP ri = TRasterImageP(getImage(false))) { TRasterP ras = ri->getRaster(); - double alpha = 1.0; + double alpha = 1.0; double alphaRadius = 3.0; - double pixelSize = sqrt(tglGetPixelSize2()); + double pixelSize = sqrt(tglGetPixelSize2()); // circles with lesser radius looks more bold // to avoid these effect we'll reduce alpha for small radiuses - double minX = m_minCursorThick/(alphaRadius*pixelSize); - double maxX = m_maxCursorThick/(alphaRadius*pixelSize); - double minAlpha = alpha*(1.0 - 1.0/(1.0 + minX)); - double maxAlpha = alpha*(1.0 - 1.0/(1.0 + maxX)); + double minX = m_minCursorThick / (alphaRadius * pixelSize); + double maxX = m_maxCursorThick / (alphaRadius * pixelSize); + double minAlpha = alpha * (1.0 - 1.0 / (1.0 + minX)); + double maxAlpha = alpha * (1.0 - 1.0 / (1.0 + maxX)); glPushAttrib(GL_ALL_ATTRIB_BITS); tglEnableBlending(); @@ -505,15 +509,15 @@ void FullColorBrushTool::draw() { if (m_minCursorThick < m_maxCursorThick - pixelSize) { glColor4d(1.0, 1.0, 1.0, minAlpha); - tglDrawCircle(m_brushPos, (m_minCursorThick + 1)*0.5 - pixelSize); + tglDrawCircle(m_brushPos, (m_minCursorThick + 1) * 0.5 - pixelSize); glColor4d(0.0, 0.0, 0.0, minAlpha); - tglDrawCircle(m_brushPos, (m_minCursorThick + 1)*0.5); + tglDrawCircle(m_brushPos, (m_minCursorThick + 1) * 0.5); } glColor4d(1.0, 1.0, 1.0, maxAlpha); - tglDrawCircle(m_brushPos, (m_maxCursorThick + 1)*0.5 - pixelSize); + tglDrawCircle(m_brushPos, (m_maxCursorThick + 1) * 0.5 - pixelSize); glColor4d(0.0, 0.0, 0.0, maxAlpha); - tglDrawCircle(m_brushPos, (m_maxCursorThick + 1)*0.5); + tglDrawCircle(m_brushPos, (m_maxCursorThick + 1) * 0.5); glPopAttrib(); } @@ -521,9 +525,7 @@ void FullColorBrushTool::draw() { //-------------------------------------------------------------------------------------------------------------- -void FullColorBrushTool::onEnter() { - updateCurrentStyle(); -} +void FullColorBrushTool::onEnter() { updateCurrentStyle(); } //---------------------------------------------------------------------------------------------------------- @@ -688,8 +690,7 @@ void FullColorBrushTool::updateCurrentStyle() { if (TTool::Application *app = getApplication()) { if (app->getCurrentObject()->isSpline()) { m_currentColor = TPixel32::Red; - } else - if (TPalette *plt = app->getCurrentPalette()->getPalette()) { + } else if (TPalette *plt = app->getCurrentPalette()->getPalette()) { int style = app->getCurrentLevelStyleIndex(); TColorStyle *colorStyle = plt->getStyle(style); m_currentColor = colorStyle->getMainColor(); @@ -701,25 +702,29 @@ void FullColorBrushTool::updateCurrentStyle() { m_enabledPressure = m_pressure.getValue(); if (TMyPaintBrushStyle *brushStyle = getBrushStyle()) { - double radiusLog = brushStyle->getBrush().getBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC) - + m_modifierSize.getValue()*log(2.0); - double radius = exp(radiusLog); - m_minCursorThick = m_maxCursorThick = (int)round(2.0*radius); + double radiusLog = brushStyle->getBrush().getBaseValue( + MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC) + + m_modifierSize.getValue() * log(2.0); + double radius = exp(radiusLog); + m_minCursorThick = m_maxCursorThick = (int)round(2.0 * radius); } else { m_minCursorThick = std::max(m_thickness.getValue().first, 1); - m_maxCursorThick = std::max(m_thickness.getValue().second, m_minCursorThick); + m_maxCursorThick = + std::max(m_thickness.getValue().second, m_minCursorThick); if (!m_enabledPressure) { - double minRadiusLog = log(0.5*m_minCursorThick); - double maxRadiusLog = log(0.5*m_maxCursorThick); - double avgRadiusLog = 0.5*(minRadiusLog + maxRadiusLog); - double avgRadius = exp(avgRadiusLog); - m_minCursorThick = m_maxCursorThick = (int)round(2.0*avgRadius); + double minRadiusLog = log(0.5 * m_minCursorThick); + double maxRadiusLog = log(0.5 * m_maxCursorThick); + double avgRadiusLog = 0.5 * (minRadiusLog + maxRadiusLog); + double avgRadius = exp(avgRadiusLog); + m_minCursorThick = m_maxCursorThick = (int)round(2.0 * avgRadius); } } - if (m_minCursorThick != prevMinCursorThick || m_maxCursorThick != prevMaxCursorThick) { - TRectD rect(m_brushPos - TPointD(m_maxCursorThick + 2, m_maxCursorThick + 2), - m_brushPos + TPointD(m_maxCursorThick + 2, m_maxCursorThick + 2)); + if (m_minCursorThick != prevMinCursorThick || + m_maxCursorThick != prevMaxCursorThick) { + TRectD rect( + m_brushPos - TPointD(m_maxCursorThick + 2, m_maxCursorThick + 2), + m_brushPos + TPointD(m_maxCursorThick + 2, m_maxCursorThick + 2)); invalidate(rect); } } @@ -727,112 +732,100 @@ void FullColorBrushTool::updateCurrentStyle() { //------------------------------------------------------------------ double FullColorBrushTool::restartBrushTimer() { - double dtime = m_brushTimer.nsecsElapsed()*1e-9; + double dtime = m_brushTimer.nsecsElapsed() * 1e-9; m_brushTimer.restart(); return dtime; } //------------------------------------------------------------------ -TMyPaintBrushStyle* FullColorBrushTool::getBrushStyle() { +TMyPaintBrushStyle *FullColorBrushTool::getBrushStyle() { if (TTool::Application *app = getApplication()) - return dynamic_cast( app->getCurrentLevelStyle() ); + return dynamic_cast(app->getCurrentLevelStyle()); return 0; } //------------------------------------------------------------------ -void FullColorBrushTool::applyClassicToonzBrushSettings(mypaint::Brush &mypaintBrush) { - const double precision = 1e-5; +void FullColorBrushTool::applyClassicToonzBrushSettings( + mypaint::Brush &mypaintBrush) { + const double precision = 1e-5; const double hardnessOpacity = 0.1; - double minThickness = 0.5*m_thickness.getValue().first; - double maxThickness = 0.5*m_thickness.getValue().second; - double minOpacity = 0.01*m_opacity.getValue().first; - double maxOpacity = 0.01*m_opacity.getValue().second; - double hardness = 0.01*m_hardness.getValue(); + double minThickness = 0.5 * m_thickness.getValue().first; + double maxThickness = 0.5 * m_thickness.getValue().second; + double minOpacity = 0.01 * m_opacity.getValue().first; + double maxOpacity = 0.01 * m_opacity.getValue().second; + double hardness = 0.01 * m_hardness.getValue(); - TPixelD color = PixelConverter::from(m_currentColor); - double colorH = 0.0; - double colorS = 0.0; - double colorV = 0.0; + TPixelD color = PixelConverter::from(m_currentColor); + double colorH = 0.0; + double colorS = 0.0; + double colorV = 0.0; RGB2HSV(color.r, color.g, color.b, &colorH, &colorS, &colorV); // avoid log(0) - if (minThickness < precision) - minThickness = precision; - if (maxThickness < precision) - maxThickness = precision; + if (minThickness < precision) minThickness = precision; + if (maxThickness < precision) maxThickness = precision; // tune hardness opacity for better visual softness hardness *= hardness; - double opacityAmplifier = 1.0 - hardnessOpacity + hardness*hardnessOpacity; + double opacityAmplifier = 1.0 - hardnessOpacity + hardness * hardnessOpacity; minOpacity *= opacityAmplifier; maxOpacity *= opacityAmplifier; // reset mypaintBrush.fromDefaults(); mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_OPAQUE_MULTIPLY, 1.0); - mypaintBrush.setMappingN( - MYPAINT_BRUSH_SETTING_OPAQUE_MULTIPLY, - MYPAINT_BRUSH_INPUT_PRESSURE, - 0 ); - - mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_HARDNESS, 0.5*hardness + 0.5); - 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); - mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_DABS_PER_ACTUAL_RADIUS, 5.0 + hardness*10.0); + mypaintBrush.setMappingN(MYPAINT_BRUSH_SETTING_OPAQUE_MULTIPLY, + MYPAINT_BRUSH_INPUT_PRESSURE, 0); + + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_HARDNESS, + 0.5 * hardness + 0.5); + 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); + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_DABS_PER_ACTUAL_RADIUS, + 5.0 + hardness * 10.0); mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_DABS_PER_BASIC_RADIUS, 0.0); mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_DABS_PER_SECOND, 0.0); // thickness may be dynamic if (minThickness + precision >= maxThickness) { - mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, log(maxThickness)); - mypaintBrush.setMappingN( - MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, - MYPAINT_BRUSH_INPUT_PRESSURE, - 0 ); + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, + log(maxThickness)); + mypaintBrush.setMappingN(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, + MYPAINT_BRUSH_INPUT_PRESSURE, 0); } else { - double minThicknessLog = log(minThickness); - double maxThicknessLog = log(maxThickness); - double baseThicknessLog = 0.5*(minThicknessLog + maxThicknessLog); - mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, baseThicknessLog); - mypaintBrush.setMappingN( - MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, - MYPAINT_BRUSH_INPUT_PRESSURE, - 2 ); - mypaintBrush.setMappingPoint( - MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, - MYPAINT_BRUSH_INPUT_PRESSURE, - 0, 0.0, minThicknessLog - baseThicknessLog); - mypaintBrush.setMappingPoint( - MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, - MYPAINT_BRUSH_INPUT_PRESSURE, - 1, 1.0, maxThicknessLog - baseThicknessLog); + double minThicknessLog = log(minThickness); + double maxThicknessLog = log(maxThickness); + double baseThicknessLog = 0.5 * (minThicknessLog + maxThicknessLog); + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, + baseThicknessLog); + mypaintBrush.setMappingN(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, + MYPAINT_BRUSH_INPUT_PRESSURE, 2); + mypaintBrush.setMappingPoint(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, + MYPAINT_BRUSH_INPUT_PRESSURE, 0, 0.0, + minThicknessLog - baseThicknessLog); + mypaintBrush.setMappingPoint(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, + MYPAINT_BRUSH_INPUT_PRESSURE, 1, 1.0, + maxThicknessLog - baseThicknessLog); } // opacity may be dynamic if (minOpacity + precision >= maxOpacity) { mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_OPAQUE, maxOpacity); - mypaintBrush.setMappingN( - MYPAINT_BRUSH_SETTING_OPAQUE, - MYPAINT_BRUSH_INPUT_PRESSURE, - 0 ); + mypaintBrush.setMappingN(MYPAINT_BRUSH_SETTING_OPAQUE, + MYPAINT_BRUSH_INPUT_PRESSURE, 0); } else { mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_OPAQUE, minOpacity); - mypaintBrush.setMappingN( - MYPAINT_BRUSH_SETTING_OPAQUE, - MYPAINT_BRUSH_INPUT_PRESSURE, - 2 ); - mypaintBrush.setMappingPoint( - MYPAINT_BRUSH_SETTING_OPAQUE, - MYPAINT_BRUSH_INPUT_PRESSURE, - 0, 0.0, 0.0); - mypaintBrush.setMappingPoint( - MYPAINT_BRUSH_SETTING_OPAQUE, - MYPAINT_BRUSH_INPUT_PRESSURE, - 1, 1.0, maxOpacity - minOpacity); + mypaintBrush.setMappingN(MYPAINT_BRUSH_SETTING_OPAQUE, + MYPAINT_BRUSH_INPUT_PRESSURE, 2); + mypaintBrush.setMappingPoint(MYPAINT_BRUSH_SETTING_OPAQUE, + MYPAINT_BRUSH_INPUT_PRESSURE, 0, 0.0, 0.0); + mypaintBrush.setMappingPoint(MYPAINT_BRUSH_SETTING_OPAQUE, + MYPAINT_BRUSH_INPUT_PRESSURE, 1, 1.0, + maxOpacity - minOpacity); } } @@ -842,27 +835,30 @@ void FullColorBrushTool::applyToonzBrushSettings(mypaint::Brush &mypaintBrush) { if (mypaintStyle) { const double precision = 1e-5; - 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(); + 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; - double colorS = 0.0; - double colorV = 0.0; + TPixelD color = PixelConverter::from(m_currentColor); + double colorH = 0.0; + double colorS = 0.0; + double colorV = 0.0; RGB2HSV(color.r, color.g, color.b, &colorH, &colorS, &colorV); mypaintBrush.fromBrush(mypaintStyle->getBrush()); - float baseSize = mypaintBrush.getBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC); + float baseSize = + mypaintBrush.getBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC); float baseOpacity = mypaintBrush.getBaseValue(MYPAINT_BRUSH_SETTING_OPAQUE); - mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, baseSize + modifierSize); - mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_OPAQUE, baseOpacity*modifierOpacity); - 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); + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC, + baseSize + modifierSize); + mypaintBrush.setBaseValue(MYPAINT_BRUSH_SETTING_OPAQUE, + baseOpacity * modifierOpacity); + 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); @@ -876,7 +872,6 @@ void FullColorBrushTool::applyToonzBrushSettings(mypaint::Brush &mypaintBrush) { } } - //========================================================================================================== FullColorBrushToolNotifier::FullColorBrushToolNotifier(FullColorBrushTool *tool) @@ -889,7 +884,7 @@ FullColorBrushToolNotifier::FullColorBrushToolNotifier(FullColorBrushTool *tool) } if (TPaletteHandle *paletteHandle = app->getCurrentPalette()) { bool ret; - ret = connect(paletteHandle, SIGNAL(colorStyleChanged()), this, + ret = connect(paletteHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(onColorStyleChanged())); assert(ret); ret = connect(paletteHandle, SIGNAL(colorStyleSwitched()), this, diff --git a/toonz/sources/tnztools/tooloptionscontrols.cpp b/toonz/sources/tnztools/tooloptionscontrols.cpp index 3cc409c..8708fbd 100644 --- a/toonz/sources/tnztools/tooloptionscontrols.cpp +++ b/toonz/sources/tnztools/tooloptionscontrols.cpp @@ -767,7 +767,7 @@ StyleIndexFieldAndChip::StyleIndexFieldAndChip(TTool *tool, setPaletteHandle(pltHandle); connect(pltHandle, SIGNAL(colorStyleSwitched()), SLOT(updateColor())); - connect(pltHandle, SIGNAL(colorStyleChanged()), SLOT(updateColor())); + connect(pltHandle, SIGNAL(colorStyleChanged(bool)), SLOT(updateColor())); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/cleanuppaletteviewer.cpp b/toonz/sources/toonz/cleanuppaletteviewer.cpp index 03b1dbe..7f095c0 100644 --- a/toonz/sources/toonz/cleanuppaletteviewer.cpp +++ b/toonz/sources/toonz/cleanuppaletteviewer.cpp @@ -87,8 +87,8 @@ CleanupPaletteViewer::CleanupPaletteViewer(QWidget *parent) bool ret = true; ret = ret && connect(m_ph, SIGNAL(paletteSwitched()), SLOT(buildGUI())); ret = ret && connect(m_ph, SIGNAL(paletteChanged()), SLOT(buildGUI())); - ret = ret && - connect(m_ph, SIGNAL(colorStyleChanged()), SLOT(onColorStyleChanged())); + ret = ret && connect(m_ph, SIGNAL(colorStyleChanged(bool)), + SLOT(onColorStyleChanged())); ret = ret && connect(m_add, SIGNAL(clicked(bool)), SLOT(onAddClicked(bool))); ret = ret && diff --git a/toonz/sources/toonz/cleanuppreview.cpp b/toonz/sources/toonz/cleanuppreview.cpp index e312d7c..0263690 100644 --- a/toonz/sources/toonz/cleanuppreview.cpp +++ b/toonz/sources/toonz/cleanuppreview.cpp @@ -98,8 +98,8 @@ void PreviewToggleCommand::enable() { TPaletteHandle *ph = TApp::instance()->getPaletteController()->getCurrentCleanupPalette(); - ret = - ret && connect(ph, SIGNAL(colorStyleChanged()), &m_timer, SLOT(start())); + ret = ret && + connect(ph, SIGNAL(colorStyleChanged(bool)), &m_timer, SLOT(start())); ret = ret && connect(ph, SIGNAL(paletteChanged()), &m_timer, SLOT(start())); assert(ret); @@ -129,8 +129,8 @@ void PreviewToggleCommand::disable() { // involve the model. TPaletteHandle *ph = TApp::instance()->getPaletteController()->getCurrentCleanupPalette(); - ret = ret && - disconnect(ph, SIGNAL(colorStyleChanged()), &m_timer, SLOT(start())); + ret = ret && disconnect(ph, SIGNAL(colorStyleChanged(bool)), &m_timer, + SLOT(start())); ret = ret && disconnect(ph, SIGNAL(paletteChanged()), &m_timer, SLOT(start())); assert(ret); diff --git a/toonz/sources/toonz/cleanupsettingsmodel.cpp b/toonz/sources/toonz/cleanupsettingsmodel.cpp index 499570a..0d6faa1 100644 --- a/toonz/sources/toonz/cleanupsettingsmodel.cpp +++ b/toonz/sources/toonz/cleanupsettingsmodel.cpp @@ -250,7 +250,7 @@ void CleanupSettingsModel::connectSignals() { SLOT(onCellChanged()), Qt::QueuedConnection); ret = ret && connect(columnHandle, SIGNAL(columnIndexSwitched()), SLOT(onCellChanged()), Qt::QueuedConnection); - ret = ret && connect(paletteHandle, SIGNAL(colorStyleChanged()), + ret = ret && connect(paletteHandle, SIGNAL(colorStyleChanged(bool)), SLOT(onPaletteChanged()), Qt::QueuedConnection); ret = ret && connect(paletteHandle, SIGNAL(paletteChanged()), SLOT(onPaletteChanged()), Qt::QueuedConnection); diff --git a/toonz/sources/toonz/colormodelviewer.cpp b/toonz/sources/toonz/colormodelviewer.cpp index e4b0085..d8e0f53 100644 --- a/toonz/sources/toonz/colormodelviewer.cpp +++ b/toonz/sources/toonz/colormodelviewer.cpp @@ -350,7 +350,7 @@ void ColorModelViewer::hideEvent(QHideEvent *e) { SLOT(showCurrentImage())); disconnect(paletteHandle, SIGNAL(paletteChanged()), this, SLOT(showCurrentImage())); - disconnect(paletteHandle, SIGNAL(colorStyleChanged()), this, + disconnect(paletteHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(showCurrentImage())); disconnect(toolHandle, SIGNAL(toolSwitched()), this, SLOT(changePickType())); @@ -370,7 +370,7 @@ void ColorModelViewer::showEvent(QShowEvent *e) { SLOT(showCurrentImage())); ret = ret && connect(paletteHandle, SIGNAL(paletteChanged()), this, SLOT(showCurrentImage())); - ret = ret && connect(paletteHandle, SIGNAL(colorStyleChanged()), this, + ret = ret && connect(paletteHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(showCurrentImage())); /*- ツールのTypeに合わせてPickのタイプも変え、カーソルも切り替える -*/ ret = ret && connect(toolHandle, SIGNAL(toolSwitched()), this, diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 94665ef..1ec1ce6 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -1096,12 +1096,7 @@ void MainWindow::onAbout() { void MainWindow::autofillToggle() { TPaletteHandle *h = TApp::instance()->getCurrentPalette(); - int index = h->getStyleIndex(); - if (index > 0) { - TColorStyle *s = h->getPalette()->getStyle(index); - s->setFlags(s->getFlags() == 0 ? 1 : 0); - h->notifyColorStyleChanged(); - } + h->toggleAutopaint(); } void MainWindow::resetRoomsLayout() { diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index 804308b..4f6f694 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -713,7 +713,7 @@ void SceneViewer::showEvent(QShowEvent *) { TPaletteHandle *paletteHandle = app->getPaletteController()->getCurrentLevelPalette(); - connect(paletteHandle, SIGNAL(colorStyleChanged()), this, SLOT(update())); + connect(paletteHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(update())); connect(app->getCurrentObject(), SIGNAL(objectSwitched()), this, SLOT(onObjectSwitched())); diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cpp index 0158dfa..f31002e 100644 --- a/toonz/sources/toonz/tpanels.cpp +++ b/toonz/sources/toonz/tpanels.cpp @@ -671,14 +671,14 @@ void ColorFieldEditorController::edit(DVGui::ColorField *colorField) { connect(m_currentColorField, SIGNAL(colorChanged(const TPixel32 &, bool)), SLOT(onColorChanged(const TPixel32 &, bool))); - connect(m_colorFieldHandle, SIGNAL(colorStyleChanged()), + connect(m_colorFieldHandle, SIGNAL(colorStyleChanged(bool)), SLOT(onColorStyleChanged())); } //----------------------------------------------------------------------------- void ColorFieldEditorController::hide() { - disconnect(m_colorFieldHandle, SIGNAL(colorStyleChanged()), this, + disconnect(m_colorFieldHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(onColorStyleChanged())); } @@ -750,14 +750,14 @@ void CleanupColorFieldEditorController::edit( TApp::instance()->getPaletteController()->setCurrentPalette( m_colorFieldHandle); - connect(m_colorFieldHandle, SIGNAL(colorStyleChanged()), + connect(m_colorFieldHandle, SIGNAL(colorStyleChanged(bool)), SLOT(onColorStyleChanged())); } //----------------------------------------------------------------------------- void CleanupColorFieldEditorController::hide() { - disconnect(m_colorFieldHandle, SIGNAL(colorStyleChanged()), this, + disconnect(m_colorFieldHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(onColorStyleChanged())); } @@ -959,9 +959,9 @@ void FlipbookPanel::initializeTitleBar(TPanelTitleBar *titleBar) { int iconWidth = 20; // safe area button TPanelTitleBarButtonForSafeArea *safeAreaButton = - new TPanelTitleBarButtonForSafeArea(titleBar, ":Resources/pane_safe_off.svg", - ":Resources/pane_safe_over.svg", - ":Resources/pane_safe_on.svg"); + new TPanelTitleBarButtonForSafeArea( + titleBar, ":Resources/pane_safe_off.svg", + ":Resources/pane_safe_over.svg", ":Resources/pane_safe_on.svg"); safeAreaButton->setToolTip("Safe Area (Right Click to Select)"); titleBar->add(QPoint(x, 0), safeAreaButton); ret = ret && connect(safeAreaButton, SIGNAL(toggled(bool)), diff --git a/toonz/sources/toonzlib/tpalettehandle.cpp b/toonz/sources/toonzlib/tpalettehandle.cpp index c3315ac..f1d5770 100644 --- a/toonz/sources/toonzlib/tpalettehandle.cpp +++ b/toonz/sources/toonzlib/tpalettehandle.cpp @@ -2,6 +2,51 @@ #include "toonz/tpalettehandle.h" +#include "tundo.h" +#include "historytypes.h" + +//============================================================================= +// AutopaintToggleUndo +//----------------------------------------------------------------------------- + +namespace { +class AutopaintToggleUndo final : public TUndo { + TPaletteHandle *m_paletteHandle; + TPaletteP m_palette; + int m_styleId; + bool m_flag; + +public: + AutopaintToggleUndo(TPaletteHandle *paletteHandle, int styleId) + : m_paletteHandle(paletteHandle) + , m_palette(paletteHandle->getPalette()) + , m_styleId(styleId) {} + + void toggleAutopaint() const { + TColorStyle *s = m_palette->getStyle(m_styleId); + s->setFlags(s->getFlags() == 0 ? 1 : 0); + m_paletteHandle->notifyColorStyleChanged(); + } + + void undo() const override { toggleAutopaint(); } + + void redo() const override { toggleAutopaint(); } + + void onAdd() { redo(); } + + int getSize() const override { return sizeof(*this); } + + QString getHistoryString() override { + return QObject::tr("Toggle Autopaint Option Palette : %1 Style#%2") + .arg(QString::fromStdWString(m_palette->getPaletteName())) + .arg(QString::number(m_styleId)); + } + + int getHistoryType() override { return HistoryType::Palette; } +}; + +} // namespace + //============================================================================= // TPaletteHandle //----------------------------------------------------------------------------- @@ -48,8 +93,8 @@ bool TPaletteHandle::connectBroadcasts(const QObject *receiver) { ret = connect(this, SIGNAL(broadcastColorStyleSwitched()), receiver, SIGNAL(colorStyleSwitched())) && ret; - ret = connect(this, SIGNAL(broadcastColorStyleChanged()), receiver, - SIGNAL(colorStyleChanged())) && + ret = connect(this, SIGNAL(broadcastColorStyleChanged(bool)), receiver, + SIGNAL(colorStyleChanged(bool))) && ret; ret = connect(this, SIGNAL(broadcastColorStyleChangedOnMouseRelease()), receiver, SIGNAL(colorStyleChangedOnMouseRelease())) && @@ -72,8 +117,8 @@ bool TPaletteHandle::disconnectBroadcasts(const QObject *receiver) { ret = disconnect(this, SIGNAL(broadcastColorStyleSwitched()), receiver, SIGNAL(colorStyleSwitched())) && ret; - ret = disconnect(this, SIGNAL(broadcastColorStyleChanged()), receiver, - SIGNAL(colorStyleChanged())) && + ret = disconnect(this, SIGNAL(broadcastColorStyleChanged(bool)), receiver, + SIGNAL(colorStyleChanged(bool))) && ret; ret = disconnect(this, SIGNAL(broadcastColorStyleChangedOnMouseRelease()), receiver, SIGNAL(colorStyleChangedOnMouseRelease())) && @@ -139,7 +184,16 @@ void TPaletteHandle::notifyColorStyleChanged(bool onDragging, if (setDirtyFlag && getPalette() && !getPalette()->getDirtyFlag()) getPalette()->setDirtyFlag(true); - emit broadcastColorStyleChanged(); + emit broadcastColorStyleChanged(onDragging); if (!onDragging) emit broadcastColorStyleChangedOnMouseRelease(); } + +//----------------------------------------------------------------------------- + +void TPaletteHandle::toggleAutopaint() { + int index = getStyleIndex(); + if (index > 0) { + TUndoManager::manager()->add(new AutopaintToggleUndo(this, index)); + } +} \ No newline at end of file diff --git a/toonz/sources/toonzqt/paletteviewer.cpp b/toonz/sources/toonzqt/paletteviewer.cpp index 17eaa33..ddb8ace 100644 --- a/toonz/sources/toonzqt/paletteviewer.cpp +++ b/toonz/sources/toonzqt/paletteviewer.cpp @@ -200,7 +200,7 @@ void PaletteViewer::setPaletteHandle(TPaletteHandle *paletteHandle) { SLOT(changeWindowTitle())); ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleSwitched()), this, SLOT(onColorStyleSwitched())); - ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleChanged()), this, + ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(changeWindowTitle())); ret = ret && connect(m_paletteHandle, SIGNAL(paletteDirtyFlagChanged()), this, SLOT(changeWindowTitle())); @@ -635,7 +635,7 @@ void PaletteViewer::showEvent(QShowEvent *) { SLOT(changeWindowTitle())); connect(m_paletteHandle, SIGNAL(colorStyleSwitched()), this, SLOT(onColorStyleSwitched())); - connect(m_paletteHandle, SIGNAL(colorStyleChanged()), this, + connect(m_paletteHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(changeWindowTitle())); connect(m_paletteHandle, SIGNAL(paletteDirtyFlagChanged()), this, SLOT(changeWindowTitle())); @@ -657,7 +657,7 @@ void PaletteViewer::hideEvent(QHideEvent *) { SLOT(changeWindowTitle())); disconnect(m_paletteHandle, SIGNAL(colorStyleSwitched()), this, SLOT(onColorStyleSwitched())); - disconnect(m_paletteHandle, SIGNAL(colorStyleChanged()), this, + disconnect(m_paletteHandle, SIGNAL(colorStyleChanged(bool)), this, SLOT(changeWindowTitle())); disconnect(m_paletteHandle, SIGNAL(paletteDirtyFlagChanged()), this, SLOT(changeWindowTitle())); diff --git a/toonz/sources/toonzqt/paletteviewergui.cpp b/toonz/sources/toonzqt/paletteviewergui.cpp index b3f01c4..7b20ad9 100644 --- a/toonz/sources/toonzqt/paletteviewergui.cpp +++ b/toonz/sources/toonzqt/paletteviewergui.cpp @@ -163,11 +163,11 @@ void PageViewer::setPaletteHandle(TPaletteHandle *paletteHandle) { if (previousPalette == paletteHandle) return; if (previousPalette) - disconnect(previousPalette, SIGNAL(colorStyleChanged()), this, + disconnect(previousPalette, SIGNAL(colorStyleChanged(bool)), this, SLOT(update())); m_styleSelection->setPaletteHandle(paletteHandle); - connect(paletteHandle, SIGNAL(colorStyleChanged()), SLOT(update())); + connect(paletteHandle, SIGNAL(colorStyleChanged(bool)), SLOT(update())); if (m_styleNameEditor) m_styleNameEditor->setPaletteHandle(paletteHandle); } @@ -1281,7 +1281,7 @@ void PageViewer::keyPressEvent(QKeyEvent *e) { void PageViewer::showEvent(QShowEvent *) { TPaletteHandle *paletteHandle = getPaletteHandle(); if (!paletteHandle) return; - connect(paletteHandle, SIGNAL(colorStyleChanged()), SLOT(update()), + connect(paletteHandle, SIGNAL(colorStyleChanged(bool)), SLOT(update()), Qt::UniqueConnection); } @@ -1290,7 +1290,8 @@ void PageViewer::showEvent(QShowEvent *) { void PageViewer::hideEvent(QHideEvent *) { TPaletteHandle *paletteHandle = getPaletteHandle(); if (!paletteHandle) return; - disconnect(paletteHandle, SIGNAL(colorStyleChanged()), this, SLOT(update())); + disconnect(paletteHandle, SIGNAL(colorStyleChanged(bool)), this, + SLOT(update())); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index 3e5f137..8950103 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -3266,13 +3266,14 @@ void StyleEditor::showEvent(QShowEvent *) { bool ret = true; ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleSwitched()), SLOT(onStyleSwitched())); - ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleChanged()), - SLOT(onStyleChanged())); + ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleChanged(bool)), + SLOT(onStyleChanged(bool))); ret = ret && connect(m_paletteHandle, SIGNAL(paletteSwitched()), this, SLOT(onStyleSwitched())); if (m_cleanupPaletteHandle) - ret = ret && connect(m_cleanupPaletteHandle, SIGNAL(colorStyleChanged()), - SLOT(onCleanupStyleChanged())); + ret = + ret && connect(m_cleanupPaletteHandle, SIGNAL(colorStyleChanged(bool)), + SLOT(onCleanupStyleChanged(bool))); ret = ret && connect(m_paletteController, SIGNAL(colorAutoApplyEnabled(bool)), this, SLOT(enableColorAutoApply(bool))); @@ -3348,7 +3349,7 @@ void StyleEditor::onStyleSwitched() { //----------------------------------------------------------------------------- -void StyleEditor::onStyleChanged() { +void StyleEditor::onStyleChanged(bool isDragging) { TPalette *palette = getPalette(); if (!palette) return; @@ -3356,10 +3357,11 @@ void StyleEditor::onStyleChanged() { assert(0 <= styleIndex && styleIndex < palette->getStyleCount()); setEditedStyleToStyle(palette->getStyle(styleIndex)); - setOldStyleToStyle( - m_editedStyle - .getPointer()); // This line is needed for proper undo behavior - + if (!isDragging) { + setOldStyleToStyle( + m_editedStyle + .getPointer()); // This line is needed for proper undo behavior + } m_plainColorPage->setColor(*m_editedStyle, getColorParam()); m_colorParameterSelector->setStyle(*m_editedStyle); m_settingsPage->setStyle(m_editedStyle); @@ -3370,10 +3372,10 @@ void StyleEditor::onStyleChanged() { //----------------------------------------------------------------------- -void StyleEditor::onCleanupStyleChanged() { +void StyleEditor::onCleanupStyleChanged(bool isDragging) { if (!m_cleanupPaletteHandle) return; - onStyleChanged(); + onStyleChanged(isDragging); } //-----------------------------------------------------------------------------