예제 #1
0
        /// <summary>
        /// Handle launching of the MSA editor.
        /// </summary>
        protected override void HandleChooser()
        {
            VectorReferenceLauncher vrl = null;

            using (MsaInflectionFeatureListDlg dlg = new MsaInflectionFeatureListDlg())
            {
                IFsFeatStruc originalFs = m_obj as IFsFeatStruc;

                Slice parentSlice = Slice;
                if (originalFs == null)
                {
                    int owningFlid;
                    int parentSliceClass = (int)parentSlice.Object.ClassID;
                    switch (parentSliceClass)
                    {
                    case MoAffixAllomorphTags.kClassId:
                        IMoAffixAllomorph allo = parentSlice.Object as IMoAffixAllomorph;
                        owningFlid = (parentSlice as MsaInflectionFeatureListDlgLauncherSlice).Flid;
                        dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, allo, owningFlid);
                        break;

                    /*case LexEntryInflTypeTags.kClassId:
                     *      ILexEntryInflType leit = parentSlice.Object as ILexEntryInflType;
                     *      owningFlid = (parentSlice as MsaInflectionFeatureListDlgLauncherSlice).Flid;
                     *      dlg.SetDlgInfo(m_cache, m_mediator, leit, owningFlid);
                     *      break;*/
                    default:
                        IMoMorphSynAnalysis msa = parentSlice.Object as IMoMorphSynAnalysis;
                        owningFlid = (parentSlice as MsaInflectionFeatureListDlgLauncherSlice).Flid;
                        dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, msa, owningFlid);
                        break;
                    }
                }
                else
                {
                    dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, originalFs,
                                   (parentSlice as MsaInflectionFeatureListDlgLauncherSlice).Flid);
                }

                const string ksPath = "/group[@id='Linguistics']/group[@id='Morphology']/group[@id='FeatureChooser']/";
                dlg.Text     = StringTable.Table.GetStringWithXPath("InflectionFeatureTitle", ksPath);
                dlg.Prompt   = StringTable.Table.GetStringWithXPath("InflectionFeaturePrompt", ksPath);
                dlg.LinkText = StringTable.Table.GetStringWithXPath("InflectionFeatureLink", ksPath);
                DialogResult result = dlg.ShowDialog(parentSlice.FindForm());
                if (result == DialogResult.OK)
                {
                    // Note that this may set m_obj to null. dlg.FS will be null if all inflection features have been
                    // removed. That is a valid state for this slice; m_obj deleted is not.
                    m_obj = dlg.FS;
                    m_msaInflectionFeatureListDlgLauncherView.Init(m_cache, dlg.FS);
                }
                else if (result == DialogResult.Yes)
                {
                    // Get the VectorReferenceLauncher for the Inflection Features slice.
                    // Since we're not changing tools, we want to change the chooser dialog.
                    // See LT-5913 for motivation.
                    Control ctl = this.Parent;
                    while (ctl != null && !(ctl is Slice))
                    {
                        ctl = ctl.Parent;
                    }
                    Slice slice = ctl as Slice;
                    if (slice != null)
                    {
                        DataTree dt = slice.ContainingDataTree;
                        for (int i = 0; i < dt.Slices.Count; ++i)
                        {
                            Slice sliceT = dt.FieldOrDummyAt(i);
                            vrl = sliceT.Control as VectorReferenceLauncher;
                            if (vrl != null)
                            {
                                if (vrl.Flid == PartOfSpeechTags.kflidInflectableFeats)
                                {
                                    break;
                                }
                                vrl = null;
                            }
                        }
                    }
                    if (vrl == null)
                    {
                        // We do, too, need to change tools! Sometimes this slice shows up in a different context,
                        // such as the main data entry view. See LT-7167.
                        // go to m_highestPOS in editor
                        // TODO: this should be reviewed by someone who knows how these links should be done
                        // I'm just guessing.
                        // Also, is there some way to know the application name and tool name without hard coding them?
                        var linkJump = new FwLinkArgs("posEdit", dlg.HighestPOS.Guid);
                        m_mediator.PostMessage("FollowLink", linkJump);
                    }
                    else
                    {
                        vrl.HandleExternalChooser();
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Handle launching of the MSA editor.
        /// </summary>
        protected override void HandleChooser()
        {
            VectorReferenceLauncher vrl = null;

            using (MsaInflectionFeatureListDlg dlg = new MsaInflectionFeatureListDlg())
            {
                IFsFeatStruc originalFs = m_obj as IFsFeatStruc;

                Slice parentSlice = Slice;
                if (originalFs == null)
                {
                    int owningFlid;
                    int parentSliceClass = parentSlice.Object.ClassID;
                    switch (parentSliceClass)
                    {
                    case MoAffixAllomorph.kclsidMoAffixAllomorph:
                        IMoAffixAllomorph allo = parentSlice.Object as IMoAffixAllomorph;
                        owningFlid = (parentSlice as MsaInflectionFeatureListDlgLauncherSlice).Flid;
                        dlg.SetDlgInfo(m_cache, m_mediator, allo, owningFlid);
                        break;

                    default:
                        IMoMorphSynAnalysis msa = parentSlice.Object as IMoMorphSynAnalysis;
                        owningFlid = (parentSlice as MsaInflectionFeatureListDlgLauncherSlice).Flid;
                        dlg.SetDlgInfo(m_cache, m_mediator, msa, owningFlid);
                        break;
                    }
                }
                else
                {
                    dlg.SetDlgInfo(m_cache, m_mediator, originalFs);
                }

                const string ksPath = "/group[@id='Linguistics']/group[@id='Morphology']/group[@id='FeatureChooser']/";
                dlg.Text     = m_mediator.StringTbl.GetStringWithXPath("InflectionFeatureTitle", ksPath);
                dlg.Prompt   = m_mediator.StringTbl.GetStringWithXPath("InflectionFeaturePrompt", ksPath);
                dlg.LinkText = m_mediator.StringTbl.GetStringWithXPath("InflectionFeatureLink", ksPath);
                DialogResult result = dlg.ShowDialog(parentSlice.FindForm());
                if (result == DialogResult.OK)
                {
                    if (dlg.FS != null)
                    {
                        m_obj = dlg.FS;
                    }
                    m_msaInflectionFeatureListDlgLauncherView.Init(m_mediator, dlg.FS);
                }
                else if (result == DialogResult.Yes)
                {
                    // Get the VectorReferenceLauncher for the Inflection Features slice.
                    // Since we're not changing tools, we want to change the chooser dialog.
                    // See LT-5913 for motivation.
                    Control ctl = this.Parent;
                    while (ctl != null && !(ctl is Slice))
                    {
                        ctl = ctl.Parent;
                    }
                    Slice slice = ctl as Slice;
                    if (slice != null)
                    {
                        DataTree dt = slice.ContainingDataTree;
                        for (int i = 0; i < dt.Controls.Count; ++i)
                        {
                            Slice sliceT = dt.FieldOrDummyAt(i);
                            vrl = sliceT.Control as VectorReferenceLauncher;
                            if (vrl != null)
                            {
                                if (vrl.Flid == (int)PartOfSpeech.PartOfSpeechTags.kflidInflectableFeats)
                                {
                                    break;
                                }
                                vrl = null;
                            }
                        }
                    }
                    if (vrl == null)
                    {
                        // We do, too, need to change tools! Sometimes this slice shows up in a different context,
                        // such as the main data entry view. See LT-7167.
                        // go to m_highestPOS in editor
                        // TODO: this should be reviewed by someone who knows how these links should be done
                        // I'm just guessing.
                        // Also, is there some way to know the application name and tool name without hard coding them?
                        FdoUi.FwLink linkJump = new SIL.FieldWorks.FdoUi.FwLink("Language Explorer", "posEdit",
                                                                                dlg.HighestPOS.Guid, m_cache.ServerName, m_cache.DatabaseName);
                        m_mediator.PostMessage("FollowLink", linkJump);
                    }
                    else
                    {
                        vrl.HandleExternalChooser();
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Handle launching of the LexEntryInflType features editor.
        /// </summary>
        protected override void HandleChooser()
        {
            VectorReferenceLauncher vrl = null;

            using (FeatureSystemInflectionFeatureListDlg dlg = new FeatureSystemInflectionFeatureListDlg())
            {
                IFsFeatStruc originalFs = m_obj as IFsFeatStruc;

                Slice parentSlice = Slice;
                if (originalFs == null)
                {
                    int owningFlid;
                    ILexEntryInflType leit = parentSlice.Object as ILexEntryInflType;
                    owningFlid = (parentSlice as FeatureSystemInflectionFeatureListDlgLauncherSlice).Flid;
                    dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, leit, owningFlid);
                }
                else
                {
                    dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, originalFs,
                                   (parentSlice as FeatureSystemInflectionFeatureListDlgLauncherSlice).Flid);
                }

                const string ksPath = "/group[@id='Linguistics']/group[@id='Morphology']/group[@id='FeatureChooser']/";
                dlg.Text     = StringTable.Table.GetStringWithXPath("InflectionFeatureTitle", ksPath);
                dlg.Prompt   = StringTable.Table.GetStringWithXPath("InflectionFeaturesPrompt", ksPath);
                dlg.LinkText = StringTable.Table.GetStringWithXPath("InflectionFeaturesLink", ksPath);
                DialogResult result = dlg.ShowDialog(parentSlice.FindForm());
                if (result == DialogResult.OK)
                {
                    if (dlg.FS != null)
                    {
                        m_obj = dlg.FS;
                    }
                    m_msaInflectionFeatureListDlgLauncherView.Init(m_cache, dlg.FS);
                }
                else if (result == DialogResult.Yes)
                {
                    /*
                     *                                      // Get the VectorReferenceLauncher for the Inflection Features slice.
                     *                                      // Since we're not changing tools, we want to change the chooser dialog.
                     *                                      // See LT-5913 for motivation.
                     *                                      Control ctl = this.Parent;
                     *                                      while (ctl != null && !(ctl is Slice))
                     *                                              ctl = ctl.Parent;
                     *                                      Slice slice = ctl as Slice;
                     *                                      if (slice != null)
                     *                                      {
                     *                                              DataTree dt = slice.ContainingDataTree;
                     *                                              for (int i = 0; i < dt.Slices.Count; ++i)
                     *                                              {
                     *                                                      Slice sliceT = dt.FieldOrDummyAt(i);
                     *                                                      vrl = sliceT.Control as VectorReferenceLauncher;
                     *                                                      if (vrl != null)
                     *                                                      {
                     *                                                              if (vrl.Flid == PartOfSpeechTags.kflidInflectableFeats)
                     *                                                                      break;
                     *                                                              vrl = null;
                     *                                                      }
                     *                                              }
                     *                                      }
                     *                                      if (vrl == null)
                     *                                      {
                     *                                              // We do, too, need to change tools! Sometimes this slice shows up in a different context,
                     *                                              // such as the main data entry view. See LT-7167.
                     *                                              // go to m_highestPOS in editor
                     *                                              // TODO: this should be reviewed by someone who knows how these links should be done
                     *                                              // I'm just guessing.
                     *                                              // Also, is there some way to know the application name and tool name without hard coding them?
                     */
                    var linkJump = new FwLinkArgs("featuresAdvancedEdit", m_cache.LanguageProject.MsFeatureSystemOA.Guid);
                    m_mediator.PostMessage("FollowLink", linkJump);

                    /*}
                     * else
                     * {
                     *      vrl.HandleExternalChooser();
                     * }*/
                }
            }
        }
        /// <summary>
        /// Handle launching of the phonological feature editor.
        /// </summary>
        protected override void HandleChooser()
        {
            VectorReferenceLauncher vrl = null;

            using (PhonologicalFeatureChooserDlg dlg = new PhonologicalFeatureChooserDlg())
            {
                IFsFeatStruc originalFs       = null;
                Slice        parentSlice      = Slice;
                int          parentSliceClass = parentSlice.Object.ClassID;
                int          owningFlid       = (parentSlice as PhonologicalFeatureListDlgLauncherSlice).Flid;
                switch (parentSliceClass)
                {
                case PhPhoneme.kclsidPhPhoneme:
                    IPhPhoneme phoneme = parentSlice.Object as IPhPhoneme;
                    if (phoneme.FeaturesOAHvo != 0)
                    {
                        originalFs = phoneme.FeaturesOA;
                    }
                    break;

                case PhNCFeatures.kclsidPhNCFeatures:
                    IPhNCFeatures features = parentSlice.Object as IPhNCFeatures;
                    if (features.FeaturesOAHvo != 0)
                    {
                        originalFs = features.FeaturesOA;
                    }
                    break;
                }

                int longNameOldLen = 0;
                if (originalFs != null && originalFs.LongName != null)
                {
                    longNameOldLen = originalFs.LongName.Length;
                }

                if (originalFs == null)
                {
                    dlg.SetDlgInfo(m_cache, m_mediator, parentSlice.Object, owningFlid);
                }
                else
                {
                    dlg.SetDlgInfo(m_cache, m_mediator, originalFs);
                }

                DialogResult result = dlg.ShowDialog(parentSlice.FindForm());
                if (result == DialogResult.OK)
                {
                    if (dlg.FS != null)
                    {
                        int tagLongName = m_cache.VwCacheDaAccessor.GetVirtualHandlerName("FsFeatStruc", "LongNameTSS").Tag;
                        m_obj = dlg.FS;
                        m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, parentSlice.Object.Hvo, owningFlid,
                                            0, 1, 0);
                        m_PhonologicalFeatureListDlgLauncherView.UpdateFS(dlg.FS);
                        dlg.FS.UpdateFeatureLongName(tagLongName, longNameOldLen);
                    }
                }
                else if (result != DialogResult.Cancel)
                {
                    if (vrl == null)
                    {
                        dlg.HandleJump();
                    }
                    else
                    {
                        vrl.HandleExternalChooser();
                    }
                }
            }
        }