bool TupProject::removeSymbolFromFrame(const QString &name, TupLibraryObject::Type type) { #ifdef K_DEBUG QString msg = "TupProject::removeSymbolFromFrame() - Removing symbol " + name + " from project..."; #ifdef Q_OS_WIN qDebug() << msg; #else T_FUNCINFO << msg; #endif #endif if (type == TupLibraryObject::Folder) return true; int totalScenes = k->scenes.size(); for (int i = 0; i < totalScenes; i++) { TupScene *scene = k->scenes.at(i); int totalLayers = scene->layers().size(); for (int j = 0; j < totalLayers; j++) { TupLayer *layer = scene->layers().at(j); int totalFrames = layer->frames().size(); for (int t = 0; t < totalFrames; t++) { TupFrame *frame = layer->frames().at(t); if (type != TupLibraryObject::Svg) frame->removeImageItemFromFrame(name); else frame->removeSvgItemFromFrame(name); } } TupBackground *bg = scene->background(); if (bg) { TupFrame *frame = bg->staticFrame(); if (frame) { if (type == TupLibraryObject::Svg) frame->removeSvgItemFromFrame(name); else frame->removeImageItemFromFrame(name); } frame = bg->dynamicFrame(); if (frame) { if (type == TupLibraryObject::Svg) frame->removeSvgItemFromFrame(name); else frame->removeImageItemFromFrame(name); } } } // k->library->removeObject(name, true); return true; }
bool TupProject::removeSymbol(const QString &name, TupLibraryObject::Type type) { #ifdef K_DEBUG #ifdef Q_OS_WIN qDebug() << "[TupProject::removeSymbol()]"; #else T_FUNCINFO; #endif #endif int totalScenes = k->scenes.size(); for (int i = 0; i < totalScenes; i++) { TupScene *scene = k->scenes.at(i); TupBackground *bg = scene->background(); if (bg) { TupFrame *frame = bg->staticFrame(); if (frame) { if (type != TupLibraryObject::Svg) frame->removeImageItemFromFrame(name); else frame->removeSvgItemFromFrame(name); } frame = bg->dynamicFrame(); if (frame) { if (type != TupLibraryObject::Svg) frame->removeImageItemFromFrame(name); else frame->removeSvgItemFromFrame(name); } } int totalLayers = scene->layers().size(); for (int j = 0; j < totalLayers; j++) { TupLayer *layer = scene->layers().at(j); int totalFrames = layer->frames().size(); for (int t = 0; t < totalFrames; t++) { TupFrame *frame = layer->frames().at(t); if (type != TupLibraryObject::Svg) frame->removeImageItemFromFrame(name); else frame->removeSvgItemFromFrame(name); } } } return k->library->removeObject(name, true); }
bool TupProject::updateSymbolId(TupLibraryObject::Type type, const QString &oldId, const QString &newId) { int scenesCount = k->scenes.size(); for (int i = 0; i < scenesCount; i++) { TupScene *scene = k->scenes.at(i); int layersCount = scene->layers().size(); for (int j = 0; j < layersCount; j++) { TupLayer *layer = scene->layers().at(j); int framesCount = layer->frames().size(); for (int t = 0; t < framesCount; t++) { TupFrame *frame = layer->frames().at(t); if (type != TupLibraryObject::Svg) frame->updateIdFromFrame(oldId, newId); else frame->updateSvgIdFromFrame(oldId, newId); } } TupBackground *bg = scene->background(); if (bg) { TupFrame *frame = bg->staticFrame(); if (frame) { if (type != TupLibraryObject::Svg) frame->updateIdFromFrame(oldId, newId); else frame->updateSvgIdFromFrame(oldId, newId); } frame = bg->dynamicFrame(); if (frame) { if (type != TupLibraryObject::Svg) frame->updateIdFromFrame(oldId, newId); else frame->updateSvgIdFromFrame(oldId, newId); } } } return true; }
void TupProject::reloadLibraryItem(TupLibraryObject::Type type, const QString &id, TupLibraryObject *object) { int scenesCount = k->scenes.size(); for (int i = 0; i < scenesCount; i++) { TupScene *scene = k->scenes.at(i); int layersCount = scene->layers().size(); for (int j = 0; j < layersCount; j++) { TupLayer *layer = scene->layers().at(j); int framesCount = layer->frames().size(); for (int t = 0; t < framesCount; t++) { TupFrame *frame = layer->frames().at(t); if (type == TupLibraryObject::Svg) frame->reloadSVGItem(id, object); else frame->reloadGraphicItem(id, object->dataPath()); } } TupBackground *bg = scene->background(); if (bg) { TupFrame *frame = bg->staticFrame(); if (frame) { if (type == TupLibraryObject::Svg) frame->reloadSVGItem(id, object); else frame->reloadGraphicItem(id, object->dataPath()); } frame = bg->dynamicFrame(); if (frame) { if (type == TupLibraryObject::Svg) frame->reloadSVGItem(id, object); else frame->reloadGraphicItem(id, object->dataPath()); } } } }