From d023e34e3f877be50863b32bfab0f26d77511c1e Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Sun, 25 Dec 2005 10:17:00 +0000 Subject: [PATCH] Now golded+ can draw box lines. Use keyboard configuration keyword EditDrawLines (default: ^D) to toggle draw modes. --- cfgs/config/goldkeys.cfg | 1 + cfgs/config/goldkeys.rus | 1 + cfgs/config/goldlang.cfg | 2 + cfgs/config/goldlang.ger | 2 + cfgs/config/goldlang.it | 2 + cfgs/config/goldlang.nl | 2 + cfgs/config/goldlang.ru2 | 2 + cfgs/config/goldlang.ru3 | 2 + cfgs/config/goldlang.rus | 2 + cfgs/config/goldlang.sv | 2 + docs/notework.txt | 3 + golded3/gckeys.cpp | 2 + golded3/gckeys.h | 1 + golded3/gclang.cpp | 2 + golded3/gclang.h | 2 + golded3/geedit.cpp | 24 +- golded3/geedit.h | 5 + golded3/geedit2.cpp | 505 +++++++++++++++++++++++++++++++++++++++ golded3/gekeys.h | 1 + golded3/gelang.h | 2 + 20 files changed, 564 insertions(+), 1 deletion(-) diff --git a/cfgs/config/goldkeys.cfg b/cfgs/config/goldkeys.cfg index c5b9d3e..2e61054 100644 --- a/cfgs/config/goldkeys.cfg +++ b/cfgs/config/goldkeys.cfg @@ -200,6 +200,7 @@ Ins EDITtoggleinsert ; Toggle insert/replace editing mode ^I EditSCodeItalic ; Set stylecode to italic font face ^L EditSCodeUnderline ; Set stylecode to underline font face ^R EditSCodeReverse ; Set stylecode to inverce font face +^D EditDrawLines ; Toggle draw box line mode ; ------------------------------------------------------------------ diff --git a/cfgs/config/goldkeys.rus b/cfgs/config/goldkeys.rus index 276043e..2cf35f8 100644 --- a/cfgs/config/goldkeys.rus +++ b/cfgs/config/goldkeys.rus @@ -153,6 +153,7 @@ Ins EditToggleInsert ^I EditSCodeItalic ; Выбрать режим курсива ^L EditSCodeUnderline ; Выбрать режим подчеркнутого шрифта ^R EditSCodeReverse ; Выбрать режим инвертированного шрифта +^D EditDrawLines ; Переключить в режим рисования рамок ; ------------------------------------------------------------------ ; КОМАHДЫ ВЫБОРА ФАЙЛОВ diff --git a/cfgs/config/goldlang.cfg b/cfgs/config/goldlang.cfg index cb7c550..eee32f4 100644 --- a/cfgs/config/goldlang.cfg +++ b/cfgs/config/goldlang.cfg @@ -422,6 +422,8 @@ IL_NOPERSONAL " No personal mail found " ST_ESCORCONTINUE "ESC exits. Other keys: Tries to continue" MS_SPELLCHECKER "SpellChecker: %s" WT_INS " Ins " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Filelist from %s" ST_INITIALIZING "Initializing ..." ST_CHECKING "Checking" diff --git a/cfgs/config/goldlang.ger b/cfgs/config/goldlang.ger index 6495e8b..1d42a80 100644 --- a/cfgs/config/goldlang.ger +++ b/cfgs/config/goldlang.ger @@ -440,6 +440,8 @@ IL_NOPERSONAL " Keine pers ST_ESCORCONTINUE "ESC bricht ab. Jede andere Taste: Versuche fortzusetzen." MS_SPELLCHECKER "RechtschreibungsprБfer: %s" WT_INS " Einf " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Dateiliste von %s" ST_INITIALIZING "Initialisiere.." ST_CHECKING "PrБfe.." diff --git a/cfgs/config/goldlang.it b/cfgs/config/goldlang.it index 1898226..cfe39a3 100644 --- a/cfgs/config/goldlang.it +++ b/cfgs/config/goldlang.it @@ -451,6 +451,8 @@ IL_NOPERSONAL " Nessuna mail personale trovata " ST_ESCORCONTINUE "ESC per uscire. Altro tasto: Per tentare di continuare" MS_SPELLCHECKER "SpellChecker: %s" WT_INS " Ins " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Lista file da %s" ST_INITIALIZING "Inizializzazione ..." ST_CHECKING "Controllo..." diff --git a/cfgs/config/goldlang.nl b/cfgs/config/goldlang.nl index 5bde80c..3929f92 100644 --- a/cfgs/config/goldlang.nl +++ b/cfgs/config/goldlang.nl @@ -432,6 +432,8 @@ IL_NOPERSONAL " Geen persoonlijke berichten gevonden " ST_ESCORCONTINUE "ESC stopt. Andere toetsen: probeert om verder te gaan" MS_SPELLCHECKER "Spellingscontrole: %s" WT_INS " Ins " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Bestandenlijst van %s" ST_INITIALIZING "Initializeert ..." ST_CHECKING "Controleert" diff --git a/cfgs/config/goldlang.ru2 b/cfgs/config/goldlang.ru2 index 0267666..c00bd98 100644 --- a/cfgs/config/goldlang.ru2 +++ b/cfgs/config/goldlang.ru2 @@ -450,6 +450,8 @@ IL_NOPERSONAL " ST_ESCORCONTINUE "ESC - выход. Остальные кнопки - попытка продолжить. " MS_SPELLCHECKER "Проверка орфографии: %s" WT_INS " Вст " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Список имеющегося у %s" ST_INITIALIZING "Инициализация ..." ST_CHECKING "Проверка" diff --git a/cfgs/config/goldlang.ru3 b/cfgs/config/goldlang.ru3 index 3642842..dd63583 100644 --- a/cfgs/config/goldlang.ru3 +++ b/cfgs/config/goldlang.ru3 @@ -642,6 +642,8 @@ WT_GRP " ST_ESCORCONTINUE "ESC выход. Другие клавиши: Попытка продолжить" MS_SPELLCHECKER "Проверка орфографии: %s" WT_INS " Вст " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Список файлов из сообщения %s" ;ST_UNREGWAIT "Зарегистрируйся!!! ;-( - Нажми клавишу или жди %ld секунд" ST_INITIALIZING "Запуск..." diff --git a/cfgs/config/goldlang.rus b/cfgs/config/goldlang.rus index aec2e12..7ae3405 100644 --- a/cfgs/config/goldlang.rus +++ b/cfgs/config/goldlang.rus @@ -447,6 +447,8 @@ IL_NOPERSONAL " ST_ESCORCONTINUE "ESC - выход. Остальные кнопки - попытка продолжить. " MS_SPELLCHECKER "Проверка орфографии: %s" WT_INS " Вст " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Список имеющегося у %s" ST_INITIALIZING "Инициализация ..." ST_CHECKING "Проверка" diff --git a/cfgs/config/goldlang.sv b/cfgs/config/goldlang.sv index dcd1c0a..392d75e 100644 --- a/cfgs/config/goldlang.sv +++ b/cfgs/config/goldlang.sv @@ -429,6 +429,8 @@ IL_NOPERSONAL " Inga personliga brev funna " ST_ESCORCONTINUE "ESC avbryter. Andra tangenter: fЎrsЎker fortsфtta" MS_SPELLCHECKER "Stavningskollr: %s" WT_INS " Ins " +WT_DRAWSL " DL1 " +WT_DRAWDL " DL2 " MI_FILELISTFROM "Fillista frхn %s" ST_INITIALIZING "Initierar ..." ST_CHECKING "Checking" diff --git a/docs/notework.txt b/docs/notework.txt index cbad373..c7c2e50 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,9 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ ++ Now golded+ can draw box lines. Use keyboard configuration keyword + EditDrawLines (default: ^D) to toggle draw modes. + + Added character code from cursor position to editor status bar. NOTE: ST_EDITSTATUS changed to "Edit %i,%i (%02X). %s". Add octal and decimal examples into language definition files (goldlang.*). diff --git a/golded3/gckeys.cpp b/golded3/gckeys.cpp index be3dd20..5982c17 100644 --- a/golded3/gckeys.cpp +++ b/golded3/gckeys.cpp @@ -148,6 +148,7 @@ CmdKey DefaultKeyset[] = { { Key_C_I , KK_EditSCodeItalic , KT_E }, { Key_C_L , KK_EditSCodeUnderline , KT_E }, { Key_C_R , KK_EditSCodeReverse , KT_E }, + { Key_C_D , KK_EditDrawLines , KT_E }, { Key_Esc , KK_FileAbort , KT_F }, { Key_A_X , KK_FileAskExit , KT_F }, @@ -369,6 +370,7 @@ CmdKey DefaultKeyset[] = { tglobalkey globalkeys[] = { { CRC_READLOOKUPDEST , KK_ReadLookupDest , KT_R }, // 0x0023 { CRC_FILETOGGLEMARKALL , KK_FileToggleMarkAll , KT_F }, // 0x0032 + { CRC_EDITDRAWLINES , KK_EditDrawLines , KT_E }, // 0x00E8 { CRC_READADDRESSBOOKADD , KK_ReadAddressbookAdd , KT_R }, // 0x00FA { CRC_LISTDOSSHELL , KK_ListDosShell , KT_M }, // 0x0130 { CRC_READREADALL , KK_ReadReadAll , KT_R }, // 0x0146 diff --git a/golded3/gckeys.h b/golded3/gckeys.h index 84badc5..46b9cbb 100644 --- a/golded3/gckeys.h +++ b/golded3/gckeys.h @@ -81,6 +81,7 @@ const word CRC_EDITDELLINE = 0xACCF; const word CRC_EDITDELLTWORD = 0x3B67; const word CRC_EDITDELRTWORD = 0x829A; const word CRC_EDITDOSSHELL = 0xD6C5; +const word CRC_EDITDRAWLINES = 0x00E8; const word CRC_EDITDUPLINE = 0x816A; const word CRC_EDITEXITMSG = 0x1813; const word CRC_EDITEXPORTTEXT = 0x5AED; diff --git a/golded3/gclang.cpp b/golded3/gclang.cpp index ed84d12..1526fc8 100644 --- a/golded3/gclang.cpp +++ b/golded3/gclang.cpp @@ -400,6 +400,8 @@ static LangCrc LangCrcs[] = { { CRC_ST_ESCORCONTINUE , NULL , "ESC exits. Other keys: Tries to continue" }, { CRC_MS_SPELLCHECKER , NULL , "SpellChecker: %s" }, { CRC_WT_INS , NULL , " Ins " }, + { CRC_WT_DRAWSL , NULL , " DL1 " }, + { CRC_WT_DRAWDL , NULL , " DL2 " }, { CRC_MI_FILELISTFROM , NULL , "Filelist from %s" }, { CRC_ST_INITIALIZING , NULL , "Initializing ..." }, { CRC_ST_CHECKING , NULL , "Checking" }, diff --git a/golded3/gclang.h b/golded3/gclang.h index 53b4efa..6a490bc 100644 --- a/golded3/gclang.h +++ b/golded3/gclang.h @@ -403,6 +403,8 @@ const word CRC_IL_NOPERSONAL = 0x2813; const word CRC_ST_ESCORCONTINUE = 0x4800; const word CRC_MS_SPELLCHECKER = 0x69B4; const word CRC_WT_INS = 0x2F27; +const word CRC_WT_DRAWSL = 0x264D; +const word CRC_WT_DRAWDL = 0x314D; const word CRC_MI_FILELISTFROM = 0xB710; const word CRC_ST_INITIALIZING = 0x4C6B; const word CRC_ST_CHECKING = 0xE219; diff --git a/golded3/geedit.cpp b/golded3/geedit.cpp index 2ade427..b728009 100644 --- a/golded3/geedit.cpp +++ b/golded3/geedit.cpp @@ -2642,7 +2642,15 @@ int IEclass::handlekey(gkey __key) { int rc = true; - switch(__key) { + if (drawlines && + (__key != KK_EditGoRight) && (__key != KK_EditGoLeft) && + (__key != KK_EditGoUp) && (__key != KK_EditGoDown)) + { + drawflag = true; + } + + switch(__key) + { case KK_EditBlockRight: __key = KK_EditGoRight; break; case KK_EditBlockLeft: __key = KK_EditGoLeft; break; case KK_EditBlockUp: __key = KK_EditGoUp; break; @@ -2684,6 +2692,18 @@ int IEclass::handlekey(gkey __key) { undo_ready = NO; return rc; + case KK_EditGoRight: + case KK_EditGoLeft: + case KK_EditGoUp: + case KK_EditGoDown: + if (drawlines && !selecting) + { + DrawLines(__key); + undo_ready = NO; + return rc; + } + // fall through + default: rc = PlayMacro(__key, KT_E); if(rc == true) @@ -2783,6 +2803,7 @@ noselecting: case KK_EditSCodeItalic: case KK_EditSCodeUnderline: case KK_EditSCodeReverse: SCodeChange(__key); break; + case KK_EditDrawLines: ToggleDrawLines(); break; // Block functions case KK_EditAnchor: BlockAnchor(); break; @@ -2969,6 +2990,7 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) { chartyped = false; if((_ch < KK_Commands) and (_ch & 0xFF) and not ismacro) { + drawflag = true; chartyped = true; _ch &= 0xFF; insertchar((char)_ch); diff --git a/golded3/geedit.h b/golded3/geedit.h index 5fda67f..77347b8 100644 --- a/golded3/geedit.h +++ b/golded3/geedit.h @@ -269,6 +269,8 @@ protected: Line* currline; int done; int insert; + int drawlines; + int drawflag; int marginquotes; int margintext; int msgmode; @@ -295,6 +297,7 @@ protected: void deleteline (bool zapquotesbelow = false); int dispchar (vchar __ch, int attr=-1); void dispins (); + void dispdl (); void displine (Line* __line, uint __row); #if defined(__GOLD_SPELL__) void dispstringsc (char *__buf, uint __beg, uint __end, uint __row, uint __col, char endchar); @@ -416,6 +419,8 @@ public: void ToggleCaseBlock(gkey key); void SCodeChange(gkey key); void ToggleInsert (); + void ToggleDrawLines(); + void DrawLines (gkey key); void ToLower (); void ToUpper (); void UnDelete (bool before=true); diff --git a/golded3/geedit2.cpp b/golded3/geedit2.cpp index 2d43647..36f02c1 100644 --- a/golded3/geedit2.cpp +++ b/golded3/geedit2.cpp @@ -61,6 +61,8 @@ IEclass::IEclass(int __scol, int __ecol, int __srow, int __erow, int __border) { currline = NULL; done = NO; insert = YES; + drawlines = 0; + drawflag = true; marginquotes = 0; margintext = 0; msgmode = 0; @@ -1383,6 +1385,29 @@ void IEclass::dispins() { } +// ------------------------------------------------------------------ + +void IEclass::dispdl() +{ + GFTRK("Editdispdl"); + + if (drawlines) + { + const char *lng = (drawlines == 1) ? LNG->DrawSL : LNG->DrawDL; + HeaderView->window.prints(5, MAXCOL-12, C_HEADT, lng); + } + else { + vchar _lbuf[6]; + for(int c = 0; c < 5; c++) + _lbuf[c] = _box_table(W_BHEAD,1); + _lbuf[5] = NUL; + HeaderView->window.printvs(5, MAXCOL-12, C_HEADB|ACSET, _lbuf); + } + + GFTRK(NULL); +} + + // ------------------------------------------------------------------ void IEclass::ToggleInsert() { @@ -1396,6 +1421,486 @@ void IEclass::ToggleInsert() { } +// ------------------------------------------------------------------ + +void IEclass::ToggleDrawLines() +{ + GFTRK("EditToggleDrawLines"); + + switch (drawlines) + { + case 0: drawlines = 1; break; + case 1: drawlines = 2; break; + case 2: drawlines = 0; break; + } + + dispdl(); + + GFTRK(NULL); +} + + +// ------------------------------------------------------------------ + +static void ChrToLines(char chr, byte lines[4]) +{ + lines[0] = lines[1] = lines[2] = lines[3] = 0; + + if (chr == _box_table(0, 1)) //hs + lines[0] = lines[1] = 1; + else if (chr == _box_table(1, 1)) //hd + lines[0] = lines[1] = 2; + else if (chr == _box_table(0, 3)) //vs + lines[2] = lines[3] = 1; + else if (chr == _box_table(1, 3)) //vd + lines[2] = lines[3] = 2; + + else if (chr == _box_table(0, 0)) //lsus + lines[1] = lines[3] = 1; + else if (chr == _box_table(1, 0)) //ldud + lines[1] = lines[3] = 2; + else if (chr == _box_table(0, 11)) //vsus + lines[0] = lines[1] = lines[3] = 1; + else if (chr == _box_table(1, 11)) //vdud + lines[0] = lines[1] = lines[3] = 2; + else if (chr == _box_table(0, 2)) //rsus + lines[0] = lines[3] = 1; + else if (chr == _box_table(1, 2)) //rdud + lines[0] = lines[3] = 2; + + else if (chr == _box_table(0, 9)) //lshs + lines[1] = lines[2] = lines[3] = 1; + else if (chr == _box_table(1, 9)) //ldhd + lines[1] = lines[2] = lines[3] = 2; + else if (chr == _box_table(0, 8)) //vshs + lines[0] = lines[1] = lines[2] = lines[3] = 1; + else if (chr == _box_table(1, 8)) //vdhd + lines[0] = lines[1] = lines[2] = lines[3] = 2; + else if (chr == _box_table(0, 10)) //rshs + lines[0] = lines[2] = lines[3] = 1; + else if (chr == _box_table(1, 10)) //rdhd + lines[0] = lines[2] = lines[3] = 2; + + else if (chr == _box_table(0, 5)) //lsds + lines[1] = lines[2] = 1; + else if (chr == _box_table(1, 5)) //lddd + lines[1] = lines[2] = 2; + else if (chr == _box_table(0, 12)) //vsds + lines[0] = lines[1] = lines[2] = 1; + else if (chr == _box_table(1, 12)) //vddd + lines[0] = lines[1] = lines[2] = 2; + else if (chr == _box_table(0, 7)) //rsds + lines[0] = lines[2] = 1; + else if (chr == _box_table(1, 7)) //rddd + lines[0] = lines[2] = 2; + + else if (chr == _box_table(2, 0)) //ldus + { lines[1] = 1; lines[3] = 2; } + else if (chr == _box_table(3, 0)) //lsud + { lines[1] = 2; lines[3] = 1; } + else if (chr == _box_table(2, 11)) //vdus + { lines[0] = lines[1] = 1; lines[3] = 2; } + else if (chr == _box_table(3, 11)) //vsud + { lines[0] = lines[1] = 2; lines[3] = 1; } + else if (chr == _box_table(2, 2)) //rdus + { lines[0] = 1; lines[3] = 2; } + else if (chr == _box_table(3, 2)) //rsud + { lines[0] = 2; lines[3] = 1; } + + else if (chr == _box_table(2, 9)) //ldhs + { lines[1] = 1; lines[2] = lines[3] = 2; } + else if (chr == _box_table(3, 9)) //lshd + { lines[1] = 2; lines[2] = lines[3] = 1; } + else if (chr == _box_table(2, 8)) //vdhs + { lines[0] = lines[1] = 1; lines[2] = lines[3] = 2; } + else if (chr == _box_table(3, 8)) //vshd + { lines[0] = lines[1] = 2; lines[2] = lines[3] = 1; } + else if (chr == _box_table(2, 10)) //rdhs + { lines[0] = 1; lines[2] = lines[3] = 2; } + else if (chr == _box_table(3, 10)) //rshd + { lines[0] = 2; lines[2] = lines[3] = 1; } + + else if (chr == _box_table(2, 5)) //ldds + { lines[1] = 1; lines[2] = 2; } + else if (chr == _box_table(3, 5)) //lsdd + { lines[1] = 2; lines[2] = 1; } + else if (chr == _box_table(2, 12)) //vdds + { lines[0] = lines[1] = 1; lines[2] = 2; } + else if (chr == _box_table(3, 12)) //vsdd + { lines[0] = lines[1] = 2; lines[2] = 1; } + else if (chr == _box_table(2, 7)) //rdds + { lines[0] = 1; lines[2] = 2; } + else if (chr == _box_table(3, 7)) //rsdd + { lines[0] = 2; lines[2] = 1; } +} + + +// ------------------------------------------------------------------ + +static char LinesToChr(byte lines[4]) +{ + if (lines[0] == 0) + { if (lines[1] == 0) + { if (lines[2] == 0) + { if (lines[3] == 1) return _box_table(0, 3); //vs + if (lines[3] == 2) return _box_table(1, 3); //vd + } else if (lines[2] == 1) + { if (lines[3] == 0) return _box_table(0, 3); //vs + if (lines[3] == 1) return _box_table(0, 3); //vs + } else if (lines[2] == 2) + { if (lines[3] == 0) return _box_table(1, 3); //vd + if (lines[3] == 2) return _box_table(1, 3); //vd + } + } else if (lines[1] == 1) + { if (lines[2] == 0) + { if (lines[3] == 0) return _box_table(0, 1); //hs + if (lines[3] == 1) return _box_table(0, 0); //lsus + if (lines[3] == 2) return _box_table(2, 0); //ldus + } else if (lines[2] == 1) + { if (lines[3] == 0) return _box_table(0, 5); //lsds + if (lines[3] == 1) return _box_table(0, 9); //lshs + } else if (lines[2] == 2) + { if (lines[3] == 0) return _box_table(2, 5); //ldds + if (lines[3] == 2) return _box_table(2, 9); //ldhs + } + } else if (lines[1] == 2) + { if (lines[2] == 0) + { if (lines[3] == 0) return _box_table(1, 1); //hd + if (lines[3] == 1) return _box_table(3, 0); //lsud + if (lines[3] == 2) return _box_table(1, 0); //ldud + } else if (lines[2] == 1) + { if (lines[3] == 0) return _box_table(3, 5); //lsdd + if (lines[3] == 1) return _box_table(3, 9); //lshd + } else if (lines[2] == 2) + { if (lines[3] == 0) return _box_table(1, 5); //lddd + if (lines[3] == 2) return _box_table(1, 9); //ldhd + } + } + } else if (lines[0] == 1) + { if (lines[1] == 0) + { if (lines[2] == 0) + { if (lines[3] == 0) return _box_table(0, 1); //hs + if (lines[3] == 1) return _box_table(0, 2); //rsus + if (lines[3] == 2) return _box_table(2, 2); //rdus + } else if (lines[2] == 1) + { if (lines[3] == 0) return _box_table(0, 7); //rsds + if (lines[3] == 1) return _box_table(0, 10); //rshs + } else if (lines[2] == 2) + { if (lines[3] == 0) return _box_table(2, 7); //rdds + if (lines[3] == 2) return _box_table(2, 10); //rdhs + } + } else if (lines[1] == 1) + { if (lines[2] == 0) + { if (lines[3] == 0) return _box_table(0, 1); //hs + if (lines[3] == 1) return _box_table(0, 11); //vsus + if (lines[3] == 2) return _box_table(2, 11); //vdus + } else if (lines[2] == 1) + { if (lines[3] == 0) return _box_table(0, 12); //vsds + if (lines[3] == 1) return _box_table(0, 8); //vshs + } else if (lines[2] == 2) + { if (lines[3] == 0) return _box_table(2, 12); //vdds + if (lines[3] == 2) return _box_table(2, 8); //vdhs + } + } + } else if (lines[0] == 2) + { if (lines[1] == 0) + { if (lines[2] == 0) + { if (lines[3] == 0) return _box_table(1, 1); //hd + if (lines[3] == 1) return _box_table(3, 2); //rsud + if (lines[3] == 2) return _box_table(1, 2); //rdud + } else if (lines[2] == 1) + { if (lines[3] == 0) return _box_table(3, 7); //rsdd + if (lines[3] == 1) return _box_table(3, 10); //rshd + } else if (lines[2] == 2) + { if (lines[3] == 0) return _box_table(1, 7); //rddd + if (lines[3] == 2) return _box_table(1, 10); //rdhd + } + } else if (lines[1] == 2) + { if (lines[2] == 0) + { if (lines[3] == 0) return _box_table(1, 1); //hd + if (lines[3] == 1) return _box_table(3, 11); //vsud + if (lines[3] == 2) return _box_table(1, 11); //vdud + } else if (lines[2] == 1) + { if (lines[3] == 0) return _box_table(3, 12); //vsdd + if (lines[3] == 1) return _box_table(3, 8); //vshd + } else if (lines[2] == 2) + { if (lines[3] == 0) return _box_table(1, 12); //vddd + if (lines[3] == 2) return _box_table(1, 8); //vdhd + } + } + } + + return 0x20; +} + + +// ------------------------------------------------------------------ + +void IEclass::DrawLines(gkey key) +{ + GFTRK("EditDrawLines"); + + static byte lines[4]; + static int drawx; + static int drawy; + + byte type1 = 1; + byte type2 = 1; + + (drawlines == 1) ? type2 = 2 : type1 = 2; + + //------------------------- + if (drawflag || chartyped) + { + ChrToLines(currline->txt[col], lines); + + switch (key) + { + case KK_EditGoRight: + drawx = -1; drawy = 0; + + if ((lines[0] == type1) || (!lines[0] && (lines[2] || lines[3]))) + drawx++; + else if ((lines[0] == type2) || (lines[1] == type2)) + { + drawx++; lines[0] = lines[1] = 0; + } + + break; + + case KK_EditGoLeft: + drawx = +1; drawy = 0; + + if ((lines[1] == type1) || (!lines[1] && (lines[2] || lines[3]))) + drawx--; + else if ((lines[0] == type2) || (lines[1] == type2)) + { + drawx--; lines[0] = lines[1] = 0; + } + + break; + + case KK_EditGoDown: + drawx = 0; drawy = -1; + + if ((lines[2] == type1) || (!lines[2] && (lines[0] || lines[1]))) + drawy++; + else if ((lines[2] == type2) || (lines[3] == type2)) + { + drawy++; lines[2] = lines[3] = 0; + } + + break; + + case KK_EditGoUp: + drawx = 0; drawy = +1; + + if ((lines[3] == type1) || (!lines[3] && (lines[0] || lines[1]))) + drawy--; + else if ((lines[2] == type2) || (lines[3] == type2)) + { + drawy--; lines[2] = lines[3] = 0; + } + + break; + } + + drawflag = false; + } + + //------------------------- + bool gonext = true; + + switch (key) + { + case KK_EditGoRight: + if (col >= (maxcol-1)) { lines[1] = 0; gonext = false; } + + if (!drawx && gonext) + { + drawx = -1; lines[1] = type1; + if (lines[0] == type2) lines[0] = 0; + } + else if (drawx == 1) drawx = -1; + else if (drawx == -1) + { + gonext = false; + drawx++; lines[0] = type1; + if (lines[1] == type2) lines[1] = 0; + } + + if (gonext && drawy) + { + if (drawy == -1) + { + drawy++; lines[2] = type1; + lines[0] = lines[3] = 0; + } + else //(drawy == 1) + { + drawy--; lines[3] = type1; + lines[0] = lines[2] = 0; + } + } + break; + + case KK_EditGoLeft: + if (col <= mincol) { lines[0] = 0; gonext = false; } + + if (!drawx && gonext) + { + drawx = 1; lines[0] = type1; + if (lines[1] == type2) lines[1] = 0; + } + else if (drawx == -1) drawx = 1; + else if (drawx == 1) + { + gonext = false; + drawx--; lines[1] = type1; + if (lines[0] == type2) lines[0] = 0; + } + + if (gonext && drawy) + { + if (drawy == -1) + { + drawy++; lines[2] = type1; + lines[1] = lines[3] = 0; + } + else //(drawy == 1) + { + drawy--; lines[3] = type1; + lines[1] = lines[2] = 0; + } + } + break; + + case KK_EditGoDown: + if (!currline->next) { lines[3] = 0; gonext = false; } + + if (!drawy && gonext) + { + drawy = -1; lines[3] = type1; + if (lines[2] == type2) lines[2] = 0; + } + else if (drawy == 1) drawy = -1; + else if (drawy == -1) + { + gonext = false; + drawy++; lines[2] = type1; + if (lines[3] == type2) lines[3] = 0; + } + + if (gonext && drawx) + { + if (drawx == -1) + { + drawx++; lines[0] = type1; + lines[1] = lines[2] = 0; + } + else //(drawx == 1) + { + drawx--; lines[1] = type1; + lines[0] = lines[2] = 0; + } + } + break; + + case KK_EditGoUp: + if (!currline->prev) { lines[2] = 0; gonext = false; } + + if (!drawy && gonext) + { + drawy = 1; lines[2] = type1; + if (lines[3] == type2) lines[3] = 0; + } + else if (drawy == -1) drawy = 1; + else if (drawy == 1) + { + gonext = false; + drawy--; lines[3] = type1; + if (lines[2] == type2) lines[2] = 0; + } + + if (gonext && drawx) + { + if (drawx == -1) + { + drawx++; lines[0] = type1; + lines[1] = lines[3] = 0; + } + else //(drawx == 1) + { + drawx--; lines[1] = type1; + lines[0] = lines[3] = 0; + } + } + break; + } + + //------------------------- + char new_chr = LinesToChr(lines); + + if (new_chr != currline->txt[col]) + { + if (col < (currline->txt.length()-1)) + { + Undo->PushItem(EDIT_UNDO_OVR_CHAR); + currline->txt[col] = new_chr; + } + else if (col < maxcol) + { + Undo->PushItem(EDIT_UNDO_INS_CHAR); + currline->txt.insert(col, 1, new_chr); + } + + setlinetype(currline); + displine(currline, row); + } + + //------------------------- + if (gonext) + { + switch (key) + { + case KK_EditGoRight: GoRight(); break; + case KK_EditGoLeft: GoLeft(); break; + default: + (key == KK_EditGoDown) ? GoDown() : GoUp(); + if (col < pcol) + { + size_t len = pcol - col; + Undo->PushItem(EDIT_UNDO_INS_TEXT|BATCH_MODE, currline, col, len); + currline->txt.insert(col, len, ' '); + GoEOL(); + } + break; + } + + gotorowcol(col, row); + ChrToLines(currline->txt[col], lines); + + switch (key) + { + case KK_EditGoRight: + if ((drawx == -1) && (lines[0] == type1)) drawx++; + break; + case KK_EditGoLeft: + if ((drawx == +1) && (lines[1] == type1)) drawx--; + break; + case KK_EditGoDown: + if ((drawy == -1) && (lines[2] == type1)) drawy++; + break; + case KK_EditGoUp: + if ((drawy == +1) && (lines[3] == type1)) drawy--; + break; + } + } + + GFTRK(NULL); +} + + // ------------------------------------------------------------------ void IEclass::Header() { diff --git a/golded3/gekeys.h b/golded3/gekeys.h index 0f26d8e..0f623d3 100644 --- a/golded3/gekeys.h +++ b/golded3/gekeys.h @@ -184,6 +184,7 @@ const gkey KK_EditSCodeReverse = 0xFF0C; #if defined(__GOLD_SPELL__) const gkey KK_EditSCheckerMenu = 0xFF0D; #endif +const gkey KK_EditDrawLines = 0xFF0E; const gkey KK_FileAbort = 0xFF10; const gkey KK_FileAskExit = 0xFF11; diff --git a/golded3/gelang.h b/golded3/gelang.h index 4516083..3253b50 100644 --- a/golded3/gelang.h +++ b/golded3/gelang.h @@ -387,6 +387,8 @@ struct LangGed { char* EscOrContinue; // ST_ESCORCONTINUE char* SpellChecker; // MS_SPELLCHECKER char* Ins; // WT_INS + char* DrawSL; // WT_DRAWSL + char* DrawDL; // WT_DRAWDL char* FilelistFrom; // MI_FILELISTFROM char* Initializing; // ST_INITIALIZING char* Checking; // ST_CHECKING