PAIGE.H

Go to the documentation of this file.
00001 
00002 /*  $Id: PAIGE.H 1194 2006-04-05 21:30:52Z karstenw $    */
00003 
00004 /* Paige Technology API file, copyright 1993-1995 by DataPak Software, Inc.
00005     Stronger typing added by T. R. Shaw, OITC, Inc.
00006     
00007 "Paige" is a code name for DataPak's text processing technology. It is
00008 illegal to remove this notice.
00009 
00010 CROSS PLATFORM INSTRUCTIONS:
00011 
00012 (1) Modify the file "CPUDefs.h" to satisfy the various compiler
00013 demands of your platform.
00014 
00015 (2) To add/change machine-specific code, you need to replace
00016 "machine.c" and "mmemory.c" as these files contain every piece of
00017 code necessary to run on a specific platform.
00018 
00019 All other code (hopefully) is universal and does not need to be changed. */
00020 
00021 /* Updated by TR Shaw, OITC, Inc. 3 Jan 1994 for compatible linkages */
00022 /* Updated by TR Shaw/J Smith, OITC, Inc. 9 JUL 1995 for Window 32, NT, 95 & RTF. */
00023 /* Updated by Gar to merge 1.2 fixes with TR Shaw enancements */
00024 
00025 #ifndef PAIGE_H
00026 #define PAIGE_H
00027 
00028 #include "pgMemMgr.h"
00029 #include "Userdefs.h"
00030 
00031 /* Fixed tab stop array size in paragraph info records: */
00032 
00033 #define TAB_ARRAY_SIZE  32
00034 
00035 /* Possible bits passed to pgNew: */
00036 
00037 #define NO_WRAP_BIT         0x00000001  /* Wraps only on <CR> or <LF> */
00038 #define NO_LF_BIT           0x00000002  /* <LF> char ignored */
00039 #define NO_DEFAULT_LEADING  0x00000004  /* Do not add default leading from OS font info */
00040 #define NO_EDIT_BIT         0x00000008  /* No editing (display only) */
00041 #define EXTERNAL_SCROLL_BIT 0x00000010  /* Scrolling is controlled by application */
00042 #define COUNT_LINES_BIT     0x00000020  /* Keep track of # of lines */
00043 #define NO_HIDDEN_TEXT_BIT  0x00000040  /* Do not display hidden text */
00044 #define SHOW_INVIS_CHAR_BIT 0x00000080  /* Show invisible character(s) active */
00045 #define EX_DIMENSION_BIT    0x00000100  /* Exclude area is included as width/height */
00046 #define NO_WINDOW_VIS_BIT   0x00000200  /* Do not respect window's clipped area */
00047 #define TEXT_DIRTY_BIT      0x00000400  /* Text format changed but not re-drawn */
00048 #define SMART_QUOTES_BIT    0x00000800  /* Do "smart quotes" */
00049 #define NO_SMART_CUT_BIT    0x00001000  /* Do not do "smart cut/paste" */
00050 #define NO_SOFT_HYPHEN_BIT  0x00002000  /* Ignore soft hyphens */
00051 #define NO_DUAL_CARET_BIT   0x00004000  /* Do not show dual carets */
00052 
00053 /* Additional attributes used internally by Paige: */
00054 
00055 #define NO_LINE_SAVE_BIT    0x00008000  /* Don't save point_start run on Write */
00056 #define DEACT_BIT           0x00010000  /* Paige is deactivated (won't hilite) */
00057 #define PERM_DEACT_BIT      0x00020000  /* App wants no highlighting */
00058 #define CARET_BIT           0x00040000  /* Caret is currently showing */
00059 #define SCALE_VIS_BIT       0x00080000  /* Include vis area when scaling - MUST be set if scrolling by setting the origin (without changing the window's origin)*/
00060 #define BITMAP_ERASE_BIT    0x00100000  /* Erase screen with offscreen bits */
00061 #define PRINT_MODE_BIT      0x00200000  /* pg_ref is "printing" */
00062 #define MERGE_MODE_BIT      0x00400000  /* pg_ref is in "merge" mode */
00063 #define NO_DEVICE_BIT       0x00800000  /* pg_ref has been made with no device */
00064 #define DOC_TERMINATED_BIT  0x01000000  /* Doc ends with paragraph break ("CR") */
00065 #define DOC_BOUNDS_DIRTY    0x02000000  /* Document bounding rect is not valid */
00066 #define CARET_CREATED_BIT   0x08000000  /* Windows version, caret is alive */
00067 #define TABS_ARE_WIDTHS_BIT 0x10000000  /* TAB chars are just default tab width */
00068 #define INIT_IO_BIT         0x20000000  /* pgReadDoc in progress when this bit set */
00069 #define LINE_EDITOR_BIT     0x40000000  /* Document becomes basic line editor if set */
00070 #define INVALID_CURSOR_BIT  0x80000000  /* Cursor is not valid */
00071 
00072 /* Additional Paige attributes used to save various information in flags2: */
00073 
00074 #define HAS_TITLE_PAGE      0x00000001  /* Document has title page */
00075 #define PAGE_AFTER_TITLE    0x00000002  /* Page after title page is special (ie back of page) */
00076 #define LEFT_EVEN_PAGES     0x00000004  /* Left hand pages are even (Paige page number) */
00077 #define RIGHT_EVEN_PAGES    0x00000008  /* Right hand pages are even (Paige page number) */
00078 #define HIDE_IMPORT_DELETE  0x00000010  /* Deletions will be automatically hidden on import (RTF) */
00079 #define DONT_HANGING_INDENT 0x00000020  /* Don't add automatic tab stop for hanging indent (RTF) */
00080 #define WRAP_TRAILING_SPACE 0x00000040  /* Wrap trailing spaces onto the next line (RTF) */
00081 #define IMAGE_COLORS_BLACK  0x00000080  /* Image all colors as black (RTF) */
00082 #define STYLESHEET_CHANGE   0x00000100  /* Set while stylesheets being added or changed */
00083 #define KEEP_READ_STYLES    0x00000200  /* Keep existing style_infos for pgReadDoc() */
00084 #define KEEP_READ_PARS      0x00000400  /* Keep existing par_infos for pgReadDoc() */
00085 #define KEEP_READ_FONTS     0x00000800  /* Keep existing font_infos for pgReadDoc() */
00086 #define NO_STYLE_CLEANUP    0x00001000  /* Do not delete style_infos during cleanup (** internal use **) */
00087 #define CHECK_PAGE_OVERFLOW 0x00002000  /* Constantly check text overflow bottom of page area */
00088 #define UNICODE_SAVED       0x00004000  /* Text is saved as unicode */
00089 #define UNICODE_TEXT        0x00008000  /* Text is active as unicode */
00090 #define BLINK_ON_DEACTIVE   0x00010000  /* Text is will blink even on deactive paige docs */
00091 #define IDLE_VIA_GBL_IDLE   0x00020000  /* pgIdles are handled via pgGlobalIdle */
00092 #define MOUSE_DRAG_STATE    0x00040000  /* Mouse is in between mouse_down and mouse_up */
00093 #define NO_HAUTOSCROLL      0x00080000  /* Do not autoscroll horizontally */
00094 #define NO_VAUTOSCROLL      0x00100000  /* Do not autoscroll vertically */
00095 #define APPLY_ALL_PAR_INFOS 0x00200000  /* Apply every par_info in pgCopy and pgPaste (used by Undo) */
00096 #define PAR_EXCLUSION_CHANGE 0x00400000 /* Paragraph exclusion changed */
00097 
00098 
00099 #ifdef UNICODE
00100 #define INITIAL_TEXT_FLAGS  UNICODE_TEXT
00101 #define TEXT_FILE_FLAGS     UNICODE_SAVED
00102 #define BOM_HEADER          1
00103 #else
00104 #define INITIAL_TEXT_FLAGS  0
00105 #define TEXT_FILE_FLAGS     0
00106 #define BOM_HEADER          0
00107 #define pgInsertBytes   pgInsert
00108 #endif
00109 
00110 /* "Shared structures" flags (version 2.0): */
00111 
00112 #define SHARED_FORMATS      0x00000001  /* Style, font and par infos shared */
00113 #define SHARED_GRAF_DEVICE  0x00000002  /* Common graphics context */
00114 #define SHARED_VIS_AREA     0x00000004  /* Shared vis area */
00115 #define SHARED_PAGE_AREA    0x00000008  /* Shared page area */
00116 #define SHARED_EXCLUDE_AREA 0x00000010  /* Shared exclusion area */
00117 
00118 /* Paige types, pg_type */
00119 
00120 #define MAIN_DOCUMENT       0           // The main document (RTF enhancement) 
00121 
00122 /* Values returned from char_info and/or pgCharType: */
00123 
00124 #define BLANK_BIT           0x00000001  /* Character is blank */
00125 #define WORD_BREAK_BIT      0x00000002  /* Word breaking char */
00126 #define WORD_SEL_BIT        0x00000004  /* Word select char */
00127 #define SOFT_HYPHEN_BIT     0x00000008  /* Soft hyphen char */
00128 #define INCLUDE_BREAK_BIT   0x00000010  /* Word break but include with word */
00129 #define INCLUDE_SEL_BIT     0x00000020  /* Select break but include with word */
00130 #define CTL_BIT             0x00000040  /* Char is a control code */
00131 #define INVIS_ACTION_BIT    0x00000080  /* Char is not a display char, but arrow, bs, etc. */
00132 #define PAR_SEL_BIT         0x00000100  /* Char breaks a paragraph */
00133 #define LINE_SEL_BIT        0x00000200  /* Char breaks a line (soft CR) */
00134 #define TAB_BIT             0x00000400  /* Char performs a TAB */
00135 #define FIRST_HALF_BIT      0x00000800  /* 1st half of a multi-byte char */
00136 #define LAST_HALF_BIT       0x00001000  /* Last half of a multi-byte char */
00137 #define MIDDLE_CHAR_BIT     0x00002000  /* Middle of a multi-byte char run */
00138 #define CONTAINER_BRK_BIT   0x00004000  /* Break-container bit */
00139 #define PAGE_BRK_BIT        0x00008000  /* Break-repeating-shape bit */
00140 #define NON_BREAKAFTER_BIT  0x00010000  /* Char must stay with char(s) after it */
00141 #define NON_BREAKBEFORE_BIT 0x00020000  /* Char must stay with char(s) before it */
00142 #define NUMBER_BIT          0x00040000  /* Char is numeric */
00143 #define DECIMAL_CHAR_BIT    0x00080000  /* Char is decimal (for decimal tab)  */
00144 #define UPPER_CASE_BIT      0x00100000  /* Char is UPPER CASE */
00145 #define LOWER_CASE_BIT      0x00200000  /* Char is lower case */
00146 #define SYMBOL_BIT          0x00400000  /* Char is a symbol */
00147 #define EUROPEAN_BIT        0x00800000  /* Char is ASCII-European */
00148 #define NON_ROMAN_BIT       0x01000000  /* Char is not Roman script */
00149 #define NON_TEXT_BIT        0x02000000  /* Char is not really text */
00150 #define FLAT_QUOTE_BIT      0x04000000  /* Char is a "flat" quote */
00151 #define SINGLE_QUOTE_BIT    0x08000000  /* Quote char is single quote */
00152 #define LEFT_QUOTE_BIT      0x10000000  /* Char is a left quote */
00153 #define RIGHT_QUOTE_BIT     0x20000000  /* Char is a right quote */
00154 #define PUNCT_NORMAL_BIT    0x40000000  /* Char is normal punctuation */
00155 #define OTHER_PUNCT_BIT     0x80000000  /* Char is other punctuation in multibyte */
00156 
00157 /* Convenient char_info macro for any quote char in globals: */
00158 
00159 #define QUOTE_BITS (FLAT_QUOTE_BIT | SINGLE_QUOTE_BIT | LEFT_QUOTE_BIT | RIGHT_QUOTE_BIT)
00160 #define NON_MULTIBYTE_BITS (~(FIRST_HALF_BIT | LAST_HALF_BIT))
00161 #define WORDBREAK_PROC_BITS (WORD_BREAK_BIT | WORD_SEL_BIT | NON_BREAKAFTER_BIT | NON_BREAKBEFORE_BIT)
00162 #define PG_SUBSET_BIT (INVIS_ACTION_BIT | CTL_BIT)
00163 
00164 /* Possible bits passed to pgDragSelect: */
00165 
00166 #define EXTEND_MOD_BIT      0x0001  /* Extend the selection */
00167 #define WORD_MOD_BIT        0x0002  /* Select whole words only */
00168 #define PAR_MOD_BIT         0x0004  /* Select whole paragraphs only */
00169 #define LINE_MOD_BIT        0x0008  /* Highlight whole lines */
00170 #define VERTICAL_MOD_BIT    0x0010  /* Allow vertical selection */
00171 #define DIS_MOD_BIT         0x0020  /* Enable discontiguous selection */
00172 #define STYLE_MOD_BIT       0x0040  /* Select whole style range */
00173 #define WORD_CTL_MOD_BIT    0x0080  /* Select "words" delineated with controls */
00174 #define NO_HALF_CHARS_BIT   0x0100  /* Click does not go left/right on half chars */
00175 #define CONTROL_MOD_BIT     0x0200  /* Word advance for arrows, Home-End to doc top and bottom */
00176 #define OPTION_MOD_BIT      0x0400  /* Option key held down */
00177 #define ALT_MOD_BIT         0x0800  /* Alt key (Windows) or command key (Mac) */
00178 #define PIVOT_EXTEND_BIT    0x4000  /* Extend-selection keeps anchor point */
00179 
00180 /* Possible bits within a point start: */
00181 
00182 #define LINE_BREAK_BIT      0x8000  /* Line ends here */
00183 #define PAR_BREAK_BIT       0x4000  /* Paragraph ends here */
00184 #define SOFT_PAR_BIT        0x2000  /* Soft CR ends line */
00185 #define RIGHT_DIRECTION_BIT 0x1000  /* Text in this start is right to left */
00186 #define LINE_GOOD_BIT       0x0800  /* This line requires no recalc */
00187 #define NEW_LINE_BIT        0x0400  /* New line starts here */
00188 #define NEW_PAR_BIT         0x0200  /* New paragraph starts here */
00189 #define WORD_HYPHEN_BIT     0x0100  /* Draw a hyphen after this text */
00190 #define TAB_BREAK_BIT       0x0080  /* Tab char terminates this line */
00191 #define HAS_WORDS_BIT       0x0040  /* One or more word separaters exist */
00192 #define CUSTOM_CHARS_BIT    0x0020  /* Style(s) are known only to app
00193                                        (so don't play games with display) */
00194 #define SOFT_BREAK_BIT      0x0010  /* Start breaks on soft hyphen */
00195 #define BREAK_CONTAINER_BIT 0x0008  /* Line breaks for next container */
00196 #define BREAK_PAGE_BIT      0x0004  /* Line broke for whole repeater shape */
00197 #define LINE_HIDDEN_BIT     0x0002  /* Line is invisible (hidden text) */
00198 #define NO_LINEFEED_BIT     0x0001  /* Line does not advance vertically */
00199 
00200 #define TERMINATOR_BITS     0xFFFF  /* Flagged only as terminator record */
00201 
00202 #define HARD_BREAK_BITS (PAR_BREAK_BIT | SOFT_PAR_BIT | BREAK_CONTAINER_BIT | BREAK_PAGE_BIT)
00203 
00204 
00205 /* Possible result bits returned from pgPtInView:  */
00206 
00207 #define WITHIN_VIS_AREA     0x0001  /* Point is within vis region of Paige */
00208 #define WITHIN_WRAP_AREA    0x0002  /* Point is within wrap shape of Paige */
00209 #define WITHIN_EXCLUDE_AREA 0x0004  /* Point is within exclusion shape of Paige */
00210 #define WITHIN_TEXT         0x0008  /* Point is in text area  */
00211 #define WITHIN_REPEAT_AREA  0x0010  /* Point is in repeating gap of page area */
00212 #define WITHIN_LEFT_AREA    0x0020  /* Point is left of document */
00213 #define WITHIN_RIGHT_AREA   0x0040  /* Point is right of document */
00214 #define WITHIN_TOP_AREA     0x0080  /* Point is above top of document */
00215 #define WITHIN_BOTTOM_AREA  0x0100  /* Point is below bottom of document */
00216 
00217 
00218 /* Possible value(s) set in class_bits for style_info: */
00219 
00220 #define CANNOT_HILITE_BIT   0x00000001  /* Do not include highlight region in this style */
00221 #define CANNOT_BREAK        0x00000002  /* Non-breaking style (words can't break) */
00222 #define STYLE_IS_CONTROL    0x00000004  /* Style is "control" type item */
00223 #define GROUP_CHARS_BIT     0x00000008  /* All char(s) in style considered one word */
00224 #define STYLE_MERGED_BIT    0x00000010  /* Style has been merged in "merged mode" */
00225 #define STYLE_IS_CUSTOM     0x00000020  /* Style is known only to app */
00226 #define HILITE_RESTRICT_BIT 0x00000040  /* Cannot select outside of of style */
00227 #define CANNOT_WRAP_BIT     0x00000080  /* Cannot wrap bit (used for tables, etc.) */
00228 #define IS_NOT_TEXT_BIT     0x00000100  /* Data is not text at all */
00229 #define REQUIRES_COPY_BIT   0x00000200  /* Text copy requires copy_proc callback */
00230 #define NO_SMART_DRAW_BIT   0x00000400  /* Tells PAIGE not to second-guess line drawing */
00231 #define ACTIVATE_ENABLE_BIT 0x00000800  /* Causes activate_proc to be called */
00232 #define CANT_UNDERLINE_BIT  0x00001000  /* The OS does not support underline */
00233 #define CANT_TRANS_BIT      0x00002000  /* Text cant transliterate upper/lower etc. */
00234 #define RIGHTLEFT_BIT       0x00004000  /* Text direction is right to left */
00235 #define VERTICAL_TEXT_BIT   0x00008000  /* Vertical text */
00236 #define TEXT_LOCKED         0x00010000  /* Text can be copied but not changed */
00237 #define NO_EXTRA_SUPER_SUB  0x00020000  /* Don't add extra space to line height for showing raised(superscript)/lowered(subscript) characters (RTF) */
00238 #define EMBED_SUBSET_BIT    0x00040000  /* Style is embed_ref pg subset */
00239 #define NO_SAVEDOC_BIT      0x00080000  /* Do not save this style_info */
00240 #define EMBED_INITED_BIT    0x00100000  /* Embed ref style and has been initialized. */
00241 #define EMBED_READ_BIT      0x00200000  /* Used by EmbedReadHandler */
00242 
00243 #define NON_TEXT_BITS (STYLE_IS_CUSTOM | IS_NOT_TEXT_BIT)
00244 
00245 /* Version 1.2 special tab-stop flags (embedded in "type"). */
00246 
00247 #define TAB_TEXT_HIDDEN_BIT 0x4000  /* Text within tab mark is hidden */
00248 #define TAB_TRUNCATES_BIT   0x2000  /* Text cannot go beyond next tab */
00249 #define TAB_TYPE_MASK       0x0FFF  /* Mask for the tab_stop.type */
00250 
00251 
00252 /* pgPtToStyleInfo() conversion_info bits: */
00253 
00254 #define NO_HALFCHARS        0x0001  /* Whole char only */
00255 #define NO_BYTE_ALIGN       0x0002  /* No multibyte alignment (return style AS-IS) */
00256 
00257 /* Some default font codes: */
00258 
00259 #define WINDOW_FONT         0       /* Font used in windows, etc. */
00260 #define DEF_FIXED_FONT      1       /* Default fixed-spaced font */
00261 #define DEF_PROP_FONT       2       /* Default variable spaced font */
00262 #define TIMES_ROMAN         3       /* Times font */
00263 #define HELVETICA_FONT      4       /* Helvetica font */
00264 #define GOTHIC_FONT         5       /* Gothic font */
00265 #define COURIER_FONT        6       /* Courier font */
00266 #define SYMBOL_FONT         7       /* Symbol font */
00267 
00268 
00269 /* Font environment settings: */
00270 
00271 #define NAME_IS_CSTR        1       /* Font name is a cstring */
00272 #define FONT_NOT_AVAIL      2       /* Font name doesn't exist in system */
00273 #define FONT_GOOD           4       /* Font name will NOT be checked if this bit set */
00274 #define FONT_BEST_GUESS     8       /* Font has been changed to best-guess equiv. */
00275 #define FONT_PG_DEFAULT     0x10    /* Default font was used as substitute */
00276 #define FONT_USES_ALTERNATE 0x20    /* The alternate font name has been selected */
00277 #define NAME_ALT_IS_CSTR    0x40    /* Font alternate name is a cstring */
00278 #define FONT_NOT_SAVED      0x80    /* Font is not saved in pgSaveDoc() */
00279 #define FONTS_TEXT_UNKNOWN  0x100   /* Font's text may not be rendered correctly as it is untranslatable from original platform (not this one) */
00280 
00281 /* Misc. #defines */
00282 
00283 #define SIMPLE_SHAPE_QTY    2       /* Number of rects for a simple shape */
00284 #define CURRENT_POSITION    -1      /* Insert at current positions */
00285 #define TAB_BOUNDS_RELATIVE -1      /* Tab base is relative to wrap bound's left */
00286 #define TAB_WRAP_RELATIVE   -2      /* Tab base is relative to current wrap edge */
00287 #define SET_MASK_BITS       -1      /* Mask word for change masks */
00288 #define PG_FUTURE           8       /* Number of long's reserved for future */
00289 #define PLAIN_SCALE         1       /* Widths are scaled directly in measure proc */
00290 #define COMPENSATE_SCALE    2       /* Errors in scaling are compensated in measure proc */
00291 #define XOR_SUPERIMPOSE     -1      /* Superimpose style XORs if style element is this. */
00292 #define REVISION_MASK       0xF000  /* revision_var "deleted"/"revised" flag mask. (RTF) */
00293 #define AUTHOR_MASK         0x0FFF  /* revision_var author index mask. (RTF) */
00294 #define TEXT_DELETED        0x1000  /* revision_var "deleted" text flag. (RTF) */
00295 #define TEXT_REVISED        0x2000  /* revision_var "revised" text flag. (RTF) */
00296 
00297 
00298 /* CharInfo / pgCharType convenient mask_bits: */
00299 
00300 #define SHORT_FORM_INFO     0x0000FFFF  /* All short form items */
00301 #define LONG_FORM_INFO      (EUROPEAN_BIT | SYMBOL_BIT | PUNCT_NORMAL_BIT | OTHER_PUNCT_BIT | NUMBER_BIT | UPPER_CASE_BIT)
00302 
00303 #define ALL_INFO_BITS       0xFFFFFFFF  /* All bits */
00304 #define MULTICHAR_BITS      (FIRST_HALF_BIT | LAST_HALF_BIT | MIDDLE_CHAR_BIT)  /* All multi-char bits */
00305 
00306 /* text_block flags */
00307 
00308 #define NEEDS_CALC          0x0001      /* One or more lines need re-calc */
00309 #define NEEDS_PAGINATE      0x0002      /* Needs re-paginatation */
00310 #define SOME_LINES_GOOD     0x0004      /* One or more lines are probably OK */
00311 #define SOME_LINES_BAD      0x0008      /* Flags means we already tagged bad lines */
00312 #define BROKE_BLOCK         0x0010      /* Terminator char deleted */
00313 #define ALL_TEXT_HIDDEN     0x0020      /* All text in block is hidden! */
00314 #define BOUNDS_GUESSED      0x0040      /* Best guess only has been made for bounds rect */
00315 #define LINES_PURGED        0x0080      /* Lines purged, but block OK */
00316 #define BELOW_CONTAINERS    0x0100      /* Lines below last container (so they are fake) */
00317 #define NO_CR_BREAK         0x0400      /* Does not break on a CR */
00318 #define SWITCHED_DIRECTIONS 0x0800      /* System text direction has switched! */
00319 #define LINES_NOT_HORIZONTAL 0x1000     /* Point starts are not necessarily horizontal */
00320 #define JUMPED_4_EXCLUSIONS 0x2000      /* One or more lines hop across exclusions */
00321 #define NEEDS_PARNUMS       0x4000      /* Requires paragraph "line" computation (line editor) */
00322 
00323 #define NULL_RUN            0xFFFF      /* Void "style item" for runs */
00324 #define DEFAULT_STYLE_ITEM  0x0000      /* Default style item index */
00325 
00326 /* font->machine_var[n] indexes:  */
00327 
00328 #define PG_OUT_PRECISION    0           /* font's out precision */
00329 #define PG_CLIP_PRECISION   1           /* font's clip precision */
00330 #define PG_QUALITY          2           /* font's quality */
00331 #define PG_CHARSET          3           /* font's character set */
00332 #define PG_PREV_LANG        4           /* font's previous language */
00333 #define PG_LANGINFO         5           /* language information bits */
00334 
00335 /* Verbs for pgInsert: */
00336 
00337 enum {
00338     key_insert_mode,                /* Typing insertion */
00339     key_buffer_mode,                /* Typing-buffer insertion */
00340     data_insert_mode,               /* Raw data insertion */
00341     recursive_insert_mode           /* Inserting buffered keys recursively */
00342 };
00343 
00344 /* Draw verbs (affects display or refresh): */
00345 
00346 enum {
00347     draw_none,                      /* Do not draw at all */
00348     best_way,                       /* Use most effecient method(s) */
00349     direct_copy,                    /* Directly to screen, overwrite */
00350     direct_or,                      /* Directly to screen, "OR" */
00351     direct_xor,                     /* Directly to screen, "XOR" */
00352     bits_copy,                      /* Copy offscreen */
00353     bits_or,                        /* Copy offscreen in "OR" mode */
00354     bits_xor,                       /* Copy offscreen in "XOR" mode */
00355     bits_emulate_copy,              /* Offscreen emulation, copy */
00356     bits_emulate_or,                /* Offscreen emulation, or */
00357     bits_emulate_xor,               /* Offscreen emulation, xor */
00358     grayish_bits_copy,              /* Gray-disabled bits copy */
00359     grayish_or                      /* In gray-disabled */
00360 };
00361 
00362 
00363 /* "Mouse" tracking verbs: */
00364 
00365 enum {
00366     mouse_down,                     /* First time click */
00367     mouse_moved,                    /* Mouse moved */
00368     mouse_up                        /* Mouse up */
00369 };
00370 
00371 /* Caret position setting verbs: */
00372 
00373 enum {
00374     home_caret,
00375     doc_bottom_caret,
00376     begin_line_caret,
00377     end_line_caret,
00378     next_word_caret,
00379     previous_word_caret
00380 };
00381 
00382 #define EXTEND_CARET_FLAG   0x8000  /* Used with caret verbs above to extend selection */
00383 #define CARET_VERB_MASK     0x0FFF  /* Used to clear bit(s) to get caret verb */
00384 
00385 /* Style index definitions: */
00386 
00387 enum {
00388     bold_var,
00389     italic_var,
00390     underline_var,
00391     outline_var,
00392     shadow_var,
00393     condense_var,
00394     extend_var,
00395     dbl_underline_var,
00396     word_underline_var,
00397     dotted_underline_var,
00398     hidden_text_var,
00399     strikeout_var,
00400     superscript_var,
00401     subscript_var,
00402     rotation_var,
00403     all_caps_var,
00404     all_lower_var,
00405     small_caps_var,
00406     overline_var,
00407     boxed_var,
00408     relative_point_var,
00409     super_impose_var,
00410     revision_var,           // RTF
00411     nested_subset_var,      // For by DSI only, do not use
00412     blink_var,              // HTML
00413     dsi_custom_var = 27,    /* Used for DSI internally only */
00414     custom_var = 28
00415 };
00416 
00417 /* The graf_device verb values: */
00418 
00419 enum {
00420     set_pg_device,
00421     unset_pg_device
00422 };
00423 
00424 
00425 #define SMALL_CAPS_DEFAULT  -1
00426 
00427 /* Style variations (when defines as "bits"): */
00428 
00429 #define X_PLAIN_TEXT                    0x00000000
00430 #define X_BOLD_BIT                      0x00000001
00431 #define X_ITALIC_BIT                    0x00000002
00432 #define X_UNDERLINE_BIT                 0x00000004
00433 #define X_OUTLINE_BIT                   0x00000008
00434 #define X_SHADOW_BIT                    0x00000010
00435 #define X_CONDENSE_BIT                  0x00000020
00436 #define X_EXTEND_BIT                    0x00000040
00437 #define X_DBL_UNDERLINE_BIT             0x00000080
00438 #define X_WORD_UNDERLINE_BIT            0x00000100
00439 #define X_DOTTED_UNDERLINE_BIT          0x00000200
00440 #define X_HIDDEN_TEXT_BIT               0x00000400
00441 #define X_STRIKEOUT_BIT                 0x00000800
00442 #define X_SUPERSCRIPT_BIT               0x00001000
00443 #define X_SUBSCRIPT_BIT                 0x00002000
00444 #define X_ROTATION_BIT                  0x00004000
00445 #define X_ALL_CAPS_BIT                  0x00008000
00446 #define X_ALL_LOWER_BIT                 0x00010000
00447 #define X_SMALL_CAPS_BIT                0x00020000
00448 #define X_OVERLINE_BIT                  0x00040000
00449 #define X_BOXED_BIT                     0x00080000
00450 #define X_RELATIVE_POINT_BIT            0x00100000
00451 #define X_SUPERIMPOSE_BIT               0x00200000
00452 #define X_ALL_STYLES                    0xFFFFFFFF
00453 
00454 /* Super/subscript action verbs: */
00455 
00456 enum {
00457     baseline_relative,          /* Draw from line's baseline */
00458     percent_of_style            /* Draw relative to percent of baseline */
00459 };
00460 
00461 
00462 /* Justification modes */
00463 
00464 enum {
00465     justify_left,               /* Left justify */
00466     justify_center,             /* Center justify */
00467     justify_right,              /* Right justify */
00468     justify_full,               /* Full justify */
00469     force_left,                 /* Force left (regardless of writing dir.) */
00470     force_right                 /* Force right (regardless of writing dir.) */
00471 };
00472 
00473 
00474 /* Writing direction modes */
00475 
00476 enum {
00477     right_left_direction = -1,  /* Right-to-left */
00478     system_direction,           /* Direction defined by OS */
00479     left_right_direction,       /* Left-to-right */
00480     up_down_left_direction,     /* Vertical, from top-left */
00481     up_down_right_direction     /* Vertical, from top-right */
00482 };
00483 
00484 
00485 /* Tab type definitions: */
00486 
00487 enum {
00488     no_tab,                     /* none (used to delete and/or report "none") */
00489     left_tab,                   /* Left tab */
00490     center_tab,                 /* Center tab */
00491     right_tab,                  /* Right tab */
00492     decimal_tab                 /* Decimal tab */
00493 };
00494 
00495 
00496 
00497 /* Action verbs for "get data": */
00498 
00499 enum {
00500     all_data,                   /* Return all data */
00501     all_text_chars,             /* All text that is writing script */
00502     all_roman,                  /* All Roman ASCII chars */
00503     all_visible_data,           /* Return all visible data */
00504     all_visible_text_chars,     /* All visible text that is writing script */
00505     all_visible_roman           /* All visible Roman ASCII chars */
00506 };
00507 
00508 
00509 
00510 /* Undo action verbs: */
00511 
00512 enum {
00513     undo_none,                  /* Null undo ("can't undo") */
00514     undo_typing,                /* Undo pg_char key insertion (except backspace) */
00515     undo_backspace,             /* Undo backspace key */
00516     undo_delete,                /* Undo clear/cut/delete */
00517     undo_fwd_delete,            /* Undo forward delete */
00518     undo_paste,                 /* Undo paste/insert */
00519     undo_format,                /* Undo text style or par format or font */
00520     undo_insert,                /* Undo some other form of insertion */
00521     undo_page_change,           /* Undo page area change */
00522     undo_vis_change,            /* Undo vis area change */
00523     undo_exclude_change,        /* Undo exclusion area change */
00524     undo_doc_info,              /* Undo setDocInfo change */
00525     undo_embed_insert,          /* Undo embed_rec insertion */
00526     undo_app_insert             /* Undo insert with position parameter */
00527 };
00528 
00529 #define UNDO_CUSTOM (undo_doc_info + 128)
00530 
00531 /* Action verb for enhance_undo_proc (used for custom undo's): */
00532 
00533 enum {
00534     enhance_prepared_undo,
00535     enhance_performed_undo
00536 };
00537 
00538 
00539 /* Scroll action verbs: */
00540 
00541 enum {
00542     scroll_none,                /* Do not scroll */
00543     scroll_unit,                /* Scroll one unit */
00544     scroll_page,                /* Scroll one page unit */
00545     scroll_home,                /* Scroll to top */
00546     scroll_end                  /* Scroll to end */
00547 };
00548 
00549 
00550 /* Cursor state action verbs: */
00551 
00552 enum {
00553     debug_cursor = -1,          /* To debug cursor problems (debug mode only) */
00554     dont_draw_cursor,           /* Do nothing */
00555     toggle_cursor,              /* Toggle cursor based on timer */
00556     toggle_cursor_idle,         /* In between toggle_cursor time */
00557     show_cursor,                /* Show cursor */
00558     hide_cursor,                /* Hide cursor */
00559     deactivate_cursor,          /* Cursor is no longer active */
00560     activate_cursor,            /* Cursor is active */
00561     update_cursor,              /* Redraw cursor per current state */
00562     restore_cursor,             /* Turn cursor back on (mainly used in Windows) */
00563     compute_cursor              /* Just compute cursor pos in pg_rec->stable_caret */
00564 };
00565 
00566 
00567 /* Verbs for text measure function: */
00568 
00569 enum {
00570     measure_width_locs,
00571     measure_draw_locs,
00572     measure_textout
00573 };
00574 
00575 /* Verbs for enhancing containers hook: */
00576 
00577 enum {
00578     clip_container_verb,
00579     unclip_container_verb,
00580     erase_rect_verb,
00581     will_draw_verb,
00582     will_delete_verb
00583 };
00584 
00585 
00586 /* Verbs passed as "reason_verb" for dup_style_proc, delete_style_proc, etc.: */
00587 
00588 enum {
00589     prepare_undo_text_reason,
00590     prepare_undo_style_reason,
00591     prepare_undo_typing_reason,
00592     undo_delete_reason,
00593     undo_style_reason,
00594     copy_reason,
00595     paste_reason,
00596     for_next_insert_reason,
00597     new_stylesheet_reason,
00598     internal_clone_reason,
00599     not_used_reason,
00600     pgdispose_reason,
00601     disposeundo_reason,
00602     delete_text_reason,
00603     pg_new_reason
00604 };
00605 
00606 /* Verbs for "line glitter procs" call_verb: */
00607 
00608 enum {
00609     glitter_bitmap_draw,
00610     glitter_post_bitmap_draw,
00611     glitter_normal_draw
00612 };
00613 
00614 
00615 /* File handler key */
00616 
00617 typedef short pg_file_key, PG_FAR *pg_file_key_ptr;
00618 
00619 
00620 /* Default key handler verbs */
00621 
00622 enum {
00623     pg_eof_key = -2,            /* Logical end-of-file key */
00624     pg_signature = -1,          /* File signature (not a "real" key) */
00625     paige_key,                  /* Paige record info */
00626     text_block_key,             /* Text block record */
00627     text_key,                   /* Text bytes */
00628     line_key,                   /* Point_start info */
00629     style_run_key,              /* Style runs */
00630     par_run_key,                /* Paragraph runs */
00631     style_info_key,             /* Style_info records */
00632     par_info_key,               /* Par_info data */
00633     font_info_key,              /* Font_info records */
00634     vis_shape_key,              /* Paige's vis area */
00635     page_shape_key,             /* Paige's wrap area */
00636     exclude_shape_key,          /* Paige's exclude area */
00637     selections_key,             /* List of selections */
00638     extra_struct_key,           /* Extra stuff from app */
00639     applied_range_key,          /* Special applied range for copies */
00640     doc_info_key,               /* Document info */
00641     containers_key,             /* Container ref_cons key */
00642     exclusions_key,             /* Exclusion ref_cons key */
00643     aux_pg_key,                 /* A new pg_ref begins (nested in original) */
00644     globals_key,                /* Critical Paige global values */
00645     embedded_item_key,          /* Embedded text item (from pgEmbed module) */
00646     source_refcon_key,          /* for source code users */
00647     exception_key,              /* Error handler */
00648     named_styles_key,           /* Named styles */
00649     format_init_key,            /* Init style or font, etc. key */
00650     list_column_key,            /* For DSI listbox mode extension */
00651     par_exclusions_key,         /* Paragraph exclusion run */
00652     PLATFORM_SPECIFIC_KEY       /* Start if platform-specific keys */
00653 };
00654 
00655 /* Macintosh-specific keys (we discourage the use of these after version 1.1 --
00656 see notes on "pgGrafx" for portable graphic objects): */
00657 
00658 enum {
00659     mac_pict_key = PLATFORM_SPECIFIC_KEY,   /* Mac Pictures */
00660     mac_control_key,                        /* Mac Control */
00661     mac_sound,                              /* Sound record */
00662     mac_quicktime,                          /* QuickTime pic */
00663     mac_print_key,                          /* Mac print record */
00664     mac_rgb_key,                            /* RGBColor */
00665     mac_code_rsrc,                          /* Mac code resource */
00666     mac_quickdraw,                          /* Quickdraw object */
00667     mac_custom_object                       /* Custom object (code rsrc included */
00668 };
00669 
00670 /* Extended file key definitions: */
00671 
00672 enum {
00673     character_set_key = PLATFORM_SPECIFIC_KEY + 255,    /* Character set of doc */
00674     portable_font_key,                                  /* Font record (portable) */
00675     pg_picture_key,                                     /* PAIGE portable picture */
00676     ruler_format_key,                                   /* - reserved for Aurbach - */
00677     layout_object_key,                                  /* - reserved for Aurbach - */
00678     extension_key,                                      /* Extension Manager's key */   // TRS/OITC
00679     author_key,                                         /* Author references key */ // TRS/OITC
00680     bookmark_key,                                       /* Bookmark references key */   // TRS/OITC
00681     annotations_key,                                    /* Annotations references key */    // TRS/OITC
00682     document_ref_key,                                   /* Document file references key */  // TRS/OITC
00683     document_info_key,                                  /* Document information references key */   // TRS/OITC
00684     html_info_key,                                      /* HTML/SGML information references key */  // TRS/OITC
00685     spcl_idle_list_key,                                 /* For special idle list */
00686     section_info_key                                    /* For sections */
00687 };
00688 
00689 
00690 #define CUSTOM_HANDLER_KEY  (PLATFORM_SPECIFIC_KEY + 1024)  // App can use this for keys
00691 
00692 /* Format init verbs for format_init_key: */
00693 
00694 enum {
00695     init_start_verb,
00696     init_style_verb,
00697     init_font_verb,
00698     init_par_verb,
00699     init_end_verb
00700 };
00701 
00702 /* I/O Verbs  */
00703 
00704 enum {
00705     io_data_direct,             /* Read or write data directly to pointer */
00706     io_data_indirect,           /* Read or write data into/from a memory_ref */
00707     io_get_eof,                 /* Return file size */
00708     io_set_fpos,                /* Set file position */
00709     io_set_eof,                 /* Set end of file */
00710     io_file_unit                /* Return file unit */
00711 };
00712 
00713 /* Extend proc verbs:  */
00714 
00715 enum {
00716     pg_std_procs,               /* Standard procs have been initialized */
00717     pg_new,                     /* pgNew has been called */
00718     pg_dispose                  /* About to do a pgDispose */
00719 };
00720 
00721 
00722 /* Text block feed action verbs: */
00723 
00724 enum {
00725     use_block,                  /* Will be using block */
00726     unuse_block,                /* No longer using block */
00727     break_block                 /* Break this block */
00728 };
00729 
00730 /* Highlight state verbs: */
00731 
00732 enum {
00733     no_change_verb,             /* State stays the same */
00734     activate_verb,              /* Set to active mode */
00735     deactivate_verb             /* Set to deactive mode */
00736 };
00737 
00738 
00739 /* "Wait function" verbs:  */
00740 
00741 enum {
00742     paginate_wait,              /* Long pagination */
00743     copy_wait,                  /* Long copy */
00744     insert_wait,                /* Long paste (insert) */
00745     save_wait,                  /* Save file wait */
00746     open_wait                   /* Open file wait */
00747 };
00748 
00749 /* Line initialize verbs: */
00750 
00751 enum {
00752     init_measure_verb,
00753     new_line_verb,
00754     done_measure_verb
00755 };
00756 
00757 /* Post-(after) pagination action taken verbs: */
00758 
00759 enum {
00760     paginated_line_shift,           /* Only shifted line locations vertically */
00761     paginated_empty_block,          /* Built an empty block */
00762     paginated_hidden_block,         /* Built block whose text is all invisible. */
00763     paginated_fake_block,           /* Built dummy block -- sits below last container */
00764     paginated_partial_block,        /* Rebuilt lines only partially */
00765     paginated_full_block            /* Rebuilt everything */
00766 };
00767 
00768 
00769 /* app_init_proc verbs */
00770 
00771 #define EMBED_REF_INIT      1
00772 
00773 
00774 /**********************  Typed Memory Ref's ***********************/
00775 
00776 /* These are typedef'd for compiler checking only */
00777 
00778 typedef memory_ref  pg_ref;     /* Reference ID for a Paige object */
00779 typedef pg_ref      pg_subref;  /* A pg_ref clone (most members shared with main doc) */
00780 typedef pg_subref PG_FAR *pg_subref_ptr;    /* Pointer to a list of subrefs */
00781 typedef memory_ref  shape_ref;  /* Memory ref containing a "shape" */
00782 typedef memory_ref  text_ref;   /* Memory ref containing text data */
00783 typedef memory_ref  line_ref;   /* Memory ref containing line info */
00784 typedef memory_ref  tab_ref;    /* Memory ref contain tab records */
00785 typedef memory_ref  select_ref; /* Selection points (longs) */
00786 typedef memory_ref  file_ref;   /* File reference (contains machine stuff) */
00787 typedef memory_ref  undo_ref;   /* For Undo support */
00788 typedef memory_ref  pg_list_ref;/* For list of paige refs */
00789 
00790 /* Additional typedef'd memory_refs (that app won't usually need to see): */
00791 
00792 typedef memory_ref  block_ref;  /* For text_block arrays */
00793 typedef memory_ref  format_ref; /* For style record array */
00794 typedef memory_ref  par_ref;    /* Paragraph record array */
00795 typedef memory_ref  font_ref;   /* Font table */
00796 typedef memory_ref  style_ref;  /* Style run array */
00797 typedef memory_ref  pgHyphenInfoRef;    /* Hyphenation extension */
00798 
00799 
00800 
00801 /**********************  Paige data structures ********************/
00802 
00803 
00804 /* Coordinate or "Point" */
00805 
00806 struct co_ordinate {
00807     long        v;              /* vertical position */
00808     long        h;              /* horizontal position */
00809 };
00810 
00811 typedef struct co_ordinate co_ordinate;
00812 
00813 typedef co_ordinate PG_FAR *co_ordinate_ptr; /* "FAR" pointer for coordinate */
00814 
00815 /* Rectangle */
00816 
00817 struct rectangle {
00818     co_ordinate top_left;       /* Top-left of rect */
00819     co_ordinate bot_right;      /* Bottom-right of rect */
00820 };
00821 
00822 typedef struct rectangle rectangle;
00823 
00824 typedef rectangle PG_FAR *rectangle_ptr;
00825 typedef rectangle        shape;         /* Also a "shape" for practical purposes */
00826 typedef rectangle_ptr    shape_ptr;
00827 
00828 /* Shape section */
00829 
00830 struct shape_section {
00831     long                    r_num;      /* Rectangle number (index) */
00832     long                    v_position; /* Vertical position (from top) */
00833 };
00834 
00835 typedef struct shape_section shape_section;
00836 typedef shape_section PG_FAR *shape_section_ptr;
00837 
00838 
00839 /* Color variable: */
00840 
00841 struct color_value {
00842     unsigned short  red;        /* Red composite */
00843     unsigned short  green;      /* Green composite */
00844     unsigned short  blue;       /* Blue composite */
00845     pg_short_t      alpha;      /* Optional value (machine dependent) */
00846 };
00847 
00848 typedef struct color_value color_value;
00849 typedef color_value PG_FAR *color_value_ptr;
00850 
00851 
00852 /* Line info record (becomes array of screen positions): */
00853 
00854 struct point_start {
00855     pg_short_t  offset;         /* Position into text */
00856     short       extra;          /* Tab record if &0xC000 == 0 */
00857     short       baseline;       /* Distance from bottom to draw */
00858     pg_short_t  flags;          /* Various attributes flags */
00859     long        r_num;          /* Wrap rectangle record where this sits */
00860     rectangle   bounds;         /* Point(s) that enclose text piece exactly */
00861 };
00862 
00863 typedef struct point_start point_start;
00864 typedef point_start PG_FAR *point_start_ptr;
00865 
00866 
00867 struct text_block {
00868     long        begin;          /* Relative offset beginning */
00869     long        end;            /* Relative offset ending */
00870     rectangle   bounds;         /* Entire area this includes */
00871     text_ref    text;           /* Actual text data */
00872     line_ref    lines;          /* Point_start run for lines */
00873     pg_short_t  flags;          /* Used internally by Paige */
00874     pg_short_t  num_lines;      /* Number of lines */
00875     pg_short_t  num_pars;       /* Number of paragraphs */
00876     pg_short_t  cache_flags;    /* Flags used in disk caching feature v2.0 */
00877     long        cache_begin;    /* File begin offset (disk caching feature v2.0) */
00878     long        first_line_num; /* First line number */
00879     long        first_par_num;  /* First par number */
00880     point_start end_start;      /* Copy of ending point_start in block */
00881     memory_ref  subref_list;    /* Reserved for DSI extensions */
00882     tb_append_t user_var;       /* Can be used for anything */
00883 };
00884 
00885 typedef struct text_block text_block;
00886 typedef text_block PG_FAR *text_block_ptr; /* "FAR" pointer for text_block */
00887 
00888 /* From/To drawing point: */
00889 
00890 struct draw_points {
00891     co_ordinate     from;           /* Draw from */
00892     co_ordinate     to;             /* Draw to */
00893     long            real_offset;    /* Actual offset into all text */
00894     long            ascent;         /* Distance to top of line from baseline */
00895     long            descent;        /* Distance to bottom of line from baseline */
00896     long            line_offset;    /* Offset where line begins */
00897     long            compensate_h;   /* Amount of x-axis compensation (due to device mapping) */
00898     point_start_ptr starts;         /* Pointer to current point_start record */
00899     shape_ref       bitmap_exclude; /* If bitmap draw, shape of exclusion rects */
00900     co_ordinate     bitmap_offset;  /* If bitmap, offset to "real" screen draw */
00901     co_ordinate     vis_offset;     /* Total amount point_starts were offset */
00902     text_block_ptr  block;          /* Current text block */
00903 };
00904 
00905 typedef struct draw_points draw_points;
00906 typedef draw_points PG_FAR *draw_points_ptr;
00907 
00908 /* Text style run record */
00909 
00910 struct style_run {
00911     long        offset;         /* Absolute text offset */
00912     pg_short_t  style_item;     /* Index to style records */
00913 };
00914 
00915 typedef struct style_run style_run;
00916 typedef style_run PG_FAR *style_run_ptr;    /* "FAR" pointer for style run */
00917 
00918 
00919 /* Font table record: */
00920 
00921 #define FONT_SIZE       64          /* Size of font name */
00922 
00923 /* IMPORTANT SOURCE CODE NOTE: See function "pgSetMaskFromFlds" in pgDefStl.c
00924 source code, which depends on the exact sequence of fields. Hence if fields are
00925 moved around or added in style_info this source needs to be modified. */
00926 
00927 struct font_info {
00928     pg_char     name[FONT_SIZE + BOM_HEADER];           /* "Name" of font */
00929     pg_char     alternate_name[FONT_SIZE + BOM_HEADER]; /* Alternate font if first name not found */
00930     short       environs;                   /* Machine-specific attributes */
00931     short       typeface;                   /* Typography class (low byte = char map index) */
00932     short       family_id;                  /* Font ID code */
00933     short       alternate_id;               /* Alternate ID code if bad font */
00934     short       char_type;                  /* Type of character set ("script" for Mac) */
00935     short       code_page;                  /* Code Page for Windows(MS) */     
00936     long        platform;                   /* The platform this font originated */
00937     long        language;                   /* Language */
00938     long        machine_var[PG_FUTURE];     /* Used for machine-specific purposes */
00939     font_append_t user_var;                 /* Can be whatever */
00940 };
00941 
00942 typedef struct font_info font_info;
00943 typedef font_info PG_FAR *font_info_ptr;    /* "FAR" pointer for font_info */
00944 
00945 /* The following defines short and long members in font_info.
00946 Do not change unless font_info changes! */
00947 
00948 #define FONTINFO_SHORTS     6
00949 #define FONTINFO_LONGS      11
00950 
00951 /* Named stylesheet record: */
00952 
00953 struct named_stylesheet {
00954     pg_char     name[FONT_SIZE + BOM_HEADER];
00955     short       stylesheet_id;
00956     short       par_stylesheet_id;
00957 };
00958 
00959 typedef struct named_stylesheet named_stylesheet;
00960 typedef named_stylesheet PG_FAR *named_stylesheet_ptr;
00961 
00962 
00963 /* Tab record: */
00964 
00965 struct tab_stop {
00966     long        tab_type;       /* Type of tab */
00967     long        leader;         /* Low word = tab leader, high word = reserved for DSI */
00968     long        position;       /* Tab position */
00969     long        ref_con;        /* Can be used for special purposes */
00970 };
00971 
00972 typedef struct tab_stop tab_stop;
00973 typedef tab_stop PG_FAR *tab_stop_ptr;  /* "FAR" pointer for tab record */
00974 
00975 
00976 /* Pair defining a selection range:  */
00977 
00978 struct select_pair {
00979     long        begin;              /* Beginning offset of some text portion */
00980     long        end;                /* Ending offset of some text portion */
00981 };
00982 
00983 typedef struct select_pair select_pair;
00984 typedef select_pair PG_FAR *select_pair_ptr;
00985 
00986 
00987 /* Array of records in keyboard_ref: */
00988 
00989 struct pg_kb_data {
00990     pg_char         text_byte[4];       /* Byte backspaced (extra for pad & long align) */
00991     pg_short_t      style_item;         /* Style (locally indexed) */
00992     pg_short_t      par_item;           /* Paragraph (locally indexed) */
00993 };
00994 
00995 typedef struct pg_kb_data pg_kb_data;
00996 typedef pg_kb_data PG_FAR *pg_kb_ptr;
00997 
00998 
00999 /* Text selection point record (defines "caret" or visual selection points): */
01000 
01001 struct t_select {
01002     long                offset;             /* Absolute text offset */
01003     select_pair         word_offsets;       /* Original word offsets if applicable */
01004     co_ordinate         original_pt;        /* Original point of selection */
01005     pg_short_t          line;               /* Point start number */
01006     pg_short_t          flags;              /* Contains internal attributes */
01007     long                control_offset;     /* Offset for purposes of tracking control */
01008     long                primary_caret;      /* Offset from left for primary direction caret */
01009     long                secondary_caret;    /* Offset from left for opposing direction caret */
01010 };
01011 
01012 typedef struct t_select t_select;
01013 typedef t_select PG_FAR *t_select_ptr;
01014 
01015 /* Record to save character positions, for performance: */
01016 
01017 struct char_widths {
01018     memory_ref          positions;          /* Ref that holds positions */
01019     memory_ref          types;              /* Ref that holds char_info stuff */
01020     long                offset;             /* The offset into the text_block for these locs */
01021     long                end;
01022     long                mem_id;             /* Memory ID that "owns" this set of charwidths */
01023     long                used_ctr;           /* Nested usage of these char widths */
01024 };
01025 
01026 typedef struct char_widths char_widths;
01027 
01028 /* Scaling factor record */
01029 
01030 struct pg_scale_factor {
01031     co_ordinate     origin;         /* Relative origin */
01032     pg_fixed        scale;          /* Scaling (hiword / loword fraction) */
01033 };
01034 
01035 typedef struct pg_scale_factor pg_scale_factor;
01036 typedef pg_scale_factor PG_FAR *pg_scale_ptr;
01037 
01038 /* Portable "graphics port" or window: */
01039 
01040 struct pg_clip_info {
01041     co_ordinate     clip_origin;    /* Origin the clipping is based on */
01042     co_ordinate     scroll_pos;     /* Scroll position clipping was based */
01043     rectangle       vis_bounds;     /* Visual bounds clipping was based */
01044     rectangle       page_bounds;    /* Visual page bounds clipping was based on */
01045     long            scale;          /* Scale value clip was based on */
01046     long            change_flags;   /* Misc. changes that can affect clip region */
01047 };
01048 
01049 typedef struct pg_clip_info pg_clip_info;
01050 
01051 struct graf_device {
01052     generic_var     machine_var;    /* Machine-dependent item */
01053     generic_var     palette;        /* Machine-specific palette (to be selected by PAIGE) */
01054     color_value     bk_color;       /* Color used for erasing (Windows only) */
01055     co_ordinate     origin;         /* Offset for which things draw (default is 0, 0) */
01056     pg_region       clip_rgn;       /* The current clip region */
01057     pg_region       scroll_rgn;     /* If non-null, clip to this (from scrolling) */
01058     pg_clip_info    clip_info;      /* Info in which last clipping region was based. */
01059     long            palette_select; /* Used for machine-specific palette code */
01060     long            previous_items[6]; /* Previously selected items (machine-specific) */
01061     long            machine_ref;    /* Additional ref for machine */
01062     long            machine_ref2;   /* More info for machine */
01063     long            machine_ref3;   /* More info for machine */
01064     long            machine_ref4;   /* More info for machine */
01065     long            caret_info;     /* Used for machine-dependent caret stuff */
01066     memory_ref      graf_stack;     /* Use to "push" previous stuff */
01067     memory_ref      poly_save;      /* Used to save polygon or picture drawings */
01068     memory_ref      pict_save;      /* Used to save portable pictures */
01069     long            resolution;     /* Device resolution (HiWord h LoWord v) */
01070     generic_var     print_port;     /* Printer port (if we are to match up) */
01071     pg_scale_factor scale;          /* Automatic scaling factor, if any */
01072     long            access_ctr;     /* Number of times called to set this port */
01073     port_append_t   user_var;       /* Can be used for whatever */
01074 };
01075 
01076 typedef struct graf_device graf_device;
01077 typedef graf_device PG_FAR *graf_device_ptr;    /* "FAR" pointer for graf_device */
01078 
01079 #define USE_NO_DEVICE       (generic_var) -1  /* pgNew is with no device */
01080 
01081 /* Document info record */
01082 
01083 #define MAX_COLS            10
01084 
01085 struct pg_col_info {
01086     pg_fixed    width;              /* Column width or 0 if default width (RTF) */
01087     pg_fixed    gap;                /* Column gap or 0 if default gap (1/2 inch) (RTF) */
01088 };
01089 
01090 typedef struct pg_col_info pg_col_info;
01091 typedef pg_col_info PG_FAR *pg_col_ptr;
01092 
01093 
01094 struct pg_doc_info {
01095     long        attributes;         /* Various attributes (see below) */
01096     long        section_attributes; /* Various section attributes (see below) (RTF) */
01097     short       exclusion_inset;    /* Amount to inset exclusion area for clipping */
01098     short       scroll_inset;       /* Amount to inset vis area when scrolling */
01099     short       caret_width_extra;  /* Extra width of the caret (default is 0) */
01100     pg_short_t  num_pages;          /* Number of "real" pages */
01101     long        repeat_slop;        /* Minimum remaining before repeat */
01102     short       minimum_widow;      /* Minimum widow (lines at end of page) */
01103     short       minimum_orphan;     /* Minimum orphan (lines at top of page) */
01104     co_ordinate repeat_offset;      /* Amount of "gap" for repeater shapes */
01105     rectangle   print_target;       /* App can use as printed page size (RTF) */
01106     rectangle   margins;            /* Page margins (RTF) */
01107     rectangle   offsets;            /* Additional offsets of doc, 4 sides */
01108     long        max_chars_per_line; /* Optional max characters per line, or zero */
01109     short       start_page_num;     /* Starting page number (RTF) */
01110     short       restart_page_num;   /* Restarting page number (RTF) */
01111     short       page_num_prefix;    /* Page number prefix index (RTF) */
01112     pg_char     page_num_sep;       /* Page number separator (RTF) */
01113     pg_char     page_num_format;    /* Page number format (RTF) */
01114     co_ordinate page_num_loc;       /* Location of the page number relative to top and right margin (RTF) */
01115     pg_fixed    hyph_hot_zone;      /* Amount of space at the right margin in which words are hyphenated (RTF) */
01116     short       consecutive_hyph;   /* Maximum number of consecutive lines that will be allowed to end in a hyphen. 0 means no limit (RTF) */
01117     short       start_line_num;     /* Starting line number (RTF) */
01118     short       restart_line_num;   /* Restarting line number (RTF) */
01119     short       line_increment;     /* Line number increment (RTF) */
01120     pg_fixed    line_num_loc;       /* Location of the line number relative to left margin (RTF) */
01121     pg_fixed    line_num_width;     /* Location of the line number relative to left margin (RTF) */
01122     pg_char     rev_format;         /* How revised text will be displayed: 0 for no properties shown; 1 for bold; 2 for italic; 3 for underline (the default); 4 for double underline. (RTF) */
01123     pg_char     rev_bar;            /* How vertical lines mark altered text, based on the argument: 0 for no marking; 1 for left margin; 2 for right margin; 3 for outside (the default: left on left pages, right on right pages). (RTF) */
01124     short       num_of_cols;        /* Optional number of columns, or zero (RTF) */
01125     pg_fixed    gutter;             /* Gutter (RTF) */
01126     pg_fixed    dflt_gap;           /* Default column gap (RTF) */
01127     pg_col_info col_info[MAX_COLS]; /* Column information (RTF) */
01128     memory_ref  title;              /* document's title (RTF) */
01129     memory_ref  subject;            /* document's subject (RTF) */
01130     memory_ref  author;             /* document's author (RTF) */
01131     memory_ref  wp_operator;        /* document's operator (RTF) */
01132     memory_ref  keywords;           /* document's keywords (RTF) */
01133     memory_ref  comment;            /* document's comment (RTF) */
01134     long        version;            /* document's document version (RTF) */
01135     memory_ref  doccomm;            /* document's document comment (RTF) */
01136     long        vern;               /* document's internal version number (RTF) */
01137     pg_time_t   creationtime;       /* document's document creation time (Paige style ie. seconds since 00:00 01 JAN 1900) (RTF) */
01138     pg_time_t   revisiontime;       /* document's document revision time (Paige style ie. seconds since 00:00 01 JAN 1900) (RTF) */
01139     pg_time_t   printtime;          /* document's document print time (Paige style ie. seconds since 00:00 01 JAN 1900) (RTF) */
01140     pg_time_t   backuptime;         /* document's document backup time (Paige style ie. seconds since 00:00 01 JAN 1900) (RTF) */
01141     pg_time_t   edittime;           /* document's document edit time in min (RTF) */
01142     long        id;                 /* document's Id (RTF) */
01143     long        future[PG_FUTURE];  /* Reserved for future */
01144     long        ref_con;            /* App can store whatever */
01145 };
01146 
01147 typedef struct pg_doc_info pg_doc_info;
01148 typedef pg_doc_info PG_FAR *pg_doc_ptr;
01149 
01150 
01151 /* rev_format */
01152 
01153 enum {
01154     no_rev_properties = 0,          /* How revised text will be displayed: 0 for no properties shown (RTF) */
01155     rev_bold_property = 1,          /* .1 for bold (RTF) */
01156     rev_italic_property = 2,        /* .2 for italic (RTF) */
01157     rev_underline_property = 3,     /* .3 for underline (the default) (RTF) */
01158     rev_dbl_underline_property = 4, /* .4 for double underline (RTF) */
01159     rev_paige_property = 5          /* .5 for Paige special formatting (RTF) */
01160 };
01161 
01162 
01163 /* rev_bar */
01164 
01165 enum {
01166     no_rev_marking = 0,             /* How vertical lines mark altered text, based on the argument: 0 for no marking (RTF) */
01167     left_margin_rev_bar = 1,        /* .1 for left margin (RTF) */
01168     right_margin_rev_bar = 2,       /* .2 for right margin (RTF) */
01169     outside_margin_rev_bar = 3,     /* .3 for outside (the default: left on left pages, right on right pages) (RTF) */
01170     paige_margin_rev_bar = 4        /* .4 for Paige special formatting (RTF) */
01171 };
01172 
01173 #define NUM_FMT_MASK            0x0000000F  /* Number format mask (RTF) */
01174 #define NUM_DECIMAL             0x00000000  /* Number format is decimal (1, 2, 3) (RTF) */
01175 #define NUM_UPR_ROMAN           0x00000001  /* Number format is uppercase roman numeral (I, II, III) (RTF) */
01176 #define NUM_LWR_ROMAN           0x00000002  /* Number format is lowercase roman numeral (i, ii, iii) (RTF) */
01177 #define NUM_UPR_LETTER          0x00000003  /* Number format is uppercase letter (A, B, C) (RTF) */
01178 #define NUM_LWR_LETTER          0x00000004  /* Number format is lowercase letter (a, b, c) (RTF) */
01179 #define NUM_CARDINAL            0x00000005  /* Number format is cardinal numbering (One, Two, Three) (RTF) */
01180 #define NUM_ORDINAL             0x00000006  /* Number format is ordinal numbering (1st, 2nd, 3rd) (RTF) */
01181 #define NUM_ORDINAL_TEXT        0x00000007  /* Number format is ordinal text numbering (First, Second, Third) (RTF) */
01182 
01183 /* attributes */
01184 
01185 #define V_REPEAT_BIT            0x00000001  /* Shape repeats vertically */
01186 #define H_REPEAT_BIT            0x00000002  /* Shape repeats horizontally */
01187 #define BOTTOM_FIXED_BIT        0x00000004  /* Shape's bottom does not grow */
01188 #define NO_CONTAINER_JMP_BIT    0x00000010  /* Can't jump containers */
01189 #define MAX_SCROLL_ON_SHAPE     0x00000020  /* Maximum scroll is on shape only */
01190 #define NO_CLIP_PAGE_AREA       0x00000040  /* Page area does NOT clip text */
01191 #define PG_LIST_MODE_BIT        0x00000080  /*** FOR DSI ONLY ***/
01192 #define PG_FORMS_MODE_BIT       0x00000100  /*** FOR DSI ONLY ***/
01193 #define PAINT_BACKGROUND_BIT    0x00000200  /*** (not used in 1.3) ***/
01194 #define WINDOW_CURSOR_BIT       0x00000400  /* Keep cursor in window view */
01195 #define PRINT_MATCH_BIT         0x00000800  /* Screen must match printer exactly */
01196 #define LANDSCAPE_BIT           0x00001000  /* Document should be landscaped (RTF) */
01197 #define MIRRORED_MARGINS_BIT    0x00002000  /* Document has mirrored margins (RTF) */
01198 #define FACING_PAGE_BIT         0x00004000  /* Document has facing pages (RTF) */
01199 #define MAC_FRAC_WIDTH_BIT      0x00008000  /* Document has fractional character widths (RTF) */
01200 #define SAVE_AS_RTF_BIT         0x00010000  /* Document should be saved as rtf (RTF) */
01201 #define LINE_BETWEEN_COLS_BIT   0x00020000  /* Document should have lines between columns (RTF) */
01202 #define HARD_SUPPRESS_BIT       0x00040000  /* Document suppresses space before paragraph property after hard page or column break if this bit set (RTF) */
01203 #define LEADING_SUPPRESS_BIT    0x00080000  /* Document suppresses extra line spacing at top and bottom of page if this bit set (RTF) */
01204 #define REV_PROTECT_BIT         0x00100000  /* Document is protected for revisions. The user can edit the document, but revision marking cannot be disabled if this bit set (RTF) */
01205 #define REV_ON_BIT              0x00200000  /* Revision marking is on for the document if this bit set (RTF) */
01206 #define IS_STATIONARY           0x00400000  /* Document is stationary if this bit set (RTF) */
01207 #define MAKE_BACKUP             0x00800000  /* Backup copy is made automatically when the document is saved. (RTF) */
01208 #define OLD_RTF_MAIL_MERGE_BIT  0x01000000  /* Treat old-style escaped quotation marks (\ ") as current style ("") in mail merge data documents (RTF) */
01209 #define NO_BALANCE_COLUMNS_BIT  0x02000000  /* Don't balance columns (RTF) */
01210 #define PRINT_COLORS_BLACK_BIT  0x04000000  /* Print all colors as black (RTF) */
01211 #define NO_SUBSET_REDRAW_BIT    0x08000000  /* (reserved for DSI, do not use) */
01212 #define COLOR_VIS_BIT           0x10000000  /* Page color covers whole vis area */
01213 #define NO_CLIP_REGIONS         0x20000000  /* Do not ever set a clipping region */
01214 
01215 /* section_attributes */
01216 
01217 #define INCL_ENDNOTES_BIT       0x00000001  /* Section should include endnotes (RTF) */
01218 #define LINE_NUMBER_RESTART_BIT 0x00000002  /* Section should restarts line numbers (RTF) */
01219 #define LINE_PAGE_RESTART_BIT   0x00000004  /* Section should restarts line numbers on each page (RTF) */
01220 #define LINE_NUMBERS_CONT_BIT   0x00000008  /* Section should continue line numbers (RTF) */
01221 #define SECT_BREAK_MASK         0x000000F0  /* Section break mask (RTF) */
01222 #define SECT_PAGE_BREAK_FLAG    0x00        /* Section break starts a new page (RTF) */
01223 #define SECT_EPAGE_BREAK_FLAG   0x10        /* Section break starts at an even page (RTF) */
01224 #define SECT_OPAGE_BREAK_FLAG   0x20        /* Section break starts at an odd page (RTF) */
01225 #define SECT_COL_BREAK_FLAG     0x30        /* Section break starts a new column (RTF) */
01226 #define NO_SECT_BREAK_FLAG      0x40        /* No section break (RTF) */
01227 #define HYPHEN_CAP_BIT          0x00000100  /* Section should hyphenate capitalized words (RTF) */
01228 #define PAGE_NUMBER_RESTART_BIT 0x00000200  /* Section should restarts page numbers (RTF) */
01229 #define PAGE_NUMBER_CONT_BIT    0x00000400  /* Section should continue page numbers (RTF) */
01230 
01231 
01232 /* Structure used by post-paginate low level hook: */
01233 
01234 struct smart_update {
01235     long            flags;                  /* Flags for special purposes */
01236     long            suggest_begin;          /* Beginning display suggestion */
01237     long            suggest_end;            /* Ending display suggestion */
01238     pg_short_t      num_display_lines;      /* Number of lines in display */
01239     pg_short_t      num_display_starts;     /* Number of starts in display */
01240 };
01241 
01242 typedef struct smart_update smart_update;
01243 typedef smart_update PG_FAR *smart_update_ptr;
01244 
01245 
01246 /************************* Function Pointer Definitions **********************/
01247 
01248 typedef void PG_FAR *pg_proc;
01249 
01250 //Forward Declarations
01251 typedef struct paige_rec paige_rec;
01252 typedef paige_rec PG_FAR *paige_rec_ptr;    /* "FAR" pointer for paige_rec */
01253 
01254 typedef struct style_info style_info;
01255 typedef style_info PG_FAR *style_info_ptr;  /* "FAR" pointer for style record */
01256 
01257 typedef struct par_info par_info;
01258 typedef par_info PG_FAR *par_info_ptr;      /* "FAR" pointer for par_info */
01259 
01260 typedef struct style_walk style_walk;
01261 typedef style_walk PG_FAR *style_walk_ptr;
01262 
01263 typedef struct pg_globals pg_globals;
01264 typedef pg_globals PG_FAR *pg_globals_ptr;
01265 
01266 
01267 /* Special generic pointer for info run structures: */
01268 
01269 typedef long PG_FAR *pg_info_ptr;   /* Pointer to app-defined record for run */
01270 
01271 
01272 /* Internal struct used for Undo records: */
01273 
01274 struct pg_undo {
01275     short           verb;               /* Type of undo (for app's reference) */
01276     short           real_verb;          /* Internal action verb (could be different) */
01277     pg_ref          data;               /* Data (different for each verb) */
01278     pg_globals_ptr  globals;            /* Pointer to PAIGE globals */
01279     memory_ref      keyboard_ref;       /* Used for backspace-key-undo */
01280     format_ref      keyboard_styles;    /* Styles possibly backspaced */
01281     format_ref      keyboard_pars;      /* Paragraphs possibly backspaced */
01282     memory_ref      applied_range;      /* Range to apply Undo */
01283     memory_ref      shape_data;         /* Data for shape undo */
01284     memory_ref      refcon_data;        /* Used to copy refcons for containers, etc. */
01285     memory_ref      doc_data;           /* Used for undo doc info */
01286     memory_ref      rsrv;               /* Reserved for DSI extensions */
01287     select_pair     alt_range;          /* Range for Undo Paste & other things */
01288     select_pair     keyboard_delete;    /* Delete range for backspace undo */
01289     long            ref_con;            /* App can set this */
01290 };
01291 
01292 typedef struct pg_undo pg_undo;
01293 typedef pg_undo PG_FAR *pg_undo_ptr;
01294 
01295 
01296 /* Special record passed to the line measure proc: */
01297 
01298 struct pg_measure {
01299     pg_short_t              previous_flags; /* Ending flags at last line's end */
01300     pg_short_t              prv_prv_flags;  /* Previous flags before above */
01301     pg_short_t              wrap_dimension; /* Bits defining how complex wrap is */
01302     pg_boolean              repeating;      /* TRUE if shape is a repeater */
01303     rectangle               extra_indents;  /* Any extra indents for hooks to alter */
01304     long                    line_text_size; /* Total use of text in line */
01305     long                    max_text_size;  /* Maximum text line can use */
01306     long                    extra_width;    /* Amount of width not used after line calculated */
01307     style_walk_ptr          styles;         /* Pointer to the style_walk record */
01308     text_block_ptr          block;          /* Current text block */
01309     point_start_ptr         starts;         /* Current point start ptr */
01310     pg_short_t              starts_ctr;     /* Number of starts remaining */
01311     pg_short_t              num_starts;     /* Number of start records generated */
01312     long PG_FAR             *char_locs;     /* Current character locations */
01313     short PG_FAR            *char_types;    /* Current character types */
01314     long PG_FAR             *positions;     /* Original character locations */
01315     short PG_FAR            *types;         /* Original character types */
01316     rectangle               fit_rect;       /* Rect in which line must fit */
01317     rectangle               actual_rect;    /* Resulting rect that encloses new line */
01318     rectangle               wrap_bounds;    /* Bounding rect for wrap area */
01319     line_ref                starts_ref;     /* Memory_ref of starts */
01320     memory_ref              tab_info;       /* Contans tab_width_info (see below) */
01321     rectangle_ptr           wrap_r_base;    /* Base for shape (first rect) */
01322     rectangle_ptr           wrap_r_begin;   /* Top wrap rectangle */
01323     rectangle_ptr           wrap_r_end;     /* End wrap rectangle (often the same) */
01324     long                    r_num_begin;    /* Current wrap-target rectangle */
01325     long                    r_num_end;      /* Ending rect of line (for complex wrap) */
01326     long                    end_r;          /* Ending record index for wrap rects */
01327     long                    subpage_qty;    /* Number of rects within a "page" (0 if non-repeating) */
01328     long                    last_page;      /* Last page number given to modify_page hook */
01329     long                    old_last_page;  /* Previous last page */
01330     memory_ref              exclude_ref;    /* Holds "exclusion" rectangles */
01331     long                    wrap_r_save;    /* Saves old bottom (I replace with 0x7FFFFFFF) */
01332     co_ordinate             repeat_offset;  /* Amount to add to shape (repeater mode) */
01333     rectangle               prev_bounds;    /* Previous start's bounds */
01334     long                    hook_refcon;    /* Custom hooks can use this */
01335     long                    minimum_left;   /* Minimum left side */
01336     long                    maximum_right;  /* Maximum right side */
01337     pg_boolean              quick_paginate; /* Only moving lines, not full calc */
01338     pg_short_t              old_offset;     /* Ending offset from old line end */
01339 };
01340 
01341 typedef struct pg_measure pg_measure;
01342 typedef pg_measure PG_FAR *pg_measure_ptr;
01343 
01344 
01345 typedef PG_FN_PASCAL(void, line_measure_proc) (paige_rec_ptr pg, pg_measure_ptr measure);
01346 typedef PG_FN_PASCAL(void, line_adjust_proc) (paige_rec_ptr pg, pg_measure_ptr measure,
01347         point_start_ptr starts, pg_short_t num_starts, rectangle_ptr line_fit,
01348         par_info_ptr par_format);
01349 typedef PG_FN_PASCAL(pg_boolean, line_validate_proc) (paige_rec_ptr pg, pg_measure_ptr measure_info);
01350 typedef PG_FN_PASCAL(long, line_parse_proc) (paige_rec_ptr pg, pg_measure_ptr measure_info,
01351         pg_char_ptr text, point_start_ptr line_start, long global_offset, long remaining_length);
01352 typedef PG_FN_PASCAL(void, line_init_proc) (paige_rec_ptr pg, pg_measure_ptr measure_info,
01353         short init_verb);
01354 typedef PG_FN_PASCAL(pg_boolean, hyphenate_proc) (paige_rec_ptr pg, text_block_ptr block,
01355         style_walk_ptr styles, pg_char_ptr block_text, long line_begin, long PG_FAR *line_end,
01356         long PG_FAR *positions, short PG_FAR *char_types, long PG_FAR *line_width_extra,
01357         pg_boolean zero_length_ok);
01358 typedef PG_FN_PASCAL(void, click_examine_proc) (paige_rec_ptr pg, short click_verb,
01359         short modifiers, long refcon_return, t_select_ptr begin_select,
01360         t_select_ptr end_select);
01361 typedef PG_FN_PASCAL(void, hilite_rgn_proc) (paige_rec_ptr pg, t_select_ptr selections,
01362         pg_short_t select_qty, shape_ref rgn);
01363 typedef PG_FN_PASCAL(void, draw_hilite_proc) (paige_rec_ptr pg, shape_ref rgn);
01364 typedef PG_FN_PASCAL(void, draw_cursor_proc) (paige_rec_ptr pg, t_select_ptr select,
01365         short verb);
01366 typedef PG_FN_PASCAL(void, do_idle_proc) (paige_rec_ptr pg, short verb);
01367 typedef PG_FN_PASCAL(void, text_load_proc) (paige_rec_ptr pg, text_block_ptr block);
01368 typedef PG_FN_PASCAL(long, text_break_proc) (paige_rec_ptr pg, text_block_ptr block); 
01369 typedef PG_FN_PASCAL(void, pt2_offset_proc) (paige_rec_ptr pg, co_ordinate_ptr point,
01370         short conversion_info, t_select_ptr selection);
01371 typedef PG_FN_PASCAL(pg_boolean, par_boundary_proc) (paige_rec_ptr pg, select_pair_ptr boundary);
01372 typedef PG_FN_PASCAL(void, change_container_proc) (paige_rec_ptr pg, pg_short_t container_num,
01373         rectangle_ptr container, pg_scale_ptr scaling_ptr, co_ordinate_ptr screen_extra,
01374         short verb, void PG_FAR *misc_info);
01375 typedef PG_FN_PASCAL(void, smart_quotes_proc) (paige_rec_ptr pg, long insert_offset,
01376         long info_bits, pg_char_ptr char_to_insert, short PG_FAR *insert_length);
01377 typedef PG_FN_PASCAL(void, post_paginate_proc) (paige_rec_ptr pg, text_block_ptr block,
01378         smart_update_ptr update_info, long lineshift_begin, long lineshift_end,
01379         short action_taken_verb);
01380 typedef PG_FN_PASCAL(void, increment_text_proc) (paige_rec_ptr pg, long base_offset,
01381         long increment_amount);
01382 typedef PG_FN_PASCAL(void, font_init_proc) (paige_rec_ptr pg, font_info_ptr info);
01383 typedef PG_FN_PASCAL(void, style_init_proc) (paige_rec_ptr pg, style_info_ptr style,
01384         font_info_ptr font);
01385 typedef PG_FN_PASCAL(void, install_font_proc) (paige_rec_ptr pg, style_info_ptr style,
01386         font_info_ptr font, style_info_ptr superimpose, pg_boolean include_offscreen);
01387 typedef PG_FN_PASCAL(void, special_char_proc) (paige_rec_ptr pg, style_walk_ptr walker, pg_char_ptr data,
01388         pg_short_t offset, pg_short_t length, draw_points_ptr draw_position,
01389         long extra, short draw_mode);
01390 typedef PG_FN_PASCAL(void, auto_scroll_proc) (paige_rec_ptr pg, short h_verb, short v_verb,
01391         co_ordinate_ptr mouse_point, short draw_mode);
01392 typedef PG_FN_PASCAL(void, scroll_adjust_proc) (paige_rec_ptr pg, long amount_h,
01393         long amount_v, short draw_mode);
01394 typedef PG_FN_PASCAL(void, draw_scroll_proc) (paige_rec_ptr pg, shape_ref update_rgn,
01395         co_ordinate_ptr scroll_pos, pg_boolean post_call);
01396 typedef PG_FN_PASCAL(void, bitmap_modify_proc) (paige_rec_ptr pg, graf_device_ptr bits_port,
01397         pg_boolean post_call, rectangle_ptr bits_rect, co_ordinate_ptr screen_offset,
01398         long text_position);
01399 typedef PG_FN_PASCAL(void, wait_process_proc) (paige_rec_ptr pg, short wait_verb,
01400         long progress_ctr, long completion_ctr);
01401 typedef PG_FN_PASCAL(void, draw_page_proc) (paige_rec_ptr pg, shape_ptr page_shape,
01402         pg_short_t r_qty, pg_short_t page_num, co_ordinate_ptr vis_offset,
01403         short draw_mode_used, short call_order);
01404 typedef PG_FN_PASCAL(void, enhance_undo_proc) (paige_rec_ptr pg, pg_undo_ptr undo_rec,
01405         void PG_FAR *insert_ref, short action_to_take);
01406 typedef PG_FN_PASCAL(void, measure_proc) (paige_rec_ptr pg, style_walk_ptr walker,
01407         pg_char_ptr data, long length, pg_short_t slop, long PG_FAR *positions,
01408         short PG_FAR *types, short measure_verb, long current_offset, pg_boolean scale_widths,
01409         short call_order);
01410 typedef PG_FN_PASCAL(pg_boolean, merge_proc) (paige_rec_ptr pg, style_info_ptr style, pg_char_ptr text_data,
01411         pg_short_t length, text_ref merged_data, long ref_con);
01412 typedef PG_FN_PASCAL(long, track_control_proc) (paige_rec_ptr pg, short verb,
01413         t_select_ptr first_select, t_select_ptr last_select, style_walk_ptr styles,
01414         pg_char_ptr associated_text, point_start_ptr bounds_info, short modifiers,
01415         long track_refcon);
01416 typedef PG_FN_PASCAL(long, char_info_proc) (paige_rec_ptr pg, style_walk_ptr walker,
01417         pg_char_ptr data, long block_offset, long offset_begin, long offset_end, long char_offset,
01418         long mask_bits);
01419 typedef PG_FN_PASCAL(void, text_draw_proc) (paige_rec_ptr pg, style_walk_ptr walker, pg_char_ptr data,
01420         pg_short_t offset, pg_short_t length, draw_points_ptr draw_position,
01421         long extra, short draw_mode);
01422 typedef PG_FN_PASCAL(void, dup_style_proc) (paige_rec_ptr src_pg, paige_rec_ptr target_pg,
01423         short reason_verb, format_ref all_styles, style_info_ptr style);
01424 typedef PG_FN_PASCAL(void, delete_style_proc) (paige_rec_ptr pg, pg_globals_ptr globals,
01425         short reason_verb, format_ref all_styles, style_info_ptr style);
01426 typedef PG_FN_PASCAL(void, alter_style_proc) (paige_rec_ptr pg, style_info_ptr old_style,
01427         style_info_ptr new_style, style_info_ptr style_mask);
01428 typedef PG_FN_PASCAL(void, save_style_proc) (paige_rec_ptr pg, style_info_ptr style_to_save);
01429 typedef PG_FN_PASCAL(void, style_activate_proc) (paige_rec_ptr pg, style_info_ptr style,
01430         select_pair_ptr text_range, pg_char_ptr text, short front_back_state,
01431         short perm_state, pg_boolean show_hilite);
01432 typedef PG_FN_PASCAL(void, copy_text_proc) (paige_rec_ptr src_pg, paige_rec_ptr target_pg,
01433         short reason_verb, style_info_ptr style, long style_position,
01434         long text_position, pg_char_ptr text, long length);
01435 typedef PG_FN_PASCAL(void, delete_text_proc) (paige_rec_ptr pg, short reason_verb,
01436         style_info_ptr style, long style_position, long text_position, pg_char_ptr text, long length);
01437 typedef PG_FN_PASCAL(pg_boolean, setup_insert_proc) (paige_rec_ptr pg, style_info_ptr to_be_inserted,
01438         long position);
01439 typedef PG_FN_PASCAL(void, line_glitter_proc) (paige_rec_ptr pg, style_walk_ptr walker,
01440         long line_number, long par_number, text_block_ptr block, point_start_ptr first_line,
01441         point_start_ptr last_line, point_start_ptr previous_first, point_start_ptr previous_last,
01442         co_ordinate_ptr offset_extra, rectangle_ptr vis_rect, short call_verb);
01443 typedef PG_FN_PASCAL(long, tab_measure_proc) (paige_rec_ptr pg, style_walk_ptr walker, long cur_pos,
01444         long cur_text_pos, long line_left, pg_char_ptr text, pg_short_t text_length,
01445         long PG_FAR *char_positions, pg_short_t PG_FAR *tab_rec_info);
01446 typedef PG_FN_PASCAL(void, tab_draw_proc) (paige_rec_ptr pg, style_walk_ptr walker, tab_stop_ptr tab_ptr,
01447         draw_points_ptr draw_position);
01448 typedef PG_FN_PASCAL(void, dup_par_proc) (paige_rec_ptr src_pg, paige_rec_ptr target_pg,
01449         short reason_verb, par_ref all_pars, par_info_ptr par_style);
01450 typedef PG_FN_PASCAL(void, delete_par_proc) (paige_rec_ptr pg, short reason_verb,
01451         par_ref all_pars, par_info_ptr par_style);
01452 typedef PG_FN_PASCAL(void, alter_par_proc) (paige_rec_ptr pg, par_info_ptr old_par,
01453         par_info_ptr new_par);
01454 typedef PG_FN_PASCAL(void, set_device_proc) (paige_rec_ptr pg, short verb, graf_device_ptr device,
01455         color_value_ptr bk_color);
01456 typedef PG_FN_PASCAL(void, page_modify_proc) (paige_rec_ptr pg, long page_num, rectangle_ptr margins);
01457 typedef PG_FN_PASCAL(pg_error, file_io_proc) (void PG_FAR *data, short verb, long PG_FAR *position,
01458         long PG_FAR *data_size, file_ref filemap);
01459 typedef PG_FN_PASCAL(long, wordbreak_info_proc) (paige_rec_ptr pg, pg_char_ptr the_char, short charsize,
01460         style_info_ptr style, font_info_ptr font, long current_settings);
01461 typedef PG_FN_PASCAL(pg_word, charclass_info_proc) (paige_rec_ptr pg, pg_char_ptr the_char, short charsize,
01462         style_info_ptr style, font_info_ptr font);
01463 typedef PG_FN_PASCAL(short, key_insert_query) (paige_rec_ptr pg, pg_char_ptr the_char, short charsize);
01464 typedef PG_FN_PASCAL(pg_boolean, pg_handler_proc) (paige_rec_ptr pg, pg_file_key key,
01465         memory_ref key_data, long PG_FAR *element_info, void PG_FAR *aux_data,
01466         long PG_FAR *unpacked_size);
01467 typedef PG_FN_PASCAL(void, extend_proc) (void PG_FAR *param, short verb);
01468 typedef PG_FN_PASCAL(void, app_init_read) (paige_rec_ptr pg, memory_ref ref, short type);   // TRS/OITC
01469 typedef PG_FN_PASCAL(void, subset_glitter_proc) (paige_rec_ptr pg, draw_points_ptr draw_position,
01470         rectangle_ptr draw_bounds, style_info_ptr style);
01471 
01472 
01473 /***************************  Style records & Globals ************************/
01474 
01475 /* Style procs for custom styles: */
01476 
01477 struct pg_style_hooks {
01478     style_init_proc     init;           /* Initialize style_info */
01479     install_font_proc   install;        /* Set up "current" font & style */
01480     measure_proc        measure;        /* Measure char positions */
01481     merge_proc          merge;          /* Substitute other text */
01482     char_info_proc      char_info;      /* Return info about a char */
01483     text_draw_proc      draw;           /* Draw the character(s) draw characters */
01484     dup_style_proc      duplicate;      /* Style will get duplicated */
01485     delete_style_proc   delete_style;   /* Style will get deleted */
01486     alter_style_proc    alter_style;    /* Style will get altered */
01487     save_style_proc     save_style;     /* Style about to be written to disk */
01488     copy_text_proc      copy_text;      /* Text of style will be copied */
01489     delete_text_proc    delete_text;    /* Text of style will be deleted */
01490     setup_insert_proc   insert_proc;    /* Set up the style for a future insert */
01491     track_control_proc  track_ctl;      /* Mouse track for "control" type style*/
01492     style_activate_proc activate_proc;  /* Activate/deactivate style */
01493 };
01494 
01495 typedef struct pg_style_hooks pg_style_hooks;
01496 
01497 
01498 /* Paragraph procs for custom paragraphs: */
01499 
01500 struct pg_par_hooks {
01501     line_glitter_proc   line_glitter;   /* Draw ornaments, line */
01502     tab_measure_proc    tab_width;      /* Return the tab position */
01503     tab_draw_proc       tab_draw;       /* Draws leaders */
01504     dup_par_proc        duplicate;      /* Style will get duplicated */
01505     delete_par_proc     delete_par;     /* Style will get deleted */
01506     alter_par_proc      alter_par;      /* Style will get altered */
01507 };
01508 
01509 typedef struct pg_par_hooks pg_par_hooks;
01510 
01511 
01512 /* Paige general hook record */
01513 
01514 struct pg_hooks {
01515     line_init_proc          line_init;      /* Initialize line measure */
01516     line_measure_proc       line_proc;      /* Measure a line */
01517     line_adjust_proc        adjust_proc;    /* Adjust a line */
01518     line_validate_proc      validate_line;  /* Validate (or change) a line */
01519     line_parse_proc         parse_line;     /* Change length for parsing */
01520     hyphenate_proc          hyphenate;      /* Hyphenate word */
01521     hilite_rgn_proc         hilite_rgn;     /* Make highlight region */
01522     draw_hilite_proc        hilite_draw;    /* Draw (invert) highlight */
01523     text_load_proc          load_proc;      /* Load text for text_block */
01524     text_break_proc         break_proc;     /* Find break point for a text block */
01525     draw_cursor_proc        cursor_proc;    /* Draw a caret */
01526     do_idle_proc            idle_proc;      /* Do idle processing */
01527     pt2_offset_proc         offset_proc;    /* Find offset matching point */
01528     font_init_proc          font_proc;      /* Set up fields in font_info */
01529     special_char_proc       special_proc;   /* Special character draw proc */
01530     auto_scroll_proc        auto_scroll;    /* Called for auto-scrolling during drag */
01531     scroll_adjust_proc      adjust_scroll;  /* Adjust scrolling values */
01532     draw_scroll_proc        draw_scroll;    /* Called to draw during scroll */
01533     draw_page_proc          page_proc;      /* Called to draw "page" stuff */
01534     bitmap_modify_proc      bitmap_proc;    /* Modify offscreen draw proc */
01535     wait_process_proc       wait_proc;      /* Called for long crunches */
01536     enhance_undo_proc       undo_enhance;   /* Called for custom undo's */
01537     par_boundary_proc       boundary_proc;  /* Called to find paragraph boundary */
01538     change_container_proc   container_proc; /* Called for pieces of shape for ornaments, etc. */        
01539     smart_quotes_proc       smart_quotes;   /* Called to handle smart quotes */
01540     post_paginate_proc      paginate_proc;  /* Called after a block paginates */
01541     increment_text_proc     text_increment; /* Called when text is inserted or deleted */
01542     click_examine_proc      click_proc;     /* Called to look at clicked item */
01543     set_device_proc         set_device;     /* Called before and after PAIGE uses a display device */
01544     page_modify_proc        page_modify;    /* Called to let app modify each (repeating) page */
01545     wordbreak_info_proc     wordbreak_proc; /* Called to let app decide on special-case chars for word breaks */
01546     charclass_info_proc     charclass_proc; /* Called to determine the character subset type */
01547     key_insert_query        insert_query;   /* Called to determine if insert chars should be buffered. */
01548 #ifdef PG_SUBSETS
01549     subset_glitter_proc     subset_glitter; /* Called for drawing DSI subsets */
01550 #endif
01551 };
01552 
01553 typedef struct pg_hooks pg_hooks;
01554 
01555 
01556 
01557 /* The text format struct */
01558 
01559 #define MAX_STYLES          32      /* Maximum # of styles in style_info */
01560 #define MAX_NORMAL_STYLES   15      /* Maximum non-small-caps or custom styles */
01561 #define DEFAULT_FONT_INDEX  -1      /* Implies the default font index in style_info */
01562 
01563 
01564 /* IMPORTANT SOURCE CODE NOTE: See function "pgSetMaskFromFlds" in pgDefStl.c
01565 source code, which depends on the exact sequence of fields. Hence if fields are
01566 moved around or added in style_info this source needs to be modified. */
01567 
01568 struct style_info {
01569     short       font_index;         /* What font this style is in */
01570     short       styles[MAX_STYLES]; /* Stylization */
01571     short       char_bytes;         /* Number of bytes per character - 1 */
01572     short       max_chars;          /* Maximum chars before new style begins */
01573     short       ascent;             /* This style's ascent */
01574     short       descent;            /* This style's descent */
01575     short       leading;            /* Regular leading */
01576     short       shift_verb;         /* Superscript / Subscript verb */
01577     short       style_num;          /* Holds the RTF stylesheet number for stylesheets (RTF) */
01578     short       style_basedon;      /* Holds the RTF stylesheet number which this stylesheet is based on (RTF) */
01579     short       next_style;         /* Holds the RTF stylesheet number which is next (RTF) */
01580     short       rtf_reserved;       /* Reserved RTF */
01581     color_value fg_color;           /* Foreground color */
01582     color_value bk_color;           /* Background color (white = transparent) */
01583     long        class_bits;         /* Defines selection & behavior */  // TRS/OITC
01584     long        style_sheet_id;     /* Used for style sheet features */
01585     long        named_style_index;  /* Index to named stylesheet */
01586     long        small_caps_index;   /* Style_info index for small caps point size */
01587     long        machine_var;        /* Machine-specific use (hold Windows font object) */
01588     long        machine_var2;       /* Machine-specific (used for Windows font object) */
01589     pg_fixed    char_width;         /* Character width (not used in Mac) */
01590     pg_fixed    point;              /* Point (if different than pitch) */
01591     pg_fixed    left_overhang;      /* This style's left overhang if any */
01592     pg_fixed    right_overhang;     /* This style's right overhang if any */
01593     pg_fixed    top_extra;          /* This style's top leading */
01594     pg_fixed    bot_extra;          /* This style's bottom leading */
01595     pg_fixed    space_extra;        /* Extra pixels for spaces ("fixed" value) */
01596     pg_fixed    char_extra;         /* Extra pixels for chars ("fixed" value) */
01597     long        user_id;            /* Can be used by app to identify custom styles */
01598     long        user_data;          /* Additional space for app if style is custom */
01599     long        user_data2;         /* Additional space for app */
01600     pg_time_t   time_stamp;         /* Time stamp (Paige style ie. seconds since 00:00 01 JAN 1900) (RTF) */
01601     long        key_equiv;          /* Holds the keyboard equivalent for stylesheets (RTF) */
01602     long        future[3];          /* Reserved for future expansion */
01603     long        embed_entry;        /* App callback function for embed_refs */
01604     long        embed_style_refcon; /* Used by embed object extension */
01605     long        embed_refcon;       /* Used by embedded object extension */
01606     long        embed_id;           /* Used by embedded object extension */
01607     memory_ref  embed_object;       /* Used by embedded object extension */
01608     style_append_t user_var;        /* Can be used for anything */
01609     pg_style_hooks procs;           /* Contains functions on how to draw */
01610     long        maintenance;        /* (Used internally) */
01611     long        used_ctr;           /* (used internally) */
01612 };
01613 
01614 /* NOTE, the following defines the number of "short" and "long" members sequentially in style_info.
01615 Do not change unless style_info changes! */
01616 
01617 #define STYLEINFO_SHORTS        51
01618 #define STYLEINFO_LONGS         28
01619 
01620 /* Paragraph indent struct (for "ruler" support): */
01621 
01622 struct pg_indents {
01623     pg_fixed    left_indent;    /* Left margin (indent) */
01624     pg_fixed    right_indent;   /* Right margin (indent) */
01625     pg_fixed    first_indent;   /* First-line indent */
01626 };
01627 
01628 typedef struct pg_indents pg_indents;
01629 typedef pg_indents PG_FAR *pg_indents_ptr;
01630 
01631 
01632 /* Paragraph format record: */
01633 
01634 /* IMPORTANT SOURCE CODE NOTE: See function "pgSetMaskFromFlds" in pgDefStl.c
01635 source code, which depends on the exact sequence of fields. Hence if fields are
01636 moved around or added in style_info this source needs to be modified. */
01637 
01638 /* Attention source code owners: If you need more potential tab stops than 32 per paragraph,
01639 please change TAB_ARRAY_SIZE near top of this header and re-compile. */
01640 
01641 
01642 struct par_info {
01643     short       justification;  /* How text is justified */
01644     short       direction;      /* Primary text direction */
01645     short       class_info;     /* Used to define para attributes */
01646     short       style_num;      /* Holds the RTF stylesheet number for stylesheets (RTF) */
01647     short       style_basedon;  /* Holds the RTF stylesheet number which this stylesheet is based on (RTF) */
01648     short       next_style;     /* Holds the RTF stylesheet number which is next (RTF) */
01649     short       outline_level;  /* Outline level (RTF enhancement) */
01650     pg_short_t  num_tabs;       /* Number of active tabs */
01651     tab_stop    tabs[TAB_ARRAY_SIZE];   /* Tab stop information */
01652     long        style_sheet_id; /* Used for style sheet features */
01653     long        named_style_index;  /* Index to named stylesheet */
01654     pg_fixed    def_tab_space;  /* Default tab space */
01655     pg_indents  indents;        /* Indentations */
01656     pg_fixed    spacing;        /* Line spacing */
01657     pg_fixed    leading_extra;  /* Extra leading of lines */
01658     pg_fixed    leading_fixed;  /* Fixed leading (0 = auto) */
01659     pg_fixed    leading_variable; /* Variable leading (0 = auto) (RTF enhancement) */
01660     pg_fixed    top_extra;      /* Extra space at top */
01661     pg_fixed    bot_extra;      /* Extra space at bottom */
01662     pg_fixed    left_extra;     /* Extra space at left */
01663     pg_fixed    right_extra;    /* Extra space at right */
01664     long        user_id;        /* Can be used by app to identify custom par styles */
01665     long        user_data;      /* Additional space for app if par is custom */
01666     long        user_data2;     /* More space for app */
01667     long        partial_just;   /* Partial justify (future enhancement) */
01668     long        key_equiv;      /* Holds the keyboard equivalent for stylesheets (RTF) */
01669     long        future[PG_FUTURE];  /* Reserved for future enhancement */
01670     par_append_t user_var;      /* Can be used for anything */
01671     pg_par_hooks procs;         /* Function pointers */
01672     long        maintenance;    /* (Used internally) */
01673     long        used_ctr;       /* (used internally) */
01674 };
01675 
01676 
01677 /* The following defines number of short and long members in par_info.
01678 Do not change unless par_info changes! */
01679 
01680 #define PARINFO_SHORTS      8
01681 #define PARINFO_LONGS       (28 + (TAB_ARRAY_SIZE * 4))
01682 
01683 /* Paragraph class_info definitions: */
01684 
01685 #define KEEP_PARS_TOGETHER  0x0001  /* Keep all pars on same page if this bit set */
01686 // RTF Paragaph flags
01687 #define KEEP_WHOLE_PAR      0x0002  /* Keep par on same page if this bit set */
01688 #define PAR_ON_NEXT_PAGE    0x0004  /* Page break before par if this bit set */
01689 #define PAR_IGNORES_ORPHAN  0x0008  /* Par ignores window/orphan control if this bit set */
01690 #define INCLUDE_PAR_EXTRA   0x0010  /* Par include extra paragraph spacing at top and bottom of page if this bit set */
01691 #define INCLUDE_LINE_EXTRA  0x0020  /* Par include extra line spacing at top and bottom of page if this bit set */
01692 #define NO_LINE_NUMBER      0x0040  /* Par ignores line numbering if this bit set */
01693 #define SIDE_BY_SIDE_PAR    0x0080  /* Pars are side by side if this bit set */
01694 #define HYPHEN_OFF_PAR      0x0100  /* No automatic hyphenation for this par if this bit set */
01695 #define NO_SAVEDOC_PAR      0x0200  /* Do not save this par_info in pgSaveDoc() */
01696 #define RECALC_TO_BEGINNING 0x0400  /* When figuring wrap, go to start of paragraph */
01697 
01698 #define SPECIAL_PAR_BITS    (KEEP_PARS_TOGETHER | KEEP_WHOLE_PAR | RECALC_TO_BEGINNING)
01699 
01700 /* Paige "globals" (address space provided by app): */
01701 
01702 #define WIDTH_QTY               16
01703 #define ACCEPTABLE_WIDTH_QTY    2
01704 
01705 struct pg_globals {
01706     pgm_globals_ptr     mem_globals;            /* Globals for pgMemManager */
01707     long                max_offscreen;          /* Maximum memory for offscreen */
01708     long                max_block_size;         /* Max size of text block */
01709     long                minimum_line_width;     /* Minimum size line width */
01710     long                def_tab_space;          /* Default tab spacing for pgNew */
01711     pg_short_t          line_wrap_char;         /* <CR> char */
01712     pg_short_t          soft_line_char;         /* Soft <CR> char */
01713     pg_short_t          tab_char;               /* Tab character */
01714     pg_short_t          soft_hyphen_char;       /* Soft "-" char */
01715     pg_short_t          bs_char;                /* Backspace char */
01716     pg_short_t          ff_char;                /* Formfeed char (used for page breaks) */
01717     pg_short_t          container_brk_char;     /* Container break character */
01718     pg_short_t          left_arrow_char;        /* Left arrow */
01719     pg_short_t          right_arrow_char;       /* Right arrow */
01720     pg_short_t          up_arrow_char;          /* Up arrow */
01721     pg_short_t          down_arrow_char;        /* Down arrow */
01722     pg_short_t          fwd_delete_char;        /* Forward delete */
01723     pg_short_t          text_brk_char;          /* Alternate Textblock break */
01724     pg_short_t          null_char;              /* Key that does not insert but paginates */
01725     pg_char             hyphen_char[4];         /* "-" char */
01726     pg_char             decimal_char[4];        /* "." char (for decimal tabs) */
01727     pg_char             cr_invis_symbol[4];     /* Char to draw for <CR> invisibles */
01728     pg_char             lf_invis_symbol[4];     /* Char to draw for <LF> invisibles */
01729     pg_char             tab_invis_symbol[4];    /* Char to draw for TAB invisibles */
01730     pg_char             end_invis_symbol[4];    /* Char to draw for end-doc invisibles */
01731     pg_char             pbrk_invis_symbol[4];   /* Char to draw for page breaks */
01732     pg_char             cont_invis_symbol[4];   /* Container break symbol */
01733     pg_char             space_invis_symbol[4];  /* Char to draw for SPACE invisibles */
01734     pg_char             flat_single_quote[4];   /* Flat single quote */
01735     pg_char             flat_double_quote[4];   /* Flat double quote */
01736     pg_char             left_single_quote[4];   /* Left smart quote */
01737     pg_char             right_single_quote[4];  /* Right smart quote */
01738     pg_char             left_double_quote[4];   /* Left smart double quote */
01739     pg_char             right_double_quote[4];  /* Right smart double quote */
01740     pg_char             elipse_symbol[4];       /* Char to draw for "elipse" */
01741     pg_char             unknown_char[4];        /* Character to use for unsupported chars */
01742     long                invis_font;             /* Machine-specific invisible char font */
01743     long                embed_callback_proc;    /* Used by embed_ref engine */
01744     font_info           def_font;               /* Default font for all pgNew's */
01745     style_info          def_style;              /* Default style for all pgNew's */
01746     par_info            def_par;                /* Default para for all pgNew's */
01747     color_value         def_bk_color;           /* Default background color */
01748     color_value         trans_color;            /* Transparent color (white = default) */
01749     pg_char             bullet_char[4];         /* Bullet character */
01750     pg_hooks            def_hooks;              /* Default general hooks */
01751     app_init_read       app_init_proc;          /* Used to init extension data in app */
01752     memory_ref          file_handlers;          /* Contains file I/O handlers */
01753     shape_ref           offscreen_exclusion;    /* Shape to hold possible offscreen exclusions */
01754     graf_device_ptr     current_port;           /* Current graphics device */
01755     graf_device         offscreen_port;         /* Used for offscreen drawing */
01756     rectangle           offscreen_target;       /*  "    "      "        "    */
01757     rectangle           original_target;        /*  "    "      "        "    */
01758     memory_ref          offscreen_buf;          /* Used for offscreen */
01759     short               offscreen_enable;       /* TRUE if in offscreen mode */
01760     short               color_enable;           /* Used to detect color screens */
01761     long                system_version;         /* Used to know what system */
01762     long                machine_const;          /* Can be used by your machine */
01763     memory_ref          machine_specific;       /* Can hold whatever, MACHINE-DEPENDENT! */
01764     memory_ref          font_objects;           /* For Windows, built font objects */
01765     memory_ref          alpha_widths;           /* Used for ExtTextOut in Windows */
01766     memory_ref          character_sets;         /* Character set tables (platform-specific) */
01767     char_widths         width_tables[WIDTH_QTY]; /* Array of width tables */
01768     pgHyphenInfoRef     hyphenInfoRef;          /* Hyphenation Information */
01769     extend_proc         pg_extend;              /* Used by add-ons */
01770     memory_ref          g_extn_mgr;             /* Used by the extensions manager */
01771     pg_list_ref         pg_list;                /* List of all active pg_refs */
01772 };
01773 
01774 /* Used for saving/reading critical globals: */
01775 
01776 #define SHORT_GLOBAL_CHARS      14
01777 #define LONG_GLOBAL_CHARS       (sizeof(pg_char) * 17) * 4
01778 
01779 /* File handler record struct (an array of these exists in globals->file_handler_ref */
01780 
01781 struct pg_handler {
01782     pg_file_key         key;                /* Parameter file key */
01783     pg_short_t          flags;              /* Internal maintenance */
01784     pg_handler_proc     read_handler;       /* Called to handle read-in data */
01785     pg_handler_proc     write_handler;      /* Called to handle write-in data */
01786     file_io_proc        read_data_proc;     /* Called to read the data */
01787     file_io_proc        write_data_proc;    /* Called to write the data */
01788 };
01789 
01790 typedef struct pg_handler pg_handler;
01791 typedef pg_handler PG_FAR *pg_handler_ptr;
01792 
01793 
01794 /************************* Paige Object Structs ******************************/
01795 
01796 
01797 /* The basic Paige record: */
01798 
01799 struct paige_rec {
01800     pg_globals_ptr      globals;            /* Pointer to global vars */
01801     long                version;            /* Version this was created with */
01802     long                platform;           /* Platform ID created on */
01803     long                author;             /* Application signature */
01804     long                flags;              /* Attributes (set in pgNew) */
01805     long                flags2;             /* Extra attributes */ // TRS/OITC
01806     long                shared_flags;       /* Shared structure flags (version 2.0) */
01807     long                pg_type;            /* Paige type (RTF enhancement) */
01808     long                io_mask_bits;       /* Bit(s) to mask individual file keys */
01809     pg_ref              shared_pg;          /* Common pg_ref we are sharing with */
01810     pg_ref              doc_pg;             /* Main document reference (for subdocuments) (RTF) */
01811     long                t_length;           /* Total length of text */
01812     select_pair         first_word;         /* Boundaries of original word/par/line selection */
01813     select_pair         last_word;          /* Boundaries of previous word/par/line selection */
01814     long                tab_base;           /* Left edge used for measuring tabs */
01815     co_ordinate         scroll_pos;         /* Scrolled position (that affects display) */
01816     co_ordinate         previous_scroll;    /* Previous scroll position (in pixels) */
01817     co_ordinate         logical_scroll_pos; /* The logical or "real" scrolled position */
01818     co_ordinate         stable_caret;       /* Co-ordinate of stable cursor */
01819     co_ordinate         relative_caret;     /* Used internally by scrolling functions */
01820     rectangle           doc_bounds;         /* Physical max bounds of doc */
01821     long                doc_top;            /* Top vertical position */
01822     long                doc_bottom;         /* Bottom point (might be different than doc_height) */
01823     long                hilite_flags;       /* Method(s) for highlighting */
01824     long                hilite_anchor;      /* Drag-select anchor point for extend-select */
01825     pg_scale_factor     scale_factor;       /* Scaling factor */
01826     color_value         bk_color;           /* Default background color */
01827     long                resolution;         /* Fundamental resolution (HiWord h LoWord v) */
01828     pg_fixed            real_scaling;       /* Original "real" scaling factor */
01829     short               unit_h;             /* Scroll unit_h (see docs) */
01830     short               unit_v;             /* Scroll unit_v (see docs) */
01831     short               append_h;           /* Extra pixel append for h-scroll */
01832     short               append_v;           /* Extra pixel append for v-scroll */
01833     short               last_h;             /* Last h-scroll from pgGetScrollValues */
01834     short               last_v;             /* Last v-scroll from pgGetScrollValues */
01835     short               last_max_h;         /* Last max-h from pgGetScrollValues */
01836     short               last_max_v;         /* Last max-v from pgGetScrollValues */
01837     pg_short_t          insert_style;       /* Text style for insertion */
01838     pg_short_t          num_selects;        /* Number of selections */
01839     short               key_buffer_mode;    /* Display mode for buffered keys */
01840     short               autoscroll_mode;    /* Display mode used for autoscroll */
01841     short               rsrv_align;         /* - Not used, placed here to align on long word */
01842     pg_short_t          def_style_index;    /* Default style index */
01843     long                def_named_index;    /* Default -named- style index */
01844     long                scroll_align_h;     /* Alignment for horizontal scroll */
01845     long                scroll_align_v;     /* Alignment for vertical scroll */
01846     shape_section       last_drawn_bottom;  /* Last bottom point drawn in wrap area */
01847     shape_section       last_drawn_top;     /* Last top point drawn in wrap area */
01848     graf_device         port;               /* Default graphics port to draw to */
01849     pg_ref              myself;             /* My own pg_ref */
01850     select_ref          select;             /* Selection points */
01851     shape_ref           vis_area;           /* Visual area */
01852     shape_ref           exclude_area;       /* Area to exclude text */
01853     shape_ref           wrap_area;          /* Intersection of page/exclude */
01854     shape_ref           hilite_rgn;         /* Area for highlight draw */
01855     shape_ref           temp_rgn;           /* Used to draw partial highlights */
01856     long                forced_break;       /* Used for temporary page break when paginating */
01857     co_ordinate         base_vis_origin;    /* Base (original) vis area top-left point */
01858     block_ref           t_blocks;           /* Text block array */
01859     block_ref           tlevel_blocks;      /* Top level blocks (when dealing with hiearchy subrefs) */
01860     format_ref          t_formats;          /* Text style records */
01861     par_ref             par_formats;        /* Paragraph style records */
01862     font_ref            fonts;              /* Font table */
01863     style_ref           t_style_run;        /* Run for styles */
01864     style_ref           par_style_run;      /* Run for paragraph styles */
01865     style_ref           named_styles;       /* Named stylesheet list */
01866     style_ref           par_exclusions;     /* List of paragraph exclusion areas */
01867     pg_hooks            procs;              /* General hooks */
01868     char_widths         last_locs;          /* Last char widths computed */
01869     unsigned long       timer_info;         /* Used for caret toggles */
01870     long                last_key_check;     /* Last time key insert checked bad blocks */
01871     long                overflow_size;      /* Amount of bytes that overflow page bottom */
01872     pg_ref              merge_save;         /* List of "pushed" merged text or NULL */
01873     long                change_ctr;         /* Changes counter */
01874     long                mem_id;             /* Common ID all memory_refs were created */
01875     memory_ref          key_buffer;         /* Buffer's chars for pgInsert */
01876     memory_ref          applied_range;      /* Used for copy/pastes */
01877     memory_ref          exclusions;         /* List of exclusion refCons */
01878     pg_doc_info         doc_info;           /* Info about the page shape */
01879     memory_ref          containers;         /* List of container refCons */
01880     pg_subref           active_subset;      /* - reserved for DSI, do not use - */
01881     pg_subref           subset_focus;       /* - reserved for DSI, do not use - */
01882     long                text_direction;     /* Last known System text direction */
01883     long                lock_id;            /* Used for asynchronous apps */
01884     long                next_id;            /* Used to produce unique "ID" */
01885     long                section_gap;        /* Vertical gap for section */
01886     long                subref_level;       /* Level of editable subrefs (** DSI ONLY **) */
01887     long                notification;       /* Used by Windows custom control */
01888     pg_fixed            hdr_ftr_loc[2];     /* Amount of space from the top of the page for the header and footer (RTF) */
01889     pg_ref              headers[4];         /* Headers section [main, left, right, first] (RTF) */
01890     pg_ref              footers[4];         /* Footers section [main, left, right, first] (RTF) */
01891     pg_ref              last_section;       /* Previous section ( future ) */
01892     pg_ref              next_section;       /* Next section ( future ) */
01893     pg_ref              cur_section;        /* Current section ( future ) */
01894     pg_ref              list_columns;       /* For DSI listbox mode extension */
01895     memory_ref          import_control;     /* Non-null when in "import" mode (set by pgBeginImport) */
01896     memory_ref          custom_control;     /* Used by Windows custom control */
01897     memory_ref          extra_stuff;        /* Used by apps and add-ons */
01898     memory_ref          buf_special;        /* Used for drawing invis spaces, SMALL CAPS, etc. */
01899     memory_ref          subref_stack;       /* Preserves original pg_ref when subset selection made */
01900     memory_ref          extn_mgr;           /* Used by the extensions manager */ // TRS/OITC
01901     memory_ref          authors;            /* Contains list of authors */ // TRS/OITC
01902     memory_ref          bookmarks;          /* Contains list of bookmarks */ // TRS/OITC
01903     memory_ref          annotations;        /* Contains list of annotations */ // TRS/OITC
01904     memory_ref          document_refs;      /* Contains list of document references */ // TRS/OITC
01905     memory_ref          document_info;      /* Contains list of document information */ // TRS/OITC
01906     memory_ref          html_info;          /* Contains list of HTML/SGML information */ // TRS/OITC
01907     pg_list_ref         idle_list;          /* List of all active special idle records */
01908     file_ref            cache_file;         /* Open file ref for disk cache (2.0) */
01909     file_ref            cache_target_file;  /* File we are writing to (if save-doc) 2.0 */
01910     file_io_proc        cache_read_proc;    /* The file read function for disk cache (2.0) */
01911     pg_char_ptr         cache_char_table;   /* Character mapping table for cache-read (2.0) */
01912     long                user_refcon;        /* Can be used by app */
01913 };
01914 
01915 
01916 /************************** Low-level Structs & Utilities ******************/
01917 
01918 /* Record to make it easier to advance through styles: */
01919 
01920 struct style_walk {
01921     long                current_offset; /* Current style offset position */
01922     style_info_ptr      cur_style;      /* Current text style */
01923     par_info_ptr        cur_par_style;  /* Current paragraph style */
01924     font_info_ptr       cur_font;       /* Current font record */
01925     style_run_ptr       next_style_run; /* Next style run record */
01926     style_run_ptr       next_par_run;   /* Next paragraph run record */
01927     style_run_ptr       prev_style_run; /* Previous style run */
01928     style_run_ptr       prev_par_run;   /* Previous paragraph style run */
01929     style_info_ptr      style_base;     /* used internally */
01930     par_info_ptr        par_base;       /* used internally */
01931     font_info_ptr       font_base;      /* used internally */
01932     long                last_font;      /* used internally */
01933     long                t_length;       /* Text size from original pg_ref */
01934     style_info          superimpose;    /* Composite superimpose style */
01935 
01936 /* The following are used only for PG_DEBUG: */
01937 
01938     pg_globals_ptr      globals;        /* Used for checking things in debug mode */
01939     memory_ref          stylerun;       /* Used in debug mode */
01940     memory_ref          parrun;         /* Used in debug mode */
01941     long                max_styles;     /* Used to detect overrun in debug mode */
01942     long                max_pars;       /* Used to detect overrun in debug mode */
01943 };
01944 
01945 /* Inline macros for "GetDefault..." style, para, font: */
01946 
01947 #define pgGetDefaultPar(pg, def_par)  pgGetParInfoRec(pg, 0, def_par)
01948 #define pgGetDefaultFont(pg, def_font)  pgGetFontInfoRec(pg, 0, def_font)
01949 
01950 #ifdef __cplusplus
01951 extern  "C" {
01952 #endif
01953 
01954 
01955 extern PG_PASCAL (void) pgPrepareStyleWalk (paige_rec_ptr pg, long offset,
01956         style_walk_ptr walker, pg_boolean include_pars);
01957 extern PG_PASCAL (pg_boolean) pgWalkNextStyle (style_walk_ptr walker);
01958 extern PG_PASCAL (pg_boolean) pgWalkPreviousStyle (style_walk_ptr walker);
01959 extern PG_PASCAL (pg_boolean) pgWalkStyle (style_walk_ptr walker, long amount);
01960 extern PG_PASCAL (pg_boolean) pgSetWalkStyle (style_walk_ptr walker, long position);
01961 
01962 /* Async Lock/Unlock */
01963 
01964 // 2006-04-04 - kw --- removed parameter names
01965 //extern PG_PASCAL (pg_boolean) pgSetLockID (pg_ref pg, long ID);
01966 extern PG_PASCAL (pg_boolean) pgSetLockID (pg_ref, long);
01967 extern PG_PASCAL (long) pgGetLockID (pg_ref pg);
01968 
01969 
01970 /**************************  Main Functions ***************************/
01971 
01972 
01973 extern PG_PASCAL (void) pgInit (pg_globals_ptr globals, const pgm_globals_ptr mem_globals);
01974 extern PG_PASCAL (void) pgShutdown (const pg_globals_ptr globals);
01975 extern PG_PASCAL (pg_globals_ptr) pgGetGlobals (pg_ref pg);
01976 extern PG_PASCAL (void) pgSetStandardProcs (pg_globals_ptr globals);
01977 extern PG_PASCAL (pg_ref) pgNew (const pg_globals_ptr globals, const generic_var def_device,
01978         shape_ref vis_area, shape_ref page_area, shape_ref exclude_area,
01979         long attributes);
01980 extern PG_PASCAL (pg_ref) pgNewShared (pg_ref shared_from, const generic_var def_device,
01981         shape_ref vis_area, shape_ref page_area, shape_ref exclude_area,
01982         long attributes);
01983 extern PG_PASCAL (void) pgSetAuthor (pg_ref pg, long author);
01984 extern PG_PASCAL (long) pgGetAuthor (pg_ref pg);
01985 extern PG_PASCAL (long) pgGetType (pg_ref pg);
01986 extern PG_PASCAL (void) pgSetType (pg_ref pg, long new_type);
01987 extern PG_PASCAL (long) pgUniqueID (pg_ref pg);
01988 extern PG_PASCAL (void) pgDispose (pg_ref pg);
01989 extern PG_PASCAL (void) pgFailureDispose (pg_ref pg);
01990 extern PG_PASCAL (pg_ref) pgNewShell (const pg_globals_ptr globals);
01991 extern PG_PASCAL (pg_ref) pgDuplicate (pg_ref pg);
01992 extern PG_PASCAL (void) pgShareRefs (pg_ref pg, pg_ref shared_from, long shared_flags);
01993 extern PG_PASCAL (void) pgSetDefaultDevice (pg_ref pg, const graf_device_ptr device);
01994 extern PG_PASCAL (void) pgGetDefaultDevice (pg_ref pg, graf_device_ptr device);
01995 extern PG_PASCAL (void) pgInitDevice (const pg_globals_ptr globals, const generic_var the_port,
01996         long machine_ref, graf_device_ptr device);
01997 extern PG_PASCAL (void) pgInitSameDevice (pg_ref pg, const graf_device_ptr device);
01998 extern PG_PASCAL (void) pgCloseDevice (const pg_globals_ptr globals, const graf_device_ptr device);
01999 extern PG_PASCAL (generic_var) pgSetDrawingDevice (pg_ref pg, const generic_var draw_device);
02000 extern PG_PASCAL (generic_var) pgSetScaledDrawingDevice (pg_ref pg, const generic_var draw_device,
02001         pg_scale_ptr scale);
02002 extern PG_PASCAL (void) pgReleaseDrawingDevice (pg_ref pg, const generic_var previous_device);
02003 extern PG_PASCAL (void) pgSetDevicePalette (pg_ref pg, const generic_var palette);
02004 extern PG_PASCAL (generic_var) pgGetDevicePalette (pg_ref pg);
02005 extern PG_PASCAL (void) pgSetOrigin (pg_ref pg, const co_ordinate_ptr origin);
02006 extern PG_PASCAL (void) pgGetOrigin (pg_ref pg, co_ordinate_ptr origin);
02007 extern PG_PASCAL (void) pgSetAreas (pg_ref pg, shape_ref vis_area, shape_ref page_area,
02008         shape_ref exclude_area);
02009 extern PG_PASCAL (void) pgGetAreas (pg_ref pg, shape_ref vis_area, shape_ref page_area,
02010         shape_ref exclude_area);
02011 extern PG_PASCAL (void) pgAreaBounds (pg_ref pg, rectangle_ptr page_bounds,
02012         rectangle_ptr vis_bounds);
02013 extern PG_PASCAL (void) pgSetAreaBounds (pg_ref pg, const rectangle_ptr page_bounds,
02014         const rectangle_ptr vis_bounds);
02015 extern PG_PASCAL (shape_ref) pgGetPageArea (pg_ref pg);
02016 extern PG_PASCAL (shape_ref) pgGetVisArea (pg_ref pg);
02017 extern PG_PASCAL (shape_ref) pgGetExcludeArea (pg_ref pg);
02018 extern PG_PASCAL (void) pgOffsetAreas (pg_ref pg, long h, long v, pg_boolean offset_page,
02019         pg_boolean offset_vis, pg_boolean offset_exclude);
02020 extern PG_PASCAL (void) pgWindowOriginChanged (pg_ref pg, const co_ordinate_ptr original_origin,
02021         co_ordinate_ptr new_origin);
02022 extern PG_PASCAL (long) pgGetAttributes (pg_ref pg);
02023 extern PG_PASCAL (pg_boolean) pgSetAttributes (pg_ref pg, long attributes);
02024 extern PG_PASCAL (long) pgGetAttributes2 (pg_ref pg);
02025 extern PG_PASCAL (pg_boolean) pgSetAttributes2 (pg_ref pg, long attributes2);
02026 extern PG_PASCAL (void) pgGrowVisArea (pg_ref pg, const co_ordinate_ptr top_left, const co_ordinate_ptr bot_right);
02027 extern PG_PASCAL (void) pgSetHooks (pg_ref pg, const pg_hooks PG_FAR *hooks, pg_boolean inval_text);
02028 extern PG_PASCAL (void) pgGetHooks (pg_ref pg, pg_hooks PG_FAR *hooks);
02029 extern PG_PASCAL (void) pgSetExtraStruct (pg_ref pg, const void PG_FAR *extra_struct, long ref_id);
02030 extern PG_PASCAL (void PG_FAR *) pgGetExtraStruct (pg_ref pg, long ref_id);
02031 extern PG_PASCAL (long) pgExtraUniqueID (pg_ref pg);
02032 extern PG_PASCAL (void) pgDisplay (pg_ref pg, const graf_device_ptr target_device, shape_ref vis_target,
02033         shape_ref wrap_target, const co_ordinate_ptr offset_extra, short draw_mode);
02034 extern PG_PASCAL (void) pgTextboxDisplay (pg_ref pg, paige_rec_ptr target_pg, const rectangle_ptr target_box,
02035         const rectangle_ptr wrap_rect, short draw_mode);
02036 extern PG_PASCAL (pg_boolean) pgInsert (pg_ref pg, const pg_char_ptr data, long length, long position,
02037         short insert_mode, short modifiers, short draw_mode);
02038 extern PG_PASCAL (pg_boolean) pgInsertText (pg_ref pg, pg_char_ptr data, long length,
02039         font_info_ptr font, style_info_ptr style, par_info_ptr paragraph, short draw_mode);
02040 extern PG_PASCAL (void) pgBeginImport (pg_ref pg, long import_position);
02041 extern PG_PASCAL (void) pgEndImport (pg_ref pg, pg_boolean keep_selection, short draw_mode);
02042 extern PG_PASCAL (pg_boolean) pgIdle (pg_ref pg);
02043 extern PG_PASCAL (pg_boolean) pgGlobalIdle (pg_globals_ptr globals);
02044 extern PG_PASCAL (pg_boolean) pgInsertPendingKeys (pg_ref pg);
02045 extern PG_PASCAL (long) pgDragSelect (pg_ref pg, const co_ordinate_ptr location, short verb,
02046         short modifiers, long track_refcon, pg_boolean auto_scroll);
02047 extern PG_PASCAL (void) pgSetHiliteStates (pg_ref pg, short front_back_state,
02048         short perm_state, pg_boolean should_draw);
02049 extern PG_PASCAL (void) pgGetHiliteStates (pg_ref pg, short PG_FAR *front_back_state,
02050         short PG_FAR *perm_state);
02051 extern PG_PASCAL (long) pgGetStyleInfo (pg_ref pg, const select_pair_ptr selection,
02052         pg_boolean set_any_match, style_info_ptr info, style_info_ptr mask);
02053 extern PG_PASCAL (pg_boolean) pgFindStyleInfo (pg_ref pg, long PG_FAR *begin_position,
02054         long PG_FAR *end_position, style_info_ptr match_style, style_info_ptr mask,
02055         style_info_ptr AND_mask);
02056 extern PG_PASCAL (void) pgSetStyleInfo (pg_ref pg, const select_pair_ptr selection,
02057         const style_info_ptr info, const style_info_ptr mask,  short draw_mode);
02058 extern PG_PASCAL (long) pgGetStyleClassInfo (pg_ref pg, long position, select_pair_ptr style_range);
02059 extern PG_PASCAL (void) pgSetStyleClassInfo (pg_ref pg, const select_pair_ptr range, long class_AND,
02060         long class_OR, short draw_mode);
02061 extern PG_PASCAL (void) pgSetInsertionStyles (pg_ref pg, const style_info_ptr style, const font_info_ptr font);
02062 extern PG_PASCAL (long) pgGetParInfo (pg_ref pg, const select_pair_ptr selection,
02063         pg_boolean set_any_match, par_info_ptr info, par_info_ptr mask);
02064 extern PG_PASCAL (void) pgSetParInfo (pg_ref pg, const select_pair_ptr selection,
02065         const par_info_ptr info, const par_info_ptr mask, short draw_mode);
02066 extern PG_PASCAL (void) pgSetFontInfo (pg_ref pg, const select_pair_ptr selection,
02067         const font_info_ptr info, const font_info_ptr mask, short draw_mode);
02068 extern PG_PASCAL (void) pgSetStyleAndFont (pg_ref pg, const select_pair_ptr selection,
02069         const style_info_ptr the_style, const style_info_ptr style_mask,
02070         const font_info_ptr font, const font_info_ptr font_mask, short draw_mode);
02071 extern PG_PASCAL (long) pgGetFontInfo (pg_ref pg, const select_pair_ptr selection,
02072         pg_boolean set_any_match, font_info_ptr info, font_info_ptr mask);
02073 extern PG_PASCAL (font_ref) pgGetFontTable (pg_ref pg);
02074 extern PG_PASCAL (short) pgCrossFont (pg_ref src_pg, pg_ref new_pg, short src_index);
02075 extern PG_PASCAL (void) pgInitStyleMask (style_info_ptr mask, short filler);
02076 extern PG_PASCAL (void) pgInitParMask (par_info_ptr mask, short filler);
02077 extern PG_PASCAL (void) pgInitFontMask (font_info_ptr mask, short filler);
02078 extern PG_PASCAL (void) pgSetStyleProcs (pg_ref pg, const pg_style_hooks PG_FAR *procs,
02079         const style_info_ptr match_style, const style_info_ptr mask_style,
02080         const style_info_ptr AND_style, long user_data, long user_id,
02081         pg_boolean inval_text, short draw_mode);
02082 extern PG_PASCAL (void) pgSetParProcs (pg_ref pg, const pg_par_hooks PG_FAR *procs,
02083         const par_info_ptr match_style, const par_info_ptr mask_style,
02084         const par_info_ptr AND_style, long user_data, long user_id,
02085         pg_boolean inval_text, short draw_mode);
02086 extern PG_PASCAL (long) pgPtToStyleInfo (pg_ref pg, const co_ordinate_ptr point,
02087         short conversion_info, style_info_ptr style, select_pair_ptr range);
02088 extern PG_PASCAL (void) pgGetStyleInfoRec (pg_ref pg, short style_item, style_info_ptr format);
02089 extern PG_PASCAL (void) pgGetParInfoRec (pg_ref pg, short style_item, par_info_ptr format);
02090 extern PG_PASCAL (void) pgGetFontInfoRec (pg_ref pg, short font_index, font_info_ptr info);
02091 extern PG_PASCAL (void) pgSetTabBase (pg_ref pg, long tab_base);
02092 extern PG_PASCAL (long) pgGetTabBase (pg_ref pg);
02093 extern PG_PASCAL (void) pgSetTab (pg_ref pg, const select_pair_ptr selection, const tab_stop_ptr tab_ptr,
02094         short draw_mode);
02095 extern PG_PASCAL (void) pgGetTabList (pg_ref pg, const select_pair_ptr selection, tab_ref tabs,
02096         memory_ref tab_mask, long PG_FAR *screen_offset);
02097 extern PG_PASCAL (void) pgSetTabList (pg_ref pg, const select_pair_ptr selection, tab_ref tabs,
02098         memory_ref tab_mask, short draw_mode);
02099 extern PG_PASCAL (void) pgSetSpecialTabFlags (pg_ref pg, const select_pair_ptr selection,
02100         memory_ref tab_flags, pg_boolean inval_text, short draw_mode);
02101 extern PG_PASCAL (void) pgClearSpecialTabFlags (pg_ref pg, const select_pair_ptr selection,
02102         pg_boolean inval_text, short draw_mode);
02103 extern PG_PASCAL (long) pgParMaxWidth (pg_ref pg, long position);
02104 extern PG_PASCAL (void) pgGetIndents (pg_ref pg, const select_pair_ptr selection, pg_indents_ptr indents,
02105         pg_indents_ptr mask, long PG_FAR *left_screen_offset, long PG_FAR *right_screen_offset);
02106 extern PG_PASCAL (void) pgSetIndents (pg_ref pg, const select_pair_ptr selection, const pg_indents_ptr indents,
02107         const pg_indents_ptr mask, short draw_mode);
02108 extern PG_PASCAL (short) pgNewStyle (pg_ref pg, const style_info_ptr new_style, const font_info_ptr style_font);
02109 extern PG_PASCAL (void) pgRemoveStyle (pg_ref pg, short style_id);
02110 extern PG_PASCAL (short) pgNumStyles (pg_ref pg);
02111 extern PG_PASCAL (short) pgMaxStylesheetID (pg_ref pg);
02112 extern PG_PASCAL (pg_boolean) pgGetStyle (pg_ref pg, short style_id, style_info_ptr style);
02113 extern PG_PASCAL (void) pgChangeStyle (pg_ref pg, short style_id, const style_info_ptr style,
02114         const font_info_ptr style_font, short draw_mode);
02115 extern PG_PASCAL (void) pgSetStyleSheet (pg_ref pg, const select_pair_ptr selection,
02116         short style_id, short draw_mode);
02117 extern PG_PASCAL (pg_boolean) pgGetStyleSheet (pg_ref pg, const select_pair_ptr selection, short PG_FAR *style_id);
02118 extern PG_PASCAL (short) pgFindStyleSheet (pg_ref pg, const style_info_ptr compare_style,
02119         const style_info_ptr mask);
02120 
02121 // 2006-04-04 - kw --- removed parameter names
02122 // extern PG_PASCAL (short) pgGetIndStyleSheet (pg_ref pg, short index, style_info_ptr stylesheet);
02123 extern PG_PASCAL (short) pgGetIndStyleSheet (pg_ref, short, style_info_ptr);
02124 
02125 extern PG_PASCAL (short) pgNewParStyle (pg_ref pg, const par_info_ptr new_style);
02126 extern PG_PASCAL (void) pgRemoveParStyle (pg_ref pg, short style_id);
02127 extern PG_PASCAL (short) pgNumParStyles (pg_ref pg);
02128 extern PG_PASCAL (short) pgMaxParStylesheetID (pg_ref pg);
02129 extern PG_PASCAL (pg_boolean) pgGetParStyle (pg_ref pg, short style_id, par_info_ptr style);
02130 extern PG_PASCAL (void) pgChangeParStyle (pg_ref pg, short style_id, const par_info_ptr style,
02131         short draw_mode);
02132 extern PG_PASCAL (void) pgSetParStyleSheet (pg_ref pg, const select_pair_ptr selection,
02133         short style_id, short draw_mode);
02134 extern PG_PASCAL (pg_boolean) pgGetParStyleSheet (pg_ref pg, const select_pair_ptr selection, short PG_FAR *style_id);
02135 extern PG_PASCAL (short) pgFindParStyleSheet (pg_ref pg, const par_info_ptr compare_style,
02136         const par_info_ptr mask);
02137 
02138 // 2006-04-04 - kw --- removed parameter names
02139 // extern PG_PASCAL (short) pgGetIndParStyleSheet (pg_ref pg, short index, par_info_ptr stylesheet);
02140 extern PG_PASCAL (short) pgGetIndParStyleSheet (pg_ref, short, par_info_ptr);
02141 
02142 extern PG_PASCAL (long) pgNewNamedStyle (pg_ref pg, pg_c_string_ptr stylename, const style_info_ptr style,
02143         const font_info_ptr font, par_info_ptr par);
02144 extern PG_PASCAL (long) pgAddNamedStyle (pg_ref pg, pg_c_string_ptr stylename, const short style_id, const short par_id);
02145 extern PG_PASCAL (void) pgApplyNamedStyle (pg_ref pg, select_pair_ptr selection, pg_c_string_ptr stylename,
02146         short draw_mode);
02147 
02148 // 2006-04-04 - kw --- removed parameter names
02149 // extern PG_PASCAL (void) pgApplyNamedStyleIndex (pg_ref pg, select_pair_ptr selection, long index, short draw_mode);
02150 extern PG_PASCAL (void) pgApplyNamedStyleIndex (pg_ref, select_pair_ptr, long, short);
02151 
02152 extern PG_PASCAL (long) pgNumNamedStyles (pg_ref pg);
02153 extern PG_PASCAL (long) pgGetNamedStyleIndex (pg_ref pg, pg_c_string_ptr stylename);
02154 
02155 // 2006-04-04 - kw --- removed parameter names
02156 // extern PG_PASCAL (void) pgGetNamedStyleInfo (pg_ref pg, long index, style_info_ptr style, font_info_ptr font, par_info_ptr par);
02157 extern PG_PASCAL (void) pgGetNamedStyleInfo (pg_ref, long, style_info_ptr, font_info_ptr, par_info_ptr);
02158 
02159 extern PG_PASCAL (pg_boolean) pgGetNamedStyle (pg_ref pg, long named_style_index, named_stylesheet_ptr named_style);
02160 extern PG_PASCAL (pg_boolean) pgGetAppliedNamedStyle (pg_ref pg, select_pair_ptr selection, pg_c_string_ptr stylename);
02161 extern PG_PASCAL (void) pgDeleteNamedStyle (pg_ref pg, long named_style_index);
02162 extern PG_PASCAL (void) pgRenameStyle (pg_ref pg, long named_style_index, pg_c_string_ptr style_name);
02163 extern PG_PASCAL (void) pgSetDefaultNamedStyle (pg_ref pg, long def_index);
02164 extern PG_PASCAL (long) pgGetDefaultNamedStyle (pg_ref pg);
02165 extern PG_PASCAL (pg_boolean) pgMergeText (pg_ref pg, const style_info_ptr matching_style,
02166         const style_info_ptr mask, const style_info_ptr AND_mask, long ref_con, short draw_mode);
02167 extern PG_PASCAL (void) pgRestoreMerge (pg_ref pg, pg_boolean revert_original, short draw_mode);
02168 extern PG_PASCAL (pg_ref) pgCut (pg_ref pg, const select_pair_ptr selection, short draw_mode);
02169 extern PG_PASCAL (pg_ref) pgCopy (pg_ref pg, const select_pair_ptr selection);
02170 extern PG_PASCAL (text_ref) pgCopyText (pg_ref pg, const select_pair_ptr selection, short data_type);
02171 extern PG_PASCAL (void) pgPaste (pg_ref pg, pg_ref paste_ref, long position,
02172         short text_only, short draw_mode);
02173 extern PG_PASCAL (void) pgDelete (pg_ref pg, const select_pair_ptr delete_range, short draw_mode);
02174 extern PG_PASCAL (undo_ref) pgPrepareUndo (pg_ref pg, short verb, void PG_FAR *insert_ref);
02175 extern PG_PASCAL (undo_ref) pgUndo (pg_ref pg, undo_ref ref, pg_boolean requires_redo,
02176         short draw_mode);
02177 extern PG_PASCAL (short) pgUndoType (undo_ref ref);
02178 extern PG_PASCAL (void) pgSetUndoRefCon (undo_ref ref, long refCon);
02179 extern PG_PASCAL (long) pgGetUndoRefCon (undo_ref ref);
02180 extern PG_PASCAL (void) pgDisposeUndo (undo_ref ref);
02181 extern PG_PASCAL (pg_char_ptr) pgExamineText (pg_ref pg, long offset, text_ref *text, long PG_FAR *length);
02182 extern PG_PASCAL (long) pgNumTextblocks (pg_ref pg);
02183 extern PG_PASCAL (long) pgGetTextblock (pg_ref pg, long offset, text_block_ptr block,
02184         pg_boolean want_pagination);
02185 extern PG_PASCAL (long) pgCharType (pg_ref pg, long offset, long mask_bits);
02186 extern PG_PASCAL (pg_short_t) pgCharByte (pg_ref pg, long offset, pg_char_ptr char_bytes);
02187 extern PG_PASCAL (long) pgTextSize (pg_ref pg);
02188 extern PG_PASCAL (void) pgFindWord (pg_ref pg, long offset, long PG_FAR *first_byte,
02189         long PG_FAR *last_byte, pg_boolean left_side, pg_boolean smart_select);
02190 extern PG_PASCAL (void) pgFindCtlWord (pg_ref pg, long offset, long PG_FAR *first_byte,
02191         long PG_FAR *last_byte, short left_side);
02192 extern PG_PASCAL (void) pgFindPar (pg_ref pg, long offset, long PG_FAR *first_byte,
02193         long PG_FAR *last_byte);
02194 extern PG_PASCAL (void) pgFindLine (pg_ref pg, long offset, long PG_FAR *first_byte,
02195         long PG_FAR *last_byte);
02196 extern PG_PASCAL (long) pgFindCharType (pg_ref pg, long char_info, long PG_FAR *offset, pg_char_ptr the_byte);
02197 extern PG_PASCAL (void) pgGetSelection (pg_ref pg, long PG_FAR *begin_sel, long PG_FAR *end_sel);
02198 extern PG_PASCAL (void) pgSetSelection (pg_ref pg, long begin_sel, long end_sel,
02199         short modifiers, pg_boolean show_hilite);
02200 extern PG_PASCAL (memory_ref) pgGetSelectionList (pg_ref pg, pg_boolean for_paragraph);
02201 extern PG_PASCAL (void) pgSetSelectionList (pg_ref pg, memory_ref select_list,
02202         long extra_offset, pg_boolean show_hilite);
02203 extern PG_PASCAL (void) pgExtendSelection (pg_ref pg, long amount_ext, short modifiers,
02204             pg_boolean show_hilite);
02205 extern PG_PASCAL (pg_boolean) pgGetHiliteRgn (pg_ref pg, const select_pair_ptr range,
02206         memory_ref select_list, shape_ref rgn);
02207 extern PG_PASCAL (pg_short_t) pgNumSelections (pg_ref pg);
02208 extern PG_PASCAL (pg_boolean) pgCaretPosition (pg_ref pg, long offset, rectangle_ptr caret_rect);
02209 extern PG_PASCAL (void) pgSetCaretPosition (pg_ref pg, pg_short_t position_verb, pg_boolean show_caret);
02210 extern PG_PASCAL (void) pgSetCursorState (pg_ref pg, short cursor_state);
02211 extern PG_PASCAL (short) pgGetCursorState (pg_ref pg);
02212 extern PG_PASCAL (long) pgGetChangeCtr (pg_ref pg);
02213 extern PG_PASCAL (void) pgSetChangeCtr (pg_ref pg, long ctr);
02214 extern PG_PASCAL (short) pgTextRect (pg_ref pg, const select_pair_ptr range, pg_boolean want_scroll,
02215         pg_boolean want_scaled, rectangle_ptr rect);
02216 extern PG_PASCAL (short) pgCharacterRect (pg_ref pg, long position, pg_boolean want_scrolled,
02217         pg_boolean want_scaled, rectangle_ptr rect);
02218 extern PG_PASCAL (long) pgPtToChar (pg_ref pg, const co_ordinate_ptr point, const co_ordinate_ptr offset_extra);
02219 extern PG_PASCAL (short) pgPtInView (pg_ref pg, const co_ordinate_ptr point,
02220         const co_ordinate_ptr offset_extra);
02221 extern PG_PASCAL (long) pgTotalTextHeight (pg_ref pg, short paginate);
02222 extern PG_PASCAL (void) pgMaxTextBounds (pg_ref pg, rectangle_ptr bounds, pg_boolean paginate);
02223 extern PG_PASCAL (void) pgPaginateNow (pg_ref pg, long paginate_to, pg_boolean use_best_guess);
02224 extern PG_PASCAL (void) pgSelectToShape (pg_ref pg, memory_ref select_shape,
02225         pg_boolean show_hilite);
02226 extern PG_PASCAL (void) pgSetScaling (pg_ref pg, const pg_scale_ptr scale_factor, short draw_mode);
02227 extern PG_PASCAL (void) pgGetScaling (pg_ref pg, pg_scale_ptr scale_factor);
02228 extern PG_PASCAL (pg_boolean) pgSetPrintDevice (pg_ref pg, generic_var device);
02229 extern PG_PASCAL (generic_var) pgGetPrintDevice (pg_ref pg);
02230 extern PG_PASCAL (long) pgPrintToPage (pg_ref pg, const graf_device_ptr target, long starting_position,
02231         const rectangle_ptr page_rect, short draw_mode);
02232 extern PG_PASCAL (short) pgNumPages (pg_ref pg, const rectangle_ptr page_rect);
02233 extern PG_PASCAL (long) pgFindPage (pg_ref pg, short page_num, const rectangle_ptr page_rect);
02234 extern PG_PASCAL (void) pgInitStandardHandlers (pg_globals_ptr globals);
02235 extern PG_PASCAL (void) pgSetHandler (pg_globals_ptr globals, pg_file_key key,
02236         pg_handler_proc read_handler, pg_handler_proc write_handler,
02237         file_io_proc read_data_proc, file_io_proc write_data_proc);
02238 extern PG_PASCAL (pg_error) pgGetHandler (pg_globals_ptr globals, pg_handler_ptr handler);
02239 extern PG_PASCAL (pg_error) pgRemoveHandler (pg_globals_ptr globals,
02240         pg_file_key key);
02241 extern PG_PASCAL (pg_error) pgSaveDoc (pg_ref pg, long PG_FAR *file_position, const pg_file_key_ptr keys,
02242         pg_short_t num_keys, file_io_proc write_proc, file_ref filemap,
02243         long doc_element_info);
02244 extern PG_PASCAL (pg_error) pgVerifyFile (file_ref filemap, file_io_proc io_proc, long position);
02245 extern PG_PASCAL (pg_error) pgReadDoc (pg_ref pg, long PG_FAR *file_position, const pg_file_key_ptr keys,
02246         pg_short_t num_keys, file_io_proc read_proc, file_ref filemap);
02247 extern PG_PASCAL (pg_error) pgCacheReadDoc (pg_ref pg, long PG_FAR *file_position, const pg_file_key_ptr keys,
02248         pg_short_t num_keys, file_io_proc read_proc, file_ref filemap);
02249 extern PG_PASCAL (file_ref) pgGetCacheFileRef (pg_ref pg);
02250 extern PG_PASCAL (pg_error) pgCacheSaveDoc (pg_ref pg, long PG_FAR *file_position, const pg_file_key_ptr keys,
02251         pg_short_t num_keys, file_io_proc write_proc, file_ref filemap,
02252         long doc_element_info);
02253 extern PG_PASCAL (pg_error) pgTerminateFile (pg_ref pg, long PG_FAR *file_position,
02254         file_io_proc write_proc, file_ref filemap);
02255 extern PG_PASCAL (void) pgOffsetShape (shape_ref the_shape, long h, long v);
02256 extern PG_PASCAL (void) pgInsetShape (shape_ref the_shape, long h, long v);
02257 extern PG_PASCAL (pg_short_t) pgPtInShape (shape_ref the_shape, const co_ordinate_ptr point,
02258         const co_ordinate_ptr offset_extra, const co_ordinate_ptr inset_extra,
02259         const pg_scale_ptr scaling);
02260 extern PG_PASCAL (pg_boolean) pgRectInShape (shape_ref the_shape, const rectangle_ptr rect,
02261         const co_ordinate_ptr offset_extra, rectangle_ptr sect_rect);
02262 extern PG_PASCAL (void) pgShapeToSelections (pg_ref pg, shape_ref the_shape, memory_ref selections);
02263 extern PG_PASCAL (pg_boolean) pgEmptyShape (shape_ref the_shape);
02264 extern PG_PASCAL (pg_boolean) pgEqualShapes (shape_ref shape1, shape_ref shape2);
02265 extern PG_PASCAL (pg_short_t) pgSectRectInShape (shape_ref the_shape, rectangle_ptr rect,
02266         rectangle_ptr sect_rect);
02267 extern PG_PASCAL (pg_short_t) pgSectOrTouchRectInShape (shape_ref the_shape,
02268         const rectangle_ptr rect, const rectangle_ptr sect_rect);
02269 extern PG_PASCAL (void) pgShapeBounds (shape_ref the_shape, rectangle_ptr bounds);
02270 extern PG_PASCAL (pg_short_t) pgNumRectsInShape (shape_ref the_shape);
02271 extern PG_PASCAL (pg_boolean) pgSectShape (shape_ref shape1, shape_ref shape2,
02272         shape_ref result_shape);
02273 extern PG_PASCAL (void) pgDiffShape (shape_ref shape1, shape_ref shape2,
02274         shape_ref result_shape);
02275 extern PG_PASCAL (shape_ref) pgRectToShape (pgm_globals_ptr mem_globals, const rectangle_ptr rect);
02276 extern PG_PASCAL (void) pgAddRectToShape (shape_ref the_shape, const rectangle_ptr rect);
02277 extern PG_PASCAL (void) pgMergeRectToShape (shape_ref the_shape, const rectangle_ptr rect);
02278 extern PG_PASCAL (void) pgSetShapeRect (shape_ref the_shape, const rectangle_ptr rect);
02279 extern PG_PASCAL (void) pgEraseShape (pg_ref pg, shape_ref the_shape, const pg_scale_ptr scale_factor,
02280         const co_ordinate_ptr offset_extra, const rectangle_ptr vis_bounds);
02281 extern PG_PASCAL (void) pgDisposeShape (shape_ref the_shape);
02282 extern PG_PASCAL (void) pgInvalSelect (pg_ref pg, long select_from, long select_to);
02283 extern PG_PASCAL (void) pgInvalShapes (pg_ref pg, pg_boolean inval_page, pg_boolean inval_exclusion);
02284 extern PG_PASCAL (void) pgGetDocInfo (pg_ref pg, pg_doc_ptr doc_info);
02285 extern PG_PASCAL (void) pgSetDocInfo (pg_ref pg, const pg_doc_ptr doc_info,
02286         pg_boolean inval_text, short draw_mode);
02287 extern PG_PASCAL (void) pgSetPageColor (pg_ref pg, const color_value_ptr color);
02288 extern PG_PASCAL (void) pgGetPageColor (pg_ref pg, color_value_ptr color);
02289 extern PG_PASCAL (void) pgErasePageArea (pg_ref pg, shape_ref vis_area);
02290 extern PG_PASCAL (long) pgGetEndingPage (pg_ref pg, rectangle_ptr page_rect);
02291 
02292 /* Scrolling & alternate scrolling method support: */
02293 
02294 extern PG_PASCAL (void) pgSetScrollParams (pg_ref pg, short unit_h, short unit_v,
02295         short append_h, short append_v);
02296 extern PG_PASCAL (void) pgGetScrollParams (pg_ref pg, short PG_FAR *unit_h, short PG_FAR *unit_v,
02297         short PG_FAR *append_h, short PG_FAR *append_v);
02298 extern PG_PASCAL (pg_boolean) pgGetScrollValues (pg_ref pg, short PG_FAR *h, short PG_FAR *v,
02299         short PG_FAR *max_h, short PG_FAR *max_v);
02300 extern PG_PASCAL (void) pgSetScrollValues (pg_ref pg, short h, short v, short align_line,
02301         short draw_mode);
02302 extern PG_PASCAL (void) pgScroll (pg_ref pg, short h_verb, short v_verb, short draw_mode);
02303 extern PG_PASCAL (pg_boolean) pgAdjustScrollMax (pg_ref pg, short draw_mode);
02304 extern PG_PASCAL (void) pgScrollUnitsToPixels (pg_ref pg, short h_verb, short v_verb,
02305         pg_boolean add_to_position, pg_boolean window_origin_changes,
02306         long PG_FAR *h_pixels, long PG_FAR *v_pixels);
02307 extern PG_PASCAL (void) pgLastScrollAmount (pg_ref pg, long *h_pixels, long *v_pixels);
02308 extern PG_PASCAL (void) pgDrawScrolledArea (pg_ref pg, long pixels_h, long pixels_v,
02309         const co_ordinate_ptr original_origin, const co_ordinate_ptr new_origin, short draw_mode);
02310 extern PG_PASCAL (pg_boolean) pgScrollToView (pg_ref pg, long text_offset, short h_extra,
02311         short v_extra, pg_boolean align_line, short draw_mode);
02312 extern PG_PASCAL (pg_region) pgScrollViewRect (pg_ref pg, long h_pixels, long v_pixels);
02313 extern PG_PASCAL (void) pgScrollPosition (pg_ref pg, co_ordinate_ptr scroll_pos);
02314 extern PG_PASCAL (void) pgScrollPixels (pg_ref pg, long h, long v, short draw_mode);
02315 extern PG_PASCAL (void) pgSetScrollAlign (pg_ref pg, short align_h, short align_v);
02316 extern PG_PASCAL (void) pgGetScrollAlign (pg_ref pg, short PG_FAR *align_h,
02317         short PG_FAR *align_v);
02318 
02319 
02320 /* "Containers" Support: */
02321 
02322 extern PG_PASCAL (pg_short_t) pgNumContainers (pg_ref pg);
02323 extern PG_PASCAL (void) pgGetContainer (pg_ref pg, pg_short_t position,
02324         pg_boolean include_scroll, pg_boolean include_scale,
02325         rectangle_ptr container);
02326 extern PG_PASCAL (long) pgGetContainerRefCon (pg_ref pg, pg_short_t position);
02327 extern PG_PASCAL (void) pgSetContainerRefCon (pg_ref pg, pg_short_t position, long ref_con);
02328 extern PG_PASCAL (pg_short_t) pgPtInContainer (pg_ref pg, const co_ordinate_ptr point,
02329         const co_ordinate_ptr inset_extra);
02330 extern PG_PASCAL (void) pgInsertContainer (pg_ref pg, const rectangle_ptr container,
02331         pg_short_t position, long ref_con, short draw_mode);
02332 extern PG_PASCAL (void) pgRemoveContainer (pg_ref pg, pg_short_t position,
02333         short draw_mode);
02334 extern PG_PASCAL (void) pgReplaceContainer (pg_ref pg, const rectangle_ptr container,
02335         pg_short_t position, short draw_mode);
02336 extern PG_PASCAL (void) pgSwapContainers (pg_ref pg, pg_short_t container1,
02337         pg_short_t container2, short draw_mode);
02338 extern PG_PASCAL (pg_short_t) pgCharToContainer (pg_ref pg, long offset);
02339 extern PG_PASCAL (long) pgContainerToChar (pg_ref pg, pg_short_t position);
02340 
02341 /* "Exclusion Area" Support (for graphics, layout, etc. ) */
02342 
02343 extern PG_PASCAL (pg_short_t) pgNumExclusions (pg_ref pg);
02344 extern PG_PASCAL (void) pgGetExclusion (pg_ref pg, pg_short_t position,
02345         pg_boolean include_scroll, pg_boolean include_scale,
02346         rectangle_ptr exclusion);
02347 extern PG_PASCAL (long) pgGetExclusionRefCon (pg_ref pg, pg_short_t position);
02348 extern PG_PASCAL (void) pgSetExclusionRefCon (pg_ref pg, pg_short_t position, long ref_con);
02349 extern PG_PASCAL (pg_short_t) pgPtInExclusion (pg_ref pg, const co_ordinate_ptr point,
02350         const co_ordinate_ptr inset_extra);
02351 extern PG_PASCAL (void) pgInsertExclusion (pg_ref pg, const rectangle_ptr exclusion,
02352         pg_short_t position, long ref_con, short draw_mode);
02353 extern PG_PASCAL (void) pgRemoveExclusion (pg_ref pg, pg_short_t position,
02354         short draw_mode);
02355 extern PG_PASCAL (void) pgReplaceExclusion (pg_ref pg, const rectangle_ptr exclusion,
02356         pg_short_t position, short draw_mode);
02357 extern PG_PASCAL (void) pgSwapExclusions (pg_ref pg, pg_short_t exclusion1,
02358         pg_short_t exclusion2, short draw_mode);
02359 extern PG_PASCAL (void) pgInsertExclusionShape (pg_ref pg, pg_short_t position,
02360         shape_ref exclude_shape, short draw_mode);
02361 
02362 // 2006-04-04 - kw --- removed parameter names
02363 // extern PG_PASCAL (void) pgAttachParExclusion (pg_ref pg, long position, pg_short_t index, short draw_mode);
02364 extern PG_PASCAL (void) pgAttachParExclusion (pg_ref, long, pg_short_t, short);
02365 
02366 extern PG_PASCAL (long) pgGetAttachedPar (pg_ref pg, pg_short_t exclusion);
02367 
02368 
02369 /* Misc. Utilities */
02370 
02371 extern PG_PASCAL (void) pgScaleLong (long scale_factor, long origin, long PG_FAR *value);
02372 extern PG_PASCAL (void) pgScalePt (const pg_scale_ptr scale_gactor, const co_ordinate_ptr amount_offset, co_ordinate_ptr pt);
02373 extern PG_PASCAL (void) pgScaleRect (const pg_scale_ptr scale_factor, const co_ordinate_ptr amount_offset, rectangle_ptr rect);
02374 extern PG_PASCAL (void) pgScaleRectToRect (const pg_scale_ptr scale_factor, const rectangle_ptr src_rect,
02375             rectangle_ptr target_rect, const co_ordinate_ptr offset_extra);
02376 
02377 extern PG_PASCAL (long) pgGetPaigeRefID(pg_ref pg);
02378 
02379 /* Note, "pgGetDefault..." for functions below are defined as macros */
02380 
02381 extern PG_PASCAL (void) pgSetDefaultStyle (pg_ref pg, const style_info_ptr def_style, short draw_mode);
02382 extern PG_PASCAL (void) pgSetDefaultPar (pg_ref pg, const par_info_ptr def_par, short draw_mode);
02383 extern PG_PASCAL (void) pgSetDefaultFont (pg_ref pg, const font_info_ptr def_font, short draw_mode);
02384 extern PG_PASCAL (pg_short_t) pgGetDefaultStyle (pg_ref pg, style_info_ptr def_style);
02385 
02386 /* Line and paragraph count utilities */
02387 
02388 extern PG_PASCAL (long) pgNumLines (pg_ref pg);
02389 extern PG_PASCAL (long) pgOffsetToLineNum (pg_ref pg, long offset,
02390         pg_boolean line_end_has_precedence);
02391 extern PG_PASCAL (void) pgLineNumToOffset (pg_ref pg, long line_num,
02392         long PG_FAR *begin_offset, long PG_FAR *end_offset);
02393 extern PG_PASCAL (long) pgNumPars (pg_ref pg);
02394 extern PG_PASCAL (long) pgOffsetToParNum (pg_ref pg, long offset);
02395 extern PG_PASCAL (void) pgParNumToOffset  (pg_ref pg, long par_num,
02396         long PG_FAR *begin_offset, long PG_FAR *end_offset);
02397 extern PG_PASCAL (void) pgLineNumToBounds (pg_ref pg, long line_num,
02398         pg_boolean want_scrolled, pg_boolean want_scaled,
02399         rectangle_ptr bounds);
02400 extern PG_PASCAL (void) pgParNumToBounds (pg_ref pg, long par_num,
02401         pg_boolean want_scrolled, pg_boolean want_scaled, rectangle_ptr bounds);
02402 extern PG_PASCAL (void) pgDisplayLineRange (pg_ref pg, long line_from, long line_to,
02403         const graf_device_ptr target_device, shape_ref vis_target,
02404         shape_ref wrap_target, const co_ordinate_ptr offset_extra, short draw_mode);
02405 
02406 
02407 /* Version 2.x Unicode Support */
02408 
02409 extern PG_PASCAL (pg_boolean) pgIsPaigeUnicode (void);
02410 extern PG_PASCAL (long) pgBytesToUnicode (pg_bits8_ptr input_bytes, long input_byte_size, pg_boolean test_only);
02411 extern PG_PASCAL (long) pgUnicodeToBytes (pg_short_t PG_FAR *input_chars, long input_char_size);
02412 extern PG_PASCAL (long) pgUnicodeToUnicode (pg_short_t PG_FAR *the_chars, long num_chars, pg_boolean force_reverse);
02413 
02414 #ifdef UNICODE
02415 extern PG_PASCAL (pg_boolean) pgInsertBytes (pg_ref pg, const pg_bits8_ptr data, long length, long position,
02416         short insert_mode, short modifiers, short draw_mode);
02417 #endif
02418 
02419 #ifdef __cplusplus
02420     }
02421 #endif
02422 
02423 #endif
02424 
02425 

Generated on Wed May 31 18:19:59 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6