From 34e217a4c7f43fd1b4f1b67e9c92c32250799f14 Mon Sep 17 00:00:00 2001 From: cadaei Date: Tue, 28 Mar 2017 00:58:03 +0200 Subject: [PATCH] The notes-tab works. added buttons for delete incubation-timer. --- ARKBreedingStats/ArkOCR.cs | 1 + ARKBreedingStats/Form1.Designer.cs | 26 ++++++++-- ARKBreedingStats/Form1.cs | 7 +++ ARKBreedingStats/Form1.resx | 15 ++++++ ARKBreedingStats/NotesControl.Designer.cs | 26 ++++++++-- ARKBreedingStats/NotesControl.cs | 34 ++++++++++++- ARKBreedingStats/Properties/AssemblyInfo.cs | 2 +- ARKBreedingStats/RaisingControl.Designer.cs | 54 ++++++++++++++------- ARKBreedingStats/RaisingControl.cs | 38 +++++++++++++++ ARKBreedingStats/Win32Stuff.cs | 1 - ARKBreedingStats/ver.txt | 2 +- 11 files changed, 174 insertions(+), 32 deletions(-) diff --git a/ARKBreedingStats/ArkOCR.cs b/ARKBreedingStats/ArkOCR.cs index c2c8eef8..00525915 100644 --- a/ARKBreedingStats/ArkOCR.cs +++ b/ARKBreedingStats/ArkOCR.cs @@ -74,6 +74,7 @@ public ArkOCR() else if (l < 165) charWeighting[l] = 0.97; // letters with accents else charWeighting[l] = 0.8; // symbols } + charWeighting[108] = 0.98;// l (i is often mistaken for l) screenCaptureApplicationName = "ShooterGame"; } diff --git a/ARKBreedingStats/Form1.Designer.cs b/ARKBreedingStats/Form1.Designer.cs index c728bb68..be02c3e3 100644 --- a/ARKBreedingStats/Form1.Designer.cs +++ b/ARKBreedingStats/Form1.Designer.cs @@ -232,6 +232,7 @@ private void InitializeComponent() this.labelListening = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.comboBoxSpeciesGlobal = new System.Windows.Forms.ComboBox(); + this.toolStripButtonDeleteExpiredIncubationTimers = new System.Windows.Forms.ToolStripButton(); this.statPotentials1 = new ARKBreedingStats.uiControls.StatPotentials(); this.radarChart1 = new ARKBreedingStats.RadarChart(); this.statTestingHealth = new ARKBreedingStats.StatIO(); @@ -2116,7 +2117,8 @@ private void InitializeComponent() this.toolStripButtonAddPlayer, this.toolStripButtonAddTribe, this.toolStripButtonAddNote, - this.toolStripButtonRemoveNote}); + this.toolStripButtonRemoveNote, + this.toolStripButtonDeleteExpiredIncubationTimers}); this.toolStrip2.Location = new System.Drawing.Point(0, 24); this.toolStrip2.Name = "toolStrip2"; this.toolStrip2.Size = new System.Drawing.Size(921, 25); @@ -2246,6 +2248,7 @@ private void InitializeComponent() this.toolStripButtonAddNote.Name = "toolStripButtonAddNote"; this.toolStripButtonAddNote.Size = new System.Drawing.Size(62, 22); this.toolStripButtonAddNote.Text = "Add Note"; + this.toolStripButtonAddNote.Visible = false; this.toolStripButtonAddNote.Click += new System.EventHandler(this.toolStripButtonAddNote_Click); // // toolStripButtonRemoveNote @@ -2256,6 +2259,7 @@ private void InitializeComponent() this.toolStripButtonRemoveNote.Name = "toolStripButtonRemoveNote"; this.toolStripButtonRemoveNote.Size = new System.Drawing.Size(83, 22); this.toolStripButtonRemoveNote.Text = "Remove Note"; + this.toolStripButtonRemoveNote.Visible = false; this.toolStripButtonRemoveNote.Click += new System.EventHandler(this.toolStripButtonRemoveNote_Click); // // panelToolBar @@ -2319,6 +2323,17 @@ private void InitializeComponent() this.comboBoxSpeciesGlobal.TabIndex = 1; this.comboBoxSpeciesGlobal.SelectedIndexChanged += new System.EventHandler(this.comboBoxSpeciesGlobal_SelectedIndexChanged); // + // toolStripButtonDeleteExpiredIncubationTimers + // + this.toolStripButtonDeleteExpiredIncubationTimers.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButtonDeleteExpiredIncubationTimers.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonDeleteExpiredIncubationTimers.Image"))); + this.toolStripButtonDeleteExpiredIncubationTimers.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonDeleteExpiredIncubationTimers.Name = "toolStripButtonDeleteExpiredIncubationTimers"; + this.toolStripButtonDeleteExpiredIncubationTimers.Size = new System.Drawing.Size(102, 22); + this.toolStripButtonDeleteExpiredIncubationTimers.Text = "Delete All Expired"; + this.toolStripButtonDeleteExpiredIncubationTimers.Visible = false; + this.toolStripButtonDeleteExpiredIncubationTimers.Click += new System.EventHandler(this.toolStripButtonDeleteExpiredIncubationTimers_Click); + // // statPotentials1 // this.statPotentials1.Location = new System.Drawing.Point(556, 243); @@ -2482,7 +2497,7 @@ private void InitializeComponent() // // creatureInfoInputTester // - this.creatureInfoInputTester.Cooldown = new System.DateTime(2017, 3, 26, 17, 18, 42, 60); + this.creatureInfoInputTester.Cooldown = new System.DateTime(2017, 3, 28, 0, 38, 22, 935); this.creatureInfoInputTester.CreatureName = ""; this.creatureInfoInputTester.CreatureNote = ""; this.creatureInfoInputTester.CreatureOwner = ""; @@ -2490,7 +2505,7 @@ private void InitializeComponent() this.creatureInfoInputTester.CreatureStatus = ARKBreedingStats.CreatureStatus.Available; this.creatureInfoInputTester.domesticatedAt = new System.DateTime(2016, 7, 5, 13, 11, 41, 997); this.creatureInfoInputTester.father = null; - this.creatureInfoInputTester.Grown = new System.DateTime(2017, 3, 26, 17, 18, 42, 60); + this.creatureInfoInputTester.Grown = new System.DateTime(2017, 3, 28, 0, 38, 22, 935); this.creatureInfoInputTester.Location = new System.Drawing.Point(321, 184); this.creatureInfoInputTester.mother = null; this.creatureInfoInputTester.MutationCounter = 0; @@ -2666,7 +2681,7 @@ private void InitializeComponent() // // creatureInfoInputExtractor // - this.creatureInfoInputExtractor.Cooldown = new System.DateTime(2017, 3, 26, 17, 18, 42, 85); + this.creatureInfoInputExtractor.Cooldown = new System.DateTime(2017, 3, 28, 0, 38, 22, 964); this.creatureInfoInputExtractor.CreatureName = ""; this.creatureInfoInputExtractor.CreatureNote = ""; this.creatureInfoInputExtractor.CreatureOwner = ""; @@ -2674,7 +2689,7 @@ private void InitializeComponent() this.creatureInfoInputExtractor.CreatureStatus = ARKBreedingStats.CreatureStatus.Available; this.creatureInfoInputExtractor.domesticatedAt = new System.DateTime(2016, 7, 5, 13, 12, 15, 968); this.creatureInfoInputExtractor.father = null; - this.creatureInfoInputExtractor.Grown = new System.DateTime(2017, 3, 26, 17, 18, 42, 85); + this.creatureInfoInputExtractor.Grown = new System.DateTime(2017, 3, 28, 0, 38, 22, 965); this.creatureInfoInputExtractor.Location = new System.Drawing.Point(321, 184); this.creatureInfoInputExtractor.mother = null; this.creatureInfoInputExtractor.MutationCounter = 0; @@ -3084,5 +3099,6 @@ private void InitializeComponent() private BreedingPlan breedingPlan1; private System.Windows.Forms.Label labelListening; private System.Windows.Forms.CheckBox chkbToggleOverlay; + private System.Windows.Forms.ToolStripButton toolStripButtonDeleteExpiredIncubationTimers; } } diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 697ed16c..533d8282 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -74,6 +74,7 @@ public Form1() raisingControl1.extractBaby += new RaisingControl.ExtractBabyEventHandler(extractBaby); raisingControl1.setSpeciesIndex += new setSpeciesIndexEventHandler(setSpeciesIndex); raisingControl1.timerControl = timerList1; + notesControl1.changed += new collectionChangedEventHandler(setCollectionChanged); extractor = new Extraction(); @@ -2272,6 +2273,7 @@ private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) toolStripButtonAddNote.Visible = tabControlMain.SelectedTab == tabPageNotes; toolStripButtonRemoveNote.Visible = tabControlMain.SelectedTab == tabPageNotes; raisingControl1.updateListView = tabControlMain.SelectedTab == tabPageRaising; + toolStripButtonDeleteExpiredIncubationTimers.Visible = tabControlMain.SelectedTab == tabPageRaising; if (tabControlMain.SelectedTab == tabPageStatTesting) { @@ -3587,6 +3589,11 @@ private void cbEvolutionEvent_CheckedChanged(object sender, EventArgs e) tamingControl1.EvolutionEvent = cbEvolutionEvent.Checked; } + private void toolStripButtonDeleteExpiredIncubationTimers_Click(object sender, EventArgs e) + { + raisingControl1.deleteAllExpiredIncubationTimers(); + } + /// /// fixes typos saved in earlier versions. is called right after loading a library /// diff --git a/ARKBreedingStats/Form1.resx b/ARKBreedingStats/Form1.resx index c87847fa..1eb84491 100644 --- a/ARKBreedingStats/Form1.resx +++ b/ARKBreedingStats/Form1.resx @@ -369,6 +369,21 @@ The TE can differ 0.1% due to ingame-rounding. mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== diff --git a/ARKBreedingStats/NotesControl.Designer.cs b/ARKBreedingStats/NotesControl.Designer.cs index 8f942480..bb460206 100644 --- a/ARKBreedingStats/NotesControl.Designer.cs +++ b/ARKBreedingStats/NotesControl.Designer.cs @@ -31,15 +31,19 @@ private void InitializeComponent() this.listViewNoteTitles = new System.Windows.Forms.ListView(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.richTextBoxNote = new System.Windows.Forms.RichTextBox(); + this.tbNoteTitle = new System.Windows.Forms.TextBox(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // listViewNoteTitles // this.listViewNoteTitles.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewNoteTitles.FullRowSelect = true; + this.listViewNoteTitles.HideSelection = false; this.listViewNoteTitles.Location = new System.Drawing.Point(3, 3); this.listViewNoteTitles.MultiSelect = false; this.listViewNoteTitles.Name = "listViewNoteTitles"; + this.tableLayoutPanel1.SetRowSpan(this.listViewNoteTitles, 2); this.listViewNoteTitles.Size = new System.Drawing.Size(194, 368); this.listViewNoteTitles.TabIndex = 0; this.listViewNoteTitles.UseCompatibleStateImageBehavior = false; @@ -52,11 +56,13 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 200F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.Controls.Add(this.listViewNoteTitles, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.richTextBoxNote, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.richTextBoxNote, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.tbNoteTitle, 1, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(735, 374); this.tableLayoutPanel1.TabIndex = 1; @@ -64,11 +70,21 @@ private void InitializeComponent() // richTextBoxNote // this.richTextBoxNote.Dock = System.Windows.Forms.DockStyle.Fill; - this.richTextBoxNote.Location = new System.Drawing.Point(203, 3); + this.richTextBoxNote.Location = new System.Drawing.Point(203, 25); this.richTextBoxNote.Name = "richTextBoxNote"; - this.richTextBoxNote.Size = new System.Drawing.Size(529, 368); + this.richTextBoxNote.Size = new System.Drawing.Size(529, 346); this.richTextBoxNote.TabIndex = 1; this.richTextBoxNote.Text = ""; + this.richTextBoxNote.Leave += new System.EventHandler(this.richTextBoxNote_Leave); + // + // tbNoteTitle + // + this.tbNoteTitle.Dock = System.Windows.Forms.DockStyle.Fill; + this.tbNoteTitle.Location = new System.Drawing.Point(203, 3); + this.tbNoteTitle.Name = "tbNoteTitle"; + this.tbNoteTitle.Size = new System.Drawing.Size(529, 20); + this.tbNoteTitle.TabIndex = 2; + this.tbNoteTitle.Leave += new System.EventHandler(this.tbNoteTitle_Leave); // // NotesControl // @@ -78,6 +94,7 @@ private void InitializeComponent() this.Name = "NotesControl"; this.Size = new System.Drawing.Size(735, 374); this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } @@ -87,5 +104,6 @@ private void InitializeComponent() private System.Windows.Forms.ListView listViewNoteTitles; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.RichTextBox richTextBoxNote; + private System.Windows.Forms.TextBox tbNoteTitle; } } diff --git a/ARKBreedingStats/NotesControl.cs b/ARKBreedingStats/NotesControl.cs index 0ca749ed..ed6362ef 100644 --- a/ARKBreedingStats/NotesControl.cs +++ b/ARKBreedingStats/NotesControl.cs @@ -13,6 +13,8 @@ namespace ARKBreedingStats public partial class NotesControl : UserControl { private List noteList; + private Note selectedNote; + public event Form1.collectionChangedEventHandler changed; public NotesControl() { @@ -43,7 +45,10 @@ private void listViewNoteTitles_SelectedIndexChanged(object sender, EventArgs e) { if (listViewNoteTitles.SelectedIndices.Count > 0) { - richTextBoxNote.Text = ((Note)(listViewNoteTitles.SelectedItems[0].Tag)).Text; + selectedNote = (Note)listViewNoteTitles.SelectedItems[0].Tag; + tbNoteTitle.Text = selectedNote.Title; + richTextBoxNote.Text = selectedNote.Text; + } } @@ -53,6 +58,9 @@ public void AddNote() ListViewItem lvi = new ListViewItem(n.Title); lvi.Tag = n; listViewNoteTitles.Items.Add(lvi); + listViewNoteTitles.Items[listViewNoteTitles.Items.Count - 1].Selected = true; + tbNoteTitle.Focus(); + tbNoteTitle.SelectAll(); } public void RemoveSelectedNote() @@ -60,9 +68,31 @@ public void RemoveSelectedNote() if (listViewNoteTitles.SelectedItems.Count > 0 && MessageBox.Show("Delete note with the title \"" + ((Note)(listViewNoteTitles.SelectedItems[0].Tag)).Title + "\"?", "Delete Note?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - listViewNoteTitles.Items.Remove(listViewNoteTitles.SelectedItems[0]); Note n = (Note)listViewNoteTitles.SelectedItems[0].Tag; noteList.Remove(n); + listViewNoteTitles.Items.Remove(listViewNoteTitles.SelectedItems[0]); + } + } + + private void richTextBoxNote_Leave(object sender, EventArgs e) + { + if (selectedNote != null) + { + selectedNote.Text = richTextBoxNote.Text; + changed?.Invoke(); + } + } + + private void tbNoteTitle_Leave(object sender, EventArgs e) + { + if (selectedNote != null) + { + if (listViewNoteTitles.SelectedIndices.Count > 0) + { + listViewNoteTitles.SelectedItems[0].Text = tbNoteTitle.Text; + } + selectedNote.Title = tbNoteTitle.Text; + changed?.Invoke(); } } } diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index c76b77ee..add5b376 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.22.0")] +[assembly: AssemblyFileVersion("0.22.1")] diff --git a/ARKBreedingStats/RaisingControl.Designer.cs b/ARKBreedingStats/RaisingControl.Designer.cs index 129027b1..3e6a49df 100644 --- a/ARKBreedingStats/RaisingControl.Designer.cs +++ b/ARKBreedingStats/RaisingControl.Designer.cs @@ -37,6 +37,8 @@ private void InitializeComponent() this.columnHeaderUntil = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.nudCurrentWeight = new System.Windows.Forms.NumericUpDown(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.labelAmountFoodAdult = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); this.labelAmountFoodBaby = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.labelTimeLeftGrowing = new System.Windows.Forms.Label(); @@ -59,8 +61,8 @@ private void InitializeComponent() this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.labelAmountFoodAdult = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); + this.deleteTimerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); ((System.ComponentModel.ISupportInitialize)(this.nudCurrentWeight)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudTotalWeight)).BeginInit(); @@ -155,6 +157,24 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Progress"; // + // labelAmountFoodAdult + // + this.labelAmountFoodAdult.AutoSize = true; + this.labelAmountFoodAdult.Location = new System.Drawing.Point(133, 126); + this.labelAmountFoodAdult.Name = "labelAmountFoodAdult"; + this.labelAmountFoodAdult.Size = new System.Drawing.Size(13, 13); + this.labelAmountFoodAdult.TabIndex = 14; + this.labelAmountFoodAdult.Text = "0"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(6, 126); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(114, 13); + this.label8.TabIndex = 15; + this.label8.Text = "Food for adult needed:"; + // // labelAmountFoodBaby // this.labelAmountFoodBaby.AutoSize = true; @@ -317,9 +337,11 @@ private void InitializeComponent() // contextMenuStripBabyList // this.contextMenuStripBabyList.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.extractValuesOfHatchedbornBabyToolStripMenuItem}); + this.extractValuesOfHatchedbornBabyToolStripMenuItem, + this.toolStripSeparator1, + this.deleteTimerToolStripMenuItem}); this.contextMenuStripBabyList.Name = "contextMenuStripBabyList"; - this.contextMenuStripBabyList.Size = new System.Drawing.Size(265, 26); + this.contextMenuStripBabyList.Size = new System.Drawing.Size(265, 76); // // extractValuesOfHatchedbornBabyToolStripMenuItem // @@ -364,23 +386,17 @@ private void InitializeComponent() this.groupBox2.TabStop = false; this.groupBox2.Text = "General Infos"; // - // labelAmountFoodAdult + // deleteTimerToolStripMenuItem // - this.labelAmountFoodAdult.AutoSize = true; - this.labelAmountFoodAdult.Location = new System.Drawing.Point(133, 126); - this.labelAmountFoodAdult.Name = "labelAmountFoodAdult"; - this.labelAmountFoodAdult.Size = new System.Drawing.Size(13, 13); - this.labelAmountFoodAdult.TabIndex = 14; - this.labelAmountFoodAdult.Text = "0"; + this.deleteTimerToolStripMenuItem.Name = "deleteTimerToolStripMenuItem"; + this.deleteTimerToolStripMenuItem.Size = new System.Drawing.Size(264, 22); + this.deleteTimerToolStripMenuItem.Text = "Delete Timer..."; + this.deleteTimerToolStripMenuItem.Click += new System.EventHandler(this.deleteTimerToolStripMenuItem_Click); // - // label8 + // toolStripSeparator1 // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 126); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(114, 13); - this.label8.TabIndex = 15; - this.label8.Text = "Food for adult needed:"; + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(261, 6); // // RaisingControl // @@ -435,5 +451,7 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.Label labelAmountFoodAdult; private System.Windows.Forms.Label label8; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem deleteTimerToolStripMenuItem; } } diff --git a/ARKBreedingStats/RaisingControl.cs b/ARKBreedingStats/RaisingControl.cs index e5976813..79bbc1fc 100644 --- a/ARKBreedingStats/RaisingControl.cs +++ b/ARKBreedingStats/RaisingControl.cs @@ -179,6 +179,11 @@ public void addIncubationTimer(Creature mother, Creature father, TimeSpan incuba recreateList(); } + private void removeIncubationTimer(IncubationTimerEntry ite) + { + cc.incubationListEntries.Remove(ite); + } + public void recreateList() { if (cc != null) @@ -311,6 +316,39 @@ private void extractValuesOfHatchedbornBabyToolStripMenuItem_Click(object sender } } + private void deleteTimerToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listViewBabies.SelectedIndices.Count > 0 + && listViewBabies.SelectedItems[0].Tag.GetType() == typeof(IncubationTimerEntry)) + { + IncubationTimerEntry ite = (IncubationTimerEntry)listViewBabies.SelectedItems[0].Tag; + if (MessageBox.Show("Delete this timer?\n" + ite.mother.species + ", ending in " + Utils.timeLeft(ite.incubationEnd), "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + removeIncubationTimer(ite); + recreateList(); + onChange?.Invoke(); + } + } + } + + public void deleteAllExpiredIncubationTimers() + { + if (MessageBox.Show("Delete all expired incubation timers?", "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + foreach (ListViewItem lvi in listViewBabies.Items) + { + if ((lvi.Tag.GetType() == typeof(IncubationTimerEntry))) + { + IncubationTimerEntry ite = (IncubationTimerEntry)lvi.Tag; + if (ite.incubationStarted && ite.incubationEnd < DateTime.Now) + removeIncubationTimer(ite); + } + } + recreateList(); + onChange?.Invoke(); + } + } + private void listViewBabies_SelectedIndexChanged(object sender, EventArgs e) { if (listViewBabies.SelectedIndices.Count > 0) diff --git a/ARKBreedingStats/Win32Stuff.cs b/ARKBreedingStats/Win32Stuff.cs index 8c2fcddf..e80ce526 100644 --- a/ARKBreedingStats/Win32Stuff.cs +++ b/ARKBreedingStats/Win32Stuff.cs @@ -130,7 +130,6 @@ public static Bitmap GrabCurrentScreen(IntPtr hwnd) gfxBmp.Dispose(); return bmp; - } public static Bitmap PrintWindow(IntPtr hwnd) diff --git a/ARKBreedingStats/ver.txt b/ARKBreedingStats/ver.txt index 4a3261c1..29327d5d 100644 --- a/ARKBreedingStats/ver.txt +++ b/ARKBreedingStats/ver.txt @@ -1 +1 @@ -2550002,0.22.0 \ No newline at end of file +2550002,0.22.1 \ No newline at end of file