Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
602 | Rus | 1 | context_menu_start: |
2 | |||
3 | mov eax, 40 |
||
4 | mov ebx, 00100111b |
||
5 | int 0x40 |
||
6 | |||
7 | ;call draw_ctx_menu |
||
8 | |||
9 | mov ebp, 2 ; 2 часто используется. |
||
10 | |||
11 | xor ecx, ecx |
||
12 | mov edx, [ctx_menu_PID] |
||
13 | find_slot: |
||
14 | inc ecx |
||
15 | |||
16 | mov eax, 9 |
||
17 | mov ebx, process_info_buffer |
||
18 | int 0x40 |
||
19 | |||
20 | cmp dword [process_info_buffer + 30], edx |
||
21 | jne find_slot |
||
22 | |||
23 | mov eax, 18 |
||
24 | mov ebx, 3 |
||
25 | ;mov ecx, ecx ; :) |
||
26 | int 0x40 |
||
27 | |||
28 | call draw_ctx_menu |
||
29 | |||
30 | ctx_menu_still: |
||
31 | mov eax, 10 |
||
32 | int 0x40 |
||
33 | |||
34 | cmp eax, ebp ; cmp eax, 2 |
||
35 | jz ctx_menu_key |
||
36 | cmp eax, 3 |
||
37 | jz ctx_menu_button |
||
38 | cmp eax, 6 |
||
39 | jz ctx_menu_mouse |
||
40 | |||
41 | call draw_ctx_menu |
||
42 | |||
43 | jmp ctx_menu_still |
||
44 | |||
45 | ctx_menu_key: |
||
46 | mov eax, ebp ; mov eax, 2 |
||
47 | int 0x40 |
||
48 | |||
49 | ctx_menu_button: |
||
50 | mov eax, 17 |
||
51 | int 0x40 |
||
52 | cmp ah, 1 |
||
53 | jne ctx_menu_still |
||
54 | mov eax, 18 |
||
55 | mov ebx, ebp ; mov eax, 2 |
||
56 | mov ecx, [n_slot] |
||
57 | |||
58 | int 0x40 |
||
59 | jmp ctx_menu_exit |
||
60 | |||
61 | ctx_menu_mouse: |
||
62 | mov eax, 37 |
||
63 | mov ebx, ebp ; mov ebx, 2 |
||
64 | int 0x40 |
||
65 | |||
66 | xchg eax, ecx ; cmp eax, 0 Если не одна из кнопок не нажата возвращаемся |
||
67 | ; в главный цикл потока |
||
68 | jecxz ctx_menu_still |
||
69 | |||
70 | mov eax, 37 |
||
71 | xor ebx, ebx ; mov ebx, 1 |
||
72 | inc ebx |
||
73 | int 0x40 |
||
74 | |||
75 | cmp ax, 0 ; Тут проверяем произошёл-ли клик за пределами окна контекстного |
||
76 | jb ctx_menu_exit ; меню, если за пределами то закрываем контекстное меню |
||
77 | cmp ax, 41 |
||
78 | ja ctx_menu_exit |
||
79 | shr eax, 16 |
||
80 | cmp ax, 0 |
||
81 | jb ctx_menu_exit |
||
82 | cmp ax, 133 |
||
83 | ja ctx_menu_exit |
||
84 | |||
85 | jmp ctx_menu_still |
||
86 | |||
87 | ctx_menu_exit: |
||
88 | xor eax, eax |
||
89 | dec eax ; mov eax, -1 |
||
90 | int 0x40 |
||
91 | |||
92 | func draw_ctx_menu |
||
93 | |||
94 | mov eax, 12 |
||
95 | xor ebx, ebx ; mov ebx, 1 |
||
96 | inc ebx |
||
97 | int 0x40 |
||
98 | |||
99 | xor eax, eax ; mov eax, 0 |
||
100 | movzx ebx, [x_coord] |
||
101 | shl ebx, 16 |
||
102 | add ebx, 133 |
||
103 | movzx ecx, [y_coord] |
||
104 | sub ecx, 41 |
||
105 | shl ecx, 16 |
||
106 | add ecx, 41 |
||
107 | mov edx, [system_colours + 20] ; sc.work |
||
108 | mov esi, [system_colours + 4] ; sc.grab |
||
109 | or esi, 0x81000000 |
||
110 | mov edi, [system_colours] ; sc.frame |
||
111 | int 0x40 |
||
112 | |||
113 | mov eax, 8 |
||
114 | mov ebx, 0 * 65536 + 133 |
||
115 | mov ecx, 22 * 65536 + 18 |
||
116 | mov edx, 0x40000001 |
||
117 | int 0x40 |
||
118 | |||
119 | shr eax, 1 ; mov eax, 4 |
||
120 | mov ebx, 36 * 65536 + 7 |
||
121 | mov ecx, [system_colours + 16] ; sc.grab_text |
||
122 | or ecx, 0x10000000 |
||
123 | |||
124 | mov edx, ctx_menu_title |
||
125 | mov esi, ctx_menu_title_end - ctx_menu_title |
||
126 | int 0x40 |
||
127 | |||
128 | add ebx, 1 * 65536 |
||
129 | int 0x40 |
||
130 | |||
131 | mov ebx, 4 * 65536 + 28 |
||
132 | xor ecx, ecx ; mov ecx, 0x00000000 |
||
133 | mov edx, ctx_menu_text |
||
134 | mov esi, ctx_menu_text_end - ctx_menu_text |
||
135 | int 0x40 |
||
136 | |||
137 | mov eax, 12 |
||
138 | mov ebx, ebp ; mov ebx, 2 |
||
139 | int 0x40 |
||
140 | |||
141 | ret |
||
142 | |||
143 | endf |
||
144 | |||
145 | x_coord rw 1 |
||
146 | y_coord rw 1 |
||
147 | n_slot rd 1 |
||
148 | lsz ctx_menu_text,\ |
||
149 | ru, "X ‡ Єалвм Alt + F4",\ |
||
150 | en, "X Close Alt + F4",\ |
||
151 | et, "X Fine Alt + F4" ; May be its not correct |
||
152 | |||
153 | ctx_menu_text_end: |
||
154 | ctx_menu_PID rd 1 |
||
155 | |||
156 | ctx_menu_title: |
||
157 | db 'KolibriOS' |
||
158 | ctx_menu_title_end: |