Updated for 1.2.0.6

This commit is contained in:
Gerald Schmidt 2009-10-04 22:54:47 +00:00
parent ed7abc9dd5
commit 5ff7b1f7ef
14 changed files with 296 additions and 165 deletions

View File

@ -1,5 +1,5 @@
# these are the headers for your project
noinst_HEADERS = $(srcdir)/*.h
noinst_HEADERS = *.h
#########################################################################
# APPLICATION SECTION
@ -8,9 +8,9 @@ noinst_HEADERS = $(srcdir)/*.h
# of the other Makefile.am variables
bin_PROGRAMS = xmlcopyeditor
bindir = ${prefix}/bin
xmlcopyeditordir = ${datarootdir}/xmlcopyeditor
pixmapdir = ${datarootdir}/pixmaps
desktopdir = ${datarootdir}/applications
xmlcopyeditordir = ${prefix}/share/xmlcopyeditor
pixmapdir = /usr/share/pixmaps
applicationsdir = /usr/share/applications
# the application source, library search path, and link libraries
xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
@ -25,55 +25,55 @@ xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
xmlparseschemans.cpp xmlshallowvalidator.cpp wrapxerces.cpp \
findreplacepanel.cpp commandpanel.cpp xercescatalogresolver.cpp \
binaryfile.cpp xmlencodingspy.cpp wrapaspell.cpp validationthread.cpp \
wrapdaisy.cpp exportdialog.cpp mp3album.cpp xmlprodnote.cpp \
rulesets png rng xpm templates copying help po \
xmlcopyeditor.spec xmlcopyeditor.png custom.xpm \
xmlcopyeditor.desktop
# rulesets png rng xpm templates copying help po
xmlcopyeditor_LDFLAGS = $(WX_LIBS) \
-lexpat -lxslt -lxml2 -lpcre -lxerces-c -laspell
-lexpat -lxslt -lxml2 -lpcre -lxerces-c $(ASPELL_LIBS) $(ENCHANT_LIBS)
nobase_xmlcopyeditor_DATA = $(srcdir)/png/*.png\
$(srcdir)/rulesets/*.* \
$(srcdir)/rng/*.rng \
$(srcdir)/rng/*.rnc \
$(srcdir)/rng/exclude/*.rng \
$(srcdir)/rng/modules/*.rng \
$(srcdir)/xpm/*.xpm \
$(srcdir)/templates/*.xml \
$(srcdir)/templates/*.dtd \
$(srcdir)/templates/*.xsl \
$(srcdir)/templates/*.rss \
$(srcdir)/templates/*.html \
$(srcdir)/templates/*.xtm \
$(srcdir)/templates/*.xsd \
$(srcdir)/templates/*.rng \
$(srcdir)/templates/*.lzx \
$(srcdir)/templates/*.xlf \
$(srcdir)/help/*.* $(srcdir)/help/html/*.* \
$(srcdir)/copying/*.txt $(srcdir)/copying/boost_shared_ptr/* \
$(srcdir)/copying/Expat/* $(srcdir)/copying/libxml2/* $(srcdir)/copying/libxslt/* \
$(srcdir)/copying/PCRE/* $(srcdir)/copying/Scintilla/* \
$(srcdir)/copying/wxStyledTextCtrl/* \
$(srcdir)/copying/wxStEditor/* \
$(srcdir)/copying/xmlcopyeditor/* \
$(srcdir)/copying/Aspell/* \
$(srcdir)/copying/Apache/LICENSE-2.0 \
$(srcdir)/copying/Apache/LICENSE-2_files/* \
$(srcdir)/po/sk/messages.mo \
$(srcdir)/po/sv/messages.mo \
$(srcdir)/po/fr/messages.mo \
$(srcdir)/po/de/messages.mo \
$(srcdir)/po/ru/messages.mo \
$(srcdir)/po/es/messages.mo \
$(srcdir)/po/zh_CN/messages.mo \
$(srcdir)/po/zh_TW/messages.mo \
$(srcdir)/po/uk_UA/messages.mo \
$(srcdir)/po/uk_UA/messages.mo \
$(srcdir)/po/en_us/messages.po
nobase_xmlcopyeditor_DATA = png/*.png \
rulesets/*.* \
rng/*.rng \
rng/*.rnc \
rng/exclude/*.rng \
rng/modules/*.rng \
xpm/*.xpm \
templates/*.xml \
templates/*.dtd \
templates/*.xsl \
templates/*.rss \
templates/*.html \
templates/*.xtm \
templates/*.xsd \
templates/*.rng \
templates/*.lzx \
templates/*.xlf \
help/*.* help/html/*.* \
copying/*.txt copying/boost_shared_ptr/* \
copying/Expat/* copying/libxml2/* copying/libxslt/* \
copying/PCRE/* copying/Scintilla/* \
copying/wxStyledTextCtrl/* \
copying/wxStEditor/* \
copying/xmlcopyeditor/* \
copying/Aspell/* \
copying/Apache/LICENSE-2.0 \
copying/Apache/LICENSE-2_files/* \
po/sk/messages.mo \
po/sv/messages.mo \
po/fr/messages.mo \
po/de/messages.mo \
po/ru/messages.mo \
po/es/messages.mo \
po/zh_CN/messages.mo \
po/zh_TW/messages.mo \
po/uk_UA/messages.mo \
po/uk_UA/messages.mo \
po/en_us/messages.po
pixmap_DATA = xmlcopyeditor.png
desktop_DATA = xmlcopyeditor.desktop
applications_DATA = xmlcopyeditor.desktop
INCLUDES = -I/usr/include/libxml2
INCLUDES = -I/usr/include/libxml2 $(ENCHANT_CFLAGS)

View File

@ -20,11 +20,6 @@
#include "myhtmlpane.h"
#include "xmlcopyeditor.h"
#include <string>
#include <sstream>
#include <iostream>
BEGIN_EVENT_TABLE ( MyHtmlPane, wxHtmlWindow )
EVT_LEFT_DCLICK ( MyHtmlPane::OnLeftDoubleClick )
END_EVENT_TABLE()
@ -57,32 +52,4 @@ void MyHtmlPane::OnCellClicked(
*/
void MyHtmlPane::OnLeftDoubleClick ( wxMouseEvent& WXUNUSED ( event ) )
{
}
bool MyHtmlPane::OnCellClicked(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& event)
{
//since the error description was hardcoded, make use of this error string
//parse the get the line number, then jump to that line
if(error_message.find("Validation stopped at line") != -1 ||
error_message.find("Error at line")!= -1){
string substring = error_message.substr(error_message.find("at line ")+8);
string number = substring.substr(0,substring.find(", "));
istringstream iss(substring);
int line ;
iss >> line;
if (--line >= 0 && (doc))
{
doc->GotoLine ( ( int ) line );
doc->SetFocus();
}
return true;
}
return false;
}
void MyHtmlPane::SetCurrentDocument(XmlDoc *xdoc)
{
doc = xdoc;
}
{ }

