]> git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/textool/StdAfx.h
reformat code! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / plugins / textool / StdAfx.h
1 /*
2    Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 // stdafx.h
23 // precompiled headers
24
25 #include "globaldefs.h"
26
27 // standard headers
28 #include <stdio.h>
29 #include <stdlib.h>
30
31 #if !GDEF_OS_WINDOWS
32
33 // Necessary for proper boolean type declaration
34 #include "qertypes.h"
35
36 typedef void *HMODULE;
37 typedef void *LPVOID;
38 typedef char *LPCSTR;
39
40 #define MB_OK                       0x00000000L
41 #define MB_OKCANCEL                 0x00000001L
42 #define MB_ABORTRETRYIGNORE         0x00000002L
43 #define MB_YESNOCANCEL              0x00000003L
44 #define MB_YESNO                    0x00000004L
45 #define MB_RETRYCANCEL              0x00000005L
46
47
48 #define MB_ICONHAND                 0x00000010L
49 #define MB_ICONQUESTION             0x00000020L
50 #define MB_ICONEXCLAMATION          0x00000030L
51 #define MB_ICONASTERISK             0x00000040L
52
53 #define MB_USERICON                 0x00000080L
54 #define MB_ICONWARNING              MB_ICONEXCLAMATION
55 #define MB_ICONERROR                MB_ICONHAND
56 #define MB_ICONINFORMATION          MB_ICONASTERISK
57 #define MB_ICONSTOP                 MB_ICONHAND
58
59 #define MB_TYPEMASK                 0x0000000FL
60 #define MB_ICONMASK                 0x000000F0L
61 #define MB_DEFMASK                  0x00000F00L
62 #define MB_MODEMASK                 0x00003000L
63 #define MB_MISCMASK                 0x0000C000L
64
65 #define IDOK                1
66 #define IDCANCEL            2
67 #define IDABORT             3
68 #define IDRETRY             4
69 #define IDIGNORE            5
70 #define IDYES               6
71 #define IDNO                7
72
73 typedef struct tagRECT {
74     long left;
75     long top;
76     long right;
77     long bottom;
78 } RECT, *PRECT, *LPRECT;
79
80 #endif // __linux__
81
82 // plugin
83 // FIXME TTimo: drop this
84 extern "C" void Sys_Printf(char *text, ...);
85
86 #include "synapse.h"
87 #include "iplugin.h"
88 #include "qerplugin.h"
89 #include "mathlib.h"
90 #include "igl.h"
91 #include "iselectedface.h"
92 #include "isurfaceplugin.h"
93 #include "iui.h"
94
95 // internals
96 // the implementation of a IWindowListener interface to use with the native UI
97 // TODO: move in it's own set of files?
98 // NOTE: I'm not too sure about the bool flags being any use.. they are supposed to tell if we handle the event or not
99 class CWindowListener : public IWindowListener {
100     int refCount;
101 public:
102 // Increment the number of references to this object
103     void IncRef()
104     { refCount++; }
105
106 // Decrement the reference count
107     void DecRef()
108     {
109         if (--refCount <= 0) {
110             delete this;
111         }
112     }
113
114 // IWindowListener ---------------------------------------
115     bool OnLButtonDown(guint32 nFlags, double x, double y);
116
117     bool OnMButtonDown(guint32 nFlags, double x, double y)
118     { return false; }
119
120     bool OnRButtonDown(guint32 nFlags, double x, double y);
121
122     bool OnLButtonUp(guint32 nFlags, double x, double y);
123
124     bool OnMButtonUp(guint32 nFlags, double x, double y)
125     { return false; }
126
127     bool OnRButtonUp(guint32 nFlags, double x, double y);
128
129     bool OnMouseMove(guint32 nFlags, double x, double y);
130
131     bool OnKeyPressed(char *s);
132
133     bool Paint();
134
135     void Close();
136 };
137
138 #include "2DView.h"
139
140 typedef struct {
141     float data[MAX_POINTS_ON_WINDING][2];
142 } CtrlPts_t;
143
144 #include "ControlPointsManager.h"
145
146 extern OpenGLBinding g_QglTable;
147 extern _QERFuncTable_1 g_FuncTable;
148 // prefs globals
149 // NOTE: these are used by the CControlPointsManager classes, not very C++ish
150 extern bool g_bPrefsUpdateCameraView;
151 extern _QERSelectedFaceTable g_SelectedFaceTable;
152 extern _QERFaceData g_CancelFaceData;
153
154 #define Sys_Printf g_FuncTable.m_pfnSysPrintf
155 #define Sys_FPrintf g_FuncTable.m_pfnSysFPrintf
156
157 // call to validate the current changes into the editor
158 extern void Textool_Validate();
159
160 extern void Textool_Cancel();
161
162 class CSynapseClientTexTool : public CSynapseClient {
163 public:
164 // CSynapseClient API
165     bool RequestAPI(APIDescriptor_t *pAPI);
166
167     const char *GetInfo();
168
169     CSynapseClientTexTool()
170     {}
171
172     virtual ~CSynapseClientTexTool()
173     {}
174 };
175
176 extern IWindow *g_pToolWnd;