⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uiinfhlp.asm

📁 Dos6.0
💻 ASM
📖 第 1 页 / 共 3 页
字号:

        cCall   GetHelpTitleStr,<ax,si> ; AX = total length of title


GetHelpTitle_Exit:
        DbAssertRel ax,be,si,UI,<GetHelpTitle: title too big>
cEnd

;***
;GetHelpLine - Get a line of help text
;
;Purpose:
;       This routine is called by the edit manager to display a line
;       of text on the screen.  This routine must take care of all
;       the cases associated with ressyncing the virtual line mechanism,
;       as well as detecting when a ressync would be needed.
;
;       Since this routine is called from COW, the line numbers are 0 relative.
;       The help system is 1 relative (because of the HelpEngine) so we
;       do the conversions on the fly.
;
;Entry:
;       CX = iLineNum - virtual line number of line to retrieve
;       DX = szBufPtr - pointer to buffer in which to store line
;       AX = cbMaxSize - maximum size of buffer
;
;Exit:
;       AX = # bytes in line
;
;****

cProc   GetHelpLine,<NEAR>,<SI,DI>
cBegin
        mov     si,ax                           ; save entry params
        mov     di,dx
        mov     al,HelpFlags                    ; get a copy of the flags
        and     al,HLP_GOTBUF or HLP_COMPRESS   ; mask out all but these
        cmp     al,HLP_GOTBUF                   ; brif HLP_GOTBUF and
        je      CheckHelpOwner                  ;  NOT HLP_COMPRESS

GetLineError:
        xor     ax,ax                           ; number of characters
GetLine_NoAttr:

        ; signal GetHelpLineAttr that it can't lookup attributes

        mov     iCurRequestLine,UNDEFINED
        jmp     short GetHelpLine_Exit          ; and return

CheckHelpOwner:

        inc     cx                              ; make 1 relative



GotHelpLine:

        mov     bx, oCurTopic                   ; get current topic pointer
        or      bx,bx                           ; is it 0?
        je      GetLineError                    ; yes, no current topic set

        mov     iCurRequestLine,cx              ; set line # offset for attribs

        lea     bx,[bx].bdlHelpText.BDL_Seg          ; BX = handle text seg
        xor     ax,ax                                ; AX = text offset
        cCall   HelpGetLine,<CX,SI,DS,DI,BX,AX>      ; put text into buff.
        or      ax,ax                                ; did we get the line?
        je      GetLineError                         ; no, signal error

        ;AX = number of characters in buffer = return value

GetHelpLine_Exit:
cEnd


;***
;GetHelpLineAttr - return attributes for previously fetched line
;
;Purpose:
;       This routine will return the line attributes for the
;       line that was retrieved with the last call to GetHelpLine.
;
;       Note: No call that could change the state of the help system
;             should be called between GetHelpLine and this routine.
;
;Entry:
;       none.
;
;Exit:
;       AX = near ptr to string containing attributes
;
;Uses:
;       Per Convention
;
;****
cProc   GetHelpLineAttr,<NEAR>
cBegin
        .errnz (-1) - (UNDEFINED)

        mov     ax,iCurRequestLine              ; did GetHelpLine return bogus
        inc     ax                              ; line (== -1 = UNDEFINED)?
        jne     Get_Attr                        ; no, line is buffered

DefaultAttrs:
        mov     bx,OFFSET DGROUP:rgLineAttr     ; pointer to static buffer
        push    bx                              ; save for return ptr
        mov     ax,UNDEFINED
        mov     [bx + LA_cb],ax
        mov     [bx + LA_attr],isaSyntaxHelp
        mov     [bx + (size LINEATTR) + LA_attr],ax

DJMP    jmp     short GetAttr_End

Get_Attr:

; we assume that nothing in the help system will change from the call to
; HelpGetLine.  Thus, we do not have to check that help is up and running,
; as HelpGetLine will zero iCurRequestLine if there are ANY problems.
; Also, CompressHelp will zero iCurRequestLine.

DbAssertTst     HelpFlags,ne,HLP_GOTBUF,UI,<GetHelpLineAttr: HLP_GOTBUF not set>
DbAssertRel     oCurTopic,ne,0,UI,<GetHelpLineAttr:Invalid oCurTopic>

        mov     bx,oCurTopic
        lea     bx,[bx].bdlHelpText.BDL_seg     ; get handle of topic seg

