00001
00002
00003
00004
00005
00006
00007
00008 #pragma warning ( disable : 4312 4311)
00009
00010
00011 #define _WIN32_WINNT 0x0500
00012
00013 #include <stdlib.h>
00014 #include <stdio.h>
00015 #include <math.h>
00016 #include <setjmp.h>
00017 #include <windows.h>
00018 #include <commctrl.h>
00019 #include <gl\gl.h>
00020 #include <gl\glu.h>
00021
00022 #include "mstruct.h"
00023 #include "mmenuid.h"
00024 #include "dialogs.h"
00025 #include "mstrings.h"
00026
00027 #define WM_UPDATEPDIALOG (WM_USER+1)
00028 #define WM_INTERROGATE (WM_USER+2)
00029
00030 #ifdef MODULE_DESIGN
00031 #define WHERE
00032 #else
00033 #define WHERE extern
00034 #endif
00035 WHERE HINSTANCE ghinst_main,ghinstDummy1;
00036 WHERE HPALETTE ghpaletteScreen,ghpaletteDummy1;
00037 WHERE HFONT ghFont1,ghFont2;
00038 WHERE HWND ghwnd_main,ghwnd_triview[3],ghwnd_current,
00039 ghwnd_view,ghwnd_info,ghwndDlgPrimitives,
00040 ghwndTools,ghwndLock,ghwndData,
00041 ghwndCoord1,ghwndDlgAttribs,ghwndDlgExpand,
00042 ghwndDlgTools,ghwndOpenGLview,ghwndTooltip,
00043 ghwndSkEdit,ghwndSkToolbar;
00044 WHERE COLORREF gScreenColourRef,gGridColourRef1,gGridColourRef2;
00045 WHERE HBRUSH ghbrushScreen,ghbrushWindow,
00046 ghSelectedBrush,ghDeselectedBrush,ghInvertBrush,
00047 ghDummyb1,ghDummyb2,ghDummyb3;
00048 WHERE HPEN ghSelectedPen,ghDeselectedPen,ghEditPen,ghEdgePen,
00049 ghInvertPen,ghWireframePen,ghCursorPen,ghSelectorPen,
00050 ghDeselectorPen,ghDotSelectedPen,
00051 ghDummyp1,ghDummyp2,ghdummyp3;
00052 WHERE HCURSOR ghcurWait,ghcurArrow,ghcurCross,ghcurSave,ghcurPan,
00053 ghcurArrowD,ghcurZout,ghcurZin,ghcurSelect,ghcurDeselect,
00054 ghcurPlotter,ghcurPlot3d,ghcurGrabber,ghcurBuilder,
00055 ghcurExpander,ghcurRotator,ghcurPrims, ghcurZoom,
00056 ghcurShaper,ghcurMagnetTo,ghcurMagnetFr,
00057 ghcurMagnetTw,ghcurMagnetCu,
00058 ghcurSel_a,ghcurSel_s,ghcurSel_l_a,ghcurSel_l_s,
00059 ghcurSel_c_a,ghcurSel_c_s;
00060 WHERE HCURSOR ghcurTools[NTOOLS];
00061 WHERE X__STRUCTURE EviStructure;
00062 WHERE X__MEMORY_MANAGER EviMemoryManager;
00063 WHERE FILE *debug;
00064 WHERE jmp_buf j_buf;
00065 WHERE UINT update_timer;
00066 WHERE long Xres,Yres;
00067 WHERE long WindowBox_view;
00068 WHERE BOOL StartedInModeler,bToolpannelLeft,bToolpannelSmall,
00069 bBackgroundImage,bEmbedImageMaps;
00070 WHERE long View,ActiveView;
00071 WHERE int ToolbuttonSize,ToolpannelSpace,
00072 WindowLeftOrigin,WindowTopOrigin,
00073 WindowGap,
00074 TriviewSpaceX,TriviewSpaceY,
00075 Window0sizeX,Window0sizeY,
00076 Textheight,Textwidth,
00077 WindowSizeX[3],WindowSizeY[3],
00078 WindowCentreX[3],WindowCentreY[3],
00079 WindowViewXsize,WindowViewYsize,
00080 InfoWindowSize,
00081 WindowsXmin[3],WindowsYmin[3],
00082 WindowViewXmin,WindowViewYmin;
00083 WHERE double WindowPixelSize;
00084 WHERE long TVpointX,TVpointY,TVpointZ,
00085 TVcentreX,TVcentreY,TVcentreZ,
00086 TVsizeX,TVsizeY,TVsizeZ;
00087 WHERE char gszHomeDir[MAX_DIR];
00088 WHERE char gszSCEfile[MAX_FILE],gszSCEdir[MAX_DIR];
00089 WHERE char gszSCFfile[MAX_FILE],gszSCFdir[MAX_DIR];
00090 WHERE char gszSCNfile[MAX_FILE],gszSCNdir[MAX_DIR];
00091 WHERE char gszPTHfile[MAX_FILE],gszPTHdir[MAX_DIR];
00092 WHERE char gszIMGfile[MAX_FILE],gszIMGdir[MAX_DIR];
00093 WHERE char gszGIFfile[MAX_FILE],gszGIFdir[MAX_DIR];
00094 WHERE char gszDLLfile[MAX_FILE],gszDLLdir[MAX_DIR];
00095 WHERE char gszDXFfile[MAX_FILE],gszDXFdir[MAX_DIR];
00096 WHERE char gsz3DSfile[MAX_FILE],gsz3DSdir[MAX_DIR];
00097 WHERE char gszTDDfile[MAX_FILE],gszTDDdir[MAX_DIR];
00098 WHERE char gszDLMfile[MAX_FILE],gszDLMdir[MAX_DIR];
00099 WHERE char gszAVIfile[MAX_FILE],gszAVIdir[MAX_DIR];
00100 WHERE char gszBRDfile[MAX_FILE],gszBRDdir[MAX_DIR];
00101 WHERE char gszMTLfile[MAX_FILE],gszMTLdir[MAX_DIR];
00102 WHERE int gCurTool,gCurCommand,gCurSelect,gCurAction,gCurZoom,
00103 gCurCoord,gCurLock;
00104 WHERE PREFERENCES Preferences;
00105 WHERE PRIMITIVE PrimStruct;
00106 #undef WHERE
00107
00108 #ifdef MODULE_DESIGN
00109 char IniFilename[256],TempPath[256],
00110 IniSection[] = "MPREFERENCES";
00111 char szMainClass[] ="OFX:ModelerClass",
00112 szViewClass[] ="OFX:ModelerViewClass",
00113 szTriViewClass[]="OFX:ModelerTriViewClass",
00114 szToolboxClass[]="OFX:ModelerToolboxClass",
00115 szToolBtnClass[]="OFX:ModelerToolBtnClass";
00116 HDC ghdc_triview_Bitmap[3]={NULL,NULL,NULL},ghdc_view_Bitmap=NULL;
00117 HBITMAP ghbm_triview[3]={NULL,NULL,NULL},ghbm_view=NULL;
00118 int EDIT_ACTION=NO,LOADOPERATION=NO,CursorToggle=0,current_message = -1,
00119 UNDO_ON=YES,icon_arrow_ids=YES,type_of_view=0,do_NOT_abort=FALSE,
00120 axis_move_flag = -1,image_edit_flag= -1;
00121 char ruler_name[8];
00122 double ruler=(double)UNIT;
00123 long rulerx=0,rulery=0,rulerz=0,
00124 lrulerx=0,lrulery=0,lrulerz=0,
00125 draw_grid_on=0,grid_on=0,grid_size=UNIT,
00126 coords_visible=0,data_visible=0,global_quickdraw=0,draw_joins=1,
00127 rubberbone_model=0;
00128 long NpointerX=0,NpointerY=0,NpointerZ=0;
00129 int tool=NOTOOL,sktool=NO,lock_visible=NO,controls_visible=YES,
00130 select_visible=YES,tools_visible=YES;
00131 wireframe w_frame={0,0,NULL,NULL};
00132 bezier_curve *Bcurves=NULL;
00133 key_points ObjectAxis={NULL,
00134 0,0,0,0,0.0,0.0,
00135 0L,0L,0L, 0L,0L,0L,
00136 NULL,
00137 0,0,0,0,0.0,0.0,
00138 0L,0L,0L,0L,0L,0L};
00139 vertex *MainVp=NULL;
00140 edge *MainEp=NULL;
00141 face *MainFp=NULL;
00142 skel *MainSp=NULL,*FirstSp=NULL,*current_skeleton=NULL;
00143 nurbs *MainNp=NULL;
00144 unsigned long Nvert=0,NvertSelect=0,NvertDeselect=0,
00145 Nface=0,Nedge=0,Nskel=0,N_Bcurves=0,Nnurbs=0;
00146 int SelectedBrush = -1, SelectedShader = -1,MirrorFlag = -1,
00147 FontLoaded=NO,ShadowFlag=NO;
00148 double PerspTheta=0.0,
00149 PerspFi=0.0;
00150 int nImaps=0,nLockediMaps=0,nMats=0;
00151 IMAGEMAP iMap[NMAPSMAX];
00152 SURFACEMATERIAL iMat[NMATERIALMAX];
00153 char *AlTextList[] = {
00154 "Plain","Wood","Marble","Granite","Brick","Luminous","Fire",
00155 "Bumpy","Aztec","Wrinkled","Spotted","Agate","Cloudy","Dents","Blend"};
00156 short NoAlTexts = 15;
00157 long DefaultBrilliance=8,DefaultParameter=0,
00158 DefaultReflectivity=0,DefaultTransp=0,
00159 DefaultTexture=0,DefaultShiny=0,DefaultSmoothing=0;
00160 unsigned char FaceColour[3]={164,164,164},
00161 ShaderColour[3]={128,128,128},
00162 LastColour[3]={164,164,164};
00163 int nActionsList=0;
00164 char *ActionsList[256];
00165 #else
00166 extern char IniFilename[],TempPath[],
00167 IniSection[];
00168 extern char szMainClass[],
00169 szTriViewClass[],
00170 szViewClass[],
00171 szToolboxClass[],
00172 szToolBtnClass[];
00173 extern HDC ghdc_triview_Bitmap[],ghdc_view_Bitmap;
00174 extern HBITMAP ghbm_triview[],ghbm_view;
00175 extern int EDIT_ACTION,LOADOPERATION,CursorToggle,current_message,
00176 UNDO_ON,icon_arrow_ids,type_of_view,do_NOT_abort,
00177 axis_move_flag,image_edit_flag;
00178 extern key_points ObjectAxis;
00179 extern char ruler_name[];
00180 extern double ruler;
00181 extern long rulerx,rulery,rulerz,
00182 lrulerx,lrulery,lrulerz,
00183 draw_grid_on,grid_on,grid_size,
00184 coords_visible,data_visible,global_quickdraw,draw_joins,
00185 rubberbone_model;
00186 extern long NpointerX,NpointerY,NpointerZ;
00187 extern int tool,sktool,lock_visible,controls_visible,
00188 select_visible,tools_visible;
00189 extern wireframe w_frame;
00190 extern bezier_curve *Bcurves;
00191 extern vertex *MainVp;
00192 extern edge *MainEp;
00193 extern face *MainFp;
00194 extern skel *MainSp,*FirstSp,*current_skeleton;
00195 extern nurbs *MainNp;
00196 extern unsigned long Nvert,NvertSelect,NvertDeselect,
00197 Nface,Nedge,Nskel,N_Bcurves,Nnurbs;
00198 extern int SelectedBrush,SelectedShader,FontLoaded,MirrorFlag,ShadowFlag;
00199 extern double PerspTheta,
00200 PerspFi;
00201 extern int nImaps,nLockediMaps,nMats;
00202 extern IMAGEMAP iMap[];
00203 extern SURFACEMATERIAL iMat[];
00204 extern char *AlTextList[];
00205 extern short NoAlTexts;
00206 extern long DefaultBrilliance,DefaultParameter,
00207 DefaultReflectivity,DefaultTransp,
00208 DefaultTexture,DefaultShiny,DefaultSmoothing;
00209 extern unsigned char FaceColour[],ShaderColour[],LastColour[];
00210 extern int nActionsList;
00211 extern char *ActionsList[];
00212 #endif
00213
00214
00215 #include "mprotos.h"
00216