C# Class SIL.FieldWorks.TE.DraftView

Implementation of the draft view (formerly SeDraftWnd)
Inheritance: SIL.FieldWorks.TE.DraftViewBase, ISelectableView
Exibir arquivo Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
m_fShowInTable bool
m_helpTopicProvider IHelpTopicProvider

Private Properties

Property Type Description
ConvertBookTagAndIndex void
FindNextTranslationInText int
FindPrevTranslationInText int
GetBackTranslationStatus BackTranslationStatus
IsKeyTermsView bool
MoveToNextTranslation void
MoveToPrevTranslation void
ReplaceBookTagAndIndex void
ShowPrintDlgHelp void
SynchFootnoteView void
SynchFootnoteView void

Public Methods

Method Description
ActivateView ( ) : void

Activates the view and initializes the information bar and styles combo based on the draft view's selection.

DeactivateView ( ) : void

DoHotLinkAction ( object sender, string strData ) : void

Handle hot link action - user clicked on hot link on the view.

DraftView ( FdoCache cache, int filterInstance, IApp app, string viewName, bool fEditable, bool fShowInTable, bool fMakeRootAutomatically, TeViewType viewType, int btWs, IHelpTopicProvider helpTopicProvider ) : System

Initializes a new instance of the DraftView class as a draft view editing pane, for either vernacular or back translation.

GetWritingSystemForHvo ( int hvo ) : int

Gets the writing system for the HVO. This could either be the vernacular or analysis writing system.

OnFilePrint ( object args ) : bool

OnInsertDiffPara ( IVwRootBox rootBox, ITsTextProps ttpDest, ITsTextProps ttpSrc, ITsString tssParas, ITsString tssTrailing ) : VwInsertDiffParaResponse

see OnInsertDiffParas

OnInsertDiffParas ( IVwRootBox rootBox, ITsTextProps ttpDest, int cPara, ITsTextProps ttpSrcArray, ITsString tssParas, ITsString tssTrailing ) : VwInsertDiffParaResponse

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).

OnProblemDeletion ( IVwSelection sel, VwDelProbType dpt ) : VwDelProbResponse

Handle a problem deletion - a complex selection crossing sections or other difficult cases such as BS/DEL at boundaries.

SelectRangeOfChars ( int book, int section, int para, int startCharacter, int endCharacter ) : SelectionHelper

Set an insertion point or character-range selection in this DraftView which is "installed" and scrolled into view.

This method is only used for tests

SetInsertionPoint ( int book, int section, int para, int character, bool fAssocPrev ) : SelectionHelper

Set the insertion point in this draftview to the specified location.

ShowContextMenuAtIp ( IVwRootBox rootb ) : void

Show the context menu for the specified root box at the location of its selection (typically an IP).

Protected Methods

Method Description
CallMouseDown ( Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot ) : void

Remember if a picture is selected so that it can be deselected on mouse up, if necessary.

CallMouseUp ( Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot ) : void

Call MouseUp on the rootbox

CreateEditingHelper ( ) : EditingHelper

Provide a TE specific implementation of the EditingHelper

CreateEditingHelper_Internal ( ) : TeEditingHelper

Internal version of CreateEditingHelper allows subclasses to override to create a subclass of TeEditingHelper without repeating the common initialization code.

CreateViewConstructor ( ) : TeStVc

Creates a view constructor suitable for this kind of view.

GetNonFocusedSelectionState ( Control windowGainingFocus ) : VwSelectionState

If the annotations window is gaining focus, then we don't want the draft view's range selections to be hidden.

HandleSelectionChange ( IVwRootBox rootb, IVwSelection vwselNew ) : void

Handle a selection changed event.

OnBackTranslationChecked ( object args ) : bool

Handle a click on the Back Translation Checked menu option

OnBackTranslationFinished ( object args ) : bool

Handle a click on the Back Translation Finished menu option

OnBackTranslationNextUnfinished ( object args ) : bool

Move to the next paragraph in the back translation that is unfinished.

OnBackTranslationPrevUnfinished ( object args ) : bool

Move to the previous paragraph in the back translation that is unfinished.

OnBackTranslationUnfinished ( object args ) : bool

Handle a click on the Back Translation Unfinished menu option

OnDeleteFootnote ( object args ) : bool

Deletes a footnote when the selection is on a footnote marker. Called from context menu.

OnGotFocus ( EventArgs e ) : void

Focus got set to the draft view

OnKeyPress ( KeyPressEventArgs e ) : void

Override to try to repair the situation if re-inserting a missing-data prompt causes there to be no selection.

OnLoadSettings ( RegistryKey key ) : void

Load settings from the registry

OnLostFocus ( EventArgs e ) : void

Raises the E:System.Windows.Forms.Control.LostFocus event.

