[Amis-vcs] SF.net SVN: amis: [2149] branches/amis3
Brought to you by:
julienq,
marisademeglio
From: <mar...@us...> - 2007-09-15 06:01:43
|
Revision: 2149 http://amis.svn.sourceforge.net/amis/?rev=2149&view=rev Author: marisademeglio Date: 2007-09-14 23:01:42 -0700 (Fri, 14 Sep 2007) Log Message: ----------- Go to page works Modified Paths: -------------- branches/amis3/AmisCore/src/dtb/nav/PageList.cpp branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h branches/amis3/AmisGuiMFC2/include/gui/MmView.h branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp Modified: branches/amis3/AmisCore/src/dtb/nav/PageList.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/PageList.cpp 2007-09-14 08:44:15 UTC (rev 2148) +++ branches/amis3/AmisCore/src/dtb/nav/PageList.cpp 2007-09-15 06:01:42 UTC (rev 2149) @@ -79,14 +79,8 @@ } } - if (b_found == true) - { - return (PageTarget*)this->getAtIndex(i); - } - else - { - return NULL; - } + if (b_found == true) return (PageTarget*)this->getAtIndex(i); + else return NULL; } void amis::dtb::nav::PageList::print() Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps =================================================================== (Binary files differ) Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj =================================================================== --- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2007-09-14 08:44:15 UTC (rev 2148) +++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2007-09-15 06:01:42 UTC (rev 2149) @@ -204,6 +204,9 @@ RelativePath=".\include\gui\dialogs\AmisFileDialog.h"> </File> <File + RelativePath=".\include\gui\dialogs\GoToPageDialog.h"> + </File> + <File RelativePath=".\include\gui\dialogs\OpenUrlDialog.h"> </File> <File @@ -347,6 +350,9 @@ RelativePath=".\src\gui\dialogs\AmisFileDialog.cpp"> </File> <File + RelativePath=".\src\gui\dialogs\GoToPageDialog.cpp"> + </File> + <File RelativePath=".\src\gui\dialogs\OpenUrlDialog.cpp"> </File> <File Modified: branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h 2007-09-14 08:44:15 UTC (rev 2148) +++ branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h 2007-09-15 06:01:42 UTC (rev 2149) @@ -76,6 +76,7 @@ afx_msg void OnSkipInfo(); afx_msg void OnAddBookmark(); afx_msg void OnSelectBookmark(UINT); + afx_msg void OnGoToPage(); protected: HMENU m_hMDIMenu; HACCEL m_hMDIAccel; Modified: branches/amis3/AmisGuiMFC2/include/gui/MmView.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MmView.h 2007-09-14 08:44:15 UTC (rev 2148) +++ branches/amis3/AmisGuiMFC2/include/gui/MmView.h 2007-09-15 06:01:42 UTC (rev 2149) @@ -50,7 +50,7 @@ void SetMMDocument(LPCTSTR lpszPathName, bool autostart); void skipOptionsChanged(); void ScheduleReplaceDoc(std::string& url); - bool LocateWelcomeDoc(LPCTSTR rpath); + //bool LocateWelcomeDoc(LPCTSTR rpath); ambulant::net::datasource_factory *getDatasourceFactory(); bool expectingAudio() const { return m_expecting_audio; } UINT_PTR m_timer_id; @@ -100,16 +100,16 @@ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnFocusAdvance(); afx_msg void OnFocusActivate(); - afx_msg void OnViewSource(); - afx_msg void OnUpdateViewSource(CCmdUI *pCmdUI); - afx_msg void OnUpdateViewLog(CCmdUI *pCmdUI); - afx_msg void OnViewLog(); + //afx_msg void OnViewSource(); + //afx_msg void OnUpdateViewSource(CCmdUI *pCmdUI); + //afx_msg void OnUpdateViewLog(CCmdUI *pCmdUI); + //afx_msg void OnViewLog(); afx_msg LRESULT OnSetClientRect(WPARAM wParam, LPARAM lParam); - afx_msg void OnOpenFilter(); - afx_msg void OnViewFilter(); - afx_msg void OnUpdateViewFilter(CCmdUI *pCmdUI); + //afx_msg void OnOpenFilter(); + //afx_msg void OnViewFilter(); + //afx_msg void OnUpdateViewFilter(CCmdUI *pCmdUI); afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnUpdateOpenFilter(CCmdUI *pCmdUI); + //afx_msg void OnUpdateOpenFilter(CCmdUI *pCmdUI); #if 0 afx_msg void OnViewAutoplay(); void OnUpdateViewAutoplay(CCmdUI *pCmdUI); @@ -117,8 +117,8 @@ afx_msg BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult); virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; - afx_msg void OnHelpWelcome(); - afx_msg void OnUpdateHelpWelcome(CCmdUI *pCmdUI); + //afx_msg void OnHelpWelcome(); + //afx_msg void OnUpdateHelpWelcome(CCmdUI *pCmdUI); afx_msg LRESULT OnReplaceDoc(WPARAM wParam, LPARAM lParam); // Daisy local navigation support Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp 2007-09-14 08:44:15 UTC (rev 2148) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp 2007-09-15 06:01:42 UTC (rev 2149) @@ -40,6 +40,8 @@ #include "gui/dialogs/AboutDialog.h" #include "gui/dialogs/OpenUrlDialog.h" #include "gui/dialogs/SkipDialog.h" +#include "gui/dialogs/GoToPageDialog.h" +#include "dtb/nav/NavModel.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -71,6 +73,7 @@ ON_COMMAND(ID_MENU_INFO_SKIP, OnSkipInfo) ON_COMMAND(ID_MENU_BMK_ADD, OnAddBookmark) ON_COMMAND_RANGE(BOOKMARKS_BASE_ID, BOOKMARKS_BASE_ID + MAX_ANYTHING, OnSelectBookmark) + ON_COMMAND(ID_MENU_NAV_GOTOPAGE, OnGoToPage) END_MESSAGE_MAP() @@ -350,17 +353,19 @@ amis::gui::dialogs::OpenUrlDialog dlg; string str_url = ""; - if (dlg.DoModal() == IDOK) str_url = T2A(dlg.getUrl()); - - ambulant::net::url book_url = ambulant::net::url::from_url(str_url); - if (amis::dtb::DtbWithHooks::Instance()->open(&book_url, &very_temporary_bookmarks_dir)) + if (dlg.DoModal() == IDOK) { - amis::dtb::DtbWithHooks::Instance()->startReading(true); + str_url = T2A(dlg.getUrl()); + ambulant::net::url book_url = ambulant::net::url::from_url(str_url); + if (amis::dtb::DtbWithHooks::Instance()->open(&book_url, &very_temporary_bookmarks_dir)) + { + amis::dtb::DtbWithHooks::Instance()->startReading(true); + } + else + { + AfxMessageBox(_T("Error opening book")); + } } - else - { - AfxMessageBox(_T("Error opening book")); - } } void CAmisGuiMFC2App::OnSkipInfo() @@ -384,4 +389,21 @@ idx = id - BOOKMARKS_BASE_ID; amis::dtb::DtbWithHooks::Instance()->loadBookmark(idx); +} + +void CAmisGuiMFC2App::OnGoToPage() +{ + amis::gui::dialogs::GoToPageDialog dialog; + if (dialog.DoModal() == IDOK) + { + wstring page_number = dialog.getPageNumber(); + amis::dtb::nav::NavModel* p_nav_model = NULL; + p_nav_model = amis::dtb::DtbWithHooks::Instance()->getNavModel(); + if (p_nav_model->hasPages() && p_nav_model->getPageList() != NULL) + { + amis::dtb::nav::PageTarget* p_page = NULL; + p_page = p_nav_model->getPageList()->findPage(page_number); + if (p_page) amis::dtb::DtbWithHooks::Instance()->loadNavNode(p_page); + } + } } \ No newline at end of file Modified: branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp 2007-09-14 08:44:15 UTC (rev 2148) +++ branches/amis3/AmisGuiMFC2/src/gui/MmDoc.cpp 2007-09-15 06:01:42 UTC (rev 2149) @@ -50,7 +50,6 @@ // #include "stdafx.h" -//#include "AmbulantPlayer.h" #include "gui/MmDoc.h" #include "gui/MmView.h" @@ -76,9 +75,7 @@ MmDoc::MmDoc() { ASSERT(MainWndParts::Instance()->mpMmDoc == NULL); - MainWndParts::Instance()->mpMmDoc = this; - // TODO: add one-time construction code here m_autostart = false; } @@ -88,11 +85,7 @@ BOOL MmDoc::OnNewDocument() { - if (!CDocument::OnNewDocument()) - return FALSE; - - // TODO: add reinitialization code here - // (SDI documents will reuse this document) + if (!CDocument::OnNewDocument()) return FALSE; return TRUE; } @@ -133,12 +126,9 @@ BOOL MmDoc::OnOpenDocument(LPCTSTR lpszPathName) { - //if (!CDocument::OnOpenDocument(lpszPathName)) - // return FALSE; - - // TODO: Add your specialized creation code here POSITION pos = GetFirstViewPosition(); - if(pos != NULL) { + if(pos != NULL) + { CView* pView = GetNextView(pos); ASSERT_VALID(pView); ((MmView*)pView)->SetMMDocument(lpszPathName, m_autostart); @@ -146,20 +136,26 @@ return TRUE; } -void MmDoc::SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU) { - if(_tcsstr(lpszPathName, _T("://")) != 0) { +void MmDoc::SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU) +{ + if(_tcsstr(lpszPathName, _T("://")) != 0) + { // seems a url m_strPathName = "URL"; m_bEmbedded = FALSE; SetTitle(_T("URL")); - } else { + } + else + { CDocument::SetPathName(lpszPathName, bAddToMRU); } } -void MmDoc::StartPlayback() { +void MmDoc::StartPlayback() +{ POSITION pos = GetFirstViewPosition(); - if(pos != NULL) { + if(pos != NULL) + { CView* pView = GetNextView(pos); ASSERT_VALID(pView); ((MmView*)pView)->OnFilePlay(); Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2007-09-14 08:44:15 UTC (rev 2148) +++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2007-09-15 06:01:42 UTC (rev 2149) @@ -22,8 +22,6 @@ #include "stdafx.h" #include "ambulant/gui/dx/html_bridge.h" -//AMIS removed this -//#include "AmbulantPlayer.h" #include "gui/MainFrm.h" #include "gui/MmDoc.h" @@ -75,7 +73,8 @@ const TCHAR log_name[] = TEXT("amlog.txt"); #ifdef _DEBUG -class logwindow_atltrace : public ambulant::lib::ostream { +class logwindow_atltrace : public ambulant::lib::ostream +{ bool is_open() const {return true;} void close() {} int write(const unsigned char *buffer, int nbytes) {return write("ostream use of buffer, size not implemented for MFC");} @@ -86,14 +85,14 @@ #endif //this function copied from AmbulantPlayer project and modified for AMIS -void -set_status_line(const char *message) +void set_status_line(const char *message) { if (MainWndParts::Instance()->mpMainFrame) MainWndParts::Instance()->mpMainFrame->PostMessage(WM_APP, 0, (LPARAM)message); } -static std::string get_log_filename() { +static std::string get_log_filename() +{ TCHAR buf[_MAX_PATH]; GetModuleFileName(NULL, buf, _MAX_PATH); TCHAR *p1 = text_strrchr(buf,'\\'); @@ -104,7 +103,8 @@ } #endif // WITHOUT_LOG_WINDOW -static TCHAR *get_directory(const TCHAR *fn) { +static TCHAR *get_directory(const TCHAR *fn) +{ static TCHAR buf[_MAX_PATH]; buf[0] = 0; text_strcat(buf, fn); @@ -119,7 +119,6 @@ #endif using namespace ambulant; -//#define AM_PLAYER_DG #ifdef AM_PLAYER_DG typedef gui::dg::dg_player dg_or_dx_player; @@ -133,7 +132,8 @@ static HWND s_hwnd; // A class with callbacks, also instantiated once -class my_player_callbacks : public gui_callbacks { +class my_player_callbacks : public gui_callbacks +{ public: HWND new_os_window(); void destroy_os_window(HWND hwnd); @@ -143,25 +143,26 @@ my_player_callbacks s_player_callbacks; -HWND my_player_callbacks::new_os_window() { +HWND my_player_callbacks::new_os_window() +{ // Return the handle of the single instance for now // This means paint bits of the new window // to the single instance return s_hwnd; } -void my_player_callbacks::destroy_os_window(HWND hwnd) { +void my_player_callbacks::destroy_os_window(HWND hwnd) +{ // none for now; keep the single instance } -html_browser * -my_player_callbacks::new_html_browser(int left, int top, int width, int height) +html_browser* my_player_callbacks::new_html_browser(int left, int top, int width, int height) { return ::new_html_browser(left, top, width, height); } -SIZE -my_player_callbacks::get_default_size() { +SIZE my_player_callbacks::get_default_size() +{ SIZE size; size.cx = 640; size.cy = 480; @@ -169,8 +170,8 @@ } -static dg_or_dx_player* -create_player_instance(const net::url& u, common::player_feedback *feedback) { +static dg_or_dx_player* create_player_instance(const net::url& u, common::player_feedback *feedback) +{ dg_or_dx_player *rv = new dg_or_dx_player(s_player_callbacks, feedback, u); amis::io::UrlInputSource::SetDatasourceFactory(rv->get_datasource_factory()); return rv; @@ -181,44 +182,20 @@ CWnd* topView = NULL; - // MmView - +// MmView IMPLEMENT_DYNCREATE(MmView, CView) - BEGIN_MESSAGE_MAP(MmView, CView) ON_WM_DESTROY() ON_COMMAND(ID_AMBULANT_PLAY, OnFilePlay) - //AMIS ON_UPDATE_COMMAND_UI(ID_FILE_PLAY, OnUpdateFilePlay) - //AMIS ON_COMMAND(ID_FILE_PAUSE, OnFilePause) - //AMIS ON_UPDATE_COMMAND_UI(ID_FILE_PAUSE, OnUpdateFilePause) ON_WM_TIMER() ON_WM_CREATE() ON_WM_LBUTTONDOWN() ON_WM_CHAR() - //AMIS ON_COMMAND(ID_PLAY_ADVANCEFOCUS, OnFocusAdvance) - //AMIS ON_COMMAND(ID_PLAY_ACTIVATEFOCUS, OnFocusActivate) - //AMIS ON_COMMAND(ID_VIEW_SOURCE, OnViewSource) - //AMIS ON_UPDATE_COMMAND_UI(ID_VIEW_SOURCE, OnUpdateViewSource) - //AMIS ON_UPDATE_COMMAND_UI(ID_VIEW_LOG, OnUpdateViewLog) - //AMIS ON_COMMAND(ID_VIEW_LOG, OnViewLog) ON_MESSAGE(WM_SET_CLIENT_RECT, OnSetClientRect) - //AMIS ON_COMMAND(ID_VIEW_TESTS, OnOpenFilter) - //AMIS ON_COMMAND(ID_VIEW_FILTER, OnViewFilter) - //AMIS ON_UPDATE_COMMAND_UI(ID_VIEW_FILTER, OnUpdateViewFilter) ON_WM_MOUSEMOVE() - //AMIS ON_UPDATE_COMMAND_UI(ID_VIEW_TESTS, OnUpdateOpenFilter) - //AMIS ON_COMMAND(ID_VIEW_AUTOPLAY, OnViewAutoplay) - //AMIS ON_UPDATE_COMMAND_UI(ID_VIEW_AUTOPLAY, OnUpdateViewAutoplay) - //AMIS ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify) - //AMIS ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify) - //AMIS ON_COMMAND(ID_HELP_WELCOME, OnHelpWelcome) - //AMIS ON_UPDATE_COMMAND_UI(ID_HELP_WELCOME, OnUpdateHelpWelcome) ON_MESSAGE(WM_REPLACE_DOC, OnReplaceDoc) END_MESSAGE_MAP() - -// MmView construction/destruction - MmView::MmView() { #ifndef WITHOUT_LOG_WINDOW @@ -232,7 +209,6 @@ m_recent_par_node = NULL; m_expecting_audio = false; m_previous_in_progress = false; -// lib::logger::get_logger()->set_show_message(log_show_message); ambulant::common::preferences *prefs = ambulant::common::preferences::get_preferences(); prefs->m_welcome_seen = true; @@ -279,30 +255,22 @@ BOOL MmView::PreCreateWindow(CREATESTRUCT& cs) { - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs cs.style |= WS_CLIPCHILDREN; // reduce flicker return CView::PreCreateWindow(cs); } -// MmView drawing - void MmView::OnDraw(CDC* pDC) { MmDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); - if (!pDoc) - return; + if (!pDoc) return; // TODO: add draw code for native data here - if(player) - player->redraw(m_hWnd, pDC->m_hDC); - + if(player) player->redraw(m_hWnd, pDC->m_hDC); } // MmView diagnostics - #ifdef _DEBUG void MmView::AssertValid() const { @@ -325,8 +293,7 @@ // MmView message handlers int MmView::OnCreate(LPCREATESTRUCT lpCreateStruct) { - if (CView::OnCreate(lpCreateStruct) == -1) - return -1; + if (CView::OnCreate(lpCreateStruct) == -1) return -1; m_timer_id = SetTimer(1, 500, 0); @@ -334,25 +301,7 @@ s_hwnd = GetSafeHwnd(); ModifyStyle(0, WS_CLIPCHILDREN); // reduce flicker - //Commented out for AMIS integration - /*if(LocateWelcomeDoc(TEXT("..\\..\\Extras\\Welcome\\Welcome.smil")) || - LocateWelcomeDoc(TEXT("Extras\\Welcome\\Welcome.smil")) || - LocateWelcomeDoc(TEXT("Welcome.smil"))){;} - */ - - PostMessage(WM_SET_CLIENT_RECT, - common::default_layout_width, ambulant::common::default_layout_height); - -//modified for AMIS - //CWinApp* pApp = AfxGetApp(); - //CString val = pApp->GetProfileString(_T("Settings"), _T("Welcome")); - if (1) { //if(val.IsEmpty()) { - // first time; write the string and play welcome - //pApp->WriteProfileString(_T("Settings"), _T("Welcome"), _T("1")); - if(!m_welcomeDocFilename.IsEmpty()); - //PostMessage(WM_COMMAND, ID_HELP_WELCOME); - } - + PostMessage(WM_SET_CLIENT_RECT, common::default_layout_width, ambulant::common::default_layout_height); return 0; } @@ -363,7 +312,8 @@ void MmView::OnDestroy() { - if(player) { + if(player) + { CAmisHtmlView *hv = MainWndParts::Instance()->mpHtmlView; if (hv) hv->smilPlayerDeleted(); player->stop(); @@ -375,16 +325,19 @@ CView::OnDestroy(); } -void MmView::ScheduleReplaceDoc(std::string& urlstr) { +void MmView::ScheduleReplaceDoc(std::string& urlstr) +{ PostMessage(WM_REPLACE_DOC, 1, (LPARAM)(new std::string(urlstr))); } -void MmView::SetMMDocument(LPCTSTR lpszPathName, bool autostart) { +void MmView::SetMMDocument(LPCTSTR lpszPathName, bool autostart) +{ USES_CONVERSION; dg_or_dx_player *dummy = player; player = 0; m_recent_media_node = NULL; - if(dummy) { + if(dummy) + { CAmisHtmlView *hv = MainWndParts::Instance()->mpHtmlView; if (hv) hv->smilPlayerDeleted(); dummy->stop(); @@ -402,16 +355,20 @@ net::url u; TCHAR path[_MAX_PATH]; - if (is_local_filename) { + if (is_local_filename) + { TCHAR *pFilePart = 0; GetFullPathName(lpszPathName, MAX_PATH, path, &pFilePart); u = net::url::from_filename(T2CA(path)); - } else { + } + else + { _tcscpy(path, lpszPathName); u = net::url::from_url(T2CA(path)); } - if (!u.is_absolute()) { + if (!u.is_absolute()) + { lib::logger::get_logger()->error("Cannot play from non-absolute pathname: %s", lpszPathName); return; } @@ -425,18 +382,17 @@ player = dummy; skipOptionsChanged(); set_status_line("Ready"); - if (m_previous_in_progress) { + if (m_previous_in_progress) + { // Goto last node lastPhrase(); m_previous_in_progress = false; } - if(autostart || m_autoplay) - PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); + if(autostart || m_autoplay) PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); } void MmView::skipOptionsChanged() { - //TODO: point to right custom test location /* amis::dtb::nav::NavModel* p_nav_model = NULL;//amis::dtb::Dtb::getNavModel(); assert(p_nav_model); @@ -464,7 +420,8 @@ /*DBG*/static in_here = 0; /*DBG*/assert(!in_here); /*DBG*/in_here++; - if(player) { + if(player) + { player->play(); needs_done_redraw = true; InvalidateRect(NULL); @@ -498,7 +455,8 @@ { // XXXX Jack: This seems a very funny way to get a final redraw... CView::OnTimer(nIDEvent); - if(player && needs_done_redraw && player->is_stop_active()) { + if(player && needs_done_redraw && player->is_stop_active()) + { player->on_done(); InvalidateRect(NULL); PostMessage(WM_INITMENUPOPUP,0, 0); @@ -516,15 +474,20 @@ void MmView::OnMouseMove(UINT nFlags, CPoint point) { #ifdef AMIS_LATER - if(player) { + if(player) + { int new_cursor_id = player->get_cursor(point.x, point.y, GetSafeHwnd()); if(new_cursor_id>0) EnableToolTips(TRUE); else CancelToolTips(); - if(new_cursor_id != m_cursor_id) { + if(new_cursor_id != m_cursor_id) + { HCURSOR new_cursor = 0; - if(new_cursor_id == 0) { + if(new_cursor_id == 0) + { new_cursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); - } else { + } + else + { new_cursor = AfxGetApp()->LoadCursor(IDC_CURSOR_HAND); } SetClassLongPtr(GetSafeHwnd(), GCLP_HCURSOR, HandleToLong(new_cursor)); @@ -535,7 +498,8 @@ CView::OnMouseMove(nFlags, point); } -void MmView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { +void MmView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +{ if(player) player->on_char(nChar); CView::OnChar(nChar, nRepCnt, nFlags); } @@ -549,8 +513,9 @@ { if (player) player->on_focus_activate(); } - -void MmView::OnViewSource() { +/* +void MmView::OnViewSource() +{ USES_CONVERSION; CString cmd = TEXT("Notepad.exe "); std::string ustr = T2CA(LPCTSTR(m_curDocFilename)); @@ -561,14 +526,18 @@ cmd += u.get_file().c_str(); // XXXX Incorrect WinExec(T2CA(cmd), SW_SHOW); } - -void MmView::OnUpdateViewSource(CCmdUI *pCmdUI) { +*/ +/* +void MmView::OnUpdateViewSource(CCmdUI *pCmdUI) +{ USES_CONVERSION; bool b = player && !m_curDocFilename.IsEmpty() && net::url::from_url(T2CA(LPCTSTR(m_curDocFilename))).is_local_file(); pCmdUI->Enable(b?TRUE:FALSE); } - -void MmView::OnViewLog() { +*/ +/* +void MmView::OnViewLog() +{ #ifdef WITHOUT_LOG_WINDOW // Logging to file: open the file in notepad. TCHAR buf[_MAX_PATH]; @@ -582,19 +551,20 @@ WinExec((LPCSTR)(LPCTSTR)cmd, SW_SHOW); #else // Logging to a window: show the window. - if (m_logwindow == NULL) { - m_logwindow = CLogWindow::GetLogWindowSingleton(); - } + if (m_logwindow == NULL) m_logwindow = CLogWindow::GetLogWindowSingleton(); + m_logwindow->ShowWindow(SW_SHOW); #endif } - -void MmView::OnUpdateViewLog(CCmdUI *pCmdUI) { - //pCmdUI->Enable((player && !m_curDocFilename.IsEmpty())?TRUE:FALSE); +*/ +/* +void MmView::OnUpdateViewLog(CCmdUI *pCmdUI) +{ pCmdUI->Enable(TRUE); } - -LPARAM MmView::OnSetClientRect(WPARAM wParam, LPARAM lParam) { +*/ +LPARAM MmView::OnSetClientRect(WPARAM wParam, LPARAM lParam) +{ CFrameWnd *mainWnd = (CFrameWnd*) AfxGetMainWnd(); POINT pt = {0, 0}; // margins @@ -614,7 +584,8 @@ return 0; } -LPARAM MmView::OnReplaceDoc(WPARAM wParam, LPARAM lParam) { +LPARAM MmView::OnReplaceDoc(WPARAM wParam, LPARAM lParam) +{ USES_CONVERSION; if(lParam == 0) return 0; std::string *purlstr = (std::string *)lParam; @@ -622,8 +593,9 @@ delete purlstr; return 0; } - -void MmView::OnOpenFilter() { +/* +void MmView::OnOpenFilter() +{ USES_CONVERSION; BOOL bOpenFileDialog = TRUE; TCHAR lpszDefExt[] = TEXT("*.xml"); @@ -648,12 +620,14 @@ #endif } } - +*/ +/* void MmView::OnUpdateOpenFilter(CCmdUI *pCmdUI) { pCmdUI->Enable(TRUE); } - +*/ +/* void MmView::OnViewFilter() { USES_CONVERSION; @@ -663,11 +637,13 @@ WinExec(T2CA((LPCTSTR)cmd), SW_SHOW); } } - +*/ +/* void MmView::OnUpdateViewFilter(CCmdUI *pCmdUI) { pCmdUI->Enable(!m_curFilter.IsEmpty()); } +*/ #if 0 void MmView::OnViewAutoplay() @@ -691,7 +667,8 @@ UINT_PTR nID = pNMHDR->idFrom; CString strTipText; if(pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || - pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) { + pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) + { std::string str = player->get_pointed_node_str(); strTipText.Format(_T("Anchor: %s"), str.c_str()); if(pNMHDR->code == TTN_NEEDTEXTA) @@ -704,12 +681,16 @@ return FALSE; } -INT_PTR MmView::OnToolHitTest(CPoint point, TOOLINFO* pTI) const { - if(player) { +INT_PTR MmView::OnToolHitTest(CPoint point, TOOLINFO* pTI) const +{ + if(player) + { int new_cursor_id = player->get_cursor(point.x, point.y, GetSafeHwnd()); - if(new_cursor_id > 0) { + if(new_cursor_id > 0) + { INT_PTR nHit = 1; // node id - if (pTI != NULL) { + if (pTI != NULL) + { pTI->hwnd = m_hWnd; pTI->uId = (UINT_PTR)m_hWnd; // hWndChild; pTI->uFlags |= TTF_IDISHWND; @@ -721,8 +702,9 @@ } return -1; // not found } - -bool MmView::LocateWelcomeDoc(LPCTSTR rpath) { +/* +bool MmView::LocateWelcomeDoc(LPCTSTR rpath) +{ TCHAR buf[_MAX_PATH]; GetModuleFileName(NULL, buf, _MAX_PATH); TCHAR *p1 = text_strrchr(buf,'\\'); @@ -734,35 +716,39 @@ WIN32_FIND_DATA fd; memset(&fd, 0, sizeof(WIN32_FIND_DATA)); HANDLE hFind = FindFirstFile(path, &fd); - if(hFind != INVALID_HANDLE_VALUE){ + if(hFind != INVALID_HANDLE_VALUE) + { FindClose(hFind); m_welcomeDocFilename = path; return true; } return false; } - +*/ +/* void MmView::OnHelpWelcome() { if(!m_welcomeDocFilename.IsEmpty()) SetMMDocument(m_welcomeDocFilename, true); } - +*/ +/* void MmView::OnUpdateHelpWelcome(CCmdUI *pCmdUI) { pCmdUI->Enable(!m_welcomeDocFilename.IsEmpty()); } - +*/ // Helper routine: find "phrase" for a given node: the most recent // ancestor that is the child of a <seq> or <body>. -static const ambulant::lib::node * -_curPhrase(const ambulant::lib::node *n) +static const ambulant::lib::node* _curPhrase(const ambulant::lib::node *n) { assert(n); const ambulant::lib::node *parent = n->up(); - while (parent) { + while (parent) + { std::string tag = parent->get_local_name(); - if (tag == "seq" || tag == "body") { + if (tag == "seq" || tag == "body") + { return n; } n = parent; @@ -773,7 +759,8 @@ void MmView::nextPhrase() { - if (!m_recent_media_node) { + if (!m_recent_media_node) + { TRACE("nextPhrase: m_recent_media_node==NULL, nowhere to go.\n"); return; } @@ -781,18 +768,22 @@ // Find the nearest ancestor that is a child of a <seq> const ambulant::lib::node *phrase = _curPhrase(m_recent_media_node); const ambulant::lib::node *next; - do { - if (!phrase) { + do + { + if (!phrase) + { TRACE("nextPhrase: no current phrase"); assert(player); player->stop(); return; } next = phrase->next(); - if (!next) { + if (!next) + { // We're apparently at the end of the parent <seq>. Up one level. const ambulant::lib::node *parent = phrase->up(); - if (!parent) { + if (!parent) + { // Need to go to next SMIL document. TRACE("nextPhrase: top-of-tree, stop playback\n"); assert(player); @@ -801,22 +792,26 @@ } phrase = _curPhrase(parent); } - } while(!next); + } + while(!next); TRACE("nextPhrase: goto_node(%s)\n", next->get_sig().c_str()); player->goto_node(next); } void MmView::prevPhrase() { - if (!m_recent_media_node) { + if (!m_recent_media_node) + { TRACE("prevPhrase: m_recent_media_node==NULL, nowhere to go.\n"); return; } // Find the nearest ancestor that is a child of a <seq> const ambulant::lib::node *phrase = _curPhrase(m_recent_media_node); const ambulant::lib::node *prev; - do { - if (!phrase) { + do + { + if (!phrase) + { TRACE("prevPhrase: no current phrase\n"); m_previous_in_progress = true; assert(player); @@ -824,10 +819,12 @@ return; } prev = phrase->previous(); - if (!prev) { + if (!prev) + { // We're apparently at the beginning of the parent <seq>. Up one level. const ambulant::lib::node *parent = phrase->up(); - if (!parent) { + if (!parent) + { // Need to go to previous SMIL document. TRACE("prevPhrase: top-of-tree, stop playback, handle in upper layer\n"); m_previous_in_progress = true; @@ -837,11 +834,13 @@ } phrase = _curPhrase(parent); } - } while(!prev); + } + while(!prev); // Now we need to find the last child of prev. Go down, and find // the phrase for that node. const ambulant::lib::node *ch = prev->get_last_child(); - while (ch) { + while (ch) + { prev = ch; ch = prev->get_last_child(); } @@ -861,7 +860,8 @@ const ambulant::lib::node *ch = root->get_last_child(); const ambulant::lib::node *prev; assert(ch); - while (ch) { + while (ch) + { prev = ch; ch = prev->get_last_child(); } @@ -888,8 +888,7 @@ nextPhrase(); } -ambulant::net::datasource_factory * -MmView::getDatasourceFactory() +ambulant::net::datasource_factory* MmView::getDatasourceFactory() { if (!player) return NULL; return player->get_datasource_factory(); @@ -913,7 +912,8 @@ lib::node *body = root->get_first_child("body"); assert(body); lib::node *s = body->down(); - while (s) { + while (s) + { const char *dur_str = s->get_attribute("dur"); #ifdef AMBULANT_SEEK_WORKAROUND if (dur_str) @@ -927,11 +927,14 @@ // with systemComponent. lib::node::iterator it; lib::node::iterator end = root->end(); - for (it=root->begin(); it!=end; it++) { - if ((*it).first) { // Only do something on inward iteration + for (it=root->begin(); it!=end; it++) + { + if ((*it).first) + { // Only do something on inward iteration lib::node *n = (*it).second; const char *teststr = n->get_attribute("system-required"); - if (teststr) { + if (teststr) + { n->set_attribute("systemComponent", teststr); n->del_attribute("system-required"); } @@ -958,7 +961,7 @@ return; } - CAmisGuiMFC2App* pApp = (CAmisGuiMFC2App *) AfxGetApp(); + CAmisGuiMFC2App* pApp = (CAmisGuiMFC2App*) AfxGetApp(); // pApp->setPlayPauseState(false); if (m_previous_in_progress) { @@ -973,7 +976,7 @@ } } -void MmView::node_started(const ambulant::lib::node *n) +void MmView::node_started(const ambulant::lib::node* n) { // Note by Jack: this routine makes a mess of unicode, mbcs and such. USES_CONVERSION; @@ -1024,10 +1027,3 @@ } - -/*BOOL MmView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) -{ - // TODO: Add your specialized code here and/or call the base class - - return __super::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); -}*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |