void State::_setColorForPen(int pen, int color, int tileIdx) { Q_ASSERT(pen >=0 && pen < PEN_MAX); Q_ASSERT(color >=0 && color < 16); bool foregroundAndPerTile = (pen == PEN_FOREGROUND && _foregroundColorMode == FOREGROUND_COLOR_PER_TILE); Q_ASSERT((tileIdx != -1 || !foregroundAndPerTile) && "Invalid Tile index"); int currentColor = foregroundAndPerTile ? _tileColors[tileIdx] : _penColors[pen]; if (currentColor != color) { bool oldvalue = shouldBeDisplayedInMulticolor2(tileIdx); if (foregroundAndPerTile) _tileColors[tileIdx] = color; else _penColors[pen] = color; bool newvalue = shouldBeDisplayedInMulticolor2(tileIdx); emit colorPropertiesUpdated(pen); if (oldvalue != newvalue) emit multicolorModeToggled(newvalue); emit contentsChanged(); } }
void State::refresh() { emit charsetUpdated(); emit charIndexUpdated(_charIndex); emit tileIndexUpdated(_tileIndex); emit tilePropertiesUpdated(); emit multicolorModeToggled(shouldBeDisplayedInMulticolor()); emit colorPropertiesUpdated(_selectedPen); }
void State::_setMulticolorMode(bool enabled) { if (_multicolorMode != enabled) { _multicolorMode = enabled; emit multicolorModeToggled(enabled); emit contentsChanged(); } }
void State::_setColorForPen(int pen, int color) { Q_ASSERT(pen >=0 && pen < PEN_MAX); Q_ASSERT(color >=0 && color < 16); if (_penColors[pen] != color) { bool oldvalue = shouldBeDisplayedInMulticolor(); _penColors[pen] = color; bool newvalue = shouldBeDisplayedInMulticolor(); emit colorPropertiesUpdated(pen); if (oldvalue != newvalue) emit multicolorModeToggled(newvalue); emit contentsChanged(); } }