OnMouseUp ( MouseEventArgs e ) : void

Handle the mouse up event.

OnSaveSettings ( RegistryKey key ) : void

Save passage to the registry

OnUpdateBackTranslationChecked ( object args ) : bool

OnUpdateBackTranslationFinished ( object args ) : bool

OnUpdateBackTranslationNextUnfinished ( object args ) : bool

Update handler for the Next Unfinished Paragraph button

OnUpdateBackTranslationPrevUnfinished ( object args ) : bool

Update handler for the Prev Unfinished Paragraph button

OnUpdateBackTranslationUnfinished ( object args ) : bool

OnUpdateInformationBar ( object args ) : bool

Handles a queued event that will be processed during idle cycles. This will update the information tool bar.

SetBackTranslationStatus ( ICmTranslation trans, BackTranslationStatus status ) : void

Set the status of a back translation object.

SetInsertionPoint ( int tag, int book, int section ) : SelectionHelper

Navigate to the beginning of any Scripture element: Title, Section Head, or Section Content.

SetInsertionPoint ( int tag, int book, int section, int paragraph ) : SelectionHelper

Navigate to the beginning of any Scripture element: Title, Section Head, or Section Content.

SetupPrintHelp ( PrintDialog dlg ) : void

If help is available for the print dialog, set ShowHelp to true, and add an event handler that can display some help. TE has such help available.

ShowContextMenu ( Point loc ) : void

Shows the context menu.

Private Methods

Method Description
ConvertBookTagAndIndex ( SelectionHelper helper, SelectionHelper selType ) : void

Convert the scripture book tag to a filter tag. Also, convert book indices to filtered book indices. This is done when loading a selection to make it work in the context of the book filter.

FindNextTranslationInText ( IStText text, int iParaStartSearch, bool>.Func condition ) : int

Look for a translation with a matching status in a paragraph of an StText

FindPrevTranslationInText ( IStText text, BackTranslationStatus searchStatus, int iParaStartSearch ) : int

Look for a previous translation with a matching status in a paragraph of an StText

GetBackTranslationStatus ( ICmTranslation trans ) : BackTranslationStatus

Get the status of a back translation object

IsKeyTermsView ( ) : bool
MoveToNextTranslation ( SelectionHelper selection, bool>.Func condition ) : void

Find and select the next translation meeting a given condition

MoveToPrevTranslation ( SelectionHelper selection, BackTranslationStatus searchStatus ) : void

Find and select the previous translation with a given state

ReplaceBookTagAndIndex ( SelectionHelper helper, SelectionHelper selType ) : void

Replace the filter book tag with a scrpiture books tag. This is done before persisting the selection because the filter tag is not valid across sessions. Also, any filtered book indices are replaced with real scripture book indices for the same reason.

ShowPrintDlgHelp ( object sender, EventArgs e ) : void

Show help for the print dialog

SynchFootnoteView ( ) : void

Synchronizes the footnote view.

SynchFootnoteView ( SelectionHelper helper ) : void

Synchronizes the footnote view.

Method Details

ActivateView() public method

Activates the view and initializes the information bar and styles combo based on the draft view's selection.
public ActivateView ( ) : void
return void

CallMouseDown() protected method

Remember if a picture is selected so that it can be deselected on mouse up, if necessary.
protected CallMouseDown ( Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot ) : void
pt Point
rcSrcRoot Rectangle
rcDstRoot Rectangle
return void

CallMouseUp() protected method

Call MouseUp on the rootbox
protected CallMouseUp ( Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot ) : void
pt Point
rcSrcRoot Rectangle
rcDstRoot Rectangle
return void

CreateEditingHelper() protected method

Provide a TE specific implementation of the EditingHelper
protected CreateEditingHelper ( ) : EditingHelper
return EditingHelper

CreateEditingHelper_Internal() protected method

Internal version of CreateEditingHelper allows subclasses to override to create a subclass of TeEditingHelper without repeating the common initialization code.
protected CreateEditingHelper_Internal ( ) : TeEditingHelper
return TeEditingHelper

CreateViewConstructor() protected method

Creates a view constructor suitable for this kind of view.
protected CreateViewConstructor ( ) : TeStVc
return TeStVc

DeactivateView() public method

public DeactivateView ( ) : void
return void

DoHotLinkAction() public method

Handle hot link action - user clicked on hot link on the view.
public DoHotLinkAction ( object sender, string strData ) : void
sender object Ignored. The view constructor that detected the click
strData string String-representation of the link, including the type of link /// and the GUID of the linked object
return void

DraftView() public method

