Skip to content

Commit

Permalink
Adjust vertical spacing in Selector Entry picker (Issue #126)
Browse files Browse the repository at this point in the history
  • Loading branch information
inexorabletash committed Feb 10, 2019
1 parent 910d11b commit 2546a63
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 54 deletions.
24 changes: 13 additions & 11 deletions desktop/desktop_res.s
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ winfo_about_dialog_port := winfo_about_dialog::port

.proc winfo_entry_picker
width = 350
height = 118

window_id: .byte $1B
options: .byte MGTK::Option::dialog_box
Expand All @@ -459,10 +460,10 @@ mincontlength: .word 50
maxcontwidth: .word 500
maxcontlength: .word 140
port:
viewloc: DEFINE_POINT (screen_width - width) / 2, 25
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, 110
cliprect: DEFINE_RECT 0, 0, width, height
penpattern: .res 8, $FF
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
penloc: DEFINE_POINT 0, 0
Expand Down Expand Up @@ -498,11 +499,12 @@ dialog_label_pos:
DEFINE_RECT 0, 0, 358, 100
.endproc

entry_picker_item_height = 9 ; default font height

entry_picker_outer_rect:
DEFINE_RECT 4,2,346,108
DEFINE_RECT 4,2,winfo_entry_picker::width-4,winfo_entry_picker::height-2
entry_picker_inner_rect:
DEFINE_RECT 5,3,345,107
DEFINE_RECT 5,3,winfo_entry_picker::width-5,winfo_entry_picker::height-3

;; Line endpoints
entry_picker_line1_start:
Expand All @@ -512,20 +514,20 @@ entry_picker_line1_end:

;; Line endpoints
entry_picker_line2_start:
DEFINE_POINT 6,89
DEFINE_POINT 6,winfo_entry_picker::height-21
entry_picker_line2_end:
DEFINE_POINT 344,89
DEFINE_POINT 344,winfo_entry_picker::height-21

entry_picker_ok_rect:
DEFINE_RECT 210,92,310,103
DEFINE_RECT 210,winfo_entry_picker::height-18,310,winfo_entry_picker::height-7

entry_picker_cancel_rect:
DEFINE_RECT 40,92,140,103
DEFINE_RECT 40,winfo_entry_picker::height-18,140,winfo_entry_picker::height-7

entry_picker_ok_pos:
DEFINE_POINT 215,102
DEFINE_POINT 215,winfo_entry_picker::height-8
entry_picker_cancel_pos:
DEFINE_POINT 45,102
DEFINE_POINT 45,winfo_entry_picker::height-8

;; ???
.word 130,7,220,19
Expand Down Expand Up @@ -568,7 +570,7 @@ entry_picker_item_rect:
DEFINE_RECT 0,0,0,0,entry_picker_item_rect

entry_picker_all_items_rect:
DEFINE_RECT 6,23,344,87
DEFINE_RECT 6,23,344,winfo_entry_picker::height-23

LD887:
.byte 0
Expand Down
89 changes: 46 additions & 43 deletions desktop/ovl3.s
Original file line number Diff line number Diff line change
Expand Up @@ -435,62 +435,63 @@ L9423: addr_call L94F0, run_an_entry_label

L942B: stx $07
sta $06
lda dialog_label_pos
lda dialog_label_pos::xcoord
sta L94A8
tya
pha
cmp #$10
cmp #16 ; 3rd column (16-24)
bcc L9441
sec
sbc #$10
sbc #16
jmp L9448

L9441: cmp #$08
;; 8 rows
L9441: cmp #8 ; 2nd column (8-15)
bcc L9448
sec
sbc #$08
L9448: ldx #$00
stx L94A7
asl a
rol L94A7
asl a
rol L94A7
asl a
rol L94A7
sbc #8

;; A has row
L9448: ldx #0
ldy #entry_picker_item_height
jsr Multiply_16_8_16 ; A,X = A,X * Y
clc
adc #$20
sta dialog_label_pos+2
lda L94A7
adc #32
sta dialog_label_pos::ycoord
txa
adc #0
sta dialog_label_pos+3
sta dialog_label_pos::ycoord+1
pla
cmp #$08
bcs L9471
lda #$00

cmp #8
bcs :+
lda #0 ; col 1
tax
beq L947F
L9471: cmp #$10
bcs L947B
ldx #$00
lda #$73
bne L947F
L947B: ldax #220
beq L947F ; always

: cmp #16
bcs :+
ldx #0
lda #115 ; col 2
bne L947F ; always

: ldax #220 ; col 3

L947F: clc
adc #10
sta dialog_label_pos
sta dialog_label_pos::xcoord
txa
adc #0
sta dialog_label_pos+1
sta dialog_label_pos::xcoord+1
MGTK_RELAY_CALL MGTK::MoveTo, dialog_label_pos
ldax $06
jsr L94CB
lda L94A8
sta dialog_label_pos
sta dialog_label_pos::xcoord
lda #0
sta dialog_label_pos+1
sta dialog_label_pos::xcoord+1
rts

L94A7: .byte 0
L94A8: .byte 0

L94A9: MGTK_RELAY_CALL MGTK::MoveTo, entry_picker_ok_pos
Expand Down Expand Up @@ -677,17 +678,19 @@ L9716: cmp16 screentowindow_windowx, #110
L9732: lda #1
bne L9738
L9736: lda #0

;; Determine row
L9738: pha
lsr16 screentowindow_windowy
lsr16 screentowindow_windowy
lsr16 screentowindow_windowy
lda screentowindow_windowy
ldax screentowindow_windowy
ldy #entry_picker_item_height
jsr Divide_16_8_16
stax screentowindow_windowy
cmp #8
bcc L9756
bcc :+
pla
return #$FF

L9756: pla
: pla
asl a
asl a
asl a
Expand Down Expand Up @@ -754,17 +757,17 @@ L97B6: clc

L97D1: sec
sbc #16
L97D4: asl a
asl a
asl a
L97D4: ldx #0
ldy #entry_picker_item_height
jsr Multiply_16_8_16
clc
adc #24
sta entry_picker_item_rect::y1
lda #0
txa
adc #0
sta entry_picker_item_rect::y1+1
add16 entry_picker_item_rect::x1, #106, entry_picker_item_rect::x2
add16 entry_picker_item_rect::y1, #7, entry_picker_item_rect::y2
add16 entry_picker_item_rect::y1, #entry_picker_item_height-1, entry_picker_item_rect::y2
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_item_rect
MGTK_RELAY_CALL MGTK::SetPenMode, pencopy
Expand Down

0 comments on commit 2546a63

Please sign in to comment.