-// qc_mdiwindow.cpp
+// mdiwindow.cpp
//
// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// JLH 05/17/2010 Added this text. :-)
//
-#include "qc_mdiwindow.h"
+#include "mdiwindow.h"
#include "drawing.h"
#include "rs_eventhandler.h"
#include "qg_filedialog.h"
// Class variable
-int QC_MDIWindow::idCounter = 0;
+int MDIWindow::idCounter = 0;
/**
* Constructor.
* document shall be created for this window.
* @param parent Parent widget. Usually a workspace.
*/
-QC_MDIWindow::QC_MDIWindow(RS_Document * doc, QWidget * parent, const char * name/*= NULL*/,
+MDIWindow::MDIWindow(RS_Document * doc, QWidget * parent, const char * name/*= NULL*/,
Qt::WindowFlags wflags/*= Qt::WDestructiveClose*/):
-// Q3MainWindow(parent, name, wflags)
QMdiSubWindow(parent, Qt::SubWindow)
#warning "!!! wflags is ignored !!!"
{
*
* Deletes the document associated with this window.
*/
-QC_MDIWindow::~QC_MDIWindow()
+MDIWindow::~MDIWindow()
{
if (document->getLayerList() != NULL)
document->getLayerList()->removeListener(graphicView);
* depend on this one. This can be another view or a view for
* a particular block.
*/
-void QC_MDIWindow::addChildWindow(QC_MDIWindow * w)
+void MDIWindow::addChildWindow(MDIWindow * w)
{
RS_DEBUG->print("RS_MDIWindow::addChildWindow()");
*
* @see addChildWindow
*/
-void QC_MDIWindow::removeChildWindow(QC_MDIWindow * w)
+void MDIWindow::removeChildWindow(MDIWindow * w)
{
RS_DEBUG->print("RS_MDIWindow::removeChildWindow()");
/**
* @return pointer to the print preview of this drawing or NULL.
*/
-QC_MDIWindow * QC_MDIWindow::getPrintPreview()
+MDIWindow * MDIWindow::getPrintPreview()
{
for(uint i=0; i<childWindows.count(); ++i)
{
* @param force Disable cancel button (demo versions)
* @param ask Ask user before closing.
*/
-bool QC_MDIWindow::closeMDI(bool force, bool ask)
+bool MDIWindow::closeMDI(bool force, bool ask)
{
// should never happen:
if (document == NULL)
#else
while (!childWindows.isEmpty())
{
- QC_MDIWindow * child = childWindows.takeFirst();
+ MDIWindow * child = childWindows.takeFirst();
if (child)
child->close();
/**
* Called by Qt when the user closes this MDI window.
*/
-void QC_MDIWindow::closeEvent(QCloseEvent * ce)
+void MDIWindow::closeEvent(QCloseEvent * ce)
{
- RS_DEBUG->print("QC_MDIWindow::closeEvent begin");
+ RS_DEBUG->print("MDIWindow::closeEvent begin");
if (closeMDI(false, !forceClosing))
ce->accept();
else
ce->ignore();
- RS_DEBUG->print("QC_MDIWindow::closeEvent end");
+ RS_DEBUG->print("MDIWindow::closeEvent end");
}
/**
* @param container Entity container to be used as document or NULL
* if a new document should be created.
*/
-void QC_MDIWindow::initDoc(RS_Document * doc)
+void MDIWindow::initDoc(RS_Document * doc)
{
- RS_DEBUG->print("QC_MDIWindow::initDoc()");
+ RS_DEBUG->print("MDIWindow::initDoc()");
if (doc == NULL)
{
/**
* Init the view.
*/
-void QC_MDIWindow::initView()
+void MDIWindow::initView()
{
- RS_DEBUG->print("QC_MDIWindow::initView()");
+ RS_DEBUG->print("MDIWindow::initView()");
graphicView = new QC_GraphicView(document, this);
// setCentralWidget(graphicView);
* Called when the current pen (color, style, width) has changed.
* Sets the active pen for the document in this MDI window.
*/
-void QC_MDIWindow::slotPenChanged(RS_Pen pen)
+void MDIWindow::slotPenChanged(RS_Pen pen)
{
- RS_DEBUG->print("QC_MDIWindow::slotPenChanged() begin");
+ RS_DEBUG->print("MDIWindow::slotPenChanged() begin");
if (document != NULL)
document->setActivePen(pen);
- RS_DEBUG->print("QC_MDIWindow::slotPenChanged() end");
+ RS_DEBUG->print("MDIWindow::slotPenChanged() end");
}
/**
* Creates a new empty document in this MDI window.
*/
-void QC_MDIWindow::slotFileNew()
+void MDIWindow::slotFileNew()
{
- RS_DEBUG->print("QC_MDIWindow::slotFileNew begin");
+ RS_DEBUG->print("MDIWindow::slotFileNew begin");
if (document != NULL && graphicView != NULL)
{
graphicView->redraw();
}
- RS_DEBUG->print("QC_MDIWindow::slotFileNew end");
+ RS_DEBUG->print("MDIWindow::slotFileNew end");
}
/**
* Opens the given file in this MDI window.
*/
-bool QC_MDIWindow::slotFileOpen(const QString & fileName, RS2::FormatType type)
+bool MDIWindow::slotFileOpen(const QString & fileName, RS2::FormatType type)
{
- RS_DEBUG->print("QC_MDIWindow::slotFileOpen");
+ RS_DEBUG->print("MDIWindow::slotFileOpen");
bool ret = false;
if (document != NULL && !fileName.isEmpty())
//QString message=tr("Loaded document: ")+fileName;
//statusBar()->message(message, 2000);
- RS_DEBUG->print("QC_MDIWindow::slotFileOpen: autoZoom");
+ RS_DEBUG->print("MDIWindow::slotFileOpen: autoZoom");
graphicView->zoomAuto(false);
- RS_DEBUG->print("QC_MDIWindow::slotFileOpen: autoZoom: OK");
+ RS_DEBUG->print("MDIWindow::slotFileOpen: autoZoom: OK");
}
else
{
- RS_DEBUG->print("QC_MDIWindow::slotFileOpen: failed");
+ RS_DEBUG->print("MDIWindow::slotFileOpen: failed");
}
}
else
{
- RS_DEBUG->print("QC_MDIWindow::slotFileOpen: cancelled");
+ RS_DEBUG->print("MDIWindow::slotFileOpen: cancelled");
//statusBar()->message(tr("Opening aborted"), 2000);
}
- RS_DEBUG->print("QC_MDIWindow::slotFileOpen: OK");
+ RS_DEBUG->print("MDIWindow::slotFileOpen: OK");
return ret;
}
* false if the file could not be saved or the document
* is invalid.
*/
-bool QC_MDIWindow::slotFileSave(bool & cancelled)
+bool MDIWindow::slotFileSave(bool & cancelled)
{
- RS_DEBUG->print("QC_MDIWindow::slotFileSave()");
+ RS_DEBUG->print("MDIWindow::slotFileSave()");
bool ret = false;
cancelled = false;
* false if the file could not be saved or the document
* is invalid.
*/
-bool QC_MDIWindow::slotFileSaveAs(bool & cancelled)
+bool MDIWindow::slotFileSaveAs(bool & cancelled)
{
- RS_DEBUG->print("QC_MDIWindow::slotFileSaveAs");
+ RS_DEBUG->print("MDIWindow::slotFileSaveAs");
bool ret = false;
cancelled = false;
RS2::FormatType t = RS2::FormatDXF;
*
* @param force Force closing by disabling the cancel button (for demo versions).
*/
-bool QC_MDIWindow::slotFileClose(bool force)
+bool MDIWindow::slotFileClose(bool force)
{
- RS_DEBUG->print("QC_MDIWindow::slotFileClose()");
+ RS_DEBUG->print("MDIWindow::slotFileClose()");
bool succ = true;
int exit = 0;
return succ;
}
-void QC_MDIWindow::slotFilePrint()
+void MDIWindow::slotFilePrint()
{
- RS_DEBUG->print("QC_MDIWindow::slotFilePrint");
+ RS_DEBUG->print("MDIWindow::slotFilePrint");
//statusBar()->message(tr("Printing..."));
QPrinter printer;
}
/** @return Pointer to graphic view */
-QC_GraphicView * QC_MDIWindow::getGraphicView()
+QC_GraphicView * MDIWindow::getGraphicView()
{
return graphicView;
}
/** @return Pointer to document */
-RS_Document * QC_MDIWindow::getDocument()
+RS_Document * MDIWindow::getDocument()
{
return document;
}
/** @return Pointer to graphic or NULL */
-Drawing * QC_MDIWindow::getGraphic()
+Drawing * MDIWindow::getGraphic()
{
return document->getGraphic();
}
/** @return Pointer to current event handler */
-RS_EventHandler * QC_MDIWindow::getEventHandler()
+RS_EventHandler * MDIWindow::getEventHandler()
{
if (graphicView != NULL)
return graphicView->getEventHandler();
/**
* Sets the parent window that will be notified if this
*/
-void QC_MDIWindow::setParentWindow(QC_MDIWindow * p)
+void MDIWindow::setParentWindow(MDIWindow * p)
{
RS_DEBUG->print("setParentWindow");
parentWindow = p;
/**
* @return The MDI window id.
*/
-int QC_MDIWindow::getId()
+int MDIWindow::getId()
{
return id;
}
-void QC_MDIWindow::setForceClosing(bool on)
+void MDIWindow::setForceClosing(bool on)
{
forceClosing = on;
}
/**
* Streams some info about an MDI window to stdout.
*/
-std::ostream & operator<<(std::ostream & os, QC_MDIWindow & w)
+std::ostream & operator<<(std::ostream & os, MDIWindow & w)
{
- os << "QC_MDIWindow[" << w.getId() << "]:\n";
+ os << "MDIWindow[" << w.getId() << "]:\n";
if (w.parentWindow!=NULL)
os << " parentWindow: " << w.parentWindow->getId() << "\n";