X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fwidgets%2Fqg_graphicview.cpp;h=6b4e1fba93f4a276afd2f8f0bc2b45610f28e1ff;hb=5adb444f3e523d3fd028617ced72d1ea6661db21;hp=963738c4d09c2274a61002589eb971c6c6d91fbc;hpb=af32602b9d8075080d5805143f1cd47fc10672e1;p=architektonas diff --git a/src/widgets/qg_graphicview.cpp b/src/widgets/qg_graphicview.cpp index 963738c..6b4e1fb 100644 --- a/src/widgets/qg_graphicview.cpp +++ b/src/widgets/qg_graphicview.cpp @@ -24,14 +24,14 @@ #include "actionmodifydelete.h" #include "actionselectsingle.h" #include "cadtoolbar.h" -#include "rs_dialogfactory.h" +#include "dialogfactory.h" #include "drawing.h" #include "graphicview.h" -#include "rs_patternlist.h" +#include "patternlist.h" #include "paintinterface.h" -#include "rs_preview.h" +#include "preview.h" #include "settings.h" -#include "rs_system.h" +#include "system.h" #define QG_SCROLLMARGIN 400 @@ -41,26 +41,26 @@ QG_GraphicView::QG_GraphicView(QWidget * parent, const char */*name*/, Qt::WindowFlags f): QWidget(parent, f), GraphicView()//, refCount(0) { - RS_DEBUG->print("QG_GraphicView::QG_GraphicView(parent, name, flags)..."); + DEBUG->print("QG_GraphicView::QG_GraphicView(parent, name, flags)..."); CommonInitialization(); } /** * Constructor II. */ -QG_GraphicView::QG_GraphicView(RS_Document * doc, QWidget * parent) +QG_GraphicView::QG_GraphicView(Document * doc, QWidget * parent) { // QG_GraphicView(parent, "graphicview"); CommonInitialization(); - RS_DEBUG->print("QG_GraphicView::QG_GraphicView(doc, parent)..."); + DEBUG->print("QG_GraphicView::QG_GraphicView(doc, parent)..."); //document = doc; - RS_DEBUG->print(" Setting Container..."); + DEBUG->print(" Setting Container..."); if (doc) setContainer(doc); - RS_DEBUG->print(" container set."); + DEBUG->print(" container set."); setFactorX(4.0); setFactorY(4.0); setOffset(50, 50); @@ -79,7 +79,7 @@ void QG_GraphicView::CommonInitialization(void) //hrm. painter = NULL; - RS_DEBUG->print("--> Setting up layout..."); + DEBUG->print("--> Setting up layout..."); QGridLayout * layout = new QGridLayout(this); layout->setColumnStretch(0, 1); layout->setColumnStretch(1, 0); @@ -95,7 +95,7 @@ Alignment is specified by alignment, which is a bitwise OR of Qt::AlignmentFlags A non-zero alignment indicates that the widget should not grow to fill the available space but should be sized according to sizeHint(). */ - RS_DEBUG->print("--> Creating hScrollBar..."); + DEBUG->print("--> Creating hScrollBar..."); // hScrollBar = new QG_ScrollBar(Qt::Horizontal, this); hScrollBar = new QScrollBar(Qt::Horizontal, this); // hScrollBar->setLineStep(50); @@ -105,7 +105,7 @@ A non-zero alignment indicates that the widget should not grow to fill the avail // layout->addRowSpacing(1, hScrollBar->sizeHint().height()); layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0); - RS_DEBUG->print("--> Creating vScrollBar..."); + DEBUG->print("--> Creating vScrollBar..."); // vScrollBar = new QG_ScrollBar(Qt::Vertical, this); vScrollBar = new QScrollBar(Qt::Vertical, this); // vScrollBar->setLineStep(50); @@ -213,7 +213,7 @@ int QG_GraphicView::getHeight() /** * Changes the current background color of this view. */ -void QG_GraphicView::setBackground(const RS_Color & bg) +void QG_GraphicView::setBackground(const Color & bg) { GraphicView::setBackground(bg); @@ -330,7 +330,7 @@ void QG_GraphicView::updateGridStatusWidget(const QString & text) */ void QG_GraphicView::redraw() { - RS_DEBUG->print("QG_GraphicView::redraw begin 1"); + DEBUG->print("QG_GraphicView::redraw begin 1"); if (simulationRunning) return; @@ -344,7 +344,7 @@ void QG_GraphicView::redraw() if (!running) { running = true; - RS_DEBUG->print("QG_GraphicView::redraw begin 2"); + DEBUG->print("QG_GraphicView::redraw begin 2"); /* This is the only place in the entire codebase that a proper update is @@ -354,20 +354,20 @@ triggered. // repaint(false); update(); - RS_DEBUG->print("QG_GraphicView::redraw end 2"); + DEBUG->print("QG_GraphicView::redraw end 2"); running = false; } - RS_DEBUG->print("QG_GraphicView::redraw end 1"); + DEBUG->print("QG_GraphicView::redraw end 1"); } void QG_GraphicView::resizeEvent(QResizeEvent * /*e*/) { - RS_DEBUG->print("QG_GraphicView::resizeEvent begin"); + DEBUG->print("QG_GraphicView::resizeEvent begin"); adjustOffsetControls(); adjustZoomControls(); updateGrid(); - RS_DEBUG->print("QG_GraphicView::resizeEvent end"); + DEBUG->print("QG_GraphicView::resizeEvent end"); } /* @@ -377,18 +377,18 @@ This could be easily called from whoever calls this crap. And so... We remove it. */ #if 0 -// Next three methods from RS_LayerListListener Interface: -void QG_GraphicView::layerEdited(RS_Layer *) +// Next three methods from LayerListListener Interface: +void QG_GraphicView::layerEdited(Layer *) { redraw(); } -void QG_GraphicView::layerRemoved(RS_Layer *) +void QG_GraphicView::layerRemoved(Layer *) { redraw(); } -void QG_GraphicView::layerToggled(RS_Layer *) +void QG_GraphicView::layerToggled(Layer *) { redraw(); } @@ -412,7 +412,7 @@ void QG_GraphicView::mousePressEvent(QMouseEvent * e) void QG_GraphicView::mouseReleaseEvent(QMouseEvent * e) { - RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent"); + DEBUG->print("QG_GraphicView::mouseReleaseEvent"); GraphicView::mouseReleaseEvent(e); //QWidget::mouseReleaseEvent(e); @@ -420,12 +420,12 @@ void QG_GraphicView::mouseReleaseEvent(QMouseEvent * e) { if (QG_DIALOGFACTORY && QG_DIALOGFACTORY->getCadToolBar()) { - RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent: fwd to cadtoolbar"); + DEBUG->print("QG_GraphicView::mouseReleaseEvent: fwd to cadtoolbar"); QG_DIALOGFACTORY->getCadToolBar()->mouseReleaseEvent(e); } } - RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent: OK"); + DEBUG->print("QG_GraphicView::mouseReleaseEvent: OK"); } void QG_GraphicView::mouseMoveEvent(QMouseEvent * e) @@ -541,7 +541,7 @@ void QG_GraphicView::focusInEvent(QFocusEvent * e) */ void QG_GraphicView::wheelEvent(QWheelEvent * e) { - //RS_DEBUG->print("wheel: %d", e->delta()); + //DEBUG->print("wheel: %d", e->delta()); //printf("state: %d\n", e->state()); //printf("ctrl: %d\n", Qt::ControlButton); @@ -647,7 +647,7 @@ void QG_GraphicView::adjustOffsetControls() running = true; - RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() begin"); + DEBUG->print("QG_GraphicView::adjustOffsetControls() begin"); if (!container || !hScrollBar || !vScrollBar) return; @@ -695,14 +695,14 @@ void QG_GraphicView::adjustOffsetControls() slotHScrolled(-ox); slotVScrolled(oy); - RS_DEBUG->print("H min: %d / max: %d / step: %d / value: %d\n", + DEBUG->print("H min: %d / max: %d / step: %d / value: %d\n", hScrollBar->minimum(), hScrollBar->maximum(), hScrollBar->pageStep(), ox); - RS_DEBUG->print("V min: %d / max: %d / step: %d / value: %d\n", + DEBUG->print("V min: %d / max: %d / step: %d / value: %d\n", vScrollBar->minimum(), vScrollBar->maximum(), vScrollBar->pageStep(), oy); enableUpdate(); - RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() end"); + DEBUG->print("QG_GraphicView::adjustOffsetControls() end"); running = false; } @@ -726,7 +726,7 @@ void QG_GraphicView::slotHScrolled(int value) //static int running = false; //if (!running) { //running = true; - ////RS_DEBUG->print("value x: %d\n", value); + ////DEBUG->print("value x: %d\n", value); if (hScrollBar->maximum() == hScrollBar->minimum()) centerOffsetX(); else @@ -752,7 +752,7 @@ void QG_GraphicView::slotVScrolled(int value) //static int running = false; //if (!running) { //running = true; - ////RS_DEBUG->print("value y: %d\n", value); + ////DEBUG->print("value y: %d\n", value); if (vScrollBar->maximum() == vScrollBar->minimum()) centerOffsetY(); else @@ -779,7 +779,7 @@ void QG_GraphicView::slotVScrolled(int value) */ void QG_GraphicView::paintEvent(QPaintEvent *) { - RS_DEBUG->print("QG_GraphicView::paintEvent begin"); + DEBUG->print("QG_GraphicView::paintEvent begin"); if (simulationRunning) return; @@ -825,8 +825,11 @@ of VectorWorks & etc. as well... // Draw the snapper first, because we want to be able to see the preview on // top of this... - if (snapper.Visible()) - snapper.Draw(this, painter); +// if (snapper.Visible()) +// snapper.Draw(this, painter); + // Actually, this code can go into drawIt() instead of here... + if (snapperVisible) + DrawSnapper(painter); if (preview.Visible()) preview.Draw(this, painter); @@ -834,5 +837,5 @@ of VectorWorks & etc. as well... delete painter; painter = NULL; - RS_DEBUG->print("QG_GraphicView::paintEvent end"); + DEBUG->print("QG_GraphicView::paintEvent end"); }