src/mainapp/createqtactions.h \
src/mainapp/qc_dialogfactory.h \
src/mainapp/graphicview.h \
- src/mainapp/qc_graphicview.h \
src/mainapp/main.h \
src/mainapp/mdiwindow.h \
src/mainapp/settings.h
src/mainapp/createqtactions.cpp \
src/mainapp/qc_dialogfactory.cpp \
src/mainapp/graphicview.cpp \
- src/mainapp/qc_graphicview.cpp \
src/mainapp/main.cpp \
src/mainapp/mdiwindow.cpp \
src/mainapp/settings.cpp
tbSelect(NULL), tbPolylines(NULL)
{
ui.setupUi(this);
-//hm. here maybe?
+//hm. here maybe? Yesh!
if (parent)
((QToolBar *)parent)->addWidget(this);
}
*/
void CadToolBar::forceNext()
{
- if (currentTb != NULL && currentTb == tbSelect)
+ if (currentTb && currentTb == tbSelect)
tbSelect->runNextAction();
}
actionHandler = ah;
tbMain = new CadToolBarMain(this);
tbMain->setCadToolBar(this);
+ currentTb = tbMain;
tbPoints = new CadToolBarPoints(this);
tbPoints->setCadToolBar(this);
tbSplines->setCadToolBar(this);
tbSplines->hide();
-//#ifdef RS_PROF
tbPolylines = new CadToolBarPolylines(this);
tbPolylines->setCadToolBar(this);
tbPolylines->hide();
-//#endif
tbDim = new CadToolBarDim(this);
tbDim->setCadToolBar(this);
tbSelect = new CadToolBarSelect(this);
tbSelect->setCadToolBar(this);
tbSelect->hide();
-
- //showToolBarMain();
}
void CadToolBar::showToolBar(int id)
case RS2::ToolBarSplines:
newTb = tbSplines;
break;
-//#ifdef RS_PROF
case RS2::ToolBarPolylines:
newTb = tbPolylines;
break;
-//#endif
case RS2::ToolBarCircles:
newTb = tbCircles;
break;
if (currentTb == newTb)
return;
- if (currentTb != NULL)
+ if (currentTb)
currentTb->hide();
currentTb = newTb;
- if (currentTb != NULL)
+ if (currentTb)
currentTb->show();
}
{
}
-/*void CadToolBarLines::mousePressEvent(QMouseEvent* e) {
- if (e->button()==RightButton && cadToolBar != NULL) {
- cadToolBar->back();
- e->accept();
- }
-}*/
-
void CadToolBarLines::contextMenuEvent(QContextMenuEvent * e)
{
e->accept();
if (tb)
ah = tb->getActionHandler();
else
- RS_DEBUG->print(RS_Debug::D_ERROR, "QG_CadToolBarMain::setCadToolBar(): No valid toolbar set.");
+ RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarMain::setCadToolBar(): No valid toolbar set.");
if (ah)
{
connect(ui.bMenuSelect, SIGNAL(clicked()), tb, SLOT(showToolBarSelect()));
}
else
- {
- RS_DEBUG->print(RS_Debug::D_ERROR, "QG_CadToolBarMain::setCadToolBar(): No valid action handler set.");
- }
+ RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarMain::setCadToolBar(): No valid action handler set.");
}
#include "qg_actionhandler.h"
#include "rs_debug.h"
-CadToolBarModify::CadToolBarModify(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+CadToolBarModify::CadToolBarModify(QWidget * parent /*= 0*/, Qt::WindowFlags flags /*= 0*/):
QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
{
ui.setupUi(this);
}
}
-void CadToolBarModify::contextMenuEvent(QContextMenuEvent *e) {
+void CadToolBarModify::contextMenuEvent(QContextMenuEvent *e)
+{
e->accept();
}
{
cadToolBar = tb;
- if (tb!=NULL) {
+ if (tb != NULL)
actionHandler = tb->getActionHandler();
- } else {
+ else
RS_DEBUG->print(RS_Debug::D_ERROR,
"CadToolBarModify::setCadToolBar(): No valid toolbar set.");
- }
}
-void CadToolBarModify::modifyMove() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyMove()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyMove();
- }
}
-void CadToolBarModify::modifyRotate() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyRotate()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyRotate();
- }
}
-void CadToolBarModify::modifyScale() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyScale()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyScale();
- }
}
-void CadToolBarModify::modifyMirror() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyMirror()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyMirror();
- }
}
-void CadToolBarModify::modifyMoveRotate() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyMoveRotate()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyMoveRotate();
- }
}
-void CadToolBarModify::modifyRotate2() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyRotate2()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyRotate2();
- }
}
-void CadToolBarModify::modifyTrim() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyTrim()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyTrim();
- }
}
-void CadToolBarModify::modifyTrim2() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyTrim2()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyTrim2();
- }
}
-void CadToolBarModify::modifyTrimAmount() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyTrimAmount()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyTrimAmount();
- }
}
-void CadToolBarModify::modifyCut() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyCut()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyCut();
- }
}
-void CadToolBarModify::modifyBevel() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyBevel()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyBevel();
- }
}
-void CadToolBarModify::modifyRound() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyRound()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyRound();
- }
}
-void CadToolBarModify::modifyEntity() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyEntity()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyEntity();
- }
}
-void CadToolBarModify::modifyDelete() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyDelete()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyDelete();
- }
}
-void CadToolBarModify::modifyAttributes() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyAttributes()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyAttributes();
- }
}
-void CadToolBarModify::modifyStretch() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyStretch()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyStretch();
- }
}
-void CadToolBarModify::modifyExplode() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyExplode()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotBlocksExplode();
- }
}
-void CadToolBarModify::modifyExplodeText() {
- if (cadToolBar!=NULL && actionHandler!=NULL) {
+void CadToolBarModify::modifyExplodeText()
+{
+ if (cadToolBar != NULL && actionHandler != NULL)
actionHandler->slotModifyExplodeText();
- }
}
-void CadToolBarModify::back() {
- if (cadToolBar!=NULL) {
+void CadToolBarModify::back()
+{
+ if (cadToolBar != NULL)
cadToolBar->back();
- }
}
+
GraphicView * graphicView = getGraphicView();
RS_Document * document = getDocument();
- if (graphicView != NULL && document != NULL)
+ if (graphicView && document)
{
RS_ActionLibraryInsert * action = new RS_ActionLibraryInsert(*document, *graphicView);
action->setFile(name);
{
GraphicView * graphicView = getGraphicView();
- if (graphicView != NULL)
+ if (graphicView)
graphicView->back();
else
{
- if (cadToolBar != NULL)
+ if (cadToolBar)
cadToolBar->showToolBar(RS2::ToolBarMain);
}
}
*/
void ApplicationWindow::slotEnter()
{
- if (commandWidget == NULL || !commandWidget->checkFocus())
+ if (!commandWidget || !commandWidget->checkFocus())
{
- if (cadToolBar != NULL)
+ if (cadToolBar)
cadToolBar->forceNext();
else
{
GraphicView * graphicView = getGraphicView();
- if (graphicView != NULL)
+ if (graphicView)
graphicView->enter();
}
}
if (m)
RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m->getDoc=%08X", m->getDocument());
- if (m != NULL && m->getDocument() != NULL)
+ if (m && m->getDocument())
{
//m->setWindowState(WindowMaximized);
*/
void ApplicationWindow::redrawAll()
{
- if (workspace != NULL)
+ if (workspace)
{
QList<QMdiSubWindow *> windows = workspace->subWindowList();
{
MDIWindow * m = (MDIWindow *)windows.at(i);
- if (m != NULL)
+ if (m)
{
QG_GraphicView * gv = m->getGraphicView();
- if (gv != NULL)
+ if (gv)
gv->redraw();
}
}
*/
void ApplicationWindow::updateGrids()
{
- if (workspace != NULL)
+ if (workspace)
{
QList<QMdiSubWindow *> windows = workspace->subWindowList();
{
MDIWindow * m = (MDIWindow *)windows.at(i);
- if (m != NULL)
+ if (m)
{
QG_GraphicView * gv = m->getGraphicView();
- if (gv != NULL)
+ if (gv)
gv->updateGrid();
}
}
{
MDIWindow * m = (MDIWindow *)windows.at(i);
- if (m != NULL)
+ if (m)
{
QG_GraphicView * gv = m->getGraphicView();
- if (gv != NULL)
+ if (gv)
{
gv->setBackground(color);
gv->setGridColor(gridColor);
GraphicView * v = getGraphicView();
- if (v != NULL)
+ if (v)
v->redraw();
}
}
*/
void ApplicationWindow::keyPressEvent(QKeyEvent * e)
{
+#warning "!!! keyPressEvent(): Do we need this anymore? !!!"
// timer
static QTime ts = QTime();
static QString firstKey = "";
case Qt::Key_Alt:
case Qt::Key_CapsLock:
{
-// Q3MainWindow::keyPressEvent(e);
QMainWindow::keyPressEvent(e);
// forward to actions:
GraphicView * graphicView = getGraphicView();
- if (graphicView != NULL)
+ if (graphicView)
graphicView->keyPressEvent(e);
e->accept();
// forward to actions:
GraphicView * graphicView = getGraphicView();
- if (graphicView != NULL)
+ if (graphicView)
graphicView->keyReleaseEvent(e);
e->accept();
{
RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::getMDIWindow: workspace=%08X", workspace);
- if (workspace != NULL)
+ if (workspace)
{
RS_DEBUG->print("ApplicationWindow::getMDIWindow: activeSubWindow=%08X", workspace->activeSubWindow());
return (MDIWindow *)workspace->activeSubWindow();
{
MDIWindow * m = getMDIWindow();
- if (m != NULL)
- return m->getGraphicView();
-
- return NULL;
+ return (m ? m->getGraphicView() : NULL);
}
/**
{
MDIWindow * m = getMDIWindow();
- if (m != NULL)
- return m->getDocument();
-
- return NULL;
+ return (m ? m->getDocument() : NULL);
}
/**
{
slotFileNew(doc);
- if (fileName != QString::null && getDocument() != NULL)
+ if (fileName != QString::null && getDocument())
getDocument()->setFilename(fileName);
}
class RS_Grid;
class RS_Pen;
class RS_EventHandler;
+class QG_ScrollBar;
class GraphicView
{
bool showCrosshairs1;
//QG
-
+ protected:
+ int lastWidth;
+ int lastHeight;
+ //! Horizontal scrollbar.
+ QG_ScrollBar * hScrollBar;
+ //! Vertical scrollbar.
+ QG_ScrollBar * vScrollBar;
+ //! Layout used to fit in the view and the scrollbars.
+ QGridLayout * layout;
+ //! Label for grid spacing.
+ QLabel * gridStatus;
+ //! CAD mouse cursor
+ QCursor * curCad;
+ //! Delete mouse cursor
+ QCursor * curDel;
+ //! Select mouse cursor
+ QCursor * curSelect;
+ //! Magnifying glass mouse cursor
+ QCursor * curMagnifier;
+ //! Hand mouse cursor
+ QCursor * curHand;
//QC
};
virtual ~QC_GraphicView();
virtual void drawIt();
-
- private:
- //RS_Document* document;
};
#endif
#include "rs_eventhandler.h"
#include "exitdialog.h"
#include "qg_filedialog.h"
+#include "qg_graphicview.h"
// Class variable
int MDIWindow::idCounter = 0;
*/
MDIWindow::MDIWindow(RS_Document * doc, QWidget * parent, const char * name/*= NULL*/,
Qt::WindowFlags wflags/*= Qt::WDestructiveClose*/):
- QMdiSubWindow(parent, Qt::SubWindow)
+ QMdiSubWindow(parent, Qt::SubWindow), owner(false), forceClosing(false)
#warning "!!! wflags is ignored !!!"
{
- owner = false;
- forceClosing = false;
//This warning is most likely coming from the QMdiSubWindow() constructor above...
#warning "QWidget::setMinimumSize: (/QMdi::ControlLabel) Negative sizes (-1,-1) are not possible"
initDoc(doc);
initView();
id = idCounter++;
-//No worries: Only need to be more vigilant if this were TRUE
-// childWindows.setAutoDelete(false);
parentWindow = NULL;
- if (document != NULL)
+ if (document)
{
- if (document->getLayerList() != NULL)
+ if (document->getLayerList())
// Link the graphic view to the layer widget
document->getLayerList()->addListener(graphicView);
- if (document->getBlockList() != NULL)
+ if (document->getBlockList())
// Link the graphic view to the block widget
document->getBlockList()->addListener(graphicView);
}
*/
MDIWindow::~MDIWindow()
{
- if (document->getLayerList() != NULL)
+ if (document->getLayerList())
document->getLayerList()->removeListener(graphicView);
- if (document->getBlockList() != NULL)
+ if (document->getBlockList())
document->getBlockList()->removeListener(graphicView);
- if (owner == true && document != NULL)
+ if (owner && document)
delete document;
document = NULL;
bool MDIWindow::closeMDI(bool force, bool ask)
{
// should never happen:
- if (document == NULL)
+ if (!document)
return true;
bool ret = false;
bool isBlock = (parentWindow != NULL);
// This is a block and we don't need to ask the user for closing
- // since it's still available in the parent drawing after closing.
+ // since it's still available in the parent drawing after closing.
if (isBlock)
{
RS_DEBUG->print(" closing block");
// tell parent window we're not here anymore.
- if (parentWindow != NULL)
+ if (parentWindow)
{
RS_DEBUG->print(" notifying parent about closing this window");
parentWindow->removeChildWindow(this);
// close all child windows:
bool done;
-#if 0 // UGH! WHY??!??!
- do
- {
- done = true;
-
- if (childWindows.at(0) != NULL)
- {
- childWindows.at(0)->close();
- done = false;
- }
- }
- while (!done);
-#else
while (!childWindows.isEmpty())
{
MDIWindow * child = childWindows.takeFirst();
if (child)
child->close();
}
-#endif
emit(signalClosing());
ret = true;
{
RS_DEBUG->print("MDIWindow::initDoc()");
- if (doc == NULL)
+ if (!doc)
{
document = new Drawing();
document->newDoc();
{
RS_DEBUG->print("MDIWindow::initView()");
- graphicView = new QC_GraphicView(document, this);
-// setCentralWidget(graphicView);
+// graphicView = new QC_GraphicView(document, this);
+ graphicView = new QG_GraphicView(document, this);
setWidget(graphicView);
graphicView->setFocus();
}
{
RS_DEBUG->print("MDIWindow::slotPenChanged() begin");
- if (document != NULL)
+ if (document)
document->setActivePen(pen);
RS_DEBUG->print("MDIWindow::slotPenChanged() end");
{
RS_DEBUG->print("MDIWindow::slotFileNew begin");
- if (document != NULL && graphicView != NULL)
+ if (document && graphicView)
{
document->newDoc();
graphicView->redraw();
if (document != NULL && !fileName.isEmpty())
{
document->newDoc();
-
- // cosmetics..
-//bah RS_APP->processEvents(QEventLoop::AllEvents, 1000);
-
ret = document->open(fileName, type);
if (ret)
bool ret = false;
cancelled = false;
- if (document != NULL)
+ if (document)
{
if (document->getFilename().isEmpty())
ret = slotFileSaveAs(cancelled);
bool succ = true;
int exit = 0;
- if (document != NULL && document->isModified())
+ if (document && document->isModified())
{
ExitDialog dlg(this);
dlg.setForce(force);
// TODO: Define printing by using the QPainter methods here
painter.end();
- };
+ }
//statusBar()->message(tr("Ready."));
}
/** @return Pointer to graphic view */
-QC_GraphicView * MDIWindow::getGraphicView()
+//QC_GraphicView * MDIWindow::getGraphicView()
+QG_GraphicView * MDIWindow::getGraphicView()
{
return graphicView;
}
/** @return Pointer to current event handler */
RS_EventHandler * MDIWindow::getEventHandler()
{
- if (graphicView != NULL)
+ if (graphicView)
return graphicView->getEventHandler();
else
return NULL;
{
os << "MDIWindow[" << w.getId() << "]:\n";
- if (w.parentWindow!=NULL)
+ if (w.parentWindow)
os << " parentWindow: " << w.parentWindow->getId() << "\n";
else
os << " parentWindow: NULL\n";
#define QC_MDIWINDOW_H
#include <QtGui>
-#include "qc_graphicview.h"
+//#include "qc_graphicview.h"
#include "qg_layerwidget.h"
#include "qg_pentoolbar.h"
#include "rs_document.h"
+class RS_EventHandler;
+class QG_GraphicView;
+
/**
* MDI document window. Contains a document and a view (window).
*
void slotFilePrint();
public:
- QC_GraphicView * getGraphicView();
+// QC_GraphicView * getGraphicView();
+ QG_GraphicView * getGraphicView();
RS_Document * getDocument();
Drawing * getGraphic();
RS_EventHandler * getEventHandler();
/** ID counter (class variable) */
static int idCounter;
/** Graphic view */
- QC_GraphicView * graphicView;
+//let's see if we can get rid of this...
+// QC_GraphicView * graphicView;
+ QG_GraphicView * graphicView;
/** Document */
RS_Document * document;
/** Does the window own the document? */
+++ /dev/null
-// qc_graphicview.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who When What
-// --- ---------- -----------------------------------------------------------
-// JLH 05/17/2010 Added this text. :-)
-//
-
-#include "qc_graphicview.h"
-
-#include "rs_actiondefault.h"
-
-QC_GraphicView::QC_GraphicView(RS_Document * doc, QWidget * parent):
- QG_GraphicView(parent, "graphicview")
-{
- RS_DEBUG->print("QC_GraphicView::QC_GraphicView()...");
- //document = doc;
- RS_DEBUG->print(" Setting Container...");
-
- if (doc != NULL)
- setContainer(doc);
-
- RS_DEBUG->print(" container set.");
- setFactorX(4.0);
- setFactorY(4.0);
- setOffset(50, 50);
- setBorders(10, 10, 10, 10);
-
- if (doc != NULL)
- setDefaultAction(new RS_ActionDefault(*doc, *this));
-}
-
-QC_GraphicView::~QC_GraphicView()
-{
-}
-
-void QC_GraphicView::drawIt()
-{
- if (!isUpdateEnabled())
- return;
-
- GraphicView::drawIt();
-}
+++ /dev/null
-#ifndef QC_GRAPHICVIEW_H
-#define QC_GRAPHICVIEW_H
-
-#include <QtCore>
-
-// Q*G*_graphicview... How retarded is this...
-//very
-#include "qg_graphicview.h"
-
-class RS_Document;
-
-/**
- * A view widget for the visualisation of drawings.
- * Very thin wrapper for QCad specific settings.
- *
- * @author Andrew Mustun
- */
-class QC_GraphicView: public QG_GraphicView
-{
- public:
- QC_GraphicView(RS_Document * doc, QWidget * parent = 0);
- virtual ~QC_GraphicView();
-
- virtual void drawIt();
-
- private:
- //RS_Document* document;
-};
-
-#endif
#include "qg_graphicview.h"
+#include "rs_actiondefault.h"
#include "rs_actionzoomin.h"
#include "rs_actionzoompan.h"
#include "rs_actionzoomscroll.h"
*/
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)...");
+ CommonInitialization();
+}
+
+/**
+ * Constructor II.
+ */
+QG_GraphicView::QG_GraphicView(RS_Document * doc, QWidget * parent)
+{
+// QG_GraphicView(parent, "graphicview");
+ CommonInitialization();
+
+ RS_DEBUG->print("QG_GraphicView::QG_GraphicView(doc, parent)...");
+ //document = doc;
+ RS_DEBUG->print(" Setting Container...");
+
+ if (doc)
+ setContainer(doc);
+
+ RS_DEBUG->print(" container set.");
+ setFactorX(4.0);
+ setFactorY(4.0);
+ setOffset(50, 50);
+ setBorders(10, 10, 10, 10);
+
+ if (doc)
+ setDefaultAction(new RS_ActionDefault(*doc, *this));
+}
+
+void QG_GraphicView::CommonInitialization(void)
{
setBackground(background);
buffer = NULL;
//hrm.
painter = NULL;
+ RS_DEBUG->print("--> Setting up layout...");
layout = new QGridLayout(this);
layout->setColumnStretch(0, 1);
layout->setColumnStretch(1, 0);
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...");
hScrollBar = new QG_ScrollBar(Qt::Horizontal, this);
// hScrollBar->setLineStep(50);
hScrollBar->setSingleStep(50);
layout->addWidget(hScrollBar, 1, 0);
// layout->addRowSpacing(1, hScrollBar->sizeHint().height());
layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0);
- connect(hScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotHScrolled(int)));
+ RS_DEBUG->print("--> Creating vScrollBar...");
vScrollBar = new QG_ScrollBar(Qt::Vertical, this);
// vScrollBar->setLineStep(50);
vScrollBar->setSingleStep(50);
layout->addWidget(vScrollBar, 0, 2);
// layout->addColSpacing(2, vScrollBar->sizeHint().width());
layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2);
+
+ connect(hScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotHScrolled(int)));
connect(vScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotVScrolled(int)));
#ifndef __APPLE__
*/
QG_GraphicView::~QG_GraphicView()
{
- if (painter != NULL)
- {
-//Not sure about this...
-// ((RS_PainterQt *)painter)->end();
+ if (painter)
delete painter;
- }
- if (buffer != NULL)
+ if (buffer)
{
delete buffer;
buffer = NULL;
if (!e->isAccepted())
{
- if (QG_DIALOGFACTORY != NULL && QG_DIALOGFACTORY->getCadToolBar() != NULL)
+ if (QG_DIALOGFACTORY && QG_DIALOGFACTORY->getCadToolBar())
{
RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent: fwd to cadtoolbar");
QG_DIALOGFACTORY->getCadToolBar()->mouseReleaseEvent(e);
//printf("state: %d\n", e->state());
//printf("ctrl: %d\n", Qt::ControlButton);
-Qt::KeyboardModifiers keyState = QApplication::keyboardModifiers();
-
- if (container == NULL)
+ if (!container)
return;
+ Qt::KeyboardModifiers keyState = QApplication::keyboardModifiers();
Vector mouse = toGraph(Vector(e->x(), e->y()));
bool scroll = false;
void QG_GraphicView::keyPressEvent(QKeyEvent * e)
{
- if (container == NULL)
+ if (!container)
return;
bool scroll = false;
Vector max = container->getMax();
// no drawing yet - still allow to scroll
- if (max.x < min.x+1.0e-6 || max.y < min.y+1.0e-6 ||
- max.x > RS_MAXDOUBLE || max.x < RS_MINDOUBLE ||
- min.x > RS_MAXDOUBLE || min.x < RS_MINDOUBLE ||
- max.y > RS_MAXDOUBLE || max.y < RS_MINDOUBLE ||
- min.y > RS_MAXDOUBLE || min.y < RS_MINDOUBLE)
+ if (max.x < min.x + 1.0e-6 || max.y < min.y + 1.0e-6
+ || max.x > RS_MAXDOUBLE || max.x < RS_MINDOUBLE
+ || min.x > RS_MAXDOUBLE || min.x < RS_MINDOUBLE
+ || max.y > RS_MAXDOUBLE || max.y < RS_MINDOUBLE
+ || min.y > RS_MAXDOUBLE || min.y < RS_MINDOUBLE)
{
min = Vector(-10, -10);
max = Vector(100, 100);
If we can make the UI more like Inkscape we'll be in good shape. Plus elements
of VectorWorks & etc. as well...
+
+-------------------------------------------------------------------------------
+
+What's needed:
+
+- Draw the entities
+- Draw the preview (if any)
+- Draw the snapper (if any)
+
*/
// Qt4 handles double buffering of screen writes now, so this needs
#include "rs_blocklistlistener.h"
#include "qg_scrollbar.h"
-class RS_Preview;
+class RS_Document;
class PaintInterface;
+class RS_Preview;
/**
* This is the Qt implementation of a widget which can view a
public:
QG_GraphicView(QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0);
+ QG_GraphicView(RS_Document * doc, QWidget * parent = 0);
virtual ~QG_GraphicView();
virtual int getWidth();
#warning "!!! File preview needs porting to Qt4 !!!"
// void previewUrl(const Q3Url &u);
+ private:
+ void CommonInitialization(void);
+
private slots:
void slotHScrolled(int value);
void slotVScrolled(int value);