[Amis-vcs] SF.net SVN: amis: [2422] branches/amis3
Brought to you by:
julienq,
marisademeglio
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. |