C# Class SIL.FieldWorks.IText.InterlinDocForAnalysis

Inheritance: InterlinDocRootSiteBase
Datei anzeigen Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
CanAddWordGlosses bool
CanDeleteNote bool
ConvertTranslationOrNoteFlidToSegmentFlid int
CreateFocusBox void
DeleteNote void
DetectDownMove bool
DetectUpMove bool
ExtremePositionInString WhichEnd
FindRealAnalysisInSegment SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
FocusBox_SizeChanged void
GetCurrentSelection bool
GetCurrentTextObjects void
GetFirstVisibleTranslationOrNoteFlid int
GetGuessForWordform IAnalysis
GetLineInfo bool
GetNextSegment ISegment
GetNextSegment ISegment
GetSandboxSelLocation Point
GetSelectedLineChoiceMode InterlinLineChoices.InterlinMode
GetTagAndObjForOnePropSelection bool
HandleArrowKeys ArrowChange
HasVisibleTranslationOrNote bool
InterlinDocForAnalysis_RightMouseClickedEvent void
IsTranslationOrNoteNext bool
MakeInnerLevelForFreeformSelection SIL.FieldWorks.Common.COMInterfaces.SelLevInfo
MakeSandboxSel IVwSelection
MoveFocusBoxIntoPlace void
MoveFocusBoxIntoPlace void
MoveVerticallyToNextAnalysis SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
OccurrenceContainingSelection SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
OnDeleteNote void
PrepareToGoAway bool
ReallyScrollControlIntoView void
RecordGuessIfNotKnown void
SelIsInEmptyTranslation bool
SelectFirstTranslationOrNote IVwSelection
SelectFirstTranslationOrNote bool
SetCpropPreviousForInsert void
SetFocusBoxSizeForVc bool
SetupTranslationPrompt void
SimulateReplaceAnalysis void
SuppressResettingGuesses void
TryHideFocusBoxAndUninstall bool
TryShowFocusBox bool
UpdateForNewLineChoices void
handlerExtensions_PropChangedCompleted void
isThereRealAnalysisInSegment bool

Public Methods

Method Description
AddNote ( Command command ) : void
ApproveAllSuggestedAnalyses ( Command cmd ) : void

Approve all the suggested analyses in this text. See LT-4312.

GetMessageTargets ( ) : IxCoreColleague[]
InterlinDocForAnalysis ( ) : System
OnAddWordGlossesToFreeTrans ( object arg ) : void

Make a free translation line out of the current glosses. Note that this is sometimes called by reflection; the parameter of type object is required to match the expected signature even though it is not used.

OnApproveAll ( object cmd ) : bool
OnDisplayAddWordGlossesToFreeTrans ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

Enable the 'insert word glosses' command

OnPropertyChanged ( string name ) : void
OriginalWndProc ( Message &msg ) : void
PrePasteProcessing ( ) : void
PropChanged ( int hvo, int tag, int ivMin, int cvIns, int cvDel ) : void
SelectOccurrence ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target ) : void

Select the word indicated by the occurrence. Note that this does not save any changes made in the Sandbox. It is mainly used when the view is read-only.

TriggerAnalysisSelected ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target, bool fSaveGuess, bool fMakeDefaultSelection ) : void

Move the sandbox to the AnalysisOccurrence, (which may be a WfiWordform, WfiAnalysis, or WfiGloss).

TriggerAnalysisSelected ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target, bool fSaveGuess, bool fMakeDefaultSelection, bool fShow ) : void

Move the sandbox to the AnalysisOccurrence, (which may be a WfiWordform, WfiAnalysis, or WfiGloss).

TriggerAnnotationSelected ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target, bool fSaveGuess ) : void

Move the sandbox (see main method), making the default selection.

Protected Methods

Method Description
CreateFocusBoxInternal ( ) : FocusBoxController
HandleClickSelection ( IVwSelection vwselNew, bool fBundleOnly, bool fSaveGuess ) : bool

Handles a view selection produced by a click. Return true to suppress normal mouse down handling, indicating that an interlinear bundle has been clicked and the Sandbox moved.

HandleSelectionChange ( IVwRootBox prootb, IVwSelection vwselNew ) : void

Notifies the site that something about the selection has changed.

When overriding you should call the base class first.

InstallFocusBox ( ) : void
MakeVc ( ) : void

factory

