コード例 #1
0
ファイル: tpanels.cpp プロジェクト: SaierMe/opentoonz
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();
}
コード例 #2
0
bool changeFrameSkippingHolds(QKeyEvent *e) {
  if ((e->modifiers() & Qt::ShiftModifier) == 0 ||
      e->key() != Qt::Key_Down && e->key() != Qt::Key_Up)
    return false;
  TApp *app        = TApp::instance();
  TFrameHandle *fh = app->getCurrentFrame();
  if (!fh->isEditingScene()) return false;
  int row       = fh->getFrame();
  int col       = app->getCurrentColumn()->getColumnIndex();
  TXsheet *xsh  = app->getCurrentXsheet()->getXsheet();
  TXshCell cell = xsh->getCell(row, col);
  if (e->key() == Qt::Key_Down) {
    if (cell.isEmpty()) {
      int r0, r1;
      if (xsh->getCellRange(col, r0, r1)) {
        while (row <= r1 && xsh->getCell(row, col).isEmpty()) row++;
        if (xsh->getCell(row, col).isEmpty()) return false;
      } else
        return false;
    } else {
      while (xsh->getCell(row, col) == cell) row++;
    }
  } else {
    // Key_Up
    while (row >= 0 && xsh->getCell(row, col) == cell) row--;
    if (row < 0) return false;
    cell = xsh->getCell(row, col);
    while (row > 0 && xsh->getCell(row - 1, col) == cell) row--;
  }
  fh->setFrame(row);
  return true;
}
コード例 #3
0
ファイル: filmstrip.cpp プロジェクト: jcome/opentoonz
void FilmstripFrames::onFrameSwitched() {
  // no. interferische con lo shift-click per la selezione.
  // m_selection->selectNone();
  TApp *app        = TApp::instance();
  TFrameHandle *fh = app->getCurrentFrame();
  TFrameId fid;
  if (fh->isEditingLevel())
    fid = fh->getFid();
  else {
    TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
    int col      = app->getCurrentColumn()->getColumnIndex();
    int row      = fh->getFrame();
    if (row < 0 || col < 0) return;
    TXshCell cell = xsh->getCell(row, col);
    if (cell.isEmpty()) return;
    fid = cell.getFrameId();
  }
  int index = fid2index(fid);
  if (index >= 0) {
    exponeFrame(index);
    // clear selection and select only the destination frame
    select(index, ONLY_SELECT);
  }
  update();
}
コード例 #4
0
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);
}
コード例 #5
0
void AntialiasPopup::showEvent(QShowEvent *se)
{
	TApp *app = TApp::instance();
	bool ret = true;
	ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(setCurrentSampleRaster()));
	ret = ret && connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(setCurrentSampleRaster()));
	ret = ret && connect(app->getCurrentColumn(), SIGNAL(columnIndexSwitched()), this, SLOT(setCurrentSampleRaster()));
	assert(ret);
	setCurrentSampleRaster();
}
コード例 #6
0
ファイル: tpanels.cpp プロジェクト: SaierMe/opentoonz
void FunctionViewerPanel::attachHandles() {
  TApp *app = TApp::instance();

  m_functionViewer->setXsheetHandle(app->getCurrentXsheet());
  m_functionViewer->setFrameHandle(app->getCurrentFrame());
  m_functionViewer->setObjectHandle(app->getCurrentObject());
  m_functionViewer->setFxHandle(app->getCurrentFx());
  m_functionViewer->setColumnHandle(app->getCurrentColumn());
  m_functionViewer->setSceneHandle(app->getCurrentScene());
}
コード例 #7
0
void LinesFadePopup::hideEvent(QHideEvent *he)
{
	TApp *app = TApp::instance();
	disconnect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(setCurrentSampleRaster()));
	disconnect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(setCurrentSampleRaster()));
	disconnect(app->getCurrentColumn(), SIGNAL(columnIndexSwitched()), this, SLOT(setCurrentSampleRaster()));
	Dialog::hideEvent(he);

	m_viewer->raster() = TRasterP();
	m_startRas = TRaster32P();
}
コード例 #8
0
void SceneViewerContextMenu::onSetCurrent() {
  TStageObjectId id;
  id.setCode(qobject_cast<QAction *>(sender())->data().toUInt());
  TApp *app = TApp::instance();
  if (id.isColumn()) {
    app->getCurrentColumn()->setColumnIndex(id.getIndex());
    app->getCurrentObject()->setObjectId(id);
  } else {
    app->getCurrentObject()->setObjectId(id);
    app->getCurrentTool()->setTool(T_Edit);
  }
}
コード例 #9
0
ファイル: insertfxpopup.cpp プロジェクト: CroW-CZ/opentoonz
void InsertFxPopup::onAdd()
{
	TFx *fx = createFx();
	if (fx) {
		TApp *app = TApp::instance();
		TXsheetHandle *xshHandle = app->getCurrentXsheet();
		QList<TFxP> fxs;
		FxSelection *selection = dynamic_cast<FxSelection *>(app->getCurrentSelection()->getSelection());
		if (selection)
			fxs = selection->getFxs();
		TFxCommand::addFx(fx, fxs, app,
						  app->getCurrentColumn()->getColumnIndex(),
						  app->getCurrentFrame()->getFrameIndex());
		xshHandle->notifyXsheetChanged();
	}
}
コード例 #10
0
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();
}
コード例 #11
0
ファイル: comboviewerpane.cpp プロジェクト: luc--/opentoonz
void ComboViewerPanel::onDrawFrame(
    int frame, const ImagePainter::VisualSettings &settings) {
  TApp *app = TApp::instance();
  m_sceneViewer->setVisual(settings);
  TFrameHandle *frameHandle = app->getCurrentFrame();

  if (m_sceneViewer->isPreviewEnabled()) {
    class Previewer *pr = Previewer::instance(m_sceneViewer->getPreviewMode() ==
                                              SceneViewer::SUBCAMERA_PREVIEW);

    pr->getRaster(frame - 1);  // the 'getRaster' starts the render of the frame
                               // is not already started
    int curFrame = frame;
    if (frameHandle->isPlaying() &&
        !pr->isFrameReady(
            frame - 1))  // stops on last rendered frame until current is ready!
    {
      while (frame > 0 && !pr->isFrameReady(frame - 1)) frame--;
      if (frame == 0)
        frame = curFrame;  // if no frame is ready, I stay on current...no use
                           // to rewind
      m_flipConsole->setCurrentFrame(frame);
    }
  }

  assert(frame >= 0);
  if (frame != frameHandle->getFrameIndex() + 1) {
    if (frameHandle->isEditingScene()) {
      TXshColumn *column = app->getCurrentXsheet()->getXsheet()->getColumn(
          app->getCurrentColumn()->getColumnIndex());
      if (column) {
        TXshSoundColumn *soundColumn = column->getSoundColumn();
        if (soundColumn && !soundColumn->isPlaying())
          app->getCurrentFrame()->scrubColumn(frame, frame, soundColumn);
      }
    }
    frameHandle->setCurrentFrame(frame);
  }

  else if (settings.m_blankColor != TPixel::Transparent)
    m_sceneViewer->update();
}
コード例 #12
0
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();
}
コード例 #13
0
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();
}
コード例 #14
0
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());
	}
}
コード例 #15
0
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();
}
コード例 #16
0
void onShowHideSelectObject(QAction *action) {
  TApp *app = TApp::instance();
  TStageObjectId id;
  id.setCode(action->data().toInt());
  if (id == TStageObjectId::NoneId) return;
  if (action->text().startsWith("Show ") ||
      action->text().startsWith("Hide ")) {
    if (id.isColumn()) {
      app->getCurrentXsheet()
          ->getXsheet()
          ->getColumn(id.getIndex())
          ->setCamstandVisible(action->text().startsWith("Show "));
      TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
    }
  } else if (action->text().startsWith("Select ")) {
    if (id.isColumn()) {
      app->getCurrentColumn()->setColumnIndex(id.getIndex());
      app->getCurrentObject()->setObjectId(id);
    } else {
      app->getCurrentObject()->setObjectId(id);
      app->getCurrentTool()->setTool(T_Edit);
    }
  }
}
コード例 #17
0
bool LevelCreatePopup::apply() {
  TApp *app = TApp::instance();
  int row   = app->getCurrentFrame()->getFrame();
  int col   = app->getCurrentColumn()->getColumnIndex();
  int i, j;

  ToonzScene *scene = app->getCurrentScene()->getScene();
  TXsheet *xsh      = scene->getXsheet();

  bool validColumn = true;
  if (xsh->getColumn(col))
    validColumn =
        xsh->getColumn(col)->getColumnType() == TXshColumn::eLevelType;

  int from   = (int)m_fromFld->getValue();
  int to     = (int)m_toFld->getValue();
  int inc    = (int)m_incFld->getValue();
  int step   = (int)m_stepFld->getValue();
  double w   = m_widthFld->getValue();
  double h   = m_heightFld->getValue();
  double dpi = m_dpiFld->getValue();
  int xres   = std::max(tround(w * dpi), 1);
  int yres   = std::max(tround(h * dpi), 1);
  int lType  = getLevelType();

  std::wstring levelName = m_nameFld->text().toStdWString();
  // tolgo i blanks prima e dopo

  i = levelName.find_first_not_of(L' ');
  if (i == (int)std::wstring::npos)
    levelName = L"";
  else {
    int j = levelName.find_last_not_of(L' ');
    assert(j != (int)std::wstring::npos);
    levelName = levelName.substr(i, j - i + 1);
  }
  if (levelName.empty()) {
    error(tr("No level name specified: please choose a valid level name"));
    return false;
  }

  if (from > to) {
    error(tr("Invalid frame range"));
    return false;
  }
  if (inc <= 0) {
    error(tr("Invalid increment value"));
    return false;
  }
  if (step <= 0) {
    error(tr("Invalid step value"));
    return false;
  }

  int numFrames = step * (((to - from) / inc) + 1);

  if (scene->getLevelSet()->getLevel(levelName)) {
    error(
        tr("The level name specified is already used: please choose a "
           "different level name"));
    m_nameFld->selectAll();
    return false;
  }

  TFilePath parentDir(m_pathFld->getPath().toStdWString());
  TFilePath fp =
      scene->getDefaultLevelPath(lType, levelName).withParentDir(parentDir);

  TFilePath actualFp = scene->decodeFilePath(fp);
  if (TSystem::doesExistFileOrLevel(actualFp)) {
    error(
        tr("The level name specified is already used: please choose a "
           "different level name"));
    m_nameFld->selectAll();
    return false;
  }
  parentDir = scene->decodeFilePath(parentDir);
  if (!TFileStatus(parentDir).doesExist()) {
    QString question;
    /*question = "Folder " +toQString(parentDir) +
                                                     " doesn't exist.\nDo you
       want to create it?";*/
    question = tr("Folder %1 doesn't exist.\nDo you want to create it?")
                   .arg(toQString(parentDir));
    int ret = DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No"));
    if (ret == 0 || ret == 2) return false;
    try {
      TSystem::mkDir(parentDir);
      DvDirModel::instance()->refreshFolder(parentDir.getParentDir());
    } catch (...) {
      error(tr("Unable to create") + toQString(parentDir));
      return false;
    }
  }

  TXshLevel *level =
      scene->createNewLevel(lType, levelName, TDimension(), 0, fp);
  TXshSimpleLevel *sl = dynamic_cast<TXshSimpleLevel *>(level);
  assert(sl);
  sl->setPath(fp, true);
  if (lType == TZP_XSHLEVEL || lType == OVL_XSHLEVEL) {
    sl->getProperties()->setDpiPolicy(LevelProperties::DP_ImageDpi);
    sl->getProperties()->setDpi(dpi);
    sl->getProperties()->setImageDpi(TPointD(dpi, dpi));
    sl->getProperties()->setImageRes(TDimension(xres, yres));
  }

  /*-- これからLevelを配置しようとしているセルが空いているかどうかのチェック
   * --*/
  bool areColumnsShifted = false;
  TXshCell cell          = xsh->getCell(row, col);
  bool isInRange         = true;
  for (i = row; i < row + numFrames; i++) {
    if (!cell.isEmpty()) {
      isInRange = false;
      break;
    }
    cell = xsh->getCell(i, col);
  }
  if (!validColumn) {
    isInRange = false;
  }

  /*-- 別のLevelに占有されていた場合、Columnを1つ右に移動 --*/
  if (!isInRange) {
    col += 1;
    TApp::instance()->getCurrentColumn()->setColumnIndex(col);
    areColumnsShifted = true;
    xsh->insertColumn(col);
  }

  CreateLevelUndo *undo =
      new CreateLevelUndo(row, col, numFrames, step, areColumnsShifted);
  TUndoManager::manager()->add(undo);

  for (i = from; i <= to; i += inc) {
    TFrameId fid(i);
    TXshCell cell(sl, fid);
    if (lType == PLI_XSHLEVEL)
      sl->setFrame(fid, new TVectorImage());
    else if (lType == TZP_XSHLEVEL) {
      TRasterCM32P raster(xres, yres);
      raster->fill(TPixelCM32());
      TToonzImageP ti(raster, TRect());
      ti->setDpi(dpi, dpi);
      sl->setFrame(fid, ti);
      ti->setSavebox(TRect(0, 0, xres - 1, yres - 1));
    } else if (lType == OVL_XSHLEVEL) {
      TRaster32P raster(xres, yres);
      raster->clear();
      TRasterImageP ri(raster);
      ri->setDpi(dpi, dpi);
      sl->setFrame(fid, ri);
    }
    for (j = 0; j < step; j++) xsh->setCell(row++, col, cell);
  }

  if (lType == TZP_XSHLEVEL || lType == OVL_XSHLEVEL) {
    sl->save(fp);
    DvDirModel::instance()->refreshFolder(fp.getParentDir());
  }

  undo->onAdd(sl);

  app->getCurrentScene()->notifySceneChanged();
  app->getCurrentScene()->notifyCastChange();
  app->getCurrentXsheet()->notifyXsheetChanged();

  // Cambia l'immagine corrente ma non cambiano ne' il frame ne' la colonna
  // corrente
  // (entrambi notificano il cambiamento dell'immagine al tool).
  // devo verfificare che sia settato il tool giusto.
  app->getCurrentTool()->onImageChanged(
      (TImage::Type)app->getCurrentImageType());
  return true;
}
コード例 #18
0
ファイル: comboviewerpane.cpp プロジェクト: luc--/opentoonz
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);
}