/* * MathPlanner 3.2 - Mathematical design tool. * Copyright(C) 2003 Jarmo Nikkanen * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation. * * You should have received a copy of the GNU General Public License with this program. * */ PaperQPicture::~PaperQPicture() { if (pixmap) delete pixmap; } PaperQPicture::PaperQPicture(DataStorage *msg,ApplicationControl *a,Paper *p) :MathFrame(msg,a,p) { pixmap=NULL; Enable(true,true,false); SetColor(QColor(0,0,255)); empty=false; QByteArray ba=msg->ReadQByteArray("image"); pixmap=QPictureDragObject::Decode(ba); } DataStorage *PaperQPicture::BuildStorage() { DataStorage *msg=MathFrame::BuildStorage(); QPictureDragObject ido(pixmap); msg->AddQByteArray("image",ido.encodedData("QPicture")); return(msg); } QPicture *PaperQPicture::Picture() { return(pixmap); } PaperQPicture::PaperQPicture(QPicture *b,ApplicationControl *a,Paper *p) :MathFrame(PAPER_OBJECT_QPICTURE,QRect(0,0,100,100),a,p) { pixmap=NULL; Enable(true,true,false); SetColor(QColor(0,0,255)); empty=false; pixmap=b; } void PaperQPicture::SetBounds(QRect r) { MathFrame::SetBounds(r); } void PaperQPicture::CalculateBounds() { MathFrame::CalculateBounds(); resizerect.setSize(QSize(10,10)); resizerect.moveBottomRight(bounds.bottomRight()); } void PaperQPicture::MousePressed(QPoint p) { } void PaperQPicture::Draw(QPainter *paint) { //QRect wi=paint->window(); //QRect vp=paint->viewport(); int zoom=100; //AppControl->ZoomFactor(); int x=bounds.left()*zoom/100; int y=bounds.top()*zoom/100; int w=bounds.width()*zoom/100; int h=bounds.height()*zoom/100; paint->save(); QRect bo=pixmap->boundingRect(); paint->setWindow(bo); paint->setViewport(bounds); pixmap->play(paint); paint->restore(); MathFrame::Draw(paint); }