FxParamEditorPopup::FxParamEditorPopup() : QDialog(TApp::instance()->getMainWindow()) { setWindowTitle(tr("Fx Settings")); setMinimumSize(20, 20); TApp *app = TApp::instance(); TSceneHandle *hScene = app->getCurrentScene(); TPixel32 col1, col2; Preferences::instance()->getChessboardColors(col1, col2); FxSettings *fxSettings = new FxSettings(this, col1, col2); fxSettings->setSceneHandle(hScene); fxSettings->setFxHandle(app->getCurrentFx()); fxSettings->setFrameHandle(app->getCurrentFrame()); fxSettings->setXsheetHandle(app->getCurrentXsheet()); fxSettings->setLevelHandle(app->getCurrentLevel()); fxSettings->setObjectHandle(app->getCurrentObject()); fxSettings->setCurrentFx(); QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->setMargin(0); mainLayout->setSpacing(10); { mainLayout->addWidget(fxSettings); } setLayout(mainLayout); move(parentWidget()->geometry().center() - rect().bottomRight() / 2.0); }
void SceneViewer::enterEvent(QEvent *) { if (m_isMouseEntered) return; m_isMouseEntered = true; TApp *app = TApp::instance(); modifiers = 0; TTool *tool = app->getCurrentTool()->getTool(); TXshLevel *level = app->getCurrentLevel()->getLevel(); if (level && level->getSimpleLevel()) m_dpiScale = getCurrentDpiScale(level->getSimpleLevel(), tool->getCurrentFid()); else m_dpiScale = TPointD(1, 1); if (m_freezedStatus != NO_FREEZED) return; invalidateToolStatus(); if (tool && tool->isEnabled()) { tool->setViewer(this); tool->updateMatrix(); tool->onEnter(); } setFocus(); updateGL(); }
void FilmstripFrames::showEvent(QShowEvent *) { TApp *app = TApp::instance(); // cambiamenti al livello TXshLevelHandle *levelHandle = app->getCurrentLevel(); connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onLevelSwitched(TXshLevel *))); connect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(onLevelChanged())); connect(levelHandle, SIGNAL(xshLevelViewChanged()), this, SLOT(onLevelChanged())); // al frame corrente connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); connect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(update())); // iconcine connect(IconGenerator::instance(), SIGNAL(iconGenerated()), this, SLOT(update())); // onion skin connect(app->getCurrentOnionSkin(), SIGNAL(onionSkinMaskChanged()), this, SLOT(update())); // enable navigator link with the Viewer in the InknPaint page ComboViewerPanel *inknPaintViewerPanel = app->getInknPaintViewerPanel(); if (inknPaintViewerPanel) { SceneViewer *viewer = inknPaintViewerPanel->getSceneViewer(); if (viewer) { connect(viewer, SIGNAL(onZoomChanged()), this, SLOT(update())); connect(viewer, SIGNAL(refreshNavi()), this, SLOT(update())); } } }
PaletteViewerPanel::PaletteViewerPanel(QWidget *parent) : TPanel(parent) { m_paletteHandle = new TPaletteHandle(); connect(m_paletteHandle, SIGNAL(colorStyleSwitched()), SLOT(onColorStyleSwitched())); connect(m_paletteHandle, SIGNAL(paletteSwitched()), SLOT(onPaletteSwitched())); TApp *app = TApp::instance(); m_paletteViewer = new PaletteViewer(this, PaletteViewerGUI::LEVEL_PALETTE); m_paletteViewer->setPaletteHandle( app->getPaletteController()->getCurrentLevelPalette()); m_paletteViewer->setFrameHandle(app->getCurrentFrame()); m_paletteViewer->setXsheetHandle(app->getCurrentXsheet()); // for clearing cache when paste style command called from the StyleSelection m_paletteViewer->setLevelHandle(app->getCurrentLevel()); TSceneHandle *sceneHandle = app->getCurrentScene(); connect(sceneHandle, SIGNAL(sceneSwitched()), SLOT(onSceneSwitched())); CurrentStyleChangeCommand *currentStyleChangeCommand = new CurrentStyleChangeCommand(); m_paletteViewer->setChangeStyleCommand(currentStyleChangeCommand); setWidget(m_paletteViewer); initializeTitleBar(); }
void SchematicScenePanel::showEvent(QShowEvent *e) { if (m_schematicViewer->isStageSchematicViewed()) setWindowTitle("Stage Schematic"); else setWindowTitle("Fx Schematic"); TApp *app = TApp::instance(); connect(m_schematicViewer, SIGNAL(showPreview(TFxP)), this, SLOT(onShowPreview(TFxP))); connect(m_schematicViewer, SIGNAL(doCollapse(const QList<TFxP> &)), this, SLOT(onCollapse(const QList<TFxP> &))); connect(m_schematicViewer, SIGNAL(doCollapse(QList<TStageObjectId>)), this, SLOT(onCollapse(QList<TStageObjectId>))); connect(m_schematicViewer, SIGNAL(doExplodeChild(const QList<TFxP> &)), this, SLOT(onExplodeChild(const QList<TFxP> &))); connect(m_schematicViewer, SIGNAL(doExplodeChild(QList<TStageObjectId>)), this, SLOT(onExplodeChild(QList<TStageObjectId>))); connect(m_schematicViewer, SIGNAL(editObject()), this, SLOT(onEditObject())); connect(app->getCurrentLevel(), SIGNAL(xshLevelChanged()), m_schematicViewer, SLOT(updateScenes())); connect(app->getCurrentObject(), SIGNAL(objectSwitched()), m_schematicViewer, SLOT(updateScenes())); connect(app->getCurrentXsheet(), SIGNAL(xsheetSwitched()), m_schematicViewer, SLOT(updateSchematic())); connect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()), m_schematicViewer, SLOT(updateSchematic())); connect(app->getCurrentScene(), SIGNAL(sceneSwitched()), m_schematicViewer, SLOT(onSceneSwitched())); m_schematicViewer->updateSchematic(); }
void SchematicScenePanel::hideEvent(QHideEvent *e) { TApp *app = TApp::instance(); disconnect(m_schematicViewer, SIGNAL(showPreview(TFxP)), this, SLOT(onShowPreview(TFxP))); disconnect(m_schematicViewer, SIGNAL(doCollapse(const QList<TFxP> &)), this, SLOT(onCollapse(const QList<TFxP> &))); disconnect(m_schematicViewer, SIGNAL(doCollapse(QList<TStageObjectId>)), this, SLOT(onCollapse(QList<TStageObjectId>))); disconnect(m_schematicViewer, SIGNAL(doExplodeChild(const QList<TFxP> &)), this, SLOT(onExplodeChild(const QList<TFxP> &))); disconnect(m_schematicViewer, SIGNAL(doExplodeChild(QList<TStageObjectId>)), this, SLOT(onExplodeChild(QList<TStageObjectId>))); disconnect(m_schematicViewer, SIGNAL(editObject()), this, SLOT(onEditObject())); disconnect(app->getCurrentLevel(), SIGNAL(xshLevelChanged()), m_schematicViewer, SLOT(updateScenes())); disconnect(app->getCurrentObject(), SIGNAL(objectSwitched()), m_schematicViewer, SLOT(updateScenes())); disconnect(app->getCurrentXsheet(), SIGNAL(xsheetSwitched()), m_schematicViewer, SLOT(updateSchematic())); disconnect(app->getCurrentXsheet(), SIGNAL(xsheetChanged()), m_schematicViewer, SLOT(updateSchematic())); disconnect(app->getCurrentScene(), SIGNAL(sceneSwitched()), m_schematicViewer, SLOT(onSceneSwitched())); }
void FilmstripFrames::hideEvent(QHideEvent *) { TApp *app = TApp::instance(); // cambiamenti al livello disconnect(app->getCurrentLevel()); // al frame corrente disconnect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); disconnect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(update())); // iconcine disconnect(IconGenerator::instance(), SIGNAL(iconGenerated()), this, SLOT(update())); // onion skin disconnect(app->getCurrentOnionSkin(), SIGNAL(onionSkinMaskChanged()), this, SLOT(update())); ComboViewerPanel *inknPaintViewerPanel = app->getInknPaintViewerPanel(); if (inknPaintViewerPanel) { SceneViewer *viewer = inknPaintViewerPanel->getSceneViewer(); if (viewer) { disconnect(viewer, SIGNAL(onZoomChanged()), this, SLOT(update())); disconnect(viewer, SIGNAL(refreshNavi()), this, SLOT(update())); } } }
void Filmstrip::hideEvent(QHideEvent *) { TApp *app = TApp::instance(); TXshLevelHandle *levelHandle = app->getCurrentLevel(); disconnect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onLevelSwitched(TXshLevel *))); disconnect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(onLevelChanged())); disconnect(TApp::instance()->getPaletteController()->getCurrentLevelPalette(), SIGNAL(colorStyleChangedOnMouseRelease()), this, SLOT(onLevelChanged())); disconnect(levelHandle, SIGNAL(xshLevelTitleChanged()), this, SLOT(onLevelChanged())); disconnect(m_frameArea->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onSliderMoved(int))); TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene(); disconnect(sceneHandle, SIGNAL(sceneSwitched()), this, SLOT(updateChooseLevelComboItems())); disconnect(sceneHandle, SIGNAL(castChanged()), this, SLOT(updateChooseLevelComboItems())); disconnect(TApp::instance()->getCurrentXsheet(), SIGNAL(xsheetChanged()), this, SLOT(updateChooseLevelComboItems())); disconnect(TApp::instance()->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); }
void BinarizePopup::hideEvent(QHideEvent *e) { TApp *app = TApp::instance(); bool ret = true; ret = ret && disconnect(app->getCurrentFrame(), 0, this, 0); ret = ret && disconnect(app->getCurrentColumn(), 0, this, 0); ret = ret && disconnect(app->getCurrentLevel(), 0, this, 0); assert(ret); }
void ComboViewerPanel::hideEvent(QHideEvent *) { TApp *app = TApp::instance(); disconnect(app->getCurrentScene()); disconnect(app->getCurrentLevel()); disconnect(app->getCurrentFrame()); disconnect(app->getCurrentObject()); disconnect(app->getCurrentXsheet()); disconnect(app->getCurrentTool()); m_flipConsole->setActive(false); }
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(); }
/*! switch the current level when the current index of m_chooseLevelCombo is * changed */ void Filmstrip::onChooseLevelComboChanged(int index) { TApp *tapp = TApp::instance(); // empty level if (index == m_chooseLevelCombo->findText(tr("- No Current Level -"))) tapp->getCurrentLevel()->setLevel(0); else { std::vector<TFrameId> fids; m_levels[index]->getFids(fids); tapp->getCurrentFrame()->setFrameIds(fids); // retrieve to the current working frame of the level TFrameId WF; std::map<TXshSimpleLevel *, TFrameId>::iterator WFit; WFit = m_workingFrames.find(m_levels[index]); if (WFit != m_workingFrames.end()) WF = WFit->second; else WF = fids[0]; // this function emits xshLevelSwitched() signal and eventually calls // FlipConsole::UpdateRange // it may move the current frame so we need to keep the current frameId // before calling setLevel. tapp->getCurrentLevel()->setLevel(m_levels[index]); if (tapp->getCurrentSelection()->getSelection()) tapp->getCurrentSelection()->getSelection()->selectNone(); // move to the current working frame tapp->getCurrentFrame()->setFid(WF); QApplication::setOverrideCursor(Qt::WaitCursor); invalidateIcons(m_levels[index], fids); QApplication::restoreOverrideCursor(); } }
void ComboViewerPanel::hideEvent(QHideEvent *event) { StyleShortcutSwitchablePanel::hideEvent(event); TApp *app = TApp::instance(); disconnect(app->getCurrentFrame(), 0, this, 0); disconnect(app->getCurrentScene(), 0, this, 0); disconnect(app->getCurrentLevel(), 0, this, 0); disconnect(app->getCurrentObject(), 0, this, 0); disconnect(app->getCurrentXsheet(), 0, this, 0); disconnect(app->getCurrentTool(), SIGNAL(toolSwitched()), m_sceneViewer, SLOT(onToolSwitched())); m_flipConsole->setActive(false); }
StudioPaletteViewerPanel::StudioPaletteViewerPanel(QWidget *parent) : TPanel(parent) { m_studioPaletteHandle = new TPaletteHandle(); connect(m_studioPaletteHandle, SIGNAL(colorStyleSwitched()), SLOT(onColorStyleSwitched())); connect(m_studioPaletteHandle, SIGNAL(paletteSwitched()), SLOT(onPaletteSwitched())); connect(m_studioPaletteHandle, SIGNAL(paletteLockChanged()), SLOT(onPaletteSwitched())); TApp *app = TApp::instance(); m_studioPaletteViewer = new StudioPaletteViewer( this, m_studioPaletteHandle, app->getPaletteController()->getCurrentLevelPalette(), app->getCurrentFrame(), app->getCurrentXsheet(), app->getCurrentLevel()); setWidget(m_studioPaletteViewer); }
void BinarizePopup::showEvent(QShowEvent *e) { TApp *app = TApp::instance(); TPixel32 col1, col2; Preferences::instance()->getChessboardColors(col1, col2); m_viewer->setBgColor(col1, col2); bool ret = true; ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(fetchSample())); ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(fetchSample())); ret = ret && connect(app->getCurrentColumn(), SIGNAL(columnIndexSwitched()), this, SLOT(fetchSample())); ret = ret && connect(app->getCurrentLevel(), SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onLevelSwitched(TXshLevel *))); ret = ret && connect(app->getCurrentLevel(), SIGNAL(xshLevelChanged()), this, SLOT(fetchSample())); assert(ret); m_previewChk->setChecked(false); fetchSample(); }
void AntialiasPopup::setCurrentSampleRaster() { TRasterP sampleRas; m_startRas = TRasterP(); TSelection *selection = TApp::instance()->getCurrentSelection()->getSelection(); TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(selection); TFilmstripSelection *filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection); TImageP image; if (cellSelection) { TApp *app = TApp::instance(); TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrameIndex(), app->getCurrentColumn()->getColumnIndex()); TImageP aux = cell.getImage(true); if (aux) image = aux->cloneImage(); } else if (filmstripSelection) { TApp *app = TApp::instance(); TXshSimpleLevel *simpleLevel = app->getCurrentLevel()->getSimpleLevel(); if (simpleLevel) { TImageP imageAux = simpleLevel->getFrame(app->getCurrentFrame()->getFid(), true); if (imageAux) image = imageAux->cloneImage(); } } if (!image || !(sampleRas = image->raster())) { m_viewer->setImage(TImageP()); m_viewer->update(); m_okBtn->setEnabled(false); return; } m_okBtn->setEnabled(true); m_startRas = sampleRas->clone(); onChange(m_startRas, sampleRas, m_thresholdField->getValue(), m_softnessField->getValue()); m_viewer->setImage(image); m_viewer->update(); }
void BinarizePopup::fetchSample() { TApp *app = TApp::instance(); TImageP img; if (app->getCurrentFrame()->isEditingLevel()) { TXshLevel *xshLevel = app->getCurrentLevel()->getLevel(); if (xshLevel && xshLevel->getSimpleLevel()) { TXshSimpleLevel *sl = xshLevel->getSimpleLevel(); img = sl->getFrame(app->getCurrentFrame()->getFid(), false); } } else { TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrame(), app->getCurrentColumn()->getColumnIndex()); img = cell.getImage(false); } TRasterImageP ri = img; if (ri) { setSample(ri->getRaster()); } else { setSample(TRasterP()); } }
void AdjustLevelsPopup::acquireRaster() { //Retrieve current selection TApp *app = TApp::instance(); TSelection *selection = app->getCurrentSelection()->getSelection(); TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(selection); TFilmstripSelection *filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection); //Retrieve the input raster m_inputRas = TRasterP(); if (cellSelection) { TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrameIndex(), app->getCurrentColumn()->getColumnIndex()); TRasterImageP rasImage = cell.getImage(true); if (rasImage && rasImage->getRaster()) m_inputRas = rasImage->getRaster(); } else if (filmstripSelection) { TXshSimpleLevel *simpleLevel = app->getCurrentLevel()->getSimpleLevel(); if (simpleLevel) { TRasterImageP rasImage = (TRasterImageP)simpleLevel->getFrame(app->getCurrentFrame()->getFid(), true); if (rasImage && rasImage->getRaster()) m_inputRas = rasImage->getRaster(); } } if (m_inputRas) { m_threshold = m_inputRas->getLx() * m_inputRas->getLy() * m_thresholdD; m_okBtn->setEnabled(true); } else { m_inputRas = TRasterP(); m_okBtn->setEnabled(false); } //Build histograms m_histogram->setRaster(m_inputRas); //Update the corresponding processed image in the viewer updateProcessedImage(); }
void BrightnessAndContrastPopup::setCurrentSampleRaster() { TRasterP sampleRas; m_startRas = TRasterP(); TSelection *selection = TApp::instance()->getCurrentSelection()->getSelection(); TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(selection); TFilmstripSelection *filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection); if (cellSelection) { TApp *app = TApp::instance(); TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrameIndex(), app->getCurrentColumn()->getColumnIndex()); TRasterImageP rasImage = cell.getImage(true); if (rasImage && rasImage->getRaster()) sampleRas = rasImage->getRaster()->clone(); } else if (filmstripSelection) { TApp *app = TApp::instance(); TXshSimpleLevel *simpleLevel = app->getCurrentLevel()->getSimpleLevel(); if (simpleLevel) { TRasterImageP rasImage = (TRasterImageP)simpleLevel->getFrame(app->getCurrentFrame()->getFid(), true); if (rasImage && rasImage->getRaster()) sampleRas = rasImage->getRaster()->clone(); } } if (!sampleRas) { m_viewer->raster() = TRasterP(); m_viewer->update(); m_okBtn->setEnabled(false); return; } m_okBtn->setEnabled(true); m_startRas = sampleRas->clone(); onChange(m_startRas, sampleRas, m_contrastField->getValue(), m_brightnessField->getValue()); m_viewer->raster() = sampleRas; m_viewer->update(); }
void Filmstrip::showEvent(QShowEvent *) { TApp *app = TApp::instance(); TXshLevelHandle *levelHandle = app->getCurrentLevel(); bool ret = connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), SLOT(onLevelSwitched(TXshLevel *))); ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), SLOT(onLevelChanged())); // updateWindowTitle is called in the onLevelChanged ret = ret && connect(app->getPaletteController()->getCurrentLevelPalette(), SIGNAL(colorStyleChangedOnMouseRelease()), SLOT(onLevelChanged())); ret = ret && connect(levelHandle, SIGNAL(xshLevelTitleChanged()), SLOT(onLevelChanged())); ret = ret && connect(m_frameArea->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onSliderMoved(int))); TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene(); ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this, SLOT(updateChooseLevelComboItems())); ret = ret && connect(sceneHandle, SIGNAL(castChanged()), this, SLOT(updateChooseLevelComboItems())); ret = ret && connect(TApp::instance()->getCurrentXsheet(), SIGNAL(xsheetChanged()), this, SLOT(updateChooseLevelComboItems())); ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); assert(ret); updateChooseLevelComboItems(); onFrameSwitched(); onLevelSwitched(0); }
void ComboViewerPanel::changeWindowTitle() { TApp *app = TApp::instance(); ToonzScene *scene = app->getCurrentScene()->getScene(); if (!scene) return; int frame = app->getCurrentFrame()->getFrame(); // put the titlebar texts in this string QString name; // if the frame type is "scene editing" if (app->getCurrentFrame()->isEditingScene()) { QString sceneName = QString::fromStdWString(scene->getSceneName()); if (sceneName.isEmpty()) sceneName = tr("Untitled"); if (app->getCurrentScene()->getDirtyFlag()) sceneName += QString(" *"); name = tr("Scene: ") + sceneName; if (frame >= 0) name = name + tr(" :: Frame: ") + tr(std::to_string(frame + 1).c_str()); int col = app->getCurrentColumn()->getColumnIndex(); if (col < 0) { setWindowTitle(name); return; } TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(frame, col); if (cell.isEmpty()) { setWindowTitle(name); return; } assert(cell.m_level.getPointer()); TFilePath fp(cell.m_level->getName()); QString imageName = QString::fromStdWString(fp.withFrame(cell.m_frameId).getWideString()); name = name + tr(" :: Level: ") + imageName; if (m_sceneViewer->isPreviewEnabled()) { name = name + " :: Zoom : " + QString::number((int)(100.0 * sqrt(m_sceneViewer->getViewMatrix().det()) * m_sceneViewer->getDpiFactor())) + "%"; } // If the current level exists and some option is set in the preference, // set the zoom value to the current level's dpi else if (Preferences::instance() ->isActualPixelViewOnSceneEditingModeEnabled() && TApp::instance()->getCurrentLevel()->getSimpleLevel() && !CleanupPreviewCheck::instance() ->isEnabled() // cleanup preview must be OFF && !CameraTestCheck::instance() ->isEnabled()) // camera test mode must be OFF neither { name = name + " :: Zoom : " + QString::number((int)(100.0 * sqrt(m_sceneViewer->getViewMatrix().det()) * m_sceneViewer->getDpiFactor())) + "%"; } } // if the frame type is "level editing" else { TXshLevel *level = app->getCurrentLevel()->getLevel(); if (level) { TFilePath fp(level->getName()); QString imageName = QString::fromStdWString( fp.withFrame(app->getCurrentFrame()->getFid()).getWideString()); name = name + tr("Level: ") + imageName; name = name + " :: Zoom : " + QString::number((int)(100.0 * sqrt(m_sceneViewer->getViewMatrix().det()) * m_sceneViewer->getDpiFactor())) + "%"; } } setWindowTitle(name); }
void ComboViewerPanel::showEvent(QShowEvent *) { TApp *app = TApp::instance(); TFrameHandle *frameHandle = app->getCurrentFrame(); TSceneHandle *sceneHandle = app->getCurrentScene(); TXshLevelHandle *levelHandle = app->getCurrentLevel(); TObjectHandle *objectHandle = app->getCurrentObject(); TXsheetHandle *xshHandle = app->getCurrentXsheet(); bool ret = true; /*! onSceneChanged(): called when the scene changed - set new scene's FPS - update the range of frame slider with a new framehandle - set the marker - update key frames */ ret = connect(xshHandle, SIGNAL(xsheetChanged()), this, SLOT(onSceneChanged())); ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this, SLOT(onSceneChanged())); ret = ret && connect(sceneHandle, SIGNAL(sceneChanged()), this, SLOT(onSceneChanged())); /*! changeWindowTitle(): called when the scene / level / frame is changed - chenge the title text */ ret = ret && connect(sceneHandle, SIGNAL(nameSceneChanged()), this, SLOT(changeWindowTitle())); ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(changeWindowTitle())); ret = ret && connect(frameHandle, SIGNAL(frameSwitched()), this, SLOT(changeWindowTitle())); // onXshLevelSwitched(TXshLevel*): changeWindowTitle() + updateFrameRange() ret = ret && connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onXshLevelSwitched(TXshLevel *))); // updateFrameRange(): update the frame slider's range ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(updateFrameRange())); // onFrameTypeChanged(): reset the marker positions in the flip console ret = ret && connect(frameHandle, SIGNAL(frameTypeChanged()), this, SLOT(onFrameTypeChanged())); // onFrameChanged(): update the flipconsole according to the current frame ret = ret && connect(frameHandle, SIGNAL(frameSwitched()), this, SLOT(onFrameChanged())); ret = ret && connect(app->getCurrentTool(), SIGNAL(toolSwitched()), m_sceneViewer, SLOT(onToolSwitched())); ret = ret && connect(sceneHandle, SIGNAL(preferenceChanged()), m_flipConsole, SLOT(onPreferenceChanged())); m_flipConsole->onPreferenceChanged(); assert(ret); m_flipConsole->setActive(true); // refresh onSceneChanged(); changeWindowTitle(); }
void FilmstripFrames::mousePressEvent(QMouseEvent *event) { m_selecting = false; int index = y2index(event->pos().y()); TFrameId fid = index2fid(index); TXshSimpleLevel *sl = getLevel(); int i0 = y2index(0); int frameHeight = m_iconSize.height() + fs_frameSpacing + fs_iconMarginTop + fs_iconMarginBottom; QPoint clickedPos = event->pos() - QPoint(0, (index - i0) * frameHeight); if (event->button() == Qt::LeftButton) { if (fid == TFrameId()) return; ComboViewerPanel *inknPaintViewerPanel = TApp::instance()->getInknPaintViewerPanel(); // navigator pan if (fid == TApp::instance()->getCurrentFrame()->getFid() && sl->getType() == TZP_XSHLEVEL && inknPaintViewerPanel && inknPaintViewerPanel->isVisible() && QRect(QPoint(fs_leftMargin + fs_iconMarginLR, fs_frameSpacing / 2 + fs_iconMarginTop) //<- top-left position of the icon , m_iconSize) .contains(clickedPos)) { m_isNavigatorPanning = true; execNavigatorPan(event->pos()); QApplication::setOverrideCursor(Qt::ClosedHandCursor); } else m_isNavigatorPanning = false; if (event->modifiers() & Qt::ShiftModifier) { select(index, SHIFT_SELECT); if (m_selection->isSelected(fid)) { // click su di un frame gia' selezionato. Puo' essere l'inizio di un // drag'n'drop m_dragDropArmed = true; m_pos = event->pos(); } } else if (event->modifiers() & Qt::ControlModifier) select(index, CTRL_SELECT); // inbetween else if (sl->getType() == PLI_XSHLEVEL && m_selection->isInInbetweenRange(fid) && event->pos().x() > width() - 20 - fs_rightMargin) { inbetween(); } else { // move current frame when clicked without modifier TApp *tapp = TApp::instance(); std::vector<TFrameId> fids; TXshLevel *level = tapp->getCurrentLevel()->getLevel(); level->getFids(fids); tapp->getCurrentFrame()->setFrameIds(fids); tapp->getCurrentFrame()->setFid(fid); if (!m_selection->isSelected(fid)) // selezione semplice { // click su un frame non selezionato m_selecting = true; // posso estendere la selezione con il drag select(index, START_DRAG_SELECT); } else if (m_selection->isSelected(fid)) { // click su di un frame gia' selezionato. Puo' essere l'inizio di un // drag'n'drop m_dragDropArmed = true; m_pos = event->pos(); } } update(); } else if (event->button() == Qt::MidButton) { m_pos = event->globalPos(); return; } else if (event->button() == Qt::RightButton) { select(index); } }
/*! Update popup value. Take current level and act on level type set popup value. */ void LevelSettingsPopup::updateLevelSettings() { TApp *app = TApp::instance(); TXshLevelP selectedLevel; CastSelection *castSelection = dynamic_cast<CastSelection *>(app->getCurrentSelection()->getSelection()); TCellSelection *cellSelection = dynamic_cast<TCellSelection *>( app->getCurrentSelection()->getSelection()); TColumnSelection *columnSelection = dynamic_cast<TColumnSelection *>( app->getCurrentSelection()->getSelection()); FxSelection *fxSelection = dynamic_cast<FxSelection *>(app->getCurrentSelection()->getSelection()); /*--セル選択の場合--*/ if (cellSelection) { TXsheet *currentXsheet = app->getCurrentXsheet()->getXsheet(); if (currentXsheet && !cellSelection->isEmpty()) { selectedLevel = 0; int r0, c0, r1, c1; cellSelection->getSelectedCells(r0, c0, r1, c1); for (int c = c0; c <= c1; c++) { for (int r = r0; r <= r1; r++) { if (currentXsheet->getCell(r, c).m_level) { selectedLevel = currentXsheet->getCell(r, c).m_level; break; } } if (selectedLevel) break; } } else selectedLevel = app->getCurrentLevel()->getLevel(); } /*--カラム選択の場合--*/ else if (columnSelection) { TXsheet *currentXsheet = app->getCurrentXsheet()->getXsheet(); if (currentXsheet && !columnSelection->isEmpty()) { selectedLevel = 0; int sceneLength = currentXsheet->getFrameCount(); std::set<int> columnIndices = columnSelection->getIndices(); std::set<int>::iterator it; /*-- 選択Columnを探索、最初に見つかったLevelの内容を表示 --*/ for (it = columnIndices.begin(); it != columnIndices.end(); ++it) { int columnIndex = *it; for (int r = 0; r < sceneLength; r++) { if (currentXsheet->getCell(r, columnIndex).m_level) { selectedLevel = currentXsheet->getCell(r, columnIndex).m_level; break; } } if (selectedLevel) break; } } else selectedLevel = app->getCurrentLevel()->getLevel(); } else if (castSelection) { std::vector<TXshLevel *> levels; castSelection->getSelectedLevels(levels); int selectedLevelSize = levels.size(); if (selectedLevelSize > 0) selectedLevel = levels[selectedLevelSize - 1]; } /*-- Fx選択(Schematicノード選択)の場合 --*/ else if (fxSelection) { selectedLevel = 0; TXsheet *currentXsheet = app->getCurrentXsheet()->getXsheet(); QList<TFxP> selectedFxs = fxSelection->getFxs(); if (currentXsheet && !selectedFxs.isEmpty()) { for (int f = 0; f < selectedFxs.size(); f++) { TLevelColumnFx *lcfx = dynamic_cast<TLevelColumnFx *>(selectedFxs.at(f).getPointer()); if (lcfx) { int firstRow = lcfx->getXshColumn()->getCellColumn()->getFirstRow(); TXshLevelP levelP = lcfx->getXshColumn()->getCellColumn()->getCell(firstRow).m_level; if (levelP) { selectedLevel = levelP; break; } } } if (!selectedLevel) selectedLevel = app->getCurrentLevel()->getLevel(); } else selectedLevel = app->getCurrentLevel()->getLevel(); // std::cout<<"fxSelection is current!"<<std::endl; } else selectedLevel = app->getCurrentLevel()->getLevel(); m_sl = dynamic_cast<TXshSimpleLevel *>(selectedLevel.getPointer()); m_pl = dynamic_cast<TXshPaletteLevel *>(selectedLevel.getPointer()); m_cl = dynamic_cast<TXshChildLevel *>(selectedLevel.getPointer()); m_sdl = dynamic_cast<TXshSoundLevel *>(selectedLevel.getPointer()); bool isSimpleLevel = m_sl; bool isChildLevel = m_cl; bool isRasterLevel = m_sl && (m_sl->getType() & RASTER_TYPE); bool isTzpLevel = m_sl && (m_sl->getType() == TZP_XSHLEVEL); bool isMeshLevel = m_sl && (m_sl->getType() == MESH_XSHLEVEL); bool hasDpiEditing = (isRasterLevel || isMeshLevel); // name if (selectedLevel) { m_nameFld->setText(::to_string(selectedLevel->getName()).c_str()); m_nameFld->setEnabled(true); } else { m_nameFld->setText(tr("")); m_nameFld->setEnabled(false); } // path if (m_sl) { m_pathFld->setPath(toQString(m_sl->getPath())); if (m_scanPathFld) m_scanPathFld->setPath(toQString(m_sl->getScannedPath())); } else if (m_pl) { m_pathFld->setPath(toQString(m_pl->getPath())); if (m_scanPathFld) m_scanPathFld->setPath(tr("")); } else if (m_sdl) { m_pathFld->setPath(toQString(m_sdl->getPath())); if (m_scanPathFld) m_scanPathFld->setPath(tr("")); } else { m_pathFld->setPath(tr("")); if (m_scanPathFld) m_scanPathFld->setPath(tr("")); } // leveltype QString levelTypeString = QString(tr("")); if (m_sl) { switch (m_sl->getType()) { case TZI_XSHLEVEL: levelTypeString = tr("Scan level"); break; case PLI_XSHLEVEL: levelTypeString = tr("Toonz Vector level"); break; case TZP_XSHLEVEL: levelTypeString = tr("Toonz Raster level"); break; case OVL_XSHLEVEL: levelTypeString = tr("Raster level"); break; case MESH_XSHLEVEL: levelTypeString = tr("Mesh level"); break; default: levelTypeString = "?"; break; } } else if (m_pl) levelTypeString = tr("Palette level"); else if (m_sdl) levelTypeString = tr("Sound Column"); m_typeLabel->setText(levelTypeString); // dpi & res & resampling if (hasDpiEditing) { LevelProperties::DpiPolicy dpiPolicy = m_sl->getProperties()->getDpiPolicy(); assert(dpiPolicy == LevelProperties::DP_ImageDpi || dpiPolicy == LevelProperties::DP_CustomDpi); m_dpiTypeOm->setCurrentIndex( (dpiPolicy == LevelProperties::DP_ImageDpi) ? 0 : 1); // dpi field TPointD dpi = m_sl->getDpi(); m_dpiFld->setText(dpiToString(dpi)); m_dpiFld->setCursorPosition(0); // image dpi m_imageDpiLabel->setText(dpiToString(m_sl->getImageDpi())); if (isRasterLevel) { // size field TDimensionD size(0, 0); TDimension res = m_sl->getResolution(); if (res.lx > 0 && res.ly > 0 && dpi.x > 0 && dpi.y > 0) { size.lx = res.lx / dpi.x; size.ly = res.ly / dpi.y; m_widthFld->setValue(tround(size.lx * 100.0) / 100.0); m_heightFld->setValue(tround(size.ly * 100.0) / 100.0); } else { m_widthFld->setText(tr("")); m_heightFld->setText(tr("")); } // image res TDimension imageRes = m_sl->getResolution(); m_imageResLabel->setText(QString::number(imageRes.lx) + "x" + QString::number(imageRes.ly)); // subsampling m_subsamplingFld->setValue(m_sl->getProperties()->getSubsampling()); // doPremultiply m_doPremultiply->setChecked(m_sl->getProperties()->doPremultiply()); if (m_whiteTransp) m_whiteTransp->setChecked(m_sl->getProperties()->whiteTransp()); m_antialiasSoftness->setValue(m_sl->getProperties()->antialiasSoftness()); m_doAntialias->setChecked(m_sl->getProperties()->antialiasSoftness() > 0); } } else { m_dpiFld->setText(tr("")); m_widthFld->setText(tr("")); m_heightFld->setText(tr("")); m_cameraDpiLabel->setText(tr("")); m_imageDpiLabel->setText(tr("")); m_imageResLabel->setText(tr("")); m_subsamplingFld->setText(tr("")); m_doPremultiply->setChecked(false); m_doAntialias->setChecked(false); if (m_whiteTransp) m_whiteTransp->setChecked(false); } // camera dpi m_cameraDpiLabel->setText(dpiToString(getCurrentCameraDpi())); m_nameFld->setEnabled((isSimpleLevel || isChildLevel || !!m_pl || !!m_sdl)); m_pathFld->setEnabled((isSimpleLevel || !!m_sdl || !!m_pl)); if (m_scanPathLabel) m_scanPathLabel->setEnabled(isTzpLevel); if (m_scanPathFld) m_scanPathFld->setEnabled(isTzpLevel); m_typeLabel->setEnabled(isSimpleLevel || !!m_pl || !!m_sdl); m_dpiTypeOm->setEnabled((isSimpleLevel && m_sl->getImageDpi() != TPointD())); m_squarePixCB->setEnabled(hasDpiEditing); m_dpiLabel->setEnabled(hasDpiEditing); m_dpiFld->setEnabled(hasDpiEditing); m_widthLabel->setEnabled(isRasterLevel); m_widthFld->setEnabled(isRasterLevel); m_heightLabel->setEnabled(isRasterLevel); m_heightFld->setEnabled(isRasterLevel); m_useCameraDpiBtn->setEnabled(hasDpiEditing); m_subsamplingLabel->setEnabled( (isRasterLevel && m_sl && !m_sl->getProperties()->getDirtyFlag())); m_subsamplingFld->setEnabled( (isRasterLevel && m_sl && !m_sl->getProperties()->getDirtyFlag())); m_doPremultiply->setEnabled(m_sl && isRasterLevel && !isTzpLevel); m_doAntialias->setEnabled(m_sl && isRasterLevel); if (m_whiteTransp) m_whiteTransp->setEnabled(m_sl && isRasterLevel && !isTzpLevel); }