Compare commits

..

5 Commits
v0.10 ... main

4 changed files with 81 additions and 97 deletions

View File

@ -5,6 +5,9 @@
<p align="center"> <p align="center">
一个制表符分隔的文本数据编辑工具 一个制表符分隔的文本数据编辑工具
</p> </p>
<p align="center" style="color:red;"><strong>使用 FlexCell 控件,请支持正版:<a href="https://www.grid2000.com/cn/index.html">https://www.grid2000.com/cn/index.html</a></strong></p>
TabEditor++仅适用于特定场景,小众应用。 TabEditor++仅适用于特定场景,小众应用。
## 📃 功能 ## 📃 功能

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project ver="10" name="TabEditor++" libEmbed="true" icon="res\app.ico" ui="win" output="TabEditor++.exe" CompanyName="" FileDescription="TabEditor++" LegalCopyright="Copyright (C) iioio.com 2024" ProductName="TabEditor++" InternalName="TabEditor++" FileVersion="0.0.0.9" ProductVersion="0.0.0.9" publishDir="/dist/" dstrip="true" local="false" ignored="false"> <project ver="10" name="TabEditor++" libEmbed="true" icon="res\app.ico" ui="win" output="TabEditor++.exe" CompanyName="" FileDescription="TabEditor++" LegalCopyright="Copyright (C) iioio.com 2024" ProductName="TabEditor++" InternalName="TabEditor++" FileVersion="0.0.0.11" ProductVersion="0.0.0.11" publishDir="/dist/" dstrip="true" local="false" ignored="false">
<file name="main.aardio" path="main.aardio" comment="main.aardio"/> <file name="main.aardio" path="main.aardio" comment="main.aardio"/>
<folder name="资源文件" path="res" embed="true" local="false" ignored="false"> <folder name="资源文件" path="res" embed="true" local="false" ignored="false">
<file name="app.ico" path="res\app.ico" comment="res\app.ico"/> <file name="app.ico" path="res\app.ico" comment="res\app.ico"/>

View File

@ -264,86 +264,53 @@ class TeMenu{
}; };
this.init(); this.init();
}; };
setCommandFunc = function(side, idx, func){
select(side) { getSid = function(side, idx) {
case 0 { var std = {};
if (idx > 0 and idx <= #this.toolbars_left) { if (side == 0) {
var ctrl = winform['plus_left'+idx]; std.sd = "plus_left";
winform['plus_left'+idx].oncommand = func(ctrl); std.n = #this.toolbars_left;
} } else {
else { std.sd = "plus_right";
return false; std.n = #this.toolbars_right;
} }
}
case 1 { if (idx > 0 && idx <= std.n) {
if (idx > 0 and idx <= #this.toolbars_right) { std.ctrl = winform[std.sd ++ idx];
var ctrl = winform['plus_right'+idx]; return std;
winform['plus_right'+idx].oncommand = func(ctrl); }
} return;
else { }
return false;
} setCommandFunc = function(side, idx, func) {
} var std = this.getSid(side, idx);
else { if (std) {
return false; std.ctrl.oncommand = func(std.ctrl);
} } else {
} return;
}; }
setRightClickFunc = function(side, idx, func){ }
select(side) {
case 0 { setRightClickFunc = function(side, idx, func) {
if (idx > 0 and idx <= #this.toolbars_left) { var std = this.getSid(side, idx);
var ctrl = winform['plus_left'+idx]; if (std) {
winform['plus_left'+idx].wndproc = function(hwnd,message,wParam,lParam){ std.ctrl.wndproc = function(hwnd, message, wParam, lParam) {
if (message == 0x205/*_WM_RBUTTONUP*/) { if (message == 0x205 /*_WM_RBUTTONUP*/) {
func(ctrl); func(std.ctrl);
} }
} }
} } else {
else { return;
return false; }
} }
}
case 1 { disabled = function(side, idx, status) {
if (idx > 0 and idx <= #this.toolbars_right) { var std = this.getSid(side, idx);
var ctrl = winform['plus_right'+idx]; if (std) {
winform['plus_right'+idx].wndproc = function(hwnd,message,wParam,lParam){ std.ctrl.disabled = status;
if (message == 0x205/*_WM_RBUTTONUP*/) { } else {
func(ctrl); return;
} }
} }
}
else {
return false;
}
}
else {
return false;
}
}
}
disabled = function(side, idx, status){
select(side) {
case 0 {
if (idx > 0 and idx <= #this.toolbars_left) {
winform['plus_left'+idx].disabled = status;
}
else {
return false;
}
}
case 1 {
if (idx > 0 and idx <= #this.toolbars_right) {
winform['plus_right'+idx].disabled = status;
}
else {
return false;
}
}
else {
return false;
}
}
};
} }

