/*========================================================================= * * DlgMain1.cpp - implementation file for main window class * Dialog functions * * Version 1.0 * Revision date * *=======================================================================*/ #include #include "stdafx.h" #include "DlgMain.h" #include "print.h" #include "main.h" #include "system.h" #include "Help.h" #include "IniData.h" #include "resource.hm" char g_szAnims[255]; char g_szBanks[255]; char g_szClasses[255]; char g_szFamilies[255]; char g_szLevels[255]; char g_szTextures[255]; extern "C" { BOOL g_bStandardConfig = TRUE; } //==================================================// // HELP // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on IDC_BUTTON_HELP button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckHelp() { CButton *p_oCheck = ((CButton *) GetDlgItem (IDC_BUTTON_HELP)); RECT stRect; CMenu oMenu; oMenu.CreatePopupMenu(); oMenu.AppendMenu( MF_STRING | MF_ENABLED, IDM_ABOUTBOX, "About ..."); oMenu.AppendMenu( MF_STRING | MF_ENABLED, IDM_OPENHELP, "Help"); p_oCheck->GetWindowRect(&stRect); oMenu.TrackPopupMenu( TPM_LEFTBUTTON, stRect.left, stRect.bottom, this ); oMenu.DestroyMenu(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on IDM_OPENHELP entry *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnHelp() { xString sDirectory; int nPanel; // set directory GetCurrentDirectory(256, sDirectory); SetCurrentDirectory(g_sInitialDir); // get the current panel nPanel = m_oMainPanel.GetCurSel(); switch(nPanel) { // the "Options" panel case 0: ::WinHelp(this->GetSafeHwnd(), C_szMainHelpFile, HELP_CONTEXT, ID_USAGE_PATHS ); break; // the "Selection" panel case 1: ::WinHelp(this->GetSafeHwnd(), C_szMainHelpFile, HELP_CONTEXT, ID_USAGE_SELECTION ); break; // the "Result" panel case 2: ::WinHelp(this->GetSafeHwnd(), C_szMainHelpFile, HELP_CONTEXT, ID_USAGE_CONVERSION ); break; } SetCurrentDirectory(sDirectory); } /**************************************************************************** * Description: Handle function for message WM_HELPINFO *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ BOOL CDlgMain::OnHelpInfo(HELPINFO* pHelpInfo) { // AfxGetApp()->WinHelp(pHelpInfo->dwContextId, HELP_CONTEXTPOPUP); OnHelp(); return TRUE; } //==================================================// // CHANGE PANEL // //==================================================// /**************************************************************************** * Description: Handle function for message TCN_SELCHANGE on main panel *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSelchangePanel(NMHDR* pNMHDR, LRESULT* pResult) { // get current panel int nPanel = m_oMainPanel.GetCurSel(); // check data validity before changing BOOL bResult = m_fn_vTestIniDatas(); // get the current panel and for it show only its controls switch(nPanel) { // "Options" panel case 0: m_fn_TabC_vShowControlsPanelDir() ; break; // "Selection" panel case 1: if (bResult) { m_fn_TabC_vShowControlsPanelDir() ; m_oMainPanel.SetCurSel(0); } else m_fn_TabC_vShowControlsPanelSel() ; break; // "Result" panel case 2: if (bResult) { m_fn_TabC_vShowControlsPanelDir() ; m_oMainPanel.SetCurSel(0); } else m_fn_TabC_vShowControlsPanelRes() ; break; } *pResult = 0; } /**************************************************************************** * Description: Handle function for message TCN_SELCHANGE on config panel *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult) { // get current panel int nPanel = m_oConfigPanel.GetCurSel(); // get the current panel and for it show only its controls switch(nPanel) { // "Current" panel case 0: if (m_bConversion) { m_fn_vShowControlsPanelCustom() ; g_bStandardConfig = FALSE; m_oConfigPanel.SetCurSel(1); } else { m_fn_vShowControlsPanelCurrent(); g_bStandardConfig = TRUE; m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); } break; // "Custom" panel case 1: if (m_bConversion) { m_fn_vShowControlsPanelCurrent() ; g_bStandardConfig = TRUE; m_oConfigPanel.SetCurSel(0); } else { m_fn_vShowControlsPanelCustom(); g_bStandardConfig = FALSE; m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); } break; } *pResult = 0; } //==================================================// // RENAME DIRECTORIES // //==================================================// /**************************************************************************** * Description: Handle function for message EN_KILLFOCUS on edit box Game Specific1 *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnKillFocusGameSpecific1() { char szName[15]; m_oEditGameSp1.GetWindowText(szName, 14); if (strcmp(szName, "")) { fn_IniData_vSetGameSp1(szName); strcpy(g_stInitialData.szGameSp1, szName); } } /**************************************************************************** * Description: Handle function for message EN_KILLFOCUS on edit box Game Specific2 *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnKillFocusGameSpecific2() { char szName[15]; m_oEditGameSp2.GetWindowText(szName, 14); if (strcmp(szName, "")) { fn_IniData_vSetGameSp2(szName); strcpy(g_stInitialData.szGameSp2, szName); } } /**************************************************************************** * Description: Handle function for message EN_KILLFOCUS on edit box Raw Specific1 *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnKillFocusRawSpecific1() { char szName[15]; m_oEditRawSp1.GetWindowText(szName, 14); if (strcmp(szName, "")) { fn_IniData_vSetRawSp1(szName); strcpy(g_stInitialData.szRawSp1, szName); } } /**************************************************************************** * Description: Handle function for message EN_KILLFOCUS on edit box Raw Specific2 *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnKillFocusRawSpecific2() { char szName[15]; m_oEditRawSp2.GetWindowText(szName, 14); if (strcmp(szName, "")) { fn_IniData_vSetRawSp2(szName); strcpy(g_stInitialData.szRawSp2, szName); } } //==================================================// // CHOOSE DIRECTORIES // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on GameData radio button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckGameData() { if (m_oCheckGameData.GetCheck()) { m_oCheckGameData.SetCheck(1); m_oCheckGameSP1.SetCheck(0); m_oCheckGameSP2.SetCheck(0); g_iData = 0; m_fn_vResetSelection() ; fn_ComRes_vDeleteLines( &m_oRichEditCom); fn_ComRes_vDeleteLines( &m_oRichEditRes); if (!g_iData && !g_bAskFamily) m_oCheckCommon.EnableWindow(TRUE); if (g_iData && !g_bAskFamily) m_oCheckSpecific.EnableWindow(TRUE); m_fn_vUpdateForSelectConfig(); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on GameSpecific1 radio button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckGameSpecific1() { if (m_oCheckGameSP1.GetCheck()) { if (strcmp(g_stInitialData.szGameSpecific1, "")) { m_oCheckGameSP1.SetCheck(1); m_oCheckGameData.SetCheck(0); m_oCheckGameSP2.SetCheck(0); g_iData=1; } else { m_oCheckGameSP1.SetCheck(0); m_oCheckGameSP2.SetCheck(0); m_oCheckGameData.SetCheck(1); g_iData=0; } } m_fn_vResetSelection() ; fn_ComRes_vDeleteLines( &m_oRichEditCom); fn_ComRes_vDeleteLines( &m_oRichEditRes); if (!g_iData && !g_bAskFamily) m_oCheckCommon.EnableWindow(TRUE); if (g_iData && !g_bAskFamily) m_oCheckSpecific.EnableWindow(TRUE); m_fn_vUpdateForSelectConfig(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on GameSpecific2 radio button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckGameSpecific2() { if (m_oCheckGameSP2.GetCheck()) { if (strcmp(g_stInitialData.szGameSpecific2, "")) { m_oCheckGameSP2.SetCheck(1); m_oCheckGameData.SetCheck(0); m_oCheckGameSP1.SetCheck(0); g_iData=2; } else { m_oCheckGameSP1.SetCheck(0); m_oCheckGameSP2.SetCheck(0); m_oCheckGameData.SetCheck(1); g_iData=0; } } m_fn_vResetSelection() ; fn_ComRes_vDeleteLines( &m_oRichEditCom); fn_ComRes_vDeleteLines( &m_oRichEditRes); if (!g_iData && !g_bAskFamily) m_oCheckCommon.EnableWindow(TRUE); if (g_iData && !g_bAskFamily) m_oCheckSpecific.EnableWindow(TRUE); m_fn_vUpdateForSelectConfig(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on RawData radio button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckRawData() { if (m_oCheckRawData.GetCheck()) { m_oCheckRawData.SetCheck(1); m_oCheckRawSP1.SetCheck(0); m_oCheckRawSP2.SetCheck(0); g_iRaw = 0; m_fn_vFreeMemory(); m_p_oTypeAnims = NULL; m_p_oTypeBanks = NULL; m_p_oTypeClasses = NULL; m_p_oTypeFamilies = NULL; m_p_oTypeLevels = NULL; m_p_oTypeTextures = NULL; //reset the contains of the list boxes m_oListType->ResetContent(); m_oListObject->ResetContent(); m_fn_vUpdateAll(); //reset the total number of selections m_iCountOfSelections = 0; if (!g_iData && !g_bAskFamily) m_oCheckCommon.EnableWindow(TRUE); if (g_iData && !g_bAskFamily) m_oCheckSpecific.EnableWindow(TRUE); m_fn_vUpdateForSelectConfig(); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on RawSpecific1 radio button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckRawSpecific1() { if (m_oCheckRawSP1.GetCheck()) { m_fn_vFreeMemory(); m_p_oTypeAnims = NULL; m_p_oTypeBanks = NULL; m_p_oTypeClasses = NULL; m_p_oTypeFamilies = NULL; m_p_oTypeLevels = NULL; m_p_oTypeTextures = NULL; //reset the contains of the list boxes m_oListType->ResetContent(); m_oListObject->ResetContent(); if (strcmp(g_stInitialData.szRawSpecific1, "")) { m_oCheckRawSP1.SetCheck(1); m_oCheckRawData.SetCheck(0); m_oCheckRawSP2.SetCheck(0); g_iRaw=1; } else { m_oCheckRawSP1.SetCheck(0); m_oCheckRawSP2.SetCheck(0); m_oCheckRawData.SetCheck(1); g_iRaw=0; } m_fn_vUpdateAll(); //reset the total number of selections m_iCountOfSelections = 0; if (!g_iData && !g_bAskFamily) m_oCheckCommon.EnableWindow(TRUE); if (g_iData && !g_bAskFamily) m_oCheckSpecific.EnableWindow(TRUE); m_fn_vUpdateForSelectConfig(); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on RawSpecific2 radio button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckRawSpecific2() { if (m_oCheckRawSP2.GetCheck()) { m_fn_vFreeMemory(); m_p_oTypeAnims = NULL; m_p_oTypeBanks = NULL; m_p_oTypeClasses = NULL; m_p_oTypeFamilies = NULL; m_p_oTypeLevels = NULL; m_p_oTypeTextures = NULL; //reset the contains of the list boxes m_oListType->ResetContent(); m_oListObject->ResetContent(); if (strcmp(g_stInitialData.szRawSpecific2, "")) { m_oCheckRawSP2.SetCheck(1); m_oCheckRawData.SetCheck(0); m_oCheckRawSP1.SetCheck(0); g_iRaw=2; } else { m_oCheckRawSP2.SetCheck(0); m_oCheckRawSP1.SetCheck(0); m_oCheckRawData.SetCheck(1); g_iRaw=0; } m_fn_vUpdateAll(); //reset the total number of selections m_iCountOfSelections = 0; if (!g_iData && !g_bAskFamily) m_oCheckCommon.EnableWindow(TRUE); if (g_iData && !g_bAskFamily) m_oCheckSpecific.EnableWindow(TRUE); m_fn_vUpdateForSelectConfig(); } } //==================================================// // BROWSE DIRECTORIES // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on GameData Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseGameData() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { // if the new directory is different to the initial one if (strcmp(szPath, g_stInitialData.szGameData)) { char szPathAux1[ MAX_PATH ]; char szPathAux2[ MAX_PATH ]; char _szMessage[50]; strcpy(szPathAux1, szPath); strcpy(szPathAux2, szPath); // in the directory GameData there must be sub-directories if (!m_fn_bExistDirectories(szPath)) { sprintf( _szMessage,"Error : You have to select another GameData directory, because it does not contain any directories (It should contain the Texture and Default sub-directories)!"); AfxMessageBox( _szMessage, MB_OK | MB_ICONSTOP ); strcpy (szPath, ""); } // see if in the new path exist the last sub-directories if (!(szPathAux1[strlen(szPathAux1)-1]=='\\')) strcat(szPathAux1, "\\"); strcat(szPathAux1, g_stInitialData.szTextures); if (!(szPathAux2[strlen(szPathAux2)-1]=='\\')) strcat(szPathAux2, "\\"); strcat(szPathAux2, g_stInitialData.szDefault); } // set that path for the Game Data directory fn_IniData_vSetGameData( szPath ); strcpy(g_stInitialData.szGameData, szPath); GetDlgItem( IDC_EDIT_GAMEDATA )->SetWindowText( szPath ); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on GameSpecific1 Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseGameSpecific1() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { // set that path for the Game Specific1 directory fn_IniData_vSetGameSpecific1( szPath ); strcpy(g_stInitialData.szGameSpecific1, szPath); GetDlgItem( IDC_EDIT_GAMESPECIFIC1 )->SetWindowText( szPath ); if (strcmp(g_stInitialData.szGameSpecific1, "")) m_oCheckGameSP1.EnableWindow(TRUE); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on GameSpecific2 Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseGameSpecific2() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { // set that path for the Game Specific2 directory fn_IniData_vSetGameSpecific2( szPath ); strcpy(g_stInitialData.szGameSpecific2, szPath); GetDlgItem( IDC_EDIT_GAMESPECIFIC2 )->SetWindowText( szPath ); if (strcmp(g_stInitialData.szGameSpecific2, "")) m_oCheckGameSP2.EnableWindow(TRUE); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on RawData Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseRawData() { char szPath[ MAX_PATH ]; int i; if (m_iCountOfSelections) { char _szMessage[50]; sprintf( _szMessage, "In the RawData directory there are some selections made. Do you want to loose this selections by changing the directory?\n"); if (AfxMessageBox( _szMessage, MB_YESNO | MB_ICONQUESTION) == IDNO) return; } // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { // set that path for the Raw Data directory fn_IniData_vSetRawData( szPath ); strcpy(g_stInitialData.szRawData, szPath); GetDlgItem( IDC_EDIT_RAWDATA )->SetWindowText( szPath ); //remove all the elements in the lists with objects m_fn_vFreeMemory(); m_p_oTypeAnims = NULL; m_p_oTypeBanks = NULL; m_p_oTypeClasses = NULL; m_p_oTypeFamilies = NULL; m_p_oTypeLevels = NULL; m_p_oTypeTextures = NULL; //reset the contains of the list boxes m_oListType->ResetContent(); m_oListObject->ResetContent(); m_fn_vUpdateAll(); //reset the total number of selections m_iCountOfSelections = 0; m_fn_vUpdateForSelectConfig(); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on RawSpecific1 Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseRawSpecific1() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { // set that path for the Game Specific1 directory fn_IniData_vSetRawSpecific1( szPath ); strcpy(g_stInitialData.szRawSpecific1, szPath); GetDlgItem( IDC_EDIT_RAWSPECIFIC1 )->SetWindowText( szPath ); if (strcmp(g_stInitialData.szRawSpecific1, "")) m_oCheckRawSP1.EnableWindow(TRUE); //remove all the elements in the lists with objects m_fn_vFreeMemory(); m_p_oTypeAnims = NULL; m_p_oTypeBanks = NULL; m_p_oTypeClasses = NULL; m_p_oTypeFamilies = NULL; m_p_oTypeLevels = NULL; m_p_oTypeTextures = NULL; //reset the contains of the list boxes m_oListType->ResetContent(); m_oListObject->ResetContent(); m_fn_vUpdateAll(); //reset the total number of selections m_iCountOfSelections = 0; m_fn_vUpdateForSelectConfig(); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on RawSpecific2 Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseRawSpecific2() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { // set that path for the Game Specific2 directory fn_IniData_vSetRawSpecific2( szPath ); strcpy(g_stInitialData.szRawSpecific2, szPath); GetDlgItem( IDC_EDIT_RAWSPECIFIC2 )->SetWindowText( szPath ); if (strcmp(g_stInitialData.szRawSpecific2, "")) m_oCheckRawSP2.EnableWindow(TRUE); //remove all the elements in the lists with objects m_fn_vFreeMemory(); m_p_oTypeAnims = NULL; m_p_oTypeBanks = NULL; m_p_oTypeClasses = NULL; m_p_oTypeFamilies = NULL; m_p_oTypeLevels = NULL; m_p_oTypeTextures = NULL; //reset the contains of the list boxes m_oListType->ResetContent(); m_oListObject->ResetContent(); m_fn_vUpdateAll(); //reset the total number of selections m_iCountOfSelections = 0; m_fn_vUpdateForSelectConfig(); } } //==================================================// // DIRECTORY CONFIGURATION // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on button Create for DirConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCreateConfigDir() { if (g_bChangeComboDir && g_iCurrentIndexDir) { int iResult = AfxMessageBox( "The current configuration was changed : if you do not save it before creating a new one, the changes will be lost!\n Do you want to save the current configuration ?", MB_YESNOCANCEL | MB_ICONEXCLAMATION ); switch (iResult) { case IDYES: OnSaveConfigDir(); break; case IDNO: g_bChangeComboDir = FALSE; break; case IDCANCEL: m_oComboChooseDir.SetCurSel(g_iCurrentIndexDir); return; } } m_oButtonCreateDir.ShowWindow(FALSE); m_oEditCreateDir.ShowWindow(TRUE); m_oEditCreateDir.SetFocus(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on button Register for DirConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnRegisterConfigDir() { m_oButtonRegisterDir.ShowWindow(FALSE); m_oEditRegisterDir.ShowWindow(TRUE); m_oEditRegisterDir.SetFocus(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on button Save for DirConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSaveConfigDir() { int i = m_oComboChooseDir.GetCurSel(); xString szDir1; if (i!=-1) { //save the directories for the new config GetCurrentDirectory( MAX_PATH, szDir1 ); SetCurrentDirectory( g_szInitialDirectory ); GetCurrentDirectory( MAX_PATH, g_szIniConfDirFile ); if (g_szIniConfDirFile[strlen(g_szIniConfDirFile) - 1] != '\\') strcat( g_szIniConfDirFile, "\\"); strcat( g_szIniConfDirFile, C_szIniConfDirFile ); SetCurrentDirectory( szDir1 ); g_bChangeComboDir = FALSE; m_fn_vRegisterAllPaths(i); xString szPath; strcpy(szPath, ""); for (int i=1; iSetWindowText( szPath ); strcpy(g_szAnims, szPath); m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); g_bChangeComboDir = (g_iCurrentIndexDir != 0); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Banks Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseBanks() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { GetDlgItem( IDC_EDIT_BANKS )->SetWindowText( szPath ); strcpy(g_szBanks, szPath); m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); g_bChangeComboDir = (g_iCurrentIndexDir != 0); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Classes Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseClasses() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { GetDlgItem( IDC_EDIT_CLASSES )->SetWindowText( szPath ); strcpy(g_szClasses, szPath); m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); g_bChangeComboDir = (g_iCurrentIndexDir != 0); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Families Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseFamilies() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { GetDlgItem( IDC_EDIT_FAMILIES )->SetWindowText( szPath ); strcpy(g_szFamilies, szPath); m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); g_bChangeComboDir = (g_iCurrentIndexDir != 0); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Levels Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseLevels() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { GetDlgItem( IDC_EDIT_LEVELS )->SetWindowText( szPath ); strcpy(g_szLevels, szPath); m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); g_bChangeComboDir = (g_iCurrentIndexDir != 0); } } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Textures Browse button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnButtonBrowseTextures() { char szPath[ MAX_PATH ]; int i; // prepare the structure for the browsing m_fn_vBrowseDirectory(szPath, &i, NULL); if (i) { GetDlgItem( IDC_EDIT_TEXTURES )->SetWindowText( szPath ); strcpy(g_szTextures, szPath); m_fn_vResetSelection(); m_fn_vUpdateForSelectConfig(); g_bChangeComboDir = (g_iCurrentIndexDir != 0); } } //==================================================// // MAIN OPTIONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on Rayman2 option *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnRayman2() { g_bRaymanII = m_oCheckRayman2.GetCheck(); m_oCheckSctMax.EnableWindow(g_bRaymanII); m_oCheckSctEds.EnableWindow(g_bRaymanII); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on ModifLst option *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnModifLst() { g_bModifLst = m_oCheckModifLst.GetCheck(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on EraseMdf option *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnEraseMdf() { g_bEraseMdf = m_oCheckEraseMdf.GetCheck(); } //==================================================// // LIST BOX FUNCTIONS // //==================================================// /**************************************************************************** * Description: Handle function for message LBN_SELCHANGE in Type listbox *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSelchangeListType() { GI_Type *p_oType; char szPath[ MAX_PATH ]; char szName[20]; int iIndex; //reset the contents of the list box with objects m_oListObject->ResetContent(); iIndex = m_oListType->GetCurSel(); if (iIndex != LB_ERR) { m_oListType->GetText(iIndex, szPath); p_oType = (GI_Type *)m_oListType->GetItemData(iIndex); } else p_oType = NULL; // update the list of objects corresponding to the type selected if (m_p_oTypeAnims) m_fn_vUpdateListBox(&m_p_oTypeAnims->m_oList, szPath, "Anims"); if (m_p_oTypeBanks) m_fn_vUpdateListBox(&m_p_oTypeBanks->m_oList, szPath, "Banks"); if (m_p_oTypeClasses) m_fn_vUpdateListBox(&m_p_oTypeClasses->m_oList, szPath, "Classes"); if (m_p_oTypeFamilies) m_fn_vUpdateListBox(&m_p_oTypeFamilies->m_oList, szPath, "Families"); if (m_p_oTypeLevels) m_fn_vUpdateListBox(&m_p_oTypeLevels->m_oList, szPath, "Levels"); if (m_p_oTypeTextures) m_fn_vUpdateListBox(&m_p_oTypeTextures->m_oList, szPath, "Textures"); // enable/disable the selection buttons corresponding with the current selections if(!m_bConversion) { if (p_oType && p_oType->m_iSelected==m_oListObject->GetCount()) m_oSelectList.EnableWindow(FALSE); else m_oSelectList.EnableWindow(TRUE); if (p_oType && p_oType->m_iSelected>0) m_oClearList.EnableWindow(TRUE); else m_oClearList.EnableWindow(FALSE); } iIndex = m_oListType->GetCurSel(); if (iIndex!=LB_ERR) { p_oType = (GI_Type *)m_oListType->GetItemData( iIndex ); strcpy(szName, p_oType -> m_fn_p_oGetName()); } } int gs_iRefIndex = -1; /**************************************************************************** * Description: Handle function for message WM_LBUTTONDOWN in Object listbox *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ BOOL CDlgMain::OnLButtonDownListBoxObject(MSG *pMsg) { CListBox *pLB = m_oListObject; POINT xPos; CRect oRect; BOOL bOutside; int iIndex; BOOL bResult = TRUE; if( !m_bConversion) { // get the x and y coordinates xPos.x = LOWORD(pMsg->lParam); xPos.y = HIWORD(pMsg->lParam); iIndex = pLB -> ItemFromPoint ( xPos, bOutside ) ; if (!(pMsg->wParam & MK_SHIFT)) gs_iRefIndex = iIndex; pLB -> GetItemRect ( iIndex , &oRect ) ; // determine the object under the cursor in front of which the user clicked GI_Item *p_oItem = (GI_Item*) pLB->GetItemData( iIndex ); ASSERT( p_oItem ) ; // and if the user click in front change the activation (validate/invalidate the activation). if ((pMsg->wParam & MK_SHIFT) && (gs_iRefIndex != iIndex) && (gs_iRefIndex != -1)) { GI_Item *p_oRefItem = (GI_Item*) pLB->GetItemData(gs_iRefIndex); int iMidIndex; if (gs_iRefIndex < iIndex) { for (iMidIndex = gs_iRefIndex + 1; iMidIndex <= iIndex; iMidIndex++) { GI_Item *p_oMidItem = (GI_Item*) pLB->GetItemData(iMidIndex); if (p_oMidItem->m_bActived != p_oRefItem->m_bActived) m_fn_bOnChangeActivation(p_oMidItem, iMidIndex); } } else { for (iMidIndex = iIndex; iMidIndex < gs_iRefIndex; iMidIndex++) { GI_Item *p_oMidItem = (GI_Item*) pLB->GetItemData(iMidIndex); if (p_oMidItem->m_bActived != p_oRefItem->m_bActived) m_fn_bOnChangeActivation(p_oMidItem, iMidIndex); } } bResult = TRUE; } else if (m_fn_bOnChangeActivation(p_oItem, iIndex )) bResult = TRUE; else bResult = CDialog::PreTranslateMessage(pMsg); return bResult; } else return bResult; } /**************************************************************************** * Description: Handle function for message WM_DRAWITEM in listbox *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDIS) { // Object listbox if ((nIDCtl == IDC_LISTBOX_OBJECTS) && (m_oListObject->IsWindowEnabled()) && (lpDIS->itemID != LB_ERR)) m_fn_vOnDrawItemListBoxObject ( lpDIS ) ; // Type listbox else if ((nIDCtl == IDC_LISTBOX_TYPES) && (m_oListType->IsWindowEnabled()) && (lpDIS->itemID != LB_ERR)) m_fn_vOnDrawItemListBoxType ( lpDIS ) ; // default handling else CDialog::OnDrawItem(nIDCtl, lpDIS); } /**************************************************************************** * Description: Handle function for message WM_MEASUREITEM in listbox *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) { CDialog::OnMeasureItem(nIDCtl, lpMeasureItemStruct); } //==================================================// // SELECTION BUTTONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Select All" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSelectAll() { // select all the objects in all the lists associated with the types m_fn_vSelectAll(TRUE); m_oListType->Invalidate(TRUE); // enable (Clear, Clear All, Convert) / disable (All, AllInList) m_fn_vEnableButtons(TRUE); g_bChangeComboSelect = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Select List" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSelectList() { //change all the objects in active and enable/disable the buttons for selection m_fn_vSelectAllForType(TRUE); m_fn_vEnableButtonAll(); m_oSelectList.EnableWindow(FALSE); m_oClearList.EnableWindow(TRUE); m_oClearAll.EnableWindow(TRUE); m_oConvert.EnableWindow(TRUE); if (!m_bConversion && m_iCountOfSelections) m_oCheckGenerateRLI.EnableWindow(TRUE); else m_oCheckGenerateRLI.EnableWindow(FALSE); if (m_p_oTypeFamilies && m_p_oTypeFamilies->m_iSelected) { m_oCheckCopyAnims.EnableWindow(TRUE); m_oCheckAskFamily.EnableWindow(TRUE); if (!g_iData && !g_bAskFamily) m_oCheckCommon.EnableWindow(TRUE); if (g_iData && !g_bAskFamily) m_oCheckSpecific.EnableWindow(TRUE); } if ((m_p_oTypeBanks && m_p_oTypeBanks->m_iSelected) || (m_p_oTypeClasses && m_p_oTypeClasses->m_iSelected) || (m_p_oTypeLevels && m_p_oTypeLevels->m_iSelected)) m_oCheckCopyTextures.EnableWindow(TRUE); if (m_p_oTypeLevels && m_p_oTypeLevels->m_iSelected) { m_oCheckSpoMax.EnableWindow(TRUE); m_oCheckSpoEds.EnableWindow(TRUE); m_oCheckUpdateGameDsc.EnableWindow(TRUE); m_oCheckEraseDup.EnableWindow(TRUE); m_oCheckEraseUnused.EnableWindow(TRUE); if (g_bRaymanII) { m_oCheckSctMax.EnableWindow(TRUE); m_oCheckSctEds.EnableWindow(TRUE); } } if ((m_p_oTypeLevels && m_p_oTypeLevels->m_iSelected) || (m_p_oTypeBanks && m_p_oTypeBanks->m_iSelected) || (m_p_oTypeClasses && m_p_oTypeClasses->m_iSelected)) { m_oCheckGmtMax.EnableWindow(TRUE); m_oCheckGmtEds.EnableWindow(TRUE); m_oCheckVmtMax.EnableWindow(TRUE); m_oCheckVmtEds.EnableWindow(TRUE); } if ((m_p_oTypeLevels && m_p_oTypeLevels->m_iSelected) || (m_p_oTypeFamilies && m_p_oTypeFamilies->m_iSelected) || (m_p_oTypeClasses && m_p_oTypeClasses->m_iSelected)) { m_oCheckZooMax.EnableWindow(TRUE); m_oCheckZooEds.EnableWindow(TRUE); } if (m_p_oTypeBanks && m_p_oTypeBanks->m_iSelected) m_oCheckCreateFamily.EnableWindow(TRUE); g_bChangeComboSelect = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Clear List" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnClearList() { //change all the objects in the current list to inactive and enable/disable the buttons m_fn_vSelectAllForType(FALSE); m_fn_vEnableButtonConvert(); m_fn_vEnableButtonAll(); m_oClearList.EnableWindow(FALSE); m_oSelectList.EnableWindow(TRUE); g_bChangeComboSelect = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Clear All" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnClearAll() { // change the state of all the objects to inactive and enable/disable selections buttons m_fn_vSelectAll(FALSE); m_oListType->Invalidate(TRUE); m_fn_vEnableButtons(FALSE); g_bChangeComboSelect = TRUE; } //==================================================// // FILE LIST BUTTONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on Create button for SelectConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCreateConfigSelect() { if (g_bChangeComboSelect && g_iCurrentIndexSelect) { int iResult = AfxMessageBox( "The current configuration was changed : if you do not save it before creating a new one, the changes will be lost!\n Do you want to save the current configuration ?", MB_YESNOCANCEL | MB_ICONEXCLAMATION ); switch (iResult) { case IDYES: OnSaveConfigSelect(); break; case IDNO: g_bChangeComboSelect = FALSE; break; case IDCANCEL: m_oComboChooseSelect.SetCurSel(g_iCurrentIndexSelect); return; } } m_oButtonCreateSelect.ShowWindow(FALSE); m_oEditCreateSelect.ShowWindow(TRUE); m_oEditCreateSelect.SetFocus(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Register button for SelectConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnRegisterConfigSelect() { m_oButtonRegisterSelect.ShowWindow(FALSE); m_oEditRegisterSelect.ShowWindow(TRUE); m_oEditRegisterSelect.SetFocus(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Save button for SelectConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSaveConfigSelect() { int i = m_oComboChooseSelect.GetCurSel(); xString szDir1; if (i!=-1) { //save the directories for the new config GetCurrentDirectory( MAX_PATH, szDir1 ); SetCurrentDirectory( g_szInitialDirectory ); GetCurrentDirectory( MAX_PATH, g_szIniConfSelectFile ); if (g_szIniConfSelectFile[strlen(g_szIniConfSelectFile) - 1] != '\\') strcat( g_szIniConfSelectFile, "\\"); strcat( g_szIniConfSelectFile, C_szIniConfSelectFile ); g_bChangeComboSelect = FALSE; SetCurrentDirectory( szDir1 ); m_fn_vRegisterSelections(i) ; xString szPath; strcpy(szPath, ""); for (int i=1; iShowWindow( TRUE); m_oProgress.SetRange( 0, 0 ); m_oProgress.SetPos( 0 ); GetDlgItem( IDC_STATIC_PROGRESS)->ShowWindow( TRUE); RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW ); AfxBeginThread( ms_fn_vConvertData, this, THREAD_PRIORITY_LOWEST); } //==================================================// // IGNORE OPTIONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Zoo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckZooMax() { g_bIgnoreZoo = m_oCheckZooMax.GetCheck(); m_oCheckZooMax.SetCheck(g_bIgnoreZoo); m_oCheckZooEds.SetCheck(!g_bIgnoreZoo); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Zoo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckZooEds() { g_bIgnoreZoo = !m_oCheckZooEds.GetCheck(); m_oCheckZooEds.SetCheck(!g_bIgnoreZoo); m_oCheckZooMax.SetCheck(g_bIgnoreZoo); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Sct" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckSctMax() { g_bIgnoreSct = m_oCheckSctMax.GetCheck(); m_oCheckSctMax.SetCheck(g_bIgnoreSct); m_oCheckSctEds.SetCheck(!g_bIgnoreSct); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Sct" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckSctEds() { g_bIgnoreSct = !m_oCheckSctEds.GetCheck(); m_oCheckSctEds.SetCheck(!g_bIgnoreSct); m_oCheckSctMax.SetCheck(g_bIgnoreSct); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Spo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckSpoMax() { g_bIgnoreSpo = m_oCheckSpoMax.GetCheck(); m_oCheckSpoMax.SetCheck(g_bIgnoreSpo); m_oCheckSpoEds.SetCheck(!g_bIgnoreSpo); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Spo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckSpoEds() { g_bIgnoreSpo = !m_oCheckSpoEds.GetCheck(); m_oCheckSpoEds.SetCheck(!g_bIgnoreSpo); m_oCheckSpoMax.SetCheck(g_bIgnoreSpo); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Spo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckGmtMax() { g_bIgnoreGmt = m_oCheckGmtMax.GetCheck(); m_oCheckGmtMax.SetCheck(g_bIgnoreGmt); m_oCheckGmtEds.SetCheck(!g_bIgnoreGmt); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Spo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckGmtEds() { g_bIgnoreGmt = !m_oCheckGmtEds.GetCheck(); m_oCheckGmtEds.SetCheck(!g_bIgnoreGmt); m_oCheckGmtMax.SetCheck(g_bIgnoreGmt); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Spo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckVmtMax() { g_bIgnoreTex = m_oCheckVmtMax.GetCheck(); m_oCheckVmtMax.SetCheck(g_bIgnoreTex); m_oCheckVmtEds.SetCheck(!g_bIgnoreTex); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ignore Spo" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCheckVmtEds() { g_bIgnoreTex = !m_oCheckVmtEds.GetCheck(); m_oCheckVmtEds.SetCheck(!g_bIgnoreTex); m_oCheckVmtMax.SetCheck(g_bIgnoreTex); g_bChangeComboOption = TRUE; } //==================================================// // CONVERSION OPTIONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Copy Anims" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCopyAnims() { g_bCopyAnims = m_oCheckCopyAnims.GetCheck(); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Copy Textures" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCopyTextures() { g_bCopyTextures = m_oCheckCopyTextures.GetCheck(); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Generate RLI" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnGenerateRLI() { g_bGenerateRLI = m_oCheckGenerateRLI.GetCheck(); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Update Game.DSC" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnUpdateGameDSC() { g_bUpdateGameDSC = m_oCheckUpdateGameDsc.GetCheck(); g_bChangeComboOption = TRUE; } //==================================================// // ERASE OPTIONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Erase Duplicated Points" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnEraseDuplicated() { g_bEraseDuplicated = m_oCheckEraseDup.GetCheck(); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Erase Unused Points" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnEraseUnused() { g_bEraseUnused = m_oCheckEraseUnused.GetCheck(); g_bChangeComboOption = TRUE; } //==================================================// // FAMILY OPTIONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Force Common" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnForceCommon() { g_bCommonFamily = m_oCheckCommon.GetCheck(); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Force Specific" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnForceSpecific() { g_bSpecificFamily = m_oCheckSpecific.GetCheck(); g_bChangeComboOption = TRUE; } /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Ask for Family" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnAskFamily() { g_bAskFamily = m_oCheckAskFamily.GetCheck(); m_oCheckCommon.EnableWindow(!g_bAskFamily); m_oCheckSpecific.EnableWindow(!g_bAskFamily); g_bChangeComboOption = TRUE; } //==================================================// // BANK OPTIONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on "Create Basic Family" button *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCreateBasicFamily() { g_bCreateBasicFamily = m_oCheckCreateFamily.GetCheck(); g_bChangeComboOption = TRUE; } //==================================================// // OPTION CONFIGURATIONS // //==================================================// /**************************************************************************** * Description: Handle function for message BN_CLICKED on Create button for OptionConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnCreateConfigOption() { if (g_bChangeComboOption && g_iCurrentIndexOption) { int iResult = AfxMessageBox( "The current configuration was changed : if you do not save it before creating a new one, the changes will be lost!\n Do you want to save the current configuration ?", MB_YESNOCANCEL | MB_ICONEXCLAMATION ); switch (iResult) { case IDYES: OnSaveConfigOption(); break; case IDNO: g_bChangeComboOption = FALSE; break; case IDCANCEL: m_oComboChooseOption.SetCurSel(g_iCurrentIndexOption); return; } } m_oButtonCreateOption.ShowWindow(FALSE); m_oEditCreateOption.ShowWindow(TRUE); m_oEditCreateOption.SetFocus(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Register button for OptionConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnRegisterConfigOption() { m_oButtonRegisterOption.ShowWindow(FALSE); m_oEditRegisterOption.ShowWindow(TRUE); m_oEditRegisterOption.SetFocus(); } /**************************************************************************** * Description: Handle function for message BN_CLICKED on Save button for OptionConfig *--------------------------------------------------------------------------- * Revision date: Author: *****************************************************************************/ void CDlgMain::OnSaveConfigOption() { int i = m_oComboChooseOption.GetCurSel(); xString szDir1; if (i!=-1) { //save the directories for the new config GetCurrentDirectory( MAX_PATH, szDir1 ); SetCurrentDirectory( g_szInitialDirectory ); GetCurrentDirectory( MAX_PATH, g_szIniConfOptionFile ); if (g_szIniConfOptionFile[strlen(g_szIniConfOptionFile) - 1] != '\\') strcat( g_szIniConfOptionFile, "\\"); strcat( g_szIniConfOptionFile, C_szIniConfOptionFile ); g_bChangeComboOption = FALSE; SetCurrentDirectory( szDir1 ); m_fn_vRegisterAllOptions(i) ; xString szPath; strcpy(szPath, ""); for (int i=1; i