예제 #1
0
        /// <summary>
        /// Note: Assume we are in the OnDisplayShowLinkWords is true context.
        /// </summary>
        public bool OnJoinWords(object arg)
        {
            var cmd = (ICommandUndoRedoText)arg;

            UndoableUnitOfWorkHelper.Do(cmd.UndoText, cmd.RedoText, Cache.ActionHandlerAccessor,
                                        () =>
            {
                SelectedOccurrence.MakePhraseWithNextWord();
                if (InterlinDoc != null)
                {
                    InterlinDoc.RecordGuessIfNotKnown(SelectedOccurrence);
                }
            });
            InterlinWordControl.SwitchWord(SelectedOccurrence);
            UpdateButtonState();
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Change root of Sandbox or create it; Lay it out and figure its size;
        /// tell m_vc the size.
        /// </summary>
        /// <returns></returns>
        private void ChangeOrCreateSandbox(AnalysisOccurrence selected)
        {
            this.SuspendLayout();
            panelSandbox.SuspendLayout();
            if (InterlinDoc != null)
            {
                InterlinDoc.RecordGuessIfNotKnown(selected);
            }
            int color = (int)CmObjectUi.RGB(DefaultBackColor);

            //if this sandbox is presenting a wordform with multiple possible analyses then set the
            //bg color indicator
            if (selected.Analysis.Analysis == null && selected.Analysis.Wordform != null &&
                SandboxBase.GetHasMultipleRelevantAnalyses(selected.Analysis.Wordform))
            {
                color = InterlinVc.MultipleApprovedGuessColor;
            }

            if (m_sandbox == null)
            {
                m_sandbox = CreateNewSandbox(selected);
                m_sandbox.MultipleAnalysisColor = color;
            }
            else
            {
                //set the color before switching so that the color is correct when DisplayWordForm is called
                m_sandbox.MultipleAnalysisColor = color;
                m_sandbox.SwitchWord(selected);
            }
            UpdateButtonState();
            // add the sandbox plus some padding.
            panelSandbox.ResumeLayout();
            this.ResumeLayout();

            SetSandboxSize();
        }