Skip to content

Commit

Permalink
[HaRepacker] a little UI polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
eaxvac committed Dec 6, 2020
1 parent 090114e commit 6c21fcf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions HaRepacker/GUI/Panels/MainPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,20 @@

<Grid x:Name="grid" Grid.Column="2" Background="#FFF1F1F1">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<!-- Text box -->
<sharedLib:ChangeableTextBox x:Name="nameBox" Grid.Row="0"
AcceptsReturn="False"
<sharedLib:ChangeableTextBox x:Name="nameBox" Grid.Row="0"
AcceptsReturn="False" Margin="20,0,20,0"
ButtonClicked="nameBox_ButtonClicked"/>
<sharedLib:ChangeableTextBox x:Name="textPropBox" Grid.Row="1"
VerticalAlignment="Top"
TextWrap="Wrap" />
<sharedLib:ChangeableTextBox x:Name="textPropBox" Grid.Row="1"
TextWrap="Wrap" Margin="20,0,20,0" />


<Grid x:Name="grid1" Grid.Row="1" Grid.RowSpan="2">
<Grid x:Name="grid1" Grid.Row="2" Grid.RowSpan="2">
<WindowsFormsHost x:Name="fieldLimitPanelHost" Visibility="Collapsed" Margin="0,37,0,0">
<sharedLib:FieldLimitPanel x:Name="fieldLimitPanel1" />
</WindowsFormsHost>
Expand Down Expand Up @@ -366,8 +366,8 @@

<!-- Context menu -->
<Button x:Name="button_MoreOption" Content="..." Width="40" Height="50" FontSize="40" Style="{DynamicResource ButtonStyle_MoreOption}"
VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,10,20,10"
Grid.Row="0" Grid.RowSpan="2"
VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,0,20,10"
Grid.Row="2"
Visibility="Collapsed"
Click="button_MoreOption_Click" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
Expand Down
19 changes: 8 additions & 11 deletions HaRepacker/GUI/Panels/MainPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public MainPanel()
DataTree.ForeColor = System.Drawing.Color.White;
}

nameBox.Header = "Key";
nameBox.Header = "Name";
textPropBox.Header = "Value";
textPropBox.ButtonClicked += applyChangesButton_Click;

Expand Down Expand Up @@ -688,7 +688,7 @@ private void nameBox_ButtonClicked(object sender, EventArgs e)
string text = nameBox.Text;
((WzNode)DataTree.SelectedNode).ChangeName(text);
nameBox.Text = text;
nameBox.ButtonEnabled = false;
nameBox.ApplyButtonEnabled = false;
}
else
Warning.Error(Properties.Resources.MainNodeExists);
Expand Down Expand Up @@ -1292,7 +1292,7 @@ private void ShowObjectValue(WzObject obj)
{
mp3Player.SoundProperty = null;
nameBox.Text = obj is WzFile ? ((WzFile)obj).Header.Copyright : obj.Name;
nameBox.ButtonEnabled = false;
nameBox.ApplyButtonEnabled = false;

toolStripStatusLabel_additionalInfo.Text = "-"; // Reset additional info to default
if (isSelectingWzMapFieldLimit) // previously already selected. update again
Expand Down Expand Up @@ -1400,6 +1400,7 @@ private void ShowObjectValue(WzObject obj)

// Value
textPropBox.Visibility = Visibility.Visible;
textPropBox.ApplyButtonEnabled = false; // reset to disabled mode when changed
textPropBox.Text = obj.ToString();
}
else if (bIsWzSoundProperty)
Expand Down Expand Up @@ -1449,16 +1450,13 @@ private void ShowObjectValue(WzObject obj)
});
thread.Start();
thread.Join();

// atlas string display
textPropBox.AcceptsReturn = true;
textPropBox.Height = 700;
}
else
{
// Value
textPropBox.Visibility = Visibility.Visible;
textPropBox.Text = obj.ToString();
textPropBox.ApplyButtonEnabled = false; // reset to disabled mode when changed

if (stringObj.Name == PORTAL_NAME_OBJ_NAME) // Portal type name display - "pn" = portal name
{
Expand All @@ -1475,15 +1473,14 @@ private void ShowObjectValue(WzObject obj)
else
{
textPropBox.AcceptsReturn = true;

textPropBox.Height = 200;
}
}
}
else if (bIsWzLongProperty || bIsWzIntProperty)
{
textPropBox.Visibility = Visibility.Visible;
textPropBox.AcceptsReturn = false;
textPropBox.Height = 35;
textPropBox.ApplyButtonEnabled = false; // reset to disabled mode when changed

ulong value_ = 0;
if (bIsWzLongProperty)
Expand All @@ -1505,11 +1502,11 @@ private void ShowObjectValue(WzObject obj)
// Set visibility
fieldLimitPanelHost.Visibility = Visibility.Visible;
}
textPropBox.Text = value_.ToString();
}
else
{
textPropBox.AcceptsReturn = false;
textPropBox.Height = 35;
}
}
else if (obj is WzVectorProperty property)
Expand Down
10 changes: 5 additions & 5 deletions HaSharedLibrary/GUI/ChangeableTextBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

mc:Ignorable="d"
Height="35"
d:DesignHeight="40" d:DesignWidth="570">

<Grid Width="570">
<Grid>
<Grid Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition Width="410" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>

<TextBlock Text="{Binding Header}" VerticalAlignment="Center" Grid.Column="0" FontSize="20"
<TextBlock Text="{Binding Header}" VerticalAlignment="Center" Grid.Column="0" FontSize="16"
Foreground="Gray"/>

<TextBox x:Name="textBox" Grid.Column="1"
VerticalContentAlignment="Center"
Background="White" BorderBrush="White" FontSize="16" TextWrapping="{Binding TextWrap}"
TextChanged="textBox_TextChanged" AcceptsReturn="{Binding AcceptsReturn}"/>

<Button x:Name="applyButton" Content="Apply" Grid.Column="2" MaxHeight="40" MinHeight="30" VerticalAlignment="Top"
<Button x:Name="applyButton" Content="Apply" Grid.Column="2" Margin="5,0,0,0" Height="25" VerticalAlignment="Center"
Click="applyButton_Click"/>
</Grid>
</Grid>
Expand Down
5 changes: 4 additions & 1 deletion HaSharedLibrary/GUI/ChangeableTextBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public string Text
}
}

public bool ButtonEnabled
/// <summary>
/// Apply button
/// </summary>
public bool ApplyButtonEnabled
{
get { return applyButton.IsEnabled; }
set {
Expand Down

0 comments on commit 6c21fcf

Please sign in to comment.