Updated for 1.2.0.3
This commit is contained in:
parent
5601d58552
commit
0d77b3b0c7
|
@ -18,13 +18,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "wraplibxml.h"
|
|
||||||
#include "catalogresolver.h"
|
#include "catalogresolver.h"
|
||||||
|
|
||||||
std::string CatalogResolver::lookupPublicId (
|
CatalogResolver::CatalogResolver( const std::string& catalogPath )
|
||||||
const std::string& publicId,
|
|
||||||
const std::string& catalogPath )
|
|
||||||
{
|
{
|
||||||
std::auto_ptr<WrapLibxml> libxml ( new WrapLibxml ( false, catalogPath ) );
|
wl = new WrapLibxml ( false, catalogPath );
|
||||||
return libxml->lookupPublicId ( publicId );
|
}
|
||||||
|
|
||||||
|
CatalogResolver::~CatalogResolver()
|
||||||
|
{
|
||||||
|
delete wl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CatalogResolver::lookupPublicId (
|
||||||
|
const std::string& publicId)
|
||||||
|
{
|
||||||
|
//std::auto_ptr<WrapLibxml> libxml ( new WrapLibxml ( false, catalogPath ) );
|
||||||
|
return wl->lookupPublicId ( publicId );
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,17 @@
|
||||||
#define CATALOG_RESOLVER_H
|
#define CATALOG_RESOLVER_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "wraplibxml.h"
|
||||||
|
|
||||||
class CatalogResolver
|
class CatalogResolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::string lookupPublicId (
|
CatalogResolver( const std::string& catalogPath );
|
||||||
const std::string& publicId,
|
~CatalogResolver();
|
||||||
const std::string& catalogPath );
|
std::string lookupPublicId (
|
||||||
|
const std::string& publicId);
|
||||||
|
private:
|
||||||
|
WrapLibxml *wl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -77,7 +77,7 @@ bool GetWord::isWordCharacter ( char *s, size_t *bytes )
|
||||||
|
|
||||||
unsigned char *us = ( unsigned char * ) s;
|
unsigned char *us = ( unsigned char * ) s;
|
||||||
if (
|
if (
|
||||||
*us < 65 ||
|
( *us < 65 && *us != 45 ) ||
|
||||||
( *us > 90 && *us < 97 ) ||
|
( *us > 90 && *us < 97 ) ||
|
||||||
( *us > 123 && *us < 128 )
|
( *us > 123 && *us < 128 )
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,6 +29,10 @@ HouseStyle::HouseStyle (
|
||||||
const std::string& filterDirectoryParameter,
|
const std::string& filterDirectoryParameter,
|
||||||
const std::string& filterFileParameter,
|
const std::string& filterFileParameter,
|
||||||
const std::string& pathSeparatorParameter,
|
const std::string& pathSeparatorParameter,
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
const std::string& aspellDataPathParameter,
|
||||||
|
const std::string& aspellDictPathParameter,
|
||||||
|
#endif
|
||||||
int contextRangeParameter ) :
|
int contextRangeParameter ) :
|
||||||
type ( typeParameter ),
|
type ( typeParameter ),
|
||||||
buffer ( bufferParameter ),
|
buffer ( bufferParameter ),
|
||||||
|
@ -37,11 +41,16 @@ HouseStyle::HouseStyle (
|
||||||
filterDirectory ( filterDirectoryParameter ),
|
filterDirectory ( filterDirectoryParameter ),
|
||||||
filterFile ( filterFileParameter ),
|
filterFile ( filterFileParameter ),
|
||||||
pathSeparator ( pathSeparatorParameter ),
|
pathSeparator ( pathSeparatorParameter ),
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
aspellDataPath ( aspellDataPathParameter ),
|
||||||
|
aspellDictPath ( aspellDictPathParameter ),
|
||||||
|
#endif
|
||||||
contextRange ( contextRangeParameter ),
|
contextRange ( contextRangeParameter ),
|
||||||
ruleVector ( new std::vector<boost::shared_ptr<Rule> > ),
|
ruleVector ( new std::vector<boost::shared_ptr<Rule> > ),
|
||||||
dictionary ( new StringSet<char> ),
|
dictionary ( new StringSet<char> ),
|
||||||
passiveDictionary ( new StringSet<char> )
|
passiveDictionary ( new StringSet<char> )
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
HouseStyle::~HouseStyle()
|
HouseStyle::~HouseStyle()
|
||||||
{}
|
{}
|
||||||
|
@ -199,7 +208,13 @@ bool HouseStyle::createReport()
|
||||||
WrapAspell *spellcheck = NULL;
|
WrapAspell *spellcheck = NULL;
|
||||||
try {
|
try {
|
||||||
if (type == HS_TYPE_SPELL)
|
if (type == HS_TYPE_SPELL)
|
||||||
spellcheck = new WrapAspell( ruleFile );
|
spellcheck = new WrapAspell(
|
||||||
|
ruleFile, // carries lang information
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
aspellDataPath,
|
||||||
|
aspellDictPath
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
@ -294,7 +309,7 @@ bool HouseStyle::createReport()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete spellcheck; // ok if NULL
|
delete spellcheck;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "xmlrulereader.h"
|
#include "xmlrulereader.h"
|
||||||
#include "housestylereader.h"
|
#include "housestylereader.h"
|
||||||
#include "xmlfilterreader.h"
|
#include "xmlfilterreader.h"
|
||||||
//#include "spellcheck.h"
|
|
||||||
#include "wrapaspell.h"
|
#include "wrapaspell.h"
|
||||||
#include "casehandler.h"
|
#include "casehandler.h"
|
||||||
|
|
||||||
|
@ -51,6 +50,10 @@ class HouseStyle
|
||||||
const std::string& filterDirectoryParameter,
|
const std::string& filterDirectoryParameter,
|
||||||
const std::string& filterFileParameter,
|
const std::string& filterFileParameter,
|
||||||
const std::string& pathSeparatorParameter,
|
const std::string& pathSeparatorParameter,
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
const std::string& aspellDataPathParameter,
|
||||||
|
const std::string& aspellDictPathParameter,
|
||||||
|
#endif
|
||||||
int contextRangeParameter );
|
int contextRangeParameter );
|
||||||
~HouseStyle();
|
~HouseStyle();
|
||||||
bool createReport();
|
bool createReport();
|
||||||
|
@ -59,13 +62,18 @@ class HouseStyle
|
||||||
private:
|
private:
|
||||||
int type;
|
int type;
|
||||||
std::string
|
std::string
|
||||||
buffer,
|
buffer,
|
||||||
ruleDirectory,
|
ruleDirectory,
|
||||||
ruleFile,
|
ruleFile,
|
||||||
filterDirectory,
|
filterDirectory,
|
||||||
filterFile,
|
filterFile,
|
||||||
pathSeparator,
|
pathSeparator,
|
||||||
error;
|
error,
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
aspellDataPath,
|
||||||
|
aspellDictPath
|
||||||
|
#endif
|
||||||
|
;
|
||||||
int contextRange;
|
int contextRange;
|
||||||
boost::shared_ptr<std::vector<boost::shared_ptr<Rule> > > ruleVector;
|
boost::shared_ptr<std::vector<boost::shared_ptr<Rule> > > ruleVector;
|
||||||
std::map<std::string, std::map<std::string, std::set<std::string> > >
|
std::map<std::string, std::map<std::string, std::set<std::string> > >
|
||||||
|
|
|
@ -70,6 +70,7 @@ bool MyServerConnection::OnPoke (
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frame->openFile ( ( wxString& ) item );
|
frame->openFile ( ( wxString& ) item );
|
||||||
|
//frame->addToFileQueue ( ( wxString& ) item ); // prevent event loop problems
|
||||||
}
|
}
|
||||||
frame->Raise();
|
frame->Raise();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#ifndef MY_IPC_H
|
#ifndef MY_IPC_H
|
||||||
#define MY_IPC_H
|
#define MY_IPC_H
|
||||||
|
|
||||||
|
//#define wxUSE_DDE_FOR_IPC 0
|
||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include <wx/ipc.h>
|
#include <wx/ipc.h>
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,10 @@ StyleDialog::StyleDialog (
|
||||||
const wxString& browserParameter,
|
const wxString& browserParameter,
|
||||||
const wxString& ruleSetPresetParameter,
|
const wxString& ruleSetPresetParameter,
|
||||||
const wxString& filterPresetParameter,
|
const wxString& filterPresetParameter,
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
const std::string& aspellDataPathParameter,
|
||||||
|
const std::string& aspellDictPathParameter,
|
||||||
|
#endif
|
||||||
int typeParameter,
|
int typeParameter,
|
||||||
bool readOnlyParameter,
|
bool readOnlyParameter,
|
||||||
wxPoint position,
|
wxPoint position,
|
||||||
|
@ -75,6 +79,10 @@ StyleDialog::StyleDialog (
|
||||||
browser ( browserParameter ),
|
browser ( browserParameter ),
|
||||||
ruleSetPreset ( ruleSetPresetParameter ),
|
ruleSetPreset ( ruleSetPresetParameter ),
|
||||||
filterPreset ( filterPresetParameter ),
|
filterPreset ( filterPresetParameter ),
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
aspellDataPath ( aspellDataPathParameter ),
|
||||||
|
aspellDictPath ( aspellDictPathParameter ),
|
||||||
|
#endif
|
||||||
type(typeParameter),
|
type(typeParameter),
|
||||||
readOnly ( readOnlyParameter )
|
readOnly ( readOnlyParameter )
|
||||||
{
|
{
|
||||||
|
@ -235,8 +243,8 @@ StyleDialog::StyleDialog (
|
||||||
config = new_aspell_config();
|
config = new_aspell_config();
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
aspell_config_replace ( config, "data-dir", ASPELL_DATA_PATH );
|
aspell_config_replace ( config, "data-dir", aspellDataPath.c_str() ); //ASPELL_DATA_PATH );
|
||||||
aspell_config_replace ( config, "dict-dir", ASPELL_DICT_PATH );
|
aspell_config_replace ( config, "dict-dir", aspellDictPath.c_str() ); //ASPELL_DICT_PATH );
|
||||||
#endif
|
#endif
|
||||||
dlist = get_aspell_dict_info_list( config );
|
dlist = get_aspell_dict_info_list( config );
|
||||||
|
|
||||||
|
@ -428,6 +436,10 @@ void StyleDialog::OnReport ( wxCommandEvent& event )
|
||||||
filterDirectoryUtf8,
|
filterDirectoryUtf8,
|
||||||
filterUtf8,
|
filterUtf8,
|
||||||
pathSeparatorUtf8,
|
pathSeparatorUtf8,
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
aspellDataPath,
|
||||||
|
aspellDictPath,
|
||||||
|
#endif
|
||||||
5 ) );
|
5 ) );
|
||||||
|
|
||||||
status->SetStatusText ( _ ( "Checking document..." ) );
|
status->SetStatusText ( _ ( "Checking document..." ) );
|
||||||
|
@ -589,6 +601,9 @@ void StyleDialog::OnStyleWebReport ( wxCommandEvent& event )
|
||||||
std::ofstream ofs ( tempNameUtf8.c_str() );
|
std::ofstream ofs ( tempNameUtf8.c_str() );
|
||||||
if ( !ofs )
|
if ( !ofs )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
WrapExpat we;
|
||||||
|
|
||||||
ofs << XHTML_START;
|
ofs << XHTML_START;
|
||||||
ofs << "<body><h2>";
|
ofs << "<body><h2>";
|
||||||
ofs << fileName.mb_str ( wxConvUTF8 );
|
ofs << fileName.mb_str ( wxConvUTF8 );
|
||||||
|
@ -606,15 +621,15 @@ void StyleDialog::OnStyleWebReport ( wxCommandEvent& event )
|
||||||
ofs << ++matchCount;
|
ofs << ++matchCount;
|
||||||
ofs << "</td>";
|
ofs << "</td>";
|
||||||
ofs << "<td align=\"right\">";
|
ofs << "<td align=\"right\">";
|
||||||
ofs << it->prelog;
|
ofs << we.xmliseTextNode ( it->prelog );
|
||||||
ofs << "</td><td align=\"center\"><font color=\"red\"><b>";
|
ofs << "</td><td align=\"center\"><font color=\"red\"><b>";
|
||||||
ofs << it->match;
|
ofs << we.xmliseTextNode ( it->match );
|
||||||
ofs << "</b></font></td><td align=\"left\">";
|
ofs << "</b></font></td><td align=\"left\">";
|
||||||
ofs << it->postlog;
|
ofs << we.xmliseTextNode ( it->postlog );
|
||||||
ofs << "</td><td><font color=\"green\"><b>";
|
ofs << "</td><td><font color=\"green\"><b>";
|
||||||
ofs << it->replace;
|
ofs << we.xmliseTextNode ( it->replace );
|
||||||
ofs << "</b></font></td><td>";
|
ofs << "</b></font></td><td>";
|
||||||
ofs << it->report;
|
ofs << we.xmliseTextNode ( it->report );
|
||||||
ofs << "</td></tr>";
|
ofs << "</td></tr>";
|
||||||
}
|
}
|
||||||
ofs << "</table></body>";
|
ofs << "</table></body>";
|
||||||
|
|
|
@ -73,6 +73,10 @@ class StyleDialog : public wxDialog
|
||||||
const wxString& browserParameter,
|
const wxString& browserParameter,
|
||||||
const wxString& ruleSetPresetParameter,
|
const wxString& ruleSetPresetParameter,
|
||||||
const wxString& filterPresetParameter,
|
const wxString& filterPresetParameter,
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
const std::string& aspellDataPath,
|
||||||
|
const std::string& aspellDictPath,
|
||||||
|
#endif
|
||||||
int type = ID_TYPE_STYLE,
|
int type = ID_TYPE_STYLE,
|
||||||
bool readOnlyParameter = false,
|
bool readOnlyParameter = false,
|
||||||
wxPoint position = wxDefaultPosition,
|
wxPoint position = wxDefaultPosition,
|
||||||
|
@ -115,7 +119,7 @@ class StyleDialog : public wxDialog
|
||||||
wxComboBox *ruleSetCombo, *filterCombo;
|
wxComboBox *ruleSetCombo, *filterCombo;
|
||||||
wxListCtrl *table;
|
wxListCtrl *table;
|
||||||
wxStatusBar *status;
|
wxStatusBar *status;
|
||||||
std::string bufferUtf8;
|
std::string bufferUtf8, aspellDataPath, aspellDictPath;
|
||||||
std::set<wxString> tempFiles;
|
std::set<wxString> tempFiles;
|
||||||
wxString fileName, ruleSetDirectory, filterDirectory, browser;
|
wxString fileName, ruleSetDirectory, filterDirectory, browser;
|
||||||
wxString ruleSetPreset, filterPreset;
|
wxString ruleSetPreset, filterPreset;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
ValidationThread::ValidationThread (
|
ValidationThread::ValidationThread (
|
||||||
const char *buffer,
|
const char *buffer,
|
||||||
const char *system,
|
const char *system,
|
||||||
|
const char *catalogPath,
|
||||||
|
const char *catalogUtilityPath,
|
||||||
bool *finished,
|
bool *finished,
|
||||||
bool *success,
|
bool *success,
|
||||||
bool *release,
|
bool *release,
|
||||||
|
@ -21,6 +23,8 @@ ValidationThread::ValidationThread (
|
||||||
|
|
||||||
myBuffer = buffer;
|
myBuffer = buffer;
|
||||||
mySystem = system;
|
mySystem = system;
|
||||||
|
myCatalogPath = catalogPath;
|
||||||
|
myCatalogUtilityPath = catalogUtilityPath;
|
||||||
myFinishedPtr = finished;
|
myFinishedPtr = finished;
|
||||||
mySuccessPtr = success;
|
mySuccessPtr = success;
|
||||||
myReleasePtr = release;
|
myReleasePtr = release;
|
||||||
|
@ -30,7 +34,9 @@ ValidationThread::ValidationThread (
|
||||||
|
|
||||||
void *ValidationThread::Entry()
|
void *ValidationThread::Entry()
|
||||||
{
|
{
|
||||||
std::auto_ptr<WrapXerces> validator ( new WrapXerces() );
|
std::auto_ptr<WrapXerces> validator ( new WrapXerces(
|
||||||
|
myCatalogPath,
|
||||||
|
myCatalogUtilityPath ) );
|
||||||
|
|
||||||
{
|
{
|
||||||
//wxCriticalSectionLocker locker ( xmlcopyeditorCriticalSection );
|
//wxCriticalSectionLocker locker ( xmlcopyeditorCriticalSection );
|
||||||
|
@ -45,8 +51,6 @@ void *ValidationThread::Entry()
|
||||||
myBuffer.c_str(),
|
myBuffer.c_str(),
|
||||||
mySystem.c_str(),
|
mySystem.c_str(),
|
||||||
myBuffer.size() );
|
myBuffer.size() );
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
//wxCriticalSectionLocker locker ( xmlcopyeditorCriticalSection );
|
//wxCriticalSectionLocker locker ( xmlcopyeditorCriticalSection );
|
||||||
if ( *myReleasePtr || TestDestroy() )
|
if ( *myReleasePtr || TestDestroy() )
|
||||||
|
|
|
@ -8,11 +8,19 @@
|
||||||
class ValidationThread : public wxThread
|
class ValidationThread : public wxThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ValidationThread ( const char *buffer, const char *system, bool *finished, bool *success, bool *release, std::pair<int, int> *position, std::string *message );
|
ValidationThread (
|
||||||
|
const char *buffer,
|
||||||
|
const char *system,
|
||||||
|
const char *catalogPath,
|
||||||
|
const char *catalogUtilityPath,
|
||||||
|
bool *finished,
|
||||||
|
bool *success,
|
||||||
|
bool *release, std::pair<int, int> *position,
|
||||||
|
std::string *message );
|
||||||
virtual void *Entry();
|
virtual void *Entry();
|
||||||
virtual void OnExit();
|
virtual void OnExit();
|
||||||
private:
|
private:
|
||||||
std::string myBuffer, mySystem;
|
std::string myBuffer, mySystem, myCatalogPath, myCatalogUtilityPath;
|
||||||
bool *myFinishedPtr, *mySuccessPtr, *myReleasePtr;
|
bool *myFinishedPtr, *mySuccessPtr, *myReleasePtr;
|
||||||
std::pair<int, int> *myPositionPtr;
|
std::pair<int, int> *myPositionPtr;
|
||||||
std::string *myMessagePtr;
|
std::string *myMessagePtr;
|
||||||
|
|
|
@ -29,13 +29,20 @@
|
||||||
#include "aspellpaths.h"
|
#include "aspellpaths.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WrapAspell::WrapAspell ( std::string lang )
|
WrapAspell::WrapAspell (
|
||||||
|
std::string lang
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
,
|
||||||
|
const std::string& aspellDataPathParameter,
|
||||||
|
const std::string& aspellDictPathParameter
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
spell_config = new_aspell_config();
|
spell_config = new_aspell_config();
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
aspell_config_replace ( spell_config, "data-dir", ASPELL_DATA_PATH );
|
aspell_config_replace ( spell_config, "data-dir", aspellDataPathParameter.c_str() );//ASPELL_DATA_PATH );
|
||||||
aspell_config_replace ( spell_config, "dict-dir", ASPELL_DICT_PATH );
|
aspell_config_replace ( spell_config, "dict-dir", aspellDictPathParameter.c_str() );//ASPELL_DICT_PATH );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
aspell_config_replace ( spell_config, "lang", lang.c_str() );
|
aspell_config_replace ( spell_config, "lang", lang.c_str() );
|
||||||
|
@ -101,4 +108,3 @@ bool WrapAspell::checkWord ( char *s, size_t len )
|
||||||
{
|
{
|
||||||
return aspell_speller_check ( spell_checker, s, len );
|
return aspell_speller_check ( spell_checker, s, len );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,13 @@
|
||||||
class WrapAspell
|
class WrapAspell
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WrapAspell ( std::string lang = "en_US" );
|
WrapAspell (
|
||||||
|
std::string lang,// = "en_US",
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
const std::string& aspellDataPathParameter,
|
||||||
|
const std::string& aspellDictPath
|
||||||
|
#endif
|
||||||
|
);
|
||||||
~WrapAspell();
|
~WrapAspell();
|
||||||
inline bool checkWord ( std::string &s );
|
inline bool checkWord ( std::string &s );
|
||||||
void checkString (
|
void checkString (
|
||||||
|
@ -36,6 +42,7 @@ class WrapAspell
|
||||||
std::vector<ContextMatch> &v,
|
std::vector<ContextMatch> &v,
|
||||||
int contextRange );
|
int contextRange );
|
||||||
std::string getSuggestion ( std::string &s );
|
std::string getSuggestion ( std::string &s );
|
||||||
|
std::string getVersion();
|
||||||
private:
|
private:
|
||||||
AspellConfig *spell_config;
|
AspellConfig *spell_config;
|
||||||
AspellSpeller *spell_checker;
|
AspellSpeller *spell_checker;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wrapexpat.h"
|
#include "wrapexpat.h"
|
||||||
#include "expat.h"
|
//#include "expat.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
|
@ -533,7 +533,18 @@ std::string WrapLibxml::lookupPublicId ( const std::string& id )
|
||||||
char *s = ( char * ) xmlCatalogResolvePublic ( ( const xmlChar * ) id.c_str() );
|
char *s = ( char * ) xmlCatalogResolvePublic ( ( const xmlChar * ) id.c_str() );
|
||||||
if ( !s )
|
if ( !s )
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
char *original, *it;
|
||||||
|
original = s;
|
||||||
|
|
||||||
|
it = strstr ( s, "file://" );
|
||||||
|
if ( it )
|
||||||
|
{
|
||||||
|
s = it + 6;
|
||||||
|
}
|
||||||
|
|
||||||
ret = s;
|
ret = s;
|
||||||
free ( s );
|
|
||||||
|
free ( original );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
|
|
||||||
WrapXerces::WrapXerces()
|
WrapXerces::WrapXerces( std::string catalogPath, std::string catalogUtilityPath )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -42,11 +42,13 @@ WrapXerces::WrapXerces()
|
||||||
throw std::runtime_error ( "Cannot initialize Xerces" );
|
throw std::runtime_error ( "Cannot initialize Xerces" );
|
||||||
}
|
}
|
||||||
errorPosition = std::make_pair ( 1, 1 );
|
errorPosition = std::make_pair ( 1, 1 );
|
||||||
|
catalogResolver = new XercesCatalogResolver( catalogPath, catalogUtilityPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
WrapXerces::~WrapXerces()
|
WrapXerces::~WrapXerces()
|
||||||
{
|
{
|
||||||
XMLPlatformUtils::Terminate();
|
delete catalogResolver;
|
||||||
|
XMLPlatformUtils::Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WrapXerces::validate ( const std::string& fileName )
|
bool WrapXerces::validate ( const std::string& fileName )
|
||||||
|
@ -61,11 +63,15 @@ bool WrapXerces::validate ( const std::string& fileName )
|
||||||
parser->setFeature ( XMLUni::fgXercesValidationErrorAsFatal, true );
|
parser->setFeature ( XMLUni::fgXercesValidationErrorAsFatal, true );
|
||||||
parser->setFeature ( XMLUni::fgXercesLoadExternalDTD, true );
|
parser->setFeature ( XMLUni::fgXercesLoadExternalDTD, true );
|
||||||
|
|
||||||
|
|
||||||
DefaultHandler handler;
|
DefaultHandler handler;
|
||||||
MySAX2Handler mySAX2Handler;
|
MySAX2Handler mySAX2Handler;
|
||||||
parser->setContentHandler ( &handler );
|
parser->setContentHandler ( &handler );
|
||||||
parser->setErrorHandler ( &mySAX2Handler );
|
parser->setErrorHandler ( &mySAX2Handler );
|
||||||
parser->setEntityResolver ( &handler );
|
|
||||||
|
//DefaultHandler handler;
|
||||||
|
//parser->setEntityResolver ( &handler );
|
||||||
|
parser->setEntityResolver ( catalogResolver );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -112,7 +118,7 @@ bool WrapXerces::validateMemory (
|
||||||
parser->setFeature ( XMLUni::fgSAX2CoreValidation, true );
|
parser->setFeature ( XMLUni::fgSAX2CoreValidation, true );
|
||||||
parser->setFeature ( XMLUni::fgXercesDynamic, true );
|
parser->setFeature ( XMLUni::fgXercesDynamic, true );
|
||||||
parser->setFeature ( XMLUni::fgXercesSchema, true );
|
parser->setFeature ( XMLUni::fgXercesSchema, true );
|
||||||
parser->setFeature ( XMLUni::fgXercesSchemaFullChecking, true );
|
//parser->setFeature ( XMLUni::fgXercesSchemaFullChecking, true );
|
||||||
parser->setFeature ( XMLUni::fgXercesValidationErrorAsFatal, true );
|
parser->setFeature ( XMLUni::fgXercesValidationErrorAsFatal, true );
|
||||||
parser->setFeature ( XMLUni::fgXercesLoadExternalDTD, true );
|
parser->setFeature ( XMLUni::fgXercesLoadExternalDTD, true );
|
||||||
|
|
||||||
|
@ -120,7 +126,8 @@ bool WrapXerces::validateMemory (
|
||||||
MySAX2Handler mySAX2Handler;
|
MySAX2Handler mySAX2Handler;
|
||||||
parser->setContentHandler ( &handler );
|
parser->setContentHandler ( &handler );
|
||||||
parser->setErrorHandler ( &mySAX2Handler );
|
parser->setErrorHandler ( &mySAX2Handler );
|
||||||
parser->setEntityResolver ( &handler );
|
//parser->setEntityResolver ( &handler );
|
||||||
|
parser->setEntityResolver ( catalogResolver );
|
||||||
|
|
||||||
XMLByte* xmlBuffer = (XMLByte*) buffer;
|
XMLByte* xmlBuffer = (XMLByte*) buffer;
|
||||||
MemBufInputSource source (
|
MemBufInputSource source (
|
||||||
|
|
|
@ -25,19 +25,22 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <xercesc/sax2/SAX2XMLReader.hpp>
|
#include <xercesc/sax2/SAX2XMLReader.hpp>
|
||||||
#include <xercesc/sax2/DefaultHandler.hpp>
|
#include <xercesc/sax2/DefaultHandler.hpp>
|
||||||
|
#include "xercescatalogresolver.h"
|
||||||
|
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
|
|
||||||
class WrapXerces
|
class WrapXerces
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WrapXerces();
|
WrapXerces( std::string catalogPath = "",
|
||||||
|
std::string catalogUtilityPath = "" );
|
||||||
~WrapXerces();
|
~WrapXerces();
|
||||||
bool validate ( const std::string& fileName );
|
bool validate ( const std::string& fileName );
|
||||||
bool validateMemory ( const char *buffer, const char *system, unsigned len );
|
bool validateMemory ( const char *buffer, const char *system, unsigned len );
|
||||||
std::string getLastError();
|
std::string getLastError();
|
||||||
std::pair<int, int> getErrorPosition();
|
std::pair<int, int> getErrorPosition();
|
||||||
private:
|
private:
|
||||||
|
XercesCatalogResolver *catalogResolver;
|
||||||
std::string lastError;
|
std::string lastError;
|
||||||
std::pair<int, int> errorPosition;
|
std::pair<int, int> errorPosition;
|
||||||
};
|
};
|
||||||
|
|
|
@ -158,10 +158,10 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame )
|
||||||
EVT_UPDATE_UI ( wxID_CLOSE, MyFrame::OnUpdateDocRange )
|
EVT_UPDATE_UI ( wxID_CLOSE, MyFrame::OnUpdateDocRange )
|
||||||
EVT_UPDATE_UI ( wxID_SAVEAS, MyFrame::OnUpdateDocRange )
|
EVT_UPDATE_UI ( wxID_SAVEAS, MyFrame::OnUpdateDocRange )
|
||||||
EVT_UPDATE_UI ( wxID_CLOSE_ALL, MyFrame::OnUpdateCloseAll )
|
EVT_UPDATE_UI ( wxID_CLOSE_ALL, MyFrame::OnUpdateCloseAll )
|
||||||
// EVT_UPDATE_UI_RANGE ( ID_SPLIT_TAB_TOP, ID_SPLIT_TAB_LEFT, MyFrame::OnUpdateCloseAll )
|
EVT_UPDATE_UI_RANGE ( ID_SPLIT_TAB_TOP, ID_SPLIT_TAB_LEFT, MyFrame::OnUpdateCloseAll )
|
||||||
EVT_UPDATE_UI ( wxID_REVERT, MyFrame::OnUpdateSaveUndo )
|
EVT_UPDATE_UI ( wxID_REVERT, MyFrame::OnUpdateUndo )
|
||||||
EVT_UPDATE_UI ( wxID_SAVE, MyFrame::OnUpdateDocRange ) // always allow save if doc present
|
EVT_UPDATE_UI ( wxID_SAVE, MyFrame::OnUpdateDocRange ) // always allow save if doc present
|
||||||
EVT_UPDATE_UI ( wxID_UNDO, MyFrame::OnUpdateSaveUndo )
|
EVT_UPDATE_UI ( wxID_UNDO, MyFrame::OnUpdateUndo )
|
||||||
EVT_UPDATE_UI ( wxID_REDO, MyFrame::OnUpdateRedo )
|
EVT_UPDATE_UI ( wxID_REDO, MyFrame::OnUpdateRedo )
|
||||||
EVT_UPDATE_UI ( wxID_PASTE, MyFrame::OnUpdatePaste )
|
EVT_UPDATE_UI ( wxID_PASTE, MyFrame::OnUpdatePaste )
|
||||||
EVT_UPDATE_UI ( wxID_CUT, MyFrame::OnUpdateCutCopy )
|
EVT_UPDATE_UI ( wxID_CUT, MyFrame::OnUpdateCutCopy )
|
||||||
|
@ -174,18 +174,18 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame )
|
||||||
EVT_UPDATE_UI ( ID_RELOAD, MyFrame::OnUpdateReload )
|
EVT_UPDATE_UI ( ID_RELOAD, MyFrame::OnUpdateReload )
|
||||||
EVT_IDLE ( MyFrame::OnIdle )
|
EVT_IDLE ( MyFrame::OnIdle )
|
||||||
EVT_AUINOTEBOOK_PAGE_CLOSE ( wxID_ANY, MyFrame::OnPageClosing )
|
EVT_AUINOTEBOOK_PAGE_CLOSE ( wxID_ANY, MyFrame::OnPageClosing )
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
EVT_DROP_FILES ( MyFrame::OnDropFiles )
|
EVT_DROP_FILES ( MyFrame::OnDropFiles )
|
||||||
#endif
|
#endif
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_APP ( MyApp)
|
IMPLEMENT_APP ( MyApp)
|
||||||
|
|
||||||
MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
|
MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
config ( new wxConfig ( _T ( "SourceForge Project\\XML Copy Editor" ) ) )
|
config ( new wxFileConfig ( _T ( ".xmlcopyeditor" ) ) )//( _T ( "SourceForge Project\\XML Copy Editor" ) ) )
|
||||||
#else
|
#else
|
||||||
config ( new wxConfig ( _T ( "xmlcopyeditor" ) ) )
|
config ( new wxFileConfig ( _T ( "xmlcopyeditor" ) ) )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
lang = 0;
|
lang = 0;
|
||||||
|
@ -315,7 +315,7 @@ bool MyApp::OnInit()
|
||||||
|
|
||||||
if ( singleInstanceCheck )
|
if ( singleInstanceCheck )
|
||||||
{
|
{
|
||||||
checker = new wxSingleInstanceChecker ( name );
|
checker = new wxSingleInstanceChecker ( name );
|
||||||
while ( checker->IsAnotherRunning() )
|
while ( checker->IsAnotherRunning() )
|
||||||
{
|
{
|
||||||
// attempt calling server
|
// attempt calling server
|
||||||
|
@ -336,7 +336,8 @@ bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
argument = ( wxString ) this->argv[i];
|
argument = ( wxString ) this->argv[i];
|
||||||
argument = PathResolver::run ( argument );
|
argument = PathResolver::run ( argument );
|
||||||
connection->Poke ( argument, whatBuffer );
|
if ( ! connection->Poke ( argument, whatBuffer ) )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -529,7 +530,7 @@ void MyApp::HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent&
|
||||||
|
|
||||||
MyFrame::MyFrame (
|
MyFrame::MyFrame (
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
wxConfig *configParameter,
|
wxFileConfig *configParameter,
|
||||||
wxLocale& locale,
|
wxLocale& locale,
|
||||||
bool singleInstanceCheckParameter,
|
bool singleInstanceCheckParameter,
|
||||||
int langParameter ) :
|
int langParameter ) :
|
||||||
|
@ -981,8 +982,8 @@ MyFrame::~MyFrame()
|
||||||
config->Write ( _T ( "protectTags" ), protectTags );
|
config->Write ( _T ( "protectTags" ), protectTags );
|
||||||
config->Write ( _T ( "visibilityState" ), visibilityState );
|
config->Write ( _T ( "visibilityState" ), visibilityState );
|
||||||
config->Write ( _T ( "browserCommand" ), browserCommand );
|
config->Write ( _T ( "browserCommand" ), browserCommand );
|
||||||
config->Write ( _T ( "layout" ), layout );
|
// config->Write ( _T ( "layout" ), layout ); // omit while unused
|
||||||
config->Write ( _T ( "showLocationPane" ), manager.GetPane ( locationPanel ).IsShown() );
|
config->Write ( _T ( "showLocationPane" ), manager.GetPane ( locationPanel ).IsShown() );
|
||||||
config->Write ( _T ( "showInsertChildPane" ), manager.GetPane ( insertChildPanel ).IsShown() );
|
config->Write ( _T ( "showInsertChildPane" ), manager.GetPane ( insertChildPanel ).IsShown() );
|
||||||
config->Write ( _T ( "showInsertSiblingPane" ), manager.GetPane ( insertSiblingPanel ).IsShown() );
|
config->Write ( _T ( "showInsertSiblingPane" ), manager.GetPane ( insertSiblingPanel ).IsShown() );
|
||||||
config->Write ( _T ( "showInsertEntityPane" ), manager.GetPane ( insertEntityPanel ).IsShown() );
|
config->Write ( _T ( "showInsertEntityPane" ), manager.GetPane ( insertEntityPanel ).IsShown() );
|
||||||
|
@ -1451,22 +1452,13 @@ void MyFrame::OnPaste ( wxCommandEvent& event )
|
||||||
wxTextDataObject data;
|
wxTextDataObject data;
|
||||||
wxTheClipboard->GetData ( data );
|
wxTheClipboard->GetData ( data );
|
||||||
wxString buffer = data.GetText();
|
wxString buffer = data.GetText();
|
||||||
|
wxTheClipboard->Close();
|
||||||
xmliseWideTextNode ( buffer );
|
xmliseWideTextNode ( buffer );
|
||||||
doc->adjustCursor();
|
doc->adjustCursor();
|
||||||
doc->AddText ( buffer );
|
doc->AddText ( buffer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
doc->Paste();
|
doc->Paste();
|
||||||
|
|
||||||
/*
|
|
||||||
XmlDoc *doc;
|
|
||||||
doc = getActiveDocument();
|
|
||||||
if (doc && protectTags)
|
|
||||||
doc->adjustCursor();
|
|
||||||
|
|
||||||
doc->setValidationRequired(true);
|
|
||||||
event.Skip(); // new
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnIdle ( wxIdleEvent& event )
|
void MyFrame::OnIdle ( wxIdleEvent& event )
|
||||||
|
@ -1475,6 +1467,15 @@ void MyFrame::OnIdle ( wxIdleEvent& event )
|
||||||
if ( !status )
|
if ( !status )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// IPC handling: take one file from fileQueue at a time
|
||||||
|
if ( !fileQueue.empty() )
|
||||||
|
{
|
||||||
|
openFile ( * ( fileQueue.begin() ) );
|
||||||
|
fileQueue.erase( fileQueue.begin() );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// update attributes hidden field even if no document loaded
|
// update attributes hidden field even if no document loaded
|
||||||
wxString currentHiddenStatus = status->GetStatusText ( STATUS_HIDDEN );
|
wxString currentHiddenStatus = status->GetStatusText ( STATUS_HIDDEN );
|
||||||
if ( visibilityState == HIDE_ATTRIBUTES )
|
if ( visibilityState == HIDE_ATTRIBUTES )
|
||||||
|
@ -1557,7 +1558,7 @@ void MyFrame::OnIdle ( wxIdleEvent& event )
|
||||||
if ( frameTitle != docTitle )
|
if ( frameTitle != docTitle )
|
||||||
SetTitle ( docTitle );
|
SetTitle ( docTitle );
|
||||||
|
|
||||||
// update modified field
|
// update modified field
|
||||||
if ( !mainBook )
|
if ( !mainBook )
|
||||||
return;
|
return;
|
||||||
int index = mainBook->GetSelection();
|
int index = mainBook->GetSelection();
|
||||||
|
@ -1799,6 +1800,7 @@ void MyFrame::OnPasteNewDocument ( wxCommandEvent& event )
|
||||||
buffer.Append ( _T ( "</root>\n" ) );
|
buffer.Append ( _T ( "</root>\n" ) );
|
||||||
|
|
||||||
newDocument ( buffer );
|
newDocument ( buffer );
|
||||||
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnDialogFind ( wxFindDialogEvent& event )
|
void MyFrame::OnDialogFind ( wxFindDialogEvent& event )
|
||||||
|
@ -2278,7 +2280,6 @@ void MyFrame::OnSplitTab ( wxCommandEvent& event )
|
||||||
direction = wxAUI_NB_RIGHT;
|
direction = wxAUI_NB_RIGHT;
|
||||||
switch ( id )
|
switch ( id )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
ID_SPLIT_TAB_TOP:
|
ID_SPLIT_TAB_TOP:
|
||||||
direction = wxAUI_NB_TOP;
|
direction = wxAUI_NB_TOP;
|
||||||
break;
|
break;
|
||||||
|
@ -2291,7 +2292,6 @@ void MyFrame::OnSplitTab ( wxCommandEvent& event )
|
||||||
ID_SPLIT_TAB_LEFT:
|
ID_SPLIT_TAB_LEFT:
|
||||||
direction = wxAUI_NB_LEFT;
|
direction = wxAUI_NB_LEFT;
|
||||||
break;
|
break;
|
||||||
*/
|
|
||||||
default:
|
default:
|
||||||
direction = wxAUI_NB_RIGHT;
|
direction = wxAUI_NB_RIGHT;
|
||||||
break;
|
break;
|
||||||
|
@ -2726,6 +2726,7 @@ void MyFrame::newDocument ( const std::string& s, const std::string& path, bool
|
||||||
s.c_str(), // modified
|
s.c_str(), // modified
|
||||||
s.size(), // new
|
s.size(), // new
|
||||||
catalogPath,
|
catalogPath,
|
||||||
|
catalogUtilityPath,
|
||||||
path,
|
path,
|
||||||
auxPath );
|
auxPath );
|
||||||
mainBook->AddPage ( ( wxWindow * ) doc, documentLabel, true );
|
mainBook->AddPage ( ( wxWindow * ) doc, documentLabel, true );
|
||||||
|
@ -3040,6 +3041,7 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile )
|
||||||
finalBuffer,
|
finalBuffer,
|
||||||
finalBufferLen,
|
finalBufferLen,
|
||||||
catalogPath,
|
catalogPath,
|
||||||
|
catalogUtilityPath,
|
||||||
( const char * ) fileName.mb_str ( wxConvLocal ),
|
( const char * ) fileName.mb_str ( wxConvLocal ),
|
||||||
auxPath );
|
auxPath );
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@ -3114,7 +3116,8 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile )
|
||||||
if ( !largeFile && ( properties.validateAsYouType && doc->getGrammarFound() ) )
|
if ( !largeFile && ( properties.validateAsYouType && doc->getGrammarFound() ) )
|
||||||
{
|
{
|
||||||
statusProgress ( _T ( "Validating document..." ) );
|
statusProgress ( _T ( "Validating document..." ) );
|
||||||
doc->backgroundValidate ( finalBuffer, doc->getFullFileName().mb_str(wxConvUTF8), finalBufferLen );
|
//doc->backgroundValidate ( finalBuffer, doc->getFullFileName().mb_str(wxConvUTF8), finalBufferLen );
|
||||||
|
doc->backgroundValidate();
|
||||||
statusProgress ( wxEmptyString );
|
statusProgress ( wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3262,9 +3265,13 @@ void MyFrame::OnSpelling ( wxCommandEvent& event )
|
||||||
ruleSetDir,
|
ruleSetDir,
|
||||||
filterDir,
|
filterDir,
|
||||||
browserCommand,
|
browserCommand,
|
||||||
( type == ID_TYPE_SPELL ) ? dictionaryPreset : ruleSetPreset,
|
( type == ID_TYPE_SPELL ) ? dictionaryPreset : ruleSetPreset,
|
||||||
filterPreset,
|
filterPreset,
|
||||||
type,
|
#ifdef __WXMSW__
|
||||||
|
aspellDataPath,
|
||||||
|
aspellDictPath,
|
||||||
|
#endif
|
||||||
|
type,
|
||||||
( success ) ? false : true,
|
( success ) ? false : true,
|
||||||
stylePosition,
|
stylePosition,
|
||||||
styleSize ) );
|
styleSize ) );
|
||||||
|
@ -3511,7 +3518,7 @@ void MyFrame::OnUpdateFindAgain ( wxUpdateUIEvent& event )
|
||||||
event.Enable ( true );
|
event.Enable ( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnUpdateSaveUndo ( wxUpdateUIEvent& event )
|
void MyFrame::OnUpdateUndo ( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
XmlDoc *doc;
|
XmlDoc *doc;
|
||||||
if ( ( doc = getActiveDocument() ) == NULL )
|
if ( ( doc = getActiveDocument() ) == NULL )
|
||||||
|
@ -3519,8 +3526,11 @@ void MyFrame::OnUpdateSaveUndo ( wxUpdateUIEvent& event )
|
||||||
event.Enable ( false );
|
event.Enable ( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//event.Enable((doc->CanUndo()) ? true : false);
|
#ifdef __WXMSW__
|
||||||
|
event.Enable((doc->CanUndo()) ? true : false);
|
||||||
|
#else
|
||||||
event.Enable ( ( doc->GetModify() ) ? true : false );
|
event.Enable ( ( doc->GetModify() ) ? true : false );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnUpdateRedo ( wxUpdateUIEvent& event )
|
void MyFrame::OnUpdateRedo ( wxUpdateUIEvent& event )
|
||||||
|
@ -3760,6 +3770,7 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event )
|
||||||
// branch: if no XML Schema found, use LibXML DTD parser instead
|
// branch: if no XML Schema found, use LibXML DTD parser instead
|
||||||
// so the catalog is read - switch when Xerces-C implements
|
// so the catalog is read - switch when Xerces-C implements
|
||||||
// XMLCatalogResolver
|
// XMLCatalogResolver
|
||||||
|
#ifdef __WXMSW__
|
||||||
{
|
{
|
||||||
std::string rawBuffer, schemaLocation;
|
std::string rawBuffer, schemaLocation;
|
||||||
getRawText ( doc, rawBuffer );
|
getRawText ( doc, rawBuffer );
|
||||||
|
@ -3771,6 +3782,7 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wxString fileName;
|
wxString fileName;
|
||||||
std::string tempFileNameLocal;
|
std::string tempFileNameLocal;
|
||||||
|
@ -3800,7 +3812,9 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event )
|
||||||
std::string error;
|
std::string error;
|
||||||
wxString wideError;
|
wxString wideError;
|
||||||
|
|
||||||
std::auto_ptr<WrapXerces> validator ( new WrapXerces() );
|
std::auto_ptr<WrapXerces> validator (
|
||||||
|
new WrapXerces( catalogPath, catalogUtilityPath )
|
||||||
|
);
|
||||||
std::string fileNameLocal = ( const char * ) fileName.mb_str ( wxConvLocal );
|
std::string fileNameLocal = ( const char * ) fileName.mb_str ( wxConvLocal );
|
||||||
if ( !validator->validate ( fileNameLocal ) )
|
if ( !validator->validate ( fileNameLocal ) )
|
||||||
{
|
{
|
||||||
|
@ -3813,11 +3827,10 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event )
|
||||||
int cursorPos =
|
int cursorPos =
|
||||||
doc->PositionFromLine ( posPair.first - 1 );
|
doc->PositionFromLine ( posPair.first - 1 );
|
||||||
doc->SetSelection ( cursorPos, cursorPos );
|
doc->SetSelection ( cursorPos, cursorPos );
|
||||||
doc->setErrorIndicator ( posPair.first - 1, 0 ); //posPair.second );
|
doc->setErrorIndicator ( posPair.first - 1, 0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
documentOk ( _ ( "valid" ) );
|
documentOk ( _ ( "valid" ) );
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnXPath ( wxCommandEvent& event )
|
void MyFrame::OnXPath ( wxCommandEvent& event )
|
||||||
|
@ -4605,7 +4618,7 @@ bool MyFrame::saveFile ( XmlDoc *doc, wxString& fileName, bool checkLastModified
|
||||||
finalBuffer = iconvBuffer; // iconvBuffer will be incremented by iconv
|
finalBuffer = iconvBuffer; // iconvBuffer will be incremented by iconv
|
||||||
size_t nconv;
|
size_t nconv;
|
||||||
|
|
||||||
#ifdef __WXMSW_
|
#ifdef __WXMSW__
|
||||||
const char *
|
const char *
|
||||||
#else
|
#else
|
||||||
char *
|
char *
|
||||||
|
@ -4748,7 +4761,8 @@ bool MyFrame::saveFile ( XmlDoc *doc, wxString& fileName, bool checkLastModified
|
||||||
if ( properties.validateAsYouType && isXml )
|
if ( properties.validateAsYouType && isXml )
|
||||||
{
|
{
|
||||||
doc->clearErrorIndicators();
|
doc->clearErrorIndicators();
|
||||||
doc->backgroundValidate ( utf8Buffer.c_str(), doc->getFullFileName().mb_str(wxConvUTF8), utf8Buffer.size() );
|
//doc->backgroundValidate ( utf8Buffer.c_str(), doc->getFullFileName().mb_str(wxConvUTF8), utf8Buffer.size() );
|
||||||
|
doc->backgroundValidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !unlimitedUndo )
|
if ( !unlimitedUndo )
|
||||||
|
@ -4950,13 +4964,13 @@ wxMenuBar *MyFrame::getMenuBar()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WAIT FOR AUI LIBRARY TO SUPPORT THIS - currently always splits left
|
/* WAIT FOR AUI LIBRARY TO SUPPORT THIS - currently always splits left
|
||||||
wxMenu *splitTabMenu = new wxMenu;
|
wxMenu *splitTabMenu = new wxMenu;
|
||||||
splitTabMenu->Append ( ID_SPLIT_TAB_TOP, _ ( "&Top" ), _ ( "Top" ));
|
splitTabMenu->Append ( ID_SPLIT_TAB_TOP, _ ( "&Top" ), _ ( "Top" ));
|
||||||
splitTabMenu->Append ( ID_SPLIT_TAB_RIGHT, _ ( "&Right" ), _ ( "Right" ));
|
splitTabMenu->Append ( ID_SPLIT_TAB_RIGHT, _ ( "&Right" ), _ ( "Right" ));
|
||||||
splitTabMenu->Append ( ID_SPLIT_TAB_BOTTOM, _ ( "&Bottom" ), _ ( "Bottom" ));
|
splitTabMenu->Append ( ID_SPLIT_TAB_BOTTOM, _ ( "&Bottom" ), _ ( "Bottom" ));
|
||||||
splitTabMenu->Append ( ID_SPLIT_TAB_LEFT, _ ( "&Left" ), _ ( "Left" ));
|
splitTabMenu->Append ( ID_SPLIT_TAB_LEFT, _ ( "&Left" ), _ ( "Left" ));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
viewMenu = new wxMenu; // use class-wide data member
|
viewMenu = new wxMenu; // use class-wide data member
|
||||||
viewMenu->Append ( ID_PREVIOUS_DOCUMENT, _ ( "&Previous Document\tCtrl+PgUp" ), _ ( "Previous Document" ) );
|
viewMenu->Append ( ID_PREVIOUS_DOCUMENT, _ ( "&Previous Document\tCtrl+PgUp" ), _ ( "Previous Document" ) );
|
||||||
|
@ -5333,11 +5347,7 @@ wxToolBar *MyFrame::getToolBar()
|
||||||
wxTB_HORIZONTAL |
|
wxTB_HORIZONTAL |
|
||||||
wxTB_DOCKABLE );
|
wxTB_DOCKABLE );
|
||||||
int w, h;
|
int w, h;
|
||||||
//#ifdef __WXMSW__
|
|
||||||
w = saveBitmap.GetWidth(), h = saveBitmap.GetHeight();
|
w = saveBitmap.GetWidth(), h = saveBitmap.GetHeight();
|
||||||
//#else
|
|
||||||
// w = h = 24;
|
|
||||||
//#endif
|
|
||||||
toolBar->SetToolBitmapSize ( wxSize ( w, h ) );
|
toolBar->SetToolBitmapSize ( wxSize ( w, h ) );
|
||||||
|
|
||||||
toolBar->AddTool (
|
toolBar->AddTool (
|
||||||
|
@ -5623,6 +5633,8 @@ void MyFrame::updatePaths()
|
||||||
applicationDir + wxFileName::GetPathSeparator() + _T ( "catalog" ) +
|
applicationDir + wxFileName::GetPathSeparator() + _T ( "catalog" ) +
|
||||||
wxFileName::GetPathSeparator() + _T ( "catalog" );
|
wxFileName::GetPathSeparator() + _T ( "catalog" );
|
||||||
catalogPath = wideCatalogPath.mb_str ( wxConvLocal );
|
catalogPath = wideCatalogPath.mb_str ( wxConvLocal );
|
||||||
|
wxString wideCatalogUtilityPath = applicationDir + wxFileName::GetPathSeparator() + _T ( "xmlcatalog" );
|
||||||
|
catalogUtilityPath = wideCatalogUtilityPath.mb_str ( wxConvLocal );
|
||||||
wxString wideXslDtdPath =
|
wxString wideXslDtdPath =
|
||||||
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
|
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
|
||||||
wxFileName::GetPathSeparator() + _T ( "xslt10.dtd" );
|
wxFileName::GetPathSeparator() + _T ( "xslt10.dtd" );
|
||||||
|
@ -5643,6 +5655,12 @@ void MyFrame::updatePaths()
|
||||||
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
|
applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) +
|
||||||
wxFileName::GetPathSeparator() + _T ( "xliff.dtd" );
|
wxFileName::GetPathSeparator() + _T ( "xliff.dtd" );
|
||||||
xliffDtdPath = wideXliffDtdPath.mb_str ( wxConvLocal );
|
xliffDtdPath = wideXliffDtdPath.mb_str ( wxConvLocal );
|
||||||
|
wxString wideAspellDataPath = applicationDir + wxFileName::GetPathSeparator() +
|
||||||
|
_T ( "aspell" ) + wxFileName::GetPathSeparator() + _T ( "data" );
|
||||||
|
aspellDataPath = wideAspellDataPath.mb_str ( wxConvLocal );
|
||||||
|
wxString wideAspellDictPath = applicationDir + wxFileName::GetPathSeparator() +
|
||||||
|
_T ( "aspell" ) + wxFileName::GetPathSeparator() + _T ( "dict" );
|
||||||
|
aspellDictPath = wideAspellDictPath.mb_str ( wxConvLocal );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAssociate ( wxCommandEvent& event )
|
void MyFrame::OnAssociate ( wxCommandEvent& event )
|
||||||
|
@ -6018,3 +6036,7 @@ void MyFrame::setStrictScrolling ( bool b )
|
||||||
( b ) ? 10 : 0 );
|
( b ) ? 10 : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::addToFileQueue ( wxString& fileName )
|
||||||
|
{
|
||||||
|
fileQueue.push_back ( fileName );
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <wx/snglinst.h>
|
#include <wx/snglinst.h>
|
||||||
#include <wx/ipc.h>
|
#include <wx/ipc.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
#include <wx/fileconf.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -184,7 +185,7 @@ class MyApp : public wxApp
|
||||||
MyClientConnection *connection;
|
MyClientConnection *connection;
|
||||||
bool singleInstanceCheck;
|
bool singleInstanceCheck;
|
||||||
int lang;
|
int lang;
|
||||||
std::auto_ptr<wxConfig> config;
|
std::auto_ptr<wxFileConfig> config;
|
||||||
};
|
};
|
||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
|
@ -203,7 +204,7 @@ class MyFrame : public wxFrame
|
||||||
public:
|
public:
|
||||||
MyFrame (
|
MyFrame (
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
wxConfig *configParameter,
|
wxFileConfig *configParameter,
|
||||||
wxLocale& locale,
|
wxLocale& locale,
|
||||||
bool singleInstanceCheck,
|
bool singleInstanceCheck,
|
||||||
int langParameter );
|
int langParameter );
|
||||||
|
@ -266,7 +267,7 @@ class MyFrame : public wxFrame
|
||||||
void OnIdle ( wxIdleEvent& event );
|
void OnIdle ( wxIdleEvent& event );
|
||||||
void OnUpdateClosePane ( wxUpdateUIEvent& event );
|
void OnUpdateClosePane ( wxUpdateUIEvent& event );
|
||||||
void OnUpdateCloseAll ( wxUpdateUIEvent& event );
|
void OnUpdateCloseAll ( wxUpdateUIEvent& event );
|
||||||
void OnUpdateSaveUndo ( wxUpdateUIEvent& event );
|
void OnUpdateUndo ( wxUpdateUIEvent& event );
|
||||||
void OnUpdatePreviousDocument ( wxUpdateUIEvent& event );
|
void OnUpdatePreviousDocument ( wxUpdateUIEvent& event );
|
||||||
void OnUpdateSavedOnly ( wxUpdateUIEvent& event );
|
void OnUpdateSavedOnly ( wxUpdateUIEvent& event );
|
||||||
void OnUpdateNextDocument ( wxUpdateUIEvent& event );
|
void OnUpdateNextDocument ( wxUpdateUIEvent& event );
|
||||||
|
@ -337,10 +338,11 @@ class MyFrame : public wxFrame
|
||||||
bool isOpen ( const wxString& fileName );
|
bool isOpen ( const wxString& fileName );
|
||||||
bool activateTab ( const wxString& fileName );
|
bool activateTab ( const wxString& fileName );
|
||||||
void reloadTab();
|
void reloadTab();
|
||||||
|
void addToFileQueue ( wxString& fileName );
|
||||||
private:
|
private:
|
||||||
wxAuiManager manager;
|
wxAuiManager manager;
|
||||||
wxConfig *config; // owned by MyApp
|
wxFileConfig *config; // owned by MyApp
|
||||||
wxLocale& myLocale;
|
wxLocale& myLocale;
|
||||||
bool singleInstanceCheck;
|
bool singleInstanceCheck;
|
||||||
int lang, lastPos;
|
int lang, lastPos;
|
||||||
wxLogNull logTarget;
|
wxLogNull logTarget;
|
||||||
|
@ -365,15 +367,15 @@ class MyFrame : public wxFrame
|
||||||
MyNotebook *mainBook;
|
MyNotebook *mainBook;
|
||||||
MyHtmlPane *htmlReport;
|
MyHtmlPane *htmlReport;
|
||||||
|
|
||||||
std::string catalogPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath,
|
std::string catalogPath, catalogUtilityPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath,
|
||||||
xliffDtdPath;
|
xliffDtdPath, aspellDataPath, aspellDictPath;
|
||||||
std::pair<int, int> controlCoordinates;
|
std::pair<int, int> controlCoordinates;
|
||||||
std::map<std::string, std::map<std::string, std::set<std::string> > >
|
std::map<std::string, std::map<std::string, std::set<std::string> > >
|
||||||
promptMap;
|
promptMap;
|
||||||
std::map<int, wxString> validationPresetMap;
|
std::map<int, wxString> validationPresetMap;
|
||||||
std::set<wxString> openFileSet;
|
std::set<wxString> openFileSet;
|
||||||
std::set<wxString> openLargeFileSet;
|
std::set<wxString> openLargeFileSet;
|
||||||
std::vector<wxString> tempFileVector;
|
std::vector<wxString> tempFileVector, fileQueue;
|
||||||
int documentCount,
|
int documentCount,
|
||||||
framePosX,
|
framePosX,
|
||||||
framePosY,
|
framePosY,
|
||||||
|
@ -385,33 +387,33 @@ class MyFrame : public wxFrame
|
||||||
wxPoint stylePosition, aboutPosition;
|
wxPoint stylePosition, aboutPosition;
|
||||||
wxSize styleSize;
|
wxSize styleSize;
|
||||||
wxString applicationDir,
|
wxString applicationDir,
|
||||||
ruleSetPreset,
|
ruleSetPreset,
|
||||||
dictionaryPreset,
|
dictionaryPreset,
|
||||||
filterPreset,
|
filterPreset,
|
||||||
ruleSetDir,
|
ruleSetDir,
|
||||||
filterDir,
|
filterDir,
|
||||||
binDir,
|
binDir,
|
||||||
templateDir,
|
templateDir,
|
||||||
helpDir,
|
helpDir,
|
||||||
rngDir,
|
rngDir,
|
||||||
htmlDir,
|
htmlDir,
|
||||||
pngDir,
|
pngDir,
|
||||||
xpathExpression,
|
xpathExpression,
|
||||||
lastDtdPublic,
|
lastDtdPublic,
|
||||||
lastDtdSystem,
|
lastDtdSystem,
|
||||||
lastSchema,
|
lastSchema,
|
||||||
lastSchemaNamespace,
|
lastSchemaNamespace,
|
||||||
lastXslStylesheet,
|
lastXslStylesheet,
|
||||||
lastSchemaNamespaceAux,
|
lastSchemaNamespaceAux,
|
||||||
lastRelaxNGSchema,
|
lastRelaxNGSchema,
|
||||||
lastDtdPublicAux,
|
lastDtdPublicAux,
|
||||||
openTabsOnClose,
|
openTabsOnClose,
|
||||||
browserCommand,
|
browserCommand,
|
||||||
layout,
|
layout,
|
||||||
defaultLayout,
|
defaultLayout,
|
||||||
lastParent,
|
lastParent,
|
||||||
lastGrandparent,
|
lastGrandparent,
|
||||||
commandString;
|
commandString;
|
||||||
bool globalReplaceAllDocuments,
|
bool globalReplaceAllDocuments,
|
||||||
toolbarVisible,
|
toolbarVisible,
|
||||||
protectTags,
|
protectTags,
|
||||||
|
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright 2005-2007 Gerald Schmidt.
|
|
||||||
*
|
|
||||||
* This file is part of Xml Copy Editor.
|
|
||||||
*
|
|
||||||
* Xml Copy Editor is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; version 2 of the License.
|
|
||||||
*
|
|
||||||
* Xml Copy Editor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Xml Copy Editor; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
|
/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
|
||||||
/* DO NOT EDIT ! */
|
/* DO NOT EDIT ! */
|
||||||
|
|
||||||
|
|
|
@ -41,5 +41,5 @@
|
||||||
"License along with this program; if not, write to the Free\n"\
|
"License along with this program; if not, write to the Free\n"\
|
||||||
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\
|
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\
|
||||||
"Boston, MA 02111-1307 USA.")
|
"Boston, MA 02111-1307 USA.")
|
||||||
#define ABOUT_VERSION _T("1.2.0")
|
#define ABOUT_VERSION _T("1.2.0.3")
|
||||||
#define XMLCE_VAR _T("XMLCE_VAR")
|
#define XMLCE_VAR _T("XMLCE_VAR")
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "xmlpromptgenerator.h"
|
#include "xmlpromptgenerator.h"
|
||||||
#include "xmlshallowvalidator.h"
|
#include "xmlshallowvalidator.h"
|
||||||
#include "xmlencodinghandler.h"
|
#include "xmlencodinghandler.h"
|
||||||
#include "wrapxerces.h"
|
//#include "wrapxerces.h"
|
||||||
#include "xmlcopyeditor.h" // needed to enable validation-as-you-type alerts
|
#include "xmlcopyeditor.h" // needed to enable validation-as-you-type alerts
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -53,6 +53,7 @@ XmlCtrl::XmlCtrl (
|
||||||
const char *buffer, // could be NULL
|
const char *buffer, // could be NULL
|
||||||
size_t bufferLen,
|
size_t bufferLen,
|
||||||
const std::string& catalogPathParameter,
|
const std::string& catalogPathParameter,
|
||||||
|
const std::string& catalogUtilityPathParameter,
|
||||||
const std::string& basePathParameter,
|
const std::string& basePathParameter,
|
||||||
const std::string& auxPathParameter,
|
const std::string& auxPathParameter,
|
||||||
const wxPoint& position,
|
const wxPoint& position,
|
||||||
|
@ -62,6 +63,7 @@ XmlCtrl::XmlCtrl (
|
||||||
protectTags ( protectTagsParameter ),
|
protectTags ( protectTagsParameter ),
|
||||||
visibilityState ( visibilityStateParameter ),
|
visibilityState ( visibilityStateParameter ),
|
||||||
catalogPath ( catalogPathParameter ),
|
catalogPath ( catalogPathParameter ),
|
||||||
|
catalogUtilityPath ( catalogUtilityPathParameter ),
|
||||||
basePath ( basePathParameter ),
|
basePath ( basePathParameter ),
|
||||||
auxPath ( auxPathParameter )
|
auxPath ( auxPathParameter )
|
||||||
{
|
{
|
||||||
|
@ -142,7 +144,6 @@ XmlCtrl::~XmlCtrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
delete validationReleasePtr;
|
delete validationReleasePtr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,7 +245,7 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
|
||||||
|
|
||||||
if ( canMoveLeftAt ( GetCurrentPos() ) )
|
if ( canMoveLeftAt ( GetCurrentPos() ) )
|
||||||
{
|
{
|
||||||
event.Skip();
|
DeleteBack();//event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,13 +270,13 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
|
||||||
if ( *protectTags )
|
if ( *protectTags )
|
||||||
adjustSelection();
|
adjustSelection();
|
||||||
else
|
else
|
||||||
event.Skip();
|
DeleteBack();//event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !properties.deleteWholeTag )
|
if ( !properties.deleteWholeTag )
|
||||||
{
|
{
|
||||||
if ( ! ( *protectTags ) )
|
if ( ! ( *protectTags ) )
|
||||||
event.Skip();
|
DeleteBack();//event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// delete tag to left of caret
|
// delete tag to left of caret
|
||||||
|
@ -352,7 +353,11 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event )
|
||||||
end = GetSelectionEnd();
|
end = GetSelectionEnd();
|
||||||
startLine = LineFromPosition ( start );
|
startLine = LineFromPosition ( start );
|
||||||
endLine = LineFromPosition ( end );
|
endLine = LineFromPosition ( end );
|
||||||
if ( startLine != endLine )
|
|
||||||
|
// add test so range unindentation only happens when caret is flush with left margin
|
||||||
|
int column = GetColumn ( GetCurrentPos() );
|
||||||
|
|
||||||
|
if ( startLine != endLine && !column)
|
||||||
{
|
{
|
||||||
if ( startLine > endLine )
|
if ( startLine > endLine )
|
||||||
{
|
{
|
||||||
|
@ -398,13 +403,13 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event )
|
||||||
if ( *protectTags )
|
if ( *protectTags )
|
||||||
adjustSelection();
|
adjustSelection();
|
||||||
else
|
else
|
||||||
event.Skip();
|
DeleteBack();//event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !properties.deleteWholeTag )
|
if ( !properties.deleteWholeTag )
|
||||||
{
|
{
|
||||||
if ( ! ( *protectTags ) )
|
if ( ! ( *protectTags ) )
|
||||||
event.Skip();
|
DeleteBack();//event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +419,7 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event )
|
||||||
{
|
{
|
||||||
if ( limitPos > ( currentPos + BUFSIZ ) )
|
if ( limitPos > ( currentPos + BUFSIZ ) )
|
||||||
{
|
{
|
||||||
event.Skip();
|
DeleteBack();//event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,7 +450,7 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event )
|
||||||
break;
|
break;
|
||||||
else if ( GetCharAt ( limitPos ) == '\n' || limitPos > ( currentPos + BUFSIZ ) )
|
else if ( GetCharAt ( limitPos ) == '\n' || limitPos > ( currentPos + BUFSIZ ) )
|
||||||
{
|
{
|
||||||
event.Skip();
|
DeleteBack();//event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1434,12 +1439,12 @@ void XmlCtrl::setColorScheme ( int scheme )
|
||||||
StyleSetBackground ( wxSTC_STYLE_DEFAULT, *wxWHITE );
|
StyleSetBackground ( wxSTC_STYLE_DEFAULT, *wxWHITE );
|
||||||
StyleClearAll();
|
StyleClearAll();
|
||||||
|
|
||||||
baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 70 );
|
baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 75 );
|
||||||
alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 90 );
|
alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 95 );
|
||||||
SetCaretLineBackground ( baseBackground );
|
SetCaretLineBackground ( baseBackground );
|
||||||
|
|
||||||
SetCaretForeground ( *wxBLACK );
|
SetCaretForeground ( *wxBLACK );
|
||||||
SetSelBackground ( true, wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) );
|
SetSelBackground ( true, LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20));//wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) );
|
||||||
|
|
||||||
if ( type == FILE_TYPE_CSS )
|
if ( type == FILE_TYPE_CSS )
|
||||||
{
|
{
|
||||||
|
@ -1501,12 +1506,12 @@ void XmlCtrl::setColorScheme ( int scheme )
|
||||||
StyleSetBackground ( wxSTC_STYLE_DEFAULT, *wxWHITE );
|
StyleSetBackground ( wxSTC_STYLE_DEFAULT, *wxWHITE );
|
||||||
StyleClearAll();
|
StyleClearAll();
|
||||||
|
|
||||||
baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20 );
|
baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 75 );
|
||||||
alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 60 );
|
alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 95 );
|
||||||
SetCaretLineBackground ( baseBackground );
|
SetCaretLineBackground ( baseBackground );
|
||||||
|
|
||||||
SetCaretForeground ( *wxBLACK );
|
SetCaretForeground ( *wxBLACK );
|
||||||
SetSelBackground ( true, wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) );
|
SetSelBackground ( true, LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20) );//wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) );
|
||||||
|
|
||||||
if ( type == FILE_TYPE_CSS )
|
if ( type == FILE_TYPE_CSS )
|
||||||
{
|
{
|
||||||
|
@ -1688,8 +1693,8 @@ void XmlCtrl::setColorScheme ( int scheme )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COLOR_SCHEME_NONE:
|
case COLOR_SCHEME_NONE:
|
||||||
baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20 );
|
baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 75 );
|
||||||
alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 60 );
|
alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 95 );
|
||||||
SetCaretLineBackground ( baseBackground );
|
SetCaretLineBackground ( baseBackground );
|
||||||
|
|
||||||
SetSelBackground ( true, wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) );
|
SetSelBackground ( true, wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) );
|
||||||
|
@ -2033,6 +2038,8 @@ bool XmlCtrl::backgroundValidate()
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
std::string bufferUtf8 = myGetTextRaw();
|
std::string bufferUtf8 = myGetTextRaw();
|
||||||
|
|
||||||
|
XmlEncodingHandler::setUtf8( bufferUtf8, true );
|
||||||
|
|
||||||
return backgroundValidate (
|
return backgroundValidate (
|
||||||
bufferUtf8.c_str(),
|
bufferUtf8.c_str(),
|
||||||
|
@ -2043,7 +2050,7 @@ bool XmlCtrl::backgroundValidate()
|
||||||
bool XmlCtrl::backgroundValidate (
|
bool XmlCtrl::backgroundValidate (
|
||||||
const char *buffer,
|
const char *buffer,
|
||||||
const char *system,
|
const char *system,
|
||||||
size_t bufferLen
|
size_t bufferLen
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !validationRequired )
|
if ( !validationRequired )
|
||||||
|
@ -2061,6 +2068,8 @@ bool XmlCtrl::backgroundValidate (
|
||||||
validationThread = new ValidationThread(
|
validationThread = new ValidationThread(
|
||||||
buffer,
|
buffer,
|
||||||
system,
|
system,
|
||||||
|
catalogPath.c_str(),
|
||||||
|
catalogUtilityPath.c_str(),
|
||||||
&validationFinished,
|
&validationFinished,
|
||||||
&validationSuccess,
|
&validationSuccess,
|
||||||
validationReleasePtr,
|
validationReleasePtr,
|
||||||
|
|
|
@ -102,6 +102,7 @@ class XmlCtrl: public wxStyledTextCtrl
|
||||||
const char *buffer = NULL,
|
const char *buffer = NULL,
|
||||||
size_t bufferLen = 0,
|
size_t bufferLen = 0,
|
||||||
const std::string& catalogPath = "",
|
const std::string& catalogPath = "",
|
||||||
|
const std::string& catalogUtilityPath = "",
|
||||||
const std::string& basePath = "",
|
const std::string& basePath = "",
|
||||||
const std::string& auxPath = "",
|
const std::string& auxPath = "",
|
||||||
const wxPoint &position = wxDefaultPosition,
|
const wxPoint &position = wxDefaultPosition,
|
||||||
|
@ -168,7 +169,7 @@ class XmlCtrl: public wxStyledTextCtrl
|
||||||
std::map<std::string, std::set<std::string> > elementMap;
|
std::map<std::string, std::set<std::string> > elementMap;
|
||||||
std::set<std::string> entitySet;
|
std::set<std::string> entitySet;
|
||||||
std::map<std::string, std::string> elementStructureMap;
|
std::map<std::string, std::string> elementStructureMap;
|
||||||
std::string catalogPath, basePath, auxPath;
|
std::string catalogPath, catalogUtilityPath, basePath, auxPath;
|
||||||
XmlCtrlProperties properties;
|
XmlCtrlProperties properties;
|
||||||
wxString getLastAttributeName ( int pos );
|
wxString getLastAttributeName ( int pos );
|
||||||
int getAttributeStartPos ( int pos );
|
int getAttributeStartPos ( int pos );
|
||||||
|
|
|
@ -31,6 +31,7 @@ XmlDoc::XmlDoc (
|
||||||
const char *buffer,
|
const char *buffer,
|
||||||
size_t bufferLen,
|
size_t bufferLen,
|
||||||
const std::string& catalogPath,
|
const std::string& catalogPath,
|
||||||
|
const std::string& catalogUtilityPath,
|
||||||
const std::string& basePath,
|
const std::string& basePath,
|
||||||
const std::string& auxPath,
|
const std::string& auxPath,
|
||||||
const wxPoint &position,
|
const wxPoint &position,
|
||||||
|
@ -46,6 +47,7 @@ XmlDoc::XmlDoc (
|
||||||
buffer,
|
buffer,
|
||||||
bufferLen, // new
|
bufferLen, // new
|
||||||
catalogPath,
|
catalogPath,
|
||||||
|
catalogUtilityPath,
|
||||||
basePath,
|
basePath,
|
||||||
auxPath,
|
auxPath,
|
||||||
position,
|
position,
|
||||||
|
|
|
@ -39,6 +39,7 @@ class XmlDoc : public XmlCtrl
|
||||||
const char *buffer = NULL,
|
const char *buffer = NULL,
|
||||||
size_t bufferLen = 0,
|
size_t bufferLen = 0,
|
||||||
const std::string& catalogPath = "",
|
const std::string& catalogPath = "",
|
||||||
|
const std::string& catalogUtilityPath = "",
|
||||||
const std::string& basePath = "",
|
const std::string& basePath = "",
|
||||||
const std::string& auxPath = "",
|
const std::string& auxPath = "",
|
||||||
const wxPoint& position = wxDefaultPosition,
|
const wxPoint& position = wxDefaultPosition,
|
||||||
|
|
|
@ -128,3 +128,4 @@ XmlEncodingHandler::getEncodingValueLimits ( const std::string& utf8 )
|
||||||
return make_pair ( -1, -1 );
|
return make_pair ( -1, -1 );
|
||||||
return make_pair ( start - buffer, end - start );
|
return make_pair ( start - buffer, end - start );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "getword.h"
|
#include "getword.h"
|
||||||
#include "pathresolver.h"
|
#include "pathresolver.h"
|
||||||
|
|
||||||
|
#undef XMLCALL
|
||||||
#include "catalogresolver.h"
|
#include "catalogresolver.h"
|
||||||
|
|
||||||
// Xerces-C req'd for Schema parsing
|
// Xerces-C req'd for Schema parsing
|
||||||
|
@ -39,6 +41,7 @@
|
||||||
#include <xercesc/validators/schema/SchemaValidator.hpp>
|
#include <xercesc/validators/schema/SchemaValidator.hpp>
|
||||||
#include <xercesc/validators/common/ContentSpecNode.hpp>
|
#include <xercesc/validators/common/ContentSpecNode.hpp>
|
||||||
#include <xercesc/validators/schema/SchemaSymbols.hpp>
|
#include <xercesc/validators/schema/SchemaSymbols.hpp>
|
||||||
|
//#include "wrapxerces.h"
|
||||||
|
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
|
|
||||||
|
@ -84,7 +87,7 @@ void XMLCALL XmlPromptGenerator::starthandler (
|
||||||
if (d->isRootElement)
|
if (d->isRootElement)
|
||||||
{
|
{
|
||||||
d->rootElement = el;
|
d->rootElement = el;
|
||||||
handleSchema ( d, el, attr );
|
handleSchema ( d, el, attr ); // experimental: schema has been pre-parsed
|
||||||
d->isRootElement = false;
|
d->isRootElement = false;
|
||||||
if ( ! (d->elementMap.empty() ) )//if ( d->elementMap.size() == 1) // must be 1 for success
|
if ( ! (d->elementMap.empty() ) )//if ( d->elementMap.size() == 1) // must be 1 for success
|
||||||
{
|
{
|
||||||
|
@ -304,7 +307,8 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler (
|
||||||
if ( publicId )
|
if ( publicId )
|
||||||
stdPublicId = publicId;
|
stdPublicId = publicId;
|
||||||
|
|
||||||
std::string stdSystemId = CatalogResolver::lookupPublicId ( stdPublicId, d->catalogPath );
|
CatalogResolver cr ( d->catalogPath );
|
||||||
|
std::string stdSystemId = cr.lookupPublicId ( stdPublicId );
|
||||||
|
|
||||||
if ( !stdSystemId.empty() )
|
if ( !stdSystemId.empty() )
|
||||||
{
|
{
|
||||||
|
@ -312,6 +316,7 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler (
|
||||||
Replace::run ( stdSystemId, "%20", " ", false );
|
Replace::run ( stdSystemId, "%20", " ", false );
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
Replace::run ( stdSystemId, "//C:/", "C:\\", false );
|
||||||
Replace::run ( stdSystemId, "/C:/", "C:\\", false );
|
Replace::run ( stdSystemId, "/C:/", "C:\\", false );
|
||||||
Replace::run ( stdSystemId, "/", "\\", false );
|
Replace::run ( stdSystemId, "/", "\\", false );
|
||||||
#endif
|
#endif
|
||||||
|
@ -523,6 +528,3 @@ void XmlPromptGenerator::handleSchema (
|
||||||
delete parser;
|
delete parser;
|
||||||
XMLPlatformUtils::Terminate();
|
XMLPlatformUtils::Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#ifndef XML_PROMPT_GENERATOR_H
|
#ifndef XML_PROMPT_GENERATOR_H
|
||||||
#define XML_PROMPT_GENERATOR_H
|
#define XML_PROMPT_GENERATOR_H
|
||||||
|
|
||||||
#include <expat.h>
|
//#include <expat.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
Loading…
Reference in New Issue