summaryrefslogtreecommitdiff
path: root/opengl/gldialog.cpp
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-04-15 00:53:56 +0000
committerIan C <ianc@noddybox.co.uk>2005-04-15 00:53:56 +0000
commit71c1ae31007891ecfd59236ba8564bc4b5deb1e4 (patch)
tree5d307457e7bfa2bb544267826a37366c51215901 /opengl/gldialog.cpp
parentede67ff31c69f56094a1248cd0bdb7f529dba0f3 (diff)
Initial import
Diffstat (limited to 'opengl/gldialog.cpp')
-rw-r--r--opengl/gldialog.cpp142
1 files changed, 142 insertions, 0 deletions
diff --git a/opengl/gldialog.cpp b/opengl/gldialog.cpp
new file mode 100644
index 0000000..c279944
--- /dev/null
+++ b/opengl/gldialog.cpp
@@ -0,0 +1,142 @@
+// msGLExport - OpenGL exporter for Milkshape
+//
+// Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk)
+//
+// 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.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// -------------------------------------------------------------------------
+//
+static const char rcs_id[]="$Id$";
+
+#include "gldialog.h"
+#include "dialog.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// GLDialog dialog
+
+
+GLDialog::GLDialog(Generate& gen)
+ : m_gen(gen)
+ , m_dirButton(this,IDC_BUT_SELECTDIR,0)
+ , m_funcName(this,IDC_TXT_FUNCNAME,0)
+ , m_useTexture(this,IDC_CHK_TEXTURE,0)
+ , m_useInfo(this,IDC_CHK_DEFINE,0)
+ , m_cancelButton(this,IDC_BUT_CANCEL,0)
+ , m_genButton(this,IDC_BUT_GENERATE,0)
+ , m_info(this,IDC_TXT_INFO,0)
+ , m_dir(this,IDC_TXT_DIR,0)
+ , m_forceCOG(this,IDC_CHK_FORCECOG,0)
+ , m_blitzMax(this,IDC_CHK_BLITZMAX,0)
+{
+ char path[1024];
+
+ GetCurrentDirectory(sizeof path,path);
+
+ m_fname=path;
+
+ m_dirButton.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnSelect));
+
+ m_cancelButton.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnCancel));
+
+ m_genButton.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnGenerate));
+
+ m_funcName.OnTextChanged
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnChange));
+
+ m_useTexture.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnChange));
+
+ m_useInfo.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnChange));
+
+ m_forceCOG.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnChange));
+
+ m_blitzMax.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&GLDialog::OnChange));
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// GLDialog public members
+
+int GLDialog::ResourceID()
+{
+ return GL_DIALOG;
+}
+
+
+void GLDialog::OnInit()
+{
+ m_dir.SetText(m_fname);
+ m_funcName.SetText(m_gen.GenerateFuncname());
+ m_genButton.Enable(true);
+ Preview();
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// GLDialog message handlers
+
+BOOL GLDialog::OnGenerate(UINT msg, WPARAM wp, LPARAM lp)
+{
+ Close(IDOK);
+ return TRUE;
+}
+
+
+BOOL GLDialog::OnSelect(UINT msg, WPARAM wp, LPARAM lp)
+{
+ if (W32DLib::Common::SelectDir(m_wnd,"Select Directory",m_fname))
+ {
+ OnChange(msg,wp,lp);
+ }
+ return TRUE;
+}
+
+
+BOOL GLDialog::OnCancel(UINT msg, WPARAM wp, LPARAM lp)
+{
+ Close(IDCANCEL);
+ return TRUE;
+}
+
+
+BOOL GLDialog::OnChange(UINT msg, WPARAM wp, LPARAM lp)
+{
+ Preview();
+ m_genButton.Enable(m_funcName.GetText().length()!=0);
+ return TRUE;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// GLDialog private members
+
+void GLDialog::Preview()
+{
+ m_gen.Setup(m_fname,
+ m_funcName.GetText(),
+ m_useTexture.GetState(),
+ m_useInfo.GetState(),
+ m_forceCOG.GetState());
+
+ m_info.SetText(m_gen.Info());
+}