-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConfig.cpp
More file actions
679 lines (591 loc) · 22.9 KB
/
Config.cpp
File metadata and controls
679 lines (591 loc) · 22.9 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
#include <string>
#include <vector>
#include <map>
#include <iterator>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string.hpp>
#include <wx/wx.h>
#include <wx/utils.h>
#include <wx/filefn.h>
#include <wx/cmdline.h>
#include <wx/regex.h>
#include <wx/stdpaths.h>
#include "inih/ini.h"
#include "MainFrame.h"
extern MainFrame *main_frame_global;
#include "Config.h"
static std::string config_filename_local;
typedef std::map<std::string, unsigned int> DisplayModeNames;
static DisplayModeNames display_mode_names = {
{"normal", NODE_DISPLAY_PANE},
{"one-line", NODE_DISPLAY_PANE_ONE_LINE_STATUS}
};
static unsigned int max_display_mode_name_length = 0;
static std::map<unsigned int, std::string> display_mode_description = {
{ NODE_DISPLAY_PANE, "Normal 4-line display mode" },
{ NODE_DISPLAY_PANE_ONE_LINE_STATUS, "One-line status-only display mode"}
};
std::string findDisplayModeName(unsigned int index)
{
for (DisplayModeNames::const_iterator iter = display_mode_names.begin();
iter != display_mode_names.end(); ++iter)
{
if (index == (*iter).second)
return (*iter).first;
}
return std::string(""); // Should not happen
}
static const wxCmdLineEntryDesc g_cmdLineDesc[] =
{
{ wxCMD_LINE_SWITCH, "h", "help", _("displays help on the command line parameters"),
wxCMD_LINE_VAL_NONE, 0 },
{ wxCMD_LINE_SWITCH, "v", "version", _("print version"),
wxCMD_LINE_VAL_NONE, 0 },
{ wxCMD_LINE_SWITCH, "g", "gencfg", _("write sample MeshStat.ini config file (and quit)"),
wxCMD_LINE_VAL_NONE, 0 },
{ wxCMD_LINE_SWITCH, "d", "dump", _("dump current configuration (and quit)"),
wxCMD_LINE_VAL_NONE, 0 },
{ wxCMD_LINE_OPTION, "n", "nodes", _("comma separated list of node(s) to monitor, with no spaces (overrides config file)"),
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_PARAM, NULL, NULL, _("config file"),
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 }
};
static std::string cleanNodeURL(const std::string &raw_url, std::string &errmsg)
{
// Return an empty string on failure
// Remove comment, if any
const std::string comment_delimiter = "#";
std::string url(raw_url);
if (url.find(comment_delimiter) != std::string::npos)
{
url = url.substr(0, url.find(comment_delimiter));
boost::algorithm::trim(url);
}
// Convert to lower case
std::string url_lower_case(url);
std::transform(url_lower_case.begin(), url_lower_case.end(), url_lower_case.begin(), ::tolower);
boost::algorithm::trim(url_lower_case);
// Complain about any protocol prefix
const std::string protocol_delimiter = "://";
if (url_lower_case.find(protocol_delimiter) != std::string::npos)
{
std::string protocol = url_lower_case.substr(0, url_lower_case.find(protocol_delimiter));
if (protocol == "https") {
std::stringstream msg;
msg << "ERROR!\n\nRemove the unsupported 'https://' protocol prefix \nfrom node name:\n\n"
<< " '" << raw_url << "'";
errmsg = msg.str();
return "";
}
else {
std::stringstream msg;
msg << "ERROR!\n\nRemove the '" << protocol << "' protocol prefix \nfrom node name:\n\n"
<< " '" << raw_url << "'";
errmsg = msg.str();
return "";
}
}
// Accept numeric IP addresses
const wxRegEx re_numeric("^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$");
if (re_numeric.Matches(url)) {
return url;
}
const wxRegEx re_multipart_hostname("^[-a-zA-Z0-9]+\\.[-a-zA-Z0-9]+(\\.[-a-zA-Z0-9]+)*$");
if (re_multipart_hostname.Matches(url)) {
return url;
}
const wxRegEx re_single_hostname("^[-a-zA-Z0-9]+$");
if (re_single_hostname.Matches(url)) {
url = url_lower_case + ".local.mesh";
return url;
}
// Complain if we cannot parse the node name!
std::stringstream msg;
msg << "ERROR!\n\nUnrecognized node name syntax: \n\n"
<< " '" << url << "'";
errmsg = msg.str();
return "";
}
static int handler(void* configObj, const char *section_raw,
const char *name_raw, const char *value_raw,
int lineno)
{
ConfigInfo *config = reinterpret_cast<ConfigInfo *>(configObj);
const std::string section(section_raw);
const std::string name(name_raw);
const std::string value(value_raw);
if ((section != "Settings") and (section != "Nodes")) {
std::stringstream msg;
msg << "ERROR\n\nin config file: Unknown section name: \n\n"
<< "[" << name << "]"
<< "\n\non line " << lineno << " of config file '"
<< config_filename_local << "'"
<< "\n\nMust be either [Settings] or [Nodes] (case sensitve).\n";
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return 0;
}
if ((section == "Settings") && (name == "period")) {
config->period = atof(value.c_str());
}
else if ((section == "Settings") && (name == "num_columns")) {
config->num_columns = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "pane_width_chars")) {
config->pane_width_chars = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "pane_height_lines")) {
config->pane_height_lines = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "pane_border_width")) {
config->pane_border_width = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "pane_interline_space")) {
config->pane_interline_space = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "font_size")) {
config->font_size = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "max_num_fails")) {
config->max_num_fails = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "display_mode")) {
std::string mode = value.c_str();
boost::algorithm::trim(mode);
std::transform(mode.begin(), mode.end(), mode.begin(), ::tolower);
if (display_mode_names.find(mode) == display_mode_names.end()) {
std::stringstream msg;
msg << "Display mode '" << mode << "' is not known!" << std::endl << std::endl;
msg << "Known modes: " << std::endl;
for (DisplayModeNames::const_iterator iter = display_mode_names.begin();
iter != display_mode_names.end(); ++iter)
msg << " " << std::left << std::setw(max_display_mode_name_length)
<< (*iter).first << " : " << display_mode_description[(*iter).second]
<< " " << std::endl;
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return 0;
}
else {
config->display_mode = display_mode_names[mode];
}
}
else if ((section == "Settings") && (name == "max_response_time")) {
config->max_response_time = atoi(value.c_str());
}
else if ((section == "Settings") && (name == "node_access_timeout")) {
config->node_access_timeout = atoi(value.c_str());
}
else if ((section == "Nodes")) {
if (name == "node") {
std::string errmsg;
const std::string new_name = cleanNodeURL(value, errmsg);
if (new_name.empty()) {
std::stringstream msg;
msg << errmsg << "\n\non line " << lineno << " of config file '"
<< config_filename_local << "'" << std::endl;
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return 0;
}
if (std::find(config->nodes.begin(), config->nodes.end(), new_name) == config->nodes.end()) {
config->nodes.push_back(new_name);
}
else {
std::stringstream msg;
msg << "ERROR\n\nDuplicate node name \n\n'" << new_name << "'"
<< "\n\non line " << lineno << " of config file '"
<< config_filename_local << "'" << std::endl;
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return 0;
}
}
}
else {
std::stringstream msg;
msg << "ERROR\n\nin config file: Unknown option name: \n\n"
<< "'" << name << "'\n\n in [" << section << "] section"
<< "\n\n on line " << lineno << " of config file '"
<< config_filename_local << "'" << std::endl;
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return 0;
}
return 1;
}
ConfigInfo::ConfigInfo()
: period(default_period),
num_columns(default_num_columns),
node_access_timeout(default_node_access_timeout),
max_response_time(default_max_response_time),
max_num_fails(default_max_num_fails),
display_mode(default_display_mode),
pane_width_chars(default_pane_width_chars),
pane_height_lines(default_pane_height_lines),
pane_border_width(default_pane_border_width),
pane_interline_space(default_pane_interline_space),
font_size(default_font_size)
{
}
bool ConfigInfo::parseCommandLine(int& argc, wxChar **argv)
{
// Parse command line
wxCmdLineParser cmdParser(g_cmdLineDesc, argc, argv);
const int res = cmdParser.Parse(false);
// Check if the user asked for command-line help
if (res == -1 || res > 0 || cmdParser.Found("h"))
{
cmdParser.AddUsageText("________________________________________________________________________\n\n");
std::stringstream msg;
msg << "You can specify a configuraton file in several ways:\n\n"
<< " 1. Put a config file named 'MeshStat.ini' in either the directory\n"
<< " of this executable program or in the current directory.\n"
<< " 2. Specifiy the name/path of the config file at the end of the command line.\n"
<< " 3. Define an environment variable MESTSTAT_CONFIG_FILE with the full\n"
<< " path to the desired config file\n\n"
<< "You can generate an example config file using the -g option.";
cmdParser.AddUsageText(msg.str());
// cmdParser.Usage();
wxString help_msg = cmdParser.GetUsageString();
wxMessageDialog dialog(main_frame_global, help_msg, _("Help"), wxICON_NONE);
dialog.ShowModal();
return false;
}
// Check if the user asked for the version
if (cmdParser.Found("v"))
{
wxString date(wxString::FromAscii(__DATE__));
std::stringstream msg;
msg << "\nMeshStat\n\n(c) Jonathan M. Cameron KF6RTA \n\n"
<< "Version " << MESH_STAT_VERSION << ", " << date;
wxMessageDialog dialog(main_frame_global, msg.str(), _("Version"), wxICON_INFORMATION);
dialog.ShowModal();
return false;
}
// Write the example config file
if (cmdParser.Found("g"))
{
writeSampleConfigFile();
return false;
}
// Check for a project filename
if (cmdParser.GetParamCount() > 0)
{
// If a config file is specified, use it
wxString configFilename = cmdParser.GetParam(0);
// Under Windows when invoking via a document
// in Explorer, we are passed the short form.
// So normalize and make the long form.
wxFileName fName(configFilename);
fName.Normalize(wxPATH_NORM_LONG|wxPATH_NORM_DOTS|
wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE);
if (fName.FileExists()) {
config_filename = fName;
config_filename_local = configFilename; // For the ini parser hander
}
else {
std::stringstream msg;
msg << "ERROR\n\nUnable to find config file \n\n'"
<< fName.GetFullPath();
msg << "'\n\nspecified on the command line! ";
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return false;
}
}
else
{
// If there is no config file on the command line, look for
// MeshStat.ini in the current directory
wxStandardPaths paths = wxStandardPathsBase::Get();
wxFileName cfg_file_local("MeshStat.ini");
wxFileName cfg_file_exe_path(paths.GetExecutablePath());
wxFileName cfg_file_exe_dir(cfg_file_exe_path.GetPathWithSep());
wxFileName cfg_file_exe(cfg_file_exe_dir.GetFullPath() + "MeshStat.ini");
if (cfg_file_local.FileExists())
{
// The MeshStat.ini file is in the directory MeshStat was run from
cfg_file_local.Normalize(wxPATH_NORM_LONG|wxPATH_NORM_DOTS|
wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE);
config_filename = cfg_file_local.GetFullPath();
}
else if (cfg_file_exe.FileExists())
{
// The MeshStat.ini file is in the directory containing the MeshStat executable
cfg_file_exe.Normalize(wxPATH_NORM_LONG|wxPATH_NORM_DOTS|
wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE);
config_filename = cfg_file_exe.GetFullPath();
}
else
{
// If there is no MeshStat.ini file in the current directory or
// the directory of the executable, see if there is an environment
// variable pointing to it
wxString env_filename;
if (wxGetEnv("MESHSTAT_CONFIG_FILE", &env_filename))
{
wxFileName fName(env_filename);
fName.Normalize(wxPATH_NORM_LONG|wxPATH_NORM_DOTS|
wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE);
if (fName.FileExists())
{
config_filename = fName.GetFullPath();
}
else
{
std::stringstream msg;
msg << "ERROR\n\nUnable to find config file \n\n'"
<< fName.GetFullPath();
msg << "'\n\nfrom environment variable MESHSTAT_CONFIG_FILE! ";
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return false;
}
}
else
{
// Otherwise whine and stop
std::stringstream msg;
msg << "ERROR\n\nUnable to find config file! \n\n"
<< "Default: MeshStat.ini \n\n"
<< "(in directory with MeshStat executable) \n\n"
<< "Use 'MeshStat -h' for help!";
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return false;
}
}
}
// Figure out the maximum length of the display mode names
for (DisplayModeNames::const_iterator iter = display_mode_names.begin();
iter != display_mode_names.end(); ++iter)
{
const std::string mode = (*iter).first;
if (mode.size() > max_display_mode_name_length)
max_display_mode_name_length = mode.size();
}
// Load the parameter information from the config file
std::string filename = config_filename.GetFullPath().ToStdString();
int result = ini_parse(filename.c_str(), handler, this);
if (result != 0) {
if (result > 0)
std::cerr << "ERROR: Cannot load config file '"
<< filename << "'; error on line " << result << "!" << std::endl;
else
std::cerr << "ERROR: Cannot load config file '"
<< filename << "'! " << std::endl;
return false;
}
// See if the user specified nodes on the command line
wxString cmd_line_nodes;
if (cmdParser.Found("n", &cmd_line_nodes))
{
typedef std::vector<std::string> StringVec;
StringVec nodes;
std::string nodes_raw = cmd_line_nodes.ToStdString();
boost::algorithm::split(nodes,nodes_raw,boost::is_any_of(","),boost::token_compress_on);
for (StringVec::const_iterator nd=nodes.begin(); nd!=nodes.end(); ++nd)
{
// ??? copy to run list of nodes
std::cout << " --> " << *nd << std::endl;
}
return false;
}
// Make sure at least one node was given!
if (nodes.size() == 0)
{
std::stringstream msg;
msg << "ERROR in config file: \n\n"
<< "You must specify at least one node to monitor!";
wxMessageDialog dialog(main_frame_global, msg.str(), _("ERROR"), wxICON_ERROR);
dialog.ShowModal();
return 0;
}
// Dump (if requested)
if (cmdParser.Found("d"))
{
dump();
return false;
}
return true;
}
void ConfigInfo::writeSampleConfigFile() const
{
std::string filename("MeshStat.ini");
wxFileName fName(filename);
fName.Normalize(wxPATH_NORM_LONG|wxPATH_NORM_DOTS|
wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE);
if (fName.FileExists())
{
std::stringstream msg;
msg << "WARNING\n\n"
<< "The file '" << filename << "' already exists!";
wxMessageDialog dialog(main_frame_global, msg.str(), _("WARNING"), wxICON_WARNING|wxOK|wxCANCEL);
dialog.SetOKLabel("Overwrite");
const int result = dialog.ShowModal();
if (result != wxID_OK)
return;
}
wxFile file;
if (!file.Open(fName.GetFullPath().c_str(), wxFile::write))
{
// wxWidgets puts up its own error dialog
return;
}
std::stringstream ss;
ss << "# Sample MeshStat.ini config file\n";
ss << "\n";
ss << "# NOTES: \n";
ss << "# - Do NOT indent any lines!\n";
ss << "# - Comment lines start with the # symbol\n";
ss << "# - Inline comments (on the end of a line) start with a semi-colon (;)";
ss << "# - If you uncomment any settings, remove any leading spaces!\n";
ss << "# - Commented out settings below show default values\n";
ss << "# - At minimum, you must uncomment and specify at \n";
ss << "# least one node in the [Nodes] section below!\n";
ss << "\n";
ss << "[Settings]\n";
ss << "\n";
ss << "# This is the general [Settings] section\n";
ss << "\n";
ss << "# Period between node status checks (seconds):\n";
ss << "# (Should be larger than the number of nodes!)\n";
ss << "# period = " << default_period << " ; seconds\n";
ss << "\n";
ss << "# Number of columns in the node display: \n";
ss << "# num_columns = " << default_num_columns << "\n";
ss << "\n";
ss << "# The desired display mode:\n";
ss << "# normal : Use normal 4-line display mode\n";
ss << "# one-line : Use one-line status only display mode\n";
ss << "# display_mode = " << findDisplayModeName(default_display_mode) << "\n";
ss << "\n";
ss << "# Minimum node display pane width (characters)\n";
ss << "# pane_width_chars = " << default_pane_width_chars << "\n";
ss << "\n";
ss << "# Minimum node display pane height (lines of text) - NOTE: Ignored in 1-line display mode\n";
ss << "# pane_height_lines = " << default_pane_height_lines << "\n";
ss << "\n";
ss << "# Node display pane border width (pixels)\n";
ss << "# pane_border_width = " << default_pane_border_width << "\n";
ss << "\n";
ss << "# Spacing on display pane between text lines (pixels)\n";
ss << "# pane_interline_space = " << default_pane_interline_space << "\n";
ss << "\n";
ss << "# Font size to use in the node display: \n";
ss << "# font_size = " << default_font_size << "\n";
ss << "\n";
ss << "# Max time allowed for node access timeout (seconds):\n";
ss << "# (Node access longer than this is assumed to be a failed access)\n";
ss << "# node_access_timeout = " << default_node_access_timeout << "\n";
ss << "\n";
ss << "# Max time allowed for normal responses (milliseconds):\n";
ss << "# (Affects what shade of green the nodes are colored)\n";
ss << "# (Faster response times are brighter green)\n";
ss << "# max_response_time = " << default_max_response_time << "\n";
ss << "\n";
ss << "# Max number of access failures\n";
ss << "# (Affects what shade of red the failing nodes are colored)\n";
ss << "# (More failures than this colors the node display bright red)\n";
ss << "# max_num_fails = " << default_max_num_fails << "\n";
ss << "\n\n";
ss << "[Nodes]\n";
ss << "\n";
ss << "# This is the [Nodes] section where you can specify which nodes to monitor\n";
ss << "\n";
ss << "# NOTES About the Mesh Nodes to Monitor: \n";
ss << "# - List the nodes to monitor below (do not indent any lines!)\n";
ss << "# - Repeat 'node = xx.yy.zz' on separate lines for each node to monitor\n";
ss << "# - Node names can be given as hostname or an IP address\n";
ss << "# - Giving node IP addresses will be faster since no DNS lookups are required\n";
ss << "# - Node names with no dots are assumed to be in the '.local.mesh' domain\n";
ss << "# - Do not use http:// or https:// prefixes\n";
ss << "\n";
ss << "# ADD YOUR OWN NODES BELOW\n";
ss << "# (remove the leading comment symbol (#) and \n";
ss << "# any leading spaces from each active line)\n";
ss << "\n";
ss << "# node = mynode.local.mesh\n";
ss << "# node = 10.123.45.67\n";
ss << "# node = CALLSIGN-MR5\n";
file.Write(ss.str());
file.Close();
}
void ConfigInfo::dump() const
{
std::stringstream msg;
std::string filename = config_filename.GetFullPath().ToStdString();
msg << std::endl << "Config file: \n " << filename << std::endl;
msg << std::endl << "Settings" << std::endl;
msg << " Period (seconds) = " << period;
if (period == default_period)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_period << ")" << std::endl;
msg << " Num Columns = " << num_columns;
if (num_columns == default_num_columns)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_num_columns << ")" << std::endl;
msg << " Display mode = " << findDisplayModeName(display_mode);
if (display_mode == default_display_mode)
msg << " (default)" << std::endl;
else
msg << " (default: " << findDisplayModeName(default_display_mode) << ")" << std::endl;
msg << " Node Access Timeout (milliseconds) = " << node_access_timeout;
if (node_access_timeout == default_node_access_timeout)
msg << " (default) " << std::endl;
else
msg << " (default: " << default_node_access_timeout << ") " << std::endl;
msg << " Max Response Time (milliseconds) = " << max_response_time;
if (max_response_time == default_max_response_time)
msg << " (default) " << std::endl;
else
msg << " (default: " << default_max_response_time << ") " << std::endl;
msg << " Max Num Fails = " << max_num_fails;
if (max_num_fails == default_max_num_fails)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_max_num_fails << ")" << std::endl;
msg << " Node pane width (chars) = " << pane_width_chars;
if (pane_width_chars == default_pane_width_chars)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_pane_width_chars << ")" << std::endl;
msg << " Pane border width = " << pane_border_width;
if (pane_border_width == default_pane_border_width)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_pane_border_width << ")" << std::endl;
msg << " Pane spacing between lines (pixels) = " << pane_interline_space;
if (pane_interline_space == default_pane_interline_space)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_pane_interline_space << ")" << std::endl;
msg << " Font size = " << font_size;
if (font_size == default_font_size)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_font_size << ")" << std::endl;
msg << " Node pane height (lines of text) = " << pane_height_lines;
if (pane_height_lines == default_pane_height_lines)
msg << " (default)" << std::endl;
else
msg << " (default: " << default_pane_height_lines << ")" << std::endl;
if (nodes.size() > 0)
{
msg << std::endl << "Nodes:" << std::endl;
for (NodeNameList::const_iterator nd=nodes.begin(); nd!=nodes.end(); ++nd)
{
msg << " " << *nd << std::endl;
}
}
msg << std::endl;
wxMessageDialog dialog(main_frame_global, msg.str(), _("Dump"), wxICON_INFORMATION);
dialog.ShowModal();
}