Rev 990 | Rev 1114 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 990 | Rev 1112 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | #include "use_library.h" |
4 | #include "use_library.h" |
5 | ///#include "use_library.h" |
5 | ///#include "use_library.h" |
6 | //const char header[] = "Table"; |
6 | //const char header[] = "Table"; |
7 | 7 | ||
Line 8... | Line 8... | ||
8 | #define TABLE_VERSION "0.94a" |
8 | #define TABLE_VERSION "0.95" |
Line 9... | Line 9... | ||
9 | 9 | ||
10 | // ñòðîêè, êîòîðûå âûâîäèò ïðîãðàììà |
10 | // ñòðîêè, êîòîðûå âûâîäèò ïðîãðàììà |
11 | const char *sFileSign = "KolibriTable File\n"; |
11 | const char *sFileSign = "KolibriTable File\n"; |
12 | const char sFilename[] = "Filename: "; |
12 | const char sFilename[] = "Filename: "; |
Line 120... | Line 120... | ||
120 | #define SIZE_SELECT 3 |
120 | #define SIZE_SELECT 3 |
121 | #define SIZE_DRAG 4 |
121 | #define SIZE_DRAG 4 |
122 | int size_mouse_x, size_mouse_y, size_id, size_state = 0; |
122 | int size_mouse_x, size_mouse_y, size_id, size_state = 0; |
123 | 123 | ||
Line -... | Line 124... | ||
- | 124 | int window_is_dragged = 0; // ñåé÷àñ ïåðåòàñêèâàåòñÿ îêíî |
|
- | 125 | ||
124 | // ðàñòàñêèâàíèå ÿ÷åéêè ïðè åå òàùåíèè çà ïðàâûé íèæíèé óãîë, ñ çàïîëíåíèåì ÿ÷ååê |
126 | // ðàñòàñêèâàíèå ÿ÷åéêè ïðè åå òàùåíèè çà ïðàâûé íèæíèé óãîë, ñ çàïîëíåíèåì ÿ÷ååê |
125 | int drag_x, drag_y; |
127 | int drag_x, drag_y; |
126 | int old_end_x, old_end_y; |
128 | int old_end_x, old_end_y; |
Line 127... | Line 129... | ||
127 | 129 | ||
Line 136... | Line 138... | ||
136 | kos_DrawLine(x+width-1,y,x+width-1,y+height-2,color1,invert); |
138 | kos_DrawLine(x+width-1,y,x+width-1,y+height-2,color1,invert); |
137 | kos_DrawLine(x+1,y+height-1,x+width-1,y+height-1,color1,invert); |
139 | kos_DrawLine(x+1,y+height-1,x+width-1,y+height-1,color1,invert); |
138 | } |
140 | } |
139 | 141 | ||
Line 140... | Line -... | ||
140 | // edit box |
- | |
141 | /* |
- | |
142 | void KEdit() |
- | |
143 | { |
- | |
144 | int max_char = (editbox_w) / 6; |
- | |
145 | kos_DrawBar(editbox_x,editbox_y,editbox_w-1,editbox_h-3,0xFFFFFF); //áåëàÿ îáëàñòü |
- | |
146 | if (strlen(edit_text) |
- | |
147 | kos_WriteTextToWindow(editbox_x, editbox_y+editbox_h / 2-5,0x80,0,edit_text,0); //editbox_h/2+ âìåñòî +3 |
- | |
148 | else |
- | |
149 | kos_WriteTextToWindow(editbox_x, editbox_y+editbox_h / 2-5,0x80,0,edit_text+strlen(edit_text)-max_char+1,0); //text 'path' |
- | |
150 | } |
- | |
151 | */ |
- | |
152 | - | ||
153 | void start_edit(int x, int y) |
142 | void start_edit(int x, int y) |
154 | { |
143 | { |
Line 155... | Line 144... | ||
155 | 144 | ||
156 | int ch = 0; |
145 | int ch = 0; |
Line 204... | Line 193... | ||
204 | cells[sel_x][sel_y] = NULL; |
193 | cells[sel_x][sel_y] = NULL; |
205 | //memset((Byte*)edit_text,0, 256); |
194 | //memset((Byte*)edit_text,0, 256); |
206 | calculate_values(); |
195 | calculate_values(); |
207 | } |
196 | } |
208 | else |
197 | } |
209 | return; |
- | |
210 | } |
- | |
211 | 198 | ||
Line 212... | Line 199... | ||
212 | void cancel_edit() |
199 | void cancel_edit() |
213 | { |
200 | { |
214 | if (!is_edit) |
201 | if (!is_edit) |
Line 804... | Line 791... | ||
804 | 791 | ||
Line 805... | Line 792... | ||
805 | kos_GetMouseState(mouse_btn, mouse_x, mouse_y); |
792 | kos_GetMouseState(mouse_btn, mouse_x, mouse_y); |
806 | mouse_x -= 5; |
793 | mouse_x -= 5; |
807 | mouse_y -= kos_GetSkinHeight(); |
794 | mouse_y -= kos_GetSkinHeight(); |
- | 795 | ||
808 | mouse_btn &= 0x0001; |
796 | mouse_btn &= 0x0001; |
Line 809... | Line 797... | ||
809 | 797 | ||
810 | ckeys = kos_GetSpecialKeyState(); |
798 | ckeys = kos_GetSpecialKeyState(); |
Line -... | Line 799... | ||
- | 799 | shift = ckeys & 0x3; |
|
- | 800 | ||
- | 801 | if (mouse_y < 0 && mouse_btn) // ò.ê. ìûøêà íà çàãîëîâêå îêíà |
|
- | 802 | { |
|
- | 803 | window_is_dragged = 1; |
|
- | 804 | return; |
|
- | 805 | } |
|
- | 806 | if (window_is_dragged) |
|
- | 807 | { |
|
- | 808 | if (mouse_btn) |
|
- | 809 | return; |
|
- | 810 | else |
|
- | 811 | window_is_dragged = 0; |
|
811 | shift = ckeys & 0x3; |
812 | } |
812 | 813 | ||
813 | if (!size_state && !mouse_btn) |
814 | if (!size_state && !mouse_btn) |
814 | return; |
815 | return; |
815 | if (mouse_btn && !size_state) // LMB down |
816 | if (mouse_btn && !size_state) // LMB down |
Line 877... | Line 878... | ||
877 | { |
878 | { |
878 | if (!shift) |
879 | if (!shift) |
879 | { |
880 | { |
880 | move_sel(kx, ky); |
881 | move_sel(kx, ky); |
881 | return; |
882 | //return; |
882 | } |
883 | } |
883 | else |
884 | else |
884 | { |
885 | { |
885 | sel_end_x = kx; |
886 | sel_end_x = kx; |
886 | sel_end_y = ky; |
887 | sel_end_y = ky; |
887 | } |
888 | } |
Line 904... | Line 905... | ||
904 | { |
905 | { |
905 | fill_cells(sel_x, sel_y, sel_end_x, sel_end_y, old_end_x, old_end_y); |
906 | fill_cells(sel_x, sel_y, sel_end_x, sel_end_y, old_end_x, old_end_y); |
906 | } |
907 | } |
907 | 908 | ||
Line 908... | Line 909... | ||
908 | sel_moved = (size_state == SIZE_SELECT && sel_x == sel_end_x && sel_y == sel_end_y && was_single_selection); |
909 | //sel_moved = (size_state == SIZE_SELECT && sel_x == sel_end_x && sel_y == sel_end_y && was_single_selection); |
909 | size_state = 0; |
910 | size_state = 0; |
910 | draw_window(); // âñå ñäâèíóëîñü - íàäî îáíîâèòüñÿ |
911 | draw_window(); // âñå ñäâèíóëîñü - íàäî îáíîâèòüñÿ |
911 | return; |
912 | return; |
912 | } |
913 | } |
913 | if (size_state == SIZE_X && mouse_x != size_mouse_x) |
914 | if (size_state == SIZE_X && mouse_x != size_mouse_x) |
Line 1237... | Line 1238... | ||
1237 | sel_moved = sel_end_move = 1; |
1238 | sel_moved = sel_end_move = 1; |
1238 | //stop_edit(); |
1239 | //stop_edit(); |
1239 | //draw_grid(); |
1240 | //draw_grid(); |
1240 | } |
1241 | } |
1241 | else |
1242 | } |
1242 | { |
- | |
1243 | } |
- | |
1244 | } |
- | |
1245 | /* |
1243 | /* |
1246 | if (sel_end_x < sel_x) |
1244 | if (sel_end_x < sel_x) |
1247 | { |
1245 | { |
1248 | Dword tmp = sel_end_x; sel_end_x = sel_x; sel_x = tmp; |
1246 | Dword tmp = sel_end_x; sel_end_x = sel_x; sel_x = tmp; |
1249 | } |
1247 | } |
Line 1425... | Line 1423... | ||
1425 | else if (r == -2) |
1423 | else if (r == -2) |
1426 | kos_WriteTextToWindow(320, panel_y,0,0x000000,(char*)er_format,strlen(er_format)); |
1424 | kos_WriteTextToWindow(320, panel_y,0,0x000000,(char*)er_format,strlen(er_format)); |
1427 | break; |
1425 | break; |
1428 | } |
1426 | } |
1429 | /* |
1427 | if (button >= COL_HEAD_BUTTON && button < ROW_HEAD_BUTTON) |
1430 | if (button >= COL_BUTTON && button < ROW_BUTTON) |
- | |
1431 | { |
- | |
1432 | scroll_x = button - COL_BUTTON; |
- | |
1433 | fn_edit = is_edit = 0; |
- | |
1434 | draw_window(); |
- | |
1435 | //sprintf(debuf, "col %U", scroll_x); |
- | |
1436 | //rtlDebugOutString(debuf); |
- | |
1437 | } |
- | |
1438 | else if (button >= ROW_BUTTON && button < COL_HEAD_BUTTON) |
- | |
1439 | { |
- | |
1440 | scroll_y = button - ROW_BUTTON; |
- | |
1441 | fn_edit = is_edit = 0; |
- | |
1442 | draw_window(); |
- | |
1443 | //sprintf(debuf, "row %U", scroll_y); |
- | |
1444 | //rtlDebugOutString(debuf); |
- | |
1445 | } |
- | |
1446 | */ |
- | |
1447 | if (button >= COL_HEAD_BUTTON && button < ROW_HEAD_BUTTON) |
- | |
1448 | { |
1428 | { |
1449 | sel_end_x = sel_x = button - COL_HEAD_BUTTON; |
1429 | sel_end_x = sel_x = button - COL_HEAD_BUTTON; |
1450 | sel_y = 1; |
1430 | sel_y = 1; |
1451 | sel_end_y = row_count - 1; |
1431 | sel_end_y = row_count - 1; |
1452 | stop_edit(); |
1432 | stop_edit(); |