Skip to content

Commit

Permalink
fixes #18, fixes #21
Browse files Browse the repository at this point in the history
  • Loading branch information
deseven committed Jan 21, 2019
1 parent d9a939a commit bf3f018
Show file tree
Hide file tree
Showing 27 changed files with 84 additions and 47 deletions.
2 changes: 1 addition & 1 deletion build/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleSignature</key>
<string>PURE</string>
<key>CFBundleVersion</key>
<string>0.8.2</string>
<string>1.0.0</string>
<key>CFBundleName</key>
<string>iCanHazShortcut</string>
<key>CSResourcesFileMapped</key>
Expand Down
Binary file removed build/Contents/Resources/add.png
Binary file not shown.
Binary file added build/Contents/Resources/apply-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed build/Contents/Resources/apply.png
Binary file not shown.
Binary file added build/Contents/Resources/arrow-down-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/Contents/Resources/arrow-up-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/Contents/Resources/cancel-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed build/Contents/Resources/cancel.png
Binary file not shown.
Binary file removed build/Contents/Resources/del.png
Binary file not shown.
Binary file removed build/Contents/Resources/disabled.png
Binary file not shown.
Binary file removed build/Contents/Resources/down.png
Binary file not shown.
Binary file added build/Contents/Resources/edit-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed build/Contents/Resources/edit.png
Binary file not shown.
Binary file removed build/Contents/Resources/failed.png
Binary file not shown.
Binary file added build/Contents/Resources/minus-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/Contents/Resources/off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed build/Contents/Resources/ok.png
Binary file not shown.
Binary file added build/Contents/Resources/on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/Contents/Resources/plus-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/Contents/Resources/test-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed build/Contents/Resources/test.png
Binary file not shown.
Binary file removed build/Contents/Resources/up.png
Binary file not shown.
8 changes: 6 additions & 2 deletions const.pb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; main
#myName = "iCanHazShortcut"
#myVer = "0.8.2"
#myVer = "1.0.0"
#myID = "info.deseven.icanhazshortcut"

; update params
Expand All @@ -11,6 +11,9 @@
#pressInvite = "press to set"
#enterInvite = "enter keys"

#linkColor = $ff8000
#linkColorHighlighted = $ba520f

