#include "mdiwindow.h"
ApplicationWindow * ApplicationWindow::appWindow = NULL;
-
-#ifndef QC_APP_ICON
-# define QC_APP_ICON "qcad.png"
-#endif
-#ifndef QC_APP_ICON16
-# define QC_APP_ICON16 "qcad16.png"
-#endif
-
extern QSplashScreen * splash;
/**
#warning "!!! Need to create new application icon !!!"
DEBUG->print("ApplicationWindow::ApplicationWindow: setting icon");
- setWindowIcon(QIcon(":/res/" QC_APP_ICON));
+ setWindowIcon(QIcon(":/res/qcad.png"));
CreateQtActions(this);
DEBUG->print("ApplicationWindow::ApplicationWindow: creating action handler");
// Help menu:
//
- helpAboutApp = new QAction(QIcon(QC_APP_ICON16), tr("&About Architektonas"), this);
+ helpAboutApp = new QAction(QIcon("qcad16.png"), tr("&About Architektonas"), this);
// helpAboutApp = new QAction(tr("About"), qPixmapFromMimeSource(QC_APP_ICON16), tr("&About %1").arg(QC_APPNAME), 0, this);
helpAboutApp->setStatusTip(tr("About the application"));
//helpAboutApp->setWhatsThis(tr("About\n\nAbout the application"));
//which means the subwindow is NOT being activated!!!
// MDIWindow * m = getMDIWindow();
MDIWindow * m = (MDIWindow *)sw;
+// MDIWindow * m = (MDIWindow *)(sw->widget());
DEBUG->print(/*Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m=%08X", m);
DEBUG->print(/*Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m->getDoc=%08X",
(m ? m->getDocument() : 0));
// Disable/Enable menu and toolbar items
//This is odd... why do this when you can just call the function directly? It's
//IN this class after all...
+//In this case it makes a little sense, as the signal is connected to all the actions'
+//setEnabled() function calls.
emit(windowsChanged(m != NULL && m->getDocument() != NULL));
DEBUG->print("ApplicationWindow::slotWindowActivated end");
//w->setFocus();
//w->activateWindow();
//w->raise();
+//will wok?
+/*printf("FileNew: Setting active subwindow... (w=%08X)\n", (uint)w);
+workspace->setActiveSubWindow(w);
+printf("FileNew: Workspace active window = %08X\n", (uint)(workspace->activeSubWindow()));
+//*/
//not anymore... #warning "!!! Parameter to slotWindowActivated() is ignored !!!"
//Hm, this should be called when the window is actually activated by the QMdiArea...
ret = true;
}
#else
+//#warning "ApplicationWindow::slotFileExport(): Need to port to Qt4... !!! FIX !!!"
// QImage image = buffer->toImage();
// QImageWriter writer;
// writer.setFileName(name);
* @param parent Parent widget. Usually a workspace (QMdiArea).
*/
MDIWindow::MDIWindow(Document * doc, QWidget * parent, const char * name/*= NULL*/,
- Qt::WindowFlags wflags/*= Qt::WDestructiveClose*/):
- QMdiSubWindow(parent, Qt::SubWindow), owner(false)//, forceClosing(false)
+ Qt::WindowFlags wflags/*= Qt::SubWindow*/):
+ QMdiSubWindow(parent, Qt::SubWindow),
+owner(false)
#warning "!!! wflags is ignored !!!"
{
// This warning not longer occurs...!
//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();
+
+ graphicView = new QG_GraphicView(document, this);
+//Let's see if the trouble is in the graphicView...
+//And it is... So... How to fix this???
+ setWidget(graphicView);
+//THIS was the problem... Somehow, setting focus on the this widget was screwing
+//*everything* about the MDI system up!
+// graphicView->setFocus();
+
id = idCounter++;
parentWindow = NULL;
}
}
-/**
- * Initialize the view.
- */
-void MDIWindow::initView()
-{
- // This is only called once: In the MDIWindow constructor.
- DEBUG->print("MDIWindow::initView()");
-
-// graphicView = new QC_GraphicView(document, this);
- graphicView = new QG_GraphicView(document, this);
- setWidget(graphicView);
- graphicView->setFocus();
-}
-
/**
* Called when the current pen (color, style, width) has changed.
* Sets the active pen for the document in this MDI window.
-#ifndef QC_MDIWINDOW_H
-#define QC_MDIWINDOW_H
+#ifndef __MDIWINDOW_H__
+#define __MDIWINDOW_H__
#include <QtGui>
#include "document.h"
#include "layerwidget.h"
#include "pentoolbar.h"
+//#include "qg_graphicview.h"
class EventHandler;
class QG_GraphicView;
* @author Andrew Mustun
*/
class MDIWindow: public QMdiSubWindow
+//class MDIWindow: public QG_GraphicView
{
Q_OBJECT
~MDIWindow();
void initDoc(Document * doc = NULL);
- void initView();
public slots:
void slotPenChanged(Pen p);
bool slotFileOpen(const QString & fileName, RS2::FormatType type);
bool slotFileSave(bool & cancelled);
bool slotFileSaveAs(bool & cancelled);
-//WAS: bool slotFileClose(bool force);
bool slotFileClose(void);
void slotFilePrint(void);
MDIWindow * getPrintPreview();
void setParentWindow(MDIWindow * p);
int getId();
-//WAS: bool closeMDI(bool force, bool ask = true);
bool CloseMDI(void);
-// void setForceClosing(bool on);
friend std::ostream & operator<<(std::ostream & os, MDIWindow & w);
Document * document;
/** Does the window own the document? */
bool owner;
- /**
- * List of known child windows that show blocks of the same drawing.
- */
+ /** List of known child windows that show blocks of the same drawing. */
QList<MDIWindow *> childWindows;
/**
* Pointer to parent window which needs to know if this window
* is closed or NULL.
*/
MDIWindow * parentWindow;
- /**
- * If flag is set, the user will not be asked about closing this file.
- */
-// bool forceClosing;
};
-#endif
+#endif // __MDIWINDOW_H__