当前位置: 首页>>代码示例>>C++>>正文


C++ TApp::getCurrentSelection方法代码示例

本文整理汇总了C++中TApp::getCurrentSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ TApp::getCurrentSelection方法的具体用法?C++ TApp::getCurrentSelection怎么用?C++ TApp::getCurrentSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TApp的用法示例。


在下文中一共展示了TApp::getCurrentSelection方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onStyleChanged

 bool onStyleChanged() override {
   TApp *app = TApp::instance();
   int styleIndex =
       app->getPaletteController()->getCurrentLevelPalette()->getStyleIndex();
   TSelection *currentSelection = app->getCurrentSelection()->getSelection();
   StrokeSelection *ss = dynamic_cast<StrokeSelection *>(currentSelection);
   if (!ss || ss->isEmpty()) return false;
   ss->changeColorStyle(styleIndex);
   return true;
 }
开发者ID:SaierMe,项目名称:opentoonz,代码行数:10,代码来源:tpanels.cpp

示例2: onCurrentButtonToggled

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();
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:53,代码来源:tpanels.cpp

示例3: onChooseLevelComboChanged

/*! 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();
  }
}
开发者ID:jcome,项目名称:opentoonz,代码行数:41,代码来源:filmstrip.cpp

示例4: onReplace

void InsertFxPopup::onReplace()
{
	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::replaceFx(fx, fxs, app->getCurrentXsheet(), app->getCurrentFx());
		xshHandle->notifyXsheetChanged();
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:14,代码来源:insertfxpopup.cpp

示例5: onInsert

void InsertFxPopup::onInsert()
{
	TFx *fx = createFx();
	if (fx) {
		TApp *app = TApp::instance();
		TXsheetHandle *xshHandle = app->getCurrentXsheet();
		QList<TFxP> fxs;
		QList<TFxCommand::Link> links;
		FxSelection *selection = dynamic_cast<FxSelection *>(app->getCurrentSelection()->getSelection());
		if (selection) {
			fxs = selection->getFxs();
			links = selection->getLinks();
		}
		TFxCommand::insertFx(fx, fxs, links, app,
							 app->getCurrentColumn()->getColumnIndex(),
							 app->getCurrentFrame()->getFrameIndex());
		xshHandle->notifyXsheetChanged();
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:19,代码来源:insertfxpopup.cpp

示例6: acquireRaster

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();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:39,代码来源:adjustlevelspopup.cpp

示例7: updateLevelSettings

/*! 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);

//.........这里部分代码省略.........
开发者ID:opentoonz,项目名称:opentoonz,代码行数:101,代码来源:levelsettingspopup.cpp


注:本文中的TApp::getCurrentSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。