1 #ifndef __LDVIEWMAINWINDOW_H__
2 #define __LDVIEWMAINWINDOW_H__
3 
4 #include "ui_LDView.h"
5 #include "ModelViewerWidget.h"
6 #include <QApplication>
7 #include <QAction>
8 #include <QToolButton>
9 
10 class LDViewMainWindow : public QMainWindow , Ui::LDView
11 {
12 	Q_OBJECT
13 public:
14 	LDViewMainWindow(QApplication * /* a */);
15 
fileSaveSetEnabled(bool b)16 	void fileSaveSetEnabled(bool b)        {fileSaveAction->setEnabled(b);}
fileReloadSetEnabled(bool b)17 	void fileReloadSetEnabled(bool b)      {fileReloadAction->setEnabled(b);}
toolbarFirstStepSetEnabled(bool b)18 	void toolbarFirstStepSetEnabled(bool b){toolbarFirstStep->setEnabled(b);}
toolbarNextStepSetEnabled(bool b)19 	void toolbarNextStepSetEnabled(bool b) {toolbarNextStep->setEnabled(b);}
toolbarPrevStepSetEnabled(bool b)20 	void toolbarPrevStepSetEnabled(bool b) {toolbarPrevStep->setEnabled(b);}
toolbarLastStepSetEnabled(bool b)21 	void toolbarLastStepSetEnabled(bool b) {toolbarLastStep->setEnabled(b);}
toolbarViewAngleSetEnabled(bool b)22 	void toolbarViewAngleSetEnabled(bool b){toolbarViewAngle->setEnabled(b);}
23 	void setupStandardSizes();
toolbarMaxStepSetText(QString s)24 	void toolbarMaxStepSetText(QString s)  {toolbarMaxStep->setText(s);}
toolbarCurrentStepSetText(QString s)25 	void toolbarCurrentStepSetText(QString s) {toolbarCurrentStep->setText(s);}
setToolbarOn(bool b)26 	void setToolbarOn(bool b) {viewToolBarAction->setChecked(b);}
setStatusbarOn(bool b)27 	void setStatusbarOn(bool b){viewStatusBarAction->setChecked(b);}
setStepGotoEnabled(bool b)28 	void setStepGotoEnabled(bool b) {stepGoto->setEnabled(b);}
setToolbarWireframeOn(bool b)29 	void setToolbarWireframeOn(bool b){toolbarWireframeAction->setChecked(b);toolbarWireframeMenu->setEnabled(b);}
setToolbarWireframeFogOn(bool b)30 	void setToolbarWireframeFogOn(bool b){wireframeFogAction->setChecked(b);}
setToolbarWireframeRemoveHiddenLinesOn(bool b)31 	void setToolbarWireframeRemoveHiddenLinesOn(bool b){wireframeRemoveHiddenLinesAction->setChecked(b);}
setToolbarEdgeShowEdgeOnlyOn(bool b)32 	void setToolbarEdgeShowEdgeOnlyOn(bool b){edgeShowEdgeOnlyAction->setChecked(b);}
setToolbarEdgeConditionalLineOn(bool b)33 	void setToolbarEdgeConditionalLineOn(bool b){edgeConditionalLineAction->setChecked(b);}
setToolbarEdgeHighQualityOn(bool b)34 	void setToolbarEdgeHighQualityOn(bool b){edgeHighQualityAction->setChecked(b);}
setToolbarEdgeAlwaysBlackOn(bool b)35 	void setToolbarEdgeAlwaysBlackOn(bool b){edgeAlwaysBlackAction->setChecked(b);}
setToolbarBfcRedBackFacesOn(bool b)36 	void setToolbarBfcRedBackFacesOn(bool b){bfcRedBackFacesAction->setChecked(b);}
setToolbarBfcGreenFrontFacesOn(bool b)37 	void setToolbarBfcGreenFrontFacesOn(bool b){bfcGreenFrontFacesAction->setChecked(b);}
setToolbarBfcBlueNeutralFacesOn(bool b)38 	void setToolbarBfcBlueNeutralFacesOn(bool b){bfcBlueNeutralFacesAction->setChecked(b);}
setToolbarTextureStudOn(bool b)39 	void setToolbarTextureStudOn(bool b) {textureStudAction->setChecked(b);}
setToolbarEdgeOn(bool b)40 	void setToolbarEdgeOn(bool b) {toolbarEdgeAction->setChecked(b);edgeMenu->setEnabled(b);}
setToolbarLightingOn(bool b)41 	void setToolbarLightingOn(bool b) {toolbarLightingAction->setChecked(b);}
setToolbarBFCOn(bool b)42 	void setToolbarBFCOn(bool b){toolbarBFCAction->setChecked(b);bfcMenu->setEnabled(b);}
setToolbarAxesOn(bool b)43 	void setToolbarAxesOn(bool b){toolbarAxesAction->setChecked(b);}
setToolbarSeamsOn(bool b)44 	void setToolbarSeamsOn(bool b){toolbarSeamsAction->setChecked(b);}
setToolbarPrimitiveSubstitutionOn(bool b)45 	void setToolbarPrimitiveSubstitutionOn(bool b){toolbarPrimitiveSubstitutionAction->setChecked(b);primitiveMenu->setEnabled(b);}
46 	void setPollAction(LDVPollMode mode);
setExamineModeOn(bool b)47 	void setExamineModeOn(bool b){examineModeAction->setChecked(b);}
setFlythroughModeOn(bool b)48 	void setFlythroughModeOn(bool b){flythroughModeAction->setChecked(b);}
setWalkModeOn(bool b)49 	void setWalkModeOn(bool b){walkModeAction->setChecked(b);}
setViewLatitudeRotationOn(bool b)50 	void setViewLatitudeRotationOn(bool b){viewLatitudeRotationAction->setChecked(b);}
setKeepRightSideUpOn(bool b)51 	void setKeepRightSideUpOn(bool b){viewKeepRightSideUpAction->setChecked(b);}
setShowPovAspectRatioOn(bool b)52 	void setShowPovAspectRatioOn(bool b){showPovAspectRatioAction->setChecked(b);}
53 //	void setMainGroupBoxMargin(int i){MainGroupBox->layout()->setMargin(i);}
54 	void setMenuItemsEnabled(QMenu *menu, bool enabled);
showToolbar(bool b)55 	void showToolbar(bool b) { if (b) {toolbar->show();} else {toolbar->hide();}}
showMenubar(bool b)56 	void showMenubar(bool b) { if (b) {menubar->show();} else {menubar->hide();}}
57 	void clearRecentFileMenuItems(void);
58 	char *truncateFilename(const char *i /* filename */);
59 	void populateRecentFileMenuItems(void);
60 	void populateRecentFiles(void);
61 	void recordRecentFiles(void);
62 	static TCStringArray* recentFiles;
63 
64 public slots:
fileOpen()65 	void fileOpen() { 	modelViewer->doFileOpen();}
fileSave()66 	void fileSave(){ 	modelViewer->doFileSave();}
fileSaveSettings()67 	void fileSaveSettings(){ modelViewer->doFileSaveSettings();}
fileExport()68 	void fileExport(){	modelViewer->fileExport();}
fileExportOption()69 	void fileExportOption(){modelViewer->fileExportOption();}
file3DSExportOption()70 	void file3DSExportOption() {modelViewer->file3DSExportOption();}
fileJPEGOptions()71 	void fileJPEGOptions(){ modelViewer->doFileJPEGOptions();}
filePrint()72 	void filePrint(){	modelViewer->doFilePrint();}
fileExit()73 	void fileExit(){    	QApplication::exit();}
helpContents()74 	void helpContents(){    modelViewer->doHelpContents();}
helpAbout()75 	void helpAbout(){	modelViewer->doHelpAbout();}
helpAboutQt()76 	void helpAboutQt(){	modelViewer->doHelpAboutQt();}
editPreferences()77 	void editPreferences(){	modelViewer->showPreferences();}
closeEvent(QCloseEvent *)78 	void closeEvent(QCloseEvent * /* event */){
79 #if (QT_VERSION >>16)==3
80     QMainWindow::closeEvent(event);
81     if (event->isAccepted())
82 #endif
83 	fileExit();
84 }
viewStatusBar(bool flag)85 	void viewStatusBar(bool flag){    modelViewer->doViewStatusBar(flag);}
viewToolBar(bool flag)86 	void viewToolBar(bool flag){    modelViewer->doViewToolBar(flag);}
toolbarWireframe(bool flag)87 	void toolbarWireframe(bool flag){    modelViewer->doWireframe(flag);toolbarWireframeMenu->setEnabled(flag);}
toolbarWireframeFog(bool flag)88 	void toolbarWireframeFog(bool flag) { modelViewer->doWireframeFog(flag);}
toolbarWireframeRemoveHiddenLines(bool flag)89 	void toolbarWireframeRemoveHiddenLines(bool flag) {modelViewer->doWireframeRemoveHiddenLines(flag);}
textureStud(bool flag)90 	void textureStud(bool flag) {modelViewer->doTextureStud(flag);}
edgeShowEdgeOnly(bool flag)91 	void edgeShowEdgeOnly(bool flag) {modelViewer->doShowEdgeOnly(flag);}
edgeConditionalLine(bool flag)92 	void edgeConditionalLine(bool flag) {modelViewer->doConditionalLine(flag);}
edgeHighQuality(bool flag)93 	void edgeHighQuality(bool flag) {modelViewer->doHighQuality(flag);}
edgeAlwaysBlack(bool flag)94 	void edgeAlwaysBlack(bool flag) {modelViewer->doAlwaysBlack(flag);}
bfcRedBackFaces(bool flag)95 	void bfcRedBackFaces(bool flag) {modelViewer->doRedBackFaces(flag);}
bfcGreenFrontFaces(bool flag)96 	void bfcGreenFrontFaces(bool flag) {modelViewer->doGreenFrontFaces(flag);}
bfcBlueNeutralFaces(bool flag)97 	void bfcBlueNeutralFaces(bool flag) {modelViewer->doBlueNeutralFaces(flag);}
toolbarEdge(bool flag)98 	void toolbarEdge(bool flag){    modelViewer->doEdge(flag);edgeMenu->setEnabled(flag);}
toolbarLighting(bool flag)99 	void toolbarLighting(bool flag){    modelViewer->doLighting(flag);}
toolbarBFC(bool flag)100 	void toolbarBFC(bool flag){    modelViewer->doBFC(flag);bfcMenu->setEnabled(flag);}
toolbarAxes(bool flag)101 	void toolbarAxes(bool flag){    modelViewer->doAxes(flag);}
toolbarPrimitiveSubstitution(bool flag)102 	void toolbarPrimitiveSubstitution(bool flag){    modelViewer->doPrimitiveSubstitution(flag);primitiveMenu->setEnabled(flag);}
toolbarSeams(bool flag)103 	void toolbarSeams(bool flag){    modelViewer->doSeams(flag);}
viewFullScreen()104 	void viewFullScreen(){	modelViewer->doViewFullScreen();}
viewResetView()105 	void viewResetView(){    modelViewer->doViewReset();}
helpOpenGLDriverInfo()106 	void helpOpenGLDriverInfo(){    modelViewer->doHelpOpenGLDriverInfo();}
fileLDrawDir()107 	void fileLDrawDir(){    modelViewer->doFileLDrawDir();}
fileExtraDir()108 	void fileExtraDir(){	modelViewer->showFileExtraDir();}
fileCheckForUpdates()109 	void fileCheckForUpdates(){	 modelViewer->checkForLibraryUpdates();}
fileReload()110 	void fileReload(){    modelViewer->doFileReload();}
viewShowErrors()111 	void viewShowErrors(){    modelViewer->doViewErrors();}
112 	void pollChanged(QAction *action);
viewModeChanged(QAction * action)113 	void viewModeChanged(QAction *action){
114 		if (action == flythroughModeAction) modelViewer->doViewModeChanged(LDInputHandler::VMFlyThrough);
115 		else if (action == examineModeAction) modelViewer->doViewModeChanged(LDInputHandler::VMExamine);
116 		else if (action == walkModeAction) modelViewer->doViewModeChanged(LDInputHandler::VMWalk);}
viewZoomToFit()117 	void viewZoomToFit(){	modelViewer->doZoomToFit();}
viewRightSideUp()118 	void viewRightSideUp(){	modelViewer->doRightSideUp();}
viewCameraLocation()119 	void viewCameraLocation(){ modelViewer->doCameraLocation();}
viewRotationCenter()120 	void viewRotationCenter(){ modelViewer->doRotationCenter();}
frontViewAngle()121 	void frontViewAngle(){	modelViewer->doFrontViewAngle();}
backViewAngle()122 	void backViewAngle(){	modelViewer->doBackViewAngle();}
leftViewAngle()123 	void leftViewAngle(){	modelViewer->doLeftViewAngle();}
rightViewAngle()124 	void rightViewAngle(){	modelViewer->doRightViewAngle();}
topViewAngle()125 	void topViewAngle(){    modelViewer->doTopViewAngle();}
bottomViewAngle()126 	void bottomViewAngle(){	modelViewer->doBottomViewAngle();}
latLongViewAngle()127 	void latLongViewAngle(){modelViewer->doLatLongViewAngle();}
isoViewAngle()128 	void isoViewAngle(){	modelViewer->doIsoViewAngle();}
saveDefaultViewAngle()129 	void saveDefaultViewAngle(){    modelViewer->doSaveDefaultViewAngle();}
fileCancelLoad()130 	void fileCancelLoad(){	modelViewer->doFileCancelLoad();}
showViewInfo()131 	void showViewInfo(){	modelViewer->doShowViewInfo();}
showPovCamera()132 	void showPovCamera(){	modelViewer->doShowPovCamera();}
showPovAspectRatio(bool flag)133 	void showPovAspectRatio(bool flag){	modelViewer->doShowPovAspectRatio(flag);}
toolsPartList()134 	void toolsPartList(){	modelViewer->doPartList();}
toolsModelTree()135 	void toolsModelTree(){	modelViewer->doModelTree();}
toolsBoundingBox()136 	void toolsBoundingBox(){modelViewer->doBoundingBox();}
toolsMpdModelSelection()137 	void toolsMpdModelSelection(){	modelViewer->doMpdModel();}
latitudeRotation(bool b)138 	void latitudeRotation(bool b){	modelViewer->switchExamineLatLong(b);}
keepRightSideUp(bool b)139 	void keepRightSideUp(bool b){ modelViewer->keepRightSideUp(b);}
prevStep()140 	void prevStep(){	modelViewer->prevStep();}
nextStep()141 	void nextStep(){	modelViewer->nextStep();}
firstStep()142 	void firstStep(){	modelViewer->firstStep();}
lastStep()143 	void lastStep(){	modelViewer->lastStep();}
gotoStep()144 	void gotoStep(){	modelViewer->gotoStep();}
145     void doFileMenuAboutToShow(void);
146     void doEditMenuAboutToShow(void);
147     void doViewMenuAboutToShow(void);
148     void doToolsMenuAboutToShow(void);
149     void doHelpMenuAboutToShow(void);
150 	void doRecentFile();
151 	void standardSizeSelected();
152 
153 private:
154 	LDrawModelViewer::StandardSizeVector standardSizes;
155 #ifdef __APPLE__
156     QMenu *openRecentMenu;
157 #endif // __APPLE__
158 	int fileSeparatorIndex;
159 	QLabel *toolbarMaxStep, *toolbarCurrentStep, *toolbarStepLabel;
160 	QToolButton *toolbarViewAngle;
161 	QMenu *toolbarWireframeMenu,*edgeMenu, *bfcMenu, *primitiveMenu;
162 };
163 
164 #endif
165