/*************************************************************************** * Copyright (C) 2004 by Johan Maes - ON4QZ * * on4qz@telenet.be * * http://users.telenet.be/on4qz * * * * 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; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef EDITORVIEW_H #define EDITORVIEW_H #include #include #include #include #include #include #include "canvasitems.h" #include "mcanvas.h" /** @author Johan Maes - ON4QZ */ class editorForm; enum eactionType {SELECT,COLORPICK,RECTANGLE,ELLIPSE,LINE,IMAGE,TEXT}; /** Widegt to disply the various canvasItems */ class editorView : public QCanvasView { Q_OBJECT public: editorView(QWidget *parent = 0, const char *name = 0); ~editorView(); //void clear(); void setEditorForm(editorForm *e) { ef=e; } void save(QFile &f,bool templ); void open(QFile &f); void setImage(QImage *ima); QImage *getImage(); Qt::BrushStyle getBrushStyle() { return brushStyle;} void setBrushStyle(int i) { brushStyle= (Qt::BrushStyle)i;} QString getFont() { return aFont.toString();} void setFont(QString fontDescr) { aFont.fromString(fontDescr);} void flattenImage(); void setRotate(int); void setShear(double); void setStatusBar(QStatusBar *sp) { sbp=sp; sizingText=new QLabel(sbp); tmpText=new QLabel(sbp); sbp->addWidget(sizingText,0,TRUE); sbp->addWidget(tmpText,0,FALSE); } bool isModified() { return modified;} mcanvas::eImageType getImageType(){return mCanvas->getImageType();} void setCanvasSize(int w,int h) { // mCanvas->resize(w,h); slotChangeSize(QSize(w,h)); } public slots: void slotArrow(); void slotRectangle(); void slotCircle(); void slotColorpicker(); void slotFgColorChanged(QColor c); void slotBgColorChanged(QColor c); void slotText(); void slotPenWidth(int pw); void slotImage(); void slotLine(); void slotDeleteItem(); void slotApplyColors(); void slotChangeFont(); void slotSetBg(); void slotClearAll(); void slotBringToFront(); void slotSendToBack(); void slotLock(); void slotUnlock(); void slotChangeSize(QSize s); void slotCopy(); void slotPaste(); void slotExpand(); void slotHorGradient(); void slotVerGradient(); void slotSelectFont(); void slotTextReturnPressed(const QString &); void slotSendForward(); void slotSendBackward(); signals: void setShearRotate(double,int); void textLoaded(const QString &); private: void contentsMousePressEvent(QMouseEvent* e); void contentsMouseMoveEvent(QMouseEvent* e); void contentsMouseReleaseEvent(QMouseEvent* e); QPoint clickPoint; eactionType actionType; void setupAction(eactionType at); void setupItem(int w=1,int h=1); QFont aFont; int lineWidth; editorForm *ef; QCursor *crsr; QImage im; Qt::BrushStyle brushStyle; void dropEvent(QDropEvent* event); void dragEnterEvent(QDragEnterEvent* event); void checkResizing(); void doSizing(QPoint p); void execSizing(QPoint s,QPoint e); void displaySize(); eSizing sizing; int rotateValue; double shearValue; QString lineEditString; bool modified; QStatusBar *sbp; mcanvas *mCanvas; QLabel *sizingText; QLabel *tmpText; }; #endif