; structures
Structure testRunResults
timeouted.b
Expand Down Expand Up @@ -213,6 +216,7 @@ keys($33) = "Del"
~"\t<key>LimitLoadToSessionType</key>\n" +
~"\t<string>Aqua</string></dict>\n" +
~"</plist>"
; IDE Options = PureBasic 5.61 (MacOS X - x64)
; IDE Options = PureBasic 5.70 LTS (MacOS X - x64)
; CursorPosition = 2
; EnableXP
; EnableUnicode
34 changes: 15 additions & 19 deletions helpers.pb
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,18 @@ Macro editingMode()
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)
SetGadgetColor(#gadActionHelp1,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadActionHelp2,10,128,120,20,"make a screenshot",$770000)
SetGadgetColor(#gadActionHelp2,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadActionHelp3,10,146,120,20,"say current date",$770000)
SetGadgetColor(#gadActionHelp3,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadActionHelp4,10,164,160,20,"save clipboard contents",$770000)
SetGadgetColor(#gadActionHelp4,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadActionHelp5,10,182,160,20,"set clipboard contents",$770000)
SetGadgetColor(#gadActionHelp5,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadActionHelp6,10,200,120,20,"lock screen",$770000)
SetGadgetColor(#gadActionHelp6,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadActionHelp1,10,110,120,20,"open an app",#linkColorHighlighted)
SetGadgetColor(#gadActionHelp1,#PB_Gadget_FrontColor,#linkColor)
HyperLinkGadget(#gadActionHelp2,10,128,120,20,"make a screenshot",#linkColorHighlighted)
SetGadgetColor(#gadActionHelp2,#PB_Gadget_FrontColor,#linkColor)
HyperLinkGadget(#gadActionHelp3,10,146,120,20,"say current date",#linkColorHighlighted)
SetGadgetColor(#gadActionHelp3,#PB_Gadget_FrontColor,#linkColor)
HyperLinkGadget(#gadActionHelp4,10,164,160,20,"save clipboard contents",#linkColorHighlighted)
SetGadgetColor(#gadActionHelp4,#PB_Gadget_FrontColor,#linkColor)
HyperLinkGadget(#gadActionHelp5,10,182,160,20,"set clipboard contents",#linkColorHighlighted)
SetGadgetColor(#gadActionHelp5,#PB_Gadget_FrontColor,#linkColor)
HyperLinkGadget(#gadActionHelp6,10,200,120,20,"lock screen",#linkColorHighlighted)
SetGadgetColor(#gadActionHelp6,#PB_Gadget_FrontColor,#linkColor)
HideGadget(#gadTest,#False)
HideGadget(#gadTestNote,#False)
HideGadget(#gadApply,#False)
Expand All @@ -255,12 +255,6 @@ Macro editingExistentMode()
EndMacro

Macro setListStyle()
If CountGadgetItems(#gadShortcuts)
ListIconGadgetColumnTitle(#gadShortcuts,0,"⚡")
ListIconGadgetColumnTitle(#gadShortcuts,1,"⚙")
Else
ListIconGadgetColumnTitle(#gadShortcuts,0,"⚡")
EndIf
setListIconColumnJustification(#gadShortcuts,0,2)
setListIconColumnJustification(#gadShortcuts,1,2)
setListIconColumnJustification(#gadShortcuts,2,2)
Expand Down Expand Up @@ -295,7 +289,9 @@ Macro deactivateSelector(hotkey = "")
previousHotkey = ""
EndIf
EndMacro
; IDE Options = PureBasic 5.60 (MacOS X - x86)
; IDE Options = PureBasic 5.70 LTS (MacOS X - x64)
; CursorPosition = 86
; FirstLine = 72
; Folding = ---
; 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.44 LTS (MacOS X - x86)">
<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 5.70 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="2017-06-12 21:26" user="deseven" host="de7air.local"/>
<lastopen date="2019-01-21 18:56" user="deseven" host="de7mac.local"/>
</section>
<section name="files">
<file name="const.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="35db764685b55cfd42efcf5fe2a70ec4"/>
<fingerprint md5="1f51b74b87f234d5bd454c490a564d63"/>
</file>
<file name="helpers.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="93ce60fa18a68034e2ee68416dac79f6"/>
<fingerprint md5="0aec717a374e184a925ddb1d0477e0bf"/>
</file>
<file name="main.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="c2f41f3be0b9f5be083bbee515c20878"/>
<fingerprint md5="fdc2c760249dd0d88a021256dbbf3ddd"/>
</file>
<file name="proc.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="5eeb6738393250fa0c3481c4b1696d43"/>
<fingerprint md5="81e92e29d45af6a82400c70528bfcaa7"/>
</file>
</section>
<section name="targets">
Expand Down
38 changes: 31 additions & 7 deletions main.pb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Define gadgetState.l
Define testRunResult.testRunResults
Define activeSelector.i = -1
Define previousHotkey.s
Define cur.NSPoint

IncludeFile "helpers.pb"
IncludeFile "proc.pb"
Expand Down Expand Up @@ -56,6 +57,7 @@ CocoaMessage(0,GadgetID(#gadShortcuts),"setFocusRingType:",1)
AddGadgetColumn(#gadShortcuts,2,"Action",1)
AddGadgetColumn(#gadShortcuts,3,"Workdir",1)
ListIconGadgetHideColumn(#gadShortcuts,3,#True)
ListIconGadgetHideColumn(#gadShortcuts,0,#True)
CocoaMessage(0,GadgetID(#gadShortcuts),"sizeLastColumnToFit")
ButtonImageGadget(#gadAdd,260,222,36,34,ImageID(#resAdd))
ButtonImageGadget(#gadEdit,296,222,36,34,ImageID(#resEdit))
Expand All @@ -73,6 +75,14 @@ CocoaMessage(0,GadgetID(#gadApply),"setFocusRingType:",1)
CocoaMessage(0,GadgetID(#gadCancel),"setFocusRingType:",1)
CocoaMessage(0,GadgetID(#gadUp),"setFocusRingType:",1)
CocoaMessage(0,GadgetID(#gadDown),"setFocusRingType:",1)
CocoaMessage(0,GadgetID(#gadAdd),"setBordered:",0)
CocoaMessage(0,GadgetID(#gadEdit),"setBordered:",0)
CocoaMessage(0,GadgetID(#gadDel),"setBordered:",0)
CocoaMessage(0,GadgetID(#gadTest),"setBordered:",0)
CocoaMessage(0,GadgetID(#gadApply),"setBordered:",0)
CocoaMessage(0,GadgetID(#gadCancel),"setBordered:",0)
CocoaMessage(0,GadgetID(#gadUp),"setBordered:",0)
CocoaMessage(0,GadgetID(#gadDown),"setBordered:",0)

AddGadgetItem(#gadTabs,1,"Preferences")
TextGadget(#gadPrefShellCap,10,12,60,20,"Shell:")
Expand All @@ -97,11 +107,11 @@ ImageGadget(#gadLogo,25,5,64,64,ImageID(#resLogo))
TextGadget(#gadNameVer,89,8,270,20,#myName + " " + #myVer,#PB_Text_Center)
SetGadgetFont(#gadNameVer,FontID(#resBigFont))
TextGadget(#gadCopyright,159,28,70,20,"created by")
HyperLinkGadget(#gadWebDeveloper,219,30,100,20,"deseven",$770000)
HyperLinkGadget(#gadWebDeveloper,219,30,100,20,"deseven",#linkColorHighlighted)
TextGadget(#gadCopyrightIcon,159,42,70,20,"icons by")
HyperLinkGadget(#gadWebDesigner,206,44,100,20,"denboroda",$770000)
SetGadgetColor(#gadWebDeveloper,#PB_Gadget_FrontColor,$bb0000)
SetGadgetColor(#gadWebDesigner,#PB_Gadget_FrontColor,$bb0000)
HyperLinkGadget(#gadWebDesigner,206,44,100,20,"denboroda",#linkColorHighlighted)
SetGadgetColor(#gadWebDeveloper,#PB_Gadget_FrontColor,#linkColor)
SetGadgetColor(#gadWebDesigner,#PB_Gadget_FrontColor,#linkColor)
EditorGadget(#gadLicense,5,70,360,180,#PB_Editor_ReadOnly|#PB_Editor_WordWrap)
AddGadgetItem(#gadLicense,-1,#LICENSE)
SetActiveGadget(#gadShortcuts)
Expand Down Expand Up @@ -160,6 +170,20 @@ Repeat
DisableGadget(#gadEdit,#True) : DisableGadget(#gadDel,#True)
DisableGadget(#gadUp,#True) : DisableGadget(#gadDown,#True)
EndIf
Case #PB_EventType_LeftClick
cur\x = WindowMouseX(#wnd)
cur\y = WindowHeight(#wnd) - WindowMouseY(#wnd)
CocoaMessage(@cur,GadgetID(#gadShortcuts),"convertPoint:@",@cur,"fromView:",0)
Define selectedColumn.i = CocoaMessage(0,GadgetID(#gadShortcuts),"columnAtPoint:@",@cur)
If selectedColumn = 1
If GetGadgetItemState(#gadShortcuts,GetGadgetState(#gadShortcuts)) = #PB_ListIcon_Checked|#PB_ListIcon_Selected
SetGadgetItemState(#gadShortcuts,GetGadgetState(#gadShortcuts),#PB_ListIcon_Selected)
Else
SetGadgetItemState(#gadShortcuts,GetGadgetState(#gadShortcuts),#PB_ListIcon_Selected|#PB_ListIcon_Checked)
EndIf
PostEvent(#PB_Event_Gadget,#wnd,#gadShortcuts,#PB_EventType_Change)
;Debug "Selected column: " + Str(selectedColumn)
EndIf
Case #PB_EventType_LeftDoubleClick
If GetGadgetState(#gadShortcuts) <> -1
editingExistentMode()
Expand Down Expand Up @@ -385,6 +409,6 @@ Repeat
ForEver

die()
; IDE Options = PureBasic 5.44 LTS (MacOS X - x86)
; EnableUnicode
; EnableXP
; IDE Options = PureBasic 5.70 LTS (MacOS X - x64)
; EnableXP
; EnableUnicode
37 changes: 25 additions & 12 deletions proc.pb
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,17 @@ Procedure initResources()
Protected path.s = GetPathPart(ProgramFilename()) + "../Resources/"
LoadFont(#resBigFont,"Courier",18,#PB_Font_Bold)
If LoadImageEx(#resLogo,path+"main.icns") And
LoadImageEx(#resAdd,path+"add.png") And
LoadImageEx(#resEdit,path+"edit.png") And
LoadImageEx(#resDel,path+"del.png") And
LoadImageEx(#resTest,path+"test.png") And
LoadImageEx(#resApply,path+"apply.png") And
LoadImageEx(#resCancel,path+"cancel.png") And
LoadImageEx(#resOk,path+"ok.png") And
LoadImageEx(#resDisabled,path+"disabled.png") And
LoadImageEx(#resFailed,path+"failed.png") And
LoadImageEx(#resUp,path+"up.png") And
LoadImageEx(#resDown,path+"down.png")
LoadImageEx(#resAdd,path+"plus-circle.png") And
LoadImageEx(#resEdit,path+"edit-circle.png") And
LoadImageEx(#resDel,path+"minus-circle.png") And
LoadImageEx(#resTest,path+"test-circle.png") And
LoadImageEx(#resApply,path+"apply-circle.png") And
LoadImageEx(#resCancel,path+"cancel-circle.png") And
LoadImageEx(#resOk,path+"on.png") And
LoadImageEx(#resDisabled,path+"off.png") And
LoadImageEx(#resFailed,path+"on.png") And
LoadImageEx(#resUp,path+"arrow-up-circle.png") And
LoadImageEx(#resDown,path+"arrow-down-circle.png")
If getBackingScaleFactor() >= 2.0
If Not LoadImageEx(#resIcon,path+"[email protected]") : End 1 : EndIf
imageSize\width = 20
Expand Down Expand Up @@ -178,6 +178,17 @@ Procedure initResources()
ResizeImage(#resFailed,16,16,#PB_Image_Smooth)
EndIf
CocoaMessage(0,ImageID(#resIcon),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resAdd),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resEdit),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resDel),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resApply),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resCancel),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resUp),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resDown),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resTest),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resOk),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resDisabled),"setTemplate:",#True)
CocoaMessage(0,ImageID(#resFailed),"setTemplate:",#True)
Else
Debug "failed to load image"
End 1
Expand Down Expand Up @@ -580,7 +591,9 @@ ProcedureC keyHandler(sender,sel,event)
EndIf
ProcedureReturn result
EndProcedure
; IDE Options = PureBasic 5.61 (MacOS X - x64)
; IDE Options = PureBasic 5.70 LTS (MacOS X - x64)
; CursorPosition = 112
; FirstLine = 109
; Folding = ----
; EnableXP
; EnableUnicode

0 comments on commit bf3f018

Please sign in to comment.