protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew) { CheckDisposed(); base.HandleSelectionChange(rootb, vwselNew); // JohnT: it's remotely possible that the base, in calling commit, made this // selection no longer useable. if (!vwselNew.IsValid) { return; } IWfiWordform wordform; if (!GetSelectedWordform(vwselNew, out wordform)) { wordform = null; } m_mediator.PropertyTable.SetProperty("TextSelectedWord", wordform); m_mediator.PropertyTable.SetPropertyPersistence("TextSelectedWord", false); SelectionHelper helper = SelectionHelper.Create(vwselNew, this); if (helper != null && helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor) == RawTextVc.kTagUserPrompt) { vwselNew.ExtendToStringBoundaries(); EditingHelper.SetKeyboardForSelection(vwselNew); } }
public override void SelectionChanged(IVwRootBox rootb, IVwSelection vwselNew) { CheckDisposed(); base.SelectionChanged(rootb, vwselNew); // JohnT: it's remotely possible that the base, in calling commit, made this // selection no longer useable. if (!vwselNew.IsValid) { return; } SelectionHelper helper = SelectionHelper.Create(vwselNew, this); if (helper != null && helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor) == RawTextVc.kTagUserPrompt) { vwselNew.ExtendToStringBoundaries(); EditingHelper.SetKeyboardForSelection(vwselNew); } }
protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew) { ICmObject selected = SelectedObject; int selectedHvo = 0; if (selected != null) { selectedHvo = selected.Hvo; } if (selectedHvo != m_prevSelectedHvo) { if (DeleteItem()) { m_prevSelectedHvo = selectedHvo; SelectedObject = selected; } else { m_prevSelectedHvo = selectedHvo; vwselNew.ExtendToStringBoundaries(); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle TE specific requirements on selection change. /// </summary> /// <param name="prootb"></param> /// <param name="vwselNew"></param> /// ------------------------------------------------------------------------------------ public override void SelectionChanged(IVwRootBox prootb, IVwSelection vwselNew) { CheckDisposed(); // selection change is being done by this routine, don't need to do processing // second time. if (m_selectionUpdateInProcess) return; // Make sure we don't try to use the old selection (TE-5009). m_viewSelection = null; SelectionHelper helper = SelectionHelper.Create(vwselNew, prootb.Site); UpdateGotoPassageControl(); // update the verse reference to the new selection SetInformationBarForSelection(); // update title bar with section reference range if (MainTransVc != null) ProcessBTSelChange(helper); bool updatedSelection = false; int hvoSelObj = 0; if (helper != null && helper.LevelInfo.Length > 0) hvoSelObj = helper.LevelInfo[0].hvo; IGetTeStVc getVc = prootb.Site as IGetTeStVc; TeStVc vc = null; if (getVc != null) vc = getVc.Vc; if (vc != null && vc.SuppressCommentPromptHvo != hvoSelObj) { vc.SuppressCommentPromptHvo = 0; // Enhance JohnT: do a Propchanged (possibly delayed until idle) on hvo.Comment to make the prompt reappear. } // If the selection is in a user prompt then extend the selection to cover the // entire prompt. if (IsSelectionInPrompt(helper)) { if (vc != null) vc.SuppressCommentPromptHvo = hvoSelObj; // If we're not really showing the prompt, but just an incomplete composition that was typed // over it, we do NOT want to select all of it all the time! (TE-8267). if (!prootb.IsCompositionInProgress) vwselNew.ExtendToStringBoundaries(); if (!vwselNew.IsEditable && helper != null) { // We somehow got an IP that associates with the non-editable spacer next to the prompt. // We need to extend in the opposite direction. helper.AssocPrev = !helper.AssocPrev; IVwSelection sel = helper.SetSelection(EditedRootBox.Site, false, false); // Make sure that the new selection is editable before we install it. This keeps us // from getting here again and again (recursively). (TE-8763) if (sel.IsEditable) sel.Install(); return; // We have already been called again as the new selection is installed. } SetKeyboardForSelection(vwselNew); } // This isn't ideal but it's one of the better of several bad options for dealing // with simplifying the selection changes in footnote views. if ((m_viewType & TeViewType.FootnoteView) != 0 || (m_viewType & TeViewType.NotesDataEntryView) != 0 || helper == null) { // This makes sure the writing system and styles combos get updated. base.SelectionChanged(prootb, vwselNew); return; } // If selection is IP, don't allow it to be associated with a verse number run. bool fRangeSelection = vwselNew.IsRange; if (!fRangeSelection) PreventIPAssociationWithVerseRun(vwselNew, prootb, ref updatedSelection); // Need to do this at end since selection may be changed by this method. // Doing this at top can also cause value of style in StylesComboBox to flash base.SelectionChanged(prootb, vwselNew); // If we changed the selection in this method we want to set the viewSelection to // null so that the next time it is gotten it will have the correct selection. if (updatedSelection) m_viewSelection = null; // Make sure the selection is in a valid Scripture element. int tagSelection; int hvoSelection; if (!vwselNew.IsValid || !GetSelectedScrElement(out tagSelection, out hvoSelection)) { m_sPrevSelectedText = null; return; } // Determine whether or not the selection changed but is in a different reference. bool fInSameRef = (m_oldReference == CurrentStartRef); if (fInSameRef && !fRangeSelection) { m_sPrevSelectedText = null; if (m_syncHandler != null) m_syncHandler.SyncToScrLocation(this, this, true); return; } ScrReference curStartRef = CurrentStartRef; if (curStartRef.Chapter == 0) curStartRef.Chapter = 1; m_oldReference = CurrentStartRef; string selectedText = null; if (fRangeSelection) { try { ITsString tssSelectedText = GetCleanSelectedText(); selectedText = (tssSelectedText != null ? tssSelectedText.Text : null); } catch { selectedText = null; } } bool fSameSelectedText = (m_sPrevSelectedText == selectedText); m_sPrevSelectedText = selectedText; if (m_syncHandler != null && (!fInSameRef || !fSameSelectedText || InBookTitle || InSectionHead || InIntroSection)) { m_syncHandler.SyncToScrLocation(this, this, fInSameRef); } }
protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew) { CheckDisposed(); base.HandleSelectionChange(rootb, vwselNew); // JohnT: it's remotely possible that the base, in calling commit, made this // selection no longer useable. if (!vwselNew.IsValid) return; IWfiWordform wordform; if (!GetSelectedWordform(vwselNew, out wordform)) wordform = null; m_mediator.PropertyTable.SetProperty("TextSelectedWord", wordform); m_mediator.PropertyTable.SetPropertyPersistence("TextSelectedWord", false); SelectionHelper helper = SelectionHelper.Create(vwselNew, this); if (helper != null && helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor) == RawTextVc.kTagUserPrompt) { vwselNew.ExtendToStringBoundaries(); EditingHelper.SetKeyboardForSelection(vwselNew); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle TE specific requirements on selection change. /// </summary> /// <param name="rootb">The rootbox whose selection changed</param> /// <param name="vwselNew">The new selection</param> /// ------------------------------------------------------------------------------------ public override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew) { CheckDisposed(); // selection change is being done by this routine, don't need to do processing // second time. if (m_selectionUpdateInProcess) return; SelectionHelper helper = CurrentSelection; UpdateGotoPassageControl(); // update the verse reference to the new selection SetInformationBarForSelection(); // update title bar with section reference range if (VernacularDraftVc != null) ProcessBTSelChange(helper); int hvoSelObj = 0; if (helper != null && helper.LevelInfo.Length > 0) hvoSelObj = helper.LevelInfo[0].hvo; ITeDraftView getVc = rootb.Site as ITeDraftView; TeStVc vc = (getVc != null) ? getVc.Vc : null; if (vc != null && vc.HvoOfSegmentWhoseBtPromptIsToBeSupressed != hvoSelObj) { vc.HvoOfSegmentWhoseBtPromptIsToBeSupressed = 0; // Enhance JohnT: do a Propchanged (possibly delayed until idle) on hvo.Comment to make the prompt reappear. } // If the selection is in a user prompt then extend the selection to cover the // entire prompt. if (IsSelectionInPrompt(helper)) { if (vc != null) vc.HvoOfSegmentWhoseBtPromptIsToBeSupressed = hvoSelObj; // If we're not really showing the prompt, but just an incomplete composition that was typed // over it, we do NOT want to select all of it all the time! (TE-8267). if (!rootb.IsCompositionInProgress) vwselNew.ExtendToStringBoundaries(); SetKeyboardForSelection(vwselNew); } // This isn't ideal but it's one of the better of several bad options for dealing // with simplifying the selection changes in footnote views. if ((m_viewType & TeViewType.FootnoteView) != 0 || helper == null) { // This makes sure the writing system and styles combos get updated. base.HandleSelectionChange(rootb, vwselNew); return; } // If selection is IP, don't allow it to be associated with a verse number run. bool fRangeSelection = vwselNew.IsRange; if (!fRangeSelection) PreventIPAssociationWithVerseRun(rootb); // Need to do this at end since selection may be changed by this method. // Doing this at top can also cause value of style in StylesComboBox to flash base.HandleSelectionChange(rootb, vwselNew); // Make sure the selection is in a valid Scripture element. int tagSelection; int hvoSelection; if (!vwselNew.IsValid || !GetSelectedScrElement(out tagSelection, out hvoSelection)) { m_sPrevSelectedText = null; return; } // Determine whether or not the selection changed but is in a different reference. bool fInSameRef = (m_oldReference == CurrentStartRef); if (fInSameRef && !fRangeSelection) { m_sPrevSelectedText = null; SyncToScrLocation(true); return; } ScrReference curStartRef = CurrentStartRef; if (curStartRef.Chapter == 0) curStartRef.Chapter = 1; m_oldReference = CurrentStartRef; string selectedText = null; if (fRangeSelection) { try { ITsString tssSelectedText; vwselNew.GetSelectionString(out tssSelectedText, string.Empty); selectedText = (tssSelectedText != null ? tssSelectedText.Text : null); } catch { selectedText = null; } } bool fSameSelectedText = (m_sPrevSelectedText == selectedText); m_sPrevSelectedText = selectedText; if (!fInSameRef || !fSameSelectedText || InBookTitle || InSectionHead || InIntroSection) SyncToScrLocation(fInSameRef); }
private static SimpleRootSiteEditControl CreateEditControl(IChildControlNavigation rawElementProviderRoot, IVwRootBox rootBox, IVwSelection selection) { if (!selection.IsRange) selection.ExtendToStringBoundaries(); return new SimpleRootSiteEditControl(rawElementProviderRoot, rootBox.Site as SimpleRootSite, selection, ""); }
protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew) { ICmObject selected = SelectedObject; int selectedHvo = 0; if (selected != null) selectedHvo = selected.Hvo; if (selectedHvo != m_prevSelectedHvo) { if (DeleteItem()) { m_prevSelectedHvo = selectedHvo; SelectedObject = selected; } else { m_prevSelectedHvo = selectedHvo; vwselNew.ExtendToStringBoundaries(); } } }
public override void SelectionChanged(IVwRootBox rootb, IVwSelection vwselNew) { CheckDisposed(); base.SelectionChanged(rootb, vwselNew); // JohnT: it's remotely possible that the base, in calling commit, made this // selection no longer useable. if (!vwselNew.IsValid) return; SelectionHelper helper = SelectionHelper.Create(vwselNew, this); if (helper != null && helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor) == RawTextVc.kTagUserPrompt) { vwselNew.ExtendToStringBoundaries(); EditingHelper.SetKeyboardForSelection(vwselNew); } }