//------------------------------------------------------------------------- void QGuidoItemContainer::loadFromMimeData( const QMimeData * mimeData ) { load( mimeData ); if ( mimeData->hasFormat(GMN_CONTAINER_MIME_PROPORTIONAL_ON) ) mIsProportionalOn = mimeData->data( GMN_CONTAINER_MIME_PROPORTIONAL_ON ).toInt(); else mIsProportionalOn = DEFAULT_PROPORTIONAL; if ( mimeData->hasFormat(GMN_CONTAINER_MIME_OPTIMAL_PAGE_FILL_ON) ) mIsOptimalPageFillOn = mimeData->data( GMN_CONTAINER_MIME_OPTIMAL_PAGE_FILL_ON ).toInt(); else mIsOptimalPageFillOn = DEFAULT_OPTIMAL_PAGE_FILL; if ( mimeData->hasFormat(GMN_CONTAINER_MIME_RESIZE_PAGE_ON) ) setResizePageToMusic( mimeData->data( GMN_CONTAINER_MIME_RESIZE_PAGE_ON ).toInt() ); else setResizePageToMusic( DEFAULT_RESIZE_PAGE ); if ( mimeData->hasFormat( GMN_CONTAINER_MIME_SCALE ) ) { float scale = mimeData->data( GMN_CONTAINER_MIME_SCALE ).toDouble(); resize( scale , scale ); } updateLayoutSettings(); mGuidoItem->setGridWidth( mimeData->data( GMN_CONTAINER_MIME_GRID_WIDTH ).toInt() ); mGuidoItem->setGridHeight( mimeData->data( GMN_CONTAINER_MIME_GRID_HEIGHT ).toInt() ); setCurrentPage( mimeData->data( GMN_CONTAINER_MIME_PAGE_INDEX ).toInt() ); }
//------------------------------------------------------------------------- void QGuidoItemContainer::loadFromOtherContainer( const QGuidoItemContainer * otherContainer ) { setResizePageToMusic( otherContainer->mGuidoItem->isResizePageToMusic() ); load( otherContainer ); mIsOptimalPageFillOn = otherContainer->mIsOptimalPageFillOn; mIsProportionalOn = otherContainer->mIsProportionalOn; mGuidoItem->scale( otherContainer->mGuidoItem->transform().m11() , otherContainer->mGuidoItem->transform().m22() ); updateLayoutSettings(); mGuidoItem->setGridWidth(otherContainer->mGuidoItem->gridWidth()); mGuidoItem->setGridHeight(otherContainer->mGuidoItem->gridHeight()); setCurrentPage( otherContainer->mGuidoItem->firstVisiblePage()); }
//------------------------------------------------------------------------- void QGuidoItemContainer::loadFromOtherContainer( const QGuidoItemContainer * otherContainer ) { setResizePageToMusic( otherContainer->mGuidoItem->isResizePageToMusicOn() ); load( otherContainer ); mIsOptimalPageFillOn = otherContainer->mIsOptimalPageFillOn; mIsProportionalRenderingOn = otherContainer->mIsProportionalRenderingOn; float xs = otherContainer->mGuidoItem->transform().m11(); float ys = otherContainer->mGuidoItem->transform().m22(); float newscale = (xs > ys ? xs : ys) * mGuidoItem->scale(); mGuidoItem->setScale( newscale ); // mGuidoItem->scale( otherContainer->mGuidoItem->transform().m11() , otherContainer->mGuidoItem->transform().m22() ); // mGuidoItem->setTransform(QTransform::fromScale(xs, ys), true); updateLayoutSettings(); mGuidoItem->setGridWidth(otherContainer->mGuidoItem->gridWidth()); mGuidoItem->setGridHeight(otherContainer->mGuidoItem->gridHeight()); setCurrentPage( otherContainer->mGuidoItem->firstVisiblePage()); }
//------------------------------------------------------------------------- void QGuidoItemContainer::loadFromDomElement( const QDomElement * e) { if ( e->tagName() != DOM_LANGUAGE_ITEM ) return; mIsProportionalOn = QVariant( e->attribute( DOM_GUIDO_ITEM_PROPORTIONAL_LAYOUT, "#DEFAULT_PROPORTIONAL" ) ).toBool(); mIsOptimalPageFillOn = QVariant( e->attribute( DOM_GUIDO_ITEM_OPTIMAL_PAGE_FILL, "#DEFAULT_OPTIMAL_PAGE_FILL" ) ).toBool(); setResizePageToMusic( QVariant( e->attribute( DOM_GUIDO_ITEM_RESIZE_PAGE_ON, "#DEFAULT_RESIZE_PAGE" ) ).toBool() ); load( e ); float scale = QVariant( e->attribute( DOM_GUIDO_ITEM_SCALE, "1" ) ).toDouble(); resize( scale , scale ); updateLayoutSettings(); int currentPage = QVariant( e->attribute( DOM_GUIDO_ITEM_CURRENT_PAGE, "1" ) ).toInt(); int gridWidth = QVariant( e->attribute( DOM_GUIDO_ITEM_GRID_WIDTH, "1" ) ).toInt(); int gridHeight = QVariant( e->attribute( DOM_GUIDO_ITEM_GRID_HEIGHT, "1" ) ).toInt(); mGuidoItem->setGridWidth(gridWidth); mGuidoItem->setGridHeight(gridHeight); setCurrentPage( currentPage ); }
//------------------------------------------------------------------------- void QGuidoItemContainer::setProportional(bool isProportionalOn) { mIsProportionalOn = isProportionalOn; updateLayoutSettings(); }
//------------------------------------------------------------------------- void QGuidoItemContainer::setOptimalPageFill(bool isOptimalPageFillOn) { mIsOptimalPageFillOn = isOptimalPageFillOn; updateLayoutSettings(); }