MakeWordformSelection ( SIL.FieldWorks.Common.COMInterfaces.SelLevInfo rgvsli ) : IVwSelection

Overridden for subclasses needing a Sandbox.

OnCreateControl ( ) : void

If we try to scroll to show the focus box before we are Created, our attempt to set the scroll position is ignored. This is an attempt to recover and make sure that even the first time the view is being created, we are scrolled to show the focus box if we have set one up.

OnGotFocus ( EventArgs e ) : void

If we have an active focus box put the focus back there when this is focused.

OnKeyDown ( KeyEventArgs e ) : void
OnKeyPress ( KeyPressEventArgs e ) : void
OnLostFocus ( EventArgs e ) : void

If you lost focus while processing a key or click, it may be because you are making a new selection before calling a method like TryHideFocusBoxAndUninstall(). Hide focus and uninstall first!

OnMouseDown ( MouseEventArgs e ) : void
OnPaint ( PaintEventArgs e ) : void

As a last resort for making sure the focus box is where we think it should be, check every time we paint. A recursive call may well happen, since an Update() is called if MoveFocusBoxIntoPlace needs to scroll. However, it can't get infinitely recursive, since MoveFocusBoxIntoPlace is guarded against being called again while it is active.

OnScroll ( ScrollEventArgs se ) : void
OnSizeChanged ( EventArgs e ) : void
ScrollToControl ( Control activeControl ) : Point

Windows.Forms is way too enthusiastic about trying to make the focused child control visible. For example it does it any time we change AutoScrollMinSize, such as when scrolling up and expanding lazy boxes. This has bad effects (LT-LT-11692). Returning the control's current location prevents ScrollControlIntoView from making any changes. However, in some cases we may want to make it visible.

SetRootInternal ( int hvo ) : void
UpdateWordforms ( HashSet wordforms ) : void

Private Methods

Method Description
CanAddWordGlosses ( ISegment &seg, int &ws ) : bool

Answer whether the AddWordGlossesToFreeTranslation menu option should be enabled. Also get the Segment to which they can be added.

CanDeleteNote ( IVwSelection sel, int &hvoNote ) : bool

Answer true if the indicated selection is within a single note we can delete.

ConvertTranslationOrNoteFlidToSegmentFlid ( int annotationFlid, ISegment segment, int ws ) : int

Converts InterlinLineChoices flids to corresponding SegmentTags. or NoteTags. This is useful when making translation or note selections.

CreateFocusBox ( ) : void
DeleteNote ( IVwSelection sel ) : void
DetectDownMove ( KeyEventArgs e, IEnumerable lines, int lineNum, ISegment curSeg, int curNoteIndex, bool isRightToLeft, WhichEnd where ) : bool

Detect that downward movement out of this segment is needed. Considerations: Configured analysis lines preceed translation or note lines (currently). "Annotation" lines include translation lines (free and literal) and notes. Each translation or note in a diffeerent ws is a different line. Translations are stored in a segment as a multistring while notes are in a sequence of multistrings. Each note is repeated in each note line of a different ws. So, the IP may be in the last configured note, but not in the last note.

DetectUpMove ( KeyEventArgs e, IEnumerable lines, int lineNum, ISegment curSeg, int curNoteIndex, WhichEnd where, bool isRightToLeft, bool &isUpNewSeg ) : bool

Detect that upward movement out of this segment or to an analysis in this same segment is needed. Considerations: Configured analysis lines preceed translation or note lines (currently). Analyses are stored as a sequence in the segement. Some analyses are punctuation that are skipped by the IP. Only analyses that have a word in them are considered "real". "Annotation" lines include translation lines (free and literal) and notes. Each translation or note in a diffeerent ws is a different line. Translations are stored in a segment as a multistring while notes are in a sequence of multistrings. Each note is repeated in each note line of a different ws. So, the IP may be in the first configured note, but not in the first note.

ExtremePositionInString ( int selStart, int selEnd, int selLength, bool isRightToLeft ) : WhichEnd

Determines if the selection is at the start, end or other position in the string. Accounts for writing system direction based on the line spec.

FindRealAnalysisInSegment ( ISegment seg, bool forward ) : SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence

Finds a real analysis in the segment from the indicated direction. When used just to check if there is an analysis, the direction doesn't matter.

FocusBox_SizeChanged ( object sender, EventArgs e ) : void
GetCurrentSelection ( int &clev, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo &rgvsli, int &tag, int &ichAnchor, int &ichEnd, int &ws ) : bool

