Click on the error message to jump to the error location
This commit is contained in:
parent
fb698e20cd
commit
14ffcc8d23
|
@ -1,4 +1,5 @@
|
|||
1.2.1.2
|
||||
+ Click on the error message to jump to the error location
|
||||
* Bug #99 fix desktop file (Marco Rodrigues)
|
||||
|
||||
1.2.1.1 2014/05/04
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "xmlcopyeditor.h"
|
||||
|
||||
BEGIN_EVENT_TABLE ( MyHtmlPane, wxHtmlWindow )
|
||||
EVT_LEFT_DCLICK ( MyHtmlPane::OnLeftDoubleClick )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyHtmlPane::MyHtmlPane (
|
||||
|
@ -29,27 +28,52 @@ MyHtmlPane::MyHtmlPane (
|
|||
wxWindowID id,
|
||||
const wxPoint& position,
|
||||
const wxSize& size ) : wxHtmlWindow ( parent, id, position, size )
|
||||
{}
|
||||
|
||||
/*
|
||||
void MyHtmlPane::OnCellClicked(
|
||||
wxHtmlCell *cell,
|
||||
wxCoord x,
|
||||
wxCoord y,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
int width = GetSize().GetWidth();
|
||||
if (x < (width*9/10))
|
||||
return;
|
||||
|
||||
MyFrame *frame = (MyFrame *)GetParent();
|
||||
if (frame)
|
||||
{
|
||||
wxCommandEvent e;
|
||||
frame->OnClosePane(e);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void MyHtmlPane::OnLeftDoubleClick ( wxMouseEvent& WXUNUSED ( event ) )
|
||||
{ }
|
||||
bool MyHtmlPane::OnCellClicked(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& event)
|
||||
{
|
||||
if ( mLastFile.empty() )
|
||||
return false;
|
||||
|
||||
wxHtmlContainerCell *parent = cell->GetParent();
|
||||
if (!parent)
|
||||
return false;
|
||||
|
||||
// Expect "FatalError at line 6, column 0:"
|
||||
wxString msg;
|
||||
wxHtmlCell *p = parent->GetFirstChild();
|
||||
for (; p != NULL; p = p->GetNext() )
|
||||
msg << p->ConvertToText ( NULL );
|
||||
|
||||
const static wxString anchor = _T(" at line ");
|
||||
size_t pos = msg.find ( anchor );
|
||||
if ( pos == wxString::npos )
|
||||
return false;
|
||||
pos += anchor.length();
|
||||
|
||||
size_t comma = msg.find ( ',', pos );
|
||||
if ( comma == wxString::npos )
|
||||
return false;
|
||||
msg = msg.Mid ( pos, comma - pos);
|
||||
|
||||
wxChar *psz = NULL;
|
||||
int line = wxStrtoul ( msg, &psz, 10 );
|
||||
if ( line <= 0 )
|
||||
return false;
|
||||
|
||||
MyFrame *frame = ( MyFrame * ) wxTheApp->GetTopWindow();
|
||||
XmlDoc *doc = frame->getActiveDocument();
|
||||
if ( ( !doc ) || !frame->activateTab ( mLastFile ) )
|
||||
return false;
|
||||
|
||||
doc->GotoLine ( line - 1 );
|
||||
doc->SetFocus();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MyHtmlPane::setLastFile ( const wxString &file )
|
||||
{
|
||||
mLastFile = file;
|
||||
}
|
||||
|
|
|
@ -31,16 +31,16 @@ class MyHtmlPane : public wxHtmlWindow
|
|||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& position = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize );
|
||||
void setLastFile ( const wxString &file );
|
||||
private:
|
||||
/*
|
||||
void OnCellClicked(
|
||||
wxHtmlCell *cell,
|
||||
wxCoord x,
|
||||
wxCoord y,
|
||||
const wxMouseEvent& event);
|
||||
*/
|
||||
void OnLeftDoubleClick ( wxMouseEvent& event );
|
||||
bool OnCellClicked(
|
||||
wxHtmlCell *cell,
|
||||
wxCoord x,
|
||||
wxCoord y,
|
||||
const wxMouseEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
wxString mLastFile;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5576,6 +5576,9 @@ void MyFrame::messagePane ( const wxString& s, int iconType, bool forcePane )
|
|||
htmlBuffer += htmlString;
|
||||
htmlBuffer += _T ( "</td></tr></table></body></html>" );
|
||||
|
||||
XmlDoc *doc = getActiveDocument();
|
||||
if ( doc )
|
||||
htmlReport->setLastFile ( doc->getFullFileName() );
|
||||
htmlReport->SetPage ( htmlBuffer );
|
||||
|
||||
manager.Update();
|
||||
|
|
Loading…
Reference in New Issue