Improved performance

Bug #92 Large XML file without line breaks kills XML Copy Editor
This commit is contained in:
Zane U. Ji 2013-12-11 23:06:15 +08:00
parent 543a4b57a3
commit 8f80bee6c2
2 changed files with 17 additions and 24 deletions

View File

@ -1661,8 +1661,8 @@ void MyFrame::OnIdle ( wxIdleEvent& event )
// check if document loaded // check if document loaded
wxString frameTitle = GetTitle(); wxString frameTitle = GetTitle();
XmlDoc *doc; XmlDoc *doc = getActiveDocument();
if ( ( doc = getActiveDocument() ) == NULL ) if ( doc == NULL )
{ {
if ( lastDoc != NULL ) if ( lastDoc != NULL )
{ {
@ -1691,18 +1691,6 @@ void MyFrame::OnIdle ( wxIdleEvent& event )
restoreFocusToNotebook = false; restoreFocusToNotebook = false;
} }
wxString docTitle;
if ( doc->getFullFileName().empty() || !showFullPathOnFrame )
docTitle = doc->getShortFileName();
else
docTitle = doc->getFullFileName();
docTitle += _T ( " - " );
docTitle += _ ( "XML Copy Editor" );
if ( frameTitle != docTitle )
SetTitle ( docTitle );
// update modified field // update modified field
if ( !mainBook ) if ( !mainBook )
return; return;
@ -1738,20 +1726,15 @@ void MyFrame::OnIdle ( wxIdleEvent& event )
} }
// update coordinates field // update coordinates field
std::pair<int, int> myControlCoordinates;
int current = doc->GetCurrentPos(); int current = doc->GetCurrentPos();
myControlCoordinates.first = doc->LineFromPosition ( current ) + 1; if ( current != lastPos )
myControlCoordinates.second = doc->GetColumn ( current ) + 1;
if ( myControlCoordinates != controlCoordinates )
{ {
wxString coordinates; wxString coordinates;
coordinates.Printf ( coordinates.Printf (
_ ( "Ln %i Col %i" ), _ ( "Ln %i Col %i" ),
myControlCoordinates.first, doc->LineFromPosition ( current ) + 1,
myControlCoordinates.second ); doc->GetColumn ( current ) + 1 );
GetStatusBar()->SetStatusText ( coordinates, STATUS_POSITION ); GetStatusBar()->SetStatusText ( coordinates, STATUS_POSITION );
controlCoordinates = myControlCoordinates;
} }
// update parent element field // update parent element field
@ -1762,6 +1745,17 @@ void MyFrame::OnIdle ( wxIdleEvent& event )
lastPos = current; lastPos = current;
lastDoc = doc; lastDoc = doc;
wxString docTitle;
if ( doc->getFullFileName().empty() || !showFullPathOnFrame )
docTitle = doc->getShortFileName();
else
docTitle = doc->getFullFileName();
docTitle += _T ( " - " );
docTitle += _ ( "XML Copy Editor" );
if ( frameTitle != docTitle )
SetTitle ( docTitle );
// don't try to find parent if pane is not shown // don't try to find parent if pane is not shown
if ( !manager.GetPane ( insertChildPanel ).IsShown() && !properties.validateAsYouType ) if ( !manager.GetPane ( insertChildPanel ).IsShown() && !properties.validateAsYouType )

View File

@ -376,7 +376,6 @@ class MyFrame : public wxFrame
wxString catalogPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath, wxString catalogPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath,
xliffDtdPath, aspellDataPath, aspellDictPath; xliffDtdPath, aspellDataPath, aspellDictPath;
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;