Skip to content

Commit

Permalink
modified watchWin bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
YrracOwl committed Jul 12, 2024
1 parent 6d1498e commit ce8ce25
Show file tree
Hide file tree
Showing 9 changed files with 550 additions and 327 deletions.
3 changes: 2 additions & 1 deletion default.aproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<project ver="10" name="ChiikawaBest" libEmbed="true" icon="res\chiikawaIcon.ico" ui="win" output="ChiikawaBest.exe" CompanyName="CarryWho" FileDescription="ChiikawaBest" LegalCopyright="Copyright (C) CarryWho 2023" ProductName="ChiikawaBest" InternalName="ChiikawaBest" FileVersion="1.2.3.1" ProductVersion="1.2.3.1" publishDir="/dist/" dstrip="true" local="false" ignored="false">
<project ver="10" name="ChiikawaBest" libEmbed="true" icon="res\chiikawaIcon.ico" ui="win" output="ChiikawaBest.exe" CompanyName="CarryWho" FileDescription="ChiikawaBest" LegalCopyright="Copyright (C) CarryWho 2023" ProductName="ChiikawaBest" InternalName="ChiikawaBest" FileVersion="1.2.3.3" ProductVersion="1.2.3.3" 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="chiikawa.png" path="res\chiikawa.png" comment="res\chiikawa.png"/>
Expand Down Expand Up @@ -52,6 +52,7 @@
<file name="chatWin.aardio" path="dlg\chatWin.aardio" comment="dlg\chatWin.aardio"/>
<file name="publish.aardio" path="dlg\publish.aardio" comment="dlg\publish.aardio"/>
<file name="hotkeys.aardio" path="dlg\hotkeys.aardio" comment="dlg\hotkeys.aardio"/>
<file name="watchWinStandalone.aardio" path="dlg\watchWinStandalone.aardio" comment="dlg\watchWinStandalone.aardio"/>
</folder>
<folder name="html_crawler" path="html_crawler" comment="html_crawler" local="false" embed="false" ignored="false">
<file name="halo.carrywho.com.html" path="html_crawler\halo.carrywho.com.html" comment="html_crawler\halo.carrywho.com.html"/>
Expand Down
23 changes: 11 additions & 12 deletions dlg/apps_setting.aardio
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import win.ui;
/*DSG{{*/
var winform = win.form(text="应用设置";right=447;bottom=207;clipch=1)
var winform = win.form(text="应用设置";right=447;bottom=207;clipch=1;)
winform.add(
btnRestore={cls="button";text="恢复默认链接";left=80;top=152;right=176;bottom=176;dl=1;dt=1;flat=1;z=8};
localPort={cls="edit";text="9090";left=104;top=128;right=176;bottom=152;dl=1;dt=1;edge=1;z=10};
static={cls="static";text="更新地址:";left=8;top=152;right=80;bottom=176;center=1;dl=1;dt=1;transparent=1;z=7};
static2={cls="static";text="本地服务端口:";left=8;top=128;right=104;bottom=152;center=1;dl=1;dt=1;transparent=1;z=9};
urlSetting={cls="edit";text="https://raw.githubusercontent.com/YrracOwl/ChiikawaBest/master/release/ChiikawaBest.exe";left=8;top=176;right=440;bottom=200;dl=1;dt=1;edge=1;z=6};
关闭时清空记录={cls="checkbox";text="关闭时清空记录 (即时生效)";left=8;top=8;right=440;bottom=32;dl=1;dt=1;z=1};
启动到托盘={cls="checkbox";text="启动时最小化到托盘";left=8;top=32;right=440;bottom=56;dl=1;dt=1;z=2};
启动时检测更新={cls="checkbox";text="启动时检测更新";left=8;top=56;right=440;bottom=80;dl=1;dt=1;z=3};
启动时监控应用={cls="checkbox";text="启动时监控应用";left=8;top=80;right=440;bottom=104;dl=1;dt=1;z=4};
模拟移动端渲染={cls="checkbox";text="模拟移动端渲染";left=8;top=104;right=440;bottom=128;checked=1;dl=1;dt=1;z=5}
btnRestore={cls="button";text="恢复默认链接";left=80;top=128;right=176;bottom=152;dl=1;dt=1;flat=1;z=7;};
localPort={cls="edit";text="9090";left=104;top=104;right=176;bottom=128;dl=1;dt=1;edge=1;z=9;};
static={cls="static";text="更新地址:";left=8;top=128;right=80;bottom=152;center=1;dl=1;dt=1;transparent=1;z=6;};
static2={cls="static";text="本地服务端口:";left=8;top=104;right=104;bottom=128;center=1;dl=1;dt=1;transparent=1;z=8;};
urlSetting={cls="edit";text="https://raw.githubusercontent.com/YrracOwl/ChiikawaBest/master/release/ChiikawaBest.exe";left=8;top=152;right=440;bottom=176;dl=1;dt=1;edge=1;z=5;};
关闭时清空记录={cls="checkbox";text="关闭时清空记录 (即时生效)";left=8;top=8;right=440;bottom=32;dl=1;dt=1;z=1;};
启动到托盘={cls="checkbox";text="启动时最小化到托盘";left=8;top=32;right=440;bottom=56;dl=1;dt=1;z=2;};
启动时监控应用={cls="checkbox";text="启动时监控应用";left=8;top=56;right=440;bottom=80;dl=1;dt=1;z=3;};
模拟移动端渲染={cls="checkbox";text="模拟移动端渲染";left=8;top=80;right=440;bottom=104;checked=1;dl=1;dt=1;z=4;};

)
/*}}*/

