From 6eee3b4ba4eaf4b077e09257e0cc605422920ceb Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 2 Feb 2018 20:10:19 -0800 Subject: [PATCH] prefix event kind --- desk.acc/calc_fixed.s | 12 +++---- desk.acc/calculator.s | 12 +++---- desk.acc/date.s | 6 ++-- desk.acc/puzzle.s | 6 ++-- desk.acc/show_image_file.s | 6 ++-- desk.acc/show_text_file.s | 2 +- desktop/desktop.s | 66 +++++++++++++++++++------------------- desktop/mgtk.s | 10 +++--- mgtk.inc | 16 ++++----- 9 files changed, 68 insertions(+), 68 deletions(-) diff --git a/desk.acc/calc_fixed.s b/desk.acc/calc_fixed.s index aba4224..82725a9 100644 --- a/desk.acc/calc_fixed.s +++ b/desk.acc/calc_fixed.s @@ -78,7 +78,7 @@ save_stack: .byte 0 call_init: jmp init - ;; Used after a drag-and-drop is completed; + ;; Used after a event_kind_drag-and-drop is completed; ;; redraws the window. .proc redraw_screen_and_window @@ -100,7 +100,7 @@ call_init: bmi :+ DESKTOP_CALL DESKTOP_REDRAW_ICONS - ;; Redraw window after drag + ;; Redraw window after event_kind_drag lda #da_window_id jsr check_visibility_and_draw_window @@ -126,7 +126,7 @@ call_init: offscreen_flag: .byte 0 - ;; Called after window drag is complete + ;; Called after window event_kind_drag is complete ;; (called with window_id in A) .proc check_visibility_and_draw_window sta getwinport_params_window_id @@ -797,12 +797,12 @@ loop: lda adjust_txtptr_copied-1,x input_loop: MGTK_CALL MGTK::GetEvent, event_params lda event_params::kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne :+ jsr on_click jmp input_loop -: cmp #MGTK::key_down +: cmp #MGTK::event_kind_key_down bne input_loop jsr on_key_press jmp input_loop @@ -1408,7 +1408,7 @@ invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts port check_button: MGTK_CALL MGTK::GetEvent, event_params lda event_params::kind - cmp #MGTK::drag ; Button down? + cmp #MGTK::event_kind_drag ; Button down? bne done ; Nope, done immediately lda #da_window_id sta screentowindow_params::window_id diff --git a/desk.acc/calculator.s b/desk.acc/calculator.s index 18e6764..d2f82dd 100644 --- a/desk.acc/calculator.s +++ b/desk.acc/calculator.s @@ -79,7 +79,7 @@ call_init: lda ROMIN2 jmp init - ;; Used after a drag-and-drop is completed; + ;; Used after a event_kind_drag-and-drop is completed; ;; redraws the window. .proc redraw_screen_and_window @@ -94,7 +94,7 @@ call_init: bpl :- jsr zp_stash - ;; Redraw window after drag + ;; Redraw window after event_kind_drag lda ROMIN2 lda #da_window_id jsr check_visibility_and_draw_window @@ -134,7 +134,7 @@ skip: lda #0 offscreen_flag: .byte 0 - ;; Called after window drag is complete + ;; Called after window event_kind_drag is complete ;; (called with window_id in A) .proc check_visibility_and_draw_window sta getwinport_params_window_id @@ -840,12 +840,12 @@ loop: lda adjust_txtptr_copied-1,x input_loop: MGTK_CALL MGTK::GetEvent, event_params lda event_params::kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne :+ jsr on_click jmp input_loop -: cmp #MGTK::key_down +: cmp #MGTK::event_kind_key_down bne input_loop jsr on_key_press jmp input_loop @@ -1459,7 +1459,7 @@ invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts port check_button: MGTK_CALL MGTK::GetEvent, event_params lda event_params::kind - cmp #MGTK::drag ; Button down? + cmp #MGTK::event_kind_drag ; Button down? bne done ; Nope, done immediately lda #da_window_id sta screentowindow_params::window_id diff --git a/desk.acc/date.s b/desk.acc/date.s index 58cd750..2b1f399 100644 --- a/desk.acc/date.s +++ b/desk.acc/date.s @@ -328,12 +328,12 @@ init_window: .proc input_loop MGTK_CALL MGTK::GetEvent, event_params lda event_params::kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne :+ jsr on_click jmp input_loop -: cmp #MGTK::key_down +: cmp #MGTK::event_kind_key_down bne input_loop .endproc @@ -487,7 +487,7 @@ on_field_click: stx hit_rect_index loop: MGTK_CALL MGTK::GetEvent, event_params ; Repeat while mouse is down lda event_params::kind - cmp #MGTK::button_up + cmp #MGTK::event_kind_button_up beq :+ jsr do_inc_or_dec jmp loop diff --git a/desk.acc/puzzle.s b/desk.acc/puzzle.s index d25940f..c9c7a4d 100644 --- a/desk.acc/puzzle.s +++ b/desk.acc/puzzle.s @@ -79,7 +79,7 @@ stash_stack: .byte 0 da_window_id := 51 ;;; ================================================== -;;; Redraw the screen (all windows) after a drag +;;; Redraw the screen (all windows) after a event_kind_drag .proc redraw_screen @@ -714,13 +714,13 @@ ploop: lda position_table+1,y .proc input_loop MGTK_CALL MGTK::GetEvent, event_params lda event_params::kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne :+ jsr on_click jmp input_loop ;; key? -: cmp #MGTK::key_down +: cmp #MGTK::event_kind_key_down bne input_loop jsr check_key jmp input_loop diff --git a/desk.acc/show_image_file.s b/desk.acc/show_image_file.s index 7c64fce..f3e430b 100644 --- a/desk.acc/show_image_file.s +++ b/desk.acc/show_image_file.s @@ -173,7 +173,7 @@ base: .word 0 .proc event_params ; queried to track mouse-up kind: .byte $00 -;;; if state is MGTK::key_down +;;; if state is MGTK::event_kind_key_down key := * modifiers := *+1 @@ -360,9 +360,9 @@ end: rts .proc input_loop MGTK_CALL MGTK::GetEvent, event_params lda event_params::kind - cmp #MGTK::button_down ; was clicked? + cmp #MGTK::event_kind_button_down ; was clicked? beq exit - cmp #MGTK::key_down ; any key? + cmp #MGTK::event_kind_key_down ; any key? beq on_key bne input_loop diff --git a/desk.acc/show_text_file.s b/desk.acc/show_text_file.s index d85ea3c..740238b 100644 --- a/desk.acc/show_text_file.s +++ b/desk.acc/show_text_file.s @@ -845,7 +845,7 @@ store: sta winfo::hthumbpos ;;; ================================================== ;;; UI Helpers - ;; Used at start of thumb drag + ;; Used at start of thumb event_kind_drag .proc do_trackthumb lda event_params::mousex sta trackthumb_params::mousex diff --git a/desktop/desktop.s b/desktop/desktop.s index 07d44cc..e971723 100644 --- a/desktop/desktop.s +++ b/desktop/desktop.s @@ -1474,7 +1474,7 @@ L99FC: MGTK_CALL MGTK::SetPattern, checkerboard_pattern2 MGTK_CALL MGTK::FramePoly, drag_outline_buffer L9A0E: MGTK_CALL MGTK::PeekEvent, peekevent_params lda peekevent_params::kind - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq L9A1E jmp L9BA5 @@ -3911,11 +3911,11 @@ LBB75: MGTK_RELAY2_CALL MGTK::MoveTo, point8 jsr draw_pascal_string LBB87: MGTK_RELAY2_CALL MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne LBB9A jmp LBC0C -LBB9A: cmp #MGTK::key_down +LBB9A: cmp #MGTK::event_kind_key_down bne LBB87 lda event_params_key and #$7F @@ -3988,7 +3988,7 @@ LBC6D: MGTK_RELAY2_CALL MGTK::SetPenMode, penXOR sta LBCE8 LBC84: MGTK_RELAY2_CALL MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::button_up + cmp #MGTK::event_kind_button_up beq LBCDB jsr LBDE1 MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords @@ -4025,7 +4025,7 @@ LBCE9: MGTK_RELAY2_CALL MGTK::SetPenMode, penXOR sta LBD64 LBD00: MGTK_RELAY2_CALL MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::button_up + cmp #MGTK::event_kind_button_up beq LBD57 jsr LBDE1 MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords @@ -4062,7 +4062,7 @@ LBD65: lda #$00 MGTK_RELAY2_CALL MGTK::PaintRect, try_again_rect LBD7C: MGTK_RELAY2_CALL MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::button_up + cmp #MGTK::event_kind_button_up beq LBDD3 jsr LBDE1 MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords @@ -6093,9 +6093,9 @@ L4088: jsr reset_grafport3 L40A6: jsr L464E jsr get_input lda event_params_kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down beq L40B7 - cmp #MGTK::apple_key + cmp #MGTK::event_kind_apple_key bne L40BD L40B7: jsr handle_click jmp L4088 @@ -8668,9 +8668,9 @@ L5579: lda #$00 L5581: jsr L55F0 L5584: jsr get_input lda event_params_kind - cmp #MGTK::key_down + cmp #MGTK::event_kind_key_down beq L5595 - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne L5584 jmp L55D1 @@ -8861,9 +8861,9 @@ L572D: lda #$00 sta L578C L5732: jsr get_input lda event_params_kind - cmp #MGTK::key_down + cmp #MGTK::event_kind_key_down beq L5743 - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne L5732 jmp L578B @@ -8929,9 +8929,9 @@ L578D: .byte 0 jsr L5803 loop: jsr get_input lda event_params_kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down beq done - cmp #MGTK::key_down + cmp #MGTK::event_kind_key_down bne loop lda event_params_key cmp #KEY_RETURN @@ -9522,7 +9522,7 @@ L5C71: lda desktop_active_winid L5C89: sta L5CB6 jsr L48F0 lda event_params_kind - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq L5C99 L5C96: lda #$FF rts @@ -9811,7 +9811,7 @@ L5F20: lda event_params_coords,x bpl L5F20 jsr L48F0 lda event_params_kind - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq L5F3F bit BUTN0 bmi L5F3E @@ -9834,7 +9834,7 @@ L5F50: lda L5F0B,x MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 L5F6B: jsr L48F0 lda event_params_kind - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq L5FC5 MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 ldx #$00 @@ -10809,7 +10809,7 @@ L68B8: lda event_params_coords,x bpl L68B8 jsr L48F0 lda event_params_kind - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq L68CF rts @@ -10818,7 +10818,7 @@ L68CF: MGTK_RELAY_CALL MGTK::SetPattern, checkerboard_pattern3 MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 L68E4: jsr L48F0 lda event_params_kind - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq L6932 MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 ldx #$00 @@ -13947,7 +13947,7 @@ L84DC: lda grafport2::width sbc grafport2::cliprect_y1+1 sta L85FB lda event_params_kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne L850C asl a bne L850E @@ -14100,15 +14100,15 @@ loop: dec counter lda event_params_kind sta state ; unused ??? - cmp #MGTK::no_event + cmp #MGTK::event_kind_no_event beq loop - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq loop - cmp #MGTK::button_up + cmp #MGTK::event_kind_button_up bne :+ jsr get_input jmp loop -: cmp #MGTK::button_down +: cmp #MGTK::event_kind_button_down bne exit jsr get_input @@ -17756,7 +17756,7 @@ LA3CA: ldx L9188 LA3D1: yax_call JT_MGTK_RELAY, MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::key_down + cmp #MGTK::event_kind_key_down bne LA3EC lda event_params_key cmp #KEY_ESCAPE @@ -17940,11 +17940,11 @@ prompt_input_loop: sta LD8E9 LA579: MGTK_RELAY_CALL MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down bne LA58C jmp LA5EE -LA58C: cmp #MGTK::key_down +LA58C: cmp #MGTK::event_kind_key_down bne LA593 jmp LA6FD @@ -18302,9 +18302,9 @@ jump_relay: : MGTK_RELAY_CALL MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::button_down + cmp #MGTK::event_kind_button_down beq close - cmp #MGTK::key_down + cmp #MGTK::event_kind_key_down bne :- lda event_params_key and #$7F @@ -19382,11 +19382,11 @@ LB476: MGTK_RELAY_CALL MGTK::PeekEvent, event_params sta LB508 lda event_params_kind sta LB507 - cmp #MGTK::no_event + cmp #MGTK::event_kind_no_event beq LB45F - cmp #MGTK::drag + cmp #MGTK::event_kind_drag beq LB45F - cmp #MGTK::button_up + cmp #MGTK::event_kind_button_up bne LB4A7 MGTK_RELAY_CALL MGTK::GetEvent, event_params jmp LB45F @@ -19811,7 +19811,7 @@ LB88A: sta LB8F3 sta LB8F2 LB892: MGTK_RELAY_CALL MGTK::GetEvent, event_params lda event_params_kind - cmp #MGTK::button_up + cmp #MGTK::event_kind_button_up beq LB8E3 lda winfoF sta event_params diff --git a/desktop/mgtk.s b/desktop/mgtk.s index f916d2b..75028b7 100644 --- a/desktop/mgtk.s +++ b/desktop/mgtk.s @@ -4669,20 +4669,20 @@ L666D: lda input::modifiers sta input::kmods - lda #MGTK::key_down + lda #MGTK::event_kind_key_down sta input::state bne L66D8 L66B9: bcc up lda input::modifiers beq :+ - lda #MGTK::apple_key + lda #MGTK::event_kind_apple_key bne set_state -: lda #MGTK::button_down +: lda #MGTK::event_kind_button_down bne set_state -up: lda #MGTK::button_up +up: lda #MGTK::event_kind_button_up set_state: sta input::state @@ -8524,7 +8524,7 @@ L8347: MGTK_CALL MGTK::PostEvent, set_input_params rts .proc set_input_params ; 1 byte shorter than normal, since KEY -state: .byte MGTK::key_down +state: .byte MGTK::event_kind_key_down key: .byte 0 modifiers: .byte 0 diff --git a/mgtk.inc b/mgtk.inc index 17a687f..4369c09 100644 --- a/mgtk.inc +++ b/mgtk.inc @@ -282,7 +282,7 @@ GetEvent := $2A ;; (input length 0 bytes) ;; (output length 5 bytes) ;; .byte kind - ;; if kind is key_down: + ;; if kind is event_kind_key_down: ;; .byte key (ASCII code; high bit clear) ;; .byte modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both) ;; if kind otherwise: @@ -298,7 +298,7 @@ PeekEvent := $2C PostEvent := $2D ; Set pending input kind (mouse or keyboard) ;; (input length 5 bytes) ;; .byte kind - ;; if kind is key_down: + ;; if kind is event_kind_key_down: ;; .byte key ASCII code; high bit clear ;; .byte modifiers 0=none, 1=open-apple, 2=closed-apple, 3=both ;; if kind otherwise: @@ -524,12 +524,12 @@ textbg_white := $7F ;;; Mouse Graphics Tool Kit Constants ;;; Used in GetEvent -no_event := 0 ; No mouse or keypress -button_down := 1 ; Mouse button was depressed -button_up := 2 ; Mouse button was released -key_down := 3 ; Key was pressed -drag := 4 ; Mouse button still down -apple_key := 5 ; Mouse button was depressed, modifier key down +event_kind_no_event := 0 ; No mouse or keypress +event_kind_button_down := 1 ; Mouse button was depressed +event_kind_button_up := 2 ; Mouse button was released +event_kind_key_down := 3 ; Key was pressed +event_kind_drag := 4 ; Mouse button still down +event_kind_apple_key := 5 ; Mouse button was depressed, modifier key down ;;; Used in FindWindow area_desktop := 0