void setCurrentColor(const TPixel32 &color) { PaletteController *controller = TTool::getApplication()->getPaletteController(); TPaletteHandle *ph = controller->getCurrentPalette(); TColorStyle *cs = ph->getStyle(); if (!cs) return; if (controller->isColorAutoApplyEnabled()) { TCleanupStyle *ccs = dynamic_cast<TCleanupStyle *>(cs); if (ccs) ccs->setCanUpdate(true); int index = ph->getStyleParamIndex(); if (0 <= index && index < cs->getColorParamCount()) cs->setColorParamValue(index, color); else cs->setMainColor(color); cs->invalidateIcon(); ph->notifyColorStyleChanged(); // per le palette animate int styleIndex = ph->getStyleIndex(); TPalette *palette = ph->getPalette(); if (palette && palette->isKeyframe(styleIndex, palette->getFrame())) palette->setKeyframe(styleIndex, palette->getFrame()); if (ccs) ccs->setCanUpdate(false); } else controller->setColorSample(color); }
void setColor(const TPixel32 &color) const { PaletteController *controller = TTool::getApplication()->getPaletteController(); if (m_colorAutoApplyEnabled) { TColorStyle *cs = m_palette->getStyle(m_styleId); if (0 <= m_styleParamIndex && m_styleParamIndex < cs->getColorParamCount()) cs->setColorParamValue(m_styleParamIndex, color); else cs->setMainColor(color); cs->invalidateIcon(); controller->getCurrentPalette()->notifyColorStyleChanged(); updateLevel(); } else { controller->setColorSample(color); } }