本文整理汇总了C#中IVwRootBox类的典型用法代码示例。如果您正苦于以下问题:C# IVwRootBox类的具体用法?C# IVwRootBox怎么用?C# IVwRootBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVwRootBox类属于命名空间,在下文中一共展示了IVwRootBox类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandleUpDownArrows
internal static void HandleUpDownArrows(KeyEventArgs e, IVwRootBox rootBox, SelectionHelper curSel, List<IWritingSystem> wsList, int flid)
{
if (curSel == null || !curSel.IsValid) // LT-13805: sometimes selection was null
return;
var index = GetCurrentSelectionIndex(curSel, wsList);
if (index < 0)
return;
var maxWsIndex = wsList.Count - 1;
if (e.KeyCode == Keys.Up)
{
// Handle Up arrow
if ((index - 1) < 0)
return;
index--;
}
else
{
// Handle Down arrow
if ((index + 1) > maxWsIndex)
return;
index++;
}
// make new selection at index
var newSelection = GetSelAtStartOfWs(rootBox, flid, index, wsList[index]);
newSelection.Install();
e.Handled = true;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:27,代码来源:MultiStringSelectionUtils.cs
示例2: DrawTheRoot
/// <summary>
/// The core of the Draw() method, where the rectangle actually gets painted.
/// Vertical views use a rotated drawing routine.
/// </summary>
/// <param name="vdrb"></param>
/// <param name="rootb"></param>
/// <param name="hdc"></param>
/// <param name="drawRect"></param>
/// <param name="backColor"></param>
/// <param name="drawSel"></param>
/// <param name="clipRect"></param>
public virtual void DrawTheRoot(IVwDrawRootBuffered vdrb, IVwRootBox rootb, IntPtr hdc,
SIL.FieldWorks.Common.Utils.Rect drawRect, uint backColor, bool drawSel,
Rectangle clipRect)
{
vdrb.DrawTheRoot(rootb, hdc, clipRect, backColor,
drawSel, m_site);
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:18,代码来源:OrientationManager.cs
示例3: PrepareView
/// ------------------------------------------------------------------------------------
/// <summary>
///
/// </summary>
/// <param name="rootSite"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="rootb"></param>
/// ------------------------------------------------------------------------------------
private void PrepareView(DummyBasicView rootSite, int width, int height,
IVwRootBox rootb)
{
rootSite.Visible = false;
rootSite.Width = width;
rootSite.Height = height;
rootSite.SetRootBox(rootb);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:17,代码来源:RootSiteGroupTests.cs
示例4: GetSelAtStartOfWs
internal static IVwSelection GetSelAtStartOfWs(IVwRootBox rootBox, int flid, int wsIndex, IWritingSystem ws)
{
try
{
return rootBox.MakeTextSelection(0, 0, null, flid, wsIndex, 0, 0, (ws == null) ? 0 : ws.Handle, false, -1, null, false);
}
catch (COMException)
{
return null; // can fail if we are hiding an empty WS.
}
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:11,代码来源:MultiStringSelectionUtils.cs
示例5: RequestSelectionHelper
/// -----------------------------------------------------------------------------------
/// <summary>
/// Make one and hook it up to be called at the appropriate time.
/// </summary>
/// -----------------------------------------------------------------------------------
public RequestSelectionHelper(IActionHandlerExtensions hookup, IVwRootBox rootb, int ihvoRoot,
SelLevInfo[] rgvsli, int tagTextProp, int cpropPrevious, int ich, int wsAlt, bool fAssocPrev,
ITsTextProps selProps)
{
m_hookup = hookup;
m_rootb = rootb;
m_ihvoRoot = ihvoRoot;
m_rgvsli = rgvsli;
m_tagTextProp = tagTextProp;
m_cpropPrevious = cpropPrevious;
m_ich = ich;
m_wsAlt = wsAlt;
m_fAssocPrev = fAssocPrev;
m_selProps = selProps;
m_hookup.DoAtEndOfPropChanged(m_hookup_PropChangedCompleted);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:RequestSelectionHelper.cs
示例6: HandleSelectionChange
protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew)
{
CheckDisposed();
if (m_handlingSelectionChanged)
return;
m_handlingSelectionChanged = true;
try
{
m_selectedSenseHvo = 0;
if (vwselNew == null)
return;
base.HandleSelectionChange(rootb, vwselNew);
// Get the Id of the selected snes, and store it.
int cvsli = vwselNew.CLevels(false);
// CLevels includes the string property itself, but AllTextSelInfo doesn't need it.
cvsli--;
if (cvsli == 0)
{
// No objects in selection: don't allow a selection.
m_rootb.DestroySelection();
// Enhance: invoke launcher's selection dialog.
return;
}
ITsString tss;
int ichAnchor;
int ichEnd;
bool fAssocPrev;
int hvoObj;
int hvoObjEnd;
int tag;
int ws;
vwselNew.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoObj,
out tag, out ws);
vwselNew.TextSelInfo(true, out tss, out ichEnd, out fAssocPrev, out hvoObjEnd,
out tag, out ws);
if (hvoObj != hvoObjEnd)
return;
m_selectedSenseHvo = hvoObj;
}
finally
{
m_handlingSelectionChanged = false;
}
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:47,代码来源:RevEntrySensesCollectionReferenceView.cs
示例7: PromptSelectionRestorer
/// <summary>
/// Make one.
/// </summary>
public PromptSelectionRestorer(IVwRootBox rootbox)
{
m_rootbox = rootbox;
if (rootbox == null)
return;
// Save information about the old selection.
IVwSelection oldsel = rootbox.Selection;
// Dummy variables
int tagTextProp;
int ichAnchor;
int ichEnd;
int ihvoEnd;
bool fAssocPrev;
if (oldsel != null && oldsel.CLevels(false) > 0)
{
cvsli = oldsel.CLevels(false);
cvsli--; // CLevels includes the string property itself, but AllTextSelInfo doesn't need it.
rgvsli = SelLevInfo.AllTextSelInfo(oldsel, cvsli,
out ihvoRoot, out tagTextProp, out cpropPrevious, out ichAnchor, out ichEnd,
out ws, out fAssocPrev, out ihvoEnd, out ttp);
}
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:26,代码来源:PromptSelectionRestorer.cs
示例8: HandleSelectionChange
/// -----------------------------------------------------------------------------------
/// <summary>
/// Handle a selection changed event.
/// </summary>
/// <param name="rootb">root box that has the selection change</param>
/// <param name="vwselNew">Selection</param>
/// -----------------------------------------------------------------------------------
protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew)
{
CheckDisposed();
base.HandleSelectionChange(rootb, vwselNew);
// It's possible that the base either changed the selection or invalidated it in
// calling commit and made this selection no longer useable.
SelectionHelper helper = EditingHelper.CurrentSelection;
if (helper == null || !helper.Selection.IsValid)
return;
// scroll the footnote pane to be in synch with the draft view
// (TimS): Focused was taken out because it was causing selection changes that
// happended from a menu item wouldn't scroll to the footnote.
if (TheDraftViewWrapper != null && TheDraftViewWrapper.FootnoteViewShowing &&
Options.FootnoteSynchronousScrollingSetting)
{
// For performance on typing, don't try to scroll footnote pane on every update
SelLevInfo paraInfo;
if (helper.GetLevelInfoForTag(StTextTags.kflidParagraphs, out paraInfo))
{
IStTxtPara para = m_fdoCache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraInfo.hvo);
ITsString tss = para.Contents;
if (helper.IchAnchor <= tss.Length)
{
int iRun = (helper.IchAnchor >= 0) ? tss.get_RunAt(helper.IchAnchor) : -1;
if (iRun != -1 && (m_prevSelectedParagraph != paraInfo.hvo ||
iRun != m_prevAnchorPosition))
{
SynchFootnoteView(helper);
// Save selection information
m_prevSelectedParagraph = paraInfo.hvo;
m_prevAnchorPosition = iRun;
}
}
}
}
// Debug code was taken out. It was put in to help with testing using TestLangProj.
// Most of our tests are using the InMemoryCache so this information is almost useless.
// If you need it, just change the "DEBUG_not_exist" to "DEBUG" and then compile.
#region Debug code
#if DEBUG_not_exist
// This section of code will display selection information in the status bar when the
// program is compiled in Debug mode. The information shown in the status bar is useful
// when you want to make selections in tests.
try
{
string text;
SelLevInfo paraInfo = helper.GetLevelInfoForTag(StTextTags.kflidParagraphs);
SelLevInfo secInfo = helper.GetLevelInfoForTag(ScrBookTags.kflidSections);
SelLevInfo bookInfo = helper.GetLevelInfoForTag(BookFilter.Tag);
bool inBookTitle = TeEditingHelper.InBookTitle;
bool inSectionHead = TeEditingHelper.InSectionHead;
text = "Book: " + bookInfo.ihvo +
" Section: " + (inBookTitle ? "Book Title" : secInfo.ihvo.ToString()) +
" Paragraph: " + paraInfo.ihvo +
" Anchor: " + helper.IchAnchor + " End: " + helper.IchEnd +
" AssocPrev: " + helper.AssocPrev;
if (!inBookTitle && bookInfo.ihvo >= 0)
{
IStTxtPara para = m_fdoCache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraInfo.hvo);
ITsString tss = para.Contents;
if (helper.IchAnchor <= tss.Length)
text += " Run No.: " + tss.get_RunAt(helper.IchAnchor);
}
if (TheMainWnd != null)
TheMainWnd.StatusStrip.Items[0].Text = text;
}
catch
{
}
#endif
#endregion
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:87,代码来源:DraftView.cs
示例9: OnInsertDiffParas
/// ------------------------------------------------------------------------------------
/// <summary>
/// Handle insertion of paragraphs (i.e., from clipboard) with properties that don't
/// match the properties of the paragraph where they are being inserted. This gives us
/// the opportunity to create/modify the DB structure to recieve the paragraphs being
/// inserted and to reject certain types of paste operations (such as attempting to
/// paste a book).
/// </summary>
/// <param name="rootBox">the sender</param>
/// <param name="ttpDest">properties of destination paragraph</param>
/// <param name="cPara">number of paragraphs to be inserted</param>
/// <param name="ttpSrcArray">Array of props of each para to be inserted</param>
/// <param name="tssParas">Array of TsStrings for each para to be inserted</param>
/// <param name="tssTrailing">Text of an incomplete paragraph to insert at end (with
/// the properties of the destination paragraph.</param>
/// <returns>One of the following:
/// kidprDefault - causes the base implementation to insert the material as part of the
/// current StText in the usual way;
/// kidprFail - indicates that we have decided that this text should not be pasted at
/// this location at all, causing entire operation to roll back;
/// kidprDone - indicates that we have handled the paste ourselves, inserting the data
/// wherever it ought to go and creating any necessary new structure.</returns>
/// ------------------------------------------------------------------------------------
public override VwInsertDiffParaResponse OnInsertDiffParas(IVwRootBox rootBox,
ITsTextProps ttpDest, int cPara, ITsTextProps[] ttpSrcArray, ITsString[] tssParas,
ITsString tssTrailing)
{
CheckDisposed();
if (TeEditingHelper == null)
return VwInsertDiffParaResponse.kidprFail;
return TeEditingHelper.InsertDiffParas(rootBox, ttpDest, cPara, ttpSrcArray,
tssParas, tssTrailing);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:DraftView.cs
示例10: HandleSelectionChange
/// -----------------------------------------------------------------------------------
/// <summary>
/// Notifies the site that something about the selection has changed.
/// </summary>
/// <param name="prootb"></param>
/// <param name="vwselNew">Selection</param>
/// <remarks>When overriding you should call the base class first.</remarks>
/// -----------------------------------------------------------------------------------
protected override void HandleSelectionChange(IVwRootBox prootb, IVwSelection vwselNew)
{
if (m_fInSelectionChanged)
return; // don't need to reprocess our own changes.
m_fInSelectionChanged = true;
try
{
base.HandleSelectionChange(prootb, vwselNew);
IVwSelection sel = vwselNew;
if (!sel.IsValid)
sel = prootb.Selection;
if (sel == null)
return;
SelectionHelper helper = SelectionHelper.Create(sel, prootb.Site);
// Check whether the selection is on the proper line of a multilingual
// annotation and, if not, fix it. See LT-9421.
if (m_cpropPrevForInsert > 0 && !sel.IsRange &&
(helper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.Anchor) == 0 ||
helper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.End) == 0))
{
try
{
helper.SetNumberOfPreviousProps(SelectionHelper.SelLimitType.Anchor, m_cpropPrevForInsert);
helper.SetNumberOfPreviousProps(SelectionHelper.SelLimitType.End, m_cpropPrevForInsert);
helper.MakeBest(true);
m_cpropPrevForInsert = -1; // we've used this the one time it was needed.
}
catch (Exception exc)
{
if (exc != null)
Debug.WriteLine(String.Format(
"InterlinDocChild.SelectionChanged() trying to display prompt in proper line of annotation: {0}", exc.Message));
}
}
int flid = helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor);
//If the flid is -2 and it is an insertion point then we may have encountered a case where the selection has landed at the boundary between our (possibly empty)
//translation field and a literal string containing our magic Bidi marker character that helps keep things in the right order.
//Sometimes AssocPrev gets set so that we read the (non-existent) flid of the literal string and miss the fact that on the other side
//of the insertion point is the field we're looking for. The following code will attempt to make a selection that associates in
//the other direction to see if the flid we want is on the other side. [LT-10568]
if (flid == -2 && !sel.IsRange && sel.SelType == VwSelType.kstText)
{
helper.AssocPrev = !helper.AssocPrev;
try
{
var newSel = helper.MakeRangeSelection(this.RootBox, false);
helper = SelectionHelper.Create(newSel, this);
flid = helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor);
}
catch (COMException)
{
// Ignore HResult E_Fail caused by Extended Keys (PgUp/PgDown) in non-editable text (LT-13500)
}
}
//Fixes LT-9884 Crash when clicking on the blank space in Text & Words--->Print view area!
if (helper.LevelInfo.Length == 0)
return;
int hvo = helper.LevelInfo[0].hvo;
// If the selection is in a freeform or literal translation that is empty, display the prompt.
if (SelIsInEmptyTranslation(helper, flid, hvo) && !m_rootb.IsCompositionInProgress)
{
var handlerExtensions = Cache.ActionHandlerAccessor as IActionHandlerExtensions;
if (handlerExtensions != null && handlerExtensions.IsUndoTaskActive)
{
// Wait to make the changes until the task (typically typing backspace) completes.
m_setupPromptHelper = helper;
m_setupPromptFlid = flid;
handlerExtensions.DoAtEndOfPropChanged(handlerExtensions_PropChangedCompleted);
}
else
{
// No undo task to tag on the end of, so do it now.
SetupTranslationPrompt(helper, flid);
}
}
else if (flid != kTagUserPrompt)
{
m_vc.SetActiveFreeform(0, 0, 0, 0); // clear any current prompt.
}
// do not extend the selection for a user prompt if the user is currently entering an IME composition,
// since we are about to switch the prompt to a real comment field
else if (helper.GetTextPropId(SelectionHelper.SelLimitType.End) == SimpleRootSite.kTagUserPrompt
&& !m_rootb.IsCompositionInProgress)
{
// If the selection is entirely in a user prompt then extend the selection to cover the
// entire prompt. This covers changes within the prompt, like clicking within it or continuing
// a drag while making it.
sel.ExtendToStringBoundaries();
EditingHelper.SetKeyboardForSelection(sel);
}
}
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:InterlinDocForAnalysis.cs
示例11: NotImplementedException
/// <summary> see OnInsertDiffParas </summary>
VwInsertDiffParaResponse IVwRootSite.OnInsertDiffPara(IVwRootBox prootb,
ITsTextProps ttpDest, ITsTextProps ttpSrc, ITsString tssParas,
ITsString tssTrailing)
{
throw new NotImplementedException();
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:7,代码来源:PrintRootSite.cs
示例12:
/// -----------------------------------------------------------------------------------
/// <summary>If there is a pending writing system that should be applied to typing,
/// return it; also clear the state so that subsequent typing will not have a pending
/// writing system until something sets it again. (This is mainly used so that
/// keyboard-change commands can be applied while the selection is a range.)</summary>
/// <param name="prootb"></param>
/// <returns>Pending writing system</returns>
/// -----------------------------------------------------------------------------------
int IVwRootSite.GetAndClearPendingWs(IVwRootBox prootb)
{
return -1;
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:12,代码来源:PrintRootSite.cs
示例13: SelectionChanged
public override void SelectionChanged(IVwRootBox rootb, IVwSelection vwselNew)
{
CheckDisposed();
if (vwselNew == null)
return;
bool hasFoc = Focused;
base.SelectionChanged(rootb, vwselNew);
ITsString tss;
int ichAnchor;
bool fAssocPrev;
int hvoObj;
int tag;
int ws; // NB: This will be 0 after each call, since the string does
// not have alternatives. Ws would be the WS of an alternative,
// if there were any.
vwselNew.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoObj,
out tag, out ws);
int ichEnd;
int hvoObjEnd;
vwselNew.TextSelInfo(true, out tss, out ichEnd, out fAssocPrev, out hvoObjEnd,
out tag, out ws);
if (hvoObjEnd != hvoObj)
{
CheckHeight();
return;
}
if (m_hvoOldSelection > 0 && hvoObj != m_hvoOldSelection)
{
// Try to validate previously selected string rep.
if (m_silCache.get_StringProp(m_hvoOldSelection, kEnvStringRep).Length==0)
{
// Remove it from the dummy cache, since its length is 0.
int limit = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
for (int i = 0; i < limit; ++i)
{
if (m_hvoOldSelection ==
m_silCache.get_VecItem(m_rootObj.Hvo, kMainObjEnvironments, i))
{
RemoveFromDummyCache(i);
break;
}
}
}
else // Validate previously selected string rep.
{
ValidateStringRep(m_hvoOldSelection);
}
}
if (hvoObj != kDummyPhoneEnvID)
{
m_hvoOldSelection = hvoObj;
CheckHeight();
return;
}
if (tss.Length == 0)
{
CheckHeight();
return;
}
// Create a new object, and recreate a new empty object. Make this part of the Undo
// Task with the character we typed.
m_silCache.GetActionHandler().ContinueUndoTask();
int count = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
int hvoNew = InsertNewEnv(count - 1);
m_silCache.SetString(hvoNew, kEnvStringRep, tss);
m_silCache.SetString(kDummyPhoneEnvID, kEnvStringRep, DummyString);
m_silCache.EndUndoTask();
// Refresh
m_silCache.PropChanged(null, (int)PropChangeType.kpctNotifyAll,
m_rootObj.Hvo, kMainObjEnvironments, count - 1, 2, 1);
// Reset selection.
SelLevInfo[] rgvsli = new SelLevInfo[1];
rgvsli[0].cpropPrevious = 0;
rgvsli[0].tag = kMainObjEnvironments;
rgvsli[0].ihvo = count - 1;
m_rootb.MakeTextSelection(0, rgvsli.Length, rgvsli, tag, 0, ichAnchor, ichEnd, ws,
fAssocPrev, -1, null, true);
m_hvoOldSelection = hvoNew;
CheckHeight();
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:86,代码来源:PhoneEnvReferenceView.cs
示例14: GetTransformAtSrc
/// <summary>
/// Get a transform for a given source point...shouldn't be needed but this is
/// safe.
/// </summary>
/// <param name="root"></param>
/// <param name="pt"></param>
/// <param name="rcSrcRoot"></param>
/// <param name="rcDstRoot"></param>
public void GetTransformAtSrc(IVwRootBox root, Point pt, out Rect rcSrcRoot,
out Rect rcDstRoot)
{
rcSrcRoot = m_rcSrc;
rcDstRoot = m_rcDst;
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:14,代码来源:PrintRootSite.cs
示例15: ShowContextMenuAtIp
/// ------------------------------------------------------------------------------------
/// <summary>
/// Show the context menu for the specified root box at the location of
/// its selection (typically an IP).
/// </summary>
/// <param name="rootb"></param>
/// ------------------------------------------------------------------------------------
public override void ShowContextMenuAtIp(IVwRootBox rootb)
{
CheckDisposed();
ShowContextMenu(IPLocation);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:12,代码来源:DraftView.cs
示例16: get_ScreenGraphics
/// <summary>
/// Real drawing VG same as layout one for simple printing.
/// </summary>
/// <param name="_Root"></param>
/// <returns></returns>
public IVwGraphics get_ScreenGraphics(IVwRootBox _Root)
{
return m_vwPrintContext.Graphics;
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:9,代码来源:PrintRootSite.cs
示例17: OnInsertDiffPara
/// <summary> see OnInsertDiffParas </summary>
public override VwInsertDiffParaResponse OnInsertDiffPara(IVwRootBox rootBox,
ITsTextProps ttpDest, ITsTextProps ttpSrc, ITsString tssParas,
ITsString tssTrailing)
{
CheckDisposed();
return OnInsertDiffParas(rootBox, ttpDest, 1, new ITsTextProps[] { ttpSrc },
new ITsString[] { tssParas } , tssTrailing);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:11,代码来源:DraftView.cs
示例18: SelectionChanged
/// <summary>
/// Handle a selection change by growing it to a word (unless the new selection IS
/// the one we're growing to a word).
/// </summary>
/// <param name="prootb"></param>
/// <param name="vwselNew"></param>
public override void SelectionChanged(IVwRootBox prootb, IVwSelection vwselNew)
{
CheckDisposed();
base.SelectionChanged (prootb, vwselNew);
if (!m_fInSelChange)
{
m_fInSelChange = true;
try
{
if (!vwselNew.IsRange)
{
vwselNew.GrowToWord().Install();
}
}
finally
{
m_fInSelChange = false;
}
}
if (SelChanged != null)
SelChanged(this, new EventArgs());
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:29,代码来源:RelatedWords.cs
注:本文中的IVwRootBox类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论