Skip to content

Commit 16bda43

Browse files
authored
fix: Add Close Button to Animation Editor & Conditionally Show Save Button Across Windows (AscensionGameDev#2689)
* add close button and conditionally show Save button * fix * allow only close button on all editor windows * allow only close button - projectile editor * Panda Review I * Weylon review
1 parent a163208 commit 16bda43

30 files changed

+173
-37
lines changed

Intersect.Editor/Forms/Editors/EditorForm.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using DarkUI.Controls;
12
using Intersect.Editor.Core;
23
using Intersect.Editor.Networking;
34
using Intersect.Enums;
@@ -12,6 +13,9 @@ public partial class EditorForm : Form
1213

1314
private bool mClosing = false;
1415

16+
protected DarkButton? _btnSave;
17+
protected DarkButton? _btnCancel;
18+
1519
protected EditorForm()
1620
{
1721
Icon = Program.Icon;
@@ -83,4 +87,18 @@ private void InitializeComponent()
8387

8488
}
8589

90+
protected void UpdateEditorButtons(bool isItemSelected)
91+
{
92+
if (_btnSave != null)
93+
{
94+
_btnSave.Visible = isItemSelected;
95+
_btnSave.Enabled = isItemSelected;
96+
}
97+
98+
if (_btnCancel != null)
99+
{
100+
_btnCancel.Visible = isItemSelected;
101+
_btnCancel.Enabled = isItemSelected;
102+
}
103+
}
86104
}

Intersect.Editor/Forms/Editors/Events/frmEvent.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Intersect.Editor/Forms/Editors/Quest/frmQuest.Designer.cs

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Intersect.Editor/Forms/Editors/Quest/frmQuest.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using DarkUI.Forms;
1+
using DarkUI.Forms;
22
using Intersect.Editor.Core;
33
using Intersect.Editor.Forms.Editors.Events;
44
using Intersect.Editor.General;
@@ -31,8 +31,12 @@ public FrmQuest()
3131
Icon = Program.Icon;
3232

3333
InitLocalization();
34+
_btnSave = btnSave;
35+
_btnCancel = btnCancel;
3436

3537
lstGameObjects.Init(UpdateToolStripItems, AssignEditorItem, toolStripItemNew_Click, toolStripItemCopy_Click, toolStripItemUndo_Click, toolStripItemPaste_Click, toolStripItemDelete_Click);
38+
39+
UpdateEditor();
3640
}
3741
private void AssignEditorItem(Guid id)
3842
{
@@ -121,6 +125,11 @@ protected override void GameObjectUpdatedDelegate(GameObjectType type)
121125
}
122126
}
123127

128+
private void FrmQuest_FormClosed(object sender, FormClosedEventArgs e)
129+
{
130+
btnCancel_Click(null, null);
131+
}
132+
124133
private void btnCancel_Click(object sender, EventArgs e)
125134
{
126135
foreach (var item in mChanged)
@@ -277,7 +286,10 @@ private void UpdateEditor()
277286
{
278287
pnlContainer.Hide();
279288
}
280-
289+
290+
var hasItem = mEditorItem != null;
291+
292+
UpdateEditorButtons(hasItem);
281293
UpdateToolStripItems();
282294
}
283295

Intersect.Editor/Forms/Editors/frmAnimation.Designer.cs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Intersect.Editor/Forms/Editors/frmAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ private void tmrUpperAnimation_Tick(object sender, EventArgs e)
527527

528528
private void frmAnimation_FormClosed(object sender, FormClosedEventArgs e)
529529
{
530-
Globals.CurrentEditor = -1;
530+
btnCancel_Click(null, null);
531531
}
532532

533533
private void scrlLowerFrame_Scroll(object sender, ScrollValueEventArgs e)

Intersect.Editor/Forms/Editors/frmClass.Designer.cs

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Intersect.Editor/Forms/Editors/frmClass.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,11 @@ private void UpdateExpGridValues(int start, int end = -1)
12801280
}
12811281
}
12821282

1283+
private void FrmClass_FormClosed(object sender, FormClosedEventArgs e)
1284+
{
1285+
btnCancel_Click(null, null);
1286+
}
1287+
12831288
private void btnCloseExpGrid_Click(object sender, EventArgs e)
12841289
{
12851290
grpExpGrid.Hide();

Intersect.Editor/Forms/Editors/frmCommonEvent.Designer.cs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Intersect.Editor/Forms/Editors/frmCraftingTables.Designer.cs

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)