void TApp::onFrameSwitched() { updateXshLevel(); int row = m_currentFrame->getFrameIndex(); TCellSelection *sel = dynamic_cast<TCellSelection *>(TSelection::getCurrent()); if (sel && !sel->isRowSelected(row)) { sel->selectNone(); } }
void PaletteViewerPanel::onCurrentButtonToggled(bool isCurrent) { if (isActive() == isCurrent) return; TApp *app = TApp::instance(); TPaletteHandle *ph = app->getPaletteController()->getCurrentLevelPalette(); // Se sono sulla palette del livello corrente e le palette e' vuota non // consento di bloccare il pannello. if (isActive() && !ph->getPalette()) { m_isCurrentButton->setPressed(true); return; } setActive(isCurrent); m_paletteViewer->enableSaveAction(isCurrent); // Cambio il livello corrente if (isCurrent) { std::set<TXshSimpleLevel *> levels; TXsheet *xsheet = app->getCurrentXsheet()->getXsheet(); int row, column; findPaletteLevels(levels, row, column, m_paletteHandle->getPalette(), xsheet); // Se non trovo livelli riferiti alla palette setto il palette viewer alla // palette del livello corrente. if (levels.empty()) { m_paletteViewer->setPaletteHandle(ph); update(); return; } TXshSimpleLevel *level = *levels.begin(); // Se sto editando l'xsheet devo settare come corrente anche la colonna e il // frame. if (app->getCurrentFrame()->isEditingScene()) { int currentColumn = app->getCurrentColumn()->getColumnIndex(); if (currentColumn != column) app->getCurrentColumn()->setColumnIndex(column); int currentRow = app->getCurrentFrame()->getFrameIndex(); TXshCell cell = xsheet->getCell(currentRow, column); if (cell.isEmpty() || cell.getSimpleLevel() != level) app->getCurrentFrame()->setFrameIndex(row); TCellSelection *selection = dynamic_cast<TCellSelection *>( app->getCurrentSelection()->getSelection()); if (selection) selection->selectNone(); } app->getCurrentLevel()->setLevel(level); m_paletteViewer->setPaletteHandle(ph); } else { m_paletteHandle->setPalette(ph->getPalette()); m_paletteViewer->setPaletteHandle(m_paletteHandle); } update(); }