OpenToonz - An open-source full-featured 2D animation creation software
C
make color slider appearance optional hide color param bar when there is no sub colors
shun-iwasawac18bfafe9c2a
diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cppindex 98d0da473..9a8cfee39 100644--- a/toonz/sources/common/tvrender/tcolorstyles.cpp+++ b/toonz/sources/common/tvrender/tcolorstyles.cpp@@ -292,13 +292,12 @@ void TColorStyle::makeIcon(const TDimension &d) {bbox = bbox.enlarge(TDimensionD(-10, -10));checkErrorsByGL;- double scx = 0.9 * d.lx / bbox.getLx();- double scy = 0.9 * d.ly / bbox.getLy();- double sc = std::min(scx, scy);- double dx = (d.lx - bbox.getLx() * sc) * 0.5;- double dy = (d.ly - bbox.getLy() * sc) * 0.5;- TAffine aff =- TScale(scx, scy) * TTranslation(-bbox.getP00() + TPointD(dx, dy));+ double scx = 0.9 * d.lx / bbox.getLx();+ double scy = 0.9 * d.ly / bbox.getLy();+ double sc = std::min(scx, scy);+ double dx = (d.lx - bbox.getLx() * sc) * 0.5;+ double dy = (d.ly - bbox.getLy() * sc) * 0.5;+ TAffine aff = TScale(sc) * TTranslation(-bbox.getP00() + TPointD(dx, dy));checkErrorsByGL;if (isRegionStyle() && !isStrokeStyle()) aff = aff * TTranslation(-10, -10);@@ -388,7 +387,7 @@ class ColorStyleList { // singletonpublic:static ColorStyleList *instance() {static ColorStyleList *_instance = 0;- if (!_instance) _instance = new ColorStyleList();+ if (!_instance) _instance = new ColorStyleList();return _instance;}diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.hindex b661dd225..346a73837 100644--- a/toonz/sources/include/toonzqt/styleeditor.h+++ b/toonz/sources/include/toonzqt/styleeditor.h@@ -275,6 +275,7 @@ signals:*/class DVAPI ColorSlider final : public QAbstractSlider {Q_OBJECT+public:ColorSlider(Qt::Orientation orientation, QWidget *parent = 0);@@ -302,6 +303,9 @@ private:ColorModel m_color;static int s_chandle_size;static int s_chandle_tall;++public:+ static int s_slider_appearance;};//=============================================================================@@ -688,6 +692,7 @@ class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {QAction *m_alphaAction;QAction *m_rgbAction;QAction *m_hexAction;+ QActionGroup *m_sliderAppearanceAG;TColorStylePm_oldStyle; //!< A copy of current style \a before the last change.@@ -795,6 +800,9 @@ protected slots:void onCustomButtonToggled(bool on);void onVectorBrushButtonToggled(bool on);+ void onSliderAppearanceSelected(QAction *);+ void onPopupMenuAboutToShow();+private:QFrame *createBottomWidget();QFrame *createVectorPage();diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cppindex 872aa6996..a655dc487 100644--- a/toonz/sources/toonz/preferencespopup.cpp+++ b/toonz/sources/toonz/preferencespopup.cpp@@ -1179,7 +1179,8 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {{ffmpegPath, tr("FFmpeg Path:")},{ffmpegTimeout, tr("FFmpeg Timeout:")},{fastRenderPath, tr("Fast Render Path:")},- {ffmpegMultiThread, tr("Allow Multi-Thread in FFMPEG Rendering (UNSTABLE)")},+ {ffmpegMultiThread,+ tr("Allow Multi-Thread in FFMPEG Rendering (UNSTABLE)")},// Drawing{scanLevelType, tr("Scan File Format:")},diff --git a/toonz/sources/toonzlib/mypaintbrushstyle.cpp b/toonz/sources/toonzlib/mypaintbrushstyle.cppindex eecc71266..a23a084d7 100644--- a/toonz/sources/toonzlib/mypaintbrushstyle.cpp+++ b/toonz/sources/toonzlib/mypaintbrushstyle.cpp@@ -149,8 +149,8 @@ static std::string mybToVersion3(std::string origStr) {outStr += " \"inputs\": {\n";while (pipe != line.length()) {if (startPos > 0) outStr += ",\n";- startPos = pipe + 1;- pipe = line.find("|", startPos);+ startPos = pipe + 1;+ pipe = line.find("|", startPos);if (pipe == std::string::npos) pipe = line.length();settingInfo = line.substr(startPos, pipe - startPos);int firstCharPos = settingInfo.find_first_not_of(" ");@@ -161,7 +161,7 @@ static std::string mybToVersion3(std::string origStr) {baseValue = settingInfo.substr(firstCharPos, pipe - startPos);int comma = baseValue.find(", ");if (comma == std::string::npos) comma = baseValue.length();- std::string value = baseValue.substr(0, comma);+ std::string value = baseValue.substr(0, comma);std::replace(value.begin(), value.end(), '(', '[');std::replace(value.begin(), value.end(), ')', ']');std::replace(value.begin(), value.end(), ' ', ',');@@ -250,28 +250,43 @@ void TMyPaintBrushStyle::resetBaseValues() {void TMyPaintBrushStyle::makeIcon(const TDimension &d) {TFilePath path =m_fullpath.getParentDir() + (m_fullpath.getWideName() + L"_prev.png");+ TPointD offset(0, 0);if (!m_preview) {m_icon = TRaster32P(d);m_icon->fill(TPixel32::Red);} else if (m_preview->getSize() == d) {m_icon = m_preview;} else {- m_icon = TRaster32P(d);- double sx = (double)d.lx / (double)m_preview->getLx();- double sy = (double)d.ly / (double)m_preview->getLy();- TRop::resample(m_icon, m_preview, TScale(sx, sy));+ m_icon = TRaster32P(d);+ if (d.lx != d.ly) {+ TPixel32 col = getMainColor();+ if (col.m == 255)+ m_icon->fill(col);+ else {+ TRaster32P fg(d);+ fg->fill(premultiply(col));+ TRop::checkBoard(m_icon, TPixel32::Black, TPixel32::White,+ TDimensionD(6, 6), TPointD());+ TRop::over(m_icon, fg);+ }+ }+ double sx = (double)d.lx / (double)m_preview->getLx();+ double sy = (double)d.ly / (double)m_preview->getLy();+ double scale = std::min(sx, sy);+ TRop::quickPut(m_icon, m_preview, TScale(scale));}// paint color markerif (d.lx > 0 && d.ly > 0) {- int size = std::min(1 + std::min(d.lx, d.ly) * 2 / 3,+ int size = std::min(1 + std::min(d.lx, d.ly) * 2 / 3,1 + std::max(d.lx, d.ly) / 2);TPixel32 color = getMainColor();+ color.m = 255; // show full opac colorfor (int y = 0; y < size; ++y) {- TPixel32 *p = m_icon->pixels(d.ly - y - 1);- TPixel32 *endp = p + size - y - 1;+ TPixel32 *p = m_icon->pixels(d.ly - y - 1);+ TPixel32 *endp = p + size - y - 1;for (; p != endp; ++p) *p = color;- *p = blend(*p, color, 0.5);+ *p = blend(*p, color, 0.5);}}}diff --git a/toonz/sources/toonzqt/colorfield.cpp b/toonz/sources/toonzqt/colorfield.cppindex c1aaf1f91..dfb4f5335 100644--- a/toonz/sources/toonzqt/colorfield.cpp+++ b/toonz/sources/toonzqt/colorfield.cpp@@ -57,7 +57,7 @@ CommonChessboard *CommonChessboard::instance() {CommonChessboard::CommonChessboard() : m_bgRas(40.0, 40.0) { update(); }void CommonChessboard::setChessboardColors(const TPixel32 &col1,- const TPixel32 &col2) {+ const TPixel32 &col2) {TRop::checkBoard(m_bgRas, col1, col2,TDimensionD(m_bgRas->getLx() / 8, m_bgRas->getLy() / 8),TPointD(0, 0));@@ -137,14 +137,27 @@ void StyleSample::setStyle(TColorStyle &style, int colorParameterIndex) {// Store current colorTPixel32 color = style.getColorParamValue(colorParameterIndex);m_currentColor = QColor(color.r, color.g, color.b, color.m);+ if (LutManager::instance()->isValid())+ LutManager::instance()->convert(m_currentColor);/*-- TSolidColorStyleの場合のみ、単色塗りつぶし --*/if (style.getTagId() == 3) {setColor(style.getMainColor());m_stretch = true;} else {- TRaster32P icon =- style.getIcon(qsize2Dimension(m_samplePixmap.rect().size()));+ TDimension iconDim(width(), height());++ // obtain square icon for the TMyPaintBrushStyle+ // so that the checkerboard color will become consistent with solido style+ // when the main color is semi-transparent.+ if (style.getTagId() == 4001) {+ int d = std::min(width(), height());+ iconDim = TDimension(d, d);+ }++ TRaster32P icon = style.getIcon(iconDim);+ // TRaster32P icon =+ // style.getIcon(qsize2Dimension(m_samplePixmap.rect().size()));m_samplePixmap = rasterToQImage(icon, false); // modified in 6.2m_stretch = false;update();@@ -196,7 +209,9 @@ void StyleSample::paintEvent(QPaintEvent *event) {if (m_stretch) {painter.drawImage(0, 0, m_samplePixmap.scaled(size()));} else {- int x = (width() - m_samplePixmap.width()) / 2;+ // put the icon on the left+ int x = 0;+ // int x = (width() - m_samplePixmap.width()) / 2;int y = (height() - m_samplePixmap.height()) / 2;painter.fillRect(rect(), m_currentColor);painter.drawImage(x, y, m_samplePixmap);diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cppindex 3f00653ed..d6a7a3aeb 100644--- a/toonz/sources/toonzqt/styleeditor.cpp+++ b/toonz/sources/toonzqt/styleeditor.cpp@@ -59,6 +59,15 @@#include <QMenu>#include <QOpenGLFramebufferObject>+namespace {+enum ColorSliderAppearance {+ RelativeColoredTriangleHandle,+ AbsoluteColoredLineHandle+};+}+TEnv::IntVar StyleEditorColorSliderAppearance(+ "StyleEditorColorSliderAppearance", RelativeColoredTriangleHandle);+using namespace StyleEditorGUI;//*****************************************************************************@@ -140,7 +149,7 @@ bool HexLineEdit::fromText(QString text) {text.remove(space);if (text.size() == 0) return false;if (text[0] == "#") return fromHex(text);- text = text.toLower(); // table names are lowercase+ text = text.toLower(); // table names are lowercase// Find color from tables, user takes priorityQMap<QString, QString>::const_iterator it;@@ -165,19 +174,19 @@ bool HexLineEdit::fromHex(QString text) {if (!ok) return false;switch (text.length()) {- case 8: // #RRGGBBAA+ case 8: // #RRGGBBAAm_color.r = parsedValue >> 24;m_color.g = parsedValue >> 16;m_color.b = parsedValue >> 8;m_color.m = parsedValue;break;- case 6: // #RRGGBB+ case 6: // #RRGGBBm_color.r = parsedValue >> 16;m_color.g = parsedValue >> 8;m_color.b = parsedValue;m_color.m = 255;break;- case 4: // #RGBA+ case 4: // #RGBAm_color.r = (parsedValue >> 12) & 15;m_color.r |= m_color.r << 4;m_color.g = (parsedValue >> 8) & 15;@@ -187,7 +196,7 @@ bool HexLineEdit::fromHex(QString text) {m_color.m = parsedValue & 15;m_color.m |= m_color.m << 4;break;- case 3: // #RGB+ case 3: // #RGBm_color.r = (parsedValue >> 8) & 15;m_color.r |= m_color.r << 4;m_color.g = (parsedValue >> 4) & 15;@@ -196,13 +205,13 @@ bool HexLineEdit::fromHex(QString text) {m_color.b |= m_color.b << 4;m_color.m = 255;break;- case 2: // #VV (non-standard)+ case 2: // #VV (non-standard)m_color.r = parsedValue;m_color.g = m_color.r;m_color.b = m_color.r;m_color.m = 255;break;- case 1: // #V (non-standard)+ case 1: // #V (non-standard)m_color.r = parsedValue & 15;m_color.r |= m_color.r << 4;m_color.g = m_color.r;@@ -681,15 +690,29 @@ QPixmap makeLinearShading(const ShadeMaker &shadeMaker, int size,QPixmap makeLinearShading(const ColorModel &color, ColorChannel channel,int size, bool isVertical) {+ bool relative =+ ColorSlider::s_slider_appearance == RelativeColoredTriangleHandle;switch (channel) {case eRed:- return makeLinearShading(RedShadeMaker(color), size, isVertical);+ if (isVertical || relative)+ return makeLinearShading(RedShadeMaker(color), size, isVertical);+ else+ return QPixmap(":Resources/grad_r.png").scaled(size, 1);case eGreen:- return makeLinearShading(GreenShadeMaker(color), size, isVertical);+ if (isVertical || relative)+ return makeLinearShading(GreenShadeMaker(color), size, isVertical);+ else+ return QPixmap(":Resources/grad_g.png").scaled(size, 1);case eBlue:- return makeLinearShading(BlueShadeMaker(color), size, isVertical);+ if (isVertical || relative)+ return makeLinearShading(BlueShadeMaker(color), size, isVertical);+ else+ return QPixmap(":Resources/grad_b.png").scaled(size, 1);case eAlpha:- return makeLinearShading(AlphaShadeMaker(color), size, isVertical);+ if (isVertical || relative)+ return makeLinearShading(AlphaShadeMaker(color), size, isVertical);+ else+ return QPixmap(":Resources/grad_m.png").scaled(size, 1);case eHue:return makeLinearShading(HueShadeMaker(color), size, isVertical);case eSaturation:@@ -774,6 +797,13 @@ HexagonalColorWheel::~HexagonalColorWheel() {void HexagonalColorWheel::updateColorCalibration() {if (Preferences::instance()->isColorCalibrationEnabled()) {+ // prevent to initialize LutCalibrator before this instance is initialized+ // or OT may crash due to missing OpenGL context+ if (m_firstInitialized) {+ cueCalibrationUpdate();+ return;+ }+makeCurrent();if (!m_lutCalibrator)m_lutCalibrator = new LutCalibrator();@@ -1177,8 +1207,9 @@ void SquaredColorWheel::setChannel(int channel) {//*****************************************************************************// Adquire size later...-int ColorSlider::s_chandle_size = -1;-int ColorSlider::s_chandle_tall = -1;+int ColorSlider::s_chandle_size = -1;+int ColorSlider::s_chandle_tall = -1;+int ColorSlider::s_slider_appearance = -1;ColorSlider::ColorSlider(Qt::Orientation orientation, QWidget *parent): QAbstractSlider(parent), m_channel(eRed), m_color() {@@ -1193,9 +1224,10 @@ ColorSlider::ColorSlider(Qt::Orientation orientation, QWidget *parent)// Get color handle size onceif (s_chandle_size == -1) {- QImage chandle = QImage(":Resources/h_chandle_arrow.svg");- s_chandle_size = chandle.width();- s_chandle_tall = chandle.height();+ QImage chandle = QImage(":Resources/h_chandle_arrow.svg");+ s_chandle_size = chandle.width();+ s_chandle_tall = chandle.height();+ s_slider_appearance = StyleEditorColorSliderAppearance;}// Attenzione: necessario per poter individuare l'oggetto nel file di@@ -1226,6 +1258,8 @@ void ColorSlider::paintEvent(QPaintEvent *event) {int h = height();bool isVertical = orientation() == Qt::Vertical;+ bool isLineHandle =+ ColorSlider::s_slider_appearance == AbsoluteColoredLineHandle;if (isVertical) {y += s_chandle_size / 2;@@ -1235,13 +1269,18 @@ void ColorSlider::paintEvent(QPaintEvent *event) {x += s_chandle_size / 2;w -= s_chandle_size;h -= 3;+ if (isLineHandle) {+ y += 1;+ h -= 2;+ }}QPixmap bgPixmap =makeLinearShading(m_color, m_channel, isVertical ? h : w, isVertical);if (m_channel == eAlpha) {- p.drawTiledPixmap(x, y, w, h, DVGui::CommonChessboard::instance()->getPixmap());+ p.drawTiledPixmap(x, y, w, h,+ DVGui::CommonChessboard::instance()->getPixmap());}if (!bgPixmap.isNull()) {@@ -1253,13 +1292,27 @@ void ColorSlider::paintEvent(QPaintEvent *event) {In this case we draw "manually" the slider handle at correct position*/if (isVertical) {- static QPixmap vHandlePixmap = svgToPixmap(":Resources/v_chandle_arrow.svg");+ static QPixmap vHandlePixmap =+ svgToPixmap(":Resources/v_chandle_arrow.svg");int pos = QStyle::sliderPositionFromValue(0, maximum(), value(), h, true);p.drawPixmap(width() - s_chandle_tall, pos, vHandlePixmap);} else {- static QPixmap hHandlePixmap = svgToPixmap(":Resources/h_chandle_arrow.svg");int pos = QStyle::sliderPositionFromValue(0, maximum(), value(), w, false);- p.drawPixmap(pos, height() - s_chandle_tall, hHandlePixmap);+ if (isLineHandle) {+ static QPixmap hHandleUpPm(":Resources/h_chandleUp.png");+ static QPixmap hHandleDownPm(":Resources/h_chandleDown.png");+ static QPixmap hHandleCenterPm(":Resources/h_chandleCenter.png");+ int linePos = pos + (s_chandle_size - hHandleCenterPm.width()) / 2;+ p.drawPixmap(linePos, 0, hHandleUpPm);+ p.drawPixmap(linePos, height() - hHandleDownPm.height(), hHandleDownPm);+ p.drawPixmap(linePos, hHandleUpPm.height(), hHandleCenterPm.width(),+ height() - hHandleUpPm.height() - hHandleDownPm.height(),+ hHandleCenterPm);+ } else {+ static QPixmap hHandlePixmap =+ svgToPixmap(":Resources/h_chandle_arrow.svg");+ p.drawPixmap(pos, height() - s_chandle_tall, hHandlePixmap);+ }}};@@ -1657,6 +1710,7 @@ void ColorParameterSelector::setStyle(const TColorStyle &style) {clear();return;}+ show();if (m_colors.size() != count) {m_index = 0;m_colors.resize(count);@@ -1674,7 +1728,11 @@ void ColorParameterSelector::setStyle(const TColorStyle &style) {void ColorParameterSelector::clear() {if (m_colors.size() != 0) m_colors.clear();m_index = 0;- update();+ if (isVisible()) {+ hide();+ update();+ qApp->processEvents();+ }}//-----------------------------------------------------------------------------@@ -3196,54 +3254,6 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)m_styleChooser->setFocusPolicy(Qt::NoFocus);QFrame *bottomWidget = createBottomWidget();-- m_toolBar = new QToolBar(this);- m_toolBar->setMovable(false);- m_toolBar->setMaximumHeight(22);- m_toolBar->addWidget(m_colorParameterSelector);-- QMenu *menu = new QMenu();- m_wheelAction = new QAction(tr("Wheel"), this);- m_hsvAction = new QAction(tr("HSV"), this);- m_alphaAction = new QAction(tr("Alpha"), this);- m_rgbAction = new QAction(tr("RGB"), this);- m_hexAction = new QAction(tr("Hex"), this);-- m_wheelAction->setCheckable(true);- m_hsvAction->setCheckable(true);- m_alphaAction->setCheckable(true);- m_rgbAction->setCheckable(true);- m_hexAction->setCheckable(true);- m_wheelAction->setChecked(true);- m_hsvAction->setChecked(true);- m_alphaAction->setChecked(true);- m_rgbAction->setChecked(true);- m_hexAction->setChecked(false);- menu->addAction(m_wheelAction);- menu->addAction(m_hsvAction);- menu->addAction(m_alphaAction);- menu->addAction(m_rgbAction);- menu->addAction(m_hexAction);-- QToolButton *toolButton = new QToolButton(this);- toolButton->setIcon(createQIcon("menu"));- toolButton->setFixedSize(22, 22);- toolButton->setMenu(menu);- toolButton->setPopupMode(QToolButton::InstantPopup);- toolButton->setToolTip(tr("Show or hide parts of the Color Page."));- QToolBar *displayToolbar = new QToolBar(this);- m_toggleOrientationAction =- displayToolbar->addAction(createQIcon("orientation_h"), "");- m_toggleOrientationAction->setToolTip(- tr("Toggle orientation of the Color Page."));- QWidget *toggleOrientationButton =- displayToolbar->widgetForAction(m_toggleOrientationAction);- toggleOrientationButton->setFixedSize(22, 22);- toggleOrientationButton->setFocusPolicy(Qt::NoFocus);- displayToolbar->addWidget(toolButton);- displayToolbar->setMaximumHeight(22);- displayToolbar->setIconSize(QSize(16, 16));-/* ------- layout ------- */QGridLayout *mainLayout = new QGridLayout;mainLayout->setMargin(0);@@ -3261,8 +3271,8 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)mainLayout->addWidget(m_tabBarContainer, 0, 0, 1, 2);mainLayout->addWidget(m_styleChooser, 1, 0, 1, 2);mainLayout->addWidget(bottomWidget, 2, 0, 1, 2);- mainLayout->addWidget(m_toolBar, 3, 0);- mainLayout->addWidget(displayToolbar, 3, 1);+ // mainLayout->addWidget(m_toolBar, 3, 0);+ // mainLayout->addWidget(displayToolbar, 3, 1);}mainLayout->setColumnStretch(0, 1);mainLayout->setRowStretch(1, 1);@@ -3295,23 +3305,6 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)ret = ret && connect(m_plainColorPage,SIGNAL(colorChanged(const ColorModel &, bool)), this,SLOT(onColorChanged(const ColorModel &, bool)));-- ret = ret && connect(m_wheelAction, SIGNAL(toggled(bool)),- m_plainColorPage->m_wheelFrame, SLOT(setVisible(bool)));- ret = ret && connect(m_hsvAction, SIGNAL(toggled(bool)),- m_plainColorPage->m_hsvFrame, SLOT(setVisible(bool)));- ret = ret && connect(m_alphaAction, SIGNAL(toggled(bool)),- m_plainColorPage->m_alphaFrame, SLOT(setVisible(bool)));- ret = ret && connect(m_rgbAction, SIGNAL(toggled(bool)),- m_plainColorPage->m_rgbFrame, SLOT(setVisible(bool)));- ret = ret && connect(m_hexAction, SIGNAL(toggled(bool)), m_hexLineEdit,- SLOT(setVisible(bool)));- ret = ret && connect(m_hexLineEdit, SIGNAL(editingFinished()), this,- SLOT(onHexChanged()));- ret = ret && connect(m_toggleOrientationAction, SIGNAL(triggered()),- m_plainColorPage, SLOT(toggleOrientation()));- ret = ret && connect(m_toggleOrientationAction, SIGNAL(triggered()), this,- SLOT(updateOrientationButton()));assert(ret);/* ------- initial conditions ------- */enable(false, false, false);@@ -3344,6 +3337,7 @@ QFrame *StyleEditor::createBottomWidget() {bottomWidget->setFrameStyle(QFrame::StyledPanel);bottomWidget->setObjectName("bottomWidget");bottomWidget->setContentsMargins(0, 0, 0, 0);+ bottomWidget->setMinimumHeight(60);m_applyButton->setToolTip(tr("Apply changes to current style"));m_applyButton->setDisabled(m_paletteController->isColorAutoApplyEnabled());m_applyButton->setFocusPolicy(Qt::NoFocus);@@ -3369,31 +3363,107 @@ QFrame *StyleEditor::createBottomWidget() {m_hexLineEdit->loadDefaultColorNames(false);m_hexLineEdit->loadUserColorNames(false);+ m_toolBar = new QToolBar(this);+ m_toolBar->setMovable(false);+ m_toolBar->setMaximumHeight(22);+ QMenu *menu = new QMenu();+ m_wheelAction = new QAction(tr("Wheel"), this);+ m_hsvAction = new QAction(tr("HSV"), this);+ m_alphaAction = new QAction(tr("Alpha"), this);+ m_rgbAction = new QAction(tr("RGB"), this);+ m_hexAction = new QAction(tr("Hex"), this);++ m_wheelAction->setCheckable(true);+ m_hsvAction->setCheckable(true);+ m_alphaAction->setCheckable(true);+ m_rgbAction->setCheckable(true);+ m_hexAction->setCheckable(true);+ m_wheelAction->setChecked(true);+ m_hsvAction->setChecked(true);+ m_alphaAction->setChecked(true);+ m_rgbAction->setChecked(true);+ m_hexAction->setChecked(false);+ menu->addAction(m_wheelAction);+ menu->addAction(m_hsvAction);+ menu->addAction(m_alphaAction);+ menu->addAction(m_rgbAction);+ menu->addAction(m_hexAction);++ m_sliderAppearanceAG = new QActionGroup(this);+ QAction *relColorAct =+ new QAction(tr("Relative colored + Triangle handle"), this);+ QAction *absColorAct =+ new QAction(tr("Absolute colored + Line handle"), this);+ relColorAct->setData(RelativeColoredTriangleHandle);+ absColorAct->setData(AbsoluteColoredLineHandle);+ relColorAct->setCheckable(true);+ absColorAct->setCheckable(true);+ if (StyleEditorColorSliderAppearance == RelativeColoredTriangleHandle)+ relColorAct->setChecked(true);+ else+ absColorAct->setChecked(true);+ m_sliderAppearanceAG->addAction(relColorAct);+ m_sliderAppearanceAG->addAction(absColorAct);+ m_sliderAppearanceAG->setExclusive(true);+ menu->addSeparator();+ QMenu *appearanceSubMenu = menu->addMenu(tr("Slider Appearance"));+ appearanceSubMenu->addAction(relColorAct);+ appearanceSubMenu->addAction(absColorAct);++ QToolButton *toolButton = new QToolButton(this);+ toolButton->setIcon(createQIcon("menu"));+ toolButton->setFixedSize(22, 22);+ toolButton->setMenu(menu);+ toolButton->setPopupMode(QToolButton::InstantPopup);+ toolButton->setToolTip(tr("Show or hide parts of the Color Page."));+ // QToolBar* displayToolbar = new QToolBar(this);+ m_toggleOrientationAction =+ m_toolBar->addAction(createQIcon("orientation_h"), "");+ m_toggleOrientationAction->setToolTip(+ tr("Toggle orientation of the Color Page."));+ QWidget *toggleOrientationButton =+ m_toolBar->widgetForAction(m_toggleOrientationAction);+ toggleOrientationButton->setFixedSize(22, 22);+ toggleOrientationButton->setFocusPolicy(Qt::NoFocus);+ m_toolBar->addWidget(toolButton);+ m_toolBar->setMaximumHeight(22);+ m_toolBar->setIconSize(QSize(16, 16));/* ------ layout ------ */- QVBoxLayout *mainLayout = new QVBoxLayout;+ QHBoxLayout *mainLayout = new QHBoxLayout;mainLayout->setMargin(2);- mainLayout->setSpacing(1);+ mainLayout->setSpacing(0);{- QHBoxLayout *hLayout = new QHBoxLayout;- hLayout->setMargin(0);- hLayout->setSpacing(0);+ mainLayout->addWidget(m_autoButton);+ mainLayout->addSpacing(4);+ mainLayout->addWidget(m_applyButton);+ mainLayout->addSpacing(4);++ QVBoxLayout *colorLay = new QVBoxLayout();+ colorLay->setMargin(0);+ colorLay->setSpacing(2);{- hLayout->addWidget(m_autoButton);- hLayout->addSpacing(2);- hLayout->addWidget(m_applyButton);- hLayout->addSpacing(2);- hLayout->addWidget(m_newColor, 1);- hLayout->addWidget(m_oldColor, 1);- hLayout->addSpacing(2);- hLayout->addWidget(m_hexLineEdit);+ QHBoxLayout *chipLay = new QHBoxLayout();+ chipLay->setMargin(0);+ chipLay->setSpacing(0);+ {+ chipLay->addWidget(m_newColor, 1);+ chipLay->addWidget(m_oldColor, 1);+ }+ colorLay->addLayout(chipLay, 1);++ colorLay->addWidget(m_colorParameterSelector, 0);}- mainLayout->addLayout(hLayout);+ mainLayout->addLayout(colorLay, 1);+ mainLayout->addSpacing(4);- // QHBoxLayout *buttonsLayout = new QHBoxLayout;- // buttonsLayout->setMargin(0);- // buttonsLayout->setSpacing(5);- //{ buttonsLayout->addWidget(m_applyButton); }- // mainLayout->addLayout(buttonsLayout);+ QVBoxLayout *hexLay = new QVBoxLayout();+ hexLay->setMargin(0);+ hexLay->setSpacing(2);+ {+ hexLay->addWidget(m_hexLineEdit);+ hexLay->addWidget(m_toolBar, 0, Qt::AlignBottom | Qt::AlignRight);+ }+ mainLayout->addLayout(hexLay, 0);}bottomWidget->setLayout(mainLayout);@@ -3403,10 +3473,30 @@ QFrame *StyleEditor::createBottomWidget() {SLOT(applyButtonClicked()));ret = ret && connect(m_autoButton, SIGNAL(toggled(bool)), this,SLOT(autoCheckChanged(bool)));- ret = ret && connect(m_oldColor, SIGNAL(clicked()), this,- SLOT(onOldStyleClicked()));- ret = ret && connect(m_newColor, SIGNAL(clicked()), this,- SLOT(onNewStyleClicked()));+ ret = ret &&+ connect(m_oldColor, SIGNAL(clicked()), this, SLOT(onOldStyleClicked()));+ ret = ret &&+ connect(m_newColor, SIGNAL(clicked()), this, SLOT(onNewStyleClicked()));+ ret = ret && connect(m_wheelAction, SIGNAL(toggled(bool)),+ m_plainColorPage->m_wheelFrame, SLOT(setVisible(bool)));+ ret = ret && connect(m_hsvAction, SIGNAL(toggled(bool)),+ m_plainColorPage->m_hsvFrame, SLOT(setVisible(bool)));+ ret = ret && connect(m_alphaAction, SIGNAL(toggled(bool)),+ m_plainColorPage->m_alphaFrame, SLOT(setVisible(bool)));+ ret = ret && connect(m_rgbAction, SIGNAL(toggled(bool)),+ m_plainColorPage->m_rgbFrame, SLOT(setVisible(bool)));+ ret = ret && connect(m_hexAction, SIGNAL(toggled(bool)), m_hexLineEdit,+ SLOT(setVisible(bool)));+ ret = ret && connect(m_hexLineEdit, SIGNAL(editingFinished()), this,+ SLOT(onHexChanged()));+ ret = ret && connect(m_toggleOrientationAction, SIGNAL(triggered()),+ m_plainColorPage, SLOT(toggleOrientation()));+ ret = ret && connect(m_toggleOrientationAction, SIGNAL(triggered()), this,+ SLOT(updateOrientationButton()));+ ret = ret && connect(m_sliderAppearanceAG, SIGNAL(triggered(QAction *)), this,+ SLOT(onSliderAppearanceSelected(QAction *)));+ ret = ret && connect(menu, SIGNAL(aboutToShow()), this,+ SLOT(onPopupMenuAboutToShow()));assert(ret);return bottomWidget;@@ -3787,9 +3877,7 @@ void StyleEditor::onOldStyleClicked() {//------------------------------------------------------------------------------void StyleEditor::onNewStyleClicked() {- applyButtonClicked();-}+void StyleEditor::onNewStyleClicked() { applyButtonClicked(); }//-----------------------------------------------------------------------------@@ -3931,9 +4019,9 @@ void StyleEditor::selectStyle(const TColorStyle &newStyle) {}// Update editor widgets+ m_colorParameterSelector->setStyle(*m_editedStyle);m_newColor->setStyle(*m_editedStyle, getColorParam());m_plainColorPage->setColor(*m_editedStyle, getColorParam());- m_colorParameterSelector->setStyle(*m_editedStyle);m_settingsPage->setStyle(m_editedStyle);m_hexLineEdit->setStyle(*m_editedStyle, getColorParam());}@@ -3947,15 +4035,17 @@ void StyleEditor::onColorParamChanged() {int styleIndex = getStyleIndex();if (styleIndex < 0 || palette->getStyleCount() <= styleIndex) return;+ if (*m_oldStyle != *m_editedStyle) applyButtonClicked();+m_paletteHandle->setStyleParamIndex(getColorParam());if (TColorStyle *currentStyle = palette->getStyle(styleIndex)) {setEditedStyleToStyle(currentStyle);+ m_colorParameterSelector->setStyle(*m_editedStyle);m_newColor->setStyle(*m_editedStyle, getColorParam());m_oldColor->setStyle(*m_editedStyle, getColorParam());m_plainColorPage->setColor(*m_editedStyle, getColorParam());- m_colorParameterSelector->setStyle(*m_editedStyle);m_settingsPage->setStyle(m_editedStyle);m_hexLineEdit->setStyle(*m_editedStyle, getColorParam());}@@ -3972,7 +4062,7 @@ void StyleEditor::onParamStyleChanged(bool isDragging) {if (m_autoButton->isChecked()) copyEditedStyleToPalette(isDragging);- m_editedStyle->invalidateIcon(); // Refresh the new color icon+ m_editedStyle->invalidateIcon(); // Refresh the new color iconm_newColor->setStyle(*m_editedStyle, getColorParam());m_hexLineEdit->setStyle(*m_editedStyle, getColorParam());}@@ -4066,3 +4156,27 @@ void StyleEditor::load(QSettings &settings) {void StyleEditor::updateColorCalibration() {m_plainColorPage->updateColorCalibration();}++//-----------------------------------------------------------------------------++void StyleEditor::onSliderAppearanceSelected(QAction *action) {+ bool ok = true;+ int appearanceId = action->data().toInt(&ok);+ if (!ok) return;+ if (appearanceId == StyleEditorColorSliderAppearance) return;+ StyleEditorColorSliderAppearance = appearanceId;+ ColorSlider::s_slider_appearance = appearanceId;+ m_plainColorPage->update();+}++//-----------------------------------------------------------------------------++void StyleEditor::onPopupMenuAboutToShow() {+ // sync radio button state to the current user env settings+ for (auto action : m_sliderAppearanceAG->actions()) {+ bool ok = true;+ int appearanceId = action->data().toInt(&ok);+ if (ok && appearanceId == StyleEditorColorSliderAppearance)+ action->setChecked(true);+ }+}\ No newline at end of filediff --git a/toonz/sources/toonzqt/toonzqt.qrc b/toonz/sources/toonzqt/toonzqt.qrcindex 20066b8cf..66ab744f7 100644--- a/toonz/sources/toonzqt/toonzqt.qrc+++ b/toonz/sources/toonzqt/toonzqt.qrc@@ -26,6 +26,9 @@<file>Resources/grad_g.png</file><file>Resources/grad_b.png</file><file>Resources/grad_m.png</file>+ <file>Resources/h_chandleDown.png</file>+ <file>Resources/h_chandleCenter.png</file>+ <file>Resources/h_chandleUp.png</file><file>Resources/h_chandle_arrow.svg</file><file>Resources/v_chandle_arrow.svg</file><file>Resources/schematic_palette.png</file>