2 * Run cavern inside an Aven window
4 * Copyright (C) 2005-2024 Olly Betts
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef SURVEX_CAVERNLOG_H
22 #define SURVEX_CAVERNLOG_H
25 #include <wx/process.h>
32 class CavernLogWindow
: public wxScrolledWindow
{
37 wxProcess
* cavern_out
= nullptr;
39 bool expecting_caret_line
= false;
43 bool init_done
= false;
51 enum { LOG_NONE
, LOG_ERROR
, LOG_WARNING
, LOG_INFO
};
55 unsigned start_offset
= 0;
57 unsigned link_len
= 0;
58 unsigned link_pixel_width
= 0;
59 unsigned colour
= LOG_NONE
;
60 unsigned colour_start
= 0;
61 unsigned colour_len
= 0;
65 explicit LineInfo(unsigned start_offset_
)
66 : start_offset(start_offset_
) { }
69 std::vector
<LineInfo
> line_info
;
71 wxButton
* save_button
= nullptr;
72 wxButton
* reprocess_button
= nullptr;
73 wxButton
* ok_button
= nullptr;
76 CavernLogWindow(MainFrm
* mainfrm_
, const wxString
& survey_
, wxWindow
* parent
);
80 /** Start to process survey data in file. */
81 void process(const wxString
&file
);
83 void OnMouseMove(wxMouseEvent
& e
);
85 void OnLinkClicked(wxMouseEvent
& e
);
87 void OnReprocess(wxCommandEvent
&);
89 void OnSave(wxCommandEvent
&);
91 void OnOK(wxCommandEvent
&);
93 void ProcessCavernOutput();
95 void OnCavernOutput(wxCommandEvent
&) {
96 ProcessCavernOutput();
101 void CheckForOutput(bool immediate
= false);
103 void OnIdle(wxIdleEvent
&) { CheckForOutput(); }
105 void OnTimer(wxTimerEvent
&) { CheckForOutput(); }
107 int OnPaintButton(wxButton
* b
, int x
);
109 void OnPaint(wxPaintEvent
&);
111 void OnEndProcess(wxProcessEvent
& e
);
113 DECLARE_EVENT_TABLE()
116 wxString
escape_for_shell(wxString s
, bool protect_dash
= false);
117 wxString
get_command_path(const wxChar
* command_name
);