amis-cvs Mailing List for AMIS (Page 4)
Brought to you by:
julienq,
marisademeglio
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(184) |
Sep
(89) |
Oct
(185) |
Nov
(71) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(45) |
Feb
(125) |
Mar
(138) |
Apr
(135) |
May
(72) |
Jun
(68) |
Jul
(23) |
Aug
(14) |
Sep
(39) |
Oct
(131) |
Nov
(43) |
Dec
(5) |
2007 |
Jan
(13) |
Feb
(16) |
Mar
(5) |
Apr
(28) |
May
(44) |
Jun
(63) |
Jul
(109) |
Aug
(19) |
Sep
(48) |
Oct
(35) |
Nov
(16) |
Dec
(27) |
2008 |
Jan
(40) |
Feb
(56) |
Mar
(97) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dan...@us...> - 2008-03-03 03:31:45
|
Revision: 2379 http://amis.svn.sourceforge.net/amis/?rev=2379&view=rev Author: daniel_weck Date: 2008-03-02 19:31:51 -0800 (Sun, 02 Mar 2008) Log Message: ----------- libs cleanup Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-03 03:12:55 UTC (rev 2378) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-03 03:31:51 UTC (rev 2379) @@ -35,11 +35,11 @@ Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" - AdditionalDependencies="AmisCoreD.lib xerces-c_2D.lib libambulant_shwin32_D.lib" + AdditionalDependencies="AmisCoreD.lib xerces-c_2D.lib libambulant_shwin32_D.lib strmiids.lib uuid.lib" OutputFile="$(OutDir)/AMIS.exe" LinkIncremental="2" AdditionalLibraryDirectories="../lib;../../../../ambulant/lib/win32;"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Lib\i386";"$(VSInstallDir)\..\Visual Leak Detector"" - IgnoreDefaultLibraryNames="uafxcwd.lib;uafxcw.lib;LIBCD.lib;LIBC.lib;msvcrt.lib;libcmt.lib" + IgnoreDefaultLibraryNames="uafxcwd.lib" GenerateDebugInformation="TRUE" SubSystem="2" TargetMachine="1"/> @@ -92,13 +92,13 @@ Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" - AdditionalDependencies="xerces-c_2.lib AmisCore.lib libambulant_shwin32.lib Strmiids.lib stlib.lib kernel32.lib gdi32.lib user32.lib" + AdditionalDependencies="xerces-c_2.lib AmisCore.lib libambulant_shwin32.lib strmiids.lib uuid.lib" OutputFile="$(OutDir)/AMIS.exe" LinkIncremental="1" AdditionalLibraryDirectories="../lib;../../../../ambulant/lib/win32;"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Lib\i386"" IgnoreAllDefaultLibraries="FALSE" - IgnoreDefaultLibraryNames="uafxcwd.lib;uafxcw.lib;LIBCD.lib;LIBC.lib;libcmt.lib;msvcrtd.lib;libc.lib" - GenerateDebugInformation="TRUE" + IgnoreDefaultLibraryNames="uafxcw.lib" + GenerateDebugInformation="FALSE" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-03 03:12:49
|
Revision: 2378 http://amis.svn.sourceforge.net/amis/?rev=2378&view=rev Author: daniel_weck Date: 2008-03-02 19:12:55 -0800 (Sun, 02 Mar 2008) Log Message: ----------- - Removed AmisAudio completely (dx_audio_player migrated to MFCGUI::self-voicing) Modified Paths: -------------- branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp branches/amis3/AmisCore/src/Media.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequenceComponent.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequenceComponent.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp branches/amis3/VC7/amis.sln Modified: branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp =================================================================== --- branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -127,7 +127,6 @@ { stop(false); DeleteCriticalSection(&m_csSequence); - int q = 0; } gui::dx::audio_playerX* gui::dx::audio_playerX::pinstance = 0; Modified: branches/amis3/AmisCore/src/Media.cpp =================================================================== --- branches/amis3/AmisCore/src/Media.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisCore/src/Media.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -68,6 +68,9 @@ void amis::MediaNode::setSrc(string src) { mSrc.assign(src); + if (mSrc.length()==0 && mMediaNodeType==AUDIO) { + int i = 0; + } } void amis::MediaNode::setSrcExpanded(string src) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-03 03:12:55 UTC (rev 2378) @@ -80,7 +80,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="include;../AmisAudio/include;../../../../ambulant/include/;"../../../../ambulant-private/pdtbplugin";"../../../../ambulant-private/pdtbplugin/PdtbIePlugin";../AmisCore/include;"../../../../xerces-c-src/src";"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Include"" - PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUGAMIS_COMPILER_MSVC;AMIS_PLATFORM_WINDOWS;" + PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;AMIS_COMPILER_MSVC;AMIS_PLATFORM_WINDOWS;WITH_EXTERNAL_SMIL_PLAYER;" MinimalRebuild="FALSE" RuntimeLibrary="2" TreatWChar_tAsBuiltInType="FALSE" @@ -359,6 +359,38 @@ RelativePath=".\include\gui\self-voicing\dialogs\SkipDialogVoicing.h"> </File> </Filter> + <Filter + Name="directshow" + Filter=""> + <File + RelativePath=".\include\gui\self-voicing\directshow\dx_audio_player.h"> + </File> + </Filter> + <Filter + Name="mffmTimeCode" + Filter=""> + <File + RelativePath=".\include\gui\self-voicing\mffmTimeCode\counter.H"> + </File> + <File + RelativePath=".\include\gui\self-voicing\mffmTimeCode\field.H"> + </File> + <File + RelativePath=".\include\gui\self-voicing\mffmTimeCode\masterCounter.H"> + </File> + <File + RelativePath=".\include\gui\self-voicing\mffmTimeCode\masterCounterArray.H"> + </File> + <File + RelativePath=".\include\gui\self-voicing\mffmTimeCode\SmilTimeCode.H"> + </File> + <File + RelativePath=".\include\gui\self-voicing\mffmTimeCode\timeCode.H"> + </File> + <File + RelativePath=".\include\gui\self-voicing\mffmTimeCode\win32fix.H"> + </File> + </Filter> </Filter> </Filter> <Filter @@ -1080,6 +1112,25 @@ </FileConfiguration> </File> </Filter> + <Filter + Name="directshow" + Filter=""> + <File + RelativePath=".\src\gui\self-voicing\directshow\dx_audio_player.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> + </File> + </Filter> </Filter> </Filter> <Filter Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequenceComponent.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequenceComponent.h 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequenceComponent.h 2008-03-03 03:12:55 UTC (rev 2378) @@ -3,16 +3,11 @@ #pragma once -//#define XUSE_WSTRING - -#ifdef XUSE_WSTRING -#include <string> -#else #ifndef __AFXWIN_H__ #include <afxwin.h> #endif -#endif + #include "Media.h" @@ -33,11 +28,7 @@ BOOL m_isAudioClip; bool mWasCloned; -#ifdef XUSE_WSTRING - std::wstring m_String; -#else CString m_String; -#endif amis::AudioNode* m_AudioClip; }; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-03 03:12:55 UTC (rev 2378) @@ -24,28 +24,6 @@ namespace spoken { -// -------------------------------- -class CCS -{ -private: - LPCRITICAL_SECTION m_lpCS; - -public: - __inline CCS(LPCRITICAL_SECTION lpCS): m_lpCS(NULL) - { - _ASSERT(lpCS != NULL); - - m_lpCS = lpCS; // Save - EnterCriticalSection(lpCS); - } - - __inline ~CCS() - { - if (m_lpCS != NULL) - LeaveCriticalSection(m_lpCS); - } -}; - class AudioSequencePlayer { Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -53,7 +53,7 @@ #include "gui/dialogs/PreferencesDialog.h" #include "gui/dialogs/PublicationSummaryDialog.h" -#include "directshow/dx_audio_player.h" +#include "gui/self-voicing/directshow/dx_audio_player.h" //using namespace amis::audio; @@ -276,11 +276,7 @@ } void CAmisApp::initializeSelfVoicing() -{ - //VLDEnable(); - //amis::Preferences::Instance()->setIsSelfVoicing(false); - //return; - +{ DataReader new_data_reader; DataTree* p_new_data_tree; p_new_data_tree = DataTree::Instance(); @@ -296,8 +292,8 @@ if (did_it_work == amis::OK) { - //TODO: remove this ! This is just for testing AMIS with Self-Voice off - amis::Preferences::Instance()->setIsSelfVoicing(false); + + amis::Preferences::Instance()->setIsSelfVoicing(false); //test print to an output file //p_new_data_tree->testPrint("c:\\devel\\amis\\Langpacks\\sandbox\\dataout.txt"); Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -28,7 +28,7 @@ #include "DtbWithHooks.h" #include "gui/MenuManip.h" -#include "directshow/dx_audio_player.h" +#include "gui/self-voicing/directshow/dx_audio_player.h" #include "io/BookmarksFileIO.h" #include "io/ToolbarIO.h" Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -39,6 +39,10 @@ m_AudioSequence.AddHead(comp); } void AudioSequence::append(amis::AudioNode* audioClip) { + if (audioClip->getSrc().length() == 0) { + int here = 1; + + } AudioSequenceComponent* comp = new AudioSequenceComponent; comp->m_isAudioClip = TRUE; comp->m_AudioClip = audioClip; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequenceComponent.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequenceComponent.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequenceComponent.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -6,11 +6,8 @@ mWasCloned = false; } AudioSequenceComponent::~AudioSequenceComponent(){ -#ifdef XUSE_WSTRING - m_String = ""; -#else + m_String.Empty(); -#endif if (mWasCloned) { delete m_AudioClip; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -8,7 +8,7 @@ #include "util/FilePathTools.h" -#include "directshow/dx_audio_player.h" +#include "gui/self-voicing/directshow/dx_audio_player.h" #include "Preferences.h" @@ -30,9 +30,17 @@ void AudioSequencePlayer::TTSAudioEndNotify() { +#ifdef CCS_ACTIVE + EnterCriticalSection(&m_csSequence); +#endif m_wakeUpOriginator = 2; // TTS END TRACE(L"\n ---- m_hEventWakeup TTS end\n"); SetEvent(m_hEventWakeup); + +#ifdef CCS_ACTIVE + LeaveCriticalSection(&m_csSequence); +#endif + /* if (m_wakeUpAction != 0) { SetEvent(m_hEventWakeup); @@ -47,9 +55,16 @@ void AudioSequencePlayer::ClipAudioEndNotify() { +#ifdef CCS_ACTIVE + EnterCriticalSection(&m_csSequence); +#endif m_wakeUpOriginator = 3; // AUDIO CLIP END TRACE(L"\n ---- m_hEventWakeup AUDIO end\n"); SetEvent(m_hEventWakeup); + +#ifdef CCS_ACTIVE + LeaveCriticalSection(&m_csSequence); +#endif /* if (m_wakeUpAction != 0) { SetEvent(m_hEventWakeup); @@ -87,6 +102,7 @@ m_previousAudioSequence = NULL; m_currentAudioSequence = NULL; m_nextAudioSequence = NULL; + m_hEventWakeup = NULL; m_hEventEnd = NULL; m_hThread = NULL; @@ -154,20 +170,11 @@ _ASSERT(m_hThread != NULL); _ASSERT(!m_bAbort); - { -#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 rc = SetEvent(m_hEventWakeup); @@ -210,17 +217,25 @@ } void AudioSequencePlayer::RepeatLast() { + +#ifdef CCS_ACTIVE + EnterCriticalSection(&m_csSequence); +#endif //AudioSequence* audioSequence = new AudioSequence(); if (m_previousAudioSequence) { Play(m_previousAudioSequence); } + +#ifdef CCS_ACTIVE + LeaveCriticalSection(&m_csSequence); +#endif } void AudioSequencePlayer::Stop() { { #ifdef CCS_ACTIVE - CCS* ccs = new CCS(&m_csSequence); + EnterCriticalSection(&m_csSequence); #endif m_wakeUpAction = 0; @@ -260,12 +275,18 @@ } #ifdef CCS_ACTIVE - delete ccs; + LeaveCriticalSection(&m_csSequence); #endif } } void AudioSequencePlayer::Play(AudioSequence* audioSequence, bool doNotRegisterInHistory) { + { +#ifdef CCS_ACTIVE + EnterCriticalSection(&m_csSequence); +#endif + if (!m_bAbort) + { if (m_hThread == NULL) { unsigned int threadID; @@ -273,13 +294,7 @@ _ASSERT(m_hThread != NULL); } - { -#ifdef CCS_ACTIVE - CCS* ccs = new CCS(&m_csSequence); -#endif - if (!m_bAbort) - { m_wakeUpAction = 0; m_nEndEventsToExpect = 0; @@ -289,23 +304,12 @@ delete m_previousAudioSequence; } } - m_previousAudioSequence = NULL; - if (FALSE && m_currentAudioSequence) { // BAD: can be half empty because of removeTails in the thread. - m_previousAudioSequence = m_currentAudioSequence->clone(); - } else { - m_previousAudioSequence = audioSequence->clone(); - } + m_previousAudioSequence = audioSequence->clone(); } - { -#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; bool bExpectEndEventForWakeUp = false; @@ -337,7 +341,7 @@ } } #ifdef CCS_ACTIVE - delete ccs; + LeaveCriticalSection(&m_csSequence); #endif } } @@ -403,238 +407,8 @@ //(char*)clipBegin.c_str(), (char*)clipEnd.c_str()); } -unsigned __stdcall AudioSequencePlayer::ThreadProc(void* Arg) -{ - USES_CONVERSION; - _ASSERT(Arg != NULL); - ULONG nStream; - AudioSequencePlayer* pThis = (AudioSequencePlayer*) Arg; - - AudioSequenceComponent* comp = NULL; - BOOL bEmptyQueue; - - HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - if (hr == S_FALSE) CoUninitialize(); - _ASSERT(hr == S_OK); - - while (! pThis->m_bAbort) - { - - DWORD hr = WaitForSingleObject(pThis->m_hEventWakeup, INFINITE); - switch (hr) { - case WAIT_FAILED: { - int i = 0; - break; - } - - case WAIT_ABANDONED - : { - int i = 0; - break;} - - case WAIT_OBJECT_0 - : { - int i = 0; - break;} - - case WAIT_TIMEOUT: - { - int i = 0; - break; - } - - } - - /* - if (pThis->m_wakeUpOriginator == 0) { - break; - } else if (pThis->m_wakeUpOriginator == 1) { - - if (AmisBrain::Instance()->isAudioClipPlaying()) { - TRACE(L"### STOP AUDIO CLIP"); - ResetEvent(pThis->m_hEventWakeup); - AmisBrain::Instance()->stopAudioClip(); - continue; - } else - if (TTSPlayer::Instance()->IsSpeaking()) { - TRACE(L"### STOP TTS CLIP"); - ResetEvent(pThis->m_hEventWakeup); - TTSPlayer::Instance()->Stop(); - //TTSPlayer::Instance()->WaitUntilDone(); - continue; - } else { - pThis->m_wakeUpOriginator = -1; - } - - } - */ - - /* - if (pThis->m_wakeUpAction == 0) // INTERRUPT PROCESS BEGIN - { - if (pThis->m_wakeUpOriginator != 1) { - TRACE(L"------------ ZZ_1"); - } - - pThis->m_wakeUpAction = 1; // TTS SHUTDOWN - - if (TTSPlayer::Instance()->IsSpeaking()) { - ResetEvent(pThis->m_hEventWakeup); - TTSPlayer::Instance()->Stop(); - TTSPlayer::Instance()->WaitUntilDone(); - } - - //continue; - } - else if (pThis->m_wakeUpAction == 1) // TTS SHUTDOWN - { - - if (pThis->m_wakeUpOriginator != 2) { - TRACE(L"------------ ZZ_2"); - } - - pThis->m_wakeUpAction = 2; // AUDIO CLIP SHUTDOWN - - if (AmisBrain::Instance()->isAudioClipPlaying()) { - ResetEvent(pThis->m_hEventWakeup); - AmisBrain::Instance()->stopAudioClip(); - } - - //continue; - } - else if (pThis->m_wakeUpAction == 2) // AUDIO CLIP SHUTDOWN - { - - if (pThis->m_wakeUpOriginator != 3) { - TRACE(L"------------ ZZ_3"); - } - pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. - }*/ - - - if (pThis->m_wakeUpOriginator == 3) { - //Sleep(500); - //TRACE(L"AUDIERE SLEEP-"); - } - - - bEmptyQueue = FALSE; - { -#ifdef CCS_ACTIVE - CCS* ccs = new CCS(&pThis->m_csSequence); -#endif - - - if (pThis->m_currentAudioSequence != NULL && pThis->m_currentAudioSequence->GetCount() > 0) - { - comp = pThis->m_currentAudioSequence->RemoveTail(); - - /*if (comp!=NULL) - { - - if (comp->m_isAudioClip) { - if (AmisBrain::Instance()->isAudioClipPlaying()) { - pThis->m_currentAudioSequence->AddTail(comp); - } - } else { - if (TTSPlayer::Instance()->IsSpeaking()) { - pThis->m_currentAudioSequence->AddTail(comp); - } - } - }*/ - - if (pThis->m_currentAudioSequence->GetCount() == 0) { - delete pThis->m_currentAudioSequence; - pThis->m_currentAudioSequence = NULL; - } - } - else - { - bEmptyQueue = TRUE; - } -#ifdef CCS_ACTIVE - delete ccs; -#endif - } - - if (!pThis->m_bAbort && !bEmptyQueue) - { - if (!pThis->m_bAbort && comp!=NULL) - { - - if (!pThis->m_bAbort && comp->m_isAudioClip) { - pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. - /*if (TTSPlayer::Instance()->IsSpeaking()) { - ResetEvent(pThis->m_hEventWakeup); - TTSPlayer::Instance()->Stop(); - TTSPlayer::Instance()->WaitUntilDone(); - }*/ - - ResetEvent(pThis->m_hEventWakeup); - TRACE(L"\n============ PLAY AUDIO CLIP\n"); - if (!pThis->m_bAbort) { - /* while (ambulantX::gui::dx::audio_playerX::Instance()->isPlaying()) { - TRACE(L"\nIS PLAYING..."); - Sleep(500); - } */ - pThis->playAudioPrompt(comp->m_AudioClip); - } - delete comp; - comp=NULL; - /* - if (!AmisBrain::Instance()->isAudioClipPlaying()) { - AmisBrain::Instance()->playAudioPrompt(comp->m_AudioClip); - } else { - TRACE(L"THIS SHOULD NEVER HAPPEN ! 1"); - }*/ - - } else if (!pThis->m_bAbort) { - pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. - - /*if (AmisBrain::Instance()->isAudioClipPlaying()) { - ResetEvent(pThis->m_hEventWakeup); - AmisBrain::Instance()->stopAudioClip(); - }*/ - - - ResetEvent(pThis->m_hEventWakeup); - CString strDebug; - strDebug.Format(_T("============ PLAY AUDIO TTS: --%s--\n"), comp->m_String); - TRACE(strDebug); - if (!TTSPlayer::Instance()->IsSpeaking()) { - - //LPCWSTR str = T2W(comp->m_String); - //std::wstring str = (LPCTSTR)comp->m_String.GetBuffer(); - //comp->m_String.ReleaseBuffer(); - TTSPlayer::Instance()->Play(comp->m_String); - delete comp; - comp=NULL; - } else { - TRACE(L"THIS SHOULD NEVER HAPPEN ! 2"); - } - } - } - } else if (!pThis->m_bAbort) { - - if (pThis->m_nextAudioSequence != NULL) { - pThis->m_currentAudioSequence = pThis->m_nextAudioSequence; - pThis->m_nextAudioSequence = NULL; - SetEvent(pThis->m_hEventWakeup); - } else { - pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. - ResetEvent(pThis->m_hEventWakeup); - SetEvent(pThis->m_hEventEnd); - } - } - } // while ... - - CoUninitialize(); - return 0; -} - - //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // This works for Containers (menus). @@ -681,6 +455,9 @@ else if (p_uiItem->getUiItemType() == CONTAINER) { Container* container = (Container*)p_uiItem; keyboardShortcutAccelerator = container->getKeyboardAccelerator(); + mnemonic = container->getMnemonic(); + } else { + int here = 1; } //fillSequenceCaptionAndDescription(seq, p_uiItem); @@ -1044,7 +821,7 @@ TextAudioPair* pair = label->getContents(); if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); - if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL) + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { seq->append(audio); } @@ -1075,7 +852,7 @@ if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); - if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL) + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { seq->append(audio); } @@ -1099,7 +876,7 @@ if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); - if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL) + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { seq->append(audio); } @@ -1126,7 +903,7 @@ TextAudioPair* pair = pi->getContents(); if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); - if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL) + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { seq->append(audio); } @@ -1165,4 +942,252 @@ } } } +} + + + + + + + + + + + + + + + + + +unsigned __stdcall AudioSequencePlayer::ThreadProc(void* Arg) +{ + USES_CONVERSION; + + _ASSERT(Arg != NULL); + + ULONG nStream; + AudioSequencePlayer* pThis = (AudioSequencePlayer*) Arg; + + AudioSequenceComponent* comp = NULL; + BOOL bEmptyQueue; + + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + _ASSERT(hr == S_OK); + + while (! pThis->m_bAbort) + { + + DWORD hr = WaitForSingleObject(pThis->m_hEventWakeup, INFINITE); + switch (hr) { + case WAIT_FAILED: { + int i = 0; + break; + } + + case WAIT_ABANDONED + : { + int i = 0; + break;} + + case WAIT_OBJECT_0 + : { + int i = 0; + break;} + + case WAIT_TIMEOUT: + { + int i = 0; + break; + } + + } + + /* + if (pThis->m_wakeUpOriginator == 0) { + break; + } else if (pThis->m_wakeUpOriginator == 1) { + + if (AmisBrain::Instance()->isAudioClipPlaying()) { + TRACE(L"### STOP AUDIO CLIP"); + ResetEvent(pThis->m_hEventWakeup); + AmisBrain::Instance()->stopAudioClip(); + continue; + } else + if (TTSPlayer::Instance()->IsSpeaking()) { + TRACE(L"### STOP TTS CLIP"); + ResetEvent(pThis->m_hEventWakeup); + TTSPlayer::Instance()->Stop(); + //TTSPlayer::Instance()->WaitUntilDone(); + continue; + } else { + pThis->m_wakeUpOriginator = -1; + } + + } + */ + + /* + if (pThis->m_wakeUpAction == 0) // INTERRUPT PROCESS BEGIN + { + if (pThis->m_wakeUpOriginator != 1) { + TRACE(L"------------ ZZ_1"); + } + + pThis->m_wakeUpAction = 1; // TTS SHUTDOWN + + if (TTSPlayer::Instance()->IsSpeaking()) { + ResetEvent(pThis->m_hEventWakeup); + TTSPlayer::Instance()->Stop(); + TTSPlayer::Instance()->WaitUntilDone(); + } + + //continue; + } + else if (pThis->m_wakeUpAction == 1) // TTS SHUTDOWN + { + + if (pThis->m_wakeUpOriginator != 2) { + TRACE(L"------------ ZZ_2"); + } + + pThis->m_wakeUpAction = 2; // AUDIO CLIP SHUTDOWN + + if (AmisBrain::Instance()->isAudioClipPlaying()) { + ResetEvent(pThis->m_hEventWakeup); + AmisBrain::Instance()->stopAudioClip(); + } + + //continue; + } + else if (pThis->m_wakeUpAction == 2) // AUDIO CLIP SHUTDOWN + { + + if (pThis->m_wakeUpOriginator != 3) { + TRACE(L"------------ ZZ_3"); + } + pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. + }*/ + + + if (pThis->m_wakeUpOriginator == 3) { + //Sleep(500); + //TRACE(L"AUDIERE SLEEP-"); + } + + + bEmptyQueue = FALSE; + { +#ifdef CCS_ACTIVE + EnterCriticalSection(&pThis->m_csSequence); +#endif + + + if (pThis->m_currentAudioSequence != NULL && pThis->m_currentAudioSequence->GetCount() > 0) + { + comp = pThis->m_currentAudioSequence->RemoveTail(); + + /*if (comp!=NULL) + { + + if (comp->m_isAudioClip) { + if (AmisBrain::Instance()->isAudioClipPlaying()) { + pThis->m_currentAudioSequence->AddTail(comp); + } + } else { + if (TTSPlayer::Instance()->IsSpeaking()) { + pThis->m_currentAudioSequence->AddTail(comp); + } + } + }*/ + + if (pThis->m_currentAudioSequence->GetCount() == 0) { + delete pThis->m_currentAudioSequence; + pThis->m_currentAudioSequence = NULL; + } + } + else + { + bEmptyQueue = TRUE; + } + + if (!pThis->m_bAbort && !bEmptyQueue) + { + if (!pThis->m_bAbort && comp!=NULL) + { + + if (!pThis->m_bAbort && comp->m_isAudioClip) { + pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. + /*if (TTSPlayer::Instance()->IsSpeaking()) { + ResetEvent(pThis->m_hEventWakeup); + TTSPlayer::Instance()->Stop(); + TTSPlayer::Instance()->WaitUntilDone(); + }*/ + + ResetEvent(pThis->m_hEventWakeup); + TRACE(L"\n============ PLAY AUDIO CLIP\n"); + if (!pThis->m_bAbort) { + /* while (ambulantX::gui::dx::audio_playerX::Instance()->isPlaying()) { + TRACE(L"\nIS PLAYING..."); + Sleep(500); + } */ + pThis->playAudioPrompt(comp->m_AudioClip); + } + delete comp; + comp=NULL; + /* + if (!AmisBrain::Instance()->isAudioClipPlaying()) { + AmisBrain::Instance()->playAudioPrompt(comp->m_AudioClip); + } else { + TRACE(L"THIS SHOULD NEVER HAPPEN ! 1"); + }*/ + + } else if (!pThis->m_bAbort) { + pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. + + /*if (AmisBrain::Instance()->isAudioClipPlaying()) { + ResetEvent(pThis->m_hEventWakeup); + AmisBrain::Instance()->stopAudioClip(); + }*/ + + + ResetEvent(pThis->m_hEventWakeup); + CString strDebug; + strDebug.Format(_T("============ PLAY AUDIO TTS: --%s--\n"), comp->m_String); + TRACE(strDebug); + if (!TTSPlayer::Instance()->IsSpeaking()) { + + //LPCWSTR str = T2W(comp->m_String); + //std::wstring str = (LPCTSTR)comp->m_String.GetBuffer(); + //comp->m_String.ReleaseBuffer(); + TTSPlayer::Instance()->Play(comp->m_String); + delete comp; + comp=NULL; + } else { + TRACE(L"THIS SHOULD NEVER HAPPEN ! 2"); + } + } + } + } else if (!pThis->m_bAbort) { + + if (pThis->m_nextAudioSequence != NULL) { + pThis->m_currentAudioSequence = pThis->m_nextAudioSequence; + pThis->m_nextAudioSequence = NULL; + SetEvent(pThis->m_hEventWakeup); + } else { + pThis->m_wakeUpAction = 3; // Nothing to do. Just play normally. + ResetEvent(pThis->m_hEventWakeup); + SetEvent(pThis->m_hEventEnd); + } + } + +#ifdef CCS_ACTIVE + LeaveCriticalSection(&pThis->m_csSequence); +#endif + } + } // while ... + + CoUninitialize(); + return 0; } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-03 03:12:55 UTC (rev 2378) @@ -175,8 +175,9 @@ { //m_iV(NULL) m_iV = NULL; + HRESULT hr = 0; #ifdef _DEBUG - HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == S_FALSE) CoUninitialize(); assert(hr == S_FALSE); #endif Modified: branches/amis3/VC7/amis.sln =================================================================== --- branches/amis3/VC7/amis.sln 2008-03-03 02:17:58 UTC (rev 2377) +++ branches/amis3/VC7/amis.sln 2008-03-03 03:12:55 UTC (rev 2378) @@ -5,7 +5,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AmisGuiMFC2", "..\AmisGuiMFC2\AmisGuiMFC2.vcproj", "{A7A37247-BAAC-4376-8354-96A8C09F926A}" ProjectSection(ProjectDependencies) = postProject - {62575239-B3F3-4020-A275-7ADF0EA18799} = {62575239-B3F3-4020-A275-7ADF0EA18799} {E0F81CE5-9C15-4E36-BC71-42BE1C0F2406} = {E0F81CE5-9C15-4E36-BC71-42BE1C0F2406} EndProjectSection EndProject @@ -17,10 +16,6 @@ ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AmisAudio", "..\AmisAudio\AmisAudio.vcproj", "{62575239-B3F3-4020-A275-7ADF0EA18799}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AmisLangpack", "..\DefaultLangpack\AmisLangpack\AmisLangpack.vcproj", "{92F93B73-6D27-47ED-89F3-B82590338216}" ProjectSection(ProjectDependencies) = postProject EndProjectSection @@ -47,10 +42,6 @@ {8B8E82A3-277F-4486-8D6A-4BCFB2DE3464}.Debug.Build.0 = Debug|Win32 {8B8E82A3-277F-4486-8D6A-4BCFB2DE3464}.Release.ActiveCfg = Release|Win32 {8B8E82A3-277F-4486-8D6A-4BCFB2DE3464}.Release.Build.0 = Release|Win32 - {62575239-B3F3-4020-A275-7ADF0EA18799}.Debug.ActiveCfg = Debug|Win32 - {62575239-B3F3-4020-A275-7ADF0EA18799}.Debug.Build.0 = Debug|Win32 - {62575239-B3F3-4020-A275-7ADF0EA18799}.Release.ActiveCfg = Release|Win32 - {62575239-B3F3-4020-A275-7ADF0EA18799}.Release.Build.0 = Release|Win32 {92F93B73-6D27-47ED-89F3-B82590338216}.Debug.ActiveCfg = Debug|Win32 {92F93B73-6D27-47ED-89F3-B82590338216}.Debug.Build.0 = Debug|Win32 {92F93B73-6D27-47ED-89F3-B82590338216}.Release.ActiveCfg = Release|Win32 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-03 02:17:52
|
Revision: 2377 http://amis.svn.sourceforge.net/amis/?rev=2377&view=rev Author: marisademeglio Date: 2008-03-02 18:17:58 -0800 (Sun, 02 Mar 2008) Log Message: ----------- small fix to the play/pause toggle button and menu item however, on startup, it is in the wrong state Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-03 01:08:39 UTC (rev 2376) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-03 02:17:58 UTC (rev 2377) @@ -251,9 +251,8 @@ BEGIN LTEXT "This book contains the following special types of items. Checked items will be played. Unchecked items will be skipped.", IDC_SKIP_INSTRUCTIONS,7,7,224,21 - LISTBOX IDC_SKIPS,7,32,224,123,LBS_OWNERDRAWFIXED | - LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | - WS_TABSTOP + LISTBOX IDC_SKIPS,7,32,224,123,LBS_HASSTRINGS | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP DEFPUSHBUTTON "OK",IDOK,94,165,50,14 END Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-03 01:08:39 UTC (rev 2376) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-03 02:17:58 UTC (rev 2377) @@ -77,6 +77,7 @@ afx_msg void OnUpdateCmdUiPlaySlower(CCmdUI*); afx_msg void OnUpdateCmdUiCheckSidebar(CCmdUI*); afx_msg void OnUpdateCmdUiFindInText(CCmdUI*); + afx_msg void OnUpdateCmdUiPlayPause(CCmdUI*); DECLARE_MESSAGE_MAP() public: afx_msg void OnSize(UINT nType, int cx, int cy); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 01:08:39 UTC (rev 2376) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 02:17:58 UTC (rev 2377) @@ -426,13 +426,15 @@ if (view->isPlaying() == true) { amis::util::Log::Instance()->writeMessage("Pausing", "CAmisApp::OnPlayPause", "AmisGuiMFC2"); - MainWndParts::Instance()->mpDefaultToolbar->togglePlayPause(true); + MainWndParts::Instance()->mpDefaultToolbar->togglePlayPause(true); + MainWndParts::Instance()->mpBasicToolbar->togglePlayPause(true); view->OnFilePause(); } else { amis::util::Log::Instance()->writeMessage("Playing", "CAmisApp::OnPlayPause", "AmisGuiMFC2"); - MainWndParts::Instance()->mpDefaultToolbar->togglePlayPause(false); + MainWndParts::Instance()->mpDefaultToolbar->togglePlayPause(false); + MainWndParts::Instance()->mpBasicToolbar->togglePlayPause(false); view->OnFilePlay(); } } Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-03 01:08:39 UTC (rev 2376) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-03 02:17:58 UTC (rev 2377) @@ -26,6 +26,7 @@ #include "gui/MainWndParts.h" #include "Preferences.h" #include "DtbWithHooks.h" +#include "gui/MenuManip.h" #include "directshow/dx_audio_player.h" @@ -75,7 +76,7 @@ ON_UPDATE_COMMAND_UI(ID_AMIS_FOCUS_ON_TEXT, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_NO_PAGE_STYLES, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_PLAYPAUSE, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_PLAYPAUSE, OnUpdateCmdUiPlayPause) ON_UPDATE_COMMAND_UI(ID_AMIS_ESCAPE, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_RESET_SPEED, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_SECTION, OnUpdateCmdUiGeneral) @@ -484,6 +485,22 @@ { pCmdUi->Enable(false); } +void CMainFrame::OnUpdateCmdUiPlayPause(CCmdUI* pCmdUi) +{ + if (theApp.isBookOpen()) + { + //should it say "play" or "pause"? + MmView *p_view = MainWndParts::Instance()->mpMmView; + if (p_view == NULL) return; + bool b_is_playing = p_view->isPlaying(); + MainWndParts::Instance()->mpDefaultToolbar->togglePlayPause(!b_is_playing); + MainWndParts::Instance()->mpBasicToolbar->togglePlayPause(!b_is_playing); + MenuManip::Instance()->setPauseState(!b_is_playing); + } + else + updateUiCommandState(pCmdUi, false); +} + void amis::gui::CMainFrame::OnSize(UINT nType, int cx, int cy) { CMDIFrameWnd::OnSize(nType, cx, cy); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-03 01:08:36
|
Revision: 2376 http://amis.svn.sourceforge.net/amis/?rev=2376&view=rev Author: daniel_weck Date: 2008-03-02 17:08:39 -0800 (Sun, 02 Mar 2008) Log Message: ----------- attempt to fix the skip dialog strange error, which seems to be related to AfxWndProc message pump...the other dialogs work fine, just not this one !! ?? Modified Paths: -------------- branches/amis3/AmisAudio/AmisAudio.vcproj branches/amis3/AmisAudio/include/directshow/dx_audio_player.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp Modified: branches/amis3/AmisAudio/AmisAudio.vcproj =================================================================== --- branches/amis3/AmisAudio/AmisAudio.vcproj 2008-03-03 00:59:30 UTC (rev 2375) +++ branches/amis3/AmisAudio/AmisAudio.vcproj 2008-03-03 01:08:39 UTC (rev 2376) @@ -40,7 +40,6 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/FORCE:MULTIPLE" - AdditionalDependencies="stlib.lib kernel32.lib gdi32.lib user32.lib" ShowProgress="2" OutputFile="$(OutDir)/$(ProjectName)D.dll" LinkIncremental="1" Modified: branches/amis3/AmisAudio/include/directshow/dx_audio_player.h =================================================================== --- branches/amis3/AmisAudio/include/directshow/dx_audio_player.h 2008-03-03 00:59:30 UTC (rev 2375) +++ branches/amis3/AmisAudio/include/directshow/dx_audio_player.h 2008-03-03 01:08:39 UTC (rev 2376) @@ -47,6 +47,14 @@ //#include "ambulant/lib/win32/win32_error.h" //#include "ambulant/lib/logger.h" +/* +#ifdef _DEBUG +#pragma comment(lib, "msvcrtd.lib") +#else +#pragma comment(lib, "msvcrt.lib") +#endif +*/ + #ifndef AMBULANT_PLATFORM_WIN32_WCE #pragma comment (lib,"winmm.lib") #pragma comment (lib,"amstrmid.lib") Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h 2008-03-03 00:59:30 UTC (rev 2375) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h 2008-03-03 01:08:39 UTC (rev 2376) @@ -27,6 +27,8 @@ #include "gui/dialogs/AmisDialogBase.h" #include "../resource.h" +//#define TESTING + namespace amis { namespace gui @@ -34,7 +36,13 @@ namespace dialogs { -class SkipDialog : public AmisDialogBase +class SkipDialog : +#ifdef TESTING +public CDialog +#else +public AmisDialogBase +#endif + { //friend class amis::gui::spoken::SkipDialogVoicing; friend class SkipDialogVoicing; Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 00:59:30 UTC (rev 2375) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 01:08:39 UTC (rev 2376) @@ -615,7 +615,8 @@ amis::util::Log::Instance()->writeMessage("Showing reading options dialog (skippability)", "CAmisApp::OnSkipInfo", "AmisGuiMFC2"); amis::gui::dialogs::SkipDialog skip_dialog; skip_dialog.initializeData(amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()); - skip_dialog.do_modal(); + //skip_dialog.do_modal(); + skip_dialog.DoModal(); amis::dtb::DtbWithHooks::Instance()->updateCustomTestStates(); } Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-03-03 00:59:30 UTC (rev 2375) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-03-03 01:08:39 UTC (rev 2376) @@ -38,7 +38,12 @@ amis::gui::dialogs::SkipDialogVoicing * mpSkipDialogVoicing = NULL; SkipDialog::SkipDialog(CWnd* pParent /*=NULL*/) - : AmisDialogBase(SkipDialog::IDD) + +#ifdef TESTING + : CDialog(SkipDialog::IDD) +#else + : AmisDialogBase(SkipDialog::IDD) +#endif { if (Preferences::Instance()->getIsSelfVoicing() == true) @@ -63,7 +68,7 @@ { return CDialog::PreTranslateMessage(pMsg); } - +#ifndef TESTING if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) { CWnd* cwnd = this->GetFocus(); @@ -81,6 +86,7 @@ } } } +#endif return CDialog::PreTranslateMessage(pMsg); } @@ -172,9 +178,16 @@ void SkipDialog::OnPaint() { +#ifdef TESTING + CDialog::OnPaint(); + return; +#endif + CPaintDC dc(this); // device context for painting // Let the window do its default painting... CWnd::DefWindowProc( WM_PAINT, (WPARAM)dc.m_hDC, 0 ); //call the base class on_paint function +#ifndef TESTING on_paint(); +#endif } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-03 00:59:28
|
Revision: 2375 http://amis.svn.sourceforge.net/amis/?rev=2375&view=rev Author: marisademeglio Date: 2008-03-02 16:59:30 -0800 (Sun, 02 Mar 2008) Log Message: ----------- Moderate success with toggling the play/pause button images. Needs testing though, and it still doesn't react to audio events (just user button presses). Also, the slowdown button is disabled unless the user has already increased the rate (this needs testing) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp branches/amis3/bin/settings/defaultToolbar.xml Modified: branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h 2008-03-03 00:00:21 UTC (rev 2374) +++ branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h 2008-03-03 00:59:30 UTC (rev 2375) @@ -63,9 +63,15 @@ void setCommandId(UINT); const ambulant::net::url* getImageSrc(); UINT getCommandId(); + std::string getId(); + void setId(std::string); + void setImageIndex(int); + int getImageIndex(); private: ambulant::net::url mSrc; UINT mMfcId; + std::string mId; + int mImageIndex; }; class ToolbarToggleButton : public ToolbarItem { @@ -114,8 +120,7 @@ Toolbar(); virtual ~Toolbar(); void setSettings(ToolbarSettings*); - void enableSlowdown(bool); - void setPlayPauseToggle(bool); + void togglePlayPause(bool); void enable(UINT, bool); protected: afx_msg int OnCreate(LPCREATESTRUCT); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 00:00:21 UTC (rev 2374) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 00:59:30 UTC (rev 2375) @@ -426,11 +426,13 @@ if (view->isPlaying() == true) { amis::util::Log::Instance()->writeMessage("Pausing", "CAmisApp::OnPlayPause", "AmisGuiMFC2"); + MainWndParts::Instance()->mpDefaultToolbar->togglePlayPause(true); view->OnFilePause(); } else { amis::util::Log::Instance()->writeMessage("Playing", "CAmisApp::OnPlayPause", "AmisGuiMFC2"); + MainWndParts::Instance()->mpDefaultToolbar->togglePlayPause(false); view->OnFilePlay(); } } Modified: branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp 2008-03-03 00:00:21 UTC (rev 2374) +++ branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp 2008-03-03 00:59:30 UTC (rev 2375) @@ -23,6 +23,7 @@ #include "stdafx.h" #include "gui/toolbar/Toolbar.h" #include "gui/AmisApp.h" +#include "util/Log.h" using namespace amis::gui::toolbar; @@ -79,7 +80,22 @@ { return mMfcId; } - +void ToolbarButton::setId(string id) +{ + mId = id; +} +string ToolbarButton::getId() +{ + return mId; +} +void ToolbarButton::setImageIndex(int idx) +{ + mImageIndex = idx; +} +int ToolbarButton::getImageIndex() +{ + return mImageIndex; +} /** * a toggle button **/ @@ -219,14 +235,58 @@ { mpSettings = pSettings; } -void Toolbar::enableSlowdown(bool bIsEnabled) +void Toolbar::togglePlayPause(bool bShowPlay) { - //TODO: write this! + //find the toggle button that has the ID_AMIS_PLAYPAUSE command + ToolbarToggleButton* play_pause_button = NULL; + ToolbarItems items = mpSettings->getItems(); + int index_of_toggle = 0; + for (int i = 0; i<items.size(); i++) + { + if (items[i]->getType() == TOGGLE) + { + ToolbarToggleButton* p_tmp = (ToolbarToggleButton*)items[i]; + if (p_tmp->getButtonOne()->getCommandId() == ID_AMIS_PLAYPAUSE) + { + play_pause_button = p_tmp; + index_of_toggle = i; + break; + } + } + } + if (play_pause_button == NULL) + { + amis::util::Log::Instance()->writeError("Play/pause button not found on toolbar", "Toolbar::togglePlayPause", "AmisGuiMFC2"); + return; + } + + ToolbarButton* play_button = NULL; + ToolbarButton* pause_button = NULL; + if (play_pause_button->getButtonOne()->getId() == "play") + { + play_button = play_pause_button->getButtonOne(); + pause_button = play_pause_button->getButtonTwo(); + } + else + { + play_button = play_pause_button->getButtonTwo(); + pause_button = play_pause_button->getButtonOne(); + } + + TBBUTTON play_or_pause; + GetButton(index_of_toggle, &play_or_pause); + if (bShowPlay == true) + { + play_or_pause.iBitmap = play_button->getImageIndex(); + } + else + { + play_or_pause.iBitmap = pause_button->getImageIndex(); + } + DeleteButton(index_of_toggle); + InsertButton(index_of_toggle, &play_or_pause); + } -void Toolbar::setPlayPauseToggle(bool bShowPlay) -{ - //TODO: write this! -} HICON Toolbar::makeIcon(ToolbarButton* pButton) { USES_CONVERSION; @@ -294,6 +354,7 @@ else if (items[i]->getType() == BUTTON) { ToolbarButton* p_button = (ToolbarButton*)items[i]; + p_button->setImageIndex(j); buttons[i].iBitmap = j; buttons[i].fsState = TBSTATE_ENABLED; buttons[i].fsStyle=TBSTYLE_BUTTON; @@ -305,6 +366,8 @@ { ToolbarToggleButton* p_button = (ToolbarToggleButton*)items[i]; buttons[i].iBitmap = j; + p_button->getButtonOne()->setImageIndex(j); + p_button->getButtonTwo()->setImageIndex(j+1); buttons[i].fsState = TBSTATE_ENABLED; buttons[i].fsStyle=TBSTYLE_BUTTON; buttons[i].iString = 0; //TODO: fill this in Modified: branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp 2008-03-03 00:00:21 UTC (rev 2374) +++ branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp 2008-03-03 00:59:30 UTC (rev 2375) @@ -107,12 +107,14 @@ amis::gui::toolbar::ToolbarButton* p_button = new amis::gui::toolbar::ToolbarButton(); string image_path = SimpleAttrs::get("src", &attributes); string mfcid = SimpleAttrs::get("mfcid", &attributes); + string id = SimpleAttrs::get("id", &attributes); ambulant::net::url image_url = ambulant::net::url::from_filename(image_path); const ambulant::net::url* base_file = getFilepath(); image_url = image_url.join_to_base(*base_file); UINT n_mfcid = getIdForCommandString(mfcid); p_button->setImageSrc(image_url); p_button->setCommandId(n_mfcid); + p_button->setId(id); if (mbFlagInToggle == true) mpCurrentToggle->addButton(p_button); else Modified: branches/amis3/bin/settings/defaultToolbar.xml =================================================================== --- branches/amis3/bin/settings/defaultToolbar.xml 2008-03-03 00:00:21 UTC (rev 2374) +++ branches/amis3/bin/settings/defaultToolbar.xml 2008-03-03 00:59:30 UTC (rev 2375) @@ -41,6 +41,8 @@ ID_AMIS_SHOW_HELP_CONTENTS ID_AMIS_ABOUT ID_AMIS_NEXT_PAGE_STYLE + +the id's "play" and "pause" are keywords to identify which image is the play button and which is the pause button --> <toolbar xmlns="http://amisproject.org" view="default" placement="top" buttonHeight="32" buttonWidth="32"> <button src="./img/defaultToolbar/document_open.ico" mfcid="ID_AMIS_OPEN_FILE"/> @@ -48,8 +50,8 @@ <separator/> <button src="./img/defaultToolbar/media_seek_backward.ico" mfcid="ID_AMIS_PREVIOUS_PHRASE"/> <toggle> - <button src="./img/defaultToolbar/media_playback_start.ico" mfcid="ID_AMIS_PLAYPAUSE"/> - <button src="./img/defaultToolbar/media_playback_pause.ico" mfcid="ID_AMIS_PLAYPAUSE"/> + <button src="./img/defaultToolbar/media_playback_start.ico" mfcid="ID_AMIS_PLAYPAUSE" id="play"/> + <button src="./img/defaultToolbar/media_playback_pause.ico" mfcid="ID_AMIS_PLAYPAUSE" id="pause"/> </toggle> <button src="./img/defaultToolbar/media_seek_forward.ico" mfcid="ID_AMIS_NEXT_PHRASE"/> <separator/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-03 00:00:34
|
Revision: 2374 http://amis.svn.sourceforge.net/amis/?rev=2374&view=rev Author: daniel_weck Date: 2008-03-02 16:00:21 -0800 (Sun, 02 Mar 2008) Log Message: ----------- fixed small bug to prevent loading of anything related to self-voicing if it is off (not even the singletons) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 23:51:37 UTC (rev 2373) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 00:00:21 UTC (rev 2374) @@ -69,7 +69,7 @@ #if _DEBUG //get Visual Leak Detector version 1.0 here: http://dmoulding.googlepages.com/downloads -#include <vld.h> +//#include <vld.h> #endif using namespace amis::gui; Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 23:51:37 UTC (rev 2373) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-03 00:00:21 UTC (rev 2374) @@ -254,6 +254,7 @@ void CMainFrame::OnMenuSelect( UINT nItemID, UINT nFlags, HMENU hSysMenu ) { + TRACE("\n\nHERE 1"); CFrameWnd::OnMenuSelect(nItemID, nFlags, hSysMenu); if (amis::Preferences::Instance()->getIsSelfVoicing() == true) @@ -264,6 +265,7 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) { + TRACE("\n\nHERE 2"); m_lastOpenPopupMenu = pPopupMenu; CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); @@ -465,7 +467,7 @@ } void CMainFrame::OnUpdateCmdUiPlaySlower(CCmdUI* pCmdUi) { - if (theApp.isBookOpen() && ambulantX::gui::dx::audio_playerX::Instance()->get_rate() > 1) + if (theApp.isBookOpen() && Preferences::Instance()->getIsSelfVoicing() && ambulantX::gui::dx::audio_playerX::Instance()->get_rate() > 1) updateUiCommandState(pCmdUi, true); else updateUiCommandState(pCmdUi, false); @@ -506,7 +508,7 @@ //we need it anyway. i suspect that our custom toolbars bypass the effect of OnUpdateCommandUi void amis::gui::CMainFrame::updateToolbarState(toolbar::Toolbar* pToolbar) { - if (theApp.isBookOpen() && ambulantX::gui::dx::audio_playerX::Instance()->get_rate() > 1) + if (theApp.isBookOpen() && Preferences::Instance()->getIsSelfVoicing() && ambulantX::gui::dx::audio_playerX::Instance()->get_rate() > 1) pToolbar->enable(ID_AMIS_SLOWER, true); else pToolbar->enable(ID_AMIS_SLOWER, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 23:51:42
|
Revision: 2373 http://amis.svn.sourceforge.net/amis/?rev=2373&view=rev Author: daniel_weck Date: 2008-03-02 15:51:37 -0800 (Sun, 02 Mar 2008) Log Message: ----------- fixed compile errors (minor) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-02 23:44:04 UTC (rev 2372) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-02 23:51:37 UTC (rev 2373) @@ -80,9 +80,9 @@ DECLARE_MESSAGE_MAP() public: afx_msg void OnSize(UINT nType, int cx, int cy); + void updateToolbarState(toolbar::Toolbar*); private: void updateUiCommandState(CCmdUI*, bool); - void updateToolbarState(toolbar::Toolbar*); }; } } Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 23:44:04 UTC (rev 2372) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 23:51:37 UTC (rev 2373) @@ -296,6 +296,9 @@ if (did_it_work == amis::OK) { + //TODO: remove this ! This is just for testing AMIS with Self-Voice off + amis::Preferences::Instance()->setIsSelfVoicing(false); + //test print to an output file //p_new_data_tree->testPrint("c:\\devel\\amis\\Langpacks\\sandbox\\dataout.txt"); Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 23:44:04 UTC (rev 2372) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 23:51:37 UTC (rev 2373) @@ -256,11 +256,10 @@ { CFrameWnd::OnMenuSelect(nItemID, nFlags, hSysMenu); - if (amis::Preferences::Instance()->getIsSelfVoicing() == false) + if (amis::Preferences::Instance()->getIsSelfVoicing() == true) { - return; + mMenuVoicing->OnMenuSelect(nItemID, nFlags, hSysMenu); } - mMenuVoicing->OnMenuSelect(nItemID, nFlags, hSysMenu); } void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) @@ -271,6 +270,8 @@ return; + /* + USES_CONVERSION; if (pPopupMenu == NULL) @@ -296,6 +297,7 @@ tmpstr = A2T(prompt.c_str()); dbg.Format(_T("\tPrompt for this popup 1 = --%s-- \n"), tmpstr); //DAN_MENU_DEBUG TRACE(dbg); + */ } void CMainFrame::OnInitMenu(CMenu* pMenu) @@ -504,7 +506,7 @@ //we need it anyway. i suspect that our custom toolbars bypass the effect of OnUpdateCommandUi void amis::gui::CMainFrame::updateToolbarState(toolbar::Toolbar* pToolbar) { - if (theApp.isBookOpen() && amis::audio::AmisAudio::Instance()->getRate() > 1) + if (theApp.isBookOpen() && ambulantX::gui::dx::audio_playerX::Instance()->get_rate() > 1) pToolbar->enable(ID_AMIS_SLOWER, true); else pToolbar->enable(ID_AMIS_SLOWER, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-02 23:44:02
|
Revision: 2372 http://amis.svn.sourceforge.net/amis/?rev=2372&view=rev Author: marisademeglio Date: 2008-03-02 15:44:04 -0800 (Sun, 02 Mar 2008) Log Message: ----------- Resolved conflicts; added toolbar item enabling/disabling (still needs work though) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 23:27:34 UTC (rev 2371) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 23:44:04 UTC (rev 2372) @@ -204,9 +204,6 @@ <File RelativePath=".\include\gui\TextRenderBrain.h"> </File> - <File - RelativePath=".\include\gui\Toolbar.h"> - </File> <Filter Name="dialogs" Filter=""> Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-02 23:27:34 UTC (rev 2371) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-02 23:44:04 UTC (rev 2372) @@ -33,9 +33,7 @@ { class CMainFrame : public CMDIFrameWnd { - DECLARE_DYNAMIC(CMainFrame) - friend class MenuVoicing; public: @@ -53,7 +51,7 @@ virtual void Dump(CDumpContext& dc) const; #endif -protected: // control bar embedded members +protected: CStatusBar mStatusBar; amis::gui::sidebar::cdxCDynamicBarT<amis::gui::sidebar::CAmisSidebar> mSidebar; amis::gui::toolbar::Toolbar mDefaultToolbar; @@ -61,7 +59,7 @@ CReBar mDefaultRebar; CReBar mBasicRebar; CMenu mSavedMenu; -protected: + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu); afx_msg void OnMenuSelect( UINT nItemID, UINT nFlags, HMENU hSysMenu ); @@ -77,7 +75,14 @@ afx_msg void OnUpdateCmdUiGeneral(CCmdUI*); afx_msg void OnUpdateCmdUiInfoSkip(CCmdUI*); afx_msg void OnUpdateCmdUiPlaySlower(CCmdUI*); + afx_msg void OnUpdateCmdUiCheckSidebar(CCmdUI*); + afx_msg void OnUpdateCmdUiFindInText(CCmdUI*); DECLARE_MESSAGE_MAP() +public: + afx_msg void OnSize(UINT nType, int cx, int cy); +private: + void updateUiCommandState(CCmdUI*, bool); + void updateToolbarState(toolbar::Toolbar*); }; } } Modified: branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h 2008-03-02 23:27:34 UTC (rev 2371) +++ branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h 2008-03-02 23:44:04 UTC (rev 2372) @@ -116,7 +116,7 @@ void setSettings(ToolbarSettings*); void enableSlowdown(bool); void setPlayPauseToggle(bool); - + void enable(UINT, bool); protected: afx_msg int OnCreate(LPCREATESTRUCT); afx_msg BOOL OnToolTipNotify(UINT, NMHDR*, LRESULT*); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 23:27:34 UTC (rev 2371) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 23:44:04 UTC (rev 2372) @@ -352,6 +352,10 @@ (filename, amis::Preferences::Instance()->getUserBmkDir())) { mbBookIsOpen = true; + MainWndParts::Instance()->mpMainFrame->updateToolbarState + (MainWndParts::Instance()->mpBasicToolbar); + MainWndParts::Instance()->mpMainFrame->updateToolbarState + (MainWndParts::Instance()->mpDefaultToolbar); amis::dtb::DtbWithHooks::Instance()->startReading(true); } else Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 23:27:34 UTC (rev 2371) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 23:44:04 UTC (rev 2372) @@ -34,6 +34,7 @@ #include "util/Log.h" #include "gui/self-voicing/dialogs/MenuVoicing.h" +#include "..\..\include\gui\mainfrm.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -71,35 +72,32 @@ ON_UPDATE_COMMAND_UI(ID_AMIS_CLOSE_BOOK, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_SHOW_READING_OPTIONS, OnUpdateCmdUiInfoSkip) ON_UPDATE_COMMAND_UI(ID_AMIS_SLOWER, OnUpdateCmdUiPlaySlower) - ON_UPDATE_COMMAND_UI(ID_AMIS_FOCUS_ON_SIDEBAR, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_FOCUS_ON_TEXT, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_RESET_HIGHLIGHT_COLORS, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_AUDIO_SELFVOICING_PLAYBACK, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_NO_PAGE_STYLES, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_PLAYPAUSE, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_ESCAPE, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_RESET_SPEED, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_INCREASE_VOLUME, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_DECREASE_VOLUME, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_SECTION, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_SECTION, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_PHRASE, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PHRASE, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_FIND_IN_TEXT, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_FIND_IN_TEXT, OnUpdateCmdUiFindInText) ON_UPDATE_COMMAND_UI(ID_AMIS_SHOW_PUBLICATION_SUMMARY, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PAGE_STYLE, OnUpdateCmdUiGeneral) //TODO: make these more intelligent ON_UPDATE_COMMAND_UI(ID_AMIS_INCREASE_SECTION_DEPTH, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_DECREASE_SECTION_DEPTH, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_SIDEBAR, OnUpdateCmdUiCheckSidebar) //}}AFX_MSG_MAP + ON_WM_SIZE() END_MESSAGE_MAP() static UINT indicators[] = { - ID_SEPARATOR, // status line indicator - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, + ID_SEPARATOR, // status line indicator + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, }; using namespace amis::gui::spoken; @@ -114,23 +112,21 @@ mCommonPreTranslateMessageHandler = new PreTranslateMessageHandler(-1); mMenuVoicing = new amis::gui::MenuVoicing(this); } - CMainFrame::~CMainFrame() { delete mCommonPreTranslateMessageHandler; delete mMenuVoicing; } - - int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; - //create the sidebar - if (!mSidebar.Create(_T("the sidebar"), this, CSize(0, 0), + //TODO: use localized data + if (!mSidebar.Create(_T("navigation"), this, CSize(0, 0), TRUE /*bHasGripper*/, AFX_IDW_CONTROLBAR_FIRST + 32)) { - TRACE0("Failed to create the sidebar\n"); + amis::util::Log::Instance()->writeError("Failed to create sidebar", "CMainFrame::OnCreate", + "AmisGuiMFC2"); return -1; } mSidebar.SetBarStyle(mSidebar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); @@ -140,7 +136,6 @@ if (!mStatusBar.Create(this) || !mStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { - TRACE0("Failed to create status bar\n"); amis::util::Log::Instance()->writeError("Failed to create status bar", "CMainFrame::OnCreate", "AmisGuiMFC2"); return -1; @@ -163,20 +158,19 @@ if (!mDefaultToolbar.Create(WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, rect, this, mSidebar.GetDlgCtrlID() + 1)) { - TRACE(_T("failed to create default toolbar\n")); amis::util::Log::Instance()->writeError("Failed to create default toolbar", "CMainFrame::OnCreate", "AmisGuiMFC2"); return -1; } + mDefaultToolbar.EnableToolTips(TRUE); + updateToolbarState(&mDefaultToolbar); - mDefaultToolbar.EnableToolTips(TRUE); //create the default rebar (toolbar container) if (p_settings->getPlacement() == amis::gui::toolbar::TOP) align = CBRS_TOP; else align = CBRS_BOTTOM; if (mDefaultRebar.Create(this, 0, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | align, AFX_IDW_REBAR) == FALSE) { - TRACE(_T("default rebar not created\n")); amis::util::Log::Instance()->writeError("Failed to create default rebar", "CMainFrame::OnCreate", "AmisGuiMFC2"); return -1; @@ -194,12 +188,12 @@ if (!mBasicToolbar.Create(WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, rect, this, mSidebar.GetDlgCtrlID() + 2)) { - TRACE(_T("failed to create default toolbar\n")); amis::util::Log::Instance()->writeError("Failed to create basic toolbar", "CMainFrame::OnCreate", "AmisGuiMFC2"); return -1; } mBasicToolbar.EnableToolTips(TRUE); + updateToolbarState(&mBasicToolbar); //create the basic rebar (toolbar container) if (p_settings->getPlacement() == amis::gui::toolbar::TOP) align = CBRS_TOP; @@ -207,7 +201,6 @@ if (mBasicRebar.Create(this, RBS_BANDBORDERS, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | align, AFX_IDW_REBAR) == FALSE) { - TRACE(_T("basic rebar not created\n")); amis::util::Log::Instance()->writeError("Failed to create basic rebar", "CMainFrame::OnCreate", "AmisGuiMFC2"); return -1; @@ -235,12 +228,10 @@ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { - if( !CMDIFrameWnd::PreCreateWindow(cs) ) - return FALSE; + if(!CMDIFrameWnd::PreCreateWindow(cs)) return FALSE; - cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE - | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU; - + cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE | WS_THICKFRAME + | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU; return TRUE; } //reload the original menu @@ -453,27 +444,105 @@ void CMainFrame::OnUpdateCmdUiPageCommands(CCmdUI* pCmdUi) { if (theApp.isBookOpen() && amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages()) - pCmdUi->Enable(true); + updateUiCommandState(pCmdUi, true); else - pCmdUi->Enable(false); + updateUiCommandState(pCmdUi, false); } void CMainFrame::OnUpdateCmdUiGeneral(CCmdUI* pCmdUi) { - pCmdUi->Enable(theApp.isBookOpen()); + updateUiCommandState(pCmdUi, theApp.isBookOpen()); } void CMainFrame::OnUpdateCmdUiInfoSkip(CCmdUI* pCmdUi) { if (theApp.isBookOpen() && amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() != NULL && amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()->getLength() > 0) - pCmdUi->Enable(true); + updateUiCommandState(pCmdUi, true); else - pCmdUi->Enable(false); + updateUiCommandState(pCmdUi, false); } void CMainFrame::OnUpdateCmdUiPlaySlower(CCmdUI* pCmdUi) { if (theApp.isBookOpen() && ambulantX::gui::dx::audio_playerX::Instance()->get_rate() > 1) - pCmdUi->Enable(true); + updateUiCommandState(pCmdUi, true); else - pCmdUi->Enable(false); + updateUiCommandState(pCmdUi, false); +} +void CMainFrame::OnUpdateCmdUiCheckSidebar(CCmdUI* pCmdUi) +{ + if (MainWndParts::Instance()->mpSidebar->IsVisible() == TRUE) + pCmdUi->SetCheck(1); + else + pCmdUi->SetCheck(0); +} +//TODO: re-enable when find in text works +void CMainFrame::OnUpdateCmdUiFindInText(CCmdUI* pCmdUi) +{ + pCmdUi->Enable(false); +} +void amis::gui::CMainFrame::OnSize(UINT nType, int cx, int cy) +{ + CMDIFrameWnd::OnSize(nType, cx, cy); + if (MainWndParts::Instance()->mpHtmlView != NULL) + { + CRect rect; + GetWindowRect(rect); + MainWndParts::Instance()->mpHtmlView->RedrawWindow(rect); + } +} + +//the ON_UPDATE_COMMAND_UI messages end up here because it takes care of the toolbars too +void amis::gui::CMainFrame::updateUiCommandState(CCmdUI* pCmdUi, bool value) +{ + pCmdUi->Enable(value); + mDefaultToolbar.enable(pCmdUi->m_nID, value); + mBasicToolbar.enable(pCmdUi->m_nID, value); +} + +//enable or disable the commands that only work when a book is open +//note that although this function should be unnecessary when we have OnUpdateCommandUi, +//we need it anyway. i suspect that our custom toolbars bypass the effect of OnUpdateCommandUi +void amis::gui::CMainFrame::updateToolbarState(toolbar::Toolbar* pToolbar) +{ + if (theApp.isBookOpen() && amis::audio::AmisAudio::Instance()->getRate() > 1) + pToolbar->enable(ID_AMIS_SLOWER, true); + else + pToolbar->enable(ID_AMIS_SLOWER, false); + + bool enable_page_cmds = false; + if (theApp.isBookOpen() && amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages()) + enable_page_cmds = true; + + pToolbar->enable(ID_AMIS_NEXT_PAGE, enable_page_cmds); + pToolbar->enable(ID_AMIS_PREVIOUS_PAGE, enable_page_cmds); + pToolbar->enable(ID_AMIS_GOTO_PAGE, enable_page_cmds); + + pToolbar->enable(ID_AMIS_BIGGER_FONT, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_SMALLER_FONT, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_ADD_BOOKMARK, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_FASTER, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_CLOSE_BOOK, theApp.isBookOpen()); + + if (theApp.isBookOpen() && amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() != NULL + && amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()->getLength() > 0) + pToolbar->enable(ID_AMIS_SHOW_READING_OPTIONS, true); + else + pToolbar->enable(ID_AMIS_SHOW_READING_OPTIONS, false); + + pToolbar->enable(ID_AMIS_FOCUS_ON_TEXT, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_NO_PAGE_STYLES, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_PLAYPAUSE, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_ESCAPE, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_RESET_SPEED, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_PREVIOUS_SECTION, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_NEXT_SECTION, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_PREVIOUS_PHRASE, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_NEXT_PHRASE, theApp.isBookOpen()); + //TODO: re-enable when the find in text feature works + pToolbar->enable(ID_AMIS_FIND_IN_TEXT, false); + pToolbar->enable(ID_AMIS_SHOW_PUBLICATION_SUMMARY, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_NEXT_PAGE_STYLE, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_INCREASE_SECTION_DEPTH, theApp.isBookOpen()); + pToolbar->enable(ID_AMIS_DECREASE_SECTION_DEPTH, theApp.isBookOpen()); } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-02 23:27:34 UTC (rev 2371) +++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-02 23:44:04 UTC (rev 2372) @@ -296,7 +296,8 @@ s_hwnd = GetSafeHwnd(); ModifyStyle(0, WS_CLIPCHILDREN); // reduce flicker - PostMessage(WM_SET_CLIENT_RECT, common::default_layout_width, ambulant::common::default_layout_height); + //this line forces a window size on startup -- otherwise we are in full screen mode + //PostMessage(WM_SET_CLIENT_RECT, common::default_layout_width, ambulant::common::default_layout_height); return 0; } Modified: branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp 2008-03-02 23:27:34 UTC (rev 2371) +++ branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp 2008-03-02 23:44:04 UTC (rev 2372) @@ -346,3 +346,7 @@ return(FALSE); } +void Toolbar::enable(UINT cmdId, bool value) +{ + this->EnableButton(cmdId, value); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 23:27:30
|
Revision: 2371 http://amis.svn.sourceforge.net/amis/?rev=2371&view=rev Author: daniel_weck Date: 2008-03-02 15:27:34 -0800 (Sun, 02 Mar 2008) Log Message: ----------- some minor changes in the thread termination handling (there are some bizarre debug assertion failed errors from time to time, but I think it may be because of the threading model of AudioSequencePlayer, so I need to refactor this first before further testing) Modified Paths: -------------- branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp Modified: branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp =================================================================== --- branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-03-02 23:02:59 UTC (rev 2370) +++ branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-03-02 23:27:34 UTC (rev 2371) @@ -161,8 +161,27 @@ pIMES->Release(); pIMES = NULL; - if (WaitForSingleObject(hEventHandler, INFINITE) != WAIT_OBJECT_0) { - int a = 3; + DWORD hr = WaitForSingleObject(hEventHandler, 1000); + switch (hr) { + case WAIT_FAILED: { + int i = 0; + break; + } + + case WAIT_ABANDONED + : { + int i = 0; + break;} + + case WAIT_OBJECT_0 + : { + int i = 0; + break;} + + case WAIT_TIMEOUT: { + int i = 0; + break;} + } hEventHandler = NULL; } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 23:02:59 UTC (rev 2370) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 23:27:34 UTC (rev 2371) @@ -115,10 +115,27 @@ } void AudioSequencePlayer::waitForSequenceEnd() { - - WaitForSingleObject(m_hEventEnd, 5000); - + DWORD hr = WaitForSingleObject(m_hEventEnd, 3000); + switch (hr) { + case WAIT_FAILED: { + int i = 0; + break;} + case WAIT_ABANDONED + : { + int i = 0; + break;} + + case WAIT_OBJECT_0 + : { + int i = 0; + break;} + + case WAIT_TIMEOUT: { + int i = 0; + break;} + + } } void AudioSequencePlayer::DestroyInstance() { @@ -160,8 +177,28 @@ _ASSERT(rc); +DWORD hr = WaitForSingleObject(m_hThread, 2000); + switch (hr) { + case WAIT_FAILED: { + int i = 0; + break;} - WaitForSingleObject(m_hThread, INFINITE); + case WAIT_ABANDONED + : { + int i = 0; + break; + } + case WAIT_OBJECT_0 + : { + int i = 0; + break;} + + case WAIT_TIMEOUT: { + int i = 0; + break;} + + } + CloseHandle(m_hThread); CloseHandle(m_hEventWakeup); @@ -384,7 +421,32 @@ while (! pThis->m_bAbort) { - WaitForSingleObject(pThis->m_hEventWakeup, INFINITE); + + DWORD hr = WaitForSingleObject(pThis->m_hEventWakeup, INFINITE); + switch (hr) { + case WAIT_FAILED: { + int i = 0; + break; + } + + case WAIT_ABANDONED + : { + int i = 0; + break;} + + case WAIT_OBJECT_0 + : { + int i = 0; + break;} + + case WAIT_TIMEOUT: + { + int i = 0; + break; + } + + } + /* if (pThis->m_wakeUpOriginator == 0) { break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 23:02:52
|
Revision: 2370 http://amis.svn.sourceforge.net/amis/?rev=2370&view=rev Author: daniel_weck Date: 2008-03-02 15:02:59 -0800 (Sun, 02 Mar 2008) Log Message: ----------- - Changed audio backend (removed AmisAudio.cpp middle-man, now direct access to dx_audio_player, for easier debugging and maintenance). The DirectShow backend is now synchronized using a critical section, which slows down the menu but avoids corruption of the state of the player. One thing has not changed: each audio clip playback require a full graph building, and it's the same for book playback via ambulant. It's definitely not ideal in terms of performance (especially given that each UI prompt also requires a watching thread for getting END events). - Removed the obsolete AudioPrompt.h/cpp Modified Paths: -------------- branches/amis3/AmisAudio/AmisAudio.vcproj branches/amis3/AmisAudio/include/directshow/dx_audio_player.h branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp branches/amis3/AmisCore/include/Media.h branches/amis3/AmisCore/src/Media.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp Removed Paths: ------------- branches/amis3/AmisAudio/include/AmisAudio.h branches/amis3/AmisAudio/include/StdAfx.h branches/amis3/AmisAudio/src/AmisAudio.cpp branches/amis3/AmisAudio/src/StdAfx.cpp branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioPrompt.h branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioPrompt.cpp Modified: branches/amis3/AmisAudio/AmisAudio.vcproj =================================================================== --- branches/amis3/AmisAudio/AmisAudio.vcproj 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisAudio/AmisAudio.vcproj 2008-03-02 23:02:59 UTC (rev 2370) @@ -152,12 +152,6 @@ <Filter Name="include" Filter=""> - <File - RelativePath=".\include\AmisAudio.h"> - </File> - <File - RelativePath=".\include\StdAfx.h"> - </File> <Filter Name="directshow" Filter=""> @@ -194,12 +188,6 @@ <Filter Name="src" Filter=""> - <File - RelativePath=".\src\AmisAudio.cpp"> - </File> - <File - RelativePath=".\src\StdAfx.cpp"> - </File> <Filter Name="directshow" Filter=""> Deleted: branches/amis3/AmisAudio/include/AmisAudio.h =================================================================== --- branches/amis3/AmisAudio/include/AmisAudio.h 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisAudio/include/AmisAudio.h 2008-03-02 23:02:59 UTC (rev 2370) @@ -1,100 +0,0 @@ -/* -AMIS: Adaptive Multimedia Information System -Software for playing DAISY books -Homepage: http://amis.sf.net - -Copyright (C) 2004-2007 DAISY for All Project - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef AMISAUDIO_H -#define AMISAUDIO_H -/** The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the AMISAUDIO_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// AMISAUDIO_API functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -*/ - -//#undef AMISAUDIO_EXPORTS - -#ifdef AMISAUDIO_EXPORTS -#define AMISAUDIO_API __declspec(dllexport) -#else -#define AMISAUDIO_API -#endif - -#include "directshow/dx_audio_player.h" -#include "mffmTimeCode/smilTimeCode.H" - -#if _DEBUG -//#include <vld.h> -#endif - -#ifdef _MSC_VER -#pragma warning(disable : 4251) -#endif - -#pragma warning(disable : 4786) - -typedef void (*sendMessageCallbackFn)(void); - -namespace amis -{ - namespace audio - { - class AMISAUDIO_API AmisAudio - { - protected: - AmisAudio(); - - public: - static AmisAudio* Instance(); - ~AmisAudio (); - static void DestroyInstance(); - - void play(const char * url,char* clipBegin,char* clipEnd); - void pause(); - void resume(); - void stopX(); - - bool isPlaying(); - - double getVolume(); - void setVolume (double); - - void adjustVolume(double); - void adjustRate(double); - - double getRate(); - void setRate(double); - - 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; - - }; - } -} - -#endif \ No newline at end of file Deleted: branches/amis3/AmisAudio/include/StdAfx.h =================================================================== --- branches/amis3/AmisAudio/include/StdAfx.h 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisAudio/include/StdAfx.h 2008-03-02 23:02:59 UTC (rev 2370) @@ -1,113 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__AE5780CC_1107_4F64_ADC7_F4BACF658CC2__INCLUDED_) -#define AFX_STDAFX_H__AE5780CC_1107_4F64_ADC7_F4BACF658CC2__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -/* -#ifndef _AFX_NOFORCE_LIBS - -///////////////////////////////////////////////////////////////////////////// -// Win32 libraries - -#ifndef _AFXDLL - #ifndef _UNICODE - #ifdef _DEBUG - #pragma comment(lib, "nafxcwd.lib") - #else - #pragma comment(lib, "nafxcw.lib") - #endif - #else - #ifdef _DEBUG - #pragma comment(lib, "uafxcwd.lib") - #else - #pragma comment(lib, "uafxcw.lib") - #endif - #endif -#else - #ifndef _UNICODE - #ifdef _DEBUG - #pragma comment(lib, "mfc71d.lib") - #pragma comment(lib, "mfcs71d.lib") - #else - #pragma comment(lib, "mfc71.lib") - #pragma comment(lib, "mfcs71.lib") - #endif - #else - #ifdef _DEBUG - #pragma comment(lib, "mfc71ud.lib") - #pragma comment(lib, "mfcs71ud.lib") - #else - #pragma comment(lib, "mfc71u.lib") - #pragma comment(lib, "mfcs71u.lib") - #endif - #endif -#endif - -#ifdef _DLL - #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG) - #pragma comment(lib, "msvcrtd.lib") - #else - #pragma comment(lib, "msvcrt.lib") - #endif -#else -#ifdef _MT - #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG) - #pragma comment(lib, "libcmtd.lib") - #else - #pragma comment(lib, "libcmt.lib") - #endif -#else - #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG) - #pragma comment(lib, "libcd.lib") - #else - #pragma comment(lib, "libc.lib") - #endif -#endif -#endif - -#pragma comment(lib, "kernel32.lib") -#pragma comment(lib, "user32.lib") -#pragma comment(lib, "gdi32.lib") -#pragma comment(lib, "msimg32.lib") -#pragma comment(lib, "comdlg32.lib") -#pragma comment(lib, "winspool.lib") -#pragma comment(lib, "advapi32.lib") -#pragma comment(lib, "shell32.lib") -#pragma comment(lib, "comctl32.lib") -#pragma comment(lib, "shlwapi.lib") - -// force inclusion of NOLIB.OBJ for /disallowlib directives -#pragma comment(linker, "/include:__afxForceEXCLUDE") - -// force inclusion of DLLMODUL.OBJ for _USRDLL -#ifdef _USRDLL -#pragma comment(linker, "/include:__afxForceUSRDLL") -#endif - -// force inclusion of STDAFX.OBJ for precompiled types -#ifdef _AFXDLL -#pragma comment(linker, "/include:__afxForceSTDAFX") -#endif - -#endif //!_AFX_NOFORCE_LIBS - -*/ - -// Insert your headers here -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include <windows.h> - -// reference additional headers your program requires here - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__AE5780CC_1107_4F64_ADC7_F4BACF658CC2__INCLUDED_) Modified: branches/amis3/AmisAudio/include/directshow/dx_audio_player.h =================================================================== --- branches/amis3/AmisAudio/include/directshow/dx_audio_player.h 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisAudio/include/directshow/dx_audio_player.h 2008-03-02 23:02:59 UTC (rev 2370) @@ -26,6 +26,12 @@ #ifndef AMBULANT_GUI_DX_AUDIO_PLAYERX_H #define AMBULANT_GUI_DX_AUDIO_PLAYERX_H +#ifdef AMISAUDIO_EXPORTS +#define AMISAUDIO_API __declspec(dllexport) +#else +#define AMISAUDIO_API +#endif + //#include "ambulant/config/config.h" #include <string> @@ -129,18 +135,22 @@ namespace dx { -class audio_playerX { +class AMISAUDIO_API audio_playerX { typedef std::pair<bool, double> duration; - + public: - void setCallback(sendMessageCallbackFn pFunction); + + audio_playerX(); + void setCallback(sendMessageCallbackFn pFunction); - audio_playerX(const char * url); + static audio_playerX* Instance(); + static void DestroyInstance(); + ~audio_playerX(); void start(double t); - void stop(); + void stop(bool fromPlay, bool fromThread=false); //void pause(common::pause_display d=common::display_show); void pause(void); void resume(); @@ -162,12 +172,12 @@ // 0 sets a neutral balance // and 10 sets -10 db to right and -90 db to left void set_balance(long val); + bool play(const char * url); private: void end_thread(); - bool open(const char * url); void release_player(); std::string m_url; @@ -182,12 +192,17 @@ public: IMediaEvent *m_media_event; sendMessageCallbackFn sendMessageCallback; - bool bCatchEvents; - bool bProcessEvents; +private: + + CRITICAL_SECTION m_csSequence; + static audio_playerX* pinstance; + #ifdef WITH_TPB_AUDIO_SPEEDUP public: void set_rate(double rate); + double get_rate(); + private: IVuppInterface *m_audio_speedup; void initialize_speedup_filter(); Deleted: branches/amis3/AmisAudio/src/AmisAudio.cpp =================================================================== --- branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -1,275 +0,0 @@ -/* -AMIS: Adaptive Multimedia Information System -Software for playing DAISY books -Homepage: http://amis.sf.net - -Copyright (C) 2004-2007 DAISY for All Project - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdlib.h> -#include <iostream> -#include <string> -#include <process.h> - -#include "AmisAudio.h" - -using namespace amis::audio; - -#ifdef AMISAUDIO_EXPORTS -BOOL APIENTRY DllMain( HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} -#endif - -static void audioFinishedCallback() -{ - AmisAudio::Instance()->PlayerEndCallback(); -} - -namespace amis -{ - namespace audio - { - - /* - void AmisAudio::play(ambulant::net::url url,char* clipBegin,char* clipEnd) - { - std::string str; - str.assign(url.get_file().c_str()); - - ambulant::net::url tmpurl = ambulant::net::url::from_url(urlOrFile); - assert(tmpurl.is_local_file()); - std::string tmpfile = tmpurl.get_file(); - thisUrl = ambulant::net::url::from_filename(tmpfile); - - ambulantX::gui::dx::audio_playerX *m_player; - if(url.is_local_file()) { // && lib::win32::file_exists(url.get_file())) - m_player = new ambulantX::gui::dx::audio_playerX(str); - int a =1; - } - else if(url.is_absolute()) { - m_player = new ambulantX::gui::dx::audio_playerX(url.get_url()); - } - else { - return; - } - */ - 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(); - - if (begin!=0){ - int q =1; - } - if (end!=0){ - int q =1; - } - - //double level = m_player->get_global_level(); - double level = 1.0; - m_player->set_volume((long)(level*100)); - - double dur = m_player->get_dur().second; - if (end <= 0 || end > dur) - m_player->endseek(dur); - else - m_player->endseek(end); - - m_player->setCallback((sendMessageCallbackFn)audioFinishedCallback); - - m_player->start(begin); - } - - AmisAudio* AmisAudio::pinstance = 0; - - AmisAudio* AmisAudio::Instance() - { - if (pinstance == 0) // is it the first call? - { - pinstance = new AmisAudio; // create sole instance - } - return pinstance; // address of sole instance - } - - - 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((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 - } - m_player = 0; - } - - void AmisAudio::DestroyInstance() - { - if (pinstance) delete pinstance; - } - - bool AmisAudio::isPlaying() - { - if (m_player) { - return m_player->is_playing(); - } else { - return false; - } - } - - void AmisAudio::pause() - { - if (m_player) { - m_player->pause(); - } - } - - void AmisAudio::resume() - { - if (m_player) { - m_player->resume(); - } - } - void AmisAudio::stopX() - { - if (m_player) { - delete m_player; // stop() and release_player() handled by destructor - } - m_player = 0; - } - - double AmisAudio::getVolume() - { - if (m_player) { - //return m_player->get_volume(); TODO: implement this - return 100.0; - } else { - return 100.0; - } - } - - void AmisAudio::setVolume(double value) - { - if (m_player) { - m_player->set_volume(value); - } - } - - void AmisAudio::adjustVolume(double adjustment) - { - if (m_player) { - m_player->set_volume(adjustment); // TODO this won't work ! - } - } - - - void AmisAudio::adjustRate(double adjustment) - { - if (m_player) { - m_player->set_rate(adjustment); // TODO this won't work ! - } - } - - double AmisAudio::getRate() - { - if (m_player) { - //return m_player->get_rate(); TODO: Implement this - return 1.0; - } else { - return 1.0; - } - } - - void AmisAudio::setRate(double value){ - if (m_player) { - m_player->set_rate(value); - } - } - } -} \ No newline at end of file Deleted: branches/amis3/AmisAudio/src/StdAfx.cpp =================================================================== --- branches/amis3/AmisAudio/src/StdAfx.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisAudio/src/StdAfx.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// AmisAudio.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// reference any additional headers you need in STDAFX.H -// and not in this file Modified: branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp =================================================================== --- branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -18,8 +18,8 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /* - * @$Id: dx_audio_player.cpp,v 1.22 2008/01/15 10:55:59 jackjansen Exp $ - */ +* @$Id: dx_audio_player.cpp,v 1.22 2008/01/15 10:55:59 jackjansen Exp $ +*/ #ifndef __AFXWIN_H__ #include <afxwin.h> @@ -40,6 +40,24 @@ using namespace ambulantX; +#ifdef AMISAUDIO_EXPORTS +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} +#endif + //using ambulant::lib::win32::win_report_error; //using ambulant::lib::win32::win_trace_error; //using ambulant::lib::logger; @@ -64,17 +82,20 @@ gui::dx::audio_playerX *pPlayer = (gui::dx::audio_playerX*)lpParam; - while((pPlayer->bCatchEvents) && (!bSelfBreak)) { - + while(!bSelfBreak) { hResult = E_FAIL; hResult = pPlayer->m_media_event->GetEvent(&lEventCode, &lParam1, &lParam2, INFINITE); pPlayer->m_media_event->FreeEventParams(lEventCode, lParam1, lParam2); - if ((hResult == S_OK) && (pPlayer->bProcessEvents)) { + if (hResult == S_OK) { switch(lEventCode) { case EC_COMPLETE: + pPlayer->stop(false, true); pPlayer->sendMessageCallback(); + bSelfBreak = true; break; case EC_USER + 4: + //pPlayer->stop(false, true); + pPlayer->sendMessageCallback(); bSelfBreak = true; break; } @@ -84,61 +105,143 @@ return 0; } -gui::dx::audio_playerX::audio_playerX(const char * url) + +gui::dx::audio_playerX::audio_playerX() : - //m_url(url), - m_graph_builder(0), - m_media_control(0), - m_media_position(0), - m_media_event(0), +//m_url(url), +m_graph_builder(0), +m_media_control(0), +m_media_position(0), +m_media_event(0), #ifdef WITH_TPB_AUDIO_SPEEDUP - m_audio_speedup(0), +m_audio_speedup(0), #endif - m_basic_audio(0), - hEventHandler(0), - bProcessEvents(false), - bCatchEvents(false) { +m_basic_audio(0), +hEventHandler(0) +{ + set_rate(1.7); + InitializeCriticalSection(&m_csSequence); +} - open(url); +gui::dx::audio_playerX::~audio_playerX() +{ + stop(false); + DeleteCriticalSection(&m_csSequence); + int q = 0; } - -gui::dx::audio_playerX::~audio_playerX() { - stop(); + +gui::dx::audio_playerX* gui::dx::audio_playerX::pinstance = 0; + +gui::dx::audio_playerX* gui::dx::audio_playerX::Instance() +{ + if (pinstance == 0) // is it the first call? + { + pinstance = new gui::dx::audio_playerX(); // create sole instance + } + return pinstance; // address of sole instance } - +void gui::dx::audio_playerX::DestroyInstance() +{ + if (pinstance) delete pinstance; +} + + void gui::dx::audio_playerX::start(double t) { if(is_playing()) pause(); seek(t); resume(); } -void gui::dx::audio_playerX::stop() { - if(m_media_control == 0) return; +void gui::dx::audio_playerX::end_thread() { + if (hEventHandler==NULL) return; - end_thread(); + IMediaEventSink *pIMES = NULL; + m_graph_builder->QueryInterface(IID_IMediaEventSink, (void**) &pIMES); + pIMES->Notify(EC_USER + 4, 0, 0); + pIMES->Release(); + pIMES = NULL; - bProcessEvents = false; - HRESULT hr = m_media_control->Stop(); - if(FAILED(hr)) { - win_report_error("IMediaControl::stop()", hr); + if (WaitForSingleObject(hEventHandler, INFINITE) != WAIT_OBJECT_0) { + int a = 3; } - - if (m_media_control->StopWhenReady() != S_OK) { - long state, i; + hEventHandler = NULL; +} - for (i = 0; i < 100; i++) { - m_media_control->GetState(10, &state); - if (state == State_Stopped) break; +void gui::dx::audio_playerX::release_player() { + + if(m_graph_builder) { + + if(m_media_event) { + m_media_event->Release(); + m_media_event = 0; } - - if (i == 100) { - bProcessEvents = true; + if(m_media_position) { + m_media_position->Release(); + m_media_position = 0; } + if(m_media_control) { + m_media_control->Release(); + m_media_control = 0; + } + if(m_basic_audio) { + m_basic_audio->Release(); + m_basic_audio = 0; + } +#ifdef WITH_TPB_AUDIO_SPEEDUP + if(m_audio_speedup) { + m_audio_speedup->Release(); + m_audio_speedup = 0; + } +#endif + m_graph_builder->Release(); + m_graph_builder = 0; } - release_player(); } -//void gui::dx::audio_playerX::pause(common::pause_display d) { +void gui::dx::audio_playerX::stop(bool fromPlay, bool fromThread) { + + + { + if (!fromPlay) { + EnterCriticalSection(&m_csSequence); + } + if(m_media_control == 0) { + LeaveCriticalSection(&m_csSequence); + return; + } + + if (!fromThread) { + end_thread(); + } else { + hEventHandler = NULL; + } + + if (!fromThread) { + 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) { + int debug = 0; + } + } + } + release_player(); + if (!fromPlay) { + LeaveCriticalSection(&m_csSequence); + } + } +} + void gui::dx::audio_playerX::pause(void) { if(m_media_control == 0) return; HRESULT hr = m_media_control->Pause(); @@ -195,27 +298,39 @@ } bool gui::dx::audio_playerX::is_playing() { - - if(m_media_control == 0) return false; + EnterCriticalSection(&m_csSequence); + + if(m_media_control == 0) { + LeaveCriticalSection(&m_csSequence);return false;} + long msTimeout = 0; long state; m_media_control->GetState(msTimeout, &state); + + LeaveCriticalSection(&m_csSequence); + return (state == State_Running); - if(m_media_event == 0) return false; + /* + if(m_media_event == 0) { + LeaveCriticalSection(&m_csSequence);return false;} + long evCode = 0; HRESULT hr = m_media_event->WaitForCompletion(msTimeout, &evCode); if(hr == E_ABORT) return true; else if(hr == S_OK) return false; else if(FAILED(hr)) { - // XXXJack: this error occurs all the time... - if (hr == 0x80040227) return false; - win_trace_error("IMediaEvent::WaitForCompletion()", hr); - return false; + // XXXJack: this error occurs all the time... + if (hr == 0x80040227) return false; + win_trace_error("IMediaEvent::WaitForCompletion()", hr); + return false; } + + LeaveCriticalSection(&m_csSequence); return evCode == 0; + */ } #if 0 @@ -234,136 +349,8 @@ } #endif -////////////////////////// - -bool gui::dx::audio_playerX::open(const char * url) { - //m_url = url; - m_url.assign(url); - HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - if (hr == S_FALSE) CoUninitialize(); - _ASSERT(hr == S_FALSE); - - hr = CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER, - IID_IGraphBuilder,(void**)&m_graph_builder); - if(FAILED(hr)) { - win_report_error("CoCreateInstance(CLSID_FilterGraph, ...)", hr); - return false; - } - - //WCHAR wsz[MAX_PATH]; - //MultiByteToWideChar(CP_ACP,0, url.c_str(), -1, wsz, MAX_PATH); - - std::string strFileName; - strFileName.assign(url); - - USES_CONVERSION; - LPCWSTR str = A2CW(strFileName.c_str()); - - 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()); - else if (hr == VFW_E_CANNOT_CONNECT) - errorX("%s: Unsupported video format", url.c_str()); - else - errorX("%s: DirectX error 0x%x", url.c_str(), hr); - */ - return false; - } #ifdef WITH_TPB_AUDIO_SPEEDUP - initialize_speedup_filter(); -#endif - - hr = m_graph_builder->QueryInterface(IID_IMediaControl, (void **) &m_media_control); - if(FAILED(hr)) { - win_report_error("QueryInterface(IID_IMediaControl, ...)", hr); - return false; - } - m_graph_builder->QueryInterface(IID_IMediaPosition, (void **) &m_media_position); - if(FAILED(hr)) { - win_report_error("QueryInterface(IID_IMediaPosition, ...)", hr); - return false; - } - m_graph_builder->QueryInterface(IID_IMediaEvent, (void **) &m_media_event); - if(FAILED(hr)) { - win_report_error("QueryInterface(IID_IMediaEvent, ...)", hr); - return false; - } - - m_graph_builder->QueryInterface(IID_IBasicAudio, (void **) &m_basic_audio); - if(FAILED(hr)) { - win_report_error("QueryInterface(IID_IBasicAudio, ...)", hr); - } - - hEventHandler = NULL; - bCatchEvents = true; - bProcessEvents = true; - - unsigned long lpdwThreadID; - hEventHandler = CreateThread(NULL, 0, eventHandler, this, 0, &lpdwThreadID); - - return true; -} - - -void gui::dx::audio_playerX::end_thread() { - - - if (hEventHandler==NULL) return; - - bCatchEvents = true; - bProcessEvents = true; - - IMediaEventSink *pIMES = NULL; - m_graph_builder->QueryInterface(IID_IMediaEventSink, (void**) &pIMES); - pIMES->Notify(EC_USER + 4, 0, 0); - pIMES->Release(); - pIMES = NULL; - - if (WaitForSingleObject(hEventHandler, INFINITE) != WAIT_OBJECT_0) { - 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; - } - if(m_media_position) { - m_media_position->Release(); - m_media_position = 0; - } - if(m_media_control) { - m_media_control->Release(); - m_media_control = 0; - } - if(m_basic_audio) { - m_basic_audio->Release(); - m_basic_audio = 0; - } -#ifdef WITH_TPB_AUDIO_SPEEDUP - if(m_audio_speedup) { - m_audio_speedup->Release(); - m_audio_speedup = 0; - } -#endif - m_graph_builder->Release(); - m_graph_builder = 0; - } - -} - -#ifdef WITH_TPB_AUDIO_SPEEDUP void gui::dx::audio_playerX::initialize_speedup_filter() { if (speedup_filter_available_valid && !speedup_filter_available) { // We don't seem to have the filter. Too bad. @@ -374,11 +361,12 @@ IBaseFilter *pNewFilter = NULL; + +#ifdef _DEBUG HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == S_FALSE) CoUninitialize(); _ASSERT(hr == S_FALSE); - - +#endif HRESULT res; res = CoCreateInstance(CLSID_TPBVupp69, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pNewFilter); @@ -397,7 +385,7 @@ } speedup_filter_available = true; speedup_filter_available_valid = true; -// AM_DBG lib::debugX("dx_audio_player: added speedup filter to graph"); + // AM_DBG lib::debugX("dx_audio_player: added speedup filter to graph"); // Next step: find out where we want to add the filter to the graph. // We iterate over the filter graph, then for each item in the graph @@ -433,28 +421,28 @@ res = pCurPin->QueryDirection(&curPinDir); HRESULT res2 = pCurPin->ConnectionMediaType(&mediaType); if (res == S_OK && - res2 == S_OK && - curPinDir == PINDIR_OUTPUT && - mediaType.majortype == MEDIATYPE_Audio&& - mediaType.subtype == MEDIASUBTYPE_PCM){ - pOutputPin = pCurPin; - res = pOutputPin->ConnectedTo(&pInputPin); - if (res != S_OK) { - // This output pin was the correct type, but not connected. - // So it cannot be the one we're looking for. - pOutputPin = pInputPin = NULL; - } else { - // Found it! - pOutputPin->AddRef(); - pInputPin->AddRef(); + res2 == S_OK && + curPinDir == PINDIR_OUTPUT && + mediaType.majortype == MEDIATYPE_Audio&& + mediaType.subtype == MEDIASUBTYPE_PCM){ + pOutputPin = pCurPin; + res = pOutputPin->ConnectedTo(&pInputPin); + if (res != S_OK) { + // This output pin was the correct type, but not connected. + // So it cannot be the one we're looking for. + pOutputPin = pInputPin = NULL; + } else { + // Found it! + pOutputPin->AddRef(); + pInputPin->AddRef(); + } } - } - if (res2 == S_OK) { - if (mediaType.cbFormat != 0) { - CoTaskMemFree((PVOID)mediaType.pbFormat); + if (res2 == S_OK) { + if (mediaType.cbFormat != 0) { + CoTaskMemFree((PVOID)mediaType.pbFormat); + } } - } - pCurPin->Release(); + pCurPin->Release(); } if (res != S_FALSE && res != S_OK) traceX("dx_audio_filter: enumerating pins: error 0x%x", res); @@ -547,6 +535,9 @@ } +double gui::dx::audio_playerX::get_rate() { + return s_current_playback_rate; +} void gui::dx::audio_playerX::set_rate(double rate) { s_current_playback_rate = rate; if (m_audio_speedup) { @@ -565,7 +556,7 @@ long cdb = (long)(20.0*log10((double)val/100.0)*100); m_basic_audio->put_Volume(cdb); } - + // can be -100 to 100 // 0 sets a neutral balance // and 10 sets -10 db to right and -90 db to left @@ -582,3 +573,119 @@ { sendMessageCallback=pFunction; } + + +////////////////////////// + +bool gui::dx::audio_playerX::play(const char * url) { + + + EnterCriticalSection(&m_csSequence); + + //m_url = url; + m_url.assign(url); + + if (m_graph_builder != NULL) { + stop(true); + } + +#ifdef _DEBUG + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (hr == S_FALSE) CoUninitialize(); + _ASSERT(hr == S_FALSE); +#endif + + if (m_graph_builder == NULL) { + hr = CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER, + IID_IGraphBuilder,(void**)&m_graph_builder); + if(FAILED(hr)) { + win_report_error("CoCreateInstance(CLSID_FilterGraph, ...)", hr); + + LeaveCriticalSection(&m_csSequence); + return false; + } + } else { + int i = 0; + } + + //WCHAR wsz[MAX_PATH]; + //MultiByteToWideChar(CP_ACP,0, url.c_str(), -1, wsz, MAX_PATH); + + std::string strFileName; + strFileName.assign(url); + + USES_CONVERSION; + LPCWSTR str = A2CW(strFileName.c_str()); + + 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()); + else if (hr == VFW_E_CANNOT_CONNECT) + errorX("%s: Unsupported video format", url.c_str()); + else + errorX("%s: DirectX error 0x%x", url.c_str(), hr); + */ + + LeaveCriticalSection(&m_csSequence); + return false; + } +#ifdef WITH_TPB_AUDIO_SPEEDUP + initialize_speedup_filter(); +#endif + + if (m_media_control == NULL) { + hr = m_graph_builder->QueryInterface(IID_IMediaControl, (void **) &m_media_control); + if(FAILED(hr)) { + win_report_error("QueryInterface(IID_IMediaControl, ...)", hr); + + LeaveCriticalSection(&m_csSequence); + return false; + } + } + + if (m_media_position == NULL) { + m_graph_builder->QueryInterface(IID_IMediaPosition, (void **) &m_media_position); + if(FAILED(hr)) { + win_report_error("QueryInterface(IID_IMediaPosition, ...)", hr); + + LeaveCriticalSection(&m_csSequence); + return false; + } + } + + if (m_media_event == NULL) { + m_graph_builder->QueryInterface(IID_IMediaEvent, (void **) &m_media_event); + if(FAILED(hr)) { + win_report_error("QueryInterface(IID_IMediaEvent, ...)", hr); + + LeaveCriticalSection(&m_csSequence); + return false; + } + } + + if (m_basic_audio == NULL) { + m_graph_builder->QueryInterface(IID_IBasicAudio, (void **) &m_basic_audio); + if(FAILED(hr)) { + win_report_error("QueryInterface(IID_IBasicAudio, ...)", hr); + } + } + + if (hEventHandler == NULL) { + unsigned long lpdwThreadID; + hEventHandler = CreateThread(NULL, 0, eventHandler, this, 0, &lpdwThreadID); + } + + hr = m_media_control->Run(); + if(FAILED(hr)) { + win_report_error("IMediaControl::run()", hr); + } + + + LeaveCriticalSection(&m_csSequence); + return true; +} + Modified: branches/amis3/AmisCore/include/Media.h =================================================================== --- branches/amis3/AmisCore/include/Media.h 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisCore/include/Media.h 2008-03-02 23:02:59 UTC (rev 2370) @@ -63,6 +63,9 @@ string getSrc(); void setSrc(string); + string getSrcExpanded(); + void setSrcExpanded(string); + string getHref(); void setHref(string); @@ -77,6 +80,7 @@ private: string mId; string mSrc; + string mSrcExpanded; string mHref; string mLangCode; MediaNodeType mMediaNodeType; Modified: branches/amis3/AmisCore/src/Media.cpp =================================================================== --- branches/amis3/AmisCore/src/Media.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisCore/src/Media.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -32,6 +32,7 @@ { mId = ""; mSrc = ""; + mSrcExpanded=""; mHref = ""; mLangCode = ""; } @@ -42,6 +43,8 @@ mId.erase(); mSrc.clear(); mSrc.erase(); + mSrcExpanded.clear(); + mSrcExpanded.erase(); mHref.clear(); mHref.erase(); mLangCode.clear(); @@ -55,6 +58,7 @@ p_new->setLangCode(this->getLangCode()); p_new->setMediaNodeType(this->getMediaNodeType()); p_new->setSrc(this->getSrc()); + p_new->setSrcExpanded(this->getSrcExpanded()); } void amis::MediaNode::setId(string id) { @@ -66,6 +70,11 @@ mSrc.assign(src); } +void amis::MediaNode::setSrcExpanded(string src) +{ + mSrcExpanded.assign(src); +} + void amis::MediaNode::setHref(string href) { mHref.assign(href); @@ -86,6 +95,11 @@ return mSrc; } +string amis::MediaNode::getSrcExpanded() +{ + return mSrcExpanded; +} + string amis::MediaNode::getHref() { return mHref; Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 23:02:59 UTC (rev 2370) @@ -292,9 +292,6 @@ Name="self-voicing" Filter=""> <File - RelativePath=".\include\gui\self-voicing\AudioPrompt.h"> - </File> - <File RelativePath=".\include\gui\self-voicing\AudioSequence.h"> </File> <File @@ -764,21 +761,6 @@ Name="self-voicing" Filter=""> <File - RelativePath=".\src\gui\self-voicing\AudioPrompt.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> - <File RelativePath=".\src\gui\self-voicing\AudioSequence.cpp"> <FileConfiguration Name="Debug|Win32"> Deleted: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioPrompt.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioPrompt.h 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioPrompt.h 2008-03-02 23:02:59 UTC (rev 2370) @@ -1,103 +0,0 @@ -#ifndef AUDIOPROMPT_H -#define AUDIOPROMPT_H - -#include <string> - -#include "Media.h" - -//!prompt variable structure -/*! - A variable has three properties, a name, a source function, and - a runtime value, like "yellow" or "c:\file" -*/ - -namespace amis -{ -namespace gui -{ -namespace spoken -{ - -class AudioPromptComponent -{ -public: - AudioPromptComponent(); - ~AudioPromptComponent(); - //!is this a variable? - bool mbIsVar; - //!name of the variable - std::string mVarName; - //!value of the variable as given by the source function - std::wstring mRuntimeValue; - //!a media object (if it's not a variable) - amis::MediaNode* mpMedia; - // Text alternative to the audio clip: can be used for TTS or braille. - std::wstring mTextAlternative; - - -}; - -//! prompt structure -/*! - a prompt has a name (like "dialog_intro"), a list of variables (described above), - and a sequence of items to be played. - \n\n - it could also just reference a single audio clip. -*/ -class AudioPrompt -{ -public: - AudioPrompt(); - ~AudioPrompt(); - - //!name of the prompt - std::string mName; - - int mStringResourceID; - - //!list of all actions - vector<AudioPromptComponent*> mSequence; - -}; - -//collection of audio prompts -class AudioPromptCol -{ -protected: - AudioPromptCol(); - -public: - static AudioPromptCol* Instance(); - void DestroyInstance(); - ~AudioPromptCol(); - - //!return a prompt based on its name - AudioPrompt* getPrompt(string); - - //!add a prompt to the collection - void addPrompt(AudioPrompt*); - - //!clear the collection - void clearAll(); - -public: - //!the source file path for the audio prompts XML file - std::string mFilePath; - -private: - //!clean up the collection of prompts - void cleanUpVector(); - - -private: - //!the collection of prompts - vector<AudioPrompt*> mPrompts; - -private: - static AudioPromptCol* pinstance; - - -}; -}}} - -#endif \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -53,7 +53,7 @@ #include "gui/dialogs/PreferencesDialog.h" #include "gui/dialogs/PublicationSummaryDialog.h" -#include "AmisAudio.h" +#include "directshow/dx_audio_player.h" //using namespace amis::audio; @@ -226,11 +226,9 @@ amis::gui::MenuManip::Instance()->DestroyInstance(); amis::gui::MainWndParts::Instance()->DestroyInstance(); - if (AudioSequencePlayer::InstanceExists()) { AudioSequencePlayer::Instance()->DestroyInstance(); } - DataTree::Instance()->DestroyInstance(); @@ -301,10 +299,10 @@ //test print to an output file //p_new_data_tree->testPrint("c:\\devel\\amis\\Langpacks\\sandbox\\dataout.txt"); - AudioSequence* seq = new AudioSequence; + /*AudioSequence* seq = new AudioSequence; seq->append(L"AMIS"); seq = AudioSequencePlayer::playPromptFromStringId("canceled", false, seq); - AudioSequencePlayer::Instance()->Play(seq); + AudioSequencePlayer::Instance()->Play(seq);*/ } //if the UI file could not be read, then disable self-voicing @@ -529,7 +527,6 @@ void CAmisApp::OnSpeedUp() { amis::util::Log::Instance()->writeMessage("Speed increase", "CAmisApp::OnSpeedUp", "AmisGuiMFC2"); - amis::audio::AmisAudio::Instance()->adjustRate(1.12); long currentRate = amis::tts::TTSPlayer::Instance()->GetSpeechRate(); amis::tts::TTSPlayer::Instance()->SetSpeechRate(currentRate+2); @@ -543,7 +540,6 @@ void CAmisApp::OnSpeedDown() { amis::util::Log::Instance()->writeMessage("Speed decrease", "CAmisApp::OnSpeedDown", "AmisGuiMFC2"); - amis::audio::AmisAudio::Instance()->adjustRate(-1.12); long currentRate = amis::tts::TTSPlayer::Instance()->GetSpeechRate(); amis::tts::TTSPlayer::Instance()->SetSpeechRate(currentRate-2); @@ -557,11 +553,9 @@ void CAmisApp::OnSpeedNormal() { amis::util::Log::Instance()->writeMessage("Speed reset to normal", "CAmisApp::OnSpeedNormal", "AmisGuiMFC2"); - amis::audio::AmisAudio::Instance()->setRate(1.0); amis::tts::TTSPlayer::Instance()->SetSpeechRate(0); - //TODO: this only works with my local hacked Ambulant API (addition of this setXX() function) ambulant::gui::dx::set_global_rate(1.0); //amis::gui::spoken::AudioSequencePlayer::Instance()->playPromptFromUiId(ID_MENU_PLAY_NORMALSPEED, true, NULL); Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -27,7 +27,7 @@ #include "Preferences.h" #include "DtbWithHooks.h" -#include "AmisAudio.h" +#include "directshow/dx_audio_player.h" #include "io/BookmarksFileIO.h" #include "io/ToolbarIO.h" @@ -41,7 +41,6 @@ static char THIS_FILE[] = __FILE__; #endif -using namespace amis::audio; using namespace amis::gui; @@ -306,43 +305,6 @@ tmpstr = A2T(prompt.c_str()); dbg.Format(_T("\tPrompt for this popup 1 = --%s-- \n"), tmpstr); //DAN_MENU_DEBUG TRACE(dbg); - - - - //if this is the view menu, set the sidebar checkmark appropriately - if (prompt.compare("view") == 0) - { - //is sidebar visible? - if (MainWndParts::Instance()->mpSidebar->IsVisible() == TRUE) - { - //pPopupMenu->CheckMenuItem(0, MF_BYPOSITION | MF_CHECKED); - } - else - { - //pPopupMenu->CheckMenuItem(0, MF_BYPOSITION | MF_UNCHECKED); - } - } - - //TODO should this be the book speed ? - if (prompt.compare("play") == 0) - { - if (AmisAudio::Instance()->getRate() == 1.0) - { - //DanToDo: menu items for slow-down / fast-up - //MenuManip::Instance()->setSlowdown(false); - } - else - { - - //DanToDo: menu items for slow-down / fast-up - //MenuManip::Instance()->setSlowdown(true); - } - } - - if (amis::Preferences::Instance()->getIsSelfVoicing() == false) - { - return; - } } void CMainFrame::OnInitMenu(CMenu* pMenu) @@ -510,7 +472,7 @@ } void CMainFrame::OnUpdateCmdUiPlaySlower(CCmdUI* pCmdUi) { - if (theApp.isBookOpen() && amis::audio::AmisAudio::Instance()->getRate() > 1) + if (theApp.isBookOpen() && ambulantX::gui::dx::audio_playerX::Instance()->get_rate() > 1) pCmdUi->Enable(true); else pCmdUi->Enable(false); Deleted: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioPrompt.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioPrompt.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioPrompt.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -1,139 +0,0 @@ -#include "gui/self-voicing/AudioPrompt.h" - -using namespace amis::gui::spoken; - -//************ -// audio prompt component -//************* -AudioPromptComponent::AudioPromptComponent() -{ - mpMedia = NULL; -} - -AudioPromptComponent::~AudioPromptComponent() -{ - if (mpMedia != NULL) - { - delete mpMedia; - } - - this->mRuntimeValue.clear(); - this->mTextAlternative.clear(); - this->mRuntimeValue.clear(); -} - - - -//************ -// audio prompt -//************* -AudioPrompt::AudioPrompt() -{ - mStringResourceID = -1; -} - -AudioPrompt::~AudioPrompt() -{ - int sz_seq = mSequence.size(); - amis::MediaNode* p_media = NULL; - int i; - - AudioPromptComponent* p_pc = NULL; - - for (i = sz_seq -1; i >=0; i--) - { - p_pc = mSequence[i]; - - mSequence.pop_back(); - - delete p_pc; - } - - this->mName.empty(); - this->mSequence.clear(); -} - -//************ -// audio prompt collection -//************* -AudioPromptCol* AudioPromptCol::pinstance = 0; - -AudioPromptCol* AudioPromptCol::Instance() -{ - if (pinstance == 0) - { - pinstance = new AudioPromptCol; - } - - return pinstance; -} - -void AudioPromptCol::DestroyInstance() -{ - delete pinstance; -} - -AudioPromptCol::AudioPromptCol() -{ -} - -AudioPromptCol::~AudioPromptCol() -{ - cleanUpVector(); - -} - -void AudioPromptCol::clearAll() -{ - cleanUpVector(); -} - -void AudioPromptCol::cleanUpVector() -{ - int sz = mPrompts.size(); - - int i; - - AudioPrompt* p_prompt = NULL; - - for (i = sz -1; i >=0; i--) - { - p_prompt = mPrompts[i]; - - mPrompts.pop_back(); - - delete p_prompt; - - } -} - -void AudioPromptCol::addPrompt(AudioPrompt* pPrompt) -{ - mPrompts.push_back(pPrompt); -} - -AudioPrompt* AudioPromptCol::getPrompt(string promptName) -{ - //search for the macro in the collection - unsigned int i; - bool b_found = false; - - for (i=0; i<mPrompts.size(); i++) - { - if (mPrompts[i]->mName.compare(promptName) == 0) - { - b_found = true; - break; - } - } - - if (b_found == false) - { - return NULL; - } - else - { - return mPrompts[i]; - } - -} \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -8,7 +8,7 @@ #include "util/FilePathTools.h" -#include "AmisAudio.h" +#include "directshow/dx_audio_player.h" #include "Preferences.h" @@ -20,7 +20,6 @@ //#include "ambulant/net/url.h" -using namespace amis::audio; using namespace amis::tts; using namespace amis::gui::spoken; @@ -97,7 +96,7 @@ m_wakeUpOriginator = -1; m_nEndEventsToExpect = 0; - AmisAudio::Instance()->setCallback((sendMessageCallbackFn)clipFinishedCallback); + ambulantX::gui::dx::audio_playerX::Instance()->setCallback((sendMessageCallbackFn)clipFinishedCallback); TTSPlayer::Instance()->setCallback((sendMessageCallbackFn)ttsFinishedCallback); @@ -126,11 +125,10 @@ if (pinstance != NULL) { Stop(); + ambulantX::gui::dx::audio_playerX::Instance()->DestroyInstance(); + TTSPlayer::Instance()->DestroyInstance(); delete pinstance; } - - AmisAudio::Instance()->DestroyInstance(); - TTSPlayer::Instance()->DestroyInstance(); } AudioSequencePlayer::~AudioSequencePlayer(void) @@ -207,11 +205,12 @@ //TTSPlayer::Instance()->WaitUntilDone(); TRACE(L"####### -- STOP TTS"); } - if (AmisAudio::Instance()->isPlaying()) { + + if (ambulantX::gui::dx::audio_playerX::Instance()->is_playing()) { //bExpectEndEventForWakeUp = true; //m_nEndEventsToExpect++; //ResetEvent(pThis->m_hEventWakeup); - AmisAudio::Instance()->stopX(); + ambulantX::gui::dx::audio_playerX::Instance()->stop(false); //m_wakeUpOriginator = 3; // AUDIO CLIP END //SetEvent(m_hEventWakeup); TRACE(L"####### -- STOP AUDIO"); @@ -282,11 +281,11 @@ //TTSPlayer::Instance()->WaitUntilDone(); TRACE(L"####### STOP TTS"); } - if (AmisAudio::Instance()->isPlaying()) { + if (ambulantX::gui::dx::audio_playerX::Instance()->is_playing()) { //bExpectEndEventForWakeUp = true; //m_nEndEventsToExpect++; //ResetEvent(pThis->m_hEventWakeup); - AmisAudio::Instance()->stopX(); + ambulantX::gui::dx::audio_playerX::Instance()->stop(false); //m_wakeUpOriginator = 3; // AUDIO CLIP END //SetEvent(m_hEventWakeup); TRACE(L"####### STOP AUDIO"); @@ -334,11 +333,23 @@ 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 strFull = pAudio->getSrcExpanded(); + if (strFull.length()==0) { + 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()); + + pAudio->setSrcExpanded(audio_src.get_file()); + strFull = pAudio->getSrcExpanded(); + } + + ambulantX::gui::dx::audio_playerX::Instance()->play(strFull.c_str()); + + + /* string clipBegin = ""; string clipEnd = ""; @@ -350,17 +361,9 @@ if (pAudio->getClipEnd().size() > 0) { clipEnd = stringReplaceAll(pAudio->getClipEnd(), "npt=", ""); - } + }*/ - - /* AmisAudio::Instance()->play(audio_src, - (char*)clipBegin.c_str(), - (char*)clipEnd.c_str()); */ - - string src = audio_src.get_file(); - AmisAudio::Instance()->play(src.c_str(), - (char*)clipBegin.c_str(), - (char*)clipEnd.c_str()); + //(char*)clipBegin.c_str(), (char*)clipEnd.c_str()); } unsigned __stdcall AudioSequencePlayer::ThreadProc(void* Arg) @@ -510,7 +513,7 @@ ResetEvent(pThis->m_hEventWakeup); TRACE(L"\n============ PLAY AUDIO CLIP\n"); if (!pThis->m_bAbort) { - /* while (AmisAudio::Instance()->isPlaying()) { + /* while (ambulantX::gui::dx::audio_playerX::Instance()->isPlaying()) { TRACE(L"\nIS PLAYING..."); Sleep(500); } */ Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-02 19:34:07 UTC (rev 2369) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-02 23:02:59 UTC (rev 2370) @@ -175,10 +175,11 @@ { //m_iV(NULL) m_iV = NULL; - +#ifdef _DEBUG HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == S_FALSE) CoUninitialize(); assert(hr == S_FALSE); +#endif hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_INPROC_SERVER, IID_ISpVoice, (void**) &m_iV); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-02 19:38:41
|
Revision: 2369 http://amis.svn.sourceforge.net/amis/?rev=2369&view=rev Author: marisademeglio Date: 2008-03-02 11:34:07 -0800 (Sun, 02 Mar 2008) Log Message: ----------- Fixed a few more memory leaks. Just a couple remain, as far as I can tell: - RecentBooks object in AmisApp doesn't get destroyed properly (why??) - pretranslatemessagehandler has a leak report associated it - AmisAudio::Instance() is listed as being leaky (I don't think AmisAudio gets destroyed) Other leaks are related to ambulant. They seem tiny but unfortunately, a handful of them (data sources, html window) increase as the user navigates. Modified Paths: -------------- branches/amis3/AmisCore/include/RecentBooks.h branches/amis3/AmisCore/src/RecentBooks.cpp branches/amis3/AmisCore/src/dtb/nav/NavContainer.cpp branches/amis3/AmisCore/src/io/RecentBooksFileIO.cpp branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp Modified: branches/amis3/AmisCore/include/RecentBooks.h =================================================================== --- branches/amis3/AmisCore/include/RecentBooks.h 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisCore/include/RecentBooks.h 2008-03-02 19:34:07 UTC (rev 2369) @@ -47,12 +47,8 @@ { public: - //static RecentBooks* Instance(); - //void DestroyInstance(); - RecentBooks(); - ~RecentBooks(); - + ~RecentBooks(); int getNumberOfEntries(); amis::RecentBookEntry* getEntry(unsigned int); void addEntry(amis::RecentBookEntry*); @@ -60,21 +56,13 @@ int getMaxItemsAllowed(); void setMaxItemsAllowed(unsigned int); amis::RecentBookEntry* getLastRead(); - - ambulant::net::url mFilePath; - + const ambulant::net::url* getFilepath(); + void setFilepath(const ambulant::net::url*); private: void cleanUpVector(); - unsigned int mMax; - - //book list entries + ambulant::net::url mFilepath; vector<amis::RecentBookEntry*> mItems; - - - -private: - //static RecentBooks* pinstance; }; } Modified: branches/amis3/AmisCore/src/RecentBooks.cpp =================================================================== --- branches/amis3/AmisCore/src/RecentBooks.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisCore/src/RecentBooks.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -32,23 +32,6 @@ amis::RecentBookEntry::~RecentBookEntry() { } - -/*amis::RecentBooks* amis::RecentBooks::pinstance = 0; - -amis::RecentBooks* amis::RecentBooks::Instance() -{ - if (pinstance == 0) // is it the first call? - { - pinstance = new RecentBooks; // create sole instance - } - return pinstance; // address of sole instance -} - -void amis::RecentBooks::DestroyInstance() -{ - delete pinstance; -} -*/ amis::RecentBooks::RecentBooks() { mMax = 5; @@ -60,15 +43,17 @@ cleanUpVector(); } +//TODO: this doesn't seem to be cleaning things up very well .. I think that's why +//RecentBooksFileIO (where objects are created) has memory leaks void amis::RecentBooks::cleanUpVector() { - int sz = mItems.size() - 1; + int sz = mItems.size(); amis::RecentBookEntry* p_tmp; - for (int i = sz; i>=0; i--) + for (int i = sz-1; i>=0; i--) { - p_tmp = mItems[i]; - mItems.pop_back(); - delete p_tmp; + p_tmp = mItems[i]; + mItems.pop_back(); + if (p_tmp != NULL) delete p_tmp; } } @@ -187,3 +172,13 @@ return p_tmp; } + +void amis::RecentBooks::setFilepath(const ambulant::net::url* pFilepath) +{ + mFilepath = *pFilepath; +} + +const ambulant::net::url* amis::RecentBooks::getFilepath() +{ + return &mFilepath; +} Modified: branches/amis3/AmisCore/src/dtb/nav/NavContainer.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavContainer.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisCore/src/dtb/nav/NavContainer.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -31,7 +31,10 @@ amis::dtb::nav::NavContainer::~NavContainer() { if (mpLabel != NULL) + { + mpLabel->destroyContents(); delete mpLabel; + } } void amis::dtb::nav::NavContainer::setNavModel(NavModel* pModel) Modified: branches/amis3/AmisCore/src/io/RecentBooksFileIO.cpp =================================================================== --- branches/amis3/AmisCore/src/io/RecentBooksFileIO.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisCore/src/io/RecentBooksFileIO.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -72,10 +72,8 @@ { mpCurrentEntry = NULL; mpRecentBooks = new amis::RecentBooks(); - mpRecentBooks->mFilePath = *filepath; - mb_flagGetChars = false; - + mpRecentBooks->setFilepath(filepath); if (!this->parseFile(filepath)) { delete mpRecentBooks; @@ -99,6 +97,8 @@ if (strcmp(element_name, "book") == 0) { + //this gets reported as a leak, but recent book objects get deleted in RecentBooks::~RecentBooks + //the caller (AmisApp.cpp in our case) is responsible for this mpCurrentEntry = new amis::RecentBookEntry(); string tmpstr; tmpstr.assign(SimpleAttrs::get("isLastRead", &attributes)); @@ -130,11 +130,13 @@ } else if (strcmp(element_name, "path") == 0) { + //TODO: this gets reported as a leak -- unresolved mpCurrentEntry->mPath = ambulant::net::url::from_url(mTempChars); mb_flagGetChars = false; } else if(strcmp(element_name, "bmkPath") == 0) { + //TODO: this gets reported as a leak -- unresolved mpCurrentEntry->mBmkPath = ambulant::net::url::from_url(mTempChars); mb_flagGetChars = false; } @@ -168,50 +170,35 @@ { XMLPlatformUtils::Initialize(); } - - // catch the error catch(...)//const XMLException& toCatch) { return false; } - // end of try-catch block + + if (pFile == NULL) return false; + if (!pFile->getFilepath()->is_local_file()) return false; - if (pFile == NULL) - { - return false; - } - if (!pFile->mFilePath.is_local_file()) - { - return false; - } - std::string local_file_name; //use the specified filepath unless it is unavailable if (filepath != NULL) local_file_name = amis::util::FilePathTools::getAsLocalFilePath(filepath->get_file()); else - local_file_name = amis::util::FilePathTools::getAsLocalFilePath(pFile->mFilePath.get_file()); + local_file_name = amis::util::FilePathTools::getAsLocalFilePath(pFile->getFilepath()->get_file()); mpRecentBooks = pFile; int i; - //the DOM implementation pointer (this is part of how Xerces does things) DOMImplementation* pImpl; - - //a pointer to the Document Writer. This will save the documet to file. + //a pointer to the Document Writer. This will save the document to file. DOMWriter* pWriter; //a DOMNode pointer - need this later for writing output DOMNode* pDocNode; //document output - XMLFormatTarget* pFormTarget; + XMLFormatTarget* pFormTarget; - //------------- - // initializing the document - //------------ - //You have to use the DOM Implementation class to get a pointer to the DOM object. It's part of how Xerces works. pImpl = DOMImplementationRegistry::getDOMImplementation(X("Core")); @@ -223,22 +210,15 @@ //start adding data to the DOM - amis::RecentBookEntry* p_entry; for (i=0; i<mpRecentBooks->getNumberOfEntries(); i++) { - p_entry = mpRecentBooks->getEntry(i); - writeRecentBookEntry(p_entry); } - //------------------ - // saving the DOM to a file - //------------------ - //initialize the DOM Writer pWriter = ((DOMImplementationLS*)pImpl)->createDOMWriter(); @@ -253,7 +233,7 @@ #if defined(AMIS_COMPILER_MSVC) _mkdir(dir.c_str()); #elif defined(AMIS_COMPILER_GCC) - //todo: something + //todo: something that creates directories on other platforms #endif } pFormTarget = new LocalFileFormatTarget(local_file_name.c_str()); @@ -265,11 +245,10 @@ string dir = amis::util::FilePathTools::getParentDirectory(local_file_name); if (access(dir.c_str(), 0) == -1) { - #if defined(AMIS_COMPILER_MSVC) _mkdir(dir.c_str()); #elif defined(AMIS_COMPILER_GCC) - //todo: something + //todo: something to make directories on other platforms #endif } pFormTarget = new LocalFileFormatTarget(local_file_name.c_str()); @@ -287,9 +266,8 @@ delete pWriter; delete mpDoc; - //terminate the XML platform utilities (part of how Xerces works) + //terminate the XML platform utilities XMLPlatformUtils::Terminate(); - return true; } Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -213,7 +213,7 @@ p_recent_books->addEntry(p_entry); amis::io::RecentBooksFileIO io; - io.writeToFile(&p_recent_books->mFilePath, p_recent_books); + io.writeToFile(p_recent_books->getFilepath(), p_recent_books); amis::gui::MenuManip::Instance()->refreshRecentBooksListMenu(); } @@ -229,7 +229,8 @@ { amis::MediaGroup* p_media = new amis::MediaGroup(); amis::TextNode* p_text = new amis::TextNode(); - p_text->setTextString(L"sections"); + wstring txt = L"sections"; + p_text->setTextString(txt); p_media->setText(p_text); p_map->setLabel(p_media); } @@ -245,7 +246,8 @@ { amis::MediaGroup* p_media = new amis::MediaGroup(); amis::TextNode* p_text = new amis::TextNode(); - p_text->setTextString(L"pages"); + wstring txt = L"pages"; + p_text->setTextString(txt); p_media->setText(p_text); p_pages->setLabel(p_media); } @@ -264,7 +266,8 @@ { amis::MediaGroup* p_media = new amis::MediaGroup(); amis::TextNode* p_text = new amis::TextNode(); - p_text->setTextString(L""); + wstring txt = L"navlist"; + p_text->setTextString(txt); p_media->setText(p_text); ((*p_lists)[i])->setLabel(p_media); } Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -68,7 +68,8 @@ #endif #if _DEBUG -//#include <vld.h> +//get Visual Leak Detector version 1.0 here: http://dmoulding.googlepages.com/downloads +#include <vld.h> #endif using namespace amis::gui; @@ -233,10 +234,11 @@ DataTree::Instance()->DestroyInstance(); - if (mpRecentBooks) delete mpRecentBooks; + if (mpRecentBooks) + delete mpRecentBooks; amis::util::Log::Instance()->endLog(); - + amis::util::Log::Instance()->DestroyInstance(); CoUninitialize(); return CWinApp::ExitInstance(); @@ -387,8 +389,9 @@ void CAmisApp::OnFileOpen() { amis::util::Log::Instance()->writeMessage("Showing file open dialog", "CAmisApp::OnFileOpen", "AmisGuiMFC2"); - amis::gui::dialogs::AmisFileDialog* p_dlg = new amis::gui::dialogs::AmisFileDialog(amis::gui::dialogs::AmisFileDialog::getFileOpenFilter()); - string filename = p_dlg->showOpen(); + amis::gui::dialogs::AmisFileDialog dlg(amis::gui::dialogs::AmisFileDialog::getFileOpenFilter()); + + string filename = dlg.showOpen(); if (filename == "") { amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnFileOpen", "AmisGuiMFC2"); Modified: branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -711,6 +711,7 @@ #else s_browser->PostMessage(WM_SHOWWINDOW, FALSE, 0); #endif + //KB DestroyWindow(browser->m_hWnd); //KB delete browser; //KB s_browser = NULL; Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -483,7 +483,6 @@ && MainWndParts::Instance()->mpMmView->isPlaying() == true && (nID & 0xFFF0) == SC_SCREENSAVE) { - //TRACE(_T("SC_SCREENSAVE, nID = %d, lParam = %d\n"), nID, lParam); amis::util::Log::Instance()->writeMessage("Preventing screensaver from starting", "CMainFrame", "AmisGuiMFC2"); return; } @@ -491,8 +490,8 @@ } void CMainFrame::OnUpdateCmdUiPageCommands(CCmdUI* pCmdUi) { - if (theApp.isBookOpen()) - pCmdUi->Enable(amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages()); + if (theApp.isBookOpen() && amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages()) + pCmdUi->Enable(true); else pCmdUi->Enable(false); } @@ -503,24 +502,16 @@ } void CMainFrame::OnUpdateCmdUiInfoSkip(CCmdUI* pCmdUi) { - if (theApp.isBookOpen()) - { - bool has_reading_options = amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() != NULL && - amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()->getLength() > 0; - pCmdUi->Enable(has_reading_options); - } + if (theApp.isBookOpen() && amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() != NULL + && amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()->getLength() > 0) + pCmdUi->Enable(true); else pCmdUi->Enable(false); } void CMainFrame::OnUpdateCmdUiPlaySlower(CCmdUI* pCmdUi) { - if (theApp.isBookOpen()) - { - bool can_slowdown = amis::audio::AmisAudio::Instance()->getRate() > 1; - pCmdUi->Enable(can_slowdown); - } + if (theApp.isBookOpen() && amis::audio::AmisAudio::Instance()->getRate() > 1) + pCmdUi->Enable(true); else - { pCmdUi->Enable(false); - } } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-02 16:58:20 UTC (rev 2368) +++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-02 19:34:07 UTC (rev 2369) @@ -322,6 +322,7 @@ void MmView::ScheduleReplaceDoc(std::string& urlstr) { + //std::string url(urlstr); PostMessage(WM_REPLACE_DOC, 1, (LPARAM)(new std::string(urlstr))); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 16:58:19
|
Revision: 2368 http://amis.svn.sourceforge.net/amis/?rev=2368&view=rev Author: daniel_weck Date: 2008-03-02 08:58:20 -0800 (Sun, 02 Mar 2008) Log Message: ----------- no more memory leaks ! (appart from Ambulant's url.cpp) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 16:46:17 UTC (rev 2367) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 16:58:20 UTC (rev 2368) @@ -121,9 +121,9 @@ BOOL CAmisApp::InitInstance() { - /* HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == S_FALSE) CoUninitialize(); - assert(hr == S_OK); */ + 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")); @@ -237,7 +237,7 @@ amis::util::Log::Instance()->endLog(); - //CoUninitialize(); + CoUninitialize(); return CWinApp::ExitInstance(); } @@ -294,7 +294,7 @@ new_data_reader.setAppPath(mAppPath); amis::ErrorCode did_it_work = new_data_reader.readFile(lang_xml_file.get_file(), p_new_data_tree); - if (false && did_it_work == amis::OK) + if (did_it_work == amis::OK) { //test print to an output file //p_new_data_tree->testPrint("c:\\devel\\amis\\Langpacks\\sandbox\\dataout.txt"); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp 2008-03-02 16:46:17 UTC (rev 2367) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp 2008-03-02 16:58:20 UTC (rev 2368) @@ -43,7 +43,7 @@ } else if (p_item->getUiItemType() == CONTAINER) { - p_container = (Container*) p_container; + p_container = (Container*) p_item; if (p_container != NULL) delete p_container; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 16:46:12
|
Revision: 2367 http://amis.svn.sourceforge.net/amis/?rev=2367&view=rev Author: daniel_weck Date: 2008-03-02 08:46:17 -0800 (Sun, 02 Mar 2008) Log Message: ----------- fixed some serious flaws in AccessibleUIDataReader: Mnemonics were not read for CONTROL and CONTAINER, defaulting in a mDescription (which the nasty side-effect of overriding the previous mDescription without de-allocating first). The last "else" in an "if" control statement can be a sink for some nasty stuff !!! (now there is a default, but it is caught in DEBUG mode, as an error) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Container.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DialogControl.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/UiItem.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h 2008-03-02 16:46:17 UTC (rev 2367) @@ -25,7 +25,6 @@ std::string getCondition(); - void testPrint(std::string, int); protected: @@ -46,9 +45,7 @@ std::string mCondition; - friend class DataReader; - }; }}} Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Container.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Container.h 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Container.h 2008-03-02 16:46:17 UTC (rev 2367) @@ -26,13 +26,17 @@ void testPrint(std::string, int); Label* getKeyboardAccelerator(); + Label* getMnemonic(); protected: void addChildItem(UiItem*); + void setKeyboardAccelerator(Label*); + void setMnemonic(Label*); private: + Label* mMnemonic; Label* mAccelerator; vector <UiItem*> mChildItems; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h 2008-03-02 16:46:17 UTC (rev 2367) @@ -21,13 +21,17 @@ std::string getWidgetCategories(); + Label* getMnemonic(); + void testPrint(std::string, int); protected: void setWidgetCategories(std::string); - + void setMnemonic(Label*); + private: std::string mWidgetCategories; + Label* mMnemonic; friend class DataReader; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 16:46:17 UTC (rev 2367) @@ -260,6 +260,30 @@ ((Action*)p_item)->setMnemonic(p_label); } } + else if (strcmp(node_name, "mnemonic") == 0 && p_item->getUiItemType() == CONTAINER) + { + p_label->setType(MNEMONIC); + if (mpRecentLabelList != NULL) + { + mpRecentLabelList->addLabel(p_label); + } + else + { + ((Container*)p_item)->setMnemonic(p_label); + } + } + else if (strcmp(node_name, "mnemonic") == 0 && p_item->getUiItemType() == CONTROL) + { + p_label->setType(MNEMONIC); + if (mpRecentLabelList != NULL) + { + mpRecentLabelList->addLabel(p_label); + } + else + { + ((DialogControl*)p_item)->setMnemonic(p_label); + } + } else if (strcmp(node_name, "accelerator") == 0 && p_item->getUiItemType() == ACTION) { p_label->setType(ACCELERATOR); @@ -284,7 +308,7 @@ ((Container*)p_item)->setKeyboardAccelerator(p_label); } } - else + else if (strcmp(node_name, "description") == 0) { p_label->setType(DESCRIPTION); @@ -304,6 +328,8 @@ p_item->setDescription(p_label); } } + } else { + int debug = 0; } mpRecentLabel = p_label; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp 2008-03-02 16:46:17 UTC (rev 2367) @@ -14,9 +14,14 @@ this->setUiItemType(CONTAINER); mAccelerator = NULL; + + mMnemonic = NULL; } Container::~Container() { + if (mAccelerator) delete mAccelerator; + if (mMnemonic) delete mMnemonic; + Action* p_action = NULL; Container* p_container = NULL; UiItem* p_item = NULL; @@ -122,11 +127,21 @@ { this->mAccelerator = accelerator; } + +void Container::setMnemonic(Label* mnemonic) +{ + this->mMnemonic = mnemonic; +} Label* Container::getKeyboardAccelerator() { return mAccelerator; } +Label* Container::getMnemonic() +{ + return mMnemonic; +} + int Container::getNumChildItems() { return mChildItems.size(); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp 2008-03-02 16:46:17 UTC (rev 2367) @@ -272,8 +272,11 @@ for (int i = 0; i<this->mNeedsResolution.size(); i++) { PromptItem* p_ref = NULL; - p_ref = this->findPromptItem(mNeedsResolution[i]->getRefId()); + string str = mNeedsResolution[i]->getRefId(); + + p_ref = this->findPromptItem(str); + if (p_ref != NULL) { mNeedsResolution[i]->setReferenceContents(p_ref); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DialogControl.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DialogControl.cpp 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DialogControl.cpp 2008-03-02 16:46:17 UTC (rev 2367) @@ -7,12 +7,23 @@ DialogControl::DialogControl() { setUiItemType(CONTROL); + + mMnemonic = NULL; } DialogControl::~DialogControl() { + if (mMnemonic) delete mMnemonic; } +void DialogControl::setMnemonic(Label* mnemonic) +{ + this->mMnemonic = mnemonic; +} +Label* DialogControl::getMnemonic() +{ + return mMnemonic; +} std::string DialogControl::getWidgetCategories() { return mWidgetCategories; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/UiItem.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/UiItem.cpp 2008-03-02 15:39:17 UTC (rev 2366) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/UiItem.cpp 2008-03-02 16:46:17 UTC (rev 2367) @@ -81,9 +81,8 @@ mpCaption = pCaption; } -void UiItem::setMfcId(int mfcId) //std::string mfcId) +void UiItem::setMfcId(int mfcId) { - //mMfcId.assign(mfcId); mMfcId = mfcId; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 15:39:13
|
Revision: 2366 http://amis.svn.sourceforge.net/amis/?rev=2366&view=rev Author: daniel_weck Date: 2008-03-02 07:39:17 -0800 (Sun, 02 Mar 2008) Log Message: ----------- changed 2 class names to avoid confusion or compiler collision. Modified Paths: -------------- branches/amis3/AmisCore/include/Media.h branches/amis3/AmisCore/src/Media.cpp branches/amis3/AmisGuiMFC2/include/gui/self-voicing/UiMediaTypes.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/AccessibleUiDataReader.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp Modified: branches/amis3/AmisCore/include/Media.h =================================================================== --- branches/amis3/AmisCore/include/Media.h 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisCore/include/Media.h 2008-03-02 15:39:17 UTC (rev 2366) @@ -54,7 +54,8 @@ MediaNode(); ~MediaNode(); - virtual MediaNode* clone() = 0; + void cloneContents(MediaNode* p_new); + //virtual MediaNode* clone() = 0; string getId(); void setId(string); @@ -91,13 +92,15 @@ TextNode(); ~TextNode(); + void cloneContents(TextNode* p_new); + wstring getTextString(); void setTextString(wstring); TextDirection getLangDir(); void setLangDir(TextDirection); - MediaNode* clone(); + TextNode* clone(); private: wstring mText; @@ -110,7 +113,7 @@ public: AudioNode(); ~AudioNode(); - MediaNode* clone(); + AudioNode* clone(); string getClipBegin(); void setClipBegin(string); @@ -132,7 +135,9 @@ ImageNode(); ~ImageNode(); - MediaNode* clone(); + void cloneContents(ImageNode* p_new); + + ImageNode* clone(); }; //!Media group represents a group of media nodes to be rendered in parallel Modified: branches/amis3/AmisCore/src/Media.cpp =================================================================== --- branches/amis3/AmisCore/src/Media.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisCore/src/Media.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -48,6 +48,14 @@ mLangCode.erase(); } +void amis::MediaNode::cloneContents(MediaNode* p_new) +{ + p_new->setHref(this->getHref()); + p_new->setId(this->getId()); + p_new->setLangCode(this->getLangCode()); + p_new->setMediaNodeType(this->getMediaNodeType()); + p_new->setSrc(this->getSrc()); +} void amis::MediaNode::setId(string id) { mId.assign(id); @@ -131,6 +139,12 @@ mText.erase(); } +void amis::TextNode::cloneContents(TextNode* p_new) +{ + MediaNode::cloneContents(p_new); + p_new->setTextString(this->getTextString()); + p_new->setLangDir(this->getLangDir()); +} void amis::TextNode::setTextString(wstring text) { mText.assign(text); @@ -150,15 +164,12 @@ { return mLangDir; } -amis::MediaNode* amis::TextNode::clone() +amis::TextNode* amis::TextNode::clone() { amis::TextNode* p_new = new amis::TextNode(); - p_new->setHref(this->getHref()); - p_new->setId(this->getId()); - p_new->setLangCode(this->getLangCode()); - p_new->setSrc(this->getSrc()); - p_new->setLangDir(this->getLangDir()); - p_new->setTextString(this->getTextString()); + + this->cloneContents(p_new); + return p_new; } @@ -202,18 +213,15 @@ { return mClipEnd; } -amis::MediaNode* amis::AudioNode::clone() +amis::AudioNode* amis::AudioNode::clone() { amis::AudioNode* p_new = new amis::AudioNode(); p_new->setClipBegin(this->getClipBegin()); p_new->setClipEnd(this->getClipEnd()); - p_new->setHref(this->getHref()); - p_new->setId(this->getId()); - p_new->setLangCode(this->getLangCode()); - p_new->setMediaNodeType(this->getMediaNodeType()); - p_new->setSrc(this->getSrc()); - + + MediaNode::cloneContents(p_new); + return p_new; } void amis::AudioNode::print() @@ -239,13 +247,15 @@ amis::ImageNode::~ImageNode() { } -amis::MediaNode* amis::ImageNode::clone() + +void amis::ImageNode::cloneContents(ImageNode* p_new) { + MediaNode::cloneContents(p_new); +} +amis::ImageNode* amis::ImageNode::clone() +{ amis::ImageNode* p_new = new amis::ImageNode(); - p_new->setHref(this->getHref()); - p_new->setId(this->getId()); - p_new->setLangCode(this->getLangCode()); - p_new->setSrc(this->getSrc()); + MediaNode::cloneContents(p_new); return p_new; } Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/UiMediaTypes.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/UiMediaTypes.h 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/UiMediaTypes.h 2008-03-02 15:39:17 UTC (rev 2366) @@ -13,16 +13,16 @@ { namespace spoken { -class TextNode : public amis::TextNode +class TextNodeSV : public amis::TextNode { public: - TextNode(); - ~TextNode(); + TextNodeSV(); + ~TextNodeSV(); std::string getMnemonic(); void setMnemonic(std::string); - TextNode* clone(); + TextNodeSV* clone(); private: std::string mMnemonic; @@ -31,16 +31,18 @@ enum ImageType {SMALL_ICON, LARGE_ICON}; -class ImageNode : public amis::ImageNode +class ImageNodeSV : public amis::ImageNode { public: - ImageNode(); - ~ImageNode(); + ImageNodeSV(); + ~ImageNodeSV(); ImageType getImageType(); void setImageType(ImageType); + ImageNodeSV* clone(); + private: ImageType mImageType; @@ -52,19 +54,19 @@ TextAudioPair(); ~TextAudioPair(); - TextNode* getText(); + TextNodeSV* getText(); amis::AudioNode* getAudio(); void testPrint(std::string, int); - void setText(TextNode*); + void setText(TextNodeSV*); void setAudio(amis::AudioNode*); TextAudioPair* clone(); amis::MediaGroup* getAsAmisMediaGroup(); private: - TextNode* mpText; + TextNodeSV* mpText; amis::AudioNode* mpAudio; amis::MediaGroup* mpMediaGroupVersion; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/AccessibleUiDataReader.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/AccessibleUiDataReader.h 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/AccessibleUiDataReader.h 2008-03-02 15:39:17 UTC (rev 2366) @@ -93,7 +93,7 @@ Label* mpRecentLabel; Switch* mpRecentSwitch; - amis::TextNode* mpRecentTextNode; + TextNodeSV* mpRecentTextNode; Prompt* mpRecentPrompt; bool mbFlag_GetChars; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h 2008-03-02 15:39:17 UTC (rev 2366) @@ -16,7 +16,7 @@ public: Action(); ~Action(); - ImageNode* getImage(ImageType); + ImageNodeSV* getImage(ImageType); std::string getWidgetCategories(); @@ -29,7 +29,7 @@ void testPrint(std::string, int); protected: - void addImage(ImageNode*); + void addImage(ImageNodeSV*); void setWidgetCategories(std::string); void setKeyboardAccelerator(Label*); @@ -38,7 +38,7 @@ void setCondition(std::string); private: - std::vector<ImageNode*> mImages; + std::vector<ImageNodeSV*> mImages; std::string mWidgetCategories; Label* mAccelerator; Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -68,7 +68,7 @@ #endif #if _DEBUG -#include <vld.h> +//#include <vld.h> #endif using namespace amis::gui; Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -248,14 +248,14 @@ if (p_caption != NULL) { TextAudioPair* pair = p_caption->getContents(); if (pair != NULL) { - amis::TextNode* textNode = pair->getText(); + TextNodeSV* textNode = pair->getText(); if (textNode != NULL) { wstring str = textNode->getTextString(); if (mnemonic != NULL) { TextAudioPair* pair = mnemonic->getContents(); if (pair != NULL) { - TextNode* node = pair->getText(); + TextNodeSV* node = pair->getText(); if (node != NULL) { wstring strMnemonic = node->getTextString(); int index = str.find_first_of(strMnemonic, 0); @@ -272,7 +272,7 @@ //str.append(accelerator.c_str()); TextAudioPair* pair = accelerator->getContents(); if (pair != NULL) { - TextNode* node = pair->getText(); + TextNodeSV* node = pair->getText(); if (node != NULL) { str.append(node->getTextString()); } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -985,7 +985,7 @@ } else { - TextNode* textN = pair->getText(); + TextNodeSV* textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); @@ -1016,7 +1016,7 @@ } else { - TextNode * textN = pair->getText(); + TextNodeSV * textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); @@ -1040,7 +1040,7 @@ } else { - TextNode * textN = pair->getText(); + TextNodeSV * textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); @@ -1067,7 +1067,7 @@ } else { - TextNode * textN = pair->getText(); + TextNodeSV * textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -42,9 +42,9 @@ TextAudioPair* p_pair = new TextAudioPair(); - TextNode* p_text = NULL; + TextNodeSV* p_text = NULL; if (!textString.empty()) { - p_text = new TextNode(); + p_text = new TextNodeSV(); p_text->setTextString(textString); p_pair->setText(p_text); } @@ -61,9 +61,9 @@ TextAudioPair* p_pair = new TextAudioPair(); - TextNode* p_text = NULL; + TextNodeSV* p_text = NULL; if (!textString.empty()) { - p_text = new TextNode(); + p_text = new TextNodeSV(); p_text->setTextString(textString); p_pair->setText(p_text); } @@ -88,7 +88,7 @@ if (pMediaGroup->hasText() == true) { - TextNode* p_text = new TextNode(); + TextNodeSV* p_text = new TextNodeSV(); p_text->setTextString(pMediaGroup->getText()->getTextString()); mpContents->setText(p_text); } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -6,56 +6,68 @@ //*********** //TextNode -TextNode::TextNode() +TextNodeSV::TextNodeSV() { mMnemonic = ""; } -TextNode::~TextNode() +TextNodeSV::~TextNodeSV() { mMnemonic.clear(); mMnemonic.erase(); } -std::string TextNode::getMnemonic() +std::string TextNodeSV::getMnemonic() { return mMnemonic; } -void TextNode::setMnemonic(std::string mnemonic) +void TextNodeSV::setMnemonic(std::string mnemonic) { mMnemonic.assign(mnemonic); } //just copy over the text string and the mnemonic //not complete but will do for now -TextNode* TextNode::clone() +TextNodeSV* TextNodeSV::clone() { - TextNode* p_new = new TextNode(); - p_new->setTextString(this->getTextString()); + TextNodeSV* p_new = new TextNodeSV(); + p_new->setMnemonic(this->getMnemonic()); + amis::TextNode::cloneContents(p_new); + return p_new; - } //*********** //ImageNode -ImageNode::ImageNode() +ImageNodeSV::ImageNodeSV() { mImageType = SMALL_ICON; } -ImageNode::~ImageNode() +ImageNodeSV::~ImageNodeSV() { } -ImageType ImageNode::getImageType() +ImageType ImageNodeSV::getImageType() { return mImageType; } -void ImageNode::setImageType(ImageType imgType) +void ImageNodeSV::setImageType(ImageType imgType) { mImageType = imgType; } +ImageNodeSV* ImageNodeSV::clone() +{ + ImageNodeSV* p_new = new ImageNodeSV(); + p_new->setImageType(this->getImageType()); + + amis::ImageNode::cloneContents(p_new); + + return p_new; +} + + //****************** //TextAudioPair @@ -76,7 +88,7 @@ } -TextNode* TextAudioPair::getText() +TextNodeSV* TextAudioPair::getText() { return mpText; } @@ -86,7 +98,7 @@ return mpAudio; } -void TextAudioPair::setText(TextNode* pNode) +void TextAudioPair::setText(TextNodeSV* pNode) { this->mpText = pNode; } @@ -99,7 +111,7 @@ TextAudioPair* p_new = new TextAudioPair(); amis::AudioNode* p_audio = (amis::AudioNode*)this->getAudio()->clone(); - TextNode* p_text = this->getText()->clone(); + TextNodeSV* p_text = this->getText()->clone(); p_new->setAudio(p_audio); p_new->setText(p_text); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -82,7 +82,7 @@ //resolve prompt items - //mpData->resolvePromptItemsWithRefIds(); TODO DANIEL: restore this !! + mpData->resolvePromptItemsWithRefIds(); return (ok ? amis::OK : amis::PARSE_ERROR); } @@ -315,7 +315,7 @@ { if (mpRecentLabel != NULL && mpRecentPrompt == NULL) { - TextNode* p_text = new TextNode(); + TextNodeSV* p_text = new TextNodeSV(); string mnemonic; mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); @@ -325,7 +325,7 @@ } - mpRecentTextNode = (amis::TextNode*)p_text; + mpRecentTextNode = p_text; TextAudioPair* p_pair = NULL; @@ -354,7 +354,7 @@ if (p_item->getPromptItemType() == PROMPT_ITEM) { - TextNode* p_text = new TextNode(); + TextNodeSV* p_text = new TextNodeSV(); string mnemonic; mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); @@ -365,7 +365,7 @@ } - mpRecentTextNode = (amis::TextNode*)p_text; + mpRecentTextNode = p_text; mbFlag_GetChars = true; p_item->getContents()->setText(p_text); @@ -382,7 +382,7 @@ if (p_item != NULL) { - TextNode* p_text = new TextNode(); + TextNodeSV* p_text = new TextNodeSV(); string mnemonic; mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); @@ -392,7 +392,7 @@ p_text->setMnemonic(mnemonic); } - mpRecentTextNode = (amis::TextNode*)p_text; + mpRecentTextNode = p_text; mbFlag_GetChars = true; p_item->getContents()->setText(p_text); @@ -490,7 +490,7 @@ if (p_action != NULL) { - ImageNode* p_image = new ImageNode(); + ImageNodeSV* p_image = new ImageNodeSV(); string type; type.assign(SimpleAttrs::get("type", &attributes)); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -12,7 +12,7 @@ } Action::~Action() { - ImageNode* p_image = NULL; + ImageNodeSV* p_image = NULL; for (int i=mImages.size()-1; i>=0; i--) { p_image = mImages[i]; @@ -29,9 +29,9 @@ if (mAccelerator) delete mAccelerator; if (mMnemonic) delete mMnemonic; } -ImageNode* Action::getImage(ImageType type) +ImageNodeSV* Action::getImage(ImageType type) { - ImageNode* p_node = NULL; + ImageNodeSV* p_node = NULL; for (int i=0; i<mImages.size(); i++) { @@ -58,7 +58,7 @@ return mMnemonic; } -void Action::addImage(ImageNode* pNode) +void Action::addImage(ImageNodeSV* pNode) { mImages.push_back(pNode); } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Container.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -43,6 +43,10 @@ delete p_container; p_container = NULL; + } else + { + UiItemType debug = p_item->getUiItemType(); + int i = 0; } } p_item = NULL; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp 2008-03-02 14:19:06 UTC (rev 2365) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DataTree.cpp 2008-03-02 15:39:17 UTC (rev 2366) @@ -277,6 +277,8 @@ if (p_ref != NULL) { mNeedsResolution[i]->setReferenceContents(p_ref); + } else { + int debug = 0; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 14:19:03
|
Revision: 2365 http://amis.svn.sourceforge.net/amis/?rev=2365&view=rev Author: daniel_weck Date: 2008-03-02 06:19:06 -0800 (Sun, 02 Mar 2008) Log Message: ----------- killed the last major memory leak. This one was tricky, because it involved the specificities of the C++ object model, when using a hierarchy of classes (the real type of an object is not used when calling the delete operator on an intermediary type of the hierarchy, resulting in partially deleted objects). Modified Paths: -------------- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 12:18:00 UTC (rev 2364) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 14:19:06 UTC (rev 2365) @@ -148,7 +148,6 @@ p_pair = pItem->getContents(); if (p_pair != NULL) { - TextAudioPair* p_these_contents = new TextAudioPair(); if (p_pair->getText() != NULL) @@ -161,7 +160,6 @@ } this->setContents(p_these_contents); - } } @@ -210,6 +208,10 @@ } PromptVar::~PromptVar() { + mParam.clear(); + mParam.erase(); + mName.clear(); + mName.erase(); } std::string PromptVar::getParam() @@ -296,9 +298,15 @@ { p_item = mItems[i]; mItems.pop_back(); - if (p_item != NULL) - delete p_item; - + if (p_item != NULL) { + if (p_item->getPromptItemType() == PROMPT_VARIABLE) { + PromptVar* p = (PromptVar*)p_item; + delete p; + } else { + PromptItem* p = (PromptItem*)p_item; + delete p; + } + } p_item = NULL; } } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 12:18:00 UTC (rev 2364) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 14:19:06 UTC (rev 2365) @@ -82,7 +82,7 @@ //resolve prompt items - mpData->resolvePromptItemsWithRefIds(); + //mpData->resolvePromptItemsWithRefIds(); TODO DANIEL: restore this !! return (ok ? amis::OK : amis::PARSE_ERROR); } @@ -701,6 +701,8 @@ if (mpRecentLabel != NULL) { mpRecentLabel->setPrompt(mpRecentPrompt); + } else { + int debug = 0 ; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-02 12:17:56
|
Revision: 2364 http://amis.svn.sourceforge.net/amis/?rev=2364&view=rev Author: daniel_weck Date: 2008-03-02 04:18:00 -0800 (Sun, 02 Mar 2008) Log Message: ----------- - fixed a major bug in the destructor code of Prompt (was not iterating properly over its members). - fixed another major de-allocation bug: mnemonic and shortcut members were not destroyed There are still leaks, presumably from promptItemRefs...I'm working on it. Modified Paths: -------------- branches/amis3/AmisAudio/include/AmisAudio.h branches/amis3/AmisCore/include/Media.h branches/amis3/AmisCore/src/Media.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp Modified: branches/amis3/AmisAudio/include/AmisAudio.h =================================================================== --- branches/amis3/AmisAudio/include/AmisAudio.h 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisAudio/include/AmisAudio.h 2008-03-02 12:18:00 UTC (rev 2364) @@ -41,6 +41,9 @@ #include "directshow/dx_audio_player.h" #include "mffmTimeCode/smilTimeCode.H" +#if _DEBUG +//#include <vld.h> +#endif #ifdef _MSC_VER #pragma warning(disable : 4251) Modified: branches/amis3/AmisCore/include/Media.h =================================================================== --- branches/amis3/AmisCore/include/Media.h 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisCore/include/Media.h 2008-03-02 12:18:00 UTC (rev 2364) @@ -52,7 +52,7 @@ { public: MediaNode(); - virtual ~MediaNode() = 0; + ~MediaNode(); virtual MediaNode* clone() = 0; Modified: branches/amis3/AmisCore/src/Media.cpp =================================================================== --- branches/amis3/AmisCore/src/Media.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisCore/src/Media.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -38,6 +38,14 @@ amis::MediaNode::~MediaNode() { + mId.clear(); + mId.erase(); + mSrc.clear(); + mSrc.erase(); + mHref.clear(); + mHref.erase(); + mLangCode.clear(); + mLangCode.erase(); } void amis::MediaNode::setId(string id) @@ -120,6 +128,7 @@ amis::TextNode::~TextNode() { mText.clear(); + mText.erase(); } void amis::TextNode::setTextString(wstring text) @@ -167,8 +176,11 @@ amis::AudioNode::~AudioNode() { - mClipBegin = ""; - mClipEnd = ""; + mClipBegin.clear(); + mClipBegin.erase(); + + mClipEnd.clear(); + mClipEnd.erase(); } void amis::AudioNode::setClipBegin(const string clipBegin) @@ -357,7 +369,7 @@ void amis::MediaGroup::setId(string id) { - mId = id; + mId.assign(id); } string amis::MediaGroup::getId() Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -120,9 +120,10 @@ BOOL CAmisApp::InitInstance() { - HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + + /* HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == S_FALSE) CoUninitialize(); - assert(hr == S_OK); + 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")); @@ -225,7 +226,9 @@ amis::gui::MainWndParts::Instance()->DestroyInstance(); - if (AudioSequencePlayer::InstanceExists())AudioSequencePlayer::Instance()->DestroyInstance(); + if (AudioSequencePlayer::InstanceExists()) { + AudioSequencePlayer::Instance()->DestroyInstance(); + } DataTree::Instance()->DestroyInstance(); @@ -234,7 +237,7 @@ amis::util::Log::Instance()->endLog(); - CoUninitialize(); + //CoUninitialize(); return CWinApp::ExitInstance(); } @@ -273,7 +276,11 @@ } void CAmisApp::initializeSelfVoicing() -{ +{ + //VLDEnable(); + //amis::Preferences::Instance()->setIsSelfVoicing(false); + //return; + DataReader new_data_reader; DataTree* p_new_data_tree; p_new_data_tree = DataTree::Instance(); @@ -287,7 +294,7 @@ new_data_reader.setAppPath(mAppPath); amis::ErrorCode did_it_work = new_data_reader.readFile(lang_xml_file.get_file(), p_new_data_tree); - if (did_it_work == amis::OK) + if (false && did_it_work == amis::OK) { //test print to an output file //p_new_data_tree->testPrint("c:\\devel\\amis\\Langpacks\\sandbox\\dataout.txt"); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -97,8 +97,6 @@ m_wakeUpOriginator = -1; m_nEndEventsToExpect = 0; - unsigned int threadID; - AmisAudio::Instance()->setCallback((sendMessageCallbackFn)clipFinishedCallback); TTSPlayer::Instance()->setCallback((sendMessageCallbackFn)ttsFinishedCallback); @@ -113,9 +111,8 @@ _ASSERT(m_hEventEnd); ResetEvent(m_hEventEnd); + m_hThread = NULL; - m_hThread = (HANDLE) _beginthreadex(NULL, 0, ThreadProc, (void*) this, 0, &threadID); - _ASSERT(m_hThread != NULL); } void AudioSequencePlayer::waitForSequenceEnd() { @@ -233,6 +230,13 @@ } void AudioSequencePlayer::Play(AudioSequence* audioSequence, bool doNotRegisterInHistory) { + if (m_hThread == NULL) { + + unsigned int threadID; + m_hThread = (HANDLE) _beginthreadex(NULL, 0, ThreadProc, (void*) this, 0, &threadID); + _ASSERT(m_hThread != NULL); + } + { #ifdef CCS_ACTIVE CCS* ccs = new CCS(&m_csSequence); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -116,6 +116,10 @@ } PromptItem::~PromptItem() { + mRefId.clear(); + mRefId.erase(); + mId.clear(); + mId.erase(); } std::string PromptItem::getRefId() @@ -275,12 +279,20 @@ Prompt::Prompt() { mItems.empty(); + mType.clear(); + mId.clear(); } Prompt::~Prompt() { + mType.clear(); + mId.clear(); + + mType.erase(); + mId.erase(); + PromptItemBase* p_item = NULL; - for (int i=0; i<mItems.size()-1; i--) + for (int i=mItems.size()-1; i>=0; i--) { p_item = mItems[i]; mItems.pop_back(); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -13,6 +13,8 @@ TextNode::~TextNode() { + mMnemonic.clear(); + mMnemonic.erase(); } std::string TextNode::getMnemonic() Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -82,7 +82,7 @@ //resolve prompt items - mpData->resolvePromptItemsWithRefIds(); + mpData->resolvePromptItemsWithRefIds(); return (ok ? amis::OK : amis::PARSE_ERROR); } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -22,8 +22,12 @@ p_image = NULL; } - - + mWidgetCategories.clear(); + mWidgetCategories.erase(); + mCondition.clear(); + mCondition.erase(); + if (mAccelerator) delete mAccelerator; + if (mMnemonic) delete mMnemonic; } ImageNode* Action::getImage(ImageType type) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-02 02:39:52
|
Revision: 2363 http://amis.svn.sourceforge.net/amis/?rev=2363&view=rev Author: marisademeglio Date: 2008-03-01 18:39:54 -0800 (Sat, 01 Mar 2008) Log Message: ----------- Added missing preprocessor definition Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 01:36:21 UTC (rev 2362) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 02:39:54 UTC (rev 2363) @@ -21,7 +21,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="include;../AmisAudio/include;../../../../ambulant/include/;"../../../../ambulant-private/pdtbplugin";"../../../../ambulant-private/pdtbplugin/PdtbIePlugin";../AmisCore/include;"../../../../xerces-c-src/src";"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Include";"$(VSInstallDir)\..\Visual Leak Detector";" - PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;AMIS_COMPILER_MSVC;AMIS_PLATFORM_WINDOWS;" + PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;AMIS_COMPILER_MSVC;AMIS_PLATFORM_WINDOWS;WITH_EXTERNAL_SMIL_PLAYER;" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-02 01:36:17
|
Revision: 2362 http://amis.svn.sourceforge.net/amis/?rev=2362&view=rev Author: marisademeglio Date: 2008-03-01 17:36:21 -0800 (Sat, 01 Mar 2008) Log Message: ----------- Added file listing all the preprocessor definitions that we use. Have a look and add information where it's missing! Enabled visual leak detector on the main AMIS project, but only in Debug mode. Get visual leak detector here: http://dmoulding.googlepages.com/vld and watch the memory gush out of AMIS... Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisFileDialog.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp Added Paths: ----------- branches/amis3/PreprocessorDefinitions.txt Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 01:04:32 UTC (rev 2361) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-02 01:36:21 UTC (rev 2362) @@ -20,8 +20,8 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="include;../AmisAudio/include;../../../../ambulant/include/;"../../../../ambulant-private/pdtbplugin";"../../../../ambulant-private/pdtbplugin/PdtbIePlugin";../AmisCore/include;"../../../../xerces-c-src/src";"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Include"" - PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG" + AdditionalIncludeDirectories="include;../AmisAudio/include;../../../../ambulant/include/;"../../../../ambulant-private/pdtbplugin";"../../../../ambulant-private/pdtbplugin/PdtbIePlugin";../AmisCore/include;"../../../../xerces-c-src/src";"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Include";"$(VSInstallDir)\..\Visual Leak Detector";" + PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;AMIS_COMPILER_MSVC;AMIS_PLATFORM_WINDOWS;" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -38,7 +38,7 @@ AdditionalDependencies="AmisCoreD.lib xerces-c_2D.lib libambulant_shwin32_D.lib" OutputFile="$(OutDir)/AMIS.exe" LinkIncremental="2" - AdditionalLibraryDirectories="../lib;../../../../ambulant/lib/win32;"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Lib\i386"" + AdditionalLibraryDirectories="../lib;../../../../ambulant/lib/win32;"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Lib\i386";"$(VSInstallDir)\..\Visual Leak Detector"" IgnoreDefaultLibraryNames="uafxcwd.lib;uafxcw.lib;LIBCD.lib;LIBC.lib;msvcrt.lib;libcmt.lib" GenerateDebugInformation="TRUE" SubSystem="2" @@ -80,7 +80,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="include;../AmisAudio/include;../../../../ambulant/include/;"../../../../ambulant-private/pdtbplugin";"../../../../ambulant-private/pdtbplugin/PdtbIePlugin";../AmisCore/include;"../../../../xerces-c-src/src";"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Include"" - PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG" + PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUGAMIS_COMPILER_MSVC;AMIS_PLATFORM_WINDOWS;" MinimalRebuild="FALSE" RuntimeLibrary="2" TreatWChar_tAsBuiltInType="FALSE" Modified: branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h 2008-03-02 01:04:32 UTC (rev 2361) +++ branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h 2008-03-02 01:36:21 UTC (rev 2362) @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef DtbWithHooks_H -#define DtbWithHooks_H +#ifndef DTBWITHHOOKS_H +#define DTBWITHHOOKS_H #include "util/SearchForFilesMFC.h" #include "dtb/Dtb.h" Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h 2008-03-02 01:04:32 UTC (rev 2361) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h 2008-03-02 01:36:21 UTC (rev 2362) @@ -19,8 +19,8 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef AboutDialog_H -#define AboutDialog_H +#ifndef ABOUTDIALOG_H +#define ABOUTDIALOG_H #include <string> #include "gui/dialogs/AmisDialogBase.h" Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisFileDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisFileDialog.h 2008-03-02 01:04:32 UTC (rev 2361) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisFileDialog.h 2008-03-02 01:36:21 UTC (rev 2362) @@ -19,8 +19,8 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef AmisFileDialog_H -#define AmisFileDialog_H +#ifndef AMISFILEDIALOG_H +#define AMISFILEDIALOG_H #include "gui/dialogs/AmisDialogBase.h" Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 01:04:32 UTC (rev 2361) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 01:36:21 UTC (rev 2362) @@ -67,6 +67,9 @@ #define new DEBUG_NEW #endif +#if _DEBUG +#include <vld.h> +#endif using namespace amis::gui; Added: branches/amis3/PreprocessorDefinitions.txt =================================================================== --- branches/amis3/PreprocessorDefinitions.txt (rev 0) +++ branches/amis3/PreprocessorDefinitions.txt 2008-03-02 01:36:21 UTC (rev 2362) @@ -0,0 +1,35 @@ +AmisCore +-------- + Pick a platform by defining one of the following: + AMIS_PLATFORM_OSX + AMIS_PLATFORM_LINUX + AMIS_PLATFORM_WINDOWS + + Pick a compiler + AMIS_COMPILER_GCC + AMIS_COMPILER_MSVC + + Say whether an external SMIL player is being used (like Ambulant): + WITH_EXTERNAL_SMIL_PLAYER + +AmisGuiMFC2 +----------- + Do we support protected books? (PDTB 1.0 spec for Daisy 2.02 books) + WITH_DAISY_PDTB + HTML_LOAD_AMBULANT_PDTB + WITH_PROTECTED_BOOK_SUPPORT + + Is Ambulant being given an HTML widget? + WITH_HTML_WIDGET + + Is Ambulant not getting a log window? + WITHOUT_LOG_WINDOW + + Use Ambulant workaround (I don't know what this is, but it seems helpful to have it defined) + AMBULANT_SEEK_WORKAROUND + + This is in the self-voicing AudioSequencePlayer, and I don't know what it does. + CCS_ACTIVE + + Use the speed-up algorithm for the Audio playback. Question: does this just affect the self-voicing player or does it affect Ambulant too? + WITH_TPB_AUDIO_SPEEDUP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-02 01:04:27
|
Revision: 2361 http://amis.svn.sourceforge.net/amis/?rev=2361&view=rev Author: marisademeglio Date: 2008-03-01 17:04:32 -0800 (Sat, 01 Mar 2008) Log Message: ----------- zed books play in release mode (at least in the core they do; haven't tried the gui yet). note to self: be sure that all functions that claim to return a value actually do -- release mode defaults are different from those in debug mode. Modified Paths: -------------- branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-01 22:52:50 UTC (rev 2360) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-02 01:04:32 UTC (rev 2361) @@ -186,7 +186,11 @@ } else if (DtbFileSet::isOpfFile(fileUrl)) { - if (!processOpf(mpFiles->getOpfFilepath())) return false; + if (!processOpf(mpFiles->getOpfFilepath())) + { + amis::util::Log::Instance()->writeMessage("xx process opf failed"); + return false; + } mDaisyVersion = DAISY_2005; amis::util::Log::Instance()->writeMessage("This is a Daisy 2005 book", "Dtb::open", "AmisCore"); if (!processNcx(mpFiles->getNavFilepath())) return false; @@ -335,6 +339,7 @@ //it involves walking the nav model and also opening all the SMIL files resolve_smil_visitor.resolve(mpNavModel, mpSpine, false); this->mpTextSmilMap = resolve_smil_visitor.getSmilTextMap(); + return true; } //-------------------------------------------------- @@ -389,6 +394,7 @@ mpFiles->setAdditionalDataAfterInitialParse(mUid, navfile, resfile); mpFiles->setTextFile(txtfile); + return true; } //-------------------------------------------------- //process a resource file Modified: branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp =================================================================== --- branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp 2008-03-01 22:52:50 UTC (rev 2360) +++ branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp 2008-03-02 01:04:32 UTC (rev 2361) @@ -40,9 +40,9 @@ amis::util::Log::Instance()->startLog("c:\\devel\\amis\\branches\\amis3\\AmisCore\\testAmisCoreWin32\\amisLog.txt"); amis::dtb::Dtb* book = new amis::dtb::Dtb(); - ambulant::net::url book_url = ambulant::net::url::from_filename("c:\\daisybooks\\Mountains_skip\\ncc.html"); - //ambulant::net::url book_url = ambulant::net::url::from_filename - // ("C:\\daisybooks\\voiceover_guide_zed\\06-SPEECHGEN.OPF"); + //ambulant::net::url book_url = ambulant::net::url::from_filename("c:\\daisybooks\\Mountains_skip\\ncc.html"); + ambulant::net::url book_url = ambulant::net::url::from_filename + ("C:\\daisybooks\\voiceover_guide_zed\\06-SPEECHGEN.OPF"); ambulant::net::url bookmarks_url = ambulant::net::url::from_filename("c:\\daisybooks\\bmk\\"); amis::RecentBooks* p_recent_books = new amis::RecentBooks(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-01 22:52:46
|
Revision: 2360 http://amis.svn.sourceforge.net/amis/?rev=2360&view=rev Author: marisademeglio Date: 2008-03-01 14:52:50 -0800 (Sat, 01 Mar 2008) Log Message: ----------- Core debugging and leak testing. No major leaks found. For general reference, there are small leaks wherever UrlInputSource is used. ambulant's logger and plugin_engine also seem to leak a bit. Our SmilEngine leaks but we don't use it for AMIS 3, so it shouldn't matter -- still, worth fixing someday. the test project builds in release mode but fails upon opening a zed book. Modified Paths: -------------- branches/amis3/AmisCore/AmisCore.vcproj branches/amis3/AmisCore/include/AmisCore.h branches/amis3/AmisCore/include/dtb/nav/NavModel.h branches/amis3/AmisCore/include/io/XercesSaxParseBase.h branches/amis3/AmisCore/src/Media.cpp branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp branches/amis3/AmisCore/src/dtb/nav/PageList.cpp branches/amis3/AmisCore/src/dtb/smil/ContentNode.cpp branches/amis3/AmisCore/src/dtb/smil/SmilTree.cpp branches/amis3/AmisCore/src/io/BookmarksFileIO.cpp branches/amis3/AmisCore/src/util/FilePathTools.cpp branches/amis3/AmisCore/src/util/Log.cpp branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.vcproj Modified: branches/amis3/AmisCore/AmisCore.vcproj =================================================================== --- branches/amis3/AmisCore/AmisCore.vcproj 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/AmisCore.vcproj 2008-03-01 22:52:50 UTC (rev 2360) @@ -20,8 +20,8 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="./include; ../../../../xerces-c-src/src;../../../../ambulant/include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + AdditionalIncludeDirectories="./include; ../../../../xerces-c-src/src;../../../../ambulant/include;c:\program files\visual leak detector;" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS; AMIS_COMPILER_MSVC; AMIS_PLATFORM_WINDOWS;" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -64,7 +64,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="./include; ../../../../xerces-c-src/src;../../../../ambulant/include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS; AMIS_COMPILER_MSVC; AMIS_PLATFORM_WINDOWS;" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" UsePrecompiledHeader="0" Modified: branches/amis3/AmisCore/include/AmisCore.h =================================================================== --- branches/amis3/AmisCore/include/AmisCore.h 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/include/AmisCore.h 2008-03-01 22:52:50 UTC (rev 2360) @@ -20,23 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -//start HACK! -//we should define these at compile-time - -//1. pick a platform -//#define AMIS_PLATFORM_OSX 1 -//#define AMIS_PLATFORM_LINUX 1 -#define AMIS_PLATFORM_WINDOWS 1 - -//2. pick a compiler -//#define AMIS_COMPILER_GCC 1 -#define AMIS_COMPILER_MSVC 1 - -//end HACK! - -//this turns off AmisCore's internal SMIL tree and logic, which we want to do because we're using Ambulant -#define WITH_EXTERNAL_SMIL_PLAYER 1 - #ifndef AMISCORE_H #define AMISCORE_H Modified: branches/amis3/AmisCore/include/dtb/nav/NavModel.h =================================================================== --- branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-03-01 22:52:50 UTC (rev 2360) @@ -63,6 +63,7 @@ PageTarget* nextPage(int); //add a node to the big ordered list. the node will not necessarily be next in sequence. void addToPlayOrderList(NavNode*); + vector<amis::dtb::nav::NavNode*> getPlayOrderList(); private: NavMap* mpNavMap; PageList* mpPageList; Modified: branches/amis3/AmisCore/include/io/XercesSaxParseBase.h =================================================================== --- branches/amis3/AmisCore/include/io/XercesSaxParseBase.h 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/include/io/XercesSaxParseBase.h 2008-03-01 22:52:50 UTC (rev 2360) @@ -22,8 +22,8 @@ #ifndef XERCESSAXPARSEBASE_H #define XERCESSAXPARSEBASE_H +#include <xercesc/sax2/DefaultHandler.hpp> #include <string> -#include <xercesc/sax2/DefaultHandler.hpp> #include "ambulant/net/url.h" #include "Error.h" Modified: branches/amis3/AmisCore/src/Media.cpp =================================================================== --- branches/amis3/AmisCore/src/Media.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/Media.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -119,7 +119,7 @@ amis::TextNode::~TextNode() { - mText.erase(); + mText.clear(); } void amis::TextNode::setTextString(wstring text) Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -77,9 +77,15 @@ if (mpMetadata != NULL) delete mpMetadata; if (mpTitle != NULL) + { + mpTitle->destroyContents(); delete mpTitle; + } if (mpAuthor != NULL) + { + mpAuthor->destroyContents(); delete mpAuthor; + } if (mpBookmarks != NULL) delete mpBookmarks; if (mpSpine != NULL) Modified: branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -62,9 +62,6 @@ if (isNccFile(filepath)) { this->mNavFilepath = *filepath; - //these should be set to "" .. however you do that with ambulant::net::url objects - //this->mOpfFilepath; - //this->mResourceFilepath; findTextFiles(fileSearcher); } else if (isOpfFile(filepath)) @@ -232,6 +229,7 @@ */ void amis::dtb::DtbFileSet::findTextFiles(amis::util::SearchForFiles* fileSearcher) { + if (fileSearcher == NULL) return; //searching won't work on network-based books yet if (mBookDirectory.is_local_file() == false) return; Modified: branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -94,30 +94,43 @@ } void amis::dtb::nav::NavModel::addToPlayOrderList(amis::dtb::nav::NavNode* pNode) { - //TODO: fix big bug in this function. It only shows up in release mode, outside the IDE! - //in the meantime, section and page navigation will be buggy... - return; - if (pNode == NULL) return; //1 is the first playOrder value; mpBigOrderedList is ordered by play order - int next_in_sequence = mPlayOrderList.size() + 1; - if (pNode->getPlayOrder() == next_in_sequence) + int node_play_order = pNode->getPlayOrder(); + if (node_play_order >= mPlayOrderList.size() + 1) { mPlayOrderList.push_back(pNode); } //we are adding nodes out of order (not unusual) else { - if (pNode->getPlayOrder() > next_in_sequence) - mPlayOrderList.resize(next_in_sequence); - - //make sure there is nothing in that spot already - if (mPlayOrderList[next_in_sequence - 1] == NULL) + for (int i = 0; i<mPlayOrderList.size(); i++) { - vector<NavNode*>::iterator it; - it = mPlayOrderList.begin(); - for (int i = 0; i<next_in_sequence; i++) it++; - mPlayOrderList.insert(it, pNode); + int play_order = mPlayOrderList[i]->getPlayOrder(); + if (play_order == node_play_order - 1) + { + //insert after the current node + vector<amis::dtb::nav::NavNode*>::iterator it = mPlayOrderList.begin(); + it = it + i + 1; + mPlayOrderList.insert(it, pNode); + break; + } + else if (play_order == node_play_order + 1) + { + //insert before the current node + vector<amis::dtb::nav::NavNode*>::iterator it = mPlayOrderList.begin(); + it = it + i; + mPlayOrderList.insert(it, pNode); + break; + } + else if (play_order > node_play_order + 1) + { + //insert before the current node + vector<amis::dtb::nav::NavNode*>::iterator it = mPlayOrderList.begin(); + it = it + i; + mPlayOrderList.insert(it, pNode); + break; + } } } } @@ -319,3 +332,7 @@ } return NULL; } +vector<amis::dtb::nav::NavNode*> amis::dtb::nav::NavModel::getPlayOrderList() +{ + return mPlayOrderList; +} \ No newline at end of file Modified: branches/amis3/AmisCore/src/dtb/nav/PageList.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/PageList.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/dtb/nav/PageList.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -43,10 +43,9 @@ //only add page targets if (pNode->getTypeOfNode() == amis::dtb::nav::NavNode::PAGE_TARGET) { + //remember that the base class takes care of adding this node to the play order list amis::dtb::nav::NavList::addNode(pNode); pNode->setNavContainer(this); - //register this node with the play order list - mpNavModel->addToPlayOrderList(pNode); } } Modified: branches/amis3/AmisCore/src/dtb/smil/ContentNode.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/smil/ContentNode.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/dtb/smil/ContentNode.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -21,116 +21,54 @@ */ -//SYSTEM INCLUDES #include <iostream> - -//PROJECT INCLUDES #include "dtb/smil/ContentNode.h" #include "dtb/smil/SmilTree.h" using namespace std; -//-------------------------------------------------- -/*! - constructor sets pointers to null -*/ -//-------------------------------------------------- amis::dtb::smil::ContentNode::ContentNode() { mpMediaData = NULL; mNodeType = NONE; } -//-------------------------------------------------- -/*! - destructor deallocates mpMediaData -*/ -//-------------------------------------------------- amis::dtb::smil::ContentNode::~ContentNode() { - if (mNodeType != NONE) - { - delete mpMediaData; - - } +//the calling appliation is expected to delete the media data when they're done with it +// if (mNodeType != NONE && mpMediaData != NULL) delete mpMediaData; } -//-------------------------------------------------- -/*! - category of this node is CONTENT -*/ -//-------------------------------------------------- NodeType amis::dtb::smil::ContentNode::getCategoryOfNode() { return CONTENT; } -//-------------------------------------------------- -/*! - type of media node is TXT, AUD, IMG, or NONE -*/ -//-------------------------------------------------- NodeType amis::dtb::smil::ContentNode::getTypeOfNode() { return mNodeType; } -//-------------------------------------------------- -/* - create mpMediaData as a new audio node -*/ -//-------------------------------------------------- void amis::dtb::smil::ContentNode::createNewAudio() { mpMediaData = new amis::AudioNode(); - mNodeType = AUD; - + mNodeType = AUD; } - -//-------------------------------------------------- -/* - create mpMediaData as a new image node -*/ -//-------------------------------------------------- void amis::dtb::smil::ContentNode::createNewImage() { mpMediaData = new amis::ImageNode(); - mNodeType = IMG; - + mNodeType = IMG; } - -//-------------------------------------------------- -/* - create mpMediaData as a new text node -*/ -//-------------------------------------------------- void amis::dtb::smil::ContentNode::createNewText() { mpMediaData = new amis::TextNode(); - mNodeType = TXT; - + mNodeType = TXT; } - - -//-------------------------------------------------- -/* - return mpMediaData -*/ -//-------------------------------------------------- amis::MediaNode* amis::dtb::smil::ContentNode::getMediaNode() { return mpMediaData; } - - -//-------------------------------------------------- -/*! - play the media node by adding it to the SmilMediaGroup which is initialized - outside the SmilEngine. The SmilEngine sends the media group pointer around - the tree and each node which is asked to play adds itself to the media group -*/ -//-------------------------------------------------- void amis::dtb::smil::ContentNode::play(amis::dtb::smil::SmilMediaGroup* pPlayGroup) { if (mNodeType == AUD) @@ -147,10 +85,6 @@ { pPlayGroup->setText((amis::TextNode*)this->getMediaNode()); } - else - { - //nothing - } //if the current id is blank, set it to the current media node if (this->getSmilTreePtr()->getCurrentId().compare("") == 0) Modified: branches/amis3/AmisCore/src/dtb/smil/SmilTree.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/smil/SmilTree.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/dtb/smil/SmilTree.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -35,9 +35,6 @@ using namespace std; -//-------------------------------------------------- -//Default constructor -//-------------------------------------------------- amis::dtb::smil::SmilTree::SmilTree() { //initialize variables and clear the skip options list @@ -49,26 +46,16 @@ mError.clear(); } -//-------------------------------------------------- -//Destructor -//-------------------------------------------------- amis::dtb::smil::SmilTree::~SmilTree() { //delete the root node - delete mpRoot; + if (mpRoot != NULL) delete mpRoot; } - -//-------------------------------------------------- -//set the root node pointer -//-------------------------------------------------- void amis::dtb::smil::SmilTree::setRoot(SeqNode* pNewRoot) { mpRoot = pNewRoot; } -//-------------------------------------------------- -//get the root node pointer -//-------------------------------------------------- amis::dtb::smil::Node* amis::dtb::smil::SmilTree::getRoot() { return mpRoot; @@ -78,9 +65,6 @@ { return mError; } -//-------------------------------------------------- -//go to the first set of parallel nodes in the tree -//-------------------------------------------------- amis::dtb::smil::SmilMediaGroup* amis::dtb::smil::SmilTree::firstPhrase() { SmilMediaGroup* p_smil_media = NULL; @@ -107,7 +91,7 @@ return p_smil_media; } //-------------------------------------------------- -//go to the last set of parallel nodes in the tree +//go to the last set of par nodes in the tree //-------------------------------------------------- amis::dtb::smil::SmilMediaGroup* amis::dtb::smil::SmilTree::lastPhrase() { @@ -135,7 +119,7 @@ } //-------------------------------------------------- -//go to the next set of parallel nodes in the smil tree +//go to the next set of par nodes in the smil tree //-------------------------------------------------- amis::dtb::smil::SmilMediaGroup* amis::dtb::smil::SmilTree::nextPhrase() { @@ -169,7 +153,7 @@ } //-------------------------------------------------- -//Go to the previous set of parallel nodes in the Smil Tree +//Go to the previous set of par nodes in the Smil Tree //-------------------------------------------------- amis::dtb::smil::SmilMediaGroup* amis::dtb::smil::SmilTree::previousPhrase() { @@ -203,9 +187,6 @@ return p_smil_media; } -//-------------------------------------------------- -//escape the current structure -//-------------------------------------------------- amis::dtb::smil::SmilMediaGroup* amis::dtb::smil::SmilTree::escapeCurrentStructure() { SmilMediaGroup* p_smil_media = NULL; @@ -229,20 +210,11 @@ return p_smil_media; } -//-------------------------------------------------- -//returns whether this tree is empty or not -//-------------------------------------------------- bool amis::dtb::smil::SmilTree::isEmpty() { //test the root for NULL - if (mpRoot == NULL) - { - return true; - } - else - { - return false; - } + if (mpRoot == NULL) return true; + else return false; } //-------------------------------------------------- @@ -262,7 +234,6 @@ void amis::dtb::smil::SmilTree::printNode(Node* pNode, int level) { TimeContainerNode* p_time_container; - int cnt; //print this node @@ -275,10 +246,7 @@ //print the children for (cnt = 0; cnt < p_time_container->NumChildren(); cnt++) - { printNode(p_time_container->getChild(cnt), level + 1); - } - } } @@ -304,7 +272,6 @@ //-------------------------------------------------- bool amis::dtb::smil::SmilTree::mustSkipOrEscapeNode(Node* pNode) { - //local variables int i; int len; bool return_value = false; Modified: branches/amis3/AmisCore/src/io/BookmarksFileIO.cpp =================================================================== --- branches/amis3/AmisCore/src/io/BookmarksFileIO.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/io/BookmarksFileIO.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -340,9 +340,6 @@ bool amis::io::BookmarksFileIO::writeToFile(const ambulant::net::url* filepath, amis::dtb::BookmarkSet* pBmks) { - assert (filepath); - if (filepath->is_local_file() == false) return false; - // Xerces-specific stuff: try-catch block to initialize the XML platform utilities // Initialize the XML4C2 system. try @@ -416,8 +413,9 @@ //initialize the DOM Writer pWriter = ((DOMImplementationLS*)pImpl)->createDOMWriter(); + ambulant::net::url base = filepath->get_base(); //make sure the path to the file exists - string dir = amis::util::FilePathTools::getParentDirectory(filepath->get_file()); + string dir = filepath->get_base().get_file(); if (access(dir.c_str(), 0) == -1) { #if defined(AMIS_PLATFORM_WINDOWS) Modified: branches/amis3/AmisCore/src/util/FilePathTools.cpp =================================================================== --- branches/amis3/AmisCore/src/util/FilePathTools.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/util/FilePathTools.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -33,17 +33,13 @@ { string file_name; int pos; - int substrLen; - + int substr_len; file_name = convertSlashesFwd(filepath); - pos = file_name.find_last_of("/"); - substrLen = file_name.length() - pos; if (pos!= string::npos && pos < file_name.length() - 1) { - file_name = file_name.substr(pos + 1, substrLen); - + file_name = file_name.substr(pos + 1); pos = file_name.find("#"); //strip the target Modified: branches/amis3/AmisCore/src/util/Log.cpp =================================================================== --- branches/amis3/AmisCore/src/util/Log.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/src/util/Log.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -42,6 +42,10 @@ amis::util::Log::~Log() { } +void amis::util::Log::DestroyInstance() +{ + delete pinstance; +} void amis::util::Log::startLog(string filename) { Modified: branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp =================================================================== --- branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp 2008-03-01 22:52:50 UTC (rev 2360) @@ -13,31 +13,50 @@ #include "dtb/nav/NavMap.h" #include "util/FilePathTools.h" #include "util/Log.h" + #include <tchar.h> #include <iostream> #include "ambulant/net/url.h" -#include <vld.h> +#if _DEBUG + #include <vld.h> +#endif - +#include "RecentBooks.h" #endif void doPhraseNavInputLoop(amis::dtb::Dtb*); void nextPhrase(amis::dtb::Dtb*); void previousPhrase(amis::dtb::Dtb*); +void addBookmark(amis::dtb::Dtb*); void searchText(amis::dtb::Dtb*); void printContextualInfo(amis::dtb::Dtb*, amis::dtb::smil::SmilMediaGroup*); +void addToRecentBooks(amis::dtb::Dtb*, amis::RecentBooks*); +void printPlayOrderList(amis::dtb::Dtb*); int _tmain(int argc, _TCHAR* argv[]) { + amis::util::Log::Instance()->startLog("c:\\devel\\amis\\branches\\amis3\\AmisCore\\testAmisCoreWin32\\amisLog.txt"); amis::dtb::Dtb* book = new amis::dtb::Dtb(); - if (!book->open("file://c:/daisybooks/Mountains_skip/ncc.html", "file://c:/daisybooks/bmk/")) - //if (!book->open("c:\\dtb\\ValidZedFromMarkus\\06-speechgen.opf", "c:\\dtb\\bmk\\")) - //if (!book->open("d:\\FullPackage.opf", "c:\\dtb\\bmk\\")) + + ambulant::net::url book_url = ambulant::net::url::from_filename("c:\\daisybooks\\Mountains_skip\\ncc.html"); + //ambulant::net::url book_url = ambulant::net::url::from_filename + // ("C:\\daisybooks\\voiceover_guide_zed\\06-SPEECHGEN.OPF"); + ambulant::net::url bookmarks_url = ambulant::net::url::from_filename("c:\\daisybooks\\bmk\\"); + amis::RecentBooks* p_recent_books = new amis::RecentBooks(); + + if (!book->open(&book_url, &bookmarks_url)) + { cout<<"Error opening book"<<endl; + return 0; + } else + { cout<<"Book opened"<<endl; + addToRecentBooks(book, p_recent_books); + //printPlayOrderList(book); + } amis::dtb::smil::SmilMediaGroup* p_data = book->startReading(false); @@ -45,21 +64,41 @@ { p_data->print(); printContextualInfo(book, p_data); + p_data->destroyContents(); delete p_data; } doPhraseNavInputLoop(book); delete book; + delete p_recent_books; + amis::util::Log::Instance()->endLog(); + amis::util::Log::Instance()->DestroyInstance(); return 0; } +void addToRecentBooks(amis::dtb::Dtb* p_dtb, amis::RecentBooks* p_recent_books) +{ + if (p_recent_books != NULL) + { + amis::RecentBookEntry* p_entry = new amis::RecentBookEntry(); + p_entry->mbIsLastRead = true; + p_entry->mBmkPath = *p_dtb->getFileSet()->getBookmarksFilepath(); + if (p_dtb->getDaisyVersion() == amis::dtb::DAISY_202) + p_entry->mPath = *p_dtb->getFileSet()->getNavFilepath(); + else if (p_dtb->getDaisyVersion() == amis::dtb::DAISY_2005) + p_entry->mPath = *p_dtb->getFileSet()->getOpfFilepath(); + + p_recent_books->addEntry(p_entry); + } +} + void doPhraseNavInputLoop(amis::dtb::Dtb* p_dtb) { string cmd; while (1) { - cout<<"Type (n)ext, (p)previous, (s)earch or (q)uit:"; + cout<<"Type (n)ext, (p)revious, (s)earch, (a)dd bookmark or (q)uit:"; cin>>cmd; if (cmd == "n") @@ -68,6 +107,8 @@ previousPhrase(p_dtb); else if (cmd == "s") searchText(p_dtb); + else if (cmd == "a") + addBookmark(p_dtb); else if (cmd == "q") break; } @@ -94,7 +135,21 @@ delete p_data; } } +void addBookmark(amis::dtb::Dtb* p_dtb) +{ + amis::MediaGroup* p_note = new amis::MediaGroup(); + amis::TextNode* p_note_text = new amis::TextNode(); + + wstring curr_text = L"test bookmark"; + p_note_text->setTextString(curr_text); + p_note->setText(p_note_text); + //TODO: add an audio node (need to find out the information from Ambulant) + ///add the audio clip of the current position to the bookmark's note's audio field + + p_dtb->addBookmark(p_note); +} + void searchText(amis::dtb::Dtb* p_dtb) { wstring search; @@ -153,9 +208,8 @@ amis::dtb::nav::NavNode* p_node = NULL; amis::dtb::DtbFileSet* p_files = pDtb->getFileSet(); const ambulant::net::url* smilfilepath = p_files->getSmilFile(); - //smilfile = amis::util::FilePathTools::clearTarget(smilfile); - //smilfile = amis::util::FilePathTools::getFileName(smilfile); string smilfile = smilfilepath->get_file(); + smilfile = amis::util::FilePathTools::getFileName(smilfile); if (p_nav->getNavMap() != NULL) { @@ -193,3 +247,19 @@ } } } + +void printPlayOrderList(amis::dtb::Dtb* p_dtb) +{ + vector<amis::dtb::nav::NavNode*> list = p_dtb->getNavModel()->getPlayOrderList(); + + char intstr[5]; + for (int i = 0; i<list.size(); i++) + { + string i_str = itoa(i, intstr, 5); + string msg = "#" + i_str; + msg += " = "; + if (list[i] == NULL) msg += "NULL -- WARNING!"; + else msg += list[i]->getId(); + amis::util::Log::Instance()->writeMessage(msg); + } +} \ No newline at end of file Modified: branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.vcproj =================================================================== --- branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.vcproj 2008-03-01 06:42:33 UTC (rev 2359) +++ branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.vcproj 2008-03-01 22:52:50 UTC (rev 2360) @@ -20,7 +20,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="C:\devel\ambulant\include;"C:\Program Files\Visual Leak Detector";../include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;AMIS_COMPILER_MSVC;AMIS_PLATFORM_WINDOWS;" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -32,7 +32,7 @@ Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" - AdditionalDependencies="xerces-c_2D.lib libambulant_shwin32_D.lib AmisCoreD.lib" + AdditionalDependencies="xerces-c_2D.lib libambulant_shwin32_D.lib AmisCoreD.lib " OutputFile="$(OutDir)/testAmisCoreD.exe" LinkIncremental="2" AdditionalLibraryDirectories="../../../../../ambulant/lib/win32;../../lib;"C:\Program Files\Visual Leak Detector"" @@ -70,9 +70,9 @@ CharacterSet="1"> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="../include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="0" + AdditionalIncludeDirectories="C:\devel\ambulant\include;../include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;AMIS_PLATFORM_WINDOWS;AMIS_COMPILER_MSVC" + RuntimeLibrary="2" UsePrecompiledHeader="3" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" @@ -81,10 +81,11 @@ Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" - AdditionalDependencies="xerces-c_2.lib" + AdditionalDependencies="xerces-c_2.lib libambulant_shwin32.lib AmisCore.lib" OutputFile="$(OutDir)/testAmisCore.exe" LinkIncremental="1" - AdditionalLibraryDirectories="../../lib" + AdditionalLibraryDirectories="../../../../../ambulant/lib/win32;../../lib;" + IgnoreDefaultLibraryNames="" GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-01 06:42:29
|
Revision: 2359 http://amis.svn.sourceforge.net/amis/?rev=2359&view=rev Author: marisademeglio Date: 2008-02-29 22:42:33 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Updated installer for AMIS 3. It seems to work as well as the release mode version of AMIS.exe Found a bug in NavModel's addToPlayOrderList function ... so, for now, prev/next page and section are not really going to work at all. The sidebar and goto page should still work though. Modified Paths: -------------- branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp branches/amis3/AmisCore/src/io/NccFileReader.cpp branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/installer/main/setup-amis3.nsi Added Paths: ----------- branches/amis3/installer/main/getversions.nsh Removed Paths: ------------- branches/amis3/bin/settings/plugins/ branches/amis3/installer/old/ branches/amis3/installer/oldscripts/ branches/amis3/installer/urakawa/ Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-01 05:23:58 UTC (rev 2358) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-01 06:42:33 UTC (rev 2359) @@ -245,8 +245,11 @@ amis::io::NccFileReader ncc_file_reader; amis::dtb::nav::BuildSpineVisitor spine_visitor; - if (!ncc_file_reader.readFromFile(filepath)) return false; - + if (!ncc_file_reader.readFromFile(filepath)) + { + amis::util::Log::Instance()->writeError("Could not read NCC file!", "Dtb::processNcc", "AmisCore"); + return false; + } mpNavModel = ncc_file_reader.getNavModel(); mpMetadata = ncc_file_reader.getMetadata(); mpCustomTests = ncc_file_reader.getCustomTests(); Modified: branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-03-01 05:23:58 UTC (rev 2358) +++ branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-03-01 06:42:33 UTC (rev 2359) @@ -94,6 +94,10 @@ } void amis::dtb::nav::NavModel::addToPlayOrderList(amis::dtb::nav::NavNode* pNode) { + //TODO: fix big bug in this function. It only shows up in release mode, outside the IDE! + //in the meantime, section and page navigation will be buggy... + return; + if (pNode == NULL) return; //1 is the first playOrder value; mpBigOrderedList is ordered by play order int next_in_sequence = mPlayOrderList.size() + 1; Modified: branches/amis3/AmisCore/src/io/NccFileReader.cpp =================================================================== --- branches/amis3/AmisCore/src/io/NccFileReader.cpp 2008-03-01 05:23:58 UTC (rev 2358) +++ branches/amis3/AmisCore/src/io/NccFileReader.cpp 2008-03-01 06:42:33 UTC (rev 2359) @@ -46,7 +46,6 @@ { mbFlag_ProcessMetadataChars = false; mpMetadata = new amis::dtb::Metadata(); - return amis::io::NavFileReader::readFromFile(filepath); } //!xerces start element event @@ -224,11 +223,11 @@ classname.assign(SimpleAttrs::get("class", pAttrs)); id.assign(SimpleAttrs::get("id", pAttrs)); - if (classname.compare("page-front") == 0 || classname.compare("page-normal") == 0 || classname.compare("page-special") == 0) { + mListType = 2; classname = classname.substr(5); Modified: branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp =================================================================== --- branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-03-01 05:23:58 UTC (rev 2358) +++ branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-03-01 06:42:33 UTC (rev 2359) @@ -103,7 +103,7 @@ parser->setContentHandler(this); parser->setErrorHandler(this); //parser begins parsing; expect SAX Events soon - parser->parse(mFilepath.get_url().c_str());//((*p_input_source)); + parser->parse((*p_input_source)); } catch (const XMLException& toCatch) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-01 05:23:58 UTC (rev 2358) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-01 06:42:33 UTC (rev 2359) @@ -36,6 +36,7 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="AmisCoreD.lib xerces-c_2D.lib libambulant_shwin32_D.lib" + OutputFile="$(OutDir)/AMIS.exe" LinkIncremental="2" AdditionalLibraryDirectories="../lib;../../../../ambulant/lib/win32;"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Lib\i386"" IgnoreDefaultLibraryNames="uafxcwd.lib;uafxcw.lib;LIBCD.lib;LIBC.lib;msvcrt.lib;libcmt.lib" @@ -86,12 +87,13 @@ UsePrecompiledHeader="3" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + DebugInformationFormat="0"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="xerces-c_2.lib AmisCore.lib libambulant_shwin32.lib Strmiids.lib stlib.lib kernel32.lib gdi32.lib user32.lib" + OutputFile="$(OutDir)/AMIS.exe" LinkIncremental="1" AdditionalLibraryDirectories="../lib;../../../../ambulant/lib/win32;"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Lib\i386"" IgnoreAllDefaultLibraries="FALSE" Copied: branches/amis3/installer/main/getversions.nsh (from rev 2307, trunk/amis/installer/main/getversions.nsh) =================================================================== --- branches/amis3/installer/main/getversions.nsh (rev 0) +++ branches/amis3/installer/main/getversions.nsh 2008-03-01 06:42:33 UTC (rev 2359) @@ -0,0 +1,120 @@ + +;************************** +;get the directx version +;************************** +Function GetDXVersion + Push $0 + Push $1 + + ReadRegStr $0 HKLM "Software\Microsoft\DirectX" "Version" + IfErrors noDirectX + + StrCpy $1 $0 2 5 ; get the minor version + StrCpy $0 $0 2 2 ; get the major version + IntOp $0 $0 * 100 ; $0 = major * 100 + minor + IntOp $0 $0 + $1 + Goto done + + noDirectX: + StrCpy $0 0 + + done: + Pop $1 + Exch $0 +FunctionEnd + + +; GetWindowsVersion +; +; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ +; Updated by Joost Verburg +; +; Returns on top of stack +; +; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista) +; or +; '' (Unknown Windows Version) +; +; Usage: +; Call GetWindowsVersion +; Pop $R0 +; ; at this point $R0 is "NT 4.0" or whatnot + +Function GetWindowsVersion + + Push $R0 + Push $R1 + + ClearErrors + + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + + IfErrors 0 lbl_winnt + + ; we are not NT + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber + + StrCpy $R1 $R0 1 + StrCmp $R1 '4' 0 lbl_error + + StrCpy $R1 $R0 3 + + StrCmp $R1 '4.0' lbl_win32_95 + StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 + + lbl_win32_95: + StrCpy $R0 '95' + Goto lbl_done + + lbl_win32_98: + StrCpy $R0 '98' + Goto lbl_done + + lbl_win32_ME: + StrCpy $R0 'ME' + Goto lbl_done + + lbl_winnt: + + StrCpy $R1 $R0 1 + + StrCmp $R1 '3' lbl_winnt_x + StrCmp $R1 '4' lbl_winnt_x + + StrCpy $R1 $R0 3 + + StrCmp $R1 '5.0' lbl_winnt_2000 + StrCmp $R1 '5.1' lbl_winnt_XP + StrCmp $R1 '5.2' lbl_winnt_2003 + StrCmp $R1 '6.0' lbl_winnt_vista lbl_error + + lbl_winnt_x: + StrCpy $R0 "NT $R0" 6 + Goto lbl_done + + lbl_winnt_2000: + Strcpy $R0 '2000' + Goto lbl_done + + lbl_winnt_XP: + Strcpy $R0 'XP' + Goto lbl_done + + lbl_winnt_2003: + Strcpy $R0 '2003' + Goto lbl_done + + lbl_winnt_vista: + Strcpy $R0 'Vista' + Goto lbl_done + + lbl_error: + Strcpy $R0 '' + lbl_done: + + Pop $R1 + Exch $R0 + +FunctionEnd \ No newline at end of file Modified: branches/amis3/installer/main/setup-amis3.nsi =================================================================== --- branches/amis3/installer/main/setup-amis3.nsi 2008-03-01 05:23:58 UTC (rev 2358) +++ branches/amis3/installer/main/setup-amis3.nsi 2008-03-01 06:42:33 UTC (rev 2359) @@ -2,9 +2,9 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "AMIS" -!define PRODUCT_VERSION "3.0" +!define PRODUCT_VERSION "3.0 Alpha" !define PRODUCT_PUBLISHER "DAISY for All Project" -!define PRODUCT_WEB_SITE "http://amis.sf.net" +!define PRODUCT_WEB_SITE "http://amisproject.org" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\AMIS.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" @@ -68,7 +68,7 @@ Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${LANG_NAME})" ;this is the name of the installer that gets created. ;for some reason, i vaguely remember that it shouldn't have spaces in the filename. -OutFile "Setup-amis-3-${DEFAULT_LANGPACK}.exe" +OutFile "Setup-amis-3-alpha-${DEFAULT_LANGPACK}.exe" InstallDir "$PROGRAMFILES\AMIS" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show @@ -87,8 +87,9 @@ ;copy the DLLs File "${BIN_DIR}\libambulant_shwin32.dll" File "${BIN_DIR}\AmisAudio.dll" - File "${BIN_DIR}\AmisCore.dll" File "${BIN_DIR}\xerces-c_2_7.dll" + File "${BIN_DIR}\libamplugin_pdtb.dll" + File "${BIN_DIR}\PdtbIePlugin.dll" File "${BIN_DIR}\TransformSample.ax" ;copy the bookmark readme file @@ -99,12 +100,27 @@ SetOutPath "$INSTDIR\settings" File "${BIN_DIR}\settings\amisPrefs.xml" File "${BIN_DIR}\settings\amisRecentBooks.xml" - File "${BIN_DIR}\settings\*.css" + File "${BIN_DIR}\settings\defaultToolbar.xml" + File "${BIN_DIR}\settings\basicToolbar.xml" + File "${BIN_DIR}\settings\resource.h.ini" + ;copy the css files + SetOutPath "$INSTDIR\settings\css" + File "${BIN_DIR}\settings\css\*.css" + SetOutPath "$INSTDIR\settings\css\customStyles" + File "${BIN_DIR}\settings\css\customStyles\*.css" + SetOutPath "$INSTDIR\settings\css\font" + File "${BIN_DIR}\settings\css\font\*.css" + ;copy the images SetOutPath "$INSTDIR\settings\img" - File "${BIN_DIR}\settings\img\*" + File "${BIN_DIR}\settings\img\*.ico" + SetOutPath "$INSTDIR\settings\img\defaultToolbar" + File "${BIN_DIR}\settings\img\defaultToolbar\*.ico" + SetOutPath "$INSTDIR\settings\img\basicToolbar" + File "${BIN_DIR}\settings\img\basicToolbar\*.ico" + ;copy a few default recordings, which give the version and release date SetOutPath "$INSTDIR\settings\lang" File "${BIN_DIR}\settings\lang\version.mp3" @@ -116,9 +132,6 @@ SetOutPath "$INSTDIR\settings\lang" File "${BIN_DIR}\settings\lang\readme.txt" - ;copy the plugins directory readme file - SetOutPath "$INSTDIR\settings\plugins" - File "${BIN_DIR}\settings\plugins\readme.txt" ;copy MFC runtimes SetOverwrite off @@ -164,16 +177,16 @@ Section -AdditionalIcons WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateShortCut "$SMPROGRAMS\AMIS\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" - CreateShortCut "$SMPROGRAMS\AMIS\Uninstall.lnk" "$INSTDIR\Uninstall-amis-26.exe" + CreateShortCut "$SMPROGRAMS\AMIS\Uninstall.lnk" "$INSTDIR\Uninstall-AMIS.exe" SectionEnd ;******************************* ;post-install stuff Section -Post - WriteUninstaller "$INSTDIR\Uninstall-amis-26.exe" + WriteUninstaller "$INSTDIR\Uninstall-AMIS.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\AMIS.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall-AMIS.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\AMIS.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" @@ -184,46 +197,44 @@ ;install init Function .onInit - ;load the sapi install screen file, as we may need it -!insertmacro MUI_INSTALLOPTIONS_EXTRACT "sapipage.ini" -!insertmacro MUI_INSTALLOPTIONS_EXTRACT "filebrowse.ini" + ;load the sapi install screen file, as we may need it + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "sapipage.ini" + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "filebrowse.ini" -;show the splash screen -File /oname=$PLUGINSDIR\splash.bmp "${LOGO_DIR}\amis.bmp" -splash::show 1000 $PLUGINSDIR\splash + ;show the splash screen + File /oname=$PLUGINSDIR\splash.bmp "${LOGO_DIR}\amis.bmp" + splash::show 1000 $PLUGINSDIR\splash -Pop $0 ; $0 has '1' if the user closed the splash screen early, - ; '0' if everything closed normally, and '-1' if some error occurred. + ; $0 has '1' if the user closed the splash screen early, + ; '0' if everything closed normally, and '-1' if some error occurred. + Pop $0 -;ensure that the OS is XP, 2000, or Vista + ;check that the OS is XP, 2000, or Vista + Call GetWindowsVersion + Pop $R0 -Call GetWindowsVersion -Pop $R0 + CheckWinXP: + StrCmp $R0 "XP" End CheckWin2K + CheckWin2K: + StrCmp $R0 "2000" End CheckVista + CheckVista: + StrCmp $R0 "Vista" End OSNotSupported -CheckWinXP: -StrCmp $R0 "XP" End CheckWin2K -CheckWin2K: -StrCmp $R0 "2000" End CheckVista -CheckVista: -StrCmp $R0 "Vista" End OSNotSupported + ;the OS is not supported; warn the user instead of aborting + OSNotSupported: + MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Warning: operating system not supported. AMIS may not work. Do you want to continue?" IDYES +2 + Abort -;the OS is not supported, so abort the installation -OSNotSupported: - MessageBox MB_OK "Operating system not supported." - Abort + ;check for the directx version + Call GetDXVersion + Pop $R3 + IntCmp $R3 900 +3 0 +3 + MessageBox "MB_OK" "Requires DirectX 9.0 or later. Aborting installation." + Abort -;check for the directx version -Call GetDXVersion -Pop $R3 -IntCmp $R3 900 +3 0 +3 -MessageBox "MB_OK" "Requires DirectX 9.0 or later." -Abort - End: FunctionEnd - - ;************************** ;uninstall success Function un.onUninstSuccess @@ -241,23 +252,9 @@ ;*************************** ;uninstall process Section Uninstall -;todo: don't remove bmk dir if it contains *.bmk files +;todo: backup bookmarks Delete "$INSTDIR\*" - Delete "$INSTDIR\settings\plugins\*" - Delete "$INSTDIR\settings\lang\*" - - Delete "$INSTDIR\settings\img\*" - Delete "$INSTDIR\settings\bmk\*.txt" - Delete "$SMPROGRAMS\AMIS\*" - - RMDir "$SMPROGRAMS\AMIS" - RMDir "$INSTDIR\settings\plugins" - - RMDir "$INSTDIR\settings\lang" - RMDir "$INSTDIR\settings\img" - RMDir "$INSTDIR\settings\bmk" RMDir "$INSTDIR" - DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-01 05:23:53
|
Revision: 2358 http://amis.svn.sourceforge.net/amis/?rev=2358&view=rev Author: marisademeglio Date: 2008-02-29 21:23:58 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Looking for memory leaks in XercesSaxParseBase. Found only one known one in UrlInputSource, which seems to be tiny and fixed in size. Otherwise the toolbar, preferences, and recent books XML files are handled without leaking. Books now open in release mode! Fixed a stupid bug. Made some minor improvements here and there while hoping to fix something major (no luck). Fixed a well-formedness problem in amisAccessibleUi.xml Modified Paths: -------------- branches/amis3/AmisCore/include/util/xercesutils.h branches/amis3/AmisCore/src/Error.cpp branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp branches/amis3/AmisCore/src/util/Log.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h branches/amis3/AmisGuiMFC2/include/io/PreferencesFileIO.h branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp branches/amis3/DefaultLangpack/amisAccessibleUi.xml Removed Paths: ------------- branches/amis3/AmisGuiMFC2/include/UiVariables.h branches/amis3/AmisGuiMFC2/src/UiVariables.cpp Modified: branches/amis3/AmisCore/include/util/xercesutils.h =================================================================== --- branches/amis3/AmisCore/include/util/xercesutils.h 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisCore/include/util/xercesutils.h 2008-03-01 05:23:58 UTC (rev 2358) @@ -83,10 +83,9 @@ if (attr_val != NULL) { return_value.assign(attr_val); + XMLString::release(&attr_val); } XMLString::release(&attr_name); - XMLString::release(&attr_val); - return return_value; } Modified: branches/amis3/AmisCore/src/Error.cpp =================================================================== --- branches/amis3/AmisCore/src/Error.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisCore/src/Error.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -41,7 +41,7 @@ void amis::Error::clear() { setCode(amis::OK); - setMessage(""); + mMessage.clear(); } void amis::Error::setCode(amis::ErrorCode code) Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -195,6 +195,7 @@ } loadBookmarks(mpFiles->getBookmarksFilepath()); + amis::util::Log::Instance()->writeMessage("Opened book successfully", "Dtb::open", "AmisCore"); return true; } @@ -304,6 +305,8 @@ amis::dtb::nav::ResolveSmilDataVisitor resolve_smil_visitor; resolve_smil_visitor.resolve(mpNavModel, mpSpine, true); this->mpTextSmilMap = resolve_smil_visitor.getSmilTextMap(); + + return true; } //-------------------------------------------------- Modified: branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp =================================================================== --- branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -77,7 +77,7 @@ //assuming we've made it this far, create a new parser parser = XMLReaderFactory::createXMLReader(); - + //set these parser features to turn off DTD loading and validation parser->setFeature(XMLUni::fgXercesLoadExternalDTD, false); parser->setFeature(XMLUni::fgSAX2CoreValidation, false); @@ -89,11 +89,13 @@ string str; str.assign("Could not creat input source for " + mFilepath.get_url()); mError.setMessage(str); + delete p_input_source; delete parser; XMLPlatformUtils::Terminate(); amis::util::Log::Instance()->writeError(mError, "XercesSaxParseBase::parseFile", "AmisCore"); return false; } + //try-catch block for Xerces parsing try { @@ -101,7 +103,7 @@ parser->setContentHandler(this); parser->setErrorHandler(this); //parser begins parsing; expect SAX Events soon - parser->parse((*p_input_source)); + parser->parse(mFilepath.get_url().c_str());//((*p_input_source)); } catch (const XMLException& toCatch) @@ -112,16 +114,14 @@ str.assign(msg); mError.setMessage(str); XMLString::release(&msg); + delete p_input_source; delete parser; XMLPlatformUtils::Terminate(); amis::util::Log::Instance()->writeError(mError, "XercesSaxParseBase::parseFile", "AmisCore"); return false; } - //delete the input source delete p_input_source; - - //we're done with the parser so delete it and terminate the XML platform utilities delete parser; try @@ -130,11 +130,11 @@ } catch (...)//const XMLException& toCatch) { - //... + amis::util::Log::Instance()->writeWarning("Exception while terminating XMLPlatformUtils", + "XercesSaxParseBase::parseFile", "AmisCore"); } if (mError.getCode() != amis::OK) return false; - amis::util::Log::Instance()->writeMessage("Done parsing.", "XercesSaxParseBase::parseFile", "AmisCore"); return true; Modified: branches/amis3/AmisCore/src/util/Log.cpp =================================================================== --- branches/amis3/AmisCore/src/util/Log.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisCore/src/util/Log.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -117,7 +117,7 @@ if (type != "") mFile<<type<<": "; mFile<<msg; if (origin != "") mFile<<" ["<<origin; - if (library != "") mFile<<" {"<<library<<") "; + if (library != "") mFile<<" ("<<library<<") "; if (origin != "") mFile<<"]"; mFile<<endl; } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-03-01 05:23:58 UTC (rev 2358) @@ -147,9 +147,6 @@ RelativePath=".\include\stdafx.h"> </File> <File - RelativePath=".\include\UiVariables.h"> - </File> - <File RelativePath=".\include\UrlInputSource.h"> <FileConfiguration Name="Debug|Win32"> @@ -433,21 +430,6 @@ UsePrecompiledHeader="1"/> </FileConfiguration> </File> - <File - RelativePath=".\src\UiVariables.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> <Filter Name="io" Filter=""> Deleted: branches/amis3/AmisGuiMFC2/include/UiVariables.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/UiVariables.h 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/include/UiVariables.h 2008-03-01 05:23:58 UTC (rev 2358) @@ -1,61 +0,0 @@ -/* -AMIS: Adaptive Multimedia Information System -Software for playing DAISY books -Homepage: http://amis.sf.net - -Copyright (C) 2004-2007 DAISY for All Project - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef UIVARIABLES_H -#define UIVARIABLES_H - -#include "AmisCore.h" - -namespace amis -{ -namespace uiVariables -{ -class Conditions -{ -protected: - Conditions(); -public: - static Conditions* Instance(); - DestroyInstance(); - ~Conditions(); - - bool lookupValue(std::string); - void setValue(std::string, bool); - amis::BooleanMap* getValues(); -private: - static Conditions* pinstance(); - amis::BooleanMap mValues; -}; - -class PromptVars -{ -protected: - PromptVars(); -public: - static PromptVars* Instance(); - DestroyInstance(); - ~PromptVars(); -private: - static PromptVars* pinstance(); -}; -} -} -#endif \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/include/gui/toolbar/Toolbar.h 2008-03-01 05:23:58 UTC (rev 2358) @@ -123,6 +123,7 @@ afx_msg void OnDestroy(); private: HICON makeIcon(ToolbarButton*); + void deleteAll(); CToolTipCtrl* mpToolTips; CImageList m_images; ToolbarSettings* mpSettings; Modified: branches/amis3/AmisGuiMFC2/include/io/PreferencesFileIO.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/io/PreferencesFileIO.h 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/include/io/PreferencesFileIO.h 2008-03-01 05:23:58 UTC (rev 2358) @@ -47,12 +47,8 @@ public: PreferencesFileIO(); ~PreferencesFileIO(); - bool readFromFile(string); bool writeToFile(string, amis::Preferences*); - amis::Preferences* getPreferences(); - - //SAX METHODS void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, @@ -61,7 +57,6 @@ const XMLCh* const localname, const XMLCh* const qname){/*we don't need this function*/} void characters(const XMLCh *const, const unsigned int){/*we don't need this function*/} - /*end of sax methods*/ private: void writeData(); Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -75,7 +75,6 @@ if (!Dtb::open(filename, bookmarksPath)) return false; //turn on all skippable options to start with - updateCustomTestStates(true); if (getDaisyVersion() == DAISY_202) makeAllNavContainerLabelsHumanReadable(); @@ -108,7 +107,6 @@ void DtbWithHooks::updateCustomTestStates(bool playAll) { amis::dtb::CustomTestSet* p_tests = this->getCustomTestSet(); - if (p_tests == NULL) return; //turn on all options in ambulant (they are off by default) Deleted: branches/amis3/AmisGuiMFC2/src/UiVariables.cpp =================================================================== Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -136,10 +136,8 @@ //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(); @@ -262,7 +260,6 @@ string prefs_path = "./settings/amisPrefs.xml"; prefs_path = amis::util::FilePathTools::goRelativePath(theApp.getAppPath(), prefs_path); prefs_io.readFromFile(prefs_path); - //read the recent books list string recent_books_path = "./settings/amisRecentBooks.xml"; recent_books_path = amis::util::FilePathTools::goRelativePath(theApp.getAppPath(), recent_books_path); Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -147,15 +147,19 @@ return -1; } - //create the default toolbar + //Toolbar data CRect rect; GetWindowRect(rect); + amis::io::ToolbarIO toolbar_reader; + ambulant::net::url toolbar_file; + amis::gui::toolbar::ToolbarSettings* p_settings = NULL; + DWORD align; + //create the default toolbar amis::util::Log::Instance()->writeMessage("Loading default toolbar", "CMainFrame::OnCreate", "AmisGuiMFC2"); - amis::io::ToolbarIO toolbar_reader; - ambulant::net::url toolbar_file = ambulant::net::url::from_filename("./settings/defaultToolbar.xml"); + toolbar_file= ambulant::net::url::from_filename("./settings/defaultToolbar.xml"); toolbar_file = toolbar_file.join_to_base(ambulant::net::url::from_filename(theApp.getAppPath())); toolbar_reader.readFromFile(toolbar_file.get_file()); - amis::gui::toolbar::ToolbarSettings* p_settings = toolbar_reader.getToolbarSettings(); + p_settings = toolbar_reader.getToolbarSettings(); mDefaultToolbar.setSettings(p_settings); if (!mDefaultToolbar.Create(WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, rect, this, mSidebar.GetDlgCtrlID() + 1)) @@ -168,7 +172,6 @@ mDefaultToolbar.EnableToolTips(TRUE); //create the default rebar (toolbar container) - DWORD align; if (p_settings->getPlacement() == amis::gui::toolbar::TOP) align = CBRS_TOP; else align = CBRS_BOTTOM; if (mDefaultRebar.Create(this, 0, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | @@ -212,7 +215,7 @@ } mBasicRebar.AddBar(&mBasicToolbar); mBasicRebar.ShowWindow(SW_HIDE); - + // Delete these three lines if you don't want the toolbar to be dockable EnableDocking(CBRS_ALIGN_ANY); #ifdef _SCB_REPLACE_MINIFRAME Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -43,10 +43,6 @@ #include "ambulant/gui/dx/dx_player.h" #include "ambulant/gui/dx/dx_wmuser.h" -// DG Player -//#include "ambulant/gui/dg/dg_player.h" -//#include "ambulant/gui/dg/dg_wmuser.h" - #include "ambulant/common/preferences.h" #include "ambulant/lib/logger.h" #include "ambulant/lib/textptr.h" Modified: branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -22,6 +22,7 @@ #include "stdafx.h" #include "gui/toolbar/Toolbar.h" +#include "gui/AmisApp.h" using namespace amis::gui::toolbar; @@ -89,6 +90,8 @@ } ToolbarToggleButton::~ToolbarToggleButton() { + if (mpButtonOne != NULL) delete mpButtonOne; + if (mpButtonTwo != NULL) delete mpButtonTwo; } //add a button as the first or second (or don't add it if there are no empty slots) void ToolbarToggleButton::addButton(ToolbarButton* pButton) @@ -182,11 +185,7 @@ int count = 0; for (int i = 0; i<mItems.size(); i++) { - if (mItems[i]->getType() == BUTTON || - mItems[i]->getType() == TOGGLE) - { - count++; - } + if (mItems[i]->getType() == BUTTON || mItems[i]->getType() == TOGGLE) count++; } return count; } @@ -205,11 +204,16 @@ } Toolbar::~Toolbar() { + deleteAll(); +} +void Toolbar::deleteAll() +{ + m_images.DeleteImageList(); if (mpSettings != NULL) delete mpSettings; } void Toolbar::OnDestroy() { - if (mpSettings != NULL) delete mpSettings; + deleteAll(); } void Toolbar::setSettings(ToolbarSettings* pSettings) { @@ -243,11 +247,9 @@ int Toolbar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CToolBarCtrl::OnCreate(lpCreateStruct) == -1) return -1; - //50 should be MAX_ANYTHING m_images.Create(mpSettings->getButtonWidth(), mpSettings->getButtonHeight(), - ILC_COLOR24 | ILC_MASK, mpSettings->getNumberOfButtons(), 50); - //50 should be MAX_ANYTHING - HICON hIcon[50]; + ILC_COLOR24 | ILC_MASK, mpSettings->getNumberOfButtons(), AMIS_MAX_ANYTHING); + HICON hIcon[AMIS_MAX_ANYTHING]; int i = 0; int j = 0; ToolbarItems items = mpSettings->getItems(); @@ -275,8 +277,7 @@ this->SetImageList(&m_images); this->SetHotImageList(&m_images); - //50 should be MAX_ANYTHING - TBBUTTON buttons[50]; + TBBUTTON buttons[AMIS_MAX_ANYTHING]; j = 0; for (i=0; i<items.size(); i++) @@ -311,7 +312,7 @@ j+=2; } } - + this->AddButtons(items.size(), &buttons[0]); this->AutoSize(); Modified: branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -57,16 +57,9 @@ PreferencesFileIO::PreferencesFileIO() { } - PreferencesFileIO::~PreferencesFileIO() { } - -amis::Preferences* PreferencesFileIO::getPreferences() -{ - return mpPrefs; -} - //this file is local! and the address does not look like a URL. bool PreferencesFileIO::readFromFile(string filepath) { Modified: branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp 2008-03-01 05:23:58 UTC (rev 2358) @@ -42,17 +42,14 @@ #include <xercesc/sax2/XMLReaderFactory.hpp> //end xerces includes - using namespace amis::io; ToolbarIO::ToolbarIO() { } - ToolbarIO::~ToolbarIO() { } - amis::gui::toolbar::ToolbarSettings* ToolbarIO::getToolbarSettings() { return mpToolbarSettings; @@ -63,7 +60,13 @@ { mbFlagInToggle = false; mpCurrentToggle = NULL; - mItems.clear(); + int sz = mItems.size(); + for (int i = sz - 1; i>=0; i--) + { + amis::gui::toolbar::ToolbarItem* p_item = mItems[i]; + mItems.pop_back(); + delete p_item; + } mpToolbarSettings = NULL; ambulant::net::url tmp_url = ambulant::net::url::from_filename(filepath); bool ret = parseFile(&tmp_url); @@ -126,7 +129,6 @@ amis::gui::toolbar::ToolbarSeparator* p_separator = new amis::gui::toolbar::ToolbarSeparator(); mpToolbarSettings->addItem(p_separator); } - XMLString::release(&node_name); } @@ -134,11 +136,8 @@ const XMLCh* const localname, const XMLCh* const qname) { - char* node_name = XMLString::transcode(qname); - - if (strcmp(node_name, "toggle") == 0) - mbFlagInToggle = false; - + char* node_name = XMLString::transcode(qname); + if (strcmp(node_name, "toggle") == 0) mbFlagInToggle = false; XMLString::release(&node_name); } Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-02-29 18:08:28 UTC (rev 2357) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-01 05:23:58 UTC (rev 2358) @@ -239,9 +239,8 @@ <caption> <promptVar name="PAGE_STYLE_NAME"/> </caption> - </list> - </action> - </switch> + </list> + </action> <mnemonic> <text id="xx">P</text> <audio src=""/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-02-29 18:08:23
|
Revision: 2357 http://amis.svn.sourceforge.net/amis/?rev=2357&view=rev Author: daniel_weck Date: 2008-02-29 10:08:28 -0800 (Fri, 29 Feb 2008) Log Message: ----------- fixed compile errors Modified Paths: -------------- branches/amis3/AmisAudio/src/AmisAudio.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp Modified: branches/amis3/AmisAudio/src/AmisAudio.cpp =================================================================== --- branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-02-29 17:55:58 UTC (rev 2356) +++ branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-02-29 18:08:28 UTC (rev 2357) @@ -83,9 +83,8 @@ void AmisAudio::play(const char * url,char* clipBegin,char* clipEnd) { if (m_playerToKill != NULL) { - delete m_playerToKill; - - } + //delete m_playerToKill; + } m_playerToKill=0; if (m_player) { delete m_player; // stop() and release_player() handled by destructor Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-29 17:55:58 UTC (rev 2356) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-29 18:08:28 UTC (rev 2357) @@ -133,66 +133,6 @@ //remember that other enabling/disabling is done in CMainFrame's ON_UPDATE_COMMAND_UI handlers } -void MenuManip::setupMenusNothingOpen() -{ - //get the main menu - CMenu* p_main_menu = NULL; - p_main_menu = MainWndParts::Instance()->mpMainFrame->GetMenu(); - assert(p_main_menu); - - return; - - //play menu - p_main_menu->EnableMenuItem(2, MF_BYPOSITION | MF_GRAYED); - - //navigate menu - p_main_menu->EnableMenuItem(3, MF_BYPOSITION | MF_GRAYED); - - //bookmarks menu - p_main_menu->EnableMenuItem(4, MF_BYPOSITION | MF_GRAYED); - - //info menu - p_main_menu->EnableMenuItem(5, MF_BYPOSITION | MF_GRAYED); - - //remember that other enabling/disabling is done in CMainFrame's ON_UPDATE_COMMAND_UI handlers -} - -void MenuManip::setupMenusSomethingOpen(amis::dtb::BookmarkSet* pBookmarks) -{ - //get the main menu - CMenu* p_main_menu = NULL; - p_main_menu = MainWndParts::Instance()->mpMainFrame->GetMenu(); - assert(p_main_menu); - - - //play menu - p_main_menu->EnableMenuItem(2, MF_BYPOSITION | MF_ENABLED); - - /*p_menu = NULL; - p_menu = p_main_menu->GetSubMenu(2); - assert(p_menu); - p_menu->EnableMenuItem(ID_MENU_PLAY_FASTER, MF_BYCOMMAND | MF_ENABLED); - p_menu->EnableMenuItem(ID_MENU_PLAY_SLOWER, MF_BYCOMMAND | MF_ENABLED); - p_menu->EnableMenuItem(ID_MENU_PLAY_NORMALSPEED, MF_BYCOMMAND | MF_ENABLED); - p_menu->EnableMenuItem(ID_MENU_PLAY_VOLDOWN, MF_BYCOMMAND | MF_ENABLED); - p_menu->EnableMenuItem(ID_MENU_PLAY_VOLUP, MF_BYCOMMAND | MF_ENABLED); - */ - - //navigate menu - p_main_menu->EnableMenuItem(3, MF_BYPOSITION | MF_ENABLED); - - //bookmarks menu - p_main_menu->EnableMenuItem(4, MF_BYPOSITION | MF_ENABLED); - - //info menu - p_main_menu->EnableMenuItem(5, MF_BYPOSITION | MF_ENABLED); - - setupNavigationOptions(); - loadBookmarks(pBookmarks); - - //remember that other enabling/disabling is done in CMainFrame's ON_UPDATE_COMMAND_UI handlers -} - void MenuManip::setViewItemCheckmark(bool isChecked, UINT itemId) { CMenu* p_menu = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-02-29 17:56:25
|
Revision: 2356 http://amis.svn.sourceforge.net/amis/?rev=2356&view=rev Author: daniel_weck Date: 2008-02-29 09:55:58 -0800 (Fri, 29 Feb 2008) Log Message: ----------- resolved conflicts Modified Paths: -------------- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-29 17:51:15 UTC (rev 2355) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-29 17:55:58 UTC (rev 2356) @@ -32,7 +32,7 @@ #include "io/BookmarksFileIO.h" #include "io/ToolbarIO.h" #include "util/Log.h" - + #include "gui/self-voicing/dialogs/MenuVoicing.h" #ifdef _DEBUG @@ -72,26 +72,26 @@ ON_UPDATE_COMMAND_UI(ID_AMIS_CLOSE_BOOK, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_SHOW_READING_OPTIONS, OnUpdateCmdUiInfoSkip) ON_UPDATE_COMMAND_UI(ID_AMIS_SLOWER, OnUpdateCmdUiPlaySlower) - ON_UPDATE_COMMAND_UI(ID_AMIS_FOCUS_ON_SIDEBAR, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_FOCUS_ON_TEXT, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_RESET_HIGHLIGHT_COLORS, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_AUDIO_SELFVOICING_PLAYBACK, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_NO_PAGE_STYLES, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_PLAYPAUSE, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_ESCAPE, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_RESET_SPEED, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_INCREASE_VOLUME, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_DECREASE_VOLUME, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_SECTION, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_SECTION, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_PHRASE, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PHRASE, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_FIND_IN_TEXT, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_SHOW_PUBLICATION_SUMMARY, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PAGE_STYLE, OnUpdateCmdUiGeneral) - //TODO: make these more intelligent - ON_UPDATE_COMMAND_UI(ID_AMIS_INCREASE_SECTION_DEPTH, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_FOCUS_ON_SIDEBAR, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_FOCUS_ON_TEXT, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_RESET_HIGHLIGHT_COLORS, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_TOGGLE_AUDIO_SELFVOICING_PLAYBACK, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_NO_PAGE_STYLES, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_PLAYPAUSE, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_ESCAPE, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_RESET_SPEED, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_INCREASE_VOLUME, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_DECREASE_VOLUME, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_SECTION, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_SECTION, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_PHRASE, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PHRASE, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_FIND_IN_TEXT, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_SHOW_PUBLICATION_SUMMARY, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PAGE_STYLE, OnUpdateCmdUiGeneral) + //TODO: make these more intelligent + ON_UPDATE_COMMAND_UI(ID_AMIS_INCREASE_SECTION_DEPTH, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_DECREASE_SECTION_DEPTH, OnUpdateCmdUiGeneral) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -102,7 +102,7 @@ ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; - + using namespace amis::gui::spoken; amis::gui::MenuVoicing* mMenuVoicing; @@ -276,6 +276,8 @@ CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); + return; + USES_CONVERSION; if (pPopupMenu == NULL) @@ -310,11 +312,11 @@ //is sidebar visible? if (MainWndParts::Instance()->mpSidebar->IsVisible() == TRUE) { - pPopupMenu->CheckMenuItem(0, MF_BYPOSITION | MF_CHECKED); + //pPopupMenu->CheckMenuItem(0, MF_BYPOSITION | MF_CHECKED); } else { - pPopupMenu->CheckMenuItem(0, MF_BYPOSITION | MF_UNCHECKED); + //pPopupMenu->CheckMenuItem(0, MF_BYPOSITION | MF_UNCHECKED); } } @@ -342,6 +344,7 @@ void CMainFrame::OnInitMenu(CMenu* pMenu) { + TRACE("\n\n\n\HERE xxxxxxxxxxxxxxxx"); CMDIFrameWnd::OnInitMenu(pMenu); } @@ -391,12 +394,35 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { + if (pMsg->message == WM_KEYUP) + { + CWnd* cwnd = this->GetFocus(); + if (pMsg->wParam == VK_ESCAPE) { + if (m_lastOpenPopupMenu != NULL) { + m_lastOpenPopupMenu = NULL; + } + TRACE("\n---------------DANOUL\n\n"); + TRACE(L"%d", cwnd); + } + } if (amis::Preferences::Instance()->getIsSelfVoicing() == true && (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP)) { CWnd* cwnd = this->GetFocus(); if (cwnd) mCommonPreTranslateMessageHandler->handle(true, NULL, pMsg, (cwnd == NULL ? -1 : cwnd->GetDlgCtrlID())); } + if (pMsg->message == WM_CANCELMODE) { + TRACE("\n---------------DANOUL\n\n"); + TRACE(L"%d", pMsg->message); + } + if (pMsg->wParam == WM_CANCELMODE) { + TRACE("\n---------------DANOUL\n\n"); + TRACE(L"%d", pMsg->wParam); + } + if (pMsg->lParam == WM_CANCELMODE) { + TRACE("\n---------------DANOUL\n\n"); + TRACE(L"%d", pMsg->lParam); + } return CFrameWnd::PreTranslateMessage(pMsg); } @@ -469,14 +495,14 @@ } void CMainFrame::OnUpdateCmdUiGeneral(CCmdUI* pCmdUi) -{ - pCmdUi->Enable(theApp.isBookOpen()); +{ + pCmdUi->Enable(theApp.isBookOpen()); } void CMainFrame::OnUpdateCmdUiInfoSkip(CCmdUI* pCmdUi) { - if (theApp.isBookOpen()) - { - bool has_reading_options = amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() != NULL && + if (theApp.isBookOpen()) + { + bool has_reading_options = amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() != NULL && amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()->getLength() > 0; pCmdUi->Enable(has_reading_options); } Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-29 17:51:15 UTC (rev 2355) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-29 17:55:58 UTC (rev 2356) @@ -132,6 +132,67 @@ } //remember that other enabling/disabling is done in CMainFrame's ON_UPDATE_COMMAND_UI handlers } + +void MenuManip::setupMenusNothingOpen() +{ + //get the main menu + CMenu* p_main_menu = NULL; + p_main_menu = MainWndParts::Instance()->mpMainFrame->GetMenu(); + assert(p_main_menu); + + return; + + //play menu + p_main_menu->EnableMenuItem(2, MF_BYPOSITION | MF_GRAYED); + + //navigate menu + p_main_menu->EnableMenuItem(3, MF_BYPOSITION | MF_GRAYED); + + //bookmarks menu + p_main_menu->EnableMenuItem(4, MF_BYPOSITION | MF_GRAYED); + + //info menu + p_main_menu->EnableMenuItem(5, MF_BYPOSITION | MF_GRAYED); + + //remember that other enabling/disabling is done in CMainFrame's ON_UPDATE_COMMAND_UI handlers +} + +void MenuManip::setupMenusSomethingOpen(amis::dtb::BookmarkSet* pBookmarks) +{ + //get the main menu + CMenu* p_main_menu = NULL; + p_main_menu = MainWndParts::Instance()->mpMainFrame->GetMenu(); + assert(p_main_menu); + + + //play menu + p_main_menu->EnableMenuItem(2, MF_BYPOSITION | MF_ENABLED); + + /*p_menu = NULL; + p_menu = p_main_menu->GetSubMenu(2); + assert(p_menu); + p_menu->EnableMenuItem(ID_MENU_PLAY_FASTER, MF_BYCOMMAND | MF_ENABLED); + p_menu->EnableMenuItem(ID_MENU_PLAY_SLOWER, MF_BYCOMMAND | MF_ENABLED); + p_menu->EnableMenuItem(ID_MENU_PLAY_NORMALSPEED, MF_BYCOMMAND | MF_ENABLED); + p_menu->EnableMenuItem(ID_MENU_PLAY_VOLDOWN, MF_BYCOMMAND | MF_ENABLED); + p_menu->EnableMenuItem(ID_MENU_PLAY_VOLUP, MF_BYCOMMAND | MF_ENABLED); + */ + + //navigate menu + p_main_menu->EnableMenuItem(3, MF_BYPOSITION | MF_ENABLED); + + //bookmarks menu + p_main_menu->EnableMenuItem(4, MF_BYPOSITION | MF_ENABLED); + + //info menu + p_main_menu->EnableMenuItem(5, MF_BYPOSITION | MF_ENABLED); + + setupNavigationOptions(); + loadBookmarks(pBookmarks); + + //remember that other enabling/disabling is done in CMainFrame's ON_UPDATE_COMMAND_UI handlers +} + void MenuManip::setViewItemCheckmark(bool isChecked, UINT itemId) { CMenu* p_menu = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |