Subversion Repositories Kolibri OS

Rev

Rev 6800 | Rev 7103 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1362 mikedld 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
1362 mikedld 4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
 
9
$Revision: 6802 $
10
 
11
;==============================================================================
12
;///// public functions ///////////////////////////////////////////////////////
13
;==============================================================================
14
 
1391 mikedld 15
window.BORDER_SIZE = 5
16
 
1362 mikedld 17
uglobal
4778 Akyltist 18
  common_colours rd 48
1391 mikedld 19
  draw_limits    RECT
1362 mikedld 20
endg
21
 
22
;------------------------------------------------------------------------------
1391 mikedld 23
syscall_draw_window: ;///// system function 0 /////////////////////////////////
24
;------------------------------------------------------------------------------
25
        mov     eax, edx
26
        shr     eax, 24
27
        and     al, 0x0f
28
        cmp     al, 5
29
        jae     .exit
30
 
31
        push    eax
32
        call    window._.sys_set_window
33
        pop     eax
34
 
35
        or      al, al
36
        jnz     @f
37
 
5847 pathoswith 38
; type I - original style
1391 mikedld 39
        call    drawwindow_I
40
        jmp     window._.draw_window_caption.2
2436 mario79 41
;--------------------------------------
42
@@:
2288 clevermous 43
        dec     al
1391 mikedld 44
        jnz     @f
45
 
5847 pathoswith 46
; type II - only reserve area, no draw
2453 mario79 47
        call    __sys_draw_pointer
1391 mikedld 48
        jmp     .exit
2436 mario79 49
;--------------------------------------
50
@@:
2288 clevermous 51
        dec     al
1391 mikedld 52
        jnz     @f
53
 
5847 pathoswith 54
; type III  - new style
1391 mikedld 55
        call    drawwindow_III
56
        jmp     window._.draw_window_caption.2
2436 mario79 57
;--------------------------------------
58
@@:
5847 pathoswith 59
; type IV & V - skinned window (resizable & not)
2288 clevermous 60
        mov     eax, [TASK_COUNT]
1391 mikedld 61
        movzx   eax, word[WIN_POS + eax * 2]
62
        cmp     eax, [CURRENT_TASK]
63
        setz    al
64
        movzx   eax, al
65
        push    eax
66
        call    drawwindow_IV
67
        jmp     window._.draw_window_caption.2
2436 mario79 68
;--------------------------------------
69
.exit:
1391 mikedld 70
        ret
2436 mario79 71
;------------------------------------------------------------------------------
1362 mikedld 72
syscall_display_settings: ;///// system function 48 ///////////////////////////
73
;------------------------------------------------------------------------------
6800 pathoswith 74
        cmp     ebx, 13
1362 mikedld 75
        ja      @f
6800 pathoswith 76
        jmp     dword[.ftable + ebx*4]
77
 
78
align 4
79
.ftable:
80
dd  .redrawWholeScreen
81
dd  .setButtonStyle
82
dd  .setSystemColors
83
dd  .getSystemColors
84
dd  .getCaptionHeight
85
dd  .getScreenWorkingArea
86
dd  .setScreenWorkingArea
87
dd  .getSkinMargins
88
dd  .setSkin
89
dd  .getFontSmoothing
90
dd  .setFontSmoothing
91
dd  .getFontSize
92
dd  .setFontSize
93
dd  .setSkinUnicode
94
 
95
.redrawWholeScreen:
1362 mikedld 96
        xor     eax, eax
97
        inc     ebx
98
        cmp     [windowtypechanged], ebx
6800 pathoswith 99
        jne     .ret
1362 mikedld 100
        mov     [windowtypechanged], eax
6800 pathoswith 101
.redrawScreen:
102
        xor     eax, eax
103
        mov     [draw_limits.left], eax
104
        mov     [draw_limits.top], eax
105
        mov     eax, [_display.width]
106
        dec     eax
107
        mov     [draw_limits.right], eax
108
        mov     eax, [_display.height]
109
        dec     eax
