Table v0.96

git-svn-id: svn://kolibrios.org@1114 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2009-06-12 22:16:16 +00:00
parent 9bdc3789b1
commit b89b199a17
2 changed files with 1372 additions and 1371 deletions

View File

@ -1,12 +1,19 @@
//своевременное реагирование на события мыши
//минимальные размеры окна
//убрана перерисовка заголовка окна там, где она не нужна
//убрано "заползание" панели снизу на границы окна
//исправлен баг из-за которого после действий мышкой удалялась кнопка закрытия окна
//зачем строка 450?
//если выделить область ячеек и сдвинуть курсор ввода с помощью клавиш, "следы" остануться
//нельзя перемещаться по буквам в редактируемой строке
#include "func.h" #include "func.h"
#include "parser.h" #include "parser.h"
#include "calc.h" #include "calc.h"
#include "use_library.h" #include "use_library.h"
///#include "use_library.h"
//const char header[] = "Table";
#define TABLE_VERSION "0.95" #define TABLE_VERSION "0.96"
// ñòðîêè, êîòîðûå âûâîäèò ïðîãðàììà // ñòðîêè, êîòîðûå âûâîäèò ïðîãðàììà
const char *sFileSign = "KolibriTable File\n"; const char *sFileSign = "KolibriTable File\n";
@ -102,6 +109,7 @@ DWORD sel_end_x = sel_x, sel_end_y = sel_y;
// ôëàã // ôëàã
bool sel_moved = 0; bool sel_moved = 0;
bool sel_end_move = 0; bool sel_end_move = 0;
bool window_drawall = false;
// ñêîëüêî ÿ÷ååê ïîìåùàåòñÿ â îêíå ïî õ è ó // ñêîëüêî ÿ÷ååê ïîìåùàåòñÿ â îêíå ïî õ è ó
DWORD nx = 0, ny = 0; DWORD nx = 0, ny = 0;
@ -583,8 +591,6 @@ void draw_size_grid()
{ {
//rtlDebugOutString("draw size grid"); //rtlDebugOutString("draw size grid");
kos_WindowRedrawStatus(1);
if (size_state == SIZE_X) if (size_state == SIZE_X)
{ {
int x, x0, i; int x, x0, i;
@ -624,8 +630,6 @@ void draw_size_grid()
kos_DrawLine(0, y - y0, wi, y - y0, 0, 1); kos_DrawLine(0, y - y0, wi, y - y0, 0, 1);
} }
kos_WindowRedrawStatus(2);
} }
@ -635,8 +639,6 @@ void draw_size_grid()
#define DINVERT 1 #define DINVERT 1
void draw_drag() void draw_drag()
{ {
kos_WindowRedrawStatus(1);
// ñîáñòâåííî, 4 èíâåðñíûå ëèíèè // ñîáñòâåííî, 4 èíâåðñíûå ëèíèè
int k0 = min(sel_x, sel_end_x); int k0 = min(sel_x, sel_end_x);
@ -660,8 +662,6 @@ void draw_drag()
kos_DrawLine(x0, y0, x1, y0, DCOLOR, DINVERT); kos_DrawLine(x0, y0, x1, y0, DCOLOR, DINVERT);
kos_DrawLine(x1, y0, x1, y1, DCOLOR, DINVERT); kos_DrawLine(x1, y0, x1, y1, DCOLOR, DINVERT);
kos_DrawLine(x0, y1, x1, y1, DCOLOR, DINVERT); kos_DrawLine(x0, y1, x1, y1, DCOLOR, DINVERT);
kos_WindowRedrawStatus(2);
} }
void draw_window() void draw_window()
@ -692,30 +692,32 @@ void draw_window()
he = WND_H; he = WND_H;
he -= kos_GetSkinHeight() + MENU_PANEL_HEIGHT; // äîñòóïíàÿ âûñîòà îêíà he -= kos_GetSkinHeight() + MENU_PANEL_HEIGHT; // äîñòóïíàÿ âûñîòà îêíà
wi -= 6 + 4; wi -= 10;
//Leency{
// start redraw // start redraw
if (window_drawall==true){
kos_WindowRedrawStatus(1); kos_WindowRedrawStatus(1);
kos_DefineAndDrawWindow(10,40,WND_W,WND_H,0x33,0x40FFFFFF,0,0,(Dword)"Table v" TABLE_VERSION); kos_DefineAndDrawWindow(10,40,WND_W,WND_H,0x33,0x40FFFFFF,0,0,(Dword)"Table v" TABLE_VERSION);
if (he + MENU_PANEL_HEIGHT <= 8) if (he + MENU_PANEL_HEIGHT <= 8) //если окно свёрнуто в заголовок
{ {
kos_WindowRedrawStatus(2); kos_WindowRedrawStatus(2);
return; return;
} }
if (!sel_moved) if (he < 100) kos_ChangeWindow( -1, -1, -1, 180 );
{ if (wi < 340) kos_ChangeWindow( -1, -1, 350, -1 );
kos_DrawBar(wi-15,he - kos_GetSkinHeight() +7,16,16,0xe4dfe1);
kos_DrawBar(0,he - kos_GetSkinHeight() + 23,wi + 1,MENU_PANEL_HEIGHT-4,0xe4dfe1); }//}Leency
}
// edit_box_draw((dword)&ebox); // edit_box_draw((dword)&ebox);
int y = he + kos_GetSkinHeight() - 10; int y = he + kos_GetSkinHeight() - 10;
if (!sel_moved) if (!sel_moved)
{ {
kos_DrawBar(wi-15,he - kos_GetSkinHeight() +7,16,16,0xe4dfe1);
kos_DrawBar(0,he - kos_GetSkinHeight() + 23,wi + 1,MENU_PANEL_HEIGHT-5,0xe4dfe1);
kos_WriteTextToWindow(3 + 1, y + 3, 0x80 , 0x000000, (char*)sFilename, strlen(sFilename)); kos_WriteTextToWindow(3 + 1, y + 3, 0x80 , 0x000000, (char*)sFilename, strlen(sFilename));
} }
@ -729,8 +731,6 @@ void draw_window()
file_box.top = y - 1; file_box.top = y - 1;
file_box.width = 98; file_box.width = 98;
//editbox_h = 18; //editbox_h = 18;
//kos_DefineButton(62, y + 3, 100, 16, 0x60000000+FILENAME_BUTTON, 0xd0d0d0);
// ñîõðàíèòü // ñîõðàíèòü
kos_DefineButton(20 + 160, y - 5, 60, 20, SAVE_BUTTON, 0xd0d0d0); kos_DefineButton(20 + 160, y - 5, 60, 20, SAVE_BUTTON, 0xd0d0d0);
@ -747,7 +747,6 @@ void draw_window()
*/ */
panel_y = y; panel_y = y;
draw_grid();
//kos_DefineButton(0,0,WND_W,WND_H,0x60000002,0); //kos_DefineButton(0,0,WND_W,WND_H,0x60000002,0);
//if (is_edit) KEdit(); //if (is_edit) KEdit();
@ -758,8 +757,10 @@ void draw_window()
edit_box_draw((DWORD)&file_box); edit_box_draw((DWORD)&file_box);
} }
draw_grid();
// end redraw // end redraw
kos_WindowRedrawStatus(2); kos_WindowRedrawStatus(2);
window_drawall=false;
sel_moved = 0; sel_moved = 0;
} }
@ -940,8 +941,8 @@ void process_mouse()
if (mouse_x >= col_left[i] && if (mouse_x >= col_left[i] &&
mouse_x <= col_left[i + 1]) mouse_x <= col_left[i + 1])
{ {
sprintf(debuf, "yyy %U",col_left[i+1]); //sprintf(debuf, "yyy %U",col_left[i+1]);
rtlDebugOutString(debuf); //rtlDebugOutString(debuf);
kx = i; break; kx = i; break;
} }
int ky = -1; int ky = -1;
@ -1450,17 +1451,17 @@ void kos_Main()
{ {
kos_InitHeap(); kos_InitHeap();
load_edit_box(); load_edit_box();
init(); init();
draw_window();
for (;;) for (;;)
{ {
switch (kos_WaitForEvent(10)) // äà, ïëîõî. ïîòîì íóæíî áóäåò ïðîñòî ëîâèòü ñîáûòèÿ ìûøè. switch (kos_CheckForEvent())
{ {
case 0: case 0:
process_mouse(); process_mouse();
break; break;
case 1: case 1:
window_drawall=true;
draw_window(); draw_window();
break; break;
case 2: case 2:

View File

@ -66,7 +66,7 @@ Dword rtlRand( void )
} }
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount ) /*void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount )
{ {
__asm{ __asm{
mov edi, dst mov edi, dst
@ -87,7 +87,7 @@ void memset( Byte *dst, Byte filler, Dword count )
mov ecx, count mov ecx, count
rep stosb rep stosb
} }
} }*/
// //