Menu

[r120]: / src / myhtmlpane.cpp  Maximize  Restore  History

Download this file

89 lines (77 with data), 2.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* 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
*/
#include "myhtmlpane.h"
#include "xmlcopyeditor.h"
#include <string>
#include <sstream>
#include <iostream>
BEGIN_EVENT_TABLE ( MyHtmlPane, wxHtmlWindow )
EVT_LEFT_DCLICK ( MyHtmlPane::OnLeftDoubleClick )
END_EVENT_TABLE()
MyHtmlPane::MyHtmlPane (
wxWindow *parent,
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)
{
//since the error description was hardcoded, make use of this error string
//parse the get the line number, then jump to that line
if(error_message.find("Validation stopped at line") != -1 ||
error_message.find("Error at line")!= -1){
string substring = error_message.substr(error_message.find("at line ")+8);
string number = substring.substr(0,substring.find(", "));
istringstream iss(substring);
int line ;
iss >> line;
if (--line >= 0 && (doc))
{
doc->GotoLine ( ( int ) line );
doc->SetFocus();
}
return true;
}
return false;
}
void MyHtmlPane::SetCurrentDocument(XmlDoc *xdoc)
{
doc = xdoc;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.