Component 'Copy' implemented.
This commit is contained in:
parent
fd81675168
commit
1e2711a616
@ -68,7 +68,8 @@ namespace TBF
|
||||
SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up |
|
||||
SharedButtons.Buttons.Down |
|
||||
SharedButtons.Buttons.Edit;
|
||||
SharedButtons.Buttons.Edit |
|
||||
SharedButtons.Buttons.Copy;
|
||||
sharedButtons.Unlocked += Unlocked;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
@ -77,7 +78,8 @@ namespace TBF
|
||||
sharedButtons.UpClicked += upButton_Click;
|
||||
sharedButtons.DownClicked += downButton_Click;
|
||||
sharedButtons.EditClicked += editButton_Click;
|
||||
}
|
||||
sharedButtons.CopyClicked += copyButton_Click;
|
||||
}
|
||||
|
||||
private void ComponentsManagerDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -380,7 +382,7 @@ namespace TBF
|
||||
editButton_Click(sender, e);
|
||||
}
|
||||
|
||||
/// Edit the component
|
||||
/// Edit a component
|
||||
private void editButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedIndices.Count != 1) return;
|
||||
@ -415,6 +417,34 @@ namespace TBF
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy a component
|
||||
private void copyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedIndices.Count != 1) return;
|
||||
ListViewItem lvi = listViewEx.SelectedItems[0];
|
||||
|
||||
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Component)lvi.Tag);
|
||||
if (cfg != null)
|
||||
{
|
||||
cfg.Name += Strings.New_name_copy;
|
||||
if (selectComponentTypeDlg.SelectedScriptName == null)
|
||||
{
|
||||
IComponentCfgCtrl cfgControl = cfg.GetControl();
|
||||
cfgControl.Config = cfg;
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
cfgForm.TbfComponents = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
if (cfgForm.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
AddOne(cfgForm.Config.CreateDbEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void upButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedIndices.Count != 1) return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user