replace auto system selection comms with a button to show current state

master
Robert Norris 2014-03-28 07:57:00 +11:00
parent 714f43d1e0
commit 080ea705c6
5 changed files with 30 additions and 23 deletions

View File

@ -9,6 +9,7 @@ March 2014
* Textual galaxy dump (#2811)
* Money format with language specific thousand separator and
decimal delimiter (#2810)
* Add button to sector view to toggle auto selection mode
* Fixes
* Fix volume control layout (#2798)

View File

@ -59,6 +59,10 @@
"description" : "",
"message" : "Shields your spaceship from the heat of atmospheric re-entry."
},
"AUTOMATIC_SYSTEM_SELECTION" : {
"description" : "",
"message" : "Automatic system selection"
},
"AUTOPILOT" : {
"description" : "",
"message" : "Autopilot"
@ -303,10 +307,6 @@
"description" : "",
"message" : "\" Dir \""
},
"DISABLED_AUTOMATIC_SYSTEM_SELECTION" : {
"description" : "",
"message" : "Disabled automatic system selection."
},
"DISTANCE_FROM_SHIP_TO_NAV_TARGET" : {
"description" : "",
"message" : "Distance from ship to navigation target"
@ -435,10 +435,6 @@
"description" : "",
"message" : "Economy type:"
},
"ENABLED_AUTOMATIC_SYSTEM_SELECTION" : {
"description" : "",
"message" : "Enabled automatic system selection."
},
"EQUATORIAL_RADIUS_TO_POLAR_RADIUS_RATIO" : {
"description" : "",
"message" : "Equatorial to polar radius ratio"

View File

@ -218,8 +218,7 @@ DECLARE_STRING(NOT_FOUND)
DECLARE_STRING(QUADRUPLE_SYSTEM)
DECLARE_STRING(TRIPLE_SYSTEM)
DECLARE_STRING(BINARY_SYSTEM)
DECLARE_STRING(ENABLED_AUTOMATIC_SYSTEM_SELECTION)
DECLARE_STRING(DISABLED_AUTOMATIC_SYSTEM_SELECTION)
DECLARE_STRING(AUTOMATIC_SYSTEM_SELECTION)
DECLARE_STRING(FUEL_SCOOP_ACTIVE_N_TONNES_H_COLLECTED)
DECLARE_STRING(CARGO_SCOOP_ACTIVE_1_TONNE_X_COLLECTED)
DECLARE_STRING(CARGO_BAY_LIFE_SUPPORT_LOST)

View File

@ -67,7 +67,7 @@ SectorView::SectorView() : UIView()
m_pos = m_posMovingTo;
m_matchTargetToSelection = true;
m_selectionFollowsMovement = true;
m_automaticSystemSelection = true;
m_detailBoxVisible = DETAILBOX_INFO;
m_toggledFaction = false;
@ -92,7 +92,7 @@ SectorView::SectorView(Serializer::Reader &rd) : UIView()
m_selected = SystemPath::Unserialize(rd);
m_hyperspaceTarget = SystemPath::Unserialize(rd);
m_matchTargetToSelection = rd.Bool();
m_selectionFollowsMovement = rd.Bool();
m_automaticSystemSelection = rd.Bool();
m_detailBoxVisible = rd.Byte();
InitObject();
@ -301,6 +301,16 @@ void SectorView::InitObject()
label = (new Gui::Label(Lang::DRAW_UNINHABITED_LABELS))->Color(255, 255, 255);
hbox->PackEnd(label);
filterBox->PackEnd(hbox);
// 2.4 Selection follows movement
hbox = new Gui::HBox();
hbox->SetSpacing(5.0f);
m_automaticSystemSelectionButton = (new Gui::ToggleButton());
m_automaticSystemSelectionButton->SetPressed(m_automaticSystemSelection);
m_automaticSystemSelectionButton->onChange.connect(sigc::mem_fun(this, &SectorView::OnAutomaticSystemSelectionChange));
hbox->PackEnd(m_automaticSystemSelectionButton);
label = (new Gui::Label(Lang::AUTOMATIC_SYSTEM_SELECTION))->Color(255, 255, 255);
hbox->PackEnd(label);
filterBox->PackEnd(hbox);
m_infoBox->PackEnd(filterBox);
@ -340,7 +350,7 @@ void SectorView::Save(Serializer::Writer &wr)
m_selected.Serialize(wr);
m_hyperspaceTarget.Serialize(wr);
wr.Bool(m_matchTargetToSelection);
wr.Bool(m_selectionFollowsMovement);
wr.Bool(m_automaticSystemSelection);
wr.Byte(m_detailBoxVisible);
}
@ -583,7 +593,7 @@ void SectorView::OnClickSystem(const SystemPath &path)
SetSelected(system->GetStars()[0]->GetPath());
}
} else {
if (m_selectionFollowsMovement) {
if (m_automaticSystemSelection) {
GotoSystem(path);
} else {
RefCountedPtr<StarSystem> system = StarSystemCache::GetCached(path);
@ -802,6 +812,10 @@ void SectorView::OnToggleFaction(Gui::ToggleButton* button, bool pressed, Factio
m_toggledFaction = true;
}
void SectorView::OnAutomaticSystemSelectionChange(Gui::ToggleButton *b, bool pressed) {
m_automaticSystemSelection = pressed;
}
void SectorView::UpdateFactionToggles()
{
PROFILE_SCOPED()
@ -1175,13 +1189,9 @@ void SectorView::OnKeyPressed(SDL_Keysym *keysym)
return;
}
// toggle selection mode
if (KeyBindings::mapToggleSelectionFollowView.Matches(keysym)) {
m_selectionFollowsMovement = !m_selectionFollowsMovement;
if (m_selectionFollowsMovement)
Pi::cpan->MsgLog()->Message("", Lang::ENABLED_AUTOMATIC_SYSTEM_SELECTION);
else
Pi::cpan->MsgLog()->Message("", Lang::DISABLED_AUTOMATIC_SYSTEM_SELECTION);
m_automaticSystemSelection = !m_automaticSystemSelection;
m_automaticSystemSelectionButton->SetPressed(m_automaticSystemSelection);
return;
}
@ -1308,7 +1318,7 @@ void SectorView::Update()
}
}
if (m_selectionFollowsMovement) {
if (m_automaticSystemSelection) {
SystemPath new_selected = SystemPath(int(floor(m_pos.x)), int(floor(m_pos.y)), int(floor(m_pos.z)), 0);
RefCountedPtr<Sector> ps = GetCached(new_selected);

View File

@ -109,8 +109,7 @@ private:
SystemPath m_hyperspaceTarget;
bool m_matchTargetToSelection;
bool m_selectionFollowsMovement;
bool m_automaticSystemSelection;
Gui::Label *m_sectorLabel;
Gui::Label *m_distanceLabel;
@ -122,6 +121,8 @@ private:
Gui::ToggleButton *m_drawOutRangeLabelButton;
Gui::ToggleButton *m_drawUninhabitedLabelButton;
Gui::ToggleButton *m_drawSystemLegButton;
Gui::ToggleButton *m_automaticSystemSelectionButton;
void OnAutomaticSystemSelectionChange(Gui::ToggleButton *b, bool pressed);
std::unique_ptr<Graphics::Drawables::Disk> m_disk;