; a-emoryh Added more space for Dos6 online help index strings
        mov     ax,CB_bufStdMsg + 6 + 16 + 70   ; maximum size of buffer

        mov     cx,OFFSET DGROUP:bufStdMsg      ; buffer to store results in
        push    cx                              ; save for mapping start
        xor     dx,dx                           ; offset into topic segment
        cCall   HelpGetLineAttr,<iCurRequestLine,AX,DS,CX,BX,DX>
        pop     bx                              ; pointer to buffer
        or      ax,ax                           ; did we succeed?
        jz      DefaultAttrs                    ; no, use default attrs

        ;Map attributes from HELP format to COW format

        push    bx              ; save ptr to buffer for return

AttrList:
        mov     ax,[bx].LA_attr ; get first attribute
        inc     ax              ; is it -1 (end of list)
        je      GetAttr_End     ; yes, we are done
        dec     ax              ; restore attribute
        DbAssertTst ax,e,<NOT (A_BOLD OR A_UNDERLINE OR A_ITALICS)>,UI,<GetHelpLineAttr: Illegal attributes set>
        mov     cx,isaBold      ; assume bold attribute
        test    ax,A_BOLD       ; does it have any bold in it?
        jne     GotAttr         ; yes, update and loop
        mov     cx,isaUnderline ; assume underline attribute
        test    ax,A_UNDERLINE  ; does it have any underline in it?
        jne     GotAttr         ; yes, update and loop
        mov     cx,isaItalic    ; assume italics attribute
        test    ax,A_ITALICS    ; does it have any italics in it?
        jne     GotAttr         ; yes, update and loop
        mov     cx,isaSyntaxHelp; it must be default

GotAttr:
        mov     [bx].LA_attr,cx ; update attribute
        add     bx,Size LINEATTR; point to next attribute/size pair
        jmp     short AttrList  ; go modify this one.

GetAttr_End:
        pop     ax              ; retrieve pointer to begining of buffer

cEnd

;***
;GetHelpFileSize - Returns the number of lines in the help file
;
;Purpose:
;       This routine is used to set the scroll bar, and to establish
;       the maximum line number in the file.  Since we currently use
;       a virtual file, we will return a virtual size.
;
;Entry:
;       None.
;
;Exit:
;       AX = size of file in lines
;
;Uses:
;       AX
;
;****
DbPub   GetHelpFileSize
cProc   GetHelpFileSize,<NEAR>
cBegin

; HLP_INHELP will only be set if we are about to do something that can
; put up a dialog/message box.  If this routine is called with it set,
; then we are trying to redraw the screen after the box has been removed.
; This can be dangerious, as we may not be in a state where we can
; access a help topic.  Thus we will tell the edit manager that we
; have 0 lines, so it will not call us to redraw the screen.

        mov     ax,iFileSize            ; get size of variable help
        test    HelpFlags,HLP_INHELP    ; are we recursively entering help?
        jz      ExitGHFS                ; no, return with what we got
        cmp     fMessageBox,0           ; are we in a message box?
        jz      ExitGHFS                ; no, return with what we got
        cCall   DrawDebugScr            ; make sure we are redrawn later
        xor     ax,ax                   ; return 0 lines
ExitGHFS:
cEnd



;***
;HelpWndProc - Window Proc for the help window
;
;Purpose:
;       This routine interprets all messages that are going to the help
;       window.  Those of interest is processes and returns a value.
;       Otherwize, it will pass the message on to EditFilterWndProc.
;
;       This routine implements the receiving end of the messaging system.
;       It must be able to be called recursively.
;
;Entry:
;       pwnd    - Ptr to window that is to receive the message
;       msg     - message
;       wParam  - Word parameter to message
;       lParamHi-\ Long word parameter to message, broken up for ease of use.
;       lParamLo-/
;
;Exit:
;       DX:AX - return value
;
;****

labelW  MessageTable                    ; list of addresses for our messages
        dw      UIOFFSET HelpBack
        dw      UIOFFSET CmdHelpNext
        dw      UIOFFSET DisplayHlpGeneric
        dw      UIOFFSET GetHelpCurTopic
        dw      UIOFFSET GetHelpNextTopic
        dw      UIOFFSET ChngHelpCurTopic
        dw      UIOFFSET RestoreHelpTopic
        dw      UIOFFSET GetHelpTitle
        dw      UIOFFSET GetHelpLine
        dw      UIOFFSET GetHelpLineAttr
        dw      UIOFFSET GetHelpFileSize

        .errnz  (($ - MessageTable) / 2) - NUM_HELPMSG

cProc   HelpWndProc,<PUBLIC,FAR>,<SI>
parmW   pwnd
parmW   msg
parmW   wParam
parmW   lParamHi
parmW   lParamLo
cBegin
        inc     fHelpAlloc              ; set recursion flag


        mov     cx,wParam               ; cache in a register for speed
        mov     ax,msg                  ; cache in a register for speed

        mov     bx,ax
        sub     bx,WM_FIRSTHELPMSG      ; is it one of our special msgs?
        cmp     bx,NUM_HELPMSG
        jae     NotInTable              ; no, it is not in table
        shl     bx,1                    ; make into a word index
        mov     dx,lParamHi             ; Make lParam accessable
        mov     ax,lParamLo
        call    CS:MessageTable[bx]     ; and go do the code
        jmp     WndProcExit_2           ; return with code from the call

