home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / zkuste / SVET_GEO / TEXTDESK / TEXTDESK.ZIP / GLOBAL.GOH < prev    next >
Text File  |  1996-02-14  |  8KB  |  174 lines

  1. /********************************************************************
  2.  *
  3.  * Copyright (C) 1996 Blue Marsh Softworks -- All Rights Reserved.
  4.  *
  5.  * PROJECT:      Text Editor
  6.  * MODULE:       Global Header
  7.  * FILE:         global.goh
  8.  *
  9.  * AUTHOR:       Nathan Fiedler
  10.  *
  11.  * REVISION HISTORY:
  12.  *      Name     Date      Description
  13.  *      ----     ----      -----------
  14.  *       NF      04/01/95  Initial version
  15.  *       NF      06/06/95  Started desktop version
  16.  *
  17.  * DESCRIPTION:
  18.  *      This contains all the global variables, object declaractions,
  19.  *      and routine declarations.
  20.  *
  21.  *******************************************************************/
  22.  
  23. #ifndef __GLOBAL_GOH
  24. #define __GLOBAL_GOH
  25.  
  26. /********************************************************************
  27.  *                 Global Variable Declarations
  28.  *******************************************************************/
  29.     extern WWFixed pointSize_g;
  30.     extern FontID  fontID_g;
  31.  
  32. /********************************************************************
  33.  *                 Object Declarations
  34.  *******************************************************************/
  35.     @extern object TFEApp;
  36.     @extern object TFEPrimary;
  37.     @extern object TFEDocumentControl;
  38.     @extern object TFEPrintControl;
  39.     @extern object TFEEditControl;
  40.     @extern object TFESearchReplaceControl;
  41.     @extern object TFEPtSizeControl;
  42.     @extern object TFEToolOptions;
  43.     @extern object TFESaveOptsTrigger;
  44.     @extern object TFEToolControl;
  45.     @extern object TFEToolbar;
  46.     @extern object TFEDisplayControl;
  47.     @extern object TFEDisplayDisplay;
  48.     @extern object TFEMoreAboutBox;
  49.     @extern object TFEText;
  50.     @extern chunk TFETextRegionArray;
  51.  
  52. /********************************************************************
  53.  *                 Function and Macro Declarations
  54.  *******************************************************************/
  55.  
  56.     /********************************************************************
  57.      *                 badChar
  58.      ********************************************************************
  59.      * SYNOPSIS:     Check if passed character is a bad one or not.
  60.      * CALLED BY:    ReadDataFromFile
  61.      *               RemoveBadChars
  62.      * RETURNS:      TRUE if character is bad
  63.      * STRATEGY:     Do an if statement to check validity of character.
  64.      *******************************************************************/
  65.     Boolean badChar
  66.       (
  67.       unsigned char ch  /* Character to test (in). */
  68.       );
  69.  
  70. #ifdef DEBUG
  71.       /********************************************************************
  72.        *                 ErrorMessage
  73.        ********************************************************************
  74.        * SYNOPSIS:     Displays an error message and then quits program.
  75.        * CALLED BY:    Any function or method
  76.        * SIDE EFFECTS: Exits program
  77.        * STRATEGY:     Call UserStandardDialog and then send MSG_META_QUIT
  78.        *               to the application object.
  79.        *******************************************************************/
  80.       void ErrorMessage
  81.         (
  82.         unsigned char * errorString  /* Message to be displayed (in) */
  83.         );
  84. #endif
  85.  
  86.     /********************************************************************
  87.      *                 ProcessString
  88.      ********************************************************************
  89.      * SYNOPSIS:     Removes bad characters from character string.
  90.      * CALLED BY:    ReadDataFromFile
  91.      * STRATEGY:     Check each character to see if it is a valid
  92.      *               character. If not, remove it. Then append what's
  93.      *               left to the text object.
  94.      *******************************************************************/
  95.     void ProcessString
  96.       (
  97.       word            numCharsRead, /* Number of characters (in) */
  98.       optr            ourText_p,    /* Text object to append to (in) */
  99.       unsigned char * dataBlockPtr  /* String of characters (in/out) */
  100.       );
  101.  
  102.     /********************************************************************
  103.      *                 ReadDataFromFile
  104.      ********************************************************************
  105.      * SYNOPSIS:     Reads text from file and appends to text object.
  106.      * CALLED BY:    MSG_GEN_DOCUMENT_PHYSICAL_REVERT
  107.      *               MSG_GEN_DOCUMENT_OPEN
  108.      * RETURNS:      TRUE if error occurred
  109.      * SIDE EFFECT:  Resets undo.
  110.      * STRATEGY:     Deletes text in text object and appends text from
  111.      *               file.
  112.      *******************************************************************/
  113.     Boolean ReadDataFromFile
  114.       (
  115.       FileHandle file_p,    /* Handle of file to read from (in). */
  116.       optr       ourText_p, /* Pointer to text object to write to (in). */
  117.       word *     error_p    /* Pointer to error status word (out). */
  118.       );
  119.  
  120.     /********************************************************************
  121.      *                 RemoveBadChars
  122.      ********************************************************************
  123.      * SYNOPSIS:     Remove some consecutive bad characters.
  124.      * CALLED BY:    ReadDataFromFile
  125.      * STRATEGY:     Look for consecutive bad characters and remove them.
  126.      *******************************************************************/
  127.     void RemoveBadChars
  128.       (
  129.       unsigned char * dataBlockPtr, /* String to examine (i/o) */
  130.       word            curCharIndex,  /* Position to start check (i/o) */
  131.       word *          numCharsLeft /* Number of characters in array (i/o) */
  132.       );
  133.  
  134.     /********************************************************************
  135.      *                 ResetUndo
  136.      ********************************************************************
  137.      * SYNOPSIS:     Set the undo status to nothing to undo.
  138.      * CALLED BY:    ReadDataFromFile
  139.      * AUTHOR:       Ed Ballot
  140.      * STRATEGY:     To notify the undo/redo edit control that there is
  141.      *               nothing to undo, send MSG_META_NOTIFY_WITH_DATA_BLOCK.
  142.      *               The notification type is GWNT_UNDO_STATE_CHANGE
  143.      *               and the block you want to send should contain
  144.      *               the structure NotifyUndoStateChange (
  145.      *               NUSC_undoTitle = NullOptr and
  146.      *               NUSC_undoType = UD_UNDO ).
  147.      *******************************************************************/
  148.     void ResetUndo
  149.       (
  150.       void
  151.       );
  152.  
  153.     /********************************************************************
  154.      *                 WriteDataToFile
  155.      ********************************************************************
  156.      * SYNOPSIS:     Write the contents of the document to a file.
  157.      * CALLED BY:    MSG_GEN_DOCUMENT_SAVE
  158.      *               MSG_GEN_DOCUMENT_UPDATE
  159.      *               MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS_FILE_HANDLE
  160.      * RETURNS:      TRUE if error occurred
  161.      * SIDE EFFECTS: Tells object it is not modified.
  162.      * STRATEGY:     Using the text optr and file handle, seek to the
  163.      *               start of the file and write the text out.
  164.      *******************************************************************/
  165.     Boolean WriteDataToFile
  166.       (
  167.       FileHandle file_p,    /* File to write to. (in) */
  168.       optr       ourText_p, /* Pointer to text object. (in) */
  169.       word *     error      /* Return error. (out) */
  170.       );
  171.  
  172. #endif
  173.  
  174.