X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fwidgets%2Fqg_graphicview.cpp;h=7c0b632076f5eb2281be0f3a53edb0e20343c952;hb=be33e866f2121c48db93e06d743c5ae3826c1948;hp=b7d010ca178f4b2f4ebce28c3842c35a7e19ac20;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/widgets/qg_graphicview.cpp b/src/widgets/qg_graphicview.cpp index b7d010c..7c0b632 100644 --- a/src/widgets/qg_graphicview.cpp +++ b/src/widgets/qg_graphicview.cpp @@ -19,7 +19,10 @@ #include "rs_actionzoomscroll.h" #include "rs_actionmodifydelete.h" #include "rs_actionselectsingle.h" -#include "rs_graphic.h" +#include "rs_dialogfactory.h" +#include "graphicview.h" +#include "rs_preview.h" +#include "drawing.h" #include "settings.h" #include "rs_system.h" #include "rs_patternlist.h" @@ -33,26 +36,15 @@ * Constructor. */ QG_GraphicView::QG_GraphicView(QWidget * parent, const char */*name*/, Qt::WindowFlags f): - QWidget(parent, f), RS_GraphicView()//, refCount(0) + QWidget(parent, f), GraphicView()//, refCount(0) { setBackground(background); buffer = NULL; lastWidth = 0; lastHeight = 0; - //coordinateWidget = NULL; - //mouseWidget = NULL; - //optionWidget = NULL; - //cadToolBar = NULL; - //commandWidget = NULL; //hrm. painter = NULL; -// layout = new Q3GridLayout(this, 3, 2); -// layout->setColStretch(0, 1); -// layout->setColStretch(1, 0); -// layout->setColStretch(2, 0); -// layout->setRowStretch(0, 1); -// layout->setRowStretch(1, 0); layout = new QGridLayout(this); layout->setColumnStretch(0, 1); layout->setColumnStretch(1, 0); @@ -89,36 +81,26 @@ A non-zero alignment indicates that the widget should not grow to fill the avail #ifndef __APPLE__ // Mouse Cursors: QBitmap bmp; -// QPixmap cur1(cur_cad_bmp_xpm); -// bmp = QPixmap(cur_cad_mask_xpm); QPixmap cur1(":/res/cur_cad_bmp.xpm"); bmp = QPixmap(":/res/cur_cad_mask.xpm"); cur1.setMask(bmp); curCad = new QCursor(cur1, 15, 15); -// QPixmap cur2(cur_glass_bmp_xpm); -// bmp = QPixmap(cur_glass_mask_xpm); QPixmap cur2(":/res/cur_glass_bmp.xpm"); bmp = QPixmap(":/res/cur_glass_mask.xpm"); cur2.setMask(bmp); curMagnifier = new QCursor(cur2, 12, 12); -// QPixmap cur3(cur_del_bmp_xpm); -// bmp = QPixmap(cur_del_mask_xpm); QPixmap cur3(":/res/cur_del_bmp.xpm"); bmp = QPixmap(":/res/cur_del_mask.xpm"); cur3.setMask(bmp); curDel = new QCursor(cur3, 15, 15); -// QPixmap cur4(cur_select_bmp_xpm); -// bmp = QPixmap(cur_select_mask_xpm); QPixmap cur4(":/res/cur_select_bmp.xpm"); bmp = QPixmap(":/res/cur_select_mask.xpm"); cur4.setMask(bmp); curSelect = new QCursor(cur4, 15, 15); -// QPixmap cur5(cur_hand_bmp_xpm); -// bmp = QPixmap(cur_hand_mask_xpm); QPixmap cur5(":/res/cur_hand_bmp.xpm"); bmp = QPixmap(":/res/cur_hand_mask.xpm"); cur5.setMask(bmp); @@ -191,110 +173,12 @@ int QG_GraphicView::getHeight() return height() - hScrollBar->sizeHint().height(); } -/** - * Creates a new painter for the buffer of this widget and returns a - * pointer to it. The class variable 'painter' also - * points to that object. - */ -//'painter' is NOT a class variable! -//RS_Painter * QG_GraphicView::createPainter() -PaintInterface * QG_GraphicView::createPainter() -{ -#if 1 - return NULL; -#else -//RS_DEBUG->print(RS_Debug::D_CRITICAL, "QG_GraphicView::createPainter called..."); - RS_DEBUG->print("QG_GraphicView::createPainter begin"); - - if (lastWidth != getWidth() || lastHeight != getHeight()) - { - destroyPainter(); - - if (buffer != NULL) - { - delete buffer; - buffer = NULL; - } - - lastWidth = getWidth(); - lastHeight = getHeight(); - } - - if (buffer == NULL) - { - //RS_DEBUG->timestamp(); - RS_DEBUG->print("creating buffer: %d,%d", getWidth(), getHeight()); - buffer = new QPixmap(getWidth(), getHeight()); - RS_DEBUG->print("ok"); - } - - if (painter == NULL) - { - painter = new RS_PainterQt(buffer); - painter->setDrawingMode(drawingMode); - ((RS_PainterQt *)painter)->setBackgroundMode(Qt::OpaqueMode); - ((RS_PainterQt *)painter)->setBackgroundColor(background); - ((RS_PainterQt *)painter)->eraseRect(0, 0, getWidth(), getHeight()); - - //RS_DEBUG->timestamp(); - } - - RS_DEBUG->print("QG_GraphicView::createPainter end"); - - return painter; -#endif -} - -/** - * Creates a new painter for this widget and returns a - * pointer to it. The class variable 'painter' also - * automatically points to that object. - */ -//RS_Painter * QG_GraphicView::createDirectPainter() -PaintInterface * QG_GraphicView::createDirectPainter() -{ -#if 1 - return NULL; -#else -//RS_DEBUG->print(RS_Debug::D_CRITICAL, "QG_GraphicView::createDirectPainter called..."); - RS_DEBUG->print("QG_GraphicView::createDirectPainter begin"); - - destroyPainter(); - painter = new RS_PainterQt(this); - painter->setDrawingMode(drawingMode); - - RS_DEBUG->print("QG_GraphicView::createDirectPainter end"); - - return painter; -#endif -} - -/** - * Deletes the painter. - */ -void QG_GraphicView::destroyPainter() -{ -#if 1 - return; -#else - RS_DEBUG->print("QG_GraphicView::destroyPainter begin"); - - if (painter != NULL) - { - delete painter; - painter = NULL; - } - - RS_DEBUG->print("QG_GraphicView::destroyPainter end"); -#endif -} - /** * Changes the current background color of this view. */ void QG_GraphicView::setBackground(const RS_Color & bg) { - RS_GraphicView::setBackground(bg); + GraphicView::setBackground(bg); // setBackgroundColor(bg); QPalette palette; @@ -477,14 +361,14 @@ void QG_GraphicView::mousePressEvent(QMouseEvent * e) if (e->button() == Qt::MidButton /*|| (e->state()==Qt::LeftButton|Qt::AltButton)*/) setCurrentAction(new RS_ActionZoomPan(*container, *this)); - RS_GraphicView::mousePressEvent(e); + GraphicView::mousePressEvent(e); QWidget::mousePressEvent(e); } void QG_GraphicView::mouseReleaseEvent(QMouseEvent * e) { RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent"); - RS_GraphicView::mouseReleaseEvent(e); + GraphicView::mouseReleaseEvent(e); //QWidget::mouseReleaseEvent(e); if (!e->isAccepted()) @@ -504,7 +388,7 @@ void QG_GraphicView::mouseMoveEvent(QMouseEvent * e) //RS_DEBUG->print("QG_GraphicView::mouseMoveEvent begin"); //QMouseEvent rsm = QG_Qt2Rs::mouseEvent(e); - RS_GraphicView::mouseMoveEvent(e); + GraphicView::mouseMoveEvent(e); QWidget::mouseMoveEvent(e); //What kind of cacamamie crap is this??? @@ -595,13 +479,13 @@ void QG_GraphicView::tabletEvent(QTabletEvent * e) void QG_GraphicView::leaveEvent(QEvent * e) { - RS_GraphicView::mouseLeaveEvent(); + GraphicView::mouseLeaveEvent(); QWidget::leaveEvent(e); } void QG_GraphicView::enterEvent(QEvent * e) { - RS_GraphicView::mouseEnterEvent(); + GraphicView::mouseEnterEvent(); QWidget::enterEvent(e); } @@ -613,7 +497,7 @@ void QG_GraphicView::focusOutEvent(QFocusEvent * e) void QG_GraphicView::focusInEvent(QFocusEvent * e) { //printf("-->QG_GraphicView::focusInEvent(): Start. this %s focus...\n", (hasFocus() ? "has" : "DOES NOT HAVE")); - RS_GraphicView::mouseEnterEvent(); + GraphicView::mouseEnterEvent(); QWidget::focusInEvent(e); //printf("-->QG_GraphicView::focusInEvent(): End. this %s focus...\n", (hasFocus() ? "has" : "DOES NOT HAVE")); } @@ -710,12 +594,12 @@ void QG_GraphicView::keyPressEvent(QKeyEvent * e) if (scroll) setCurrentAction(new RS_ActionZoomScroll(direction, *container, *this)); - RS_GraphicView::keyPressEvent(e); + GraphicView::keyPressEvent(e); } void QG_GraphicView::keyReleaseEvent(QKeyEvent * e) { - RS_GraphicView::keyReleaseEvent(e); + GraphicView::keyReleaseEvent(e); } /** @@ -855,6 +739,11 @@ void QG_GraphicView::slotVScrolled(int value) * Handles paint events by redrawing the graphic in this view. * usually that's very fast since we only paint the buffer we * have from the last call.. + * + * This is not true anymore--even if it was true in the first place, which + * seems doubtful to me. Everything is redrawn every time; we need to see if + * relying on Qt do to the clipping is wise or not... Also, we need to clarify + * all rendering paths since they are not all logical or consistent. */ void QG_GraphicView::paintEvent(QPaintEvent *) { @@ -1010,13 +899,13 @@ of VectorWorks & etc. as well... */ void QG_GraphicView::previewUrl(const Q3Url & u) { - //static RS_Graphic* gr = new RS_Graphic(); + //static Drawing* gr = new Drawing(); RS_DEBUG->print("QG_GraphicView::previewUrl"); if (container != NULL && container->rtti() == RS2::EntityGraphic) { - ((RS_Graphic *)container)->open(u.path(), RS2::FormatUnknown); + ((Drawing *)container)->open(u.path(), RS2::FormatUnknown); zoomAuto(); } //setContainer(gr);