Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7941 → Rev 7940

/programs/cmm/quark/search.h
File deleted
/programs/cmm/quark/data.h
13,7 → 13,7
 
char copied_chars[] = "‘ª®¯¨à®¢ ­® ᨢ®«®¢: %i";
 
char about[] = "Quark Text v0.7
char about[] = "Quark Text v0.4
€¢â®à: Š¨à¨«« ‹¨¯ â®¢ aka Leency
‘ ©â: http://aspero.pro
 
31,8 → 31,8
Esc - áªàëâì ¯ ­¥«ì ¯®¨áª ";
 
char color_scheme_names[] = "’¢®à®¦¥ª\nŠ®á¬®á ";
?define FILE_SAVED_WELL "'” ©« ãᯥ譮 á®åà ­¥­'O"
?define FILE_NOT_SAVED "'Žè¨¡ª  ¯à¨ á®åà ­¥­¨¨ ä ©« !'E"
#define FILE_SAVED_WELL "'” ©« ãᯥ譮 á®åà ­¥­'O"
#define FILE_NOT_SAVED "'Žè¨¡ª  ¯à¨ á®åà ­¥­¨¨ ä ©« !'E"
 
char rmb_menu[] =
"‚ë१ âì|Ctrl+X
42,9 → 42,6
Žâªàëâì ¢ ¯ ¯ª¥
Š®¯¨à®¢ âì ¯ãâì ä ©« ";
 
?define T_MATCHES " ©¤¥­®: %i "
?define T_FIND_NEXT " ©â¨ ¤ «¥¥"
 
#else
 
char intro[] = "Quark is a simple text viewer.
52,7 → 49,7
 
char copied_chars[] = "Copied %i chars";
 
char about[] = "Quark Text v0.7
char about[] = "Quark Text v0.4
Author: Kiril Lipatov aka Leency
Website: http://aspero.pro
 
70,8 → 67,8
Esc - hide search bar";
 
char color_scheme_names[] = "Dairy\nCosmos ";
?define FILE_SAVED_WELL "'File saved'O"
?define FILE_NOT_SAVED "'Error saving file!'E"
#define FILE_SAVED_WELL "'File saved'O"
#define FILE_NOT_SAVED "'Error saving file!'E"
 
char rmb_menu[] =
"Cut|Ctrl+X
81,9 → 78,6
Reveal in folder
Copy file path";
 
?define T_MATCHES "Matches: %i "
?define T_FIND_NEXT " Find next "
 
#endif
 
//===================================================//
/programs/cmm/quark/quark.c
57,7 → 57,7
 
#include "data.h"
 
#include "search.h"
#include "../txtread/search.h"
#include "selection.h"
#include "prepare_page.h"
 
72,6 → 72,8
 
char title[4196];
 
bool help_opened = false;
 
int reopenin_mx,
theme_mx,
burger_mx,
195,33 → 197,18
 
void HandleKeyEvent()
{
GetKeys();
 
switch (key_scancode)
{
case SCAN_CODE_F1:
EventShowInfo();
int new_y;
if (help_opened) {
help_opened = false;
DrawPage();
return;
case SCAN_CODE_ESC:
search.hide();
return;
case SCAN_CODE_ENTER:
if (! search_box.flags & ed_focus) return;
case SCAN_CODE_F3:
EventSearchNext();
return;
}
GetKeys();
 
if (search.edit_key()) return;
 
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
if (key.press(ECTRL + key_scancode)) return;
switch (key_scancode)
{
case SCAN_CODE_KEY_A:
selection.select_all();
DrawPage();
return;
case SCAN_CODE_KEY_X:
EventCut();
return;
243,19 → 230,37
case SCAN_CODE_KEY_F:
search.show();
return;
case SCAN_CODE_KEY_A:
selection.select_all();
DrawPage();
return;
}
}
 
if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) {
selection.set_start();
switch (key_scancode)
{
case SCAN_CODE_F1:
EventShowInfo();
return;
case SCAN_CODE_ESC:
search.hide();
return;
case SCAN_CODE_ENTER:
if (! search_box.flags & ed_focus) return;
case SCAN_CODE_F3:
EventSearchNext();
return;
}
if (search.edit_key()) {
return;
} else {
selection.cancel();
}
 
if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) selection.set_start();
else selection.cancel();
if (list.ProcessKey(key_scancode)) {
if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) selection.set_end();
DrawPage();
}
return;
}
//EventInsertCharIntoText();
}
 
