From 6221a7dd6dcac3771fa8b41e42f55ec04c772f0b Mon Sep 17 00:00:00 2001 From: Crimson Date: Thu, 20 Jun 2024 22:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8C=BA=E5=88=86=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=86=99=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++-- dlg/searchForm.aardio | 9 +++++---- main.aardio | 30 ++++++++++++++++++++---------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 0284930..502acee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ -# TabEditor-- +

+ +

+

TabEditor++ - 制表符分隔的文本数据编辑工具

+ + -制表符分隔数据的txt文本编辑器 \ No newline at end of file diff --git a/dlg/searchForm.aardio b/dlg/searchForm.aardio index 2238ffe..75da615 100644 --- a/dlg/searchForm.aardio +++ b/dlg/searchForm.aardio @@ -5,9 +5,10 @@ winform.add( btnSearchNext={cls="button";text="查找下一个(F)";left=218;top=83;right=306;bottom=113;db=1;dl=1;font=LOGFONT(name='微软雅黑');z=1}; btnSearchPrev={cls="button";text="查找下上个(V)";left=119;top=83;right=207;bottom=113;db=1;dl=1;font=LOGFONT(name='微软雅黑');z=2}; button={cls="button";text="关闭";left=327;top=82;right=386;bottom=112;db=1;dl=1;font=LOGFONT(name='微软雅黑');z=4}; -checkbox={cls="checkbox";text="单元格匹配";left=16;top=86;right=108;bottom=113;bgcolor=16777215;checked=1;font=LOGFONT(h=-14);z=6}; -editSearchInput={cls="combobox";left=81;top=28;right=392;bottom=54;db=1;dl=1;edge=1;font=LOGFONT(name='微软雅黑');items={};mode="dropdown";z=3}; -static={cls="static";text="查找内容:";left=12;top=29;right=72;bottom=55;align="right";bgcolor=16777215;center=1;db=1;dl=1;font=LOGFONT(name='微软雅黑');transparent=1;z=5} +checkbox={cls="checkbox";text="区分大小写";left=19;top=60;right=111;bottom=87;bgcolor=16777215;font=LOGFONT(h=-14);z=6}; +checkbox2={cls="checkbox";text="单元格匹配";left=19;top=92;right=111;bottom=119;bgcolor=16777215;font=LOGFONT(h=-14);z=7}; +editSearchInput={cls="combobox";left=81;top=15;right=392;bottom=41;db=1;dl=1;edge=1;font=LOGFONT(name='微软雅黑');items={};mode="dropdown";z=3}; +static={cls="static";text="查找内容:";left=12;top=16;right=72;bottom=42;align="right";bgcolor=16777215;center=1;db=1;dl=1;font=LOGFONT(name='微软雅黑');transparent=1;z=5} ) /*}}*/ @@ -37,7 +38,7 @@ winform.onCancel = function(){ } pushSearchNext = function(){ - publish("search_next", winform.editSearchInput.text, winform.checkbox.checked); + publish("search_next", winform.editSearchInput.text, winform.checkbox.checked, winform.checkbox2.checked); } winform.onOk = function(){ diff --git a/main.aardio b/main.aardio index ae18e86..ac7a132 100644 --- a/main.aardio +++ b/main.aardio @@ -344,7 +344,6 @@ mainForm.popmenuRight.add('删除列',function(id){ mainForm.release(); } ) - mainForm.g_flexcell.onMouseUp = function(Button , Shift, x, y){ /*** 鼠标按键放开。 Button 当前按下的鼠标按钮:1:左按钮;2:右按钮;4:中间按钮;同时按下时执行位或操作。 @@ -389,7 +388,7 @@ var accelerator = win.ui.accelerator({ },mainForm ); research_flag = true; -searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCellMatching){ +searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCaseSensitive, isCellMatching){ if(isRangeSearch){// 从一个范围开始搜索 var tempRow = firstRow; var tempCol = firstCol; @@ -406,8 +405,13 @@ searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRange if (i == pre_searched_row and i2 == pre_searched_col){ continue; } + var currStr = v[v2]; + if(!isCaseSensitive){ + currStr = string.lower(currStr); + searchContent = string.lower(searchContent); + } if (isCellMatching){ - if(v[v2] == searchContent){ + if(currStr == searchContent){ research_flag = true; pre_searched_row = i; pre_searched_col = i2; @@ -415,7 +419,7 @@ searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRange } } else { - if(string.find(v[v2], searchContent)){ + if(string.find(currStr, searchContent)){ research_flag = true; pre_searched_row = i; pre_searched_col = i2; @@ -431,7 +435,7 @@ searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRange research_flag = false; pre_searched_row = null; pre_searched_col = null; - row, col = searchNextContent(data, selFirstRow, selFirstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCellMatching); + row, col = searchNextContent(data, selFirstRow, selFirstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCaseSensitive, isCellMatching); return row, col; } research_flag = true; @@ -448,14 +452,19 @@ searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRange if(i == firstRow and i2 == firstCol){ continue; } + var currStr = v[v2]; + if(!isCaseSensitive){ + currStr = string.lower(currStr); + searchContent = string.lower(searchContent); + } if (isCellMatching){ - if(v[v2] == searchContent){ + if(currStr == searchContent){ research_flag = true; return i, i2; } } else { - if(string.find(v[v2], searchContent)){ + if(string.find(currStr, searchContent)){ research_flag = true; return i, i2; } @@ -466,7 +475,7 @@ searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRange // 搜不到了,重头搜索 if(research_flag){ research_flag = false; - row, col = searchNextContent(data, 1, 1, 1, 1, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCellMatching); + row, col = searchNextContent(data, 1, 1, 1, 1, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCaseSensitive, isCellMatching); return row, col; } research_flag = true; @@ -482,7 +491,8 @@ subscribe("search_prev",function(...){ subscribe("search_next",function(...){ var args = {...}; var searchContent = args[1]; - var isCellMatching = args[2]; + var isCaseSensitive = args[2]; + var isCellMatching = args[3]; var curSelection = mainForm.g_flexcell.selection(); var firstRow = curSelection.FirstRow; var firstCol = curSelection.FirstCol; @@ -495,7 +505,7 @@ subscribe("search_next",function(...){ if(pre_searched_row != null and pre_searched_col != null){ mainForm.g_flexcell.Cell(pre_searched_row, pre_searched_col).BackColor = 0xffffff; } - var row, col = searchNextContent(mainForm.g_flexcell.getVlistData(), firstRow, firstCol, lastRow, lastCol, isRangeSearch, firstRow, firstCol, searchContent, isCellMatching); + var row, col = searchNextContent(mainForm.g_flexcell.getVlistData(), firstRow, firstCol, lastRow, lastCol, isRangeSearch, firstRow, firstCol, searchContent, isCaseSensitive, isCellMatching); //console.dump(row, col); if(row != null && col != null){ if(isRangeSearch){