Skip to content

Commit

Permalink
PR review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shushishtok committed Sep 9, 2024
1 parent b8560cb commit 747d272
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/TSMapEditor/Config/UI/Windows/TriggersWindow.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $CCa09=lblActionParameterValue:XNALabel
$CCa10=tbActionParameterValue:EditorTextBox
$CCa11=btnActionParameterValuePreset:EditorButton
$CCa12=btnCloneAction:EditorButton
$CCa13=btnActionGoToSource:EditorButton
$CCa13=btnActionGoToTarget:EditorButton

$Height=getBottom(lbActionParameters) + EMPTY_SPACE_BOTTOM
$Width=getRight(tbName) + EMPTY_SPACE_SIDES
Expand Down Expand Up @@ -378,8 +378,8 @@ $Y=getY(tbActionParameterValue)
$Width=30
Text=...

[btnActionGoToSource]
[btnActionGoToTarget]
$X=getX(tbActionParameterValue)
$Y=getBottom(tbActionParameterValue) + VERTICAL_SPACING
$Width=getWidth(tbActionParameterValue) - 10
Text=Go To Source ->
Text=Go To Target ->
36 changes: 17 additions & 19 deletions src/TSMapEditor/UI/Windows/TriggersWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public TriggersWindow(WindowManager windowManager, Map map, EditorState editorSt
private EditorDescriptionPanel panelActionDescription;
private EditorListBox lbActionParameters;
private EditorTextBox tbActionParameterValue;
private EditorButton btnActionGoToSource;
private EditorButton btnActionGoToTarget;
private XNAContextMenu ctxActionParameterPresetValues;

private SelectEventWindow selectEventWindow;
Expand Down Expand Up @@ -163,7 +163,7 @@ public override void Initialize()
panelEventDescription = FindChild<EditorDescriptionPanel>(nameof(panelEventDescription));
lbEventParameters = FindChild<EditorListBox>(nameof(lbEventParameters));
tbEventParameterValue = FindChild<EditorTextBox>(nameof(tbEventParameterValue));
btnActionGoToSource = FindChild<EditorButton>(nameof(btnActionGoToSource));
btnActionGoToTarget = FindChild<EditorButton>(nameof(btnActionGoToTarget));

ctxEventParameterPresetValues = new XNAContextMenu(WindowManager);
ctxEventParameterPresetValues.Name = nameof(ctxEventParameterPresetValues);
Expand Down Expand Up @@ -225,7 +225,7 @@ public override void Initialize()
FindChild<EditorButton>("btnActionParameterValuePreset").LeftClick += BtnActionParameterValuePreset_LeftClick;
FindChild<EditorButton>("btnEventParameterValuePreset").LeftClick += BtnEventParameterValuePreset_LeftClick;

btnActionGoToSource.LeftClick += BtnActionGoToSource_LeftClick;
btnActionGoToTarget.LeftClick += btnActionGoToTarget_LeftClick;

selectEventWindow = new SelectEventWindow(WindowManager, map);
var eventWindowDarkeningPanel = DarkeningPanel.InitializeAndAddToParentControlWithChild(WindowManager, Parent, selectEventWindow);
Expand Down Expand Up @@ -1054,7 +1054,7 @@ private void BtnActionParameterValuePreset_LeftClick(object sender, EventArgs e)
}
}

private void BtnActionGoToSource_LeftClick(object sender, EventArgs e)
private void btnActionGoToTarget_LeftClick(object sender, EventArgs e)
{
if (lbActions.SelectedItem == null)
return;
Expand All @@ -1063,10 +1063,7 @@ private void BtnActionGoToSource_LeftClick(object sender, EventArgs e)

var triggerActionType = GetTriggerActionType(triggerAction.ActionIndex);
var triggerActionParam = triggerActionType.Parameters[paramIndex];
var triggerParamType = triggerActionParam.TriggerParamType;

if (!supportedGoToSourceTriggerParamTypes.Contains(triggerParamType))
return;
var triggerParamType = triggerActionParam.TriggerParamType;

switch (triggerParamType)
{
Expand Down Expand Up @@ -1119,12 +1116,6 @@ private void BtnActionGoToSource_LeftClick(object sender, EventArgs e)
}
}

private void SetGoToSourceButtonVisibility(bool enabled)
{
btnActionGoToSource.Enabled = enabled;
btnActionGoToSource.Visible = enabled;
}

private void AnimationWindowDarkeningPanel_Hidden(object sender, EventArgs e)
{
if (selectAnimationWindow.SelectedObject == null)
Expand Down Expand Up @@ -1634,7 +1625,7 @@ private void EditTrigger(Trigger trigger)
lbActionParameters.Clear();
tbActionParameterValue.Text = string.Empty;

SetGoToSourceButtonVisibility(false);
btnActionGoToTarget.Disable();

return;
}
Expand Down Expand Up @@ -1767,7 +1758,7 @@ private void LbActions_SelectedIndexChanged(object sender, EventArgs e)
lbActionParameters.Clear();
tbActionParameterValue.Text = string.Empty;

SetGoToSourceButtonVisibility(false);
btnActionGoToTarget.Disable();
return;
}

Expand Down Expand Up @@ -1837,15 +1828,22 @@ private void LbActionParameters_SelectedIndexChanged(object sender, EventArgs e)
tbActionParameterValue.Text = GetParamValueText(triggerAction.Parameters[paramNumber], triggerParamType, triggerActionParam.PresetOptions);
tbActionParameterValue.TextColor = GetParamValueColor(triggerAction.Parameters[paramNumber], triggerParamType);

var isSupportedGoToSourceParamType = supportedGoToSourceTriggerParamTypes.Contains(triggerParamType);
SetGoToSourceButtonVisibility(isSupportedGoToSourceParamType);
bool isSupportedGoToSourceParamType = supportedGoToSourceTriggerParamTypes.Contains(triggerParamType);
if (isSupportedGoToSourceParamType)
{
btnActionGoToTarget.Enable();
}
else
{
btnActionGoToTarget.Disable();
}
}
else
{
tbActionParameterValue.Text = triggerAction.Parameters[paramNumber];
tbActionParameterValue.TextColor = UISettings.ActiveSettings.AltColor;

SetGoToSourceButtonVisibility(false);
btnActionGoToTarget.Disable();
}

tbActionParameterValue.TextChanged += TbActionParameterValue_TextChanged;
Expand Down

0 comments on commit 747d272

Please sign in to comment.