Initializes a new instance of the DraftView class as a draft view editing pane, for either vernacular or back translation.
public DraftView ( FdoCache cache, int filterInstance, IApp app, string viewName, bool fEditable, bool fShowInTable, bool fMakeRootAutomatically, TeViewType viewType, int btWs, IHelpTopicProvider helpTopicProvider ) : System
cache FdoCache The cache.
filterInstance int The tag that identifies the book filter instance.
app IApp The application.
viewName string The name of the view.
fEditable bool true if view is to be editable.
fShowInTable bool true if the paragraphs are to be displayed in a /// table.
fMakeRootAutomatically bool true to make the root automatically /// when the window handle is created.
viewType TeViewType Bit-flags indicating type of view.
btWs int The back translation writing system (if needed).
helpTopicProvider IHelpTopicProvider The help topic provider.
return System

GetNonFocusedSelectionState() protected method

If the annotations window is gaining focus, then we don't want the draft view's range selections to be hidden.
protected GetNonFocusedSelectionState ( Control windowGainingFocus ) : VwSelectionState
windowGainingFocus Control
return VwSelectionState

GetWritingSystemForHvo() public method

Gets the writing system for the HVO. This could either be the vernacular or analysis writing system.
public GetWritingSystemForHvo ( int hvo ) : int
hvo int HVO
return int

HandleSelectionChange() protected method

Handle a selection changed event.
protected HandleSelectionChange ( IVwRootBox rootb, IVwSelection vwselNew ) : void
rootb IVwRootBox root box that has the selection change
vwselNew IVwSelection Selection
return void

OnBackTranslationChecked() protected method

Handle a click on the Back Translation Checked menu option
protected OnBackTranslationChecked ( object args ) : bool
args object
return bool

OnBackTranslationFinished() protected method

Handle a click on the Back Translation Finished menu option
protected OnBackTranslationFinished ( object args ) : bool
args object
return bool

OnBackTranslationNextUnfinished() protected method

Move to the next paragraph in the back translation that is unfinished.
protected OnBackTranslationNextUnfinished ( object args ) : bool
args object
return bool

OnBackTranslationPrevUnfinished() protected method

Move to the previous paragraph in the back translation that is unfinished.
protected OnBackTranslationPrevUnfinished ( object args ) : bool
args object
return bool

OnBackTranslationUnfinished() protected method

Handle a click on the Back Translation Unfinished menu option
protected OnBackTranslationUnfinished ( object args ) : bool
args object
return bool

OnDeleteFootnote() protected method

Deletes a footnote when the selection is on a footnote marker. Called from context menu.
protected OnDeleteFootnote ( object args ) : bool
args object
return bool

OnFilePrint() public method

public OnFilePrint ( object args ) : bool
args object
return bool

OnGotFocus() protected method

Focus got set to the draft view
protected OnGotFocus ( EventArgs e ) : void
e EventArgs The event data
return void

OnInsertDiffPara() public method

see OnInsertDiffParas
public OnInsertDiffPara ( IVwRootBox rootBox, ITsTextProps ttpDest, ITsTextProps ttpSrc, ITsString tssParas, ITsString tssTrailing ) : VwInsertDiffParaResponse
rootBox IVwRootBox
ttpDest ITsTextProps
ttpSrc ITsTextProps
tssParas ITsString
tssTrailing ITsString
return VwInsertDiffParaResponse