279,11 → 284,7
return;
}
 
//as we have lines of variable width, we need to recalculate column_max
list.column_max = lines.len(mouse.y - list.y / list.item_h + list.first);
 
list.ProcessMouse(mouse.x, mouse.y);
 
if (mouse.down) {
selection.cancel();
selection.set_start();
312,7 → 313,7
 
bool EventSearchNext()
{
int new_y = search.find_next(list.first);
int new_y = search.find_next(list.first, theme.bg);
if (new_y) {
list.first = new_y / list.item_h;
list.CheckDoesValuesOkey();
/programs/cmm/quark/selection.h
11,7 → 11,6
bool swap_start_end();
void normalize();
void select_all();
void debug();
} selection;
 
bool SELECTION::is_active()
34,7 → 33,6
if (start_y == i) && (end_y == i) draw_line(start_x * list.font_w+2, start_y, end_x - start_x * list.font_w);
else if (start_y == i) draw_line(start_x * list.font_w+2, start_y, list.w -2- calc(start_x * list.font_w));
else if (end_y == i) draw_line(0, end_y, end_x * list.font_w+2);
//only for debug:
//DrawBuf.DrawBar(start_x * list.font_w + 2, start_y * list.item_h, 2, list.item_h, 0x00FF00);
//DrawBuf.DrawBar(end_x * list.font_w + 0, end_y * list.item_h, 2, list.item_h, 0xFF00FF);
}
61,13 → 59,6
start_offset = lines.get(start_y) + start_x;
}
 
:void SELECTION::debug()
{
char rez[256];
sprintf(#rez, "start_x: %d start_y: %d end_x: %d end_y: %d", start_x, start_y, end_x, end_y);
debugln(#rez);
}
 
void SELECTION::set_end()
{
end_x = list.cur_x;
74,6 → 65,8
end_y = list.cur_y;
normalize();
end_offset = lines.get(end_y) + end_x;
//debugval("end_x", end_x);
//debugval("end_y", end_y);
}
 
 
91,6 → 84,8
end_x = lines.get(end_y+1) - lines.get(end_y);
start_offset = lines.get(start_y) + start_x;
end_offset = lines.get(end_y) + end_x;
//debugval("end_x__", end_x);
//debugval("end_y__", end_y);
}
 
bool SELECTION::swap_start_end()
/programs/cmm/lib/list_box.h
102,21 → 102,21
 
:int llist::ProcessMouse(int xx, yy)
{
int new_cur_y, new_cur_x, ret=0;
int cur_y_temp, cur_x_temp, ret=0;
if (MouseOver(xx, yy))
{
new_cur_y = yy - y / item_h + first;
if (new_cur_y != cur_y) && (new_cur_y<count)
cur_y_temp = yy - y / item_h + first;
if (cur_y_temp != cur_y) && (cur_y_temp<count)
{
cur_y = new_cur_y;
cur_y = cur_y_temp;
ret = 1;
}
if (horisontal_selelection)
{
new_cur_x = xx - x / item_w;
if (new_cur_x != cur_x) && (new_cur_x<column_max)
cur_x_temp = xx - x / item_w;
if (cur_x_temp != cur_x) && (cur_x_temp<column_max)
{
cur_x = new_cur_x;
cur_x = cur_x_temp;
ret = 1;
}
}
/programs/cmm/lib/strings.h
491,18 → 491,6
}
}
 
inline int strnum(dword haystack, needle)
{
int count = 0;
int needle_len = strlen(needle);
loop() {
if (! haystack = strstr(haystack, needle)) break;
haystack+=needle_len;
count++;
}
return count;
}
 
inline signed int strcmpi(dword cmp1, cmp2)
{
char si, ue;