[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6325] Show newline as RETURN SYMBOL in census-manager tex
From: |
Greg Chicares |
Subject: |
[lmi-commits] [6325] Show newline as RETURN SYMBOL in census-manager text subcontrols (VZ ) |
Date: |
Wed, 07 Oct 2015 00:03:48 +0000 |
Revision: 6325
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6325
Author: chicares
Date: 2015-10-07 00:03:47 +0000 (Wed, 07 Oct 2015)
Log Message:
-----------
Show newline as RETURN SYMBOL in census-manager text subcontrols (VZ)
Modified Paths:
--------------
lmi/trunk/census_view.cpp
Modified: lmi/trunk/census_view.cpp
===================================================================
--- lmi/trunk/census_view.cpp 2015-10-06 16:48:38 UTC (rev 6324)
+++ lmi/trunk/census_view.cpp 2015-10-07 00:03:47 UTC (rev 6325)
@@ -626,12 +626,24 @@
public:
virtual wxVariant to_variant(any_member<Input> const& x, Input const&,
std::string const&) const
{
- return wxString(x.str());
+ // Strings containing new line characters are currently not displayed
+ // correctly by wxDataViewCtrl, so display the value on a single line
+ // after converting any optional new lines to the Unicode character
+ // representing them.
+ wxString s(x.str());
+ s.Replace("\n", RETURN_SYMBOL, true);
+ return s;
}
virtual std::string from_variant(wxVariant const& x) const
{
- return x.GetString().ToStdString();
+ // Undo the replacement done above. Notice that this will (wrongly)
+ // translate any RETURN_SYMBOL characters entered by the user into the
+ // string to new lines, but this character is not supposed to be used
+ // in any of the cells values, so just ignore this problem for now.
+ wxString s = x.GetString();
+ s.Replace(RETURN_SYMBOL, "\n", true);
+ return s.ToStdString();
}
virtual char const* variant_type() const
@@ -643,6 +655,9 @@
{
return new(wx) wxDataViewTextRenderer("string",
wxDATAVIEW_CELL_EDITABLE);
}
+
+ private:
+ static const wchar_t RETURN_SYMBOL = 0x23ce;
};
renderer_type_convertor const& renderer_type_convertor::get(any_member<Input>
const& value)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6325] Show newline as RETURN SYMBOL in census-manager text subcontrols (VZ ),
Greg Chicares <=