Skip to content

Commit 75c3370

Browse files
committed
Feature: Succession can be expanded/collapsed
1 parent 5d15ed2 commit 75c3370

8 files changed

Lines changed: 92 additions & 12 deletions

HitCounterManagerMono.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@
150150
<None Include="Images\icons8-cloud-20.png" />
151151
<None Include="Images\icons8-copy-20.png" />
152152
<None Include="Images\icons8-counter-20.png" />
153+
<None Include="Images\icons8-double-down-20.png" />
154+
<None Include="Images\icons8-double-up-20.png" />
153155
<None Include="Images\icons8-edit-20.png" />
154156
<None Include="Images\icons8-pin-20.png" />
155157
<None Include="Images\icons8-repeat-one-32.png" />

HitCounterManagerWin.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@
132132
<None Include="Images\icons8-cloud-20.png" />
133133
<None Include="Images\icons8-copy-20.png" />
134134
<None Include="Images\icons8-counter-20.png" />
135+
<None Include="Images\icons8-double-down-20.png" />
136+
<None Include="Images\icons8-double-up-20.png" />
135137
<None Include="Images\icons8-edit-20.png" />
136138
<None Include="Images\icons8-pin-20.png" />
137139
<None Include="Images\icons8-repeat-one-32.png" />

Images/icons8-double-down-20.png

245 Bytes
Loading

Images/icons8-double-up-20.png

243 Bytes
Loading

Sources/Form1.Designer.cs

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

Sources/Form1.cs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public partial class Form1 : Form
4242
private bool DataGridView1_ValueChangedSema = false;
4343
private bool gpSuccession_ValueChangedSema = false;
4444

45+
private readonly int gpSuccession_Height;
46+
4547
#region Form
4648

4749
public Form1()
@@ -55,6 +57,9 @@ public Form1()
5557
gpSuccession_ValueChangedSema = false;
5658
DataGridView1_ValueChangedSema = false;
5759

60+
gpSuccession_Height = gpSuccession.Height;
61+
ShowSuccessionMenu(false); // start collapsed
62+
5863
pi = DataGridView1; // for better capsulation
5964
om = new OutModule(pi);
6065
sc = new Shortcuts(Handle);
@@ -108,6 +113,7 @@ private void Form1_Resize(object sender, EventArgs e)
108113

109114
// succession group
110115
txtPredecessorTitle.Width = gpSuccession.Width - txtPredecessorTitle.Left - Pad_Frame;
116+
btnSuccessionVisibility.Left = gpSuccession.Width - btnSuccessionVisibility.Width - Pad_Frame;
111117
}
112118

113119
protected override void WndProc(ref Message m)
@@ -589,11 +595,14 @@ private void BtnSuccessionProceed_Click(object sender, EventArgs e)
589595
int TotalPB = 0;
590596
GetCalculatedSums(ref TotalHits, ref TotalHitsWay, ref TotalPB);
591597
SetSuccession(TotalHits, TotalHitsWay, TotalPB);
598+
ShowSuccessionMenu(true);
592599
SuccessionChanged(sender, e);
593600

594601
MessageBox.Show("The progress of this profile was saved.\nYou can select your next profile now!", "Succession", MessageBoxButtons.OK, MessageBoxIcon.Information);
595602
}
596-
603+
604+
private void btnSuccessionVisibility_Click(object sender, EventArgs e) { ShowSuccessionMenu(); }
605+
597606
/// <summary>
598607
/// Interchange of two data rows
599608
/// </summary>
@@ -619,6 +628,31 @@ private bool PermuteSplit(int idx_from, int offset)
619628
return true;
620629
}
621630

631+
/// <summary>
632+
/// Collapses or expands succession menu
633+
/// </summary>
634+
/// <param name="expand">TRUE = Expand, FALSE = Collapse, NULL = Toggle</param>
635+
private void ShowSuccessionMenu(Nullable<bool> expand = null)
636+
{
637+
int diff = 0;
638+
639+
if (!expand.HasValue) expand = gpSuccession.Height != gpSuccession_Height; // Toggle
640+
641+
if (expand.Value) // Expand..
642+
{
643+
diff = gpSuccession_Height - gpSuccession.Height;
644+
gpSuccession.Height = gpSuccession_Height;
645+
btnSuccessionVisibility.BackgroundImage = Sources.Resources.icons8_double_up_20;
646+
}
647+
else // Collapse..
648+
{
649+
diff = btnSuccessionVisibility.Height - gpSuccession.Height;
650+
gpSuccession.Height = btnSuccessionVisibility.Height;
651+
btnSuccessionVisibility.BackgroundImage = Sources.Resources.icons8_double_down_20;
652+
}
653+
Height += diff;
654+
}
655+
622656
private void SetSuccession(int TotalHits, int TotalHitsWay, int TotalPB, string Title = null, bool ShowPredecessor = true)
623657
{
624658
gpSuccession_ValueChangedSema = true;

Sources/Resources.Designer.cs

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

Sources/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@
139139
<data name="icons8_counter_20" type="System.Resources.ResXFileRef, System.Windows.Forms">
140140
<value>..\Images\icons8-counter-20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
141141
</data>
142+
<data name="icons8-double-down-20" type="System.Resources.ResXFileRef, System.Windows.Forms">
143+
<value>..\Images\icons8-double-down-20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
144+
</data>
145+
<data name="icons8-double-up-20" type="System.Resources.ResXFileRef, System.Windows.Forms">
146+
<value>..\Images\icons8-double-up-20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
147+
</data>
142148
<data name="icons8_edit_20" type="System.Resources.ResXFileRef, System.Windows.Forms">
143149
<value>..\Images\icons8-edit-20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
144150
</data>

0 commit comments

Comments
 (0)