Gets the current selection and returns enough data to move the IP.

GetCurrentTextObjects ( int clev, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo rgvsli, int tag, int &curParaIndex, int &curSegIndex, int &curNoteIndex, ISegment &curSeg, INote &curNote ) : void

Retrieves the selected objects and data from the selection range.

GetFirstVisibleTranslationOrNoteFlid ( ISegment segment, int &ws ) : int

Gets the first visible (non-null and configured) translation or note line in the current segment.

GetGuessForWordform ( IWfiWordform wf, int ws ) : IAnalysis
GetLineInfo ( ISegment curSeg, INote curNote, int tag, int ichAnchor, int ichEnd, int wid, int &id, int &lineNum, WhichEnd &where, bool &isRightToLeft, bool &hasPrompt ) : bool

Assumes the selection data belongs to a translation or note! Gets the InterlinLineChoices flid (id) and a meaningful interpretation of where the IP is in the translation or note text. If an empty translation note was selected, its tag is kTagUserPrompt.

GetNextSegment ( IStTxtPara currentPara, ISegment seg, bool upward, SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence &realAnalysis ) : ISegment

Get the next segment with either a non-null annotation that is configured or a non-punctuation analysis. Also skip segments that are Scripture labels (like Chapter/Verse/Footnote numbers. It tries the next one after the SelectedOccurrence.Segment then tries the next paragraph, etc.. Use this version if the calling code already has the actual para/seg objects.

GetNextSegment ( int paraIndex, int segIndex, bool upward, SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence &realAnalysis ) : ISegment

Get the next segment with either a non-null annotation that is configured or a non-punctuation analysis. It tries the next one after the SelectedOccurrence.Segment then tries the next paragraph, etc..

GetSandboxSelLocation ( IVwSelection sel ) : Point
GetSelectedLineChoiceMode ( ) : InterlinLineChoices.InterlinMode
GetTagAndObjForOnePropSelection ( IVwSelection sel, int &hvoObj, int &tagAnchor ) : bool

Answer true if the indicated selection is within a single note we can delete. Also obtain the object and property.

HandleArrowKeys ( KeyEventArgs e ) : ArrowChange

Performs a change in IP when arrow keys should take the IP from a translation or note to an analysis. Also handles right and left arrow for empty translation lines via the output enum. two directions of concern for Left to Right(LTR) and Right To Left(RTL): 1: up from the first translation or note in a paragraph after a word line possibly in another paragraph via up arrow or a left (right if RTL) arrow from the first (last) character of the annotaton 2: down from the last translation or note in a paragraph before a word line possibly in another paragraph via down arrow or a right (left if RTL) arrow from the last (right) character of the annotaton The following logic accounts for the configured position of notes and whether the user added them. The idea here is to eliminate as many default cases as possible as early as possible to be handled by the old annotation OnKeyDown() method.

HasVisibleTranslationOrNote ( ISegment seg, IEnumerable lines ) : bool

Determines if there are visible translation or note - non null and configured.

InterlinDocForAnalysis_RightMouseClickedEvent ( SimpleRootSite sender, FwRightMouseClickEventArgs e ) : void
IsTranslationOrNoteNext ( int paragraphInd, ISegment seg, bool moveUp ) : bool

Determines if a visible translation or note is the next line in the indicated direction (up or down).

MakeInnerLevelForFreeformSelection ( int tagTextProp ) : SIL.FieldWorks.Common.COMInterfaces.SelLevInfo

Sets up the tags for the 0 level of a selection of a free translation or note. This will be the level "inside" the ones that select the paragraph and segment. For a note, we need to select the first note. For a free translation, we need to insert the level for the 'self' property which the VC inserts to isolate the free translations and make it easier to update them.

MakeSandboxSel ( ) : IVwSelection

Return the selection that corresponds to the SandBox position.

MoveFocusBoxIntoPlace ( ) : void
MoveFocusBoxIntoPlace ( bool fJustChecking ) : void
MoveVerticallyToNextAnalysis ( int paragraphInd, int segmentInd, bool moveUpward ) : SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence

Moves from the current segment to the next that has a real word line or a real translation or note depending on the direction. If none, try the appropriate segment in the next paragraph. Continue until a suitable analysis or translation or note is found or there are no more to check.

OccurrenceContainingSelection ( ) : SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
OnDeleteNote ( object sender, EventArgs e ) : void
PrepareToGoAway ( ) : bool
ReallyScrollControlIntoView ( Control c ) : void
RecordGuessIfNotKnown ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence selected ) : void
SelIsInEmptyTranslation ( SelectionHelper helper, int flid, int hvo ) : bool
SelectFirstTranslationOrNote ( ISegment segment ) : IVwSelection

