Added XSD element inspection
This commit is contained in:
parent
4bef2eea7e
commit
9ef9fd5dea
|
@ -16,7 +16,7 @@ applicationsdir = /usr/share/applications
|
|||
xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
|
||||
contexthandler.cpp globalreplacedialog.cpp housestyle.cpp \
|
||||
housestylereader.cpp myhtmlpane.cpp nocasecompare.cpp readfile.cpp \
|
||||
replace.cpp spellcheck.cpp styledialog.cpp wraplibxml.cpp \
|
||||
replace.cpp styledialog.cpp wraplibxml.cpp \
|
||||
wrapregex.cpp wraptempfilename.cpp xmlassociatedtd.cpp xmlassociatexsd.cpp \
|
||||
xmlassociatexsl.cpp xmlctrl.cpp xmldoc.cpp xmlencodinghandler.cpp xmlfilterreader.cpp \
|
||||
xmlpromptgenerator.cpp xmlrulereader.cpp xmlschemalocator.cpp xmlutf8reader.cpp xsllocator.cpp \
|
||||
|
@ -24,12 +24,12 @@ xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
|
|||
insertpanel.cpp xmlwordcount.cpp getword.cpp locationpanel.cpp catalogresolver.cpp getlinuxappdir.cpp \
|
||||
xmlparseschemans.cpp xmlshallowvalidator.cpp wrapxerces.cpp \
|
||||
findreplacepanel.cpp commandpanel.cpp \
|
||||
binaryfile.cpp xmlencodingspy.cpp \
|
||||
binaryfile.cpp xmlencodingspy.cpp wrapaspell.cpp \
|
||||
rulesets filters png rng xpm templates copying help po \
|
||||
docbook xmlcopyeditor.spec xmlcopyeditor.png custom.xpm \
|
||||
xmlcopyeditor.desktop
|
||||
xmlcopyeditor_LDFLAGS = $(WX_LIBS) \
|
||||
-lexpat -lxslt -lxml2 -lpcre -lxerces-c
|
||||
-lexpat -lxslt -lxml2 -lpcre -lxerces-c -laspell
|
||||
|
||||
nobase_xmlcopyeditor_DATA = png/*.png \
|
||||
rulesets/*.* \
|
||||
|
@ -57,6 +57,7 @@ nobase_xmlcopyeditor_DATA = png/*.png \
|
|||
copying/wxStyledTextCtrl/* copying/ximian/* \
|
||||
copying/wxStEditor/* \
|
||||
copying/xmlcopyeditor/* \
|
||||
copying/Aspell/* \
|
||||
copying/Apache/LICENSE-2.0 \
|
||||
copying/Apache/LICENSE-2_files/* \
|
||||
po/sk/messages.mo \
|
||||
|
|
|
@ -57,7 +57,7 @@ am_xmlcopyeditor_OBJECTS = xmlcopyeditor.$(OBJEXT) \
|
|||
contexthandler.$(OBJEXT) globalreplacedialog.$(OBJEXT) \
|
||||
housestyle.$(OBJEXT) housestylereader.$(OBJEXT) \
|
||||
myhtmlpane.$(OBJEXT) nocasecompare.$(OBJEXT) \
|
||||
readfile.$(OBJEXT) replace.$(OBJEXT) spellcheck.$(OBJEXT) \
|
||||
readfile.$(OBJEXT) replace.$(OBJEXT) \
|
||||
styledialog.$(OBJEXT) wraplibxml.$(OBJEXT) wrapregex.$(OBJEXT) \
|
||||
wraptempfilename.$(OBJEXT) xmlassociatedtd.$(OBJEXT) \
|
||||
xmlassociatexsd.$(OBJEXT) xmlassociatexsl.$(OBJEXT) \
|
||||
|
@ -74,7 +74,7 @@ am_xmlcopyeditor_OBJECTS = xmlcopyeditor.$(OBJEXT) \
|
|||
locationpanel.$(OBJEXT) catalogresolver.$(OBJEXT) \
|
||||
getlinuxappdir.$(OBJEXT) xmlparseschemans.$(OBJEXT) \
|
||||
xmlshallowvalidator.$(OBJEXT) wrapxerces.$(OBJEXT) \
|
||||
findreplacepanel.$(OBJEXT) \
|
||||
findreplacepanel.$(OBJEXT) wrapaspell.$(OBJEXT) \
|
||||
commandpanel.$(OBJEXT) binaryfile.$(OBJEXT) \
|
||||
xmlencodingspy.$(OBJEXT)
|
||||
xmlcopyeditor_OBJECTS = $(am_xmlcopyeditor_OBJECTS)
|
||||
|
@ -216,7 +216,7 @@ applicationsdir = /usr/share/applications
|
|||
xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
|
||||
contexthandler.cpp globalreplacedialog.cpp housestyle.cpp \
|
||||
housestylereader.cpp myhtmlpane.cpp nocasecompare.cpp readfile.cpp \
|
||||
replace.cpp spellcheck.cpp styledialog.cpp wraplibxml.cpp \
|
||||
replace.cpp styledialog.cpp wraplibxml.cpp \
|
||||
wrapregex.cpp wraptempfilename.cpp xmlassociatedtd.cpp xmlassociatexsd.cpp \
|
||||
xmlassociatexsl.cpp xmlctrl.cpp xmldoc.cpp xmlencodinghandler.cpp xmlfilterreader.cpp \
|
||||
xmlpromptgenerator.cpp xmlrulereader.cpp xmlschemalocator.cpp xmlutf8reader.cpp xsllocator.cpp \
|
||||
|
@ -224,13 +224,13 @@ xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
|
|||
insertpanel.cpp xmlwordcount.cpp getword.cpp locationpanel.cpp catalogresolver.cpp getlinuxappdir.cpp \
|
||||
xmlparseschemans.cpp xmlshallowvalidator.cpp wrapxerces.cpp \
|
||||
findreplacepanel.cpp commandpanel.cpp \
|
||||
binaryfile.cpp xmlencodingspy.cpp \
|
||||
binaryfile.cpp xmlencodingspy.cpp wrapaspell.cpp \
|
||||
rulesets filters png rng xpm templates copying help po \
|
||||
xmlcopyeditor.spec xmlcopyeditor.png custom.xpm \
|
||||
xmlcopyeditor.desktop
|
||||
|
||||
xmlcopyeditor_LDFLAGS = $(WX_LIBS) \
|
||||
-lexpat -lxslt -lxml2 -lpcre -lxerces-c
|
||||
-lexpat -lxslt -lxml2 -lpcre -lxerces-c -laspell
|
||||
|
||||
nobase_xmlcopyeditor_DATA = png/*.png \
|
||||
rulesets/*.* \
|
||||
|
@ -249,6 +249,7 @@ nobase_xmlcopyeditor_DATA = png/*.png \
|
|||
copying/wxStyledTextCtrl/* copying/ximian/* \
|
||||
copying/wxStEditor/* \
|
||||
copying/xmlcopyeditor/* \
|
||||
copying/Aspell/* \
|
||||
copying/Apache/LICENSE-2.0 \
|
||||
copying/Apache/LICENSE-2_files/* \
|
||||
po/sk/messages.mo \
|
||||
|
@ -358,7 +359,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readfile.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replace.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rule.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spellcheck.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/styledialog.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapexpat.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wraplibxml.Po@am__quote@
|
||||
|
|
|
@ -101,6 +101,7 @@ void InsertPanel::update (
|
|||
list->Clear();
|
||||
lastDoc = doc;
|
||||
std::set<std::string> entitySet = doc->getEntitySet();
|
||||
entitySet.insert ( "amp" );
|
||||
entitySet.insert ( "apos" );
|
||||
entitySet.insert ( "gt" );
|
||||
entitySet.insert ( "lt" );
|
||||
|
|
|
@ -47,28 +47,23 @@ LocationPanel::LocationPanel ( wxWindow *parentWindowParameter, int id ) :
|
|||
boldFont.SetWeight ( wxFONTWEIGHT_BOLD );
|
||||
edit->SetFont ( boldFont );
|
||||
|
||||
/*
|
||||
wxStaticText *label = new wxStaticText(
|
||||
structureEdit = new wxStyledTextCtrl (
|
||||
this,
|
||||
wxID_ANY,
|
||||
_("Attributes"),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize);
|
||||
|
||||
list = new wxListBox(
|
||||
this,
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
0,
|
||||
NULL,
|
||||
wxLB_SORT | wxLB_HSCROLL);
|
||||
*/
|
||||
for (int i = 0 ; i < 3; i++ )
|
||||
structureEdit->SetMarginWidth ( i, 0 );
|
||||
structureEdit->SetReadOnly ( true );
|
||||
//structureEdit->SetWrapMode ( wxSTC_WRAP_WORD );
|
||||
//structureEdit->SetWrapVisualFlags ( wxSTC_WRAPVISUALFLAG_START );
|
||||
structureEdit->SetTabWidth ( 2 );
|
||||
structureEdit->SetIndentationGuides ( true );
|
||||
|
||||
sizer->Add ( edit, 0, wxGROW | wxTOP, 0 );
|
||||
//sizer->Add(label, 0, wxGROW | wxTOP, 10);
|
||||
//sizer->Add(list, 0, wxGROW | wxTOP, 0);
|
||||
sizer->Add ( structureEdit, 0, wxGROW | wxTOP, 0 );
|
||||
sizer->Layout();
|
||||
structureEdit->Show ( false );
|
||||
}
|
||||
|
||||
void LocationPanel::update (
|
||||
|
@ -78,8 +73,109 @@ void LocationPanel::update (
|
|||
doc = docParameter;
|
||||
parent = parentParameter;
|
||||
wxString previous = edit->GetValue();
|
||||
|
||||
if ( !doc )
|
||||
{
|
||||
edit->SetValue ( wxEmptyString );
|
||||
structureEdit->Show ( false );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string structure = doc->getElementStructure ( parent );
|
||||
|
||||
if (!structure.empty () )
|
||||
{
|
||||
indentStructure( structure );
|
||||
structureEdit->Show ( true );
|
||||
wxString wideStructure = wxString ( structure.c_str(), wxConvUTF8, structure.size() );
|
||||
structureEdit->SetReadOnly ( false );
|
||||
structureEdit->SetText ( wideStructure );
|
||||
structureEdit->SetReadOnly ( true );
|
||||
|
||||
wxSize clientSize = GetClientSize();
|
||||
wxSize editSize = edit->GetSize();
|
||||
wxSize structureSize =
|
||||
wxSize ( clientSize.GetWidth(), clientSize.GetHeight() - editSize.GetHeight() );
|
||||
|
||||
if ( clientSize.IsFullySpecified() && editSize.IsFullySpecified() )
|
||||
structureEdit->SetSize ( structureSize );
|
||||
structureEdit->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
structureEdit->Show ( false );
|
||||
}
|
||||
}
|
||||
|
||||
if ( parentParameter == previous )
|
||||
return;
|
||||
previous = parentParameter;
|
||||
edit->SetValue ( parent );
|
||||
|
||||
}
|
||||
|
||||
void LocationPanel::indentStructure ( std::string& structure )
|
||||
{
|
||||
std::string indented;
|
||||
char *s = (char *) structure.c_str();
|
||||
int indent = 0;
|
||||
char *indentMark = "\t";
|
||||
|
||||
int count = 0;
|
||||
bool justSeenContent = false;
|
||||
for ( ; *s; s++, count++)
|
||||
{
|
||||
if (*s == '(')
|
||||
{
|
||||
if ( count && justSeenContent )
|
||||
{
|
||||
indented += '\n';
|
||||
}
|
||||
else if (!justSeenContent)
|
||||
indented += *s;
|
||||
for ( int i = 0; i < indent; i++ )
|
||||
{
|
||||
indented += indentMark;
|
||||
}
|
||||
if (justSeenContent)
|
||||
indented += *s;
|
||||
|
||||
indent++;
|
||||
|
||||
indented += '\n';
|
||||
|
||||
for (int i = 0; indent && i < indent; i++)
|
||||
indented += indentMark;
|
||||
justSeenContent = false;
|
||||
}
|
||||
else if (*s == ')')
|
||||
{
|
||||
if ( justSeenContent )
|
||||
{
|
||||
indented += '\n';
|
||||
}
|
||||
indent--;
|
||||
for (int i = 0; indent && i < indent; i++)
|
||||
indented += indentMark;
|
||||
indented += *s;
|
||||
indented += '\n';
|
||||
if (*( s + 1 ) && *(s + 1) != ')' )
|
||||
{
|
||||
for (int i = 0; i < indent; i++)
|
||||
indented += indentMark;
|
||||
}
|
||||
justSeenContent = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( *s == '|' && justSeenContent)
|
||||
indented += ' ';
|
||||
indented += *s;
|
||||
if ( *s == ',' || *s == '|' )
|
||||
indented += ' ';
|
||||
justSeenContent = true;
|
||||
}
|
||||
}
|
||||
structure = indented;
|
||||
}
|
||||
|
|
|
@ -34,11 +34,12 @@ class LocationPanel : public wxPanel
|
|||
XmlDoc *docParameter = NULL,
|
||||
const wxString& parent = wxEmptyString );
|
||||
private:
|
||||
void indentStructure ( std::string& structure );
|
||||
MyFrame *parentWindow;
|
||||
XmlDoc *doc;
|
||||
wxBoxSizer *sizer;
|
||||
wxTextCtrl *edit;
|
||||
//wxListBox *list;
|
||||
wxStyledTextCtrl *structureEdit;
|
||||
wxString parent;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
@ -115,13 +115,13 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame )
|
|||
EVT_MENU ( ID_REPLACE, MyFrame::OnFindReplace )
|
||||
EVT_MENU ( ID_GLOBAL_REPLACE, MyFrame::OnGlobalReplace )
|
||||
EVT_MENU ( ID_CHECK_WELLFORMED, MyFrame::OnCheckWellformedness )
|
||||
//EVT_MENU ( ID_VALIDATE_DTD, MyFrame::OnValidateDTD )
|
||||
EVT_MENU ( ID_VALIDATE_RELAX_NG, MyFrame::OnValidateRelaxNG )
|
||||
EVT_MENU ( ID_VALIDATE_W3C_SCHEMA, MyFrame::OnValidateSchema )
|
||||
EVT_MENU ( ID_XPATH, MyFrame::OnXPath )
|
||||
EVT_MENU_RANGE ( ID_XSLT, ID_XSLT_WORDML_DOCBOOK, MyFrame::OnXslt )
|
||||
EVT_MENU ( ID_PRETTYPRINT, MyFrame::OnPrettyPrint )
|
||||
EVT_MENU ( ID_ENCODING, MyFrame::OnEncoding )
|
||||
EVT_MENU ( ID_STYLE, MyFrame::OnSpelling )
|
||||
EVT_MENU ( ID_SPELL, MyFrame::OnSpelling )
|
||||
EVT_MENU ( ID_FONT_SMALLER, MyFrame::OnFontSmaller )
|
||||
EVT_MENU ( ID_FONT_NORMAL, MyFrame::OnFontMedium )
|
||||
|
@ -280,7 +280,7 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
|
|||
wxLocale::AddCatalogLookupPathPrefix ( wxT ( ".." ) );
|
||||
|
||||
#ifndef __WXMSW__
|
||||
wxString poDir = GetLinuxAppDir::run() + wxFileName::GetPathSeparator() + _T ( "po" );
|
||||
wxString poDir = GetLinuxAppDir::run() + wxFileName::GetPathSeparator() + _T ( "po" ) + wxFileName::GetPathSeparator();
|
||||
wxLocale::AddCatalogLookupPathPrefix ( poDir );
|
||||
#endif
|
||||
|
||||
|
@ -642,7 +642,10 @@ MyFrame::MyFrame (
|
|||
commandString = config->Read ( _T ( "commandString" ), wxEmptyString );
|
||||
|
||||
ruleSetPreset =
|
||||
config->Read ( _T ( "ruleSetPreset" ), _ ( "Default dictionary and style" ) );
|
||||
config->Read ( _T ( "ruleSetPreset" ), _ ( "Default style" ) );
|
||||
dictionaryPreset =
|
||||
config->Read ( _T ( "dictionaryPreset" ), _ ( "en_US" ) );
|
||||
|
||||
filterPreset =
|
||||
config->Read ( _T ( "filterPreset" ), _ ( "(No filter)" ) );
|
||||
findData.SetFindString ( config->Read ( _T ( "findReplaceFind" ), _T ( "" ) ) );
|
||||
|
@ -691,7 +694,8 @@ MyFrame::MyFrame (
|
|||
#else
|
||||
applicationDir = GetLinuxAppDir::run();//getLinuxApplicationDir();
|
||||
#endif
|
||||
ruleSetPreset = _ ( "Default dictionary and style" );
|
||||
ruleSetPreset = _ ( "Default style" );
|
||||
dictionaryPreset = _ ( "en_US" );
|
||||
filterPreset = _ ( "No filter" );
|
||||
xpathExpression = lastXslStylesheet = lastRelaxNGSchema = wxEmptyString;
|
||||
findRegex = true;
|
||||
|
@ -960,6 +964,7 @@ MyFrame::~MyFrame()
|
|||
config->Write ( _T ( "highlightSyntax" ), properties.highlightSyntax );
|
||||
config->Write ( _T ( "applicationDir" ), applicationDir );
|
||||
config->Write ( _T ( "ruleSetPreset" ), ruleSetPreset );
|
||||
config->Write ( _T ( "dictionaryPreset" ), dictionaryPreset );
|
||||
config->Write ( _T ( "filterPreset" ), filterPreset );
|
||||
config->Write ( _T ( "xpathExpression" ), xpathExpression );
|
||||
config->Write ( _T ( "findReplaceFind" ), findData.GetFindString() );
|
||||
|
@ -1208,7 +1213,7 @@ void MyFrame::OnAbout ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
|
||||
void MyFrame::OnCheckWellformedness ( wxCommandEvent& event )
|
||||
{
|
||||
statusProgress ( wxEmptyString );
|
||||
statusProgress ( wxEmptyString );
|
||||
XmlDoc *doc;
|
||||
if ( ( doc = getActiveDocument() ) == NULL )
|
||||
return;
|
||||
|
@ -1799,17 +1804,11 @@ void MyFrame::OnDialogReplace ( wxFindDialogEvent& event )
|
|||
if ( findReplacePanel->getRegex() )
|
||||
{
|
||||
regexWidth = doc->ReplaceTargetRE ( event.GetReplaceString() );
|
||||
//doc->SetTargetStart(newLocation + regexWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
doc->ReplaceTarget ( event.GetReplaceString() );
|
||||
//doc->SetTargetStart(newLocation + event.GetReplaceString().size());
|
||||
}
|
||||
/*
|
||||
if (doc->GetSelectionStart() != doc->GetSelectionEnd())
|
||||
doc->ReplaceSelection(event.GetReplaceString());
|
||||
*/
|
||||
OnDialogFind ( event );
|
||||
}
|
||||
|
||||
|
@ -1943,7 +1942,7 @@ wxString MyFrame::getHtmlBuffer()
|
|||
startOfLine = true;
|
||||
break;
|
||||
case L'&':
|
||||
htmlBuffer + _T ( "&" );
|
||||
htmlBuffer + _T ( "&" );
|
||||
startOfLine = false;
|
||||
break;
|
||||
default:
|
||||
|
@ -3214,7 +3213,7 @@ void MyFrame::OnRevert ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
doc->SetFocus();
|
||||
}
|
||||
|
||||
void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
|
||||
void MyFrame::OnSpelling ( wxCommandEvent& event )
|
||||
{
|
||||
XmlDoc *doc;
|
||||
if ( ( doc = getActiveDocument() ) == NULL )
|
||||
|
@ -3228,6 +3227,10 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
doc->SetUndoCollection ( true );
|
||||
#endif
|
||||
|
||||
int id, type;
|
||||
id = event.GetId();
|
||||
type = (id == ID_STYLE) ? ID_TYPE_STYLE : ID_TYPE_SPELL;
|
||||
|
||||
|
||||
std::string rawBufferUtf8;
|
||||
getRawText ( doc, rawBufferUtf8 );
|
||||
|
@ -3259,7 +3262,7 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
statusProgress ( wxEmptyString );
|
||||
std::string error = wl->getLastError();
|
||||
wxString wideError = wxString ( error.c_str(), wxConvUTF8, error.size() );
|
||||
wideError.Prepend ( _ ( "Opening spelling and style check in read-only mode: " ) );
|
||||
wideError.Prepend ( _ ( "Checking document in read-only mode: " ) );
|
||||
messagePane ( wideError, CONST_WARNING );
|
||||
|
||||
if ( !ReadFile::run ( tempFileName.name(), bufferParameterUtf8 ) )
|
||||
|
@ -3282,8 +3285,9 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
ruleSetDir,
|
||||
filterDir,
|
||||
browserCommand,
|
||||
ruleSetPreset,
|
||||
( type == ID_TYPE_SPELL ) ? dictionaryPreset : ruleSetPreset,
|
||||
filterPreset,
|
||||
type,
|
||||
( success ) ? false : true,
|
||||
stylePosition,
|
||||
styleSize ) );
|
||||
|
@ -3296,10 +3300,16 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
else
|
||||
doc->SetTextRaw ( bufferUtf8.c_str() );
|
||||
}
|
||||
|
||||
// update presets if report has been created (even if followed by cancel)
|
||||
ruleSetPreset = sd->getRuleSetPreset();
|
||||
filterPreset = sd->getFilterPreset();
|
||||
|
||||
if (type == ID_TYPE_STYLE)
|
||||
{
|
||||
ruleSetPreset = sd->getRuleSetPreset();
|
||||
filterPreset = sd->getFilterPreset();
|
||||
}
|
||||
else
|
||||
dictionaryPreset = sd->getRuleSetPreset();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
stylePosition = sd->getPosition();
|
||||
styleSize = sd->getSize();
|
||||
|
@ -5087,6 +5097,7 @@ wxMenuBar *MyFrame::getMenuBar()
|
|||
}
|
||||
|
||||
// xsl menu
|
||||
/*
|
||||
wxMenu *xslMenu = new wxMenu;
|
||||
xslMenu->Append ( ID_XSLT, _ ( "&XSL Transform...\tF8" ),
|
||||
_ ( "XSL Transform..." ) );
|
||||
|
@ -5112,6 +5123,7 @@ wxMenuBar *MyFrame::getMenuBar()
|
|||
xslMenu->Append (
|
||||
ID_XSLT_TEI_FO,
|
||||
_ ( "TEI to &XSL-FO\tAlt+7" ), _ ( "TEI to XSL-FO" ) );
|
||||
*/
|
||||
|
||||
// xml menu
|
||||
xmlMenu = new wxMenu; // use class-wide data member
|
||||
|
@ -5128,7 +5140,8 @@ wxMenuBar *MyFrame::getMenuBar()
|
|||
_ ( "&Associate" ),
|
||||
associateMenu );
|
||||
xmlMenu->AppendSeparator();
|
||||
xmlMenu->Append ( wxID_ANY, _ ( "&XSLT" ), xslMenu );
|
||||
xmlMenu->Append ( ID_XSLT, _ ( "&XSL Transform...\tF8" ),
|
||||
_ ( "XSL Transform..." ) );
|
||||
xmlMenu->Append (
|
||||
ID_XPATH,
|
||||
_ ( "&Evaluate XPath...\tF9" ),
|
||||
|
@ -5156,9 +5169,17 @@ wxMenuBar *MyFrame::getMenuBar()
|
|||
new wxMenuItem (
|
||||
NULL,
|
||||
ID_SPELL,
|
||||
_ ( "&Spelling and Style...\tF7" ),
|
||||
_ ( "Spelling and Style..." ) );
|
||||
_ ( "&Spelling...\tF7" ),
|
||||
_ ( "Spelling..." ) );
|
||||
spellingItem->SetBitmap ( spelling16Bitmap );
|
||||
|
||||
wxMenuItem *styleItem =
|
||||
new wxMenuItem (
|
||||
NULL,
|
||||
ID_STYLE,
|
||||
_ ( "&Style...\tShift+F7" ),
|
||||
_ ( "Style..." ) );
|
||||
styleItem->SetBitmap ( wxNullBitmap );
|
||||
|
||||
wxMenuItem *wordCountItem =
|
||||
new wxMenuItem (
|
||||
|
@ -5177,6 +5198,7 @@ wxMenuBar *MyFrame::getMenuBar()
|
|||
commandItem->SetBitmap ( wxNullBitmap );
|
||||
|
||||
toolsMenu->Append ( spellingItem );
|
||||
toolsMenu->Append ( styleItem );
|
||||
toolsMenu->Append ( wordCountItem );
|
||||
toolsMenu->AppendSeparator();
|
||||
toolsMenu->Append ( commandItem );
|
||||
|
@ -5386,11 +5408,11 @@ wxToolBar *MyFrame::getToolBar()
|
|||
_ ( "Browser" ) );
|
||||
toolBar->AddTool (
|
||||
ID_SPELL,
|
||||
_ ( "Spelling and Style" ),
|
||||
_ ( "Spelling" ),
|
||||
spellingBitmap,
|
||||
wxNullBitmap,
|
||||
wxITEM_NORMAL,
|
||||
_ ( "Spelling and Style" ) );
|
||||
_ ( "Spelling" ) );
|
||||
|
||||
toolBar->AddCheckTool (
|
||||
ID_PROTECT_TAGS,
|
||||
|
|
|
@ -139,6 +139,7 @@ enum
|
|||
ID_PRETTYPRINT,
|
||||
ID_ENCODING,
|
||||
ID_SPELL,
|
||||
ID_STYLE,
|
||||
ID_FONT_SMALLER,
|
||||
ID_FONT_NORMAL,
|
||||
ID_FONT_LARGER,
|
||||
|
@ -253,6 +254,7 @@ class MyFrame : public wxFrame
|
|||
void OnUndo ( wxCommandEvent& event );
|
||||
void OnRedo ( wxCommandEvent& event );
|
||||
void OnSpelling ( wxCommandEvent& event );
|
||||
//void OnStyle ( wxCommandEvent& event );
|
||||
void OnPreviousDocument ( wxCommandEvent& event );
|
||||
void OnNextDocument ( wxCommandEvent& event );
|
||||
void OnOptions ( wxCommandEvent& event );
|
||||
|
@ -384,6 +386,7 @@ class MyFrame : public wxFrame
|
|||
wxSize styleSize;
|
||||
wxString applicationDir,
|
||||
ruleSetPreset,
|
||||
dictionaryPreset,
|
||||
filterPreset,
|
||||
ruleSetDir,
|
||||
filterDir,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%define name xmlcopyeditor
|
||||
%define version 1.1.0.5
|
||||
%define version 1.1.0.6
|
||||
%define release 1
|
||||
%define author Gerald Schmidt <gnschmidt@users.sourceforge.net>
|
||||
%define prefix /usr/local
|
||||
|
|
|
@ -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.1.0.5")
|
||||
#define ABOUT_VERSION _T("1.1.0.6")
|
||||
#define XMLCE_VAR _T("XMLCE_VAR")
|
||||
|
|
|
@ -59,9 +59,6 @@ XmlCtrl::XmlCtrl (
|
|||
basePath ( basePathParameter ),
|
||||
auxPath ( auxPathParameter )
|
||||
{
|
||||
//SetEOLMode ( wxSTC_EOL_LF );
|
||||
//SetPasteConvertEndings ( true );
|
||||
|
||||
currentMaxLine = 1;
|
||||
validationRequired = grammarFound = false;
|
||||
|
||||
|
@ -107,7 +104,7 @@ XmlCtrl::XmlCtrl (
|
|||
applyVisibilityState ( visibilityState );
|
||||
lineBackgroundState = BACKGROUND_STATE_NORMAL;
|
||||
|
||||
for ( int i = 0; i < wxSTC_INDIC_MAX; ++i ) // start from 1 to disable faulty default indication
|
||||
for ( int i = 0; i < wxSTC_INDIC_MAX; ++i )
|
||||
IndicatorSetStyle ( i, wxSTC_INDIC_HIDDEN );
|
||||
IndicatorSetStyle ( 2, wxSTC_INDIC_SQUIGGLE );
|
||||
IndicatorSetForeground ( 0, *wxRED );
|
||||
|
@ -202,7 +199,6 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
|
|||
|
||||
// tag
|
||||
int limitStyle = getLexerStyleAt ( limitPos );
|
||||
//limitStyle &= ~wxSTC_INDIC2_MASK;
|
||||
if ( GetCharAt ( limitPos ) == '>' &&
|
||||
( limitStyle == wxSTC_H_TAG ||
|
||||
limitStyle == wxSTC_H_TAGUNKNOWN ||
|
||||
|
@ -230,7 +226,7 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
|
|||
GetCharAt ( limitPos ) != '<';
|
||||
limitPos-- )
|
||||
;
|
||||
SetSelection ( currentPos, limitPos );//(limitPos, currentPos);
|
||||
SetSelection ( currentPos, limitPos );
|
||||
if ( *protectTags )
|
||||
{
|
||||
SetReadOnly ( true ); // needed to prevent erroneous BS insertion by control
|
||||
|
@ -250,8 +246,8 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
|
|||
DeleteBack();
|
||||
return;
|
||||
}
|
||||
// entity reference
|
||||
|
||||
// entity reference
|
||||
else if ( GetCharAt ( limitPos ) == ';' && getLexerStyleAt ( limitPos ) == wxSTC_H_ENTITY )
|
||||
{
|
||||
// delete entity to left of caret
|
||||
|
@ -437,7 +433,6 @@ void XmlCtrl::handleOpenAngleBracket ( wxKeyEvent& event )
|
|||
|
||||
// exit conditions based on style
|
||||
int style = getLexerStyleAt ( pos );
|
||||
//style &= ~wxSTC_INDIC2_MASK;
|
||||
switch ( style )
|
||||
{
|
||||
case wxSTC_H_DOUBLESTRING:
|
||||
|
@ -611,7 +606,6 @@ void XmlCtrl::handleSpace ( wxKeyEvent& event )
|
|||
}
|
||||
|
||||
int style = getLexerStyleAt ( pos - 1 );
|
||||
//style &= ~wxSTC_INDIC2_MASK;
|
||||
|
||||
char c = GetCharAt ( pos - 1 );
|
||||
|
||||
|
@ -748,8 +742,7 @@ void XmlCtrl::OnKeyPressed ( wxKeyEvent& event )
|
|||
if ( *protectTags )
|
||||
SetOvertype ( false );
|
||||
|
||||
//bool autoindent;
|
||||
int pos, iteratorPos, maxPos; // omitted startPos, line, newPos
|
||||
int pos, iteratorPos, maxPos;
|
||||
char c;
|
||||
wxString s;
|
||||
switch ( event.GetKeyCode() )
|
||||
|
@ -995,7 +988,6 @@ int XmlCtrl::getParentCloseAngleBracket ( int pos, int range )
|
|||
{
|
||||
int type, style;
|
||||
style = getLexerStyleAt ( iteratorPos );
|
||||
//style &= ~wxSTC_INDIC2_MASK;
|
||||
|
||||
if ( GetCharAt ( iteratorPos ) == '>' &&
|
||||
( style == wxSTC_H_TAG ||
|
||||
|
@ -1015,7 +1007,6 @@ int XmlCtrl::getParentCloseAngleBracket ( int pos, int range )
|
|||
case ( TAG_TYPE_ERROR ) :
|
||||
break;
|
||||
}
|
||||
//(isCloseTag(iteratorPos)) ? ++depth : --depth;
|
||||
if ( !depth )
|
||||
return iteratorPos;
|
||||
}
|
||||
|
@ -1058,6 +1049,7 @@ void XmlCtrl::updatePromptMaps ( const char *buffer, size_t bufferLen )
|
|||
{
|
||||
attributeMap.clear();
|
||||
elementMap.clear();
|
||||
elementStructureMap.clear();
|
||||
std::auto_ptr<XmlPromptGenerator> xpg ( new XmlPromptGenerator (
|
||||
catalogPath,
|
||||
basePath,
|
||||
|
@ -1066,8 +1058,10 @@ void XmlCtrl::updatePromptMaps ( const char *buffer, size_t bufferLen )
|
|||
xpg->getAttributeMap ( attributeMap );
|
||||
xpg->getRequiredAttributeMap ( requiredAttributeMap );
|
||||
xpg->getElementMap ( elementMap );
|
||||
xpg->getElementStructureMap ( elementStructureMap );
|
||||
xpg->getEntitySet ( entitySet );
|
||||
grammarFound = xpg->getGrammarFound();
|
||||
entitySet.insert ( "amp" );
|
||||
entitySet.insert ( "apos" );
|
||||
entitySet.insert ( "quot" );
|
||||
entitySet.insert ( "lt" );
|
||||
|
@ -1264,7 +1258,6 @@ bool XmlCtrl::canInsertAt ( int pos )
|
|||
return false;
|
||||
|
||||
int style = getLexerStyleAt ( pos );
|
||||
//style &= ~wxSTC_INDIC2_MASK;
|
||||
switch ( style )
|
||||
{
|
||||
case wxSTC_H_TAG:
|
||||
|
@ -1285,7 +1278,6 @@ bool XmlCtrl::canInsertAt ( int pos )
|
|||
bool XmlCtrl::canMoveRightAt ( int pos )
|
||||
{
|
||||
int style = getLexerStyleAt ( pos );
|
||||
//style &= ~wxSTC_INDIC2_MASK;
|
||||
switch ( style )
|
||||
{
|
||||
case wxSTC_H_DEFAULT:
|
||||
|
@ -1300,7 +1292,6 @@ bool XmlCtrl::canMoveLeftAt ( int pos )
|
|||
return false;
|
||||
|
||||
int style = getLexerStyleAt ( pos - 1 );
|
||||
//style &= ~wxSTC_INDIC2_MASK;
|
||||
switch ( style )
|
||||
{
|
||||
case wxSTC_H_DEFAULT:
|
||||
|
@ -1743,10 +1734,6 @@ void XmlCtrl::toggleFold()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// was previously (changed so cursor doesn't have to be in headline):
|
||||
// if ( XMLCTRL_HASBIT ( level, wxSTC_FOLDLEVELHEADERFLAG ) )
|
||||
// ToggleFold ( line );
|
||||
}
|
||||
|
||||
// adapted from wxSTEdit (c) 2005 John Labenski, Otto Wyss
|
||||
|
@ -1835,7 +1822,6 @@ bool XmlCtrl::insertChild ( const wxString& child )
|
|||
{
|
||||
if ( !canInsertAt ( start ) )
|
||||
return false;
|
||||
//tag = _T("<") + child + _T(">");
|
||||
offset = openTag.Length();
|
||||
|
||||
wxString tag;
|
||||
|
@ -1847,9 +1833,6 @@ bool XmlCtrl::insertChild ( const wxString& child )
|
|||
}
|
||||
if ( *protectTags )
|
||||
adjustSelection();
|
||||
//wxString openTag, closeTag;
|
||||
//openTag = _T("<") + child + _T(">");
|
||||
//closeTag = _T("</") + child + _T(">");
|
||||
offset = openTag.Length();
|
||||
if ( start > end )
|
||||
{
|
||||
|
@ -1958,6 +1941,28 @@ std::set<std::string> XmlCtrl::getEntitySet()
|
|||
return entitySet;
|
||||
}
|
||||
|
||||
std::set<std::string> XmlCtrl::getAttributes ( const wxString& parent )
|
||||
{
|
||||
std::set<std::string> retVal;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
std::string XmlCtrl::getElementStructure ( const wxString& element )
|
||||
{
|
||||
std::string stdElement, ret;
|
||||
stdElement = element.mb_str ( wxConvUTF8);
|
||||
|
||||
if ( elementStructureMap.find ( stdElement ) == elementStructureMap.end() )
|
||||
{
|
||||
ret = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = elementStructureMap[stdElement];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool XmlCtrl::shallowValidate ( int maxLine, bool segmentOnly )
|
||||
{
|
||||
if ( !properties.validateAsYouType || type != FILE_TYPE_XML )
|
||||
|
|
|
@ -98,7 +98,6 @@ class XmlCtrl: public wxStyledTextCtrl
|
|||
int visibilityStateParameter = SHOW_TAGS,
|
||||
int typeParameter = FILE_TYPE_XML,
|
||||
wxWindowID id = wxID_ANY,
|
||||
//const std::string& buffer = DEFAULT_XML_DECLARATION_UTF8,
|
||||
const char *buffer = NULL,
|
||||
size_t bufferLen = 0,
|
||||
const std::string& catalogPath = "",
|
||||
|
@ -136,6 +135,8 @@ class XmlCtrl: public wxStyledTextCtrl
|
|||
wxString getLastElementName ( int pos );
|
||||
std::set<wxString> getChildren ( const wxString& parent );
|
||||
std::set<std::string> getEntitySet();
|
||||
std::set<std::string> getAttributes ( const wxString& parent );
|
||||
std::string getElementStructure ( const wxString& parent );
|
||||
bool canInsertAt ( int pos );
|
||||
int getTagStartPos ( int pos );
|
||||
void toggleLineBackground();
|
||||
|
@ -162,6 +163,7 @@ class XmlCtrl: public wxStyledTextCtrl
|
|||
std::map<std::string, std::set<std::string> > requiredAttributeMap;
|
||||
std::map<std::string, std::set<std::string> > elementMap;
|
||||
std::set<std::string> entitySet;
|
||||
std::map<std::string, std::string> elementStructureMap;
|
||||
std::string catalogPath, basePath, auxPath;
|
||||
XmlCtrlProperties properties;
|
||||
wxString getLastAttributeName ( int pos );
|
||||
|
|
|
@ -50,6 +50,7 @@ XmlPromptGenerator::XmlPromptGenerator (
|
|||
XML_SetUserData ( p, d.get() );
|
||||
d->p = p;
|
||||
d->catalogPath = catalogPath;
|
||||
d->basePath = basePath;
|
||||
d->auxPath = auxPath;
|
||||
d->elementDeclRecurseLevel = 0;
|
||||
d->isRootElement = true;
|
||||
|
@ -166,6 +167,12 @@ void XmlPromptGenerator::getEntitySet (
|
|||
entitySet = d->entitySet;
|
||||
}
|
||||
|
||||
void XmlPromptGenerator::getElementStructureMap (
|
||||
std::map<std::string, std::string> &elementStructureMap )
|
||||
{
|
||||
elementStructureMap = d->elementStructureMap;
|
||||
}
|
||||
|
||||
// handlers for DOCTYPE handling
|
||||
|
||||
void XMLCALL XmlPromptGenerator::doctypedeclstarthandler (
|
||||
|
@ -303,10 +310,15 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler (
|
|||
{
|
||||
Replace::run ( stdSystemId, "file://", "", false );
|
||||
Replace::run ( stdSystemId, "%20", " ", false );
|
||||
|
||||
#ifdef __WXMSW__
|
||||
Replace::run ( stdSystemId, "/C:/", "C:\\", false );
|
||||
Replace::run ( stdSystemId, "/", "\\", false );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (systemId )
|
||||
if ( systemId )
|
||||
stdSystemId = systemId;
|
||||
if ( base )
|
||||
{
|
||||
|
@ -317,7 +329,7 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler (
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( !stdSystemId.empty() )
|
||||
{
|
||||
ReadFile::run ( stdSystemId, buffer );
|
||||
|
@ -396,7 +408,10 @@ void XmlPromptGenerator::handleSchema (
|
|||
{
|
||||
return;
|
||||
}
|
||||
std::string schemaPath = PathResolver::run ( path, d->auxPath );
|
||||
|
||||
|
||||
std::string schemaPath = PathResolver::run ( path, ( d->auxPath.empty() ) ? d->basePath : d->auxPath);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -417,7 +432,8 @@ void XmlPromptGenerator::handleSchema (
|
|||
if ( !rootGrammar )
|
||||
{
|
||||
delete parser;
|
||||
return;
|
||||
XMLPlatformUtils::Terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
SchemaGrammar* grammar = ( SchemaGrammar* ) rootGrammar;
|
||||
|
@ -427,7 +443,7 @@ void XmlPromptGenerator::handleSchema (
|
|||
{
|
||||
delete grammar;
|
||||
delete parser;
|
||||
|
||||
XMLPlatformUtils::Terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -451,7 +467,11 @@ void XmlPromptGenerator::handleSchema (
|
|||
{
|
||||
size_t len;
|
||||
char *s, *word;
|
||||
std::string structure;
|
||||
s = ( char * ) XMLString::transcode ( fmtCntModel );
|
||||
|
||||
structure = s;
|
||||
d->elementStructureMap.insert ( make_pair ( element, structure ) );
|
||||
|
||||
while ( ( word = GetWord::run ( &s, &len ) ) != NULL )
|
||||
{
|
||||
|
@ -500,6 +520,9 @@ void XmlPromptGenerator::handleSchema (
|
|||
d->attributeMap.insert( make_pair ( element, attributeMap ) );
|
||||
}
|
||||
}
|
||||
delete parser;
|
||||
XMLPlatformUtils::Terminate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,9 @@ struct PromptGeneratorData : public ParserData
|
|||
attributeMap;
|
||||
std::map<std::string, std::set<std::string> > elementMap;
|
||||
std::map<std::string, std::set<std::string> > requiredAttributeMap;
|
||||
std::map<std::string, std::string> elementStructureMap;
|
||||
std::set<std::string> entitySet;
|
||||
std::string catalogPath, auxPath, rootElement;
|
||||
std::string catalogPath, basePath, auxPath, rootElement;
|
||||
int elementDeclRecurseLevel;
|
||||
bool isRootElement, grammarFound;
|
||||
unsigned attributeValueCutoff;
|
||||
|
@ -58,6 +59,8 @@ class XmlPromptGenerator : public WrapExpat
|
|||
void getEntitySet (
|
||||
std::set<std::string> &entitySet );
|
||||
bool getGrammarFound();
|
||||
void getElementStructureMap (
|
||||
std::map<std::string, std::string> &elementStructureMap );
|
||||
private:
|
||||
std::auto_ptr<PromptGeneratorData> d;
|
||||
static void XMLCALL starthandler (
|
||||
|
|
Loading…
Reference in New Issue