amis-cvs Mailing List for AMIS (Page 2)
Brought to you by:
julienq,
marisademeglio
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(184) |
Sep
(89) |
Oct
(185) |
Nov
(71) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(45) |
Feb
(125) |
Mar
(138) |
Apr
(135) |
May
(72) |
Jun
(68) |
Jul
(23) |
Aug
(14) |
Sep
(39) |
Oct
(131) |
Nov
(43) |
Dec
(5) |
2007 |
Jan
(13) |
Feb
(16) |
Mar
(5) |
Apr
(28) |
May
(44) |
Jun
(63) |
Jul
(109) |
Aug
(19) |
Sep
(48) |
Oct
(35) |
Nov
(16) |
Dec
(27) |
2008 |
Jan
(40) |
Feb
(56) |
Mar
(97) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mar...@us...> - 2008-03-18 05:38:30
|
Revision: 2429 http://amis.svn.sourceforge.net/amis/?rev=2429&view=rev Author: marisademeglio Date: 2008-03-17 22:38:31 -0700 (Mon, 17 Mar 2008) Log Message: ----------- some more improvements to HTML view sizing. it responds to changes in the main window, but stylesheets still look a bit funny Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-18 05:32:42 UTC (rev 2428) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-18 05:38:31 UTC (rev 2429) @@ -92,6 +92,7 @@ void updateUiCommandState(CCmdUI*, bool); public: virtual void RecalcLayout(BOOL bNotify = TRUE); + afx_msg void OnSize(UINT nType, int cx, int cy); }; } } Modified: branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-03-18 05:32:42 UTC (rev 2428) +++ branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-03-18 05:38:31 UTC (rev 2429) @@ -628,6 +628,11 @@ //stylesheet doesn't override the default styling (i would like it to override this) res = pDoc->createStyleSheet(css_path_bstr, 0, &pStyleSheet); SysFreeString(css_path_bstr); + //without this line, the stylesheet gets a weird leftover border from the previous style + //it still happens sometimes though + //if you move the window or scroll, the weird border goes away + MainWndParts::Instance()->mpMainFrame->ShowWindow(SW_SHOWNA); + return pStyleSheet; } Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-18 05:32:42 UTC (rev 2428) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-18 05:38:31 UTC (rev 2429) @@ -98,6 +98,7 @@ ON_UPDATE_COMMAND_UI_RANGE(AMIS_BOOKMARKS_BASE_ID, AMIS_BOOKMARKS_BASE_ID + AMIS_MAX_ANYTHING, OnUpdateCmdUiGeneral) //}}AFX_MSG_MAP ON_WM_SIZE() + ON_WM_SIZE() END_MESSAGE_MAP() static UINT indicators[] = @@ -672,3 +673,16 @@ CMDIFrameWnd::RecalcLayout(bNotify); } + +void amis::gui::CMainFrame::OnSize(UINT nType, int cx, int cy) +{ + CMDIFrameWnd::OnSize(nType, cx, cy); + if (MainWndParts::Instance()->mpMmView != NULL) + { + //CRect sr; + //CRect r; + //this->GetWindowRect(&r); + //MainWndParts::Instance()->mpSidebar->GetWindowRect(&sr); + MainWndParts::Instance()->mpMmView->OnSize(nType, cx, cy); + } +} Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-18 05:32:42 UTC (rev 2428) +++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-18 05:38:31 UTC (rev 2429) @@ -541,7 +541,7 @@ mainWnd->SetWindowPos(&wndTop, 0, 0, size.cx, size.cy, flags); return 0; } -//TODO: why does this code never get called?? + void MmView::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-18 05:32:58
|
Revision: 2428 http://amis.svn.sourceforge.net/amis/?rev=2428&view=rev Author: daniel_weck Date: 2008-03-17 22:32:42 -0700 (Mon, 17 Mar 2008) Log Message: ----------- fixed the miss-synchronization issues with TTS. Now renders nicely even with fast-switching using mouse of keyboard. A good place to test is the publication summary dialog (most of the list is TTS-rendered) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/TTSPlayer.h branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/TTSPlayer.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/TTSPlayer.h 2008-03-18 05:01:55 UTC (rev 2427) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/TTSPlayer.h 2008-03-18 05:32:42 UTC (rev 2428) @@ -36,6 +36,8 @@ void Play(CString str); #endif void Stop(); + +void callback(); void WaitUntilDone(); long GetSpeechRate(); @@ -52,8 +54,11 @@ static TTSPlayer* pinstance; + CRITICAL_SECTION m_csSequence; + ULONG m_currentVoiceNumber; + bool mbDoNotProcessEndEvent; TTSPlayer(void); ~TTSPlayer(void); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-18 05:01:55 UTC (rev 2427) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-18 05:32:42 UTC (rev 2428) @@ -86,47 +86,63 @@ USES_CONVERSION; #endif + EnterCriticalSection(&m_csSequence); + TRACE(L"\n*-*=*+*"); TRACE(str); if (IsSpeaking()) { TRACE("????????"); } TRACE("\n"); +mbDoNotProcessEndEvent = true; +m_iV->Speak(NULL, SPF_PURGEBEFORESPEAK, NULL); +WaitUntilDone(); +mbDoNotProcessEndEvent = false; + #ifdef USE_WSTRING - m_iV->Speak(str, SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL); - #else + m_iV->Speak(str, SPF_ASYNC, NULL); +#else //LPCWSTR str_ = T2W(str); -m_iV->Speak(str, SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL); +m_iV->Speak(str, SPF_ASYNC, NULL); #endif + +LeaveCriticalSection(&m_csSequence); } void TTSPlayer::Stop() { + EnterCriticalSection(&m_csSequence); TRACE(_T("\nStop TTS\r\n") ); - m_iV->Speak(NULL, SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL); - m_isSpeaking = FALSE; + mbDoNotProcessEndEvent = true; + m_iV->Speak(NULL, SPF_PURGEBEFORESPEAK, NULL); + //m_iV->Speak(L"", SPF_PURGEBEFORESPEAK, NULL); + //m_iV->Speak(L"", SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL); +WaitUntilDone(); + +m_isSpeaking = FALSE; + +LeaveCriticalSection(&m_csSequence); } void TTSPlayer::WaitUntilDone() { - +TRACE(_T("\n//// TTS BEFORE WAIT \r\n") ); m_iV->WaitUntilDone(INFINITE); +TRACE(_T("\n//// TTS AFTER WAIT \r\n") ); +} +void __stdcall SpkCallback(WPARAM wParam, LPARAM lParam) { + ((TTSPlayer *)lParam)->callback(); } +void TTSPlayer::callback() { - - - -void __stdcall SpkCallback(WPARAM wParam, LPARAM lParam) { - - CSpEvent event; // helper class in sphelper.h for events that releases any // allocated memory in it's destructor - SAFER than SPEVENT //SPVOICESTATUS Stat; @@ -144,17 +160,27 @@ { case SPEI_START_INPUT_STREAM: TRACE(_T("\nStartStream event\r\n") ); - ((TTSPlayer *)lParam)->m_isSpeaking = TRUE; + m_isSpeaking = TRUE; break; case SPEI_END_INPUT_STREAM: - TRACE(_T("\nEndStream event\r\n") ); - ((TTSPlayer *)lParam)->m_isSpeaking = FALSE; + if (m_isSpeaking) { + m_isSpeaking = FALSE; - ((TTSPlayer *)lParam)->sendMessageCallback(); - + if (mbDoNotProcessEndEvent) { + + TRACE(_T("\nEndStream 1 mbDoNotProcessEndEvent\r\n") ); + mbDoNotProcessEndEvent = false; + } else { + + TRACE(_T("\nEndStream 2 sendMessageCallback\r\n") ); + sendMessageCallback(); + } + } else { + int i = 9; + } break; case SPEI_VOICE_CHANGE: @@ -166,15 +192,22 @@ //TRACE(_T("Unknown message\r\n") ); break; } + //break; } } -bool TTSPlayer::IsSpeaking(void) {return m_isSpeaking;} +bool TTSPlayer::IsSpeaking(void) { + + return m_isSpeaking; +} TTSPlayer::TTSPlayer(void) : m_currentVoiceNumber(-1) , m_isSpeaking(FALSE) { + mbDoNotProcessEndEvent = false; + InitializeCriticalSection(&m_csSequence); + //m_iV(NULL) m_iV = NULL; HRESULT hr = 0; @@ -211,8 +244,11 @@ TTSPlayer::~TTSPlayer(void) { + mbDoNotProcessEndEvent = false; if (m_iV != NULL) m_iV->Release(); + + DeleteCriticalSection(&m_csSequence); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-18 05:01:51
|
Revision: 2427 http://amis.svn.sourceforge.net/amis/?rev=2427&view=rev Author: marisademeglio Date: 2008-03-17 22:01:55 -0700 (Mon, 17 Mar 2008) Log Message: ----------- Fixed bug where recent books list wasn't recent enough Sidebar list views no longer cut off text Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/gui/sidebar/NavListControl.h branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/NavListControl.cpp Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-18 03:42:12 UTC (rev 2426) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-18 05:01:55 UTC (rev 2427) @@ -77,6 +77,7 @@ IDD_SIDEBAR, DIALOG BEGIN + RIGHTMARGIN, 86 BOTTOMMARGIN, 181 END Modified: branches/amis3/AmisGuiMFC2/include/gui/sidebar/NavListControl.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/sidebar/NavListControl.h 2008-03-18 03:42:12 UTC (rev 2426) +++ branches/amis3/AmisGuiMFC2/include/gui/sidebar/NavListControl.h 2008-03-18 05:01:55 UTC (rev 2427) @@ -54,6 +54,7 @@ DECLARE_MESSAGE_MAP() public: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnSize(UINT nType, int cx, int cy); }; } } Modified: branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-03-18 03:42:12 UTC (rev 2426) +++ branches/amis3/AmisGuiMFC2/src/gui/HtmlView.cpp 2008-03-18 05:01:55 UTC (rev 2427) @@ -477,8 +477,8 @@ HRESULT CAmisHtmlView::OnShowContextMenu(DWORD dwID, LPPOINT ppt,LPUNKNOWN pcmdtReserved, LPDISPATCH pdispReserved) { - return S_FALSE; // Enable the HtmlView popup menu - //return S_OK; // Disable the standard HtmlView popup menu + //return S_FALSE; // Enable the HtmlView popup menu + return S_OK; // Disable the standard HtmlView popup menu } void CAmisHtmlView::OnEditCopy() Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-18 03:42:12 UTC (rev 2426) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-18 05:01:55 UTC (rev 2427) @@ -90,7 +90,7 @@ int max = AMIS_MAX_RECENT_BOOKS; if (num_entries < max) max = num_entries; //get the last X entries - for (i=max-1; i>=0; i--) + for (i=num_entries-1; i>=num_entries-max; i--) { p_entry = theApp.getHistory()->getEntry(i); string filepath = p_entry->mPath.get_url(); Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-18 03:42:12 UTC (rev 2426) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-18 05:01:55 UTC (rev 2427) @@ -270,6 +270,7 @@ mTree.GetWindowRect(mInitialRect); this->GetWindowRect(mInitialParentRect); + mNumTabs = 0; mIsShiftDown = false; mIsControlDown = false; Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/NavListControl.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/NavListControl.cpp 2008-03-18 03:42:12 UTC (rev 2426) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/NavListControl.cpp 2008-03-18 05:01:55 UTC (rev 2427) @@ -57,6 +57,7 @@ ON_NOTIFY_REFLECT(LVN_KEYDOWN, OnKeyDown) //}}AFX_MSG_MAP ON_WM_CREATE() + ON_WM_SIZE() END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -121,5 +122,21 @@ { if (CListCtrl::OnCreate(lpCreateStruct) == -1) return -1; + CWnd* p_parent = this->GetParent(); + CRect rect; + p_parent->GetClientRect(&rect); + int w = rect.Width(); + this->SetColumnWidth(0, w); return 0; } + +void amis::gui::sidebar::CNavListControl::OnSize(UINT nType, int cx, int cy) +{ + CListCtrl::OnSize(nType, cx, cy); + + CWnd* p_parent = this->GetParent(); + CRect rect; + p_parent->GetClientRect(&rect); + int w = rect.Width(); + this->SetColumnWidth(0, w); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-18 03:42:07
|
Revision: 2426 http://amis.svn.sourceforge.net/amis/?rev=2426&view=rev Author: daniel_weck Date: 2008-03-17 20:42:12 -0700 (Mon, 17 Mar 2008) Log Message: ----------- enabled arrow key interactive navigation of publication summary, corrected a typo in the XML Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp branches/amis3/DefaultLangpack/amisAccessibleUi.xml Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-03-18 03:10:52 UTC (rev 2425) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-03-18 03:42:12 UTC (rev 2426) @@ -47,6 +47,8 @@ protected: virtual BOOL OnInitDialog(); afx_msg void OnPaint(); + + afx_msg void OnLvnItemchangedSummary(NMHDR *pNMHDR, LRESULT *pResult); virtual void DoDataExchange(CDataExchange*); DECLARE_MESSAGE_MAP() Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-18 03:10:52 UTC (rev 2425) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-18 03:42:12 UTC (rev 2426) @@ -38,7 +38,8 @@ BEGIN_MESSAGE_MAP(PublicationSummaryDialog, CDialog) ON_WM_KEYUP() ON_WM_KEYDOWN() - ON_WM_PAINT() + ON_WM_PAINT() + ON_NOTIFY(LVN_ITEMCHANGED, IDC_SUMMARYLIST, OnLvnItemchangedSummary) END_MESSAGE_MAP() PublicationSummaryDialog::PublicationSummaryDialog(CWnd* pParent /*=NULL*/) @@ -86,11 +87,19 @@ if (p_wnd) { int id = p_wnd->GetDlgCtrlID(); + + if (id = IDC_SUMMARYLIST && (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN)) + { + return CDialog::PreTranslateMessage(pMsg); + } + + //inexplicably, the default behavior for pressing enter in a dialog is to close it. //we're overriding this here. if (pMsg->wParam == VK_RETURN) { //do nothing + //return CDialog::PreTranslateMessage(pMsg); } } } @@ -295,6 +304,44 @@ return value; } + +void PublicationSummaryDialog::OnLvnItemchangedSummary(NMHDR *pNMHDR, LRESULT *pResult) +{ + LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); + if (pNMLV->iItem != -1) { + if (pNMLV->uNewState == 3) { + + CListCtrl* p_ctrl_list = (CListCtrl*)this->GetDlgItem(IDC_SUMMARYLIST); + //int i = p_ctrl_list->GetSelectionMark(); // Should = pNMLV->iItem + int i = pNMLV->iItem; + + Dialog* p_dlg = DataTree::Instance()->findDialog(IDD_PUBLICATIONSUMMARY); + + if (p_dlg != NULL) + { + DialogControl* p_ctrl = p_dlg->findControl(IDC_SUMMARYLIST); + if (p_ctrl != NULL) + { + LabelList* p_list = p_ctrl->getLabelList(); + if (p_list != NULL) + { + Prompt* p_prompt = p_list->getLabel(i)->getPrompt(); + if (p_prompt != NULL) + { + AudioSequence* seq = new AudioSequence(); + AudioSequencePlayer::Instance()->fillSequencePrompt(seq, p_prompt, NULL); + if (seq->IsEmpty()) {delete seq;}else{ + AudioSequencePlayer::Instance()->Play(seq); + } + } + } + } + } + } + } + *pResult = 0; +} + void PublicationSummaryDialog::resolvePromptVariables(Prompt* pPrompt) { PromptVar* p_var = NULL; @@ -519,8 +566,8 @@ void PublicationSummaryDialog::appendToList(CListCtrl* pList, CString field, wstring value) { - //don't add empty items - if (value.size() == 0) return; + //don't add empty items (no anymore: to match self-voicing exactly, and to support interactive navigation in the list) + //if (value.size() == 0) return; int idx = pList->GetItemCount(); pList->InsertItem(idx, _T("")); pList->SetItemText(idx, 0, field); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-18 03:10:52 UTC (rev 2425) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/TTSPlayer.cpp 2008-03-18 03:42:12 UTC (rev 2426) @@ -86,11 +86,12 @@ USES_CONVERSION; #endif - TRACE(L"******"); + TRACE(L"\n*-*=*+*"); TRACE(str); if (IsSpeaking()) { TRACE("????????"); } + TRACE("\n"); #ifdef USE_WSTRING @@ -104,6 +105,7 @@ void TTSPlayer::Stop() { + TRACE(_T("\nStop TTS\r\n") ); m_iV->Speak(NULL, SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL); m_isSpeaking = FALSE; @@ -141,13 +143,13 @@ switch( event.eEventId ) { case SPEI_START_INPUT_STREAM: - TRACE(_T("StartStream event\r\n") ); + TRACE(_T("\nStartStream event\r\n") ); ((TTSPlayer *)lParam)->m_isSpeaking = TRUE; break; case SPEI_END_INPUT_STREAM: - TRACE(_T("EndStream event\r\n") ); + TRACE(_T("\nEndStream event\r\n") ); ((TTSPlayer *)lParam)->m_isSpeaking = FALSE; @@ -156,7 +158,7 @@ break; case SPEI_VOICE_CHANGE: - TRACE(_T("Voicechange event\r\n") ); + TRACE(_T("\nVoicechange event\r\n") ); break; Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-18 03:10:52 UTC (rev 2425) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-18 03:42:12 UTC (rev 2426) @@ -1396,7 +1396,7 @@ <promptItem refid="ok_button_description"/> </description> </control> - <control mfcid="IDC_SUMMARY" widget="list"> + <control mfcid="IDC_SUMMARYLIST" widget="list"> <caption mfcid="IDC_LISTCAPTION"> <!--changed text--> <text id="t214">Information about this publication and your current position:</text> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-18 03:10:48
|
Revision: 2425 http://amis.svn.sourceforge.net/amis/?rev=2425&view=rev Author: daniel_weck Date: 2008-03-17 20:10:52 -0700 (Mon, 17 Mar 2008) Log Message: ----------- - added max section depth and number of TOC navigation points to publication summary Modified Paths: -------------- branches/amis3/AmisCore/include/dtb/nav/NavMap.h branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp Modified: branches/amis3/AmisCore/include/dtb/nav/NavMap.h =================================================================== --- branches/amis3/AmisCore/include/dtb/nav/NavMap.h 2008-03-18 02:52:01 UTC (rev 2424) +++ branches/amis3/AmisCore/include/dtb/nav/NavMap.h 2008-03-18 03:10:52 UTC (rev 2425) @@ -55,6 +55,8 @@ NavNode* goToPlayOrder(int); NavNode* goToContentRef(string); NavNode* goToId(string); + + int getNumberOfNavPoints(); int getMaxDepth(); Modified: branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp 2008-03-18 02:52:01 UTC (rev 2424) +++ branches/amis3/AmisCore/src/dtb/nav/NavMap.cpp 2008-03-18 03:10:52 UTC (rev 2425) @@ -182,6 +182,19 @@ else return false; } +int amis::dtb::nav::NavMap::getNumberOfNavPoints() +{ + NavPoint* p_node = mpRoot; + int n = 0; + while (p_node != NULL) + { + n++; + p_node = p_node->next(); + } + return n-1; +} + + amis::dtb::nav::NavNode* amis::dtb::nav::NavMap::goToId(string id) { NavPoint* p_node = mpRoot; Modified: branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp 2008-03-18 02:52:01 UTC (rev 2424) +++ branches/amis3/AmisCore/src/dtb/nav/NavPoint.cpp 2008-03-18 03:10:52 UTC (rev 2425) @@ -30,6 +30,7 @@ mpSibling = NULL; mpParent = NULL; mpFirstChild = NULL; + resetChildCount(); this->mTypeOfNode = NavNode::NAV_POINT; } Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-03-18 02:52:01 UTC (rev 2424) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-03-18 03:10:52 UTC (rev 2425) @@ -66,6 +66,8 @@ amis::MediaGroup* mpSectionName; int mNumSubsections; int mNumPagesForSection; + int mMaxDepth; + int mTocs; wstring mTotalTime; wstring mPublisher; wstring mDescription; Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-18 02:52:01 UTC (rev 2424) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-18 03:10:52 UTC (rev 2425) @@ -115,6 +115,8 @@ mpBook = NULL; mpSectionName = NULL; mpTitle = NULL; + mMaxDepth = 0; + mTocs = 0; mpBook = pBook; } @@ -127,6 +129,9 @@ amis::dtb::DaisyVersion version = mpBook->getDaisyVersion(); amis::dtb::nav::NavModel* p_nav = mpBook->getNavModel(); + mTocs = p_nav->getNavMap()->getNumberOfNavPoints(); + mMaxDepth = p_nav->getNavMap()->getMaxDepth(); + mpTitle = mpBook->getTitle(); mCreator = p_meta->getMetadataContent("dc:creator"); @@ -231,7 +236,10 @@ CString curr_time = _T("Current time:"); CString curr_section = _T("Current section:"); CString section_contents = _T("Section contents:"); + CString maxdepth = _T("Max section depth:"); + CString tocs = _T("TOC entries:"); + CString value; wstring wvalue; int idx = 0; @@ -263,6 +271,12 @@ wvalue = value; appendToList(p_list, section_contents, wvalue); } + value.Format(_T("%d"), mTocs); + wvalue = value; + appendToList(p_list, tocs, wvalue); + value.Format(_T("%d"), mMaxDepth); + wvalue = value; + appendToList(p_list, maxdepth, wvalue); } CString PublicationSummaryDialog::computeAuthor() { @@ -308,7 +322,7 @@ p_var->setContents(promptNotAvailable->getContents()->clone()); } } else { - p_var->setContents(str, node); + p_var->setContents(str, node->clone()); } } else if (p_var->getName() == "META_CREATOR") @@ -392,10 +406,45 @@ p_var->setContents(promptNotAvailable->getContents()->clone()); } } + + else if (p_var->getName() == "META_TOCITEMS") + { + amis::dtb::nav::NavModel* p_nav = mpBook->getNavModel(); + int max = p_nav->getNavMap()->getNumberOfNavPoints(); + CString value; + value.Format(_T("%d"), max); + wstring str; + str = value; + p_var->setContents(str, ""); + //p_var->setContents(promptNotAvailable->getContents()->clone()); + } + else if (p_var->getName() == "META_DEPTH") + { + amis::dtb::nav::NavModel* p_nav = mpBook->getNavModel(); + int max = p_nav->getNavMap()->getMaxDepth(); + CString value; + value.Format(_T("%d"), max); + wstring str; + str = value; + p_var->setContents(str, ""); + //p_var->setContents(promptNotAvailable->getContents()->clone()); + } else if (p_var->getName() == "TOC_CATEGORIES") { if (mNavigableItems.length() != 0) { + p_var->setContents(mNavigableItems, ""); + + /* + amis::dtb::nav::NavModel* p_nav = mpBook->getNavModel(); + if (p_nav->getNavMap()->getLabel() != NULL) + { + amis::AudioNode * node = p_nav->getNavMap()->getLabel()->getAudio(0); + p_var->setContents(p_nav->getNavMap()->getLabel()->getText()->getTextString(), node); + } else { + p_var->setContents(mNavigableItems, ""); + } + */ } else if (promptNotAvailable != NULL) { @@ -404,6 +453,8 @@ /* //TODO: get the full multimedia data (should be available directly from the nav data model) + + amis::dtb::nav::NavModel* p_nav = mpBook->getNavModel(); if (p_nav->getNavMap()->getLabel() != NULL) { mNavigableItems = p_nav->getNavMap()->getLabel()->getText()->getTextString(); @@ -424,8 +475,9 @@ else if (p_var->getName() == "CURRENT_PAGE") { + amis::AudioNode * node = mpCurrentPage->getAudio(0); if (mpCurrentPage != NULL) { - p_var->setContents(mpCurrentPage->getText()->getTextString(), mpCurrentPage->getAudio(0)); + p_var->setContents(mpCurrentPage->getText()->getTextString(), (node != NULL ? node->clone() : NULL)); } } else if (p_var->getName() == "CURRENT_TIME") @@ -435,9 +487,10 @@ else if (p_var->getName() == "CURRENT_SECTION_TITLE") { + amis::AudioNode * node = mpSectionName->getAudio(0); if (mpSectionName != NULL) { - p_var->setContents(mpSectionName->getText()->getTextString(), mpSectionName->getAudio(0)); + p_var->setContents(mpSectionName->getText()->getTextString(), (node != NULL ? node->clone() : NULL)); } } @@ -458,16 +511,7 @@ str = value; p_var->setContents(str, ""); } - - else if (p_var->getName() == "META_DEPTH") - { - p_var->setContents(promptNotAvailable->getContents()->clone()); - } - - else if (p_var->getName() == "META_TOCITEMS") - { - p_var->setContents(promptNotAvailable->getContents()->clone()); - } + } } AmisDialogBase::resolvePromptVariables(pPrompt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-18 02:51:56
|
Revision: 2424 http://amis.svn.sourceforge.net/amis/?rev=2424&view=rev Author: marisademeglio Date: 2008-03-17 19:52:01 -0700 (Mon, 17 Mar 2008) Log Message: ----------- update to issues file Modified Paths: -------------- branches/amis3/amis_issues.txt Modified: branches/amis3/amis_issues.txt =================================================================== --- branches/amis3/amis_issues.txt 2008-03-18 02:51:18 UTC (rev 2423) +++ branches/amis3/amis_issues.txt 2008-03-18 02:52:01 UTC (rev 2424) @@ -21,6 +21,7 @@ * window resizing problems with HTML view * audio does not change speed + KNOWN ISSUES (not going to change for alpha 2; should be listed as bugs to work on for beta 1) --- * Load CD shows more titles than the ones on discinfo.html @@ -119,3 +120,4 @@ * phrase arrow keys work when the focus is in the sidebar * page navigation bug fixed * navigation cursor synchronized +* bookmarks cleared when closing a book \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-18 02:51:14
|
Revision: 2423 http://amis.svn.sourceforge.net/amis/?rev=2423&view=rev Author: marisademeglio Date: 2008-03-17 19:51:18 -0700 (Mon, 17 Mar 2008) Log Message: ----------- minor fix to clear bookmarks when a book is closed Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2008-03-18 02:30:27 UTC (rev 2422) +++ branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2008-03-18 02:51:18 UTC (rev 2423) @@ -42,6 +42,7 @@ void setPauseState(bool pauseState); void addBookmark(amis::dtb::PositionMark*); void loadBookmarks(amis::dtb::BookmarkSet*); + void clearBookmarks(); void setupNavigationOptions(); void addPageStyles(); private: Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-18 02:30:27 UTC (rev 2422) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-18 02:51:18 UTC (rev 2423) @@ -551,6 +551,7 @@ amis::dtb::DtbWithHooks::Instance()->DestroyInstance(); MainWndParts::Instance()->mpMmView->OnDestroy(); amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.clearAll(); + amis::gui::MenuManip::Instance()->clearBookmarks(); } } Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-18 02:30:27 UTC (rev 2422) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-18 02:51:18 UTC (rev 2423) @@ -95,6 +95,7 @@ ON_UPDATE_COMMAND_UI(ID_AMIS_BIGGER_FONT, OnUpdateCmdUiBiggerFont) ON_UPDATE_COMMAND_UI(ID_AMIS_INCREASE_VOLUME, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_DECREASE_VOLUME, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI_RANGE(AMIS_BOOKMARKS_BASE_ID, AMIS_BOOKMARKS_BASE_ID + AMIS_MAX_ANYTHING, OnUpdateCmdUiGeneral) //}}AFX_MSG_MAP ON_WM_SIZE() END_MESSAGE_MAP() Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-18 02:30:27 UTC (rev 2422) +++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2008-03-18 02:51:18 UTC (rev 2423) @@ -187,42 +187,49 @@ { USES_CONVERSION; - CMenu* p_menu = NULL; - p_menu = MainWndParts::Instance()->mpMainFrame->GetMenu(); + //clear all the bookmarks + clearBookmarks(); - //exit if no menu is present..this could mean we are in basic view mode - if (p_menu == NULL) return; - - //get to "bookmarks" - p_menu = p_menu->GetSubMenu(4); - - int num_entries = p_menu->GetMenuItemCount(); - int i; - //remove all but the first two ("add bookmark" and the separator) - for (i=num_entries-1; i>=2; i--) - p_menu->RemoveMenu(i, MF_BYPOSITION); - //if there is no new bookmark data, it means that no bookmark file was found //and one could not be created //so disable the add bookmark menu option and return if (pBookmarks == NULL) { + 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 "bookmarks" + p_menu = p_menu->GetSubMenu(4); p_menu->EnableMenuItem(ID_AMIS_ADD_BOOKMARK, MF_DISABLED | MF_BYCOMMAND | MF_GRAYED); return; } - //enable the "add bookmark" item - 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++) + for (int i=0; i<pBookmarks->getNumberOfItems(); i++) { amis::dtb::PositionMark* p_mark = NULL; p_mark = pBookmarks->getItem(i); if (p_mark) addBookmark(p_mark); } } - +//clear all the bookmarks from the Bookmarks menu +void MenuManip::clearBookmarks() +{ + 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 "bookmarks" + p_menu = p_menu->GetSubMenu(4); + int num_entries = p_menu->GetMenuItemCount(); + //remove all but the first two ("add bookmark" and the separator) + for (int i=num_entries-1; i>=2; i--) + p_menu->RemoveMenu(i, MF_BYPOSITION); + + //enable the "add bookmark" item + p_menu->EnableMenuItem(ID_AMIS_ADD_BOOKMARK, MF_BYCOMMAND | MF_ENABLED); +} void MenuManip::setPauseState(bool pauseState) { CMenu* p_menu = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-18 02:30:20
|
Revision: 2422 http://amis.svn.sourceforge.net/amis/?rev=2422&view=rev Author: daniel_weck Date: 2008-03-17 19:30:27 -0700 (Mon, 17 Mar 2008) Log Message: ----------- - fixed XML to match data flow in the GUI list of publication summary - fixed minor memory leak Modified Paths: -------------- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp branches/amis3/DefaultLangpack/amisAccessibleUi.xml Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-18 01:50:14 UTC (rev 2421) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-18 02:30:27 UTC (rev 2422) @@ -72,7 +72,7 @@ #if _DEBUG //get Visual Leak Detector version 1.0 here: http://dmoulding.googlepages.com/downloads -//#include <vld.h> +#include <vld.h> #endif using namespace amis::gui; Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-18 02:30:27 UTC (rev 2422) @@ -31,6 +31,8 @@ #include "gui/MainWndParts.h" #include "util/FilePathTools.h" #include "util/Log.h" +#include "gui/self-voicing/datamodel/DataTree.h" + using namespace amis::gui::dialogs; BEGIN_MESSAGE_MAP(PublicationSummaryDialog, CDialog) @@ -267,7 +269,7 @@ CString value; if (mCreator.size() > 0) value = mCreator.c_str(); - else value = _T("Author not available"); + else value = _T("not available"); return value; } @@ -275,13 +277,14 @@ CString value; if (mpTitle != NULL) value = mpTitle->getText()->getTextString().c_str(); - else value = _T("Title not available"); + else value = _T("not available"); return value; } void PublicationSummaryDialog::resolvePromptVariables(Prompt* pPrompt) { PromptVar* p_var = NULL; + PromptItem* promptNotAvailable = DataTree::Instance()->findPromptItem("not_available"); for (int i=0; i<pPrompt->getNumberOfItems(); i++) { @@ -297,7 +300,13 @@ str = computeTitle(); if (node == NULL) { - p_var->setContents(str, ""); + if (str.length() != 0) { + p_var->setContents(str, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } else { p_var->setContents(str, node); } @@ -306,24 +315,54 @@ { wstring str; str = computeAuthor(); - p_var->setContents(str, ""); + if (str.length() != 0) { + p_var->setContents(str, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } else if (p_var->getName() == "META_PUBLISHER") { - p_var->setContents(mPublisher, ""); + if (mPublisher.length() != 0) { + p_var->setContents(mPublisher, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } else if (p_var->getName() == "META_DESC") { - p_var->setContents(mDescription, ""); + if (mDescription.length() != 0) { + p_var->setContents(mDescription, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } else if (p_var->getName() == "META_NARRATOR") { - p_var->setContents(mNarrator, ""); + if (mNarrator.length() != 0) { + p_var->setContents(mNarrator, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } else if (p_var->getName() == "META_TOTALTIME") { - p_var->setContents(mTotalTime, ""); + if (mTotalTime.length() != 0) { + p_var->setContents(mTotalTime, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } else if (p_var->getName() == "META_NUMPAGES") { @@ -335,15 +374,52 @@ } else if (p_var->getName() == "META_DATE") { - p_var->setContents(mDate, ""); + if (mDate.length() != 0) { + p_var->setContents(mDate, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } else if (p_var->getName() == "META_FORMAT") { - p_var->setContents(mFormat, ""); + if (mFormat.length() != 0) { + p_var->setContents(mFormat, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } - else if (p_var->getName() == "META_TOCITEMS") + else if (p_var->getName() == "TOC_CATEGORIES") { - p_var->setContents(mNavigableItems, ""); + if (mNavigableItems.length() != 0) { + p_var->setContents(mNavigableItems, ""); + } + else if (promptNotAvailable != NULL) + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } + + /* + //TODO: get the full multimedia data (should be available directly from the nav data model) + if (p_nav->getNavMap()->getLabel() != NULL) + { + 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", "); + if (p_nav->getNavList(i)->getLabel() != NULL) + mNavigableItems.append(p_nav->getNavList(i)->getLabel()->getText()->getTextString()); + } */ } else if (p_var->getName() == "CURRENT_PAGE") @@ -354,7 +430,7 @@ } else if (p_var->getName() == "CURRENT_TIME") { - p_var->setContents(L"TODO", ""); + p_var->setContents(promptNotAvailable->getContents()->clone()); } else if (p_var->getName() == "CURRENT_SECTION_TITLE") @@ -383,11 +459,15 @@ p_var->setContents(str, ""); } - //TODO: what about the variables below: - //META_DEPTH - //TOC_CATEGORIES - // ?? - + else if (p_var->getName() == "META_DEPTH") + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } + + else if (p_var->getName() == "META_TOCITEMS") + { + p_var->setContents(promptNotAvailable->getContents()->clone()); + } } } AmisDialogBase::resolvePromptVariables(pPrompt); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-18 01:50:14 UTC (rev 2421) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-18 02:30:27 UTC (rev 2422) @@ -68,7 +68,7 @@ p_pair->setText(p_text); } - amis::AudioNode* p_audio = new amis::AudioNode(); + amis::AudioNode* p_audio = NULL; if (!audioSrc.empty()) { p_audio = new amis::AudioNode(); p_audio->setSrc(audioSrc); Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-18 01:50:14 UTC (rev 2421) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-18 02:30:27 UTC (rev 2422) @@ -1474,26 +1474,6 @@ <promptVar name="META_NUMPAGES"/> </prompt> </caption> - <caption condition="DATA_EXISTS"> - <prompt> - <promptItem> - <!--changed text--> - <text id="t244">Total TOC items:</text> - <audio src="./audio/241_Number_of_navigation_points_in.mp3"/> - </promptItem> - <promptVar name="META_TOCITEMS"/> - </prompt> - </caption> - <caption condition="DATA_EXISTS"> - <prompt> - <promptItem> - <!--changed text--> - <text id="t245">Max. section depth:</text> - <audio src="./audio/242_Maximum_section_depth.mp3"/> - </promptItem> - <promptVar name="META_DEPTH"/> - </prompt> - </caption> <!--new item--> <caption condition="DATA_EXISTS"> <prompt> @@ -1557,20 +1537,40 @@ <!--new item (except for some reused texts)--> <caption condition="DATA_EXISTS"> <prompt> - <promptVar name="CURRENT_SECTION_NUM_SUBSECTIONS"/> <promptItem> <!--changed text--> <text id="t217">subsections, </text> <audio src="./audio/215_Number_of_subsections_in_this_.mp3"/> </promptItem> - <promptVar name="CURRENT_SECTION_NUM_PAGES"/> + <promptVar name="CURRENT_SECTION_NUM_SUBSECTIONS"/> <promptItem> <!--changed text--> <text id="t216">pages</text> <audio src="./audio/214_Number_of_pages_in_this_sectio.mp3"/> </promptItem> + <promptVar name="CURRENT_SECTION_NUM_PAGES"/> </prompt> </caption> + <caption condition="DATA_EXISTS"> + <prompt> + <promptItem> + <!--changed text--> + <text id="t244">Total TOC items:</text> + <audio src="./audio/241_Number_of_navigation_points_in.mp3"/> + </promptItem> + <promptVar name="META_TOCITEMS"/> + </prompt> + </caption> + <caption condition="DATA_EXISTS"> + <prompt> + <promptItem> + <!--changed text--> + <text id="t245">Max. section depth:</text> + <audio src="./audio/242_Maximum_section_depth.mp3"/> + </promptItem> + <promptVar name="META_DEPTH"/> + </prompt> + </caption> </list> </control> </dialog> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-18 01:50:08
|
Revision: 2421 http://amis.svn.sourceforge.net/amis/?rev=2421&view=rev Author: daniel_weck Date: 2008-03-17 18:50:14 -0700 (Mon, 17 Mar 2008) Log Message: ----------- - improved the text field self-voicing by using the "textFieldEntry" prompt from XML - added prompt-resolver to the base dialog class, and implemented publication summary read-out. Not yet interactive though (arrow keys). Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h branches/amis3/AmisGuiMFC2/src/gui/dialogs/AboutDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/AboutDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -35,6 +35,9 @@ class AboutDialog : public AmisDialogBase { public: + + void resolvePromptVariables(Prompt*); + AboutDialog(); ~AboutDialog(){}; Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -32,9 +32,10 @@ { namespace dialogs { -class AmisDialogBase : public CDialog +class AmisDialogBase : public CDialog, public PromptResolver { public: + void resolvePromptVariables(Prompt*); AmisDialogBase(int); ~AmisDialogBase(); void on_init(); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -35,6 +35,8 @@ class GoToPageDialog : public AmisDialogBase { public: + void resolvePromptVariables(Prompt*); + GoToPageDialog(CWnd* pParent = NULL); ~GoToPageDialog(); //Dialog Data Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -36,6 +36,8 @@ class MultipleBooksOnVolumeDialog : public AmisDialogBase { public: + void resolvePromptVariables(Prompt*); + //the pUrlList parameter has a default value only because the compiler requires it MultipleBooksOnVolumeDialog(CWnd* pParent = NULL, amis::UrlList* pUrlList = NULL); ~MultipleBooksOnVolumeDialog(); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -37,6 +37,8 @@ //DECLARE_DYNAMIC(OpenUrlDialog) public: + void resolvePromptVariables(Prompt*); + OpenUrlDialog(CWnd* pParent = NULL); virtual ~OpenUrlDialog(); virtual BOOL OnInitDialog(); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/PreferencesDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -36,6 +36,8 @@ class PreferencesDialog : public AmisDialogBase { public: + void resolvePromptVariables(Prompt*); + PreferencesDialog(CWnd* pParent = NULL); ~PreferencesDialog(); virtual BOOL PreTranslateMessage(MSG*); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/PublicationSummaryDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -36,6 +36,7 @@ class PublicationSummaryDialog : public AmisDialogBase { public: + void resolvePromptVariables(Prompt*); PublicationSummaryDialog(CWnd* pParent = NULL); ~PublicationSummaryDialog(); virtual BOOL PreTranslateMessage(MSG*); @@ -50,6 +51,8 @@ DECLARE_MESSAGE_MAP() private: + CString computeTitle(); + CString computeAuthor(); bool calculateData(); void displayData(); void appendToList(CListCtrl*, CString, wstring); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -36,6 +36,8 @@ class SearchForBooksDialog : public AmisDialogBase { public: + void resolvePromptVariables(Prompt*); + SearchForBooksDialog(CWnd* pParent = NULL); ~SearchForBooksDialog(); ambulant::net::url getBookToLoad(); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/SkipDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -40,6 +40,8 @@ friend class SkipDialogVoicing; public: + void resolvePromptVariables(Prompt*); + SkipDialog(CWnd* pParent = NULL); ~SkipDialog(); void initializeData(amis::dtb::CustomTestSet*); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -37,6 +37,8 @@ class TextStyleDialog : public AmisDialogBase { public: + void resolvePromptVariables(Prompt*); + TextStyleDialog(CWnd* pParent = NULL); ~TextStyleDialog(); enum { IDD = IDD_TEXTSTYLE }; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-18 01:50:14 UTC (rev 2421) @@ -75,11 +75,11 @@ static void playPromptFromStringId(string); static void playPromptItemFromStringId(string); static void playDialogInstructionsFromUiId(int nItemID); - static void playDialogTextControlsFromUiId(int nItemID); + static void playDialogTextControlsFromUiId(int nItemID, PromptResolver* pResolver); static AudioSequence * playDialogControlFromUiIds(int dlgID, int ctrlId, bool playNow = true); static void fillSequenceContainerPromptFromId(AudioSequence* seq, string id); - static void fillSequencePrompt(AudioSequence* seq, Prompt* prompt, PromptResolver* pResolver = NULL); + static void fillSequencePrompt(AudioSequence* seq, Prompt* prompt, PromptResolver* pResolver); static void fillSequenceCaptionAndDescription(AudioSequence* seq, UiItem* uiItem); static void fillSequenceSwitch(AudioSequence* seq, UiItem* uiItem, string switchCondition = ""); static void fillSequenceContentAndPrompt(AudioSequence* seq, Label* label); Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/AboutDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/AboutDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/AboutDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -25,6 +25,9 @@ using namespace amis::gui::dialogs; +void AboutDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} AboutDialog::AboutDialog() : AmisDialogBase(AboutDialog::IDD) { } Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -31,6 +31,9 @@ IMPLEMENT_DYNAMIC(AmisDialogBase, CDialog) //IMPLEMENT_DYNCREATE(AmisDialogBase, CDialog) +void AmisDialogBase::resolvePromptVariables(Prompt* pPrompt) { + return; +} BOOL AmisDialogBase::PreTranslateMessageTextField(MSG* pMsg, UINT id) { if (Preferences::Instance()->getIsSelfVoicing() == false) @@ -132,7 +135,7 @@ { if (amis::Preferences::Instance()->getIsSelfVoicing() == true) { - AudioSequencePlayer::playDialogTextControlsFromUiId(mId); + AudioSequencePlayer::playDialogTextControlsFromUiId(mId, this); } mbFlag_FirstDraw = false; } Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -28,6 +28,10 @@ using namespace amis::gui::dialogs; +void GoToPageDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} + GoToPageDialog::GoToPageDialog(CWnd* pParent /*=NULL*/) : AmisDialogBase(GoToPageDialog::IDD) { Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -33,6 +33,11 @@ ON_BN_CLICKED(IDC_OPENBOOK, OnOpenbook) END_MESSAGE_MAP() + +void MultipleBooksOnVolumeDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} + MultipleBooksOnVolumeDialog::MultipleBooksOnVolumeDialog(CWnd* pParent /*=NULL*/, amis::UrlList* pUrlList) : AmisDialogBase(MultipleBooksOnVolumeDialog::IDD) { Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -31,6 +31,9 @@ //IMPLEMENT_DYNAMIC(OpenUrlDialog, CDialog) +void OpenUrlDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} OpenUrlDialog::OpenUrlDialog(CWnd* pParent /*=NULL*/) : AmisDialogBase(OpenUrlDialog::IDD) { Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PreferencesDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -52,6 +52,10 @@ ON_WM_PAINT() END_MESSAGE_MAP() +void PreferencesDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} + PreferencesDialog::PreferencesDialog(CWnd* pParent /*=NULL*/) : AmisDialogBase(PreferencesDialog::IDD) { Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -234,14 +234,10 @@ wstring wvalue; int idx = 0; - if (mpTitle != NULL) value = mpTitle->getText()->getTextString().c_str(); - else value = _T("Title not available"); - wvalue = value; + wvalue = computeTitle(); appendToList(p_list, title, wvalue); - if (mCreator.size() > 0) value = mCreator.c_str(); - else value = _T("Author not available"); - wvalue = value; + wvalue = computeAuthor(); appendToList(p_list, author, wvalue); appendToList(p_list, publisher, mPublisher); @@ -267,6 +263,136 @@ } } +CString PublicationSummaryDialog::computeAuthor() { + CString value; + + if (mCreator.size() > 0) value = mCreator.c_str(); + else value = _T("Author not available"); + + return value; +} +CString PublicationSummaryDialog::computeTitle() { + CString value; + + if (mpTitle != NULL) value = mpTitle->getText()->getTextString().c_str(); + else value = _T("Title not available"); + + return value; +} +void PublicationSummaryDialog::resolvePromptVariables(Prompt* pPrompt) { + + PromptVar* p_var = NULL; + + for (int i=0; i<pPrompt->getNumberOfItems(); i++) + { + if (pPrompt->getItem(i)->getPromptItemType() == PROMPT_VARIABLE) + { + p_var = (PromptVar*)pPrompt->getItem(i); + + if (p_var->getName() == "META_TITLE") + { + amis::AudioNode * node = mpTitle->getAudio(0); + + wstring str; + str = computeTitle(); + + if (node == NULL) { + p_var->setContents(str, ""); + } else { + p_var->setContents(str, node); + } + } + else if (p_var->getName() == "META_CREATOR") + { + wstring str; + str = computeAuthor(); + p_var->setContents(str, ""); + } + + else if (p_var->getName() == "META_PUBLISHER") + { + p_var->setContents(mPublisher, ""); + } + else if (p_var->getName() == "META_DESC") + { + p_var->setContents(mDescription, ""); + } + else if (p_var->getName() == "META_NARRATOR") + { + p_var->setContents(mNarrator, ""); + } + else if (p_var->getName() == "META_TOTALTIME") + { + p_var->setContents(mTotalTime, ""); + } + else if (p_var->getName() == "META_NUMPAGES") + { + CString value; + value.Format(_T("%d"), mTotalNumPages); + wstring str; + str = value; + p_var->setContents(str, ""); + } + else if (p_var->getName() == "META_DATE") + { + p_var->setContents(mDate, ""); + } + else if (p_var->getName() == "META_FORMAT") + { + p_var->setContents(mFormat, ""); + } + else if (p_var->getName() == "META_TOCITEMS") + { + p_var->setContents(mNavigableItems, ""); + } + + else if (p_var->getName() == "CURRENT_PAGE") + { + if (mpCurrentPage != NULL) { + p_var->setContents(mpCurrentPage->getText()->getTextString(), mpCurrentPage->getAudio(0)); + } + } + else if (p_var->getName() == "CURRENT_TIME") + { + p_var->setContents(L"TODO", ""); + } + + else if (p_var->getName() == "CURRENT_SECTION_TITLE") + { + if (mpSectionName != NULL) + { + p_var->setContents(mpSectionName->getText()->getTextString(), mpSectionName->getAudio(0)); + } + } + + else if (p_var->getName() == "CURRENT_SECTION_NUM_SUBSECTIONS") + { + CString value; + value.Format(_T("%d"), mNumSubsections); + wstring str; + str = value; + p_var->setContents(str, ""); + } + + else if (p_var->getName() == "CURRENT_SECTION_NUM_PAGES") + { + CString value; + value.Format(_T("%d"), mNumPagesForSection); + wstring str; + str = value; + p_var->setContents(str, ""); + } + + //TODO: what about the variables below: + //META_DEPTH + //TOC_CATEGORIES + // ?? + + } + } + AmisDialogBase::resolvePromptVariables(pPrompt); +} + void PublicationSummaryDialog::appendToList(CListCtrl* pList, CString field, wstring value) { //don't add empty items Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -37,6 +37,11 @@ ON_BN_CLICKED(IDC_OPENBOOK, OnOpenbook) END_MESSAGE_MAP() + +void SearchForBooksDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} + SearchForBooksDialog::SearchForBooksDialog(CWnd* pParent /*=NULL*/) : AmisDialogBase(SearchForBooksDialog::IDD) { Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/SkipDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -37,6 +37,11 @@ amis::gui::dialogs::SkipDialogVoicing * mpSkipDialogVoicing = NULL; + +void SkipDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} + SkipDialog::SkipDialog(CWnd* pParent /*=NULL*/) : AmisDialogBase(SkipDialog::IDD) { Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -42,6 +42,10 @@ ON_WM_PAINT() END_MESSAGE_MAP() +void TextStyleDialog::resolvePromptVariables(Prompt* pPrompt) { + return; +} + BOOL CALLBACK EnumFontCallback (LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData) { USES_CONVERSION; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -968,22 +968,18 @@ // This works for Prompts. void AudioSequencePlayer::playPromptFromStringId(string promptId) { - - - Prompt* p_prompt_ = DataTree::Instance()->findPrompt(promptId); if (p_prompt_ != NULL) { - AudioSequence * seq = new AudioSequence; + AudioSequence * seq = new AudioSequence; fillSequencePrompt(seq, p_prompt_, NULL); if (seq->GetCount() == 0) { delete seq; } else { - AudioSequencePlayer::Instance()->Play(seq); + AudioSequencePlayer::Instance()->Play(seq); } } - } //////////////////////////////////////////////////////////////////////////////////// @@ -1020,7 +1016,7 @@ if (p_dialog != NULL) { Prompt* prompt = p_dialog->getPrompt("instructions"); if (prompt != NULL) { - fillSequencePrompt(seq, prompt); + fillSequencePrompt(seq, prompt, NULL); } } if (seq->GetCount() == 0) { @@ -1036,7 +1032,7 @@ //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // This works for Dialogs -void AudioSequencePlayer::playDialogTextControlsFromUiId(int nItemID) { +void AudioSequencePlayer::playDialogTextControlsFromUiId(int nItemID, PromptResolver * presolver) { if (nItemID != -1) { @@ -1055,6 +1051,19 @@ if (-1 == find) { fillSequenceCaptionAndDescription(seq, control); } + + LabelList* p_list = control->getLabelList(); + if (p_list != NULL) + { + for (int i = 0; i<p_list->getNumberOfLabels(); i++) + { + Prompt* p_prompt = p_list->getLabel(i)->getPrompt(); + if (p_prompt != NULL) + { + fillSequencePrompt(seq, p_prompt, presolver); + } + } + } } } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 23:48:20 UTC (rev 2420) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-18 01:50:14 UTC (rev 2421) @@ -1,6 +1,9 @@ #include "gui/self-voicing/pretranslatemessagehandler.h" +#include "gui/self-voicing/datamodel/UiItem.h" +#include "gui/self-voicing/datamodel/DataTree.h" + #include "../../AmisGuiMFC2/resource.h" //#include "gui/AmisApp.h" @@ -273,17 +276,27 @@ AudioSequencePlayer::Instance()->RepeatLast(); return; } - else if(pMsg->wParam == 'T' && mbKeyControl == true && !strTextFieldFULL.IsEmpty()) + else if(pMsg->wParam == 'T' && mbKeyControl == true) { AudioSequence * mSeq = new AudioSequence(); mbKeyControl = false; - if (strTextFieldFULL.GetLength() == 1) { - strTextFieldFULL = convertKeystrokeToSpeakableString(strTextFieldFULL.GetAt(0)); + + Prompt* p_prompt_ = DataTree::Instance()->findPrompt("textFieldEntry"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::Instance()->fillSequencePrompt(mSeq, p_prompt_, NULL); } - mSeq->append(strTextFieldFULL); + + if (!strTextFieldFULL.IsEmpty()) { + if (strTextFieldFULL.GetLength() == 1) { + strTextFieldFULL = convertKeystrokeToSpeakableString(strTextFieldFULL.GetAt(0)); + } + mSeq->append(strTextFieldFULL); + } AudioSequencePlayer::Instance()->Play(mSeq); - + return; } else { @@ -310,9 +323,14 @@ mSeq = new AudioSequence(); - if (idUiFocus == IDC_URL && strTextFieldFULL.IsEmpty() && strTextField.IsEmpty()) { + if (idUiFocus == IDC_URL) { - mSeq->append("text"); + Prompt* p_prompt_ = DataTree::Instance()->findPrompt("textFieldEntry"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::Instance()->fillSequencePrompt(mSeq, p_prompt_, NULL); + } } } @@ -320,14 +338,13 @@ if (strTextFieldFULL.GetLength() == 1) { strTextFieldFULL = convertKeystrokeToSpeakableString(strTextFieldFULL.GetAt(0)); } - mSeq->prepend(strTextFieldFULL); + mSeq->append(strTextFieldFULL); } else if (! strTextField.IsEmpty()) { if (strTextField.GetLength() == 1) { strTextField = convertKeystrokeToSpeakableString(strTextField.GetAt(0)); } - mSeq->prepend(strTextField); + mSeq->append(strTextField); } - if (mSeq->GetCount() == 0) { delete mSeq; } else { @@ -351,6 +368,13 @@ } mSeq->append(strTextField); if (strTextField.Compare(strTextFieldFULL) != 0) { + + Prompt* p_prompt_ = DataTree::Instance()->findPrompt("textFieldEntry"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::Instance()->fillSequencePrompt(mSeq, p_prompt_, NULL); + } mSeq->append(strTextFieldFULL); } //if (playNow) AudioSequencePlayer::Instance()->Play(seq); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 23:48:14
|
Revision: 2420 http://amis.svn.sourceforge.net/amis/?rev=2420&view=rev Author: daniel_weck Date: 2008-03-17 16:48:20 -0700 (Mon, 17 Mar 2008) Log Message: ----------- - fixed a typo in XML for an ID that matches an item in resource.h - resource.h.ini was out of date: regenerated. - added support for Page Style menu item, although it currently interferes with the play menu...(global problem because of lack of MFC menu events...trying to find a different implementation to fix this). Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/resource.h branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.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/resource.h =================================================================== --- branches/amis3/AmisGuiMFC2/resource.h 2008-03-17 22:54:01 UTC (rev 2419) +++ branches/amis3/AmisGuiMFC2/resource.h 2008-03-17 23:48:20 UTC (rev 2420) @@ -95,7 +95,6 @@ #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 @@ -120,6 +119,7 @@ #define ID_AMIS_SHOW_HELP_CONTENTS 32950 #define ID_AMIS_ABOUT 32951 #define ID_AMIS_SHOW_TEXTSTYLE 32953 +#define ID_AMIS_NO_PAGE_STYLES 32954 #define IDS_SELFOLDER_TITLE 61258 #define IDS_SELFOLDER_INSTR 61259 #define IDS_FOLDERDOESNOTEXIST 61279 @@ -133,7 +133,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 193 -#define _APS_NEXT_COMMAND_VALUE 32954 +#define _APS_NEXT_COMMAND_VALUE 32955 #define _APS_NEXT_CONTROL_VALUE 1115 #define _APS_NEXT_SYMED_VALUE 143 #endif Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-03-17 22:54:01 UTC (rev 2419) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-03-17 23:48:20 UTC (rev 2420) @@ -46,6 +46,11 @@ firstItemId == AMIS_RECENT_BOOK_BASE_ID) { str_id = "recentBooksList"; } + + else if (firstItemId == ID_AMIS_NO_PAGE_STYLES || + firstItemId == AMIS_PAGE_STYLE_BASE_ID) { + str_id = "pageStylesList"; + } else if(firstItemId == ID_AMIS_TOGGLE_SIDEBAR) { str_id = "view"; @@ -211,7 +216,7 @@ } - if ((nItemID == 8 || nItemID == 2) && mFrm->m_lastOpenPopupMenu != NULL) { // 8 => "recent" (including separators), 2 => "show section depth" + if ((nItemID == 8 || nItemID == 2 || nItemID == 3) && 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); @@ -259,6 +264,26 @@ AudioSequencePlayer::Instance()->Play(seq); } return; + } else if (prompt.compare("view") == 0 || prompt.compare("pageStylesList") == 0) { + AudioSequencePlayer::fillSequenceContainerPromptFromId(seq, "pageStylesList"); + + + PromptItem* p_prompt_ = DataTree::Instance()->findPromptItem("menu"); + + if (p_prompt_ != NULL) + { + AudioSequencePlayer::fillSequenceContents(seq, p_prompt_); + } + else { + seq->append(_T("menu")); + } + + if (seq->GetCount() == 0) { + delete seq; + } else { + AudioSequencePlayer::Instance()->Play(seq); + } + return; } else { delete seq; } Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-17 22:54:01 UTC (rev 2419) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-17 23:48:20 UTC (rev 2420) @@ -226,7 +226,7 @@ <text id="xx">Page Style</text> <audio src=""/> </caption> - <action mfcid="ID_AMIS_NO_PAGE_STYLE" widget="menuItem"> + <action mfcid="ID_AMIS_NO_PAGE_STYLES" widget="menuItem"> <note>This is going to be a menu item</note> <caption> <text id="xx">None</text> Modified: branches/amis3/bin/settings/resource.h.ini =================================================================== --- branches/amis3/bin/settings/resource.h.ini 2008-03-17 22:54:01 UTC (rev 2419) +++ branches/amis3/bin/settings/resource.h.ini 2008-03-17 23:48:20 UTC (rev 2420) @@ -1,9 +1,6 @@ ; [resources] - - - IDD_ABOUTBOX=100 IDS_PROPSHT_CAPTION=102 IDD_SIDEBAR=103 @@ -28,6 +25,7 @@ IDB_BOOKSHELFMAG=186 IDD_OPENURL=190 IDD_PREFERENCES=191 +IDD_TEXTSTYLE=192 AMIS_RECENT_BOOK_BASE_ID=200 AMIS_SECTION_DEPTH_BASE_ID=250 AMIS_NAVLIST_BASE_ID=300 @@ -73,6 +71,16 @@ IDC_MULTIVOLCD_INSTRUCTIONS=1103 IDC_GOTOPAGE_CAPTION=1104 IDC_OPENURL_CAPTION=1105 +IDC_FONT=1106 +IDC_HIGHLIGHTFOREGROUND=1107 +IDC_HIGHLIGHTBACKGROUND=1108 +IDC_FONTLABEL=1109 +IDC_HIGHLIGHTFOREGROUNDLABEL=1110 +IDC_HIGHLIGHTBACKGROUNDLABEL=1111 +IDC_TEXTSTYLEPREVIEW=1112 +IDC_TEXTPREVIEW=1113 +IDC_EDIT1=1114 +SELF_VOICING_PLAY_NEXT=6969 IDC_CURRLANG=9002 IDC_VERSION=9006 IDC_VERSIONNOTE=9007 @@ -110,21 +118,10 @@ ID_AMIS_SHOW_PUBLICATION_SUMMARY=32949 ID_AMIS_SHOW_HELP_CONTENTS=32950 ID_AMIS_ABOUT=32951 +ID_AMIS_SHOW_TEXTSTYLE=32953 IDS_SELFOLDER_TITLE=61258 IDS_SELFOLDER_INSTR=61259 IDS_FOLDERDOESNOTEXIST=61279 IDS_FOLDERINVALID=61280 IDS_FOLDERCANTBECREATED=61281 IDS_FILE_OPEN_DAISY_BOOKS=61288 - - - - - -_APS_3D_CONTROLS=1 -_APS_NEXT_RESOURCE_VALUE=192 -_APS_NEXT_COMMAND_VALUE=32952 -_APS_NEXT_CONTROL_VALUE=1106 -_APS_NEXT_SYMED_VALUE=143 - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 22:53:58
|
Revision: 2419 http://amis.svn.sourceforge.net/amis/?rev=2419&view=rev Author: daniel_weck Date: 2008-03-17 15:54:01 -0700 (Mon, 17 Mar 2008) Log Message: ----------- fixed the weird kernel32.dll crash that happened in debugging mode (with untraceable assembly code), when closing the app after a self-voiced dialog was shown. Calling Stop() from the MFC event dispatch thread eradicated the problem...dunno why but it works. Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 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/PreTranslateMessageHandler.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-17 22:54:01 UTC (rev 2419) @@ -84,6 +84,7 @@ afx_msg void OnUpdateCmdUiBiggerFont(CCmdUI*); afx_msg void OnUpdateCmdUiSmallerFont(CCmdUI*); afx_msg void OnUpdateCmdUiBookmarks(CCmdUI*); + afx_msg void OnClose(); DECLARE_MESSAGE_MAP() public: void updateToolbarState(toolbar::Toolbar*); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -72,7 +72,7 @@ #if _DEBUG //get Visual Leak Detector version 1.0 here: http://dmoulding.googlepages.com/downloads -#include <vld.h> +//#include <vld.h> #endif using namespace amis::gui; @@ -865,27 +865,22 @@ //AudioSequencePlayer::Instance()->Stop(); AudioSequencePlayer::playPromptFromStringId("dialogClosed"); - if (b_was_playing == true) - { - - AudioSequencePlayer::Instance()->WaitForEndSeqAndRestartBook(); - - } + if (b_was_playing == true) + { + AudioSequencePlayer::Instance()->WaitForEndSeqAndRestartBook(); + } - } else { - //resume playback - if (b_was_playing == true) - { - - //MainWndParts::Instance()->mpMainFrame->PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); - - MmView *view = MainWndParts::Instance()->mpMmView; - view->OnFilePlay(); + //resume playback + if (b_was_playing == true) + { + //MainWndParts::Instance()->mpMainFrame->PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); + MmView *view = MainWndParts::Instance()->mpMmView; + view->OnFilePlay(); + } } - } } void CAmisApp::generalBookErrorMsgBox(CString str) Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -50,7 +50,8 @@ IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) - //{{AFX_MSG_MAP(CMainFrame) + //{{AFX_MSG_MAP(CMainFrame) + ON_WM_CLOSE() ON_WM_CREATE() //ON_MESSAGE(WM_MESSAGETOAMIS, OnMessageFromPlugin) ON_WM_INITMENUPOPUP() @@ -122,6 +123,13 @@ delete mCommonPreTranslateMessageHandler; delete mMenuVoicing; } + +void CMainFrame::OnClose() +{ + // That is a hack to remove a weird bug (crash after ExitInstance() when a self-voicing dialog was previously open) + AudioSequencePlayer::Instance()->Stop(); + CMDIFrameWnd::OnClose(); +} BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { if (amis::Preferences::Instance()->getIsSelfVoicing() == true) @@ -368,7 +376,7 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { - if (pMsg->message == WM_KEYUP) + if (pMsg->message == WM_KEYUP) { CWnd* cwnd = this->GetFocus(); if (pMsg->wParam == VK_ESCAPE) { Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -508,7 +508,6 @@ if (m_previousAudioSequence) { Play(m_previousAudioSequence); } - } //unsigned __stdcall eventHandler(void* lpParam) { @@ -535,7 +534,7 @@ HANDLE xeventHandler = CreateThread(NULL, 0, &eventHandlerY, 0, 0, &lpdwThreadID); //AfxBeginThread(eventHandlerX,0); //GetCurrentThreadId - TRACE("\nTHREAD ID (AUDIO_SEQ_PLAYER): %x\n", lpdwThreadID); + TRACE("\nTHREAD ID (WaitForEndSeqAndRestartBook): %x\n", lpdwThreadID); } void AudioSequencePlayer::Stop(bool fromPlay) Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -254,6 +254,7 @@ if (mbKeyControl && wasSameKey) { //if (seq != NULL && !(seq->IsEmpty()) && playNow) AudioSequencePlayer::Instance()->Play(seq, true); //else AudioSequencePlayer::Instance()->Stop(); + TRACE(L"\n @@@ CONTROL KEY STOP\n"); AudioSequencePlayer::Instance()->Stop(); } mbKeyControl = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 20:50:45
|
Revision: 2418 http://amis.svn.sourceforge.net/amis/?rev=2418&view=rev Author: daniel_weck Date: 2008-03-17 13:50:49 -0700 (Mon, 17 Mar 2008) Log Message: ----------- - added text-field support for self-voicing in SearchForBooksDialog - restored vld.h ... I am hoping to find where the first-chance exception comes from (0xC0000005: Access violation reading location) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 20:39:20 UTC (rev 2417) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 20:50:49 UTC (rev 2418) @@ -72,7 +72,7 @@ #if _DEBUG //get Visual Leak Detector version 1.0 here: http://dmoulding.googlepages.com/downloads -//#include <vld.h> +#include <vld.h> #endif using namespace amis::gui; Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp 2008-03-17 20:39:20 UTC (rev 2417) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp 2008-03-17 20:50:49 UTC (rev 2418) @@ -270,5 +270,5 @@ } } } - return AmisDialogBase::PreTranslateMessage(pMsg); + return AmisDialogBase::PreTranslateMessageTextField(pMsg ,IDC_SEARCHPATH); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 20:39:39
|
Revision: 2417 http://amis.svn.sourceforge.net/amis/?rev=2417&view=rev Author: daniel_weck Date: 2008-03-17 13:39:20 -0700 (Mon, 17 Mar 2008) Log Message: ----------- implemented a series of small hacks to make sure that undefined dialogs in AccessibleUi.xml still deliver a minimum set of meaningful info to the end-user, such as OK and CANCEL buttons. Also improved the text-field self-voicing a little bit, although it's not perfect yet. Oh yes, and also fixed a couple of issues related to the RETURN and ESCAPE key generating MFC actions on KEY_DOWN rather than KEY_UP, which tends to mess-up the self-voicing (i.e. a dialog closes on KEY_DOWN, then on KEY_UP the main window picks-up the event and overrides the "dialogClosed" prompt...and the user is all confused !). This does not happen with the SPACE key, as it triggers the MFC action on KEY_UP only. There was a similar problem with SHIFT+TAB combo for navigating widgets. Now fixed. Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/AmisDialogBase.h 2008-03-17 20:39:20 UTC (rev 2417) @@ -42,6 +42,7 @@ INT_PTR do_modal(); void setFirstDraw(bool); + BOOL PreTranslateMessageTextField(MSG* pMsg, UINT id); virtual BOOL PreTranslateMessage(MSG* pMsg); protected: bool mbFlag_FirstDraw; Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/OpenUrlDialog.h 2008-03-17 20:39:20 UTC (rev 2417) @@ -43,6 +43,8 @@ CString getUrl(); enum { IDD = IDD_OPENURL }; + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: virtual void DoDataExchange(CDataExchange* pDX); CString mUrl; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 20:39:20 UTC (rev 2417) @@ -86,6 +86,9 @@ static void fillSequenceContents(AudioSequence* seq, PromptItemBase* pi); static void resolvePromptVariables(Prompt*); + +private: + static void fillOK_CANCEL(AudioSequence * seq, UINT ctrlId); }; } Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 20:39:20 UTC (rev 2417) @@ -273,6 +273,9 @@ amis::util::Log::Instance()->DestroyInstance(); TRACE("\nEXIT.\n\n"); + + Sleep(1000); + return CWinApp::ExitInstance(); } Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/AmisDialogBase.cpp 2008-03-17 20:39:20 UTC (rev 2417) @@ -31,6 +31,47 @@ IMPLEMENT_DYNAMIC(AmisDialogBase, CDialog) //IMPLEMENT_DYNCREATE(AmisDialogBase, CDialog) +BOOL AmisDialogBase::PreTranslateMessageTextField(MSG* pMsg, UINT id) +{ + if (Preferences::Instance()->getIsSelfVoicing() == false) + return CDialog::PreTranslateMessage(pMsg); + + if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) + { + CWnd* cwnd = this->GetFocus(); + if (cwnd) + { + //int id = cwnd->GetDlgCtrlID(); + CEdit* p_edit = (CEdit*)GetDlgItem(id); + if (cwnd == p_edit) { + + CString str; + p_edit->GetWindowText(str); + + + if (!str.IsEmpty()) { + + CString strFULL = str; + + int nStartChar = -1; + int nEndChar = -1; + p_edit->GetSel(nStartChar, nEndChar); + + str = mCommonPreTranslateMessageHandler->normalizeTextEntry(str, nStartChar, nEndChar); + + if (!str.IsEmpty()) { // && (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) { + mCommonPreTranslateMessageHandler->handle(pMsg, (cwnd == NULL ? -1 : cwnd->GetDlgCtrlID()),false,true,str, strFULL, false); + return CDialog::PreTranslateMessage(pMsg); + } + } + } + + mCommonPreTranslateMessageHandler->handle(pMsg, (cwnd == NULL ? -1 : cwnd->GetDlgCtrlID())); + } + } + + return CDialog::PreTranslateMessage(pMsg); +} BOOL AmisDialogBase::PreTranslateMessage(MSG* pMsg) { if (Preferences::Instance()->getIsSelfVoicing() == false) Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp 2008-03-17 20:39:20 UTC (rev 2417) @@ -81,10 +81,9 @@ BOOL GoToPageDialog::PreTranslateMessage(MSG* pMsg) { - if (Preferences::Instance()->getIsSelfVoicing() == false) { - return CDialog::PreTranslateMessage(pMsg); - } + return AmisDialogBase::PreTranslateMessageTextField(pMsg, IDC_PAGENUM); + /* if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) { CWnd* cwnd = this->GetFocus(); @@ -119,4 +118,5 @@ } return CDialog::PreTranslateMessage(pMsg); + */ } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/OpenUrlDialog.cpp 2008-03-17 20:39:20 UTC (rev 2417) @@ -72,4 +72,9 @@ CWnd::DefWindowProc( WM_PAINT, (WPARAM)dc.m_hDC, 0 ); //call the base class on_paint function on_paint(); +} + +BOOL OpenUrlDialog::PreTranslateMessage(MSG* pMsg) +{ + return AmisDialogBase::PreTranslateMessageTextField(pMsg, IDC_URL); } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-17 20:39:20 UTC (rev 2417) @@ -30,7 +30,7 @@ } void AudioSequence::append(CString strTTS) { if (strTTS.IsEmpty()) { - TRACE(L"???????????????????????????"); + return; } AudioSequenceComponent* comp = new AudioSequenceComponent; comp->m_isAudioClip = false; @@ -41,7 +41,7 @@ void AudioSequence::prepend(CString strTTS) { if (strTTS.IsEmpty()) { - TRACE(L"???????????????????????????"); + return; } AudioSequenceComponent* comp = new AudioSequenceComponent; comp->m_isAudioClip = false; Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 20:39:20 UTC (rev 2417) @@ -1064,6 +1064,52 @@ } } + +void AudioSequencePlayer::fillOK_CANCEL(AudioSequence * seq, UINT ctrlId) { + if (ctrlId == IDCANCEL) { + PromptItem* p_prompt = DataTree::Instance()->findPromptItem("cancel_button_caption"); + if (p_prompt != NULL) + { + fillSequenceContents(seq, p_prompt); + //CString text = p_prompt->concatAllText().c_str(); + //seq->append(text); + } + p_prompt = DataTree::Instance()->findPromptItem("cancel_button_description"); + if (p_prompt != NULL) + { + fillSequenceContents(seq, p_prompt); + //CString text = p_prompt->concatAllText().c_str(); + //seq->append(text); + } + + } else if (ctrlId == IDOK) { + PromptItem* p_prompt = DataTree::Instance()->findPromptItem("ok_button_caption"); + if (p_prompt != NULL) + { + fillSequenceContents(seq, p_prompt); + //CString text = p_prompt->concatAllText().c_str(); + //seq->append(text); + } + p_prompt = DataTree::Instance()->findPromptItem("ok_button_description"); + if (p_prompt != NULL) + { + fillSequenceContents(seq, p_prompt); + //CString text = p_prompt->concatAllText().c_str(); + //seq->append(text); + } + + + /* Dialog* p_dialog = DataTree::Instance()->findDialog(IDD_ABOUTBOX); + if (p_dialog != NULL) { + DialogControl* control = p_dialog->findControl(IDOK); + + if (control != NULL) { + fillSequenceCaptionAndDescription(seq, control); + } + }*/ + } +} + //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // This works for Dialogs @@ -1077,49 +1123,7 @@ AudioSequence * seq = new AudioSequence; if (dlgID == -1) { - if (ctrlId == IDCANCEL) { - PromptItem* p_prompt = DataTree::Instance()->findPromptItem("cancel_button_caption"); - if (p_prompt != NULL) - { - fillSequenceContents(seq, p_prompt); - //CString text = p_prompt->concatAllText().c_str(); - //seq->append(text); - } - p_prompt = DataTree::Instance()->findPromptItem("cancel_button_description"); - if (p_prompt != NULL) - { - fillSequenceContents(seq, p_prompt); - //CString text = p_prompt->concatAllText().c_str(); - //seq->append(text); - } - - } else if (ctrlId == IDOK) { - PromptItem* p_prompt = DataTree::Instance()->findPromptItem("ok_button_caption"); - if (p_prompt != NULL) - { - fillSequenceContents(seq, p_prompt); - //CString text = p_prompt->concatAllText().c_str(); - //seq->append(text); - } - p_prompt = DataTree::Instance()->findPromptItem("ok_button_description"); - if (p_prompt != NULL) - { - fillSequenceContents(seq, p_prompt); - //CString text = p_prompt->concatAllText().c_str(); - //seq->append(text); - } - - - /* Dialog* p_dialog = DataTree::Instance()->findDialog(IDD_ABOUTBOX); - if (p_dialog != NULL) { - DialogControl* control = p_dialog->findControl(IDOK); - - if (control != NULL) { - fillSequenceCaptionAndDescription(seq, control); - } - }*/ - } - + fillOK_CANCEL(seq, ctrlId); } else { Dialog* p_dialog = DataTree::Instance()->findDialog(dlgID); if (p_dialog != NULL) { @@ -1128,6 +1132,8 @@ if (control != NULL) { fillSequenceCaptionAndDescription(seq, control); } + } else { + fillOK_CANCEL(seq, ctrlId); } } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 17:33:11 UTC (rev 2416) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 20:39:20 UTC (rev 2417) @@ -107,7 +107,8 @@ return L"control"; } else if (ch == VK_SHIFT) { - return L"shift"; + //return L"shift"; + return L""; // Because when this key is used in combination with TAB to reverse-navigate, it overrides the prompt for the dialog that is reached. } else if (ch == VK_LEFT) { if (!ignoreArrowKeys) return L"left"; @@ -122,16 +123,18 @@ if (!ignoreArrowKeys) return L"down"; } else if (ch == VK_ESCAPE) { - return L"escape"; + //return L"escape"; + return L""; // Because this key activates the corresponding MFC action (i.e. close a dialog) on KEY_DOWN, as opposed to KEY_UP, which means that the "dialogClosed" prompt would be overridden. The SPACE key does not have this problem. + } else if (ch == VK_RETURN) + { + //return L"return"; + return L""; // Because this key activates the corresponding MFC action (i.e. close a dialog) on KEY_DOWN, as opposed to KEY_UP, which means that the "dialogClosed" prompt would be overridden. The SPACE key does not have this problem. } else if (ch == VK_HOME) { if (!ignoreArrowKeys) return L"home"; } else if (ch == VK_END) { if (!ignoreArrowKeys) return L"end"; - } else if (ch == VK_RETURN) - { - return L"return"; } else if (ch == VK_TAB) { @@ -300,24 +303,35 @@ } else if (idUiFocus >= 0) { - /* - AudioSequence * mSeq = new AudioSequence(); - if (! strTextField.IsEmpty()) { - if (strTextField.GetLength() == 1) { - strTextField = convertKeystrokeToSpeakableString(strTextField.GetAt(0)); - } - mSeq->append(strTextField); - //if (playNow) AudioSequencePlayer::Instance()->Play(seq); - }*/ AudioSequence * mSeq = AudioSequencePlayer::Instance()->playDialogControlFromUiIds(m_instructionsDialogID, idUiFocus, false); + if (mSeq == NULL) { + + mSeq = new AudioSequence(); + + if (idUiFocus == IDC_URL && strTextFieldFULL.IsEmpty() && strTextField.IsEmpty()) { + + mSeq->append("text"); + } + } + if (! strTextFieldFULL.IsEmpty()) { if (strTextFieldFULL.GetLength() == 1) { strTextFieldFULL = convertKeystrokeToSpeakableString(strTextFieldFULL.GetAt(0)); } mSeq->prepend(strTextFieldFULL); + } else if (! strTextField.IsEmpty()) { + if (strTextField.GetLength() == 1) { + strTextField = convertKeystrokeToSpeakableString(strTextField.GetAt(0)); + } + mSeq->prepend(strTextField); } + + if (mSeq->GetCount() == 0) { + delete mSeq; + } else { AudioSequencePlayer::Instance()->Play(mSeq); + } return; } @@ -340,7 +354,7 @@ } //if (playNow) AudioSequencePlayer::Instance()->Play(seq); } - if (!(mSeq->IsEmpty()) && wasSameKey) { + if (!(mSeq->IsEmpty())) { // && wasSameKey) { AudioSequencePlayer::Instance()->Play(mSeq, true); return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 17:33:06
|
Revision: 2416 http://amis.svn.sourceforge.net/amis/?rev=2416&view=rev Author: daniel_weck Date: 2008-03-17 10:33:11 -0700 (Mon, 17 Mar 2008) Log Message: ----------- - trying to pin-down a weird crash *after* the application exits. I have added code to manually close the DX audio player thread instead of letting the Windows runtime do it. I'm not sure that's going to fix anything, I will keep testing. Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/directshow/dx_audio_player.h branches/amis3/AmisGuiMFC2/src/gui/MainFrm.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/self-voicing/directshow/dx_audio_player.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 04:28:03 UTC (rev 2415) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 17:33:11 UTC (rev 2416) @@ -56,6 +56,7 @@ HANDLE m_hThread; HANDLE m_hEventWakeup; + HANDLE m_hEventEnd; CRITICAL_SECTION m_csSequence; bool m_bAbort; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/directshow/dx_audio_player.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/directshow/dx_audio_player.h 2008-03-17 04:28:03 UTC (rev 2415) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/directshow/dx_audio_player.h 2008-03-17 17:33:11 UTC (rev 2416) @@ -153,8 +153,9 @@ static audio_playerX* Instance(); static void DestroyInstance(); + #ifdef SINGLE_THREAD_HACK -HANDLE m_hEventWakeup; + HANDLE m_hEventWakeup; #endif ~audio_playerX(); Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-17 04:28:03 UTC (rev 2415) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-17 17:33:11 UTC (rev 2416) @@ -268,7 +268,7 @@ void CMainFrame::OnMenuSelect( UINT nItemID, UINT nFlags, HMENU hSysMenu ) { - TRACE("\n\nHERE 1"); + TRACE("\nCMainFrame::OnMenuSelect()\n"); CFrameWnd::OnMenuSelect(nItemID, nFlags, hSysMenu); if (amis::Preferences::Instance()->getIsSelfVoicing() == true) @@ -279,7 +279,7 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) { - TRACE("\n\nHERE 2"); + TRACE("\nCMainFrame::OnInitMenuPopup()\n"); m_lastOpenPopupMenu = pPopupMenu; CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); @@ -318,7 +318,7 @@ void CMainFrame::OnInitMenu(CMenu* pMenu) { - TRACE("\n\n\n\HERE xxxxxxxxxxxxxxxx"); + TRACE("\nCMainFrame::OnInitMenu()\n"); CMDIFrameWnd::OnInitMenu(pMenu); } @@ -375,8 +375,8 @@ if (m_lastOpenPopupMenu != NULL) { m_lastOpenPopupMenu = NULL; } - TRACE("\n---------------DANOUL1\n\n"); - TRACE(L"%d", cwnd); + //TRACE("\n---------------DANOUL1\n\n"); + //TRACE(L"%d", cwnd); } } if (amis::Preferences::Instance()->getIsSelfVoicing() == true && @@ -386,16 +386,16 @@ if (cwnd) mCommonPreTranslateMessageHandler->handle(pMsg, (cwnd == NULL ? -1 : cwnd->GetDlgCtrlID())); } if (pMsg->message == WM_CANCELMODE) { - TRACE("\n---------------DANOUL2\n\n"); - TRACE(L"%d", pMsg->message); + //TRACE("\n---------------DANOUL2\n\n"); + //TRACE(L"%d", pMsg->message); } if (pMsg->wParam == WM_CANCELMODE) { - TRACE("\n---------------DANOUL3\n\n"); - TRACE(L"%d", pMsg->wParam); + //TRACE("\n---------------DANOUL3\n\n"); + //TRACE(L"%d", pMsg->wParam); } if (pMsg->lParam == WM_CANCELMODE) { - TRACE("\n---------------DANOUL4\n\n"); - TRACE(L"%d", pMsg->lParam); + //TRACE("\n---------------DANOUL4\n\n"); + //TRACE(L"%d", pMsg->lParam); } return CFrameWnd::PreTranslateMessage(pMsg); } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 04:28:03 UTC (rev 2415) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 17:33:11 UTC (rev 2416) @@ -534,6 +534,8 @@ //hEventHandler = (HANDLE) _beginthreadex(NULL, 0, eventHandler, (void*) this, 0, &lpdwThreadID); HANDLE xeventHandler = CreateThread(NULL, 0, &eventHandlerY, 0, 0, &lpdwThreadID); //AfxBeginThread(eventHandlerX,0); + //GetCurrentThreadId + TRACE("\nTHREAD ID (AUDIO_SEQ_PLAYER): %x\n", lpdwThreadID); } void AudioSequencePlayer::Stop(bool fromPlay) @@ -690,7 +692,7 @@ #endif //HWND hWnd = MainWndParts::Instance()->mpMainFrame->GetSafeHwnd(); - MainWndParts::Instance()->mpMainFrame->PostMessage(WM_COMMAND, (WPARAM)SELF_VOICING_PLAY_NEXT, (LPARAM)0); + MainWndParts::Instance()->mpMainFrame->SendMessage(WM_COMMAND, (WPARAM)SELF_VOICING_PLAY_NEXT, (LPARAM)0); //playNext(false); /* Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-03-17 04:28:03 UTC (rev 2415) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-03-17 17:33:11 UTC (rev 2416) @@ -215,11 +215,9 @@ UINT nID = mFrm->m_lastOpenPopupMenu->GetMenuItemID(0); std::string prompt = computeRootMenuFromFirstChildID(nID, false); - s.Format(_T("\n\n\n\n{{{ %d\n\n\n\n"), nItemID); //DAN_MENU_DEBUG + s.Format(_T("\nMenuVoicing::OnMenuSelect(%d) '%s'\n"), nItemID, prompt.c_str()); //DAN_MENU_DEBUG TRACE(s); - TRACE(prompt.c_str()); - AudioSequence* seq = createSeqPrepend(nFlags); if (prompt.compare("file") == 0 || prompt.compare("recentBooksList") == 0) { @@ -266,10 +264,9 @@ } } 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 + s.Format(_T("\nMenuVoicing::OnMenuSelect(%d)\n"), nItemID); //DAN_MENU_DEBUG TRACE(s); - AudioSequence* seq = createSeqPrepend(nFlags); switch (nItemID) { @@ -318,7 +315,9 @@ } else { - s.Format(_T("Item %d is selected"), nItemID); //DAN_MENU_DEBUG + + s.Format(_T("\nMenuVoicing::OnMenuSelect(%d is selected)\n"), nItemID); //DAN_MENU_DEBUG + TRACE(s); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/directshow/dx_audio_player.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/directshow/dx_audio_player.cpp 2008-03-17 04:28:03 UTC (rev 2415) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/directshow/dx_audio_player.cpp 2008-03-17 17:33:11 UTC (rev 2416) @@ -57,6 +57,11 @@ #define errorX #define traceX + +#ifdef SINGLE_THREAD_HACK + static bool bDestroyBreak = false; +#endif + static int nTimes = 0; //unsigned __stdcall eventHandler(void* lpParam) { @@ -71,7 +76,11 @@ int nn = ++nTimes; TRACE(L"\n== THREAD BEGIN %d\n", nn); - while(!bSelfBreak) { + while(!bSelfBreak +#ifdef SINGLE_THREAD_HACK + && !bDestroyBreak +#endif + ) { hResult = E_FAIL; #ifdef SINGLE_THREAD_HACK if (pPlayer->m_media_event == NULL) { @@ -166,15 +175,29 @@ hEventHandler(0) { set_rate(1.0); + +#ifdef SINGLE_THREAD_HACK + bDestroyBreak = false; m_hEventWakeup = CreateEvent(NULL, TRUE, FALSE, NULL); _ASSERT(m_hEventWakeup); ResetEvent(m_hEventWakeup); +#endif + InitializeCriticalSection(&m_csSequence); } gui::dx::audio_playerX::~audio_playerX() { - stop(true); + stop(true); + +#ifdef SINGLE_THREAD_HACK + TRACE(L"\n####### ~audio_playerX || SetEvent(m_hEventWakeup)\n"); + //end_thread(); + bDestroyBreak = true; + SetEvent(m_hEventWakeup); + CloseHandle(m_hEventWakeup); +#endif + DeleteCriticalSection(&m_csSequence); } @@ -785,6 +808,8 @@ unsigned long lpdwThreadID; //hEventHandler = (HANDLE) _beginthreadex(NULL, 0, eventHandler, (void*) this, 0, &lpdwThreadID); hEventHandler = CreateThread(NULL, 0, &eventHandler, this, 0, &lpdwThreadID); + //GetCurrentThreadId + TRACE("\nTHREAD ID (DX_AUDIO_PLAYER): %x\n", lpdwThreadID); } #ifdef SINGLE_THREAD_HACK SetEvent(m_hEventWakeup); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 04:28:03
|
Revision: 2415 http://amis.svn.sourceforge.net/amis/?rev=2415&view=rev Author: daniel_weck Date: 2008-03-16 21:28:03 -0700 (Sun, 16 Mar 2008) Log Message: ----------- improved self-voicing for textfield widget (tested with GotoPage) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h 2008-03-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/GoToPageDialog.h 2008-03-17 04:28:03 UTC (rev 2415) @@ -40,6 +40,7 @@ //Dialog Data enum { IDD = IDD_GOTOPAGE }; std::wstring getPageNumber(); + virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL OnInitDialog(); Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h 2008-03-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h 2008-03-17 04:28:03 UTC (rev 2415) @@ -30,6 +30,7 @@ AudioSequenceComponent* RemoveTail(); void AddTail(AudioSequenceComponent* comp); void append(CString strTTS); + void prepend(CString strTTS); void append(amis::AudioNode* audioClip, CString strTTS); AudioSequence* clone(); private: @@ -40,4 +41,4 @@ } } } -#endif \ No newline at end of file +#endif Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 04:28:03 UTC (rev 2415) @@ -75,7 +75,7 @@ static void playPromptItemFromStringId(string); static void playDialogInstructionsFromUiId(int nItemID); static void playDialogTextControlsFromUiId(int nItemID); - static void playDialogControlFromUiIds(int dlgID, int ctrlId); + static AudioSequence * playDialogControlFromUiIds(int dlgID, int ctrlId, bool playNow = true); static void fillSequenceContainerPromptFromId(AudioSequence* seq, string id); static void fillSequencePrompt(AudioSequence* seq, Prompt* prompt, PromptResolver* pResolver = NULL); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 04:28:03 UTC (rev 2415) @@ -72,7 +72,7 @@ #if _DEBUG //get Visual Leak Detector version 1.0 here: http://dmoulding.googlepages.com/downloads -#include <vld.h> +//#include <vld.h> #endif using namespace amis::gui; Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp 2008-03-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/GoToPageDialog.cpp 2008-03-17 04:28:03 UTC (rev 2415) @@ -24,6 +24,8 @@ #include "gui/dialogs/GoToPageDialog.h" #include "../resource.h" +#include "Preferences.h" + using namespace amis::gui::dialogs; GoToPageDialog::GoToPageDialog(CWnd* pParent /*=NULL*/) @@ -75,4 +77,46 @@ CWnd::DefWindowProc( WM_PAINT, (WPARAM)dc.m_hDC, 0 ); //call the base class on_paint function on_paint(); +} + +BOOL GoToPageDialog::PreTranslateMessage(MSG* pMsg) +{ + if (Preferences::Instance()->getIsSelfVoicing() == false) { + return CDialog::PreTranslateMessage(pMsg); + } + + if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) + { + CWnd* cwnd = this->GetFocus(); + if (cwnd) { + //int id = cwnd->GetDlgCtrlID(); + CEdit* p_edit = (CEdit*)GetDlgItem(IDC_PAGENUM); + if (cwnd == p_edit) { + + CString str; + p_edit->GetWindowText(str); + + + if (!str.IsEmpty()) { + + CString strFULL = str; + + int nStartChar = -1; + int nEndChar = -1; + p_edit->GetSel(nStartChar, nEndChar); + + str = mCommonPreTranslateMessageHandler->normalizeTextEntry(str, nStartChar, nEndChar); + + if (!str.IsEmpty()) { // && (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) { + mCommonPreTranslateMessageHandler->handle(pMsg, (cwnd == NULL ? -1 : cwnd->GetDlgCtrlID()),false,true,str, strFULL, false); + return CDialog::PreTranslateMessage(pMsg); + } + } + } + + mCommonPreTranslateMessageHandler->handle(pMsg, (cwnd == NULL ? -1 : cwnd->GetDlgCtrlID())); + } + } + + return CDialog::PreTranslateMessage(pMsg); } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-17 04:28:03 UTC (rev 2415) @@ -5,55 +5,66 @@ AudioSequence::AudioSequence(){} AudioSequence::~AudioSequence(){ - if (m_AudioSequence.GetCount() > 0) - { - for (size_t i = 0; i < m_AudioSequence.GetCount(); i++) { - AudioSequenceComponent* comp = m_AudioSequence.GetAt(m_AudioSequence.FindIndex(i)); - delete comp; - } + if (m_AudioSequence.GetCount() > 0) + { + for (size_t i = 0; i < m_AudioSequence.GetCount(); i++) { + AudioSequenceComponent* comp = m_AudioSequence.GetAt(m_AudioSequence.FindIndex(i)); + delete comp; + } - m_AudioSequence.RemoveAll(); - } + m_AudioSequence.RemoveAll(); } +} UINT AudioSequence::GetCount() { - return m_AudioSequence.GetCount(); - } + return m_AudioSequence.GetCount(); +} bool AudioSequence::IsEmpty() { - return m_AudioSequence.GetCount() == 0; - } + return m_AudioSequence.GetCount() == 0; +} AudioSequenceComponent* AudioSequence::RemoveTail() { - return m_AudioSequence.RemoveTail(); - }; + return m_AudioSequence.RemoveTail(); +}; void AudioSequence::AddTail(AudioSequenceComponent* comp) { - m_AudioSequence.AddTail(comp); + m_AudioSequence.AddTail(comp); +} +void AudioSequence::append(CString strTTS) { + if (strTTS.IsEmpty()) { + TRACE(L"???????????????????????????"); } - void AudioSequence::append(CString strTTS) { - if (strTTS.IsEmpty()) { - TRACE(L"???????????????????????????"); - } - AudioSequenceComponent* comp = new AudioSequenceComponent; - comp->m_isAudioClip = false; - comp->m_AudioClip = 0; - comp->m_String = strTTS; - m_AudioSequence.AddHead(comp); + AudioSequenceComponent* comp = new AudioSequenceComponent; + comp->m_isAudioClip = false; + comp->m_AudioClip = 0; + comp->m_String = strTTS; + m_AudioSequence.AddHead(comp); +} + +void AudioSequence::prepend(CString strTTS) { + if (strTTS.IsEmpty()) { + TRACE(L"???????????????????????????"); } + AudioSequenceComponent* comp = new AudioSequenceComponent; + comp->m_isAudioClip = false; + comp->m_AudioClip = 0; + comp->m_String = strTTS; + m_AudioSequence.AddTail(comp); +} void AudioSequence::append(amis::AudioNode* audioClip, CString strTTS) { if (audioClip->getSrc().length() == 0) { int here = 1; } - AudioSequenceComponent* comp = new AudioSequenceComponent; - comp->m_isAudioClip = TRUE; - comp->m_AudioClip = audioClip; - comp->m_String = strTTS; - m_AudioSequence.AddHead(comp); + AudioSequenceComponent* comp = new AudioSequenceComponent; + comp->m_isAudioClip = TRUE; + comp->m_AudioClip = audioClip; + comp->m_String = strTTS; + m_AudioSequence.AddHead(comp); +} +AudioSequence* AudioSequence::clone() { + AudioSequence* seq = new AudioSequence; + for (size_t i = 0; i < m_AudioSequence.GetCount(); i++) { + AudioSequenceComponent* comp = m_AudioSequence.GetAt(m_AudioSequence.FindIndex(i))->clone(); + seq->AddTail(comp); } - AudioSequence* AudioSequence::clone() { - AudioSequence* seq = new AudioSequence; - for (size_t i = 0; i < m_AudioSequence.GetCount(); i++) { - AudioSequenceComponent* comp = m_AudioSequence.GetAt(m_AudioSequence.FindIndex(i))->clone(); - seq->AddTail(comp); - } - - return seq; - } \ No newline at end of file + + return seq; +} \ 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-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 04:28:03 UTC (rev 2415) @@ -516,9 +516,14 @@ //UINT __cdecl eventHandlerX( LPVOID pParam ) { AudioSequencePlayer::Instance()->waitForSequenceEnd(); + //MmView *view = MainWndParts::Instance()->mpMmView; //view->OnFilePlay(); - MainWndParts::Instance()->mpMainFrame->PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); + try { + MainWndParts::Instance()->mpMainFrame->PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); + } catch (exception e) { + int i = 0; + } //_endthreadex( 0 ); return 0; @@ -1060,17 +1065,15 @@ //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // This works for Dialogs -void AudioSequencePlayer::playDialogControlFromUiIds(int dlgID, int ctrlId) { +AudioSequence * AudioSequencePlayer::playDialogControlFromUiIds(int dlgID, int ctrlId, bool playNow) { if ( (dlgID != -1 && ctrlId != -1) || (dlgID == -1 && (ctrlId == IDOK || ctrlId == IDCANCEL)) ) { - - - AudioSequence * seq = new AudioSequence; - + AudioSequence * seq = new AudioSequence; + if (dlgID == -1) { if (ctrlId == IDCANCEL) { PromptItem* p_prompt = DataTree::Instance()->findPromptItem("cancel_button_caption"); @@ -1104,42 +1107,42 @@ //seq->append(text); } - + /* Dialog* p_dialog = DataTree::Instance()->findDialog(IDD_ABOUTBOX); if (p_dialog != NULL) { - DialogControl* control = p_dialog->findControl(IDOK); + DialogControl* control = p_dialog->findControl(IDOK); - if (control != NULL) { - fillSequenceCaptionAndDescription(seq, control); - } + if (control != NULL) { + fillSequenceCaptionAndDescription(seq, control); + } }*/ } - - - - - } else { Dialog* p_dialog = DataTree::Instance()->findDialog(dlgID); if (p_dialog != NULL) { DialogControl* control = p_dialog->findControl(ctrlId); if (control != NULL) { - fillSequenceCaptionAndDescription(seq, control); - } + fillSequenceCaptionAndDescription(seq, control); + } } } if (seq != NULL && seq->GetCount() == 0) { - delete seq; - - } else { + delete seq; + return NULL; - AudioSequencePlayer::Instance()->Play(seq); + } else if (playNow) { + + AudioSequencePlayer::Instance()->Play(seq); + return seq; } + else return seq; + + } - } + return NULL; } //////////////////////////////////////////////////////////////////////////////////// Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 03:44:41 UTC (rev 2414) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 04:28:03 UTC (rev 2415) @@ -309,7 +309,15 @@ mSeq->append(strTextField); //if (playNow) AudioSequencePlayer::Instance()->Play(seq); }*/ - AudioSequencePlayer::Instance()->playDialogControlFromUiIds(m_instructionsDialogID, idUiFocus); + AudioSequence * mSeq = AudioSequencePlayer::Instance()->playDialogControlFromUiIds(m_instructionsDialogID, idUiFocus, false); + + if (! strTextFieldFULL.IsEmpty()) { + if (strTextFieldFULL.GetLength() == 1) { + strTextFieldFULL = convertKeystrokeToSpeakableString(strTextFieldFULL.GetAt(0)); + } + mSeq->prepend(strTextFieldFULL); + } + AudioSequencePlayer::Instance()->Play(mSeq); return; } @@ -317,11 +325,19 @@ AudioSequence * mSeq = new AudioSequence(); + if (!(pMsg->wParam == VK_HOME || pMsg->wParam == VK_END || pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) + { + + mSeq->append(convertKeystrokeToSpeakableString(pMsg, false, true, false)); + } if (! strTextField.IsEmpty()) { if (strTextField.GetLength() == 1) { strTextField = convertKeystrokeToSpeakableString(strTextField.GetAt(0)); } mSeq->append(strTextField); + if (strTextField.Compare(strTextFieldFULL) != 0) { + mSeq->append(strTextFieldFULL); + } //if (playNow) AudioSequencePlayer::Instance()->Play(seq); } if (!(mSeq->IsEmpty()) && wasSameKey) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-17 03:46:01
|
Revision: 2413 http://amis.svn.sourceforge.net/amis/?rev=2413&view=rev Author: marisademeglio Date: 2008-03-16 20:41:55 -0700 (Sun, 16 Mar 2008) Log Message: ----------- edited issues list Modified Paths: -------------- branches/amis3/amis_issues.txt Modified: branches/amis3/amis_issues.txt =================================================================== --- branches/amis3/amis_issues.txt 2008-03-17 03:19:14 UTC (rev 2412) +++ branches/amis3/amis_issues.txt 2008-03-17 03:41:55 UTC (rev 2413) @@ -10,70 +10,44 @@ NEW FEATURES (things to add) --- * finish self-voicing for all dialogs -* add navlists to view menu -* re-add tooltips -* next/previous page/phrase/section should be enabled or disabled according to the book state -* opening URLs from the command line (add a new command line parameter: http://www.codeguru.com/forum/showthread.php?t=386406) ISSUES and BUGS (things to address) --- * stabilize self-voicing for menus * new audio backend makes reading options dialog crash -* zed books need a stylesheet +* Zed stylesheet doesn't work + ==>problem reproduced in a test app: applying CSS to XML in an HtmlView doesn't work * Listviews have more than one column, cutting off text * window resizing problems with HTML view -* navigation not highlighted until you click on it -* speed buttons reset when you open a new book - 1. open a book - 2. play - 3. select "faster" - 4. make sure that the button for "faster" is not active - 5. close the book - 6. open the same book - 7. see the buttons for speed * audio does not change speed -* book in a japanese folder can't be opened -* search drives crashes - 1. search drives - 2. open a title - 3. search drives - 4. select a title - -* search drives opens wrong title - on w2k - 1. search drives - 2. select the title(bcakeM_202) - 3. it opens Dogs_bM - - on xp and Vista - 1. search drives - 2. select the title(newreadP) - 3. it opens newread_atauP - -* after opening a title using open from URL, it only shows navigation, it does not show html portion and it does not start playing - -KNOWN ISSUES (not going to change) +KNOWN ISSUES (not going to change for alpha 2; should be listed as bugs to work on for beta 1) --- * Load CD shows more titles than the ones on discinfo.html + ==>is this really a bug? * japanese characters not shown in sidebar in win2k ==>not known if this is still an issue in alpha 2; you can set the sidebar font so maybe that will help * shows □□ for <br /> in the list of bookmarks * play/pause state doesn't toggle correctly on startup -* IE7 right-click menu works (ideally, it shouldn't appear) +* IE7 right-click menu appears although, ideally, it shouldn't * a book won't close all the way -* navigating online books crashes +* can't open a URL from the command line +* speed buttons reset when you open a new book + 1. open a book + 2. play + 3. select "faster" + 4. make sure that the button for "faster" is not active + 5. close the book + 6. open the same book + 7. see the buttons for speed + ==>want to wait and see what happens when the audio speed itself is working again AMBULANT ISSUES (some of these are repeated from the above "Known Issues" list) -- * How to stop ambulant when closing a book * review skippability across document boundaries (need reading options dialog to work) * memory leaks -* navigation for online books crashes: - 1. open from URL - 2. type URL - 3. wait till it shows navigation - 4. click on any heading +* book in a japanese folder can't be opened (ambulant::net::url problem?) BETA (APRIL 1) ================= @@ -93,6 +67,10 @@ ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK * add commands to increase/decrease specific volumes * highlight current section (in sidebar) in same color as page highlight +* opening URLs from the command line (add a new command line parameter: http://www.codeguru.com/forum/showthread.php?t=386406) +* add navlists to view menu +* re-add tooltips +* next/previous page/phrase/section should be enabled or disabled according to the book state IMPROVEMENTS --- @@ -139,4 +117,5 @@ * dialog to adjust highlight colors and font type * font and fontsize control in the sidebar * phrase arrow keys work when the focus is in the sidebar -* page navigation bug fixed \ No newline at end of file +* page navigation bug fixed +* navigation cursor synchronized This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-17 03:46:00
|
Revision: 2414 http://amis.svn.sourceforge.net/amis/?rev=2414&view=rev Author: marisademeglio Date: 2008-03-16 20:44:41 -0700 (Sun, 16 Mar 2008) Log Message: ----------- Navigation highlight works Modified Paths: -------------- branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-17 03:41:55 UTC (rev 2413) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-17 03:44:41 UTC (rev 2414) @@ -206,34 +206,6 @@ "Dtb::open", "AmisCore"); return false; } - - //testing only! - // print the play order list - //******************************** - // Save the original stdout buffer. - std::streambuf * sobuf = cout.rdbuf(); - std::ofstream fileout; - fileout.open("c:\\devel\\amis\\branches\\amis3\\bin\\playorder_printout.txt"); - std::streambuf * filebuf = fileout.rdbuf(); - cout.rdbuf(filebuf); - amis::dtb::nav::NavNodeList* p_list = this->getNavModel()->getPlayOrderList(); - for (int i = 0; i<p_list->size(); i++) - { - cout<<"# "<<i<<" = "<<endl; - if ((*p_list)[i]->getTypeOfNode() == amis::dtb::nav::NavNode::NAV_POINT) - cout<<"Nav Point "; - else if ((*p_list)[i]->getTypeOfNode() == amis::dtb::nav::NavNode::PAGE_TARGET) - cout<<"Page Target "; - else if ((*p_list)[i]->getTypeOfNode() == amis::dtb::nav::NavNode::NAV_TARGET) - cout<<"Nav Target "; - - cout<<(*p_list)[i]->getId()<<endl; - } - - fileout.close(); - cout.rdbuf(sobuf); - //***********************end test - loadBookmarks(mpFiles->getBookmarksFilepath()); amis::util::Log::Instance()->writeMessage("Opened book successfully", "Dtb::open", "AmisCore"); return true; @@ -580,6 +552,7 @@ setNewLastmark(data_uri); } +//this function does more than it seems .. it needs a better name //it turns out that this method signature is friendlier for ambulant than the other setNewLastmark function void amis::dtb::Dtb::setNewLastmark(ambulant::net::url positionUri) { @@ -609,13 +582,14 @@ { p_node = mpNavModel->getNodeForSmilId(smil_file_name, mpNavModel->getPageList()); if (p_node != NULL && mpCurrentNavNode->getPlayOrder() < p_node->getPlayOrder()) + { mpCurrentNavNode = p_node; + } } } } mpBookmarks->setLastmark(p_pos_data); - amis::io::BookmarksFileIO bmk_file_io; bmk_file_io.writeToFile(mpFiles->getBookmarksFilepath(), mpBookmarks); } Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-17 03:41:55 UTC (rev 2413) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-17 03:44:41 UTC (rev 2414) @@ -270,7 +270,7 @@ BEGIN CONTROL "Tab1",IDC_TAB,"SysTabControl32",TCS_BOTTOM,0,163,175,18 CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASLINES | - WS_BORDER | WS_TABSTOP,0,0,175,164 + TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,0,0,175,164 CONTROL "List1",IDC_LIST_PAGE,"SysListView32",LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | Modified: branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h 2008-03-17 03:41:55 UTC (rev 2413) +++ branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h 2008-03-17 03:44:41 UTC (rev 2414) @@ -60,12 +60,13 @@ void setPageFGColor(amis::util::Color); void setFontName(std::string); void setFontSize(double); - + void setSelectedNode(amis::dtb::nav::NavPoint*); + void setSelectedNode(amis::dtb::nav::PageTarget*); enum { IDD = IDD_SIDEBAR }; - CTabCtrl m_wndTab; - CTreeCtrl m_wndTree; - CListCtrl m_wndPageList; - int m_iSel; + CTabCtrl mTabStrip; + CTreeCtrl mTree; + CListCtrl mPageList; + int mTabSel; afx_msg void OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnSelchangeTree(NMHDR* pNMHDR, LRESULT* pResult); @@ -97,7 +98,8 @@ CFont mDefaultFont; CFont* mpAlteredFont; int mFontSizeInPoints; - + bool mbIgnoreTreeSelect; + bool mbIgnorePageListSelect; DECLARE_MESSAGE_MAP(); friend class AmisSidebarLoader; Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-17 03:41:55 UTC (rev 2413) +++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2008-03-17 03:44:41 UTC (rev 2414) @@ -937,6 +937,9 @@ //set the lastmark amis::dtb::DtbWithHooks::Instance()->setNewLastmark(m_current_url); + //highlight the sidebar + amis::dtb::nav::NavNode* p_node = amis::dtb::DtbWithHooks::Instance()->getCurrentNavNode(); + amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg.setSelectedNode((amis::dtb::nav::NavPoint*)p_node); } void MmView::node_stopped(const ambulant::lib::node *n) Modified: branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-17 03:41:55 UTC (rev 2413) +++ branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-17 03:44:41 UTC (rev 2414) @@ -133,8 +133,8 @@ { if (mbWaitForDocumentLoad) { - mpAmisCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet - (Preferences::Instance()->getAmisCssFile()); + //mpAmisCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet + // (Preferences::Instance()->getAmisCssFile()); //TODO: does this ever work? need to test more books. if (amis::dtb::DtbWithHooks::Instance()->getDaisyVersion() == amis::dtb::DAISY_2005) MainWndParts::Instance()->mpHtmlView->applyStylesheet(Preferences::Instance()->getZed2005CssFile()); Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-17 03:41:55 UTC (rev 2413) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-17 03:44:41 UTC (rev 2414) @@ -49,7 +49,7 @@ CAmisSidebar::CAmisSidebar(CWnd* pParent /*=NULL*/) : cdxCDynamicBarDlg(CAmisSidebar::IDD, pParent) { - m_iSel = 0; + mTabSel = 0; mFontSizeInPoints = AMIS_SIDEBAR_SMALLEST_FONT_SIZE; } @@ -63,9 +63,9 @@ void CAmisSidebar::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_TAB, m_wndTab); - DDX_Control(pDX, IDC_TREE, m_wndTree); - DDX_Control(pDX, IDC_LIST_PAGE, m_wndPageList); + DDX_Control(pDX, IDC_TAB, mTabStrip); + DDX_Control(pDX, IDC_TREE, mTree); + DDX_Control(pDX, IDC_LIST_PAGE, mPageList); } void CAmisSidebar::clearAll() @@ -87,12 +87,12 @@ if (p_navl) delete p_navl; } - if (m_wndTree) m_wndTree.DeleteAllItems(); - if (m_wndPageList) m_wndPageList.DeleteAllItems(); + if (mTree) mTree.DeleteAllItems(); + if (mPageList) mPageList.DeleteAllItems(); - if (m_wndTab) + if (mTabStrip) { - m_wndTab.DeleteAllItems(); + mTabStrip.DeleteAllItems(); this->RedrawWindow(); } mNumTabs = 0; @@ -108,8 +108,8 @@ } void CAmisSidebar::setPageBGColor(amis::util::Color clr) { - m_wndTree.SetBkColor(clr.getAsColorRef()); - m_wndPageList.SetBkColor(clr.getAsColorRef()); + mTree.SetBkColor(clr.getAsColorRef()); + mPageList.SetBkColor(clr.getAsColorRef()); for (int i = 0; i<mNavLists.size(); i++) { mNavLists[i]->SetBkColor(clr.getAsColorRef()); @@ -117,8 +117,8 @@ } void CAmisSidebar::setPageFGColor(amis::util::Color clr) { - m_wndTree.SetTextColor(clr.getAsColorRef()); - m_wndPageList.SetTextColor(clr.getAsColorRef()); + mTree.SetTextColor(clr.getAsColorRef()); + mPageList.SetTextColor(clr.getAsColorRef()); for (int i = 0; i<mNavLists.size(); i++) { mNavLists[i]->SetTextColor(clr.getAsColorRef()); @@ -128,7 +128,7 @@ { USES_CONVERSION; CFont* p_font = NULL; - p_font=m_wndTree.GetFont(); + p_font=mTree.GetFont(); LOGFONT lf; p_font->GetLogFont(&lf); CString font_name; @@ -139,8 +139,8 @@ lf.lfWeight = 600; mDefaultFont.DeleteObject(); mDefaultFont.CreatePointFontIndirect(&lf); - m_wndTree.SetFont(&mDefaultFont); - m_wndPageList.SetFont(&mDefaultFont); + mTree.SetFont(&mDefaultFont); + mPageList.SetFont(&mDefaultFont); for (int i = 0; i < mNavLists.size(); i++) { mNavLists[i]->SetFont(&mDefaultFont); @@ -162,8 +162,8 @@ lf.lfHeight = mFontSizeInPoints; mDefaultFont.DeleteObject(); mDefaultFont.CreatePointFontIndirect(&lf); - m_wndTree.SetFont(&mDefaultFont); - m_wndPageList.SetFont(&mDefaultFont); + mTree.SetFont(&mDefaultFont); + mPageList.SetFont(&mDefaultFont); for (int i = 0; i < mNavLists.size(); i++) { mNavLists[i]->SetFont(&mDefaultFont); @@ -171,20 +171,20 @@ } void CAmisSidebar::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult) { - m_iSel = m_wndTab.GetCurSel(); - if (m_iSel == 0) + mTabSel = mTabStrip.GetCurSel(); + if (mTabSel == 0) { showNavMap(); } - else if(m_iSel == 1) + else if(mTabSel == 1) { if (amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages() == true) showPageList(); - else showNavList(m_iSel-1); + else showNavList(mTabSel-1); } else { - if (amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages() == true) showNavList(m_iSel-2); - else showNavList(m_iSel-1); + if (amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages() == true) showNavList(mTabSel-2); + else showNavList(mTabSel-1); } *pResult = 0; } @@ -193,10 +193,11 @@ void CAmisSidebar::OnSelchangeTree(NMHDR* pNMHDR, LRESULT* pResult) { if (theApp.isBookOpen() == false) return; + if (mbIgnoreTreeSelect == true) return; amis::dtb::nav::NavPoint* p_nav = NULL; HTREEITEM item; - item = m_wndTree.GetSelectedItem(); - p_nav = (amis::dtb::nav::NavPoint*)m_wndTree.GetItemData(item); + item = mTree.GetSelectedItem(); + p_nav = (amis::dtb::nav::NavPoint*)mTree.GetItemData(item); if (p_nav != NULL) amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_nav); } @@ -210,13 +211,14 @@ void CAmisSidebar::OnPageListClick(NMHDR* pNMHDR, LRESULT* pResult) { if (theApp.isBookOpen() == false) return; + if (mbIgnorePageListSelect == true) return; amis::dtb::nav::PageTarget* p_page = NULL; int curr_sel; - curr_sel = m_wndPageList.GetSelectionMark(); + curr_sel = mPageList.GetSelectionMark(); if (curr_sel > -1) { - p_page = (amis::dtb::nav::PageTarget*)m_wndPageList.GetItemData(curr_sel); + p_page = (amis::dtb::nav::PageTarget*)mPageList.GetItemData(curr_sel); if (p_page != NULL) amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_page); } } @@ -227,33 +229,35 @@ //by the list control because the message hasn't gone through yet //so we need to go either forward or back one, depending on what key the user pressed + if (mbIgnorePageListSelect == true) + { + *pResult = 0; + return; + } + NMLVKEYDOWN* pKeyDown = (NMLVKEYDOWN*)pNMHDR; - amis::dtb::nav::PageTarget* p_page = NULL; - int curr_sel; string content; - curr_sel = m_wndPageList.GetSelectionMark(); - + curr_sel = mPageList.GetSelectionMark(); if (pKeyDown->wVKey == VK_UP && (!mIsControlDown || !mIsShiftDown)) { - if (curr_sel - 1 > -1 && curr_sel - 1 < m_wndPageList.GetItemCount()) + if (curr_sel - 1 > -1 && curr_sel - 1 < mPageList.GetItemCount()) { curr_sel--; - p_page = (amis::dtb::nav::PageTarget*)m_wndPageList.GetItemData(curr_sel); + p_page = (amis::dtb::nav::PageTarget*)mPageList.GetItemData(curr_sel); } } else if (pKeyDown->wVKey == VK_DOWN && (!mIsControlDown || !mIsShiftDown)) { - if (curr_sel + 1 > -1 && curr_sel + 1 < m_wndPageList.GetItemCount()) + if (curr_sel + 1 > -1 && curr_sel + 1 < mPageList.GetItemCount()) { curr_sel++; - p_page = (amis::dtb::nav::PageTarget*)m_wndPageList.GetItemData(curr_sel); + p_page = (amis::dtb::nav::PageTarget*)mPageList.GetItemData(curr_sel); } } if (p_page != NULL) amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_page); - *pResult = 0; } @@ -263,7 +267,7 @@ cdxCDynamicBarDlg::OnInitDialog(); - m_wndTree.GetWindowRect(mInitialRect); + mTree.GetWindowRect(mInitialRect); this->GetWindowRect(mInitialParentRect); mNumTabs = 0; @@ -300,16 +304,17 @@ mImagesForTab.Add(hIcon[1]); mImagesForTab.Add(hIcon[2]); - m_wndTab.SetImageList(&mImagesForTab); + mTabStrip.SetImageList(&mImagesForTab); - AddSzControl(m_wndTree,mdResize,mdResize); - AddSzControl(m_wndTab,mdResize,mdRepos); - AddSzControl(m_wndPageList, mdResize, mdResize); + AddSzControl(mTree,mdResize,mdResize); + AddSzControl(mTabStrip,mdResize,mdRepos); + AddSzControl(mPageList, mdResize, mdResize); - m_wndPageList.ShowWindow(SW_HIDE); - m_wndTab.ShowWindow(SW_HIDE); - m_wndTree.ShowWindow(SW_HIDE); - + mPageList.ShowWindow(SW_HIDE); + mTabStrip.ShowWindow(SW_HIDE); + mTree.ShowWindow(SW_HIDE); + mbIgnoreTreeSelect = false; + mbIgnorePageListSelect = false; return TRUE; } @@ -394,13 +399,13 @@ } void CAmisSidebar::showPageList() { - m_wndPageList.ShowWindow(SW_SHOW); - m_wndTree.ShowWindow(SW_HIDE); + mPageList.ShowWindow(SW_SHOW); + mTree.ShowWindow(SW_HIDE); for (unsigned int i=0; i<mNavLists.size(); i++) mNavLists[i]->ShowWindow(SW_HIDE); - m_wndPageList.SetFocus(); + mPageList.SetFocus(); this->RedrawWindow(); //TODO: then amis should play an audio prompt "pages" } @@ -417,8 +422,8 @@ mNavLists[idx]->ShowWindow(SW_SHOW); - m_wndPageList.ShowWindow(SW_HIDE); - m_wndTree.ShowWindow(SW_HIDE); + mPageList.ShowWindow(SW_HIDE); + mTree.ShowWindow(SW_HIDE); mNavLists[idx]->SetFocus(); this->RedrawWindow(); @@ -432,12 +437,12 @@ void CAmisSidebar::showNavMap() { - m_wndTree.ShowWindow(SW_SHOW); + mTree.ShowWindow(SW_SHOW); for (unsigned int i=0; i<mNavLists.size(); i++) mNavLists[i]->ShowWindow(SW_HIDE); - m_wndPageList.ShowWindow(SW_HIDE); - m_wndTree.SetFocus(); + mPageList.ShowWindow(SW_HIDE); + mTree.SetFocus(); this->RedrawWindow(); //TODO: amis should play an audio prompt "sections" } @@ -452,7 +457,7 @@ GetWindowRect(parent_rect); //the pageview's rectangle - m_wndPageList.GetWindowRect(rect); + mPageList.GetWindowRect(rect); //use init rects when sizing a runtime control //the sizing control manager requires this @@ -475,8 +480,8 @@ void CAmisSidebar::addTab(std::wstring label) { CString tab_label = label.c_str(); - int pos = m_wndTab.GetItemCount() + 1; - m_wndTab.InsertItem(pos, tab_label, pos-1); + int pos = mTabStrip.GetItemCount() + 1; + mTabStrip.InsertItem(pos, tab_label, pos-1); mNumTabs++; } @@ -509,17 +514,17 @@ //save the current selection HTREEITEM h_selected = NULL; - h_selected = m_wndTree.GetSelectedItem(); + h_selected = mTree.GetSelectedItem(); - HTREEITEM h_curr = m_wndTree.GetRootItem(); + HTREEITEM h_curr = mTree.GetRootItem(); //first: collapse all branches while (h_curr != NULL) { treeBranchCollapse(h_curr); - h_curr = m_wndTree.GetNextSiblingItem(h_curr); + h_curr = mTree.GetNextSiblingItem(h_curr); } - h_curr = m_wndTree.GetRootItem(); + h_curr = mTree.GetRootItem(); //then expand to the right depth if (level > 1) @@ -527,28 +532,28 @@ while (h_curr != NULL) { treeBranchExpand(h_curr, level-1); - h_curr = m_wndTree.GetNextSiblingItem(h_curr); + h_curr = mTree.GetNextSiblingItem(h_curr); } } //make sure the selection is visible - if (h_selected == NULL) h_selected = m_wndTree.GetRootItem(); - m_wndTree.EnsureVisible(h_selected); + if (h_selected == NULL) h_selected = mTree.GetRootItem(); + mTree.EnsureVisible(h_selected); } void CAmisSidebar::treeBranchCollapse(HTREEITEM hItem) { HTREEITEM h_curr = hItem; - if(h_curr != NULL && m_wndTree.ItemHasChildren(h_curr) == TRUE) + if(h_curr != NULL && mTree.ItemHasChildren(h_curr) == TRUE) { - m_wndTree.Expand(h_curr, TVE_COLLAPSE ); - h_curr = m_wndTree.GetChildItem(h_curr); + mTree.Expand(h_curr, TVE_COLLAPSE ); + h_curr = mTree.GetChildItem(h_curr); while (h_curr != NULL) { treeBranchCollapse(h_curr); - h_curr = m_wndTree.GetNextSiblingItem(h_curr); + h_curr = mTree.GetNextSiblingItem(h_curr); } } } @@ -557,15 +562,85 @@ { HTREEITEM h_curr = hItem; - if (h_curr != NULL && level > 0 && m_wndTree.ItemHasChildren(h_curr) == TRUE) + if (h_curr != NULL && level > 0 && mTree.ItemHasChildren(h_curr) == TRUE) { - m_wndTree.Expand(h_curr, TVE_EXPAND); - h_curr = m_wndTree.GetChildItem(h_curr); + mTree.Expand(h_curr, TVE_EXPAND); + h_curr = mTree.GetChildItem(h_curr); while (h_curr != NULL) { treeBranchExpand(h_curr, level - 1); - h_curr = m_wndTree.GetNextSiblingItem(h_curr); + h_curr = mTree.GetNextSiblingItem(h_curr); } } +} + +void CAmisSidebar::setSelectedNode(amis::dtb::nav::NavPoint* pNode) +{ + if (pNode == NULL) return; + mbIgnoreTreeSelect = true; + + HTREEITEM h_curr; + HTREEITEM h_temp; + h_curr = mTree.GetFirstVisibleItem(); + bool b_found = false; + amis::dtb::nav::NavPoint* p_item_data = NULL; + while (h_curr != NULL && b_found == false) + { + p_item_data = (amis::dtb::nav::NavPoint*)mTree.GetItemData(h_curr); + if (p_item_data == pNode) + { + b_found = true; + } + else + { + //it will not autotraverse in-order, so give it a parameter..next sibling, child, whatever + //the idea is to go to the first child + h_temp = mTree.GetNextItem(h_curr, TVGN_CHILD); + //otherwise go to the sibling item + if (h_temp == NULL) h_temp = mTree.GetNextItem(h_curr, TVGN_NEXT); + //otherwise find a parent who has siblings + if (h_temp == NULL) + { + h_temp = h_curr; + HTREEITEM h_parent; + do + { + h_parent = mTree.GetParentItem(h_temp); + if (h_parent != NULL) + { + h_temp = mTree.GetNextItem(h_parent, TVGN_NEXT); + if (h_temp == NULL) h_temp = h_parent; + else break; + } + else + { + //we are at the root so just return NULL + //the root has no info + h_temp = NULL; + break; + } + } + while (1); + } + h_curr = h_temp; + } + } + + if (b_found == true && h_curr != NULL) + mTree.SelectItem(h_curr) == TRUE; + + mbIgnoreTreeSelect = false; +} +void CAmisSidebar::setSelectedNode(amis::dtb::nav::PageTarget* pNode) +{ + if (pNode == NULL) return; + mbIgnorePageListSelect = true; + + LVITEM item; + mPageList.SetSelectionMark(pNode->getIndex()); + mPageList.GetItem(&item); + mPageList.SetItemState(pNode->getIndex(), 0, LVIS_SELECTED); + + mbIgnorePageListSelect = false; } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp 2008-03-17 03:41:55 UTC (rev 2413) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp 2008-03-17 03:44:41 UTC (rev 2414) @@ -53,7 +53,7 @@ mpSidebar = pSidebar; mpSidebar->clearAll(); - mpSidebar->m_wndTab.ShowWindow(SW_SHOW); + mpSidebar->mTabStrip.ShowWindow(SW_SHOW); //1. load nav map if (pNavModel != NULL && pNavModel->getNavMap() != NULL) @@ -64,15 +64,15 @@ //load its data pNavModel->getNavMap()->acceptDepthFirst(this); - mpSidebar->m_wndTree.ShowWindow(SW_SHOW); - mpSidebar->m_wndTree.Expand(mpSidebar->m_wndTree.GetRootItem(), 3); + mpSidebar->mTree.ShowWindow(SW_SHOW); + mpSidebar->mTree.Expand(mpSidebar->mTree.GetRootItem(), 3); } //2. load the pagelist if (pNavModel->hasPages()) { mpSidebar->addTab(getTextLabel(pNavModel->getPageList())); - loadNavList(pNavModel->getPageList(), &mpSidebar->m_wndPageList); + loadNavList(pNavModel->getPageList(), &mpSidebar->mPageList); } //3. load the navlists (if exist) @@ -115,7 +115,7 @@ int level = ((amis::dtb::nav::NavPoint*)pNode)->getLevel(); if (level == 1) { - hItem = mpSidebar->m_wndTree.InsertItem(tmpstr); + hItem = mpSidebar->mTree.InsertItem(tmpstr); hParent = hItem; mWidgetNodes.clear(); } @@ -134,10 +134,10 @@ mWidgetNodes.pop_back(); } - hItem = mpSidebar->m_wndTree.InsertItem(tmpstr, mWidgetNodes.back()); + hItem = mpSidebar->mTree.InsertItem(tmpstr, mWidgetNodes.back()); } mWidgetNodes.push_back(hItem); - mpSidebar->m_wndTree.SetItemData(hItem, (DWORD)pNode); + mpSidebar->mTree.SetItemData(hItem, (DWORD)pNode); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 03:19:11
|
Revision: 2412 http://amis.svn.sourceforge.net/amis/?rev=2412&view=rev Author: daniel_weck Date: 2008-03-16 20:19:14 -0700 (Sun, 16 Mar 2008) Log Message: ----------- - aligned TTS speed with book and UI speed (was too fast) Modified Paths: -------------- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 03:07:28 UTC (rev 2411) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 03:19:14 UTC (rev 2412) @@ -572,7 +572,7 @@ amis::util::Log::Instance()->writeMessage("Speed increase", "CAmisApp::OnSpeedUp", "AmisGuiMFC2"); long currentRate = amis::tts::TTSPlayer::Instance()->GetSpeechRate(); - amis::tts::TTSPlayer::Instance()->SetSpeechRate(currentRate+2); + amis::tts::TTSPlayer::Instance()->SetSpeechRate(currentRate+1); double rate = ambulant::gui::dx::change_global_rate(0.5); ambulantX::gui::dx::audio_playerX::Instance()->set_rate(rate); @@ -585,7 +585,7 @@ amis::util::Log::Instance()->writeMessage("Speed decrease", "CAmisApp::OnSpeedDown", "AmisGuiMFC2"); long currentRate = amis::tts::TTSPlayer::Instance()->GetSpeechRate(); - amis::tts::TTSPlayer::Instance()->SetSpeechRate(currentRate-2); + amis::tts::TTSPlayer::Instance()->SetSpeechRate(currentRate-1); //TODO: Doesn't seem to affect the playback speed at all double rate = ambulant::gui::dx::change_global_rate(-0.5); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2008-03-17 03:07:27
|
Revision: 2411 http://amis.svn.sourceforge.net/amis/?rev=2411&view=rev Author: daniel_weck Date: 2008-03-16 20:07:28 -0700 (Sun, 16 Mar 2008) Log Message: ----------- - fixed a very strange memory leak Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/directshow/dx_audio_player.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h 2008-03-16 23:09:37 UTC (rev 2410) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequence.h 2008-03-17 03:07:28 UTC (rev 2411) @@ -30,9 +30,7 @@ AudioSequenceComponent* RemoveTail(); void AddTail(AudioSequenceComponent* comp); void append(CString strTTS); - void append(amis::AudioNode* audioClip); - void prepend(CString strTTS); - void prepend(amis::AudioNode* audioClip); + void append(amis::AudioNode* audioClip, CString strTTS); AudioSequence* clone(); private: CAtlList<AudioSequenceComponent*> m_AudioSequence; Modified: branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-16 23:09:37 UTC (rev 2410) +++ branches/amis3/AmisGuiMFC2/include/gui/self-voicing/AudioSequencePlayer.h 2008-03-17 03:07:28 UTC (rev 2411) @@ -29,7 +29,7 @@ public: string stringReplaceAll(string sourceStr, string searchStr, string replaceStr); -void playAudioPrompt(amis::AudioNode* pAudio); +bool playAudioPrompt(amis::AudioNode* pAudio); static bool InstanceExists(); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-16 23:09:37 UTC (rev 2410) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequence.cpp 2008-03-17 03:07:28 UTC (rev 2411) @@ -38,34 +38,16 @@ comp->m_String = strTTS; m_AudioSequence.AddHead(comp); } -void AudioSequence::append(amis::AudioNode* audioClip) { +void AudioSequence::append(amis::AudioNode* audioClip, CString strTTS) { if (audioClip->getSrc().length() == 0) { int here = 1; - } AudioSequenceComponent* comp = new AudioSequenceComponent; comp->m_isAudioClip = TRUE; comp->m_AudioClip = audioClip; - comp->m_String = L""; + comp->m_String = strTTS; m_AudioSequence.AddHead(comp); } - void AudioSequence::prepend(CString strTTS) { - if (strTTS.IsEmpty()) { - TRACE(L"???????????????????????????"); - } - AudioSequenceComponent* comp = new AudioSequenceComponent; - comp->m_isAudioClip = false; - comp->m_AudioClip = 0; - comp->m_String = strTTS; - m_AudioSequence.AddTail(comp); - } - void AudioSequence::prepend(amis::AudioNode* audioClip) { - AudioSequenceComponent* comp = new AudioSequenceComponent; - comp->m_isAudioClip = TRUE; - comp->m_AudioClip = audioClip; - comp->m_String = L""; - m_AudioSequence.AddTail(comp); - } AudioSequence* AudioSequence::clone() { AudioSequence* seq = new AudioSequence; for (size_t i = 0; i < m_AudioSequence.GetCount(); i++) { Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-16 23:09:37 UTC (rev 2410) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 03:07:28 UTC (rev 2411) @@ -610,7 +610,12 @@ } TRACE(L"\n============ PLAY AUDIO CLIP\n"); - playAudioPrompt(comp->m_AudioClip); + bool b = playAudioPrompt(comp->m_AudioClip); + + if (!b && !comp->m_String.IsEmpty()) { + bIgnoreTTSEnd = false; + TTSPlayer::Instance()->Play(comp->m_String); + } //if (fromEndEvent) {CoUninitialize();} @@ -770,11 +775,11 @@ return source_str; } -void AudioSequencePlayer::playAudioPrompt(amis::AudioNode* pAudio) +bool AudioSequencePlayer::playAudioPrompt(amis::AudioNode* pAudio) { string str = pAudio->getSrc(); if (str.length()==0) { - return; + return false; } string strFull = pAudio->getSrcExpanded(); @@ -789,7 +794,7 @@ strFull = pAudio->getSrcExpanded(); } - ambulantX::gui::dx::audio_playerX::Instance()->play(strFull.c_str()); + return ambulantX::gui::dx::audio_playerX::Instance()->play(strFull.c_str()); /* @@ -1216,13 +1221,15 @@ TextAudioPair* pair = label->getContents(); if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); + + TextNodeSV* textN = pair->getText(); + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { - seq->append(audio->clone()); + seq->append(audio->clone(), (textN != NULL ? textN->getTextString().c_str() : L"")); } else { - TextNodeSV* textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); @@ -1247,13 +1254,15 @@ if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); + + TextNodeSV * textN = pair->getText(); + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { - seq->append(audio->clone()); + seq->append(audio->clone(), (textN != NULL ? textN->getTextString().c_str() : L"")); } else { - TextNodeSV * textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); @@ -1271,13 +1280,15 @@ if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); + + TextNodeSV * textN = pair->getText(); + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { - seq->append(audio->clone()); + seq->append(audio->clone(), (textN != NULL ? textN->getTextString().c_str() : L"")); } else { - TextNodeSV * textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); @@ -1298,13 +1309,14 @@ TextAudioPair* pair = pi->getContents(); if (pair != NULL) { amis::AudioNode* audio = pair->getAudio(); + TextNodeSV * textN = pair->getText(); + if (!Preferences::Instance()->getUseTTSNotAudio() && audio != NULL && audio->getSrc().length() != 0) { - seq->append(audio->clone()); + seq->append(audio->clone(), (textN != NULL ? textN->getTextString().c_str() : L"")); } else { - TextNodeSV * textN = pair->getText(); if (textN != NULL) { seq->append(textN->getTextString().c_str()); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-16 23:09:37 UTC (rev 2410) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-17 03:07:28 UTC (rev 2411) @@ -339,16 +339,43 @@ //text element else if (strcmp(node_name, "text") == 0) { + if (this->mbFlag_ProcessingPromptItemRefs == true) + { + int last_prompt_item = mpData->getNumPromptItems(); + if (last_prompt_item > 0) + { + PromptItem* p_item = NULL; + p_item = mpData->getPromptItem(last_prompt_item-1); + + if (p_item != NULL) + { + TextNodeSV* p_text = new TextNodeSV(); + + string mnemonic; + mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); + if (!mnemonic.empty()) + { + + p_text->setMnemonic(mnemonic); + } + + mpRecentTextNode = p_text; + + mbFlag_GetChars = true; + p_item->getContents()->setText(p_text); + } + } + } else if (mpRecentLabel != NULL && mpRecentPrompt == NULL) { TextNodeSV* p_text = new TextNodeSV(); - - string mnemonic; - mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); - if (!mnemonic.empty()) - { + + string mnemonic; + mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); + if (!mnemonic.empty()) + { p_text->setMnemonic(mnemonic); - + } mpRecentTextNode = p_text; @@ -381,14 +408,14 @@ if (p_item->getPromptItemType() == PROMPT_ITEM) { TextNodeSV* p_text = new TextNodeSV(); - - string mnemonic; - mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); - if (!mnemonic.empty()) - { + string mnemonic; + mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); + if (!mnemonic.empty()) + { + p_text->setMnemonic(mnemonic); - + } mpRecentTextNode = p_text; @@ -398,7 +425,13 @@ } } } - else if (this->mbFlag_ProcessingPromptItemRefs == true) + + } + + //audio element + else if (strcmp(node_name, "audio") == 0) + { + if (this->mbFlag_ProcessingPromptItemRefs == true) { int last_prompt_item = mpData->getNumPromptItems(); if (last_prompt_item > 0) @@ -408,38 +441,29 @@ if (p_item != NULL) { - TextNodeSV* p_text = new TextNodeSV(); - - string mnemonic; - mnemonic.assign(SimpleAttrs::get("mnemonic", &attributes)); - if (!mnemonic.empty()) - { + amis::AudioNode* p_audio = new amis::AudioNode(); - p_text->setMnemonic(mnemonic); + string src; + src.assign(SimpleAttrs::get("src", &attributes)); + if (!src.empty()) + { + p_audio->setSrc(src); } - - mpRecentTextNode = p_text; - - mbFlag_GetChars = true; - p_item->getContents()->setText(p_text); + + p_item->getContents()->setAudio(p_audio); } } - } - } - - //audio element - else if (strcmp(node_name, "audio") == 0) - { + } else if (mpRecentLabel != NULL && mpRecentPrompt == NULL) { amis::AudioNode* p_audio = new amis::AudioNode(); - - string src; - src.assign(SimpleAttrs::get("src", &attributes)); - if (!src.empty()) - { + string src; + src.assign(SimpleAttrs::get("src", &attributes)); + if (!src.empty()) + { + p_audio->setSrc(src); } @@ -469,13 +493,13 @@ if (p_item->getPromptItemType() == PROMPT_ITEM) { amis::AudioNode* p_audio = new amis::AudioNode(); - - string src; - src.assign(SimpleAttrs::get("src", &attributes)); - if (!src.empty()) - { + + string src; + src.assign(SimpleAttrs::get("src", &attributes)); + if (!src.empty()) + { p_audio->setSrc(src); - + } @@ -483,29 +507,6 @@ } } } - else if (this->mbFlag_ProcessingPromptItemRefs == true) - { - int last_prompt_item = mpData->getNumPromptItems(); - if (last_prompt_item > 0) - { - PromptItem* p_item = NULL; - p_item = mpData->getPromptItem(last_prompt_item-1); - - if (p_item != NULL) - { - amis::AudioNode* p_audio = new amis::AudioNode(); - - string src; - src.assign(SimpleAttrs::get("src", &attributes)); - if (!src.empty()) - { - p_audio->setSrc(src); - } - - p_item->getContents()->setAudio(p_audio); - } - } - } } //icon element @@ -695,16 +696,17 @@ } this->mpRecentPrompt = p_prompt; - + + if (this->mbFlag_ProcessingGeneralPrompts == true) + { + mpData->addPrompt(mpRecentPrompt); + } + else //if we are processing a label, then the prompt belongs to it if (mpRecentLabel != NULL) { mpRecentLabel->setPrompt(mpRecentPrompt); } - else if (this->mbFlag_ProcessingGeneralPrompts == true) - { - mpData->addPrompt(mpRecentPrompt); - } //else it belongs to a dialog else Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-03-16 23:09:37 UTC (rev 2410) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/dialogs/MenuVoicing.cpp 2008-03-17 03:07:28 UTC (rev 2411) @@ -403,7 +403,9 @@ p_audio = p_note->getAudio(0); if (p_audio != NULL) { - seq->append(p_audio->clone()); + amis::TextNode* p_text = NULL; + p_text = p_note->getText(); + seq->append(p_audio->clone(), (p_text != NULL ? p_text->getTextString().c_str() : L"")); AudioSequencePlayer::Instance()->Play(seq); return; } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/directshow/dx_audio_player.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/directshow/dx_audio_player.cpp 2008-03-16 23:09:37 UTC (rev 2410) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/directshow/dx_audio_player.cpp 2008-03-17 03:07:28 UTC (rev 2411) @@ -75,7 +75,7 @@ hResult = E_FAIL; #ifdef SINGLE_THREAD_HACK if (pPlayer->m_media_event == NULL) { - Sleep(100); + //Sleep(100); continue; } #endif @@ -311,7 +311,7 @@ pIMES = NULL; #endif -Sleep(100); +//Sleep(100); TRACE(L"\n####### -- STOP DX || AFTER END THREAD\n"); @@ -736,7 +736,7 @@ else errorX("%s: DirectX error 0x%x", url.c_str(), hr); */ - + release_player(); LeaveCriticalSection(&m_csSequence); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-16 23:09:30
|
Revision: 2410 http://amis.svn.sourceforge.net/amis/?rev=2410&view=rev Author: marisademeglio Date: 2008-03-16 16:09:37 -0700 (Sun, 16 Mar 2008) Log Message: ----------- fixed page navigation bug Modified Paths: -------------- 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/AmisCore/src/dtb/nav/NavVisitor.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp Modified: branches/amis3/AmisCore/include/dtb/nav/NavModel.h =================================================================== --- branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-03-16 23:09:11 UTC (rev 2409) +++ branches/amis3/AmisCore/include/dtb/nav/NavModel.h 2008-03-16 23:09:37 UTC (rev 2410) @@ -63,13 +63,13 @@ PageTarget* nextPage(int); //add a node to the big ordered list. the node will not necessarily be next in sequence. void addToPlayOrderList(NavNode*); - vector<amis::dtb::nav::NavNode*> getPlayOrderList(); + NavNodeList* getPlayOrderList(); private: NavMap* mpNavMap; PageList* mpPageList; NodeRefMap* mpSmilIdNodeMap; NavListList mNavLists; - std::vector<NavNode*> mPlayOrderList; + NavNodeList mPlayOrderList; }; } } Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-16 23:09:11 UTC (rev 2409) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-16 23:09:37 UTC (rev 2410) @@ -207,6 +207,33 @@ return false; } + //testing only! + // print the play order list + //******************************** + // Save the original stdout buffer. + std::streambuf * sobuf = cout.rdbuf(); + std::ofstream fileout; + fileout.open("c:\\devel\\amis\\branches\\amis3\\bin\\playorder_printout.txt"); + std::streambuf * filebuf = fileout.rdbuf(); + cout.rdbuf(filebuf); + amis::dtb::nav::NavNodeList* p_list = this->getNavModel()->getPlayOrderList(); + for (int i = 0; i<p_list->size(); i++) + { + cout<<"# "<<i<<" = "<<endl; + if ((*p_list)[i]->getTypeOfNode() == amis::dtb::nav::NavNode::NAV_POINT) + cout<<"Nav Point "; + else if ((*p_list)[i]->getTypeOfNode() == amis::dtb::nav::NavNode::PAGE_TARGET) + cout<<"Page Target "; + else if ((*p_list)[i]->getTypeOfNode() == amis::dtb::nav::NavNode::NAV_TARGET) + cout<<"Nav Target "; + + cout<<(*p_list)[i]->getId()<<endl; + } + + fileout.close(); + cout.rdbuf(sobuf); + //***********************end test + loadBookmarks(mpFiles->getBookmarksFilepath()); amis::util::Log::Instance()->writeMessage("Opened book successfully", "Dtb::open", "AmisCore"); return true; @@ -578,9 +605,9 @@ } //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) + if (mpNavModel->hasPages() == true) { - p_node = mpNavModel->getNodeForSmilId(uri_ref, mpNavModel->getPageList()); + p_node = mpNavModel->getNodeForSmilId(smil_file_name, mpNavModel->getPageList()); if (p_node != NULL && mpCurrentNavNode->getPlayOrder() < p_node->getPlayOrder()) mpCurrentNavNode = p_node; } Modified: branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-03-16 23:09:11 UTC (rev 2409) +++ branches/amis3/AmisCore/src/dtb/nav/NavModel.cpp 2008-03-16 23:09:37 UTC (rev 2410) @@ -292,7 +292,7 @@ } amis::dtb::nav::NavPoint* amis::dtb::nav::NavModel::nextSection(int currentPlayOrder) { - int idx = currentPlayOrder + 1; + int idx = currentPlayOrder; if (idx >= mPlayOrderList.size() || idx <= 0) return NULL; for (int i = idx; i < mPlayOrderList.size(); i++) @@ -307,7 +307,7 @@ } amis::dtb::nav::PageTarget* amis::dtb::nav::NavModel::previousPage(int currentPlayOrder) { - int idx = currentPlayOrder - 1; + int idx = currentPlayOrder - 2; if (idx >= mPlayOrderList.size() || idx <= 0) return NULL; for (int i = idx; i >=0; i--) @@ -322,7 +322,8 @@ } amis::dtb::nav::PageTarget* amis::dtb::nav::NavModel::nextPage(int currentPlayOrder) { - int idx = currentPlayOrder + 1; + //play order is 1-based; the array is 0-based + int idx = currentPlayOrder; if (idx >= mPlayOrderList.size() || idx <= 0) return NULL; for (int i = idx; i < mPlayOrderList.size(); i++) @@ -335,7 +336,7 @@ } return NULL; } -vector<amis::dtb::nav::NavNode*> amis::dtb::nav::NavModel::getPlayOrderList() +amis::dtb::nav::NavNodeList* amis::dtb::nav::NavModel::getPlayOrderList() { - return mPlayOrderList; + return &mPlayOrderList; } \ No newline at end of file Modified: branches/amis3/AmisCore/src/dtb/nav/NavVisitor.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavVisitor.cpp 2008-03-16 23:09:11 UTC (rev 2409) +++ branches/amis3/AmisCore/src/dtb/nav/NavVisitor.cpp 2008-03-16 23:09:37 UTC (rev 2410) @@ -241,7 +241,6 @@ std::ofstream fileout; if (toFile == true) { - //TODO: take the path out fileout.open("map_printout.txt"); std::streambuf * filebuf = fileout.rdbuf(); cout.rdbuf(filebuf); Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-16 23:09:11 UTC (rev 2409) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-16 23:09:37 UTC (rev 2410) @@ -329,9 +329,7 @@ if (pMsg->message == WM_KEYDOWN) { //let the arrow keys operate the tree view - if ((pMsg->wParam == VK_LEFT || - pMsg->wParam == VK_RIGHT || - pMsg->wParam == VK_UP || + if ((pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || pMsg->wParam == VK_RETURN)&& mIsControlDown == false && This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-16 23:09:12
|
Revision: 2409 http://amis.svn.sourceforge.net/amis/?rev=2409&view=rev Author: marisademeglio Date: 2008-03-16 16:09:11 -0700 (Sun, 16 Mar 2008) Log Message: ----------- fixed stuff, moved stuff around Modified Paths: -------------- branches/amis3/amis_issues.txt Modified: branches/amis3/amis_issues.txt =================================================================== --- branches/amis3/amis_issues.txt 2008-03-16 06:19:41 UTC (rev 2408) +++ branches/amis3/amis_issues.txt 2008-03-16 23:09:11 UTC (rev 2409) @@ -13,7 +13,7 @@ * add navlists to view menu * re-add tooltips * next/previous page/phrase/section should be enabled or disabled according to the book state -* opening URLs from the command line +* opening URLs from the command line (add a new command line parameter: http://www.codeguru.com/forum/showthread.php?t=386406) ISSUES and BUGS (things to address) --- @@ -21,9 +21,7 @@ * new audio backend makes reading options dialog crash * zed books need a stylesheet * Listviews have more than one column, cutting off text -* Sidebar intercepts shift+arrow even when I tell it not to. * window resizing problems with HTML view -* play/pause state doesn't toggle correctly on startup * navigation not highlighted until you click on it * speed buttons reset when you open a new book 1. open a book @@ -33,20 +31,9 @@ 5. close the book 6. open the same book 7. see the buttons for speed -* phrase arrow keys don't work when the focus is in the sidebar * audio does not change speed * book in a japanese folder can't be opened -* shows □□ for <br /> in the list of bookmarks - amisLog_080312_14.txt - bookmark_w2k_01.jpg - bookmark_w2k_02.jpg -* valentin hauy (amisLog_080312.txt): - does not go to next page - 1. open valentin_hauy - 2. go to next page till page 7 - 3. go to next page - * search drives crashes 1. search drives 2. open a title @@ -65,18 +52,29 @@ 3. it opens newread_atauP * after opening a title using open from URL, it only shows navigation, it does not show html portion and it does not start playing -* navigation for online books crashes: - 1. open from URL - 2. type URL - 3. wait till it shows navigation - 4. click on any heading KNOWN ISSUES (not going to change) --- * Load CD shows more titles than the ones on discinfo.html * japanese characters not shown in sidebar in win2k ==>not known if this is still an issue in alpha 2; you can set the sidebar font so maybe that will help +* shows □□ for <br /> in the list of bookmarks +* play/pause state doesn't toggle correctly on startup +* IE7 right-click menu works (ideally, it shouldn't appear) +* a book won't close all the way +* navigating online books crashes +AMBULANT ISSUES (some of these are repeated from the above "Known Issues" list) +-- +* How to stop ambulant when closing a book +* review skippability across document boundaries (need reading options dialog to work) +* memory leaks +* navigation for online books crashes: + 1. open from URL + 2. type URL + 3. wait till it shows navigation + 4. click on any heading + BETA (APRIL 1) ================= NEW FEATURES @@ -96,18 +94,8 @@ * add commands to increase/decrease specific volumes * highlight current section (in sidebar) in same color as page highlight -ISSUES +IMPROVEMENTS --- -* disable IE7 right-click menu - -AMBULANT ISSUES --- -* How to stop ambulant when closing a book -* review skippability across document boundaries (need reading options dialog to work) -* memory leaks - -OTHER ---- * select TTS based on language of book/UI. or take an educated guess. * Right/left arrow means something different (conceptually) in nav window * how do we count pages? does the page number appear at the bottom or top of the page? @@ -150,3 +138,5 @@ * bookmarking for books with non-ascii dc:identifiers * dialog to adjust highlight colors and font type * font and fontsize control in the sidebar +* phrase arrow keys work when the focus is in the sidebar +* page navigation bug fixed \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-16 06:19:34
|
Revision: 2408 http://amis.svn.sourceforge.net/amis/?rev=2408&view=rev Author: marisademeglio Date: 2008-03-15 23:19:41 -0700 (Sat, 15 Mar 2008) Log Message: ----------- reorganized based on bug reports from earlier this week Modified Paths: -------------- branches/amis3/amis_issues.txt Modified: branches/amis3/amis_issues.txt =================================================================== --- branches/amis3/amis_issues.txt 2008-03-16 06:13:20 UTC (rev 2407) +++ branches/amis3/amis_issues.txt 2008-03-16 06:19:41 UTC (rev 2408) @@ -7,18 +7,15 @@ * review TODOs, remove if resolved, address if needed * remove commented-out code unless there is a good reason to keep it in (say why) -NEW FEATURES +NEW FEATURES (things to add) --- * finish self-voicing for all dialogs * add navlists to view menu * re-add tooltips * next/previous page/phrase/section should be enabled or disabled according to the book state -* add dialog to adjust highlight colors and font type -* fontsize in the sidebar -* highlight current section (in sidebar) in same color as page highlight * opening URLs from the command line -ISSUES +ISSUES and BUGS (things to address) --- * stabilize self-voicing for menus * new audio backend makes reading options dialog crash @@ -26,12 +23,8 @@ * Listviews have more than one column, cutting off text * Sidebar intercepts shift+arrow even when I tell it not to. * window resizing problems with HTML view - -BUG REPORTS ---- * play/pause state doesn't toggle correctly on startup * navigation not highlighted until you click on it -* japanese characters not shown in sidebar in win2k * speed buttons reset when you open a new book 1. open a book 2. play @@ -43,13 +36,47 @@ * phrase arrow keys don't work when the focus is in the sidebar * audio does not change speed * book in a japanese folder can't be opened +* shows □□ for <br /> in the list of bookmarks + amisLog_080312_14.txt + bookmark_w2k_01.jpg + bookmark_w2k_02.jpg -AMBULANT ISSUES --- -* How to stop ambulant when closing a book -* review skippability across document boundaries (need reading options dialog to work) -* memory leaks +* valentin hauy (amisLog_080312.txt): + does not go to next page + 1. open valentin_hauy + 2. go to next page till page 7 + 3. go to next page +* search drives crashes + 1. search drives + 2. open a title + 3. search drives + 4. select a title + +* search drives opens wrong title + on w2k + 1. search drives + 2. select the title(bcakeM_202) + 3. it opens Dogs_bM + + on xp and Vista + 1. search drives + 2. select the title(newreadP) + 3. it opens newread_atauP + +* after opening a title using open from URL, it only shows navigation, it does not show html portion and it does not start playing +* navigation for online books crashes: + 1. open from URL + 2. type URL + 3. wait till it shows navigation + 4. click on any heading + +KNOWN ISSUES (not going to change) +--- +* Load CD shows more titles than the ones on discinfo.html +* japanese characters not shown in sidebar in win2k + ==>not known if this is still an issue in alpha 2; you can set the sidebar font so maybe that will help + BETA (APRIL 1) ================= NEW FEATURES @@ -67,11 +94,18 @@ ID_AMIS_RESET_HIGHLIGHT_COLORS ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK * add commands to increase/decrease specific volumes +* highlight current section (in sidebar) in same color as page highlight ISSUES --- * disable IE7 right-click menu +AMBULANT ISSUES +-- +* How to stop ambulant when closing a book +* review skippability across document boundaries (need reading options dialog to work) +* memory leaks + OTHER --- * select TTS based on language of book/UI. or take an educated guess. @@ -103,8 +137,8 @@ * audio slow-down * Support DAISY resource files (need an example!) * Bookshare books are slow and don't load if a bookmark file exists for them; eventually this error appears 12:35:27 TRACE dx_html_renderer: programmer error: attempt to start() again. +* Drag & drop book-ncc to program icon - ADDED AFTER ALPHA 1 =================== * Loads last book on startup @@ -113,4 +147,6 @@ * If no dc:identifier or the bookmark file can't be created, it no longer crashes * publication summary dialog not getting current section for zed books * "previous section" works as it should -* bookmarking for books with non-ascii dc:identifiers \ No newline at end of file +* bookmarking for books with non-ascii dc:identifiers +* dialog to adjust highlight colors and font type +* font and fontsize control in the sidebar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-16 06:13:14
|
Revision: 2407 http://amis.svn.sourceforge.net/amis/?rev=2407&view=rev Author: marisademeglio Date: 2008-03-15 23:13:20 -0700 (Sat, 15 Mar 2008) Log Message: ----------- text style dialog finished (also in amisAccessibleUi.xml) highlight colors and sidebar font can be controlled via the TextStyleDialog Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp branches/amis3/DefaultLangpack/amisAccessibleUi.xml Modified: branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h 2008-03-15 18:39:57 UTC (rev 2406) +++ branches/amis3/AmisGuiMFC2/include/gui/sidebar/AmisSidebar.h 2008-03-16 06:13:20 UTC (rev 2407) @@ -30,10 +30,13 @@ #include "gui/sidebar/cdxCDynamicBar.h" #include "gui/sidebar/NavListControl.h" #include "dtb/nav/NavTarget.h" +#include "util/Color.h" #include <vector> #include <string> +#define AMIS_SIDEBAR_SMALLEST_FONT_SIZE 100 +#define AMIS_SIDEBAR_BIGGEST_FONT_SIZE 400 namespace amis { namespace gui @@ -43,42 +46,39 @@ class CAmisSidebar: public cdxCDynamicBarDlg { public: - CAmisSidebar(CWnd* pParent = NULL); // standard constructor + CAmisSidebar(CWnd* pParent = NULL); ~CAmisSidebar(); CNavListControl* addNavListWidget(); void addTab(std::wstring); - //void nextSection(); - //void previousSection(); void expandAllSections(); void expandSections(int level); int getExposedDepth(); void clearAll(); - - //{{AFX_DATA(CAmisSidebar) + void setHighlightBGColor(amis::util::Color); + void setHighlightFGColor(amis::util::Color); + void setPageBGColor(amis::util::Color); + void setPageFGColor(amis::util::Color); + void setFontName(std::string); + void setFontSize(double); + enum { IDD = IDD_SIDEBAR }; - CTabCtrl m_wndTab; - CTreeCtrl m_wndTree; + CTabCtrl m_wndTab; + CTreeCtrl m_wndTree; CListCtrl m_wndPageList; - int m_iSel; - //}}AFX_DATA + int m_iSel; - //{{AFX_MSG(CAmisSidebar) afx_msg void OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnSelchangeTree(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnNavListSelect(NMHDR* pNMHDR, LRESULT* pResult, amis::dtb::nav::NavTarget* pData); afx_msg void OnPageListClick(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnPageListKeyDown(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnLvnItemchangedListPage(NMHDR *pNMHDR, LRESULT *pResult); - //}}AFX_MSG - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CAmisSidebar) - protected: + +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL PreTranslateMessage(MSG* pMsg); - //}}AFX_VIRTUAL - + virtual BOOL OnInitDialog(); + private: void showPageList(); void showNavList(unsigned int); @@ -93,17 +93,13 @@ int mNumTabs; int mExposedDepth; bool mIsShiftDown; - bool mIsControlDown; + bool mIsControlDown; + CFont mDefaultFont; + CFont* mpAlteredFont; + int mFontSizeInPoints; - -// Implementation -protected: - // Generated message map functions - //{{AFX_MSG(CAmisSidebar) - virtual BOOL OnInitDialog(); - //}}AFX_MSG DECLARE_MESSAGE_MAP(); - + friend class AmisSidebarLoader; }; } Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-15 18:39:57 UTC (rev 2406) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-16 06:13:20 UTC (rev 2407) @@ -817,6 +817,7 @@ if (dlg.DoModal() == IDOK) { TextRenderBrain::Instance()->redoPageColors(); + MainWndParts::Instance()->mpSidebar->m_wndDlg.setFontName(Preferences::Instance()->getSidebarFontName()); } } Modified: branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-15 18:39:57 UTC (rev 2406) +++ branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-16 06:13:20 UTC (rev 2407) @@ -371,6 +371,12 @@ //remove the old stylesheet MainWndParts::Instance()->mpHtmlView->removeStylesheet(mpFontCss); + //apply the size change to the sidebar + double d_fontsz = fontsz; + double d_max = Preferences::Instance()->getFontsizeCssFiles()->size(); + double pct = d_fontsz/d_max; + MainWndParts::Instance()->mpSidebar->m_wndDlg.setFontSize(pct); + ambulant::net::url* css_url = NULL; if (fontsz > 0 && fontsz <= Preferences::Instance()->getFontsizeCssFiles()->size()) { Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-15 18:39:57 UTC (rev 2406) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebar.cpp 2008-03-16 06:13:20 UTC (rev 2407) @@ -29,6 +29,7 @@ #include "gui/AmisApp.h" #include "../../../resource.h" #include "util/Log.h" +#include "Preferences.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -49,12 +50,14 @@ : cdxCDynamicBarDlg(CAmisSidebar::IDD, pParent) { m_iSel = 0; + mFontSizeInPoints = AMIS_SIDEBAR_SMALLEST_FONT_SIZE; } CAmisSidebar::~CAmisSidebar() { clearAll(); mImagesForTab.DeleteImageList(); + mDefaultFont.DeleteObject(); } void CAmisSidebar::DoDataExchange(CDataExchange* pDX) @@ -94,12 +97,85 @@ } mNumTabs = 0; } +void CAmisSidebar::setHighlightBGColor(amis::util::Color clr) +{ + //TODO: implement sidebar highlight control +} +void CAmisSidebar::setHighlightFGColor(amis::util::Color clr) +{ + //TODO: implement sidebar highlight control + //this foreground color feature is easy but meaningless until the BG color can also be changed +} +void CAmisSidebar::setPageBGColor(amis::util::Color clr) +{ + m_wndTree.SetBkColor(clr.getAsColorRef()); + m_wndPageList.SetBkColor(clr.getAsColorRef()); + for (int i = 0; i<mNavLists.size(); i++) + { + mNavLists[i]->SetBkColor(clr.getAsColorRef()); + } +} +void CAmisSidebar::setPageFGColor(amis::util::Color clr) +{ + m_wndTree.SetTextColor(clr.getAsColorRef()); + m_wndPageList.SetTextColor(clr.getAsColorRef()); + for (int i = 0; i<mNavLists.size(); i++) + { + mNavLists[i]->SetTextColor(clr.getAsColorRef()); + } +} +void CAmisSidebar::setFontName(std::string fontName) +{ + USES_CONVERSION; + CFont* p_font = NULL; + p_font=m_wndTree.GetFont(); + LOGFONT lf; + p_font->GetLogFont(&lf); + CString font_name; + font_name = A2T(amis::Preferences::Instance()->getSidebarFontName().c_str()); + lstrcpy(lf.lfFaceName, font_name); + //font default size and boldness values + lf.lfHeight = mFontSizeInPoints; + lf.lfWeight = 600; + mDefaultFont.DeleteObject(); + mDefaultFont.CreatePointFontIndirect(&lf); + m_wndTree.SetFont(&mDefaultFont); + m_wndPageList.SetFont(&mDefaultFont); + for (int i = 0; i < mNavLists.size(); i++) + { + mNavLists[i]->SetFont(&mDefaultFont); + } +} +//pct should give some idea of the total possible gradients +void CAmisSidebar::setFontSize(double pct) +{ + LOGFONT lf; + mDefaultFont.GetLogFont(&lf); + int diff = AMIS_SIDEBAR_BIGGEST_FONT_SIZE - AMIS_SIDEBAR_SMALLEST_FONT_SIZE; + if (pct <= 0.0) + mFontSizeInPoints = AMIS_SIDEBAR_SMALLEST_FONT_SIZE; + else if (pct >= 1.0) + mFontSizeInPoints = AMIS_SIDEBAR_BIGGEST_FONT_SIZE; + else + mFontSizeInPoints = AMIS_SIDEBAR_SMALLEST_FONT_SIZE + (pct * diff); + + lf.lfHeight = mFontSizeInPoints; + mDefaultFont.DeleteObject(); + mDefaultFont.CreatePointFontIndirect(&lf); + m_wndTree.SetFont(&mDefaultFont); + m_wndPageList.SetFont(&mDefaultFont); + for (int i = 0; i < mNavLists.size(); i++) + { + mNavLists[i]->SetFont(&mDefaultFont); + } +} void CAmisSidebar::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult) { m_iSel = m_wndTab.GetCurSel(); - - if (m_iSel == 0) showNavMap(); - + if (m_iSel == 0) + { + showNavMap(); + } else if(m_iSel == 1) { if (amis::dtb::DtbWithHooks::Instance()->getNavModel()->hasPages() == true) showPageList(); @@ -121,7 +197,6 @@ HTREEITEM item; item = m_wndTree.GetSelectedItem(); p_nav = (amis::dtb::nav::NavPoint*)m_wndTree.GetItemData(item); - if (p_nav != NULL) amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_nav); } @@ -329,7 +404,7 @@ m_wndPageList.SetFocus(); this->RedrawWindow(); - //then amis should play an audio prompt "pages" + //TODO: then amis should play an audio prompt "pages" } void CAmisSidebar::showNavList(unsigned int idx) @@ -407,36 +482,7 @@ mNumTabs++; } -/* -void CAmisSidebar::nextSection() -{ - HTREEITEM h_curr = NULL; - h_curr = m_wndTree.GetSelectedItem(); - if (h_curr != NULL) - { - h_curr = m_wndTree.GetNextItem(h_curr, TVGN_NEXTVISIBLE); - m_wndTree.SelectItem(h_curr); - amis::dtb::nav::NavPoint* p_nav = NULL; - p_nav = (amis::dtb::nav::NavPoint*)m_wndTree.GetItemData(h_curr); - amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_nav); - } -} - -void CAmisSidebar::previousSection() -{ - HTREEITEM h_curr = NULL; - h_curr = m_wndTree.GetSelectedItem(); - if (h_curr != NULL) - { - h_curr = m_wndTree.GetPrevVisibleItem(h_curr); - m_wndTree.SelectItem(h_curr); - amis::dtb::nav::NavPoint* p_nav = NULL; - p_nav = (amis::dtb::nav::NavPoint*)m_wndTree.GetItemData(h_curr); - amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_nav); - } -} -*/ //******************* //tree view expand and collapse //******************* Modified: branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp 2008-03-15 18:39:57 UTC (rev 2406) +++ branches/amis3/AmisGuiMFC2/src/gui/sidebar/AmisSidebarLoader.cpp 2008-03-16 06:13:20 UTC (rev 2407) @@ -21,6 +21,7 @@ */ #include "gui/sidebar/AmisSidebarLoader.h" #include "util/Log.h" +#include "Preferences.h" using namespace amis::gui::sidebar; @@ -90,6 +91,7 @@ //expand all sections mpSidebar->expandAllSections(); + mpSidebar->setFontName(Preferences::Instance()->getSidebarFontName()); amis::util::Log::Instance()->writeMessage("Data loaded into sidebar"); } Modified: branches/amis3/DefaultLangpack/amisAccessibleUi.xml =================================================================== --- branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-15 18:39:57 UTC (rev 2406) +++ branches/amis3/DefaultLangpack/amisAccessibleUi.xml 2008-03-16 06:13:20 UTC (rev 2407) @@ -281,6 +281,22 @@ <audio src=""/> </mnemonic> </action> + <!--new item--> + <action mfcid="ID_AMIS_SHOW_TEXTSTYLE" widget="menuItem"> + <note>This is going to be a menu item</note> + <caption> + <text id="xx">Text style...</text> + <audio src=""/> + </caption> + <description> + <text id="xx">Change the text style properties.</text> + <audio src=""/> + </description> + <mnemonic> + <text id="xx">T</text> + <audio src=""/> + </mnemonic> + </action> <action mfcid="AMIS_NAVLIST_BASE_ID" widget="menuItem"> <note>This is going to be a menu item</note> <caption> @@ -1288,6 +1304,26 @@ </caption> </list> </control> + <control mfcid="IDOK" widget="button"> + <caption> + <promptItem refid="ok_button_caption"/> + </caption> + <description> + <promptItem refid="ok_button_description"/> + </description> + </control> + <control mfcid="IDCANCEL" widget="button"> + <caption> + <promptItem refid="cancel_button_caption"/> + </caption> + <description> + <promptItem refid="cancel_button_description"/> + </description> + <mnemonic> + <text id="xx">C</text> + <audio src=""/> + </mnemonic> + </control> </dialog> <dialog mfcid="IDD_GOTOPAGE"> <note>This dialog lets the user jump to a certain page</note> @@ -1538,6 +1574,88 @@ </list> </control> </dialog> + <dialog> + <note>This dialog lets the user set text style properties.</note> + <caption> + <text id="xx">Text Style</text> + <audio src=""/> + </caption> + <description> + <text id="xx">Here you can change text style properties.</text> + <audio src=""/> + </description> + <prompt type="instructions"> + <promptItem refid="tabAround"/> + <promptItem refid="altC_to_cancel"/> + <promptItem refid="repeatLastPromptInstr"/> + <promptItem refid="hearDlgInstructions"/> + </prompt> + <control mfcid="IDC_FONT" widget="list"> + <caption mfcid="IDC_FONTLABEL"> + <text id="xx">Sidebar font:</text> + <audio src=""/> + </caption> + <description> + <text id="xx">Use the arrow keys to move around this list of font names.</text> + <audio src=""/> + </description> + <list repeat="yes"> + <caption> + <promptVar name="FONT_NAME"/> + </caption> + </list> + </control> + <control mfcid="IDC_HIGHLIGHTFOREGROUND" widget="list"> + <caption mfcid="IDC_HIGHLIGHTFOREGROUNDLABEL"> + <text id="xx">Highlighted text color:</text> + <audio src=""/> + </caption> + <description> + <text id="xx">Use the arrow keys to move around this list of colors.</text> + <audio src=""/> + </description> + <list repeat="yes"> + <caption> + <promptVar name="COLOR_NAME"/> + </caption> + </list> + </control> + <control mfcid="IDC_HIGHLIGHTBACKGROUND" widget="list"> + <caption mfcid="IDC_HIGHLIGHTBACKGROUNDLABEL"> + <text id="xx">Highlight background color:</text> + <audio src=""/> + </caption> + <description> + <text id="xx">Use the arrow keys to move around this list of colors.</text> + <audio src=""/> + </description> + <list repeat="yes"> + <caption> + <promptVar name="COLOR_NAME"/> + </caption> + </list> + </control> + <control mfcid="IDOK" widget="button"> + <caption> + <promptItem refid="ok_button_caption"/> + </caption> + <description> + <promptItem refid="ok_button_description"/> + </description> + </control> + <control mfcid="IDCANCEL" widget="button"> + <caption> + <promptItem refid="cancel_button_caption"/> + </caption> + <description> + <promptItem refid="cancel_button_description"/> + </description> + <mnemonic> + <text id="xx">C</text> + <audio src=""/> + </mnemonic> + </control> + </dialog> </dialogs> <prompts> <promptItemRefs> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-15 18:39:53
|
Revision: 2406 http://amis.svn.sourceforge.net/amis/?rev=2406&view=rev Author: marisademeglio Date: 2008-03-15 11:39:57 -0700 (Sat, 15 Mar 2008) Log Message: ----------- ultimately decided to do something simple for the text style dialog Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/Preferences.h branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h branches/amis3/AmisGuiMFC2/include/util/Color.h branches/amis3/AmisGuiMFC2/resource.h branches/amis3/AmisGuiMFC2/src/Preferences.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp branches/amis3/AmisGuiMFC2/src/util/Color.cpp branches/amis3/bin/settings/amisPrefs.xml.default branches/amis3/bin/settings/css/amis.css Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-15 18:39:57 UTC (rev 2406) @@ -147,7 +147,7 @@ IDD_TEXTSTYLE, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 386 + RIGHTMARGIN, 165 TOPMARGIN, 7 BOTTOMMARGIN, 142 END @@ -411,13 +411,13 @@ PUSHBUTTON "Cancel",IDCANCEL,112,202,50,14 END -IDD_TEXTSTYLE DIALOGEX 0, 0, 393, 149 +IDD_TEXTSTYLE DIALOGEX 0, 0, 172, 149 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Text Style" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - LTEXT "Font:",IDC_FONTLABEL,7,7,155,12 + LTEXT "Sidebar font:",IDC_FONTLABEL,7,7,155,12 COMBOBOX IDC_FONT,7,20,155,63,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Highlighted text color:",IDC_HIGHLIGHTFOREGROUNDLABEL,7, @@ -428,10 +428,8 @@ IDC_HIGHLIGHTBACKGROUNDLABEL,7,83,156,8 COMBOBOX IDC_HIGHLIGHTBACKGROUND,7,98,156,52,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_TEXTSTYLEPREVIEW,211,7,175,135,ES_MULTILINE | - ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,39,128,50,14 - PUSHBUTTON "Cancel",IDCANCEL,101,128,50,14 + DEFPUSHBUTTON "OK",IDOK,30,128,50,14 + PUSHBUTTON "Cancel",IDCANCEL,94,128,50,14 END Modified: branches/amis3/AmisGuiMFC2/include/Preferences.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/include/Preferences.h 2008-03-15 18:39:57 UTC (rev 2406) @@ -35,18 +35,8 @@ { protected: Preferences(); - + public: - //these should be private some day - //these values come from TextRenderBrain after it parses amis.css - util::Color mHighlightFG; - util::Color mHighlightBG; - std::string mFontName; - util::Color mPageFG; - util::Color mPageBG; - int mFontSize; - -public: static Preferences* Instance(); void DestroyInstance(); ~Preferences(); @@ -54,6 +44,7 @@ void scanAll(); void logAllPreferences(); void logUserControllablePreferences(); + //ACCESSORS void setUiLangId(string); string getUiLangId(); @@ -106,6 +97,13 @@ void setSourceUrl(const ambulant::net::url*); const ambulant::net::url* getSourceUrl(); + void setHighlightBGColor(amis::util::Color); + amis::util::Color getHighlightBGColor(); + void setHighlightFGColor(amis::util::Color); + amis::util::Color getHighlightFGColor(); + void setSidebarFontName(std::string); + std::string getSidebarFontName(); + amis::UrlList* getFontsizeCssFiles(); amis::UrlList* getCustomCssFiles(); amis::StringModuleMap* getInstalledLanguages(); @@ -115,7 +113,7 @@ void scanDirectoriesForCssFiles(); void scanDirectoriesForLanguagePackFiles(); void processLanguagePackModuleDescData(amis::ModuleDescData*); - + string mUiLangId; bool mbStartInBasicView; bool mbLoadLastBook; @@ -126,6 +124,9 @@ bool mbWasExitClean; bool mbHighlightText; bool mbDisableScreensaver; + util::Color mHighlightFG; + util::Color mHighlightBG; + std::string mSidebarFontName; ambulant::net::url mUserBmkDir; ambulant::net::url mLangpacksDir; ambulant::net::url mFontsizeCssDir; Modified: branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h 2008-03-15 18:39:57 UTC (rev 2406) @@ -56,7 +56,6 @@ void gotoUriTarget(amis::TextNode*); void gotoUriTarget(std::string url); - void saveDefaultCss(); void applyPageStyle(int); void clearPageStyle(); void applyNextPageStyle(); @@ -74,7 +73,6 @@ void setHighlightColors(IHTMLElement*); void redoHighlightColors(); bool isElementInView(IHTMLElement*); - void scanStylesheetForAdditionalData(IHTMLStyleSheet*); IHTMLElement* GetElementFromId(string id, const GUID *iid); IHTMLDocument2* GetDoc(); @@ -88,7 +86,7 @@ VARIANT mUnhighlightedFG; IHTMLStyleSheet* mpFontCss; IHTMLStyleSheet* mpStyleCss; - IHTMLStyleSheet* mpUserCss; + IHTMLStyleSheet* mpAmisCss; int mCurrentStyleIdx; bool mbStyleOn; private: Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h 2008-03-15 18:39:57 UTC (rev 2406) @@ -40,9 +40,6 @@ TextStyleDialog(CWnd* pParent = NULL); ~TextStyleDialog(); enum { IDD = IDD_TEXTSTYLE }; - amis::util::Color getHighlightForegroundColor(); - amis::util::Color getHighlightBackgroundColor(); - std::string getFontName(); protected: void initializeCombos(); virtual BOOL OnInitDialog(); @@ -56,10 +53,8 @@ protected: afx_msg void OnPaint(); DECLARE_MESSAGE_MAP() -private: - amis::util::Color mHighlightBG; - amis::util::Color mHighlightFG; - std::string mFontName; +protected: + virtual void OnOK(); }; } } Modified: branches/amis3/AmisGuiMFC2/include/util/Color.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/util/Color.h 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/include/util/Color.h 2008-03-15 18:39:57 UTC (rev 2406) @@ -37,6 +37,7 @@ std::string mColorHtml; public: Color(); + //needs a hex value Color(std::string); Color(COLORREF); void set(std::string); Modified: branches/amis3/AmisGuiMFC2/resource.h =================================================================== --- branches/amis3/AmisGuiMFC2/resource.h 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/resource.h 2008-03-15 18:39:57 UTC (rev 2406) @@ -79,6 +79,8 @@ #define IDC_HIGHLIGHTFOREGROUNDLABEL 1110 #define IDC_HIGHLIGHTBACKGROUNDLABEL 1111 #define IDC_TEXTSTYLEPREVIEW 1112 +#define IDC_TEXTPREVIEW 1113 +#define IDC_EDIT1 1114 #define SELF_VOICING_PLAY_NEXT 6969 #define IDC_CURRLANG 9002 #define IDC_VERSION 9006 @@ -132,7 +134,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 193 #define _APS_NEXT_COMMAND_VALUE 32954 -#define _APS_NEXT_CONTROL_VALUE 1113 +#define _APS_NEXT_CONTROL_VALUE 1115 #define _APS_NEXT_SYMED_VALUE 143 #endif #endif Modified: branches/amis3/AmisGuiMFC2/src/Preferences.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/src/Preferences.cpp 2008-03-15 18:39:57 UTC (rev 2406) @@ -63,7 +63,7 @@ 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/"); - mAmisCssFile = ambulant::net::url::from_filename("./settings/css/default.css"); + mAmisCssFile = ambulant::net::url::from_filename("./settings/css/amis.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()); @@ -74,9 +74,9 @@ mAmisCssFile = mAmisCssFile.join_to_base(app_path); mZed2005CssFile = mZed2005CssFile.join_to_base(app_path); - mHighlightFG.set("000000"); - mHighlightBG.set("FFFF00"); - mFontName = "Arial"; + mHighlightFG.set("#000000"); + mHighlightBG.set("#FFFF00"); + mSidebarFontName = "Arial"; } //this function should be called after the preferences XML file has been parsed @@ -86,7 +86,6 @@ scanDirectoriesForLanguagePackFiles(); } - void Preferences::scanDirectoriesForCssFiles() { amis::util::SearchForFilesMFC searcher; @@ -368,7 +367,30 @@ amis::ModuleDescData* p_data = mInstalledLanguages[mUiLangId]; return p_data; } - +void Preferences::setHighlightBGColor(amis::util::Color value) +{ + mHighlightBG = value; +} +amis::util::Color Preferences::getHighlightBGColor() +{ + return mHighlightBG; +} +void Preferences::setHighlightFGColor(amis::util::Color value) +{ + mHighlightFG = value; +} +amis::util::Color Preferences::getHighlightFGColor() +{ + return mHighlightFG; +} +void Preferences::setSidebarFontName(std::string value) +{ + mSidebarFontName = value; +} +std::string Preferences::getSidebarFontName() +{ + return mSidebarFontName; +} void Preferences::logAllPreferences() { amis::util::Log* p_log = amis::util::Log::Instance(); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-15 18:39:57 UTC (rev 2406) @@ -816,10 +816,6 @@ amis::gui::dialogs::TextStyleDialog dlg; if (dlg.DoModal() == IDOK) { - Preferences::Instance()->mHighlightBG = dlg.getHighlightBackgroundColor(); - Preferences::Instance()->mHighlightFG = dlg.getHighlightForegroundColor(); - Preferences::Instance()->mFontName = dlg.getFontName(); - TextRenderBrain::Instance()->saveDefaultCss(); TextRenderBrain::Instance()->redoPageColors(); } } Modified: branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-15 18:39:57 UTC (rev 2406) @@ -63,7 +63,7 @@ mpFontCss = NULL; mpStyleCss = NULL; - mpUserCss = NULL; + mpAmisCss = NULL; } TextRenderBrain::~TextRenderBrain() @@ -133,9 +133,8 @@ { if (mbWaitForDocumentLoad) { - mpUserCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet + mpAmisCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet (Preferences::Instance()->getAmisCssFile()); - scanStylesheetForAdditionalData(mpUserCss); //TODO: does this ever work? need to test more books. if (amis::dtb::DtbWithHooks::Instance()->getDaisyVersion() == amis::dtb::DAISY_2005) MainWndParts::Instance()->mpHtmlView->applyStylesheet(Preferences::Instance()->getZed2005CssFile()); @@ -266,8 +265,8 @@ VariantInit(&var_fg); //get as strings from the preferences for highlight values - str_text_fg = amis::Preferences::Instance()->mHighlightFG.getAsHtmlHexColor(); - str_text_bg = amis::Preferences::Instance()->mHighlightBG.getAsHtmlHexColor(); + str_text_fg = amis::Preferences::Instance()->getHighlightFGColor().getAsHtmlHexColor(); + str_text_bg = amis::Preferences::Instance()->getHighlightBGColor().getAsHtmlHexColor(); //convert to chars const char* textfg_color = str_text_fg.c_str(); @@ -288,22 +287,6 @@ { return mCurrentStyleIdx; } -//take the values in Preferences and write them to file -void TextRenderBrain::saveDefaultCss() -{ - string fg = Preferences::Instance()->mHighlightFG.getAsHtmlHexColor(); - string bg = Preferences::Instance()->mHighlightBG.getAsHtmlHexColor(); - string font = Preferences::Instance()->mFontName; - ofstream cssfile; - cssfile.open(Preferences::Instance()->getAmisCssFile()->get_file().c_str(), ios::out); - cssfile<<"/*default CSS sheet*/"<<endl; - cssfile<<"/*DO NOT EDIT! YOUR CHANGES WILL BE LOST!*/"<<endl; - cssfile<<"/*\"amis-highlight\" is a reserved word that AMIS will look for to find the highlight colors*/"<<endl; - cssfile<<"/*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*/"<<endl; - cssfile<<".amis-highlight {color: "<<fg<<"; background-color: "<<bg<<";}"<<endl; - cssfile<<"body {font-family: "<<font<<";}"<<endl; - cssfile.close(); -} void TextRenderBrain::applyPageStyle(int idx) { clearPageStyle(); @@ -313,7 +296,6 @@ ambulant::net::url url = (*list)[idx]; mCurrentStyleIdx = idx; mpStyleCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet(&url); - scanStylesheetForAdditionalData(mpStyleCss); } void TextRenderBrain::applyNextPageStyle() @@ -394,7 +376,6 @@ { css_url = &(*Preferences::Instance()->getFontsizeCssFiles())[fontsz - 1]; mpFontCss = MainWndParts::Instance()->mpHtmlView->applyStylesheet(css_url); - scanStylesheetForAdditionalData(mpFontCss); } else { @@ -509,8 +490,8 @@ VariantInit(&var_fg); //get as strings - str_text_fg = amis::Preferences::Instance()->mHighlightFG.getAsHtmlHexColor(); - str_text_bg = amis::Preferences::Instance()->mHighlightBG.getAsHtmlHexColor(); + str_text_fg = amis::Preferences::Instance()->getHighlightFGColor().getAsHtmlHexColor(); + str_text_bg = amis::Preferences::Instance()->getHighlightBGColor().getAsHtmlHexColor(); //convert to chars const char* textfg_color = str_text_fg.c_str(); @@ -631,91 +612,3 @@ //otherwise we assume it's in view return true; } - -//use the COM interface to get at the details of this stylesheet and apply them to the sidebar too -//it also gets the highlight colors for the main window from a selector called .amis-highlight -void TextRenderBrain::scanStylesheetForAdditionalData(IHTMLStyleSheet* pStylesheet) -{ - USES_CONVERSION; - //all the stupid COM objects... - IHTMLStyleSheetRulesCollection* p_rules; - long len; - IHTMLStyleSheetRule* p_rule; - - if (!SUCCEEDED(pStylesheet->get_rules(&p_rules))) return; - if (!SUCCEEDED(p_rules->get_length(&len))) - { - p_rules->Release(); - return; - } - - for (long i = 0; i<len; i++) - { - //get a single style rule - if (!SUCCEEDED(p_rules->item(i, &p_rule))) continue; - - //get the rule's selector - BSTR selector_text; - if (!SUCCEEDED(p_rule->get_selectorText(&selector_text))) continue; - string str_selector_text = OLE2A(selector_text); - - //this gives the highlight colors - if (!str_selector_text.compare(".amis-highlight")) - { - IHTMLRuleStyle* p_rule_style; - if (SUCCEEDED(p_rule->get_style(&p_rule_style))) - { - VARIANT highlight_bg, highlight_fg; - VariantInit(&highlight_bg); - VariantInit(&highlight_fg); - p_rule_style->get_backgroundColor(&highlight_bg); - p_rule_style->get_color(&highlight_fg); - util::Color dummy_color; - string fg_color = dummy_color.getHexValueForNamedColor(OLE2A(highlight_fg.bstrVal)); - string bg_color = dummy_color.getHexValueForNamedColor(OLE2A(highlight_bg.bstrVal)); - Preferences::Instance()->mHighlightBG.set(bg_color); - Preferences::Instance()->mHighlightFG.set(fg_color); - p_rule_style->Release(); - } - } - else if (!str_selector_text.compare("body")) - { - IHTMLRuleStyle* p_rule_style; - if (SUCCEEDED(p_rule->get_style(&p_rule_style))) - { - VARIANT page_bg, page_fg, font_size; - BSTR font_family; - VariantInit(&page_bg); - VariantInit(&page_fg); - VariantInit(&font_size); - p_rule_style->get_backgroundColor(&page_bg); - p_rule_style->get_color(&page_fg); - p_rule_style->get_fontFamily(&font_family); - p_rule_style->get_fontSize(&font_size); - - util::Color dummy_color; - string fg_color = dummy_color.getHexValueForNamedColor(OLE2A(page_fg.bstrVal)); - string bg_color = dummy_color.getHexValueForNamedColor(OLE2A(page_bg.bstrVal)); - string font_name = OLE2A(font_family); - //font names could look like "arial, verdana, sans-serif;" - //just grab the first one - if (font_name.find(",") != std::string::npos) - { - int pos = font_name.find(","); - font_name = font_name.substr(0, pos); - } - //int pct_font_size = amis::util::CssUtil::getAsPercentValue(OLE2A(font_size.bstrVal)); - - Preferences::Instance()->mPageBG.set(bg_color); - Preferences::Instance()->mPageFG.set(fg_color); - Preferences::Instance()->mFontName = font_name; - //Preferences::Instance()->mFontSize = pct_font_size; - p_rule_style->Release(); - } - } - p_rule->Release(); - - } //end for-loop through the rules collection - p_rules->Release(); -} - Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp 2008-03-15 18:39:57 UTC (rev 2406) @@ -44,8 +44,14 @@ BOOL CALLBACK EnumFontCallback (LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData) { + USES_CONVERSION; CComboBox* p_font_list = (CComboBox*)lpData; int index = p_font_list->AddString(lplf->lfFaceName); + std::string font = T2A(lplf->lfFaceName); + if (font.compare(amis::Preferences::Instance()->getSidebarFontName()) == 0) + { + p_font_list->SetCurSel(index); + } return TRUE; } @@ -58,9 +64,6 @@ } BOOL TextStyleDialog::OnInitDialog() { - mFontName = Preferences::Instance()->mFontName; - mHighlightBG = Preferences::Instance()->mHighlightBG; - mHighlightFG = Preferences::Instance()->mHighlightFG; initializeCombos(); return CDialog::OnInitDialog(); } @@ -76,13 +79,12 @@ amis::StringMap* p_all_colors = dummy_color.getColorHexMap(); //the current values all come from Preferences - //TODO: save them to file int foreground_sel = -1; int background_sel = -1; int i = 0; amis::StringMap::iterator it = p_all_colors->begin(); - std::string highlight_bg = Preferences::Instance()->mHighlightBG.getAsHtmlHexColor(); - std::string highlight_fg = Preferences::Instance()->mHighlightFG.getAsHtmlHexColor(); + std::string highlight_bg = Preferences::Instance()->getHighlightBGColor().getAsHtmlHexColor(); + std::string highlight_fg = Preferences::Instance()->getHighlightFGColor().getAsHtmlHexColor(); while (it != p_all_colors->end()) { CString label = A2T(it->first.c_str()); @@ -130,55 +132,47 @@ return AmisDialogBase::PreTranslateMessage(pMsg); } -amis::util::Color TextStyleDialog::getHighlightForegroundColor() -{ - return mHighlightFG; -} - -amis::util::Color TextStyleDialog::getHighlightBackgroundColor() -{ - return mHighlightBG; -} - -std::string TextStyleDialog::getFontName() -{ - return mFontName; -} - //widget event handlers void TextStyleDialog::OnCbnSelchangeFont() { - USES_CONVERSION; - CString tmp; - CComboBox* p_font_list = (CComboBox*)GetDlgItem(IDC_FONT); - p_font_list->GetWindowText(tmp); - mFontName = T2A(tmp); } void TextStyleDialog::OnCbnSetfocusFont() { } void TextStyleDialog::OnCbnSelchangeHighlightForeground() { - USES_CONVERSION; - CString tmp; - CComboBox* p_foreground_list = (CComboBox*)GetDlgItem(IDC_HIGHLIGHTFOREGROUND); - - p_foreground_list->GetWindowText(tmp); - if (tmp == "") tmp = "black"; - mHighlightFG.setWithHtmlName(T2A(tmp)); } void TextStyleDialog::OnCbnSetfocusHighlightForeground() { } void TextStyleDialog::OnCbnSelchangeHighlightBackground() { +} +void TextStyleDialog::OnCbnSetfocusHighlightBackground() +{ + +} +void amis::gui::dialogs::TextStyleDialog::OnOK() +{ USES_CONVERSION; CString tmp; + CComboBox* p_font_list = (CComboBox*)GetDlgItem(IDC_FONT); + p_font_list->GetWindowText(tmp); + Preferences::Instance()->setSidebarFontName(T2A(tmp)); + CComboBox* p_background_list = (CComboBox*)GetDlgItem(IDC_HIGHLIGHTBACKGROUND); p_background_list->GetWindowText(tmp); if (tmp == "") tmp = "yellow"; - mHighlightBG.setWithHtmlName(T2A(tmp)); + amis::util::Color bg_clr; + bg_clr.setWithHtmlName(T2A(tmp)); + Preferences::Instance()->setHighlightBGColor(bg_clr); + + CComboBox* p_foreground_list = (CComboBox*)GetDlgItem(IDC_HIGHLIGHTFOREGROUND); + p_foreground_list->GetWindowText(tmp); + if (tmp == "") tmp = "black"; + amis::util::Color fg_clr; + fg_clr.setWithHtmlName(T2A(tmp)); + Preferences::Instance()->setHighlightFGColor(fg_clr); + + AmisDialogBase::OnOK(); } -void TextStyleDialog::OnCbnSetfocusHighlightBackground() -{ -} Modified: branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/src/io/PreferencesFileIO.cpp 2008-03-15 18:39:57 UTC (rev 2406) @@ -202,6 +202,20 @@ file = file.join_to_base(source_url); mpPrefs->setUserBmkDir(&file); } + else if (id.compare("highlight-fg-color") == 0) + { + amis::util::Color c(value); + mpPrefs->setHighlightFGColor(c); + } + else if (id.compare("highlight-bg-color") == 0) + { + amis::util::Color c(value); + mpPrefs->setHighlightBGColor(c); + } + else if (id.compare("sidebar-font-name") == 0) + { + mpPrefs->setSidebarFontName(value); + } } @@ -324,6 +338,15 @@ pEntry = createEntry("custom-css-dir", mpPrefs->getCustomCssDir()->get_file()); pGeneralSection->appendChild((DOMNode*)pEntry); + pEntry = createEntry("highlight-fg-color", mpPrefs->getHighlightFGColor().getAsHtmlHexColor()); + pGeneralSection->appendChild((DOMNode*)pEntry); + + pEntry = createEntry("highlight-bg-color", mpPrefs->getHighlightBGColor().getAsHtmlHexColor()); + pGeneralSection->appendChild((DOMNode*)pEntry); + + pEntry = createEntry("sidebar-font-name", mpPrefs->getSidebarFontName()); + pGeneralSection->appendChild((DOMNode*)pEntry); + //get a pointer to the root element DOMElement* pRootElem = mpDoc->getDocumentElement(); //append the general section element Modified: branches/amis3/AmisGuiMFC2/src/util/Color.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/util/Color.cpp 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/AmisGuiMFC2/src/util/Color.cpp 2008-03-15 18:39:57 UTC (rev 2406) @@ -235,12 +235,11 @@ wblue = A2CW(clr.substr(4, 2).c_str()); - int iRed = _httoi(wred.c_str());//_httoi((LPCTSTR)red.c_str()); + int iRed = _httoi(wred.c_str()); int iGreen = _httoi(wgreen.c_str()); int iBlue = _httoi(wblue.c_str()); return RGB(iRed, iGreen, iBlue); - } //function taken from http://www.codeproject.com/string/hexstrtoint.asp Modified: branches/amis3/bin/settings/amisPrefs.xml.default =================================================================== --- branches/amis3/bin/settings/amisPrefs.xml.default 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/bin/settings/amisPrefs.xml.default 2008-03-15 18:39:57 UTC (rev 2406) @@ -18,5 +18,8 @@ <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"/> +<entry id="highlight-fg-color"value="#FFFFFF"/> +<entry id="highlight-bg-color" value="#FFFF00"/> +<entry id="sidebar-font-name" value="Verdana"/> </section> </preferences> Modified: branches/amis3/bin/settings/css/amis.css =================================================================== --- branches/amis3/bin/settings/css/amis.css 2008-03-13 23:44:17 UTC (rev 2405) +++ branches/amis3/bin/settings/css/amis.css 2008-03-15 18:39:57 UTC (rev 2406) @@ -1,6 +1 @@ -/*default CSS sheet*/ -/*DO NOT EDIT! YOUR CHANGES WILL BE LOST!*/ -/*"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: #000000; background-color: #FFFF00;} -body {font-family: verdana;} +/*put default style preferences here*/ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-03-13 23:44:12
|
Revision: 2405 http://amis.svn.sourceforge.net/amis/?rev=2405&view=rev Author: marisademeglio Date: 2008-03-13 16:44:17 -0700 (Thu, 13 Mar 2008) Log Message: ----------- Updates to text style dialog. It's almost working. Modified Paths: -------------- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h branches/amis3/AmisGuiMFC2/include/util/Color.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp branches/amis3/AmisGuiMFC2/src/util/Color.cpp branches/amis3/bin/settings/css/amis.css Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2008-03-13 23:44:17 UTC (rev 2405) @@ -418,17 +418,18 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Font:",IDC_FONTLABEL,7,7,155,12 - COMBOBOX IDC_FONT,7,20,155,30,CBS_DROPDOWN | CBS_SORT | + COMBOBOX IDC_FONT,7,20,155,63,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Highlighted text color:",IDC_HIGHLIGHTFOREGROUNDLABEL,7, 45,155,11 - COMBOBOX IDC_HIGHLIGHTFOREGROUND,7,57,155,30,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_HIGHLIGHTFOREGROUND,7,57,155,63,CBS_DROPDOWN | + WS_VSCROLL | WS_TABSTOP LTEXT "Highlight background color:", IDC_HIGHLIGHTBACKGROUNDLABEL,7,83,156,8 - COMBOBOX IDC_HIGHLIGHTBACKGROUND,7,98,156,12,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_TEXTSTYLEPREVIEW,211,7,175,135,ES_AUTOHSCROLL + COMBOBOX IDC_HIGHLIGHTBACKGROUND,7,98,156,52,CBS_DROPDOWN | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_TEXTSTYLEPREVIEW,211,7,175,135,ES_MULTILINE | + ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,39,128,50,14 PUSHBUTTON "Cancel",IDCANCEL,101,128,50,14 END Modified: branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/include/gui/AmisApp.h 2008-03-13 23:44:17 UTC (rev 2405) @@ -106,6 +106,7 @@ afx_msg void OnClearPageStyle(); afx_msg void OnApplyPageStyle(UINT); afx_msg void OnNextPageStyle(); + afx_msg void OnShowTextStyle(); protected: HMENU m_hMDIMenu; HACCEL m_hMDIAccel; Modified: branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/include/gui/TextRenderBrain.h 2008-03-13 23:44:17 UTC (rev 2405) @@ -56,6 +56,7 @@ void gotoUriTarget(amis::TextNode*); void gotoUriTarget(std::string url); + void saveDefaultCss(); void applyPageStyle(int); void clearPageStyle(); void applyNextPageStyle(); Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/TextStyleDialog.h 2008-03-13 23:44:17 UTC (rev 2405) @@ -24,6 +24,7 @@ #include "gui/dialogs/AmisDialogBase.h" #include "../resource.h" +#include "util/Color.h" BOOL CALLBACK EnumFontCallback (LPLOGFONT, LPTEXTMETRIC, DWORD, LPARAM); @@ -33,14 +34,15 @@ { namespace dialogs { - class TextStyleDialog : public AmisDialogBase { public: TextStyleDialog(CWnd* pParent = NULL); ~TextStyleDialog(); enum { IDD = IDD_TEXTSTYLE }; - + amis::util::Color getHighlightForegroundColor(); + amis::util::Color getHighlightBackgroundColor(); + std::string getFontName(); protected: void initializeCombos(); virtual BOOL OnInitDialog(); @@ -54,6 +56,10 @@ protected: afx_msg void OnPaint(); DECLARE_MESSAGE_MAP() +private: + amis::util::Color mHighlightBG; + amis::util::Color mHighlightFG; + std::string mFontName; }; } } Modified: branches/amis3/AmisGuiMFC2/include/util/Color.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/util/Color.h 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/include/util/Color.h 2008-03-13 23:44:17 UTC (rev 2405) @@ -41,6 +41,7 @@ Color(COLORREF); void set(std::string); void set(COLORREF); + void setWithHtmlName(std::string); COLORREF getAsColorRef(); std::string getAsHtmlHexColor(); std::string getHexValueForNamedColor(std::string); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-13 23:44:17 UTC (rev 2405) @@ -54,6 +54,7 @@ #include "gui/dialogs/MultipleBooksOnVolumeDialog.h" #include "gui/dialogs/PreferencesDialog.h" #include "gui/dialogs/PublicationSummaryDialog.h" +#include "gui/dialogs/TextStyleDialog.h" #include "gui/self-voicing/directshow/dx_audio_player.h" @@ -113,6 +114,7 @@ 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) + ON_COMMAND(ID_AMIS_SHOW_TEXTSTYLE, OnShowTextStyle) END_MESSAGE_MAP() CAmisApp::CAmisApp() @@ -809,6 +811,19 @@ { TextRenderBrain::Instance()->applyNextPageStyle(); } +void CAmisApp::OnShowTextStyle() +{ + amis::gui::dialogs::TextStyleDialog dlg; + if (dlg.DoModal() == IDOK) + { + Preferences::Instance()->mHighlightBG = dlg.getHighlightBackgroundColor(); + Preferences::Instance()->mHighlightFG = dlg.getHighlightForegroundColor(); + Preferences::Instance()->mFontName = dlg.getFontName(); + TextRenderBrain::Instance()->saveDefaultCss(); + TextRenderBrain::Instance()->redoPageColors(); + } +} + /*************************************************** * (MED) I moved these functions out of the menu handler area *****************************************************/ Modified: branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/src/gui/TextRenderBrain.cpp 2008-03-13 23:44:17 UTC (rev 2405) @@ -288,6 +288,22 @@ { return mCurrentStyleIdx; } +//take the values in Preferences and write them to file +void TextRenderBrain::saveDefaultCss() +{ + string fg = Preferences::Instance()->mHighlightFG.getAsHtmlHexColor(); + string bg = Preferences::Instance()->mHighlightBG.getAsHtmlHexColor(); + string font = Preferences::Instance()->mFontName; + ofstream cssfile; + cssfile.open(Preferences::Instance()->getAmisCssFile()->get_file().c_str(), ios::out); + cssfile<<"/*default CSS sheet*/"<<endl; + cssfile<<"/*DO NOT EDIT! YOUR CHANGES WILL BE LOST!*/"<<endl; + cssfile<<"/*\"amis-highlight\" is a reserved word that AMIS will look for to find the highlight colors*/"<<endl; + cssfile<<"/*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*/"<<endl; + cssfile<<".amis-highlight {color: "<<fg<<"; background-color: "<<bg<<";}"<<endl; + cssfile<<"body {font-family: "<<font<<";}"<<endl; + cssfile.close(); +} void TextRenderBrain::applyPageStyle(int idx) { clearPageStyle(); Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/TextStyleDialog.cpp 2008-03-13 23:44:17 UTC (rev 2405) @@ -26,6 +26,7 @@ #include "AmisCore.h" #include "util/Color.h" #include "Preferences.h" +#include "..\..\..\include\gui\dialogs\textstyledialog.h" using namespace amis::gui::dialogs; @@ -38,7 +39,7 @@ ON_CBN_SETFOCUS(IDC_HIGHLIGHTFOREGROUND, OnCbnSetfocusHighlightForeground) ON_CBN_SELCHANGE(IDC_HIGHLIGHTBACKGROUND, OnCbnSelchangeHighlightBackground) ON_CBN_SETFOCUS(IDC_HIGHLIGHTBACKGROUND, OnCbnSetfocusHighlightBackground) - ON_WM_PAINT() + ON_WM_PAINT() END_MESSAGE_MAP() BOOL CALLBACK EnumFontCallback (LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData) @@ -57,6 +58,9 @@ } BOOL TextStyleDialog::OnInitDialog() { + mFontName = Preferences::Instance()->mFontName; + mHighlightBG = Preferences::Instance()->mHighlightBG; + mHighlightFG = Preferences::Instance()->mHighlightFG; initializeCombos(); return CDialog::OnInitDialog(); } @@ -77,14 +81,16 @@ int background_sel = -1; int i = 0; amis::StringMap::iterator it = p_all_colors->begin(); + std::string highlight_bg = Preferences::Instance()->mHighlightBG.getAsHtmlHexColor(); + std::string highlight_fg = Preferences::Instance()->mHighlightFG.getAsHtmlHexColor(); while (it != p_all_colors->end()) { CString label = A2T(it->first.c_str()); p_foreground_list->AddString(label); p_background_list->AddString(label); - if (it->second == Preferences::Instance()->mHighlightBG.getAsHtmlHexColor()) + if (it->second == highlight_bg) background_sel = i; - if (it->second == Preferences::Instance()->mHighlightFG.getAsHtmlHexColor()) + if (it->second == highlight_fg) foreground_sel = i; i++; it++; @@ -93,7 +99,7 @@ p_background_list->SetCurSel(background_sel); CClientDC dc(this); - EnumFonts (dc, 0,(FONTENUMPROC)EnumFontCallback,(LPARAM)this); + EnumFonts (dc, 0,(FONTENUMPROC)EnumFontCallback,(LPARAM)this->GetDlgItem(IDC_FONT)); } void TextStyleDialog::OnPaint() { @@ -124,22 +130,55 @@ return AmisDialogBase::PreTranslateMessage(pMsg); } +amis::util::Color TextStyleDialog::getHighlightForegroundColor() +{ + return mHighlightFG; +} + +amis::util::Color TextStyleDialog::getHighlightBackgroundColor() +{ + return mHighlightBG; +} + +std::string TextStyleDialog::getFontName() +{ + return mFontName; +} + //widget event handlers void TextStyleDialog::OnCbnSelchangeFont() { + USES_CONVERSION; + CString tmp; + CComboBox* p_font_list = (CComboBox*)GetDlgItem(IDC_FONT); + p_font_list->GetWindowText(tmp); + mFontName = T2A(tmp); } void TextStyleDialog::OnCbnSetfocusFont() { } void TextStyleDialog::OnCbnSelchangeHighlightForeground() { + USES_CONVERSION; + CString tmp; + CComboBox* p_foreground_list = (CComboBox*)GetDlgItem(IDC_HIGHLIGHTFOREGROUND); + + p_foreground_list->GetWindowText(tmp); + if (tmp == "") tmp = "black"; + mHighlightFG.setWithHtmlName(T2A(tmp)); } void TextStyleDialog::OnCbnSetfocusHighlightForeground() { } void TextStyleDialog::OnCbnSelchangeHighlightBackground() { + USES_CONVERSION; + CString tmp; + CComboBox* p_background_list = (CComboBox*)GetDlgItem(IDC_HIGHLIGHTBACKGROUND); + p_background_list->GetWindowText(tmp); + if (tmp == "") tmp = "yellow"; + mHighlightBG.setWithHtmlName(T2A(tmp)); } void TextStyleDialog::OnCbnSetfocusHighlightBackground() { -} \ No newline at end of file +} Modified: branches/amis3/AmisGuiMFC2/src/util/Color.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/util/Color.cpp 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/AmisGuiMFC2/src/util/Color.cpp 2008-03-13 23:44:17 UTC (rev 2405) @@ -192,6 +192,11 @@ mColor = htmlToRgb(value); } +void Color::setWithHtmlName(std::string value) +{ + mColorHtml = mColorHexMap[value]; + mColor = htmlToRgb(value); +} void Color::set(COLORREF value) { mColor = value; Modified: branches/amis3/bin/settings/css/amis.css =================================================================== --- branches/amis3/bin/settings/css/amis.css 2008-03-12 03:45:11 UTC (rev 2404) +++ branches/amis3/bin/settings/css/amis.css 2008-03-13 23:44:17 UTC (rev 2405) @@ -1,5 +1,6 @@ /*default CSS sheet*/ +/*DO NOT EDIT! YOUR CHANGES WILL BE LOST!*/ /*"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: black; background-color: yellow} -body {font-family: arial, verdana, sans-serif;} \ No newline at end of file +.amis-highlight {color: #000000; background-color: #FFFF00;} +body {font-family: verdana;} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |