Compare commits

...
Author SHA1 Message Date
Burer bfb69dd67a system/setup: grid layout, fix mouse and font height handling
Test PR / Build (en_US) (pull_request) Successful in 1m54s
Test PR / Build (es_ES) (pull_request) Successful in 1m59s
Test PR / Build (ru_RU) (pull_request) Successful in 2m6s
Layout:
- controls 24 px high and 12 px apart, 8 px to the window border
  (12 at the top); text centred on the capitals of the 8x16 font
- value boxes sunken, the -/+ buttons share one frame with them
- checkboxes: box before the label, spread without per-item widths
- group title drawn over the frame with a filled background
- bevel and checkbox colours derived from the skin, no hardcoded white

Fixes:
- the window re-applied the mouse settings read at start, reverting
  changes made meanwhile; mouse is now read and applied by BOOT only
- font height is clamped to 9..99, a larger ini value showed garbage
  and could fault on div
- a GetButton result of 1 (no button) indexed rows out of bounds
- hidden checkbox buttons flashed an XOR frame when pressed
- skip bg_program when it is empty; drop duplicate LBA/PCI strings

Assisted-by: Claude:claude-opus-5-5
2026-09-29 19:42:20 +03:00
Leency d6010bc759 system/setup: all eight kernel languages again
Test PR / Build (ru_RU) (pull_request) Successful in 1m54s
Test PR / Build (es_ES) (pull_request) Successful in 1m57s
Test PR / Build (en_US) (pull_request) Successful in 2m3s
The language list is the kernel one again: en fi de ru fr et es it.
Russian and Spanish have their texts, the others use English.

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 19:33:15 +03:00
Leency f022313a49 system/eskin: bring back, outdated
Test PR / Build (en_US) (pull_request) Successful in 1m53s
Test PR / Build (es_ES) (pull_request) Successful in 2m2s
Test PR / Build (ru_RU) (pull_request) Successful in 2m5s
SETUP BOOT applies the style now; eskin stays in the tree unused.

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 18:37:38 +03:00
Leency e87eaace4c system/setup: keep the speaker setting in [low-level]
Test PR / Build (es_ES) (pull_request) Successful in 1m49s
Test PR / Build (en_US) (pull_request) Successful in 1m54s
Test PR / Build (ru_RU) (pull_request) Successful in 2m1s
Assisted-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 18:07:25 +03:00
Leency bcd09d2952 system/setup: keep "speaker" instead of "speaker mute" in system.ini
Test PR / Build (es_ES) (pull_request) Successful in 1m50s
Test PR / Build (ru_RU) (pull_request) Successful in 1m58s
Test PR / Build (en_US) (pull_request) Successful in 2m0s
The checkbox means "speaker on", so system.ini now keeps the same:
speaker=on / speaker=off. The default system.ini is updated.

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 18:01:41 +03:00
Leency fc9a2a0fc7 system/setup: rework the window, merge eskin into setup
Test PR / Build (en_US) (pull_request) Successful in 2m8s
Test PR / Build (es_ES) (pull_request) Successful in 2m11s
Test PR / Build (ru_RU) (pull_request) Successful in 2m13s
The window:
- 8x16 UTF-8 system font and system colours, values on light boxes
- English, Spanish and Russian texts; the language list is those three
- LBA, PCI and the speaker as @RESHARE checkboxes in an "Access
  settings" group; the speaker box means "speaker on"
- no Apply button: every change is applied and saved to system.ini
  at once; changing the language or the font smoothing repaints

The code:
- settings.inc reads the settings from the kernel and from system.ini,
  applies them and saves them; one table drives system.ini
- SETUP BOOT also applies the [style] section (button style, desktop
  background, skin), which is what eskin did; eskin is removed from
  the tree, AUTORUN.DAT and data/Tupfile.lua
- format meos 01 header, packed size under 2 KB

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 17:51:46 +03:00
6 changed files with 599 additions and 480 deletions

No files matched your search

-1
View File
@@ -427,7 +427,6 @@ tup.append_table(img_files, {
{"DEFAULT.SKN", VAR_SKINS .. "/../skins/Leency/Shkvorka/Shkvorka.skn"},
{"DISPTEST", VAR_PROGS .. "/testing/disptest/disptest"},
{"END", VAR_PROGS .. "/system/end/light/end"},
{"ESKIN", VAR_PROGS .. "/system/eskin/eskin"},
{"GMON", VAR_PROGS .. "/system/gmon/gmon"},
{"HDD_INFO", VAR_PROGS .. "/system/hdd_info/hdd_info"},
{"KBD", VAR_PROGS .. "/testing/kbd/kbd"},
-1
View File
@@ -10,7 +10,6 @@
/SYS/SETUP BOOT 0 # Load device settings
/SYS/LOADDRV I2CHID 0 # Start I2C touchpad driver
/SYS/@TASKBAR "" 0 # Start taskbar
/SYS/ESKIN "" 0 # Set style
/SYS/@ICON "" 0 # Multithread desktop icons
/SYS/TMPDISK A0 0 # Add virtual RAM disk /tmp0/1
/SYS/@RESHARE "" 0 # Shared resources
+1 -1
View File
@@ -3,7 +3,6 @@ language=en
font file=/sys/Fonts/Tahoma.kf
font smoothing=sbp
font height=9
speaker mute=off
[touchpad]
speed=100
@@ -29,6 +28,7 @@ double_click_delay=64
[low-level]
LBA=off
PCI=on
speaker=on
;timeout in minutes
;program needs a full path
@@ -20,7 +20,6 @@ disptest;
docpack;Документация / Блок документов;asm;http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/docpack;;http://wiki.kolibrios.org/wiki/Docpack/ru
easyshot;Простой скриншотер;c--;http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/cmm/misc/easyshot.c;http://board.kolibrios.org/viewtopic.php?t=3695;
end;Программа завершения работы;asm;http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/end;http://board.kolibrios.org/viewtopic.php?t=2442;http://wiki.kolibrios.org/wiki/End/ru
eskin;Установщик фона и скина при старте системы;asm;http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/eskin;http://board.kolibrios.org/viewtopic.php?t=2424;
fb2read;Читалка FB2;oberon07;http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/other/fb2reader;http://board.kolibrios.org/viewtopic.php?t=3128;
fspeed;Тестирование скорости диска;asm;http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/testing/fspeed;http://board.kolibrios.org/viewtopic.php?t=2660;
gmon;Информация о загрузке системы;asm;http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/gmon;http://board.kolibrios.org/viewtopic.php?t=470;http://wiki.kolibrios.org/wiki/Gmon/ru
1 Имя программы Описание Lang Gitea Forum Wiki
20 docpack Документация / Блок документов asm http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/docpack http://wiki.kolibrios.org/wiki/Docpack/ru
21 easyshot Простой скриншотер c-- http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/cmm/misc/easyshot.c http://board.kolibrios.org/viewtopic.php?t=3695
22 end Программа завершения работы asm http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/end http://board.kolibrios.org/viewtopic.php?t=2442 http://wiki.kolibrios.org/wiki/End/ru
eskin Установщик фона и скина при старте системы asm http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/eskin http://board.kolibrios.org/viewtopic.php?t=2424
23 fb2read Читалка FB2 oberon07 http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/other/fb2reader http://board.kolibrios.org/viewtopic.php?t=3128
24 fspeed Тестирование скорости диска asm http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/testing/fspeed http://board.kolibrios.org/viewtopic.php?t=2660
25 gmon Информация о загрузке системы asm http://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/gmon http://board.kolibrios.org/viewtopic.php?t=470 http://wiki.kolibrios.org/wiki/Gmon/ru
+256
View File
@@ -0,0 +1,256 @@
; SPDX-License-Identifier: NOASSERTION
;
; System settings: read them from the kernel or from system.ini,
; apply them to the kernel and save them to system.ini.
;---------------------------------------------------------------
; Take the current values from the kernel, the mouse ones at system start only
settings_read_boot:
mcall 18,19,0
mov [mouseSpeed],eax
mcall 18,,2
mov [mouseAccel],eax
mcall 18,,6
mov [mouseDelay],eax
settings_read_system:
mcall 26,5
dec eax ; the kernel counts languages from 1
cmp eax,LANGUAGES
jb @f
xor eax,eax
@@:
mov [language],eax
mcall 26,11
mov [lba],eax
mcall 26,12
mov [pci],eax
mcall 18,8,1
mov [speakerMute],eax
mcall 48,9
mov [fontSmoothing],eax
mcall 48,11
mov [fontHeight],eax
; keep the font height within what the window shows and steps through
font_height_limits:
mov eax,[fontHeight]
cmp eax,FONT_H_MIN
jge @f
mov eax,FONT_H_MIN
@@:
cmp eax,FONT_H_MAX
jle @f
mov eax,FONT_H_MAX
@@:
mov [fontHeight],eax
ret
;---------------------------------------------------------------
; Override the values with the ones stored in system.ini.
; A missing or unknown value keeps the current one.
settings_read_ini:
mov esi,iniSettings
.next:
mov edi,[esi+12]
test edi,edi
jnz .word
mov eax,[esi+8]
invoke ini.get_int, sz_ini, [esi], [esi+4], [eax]
jmp .store
.word:
and [iniWord],0
invoke ini.get_str, sz_ini, [esi], [esi+4], iniWord, 4, 0
mov eax,[iniWord]
or eax,0x20202020 ; lowercase, zeroes become spaces
xor edx,edx
@@:
cmp eax,[edi+4+edx*4]
jz .found
inc edx
cmp edx,[edi]
jb @b
jmp .skip
.found:
mov eax,edx
.store:
mov edx,[esi+8]
mov [edx],eax
.skip:
add esi,16
cmp esi,iniSettings.end
jb .next
jmp font_height_limits
;---------------------------------------------------------------
; Store the values to system.ini (all but the mouse ones).
; Not ebx for the loop: ini_set_str returns with ebx = 13.
settings_save_ini:
mov esi,iniSettings
.next:
mov eax,[esi+8]
mov eax,[eax]
mov edi,[esi+12]
test edi,edi
jnz .word
invoke ini.set_int, sz_ini, [esi], [esi+4], eax
jmp .done
.word:
mov eax,[edi+4+eax*4]
mov [iniWord],eax
xor ecx,ecx ; length of the word
@@:
cmp byte[iniWord+ecx],' '
jz @f
inc ecx
cmp ecx,4
jb @b
@@:
invoke ini.set_str, sz_ini, [esi], [esi+4], iniWord, ecx
.done:
add esi,16
cmp esi,iniSettings.saved
jb .next
ret
;---------------------------------------------------------------
; Pass the values to the kernel, the mouse ones at system start only
settings_apply_boot:
mcall 18,19,1,[mouseSpeed]
mcall 18,,3,[mouseAccel]
mcall 18,,7,[mouseDelay]
settings_apply:
mov ecx,[language]
inc ecx
mcall 21,5
mcall 21,11,[lba]
mcall 21,12,[pci]
mcall 48,10,[fontSmoothing]
mcall 48,12,[fontHeight]
; the speaker can only be toggled
mcall 18,8,1
cmp eax,[speakerMute]
jz @f
mcall 18,,2
@@:
ret
;---------------------------------------------------------------
; Button style, desktop background and skin from the [style] section.
; Used at system start only.
style_apply:
invoke ini.get_int, sz_ini, sz_style, sz_buttonStyle, 0
mcall 48,1,eax
; the background is set by a program: bg_program with bg_param
invoke ini.get_str, sz_ini, sz_style, sz_bgProgram, bgProgram, PATH_MAX, 0
cmp byte[bgProgram],0
jz .skin
invoke ini.get_str, sz_ini, sz_style, sz_bgParam, bgParam, PATH_MAX, 0
cmp byte[bgParam],'\' ; KIV param like '\S__/path/to/img'
jnz @f
mov [fileInfo.path],bgParam+4
call wait_for_file
@@:
mcall 70,runBgProgram
.skin:
invoke ini.get_str, sz_ini, sz_style, sz_skin, skinPath, PATH_MAX, 0
cmp byte[skinPath],0
jz @f
mov [fileInfo.path],skinPath
call wait_for_file
mcall 48,8,skinPath
@@:
ret
; Files on /kolibrios and /usbhd may appear a few seconds after boot:
; try to read the file for up to 5 seconds
wait_for_file:
mov edi,5
@@:
mcall 70,fileInfo
test eax,eax
jz @f
mcall 5,100
dec edi
jnz @b
@@:
ret
;---------------------------------------------------------------
; DATA
; The languages of the kernel
LANGUAGES = 8
FONT_H_MIN = 9
FONT_H_MAX = 99 ; two digits in the window
PATH_MAX = 256
; Every value stored in system.ini: section, key, variable, words.
; Words = 0 for a number, otherwise the list of words for 0, 1, 2...
align 4
iniSettings:
dd sz_system, sz_language, language, wordsLanguage
dd sz_system, sz_fontHeight, fontHeight, 0
dd sz_system, sz_fontSmooth, fontSmoothing, wordsSmoothing
dd sz_lowLevel, sz_lba, lba, wordsOnOff
dd sz_lowLevel, sz_pci, pci, wordsOnOff
dd sz_lowLevel, sz_speaker, speakerMute, wordsSpeaker
.saved: ; the mouse is configured by its own application
dd sz_mouse, sz_speed, mouseSpeed, 0
dd sz_mouse, sz_accel, mouseAccel, 0
dd sz_mouse, sz_dblClick, mouseDelay, 0
.end:
wordsOnOff dd 2, 'off ','on '
wordsSpeaker dd 2, 'on ','off ' ; the ini keeps 'speaker on', not 'mute'
wordsSmoothing dd 3, 'off ','on ','sbp '
wordsLanguage dd LANGUAGES, 'en ','fi ','de ','ru ','fr ','et ','es ','it '
runBgProgram:
dd 7, 0, bgParam, 0, 0
db 0
dd bgProgram
fileInfo:
dd 0, 0, 0, 4, fileBuf
db 0
.path dd ?
sz_ini db "/sys/settings/system.ini",0
sz_system db "system",0
sz_language db "language",0
sz_fontHeight db "font height",0
sz_fontSmooth db "font smoothing",0
sz_speaker db "speaker",0
sz_lowLevel db "low-level",0
sz_lba db "LBA",0
sz_pci db "PCI",0
sz_mouse db "mouse",0
sz_speed db "speed",0
sz_accel db "acceleration",0
sz_dblClick db "double_click_delay",0
sz_style db "style",0
sz_buttonStyle db "buttons_gradient",0
sz_bgProgram db "bg_program",0
sz_bgParam db "bg_param",0
sz_skin db "skin",0
; not stored in the program file
language dd ?
lba dd ?
pci dd ?
speakerMute dd ?
fontSmoothing dd ?
fontHeight dd ?
mouseSpeed dd ?
mouseAccel dd ?
mouseDelay dd ?
iniWord dd ? ; a word of system.ini
fileBuf dd ?
bgProgram rb PATH_MAX
bgParam rb PATH_MAX
skinPath rb PATH_MAX
+342 -476
View File
@@ -1,462 +1,316 @@
; SPDX-License-Identifier: NOASSERTION
;
; System settings.
; SETUP BOOT - apply the settings from system.ini (run from AUTORUN.DAT)
; SETUP - window to change and save them
;
; Texts are UTF-8
; Text encoded with Code Page 866 - Cyrillic
;;;;;;;;;;;;;;;;;;;;;;;
;; SYSTEM SETTINGS ;;
;;;;;;;;;;;;;;;;;;;;;;;
format binary as ""
use32
org 0
db 'MENUET01'
dd 1
dd START
dd IM_END
dd I_END
dd I_END
dd param
dd 0
include '../../macros.inc'
format meos 01
entry START
stack 4096
include '../../proc32.inc'
include '../../macros.inc'
include '../../dll.inc'
;---------------------------------------------------------------
BootSettings:
; Set system language
mov word[param],0
invoke ini.get_str, sz_ini, sz_system, sz_language, param, 2, 0
mov ax, [param]
or ax, 0x2020 ; convert to lowercase
mov ecx,langMarks.size/2
mov edi,langMarks
repnz scasw
jnz @f
neg ecx
add ecx,langMarks.size/2
mcall 21,5
@@:
; Set font smoothing
mov dword[param],0
invoke ini.get_str, sz_ini, sz_system, sz_fontSmooth, param, 4, 0
xor ecx,ecx
mov eax,[param]
or eax,0x20202020
cmp eax,'off '
jz @f
inc ecx
cmp eax,'on '
jz @f
cmp eax,'sbp '
jnz .skipFont
inc ecx
@@:
mcall 48,10
.skipFont:
; Enable/disable system speaker
mov dword[param],0
invoke ini.get_str, sz_ini, sz_system, sz_speaker, param, 4, 0
mov eax,[param]
or eax,0x20202020
cmp eax,'off '
jz @f
cmp eax,'on '
jnz .skipSpeaker
inc [speaker_mute]
@@:
call _speaker_mute
.skipSpeaker:
; Set font size
invoke ini.get_int, sz_ini, sz_system, sz_fontSize, 9
mov ecx,eax
mcall 48,12
; Set mouse speed
invoke ini.get_int, sz_ini, sz_mouse, sz_speed, 1
mov edx,eax
mcall 18,19,1
; Set mouse acceleration
invoke ini.get_int, sz_ini, sz_mouse, sz_acceleration, 1
mov edx,eax
mcall 18,19,3
; Set mouse double click delay
invoke ini.get_int, sz_ini, sz_mouse, sz_double_click_delay, 1
mov edx,eax
mcall 18,19,7
; Enable/disable LBA access for applications
mov dword[param],0
invoke ini.get_str, sz_ini, sz_low_level, sz_lba, param, 4, 0
xor ecx,ecx
mov eax,[param]
or eax,0x20202020
cmp eax,'off '
jz @f
cmp eax,'on '
jnz .skipLBA
inc ecx
@@:
mcall 21,11
.skipLBA:
; Enable/disable PCI access for applications
mov dword[param],0
invoke ini.get_str, sz_ini, sz_low_level, sz_pci, param, 4, 0
xor ecx,ecx
mov eax,[param]
or eax,0x20202020
cmp eax,'off '
jz @f
cmp eax,'on '
jnz close
inc ecx
@@:
mcall 21,12
jmp close
;---------------------------------------------------------------
START:
mcall 68,11
stdcall dll.Load, @IMPORT
push eax
test eax,eax
jnz close
jnz quit
cmp [param],dword 'BOOT'
jz BootSettings
pop eax
GetCommandLine eax
cmp dword[eax],'BOOT'
jnz @f
; get current settings
mcall 26,5
dec eax
mov [syslang],eax
call settings_read_boot
call settings_read_ini
call settings_apply_boot
call style_apply
quit:
mcall -1
mcall 26,11
mov [lba_read],eax
mcall 26,12
mov [pci_acc],eax
mcall 18,8,1
mov [speaker_mute],eax
mcall 48,9
mov [fontSmoothing],eax
mcall 48,11
mov [fontSize],eax
loadtxt:
cmp [syslang],3
jz .ru
cmp [syslang],5
jz .et
mov [text],texteng
jmp draw_window
.et:
mov [text],textet
jmp draw_window
.ru:
mov [text],textrus
draw_window:
mcall 12,1
mov ecx,50*65536+32*(4+stringsAmount)
mcall 0,<50,700>,,0xB4111199,0,title
; Main buttons
mov eax,8
mov ecx,6*65536+26
mov edx,4
mov esi,0x5580c0
mov ebp,stringsAmount
@@:
mcall ,<490,24>
call settings_read_system
; the checkbox image is shared by @RESHARE, 0 if it is not running
mcall 68,22,sz_checkbox,0,0
mov [checkboxImage],eax
;---------------------------------------------------------------
draw_window:
mov eax,[language]
mov eax,[texts+eax*4]
mov [text],eax
mcall 12,1
mcall 48,3,sc,sizeof.system_colors
mov byte[sc.work_text+3],FONT
mov byte[sc.work_button_text+3],FONT
mcall 48,4
lea ecx,[eax+(50 shl 16)+CLIENT_H+4]
mov edx,[sc.work]
or edx,0x34000000
mcall 0,<50,CLIENT_W+9>,,,0,title
; a row: label, value (drawn by draw_values), '-' and '+' buttons
xor ebp,ebp
.row:
imul edi,ebp,ROW_STEP
add edi,TOP ; y of the row
mov ecx,edi
shl ecx,16
add ecx,ROW_H-1 ; the button is 1 pixel bigger than given
lea edx,[FIRST_ROW_BUTTON+ebp*2]
mcall 8,<BUTTON1_X,ROW_H-1>,,,[sc.work_button]
lea edx,[FIRST_ROW_BUTTON+1+ebp*2]
mcall 8,<BUTTON2_X,ROW_H-1>
; the kernel leaves the corners of a button out: one frame for both,
; its right corners stay out
mov edx,[sc.work_button]
shr edx,1
and edx,0x7F7F7F ; the border colour of a button
mov cx,1
mcall 13,<BUTTON1_X,BUTTON2_X+ROW_H-1-BUTTON1_X>
add ecx,(ROW_H-1) shl 16
mcall 13
lea ebx,[edi+TEXT_DY+(LABEL_X shl 16)]
mov ecx,ebp
call get_text
mcall 4,,[sc.work_text]
lea ebx,[edi+TEXT_DY+((BUTTON1_X+8) shl 16)]
lea edx,[glyphs+ebp*4]
mcall 4,,[sc.work_button_text]
lea ebx,[edi+TEXT_DY+((BUTTON2_X+8) shl 16)]
lea edx,[glyphs+2+ebp*4]
mcall 4
inc ebp
cmp ebp,ROWS
jb .row
; group box of the checkboxes: a frame, its title over it on the work colour
mcall 13,<GROUP_X,GROUP_W>,<GROUP_Y,GROUP_H>,[sc.work_graph]
mcall 13,<GROUP_X+1,GROUP_W-2>,<GROUP_Y+1,GROUP_H-2>,[sc.work]
mov ecx,T_GROUP
call get_text
mov ecx,[sc.work_text]
or ecx,0x40000000
mcall 4,<GROUP_TITLE_X,GROUP_TITLE_Y>,,,,[sc.work]
; The checkboxes are spread over the group, the last one ends at its end.
; LBA and PCI are fixed, so the step only depends on the speaker label.
mov ecx,T_SPEAKER
call get_text
mov eax,ITEM_END-ITEM_X-CHECK_SIZE-8
.length:
mov cl,[edx]
inc edx
mcall ,<526,24>
inc edx
mcall ,<562,120>
inc edx
add ecx,32*65536
dec ebp
jnz @b
; APPLY ALL
add ecx,32*65536
mcall ,<514,168>,,3,0x005588dd
; SAVE ALL
add ecx,32*65536
dec edx
mcall
test cl,cl
jz .step
and cl,0xC0
cmp cl,0x80 ; UTF-8 continuation byte
jz .length
sub eax,8
jmp .length
.step:
shr eax,1
mov [checkStep],eax
; a checkbox: the box (drawn by draw_values), then the label, both under
; one button up to the end of the group. The next button covers the rest.
xor ebp,ebp
.check:
mov edi,[checkStep]
imul edi,ebp
add edi,ITEM_X ; x of the box
lea ebx,[edi+CHECK_SIZE+8]
shl ebx,16
add ebx,CHECK_Y+TEXT_DY
call check_label
mcall 4,,[sc.work_text]
mov ebx,edi
shl ebx,16
add ebx,ITEM_END
sub ebx,edi
lea edx,[FIRST_CHECK_BUTTON+BT_HIDE+BT_NOFRAME+ebp]
mcall 8,,<CHECK_Y,ROW_H-1>
inc ebp
cmp ebp,CHECKS
jb .check
mcall 12,2
draw_infotext:
mov eax,[syslang]
mov edi,[text]
lea esi,[eax*8+langs]
add edi,28
movsd
movsd
add edi,LLL-8
;---------------------------------------------------------------
draw_values:
mov edx,languageNames
mov ecx,[language]
call nth_string
mov [valueText],edx
mov eax,[lba_read]
call onoff
mov [edi],ebx
mov eax,[pci_acc]
call onoff
mov [edi+LLL],ebx
mov eax,[speaker_mute]
call onoff
mov [edi+LLL*2],ebx
mov ebx,'SUBP'
mov ecx,'IXEL'
cmp [fontSmoothing],2
jz @f
mov eax,[fontSmoothing]
call onoff
mov ecx,' '
mov edx,sz_subpixel
mov ecx,[fontSmoothing]
cmp ecx,2
jae @f
add ecx,T_OFF
call get_text
@@:
mov [edi+LLL*3],ebx
mov [edi+LLL*3+4],ecx
mov [valueText+4],edx
mov eax,[fontSize]
mov bl, 10
mov eax,[fontHeight]
mov bl,10
div bl
add ax, '00'
mov [edi+LLL*4],ax
; draw text
mcall 13,<342,96>,32*stringsAmount,80111199h
mov eax,4
mov ebx,6*65536+11
mov ecx,1ffffffh
mov edx,[text]
mov esi,LLL
mov ebp,stringsAmount
newline:
mcall
add ebx,32
add edx,esi
dec ebp
jnz newline
add ax,'00'
mov word[heightText],ax
mov [valueText+8],heightText
mov ebp,2
add ebx,32
@@:
mcall
add ebx,32
add edx,esi
dec ebp
jnz @b
; each value in a light box framed on three sides, the button is the fourth,
; the left corners are cut off
xor ebp,ebp
.row:
imul edi,ebp,ROW_STEP
add edi,TOP
mov ecx,edi
shl ecx,16
add ecx,ROW_H
mcall 13,<VALUE_X+1,VALUE_W-1>,,[sc.work_graph]
add ecx,(1 shl 16)-2
mcall 13,<VALUE_X,VALUE_W>
; sunken, the inner lines of a button reversed: three boxes, each 1 pixel
; smaller, leave darker lines left and top and lighter right and bottom
mov edx,[sc.work_light]
mov eax,edx
shr eax,3
and eax,0x1F1F1F
sub edx,eax ; 1/8 darker
mcall 13,<VALUE_X+1,VALUE_W-1>
mov edx,[sc.work_light]
or edx,0x1F1F1F ; lighter
add ecx,(1 shl 16)-1
mcall 13,<VALUE_X+2,VALUE_W-2>
dec ecx
mcall 13,<VALUE_X+2,VALUE_W-3>,,[sc.work_light]
lea ebx,[edi+TEXT_DY+((VALUE_X+VALUE_PAD) shl 16)]
mov edx,[valueText+ebp*4]
mcall 4,,[sc.work_text]
inc ebp
cmp ebp,ROWS
jb .row
; checkboxes: a frame, light inside, the @RESHARE image when set
xor ebp,ebp
.check:
mov ebx,[checkStep]
imul ebx,ebp
add ebx,ITEM_X
shl ebx,16
add ebx,CHECK_SIZE
mcall 13,,<CHECK_BOX_Y,CHECK_SIZE>,[sc.work_graph]
add ebx,(1 shl 16)-2
mcall 13,,<CHECK_BOX_Y+1,CHECK_SIZE-2>,[sc.work_light]
mov eax,[checks+ebp*8]
mov eax,[eax]
xor eax,[checks+ebp*8+4]
jz .next
mov edx,ebx
mov dx,CHECK_BOX_Y+1
mov ebx,[checkboxImage]
test ebx,ebx ; no @RESHARE: the box stays empty
jz .next
mcall 7,,<CHECK_SIZE-2,CHECK_SIZE-2>
.next:
inc ebp
cmp ebp,CHECKS
jb .check
;---------------------------------------------------------------
still:
mcall 10
cmp eax,1
jz draw_window
cmp eax,2
jz key
jz .key
cmp eax,3
jz button
jnz still
jmp still
;---------------------------------------------------------------
key:
mcall 2
jmp still
;---------------------------------------------------------------
button:
mcall 17
shr eax,8
call dword[eax*4+buttonTab-4]
jmp draw_infotext
close:
pop eax
mcall -1
language1:
dec [syslang]
jns @f
mov [syslang],7
jmp @f
language2:
inc [syslang]
cmp [syslang],8
jc @f
mov [syslang],0
@@:
pop eax
jmp loadtxt
LBA1:
btr [lba_read],0
ret
LBA2:
bts [lba_read],0
ret
PCI1:
btr [pci_acc],0
ret
PCI2:
bts [pci_acc],0
ret
SPEAKER1:
btr [speaker_mute],0
ret
SPEAKER2:
bts [speaker_mute],0
ret
font1:
cmp [fontSmoothing],0
jz @f
dec [fontSmoothing]
ret
font2:
cmp [fontSmoothing],2
jz @f
inc [fontSmoothing]
ret
fontSize1:
cmp [fontSize],10
jc @f
dec [fontSize]
@@:
ret
fontSize2:
inc [fontSize]
ret
apply_all:
call _lba_read
call _pci_acc
call _speaker_mute
call fontApply
call fontSizeApply
_syslang:
mov ecx,[syslang]
cmp eax,1
jz quit
sub eax,FIRST_ROW_BUTTON
jb still ; 0: no button after all
cmp eax,FIRST_CHECK_BUTTON-FIRST_ROW_BUTTON
jae .check
; '-' or '+' of a row: step the value within the limits of the row
shr eax,1 ; eax = row, CF = '+'
lea esi,[eax*3]
lea esi,[rows+esi*4]
mov edi,[esi]
mov ecx,[edi]
jc .plus
cmp ecx,[esi+4]
jbe still
dec ecx
jmp .set
.plus:
cmp ecx,[esi+8]
jae still
inc ecx
mcall 21,5
ret
_lba_read:
mcall 21,11,[lba_read]
ret
_pci_acc:
mcall 21,12,[pci_acc]
ret
fontApply:
mcall 48,10,[fontSmoothing]
ret
fontSizeApply:
mcall 48,12,[fontSize]
ret
_speaker_mute:
mcall 18,8,1
cmp [speaker_mute],eax
jz @f
inc ecx
mcall 18
@@:
ret
.set:
mov [edi],ecx
push eax
call apply_and_save
pop eax
cmp eax,1 ; the language and the font smoothing
jbe draw_window ; change all the texts: repaint the window
jmp draw_values
.check:
mov eax,[checks-(FIRST_CHECK_BUTTON-FIRST_ROW_BUTTON)*8+eax*8]
xor dword[eax],1
call apply_and_save
jmp draw_values
.key:
mcall 2
jmp still
;---------------------------------------------------------------
onoff:
cmp [syslang],3
jz .ru
cmp [syslang],5
jz .et
mov ebx,'OFF '
test eax,eax
jz @f
mov ebx,'ON '
ret
.ru:
mov ebx,'НЕТ '
test eax,eax
jz @f
mov ebx,'ДА '
ret
.et:
mov ebx,'V─L.'
test eax,eax
jz @f
mov ebx,'SEES'
; every change takes effect at once and is kept in system.ini
apply_and_save:
call settings_apply
jmp settings_save_ini
; edx = label of the checkbox ebp
check_label:
mov edx,[checkLabels+ebp*4]
test edx,edx
jnz @f
mov ecx,T_SPEAKER
call get_text
@@:
ret
;---------------------------------------------------------------
saveAll:
; system language
mov eax,[syslang]
mov ax, word[eax*2+langMarks]
mov [param],eax
invoke ini.set_str, sz_ini, sz_system, sz_language, param, 2
; font size
invoke ini.set_int, sz_ini, sz_system, sz_fontSize, [fontSize]
; font smoothing
mov dword[param],'off'
cmp [fontSmoothing],0
jz @f
mov dword[param],'on '
cmp [fontSmoothing],1
jz @f
mov dword[param],'sbp'
; edx = string number ecx of the window language
get_text:
mov edx,[text]
; edx = string number ecx of the zero separated list at edx
nth_string:
jecxz .done
@@:
invoke ini.set_str, sz_ini, sz_system, sz_fontSmooth, param, 3
; system speaker
mov dword[param],'off'
cmp [speaker_mute],0
jz @f
mov dword[param],'on '
@@:
invoke ini.set_str, sz_ini, sz_system, sz_speaker, param, 3
; LBA access for applications
mov dword[param],'off'
cmp [lba_read],0
jz @f
mov dword[param],'on '
@@:
invoke ini.set_str, sz_ini, sz_low_level, sz_lba, param, 3
; PCI access for applications
mov dword[param],'off'
cmp [pci_acc],0
jz @f
mov dword[param],'on '
@@:
invoke ini.set_str, sz_ini, sz_low_level, sz_pci, param, 3
inc edx
cmp byte[edx-1],0
jnz @b
loop @b
.done:
ret
;---------------------------------------------------------------
; DATA
align 4
buttonTab: ; button handler pointers: -,+,apply
dd close
dd saveAll
dd apply_all
dd language1
dd language2
dd _syslang
dd LBA1
dd LBA2
dd _lba_read
dd PCI1
dd PCI2
dd _pci_acc
dd SPEAKER1
dd SPEAKER2
dd _speaker_mute
dd font1
dd font2
dd fontApply
dd fontSize1
dd fontSize2
dd fontSizeApply
@IMPORT:
library libini, 'libini.obj'
import libini, \
@@ -465,76 +319,88 @@ import libini, \
ini.set_str, 'ini_set_str',\
ini.set_int, 'ini_set_int'
title db "System settings",0
sz_ini db "/sys/settings/system.ini",0
ROWS = 3
CHECKS = 3
FIRST_ROW_BUTTON = 10 ; row N has '-' = 10+N*2 and '+' = 11+N*2
FIRST_CHECK_BUTTON = 20
FONT = 0xB0 ; text flags: zero terminated, 8x16 UTF-8
sz_system db "system",0
sz_language db "language",0
sz_fontSize db "font height",0
sz_fontSmooth db "font smoothing",0
sz_speaker db "speaker mute",0
sz_mouse db "mouse",0
sz_speed db "speed",0
sz_acceleration db "acceleration",0
sz_double_click_delay db "double_click_delay",0
sz_low_level db "low-level",0
sz_lba db "LBA",0
sz_pci db "PCI",0
LLL = 56
stringsAmount = 6
; layout of the client area: controls ROW_H high, GAP empty pixels apart,
; EDGE to the window border, GAP at the top
LABEL_CHARS = 20 ; the longest label, Spanish
GAP = 12
EDGE = 8
TOP = GAP
ROW_H = 24
ROW_STEP = ROW_H + GAP
TEXT_DY = 5 ; the capitals, rows 2..11 of the font, centred in ROW_H
LABEL_X = EDGE - 1 ; column 0 of a letter is empty: aligned with the group frame
VALUE_X = LABEL_X + LABEL_CHARS*8 + GAP
VALUE_PAD = GAP
VALUE_W = 8*8 + VALUE_PAD*2
BUTTON1_X = VALUE_X + VALUE_W ; right after the value box
BUTTON2_X = BUTTON1_X + ROW_H - 1 ; the buttons share a border
CLIENT_W = BUTTON2_X + ROW_H + EDGE
GROUP_X = EDGE
GROUP_W = CLIENT_W - EDGE*2
GROUP_Y = TOP + ROWS*ROW_STEP + 5 ; GAP to the capitals of the title
GROUP_TITLE_Y = GROUP_Y - 7 ; the frame crosses the capitals
CHECK_Y = GROUP_Y + 1 + GAP ; the row of the checkboxes
GROUP_H = 1 + GAP + ROW_H + GAP + 1
CHECK_SIZE = 15
CHECK_BOX_Y = CHECK_Y + (ROW_H-CHECK_SIZE)/2
ITEM_X = GROUP_X + 1 + GAP
ITEM_END = GROUP_X + GROUP_W - GAP ; the last column of a letter is empty
GROUP_TITLE_X = ITEM_X - 8 - 1 ; a space, then a letter from its column 1
CLIENT_H = GROUP_Y + GROUP_H + EDGE
; variable, min, max of every row
align 4
langs:
db 'ENGLISH FINNISH GERMAN RUSSIAN FRENCH ESTONIANSPANISH ITALIAN '
sz langMarks, 'en','fi','de','ru','fr','et','es','it'
rows:
dd language, 0, LANGUAGES-1
dd fontSmoothing, 0, 2
dd fontHeight, FONT_H_MIN, FONT_H_MAX
textrus:
db 'Язык системы : < > Применить'
db 'Включить LBA : - + Применить'
db 'Доступ к шине PCI : - + Применить'
db 'Выключить SPEAKER : - + Применить'
db 'Сглаживание шрифтов : - + Применить'
db 'Высота шрифтов : - + Применить'
; variable and the value of it that means 'not checked'
checks dd lba,0, pci,0, speakerMute,1
checkLabels dd sz_lba, sz_pci, 0 ; 0: the speaker label of the language
db 'ВНИМАНИЕ: Применить все'
db 'НЕ ЗАБУДЬТЕ СОХРАНИТЬ НАСТРОЙКИ Сохранить все'
glyphs db '<',0,'>',0,'<',0,'>',0,'-',0,'+',0
sz_subpixel db 'Subpixel',0
languageNames db 'English',0,'Finnish',0,'German',0,'Russian',0
db 'French',0,'Estonian',0,'Spanish',0,'Italian',0
texteng:
db 'System language : < > Apply '
db 'Allow LBA access : - + Apply '
db 'Allow PCI access : - + Apply '
db 'Disable SPEAKER : - + Apply '
db 'Font smoothing : - + Apply '
db 'Font height : - + Apply '
title db "System settings",0
sz_checkbox db "CHECKBOX",0
db 'NOTE: Apply all '
db 'SAVE YOUR SETTINGS BEFORE QUITING KOLIBRI Save all '
; Texts of the window languages: zero terminated strings in this order
; (row labels, group title, speaker label, 'off', 'on')
T_GROUP = ROWS
T_SPEAKER = ROWS + 1
T_OFF = ROWS + 2
textet:
db 'S№steemi keel : < > Kinnita '
db 'LBA lugemine lubatud : - + Kinnita '
db 'PCI juurdepффs programm. : - + Kinnita '
db 'Disable SPEAKER : - + Kinnita '
db 'Font smoothing : - + Kinnita '
db 'Font height : - + Kinnita '
; the texts of every kernel language, English where there is no translation
texts dd texteng, texteng, texteng, textrus, texteng, texteng, textspa, texteng
db 'M─RKUS: Kinnita kїik '
db 'SALVESTA SEADED ENNE KOLIBRIST V─LJUMIST Salvesta kїik'
texteng db 'System language',0, 'Font smoothing',0, 'Font height',0
db ' Access settings ',0, 'Speaker',0
db 'Off',0, 'On',0
IM_END:
textspa db 'Idioma del sistema',0, 'Suavizado de fuentes',0, 'Altura de fuente',0
db ' Ajustes de acceso ',0, 'Altavoz',0
db 'No',0, 'Sí',0
text dd ?
textrus db 'Язык системы',0, 'Сглаживание шрифтов',0, 'Высота шрифтов',0
db ' Настройки доступа ',0, 'Динамик',0
db 'Нет',0, 'Да',0
syslang dd ?
lba_read dd ?
pci_acc dd ?
speaker_mute dd ?
fontSmoothing dd ?
fontSize dd ?
;---------------------------------------------------------------
include 'settings.inc'
param:
rb 1024
I_END:
text dd ? ; texts of the window language
checkboxImage dd ?
checkStep dd ? ; x distance of two checkboxes
sc system_colors
valueText rd ROWS ; the strings shown in the value boxes
heightText rb 4