lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 8abeb84 2/3: Echo GUI alert messages to conso


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 8abeb84 2/3: Echo GUI alert messages to console
Date: Sat, 4 May 2019 16:22:20 -0400 (EDT)

branch: master
commit 8abeb84cbf26f1729dc83efda657f0ad9cb44806
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Echo GUI alert messages to console
    
    Developers always have a console available. End users never do, so they
    see no echo. status() messages are not echoed, just as status() has no
    effect in the command-line interface.
---
 alert.cpp    | 3 +--
 alert_wx.cpp | 8 ++++++--
 gui_test.sh  | 1 +
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/alert.cpp b/alert.cpp
index e720c2b..e3a7301 100644
--- a/alert.cpp
+++ b/alert.cpp
@@ -68,9 +68,8 @@ inline bool any_function_pointer_has_been_set()
 
 void report_catastrophe(char const* message)
 {
-#if !defined LMI_MSW
     safely_show_on_stderr(message);
-#else  // defined LMI_MSW
+#if defined LMI_MSW
     ::MessageBoxA
         (0
         ,message
diff --git a/alert_wx.cpp b/alert_wx.cpp
index 88411b0..f5d0dd9 100644
--- a/alert_wx.cpp
+++ b/alert_wx.cpp
@@ -33,6 +33,7 @@
 #   include <wx/msw/wrapwin.h>          // HWND etc.
 #endif // defined LMI_MSW
 
+#include <iostream>
 #include <stdexcept>
 
 LMI_FORCE_LINKING_IN_SITU(alert_wx)
@@ -71,6 +72,7 @@ void status_alert(std::string const& s)
 
 void warning_alert(std::string const& s)
 {
+    std::cerr << "Warning: " << s << std::endl;
     wxMessageBox(s, "Warning", wxOK, wxTheApp ? wxTheApp->GetTopWindow() : 
nullptr);
 }
 
@@ -84,6 +86,8 @@ void warning_alert(std::string const& s)
 
 void hobsons_choice_alert(std::string const& s)
 {
+    std::cerr << "Hobson's choice: " << s << std::endl;
+
     wxWindow* w = nullptr;
     if(wxTheApp)
         {
@@ -120,6 +124,7 @@ void hobsons_choice_alert(std::string const& s)
 
 void alarum_alert(std::string const& s)
 {
+    std::cerr << "Alarum: " << s << std::endl;
     throw std::runtime_error(s);
 }
 
@@ -147,9 +152,8 @@ void alarum_alert(std::string const& s)
 
 void safe_message_alert(char const* message)
 {
-#if !defined LMI_MSW
     safely_show_on_stderr(message);
-#else  // defined LMI_MSW
+#if defined LMI_MSW
     HWND handle = 0;
     if(wxTheApp && wxTheApp->GetTopWindow())
         {
diff --git a/gui_test.sh b/gui_test.sh
index fab1d3c..3716e3f 100755
--- a/gui_test.sh
+++ b/gui_test.sh
@@ -135,6 +135,7 @@ gui_test_clutter='
 /^time=[[:digit:]]\+ms (for validate_output_mec)$/d
 /^validate_output_mec: ok$/d
 /^time=[[:digit:]]\+ms (for all tests)$/d
+/^Warning: Test files path ..opt.lmi.gui_test. doesn.t exist\.$/d
 '
 
 # Directory for test logs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]