Inheritance: ComplexConcLeafNode
コード例 #1
0
		private void m_insertControl_Insert(object sender, InsertEventArgs e)
		{
			ComplexConcPatternNode node = null;
			switch (((InsertOption) e.Option).Type)
			{
				case ComplexConcordanceInsertType.Morph:
					using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg())
					{
						ComplexConcMorphNode morphNode = new ComplexConcMorphNode();
						dlg.SetDlgInfo(m_cache, m_mediator, morphNode);
						if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
							node = morphNode;
					}
					break;

				case ComplexConcordanceInsertType.Word:
					using (ComplexConcWordDlg dlg = new ComplexConcWordDlg())
					{
						ComplexConcWordNode wordNode = new ComplexConcWordNode();
						dlg.SetDlgInfo(m_cache, m_mediator, wordNode);
						if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
							node = wordNode;
					}
					break;

				case ComplexConcordanceInsertType.TextTag:
					using (ComplexConcTagDlg dlg = new ComplexConcTagDlg())
					{
						ComplexConcTagNode tagNode = new ComplexConcTagNode();
						dlg.SetDlgInfo(m_cache, m_mediator, tagNode);
						if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
							node = tagNode;
					}
					break;

				case ComplexConcordanceInsertType.Or:
					node = new ComplexConcOrNode();
					break;

				case ComplexConcordanceInsertType.WordBoundary:
					node = new ComplexConcWordBdryNode();
					break;
			}

			m_view.Select();

			if (node == null)
				return;

			SelectionHelper sel = SelectionHelper.Create(m_view);

			ComplexConcPatternNode parent;
			int index;
			GetInsertionIndex(sel, out parent, out index);
			// if the current selection is a range remove the items we are overwriting
			if (sel.IsRange)
			{
				foreach (ComplexConcPatternNode n in CurrentNodes)
					n.Parent.Children.Remove(n);
			}

			parent.Children.Insert(index, node);
			ReconstructView(parent, index, false);
		}
コード例 #2
0
        private void m_insertControl_Insert(object sender, InsertEventArgs e)
        {
            ComplexConcPatternNode node = null;

            switch (((InsertOption)e.Option).Type)
            {
            case ComplexConcordanceInsertType.Morph:
                using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg())
                {
                    ComplexConcMorphNode morphNode = new ComplexConcMorphNode();
                    dlg.SetDlgInfo(m_cache, m_mediator, morphNode);
                    if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
                    {
                        node = morphNode;
                    }
                }
                break;

            case ComplexConcordanceInsertType.Word:
                using (ComplexConcWordDlg dlg = new ComplexConcWordDlg())
                {
                    ComplexConcWordNode wordNode = new ComplexConcWordNode();
                    dlg.SetDlgInfo(m_cache, m_mediator, wordNode);
                    if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
                    {
                        node = wordNode;
                    }
                }
                break;

            case ComplexConcordanceInsertType.TextTag:
                using (ComplexConcTagDlg dlg = new ComplexConcTagDlg())
                {
                    ComplexConcTagNode tagNode = new ComplexConcTagNode();
                    dlg.SetDlgInfo(m_cache, m_mediator, tagNode);
                    if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
                    {
                        node = tagNode;
                    }
                }
                break;

            case ComplexConcordanceInsertType.Or:
                node = new ComplexConcOrNode();
                break;

            case ComplexConcordanceInsertType.WordBoundary:
                node = new ComplexConcWordBdryNode();
                break;
            }

            m_view.Select();

            if (node == null)
            {
                return;
            }

            SelectionHelper sel = SelectionHelper.Create(m_view);

            ComplexConcPatternNode parent;
            int index;

            GetInsertionIndex(sel, out parent, out index);
            // if the current selection is a range remove the items we are overwriting
            if (sel.IsRange)
            {
                foreach (ComplexConcPatternNode n in CurrentNodes)
                {
                    n.Parent.Children.Remove(n);
                }
            }

            parent.Children.Insert(index, node);
            ReconstructView(parent, index, false);
        }