/************************************************************************* Set the current mouse cursor image *************************************************************************/ void MouseCursor::setImage(const Image* image) { d_cursorImage = image; MouseCursorEventArgs args(this); args.image = image; onImageChanged(args); }
/*! 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(); }
void TApp::onObjectSwitched() { if (m_currentObject->isSpline()) { TXsheet *xsh = m_currentXsheet->getXsheet(); TStageObject *currentObject = xsh->getStageObject(m_currentObject->getObjectId()); TStageObjectSpline *ps = currentObject->getSpline(); m_currentObject->setSplineObject(ps); } else m_currentObject->setSplineObject(0); onImageChanged(); }
/************************************************************************* Set the current mouse cursor image *************************************************************************/ void MouseCursor::setImage(const Image* image) { if (image == d_cursorImage) return; d_cursorImage = image; if (image) { d_geometry->reset(); image->draw(*d_geometry, Vector2(0, 0), 0); } MouseCursorEventArgs args(this); args.image = image; onImageChanged(args); }
/*! Notify change of current image: update icon and notify level change. If current object is a spline commit spline chenged. If current mode is EditingLevel touch current frame. */ void TTool::notifyImageChanged() { 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; TFrameId fid = m_application->getCurrentFrame()->getFid(); sl->touchFrame(fid); // sl->setDirtyFlag(true); IconGenerator::instance()->invalidate(sl, fid); IconGenerator::instance()->invalidateSceneIcon(); } else { TXsheet *xsh = m_application->getCurrentXsheet()->getXsheet(); if (!xsh) return; TObjectHandle *currentObject = m_application->getCurrentObject(); if (currentObject->isSpline()) { m_application->getCurrentObject()->commitSplineChanges(); TStageObject *pegbar = xsh->getStageObject(currentObject->getObjectId()); IconGenerator::instance()->invalidate(pegbar->getSpline()); } else { int row = m_application->getCurrentFrame()->getFrame(); int col = m_application->getCurrentColumn()->getColumnIndex(); if (col < 0) return; TXshCell cell = xsh->getCell(row, col); TXshSimpleLevel *sl = cell.getSimpleLevel(); if (sl) { IconGenerator::instance()->invalidate(sl, cell.m_frameId); sl->touchFrame(cell.m_frameId); IconGenerator::instance()->invalidateSceneIcon(); } } } m_application->getCurrentLevel()->notifyLevelChange(); }
TApp::TApp() : m_currentScene(0) , m_currentXsheet(0) , m_currentFrame(0) , m_currentColumn(0) , m_currentLevel(0) , m_currentTool(0) , m_currentObject(0) , m_currentSelection(0) , m_currentOnionSkinMask(0) , m_currentFx(0) , m_mainWindow(0) , m_autosaveTimer(0) , m_autosaveSuspended(false) , m_isStarting(false) , m_isPenCloseToTablet(false) { m_currentScene = new TSceneHandle(); m_currentXsheet = new TXsheetHandle(); m_currentFrame = new TFrameHandle(); m_currentColumn = new TColumnHandle(); m_currentLevel = new TXshLevelHandle(); m_currentTool = new ToolHandle(); m_currentObject = new TObjectHandle(); m_currentOnionSkinMask = new TOnionSkinMaskHandle(); m_currentFx = new TFxHandle(); m_currentSelection = TSelectionHandle::getCurrent(); m_paletteController = new PaletteController(); bool ret = true; ret = ret && QObject::connect(m_currentXsheet, SIGNAL(xsheetChanged()), this, SLOT(onXsheetChanged())); ret = ret && QObject::connect(m_currentXsheet, SIGNAL(xsheetSoundChanged()), this, SLOT(onXsheetSoundChanged())); ret = ret && QObject::connect(m_currentScene, SIGNAL(sceneSwitched()), this, SLOT(onSceneSwitched())); ret = ret && QObject::connect(m_currentScene, SIGNAL(sceneChanged()), this, SLOT(onSceneChanged())); ret = ret && QObject::connect(m_currentXsheet, SIGNAL(xsheetSwitched()), this, SLOT(onXsheetSwitched())); ret = ret && QObject::connect(m_currentFrame, SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); ret = ret && QObject::connect(m_currentFrame, SIGNAL(frameSwitched()), this, SLOT(onImageChanged())); ret = ret && QObject::connect(m_currentFx, SIGNAL(fxSwitched()), this, SLOT(onFxSwitched())); ret = ret && QObject::connect(m_currentColumn, SIGNAL(columnIndexSwitched()), this, SLOT(onColumnIndexSwitched())); ret = ret && QObject::connect(m_currentColumn, SIGNAL(columnIndexSwitched()), this, SLOT(onImageChanged())); ret = ret && QObject::connect(m_currentLevel, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onImageChanged())); ret = ret && QObject::connect(m_currentLevel, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onXshLevelSwitched(TXshLevel *))); ret = ret && QObject::connect(m_currentLevel, SIGNAL(xshLevelChanged()), this, SLOT(onXshLevelChanged())); ret = ret && QObject::connect(m_currentObject, SIGNAL(objectSwitched()), this, SLOT(onObjectSwitched())); ret = ret && QObject::connect(m_currentObject, SIGNAL(splineChanged()), this, SLOT(onSplineChanged())); ret = ret && QObject::connect(m_paletteController->getCurrentLevelPalette(), SIGNAL(paletteChanged()), this, SLOT(onPaletteChanged())); ret = ret && QObject::connect(m_paletteController->getCurrentLevelPalette(), SIGNAL(colorStyleSwitched()), this, SLOT(onLevelColorStyleSwitched())); ret = ret && QObject::connect(m_paletteController->getCurrentLevelPalette(), SIGNAL(colorStyleChangedOnMouseRelease()), this, SLOT(onLevelColorStyleChanged())); ret = ret && QObject::connect(m_paletteController->getCurrentCleanupPalette(), SIGNAL(paletteChanged()), m_currentScene, SIGNAL(sceneChanged())); TMeasureManager::instance()->addCameraMeasures(getCurrentCameraSize); m_autosaveTimer = new QTimer(this); ret = ret && connect(m_autosaveTimer, SIGNAL(timeout()), this, SLOT(autosave())); Preferences *preferences = Preferences::instance(); if (preferences->isRasterOptimizedMemory()) { if (!TBigMemoryManager::instance()->init( (int)(/*15*1024*/ TSystem::getFreeMemorySize(true) * .8))) DVGui::warning(tr("Error allocating memory: not enough memory.")); } ret = ret && connect(preferences, SIGNAL(stopAutoSave()), SLOT(onStopAutoSave())); ret = ret && connect(preferences, SIGNAL(startAutoSave()), SLOT(onStartAutoSave())); ret = ret && connect(m_currentTool, SIGNAL(toolEditingFinished()), SLOT(onToolEditingFinished())); if (preferences->isAutosaveEnabled()) m_autosaveTimer->start(preferences->getAutosavePeriod() * 1000 * 60); UnitParameters::setCurrentDpiGetter(getCurrentDpi); assert(ret); }