Skip to content

Commit

Permalink
test run for #16, new shortcut selector, new update arrival window, t…
Browse files Browse the repository at this point in the history
…ooltips, small fixes & changes
  • Loading branch information
deseven committed May 4, 2017
1 parent eaffa9c commit 9e92a08
Show file tree
Hide file tree
Showing 9 changed files with 311 additions and 70 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Simple shortcut manager for OS X 10.8 or higher.
![screenshot](https://eri.deseven.info/scr/PneographEpituberculousPreofficially.png)

## binaries
Latest binary release can be downloaded [here](https://deseven.info/sys/ichs.dmg).
Latest binary release can be downloaded [here](https://github.com/deseven/icanhazshortcut/releases).

## compiling from source
iCHS created in [PB](http://purebasic.com) and depends on [pb-osx-globalhotkeys](https://github.com/deseven/pb-osx-globalhotkeys).
Expand Down
Binary file added build/Contents/Resources/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions build/appdmg/iCanHazShortcut.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"icon": "../Contents/Resources/main.icns",
"background": "bg.png",
"contents": [
{ "x": 448, "y": 355, "type": "link", "path": "/Applications" },
{ "x": 192, "y": 355, "type": "file", "path": "../iCanHazShortcut.app" }
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
{ "x": 192, "y": 344, "type": "file", "path": "../iCanHazShortcut.app" }
]
}
2 changes: 1 addition & 1 deletion build/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

pb="/Applications/PureBasic"
pb="/Applications/PureBasic.app/Contents/Resources"
name="iCanHazShortcut"
shortName="ichs"
ident="info.deseven.icanhazshortcut"
Expand Down
23 changes: 19 additions & 4 deletions const.pb
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
; main
#myName = "iCanHazShortcut"
#myVer = "0.7.0"
#myVer = "0.8.0"
#myID = "info.deseven.icanhazshortcut"

; update params
#updateCheckUrl = "http://deseven.info/sys/ichs.ver"
#updateDownloadUrl = "http://deseven.info/sys/ichs.dmg"
#updateCheckInterval = 1440

#pressInvite = "press to set"
#enterInvite = "enter keys"

; structures
Structure testRunResults
timeouted.b
exitCode.i
stdout.s
stderr.s
EndStructure

; enums
Enumeration main
#wnd
Expand All @@ -25,6 +36,8 @@ Enumeration gadgets
#gadAdd
#gadEdit
#gadDel
#gadTest
#gadTestNote
#gadApply
#gadCancel
#gadUp
Expand All @@ -50,6 +63,7 @@ Enumeration gadgets
#gadActionHelp6
#gadPrefShell
#gadPrefShellCap
#gadPrefShellNote
#gadPrefStatusBar
#gadPrefPopulateMenu
#gadPrefShowHtk
Expand All @@ -65,6 +79,7 @@ Enumeration resources
#resAdd
#resEdit
#resDel
#resTest
#resApply
#resCancel
#resUp
Expand Down Expand Up @@ -194,6 +209,6 @@ keys($33) = "Del"
~"\t<key>LimitLoadToSessionType</key>\n" +
~"\t<string>Aqua</string></dict>\n" +
~"</plist>"
; IDE Options = PureBasic 5.42 LTS (MacOS X - x64)
; EnableUnicode
; EnableXP
; IDE Options = PureBasic 5.60 (MacOS X - x86)
; EnableXP
; EnableUnicode
75 changes: 67 additions & 8 deletions helpers.pb
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,48 @@ Procedure.f getBackingScaleFactor()
ProcedureReturn backingScaleFactor
EndProcedure

Procedure MessageRequesterEx(Title.s, Info.s,type.s="'note'",defaultbutton=1,buttonone.s="Ok",buttontwo.s="",buttonthree.s="",buttonfour.s="",buttonfive.s="") ; max 5 buttons
Protected.i Alert, Frame.NSRect,numberbuttons=0,button
Shared workspace,application
;If FindString("'APPL''caut''note''stop'",type,1)=0 : Debug "no type":EndIf
Frame\size\width = 300
Frame\size\height = 24
Alert = CocoaMessage(0, CocoaMessage(0, 0, "NSAlert new"), "autorelease")
CocoaMessage(0, Alert, "setMessageText:$", @Title)
CocoaMessage(0, Alert, "setInformativeText:$", @Info)
CocoaMessage(0, Alert, "setIcon:", ImageID(#resLogo))

If buttonfive
CocoaMessage(0, Alert, "addButtonWithTitle:$", @buttonfive)
numberbuttons+1
EndIf
If buttonfour
CocoaMessage(0, Alert, "addButtonWithTitle:$", @buttonfour)
numberbuttons+1
EndIf
If buttonthree
CocoaMessage(0, Alert, "addButtonWithTitle:$", @buttonthree)
numberbuttons+1
EndIf
If buttontwo
CocoaMessage(0, Alert, "addButtonWithTitle:$", @buttontwo)
numberbuttons+1
EndIf
CocoaMessage(0, Alert, "addButtonWithTitle:$", @buttonone)
Button = CocoaMessage(0, CocoaMessage(0, Alert, "buttons"), "objectAtIndex:",numberbuttons-defaultbutton+1)
CocoaMessage(0, CocoaMessage(0, Alert, "window"), "setDefaultButtonCell:", CocoaMessage(0, Button ,"cell"))
ProcedureReturn 1001+numberbuttons-CocoaMessage(0, Alert, "runModal")
EndProcedure

Macro viewingMode()
FreeGadget(#gadShortcutSelectorCap) : FreeGadget(#gadShortcutSelector)
FreeGadget(#gadActionCap) : FreeGadget(#gadAction) : FreeGadget(#gadActionHelp)
FreeGadget(#gadActionHelp1) : FreeGadget(#gadActionHelp2) : FreeGadget(#gadActionHelp3)
FreeGadget(#gadActionHelp4) : FreeGadget(#gadActionHelp5) : FreeGadget(#gadActionHelp6)
HideGadget(#gadCancel,#True)
HideGadget(#gadApply,#True)
HideGadget(#gadTest,#True)
HideGadget(#gadTestNote,#True)
TextGadget(#gadBg,0,0,400,300,"") ; dirty fix for a strange redraw behavior
FreeGadget(#gadBg)
HideGadget(#gadShortcuts,#False)
Expand Down Expand Up @@ -184,15 +219,13 @@ Macro editingMode()
TextGadget(#gadBg,0,0,400,300,"") ; dirty fix for a strange redraw behavior
FreeGadget(#gadBg)
TextGadget(#gadShortcutSelectorCap,10,12,60,20,"Shortcut:")
StringGadget(#gadShortcutSelector,70,10,80,20,"")
ButtonGadget(#gadShortcutSelector,70,10,80,20,#pressInvite)
CocoaMessage(0,GadgetID(#gadShortcutSelector),"setBezelStyle:",10)
CocoaMessage(0,GadgetID(#gadShortcutSelector),"setFocusRingType:",1)
CocoaMessage(0,GadgetID(#gadShortcutSelector),"setAlignment:",#NSCenterTextAlignment)
Define placeholder.s = "press keys"
CocoaMessage(0,CocoaMessage(0,GadgetID(#gadShortcutSelector),"cell"),"setPlaceholderString:$",@placeholder)
TextGadget(#gadActionCap,10,42,60,20,"Action:")
StringGadget(#gadAction,70,40,290,20,"")
CocoaMessage(0,GadgetID(#gadAction),"setFocusRingType:",1)
placeholder.s = "input command which will be executed"
Define placeholder.s = "input command which will be executed"
CocoaMessage(0,CocoaMessage(0,GadgetID(#gadAction),"cell"),"setPlaceholderString:$",@placeholder)
TextGadget(#gadActionHelp,10,70,360,40,~"You can use any command that works in your terminal.\nHere are some examples:")
HyperLinkGadget(#gadActionHelp1,10,110,120,20,"open an app",$770000)
Expand All @@ -207,6 +240,8 @@ Macro editingMode()
SetGadgetColor(#gadActionHelp5,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadActionHelp6,10,200,120,20,"lock screen",$770000)
SetGadgetColor(#gadActionHelp6,#PB_Gadget_FrontColor,$bb0000)
HideGadget(#gadTest,#False)
HideGadget(#gadTestNote,#False)
HideGadget(#gadApply,#False)
HideGadget(#gadCancel,#False)
CloseGadgetList()
Expand Down Expand Up @@ -236,7 +271,31 @@ Macro setListStyle()
;CocoaMessage(0,GadgetID(#gadShortcuts),"sizeToFit")
CocoaMessage(0,GadgetID(#gadShortcuts),"sizeLastColumnToFit")
EndMacro
; IDE Options = PureBasic 5.42 LTS (MacOS X - x64)

Macro activateSelector(gadget)
activeSelector = gadget
If GetGadgetText(activeSelector) <> #pressInvite
previousHotkey = GetGadgetText(activeSelector)
EndIf
CocoaMessage(0,GadgetID(activeSelector),"highlight:",1)
SetGadgetText(activeSelector,#enterInvite)
EndMacro

Macro deactivateSelector(hotkey = "")
If activeSelector <> -1
CocoaMessage(0,GadgetID(activeSelector),"highlight:",0)
If Len(hotkey)
SetGadgetText(activeSelector,hotkey)
ElseIf Len(previousHotkey)
SetGadgetText(activeSelector,previousHotkey)
Else
SetGadgetText(activeSelector,#pressInvite)
EndIf
activeSelector = -1
previousHotkey = ""
EndIf
EndMacro
; IDE Options = PureBasic 5.60 (MacOS X - x86)
; Folding = ---
; EnableUnicode
; EnableXP
; EnableXP
; EnableUnicode
12 changes: 6 additions & 6 deletions iCanHazShortcut.pbp
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 5.42 LTS (MacOS X - x64)">
<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 5.44 LTS (MacOS X - x64)">
<section name="config">
<options closefiles="1" openmode="0" name="iCanHazShortcut"/>
</section>
<section name="data">
<explorer view="../../" pattern="0"/>
<log show="1"/>
<lastopen date="2016-10-11 22:56" user="deseven" host="de7air.local"/>
<lastopen date="2017-04-26 16:38" user="deseven" host="de7air.local"/>
</section>
<section name="files">
<file name="const.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="524571b1343e0bfd3fdd7876f461a110"/>
<fingerprint md5="e2d1d9f20ed7d37eabdc52df905a3d96"/>
</file>
<file name="helpers.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="874e8adc1f2bb1642f21bb2cfc609edd"/>
<fingerprint md5="c1b6b424617c00733aa3936bc2b8f43a"/>
</file>
<file name="main.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="d11c402678e663be33a83ec6138ed578"/>
<fingerprint md5="e9da098b074d2bb8b0d7ac68fc2e0441"/>
</file>
<file name="proc.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="6bc6e493a7afbe9064c77e0fb7683b4b"/>
<fingerprint md5="74ebb22648fb29d58ab709de5717736f"/>
</file>
</section>
<section name="targets">
Expand Down
Loading

0 comments on commit 9e92a08

Please sign in to comment.