Initial community commit

This commit is contained in:
Jef 2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit fc06254474
16440 changed files with 4239995 additions and 2 deletions

View file

@ -0,0 +1,110 @@
#include <lib/std.mi>
#define MARGIN 2
#define MARGIN_PRE 2
#define MARGIN_POST 6
#define CHECKMARK_WIDTH 10
#define ARROW_WIDTH 10
Function setArrow(int want);
Function setCheckmark(int want);
Function updatePos();
Global Group mgrp;
Global GuiObject background;
Class GuiObject ItemSwitcher;
Global int id;
Global int want_checkmark;
Global int want_arrow;
Global ItemSwitcher a, b, c, d;
Global GuiObject _a, _b, _c;
System.onScriptLoaded() {
mgrp = getScriptGroup();
if (mgrp == NULL) {
messagebox("popupitem.maki: cannot run outside a group", "Error", 0, "");
return;
}
_a = mgrp.getObject("popup.item.checkmark"); a = _a;
_b = mgrp.getObject("popup.item.text"); b = _b;
_c = mgrp.getObject("popup.item.submenuarrow"); c = _c;
background = mgrp.getObject("popup.background"); d = background;
want_checkmark = -1;
want_arrow = -1;
}
mgrp.onNotify(String command, String param, int a, int b) {
if (command == "id") id = StringToInteger(param);
if (command == "arrow") setArrow(StringToInteger(param));
if (command == "checkmark") setCheckMark(StringToInteger(param));
}
ItemSwitcher.onEnterArea() {
background.cancelTarget();
background.setAlpha(255);
}
ItemSwitcher.onLeaveArea() {
background.setTargetA(0);
background.setTargetSpeed(0.25);
background.gotoTarget();
}
ItemSwitcher.onLeftButtonDown(int x, int y) {
mgrp.endModal(id);
}
setArrow(int want) {
if (want_arrow == want) return;
want_arrow = want;
updatePos();
}
setCheckmark(int want) {
if (want_checkmark == want) return;
want_checkmark = want;
updatePos();
}
updatePos() {
int x = MARGIN;
int mx = MARGIN;
if (!want_checkmark) {
if (_a != NULL) {
_a.hide();
}
} else {
if (_a != NULL) {
_a.show();
}
x += CHECKMARK_WIDTH + MARGIN_PRE;
mx += CHECKMARK_WIDTH + MARGIN_PRE;
}
if (!want_arrow) {
if (_c != NULL) {
_c.hide();
}
} else {
if (_c != NULL) {
_c.show();
}
mx += ARROW_WIDTH + MARGIN_POST;
}
mx += MARGIN;
if (_b != NULL) {
_b.setXmlParam("x", IntegerToString(x));
_b.setXmlParam("w", "-" + IntegerToString(mx));
}
}

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<WinampAbstractionLayer version="0.7">
<groupdef id="wasabi.popup.main.group" inherit_group="wasabi.panel" background="studio.popup.background" rectrgn="1" autowidthsource="popup.content" autoheightsource="popup.content">
<GroupList id="popup.content" x="2" y="2" w="-4" h="-4" relatw="1" relath="1" />
</groupdef>
<groupdef id="wasabi.popup.image.item">
<layer id="popup.item.layer" x="16" y="0" w="0" relatw="1" h="0" relath="1" />
</groupdef>
<groupdef id="wasabi.popup.text.item" h="16" autowidthsource="popup.item.text" >
<rect id="popup.background" color="128,128,230" filled="1" x="0" y="0" w="0" h="0" relatw="1" relath="1" alpha="0"/>
<button
id="popup.item.checkmark"
x="2" y="3" h="9" w="10"
activeimage="wasabi.popup.menu.check"
/>
<text
id="popup.item.text"
default="Popup Item"
x="42" y="0"
w="-28" relatw="1" h="15"
font="arial" fontsize="14"
color="black"
/>
<button
id="popup.item.submenuarrow"
x="-8" relatx="1" y="3" w="10" h="9"
activeimage="wasabi.popup.menu.submenu"
/>
<script file="popupitem.maki" />
</groupdef>
<groupdef id="wasabi.popup.separator.item">
<group id="wasabi.panel" x="1" y="0" w="-2" relatw="1" h="0" relath="1" />
</groupdef>
</WinampAbstractionLayer>