Skip to content

Commit

Permalink
Merge pull request #23 from Nigh/v0_2_5-update
Browse files Browse the repository at this point in the history
V0.2.5 update
  • Loading branch information
Nigh authored Sep 27, 2023
2 parents 75ff3be + 70e0e8a commit 1237cb1
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 97 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ $RECYCLE.BIN/
dist/

*.ini

compile_prop.ahk
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ahk-compile-toolset"]
path = ahk-compile-toolset
url = https://github.com/Nigh/ahk-compile-toolset.git
1 change: 1 addition & 0 deletions ahk-compile-toolset
Submodule ahk-compile-toolset added at 1989c4
86 changes: 62 additions & 24 deletions app.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
SetWorkingDir(A_ScriptDir)
#SingleInstance force
#include meta.ahk
;@Ahk2Exe-SetName %appName%
;@Ahk2Exe-SetVersion %version%
;@Ahk2Exe-SetMainIcon icon.ico
;@Ahk2Exe-ExeName %appName%
#include *i compile_prop.ahk
;@Ahk2Exe-AddResource *10 %A_ScriptDir%\app_title.png

#include prod.ahk
Expand All @@ -22,11 +19,18 @@ OnExit(trueExit)
; ===============================================================
; ===============================================================
; your code below

if (A_IsCompiled) {
debugBorder := ""
} else {
debugBorder := "Border "
}
MonitorGet(1, &Left, &Top, &Right, &Bottom)
DPIScale := A_ScreenDPI / 96
DPIScaled(n) {
return Round(n*DPIScale)
return Round(n * DPIScale)
}
DPIScaledFont(n) {
return Round(n * (DPIScale ** 0.5))
}
Screen_Height := Bottom - Top
Screen_Width := Right - Left
Expand All @@ -36,6 +40,8 @@ loop 2
name: '',
pBitmap: -1,
exif: '',
fileSize: '',
picSize: '',
pBitmapShow: 0,
G: 0,
hBitmapShow: 0
Expand Down Expand Up @@ -67,39 +73,45 @@ mygui.Title := appName
myGui.OnEvent("Close", myGui_Close)
myGui.OnEvent("DropFiles", mygui_DropFiles)
if A_IsCompiled {
mygui.Add("Picture", "x" DPIScaled(10) " y" DPIScaled(10) " Section", "HBITMAP:" HBitmapFromResource("app_title.png"))
mygui.Add("Picture", debugBorder "x" DPIScaled(10) " y" DPIScaled(10) " h" DPIScaled(30) " w-1 Section", "HBITMAP:" HBitmapFromResource("app_title.png"))
} else {
mygui.Add("Picture", "x" DPIScaled(10) " y" DPIScaled(10) " Section", "app_title.png")
mygui.Add("Picture", debugBorder "x" DPIScaled(10) " y" DPIScaled(10) " h" DPIScaled(30) " w-1 Section", "app_title.png")
}

mygui.SetFont("s" DPIScaled(8) " Q5 bold", "Comic Sans MS")
mygui.SetFont("s" DPIScaledFont(8) " Q5 bold", "Comic Sans MS")
swapbtn := mygui.Add("Button", "xs y+5 h" DPIScaled(22) " w" DPIScaled(90), 'SWAP(s)')
swapbtn.OnEvent("Click", swap)

autoCenterSwitch := mygui.Add("Checkbox", "x+10 yp hp " autoCenter_default_check, 'Auto Center')
autoCenterSwitch := mygui.Add("Checkbox", debugBorder "x+10 yp hp " autoCenter_default_check, 'Auto Center')
autoCenterSwitch.OnEvent("Click", autoPosSwitch_cb)
backgroundSwitch := mygui.Add("Checkbox", "x+10 yp hp " runbackgroud_default_check, 'Runs in background')
backgroundSwitch := mygui.Add("Checkbox", debugBorder "x+10 yp hp " runbackgroud_default_check, 'Runs in background')
backgroundSwitch.OnEvent("Click", backgroundSwitch_cb)

mygui.SetFont("s" DPIScaled(10) " Q5 norm", "Comic Sans MS")
mygui.Add("Text", "xs y+0 h" DPIScaled(12), 'Current:')
txt_indicator := mygui.Add("Text", "x+10 yp hp w" DPIScaled(360), 'NULL')
mygui.SetFont("s" DPIScaledFont(10) " Q5 norm", "Comic Sans MS")
mygui.Add("Text", "Section xs y+0 h" DPIScaled(12), 'Current:')
mygui.Add("Text", "xs y+0 hp wp", 'EXIF:')

txt_indicator := mygui.Add("Text", debugBorder "Section x+10 ys hp w" DPIScaled(270), 'NULL')
txt_indicator.SetFont("cTeal bold")

