本文整理汇总了C++中TXsheet::getCell方法的典型用法代码示例。如果您正苦于以下问题:C++ TXsheet::getCell方法的具体用法?C++ TXsheet::getCell怎么用?C++ TXsheet::getCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TXsheet
的用法示例。
在下文中一共展示了TXsheet::getCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateXshLevel
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);
}
}
示例2: updateBox
void ShiftTraceTool::updateBox() {
if (0 <= m_ghostIndex && m_ghostIndex < 2 && m_row[m_ghostIndex] >= 0) {
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
int row = m_row[m_ghostIndex];
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
TXshCell cell = xsh->getCell(row, col);
TXshSimpleLevel *sl = cell.getSimpleLevel();
if (sl) {
m_dpiAff = getDpiAffine(sl, cell.m_frameId);
TImageP img = cell.getImage(false);
if (img) {
if (TRasterImageP ri = img) {
TRasterP ras = ri->getRaster();
m_box = (convert(ras->getBounds()) - ras->getCenterD()) *
ri->getSubsampling();
} else if (TToonzImageP ti = img) {
TRasterP ras = ti->getRaster();
m_box = (convert(ras->getBounds()) - ras->getCenterD()) *
ti->getSubsampling();
} else if (TVectorImageP vi = img) {
m_box = vi->getBBox();
}
}
}
}
}
示例3: canMoveCells
bool CellsMover::canMoveCells(const TPoint &pos) {
TXsheet *xsh = getXsheet();
if (pos.x < 0) return false;
if (pos.x != m_startPos.x) {
int count = 0;
// controlla il tipo
int i = 0;
while (i < m_rowCount * m_colCount) {
TXshColumn::ColumnType srcType = getColumnTypeFromCell(i);
int dstIndex = pos.x + i;
TXshColumn *dstColumn = xsh->getColumn(dstIndex);
if (srcType == TXshColumn::eZeraryFxType) return false;
if (dstColumn && !dstColumn->isEmpty() &&
dstColumn->getColumnType() != srcType)
return false;
if (!dstColumn || dstColumn->isLocked() == false) count++;
i += m_rowCount;
}
if (count == 0) return false;
}
if ((m_qualifiers & CellsMover::eInsertCells) ||
(m_qualifiers & CellsMover::eOverwriteCells))
return true;
int count = 0;
for (int i = 0; i < m_colCount; i++) {
for (int j = 0; j < m_rowCount; j++) {
if (!xsh->getCell(pos.y + j, pos.x + i).isEmpty()) return false;
count++;
}
}
if (count == 0) return false;
return true;
}
示例4: onFrameSwitched
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();
}
示例5: notifyImageChanged
/*! Notify change of image in \b fid: update icon and notify level change.
*/
void TTool::notifyImageChanged(const TFrameId &fid) {
onImageChanged();
if (!m_application) return;
m_application->getCurrentScene()->setDirtyFlag(true);
if (m_application->getCurrentFrame()->isEditingLevel()) {
TXshLevel *xl = m_application->getCurrentLevel()->getLevel();
if (!xl) return;
TXshSimpleLevel *sl = xl->getSimpleLevel();
if (!sl) return;
sl->setDirtyFlag(true);
IconGenerator::instance()->invalidate(sl, fid);
IconGenerator::instance()->invalidateSceneIcon();
} else {
int row = m_application->getCurrentFrame()->getFrame();
int col = m_application->getCurrentColumn()->getColumnIndex();
if (col < 0) return;
TXsheet *xsh = m_application->getCurrentXsheet()->getXsheet();
if (!xsh) return;
TXshCell cell = xsh->getCell(row, col);
TXshSimpleLevel *sl = cell.getSimpleLevel();
if (sl) {
IconGenerator::instance()->invalidate(sl, fid);
IconGenerator::instance()->invalidateSceneIcon();
sl->setDirtyFlag(true);
}
}
m_application->getCurrentLevel()->notifyLevelChange();
}
示例6: execute
void execute()
{
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int row = TApp::instance()->getCurrentFrame()->getFrame();
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
const TXshCell &cell = xsh->getCell(row, col);
if (cell.isEmpty())
return;
for (++row; xsh->getCell(row, col) == cell; ++row)
;
if (!xsh->getCell(row, col).isEmpty())
TApp::instance()->getCurrentFrame()->setFrame(row);
}
示例7: changeFrameSkippingHolds
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;
}
示例8: ClearColumnCellsUndo
ClearColumnCellsUndo(int col) : m_col(col), m_r0(0) {
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int r0, r1;
xsh->getCellRange(col, r0, r1);
m_r0 = r0;
if (r0 > r1) return;
for (int r = r0; r <= r1; r++) {
m_oldFrames.push_back(xsh->getCell(r, col));
}
}
示例9: 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();
}
示例10: drawControlRect
void ShiftTraceTool::drawControlRect() {
if (m_ghostIndex < 0 || m_ghostIndex > 1) return;
int row = m_row[m_ghostIndex];
if (row < 0) return;
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
TXshCell cell = xsh->getCell(row, col);
if (cell.isEmpty()) return;
TImageP img = cell.getImage(false);
if (!img) return;
TRectD box;
if (TRasterImageP ri = img) {
TRasterP ras = ri->getRaster();
box =
(convert(ras->getBounds()) - ras->getCenterD()) * ri->getSubsampling();
} else if (TToonzImageP ti = img) {
TRasterP ras = ti->getRaster();
box =
(convert(ras->getBounds()) - ras->getCenterD()) * ti->getSubsampling();
} else if (TVectorImageP vi = img) {
box = vi->getBBox();
} else {
return;
}
glPushMatrix();
tglMultMatrix(getGhostAff());
TPixel32 color;
color = m_highlightedGadget == TranslateGadget ? TPixel32(200, 100, 100)
: TPixel32(120, 120, 120);
tglColor(color);
glBegin(GL_LINE_STRIP);
glVertex2d(box.x0, box.y0);
glVertex2d(box.x1, box.y0);
glVertex2d(box.x1, box.y1);
glVertex2d(box.x0, box.y1);
glVertex2d(box.x0, box.y0);
glEnd();
color =
m_highlightedGadget == 2000 ? TPixel32(200, 100, 100) : TPixel32::White;
double r = 4 * sqrt(tglGetPixelSize2());
drawDot(box.getP00(), r, color);
drawDot(box.getP01(), r, color);
drawDot(box.getP10(), r, color);
drawDot(box.getP11(), r, color);
if (m_curveStatus == NoCurve) {
color =
m_highlightedGadget == 2001 ? TPixel32(200, 100, 100) : TPixel32::White;
TPointD c = m_center[m_ghostIndex];
drawDot(c, r, color);
}
glPopMatrix();
}
示例11: ResequenceUndo
ResequenceUndo(int col, int count)
: m_index(col), m_r0(0), m_newFramesCount(count) {
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int r0, r1;
xsh->getCellRange(col, r0, r1);
m_r0 = r0;
assert(r0 <= r1);
if (r0 > r1) return;
for (int r = r0; r <= r1; r++) {
TXshCell cell = xsh->getCell(r, col);
assert(cell.isEmpty() || cell.m_level->getChildLevel());
m_oldFrames.push_back(cell.m_frameId);
}
}
示例12: redo
void redo() const override {
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int r0, r1;
xsh->getCellRange(m_index, r0, r1);
assert(r0 <= r1);
if (r0 > r1) return;
TXshCell cell = xsh->getCell(r0, m_index);
assert(!cell.isEmpty());
assert(cell.m_level->getChildLevel());
xsh->clearCells(r0, m_index, r1 - r0 + 1);
for (int i = 0; i < m_newFramesCount; i++) {
cell.m_frameId = TFrameId(i + 1);
xsh->setCell(m_r0 + i, m_index, cell);
}
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}
示例13: getSelectedFrames
int BinarizePopup::getSelectedFrames()
{
m_frames.clear();
TSelection *selection = TSelection::getCurrent();
TCellSelection *cellSelection;
TFilmstripSelection *filmstripSelection;
int count = 0;
if ((cellSelection = dynamic_cast<TCellSelection *>(selection))) {
std::set<TRasterImage *> images;
int r0, c0, r1, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
int c, r;
for (c = c0; c <= c1; c++) {
for (r = r0; r <= r1; r++) {
TXshCell cell = xsheet->getCell(r, c);
TRasterImageP rasImage = cell.getImage(false);
if (!rasImage || !rasImage->getRaster())
continue;
Frames::value_type item(cell.getSimpleLevel(), cell.getFrameId());
Frames::iterator it;
it = std::lower_bound(m_frames.begin(), m_frames.end(), item);
if (it == m_frames.end() || *it != item) {
m_frames.insert(it, item);
count++;
}
}
}
} else if ((filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection))) {
TXshSimpleLevel *sl = TApp::instance()->getCurrentLevel()->getSimpleLevel();
if (sl) {
std::set<TFrameId> fids = filmstripSelection->getSelectedFids();
std::set<TFrameId>::iterator it;
for (it = fids.begin(); it != fids.end(); ++it) {
TRasterImageP rasImage = sl->getFrame(*it, false);
if (!!rasImage && !!rasImage->getRaster()) {
m_frames.push_back(std::make_pair(sl, *it));
count++;
}
}
}
} else {
}
m_frameIndex = 0;
return count;
}
示例14: undo
void undo() const
{
TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
TXshCell cell = xsheet->getCell(m_r, m_c);
TRasterImageP rasImage = (TRasterImageP)cell.getImage(true);
if (!rasImage)
return;
rasImage->setRaster(((TRasterImageP)TImageCache::instance()->get(m_rasId, true))->getRaster()->clone());
TXshSimpleLevel *simpleLevel = cell.getSimpleLevel();
assert(simpleLevel);
simpleLevel->touchFrame(cell.getFrameId());
simpleLevel->setDirtyFlag(false);
IconGenerator::instance()->invalidate(simpleLevel, cell.getFrameId());
if (m_isLastInBlock) {
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}
}
示例15: acquirePreview
void MeshifyPopup::acquirePreview()
{
m_viewer->clear();
// Assign preview input to the viewer
bool enabled = false;
::xshPos(m_r, m_c);
m_cell = TApp::instance()->getCurrentXsheet()->getXsheet()->getCell(m_r, m_c);
// Redirect mesh case to texture
TXshSimpleLevel *sl = m_cell.getSimpleLevel();
if (sl && sl->getType() == MESH_XSHLEVEL) {
// Mesh image case
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
TStageObject *meshObj = xsh->getStageObject(TStageObjectId::ColumnId(m_c));
const TStageObjectId &childId = ::firstChildLevelColumn(*xsh, *meshObj);
if (childId.isColumn())
// Retrieved the associated texture cell - redirect acquisition there
m_cell = xsh->getCell(m_r, childId.getIndex());
}
if ((sl = m_cell.getSimpleLevel())) {
// Standard image case
m_viewer->m_img = sl->getFullsampledFrame(m_cell.getFrameId(), ImageManager::dontPutInCache);
enabled = true;
} else if (TXshChildLevel *cl = m_cell.getChildLevel()) {
// Sub-xsheet case
TXsheet *xsh = cl->getXsheet();
int row = m_cell.getFrameId().getNumber() - 1;
m_viewer->m_xsh = xsh, m_viewer->m_row = row;
enabled = true;
}
m_okBtn->setEnabled(enabled);
// Update the corresponding processed image in the viewer
updateMeshPreview();
}