Return the first non-null translation or note selection in the specified segment. The segment does not need to be the current occurance.

SelectFirstTranslationOrNote ( ) : bool

Select the first non-null translation or note in the current segment of the current analysis occurance.

SetCpropPreviousForInsert ( ) : void

This computes and saves the information needed to ensure the insertion point is placed on the correct line of a multilingual annotation when replacing a user prompt. See LT-9421.

SetFocusBoxSizeForVc ( ) : bool
SetupTranslationPrompt ( SelectionHelper helper, int flid ) : void
SimulateReplaceAnalysis ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence occurrence ) : void

Something about the display of the AnalysisOccurrence has changed...perhaps it has become or ceased to be the current annotation displayed using the Sandbox, or the Sandbox changed size. Produce a PropChanged that makes the system think it has been replaced (with itself) to refresh the relevant part of the display.

SuppressResettingGuesses ( System.Action task ) : void
TryHideFocusBoxAndUninstall ( ) : bool

Hides the sandbox and removes it from the controls.

TryShowFocusBox ( ) : bool

Adds the sandbox to the control and makes it visible.

UpdateForNewLineChoices ( SIL.FieldWorks.IText.InterlinLineChoices newChoices ) : void
handlerExtensions_PropChangedCompleted ( ) : void
isThereRealAnalysisInSegment ( ISegment seg ) : bool

Answers true if there is a "real" analysis in the segment.

Method Details

AddNote() public method

public AddNote ( Command command ) : void
command Command
return void

ApproveAllSuggestedAnalyses() public method

Approve all the suggested analyses in this text. See LT-4312.
public ApproveAllSuggestedAnalyses ( Command cmd ) : void
cmd Command The command object from the selection event.
return void

CreateFocusBoxInternal() protected method

protected CreateFocusBoxInternal ( ) : FocusBoxController
return FocusBoxController

GetMessageTargets() public method

public GetMessageTargets ( ) : IxCoreColleague[]
return IxCoreColleague[]

HandleClickSelection() protected method

Handles a view selection produced by a click. Return true to suppress normal mouse down handling, indicating that an interlinear bundle has been clicked and the Sandbox moved.
protected HandleClickSelection ( IVwSelection vwselNew, bool fBundleOnly, bool fSaveGuess ) : bool
vwselNew IVwSelection
fBundleOnly bool
fSaveGuess bool if true, saves guesses; if false, skips guesses but still saves edits.
return bool

HandleSelectionChange() protected method

Notifies the site that something about the selection has changed.
When overriding you should call the base class first.
protected HandleSelectionChange ( IVwRootBox prootb, IVwSelection vwselNew ) : void
prootb IVwRootBox
vwselNew IVwSelection Selection
return void

InstallFocusBox() protected method

protected InstallFocusBox ( ) : void
return void

InterlinDocForAnalysis() public method

public InterlinDocForAnalysis ( ) : System
return System

MakeVc() protected method

factory
protected MakeVc ( ) : void
return void

MakeWordformSelection() protected method

Overridden for subclasses needing a Sandbox.
protected MakeWordformSelection ( SIL.FieldWorks.Common.COMInterfaces.SelLevInfo rgvsli ) : IVwSelection
rgvsli SIL.FieldWorks.Common.COMInterfaces.SelLevInfo
return IVwSelection

OnAddWordGlossesToFreeTrans() public method

Make a free translation line out of the current glosses. Note that this is sometimes called by reflection; the parameter of type object is required to match the expected signature even though it is not used.
public OnAddWordGlossesToFreeTrans ( object arg ) : void
arg object
return void

OnApproveAll() public method

public OnApproveAll ( object cmd ) : bool
cmd object
return bool

OnCreateControl() protected method

If we try to scroll to show the focus box before we are Created, our attempt to set the scroll position is ignored. This is an attempt to recover and make sure that even the first time the view is being created, we are scrolled to show the focus box if we have set one up.
protected OnCreateControl ( ) : void
return void

