示例#1
0
        public bool OnPatternNodeSetCriteria(object args)
        {
            CheckDisposed();
            ComplexConcPatternNode[] nodes = CurrentNodes;

            ComplexConcWordNode wordNode = nodes[0] as ComplexConcWordNode;
            var xwindow = m_propertyTable.GetValue <XWindow>("window");

            if (wordNode != null)
            {
                using (ComplexConcWordDlg dlg = new ComplexConcWordDlg())
                {
                    dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, wordNode);
                    if (dlg.ShowDialog(xwindow) == DialogResult.Cancel)
                    {
                        return(true);
                    }
                }
            }
            else
            {
                ComplexConcMorphNode morphNode = nodes[0] as ComplexConcMorphNode;
                if (morphNode != null)
                {
                    using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg())
                    {
                        dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, morphNode);
                        if (dlg.ShowDialog(xwindow) == DialogResult.Cancel)
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    ComplexConcTagNode tagNode = nodes[0] as ComplexConcTagNode;
                    if (tagNode != null)
                    {
                        using (ComplexConcTagDlg dlg = new ComplexConcTagDlg())
                        {
                            dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, tagNode);
                            if (dlg.ShowDialog(xwindow) == DialogResult.Cancel)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            ReconstructView(nodes[0], false);
            return(true);
        }
示例#2
0
		public bool OnPatternNodeSetCriteria(object args)
		{
			CheckDisposed();
			ComplexConcPatternNode[] nodes = CurrentNodes;

			ComplexConcWordNode wordNode = nodes[0] as ComplexConcWordNode;
			if (wordNode != null)
			{
				using (ComplexConcWordDlg dlg = new ComplexConcWordDlg())
				{
					dlg.SetDlgInfo(m_cache, m_mediator, wordNode);
					if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.Cancel)
						return true;
				}
			}
			else
			{
				ComplexConcMorphNode morphNode = nodes[0] as ComplexConcMorphNode;
				if (morphNode != null)
				{
					using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg())
					{
						dlg.SetDlgInfo(m_cache, m_mediator, morphNode);
						if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.Cancel)
							return true;
					}
				}
				else
				{
					ComplexConcTagNode tagNode = nodes[0] as ComplexConcTagNode;
					if (tagNode != null)
					{
						using (ComplexConcTagDlg dlg = new ComplexConcTagDlg())
						{
							dlg.SetDlgInfo(m_cache, m_mediator, tagNode);
							if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.Cancel)
								return true;
						}
					}
				}
			}

			ReconstructView(nodes[0], false);
			return true;
		}
示例#3
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);
		}
示例#4
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);
        }