Skip to content

Commit 49979a5

Browse files
committed
Add default value to all selected SubObjects (multiple subs can be selected in listview and set)
1 parent c0b999e commit 49979a5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

EDSEditorGUI/DeviceODView.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,26 +533,34 @@ private void ObjectSave()
533533
}
534534

535535
// Default value
536+
if (listView_subObjects.SelectedItems.Count > 1) {
537+
for (ushort i = 0; i < listView_subObjects.SelectedItems.Count; i++)
538+
{
539+
od.parent.subobjects[(ushort) Convert.ToInt32(listView_subObjects.SelectedItems[i].Text,16)].defaultvalue = textBox_defaultValue.Text;
540+
}
541+
}
542+
543+
536544
bool setDefaultValueToAll = false;
537545
bool identicalDefaultValues = true;
538-
string oldDefaultValue = "";
539-
if (od.parent != null && od.Subindex > 1)
546+
547+
if (od.parent != null && od.parent.Nosubindexes > 2)
540548
{
541549

542550
for (int i = 2; i < od.parent.Nosubindexes; i++)
543551
{
544552
identicalDefaultValues &= (od.parent.subobjects[(ushort)i].defaultvalue == od.parent.subobjects[(ushort)(i - 1)].defaultvalue);
545553
}
546-
554+
547555
if (identicalDefaultValues) {
548-
DialogResult confirm = MessageBox.Show("Do you want to set all identical default values in subobjects to this default value?", "Set to all?", MessageBoxButtons.YesNo);
556+
DialogResult confirm = MessageBox.Show("Do you want to set all identical default values in subobjects to this default value?", "Set to all?", MessageBoxButtons.YesNo);
549557
if (confirm == DialogResult.Yes)
550558
{
551559
setDefaultValueToAll = true;
552560
}
553561
}
554562
}
555-
if (setDefaultValueToAll)
563+
if (setDefaultValueToAll)
556564
{
557565
for (ushort i = 1; i < od.parent.Nosubindexes; i++)
558566
{

0 commit comments

Comments
 (0)