//------------------------------------------------------------------- private void TextBoxSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { e.Handled = true; if (textBoxSearch.Text.Length < 2) { TaxonSearchAsync.Search(_Root, textBoxSearch.Text); } if (listBoxResult.Items.Count > 0) { TaxonTreeNode taxon = listBoxResult.GetAt(0); if (taxon != null) { TaxonUtils.GotoTaxon(taxon); TaxonUtils.SelectTaxon(taxon); } } } if (e.KeyCode == Keys.Down) { if (listBoxResult.Items.Count > 0) { e.Handled = true; listBoxResult.Focus(); if (listBoxResult.SelectedIndex == -1) { listBoxResult.SelectedIndex = 0; } } } }
void PasteClipboard(TaxonTreeNode _to) { if (Clipboard.ContainsData("TaxonTreeNodeXmlMemoryStream")) { object o = Clipboard.GetData("TaxonTreeNodeXmlMemoryStream"); if (o is System.IO.MemoryStream ms) { TaxonTreeNode node = TaxonTreeNode.LoadXMLFromMemory(ms); if (node != null) { ImportNode(_to, node); } } } else if (Clipboard.ContainsData(DataFormats.Text)) { string name = Clipboard.GetText(); if (name == null) { return; } TaxonTreeNode node = Root.FindTaxonByFullName(name); if (node != null) { TaxonUtils.GotoTaxon(node); TaxonUtils.SelectTaxon(node); } } }
//------------------------------------------------------------------- private void OnSelect(object sender, EventArgs e) { if (!(sender is ToolStripMenuItem)) { return; } if (!((sender as ToolStripMenuItem).Tag is TaxonTreeNode node)) { return; } TaxonUtils.GotoTaxon(node); TaxonUtils.SelectTaxon(node); }
//--------------------------------------------------------------------------------- public void loadToolStripMenuItem_Click(object sender, EventArgs e) { string filename = TaxonUtils.GetTaxonFileName(); TaxonTreeNode node = TaxonUtils.Load(ref filename); if (node == null) { return; } TaxonUtils.MyConfig.TaxonPath = Path.GetDirectoryName(filename); TaxonUtils.MyConfig.TaxonFileName = Path.GetFileName(filename); TaxonUtils.SetOriginalRoot(node); TaxonUtils.Invalidate(); TaxonUtils.GotoTaxon(node); }
//--------------------------------------------------------------------------------- private void _MultiImages_DoubleClick(object sender, Controls.TaxonMultiImageSoundControl.OnClickImageEventArgs e) { if (!(sender is Controls.TaxonMultiImageSoundControl)) { return; } if (e.Taxon == null) { return; } if (_CurrentTaxon != e.Taxon) { TaxonUtils.GotoTaxon(e.Taxon); TaxonUtils.SelectTaxon(e.Taxon); return; } NumberInMultiImageControl = 1; _MultiImages.ScrollTo(e.ImageIndex, e.Item?.Bounds); }
//------------------------------------------------------------------- protected override void OnMouseDoubleClick(MouseEventArgs e) { if (Selected != null && ShortcutModeKeyOn()) { foreach (ShortcutData data in ShortcutModeDatas.Values) { if (data.Siblings.TryGetValue(Selected, out Rectangle R)) { ShortcutModeClear(); TaxonUtils.MoveTaxonTo(Selected, R); return; } } } if (BelowMouse == null) { TaxonTreeNode taxon = TaxonUtils.Root; TaxonUtils.SelectTaxon(taxon); TaxonUtils.GotoTaxon(taxon); } }
//-------------------------------------------------------------------------------------- protected override void OnMouseDoubleClick(MouseEventArgs e) { if (MouseDoubleClickMode == MouseDoubleClickModeEnum.DoNothing) { return; } if (SelectedItem == null) { return; } if (!(SelectedItem is Taxon)) { return; } TaxonUtils.GotoTaxon(SelectedItem as Taxon); if (MouseDoubleClickMode == MouseDoubleClickModeEnum.SelectTaxon) { TaxonUtils.SelectTaxon(SelectedItem as Taxon); } }
//------------------------------------------------------------------- protected override void OnMouseUp(MouseEventArgs e) { if (move) { _InertiaMove.EndSamples(); move = false; return; } mouseDown = false; if (e.Button == MouseButtons.Left) { if (!_EditionToolInfo.DoAction()) { if (BelowMouse == null) { TaxonUtils.GotoTaxon(Selected); } else { Selected = BelowMouse; } } } }
//-------------------------------------------------------------------------------------- private void onSelect(object sender, EventArgs e) { TaxonUtils.GotoTaxon(SelectedItem as Taxon); }
//------------------------------------------------------------------- private void gotoSelectedToolStripMenuItem_Click(object sender, EventArgs e) { TaxonUtils.GotoTaxon(TaxonUtils.SelectedTaxon()); }
//------------------------------------------------------------------- private void gotoRootToolStripMenuItem_Click(object sender, EventArgs e) { TaxonUtils.GotoTaxon(TaxonUtils.Root); }