Skip to content

Commit

Permalink
Merge pull request #5 from Nigh/gdip-pic-icon
Browse files Browse the repository at this point in the history
add Gdip pic icon
  • Loading branch information
Nigh authored Sep 10, 2023
2 parents d2ac8da + f4ae5c7 commit 6845b95
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ right click the `ahko` tray icon, and then click the `Setup`
## Usage

ahko scans two levels of directories in the watch folder.
The number of objects per directory level is limited to `16`. So that a maximum of `16x16 = 256` objects can be used in ahko.
The number of objects per directory level is limited to `16`.
So that a maximum of `16x16 = 256` objects can be used in ahko.

Use hotkey set in `Setup` page to show launcher.

<code>`</code> key back to upper level.

`Esc` to hide the launcher.

### icon

Icons can be obtained automatically. And you can set it by your own.
Folder icons can be set by placing a png image with the name `_icon.png` in the folder.
Item's icon can be set by placing a png image with the same name as the item. For example, put `abc.lnk` and `abc.png` in the same folder, the icon of `abc.lnk` would be set to `abc.png`.
Icons can be automatically get from the file. And you can set it by your own.
Folder icons can be set by placing a png image with the name `_icon.png` in the folder.

Item's icon can be set by placing a png image with the same name as the item.
For example, put `abc.lnk` and `abc.png` in the same folder, the icon of `abc.lnk` would be set to `abc.png`.

## Template

Expand Down
24 changes: 14 additions & 10 deletions ahko_gridview_ui.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class ahko_gridview_class

HotIfWinExist("ahk_id " this.grid_gui.Hwnd)
hotkey("Escape", this.grid_gui.uHide)
hotkey("``", this.grid_gui.uHide)
For k, v in this.grid_gui.callback
{
if (v != "") {
Expand Down Expand Up @@ -238,16 +239,19 @@ class ahko_gridview_class
}
} else {
pBitmapBtn := Gdip_CreateBitmap(this.buttonSize, this.buttonSize)
; MsgBox ahko_obj.path
fileinfo := Buffer(fisize := A_PtrSize + 688)
; Get the file's icon.
if DllCall("shell32\SHGetFileInfoW", "WStr", ahko_obj.path
, "UInt", 0, "Ptr", fileinfo, "UInt", fisize, "UInt", 0x100)
{
hicon := NumGet(fileinfo, 0, "Ptr")
; GetIconDimensions(hicon, &W, &H)
; MsgBox W "," H
pBitmapIcon := Gdip_CreateBitmapFromHICON(hicon)
if ahko_obj.icon {
pBitmapIcon := Gdip_CreateBitmapFromFile(ahko_obj.icon)
} else {
fileinfo := Buffer(fisize := A_PtrSize + 688)
; Get the file's icon.
if DllCall("shell32\SHGetFileInfoW", "WStr", ahko_obj.path
, "UInt", 0, "Ptr", fileinfo, "UInt", fisize, "UInt", 0x100)
{
hicon := NumGet(fileinfo, 0, "Ptr")
; GetIconDimensions(hicon, &W, &H)
; MsgBox W "," H
pBitmapIcon := Gdip_CreateBitmapFromHICON(hicon)
}
}
G := Gdip_GraphicsFromImage(pBitmapBtn)
pBrush := Gdip_BrushCreateSolid(0xFFAAAAAA)
Expand Down
5 changes: 3 additions & 2 deletions meta.ahk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

FileEncoding("UTF-8")
appName:="ahko"
version:="0.3.0"
version:="0.3.1"
versionFilename:="version.txt"
ahkFilename:="app.ahk"
binaryFilename:="ahko.exe"
Expand All @@ -10,6 +10,7 @@ downloadUrl:="/Nigh/ahko/releases/latest/download/"
update_log:="
(

1. Add gdip version of grid view
1. Add gdip version of gridview
2. Add picture icon support for gridview

)"

0 comments on commit 6845b95

Please sign in to comment.