winform.bindConfig( ..cfg.apps_setting,{
checkbox = {
["启动到托盘"] = "checked";
["启动时检测更新"] = "checked";
["启动时监控应用"] = "checked";
["模拟移动端渲染"] = "checked";
};
Expand Down
20 changes: 13 additions & 7 deletions dlg/watchWin.aardio
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import fonts.fontAwesome;
import win.ui;
/*DSG{{*/
var winform = win.form(text="截图";right=199;bottom=99;border="none")
var winform = win.form(text="截图";right=199;bottom=99;border="none";)
winform.add(
plusPreview={cls="plus";left=2;top=32;right=198;bottom=98;clipBk=false;db=1;dl=1;dr=1;dt=1;foreRepeat="scale";notify=1;repeat="scale";z=1};
保存={cls="plus";text="保存";left=175;top=5;right=225;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=5};
反色={cls="plus";text="反色";left=63;top=5;right=113;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=3};
复制={cls="plus";text="复制";left=119;top=5;right=169;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=4};
截图={cls="plus";text="截图";left=7;top=5;right=57;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=2}
plusPreview={cls="plus";left=2;top=32;right=198;bottom=98;clipBk=false;db=1;dl=1;dr=1;dt=1;foreRepeat="scale";notify=1;repeat="scale";z=1;};
保存={cls="plus";text="保存";left=175;top=5;right=225;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=5;};
反色={cls="plus";text="反色";left=64;top=5;right=113;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=3;};
复制={cls="plus";text="复制";left=119;top=5;right=169;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=4;};
截图={cls="plus";text="截图";left=7;top=5;right=57;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=2;};

)
/*}}*/

Expand Down Expand Up @@ -176,12 +178,16 @@ winform.onClose = function(hwnd,message,wParam,lParam){

winform.width = 400;
winform.height = 400;
win.setTopmost(winform.hwnd,true)
//win.setTopmost(winform.hwnd,true)
winform.show();

winform.doTop = function(){
win.setTopmost(winform.hwnd,true);
}

winform.undoTop = function(){
win.setTopmost(winform.hwnd,false);
}

win.loopMessage();
return winform;
195 changes: 195 additions & 0 deletions dlg/watchWinStandalone.aardio
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
import fonts.fontAwesome;
import win.ui;
/*DSG{{*/
var winform = win.form(text="截图";right=199;bottom=99;border="none";)
winform.add(
plusPreview={cls="plus";left=2;top=32;right=198;bottom=98;clipBk=false;db=1;dl=1;dr=1;dt=1;foreRepeat="scale";notify=1;repeat="scale";z=1;};
保存={cls="plus";text="保存";left=175;top=5;right=225;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=5;};
反色={cls="plus";text="反色";left=64;top=5;right=113;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=3;};
复制={cls="plus";text="复制";left=119;top=5;right=169;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=4;};
截图={cls="plus";text="截图";left=7;top=5;right=57;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=2;};

)
/*}}*/

import fsys.dlg;
import soImage;

winform.截图.skin({
background={
default=0x668FB2B0;
disabled=0xFFCCCCCC;
hover=0xFF928BB3
};
color={
default=0xFF000000;
disabled=0xFF6D6D6D
}
})

winform.反色.skin({
background={
default=0x668FB2B0;
disabled=0xFFCCCCCC;
hover=0xFF928BB3
};
color={
default=0xFF000000;
disabled=0xFF6D6D6D
}
})

winform.复制.skin({
background={
default=0x668FB2B0;
disabled=0xFFCCCCCC;
hover=0xFF928BB3
};
color={
default=0xFF000000;
disabled=0xFF6D6D6D
}
})

winform.保存.skin({
background={
default=0x668FB2B0;
disabled=0xFFCCCCCC;
hover=0xFF928BB3
};
color={
default=0xFF000000;
disabled=0xFF6D6D6D
}
})

winform.caller = null;

import win.region.hole;
var watchWin = win.region.hole(winform.plusPreview);

var imgCaptured = soImage();

import win.ui.simpleWindow3;
win.ui.simpleWindow(winform,,,,).skin(
background = {
hover = 0xff99ffcc;
active = 0xffff6666;
default = 0x00000000;
}
color = {
hover = 0xff666666;
active = 0xffffffff;
default = 0xFF7BA5BF;
}
)

winform.uiShow = function(){
winform.disableDragFullWindow = true;
winform.截图.text = "重截";
winform.反色.show(true);
winform.复制.show(true);
winform.保存.show(true);
watchWin.enable(false);
if(winform.width<400){
winform.width = 400;
}
}
winform.uiHide = function(){
winform.disableDragFullWindow = false;
winform.截图.text = "截图";
winform.反色.show(false);
winform.复制.show(false);
winform.保存.show(false);
watchWin.enable(true);
var old = winform.plusPreview.setForeground(null);
if(old){ old.dispose(); }
}

winform.uiHide();

winform.watchWinEn = true;
winform.截图.oncommand = function(id,event){
if(winform.watchWinEn){
winform.getHoleBmp();
winform.uiShow();
}
else {
winform.uiHide();
}
winform.watchWinEn = !winform.watchWinEn;
}

winform.getHoleBmp = function(){
var x,y,cx,cy = win.getPos(winform.plusPreview.hwnd,true);
imgCaptured.capture(,x,y,cx,cy,pointerSize);
winform.plusPreview.foreground = imgCaptured.getBytes("*.bmp");
}

winform.复制.oncommand = function(id,event){
imgCaptured.toClipBD();
if(winform.caller){
win.setForeground(winform.caller.hwnd);
winform.caller.图片预览.foreground = imgCaptured.getBytes("*.bmp");
winform.caller.show();
winform.close();
}
}

winform.保存.oncommand = function(id,event){
var savePath = fsys.dlg.saveOp("图像文件|*.bmp;*.png;*.jpg","保存图像",,,"temp.png");
if(savePath){
imgCaptured.save(savePath);
}
}

winform.反色.oncommand = function(id,event){
imgCaptured.negative();
winform.plusPreview.foreground = imgCaptured.getBytes("*.bmp");
}

winform.wndproc = function(hwnd,message,wParam,lParam){
select( message ) {
case 5/*_WM_SIZE*/{
winform.redrawBackground();
}
else{
}
}
//无返回值则继续调用默认回调函数
}

winform.plusPreview.wndproc = function(hwnd,message,wParam,lParam){
select( message ) {
case 0x201/*_WM_LBUTTONDOWN*/ {
winform.hitCaption();
}
else{
}
}
//无返回值则继续调用默认回调函数
}

winform.onClose = function(hwnd,message,wParam,lParam){
if(winform.caller){
win.setForeground(winform.caller.hwnd);
winform.caller.图片预览.foreground = imgCaptured.getBytes("*.bmp");
winform.caller.show();
};
imgCaptured.delete();
}

winform.width = 400;
winform.height = 400;
win.setTopmost(winform.hwnd,true)
winform.show();

winform.doTop = function(){
win.setTopmost(winform.hwnd,true);
}

winform.undoTop = function(){
win.setTopmost(winform.hwnd,false);
}

win.loopMessage();
Loading

0 comments on commit ce8ce25

Please sign in to comment.