[Amis-vcs] SF.net SVN: amis: [2185] branches/amis3
Brought to you by:
julienq,
marisademeglio
|
From: <dan...@us...> - 2007-10-13 09:46:39
|
Revision: 2185
http://amis.svn.sourceforge.net/amis/?rev=2185&view=rev
Author: daniel_weck
Date: 2007-10-13 02:46:40 -0700 (Sat, 13 Oct 2007)
Log Message:
-----------
- Daniel WECK
First commit in Amis3:
* Warning, I have commented MmView.cpp:221 m_prefer_ffmpeg, because of my Ambulant revision which does not have this preference item. (by the way, I use my own todo annotation for easy find: "DanToDo")
* The title bar now displays the Amis2.6 content fields (app_name, book_title, view_mode, voicing, play/pause_state). There is some garbage "AMIS1" at the end, I think it needs to be removed from the RC (impossible to remove programmatically)
* The play/pause state is updated in the menu and in the title bar
Modified Paths:
--------------
branches/amis3/AmisCore/include/dtb/Dtb.h
branches/amis3/AmisCore/src/dtb/Dtb.cpp
branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h
branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h
branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h
branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp
branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp
branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp
branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp
branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp
Modified: branches/amis3/AmisCore/include/dtb/Dtb.h
===================================================================
--- branches/amis3/AmisCore/include/dtb/Dtb.h 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisCore/include/dtb/Dtb.h 2007-10-13 09:46:40 UTC (rev 2185)
@@ -53,7 +53,8 @@
amis::dtb::Bookmark* addBookmark(amis::MediaGroup*);
//void loadFromBookmark(amis::Bookmark*);
-
+
+ amis::MediaGroup* getTitle();
amis::dtb::Metadata* getMetadata();
amis::dtb::Spine* getSpine();
amis::dtb::nav::NavModel* getNavModel();
Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp
===================================================================
--- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2007-10-13 09:46:40 UTC (rev 2185)
@@ -99,6 +99,10 @@
mDaisyVersion = 0;
mpCallbackForPreprocessingBookKey = NULL;
}
+amis::MediaGroup* amis::dtb::Dtb::getTitle()
+{
+ return mpTitle;
+}
amis::dtb::Spine* amis::dtb::Dtb::getSpine()
{
return mpSpine;
Modified: branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h 2007-10-13 09:46:40 UTC (rev 2185)
@@ -57,6 +57,9 @@
std::string getAppPath();
amis::RecentBooks* getRecentBooks();
+
+ void setPauseState(bool play);
+
//Menu handlers
afx_msg void OnFileOpen();
afx_msg void OnPlayPause();
Modified: branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/include/gui/MainWndParts.h 2007-10-13 09:46:40 UTC (rev 2185)
@@ -71,6 +71,24 @@
private:
static MainWndParts* pinstance;
+
+public:
+
+ enum TitleBarFieldID{TITLEBAR_APPNAME, TITLEBAR_BOOKTITLE, TITLEBAR_VIEWMODE, TITLEBAR_SELFVOICING, TITLEBAR_PLAYSTATE};
+ void updateTitleBar(TitleBarFieldID field, CString str);
+
+ void updateTitleViewMode();
+ void updateTitleSelfVoicing(bool selfVoiced);
+ void updateTitlePlayState(bool playing);
+
+private:
+
+ CString mStrTITLEBAR_APPNAME;
+ CString mStrTITLEBAR_VIEWMODE;
+ CString mStrTITLEBAR_SELFVOICING;
+ CString mStrTITLEBAR_PLAYSTATE;
+ CString mStrTITLEBAR_BOOKTITLE;
+
};
}
}
Modified: branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/include/gui/MenuManip.h 2007-10-13 09:46:40 UTC (rev 2185)
@@ -40,7 +40,8 @@
void refreshRecentBooksListMenu();
void setupMenusSomethingOpen(amis::dtb::BookmarkSet*);
void setupMenusNothingOpen();
- void setViewItemCheckmark(bool, UINT);
+ void setViewItemCheckmark(bool, UINT);
+ void setPauseState(bool pauseState);
void addBookmark(amis::dtb::PositionMark*);
void loadBookmarks(amis::dtb::BookmarkSet*);
private:
Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2007-10-13 09:46:40 UTC (rev 2185)
@@ -75,6 +75,19 @@
amis::gui::sidebar::AmisSidebarLoader::Instance()->loadNavigationData
(this->getNavModel(), &amis::gui::MainWndParts::Instance()->mpSidebar->m_wndDlg);
+ if (this->getTitle() != NULL)
+ {
+ amis::TextNode* p_txt = NULL;
+ p_txt = this->getTitle()->getText();
+ if (p_txt != NULL)
+ {
+ CString title = p_txt->getTextString().c_str();
+ title.Trim();
+ //DanToDo: title text seems to be empty with HELP DTB. Not initialized properly in the backend parser ?
+ amis::gui::MainWndParts::Instance()->updateTitleBar(amis::gui::MainWndParts::TITLEBAR_BOOKTITLE, title);
+ }
+ }
+
addToRecentBooks();
amis::dtb::BookmarkSet* p_bmks = NULL;
p_bmks = this->getBookmarks();
@@ -339,6 +352,8 @@
{
amis::gui::MainWndParts::Instance()->mpMmDoc->OnOpenDocument(A2T(full_path.get_url().c_str()));
}
+ //DanToDo: Is this the best place to set the PLAY/PAUSE status ? (is the book actually playing at this stage...probably not)
+ theApp.setPauseState(false);
return NULL;
}
Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp 2007-10-13 09:46:40 UTC (rev 2185)
@@ -253,6 +253,10 @@
void CAmisGuiMFC2App::openBook(const ambulant::net::url* filename)
{
+ MainWndParts::Instance()->updateTitleBar(MainWndParts::TITLEBAR_APPNAME, L"Amis");
+ MainWndParts::Instance()->updateTitleViewMode();
+ MainWndParts::Instance()->updateTitleSelfVoicing(Preferences::Instance()->mbIsSelfVoicing);
+
bool b_a_book_was_open = false;
//close the open book
@@ -311,6 +315,35 @@
}
}
+/**
+ * 'pauseState' function parameter:
+ * - FALSE => state is set to "PLAYING", the "PAUSE" action button is therefore shown
+ * - TRUE => state is set to "PAUSED", the "PLAY" action button is therefore shown
+ */
+void CAmisGuiMFC2App::setPauseState(bool pauseState)
+{
+ //DanToDo:
+ //AudioSequencePlayer::Instance()->Stop();
+
+ ////CAmisGuiMFC2App* pApp = (CAmisGuiMFC2App *) AfxGetApp();AfxGetApp()->m_pMainWnd;theApp.xxxx()
+
+ //if (mpMainFrame->m_wndDefaultToolbar)
+ {
+ //DanToDo:
+ //mpMainFrame->m_wndDefaultToolbar.setPauseState(pauseState);
+ }
+
+ //if (mpMainFrame->m_wndBasicToolbar)
+ {
+ //DanToDo:
+ //mpMainFrame->m_wndBasicToolbar.setPauseState(pauseState);
+ }
+
+ amis::gui::MenuManip::Instance()->setPauseState(pauseState);
+
+ MainWndParts::Instance()->updateTitlePlayState(!pauseState);
+}
+
void CAmisGuiMFC2App::OnPlayPause()
{
MmView *view = MainWndParts::Instance()->mpMmView;
Modified: branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/src/gui/MainWndParts.cpp 2007-10-13 09:46:40 UTC (rev 2185)
@@ -162,3 +162,73 @@
return this->mbBasicView;
}
+
+void MainWndParts::updateTitleViewMode()
+{
+ updateTitleBar(TITLEBAR_VIEWMODE, (isBasicView() ? L"Basic view mode" : L"Default view mode"));
+}
+
+void MainWndParts::updateTitleSelfVoicing(bool selfVoiced)
+{
+ updateTitleBar(TITLEBAR_SELFVOICING, (selfVoiced ? L"Self-voicing" : L"Not self-voicing"));
+}
+
+void MainWndParts::updateTitlePlayState(bool playing)
+{
+ updateTitleBar(TITLEBAR_PLAYSTATE, (playing ? L"Playing..." : L"Paused."));
+}
+
+void MainWndParts::updateTitleBar(TitleBarFieldID field, CString str) {
+ CString title;
+ switch (field) {
+ case TITLEBAR_APPNAME: {
+ mStrTITLEBAR_APPNAME = str;
+ break;
+ }
+ case TITLEBAR_BOOKTITLE: {
+ mStrTITLEBAR_BOOKTITLE = str;
+ break;
+ }
+ case TITLEBAR_VIEWMODE: {
+ mStrTITLEBAR_VIEWMODE = str;
+ break;
+ }
+ case TITLEBAR_SELFVOICING: {
+ mStrTITLEBAR_SELFVOICING = str;
+ break;
+ }
+ case TITLEBAR_PLAYSTATE: {
+ mStrTITLEBAR_PLAYSTATE = str;
+ break;
+ }
+ }
+ title.Append(mStrTITLEBAR_APPNAME);
+ title.Append(L" \"");
+ if (mStrTITLEBAR_BOOKTITLE.IsEmpty())
+ {
+ title.Append(L"NO TITLE");
+ }
+ else
+ {
+ title.Append(mStrTITLEBAR_BOOKTITLE);
+ }
+ title.Append(L"\" ");
+ title.Append(mStrTITLEBAR_VIEWMODE);
+ title.Append(L" - ");
+ title.Append(mStrTITLEBAR_SELFVOICING);
+ title.Append(L" - ");
+ if (mStrTITLEBAR_PLAYSTATE.IsEmpty())
+ {
+ title.Append(L"Playing?");
+ }
+ else
+ {
+ title.Append(mStrTITLEBAR_PLAYSTATE);
+ }
+
+ mpMainFrame->SetTitle(L"");
+ AfxGetApp()->m_pMainWnd->SetWindowText(L"");
+
+ mpMainFrame->SetTitle(title);
+ AfxGetApp()->m_pMainWnd->SetWindowText(title);
+}
\ No newline at end of file
Modified: branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/src/gui/MenuManip.cpp 2007-10-13 09:46:40 UTC (rev 2185)
@@ -313,3 +313,28 @@
if (p_mark) addBookmark(p_mark);
}
}
+
+void MenuManip::setPauseState(bool pauseState)
+{
+
+ CMenu* p_menu = NULL;
+ p_menu = MainWndParts::Instance()->mpMainFrame->GetMenu();
+ if (p_menu == NULL)
+ {
+ return;
+ }
+
+ p_menu = p_menu->GetSubMenu(2);
+ assert(p_menu);
+
+ if (pauseState)
+ {
+ // If book is paused, then we display a "play" action
+ p_menu->ModifyMenu(0, MF_BYPOSITION, ID_MENU_PLAYPAUSE, L"&Play\tSpace");
+ }
+ else
+ {
+ // If book is playing, then we display a "pause" action
+ p_menu->ModifyMenu(0, MF_BYPOSITION, ID_MENU_PLAYPAUSE, L"&Pause\tSpace");
+ }
+}
\ No newline at end of file
Modified: branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2007-09-27 17:26:39 UTC (rev 2184)
+++ branches/amis3/AmisGuiMFC2/src/gui/MmView.cpp 2007-10-13 09:46:40 UTC (rev 2185)
@@ -216,7 +216,9 @@
prefs->m_parser_id = "xerces";
prefs->m_use_plugins = true;
prefs->m_plugin_dir = "";
- prefs->m_prefer_ffmpeg = false;
+
+ //DanToDo: I removed the line below to compile with my revision of Ambulant
+ //prefs->m_prefer_ffmpeg = false;
prefs->m_dynamic_content_control = true;
@@ -424,6 +426,7 @@
/*DBG*/in_here++;
if(player)
{
+ theApp.setPauseState(false);
player->play();
needs_done_redraw = true;
InvalidateRect(NULL);
@@ -444,7 +447,11 @@
void MmView::OnFilePause()
{
- if(player) player->pause();
+ if(player)
+ {
+ theApp.setPauseState(true);
+ player->pause();
+ }
}
void MmView::OnUpdateFilePause(CCmdUI *pCmdUI)
@@ -777,6 +784,7 @@
TRACE("nextPhrase: no current phrase");
assert(player);
player->stop();
+ theApp.setPauseState(true);
return;
}
next = phrase->next();
@@ -790,6 +798,7 @@
TRACE("nextPhrase: top-of-tree, stop playback\n");
assert(player);
player->stop();
+ theApp.setPauseState(true);
return;
}
phrase = _curPhrase(parent);
@@ -818,6 +827,7 @@
m_previous_in_progress = true;
assert(player);
player->stop();
+ theApp.setPauseState(true);
return;
}
prev = phrase->previous();
@@ -832,6 +842,7 @@
m_previous_in_progress = true;
assert(player);
player->stop();
+ theApp.setPauseState(true);
return;
}
phrase = _curPhrase(parent);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|