OnDisplayAddWordGlossesToFreeTrans() public method

Enable the 'insert word glosses' command
public OnDisplayAddWordGlossesToFreeTrans ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object The command object.
display XCore.UIItemDisplayProperties The display properties.
return bool

OnGotFocus() protected method

If we have an active focus box put the focus back there when this is focused.
protected OnGotFocus ( EventArgs e ) : void
e System.EventArgs
return void

OnKeyDown() protected method

protected OnKeyDown ( KeyEventArgs e ) : void
e System.Windows.Forms.KeyEventArgs
return void

OnKeyPress() protected method

protected OnKeyPress ( KeyPressEventArgs e ) : void
e System.Windows.Forms.KeyPressEventArgs
return void

OnLostFocus() protected method

If you lost focus while processing a key or click, it may be because you are making a new selection before calling a method like TryHideFocusBoxAndUninstall(). Hide focus and uninstall first!
protected OnLostFocus ( EventArgs e ) : void
e System.EventArgs
return void

OnMouseDown() protected method

protected OnMouseDown ( MouseEventArgs e ) : void
e MouseEventArgs
return void

OnPaint() protected method

As a last resort for making sure the focus box is where we think it should be, check every time we paint. A recursive call may well happen, since an Update() is called if MoveFocusBoxIntoPlace needs to scroll. However, it can't get infinitely recursive, since MoveFocusBoxIntoPlace is guarded against being called again while it is active.
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void

OnPropertyChanged() public method

public OnPropertyChanged ( string name ) : void
name string
return void

OnScroll() protected method

protected OnScroll ( ScrollEventArgs se ) : void
se System.Windows.Forms.ScrollEventArgs
return void

OnSizeChanged() protected method

protected OnSizeChanged ( EventArgs e ) : void
e System.EventArgs
return void

OriginalWndProc() public method

public OriginalWndProc ( Message &msg ) : void
msg System.Windows.Forms.Message
return void

PrePasteProcessing() public method

public PrePasteProcessing ( ) : void
return void

PropChanged() public method

public PropChanged ( int hvo, int tag, int ivMin, int cvIns, int cvDel ) : void
hvo int
tag int
ivMin int
cvIns int
cvDel int
return void

ScrollToControl() protected method

Windows.Forms is way too enthusiastic about trying to make the focused child control visible. For example it does it any time we change AutoScrollMinSize, such as when scrolling up and expanding lazy boxes. This has bad effects (LT-LT-11692). Returning the control's current location prevents ScrollControlIntoView from making any changes. However, in some cases we may want to make it visible.
protected ScrollToControl ( Control activeControl ) : Point
activeControl System.Windows.Forms.Control
return Point

SelectOccurrence() public method

Select the word indicated by the occurrence. Note that this does not save any changes made in the Sandbox. It is mainly used when the view is read-only.
public SelectOccurrence ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target ) : void
target SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
return void

SetRootInternal() protected method

protected SetRootInternal ( int hvo ) : void
hvo int
return void

TriggerAnalysisSelected() public method

Move the sandbox to the AnalysisOccurrence, (which may be a WfiWordform, WfiAnalysis, or WfiGloss).
public TriggerAnalysisSelected ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target, bool fSaveGuess, bool fMakeDefaultSelection ) : void
target SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
fSaveGuess bool if true, saves guesses; if false, skips guesses but still saves edits.
fMakeDefaultSelection bool true to make the default selection within the new sandbox.
return void

TriggerAnalysisSelected() public method

Move the sandbox to the AnalysisOccurrence, (which may be a WfiWordform, WfiAnalysis, or WfiGloss).
public TriggerAnalysisSelected ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target, bool fSaveGuess, bool fMakeDefaultSelection, bool fShow ) : void
target SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
fSaveGuess bool if true, saves guesses; if false, skips guesses but still saves edits.
fMakeDefaultSelection bool true to make the default selection within the new sandbox.
fShow bool true makes the focusbox visible.
return void

TriggerAnnotationSelected() public method

Move the sandbox (see main method), making the default selection.
public TriggerAnnotationSelected ( SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence target, bool fSaveGuess ) : void
target SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
fSaveGuess bool if true, saves guesses; if false, skips guesses but still saves edits.
return void

UpdateWordforms() protected method

protected UpdateWordforms ( HashSet wordforms ) : void
wordforms HashSet
return void