#include "applicationwindow.h"
#include <fstream>
-#include "rs_actiondrawlinefree.h"
-#include "rs_actionlibraryinsert.h"
-#include "rs_actionprintpreview.h"
+#include "actiondrawlinefree.h"
+#include "actionlibraryinsert.h"
+#include "actionprintpreview.h"
#include "rs_creation.h"
#include "rs_dialogfactory.h"
#include "rs_dimaligned.h"
#include "rs_hatch.h"
#include "rs_insert.h"
#include "rs_image.h"
-#include "paintintf.h"
+#include "paintinterface.h"
#include "rs_script.h"
#include "rs_scriptlist.h"
#include "settings.h"
#include "mousewidget.h"
#include "selectionwidget.h"
-#include "mdiwindow.h"
-#include "qc_dialogfactory.h"
#include "createqtactions.h"
+#include "qc_dialogfactory.h"
+#include "qg_graphicview.h"
#include "main.h"
+#include "mdiwindow.h"
ApplicationWindow * ApplicationWindow::appWindow = NULL;
// setIcon(qPixmapFromMimeSource(QC_APP_ICON));
// setWindowIcon(qPixmapFromMimeSource(QC_APP_ICON));
setWindowIcon(QIcon(":/res/" QC_APP_ICON));
+ CreateQtActions(this);
RS_DEBUG->print("ApplicationWindow::ApplicationWindow: creating action handler");
actionHandler = new QG_ActionHandler(this);
GraphicView * graphicView = getGraphicView();
RS_Document * document = getDocument();
- if (graphicView != NULL && document != NULL)
+ if (graphicView && document)
{
- RS_ActionLibraryInsert * action = new RS_ActionLibraryInsert(*document, *graphicView);
+ ActionLibraryInsert * action = new ActionLibraryInsert(*document, *graphicView);
action->setFile(name);
graphicView->setCurrentAction(action);
}
void ApplicationWindow::initActions()
{
RS_DEBUG->print("ApplicationWindow::initActions()");
- CreateQtActions(this);
//
// File actions:
{
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);
w->setWindowIcon(QIcon(":/res/document.png"));
w->getGraphicView()->setPrintPreview(true);
w->getGraphicView()->setBackground(RS_Color(255, 255, 255));
- w->getGraphicView()->setDefaultAction(new RS_ActionPrintPreview(*w->getDocument(), *w->getGraphicView()));
+ w->getGraphicView()->setDefaultAction(new ActionPrintPreview(*w->getDocument(), *w->getGraphicView()));
// only graphics offer block lists, blocks don't
RS_DEBUG->print(" adding listeners");
*/
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);
//Drawing* g = document->getMarking();
/*
- RS_ActionDrawLineFree* action =
- new RS_ActionDrawLineFree(*document->getGraphic(),
+ ActionDrawLineFree* action =
+ new ActionDrawLineFree(*document->getGraphic(),
*graphicView);
for (int i=0; i<100; ++i) {
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);
}