Skip to content

Commit

Permalink
Merge pull request #983 from sweiland-openrails/SwitchPanelDpu
Browse files Browse the repository at this point in the history
WEB based Switch Panel bug: DPU window
  • Loading branch information
sweiland-openrails authored Sep 26, 2024
2 parents 336a700 + 202316e commit ca63633
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/RunActivity/Viewer3D/Popups/TrainDPUWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void VerticalWindow_Click(Control arg1, Point arg2)
UpdateWindowSize();
}

private void UpdateWindowSize()
public void UpdateWindowSize()
{
labels = TrainDPUWindowList(Owner.Viewer, normalTextMode).ToList();
ModifyWindowSize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ public bool IsPressed(UserCommand userCommand)
case UserCommand.DisplayHUD:
IsPressedDisplayHUD();
return false;
case UserCommand.DisplayTrainDpuWindow:
IsPressedDisplayDpuWindow();
return false;
default:
return true;
}
Expand Down Expand Up @@ -328,6 +331,52 @@ private void IsPressedDisplayHUD()
}
}

private void IsPressedDisplayDpuWindow()
{
if (!Viewer.TrainDpuWindow.Visible)
{
// DpuWindow not visible
Viewer.TrainDpuWindow.normalTextMode = true;
Viewer.TrainDpuWindow.normalVerticalMode = true;
Viewer.TrainDpuWindow.Visible = true;
Viewer.TrainDpuWindow.UpdateWindowSize();
}
else
{
// visible
if ((Viewer.TrainDpuWindow.normalTextMode == true) && (Viewer.TrainDpuWindow.normalVerticalMode == true))
{
Viewer.TrainDpuWindow.normalVerticalMode = false;
Viewer.TrainDpuWindow.UpdateWindowSize();
return;
}

if ((Viewer.TrainDpuWindow.normalTextMode == true) && (Viewer.TrainDpuWindow.normalVerticalMode == false))
{
Viewer.TrainDpuWindow.normalTextMode = false;
Viewer.TrainDpuWindow.normalVerticalMode = true;
Viewer.TrainDpuWindow.UpdateWindowSize();
return;
}

if ((Viewer.TrainDpuWindow.normalTextMode == false) && (Viewer.TrainDpuWindow.normalVerticalMode == true))
{
Viewer.TrainDpuWindow.normalVerticalMode = false;
Viewer.TrainDpuWindow.UpdateWindowSize();
return;
}

if ((Viewer.TrainDpuWindow.normalTextMode == false) && (Viewer.TrainDpuWindow.normalVerticalMode == false))
{
Viewer.TrainDpuWindow.normalTextMode = true;
Viewer.TrainDpuWindow.normalVerticalMode = true;
Viewer.TrainDpuWindow.Visible = false;
Viewer.TrainDpuWindow.UpdateWindowSize();
return;
}
}
}

public bool IsChanged()
{
bool changed = false;
Expand Down

0 comments on commit ca63633

Please sign in to comment.