1
2
3
4
5
6
7 from ctypes import *
8 from ctypes.wintypes import *
9 import winKernel
10 import winUser
11 from scriptHandler import isScriptWaiting
12 from NVDAObjects.IAccessible import IAccessible
13 import appModuleHandler
14 import speech
15 import locale
16 import controlTypes
17 import api
18 import watchdog
19
20
21
22
23
24 WM_WA_IPC=winUser.WM_USER
25
26
27 IPC_GET_SHUFFLE=250
28 IPC_GET_REPEAT=251
29
30
31 IPC_PLAYLIST_GET_NEXT_SELECTED=3029
32 IPC_PE_GETCURINDEX=100
33 IPC_PE_GETINDEXTOTAL=101
34
35 IPC_PE_GETINDEXTITLE=200
36
38 _fields_=[
39 ('fileindex',c_int),
40 ('filetitle',c_char*256),
41 ('filelength',c_char*16),
42 ]
43
44 hwndWinamp=0
45
49
53
55
59
61 windowClass = obj.windowClassName
62 if windowClass == "Winamp PE":
63 clsList.insert(0, winampPlaylistEditor)
64 elif windowClass == "Winamp v1.x":
65 clsList.insert(0, winampMainWindow)
66
67 -class winampMainWindow(IAccessible):
68
71
72 - def script_shuffleToggle(self,gesture):
73 gesture.send()
74 if not isScriptWaiting():
75 api.processPendingEvents()
76 if getShuffle():
77 onOff=_("on")
78 else:
79 onOff=_("off")
80 speech.speakMessage(onOff)
81
82 - def script_repeatToggle(self,gesture):
83 gesture.send()
84 if not isScriptWaiting():
85 api.processPendingEvents()
86 if getRepeat():
87 onOff=_("on")
88 else:
89 onOff=_("off")
90 speech.speakMessage(onOff)
91
92 __gestures = {
93 "kb:s": "shuffleToggle",
94 "kb:r": "repeatToggle",
95 }
96
98
100 curIndex=watchdog.cancellableSendMessage(hwndWinamp,WM_WA_IPC,-1,IPC_PLAYLIST_GET_NEXT_SELECTED)
101 if curIndex <0:
102 return None
103 info=fileinfo2()
104 info.fileindex=curIndex
105 internalInfo=winKernel.virtualAllocEx(self.processHandle,None,sizeof(info),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
106 try:
107 winKernel.writeProcessMemory(self.processHandle,internalInfo,byref(info),sizeof(info),None)
108 watchdog.cancellableSendMessage(self.windowHandle,WM_WA_IPC,IPC_PE_GETINDEXTITLE,internalInfo)
109 winKernel.readProcessMemory(self.processHandle,internalInfo,byref(info),sizeof(info),None)
110 finally:
111 winKernel.virtualFreeEx(self.processHandle,internalInfo,0,winKernel.MEM_RELEASE)
112 return unicode("%d.\t%s\t%s"%(curIndex+1,info.filetitle,info.filelength), errors="replace", encoding=locale.getlocale()[1])
113
116
122
125
126 __changeItemGestures = (
127 "kb:upArrow",
128 "kb:downArrow",
129 "kb:pageUp",
130 "kb:pageDown",
131 )
132
136