From b7ff2609f4744a42f12a9782dd15c9b00950a6db Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Tue, 10 Feb 2015 15:49:00 -0500 Subject: [PATCH] Standard error dialogs now have a copy to clipboard button --- src/dialogxml/dlogutil.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/dialogxml/dlogutil.cpp b/src/dialogxml/dlogutil.cpp index 85feb8de7..b85df5e3f 100644 --- a/src/dialogxml/dlogutil.cpp +++ b/src/dialogxml/dlogutil.cpp @@ -14,6 +14,7 @@ #include #include "dialog.hpp" #include "dlogutil.hpp" +#include "winutil.hpp" #include "mathutil.hpp" #include #include "message.hpp" @@ -515,6 +516,18 @@ void cStrDlog::show(){ void giveError(std::string str1, std::string str2, cDialog* parent){ cStrDlog error(str1,str2,"Error!!!",25,PIC_DLOG,parent); + error->getControl("record").setText("Copy"); + error.setRecordHandler([](cDialog& me) { + std::string error = me["str1"].getText(); + try { + std::string error2 = me["str2"].getText(); + error += "\n\n" + error2; + } catch(std::invalid_argument) {} + for(char& c : error) { + if(c == '|') c = '\n'; + } + set_clipboard(error); + }); error.show(); }