View File

@ -10,11 +10,10 @@ import flexcell;
import teUtils; import teUtils;
import teMenu; import teMenu;
/*DSG{{*/ /*DSG{{*/
var mainForm = win.form(text="TabEditor++";right=1399;bottom=799;bgcolor=16777215;) var mainForm = win.form(text="TabEditor++";right=1399;bottom=799;bgcolor=16777215)
mainForm.add( mainForm.add(
custom={cls="custom";text="自定义控件";left=0;top=36;right=1400;bottom=800;ah=1;aw=1;bgcolor=12639424;db=1;dl=1;dr=1;dt=1;z=2;}; custom={cls="custom";text="自定义控件";left=0;top=36;right=1400;bottom=800;ah=1;aw=1;bgcolor=12639424;db=1;dl=1;dr=1;dt=1;z=2};
plus={cls="plus";left=0;top=0;right=1400;bottom=36;bgcolor=16777215;border={left=1;top=1;right=1;color=-6250332;};clipBk=false;clipch=1;dl=1;dr=1;dt=1;font=LOGFONT(h=-18);forecolor=16777215;notify=1;repeat="stretch";z=1;}; plus={cls="plus";left=0;top=0;right=1400;bottom=36;bgcolor=16777215;border={left=1;top=1;right=1;color=-6250332};clipBk=false;clipch=1;dl=1;dr=1;dt=1;font=LOGFONT(h=-18);forecolor=16777215;notify=1;repeat="stretch";z=1}
) )
/*}}*/ /*}}*/
@ -26,6 +25,7 @@ mainForm.release = function(){
collectgarbage("collect"); collectgarbage("collect");
} }
var frmChild = mainForm.loadForm("\dlg\searchForm.aardio"); var frmChild = mainForm.loadForm("\dlg\searchForm.aardio");
var g_mainform_text_default = mainForm.text;
//菜单控件初始化 //菜单控件初始化
g_teMenus = teMenu.TeMenu(mainForm.plus); g_teMenus = teMenu.TeMenu(mainForm.plus);
@ -81,6 +81,7 @@ g_teMenus.openFile = function(ctrl){
return function(){ return function(){
var t = teUtils.getTxtTableData(); var t = teUtils.getTxtTableData();
if(t){ if(t){
mainForm.text = g_mainform_text_default;
mainForm.text += "[ " + teUtils.getCurFilePath() + " ]"; mainForm.text += "[ " + teUtils.getCurFilePath() + " ]";
g_teMenus.newFile(); g_teMenus.newFile();
mainForm.g_flexcell.AutoRedraw = false; mainForm.g_flexcell.AutoRedraw = false;
@ -93,6 +94,7 @@ g_teMenus.openFile = function(ctrl){
mainForm.g_flexcell.Refresh(); mainForm.g_flexcell.Refresh();
collectgarbage("collect"); collectgarbage("collect");
collectgarbage("collect"); collectgarbage("collect");
showModifyStyle();
} }
} }
} }
@ -376,19 +378,6 @@ mainForm.g_flexcell.onSelChange = function(FirstRow,FirstCol,LastRow,LastCol){
} }
/*}}*/ /*}}*/
//搜索窗口
var openSearchForm = function(){
frmChild.show();
frmChild.editSearchInput.setFocus();
}
var accelerator = win.ui.accelerator({
{
ctrl = true; vkey = 'F'#;
oncommand = function() openSearchForm();
};
},mainForm );
research_flag = true; research_flag = true;
searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCaseSensitive, isCellMatching){ searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCaseSensitive, isCellMatching){
if(isRangeSearch){// 从一个范围开始搜索 if(isRangeSearch){// 从一个范围开始搜索
@ -534,6 +523,31 @@ subscribe("search_next",function(...){
curSelection.release(); curSelection.release();
} ) } )
//搜索窗口
var openSearchForm = function(){
frmChild.show();
frmChild.editSearchInput.setFocus();
}
var accelerator = win.ui.accelerator({
{
ctrl = true; vkey = 'F'#;
oncommand = function() openSearchForm();
};
{
ctrl = true; vkey = 'S'#;
oncommand = function(){
var curRow = mainForm.g_flexcell.ActiveCell().Row;
var curCol = mainForm.g_flexcell.ActiveCell().Col;
mainForm.g_flexcell.Cell(curRow, curCol).SetFocus(); // 不加这个,光标处于的单元格内容不会被保存----规避方案
teUtils.saveTxtTableData(mainForm.g_flexcell.getVlistData());
showUnmodifyStyle();
};
};
},mainForm );
import win.ui.minmax; import win.ui.minmax;
win.ui.minmax(mainForm,860,400); win.ui.minmax(mainForm,860,400);