home *** CD-ROM | disk | FTP | other *** search
- #include "custcntl.h" // custom control structure definitions
- #include "ter_def.h" // TER macro definitions
- #include "ter_cmd.h" // TER command ids
- #include "ter_dlg.h" // TER dialog control ids
-
- /******************************************************************************
- Sub structure which needs to be defined before the main StrTer structure.
- *******************************************************************************/
- struct StrRtfParaFrameInfo { // para frame id information
- int x; // x position in twips
- int y; // y position in twips
- int width; // frame width in twips
- int height; // frame height in twips
- int DistFromText; // frame distance from text
- };
-
- /******************************************************************************
- The following structure is allocated for each window. The structure
- contains the global variables required for a window. This structure
- is deallocated when the window is closed.
- *******************************************************************************/
- typedef struct StrTer {
- struct arg_list TerArgW; // keep a copy of the user parametres
-
- /******************************************************************************
- Text line data arrays
- *******************************************************************************/
- DWORD huge * hLineW; // memory handle for each line
- int huge * LineLenW; // line length
- int huge * LineHtW; // line height
- int huge * LineYW; // line y position
- int huge * LineXW; // line x position from the begining of the frame
- BYTE huge * LineFlagsW; // Paragraph run-time flags
-
- HANDLE hhLineW,hLineLenW,hLineHtW,hLineYW,hLineXW,hLineFlagsW; // handles for the above memory blocks
-
- /******************************************************************************
- Screen display control variables
- *******************************************************************************/
- HWND hTerWndW; // handle to TER Window
- HDC hTerDCW, // handle to TER class DC
- hPrW; // current printer device context
- HFONT hTerRegFontW, // regular fixed pitched font
- hTerCurFontW, // current font in the display context
- hRulerFontW; // Ruler font handle
- TEXTMETRIC TerTextMetW; // TER text metric
- HCURSOR hWaitCursorW; // handle to Hour glass cursor
- RECT TerRectW, // entire client window rectangal
- TerWinRectW, // text window rectangal
- RulerRectW; // ruler rectangle
- HPEN hPagePenW, // pen to draw soft page break
- hColPenW, // pen to draw hard column break
- hCellPenW, // pen to draw cell break line
- hRowPenW; // pen to drag table row break line
- HBITMAP hScrollBMW; // stores scroll bits
-
- int CurColW, // current window column position
- WinWidthW, // current window in columns
- WinHeightW, // current window height in number of rows
- LineWidthW, // maximum line width in number of characters
- PaintFlagW, // indicates scope of painting
- TabWidthW, // tab width in number of characters
- HorScrollPosW, // horizontal scroll position
- VerScrollPosW, // vertical scroll position
- TerWinWidthW, // window width in units
- TerWinHeightW, // window height in units
- TerWinOrgXW, // window origin x co-ordinates
- TerWinOrgYW, // window origin y co-ordinates
- NextXW, // logical X co-ordinate where next painting will begin
- NextTabW, // next tab number while displaying a text line
- NextSpaceW, // next space number in a justified text
- PaintEnabledW, // When FALSE, disables the window painting
- WrapPendingW, // wrapping postponed
- RulerPendingW, // ruler painting postponed
- RulerSectionW, // section for which the ruler is displayed
- PagingMarginW, // number of lines to retail while PGUP and PGDN
- RulerFontHeightW, // height of the ruler font
- ScrResXW, // screen resolution/inch in X direction
- ScrResYW, // screen resolution/inch in Y direction
- PrtResXW, // printer resolution/inch in X direction
- PrtResYW, // printer resolution/inch in Y direction
- CurLineYW, // Y position of the current line in PrintView mode
- CurPageWidthW, // Height of the current page
- CurPageHeightW, // Height of the current page
- CurTextHeightW, // Height of the text on the current page
- CursHorzPosW, // Horizontal cursor position or up/down key processing
- OverhangFontW, // font to cover the previous overhang
- WinYOffsetW, // offset of the first line with respect to top of the window
- CommandIdW, // current Command Id
- RepaintNoW; // incremental number of this repaint
-
- long CurRowW, // current window row position
- CurLineW, // current line number in the file
- BeginLineW, // line number of the first window line
- TotalLinesW, // total lines in the file
- MaxLinesW, // maximum number of line space allocated
- PaintBegLineW, // first line to be painted
- PaintEndLineW, // last line to be painted
- WinYOffsetLineW; // First line with offset
-
- BOOL CrNewLineW, // create a new line when <CR> hit at the end of line
- CrSplitLineW, // split the current line if <CR> was hit
- TabAlignW, // Align tabs
- JoinLinesW, // join the current line to the previous line when BKSP is hit
- NotifiedW, // TRUE when modification message is sent to your application
- InAcceleratorW, // TRUE when processing an accelerator key
- RulerClickedW, // TRUE when user clicks the ruler
- FontsReleasedW, // TRUE when the fonts are released
- WindowDestroyedW, // TRUE when processing WM_DESTROY message
- ReclaimResourcesW; // reuse unused font and para ids
-
- int StatusRowPosW, // logical unit position where status row number is printed
- StatusColPosW, // logical unit position where status col number is printed
- StatusLinePosW; // logical unit position where status line number is printed
-
- HRGN CurClipRgnW; // current clip region handle
- /******************************************************************************
- Text Frame variables
- *******************************************************************************/
- struct StrFrame {
- BOOL empty; // TRUE if the frame does not contain text
- long PageFirstLine, // first line in the frame
- PageLastLine, // last line of the frame
- ScrFirstLine, // first line visible in the window
- ScrLastLine; // last line visible in the window
- int x, // frame X location relative to page
- y, // frame Y location relative to page
- ScrX, // X location of WinBeginLine
- ScrY; // Y location of WinBeginLine
- int width, // width of the frame
- height, // height of the frame
- TextHeight, // height where the text ends
- ScrWidth, // width of the frame visible in the window
- ScrHeight; // height of the frame visible in the window
- int RowOffset; // offset into the RowY,RowHeight & RowX arrays
- int sect; // section to which this frame belongs
- UINT border; // frame border, uses BORDER_ constants
- int BorderWidth[4]; // border width of each border
- BOOL LastColumnFrame; // TRUE for the last frame of a column
- int RowId; // for cell frames the row id of the table row
- int CellId; // for cell frames the cell id of the frame
- int SpaceTop; // space before the first line
- int SpaceBot; // space after the last line
- int SpaceLeft; // left margin
- int SpaceRight; // right margin
- int shading; // frame shading percent 0 to 100
- int ParaFrameId; // para frame id
- UINT flags; // FRAME_RIGHTMOST and other flags
- } huge *frameW;
-
- HANDLE hFrameW; // handle for the above table
- int CurFrameW, // current frame index
- TotalFramesW, // total number of frames
- MaxFramesW, // maximum number of frames allocated
- FirstTextFrameW, // first text frame
- LastTextFrameW; // last text frame
-
- /******************************************************************************
- Paragraph Frame variables
- *******************************************************************************/
- struct StrParaFrame {
- BOOL InUse; // TRUE when in use
- int x; // x position (twips) relative to left margin
- int y; // y position (twips) relative to top margin
- int ParaY; // y (twips) relative to the beginning of the next para
- int width; // width in twips
- int margin; // border margin
- int height; // current height in twips
- int MinHeight; // minimum height in twips
- int DistFromText; // distance from the text text in twips
- int PageNo; // page number to which this frame belongs
- UINT flags; // PARA_FRAME_ flags
- long TextLine; // used temporarily to store the corresponding text line
- } huge *ParaFrameW;
-
- HANDLE hParaFrameW; // handle for the above table
- int CurParaFrameW, // current para frame index
- TotalParaFramesW; // total number of para frames
-
- BOOL ContainsParaFramesW; // TRUE when a text frame contain paraframes
- /******************************************************************************
- Screen Text Line Position Table
- *******************************************************************************/
- int RowYW[MAX_LINES_PER_WIN], // Y position of each row
- RowHeightW[MAX_LINES_PER_WIN], // pixel height of each screen row
- RowXW[MAX_LINES_PER_WIN]; // Starting X position of each row
-
- /******************************************************************************
- Text segment structure
- *******************************************************************************/
- struct StrTextSeg {
- BOOL drawn; // TRUE if the text segment is drawn
- LPBYTE string; // pointer to the text string
- HANDLE hString; // handle to the string
- int len; // length of the text string
- int x; // starting X coordinate of the text
- int y; // starting Y coordinate of the text
- RECT rect; // coordinate of the text box
- COLORREF color; // forground color
- COLORREF BackColor; // background color
- int fmt; // format id used for the segment
- UINT border; // BORDER_TOP,BORDER_BOT,BORDER_LEFT,BORDER_RIGHT
- UINT ParShading; // paragraph shading
- int FrmShading; // frame shading
- int BoxLeftPos; // position of left side of the box
- int BoxRightPos; // position of the right side of the box
- int CellId; // frame cell id
- int RowId; // frame row id
- int FrameHt; // frame height
- BOOL ParFrameSpace; // TRUE is space reserved for a paragraph frame
- int RepaintNoW; // incremental number of this repaint
- int ParaFIDW; // para frame id
- }far *TextSegW;
-
- HANDLE hTextSegW; // handle to the text segment block
- int TotalSegmentsW; // total text segments
- BOOL UseTextMapW; // use text map to increase painting efficiency
- UINT TextBorderW, // current text border to be used
- ParaShadingW; // current shading for the paragraph (0 to 10000)
- BOOL ParaFrameSpaceW; // TRUE if paraframe space
-
- /******************************************************************************
- Mouse control variables
- *******************************************************************************/
- long MouseLineW; // text line position of mouse
-
- int MouseColW, // text column position of mouse
- MouseXW, // current x position of mouse
- MouseYW; // current y position of mouse
- BYTE MouseOverShootW; // stores L,R,T,or B when mouse goes past the text area of the screen
-
- BOOL IgnoreMouseMoveW, // ignore mouse move until a mouse button is depressed
- VerySmallMovementW; // record if the mouse movement is very small
-
- /******************************************************************************
- Word Wrapping related variables
- *******************************************************************************/
- WORD DocCodeW, // used to identify a word wrap file
- DocBeginW; // Document header size or text begin location
-
- long WrapMaxLinesW; // Maximum lines for the wrap buffer
- int WrapBufferSizeW; // wrap buffer size
-
- BYTE ParaCharW; // a character to mark end of a paragraph
- BYTE DocExtW[5]; // extension of a document file
-
- LPBYTE wrapW; // pointer to the wrap buffer
-
- HANDLE hWrapW; // handle to the wrap buffer
-
- int BufferLengthW, // current length of a wrap buffer
- MaxBufferLengthW; // max length of a wrap buffer
-
- int WrapFlagW; // indicates the extent of word wrapping for the current operation
-
- long LastBufferedLineW, // last line in the wrap buffer
- LastWrappedLineW; // lines used up the wrap buffer
-
- /*****************************************************************************
- Character Formatting Variables
- The character formatting option provide underline, bold and italic attributes.
- ******************************************************************************/
- BYTE CfmtSignW[30]; // indicates the beginning of the formatting information
-
- union UnionCfmt {
- DWORD hnd; // handle to the character formattnig information
- struct {
- unsigned short type; // = UNIFORM if one format used through out the line
- BYTE fmt; // format if type = UNIFORM
- }info;
- }huge * cfmtW; // pointer to line array containing the formatting information for each line
-
- HANDLE hCfmtW;
-
- LPBYTE WrapCfmtW, // pointer to the character formatting wrap buffer
- TempCfmtW; // pointer to temporary formatting info
-
- HANDLE hWrapCfmtW; // handle to the character formatting wrap buffer
- int CurFmtIdW; // current format id in the device context
- int InputFontIdW; // font selected for next input
-
- /******************************************************************************
- Paragraph formatting variables
- ******************************************************************************/
- HANDLE hPfmtW; // handle to the paragraph formatting info
- int huge *pfmtW; // paragraph formatting data for each line
-
- HANDLE hPfmtIdW; // handle to the paragraph formatting table
-
- struct StrPfmt {
- int LeftIndent; // left indentation in screen units
- int RightIndent; // Right indentation in screen units
- int FirstIndent; // First line indentation in screen units
- int LeftIndentTwips; // left indent in twips
- int RightIndentTwips; // Right indent in twips
- int FirstIndentTwips; // First line indent in twips
- UINT flags; // includes such flags as double spacing,centering, right justify etc
- int TabId; // tab id, index into the tab table
- int CellId; // cell id that the paragraph belongs to
- UINT shading; // shading (0 to 10000)
- int ParaFrameId; // paragraph frame id
- int SpaceBefore; // space before the paragraph in twips
- int SpaceAfter; // space after the paragraph in twips
- int SpaceBetween; // space between the paragraph lines in twips
- int AuxId; // id for use by external application
- } far *PfmtIdW;
-
- int TotalPfmtsW; // total number of para ids
-
- int CurPfmtW; // current para id
-
- int CurWrapPfmtW; // para id of para being wrapped
-
- /******************************************************************************
- Paragraph Border and spacing parameters
- ******************************************************************************/
- int BoxLeftW, // position of the left edge of the paragraph box
- BoxRightW; // position of the right edge of the paragraph box
-
- UINT DlgOnFlagsW, // box parameters turned on by the dialog box
- DlgOffFlagsW; // box parameters turned off by the dialog box
-
- DWORD DlgLongW; // temporary variable to pass a long value
-
- int DlgInt1W, // temporary integer variables to pass result
- DlgInt2W,
- DlgInt3W;
-
- int SpaceBefW, // space before the paragraph
- SpaceAftW; // space after the paragraph
-
- /******************************************************************************
- Font and Picture Control Data
- ******************************************************************************/
-
- BYTE FmtSignW, // indicates the beginning of a format data section
- FmtSignOldW; // old value (version 3.5)
-
- struct StrFont { // main font table
- //******* Font Variables *********
- HFONT hFont; // font handle
- BYTE TypeFace[31];//font typeface
- BYTE FontFamily; // font famiy (optional)
- int PointSize; // display point size of the font
- DWORD TextColor; // Color of the text
- DWORD TextBkColor;// text background color
- //******* Object Variables
- LPOLEOBJECT pObject;// pointer to the object
- int ObjectType; // OBJ_EMBED, OBJ_LINK, OBJ_NONE
- DWORD ObjectSize; // size of the object storage data
- WORD OleNotice; // notification from the callback funciton
- HGLOBAL hObject; // temporary memory containing object data
- #if !defined(INC_OLE1)
- LPOLECLIENTSITE pObjSite; // Client site pointer
- #endif
-
- //****** Picture Variables ********
- int PictType; // PICT_DIBITMAP (device ind. bitmap) or PICT_METAFILE
- HBITMAP hBM; // bitmap handle if style&PICT is TRUE and PictType=PICT_DIBITMAP
- HMETAFILE hMeta; // bitmap handle if style&PICT is TRUE and PictType=PICT_METAFILE
- DWORD ImageSize; // size of the device independent bitmap image
- DWORD InfoSize; // size of the device independent bitmap information structure
- HANDLE hImage; // handle to the device independent bitmap image
- HANDLE hInfo; // handle to the device independent bitmap info structure
- int bmHeight; // actual height of the stored bitmap
- int bmWidth; // actual width of the stored bitmap
- int PictHeight; // display height in point size
- int PictWidth; // display width in point size
- DWORD ColorsUsed; // number of colors used in the bitmap
- int PictAlign; // picture alignment value, uses ALIGN_ constants
- int PictX; // latest x location on the screen
- int PictY; // latest y location on the screen
- //****** Common Variables *********
- int height; // point size converted to pixel height for display
- int BaseHeight; // baseline to the top of the character/picture
- UINT style; // font styles: bold,underline,italic,strikeout, or PICTURE
- BOOL InUse; // TRUE indicates that this font/picture is in use in the current document
- LPINT CharWidth; // stores the character width of each style
- int FieldId; // field id, 0 for default
- int AuxId; // auxiliary id for sole use of outside application
- } far *TerFontW; // pointer to the font structure
-
- struct StrPrtFont { // printer font metrics translation structure
- int height; // point size converted to pixel height for display
- int BaseHeight; // baseline to the top of the character/picture
- LPINT CharWidth; // stores the character width of each style
- } far *PrtFontW; // pointer to the font structure
-
- HANDLE hTerFontW, // handle to the main font structure
- hPrtFontW; // handle to the printer font structure
-
- int TotalFontsW, // Total fonts in use by the current window
- TotalTypesW, // number of enumerated font face types
- TotalPointSizesW; // number of enumerated pointsizes
- BYTE ReqTypeFaceW[31]; // requested type face
- int ReqPointSizeW; // requested font size
-
- BOOL UsingZoomFontsW; // use and create zoom fonts
-
- /******************************************************************************
- Tab control control variables
- *******************************************************************************/
- struct StrTab { // tab table
- int count; // number of tabs
- int pos[MAX_TAB_STOPS]; // tab stop position in twips
- int type[MAX_TAB_STOPS];// tab type each stop, TAB_LEFT, TAB_RIGHT
- } far *TerTabW; // pointer to the tab table
-
- struct StrTabw { // stores tab or section information for a line
- int type; // information type: INFO_TAB, INFO_SECT
- int count; // number of tabs used in the line
- int width[MAX_TAB_STOPS]; // screen width of each tab
- int section; // section number when type==INFO_SECT
- int JustCount; // justification - number of spaces allocated one extra pixel
- int JustAdj; // justification - extra pixels for each space
- int JustSpaceCount; // justification - number of spaces to modify
- int FrameCharPos; // character number before which the space is created
- int FrameX; // frame space begin position
- int FrameWidth; // width of the frame space - printer pixels
- int FrameScrWidth; // total width of the frame space including distance from text - screen pixels
- int height; // height of a space line in printer units
- } far * (huge *tabwW);
-
- HANDLE hTerTabW, // handle to the StrTab table
- hTabwW; // handle to the StrTabw table
-
- int TotalTabsW, // total tab entries used in the tab table
- DefTabWidthW; // default tab width in twips
-
- /******************************************************************************
- Section control variables
- *******************************************************************************/
- struct StrSect { // section table
- BOOL InUse; // TRUE when this slot is in use
- float LeftMargin; // left margin in inches
- float RightMargin; // right margin in inches
- float TopMargin; // top margin in inches
- float BotMargin; // bottom margin in inches
- int columns; // number of columns
- float ColumnSpace; // space between column in inches
- long FirstLine; // first line of the section
- long LastLine; // last line of the section
- BOOL reserved1; // lines justified for printing
- int start; // section starts SECT_CONTINUE, SECT_NEW_PAGE
- int LastPage; // last page number of the section
- int LastPageHeight;// height of the text on the last page
- BYTE reserved[16]; // reserved for future
- } far *TerSectW; // pointer to the section table
-
- struct StrSect1 { // temporary section table
- int PrevSect; // previous section number
- long HdrFirstLine; // first page header line
- long HdrLastLine; // last page header line
- long FtrFirstLine; // first page footer line
- long FtrLastLine; // last page footer line
- } far *TerSect1W; // pointer to the section table
-
- HANDLE hTerSectW, // handle to the StrSect table
- hTerSect1W; // handle to the StrSect1 table
- int TotalSectsW, // total section entries used in the section table
- WrapSectW; // section being wrapped currently
-
- BOOL SectModifiedW; // TRUE when section boundary may have been modified
-
- /******************************************************************************
- Screen page break and repagination variables
- *******************************************************************************/
- int TotalPagesW, // total number of pages
- MaxPagesW, // size of the page array
- PageModifyCountW, // number of times document modified
- CurPageW; // current page number
-
- long huge * PageLineW; // stores first line of each page
-
- HANDLE hPageLineW; // handles for the above memory block
- long RepageBeginLineW; // repagination begin line
- BOOL repaginatingW; // TRUE during the repagination process
-
- /******************************************************************************
- Print control variables
- *******************************************************************************/
- float PageWidthW, // width of the page in inches
- PageHeightW; // height of the page in inches
-
- int PageXW; // X position where the text begin on the page
-
- BOOL AbortPrintW, // set to TRUE to abort printing
- InPrintingW, // TRUE when the editor is in printing process
- InPrintPreviewW, // TRUE when the editor is in print preview process
- PrinterAvailableW; // TRUE when a printer is avaialbe
-
- BYTE PrinterNameW[60], // name of the printer
- PrinterDriverW[60], // printer driver
- PrinterPortW[60]; // printer port
-
- LPDEVMODE pDevModeW; // pointer to the device mode storage
- HANDLE hDevModeW; // handle to device mode memory
-
- HWND hAbortWndW; // abort window handle
-
- int TotalPreviewPagesW; // number of preview pages to display
- int PreviewZoomW, // zoom percent for print preview
- PreviewHeightW, // height of the preview area
- PreviewWidthW; // width of the preview area
-
- BOOL SavePvStatusW, // save the show status flag
- SavePvRulerW, // save the ruler status
- SavePvToolbarW, // save the tool bar status
- SavePvWordWrapW, // save the word wrap flag
- SavePvPrintViewW, // save the print view mode flag
- SavePvPageModeW, // save the page mode flag
- SavePvShowHorBarW, // horrizontal scroll bar display flag
- SavePvOrgXW, // save the x window origin
- SavePvOrgYW, // save the y window origin
- SavePvViewPageHdrFtrW; // save the hdr/ftr view status
-
- WNDPROC ZoomSubclassProcW, // handle to zoom bar subclass process
- OrigZoomSubclassProcW;// original zoom bar control process
-
- /******************************************************************************
- Cursor Adjustment variables
- ******************************************************************************/
- long PrevCursLineW; // previous cursor line
-
- int PrevCursColW, // previous cursor column
- PrevCursPageW, // previous cursor page
- PrevCursLineYW, // previous cursor Y position (including TerWinOrgX)
- CursDirectionW; // direction of cursor movement
-
- /******************************************************************************
- OLE variables
- ******************************************************************************/
- #if defined (INC_OLE1)
- struct StrClient {
- OLECLIENT client; // ole client
- void far * TerData;
- } TerClientW;
-
- OLECLIENTVTBL TerClientVtblW; // contains the pointer to call back function
- LHCLIENTDOC lhDocW; // handle to current document
- OLE_RELEASE_METHOD OleReleaseMethodW; // Ole release method
- #else
- LPSTORAGE pDocStorageW; // top level storage
- #endif
-
- struct StrOleStream {
- OLESTREAM stream; // ole stream
- void far * TerData;
- DWORD offset; // offset into buffer
- DWORD MaxSize;
- } OleStreamW;
-
- OLESTREAMVTBL OleStreamVtblW; // virtual table containing ole streams
-
- OLECLIPFORMAT NativeClipFormatW, // Native format
- ObjectLinkClipFormatW, // Object link format
- OwnerLinkClipFormatW; // Owner link format
-
- BOOL WaitForOleW; // Wait for OLE asynch task to be over
- HGLOBAL hOleDataW; // Handle to the OLE file io buffer
- BYTE huge * pOleDataW; // pointer to the OLE file io buffer
- int CurObjectW; // current object index
- UINT RtfClipFormatW; // Rich text format clipboard format
-
- /******************************************************************************
- Color control variables
- ******************************************************************************/
- COLORREF TextDefBkColorW, // default background color for text
- StatusBkColorW, // background color of the status line
- StatusColorW, // foreground color of the status line
-
- CurForeColorW, // current foreground color
- CurBackColorW; // currnet background color
-
- int FrameShadingW; // Current shading percent 0 to 100
-
- /******************************************************************************
- Block highlighting variables
- ******************************************************************************/
- long HilightBegRowW, // beginning row
- HilightEndRowW; // ending row
-
- int HilightTypeW, // line/col or character block
- HilightBegColW, // beginning col
- HilightEndColW, // ending col
- MaxColBlockW; // biggest column block allowed
-
- BOOL StretchHilightW;// stretch hilighting mode
-
- /******************************************************************************
- Tool Bar variables
- *******************************************************************************/
- int ToolBarHeightW; // height of the tool bar
- HWND hToolBarWndW; // handle to the tool bar window
- HWND hPvToolBarWndW; // handle to the print preview tool bar window
- FARPROC lpToolBarW; // handle to the tool bar dialog process
-
-
- int ToolBarCfmtW; // tool bar font id
- int ToolBarPfmtW; // tool bar para id
-
- WNDPROC ToolBarFontProcW, // handle to font subclass process
- OrigBarFontProcW; // original font process
-
- WNDPROC ToolBarPointProcW, // handle to point size edit subclass process
- OrigBarPointProcW; // original point size edit control process
-
- /******************************************************************************
- Search/Replace Variables
- *******************************************************************************/
- BYTE SearchStringW[MAX_WIDTH+1], // last string searched
- SearchDirectionW, // F'orward, B'ackward, E'ntire file
- ReplaceStringW[MAX_WIDTH+1],// last string changed
- ReplaceWithW[MAX_WIDTH+1]; // string to be changed with
-
- BOOL ReplaceVerifyW, // verify before replace
- ReplaceBlockW; // Replace range: block or file
-
- UINT SearchFlagsW; // Search flags
-
- /******************************************************************************
- Undo variables
- *******************************************************************************/
- HANDLE hUndoW, // handle to the undo text information
- hUndoCfmtW; // handle to the undo formatting info
- long UndoBegW, // undo block absolute coordinates
- UndoEndW;
-
- BOOL UndoExistsW; // text exist for undoing
- BYTE UndoTypeW; // type of undo: delete,insert or replace
-
- /******************************************************************************
- Mail merge fields
- *******************************************************************************/
- struct StrMergeData {
- LPBYTE pName; // name of the field
- LPBYTE pData; // data for the field
- int NameLen; // length of the name
- int DataLen; // length of the field data
- } mergeW[MAX_FIELDS];
-
- /******************************************************************************
- Hidden text variables
- *******************************************************************************/
- BOOL ShowHiddenTextW; // show hidden text
-
- /******************************************************************************
- VBX Variables
- *******************************************************************************/
- BOOL VbxControlW, // TRUE if it is a VBX control
- VbxMessageProcessedW; // TRUE when VBX message processed successfully.
-
- VBX_CALLBACK VbxCallbackW; // routine to recieve TER messages in a VBX
-
- /******************************************************************************
- Object drag Variables
- *******************************************************************************/
- struct StrDragObj { // drag object table
- BOOL InUse; // TRUE if the entry in use
- BOOL drawn; // object drawn
- int type; // object type
- int id1; // primary object identification
- int id2; // secondary object identification
- int id3; // another object identification
-
- POINT ObjPoint[4]; // polygon to be dragged. Other than fist two points are static when strech = FALSE
- int ObjPointCount; // number of points in the drag polygon
- RECT ObjRect; // some object migh use rect istead of polygon
-
- RECT HotRect[4]; // hotspot rectangles
- int HotRectCount; // number of hot rects in use
- } far * DragObjW; // table pointer
-
- HGLOBAL hDragObjW; // drag object table handle
-
- int CurDragObjW; // current drag object
- int CurHotSpotW; // current hot spot within the drag object
- int TotalDragObjsW; // total drag objects on the screen
-
- BOOL PictureHilightedW; // TRUE when a picutre object is highlighted
- BOOL FrameTabsHilightedW; // TRUE when a frame size tabs are highlighted
- BOOL FrameRectHilightedW; // TRUE when a frame rectangle is highlighted
- BOOL PictureClickedW; // TRUE when a picutre object is clicked
- BOOL FrameClickedW; // TRUE when a frame object is clicked
-
- HPEN hFocusPenW; // handle to the focus pen
-
- /******************************************************************************
- Table Variables
- *******************************************************************************/
- struct StrTableRow { // Table structure
- BOOL InUse; // TRUE if the entry in use
- BOOL hdr; // TRUE if this is a header row
- int FirstCell; // first cell id for this row
- int LastCell; // last cell id for this row
- int YPos; // Row Y position during display or printing
- int height; // Row height during display or printing
- BOOL PrevRow; // Previous row of the table, -1 if the first row
- BOOL NextRow; // Next row of the table, -1 if the last row
- int indent; // left indentation in twips
- UINT flags; // RIGHT or CENTER flags
- int CellMargin; // space between the cells
- UINT border; // uses BORDER_ constants
- int BorderWidth[4]; // border width for each border
- int FirstFrame; // first frame for the row
- int LastFrame; // last frame for the row
- #if defined (WIN32)
- BYTE reserved32[8]; // maintain 4 byte alignement
- #else
- BYTE reserved[6];
- #endif
- } far *TableRowW; // pointer to the table row table
-
- struct StrCell { // Cell structure
- BOOL InUse; // TRUE if the entry in use
- int row; // row id to which this cell belongs
- int NextCell; // next cell in the row, -1 if last
- int PrevCell; // previous cell in the row, -1 if last
- int x; // calculated x (twips) position
- int width; // width (twips) including the margin
- UINT border; // uses BORDER_ constants
- int BorderWidth[4]; // border width for each border
- int margin; // left/right margin in twips
- int height; // cell height (pixels) during display
- long FirstLine; // first line in the cell
- long LastLine; // last line in the cell including the cell marker line
- int shading; // shading percent 0 to 100
- UINT flags;
- #if defined (WIN32)
- BYTE reserved32[8]; // maintain 4 byte alignement
- #else
- BYTE reserved[6];
- #endif
- } far *cellW; // pointer to the cell table
-
-
- HGLOBAL hTableRowW; // handle to the row table
- HGLOBAL hCellW; // handle to the cell table
-
- int TotalTableRowsW, // number of row entries in the table
- TotalCellsW; // number of cells entries in the table
-
- int TableRowsW, // new table parameter
- TableColsW; // new table parameter
-
- BYTE CellCharW; // a character to mark end of a cell
-
- int FrameCellIdW, // current frame cell id
- FrameRowIdW, // current frame Row id
- FrameHeightW; // current frame height
-
- BOOL ShowTableGridLinesW; // show table grid lines
-
- /******************************************************************************
- File info structure
- *******************************************************************************/
- struct StrFileInfo { // Table structure
- BYTE sign; // is set to SIGN_EOF
- BYTE VerId; // x.x is stored as xx (4.0 -> 40)
- BYTE RevId; // revision id
- BYTE reserved[599]; // reserved for future use
- }FileInfoW;
-
- /******************************************************************************
- Rtf Control Variables
- *******************************************************************************/
- int RtfCurRowIdW; // current table row id
- int RtfCurCellIdW; // current table cell id
- int RtfLastCellIdW; // last cell id for this row
- int RtfParaFIDW; // current paragraph frame id
- BOOL RtfInTableW; // text in table
- UINT RtfInHdrFtrW; // PAGE_HDR || PAGE_FTR
- struct StrRtfParaFrameInfo RtfParaFrameInfoW; // paraframe information
-
- /******************************************************************************
- Page header/footer variables
- *******************************************************************************/
- BOOL ViewPageHdrFtrW, // TRUE to show page header footer
- EditPageHdrFtrW, // TRUE when editing page header/footer
- PosPageHdrFtrW; // TRUE when page header/footer need to be repositioned
-
- long HdrFirstPageLineW, // first header line number on the current page
- HdrLastPageLineW, // last header line number on the current page
- FtrFirstPageLineW, // first footer line number on the current page
- FtrLastPageLineW; // last footer line number on the current page
-
- /******************************************************************************
- Caret Variables
- *******************************************************************************/
- HWND hCaretWndW; // window that owns the caret
- BOOL CaretEngagedW, // caret engaged to scrolling text
- CaretEnabledW, // TRUE when this window owns the caret
- CaretHiddenW, // TRUE when the caret is hidden has meaning only when the caret is enabled
- ShowProtectCaretW, // TRUE to show caret on the protected text
- CaretPositionedW; // TRUE when caret already positioned
- int CaretPageW, // page number of the caret
- CaretHeightW; // height of the caret
- long CaretPosW; // position of the caret
-
- /******************************************************************************
- Other Variables
- *******************************************************************************/
- BOOL InsertModeW, // indicates if insert or replace typing mode
- TerHelpWantedW, // TRUE when help is requested
- WindowBeingCreatedW, // TRUE when a window is being created
- CrLfUsedW, // TRUE when cr/lf pair used in the buffer
- ProtectionLockW, // Protection lock
- ShowParaMarkW; // show para mark
-
- BYTE TerHelpFileW[13]; // Help file for the editor
- BYTE BreakCharsW[20]; // break characters
-
- HANDLE hTerAccTableW; // accelerator table handle
-
- int FileFormatW, // input format, SAVE_TER, SAVE_RTF, SAVE_TEXT
- RtfInputW; // type of rtf input: RTF_FILE, RTF_BUF, RTF_CB
-
- BYTE SpeedKeyEnabledW[MAX_SPEED_KEYS]; // TRUE to enable a speed key
-
- BOOL ShowHyperlinkCursorW, // TRUE to show the hyperlink cursor
- ModifyProtectColorW, // modify the color or the protected text
- LinkDblClickW, // TRUE to activate hyperlink on double click, otherwise use single click
- MatchIdsW; // match font and para ids when creating a new one
-
- HGLOBAL hAppMemoryW; // data block reserved to use by your application
- LPVOID pAppMemoryW; // data pointer for hAppMemory
-
- UINT LinkStyleW; // character style of the hyperlink phrase
- COLORREF LinkColorW; // color of the linked phrase
-
- }TERWND;
-
- typedef TERWND far *PTERWND; // pointer to the TER window variable structure
-
-
- /******************************************************************************
- Common Variables
- *******************************************************************************/
- PREFIX HANDLE hTerInst; // Ter instance id
- PREFIX BYTE TempString[MAX_WIDTH+1], // temporary holding place
- TempString1[MAX_WIDTH+1];// temporary holding place
- PREFIX BOOL ClassRegistered; // TRUE after registered the window class
- PREFIX BOOL Win32; // TRUE if compiled as a WIN32 application
- PREFIX HWND hCurAbortWnd; // Current abort window
- PREFIX HMENU hTerMenu; // TER menu
- PREFIX HDC hMemDC; // comaptible display context
- PREFIX int TerOpenCount; // number of open windows
- PREFIX int TotalWinPtrs, // number of non-standard windows open
- TotalWinTasks; // total tasks using this DLL
- PREFIX int StorageId; // id to make unique storage name
-
- PREFIX HBITMAP hBoldOnBM, // bold on tool bar bitmap
- hBoldOffBM, // bold off tool bar bitmap
- hItalicOnBM, // italic on tool bar bitmap
- hItalicOffBM, // italic off tool bar bitmap
- hUlineOnBM, // Uline on tool bar bitmap
- hUlineOffBM, // Uline off tool bar bitmap
- hJustRightBM, // right justify tool bar bitmap
- hJustCenterBM, // center justify tool bar bitmap
- hDoubleSpaceBM, // double space tool bar bitmap
- hIndentLeftBM, // left indent tool bar bitmap
- hIndentRightBM, // right indent tool bar bitmap
- hIndentHangingBM; // right indent tool bar bitmap
-
- PREFIX HCURSOR hTable1Cur, // table cell width cursor
- hTab1Cur, // tab marker cursor
- hHyperlinkCur, // hyperlink cursor
- hPlusCur; // plus cursor
-
- PREFIX struct StrWinPtr { // Contains data pointer for non-standard windows
- BOOL InUse; // TRUE=slot in use
- HWND hWnd; // window handle
- PTERWND data; // data pointer
- }WinPtr[MAX_WIN_PTRS]; // max non-standard windows
-
- PREFIX struct StrTask { // window task list
- HTASK task; // task id
- int count; // number of open windows for this task
- #if !defined(INC_OLE1)
- LPSTORAGE pDocStg; // top level storage
- #endif
- } WinTask[MAX_TASKS];
-
- /******************************************************************************
- WIN32 Custom Control Variables
- *******************************************************************************/
- PREFIX CCSTYLEFLAG CtlStyleFlag[TER_NUM_STYLES]; // style flags
-
-
- /******************************************************************************
- Other Structures
- *******************************************************************************/
-
- struct StructTextBuf {
- BYTE huge *pBuf; // pointer to the buffer containing text
- BYTE huge *pFmt; // pointer to the buffer containing the format data
- int len; // current line length
- long index; // index to the current line
- BOOL eof,eol; // end of file and end of line flags
- int MaxLineLen; // maximum line length allowed
- BOOL ParaCharFound; // indicates if paragraph character is detected
- };
-
- struct StrEnumFonts { // result of font enumeration
- BOOL GetMultiple; // when TRUE all enumerated fonts are returned
- BOOL EnumTypeFace; // Enumerate type face, otherwise enumerate pointsizes
- BOOL result; // TRUE or FALSE
- BYTE CharSet; // character set
- BYTE PitchAndFamily; // pitch and family
- int TypeCount; // number of fonts enumerated
- BYTE TypeNames[MAX_TYPES][31]; // font type faces returned
- int PointCount; // number of point sizes enumerated
- int height[MAX_POINTS]; // font height in device units
- BOOL TrueType; // TRUE indicates true type font
- };
-
- struct StrDlgParam { // Dialog box title and owner window control area
- PTERWND w; // owner window data pointer
- LPBYTE data; // miscellaneous data pointer
- };
-
- struct StrFontIO { // font structure to write to ter file
- UINT style; // character style
- int PointSize; // point size
- BYTE TypeFace[31]; // font type face
- BYTE FontFamily; // font family
- int PictType; // picture type when the font represents a picture
- DWORD TextColor; // color of the text
- int bmWidth; // actual width of the picture
- int bmHeight; // actual height of the picture
- int ObjectType; // object type
- DWORD ObjectSize; // size of the object storage data
- DWORD TextBkColor; // text background color
- int FieldId; // field id
- int PictAlign; // picture alignment value
- int AuxId; // id for external use
- #if defined (WIN32)
- BYTE reserved[20]; // reserved bytes
- #else
- BYTE reserved[26]; // reserved bytes
- #endif
- };
-
- struct StrParaIO { // para table structure to write to ter file
- int LeftIndent; // left indent in twips
- int RightIndent; // right indent in twips
- int FirstIndent; // first line indent in twips
- UINT flags; // paragraph flags
- int TabId; // tab id
- int CellId; // cell id
- UINT shading; // shading percentage
- int ParaFrameId; // paragraph frame id
- int SpaceBefore; // space before the paragraph-twips
- int SpaceAfter; // space after the paragraph - twips
- int SpaceBetween; // space between the paragraph lines
- int AuxId; // id for external use
- #if defined(WIN32)
- BYTE reserved[24]; // reserved bytes
- #else
- BYTE reserved[20];
- #endif
- };
-
- struct StrRtf { // Rtf input file processing block
- FILE TERFAR *InStream; // stream if file is used
- BYTE huge *buf; // input buffer pointer if using buffer
- long BufLen; // length of the buffer, -1 if not known
- long BufIndex; // index of current character in the buffer
- BYTE OutBuf[MAX_WIDTH+1]; // output buffer
- int OutBufLen; // output buffer length
- BYTE text[MAX_WIDTH+1]; // temporary buffer to read text from file
- int TextLen; // length of the text in the 'text' buffer
- int TextIndex; // index if current BYTE in the 'text' buffer
- BYTE CurChar; // last character read
- BYTE stack[MAX_WIDTH+1]; // characters returned from previous operations
- int StackLen; // number of characters in the stack
- BYTE CurWord[MAX_WIDTH+1]; // current word
- int WordLen; // length of the current word
- BOOL GroupBegin; // TRUE if the group begins
- BOOL GroupEnd; // TRUE if the group ends
- BOOL IsControlWord; // TRUE if control word
- BOOL IgnoreText; // TRUE to ignore text if not understood
- BOOL SubEntry; // TRUE if subentry in an index entry
- BOOL eof; // end of file
- BOOL IgnoreCrLfInControlWord; // TRUE to ingore cr/lf in control word
- BYTE param[MAX_WIDTH/3]; // rtf control word parameter
- long IntParam; // rtf control word parameter in integer numeric format
- double DoubleParam; // rtf control word parameter in double numeric format
- int GroupLevel; // group nesting level
- struct StrRtfGroup far *group; // rtf group table pointer
- struct StrRtfFont far *font; // rtf font table pointer
- struct StrRtfColor far *color; // rtf color table pointer
- int TotalColors; // total colors in the color table
- int InitialCell; // value of the initial cell
- int InitialParaFID; // initial paraframe id
-
- // picture transfer information
- HMETAFILE hMeta; // handle to the metafile
- int PictWidth; // width of the picture in twips
- int PictHeight; // height of the picture in twips
-
- // current section properties
- struct StrSect sect; // current section properties
-
- long FirstLine; // first line where the text is inserted
-
- long FilePos; // current file position
- };
-
- struct StrRtfFont { // font table in an rtf file
- BYTE family[32]; // font family
- BYTE name[32]; // font name
- };
-
- struct StrRtfColor { // color table in an rtf file
- COLORREF color; // color
- };
-
- struct StrRtfGroup { // RTF group properties
- struct StrRtf far *rtf; // pointer to the rtf structure
-
- // character properties
- int DefFont; // default font index into font table
- BYTE FontFamily[31]; // font family
- BYTE TypeFace[31]; // font typeface
- int PointSize2; // double point size of the font
- COLORREF TextColor; // rtf text color
- COLORREF TextBkColor; // rtf background text color
- UINT style; // character style
- int FieldId; // field id
-
- // paragraph properties
- int LeftIndent; // left indentation in twips
- int RightIndent; // Right indentation in twips
- int FirstIndent; // left indentation of the first line in twips
- UINT flags; // includes such flags as double spacing,centering, right justify etc
- struct StrTab tab; // tap position record
- int CurTabType; // TAB_LEFT or TAB_RIGHT
- UINT ParShading; // paragraph shading
- int SpaceBefore; // space before paragraph
- int SpaceAfter; // space after paragraph
- int SpaceBetween; // space between paragraph lines
-
- // border information
- int BorderType; // current border type
- int BorderWidth[MAX_BORDERS]; // border width for each type
- int BorderMargin; // space between text and border
- int CellShading; // cell shading percent 0 to 100
-
- // paragraph frame information
- struct StrRtfParaFrameInfo ParaFrameInfo;
- UINT FrmFlags; // temporary frame flags
-
- // control information
- BYTE ControlWord[MAX_WIDTH+1]; // control word for the group
- BOOL IgnoreText; // TRUE to ingore any text in this group
- int ControlCount; // number of control words in the group
- };
-
- struct StrRtfPict { // RTF picture properties
- int type; // PICT_METAFILE or PICT_DIBITMAP
- HMETAFILE hMeta; // metafile handle if a metafile
- HGLOBAL hInfo; // DI bitmap information block
- HGLOBAL hImage; // DI bitmap image block
- int bmHeight; // picture height in pixels or yExt
- int bmWidth; // picture width in pixels or xExt
- int height; // picture height in twips
- int width; // picture width in twips
- int ScaleX; // horrizontal scaling for display
- int ScaleY; // vertical scaling for display
- long InfoSize; // picture information size
- long ImageSize; // image size of the picture
- int align; // picture alignement ALIGN_BOT, ALIGN_TOP, ALIGN_MIDDLE
- };
-
- struct StrRtfObject { // RTF object properties
- int ObjectType; // object type OBJ_NONE, OBJ_EMBED, OBJ_LINK
- HGLOBAL hObject; // object data handle
- DWORD ObjectSize; // storage size of the object data
- int pict; // picture index
- };
-
- struct StrRtfOut { // Rtf output file processing block
- int output; // rtr output type: RTF_FILE,RTF_BUF,RTF_CB
- FILE TERFAR *OutStream; // stream if file is used
- HGLOBAL hBuf; // output buffer handle if using buffer output
- BYTE huge *buf; // output buffer pointer if using buffer
- long BufLen; // allcated length of buffer
- long BufIndex; // index of next character in the buffer
- BYTE text[MAX_WIDTH+1]; // temporary buffer to write text
- int TextLen; // length of the text in the 'text' buffer
- BOOL SpacePending; // TRUE if space needs to be written out after the last control
- BOOL WritingControl; // TRUE when writing a control word
- struct StrRtfColor far *color; // rtf color table pointer
- int TotalColors; // total colors in the color table
- int GroupLevel;
- };
-
-
- #if !defined(INC_OLE1) // OLE2 specific structure
- struct StrClientSite { // client site
- IOleClientSite site; // client site
- ULONG count; // use count
- PTERWND w; // window data pointer
- int obj; // object id in the object table
- LPSTORAGE pObjStg; // object storage
- LPADVISESINK pObjAdvise; // object advise sink
- DWORD ConnectToken; // token used to call unadvise
- };
-
- typedef struct StrClientSite far *LPSTRCLIENTSITE;
-
- struct StrAdviseSink { // advise sink interface data
- IAdviseSink advise; // client site
- ULONG count; // use count
- PTERWND w; // window data pointer
- int obj; // object id in the object table
- LPSTORAGE pObjStg; // object storage
- LPOLECLIENTSITE pObjSite; // client site interface
- };
- typedef struct StrAdviseSink far *LPSTRADVISESINK;
- #endif
-
- /*******************************************************************************
- Function Prototypes
- ********************************************************************************/
- #include "ter_prot.h"
-