[Amis-vcs] SF.net SVN: amis: [2355] branches/amis3
Brought to you by:
julienq,
marisademeglio
From: <dan...@us...> - 2008-02-29 17:51:18
|
Revision: 2355 http://amis.svn.sourceforge.net/amis/?rev=2355&view=rev Author: daniel_weck Date: 2008-02-29 09:51:15 -0800 (Fri, 29 Feb 2008) Log Message: ----------- - fixed CoInit() and cross-checked thread activation with lib-ambulant. I still manage to generate audio prompts overlap when navigating the menus...working on it. Modified Paths: -------------- branches/amis3/AmisAudio/include/AmisAudio.h branches/amis3/AmisAudio/include/directshow/dx_audio_player.h branches/amis3/AmisAudio/src/AmisAudio.cpp branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp branches/amis3/bin/copyLangpack.bat Modified: branches/amis3/AmisAudio/include/AmisAudio.h =================================================================== --- branches/amis3/AmisAudio/include/AmisAudio.h 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisAudio/include/AmisAudio.h 2008-02-29 17:51:15 UTC (rev 2355) @@ -83,9 +83,13 @@ sendMessageCallbackFn sendMessageCallback; void setCallback(sendMessageCallbackFn pFunction); + void PlayerEndCallback(); + ambulantX::gui::dx::audio_playerX *m_playerToKill; + private: static AmisAudio* pinstance; ambulantX::gui::dx::audio_playerX *m_player; + }; } } Modified: branches/amis3/AmisAudio/include/directshow/dx_audio_player.h =================================================================== --- branches/amis3/AmisAudio/include/directshow/dx_audio_player.h 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisAudio/include/directshow/dx_audio_player.h 2008-02-29 17:51:15 UTC (rev 2355) @@ -165,6 +165,8 @@ private: + void end_thread(); + bool open(const char * url); void release_player(); Modified: branches/amis3/AmisAudio/src/AmisAudio.cpp =================================================================== --- branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -47,6 +47,10 @@ } #endif +static void audioFinishedCallback() +{ + AmisAudio::Instance()->PlayerEndCallback(); +} namespace amis { @@ -78,9 +82,26 @@ */ void AmisAudio::play(const char * url,char* clipBegin,char* clipEnd) { + if (m_playerToKill != NULL) { + delete m_playerToKill; + + } + m_playerToKill=0; + if (m_player) { + delete m_player; // stop() and release_player() handled by destructor + } m_player = 0; + m_player = new ambulantX::gui::dx::audio_playerX(url); + if (! m_player->can_play()) { + + delete m_player; // stop() and release_player() handled by destructor + + m_player = 0; + return; + } + SmilTimeCode startStop(clipBegin, clipBegin, clipEnd); int begin=startStop.getStart(); int end=startStop.getEnd(); @@ -102,7 +123,7 @@ else m_player->endseek(end); - m_player->setCallback(sendMessageCallback); + m_player->setCallback((sendMessageCallbackFn)audioFinishedCallback); m_player->start(begin); } @@ -122,18 +143,47 @@ AmisAudio::AmisAudio() { m_player = 0; + m_playerToKill = 0; } +static DWORD WINAPI killPlayer(LPVOID lpParam) { + + AmisAudio *audio = (AmisAudio*)lpParam; + if (audio->m_playerToKill != NULL) { + delete audio->m_playerToKill; + audio->m_playerToKill=0; + } + return 0; +} + void AmisAudio::PlayerEndCallback() + { + if (m_player) { + //delete m_player; // stop() and release_player() handled by destructor + m_playerToKill = m_player; + + } + m_player = 0; + if (sendMessageCallback!=NULL) sendMessageCallback(); + + unsigned long lpdwThreadID; + HANDLE hEventHandler = CreateThread(NULL, 0, killPlayer, this, 0, &lpdwThreadID); + } + void AmisAudio::setCallback(sendMessageCallbackFn pFunction) { sendMessageCallback = pFunction; if (m_player) { - m_player->setCallback(pFunction); + m_player->setCallback((sendMessageCallbackFn)audioFinishedCallback); } } AmisAudio::~AmisAudio() { + if (m_playerToKill != NULL && m_player!= m_playerToKill) { + delete m_playerToKill; + + } + m_playerToKill=0; if (m_player) { delete m_player; // stop() and release_player() handled by destructor } @@ -170,7 +220,7 @@ void AmisAudio::stopX() { if (m_player) { - m_player->stop(); + delete m_player; // stop() and release_player() handled by destructor } m_player = 0; } Modified: branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp =================================================================== --- branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -80,7 +80,7 @@ } } } - CoUninitialize(); + return 0; } @@ -114,10 +114,27 @@ void gui::dx::audio_playerX::stop() { if(m_media_control == 0) return; + + end_thread(); + + bProcessEvents = false; HRESULT hr = m_media_control->Stop(); if(FAILED(hr)) { win_report_error("IMediaControl::stop()", hr); } + + if (m_media_control->StopWhenReady() != S_OK) { + long state, i; + + for (i = 0; i < 100; i++) { + m_media_control->GetState(10, &state); + if (state == State_Stopped) break; + } + + if (i == 100) { + bProcessEvents = true; + } + } release_player(); } @@ -178,8 +195,16 @@ } bool gui::dx::audio_playerX::is_playing() { + + if(m_media_control == 0) return false; + + long msTimeout = 0; + long state; + m_media_control->GetState(msTimeout, &state); + return (state == State_Running); + if(m_media_event == 0) return false; - long msTimeout = 0; + long evCode = 0; HRESULT hr = m_media_event->WaitForCompletion(msTimeout, &evCode); if(hr == E_ABORT) return true; @@ -215,18 +240,11 @@ //m_url = url; m_url.assign(url); - HRESULT hrr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + _ASSERT(hr == S_FALSE); - if (hrr) { - int a= 3; - //lib::logger::get_logger()->trace("win32_event_processor::run: CoInitializeEx failed with 0x%x", hr); - } - //CoInitialize(NULL); - //CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - //CoInitializeEx(NULL, COINIT_MULTITHREADED); - - - HRESULT hr = CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER, + hr = CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER, IID_IGraphBuilder,(void**)&m_graph_builder); if(FAILED(hr)) { win_report_error("CoCreateInstance(CLSID_FilterGraph, ...)", hr); @@ -244,6 +262,8 @@ hr = m_graph_builder->RenderFile(str, 0); if(FAILED(hr)){ + m_graph_builder->Release(); + m_graph_builder = 0; /* if (hr == 0x800c000d) // XXX This value experimentally determined:-) errorX("%s: Unsupported URL protocol", url.c_str()); @@ -289,9 +309,12 @@ return true; } -void gui::dx::audio_playerX::release_player() { - if(m_graph_builder) { +void gui::dx::audio_playerX::end_thread() { + + + if (hEventHandler==NULL) return; + bCatchEvents = true; bProcessEvents = true; @@ -302,8 +325,16 @@ pIMES = NULL; if (WaitForSingleObject(hEventHandler, INFINITE) != WAIT_OBJECT_0) { - //return false; + int a = 3; } + hEventHandler = NULL; +} + +void gui::dx::audio_playerX::release_player() { + if(m_graph_builder) { + + end_thread(); + if(m_media_event) { m_media_event->Release(); m_media_event = 0; @@ -330,7 +361,6 @@ m_graph_builder = 0; } - CoUninitialize(); } #ifdef WITH_TPB_AUDIO_SPEEDUP @@ -342,6 +372,13 @@ // Either the filter exists or we haven't tried yet. Let's try to create // it and remember whether it worked. IBaseFilter *pNewFilter = NULL; + + + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + _ASSERT(hr == S_FALSE); + + HRESULT res; res = CoCreateInstance(CLSID_TPBVupp69, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pNewFilter); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -117,6 +117,10 @@ BOOL CAmisApp::InitInstance() { + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + assert(hr == S_OK); + //this says "use the registry instead of ini files" (for windows-specific app preferences). we use it for UAKs SetRegistryKey(_T("Amis")); @@ -129,10 +133,13 @@ mbBookIsOpen = false; mAppPath = ""; + //first read the preferences initializePathsAndFiles(); + //then start logging! this is in case we decide to turn logging on/off via the preferences amis::util::Log::Instance()->startLog(this->getAppPath() + "amisLog.txt"); + Preferences::Instance()->logAllPreferences(); initializeSelfVoicing(); AfxEnableControlContainer(); @@ -179,8 +186,7 @@ //the command line because mfc processes dynamic view creation somewhere in here. if (!ProcessShellCommand(cmdInfo)) { - amis::util::Log::Instance()->writeError("Error processing shell command info", "CAmisApp::InitInstance", - "AmisGuiMFC2"); + amis::util::Log::Instance()->writeError("Error processing shell command info", "CAmisApp::InitInstance", "AmisGuiMFC2"); return FALSE; } @@ -217,16 +223,18 @@ amis::gui::MenuManip::Instance()->DestroyInstance(); amis::gui::MainWndParts::Instance()->DestroyInstance(); + + if (AudioSequencePlayer::InstanceExists())AudioSequencePlayer::Instance()->DestroyInstance(); + + DataTree::Instance()->DestroyInstance(); - if (AudioSequencePlayer::InstanceExists()) - { - AudioSequencePlayer::Instance()->DestroyInstance(); - } - if (mpRecentBooks) delete mpRecentBooks; amis::util::Log::Instance()->endLog(); + + CoUninitialize(); + return CWinApp::ExitInstance(); } @@ -272,8 +280,10 @@ //a lang module file points to the moduleDescData.xml in the top-level directory of every langpack const ambulant::net::url* lang_module_file = amis::Preferences::Instance()->getCurrentLanguageData()->getXmlFileName(); + ambulant::net::url lang_xml_file = ambulant::net::url::from_filename("amisAccessibleUi.xml"); lang_xml_file = lang_xml_file.join_to_base(*lang_module_file); + new_data_reader.setAppPath(mAppPath); amis::ErrorCode did_it_work = new_data_reader.readFile(lang_xml_file.get_file(), p_new_data_tree); @@ -282,16 +292,11 @@ //test print to an output file //p_new_data_tree->testPrint("c:\\devel\\amis\\Langpacks\\sandbox\\dataout.txt"); - //DanToDo: This makes sure a clip is played first before any TTS. For some strange CoInitialize order between SAPI-TTS and Vupp, we must play an audio clip first, not a TTS...unless we open a book, in which case the CoInitialize of the IE-HTML view makes things work again !! :-| - //AudioSequencePlayer::playPromptFromStringId("canceled"); - - /* AudioSequence* seq = new AudioSequence; - seq->append(L"AMIS"); - seq->append(L"Text-to-speech engine is ready.Text-to-speech engine is ready.Text-to-speech engine is ready."); - seq->append(L"Is it good ?"); + seq->append(L"AMIS"); + seq = AudioSequencePlayer::playPromptFromStringId("canceled", false, seq); AudioSequencePlayer::Instance()->Play(seq); - */ + } //if the UI file could not be read, then disable self-voicing //todo: a more robust solution should go here: Modified: branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -362,8 +362,9 @@ HRESULT res; // Check that we are indeed in threading mode #ifdef _DEBUG - assert(CoInitialize(NULL) == S_FALSE); - //CoUninitialize(); + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + assert(hr == S_FALSE); #endif // First we need to get a pointer to the DOM IDispatch *pDisp = GetHtmlDocument(); @@ -385,8 +386,9 @@ HRESULT res; // Check that we are indeed in threading mode #ifdef _DEBUG - assert(CoInitialize(NULL) == S_FALSE); - //CoUninitialize(); + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + assert(hr == S_FALSE); #endif // First we need to get a pointer to the DOM IDispatch *pDisp = GetHtmlDocument(); @@ -614,7 +616,8 @@ HRESULT res; // Check that we are indeed in threading mode #ifdef _DEBUG - HRESULT hr = CoInitialize(NULL); + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); assert(hr == S_FALSE); #endif if (stylesheet == NULL) return NULL; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -27,10 +27,12 @@ AudioSequencePlayer* AudioSequencePlayer::pinstance = 0; +#define CCS_ACTIVE void AudioSequencePlayer::TTSAudioEndNotify() { - TRACE(L"####### END TTS"); + m_wakeUpOriginator = 2; // TTS END + TRACE(L"\n ---- m_hEventWakeup TTS end\n"); SetEvent(m_hEventWakeup); /* if (m_wakeUpAction != 0) { @@ -45,8 +47,9 @@ void AudioSequencePlayer::ClipAudioEndNotify() { - TRACE(L"####### END AUDIO"); + m_wakeUpOriginator = 3; // AUDIO CLIP END + TRACE(L"\n ---- m_hEventWakeup AUDIO end\n"); SetEvent(m_hEventWakeup); /* if (m_wakeUpAction != 0) { @@ -62,7 +65,7 @@ //The message callback function ... signals end of the tts static void ttsFinishedCallback() { - AudioSequencePlayer::Instance()->ClipAudioEndNotify(); + AudioSequencePlayer::Instance()->TTSAudioEndNotify(); } //The message callback function ... signals end of the clip static void clipFinishedCallback() @@ -140,12 +143,18 @@ _ASSERT(!m_bAbort); { - CCS ccs(&m_csSequence); +#ifdef CCS_ACTIVE + CCS* ccs = new CCS(&m_csSequence); +#endif m_bAbort = TRUE; if (m_previousAudioSequence) delete m_previousAudioSequence; if (m_currentAudioSequence) delete m_currentAudioSequence; if (m_nextAudioSequence) delete m_nextAudioSequence; + +#ifdef CCS_ACTIVE + delete ccs; +#endif } m_wakeUpOriginator = 0; // DESTRUCTOR @@ -178,7 +187,9 @@ void AudioSequencePlayer::Stop() { { +#ifdef CCS_ACTIVE CCS* ccs = new CCS(&m_csSequence); +#endif m_wakeUpAction = 0; m_nEndEventsToExpect = 0; @@ -215,14 +226,17 @@ //SetEvent(m_hEventWakeup); } +#ifdef CCS_ACTIVE delete ccs; +#endif } } - void AudioSequencePlayer::Play(AudioSequence* audioSequence, bool doNotRegisterInHistory) { { +#ifdef CCS_ACTIVE CCS* ccs = new CCS(&m_csSequence); +#endif if (!m_bAbort) { @@ -243,10 +257,14 @@ } } { - CCS* ccs = new CCS(&m_csSequence); +#ifdef CCS_ACTIVE2 + CCS* ccs = new CCS(&m_csSequence); +#endif if (m_currentAudioSequence) delete m_currentAudioSequence; m_currentAudioSequence = NULL; +#ifdef CCS_ACTIVE2 delete ccs; +#endif } m_nextAudioSequence = audioSequence; @@ -271,14 +289,16 @@ } if (!bExpectEndEventForWakeUp) { - TRACE(L"####### SET EVENT"); m_wakeUpOriginator = 1; // PLAY ResetEvent(m_hEventEnd); + + TRACE(L"\n ---- m_hEventWakeup PLAY\n"); SetEvent(m_hEventWakeup); } } - +#ifdef CCS_ACTIVE delete ccs; +#endif } } @@ -306,12 +326,15 @@ } void AudioSequencePlayer::playAudioPrompt(amis::AudioNode* pAudio) { - ambulant::net::url audio_src = ambulant::net::url::from_filename(pAudio->getSrc()); + string str = pAudio->getSrc(); + if (str.length()==0) { + return; + } + ambulant::net::url audio_src = ambulant::net::url::from_filename(str); amis::ModuleDescData* p_langpack_data = amis::Preferences::Instance()->getCurrentLanguageData(); audio_src = audio_src.join_to_base(*p_langpack_data->getXmlFileName()); - string clipBegin = ""; string clipEnd = ""; @@ -348,6 +371,10 @@ AudioSequenceComponent* comp = NULL; BOOL bEmptyQueue; + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + _ASSERT(hr == S_OK); + while (! pThis->m_bAbort) { WaitForSingleObject(pThis->m_hEventWakeup, INFINITE); @@ -426,10 +453,11 @@ bEmptyQueue = FALSE; { +#ifdef CCS_ACTIVE + CCS* ccs = new CCS(&pThis->m_csSequence); +#endif - CCS* ccs = new CCS(&pThis->m_csSequence); - if (pThis->m_currentAudioSequence != NULL && pThis->m_currentAudioSequence->GetCount() > 0) { comp = pThis->m_currentAudioSequence->RemoveTail(); @@ -457,7 +485,9 @@ { bEmptyQueue = TRUE; } - delete ccs; +#ifdef CCS_ACTIVE + delete ccs; +#endif } if (!pThis->m_bAbort && !bEmptyQueue) @@ -474,8 +504,12 @@ }*/ ResetEvent(pThis->m_hEventWakeup); - TRACE(L"============ PLAY AUDIO CLIP"); + TRACE(L"\n============ PLAY AUDIO CLIP\n"); if (!pThis->m_bAbort) { + /* while (AmisAudio::Instance()->isPlaying()) { + TRACE(L"\nIS PLAYING..."); + Sleep(500); + } */ pThis->playAudioPrompt(comp->m_AudioClip); } delete comp; @@ -527,7 +561,7 @@ } } // while ... - + CoUninitialize(); return 0; } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -176,10 +176,9 @@ //m_iV(NULL) m_iV = NULL; - HRESULT hr; - - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - //CoInitializeEx(NULL, COINIT_MULTITHREADED); + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + assert(hr == S_FALSE); hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_INPROC_SERVER, IID_ISpVoice, (void**) &m_iV); @@ -210,8 +209,6 @@ { if (m_iV != NULL) m_iV->Release(); - - CoUninitialize(); } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -39,6 +39,7 @@ PromptItem* p_prompt_item = NULL; sz = mContainersList.size(); + for (i=sz -1; i>=0; i--) { p_container = mContainersList[i]; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-02-29 17:51:15 UTC (rev 2355) @@ -113,43 +113,56 @@ //TRACE("OnMenuSelect, hSysMenu=%p is %s\n", hSysMenu, ::IsMenu(hSysMenu) ? "HMENU" : pMenu ? "CMenu" : "unknown"); bool isSysMenu = false; - HWND hWnd = MainWndParts::Instance()->mpMainFrame->GetSafeHwnd(); - HMENU pSysMenu = GetSystemMenu(hWnd, FALSE); + //HWND hWnd = MainWndParts::Instance()->mpMainFrame->GetSafeHwnd(); + CMenu * pSysMenu = mFrm->GetSystemMenu(FALSE); if (pSysMenu != NULL) { - if (pSysMenu == hSysMenu) { + if (pSysMenu->m_hMenu == hSysMenu) { TRACE("System Menu !"); isSysMenu = true; } } if (isSysMenu) { + CString str; + pSysMenu->GetMenuString(nItemID, str, MF_BYCOMMAND); + + str.Replace(L"&", L""); + + //str.Replace(CString("&"), CString("")); + + AudioSequence* seq = new AudioSequence; + seq->append(str); + AudioSequencePlayer::Instance()->Play(seq); + + //CMenu* p_menu = p_menu->GetSubMenu(nItemID); + /* int nLen = ::GetMenuString(pSysMenu, nItemID, NULL, 0, MF_BYCOMMAND); - if (nLen > 0) { - LPTSTR lpszText = (LPTSTR)_alloca((nLen + 1) * sizeof(TCHAR)); - if (::GetMenuString(pSysMenu, nItemID, lpszText, nLen + 1, MF_BYCOMMAND) == nLen) { + LPTSTR lpszText = (LPTSTR)_alloca((nLen + 1) * sizeof(TCHAR)); + if (::GetMenuString(pSysMenu, nItemID, lpszText, nLen + 1, MF_BYCOMMAND) == nLen) { - CString str; + CString str; - //pSysMenu->GetMenuString(nItemID, str, nFlags); - //TRACE(str); - str.Append(lpszText); + //pSysMenu->GetMenuString(nItemID, str, nFlags); + //TRACE(str); + str.Append(lpszText); - str.Replace(L"&", L""); + str.Replace(L"&", L""); - //str.Replace(CString("&"), CString("")); + //str.Replace(CString("&"), CString("")); - AudioSequence* seq = new AudioSequence; - seq->append(str); - AudioSequencePlayer::Instance()->Play(seq); + AudioSequence* seq = new AudioSequence; + seq->append(str); + AudioSequencePlayer::Instance()->Play(seq); - } + } } + */ return; } @@ -198,7 +211,7 @@ UINT nID = mFrm->m_lastOpenPopupMenu->GetMenuItemID(0); std::string prompt = computeRootMenuFromFirstChildID(nID, false); - s.Format(_T("\n{{{ %d"), nItemID); //DAN_MENU_DEBUG + s.Format(_T("\n\n\n\n{{{ %d\n\n\n\n"), nItemID); //DAN_MENU_DEBUG TRACE(s); TRACE(prompt.c_str()); @@ -232,8 +245,12 @@ } else { int i = 0; // NOP, for breakpoint } - } else if (nItemID >=0 && nItemID <=6) { //TODO: Yuuk ! UGLY ! This is only a temporary workaround ! //m_lastOpenPopupMenu == NULL && + } else if ((nItemID >=0 && nItemID <=6) && (mFrm->m_lastOpenPopupMenu == NULL)) { //TODO: Yuuk ! UGLY ! This is only a temporary workaround ! //(nFlags & MF_GRAYED) + s.Format(_T("\n\n\n\n{{{ %d\n\n\n\n"), nItemID); //DAN_MENU_DEBUG + TRACE(s); + + switch (nItemID) { case 0: seq = AudioSequencePlayer::playContainerPromptFromId("file", false, seq); Modified: branches/amis3/bin/copyLangpack.bat =================================================================== --- branches/amis3/bin/copyLangpack.bat 2008-02-29 06:09:44 UTC (rev 2354) +++ branches/amis3/bin/copyLangpack.bat 2008-02-29 17:51:15 UTC (rev 2355) @@ -37,3 +37,5 @@ :end :: + +pause This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |