@@ -6,12 +6,14 @@ P.handlers = {}
6
6
function P .init (handlers )
7
7
for i , v in ipairs (handlers ) do
8
8
local h = require (v )
9
- if (type (h .name ) == " string" )and
10
- (type (h .priority ) == " number" )and
11
- (type (h .ondragenter ) == " function" )and
12
- (type (h .ondragover ) == " function" )and
13
- (type (h .ondragleave ) == " function" )and
14
- (type (h .ondrop ) == " function" ) then
9
+ if
10
+ (type (h .name ) == " string" )
11
+ and (type (h .priority ) == " number" )
12
+ and (type (h .ondragenter ) == " function" )
13
+ and (type (h .ondragover ) == " function" )
14
+ and (type (h .ondragleave ) == " function" )
15
+ and (type (h .ondrop ) == " function" )
16
+ then
15
17
table.insert (P .handlers , h )
16
18
end
17
19
end
@@ -27,11 +29,14 @@ function P.ondragenter(files, state)
27
29
if h .ondragenter (files , state ) then
28
30
r = true
29
31
else
30
- debug_print (string.format (i18n ({
31
- ja_JP = [=[ %s: ondragenter で false を返しました]=] ,
32
- en_US = [=[ %s: false returned on ondragenter]=] ,
33
- zh_CN = [=[ %s: 在ondragenter上返回false]=] ,
34
- }), h .name ))
32
+ debug_print (string.format (
33
+ i18n ({
34
+ ja_JP = [=[ %s: ondragenter で false を返しました]=] ,
35
+ en_US = [=[ %s: false returned on ondragenter]=] ,
36
+ zh_CN = [=[ %s: 在ondragenter上返回false]=] ,
37
+ }),
38
+ h .name
39
+ ))
35
40
P .handlers [i ] = false
36
41
end
37
42
end
@@ -46,11 +51,14 @@ function P.ondragover(files, state)
46
51
if h .ondragover (files , state ) then
47
52
r = true
48
53
else
49
- debug_print (string.format (i18n ({
50
- ja_JP = [=[ %s: ondragover で false を返しました]=] ,
51
- en_US = [=[ %s: false returned on ondragover]=] ,
52
- zh_CN = [=[ %s: 在ondragover上返回false]=] ,
53
- }), h .name ))
54
+ debug_print (string.format (
55
+ i18n ({
56
+ ja_JP = [=[ %s: ondragover で false を返しました]=] ,
57
+ en_US = [=[ %s: false returned on ondragover]=] ,
58
+ zh_CN = [=[ %s: 在ondragover上返回false]=] ,
59
+ }),
60
+ h .name
61
+ ))
54
62
P .handlers [i ] = false
55
63
end
56
64
end
@@ -72,29 +80,38 @@ function P.ondrop(files, state)
72
80
if h ~= false then
73
81
local f , s = h .ondrop (files , state )
74
82
if f == nil then
75
- debug_print (string.format (i18n ({
76
- ja_JP = [=[ %s: 処理がキャンセルされました]=] ,
77
- en_US = [=[ %s: The process has been canceled]=] ,
78
- zh_CN = [=[ %s: 处理已取消]=] ,
79
- }), h .name ))
83
+ debug_print (string.format (
84
+ i18n ({
85
+ ja_JP = [=[ %s: 処理がキャンセルされました]=] ,
86
+ en_US = [=[ %s: The process has been canceled]=] ,
87
+ zh_CN = [=[ %s: 处理已取消]=] ,
88
+ }),
89
+ h .name
90
+ ))
80
91
return false
81
92
elseif f ~= false then
82
93
for i2 , f2 in ipairs (f ) do
83
94
debug_print (string.format (" [%d] %s" , i2 , f2 .filepath ))
84
95
end
85
96
GCMZDrops .drop (f , s )
86
- debug_print (string.format (i18n ({
87
- ja_JP = [=[ %s: 処理が完了しました。]=] ,
88
- en_US = [=[ %s: The process has been completed.]=] ,
89
- zh_CN = [=[ %s: 处理已完成]=] ,
90
- }), h .name ))
97
+ debug_print (string.format (
98
+ i18n ({
99
+ ja_JP = [=[ %s: 処理が完了しました。]=] ,
100
+ en_US = [=[ %s: The process has been completed.]=] ,
101
+ zh_CN = [=[ %s: 处理已完成]=] ,
102
+ }),
103
+ h .name
104
+ ))
91
105
return true
92
106
else
93
- debug_print (string.format (i18n ({
94
- ja_JP = [=[ %s: 処理を続行します。]=] ,
95
- en_US = [=[ %s: Continue processing.]=] ,
96
- zh_CN = [=[ %s: 继续处理]=] ,
97
- }), h .name ))
107
+ debug_print (string.format (
108
+ i18n ({
109
+ ja_JP = [=[ %s: 処理を続行します。]=] ,
110
+ en_US = [=[ %s: Continue processing.]=] ,
111
+ zh_CN = [=[ %s: 继续处理]=] ,
112
+ }),
113
+ h .name
114
+ ))
98
115
end
99
116
end
100
117
end
@@ -122,9 +139,7 @@ function P.initdropper(droppers)
122
139
end )
123
140
for i , v in ipairs (droppers ) do
124
141
local d = require (v )
125
- if (type (d .name ) == " string" )and
126
- (type (d .oninitmenu ) == " function" )and
127
- (type (d .onselect ) == " function" ) then
142
+ if (type (d .name ) == " string" ) and (type (d .oninitmenu ) == " function" ) and (type (d .onselect ) == " function" ) then
128
143
table.insert (P .droppers , d )
129
144
end
130
145
end
@@ -150,7 +165,7 @@ function P.selectdropper(dropperindex, menuindex, state)
150
165
return false
151
166
end
152
167
if type (rstate ) ~= " table" then
153
- rstate = {x = state .x , y = state .y }
168
+ rstate = { x = state .x , y = state .y }
154
169
end
155
170
rstate .control = rstate .control or false
156
171
rstate .shift = rstate .shift or false
@@ -159,7 +174,7 @@ function P.selectdropper(dropperindex, menuindex, state)
159
174
rstate .mbutton = rstate .mbutton or false
160
175
rstate .rbutton = rstate .rbutton or false
161
176
rstate .frameadvance = rstate .frameadvance or 0
162
- if (not rstate .lbutton )and ( not rstate .mbutton ) and ( not rstate .rbutton ) then
177
+ if (not rstate .lbutton ) and not rstate .mbutton and not rstate .rbutton then
163
178
rstate .lbutton = true
164
179
end
165
180
return P .ondropsimulated (files , rstate )
@@ -178,7 +193,7 @@ function _G.i18n(utf8string_map)
178
193
end
179
194
end
180
195
local idx = GCMZDrops .choose_language (preferred_languages , langs )
181
- return GCMZDrops .convertencoding (utf8string_map [langs [idx ]], ' utf8' , ' ansi' )
196
+ return GCMZDrops .convertencoding (utf8string_map [langs [idx ]], " utf8" , " ansi" )
182
197
end
183
198
184
199
return P
0 commit comments