[Amis-vcs] SF.net SVN: amis: [2395] branches/amis3
Brought to you by:
julienq,
marisademeglio
From: <mar...@us...> - 2008-03-07 05:55:25
|
Revision: 2395 http://amis.svn.sourceforge.net/amis/?rev=2395&view=rev Author: marisademeglio Date: 2008-03-06 21:55:29 -0800 (Thu, 06 Mar 2008) Log Message: ----------- No longer crashes if the book has no UID and bookmarking is unavailable. Bookmarking commands disabled if bookmarking not available. Modified Paths: -------------- branches/amis3/AmisCore/src/dtb/Dtb.cpp branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp branches/amis3/AmisCore/src/dtb/nav/NavVisitor.cpp branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp branches/amis3/bin/settings/makeLocalCopiesOfDefaults.bat Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-06 00:12:19 UTC (rev 2394) +++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2008-03-07 05:55:29 UTC (rev 2395) @@ -436,7 +436,7 @@ //-------------------------------------------------- void amis::dtb::Dtb::loadBookmarks(const ambulant::net::url* filepath) { - if (filepath == NULL) + if (filepath == NULL || filepath->is_empty_path()) { mpBookmarks = NULL; return; @@ -553,6 +553,8 @@ //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) { + if (mpBookmarks == NULL) return; + amis::dtb::PositionData* p_pos_data = new amis::dtb::PositionData(); p_pos_data->mUri = positionUri; Modified: branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp 2008-03-06 00:12:19 UTC (rev 2394) +++ branches/amis3/AmisCore/src/dtb/DtbFileSet.cpp 2008-03-07 05:55:29 UTC (rev 2395) @@ -35,6 +35,7 @@ #include "dtb/DtbFileSet.h" #include "util/FilePathTools.h" #include "util/findfilecontainer.h" +#include "util/Log.h" //DTB fileset utility class amis::dtb::DtbFileSet::DtbFileSet() @@ -80,7 +81,10 @@ mBookmarksFilepath = ambulant::net::url::from_filename(thefilename);//calculateSafeBookmarksFilename(uid)); mBookmarksFilepath = mBookmarksFilepath.join_to_base(mBookmarksDirectory); } - + else + { + amis::util::Log::Instance()->writeError("No UID found. Bookmarking unavailable.", "DtbFileSet::setAdditionalDataAfterInitialParse", "AmisCore"); + } if (navfile != NULL) { mNavFilepath = navfile->join_to_base(mBookDirectory); Modified: branches/amis3/AmisCore/src/dtb/nav/NavVisitor.cpp =================================================================== --- branches/amis3/AmisCore/src/dtb/nav/NavVisitor.cpp 2008-03-06 00:12:19 UTC (rev 2394) +++ branches/amis3/AmisCore/src/dtb/nav/NavVisitor.cpp 2008-03-07 05:55:29 UTC (rev 2395) @@ -130,7 +130,7 @@ pModel->setSmilIdNodeMap(mpMap); -// printMap(true); + printMap(true); } //then assign each NavNode a list of file#id values Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-06 00:12:19 UTC (rev 2394) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-07 05:55:29 UTC (rev 2395) @@ -83,6 +83,7 @@ afx_msg void OnUpdateCmdUiPageStyle(CCmdUI*); afx_msg void OnUpdateCmdUiBiggerFont(CCmdUI*); afx_msg void OnUpdateCmdUiSmallerFont(CCmdUI*); + afx_msg void OnUpdateCmdUiBookmarks(CCmdUI*); DECLARE_MESSAGE_MAP() public: void updateToolbarState(toolbar::Toolbar*); Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-06 00:12:19 UTC (rev 2394) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-07 05:55:29 UTC (rev 2395) @@ -67,7 +67,7 @@ ON_UPDATE_COMMAND_UI(ID_AMIS_NEXT_PAGE, OnUpdateCmdUiPageCommands) ON_UPDATE_COMMAND_UI(ID_AMIS_PREVIOUS_PAGE, OnUpdateCmdUiPageCommands) ON_UPDATE_COMMAND_UI(ID_AMIS_GOTO_PAGE, OnUpdateCmdUiPageCommands) - ON_UPDATE_COMMAND_UI(ID_AMIS_ADD_BOOKMARK, OnUpdateCmdUiGeneral) + ON_UPDATE_COMMAND_UI(ID_AMIS_ADD_BOOKMARK, OnUpdateCmdUiBookmarks) ON_UPDATE_COMMAND_UI(ID_AMIS_FASTER, OnUpdateCmdUiPlayFaster) ON_UPDATE_COMMAND_UI(ID_AMIS_CLOSE_BOOK, OnUpdateCmdUiGeneral) ON_UPDATE_COMMAND_UI(ID_AMIS_SHOW_READING_OPTIONS, OnUpdateCmdUiInfoSkip) @@ -557,6 +557,13 @@ else updateUiCommandState(pCmdUi, false); } +void amis::gui::CMainFrame::OnUpdateCmdUiBookmarks(CCmdUI* pCmdUi) +{ + if (theApp.isBookOpen() && amis::dtb::DtbWithHooks::Instance()->getBookmarks() != NULL) + updateUiCommandState(pCmdUi, true); + else + updateUiCommandState(pCmdUi, false); +} //the ON_UPDATE_COMMAND_UI messages end up here because it takes care of the toolbars too void amis::gui::CMainFrame::updateUiCommandState(CCmdUI* pCmdUi, bool value) @@ -617,8 +624,12 @@ else pToolbar->enable(ID_AMIS_SHOW_READING_OPTIONS, false); + if (b_is_book_open && amis::dtb::DtbWithHooks::Instance()->getBookmarks() != NULL) + pToolbar->enable(ID_AMIS_ADD_BOOKMARK, true); + else + pToolbar->enable(ID_AMIS_ADD_BOOKMARK, false); + //general stuff - pToolbar->enable(ID_AMIS_ADD_BOOKMARK, b_is_book_open); pToolbar->enable(ID_AMIS_CLOSE_BOOK, b_is_book_open); pToolbar->enable(ID_AMIS_FOCUS_ON_TEXT, b_is_book_open); pToolbar->enable(ID_AMIS_TOGGLE_AUDIO_CONTENT_PLAYBACK, b_is_book_open); Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-06 00:12:19 UTC (rev 2394) +++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/PublicationSummaryDialog.cpp 2008-03-07 05:55:29 UTC (rev 2395) @@ -139,18 +139,22 @@ mNarrator = p_meta->getMetadataContent("dc:Narrator"); } - //TODO: get the full mutimedia data (should be available directly from the nav data model) - mNavigableItems = p_nav->getNavMap()->getLabel()->getText()->getTextString(); - if (p_nav->hasPages()) - { - mNavigableItems.append(L", "); - mNavigableItems.append(p_nav->getPageList()->getLabel()->getText()->getTextString()); + //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", "); - mNavigableItems.append(p_nav->getNavList(i)->getLabel()->getText()->getTextString()); + if (p_nav->getNavList(i)->getLabel() != NULL) + mNavigableItems.append(p_nav->getNavList(i)->getLabel()->getText()->getTextString()); } mPublisher = p_meta->getMetadataContent("dc:Publisher"); mDescription = p_meta->getMetadataContent("dc:Description"); Modified: branches/amis3/bin/settings/makeLocalCopiesOfDefaults.bat =================================================================== --- branches/amis3/bin/settings/makeLocalCopiesOfDefaults.bat 2008-03-06 00:12:19 UTC (rev 2394) +++ branches/amis3/bin/settings/makeLocalCopiesOfDefaults.bat 2008-03-07 05:55:29 UTC (rev 2395) @@ -1,4 +1,5 @@ rem this batch file copies two default config files and renames them so they work with amis -copy amisRecentBooks.xml.default amisRecentBooks.xml -copy amisPrefs.xml.default amisPrefs.xml \ No newline at end of file +copy amisRecentBooks.xml.default amisRecentBooks.xml /y +copy amisPrefs.xml.default amisPrefs.xml /y +copy bmk\amisExtraBookmarksInfo.xml.default bmk\amisExtraBookmarksInfo.xml /y \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |