more unicode functions

git-svn-id: svn://kolibrios.org@6800 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2016-12-18 03:13:18 +00:00
parent ccedb4ca44
commit ee04f7ac02
4 changed files with 216 additions and 204 deletions

View File

@ -1940,6 +1940,15 @@ path db 'HD0/1',0
* После прочтения значения обнуляются. * После прочтения значения обнуляются.
* Данные имеют знаковые значения. * Данные имеют знаковые значения.
------- Подфункция 8 - загрузить курсор с указанием кодировки. -------
Параметры:
* eax = 37 - номер функции
* ebx = 8 - номер подфункции
* ecx = указатель на строку с путём к файлу курсора
* edx = кодировка строки, подробности указаны в описании функции 80.
Возвращаемое значение:
* eax = хэндл курсора, 0 - неудача
---------------------- Константы для регистров: ---------------------- ---------------------- Константы для регистров: ----------------------
eax - SF_MOUSE_GET (37) eax - SF_MOUSE_GET (37)
ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1), ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1),
@ -2429,6 +2438,26 @@ dword-значение цвета 0x00RRGGBB
eax - SF_STYLE_SETTINGS (48) eax - SF_STYLE_SETTINGS (48)
ebx - SSF_SET_FONT_SIZE (12) ebx - SSF_SET_FONT_SIZE (12)
====================================================================== ======================================================================
= Функция 48, подфункция 13 - установить скин с указанием кодировки. =
======================================================================
Параметры:
* eax = 48 - номер функции
* ebx = 13 - номер подфункции
* ecx = указатель на строку с путём к файлу скина
* edx = кодировка строки, подробности указаны в описании функции 80.
Возвращаемое значение:
* eax = 0 - успешно
* eax = 1 - не удалось загрузить файл
* eax = 2 - файл не является файлом скина
Замечания:
* При успешной загрузке скина все окна извещаются о необходимости
перерисовки (событие 1).
* При загрузке система считывает скин из файла default.skn
на рамдиске.
* Пользователь может изменять скин статически, создав свой
default.skn, или динамически с помощью приложения desktop.
======================================================================
============ Функция 49 - Advanced Power Management (APM). =========== ============ Функция 49 - Advanced Power Management (APM). ===========
====================================================================== ======================================================================
Параметры: Параметры:

View File

@ -1922,6 +1922,15 @@ Remarks:
* Values are zeroed after reading. * Values are zeroed after reading.
* Values are signed. * Values are signed.
-------- Subfunction 8 - load cursor, specifying the encoding --------
Parameters:
* eax = 37 - function number
* ebx = 8 - subfunction number
* ecx = pointer to the cursor file path string
* edx = string encoding, details can be found in function 80 description.
Returned value:
* eax = cursor handle, 0 - failed
---------------------- Constants for registers: ---------------------- ---------------------- Constants for registers: ----------------------
eax - SF_MOUSE_GET (37) eax - SF_MOUSE_GET (37)
ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1), ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1),
@ -2407,6 +2416,27 @@ Parameters:
eax - SF_STYLE_SETTINGS (48) eax - SF_STYLE_SETTINGS (48)
ebx - SSF_SET_FONT_SIZE (12) ebx - SSF_SET_FONT_SIZE (12)
====================================================================== ======================================================================
== Function 48, subfunction 13 - set skin, specifying the encoding. ==
======================================================================
Parameters:
* eax = 48 - function number
* ebx = 13 - subfunction number
* ecx = pointer to the skin file path string
* edx = string encoding, details can be found in function 80 description.
Returned value:
* eax = 0 - success
* otherwise eax = file system error code; if file does not
contain valid skin, function returns error 3
(unknown file system).
Remarks:
* After successful skin loading the system sends to all windows
redraw message (the event 1).
* At booting the system reads skin from file 'default.skn'
on ramdisk.
* User can change the skin statically by creating hisself
'default.skn' or dynamically with the application 'desktop'.
======================================================================
=========== Function 49 - Advanced Power Management (APM). =========== =========== Function 49 - Advanced Power Management (APM). ===========
====================================================================== ======================================================================
Parameters: Parameters:

View File

@ -14,17 +14,6 @@ $Revision$
window.BORDER_SIZE = 5 window.BORDER_SIZE = 5
macro FuncTable name, table_name, [label]
{
common
align 4
\label name#.#table_name dword
forward
dd name#.#label
common
name#.sizeof.#table_name = $ - name#.#table_name
}
uglobal uglobal
common_colours rd 48 common_colours rd 48
draw_limits RECT draw_limits RECT
@ -82,85 +71,58 @@ syscall_draw_window: ;///// system function 0 /////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
syscall_display_settings: ;///// system function 48 /////////////////////////// syscall_display_settings: ;///// system function 48 ///////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;; Redraw screen: cmp ebx, 13
;< ebx = 0
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Set button style:
;< ebx = 1
;< ecx = 0 (flat) or 1 (with gradient)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Set system color palette:
;< ebx = 2
;< ecx = pointer to color table
;< edx = size of color table
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Get system color palette:
;< ebx = 3
;< ecx = pointer to color table buffer
;< edx = size of color table buffer
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Get skinned caption height:
;< ebx = 4
;> eax = height in pixels
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Get screen working area:
;< ebx = 5
;> eax = pack[16(left), 16(right)]
;> ebx = pack[16(top), 16(bottom)]
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Set screen working area:
;< ebx = 6
;< ecx = pack[16(left), 16(right)]
;< edx = pack[16(top), 16(bottom)]
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Get skin margins:
;< ebx = 7
;> eax = pack[16(left), 16(right)]
;> ebx = pack[16(top), 16(bottom)]
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Set skin:
;< ebx = 8
;< ecx = pointer to FileInfoBlock struct
;> eax = FS error code
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Get font smoothing:
;< ebx = 9
;> eax = 0 off, 1 on, 2 subpixel
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Set font smoothing:
;< ebx = 10
;< ecx = 0 off, 1 on, 2 subpixel
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Get font size:
;< ebx = 11
;> eax = height in pixels
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Set font size:
;< ebx = 12
;< ecx = height in pixels
;------------------------------------------------------------------------------
cmp ebx, .sizeof.ftable / 4
ja @f ja @f
jmp [.ftable + ebx * 4] jmp dword[.ftable + ebx*4]
;------------------------------------------------------------------------------
syscall_display_settings.00: align 4
.ftable:
dd .redrawWholeScreen
dd .setButtonStyle
dd .setSystemColors
dd .getSystemColors
dd .getCaptionHeight
dd .getScreenWorkingArea
dd .setScreenWorkingArea
dd .getSkinMargins
dd .setSkin
dd .getFontSmoothing
dd .setFontSmoothing
dd .getFontSize
dd .setFontSize
dd .setSkinUnicode
.redrawWholeScreen:
xor eax, eax xor eax, eax
inc ebx inc ebx
cmp [windowtypechanged], ebx cmp [windowtypechanged], ebx
jne @f jne .ret
mov [windowtypechanged], eax mov [windowtypechanged], eax
jmp syscall_display_settings._.redraw_whole_screen .redrawScreen:
;------------------------------------------------------------------------------ xor eax, eax
syscall_display_settings.01: mov [draw_limits.left], eax
mov [draw_limits.top], eax
mov eax, [_display.width]
dec eax
mov [draw_limits.right], eax
mov eax, [_display.height]
dec eax
mov [draw_limits.bottom], eax
mov eax, window_data
jmp redrawscreen
.setButtonStyle:
; in: ecx: 0 = flat, 1 = with gradient
and ecx, 1 and ecx, 1
cmp ecx, [buttontype] cmp ecx, [buttontype]
je @f je .ret
mov [buttontype], ecx mov [buttontype], ecx
mov [windowtypechanged], ebx mov [windowtypechanged], ebx
@@: .ret:
ret ret
;------------------------------------------------------------------------------
syscall_display_settings.02: .setSystemColors:
; in: ecx = pointer to color table, edx = size of color table
dec ebx dec ebx
mov esi, ecx mov esi, ecx
cmp edx, 192 cmp edx, 192
@ -172,8 +134,9 @@ syscall_display_settings.02:
rep movsb rep movsb
mov [windowtypechanged], ebx mov [windowtypechanged], ebx
ret ret
;------------------------------------------------------------------------------
syscall_display_settings.03: .getSystemColors:
; in: ecx = pointer to color table, edx = size of color table
mov edi, ecx mov edi, ecx
cmp edx, 192 cmp edx, 192
jnae @f jnae @f
@ -183,13 +146,14 @@ syscall_display_settings.03:
mov ecx, edx mov ecx, edx
rep movsb rep movsb
ret ret
;------------------------------------------------------------------------------
syscall_display_settings.04: .getCaptionHeight:
mov eax, [_skinh] mov eax, [_skinh]
mov [esp + 32], eax mov [esp + 32], eax
ret ret
;------------------------------------------------------------------------------
syscall_display_settings.05: .getScreenWorkingArea:
; out: eax = pack[left, right], ebx = pack[top, bottom]
mov eax, [screen_workarea.left - 2] mov eax, [screen_workarea.left - 2]
mov ax, word[screen_workarea.right] mov ax, word[screen_workarea.right]
mov [esp + 32], eax mov [esp + 32], eax
@ -197,8 +161,9 @@ syscall_display_settings.05:
mov ax, word[screen_workarea.bottom] mov ax, word[screen_workarea.bottom]
mov [esp + 20], eax mov [esp + 20], eax
ret ret
;------------------------------------------------------------------------------
syscall_display_settings.06: .setScreenWorkingArea:
; in: ecx = pack[left, right], edx = pack[top, bottom]
xor esi, esi xor esi, esi
mov edi, [_display.width] mov edi, [_display.width]
dec edi dec edi
@ -240,49 +205,8 @@ syscall_display_settings.06:
.check_if_redraw_needed: .check_if_redraw_needed:
or esi, esi or esi, esi
jz @f jz @f
call repos_windows call repos_windows
jmp syscall_display_settings._.calculate_whole_screen .calculateScreen:
;------------------------------------------------------------------------------
syscall_display_settings.07:
mov eax, [_skinmargins + 0]
mov [esp + 32], eax
mov eax, [_skinmargins + 4]
mov [esp + 20], eax
@@:
ret
;------------------------------------------------------------------------------
syscall_display_settings.08:
mov ebx, ecx
call read_skin_file
mov [esp + 32], eax
test eax, eax
jnz @b
call syscall_display_settings._.calculate_whole_screen
jmp syscall_display_settings._.redraw_whole_screen
;------------------------------------------------------------------------------
syscall_display_settings.09:
xor eax, eax
mov al, [fontSmoothing]
mov [esp + 32], eax
ret
;------------------------------------------------------------------------------
syscall_display_settings.10:
mov [fontSmoothing], cl
ret
;------------------------------------------------------------------------------
syscall_display_settings.11:
xor eax, eax
mov al, [fontSize]
mov [esp + 32], eax
ret
;------------------------------------------------------------------------------
syscall_display_settings.12:
mov [fontSize], cl
ret
;------------------------------------------------------------------------------
syscall_display_settings._.calculate_whole_screen:
xor eax, eax xor eax, eax
xor ebx, ebx xor ebx, ebx
mov ecx, [_display.width] mov ecx, [_display.width]
@ -290,19 +214,63 @@ syscall_display_settings._.calculate_whole_screen:
dec ecx dec ecx
dec edx dec edx
jmp calculatescreen jmp calculatescreen
;------------------------------------------------------------------------------
syscall_display_settings._.redraw_whole_screen: .getSkinMargins:
; out: eax = pack[left, right], ebx = pack[top, bottom]
mov eax, [_skinmargins + 0]
mov [esp + 32], eax
mov eax, [_skinmargins + 4]
mov [esp + 20], eax
ret
.setSkin:
; in: ecx -> file path string
mov ebx, ecx
call read_skin_file
mov [esp + 32], eax
test eax, eax
jnz .ret
call .calculateScreen
jmp .redrawScreen
.getFontSmoothing:
xor eax, eax xor eax, eax
mov [draw_limits.left], eax mov al, [fontSmoothing]
mov [draw_limits.top], eax mov [esp + 32], eax
mov eax, [_display.width] ret
dec eax
mov [draw_limits.right], eax .setFontSmoothing:
mov eax, [_display.height] mov [fontSmoothing], cl
dec eax ret
mov [draw_limits.bottom], eax
mov eax, window_data .getFontSize:
jmp redrawscreen xor eax, eax
mov al, [fontSize]
mov [esp + 32], eax
ret
.setFontSize:
mov [fontSize], cl
ret
.setSkinUnicode:
; in: ecx -> file path string, edx = string encoding
push ecx edx
stdcall kernel_alloc, maxPathLength
mov edi, eax
pop eax esi
push edi
call getFullPath
test eax, eax
jz @f
mov ebx, [esp]
call read_skin_file
mov [esp + 32 + 4], eax
@@:
call kernel_free
call .calculateScreen
jmp .redrawScreen
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
syscall_set_window_shape: ;///// system function 50 /////////////////////////// syscall_set_window_shape: ;///// system function 50 ///////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -617,29 +585,6 @@ align 4
mov [edi + WDATA.box.height], eax mov [edi + WDATA.box.height], eax
jmp .fix_client_box jmp .fix_client_box
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
;align 4
;------------------------------------------------------------------------------
;sys_window_mouse: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
; NOTE: commented out since doesn't provide necessary functionality
; anyway, to be reworked
; push eax
;
; mov eax, [timer_ticks]
; cmp [new_window_starting], eax
; jb .exit
;
; mov byte[MOUSE_BACKGROUND], 0
; mov byte[DONT_DRAW_MOUSE], 0
;
; mov [new_window_starting], eax
;
; .exit:
; pop eax
; ret
;------------------------------------------------------------------------------
align 4 align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
draw_rectangle: ;////////////////////////////////////////////////////////////// draw_rectangle: ;//////////////////////////////////////////////////////////////
@ -1046,8 +991,8 @@ align 4
jz @f jz @f
push edx push edx
call syscall_display_settings._.calculate_whole_screen call syscall_display_settings.calculateScreen
call syscall_display_settings._.redraw_whole_screen call syscall_display_settings.redrawScreen
pop edx pop edx
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -1381,11 +1326,8 @@ sys_window_moving_handler: ;///////////////////////////////////////////////////
;============================================================================== ;==============================================================================
iglobal iglobal
FuncTable syscall_display_settings, ftable, \ align 4
00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12 window_topleft dd \
align 4
window_topleft dd \
1, 21, \ ;type 0 1, 21, \ ;type 0
0, 0, \ ;type 1 0, 0, \ ;type 1
5, 20, \ ;type 2 5, 20, \ ;type 2
@ -1393,11 +1335,6 @@ iglobal
5, ? ;type 4 {set by skin} 5, ? ;type 4 {set by skin}
endg endg
;uglobal
; NOTE: commented out since doesn't provide necessary functionality anyway,
; to be reworked
; new_window_starting dd ?
;endg
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -1871,20 +1871,7 @@ get_timer_ticks:
mov eax, [timer_ticks] mov eax, [timer_ticks]
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
iglobal
align 4
mousefn dd msscreen
dd mswin
dd msbutton
dd msbuttonExt
dd app_load_cursor
dd app_set_cursor
dd app_delete_cursor
dd msz
endg
;-----------------------------------------------------------------------------
readmousepos: readmousepos:
; eax=0 screen relative ; eax=0 screen relative
; eax=1 window relative ; eax=1 window relative
; eax=2 buttons pressed ; eax=2 buttons pressed
@ -1893,12 +1880,24 @@ readmousepos:
; eax=5 set cursor ; eax=5 set cursor
; eax=6 delete cursor ; eax=6 delete cursor
; eax=7 get mouse_z ; eax=7 get mouse_z
; eax=8 load cursor unicode
cmp ebx, 7 cmp ebx, 8
ja @f ja @f
jmp [mousefn+ebx*4] jmp dword[.mousefn+ebx*4]
msscreen: align 4
.mousefn:
dd .msscreen
dd .mswin
dd .msbutton
dd .msbuttonExt
dd .app_load_cursor
dd .app_set_cursor
dd .app_delete_cursor
dd .msz
dd .loadCursorUni
.msscreen:
mov eax, [MOUSE_X] mov eax, [MOUSE_X]
shl eax, 16 shl eax, 16
mov ax, [MOUSE_Y] mov ax, [MOUSE_Y]
@ -1906,7 +1905,7 @@ msscreen:
@@: @@:
ret ret
mswin: .mswin:
mov eax, [MOUSE_X] mov eax, [MOUSE_X]
shl eax, 16 shl eax, 16
mov ax, [MOUSE_Y] mov ax, [MOUSE_Y]
@ -1924,17 +1923,17 @@ mswin:
mov [esp+36-4], eax mov [esp+36-4], eax
ret ret
msbutton: .msbutton:
movzx eax, byte [BTN_DOWN] movzx eax, byte [BTN_DOWN]
mov [esp+36-4], eax mov [esp+36-4], eax
ret ret
msbuttonExt: .msbuttonExt:
mov eax, [BTN_DOWN] mov eax, [BTN_DOWN]
mov [esp+36-4], eax mov [esp+36-4], eax
ret ret
app_load_cursor: .app_load_cursor:
cmp ecx, OS_BASE cmp ecx, OS_BASE
jae @f jae @f
stdcall load_cursor, ecx, edx stdcall load_cursor, ecx, edx
@ -1942,17 +1941,35 @@ app_load_cursor:
@@: @@:
ret ret
app_set_cursor: .loadCursorUni:
cmp ecx, OS_BASE
jae @b
push ecx edx
stdcall kernel_alloc, maxPathLength
mov edi, eax
pop eax esi
push edi
call getFullPath
pop ebp
test eax, eax
jz @f
stdcall load_cursor, ebp, LOAD_FROM_FILE
mov [esp+32], eax
@@:
stdcall kernel_free, ebp
ret
.app_set_cursor:
stdcall set_cursor, ecx stdcall set_cursor, ecx
mov [esp+36-4], eax mov [esp+36-4], eax
ret ret
app_delete_cursor: .app_delete_cursor:
stdcall delete_cursor, ecx stdcall delete_cursor, ecx
mov [esp+36-4], eax mov [esp+36-4], eax
ret ret
msz: .msz:
mov edi, [TASK_COUNT] mov edi, [TASK_COUNT]
movzx edi, word [WIN_POS + edi*2] movzx edi, word [WIN_POS + edi*2]
cmp edi, [CURRENT_TASK] cmp edi, [CURRENT_TASK]
@ -2278,9 +2295,8 @@ sysfn_deactivate: ; 18.1 = DEACTIVATE WINDOW
movzx esi, word [WIN_STACK + ecx * 2] movzx esi, word [WIN_STACK + ecx * 2]
lea esi, [WIN_POS + esi * 2] lea esi, [WIN_POS + esi * 2]
call window._.window_deactivate call window._.window_deactivate
call syscall_display_settings.calculateScreen
call syscall_display_settings._.calculate_whole_screen call syscall_display_settings.redrawScreen
call syscall_display_settings._.redraw_whole_screen
.nowindowdeactivate: .nowindowdeactivate:
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------