mirror of https://github.com/CGAL/cgal
281 lines
8.5 KiB
C++
281 lines
8.5 KiB
C++
/***************************************************************************
|
|
|
|
begin : jan 02
|
|
copyright : (C) 2002 by Pierre Alliez
|
|
email : pierre.alliez@sophia.inria.fr
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#ifndef TOOL_H
|
|
#define TOOL_H
|
|
|
|
// include files for QT
|
|
#include <qaction.h>
|
|
#include <qaccel.h>
|
|
#include <qapp.h>
|
|
#include <qcolordialog.h>
|
|
#include <qfiledialog.h>
|
|
#include <qlabel.h>
|
|
#include <qmainwindow.h>
|
|
#include <qmenubar.h>
|
|
#include <qmsgbox.h>
|
|
#include <qpixmap.h>
|
|
#include <qpopupmenu.h>
|
|
#include <qprinter.h>
|
|
#include <qstatusbar.h>
|
|
#include <qstring.h>
|
|
#include <qtoolbar.h>
|
|
#include <qtoolbutton.h>
|
|
#include <qwhatsthis.h>
|
|
#include <qworkspace.h>
|
|
|
|
#include "Arcball.h"
|
|
|
|
// forward declaration of the Tool classes
|
|
class ToolDoc;
|
|
class ToolView;
|
|
class QDialogParamDirection;
|
|
|
|
/**
|
|
* This Class is the base class for your application. It sets up the main
|
|
* window and providing a menubar, toolbar
|
|
* and statusbar. For the main view, an instance of class ToolView is
|
|
* created which creates your view.
|
|
*
|
|
* @author Source Framework Automatically Generated by KDevelop, (c) The
|
|
KDevelop Team.
|
|
* @version KDevelop version 1.3 code generation
|
|
*/
|
|
class ToolApp : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
QDialogParamDirection *m_pDlgParamDirection;
|
|
|
|
public:
|
|
/** construtor */
|
|
ToolApp();
|
|
/** destructor */
|
|
~ToolApp();
|
|
|
|
// common objects
|
|
CArcball theArcball;
|
|
|
|
/** opens a file specified by commandline option
|
|
*/
|
|
void openDocumentFile(const char *file=0);
|
|
|
|
protected:
|
|
/** overloaded for Message box on last window exit */
|
|
bool queryExit();
|
|
/** event filter to catch close events for MDI child windows and is
|
|
installed in createClient() on every child window.
|
|
* Closing a window calls the eventFilter first which removes the view from
|
|
the connected documents' view list. If the
|
|
* last view is going to be closed, the eventFilter() tests if the document
|
|
is modified; if yes, it asks the user to
|
|
* save the document. If the document title contains "Untitled",
|
|
slotFileSaveAs() gets called to get a save name and path.
|
|
*/
|
|
virtual bool eventFilter(QObject* object, QEvent* event);
|
|
/** creates a new child window. The document that will be connected to it
|
|
* has to be created before and the instances filled, with e.g.
|
|
openDocument().
|
|
* Then call createClient() to get a new MDI child window.
|
|
* @see ToolDoc#addView
|
|
* @see ToolDoc#openDocument
|
|
* @param doc pointer to the document instance that the view will
|
|
* be connected to.
|
|
*/
|
|
void createClient(ToolDoc* doc);
|
|
|
|
private slots:
|
|
/** open a document */
|
|
void slotFileOpen();
|
|
/** save a document */
|
|
void slotFileSave();
|
|
/** save a document under a different filename*/
|
|
void slotFileSaveAs();
|
|
/** close the actual file */
|
|
void slotFileClose();
|
|
/** print the actual file */
|
|
void slotFilePrint();
|
|
/** exits the application */
|
|
void slotFileQuit();
|
|
|
|
/** reverts the last editing action */
|
|
void slotEditUndo();
|
|
/** put the marked text/object into the clipboard and remove
|
|
* it from the document */
|
|
void slotEditCut();
|
|
/** put the marked text/object into the clipboard*/
|
|
void slotEditCopy();
|
|
/** paste the clipboard into the document*/
|
|
void slotEditPaste();
|
|
|
|
/** toggle the toolbar*/
|
|
void slotViewToolBar(bool toggle);
|
|
/** toggle the toolbar*/
|
|
void slotViewRenderingToolBar(bool toggle);
|
|
/** toggle the statusbar*/
|
|
void slotViewStatusBar(bool toggle);
|
|
|
|
// TRACKBALL
|
|
void slotViewCopyViewpoint();
|
|
void slotViewPasteViewpoint();
|
|
|
|
// RENDER
|
|
void slotRenderWireframe();
|
|
void slotSelectBgColor();
|
|
void slotSelectFgColor();
|
|
void slotRenderEdges();
|
|
void slotRenderFill();
|
|
void slotRenderSmooth();
|
|
void slotRenderCulling();
|
|
void slotRenderLighting();
|
|
void slotRenderVertex();
|
|
void slotRenderSuperimposing();
|
|
void slotRenderSuperimposedV();
|
|
void slotRenderAntialiasing();
|
|
|
|
// SUBDIVISION
|
|
void slotSubdivisionStamLoop();
|
|
void slotSubdivisionSqrt3();
|
|
void slotSubdivisionSqrt3_twice();
|
|
void slotSubdivisionDooSabin();
|
|
void slotSubdivisionCatmullClark();
|
|
void slotSubdivisionLoop();
|
|
|
|
/** creates a new view for the current document */
|
|
void slotWindowNewWindow();
|
|
/** shows an about dlg*/
|
|
void slotHelpAbout();
|
|
/** change the status message of the whole statusbar temporary */
|
|
void slotStatusHelpMsg(const QString &text);
|
|
/** gets called when the window menu is activated; recreates the window menu
|
|
with all opened window titles. */
|
|
void windowMenuAboutToShow();
|
|
/** activates the MDI child widget when it gets selected from the window
|
|
menu. */
|
|
void windowMenuActivated( int id );
|
|
|
|
//this will be triggered by each view when get the focus
|
|
void slotUpdateStates(ToolView*);
|
|
|
|
private:
|
|
|
|
/** initializes all QActions of the application */
|
|
void initActions();
|
|
/** initMenuBar creates the menu_bar and inserts the menuitems */
|
|
void initMenuBar();
|
|
/** this creates the toolbars. Change the toobar look and add new toolbars
|
|
in this
|
|
* function */
|
|
void initToolBar();
|
|
/** setup the statusbar */
|
|
void initStatusBar();
|
|
/** setup the mainview*/
|
|
void initView();
|
|
|
|
/** file_menu contains all items of the menubar entry "File" */
|
|
QPopupMenu *pFileMenu;
|
|
/** edit_menu contains all items of the menubar entry "Edit" */
|
|
QPopupMenu *pEditMenu;
|
|
/** view_menu contains all items of the menubar entry "View" */
|
|
QPopupMenu *pViewMenu;
|
|
/** view_menu contains all items of the menubar entry "Help" */
|
|
QPopupMenu *pHelpMenu;
|
|
/** the window menu */
|
|
QPopupMenu *pWindowMenu;
|
|
|
|
QToolBar *fileToolbar;
|
|
QToolBar *renderingToolbar;
|
|
QToolBar *subdivisionToolbar;
|
|
|
|
/** pWorkspace is the MDI frame widget that handles MDI child widgets.
|
|
Inititalized in
|
|
* initView()
|
|
*/
|
|
QWorkspace *pWorkspace;
|
|
/** the printer instance */
|
|
QPrinter *printer;
|
|
/** a counter that gets increased each time the user creates a new document
|
|
with "File"->"New" */
|
|
int untitledCount;
|
|
/** a list of all open documents. If the last window of a document gets
|
|
closed, the installed eventFilter
|
|
* removes this document from the list. The document list is checked for
|
|
modified documents when the user
|
|
* is about to close the application. */
|
|
QList<ToolDoc> *pDocList;
|
|
|
|
QAction *fileNew;
|
|
QAction *fileOpen;
|
|
QAction *fileSave;
|
|
QAction *fileSaveAs;
|
|
QAction *fileClose;
|
|
QAction *filePrint;
|
|
QAction *fileQuit;
|
|
|
|
QAction *editUndo;
|
|
QAction *editCut;
|
|
QAction *editCopy;
|
|
QAction *editPaste;
|
|
|
|
QAction *viewToolBar;
|
|
QAction *viewRenderingToolbar;
|
|
QAction *viewStatusBar;
|
|
QAction *viewCopyViewpoint;
|
|
QAction *viewPasteViewpoint;
|
|
|
|
QActionGroup *windowAction;
|
|
QActionGroup *renderActionGroup;
|
|
QActionGroup *subdivisionActionGroup;
|
|
QAction *windowNewWindow;
|
|
QAction *windowTile;
|
|
QAction *windowCascade;
|
|
|
|
QAction *helpAboutApp;
|
|
|
|
// ALGORITHMS
|
|
QPopupMenu *pAlgoMenu;
|
|
|
|
QPopupMenu *pAlgoSubdivisionMenu;
|
|
QAction *algoSubdivisionStamLoop;
|
|
QAction *algoSubdivisionSqrt3;
|
|
QAction *algoSubdivisionSqrt3_twice;
|
|
QAction *algoSubdivisionDooSabin;
|
|
QAction *algoSubdivisionCatmullClark;
|
|
QAction *algoSubdivisionLoop;
|
|
|
|
// RENDER
|
|
QPopupMenu *pRenderMenu;
|
|
QPopupMenu *pRenderModeMenu;
|
|
QPopupMenu *pRenderSuperimposeMenu;
|
|
QAction *renderWireframe;
|
|
QAction *renderVertex;
|
|
QAction *renderFill;
|
|
QAction *renderEdges;
|
|
QAction *renderSuperimpose;
|
|
QAction *renderSuperimposeV;
|
|
QAction *renderSmooth;
|
|
QAction *renderCulling;
|
|
QAction *renderLighting;
|
|
QAction *renderNormals;
|
|
QAction *renderAntialiasing;
|
|
|
|
QToolButton *bgcolor_button;
|
|
QToolButton *fgcolor_button;
|
|
|
|
};
|
|
#endif
|
|
|