-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnfcustomenvhelperUtils.prg
105 lines (84 loc) · 2.55 KB
/
nfcustomenvhelperUtils.prg
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
*-------------------------------------------------------
* adds some sample functions to nfcustomenvhelper menu
* when called from afterstartup
*-------------------------------------------------------
local thisprg,thisfolder
thisprg = sys(16)
thisfolder = fullpath('')
define bar 7 of _devpop prompt '\-'
define bar 8 of _devpop prompt ' Open File Explorer ' key f8, 'F8'
define bar 9 of _devpop prompt ' Open CMD in current folder' key ctrl+f8, 'ctrl+F8'
define bar 10 of _devpop prompt ' Modify project' key f9,'F9'
define bar 11 of _devpop prompt ' Show files' key f11,'F11'
define bar 12 of _devpop prompt ' Toggle desktop/active window' key f12,'F12'
on selection bar 8 of _devpop do explorewd in "&thisprg"
on selection bar 9 of _devpop do runcmd in "&thisprg"
on selection bar 10 of _devpop do openproject in "&thisprg"
on selection bar 11 of _devpop do showdir in "&thisprg"
on selection bar 12 of _devpop do activatescreen in "&thisprg"
*- window state
_screen.addproperty('oCustEnv',createobject('empty'))
addproperty(_screen.ocustenv,'toggle',.t.)
addproperty(_screen.ocustenv,'lastWontop','')
*----------------------------
procedure runcmd
*----------------------------
local oexp
oexp = createobject('shell.application')
oexp.ShellExecute('cmd')
*----------------------------
procedure openproject
*----------------------------
try
local defproj
defproj = sys(2000,'*.pjx')
if !empty(m.defproj)
modify project (m.defproj) nowait
else
messagebox( 'No project found in current folder',0)
endif
catch
messagebox( 'Project '+justfname(m.defproj)+' is in use by another ',0)
endtry
*-------------------------
procedure explorewd
*-------------------------
local oexp
oexp = createobject('shell.application')
oexp.explore(fullpath(''))
*----------------------------
procedure showdir(noclear)
*----------------------------
activatescreen(.t.)
if !m.noclear
clear
endif
? 'Current Directory: ',fullpath('')
? ''
? 'Search Path: '
? '-'+strtran(set('path'),';',' -')
? ''
? 'dir *.pjx:'
dir *.pjx
? 'dir *.prg:'
dir *.prg
*------------------------------
function activatescreen(showd)
*------------------------------
with _screen.ocustenv
if .toggle or m.showd
.lastwontop = wontop()
activate screen
hide window all
sys(1500,'_MWI_CMD','_MWINDOW')
.toggle = .f.
else
sys(1500,'_MWI_HIDE','_MWINDOW')
show window all
.toggle = .t.
if !empty(.lastwontop) and wexist(.lastwontop)
activate window (.lastwontop)
endif
.lastwontop = ''
endif
endwith