Skip to content

Commit ee02884

Browse files
committed
Add header for goto and fix eclipse finder
1 parent 062d0b4 commit ee02884

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

CelestiaWinUI/EclipseFinderUserControl.xaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@
4848
<ColumnDefinition Width="*"/>
4949
<ColumnDefinition Width="*"/>
5050
</Grid.ColumnDefinitions>
51-
<TextBlock Text="Object:" x:Name="ObjectHint" Grid.Column="0" VerticalAlignment="Center"/>
52-
<AutoSuggestBox x:Name="ObjectChooser" ItemsSource="{x:Bind AvailableObjects}" Grid.Column="1" TextChanged="ObjectChooser_TextChanged" SuggestionChosen="ObjectChooser_SuggestionChosen" UpdateTextOnSelect="False">
51+
<AutoSuggestBox x:Name="ObjectChooser" ItemsSource="{x:Bind AvailableObjects}" Grid.Column="0" Grid.ColumnSpan="2" TextChanged="ObjectChooser_TextChanged" SuggestionChosen="ObjectChooser_SuggestionChosen" UpdateTextOnSelect="False">
5352
<AutoSuggestBox.ItemTemplate>
5453
<DataTemplate x:DataType="app:SearchObjectEntry">
5554
<TextBlock Text="{x:Bind Name, Mode=OneTime}"/>
5655
</DataTemplate>
5756
</AutoSuggestBox.ItemTemplate>
5857
</AutoSuggestBox>
59-
<CheckBox Content="Solar" IsChecked="{x:Bind FindSolar, Mode=TwoWay}" x:Name="SolarEclipseButton" Grid.Column="2"/>
60-
<CheckBox Content="Lunar" IsChecked="{x:Bind FindLunar, Mode=TwoWay}" x:Name="LunarEclipseButton" Grid.Column="3"></CheckBox>
58+
<CheckBox Content="Solar" IsChecked="{x:Bind FindSolar, Mode=TwoWay}" x:Name="SolarEclipseButton" Grid.Column="2" VerticalAlignment="Bottom"/>
59+
<CheckBox Content="Lunar" IsChecked="{x:Bind FindLunar, Mode=TwoWay}" x:Name="LunarEclipseButton" Grid.Column="3" VerticalAlignment="Bottom"/>
6160
</Grid>
6261
<RelativePanel>
6362
<Button Content="Compute" x:Name="ComputeButton" Click="ComputeButton_Click" RelativePanel.AlignLeftWithPanel="True"/>

CelestiaWinUI/EclipseFinderUserControl.xaml.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace winrt::CelestiaWinUI::implementation
4343
{
4444
availableObjects = single_threaded_observable_vector<SearchObjectEntry>({ SearchObjectEntry(CelestiaAppCore::LocalizedString(L"Earth", L"celestia-data"), L"Sol/Earth"), SearchObjectEntry(CelestiaAppCore::LocalizedString(L"Jupiter", L"celestia-data"), L"Sol/Jupiter")});
4545
eclipses = single_threaded_observable_vector<CelestiaWinUI::EclipseResult>();
46-
startTime = clock::now();
46+
startTime = clock::now() - std::chrono::hours(24 * 365);
4747
endTime = clock::now();
4848
}
4949

@@ -55,7 +55,7 @@ namespace winrt::CelestiaWinUI::implementation
5555
ComputeButton().Content(box_value(LocalizationHelper::Localize(L"Compute", L"Compute for eclipses")));
5656
StartTimeHint().Text(LocalizationHelper::Localize(L"Start time:", L"In eclipse finder, range of time to find eclipse in"));
5757
EndTimeHint().Text(LocalizationHelper::Localize(L"End time:", L"In eclipse finder, range of time to find eclipse in"));
58-
ObjectHint().Text(LocalizationHelper::Localize(L"Object:", L"In Go to, Windows, In eclipse finder, object to find eclipse with"));
58+
ObjectChooser().Header(box_value(LocalizationHelper::Localize(L"Object", L"In eclipse finder, object to find eclipse with, or in go to")));
5959
SolarEclipseButton().Content(box_value(LocalizationHelper::Localize(L"Solar", L"Solar eclipses.")));
6060
LunarEclipseButton().Content(box_value(LocalizationHelper::Localize(L"Lunar", L"Lunar eclipses.")));
6161
EmptyHintText().Text(LocalizationHelper::Localize(L"Find eclipses for an object in a time range", L""));
@@ -193,12 +193,12 @@ namespace winrt::CelestiaWinUI::implementation
193193
if (selectedEclipse == nullptr)
194194
return;
195195

196-
auto eclipse = selectedEclipse.as<CelestiaEclipse>();
196+
auto eclipse = selectedEclipse.as<CelestiaWinUI::EclipseResult>();
197197
renderer.EnqueueTask([weak_this{ get_weak() }, eclipse]()
198198
{
199199
auto strong_this{ weak_this.get() };
200200
if (strong_this == nullptr) return;
201-
strong_this->appCore.Simulation().GoToEclipse(eclipse);
201+
strong_this->appCore.Simulation().GoToEclipse(eclipse.Eclipse());
202202
});
203203
}
204204

CelestiaWinUI/GotoObjectDialog.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
<TextBox x:Name="LatitudeText" Grid.Row="1" TextChanged="LatitudeText_TextChanged"/>
2828
<TextBox x:Name="LongitudeText" Grid.Row="1" Grid.Column="1" TextChanged="LongitudeText_TextChanged"/>
2929
<TextBox x:Name="DistanceText" Grid.Row="2" TextChanged="DistanceText_TextChanged"/>
30-
<ComboBox Grid.Row="2" Grid.Column="1" ItemsSource="{x:Bind Units, Mode=OneTime}" SelectedIndex="{x:Bind Unit, Mode=TwoWay}"></ComboBox>
30+
<ComboBox Grid.Row="2" Grid.Column="1" ItemsSource="{x:Bind Units, Mode=OneTime}" SelectedIndex="{x:Bind Unit, Mode=TwoWay}" VerticalAlignment="Bottom"/>
3131
</Grid>
3232
</ContentDialog>

CelestiaWinUI/GotoObjectDialog.xaml.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ namespace winrt::CelestiaWinUI::implementation
4343
Title(box_value(LocalizationHelper::Localize(L"Go to Object", L"")));
4444
PrimaryButtonText(LocalizationHelper::Localize(L"OK", L""));
4545
SecondaryButtonText(LocalizationHelper::Localize(L"Cancel", L""));
46-
ObjectNameText().PlaceholderText(LocalizationHelper::Localize(L"Object Name", L""));
47-
LongitudeText().PlaceholderText(LocalizationHelper::Localize(L"Longitude", L"Coordinates"));
48-
LatitudeText().PlaceholderText(LocalizationHelper::Localize(L"Latitude", L"Coordinates"));
49-
DistanceText().PlaceholderText(LocalizationHelper::Localize(L"Distance", L"Distance to the object (in Go to)"));
46+
ObjectNameText().Header(box_value(LocalizationHelper::Localize(L"Object Name", L"")));
47+
LongitudeText().Header(box_value(LocalizationHelper::Localize(L"Longitude", L"Coordinates")));
48+
LatitudeText().Header(box_value(LocalizationHelper::Localize(L"Latitude", L"Coordinates")));
49+
DistanceText().Header(box_value(LocalizationHelper::Localize(L"Distance", L"Distance to the object (in Go to)")));
5050
}
5151

5252
float GotoObjectDialog::Latitude()

0 commit comments

Comments
 (0)