Skip to content

Commit 4c518d1

Browse files
authored
Merge pull request #8 from L3v3L/feature-usable-smp-package
2 parents 0323db5 + fc13970 commit 4c518d1

File tree

8 files changed

+78
-139
lines changed

8 files changed

+78
-139
lines changed
File renamed without changes.
File renamed without changes.

buttons/buttons_last_list.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

foo_last_list_smp.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

main.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
include('scripts\\last_list.js');
4+
include('scripts\\button.js');
5+
6+
const lastList = new _lastList();
7+
8+
// Button
9+
const buttons = {
10+
LastListButton: new columnButton(buttonTemplate, 0, "Last List", function () {
11+
lastList.run(null, null, null);
12+
}),
13+
};

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": "0.6",
3+
"name": "foo-last-list-smp",
4+
"author": "Ivo Barros",
5+
"id": "{152DE6E6-A5D6-4434-88D8-E9FF00130BF9}",
6+
"description": "Create playlists from Last.fm urls",
7+
"shouldGrabFocus": true,
8+
"enableDragDrop": false
9+
}

main/last_list/last_list_button.js renamed to scripts/button.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,60 @@ function chooseButton(x, y) {
107107
}
108108

109109
return null;
110+
}
111+
112+
// Callbacks
113+
let g_down = false;
114+
let cur_btn = null;
115+
116+
function on_paint(gr) {
117+
gr.FillSolidRect(0, 0, window.Width, window.Height, utils.GetSysColour(15));
118+
drawAllButtons(gr);
119+
}
120+
121+
function on_mouse_move(x, y) {
122+
let old = cur_btn;
123+
cur_btn = chooseButton(x, y);
124+
125+
if (old === cur_btn) {
126+
if (g_down) {
127+
return;
128+
}
129+
} else if (g_down && cur_btn && cur_btn.state !== ButtonStates.down) {
130+
cur_btn.changeState(ButtonStates.down);
131+
window.Repaint();
132+
return;
133+
}
134+
135+
old && old.changeState(ButtonStates.normal);
136+
cur_btn && cur_btn.changeState(ButtonStates.hover);
137+
window.Repaint();
138+
}
139+
140+
function on_mouse_leave() {
141+
g_down = false;
142+
143+
if (cur_btn) {
144+
cur_btn.changeState(ButtonStates.normal);
145+
window.Repaint();
146+
}
147+
}
148+
149+
function on_mouse_lbtn_down(x, y) {
150+
g_down = true;
151+
152+
if (cur_btn) {
153+
cur_btn.changeState(ButtonStates.down);
154+
window.Repaint();
155+
}
156+
}
157+
158+
function on_mouse_lbtn_up(x, y) {
159+
g_down = false;
160+
161+
if (cur_btn) {
162+
cur_btn.onClick();
163+
cur_btn.changeState(ButtonStates.hover);
164+
window.Repaint();
165+
}
110166
}
File renamed without changes.

0 commit comments

Comments
 (0)