updated for v. 1.0.3

This commit is contained in:
Gerald Schmidt 2010-04-25 22:24:53 +00:00
parent 635f783128
commit 68b60043a3
9 changed files with 272 additions and 200 deletions

View File

@ -165,6 +165,12 @@ void ExportDialog::OnOk ( wxCommandEvent& e )
folder = dirPicker->GetPath();
quiet = quietCheckbox->IsChecked();
mp3Album = mp3AlbumCheckbox->IsChecked();
suppressOptional = suppressOptionalCheckbox->IsChecked();
html = htmlCheckbox->IsChecked();
epub = epubCheckbox->IsChecked();
rtf = rtfCheckbox->IsChecked();
doc = docCheckbox->IsChecked();
fullDaisy = fullDaisyCheckbox->IsChecked();
urlUtf8 = ( const char * ) url.mb_str ( wxConvUTF8 );
e.Skip();
@ -199,13 +205,6 @@ void ExportDialog::OnContextHelp ( wxHelpEvent& e )
void ExportDialog::OnUpdateOk ( wxUpdateUIEvent& e )
{
bool enable = true;
/*
#ifdef __WXMSW__
if ( urlCtrl->GetTextCtrlValue().empty() ||
#else
if ( urlCtrl->GetPath().empty() ||
#endif
*/
if (
dirPicker->GetPath().empty() ||
downloadLink )
@ -233,6 +232,13 @@ bool ExportDialog::getMp3Album()
return mp3Album;
}
bool ExportDialog::getSuppressOptional() { return suppressOptional; }
bool ExportDialog::getHtml() { return html; }
bool ExportDialog::getEpub() { return epub; }
bool ExportDialog::getRtf() { return rtf; }
bool ExportDialog::getDoc() { return doc; }
bool ExportDialog::getFullDaisy() { return fullDaisy; }
void ExportDialog::OnFolderBrowse ( wxCommandEvent& e )
{
}

View File

