-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstack_ScriptTracker_.livecodescript
More file actions
137 lines (106 loc) · 3.27 KB
/
stack_ScriptTracker_.livecodescript
File metadata and controls
137 lines (106 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Script "stack_ScriptTracker_"
/*
# Name: stack "ScriptTracker"
# ID: stack "ScriptTracker"
*/
//>CONSTANTS
constant kAutoExternalEditor = "false"
constant kCollisionPolicy = "Ask"
constant kDefaultDiffPath = "[[tExportPath]]/diff"
constant kDefaultExportPath = "[[tStackFileName]]_Scripts"
constant kDefaultExtraPath = "[[tExportPath]]/extra"
constant kDiffContext = 3
constant kDigestType = "MD5"
constant kFileMethod = "binfile:"
constant kPropertySet = "bwmScriptTracker"
constant kSyncBeforeSave = "false"
//>LOCALS
local sPrefsA
function getPrefsA
if sPrefsA is empty then loadPrefs
return sPrefsA
end getPrefsA
function getPref pPref
if sPrefsA is empty then loadPrefs
return sPrefsA[pPref]
end getPref
command setPrefsA pPrefsA
initializePrefs
repeat for each key tPref in pPrefsA
put pPrefsA[tPref] into sPrefsA[tPref]
end repeat
savePrefs
restartAutoSync
end setPrefsA
command setPref pPref, pValue
if sPrefsA is empty then loadPrefs
put pValue into sPrefsA[pPref]
savePrefs
restartAutoSync
end setPref
command loadPrefs
local tPrefs
put url ("binfile:" & prefsFileName()) into tPrefs
if tPrefs is empty then
initializePrefs
else
try
put arrayDecode(tPrefs) into sPrefsA
catch tError
put "Error decoding preferences:" && tError & lf after \
field "log" of stack "ScriptTrackerLog"
initializePrefs
end try
end if
end loadPrefs
command savePrefs
try
put arrayEncode(sPrefsA) into url ("binfile:" & prefsFileName())
catch tError
put "Error saving preferences:" && tError & lf after \
field "log" of stack "ScriptTrackerLog"
end try
end savePrefs
command initializePrefs
delete variable sPrefsA
put getDefaultPrefsA() into sPrefsA
savePrefs
end initializePrefs
function getDefaultPrefsA
local tPrefsA
put kCollisionPolicy into tPrefsA["CollisionPolicy"]
put kDefaultDiffPath into tPrefsA["DiffPath"]
put kDefaultExportPath into tPrefsA["ExportPath"]
put kDefaultExtraPath into tPrefsA["ExtraPath"]
put kDiffContext into tPrefsA["DiffContext"]
put kDigestType into tPrefsA["DigestType"]
put kFileMethod into tPrefsA["FileMethod"]
put kPropertySet into tPrefsA["PropertySet"]
put kSyncBeforeSave into tPrefsA["SyncBeforeSave"]
put kAutoExternalEditor into tPrefsA["AutoExternalEditor"]
put revIDEGetPreference("LCB_textEditor") into tPrefsA["Editor"]
return tPrefsA
end getDefaultPrefsA
function prefsFileName
return revEnvironmentUserPreferencesPath() & "/bwmScriptTracker.lson"
end prefsFileName
on restartAutoSync
if the hilite of button "Automatic" of card "Tracker" \
of stack "ScriptTracker" is true then
send "mouseUp" to button "Automatic" of card "Tracker" \
of stack "ScriptTracker"
return "running"
end if
end restartAutoSync
on stopAutoSync
if the hilite of button "Automatic" of card "Tracker" \
of stack "ScriptTracker" is true then
set the hilite of button "Automatic" of card "Tracker" \
of stack "ScriptTracker" to false
send "mouseUp" to button "Automatic" of card "Tracker" \
of stack "ScriptTracker"
end if
end stopAutoSync
on mouseDoubleUp pButtonNumber
go next card
end mouseDoubleUp