View File

@ -19,23 +19,18 @@
#ifndef MY_HTML_PANE_H
#define MY_HTML_PANE_H
#include "xmldoc.h"
#include <wx/wx.h>
#include <wx/wxhtml.h>
class MyHtmlPane : public wxHtmlWindow
{
public:
std::string error_message;
MyHtmlPane (
wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& position = wxDefaultPosition,
const wxSize& size = wxDefaultSize );
void SetCurrentDocument(XmlDoc *xdoc);
private:
/*
void OnCellClicked(
@ -44,9 +39,7 @@ class MyHtmlPane : public wxHtmlWindow
wxCoord y,
const wxMouseEvent& event);
*/
XmlDoc *doc;
void OnLeftDoubleClick ( wxMouseEvent& event );
bool OnCellClicked(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& event);
DECLARE_EVENT_TABLE()
};

View File

@ -188,6 +188,7 @@ MyPropertySheet::MyPropertySheet (
languageBox->Insert ( _T ( "Chinese Simplified" ), INDEX_CHINESE_SIMPLIFIED );
languageBox->Insert ( _T ( "Chinese Traditional" ), INDEX_CHINESE_TRADITIONAL );
languageBox->Insert ( _T ( "Dutch" ), INDEX_DUTCH );
languageBox->Insert ( _T ( "English (US)" ), INDEX_ENGLISH_US );
languageBox->Insert ( _T ( "French" ), INDEX_FRENCH );
languageBox->Insert ( _T ( "German" ), INDEX_GERMAN );
@ -203,6 +204,9 @@ MyPropertySheet::MyPropertySheet (
case wxLANGUAGE_GERMAN:
languageBox->SetSelection ( INDEX_GERMAN );
break;
case wxLANGUAGE_DUTCH:
languageBox->SetSelection ( INDEX_DUTCH );
break;
case wxLANGUAGE_FRENCH:
languageBox->SetSelection ( INDEX_FRENCH );
break;
@ -337,7 +341,10 @@ void MyPropertySheet::OnOk ( wxCommandEvent& e )
int languageChoice = languageBox->GetSelection();
switch ( languageChoice )
{
case INDEX_ITALIAN:
case INDEX_DUTCH:
lang = wxLANGUAGE_DUTCH;
break;
case INDEX_ITALIAN:
lang = wxLANGUAGE_ITALIAN;
break;
case INDEX_GERMAN:

View File

@ -36,6 +36,7 @@ enum langIndex
{
INDEX_CHINESE_SIMPLIFIED = 0,
INDEX_CHINESE_TRADITIONAL,
INDEX_DUTCH,
INDEX_ENGLISH_US,
INDEX_FRENCH,
INDEX_GERMAN,

View File

@ -18,15 +18,18 @@
*/
#include <wx/intl.h>
#include "aspell.h"
#ifdef USE_ENCHANT
# include <enchant.h>
#else
# include "aspell.h"
# ifdef __WXMSW__
# include "aspellpaths.h"
# endif
#endif
#include "styledialog.h"
#include "nocasecompare.h"
#define ngettext wxGetTranslation
#ifdef __WXMSW__
#include "aspellpaths.h"
#endif
BEGIN_EVENT_TABLE ( StyleDialog, wxDialog )
EVT_BUTTON ( ID_STYLE_REPORT, StyleDialog::OnReport )
EVT_BUTTON ( ID_STYLE_IGNORE_ALL, StyleDialog::OnStyleIgnoreAll )
@ -47,6 +50,38 @@ BEGIN_EVENT_TABLE ( StyleDialog, wxDialog )
EVT_UPDATE_UI_RANGE ( ID_STYLE_EDIT, ID_STYLE_CHANGE_ALL, StyleDialog::OnUpdateTableRange )
END_EVENT_TABLE()
#ifdef USE_ENCHANT
class dictdetect
{
public:
dictdetect(wxComboBox *aCombo) : ruleSetCombo(aCombo), anyFound(false) {}
void add(const char *lang_tag);
bool empty() const { return !anyFound; }
private:
wxComboBox *ruleSetCombo;
bool anyFound;
};
void dictdetect::add(const char *lang_tag)
{
anyFound = true;
std::string stdEntry = lang_tag;
wxString entry = wxString ( stdEntry.c_str(), wxConvUTF8, stdEntry.size() );
ruleSetCombo->Append ( entry );
}
void EnchantDictDescribe(const char * const lang_tag,
const char * const provider_name,
const char * const provider_desc,
const char * const provider_file,
void * user_data)
{
dictdetect *detected = (dictdetect*)user_data;
detected->add(lang_tag);
}
#endif
StyleDialog::StyleDialog (
wxWindow *parent,
wxIcon icon,
@ -57,7 +92,7 @@ StyleDialog::StyleDialog (
const wxString& browserParameter,
const wxString& ruleSetPresetParameter,
const wxString& filterPresetParameter,
#ifdef __WXMSW__
#if !defined(USE_ENCHANT) && defined(__WXMSW__)
const std::string& aspellDataPathParameter,
const std::string& aspellDictPathParameter,
#endif
@ -79,7 +114,7 @@ StyleDialog::StyleDialog (
browser ( browserParameter ),
ruleSetPreset ( ruleSetPresetParameter ),
filterPreset ( filterPresetParameter ),
#ifdef __WXMSW__
#if !defined(USE_ENCHANT) && defined(__WXMSW__)
aspellDataPath ( aspellDataPathParameter ),
aspellDictPath ( aspellDictPathParameter ),
#endif
@ -235,6 +270,12 @@ StyleDialog::StyleDialog (
// special case spellcheck
if (type == ID_TYPE_SPELL)
{
#ifdef USE_ENCHANT
EnchantBroker *broker = enchant_broker_init();
dictdetect adetected(ruleSetCombo);
enchant_broker_list_dicts(broker, EnchantDictDescribe, &adetected);
bool anyFound = !adetected.empty();
#else
AspellConfig *config;
AspellDictInfoList *dlist;
AspellDictInfoEnumeration *dels;
@ -243,10 +284,10 @@ StyleDialog::StyleDialog (
config = new_aspell_config();
#ifdef __WXMSW__
aspell_config_replace ( config, "data-dir", aspellDataPath.c_str() ); //ASPELL_DATA_PATH );
aspell_config_replace ( config, "dict-dir", aspellDictPath.c_str() ); //ASPELL_DICT_PATH );
aspell_config_replace ( config, "data-dir", aspellDataPath.c_str() ); //ASPELL_DATA_PATH );
aspell_config_replace ( config, "dict-dir", aspellDictPath.c_str() ); //ASPELL_DICT_PATH );
#endif
dlist = get_aspell_dict_info_list( config );
dlist = get_aspell_dict_info_list( config );
delete_aspell_config ( config );
@ -260,6 +301,7 @@ StyleDialog::StyleDialog (
wxString entry = wxString ( stdEntry.c_str(), wxConvUTF8, stdEntry.size() );
ruleSetCombo->Append ( entry );
}
#endif
if ( anyFound )
{

View File

@ -20,7 +20,9 @@
#include <iostream>
#include <stdexcept>
#include "wrapaspell.h"
#include "aspell.h"
#ifdef USE_ENCHANT
#include <enchant++.h>
#endif
#include "casehandler.h"
#include "contexthandler.h"
#include "getword.h"
@ -31,13 +33,17 @@
WrapAspell::WrapAspell (
std::string lang
#ifdef __WXMSW__
#if !defined(USE_ENCHANT) && defined(__WXMSW__)
,
const std::string& aspellDataPathParameter,
const std::string& aspellDictPathParameter
#endif
)
{
#ifdef USE_ENCHANT
spell_broker = enchant::Broker::instance();
spell_checker = spell_broker->request_dict( lang );
#else
spell_config = new_aspell_config();
#ifdef __WXMSW__
@ -55,26 +61,41 @@ WrapAspell::WrapAspell (
}
else
spell_checker = to_aspell_speller ( possible_err );
#endif
}
WrapAspell::~WrapAspell()
{
#ifdef USE_ENCHANT
delete spell_checker;
#else
delete_aspell_speller ( spell_checker );
delete_aspell_config ( spell_config );
#endif
}
bool WrapAspell::checkWord ( std::string &s )
bool WrapAspell::checkWord ( const std::string &s )
{
#ifdef USE_ENCHANT
return spell_checker->check(s);
#else
return checkWord ( (char *) s.c_str(), s.size() );
#endif
}
std::string WrapAspell::getSuggestion (
std::string &s )
{
#ifdef USE_ENCHANT
std::vector<std::string> out_suggestions;
spell_checker->suggest(s, out_suggestions);
return out_suggestions.empty() ? "----" : out_suggestions[0];
#else
const AspellWordList *suggestions = aspell_speller_suggest ( spell_checker, s.c_str(), s.size() );
AspellStringEnumeration *elements = aspell_word_list_elements ( suggestions );
const char *word = aspell_string_enumeration_next ( elements ); // no iteration req'd
return (word) ? word : "----";
#endif
}
void WrapAspell::checkString (
@ -104,7 +125,11 @@ void WrapAspell::checkString (
}
}
bool WrapAspell::checkWord ( char *s, size_t len )
bool WrapAspell::checkWord ( const char *s, size_t len )
{
#ifdef USE_ENCHANT
return checkWord( std::string(s, len) );
#else
return aspell_speller_check ( spell_checker, s, len );
#endif
}

View File

@ -23,20 +23,28 @@
#include <string>
#include <vector>
#include "contexthandler.h"
#if !defined(USE_ENCHANT)
#include "aspell.h"
#else
namespace enchant
{
class Broker;
class Dict;
}
#endif
class WrapAspell
{
public:
WrapAspell (
std::string lang// = "en_US",
#ifdef __WXMSW__
#if !defined(USE_ENCHANT) && defined(__WXMSW__)
, const std::string& aspellDataPathParameter,
const std::string& aspellDictPath
#endif
);
~WrapAspell();
inline bool checkWord ( std::string &s );
inline bool checkWord ( const std::string &s );
void checkString (
std::string &s,
std::vector<ContextMatch> &v,
@ -44,8 +52,13 @@ class WrapAspell
std::string getSuggestion ( std::string &s );
std::string getVersion();
private:
#ifdef USE_ENCHANT
enchant::Broker *spell_broker;
enchant::Dict *spell_checker;
#else
AspellConfig *spell_config;
AspellSpeller *spell_checker;
bool checkWord ( char *s, size_t len );
#endif
bool checkWord ( const char *s, size_t len );
};
#endif

View File

@ -339,6 +339,7 @@ bool WrapLibxml::xslt (
cur = xsltParseStylesheetFile ( ( const xmlChar * ) styleFileName.c_str() );
if ( !cur )
{
nonParserError = "Cannot parse stylesheet";
return false;
}
@ -346,6 +347,7 @@ bool WrapLibxml::xslt (
doc = xmlParseFile ( fileName.c_str() );
if ( !doc )
{
nonParserError = "Cannot parse file";
xsltFreeStylesheet ( cur );
return false;
}
@ -361,6 +363,7 @@ bool WrapLibxml::xslt (
res = xsltApplyStylesheet ( cur, doc, NULL );
if ( !res )
{
nonParserError = "Cannot apply stylesheet";
xmlFreeDoc ( doc );
xsltFreeStylesheet ( cur );
return false;
@ -493,7 +496,9 @@ std::string WrapLibxml::getLastError()
xmlErrorPtr err = xmlGetLastError();
if ( !err )
return "";
{
return ( nonParserError.empty() ) ? "" : nonParserError;
}
std::stringstream ss;
ss << "Error at line ";

View File

@ -70,7 +70,7 @@ class WrapLibxml
std::string lookupPublicId ( const std::string& id );
private:
bool netAccess;
std::string catalogPath, output;
std::string catalogPath, output, nonParserError;
int errorLine;
void loadCatalog();
};

View File

@ -37,6 +37,7 @@ XmlAssociateXsd::XmlAssociateXsd (
d->rootElementSeen = false;
XML_SetElementHandler ( p, start, end );
XML_SetDefaultHandlerExpand ( p, defaulthandler );
XML_SetUserData ( p, d.get() );
std::auto_ptr<XmlParseSchemaNs> parser ( new XmlParseSchemaNs() );
std::string normalisedPath, buffer;
@ -66,7 +67,6 @@ XmlAssociateXsd::XmlAssociateXsd (
}
}
d->namespaceMap = namespaceMap;
XML_SetUserData ( p, d.get() );
}
XmlAssociateXsd::~XmlAssociateXsd()
@ -77,18 +77,24 @@ void XMLCALL XmlAssociateXsd::defaulthandler (
const XML_Char *s,
int len )
{
if ( !data || !s )
return;
AssociateXsdData *d;
d = ( AssociateXsdData * ) data;
d->buffer.append ( s, len );
if ( d )
d->buffer.append ( s, len );
}
void XMLCALL XmlAssociateXsd::start ( void *data,
const XML_Char *el,
const XML_Char **attr )
{
if ( !data )
return;
AssociateXsdData *d;
d = ( AssociateXsdData * ) data;
d->buffer += "<";
d->buffer += el;
@ -141,6 +147,8 @@ void XMLCALL XmlAssociateXsd::start ( void *data,
void XMLCALL XmlAssociateXsd::end ( void *data, const XML_Char *el )
{
if ( !data )
return;
AssociateXsdData *d;
d = ( AssociateXsdData * ) data;
d->buffer += "</";

View File

@ -40,6 +40,7 @@
#include "xmlassociatexsd.h"
#include "xmlassociatexsl.h"
#include "xmlassociatedtd.h"
#include "wrapdaisy.h"
#include "aboutdialog.h"
#include "pathresolver.h"
#include "locationpanel.h"
@ -49,6 +50,7 @@
#include "getlinuxappdir.h"
#include "commandpanel.h"
#include "binaryfile.h"
#include "exportdialog.h"
#include <wx/aui/auibook.h>
#include <wx/richtext/richtextsymboldlg.h>
#include <wx/textctrl.h>
@ -103,6 +105,7 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame )
EVT_MENU ( ID_WORD_COUNT, MyFrame::OnWordCount )
EVT_MENU ( ID_IMPORT_MSWORD, MyFrame::OnImportMSWord )
EVT_MENU ( ID_EXPORT_MSWORD, MyFrame::OnExportMSWord )
EVT_MENU ( ID_EXPORT, MyFrame::OnExport )
EVT_MENU ( ID_HIDE_PANE, MyFrame::OnClosePane )
EVT_MENU ( ID_COMMAND, MyFrame::OnCommand )
EVT_MENU ( ID_FIND, MyFrame::OnFind )
@ -174,7 +177,6 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame )
EVT_UPDATE_UI ( ID_RELOAD, MyFrame::OnUpdateReload )
EVT_IDLE ( MyFrame::OnIdle )
EVT_AUINOTEBOOK_PAGE_CLOSE ( wxID_ANY, MyFrame::OnPageClosing )
EVT_AUI_PANE_CLOSE ( MyFrame::OnPaneClose )
#ifdef __WXMSW__
EVT_DROP_FILES ( MyFrame::OnDropFiles )
#endif
@ -254,6 +256,9 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
case wxLANGUAGE_RUSSIAN:
systemLocale = wxLANGUAGE_RUSSIAN;
break;
case wxLANGUAGE_DUTCH:
systemLocale = wxLANGUAGE_DUTCH;
break;
default:
systemLocale = wxLANGUAGE_ENGLISH_US;
break;
@ -609,6 +614,12 @@ MyFrame::MyFrame (
lastXslStylesheet.Replace ( _T ( " " ), _T ( "%20" ), true );
lastRelaxNGSchema.Replace ( _T ( " " ), _T ( "%20" ), true );
exportQuiet =
config->Read ( _T ( "exportQuiet" ), (long)false );
exportMp3Album =
config->Read ( _T ( "exportMp3Album" ), (long)false );
applicationDir =
config->Read ( _T ( "applicationDir" ), wxEmptyString );
@ -648,6 +659,9 @@ MyFrame::MyFrame (
commandSync = config->Read ( _T ( "commandSync" ), longFalse );
commandOutput = config->Read ( _T ( "commandOutput" ), ID_COMMAND_OUTPUT_IGNORE );
commandString = config->Read ( _T ( "commandString" ), wxEmptyString );
exportStylesheet = config->Read ( _T ( "exportStylesheet" ), wxEmptyString );
exportFolder = config->Read ( _T ( "exportFolder" ), wxEmptyString );
ruleSetPreset =
config->Read ( _T ( "ruleSetPreset" ), _ ( "Default style" ) );
@ -731,6 +745,9 @@ MyFrame::MyFrame (
commandSync = false;
commandOutput = ID_COMMAND_OUTPUT_IGNORE;
commandString = wxEmptyString;
exportStylesheet = exportFolder = wxEmptyString;
exportQuiet = exportMp3Album = false;
}
@ -891,7 +908,7 @@ MyFrame::MyFrame (
manager.AddPane (
( wxWindow * ) findReplacePanel,
wxAuiPaneInfo().Bottom().Hide().Caption ( wxEmptyString ).
Name( _T ( "FindReplacePanel" ) ).DestroyOnClose ( false ).Layer ( 2 ) );
DestroyOnClose ( false ).Layer ( 2 ) );
#endif
commandPanel = new CommandPanel (
@ -983,7 +1000,6 @@ MyFrame::~MyFrame()
config->Write ( _T ( "protectTags" ), protectTags );
config->Write ( _T ( "visibilityState" ), visibilityState );
config->Write ( _T ( "browserCommand" ), browserCommand );
// config->Write ( _T ( "layout" ), layout ); // omit while unused
config->Write ( _T ( "showLocationPane" ), manager.GetPane ( locationPanel ).IsShown() );
config->Write ( _T ( "showInsertChildPane" ), manager.GetPane ( insertChildPanel ).IsShown() );
config->Write ( _T ( "showInsertSiblingPane" ), manager.GetPane ( insertSiblingPanel ).IsShown() );
@ -994,12 +1010,13 @@ MyFrame::~MyFrame()
config->Write ( _T ( "commandSync" ), commandPanel->getSync() );
config->Write ( _T ( "commandOutput" ), commandPanel->getOutput() );
config->Write ( _T ( "commandString" ), commandPanel->getCommand() );
config->Write ( _T ( "restoreLayout" ), restoreLayout );
config->Write ( _T ( "lastXslStylesheet" ), lastXslStylesheet );
config->Write ( _T ( "lastRelaxNGSchema" ), lastRelaxNGSchema );
config->Write ( _T ( "exportStylesheet" ), exportStylesheet );
config->Write ( _T ( "exportFolder" ), exportFolder );
config->Write ( _T ( "exportQuiet" ), exportQuiet );
config->Write ( _T ( "exportMp3Album" ), exportMp3Album );
GetPosition ( &framePosX, &framePosY );
config->Write ( _T ( "framePosX" ), framePosX );
@ -1018,6 +1035,7 @@ MyFrame::~MyFrame()
config->Write ( _T ( "saveBom" ), saveBom );
config->Write ( _T ( "unlimitedUndo" ), unlimitedUndo );
manager.UnInit();
wxTheClipboard->Flush();
}
wxString MyFrame::getLinuxBrowser()
@ -1220,6 +1238,7 @@ void MyFrame::OnAbout ( wxCommandEvent& WXUNUSED ( event ) )
info.AddTranslator ( _ ( "Antonio Angelo (Italian) <aangelo at users.sourceforge.net>" ) );
info.AddTranslator ( _ ( "Siarhei Kuchuk (Russian) <Cuchuk.Sergey at gmail.com>" ) );
info.AddTranslator ( _ ( "Marcos Pérez González (Spanish) <marcos_pg at yahoo.com>" ) );
info.AddTranslator ( _ ( "Rob Elemans (Dutch) <relemans at gmail.com>" ) );
info.SetLicense ( ABOUT_LICENSE );
info.SetDescription ( description );
wxAboutBox ( info );
@ -2015,11 +2034,6 @@ void MyFrame::OnImportMSWord ( wxCommandEvent& event )
_T ( "" ),
_T ( "Microsoft Word (*.doc)|*.doc" ),
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR
/*
#ifdef __WXMSW__
| wxHIDE_READONLY
#endif
*/
) );
if ( fd->ShowModal() == wxID_CANCEL )
return;
@ -2032,6 +2046,67 @@ void MyFrame::OnImportMSWord ( wxCommandEvent& event )
importMSWord ( path );
}
void MyFrame::OnExport ( wxCommandEvent& event )
{
statusProgress ( wxEmptyString );
closePane();
XmlDoc *doc;
if ( ( doc = getActiveDocument() ) == NULL )
return;
wxString testDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "daisy" );
bool downloadLink = !wxDirExists ( testDir );
std::auto_ptr<ExportDialog> ed ( new ExportDialog (
this,
exportStylesheet,
exportFolder,
exportQuiet,
true, //suppressOptional
true, //epub
true, //rtf
true, //doc
true, //fullDaisy
exportMp3Album,
downloadLink ) );
int ret = ed->ShowModal();
if ( ret == wxID_CANCEL )
return;
exportStylesheet = ed->getUrlString();
exportFolder = ed->getFolderString();
exportQuiet = ed->getQuiet();
exportMp3Album = ed->getMp3Album();
std::string rawBufferUtf8;
getRawText ( doc, rawBufferUtf8 );
if ( !XmlEncodingHandler::setUtf8 ( rawBufferUtf8 ) )
{
encodingMessage();
return;
}
WrapTempFileName tempFileName ( doc->getFullFileName() );
ofstream rawBufferStream ( tempFileName.name().c_str() );
if ( !rawBufferStream )
return;
rawBufferStream << rawBufferUtf8;
rawBufferStream.close();
wxString tempFile= tempFileName.wideName();
WrapDaisy wd ( daisyDir );
if ( !wd.run ( tempFile, exportStylesheet, exportFolder, exportQuiet, exportMp3Album, true, true, true, true ) )
{
messagePane ( _ ("DAISY Talking Book export stopped: ") + wd.getLastError(), CONST_STOP );
return;
}
messagePane ( _ ( "DAISY Talking Book export completed. Output files are stored in " ) + exportFolder + _T ( "." ), CONST_INFO );
}
void MyFrame::importMSWord ( const wxString& path )
{
#ifndef __WXMSW__
@ -2254,6 +2329,7 @@ void MyFrame::OnHelp ( wxCommandEvent& event )
void MyFrame::OnSplitTab ( wxCommandEvent& event )
{
/*
int id = event.GetId();
XmlDoc *doc = getActiveDocument();
if ( !doc )
@ -2262,7 +2338,6 @@ void MyFrame::OnSplitTab ( wxCommandEvent& event )
// mainBook->GetSelection() is currently unreliable, so fetch by title
/*
int pageCount = mainBook->GetPageCount();
XmlDoc *currentDoc;
int currentSelection = -1;
@ -2282,6 +2357,7 @@ void MyFrame::OnSplitTab ( wxCommandEvent& event )
int currentSelection, direction;
currentSelection = mainBook->GetSelection();
direction = wxAUI_NB_RIGHT;
/*
switch ( id )
{
ID_SPLIT_TAB_TOP:
@ -2300,6 +2376,7 @@ void MyFrame::OnSplitTab ( wxCommandEvent& event )
direction = wxAUI_NB_RIGHT;
break;
}
*/
mainBook->Split ( currentSelection, direction );
}
@ -2609,7 +2686,6 @@ void MyFrame::OnGlobalReplace ( wxCommandEvent& event )
void MyFrame::OnFrameClose ( wxCloseEvent& event )
{
std::cout<<"MyFrame::OnFrameClose\n";
wxCommandEvent e;
OnCloseAll ( e );
if ( mainBook->GetPageCount() )
@ -5288,6 +5364,9 @@ void MyFrame::updateFileMenu ( bool deleteExisting )
wxMenuItem *saveAsItem =
new wxMenuItem ( NULL, wxID_SAVEAS, _ ( "S&ave As...\tF12" ), _ ( "Save As..." ) );
saveAsItem->SetBitmap ( wxNullBitmap );
wxMenuItem *exportItem =
new wxMenuItem ( NULL, ID_EXPORT, _ ( "Export &DAISY Talking Book..." ), _ ( "Export DAISY Talking Book..." ) );
exportItem->SetBitmap ( wxNullBitmap );
wxMenuItem *reloadItem =
new wxMenuItem ( NULL, ID_RELOAD, _ ( "&Reload" ), _ ( "Reload" ) );
reloadItem->SetBitmap ( wxNullBitmap );
@ -5309,7 +5388,7 @@ void MyFrame::updateFileMenu ( bool deleteExisting )
importMSWordItem->SetBitmap ( wxNullBitmap );
wxMenuItem *exportMSWordItem =
new wxMenuItem (
NULL, ID_EXPORT_MSWORD, _ ( "&Export Microsoft Word Document..." ) );
NULL, ID_EXPORT_MSWORD, _ ( "Expor&t Microsoft Word Document..." ) );
exportMSWordItem->SetBitmap ( wxNullBitmap );
wxMenuItem *exitItem =
@ -5324,15 +5403,16 @@ void MyFrame::updateFileMenu ( bool deleteExisting )
fileMenu->Append ( closeAllItem );
fileMenu->Append ( saveItem );
fileMenu->Append ( saveAsItem );
fileMenu->AppendSeparator();
fileMenu->AppendSeparator();
fileMenu->Append ( reloadItem );
fileMenu->Append ( revertItem );
fileMenu->AppendSeparator();
fileMenu->Append ( printSetupItem );
fileMenu->Append ( printPreviewItem );
fileMenu->Append ( printItem );
#ifdef __WXMSW__
fileMenu->AppendSeparator();
fileMenu->Append ( exportItem );
#ifdef __WXMSW__
fileMenu->Append ( importMSWordItem );
fileMenu->Append ( exportMSWordItem );
#endif
@ -5452,14 +5532,14 @@ void MyFrame::messagePane ( const wxString& s, int iconType, bool forcePane )
switch ( iconType )
{
case ( CONST_INFO ) :
/*
if ( !forcePane && s.Length() < 50 ) // magic no. necessary?
{
statusProgress ( s );
return;
}
*/
paneTitle = _ ( "Information" );
/*
if ( !forcePane && s.Length() < 50 ) // magic no. necessary?
{
statusProgress ( s );
return;
}
*/
paneTitle = _ ( "Information" );
break;
case ( CONST_WARNING ) :
paneTitle = _ ( "Warning" );
@ -5477,7 +5557,7 @@ void MyFrame::messagePane ( const wxString& s, int iconType, bool forcePane )
wxAuiPaneInfo info = manager.GetPane ( htmlReport );
if ( !info.IsShown() )
{
{
manager.GetPane ( htmlReport ).Show ( true );
manager.Update();
}
@ -5494,19 +5574,19 @@ void MyFrame::messagePane ( const wxString& s, int iconType, bool forcePane )
switch ( iconType )
{
case ( CONST_INFO ) :
htmlBuffer += pngDir;
htmlBuffer += pngDir;
htmlBuffer += _T ( "stock_dialog-info-32.png" );
break;
case ( CONST_WARNING ) :
htmlBuffer += pngDir;
htmlBuffer += pngDir;
htmlBuffer += _T ( "stock_dialog-warning-32.png" );
break;
case ( CONST_STOP ) :
htmlBuffer += pngDir;
htmlBuffer += pngDir;
htmlBuffer += _T ( "stock_dialog-stop-32.png" );
break;
case ( CONST_QUESTION ) :
htmlBuffer += pngDir;
htmlBuffer += pngDir;
htmlBuffer += _T ( "stock_dialog-question-32.png" );
break;
default:
@ -5517,8 +5597,7 @@ void MyFrame::messagePane ( const wxString& s, int iconType, bool forcePane )
htmlBuffer += _T ( "</td></tr></table></body></html>" );
htmlReport->SetPage ( htmlBuffer );
htmlReport->error_message = htmlString.mb_str(wxConvUTF8);
htmlReport->SetCurrentDocument(getActiveDocument());
manager.Update();
}
@ -5635,6 +5714,8 @@ void MyFrame::updatePaths()
wxFileName::GetPathSeparator();
pngDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "png" ) +
wxFileName::GetPathSeparator();
daisyDir = applicationDir + wxFileName::GetPathSeparator() + _T ( "daisy" ) +
wxFileName::GetPathSeparator();
wxString wideCatalogPath =
applicationDir + wxFileName::GetPathSeparator() + _T ( "catalog" ) +
wxFileName::GetPathSeparator() + _T ( "catalog" );
@ -5863,8 +5944,6 @@ void MyFrame::getRawText ( XmlDoc *doc, std::string& buffer )
buffer = "";
return;
}
//wxString wideBuffer = doc->GetText();
//buffer = wideBuffer.mb_str(wxConvUTF8);
buffer = doc->myGetTextRaw();
}
@ -6046,17 +6125,3 @@ void MyFrame::addToFileQueue ( wxString& fileName )
{
fileQueue.push_back ( fileName );
}
void MyFrame::OnPaneClose ( wxAuiManagerEvent& event )
{
wxAuiPaneInfo* closedPane=event.GetPane();
if (closedPane->name== _T ( "FindReplacePanel" ) )
{
// Find pane was closed - set focus back to document pane
XmlDoc *doc;
if ( ( doc = getActiveDocument() ) == NULL )
return;
doc->SetFocus();
}
}

View File

@ -157,6 +157,7 @@ enum
ID_VALIDATE_PRESET7,
ID_VALIDATE_PRESET8,
ID_VALIDATE_PRESET9,
ID_EXPORT,
ID_EXPORT_MSWORD,
// icon constants
CONST_WARNING,
@ -234,6 +235,7 @@ class MyFrame : public wxFrame
void OnFontMedium ( wxCommandEvent& event );
void OnFontLarger ( wxCommandEvent& event );
void OnImportMSWord ( wxCommandEvent& event );
void OnExport ( wxCommandEvent& event );
void OnInsertChild ( wxCommandEvent& event );
void OnInsertSibling ( wxCommandEvent& event );
void OnInsertTwin ( wxCommandEvent& event );
@ -398,6 +400,7 @@ class MyFrame : public wxFrame
rngDir,
htmlDir,
pngDir,
daisyDir,
xpathExpression,
lastDtdPublic,
lastDtdSystem,
@ -413,7 +416,9 @@ class MyFrame : public wxFrame
defaultLayout,
lastParent,
lastGrandparent,
commandString;
commandString,
exportStylesheet,
exportFolder;
bool globalReplaceAllDocuments,
toolbarVisible,
protectTags,
@ -437,7 +442,9 @@ class MyFrame : public wxFrame
restoreFocusToNotebook,
showFullPathOnFrame,
findRegex,
commandSync;
commandSync,
exportQuiet,
exportMp3Album;
wxBitmap newBitmap,
new16Bitmap,
openBitmap,
@ -507,7 +514,6 @@ class MyFrame : public wxFrame
bool ignoreEncoding = false,
bool isXml = true );
void removeUtf8Bom ( std::string& buffer );
void OnPaneClose ( wxAuiManagerEvent& event );
std::string getAuxPath ( const std::string& fileName );
wxMenuBar *getMenuBar();
wxToolBar *getToolBar();
@ -516,4 +522,3 @@ class MyFrame : public wxFrame
};
#endif

View File

@ -25,7 +25,7 @@
#endif
#define ABOUT_COPYRIGHT _("Copyright © 2005-2009 Gerald Schmidt <gnschmidt@users.sourceforge.net>")
#define ABOUT_DESCRIPTION _("\nXML Copy Editor is free software released under the GNU\nGeneral Public License.\n\nMany thanks are due to Tim van Niekerk, Matt Smigielski,\nDavid Scholl, Jan Merka, Marcus Bingenheimer, Roberto\nRosselli Del Turco, Ken Zalewski, C.J. Meidlinger,\nThomas Zajic, Viliam Búr, David Håsäther, François\nBadier, Thomas Wenzel, Roger Sperberg, SHiNE CsyFeK,\nHSU PICHAN, YANG SHUFUN, CHENG PAULIAN,\nCHUANG KUO-PING, Justin Dearing, Serhij Dubyk,\nAntonio Angelo, Jose Luis Rivero, Siarhei Kuchuk,\nIan Abbott, Kev James, Marcos Pérez González\nand Anh Trinh.")
#define ABOUT_DESCRIPTION _("\nXML Copy Editor is free software released under the GNU\nGeneral Public License.\n\nMany thanks are due to Tim van Niekerk, Matt Smigielski,\nDavid Scholl, Jan Merka, Marcus Bingenheimer, Roberto\nRosselli Del Turco, Ken Zalewski, C.J. Meidlinger,\nThomas Zajic, Viliam Búr, David Håsäther, François\nBadier, Thomas Wenzel, Roger Sperberg, SHiNE CsyFeK,\nHSU PICHAN, YANG SHUFUN, CHENG PAULIAN,\nCHUANG KUO-PING, Justin Dearing, Serhij Dubyk,\nAntonio Angelo, Jose Luis Rivero, Siarhei Kuchuk,\nIan Abbott, Kev James, Marcos Pérez González, Anh\nTrinh and Rob Elemans.")
#define ABOUT_LICENSE _T(\
"This program is free software; you can redistribute it\n"\
"and/or modify it under the terms of the GNU General Public\n"\
@ -41,5 +41,5 @@
"License along with this program; if not, write to the Free\n"\
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\
"Boston, MA 02111-1307 USA.")
#define ABOUT_VERSION _T("1.2.0.4")
#define ABOUT_VERSION _T("1.2.0.6")
#define XMLCE_VAR _T("XMLCE_VAR")