Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some interface fixes #1678

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OpenDreamClient/Interface/Controls/ControlBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ private void HandleEmbeddedWinset(string query) {

public void OnShowEvent() {
ControlDescriptorBrowser controlDescriptor = (ControlDescriptorBrowser)ControlDescriptor;
if (controlDescriptor.OnShowCommand != null) {
if (!string.IsNullOrWhiteSpace(controlDescriptor.OnShowCommand)) {
_interfaceManager.RunCommand(controlDescriptor.OnShowCommand);
}
}

public void OnHideEvent() {
ControlDescriptorBrowser controlDescriptor = (ControlDescriptorBrowser)ControlDescriptor;
if (controlDescriptor.OnHideCommand != null) {
if (!string.IsNullOrWhiteSpace(controlDescriptor.OnHideCommand)) {
_interfaceManager.RunCommand(controlDescriptor.OnHideCommand);
}
}
Expand Down
4 changes: 2 additions & 2 deletions OpenDreamClient/Interface/Controls/ControlChild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void UpdateElementDescriptor() {
? rightWindow.UIElement
: null;

if (newLeftElement != _leftElement || _grid.ChildCount == 0) {
if (newLeftElement != _leftElement || _grid.ChildCount == 1) {
if (_leftElement != null)
_grid.Children.Remove(_leftElement);

Expand All @@ -46,7 +46,7 @@ protected override void UpdateElementDescriptor() {
_grid.Children.Add(_leftElement);
}

if (newRightElement != _rightElement || _grid.ChildCount == 1) {
if (newRightElement != _rightElement || _grid.ChildCount == 2) {
if (_rightElement != null)
_grid.Children.Remove(_rightElement);

Expand Down
4 changes: 2 additions & 2 deletions OpenDreamClient/Interface/Controls/ControlInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ private void OnSelectionChanged(int tabIndex) {

public void OnShowEvent() {
ControlDescriptorInfo controlDescriptor = (ControlDescriptorInfo)ControlDescriptor;
if (controlDescriptor.OnShowCommand != null) {
if (!string.IsNullOrWhiteSpace(controlDescriptor.OnShowCommand)) {
_interfaceManager.RunCommand(controlDescriptor.OnShowCommand);
}
}

public void OnHideEvent() {
ControlDescriptorInfo controlDescriptor = (ControlDescriptorInfo)ControlDescriptor;
if (controlDescriptor.OnHideCommand != null) {
if (!string.IsNullOrWhiteSpace(controlDescriptor.OnHideCommand)) {
_interfaceManager.RunCommand(controlDescriptor.OnHideCommand);
}
}
Expand Down
4 changes: 2 additions & 2 deletions OpenDreamClient/Interface/Controls/ControlMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ private void OnViewportKeyBindEvent(GUIBoundKeyEventArgs e) {

public void OnShowEvent() {
ControlDescriptorMap controlDescriptor = (ControlDescriptorMap)ControlDescriptor;
if (controlDescriptor.OnShowCommand != null) {
if (!string.IsNullOrWhiteSpace(controlDescriptor.OnShowCommand)) {
_interfaceManager.RunCommand(controlDescriptor.OnShowCommand);
}
}

public void OnHideEvent() {
ControlDescriptorMap controlDescriptor = (ControlDescriptorMap)ControlDescriptor;
if (controlDescriptor.OnHideCommand != null) {
if (!string.IsNullOrWhiteSpace(controlDescriptor.OnHideCommand)) {
_interfaceManager.RunCommand(controlDescriptor.OnHideCommand);
}
}
Expand Down
4 changes: 2 additions & 2 deletions OpenDreamClient/Interface/Controls/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ public OSWindow CreateWindow() {
window.SetHeight = window.MaxHeight;
window.Closing += _ => {
// A window can have a command set to be run when it's closed
if (WindowDescriptor.OnClose != null) {
if (!string.IsNullOrWhiteSpace(WindowDescriptor.OnClose)) {
_interfaceManager.RunCommand(WindowDescriptor.OnClose);
}

_myWindow = (null, _myWindow.clydeWindow);
};
window.StartupLocation = WindowStartupLocation.CenterOwner;
Expand Down Expand Up @@ -151,7 +152,6 @@ public void UpdateAnchors() {
element.SetWidth = Math.Max(width, 0);
element.SetHeight = Math.Max(height, 0);
}

}
}
}
Expand Down
Loading