void CGUIWindowFullScreen::FreeResources(bool forceUnload) { g_settings.Save(); DynamicResourceAlloc(true); UnloadDialog(WINDOW_OSD); UnloadDialog(WINDOW_DIALOG_VIDEO_OSD_SETTINGS); UnloadDialog(WINDOW_DIALOG_AUDIO_OSD_SETTINGS); // No need to unload these here, as they're preloaded by our app // UnloadDialog(WINDOW_DIALOG_SEEK_BAR); // UnloadDialog(WINDOW_DIALOG_VOLUME_BAR); // UnloadDialog(WINDOW_DIALOG_MUTE_BUG); CGUIWindow::FreeResources(forceUnload); }
void pfGameGUIMgr::UnloadDialog( const char *name ) { int i; for( i = 0; i < fDialogs.GetCount(); i++ ) { if( stricmp( fDialogs[ i ]->GetName(), name ) == 0 ) { UnloadDialog( fDialogs[ i ] ); break; } } }
pfGameGUIMgr::~pfGameGUIMgr() { int i; // the GUIMgr is dead! fInstance = nil; for( i = 0; i < fDialogs.GetCount(); i++ ) UnloadDialog( fDialogs[ i ] ); for( i = 0; i < fDialogToSetKeyOf.GetCount(); i++ ) delete fDialogToSetKeyOf[i]; if( fActivated ) IActivateGUI( false ); delete fInputConfig; }
void CGenPropertyPage::OnAddItem(CDialog & dlg) { // load dialog with default values InitDialog (&dlg); // display dialog, exit if cancelled if (dlg.DoModal () != IDOK) return; // create the object's lookup name (label converted to lower case, or generated) CObject * pItem; CString strObjectName; strObjectName = GetObjectName (&dlg); if (strObjectName.IsEmpty ()) strObjectName.Format ("*%s%s", // e.g. *trigger100 (LPCTSTR) m_strObjectType, (LPCTSTR) App.GetUniqueString ()); else strObjectName.MakeLower(); // if already there (presumably not possible with un-named objects), // then abort the add if (m_ObjectMap->Lookup (strObjectName, pItem)) { CString strMsg; strMsg = TFormat ("The %s named \"%s\" is already in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) GetObjectName (&dlg), (LPCTSTR) m_strObjectType); ::UMessageBox (strMsg); return; } // add new object to map m_ObjectMap->SetAt (strObjectName, pItem = MakeNewObject ()); // unload from dialog into object's properties UnloadDialog (&dlg, pItem); // They can no longer cancel the property sheet, the document has changed CancelToClose (); if (!CheckIfTemporary (pItem)) m_doc->SetModifiedFlag (TRUE); // create a CString for lookup purposes CString * pstrObjectName = new CString (strObjectName); // add this item to the list view add_item (pItem, pstrObjectName, 0, TRUE); SetInternalName (pItem, strObjectName); // set name so we can delete one-shot items // resort the list t_gen_sort_param sort_param (m_ObjectMap, m_last_col, m_reverse, m_CompareObjects); m_ctlList->SortItems (CompareFunc, (LPARAM) &sort_param); // redraw the list if (GetFilterFlag ()) LoadList (); // full reload because it may have changed filter requirements // get dispatch id from the script and put it into the item if (m_doc->m_ScriptEngine) { CString strMessage; SetDispatchID (pItem, m_doc->GetProcedureDispid (GetScriptName (pItem), m_strObjectType, GetLabel (pItem), strMessage)); if (!strMessage.IsEmpty ()) ::UMessageBox (strMessage, MB_ICONINFORMATION); } } // end of CGenPropertyPage::OnAddItem
void CGenPropertyPage::OnChangeItem(CDialog & dlg) { CString strMsg; // iterate through list in case we implement multiple selection one day for (int nItem = -1; (nItem = m_ctlList->GetNextItem(nItem, LVNI_SELECTED)) != -1;) { // get the lower-case name of this item's object CString * pstrObjectName = (CString *) m_ctlList->GetItemData (nItem); ASSERT (pstrObjectName != NULL); CObject * pItem; // check object is still there (it might have gone while we looked at the list box) if (!m_ObjectMap->Lookup (*pstrObjectName, pItem)) { m_ctlList->DeleteItem (nItem); // it's gone, so delete it from the list view m_ctlList->RedrawItems (0, m_ctlList->GetItemCount () - 1); // redraw the list // in the case of one-shot timers, unnamed items might be removed from the list if (pstrObjectName->Left (1) == "*") strMsg = TFormat ("The %s you selected is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) m_strObjectType); else strMsg = TFormat ("The %s named \"%s\" is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName, (LPCTSTR) m_strObjectType); ::UMessageBox (strMsg); delete pstrObjectName; // and get rid of its name string continue; } ASSERT_VALID (pItem); ASSERT( pItem->IsKindOf( RUNTIME_CLASS( CObject ) ) ); // load dialog with values from the found item LoadDialog (&dlg, pItem); // put up the dialog, give up if they cancel if (dlg.DoModal () != IDOK) continue; // lookup this object, to make sure it still exists if (!m_ObjectMap->Lookup (*pstrObjectName, pItem)) { m_ctlList->DeleteItem (nItem); // it's gone, so delete it from the list view m_ctlList->RedrawItems (0, m_ctlList->GetItemCount () - 1); // redraw the list // in the case of one-shot timers, unnamed items might be removed from the list if (pstrObjectName->Left (1) == "*") strMsg = TFormat ("The %s you selected is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) m_strObjectType); else strMsg = TFormat ("The %s named \"%s\" is no longer in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName, (LPCTSTR) m_strObjectType); delete pstrObjectName; // and get rid of its name string ::UMessageBox (strMsg); continue; } ASSERT_VALID (pItem); ASSERT( pItem->IsKindOf( RUNTIME_CLASS( CObject ) ) ); if (CheckIfIncluded (pItem)) { strMsg = TFormat ("The %s named \"%s\" has been included from an include file. You cannot modify it here.", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName); ::UMessageBox (strMsg); return; // can't modify included items } // check object still has the same modification number // (it might have been modified while we looked at the list box) if (GetModificationNumber (pItem) != m_nUpdateNumber) { strMsg = TFormat ("The %s named \"%s\" has already been modified by a script subroutine", (LPCTSTR) m_strObjectType, (LPCTSTR) *pstrObjectName); ::UMessageBox (strMsg); continue; } // check for name change CString strObjectName = GetObjectName (&dlg); if (strObjectName.IsEmpty ()) strObjectName.Format ("*%s%s", (LPCTSTR) m_strObjectType, (LPCTSTR) App.GetUniqueString ()); else strObjectName.MakeLower (); if (strObjectName != *pstrObjectName) // has name changed? { // here if label has changed CObject * new_pItem; if (m_ObjectMap->Lookup (strObjectName, new_pItem)) { strMsg = TFormat ("The %s named \"%s\" already exists in the %s list", (LPCTSTR) m_strObjectType, (LPCTSTR) strObjectName, (LPCTSTR) m_strObjectType); ::UMessageBox (strMsg); continue; } // remove old entry and re-add under new name m_ObjectMap->RemoveKey (*pstrObjectName); // remove old entry m_ObjectMap->SetAt (strObjectName, pItem); // insert under new name // delete old name in the list delete pstrObjectName; // create a new CString for lookup purposes pstrObjectName = new CString (strObjectName); // record item's new name as the list object data m_ctlList->SetItemData(nItem, (DWORD) pstrObjectName); } // end of label changing // see if the user changed anything, anyway if (CheckIfChanged (&dlg, pItem)) { // unload from dialog into object's properties UnloadDialog (&dlg, pItem); // They can no longer cancel the property sheet, the document has changed CancelToClose (); if (!CheckIfTemporary (pItem)) m_doc->SetModifiedFlag (TRUE); // re-setup list with amended details int nNewItem = add_item (pItem, pstrObjectName, nItem, FALSE); m_ctlList->RedrawItems (nNewItem, nNewItem); } // end of item changing // Get dispatch id from the script and put it into the item. // We do this even if nothing has changed, so that we can force re-evaluation // of the dispatch ID, by just getting the item and pressing OK. if (m_doc->m_ScriptEngine) { CString strMessage; SetDispatchID (pItem, m_doc->GetProcedureDispid (GetScriptName (pItem), m_strObjectType, GetLabel (pItem), strMessage)); if (!strMessage.IsEmpty ()) ::UMessageBox (strMessage, MB_ICONINFORMATION); } } // end of dealing with each selected item // redraw the list if (GetFilterFlag ()) LoadList (); // full reload because it may have changed filter requirements // resort the list t_gen_sort_param sort_param (m_ObjectMap, m_last_col, m_reverse, m_CompareObjects); m_ctlList->SortItems (CompareFunc, (LPARAM) &sort_param); } // end of CGenPropertyPage::OnChangeItem