/programs/cmm/lib/list_box.h |
---|
126,13 → 126,18 |
:int llist::ProcessKey(dword key) |
{ |
if (horisontal_selelection) switch(key) |
{ |
if (horisontal_selelection) { |
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) switch(key) { |
case SCAN_CODE_HOME: KeyHome(); break; |
case SCAN_CODE_END: KeyEnd(); |
} |
switch(key) { |
case SCAN_CODE_LEFT: return KeyLeft(); |
case SCAN_CODE_RIGHT: return KeyRight(); |
case SCAN_CODE_HOME: return KeyHomeHor(); |
case SCAN_CODE_END: return KeyEndHor(); |
} |
} |
switch(key) |
{ |
case SCAN_CODE_DOWN: return KeyDown(); |
/programs/cmm/quark/data.h |
---|
9,11 → 9,11 |
#ifdef LANG_RUS |
char intro[] = "â® ¯à®á⮩ ¯à®á¬®âà騪 ⥪áâ . |
®¯à®¡ã©â¥ ®âªàëâì ª ª®©-¨¡ã¤ì ⥪áâ®¢ë© ä ©«."; |
®¯à®¡ã©â¥ ®âªàëâì ⥪áâ®¢ë© ä ©«."; |
char copied_chars[] = "ª®¯¨à®¢ ® ᨢ®«®¢: %i"; |
char about[] = "Quark Text v0.2 |
char about[] = "Quark Text v0.4 |
¢â®à: ¨à¨«« ¨¯ ⮢ aka Leency |
©â: http://aspero.pro |
44,12 → 44,12 |
#else |
char intro[] = "Quark will be a nice Code Editor one day. |
char intro[] = "Quark is a simple text viewer. |
Try to open some text file."; |
char copied_chars[] = "Copied %i chars"; |
char about[] = "Quark Text v0.2 |
char about[] = "Quark Text v0.4 |
Author: Kiril Lipatov aka Leency |
Website: http://aspero.pro |
/programs/cmm/quark/prepare_page.h |
---|
2,19 → 2,13 |
void ParseAndPaint() |
{ |
//search.clear(); |
list.KeyHome(); |
list.count=0; |
selection.cancel(); |
Parse(); |
list.visible = list.h / list.item_h; |
if (list.count < list.visible) { |
DrawBuf.bufh = list.visible; |
} else { |
DrawBuf.bufh = list.count; |
} |
DrawBuf.Init(list.x, list.y, list.w, DrawBuf.bufh+1*list.item_h); |
DrawBuf.Init(list.x, list.y, list.w, list.visible+1*list.item_h); |
DrawPage(); |
} |
28,7 → 22,6 |
lines.drop(); |
lines.add(io.buffer_data); |
selection.cancel(); |
for (off = io.buffer_data; off < buflen; off++) |
{ |
54,33 → 47,33 |
void PaintVisible() |
{ |
int i; |
dword y; |
dword ydraw, absolute_y; |
dword line_bg; |
bool swapped = false; |
bool swapped_selection = false; |
list.column_max = lines.get(list.cur_y+1) - lines.get(list.cur_y); |
list.CheckDoesValuesOkey(); |
if (selection.end_offset < selection.start_offset) { |
swapped = selection.swap_start_end(); |
swapped_selection = selection.swap_start_end(); |
} |
for ( i=list.first; i < list.first+list.visible+1; i++) |
for ( i=0; i < list.visible+1; i++) |
{ |
y = i * list.item_h; |
ydraw = i * list.item_h; |
absolute_y = i + list.first; |
line_bg = theme.bg; |
if (selection.start_y < i) && (selection.end_y > i) line_bg = selection.color; |
DrawBuf.DrawBar(0, y, list.w, list.item_h, line_bg); |
if (selection.start_y < absolute_y) && (selection.end_y > absolute_y) line_bg = selection.color; |
DrawBuf.DrawBar(0, ydraw, list.w, list.item_h, line_bg); |
selection.draw(i); |
selection.draw(absolute_y); |
if (i<list.count) DrawBuf.WriteText(3, y+3, list.font_type, theme.text, |
lines.get(i), lines.get(i+1) - lines.get(i)); |
if (absolute_y<list.count) DrawBuf.WriteText(3, ydraw+3, list.font_type, theme.text, |
lines.get(absolute_y), lines.get(absolute_y+1) - lines.get(absolute_y)); |
} |
PutPaletteImage(list.first * DrawBuf.bufw * list.item_h * 4 + buf_data+8, |
DrawBuf.bufw, list.h, list.x, list.y, 32, 0); |
PutPaletteImage(buf_data+8, DrawBuf.bufw, list.h, list.x, list.y, 32, 0); |
if (swapped) selection.swap_start_end(); |
if (swapped_selection) selection.swap_start_end(); |
} |
/programs/cmm/quark/quark.c |
---|
4,7 → 4,7 |
Licence: GPLv2 |
The core components of this app are: |
1. list: text grid with keyboard and mouse proceed |
1. list: text grid with keyboard and mouse events |
2. lines: the mas of pointers for each line start |
3. selection |
*/ |
85,7 → 85,8 |
COLOR_SCHEME=8, |
RMB_MENU, |
BTN_FIND_NEXT, |
BTN_FIND_CLOSE |
BTN_FIND_CLOSE, |
BTN_CHANGE_CHARSET |
}; |
dword menu_id; |
114,14 → 115,12 |
{ |
dword bufsize = atoi(#param + 1) + 20; |
dword bufpointer = malloc(bufsize); |
dword filesize; |
ESDWORD[bufpointer+0] = 0; |
ESDWORD[bufpointer+4] = 8; |
IpcSetArea(bufpointer, bufsize); |
IpcSetArea(bufpointer, bufsize); |
SetEventMask(EVM_IPC); |
if (@WaitEventTimeout(200) != evIPC) { |
notify("'IPC FAIL'E"); |
return; |
190,6 → 189,9 |
case BTN_FIND_CLOSE: |
search.hide(); |
break; |
case BTN_CHANGE_CHARSET: |
EventShowCharsetsList(); |
break; |
} |
} |
228,17 → 230,6 |
case SCAN_CODE_KEY_F: |
search.show(); |
return; |
case SCAN_CODE_HOME: |
list.KeyHome(); |
list.KeyHomeHor(); |
DrawPage(); |
return; |
case SCAN_CODE_END: |
list.KeyEnd(); |
list.column_max = strlen(lines.get(list.cur_y)); |
list.KeyEndHor(); |
DrawPage(); |
return; |
case SCAN_CODE_KEY_A: |
selection.select_all(); |
DrawPage(); |
261,11 → 252,16 |
} |
if (search.edit_key()) { |
return; |
} else if (list.ProcessKey(key_scancode)) { |
} else { |
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(); |
//EventInsertCharIntoText(); |
} |
void HandleMouseEvent() |
281,7 → 277,7 |
GetKeyModifier(); |
if (key_modifier & KEY_LSHIFT) || (key_modifier & KEY_RSHIFT) { |
if (mouse.down) && (!selection.is_active()) selection.set_start(); |
if (mouse.down) selection.set_start(); |
list.ProcessMouse(mouse.x, mouse.y); |
if (mouse.up) selection.set_end(); |
DrawPage(); |
290,6 → 286,7 |
list.ProcessMouse(mouse.x, mouse.y); |
if (mouse.down) { |
selection.cancel(); |
selection.set_start(); |
} |
selection.set_end(); |
386,8 → 383,8 |
void EventShowReopenMenu() |
{ |
menu_id = REOPEN_IN_APP; |
open_lmenu(Form.left+5 + reopenin_mx, Form.top+29+skin_height, |
MENU_ALIGN_TOP_LEFT, NULL, |
open_lmenu(Form.left+5 + reopenin_mx + 23, Form.top+29+skin_height, |
MENU_ALIGN_TOP_RIGHT, NULL, |
"Tinypad\nTextEdit\nWebView\nFB2Read\nHexView\nOther"); |
} |
394,7 → 391,7 |
void EventShowThemesList() |
{ |
menu_id = COLOR_SCHEME; |
open_lmenu(Form.left+2 + theme_mx + 26, |
open_lmenu(Form.left+5 + theme_mx + 23, |
Form.top+29+skin_height, MENU_ALIGN_TOP_RIGHT, |
curcol_scheme+1, #color_scheme_names); |
} |
646,17 → 643,15 |
AddTopBarButton(#EventOpenDialog, ECTRL+SCAN_CODE_KEY_O, 0, x.set(8), false); |
//AddTopBarButton(#EventSave, ECTRL+SCAN_CODE_KEY_S, 5, x.inc(SMALL_GAP), false); |
AddTopBarButton(#EventShowFileInfo, ECTRL+SCAN_CODE_KEY_I, 10, x.inc(SMALL_GAP), false); |
AddTopBarButton(#EventMagnifyMinus, ECTRL+SCAN_CODE_MINUS, 32, x.inc(BIG_GAP), false); |
AddTopBarButton(#EventMagnifyPlus, ECTRL+SCAN_CODE_PLUS, 33, x.inc(SMALL_GAP), false); |
AddTopBarButton(#EventMagnifyMinus, ECTRL+SCAN_CODE_MINUS, 33, x.inc(BIG_GAP), false); |
AddTopBarButton(#EventMagnifyPlus, ECTRL+SCAN_CODE_PLUS, 32, x.inc(SMALL_GAP), false); |
AddTopBarButton(#EventClickSearch, ECTRL+SCAN_CODE_KEY_F, 49, x.inc(BIG_GAP), serha); search_mx = EAX; |
x.set(Form.cwidth-4); |
AddTopBarButton(#EventShowInfo, NULL, -1, x.inc(-SMALL_GAP), false); burger_mx = EAX; |
AddTopBarButton(#EventShowThemesList, NULL, 40, x.inc(-BIG_GAP), thema); theme_mx = EAX; |
//AddTopBarButton(#EventShowInfo, NULL, -1, x.inc(-SMALL_GAP), false); burger_mx = EAX; |
AddTopBarButton(#EventShowThemesList, NULL, 40, x.inc(-SMALL_GAP), thema); theme_mx = EAX; |
AddTopBarButton(#EventShowReopenMenu, ECTRL+SCAN_CODE_KEY_E, 16, x.inc(-SMALL_GAP), reopa); reopenin_mx = EAX; |
//AddTopBarButton(#EventOpenSysfuncs, NULL, 18, x.inc(-SMALL_GAP), false); |
//AddTopBarButton(#EventOpenPipet, NULL, 39, x.inc(-SMALL_GAP), false); |
DefineHiddenButton(Form.cwidth-70, Form.cheight - STATUSBAR_H + 1, |
60, 12, button.add(#EventShowCharsetsList)); |
} |
void DrawStatusBar(dword _in_text) |
666,10 → 661,14 |
if (_in_text) strncpy(#status_text, _in_text, sizeof(status_text)); |
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); |
DrawBar(0,Form.cheight - STATUSBAR_H+1, Form.cwidth,STATUSBAR_H-1, sc.work); |
WriteText(5, Form.cheight - STATUSBAR_H + 4, 0x80, sc.work_text, #status_text); |
if (param[0]) { |
WriteTextCenter(Form.cwidth-70, Form.cheight - STATUSBAR_H + 4, |
60, sc.work_text, real_encoding*10+#charsets); |
WriteText(5, Form.cheight - STATUSBAR_H + 4, 0x80, sc.work_text, #status_text); |
DefineHiddenButton(Form.cwidth-70, Form.cheight - STATUSBAR_H + 1, |
60, 12, BTN_CHANGE_CHARSET+10); |
} |
} |
void draw_window() |
{ |
/programs/cmm/quark/selection.h |
---|
24,20 → 24,23 |
void SELECTION::draw_line(dword x,y,w) |
{ |
DrawBuf.DrawBar(x, y, w, list.item_h, color); |
DrawBuf.DrawBar(x, y - list.first * list.item_h, w, list.item_h, color); |
} |
void SELECTION::draw(int i) |
{ |
if (is_active()) { |
if (start_y == i) && (end_y == i) draw_line(start_x * list.font_w+2, start_y * list.item_h, end_x - start_x * list.font_w); |
else if (start_y == i) draw_line(start_x * list.font_w+2, start_y * list.item_h, list.w -2- calc(start_x * list.font_w)); |
else if (end_y == i) draw_line(0, end_y * list.item_h, end_x * list.font_w+2); |
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); |
//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); |
} |
DrawBuf.DrawBar(list.cur_x * list.font_w + 2, list.cur_y * list.item_h, 2, list.item_h, theme.cursor); //DrawCursor |
//DrawCursor |
if (list.cur_y >= list.first) && (list.cur_y <= list.first+list.visible) { |
DrawBuf.DrawBar(list.cur_x * list.font_w + 2, list.cur_y - list.first * list.item_h, 2, list.item_h, theme.cursor); |
} |
} |
void SELECTION::cancel() |
{ |
49,6 → 52,7 |
void SELECTION::set_start() |
{ |
if (selection.is_active()) return; |
start_x = list.cur_x; |
start_y = list.cur_y; |
normalize(); |
61,8 → 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); |
//debugval("end_x", end_x); |
//debugval("end_y", end_y); |
} |
78,11 → 82,10 |
start_x = 0; |
end_y = lines.count-2; |
end_x = lines.get(end_y+1) - lines.get(end_y); |
//normalize(); |
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); |
//debugval("end_x__", end_x); |
//debugval("end_y__", end_y); |
} |
bool SELECTION::swap_start_end() |