webamp/packages/webamp-modern/assets/winamp_classic/scripts/actioninfo.m
Fathony Luthfillah 6a97db0a13
x2nie dev8 (Multi Skin Engines) (#1203)
* prettier

* typo

* bugfix: expect error on non supported skin format

* multiple instance, different gamma (colors)

* bugfix colortheme bg, cleanup

* prettier

* back to load single skin, del dead code

* del hack()

* trial to rename 'parse' -> skinengine_wal

* fully SkinEngine_Audio

* cleanup console warn.

* real switchSkin

* integrate WAL parser with plugable skinEngine.

* +KJofol !

* show Vis, Song,

* +WindowsMediaPlayer: Engine,Skins.

* load JS

* MMD3's header: movable

* +DialKnob

* +Button for down image that use global bmp

* preparing to Dock (layout name|mode)

* dock!

* undoc button

* +FloodLevel: kjofol seek. only ui/drag-mouse

* bugfix can't click

* +slider action.

* del dead code

* bugfix on switch kjofol skin

* call dispose() on switch skin

* bugfix Audion timer.

* bugfix loading skin*.zip, bugfix knob

* demo: loading .zip (unknown|ambiguous ext)

* just rename file

* wsz: failed to load wsz:(

* default Equalizer: missing #11,#12

* loading classic skin .wsz

* bugfix: don't stop when bitmap not found

* maximum viable.

* Replace the previous base with DeClassified

This commit aims to replace the base used for rendering Classic Skins in Webamp Modern with the latest commit of DeClassified

* added iso support for the EQ, update base skin

* working tooltips for the time display

* rename wsz_root to skin

for some reason this still doesnt make webamp modern render the skin it's given

* a bunch of things

* allow wsz_root to skin. (failed due missing files)

* prettier

* add but ignore. maybe soon be used

* temporary disabling "application.mi"

* reusing old classic code, that works

* + manifesto

* okay, lets use skin in correct way

* ren file

* redefining eq xml

* thumb background changes when mousemove

* +Pitch !

* set seek z-order to be not covering pitch.

* pitch: smooth audio effect during changes.

* bugfix normal pitch != 100%

* +Shade mode

* add objective-c syntaxt highlighter

* +Repeat, Shuffle

* Call & StrangeCall diff exploration

* +FileExtractor

* prettier.

* loading sonique for first time

* loading sonique for first time

* showing the main frame, + regional applied

* play,pause,stop

* play,pause,stop click images

* revert to using std|*.json

* show song duration (both enquee & addtrack)

* finding a correct bitrate

* +real metadata, +experiment bitRate

* show real song artist + title

* +showing real KBPS, real KHZ.

* track.id is not (can not be) required,
error on eqnueeefile()

* complete album art.

* bugfix volume onchanged

* del dead code

* lowercase key, to avoid misleading

* lowercase key, to avoid misleading

* speedup id3 parsing by Promise

* load another maki

* valid: uiRoot required for vm.

* move Track

* playlist text elipsis

* +scifi (sample skin)

* first attept to wrap text inside an irregular
shape

* reduce noise in html. => head/css.

* show cone gradient as Ring's preparation.

* show progress Ring

* both ring are now drawn.

* allow 270deg

* preparing real progress

* completing ui, no event yet

* bugfix mistaken mask

* allowing ring.action (+events)

* shuffle,repeat.

* eject

* switch to layout:NAV

* switch to layout:SMALL

* adding JetAudio support

* all bitmaps are loaded

* prevent 'undefined' id.

* show something visible :P

* preparing to load one tag with several meaning

* adding JetCowonAudio (old uib) support

* bugfix CORS issue of api.webampskins.org/graphql

* more window buttons

* add more sonique skin

* do list of ini content

* valid yarn build.

* sgf extractor

* sonique icon

* ignore 'extracted-*' folders

* add more sonique skin to load

* custom bitmap (just shown)

* just colorized

* maybe yes/no. colors is not confirmed

* not-found items (
taken from sonique install dir)

* load global png: via .ts

* show icons in circle buttons!

* exploring rgn (failed)

* can load from path (yeah, slow! :v)

* add freform/winamp

* add lineHeight to adjust font-size

* add border-bottom of menus

* prefix css (scrollbars)

* just commit, whatever.

* bugfix frequency position (not overlaped)

* +Menu ! (can only hover & mouse-down)

* still bugfix lineheight of titlebar's text

* show deprecated class

* show deprecated methods

* better on showing deprecated

* bugfix Menu.GUID

* force lowercase

* menus res

* set zero as a valid value of calcelation.

* completing Container props

* add more props, and also by retype (lowcase typo)

* pre-add

* +List, etc.

* addd more props

* rename _width -> _w & _height -> _h

* +onresize

* more detail message of too many similar error

* +ontextchanged

* log description on where the error come?

* avoid missing script id. (better debug)

* attaching WindowHolder

* my BigBento is just working (some hardcoded)

* add (my hacked) BigBento into selection.

* rename: _resizable -> _canResize. to avoid conflict
in Frame

* Frame.from = L

* a bit better. but not reflect on toggle click.

* reaching 71% of maki implementation

* mute frame border

* MUTE GRAPHQL ERROR CORS.

* dummy method: addSubMenu

* oke lah. lumayan

* implement windowholder for PL (only).

* correct align children: left & right.

* a bit better (assuring all key = lowercased)

* recompile some scripts

* bugfix thinger

* +MMD3 with thinger included (standalone)

* bugfix mono/stereo  get by text.display="songinfo"

* +winamp browser

* + Maki Explorer

* +fake implementation

* Big Bugfix: COnfig Item

* I understand, bud no found any mistake

* trial to compare string == insensitive

* trial to compare string != insensitive

* trial to case insensitive

* trial to compare string != insensitive

* bugfix triggering multi events

* set DEBUG, doesnt work :(

* more preserved guid

* mice down/up = work. but no visually.

* add undefined as fake

* implement fake Popup > open @mouse-hover

* bugfix: hover didn't work

* mute lint error

* bugfix xmlParam -> toLowerCase

* failed code to comment:

* allow bool as int

* mute console

* unhide text when not expanded | to find a text

* inpect "Class" in binary (distinct to other var)

* bugfix CORS cdn. , wait until user click demo.

* bugfix reading unicode char.

* Mad Apple Girl dancing

* Mad Apple Girl skin

* bad apple HD

* set back Text to be used by titlebar

* Completing missing classes (For better
 maki explorer / maki understanding)

* split editor to 2, for comparing up & down

* mark CLASS. by subclassing of vars identification

* Full speed animation

* add more maki: Application, File+XmlDoc

* add more maki: Application, File+XmlDoc

* more info when error (id of script)

* +global: application. +few methods

* +few methods.

* beautify (format doc), (typo)

* bugfix eris-lund: found a fatal error/program stop

* Class defintion (in maki file) is back supported.

* STUPID? mute ERROR. (don't stop)

* set back to very-simple logic

* implement alternateText

* bugfix a maki file loaded twice (multi)

* + trigger event in a class.

* mute console

* sorry, for hardcoded. ;p

* clean up uneeded dependency

* load very simple part: main.bmp + cbutton.bmp

* load main.shaded

* bitrates

* bitrates

* more classic skin

* + note & link, +full bitlist

* more classic items

* more progress.

* ++ various implementation, based on /progress

* *.WMZ region.txt is now ready !

* typo.

* integrate play/pause/stop statuses + mono|stereo

* network status

* change: wa.play.red => traffic.red (buffering)

* Volume + Pan

* EQ + PL buttons

* bugfix Text (char not found , too narrow
 bitmapfont)

* TIME text is clickable

* +Shuffle + Repeat

* better pseudo minus sign taken from "5" & "7" char

* pixel-perfect of Timer (text) of WInamp Modern.

* completing classic.player (container)

* completing VISCOLOR.txt parsing & applying values

* bugfix wrong parameter of vis

* Allow bitmap transparency by color (WMP)

* bugfix wrong parameter of vis

* Green Head is back running! (WMP)

* running WMP correctly

* running WMP correctly: background-color

* format from root dir

* format from root dir

* reduce lint complain

* del unknown file

---------

Co-authored-by: Fathony <fathony@smart-leaders.net>
Co-authored-by: Eris Lund <38136789+0x5066@users.noreply.github.com>
2023-02-23 08:41:17 -05:00

369 lines
No EOL
13 KiB
Objective-C

//Taken straight out of Winamp Modern's display.m.
//Modified to include the Volume change, balance change,
//EQ change messages. Also hooks into the Main Window
//and Equalizer for obvious reasons.
//Now handles switching most of the main windows,
//the Equalizer does this on it's own, though the
//mechanism is the same.
#include "../../../lib/std.mi"
#include "..\..\..\lib/winampconfig.mi"
#include "IsWACUP.m"
Global Group frameGroup, frameGroupEQ, frameGroupEQShade, frameGroupPL, frameGroupShade, frameGroupVideo;
Global Togglebutton ShuffleBtn, RepeatBtn/*, CLBA*/;
Global Timer SongTickerTimer;
Global Text InfoTicker;
Global GuiObject SongTicker;
Global Slider Balance, BalanceEQ;
Global Layout Normal, ShadeEQ, NormalEQ;
Global Layer wacupmain, wacuptitlebar, wacupshade;
Global Layer wacuppl1, wacuppl2, wacuppl3, wacuppl4, wacuppl5, wacuppl6, wacuppl7, wacuppl8, wacuppl9, wacupplvis, wacupplcenter;
Global Layer wacupvideo1, wacupvideo2, wacupvideo3, wacupvideo4, wacupvideo5, wacupvideo6, wacupvideo7, wacupvideo8, wacupvideo9;
Global Slider Seeker;
Global Int Seeking;
Global Boolean manual_set;
#define ISOBANDS "31.5 Hz,63 Hz,125 Hz,250 Hz,500 Hz,1 KHz,2 KHz,4 KHz,8 KHz,16 KHz"
#define WINAMPBANDS "70 Hz,180 Hz,320 Hz,600 Hz,1 KHz,3 KHz,6 KHz,12 KHz,14 KHz,16 KHz"
System.onScriptLoaded(){
initDetector();
WinampConfigGroup eqwcg = WinampConfig.getGroup("{72409F84-BAF1-4448-8211-D84A30A1591A}");
int freqmode = eqwcg.getInt("frequencies"); // returns 0 for classical winamp levels, 1 for ISO levels
frameGroup = getContainer("Main").getLayout("Normal");
frameGroupShade = getContainer("Main").getLayout("shade");
wacupshade = frameGroupShade.findObject("washade");
SongTicker = frameGroup.findObject("songticker");
InfoTicker = frameGroup.findObject("infoticker");
Balance = frameGroup.findObject("Balance");
wacupmain = frameGroup.findObject("mainwnd");
wacuptitlebar = frameGroup.findObject("wa.titlebar");
frameGroupEQShade = getContainer("eq").getLayout("shadeeq");
BalanceEQ = frameGroupEQShade.findObject("Balance");
frameGroupEQ = getContainer("eq").getLayout("eq");
frameGroupVideo = getContainer("video").getLayout("normal");
normal = getContainer("main").getlayout("normal");
shadeeq = getContainer("eq").getlayout("shadeeq");
normalEQ = getContainer("eq").getlayout("eq");
frameGroupPL = getContainer("PL").getLayout("normal");
SongTickerTimer = new Timer;
SongTickerTimer.setDelay(1000);
RepeatBtn = frameGroup.findObject("Repeat");
ShuffleBtn = frameGroup.findObject("Shuffle");
//CLBA = frameGroup.findObject("CLB.A");
Seeker = frameGroup.findObject("player.slider.seek");
SongTicker = frameGroup.findObject("songticker");
InfoTicker = frameGroup.findObject("infoticker");
wacuppl1 = frameGroupPL.findObject("wa2.pl1");
wacuppl2 = frameGroupPL.findObject("wa2.pl2");
wacuppl3 = frameGroupPL.findObject("wa2.pl3");
wacuppl4 = frameGroupPL.findObject("wa2.pl4");
wacuppl5 = frameGroupPL.findObject("wa2.pl5");
wacuppl6 = frameGroupPL.findObject("wa2.pl6");
wacuppl7 = frameGroupPL.findObject("wa2.pl7");
wacuppl8 = frameGroupPL.findObject("wa2.pl8");
wacuppl9 = frameGroupPL.findObject("wa2.pl9");
wacupplcenter = frameGroupPL.findObject("pl.center.logo");
wacupplvis = frameGroupPL.findObject("pl.vis.area");
wacupvideo1 = frameGroupVideo.findObject("video.topleft");
wacupvideo2 = frameGroupVideo.findObject("video.stretchybit");
wacupvideo3 = frameGroupVideo.findObject("video.center");
wacupvideo4 = frameGroupVideo.findObject("video.topright");
wacupvideo5 = frameGroupVideo.findObject("video.left");
wacupvideo6 = frameGroupVideo.findObject("video.right");
wacupvideo7 = frameGroupVideo.findObject("video.bottomleft");
wacupvideo8 = frameGroupVideo.findObject("video.bottom.stretchybit");
wacupvideo9 = frameGroupVideo.findObject("video.bottomright");
if(IsWACUP != 0){
wacupmain.setXmlParam("image", "wacup.main");
wacuptitlebar.setXmlParam("image", "wacup.titlebar.on");
wacuptitlebar.setXmlParam("inactiveimage", "wacup.titlebar.off");
wacupshade.setXmlParam("image", "wacup.player.shade.enabled");
wacupshade.setXmlParam("inactiveimage", "wacup.player.shade.disabled");
wacuppl1.setXmlParam("image", "wacup.pl.1");
wacuppl1.setXmlParam("inactiveimage", "wacup.pl.1.disabled");
wacuppl2.setXmlParam("image", "wacup.pl.2");
wacuppl2.setXmlParam("inactiveimage", "wacup.pl.2.disabled");
wacuppl3.setXmlParam("image", "wacup.pl.3");
wacuppl3.setXmlParam("inactiveimage", "wacup.pl.3.disabled");
wacuppl4.setXmlParam("image", "wacup.pl.4");
wacuppl6.setXmlParam("image", "wacup.pl.6");
wacuppl7.setXmlParam("image", "wacup.pl.7");
wacuppl8.setXmlParam("image", "wacup.pl.8");
wacuppl9.setXmlParam("image", "wacup.pl.9");
wacupplcenter.setXmlParam("image", "wacup.pl.2.center");
wacupplcenter.setXmlParam("inactiveimage", "wacup.pl.2.center.disabled");
wacupplvis.setXmlParam("image", "wacup.pl.8.vis");
wacupvideo1.setXmlParam("image", "wacup.video.topleft.active");
wacupvideo1.setXmlParam("inactiveimage", "wacup.video.topleft.inactive");
wacupvideo2.setXmlParam("image", "wacup.video.top.stretchybit.active");
wacupvideo2.setXmlParam("inactiveimage", "wacup.video.top.stretchybit.inactive");
wacupvideo3.setXmlParam("image", "wacup.video.top.center.active");
wacupvideo3.setXmlParam("inactiveimage", "wacup.video.top.center.inactive");
wacupvideo4.setXmlParam("image", "wacup.video.topright.active");
wacupvideo4.setXmlParam("inactiveimage", "wacup.video.topright.inactive");
wacupvideo5.setXmlParam("image", "wacup.video.left");
wacupvideo6.setXmlParam("image", "wacup.video.right");
wacupvideo7.setXmlParam("image", "wacup.video.bottomleft");
wacupvideo8.setXmlParam("image", "wacup.video.bottom.stretchybit");
wacupvideo9.setXmlParam("image", "wacup.video.bottomright");
}else{
wacupmain.setXmlParam("image", "wa.main");
wacuptitlebar.setXmlParam("image", "wa.titlebar.on");
wacuptitlebar.setXmlParam("inactiveimage", "wa.titlebar.off");
wacupshade.setXmlParam("image", "wa2.player.shade.enabled");
wacupshade.setXmlParam("inactiveimage", "wa2.player.shade.disabled");
wacuppl1.setXmlParam("image", "wa2.pl.1");
wacuppl1.setXmlParam("inactiveimage", "wa2.pl.1.disabled");
wacuppl2.setXmlParam("image", "wa2.pl.2");
wacuppl2.setXmlParam("inactiveimage", "wa2.pl.2.disabled");
wacuppl3.setXmlParam("image", "wa2.pl.3");
wacuppl3.setXmlParam("inactiveimage", "wa2.pl.3.disabled");
wacuppl4.setXmlParam("image", "wa2.pl.4");
wacuppl6.setXmlParam("image", "wa2.pl.6");
wacuppl7.setXmlParam("image", "wa2.pl.7");
wacuppl8.setXmlParam("image", "wa2.pl.8");
wacuppl9.setXmlParam("image", "wa2.pl.9");
wacupplcenter.setXmlParam("image", "wa2.pl.2.center");
wacupplcenter.setXmlParam("inactiveimage", "wa2.pl.2.center.disabled");
wacupplvis.setXmlParam("image", "wa2.pl.8.vis");
wacupvideo1.setXmlParam("image", "video.topleft.active");
wacupvideo1.setXmlParam("inactiveimage", "video.topleft.inactive");
wacupvideo2.setXmlParam("image", "video.top.stretchybit.active");
wacupvideo2.setXmlParam("inactiveimage", "video.top.stretchybit.inactive");
wacupvideo3.setXmlParam("image", "video.top.center.active");
wacupvideo3.setXmlParam("inactiveimage", "video.top.center.inactive");
wacupvideo4.setXmlParam("image", "video.topright.active");
wacupvideo4.setXmlParam("inactiveimage", "video.topright.inactive");
wacupvideo5.setXmlParam("image", "video.left");
wacupvideo6.setXmlParam("image", "video.right");
wacupvideo7.setXmlParam("image", "video.bottomleft");
wacupvideo8.setXmlParam("image", "video.bottom.stretchybit");
wacupvideo9.setXmlParam("image", "video.bottomright");
}
}
Normal.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
{
if (strlower(action) == "showinfo")
{
SongTicker.hide();
SongTickerTimer.start();
InfoTicker.setText(param);
InfoTicker.show();
}
else if (strlower(action) == "cancelinfo")
{
SongTickerTimer.onTimer();
}
}
NormalEQ.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
{
if (strlower(action) == "showinfo")
{
SongTicker.hide();
SongTickerTimer.start();
InfoTicker.setText(param);
InfoTicker.show();
}
else if (strlower(action) == "cancelinfo")
{
SongTickerTimer.onTimer();
}
}
SongTickerTimer.onTimer() {
SongTicker.show();
InfoTicker.hide();
SongTickerTimer.stop();
}
System.onScriptUnloading() {
delete SongTickerTimer;
}
Balance.onSetPosition(int newpos)
{
string t=translate("Balance")+":";
if (newpos==127) t+= " " + translate("Center");
if (newpos<127) t += " " + integerToString((100-(newpos/127)*100))+"% "+translate("Left");
if (newpos>127) t += " " + integerToString(((newpos-127)/127)*100)+"% "+translate("Right");
SongTickerTimer.start();
SongTicker.hide();
InfoTicker.show();
InfoTicker.setText(t);
}
System.onvolumechanged(int newvol)
{
SongTickerTimer.start();
SongTicker.hide();
InfoTicker.show();
InfoTicker.setText(translate("Volume") + ": " + integerToString(newvol/2.55) + "%");
}
RepeatBtn.onToggle(boolean on) {
SongTickerTimer.start();
int v = getCurCfgVal();
SongTicker.hide();
InfoTicker.show();
if (on) InfoTicker.setText("Repeat: ON"); else InfoTicker.setText("Repeat: OFF");
}
ShuffleBtn.onToggle(boolean on) {
SongTickerTimer.start();
SongTicker.hide();
InfoTicker.show();
if (on) InfoTicker.setText("Shuffle: ON"); else InfoTicker.setText("Shuffle: OFF");
}
/*
CLBA.onToggle(boolean on) {
SongTickerTimer.start();
SongTicker.hide();
InfoTicker.show();
if (on) InfoTicker.setText("Enable Always-on-Top"); else InfoTicker.setText("Disable Always-on-Top");
}*/
shadeEQ.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
{
if (strlower(action) == "showinfo")
{
SongTicker.hide();
SongTickerTimer.start();
InfoTicker.setText(param);
InfoTicker.show();
}
else if (strlower(action) == "cancelinfo")
{
SongTickerTimer.onTimer ();
}
}
BalanceEQ.onSetPosition(int newpos)
{
string t=translate("Balance")+":";
if (newpos==127) t+= " " + translate("Center");
if (newpos<127) t += " " + integerToString((100-(newpos/127)*100))+"% "+translate("Left");
if (newpos>127) t += " " + integerToString(((newpos-127)/127)*100)+"% "+translate("Right");
SongTickerTimer.start();
SongTicker.hide();
InfoTicker.show();
InfoTicker.setText(t);
}
SongTickerTimer.onTimer() {
SongTicker.show();
InfoTicker.hide();
SongTickerTimer.stop();
}
System.onScriptUnloading() {
delete SongTickerTimer;
}
Seeker.onSetPosition(int p) {
if (seeking) {
String propertime;
String propertime2;
Float f;
f = p;
f = f / 255 * 100;
Float len = getPlayItemLength();
if (len != 0) {
int np = len * f / 100;
if(np < 600000){
propertime = "0"+integerToTime(np);
}
else{
propertime = integerToTime(np);
}
if(len < 600000){
propertime2 = "0"+integerToTime(len);
}
else{
propertime2 = integerToTime(len);
}
SongTickerTimer.start();
SongTicker.hide();
InfoTicker.show();
InfoTicker.setText(translate("Seek to") + ": " + propertime + "/" + propertime2 + " (" + integerToString(f) + "%)");
}
}
}
Seeker.onLeftButtonDown(int x, int y) {
seeking = 1;
}
Seeker.onLeftButtonUp(int x, int y) {
seeking = 0;
SongTickerTimer.start();
SongTicker.show();
InfoTicker.hide();
}
Seeker.onSetFinalPosition(int p) {
SongTickerTimer.start();
SongTicker.show();
InfoTicker.hide();
}
system.onEqBandChanged(int band, int value)
{
if (manual_set) return;
String t;
Float f = value;
f = f / 10.5;
WinampConfigGroup eqwcg = WinampConfig.getGroup("{72409F84-BAF1-4448-8211-D84A30A1591A}");
if (eqwcg.getInt("frequencies") == 1) {
if (f >= 0) t = "EQ: " + translate(getToken(ISOBANDS,",",band)) + ": +" + floattostring(f, 1) + " "+ translate("dB");
else t = "EQ: " + translate(getToken(ISOBANDS,",",band)) + ": " + floattostring(f, 1) + " "+ translate("dB");
}
else {
if (f >= 0) t = "EQ: " + translate(getToken(WINAMPBANDS,",",band)) + ": +" + floattostring(f, 1) + " "+ translate("dB");
else t = "EQ: " + translate(getToken(WINAMPBANDS,",",band)) + ": " + floattostring(f, 1) + " "+ translate("dB");
}
normal.sendAction("showinfo", t, 0,0,0,0);
}
system.onEqPreampChanged(int value)
{
slider s = frameGroupEQ.findObject("preamp");
value = s.getPosition(); // Somehow this function returns a range from [-127;125] with hotpos -3, so we take the slider instead
String t = "EQ: " + translate("Preamp:") + " ";
Float f = value;
f = f / 10.5;
if (f >= -3) t += "+"+floattostring(f, 1) + " "+ translate("dB");
else t += floattostring(f, 1) + " "+ translate("dB");
normal.sendAction("showinfo", t, 0,0,0,0);
}