OnInsertDiffParas() public method

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).
public OnInsertDiffParas ( IVwRootBox rootBox, ITsTextProps ttpDest, int cPara, ITsTextProps ttpSrcArray, ITsString tssParas, ITsString tssTrailing ) : VwInsertDiffParaResponse
rootBox IVwRootBox the sender
ttpDest ITsTextProps properties of destination paragraph
cPara int number of paragraphs to be inserted
ttpSrcArray ITsTextProps Array of props of each para to be inserted
tssParas ITsString Array of TsStrings for each para to be inserted
tssTrailing ITsString Text of an incomplete paragraph to insert at end (with /// the properties of the destination paragraph.
return VwInsertDiffParaResponse

OnKeyPress() protected method

Override to try to repair the situation if re-inserting a missing-data prompt causes there to be no selection.
protected OnKeyPress ( KeyPressEventArgs e ) : void
e KeyPressEventArgs
return void

OnLoadSettings() protected method

Load settings from the registry
protected OnLoadSettings ( RegistryKey key ) : void
key RegistryKey Location in the registry
return void

OnLostFocus() protected method

Raises the E:System.Windows.Forms.Control.LostFocus event.
protected OnLostFocus ( EventArgs e ) : void
e EventArgs An that contains the event data.
return void

OnMouseUp() protected method

Handle the mouse up event.
protected OnMouseUp ( MouseEventArgs e ) : void
e MouseEventArgs
return void

OnProblemDeletion() public method

Handle a problem deletion - a complex selection crossing sections or other difficult cases such as BS/DEL at boundaries.
public OnProblemDeletion ( IVwSelection sel, VwDelProbType dpt ) : VwDelProbResponse
sel IVwSelection
dpt VwDelProbType
return VwDelProbResponse

OnSaveSettings() protected method

Save passage to the registry
protected OnSaveSettings ( RegistryKey key ) : void
key RegistryKey Location in the registry
return void

OnUpdateBackTranslationChecked() protected method

protected OnUpdateBackTranslationChecked ( object args ) : bool
args object
return bool

OnUpdateBackTranslationFinished() protected method

protected OnUpdateBackTranslationFinished ( object args ) : bool
args object
return bool

OnUpdateBackTranslationNextUnfinished() protected method

Update handler for the Next Unfinished Paragraph button
protected OnUpdateBackTranslationNextUnfinished ( object args ) : bool
args object
return bool

OnUpdateBackTranslationPrevUnfinished() protected method

Update handler for the Prev Unfinished Paragraph button
protected OnUpdateBackTranslationPrevUnfinished ( object args ) : bool
args object
return bool

OnUpdateBackTranslationUnfinished() protected method

protected OnUpdateBackTranslationUnfinished ( object args ) : bool
args object
return bool

OnUpdateInformationBar() protected method

Handles a queued event that will be processed during idle cycles. This will update the information tool bar.
protected OnUpdateInformationBar ( object args ) : bool
args object
return bool

SelectRangeOfChars() public method

Set an insertion point or character-range selection in this DraftView which is "installed" and scrolled into view.
This method is only used for tests
public SelectRangeOfChars ( int book, int section, int para, int startCharacter, int endCharacter ) : SelectionHelper
book int The 0-based index of the Scripture book in which to put the /// insertion point
section int The 0-based index of the Scripture section in which to put the /// insertion point
para int The 0-based index of the paragraph in which to put the insertion /// point
startCharacter int The 0-based index of the character at which the /// selection begins (or before which the insertion point is to be placed if /// startCharacter == endCharacter)
endCharacter int The character location to end the selection
return SelectionHelper

SetBackTranslationStatus() protected method

Set the status of a back translation object.
protected SetBackTranslationStatus ( ICmTranslation trans, BackTranslationStatus status ) : void
trans ICmTranslation
status BackTranslationStatus
return void

SetInsertionPoint() protected method

Navigate to the beginning of any Scripture element: Title, Section Head, or Section Content.
protected SetInsertionPoint ( int tag, int book, int section ) : SelectionHelper
tag int Indicates whether selection should be made in the title, section /// Heading or section Content
book int The 0-based index of the Scripture book in which to put the /// insertion point
section int The 0-based index of the Scripture section in which to put the /// insertion point. Ignored if tag is ///
return SelectionHelper

SetInsertionPoint() protected method

Navigate to the beginning of any Scripture element: Title, Section Head, or Section Content.
protected SetInsertionPoint ( int tag, int book, int section, int paragraph ) : SelectionHelper
tag int Indicates whether selection should be made in the title, section /// Heading or section Content
book int The 0-based index of the Scripture book in which to put the /// insertion point
section int The 0-based index of the Scripture section in which to put the /// insertion point. Ignored if tag is ///
paragraph int The 0-based index of the paragraph which to put the /// insertion point.
return SelectionHelper

SetInsertionPoint() public method

Set the insertion point in this draftview to the specified location.
public SetInsertionPoint ( int book, int section, int para, int character, bool fAssocPrev ) : SelectionHelper
book int The 0-based index of the Scripture book in which to put the /// insertion point
section int The 0-based index of the Scripture section in which to put the /// insertion point
para int The 0-based index of the paragraph in which to put the insertion /// point
character int The 0-based index of the character before which the /// insertion point is to be placed
fAssocPrev bool True if the properties of the text entered at the new /// insertion point should be associated with the properties of the text before the new /// insertion point. False if text entered at the new insertion point should be /// associated with the text following the new insertion point.
return SelectionHelper

SetupPrintHelp() protected method

If help is available for the print dialog, set ShowHelp to true, and add an event handler that can display some help. TE has such help available.
protected SetupPrintHelp ( PrintDialog dlg ) : void
dlg PrintDialog
return void

ShowContextMenu() protected method

Shows the context menu.
protected ShowContextMenu ( Point loc ) : void
loc Point The loc.
return void

ShowContextMenuAtIp() public method

Show the context menu for the specified root box at the location of its selection (typically an IP).
public ShowContextMenuAtIp ( IVwRootBox rootb ) : void
rootb IVwRootBox
return void

Property Details

m_fShowInTable protected_oe property

true to layout data in a table
protected bool m_fShowInTable
return bool

m_helpTopicProvider protected_oe property

protected IHelpTopicProvider m_helpTopicProvider
return IHelpTopicProvider