mygui.Add("Text", "xs y+0 h" DPIScaled(12), 'EXIF:')
txt_exif := mygui.Add("Text", "x+10 yp hp w" DPIScaled(360), 'NULL')
picSize := mygui.Add("Text", debugBorder "Center x+2 yp hp", '0000000000')
picSize.SetFont("cOlive bold")
fileSize := mygui.Add("Text", debugBorder "Right x+5 yp hp w" DPIScaled(70), '0 kB')
fileSize.SetFont("cMaroon bold")

txt_exif := mygui.Add("Text", debugBorder "xs y+0 hp w" DPIScaled(270), 'NULL')
txt_exif.SetFont("cNavy bold")

picCurrentShow := 1
pic := mygui.Add("Picture", "x10 y+0 w" DPIScaled(500) " h" DPIScaled(400) " 0xE 0x200 0x800000 -0x40")
pic.OnEvent("Click", pic_on_click)
pic.OnEvent("DoubleClick", pic_on_click)

mygui.SetFont("s" DPIScaled(8) " Q5 Norm", "Comic Sans MS")
mygui.SetFont("s" DPIScaledFont(8) " Q5 Norm", "Comic Sans MS")
info := Array()
info.Push(mygui.Add("Text", "x" DPIScaled(420) " y" DPIScaled(12) " h0", "v" . version))
info.Push(mygui.Add("Link", "xp y+0 hp", 'bilibili: <a href="https://space.bilibili.com/895523">TecNico</a>'))
info.Push(mygui.Add("Link", "xp y+0 hp", 'GitHub: <a href="https://github.com/Nigh">xianii</a>'))
info.Push(mygui.Add("Text", debugBorder "x" DPIScaled(420) " y" DPIScaled(12) " h0", "v" . version))
info.Push(mygui.Add("Link", debugBorder "xp y+0 hp", 'bilibili: <a href="https://space.bilibili.com/895523">TecNico</a>'))
info.Push(mygui.Add("Link", debugBorder "xp y+0 hp", 'GitHub: <a href="https://github.com/Nigh">xianii</a>'))