@ -49,6 +49,13 @@ class ExportDialog : public wxDialog
wxString getFolderString();
bool getQuiet();
bool getMp3Album();
bool getSuppressOptional();
bool getHtml();
bool getEpub();
bool getRtf();
bool getDoc();
bool getFullDaisy();
enum constants
{
ID_URL,

View File

@ -66,6 +66,7 @@ bool WrapDaisy::run (
bool suppressOptional,
bool epub,
bool rtf,
bool doc,
bool fullDaisy,
bool mp3Album )
{
@ -348,6 +349,8 @@ bool WrapDaisy::run (
while (wxTheApp->Pending())
wxTheApp->Dispatch();
if ( epub )
{
if ( !pd->Update ( 50, _T("Preparing ePub...") ) )
{
error = _T ( "Cancelled" );
@ -396,8 +399,11 @@ bool WrapDaisy::run (
if ( !error.empty() )
return false;
}
// #2.9: convert to RTF
if ( rtf || doc )
{
pd->ProcessPendingEvents();
while (wxTheApp->Pending())
wxTheApp->Dispatch();
@ -512,12 +518,16 @@ bool WrapDaisy::run (
//wxCopyFile ( tempDocFile, docFile );
//wxRemoveFile ( tempRtfFile );
//wxRemoveFile ( tempDocFile );
}
// #3: convert to full DAISY book
pd->ProcessPendingEvents();
while (wxTheApp->Pending())
wxTheApp->Dispatch();
if ( !fullDaisy )
return true; // no full DAISY, no audio
if ( !pd->Update ( 70, _T("Preparing DAISY books...") ) )
{
error = _T ( "Cancelled" );
@ -569,6 +579,9 @@ bool WrapDaisy::run (
if ( !error.empty() )
return false;
if ( !mp3Album )
return true;
// #4: create MP3 album
pd->ProcessPendingEvents();
while (wxTheApp->Pending())
@ -651,19 +664,19 @@ bool WrapDaisy::run (
while (wxTheApp->Pending())
wxTheApp->Dispatch();
/*
if ( !pd->Update ( 90, _T("Updating playlists...") ) )
{
error = _T ( "Cancelled" );
return false;
}
/*
//rename mp3 playlists
albumDir += wxFileName::GetPathSeparator();
PlayListRenamer plr;
std::string stdAlbumDir = ( const char *) albumDir.mb_str ( wxConvUTF8 );
plr.run ( stdAlbumDir );
*/
//albumDir += wxFileName::GetPathSeparator();
//PlayListRenamer plr;
//std::string stdAlbumDir = ( const char *) albumDir.mb_str ( wxConvUTF8 );
//plr.run ( stdAlbumDir );
//rename mp3 files in //z3986/
wxFileName fn ( dtbFilePath );
@ -741,6 +754,7 @@ bool WrapDaisy::run (
wxFileName::GetPathSeparator() +
_T("cover.jpg");
wxCopyFile ( albumCover, destAlbumCover, true );
*/
return true;
}

View File

@ -20,6 +20,7 @@ public:
bool suppressOptional,
bool epub,
bool rtf,
bool doc,
bool fullDaisy,
bool mp3Album );
wxString getLastError();

View File

@ -619,10 +619,21 @@ MyFrame::MyFrame (
lastRelaxNGSchema.Replace ( _T ( " " ), _T ( "%20" ), true );
exportQuiet =
config->Read ( _T ( "exportQuiet" ), (long)false );
config->Read ( _T ( "exportQuiet" ), (long)true );
exportMp3Album =
config->Read ( _T ( "exportMp3Album" ), (long)false );
config->Read ( _T ( "exportMp3Album" ), (long)true );
exportSuppressOptional =
config->Read ( _T ( "exportSuppressOptional" ), (long)true );
exportHtml =
config->Read ( _T ( "exportHtml" ), (long)true );
exportEpub =
config->Read ( _T ( "exportEpub" ), (long)true );
exportRtf =
config->Read ( _T ( "exportRtf" ), (long)true );
exportDoc =
config->Read ( _T ( "exportDoc" ), (long)true );
exportFullDaisy =
config->Read ( _T ( "exportFullDaisy" ), (long)true );
applicationDir =
config->Read ( _T ( "applicationDir" ), wxEmptyString );
@ -751,7 +762,8 @@ MyFrame::MyFrame (
exportStylesheet = exportFolder = wxEmptyString;
exportQuiet = exportMp3Album = false;
exportQuiet = exportMp3Album = exportSuppressOptional = exportHtml =
exportEpub = exportRtf = exportDoc = exportFullDaisy = true;
}
largeFileProperties.completion = false;
@ -1020,6 +1032,12 @@ MyFrame::~MyFrame()
config->Write ( _T ( "exportFolder" ), exportFolder );
config->Write ( _T ( "exportQuiet" ), exportQuiet );
config->Write ( _T ( "exportMp3Album" ), exportMp3Album );
config->Write ( _T ( "exportSuppressOptional" ), exportSuppressOptional );
config->Write ( _T ( "exportHtml" ), exportHtml );
config->Write ( _T ( "exportEpub" ), exportEpub );
config->Write ( _T ( "exportRtf" ), exportRtf );
config->Write ( _T ( "exportDoc" ), exportDoc );
config->Write ( _T ( "exportFullDaisy" ), exportFullDaisy );
GetPosition ( &framePosX, &framePosY );
config->Write ( _T ( "framePosX" ), framePosX );
@ -2067,12 +2085,12 @@ void MyFrame::OnExport ( wxCommandEvent& event )
exportStylesheet,
exportFolder,
exportQuiet,
true, //suppressOptional
true, //html
true, //epub
true, //rtf
true, //doc
true, //fullDaisy
exportSuppressOptional,
exportHtml,
exportEpub,
exportRtf,
exportDoc,
exportFullDaisy,
exportMp3Album,
downloadLink ) );
int ret = ed->ShowModal();
@ -2084,6 +2102,12 @@ void MyFrame::OnExport ( wxCommandEvent& event )
exportFolder = ed->getFolderString();
exportQuiet = ed->getQuiet();
exportMp3Album = ed->getMp3Album();
exportSuppressOptional = ed->getSuppressOptional();
exportHtml = ed->getHtml();
exportEpub = ed->getEpub();
exportRtf = ed->getRtf();
exportDoc = ed->getDoc();
exportFullDaisy = ed->getFullDaisy();
std::string rawBufferUtf8;
getRawText ( doc, rawBufferUtf8 );
@ -2104,7 +2128,17 @@ void MyFrame::OnExport ( wxCommandEvent& event )
wxString tempFile= tempFileName.wideName();
WrapDaisy wd ( this, daisyDir, doc->getFullFileName() );
if ( !wd.run ( tempFile, exportStylesheet, exportFolder, exportQuiet, exportMp3Album, true, true, true, true ) )
if ( !wd.run (
tempFile,
exportStylesheet,
exportFolder,
exportQuiet,
exportSuppressOptional,
exportEpub,
exportRtf,
exportDoc,
exportFullDaisy,
exportMp3Album ) )
{
messagePane ( _ ("[b]DAISY export stopped[/b]: ") + wd.getLastError(), CONST_STOP );
return;

View File

@ -444,7 +444,13 @@ class MyFrame : public wxFrame
findRegex,
commandSync,
exportQuiet,
exportMp3Album;
exportMp3Album,
exportSuppressOptional,
exportHtml,
exportEpub,
exportRtf,
exportDoc,
exportFullDaisy;
wxBitmap newBitmap,
new16Bitmap,
openBitmap,

View File

@ -66,9 +66,7 @@
<xsl:template match="Question">
<xsl:if test="count(Heading) = '0'">
<p>
<span class="optional-prodnote">
<strong>Question</strong>
</span>
<span class="optional-prodnote">Question</span>
</p>
</xsl:if>
<xsl:call-template name="apply-templates-lang"/>
@ -76,9 +74,7 @@
<xsl:template match="Answer">
<xsl:if test="count(Heading) = '0'">
<p>
<span class="optional-prodnote">
<strong>Answer</strong>
</span>
<span class="optional-prodnote">Answer</span>
</p>
</xsl:if>
<xsl:call-template name="apply-templates-lang"/>
@ -86,9 +82,7 @@
<xsl:template match="Discussion">
<xsl:if test="count(Heading) = '0'">
<p>
<span class="optional-prodnote">
<strong>Discussion</strong>
</span>
<span class="optional-prodnote">Discussion</span>
</p>
</xsl:if>
<xsl:call-template name="apply-templates-lang"/>

View File

@ -129,14 +129,6 @@
</xsl:template>
<xsl:template
match="InlineChemistry/Description | InlineChemistry/Alternative"/>
<xsl:template match="AuthorComment">
<!-- omit -->
<xsl:apply-templates/>

View File

@ -112,12 +112,19 @@
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:choose>
<xsl:when
test="count(./Description/*) = 0 and string-length(./Description) &lt; 1024">
<xsl:value-of select="./Description"/>
</xsl:when>
<xsl:when test="string-length(./Image/@alt) &gt; 0">
<xsl:value-of select="./Image/@alt"/>
</xsl:when>
<xsl:when test="string-length(Alternative) &gt; 0">
<xsl:value-of select="Alternative"/>
</xsl:when>
<xsl:when test="count(./Description/*) &gt; 0">
<xsl:text>figure description follows</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>no alternative text</xsl:text>
</xsl:otherwise>
@ -133,7 +140,9 @@
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="Caption"/>
<xsl:if test="count(./Description/*) &gt; 0 or string-length(./Description) &gt; 1024">
<xsl:apply-templates select="Description"/>
</xsl:if>
<xsl:apply-templates select="SourceReference"/>
<p>
<span class="optional-prodnote">End of figure</span>
@ -152,12 +161,19 @@
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:choose>
<xsl:when
test="count(./Description/*) = 0 and string-length(./Description) &lt; 1024">
<xsl:value-of select="./Description"/>
</xsl:when>
<xsl:when test="string-length(./Image/@alt) &gt; 0">
<xsl:value-of select="./Image/@alt"/>
</xsl:when>
<xsl:when test="string-length(Alternative) &gt; 0">
<xsl:value-of select="Alternative"/>
</xsl:when>
<xsl:when test="count(./Description/*) &gt; 0">
<xsl:text>equation description follows</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>no alternative text</xsl:text>
</xsl:otherwise>
@ -176,7 +192,9 @@
<xsl:apply-templates select="TeX"/>
<xsl:apply-templates select="MathML"/>
<xsl:apply-templates select="Caption"/>
<xsl:if test="count(./Description/*) &gt; 0 or string-length(./Description) &gt; 1024">
<xsl:apply-templates select="Description"/>
</xsl:if>
<xsl:apply-templates select="SourceReference"/>
<span class="optional-prodnote">End of equation</span>
</xsl:template>
@ -402,9 +420,9 @@
</xsl:template>
<xsl:template match="SideNote">
<hr/>
<span class="optional-prodnote">Side note</span>
<p><span class="optional-prodnote">Side note</span></p>
<xsl:apply-templates/>
<span class="optional-prodnote">End of side note</span>
<p><span class="optional-prodnote">End of side note</span></p>
<hr/>
</xsl:template>
<xsl:template match="footnote">