void LayerHeaderPanel::mouseReleaseEvent(QMouseEvent *event) { TApp *app = TApp::instance(); TXsheet *xsh = m_viewer->getXsheet(); int col, totcols = xsh->getColumnCount(); bool sound_changed = false; if (m_doOnRelease != 0 && totcols > 0) { for (col = 0; col < totcols; col++) { if (!xsh->isColumnEmpty(col)) { TXshColumn *column = xsh->getColumn(col); if (m_doOnRelease == ToggleAllPreviewVisible) { column->setPreviewVisible(!column->isPreviewVisible()); } else if (m_doOnRelease == ToggleAllTransparency) { column->setCamstandVisible(!column->isCamstandVisible()); if (column->getSoundColumn()) sound_changed = true; } else if (m_doOnRelease == ToggleAllLock) { column->lock(!column->isLocked()); } } } if (sound_changed) { app->getCurrentXsheet()->notifyXsheetSoundChanged(); } app->getCurrentScene()->notifySceneChanged(); app->getCurrentXsheet()->notifyXsheetChanged(); } m_viewer->updateColumnArea(); update(); m_doOnRelease = 0; }
void TApp::updateXshLevel() { TXshLevel *xl = 0; if (m_currentFrame->isEditingScene()) { int frame = m_currentFrame->getFrame(); int column = m_currentColumn->getColumnIndex(); TXsheet *xsheet = m_currentXsheet->getXsheet(); if (xsheet && column >= 0 && frame >= 0 && !xsheet->isColumnEmpty(column)) { TXshCell cell = xsheet->getCell(frame, column); xl = cell.m_level.getPointer(); // Se sono su una cella vuota successiva a celle di un certo livello // prendo questo come livello corrente. if (!xl && frame > 0) { TXshCell cell = xsheet->getCell(frame - 1, column); xl = cell.m_level.getPointer(); } } m_currentLevel->setLevel(xl); // level could be the same, but palette could have changed if (xl && xl->getSimpleLevel()) { TPalette *currentPalette = m_paletteController->getCurrentPalette()->getPalette(); int styleIndex = m_paletteController->getCurrentLevelPalette()->getStyleIndex(); m_paletteController->getCurrentLevelPalette()->setPalette( xl->getSimpleLevel()->getPalette(), styleIndex); // Se il nuovo livello selezionato e' un ovl, // la paletta corrente e' una cleanup palette // => setto come handle corrente quello della paletta di cleanup. if (xl->getType() == OVL_XSHLEVEL && currentPalette && currentPalette->isCleanupPalette()) m_paletteController->editCleanupPalette(); } else if (xl && xl->getPaletteLevel()) { int styleIndex = m_paletteController->getCurrentLevelPalette()->getStyleIndex(); m_paletteController->getCurrentLevelPalette()->setPalette( xl->getPaletteLevel()->getPalette(), styleIndex); } else m_paletteController->getCurrentLevelPalette()->setPalette(0); } }
void execute() override { TColumnSelection *selection = dynamic_cast<TColumnSelection *>( TApp::instance()->getCurrentSelection()->getSelection()); TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); int cc = TApp::instance()->getCurrentColumn()->getColumnIndex(); bool sound_changed = false; TTool *tool = TApp::instance()->getCurrentTool()->getTool(); TTool::Viewer *viewer = tool ? tool->getViewer() : nullptr; bool viewer_changed = false; for (int i = 0; i < xsh->getColumnCount(); i++) { /*- 空のカラムの場合は飛ばす -*/ if (xsh->isColumnEmpty(i)) continue; /*- カラムが取得できなかったら飛ばす -*/ TXshColumn *column = xsh->getColumn(i); if (!column) continue; /*- ターゲットが選択カラムのモードで、選択されていなかった場合は飛ばす -*/ bool isSelected = selection && selection->isColumnSelected(i); if (m_target == TARGET_SELECTED && !isSelected) continue; /*- * ターゲットが「カレントカラムより右側」のモードで、iがカレントカラムより左の場合は飛ばす * -*/ if (m_target == TARGET_UPPER && i < cc) continue; bool negate = m_target == TARGET_CURRENT && cc != i || m_target == TARGET_OTHER && cc == i || m_target == TARGET_UPPER && cc == i; int cmd = m_cmd; if (cmd & (CMD_LOCK | CMD_UNLOCK | CMD_TOGGLE_LOCK)) { if (cmd & CMD_LOCK) column->lock(!negate); else if (cmd & CMD_UNLOCK) column->lock(negate); else column->lock(!column->isLocked()); viewer_changed = true; } if (cmd & (CMD_ENABLE_PREVIEW | CMD_DISABLE_PREVIEW | CMD_TOGGLE_PREVIEW)) { if (cmd & CMD_ENABLE_PREVIEW) column->setPreviewVisible(!negate); else if (cmd & CMD_DISABLE_PREVIEW) column->setPreviewVisible(negate); else column->setPreviewVisible(!column->isPreviewVisible()); } if (cmd & (CMD_ENABLE_CAMSTAND | CMD_DISABLE_CAMSTAND | CMD_TOGGLE_CAMSTAND)) { if (cmd & CMD_ENABLE_CAMSTAND) column->setCamstandVisible(!negate); else if (cmd & CMD_DISABLE_CAMSTAND) column->setCamstandVisible(negate); else column->setCamstandVisible(!column->isCamstandVisible()); if (column->getSoundColumn()) sound_changed = true; viewer_changed = true; } /*TAB if(cmd & (CMD_ENABLE_PREVIEW|CMD_DISABLE_PREVIEW|CMD_TOGGLE_PREVIEW)) { //In Tab preview e cameraStand vanno settati entrambi if(cmd&CMD_ENABLE_PREVIEW) { column->setPreviewVisible(!negate); column->setCamstandVisible(!negate); } else if(cmd&CMD_DISABLE_PREVIEW) { column->setPreviewVisible(negate); column->setCamstandVisible(negate); } else { column->setPreviewVisible(!column->isPreviewVisible()); column->setCamstandVisible(!column->isCamstandVisible()); } } */ } if (sound_changed) TApp::instance()->getCurrentXsheet()->notifyXsheetSoundChanged(); TApp::instance()->getCurrentXsheet()->notifyXsheetChanged(); TApp::instance()->getCurrentScene()->setDirtyFlag(true); if (viewer && viewer_changed) viewer->invalidateToolStatus(); }
void SceneViewerContextMenu::addLevelCommands(std::vector<int> &indices) { addSeparator(); TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); TStageObjectId currentId = TApp::instance()->getCurrentObject()->getObjectId(); /*- Xsheet内の、空でないColumnを登録 -*/ std::vector<TXshColumn *> columns; for (int i = 0; i < (int)indices.size(); i++) { if (xsh->isColumnEmpty(indices[i])) continue; TXshColumn *column = xsh->getColumn(indices[i]); if (column) { columns.push_back(column); } } if (!columns.empty()) { // show/hide if (columns.size() > 1) { QMenu *subMenu = addMenu("Show / Hide"); for (int i = 0; i < (int)columns.size(); i++) addShowHideCommand(subMenu, columns[i]); } else addShowHideCommand(this, columns[0]); addSeparator(); } // selection /* if(selectableColumns.size()==1) { addSelectCommand(this, TStageObjectId::ColumnId(selectableColumns[0]->getIndex())); } else */ /*-- Scene内の全Objectを選択可能にする --*/ TStageObjectId id; QMenu *cameraMenu = addMenu(tr("Select Camera")); QMenu *pegbarMenu = addMenu(tr("Select Pegbar")); QMenu *columnMenu = addMenu(tr("Select Column")); bool flag = false; for (int i = 0; i < xsh->getStageObjectTree()->getStageObjectCount(); i++) { id = xsh->getStageObjectTree()->getStageObject(i)->getId(); if (id.isColumn()) { int columnIndex = id.getIndex(); if (xsh->isColumnEmpty(columnIndex)) continue; else { addSelectCommand(columnMenu, id); flag = true; } } else if (id.isTable()) addSelectCommand(this, id); else if (id.isCamera()) addSelectCommand(cameraMenu, id); else if (id.isPegbar()) addSelectCommand(pegbarMenu, id); } /*- カラムがひとつも無かったらDisable -*/ if (!flag) columnMenu->setEnabled(false); }