if (setting_runbackgroud) {
mygui.Show("AutoSize Hide")
Expand Down Expand Up @@ -134,6 +146,28 @@ if (setting_runbackgroud) {
}
Return

shortFilename(name) {
if (StrLen(name) > 20) {
return SubStr(name, 1, 6) "..." SubStr(name, -9)
}
return name
}

sizeToStr(byte) {
if (byte < 1024) {
return byte "Bytes"
}
byte := Round(byte / 1024, 2)
if (byte < 1024) {
return byte "kB"
}
byte := Round(byte / 1024, 2)
if (byte < 1024) {
return byte "MB"
}
return "Inf"
}

copyCompare(GuiCtrlObj, info*) {
global mygui
A_Clipboard := ""
Expand Down Expand Up @@ -278,8 +312,10 @@ pic_ctrl_set_size() {

mygui_ctrl_show_pic(picture)
{
global txt_indicator, pic, mygui
txt_indicator.Text := picture.name
global txt_indicator, pic, mygui, fileSize, picSize
txt_indicator.Text := shortFilename(picture.name)
fileSize.Text := picture.fileSize
picSize.Text := picture.picSize
txt_exif.Text := picture.exif
SetImage(pic.hwnd, picture.hBitmapShow)
}
Expand All @@ -297,9 +333,9 @@ mygui_DropFiles(GuiObj, GuiCtrlObj, FileArray, X, Y) {
valid += 1
Loop Files, fullpath, "F" {
picCurrentShow := picCurrentShow ^ 0x3
exinfo := Filexpro(A_LoopFileFullPath, "", "System.Photo.Orientation", "System.Photo.FNumber", "System.Photo.ISOSpeed", "System.Photo.FocalLength", "System.Photo.ExposureTime", "System.Photo.ExposureTimeNumerator", "System.Photo.ExposureTimeDenominator", "xInfo")
exinfo := Filexpro(A_LoopFileFullPath, "", "System.Photo.Orientation", "System.Photo.FNumber", "System.Photo.ISOSpeed", "System.Photo.FocalLength", "System.Photo.ExposureTime", "System.Photo.ExposureTimeNumerator", "System.Photo.ExposureTimeDenominator", "System.Image.HorizontalSize", "System.Image.VerticalSize", "System.Size", "xInfo")
if (StrLen(exinfo["System.Photo.FocalLength"]) > 0) {
ex_focal := exinfo["System.Photo.FocalLength"] "mm"
ex_focal := Round(exinfo["System.Photo.FocalLength"]) "mm"
ex_apture := "F" Round(exinfo["System.Photo.FNumber"], 1)
ex_ISO := "ISO" exinfo["System.Photo.ISOSpeed"]
ex_exposure := ("0" exinfo["System.Photo.ExposureTime"]) + 0
Expand All @@ -322,6 +358,8 @@ mygui_DropFiles(GuiObj, GuiCtrlObj, FileArray, X, Y) {
picture_array[picCurrentShow].name := A_LoopFileName
picture_array[picCurrentShow].pBitmap := bitmap
picture_array[picCurrentShow].exif := exif
picture_array[picCurrentShow].fileSize := sizeToStr(exinfo["System.Size"])
picture_array[picCurrentShow].picSize := exinfo["System.Image.HorizontalSize"] "x" exinfo["System.Image.VerticalSize"]
}
}
}
Expand Down
Binary file removed binary/Ahk2Exe.exe
Binary file not shown.
Binary file removed binary/AutoHotkey64.exe
Binary file not shown.
Binary file removed binary/mpress.exe
Binary file not shown.
25 changes: 20 additions & 5 deletions distribution.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ SetWorkingDir(A_ScriptDir)

#include meta.ahk

try
{
props := FileOpen("compile_prop.ahk", "w")
props.WriteLine(";@Ahk2Exe-SetName " appName)
props.WriteLine(";@Ahk2Exe-SetVersion " version)
props.WriteLine(";@Ahk2Exe-SetMainIcon icon.ico")
props.WriteLine(";@Ahk2Exe-ExeName " appName)
props.Close()
}
catch as e
{
MsgBox("Writting compile props`nERROR CODE=" . e.Message)
ExitApp
}

if FileExist(binaryFilename)
{
FileDelete(binaryFilename)
Expand Down Expand Up @@ -30,17 +45,17 @@ DirCreate("dist")

try
{
RunWait("./binary/ahk2exe.exe /in updater.ahk /out updater.exe /base `"" A_AhkPath "`" /compress 1")
RunWait("./ahk-compile-toolset/tcc/tcc.exe ./updater.c -luser32")
}
catch as e
{
MsgBox("updater.ahk`nERROR CODE=" . e.Message)
MsgBox("updater compile`nERROR CODE=" . e.Message)
ExitApp
}

try
{
RunWait("./binary/ahk2exe.exe /in " ahkFilename " /out " binaryFilename " /base `"" A_AhkPath "`" /compress 1")
RunWait("./ahk-compile-toolset/ahk2exe.exe /in " ahkFilename " /out " binaryFilename " /base `"" A_AhkPath "`" /compress 1")
}
catch as e
{
Expand All @@ -50,7 +65,7 @@ catch as e

try
{
RunWait("./binary/AutoHotkey64.exe .\" . ahkFilename . " --out=version")
RunWait("./ahk-compile-toolset/AutoHotkey64.exe .\" . ahkFilename . " --out=version")
}
catch as e
{
Expand All @@ -60,7 +75,7 @@ catch as e

try
{
RunWait("powershell -command `"Compress-Archive -Path .\" binaryFilename " -DestinationPath " downloadFilename '"',, "Hide")
RunWait("powershell -command `"Compress-Archive -Path .\" binaryFilename " -DestinationPath " downloadFilename '"', , "Hide")
}
catch as e
{
Expand Down
18 changes: 12 additions & 6 deletions meta.ahk
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
FileEncoding("UTF-8")
appName := "PicQuickCompare"
version := "0.2.4"
version := "0.2.5"
versionFilename := "version.txt"
ahkFilename := "app.ahk"
binaryFilename := "PicQuickCompare.exe"
downloadFilename := "PicQuickCompare.zip"
downloadUrl := "/Nigh/PicQuickCompare/releases/latest/download/"
GitHubID := "Nigh"
repoName := "PicQuickCompare"
downloadUrl := "/" GitHubID "/" repoName "/releases/latest/download/"
update_log := "
(
v0.2.X 更新日志
1. 增加Exif信息显示
2. 根据Exif信息自动旋转图片
3. 修复v0.2.0版本Exif只能获取英文系统的问题
4. 修复v0.2.1版本读取不含Exif文件报错的问题
5. 增加后台运行模式,选中图片按Ctrl+Q即可直接比较
6. 重写了DPI缩放逻辑,图片控件不再因为DPI缩放而模糊
3. 增加后台运行模式,选中图片按Ctrl+Q即可直接比较
4. 重写了DPI缩放逻辑,图片控件不再因为DPI缩放而模糊
5. 更新了编译工具链,使用C重写了部分升级相关功能,使得打包体积减小了一半
6. 减小了字体的DPI缩放系数
7. 过长文件名缩略显示
8. 添加图片尺寸与文件大小显示
9. 对LOGO启用DPI缩放
)"
Loading

0 comments on commit 1237cb1

Please sign in to comment.