Exemple #1
0
        public void OnInsertButtonClick(object obj, EventArgs ea)
        {
            CheckDisposed();

            MasterInflectionFeature mif = (MasterInflectionFeature)treeViewGlossListItem.SelectedNode.Tag;

            if (mif == null)
            {
                return;                 // just to be safe
            }
            GlossListBoxItem glbiNew = new GlossListBoxItem(mif.Node,
                                                            treeViewGlossListItem.AfterSeparator, treeViewGlossListItem.ComplexNameSeparator,
                                                            treeViewGlossListItem.ComplexNameFirst);
            GlossListBoxItem glbiConflict;

            if (glossListBoxGloss.NewItemConflictsWithExtantItem(glbiNew, out glbiConflict))
            {
                const string ksPath   = "/group[@id='Linguistics']/group[@id='Morphology']/group[@id='MGA']/";
                string       sMsg1    = m_mediator.StringTbl.GetStringWithXPath("ItemConflictDlgMessage", ksPath);
                string       sMsg     = String.Format(sMsg1, glbiConflict.ToString());
                string       sCaption = m_mediator.StringTbl.GetStringWithXPath("ItemConflictDlgCaption", ksPath);
                MessageBox.Show(sMsg, sCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            // raise event
            GlossListEventArgs glea = new GlossListEventArgs(glbiNew);

            OnInsertMGAGlossListItem(glea);
            buttonAcceptGloss.Enabled = true;
            EnableMoveUpDownButtons();
            ShowGloss();
        }
Exemple #2
0
        void OnGlossListTreeSelect(object obj, TreeViewEventArgs tvea)
        {
            buttonInsert.Enabled = true;
            TreeNode tn = tvea.Node;
            // do we need a try block here to catch a problem?
            MasterInflectionFeature mif = (MasterInflectionFeature)tn.Tag;
            XmlNode node = mif.Node;

            ShowInfo(node);
        }
        protected virtual TreeNode CreateNewNode(XmlNode currentNode, string sType, StringBuilder sbNode, string sTerm)
        {
            TreeNode newNode;

            GlossListTreeView.ImageKind ik = GetImageKind(sType);
            newNode = new TreeNode(TsStringUtils.NormalizeToNFC(sbNode.ToString()), (int)ik, (int)ik);
            MasterInflectionFeature mif = new MasterInflectionFeature(currentNode, ik, sTerm);

            newNode.Tag = (MasterInflectionFeature)mif;
            return(newNode);
        }
 protected virtual void HandleCheckBoxNodes(TreeView tv, TreeNode tn)
 {
     UndoLastSelectedNode();
     if (m_fTerminalsUseCheckBoxes)
     {
         if (IsTerminalNode(tn))
         {
             MasterInflectionFeature mif = tn.Tag as MasterInflectionFeature;
             if (tn.Checked)
             {
                 if (mif == null || !mif.InDatabase)
                 {
                     tn.Checked    = false;
                     tn.ImageIndex = tn.SelectedImageIndex = (int)ImageKind.checkBox;
                 }
             }
             else
             {
                 tn.Checked    = true;
                 tn.ImageIndex = tn.SelectedImageIndex = (int)ImageKind.checkedBox;
                 if (mif != null)
                 {
                     string sId = XmlUtils.GetOptionalAttributeValue(mif.Node, "id");
                     if (m_cache.LanguageProject.MsFeatureSystemOA.GetSymbolicValue(sId) != null)
                     {
                         // we want to set all other sisters that are in the database
                         TreeNode sibling = tn.Parent.FirstNode;
                         while (sibling != null)
                         {
                             if (IsTerminalNode(sibling) && sibling != tn)
                             {
                                 mif = sibling.Tag as MasterInflectionFeature;
                                 if (mif != null)
                                 {
                                     sId = XmlUtils.GetOptionalAttributeValue(mif.Node, "id");
                                     if (m_cache.LanguageProject.MsFeatureSystemOA.GetSymbolicValue(sId) != null)
                                     {
                                         sibling.Checked                = true;
                                         sibling.ImageIndex             =
                                             sibling.SelectedImageIndex = (int)ImageKind.checkedBox;
                                     }
                                 }
                             }
                             sibling = sibling.NextNode;
                         }
                     }
                 }
             }
             tv.Invalidate();
         }
     }
     else
     {
         if (IsTerminalNode(tn))
         {
             tn.Checked    = true;
             tn.ImageIndex = tn.SelectedImageIndex = (int)ImageKind.radioSelected;
             if (tn.Parent != null)
             {
                 TreeNode sibling = tn.Parent.FirstNode;
                 while (sibling != null)
                 {
                     if (IsTerminalNode(sibling) && sibling != tn)
                     {
                         sibling.Checked    = false;
                         sibling.ImageIndex = sibling.SelectedImageIndex = (int)ImageKind.radio;
                     }
                     sibling = sibling.NextNode;
                 }
             }
             tv.Invalidate();
         }
         m_lastSelectedTreeNode = tn;
     }
 }
		protected virtual TreeNode CreateNewNode(XmlNode currentNode, string sType, StringBuilder sbNode, string sTerm)
		{
			TreeNode newNode;
			GlossListTreeView.ImageKind ik = GetImageKind(sType);
			newNode = new TreeNode(StringUtils.NormalizeToNFC(sbNode.ToString()), (int) ik, (int) ik);
			MasterInflectionFeature mif = new MasterInflectionFeature(currentNode, ik, sTerm);
			newNode.Tag = (MasterInflectionFeature) mif;
			return newNode;
		}