110
        mov     [draw_limits.bottom], eax
111
        mov     eax, window_data
112
        jmp     redrawscreen
113
 
114
.setButtonStyle:
115
; in: ecx: 0 = flat, 1 = with gradient
1362 mikedld 116
        and     ecx, 1
117
        cmp     ecx, [buttontype]
6800 pathoswith 118
        je      .ret
1362 mikedld 119
        mov     [buttontype], ecx
120
        mov     [windowtypechanged], ebx
6800 pathoswith 121
.ret:
1362 mikedld 122
        ret
6800 pathoswith 123
 
124
.setSystemColors:
125
; in: ecx = pointer to color table, edx = size of color table
1362 mikedld 126
        dec     ebx
127
        mov     esi, ecx
4796 Akyltist 128
        cmp     edx, 192
129
        jnae    @f
130
        mov     edx, 192 ; max size
5847 pathoswith 131
@@:
1362 mikedld 132
        mov     edi, common_colours
133
        mov     ecx, edx
2288 clevermous 134
        rep movsb
1362 mikedld 135
        mov     [windowtypechanged], ebx
136
        ret
6800 pathoswith 137
 
138
.getSystemColors:
139
; in: ecx = pointer to color table, edx = size of color table
1362 mikedld 140
        mov     edi, ecx
4796 Akyltist 141
        cmp     edx, 192
142
        jnae    @f
143
        mov     edx, 192 ; max size
5847 pathoswith 144
@@:
1362 mikedld 145
        mov     esi, common_colours
146
        mov     ecx, edx
2288 clevermous 147
        rep movsb
1362 mikedld 148
        ret
6800 pathoswith 149
 
150
.getCaptionHeight:
1362 mikedld 151
        mov     eax, [_skinh]
152
        mov     [esp + 32], eax
153
        ret
6800 pathoswith 154
 
155
.getScreenWorkingArea:
156
; out: eax = pack[left, right], ebx = pack[top, bottom]
1362 mikedld 157
        mov     eax, [screen_workarea.left - 2]
158
        mov     ax, word[screen_workarea.right]
159
        mov     [esp + 32], eax
160
        mov     eax, [screen_workarea.top - 2]
161
        mov     ax, word[screen_workarea.bottom]
162
        mov     [esp + 20], eax
163
        ret
6800 pathoswith 164
 
165
.setScreenWorkingArea:
166
; in: ecx = pack[left, right], edx = pack[top, bottom]
1362 mikedld 167
        xor     esi, esi
5350 serge 168
        mov     edi, [_display.width]
169
        dec     edi
1362 mikedld 170
        mov     eax, ecx
171
        movsx   ebx, ax
172
        sar     eax, 16
173
        cmp     eax, ebx
174
        jge     .check_horizontal
175
        inc     esi
176
        or      eax, eax
177
        jge     @f
178
        xor     eax, eax
2436 mario79 179
@@:
2288 clevermous 180
        mov     [screen_workarea.left], eax
1362 mikedld 181
        cmp     ebx, edi
182
        jle     @f
183
        mov     ebx, edi
2436 mario79 184
@@:
2288 clevermous 185
        mov     [screen_workarea.right], ebx
2436 mario79 186
.check_horizontal:
5350 serge 187
        mov     edi, [_display.height]
188
        dec     edi
1362 mikedld 189
        mov     eax, edx
190
        movsx   ebx, ax
191
        sar     eax, 16
192
        cmp     eax, ebx
193
        jge     .check_if_redraw_needed
194
        inc     esi
195
        or      eax, eax
196
        jge     @f
197
        xor     eax, eax
2436 mario79 198
@@:
2288 clevermous 199
        mov     [screen_workarea.top], eax
1362 mikedld 200
        cmp     ebx, edi
201
        jle     @f
202
        mov     ebx, edi
2436 mario79 203
@@:
2288 clevermous 204
        mov     [screen_workarea.bottom], ebx
2436 mario79 205
.check_if_redraw_needed:
1362 mikedld 206
        or      esi, esi
5847 pathoswith