// 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(&GLDialog::OnSelect)); m_cancelButton.OnPress (this,static_cast(&GLDialog::OnCancel)); m_genButton.OnPress (this,static_cast(&GLDialog::OnGenerate)); m_funcName.OnTextChanged (this,static_cast(&GLDialog::OnChange)); m_useTexture.OnPress (this,static_cast(&GLDialog::OnChange)); m_useInfo.OnPress (this,static_cast(&GLDialog::OnChange)); m_forceCOG.OnPress (this,static_cast(&GLDialog::OnChange)); m_blitzMax.OnPress (this,static_cast(&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()); }