PreviousUpNext

15.4.1433  src/lib/x-kit/widget/edit/textpane-hint.pkg

## textpane-hint.pkg
#
# Textpane state information stored in textmill                 # textmill                      is from   src/lib/x-kit/widget/edit/textmill.pkg
# without revealing the relevant types to textmill.
#
# See also:
#     src/lib/x-kit/widget/edit/textpane.pkg
#     src/lib/x-kit/widget/edit/millboss-imp.pkg
#     src/lib/x-kit/widget/edit/textmill.pkg
#     src/lib/x-kit/widget/edit/keystroke-macro-junk.pkg

# Compiled by:
#     src/lib/x-kit/widget/xkit-widget.sublib


stipulate
    include package   threadkit;                                # threadkit                     is from   src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg
    #
    package g2d =  geometry2d;                                  # geometry2d                    is from   src/lib/std/2d/geometry2d.pkg
    package mt  =  millboss_types;                              # millboss_types                is from   src/lib/x-kit/widget/edit/millboss-types.pkg

    nb = log::note_on_stderr;                                   # log                           is from   src/lib/std/src/log.pkg
herein

    package textpane_hint                                       # 
    {
        Textpane_Hint                                                                                   # We store these into textmill.pkg via Textpane_To_Textmill.set_textpane_hint().
          =                                                                                             # The point of the exercise is that if we open a different textmill in this textpane and then later come back to it, we can position the point+cursor at a reasonable spot instead of just the top of file, and select a reasonable panemode.
          { point:                      g2d::Point,                                                     # (0,0)-origin 'point' (==cursor) screen coordinates, in rows and cols (we assume a fixed-width font).  (Remember to display these as (1,1)-origin when printing them out as numbers!)
            mark:                       Null_Or(g2d::Point),                                            # (0,0)-origin 'mark' if set, else NULL.  Same coordinate system as 'point'.
            lastmark:                   Null_Or(g2d::Point),                                            # (0,0)-origin last-valid-value-of-mark if set, else NULL.  We use this in exchange_point_and_mark() when 'mark' is not set -- see   src/lib/x-kit/widget/edit/fundamental-mode.pkg
            panemode:                   mt::Panemode
          };

        exception  TEXTPANE_HINT  Textpane_Hint;                                                        # We'll never 'raise' this exception:  It is purely a datastructure to hide the Textpane_Hint datatype from textmill.pkg, in the interests of good modularity.
        #
        #
        fun decrypt__textpane_hint  (crypt:  Crypt):  Fail_Or( Textpane_Hint )
            =
            case crypt.data
                #
                TEXTPANE_HINT
                textpane_hint
                    =>
                    WORK textpane_hint;

                _   =>  FAIL (sprintf "decrypt__textpane_hint:  Unknown Crypt value, type='%s' info='%s'  --textmill-crypts.pkg"
                                        crypt.type
                                        crypt.info
                             );
            esac;       


        fun encrypt__textpane_hint  (textpane_hint:  Textpane_Hint):  Crypt
            =
            { id   =>  issue_unique_id (),
              type =>  "textpane_hint::Textpane_Hint",
              info =>  "Wrapped by textpane_hint::encrypt__textpane_hint.",
              data =>  TEXTPANE_HINT textpane_hint
            };           
    };

end;





Comments and suggestions to: bugs@mythryl.org

PreviousUpNext