NotInTable:
        cmp     ax,WM_LBUTTONDBLCLK
        jne     CheckSETFOCUS

DbAssertRel     pwnd,e,<OFFSET DGROUP:wndHelp>,UI,<HelpWndProc:mouse message not for Help window>
        mov     bx,lParamLo
        mov     al,bh                   ; al = screen relative row number
        cbw                             ; ax = screen relative row number
        add     ax,EfHelp.EF_pdCur_olnTop ; ax = file relative row number
        xor     bh,bh                   ; bx = screen relative column number
        add     bx,EfHelp.EF_pdCur_obleft ; bx = file relative column number
        push    BX                      ; push first parameter
SelectHotLinkTrue:
        push    ax

; a-emoryh - Don't beep in QHelp mode when can't find hotlink
;            Do we really want to not beep, though?
        mov     ax, 1                   ; assume do beep
        test    cmdSwitches,CMD_SW_QHELP ; /QHELP viewer?
        jz      hwpDoBeep
        xor     ax, ax                  ; Qhelp mode, so clear beep flag
hwpDoBeep:
        push    ax

;; Old line
;        push    sp

        cCall   SelectHotLink           ; select hot link, allow BEEP
        jmp     WndProcExit

CheckSETFOCUS:
        cmp     ax,WM_SETFOCUS
        jne     CheckSETBOOKMARK
        PUSHI   ax,<OFFSET DGROUP:wndHelp> ; borrow the SETFOCUS call to
        cCall   DoStatusMsg             ; update the status line message
        jmp     Short DefaultCase       ; Pass call onto the edit mgr.

CheckSETBOOKMARK:
        cmp     ax,WM_SETBOOKMARK
        jne     CheckGOTOBOOKMARK
        sub     cx,'0'                  ; CX = wParam - '0'
        cCall   SetBookMark,<CX>
        jmp     short WndProcExit

CheckGOTOBOOKMARK:
        cmp     ax,WM_GOTOBOOKMARK
        jne     CheckCHAR
        sub     cx,'0'                  ; CX = wParam - '0'
        cCall   GotoBookMark,<CX>
        jmp     short WndProcExit

CheckCHAR:
        cmp     ax,WM_CHAR
        jne     DefaultCase
        cmp     cx,09h                  ; is the character a TAB
        jne     NotTab                  ; no, go check for ENTER
        xor     ax,ax                   ; assume not shifted
        test    lParamHi,KK_SHIFT       ; is a shift key pressed?
        jz      GotoHotLink             ; no, use a value of 0
        dec     ax                      ; use -1
GotoHotLink:
        cCall   NextHotLink,<AX>
        jmp     short WndProcExit

NotTab:
        cmp     cx,0dh                  ; is the character an ENTER?
        jne     NotEnter                ; no, go test for another char
        cCall   GetEditColumn           ; AX = file relative column number
        push    ax
        cCall   GetEditLine             ; AX = file relative line number
        jmp     SelectHotLinkTrue       ; select hot link (AX = line)

NotEnter:                               ; check for legal characters
        cmp     cx,7fh                  ; is it a backspace?
        je      DefaultCase             ; yes,  let EditMgr have it
        or      ch,ch                   ; is it a virtual key
        jne     DefaultCase             ; yes, EditMgr will handle it
        cmp     cx,' '                  ; is it a control character
        jb      DefaultCase             ; yes, let EditMgr have it
        cCall   GetEditMgrState         ; Ctrl+Q or Ctrl+K active?
        or      ax,ax                   ; (non-zero if so)
        jnz     DefaultCase             ; yes, EditMgr will handle this
        cCall   toupper,<wParam>        ; convert parameter to uppercase
        cmp     ax,wParam               ; was it already upper?
        jne     GotoHotLink             ; no, goto hotlink
        neg     ax                      ; yes, tell hotlink to look backwards
        jmp     GotoHotLink             ; goto hotlink.

DefaultCase:
        cCall   EditFilterWndProc,<pwnd,msg,wParam,lParamHi,lParamLo>
        jmp     short WndProcExit_2
WndProcExit:
        xor     ax,ax                   ; return 0L
        cwd
WndProcExit_2:
        dec     fHelpAlloc              ; release allocation lock
        cCall   CloseCurHelpFile        ; close the current help file
cEnd

sEnd    UI
        end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -