From e92822eb8d453ed1362a2261a9b8e823647ce7bd Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 5 Feb 2019 22:00:49 -0800 Subject: [PATCH] Adjust vertical spacing in various dialogs (Issue #126) * About * Confirmation and progress dialogs (copy/delete/lock/unlock etc) * Format/Erase disk --- desktop/desktop_aux.s | 8 +++---- desktop/desktop_main.s | 18 +++++---------- desktop/desktop_res.s | 17 +++++++------- desktop/ovl2.s | 50 +++++++++++++++++++++++++++--------------- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/desktop/desktop_aux.s b/desktop/desktop_aux.s index 966f603..a488ae4 100644 --- a/desktop/desktop_aux.s +++ b/desktop/desktop_aux.s @@ -3194,7 +3194,7 @@ special_menu: ;; Rects alert_dialog_width = 400 - alert_dialog_height = 100 + alert_dialog_height = 107 confirm_dialog_outer_rect: DEFINE_RECT 4,2,alert_dialog_width-4,alert_dialog_height-2 confirm_dialog_inner_rect: DEFINE_RECT 5,3,alert_dialog_width-5,alert_dialog_height-3 @@ -3220,8 +3220,8 @@ all_label_pos: DEFINE_POINT 325,alert_dialog_height-9 textbg_black: .byte $00 textbg_white: .byte $7F - dialog_label_height = 8 - dialog_label_base_y = 27 + dialog_label_height = 9 + dialog_label_base_y = 30 .define dialog_label_row_y(num) (((num)*(dialog_label_height))+(dialog_label_base_y)) clear_dialog_labels_rect: DEFINE_RECT 39,25,360,alert_dialog_height-20 @@ -3246,7 +3246,7 @@ LAEC7: PASCAL_STRING "Destination filename:" ;; "About" dialog resources about_dialog_width = 400 - about_dialog_height = 110 + about_dialog_height = 120 about_dialog_outer_rect: DEFINE_RECT 4, 2, about_dialog_width-4, about_dialog_height-2 about_dialog_inner_rect: DEFINE_RECT 5, 3, about_dialog_width-5, about_dialog_height-3 diff --git a/desktop/desktop_main.s b/desktop/desktop_main.s index d5f7b3e..a3f68e2 100644 --- a/desktop/desktop_main.s +++ b/desktop/desktop_main.s @@ -12973,7 +12973,6 @@ close: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_about_dialog : copy #0, has_input_field_flag jsr open_dialog_window - ;; TODO: Looks ugly due to overwrite of ascenders; adjust spacing axy_call draw_dialog_label, 2, desktop_aux::str_copy_from axy_call draw_dialog_label, 3, desktop_aux::str_copy_to bit move_flag @@ -14112,19 +14111,14 @@ done: jmp reset_grafport3a lsr16 result sub16 #200, result, dialog_label_pos pla + and #$7F ; strip "center?" flag tay -skip: dey ; ypos = (Y-1) * 8 + dialog_label_base_pos::ycoord - tya - asl a - asl a - asl a - clc - adc dialog_label_base_pos::ycoord - sta dialog_label_pos+2 - lda dialog_label_base_pos::ycoord+1 - adc #0 - sta dialog_label_pos+3 + ;; y = base + desktop_aux::dialog_label_height * line +skip: copy16 dialog_label_base_pos::ycoord, dialog_label_pos::ycoord +: add16 dialog_label_pos::ycoord, #desktop_aux::dialog_label_height, dialog_label_pos::ycoord + dey + bne :- MGTK_RELAY_CALL MGTK::MoveTo, dialog_label_pos addr_call_indirect draw_text1, ptr ldx dialog_label_pos diff --git a/desktop/desktop_res.s b/desktop/desktop_res.s index ebb4bcd..92ed987 100644 --- a/desktop/desktop_res.s +++ b/desktop/desktop_res.s @@ -298,7 +298,7 @@ alert_bitmap2_params: .proc winfo_alert_dialog width = 400 - height = 100 + height = 107 window_id: .byte $0F options: .byte MGTK::Option::dialog_box @@ -316,7 +316,7 @@ mincontlength: .word 50 maxcontwidth: .word 500 maxcontlength: .word 140 port: -viewloc: DEFINE_POINT 75, 35 +viewloc: DEFINE_POINT (screen_width - width) / 2, (screen_height - height) / 2 mapbits: .addr MGTK::screen_mapbits mapwidth: .word MGTK::screen_mapwidth cliprect: DEFINE_RECT 0, 0, width, height @@ -403,7 +403,7 @@ nextwinfo: .addr 0 .proc winfo_about_dialog width = 400 - height = 110 + height = 120 window_id: .byte $18 options: .byte MGTK::Option::dialog_box @@ -421,7 +421,8 @@ mincontlength: .word 50 maxcontwidth: .word 500 maxcontlength: .word 140 port: -viewloc: DEFINE_POINT (screen_width - width) / 2, 40 +viewloc: DEFINE_POINT (screen_width - width) / 2, (screen_height - height) / 2 + mapbits: .addr MGTK::screen_mapbits mapwidth: .word MGTK::screen_mapwidth cliprect: DEFINE_RECT 0, 0, width, height @@ -476,21 +477,21 @@ nextwinfo: .addr 0 ;; Coordinates for labels? .byte $28,$00,$25,$00,$68,$01,$2F,$00,$2D,$00,$2E,$00 -name_input_rect: DEFINE_RECT 40,61,360,71, name_input_rect -name_input_textpos: DEFINE_POINT 45,70, name_input_textpos +name_input_rect: DEFINE_RECT 40,61+6,360,71+6, name_input_rect +name_input_textpos: DEFINE_POINT 45,70+6, name_input_textpos pos_dialog_title: DEFINE_POINT 0, 18, pos_dialog_title point7: DEFINE_POINT 40,18, point7 dialog_label_base_pos: - DEFINE_POINT 40,35, dialog_label_base_pos + DEFINE_POINT 40,35-5, dialog_label_base_pos dialog_label_default_x = 40 dialog_label_pos: DEFINE_POINT dialog_label_default_x,0, dialog_label_pos .proc name_input_mapinfo - DEFINE_POINT 75, 35 + DEFINE_POINT 80, 35+7 .addr MGTK::screen_mapbits .byte MGTK::screen_mapwidth .byte 0 diff --git a/desktop/ovl2.s b/desktop/ovl2.s index 20797df..119bfa0 100644 --- a/desktop/ovl2.s +++ b/desktop/ovl2.s @@ -255,6 +255,8 @@ L0B47: .byte 0 ;;; ============================================================ + labels_voffset = 40 + L0B48: cmp16 screentowindow_windowx, #40 bpl :+ return #$FF @@ -263,16 +265,24 @@ L0B48: cmp16 screentowindow_windowx, #40 return #$FF : lda screentowindow_windowy sec - sbc #43 + sbc #labels_voffset+desktop_aux::dialog_label_height sta screentowindow_windowy lda screentowindow_windowy+1 sbc #0 bpl :+ return #$FF : sta screentowindow_windowy+1 - lsr16 screentowindow_windowy - lsr16 screentowindow_windowy - lsr16 screentowindow_windowy + + ;; Divide by desktop_aux::dialog_label_height + ldx #0 + lda screentowindow_windowy +: sec + sbc #desktop_aux::dialog_label_height + bmi :+ + inx + bne :- ; always + +: stx screentowindow_windowy lda screentowindow_windowy cmp #$04 bcc L0B98 @@ -328,6 +338,8 @@ L0C1F: .byte 0 ;;; Hilight volume label ;;; Input: A = volume index + label_width = 120 + L0C20: ldy #39 sty select_volume_rect::x1 ldy #0 @@ -335,28 +347,30 @@ L0C20: ldy #39 tax lsr a ; / 4 lsr a - sta L0CA9 ; columne (0, 1, or 2) - beq L0C5B - add16 select_volume_rect::x1, #120, select_volume_rect::x1 + sta L0CA9 ; column (0, 1, or 2) + beq :+ + add16 select_volume_rect::x1, #label_width, select_volume_rect::x1 lda L0CA9 cmp #1 - beq L0C5B - add16 select_volume_rect::x1, #120, select_volume_rect::x1 -L0C5B: asl L0CA9 ; * 4 + beq :+ + add16 select_volume_rect::x1, #label_width, select_volume_rect::x1 +: asl L0CA9 ; * 4 asl L0CA9 txa sec sbc L0CA9 ; entry % 4 - asl a - asl a - asl a - clc - adc #$2B + tax + lda #0 +: clc + adc #desktop_aux::dialog_label_height + dex + bpl :- + adc #labels_voffset sta select_volume_rect::y1 - lda #$00 + lda #0 sta select_volume_rect::y1+1 - add16 select_volume_rect::x1, #119, select_volume_rect::x2 - add16 select_volume_rect::y1, #7, select_volume_rect::y2 + add16 select_volume_rect::x1, #label_width-1, select_volume_rect::x2 + add16 select_volume_rect::y1, #desktop_aux::dialog_label_height-1, select_volume_rect::y2 MGTK_RELAY_CALL MGTK::SetPenMode, penXOR MGTK_RELAY_CALL MGTK::PaintRect, select_volume_rect rts