Thread: [Amis-vcs] SF.net SVN: amis: [2305] branches/amis3 (Page 3)
Brought to you by:
julienq,
marisademeglio
From: <mar...@us...> - 2008-02-03 06:07:06
|
Revision: 2305 http://amis.svn.sourceforge.net/amis/?rev=2305&view=rev Author: marisademeglio Date: 2008-02-02 22:07:11 -0800 (Sat, 02 Feb 2008) Log Message: ----------- Removed some Visual Studio-generated TODO's (which aren't really "TODO"s) Updated some of our TODO's so that they appear on one line and can be picked up by the todo-scraper More adjustments to the GUI; preparing new XML file too Removed AudioPromptReader files since it hasn't been used for several versions now. Added and implemented a preference to disable the screensaver if AMIS is reading. This had been a user request. Modified Paths: -------------- branches/amis3/AmisAudio/StdAfx.cpp branches/amis3/AmisAudio/StdAfx.h branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp branches/amis3/AmisCore/src/io/NccFileReader.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/Preferences.h branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h branches/amis3/AmisGuiMFC2/resource.h branches/amis3/AmisGuiMFC2/src/Preferences.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/HtmlDoc.cpp branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp branches/amis3/bin/settings/amisPrefs.xml.default Removed Paths: ------------- branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.cpp branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.h Modified: branches/amis3/AmisAudio/StdAfx.cpp =================================================================== --- branches/amis3/AmisAudio/StdAfx.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisAudio/StdAfx.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -4,5 +4,5 @@ #include "stdafx.h" -// TODO: reference any additional headers you need in STDAFX.H +// reference any additional headers you need in STDAFX.H // and not in this file Modified: branches/amis3/AmisAudio/StdAfx.h =================================================================== --- branches/amis3/AmisAudio/StdAfx.h 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisAudio/StdAfx.h 2008-02-03 06:07:11 UTC (rev 2305) @@ -105,7 +105,7 @@ #include <windows.h> -// TODO: reference additional headers your program requires here +// reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. Modified: branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -62,8 +62,7 @@ int cnt; int i; - //@todo - //move level and parent data printouts to NavPoint eventually + //@todo: move level and parent data printouts to NavPoint eventually // print out the correct number of tabs for (i = 0; i<level; i++) Modified: branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -96,8 +96,7 @@ } -//@todo -//complete this function +//@todo: complete this function amis::dtb::nav::NavPoint* amis::dtb::nav::NavPoint::previous() { return NULL; Modified: branches/amis3/AmisCore/src/io/NccFileReader.cpp =================================================================== --- branches/amis3/AmisCore/src/io/NccFileReader.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisCore/src/io/NccFileReader.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -161,8 +161,7 @@ p_text->setTextString(mTempChars); p_media_label->setText(p_text); - //@todo - //set other text properties (RTL, lang, etc) + //@todo: set other text properties (RTL, lang, etc) } } } Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-03 06:07:11 UTC (rev 2305) @@ -141,7 +141,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 249 TOPMARGIN, 7 - BOTTOMMARGIN, 199 + BOTTOMMARGIN, 216 END END #endif // APSTUDIO_INVOKED @@ -178,10 +178,13 @@ , CHECKED MENUITEM "&Basic View Mode\tF11", ID_MENU_VIEW_BASIC MENUITEM SEPARATOR - MENUITEM "High &Contrast\tCtrl+S", ID_MENU_VIEW_CONTRAST - , CHECKED + POPUP "&Page Style" + BEGIN + MENUITEM "Empty", ID_PAGESTYLES_EMPTY + , INACTIVE + END MENUITEM "&Increase Font Size", ID_MENU_VIEW_LARGEFONT - MENUITEM "&Reset Font Size", ID_MENU_VIEW_RESETFONT + MENUITEM "&Decrease Font Size", ID_MENU_VIEW_DECREASEFONT END POPUP "&Play" BEGIN @@ -369,10 +372,10 @@ PUSHBUTTON "Cancel",IDCANCEL,127,49,50,14 END -IDD_PREFERENCES DIALOGEX 0, 0, 256, 206 +IDD_PREFERENCES DIALOGEX 0, 0, 256, 223 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Preferences" +CAPTION "d" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "Use self-voicing",IDC_ISSELFVOICING,"Button", @@ -380,23 +383,26 @@ LTEXT "Select TTS voice:",IDC_SELTTSLABEL,7,22,242,8 COMBOBOX IDC_TTSVOICES,7,35,108,88,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Pause audio when switching applications", - IDC_PAUSEONLOSTFOCUS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,59,242,10 CONTROL "Highlight text as it is read aloud",IDC_HIGHLIGHTTEXT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,78,242,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,59,242,10 CONTROL "Load the most recently read book on startup", IDC_LOADLASTBOOK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7, - 98,242,10 + 76,242,10 CONTROL "Start in basic view mode",IDC_STARTINBASICVIEW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,117,242,10 - LTEXT "You are currently using AMIS in:",IDC_CURRLANG,7,140, + BS_AUTOCHECKBOX | WS_TABSTOP,7,94,242,10 + CONTROL "Pause audio when switching applications", + IDC_PAUSEONLOSTFOCUS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,112,242,10 + CONTROL "Disable the screensaver while reading", + IDC_DISABLESCREENSAVER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,130,242,10 + LTEXT "You are currently using AMIS in:",IDC_CURRLANG,7,153, 242,8 - ICON IDI_LANGICON,IDC_LANGICON,127,151,21,20 - DEFPUSHBUTTON "OK",IDOK,57,185,50,14 - PUSHBUTTON "Cancel",IDCANCEL,112,185,50,14 - COMBOBOX IDC_INSTALLEDLANGUAGES,7,153,108,88,CBS_DROPDOWNLIST | + COMBOBOX IDC_INSTALLEDLANGUAGES,7,166,108,88,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + ICON IDI_LANGICON,IDC_LANGICON,127,164,20,20 + DEFPUSHBUTTON "OK",IDOK,57,202,50,14 + PUSHBUTTON "Cancel",IDCANCEL,112,202,50,14 END @@ -634,6 +640,7 @@ BEGIN ID_MENU_PLAYPAUSE "Start synchronized playback." ID_MENU_FILE_CLOSE "Close the publication." + ID_MENU_VIEW_DECREASEFONT "Decrease the font size" END #endif // English (U.S.) resources Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-02-03 06:07:11 UTC (rev 2305) @@ -877,24 +877,6 @@ RelativePath=".\AmisSelfVoicing\AccessibleUI\AudioPrompt.h"> </File> <File - RelativePath=".\AmisSelfVoicing\AccessibleUI\AudioPromptReader.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> - <File - RelativePath=".\AmisSelfVoicing\AccessibleUI\AudioPromptReader.h"> - </File> - <File RelativePath=".\AmisSelfVoicing\AccessibleUI\Container.cpp"> <FileConfiguration Name="Debug|Win32"> Deleted: branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -1,328 +0,0 @@ -/* -AmisGuiMFC: AMIS executable module and primary UI -Copyright (C) 2004 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 -*/ - -/*! -This module was adapted to read audio prompts that are either a single clip -or made up of a sequence of clips and TTS renderings of variables -*/ - -//SYSTEM INCLUDES -#include <string> -#include <vector> - -#include "afxpriv.h" - -//PROJECT INCLUDES -#include <xercesc/util/XMLString.hpp> -#include <xercesc/sax2/Attributes.hpp> -#include <xercesc/sax/SAXParseException.hpp> -#include <xercesc/sax/SAXException.hpp> -#include <xercesc/sax/HandlerBase.hpp> - -#include <xercesc/util/PlatformUtils.hpp> -#include <xercesc/util/TransService.hpp> -#include <xercesc/sax2/SAX2XMLReader.hpp> -#include <xercesc/sax2/XMLReaderFactory.hpp> - -//LOCAL INCLUDES -#include "AudioPromptReader.h" - -using namespace std; -using namespace amis::gui::spoken; - -AudioPromptReader::AudioPromptReader() -{ - -} - -AudioPromptReader::~AudioPromptReader() -{ - -} - - -void AudioPromptReader::loadFile(string filepath) -{ - const char* cp_file = NULL; - char* xerces_msg = NULL; - SAX2XMLReader* parser = NULL; - - - cp_file = filepath.c_str(); - - //clear any existing data - AudioPromptCol::Instance()->clearAll(); - - AudioPromptCol::Instance()->mFilePath = filepath; - - //try-catch block for Xerces platform utilities - try - { - XMLPlatformUtils::Initialize(); - } - catch (const XMLException& toCatch) - { - xerces_msg = XMLString::transcode(toCatch.getMessage()); //DANIEL MEMORY LEAK VERIFIED - // cout<<"Xerces said: "<<xerces_msg<<endl; - XMLString::release(&xerces_msg); //DANIEL MEMORY LEAK VERIFIED - return; - } - - //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); - - - //try-catch block for Xerces parsing - try - { - parser->setContentHandler(this); - parser->setErrorHandler(this); - //parser begins fileparse. expect SAX Events soon. - parser->parse(cp_file); - } - catch (const XMLException& toCatch) - { - xerces_msg = XMLString::transcode(toCatch.getMessage()); //DANIEL MEMORY LEAK VERIFIED - //cout<<"Xerces said: "<<xerces_msg<<endl; - XMLString::release(&xerces_msg); //DANIEL MEMORY LEAK VERIFIED - //terminate the platform utilities - delete parser; - XMLPlatformUtils::Terminate(); - return; - } - - //we're done with the parser so delete it and terminate the XML platform utilities - delete parser; - XMLPlatformUtils::Terminate(); -} - -//-------------------------------------------------- -//! (SAX Event) analyze the element type and build a gui -//-------------------------------------------------- -void AudioPromptReader::startElement(const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname, - const Attributes& attributes) -{ - - USES_CONVERSION; - - //local variables - char* element_name = NULL; - string tmp_string; - - //get the element name as a string - element_name = XMLString::transcode(qname); //DANIEL MEMORY LEAK VERIFIED - - if (strcmp(element_name, "prompt") == 0) - { - mpCurrentPrompt = new AudioPrompt(); - - XMLCh* txt_NAME = XMLString::transcode("name"); //DANIEL MEMORY LEAK VERIFIED - char* name = XMLString::transcode(attributes.getValue(txt_NAME)); //DANIEL MEMORY LEAK VERIFIED - XMLString::release(&txt_NAME); //DANIEL MEMORY LEAK VERIFIED - - mpCurrentPrompt->mName.assign(name); - XMLString::release(&name); //DANIEL MEMORY LEAK VERIFIED - } - - else if(strcmp(element_name, "var")==0) - { - AudioPromptComponent* p_prompt_var = NULL; - p_prompt_var = new AudioPromptComponent; - - - XMLCh* txt_NAME = XMLString::transcode("name"); //DANIEL MEMORY LEAK VERIFIED - char* name = XMLString::transcode(attributes.getValue(txt_NAME)); //DANIEL MEMORY LEAK VERIFIED - XMLString::release(&txt_NAME); //DANIEL MEMORY LEAK VERIFIED - - p_prompt_var->mVarName.assign(name); - XMLString::release(&name); //DANIEL MEMORY LEAK VERIFIED - - p_prompt_var->mRuntimeValue = L""; - p_prompt_var->mbIsVar = true; - - p_prompt_var->mTextAlternative = L""; - - mpCurrentPrompt->mSequence.push_back(p_prompt_var); - } - - - else if (strcmp(element_name, "audio") == 0) - { - amis::AudioNode* p_audio = NULL; - p_audio = new amis::AudioNode(); - - AudioPromptComponent* p_pc = NULL; - p_pc = new AudioPromptComponent; - - char* src = NULL; - XMLCh* txt_SRC = XMLString::transcode("src"); //DANIEL MEMORY LEAK VERIFIED - src = XMLString::transcode(attributes.getValue(txt_SRC)); //DANIEL MEMORY LEAK VERIFIED - XMLString::release(&txt_SRC); //DANIEL MEMORY LEAK VERIFIED - - char* clipBegin = NULL; - XMLCh* txt_CLIPBEGIN = XMLString::transcode("clipBegin"); //DANIEL MEMORY LEAK VERIFIED - clipBegin = XMLString::transcode(attributes.getValue(txt_CLIPBEGIN)); //DANIEL MEMORY LEAK VERIFIED - XMLString::release(&txt_CLIPBEGIN); //DANIEL MEMORY LEAK VERIFIED - - char* clipEnd = NULL; - XMLCh* txt_CLIPEND = XMLString::transcode("clipEnd"); //DANIEL MEMORY LEAK VERIFIED - clipEnd = XMLString::transcode(attributes.getValue(txt_CLIPEND)); //DANIEL MEMORY LEAK VERIFIED - XMLString::release(&txt_CLIPEND); //DANIEL MEMORY LEAK VERIFIED - - if (src != NULL) { - string str; - str.assign(src); - XMLString::release(&src); //DANIEL MEMORY LEAK VERIFIED - p_audio->setSrc(str); - } - if (clipBegin != NULL) { - string str; - str.assign(clipBegin); - XMLString::release(&clipBegin); //DANIEL MEMORY LEAK VERIFIED - p_audio->setClipBegin(str); - } - if (clipEnd != NULL) { - string str; - str.assign(clipEnd); - XMLString::release(&clipEnd); //DANIEL MEMORY LEAK VERIFIED - p_audio->setClipEnd(str); - } - - p_pc->mbIsVar = false; - p_pc->mRuntimeValue = L""; - p_pc->mVarName = ""; - p_pc->mpMedia = p_audio; - - char* alt_text = NULL; - - XMLCh* txt_TXT = XMLString::transcode("txt"); //DANIEL MEMORY LEAK VERIFIED - alt_text = - XMLString::transcode(attributes.getValue(txt_TXT)); //DANIEL MEMORY LEAK VERIFIED - XMLString::release(&txt_TXT); //DANIEL MEMORY LEAK VERIFIED - - if (alt_text != NULL) { - p_pc->mTextAlternative.assign(A2CW(alt_text)); - XMLString::release(&alt_text); //DANIEL MEMORY LEAK VERIFIED - } - - mpCurrentPrompt->mSequence.push_back(p_pc); - } - - else - { - //empty - } - - XMLString::release(&element_name); //DANIEL MEMORY LEAK VERIFIED - - - -} //end startElement function - -//-------------------------------------------------- -//! (SAX Event) close this element -//-------------------------------------------------- -void AudioPromptReader::endElement( const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname) -{ - //local variable - char* element_name = XMLString::transcode(qname); //DANIEL MEMORY LEAK VERIFIED - - - if (strcmp(element_name, "prompt") == 0) - { - AudioPromptCol::Instance()->addPrompt(mpCurrentPrompt); - } - else - { - //empty - } - - XMLString::release(&element_name); //DANIEL MEMORY LEAK VERIFIED - -} - - - -//-------------------------------------------------- -//! (SAX Event) error -//:TODO: handle SAX error properly -//-------------------------------------------------- -void AudioPromptReader::error(const SAXParseException& e) -{ - char* xerces_msg; - xerces_msg = XMLString::transcode(e.getMessage()); //DANIEL MEMORY LEAK VERIFIED -// cout<<"Xerces error: "<<xerces_msg<<endl; - XMLString::release(&xerces_msg); //DANIEL MEMORY LEAK VERIFIED -} - -//-------------------------------------------------- -//! (SAX Event) fatal error -//:TODO: handle SAX error properly -//-------------------------------------------------- -void AudioPromptReader::fatalError(const SAXParseException& e) -{ - char* xerces_msg; - xerces_msg = XMLString::transcode(e.getMessage()); //DANIEL MEMORY LEAK VERIFIED -// cout<<"Xerces fatal: "<<xerces_msg<<endl; - XMLString::release(&xerces_msg); //DANIEL MEMORY LEAK VERIFIED -} - -//-------------------------------------------------- -//! (SAX Event) warning -//:TODO: handle SAX warning properly -//-------------------------------------------------- -void AudioPromptReader::warning(const SAXParseException& e) -{ - char* xerces_msg; - xerces_msg = XMLString::transcode(e.getMessage()); //DANIEL MEMORY LEAK VERIFIED -// cout<<"Xerces warning: "<<xerces_msg<<endl; - XMLString::release(&xerces_msg); //DANIEL MEMORY LEAK VERIFIED -} - -//useful function -//replace all occurances of searchStr with replaceStr in sourceStr -string AudioPromptReader::stringReplaceAll(string sourceStr, string searchStr, string replaceStr) -{ -// cout<<"Replacing "<<searchStr<<" with "<<replaceStr<<" in "<<sourceStr<<endl; - - int pos = 0; - string source_str = sourceStr; - - while (pos > -1) - { - pos = source_str.find(searchStr); - - if (pos > -1) - { - source_str.replace(pos, searchStr.length(), replaceStr); - } - - } - - return source_str; - -} Deleted: branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.h =================================================================== --- branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.h 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/AmisSelfVoicing/AccessibleUI/AudioPromptReader.h 2008-02-03 06:07:11 UTC (rev 2305) @@ -1,96 +0,0 @@ -/* -AmisGtkGuiExe: AMIS executable module and primary UI -Copyright (C) 2004 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 AUDIOPROMPTREADER_H -#define AUDIOPROMPTREADER_H - -//SYSTEM INCLUDES -#include <string> -#include <vector> - -//XERCES INCLUDES -#include <xercesc/sax2/DefaultHandler.hpp> - -#include "Media.h" - -#include "AudioPrompt.h" - -//NAMESPACES -XERCES_CPP_NAMESPACE_USE - -XERCES_CPP_NAMESPACE_BEGIN -class Attributes; -XERCES_CPP_NAMESPACE_END - -using namespace std; - - -namespace amis -{ -namespace gui -{ -namespace spoken -{ - - -//!Get an action list from a prompts XML file -/*! - Processing steps are: - 1. make new entry for each prompt, with appropriate name - 2. reserve space for variables - 3. add playable items to prompt "sequence" - 4. at runtime, resolve variables and return completed action strings - -*/ -class AudioPromptReader: public DefaultHandler -{ -public: - //!constructor - AudioPromptReader(); - - //!destructor - ~AudioPromptReader(); - - //MEMBER FUNCTIONS - //!set the file to be processed - void loadFile(string); - - //Xerces SAX methods - //!start tag of an element - void startElement(const XMLCh* const, const XMLCh* const, const XMLCh* const, - const Attributes&); - //!end tag of an element - void endElement(const XMLCh* const, const XMLCh* const, const XMLCh* const); - //!parse error (non-fatal) - void error(const SAXParseException&); - //!parse fatal error - void fatalError(const SAXParseException&); - //!parse warning - void warning(const SAXParseException&); - -private: - string stringReplaceAll(string, string, string); - - AudioPrompt* mpCurrentPrompt; - - - -}; -}}} -#endif \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/include/Preferences.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-02-03 06:07:11 UTC (rev 2305) @@ -80,6 +80,9 @@ void setHighlightText(bool); bool getHighlightText(); + + void setDisableScreensaver(bool); + bool getDisableScreensaver(); void setUserBmkDir(const ambulant::net::url*); const ambulant::net::url* getUserBmkDir(); @@ -121,6 +124,7 @@ bool mbUseTTSNotAudio; bool mbWasExitClean; bool mbHighlightText; + bool mbDisableScreensaver; ambulant::net::url mUserBmkDir; ambulant::net::url mLangpacksDir; ambulant::net::url mFontsizeCssDir; Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-02-03 06:07:11 UTC (rev 2305) @@ -83,9 +83,8 @@ afx_msg void OnEnterMenuLoop(BOOL bIsTrackPopupMenu); afx_msg void OnExitMenuLoop(BOOL bIsTrackPopupMenu); afx_msg void OnInitMenu(CMenu* pMenu); - afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized ); - + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h 2008-02-03 06:07:11 UTC (rev 2305) @@ -48,7 +48,7 @@ BOOL mbLoadLastBook; BOOL mbStartInBasicView; BOOL mbHighlightText; - + BOOL mbDisableScreensaver; int mTTSVoiceIndex; string mUiLanguageSelection; @@ -65,7 +65,8 @@ afx_msg void OnBnClickedHighlightText(); afx_msg void OnCbnSelchangeInstalledLanguages(); afx_msg void OnCbnSetfocusInstalledLanguages(); - + afx_msg void OnBnClickedDisableScreensaver(); + afx_msg void OnBnSetfocusDisableScreensaver(); protected: virtual BOOL OnInitDialog(); afx_msg void OnPaint(); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-02-03 06:07:11 UTC (rev 2305) @@ -67,6 +67,7 @@ wstring mDescription; wstring mDate; wstring mFormat; + wstring mNarrator; }; } } Modified: branches/amis3/AmisGuiMFC2/resource.h =================================================================== --- branches/amis3/AmisGuiMFC2/resource.h 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/resource.h 2008-02-03 06:07:11 UTC (rev 2305) @@ -88,6 +88,7 @@ #define IDC_LISTCAPTION 1075 #define IDC_PHRASEPREVIEW 1075 #define IDC_PAUSEONLOSTFOCUS2 1075 +#define IDC_DISABLESCREENSAVER 1075 #define IDC_CONTRASTPREVIEW 1076 #define IDC_AMISNAME 1076 #define IDC_PAGEFG 1077 @@ -153,6 +154,8 @@ #define ID_MENU_FILE_OPENFROMURL 32870 #define ID_MENU_FILE_CLOSE 32871 #define ID_MENU_INFO_PUBLICATION_SUMMARY 32876 +#define ID_PAGESTYLES_EMPTY 32877 +#define ID_MENU_VIEW_DECREASEFONT 32878 #define IDS_NOSKIP 61245 #define IDS_SELFOLDER_TITLE 61258 #define IDS_SELFOLDER_INSTR 61259 @@ -167,7 +170,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 192 -#define _APS_NEXT_COMMAND_VALUE 32877 +#define _APS_NEXT_COMMAND_VALUE 32879 #define _APS_NEXT_CONTROL_VALUE 1098 #define _APS_NEXT_SYMED_VALUE 141 #endif Modified: branches/amis3/AmisGuiMFC2/src/Preferences.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -53,6 +53,7 @@ setStartInBasicView(false); setTTSVoiceIndex(-1); setWasExitClean(true); + setDisableScreensaver(true); mFontsizeCssFiles.clear(); mContrastCssFiles.clear(); //note that file paths here are hardcoded relative to the application directory @@ -250,6 +251,14 @@ { return mbHighlightText; } +void Preferences::setDisableScreensaver(bool value) +{ + mbDisableScreensaver = value; +} +bool Preferences::getDisableScreensaver() +{ + return mbDisableScreensaver; +} void Preferences::setUserBmkDir(const ambulant::net::url* value) { mUserBmkDir = *value; Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -656,6 +656,7 @@ Preferences::Instance()->setPauseOnLostFocus(prefs.mbPauseOnLostFocus); Preferences::Instance()->setStartInBasicView(prefs.mbStartInBasicView); Preferences::Instance()->setLoadLastBook(prefs.mbLoadLastBook); + Preferences::Instance()->setDisableScreensaver(prefs.mbDisableScreensaver); if (prefs.mbHighlightText != Preferences::Instance()->getHighlightText()) { Preferences::Instance()->setHighlightText(prefs.mbHighlightText); @@ -692,7 +693,7 @@ void CAmisApp::setPauseState(bool pauseState) { - //DanToDo: I don't think Amis3 has a toolbar, so for now the following code is useless (should be removed definitely ?). + //TODO: re-add toolbar //if (MainWndParts::Instance()->mpMainFrame->m_wndDefaultToolbar) { //MainWndParts::Instance()->mpMainFrame->m_wndDefaultToolbar.setPauseState(pauseState); Modified: branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -50,7 +50,7 @@ CChildFrame::CChildFrame() { - // TODO: add member initialization code here + // add member initialization code here } @@ -60,7 +60,7 @@ BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { - // TODO: Modify the Window class or styles here by modifying + // Modify the Window class or styles here by modifying // the CREATESTRUCT cs if( !CMDIChildWnd::PreCreateWindow(cs) ) Modified: branches/amis3/AmisGuiMFC2/src/gui/HtmlDoc.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/HtmlDoc.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/HtmlDoc.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -33,25 +33,13 @@ using namespace amis::gui; -///////////////////////////////////////////////////////////////////////////// -// CAmisHtmlDoc - IMPLEMENT_DYNCREATE(CAmisHtmlDoc, CDocument) BEGIN_MESSAGE_MAP(CAmisHtmlDoc, CDocument) - //{{AFX_MSG_MAP(CAmisHtmlDoc) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP END_MESSAGE_MAP() -///////////////////////////////////////////////////////////////////////////// -// CAmisHtmlDoc construction/destruction - CAmisHtmlDoc::CAmisHtmlDoc() { - // TODO: add one-time construction code here - } CAmisHtmlDoc::~CAmisHtmlDoc() @@ -62,33 +50,22 @@ { if (!CDocument::OnNewDocument()) return FALSE; - - // TODO: add reinitialization code here - // (SDI documents will reuse this document) - + // add reinitialization code here (SDI documents will reuse this document) return TRUE; } - - -///////////////////////////////////////////////////////////////////////////// -// CAmisHtmlDoc serialization - void CAmisHtmlDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { - // TODO: add storing code here + // add storing code here } else { - // TODO: add loading code here + // add loading code here } } -///////////////////////////////////////////////////////////////////////////// -// CAmisHtmlDoc diagnostics - #ifdef _DEBUG void CAmisHtmlDoc::AssertValid() const { @@ -100,6 +77,3 @@ CDocument::Dump(dc); } #endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CAmisHtmlDoc commands Modified: branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -496,8 +496,6 @@ void CAmisHtmlView::OnNavigateComplete2(LPCTSTR strURL) { - // TODO: Add your specialized code here and/or call the base class - CHtmlView::OnNavigateComplete2(strURL); } void CAmisHtmlView::OnNavigateError( Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -55,6 +55,7 @@ ON_WM_ENTERMENULOOP() ON_WM_EXITMENULOOP() //ON_WM_KEYDOWN() + ON_WM_SYSCOMMAND() //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -112,8 +113,7 @@ return -1; // fail to create } - // TODO: Delete these three lines if you don't want the toolbar to - // be dockable + // Delete these three lines if you don't want the toolbar to be dockable EnableDocking(CBRS_ALIGN_ANY); #ifdef _SCB_REPLACE_MINIFRAME m_pFloatingFrameClass = RUNTIME_CLASS(CSCBMiniDockFrameWnd); @@ -132,8 +132,6 @@ { if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU; @@ -725,7 +723,6 @@ CWnd* cwnd = this->GetFocus(); if (cwnd) mCommonPreTranslateMessageHandler->handle(true, NULL, pMsg, (cwnd == NULL ? -1 : cwnd->GetDlgCtrlID())); } - return CFrameWnd::PreTranslateMessage(pMsg); } @@ -858,4 +855,16 @@ mbWasPlayingWhenLostFocus = false; } } +} +//stop the screensaver from starting +void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) +{ + if(Preferences::Instance()->getDisableScreensaver() == true + && MainWndParts::Instance()->mpMmView->isPlaying() == true + && (nID & 0xFFF0) == SC_SCREENSAVE) + { + TRACE(_T("SC_SCREENSAVE, nID = %d, lParam = %d\n"), nID, lParam); + return; + } + CMDIFrameWnd::OnSysCommand(nID, lParam); } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -98,11 +98,11 @@ { if (ar.IsStoring()) { - // TODO: add storing code here + // add storing code here } else { - // TODO: add loading code here + // add loading code here } } Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -264,7 +264,7 @@ ASSERT_VALID(pDoc); if (!pDoc) return; - // TODO: add draw code for native data here + // add draw code for native data here if(player) player->redraw(m_hWnd, pDC->m_hDC); } Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -47,6 +47,8 @@ ON_BN_SETFOCUS(IDC_HIGHLIGHTTEXT, OnBnSetfocusHighlightText) ON_CBN_SELCHANGE(IDC_INSTALLEDLANGUAGES, OnCbnSelchangeInstalledLanguages) ON_CBN_SETFOCUS(IDC_INSTALLEDLANGUAGES, OnCbnSetfocusInstalledLanguages) + ON_BN_CLICKED(IDC_DISABLESCREENSAVER, OnBnClickedDisableScreensaver) + ON_BN_SETFOCUS(IDC_DISABLESCREENSAVER, OnBnSetfocusDisableScreensaver) ON_WM_PAINT() END_MESSAGE_MAP() @@ -71,6 +73,7 @@ DDX_Check(pDX, IDC_LOADLASTBOOK, mbLoadLastBook); DDX_Check(pDX, IDC_STARTINBASICVIEW, mbStartInBasicView); DDX_Check(pDX, IDC_HIGHLIGHTTEXT, mbHighlightText); + DDX_Check(pDX, IDC_DISABLESCREENSAVER, mbDisableScreensaver); } BOOL PreferencesDialog::OnInitDialog() { @@ -80,6 +83,7 @@ mbStartInBasicView = Preferences::Instance()->getStartInBasicView(); mbHighlightText = Preferences::Instance()->getHighlightText(); mUiLanguageSelection = Preferences::Instance()->getUiLangId(); + mbDisableScreensaver = Preferences::Instance()->getDisableScreensaver(); initializeTTSVoiceOption(); initializeUiLanguageOption(); @@ -209,4 +213,10 @@ } void PreferencesDialog::OnCbnSetfocusInstalledLanguages() { +} +void PreferencesDialog::OnBnSetfocusDisableScreensaver() +{ +} +void PreferencesDialog::OnBnClickedDisableScreensaver() +{ } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -127,9 +127,15 @@ mCreator = p_meta->getMetadataContent("dc:creator"); if (version == amis::dtb::DAISY_202) + { mTotalTime = p_meta->getMetadataContent("ncc:totalTime"); + mNarrator = p_meta->getMetadataContent("ncc:narrator"); + } else if (version == amis::dtb::ZED_2002 || version == amis::dtb::ZED_2005) + { mTotalTime = p_meta->getMetadataContent("dtb:totalTime"); + mNarrator = p_meta->getMetadataContent("dc:Narrator"); + } mPublisher = p_meta->getMetadataContent("dc:Publisher"); mDescription = p_meta->getMetadataContent("dc:Description"); @@ -185,7 +191,9 @@ CListBox* p_current_pos = (CListBox*)GetDlgItem(IDC_CURRENTPOSITION); CListBox* p_pub_info = (CListBox*)GetDlgItem(IDC_PUBLICATIONINFO); - CString caption, title, author; + CString caption, title, author, current_page, current_time, current_section, + publisher, description, total_time, date, format, narrator; + if (mpTitle != NULL) title.Format(_T("About: \"%s\""), mpTitle->getText()->getTextString().c_str()); else @@ -199,8 +207,6 @@ caption.Append(author); p_caption->SetWindowText(caption); - CString current_page, current_time, current_section, publisher, description, total_time, date, format; - if (mpCurrentPage != NULL) { current_page.Format(_T("On page %s of %d total pages"), @@ -229,6 +235,11 @@ description.Format(_T("Description: %s"), mDescription.c_str()); p_pub_info->AddString(description); } + if (mNarrator.size() > 0) + { + narrator.Format(_T("Narrated by: %s"), mNarrator.c_str()); + p_pub_info->AddString(narrator); + } if (mTotalTime.size() > 0) { total_time.Format(_T("Total length (time): %s"), mTotalTime.c_str()); Modified: branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-02-03 06:07:11 UTC (rev 2305) @@ -166,6 +166,13 @@ else mpPrefs->setWasExitClean(false); } + else if (id.compare("disable-screensaver") == 0) + { + if (value.compare("yes") == 0) + mpPrefs->setDisableScreensaver(true); + else + mpPrefs->setDisableScreensaver(false); + } else if (id.compare("user-css-file") == 0) { ambulant::net::url file = ambulant::net::url::from_filename(value); @@ -286,6 +293,9 @@ pEntry = createEntry("highlight-text", mpPrefs->getHighlightText()); pGeneralSection->appendChild((DOMNode*)pEntry); + pEntry = createEntry("disable-screensaver", mpPrefs->getDisableScreensaver()); + pGeneralSection->appendChild((DOMNode*)pEntry); + std::string voice; char buff[5]; itoa(mpPrefs->getTTSVoiceIndex(), buff, 10); Modified: branches/amis3/bin/settings/amisPrefs.xml.default =================================================================== --- branches/amis3/bin/settings/amisPrefs.xml.default 2008-02-02 17:53:35 UTC (rev 2304) +++ branches/amis3/bin/settings/amisPrefs.xml.default 2008-02-03 06:07:11 UTC (rev 2305) @@ -11,6 +11,7 @@ <entry id="use-tts-not-audio" value="no"/> <entry id="highlight-text" value="yes"/> <entry id="was-exit-clean" value="yes"/> +<entry id="disable-screensaver" value="yes"/> <entry id="user-bmk-dir" value="./bmk/"/> <entry id="langpacks-dir" value="./lang/"/> <entry id="fontsize-css-dir" value="./css/font/"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-02-04 05:50:12
|
Revision: 2306 http://amis.svn.sourceforge.net/amis/?rev=2306&view=rev Author: marisademeglio Date: 2008-02-03 21:50:18 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Rewrote PublicationSummaryDialog to make it even simpler Removed unused IDs from resource symbol table Huge updates to amisAccessibleUi.xml for new dialogs and menu items. Note that resource.h.ini is not up-to-date; some text ids are missing from amisAccessibleUi.xml; the page styles in the menus are just samples (don't work). Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h branches/amis3/AmisGuiMFC2/resource.h branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/DefaultLangpack/amisAccessibleUi.xml Added Paths: ----------- branches/amis3/DefaultLangpack/just_as_a_reference_amisAccessibleUi-oldstyle.xml Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-03 06:07:11 UTC (rev 2305) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-04 05:50:18 UTC (rev 2306) @@ -123,9 +123,9 @@ IDD_PUBLICATIONSUMMARY, DIALOG BEGIN LEFTMARGIN, 6 - RIGHTMARGIN, 393 + RIGHTMARGIN, 315 TOPMARGIN, 7 - BOTTOMMARGIN, 270 + BOTTOMMARGIN, 183 END IDD_OPENURL, DIALOG @@ -160,7 +160,7 @@ MENUITEM "Open from &URL", ID_MENU_FILE_OPENFROMURL MENUITEM "&Close", ID_MENU_FILE_CLOSE MENUITEM "&Load CD\tCtrl+L", ID_MENU_FILE_LOADCD - MENUITEM "&Search...", ID_MENU_FILE_SEARCHDRIVE + MENUITEM "&Search drives...", ID_MENU_FILE_SEARCHDRIVE MENUITEM SEPARATOR MENUITEM "&Preferences...", ID_MENU_FILE_PREFERENCES MENUITEM SEPARATOR @@ -180,11 +180,13 @@ MENUITEM SEPARATOR POPUP "&Page Style" BEGIN - MENUITEM "Empty", ID_PAGESTYLES_EMPTY - , INACTIVE + MENUITEM "None", ID_PAGESTYLES_NONE + , CHECKED + MENUITEM "sample 1", 351 + MENUITEM "sample 2", 352 END - MENUITEM "&Increase Font Size", ID_MENU_VIEW_LARGEFONT - MENUITEM "&Decrease Font Size", ID_MENU_VIEW_DECREASEFONT + MENUITEM "Bi&gger Font", ID_MENU_VIEW_LARGEFONT + MENUITEM "S&maller Font", ID_MENU_VIEW_DECREASEFONT END POPUP "&Play" BEGIN @@ -341,22 +343,17 @@ DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP END -IDD_PUBLICATIONSUMMARY DIALOGEX 0, 0, 400, 278 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_PUBLICATIONSUMMARY DIALOGEX 0, 0, 322, 191 +STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Publication Summary" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - LTEXT "About: TITLE by CREATOR", - IDC_PUBLICATIONSUMMARYDLGCAPTION,6,7,387,17 - LTEXT "About your current position:", - IDC_CURRENTPOSITIONCAPTION,6,27,387,17 - LISTBOX IDC_CURRENTPOSITION,6,47,387,49,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "About this publication:",IDC_PUBLICATIONINFOCAPTION,6, - 107,387,16 - LISTBOX IDC_PUBLICATIONINFO,6,125,387,123,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",IDOK,176,256,50,14 + CONTROL "",IDC_SUMMARYLIST,"SysListView32",LVS_REPORT | + LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | + WS_TABSTOP,6,25,309,137 + DEFPUSHBUTTON "OK",IDOK,137,169,50,14 + LTEXT "Information about this publication and your current position:", + IDC_PUBLICATIONSUMMARYCAPTION,6,7,309,17 END IDD_OPENURL DIALOGEX 0, 0, 265, 70 Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-02-03 06:07:11 UTC (rev 2305) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-02-04 05:50:18 UTC (rev 2306) @@ -52,6 +52,7 @@ private: bool calculateData(); void displayData(); + void appendToList(CListCtrl*, CString, wstring); amis::dtb::Dtb* mpBook; amis::MediaGroup* mpTitle; wstring mCreator; @@ -68,6 +69,7 @@ wstring mDate; wstring mFormat; wstring mNarrator; + wstring mNavigableItems; }; } } Modified: branches/amis3/AmisGuiMFC2/resource.h =================================================================== --- branches/amis3/AmisGuiMFC2/resource.h 2008-02-03 06:07:11 UTC (rev 2305) +++ branches/amis3/AmisGuiMFC2/resource.h 2008-02-04 05:50:18 UTC (rev 2306) @@ -5,8 +5,6 @@ #define IDD_ABOUTBOX 100 #define IDS_PROPSHT_CAPTION 102 #define IDD_SIDEBAR 103 -#define IDD_PROPPAGE1 110 -#define IDD_PROPPAGE4 112 #define ID_FOCUS_ON_SIDEBAR 123 #define ID_HEAR_LAST_PROMPT 124 #define ID_HEAR_INSTRUCTIONS 125 @@ -26,41 +24,25 @@ #define IDD_SEARCHDAISY 177 #define IDD_GOTOPAGE 180 #define IDD_CDSEARCH 181 -#define IDD_FULLSUMMARY 182 -#define IDD_PUBLICATIONINFO 182 #define IDD_PUBLICATIONSUMMARY 182 #define IDI_LANGICON 185 -#define IDD_PROPPAGE3 185 #define IDB_BOOKSHELFMAG 186 -#define IDD_DIALOG1 190 #define IDD_OPENURL 190 #define IDD_PREFERENCES 191 #define BOOK_BASE_ID 200 #define SECTION_DEPTH_BASE_ID 250 #define NAVLIST_BASE_ID 300 +#define PAGESTYLE_BASE_ID 350 #define BOOKMARKS_BASE_ID 400 #define ID_AMBULANT_PLAY 700 #define IDC_TREE 1000 #define IDC_TAB 1001 #define IDC_SEARCHSTRING 1003 -#define IDC_SUMMARY 1004 -#define IDC_BASIC 1010 -#define IDC_BTN_BORDER 1011 -#define IDC_BTN_TEXTBG 1012 -#define IDC_BTN_PAGEBG 1013 #define IDC_LIST_PAGE 1015 -#define IDC_TTSVOICE 1020 #define IDC_TTSVOICES 1020 -#define IDC_BTN_RESETCOLORS 1028 #define IDC_STARTSEARCH 1030 -#define IDC_BTN_TEXTFG 1030 -#define IDC_BTN_PAGEFG 1032 -#define IDC_SELFVOICING 1034 #define IDC_ISSELFVOICING 1034 -#define IDC_PROMPTONBASICVIEW 1036 -#define IDC_BMKDIR 1037 #define IDC_BROWSE 1038 -#define IDC_LOADLASTDTB 1041 #define IDC_LOADLASTBOOK 1041 #define IDC_HIGHLIGHTTEXT 1042 #define IDC_STARTINBASICVIEW 1043 @@ -73,41 +55,20 @@ #define IDC_SEARCHPATH 1056 #define IDC_BOOKLIST 1058 #define IDC_OPENBOOK 1059 -#define IDC_CANCEL 1060 #define IDC_LANGICON 1065 -#define IDC_BTN_SELECTLANG 1066 -#define IDC_CANCELBUTTON 1067 #define IDC_FINDNEXT 1068 #define IDC_FINDPREV 1069 -#define IDC_BMKDIRBROWSE 1069 -#define IDC_BMKDIRLABEL 1071 #define IDC_SELTTSLABEL 1072 -#define IDC_PHRASES 1073 -#define IDC_CONTRAST 1074 #define IDC_PAUSEONLOSTFOCUS 1074 -#define IDC_LISTCAPTION 1075 -#define IDC_PHRASEPREVIEW 1075 -#define IDC_PAUSEONLOSTFOCUS2 1075 #define IDC_DISABLESCREENSAVER 1075 -#define IDC_CONTRASTPREVIEW 1076 #define IDC_AMISNAME 1076 -#define IDC_PAGEFG 1077 #define IDC_COPYRIGHT 1077 -#define IDC_PAGEBG 1078 -#define IDC_TEXTFG 1079 #define IDC_URL 1079 -#define IDC_TEXTBG 1080 -#define IDC_DIALOGCAPTION 1080 -#define IDC_PUBLICATIONSUMMARYDLGCAPTION 1080 -#define IDC_BORDER 1081 -#define IDC_PUBLICATIONINFO 1081 -#define IDC_CURRENTPOSITIONCAPTION 1082 -#define IDC_PUBLICATIONINFOCAPTION 1084 -#define IDC_CURRENTPOSITION 1085 +#define IDC_SUMMARYLIST 1085 #define IDC_SEARCHINSTRUCTIONS 1088 #define IDC_INSTALLEDLANGUAGES 1097 +#define IDC_PUBLICATIONSUMMARYCAPTION 1100 #define ID_MENU_FIND_IN_TEXT_NEXT 9000 -#define IDC_LANGLIST 9001 #define ID_MENU_FIND_IN_TEXT_PREV 9001 #define IDC_CURRLANG 9002 #define IDC_VERSION 9006 @@ -154,9 +115,8 @@ #define ID_MENU_FILE_OPENFROMURL 32870 #define ID_MENU_FILE_CLOSE 32871 #define ID_MENU_INFO_PUBLICATION_SUMMARY 32876 -#define ID_PAGESTYLES_EMPTY 32877 #define ID_MENU_VIEW_DECREASEFONT 32878 -#define IDS_NOSKIP 61245 +#define ID_PAGESTYLES_NONE 32882 #define IDS_SELFOLDER_TITLE 61258 #define IDS_SELFOLDER_INSTR 61259 #define IDS_FOLDERDOESNOTEXIST 61279 @@ -170,8 +130,8 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 192 -#define _APS_NEXT_COMMAND_VALUE 32879 -#define _APS_NEXT_CONTROL_VALUE 1098 -#define _APS_NEXT_SYMED_VALUE 141 +#define _APS_NEXT_COMMAND_VALUE 32883 +#define _APS_NEXT_CONTROL_VALUE 1101 +#define _APS_NEXT_SYMED_VALUE 142 #endif #endif Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-03 06:07:11 UTC (rev 2305) +++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-04 05:50:18 UTC (rev 2306) @@ -77,7 +77,7 @@ //turn on all skippable options to start with updateCustomTestStates(true); - if (getDaisyVersion() == 2) makeAllNavContainerLabelsHumanReadable(); + if (getDaisyVersion() == DAISY_202) makeAllNavContainerLabelsHumanReadable(); amis::gui::sidebar::AmisSidebarLoader::Instance()->loadNavigationData (this->getNavModel(), &amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg); @@ -115,7 +115,7 @@ { std::string test_id = p_tests->getCustomTest(i)->getId(); //append "-on" if this is a Daisy 202 book - if (this->getDaisyVersion() == 2) test_id.append("-on"); + if (this->getDaisyVersion() == DAISY_202) test_id.append("-on"); bool state = p_tests->getCustomTest(i)->getCurrentState() | playAll; ambulant::smil2::test_attrs::set_current_system_component_value(test_id, state); //TODO: review skippability across document boundaries @@ -201,9 +201,9 @@ p_entry->mbIsLastRead = true; p_entry->mBmkPath = *this->getFileSet()->getBookmarksFilepath(); - if (this->getDaisyVersion() == 2) + if (getDaisyVersion() == DAISY_202) p_entry->mPath = *this->getFileSet()->getNavFilepath(); - else if (this->getDaisyVersion() == 3) + else if (getDaisyVersion() == ZED_2002 ||getDaisyVersion() == ZED_2005) p_entry->mPath = *this->getFileSet()->getOpfFilepath(); p_recent_books->addEntry(p_entry); Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-03 06:07:11 UTC (rev 2305) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-04 05:50:18 UTC (rev 2306) @@ -227,11 +227,16 @@ //info menu p_main_menu->EnableMenuItem(5, MF_BYPOSITION | MF_ENABLED); - - //uncheck "high contrast" - bool is_contrast_on = TextRenderBrain::Instance()->isContrastOn(); - setViewItemCheckmark(is_contrast_on, ID_MENU_VIEW_CONTRAST); - + //check if there are any reading options + if (amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() == NULL || + amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()->getLength() == 0) + { + //TODO: this doesn't work, but it should be disabling the "Reading Options" menu choice + //if there are no reading options + p_menu = p_main_menu->GetSubMenu(5); + p_menu->EnableMenuItem(0, MF_BYPOSITION | MF_DISABLED); + } + setupNavigationOptions(); loadBookmarks(pBookmarks); Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-02-03 06:07:11 UTC (rev 2305) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-02-04 05:50:18 UTC (rev 2306) @@ -137,6 +137,19 @@ mNarrator = p_meta->getMetadataContent("dc:Narrator"); } + //TODO: get the full mutimedia data (should be available directly from the nav data model) + mNavigableItems = p_nav->getNavMap()->getLabel()->getText()->getTextString(); + if (p_nav->hasPages()) + { + mNavigableItems.append(L", "); + mNavigableItems.append(p_nav->getPageList()->getLabel()->getText()->getTextString()); + } + int sz = p_nav->getNumberOfNavLists(); + for (int i=0; i<sz; i++) + { + mNavigableItems.append(L", "); + mNavigableItems.append(p_nav->getNavList(i)->getLabel()->getText()->getTextString()); + } mPublisher = p_meta->getMetadataContent("dc:Publisher"); mDescription = p_meta->getMetadataContent("dc:Description"); mDate = p_meta->getMetadataContent("dc:Date"); @@ -180,6 +193,9 @@ } //TODO: figure out current timestamp + //TODO: get max TOC depth + //TODO: get number of TOC items + return true; } @@ -187,72 +203,70 @@ //for now, it's just temporary to a. see how it looks and b. see if the data is correct void PublicationSummaryDialog::displayData() { - CStatic* p_caption = (CStatic*)GetDlgItem(IDC_PUBLICATIONSUMMARYDLGCAPTION); - CListBox* p_current_pos = (CListBox*)GetDlgItem(IDC_CURRENTPOSITION); - CListBox* p_pub_info = (CListBox*)GetDlgItem(IDC_PUBLICATIONINFO); + CListCtrl* p_list = (CListCtrl*)GetDlgItem(IDC_SUMMARYLIST); + p_list->DeleteAllItems(); + //these column headers don't get shown, so it doesn't matter that they're not localized + p_list->InsertColumn(0, _T("Field"), LVCFMT_LEFT, 100); + p_list->InsertColumn(1, _T("Value"), LVCFMT_LEFT, 400); - CString caption, title, author, current_page, current_time, current_section, - publisher, description, total_time, date, format, narrator; + CString title = _T("Title:"); + CString author = _T("Author:"); + CString publisher = _T("Publisher:"); + CString description = _T("Description:"); + CString narrator = _T("Narrator:"); + CString total_time = _T("Total duration:"); + CString total_pages = _T("Total pages:"); + CString date = _T("Date:"); + CString format = _T("Format:"); + CString features = _T("Features:"); + CString curr_page = _T("Current page:"); + CString curr_time = _T("Current time:"); + CString curr_section = _T("Current section:"); + CString section_contents = _T("Section contents:"); - if (mpTitle != NULL) - title.Format(_T("About: \"%s\""), mpTitle->getText()->getTextString().c_str()); - else - title = _T("Title not available"); - if (mCreator.size() > 0) - author.Format(_T("written by %s"), mCreator.c_str()); - else - author = _T("Author not available"); - caption.Append(title); - caption.Append(_T(", ")); - caption.Append(author); - p_caption->SetWindowText(caption); + CString value; + wstring wvalue; + int idx = 0; + if (mpTitle != NULL) value = mpTitle->getText()->getTextString().c_str(); + else value = _T("Title not available"); + wvalue = value; + appendToList(p_list, title, wvalue); + + if (mCreator.size() > 0) value = mCreator.c_str(); + else value = _T("Author not available"); + wvalue = value; + appendToList(p_list, author, wvalue); + + appendToList(p_list, publisher, mPublisher); + appendToList(p_list, description, mDescription); + appendToList(p_list, narrator, mNarrator); + appendToList(p_list, total_time, mTotalTime); + value.Format(_T("%d"), mTotalNumPages); + wvalue = value; + appendToList(p_list, total_pages, wvalue); + appendToList(p_list, date, mDate); + appendToList(p_list, format, mFormat); + appendToList(p_list, features, mNavigableItems); if (mpCurrentPage != NULL) + appendToList(p_list, curr_page, mpCurrentPage->getText()->getTextString()); + wvalue = L"TODO"; + appendToList(p_list, curr_time, wvalue); + if (mpSectionName != NULL) { - current_page.Format(_T("On page %s of %d total pages"), - mpCurrentPage->getText()->getTextString().c_str(), mTotalNumPages); - p_current_pos->AddString(current_page); + appendToList(p_list, curr_section, mpSectionName->getText()->getTextString()); + value.Format(_T("%d subsections and %d pages"), mNumSubsections, mNumPagesForSection); + wvalue = value; + appendToList(p_list, section_contents, wvalue); } +} - //TODO: if time data is available - current_time.Format(_T("At %s; %s remaining"), - _T("TODO"), _T("TODO")); - p_current_pos->AddString(current_time); - - if (mpSectionName != NULL) - { - current_section.Format(_T("In section %s, which contains %d subsections and %d pages."), - mpSectionName->getText()->getTextString().c_str(), mNumSubsections, mNumPagesForSection); - p_current_pos->AddString(current_section); - } - if (mPublisher.size() > 0) - { - publisher.Format(_T("Published by %s"), mPublisher.c_str()); - p_pub_info->AddString(publisher); - } - if (mDescription.size() > 0) - { - description.Format(_T("Description: %s"), mDescription.c_str()); - p_pub_info->AddString(description); - } - if (mNarrator.size() > 0) - { - narrator.Format(_T("Narrated by: %s"), mNarrator.c_str()); - p_pub_info->AddString(narrator); - } - if (mTotalTime.size() > 0) - { - total_time.Format(_T("Total length (time): %s"), mTotalTime.c_str()); - p_pub_info->AddString(total_time); - } - if (mDate.size() > 0) - { - date.Format(_T("Date: %s"), mDate.c_str()); - p_pub_info->AddString(date); - } - if (mFormat.size() > 0) - { - format.Format(_T("Format: %s"), mFormat.c_str()); - p_pub_info->AddString(format); - } -} \ No newline at end of file +void PublicationSummaryDialog::appendToList(CListCtrl* pList, CString field, wstring value) +{ + //don't add empty items + if (value.size() == 0) return; + int idx = pList->GetItemCount(); + pList->InsertItem(idx, _T("")); + pList->SetItemText(idx, 0, field); + pList->SetItemText(idx, 1, value.c_str()); +} Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-02-03 06:07:11 UTC (rev 2305) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-02-04 05:50:18 UTC (rev 2306) @@ -1,2432 +1,1904 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui xml:lang="en"> - <containers> - <container id="file"> - <note>This is the menu header "File"</note> - <caption> - <text>File</text> - <originalText>File</originalText> - <audio src="./audio/002_File.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0003.smil#text_0003" /> - </caption> - <action mfcid="ID_MENU_FILE_OPEN" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and a toolbar item</note> - <icon src="./open.png" type="smallIcon" /> - <caption> - <text>Open...</text> - <originalText>Open...</originalText> - <audio src="./audio/003_Open.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0004.smil#text_0004" /> - </caption> - <description> - <text>Open a DAISY book from the local file system</text> - <originalText>Open a Daisy book from the local file system</originalText> - <audio src="./audio/004_Open_a_Daisy_book_from_the_loc.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0005.smil#text_0005" /> - </description> - <accelerator> - <text>Ctrl+O</text> - <originalText>Ctrl+O</originalText> - <audio src="./audio/005_CtrlO.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0006.smil#text_0006" /> - </accelerator> - <mnemonic> - <text>O</text> - <originalText>O</originalText> - <audio src="./audio/006_O.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0007.smil#text_0007" /> - </mnemonic> - </action> - <!--new action--> - <action mfcid="ID_MENU_FILE_CLOSE" widget="menuItem"> - <note>This is going to be a menu item</note> - <icon src="./close.png" type="smallIcon" /> - <caption> - <text>Close</text> - <originalText>Close</originalText> - </caption> - <description> - <text>Close the DAISY publication.</text> - <originalText>Close the DAISY publication.</originalText> - </description> - <mnemonic> - <text>C</text> - <originalText>C</originalText> - </mnemonic> - </action> - <!--new action--> - <action mfcid="ID_MENU_FILE_OPENURL" widget="menuItem"> - <note>This is going to be a menu item</note> - <icon src="./open.png" type="smallIcon" /> - <caption> - <text>Open URL...</text> - <originalText>Open URL...</originalText> - </caption> - <description> - <text>Open a DAISY publication from a URL</text> - <originalText>Open a Daisy book from a URL</originalText> - </description> - <accelerator> - <text>Ctrl+U</text> - <originalText>Ctrl+U</originalText> - </accelerator> - <mnemonic> - <text>U</text> - <originalText>U</originalText> - </mnemonic> - </action> - <action mfcid="ID_MENU_FILE_LOADCD" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and a toolbar item</note> - <icon src="./settings/img/cd3.ico" type="smallIcon" /> - <icon src="./settings/img/cd_big.ico" type="largeIcon" /> - <caption> - <text>Load CD</text> - <originalText>Load CD</originalText> - <audio src="./audio/007_Load_CD.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0008.smil#text_0008" /> - </caption> - <description> - <text>Load a DAISY book from CD ROM</text> - <originalText>Load a DAISY book from CD ROM</originalText> - <audio src="./audio/008_Load_a_DAISY_book_from_CD_ROM.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0009.smil#text_0009" /> - </description> - <accelerator> - <text>Ctrl+L</text> - <originalText>Ctrl+L</originalText> - <audio src="./audio/009_CtrlL.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom000a.smil#text_000a" /> - </accelerator> - <mnemonic> - <text>L</text> - <originalText>L</originalText> - <audio src="./audio/010_L.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom000b.smil#text_000b" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_FILE_SEARCHDRIVE" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Search...</text> - <originalText>Search...</originalText> - <audio src="./audio/011_Search.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom000c.smil#text_000c" /> - </caption> - <description> - <text>Search local drives for DAISY books</text> - <originalText>Search local drives for DAISY books</originalText> - <audio src="./audio/012_Search_local_drives_for_DAISY_.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom000d.smil#text_000d" /> - </description> - <mnemonic> - <text>S</text> - <originalText>S</originalText> - <audio src="./audio/013_S.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom000e.smil#text_000e" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_FILE_PREFERENCES" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Preferences...</text> - <originalText>Preferences...</originalText> - <audio src="./audio/014_Preferences.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom000f.smil#text_000f" /> - </caption> - <description> - <text>This is the application preferences dialog.</text> - <originalText>This is the application preferences dialog.</originalText> - <audio src="./audio/015_This_is_the_application_prefer.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0010.smil#text_0010" /> - </description> - <mnemonic> - <text>P</text> - <originalText>P</originalText> - <audio src="./audio/016_P.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0011.smil#text_0011" /> - </mnemonic> - </action> - <container id="recentBooksList"> - <note>This is the menu header for the recent books sub-menu.</note> - <caption> - <text>Recent</text> - <originalText>Recent</originalText> - <audio src="./audio/017_Recent.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0012.smil#text_0012" /> - </caption> - <switch element="action"> - <action mfcid="ID_FILE_RECENT_EMPTY" widget="menuItem" condition="ID_FILE_RECENT_EMPTY"> - <note>This is going to be a menu item</note> - <caption> - <text>Empty</text> - <originalText>Empty</originalText> - <audio src="./audio/018_Empty.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0013.smil#text_0013" /> - </caption> - <description> - <text>There are no recently read books.</text> - <originalText>There are no recently read books.</originalText> - <audio src="./audio/019_There_are_no_recently_read_boo.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0014.smil#text_0014" /> - </description> - </action> - <action mfcid="BOOK_BASE_ID" widget="menuItem" condition="BOOK_BASE_ID"> - <note>This is going to be a menu item</note> - <list repeat="yes"> - <caption> - <promptVar name="RECENT_BOOK_TITLE" /> - </caption> - </list> - </action> - </switch> - <mnemonic> - <text>R</text> - <originalText>R</originalText> - <audio src="./audio/020_R.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0015.smil#text_0015" /> - </mnemonic> - </container> - <action mfcid="ID_MENU_FILE_EXIT" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Exit</text> - <originalText>Exit</originalText> - <audio src="./audio/021_Exit.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0016.smil#text_0016" /> - </caption> - <description> - <text>Exit AMIS</text> - <originalText>Exit AMIS</originalText> - <audio src="./audio/022_Exit_AMIS.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0017.smil#text_0017" /> - </description> - <accelerator> - <text>Alt+F4</text> - <originalText>Alt+F4</originalText> - <audio src="./audio/023_AltF4.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0018.smil#text_0018" /> - </accelerator> - <mnemonic> - <text>x</text> - <originalText>x</originalText> - <audio src="./audio/024_x.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0019.smil#text_0019" /> - </mnemonic> - </action> - <accelerator> - <text>Alt+F</text> - <originalText>Alt+F</originalText> - <audio src="./audio/025_AltF.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom001a.smil#text_001a" /> - </accelerator> - <mnemonic> - <text>F</text> - <originalText>F</originalText> - <audio src="./audio/026_F.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom001b.smil#text_001b" /> - </mnemonic> - </container> - <container id="view"> - <note>This is the menu header "View"</note> - <caption> - <text>View</text> - <originalText>View</originalText> - <audio src="./audio/027_View.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom001c.smil#text_001c" /> - </caption> - <action mfcid="ID_MENU_VIEW_SIDEBAR_ONOFF" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Sidebar</text> - <originalText>Sidebar</originalText> - <audio src="./audio/028_Sidebar.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom001d.smil#text_001d" /> - </caption> - <description> - <text>Turn the sidebar on or off.</text> - <originalText>Turn the sidebar on or off.</originalText> - <audio src="./audio/029_Turn_the_sidebar_on_or_off.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom001e.smil#text_001e" /> - </description> - <mnemonic> - <text>S</text> - <originalText>S</originalText> - <audio src="./audio/030_S.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom001f.smil#text_001f" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_VIEW_BASIC" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Basic View Mode</text> - <originalText>Basic View Mode</originalText> - <audio src="./audio/031_Basic_View_Mode.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0020.smil#text_0020" /> - </caption> - <description> - <text>Switch the view to basic mode.</text> - <originalText>Switch the view to basic mode.</originalText> - <audio src="./audio/032_Switch_the_view_to_basic_mode.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0021.smil#text_0021" /> - </description> - <accelerator> - <text>F11</text> - <originalText>F11</originalText> - <audio src="./audio/033_F11.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0022.smil#text_0022" /> - </accelerator> - <mnemonic> - <text>B</text> - <originalText>B</originalText> - <audio src="./audio/034_B.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0023.smil#text_0023" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_VIEW_CONTRAST" widget="menuItem toolbarItem"> - <note>This is going to be a menu item</note> - <icon src="./settings/img/contrast.ico" type="smallIcon" /> - <caption> - <text>High Contrast</text> - <originalText>High Contrast</originalText> - <audio src="./audio/035_High_Contrast.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0024.smil#text_0024" /> - </caption> - <description> - <text>Use high contrast colors for the text display.</text> - <originalText>Use high contrast colors for the text display.</originalText> - <audio src="./audio/036_Use_high_contrast_colors_for_t.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0025.smil#text_0025" /> - </description> - <accelerator> - <text>Ctrl+S</text> - <originalText>Ctrl+S</originalText> - <audio src="./audio/037_CtrlC.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0026.smil#text_0026" /> - </accelerator> - <mnemonic> - <text>C</text> - <originalText>C</originalText> - <audio src="./audio/038_C.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0027.smil#text_0027" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_VIEW_LARGEFONT" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/font.ico" type="smallIcon" /> - <caption> - <text>Increase Font Size</text> - <originalText>Increase Font Size</originalText> - <audio src="./audio/039_Increase_Font_Size.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0028.smil#text_0028" /> - </caption> - <description> - <text>Gradually increase the font size.</text> - <originalText>Gradually increase the font size.</originalText> - <audio src="./audio/040_Gradually_increase_the_font_si.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0029.smil#text_0029" /> - </description> - <mnemonic> - <text>I</text> - <originalText>I</originalText> - <audio src="./audio/041_I.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom002a.smil#text_002a" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_VIEW_RESETFONT" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Reset Font Size</text> - <originalText>Reset Font Size</originalText> - <audio src="./audio/042_Reset_Font_Size.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom002b.smil#text_002b" /> - </caption> - <description> - <text>Set the font size to the default setting.</text> - <originalText>Set the font size to the default setting.</originalText> - <audio src="./audio/043_Set_the_font_size_to_the_defau.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom002c.smil#text_002c" /> - </description> - <mnemonic> - <text>R</text> - <originalText>R</originalText> - <audio src="./audio/044_R.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom002d.smil#text_002d" /> - </mnemonic> - </action> - <action mfcid="NAVLIST_BASE_ID" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <promptVar name="NAV_LIST_NAME" /> - </caption> - <description> - <promptVar name="NAV_LIST_DESCRIPTION" /> - </description> - </action> - <accelerator> - <text>Alt+V</text> - <originalText>Alt+V</originalText> - <audio src="./audio/045_AltV.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom002e.smil#text_002e" /> - </accelerator> - <mnemonic> - <text>V</text> - <originalText>V</originalText> - <audio src="./audio/046_V.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom002f.smil#text_002f" /> - </mnemonic> - </container> - <container id="play"> - <note>This is the menu header "Play"</note> - <caption> - <text>Play</text> - <originalText>Play</originalText> - <audio src="./audio/047_Play.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0030.smil#text_0030" /> - </caption> - <switch element="action"> - <action mfcid="ID_MENU_PLAYPAUSE" widget="menuItem toolbarItem" condition="canPlay"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/play-big.ico" type="smallIcon" /> - <icon src="./settings/img/play_big.ico" type="largeIcon" /> - <caption> - <text>Play</text> - <originalText>Play</originalText> - <audio src="./audio/048_Play.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0031.smil#text_0031" /> - </caption> - <description> - <text>Start synchronized playback.</text> - <originalText>Start synchronized playback.</originalText> - <audio src="./audio/049_Start_synchronized_playback.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0032.smil#text_0032" /> - </description> - <accelerator> - <text>Space</text> - <originalText>Space</originalText> - <audio src="./audio/050_Space.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0033.smil#text_0033" /> - </accelerator> - <mnemonic> - <text>P</text> - <originalText>P</originalText> - <audio src="./audio/051_P.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0034.smil#text_0034" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_PLAYPAUSE" widget="menuItem toolbarItem" condition="canPause"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/pause.ico" type="smallIcon" /> - <icon src="./settings/img/pause_big.ico" type="largeIcon" /> - <caption> - <text>Pause</text> - <originalText>Pause</originalText> - <audio src="./audio/052_Pause.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0035.smil#text_0035" /> - </caption> - <description> - <text>Pause playback of this DAISY book.</text> - <originalText>Pause playback of this DAISY book.</originalText> - <audio src="./audio/053_Pause_playback_of_this_DAISY_b.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0036.smil#text_0036" /> - </description> - <accelerator> - <text>Space</text> - <originalText>Space</originalText> - <audio src="./audio/054_Space.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0037.smil#text_0037" /> - </accelerator> - <mnemonic> - <text>a</text> - <originalText>a</originalText> - <audio src="./audio/055_a.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0038.smil#text_0038" /> - </mnemonic> - </action> - </switch> - <action mfcid="ID_MENU_PLAY_ESCAPE" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Escape</text> - <originalText>Escape</originalText> - <audio src="./audio/056_Escape.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0039.smil#text_0039" /> - </caption> - <description> - <text>Jump out of the currently playing item or structure.</text> - <originalText>Jump out of the currently playing item or structure.</originalText> - <audio src="./audio/057_Jump_out_of_the_currently_play.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom003a.smil#text_003a" /> - </description> - <accelerator> - <text>Esc</text> - <originalText>Esc</originalText> - <audio src="./audio/058_Esc.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom003b.smil#text_003b" /> - </accelerator> - <mnemonic> - <text>E</text> - <originalText>E</originalText> - <audio src="./audio/059_E.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom003c.smil#text_003c" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_PLAY_FASTER" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/fullspeedahead.ico" type="smallIcon" /> - <caption> - <text>Faster</text> - <originalText>Faster</originalText> - <audio src="./audio/060_Faster.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom003d.smil#text_003d" /> - </caption> - <description> - <text>Increase the playback rate.</text> - <originalText>Increase the playback rate.</originalText> - <audio src="./audio/061_Increase_the_playback_rate.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom003e.smil#text_003e" /> - </description> - <accelerator> - <text>Ctrl++</text> - <originalText>Ctrl++</originalText> - <audio src="./audio/062_Ctrl.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom003f.smil#text_003f" /> - </accelerator> - <mnemonic> - <text>F</text> - <originalText>F</originalText> - <audio src="./audio/063_F.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0040.smil#text_0040" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_PLAY_SLOWER" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/slowdown.ico" type="smallIcon" /> - <caption> - <text>Slower</text> - <originalText>Slower</originalText> - <audio src="./audio/064_Slower.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0041.smil#text_0041" /> - </caption> - <description> - <text>Slow down the playback rate.</text> - <originalText>Slow down the playback rate.</originalText> - <audio src="./audio/065_Slow_down_the_playback_rate.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0042.smil#text_0042" /> - </description> - <accelerator> - <text>Ctrl+-</text> - <originalText>Ctrl+-</originalText> - <audio src="./audio/066_Ctrl.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0043.smil#text_0043" /> - </accelerator> - <mnemonic> - <text>S</text> - <originalText>S</originalText> - <audio src="./audio/067_S.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0044.smil#text_0044" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_PLAY_NORMALSPEED" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/normalspeed.ico" type="smallIcon" /> - <caption> - <text>Normal Speed</text> - <originalText>Normal Speed</originalText> - <audio src="./audio/068_Normal_Speed.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0045.smil#text_0045" /> - </caption> - <description> - <text>Reset the playback rate to normal.</text> - <originalText>Reset the playback rate to normal.</originalText> - <audio src="./audio/069_Reset_the_playback_rate_to_nor.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0046.smil#text_0046" /> - </description> - <accelerator> - <text>Ctrl+0</text> - <originalText>Ctrl+0</originalText> - <audio src="./audio/070_Ctrl0.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0047.smil#text_0047" /> - </accelerator> - <mnemonic> - <text>N</text> - <originalText>N</originalText> - <audio src="./audio/071_N.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0048.smil#text_0048" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_PLAY_VOLUP" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Increase Volume</text> - <originalText>Increase Volume</originalText> - <audio src="./audio/072_Increase_Volume.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0049.smil#text_0049" /> - </caption> - <description> - <text>Gradually raise the volume.</text> - <originalText>Gradually raise the volume.</originalText> - <audio src="./audio/073_Gradually_raise_the_volume.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom004a.smil#text_004a" /> - </description> - <accelerator> - <text>Ctrl+Up</text> - <originalText>Ctrl+Up</originalText> - <audio src="./audio/074_CtrlUp.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom004b.smil#text_004b" /> - </accelerator> - <mnemonic> - <text>I</text> - <originalText>I</originalText> - <audio src="./audio/075_I.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom004c.smil#text_004c" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_PLAY_VOLDOWN" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Decrease Volume</text> - <originalText>Decrease Volume</originalText> - <audio src="./audio/076_Decrease_Volume.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom004d.smil#text_004d" /> - </caption> - <description> - <text>Gradually lower the volume.</text> - <originalText>Gradually lower the volume.</originalText> - <audio src="./audio/077_Gradually_lower_the_volume.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom004e.smil#text_004e" /> - </description> - <accelerator> - <text>Ctrl+Down</text> - <originalText>Ctrl+Down</originalText> - <audio src="./audio/078_CtrlDown.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom004f.smil#text_004f" /> - </accelerator> - <mnemonic> - <text>D</text> - <originalText>D</originalText> - <audio src="./audio/079_D.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0050.smil#text_0050" /> - </mnemonic> - </action> - <accelerator> - <text>Alt+P</text> - <originalText>Alt+P</originalText> - <audio src="./audio/080_AltP.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0051.smil#text_0051" /> - </accelerator> - <mnemonic> - <text>P</text> - <originalText>P</originalText> - <audio src="./audio/081_P.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0052.smil#text_0052" /> - </mnemonic> - </container> - <container id="navigate"> - <note>This is the menu header "Navigate"</note> - <caption> - <text>Navigate</text> - <originalText>Navigate</originalText> - <audio src="./audio/082_Navigate.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0053.smil#text_0053" /> - </caption> - <action mfcid="ID_MENU_NAV_PREVSECTION" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/prevsection.ico" type="smallIcon" /> - <icon src="./settings/img/prevsection_big.ico" type="largeIcon" /> - <caption> - <text>Previous Section</text> - <originalText>Previous Section</originalText> - <audio src="./audio/083_Previous_Section.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0054.smil#text_0054" /> - </caption> - <description> - <text>Go to the previous section.</text> - <originalText>Go to the previous section.</originalText> - <audio src="./audio/084_Go_to_the_previous_section.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0055.smil#text_0055" /> - </description> - <accelerator> - <text>Up</text> - <originalText>Up</originalText> - <audio src="./audio/085_Up.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0056.smil#text_0056" /> - </accelerator> - <mnemonic> - <text>P</text> - <originalText>P</originalText> - <audio src="./audio/086_P.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0057.smil#text_0057" /> - </mnemonic> - </action> - <action mfcid="ID_MENU_NAV_NEXTSECTION" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/nextsection.ico" type="smallIcon" /> - <icon src="./settings/img/nextsection_big.ico" type="largeIcon" /> - <caption> - <text>Next Section</text> - <originalText>Next Section</originalText> - <audio src="./audio/087_Next_Section.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0058.smil#text_0058" /> - </caption> - <description> - <text>Go to the next section.</text> - <originalText>Go to the next section.</originalText> - <audio src="./audio/088_Go_to_the_next_section.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0059.smil#text_0059" /> - </description> - <accelerator> - <text>Down</text> - <originalText>Down</originalText> - <audio src="./audio/089_Down.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom005a.smil#text_005a" /> - </accelerator> - <mnemonic> - <text>N</text> - <originalText>N</originalText> - <audio src="./audio/090_N.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom005b.smil#text_005b" /> - </mnemonic> - </action> - <container id="sectiondepth"> - <note>This is the "show section depth" sub-menu pop-up</note> - <caption> - <text>Show Section Depth</text> - <originalText>Show Section Depth</originalText> - <audio src="./audio/091_Show_Section_Depth.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom005c.smil#text_005c" /> - </caption> - <switch element="action"> - <action mfcid="ID_EMPTY" widget="menuItem" condition="ID_EMPTY"> - <note>This is going to be a menu item</note> - <caption> - <text>Empty</text> - <originalText>Empty</originalText> - <audio src="./audio/092_Empty.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom005d.smil#text_005d" /> - </caption> - <description> - <text>There are no section levels.</text> - <originalText>There are no section levels.</originalText> - <audio src="./audio/093_There_are_no_section_levels.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom005e.smil#text_005e" /> - </description> - </action> - <action mfcid="SECTION_DEPTH_BASE_ID" widget="menuItem" condition="SECTION_DEPTH_BASE_ID"> - <note>This is going to be a menu item</note> - <list repeat="yes"> - <caption> - <promptVar name="SECTION_DEPTH_OPTION" /> - </caption> - </list> - </action> - </switch> - <mnemonic> - <text>S</text> - <originalText>S</originalText> - <audio src="./audio/094_S.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom005f.smil#text_005f" /> - </mnemonic> - </container> - <action mfcid="ID_MENU_NAV_PREVPHRASE" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/prevphasecirc.ico" type="smallIcon" /> - <caption> - <text>Previous Phrase</text> - <originalText>Previous Phrase</originalText> - <audio src="./audio/095_Previous_Phrase.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0060.smil#text_0060" /> - </caption> - <description> - <text>Go to the previous phrase.</text> - <originalText>Go to the previous phrase.</originalText> - <audio src="./audio/096_Go_to_the_previous_phrase.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0061.smil#text_0061" /> - </description> - <accelerator> - <text>Left</text> - <originalText>Left</originalText> - <audio src="./audio/097_Left.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0062.smil#text_0062" /> - </accelerator> - </action> - <action mfcid="ID_MENU_NAV_NEXTPHRASE" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/nextphrasecirc.ico" type="smallIcon" /> - <caption> - <text>Next Phrase</text> - <originalText>Next Phrase</originalText> - <audio src="./audio/098_Next_Phrase.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0063.smil#text_0063" /> - </caption> - <description> - <text>Go to the next phrase.</text> - <originalText>Go to the next phrase.</originalText> - <audio src="./audio/099_Go_to_the_next_phrase.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0064.smil#text_0064" /> - </description> - <accelerator> - <text>Right</text> - <originalText>Right</originalText> - <audio src="./audio/100_Right.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0065.smil#text_0065" /> - </accelerator> - </action> - <action mfcid="ID_MENU_NAV_PREVPAGE" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/prevpage.ico" type="smallIcon" /> - <caption> - <text>Previous Page</text> - <originalText>Previous Page</originalText> - <audio src="./audio/101_Previous_Page.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0066.smil#text_0066" /> - </caption> - <description> - <text>Go to the previous page.</text> - <originalText>Go to the previous page.</originalText> - <audio src="./audio/102_Go_to_the_previous_page.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0067.smil#text_0067" /> - </description> - <accelerator> - <text>Ctrl+Left</text> - <originalText>Ctrl+Left</originalText> - <audio src="./audio/103_CtrlLeft.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0068.smil#text_0068" /> - </accelerator> - </action> - <action mfcid="ID_MENU_NAV_NEXTPAGE" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/nextpage.ico" type="smallIcon" /> - <caption> - <text>Next Page</text> - <originalText>Next Page</originalText> - <audio src="./audio/104_Next_Page.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0069.smil#text_0069" /> - </caption> - <description> - <text>Go to the next page.</text> - <originalText>Go to the next page.</originalText> - <audio src="./audio/105_Go_to_the_next_page.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom006a.smil#text_006a" /> - </description> - <accelerator> - <text>Ctrl+Right</text> - <originalText>Ctrl+Right</originalText> - <audio src="./audio/106_CtrlRight.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom006b.smil#text_006b" /> - </accelerator> - </action> - <action mfcid="ID_MENU_NAV_GOTOPAGE" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Go to Page...</text> - <originalText>Go to Page...</originalText> - <audio src="./audio/107_Go_to_Page.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom006c.smil#text_006c" /> - </caption> - <description> - <text>Go to a specific page.</text> - <originalText>Go to a specific page.</originalText> - <audio src="./audio/108_Go_to_a_specific_page.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom006d.smil#text_006d" /> - </description> - <accelerator> - <text>Ctrl+G</text> - <originalText>Ctrl+G</originalText> - <audio src="./audio/109_CtrlG.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom006e.smil#text_006e" /> - </accelerator> - </action> - <action mfcid="ID_MENU_NAV_FINDINTEXT" widget="menuItem"> - <note>This is going to be a menu item</note> - <caption> - <text>Find in Text</text> - <originalText>Find in Text</originalText> - <audio src="./audio/110_Find_in_Text.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom006f.smil#text_006f" /> - </caption> - <description> - <text>Search for a word or phrase in the text.</text> - <originalText>Search for a word or phrase in the text.</originalText> - <audio src="./audio/111_Search_for_a_word_or_phrase_in.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0070.smil#text_0070" /> - </description> - <accelerator> - <text>Ctrl+F</text> - <originalText>Ctrl+F</originalText> - <audio src="./audio/112_CtrlF.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0071.smil#text_0071" /> - </accelerator> - <mnemonic> - <text>F</text> - <originalText>F</originalText> - <audio src="./audio/113_F.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0072.smil#text_0072" /> - </mnemonic> - </action> - <accelerator> - <text>Alt+N</text> - <originalText>Alt+N</originalText> - <audio src="./audio/114_AltN.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0073.smil#text_0073" /> - </accelerator> - <mnemonic> - <text>N</text> - <originalText>N</originalText> - <audio src="./audio/115_N.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0074.smil#text_0074" /> - </mnemonic> - </container> - <container id="bookmarks"> - <note>This is the menu header "Bookmarks"</note> - <caption> - <text>Bookmarks</text> - <originalText>Bookmarks</originalText> - <audio src="./audio/116_Bookmarks.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0075.smil#text_0075" /> - </caption> - <action mfcid="ID_MENU_BMK_ADD" widget="menuItem toolbarItem"> - <note>This is going to be a menu item and toolbar item</note> - <icon src="./settings/img/adbookmark.ico" type="smallIcon" /> - <caption> - <text>Add Bookmark</text> - <originalText>Add Bookmark</originalText> - <audio src="./audio/117_Add_Bookmark.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0076.smil#text_0076" /> - </caption> - <description> - <text>Bookmark your current position.</text> - <originalText>Bookmark your current position.</originalText> - <audio src="./audio/118_Bookmark_your_current_position.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0077.smil#text_0077" /> - </description> - <accelerator> - <text>Ctrl+D</text> - <originalText>Ctrl+D</originalText> - <audio src="./audio/119_CtrlD.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0078.smil#text_0078" /> - </accelerator> - <mnemonic> - <text>A</text> - <originalText>A</originalText> - <audio src="./audio/120_A.mp3" from="file:///c:/devel/amis/Defaultlangpack/prompts/prom0079.smil#text_0079" /> - </mnemonic> - </action> - <action mfcid="BOOKMARK_BASE_ID" widget="menuItem"> - <note>This is going ... [truncated message content] |
From: <mar...@us...> - 2008-02-26 05:25:15
|
Revision: 2342 http://amis.svn.sourceforge.net/amis/?rev=2342&view=rev Author: marisademeglio Date: 2008-02-25 21:25:21 -0800 (Mon, 25 Feb 2008) Log Message: ----------- Added logging Modified Paths: -------------- branches/amis3/AmisCore/AmisCore.sln branches/amis3/AmisCore/AmisCore.vcproj branches/amis3/AmisCore/include/AmisCore.h branches/amis3/AmisCore/include/dtb/nav/NavList.h branches/amis3/AmisCore/include/dtb/nav/NavModel.h branches/amis3/AmisCore/src/dtb/Bookmarks.cpp branches/amis3/AmisCore/src/dtb/CustomTest.cpp branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisCore/src/dtb/nav/NavList.cpp branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp branches/amis3/AmisCore/src/dtb/nav/PageList.cpp branches/amis3/AmisCore/src/io/NavFileReader.cpp branches/amis3/AmisCore/src/io/NccFileReader.cpp branches/amis3/AmisCore/src/io/NcxFileReader.cpp branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp branches/amis3/AmisGuiMFC2/include/Preferences.h branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp branches/amis3/AmisGuiMFC2/src/Preferences.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/HtmlDoc.cpp branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/AboutDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisFileDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp branches/amis3/AmisGuiMFC2/src/gui/toolbar/Toolbar.cpp branches/amis3/AmisGuiMFC2/src/pdtb.cpp Added Paths: ----------- branches/amis3/AmisCore/include/util/Log.h branches/amis3/AmisCore/src/util/Log.cpp Modified: branches/amis3/AmisCore/AmisCore.sln =================================================================== --- branches/amis3/AmisCore/AmisCore.sln 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/AmisCore.sln 2008-02-26 05:25:21 UTC (rev 2342) @@ -3,7 +3,7 @@ ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testAmisCore", "testAmisCore\testAmisCore.vcproj", "{EF232C4C-7F7A-496F-A2DC-E658C2845330}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testAmisCore", "testAmisCoreWin32\testAmisCore.vcproj", "{EF232C4C-7F7A-496F-A2DC-E658C2845330}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Modified: branches/amis3/AmisCore/AmisCore.vcproj =================================================================== --- branches/amis3/AmisCore/AmisCore.vcproj 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/AmisCore.vcproj 2008-02-26 05:25:21 UTC (rev 2342) @@ -479,6 +479,9 @@ </FileConfiguration> </File> <File + RelativePath=".\src\util\Log.cpp"> + </File> + <File RelativePath=".\src\util\SearchForFiles.cpp"> </File> </Filter> @@ -635,7 +638,7 @@ RelativePath=".\include\util\FilePathTools.h"> </File> <File - RelativePath=".\include\util\findfilecontainer.h"> + RelativePath=".\include\util\Log.h"> </File> <File RelativePath=".\include\util\SearchForFiles.h"> Modified: branches/amis3/AmisCore/include/AmisCore.h =================================================================== --- branches/amis3/AmisCore/include/AmisCore.h 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/include/AmisCore.h 2008-02-26 05:25:21 UTC (rev 2342) @@ -157,6 +157,7 @@ { class FilePathTools; class SmilAudioExtract; + class Log; } } Modified: branches/amis3/AmisCore/include/dtb/nav/NavList.h =================================================================== --- branches/amis3/AmisCore/include/dtb/nav/NavList.h 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/include/dtb/nav/NavList.h 2008-02-26 05:25:21 UTC (rev 2342) @@ -50,7 +50,7 @@ void acceptDepthFirst(NavVisitor*); private: - vector<NavTarget*> mpNodes; + vector<NavTarget*> mNodes; }; } } Modified: branches/amis3/AmisCore/include/dtb/nav/NavModel.h =================================================================== --- branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-02-26 05:25:21 UTC (rev 2342) @@ -49,23 +49,23 @@ NavList* getNavList(unsigned int); NavList* getNavList(string); NavListList* getNavLists(); - int addNavList(string); - bool hasPages(); PageList* getPageList(); NavMap* getNavMap(); - void acceptDepthFirst(NavVisitor*); - NavNode* getNodeForSmilId(string, NavContainer*); void setSmilIdNodeMap(NodeRefMap*); void testMap(); + + //add a node to the big ordered list. the node will not necessarily be next in sequence. + void addToPlayOrderList(NavNode*); private: NavMap* mpNavMap; PageList* mpPageList; NodeRefMap* mpSmilIdNodeMap; NavListList mNavLists; + std::vector<NavNode*> mPlayOrderList; }; } } Added: branches/amis3/AmisCore/include/util/Log.h =================================================================== --- branches/amis3/AmisCore/include/util/Log.h (rev 0) +++ branches/amis3/AmisCore/include/util/Log.h 2008-02-26 05:25:21 UTC (rev 2342) @@ -0,0 +1,65 @@ +/* +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 LOG_H +#define LOG_H + +#include <string> +#include <fstream> + +#include "Error.h" +using namespace std; + +namespace amis +{ +namespace util +{ +class Log +{ +protected: + Log(); +public: + static Log* Instance(); + void DestroyInstance(); + ~Log(); + + void startLog(string); + void writeMessage(string, string, string); + void writeMessage(string); + void writeMessage(string, const ambulant::net::url*); + void writeWarning(string, string, string); + void writeError(string, string, string); + void writeMessage(string, const ambulant::net::url*, string, string); + void writeWarning(string, const ambulant::net::url*, string, string); + void writeError(string, const ambulant::net::url*, string, string); + void writeError(amis::Error, string, string); + void endLog(); + +private: + void writeData(string, string, string, string); + ofstream mFile; + static Log* pinstance; + bool mbIsFileOpen; +}; +} +} + +#endif \ No newline at end of file Modified: branches/amis3/AmisCore/src/dtb/Bookmarks.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Bookmarks.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/dtb/Bookmarks.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -176,10 +176,14 @@ { mItems.push_back(pBookmark); } - +//todo: verify that this function works void amis::dtb::BookmarkSet::deleteItem(unsigned int idx) { - //@todo: write this deleteItem(..) function + if (mItems.size() == 0 || idx > mItems.size()-1) return; + vector<amis::dtb::PositionMark*>::iterator it; + it = mItems.begin(); + for (int i = 0; i<idx; i++) it++; + mItems.erase(it); } void amis::dtb::BookmarkSet::setTitle(amis::MediaGroup* pData) Modified: branches/amis3/AmisCore/src/dtb/CustomTest.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/CustomTest.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/dtb/CustomTest.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -33,81 +33,51 @@ mBookStruct = ""; mbCurrentState = false; } - - - amis::dtb::CustomTest::~CustomTest() { mId = ""; mBookStruct = ""; } - - - void amis::dtb::CustomTest::setId(const string id) { mId.assign(id); } - - - void amis::dtb::CustomTest::setOverride(bool override) { mbOverride = override; } - - - void amis::dtb::CustomTest::setDefaultState(bool defaultState) { mbDefaultState = defaultState; } - - - void amis::dtb::CustomTest::setBookStruct(const string bookStruct) { mBookStruct.assign(bookStruct); } - - - void amis::dtb::CustomTest::setCurrentState(bool currentState) { mbCurrentState = currentState; } - - - const string amis::dtb::CustomTest::getId() { return mId; } - - - bool amis::dtb::CustomTest::getOverride() { return mbOverride; } - - - bool amis::dtb::CustomTest::getDefaultState() { return mbDefaultState; } - const string amis::dtb::CustomTest::getBookStruct() { return mBookStruct; } - bool amis::dtb::CustomTest::getCurrentState() { return mbCurrentState; } - amis::dtb::CustomTestSet::CustomTestSet() { } @@ -134,9 +104,7 @@ break; } } - if (b_found == false) mList.push_back(pCustomTest); - return !b_found; } amis::dtb::CustomTest* amis::dtb::CustomTestSet::getCustomTest(int idx) Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -33,6 +33,7 @@ #include "io/TextSearch.h" #include "io/OpfFileReader.h" #include "io/NcxFileReader.h" +#include "util/Log.h" #include "ambulant/common/plugin_engine.h" @@ -159,9 +160,9 @@ bool amis::dtb::Dtb::open(const ambulant::net::url* fileUrl, const ambulant::net::url* bookmarksDirectory) { cleanUpObjects(); + string log_msg = "Opening book: " + fileUrl->get_url(); + amis::util::Log::Instance()->writeMessage(log_msg, "Dtb::open", "AmisCore"); - //cout<<"trying to open: "<<filepath<<endl; - mpFiles = NULL; mpFiles = new amis::dtb::DtbFileSet(); mpFiles->initWithNccOrOpf(fileUrl, mpFileSearcher); @@ -169,6 +170,7 @@ if (DtbFileSet::isNccFile(fileUrl)) { + amis::util::Log::Instance()->writeMessage("This is a DAISY 2.02 book", "Dtb::open", "AmisCore"); mDaisyVersion = DAISY_202; if (!processNcc(mpFiles->getNavFilepath())) { @@ -179,7 +181,7 @@ { //TODO: differentiate between 2005 and 2002 mDaisyVersion = ZED_2005; - + amis::util::Log::Instance()->writeMessage("This is a Zed book", "Dtb::open", "AmisCore"); if (!processOpf(mpFiles->getOpfFilepath())) return false; if (!processNcx(mpFiles->getNavFilepath())) return false; //if (!processDaisyResourceFile(mpFiles->getResourceFilepath())) return false; @@ -187,7 +189,8 @@ else { mDaisyVersion = UNDEFINED; - //TODO: flag not supported + amis::util::Log::Instance()->writeWarning("The type of book could not be determined", + "Dtb::open", "AmisCore"); return false; } @@ -251,8 +254,8 @@ //from an encrypted file if (checkForCopyProtection(mpMetadata)) { + amis::util::Log::Instance()->writeMessage("This is a protected book", "Dtb::processNcc", "AmisCore"); mbIsProtected = true; - if (mpCallbackForPreprocessingBookKey != NULL) { if (mpCallbackForPreprocessingBookKey( @@ -269,10 +272,15 @@ mpCustomTests = ncc_file_reader.getCustomTests(); } } - /* if: 1. no function registered to handle protected books or - 2. that function failed - then: playback of NCC.html continues and it will say "this book is protected... " - */ + else + { + /* if: 1. no function registered to handle protected books or + 2. that function failed + then: playback of NCC.html continues and it will say "this book is protected... " + */ + amis::util::Log::Instance()->writeError("Protected book could not be read", + "Dtb::processNcc", "AmisCore"); + } } //the spine visitor also makes the smil file paths absolute @@ -665,6 +673,9 @@ amis::dtb::Bookmark* p_bmk = new amis::dtb::Bookmark(); amis::dtb::PositionData* p_pos = mpBookmarks->getLastmark()->copy(); + + amis::util::Log::Instance()->writeMessage("Adding bookmark", &p_pos->mUri, + "Dtb::addBookmark", "AmisCore"); p_bmk->mType = amis::dtb::Bookmark::BOOKMARK; p_bmk->mpStart = p_pos; @@ -685,6 +696,12 @@ //the callback here will get invoked during processNcc void amis::dtb::Dtb::setCallbackForPreprocessingBookKey(ProtectedBookKeyHandlerFunctionPtr pFunction) { + if (pFunction == NULL) + amis::util::Log::Instance()->writeWarning("Setting NULL handler for protected books", + "Dtb::setCallbackForPreprocessingBookKey", "AmisCore"); + else + amis::util::Log::Instance()->writeMessage("Setting handler for protected books", + "Dtb::setCallbackForPreprocessingBookKey", "AmisCore"); mpCallbackForPreprocessingBookKey = pFunction; } Modified: branches/amis3/AmisCore/src/dtb/nav/NavList.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavList.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/dtb/nav/NavList.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -39,13 +39,13 @@ //-------------------------------------------------- amis::dtb::nav::NavList::~NavList() { - int sz = mpNodes.size(); + int sz = mNodes.size(); NavTarget* tmp_node; for (int i=sz-1; i>=0; i--) { - tmp_node = mpNodes[i]; - mpNodes.pop_back(); + tmp_node = mNodes[i]; + mNodes.pop_back(); delete tmp_node; } } @@ -56,18 +56,18 @@ void amis::dtb::nav::NavList::addNode(NavTarget* pNode) { pNode->setNavModel(mpNavModel); - pNode->setIndex(mpNodes.size()); + pNode->setIndex(mNodes.size()); pNode->setNavContainer(this); - mpNodes.push_back(pNode); + mNodes.push_back(pNode); + mpNavModel->addToPlayOrderList(pNode); } - //-------------------------------------------------- //get the list length //-------------------------------------------------- int amis::dtb::nav::NavList::getLength() { - return mpNodes.size(); + return mNodes.size(); } //-------------------------------------------------- @@ -76,12 +76,10 @@ amis::dtb::nav::NavNode* amis::dtb::nav::NavList::goToPlayOrder(int playOrder) { bool b_found = false; - unsigned int i = 0; - - for (i=0; i<mpNodes.size(); i++) + for (i=0; i<mNodes.size(); i++) { - if (mpNodes[i]->getPlayOrder() == playOrder) + if (mNodes[i]->getPlayOrder() == playOrder) { b_found = true; break; @@ -89,11 +87,9 @@ } if (b_found == true) - return mpNodes[i]; + return mNodes[i]; else - { return NULL; - } } amis::dtb::nav::NavNode* amis::dtb::nav::NavList::goToContentRef(string contentHref) @@ -103,12 +99,10 @@ unsigned int i = 0; - for (i=0; i<mpNodes.size(); i++) + for (i=0; i<mNodes.size(); i++) { - content_href = mpNodes[i]->getContent(); - + content_href = mNodes[i]->getContent(); content_href = amis::util::FilePathTools::getFileName(content_href); - if (content_href.compare(contentHref) == 0) { b_found = true; @@ -117,24 +111,19 @@ } if (b_found == true) - { - return mpNodes[i]; - } + return mNodes[i]; else - { return NULL; - } } amis::dtb::nav::NavNode* amis::dtb::nav::NavList::goToId(string id) { bool b_found = false; - unsigned int i = 0; - for (i=0; i<mpNodes.size(); i++) + for (i=0; i<mNodes.size(); i++) { - if (mpNodes[i]->getId().compare(id) == 0) + if (mNodes[i]->getId().compare(id) == 0) { b_found = true; break; @@ -142,36 +131,32 @@ } if (b_found == true) - { - return mpNodes[i]; - } + return mNodes[i]; else - { return NULL; - } } void amis::dtb::nav::NavList::print(bool printheader) { if (printheader) cout<<"Nav List: "<<this->getId()<<endl; - for (unsigned int i=0; i<mpNodes.size(); i++) + for (unsigned int i=0; i<mNodes.size(); i++) { - mpNodes[i]->print(0); + mNodes[i]->print(0); } } void amis::dtb::nav::NavList::acceptDepthFirst(NavVisitor* v) { - if (mpNodes.size() > 0) - mpNodes.front()->acceptDepthFirst(v); + if (mNodes.size() > 0) + mNodes.front()->acceptDepthFirst(v); } amis::dtb::nav::NavTarget* amis::dtb::nav::NavList::getAtIndex(int idx) { - if (idx >= 0 && idx < mpNodes.size()) - return mpNodes[idx]; + if (idx >= 0 && idx < mNodes.size()) + return mNodes[idx]; else return NULL; } Modified: branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -30,25 +30,18 @@ //all models will have a nav map and page list mpNavMap = new NavMap(); mpPageList = new PageList(); - - mpPageList->setNavModel(this); mpNavMap->setNavModel(this); - NavPoint* p_root = new NavPoint(); - //give the map a 'fake' root p_root->setClass("ROOT"); p_root->setLevel(0); p_root->setPlayOrder(-1); p_root->setId("ROOT"); p_root->setParent(NULL); - p_root->setNavModel(this); p_root->setLabel(NULL); - mpNavMap->setRoot(p_root); - mpSmilIdNodeMap = NULL; } @@ -58,10 +51,7 @@ int sz = mNavLists.size(); NavList* p_tmp_navlist; - if (mpNavMap != NULL) - { - delete mpNavMap; - } + if (mpNavMap != NULL) delete mpNavMap; //delete nav lists and page list for (i=sz-1; i>=0; i--) @@ -69,10 +59,7 @@ p_tmp_navlist = NULL; p_tmp_navlist = mNavLists[i]; mNavLists.pop_back(); - if (p_tmp_navlist != NULL) - { - delete p_tmp_navlist; - } + if (p_tmp_navlist != NULL) delete p_tmp_navlist; } if (mpPageList != NULL) delete mpPageList; @@ -101,12 +88,33 @@ amis::dtb::nav::NavList* amis::dtb::nav::NavModel::getNavList(unsigned int index) { if (index < mNavLists.size()) + return mNavLists[index]; + else + return NULL; +} +void amis::dtb::nav::NavModel::addToPlayOrderList(amis::dtb::nav::NavNode* pNode) +{ + 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) { - return mNavLists[index]; + mPlayOrderList.push_back(pNode); } + //we are adding nodes out of order (not unusual) else { - return NULL; + 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) + { + vector<NavNode*>::iterator it; + it = mPlayOrderList.begin(); + for (int i = 0; i<next_in_sequence; i++) it++; + mPlayOrderList.insert(it, pNode); + } } } Modified: branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -30,25 +30,16 @@ mpSibling = NULL; mpParent = NULL; mpFirstChild = NULL; - this->mTypeOfNode = NavNode::NAV_POINT; } -//-------------------------------------------------- //Destructor -/*! - delete all children recursively -*/ -//-------------------------------------------------- amis::dtb::nav::NavPoint::~NavPoint() { NavPoint* p_tmp_node; //if this node has no children, perform any internal cleanup and return - if (mpFirstChild == NULL) - { - return; - } + if (mpFirstChild == NULL) return; //else, this node has one or more children else @@ -58,7 +49,6 @@ { p_tmp_node = getChild(mNumChildren-1); delete p_tmp_node; - //each time a child is deleted, decrement the number of children mNumChildren--; } @@ -84,13 +74,9 @@ //we are leaving this branch so reset the child count this->resetChildCount(); if (mpParent != NULL) - { return mpParent->next(); - } else - { return NULL; - } } } @@ -102,12 +88,7 @@ return NULL; } -//-------------------------------------------------- //return the immediate sibling -/*! - delete all children recursively -*/ -//-------------------------------------------------- amis::dtb::nav::NavPoint* amis::dtb::nav::NavPoint::getFirstSibling() { return mpSibling; @@ -115,7 +96,6 @@ amis::dtb::nav::NavPoint* amis::dtb::nav::NavPoint::getChild(int index) { - //local variables NavPoint* p_tmp_node; //check the bounds of the requested index @@ -146,14 +126,13 @@ } -//-------------------------------------------------- //return the number of children that this node has -//-------------------------------------------------- int amis::dtb::nav::NavPoint::getNumChildren() { return mNumChildren; } +//return the level in the hierarchy (0 is outermost, 1 is indented once, etc) int amis::dtb::nav::NavPoint::getLevel() { return mLevel; @@ -168,22 +147,20 @@ //-------------------------------------------------- void amis::dtb::nav::NavPoint::addSibling(NavPoint* pNode) { - //if-else block to see if this node's sibling pointer is null if (mpSibling == NULL) { //add the new node pointer as its sibling - mpSibling = pNode; - + mpSibling = pNode; //set the new node's parent to be the same as this node's parent mpSibling->setParent(this->getParent()); + //register this node with the play order list + mpNavModel->addToPlayOrderList(pNode); } else { //recursive call to try and add the new node to the sibling of this node mpSibling->addSibling(pNode); } - //end if-else block to see if this node's sibling pointer is null - } @@ -203,9 +180,10 @@ { //set new node pointer as first child mpFirstChild = pNode; - //set the new child's parent to be this node mpFirstChild->setParent(this); + //register this node with the play order list + mpNavModel->addToPlayOrderList(pNode); } //if exists, add new node pointer as a sibling @@ -243,14 +221,11 @@ { if (v->preVisit(this)) { - //read the children + //read the children first if (mpFirstChild != NULL) - { mpFirstChild->acceptDepthFirst(v); - } + //then look to the siblings if (mpSibling != NULL) - { mpSibling->acceptDepthFirst(v); - } } } Modified: branches/amis3/AmisCore/src/dtb/nav/PageList.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/PageList.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/dtb/nav/PageList.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -45,6 +45,8 @@ { 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/io/NavFileReader.cpp =================================================================== --- branches/amis3/AmisCore/src/io/NavFileReader.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/io/NavFileReader.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -65,7 +65,7 @@ } bool amis::io::NavFileReader::readFromFile(const ambulant::net::url* filepath) { - this->mPlayOrderCount = 0; + this->mPlayOrderCount = 1; this->mbFlag_GetChars = false; this->mpCurrentNavPoint = NULL; Modified: branches/amis3/AmisCore/src/io/NccFileReader.cpp =================================================================== --- branches/amis3/AmisCore/src/io/NccFileReader.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/io/NccFileReader.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -238,17 +238,11 @@ p_page->setId(id); if (classname.compare("front") == 0) - { p_page->setType(amis::dtb::nav::PageTarget::PAGE_FRONT); - } else if(classname.compare("normal") == 0) - { p_page->setType(amis::dtb::nav::PageTarget::PAGE_NORMAL); - } else if(classname.compare("special") == 0) - { p_page->setType(amis::dtb::nav::PageTarget::PAGE_SPECIAL); - } mPlayOrderCount++; @@ -259,8 +253,7 @@ p_page_list = mpNavModel->getPageList(); p_page_list->addNode(p_page); - mpCurrentPageTarget = p_page; - + mpCurrentPageTarget = p_page; addCustomTest("pagenumber", true, true, ""); } @@ -292,33 +285,22 @@ } p_nav_list->addNode(p_navt); - mpCurrentNavTarget = p_navt; //see if we should add a custom test to the list string custom_test; if (classname.compare("sidebar") == 0) - { custom_test = "sidebar"; - } else if (classname.compare("optional-prodnote") == 0) - { custom_test = "prodnote"; - } else if(classname.compare("noteref") == 0) - { custom_test = "footnote"; - } else - { custom_test = ""; - } if (custom_test.compare("") != 0) - { addCustomTest(custom_test, true, true, ""); - } } } @@ -344,7 +326,6 @@ int newidx = mpNavModel->addNavList(classname); p_nav_list = mpNavModel->getNavList(newidx); } - p_nav_list->addNode(p_navt); mpCurrentNavTarget = p_navt; } Modified: branches/amis3/AmisCore/src/io/NcxFileReader.cpp =================================================================== --- branches/amis3/AmisCore/src/io/NcxFileReader.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/io/NcxFileReader.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -209,7 +209,7 @@ play_order.assign(SimpleAttrs::get("playOrder", pAttrs)); int i_play_order = atoi(play_order.c_str()); mpCurrentNavPoint->setPlayOrder(i_play_order); - + //get the last item from the open nodes list and set it as the parent for this node int len = mOpenNodes.size(); amis::dtb::nav::NavPoint* p_parent = mOpenNodes[len-1]; @@ -292,9 +292,8 @@ play_order.assign(SimpleAttrs::get("playOrder", pAttrs)); int i_play_order = atoi(play_order.c_str()); mpCurrentNavTarget->setPlayOrder(i_play_order); - + amis::dtb::nav::NavList* p_nav_list = NULL; - int num = mpNavModel->getNumberOfNavLists(); p_nav_list = mpNavModel->getNavList(num-1); @@ -323,7 +322,6 @@ play_order.assign(SimpleAttrs::get("playOrder", pAttrs)); int i_play_order = atoi(play_order.c_str()); p_page->setPlayOrder(i_play_order); - p_page_list->addNode(p_page); mpCurrentPageTarget = p_page; Modified: branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp =================================================================== --- branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -24,6 +24,7 @@ #include "util/FilePathTools.h" #include "io/UrlInputSource.h" #include <iostream> +#include "util/Log.h" //XERCES INCLUDES #include <xercesc/util/XMLString.hpp> @@ -55,7 +56,7 @@ { SAX2XMLReader* parser; mFilepath = *filepath; - + amis::util::Log::Instance()->writeMessage("Parsing file: ", filepath, "XercesSaxParseBase::parseFile", "AmisCore"); //try-catch block for Xerces platform utilities try { @@ -70,6 +71,7 @@ str.assign(msg); mError.setMessage(str); XMLString::release(&msg); + amis::util::Log::Instance()->writeError(mError, "XercesSaxParseBase::parseFile", "AmisCore"); return false; } @@ -89,6 +91,7 @@ mError.setMessage(str); delete parser; XMLPlatformUtils::Terminate(); + amis::util::Log::Instance()->writeError(mError, "XercesSaxParseBase::parseFile", "AmisCore"); return false; } //try-catch block for Xerces parsing @@ -111,6 +114,7 @@ XMLString::release(&msg); delete parser; XMLPlatformUtils::Terminate(); + amis::util::Log::Instance()->writeError(mError, "XercesSaxParseBase::parseFile", "AmisCore"); return false; } @@ -130,7 +134,9 @@ } if (mError.getCode() != amis::OK) return false; - else return true; + + amis::util::Log::Instance()->writeMessage("Done parsing.", "XercesSaxParseBase::parseFile", "AmisCore"); + return true; } amis::Error amis::io::XercesSaxParseBase::getError() @@ -140,12 +146,20 @@ void amis::io::XercesSaxParseBase::warning(const SAXParseException& e) { - //ignore this, it's non-fatal + char* xerces_msg = XMLString::transcode(e.getMessage()); + string msg = "While processing *" + mFilepath.get_url() + + "* Xerces said: \"" + xerces_msg + "\""; + amis::util::Log::Instance()->writeWarning(msg, "XercesSaxParseBase::warning", "AmisCore"); + XMLString::release(&xerces_msg); } void amis::io::XercesSaxParseBase::error(const SAXParseException& e) { - //ignore this, it's non-fatal + char* xerces_msg = XMLString::transcode(e.getMessage()); + string msg = "While processing *" + mFilepath.get_url() + + "* Xerces said: \"" + xerces_msg + "\""; + amis::util::Log::Instance()->writeError(msg, "XercesSaxParseBase::error", "AmisCore"); + XMLString::release(&xerces_msg); } void amis::io::XercesSaxParseBase::fatalError(const SAXParseException& e) @@ -153,8 +167,8 @@ char* xerces_msg = XMLString::transcode(e.getMessage()); mError.setCode (amis::PARSE_ERROR); string msg = "While processing *" + mFilepath.get_url() + - "* Xerces signalled: \"" + xerces_msg + "\""; + "* Xerces said: \"" + xerces_msg + "\""; mError.setMessage(msg); - + amis::util::Log::Instance()->writeError(mError, "XercesSaxParseBase::fatalError", "AmisCore"); XMLString::release(&xerces_msg); } Added: branches/amis3/AmisCore/src/util/Log.cpp =================================================================== --- branches/amis3/AmisCore/src/util/Log.cpp (rev 0) +++ branches/amis3/AmisCore/src/util/Log.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -0,0 +1,123 @@ +/* +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 "util/Log.h" +#ifdef AMIS_PLATFORM_WINDOWS +#include "time.h" +#else +//TODO: timestamp for other platforms +#endif +using namespace std; + +amis::util::Log* amis::util::Log::pinstance = 0; + +amis::util::Log* amis::util::Log::Instance() +{ + if (pinstance == 0) pinstance = new amis::util::Log(); + return pinstance; +} + +amis::util::Log::Log() +{ + mbIsFileOpen = false; +} +amis::util::Log::~Log() +{ +} + +void amis::util::Log::startLog(string filename) +{ + mFile.open(filename.c_str(), ios::out); + mbIsFileOpen = true; + mFile<<"AMIS Log"<<endl; +#ifdef AMIS_PLATFORM_WINDOWS + char datestr[10]; + char timestr[10]; + _strdate(datestr); + _strtime(timestr); + mFile<<datestr<<"\n"<<timestr<<endl; +#else + //TODO: timestamp for other platforms +#endif + mFile<<"-------------------------------------"<<endl; +} + +void amis::util::Log::endLog() +{ + mFile.close(); + mbIsFileOpen = false; +} +void amis::util::Log::writeError(amis::Error error, string origin, string library) +{ + writeError(error.getMessage(), origin, library); +} +void amis::util::Log::writeError(string msg, string origin, string library) +{ + writeData("ERROR", msg, origin, library); +} +void amis::util::Log::writeWarning(string msg, string origin, string library) +{ + writeData("WARNING", msg, origin, library); +} +void amis::util::Log::writeMessage(string msg, string origin, string library) +{ + writeData("", msg, origin, library); +} +void amis::util::Log::writeMessage(string msg, const ambulant::net::url* file, string origin, string library) +{ + string log_msg = msg; + if (file != NULL) log_msg += file->get_url(); + else log_msg += "*NULL file name*"; + writeMessage(log_msg, origin, library); +} +void amis::util::Log::writeWarning(string msg, const ambulant::net::url* file, string origin, string library) +{ + string log_msg = msg; + if (file != NULL) log_msg += file->get_url(); + else log_msg += "*NULL file name*"; + writeWarning(log_msg, origin, library); +} +void amis::util::Log::writeError(string msg, const ambulant::net::url* file, string origin, string library) +{ + string log_msg = msg; + if (file != NULL) log_msg += file->get_url(); + else log_msg += "*NULL file name*"; + writeError(log_msg, origin, library); +} +void amis::util::Log::writeMessage(string msg) +{ + writeData("", msg, "", ""); +} +void amis::util::Log::writeMessage(string msg, const ambulant::net::url* file) +{ + writeMessage("", file, "", ""); +} +void amis::util::Log::writeData(string type, string msg, string origin, string library) +{ + if (!mbIsFileOpen) return; + + if (type != "") mFile<<type<<": "; + mFile<<msg; + if (origin != "") mFile<<" ["<<origin; + if (library != "") mFile<<" {"<<library<<") "; + if (origin != "") mFile<<"]"; + mFile<<endl; +} \ No newline at end of file Modified: branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp =================================================================== --- branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisCore/testAmisCoreWin32/testAmisCore.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -12,6 +12,7 @@ #include "dtb/nav/NavList.h" #include "dtb/nav/NavMap.h" #include "util/FilePathTools.h" +#include "util/Log.h" #include <tchar.h> #include <iostream> Modified: branches/amis3/AmisGuiMFC2/include/Preferences.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-02-26 05:25:21 UTC (rev 2342) @@ -52,7 +52,8 @@ ~Preferences(); //the preferences IO class should call this function after reading in the XML file void scanAll(); - + void logAllPreferences(); + void logUserControllablePreferences(); //ACCESSORS void setUiLangId(string); string getUiLangId(); Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -30,8 +30,8 @@ #include "gui/TextRenderBrain.h" #include "ambulant/net/url.h" #include "ambulant/smil2/test_attrs.h" +#include "util/Log.h" - using namespace amis::dtb; DtbWithHooks* DtbWithHooks::pinstance = 0; @@ -345,7 +345,7 @@ p_mark = p_bmks->getItem(index); if (!p_mark) return; - + amis::util::Log::Instance()->writeMessage("Loading bookmark", "DtbWitHooks::loadBookmark", "AmisGuiMFC2"); loadSmilFromUrl(&p_mark->mpStart->mUri); } @@ -358,8 +358,10 @@ //set the spine at this file. this also makes sure that we're going to a file that is in the book. if (getSpine()->goToFile(&full_path)) { - - LPCTSTR str_ = A2T(full_path.get_url().c_str()); //(LPSTR) + LPCTSTR str_ = A2T(full_path.get_url().c_str()); + string log_msg = "Loading SMIL from URL: " + full_path.get_url(); + amis::util::Log::Instance()->writeMessage("Loading SMIL from URL", &full_path, + "DtbWithHooks::loadSmilFromUrl", "AmisGuiMFC2"); amis::gui::MainWndParts::Instance()->mpMmDoc->OnOpenDocument(str_); } //DanToDo: Is this the best place to set the PLAY/PAUSE status ? (is the book actually playing at this stage...probably not) Modified: branches/amis3/AmisGuiMFC2/src/Preferences.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -26,7 +26,7 @@ #include "util/SearchForFilesMFC.h" #include "util/FilePathTools.h" #include "io/ModuleDescReader.h" - +#include "util/Log.h" using namespace amis; Preferences* Preferences::pinstance = 0; @@ -98,14 +98,23 @@ { mFontsizeCssFiles = *searcher.getSearchResults(); } - else TRACE(_T("No fontsize css files found\n"));//TODO Log this message instead + else + { + TRACE(_T("No fontsize css files found\n")); + amis::util::Log::Instance()->writeWarning("No fontsize css files found in directory", + &mFontsizeCssDir, "Preferences::scanDirectoriesForCssFiles", "AmisGuiMFC2"); + } searcher.clearSearchResults(); if (searcher.startSearch(mContrastCssDir.get_file()) > 0) { mContrastCssFiles = *searcher.getSearchResults(); } - else TRACE(_T("No contrast css files found\n"));//TODO Log this message instead + else + { + TRACE(_T("No contrast css files found\n")); + string log_msg = "No contrast css files found in " + mContrastCssDir.get_url(); + } } //search for "moduleDesc.xml" files that inside the root language pack directory @@ -129,8 +138,10 @@ amis::ModuleDescData* p_data = reader.getModuleDescData(); if (p_data == NULL) { - //TODO: log error - no data available for language pack TRACE(_T("No data available for language pack\n")); + string log_msg = "No data available for language pack " + list[i].get_url(); + amis::util::Log::Instance()->writeError("No data available for language pack", + &list[i], "Preferences::scanDirectoriesForLanguagePackFiles", "AmisGuiMFC2"); } else { @@ -138,17 +149,26 @@ { string id = p_data->getId(); mInstalledLanguages[id] = p_data; + string log_msg = "Added language pack for " + id; + amis::util::Log::Instance()->writeMessage(log_msg, + "Preferences::scanDirectoriesForLanguagePackFile", "AmisGuiMFC2"); } } } else { - //TODO: log error - could not read language pack file TRACE(_T("Could not read language pack file\n")); + amis::util::Log::Instance()->writeError("Could not read language pack file: ", &list[i], + "Preferences::scanDirectoriesForLanguagePackFiles", "AmisGuiMFC2"); } } } - else TRACE(_T("No language pack files found\n"));//TODO Log this message instead + else + { + TRACE(_T("No language pack files found\n")); + amis::util::Log::Instance()->writeError("No language pack files found", + "Preferences::scanDirectoriesForLanguagePackFiles", "AmisGuiMFC2"); + } } Preferences::~Preferences() @@ -347,4 +367,123 @@ { amis::ModuleDescData* p_data = mInstalledLanguages[mUiLangId]; return p_data; +} + +void Preferences::logAllPreferences() +{ + amis::util::Log* p_log = amis::util::Log::Instance(); + p_log->writeMessage("__Preferences (all)__"); + + p_log->writeMessage("\tPreferences XML File: ", getSourceUrl()); + + string log_msg = "\tLanguage pack = " + getUiLangId(); + p_log->writeMessage(log_msg); + + log_msg = "\tStartup view = "; + if (getStartInBasicView()) log_msg += "Basic"; + else log_msg += "Default"; + p_log->writeMessage(log_msg); + + log_msg = "\tWill load last book on startup? "; + if (getLoadLastBook()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tWill pause when AMIS loses application focus? "; + if (getPauseOnLostFocus()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tIs self-voicing? "; + if (getIsSelfVoicing()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + //TODO: log tts voice index as something meaningful + + log_msg = "\tUsing TTS or pre-recorded audio? "; + if (getUseTTSNotAudio()) log_msg += "TTS"; + else log_msg += "Audio"; + p_log->writeMessage(log_msg); + + log_msg = "\tDid AMIS exit cleanly last time? "; + if (getWasExitClean()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tHighlight text? "; + if (getHighlightText()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tDisable screensaver? "; + if (getDisableScreensaver()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + p_log->writeMessage("\tBookmark dir = ", &mUserBmkDir); + p_log->writeMessage("\tLangpacks dir = ", &mLangpacksDir); + p_log->writeMessage("\tFontsize css dir = ", &mFontsizeCssDir); + p_log->writeMessage("\tContrast css dir = ", &mContrastCssDir); + p_log->writeMessage("\tUser css file = ", &mUserCssFile); + p_log->writeMessage("\tZed2005 css file = ", &mZed2005CssFile); + + p_log->writeMessage("\tInstalled language packs:"); + amis::StringModuleMap::iterator it; + it = mInstalledLanguages.begin(); + while (it != mInstalledLanguages.end()) + { + string lang_id = it->first; + log_msg = "\t\t" + lang_id; + p_log->writeMessage(log_msg); + it++; + } + + p_log->writeMessage("\tFontsize CSS files:"); + for (int i = 0; i<mFontsizeCssFiles.size(); i++) + p_log->writeMessage("\t\t", &mFontsizeCssFiles[i]); + + + p_log->writeMessage("\tContrast CSS files:"); + for (i = 0; i<mContrastCssFiles.size(); i++) + p_log->writeMessage("\t\t", &mContrastCssFiles[i]); +} + +void Preferences::logUserControllablePreferences() +{ + amis::util::Log* p_log = amis::util::Log::Instance(); + p_log->writeMessage("__Preferences (user-controllable only)__"); + + string log_msg = "\tLanguage pack = " + getUiLangId(); + p_log->writeMessage(log_msg); + + log_msg = "\tStartup view = "; + if (getStartInBasicView()) log_msg += "Basic"; + else log_msg += "Default"; + p_log->writeMessage(log_msg); + + log_msg = "\tWill load last book on startup? "; + if (getLoadLastBook()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tWill pause when AMIS loses application focus? "; + if (getPauseOnLostFocus()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tIs self-voicing? "; + if (getIsSelfVoicing()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tHighlight text? "; + if (getHighlightText()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); + + log_msg = "\tDisable screensaver? "; + if (getDisableScreensaver()) log_msg += "Yes"; + else log_msg += "No"; + p_log->writeMessage(log_msg); } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -28,7 +28,7 @@ #include "io/RecentBooksFileIO.h" #include "io/PreferencesFileIO.h" #include "util/SearchForFilesMFC.h" - +#include "util/Log.h" #include "pdtb.h" #include "dtb/nav/NavModel.h" #include "DtbWithHooks.h" @@ -128,7 +128,11 @@ 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(); @@ -156,7 +160,12 @@ // object and then sets it as the application's main window object CMDIFrameWnd* pFrame = new CMainFrame; - if (!pFrame->LoadFrame(IDR_AMISTYPE)) return FALSE; + if (!pFrame->LoadFrame(IDR_AMISTYPE)) + { + amis::util::Log::Instance()->writeError("Could not load MFC frame IDR_AMISTYPE", "CMainFrame::InitInstance", + "AmisGuiMFC2"); + return FALSE; + } m_pMainWnd = pFrame; @@ -167,7 +176,12 @@ // Dispatch commands specified on the command line //it turns out that this step is rather important even if you're not really interested in //the command line because mfc processes dynamic view creation somewhere in here. - if (!ProcessShellCommand(cmdInfo)) return FALSE; + if (!ProcessShellCommand(cmdInfo)) + { + amis::util::Log::Instance()->writeError("Error processing shell command info", "CAmisApp::InitInstance", + "AmisGuiMFC2"); + return FALSE; + } // try to load shared MDI menus and accelerator table HINSTANCE hInst = AfxGetResourceHandle(); @@ -194,6 +208,7 @@ int CAmisApp::ExitInstance() { + amis::util::Log::Instance()->writeMessage("Exiting", "CAmisApp::ExitInstance", "AmisGuiMFC2"); if (m_hMDIMenu != NULL) FreeResource(m_hMDIMenu); if (m_hMDIAccel != NULL)FreeResource(m_hMDIAccel); @@ -213,6 +228,7 @@ if (mpRecentBooks) delete mpRecentBooks; + amis::util::Log::Instance()->endLog(); return CWinApp::ExitInstance(); } @@ -357,9 +373,14 @@ ********************************/ 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(); - if (filename == "") return; + if (filename == "") + { + amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnFileOpen", "AmisGuiMFC2"); + return; + } //the user is able to open UAK files through AMIS if (isUserKeyFile(filename)) @@ -376,35 +397,39 @@ void CAmisApp::OnPlayPause() { - if (MainWndParts::Instance()->mpMainFrame->mbWasPlayingWhenLostFocus) { + if (MainWndParts::Instance()->mpMainFrame->mbWasPlayingWhenLostFocus) MainWndParts::Instance()->mpMainFrame->mbWasPlayingWhenLostFocus = false; - } MmView *view = MainWndParts::Instance()->mpMmView; assert(view); // XXXJack: or what to do if view == NULL? Skip? if (view->isPlaying() == true) { + amis::util::Log::Instance()->writeMessage("Pausing", "CAmisApp::OnPlayPause", "AmisGuiMFC2"); view->OnFilePause(); } else { + amis::util::Log::Instance()->writeMessage("Playing", "CAmisApp::OnPlayPause", "AmisGuiMFC2"); view->OnFilePlay(); } } void CAmisApp::OnNavPrevPhrase() { + amis::util::Log::Instance()->writeMessage("Previous phrase", "CAmisApp::OnNavPrevPhrase", "AmisGuiMFC2"); amis::dtb::DtbWithHooks::Instance()->previousPhrase(); } void CAmisApp::OnNavNextPhrase() { + amis::util::Log::Instance()->writeMessage("Next phrase", "CAmisApp::OnNavNextPhrase", "AmisGuiMFC2"); amis::dtb::DtbWithHooks::Instance()->nextPhrase(); } void CAmisApp::OnFileExit() { + amis::util::Log::Instance()->writeMessage("Exiting", "CAmisApp::OnFileExit", "AmisGuiMFC2"); CWnd * ptr = AfxGetMainWnd(); ptr->SendMessage(WM_CLOSE); } @@ -419,38 +444,46 @@ amis::RecentBookEntry* p_book = NULL; p_book = mpRecentBooks->getEntry(selection); - + string log_msg = "Loading recent book " + p_book->mPath.get_url(); + amis::util::Log::Instance()->writeMessage("Loading recent book", &p_book->mPath, "CAmisApp::OnFileRecentBook", "AmisGuiMFC2"); openBook(&p_book->mPath); } void CAmisApp::OnNavNextSection() { + amis::util::Log::Instance()->writeMessage("Next section", "CAmisApp::OnNavNextSection", "AmisGuiMFC2"); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.nextSection(); } void CAmisApp::OnNavPreviousSection() { + amis::util::Log::Instance()->writeMessage("Previous section", "CAmisApp::OnNavPreviousSection", "AmisGuiMFC2"); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.previousSection(); } void CAmisApp::OnNavShowSectionDepth(UINT id) { int level = id - SECTION_DEPTH_BASE_ID; + string log_msg = "Setting section depth to " + level; + amis::util::Log::Instance()->writeMessage(log_msg, "CAmisApp::OnNavShowSectionDepth", "AmisGuiMFC2"); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.expandSections(level); } void CAmisApp::OnNavNextPage() { + amis::util::Log::Instance()->writeMessage("Next page", "CAmisApp::OnNavNextPage", "AmisGuiMFC2"); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.nextPage(); } void CAmisApp::OnNavPrevPage() { + amis::util::Log::Instance()->writeMessage("Previous page", "CAmisApp::OnNavPrevPage", "AmisGuiMFC2"); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.previousPage(); } //TODO need to fix this...how do I stop ambulant? void CAmisApp::OnFileClose() { + amis::util::Log::Instance()->writeMessage("Closing book", "CAmisApp::OnFileClose", "AmisGuiMFC2"); if (mbBookIsOpen) { //the order matters here @@ -464,6 +497,7 @@ void CAmisApp::OnVolumeUp() { + amis::util::Log::Instance()->writeMessage("Volume increase", "CAmisApp::OnVolumeUp", "AmisGuiMFC2"); //amis::audio::AmisAudio::Instance()->adjustVolume(1.2); REMOVED because it makes more sense to allow book volume control than the whole application: otherwise users would use their OS-level volume control. ambulant::gui::dx::change_global_level(1.2); //amis::gui::spoken::AudioSequencePlayer::Instance()->playPromptFromUiId(ID_MENU_PLAY_VOLUP, true, NULL); @@ -471,6 +505,7 @@ void CAmisApp::OnVolumeDown() { + amis::util::Log::Instance()->writeMessage("Volume decrease", "CAmisApp::OnVolumeDown", "AmisGuiMFC2"); //amis::audio::AmisAudio::Instance()->adjustVolume(1.0/1.2); REMOVED because it makes more sense to allow book volume control than the whole application: otherwise users would use their OS-level volume control. ambulant::gui::dx::change_global_level(1.0/1.2); //amis::gui::spoken::AudioSequencePlayer::Instance()->playPromptFromUiId(ID_MENU_PLAY_VOLDOWN, true, NULL); @@ -478,6 +513,7 @@ 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(); @@ -491,6 +527,7 @@ 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(); @@ -504,6 +541,7 @@ 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); @@ -517,17 +555,20 @@ void CAmisApp::OnAbout() { + amis::util::Log::Instance()->writeMessage("Showing about box", "CAmisApp::OnAbout", "AmisGuiMFC2"); amis::gui::dialogs::AboutDialog about; about.do_modal(); } void CAmisApp::OnViewSidebarOnoff() { + amis::util::Log::Instance()->writeMessage("Toggle sidebar", "CAmisApp::OnViewSidebarOnOff", "AmisGuiMFC2"); MainWndParts::Instance()->toggleSidebar(); } void CAmisApp::OnPlayEscape() { + amis::util::Log::Instance()->writeMessage("Escape", "CAmisApp::OnPlayEscape","AmisGuiMFC2"); MmView *view = MainWndParts::Instance()->mpMmView; assert(view); view->escapeCurrent(); @@ -537,6 +578,7 @@ { USES_CONVERSION; + amis::util::Log::Instance()->writeMessage("Showing open from URL dialog", "CAmisApp::OnFileOpenFromUrl", "AmisGuiMFC2"); amis::gui::dialogs::OpenUrlDialog dlg; string str_url = ""; @@ -546,10 +588,13 @@ ambulant::net::url book_url = ambulant::net::url::from_url(str_url); openBook(&book_url); } + else + amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnFileOpenFromUrl", "AmisGuiMFC2"); } void CAmisApp::OnSkipInfo() { + 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(); @@ -558,6 +603,7 @@ void CAmisApp::OnAddBookmark() { + amis::util::Log::Instance()->writeMessage("Adding bookmark", "CAmisApp::OnAddBookmark", "AmisGuiMFC2"); amis::dtb::Bookmark* p_bmk = NULL; p_bmk = amis::dtb::DtbWithHooks::Instance()->addBookmark(); if (p_bmk) MenuManip::Instance()->addBookmark(p_bmk); @@ -567,13 +613,14 @@ { int idx; idx = id - BOOKMARKS_BASE_ID; - + amis::util::Log::Instance()->writeMessage("Loading bookmark", "CAmisApp::OnSelectBookmark", "AmisGuiMFC2"); amis::dtb::DtbWithHooks::Instance()->loadBookmark(idx); } void CAmisApp::OnGoToPage() { amis::gui::dialogs::GoToPageDialog dialog; + amis::util::Log::Instance()->writeMessage("Showing go to page dialog", "CAmisApp::OnGoToPage", "AmisGuiMFC2"); if (dialog.do_modal() == IDOK) { wstring page_number = dialog.getPageNumber(); @@ -586,32 +633,41 @@ if (p_page) amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_page); } } + else + amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnGoToPage", "AmisGuiMFC2"); } void CAmisApp::OnToggleContrast() { + amis::util::Log::Instance()->writeMessage("Toggle contrast", "CAmisApp::OnToggleContrast", "AmisGuiMFC2"); bool is_contrast_on = amis::gui::TextRenderBrain::Instance()->toggleContrast(); MenuManip::Instance()->setViewItemCheckmark(is_contrast_on, ID_MENU_VIEW_CONTRAST); } void CAmisApp::OnIncreaseFontSize() { + amis::util::Log::Instance()->writeMessage("Increase font size", "CAmisApp::OnIncreaseFontSize", "AmisGuiMFC2"); TextRenderBrain::Instance()->increaseFontSize(); } void CAmisApp::OnResetFontSize() { + amis::util::Log::Instance()->writeMessage("Reset font size", "CAmisApp::OnResetFontSize", "AmisGuiMFC2"); TextRenderBrain::Instance()->resetFontSize(); } void CAmisApp::OnSearchForBooks() { + amis::util::Log::Instance()->writeMessage("Showing search for books dialog", "CAmisApp::OnSearchForBooks", "AmisGuiMFC2"); dialogs::SearchForBooksDialog search; if (search.do_modal() == IDOK) { ambulant::net::url book_url = search.getBookToLoad(); this->openBook(&book_url); } + else + amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnSearchForBooks", "AmisGuiMFC2"); } void CAmisApp::OnLoadCd() { + amis::util::Log::Instance()->writeMessage("Loading from CD", "CAmisApp::OnLoadCd", "AmisGuiMFC2"); amis::util::SearchForFilesMFC searcher; //prepare the search tool searcher.clearAll(); @@ -627,20 +683,24 @@ if (num_books == 0) { generalBookErrorMsgBox(_T("No files found on this CD-ROM")); + amis::util::Log::Instance()->writeWarning("No DAISY books on CD-ROM", "CAmisApp::OnLoadCd", "AmisGuiMFC2"); } else { amis::UrlList* p_results = searcher.getSearchResults(); if (p_results->size() > 1) { + amis::util::Log::Instance()->writeMessage("Multiple books found on CD-ROM", "CAmisApp::OnLoadCd", "AmisGuiMFC2"); dialogs::MultipleBooksOnVolumeDialog dlg(NULL, p_results); + amis::util::Log::Instance()->writeMessage("Showing multiple books on volume dialog", "CAmisApp::OnLoadCd", "AmisGuiMFC2"); if (dlg.do_modal() == IDOK) - { openBook(&dlg.getBookToLoad()); - } + else + amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnLoadCd", "AmisGuiMFC2"); } else { + amis::util::Log::Instance()->writeMessage("Found one book on CD; opening it", "CAmisApp::OnLoadCd", "AmisGuiMFC2"); //open the first and only URL found openBook(&(*p_results)[0]); } @@ -650,6 +710,7 @@ void CAmisApp::OnPreferences() { dialogs::PreferencesDialog prefs; + amis::util::Log::Instance()->writeMessage("Showing preferences dialog", "CAmisApp::OnPreferences", "AmisGuiMFC2"); if (prefs.do_modal() == IDOK) { Preferences::Instance()->setIsSelfVoicing(prefs.mbIsSelfVoicing); @@ -671,12 +732,16 @@ amis::io::PreferencesFileIO prefs_io; prefs_io.writeToFile(Preferences::Instance()->getSourceUrl()->get_file(), Preferences::Instance()); + Preferences::Instance()->logUserControllablePreferences(); } + else + amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnPreferences", "AmisGuiMFC2"); } void CAmisApp::OnPublicationSummary() { dialogs::PublicationSummaryDialog summary; + amis::util::Log::Instance()->writeMessage("Showing publication summary dialog", "CAmisApp::OnPublicationSummary", "AmisGuiMFC2"); summary.setBook(amis::dtb::DtbWithHooks::Instance()); summary.DoModal(); } @@ -709,7 +774,8 @@ MainWndParts::Instance()->updateTitlePlayState(!pauseState); } -bool CAmisApp::beforeModalBox() { +bool CAmisApp::beforeModalBox() +{ if (amis::Preferences::Instance()->getIsSelfVoicing() == true) { @@ -726,12 +792,11 @@ return b_was_playing; } -void CAmisApp::afterModalBox(bool b_was_playing) { - +void CAmisApp::afterModalBox(bool b_was_playing) +{ if (amis::Preferences::Instance()->getIsSelfVoicing() == true) { AudioSequencePlayer::Instance()->Stop(); - AudioSequencePlayer::playPromptFromStringId("dialogClosed"); AudioSequencePlayer::Instance()->waitForSequenceEnd(); } @@ -739,7 +804,7 @@ //resume playback if (b_was_playing == true) { - MmView *view = MainWndParts::Instance()->mpMmView; + MmView *view = MainWndParts::Instance()->mpMmView; view->OnFilePlay(); } } @@ -748,9 +813,9 @@ { bool b = beforeModalBox(); - AudioSequencePlayer::Instance()->Stop(); - AudioSequencePlayer::playPromptFromStringId("generalBookError"); - AfxMessageBox(str); + AudioSequencePlayer::Instance()->Stop(); + AudioSequencePlayer::playPromptFromStringId("generalBookError"); + AfxMessageBox(str); afterModalBox(b); } Modified: branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp 2008-02-24 04:58:39 UTC (rev 2341) +++ branches/amis3/AmisGuiMFC2/src/gui/ChildFrm.cpp 2008-02-26 05:25:21 UTC (rev 2342) @@ -33,9 +33,6 @@ using namespace amis::gui; -///////////////////////////////////////////////////////////////////////////// -// CChildFrame - IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) @@ -45,13 +42,8 @@ //}}AFX_MSG_MAP END_MESSAGE_MAP() -///////////////////////////////////////////////////////////////////////////// -// CChildFrame construction/destruction - CChildFrame::CChildFrame() { - // add member initialization code here - } CChildFrame::~CChildFrame() @@ -60,20 +52,11 @@ BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { - // Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - if( !CMDIChildWnd::PreCreateWindow(cs) ) - return FALSE; - + // Modify the Window class or styles here by modifying the CREATESTRUCT cs + if(!CMDIChildWnd::PreCreateWindow(cs)) return FALSE; return TRUE; } - - -///////////////////////////////////////////////////////////////////////////// -// CChildFrame diagnostics - #ifdef _DEBUG void CChildFrame::AssertValid() const { @@ -87,24 +70,15 @@ #endif //_DEBUG -///////////////////////////////////////////////////////////////////////////// -// CChildFrame message handlers - int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { - if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) - return -1; - + if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; this->ShowWindow(SW_SHOWMAXIMIZED); - return 0; } void CChildFrame::OnClose() { - - this->ShowWindow(SW_MINIMIZE); - -// CMDIChildWnd::OnClose(); + // CMDIChildWnd::OnClose(); } Modified: branches/amis3/AmisGuiMFC2/src/gui/HtmlDoc.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/HtmlDoc.cpp 2008-02-24 04:58:39 UTC (r... [truncated message content] |
From: <dan...@us...> - 2008-02-26 09:31:10
|
Revision: 2343 http://amis.svn.sourceforge.net/amis/?rev=2343&view=rev Author: daniel_weck Date: 2008-02-26 01:29:53 -0800 (Tue, 26 Feb 2008) Log Message: ----------- - Self-voicing code now dispatched in "src" and "include". Modified Paths: -------------- branches/amis3/AmisAudio/AmisAudio.vcproj branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp Added Paths: ----------- branches/amis3/AmisAudio/include/ branches/amis3/AmisAudio/include/AmisAudio.h branches/amis3/AmisAudio/include/StdAfx.h branches/amis3/AmisAudio/include/TPBReader/ branches/amis3/AmisAudio/include/TPBReader/DmpCtl.h branches/amis3/AmisAudio/include/TPBReader/DmpPpg.h branches/amis3/AmisAudio/include/TPBReader/RegOcx.h branches/amis3/AmisAudio/include/TPBReader/Resource.h branches/amis3/AmisAudio/include/TPBReader/StdAfxFIX.h branches/amis3/AmisAudio/include/TPBReader/TransformSample.h branches/amis3/AmisAudio/include/TPBReader/Vupp1.h branches/amis3/AmisAudio/include/TPBReader/VuppInterface.h branches/amis3/AmisAudio/include/TPBReader/VuppSample.h branches/amis3/AmisAudio/include/TPBReader/dmp.h branches/amis3/AmisAudio/include/TPBReader/iTPBTS.h branches/amis3/AmisAudio/include/TPBReader/intvec.h branches/amis3/AmisAudio/include/directx/ branches/amis3/AmisAudio/include/directx/amextra.h branches/amis3/AmisAudio/include/directx/amfilter.h branches/amis3/AmisAudio/include/directx/cache.h branches/amis3/AmisAudio/include/directx/combase.h branches/amis3/AmisAudio/include/directx/cprop.h branches/amis3/AmisAudio/include/directx/ctlutil.h branches/amis3/AmisAudio/include/directx/ddmm.h branches/amis3/AmisAudio/include/directx/dllsetup.h branches/amis3/AmisAudio/include/directx/dsschedule.h branches/amis3/AmisAudio/include/directx/fourcc.h branches/amis3/AmisAudio/include/directx/measure.h branches/amis3/AmisAudio/include/directx/msgthrd.h branches/amis3/AmisAudio/include/directx/mtype.h branches/amis3/AmisAudio/include/directx/outputq.h branches/amis3/AmisAudio/include/directx/pstream.h branches/amis3/AmisAudio/include/directx/pullpin.h branches/amis3/AmisAudio/include/directx/refclock.h branches/amis3/AmisAudio/include/directx/reftime.h branches/amis3/AmisAudio/include/directx/renbase.h branches/amis3/AmisAudio/include/directx/schedule.h branches/amis3/AmisAudio/include/directx/seekpt.h branches/amis3/AmisAudio/include/directx/source.h branches/amis3/AmisAudio/include/directx/streams.h branches/amis3/AmisAudio/include/directx/strmctl.h branches/amis3/AmisAudio/include/directx/sysclock.h branches/amis3/AmisAudio/include/directx/transfrm.h branches/amis3/AmisAudio/include/directx/transip.h branches/amis3/AmisAudio/include/directx/videoctl.h branches/amis3/AmisAudio/include/directx/vtrans.h branches/amis3/AmisAudio/include/directx/winctrl.h branches/amis3/AmisAudio/include/directx/winutil.h branches/amis3/AmisAudio/include/directx/wxdebug.h branches/amis3/AmisAudio/include/directx/wxlist.h branches/amis3/AmisAudio/include/directx/wxutil.h branches/amis3/AmisAudio/include/mffmTimeCode/ branches/amis3/AmisAudio/include/mffmTimeCode/SmilTimeCode.H branches/amis3/AmisAudio/include/mffmTimeCode/counter.H branches/amis3/AmisAudio/include/mffmTimeCode/field.H branches/amis3/AmisAudio/include/mffmTimeCode/masterCounter.H branches/amis3/AmisAudio/include/mffmTimeCode/masterCounterArray.H branches/amis3/AmisAudio/include/mffmTimeCode/timeCode.H branches/amis3/AmisAudio/include/mffmTimeCode/win32fix.H branches/amis3/AmisAudio/src/ branches/amis3/AmisAudio/src/AmisAudio.cpp branches/amis3/AmisAudio/src/StdAfx.cpp branches/amis3/AmisAudio/src/TPBReader/ branches/amis3/AmisAudio/src/TPBReader/DmpCtl.cpp branches/amis3/AmisAudio/src/TPBReader/DmpPpg.cpp branches/amis3/AmisAudio/src/TPBReader/RegOcx.cpp branches/amis3/AmisAudio/src/TPBReader/StdAfx.cpp branches/amis3/AmisAudio/src/TPBReader/dmp.cpp branches/amis3/AmisGuiMFC2/include/gui/self-voicing/ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioPrompt.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequenceComponent.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/PreTranslateMessageHandler.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/Prompt.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/PromptResolver.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/TTSPlayer.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/UiMediaTypes.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/AccessibleUiDataReader.h 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/DataTree.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Dialog.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/IniFile.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Label.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/LabelList.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Switch.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/UiItem.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/SkipDialogVoicing.h branches/amis3/AmisGuiMFC2/src/gui/self-voicing/ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioPrompt.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/PreTranslateMessageHandler.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PromptResolver.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/ 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 branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Dialog.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/DialogControl.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/IniFile.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Label.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/LabelList.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Switch.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/UiItem.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/SkipDialogVoicing.cpp Removed Paths: ------------- branches/amis3/AmisAudio/AmisAudio.cpp branches/amis3/AmisAudio/AmisAudio.h branches/amis3/AmisAudio/StdAfx.cpp branches/amis3/AmisAudio/StdAfx.h branches/amis3/AmisAudio/TPBReader2/ branches/amis3/AmisAudio/mffmTimeCode/ branches/amis3/AmisGuiMFC2/AmisSelfVoicing/ Deleted: branches/amis3/AmisAudio/AmisAudio.cpp =================================================================== --- branches/amis3/AmisAudio/AmisAudio.cpp 2008-02-26 05:25:21 UTC (rev 2342) +++ branches/amis3/AmisAudio/AmisAudio.cpp 2008-02-26 09:29:53 UTC (rev 2343) @@ -1,614 +0,0 @@ -/* -AmisAudio - -Copyright (C) 2005 DAISY for All Project - -Licensing note: This file is released as LGPL; however, its module relies upon GPL code in third party libraries. Any reuse of this library in a closed source environment must contact the GPL license holders to negotiate terms for use with an altered license. GPL code referenced from this module includes, but may not be limited to, libfftw, WSOLA code by Matt Flax, and stlib. - -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 -*/ -// AmisAudio.cpp : Defines the entry point for the DLL application. - - -#include <stdlib.h> -#include <iostream> -#include <string> -#include "AmisAudio.h" - -#include <process.h> - -using namespace amis::audio; - -//#include "win32Fix.H" - -//#include "../AmisGuiMFC/Brain/Preferences.h" - - -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; -} - - - -namespace amis -{ -namespace audio -{ -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(HWND parentWindow) -{ - mState=NOTACTIVE; - mVolume=100; - mWsolaSource=NULL; - - parentWnd=parentWindow; -}*/ - -AmisAudio::AmisAudio() -{ - //pDmpApp = 0; - pDmpCtrl = 0; - mTau=1.0; - mState=NOTACTIVE; - mVolume=1.0; - - mbAudioPlaybackEnabled = true; - - pDmpCtrl = new CDmpCtrl(); -} - -void AmisAudio::setCallback(sendMessageCallbackFn pFunction) -{ - pDmpCtrl->setCallback(pFunction); -} -/****************************************************************** -AmisAudio destructor Function -******************************************************************/ - - -AmisAudio::~AmisAudio() -{ - if (pDmpCtrl) delete pDmpCtrl; - - /*clean up code goes here*/ -} - -void AmisAudio::DestroyInstance() -{ - if (pinstance) delete pinstance; -} - -void AmisAudio::setStatePause() { - mState = PAUSE; - -} - - -/*-------------------------------------------------------------------------------------------------------------------------- -This function enables Audio plugin, initializes rate to 1.0 and volume to 100 -----------------------------------------------------------------------------------------------------------------------------*/ -void AmisAudio::enable() -{ - if (pDmpCtrl) { - mState=PAUSE; //ACTIVE - mTau=1.0; - mVolume = 1.0; - return; - } - switch(mState) - { - case NOTACTIVE: - { - - mState=PAUSE; //ACTIVE - // mRate = 1.0; - mTau=1.0; - mVolume = 1.0; - return; - } - default: - return; - //return"Audio Plugin is already enabled"; - } -} - -/*-------------------------------------------------------------------------------------------------------------------------- -This function disables Audio plugin -----------------------------------------------------------------------------------------------------------------------------*/ -void AmisAudio::disable() -{ - switch(mState) - { - //case ACTIVE: - case PLAYING: - case PAUSE: - //if(mState==PLAYING) - { - stop(); - ShowStatePrompt(); - mState=NOTACTIVE; - ShowStatePrompt(); - mState=NOTACTIVE; - return; - //return"Audio plugin has been disabled!!"; - } - case NOTACTIVE: - return; - //return"Audio plugin is not enabled."; - - } - -} - - -/**************************************************************** -play(char *filename,char* clipBegin,char* clipEnd) function -****************************************************************/ - -void AmisAudio::play(const char *filename,char* clipBegin,char* clipEnd){ - - - if (mbAudioPlaybackEnabled == false) - { - - return; - } - - mFileName.assign(filename); - int channel; - - //Format the beg and end from string to timeCode - SmilTimeCode startStop(clipBegin, clipBegin, clipEnd); - - unsigned long begin,end; - - ShowStatePrompt(); - - - - - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - break; - } - //case ACTIVE: - case PAUSE: - case PLAYING: - { - if (pDmpCtrl) { - - if (mbAudioPlaybackEnabled == false) - { - return; - } - //stop(); - if (!pDmpCtrl->fileName(filename)) { - - pDmpCtrl->destroyFilterGraph(); - return; - } - pDmpCtrl->insertVupp(); - - begin=startStop.getStart(); - end=startStop.getEnd(); - if (! (begin == 0 && end == 0)) { - - if (begin >= 0 && begin < pDmpCtrl->getDuration()) { - pDmpCtrl->setPosition(begin); - } - - if (end >= 0 && end > begin && end < pDmpCtrl->getDuration()) { - pDmpCtrl->setStopPosition(end); - } - } - - pDmpCtrl->setVolume((long)(100*mVolume)); - pDmpCtrl->play(); - mState = PLAYING; - return; - } - - //return "now playing\n" ; - } - } - -} // end method - - - -/**************************************************************** -stop() function -****************************************************************/ - -void AmisAudio::stop() -{ - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - } - - /*case ACTIVE: - { - return; - //return"No file is playing"; - }*/ - - case PLAYING : - { - mState = PAUSE; //ACTIVE - - - if (pDmpCtrl) { - pDmpCtrl->stop(); - //pDmpCtrl->pause(); - return; - } - - - return; - //return"The playing file has been stopped"; - } - - case PAUSE : - { - mState = PAUSE; //ACTIVE - - - - return; - //return"The playing file has been stopped"; - - } - } -} - - - - -/**************************************************************** -pause() function -****************************************************************/ - -void AmisAudio::pause(){ - - - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - - } - - /* case ACTIVE : - { - return; - //return "The plugin is already stopped."; - } */ - case PLAYING : - { - mState=PAUSE; - - if (pDmpCtrl) { - //pDmpCtrl->stop(); - pDmpCtrl->pause(); - return; - } - - return; - //return"The plugin is paused"; - } - - - - case PAUSE : - { - return; - //return "The plugin is already paused."; - } - - } -} - - -/**************************************************************** -resume() function -****************************************************************/ - -int AmisAudio::resume(){ - - - switch(mState) - { - - case NOTACTIVE: - { - return -1; - //return "Audio plugin is not enabled.\n"; - - } - - //case ACTIVE : - case PAUSE : - { - - - if (pDmpCtrl) { - - pDmpCtrl->play(); - mState=PLAYING; - return 0; - } - - //return"The plugin is resumed"; - - } - - case PLAYING : - { - return 0; - //return"The plugin is not in paused state"; - } - - - } - -} - -/**************************************************************** -getVolume() function -****************************************************************/ - -double AmisAudio::getVolume() -{ - - return mVolume; -} - - -/**************************************************************** -setVolume(char * value) function -****************************************************************/ -void AmisAudio::setVolume(double value) -{ - mVolume = value; - - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - - } - - //case ACTIVE : - case PAUSE : - case PLAYING : - { - - - if (pDmpCtrl) { - - pDmpCtrl->setVolume((long)(100*mVolume)); - - return ; - } - } - } -} - -//adjustment is positive or negative (louder or softer) -void AmisAudio::adjustVolume(double adjustment) -{ -mVolume *= adjustment; - - setVolume(mVolume); -} - - -void AmisAudio::adjustRate(double adjustment) -{ - if (pDmpCtrl) { - double value = mTau + adjustment; - setRate(value); - } -} - - -/**************************************************************** -getRate() function -****************************************************************/ - -double AmisAudio::getRate() -{ - return mTau; -} - -/**************************************************************** -setRate() function -****************************************************************/ - -void AmisAudio::setRate(double value){ - - - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - - } - - //case ACTIVE : - case PAUSE : - case PLAYING : - { - if (pDmpCtrl) { - - mTau=value; - - if (mTau > 1.0) { - double offset = mTau - 1.0; - /* int n = offset / 0.2; - offset *= 6; - offset = n * 0.5; */ - //mTau = 1 - offset; - } - if (mTau < 1.0) { - double offset = 1.0 - mTau; - - mTau = 0.5; - - /* int n = offset / 0.2; - offset *= 6; - offset = n * 0.5; */ - //mTau = 1 + offset; - } - //if (mTau > 3) mTau = 3; - //if (mTau < 1) mTau = 1; - - //mTau=value; - - pDmpCtrl->setRate(mTau); - return; - } - - - } - - - - } - - -} // end method - - - - -/**************************************************************** - isPlaying() function -****************************************************************/ - -bool AmisAudio::isPlaying() -{ - - if(mState==PLAYING) - { - return true; - } - else - { - return false; - } - - -} - -bool AmisAudio::isActive() -{ - - return (mState==PAUSE || mState==PLAYING); - -} - /**************************************************************** - ShowStatePropmt() function - ****************************************************************/ - - - void AmisAudio::ShowStatePrompt(){ - - switch(mState){ - - case NOTACTIVE: { - std::cout<<"Not Active"<<endl; - break; - } - - /* case ACTIVE: { - std::cout<<" Active"<<endl; - break; - } */ - - case PAUSE: { - std::cout<<" Pause"<<endl; - break; - } - - case PLAYING: { - std::cout<<" Playing"<<endl; - } - - - } - - } - - - void AmisAudio::enableAudioPlayback() - { - mbAudioPlaybackEnabled = true; - } - - void AmisAudio::disableAudioPlayback() - { - mbAudioPlaybackEnabled = false; - } - - bool AmisAudio::isAudioPlaybackEnabled() - { - return mbAudioPlaybackEnabled; - } - -}} \ No newline at end of file Deleted: branches/amis3/AmisAudio/AmisAudio.h =================================================================== --- branches/amis3/AmisAudio/AmisAudio.h 2008-02-26 05:25:21 UTC (rev 2342) +++ branches/amis3/AmisAudio/AmisAudio.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -1,148 +0,0 @@ -/* -AmisAudio - -Copyright (C) 2005 DAISY for All Project - -Licensing note: This file is released as LGPL; however, its module relies upon GPL code in third party libraries. Any reuse of this library in a closed source environment must contact the GPL license holders to negotiate terms for use with an altered license. GPL code referenced from this module includes, but may not be limited to, libfftw, WSOLA code by Matt Flax, and stlib. - -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. -*/ - -#ifdef AMISAUDIO_EXPORTS -#define AMISAUDIO_API __declspec(dllexport) -#else -#define AMISAUDIO_API __declspec(dllimport) -#endif - -///This gets rid of some warnings -#pragma warning(disable : 4786) - - -#include "TPBReader2\dmp\DmpCtl.h" -#include "TPBReader2\dmp\Dmp.h" - -//#include <windows.h> - -#include "./mffmTimeCode/smilTimeCode.H" - -//for message sending ... -typedef void (*sendMessageCallbackFn)(); - -//using namespace std; - -enum State{NOTACTIVE,PAUSE,PLAYING}; //ACTIVE - - -#ifdef _MSC_VER -#pragma warning(disable : 4251) -#endif - -/** This class is exported from the AmisAudio.dll*/ - -namespace amis -{ -namespace audio -{ -class AMISAUDIO_API AmisAudio -{ -protected: - ///Constructor which is used to ensure callbacks are executed once a stream is played - //AmisAudio(HWND parentWindow); - ///Constructor which executes no callback once a stream is played - AmisAudio(); - -public: - - static AmisAudio* Instance(); - - ///Deconstructor - ~AmisAudio (); - - - static void DestroyInstance(); - - - void setStatePause(); - - - //functions related to enabling/disabling audio - //these were added so that screen readers could ask AMIS to be quiet - void enableAudioPlayback(); - void disableAudioPlayback(); - bool isAudioPlaybackEnabled(); - -private: - - //private member functions - //Look in the cpp source for comments on what these functions do. - -public: - void enable(); - void disable(); - void play(const char *filename,char* clipBegin,char* clipEnd); - - - -public: - void stop(); - void pause(); - int resume(); - double getVolume(); - void setVolume (double); - double getRate(); - void setRate(double); - bool isPlaying(); - bool isActive(); - - void adjustVolume(double); - void adjustRate(double); - - typedef void (*sendMessageCallbackFn)(void); - void setCallback(sendMessageCallbackFn pFunction); - -private: - void ShowStatePrompt(); - - //member variables - std::string mFileName; //The file name being played - double mVolume; //The volume of the stream - - State mState; //The state of the player - double mTau; //This is the playback speed - - //is the audio playback enabled? - bool mbAudioPlaybackEnabled; - -private: - static AmisAudio* pinstance; - - - CDmpCtrl* pDmpCtrl; - //CDmpApp* pDmpApp; -}; - -} -} - -#endif \ No newline at end of file Modified: branches/amis3/AmisAudio/AmisAudio.vcproj =================================================================== --- branches/amis3/AmisAudio/AmisAudio.vcproj 2008-02-26 05:25:21 UTC (rev 2342) +++ branches/amis3/AmisAudio/AmisAudio.vcproj 2008-02-26 09:29:53 UTC (rev 2343) @@ -23,7 +23,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""../AmisGuiMFC2/include/";"../AmisCore/include/"" + AdditionalIncludeDirectories=""./include/";../AmisGuiMFC2/include/";"../AmisCore/include/"" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_WINDOWS;_USRDLL;AMISAUDIO_EXPORTS" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -142,185 +142,227 @@ </References> <Files> <Filter - Name="Source Files" - Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> + Name="include" + Filter=""> <File - RelativePath="AmisAudio.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="" - PreprocessorDefinitions="" - BasicRuntimeChecks="3" - UsePrecompiledHeader="0" - BrowseInformation="1"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - AdditionalIncludeDirectories="" - PreprocessorDefinitions="" - UsePrecompiledHeader="0"/> - </FileConfiguration> + RelativePath=".\include\AmisAudio.h"> </File> <File - RelativePath=".\TPBReader2\dmp\dmp.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> + RelativePath=".\include\StdAfx.h"> </File> - <File - RelativePath=".\TPBReader2\dmp\DmpCtl.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0" - PrecompiledHeaderThrough="StdAfxFIX.h"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> - <File - RelativePath=".\TPBReader2\dmp\DmpPpg.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0" - PrecompiledHeaderThrough="StdAfxFIX.h"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> - <File - RelativePath=".\TPBReader2\RegOcx.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> - <File - RelativePath="StdAfx.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="" - PreprocessorDefinitions="" - BasicRuntimeChecks="3" - UsePrecompiledHeader="1" - BrowseInformation="1"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - AdditionalIncludeDirectories="" - PreprocessorDefinitions="" - UsePrecompiledHeader="1"/> - </FileConfiguration> - </File> + <Filter + Name="TPBReader" + Filter=""> + <File + RelativePath=".\include\TPBReader\dmp.h"> + </File> + <File + RelativePath=".\include\TPBReader\DmpCtl.h"> + </File> + <File + RelativePath=".\include\TPBReader\DmpPpg.h"> + </File> + <File + RelativePath=".\include\TPBReader\intvec.h"> + </File> + <File + RelativePath=".\include\TPBReader\iTPBTS.h"> + </File> + <File + RelativePath=".\include\TPBReader\RegOcx.h"> + </File> + <File + RelativePath=".\include\TPBReader\Resource.h"> + </File> + <File + RelativePath=".\include\TPBReader\StdAfxFIX.h"> + </File> + <File + RelativePath=".\include\TPBReader\TransformSample.h"> + </File> + <File + RelativePath=".\include\TPBReader\Vupp1.h"> + </File> + <File + RelativePath=".\include\TPBReader\VuppInterface.h"> + </File> + <File + RelativePath=".\include\TPBReader\VuppSample.h"> + </File> + </Filter> + <Filter + Name="mffmTimeCode" + Filter=""> + <File + RelativePath=".\include\mffmTimeCode\counter.H"> + </File> + <File + RelativePath=".\include\mffmTimeCode\field.H"> + </File> + <File + RelativePath=".\include\mffmTimeCode\masterCounter.H"> + </File> + <File + RelativePath=".\include\mffmTimeCode\masterCounterArray.H"> + </File> + <File + RelativePath=".\include\mffmTimeCode\SmilTimeCode.H"> + </File> + <File + RelativePath=".\include\mffmTimeCode\timeCode.H"> + </File> + <File + RelativePath=".\include\mffmTimeCode\win32fix.H"> + </File> + </Filter> + <Filter + Name="directx" + Filter=""> + <File + RelativePath=".\include\directx\amextra.h"> + </File> + <File + RelativePath=".\include\directx\amfilter.h"> + </File> + <File + RelativePath=".\include\directx\cache.h"> + </File> + <File + RelativePath=".\include\directx\combase.h"> + </File> + <File + RelativePath=".\include\directx\cprop.h"> + </File> + <File + RelativePath=".\include\directx\ctlutil.h"> + </File> + <File + RelativePath=".\include\directx\ddmm.h"> + </File> + <File + RelativePath=".\include\directx\dllsetup.h"> + </File> + <File + RelativePath=".\include\directx\dsschedule.h"> + </File> + <File + RelativePath=".\include\directx\fourcc.h"> + </File> + <File + RelativePath=".\include\directx\measure.h"> + </File> + <File + RelativePath=".\include\directx\msgthrd.h"> + </File> + <File + RelativePath=".\include\directx\mtype.h"> + </File> + <File + RelativePath=".\include\directx\outputq.h"> + </File> + <File + RelativePath=".\include\directx\pstream.h"> + </File> + <File + RelativePath=".\include\directx\pullpin.h"> + </File> + <File + RelativePath=".\include\directx\refclock.h"> + </File> + <File + RelativePath=".\include\directx\reftime.h"> + </File> + <File + RelativePath=".\include\directx\renbase.h"> + </File> + <File + RelativePath=".\include\directx\schedule.h"> + </File> + <File + RelativePath=".\include\directx\seekpt.h"> + </File> + <File + RelativePath=".\include\directx\source.h"> + </File> + <File + RelativePath=".\include\directx\streams.h"> + </File> + <File + RelativePath=".\include\directx\strmctl.h"> + </File> + <File + RelativePath=".\include\directx\sysclock.h"> + </File> + <File + RelativePath=".\include\directx\transfrm.h"> + </File> + <File + RelativePath=".\include\directx\transip.h"> + </File> + <File + RelativePath=".\include\directx\videoctl.h"> + </File> + <File + RelativePath=".\include\directx\vtrans.h"> + </File> + <File + RelativePath=".\include\directx\winctrl.h"> + </File> + <File + RelativePath=".\include\directx\winutil.h"> + </File> + <File + RelativePath=".\include\directx\wxdebug.h"> + </File> + <File + RelativePath=".\include\directx\wxlist.h"> + </File> + <File + RelativePath=".\include\directx\wxutil.h"> + </File> + </Filter> </Filter> <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl"> + Name="src" + Filter=""> <File - RelativePath="AmisAudio.h"> + RelativePath=".\src\AmisAudio.cpp"> </File> <File - RelativePath=".\mffmTimeCode\counter.H"> + RelativePath=".\src\StdAfx.cpp"> </File> - <File - RelativePath=".\TPBReader2\dmp\dmp.h"> - </File> - <File - RelativePath=".\TPBReader2\dmp\DmpCtl.h"> - </File> - <File - RelativePath=".\TPBReader2\dmp\DmpPpg.h"> - </File> - <File - RelativePath=".\mffmTimeCode\field.H"> - </File> - <File - RelativePath=".\TPBReader2\dmp\iTPBTS.h"> - </File> - <File - RelativePath=".\mffmTimeCode\masterCounter.H"> - </File> - <File - RelativePath=".\mffmTimeCode\masterCounterArray.H"> - </File> - <File - RelativePath=".\TPBReader2\RegOcx.h"> - </File> - <File - RelativePath=".\TPBReader2\dmp\Resource.h"> - </File> - <File - RelativePath=".\mffmTimeCode\SmilTimeCode.H"> - </File> - <File - RelativePath="StdAfx.h"> - </File> - <File - RelativePath=".\TPBReader2\dmp\StdAfxFIX.h"> - </File> - <File - RelativePath=".\mffmTimeCode\timeCode.H"> - </File> - <File - RelativePath=".\TPBReader2\dmp\TransformSample.h"> - </File> - <File - RelativePath=".\TPBReader2\dmp\Vupp1.h"> - </File> - <File - RelativePath=".\TPBReader2\dmp\VuppInterface.h"> - </File> - <File - RelativePath=".\TPBReader2\dmp\VuppSample.h"> - </File> - <File - RelativePath=".\mffmTimeCode\win32fix.H"> - </File> + <Filter + Name="TPBReader" + Filter=""> + <File + RelativePath=".\src\TPBReader\dmp.cpp"> + </File> + <File + RelativePath=".\src\TPBReader\DmpCtl.cpp"> + </File> + <File + RelativePath=".\src\TPBReader\DmpPpg.cpp"> + </File> + <File + RelativePath=".\src\TPBReader\RegOcx.cpp"> + </File> + <File + RelativePath=".\src\TPBReader\StdAfx.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + </File> + </Filter> </Filter> - <Filter - Name="Resource Files" - Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> - </Filter> <File RelativePath="ReadMe.txt"> </File> Deleted: branches/amis3/AmisAudio/StdAfx.cpp =================================================================== --- branches/amis3/AmisAudio/StdAfx.cpp 2008-02-26 05:25:21 UTC (rev 2342) +++ branches/amis3/AmisAudio/StdAfx.cpp 2008-02-26 09:29:53 UTC (rev 2343) @@ -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 Deleted: branches/amis3/AmisAudio/StdAfx.h =================================================================== --- branches/amis3/AmisAudio/StdAfx.h 2008-02-26 05:25:21 UTC (rev 2342) +++ branches/amis3/AmisAudio/StdAfx.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -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_) Added: branches/amis3/AmisAudio/include/AmisAudio.h =================================================================== --- branches/amis3/AmisAudio/include/AmisAudio.h (rev 0) +++ branches/amis3/AmisAudio/include/AmisAudio.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -0,0 +1,148 @@ +/* +AmisAudio + +Copyright (C) 2005 DAISY for All Project + +Licensing note: This file is released as LGPL; however, its module relies upon GPL code in third party libraries. Any reuse of this library in a closed source environment must contact the GPL license holders to negotiate terms for use with an altered license. GPL code referenced from this module includes, but may not be limited to, libfftw, WSOLA code by Matt Flax, and stlib. + +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. +*/ + +#ifdef AMISAUDIO_EXPORTS +#define AMISAUDIO_API __declspec(dllexport) +#else +#define AMISAUDIO_API __declspec(dllimport) +#endif + +///This gets rid of some warnings +#pragma warning(disable : 4786) + + +#include "TPBReader/DmpCtl.h" +#include "TPBReader/Dmp.h" + +//#include <windows.h> + +#include "mffmTimeCode/smilTimeCode.H" + +//for message sending ... +typedef void (*sendMessageCallbackFn)(); + +//using namespace std; + +enum State{NOTACTIVE,PAUSE,PLAYING}; //ACTIVE + + +#ifdef _MSC_VER +#pragma warning(disable : 4251) +#endif + +/** This class is exported from the AmisAudio.dll*/ + +namespace amis +{ +namespace audio +{ +class AMISAUDIO_API AmisAudio +{ +protected: + ///Constructor which is used to ensure callbacks are executed once a stream is played + //AmisAudio(HWND parentWindow); + ///Constructor which executes no callback once a stream is played + AmisAudio(); + +public: + + static AmisAudio* Instance(); + + ///Deconstructor + ~AmisAudio (); + + + static void DestroyInstance(); + + + void setStatePause(); + + + //functions related to enabling/disabling audio + //these were added so that screen readers could ask AMIS to be quiet + void enableAudioPlayback(); + void disableAudioPlayback(); + bool isAudioPlaybackEnabled(); + +private: + + //private member functions + //Look in the cpp source for comments on what these functions do. + +public: + void enable(); + void disable(); + void play(const char *filename,char* clipBegin,char* clipEnd); + + + +public: + void stop(); + void pause(); + int resume(); + double getVolume(); + void setVolume (double); + double getRate(); + void setRate(double); + bool isPlaying(); + bool isActive(); + + void adjustVolume(double); + void adjustRate(double); + + typedef void (*sendMessageCallbackFn)(void); + void setCallback(sendMessageCallbackFn pFunction); + +private: + void ShowStatePrompt(); + + //member variables + std::string mFileName; //The file name being played + double mVolume; //The volume of the stream + + State mState; //The state of the player + double mTau; //This is the playback speed + + //is the audio playback enabled? + bool mbAudioPlaybackEnabled; + +private: + static AmisAudio* pinstance; + + + CDmpCtrl* pDmpCtrl; + //CDmpApp* pDmpApp; +}; + +} +} + +#endif \ No newline at end of file Added: branches/amis3/AmisAudio/include/StdAfx.h =================================================================== --- branches/amis3/AmisAudio/include/StdAfx.h (rev 0) +++ branches/amis3/AmisAudio/include/StdAfx.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -0,0 +1,113 @@ +// 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_) Added: branches/amis3/AmisAudio/include/TPBReader/DmpCtl.h =================================================================== --- branches/amis3/AmisAudio/include/TPBReader/DmpCtl.h (rev 0) +++ branches/amis3/AmisAudio/include/TPBReader/DmpCtl.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -0,0 +1,302 @@ +#if !defined(AFX_DMPCTL_H__62F1A308_A87A_472C_970B_65BC44BDA998__INCLUDED_) +#define AFX_DMPCTL_H__62F1A308_A87A_472C_970B_65BC44BDA998__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// LIBs to link against can be added here instead of the project/module settings. +//#zpragma comment(lib,"Strmiids.lib") + +//ke20030625 +#include "malloc.h" +#include <exception> +//#include <windows.h> +#include "afxpriv.h" + + + +#include "dmp.h" + + + +#include "TransformSample.h" + + +//#include "TransformSample.h"; + +//#include "..\Vupp\vuppinterface.h" +//#include "vuppinterface.h" + +//#include "..\directx\streams.h" +#include <dshow.h> +#include "itpbts.h" + +#include <afxctl.h> + +#if !defined( __AFXCTL_H__ ) + #error include 'afxctl.h' before including this file +#endif + + + + +BOOL isSameCLSID(CLSID *compare1, const struct _GUID *compare2); + +// DmpCtl.h : Declaration of the CDmpCtrl ActiveX Control class. + +///////////////////////////////////////////////////////////////////////////// +// CDmpCtrl : See DmpCtl.cpp for implementation. + +class CDmpCtrl//NO_ACTIVEX : public COleControl +{ + //NO_ACTIVEX DECLARE_DYNCREATE(CDmpCtrl) + +// Constructor +public: + CDmpCtrl(); + + typedef void (*sendMessageCallbackFn)(void); + sendMessageCallbackFn sendMessageCallback; + void setCallback(sendMessageCallbackFn pFunction); + +// Overrides + // ClassWizard generated virtual function overrides + //{{zAFX_VIRTUAL(CDmpCtrl) + public: + //}}zAFX_VIRTUAL + + bool bCatchEvents; + void handleEvent(long lEventCode); + IGraphBuilder *pIGB; + + BOOL bProcessEvents; +// Implementation +public: + + double mRate; + + IVuppInterface *pIVuppInterface; +// ITPBTS *pITPBTs; + HANDLE hEventHandler; + HANDLE hThread; + + long currentPosition; + long stopPosition; + long startPosition; + + BOOL bInitialized; + BOOL bFileLoaded; + //BOOL bEndOfStream; + BOOL bUseVupp; + + BOOL setSync(); + BOOL insertSource(WCHAR *wFileName); + BOOL getInterfaceFromFilter(CLSID interfaceCLSID, IID interfaceIID, + void **interfacePointer); + BOOL FindAudioFilter(CLSID *pAudioFilterID); + BOOL insertAfter(CLSID pBefore, CLSID pInsert); + BOOL createFilterGraph(); + BOOL destroyFilterGraph(); + + int thisInstanceNumber; + + //BOOL GetEndOfStream(); + //void SetEndOfStream(BOOL bNewValue); + BOOL fileName(LPCSTR iszFileName); + BOOL play(); + BOOL stop(); + long getPosition(); + BOOL setPosition(long ilPosition); + BOOL setRate(double idRate); + double getRate(); + long getDuration(); + BOOL setStopPosition(long istopPosition); + BOOL insertVupp(); + long getState(); + BOOL pause(); + BOOL setVuppProperties(double idCrossFadeSpeed, short isWindowLength, short isCycleSpeed, short isThreshold, short isRemainder, short isSilence); + BOOL setVolume(long ilVolume); + long getVolume(); + //void stopDmpThread(); + + static DWORD WINAPI eventHandler(LPVOID lpParam) { + long lEventCode, lParam1, lParam2; + HRESULT hResult = E_FAIL; + bool bSelfBreak = false; + + //CoInitialize(NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + //CoInitializeEx(NULL, COINIT_MULTITHREADED); + + CDmpCtrl *pDMP = (CDmpCtrl*)lpParam; + IMediaEvent *pIME; + if (pDMP->pIGB->QueryInterface(IID_IMediaEvent, (void**) &pIME)) { + + CoUninitialize(); + pDMP = NULL; + return 0; + }; + + while((pDMP->bCatchEvents) && (!bSelfBreak)) { + + hResult = E_FAIL; + //__try { + hResult = pIME->GetEvent(&lEventCode, &lParam1, &lParam2, INFINITE); + pIME->FreeEventParams(lEventCode, lParam1, lParam2); + if ((hResult == S_OK) && (pDMP->bProcessEvents)) { + switch(lEventCode) { +/* case EC_USER + 1: + pDMP->handleEvent(lEventCode); + break;*/ + case EC_COMPLETE: + pDMP->handleEvent(lEventCode); + break; + case EC_USER + 4: + bSelfBreak = true; + break; + } + } + /*} __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) { + lEventCode = 2; + //MessageBox(NULL, "Access violation!", MB_OK); + }*/ + } + pIME->Release(); + + CoUninitialize(); + pDMP = NULL; + return 0; + } + + long logSession(const char *string) { +/* FILE *file = fopen("d:\\dmp.log", "a"); + if (file == NULL) return 0; + + char *buffer = (char*) malloc(sizeof(char) * 300); + sprintf(buffer, "instance %d, position %8g: %s\n", thisInstanceNumber, + ((double) getPosition() / 1000), string); + + //if (fprintf(file, string) < 0) return 0; + if (fprintf(file, buffer) < 0) return 0; + free (buffer); + + if (!fclose(file)) return 0; +*/ + return 1; + } + + long logSession(long number) { +/* FILE *file = fopen("d:\\dmp.log", "a"); + if (file == NULL) return 0; + + char *buffer = (char*) malloc(sizeof(char) * 300); + sprintf(buffer, "instance %d, position %8g: %d\n", thisInstanceNumber, + ((double) getPosition() / 1000), number); + + //if (fprintf(file, string) < 0) return 0; + if (fprintf(file, buffer) < 0) return 0; + free (buffer); + + //if (fprintf(file, "%d", number) < 0) return 0; + + if (!fclose(file)) return 0; +*/ + return 1; + } + + ~CDmpCtrl(); + + //NO_ACTIVEX + /* + DECLARE_OLECREATE_EX(CDmpCtrl) // Class factory and guid + DECLARE_OLETYPELIB(CDmpCtrl) // GetTypeInfo + DECLARE_PROPPAGEIDS(CDmpCtrl) // Property page IDs + DECLARE_OLECTLTYPE(CDmpCtrl) // Type name and misc status + */ + +// Message maps + //{{zAFX_MSG(CDmpCtrl) + //}}zAFX_MSG + //NO_ACTIVEX DECLARE_MESSAGE_MAP() + +// Dispatch maps + //{{AFX_DISPATCH(CDmpCtrl) + //NO_ACTIVEX + /* + afx_msg BOOL GetEndOfStream(); + afx_msg void SetEndOfStream(BOOL bNewValue); + afx_msg BOOL fileName(LPCSTR iszFileName); + afx_msg BOOL play(); + afx_msg BOOL stop(); + afx_msg long getPosition(); + afx_msg BOOL setPosition(long ilPosition); + afx_msg BOOL setRate(double idRate); + afx_msg double getRate(); + afx_msg long getDuration(); + afx_msg BOOL setStopPosition(long istopPosition); + afx_msg BOOL insertVupp(); + afx_msg long getState(); + afx_msg BOOL pause(); + afx_msg BOOL setVuppProperties(double idCrossFadeSpeed, short isWindowLength, short isCycleSpeed, short isThreshold, short isRemainder, short isSilence); + afx_msg BOOL setVolume(long ilVolume); + afx_msg long getVolume(); + afx_msg void stopDmpThread(); + */ + //}}AFX_DISPATCH + //NO_ACTIVEX DECLARE_DISPATCH_MAP() + +// Event maps + //{{AFX_EVENT(CDmpCtrl) + //NO_ACTIVEX + /* + void FireNewTime(long ilTime) + {FireEvent(eventidNewTime,EVENT_PARAM(VTS_I4), ilTime);} + void FireEndOfStream() + {FireEvent(eventidEndOfStream,EVENT_PARAM(VTS_NONE));} + void FireError(long errorNumber) + {FireEvent(DISPID_ERROREVENT,EVENT_PARAM(VTS_I4), errorNumber);} + */ + //}}AFX_EVENT + //NO_ACTIVEX DECLARE_EVENT_MAP() + +// Dispatch and event IDs +public: + //NO_ACTIVEX + /* + enum { + //{{AFX_DISP_ID(CDmpCtrl) + dispidEndOfStream = 1L, + dispidFileName = 2L, + dispidPlay = 3L, + dispidStop = 4L, + dispidGetPosition = 5L, + dispidSetPosition = 6L, + dispidSetRate = 7L, + dispidGetRate = 8L, + dispidGetDuration = 9L, + dispidSetStopPosition = 10L, + dispidInsertVupp = 11L, + dispidGetState = 12L, + dispidPause = 13L, + dispidSetVuppProperties = 14L, + dispidSetVolume = 15L, + dispidGetVolume = 16L, + dispidStopDmpThread = 17L, + eventidEndOfStream = 2L, + eventidNewTime = 1L, + //}}AFX_DISP_ID + }; + */ +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +/* +extern const GUID CDECL _tlid; +extern const WORD _wVerMajor; +extern const WORD _wVerMinor; +*/ + +#endif // !defined(AFX_DMPCTL_H__62F1A308_A87A_472C_970B_65BC44BDA998__INCLUDED) Added: branches/amis3/AmisAudio/include/TPBReader/DmpPpg.h =================================================================== --- branches/amis3/AmisAudio/include/TPBReader/DmpPpg.h (rev 0) +++ branches/amis3/AmisAudio/include/TPBReader/DmpPpg.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -0,0 +1,71 @@ +#if !defined(AFX_DMPPPG_H__8EEF5A55_005D_4D39_A1B9_6539C5CAF85C__INCLUDED_) +#define AFX_DMPPPG_H__8EEF5A55_005D_4D39_A1B9_6539C5CAF85C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" // main symbols + + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include <afxctl.h> + +#if !defined( __AFXCTL_H__ ) + #error include 'afxctl.h' before including this file +#endif + +//#include <afxext.h> // MFC extensions +//#include <afxdtctl.h> // MFC support for Internet Explorer 4 Comon Controls +//#ifndef _AFX_NO_AFXCMN_SUPPORT +//#include <afxcmn.h> // MFC support for Windows Common Controls +//#endif // _AFX_NO_AFXCMN_SUPPORT + +// Delete the two includes below if you do not wish to use the MFC +// database classes +//#include <afxdb.h> // MFC database classes +//#include <afxdao.h> // MFC DAO database classes + + +// DmpPpg.h : Declaration of the CDmpPropPage property page class. + +//////////////////////////////////////////////////////////////////////////// +// CDmpPropPage : See DmpPpg.cpp.cpp for implementation. + +class CDmpPropPage : public COlePropertyPage +{ + DECLARE_DYNCREATE(CDmpPropPage) + DECLARE_OLECREATE_EX(CDmpPropPage) + +// Constructor +public: + CDmpPropPage(); + +// Dialog Data + //{{AFX_DATA(CDmpPropPage) + enum { IDD = IDD_PROPPAGE_DMP }; + // NOTE - ClassWizard will add data members here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_DATA + +// Implementation +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Message maps +protected: + //{{AFX_MSG(CDmpPropPage) + // NOTE - ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DMPPPG_H__8EEF5A55_005D_4D39_A1B9_6539C5CAF85C__INCLUDED) Added: branches/amis3/AmisAudio/include/TPBReader/RegOcx.h =================================================================== --- branches/amis3/AmisAudio/include/TPBReader/RegOcx.h (rev 0) +++ branches/amis3/AmisAudio/include/TPBReader/RegOcx.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -0,0 +1,18 @@ +// RegOcx.cpp : Defines the entry point for the DLL application. +// + +/* +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + //LoadLibrary( + return TRUE; +} +*/ + +BOOL RunDllReg(LPTSTR lpFileName); +BOOL RunDllUnreg(LPTSTR lpFileName); +BOOL RegisterOCX(); +BOOL UnregisterOCX(); \ No newline at end of file Added: branches/amis3/AmisAudio/include/TPBReader/Resource.h =================================================================== --- branches/amis3/AmisAudio/include/TPBReader/Resource.h (rev 0) +++ branches/amis3/AmisAudio/include/TPBReader/Resource.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -0,0 +1,20 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by dmp.rc +// + +#define IDS_DMP 1 +#define IDS_DMP_PPG 2 + +#define IDS_DMP_PPG_CAPTION 200 + +#define IDD_PROPPAGE_DMP 200 + + +#define IDB_DMP 1 + + +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 32768 Added: branches/amis3/AmisAudio/include/TPBReader/StdAfxFIX.h =================================================================== --- branches/amis3/AmisAudio/include/TPBReader/StdAfxFIX.h (rev 0) +++ branches/amis3/AmisAudio/include/TPBReader/StdAfxFIX.h 2008-02-26 09:29:53 UTC (rev 2343) @@ -0,0 +1,123 @@ +#if !defined(AFX_STDAFX_H__5E3570A3_4D82_4FC2_9FB5_2302F1E04AB6__INCLUDED_) +#define AFX_STDAFX_H__5E3570A3_4D82_4FC2_9FB5_2302F1E04AB6__INCLUDED_ + +//#if _MSC_VER > 1000 +//#pragma once +//#endif // _MSC_VER > 1000 + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +// Insert your headers here + +//#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +//#include <windows.h> + + +//#include <afxctl.h> // MFC support for ActiveX Controls +//#include <afxext.h> // MFC extensions +//#include <afxdtctl.h> // MFC support for Internet Explorer 4 Comon Controls +//#ifndef _AFX_NO_AFXCMN_SUPPORT +//#include <afxcmn.h> // MFC support for Windows Common Controls +//#endif // _AFX_NO_AFXCMN_SUPPORT + +// Delete the two includes below if you do not wish to use the MFC +// database classes +//#include <afxdb.h> // MFC database classes +//#include <afxdao.h> // MFC DAO database classes + +//#error DANOUL + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + + +///////////////////////////////////////////////////////////////////////////// +// 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 + +#if... [truncated message content] |
From: <dan...@us...> - 2008-02-26 22:44:10
|
Revision: 2345 http://amis.svn.sourceforge.net/amis/?rev=2345&view=rev Author: daniel_weck Date: 2008-02-26 14:44:16 -0800 (Tue, 26 Feb 2008) Log Message: ----------- - Changed audio backend. Now compiles in Release and Debug mode. Problem when loading books in Release mode (graceful, but no book playback at all). Volume and Speed are ultra-buggy. Modified Paths: -------------- branches/amis3/AmisAudio/AmisAudio.vcproj branches/amis3/AmisAudio/include/AmisAudio.h branches/amis3/AmisAudio/src/AmisAudio.cpp branches/amis3/AmisCore/AmisCore.vcproj 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/VC7/amis.sln Added Paths: ----------- branches/amis3/AmisAudio/include/directshow/ branches/amis3/AmisAudio/include/directshow/dx_audio_player.h branches/amis3/AmisAudio/src/directshow/ branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp Removed Paths: ------------- branches/amis3/AmisAudio/include/TPBReader/ branches/amis3/AmisAudio/include/directx/ branches/amis3/AmisAudio/src/TPBReader/ Modified: branches/amis3/AmisAudio/AmisAudio.vcproj =================================================================== --- branches/amis3/AmisAudio/AmisAudio.vcproj 2008-02-26 17:27:09 UTC (rev 2344) +++ branches/amis3/AmisAudio/AmisAudio.vcproj 2008-02-26 22:44:16 UTC (rev 2345) @@ -17,7 +17,7 @@ OutputDirectory="../bin" IntermediateDirectory="./Debug" ConfigurationType="2" - UseOfMFC="0" + UseOfMFC="2" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="1"> <Tool @@ -26,7 +26,7 @@ AdditionalIncludeDirectories=""./include/";../AmisGuiMFC2/include/";"../AmisCore/include/"" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_WINDOWS;_USRDLL;AMISAUDIO_EXPORTS" BasicRuntimeChecks="3" - RuntimeLibrary="1" + RuntimeLibrary="3" UsePrecompiledHeader="0" PrecompiledHeaderThrough="StdAfx.h" PrecompiledHeaderFile="./Debug/AmisAudio.pch" @@ -40,13 +40,13 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/FORCE:MULTIPLE" - AdditionalDependencies="Strmiids.lib TransformSample.lib stlib.lib kernel32.lib gdi32.lib user32.lib AmisCoreD.lib" + AdditionalDependencies="libambulant_shwin32_D.lib stlib.lib kernel32.lib gdi32.lib user32.lib" ShowProgress="2" - OutputFile="../bin/AmisAudioD.dll" + OutputFile="$(OutDir)/$(ProjectName)D.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="../lib" - IgnoreDefaultLibraryNames="libc.lib" + IgnoreDefaultLibraryNames="" GenerateDebugInformation="TRUE" ProgramDatabaseFile="./Debug/AmisAudioD.pdb" ImportLibrary="../lib/AmisAudioD.lib" @@ -82,20 +82,20 @@ </Configuration> <Configuration Name="Release|Win32" - OutputDirectory="../lib" + OutputDirectory="../bin" IntermediateDirectory="Release" - ConfigurationType="4" - UseOfMFC="0" + ConfigurationType="2" + UseOfMFC="2" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="1"> <Tool Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" - AdditionalIncludeDirectories=""../AmisGuiMFC2/include/";"../AmisCore/include/"" + AdditionalIncludeDirectories=""./include/";"../AmisGuiMFC2/include/";"../AmisCore/include/"" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;AMISAUDIO_EXPORTS" StringPooling="TRUE" - RuntimeLibrary="0" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" @@ -109,7 +109,13 @@ <Tool Name="VCCustomBuildTool"/> <Tool - Name="VCLibrarianTool"/> + Name="VCLinkerTool" + AdditionalOptions="/FORCE:MULTIPLE" + AdditionalDependencies="libambulant_shwin32.lib stlib.lib kernel32.lib gdi32.lib user32.lib" + AdditionalLibraryDirectories="../lib" + IgnoreDefaultLibraryNames="" + ImportLibrary="../lib/AmisAudio.lib" + TargetMachine="1"/> <Tool Name="VCMIDLTool" PreprocessorDefinitions="NDEBUG" @@ -133,6 +139,8 @@ <Tool Name="VCXMLDataGeneratorTool"/> <Tool + Name="VCWebDeploymentTool"/> + <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> @@ -151,44 +159,11 @@ RelativePath=".\include\StdAfx.h"> </File> <Filter - Name="TPBReader" + Name="directshow" Filter=""> <File - RelativePath=".\include\TPBReader\dmp.h"> + RelativePath=".\include\directshow\dx_audio_player.h"> </File> - <File - RelativePath=".\include\TPBReader\DmpCtl.h"> - </File> - <File - RelativePath=".\include\TPBReader\DmpPpg.h"> - </File> - <File - RelativePath=".\include\TPBReader\intvec.h"> - </File> - <File - RelativePath=".\include\TPBReader\iTPBTS.h"> - </File> - <File - RelativePath=".\include\TPBReader\RegOcx.h"> - </File> - <File - RelativePath=".\include\TPBReader\Resource.h"> - </File> - <File - RelativePath=".\include\TPBReader\StdAfxFIX.h"> - </File> - <File - RelativePath=".\include\TPBReader\TransformSample.h"> - </File> - <File - RelativePath=".\include\TPBReader\Vupp1.h"> - </File> - <File - RelativePath=".\include\TPBReader\VuppInterface.h"> - </File> - <File - RelativePath=".\include\TPBReader\VuppSample.h"> - </File> </Filter> <Filter Name="mffmTimeCode" @@ -215,112 +190,6 @@ RelativePath=".\include\mffmTimeCode\win32fix.H"> </File> </Filter> - <Filter - Name="directx" - Filter=""> - <File - RelativePath=".\include\directx\amextra.h"> - </File> - <File - RelativePath=".\include\directx\amfilter.h"> - </File> - <File - RelativePath=".\include\directx\cache.h"> - </File> - <File - RelativePath=".\include\directx\combase.h"> - </File> - <File - RelativePath=".\include\directx\cprop.h"> - </File> - <File - RelativePath=".\include\directx\ctlutil.h"> - </File> - <File - RelativePath=".\include\directx\ddmm.h"> - </File> - <File - RelativePath=".\include\directx\dllsetup.h"> - </File> - <File - RelativePath=".\include\directx\dsschedule.h"> - </File> - <File - RelativePath=".\include\directx\fourcc.h"> - </File> - <File - RelativePath=".\include\directx\measure.h"> - </File> - <File - RelativePath=".\include\directx\msgthrd.h"> - </File> - <File - RelativePath=".\include\directx\mtype.h"> - </File> - <File - RelativePath=".\include\directx\outputq.h"> - </File> - <File - RelativePath=".\include\directx\pstream.h"> - </File> - <File - RelativePath=".\include\directx\pullpin.h"> - </File> - <File - RelativePath=".\include\directx\refclock.h"> - </File> - <File - RelativePath=".\include\directx\reftime.h"> - </File> - <File - RelativePath=".\include\directx\renbase.h"> - </File> - <File - RelativePath=".\include\directx\schedule.h"> - </File> - <File - RelativePath=".\include\directx\seekpt.h"> - </File> - <File - RelativePath=".\include\directx\source.h"> - </File> - <File - RelativePath=".\include\directx\streams.h"> - </File> - <File - RelativePath=".\include\directx\strmctl.h"> - </File> - <File - RelativePath=".\include\directx\sysclock.h"> - </File> - <File - RelativePath=".\include\directx\transfrm.h"> - </File> - <File - RelativePath=".\include\directx\transip.h"> - </File> - <File - RelativePath=".\include\directx\videoctl.h"> - </File> - <File - RelativePath=".\include\directx\vtrans.h"> - </File> - <File - RelativePath=".\include\directx\winctrl.h"> - </File> - <File - RelativePath=".\include\directx\winutil.h"> - </File> - <File - RelativePath=".\include\directx\wxdebug.h"> - </File> - <File - RelativePath=".\include\directx\wxlist.h"> - </File> - <File - RelativePath=".\include\directx\wxutil.h"> - </File> - </Filter> </Filter> <Filter Name="src" @@ -332,35 +201,11 @@ RelativePath=".\src\StdAfx.cpp"> </File> <Filter - Name="TPBReader" + Name="directshow" Filter=""> <File - RelativePath=".\src\TPBReader\dmp.cpp"> + RelativePath=".\src\directshow\dx_audio_player.cpp"> </File> - <File - RelativePath=".\src\TPBReader\DmpCtl.cpp"> - </File> - <File - RelativePath=".\src\TPBReader\DmpPpg.cpp"> - </File> - <File - RelativePath=".\src\TPBReader\RegOcx.cpp"> - </File> - <File - RelativePath=".\src\TPBReader\StdAfx.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> </Filter> </Filter> <File Modified: branches/amis3/AmisAudio/include/AmisAudio.h =================================================================== --- branches/amis3/AmisAudio/include/AmisAudio.h 2008-02-26 17:27:09 UTC (rev 2344) +++ branches/amis3/AmisAudio/include/AmisAudio.h 2008-02-26 22:44:16 UTC (rev 2345) @@ -1,10 +1,10 @@ /* -AmisAudio +AMIS: Adaptive Multimedia Information System +Software for playing DAISY books +Homepage: http://amis.sf.net -Copyright (C) 2005 DAISY for All Project +Copyright (C) 2004-2007 DAISY for All Project -Licensing note: This file is released as LGPL; however, its module relies upon GPL code in third party libraries. Any reuse of this library in a closed source environment must contact the GPL license holders to negotiate terms for use with an altered license. GPL code referenced from this module includes, but may not be limited to, libfftw, WSOLA code by Matt Flax, and stlib. - 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 @@ -19,6 +19,7 @@ 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 @@ -29,120 +30,64 @@ // defined with this macro as being exported. */ +//#undef AMISAUDIO_EXPORTS + #ifdef AMISAUDIO_EXPORTS #define AMISAUDIO_API __declspec(dllexport) #else -#define AMISAUDIO_API __declspec(dllimport) +#define AMISAUDIO_API #endif -///This gets rid of some warnings -#pragma warning(disable : 4786) - - -#include "TPBReader/DmpCtl.h" -#include "TPBReader/Dmp.h" - -//#include <windows.h> - +#include "directshow/dx_audio_player.h" #include "mffmTimeCode/smilTimeCode.H" -//for message sending ... -typedef void (*sendMessageCallbackFn)(); -//using namespace std; - -enum State{NOTACTIVE,PAUSE,PLAYING}; //ACTIVE - - #ifdef _MSC_VER #pragma warning(disable : 4251) #endif -/** This class is exported from the AmisAudio.dll*/ +#pragma warning(disable : 4786) +typedef void (*sendMessageCallbackFn)(void); + namespace amis { -namespace audio -{ -class AMISAUDIO_API AmisAudio -{ -protected: - ///Constructor which is used to ensure callbacks are executed once a stream is played - //AmisAudio(HWND parentWindow); - ///Constructor which executes no callback once a stream is played - AmisAudio(); + namespace audio + { + class AMISAUDIO_API AmisAudio + { + protected: + AmisAudio(); -public: - - static AmisAudio* Instance(); - - ///Deconstructor - ~AmisAudio (); + public: + static AmisAudio* Instance(); + ~AmisAudio (); + static void DestroyInstance(); + void play(const char * url,char* clipBegin,char* clipEnd); + void pause(); + void resume(); + void stopX(); - static void DestroyInstance(); - - - void setStatePause(); + bool isPlaying(); + double getVolume(); + void setVolume (double); - //functions related to enabling/disabling audio - //these were added so that screen readers could ask AMIS to be quiet - void enableAudioPlayback(); - void disableAudioPlayback(); - bool isAudioPlaybackEnabled(); - -private: + void adjustVolume(double); + void adjustRate(double); - //private member functions - //Look in the cpp source for comments on what these functions do. + double getRate(); + void setRate(double); -public: - void enable(); - void disable(); - void play(const char *filename,char* clipBegin,char* clipEnd); + sendMessageCallbackFn sendMessageCallback; + void setCallback(sendMessageCallbackFn pFunction); - - -public: - void stop(); - void pause(); - int resume(); - double getVolume(); - void setVolume (double); - double getRate(); - void setRate(double); - bool isPlaying(); - bool isActive(); - - void adjustVolume(double); - void adjustRate(double); - - typedef void (*sendMessageCallbackFn)(void); - void setCallback(sendMessageCallbackFn pFunction); - -private: - void ShowStatePrompt(); - - //member variables - std::string mFileName; //The file name being played - double mVolume; //The volume of the stream - - State mState; //The state of the player - double mTau; //This is the playback speed - - //is the audio playback enabled? - bool mbAudioPlaybackEnabled; - -private: - static AmisAudio* pinstance; - - - CDmpCtrl* pDmpCtrl; - //CDmpApp* pDmpApp; -}; - + private: + static AmisAudio* pinstance; + ambulantX::gui::dx::audio_playerX *m_player; + }; + } } -} #endif \ No newline at end of file Added: branches/amis3/AmisAudio/include/directshow/dx_audio_player.h =================================================================== --- branches/amis3/AmisAudio/include/directshow/dx_audio_player.h (rev 0) +++ branches/amis3/AmisAudio/include/directshow/dx_audio_player.h 2008-02-26 22:44:16 UTC (rev 2345) @@ -0,0 +1,202 @@ +/* + * This file is part of Ambulant Player, www.ambulantplayer.org. + * + * Copyright (C) 2003-2008 Stichting CWI, + * Kruislaan 413, 1098 SJ Amsterdam, The Netherlands. + * + * Ambulant Player 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. + * + * Ambulant Player 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 Ambulant Player; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * @$Id: dx_audio_player.h,v 1.21 2008/01/15 10:54:48 jackjansen Exp $ + */ + +#ifndef AMBULANT_GUI_DX_AUDIO_PLAYERX_H +#define AMBULANT_GUI_DX_AUDIO_PLAYERX_H + +#include "ambulant/config/config.h" + +#include <string> +#include <cmath> + +#include <objbase.h> +#include <strmif.h> +#include <control.h> + +#include <initguid.h> + +//#include "ambulant/common/playable.h" +//#include "ambulant/lib/win32/win32_error.h" +//#include "ambulant/lib/logger.h" + +#ifndef AMBULANT_PLATFORM_WIN32_WCE +#pragma comment (lib,"winmm.lib") +#pragma comment (lib,"amstrmid.lib") +#endif +#pragma comment (lib,"strmiids.lib") +#pragma comment (lib,"uuid.lib") + +#ifndef AMBULANT_PLATFORM_WIN32_WCE +#define WITH_TPB_AUDIO_SPEEDUP +#endif + +#ifdef WITH_TPB_AUDIO_SPEEDUP +// If this option is active during build (which is true when building +// for AmisAmbulant) we try to insert the TPB Audio Speedup/Slowdown +// filter into our filtergraph. This allows for changing audio playback +// speed without altering pitch. +// If the TPB DirectShow filter is not available we do nothing. +#include <set> + +DEFINE_GUID(CLSID_TPBVupp69, + 0x66172967, 0x56c5, 0x4b89, 0xaa, 0x92, 0xc9, 0xef, 0xec, 0x56, 0x46, 0x7b); + + +#ifdef __cplusplus +extern "C" { +#endif + +// {A33E626E-D6C4-4559-A1D6-9F1D95F0D8E2} +DEFINE_GUID(IID_IVuppInterface, +0xa33e626e, 0xd6c4, 0x4559, 0xa1, 0xd6, 0x9f, 0x1d, 0x95, 0xf0, 0xd8, 0xe2); + +DECLARE_INTERFACE_(IVuppInterface, IUnknown) { + + //Deklarera metoder: + STDMETHOD(setCrossFadeSpeed) + ( THIS_ + double speed + ) PURE; + + STDMETHOD(setWindowLength) + ( THIS_ + int length + ) PURE; + + STDMETHOD(setCycleSpeed) + ( THIS_ + short speed + ) PURE; + + STDMETHOD(setSilenceLoudnessThreshold) + ( THIS_ + short threshold + ) PURE; + + STDMETHOD(setSilenceRemainderLength) + ( THIS_ + short length + ) PURE; + + STDMETHOD(setSilenceSpeed) + ( THIS_ + short speed + ) PURE; + + STDMETHOD(getPosition) + ( THIS_ + LONGLONG &position + ) PURE; +}; + +#ifdef __cplusplus +} +#endif + + + +#endif // WITH_TPB_AUDIO_SPEEDUP + +typedef void (*sendMessageCallbackFn)(void); + +static double s_current_playback_rate = 1.0; + +namespace ambulantX { + +namespace gui { + +namespace dx { + +class audio_playerX { + + typedef std::pair<bool, double> duration; + + public: + void setCallback(sendMessageCallbackFn pFunction); + + audio_playerX(const char * url); + ~audio_playerX(); + + void start(double t); + void stop(); + //void pause(common::pause_display d=common::display_show); + void pause(void); + void resume(); + void seek(double t); + void endseek(double t); + duration get_dur(); + void wantclicks(bool want) {} + void preroll(double when, double where, double how_much) {} + + bool can_play(); + bool is_playing(); + double get_position(); + + // -val is the attenuation in decibels + // can be 0 to 100 + void set_volume(long val); + + // can be -100 to 100 + // 0 sets a neutral balance + // and 10 sets -10 db to right and -90 db to left + void set_balance(long val); + + private: + + bool open(const char * url); + void release_player(); + + std::string m_url; + + IGraphBuilder *m_graph_builder; + IMediaControl *m_media_control; + IMediaPosition *m_media_position; + IBasicAudio *m_basic_audio; + + HANDLE hEventHandler; + +public: + IMediaEvent *m_media_event; + sendMessageCallbackFn sendMessageCallback; + bool bCatchEvents; + bool bProcessEvents; + +#ifdef WITH_TPB_AUDIO_SPEEDUP + public: + void set_rate(double rate); + private: + IVuppInterface *m_audio_speedup; + void initialize_speedup_filter(); +#endif +}; + +} // namespace dx + +} // namespace gui + +} // namespace ambulantX + +#endif // AMBULANT_GUI_DX_AUDIO_PLAYERX_H + Modified: branches/amis3/AmisAudio/src/AmisAudio.cpp =================================================================== --- branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-02-26 17:27:09 UTC (rev 2344) +++ branches/amis3/AmisAudio/src/AmisAudio.cpp 2008-02-26 22:44:16 UTC (rev 2345) @@ -1,10 +1,10 @@ /* -AmisAudio +AMIS: Adaptive Multimedia Information System +Software for playing DAISY books +Homepage: http://amis.sf.net -Copyright (C) 2005 DAISY for All Project +Copyright (C) 2004-2007 DAISY for All Project -Licensing note: This file is released as LGPL; however, its module relies upon GPL code in third party libraries. Any reuse of this library in a closed source environment must contact the GPL license holders to negotiate terms for use with an altered license. GPL code referenced from this module includes, but may not be limited to, libfftw, WSOLA code by Matt Flax, and stlib. - 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 @@ -19,596 +19,208 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// AmisAudio.cpp : Defines the entry point for the DLL application. - #include <stdlib.h> #include <iostream> #include <string> -#include "AmisAudio.h" - #include <process.h> + +#include "AmisAudio.h" using namespace amis::audio; -//#include "win32Fix.H" - -//#include "../AmisGuiMFC/Brain/Preferences.h" - - +#ifdef AMISAUDIO_EXPORTS BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { - switch (ul_reason_for_call) + switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; - } - return TRUE; + } + return TRUE; } +#endif - namespace amis { -namespace audio -{ -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(HWND parentWindow) -{ - mState=NOTACTIVE; - mVolume=100; - mWsolaSource=NULL; - - parentWnd=parentWindow; -}*/ - -AmisAudio::AmisAudio() -{ - //pDmpApp = 0; - pDmpCtrl = 0; - mTau=1.0; - mState=NOTACTIVE; - mVolume=1.0; - - mbAudioPlaybackEnabled = true; - - pDmpCtrl = new CDmpCtrl(); -} - -void AmisAudio::setCallback(sendMessageCallbackFn pFunction) -{ - pDmpCtrl->setCallback(pFunction); -} -/****************************************************************** -AmisAudio destructor Function -******************************************************************/ - - -AmisAudio::~AmisAudio() -{ - if (pDmpCtrl) delete pDmpCtrl; - - /*clean up code goes here*/ -} - -void AmisAudio::DestroyInstance() -{ - if (pinstance) delete pinstance; -} - -void AmisAudio::setStatePause() { - mState = PAUSE; - -} - - -/*-------------------------------------------------------------------------------------------------------------------------- -This function enables Audio plugin, initializes rate to 1.0 and volume to 100 -----------------------------------------------------------------------------------------------------------------------------*/ -void AmisAudio::enable() -{ - if (pDmpCtrl) { - mState=PAUSE; //ACTIVE - mTau=1.0; - mVolume = 1.0; - return; - } - switch(mState) + namespace audio { - case NOTACTIVE: + + /* + void AmisAudio::play(ambulant::net::url url,char* clipBegin,char* clipEnd) { + std::string str; + str.assign(url.get_file().c_str()); - mState=PAUSE; //ACTIVE - // mRate = 1.0; - mTau=1.0; - mVolume = 1.0; - return; - } - default: - return; - //return"Audio Plugin is already enabled"; - } -} + 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); -/*-------------------------------------------------------------------------------------------------------------------------- -This function disables Audio plugin -----------------------------------------------------------------------------------------------------------------------------*/ -void AmisAudio::disable() -{ - switch(mState) - { - //case ACTIVE: - case PLAYING: - case PAUSE: - //if(mState==PLAYING) - { - stop(); - ShowStatePrompt(); - mState=NOTACTIVE; - ShowStatePrompt(); - mState=NOTACTIVE; - return; - //return"Audio plugin has been disabled!!"; + 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; } - case NOTACTIVE: + else if(url.is_absolute()) { + m_player = new ambulantX::gui::dx::audio_playerX(url.get_url()); + } + else { return; - //return"Audio plugin is not enabled."; - - } - -} + } + */ + void AmisAudio::play(const char * url,char* clipBegin,char* clipEnd) + { + m_player = 0; + m_player = new ambulantX::gui::dx::audio_playerX(url); + SmilTimeCode startStop(clipBegin, clipBegin, clipEnd); + int begin=startStop.getStart(); + int end=startStop.getEnd(); -/**************************************************************** -play(char *filename,char* clipBegin,char* clipEnd) function -****************************************************************/ - -void AmisAudio::play(const char *filename,char* clipBegin,char* clipEnd){ - - - if (mbAudioPlaybackEnabled == false) - { - - return; - } - - mFileName.assign(filename); - int channel; - - //Format the beg and end from string to timeCode - SmilTimeCode startStop(clipBegin, clipBegin, clipEnd); - - unsigned long begin,end; - - ShowStatePrompt(); - - - - - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - break; + if (begin!=0){ + int q =1; } - //case ACTIVE: - case PAUSE: - case PLAYING: - { - if (pDmpCtrl) { - - if (mbAudioPlaybackEnabled == false) - { - return; - } - //stop(); - if (!pDmpCtrl->fileName(filename)) { - - pDmpCtrl->destroyFilterGraph(); - return; - } - pDmpCtrl->insertVupp(); - - begin=startStop.getStart(); - end=startStop.getEnd(); - if (! (begin == 0 && end == 0)) { - - if (begin >= 0 && begin < pDmpCtrl->getDuration()) { - pDmpCtrl->setPosition(begin); - } - - if (end >= 0 && end > begin && end < pDmpCtrl->getDuration()) { - pDmpCtrl->setStopPosition(end); - } - } - - pDmpCtrl->setVolume((long)(100*mVolume)); - pDmpCtrl->play(); - mState = PLAYING; - return; - } - - //return "now playing\n" ; + if (end!=0){ + int q =1; } - } - -} // end method + //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(sendMessageCallback); + + m_player->start(begin); + } -/**************************************************************** -stop() function -****************************************************************/ + AmisAudio* AmisAudio::pinstance = 0; -void AmisAudio::stop() -{ - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; + AmisAudio* AmisAudio::Instance() + { + if (pinstance == 0) // is it the first call? + { + pinstance = new AmisAudio; // create sole instance } - - /*case ACTIVE: - { - return; - //return"No file is playing"; - }*/ + return pinstance; // address of sole instance + } - case PLAYING : - { - mState = PAUSE; //ACTIVE - - if (pDmpCtrl) { - pDmpCtrl->stop(); - //pDmpCtrl->pause(); - return; - } + AmisAudio::AmisAudio() + { + m_player = 0; + } + void AmisAudio::setCallback(sendMessageCallbackFn pFunction) + { + sendMessageCallback = pFunction; + if (m_player) { + m_player->setCallback(pFunction); + } + } - return; - //return"The playing file has been stopped"; + AmisAudio::~AmisAudio() + { + if (m_player) { + delete m_player; // stop() and release_player() handled by destructor } - - case PAUSE : - { - mState = PAUSE; //ACTIVE + m_player = 0; + } - + void AmisAudio::DestroyInstance() + { + if (pinstance) delete pinstance; + } - return; - //return"The playing file has been stopped"; - + bool AmisAudio::isPlaying() + { + if (m_player) { + return m_player->is_playing(); + } else { + return false; } - } -} - - - - -/**************************************************************** -pause() function -****************************************************************/ + } -void AmisAudio::pause(){ - - - switch(mState) - { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - + void AmisAudio::pause() + { + if (m_player) { + m_player->pause(); } - - /* case ACTIVE : - { - return; - //return "The plugin is already stopped."; - } */ - case PLAYING : - { - mState=PAUSE; + } - if (pDmpCtrl) { - //pDmpCtrl->stop(); - pDmpCtrl->pause(); - return; - } - - return; - //return"The plugin is paused"; + void AmisAudio::resume() + { + if (m_player) { + m_player->resume(); } - - - - case PAUSE : - { - return; - //return "The plugin is already paused."; + } + void AmisAudio::stopX() + { + if (m_player) { + m_player->stop(); } - - } -} + m_player = 0; + } - -/**************************************************************** -resume() function -****************************************************************/ - -int AmisAudio::resume(){ - - - switch(mState) - { - - case NOTACTIVE: - { - return -1; - //return "Audio plugin is not enabled.\n"; - - } - - //case ACTIVE : - case PAUSE : + double AmisAudio::getVolume() { - - - if (pDmpCtrl) { - - pDmpCtrl->play(); - mState=PLAYING; - return 0; - } - - //return"The plugin is resumed"; - + if (m_player) { + //return m_player->get_volume(); TODO: implement this + return 100.0; + } else { + return 100.0; + } } - - case PLAYING : + + void AmisAudio::setVolume(double value) { - return 0; - //return"The plugin is not in paused state"; + if (m_player) { + m_player->set_volume(value); + } } - - - } - -} - -/**************************************************************** -getVolume() function -****************************************************************/ -double AmisAudio::getVolume() -{ - - return mVolume; -} - - -/**************************************************************** -setVolume(char * value) function -****************************************************************/ -void AmisAudio::setVolume(double value) -{ - mVolume = value; - - switch(mState) - { - - case NOTACTIVE: + void AmisAudio::adjustVolume(double adjustment) { - return; - //return "Audio plugin is not enabled.\n"; - + if (m_player) { + m_player->set_volume(adjustment); // TODO this won't work ! + } } - - //case ACTIVE : - case PAUSE : - case PLAYING : - { - - if (pDmpCtrl) { - - pDmpCtrl->setVolume((long)(100*mVolume)); - - return ; - } - } - } -} -//adjustment is positive or negative (louder or softer) -void AmisAudio::adjustVolume(double adjustment) -{ -mVolume *= adjustment; - - setVolume(mVolume); -} - - -void AmisAudio::adjustRate(double adjustment) -{ - if (pDmpCtrl) { - double value = mTau + adjustment; - setRate(value); - } -} - - -/**************************************************************** -getRate() function -****************************************************************/ - -double AmisAudio::getRate() -{ - return mTau; -} - -/**************************************************************** -setRate() function -****************************************************************/ - -void AmisAudio::setRate(double value){ - - - switch(mState) + void AmisAudio::adjustRate(double adjustment) { - - case NOTACTIVE: - { - return; - //return "Audio plugin is not enabled.\n"; - + if (m_player) { + m_player->set_rate(adjustment); // TODO this won't work ! } - - //case ACTIVE : - case PAUSE : - case PLAYING : - { - if (pDmpCtrl) { + } - mTau=value; - - if (mTau > 1.0) { - double offset = mTau - 1.0; - /* int n = offset / 0.2; - offset *= 6; - offset = n * 0.5; */ - //mTau = 1 - offset; - } - if (mTau < 1.0) { - double offset = 1.0 - mTau; - - mTau = 0.5; - - /* int n = offset / 0.2; - offset *= 6; - offset = n * 0.5; */ - //mTau = 1 + offset; - } - //if (mTau > 3) mTau = 3; - //if (mTau < 1) mTau = 1; - - //mTau=value; - - pDmpCtrl->setRate(mTau); - return; - } - - + double AmisAudio::getRate() + { + if (m_player) { + //return m_player->get_rate(); TODO: Implement this + return 1.0; + } else { + return 1.0; } - - - - } - - -} // end method - - - - -/**************************************************************** - isPlaying() function -****************************************************************/ - -bool AmisAudio::isPlaying() -{ + } - if(mState==PLAYING) - { - return true; - } - else - { - return false; - } - - -} - -bool AmisAudio::isActive() -{ - - return (mState==PAUSE || mState==PLAYING); - -} - /**************************************************************** - ShowStatePropmt() function - ****************************************************************/ - - - void AmisAudio::ShowStatePrompt(){ - - switch(mState){ - - case NOTACTIVE: { - std::cout<<"Not Active"<<endl; - break; - } - - /* case ACTIVE: { - std::cout<<" Active"<<endl; - break; - } */ - - case PAUSE: { - std::cout<<" Pause"<<endl; - break; - } - - case PLAYING: { - std::cout<<" Playing"<<endl; - } - - + void AmisAudio::setRate(double value){ + if (m_player) { + m_player->set_rate(value); + } } - } - - - void AmisAudio::enableAudioPlayback() - { - mbAudioPlaybackEnabled = true; - } - - void AmisAudio::disableAudioPlayback() - { - mbAudioPlaybackEnabled = false; - } - - bool AmisAudio::isAudioPlaybackEnabled() - { - return mbAudioPlaybackEnabled; - } - -}} \ No newline at end of file +} \ No newline at end of file Added: branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp =================================================================== --- branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp (rev 0) +++ branches/amis3/AmisAudio/src/directshow/dx_audio_player.cpp 2008-02-26 22:44:16 UTC (rev 2345) @@ -0,0 +1,547 @@ +// This file is part of Ambulant Player, www.ambulantplayer.org. +// +// Copyright (C) 2003-2008 Stichting CWI, +// Kruislaan 413, 1098 SJ Amsterdam, The Netherlands. +// +// Ambulant Player 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. +// +// Ambulant Player 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 Ambulant Player; if not, write to the Free Software +// 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 $ + */ + +#ifndef __AFXWIN_H__ +#include <afxwin.h> +#endif + +#include "directshow/dx_audio_player.h" + +//#include "ambulant/lib/logger.h" +#include "ambulant/lib/textptr.h" +#include <math.h> +#include <vfwmsgs.h> +// CLSID_FilterGraph +//#include <uuids.h> +#include <dshow.h> +#ifndef AM_DBG +#define AM_DBG if(0) +#endif + +using namespace ambulantX; + +//using ambulant::lib::win32::win_report_error; +//using ambulant::lib::win32::win_trace_error; +//using ambulant::lib::logger; + +const ULONGLONG MILLIS_FACT = 10000; + +#ifdef WITH_TPB_AUDIO_SPEEDUP +bool speedup_filter_available; +bool speedup_filter_available_valid; +#endif + +#define win_report_error +#define win_trace_error +#define debugX +#define errorX +#define traceX + +static DWORD WINAPI eventHandler(LPVOID lpParam) { + long lEventCode, lParam1, lParam2; + HRESULT hResult = E_FAIL; + bool bSelfBreak = false; + + gui::dx::audio_playerX *pPlayer = (gui::dx::audio_playerX*)lpParam; + + while((pPlayer->bCatchEvents) && (!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)) { + switch(lEventCode) { + case EC_COMPLETE: + pPlayer->sendMessageCallback(); + break; + case EC_USER + 4: + bSelfBreak = true; + break; + } + } + } + CoUninitialize(); + return 0; +} + +gui::dx::audio_playerX::audio_playerX(const char * url) +: + //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), +#endif + m_basic_audio(0), + hEventHandler(0), + bProcessEvents(false), + bCatchEvents(false) { + + open(url); +} + +gui::dx::audio_playerX::~audio_playerX() { + stop(); +} + +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; + HRESULT hr = m_media_control->Stop(); + if(FAILED(hr)) { + win_report_error("IMediaControl::stop()", hr); + } + release_player(); +} + +//void gui::dx::audio_playerX::pause(common::pause_display d) { +void gui::dx::audio_playerX::pause(void) { + if(m_media_control == 0) return; + HRESULT hr = m_media_control->Pause(); + if(FAILED(hr)) { + win_report_error("IMediaControl::pause()", hr); + } +} + +void gui::dx::audio_playerX::resume() { + if(m_media_control == 0) { + debugX("Invalid call to audio_playerX::run"); + return; + } + HRESULT hr = m_media_control->Run(); + if(FAILED(hr)) { + win_report_error("IMediaControl::run()", hr); + } +} + +void gui::dx::audio_playerX::seek(double t) { + if(m_media_position == 0) return; + HRESULT hr = m_media_position->put_CurrentPosition(REFTIME(t)); + if(FAILED(hr)) + win_report_error("IMediaPosition::put_CurrentPosition()", hr); +} + +void gui::dx::audio_playerX::endseek(double t) { + if(m_media_position == 0) return; + HRESULT hr = m_media_position->put_StopTime(REFTIME(t)); + if(FAILED(hr)) + win_report_error("IMediaPosition::put_StopTime()", hr); +} + +std::pair<bool, double> gui::dx::audio_playerX::get_dur() { + if(m_media_position == 0) { + debugX("Invalid call to audio_playerX::get_duration"); + return std::pair<bool, double>(false, 0); + } + REFTIME dur = 0.0; + HRESULT hr = m_media_position->get_Duration(&dur); + if(FAILED(hr)) { + win_report_error("IMediaPosition::get_Duration()", hr); + return std::pair<bool, double>(false, 0); + } + return std::pair<bool, double>(dur>0, dur); +} + +bool gui::dx::audio_playerX::can_play() { + return m_graph_builder && + m_media_event && + m_media_position && + m_media_control && + m_media_event; +} + +bool gui::dx::audio_playerX::is_playing() { + 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; + 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; + } + return evCode == 0; +} + +#if 0 +double gui::dx::audio_playerX::get_position() { + if(m_media_position == 0) { + debugX("Invalid call to audio_playerX::get_current_position"); + return 0.0; + } + REFTIME pos = 0.0; + HRESULT hr = m_media_position->get_CurrentPosition(&pos); + if(FAILED(hr)) { + win_report_error("IMediaPosition::get_CurrentPosition()", hr); + return 0.0; + } + return pos; +} +#endif + +////////////////////////// + +bool gui::dx::audio_playerX::open(const char * url) { + //m_url = url; + m_url.assign(url); + + HRESULT hrr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + + 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, + 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)){ + /* + 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::release_player() { + if(m_graph_builder) { + + 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) { + //return false; + } + 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; + } + + CoUninitialize(); +} + +#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. + return; + } + // 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 res; + res = CoCreateInstance(CLSID_TPBVupp69, NULL, CLSCTX_INPROC_SERVER, + IID_IBaseFilter, (void**)&pNewFilter); + + if (res != S_OK) { + traceX("dx_audio_player: Speedup filter not available, error 0x%x", res); + speedup_filter_available = false; + speedup_filter_available_valid = true; + return; + } + res = m_graph_builder->AddFilter(pNewFilter, NULL); + if (res != S_OK) { + traceX("dx_audio_player: AddFilter(Speedup filter): error 0x%x", res); + pNewFilter->Release(); + return; + } + speedup_filter_available = true; + speedup_filter_available_valid = true; +// 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 + // we iterate over the connected output pins util we find one we like. + IPin *pOutputPin = NULL; + IPin *pInputPin = NULL; + IEnumFilters *pEnumFilters = NULL; + res = m_graph_builder->EnumFilters(&pEnumFilters); + if (res != S_OK) { + traceX("dx_audio_filter: EnumFilters: error 0x%x", res); + return; + } + + IBaseFilter *pCurFilter; + while (pOutputPin == NULL && (res=pEnumFilters->Next(1, &pCurFilter, NULL)) == S_OK) { + AM_DBG { + FILTER_INFO info; + LPWSTR vendorInfo; + res = pCurFilter->QueryFilterInfo(&info); + if (res != S_OK) info.achName[0] = 0; + res = pCurFilter->QueryVendorInfo(&vendorInfo); + if (res != S_OK) vendorInfo = L""; + ambulant::lib::textptr tInfo(info.achName); + ambulant::lib::textptr tVendorInfo(vendorInfo); + //lib::debugX("dx_audio_filter: filter found: '%s' vendor '%s'", tInfo.c_str(), tVendorInfo.c_str()); + } + IEnumPins *pEnumPins; + res = pCurFilter->EnumPins(&pEnumPins); + IPin *pCurPin; + while (pOutputPin == NULL && (res=pEnumPins->Next(1, &pCurPin, NULL)) == S_OK) { + AM_MEDIA_TYPE mediaType; + PIN_DIRECTION curPinDir; + 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(); + } + } + if (res2 == S_OK) { + if (mediaType.cbFormat != 0) { + CoTaskMemFree((PVOID)mediaType.pbFormat); + } + } + pCurPin->Release(); + } + if (res != S_FALSE && res != S_OK) + traceX("dx_audio_filter: enumerating pins: error 0x%x", res); + pEnumPins->Release(); + pCurFilter->Release(); + } + if (res != S_FALSE && res != S_OK) + traceX("dx_audio_filter: enumerating filters: error 0x%x", res); + + pEnumFilters->Release(); + // We have the correct pins now. + if (pOutputPin) { + traceX("dx_audio_filter: found the right pins!"); + } else { + traceX("dx_audio_filter: could not find a good pin"); + pOutputPin->Release(); + pInputPin->Release(); + return; + } + // Now we need to find the pins on our speedup filter. + IPin *pFilterInputPin = NULL; + IPin *pFilterOutputPin = NULL; + IEnumPins *pEnumPins; + res = pNewFilter->EnumPins(&pEnumPins); + IPin *pCurPin; + while (res=pEnumPins->Next(1, &pCurPin, NULL) == S_OK) { + PIN_DIRECTION pinDir; + res = pCurPin->QueryDirection(&pinDir); + //assert(res == S_OK); + if (pinDir == PINDIR_INPUT) { + if (pFilterInputPin) { + traceX("dx_audio_filter: multiple input pins on filter"); + goto bad; + } + pFilterInputPin = pCurPin; + pFilterInputPin->AddRef(); + } else { + if (pFilterOutputPin) { + traceX("dx_audio_filter: multiple output pins on filter"); + goto bad; + } + pFilterOutputPin = pCurPin; + pFilterOutputPin->AddRef(); + } + } + if (!pFilterInputPin) { + traceX("dx_audio_filter: no input pin on filter"); + goto bad; + } + if (!pFilterOutputPin) { + traceX("dx_audio_filter: no output pin on filter"); + goto bad; + } + // We have everything. Sever the old connection and insert the filter. + res = m_graph_builder->Disconnect(pOutputPin); + if (res) { + traceX("dx_audio_filter: Severing old connection: error 0x%x", res); + goto bad; + } + res = m_graph_builder->Disconnect(pInputPin); + if (res) { + traceX("dx_audio_filter: Severing old connection: error 0x%x", res); + goto bad; + } + res = m_graph_builder->Connect(pOutputPin, pFilterInputPin); + if (res) { + traceX("dx_audio_filter: Creating filter input connection: error 0x%x", res); + goto bad; + } + res = m_graph_builder->Connect(pFilterOutputPin, pInputPin); + if (res) { + traceX("dx_audio_filter: Creating filter output connection: error 0x%x", res); + goto bad; + } + // Finally remember the interface to set speedup/slowdown, and register ourselves + // in the global pool (so Amis can change our speed). + res = pNewFilter->QueryInterface(IID_IVuppInterface, (void**) &m_audio_speedup); + if (res != S_OK) { + traceX("dx_audio_filter: filter does not provide IVuppInterface"); + goto bad; + } + set_rate(s_current_playback_rate); + +bad: + if (pOutputPin) pOutputPin->Release(); + if (pInputPin) pInputPin->Release(); + if (pFilterOutputPin) pFilterOutputPin->Release(); + if (pFilterInputPin) pFilterInputPin->Release(); + return; + +} + +void gui::dx::audio_playerX::set_rate(double rate) { + s_current_playback_rate = rate; + if (m_audio_speedup) { + m_audio_speedup->setCycleSpeed((short)(rate*100)); + } +} + +#endif + +// -val is the attenuation in decibels +// can be 0 to 100 +void gui::dx::audio_playerX::set_volume(long val) { + if(m_basic_audio == 0) return; + if (val < 0) val = 0; + if (val > 100) val = 100; + 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 +void gui::dx::audio_playerX::set_balance(long val) { + if(m_basic_audio == 0) return; + val = (val>=-100)?val:-100; + val = (val<=100)?val:100; + long cdb = val*100; + m_basic_audio->put_Balance(cdb); +} + + +void gui::dx::audio_playerX::setCallback(sendMessageCallbackFn pFunction) +{ + sendMessageCallback=pFunction; +} Modified: branches/amis3/AmisCore/AmisCore.vcproj =================================================================== --- branches/amis3/AmisCore/AmisCore.vcproj 2008-02-26 17:27:09 UTC (rev 2344) +++ branches/amis3/AmisCore/AmisCore.vcproj 2008-02-26 22:44:16 UTC (rev 2345) @@ -65,7 +65,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="./include; ../../../../xerces-c-src/src;../../../../ambulant/include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" - RuntimeLibrary="0" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-02-26 17:27:09 UTC (rev 2344) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-02-26 22:44:16 UTC (rev 2345) @@ -20,7 +20,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="include;../../../../ambulant/include/;"../../../../ambulant-private/pdtbplugin";"../../../../ambulant-private/pdtbplugin/PdtbIePlugin";../AmisCore/include;"../../../../xerces-c-src/src";"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Include"" + 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" MinimalRebuild="TRUE" BasicRuntimeChecks="3" @@ -35,7 +35,7 @@ Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" - AdditionalDependencies="AmisCoreD.lib xerces-c_2D.lib libambulant_shwin32_D.lib AmisAudioD.lib" + AdditionalDependencies="AmisCoreD.lib xerces-c_2D.lib libambulant_shwin32_D.lib" 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" @@ -71,14 +71,14 @@ </Configuration> <Configuration Name="Release|Win32" - OutputDirectory="Release" + OutputDirectory="../bin" IntermediateDirectory="Release" ConfigurationType="1" UseOfMFC="2" CharacterSet="1"> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include;../../../../ambulant/include/;"../../../../ambulant-private/pdtbplugin";"../../../../ambulant-private/pdtbplugin/PdtbIePlugin";../AmisCore/include;"../../../../xerces-c-src/src";"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Include"" + 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" MinimalRebuild="FALSE" RuntimeLibrary="2" @@ -91,7 +91,7 @@ Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" - AdditionalDependencies="xerces-c_2.lib AmisCore.lib AmisAudio.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 stlib.lib kernel32.lib gdi32.lib user32.lib" LinkIncremental="1" AdditionalLibraryDirectories="../lib;../../../../ambulant/lib/win32;"$(VSInstallDir)\..\Microsoft Speech SDK 5.1\Lib\i386"" IgnoreAllDefaultLibraries="FALSE" @@ -784,6 +784,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\AudioSequence.cpp"> @@ -793,6 +799,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\AudioSequenceComponent.cpp"> @@ -802,6 +814,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\AudioSequencePlayer.cpp"> @@ -811,6 +829,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\PreTranslateMessageHandler.cpp"> @@ -820,6 +844,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\Prompt.cpp"> @@ -829,6 +859,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\PromptResolver.cpp"> @@ -838,6 +874,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\TTSPlayer.cpp"> @@ -847,6 +889,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\UiMediaTypes.cpp"> @@ -856,6 +904,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <Filter Name="datamodel" @@ -868,6 +922,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\Action.cpp"> @@ -877,6 +937,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\Container.cpp"> @@ -886,6 +952,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\DataTree.cpp"> @@ -895,6 +967,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\Dialog.cpp"> @@ -904,6 +982,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\DialogControl.cpp"> @@ -913,6 +997,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\IniFile.cpp"> @@ -922,6 +1012,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\Label.cpp"> @@ -931,6 +1027,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> </File> <File RelativePath=".\src\gui\self-voicing\datamodel\LabelList.cpp"> @@ -940,6 +1042,12 @@ Name="VCCLCompilerTool" UsePrecompiledHeader="0"/> ... [truncated message content] |
From: <mar...@us...> - 2008-02-26 23:49:11
|
Revision: 2346 http://amis.svn.sourceforge.net/amis/?rev=2346&view=rev Author: marisademeglio Date: 2008-02-26 15:49:15 -0800 (Tue, 26 Feb 2008) Log Message: ----------- Added basic view mode and basic toolbar Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp Added Paths: ----------- branches/amis3/bin/settings/basicToolbar.xml branches/amis3/bin/settings/img/basicToolbar/ Modified: branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-02-26 22:44:16 UTC (rev 2345) +++ branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-02-26 23:49:15 UTC (rev 2346) @@ -100,6 +100,7 @@ afx_msg void OnSpeedNormal(); afx_msg void OnPreferences(); afx_msg void OnPublicationSummary(); + afx_msg void OnToggleView(); protected: HMENU m_hMDIMenu; HACCEL m_hMDIAccel; Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-02-26 22:44:16 UTC (rev 2345) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-02-26 23:49:15 UTC (rev 2346) @@ -46,6 +46,7 @@ virtual BOOL PreTranslateMessage(MSG* pMsg); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual ~CMainFrame(); + void restoreMenu(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; @@ -57,6 +58,8 @@ amis::gui::toolbar::Toolbar mDefaultToolbar; amis::gui::toolbar::Toolbar mBasicToolbar; CReBar mDefaultRebar; + CReBar mBasicRebar; + CMenu mSavedMenu; protected: //{{AFX_MSG(CMainFrame) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); Modified: branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h 2008-02-26 22:44:16 UTC (rev 2345) +++ branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h 2008-02-26 23:49:15 UTC (rev 2346) @@ -25,8 +25,7 @@ #include "gui/MainFrm.h" #include "gui/sidebar/AmisSidebar.h" - -//#include "../AmisToolbar.h" +#include "gui/toolbar/Toolbar.h" #include "HtmlView.h" #include "MmDoc.h" #include "MmView.h" @@ -57,10 +56,10 @@ public: amis::gui::sidebar::cdxCDynamicBarT<amis::gui::sidebar::CAmisSidebar>* mpSidebar; CMainFrame* mpMainFrame; - //CAmisToolbar* mpBasicToolbar; - //CAmisToolbar* mpDefaultToolbar; - //CReBar* mpBasicRebar; - //CReBar* mpDefaultRebar; + amis::gui::toolbar::Toolbar* mpBasicToolbar; + amis::gui::toolbar::Toolbar* mpDefaultToolbar; + CReBar* mpBasicRebar; + CReBar* mpDefaultRebar; CAmisHtmlView* mpHtmlView; CStatusBar* mpStatusBar; MmDoc* mpMmDoc; Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-26 22:44:16 UTC (rev 2345) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-26 23:49:15 UTC (rev 2346) @@ -104,6 +104,7 @@ ON_COMMAND(ID_MENU_PLAY_VOLDOWN, OnVolumeDown) ON_COMMAND(ID_MENU_FILE_PREFERENCES, OnPreferences) ON_COMMAND(ID_MENU_INFO_PUBLICATION_SUMMARY, OnPublicationSummary) + ON_COMMAND(ID_MENU_VIEW_BASIC, OnToggleView) END_MESSAGE_MAP() CAmisApp::CAmisApp() @@ -190,7 +191,7 @@ m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_AMISTYPE)); //why won't this work?? - //MainWndParts::Instance()->mpMainFrame->SetIcon(AfxGetApp()->LoadIcon(IDI_AMIS), TRUE); + MainWndParts::Instance()->mpMainFrame->SetIcon(AfxGetApp()->LoadIcon(IDI_AMIS), TRUE); amis::gui::MenuManip::Instance()->setupMenusNothingOpen(); amis::gui::MenuManip::Instance()->refreshRecentBooksListMenu(); @@ -747,6 +748,10 @@ summary.DoModal(); } +void CAmisApp::OnToggleView() +{ + MainWndParts::Instance()->toggleViewMode(); +} /*************************************************** * (MED) I moved these functions out of the menu handler area *****************************************************/ Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-26 22:44:16 UTC (rev 2345) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-26 23:49:15 UTC (rev 2346) @@ -75,6 +75,7 @@ { mbWasPlayingWhenLostFocus = false; m_lastOpenPopupMenu = NULL; + mSavedMenu.LoadMenu(IDR_AMISTYPE); mCommonPreTranslateMessageHandler = new PreTranslateMessageHandler(-1); } @@ -98,7 +99,17 @@ mSidebar.SetBarStyle(mSidebar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); mSidebar.EnableDocking(CBRS_ALIGN_ANY); - //create default (top) toolbar + //create the status bar + 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; + } + + //create the default toolbar CRect rect; GetWindowRect(rect); amis::util::Log::Instance()->writeMessage("Loading default toolbar", "CMainFrame::OnCreate", "AmisGuiMFC2"); @@ -116,28 +127,53 @@ "AmisGuiMFC2"); return -1; } + mDefaultToolbar.EnableToolTips(TRUE); - //create top rebar (toolbar container) - //TODO: use the right placement (top, bottom, etc) - if (mDefaultRebar.Create(this, RBS_BANDBORDERS, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | - WS_CLIPCHILDREN | CBRS_TOP, AFX_IDW_REBAR) == FALSE) + //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 | + 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; } + mDefaultRebar.AddBar(&mDefaultToolbar); - - //create the status bar - if (!mStatusBar.Create(this) - || !mStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) + + //create the basic toolbar + amis::util::Log::Instance()->writeMessage("Loading basic toolbar", "CMainFrame::OnCreate", "AmisGuiMFC2"); + toolbar_file = ambulant::net::url::from_filename("./settings/basicToolbar.xml"); + toolbar_file = toolbar_file.join_to_base(ambulant::net::url::from_filename(theApp.getAppPath())); + toolbar_reader.readFromFile(toolbar_file.get_file()); + p_settings = toolbar_reader.getToolbarSettings(); + mBasicToolbar.setSettings(p_settings); + if (!mBasicToolbar.Create(WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, + rect, this, mSidebar.GetDlgCtrlID() + 2)) { - TRACE0("Failed to create status bar\n"); - amis::util::Log::Instance()->writeError("Failed to create status bar", "CMainFrame::OnCreate", + 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); + + //create the basic rebar (toolbar container) + if (p_settings->getPlacement() == amis::gui::toolbar::TOP) align = CBRS_TOP; + else align = CBRS_BOTTOM; + 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; + } + 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); @@ -150,7 +186,10 @@ MainWndParts::Instance()->mpSidebar = &mSidebar; MainWndParts::Instance()->mpStatusBar = &mStatusBar; MainWndParts::Instance()->mpMainFrame = this; - + MainWndParts::Instance()->mpDefaultToolbar = &mDefaultToolbar; + MainWndParts::Instance()->mpBasicToolbar = &mBasicToolbar; + MainWndParts::Instance()->mpBasicRebar = &mBasicRebar; + MainWndParts::Instance()->mpDefaultRebar = &mDefaultRebar; return 0; } @@ -164,6 +203,11 @@ return TRUE; } +//reload the original menu +void CMainFrame::restoreMenu() +{ + this->SetMenu(&mSavedMenu); +} #ifdef _DEBUG void CMainFrame::AssertValid() const Modified: branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp 2008-02-26 22:44:16 UTC (rev 2345) +++ branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp 2008-02-26 23:49:15 UTC (rev 2346) @@ -41,10 +41,10 @@ { mpSidebar = NULL; mpMainFrame = NULL; - //mpBasicToolbar = NULL; - //mpDefaultToolbar = NULL; - //mpBasicRebar = NULL; - //mpDefaultRebar = NULL; + mpBasicToolbar = NULL; + mpDefaultToolbar = NULL; + mpBasicRebar = NULL; + mpDefaultRebar = NULL; mpHtmlView = NULL; mpStatusBar = NULL; mpMmDoc = NULL; @@ -60,9 +60,7 @@ void MainWndParts::toggleViewMode() { - //go to basic view mode - if (mbBasicView == false) this->basicView(); - //go to default view mode + if (mbBasicView == false) basicView(); else defaultView(); } @@ -82,79 +80,50 @@ void MainWndParts::basicView() { - /* - if (this->mbSidebarVisible == true) - { - toggleSidebar(); - } + if (this->mbSidebarVisible == true) toggleSidebar(); - //check the basic view menu - CMenu* p_menu = NULL; - p_menu = mpMainFrame->GetMenu(); - p_menu->CheckMenuItem(ID_MENU_VIEW_BASIC, MF_CHECKED); - + /* TODO: re-add this //change the window title text to say "basic view mode" mMainWindowTitle = this->mpMainFrame->GetTitle(); - CString new_title = mMainWindowTitle + _T(": basic view"); this->mpMainFrame->SetTitle(new_title); + */ mpMainFrame->ShowControlBar(mpStatusBar, FALSE, TRUE); - mpMainFrame->ShowControlBar(mpDefaultRebar, FALSE, TRUE); - mpMainFrame->ShowControlBar(mpBasicRebar, TRUE, TRUE); - mpMainFrame->SetMenu(NULL); - mpMainFrame->RecalcLayout(); - - mbBasicView = true; - -*/ - + mbBasicView = true; } void MainWndParts::defaultView() { - /* CMenu* p_menu = NULL; + + //TODO: Set the title again + //this->mpMainFrame->SetTitle(mMainWindowTitle); - this->mpMainFrame->SetTitle(mMainWindowTitle); - mpMainFrame->restoreMenu(); - + /* TODO: re-add menu settings code if (AmisBrain::Instance()->doesMenuNeedUpdate() == true) { AmisBrain::Instance()->updateMenus(); AmisBrain::Instance()->flagMenusForUpdate(false); - } + }*/ - - //uncheck the basic view menu - p_menu = mpMainFrame->GetMenu(); - p_menu->CheckMenuItem(ID_MENU_VIEW_BASIC, MF_UNCHECKED); - mpMainFrame->ShowControlBar(mpStatusBar, TRUE, TRUE); - mpMainFrame->ShowControlBar(mpDefaultRebar, TRUE, TRUE); - mpMainFrame->ShowControlBar(mpBasicRebar, FALSE, TRUE); - mpMainFrame->RecalcLayout(); - mbBasicView = false; - - if (this->mbSidebarVisible == false) - { - toggleSidebar(); - } - */ + //TODO: make this smarter: only turn the sidebar on if it had been on before + if (this->mbSidebarVisible == false) toggleSidebar(); } bool MainWndParts::isBasicView() { - return this->mbBasicView; + return mbBasicView; } @@ -173,9 +142,11 @@ updateTitleBar(TITLEBAR_PLAYSTATE, (playing ? L"Playing..." : L"Paused.")); } -void MainWndParts::updateTitleBar(TitleBarFieldID field, CString str) { +void MainWndParts::updateTitleBar(TitleBarFieldID field, CString str) +{ CString title; - switch (field) { + switch (field) + { case TITLEBAR_APPNAME: { mStrTITLEBAR_APPNAME = str; break; Modified: branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp 2008-02-26 22:44:16 UTC (rev 2345) +++ branches/amis3/AmisGuiMFC2/src/io/ToolbarIO.cpp 2008-02-26 23:49:15 UTC (rev 2346) @@ -63,6 +63,8 @@ { mbFlagInToggle = false; mpCurrentToggle = NULL; + mItems.clear(); + mpToolbarSettings = NULL; ambulant::net::url tmp_url = ambulant::net::url::from_filename(filepath); bool ret = parseFile(&tmp_url); return ret; Added: branches/amis3/bin/settings/basicToolbar.xml =================================================================== --- branches/amis3/bin/settings/basicToolbar.xml (rev 0) +++ branches/amis3/bin/settings/basicToolbar.xml 2008-02-26 23:49:15 UTC (rev 2346) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<toolbar xmlns="http://amisproject.org" view="basic" placement="bottom" buttonHeight="72" buttonWidth="72"> + <button src="./img/basicToolbar/media_seek_backward.ico" mfcid="ID_MENU_NAV_PREVPHRASE"/> + <toggle> + <button src="./img/basicToolbar/media_playback_start.ico" mfcid="ID_MENU_PLAY_PLAY"/> + <button src="./img/basicToolbar/media_playback_pause.ico" mfcid="ID_MENU_PLAY_PAUSE"/> + </toggle> + <button src="./img/basicToolbar/media_seek_forward.ico" mfcid="ID_MENU_NAV_NEXTPHRASE"/> + <separator/> + <button src="./img/basicToolbar/style.ico" mfcid="ID_MENU_PLAY_SLOWER"/> + <separator/> + <button src="./img/basicToolbar/display.ico" mfcid="ID_MENU_VIEW_BASIC"/> +</toolbar> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-02-27 20:38:38
|
Revision: 2347 http://amis.svn.sourceforge.net/amis/?rev=2347&view=rev Author: marisademeglio Date: 2008-02-27 12:38:43 -0800 (Wed, 27 Feb 2008) Log Message: ----------- Changed IDC_STATIC controls to have unique names. It shouldn't make much difference, but it's a good idea anyway. Updated resource.h.ini Removed some code from the SkipDialog (it will only get displayed when there is something to skip). Regardless of what I removed, it crashes when it tries to fill the list box. This feels like an MFC DLL conflict since it's very normal code that used to work all the time. Nothing has changed in the custom test list either. Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/resource.h branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp branches/amis3/DefaultLangpack/amisAccessibleUi.xml branches/amis3/bin/settings/resource.h.ini Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-26 23:49:15 UTC (rev 2346) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-27 20:38:43 UTC (rev 2347) @@ -249,7 +249,7 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN LTEXT "This book contains the following special types of items. Checked items will be played. Unchecked items will be skipped.", - IDC_STATIC,7,7,224,21 + IDC_SKIP_INSTRUCTIONS,7,7,224,21 LISTBOX IDC_SKIPS,7,32,224,123,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP @@ -294,7 +294,7 @@ CAPTION "Go To Page" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - LTEXT "Go To Page",IDC_STATIC,7,7,69,8 + LTEXT "Go To Page",IDC_GOTOPAGE_CAPTION,7,7,69,8 EDITTEXT IDC_PAGENUM,7,22,40,14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,7,45,50,14 PUSHBUTTON "&Cancel",IDCANCEL,63,45,50,14 @@ -320,7 +320,7 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN LTEXT "More than one book was found on this CD. Please select a book from the list below and press Alt + O to open.", - IDC_STATIC,7,7,239,18 + IDC_MULTIVOLCD_INSTRUCTIONS,7,7,239,18 LISTBOX IDC_BOOKLIST,7,27,239,124,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "&Open",IDC_OPENBOOK,71,159,50,14 @@ -332,7 +332,7 @@ CAPTION "About AMIS" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - ICON IDI_AMIS,IDC_STATIC,11,17,20,20 + ICON IDI_AMIS,IDC_AMISICON,11,17,20,20 LTEXT "AMIS: \nAdaptive Multimedia Information System", IDC_AMISNAME,40,10,132,31,SS_NOPREFIX LTEXT "Version 3.0 beta",IDC_VERSION,39,44,128,8 @@ -362,8 +362,8 @@ CAPTION "Open URL" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - LTEXT "Enter the URL of the book you want to open:",IDC_STATIC, - 7,7,146,8 + LTEXT "Enter the URL of the book you want to open:", + IDC_OPENURL_CAPTION,7,7,146,8 EDITTEXT IDC_URL,7,26,251,12,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,73,49,50,14 PUSHBUTTON "Cancel",IDCANCEL,127,49,50,14 Modified: branches/amis3/AmisGuiMFC2/resource.h =================================================================== --- branches/amis3/AmisGuiMFC2/resource.h 2008-02-26 23:49:15 UTC (rev 2346) +++ branches/amis3/AmisGuiMFC2/resource.h 2008-02-27 20:38:43 UTC (rev 2347) @@ -68,6 +68,11 @@ #define IDC_SEARCHINSTRUCTIONS 1088 #define IDC_INSTALLEDLANGUAGES 1097 #define IDC_PUBLICATIONSUMMARYCAPTION 1100 +#define IDC_AMISICON 1101 +#define IDC_SKIP_INSTRUCTIONS 1102 +#define IDC_MULTIVOLCD_INSTRUCTIONS 1103 +#define IDC_GOTOPAGE_CAPTION 1104 +#define IDC_OPENURL_CAPTION 1105 #define ID_MENU_FIND_IN_TEXT_NEXT 9000 #define ID_MENU_FIND_IN_TEXT_PREV 9001 #define IDC_CURRLANG 9002 @@ -131,7 +136,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 192 #define _APS_NEXT_COMMAND_VALUE 32883 -#define _APS_NEXT_CONTROL_VALUE 1101 +#define _APS_NEXT_CONTROL_VALUE 1106 #define _APS_NEXT_SYMED_VALUE 142 #endif #endif Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-02-26 23:49:15 UTC (rev 2346) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-02-27 20:38:43 UTC (rev 2347) @@ -114,51 +114,12 @@ if (mpCustomTests != NULL && mpCustomTests->getLength() > 0) m_ListSkips.SetFocus(); else m_Ok.SetFocus(); + // return TRUE unless you set the focus to a control return FALSE; - //return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE } -void SkipDialog::setDescriptiveText(bool hasSkips) -{ - amis::gui::spoken::Dialog* p_dlg = NULL; - p_dlg = amis::gui::spoken::DataTree::Instance()->findDialog(IDD_SKIP); - amis::gui::spoken::Switch* p_switch = NULL; - p_switch = p_dlg->getSwitch(); - - amis::gui::spoken::Label* p_label = NULL; - - if (hasSkips == true) - { - p_label = p_switch->getLabel("hasSkippableStructures"); - } - else - { - p_label = p_switch->getLabel("hasNoSkippableStructures"); - } - - amis::gui::spoken::TextNode* p_text = NULL; - p_text = p_label->getContents()->getText(); - - CString desc = p_text->getTextString().c_str(); - - CStatic* p_ctrl = NULL; - p_ctrl = (CStatic*)this->GetDlgItem(IDC_STATIC); - p_ctrl->SetWindowText(desc); -} - - void SkipDialog::fillListBox() { - if (mpCustomTests->getLength() == 0) - { - setDescriptiveText(false); - } - else - { - setDescriptiveText(true); - } - USES_CONVERSION; //populate the list box Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-02-26 23:49:15 UTC (rev 2346) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-02-27 20:38:43 UTC (rev 2347) @@ -885,7 +885,7 @@ <text id="t154">Multiple books found</text> <audio src="./audio/154_Multiple_books_found.mp3"/> </caption> - <description mfcid="IDC_STATIC"> + <description mfcid="IDC_MULTIVOLCD_INSTRUCTIONS"> <text id="t155">More than one book was found on this CD. Please select a book from the list below and press Alt + O to open.</text> <audio src="./audio/155_More_than_one_book_was_found_o.mp3"/> </description> @@ -1118,7 +1118,7 @@ <text id="t187">Reading Options</text> <audio src="./audio/185_Skippable_Items.mp3"/> </caption> - <description condition="hasSkippableStructures" mfcid="IDC_STATIC"> + <description mfcid="IDC_SKIP_INSTRUCTIONS"> <text id="t188">This book contains the following special types of items. Checked items will be played. Unchecked items will be skipped.</text> <audio src="./audio/186_This_book_contains_the_followi.mp3"/> </description> Modified: branches/amis3/bin/settings/resource.h.ini =================================================================== --- branches/amis3/bin/settings/resource.h.ini 2008-02-26 23:49:15 UTC (rev 2346) +++ branches/amis3/bin/settings/resource.h.ini 2008-02-27 20:38:43 UTC (rev 2347) @@ -70,6 +70,11 @@ IDC_SEARCHINSTRUCTIONS=1088 IDC_INSTALLEDLANGUAGES=1097 IDC_PUBLICATIONSUMMARYCAPTION=1100 +IDC_AMISICON=1101 +IDC_SKIP_INSTRUCTIONS=1102 +IDC_MULTIVOLCD_INSTRUCTIONS=1103 +IDC_GOTOPAGE_CAPTION=1104 +IDC_OPENURL_CAPTION=1105 ID_MENU_FIND_IN_TEXT_NEXT=9000 ID_MENU_FIND_IN_TEXT_PREV=9001 IDC_CURRLANG=9002 @@ -133,7 +138,7 @@ _APS_3D_CONTROLS=1 _APS_NEXT_RESOURCE_VALUE=192 _APS_NEXT_COMMAND_VALUE=32883 -_APS_NEXT_CONTROL_VALUE=1101 +_APS_NEXT_CONTROL_VALUE=1106 _APS_NEXT_SYMED_VALUE=142 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-02-27 21:05:05
|
Revision: 2348 http://amis.svn.sourceforge.net/amis/?rev=2348&view=rev Author: marisademeglio Date: 2008-02-27 13:05:06 -0800 (Wed, 27 Feb 2008) Log Message: ----------- changed some names Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/Preferences.h branches/amis3/AmisGuiMFC2/src/Preferences.cpp branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp branches/amis3/bin/settings/amisPrefs.xml.default Added Paths: ----------- branches/amis3/bin/settings/css/amis.css branches/amis3/bin/settings/css/customStyles/ Removed Paths: ------------- branches/amis3/bin/settings/css/contrast/ branches/amis3/bin/settings/css/default.css Modified: branches/amis3/AmisGuiMFC2/include/Preferences.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-02-27 20:38:43 UTC (rev 2347) +++ branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-02-27 21:05:06 UTC (rev 2348) @@ -94,11 +94,11 @@ void setFontsizeCssDir(const ambulant::net::url*); const ambulant::net::url* getFontsizeCssDir(); - void setContrastCssDir(const ambulant::net::url*); - const ambulant::net::url* getContrastCssDir(); + void setCustomCssDir(const ambulant::net::url*); + const ambulant::net::url* getCustomCssDir(); - void setUserCssFile(const ambulant::net::url*); - const ambulant::net::url* getUserCssFile(); + void setAmisCssFile(const ambulant::net::url*); + const ambulant::net::url* getAmisCssFile(); void setZed2005CssFile(const ambulant::net::url*); const ambulant::net::url* getZed2005CssFile(); @@ -107,7 +107,7 @@ const ambulant::net::url* getSourceUrl(); amis::UrlList* getFontsizeCssFiles(); - amis::UrlList* getContrastCssFiles(); + amis::UrlList* getCustomCssFiles(); amis::StringModuleMap* getInstalledLanguages(); amis::ModuleDescData* getCurrentLanguageData(); @@ -129,8 +129,8 @@ ambulant::net::url mUserBmkDir; ambulant::net::url mLangpacksDir; ambulant::net::url mFontsizeCssDir; - ambulant::net::url mContrastCssDir; - ambulant::net::url mUserCssFile; + ambulant::net::url mCustomCssDir; + ambulant::net::url mAmisCssFile; ambulant::net::url mZed2005CssFile; //the following gets calculated at runtime @@ -138,8 +138,8 @@ amis::StringModuleMap mInstalledLanguages; //2. the fontsize css files amis::UrlList mFontsizeCssFiles; - //3. the contrast css files - amis::UrlList mContrastCssFiles; + //3. the custom css files + amis::UrlList mCustomCssFiles; //the source preferences XML file ambulant::net::url mSourceUrl; Modified: branches/amis3/AmisGuiMFC2/src/Preferences.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-02-27 20:38:43 UTC (rev 2347) +++ branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-02-27 21:05:06 UTC (rev 2348) @@ -55,23 +55,23 @@ setWasExitClean(true); setDisableScreensaver(true); mFontsizeCssFiles.clear(); - mContrastCssFiles.clear(); + mCustomCssFiles.clear(); //note that file paths here are hardcoded relative to the application directory //whereas in the prefs XML file, they are relative to the prefs XML file //they get overridden by reading in the preferences file; these defaults are just here as a safety measure mFontsizeCssDir = ambulant::net::url::from_filename("./settings/css/font/"); - mContrastCssDir = ambulant::net::url::from_filename("./settings/css/contrast/"); + mCustomCssDir = ambulant::net::url::from_filename("./settings/css/contrast/"); mLangpacksDir = ambulant::net::url::from_filename("./settings/lang/"); mUserBmkDir = ambulant::net::url::from_filename("./settings/bmk/"); - mUserCssFile = ambulant::net::url::from_filename("./settings/css/default.css"); + mAmisCssFile = ambulant::net::url::from_filename("./settings/css/default.css"); mZed2005CssFile = ambulant::net::url::from_filename("./settings/css/dtbook.2005.basic.css"); ambulant::net::url app_path = ambulant::net::url::from_filename(theApp.getAppPath()); mFontsizeCssDir = mFontsizeCssDir.join_to_base(app_path); - mContrastCssDir = mContrastCssDir.join_to_base(app_path); + mCustomCssDir = mCustomCssDir.join_to_base(app_path); mLangpacksDir = mLangpacksDir.join_to_base(app_path); mUserBmkDir = mUserBmkDir.join_to_base(app_path); - mUserCssFile = mUserCssFile.join_to_base(app_path); + mAmisCssFile = mAmisCssFile.join_to_base(app_path); mZed2005CssFile = mZed2005CssFile.join_to_base(app_path); mHighlightFG.set("000000"); @@ -106,14 +106,14 @@ } searcher.clearSearchResults(); - if (searcher.startSearch(mContrastCssDir.get_file()) > 0) + if (searcher.startSearch(mCustomCssDir.get_file()) > 0) { - mContrastCssFiles = *searcher.getSearchResults(); + mCustomCssFiles = *searcher.getSearchResults(); } else { TRACE(_T("No contrast css files found\n")); - string log_msg = "No contrast css files found in " + mContrastCssDir.get_url(); + string log_msg = "No contrast css files found in " + mCustomCssDir.get_url(); } } @@ -309,24 +309,24 @@ return &mFontsizeCssDir; } -void Preferences::setContrastCssDir(const ambulant::net::url* value) +void Preferences::setCustomCssDir(const ambulant::net::url* value) { - mContrastCssDir = *value; + mCustomCssDir = *value; } -const ambulant::net::url* Preferences::getContrastCssDir() +const ambulant::net::url* Preferences::getCustomCssDir() { - return &mContrastCssDir; + return &mCustomCssDir; } -void Preferences::setUserCssFile(const ambulant::net::url* value) +void Preferences::setAmisCssFile(const ambulant::net::url* value) { - mUserCssFile = *value; + mAmisCssFile = *value; } -const ambulant::net::url* Preferences::getUserCssFile() +const ambulant::net::url* Preferences::getAmisCssFile() { - return &mUserCssFile; + return &mAmisCssFile; } void Preferences::setZed2005CssFile(const ambulant::net::url* value) @@ -354,9 +354,9 @@ return &mFontsizeCssFiles; } -amis::UrlList* Preferences::getContrastCssFiles() +amis::UrlList* Preferences::getCustomCssFiles() { - return &mContrastCssFiles; + return &mCustomCssFiles; } amis::StringModuleMap* Preferences::getInstalledLanguages() { @@ -424,8 +424,8 @@ p_log->writeMessage("\tBookmark dir = ", &mUserBmkDir); p_log->writeMessage("\tLangpacks dir = ", &mLangpacksDir); p_log->writeMessage("\tFontsize css dir = ", &mFontsizeCssDir); - p_log->writeMessage("\tContrast css dir = ", &mContrastCssDir); - p_log->writeMessage("\tUser css file = ", &mUserCssFile); + p_log->writeMessage("\tContrast css dir = ", &mCustomCssDir); + p_log->writeMessage("\tUser css file = ", &mAmisCssFile); p_log->writeMessage("\tZed2005 css file = ", &mZed2005CssFile); p_log->writeMessage("\tInstalled language packs:"); @@ -444,9 +444,9 @@ p_log->writeMessage("\t\t", &mFontsizeCssFiles[i]); - p_log->writeMessage("\tContrast CSS files:"); - for (i = 0; i<mContrastCssFiles.size(); i++) - p_log->writeMessage("\t\t", &mContrastCssFiles[i]); + p_log->writeMessage("\tCustom CSS files:"); + for (i = 0; i<mCustomCssFiles.size(); i++) + p_log->writeMessage("\t\t", &mCustomCssFiles[i]); } void Preferences::logUserControllablePreferences() Modified: branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-02-27 20:38:43 UTC (rev 2347) +++ branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-02-27 21:05:06 UTC (rev 2348) @@ -141,7 +141,7 @@ if (mbWaitForDocumentLoad) { mpUserCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet - (Preferences::Instance()->getUserCssFile()); + (Preferences::Instance()->getAmisCssFile()); scanStylesheetForAdditionalData(mpUserCss); MainWndParts::Instance()->mpHtmlView->RedrawWindow(); mbWaitForDocumentLoad = false; @@ -306,7 +306,7 @@ { amis::util::Log::Instance()->writeMessage("HTML contrast turned on", "TextRenderBrain::htmlContrastOn", "AmisGuiMFC2"); mbContrastOn = true; - amis::UrlList* list = Preferences::Instance()->getContrastCssFiles(); + amis::UrlList* list = Preferences::Instance()->getCustomCssFiles(); ambulant::net::url url = (*list)[0]; mpContrastCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet(&url); scanStylesheetForAdditionalData(mpContrastCss); Modified: branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-02-27 20:38:43 UTC (rev 2347) +++ branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-02-27 21:05:06 UTC (rev 2348) @@ -173,11 +173,11 @@ else mpPrefs->setDisableScreensaver(false); } - else if (id.compare("user-css-file") == 0) + else if (id.compare("amis-css-file") == 0) { ambulant::net::url file = ambulant::net::url::from_filename(value); file = file.join_to_base(source_url); - mpPrefs->setUserCssFile(&file); + mpPrefs->setAmisCssFile(&file); } else if (id.compare("zed-2005-css-file") == 0) { @@ -197,11 +197,11 @@ file = file.join_to_base(source_url); mpPrefs->setFontsizeCssDir(&file); } - else if (id.compare("contrast-css-dir") == 0) + else if (id.compare("custom-css-dir") == 0) { ambulant::net::url file = ambulant::net::url::from_filename(value); file = file.join_to_base(source_url); - mpPrefs->setContrastCssDir(&file); + mpPrefs->setCustomCssDir(&file); } else if (id.compare("user-bmk-dir") == 0) { @@ -312,7 +312,7 @@ pEntry = createEntry("was-exit-clean", mpPrefs->getWasExitClean()); pGeneralSection->appendChild((DOMNode*)pEntry); - pEntry = createEntry("user-css-file", mpPrefs->getUserCssFile()->get_file()); + pEntry = createEntry("amis-css-file", mpPrefs->getAmisCssFile()->get_file()); pGeneralSection->appendChild((DOMNode*)pEntry); pEntry = createEntry("zed-2005-css-file", mpPrefs->getZed2005CssFile()->get_file()); @@ -328,7 +328,7 @@ pEntry = createEntry("fontsize-css-dir", mpPrefs->getFontsizeCssDir()->get_file()); pGeneralSection->appendChild((DOMNode*)pEntry); - pEntry = createEntry("contrast-css-dir", mpPrefs->getContrastCssDir()->get_file()); + pEntry = createEntry("custom-css-dir", mpPrefs->getCustomCssDir()->get_file()); pGeneralSection->appendChild((DOMNode*)pEntry); //get a pointer to the root element Modified: branches/amis3/bin/settings/amisPrefs.xml.default =================================================================== --- branches/amis3/bin/settings/amisPrefs.xml.default 2008-02-27 20:38:43 UTC (rev 2347) +++ branches/amis3/bin/settings/amisPrefs.xml.default 2008-02-27 21:05:06 UTC (rev 2348) @@ -15,8 +15,8 @@ <entry id="user-bmk-dir" value="./bmk/"/> <entry id="langpacks-dir" value="./lang/"/> <entry id="fontsize-css-dir" value="./css/font/"/> -<entry id="contrast-css-dir" value="./css/contrast/"/> -<entry id="user-css-file" value="./css/default.css"/> +<entry id="custom-css-dir" value="./css/customStyles/"/> +<entry id="amis-css-file" value="./css/amis.css"/> <entry id="zed-2005-css-file" value="./css/dtbook.2005.basic.css"/> </section> </preferences> Copied: branches/amis3/bin/settings/css/amis.css (from rev 2346, branches/amis3/bin/settings/css/default.css) =================================================================== --- branches/amis3/bin/settings/css/amis.css (rev 0) +++ branches/amis3/bin/settings/css/amis.css 2008-02-27 21:05:06 UTC (rev 2348) @@ -0,0 +1,5 @@ +/*default CSS sheet*/ +/*"amis-highlight" is a reserved word that AMIS will look for to find the highlight colors*/ +/*use the body element selector to specify what font you want, etc. AMIS will pick up the font family for the body element and use it in the sidebar*/ +.amis-highlight {color: white; background-color: green} +body {font-family: arial, verdana, sans-serif;} \ No newline at end of file Copied: branches/amis3/bin/settings/css/customStyles (from rev 2346, branches/amis3/bin/settings/css/contrast) Deleted: branches/amis3/bin/settings/css/default.css =================================================================== --- branches/amis3/bin/settings/css/default.css 2008-02-27 20:38:43 UTC (rev 2347) +++ branches/amis3/bin/settings/css/default.css 2008-02-27 21:05:06 UTC (rev 2348) @@ -1,5 +0,0 @@ -/*default CSS sheet*/ -/*"amis-highlight" is a reserved word that AMIS will look for to find the highlight colors*/ -/*use the body element selector to specify what font you want, etc. AMIS will pick up the font family for the body element and use it in the sidebar*/ -.amis-highlight {color: white; background-color: green} -body {font-family: arial, verdana, sans-serif;} \ 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: <dan...@us...> - 2008-02-28 17:03:39
|
Revision: 2350 http://amis.svn.sourceforge.net/amis/?rev=2350&view=rev Author: daniel_weck Date: 2008-02-28 09:03:34 -0800 (Thu, 28 Feb 2008) Log Message: ----------- - Finally managed to extract the Menu self-voicing code to an external friend class. Compiles and runs fine in both Release and Debug modes. Modified Paths: -------------- branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Dialog.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Label.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/UiItem.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/SkipDialogVoicing.h branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Switch.cpp Added Paths: ----------- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/MenuVoicing.h branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp Modified: branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-02-28 17:03:34 UTC (rev 2350) @@ -186,7 +186,7 @@ bool amis::dtb::nav::NavModel::hasPages() { - if (mpPageList->getLength() > 0) + if (mpPageList != NULL && mpPageList->getLength() > 0) { return true; } Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2008-02-28 17:03:34 UTC (rev 2350) @@ -360,6 +360,9 @@ Name="dialogs" Filter=""> <File + RelativePath=".\include\gui\self-voicing\dialogs\MenuVoicing.h"> + </File> + <File RelativePath=".\include\gui\self-voicing\dialogs\SkipDialogVoicing.h"> </File> </Filter> @@ -1084,6 +1087,21 @@ Name="dialogs" Filter=""> <File + RelativePath=".\src\gui\self-voicing\dialogs\MenuVoicing.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\dialogs\SkipDialogVoicing.cpp"> <FileConfiguration Name="Debug|Win32"> Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -27,21 +27,22 @@ #include "gui/self-voicing/PreTranslateMessageHandler.h" #pragma once -using namespace amis::gui::spoken; - - namespace amis { namespace gui { class CMainFrame : public CMDIFrameWnd { + DECLARE_DYNAMIC(CMainFrame) + + friend class MenuVoicing; + public: CMainFrame(); CMenu* m_lastOpenPopupMenu; - std::string computeRootMenuFromFirstChildID(unsigned int firstItemId, bool playPrompt); PreTranslateMessageHandler* mCommonPreTranslateMessageHandler; + bool mbWasPlayingWhenLostFocus; virtual BOOL PreTranslateMessage(MSG* pMsg); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Action.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -1,7 +1,7 @@ #ifndef ACTION_H #define ACTION_H -#include "../UiMediaTypes.h" +#include "gui/self-voicing/UiMediaTypes.h" #include "UiItem.h" Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Dialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Dialog.h 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Dialog.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -2,7 +2,7 @@ #define DIALOG_H #include "UiItem.h" -#include "../Prompt.h" +#include "gui/self-voicing/Prompt.h" #include "DialogControl.h" Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/DialogControl.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -1,8 +1,8 @@ #ifndef DIALOGCONTROL_H #define DIALOGCONTROL_H -#include "../UiMediaTypes.h" -#include "../Prompt.h" +#include "gui/self-voicing/UiMediaTypes.h" +#include "gui/self-voicing/Prompt.h" #include "UiItem.h" #include "LabelList.h" Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Label.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Label.h 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/Label.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -1,7 +1,7 @@ #ifndef LABEL_H #define LABEL_H -#include "../Prompt.h" +#include "gui/self-voicing/Prompt.h" namespace amis Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/UiItem.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/UiItem.h 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/datamodel/UiItem.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -1,7 +1,7 @@ #ifndef UIITEM_H #define UIITEM_H -#include "../UiMediaTypes.h" +#include "gui/self-voicing/UiMediaTypes.h" #include "Label.h" #include "LabelList.h" Added: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/MenuVoicing.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/MenuVoicing.h (rev 0) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/MenuVoicing.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -0,0 +1,24 @@ + +#include <string> +#include "stdafx.h" + +#include "gui/MainFrm.h" + +namespace amis +{ + namespace gui + { + class MenuVoicing + { + private: + CMainFrame * mFrm; + public: + MenuVoicing(CMainFrame * frm); + ~MenuVoicing(void); + + std::string computeRootMenuFromFirstChildID(unsigned int firstItemId, bool playPrompt); + void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu); + }; + } + +} \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/SkipDialogVoicing.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/SkipDialogVoicing.h 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/dialogs/SkipDialogVoicing.h 2008-02-28 17:03:34 UTC (rev 2350) @@ -1,11 +1,11 @@ #include "gui/dialogs/SkipDialog.h"; -#include "../datamodel/DataTree.h" -#include "../datamodel/Dialog.h" -#include "../datamodel/Switch.h" -#include "../datamodel/Label.h" -#include "../Prompt.h" -#include "../UiMediaTypes.h" +#include "gui/self-voicing/datamodel/DataTree.h" +#include "gui/self-voicing/datamodel/Dialog.h" +#include "gui/self-voicing/datamodel/Switch.h" +#include "gui/self-voicing/datamodel/Label.h" +#include "gui/self-voicing/Prompt.h" +#include "gui/self-voicing/UiMediaTypes.h" namespace amis { Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-28 17:03:34 UTC (rev 2350) @@ -32,6 +32,8 @@ #include "io/BookmarksFileIO.h" #include "io/ToolbarIO.h" #include "util/Log.h" + +#include "gui/self-voicing/dialogs/MenuVoicing.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -78,21 +80,27 @@ static UINT indicators[] = { ID_SEPARATOR, // status line indicator - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, }; + +using namespace amis::gui::spoken; +amis::gui::MenuVoicing* mMenuVoicing; + CMainFrame::CMainFrame() { mbWasPlayingWhenLostFocus = false; m_lastOpenPopupMenu = NULL; mSavedMenu.LoadMenu(IDR_AMISTYPE); mCommonPreTranslateMessageHandler = new PreTranslateMessageHandler(-1); + mMenuVoicing = new amis::gui::MenuVoicing(this); } CMainFrame::~CMainFrame() { delete mCommonPreTranslateMessageHandler; + delete mMenuVoicing; } @@ -154,7 +162,7 @@ } mDefaultRebar.AddBar(&mDefaultToolbar); - + //create the basic toolbar amis::util::Log::Instance()->writeMessage("Loading basic toolbar", "CMainFrame::OnCreate", "AmisGuiMFC2"); toolbar_file = ambulant::net::url::from_filename("./settings/basicToolbar.xml"); @@ -171,7 +179,7 @@ return -1; } mBasicToolbar.EnableToolTips(TRUE); - + //create the basic rebar (toolbar container) if (p_settings->getPlacement() == amis::gui::toolbar::TOP) align = CBRS_TOP; else align = CBRS_BOTTOM; @@ -188,12 +196,12 @@ // Delete these three lines if you don't want the toolbar to be dockable EnableDocking(CBRS_ALIGN_ANY); - #ifdef _SCB_REPLACE_MINIFRAME - m_pFloatingFrameClass = RUNTIME_CLASS(CSCBMiniDockFrameWnd); - #endif +#ifdef _SCB_REPLACE_MINIFRAME + m_pFloatingFrameClass = RUNTIME_CLASS(CSCBMiniDockFrameWnd); +#endif DockControlBar(&mSidebar, AFX_IDW_DOCKBAR_LEFT); - + MainWndParts::Instance()->mpSidebar = &mSidebar; MainWndParts::Instance()->mpStatusBar = &mStatusBar; MainWndParts::Instance()->mpMainFrame = this; @@ -210,7 +218,7 @@ return FALSE; cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE - | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU; + | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU; return TRUE; } @@ -234,384 +242,13 @@ void CMainFrame::OnMenuSelect( UINT nItemID, UINT nFlags, HMENU hSysMenu ) { - USES_CONVERSION; CFrameWnd::OnMenuSelect(nItemID, nFlags, hSysMenu); if (amis::Preferences::Instance()->getIsSelfVoicing() == false) { return; } - - //CMenu* pMenu = DYNAMIC_DOWNCAST(CMenu, (CObject*)hSysMenu); - //TRACE("OnMenuSelect, hSysMenu=%p is %s\n", hSysMenu, ::IsMenu(hSysMenu) ? "HMENU" : pMenu ? "CMenu" : "unknown"); - - bool isSysMenu = false; - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - if (pSysMenu->m_hMenu == hSysMenu) { - TRACE("System Menu !"); - isSysMenu = true; - } - } - - if (isSysMenu) { - //CMenu* p_menu = p_menu->GetSubMenu(nItemID); - CString str; - pSysMenu->GetMenuString(nItemID, str, nFlags); - TRACE(str); - AudioSequence* seq = new AudioSequence; - str.Replace(L"&", L""); - seq->append(str); - AudioSequencePlayer::Instance()->Play(seq); - return; - } - - - if (nItemID) { - // - - CString s; - } - //don't read separators - if (nFlags & MF_SEPARATOR) - { - return; - } - - CString s; - - string prompt; - - - AudioSequence* seq = NULL; - seq = new AudioSequence(); - - if ( nFlags & MF_GRAYED ) - { - PromptItem* promptNotAvailable = DataTree::Instance()->findPromptItem("not_available"); - if (promptNotAvailable != NULL) - { - - AudioSequencePlayer::fillSequenceContents(seq, promptNotAvailable); - } - } - if ( nFlags & MF_POPUP ) - { - if ( nFlags & MF_BYPOSITION ) - { - //AmisBrain::Instance()->playPromptFromUiId(nItemID); - } - if ( nFlags & MF_BYCOMMAND ) - { - //AmisBrain::Instance()->playPromptFromUiId(nItemID); - } - - - if ((nItemID == 8 || nItemID == 2) && m_lastOpenPopupMenu != NULL) { // 8 => "recent" (including separators), 2 => "show section depth" - UINT nID = m_lastOpenPopupMenu->GetMenuItemID(0); - std::string prompt = computeRootMenuFromFirstChildID(nID, false); - - s.Format(_T("\n{{{ %d"), nItemID); //DAN_MENU_DEBUG - TRACE(s); - TRACE(prompt.c_str()); - - if (prompt.compare("file") == 0 || prompt.compare("recentBooksList") == 0) { - seq = AudioSequencePlayer::playContainerPromptFromId("recentBooksList", false, seq); - - PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); - - if (p_prompt_ != NULL) - { - AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); - } - else { - seq->append(_T("menu")); - } - - AudioSequencePlayer::Instance()->Play(seq); - } else if (prompt.compare("navigate") == 0 || prompt.compare("sectiondepth") == 0) { - seq = AudioSequencePlayer::playContainerPromptFromId("sectiondepth", false, seq); - - PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); - - if (p_prompt_ != NULL) - { - AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); - } - else { - seq->append(_T("menu")); - } - AudioSequencePlayer::Instance()->Play(seq); - } 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 && - - switch (nItemID) { - case 0: - seq = AudioSequencePlayer::playContainerPromptFromId("file", false, seq); - break; - case 1: - seq = AudioSequencePlayer::playContainerPromptFromId("view", false, seq); - break; - case 2: - seq = AudioSequencePlayer::playContainerPromptFromId("play", false, seq); - break; - case 3: - seq = AudioSequencePlayer::playContainerPromptFromId("navigate", false, seq); - break; - case 4: - seq = AudioSequencePlayer::playContainerPromptFromId("bookmarks", false, seq); - break; - case 5: - seq = AudioSequencePlayer::playContainerPromptFromId("info", false, seq); - break; - case 6: - seq = AudioSequencePlayer::playContainerPromptFromId("help", false, seq); - break; - //default: seq = new AudioSequence(); - } - PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); - - if (p_prompt_ != NULL) - { - AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); - } - else { - if (seq != NULL) { - seq->append(_T("menu")); - } - } - - if (seq != NULL) { - AudioSequencePlayer::Instance()->Play(seq); - } - } - } - else - { - s.Format(_T("Item %d is selected"), nItemID); //DAN_MENU_DEBUG - TRACE(s); - - -amis::RecentBooks* books = theApp.getRecentBooks(); -int nRecentBooks = (books ? books->getNumberOfEntries() : 0); - -if (nRecentBooks > 0 && (nItemID >= BOOK_BASE_ID && nItemID < BOOK_BASE_ID + nRecentBooks)) - { - int idx = nItemID - BOOK_BASE_ID; - -amis::RecentBookEntry* p_entry = theApp.getRecentBooks()->getEntry(idx); - -//DanTodo: surely, there must be a way to get a title instead of rendering the URL with TTS ??! (see bookmark methd commented below) -string str = p_entry->mPath.get_url(); - seq->append(A2T(str.c_str())); - AudioSequencePlayer::Instance()->Play(seq); - - //CString cstr_filepath = A2T(filepath.c_str()); - - /* -amis::io::BookmarksFileIO bmk_file_io; -bmk_file_io.readFromFile(&p_entry->mPath); - - amis::MediaGroup* p_title = NULL; - p_title = bmk_file_io.getBookmarkSet()->getTitle(); - - if (p_title != NULL) - { - if (p_title->hasAudio() == true) - { - amis::AudioNode* p_audio = NULL; - p_audio = (amis::AudioNode*)p_title->getAudio(0)->clone(); - if (p_audio != NULL) - { - seq->append(p_audio); - AudioSequencePlayer::Instance()->Play(seq); - - } - - - }else if (p_title->hasText() == true) - { -amis::TextNode* p_text = NULL; -p_text = p_title->getText(); - if (p_text != NULL) - { - wstring str = p_text->getTextString(); - seq->append(str.c_str()); - AudioSequencePlayer::Instance()->Play(seq); - } - - - } - - } */ - } -else - if (nItemID >= BOOKMARKS_BASE_ID && nItemID <= - BOOKMARKS_BASE_ID + MAX_ANYTHING) - { - int idx = nItemID - BOOKMARKS_BASE_ID; - - - //amis::dtb::BookmarkSet* p_bmks = amis::dtb::DtbWithHooks::Instance()->getBookmarks(); - //amis::dtb::PositionMark* p_mark = p_bmks->getItem(idx); - - amis::MediaGroup* p_note = amis::dtb::DtbWithHooks::Instance()->getBookmarks()->getItem(idx)->mpNote; - if (p_note!=NULL) - { - - if (p_note->hasAudio() == true) - { - amis::AudioNode* p_audio = NULL; - p_audio = p_note->getAudio(0); - if (p_audio != NULL) - { - seq->append(p_audio); - AudioSequencePlayer::Instance()->Play(seq); - } - } else if (p_note->hasText() == true) - { - //DanTodo: bmks generally have no audio, so how can we use the existing (open) book content to render audio voice here ? -amis::TextNode* p_text = NULL; -p_text = p_note->getText(); - if (p_text != NULL) - { - wstring str = p_text->getTextString(); - seq->append(str.c_str()); - AudioSequencePlayer::Instance()->Play(seq); - } - - - } - - } - } else - -if (nItemID > SECTION_DEPTH_BASE_ID && nItemID <= (SECTION_DEPTH_BASE_ID + MAX_ANYTHING)) - { - string strPrompt; - switch (nItemID) { - case (SECTION_DEPTH_BASE_ID+1): { - strPrompt = "numeric_one"; - break; - } - case (SECTION_DEPTH_BASE_ID+2): { - strPrompt = "numeric_two"; - break; - } - case (SECTION_DEPTH_BASE_ID+3): { - strPrompt = "numeric_three"; - break; - } - case (SECTION_DEPTH_BASE_ID+4): { - strPrompt = "numeric_four"; - break; - } - case (SECTION_DEPTH_BASE_ID+5): { - strPrompt = "numeric_five"; - break; - } - case (SECTION_DEPTH_BASE_ID+6): { - strPrompt = "numeric_six"; - break; - } - case (SECTION_DEPTH_BASE_ID+7): { - strPrompt = "numeric_seven"; - break; - } - case (SECTION_DEPTH_BASE_ID+8): { - strPrompt = "numeric_eight"; - break; - } - case (SECTION_DEPTH_BASE_ID+9): { - strPrompt = "numeric_nine"; - break; - } - } - if (!strPrompt.empty()) { - //seq->append(strPrompt.c_str()); TEST ONLY - - delete seq; - seq = AudioSequencePlayer::playPromptItemFromStringId(strPrompt, false, NULL); - - AudioSequencePlayer::Instance()->Play(seq); - } - - } - - - /* - - //is this a view menu item (sections/prodnotes/etc) - else if (nItemID >= VIEW_MENU_BASE_ID && nItemID < VIEW_MENU_BASE_ID + - MenuManip::Instance()->getNumberOfViewMenuAdditions()) - { - //first item in the list is always "sections" - if (nItemID == VIEW_MENU_BASE_ID) - { - //playPrompt("sections"); - theApp.playPromptItemFromStringId("sections"); - } - //then "pages", if exists - else if (nItemID == VIEW_MENU_BASE_ID + 1 && - NavParse::Instance()->getNavModel()->hasPages() == true) - { - //playPrompt("pages"); - theApp.playPromptItemFromStringId("pages"); - } - else - { - //otherwise it's a nav list so ask NavParse for the nav list ID - //subtract 1 because the menu items include sections, pages, navlists - //we want just the index relative to nav lists - int idx = nItemID - VIEW_MENU_BASE_ID - 1; - - //adjust again by subtracting 1 if there are pages in this book - if (NavParse::Instance()->getNavModel()->hasPages() == true) - { - idx--; - } - - std::string item_id = NavParse::Instance()->getNavModel()->getNavList(idx)->getId(); - - if (item_id.compare("prodnote") == 0 || - item_id.compare("optional-prodnote") == 0 ) - { - //playPrompt("prodnotes"); - theApp.playPromptItemFromStringId("prodnotes"); - } - else if (item_id.compare("sidebar") == 0) - { - //playPrompt("sidebars"); - theApp.playPromptItemFromStringId("sidebars"); - } - else if (item_id.compare("footnote") == 0 || - item_id.compare("noteref") == 0) - { - //playPrompt("footnotes"); - theApp.playPromptItemFromStringId("noterefs"); - } - else - { - //we can't identify it, so read its name with TTS - theApp.playPromptFromUiId(nItemID); - } - } - - } - else - */ - -else - { - AudioSequencePlayer::playPromptFromUiId(nItemID, true, seq); - - - } - - } + mMenuVoicing->OnMenuSelect(nItemID, nFlags, hSysMenu); } void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) @@ -620,13 +257,6 @@ CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); -if (amis::Preferences::Instance()->getIsSelfVoicing() == false) - { - return; - } - - TRACE(_T("XXXXXXX 3: on init menu popup\n")); //DAN_MENU_DEBUG - USES_CONVERSION; if (pPopupMenu == NULL) @@ -637,24 +267,24 @@ CString dbg; CString tmpstr; - + UINT nID = pPopupMenu->GetMenuItemID(0); dbg.Format(_T("\tThis popup menu's first item's ID = %d \n"), nID); TRACE(dbg); dbg.Format(_T("\t---------- This popup menu's INDEX = %d \n"), nIndex); TRACE(dbg); - + std::string prompt; //prompt = PromptsGuiIds::Instance()->lookupPromptMenuPopup(nID); - prompt = computeRootMenuFromFirstChildID(nID, false); //Preferences::Instance()->mbIsSelfVoicing); - - tmpstr = A2T(prompt.c_str()); - dbg.Format(_T("\tPrompt for this popup 1 = --%s-- \n"), tmpstr); //DAN_MENU_DEBUG - TRACE(dbg); + prompt = mMenuVoicing->computeRootMenuFromFirstChildID(nID, false); //Preferences::Instance()->mbIsSelfVoicing); - + 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) { @@ -669,7 +299,7 @@ } } - //if this is the play menu, decide if slowdown should be available or not + //TODO should this be the book speed ? if (prompt.compare("play") == 0) { if (AmisAudio::Instance()->getRate() == 1.0) @@ -679,59 +309,21 @@ } else { - + //DanToDo: menu items for slow-down / fast-up //MenuManip::Instance()->setSlowdown(true); } } - -} -void CMainFrame::OnInitMenu(CMenu* pMenu) -{ - //m_OpenMenu = pMenu; - CMDIFrameWnd::OnInitMenu(pMenu); - -if (amis::Preferences::Instance()->getIsSelfVoicing() == false) + if (amis::Preferences::Instance()->getIsSelfVoicing() == false) { return; } +} - TRACE(_T("XXXXXXX 2: on init menu\n")); //DAN_MENU_DEBUG - if (pMenu != NULL) - { - int cMenuCount = pMenu->GetMenuItemCount( ); - // Get number of menu - // Items - - for(int i=0 ; i < cMenuCount ; i++) { - //pMenu->DeleteMenu( i, MF_BYPOSITION ); - ; - } - -//MENUITEMINFO* pMenuItemInfo; -//GetMenuInfo(pMenu->GetSafeHmenu(),pMenuItemInfo); - - //pMenu->DeleteMenu(3, MF_BYPOSITION); - - /* - //DanToDo: Arghhh !!! The IDE tells me everything is fine, but the compiler cannot find MENUINFO and tells me: - //error C2039: 'GetMenuInfo' : is not a member of 'CMenu' - //Stupid bloody VisualC++ !!!!!!! - - MENUINFO menuinfo; - pMenu->GetMenuInfo(&menuinfo); - - CString dbg; - UINT nID = pMenu->GetMenuItemID(0); - dbg.Format(_T("\tINIT MENU ... This popup menu's first item's ID = %d \n"), nID); - TRACE(dbg); - */ - - //std::string prompt; - //prompt = PromptsGuiIds::Instance()->lookupPromptMenuPopup(nID); - } - +void CMainFrame::OnInitMenu(CMenu* pMenu) +{ + CMDIFrameWnd::OnInitMenu(pMenu); } @@ -739,52 +331,42 @@ { CMDIFrameWnd::OnEnterMenuLoop(bIsTrackPopupMenu); -if (amis::Preferences::Instance()->getIsSelfVoicing() == false) + if (amis::Preferences::Instance()->getIsSelfVoicing() == false) { return; } - - MmView *view = MainWndParts::Instance()->mpMmView; assert(view); // XXXJack: or what to do if view == NULL? Skip? - - - bool b_BookIsPlaying = view->isPlaying(); // BOOK Audio Player - mbWasPlayingWhenLostFocus = b_BookIsPlaying; - if (mbWasPlayingWhenLostFocus) - { - MmView *view = MainWndParts::Instance()->mpMmView; - assert(view); // XXXJack: or what to do if view == NULL? Skip? - view->OnFilePause(); - //view->OnFilePlay(); - } - - TRACE(_T("zzzzzzzz : on ENTER menu loop!\n")); //DAN_MENU_DEBUG + if (view==NULL) {return;} + bool b_BookIsPlaying = view->isPlaying(); // BOOK Audio Player + mbWasPlayingWhenLostFocus = b_BookIsPlaying; + if (mbWasPlayingWhenLostFocus) + { + view->OnFilePause(); + } } void CMainFrame::OnExitMenuLoop(BOOL bIsTrackPopupMenu) { CMDIFrameWnd::OnExitMenuLoop(bIsTrackPopupMenu); -if (amis::Preferences::Instance()->getIsSelfVoicing() == false) + if (amis::Preferences::Instance()->getIsSelfVoicing() == false) { return; } - AudioSequencePlayer::Instance()->Stop(); + AudioSequencePlayer::Instance()->Stop(); - if (mbWasPlayingWhenLostFocus) { - - MmView *view = MainWndParts::Instance()->mpMmView; - assert(view); // XXXJack: or what to do if view == NULL? Skip? - //view->OnFilePause(); - view->OnFilePlay(); - } - mbWasPlayingWhenLostFocus = false; - + if (mbWasPlayingWhenLostFocus) { - TRACE(_T("zzzzzzzz : on EXIT menu loop!\n")); //DAN_MENU_DEBUG + MmView *view = MainWndParts::Instance()->mpMmView; + assert(view); // XXXJack: or what to do if view == NULL? Skip? + if (view==NULL) {return;} + view->OnFilePlay(); + } + mbWasPlayingWhenLostFocus = false; + m_lastOpenPopupMenu = NULL; } @@ -799,135 +381,52 @@ return CFrameWnd::PreTranslateMessage(pMsg); } -//todo: replace this by something like: -// Container* container = DataTree::Instance()->findContainerWhichHasFirstItem(id) -// container.id -std::string CMainFrame::computeRootMenuFromFirstChildID(unsigned int firstItemId, bool playPrompt) +void CMainFrame::OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized ) { - - CString dbg; - dbg.Format(_T("\n===firstItemId %d####\n"), firstItemId); - TRACE(dbg); - - string str_id; - - if (firstItemId == ID_MENU_FILE_OPEN) + CWnd::OnActivate( nState, pWndOther, bMinimized ); + //TODO: focus lost detection doesn't work when a modal dialog is used on top of the main application window. + // The consequence is that the book is stopped anyway because modal dialogs stop book audio by default, + // and the dialog-related speech doesn't stop. + if (Preferences::Instance()->getPauseOnLostFocus() == true) { - str_id = "file"; - } - else if (firstItemId == ID_FILE_RECENT_EMPTY || - firstItemId == BOOK_BASE_ID) { - str_id = "recentBooksList"; - } - else if(firstItemId == ID_MENU_VIEW_SIDEBAR_ONOFF) - { - str_id = "view"; - } - else if(firstItemId == ID_MENU_PLAYPAUSE) - { - str_id = "play"; - } - else if(firstItemId == ID_MENU_NAV_PREVSECTION) - { - str_id = "navigate"; - } - else if(firstItemId == ID_EMPTY || - firstItemId == SECTION_DEPTH_BASE_ID + 1) - { - str_id = "sectiondepth"; - } + MmView *view = MainWndParts::Instance()->mpMmView; + assert(view); // XXXJack: or what to do if view == NULL? Skip? - else if(firstItemId == ID_MENU_BMK_ADD) - { - str_id = "bookmarks"; - } - - else if(firstItemId == ID_MENU_INFO_SKIP) - { - str_id = "info"; - } - else if(firstItemId == ID_MENU_HELP_CONTENTS) - { - str_id = "help"; - } - else - { - str_id = ""; - } - if (!str_id.empty()) { - - if (playPrompt) { - AudioSequence* seq = AudioSequencePlayer::playContainerPromptFromId(str_id, false); - - PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); - - if (p_prompt_ != NULL) - { - AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); - } - else { - seq->append(_T("menu")); - } - - AudioSequencePlayer::Instance()->Play(seq); + if (view=NULL) { + return; } - } + if ( nState == WA_INACTIVE ) { + if ( ! AfxGetMainWnd()->IsChild(pWndOther) ) { - return str_id; -} -void CMainFrame::OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized ) -{ - CWnd::OnActivate( nState, pWndOther, bMinimized ); - //TODO: focus lost detection doesn't work when a modal dialog is used on top of the main application window. - // The consequence is that the book is stopped anyway because modal dialogs stop book audio by default, - // and the dialog-related speech doesn't stop. - if (Preferences::Instance()->getPauseOnLostFocus() == true) - { - if ( nState == WA_INACTIVE ) { - if ( ! AfxGetMainWnd()->IsChild(pWndOther) ) { + bool b_BookIsPlaying = view->isPlaying(); // BOOK Audio Player - - MmView *view = MainWndParts::Instance()->mpMmView; - assert(view); // XXXJack: or what to do if view == NULL? Skip? + //mbWasPlayingWhenLostFocus = b_BookIsPlaying || b_GuiIsPlaying; + mbWasPlayingWhenLostFocus = b_BookIsPlaying; - bool b_BookIsPlaying = view->isPlaying(); // BOOK Audio Player + if (mbWasPlayingWhenLostFocus) + { + view->OnFilePause(); - //mbWasPlayingWhenLostFocus = b_BookIsPlaying || b_GuiIsPlaying; - mbWasPlayingWhenLostFocus = b_BookIsPlaying; + if (amis::Preferences::Instance()->getIsSelfVoicing() == true) + { + AudioSequencePlayer::Instance()->Stop(); + } + } + } + } else { //WA_ACTIVE + if (mbWasPlayingWhenLostFocus) { - if (mbWasPlayingWhenLostFocus) - { - - MmView *view = MainWndParts::Instance()->mpMmView; - assert(view); // XXXJack: or what to do if view == NULL? Skip? - view->OnFilePause(); - //view->OnFilePlay(); - -if (amis::Preferences::Instance()->getIsSelfVoicing() == true) - { - AudioSequencePlayer::Instance()->Stop(); - } + view->OnFilePlay(); - + if (amis::Preferences::Instance()->getIsSelfVoicing() == true) + { + AudioSequencePlayer::Instance()->RepeatLast(); + } } + mbWasPlayingWhenLostFocus = false; } - } else { //WA_ACTIVE - if (mbWasPlayingWhenLostFocus) { - - MmView *view = MainWndParts::Instance()->mpMmView; - assert(view); // XXXJack: or what to do if view == NULL? Skip? - //view->OnFilePause(); - view->OnFilePlay(); - -if (amis::Preferences::Instance()->getIsSelfVoicing() == true) - { - AudioSequencePlayer::Instance()->RepeatLast(); } - } - mbWasPlayingWhenLostFocus = false; - } - } } //stop the screensaver from starting void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-02-28 17:03:34 UTC (rev 2350) @@ -51,7 +51,7 @@ SkipDialog::~SkipDialog() { - if (Preferences::Instance()->getIsSelfVoicing() == true) + if (mpSkipDialogVoicing != NULL) { delete mpSkipDialogVoicing; } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Switch.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Switch.cpp 2008-02-27 23:10:17 UTC (rev 2349) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Switch.cpp 2008-02-28 17:03:34 UTC (rev 2350) @@ -1,7 +1,6 @@ #include "gui/self-voicing/datamodel/Switch.h" #include "../../AmisGuiMFC2/resource.h" -//#include "../AudioAudio/AmisAudio.h" #include <fstream> Added: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp (rev 0) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-02-28 17:03:34 UTC (rev 2350) @@ -0,0 +1,500 @@ +#include "../../../../resource.h" +#include "gui/self-voicing/datamodel/DataTree.h" +#include "gui/self-voicing/datamodel/Dialog.h" +#include "gui/self-voicing/datamodel/Switch.h" +#include "gui/self-voicing/datamodel/Label.h" +#include "gui/self-voicing/Prompt.h" +#include "gui/self-voicing/UiMediaTypes.h" +#include "RecentBooks.h" +#include "gui/self-voicing/dialogs/menuvoicing.h" +#include "gui/self-voicing/audiosequenceplayer.h" +#include "DtbWithHooks.h" +#include "gui/AmisApp.h" +#include "gui/MainWndParts.h" + +namespace amis +{ + namespace gui + { + MenuVoicing::MenuVoicing(CMainFrame * frm) + { + mFrm= frm; + } + + MenuVoicing::~MenuVoicing(void) + { + + } + + //todo: replace this by something like: + // Container* container = DataTree::Instance()->findContainerWhichHasFirstItem(id) + // container.id + std::string MenuVoicing::computeRootMenuFromFirstChildID(unsigned int firstItemId, bool playPrompt) + { + + CString dbg; + dbg.Format(_T("\n===firstItemId %d####\n"), firstItemId); + TRACE(dbg); + + string str_id; + + if (firstItemId == ID_MENU_FILE_OPEN) + { + str_id = "file"; + } + else if (firstItemId == ID_FILE_RECENT_EMPTY || + firstItemId == BOOK_BASE_ID) { + str_id = "recentBooksList"; + } + else if(firstItemId == ID_MENU_VIEW_SIDEBAR_ONOFF) + { + str_id = "view"; + } + else if(firstItemId == ID_MENU_PLAYPAUSE) + { + str_id = "play"; + } + else if(firstItemId == ID_MENU_NAV_PREVSECTION) + { + str_id = "navigate"; + } + else if(firstItemId == ID_EMPTY || + firstItemId == SECTION_DEPTH_BASE_ID + 1) + { + str_id = "sectiondepth"; + } + + else if(firstItemId == ID_MENU_BMK_ADD) + { + str_id = "bookmarks"; + } + + else if(firstItemId == ID_MENU_INFO_SKIP) + { + str_id = "info"; + } + else if(firstItemId == ID_MENU_HELP_CONTENTS) + { + str_id = "help"; + } + else + { + str_id = ""; + } + if (!str_id.empty()) { + + if (playPrompt) { + AudioSequence* seq = AudioSequencePlayer::playContainerPromptFromId(str_id, false); + + PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); + } + else { + seq->append(_T("menu")); + } + + AudioSequencePlayer::Instance()->Play(seq); + } + } + + return str_id; + } + + + void MenuVoicing::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu) + { + + USES_CONVERSION; + + //CMenu* pMenu = DYNAMIC_DOWNCAST(CMenu, (CObject*)hSysMenu); + //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); + if (pSysMenu != NULL) + { + if (pSysMenu == hSysMenu) { + TRACE("System Menu !"); + isSysMenu = true; + } + } + + if (isSysMenu) { + //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) { + + CString str; + + //pSysMenu->GetMenuString(nItemID, str, nFlags); + //TRACE(str); + str.Append(lpszText); + + str.Replace(L"&", L""); + + //str.Replace(CString("&"), CString("")); + + AudioSequence* seq = new AudioSequence; + seq->append(str); + AudioSequencePlayer::Instance()->Play(seq); + + + } + } + return; + } + + + if (nItemID) { + // + + CString s; + } + //don't read separators + if (nFlags & MF_SEPARATOR) + { + return; + } + + CString s; + + string prompt; + + + AudioSequence* seq = NULL; + seq = new AudioSequence(); + + if ( nFlags & MF_GRAYED ) + { + PromptItem* promptNotAvailable = DataTree::Instance()->findPromptItem("not_available"); + if (promptNotAvailable != NULL) + { + + AudioSequencePlayer::fillSequenceContents(seq, promptNotAvailable); + } + } + if ( nFlags & MF_POPUP ) + { + if ( nFlags & MF_BYPOSITION ) + { + //AmisBrain::Instance()->playPromptFromUiId(nItemID); + } + if ( nFlags & MF_BYCOMMAND ) + { + //AmisBrain::Instance()->playPromptFromUiId(nItemID); + } + + + if ((nItemID == 8 || nItemID == 2) && mFrm->m_lastOpenPopupMenu != NULL) { // 8 => "recent" (including separators), 2 => "show section depth" + UINT nID = mFrm->m_lastOpenPopupMenu->GetMenuItemID(0); + std::string prompt = computeRootMenuFromFirstChildID(nID, false); + + s.Format(_T("\n{{{ %d"), nItemID); //DAN_MENU_DEBUG + TRACE(s); + TRACE(prompt.c_str()); + + if (prompt.compare("file") == 0 || prompt.compare("recentBooksList") == 0) { + seq = AudioSequencePlayer::playContainerPromptFromId("recentBooksList", false, seq); + + PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); + } + else { + seq->append(_T("menu")); + } + + AudioSequencePlayer::Instance()->Play(seq); + } else if (prompt.compare("navigate") == 0 || prompt.compare("sectiondepth") == 0) { + seq = AudioSequencePlayer::playContainerPromptFromId("sectiondepth", false, seq); + + PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); + } + else { + seq->append(_T("menu")); + } + AudioSequencePlayer::Instance()->Play(seq); + } 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 && + + switch (nItemID) { + case 0: + seq = AudioSequencePlayer::playContainerPromptFromId("file", false, seq); + break; + case 1: + seq = AudioSequencePlayer::playContainerPromptFromId("view", false, seq); + break; + case 2: + seq = AudioSequencePlayer::playContainerPromptFromId("play", false, seq); + break; + case 3: + seq = AudioSequencePlayer::playContainerPromptFromId("navigate", false, seq); + break; + case 4: + seq = AudioSequencePlayer::playContainerPromptFromId("bookmarks", false, seq); + break; + case 5: + seq = AudioSequencePlayer::playContainerPromptFromId("info", false, seq); + break; + case 6: + seq = AudioSequencePlayer::playContainerPromptFromId("help", false, seq); + break; + //default: seq = new AudioSequence(); + } + PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); + } + else { + if (seq != NULL) { + seq->append(_T("menu")); + } + } + + if (seq != NULL) { + AudioSequencePlayer::Instance()->Play(seq); + } + } + } + else + { + s.Format(_T("Item %d is selected"), nItemID); //DAN_MENU_DEBUG + TRACE(s); + + + amis::RecentBooks* books = theApp.getRecentBooks(); + int nRecentBooks = (books ? books->getNumberOfEntries() : 0); + + if (nRecentBooks > 0 && (nItemID >= BOOK_BASE_ID && nItemID < BOOK_BASE_ID + nRecentBooks)) + { + int idx = nItemID - BOOK_BASE_ID; + + amis::RecentBookEntry* p_entry = theApp.getRecentBooks()->getEntry(idx); + + //DanTodo: surely, there must be a way to get a title instead of rendering the URL with TTS ??! (see bookmark methd commented below) + string str = p_entry->mPath.get_url(); + seq->append(A2T(str.c_str())); + AudioSequencePlayer::Instance()->Play(seq); + + //CString cstr_filepath = A2T(filepath.c_str()); + + /* + amis::io::BookmarksFileIO bmk_file_io; + bmk_file_io.readFromFile(&p_entry->mPath); + + amis::MediaGroup* p_title = NULL; + p_title = bmk_file_io.getBookmarkSet()->getTitle(); + + if (p_title != NULL) + { + if (p_title->hasAudio() == true) + { + amis::AudioNode* p_audio = NULL; + p_audio = (amis::AudioNode*)p_title->getAudio(0)->clone(); + if (p_audio != NULL) + { + seq->append(p_audio); + AudioSequencePlayer::Instance()->Play(seq); + + } + + + }else if (p_title->hasText() == true) + { + amis::TextNode* p_text = NULL; + p_text = p_title->getText(); + if (p_text != NULL) + { + wstring str = p_text->getTextString(); + seq->append(str.c_str()); + AudioSequencePlayer::Instance()->Play(seq); + } + + + } + + } */ + } + else + if (nItemID >= BOOKMARKS_BASE_ID && nItemID <= + BOOKMARKS_BASE_ID + MAX_ANYTHING) + { + int idx = nItemID - BOOKMARKS_BASE_ID; + + + //amis::dtb::BookmarkSet* p_bmks = amis::dtb::DtbWithHooks::Instance()->getBookmarks(); + //amis::dtb::PositionMark* p_mark = p_bmks->getItem(idx); + + amis::MediaGroup* p_note = amis::dtb::DtbWithHooks::Instance()->getBookmarks()->getItem(idx)->mpNote; + if (p_note!=NULL) + { + + if (p_note->hasAudio() == true) + { + amis::AudioNode* p_audio = NULL; + p_audio = p_note->getAudio(0); + if (p_audio != NULL) + { + seq->append(p_audio); + AudioSequencePlayer::Instance()->Play(seq); + } + } else if (p_note->hasText() == true) + { + //DanTodo: bmks generally have no audio, so how can we use the existing (open) book content to render audio voice here ? + amis::TextNode* p_text = NULL; + p_text = p_note->getText(); + if (p_text != NULL) + { + wstring str = p_text->getTextString(); + seq->append(str.c_str()); + AudioSequencePlayer::Instance()->Play(seq); + } + + + } + + } + } else + + if (nItemID > SECTION_DEPTH_BASE_ID && nItemID <= (SECTION_DEPTH_BASE_ID + MAX_ANYTHING)) + { + string strPrompt; + switch (nItemID) { + case (SECTION_DEPTH_BASE_ID+1): { + strPrompt = "numeric_one"; + break; + } + case (SECTION_DEPTH_BASE_ID+2): { + strPrompt = "numeric_two"; + break; + } + case (SECTION_DEPTH_BASE_ID+3): { + strPrompt = "numeric_three"; + break; + } + case (SECTION_DEPTH_BASE_ID+4): { + strPrompt = "numeric_four"; + break; + } + case (SECTION_DEPTH_BASE_ID+5): { + strPrompt = "numeric_five"; + break; + } + case (SECTION_DEPTH_BASE_ID+6): { + strPrompt = "numeric_six"; + break; + } + case (SECTION_DEPTH_BASE_ID+7): { + strPrompt = "numeric_seven"; + break; + } + case (SECTION_DEPTH_BASE_ID+8): { + strPrompt = "numeric_eight"; + break; + } + case (SECTION_DEPTH_BASE_ID+9): { + strPrompt = "numeric_nine"; + break; + } + } + if (!strPrompt.empty()) { + //seq->append(strPrompt.c_str()); TEST ONLY + + delete seq; + seq = AudioSequencePlayer::playPromptItemFromStringId(strPrompt, false, NULL); + + AudioSequencePlayer::Instance()->Play(seq); + } + + } + + + /* + + //is this a view menu item (sections/prodnotes/etc) + else if (nItemID >= VIEW_MENU_BASE_ID && nItemID < VIEW_MENU_BASE_ID + + MenuManip::Instance()->getNumberOfViewMenuAdditions()) + { + //first item in the list is always "sections" + if (nItemID == VIEW_MENU_BASE_ID) + { + //playPrompt("sections"); + theApp.playPromptItemFromStringId("sections"); + } + //then "pages", if exists + else if (nItemID == VIEW_MENU_BASE_ID + 1 && + NavParse::Instance()->getNavModel()->hasPages() == true) + { + //playPrompt("pages"); + theApp.playPromptItemFromStringId("pages"); + } + else + { + //otherwise it's a nav list so ask NavParse for the nav list ID + //subtract 1 because the menu items include sections, pages, navlists + //we want just the index relative to nav lists + int idx = nItemID - VIEW_MENU_BASE_ID - 1; + + //adjust again by subtracting 1 if there are pages in this book + if (NavParse::Instance()->getNavModel()->hasPages() == true) + { + idx--; + } + + std::string item_id = NavParse::Instance()->getNavModel()->getNavList(idx)->getId(); + + if (item_id.compare("prodnote") == 0 || + item_id.compare("optional-prodnote") == 0 ) + { + //playPrompt("prodnotes"); + theApp.playPromptItemFromStringId("prodnotes"); + } + else if (item_id.compare("sidebar") == 0) + { + //playPrompt("sidebars"); + theApp.playPromptItemFromStringId("sidebars"); + } + else if (item_id.compare("footnote") == 0 || + item_id.compare("noteref") == 0) + { + //playPrompt("footnotes"); + theApp.playPromptItemFromStringId("noterefs"); + } + else + { + //we can't identify it, so read its name with TTS + theApp.playPromptFromUiId(nItemID); + } + } + + } + else + */ + + else + { + AudioSequencePlayer::playPromptFromUiId(nItemID, true, seq); + } + } + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-02-28 23:13:05
|
Revision: 2352 http://amis.svn.sourceforge.net/amis/?rev=2352&view=rev Author: marisademeglio Date: 2008-02-28 15:13:10 -0800 (Thu, 28 Feb 2008) Log Message: ----------- Improvements to prev/next section and prev/next page. Still needs testing with DAISY 2005 books. Previous section known to be buggy. Modified Paths: -------------- branches/amis3/AmisCore/include/dtb/Dtb.h branches/amis3/AmisCore/include/dtb/nav/NavModel.h branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp Modified: branches/amis3/AmisCore/include/dtb/Dtb.h =================================================================== --- branches/amis3/AmisCore/include/dtb/Dtb.h 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisCore/include/dtb/Dtb.h 2008-02-28 23:13:10 UTC (rev 2352) @@ -38,7 +38,7 @@ namespace dtb { typedef bool (*ProtectedBookKeyHandlerFunctionPtr)(const ambulant::net::url*, const ambulant::net::url*); -enum DaisyVersion {UNDEFINED, DAISY_202, ZED_2002, ZED_2005}; +enum DaisyVersion {UNSUPPORTED, DAISY_202, DAISY_2005}; class Dtb { public: @@ -51,10 +51,7 @@ amis::dtb::smil::SmilMediaGroup* nextPhrase(); amis::dtb::smil::SmilMediaGroup* previousPhrase(); amis::dtb::smil::SmilMediaGroup* loadSmilFromUrl(ambulant::net::url*); - amis::dtb::Bookmark* addBookmark(amis::MediaGroup*); - //void loadFromBookmark(amis::Bookmark*); - amis::MediaGroup* getTitle(); amis::dtb::Metadata* getMetadata(); amis::dtb::Spine* getSpine(); @@ -69,9 +66,9 @@ amis::dtb::smil::SmilTree* getSmilTree(); string searchFullTextNext(); string searchFullTextPrevious(); - void setNewLastmark(ambulant::net::url); ambulant::net::url calculateUriOfData(amis::dtb::smil::SmilMediaGroup*); + amis::dtb::nav::NavNode* getCurrentNavNode(); amis::dtb::DaisyVersion getDaisyVersion(); bool isProtected(); @@ -106,6 +103,7 @@ string mLastSearchedTextFile; amis::util::SearchForFiles* mpFileSearcher; amis::dtb::DaisyVersion mDaisyVersion; + amis::dtb::nav::NavNode* mpCurrentNavNode; bool mbIsProtected; ProtectedBookKeyHandlerFunctionPtr mpCallbackForPreprocessingBookKey; }; Modified: branches/amis3/AmisCore/include/dtb/nav/NavModel.h =================================================================== --- branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-02-28 23:13:10 UTC (rev 2352) @@ -57,7 +57,10 @@ NavNode* getNodeForSmilId(string, NavContainer*); void setSmilIdNodeMap(NodeRefMap*); void testMap(); - + NavPoint* previousSection(int); + NavPoint* nextSection(int); + PageTarget* previousPage(int); + PageTarget* nextPage(int); //add a node to the big ordered list. the node will not necessarily be next in sequence. void addToPlayOrderList(NavNode*); private: Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-02-28 23:13:10 UTC (rev 2352) @@ -52,7 +52,7 @@ mpCustomTests = NULL; mpFileSearcher = NULL; mUid.erase(); - mDaisyVersion = UNDEFINED; + mDaisyVersion = UNSUPPORTED; mpCallbackForPreprocessingBookKey = NULL; } //destructor @@ -100,7 +100,7 @@ mpTextSmilMap = NULL; mpCustomTests = NULL; mUid.erase(); - mDaisyVersion = UNDEFINED; + mDaisyVersion = UNSUPPORTED; } amis::MediaGroup* amis::dtb::Dtb::getTitle() @@ -168,6 +168,7 @@ mpFiles->initWithNccOrOpf(fileUrl, mpFileSearcher); mpFiles->setBookmarksDirectory(bookmarksDirectory); + mpCurrentNavNode = NULL; if (DtbFileSet::isNccFile(fileUrl)) { amis::util::Log::Instance()->writeMessage("This is a DAISY 2.02 book", "Dtb::open", "AmisCore"); @@ -179,16 +180,15 @@ } else if (DtbFileSet::isOpfFile(fileUrl)) { - //TODO: differentiate between 2005 and 2002 - mDaisyVersion = ZED_2005; - amis::util::Log::Instance()->writeMessage("This is a Zed book", "Dtb::open", "AmisCore"); if (!processOpf(mpFiles->getOpfFilepath())) 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; //if (!processDaisyResourceFile(mpFiles->getResourceFilepath())) return false; } else { - mDaisyVersion = UNDEFINED; + mDaisyVersion = UNSUPPORTED; amis::util::Log::Instance()->writeWarning("The type of book could not be determined", "Dtb::open", "AmisCore"); return false; @@ -328,14 +328,36 @@ //-------------------------------------------------- //process an OPF file //-------------------------------------------------- -bool amis::dtb::Dtb::processOpf(const ambulant::net::url* filepath) +bool amis::dtb::Dtb::processOpf(const ambulant::net::url* filepath) { + #if defined(AMIS_COMPILER_MSVC) + //windows utility for converting wstring to string + USES_CONVERSION; + #endif + amis::io::OpfFileReader opf_file_reader; if (!opf_file_reader.readFromFile(filepath)) return false; mpSpine = opf_file_reader.getSpine(); mpMetadata = opf_file_reader.getMetadata(); + //only support DAISY 2005 books + amis::dtb::MetaItem* p_item = mpMetadata->getMetadata("dc:Format"); + std::string str_content = ""; + #if defined(AMIS_COMPILER_MSVC) + str_content.assign(T2A(p_item->mContent.c_str())); + #else + //TODO: convert string on other platforms + #endif + if (p_item == NULL || str_content != "ANSI/NISO Z39.86-2005") + { + std::string msg = "This format is unsupported: "; + if (p_item == NULL) msg += "dc:Format not found"; + else msg += str_content; + amis::util::Log::Instance()->writeError(msg, "Dtb::processOpf", "AmisCore"); + mDaisyVersion = UNSUPPORTED; + return false; + } //fill in the text for the title and the author mUid = getUid(); mpTitle = new amis::MediaGroup(); @@ -416,14 +438,8 @@ #ifdef WITH_EXTERNAL_SMIL_PLAYER return true; #else - //cout<<"** processing smil: "<<filepath<<" **"<<endl; - amis::io::SmilFileReader smil_reader; - if (!smil_reader.readFromFile(filepath)) - { - //cout<<"SMIL processing error: "<<smil_reader.getError().getMessage()<<endl; - return false; - } + if (!smil_reader.readFromFile(filepath)) return false; mpSmilTree = smil_reader.getSmilTree(); mpSmilTree->setCustomTestSet(mpCustomTests); return true; @@ -437,8 +453,7 @@ #ifdef WITH_EXTERNAL_SMIL_PLAYER return NULL; #else - if (mpSmilTree == NULL) - return NULL; + if (mpSmilTree == NULL) return NULL; amis::dtb::smil::SmilMediaGroup* p_smil_media = NULL; p_smil_media = mpSmilTree->nextPhrase(); @@ -447,7 +462,6 @@ { if (mpSmilTree->getError().getCode() == amis::AT_END) { - //cout<<"** end of smil file**"<<endl; const ambulant::net::url* p_file = NULL; p_file = mpSpine->getNextFile(); if (p_file != NULL) @@ -476,8 +490,7 @@ #ifdef WITH_EXTERNAL_SMIL_PLAYER return NULL; #else - if (mpSmilTree == NULL) - return NULL; + if (mpSmilTree == NULL) return NULL; amis::dtb::smil::SmilMediaGroup* p_smil_media = NULL; p_smil_media = mpSmilTree->previousPhrase(); @@ -530,8 +543,24 @@ if (mpNavModel->getNavMap() != NULL) { amis::dtb::nav::NavNode* p_node = NULL; - p_node = mpNavModel->getNodeForSmilId(p_pos_data->mUri.get_ref(), mpNavModel->getNavMap()); - if (p_node != NULL) p_pos_data->mNcxRef = p_node->getId(); + std::string uri_ref = p_pos_data->mUri.get_ref(); + //TODO: make this work for arbitrarily nested SMIL files (don't assume ncx and smil in same dir) + std::string smil_file_name = amis::util::FilePathTools::getFileName(p_pos_data->mUri.get_url()); + smil_file_name += "#" + uri_ref; + p_node = mpNavModel->getNodeForSmilId(smil_file_name, mpNavModel->getNavMap()); + if (p_node != NULL) + { + mpCurrentNavNode = p_node; + p_pos_data->mNcxRef = p_node->getId(); + } + //the current nav node could be a page target or nav point, depending on which has the greater + //play order value. default to nav point. + if (mpNavModel->hasPages() == true) + { + p_node = mpNavModel->getNodeForSmilId(uri_ref, mpNavModel->getPageList()); + if (p_node != NULL && mpCurrentNavNode->getPlayOrder() < p_node->getPlayOrder()) + mpCurrentNavNode = p_node; + } } } @@ -744,4 +773,9 @@ bool amis::dtb::Dtb::isProtected() { return mbIsProtected; +} + +amis::dtb::nav::NavNode* amis::dtb::Dtb::getCurrentNavNode() +{ + return mpCurrentNavNode; } \ No newline at end of file Modified: branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-02-28 23:13:10 UTC (rev 2352) @@ -186,15 +186,8 @@ bool amis::dtb::nav::NavModel::hasPages() { - if (mpPageList != NULL && mpPageList->getLength() > 0) - { - return true; - } - else - { - return false; - } - + if (mpPageList->getLength() > 0) return true; + else return false; } @@ -262,4 +255,63 @@ return p_node; } +amis::dtb::nav::NavPoint* amis::dtb::nav::NavModel::previousSection(int currentPlayOrder) +{ + int idx = currentPlayOrder - 1; + if (idx >= mPlayOrderList.size() || idx <= 0) return NULL; + for (int i = idx; i >=0; i--) + { + if (mPlayOrderList[i]->getTypeOfNode() == NavNode::NAV_POINT) + { + NavPoint* p_node = (NavPoint*)mPlayOrderList[i]; + return p_node; + } + } + return NULL; +} +amis::dtb::nav::NavPoint* amis::dtb::nav::NavModel::nextSection(int currentPlayOrder) +{ + int idx = currentPlayOrder + 1; + if (idx >= mPlayOrderList.size() || idx <= 0) return NULL; + + for (int i = idx; i < mPlayOrderList.size(); i++) + { + if (mPlayOrderList[i]->getTypeOfNode() == NavNode::NAV_POINT) + { + NavPoint* p_node = (NavPoint*)mPlayOrderList[i]; + return p_node; + } + } + return NULL; +} +amis::dtb::nav::PageTarget* amis::dtb::nav::NavModel::previousPage(int currentPlayOrder) +{ + int idx = currentPlayOrder - 1; + if (idx >= mPlayOrderList.size() || idx <= 0) return NULL; + + for (int i = idx; i >=0; i--) + { + if (mPlayOrderList[i]->getTypeOfNode() == NavNode::PAGE_TARGET) + { + PageTarget* p_node = (PageTarget*)mPlayOrderList[i]; + return p_node; + } + } + return NULL; +} +amis::dtb::nav::PageTarget* amis::dtb::nav::NavModel::nextPage(int currentPlayOrder) +{ + int idx = currentPlayOrder + 1; + if (idx >= mPlayOrderList.size() || idx <= 0) return NULL; + + for (int i = idx; i < mPlayOrderList.size(); i++) + { + if (mPlayOrderList[i]->getTypeOfNode() == NavNode::PAGE_TARGET) + { + PageTarget* p_node = (PageTarget*)mPlayOrderList[i]; + return p_node; + } + } + return NULL; +} Modified: branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h 2008-02-28 23:13:10 UTC (rev 2352) @@ -42,13 +42,14 @@ static bool isNull(); void DestroyInstance(); ~DtbWithHooks(); - -//overrides -public: bool open(const ambulant::net::url*, const ambulant::net::url*); smil::SmilMediaGroup* startReading(bool); smil::SmilMediaGroup* nextPhrase(); smil::SmilMediaGroup* previousPhrase(); + void nextSection(); + void previousSection(); + void nextPage(); + void previousPage(); void nextSmilDocument(); void previousSmilDocument(); void loadNavNode(nav::NavNode*); Modified: branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h 2008-02-28 23:13:10 UTC (rev 2352) @@ -47,8 +47,8 @@ ~CAmisSidebar(); CNavListControl* addNavListWidget(); void addTab(std::wstring); - void nextSection(); - void previousSection(); + //void nextSection(); + //void previousSection(); void expandAllSections(); void expandSections(int level); int getExposedDepth(); Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-28 23:13:10 UTC (rev 2352) @@ -185,7 +185,12 @@ void DtbWithHooks::loadNavNode(nav::NavNode* pNav) { - if (pNav == NULL) return; + if (pNav == NULL) + { + amis::util::Log::Instance()->writeWarning("Tried to load NULL nav node", "DtbWithHooks::loadNavNode", "AmisGuiMFC2"); + return; + } + amis::util::Log::Instance()->writeMessage("Loading nav node", "DtbWithHooks::loadNavNode", "AmisGuiMFC2"); ambulant::net::url rel_path = ambulant::net::url::from_url(pNav->getContent()); loadSmilFromUrl(&rel_path); } @@ -203,7 +208,7 @@ if (getDaisyVersion() == DAISY_202) p_entry->mPath = *this->getFileSet()->getNavFilepath(); - else if (getDaisyVersion() == ZED_2002 ||getDaisyVersion() == ZED_2005) + else if (getDaisyVersion() == DAISY_2005) p_entry->mPath = *this->getFileSet()->getOpfFilepath(); p_recent_books->addEntry(p_entry); @@ -368,3 +373,100 @@ theApp.setPauseState(false); return NULL; } + +void DtbWithHooks::previousSection() +{ + amis::util::Log* p_log = amis::util::Log::Instance(); + nav::NavNode* p_node = NULL; + p_node = getCurrentNavNode(); + if (p_node != NULL) + { + std::string id = p_node->getId(); + p_node = getNavModel()->previousSection(p_node->getPlayOrder()); + if (p_node != NULL) + { + loadNavNode(p_node); + } + else + { + std::string msg = "Previous section is NULL. Current nav ID# = " + id; + p_log->writeMessage(msg, "DtbWithHooks::previousSection", "AmisGuiMFC2"); + } + } + else + { + p_log->writeWarning("current nav node is NULL", "DtbWithHooks::previousSection", "AmisGuiMFC2"); + } +} +void DtbWithHooks::nextSection() +{ + amis::util::Log* p_log = amis::util::Log::Instance(); + nav::NavNode* p_node = NULL; + p_node = getCurrentNavNode(); + if (p_node != NULL) + { + std::string id = p_node->getId(); + p_node = getNavModel()->nextSection(p_node->getPlayOrder()); + if (p_node != NULL) + { + loadNavNode(p_node); + } + else + { + std::string msg = "Next section is NULL. Current nav ID# = " + id; + p_log->writeMessage(msg, "DtbWithHooks::nextSection", "AmisGuiMFC2"); + } + } + else + { + p_log->writeWarning("current nav node is NULL", "DtbWithHooks::nextSection", "AmisGuiMFC2"); + } +} +void DtbWithHooks::previousPage() +{ + amis::util::Log* p_log = amis::util::Log::Instance(); + nav::NavNode* p_node = NULL; + p_node = getCurrentNavNode(); + if (p_node != NULL) + { + std::string id = p_node->getId(); + p_node = getNavModel()->previousPage(p_node->getPlayOrder()); + if (p_node != NULL) + { + loadNavNode(p_node); + } + else + { + std::string msg = "Previous page is NULL. Current nav ID# = " + id; + p_log->writeMessage(msg, "DtbWithHooks::previousPage", "AmisGuiMFC2"); + } + } + else + { + p_log->writeWarning("current nav node is NULL", "DtbWithHooks::previousPage", "AmisGuiMFC2"); + } +} +void DtbWithHooks::nextPage() +{ + amis::util::Log* p_log = amis::util::Log::Instance(); + nav::NavNode* p_node = NULL; + p_node = getCurrentNavNode(); + if (p_node != NULL) + { + std::string id = p_node->getId(); + p_node = getNavModel()->nextPage(p_node->getPlayOrder()); + if (p_node != NULL) + { + loadNavNode(p_node); + } + else + { + std::string msg = "Next page is NULL. Current nav ID# = " + id; + p_log->writeMessage(msg, "DtbWithHooks::nextPage", "AmisGuiMFC2"); + } + } + else + { + p_log->writeWarning("current nav node is NULL", "DtbWithHooks::nextPage", "AmisGuiMFC2"); + } +} \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-28 23:13:10 UTC (rev 2352) @@ -457,13 +457,13 @@ void CAmisApp::OnNavNextSection() { amis::util::Log::Instance()->writeMessage("Next section", "CAmisApp::OnNavNextSection", "AmisGuiMFC2"); - amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.nextSection(); + amis::dtb::DtbWithHooks::Instance()->nextSection(); } void CAmisApp::OnNavPreviousSection() { amis::util::Log::Instance()->writeMessage("Previous section", "CAmisApp::OnNavPreviousSection", "AmisGuiMFC2"); - amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.previousSection(); + amis::dtb::DtbWithHooks::Instance()->previousSection(); } void CAmisApp::OnNavShowSectionDepth(UINT id) { @@ -476,13 +476,13 @@ void CAmisApp::OnNavNextPage() { amis::util::Log::Instance()->writeMessage("Next page", "CAmisApp::OnNavNextPage", "AmisGuiMFC2"); - //TODO: write this + amis::dtb::DtbWithHooks::Instance()->nextPage(); } void CAmisApp::OnNavPrevPage() { amis::util::Log::Instance()->writeMessage("Previous page", "CAmisApp::OnNavPrevPage", "AmisGuiMFC2"); - //TODO: write this + amis::dtb::DtbWithHooks::Instance()->previousPage(); } //TODO need to fix this...how do I stop ambulant? Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-02-28 23:13:10 UTC (rev 2352) @@ -133,7 +133,7 @@ mTotalTime = p_meta->getMetadataContent("ncc:totalTime"); mNarrator = p_meta->getMetadataContent("ncc:narrator"); } - else if (version == amis::dtb::ZED_2002 || version == amis::dtb::ZED_2005) + else if (version == amis::dtb::DAISY_2005) { mTotalTime = p_meta->getMetadataContent("dtb:totalTime"); mNarrator = p_meta->getMetadataContent("dc:Narrator"); @@ -179,7 +179,7 @@ mpSectionName = p_section->getLabel(); mNumSubsections = p_section->getNumChildren(); //the number of pages in a section is calculated using playorder, which doesn't exist in Zed 2002 - if (version == amis::dtb::DAISY_202 || version == amis::dtb::ZED_2005) + if (version == amis::dtb::DAISY_202 || version == amis::dtb::DAISY_2005) { int start_play_order, end_play_order; if (p_section->getFirstSibling() == NULL) end_play_order = -1; Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-02-28 18:29:23 UTC (rev 2351) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-02-28 23:13:10 UTC (rev 2352) @@ -412,12 +412,7 @@ mNumTabs++; } - -//******************* -//Section and Page Navigation -// -//works on visible items -//******************* +/* void CAmisSidebar::nextSection() { HTREEITEM h_curr = NULL; @@ -446,7 +441,7 @@ amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_nav); } } - +*/ //******************* //tree view expand and collapse //******************* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-02-29 03:15:03
|
Revision: 2353 http://amis.svn.sourceforge.net/amis/?rev=2353&view=rev Author: marisademeglio Date: 2008-02-28 19:15:09 -0800 (Thu, 28 Feb 2008) Log Message: ----------- Renamed command IDs so they make more sense outside of a menubar context (they're used in the toolbars too). Entire menus are no longer grayed-out -- just the individual items. Added line number to xerces parse logging. Removed file "Copy of eng-US" -- don't know why it was there. Modified Paths: -------------- branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h branches/amis3/AmisGuiMFC2/resource.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/MainWndParts.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp branches/amis3/DefaultLangpack/amisAccessibleUi.xml branches/amis3/VC7/amis.sln branches/amis3/bin/settings/basicToolbar.xml branches/amis3/bin/settings/defaultToolbar.xml branches/amis3/bin/settings/resource.h.ini Removed Paths: ------------- branches/amis3/DefaultLangpack/AmisLangpack/resource.h.ini branches/amis3/bin/settings/lang/Copy of eng-US/ Modified: branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp =================================================================== --- branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisCore/src/io/XercesSaxParseBase.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -147,17 +147,21 @@ void amis::io::XercesSaxParseBase::warning(const SAXParseException& e) { char* xerces_msg = XMLString::transcode(e.getMessage()); - string msg = "While processing *" + mFilepath.get_url() + - "* Xerces said: \"" + xerces_msg + "\""; - amis::util::Log::Instance()->writeWarning(msg, "XercesSaxParseBase::warning", "AmisCore"); + long line = e.getLineNumber(); + char ch_line[10]; + itoa(line, ch_line, 10); + string msg = "Parse warning: \n\t" + mFilepath.get_url() + "\n\tline: " + ch_line + "\n\t" + xerces_msg; + amis::util::Log::Instance()->writeWarning(msg, "XercesSaxParseBase::error", "AmisCore"); XMLString::release(&xerces_msg); } void amis::io::XercesSaxParseBase::error(const SAXParseException& e) { char* xerces_msg = XMLString::transcode(e.getMessage()); - string msg = "While processing *" + mFilepath.get_url() + - "* Xerces said: \"" + xerces_msg + "\""; + long line = e.getLineNumber(); + char ch_line[10]; + itoa(line, ch_line, 10); + string msg = "Parse error: \n\t" + mFilepath.get_url() + "\n\tline: " + ch_line + "\n\t" + xerces_msg; amis::util::Log::Instance()->writeError(msg, "XercesSaxParseBase::error", "AmisCore"); XMLString::release(&xerces_msg); } @@ -165,10 +169,10 @@ void amis::io::XercesSaxParseBase::fatalError(const SAXParseException& e) { char* xerces_msg = XMLString::transcode(e.getMessage()); - mError.setCode (amis::PARSE_ERROR); - string msg = "While processing *" + mFilepath.get_url() + - "* Xerces said: \"" + xerces_msg + "\""; - mError.setMessage(msg); - amis::util::Log::Instance()->writeError(mError, "XercesSaxParseBase::fatalError", "AmisCore"); + long line = e.getLineNumber(); + char ch_line[10]; + itoa(line, ch_line, 10); + string msg = "Parse fatal error: \n\t" + mFilepath.get_url() + "\n\tline: " + ch_line + "\n\t" + xerces_msg; + amis::util::Log::Instance()->writeError(msg, "XercesSaxParseBase::error", "AmisCore"); XMLString::release(&xerces_msg); } Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-02-29 03:15:09 UTC (rev 2353) @@ -156,84 +156,85 @@ BEGIN POPUP "&File" BEGIN - MENUITEM "&Open...\tCtrl+O", ID_MENU_FILE_OPEN - MENUITEM "Open from &URL", ID_MENU_FILE_OPENFROMURL - MENUITEM "&Close", ID_MENU_FILE_CLOSE - MENUITEM "&Load CD\tCtrl+L", ID_MENU_FILE_LOADCD - MENUITEM "&Search drives...", ID_MENU_FILE_SEARCHDRIVE + MENUITEM "&Open...\tCtrl+O", ID_AMIS_OPEN_FILE + MENUITEM "Open from &URL", ID_AMIS_OPEN_URL + MENUITEM "&Close", ID_AMIS_CLOSE_BOOK + MENUITEM "&Load CD\tCtrl+L", ID_AMIS_LOAD_CD + MENUITEM "&Search drives...", ID_AMIS_SEARCH_LOCAL_DRIVES MENUITEM SEPARATOR - MENUITEM "&Preferences...", ID_MENU_FILE_PREFERENCES + MENUITEM "&Preferences...", ID_AMIS_SHOW_PREFERENCES MENUITEM SEPARATOR POPUP "&Recent" BEGIN - MENUITEM "Empty", ID_FILE_RECENT_EMPTY + MENUITEM "Empty", ID_AMIS_RECENT_BOOKS_EMPTY , INACTIVE END MENUITEM SEPARATOR - MENUITEM "E&xit\tAlt+F4", ID_MENU_FILE_EXIT + MENUITEM "E&xit\tAlt+F4", ID_AMIS_EXIT END POPUP "&View" BEGIN - MENUITEM "&Sidebar", ID_MENU_VIEW_SIDEBAR_ONOFF + MENUITEM "&Sidebar", ID_AMIS_TOGGLE_SIDEBAR , CHECKED - MENUITEM "&Basic View Mode\tF11", ID_MENU_VIEW_BASIC + MENUITEM "&Basic View Mode\tF11", ID_AMIS_TOGGLE_VIEW MENUITEM SEPARATOR POPUP "&Page Style" BEGIN - MENUITEM "None", ID_PAGESTYLES_NONE + MENUITEM "None", ID_AMIS_NO_PAGE_STYLES , CHECKED MENUITEM "sample 1", 351 MENUITEM "sample 2", 352 END - MENUITEM "Bi&gger Font", ID_MENU_VIEW_LARGEFONT - MENUITEM "S&maller Font", ID_MENU_VIEW_DECREASEFONT + MENUITEM "Bi&gger Font", ID_AMIS_BIGGER_FONT + MENUITEM "S&maller Font", ID_AMIS_SMALLER_FONT END POPUP "&Play" BEGIN - MENUITEM "&Play\tSpace", ID_MENU_PLAYPAUSE + MENUITEM "&Play\tSpace", ID_AMIS_PLAYPAUSE MENUITEM SEPARATOR - MENUITEM "&Escape\tEsc", ID_MENU_PLAY_ESCAPE + MENUITEM "&Escape\tEsc", ID_AMIS_ESCAPE MENUITEM SEPARATOR - MENUITEM "&Faster\tCtrl++", ID_MENU_PLAY_FASTER - MENUITEM "&Slower\tCtrl+-", ID_MENU_PLAY_SLOWER - MENUITEM "&Normal Speed\tCtrl+0", ID_MENU_PLAY_NORMALSPEED + MENUITEM "&Faster\tCtrl++", ID_AMIS_FASTER + MENUITEM "&Slower\tCtrl+-", ID_AMIS_SLOWER + MENUITEM "&Normal Speed\tCtrl+0", ID_AMIS_RESET_SPEED MENUITEM SEPARATOR - MENUITEM "&Increase Volume\tCtrl+Up", ID_MENU_PLAY_VOLUP - MENUITEM "&Decrease Volume\tCtrl+Down", ID_MENU_PLAY_VOLDOWN + MENUITEM "&Increase Volume\tCtrl+Up", ID_AMIS_INCREASE_VOLUME + MENUITEM "&Decrease Volume\tCtrl+Down", ID_AMIS_DECREASE_VOLUME END POPUP "&Navigate" BEGIN - MENUITEM "&Previous Section\tUp", ID_MENU_NAV_PREVSECTION - MENUITEM "&Next Section\tDown", ID_MENU_NAV_NEXTSECTION + MENUITEM "&Previous Section\tUp", ID_AMIS_PREVIOUS_SECTION + MENUITEM "&Next Section\tDown", ID_AMIS_NEXT_SECTION POPUP "&Show Section Depth" BEGIN - MENUITEM "Empty", ID_EMPTY + MENUITEM "Empty", ID_AMIS_SECTION_DEPTH_EMPTY + END MENUITEM SEPARATOR - MENUITEM "Previous Phrase\tLeft", ID_MENU_NAV_PREVPHRASE - MENUITEM "Next Phrase\tRight", ID_MENU_NAV_NEXTPHRASE + MENUITEM "Previous Phrase\tLeft", ID_AMIS_PREVIOUS_PHRASE + MENUITEM "Next Phrase\tRight", ID_AMIS_NEXT_PHRASE MENUITEM SEPARATOR - MENUITEM "Previous Page\tCtrl+Left", ID_MENU_NAV_PREVPAGE - MENUITEM "Next Page\tCtrl+Right", ID_MENU_NAV_NEXTPAGE - MENUITEM "Go to Page...\tCtrl+G", ID_MENU_NAV_GOTOPAGE + MENUITEM "Previous Page\tCtrl+Left", ID_AMIS_PREVIOUS_PAGE + MENUITEM "Next Page\tCtrl+Right", ID_AMIS_NEXT_PAGE + MENUITEM "Go to Page...\tCtrl+G", ID_AMIS_GOTO_PAGE MENUITEM SEPARATOR - MENUITEM "&Find in Text\tCtrl+F", ID_MENU_NAV_FINDINTEXT + MENUITEM "&Find in Text\tCtrl+F", ID_AMIS_FIND_IN_TEXT END POPUP "&Bookmarks" BEGIN - MENUITEM "&Add Bookmark\tCtrl+D", ID_MENU_BMK_ADD + MENUITEM "&Add Bookmark\tCtrl+D", ID_AMIS_ADD_BOOKMARK MENUITEM SEPARATOR END POPUP "&Info" BEGIN - MENUITEM "&Reading Options...", ID_MENU_INFO_SKIP - MENUITEM "&Publication Summary", ID_MENU_INFO_PUBLICATION_SUMMARY + MENUITEM "&Reading Options...", ID_AMIS_SHOW_READING_OPTIONS + MENUITEM "&Publication Summary", ID_AMIS_SHOW_PUBLICATION_SUMMARY END POPUP "&Help" BEGIN - MENUITEM "&Contents", ID_MENU_HELP_CONTENTS - MENUITEM "&About AMIS", ID_MENU_HELP_ABOUT + MENUITEM "&Contents", ID_AMIS_SHOW_HELP_CONTENTS + MENUITEM "&About AMIS", ID_AMIS_ABOUT END END @@ -465,46 +466,42 @@ IDR_AMISTYPE ACCELERATORS BEGIN - "Q", ID_DECREASE_SECTION_DEPTH, VIRTKEY, CONTROL, NOINVERT - "N", ID_FOCUS_ON_SIDEBAR, VIRTKEY, CONTROL, NOINVERT - "A", ID_FOCUS_ON_TEXT, VIRTKEY, CONTROL, NOINVERT - "I", ID_HEAR_INSTRUCTIONS, VIRTKEY, CONTROL, NOINVERT - "R", ID_HEAR_LAST_PROMPT, VIRTKEY, CONTROL, NOINVERT - "T", ID_HEAR_LAST_TEXT_ENTRY, VIRTKEY, CONTROL, NOINVERT - "P", ID_INCREASE_SECTION_DEPTH, VIRTKEY, CONTROL, NOINVERT - "D", ID_MENU_BMK_ADD, VIRTKEY, CONTROL, NOINVERT - VK_F4, ID_MENU_FILE_EXIT, VIRTKEY, ALT, NOINVERT - "L", ID_MENU_FILE_LOADCD, VIRTKEY, CONTROL, NOINVERT - "O", ID_MENU_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT - VK_F3, ID_MENU_FIND_IN_TEXT_NEXT, VIRTKEY, NOINVERT - VK_F3, ID_MENU_FIND_IN_TEXT_PREV, VIRTKEY, CONTROL, NOINVERT - VK_F1, ID_MENU_HELP_CONTENTS, VIRTKEY, NOINVERT - "F", ID_MENU_NAV_FINDINTEXT, VIRTKEY, CONTROL, NOINVERT - "G", ID_MENU_NAV_GOTOPAGE, VIRTKEY, CONTROL, NOINVERT - VK_RIGHT, ID_MENU_NAV_NEXTPAGE, VIRTKEY, CONTROL, NOINVERT - VK_RIGHT, ID_MENU_NAV_NEXTPHRASE, VIRTKEY, NOINVERT - VK_DOWN, ID_MENU_NAV_NEXTSECTION, VIRTKEY, NOINVERT - VK_LEFT, ID_MENU_NAV_PREVPAGE, VIRTKEY, CONTROL, NOINVERT - VK_LEFT, ID_MENU_NAV_PREVPHRASE, VIRTKEY, NOINVERT - VK_UP, ID_MENU_NAV_PREVSECTION, VIRTKEY, NOINVERT - VK_ESCAPE, ID_MENU_PLAY_ESCAPE, VIRTKEY, NOINVERT - VK_OEM_PLUS, ID_MENU_PLAY_FASTER, VIRTKEY, CONTROL, NOINVERT - "0", ID_MENU_PLAY_NORMALSPEED, VIRTKEY, CONTROL, NOINVERT - VK_ADD, ID_MENU_PLAY_SLOWER, VIRTKEY, CONTROL, NOINVERT - VK_OEM_MINUS, ID_MENU_PLAY_SLOWER, VIRTKEY, CONTROL, NOINVERT - VK_SUBTRACT, ID_MENU_PLAY_SLOWER, VIRTKEY, CONTROL, NOINVERT - VK_DOWN, ID_MENU_PLAY_VOLDOWN, VIRTKEY, CONTROL, NOINVERT - VK_UP, ID_MENU_PLAY_VOLUP, VIRTKEY, CONTROL, NOINVERT - VK_SPACE, ID_MENU_PLAYPAUSE, VIRTKEY, NOINVERT - VK_F11, ID_MENU_VIEW_BASIC, VIRTKEY, NOINVERT - "E", ID_RESET_HIGHLIGHT_COLORS, VIRTKEY, SHIFT, CONTROL, + "Q", ID_AMIS_DECREASE_SECTION_DEPTH, VIRTKEY, CONTROL, NOINVERT - "F", ID_TOGGLE_AUDIO_CONTENT_PLAYBACK, VIRTKEY, SHIFT, + VK_DOWN, ID_AMIS_DECREASE_VOLUME, VIRTKEY, CONTROL, NOINVERT + VK_ESCAPE, ID_AMIS_ESCAPE, VIRTKEY, NOINVERT + VK_F4, ID_AMIS_EXIT, VIRTKEY, ALT, NOINVERT + VK_ADD, ID_AMIS_FASTER, VIRTKEY, CONTROL, NOINVERT + VK_OEM_PLUS, ID_AMIS_FASTER, VIRTKEY, CONTROL, NOINVERT + "F", ID_AMIS_FIND_IN_TEXT, VIRTKEY, CONTROL, NOINVERT + "N", ID_AMIS_FOCUS_ON_SIDEBAR, VIRTKEY, CONTROL, NOINVERT + "A", ID_AMIS_FOCUS_ON_TEXT, VIRTKEY, CONTROL, NOINVERT + "G", ID_AMIS_GOTO_PAGE, VIRTKEY, CONTROL, NOINVERT + "P", ID_AMIS_INCREASE_SECTION_DEPTH, VIRTKEY, CONTROL, + NOINVERT + VK_UP, ID_AMIS_INCREASE_VOLUME, VIRTKEY, CONTROL, NOINVERT + "L", ID_AMIS_LOAD_CD, VIRTKEY, CONTROL, NOINVERT + "D", ID_AMIS_ADD_BOOKMARK, VIRTKEY, CONTROL, NOINVERT + VK_RIGHT, ID_AMIS_NEXT_PAGE, VIRTKEY, CONTROL, NOINVERT + VK_RIGHT, ID_AMIS_NEXT_PHRASE, VIRTKEY, NOINVERT + VK_DOWN, ID_AMIS_NEXT_SECTION, VIRTKEY, NOINVERT + "O", ID_AMIS_OPEN_FILE, VIRTKEY, CONTROL, NOINVERT + "U", ID_AMIS_OPEN_URL, VIRTKEY, CONTROL, NOINVERT + VK_SPACE, ID_AMIS_PLAYPAUSE, VIRTKEY, NOINVERT + VK_LEFT, ID_AMIS_PREVIOUS_PAGE, VIRTKEY, CONTROL, NOINVERT + VK_LEFT, ID_AMIS_PREVIOUS_PHRASE, VIRTKEY, NOINVERT + VK_UP, ID_AMIS_PREVIOUS_SECTION, VIRTKEY, NOINVERT + "E", ID_AMIS_RESET_HIGHLIGHT_COLORS, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "0", ID_AMIS_RESET_SPEED, VIRTKEY, CONTROL, NOINVERT + VK_F1, ID_AMIS_SHOW_HELP_CONTENTS, VIRTKEY, NOINVERT + VK_OEM_MINUS, ID_AMIS_SLOWER, VIRTKEY, CONTROL, NOINVERT + VK_SUBTRACT, ID_AMIS_SLOWER, VIRTKEY, CONTROL, NOINVERT + "F", ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK, VIRTKEY, SHIFT, CONTROL, NOINVERT - "G", ID_TOGGLE_AUDIO_SELFVOICING_PLAYBACK, VIRTKEY, SHIFT, - CONTROL, NOINVERT - "S", ID_VIEW_CONTRAST, VIRTKEY, CONTROL, NOINVERT - "U", ID_MENU_FILE_OPENFROMURL, VIRTKEY, CONTROL, NOINVERT + "G", ID_AMIS_TOGGLE_AUDIO_SELFVOICING_PLAYBACK, VIRTKEY, + SHIFT, CONTROL, NOINVERT + VK_F11, ID_AMIS_TOGGLE_VIEW, VIRTKEY, NOINVERT END @@ -522,7 +519,7 @@ STRINGTABLE BEGIN AFX_IDS_APP_TITLE "AMIS" - AFX_IDS_IDLEMESSAGE "Ready Ready" + AFX_IDS_IDLEMESSAGE "Ready" END STRINGTABLE @@ -544,32 +541,6 @@ STRINGTABLE BEGIN - ID_MENU_FILE_LOADCD "Load a DAISY book from CD ROM" - ID_MENU_FILE_SEARCHDRIVE "Search local drives for DAISY books" - ID_MENU_VIEW_BASIC "Switch the view to basic mode." - ID_MENU_VIEW_LARGEFONT "Gradually increase the font size." - ID_MENU_VIEW_RESET "Set the font size to the default setting." -END - -STRINGTABLE -BEGIN - ID_MENU_PLAY_FASTER "Increase the playback rate." - ID_MENU_PLAY_NORMALSPEED "Reset the playback rate to normal." - ID_MENU_HELP_HELP "Get help using AMIS" -END - -STRINGTABLE -BEGIN - ID_MENU_INFO_SUMMARY "Get all summary info for this publication." - ID_MENU_FILE_PREFERENCES "This is the application preferences dialog." - ID_MENU_INFO_NAVOPTIONS "Learn about your navigation options for this publication." - ID_MENU_INFO_CURRENTPOSITION - "Get information about your current position." - ID_MENU_VIEW_RESETFONT "Set the font size to the default setting." -END - -STRINGTABLE -BEGIN IDS_PROPSHT_CAPTION "Preferences" END @@ -603,43 +574,48 @@ STRINGTABLE BEGIN - ID_MENU_VIEW_CONTRAST "Use high contrast colors for the text display." - ID_MENU_PLAY_ESCAPE "Jump out of the currently playing item or structure." - ID_MENU_INFO_SKIP "View the skippable items for this publication." - ID_MENU_HELP_CONTENTS "Get help using AMIS" - ID_MENU_PLAY_SLOWER "Slow down the playback rate." - ID_MENU_FILE_EXIT "Exit AMIS" - ID_MENU_VIEW_SIDEBAR_ONOFF "Turn the sidebar on or off." + ID_AMIS_BIGGER_FONT "Increase the font size." + ID_AMIS_SMALLER_FONT "Reduce the font size." + ID_AMIS_PLAYPAUSE "Start synchronized playback." + ID_AMIS_ESCAPE "Jump out of the currently playing item or structure." + ID_AMIS_FASTER "Increase the playback rate." + ID_AMIS_SLOWER "Slow down the playback rate." + ID_AMIS_RESET_SPEED "Reset the playback rate to normal." + ID_AMIS_INCREASE_VOLUME "Gradually raise the volume." + ID_AMIS_DECREASE_VOLUME "Gradually lower the volume." + ID_AMIS_PREVIOUS_SECTION "Go to the previous section." + ID_AMIS_NEXT_SECTION "Go to the next section." + ID_AMIS_PREVIOUS_PHRASE "Go to the previous phrase." + ID_AMIS_NEXT_PHRASE "Go to the next phrase." + ID_AMIS_PREVIOUS_PAGE "Go to the previous page." END STRINGTABLE BEGIN - ID_MENU_NAV_NEXTSECTION "Go to the next section." - ID_MENU_NAV_PREVSECTION "Go to the previous section." - ID_MENU_NAV_PREVPHRASE "Go to the previous phrase." - ID_MENU_NAV_NEXTPHRASE "Go to the next phrase." - ID_MENU_BMK_ADD "Bookmark your current position." - ID_MENU_FILE_OPEN "Open a Daisy book from the local file system" - ID_MENU_HELP_ABOUT "Find out about AMIS and DAISY-for-All." - ID_MENU_PLAY_VOLUP "Gradually raise the volume." - ID_MENU_PLAY_VOLDOWN "Gradually lower the volume." + ID_AMIS_NEXT_PAGE "Go to the next page." + ID_AMIS_GOTO_PAGE "Go to a specific page." + ID_AMIS_FIND_IN_TEXT "Search for a word or phrase in the text." + ID_AMIS_ADD_BOOKMARK "Bookmark your current position." + ID_AMIS_SHOW_READING_OPTIONS + "View the skippable items for this publication." + ID_AMIS_SHOW_PUBLICATION_SUMMARY + "Get all summary info for this publication." + ID_AMIS_SHOW_HELP_CONTENTS "Get help using AMIS" + ID_AMIS_ABOUT "Find out about AMIS and DAISY-for-All." END STRINGTABLE BEGIN - ID_MENU_NAV_PREVPAGE "Go to the previous page." - ID_MENU_NAV_NEXTPAGE "Go to the next page." - ID_MENU_NAV_FINDINTEXT "Search for a word or phrase in the text." - ID_MENU_NAV_GOTOPAGE "Go to a specific page." + ID_AMIS_OPEN_FILE "Open a Daisy book from the local file system" + ID_AMIS_CLOSE_BOOK "Close the publication." + ID_AMIS_LOAD_CD "Load a DAISY book from CD ROM" + ID_AMIS_SEARCH_LOCAL_DRIVES "Search local drives for DAISY books" + ID_AMIS_SHOW_PREFERENCES "This is the application preferences dialog." + ID_AMIS_EXIT "Exit AMIS" + ID_AMIS_TOGGLE_SIDEBAR "Turn the sidebar on or off." + ID_AMIS_TOGGLE_VIEW "Switch the view to basic mode." END -STRINGTABLE -BEGIN - ID_MENU_PLAYPAUSE "Start synchronized playback." - ID_MENU_FILE_CLOSE "Close the publication." - ID_MENU_VIEW_DECREASEFONT "Decrease the font size" -END - #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// Modified: branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-02-29 03:15:09 UTC (rev 2353) @@ -43,7 +43,7 @@ #include "gui/self-voicing/datamodel/AccessibleUIDataReader.h" #define WITH_DAISY_PDTB -#define MAX_ANYTHING 49 +#define AMIS_MAX_ANYTHING 49 namespace amis { @@ -87,7 +87,7 @@ afx_msg void OnSelectBookmark(UINT); afx_msg void OnGoToPage(); afx_msg void OnIncreaseFontSize(); - afx_msg void OnResetFontSize(); + afx_msg void OnDecreaseFontSize(); afx_msg void OnToggleContrast(); afx_msg void OnSearchForBooks(); afx_msg void OnLoadCd(); Modified: branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2008-02-29 03:15:09 UTC (rev 2353) @@ -38,13 +38,10 @@ void DestroyInstance(); ~MenuManip(); void refreshRecentBooksListMenu(); - void setupMenusSomethingOpen(amis::dtb::BookmarkSet*); - void setupMenusNothingOpen(); void setViewItemCheckmark(bool, UINT); void setPauseState(bool pauseState); void addBookmark(amis::dtb::PositionMark*); void loadBookmarks(amis::dtb::BookmarkSet*); -private: void setupNavigationOptions(); private: static MenuManip* pinstance; Modified: branches/amis3/AmisGuiMFC2/resource.h =================================================================== --- branches/amis3/AmisGuiMFC2/resource.h 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/resource.h 2008-02-29 03:15:09 UTC (rev 2353) @@ -5,20 +5,18 @@ #define IDD_ABOUTBOX 100 #define IDS_PROPSHT_CAPTION 102 #define IDD_SIDEBAR 103 -#define ID_FOCUS_ON_SIDEBAR 123 -#define ID_HEAR_LAST_PROMPT 124 -#define ID_HEAR_INSTRUCTIONS 125 -#define ID_HEAR_LAST_TEXT_ENTRY 126 -#define ID_FOCUS_ON_TEXT 127 +#define ID_AMIS_FOCUS_ON_SIDEBAR 123 +#define ID_AMIS_FOCUS_ON_TEXT 127 #define IDR_MAINFRAME 128 #define IDR_AMISTYPE 129 -#define ID_INCREASE_SECTION_DEPTH 130 -#define ID_DECREASE_SECTION_DEPTH 131 -#define ID_RESET_HIGHLIGHT_COLORS 132 -#define ID_TOGGLE_AUDIO_CONTENT_PLAYBACK 133 -#define ID_TOGGLE_AUDIO_SELFVOICING_PLAYBACK 134 +#define ID_AMIS_INCREASE_SECTION_DEPTH 130 +#define ID_AMIS_DECREASE_SECTION_DEPTH 131 +#define ID_AMIS_RESET_HIGHLIGHT_COLORS 132 +#define ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK 133 +#define ID_AMIS_TOGGLE_AUDIO_SELFVOICING_PLAYBACK 134 +#define ID_AMIS_NEXT_PAGE_STYLE 142 #define IDD_FIND 147 -#define VIEW_MENU_BASE_ID 150 +#define AMIS_VIEW_MENU_BASE_ID 150 #define IDD_SKIP 153 #define IDI_AMIS 164 #define IDD_SEARCHDAISY 177 @@ -29,11 +27,11 @@ #define IDB_BOOKSHELFMAG 186 #define IDD_OPENURL 190 #define IDD_PREFERENCES 191 -#define BOOK_BASE_ID 200 -#define SECTION_DEPTH_BASE_ID 250 -#define NAVLIST_BASE_ID 300 -#define PAGESTYLE_BASE_ID 350 -#define BOOKMARKS_BASE_ID 400 +#define AMIS_RECENT_BOOK_BASE_ID 200 +#define AMIS_SECTION_DEPTH_BASE_ID 250 +#define AMIS_NAVLIST_BASE_ID 300 +#define AMIS_PAGE_STYLE_BASE_ID 350 +#define AMIS_BOOKMARKS_BASE_ID 400 #define ID_AMBULANT_PLAY 700 #define IDC_TREE 1000 #define IDC_TAB 1001 @@ -73,55 +71,43 @@ #define IDC_MULTIVOLCD_INSTRUCTIONS 1103 #define IDC_GOTOPAGE_CAPTION 1104 #define IDC_OPENURL_CAPTION 1105 -#define ID_MENU_FIND_IN_TEXT_NEXT 9000 -#define ID_MENU_FIND_IN_TEXT_PREV 9001 #define IDC_CURRLANG 9002 #define IDC_VERSION 9006 #define IDC_VERSIONNOTE 9007 -#define ID_MENU_FILE_LOADCD 32771 -#define ID_MENU_FILE_SEARCHDRIVE 32772 -#define ID_MENU_VIEW_BASIC 32776 -#define ID_MENU_VIEW_LARGEFONT 32778 -#define ID_MENU_VIEW_RESET 32779 -#define ID_MENU_PLAY_PLAY 32787 -#define ID_MENU_PLAY_PAUSE 32788 -#define ID_MENU_PLAY_FASTER 32789 -#define ID_MENU_PLAY_NORMALSPEED 32791 -#define ID_MENU_HELP_HELP 32798 -#define ID_MENU_INFO_SUMMARY 32800 -#define ID_MENU_FILE_PREFERENCES 32802 -#define ID_MENU_INFO_NAVOPTIONS 32804 -#define ID_MENU_INFO_CURRENTPOSITION 32805 -#define ID_MENU_VIEW_RESETFONT 32814 -#define ID_VIEW_CONTRAST 32818 -#define ID_MENU_VIEW_CONTRAST 32818 -#define ID_MENU_PLAY_ESCAPE 32819 -#define ID_MENU_INFO_SKIP 32820 -#define ID_MENU_HELP_CONTENTS 32821 -#define ID_MENU_PLAY_SLOWER 32822 -#define ID_MENU_FILE_EXIT 32823 -#define ID_MENU_VIEW_SIDEBAR_ONOFF 32825 -#define ID_FILE_RECENT_EMPTY 32828 -#define ID_EMPTY 32830 -#define ID_MENU_NAV_NEXTSECTION 32833 -#define ID_MENU_NAV_PREVSECTION 32834 -#define ID_MENU_NAV_PREVPHRASE 32835 -#define ID_MENU_NAV_NEXTPHRASE 32836 -#define ID_MENU_BMK_ADD 32837 -#define ID_MENU_FILE_OPEN 32838 -#define ID_MENU_HELP_ABOUT 32839 -#define ID_MENU_PLAY_VOLUP 32844 -#define ID_MENU_PLAY_VOLDOWN 32845 -#define ID_MENU_NAV_PREVPAGE 32854 -#define ID_MENU_NAV_NEXTPAGE 32856 -#define ID_MENU_NAV_FINDINTEXT 32859 -#define ID_MENU_NAV_GOTOPAGE 32860 -#define ID_MENU_PLAYPAUSE 32865 -#define ID_MENU_FILE_OPENFROMURL 32870 -#define ID_MENU_FILE_CLOSE 32871 -#define ID_MENU_INFO_PUBLICATION_SUMMARY 32876 -#define ID_MENU_VIEW_DECREASEFONT 32878 -#define ID_PAGESTYLES_NONE 32882 +#define ID_AMIS_OPEN_FILE 32918 +#define ID_AMIS_OPEN_URL 32919 +#define ID_AMIS_CLOSE_BOOK 32920 +#define ID_AMIS_LOAD_CD 32921 +#define ID_AMIS_SEARCH_LOCAL_DRIVES 32922 +#define ID_AMIS_SHOW_PREFERENCES 32923 +#define ID_AMIS_RECENT_BOOKS_EMPTY 32924 +#define ID_AMIS_EXIT 32925 +#define ID_AMIS_TOGGLE_SIDEBAR 32926 +#define ID_AMIS_TOGGLE_VIEW 32927 +#define ID_AMIS_NO_PAGE_STYLES 32928 +#define ID_AMIS_BIGGER_FONT 32929 +#define ID_AMIS_SMALLER_FONT 32930 +#define ID_AMIS_PLAYPAUSE 32931 +#define ID_AMIS_ESCAPE 32932 +#define ID_AMIS_FASTER 32933 +#define ID_AMIS_SLOWER 32934 +#define ID_AMIS_RESET_SPEED 32935 +#define ID_AMIS_INCREASE_VOLUME 32936 +#define ID_AMIS_DECREASE_VOLUME 32937 +#define ID_AMIS_PREVIOUS_SECTION 32938 +#define ID_AMIS_NEXT_SECTION 32939 +#define ID_AMIS_SECTION_DEPTH_EMPTY 32940 +#define ID_AMIS_PREVIOUS_PHRASE 32941 +#define ID_AMIS_NEXT_PHRASE 32942 +#define ID_AMIS_PREVIOUS_PAGE 32943 +#define ID_AMIS_NEXT_PAGE 32944 +#define ID_AMIS_GOTO_PAGE 32945 +#define ID_AMIS_FIND_IN_TEXT 32946 +#define ID_AMIS_ADD_BOOKMARK 32947 +#define ID_AMIS_SHOW_READING_OPTIONS 32948 +#define ID_AMIS_SHOW_PUBLICATION_SUMMARY 32949 +#define ID_AMIS_SHOW_HELP_CONTENTS 32950 +#define ID_AMIS_ABOUT 32951 #define IDS_SELFOLDER_TITLE 61258 #define IDS_SELFOLDER_INSTR 61259 #define IDS_FOLDERDOESNOTEXIST 61279 @@ -135,8 +121,8 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 192 -#define _APS_NEXT_COMMAND_VALUE 32883 +#define _APS_NEXT_COMMAND_VALUE 32952 #define _APS_NEXT_CONTROL_VALUE 1106 -#define _APS_NEXT_SYMED_VALUE 142 +#define _APS_NEXT_SYMED_VALUE 143 #endif #endif Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -97,7 +97,8 @@ addToRecentBooks(); amis::dtb::BookmarkSet* p_bmks = NULL; p_bmks = this->getBookmarks(); - amis::gui::MenuManip::Instance()->setupMenusSomethingOpen(p_bmks); + amis::gui::MenuManip::Instance()->setupNavigationOptions(); + amis::gui::MenuManip::Instance()->loadBookmarks(p_bmks); return true; } Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -72,39 +72,38 @@ BEGIN_MESSAGE_MAP(CAmisApp, CWinApp) - ON_COMMAND(ID_MENU_FILE_OPEN, OnFileOpen) - ON_COMMAND(ID_MENU_PLAYPAUSE, OnPlayPause) - ON_COMMAND(ID_MENU_NAV_NEXTPHRASE, OnNavNextPhrase) - ON_COMMAND(ID_MENU_NAV_PREVPHRASE, OnNavPrevPhrase) - ON_COMMAND(ID_MENU_FILE_EXIT, OnFileExit) - ON_COMMAND(ID_MENU_NAV_NEXTSECTION, OnNavNextSection) - ON_COMMAND(ID_MENU_NAV_PREVSECTION, OnNavPreviousSection) - ON_COMMAND_RANGE(BOOK_BASE_ID, BOOK_BASE_ID + MAX_ANYTHING, OnFileRecentBook) - ON_COMMAND_RANGE(SECTION_DEPTH_BASE_ID, SECTION_DEPTH_BASE_ID + MAX_ANYTHING, OnNavShowSectionDepth) - ON_COMMAND(ID_MENU_NAV_NEXTPAGE, OnNavNextPage) - ON_COMMAND(ID_MENU_NAV_PREVPAGE, OnNavPrevPage) - ON_COMMAND(ID_MENU_FILE_CLOSE, OnFileClose) - ON_COMMAND(ID_MENU_HELP_ABOUT, OnAbout) - ON_COMMAND(ID_MENU_VIEW_SIDEBAR_ONOFF, OnViewSidebarOnoff) - ON_COMMAND(ID_MENU_PLAY_ESCAPE, OnPlayEscape) - ON_COMMAND(ID_MENU_FILE_OPENFROMURL, OnFileOpenFromUrl) - ON_COMMAND(ID_MENU_INFO_SKIP, OnSkipInfo) - ON_COMMAND(ID_MENU_BMK_ADD, OnAddBookmark) - ON_COMMAND_RANGE(BOOKMARKS_BASE_ID, BOOKMARKS_BASE_ID + MAX_ANYTHING, OnSelectBookmark) - ON_COMMAND(ID_MENU_NAV_GOTOPAGE, OnGoToPage) - ON_COMMAND(ID_MENU_VIEW_CONTRAST, OnToggleContrast) - ON_COMMAND(ID_MENU_VIEW_LARGEFONT, OnIncreaseFontSize) - ON_COMMAND(ID_MENU_VIEW_RESETFONT, OnResetFontSize) - ON_COMMAND(ID_MENU_FILE_SEARCHDRIVE, OnSearchForBooks) - ON_COMMAND(ID_MENU_FILE_LOADCD, OnLoadCd) - ON_COMMAND(ID_MENU_PLAY_NORMALSPEED, OnSpeedNormal) - ON_COMMAND(ID_MENU_PLAY_SLOWER, OnSpeedDown) - ON_COMMAND(ID_MENU_PLAY_FASTER, OnSpeedUp) - ON_COMMAND(ID_MENU_PLAY_VOLUP, OnVolumeUp) - ON_COMMAND(ID_MENU_PLAY_VOLDOWN, OnVolumeDown) - ON_COMMAND(ID_MENU_FILE_PREFERENCES, OnPreferences) - ON_COMMAND(ID_MENU_INFO_PUBLICATION_SUMMARY, OnPublicationSummary) - ON_COMMAND(ID_MENU_VIEW_BASIC, OnToggleView) + ON_COMMAND(ID_AMIS_OPEN_FILE, OnFileOpen) + ON_COMMAND(ID_AMIS_PLAYPAUSE, OnPlayPause) + ON_COMMAND(ID_AMIS_NEXT_PHRASE, OnNavNextPhrase) + ON_COMMAND(ID_AMIS_PREVIOUS_PHRASE, OnNavPrevPhrase) + ON_COMMAND(ID_AMIS_EXIT, OnFileExit) + ON_COMMAND(ID_AMIS_NEXT_SECTION, OnNavNextSection) + ON_COMMAND(ID_AMIS_PREVIOUS_SECTION, OnNavPreviousSection) + ON_COMMAND_RANGE(AMIS_RECENT_BOOK_BASE_ID, AMIS_RECENT_BOOK_BASE_ID + AMIS_MAX_ANYTHING, OnFileRecentBook) + ON_COMMAND_RANGE(AMIS_SECTION_DEPTH_BASE_ID, AMIS_SECTION_DEPTH_BASE_ID + AMIS_MAX_ANYTHING, OnNavShowSectionDepth) + ON_COMMAND(ID_AMIS_NEXT_PAGE, OnNavNextPage) + ON_COMMAND(ID_AMIS_PREVIOUS_PAGE, OnNavPrevPage) + ON_COMMAND(ID_AMIS_CLOSE_BOOK, OnFileClose) + ON_COMMAND(ID_AMIS_ABOUT, OnAbout) + ON_COMMAND(ID_AMIS_TOGGLE_SIDEBAR, OnViewSidebarOnoff) + ON_COMMAND(ID_AMIS_ESCAPE, OnPlayEscape) + ON_COMMAND(ID_AMIS_OPEN_URL, OnFileOpenFromUrl) + ON_COMMAND(ID_AMIS_SHOW_READING_OPTIONS, OnSkipInfo) + ON_COMMAND(ID_AMIS_ADD_BOOKMARK, OnAddBookmark) + ON_COMMAND_RANGE(AMIS_BOOKMARKS_BASE_ID, AMIS_BOOKMARKS_BASE_ID + AMIS_MAX_ANYTHING, OnSelectBookmark) + ON_COMMAND(ID_AMIS_GOTO_PAGE, OnGoToPage) + ON_COMMAND(ID_AMIS_BIGGER_FONT, OnIncreaseFontSize) + ON_COMMAND(ID_AMIS_SMALLER_FONT, OnDecreaseFontSize) + ON_COMMAND(ID_AMIS_SEARCH_LOCAL_DRIVES, OnSearchForBooks) + ON_COMMAND(ID_AMIS_LOAD_CD, OnLoadCd) + ON_COMMAND(ID_AMIS_RESET_SPEED, OnSpeedNormal) + ON_COMMAND(ID_AMIS_SLOWER, OnSpeedDown) + ON_COMMAND(ID_AMIS_FASTER, OnSpeedUp) + ON_COMMAND(ID_AMIS_INCREASE_VOLUME, OnVolumeUp) + ON_COMMAND(ID_AMIS_DECREASE_VOLUME, OnVolumeDown) + ON_COMMAND(ID_AMIS_SHOW_PREFERENCES, OnPreferences) + ON_COMMAND(ID_AMIS_SHOW_PUBLICATION_SUMMARY, OnPublicationSummary) + ON_COMMAND(ID_AMIS_TOGGLE_VIEW, OnToggleView) END_MESSAGE_MAP() CAmisApp::CAmisApp() @@ -190,10 +189,7 @@ m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_AMISTYPE)); m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_AMISTYPE)); - //why won't this work?? MainWndParts::Instance()->mpMainFrame->SetIcon(AfxGetApp()->LoadIcon(IDI_AMIS), TRUE); - - amis::gui::MenuManip::Instance()->setupMenusNothingOpen(); amis::gui::MenuManip::Instance()->refreshRecentBooksListMenu(); // The main window has been initialized, so show and update it @@ -444,7 +440,7 @@ { if (mpRecentBooks == NULL) return; - UINT selection = id - BOOK_BASE_ID; + UINT selection = id - AMIS_RECENT_BOOK_BASE_ID; string filename = ""; amis::RecentBookEntry* p_book = NULL; @@ -467,7 +463,7 @@ } void CAmisApp::OnNavShowSectionDepth(UINT id) { - int level = id - SECTION_DEPTH_BASE_ID; + int level = id - AMIS_SECTION_DEPTH_BASE_ID; string log_msg = "Setting section depth to " + level; amis::util::Log::Instance()->writeMessage(log_msg, "CAmisApp::OnNavShowSectionDepth", "AmisGuiMFC2"); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.expandSections(level); @@ -495,7 +491,6 @@ amis::dtb::DtbWithHooks::Instance()->DestroyInstance(); MainWndParts::Instance()->mpMmView->OnDestroy(); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.clearAll(); - amis::gui::MenuManip::Instance()->setupMenusNothingOpen(); mbBookIsOpen = false; } } @@ -617,7 +612,7 @@ void CAmisApp::OnSelectBookmark(UINT id) { int idx; - idx = id - BOOKMARKS_BASE_ID; + idx = id - AMIS_BOOKMARKS_BASE_ID; amis::util::Log::Instance()->writeMessage("Loading bookmark", "CAmisApp::OnSelectBookmark", "AmisGuiMFC2"); amis::dtb::DtbWithHooks::Instance()->loadBookmark(idx); } @@ -641,19 +636,12 @@ else amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnGoToPage", "AmisGuiMFC2"); } - -void CAmisApp::OnToggleContrast() -{ - amis::util::Log::Instance()->writeMessage("Toggle contrast", "CAmisApp::OnToggleContrast", "AmisGuiMFC2"); - bool is_contrast_on = amis::gui::TextRenderBrain::Instance()->toggleContrast(); - MenuManip::Instance()->setViewItemCheckmark(is_contrast_on, ID_MENU_VIEW_CONTRAST); -} void CAmisApp::OnIncreaseFontSize() { amis::util::Log::Instance()->writeMessage("Increase font size", "CAmisApp::OnIncreaseFontSize", "AmisGuiMFC2"); TextRenderBrain::Instance()->increaseFontSize(); } -void CAmisApp::OnResetFontSize() +void CAmisApp::OnDecreaseFontSize() { amis::util::Log::Instance()->writeMessage("Reset font size", "CAmisApp::OnResetFontSize", "AmisGuiMFC2"); TextRenderBrain::Instance()->resetFontSize(); Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -62,18 +62,37 @@ ON_WM_EXITMENULOOP() //ON_WM_KEYDOWN() ON_WM_SYSCOMMAND() - ON_UPDATE_COMMAND_UI(ID_MENU_NAV_NEXTPAGE, OnUpdateCmdUiPageCommands) - ON_UPDATE_COMMAND_UI(ID_MENU_NAV_PREVPAGE, OnUpdateCmdUiPageCommands) - ON_UPDATE_COMMAND_UI(ID_MENU_NAV_GOTOPAGE, OnUpdateCmdUiPageCommands) - ON_UPDATE_COMMAND_UI(ID_MENU_VIEW_CONTRAST, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_MENU_VIEW_LARGEFONT, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_MENU_VIEW_RESETFONT, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_MENU_BMK_ADD, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_MENU_PLAY_FASTER, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_MENU_FILE_CLOSE, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_MENU_INFO_SKIP, OnUpdateCmdUiInfoSkip) - ON_UPDATE_COMMAND_UI(ID_MENU_PLAY_SLOWER, OnUpdateCmdUiPlaySlower) - + ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PAGE, OnUpdateCmdUiPageCommands) + ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_PAGE, OnUpdateCmdUiPageCommands) + ON_UPDATE_COMMAND_UI(ID_AMIS_GOTO_PAGE, OnUpdateCmdUiPageCommands) + ON_UPDATE_COMMAND_UI(ID_AMIS_BIGGER_FONT, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_SMALLER_FONT, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_ADD_BOOKMARK, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_FASTER, OnUpdateCmdUiGeneral) + 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_DECREASE_SECTION_DEPTH, OnUpdateCmdUiGeneral) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -443,7 +462,10 @@ } void CMainFrame::OnUpdateCmdUiPageCommands(CCmdUI* pCmdUi) { - pCmdUi->Enable(amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages()); + if (theApp.isBookOpen()) + pCmdUi->Enable(amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages()); + else + pCmdUi->Enable(false); } void CMainFrame::OnUpdateCmdUiGeneral(CCmdUI* pCmdUi) @@ -452,9 +474,14 @@ } void CMainFrame::OnUpdateCmdUiInfoSkip(CCmdUI* pCmdUi) { - 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()) + { + bool has_reading_options = amis::dtb::DtbWithHooks::Instance()->getCustomTestSet() != NULL && + amis::dtb::DtbWithHooks::Instance()->getCustomTestSet()->getLength() > 0; + pCmdUi->Enable(has_reading_options); + } + else + pCmdUi->Enable(false); } void CMainFrame::OnUpdateCmdUiPlaySlower(CCmdUI* pCmdUi) { Modified: branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -68,7 +68,7 @@ void MainWndParts::toggleSidebar() { mbSidebarVisible = !mbSidebarVisible; - MenuManip::Instance()->setViewItemCheckmark(mbSidebarVisible, ID_MENU_VIEW_SIDEBAR_ONOFF); + MenuManip::Instance()->setViewItemCheckmark(mbSidebarVisible, ID_AMIS_TOGGLE_SIDEBAR); //if the window is hidden, show it if (!mpSidebar->ShowWindow(SW_SHOWNA)) mpMainFrame->ShowControlBar(mpSidebar, TRUE, TRUE); Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -91,7 +91,7 @@ p_entry = theApp.getRecentBooks()->getEntry(i); string filepath = p_entry->mPath.get_url(); CString cstr_filepath = A2T(filepath.c_str()); - BOOL ret = p_menu->AppendMenu(MF_STRING, BOOK_BASE_ID + i, cstr_filepath); + BOOL ret = p_menu->AppendMenu(MF_STRING, AMIS_RECENT_BOOK_BASE_ID + i, cstr_filepath); } } } @@ -128,69 +128,10 @@ { CString menu_label; menu_label.Format(_T("&%d"), i); - BOOL ret = p_menu->AppendMenu(MF_STRING, SECTION_DEPTH_BASE_ID + i, menu_label); + BOOL ret = p_menu->AppendMenu(MF_STRING, AMIS_SECTION_DEPTH_BASE_ID + i, menu_label); } //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); - - //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; @@ -234,7 +175,7 @@ int bmk_index = amis::dtb::DtbWithHooks::Instance()->getBookmarks()->getIndexOf(pBmk); if (bmk_index != -1) - p_menu->AppendMenu(MF_STRING, BOOKMARKS_BASE_ID + bmk_index, menu_label); + p_menu->AppendMenu(MF_STRING, AMIS_BOOKMARKS_BASE_ID + bmk_index, menu_label); } void MenuManip::loadBookmarks(amis::dtb::BookmarkSet* pBookmarks) @@ -261,12 +202,12 @@ //so disable the add bookmark menu option and return if (pBookmarks == NULL) { - p_menu->EnableMenuItem(ID_MENU_BMK_ADD, MF_DISABLED | MF_BYCOMMAND | MF_GRAYED); + p_menu->EnableMenuItem(ID_AMIS_ADD_BOOKMARK, MF_DISABLED | MF_BYCOMMAND | MF_GRAYED); return; } //enable the "add bookmark" item - p_menu->EnableMenuItem(ID_MENU_BMK_ADD, MF_BYCOMMAND | MF_ENABLED); + p_menu->EnableMenuItem(ID_AMIS_ADD_BOOKMARK, MF_BYCOMMAND | MF_ENABLED); //add all the bookmarks for this book for (i=0; i<pBookmarks->getNumberOfItems(); i++) @@ -292,7 +233,7 @@ bool b_BookIsPlaying = MainWndParts::Instance()->mpMainFrame->mbWasPlayingWhenLostFocus || !pauseState; - UiItem* p_uiItem = DataTree::Instance()->findUiItemInContainers(ID_MENU_PLAYPAUSE, (b_BookIsPlaying ? "canPause" : "canPlay")); + UiItem* p_uiItem = DataTree::Instance()->findUiItemInContainers(ID_AMIS_PLAYPAUSE, (b_BookIsPlaying ? "canPause" : "canPlay")); if (p_uiItem != NULL) { Label* accelerator = NULL; if (p_uiItem->getUiItemType() == ACTION) { @@ -338,7 +279,7 @@ //str2.append(info.dwTypeData); } - p_menu->ModifyMenu(0, MF_BYPOSITION, ID_MENU_PLAYPAUSE, str.c_str()); + p_menu->ModifyMenu(0, MF_BYPOSITION, ID_AMIS_PLAYPAUSE, str.c_str()); } } } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -545,18 +545,18 @@ int nRecentBooks = (books ? books->getNumberOfEntries() : 0); string strCondition; - if (ID_MENU_PLAYPAUSE == nItemID) { + if (ID_AMIS_PLAYPAUSE == nItemID) { MmView *view = MainWndParts::Instance()->mpMmView; bool b_BookIsPlaying = MainWndParts::Instance()->mpMainFrame->mbWasPlayingWhenLostFocus || view->isPlaying(); // BOOK Audio Player strCondition = (b_BookIsPlaying ? "canPause" : "canPlay"); - } else if (ID_FILE_RECENT_EMPTY == nItemID || (nItemID >= BOOK_BASE_ID && nItemID < BOOK_BASE_ID + nRecentBooks)) { + } else if (ID_AMIS_RECENT_BOOKS_EMPTY == nItemID || (nItemID >= AMIS_RECENT_BOOK_BASE_ID && nItemID < AMIS_RECENT_BOOK_BASE_ID + nRecentBooks)) { if (nRecentBooks > 0) { - strCondition = "BOOK_BASE_IDXX"; // Removing "XX" means that the list-repeat form AccessibleUiData.xml is used => the problem is that no prompt variable resolver exists for the list of recent books. Instead, it's all hardcoded below. + strCondition = "AMIS_RECENT_BOOK_BASE_IDXX"; // Removing "XX" means that the list-repeat form AccessibleUiData.xml is used => the problem is that no prompt variable resolver exists for the list of recent books. Instead, it's all hardcoded below. } else { - strCondition = "ID_FILE_RECENT_EMPTY"; // This condition is never accepted by AccessibleDataUi.xml, so it's kinda of useless. + strCondition = "ID_AMIS_RECENT_BOOKS_EMPTY"; // This condition is never accepted by AccessibleDataUi.xml, so it's kinda of useless. } } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -38,42 +38,42 @@ string str_id; - if (firstItemId == ID_MENU_FILE_OPEN) + if (firstItemId == ID_AMIS_OPEN_FILE) { str_id = "file"; } - else if (firstItemId == ID_FILE_RECENT_EMPTY || - firstItemId == BOOK_BASE_ID) { + else if (firstItemId == ID_AMIS_RECENT_BOOKS_EMPTY || + firstItemId == AMIS_RECENT_BOOK_BASE_ID) { str_id = "recentBooksList"; } - else if(firstItemId == ID_MENU_VIEW_SIDEBAR_ONOFF) + else if(firstItemId == ID_AMIS_TOGGLE_SIDEBAR) { str_id = "view"; } - else if(firstItemId == ID_MENU_PLAYPAUSE) + else if(firstItemId == ID_AMIS_PLAYPAUSE) { str_id = "play"; } - else if(firstItemId == ID_MENU_NAV_PREVSECTION) + else if(firstItemId == ID_AMIS_PREVIOUS_SECTION) { str_id = "navigate"; } - else if(firstItemId == ID_EMPTY || - firstItemId == SECTION_DEPTH_BASE_ID + 1) + else if(firstItemId == ID_AMIS_SECTION_DEPTH_EMPTY || + firstItemId == AMIS_SECTION_DEPTH_BASE_ID + 1) { str_id = "sectiondepth"; } - else if(firstItemId == ID_MENU_BMK_ADD) + else if(firstItemId == ID_AMIS_ADD_BOOKMARK) { str_id = "bookmarks"; } - else if(firstItemId == ID_MENU_INFO_SKIP) + else if(firstItemId == ID_AMIS_SHOW_READING_OPTIONS) { str_id = "info"; } - else if(firstItemId == ID_MENU_HELP_CONTENTS) + else if(firstItemId == ID_AMIS_SHOW_HELP_CONTENTS) { str_id = "help"; } @@ -284,9 +284,10 @@ amis::RecentBooks* books = theApp.getRecentBooks(); int nRecentBooks = (books ? books->getNumberOfEntries() : 0); - if (nRecentBooks > 0 && (nItemID >= BOOK_BASE_ID && nItemID < BOOK_BASE_ID + nRecentBooks)) + if (nRecentBooks > 0 && (nItemID >= AMIS_RECENT_BOOK_BASE_ID && + nItemID < AMIS_RECENT_BOOK_BASE_ID + nRecentBooks)) { - int idx = nItemID - BOOK_BASE_ID; + int idx = nItemID - AMIS_RECENT_BOOK_BASE_ID; amis::RecentBookEntry* p_entry = theApp.getRecentBooks()->getEntry(idx); @@ -335,10 +336,10 @@ } */ } else - if (nItemID >= BOOKMARKS_BASE_ID && nItemID <= - BOOKMARKS_BASE_ID + MAX_ANYTHING) + if (nItemID >= AMIS_BOOKMARKS_BASE_ID && nItemID <= + AMIS_BOOKMARKS_BASE_ID + AMIS_MAX_ANYTHING) { - int idx = nItemID - BOOKMARKS_BASE_ID; + int idx = nItemID - AMIS_BOOKMARKS_BASE_ID; //amis::dtb::BookmarkSet* p_bmks = amis::dtb::DtbWithHooks::Instance()->getBookmarks(); @@ -375,43 +376,44 @@ } } else - if (nItemID > SECTION_DEPTH_BASE_ID && nItemID <= (SECTION_DEPTH_BASE_ID + MAX_ANYTHING)) + if (nItemID > AMIS_SECTION_DEPTH_BASE_ID + && nItemID <= (AMIS_SECTION_DEPTH_BASE_ID + AMIS_MAX_ANYTHING)) { string strPrompt; switch (nItemID) { - case (SECTION_DEPTH_BASE_ID+1): { + case (AMIS_SECTION_DEPTH_BASE_ID+1): { strPrompt = "numeric_one"; break; } - case (SECTION_DEPTH_BASE_ID+2): { + case (AMIS_SECTION_DEPTH_BASE_ID+2): { strPrompt = "numeric_two"; break; } - case (SECTION_DEPTH_BASE_ID+3): { + case (AMIS_SECTION_DEPTH_BASE_ID+3): { strPrompt = "numeric_three"; break; } - case (SECTION_DEPTH_BASE_ID+4): { + case (AMIS_SECTION_DEPTH_BASE_ID+4): { strPrompt = "numeric_four"; break; } - case (SECTION_DEPTH_BASE_ID+5): { + case (AMIS_SECTION_DEPTH_BASE_ID+5): { strPrompt = "numeric_five"; break; } - case (SECTION_DEPTH_BASE_ID+6): { + case (AMIS_SECTION_DEPTH_BASE_ID+6): { strPrompt = "numeric_six"; break; } - case (SECTION_DEPTH_BASE_ID+7): { + case (AMIS_SECTION_DEPTH_BASE_ID+7): { strPrompt = "numeric_seven"; break; } - case (SECTION_DEPTH_BASE_ID+8): { + case (AMIS_SECTION_DEPTH_BASE_ID+8): { strPrompt = "numeric_eight"; break; } - case (SECTION_DEPTH_BASE_ID+9): { + case (AMIS_SECTION_DEPTH_BASE_ID+9): { strPrompt = "numeric_nine"; break; } Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-02-29 03:15:09 UTC (rev 2353) @@ -396,7 +396,7 @@ CRect new_rect(left, top, right, bottom); p_nav_list->Create(LVS_LIST | LVS_SINGLESEL | LVA_ALIGNLEFT, new_rect, this, - NAVLIST_BASE_ID + mNumTabs); + AMIS_NAVLIST_BASE_ID + mNumTabs); p_nav_list->SetExtendedStyle(LVS_SHAREIMAGELISTS); AddSzControl(*p_nav_list, mdResize, mdResize); Deleted: branches/amis3/DefaultLangpack/AmisLangpack/resource.h.ini =================================================================== --- branches/amis3/DefaultLangpack/AmisLangpack/resource.h.ini 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/DefaultLangpack/AmisLangpack/resource.h.ini 2008-02-29 03:15:09 UTC (rev 2353) @@ -1,158 +0,0 @@ -; -[resources] - - - - -IDD_ABOUTBOX=100 -IDS_PROPSHT_CAPTION=102 -IDD_SIDEBAR=103 -IDD_PROPPAGE2=106 -IDD_PROPPAGE1=110 -IDD_PROPPAGE4=112 -ID_FOCUS_ON_SIDEBAR=123 -ID_HEAR_LAST_PROMPT=124 -ID_HEAR_INSTRUCTIONS=125 -ID_HEAR_LAST_TEXT_ENTRY=126 -ID_FOCUS_ON_TEXT=127 -IDR_MAINFRAME=128 -IDR_AMISTYPE=129 -ID_INCREASE_SECTION_DEPTH=130 -ID_DECREASE_SECTION_DEPTH=131 -ID_RESET_HIGHLIGHT_COLORS=132 -ID_TOGGLE_AUDIO_CONTENT_PLAYBACK=133 -ID_TOGGLE_AUDIO_SELFVOICING_PLAYBACK 134 -IDD_FIND=147 -VIEW_MENU_BASE_ID=150 -IDD_SKIP=153 -IDI_AMIS=164 -IDD_SEARCHDAISY=177 -IDD_GOTOPAGE=180 -IDD_CDSEARCH=181 -IDD_FULLSUMMARY=182 -IDD_CURRENTPOSITION=183 -IDD_NAVIGATIONOPTIONS=184 -IDI_LANGICON=185 -IDD_PROPPAGE3=185 -IDB_BOOKSHELFMAG=186 -BOOK_BASE_ID=200 -SECTION_DEPTH_BASE_ID=250 -NAVLIST_BASE_ID=300 -ID_MENU_GOTO_PAGE=352 -ID_MENU_FIND_IN_TEXT=353 -BOOKMARKS_BASE_ID=400 -IDC_TREE=1000 -IDC_TAB=1001 -IDC_SEARCHSTRING=1003 -IDC_SUMMARY=1004 -IDC_BASIC=1010 -IDC_BTN_BORDER=1011 -IDC_BTN_TEXTBG=1012 -IDC_BTN_PAGEBG=1013 -IDC_LIST_PAGE=1015 -IDC_TTSVOICE=1020 -IDC_BTN_RESETCOLORS=1028 -IDC_STARTSEARCH=1030 -IDC_BTN_TEXTFG=1030 -IDC_BTN_PAGEFG=1032 -IDC_SELFVOICING=1034 -IDC_PROMPTONBASICVIEW=1036 -IDC_BMKDIR=1037 -IDC_BROWSE=1038 -IDC_LOADLASTDTB=1041 -IDC_STOPSEARCH=1048 -IDC_PICTURE=1050 -IDC_SEARCHING=1051 -IDC_FILESFOUND=1052 -IDC_SKIPS=1054 -IDC_PAGENUM=1055 -IDC_SEARCHPATH=1056 -IDC_BOOKLIST=1058 -IDC_OPENBOOK=1059 -IDC_CANCEL=1060 -IDC_LANGICON=1065 -IDC_BTN_SELECTLANG=1066 -IDC_CANCELBUTTON=1067 -IDC_FINDNEXT=1068 -IDC_FINDPREV=1069 -IDC_BMKDIRBROWSE=1069 -IDC_BMKDIRLABEL=1071 -IDC_SELTTSLABEL=1072 -IDC_PHRASES=1073 -IDC_CONTRAST=1074 -IDC_LISTCAPTION=1075 -IDC_PHRASEPREVIEW=1075 -IDC_CONTRASTPREVIEW=1076 -IDC_AMISNAME=1076 -IDC_PAGEFG=1077 -IDC_COPYRIGHT=1077 -IDC_PAGEBG=1078 -IDC_TEXTFG=1079 -IDC_TEXTBG=1080 -IDC_BORDER=1081 -ID_MENU_FIND_IN_TEXT_NEXT=9000 -IDC_LANGLIST=9001 -ID_MENU_FIND_IN_TEXT_PREV=9001 -IDC_CURRLANG=9002 -IDC_VERSION=9006 -IDC_VERSIONNOTE=9007 -ID_MENU_FILE_LOADCD=32771 -ID_MENU_FILE_SEARCHDRIVE=32772 -ID_MENU_VIEW_BASIC=32776 -ID_MENU_VIEW_LARGEFONT=32778 -ID_MENU_VIEW_RESET=32779 -ID_MENU_PLAY_PLAY=32787 -ID_MENU_PLAY_PAUSE=32788 -ID_MENU_PLAY_FASTER=32789 -ID_MENU_PLAY_NORMALSPEED=32791 -ID_MENU_HELP_HELP=32798 -ID_MENU_INFO_SUMMARY=32800 -ID_MENU_FILE_PREFERENCES=32802 -ID_MENU_INFO_NAVOPTIONS=32804 -ID_MENU_INFO_CURRENTPOSITION=32805 -ID_MENU_VIEW_RESETFONT=32814 -ID_VIEW_CONTRAST=32818 -ID_MENU_VIEW_CONTRAST=32818 -ID_MENU_PLAY_ESCAPE=32819 -ID_MENU_INFO_SKIP=32820 -ID_MENU_HELP_CONTENTS=32821 -ID_MENU_PLAY_SLOWER=32822 -ID_MENU_FILE_EXIT=32823 -ID_MENU_VIEW_SIDEBAR_ONOFF=32825 -ID_FILE_RECENT_EMPTY=32828 -ID_EMPTY=32830 -ID_MENU_NAV_NEXTSECTION=32833 -ID_MENU_NAV_PREVSECTION=32834 -ID_MENU_NAV_PREVPHRASE=32835 -ID_MENU_NAV_NEXTPHRASE=32836 -ID_MENU_BMK_ADD=32837 -ID_MENU_FILE_OPEN=32838 -ID_MENU_HELP_ABOUT=32839 -ID_MENU_PLAY_VOLUP=32844 -ID_MENU_PLAY_VOLDOWN=32845 -ID_MENU_NAV_PREVPAGE=32854 -ID_MENU_NAV_NEXTPAGE=32856 -ID_MENU_NAV_FINDINTEXT=32859 -ID_MENU_NAV_GOTOPAGE=32860 -ID_MENU_PLAYPAUSE=32865 -IDS_NOSKIP=61245 -IDS_SELFOLDER_TITLE=61258 -IDS_SELFOLDER_INSTR=61259 -IDS_FOLDERDOESNOTEXIST=61279 -IDS_FOLDERINVALID=61280 -IDS_FOLDERCANTBECREATED=61281 -IDS_FILE_OPEN_DAISY_BOOKS=61288 - - -ID_MENU_FILE_CLOSE=32871 -ID_MENU_FILE_OPENURL=32870 - - - -_APS_3D_CONTROLS=1 -_APS_NEXT_RESOURCE_VALUE=190 -_APS_NEXT_COMMAND_VALUE=32866 -_APS_NEXT_CONTROL_VALUE=1078 -_APS_NEXT_SYMED_VALUE=140 - - Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-02-28 23:13:10 UTC (rev 2352) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-02-29 03:15:09 UTC (rev 2353) @@ -7,7 +7,7 @@ <text id="t1">File</text> <audio src="./audio/002_File.mp3"/> </caption> - <action mfcid="ID_MENU_FILE_OPEN" widget="menuItem toolbarItem"> + <action mfcid="ID_AMIS_OPEN_FILE" widget="menuItem toolbarItem"> <note>This is going to be a menu item and a toolbar item</note> <icon src="./open.png" type="smallIcon"/> <caption> @@ -29,7 +29,7 @@ </mnemonic> </action> <!--new action--> - <action mfcid="ID_MENU_FILE_OPENURL" widget="menuItem"> + <action mfcid="ID_AMIS_OPEN_URL" widget="menuItem"> <note>This is going to be a menu item</note> <icon src="./open.png" type="smallIcon"/> <caption> @@ -50,7 +50,7 @@ </mnemonic> </action> <!--new action--> - <action mfcid="ID_MENU_FILE_CLOSE" widget="menuItem"> + <action mfcid="ID_AMIS_CLOSE_BOOK" widget="menuItem"> <note>This is going to be a menu item</note> <icon src="./close.png" type="smallIcon"/> <caption> @@ -66,7 +66,7 @@ <audio src=""/> </mnemonic> </action> - <action mfcid="ID_MENU_FILE_LOADCD" widget="menuItem toolbarItem"> + <action mfcid="ID_AMIS_LOAD_CD" widget="menuItem toolbarItem"> <note>This is going to be a menu item and a toolbar item</note> <icon src="./settings/img/cd3.ico" type="smallIcon"/> <icon src="./settings/img/cd_big.ico" type="largeIcon"/> @@ -87,7 +87,7 @@ <audio src="./audio/010_L.mp3"/> </mnemonic> </action> - <action mfcid="ID_MENU_FILE_SEARCHDRIVE" widget="menuItem"> + <action mfcid="ID_AMIS_SEARCH_LOCAL_DRIVES" widget="menuItem"> <note>This is going to be a menu item</note> <caption> <!--changed text--> @@ -103,7 +103,7 @@ <audio src="./audio/013_S.mp3"/> </mnemonic> </action> - <action mfcid="ID_MENU_FILE_PREFERENCES" widget="menuItem"> + <action mfcid="ID_AMIS_SHOW_PREFERENCES" widget="menuItem"> <note>This is going to be a menu item</note> <caption> <text id="t13">Preferences...</text> @@ -125,7 +125,7 @@ <audio src="./audio/017_Recent.mp3"/> </caption> <switch element="action"> - <action condition="ID_FILE_RECENT_EMPTY" mfcid="ID_FILE_RECENT_EMPTY" widget="menuItem"> + <action condition="ID_AMIS_RECENT_BOOKS_EMPTY" mfcid="ID_AMIS_RECENT_BOOKS_EMPTY" widget="menuItem"> <note>This is going to be a menu item</note> <caption> <text id="t17">Empty</text> @@ -136,7 +136,7 @@ <audio src="./audio/019_There_are_no_recently_read_boo.mp3"/> </description> </action> - <action condition="BOOK_BASE_ID" mfcid="BOOK_BASE_ID" widget="menuItem"> + <action condition="AMIS_RECENT_BOOK_BASE_ID" mfcid="AMIS_RECENT_BOOK_BASE_ID" widget="menuItem"> <note>This is going to be a menu item</note> <list repeat="yes"> <caption> @@ -150,7 +150,7 @@ <audio src="./audio/020_R.mp3"/> </mnemonic> </container> - <action mfcid="ID_MENU_FILE_EXIT" widget="menuItem"> + <action mfcid="ID_AMIS_EXIT" widget="menuItem"> <note>This is going to be a menu item</note> <caption> <text id="t20">Exit</text> @@ -184,7 +184,7 @@ <text id="t26">View</text> <audio src="./audio/027_View.mp3"/> </caption> - <action mfcid="ID_MENU_VIEW_SIDEBAR_ONOFF" widget="menuItem"> + <action mfcid="ID_AMIS_TOGGLE_SIDEBAR" widget="menuItem"> <note>This is going to be a menu item</note> <caption> <text id="t27">Sidebar</text> @@ -199,7 +199,7 @@ <audio src="./audio/030_S.mp3"/> </mnemonic> </action> - <action mfcid="ID_MENU_VIEW_BASIC" widget="menuItem"> + <action mfcid="ID_AMIS_TOGGLE_VIEW" widget="menuItem"> <note>This is going to be a menu item</note> <caption> <!--changed text--> @@ -226,20 +226,19 @@ <text id="xx">Page Style</text> <audio src=""/> </caption> - ... [truncated message content] |
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. |
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: <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: <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-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: <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: <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: <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 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: <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: <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 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: <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 05:25:19
|
Revision: 2384 http://amis.svn.sourceforge.net/amis/?rev=2384&view=rev Author: marisademeglio Date: 2008-03-02 21:25:23 -0800 (Sun, 02 Mar 2008) Log Message: ----------- Fontsize buttons now enable/disable like they should Page styles work too Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h branches/amis3/AmisGuiMFC2/resource.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp branches/amis3/bin/settings/basicToolbar.xml branches/amis3/bin/settings/css/amis.css branches/amis3/bin/settings/resource.h.ini Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-03 05:25:23 UTC (rev 2384) @@ -182,8 +182,6 @@ BEGIN MENUITEM "None", ID_AMIS_NO_PAGE_STYLES , CHECKED - MENUITEM "sample 1", 351 - MENUITEM "sample 2", 352 END MENUITEM "Bi&gger Font", ID_AMIS_BIGGER_FONT MENUITEM "S&maller Font", ID_AMIS_SMALLER_FONT Modified: branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-03-03 05:25:23 UTC (rev 2384) @@ -99,6 +99,9 @@ afx_msg void OnPreferences(); afx_msg void OnPublicationSummary(); afx_msg void OnToggleView(); + afx_msg void OnClearPageStyle(); + afx_msg void OnApplyPageStyle(UINT); + afx_msg void OnNextPageStyle(); protected: HMENU m_hMDIMenu; HACCEL m_hMDIAccel; @@ -108,6 +111,7 @@ void initializeSelfVoicing(); void openBook(const ambulant::net::url*); void openLastReadBook(); + void updateFontSizeButtons(); std::string mAppPath; std::string mLocalizationDll; ambulant::net::url mURL; Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-03 05:25:23 UTC (rev 2384) @@ -78,6 +78,9 @@ afx_msg void OnUpdateCmdUiCheckSidebar(CCmdUI*); afx_msg void OnUpdateCmdUiFindInText(CCmdUI*); afx_msg void OnUpdateCmdUiPlayPause(CCmdUI*); + afx_msg void OnUpdateCmdUiPageStyle(CCmdUI*); + afx_msg void OnUpdateCmdUiBiggerFont(CCmdUI*); + afx_msg void OnUpdateCmdUiSmallerFont(CCmdUI*); DECLARE_MESSAGE_MAP() public: afx_msg void OnSize(UINT nType, int cx, int cy); Modified: branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2008-03-03 05:25:23 UTC (rev 2384) @@ -43,6 +43,7 @@ void addBookmark(amis::dtb::PositionMark*); void loadBookmarks(amis::dtb::BookmarkSet*); void setupNavigationOptions(); + void addPageStyles(); private: static MenuManip* pinstance; }; Modified: branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h 2008-03-03 05:25:23 UTC (rev 2384) @@ -49,13 +49,19 @@ void resetFontSize(); void increaseFontSize(); - bool toggleContrast(); - bool isContrastOn(); + void decreaseFontSize(); + int getFontLevel(); + int getMaxFontLevel(); void gotoUriTarget(amis::TextNode*); void gotoUriTarget(std::string url); - void redoPageColors(bool bDisableContrast=false); + void applyPageStyle(int); + void clearPageStyle(); + void applyNextPageStyle(); + int getCurrentCustomStyleIndex(); + + void redoPageColors(); wstring getCurrentText(); void webDocumentComplete(); @@ -63,8 +69,6 @@ void saveElementText(IHTMLElement*); void setFontSize(int); void showElementAtId(string); - void htmlContrastOn(); - void htmlContrastOff(); void unHighlightPreviousElement(); void setHighlightColors(IHTMLElement*); void redoHighlightColors(); @@ -75,7 +79,6 @@ int mFontSize; bool mbWaitForDocumentLoad; - bool mbContrastOn; ambulant::net::url mCurrentUrl; string mTextElmId; wstring mCurrentElmText; @@ -83,9 +86,10 @@ VARIANT mUnhighlightedBG; VARIANT mUnhighlightedFG; IHTMLStyleSheet* mpFontCss; - IHTMLStyleSheet* mpContrastCss; + IHTMLStyleSheet* mpStyleCss; IHTMLStyleSheet* mpUserCss; - + int mCurrentStyleIdx; + bool mbStyleOn; private: static TextRenderBrain* pinstance; Modified: branches/amis3/AmisGuiMFC2/resource.h =================================================================== --- branches/amis3/AmisGuiMFC2/resource.h 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/resource.h 2008-03-03 05:25:23 UTC (rev 2384) @@ -14,7 +14,6 @@ #define ID_AMIS_RESET_HIGHLIGHT_COLORS 132 #define ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK 133 #define ID_AMIS_TOGGLE_AUDIO_SELFVOICING_PLAYBACK 134 -#define ID_AMIS_NEXT_PAGE_STYLE 142 #define IDD_FIND 147 #define AMIS_VIEW_MENU_BASE_ID 150 #define IDD_SKIP 153 @@ -32,6 +31,7 @@ #define AMIS_NAVLIST_BASE_ID 300 #define AMIS_PAGE_STYLE_BASE_ID 350 #define AMIS_BOOKMARKS_BASE_ID 400 +#define ID_AMIS_NEXT_PAGE_STYLE 450 #define ID_AMBULANT_PLAY 700 #define IDC_TREE 1000 #define IDC_TAB 1001 Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-03 05:25:23 UTC (rev 2384) @@ -108,6 +108,9 @@ ON_COMMAND(ID_AMIS_SHOW_PREFERENCES, OnPreferences) ON_COMMAND(ID_AMIS_SHOW_PUBLICATION_SUMMARY, OnPublicationSummary) ON_COMMAND(ID_AMIS_TOGGLE_VIEW, OnToggleView) + ON_COMMAND(ID_AMIS_NO_PAGE_STYLES, OnClearPageStyle) + ON_COMMAND_RANGE(AMIS_PAGE_STYLE_BASE_ID, AMIS_PAGE_STYLE_BASE_ID + AMIS_MAX_ANYTHING, OnApplyPageStyle) + ON_COMMAND(ID_AMIS_NEXT_PAGE_STYLE, OnNextPageStyle) END_MESSAGE_MAP() CAmisApp::CAmisApp() @@ -200,7 +203,7 @@ MainWndParts::Instance()->mpMainFrame->SetIcon(AfxGetApp()->LoadIcon(IDI_AMIS), TRUE); amis::gui::MenuManip::Instance()->refreshRecentBooksListMenu(); - + amis::gui::MenuManip::Instance()->addPageStyles(); // The main window has been initialized, so show and update it pFrame->ShowWindow(SW_SHOWMAXIMIZED); pFrame->UpdateWindow(); @@ -656,11 +659,13 @@ { amis::util::Log::Instance()->writeMessage("Increase font size", "CAmisApp::OnIncreaseFontSize", "AmisGuiMFC2"); TextRenderBrain::Instance()->increaseFontSize(); + updateFontSizeButtons(); } void CAmisApp::OnDecreaseFontSize() { amis::util::Log::Instance()->writeMessage("Reset font size", "CAmisApp::OnResetFontSize", "AmisGuiMFC2"); - TextRenderBrain::Instance()->resetFontSize(); + TextRenderBrain::Instance()->decreaseFontSize(); + updateFontSizeButtons(); } void CAmisApp::OnSearchForBooks() { @@ -746,7 +751,6 @@ else amis::util::Log::Instance()->writeMessage("Dialog cancelled", "CAmisApp::OnPreferences", "AmisGuiMFC2"); } - void CAmisApp::OnPublicationSummary() { dialogs::PublicationSummaryDialog summary; @@ -754,11 +758,24 @@ summary.setBook(amis::dtb::DtbWithHooks::Instance()); summary.DoModal(); } - void CAmisApp::OnToggleView() { MainWndParts::Instance()->toggleViewMode(); } +void CAmisApp::OnClearPageStyle() +{ + TextRenderBrain::Instance()->clearPageStyle(); +} +void CAmisApp::OnApplyPageStyle(UINT id) +{ + int idx; + idx = id - AMIS_PAGE_STYLE_BASE_ID; + TextRenderBrain::Instance()->applyPageStyle(idx); +} +void CAmisApp::OnNextPageStyle() +{ + TextRenderBrain::Instance()->applyNextPageStyle(); +} /*************************************************** * (MED) I moved these functions out of the menu handler area *****************************************************/ @@ -770,20 +787,7 @@ */ void CAmisApp::setPauseState(bool pauseState) { - - //TODO: re-add toolbar - //if (MainWndParts::Instance()->mpMainFrame->m_wndDefaultToolbar) - { - //MainWndParts::Instance()->mpMainFrame->m_wndDefaultToolbar.setPauseState(pauseState); - } - - //if (MainWndParts::Instance()->mpMainFrame->m_wndBasicToolbar) - { - //MainWndParts::Instance()->mpMainFrame->m_wndBasicToolbar.setPauseState(pauseState); - } - amis::gui::MenuManip::Instance()->setPauseState(pauseState); - MainWndParts::Instance()->updateTitlePlayState(!pauseState); } @@ -832,3 +836,24 @@ afterModalBox(b); } +void CAmisApp::updateFontSizeButtons() +{ + int font_level = TextRenderBrain::Instance()->getFontLevel(); + int max = TextRenderBrain::Instance()->getMaxFontLevel(); + bool can_increase = true; + bool can_decrease = true; + if (font_level == 0) + { + can_decrease = false; + can_increase = true; + } + else if (font_level == max) + { + can_decrease = true; + can_increase = false; + } + MainWndParts::Instance()->mpDefaultToolbar->enable(ID_AMIS_BIGGER_FONT, can_increase); + MainWndParts::Instance()->mpBasicToolbar->enable(ID_AMIS_BIGGER_FONT, can_increase); + MainWndParts::Instance()->mpDefaultToolbar->enable(ID_AMIS_SMALLER_FONT, can_decrease); + MainWndParts::Instance()->mpBasicToolbar->enable(ID_AMIS_SMALLER_FONT, can_decrease); +} \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-03 05:25:23 UTC (rev 2384) @@ -27,6 +27,7 @@ #include "Preferences.h" #include "DtbWithHooks.h" #include "gui/MenuManip.h" +#include "gui/TextRenderBrain.h" #include "gui/self-voicing/directshow/dx_audio_player.h" @@ -66,8 +67,6 @@ ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PAGE, OnUpdateCmdUiPageCommands) ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_PAGE, OnUpdateCmdUiPageCommands) ON_UPDATE_COMMAND_UI(ID_AMIS_GOTO_PAGE, OnUpdateCmdUiPageCommands) - ON_UPDATE_COMMAND_UI(ID_AMIS_BIGGER_FONT, OnUpdateCmdUiGeneral) - ON_UPDATE_COMMAND_UI(ID_AMIS_SMALLER_FONT, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_ADD_BOOKMARK, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_FASTER, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_CLOSE_BOOK, OnUpdateCmdUiGeneral) @@ -75,7 +74,7 @@ ON_UPDATE_COMMAND_UI(ID_AMIS_SLOWER, OnUpdateCmdUiPlaySlower) 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_NO_PAGE_STYLES, OnUpdateCmdUiPageStyle) 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) @@ -86,10 +85,13 @@ 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 + //TODO: make these two 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) + ON_UPDATE_COMMAND_UI_RANGE(AMIS_PAGE_STYLE_BASE_ID, AMIS_PAGE_STYLE_BASE_ID + AMIS_MAX_ANYTHING, OnUpdateCmdUiPageStyle) + ON_UPDATE_COMMAND_UI(ID_AMIS_SMALLER_FONT, OnUpdateCmdUiSmallerFont) + ON_UPDATE_COMMAND_UI(ID_AMIS_BIGGER_FONT, OnUpdateCmdUiBiggerFont) //}}AFX_MSG_MAP ON_WM_SIZE() END_MESSAGE_MAP() @@ -500,7 +502,43 @@ else updateUiCommandState(pCmdUi, false); } +void amis::gui::CMainFrame::OnUpdateCmdUiPageStyle(CCmdUI* pCmdUi) +{ + if (theApp.isBookOpen()) + { + int curr = TextRenderBrain::Instance()->getCurrentCustomStyleIndex(); + + if (curr == -1) + { + if (pCmdUi->m_nID == ID_AMIS_NO_PAGE_STYLES) pCmdUi->SetCheck(1); + else pCmdUi->SetCheck(0); + } + else + { + if (curr == pCmdUi->m_nID - AMIS_PAGE_STYLE_BASE_ID) pCmdUi->SetCheck(1); + else pCmdUi->SetCheck(0); + } + updateUiCommandState(pCmdUi, true); + } + else + updateUiCommandState(pCmdUi, false); +} +void amis::gui::CMainFrame::OnUpdateCmdUiSmallerFont(CCmdUI* pCmdUi) +{ + if (theApp.isBookOpen() && TextRenderBrain::Instance()->getFontLevel() > 0) + updateUiCommandState(pCmdUi, true); + else + updateUiCommandState(pCmdUi, false); +} +void amis::gui::CMainFrame::OnUpdateCmdUiBiggerFont(CCmdUI* pCmdUi) +{ + if (theApp.isBookOpen() && TextRenderBrain::Instance()->getFontLevel() < TextRenderBrain::Instance()->getMaxFontLevel()) + updateUiCommandState(pCmdUi, true); + else + updateUiCommandState(pCmdUi, false); +} +//TODO: this doesn't work void amis::gui::CMainFrame::OnSize(UINT nType, int cx, int cy) { CMDIFrameWnd::OnSize(nType, cx, cy); Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-03 05:25:23 UTC (rev 2384) @@ -29,7 +29,8 @@ #include "RecentBooks.h" #include "dtb/nav/NavModel.h" #include "gui/TextRenderBrain.h" - +#include "util/FilePathTools.h" +#include "Preferences.h" using namespace amis::gui; MenuManip* MenuManip::pinstance = 0; @@ -221,18 +222,15 @@ void MenuManip::setPauseState(bool pauseState) { - CMenu* p_menu = NULL; p_menu = MainWndParts::Instance()->mpMainFrame->GetMenu(); - if (p_menu == NULL) - { - return; - } - + if (p_menu == NULL) return; + p_menu = p_menu->GetSubMenu(2); assert(p_menu); - bool b_BookIsPlaying = MainWndParts::Instance()->mpMainFrame->mbWasPlayingWhenLostFocus || !pauseState; + bool b_BookIsPlaying = MainWndParts::Instance()->mpMainFrame->mbWasPlayingWhenLostFocus + || !pauseState; UiItem* p_uiItem = DataTree::Instance()->findUiItemInContainers(ID_AMIS_PLAYPAUSE, (b_BookIsPlaying ? "canPause" : "canPlay")); if (p_uiItem != NULL) { @@ -251,7 +249,6 @@ TextNodeSV* textNode = pair->getText(); if (textNode != NULL) { wstring str = textNode->getTextString(); - if (mnemonic != NULL) { TextAudioPair* pair = mnemonic->getContents(); if (pair != NULL) { @@ -268,8 +265,6 @@ if (accelerator != NULL) { str.append(_T("\t")); - //char* text = accelerator.c_str(); - //str.append(accelerator.c_str()); TextAudioPair* pair = accelerator->getContents(); if (pair != NULL) { TextNodeSV* node = pair->getText(); @@ -277,25 +272,39 @@ str.append(node->getTextString()); } } - - //str2.append(info.dwTypeData); } p_menu->ModifyMenu(0, MF_BYPOSITION, ID_AMIS_PLAYPAUSE, str.c_str()); } } } } +} - /*if (pauseState) +void MenuManip::addPageStyles() +{ + USES_CONVERSION; + + CMenu* p_menu = NULL; + p_menu = MainWndParts::Instance()->mpMainFrame->GetMenu(); + //exit if no menu is present..this could mean we are in basic view mode + if (p_menu == NULL) return; + //get to "view" + p_menu = p_menu->GetSubMenu(1); + //get to "page styles" + p_menu = p_menu->GetSubMenu(3); + int num_entries = p_menu->GetMenuItemCount(); + int i; + //remove all but the first one ("None") + for (i=num_entries-1; i>=1; i--) + p_menu->RemoveMenu(i, MF_BYPOSITION); + + //add all the page styles in the settings/css/customStyles folder + amis::UrlList custom_styles = *Preferences::Instance()->getCustomCssFiles(); + for (i=0; i<custom_styles.size(); i++) { - // If book is paused, then we display a "play" action - p_menu->ModifyMenu(0, MF_BYPOSITION, ID_MENU_PLAYPAUSE, L"&Play\tSpace"); + CString menu_label; + string file_name = amis::util::FilePathTools::getFileName(custom_styles[i].get_file()); + menu_label = A2T(file_name.c_str()); + p_menu->AppendMenu(MF_STRING, AMIS_PAGE_STYLE_BASE_ID + i, menu_label); } - else - { - // If book is playing, then we display a "pause" action - p_menu->ModifyMenu(0, MF_BYPOSITION, ID_MENU_PLAYPAUSE, L"&Pause\tSpace"); - }*/ - - } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-03 05:25:23 UTC (rev 2384) @@ -52,30 +52,22 @@ { mFontSize = 0; mbWaitForDocumentLoad = false; - mbContrastOn = false; mpPreviousElm = NULL; - + mbStyleOn = false; + mCurrentStyleIdx = -1; VariantInit(&mUnhighlightedFG); VariantInit(&mUnhighlightedBG); mCurrentUrl = ambulant::net::url(); mpFontCss = NULL; - mpContrastCss = NULL; + mpStyleCss = NULL; mpUserCss = NULL; } TextRenderBrain::~TextRenderBrain() { - - //these crash.. - - /*if (mpFontCss) delete mpFontCss; - if (mpContrastCss) delete mpContrastCss; - if (mpUserCss) delete mpUserCss; - */ - - //TODO: should delete variants too + //TODO: should delete variants } void TextRenderBrain::gotoUriTarget(amis::TextNode* pText) @@ -148,7 +140,7 @@ //refresh font size and contrast settings for the newly loaded page if (mFontSize > 0) setFontSize(mFontSize); - if (mbContrastOn) htmlContrastOn(); + if (mbStyleOn) applyPageStyle(mCurrentStyleIdx); showElementAtId(mTextElmId); } @@ -287,50 +279,69 @@ p_style->put_backgroundColor(var_bg); p_style->put_color(var_fg); } - -bool TextRenderBrain::isContrastOn() +int TextRenderBrain::getFontLevel() { - return mbContrastOn; + return mFontSize; } -//turns the contrast on or off. returns the new state of the contrast (true = on) -bool TextRenderBrain::toggleContrast() +int TextRenderBrain::getMaxFontLevel() { - //MainWndParts::Instance()->mpSidebar->m_wndDlg.toggleContrast(); - - if (mbContrastOn) htmlContrastOff(); - else htmlContrastOn(); - - return mbContrastOn; + return 4; } -void TextRenderBrain::htmlContrastOn() +int TextRenderBrain::getCurrentCustomStyleIndex() { - amis::util::Log::Instance()->writeMessage("HTML contrast turned on", "TextRenderBrain::htmlContrastOn", "AmisGuiMFC2"); - mbContrastOn = true; + return mCurrentStyleIdx; +} +void TextRenderBrain::applyPageStyle(int idx) +{ + clearPageStyle(); + amis::util::Log::Instance()->writeMessage("Applying custom style", "TextRenderBrain::applyPageStyle", "AmisGuiMFC2"); + mbStyleOn = true; amis::UrlList* list = Preferences::Instance()->getCustomCssFiles(); - ambulant::net::url url = (*list)[0]; - mpContrastCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet(&url); - scanStylesheetForAdditionalData(mpContrastCss); + ambulant::net::url url = (*list)[idx]; + mCurrentStyleIdx = idx; + mpStyleCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet(&url); + scanStylesheetForAdditionalData(mpStyleCss); } +void TextRenderBrain::applyNextPageStyle() +{ + amis::UrlList* p_list = Preferences::Instance()->getCustomCssFiles(); + int sz = p_list->size(); + if (mCurrentStyleIdx >= -1 && + mCurrentStyleIdx < sz-1) + { + int tmp = mCurrentStyleIdx; + clearPageStyle(); + mCurrentStyleIdx = tmp + 1; + applyPageStyle(mCurrentStyleIdx); + } + else + { + clearPageStyle(); + } +} -void TextRenderBrain::htmlContrastOff() +void TextRenderBrain::clearPageStyle() { - amis::util::Log::Instance()->writeMessage("HTML contrast turned off", "TextRenderBrain::htmlContrastOff", "AmisGuiMFC2"); - mbContrastOn = false; - MainWndParts::Instance()->mpHtmlView->removeStylesheet(mpContrastCss); + amis::util::Log::Instance()->writeMessage("Clearing page style", "TextRenderBrain::clearPageStyle", "AmisGuiMFC2"); + mbStyleOn = false; + mCurrentStyleIdx = -1; + MainWndParts::Instance()->mpHtmlView->removeStylesheet(mpStyleCss); } void TextRenderBrain::increaseFontSize() { amis::util::Log::Instance()->writeMessage("Font size increased", "TextRenderBrain::increaseFontSize", "AmisGuiMFC2"); - //MainWndParts::Instance()->mpSidebar->m_wndDlg.increaseFontSize(); if (mFontSize >= 0 && mFontSize < 4) setFontSize(mFontSize + 1); } - +void TextRenderBrain::decreaseFontSize() +{ + amis::util::Log::Instance()->writeMessage("Font size decreased", "TextRenderBrain::decreaseFontSize", "AmisGuiMFC2"); + if (mFontSize > 0 && mFontSize <=4) setFontSize(mFontSize - 1); +} void TextRenderBrain::resetFontSize() { amis::util::Log::Instance()->writeMessage("Font size reset", "TextRenderBrain::resetFontSize", "AmisGuiMFC2"); - //MainWndParts::Instance()->mpSidebar->m_wndDlg.resetFontSize(); setFontSize(0); } //set the font size @@ -351,6 +362,10 @@ mpFontCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet(css_url); scanStylesheetForAdditionalData(mpFontCss); } + else + { + mpFontCss = NULL; + } if (isElementInView(mpPreviousElm) == false) { VARIANT v_bool; @@ -433,31 +448,12 @@ return mCurrentElmText; } -void TextRenderBrain::redoPageColors(bool disableContrast) +void TextRenderBrain::redoPageColors() { if (Preferences::Instance()->getHighlightText() == true) redoHighlightColors(); else unHighlightPreviousElement(); - - //maintain the contrast settings (on/off) but use the new colors - if (disableContrast == false) - { - //TODO repaint the sidebar contrast - //MainWndParts::Instance()->mpSidebar->m_wndDlg.repaintContrast(); - - //repaint the html view contrast if it had been enabled - if (mbContrastOn) htmlContrastOn(); - } - //otherwise turn the contrast off everywhere - else - { - //TODO turn off the sidebar contrast - //MainWndParts::Instance()->mpSidebar->m_wndDlg.turnContrastOff(); - - //turn off the html view contrast - htmlContrastOff(); - } } //this is called to refresh the page colors //the colors might have changed but the element cursor hasn't moved yet @@ -465,9 +461,7 @@ void TextRenderBrain::redoHighlightColors() { USES_CONVERSION; - IHTMLStyle* pStyle = NULL; - if (mpPreviousElm != NULL) { //get a pointer to the style @@ -477,8 +471,6 @@ string str_text_fg, str_text_bg; VARIANT var_bg; VARIANT var_fg; - - VariantInit(&var_bg); VariantInit(&var_fg); Modified: branches/amis3/bin/settings/basicToolbar.xml =================================================================== --- branches/amis3/bin/settings/basicToolbar.xml 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/bin/settings/basicToolbar.xml 2008-03-03 05:25:23 UTC (rev 2384) @@ -7,7 +7,7 @@ </toggle> <button src="./img/basicToolbar/media_seek_forward.ico" mfcid="ID_AMIS_NEXT_PHRASE"/> <separator/> - <button src="./img/basicToolbar/style.ico" mfcid="ID_AMIS_SLOWER"/> + <button src="./img/basicToolbar/style.ico" mfcid="ID_AMIS_NEXT_PAGE_STYLE"/> <separator/> <button src="./img/basicToolbar/display.ico" mfcid="ID_AMIS_TOGGLE_VIEW"/> </toolbar> Modified: branches/amis3/bin/settings/css/amis.css =================================================================== --- branches/amis3/bin/settings/css/amis.css 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/bin/settings/css/amis.css 2008-03-03 05:25:23 UTC (rev 2384) @@ -1,5 +1,5 @@ /*default CSS sheet*/ /*"amis-highlight" is a reserved word that AMIS will look for to find the highlight colors*/ /*use the body element selector to specify what font you want, etc. AMIS will pick up the font family for the body element and use it in the sidebar*/ -.amis-highlight {color: white; background-color: green} +.amis-highlight {color: black; background-color: yellow} body {font-family: arial, verdana, sans-serif;} \ No newline at end of file Modified: branches/amis3/bin/settings/resource.h.ini =================================================================== --- branches/amis3/bin/settings/resource.h.ini 2008-03-03 05:17:32 UTC (rev 2383) +++ branches/amis3/bin/settings/resource.h.ini 2008-03-03 05:25:23 UTC (rev 2384) @@ -33,6 +33,7 @@ AMIS_NAVLIST_BASE_ID=300 AMIS_PAGE_STYLE_BASE_ID=350 AMIS_BOOKMARKS_BASE_ID=400 +ID_AMIS_NEXT_PAGE_STYLE=450 ID_AMBULANT_PLAY=700 IDC_TREE=1000 IDC_TAB=1001 @@ -124,7 +125,6 @@ _APS_NEXT_RESOURCE_VALUE=192 _APS_NEXT_COMMAND_VALUE=32952 _APS_NEXT_CONTROL_VALUE=1106 -_APS_NEXT_SYMED_VALUE=142 +_APS_NEXT_SYMED_VALUE=143 - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |