quark: working "search next"

git-svn-id: svn://kolibrios.org@7975 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-24 00:18:40 +00:00
parent c20f1efa82
commit 7f30709b5c
4 changed files with 21 additions and 13 deletions

View File

@ -13,7 +13,7 @@ char intro[] = "
char copied_chars[] = "‘ª®¯¨à®¢ ­® ᨢ®«®¢: %i"; char copied_chars[] = "‘ª®¯¨à®¢ ­® ᨢ®«®¢: %i";
char about[] = "Quark Text v0.8 char about[] = "Quark Text v0.9
¢â®à: Š¨à¨«« ¨¯ â®¢ aka Leency ¢â®à: Š¨à¨«« ¨¯ â®¢ aka Leency
 ©â: http://aspero.pro  ©â: http://aspero.pro
@ -52,7 +52,7 @@ Try to open some text file.";
char copied_chars[] = "Copied %i chars"; char copied_chars[] = "Copied %i chars";
char about[] = "Quark Text v0.8 char about[] = "Quark Text v0.9
Author: Kiril Lipatov aka Leency Author: Kiril Lipatov aka Leency
Website: http://aspero.pro Website: http://aspero.pro

View File

@ -68,7 +68,7 @@ void PaintVisible()
selection.draw(absolute_y); selection.draw(absolute_y);
if (search.visible) for (ff=0; ff<search.found.count; ff++) { if (search.visible) || (search_next) for (ff=0; ff<search.found.count; ff++) {
s1 = search.found.get(ff) - lines.get(absolute_y); s1 = search.found.get(ff) - lines.get(absolute_y);
s2 = search.found.get(ff) - lines.get(absolute_y+1); s2 = search.found.get(ff) - lines.get(absolute_y+1);
@ -77,6 +77,7 @@ void PaintVisible()
if (s1 > 0) && (s2 < 0) { if (s1 > 0) && (s2 < 0) {
DrawBuf.DrawBar(search.found.get(ff) - lines.get(absolute_y) * list.font_w + 3, DrawBuf.DrawBar(search.found.get(ff) - lines.get(absolute_y) * list.font_w + 3,
ydraw, strlen(#found_text) * list.font_w, list.item_h, theme.found); ydraw, strlen(#found_text) * list.font_w, list.item_h, theme.found);
search_next = false;
} }
} }

View File

@ -56,6 +56,7 @@ int curcol_scheme;
int font_size; int font_size;
bool enable_edit = false; bool enable_edit = false;
bool search_next = false;
#include "data.h" #include "data.h"
@ -315,11 +316,12 @@ void HandleMouseEvent()
bool EventSearchNext() bool EventSearchNext()
{ {
int new_y = search.find_next(list.first); int new_y = search.find_next(list.first+1);
if (new_y) { if (new_y) {
list.first = new_y; list.first = new_y;
list.CheckDoesValuesOkey(); list.CheckDoesValuesOkey();
DrawPage(); search_next = true;
DrawPage();
} }
} }
@ -690,7 +692,7 @@ void draw_window()
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
sc.get(); sc.get();
if (Form.status_window>2) return; if (Form.status_window>2) return;
if (Form.width < 430) { MoveSize(OLD,OLD,430,OLD); return; } if (Form.width < 450) { MoveSize(OLD,OLD,450,OLD); return; }
if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; } if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; }
button.init(40); button.init(40);

View File

@ -63,17 +63,17 @@ bool SEARCH::draw(dword _btn_find, _btn_hide, _y)
DrawBar(0, _y+1, Form.cwidth, SEARCH_H-1, sc.work); DrawBar(0, _y+1, Form.cwidth, SEARCH_H-1, sc.work);
search_box.top = _y + 6; search_box.top = _y + 6;
search_box.width = math.min(Form.width - 200, 250); search_box.width = math.min(Form.width - 200, 150);
DrawRectangle(search_box.left-1, search_box.top-1, search_box.width+2, 23,sc.work_graph); DrawRectangle(search_box.left-1, search_box.top-1, search_box.width+2, 23,sc.work_graph);
edit_box_draw stdcall(#search_box); edit_box_draw stdcall(#search_box);
DrawCaptButton(search_box.left+search_box.width+14, search_box.top-1, 90, DrawCaptButton(search_box.left+search_box.width+14, search_box.top-1, 100,
TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, T_FIND_NEXT); TOOLBAR_ICON_HEIGHT+1, _btn_find, sc.work_light, sc.work_text, T_FIND_NEXT);
sprintf(#matches, T_MATCHES, found.count); sprintf(#matches, T_MATCHES, found.count);
WriteTextWithBg(search_box.left+search_box.width+14+110, WriteTextWithBg(search_box.left+search_box.width+14+115,
search_box.top+3, 0xD0, sc.work_text, #matches, sc.work); search_box.top+3, 0xD0, sc.work_text, #matches, sc.work);
DefineHiddenButton(Form.cwidth-26, search_box.top-1, TOOLBAR_ICON_HEIGHT+1, DefineHiddenButton(Form.cwidth-26, search_box.top-1, TOOLBAR_ICON_HEIGHT+1,
@ -97,17 +97,22 @@ int SEARCH::find_all()
int SEARCH::find_next(int _cur_pos) int SEARCH::find_next(int _cur_pos)
{ {
int i; int i;
dword t1, t2;
if (!search_text[0]) return false; if (!search_text[0]) return false;
if (!streq(#found_text, #search_text)) { if (!streq(#found_text, #search_text)) {
strcpy(#found_text, #search_text); strcpy(#found_text, #search_text);
find_all(); find_all();
draw_window();
} }
draw_window();
//for (i=_cur_pos+1; i<list.count; i++) { for (i=0; i<found.count; i++) {
// if (strstri(lines.get(i),#search_text)) return i; if (signed found.get(i) - lines.get(_cur_pos) > 0) {
//} t1 = found.get(i);
while(t1 > lines.get(_cur_pos)) _cur_pos++;
return _cur_pos-1;
}
}
return false; return false;
} }