本文整理汇总了C++中ttool::Application类的典型用法代码示例。如果您正苦于以下问题:C++ Application类的具体用法?C++ Application怎么用?C++ Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: multiAutocloseRegion
void multiAutocloseRegion(TStroke *stroke, const TMouseEvent &e) {
TTool::Application *app = TTool::getApplication();
if (m_firstStroke) {
multiApplyAutoclose(m_firstFrameId, getFrameId(), TRectD(), TRectD(),
m_firstStroke, stroke);
invalidate();
if (e.isShiftPressed()) {
delete m_firstStroke;
m_firstStroke = new TStroke(*stroke);
m_firstFrameId = getFrameId();
} else {
if (m_isXsheetCell) {
app->getCurrentColumn()->setColumnIndex(m_currCell.first);
app->getCurrentFrame()->setFrame(m_currCell.second);
} else
app->getCurrentFrame()->setFid(m_veryFirstFrameId);
resetMulti();
}
} else {
m_isXsheetCell = app->getCurrentFrame()->isEditingScene();
// if (m_isXsheetCell)
m_currCell = std::pair<int, int>(getColumnIndex(), getFrame());
m_firstStroke = new TStroke(*stroke);
}
return;
}
示例2: onActivate
void FullColorBrushTool::onActivate()
{
if (!m_notifier)
m_notifier = new FullColorBrushToolNotifier(this);
TTool::Application *app = getApplication();
if (app->getCurrentObject()->isSpline()) {
m_currentColor = TPixel32::Red;
return;
}
int styleIndex = app->getCurrentLevelStyleIndex();
TPalette *plt = app->getCurrentPalette()->getPalette();
if (plt) {
int style = app->getCurrentLevelStyleIndex();
TColorStyle *colorStyle = plt->getStyle(style);
m_currentColor = colorStyle->getMainColor();
}
if (m_firstTime) {
m_firstTime = false;
m_thickness.setValue(TIntPairProperty::Value(FullcolorBrushMinSize, FullcolorBrushMaxSize));
m_pressure.setValue(FullcolorPressureSensibility ? 1 : 0);
m_opacity.setValue(TDoublePairProperty::Value(FullcolorMinOpacity, FullcolorMaxOpacity));
m_hardness.setValue(FullcolorBrushHardness);
}
m_brushPad = ToolUtils::getBrushPad(m_thickness.getValue().second, m_hardness.getValue() * 0.01);
setWorkAndBackupImages();
}
示例3: pickRect
void RGBPickerTool::pickRect() {
TImageP image = TImageP(getImage(false));
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TRectD area = m_selectingRect;
if (!palette) return;
if (m_selectingRect.x0 > m_selectingRect.x1) {
area.x1 = m_selectingRect.x0;
area.x0 = m_selectingRect.x1;
}
if (m_selectingRect.y0 > m_selectingRect.y1) {
area.y1 = m_selectingRect.y0;
area.y0 = m_selectingRect.y1;
}
m_selectingRect.empty();
if (area.getLx() <= 1 || area.getLy() <= 1) return;
StylePicker picker(image, palette);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->bindFBO();
m_currentValue = picker.pickColor(area);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->releaseFBO();
}
示例4: leftButtonDown
void RGBPickerTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) {
TTool::Application *app = TTool::getApplication();
TPaletteHandle *pltHandle = app->getPaletteController()->getCurrentPalette();
m_currentStyleId = pltHandle->getStyleIndex();
if (m_currentStyleId == 0) return;
TColorStyle *colorStyle = pltHandle->getStyle();
if (colorStyle) m_oldValue = colorStyle->getMainColor();
if (m_pickType.getValue() == RECT_PICK) {
m_selectingRect.x0 = e.m_pos.x;
m_selectingRect.y0 = e.m_pos.y;
m_selectingRect.x1 = e.m_pos.x;
m_selectingRect.y1 = e.m_pos.y;
m_drawingRect.x0 = pos.x;
m_drawingRect.y0 = pos.y;
m_drawingRect.x1 = pos.x;
m_drawingRect.y1 = pos.y;
invalidate();
return;
} else if (m_pickType.getValue() == FREEHAND_PICK) {
startFreehand(pos, convert(e.m_pos));
return;
} else if (m_pickType.getValue() == POLYLINE_PICK) {
addPointPolyline(pos, convert(e.m_pos));
return;
} else {
pick(e.m_pos);
}
}
示例5: magicLink
void SkeletonTool::magicLink(int index)
{
if (index < 0 || index >= (int)m_magicLinks.size())
return;
HookData h0 = m_magicLinks[index].m_h0;
HookData h1 = m_magicLinks[index].m_h1;
TTool::Application *app = TTool::getApplication();
TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
int columnIndex = app->getCurrentColumn()->getColumnIndex();
TStageObjectId id = TStageObjectId::ColumnId(columnIndex);
TStageObject *obj = xsh->getStageObject(id);
int parentColumnIndex = h1.m_columnIndex;
TStageObjectId parentId = TStageObjectId::ColumnId(parentColumnIndex);
std::string parentHandle = h1.getHandle();
std::string handle = "";
if (h0.m_columnIndex < 0) {
handle = obj->getHandle();
} else {
handle = h0.getHandle();
}
//TUndoManager *undoManager = TUndoManager::manager();
//undoManager->beginBlock();
TStageObjectCmd::setHandle(id, handle, app->getCurrentXsheet());
TStageObjectCmd::setParent(id, parentId, parentHandle, app->getCurrentXsheet());
//undoManager->endBlock();
}
示例6: onImageChanged
void onImageChanged() override {
if (!m_multi.getValue()) return;
TTool::Application *app = TTool::getApplication();
TXshSimpleLevel *xshl = 0;
if (app->getCurrentLevel()->getLevel())
xshl = app->getCurrentLevel()->getSimpleLevel();
if (!xshl || m_level.getPointer() != xshl ||
(m_closeType.getValue() == RECT_CLOSE && m_selectingRect.isEmpty()) ||
((m_closeType.getValue() == FREEHAND_CLOSE ||
m_closeType.getValue() == POLYLINE_CLOSE) &&
!m_firstStroke))
resetMulti();
else if (m_firstFrameId == getFrameId())
m_firstFrameSelected = false; // nel caso sono passato allo stato 1 e
// torno all'immagine iniziale, torno allo
// stato iniziale
else { // cambio stato.
m_firstFrameSelected = true;
if (m_closeType.getValue() == RECT_CLOSE) {
assert(!m_selectingRect.isEmpty());
m_firstRect = m_selectingRect;
}
}
}
示例7: resetMulti
void resetMulti() {
m_firstFrameSelected = false;
m_firstRect.empty();
m_firstPoint = TPointD();
m_selectingRect.empty();
TTool::Application *app = TTool::getApplication();
m_level = app->getCurrentLevel()->getLevel()
? app->getCurrentLevel()->getSimpleLevel()
: 0;
m_firstFrameId = m_veryFirstFrameId = getFrameId();
m_firstStroke = 0;
}
示例8: leftButtonUp
void FullColorBrushTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e)
{
m_brushPos = m_mousePos = pos;
TRasterImageP ri = (TRasterImageP)getImage(true);
if (!ri)
return;
if (m_points.size() != 1) {
double maxThickness = m_thickness.getValue().second;
double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThickness;
double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
TPointD rasCenter = ri->getRaster()->getCenterD();
TThickPoint point(pos + rasCenter, thickness);
m_points.push_back(point);
int m = m_points.size();
vector<TThickPoint> points;
points.push_back(m_points[m - 3]);
points.push_back(m_points[m - 2]);
points.push_back(m_points[m - 1]);
TRect bbox = m_brush->getBoundFromPoints(points);
updateWorkAndBackupRasters(bbox);
m_tileSaver->save(bbox);
m_brush->addArc(points[0], points[1], points[2], m_oldOpacity, opacity);
m_brush->updateDrawing(ri->getRaster(), m_backUpRas, m_currentColor, bbox, m_opacity.getValue().second * 0.01);
TRectD invalidateRect = ToolUtils::getBounds(points, maxThickness);
invalidate(invalidateRect.enlarge(2) - rasCenter);
m_strokeRect += bbox;
m_lastRect.empty();
}
if (m_brush) {
delete m_brush;
m_brush = 0;
}
m_workRaster->unlock();
if (m_tileSet->getTileCount() > 0) {
delete m_tileSaver;
TTool::Application *app = TTool::getApplication();
TXshLevel *level = app->getCurrentLevel()->getLevel();
TXshSimpleLevelP simLevel = level->getSimpleLevel();
TFrameId frameId = getCurrentFid();
TRasterP ras = ri->getRaster()->extract(m_strokeRect)->clone();
TUndoManager::manager()->add(new FullColorBrushUndo(m_tileSet, simLevel.getPointer(), frameId,
m_isFrameCreated, ras, m_strokeRect.getP00()));
}
notifyImageChanged();
m_strokeRect.empty();
}
示例9: doesApply
bool SkeletonTool::doesApply() const
{
TTool::Application *app = TTool::getApplication();
TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
assert(xsh);
TStageObjectId objId = app->getCurrentObject()->getObjectId();
if (objId.isColumn()) {
TXshColumn *column = xsh->getColumn(objId.getIndex());
if (column && column->getSoundColumn())
return false;
}
return true;
}
示例10: connect
FullColorBrushToolNotifier::FullColorBrushToolNotifier(FullColorBrushTool *tool)
: m_tool(tool)
{
TTool::Application *app = m_tool->getApplication();
TXshLevelHandle *levelHandle;
if (app)
levelHandle = app->getCurrentLevel();
bool ret = false;
if (levelHandle) {
bool ret = connect(levelHandle, SIGNAL(xshCanvasSizeChanged()), this, SLOT(onCanvasSizeChanged()));
assert(ret);
}
}
示例11: onActivate
void SkeletonTool::onActivate()
{
TTool::Application *app = TTool::getApplication();
if (m_firstTime) {
m_globalKeyframes.setValue(SkeletonGlobalKeyFrame ? 1 : 0);
m_mode.setValue(BUILD_SKELETON);
// m_ikEnabled.setValue(SkeletonInverseKinematics ? 1 : 0);
m_firstTime = false;
}
TStageObjectId objId = app->getCurrentObject()->getObjectId();
if (objId == TStageObjectId::NoneId) {
int index = app->getCurrentColumn()->getColumnIndex();
objId = TStageObjectId::ColumnId(index);
}
// app->editStageObject(objId);
}
示例12: leftButtonDown
void leftButtonDown(const TPointD &pos, const TMouseEvent &) override {
TToonzImageP ti = TToonzImageP(getImage(true));
if (!ti) return;
if (m_closeType.getValue() == RECT_CLOSE) {
m_selecting = true;
m_selectingRect.x0 = pos.x;
m_selectingRect.y0 = pos.y;
m_selectingRect.x1 = pos.x + 1;
m_selectingRect.y1 = pos.y + 1;
return;
} else if (m_closeType.getValue() == FREEHAND_CLOSE) {
startFreehand(pos);
return;
} else if (m_closeType.getValue() == POLYLINE_CLOSE) {
addPointPolyline(pos);
return;
} else if (m_closeType.getValue() == NORMAL_CLOSE) {
if (m_multi.getValue()) {
TTool::Application *app = TTool::getApplication();
if (m_firstFrameSelected) {
multiApplyAutoclose(m_firstFrameId, getFrameId());
invalidate();
if (m_isXsheetCell) {
app->getCurrentColumn()->setColumnIndex(m_currCell.first);
app->getCurrentFrame()->setFrame(m_currCell.second);
} else
app->getCurrentFrame()->setFid(m_veryFirstFrameId);
resetMulti();
} else {
m_isXsheetCell = app->getCurrentFrame()->isEditingScene();
// if (m_isXsheetCell)
m_currCell = std::pair<int, int>(getColumnIndex(), getFrame());
m_firstFrameSelected = true;
m_firstPoint = pos;
}
invalidate();
return;
}
m_selecting = false;
applyAutoclose(ti);
invalidate();
notifyImageChanged();
}
}
示例13: setCurrentColorWithUndo
void setCurrentColorWithUndo(const TPixel32 &color) {
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
if (palette)
TUndoManager::manager()->add(
new UndoPickRGBM(palette, styleId, color, level));
setCurrentColor(color);
if (level) {
std::vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level, fids);
}
}
示例14: onImageChanged
void RGBPickerTool::onImageChanged() {
if (m_currentStyleId != 0 && m_makePick &&
(m_pickType.getValue() == POLYLINE_PICK ||
m_pickType.getValue() == RECT_PICK)) {
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
if (palette)
TUndoManager::manager()->add(
new UndoPickRGBM(palette, styleId, m_currentValue, level));
setCurrentColor(m_currentValue);
if (level) {
std::vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level, fids);
}
}
m_makePick = false;
}
示例15: updateLevel
void updateLevel()
{
TTool::Application *app = TTool::getApplication();
if (!app->getCurrentLevel()->getLevel())
return;
TXshSimpleLevelP xl = app->getCurrentLevel()->getLevel()->getSimpleLevel();
if (app->getCurrentFrame()->getFrameType() != TFrameHandle::LevelFrame)
return;
TFrameId fid = app->getCurrentFrame()->getFid();
TVectorImageP src = xl->getFrame(fid, true);
int count = src->getStrokeCount();
for (int i = 1; i < 10; i++) {
++fid;
if (!xl->isFid(fid)) {
TVectorImageP vi = new TVectorImage();
xl->setFrame(fid, vi);
}
TVectorImageP vi = xl->getFrame(fid, true);
TVectorImageP dst = src->clone();
deform(dst.getPointer(), src.getPointer(), (double)i / (double)9);
count = dst->getStrokeCount();
vi->mergeImage(dst, TAffine());
app->getCurrentTool()->getTool()->notifyImageChanged(fid);
}
}