aboutsummaryrefslogtreecommitdiff
path: root/Src/resources/skins/Big Bento/scripts/simplemaximize.m
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/resources/skins/Big Bento/scripts/simplemaximize.m
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/resources/skins/Big Bento/scripts/simplemaximize.m')
-rw-r--r--Src/resources/skins/Big Bento/scripts/simplemaximize.m72
1 files changed, 72 insertions, 0 deletions
diff --git a/Src/resources/skins/Big Bento/scripts/simplemaximize.m b/Src/resources/skins/Big Bento/scripts/simplemaximize.m
new file mode 100644
index 00000000..cc255edd
--- /dev/null
+++ b/Src/resources/skins/Big Bento/scripts/simplemaximize.m
@@ -0,0 +1,72 @@
+/**
+ * simlple maximize script
+ *
+ * doesn't require a registry store, so ideal for standardframes
+ * required objects: maximize & restore as buttons
+ *
+ * @author mpdeimos
+ * @version 0.1
+ */
+
+#include <lib/std.mi>
+
+Global Button restore, maximize;
+Global Layout parent;
+
+Global Int lx, ly, lw, lh;
+
+System.onScriptLoaded ()
+{
+ restore = getScriptGroup().findObject("restore");
+ maximize = getScriptGroup().findObject("maximize");
+ parent = getScriptGroup().getParentLayout();
+
+ lx = -1;
+ ly = -1;
+ lh = -1;
+ lw = -1;
+}
+
+parent.onResize (int x, int y, int w, int h)
+{
+ double d = getScale();
+ if (getLeft() == getViewPortLeftfromGuiObject(parent) && getTop() == getViewPortTopfromGuiObject(parent) && getWidth() == getViewPortWidthfromGuiObject(parent)/d && getHeight() == getViewPortHeightfromGuiObject(parent)/d)
+ {
+ restore.show();
+ maximize.hide();
+ }
+ else
+ {
+ restore.hide();
+ maximize.show();
+ }
+}
+
+maximize.onLeftClick ()
+{
+ lx = parent.getLeft();
+ ly = parent.getTop();
+ lw = parent.getWidth();
+ lh = parent.getHeight();
+
+ double d = parent.getScale();
+ parent.resize(getViewPortLeftfromGuiObject(parent), getViewPortTopfromGuiObject(parent), getViewPortWidthfromGuiObject(parent)/d, getViewPortHeightfromGuiObject(parent)/d);
+}
+
+
+restore.onLeftClick ()
+{
+ if (lx == -1)
+ lx = parent.getLeft() - 75;
+ if (ly == -1)
+ ly = parent.getTop() - 75;
+ if (lw == -1)
+ lw = parent.getWidth() - 150;
+ if (lh == -1)
+ lh = parent.getHeight() - 150;
+
+ parent.resize(lx,ly,lw,lh);
+}
+
+
+// TODO (mpdeimos) add scale recognizing