Expose current RecentEntry from detail view.

This commit is contained in:
Jared Boone 2016-01-15 11:37:37 -08:00
parent 089ef25df9
commit 19e3b273ad
2 changed files with 12 additions and 11 deletions

View File

@ -320,18 +320,18 @@ void AISRecentEntryDetailView::paint(Painter& painter) {
auto field_rect = Rect { rect.left(), rect.top() + 16, rect.width(), 16 }; auto field_rect = Rect { rect.left(), rect.top() + 16, rect.width(), 16 };
const size_t mmsi_length = 9; const size_t mmsi_length = 9;
field_rect = draw_field(painter, field_rect, s, "MMSI", to_string_dec_int(entry.mmsi, mmsi_length)); field_rect = draw_field(painter, field_rect, s, "MMSI", to_string_dec_int(entry_.mmsi, mmsi_length));
field_rect = draw_field(painter, field_rect, s, "Name", entry.name); field_rect = draw_field(painter, field_rect, s, "Name", entry_.name);
field_rect = draw_field(painter, field_rect, s, "Call", entry.call_sign); field_rect = draw_field(painter, field_rect, s, "Call", entry_.call_sign);
field_rect = draw_field(painter, field_rect, s, "Dest", entry.destination); field_rect = draw_field(painter, field_rect, s, "Dest", entry_.destination);
field_rect = draw_field(painter, field_rect, s, "Lat ", ais::format::latlon_normalized(entry.last_position.latitude) + "N"); field_rect = draw_field(painter, field_rect, s, "Lat ", ais::format::latlon_normalized(entry_.last_position.latitude) + "N");
field_rect = draw_field(painter, field_rect, s, "Lon ", ais::format::latlon_normalized(entry.last_position.longitude) + "E"); field_rect = draw_field(painter, field_rect, s, "Lon ", ais::format::latlon_normalized(entry_.last_position.longitude) + "E");
field_rect = draw_field(painter, field_rect, s, "Stat", ais::format::navigational_status(entry.navigational_status)); field_rect = draw_field(painter, field_rect, s, "Stat", ais::format::navigational_status(entry_.navigational_status));
field_rect = draw_field(painter, field_rect, s, "Rx #", to_string_dec_uint(entry.received_count, 10)); field_rect = draw_field(painter, field_rect, s, "Rx #", to_string_dec_uint(entry_.received_count, 10));
} }
void AISRecentEntryDetailView::set_entry(const AISRecentEntry& new_entry) { void AISRecentEntryDetailView::set_entry(const AISRecentEntry& entry) {
entry = new_entry; entry_ = entry;
} }
AISAppView::AISAppView() { AISAppView::AISAppView() {

View File

@ -144,12 +144,13 @@ public:
AISRecentEntryDetailView(); AISRecentEntryDetailView();
void set_entry(const AISRecentEntry& new_entry); void set_entry(const AISRecentEntry& new_entry);
const AISRecentEntry& entry() const { return entry_; };
void focus() override; void focus() override;
void paint(Painter&) override; void paint(Painter&) override;
private: private:
AISRecentEntry entry; AISRecentEntry entry_;
Button button_done { Button button_done {
{ 72, 192, 96, 24 }, { 72, 192, 96, 24 },