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>
<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++仅适用于特定场景,小众应用。
## 📃 功能

View File

@ -1,5 +1,5 @@
<?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"/>
<folder name="资源文件" path="res" embed="true" local="false" ignored="false">
<file name="app.ico" path="res\app.ico" comment="res\app.ico"/>

View File

@ -264,86 +264,53 @@ class TeMenu{
};
this.init();
};
setCommandFunc = function(side, idx, func){
select(side) {
case 0 {
if (idx > 0 and idx <= #this.toolbars_left) {
var ctrl = winform['plus_left'+idx];
winform['plus_left'+idx].oncommand = func(ctrl);
}
else {
return false;
}
}
case 1 {
if (idx > 0 and idx <= #this.toolbars_right) {
var ctrl = winform['plus_right'+idx];
winform['plus_right'+idx].oncommand = func(ctrl);
}
else {
return false;
}
}
else {
return false;
}
}
};
setRightClickFunc = function(side, idx, func){
select(side) {
case 0 {
if (idx > 0 and idx <= #this.toolbars_left) {
var ctrl = winform['plus_left'+idx];
winform['plus_left'+idx].wndproc = function(hwnd,message,wParam,lParam){
if (message == 0x205/*_WM_RBUTTONUP*/) {
func(ctrl);
}
}
}
else {
return false;
}
}
case 1 {
if (idx > 0 and idx <= #this.toolbars_right) {
var ctrl = winform['plus_right'+idx];
winform['plus_right'+idx].wndproc = function(hwnd,message,wParam,lParam){
if (message == 0x205/*_WM_RBUTTONUP*/) {
func(ctrl);
}
}
}
else {
return false;
}
}
else {
return false;
}
getSid = function(side, idx) {
var std = {};
if (side == 0) {
std.sd = "plus_left";
std.n = #this.toolbars_left;
} else {
std.sd = "plus_right";
std.n = #this.toolbars_right;
}
if (idx > 0 && idx <= std.n) {
std.ctrl = winform[std.sd ++ idx];
return std;
}
return;
}
setCommandFunc = function(side, idx, func) {
var std = this.getSid(side, idx);
if (std) {
std.ctrl.oncommand = func(std.ctrl);
} else {
return;
}
}
setRightClickFunc = function(side, idx, func) {
var std = this.getSid(side, idx);
if (std) {
std.ctrl.wndproc = function(hwnd, message, wParam, lParam) {
if (message == 0x205 /*_WM_RBUTTONUP*/) {
func(std.ctrl);
}
}
} else {
return;
}
}
disabled = function(side, idx, status) {
var std = this.getSid(side, idx);
if (std) {
std.ctrl.disabled = status;
} else {
return;
}
}
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 teMenu;
/*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(
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;};
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}
)
/*}}*/
@ -26,6 +25,7 @@ mainForm.release = function(){
collectgarbage("collect");
}
var frmChild = mainForm.loadForm("\dlg\searchForm.aardio");
var g_mainform_text_default = mainForm.text;
//菜单控件初始化
g_teMenus = teMenu.TeMenu(mainForm.plus);
@ -81,6 +81,7 @@ g_teMenus.openFile = function(ctrl){
return function(){
var t = teUtils.getTxtTableData();
if(t){
mainForm.text = g_mainform_text_default;
mainForm.text += "[ " + teUtils.getCurFilePath() + " ]";
g_teMenus.newFile();
mainForm.g_flexcell.AutoRedraw = false;
@ -93,6 +94,7 @@ g_teMenus.openFile = function(ctrl){
mainForm.g_flexcell.Refresh();
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;
searchNextContent = function(data, firstRow, firstCol, lastRow, lastCol, isRangeSearch, selFirstRow, selFirstCol, searchContent, isCaseSensitive, isCellMatching){
if(isRangeSearch){// 从一个范围开始搜索
@ -534,6 +523,31 @@ subscribe("search_next",function(...){
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;
win.ui.minmax(mainForm,860,400);