[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Input-sequence editor testing
From: |
Vaclav Slavik |
Subject: |
Re: [lmi] Input-sequence editor testing |
Date: |
Wed, 25 Aug 2010 22:27:00 +0200 |
On Sun, 2010-08-01 at 22:16 +0000, Greg Chicares wrote:
> Here's a new anomaly I just noticed, with or without that change:
>
> alt-F N I
> delete contents of "Individual payment" textcontrol
> press "..." [corresponding to "Individual payment"]
> now there's no combobox, so no keyword can be entered
>
> click OK anyway
> press "..." again
> now it's all right--the combobox appears
There was a superfluous check for empty inputs; turns out that
InputSequence parser deals with them correctly already. Here's diff -w
version of the fix:
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index ba42ec1..e815aaa 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -1073,8 +1073,6 @@ void InputSequenceEntry::UponOpenEditor(wxCommandEvent&)
editor.CentreOnParent();
std::string sequence_string = std::string(text_->GetValue());
- if(!sequence_string.empty())
- {
std::string const name(GetName().c_str());
datum_sequence const& ds =
*member_cast<datum_sequence>(input->operator[](name));
@@ -1112,7 +1110,6 @@ void InputSequenceEntry::UponOpenEditor(wxCommandEvent&)
}
editor.sequence(sequence);
- }
if(wxID_OK == editor.ShowModal())
{
And here's full diff:
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index ba42ec1..e815aaa 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -1073,47 +1073,44 @@ void InputSequenceEntry::UponOpenEditor(wxCommandEvent&)
editor.CentreOnParent();
std::string sequence_string = std::string(text_->GetValue());
- if(!sequence_string.empty())
- {
- std::string const name(GetName().c_str());
- datum_sequence const& ds =
*member_cast<datum_sequence>(input->operator[](name));
-
- std::map<std::string,std::string> const kwmap = ds.allowed_keywords();
- std::vector<std::string> const keywords =
- detail::extract_keys_from_string_map(kwmap);
+ std::string const name(GetName().c_str());
+ datum_sequence const& ds =
*member_cast<datum_sequence>(input->operator[](name));
+
+ std::map<std::string,std::string> const kwmap = ds.allowed_keywords();
+ std::vector<std::string> const keywords =
+ detail::extract_keys_from_string_map(kwmap);
+
+ bool keywords_only =
+ ds.keyword_values_are_allowable()
+ && !ds.numeric_values_are_allowable()
+ ;
+ LMI_ASSERT(!(keywords_only && keywords.empty()));
+ editor.set_keywords(keywords, keywords_only, ds.default_keyword());
+
+ InputSequence sequence
+ (sequence_string
+ ,input->years_to_maturity()
+ ,input->issue_age ()
+ ,input->retirement_age ()
+ ,input->inforce_year ()
+ ,input->effective_year ()
+ ,0
+ ,keywords
+ );
- bool keywords_only =
- ds.keyword_values_are_allowable()
- && !ds.numeric_values_are_allowable()
+ std::string const diagnostics = sequence.formatted_diagnostics();
+ if(!diagnostics.empty())
+ {
+ warning()
+ << "The sequence is invalid and cannot be edited visually.\n"
+ << diagnostics
+ << LMI_FLUSH
;
- LMI_ASSERT(!(keywords_only && keywords.empty()));
- editor.set_keywords(keywords, keywords_only, ds.default_keyword());
-
- InputSequence sequence
- (sequence_string
- ,input->years_to_maturity()
- ,input->issue_age ()
- ,input->retirement_age ()
- ,input->inforce_year ()
- ,input->effective_year ()
- ,0
- ,keywords
- );
-
- std::string const diagnostics = sequence.formatted_diagnostics();
- if(!diagnostics.empty())
- {
- warning()
- << "The sequence is invalid and cannot be edited visually.\n"
- << diagnostics
- << LMI_FLUSH
- ;
- return;
- }
-
- editor.sequence(sequence);
+ return;
}
+ editor.sequence(sequence);
+
if(wxID_OK == editor.ShowModal())
{
text_->SetValue(editor.sequence_string());
Thanks,
Vaclav