PDA

View Full Version : How do I create menus and skin options...


rohan_pwln
11th April 2005, 12:17
How the hell can I ever create a menu which will pop up on right clicking an animatedLayer or a layer or a button and how do I create custom skin options...

[thanX]

carlosp
11th April 2005, 13:25
this is a part of a script of mine, hope it helps ya :D



function loadEqPresets();
function checkCommandfunc(int checked);

global layer presetsLayer;
global text prestesInfoText;
global popupmenu eqPresetsMenu;

loadEqPresets(){

presetsLayer = normal.findobject("lcd.mode1.presets.arrow");
prestesInfoText = normal.findobject("eq.presets.infoText");

prestesInfoText.settext(getprivatestring(strSkinName, "eqpreset","Normal"));

eqPresetsMenu = new popupmenu;
eqPresetsMenu.addcommand("Choose Preset", 0,0,1);

eqPresetsMenu.addcommand("Normal", 20,0,0);


eqPresetsMenu.addcommand("Classical",1,0,0);
eqPresetsMenu.addcommand("Jazz",2,0,0);
eqPresetsMenu.addcommand("Party",3,0,0);
eqPresetsMenu.addcommand("Rock",4,0,0);
eqPresetsMenu.addcommand("Bass",5,0,0);
eqPresetsMenu.addcommand("Soft Rock",6,0,0);
eqPresetsMenu.addcommand("Punk",7,0,0);
eqPresetsMenu.addcommand("Live",8,0,0);
eqPresetsMenu.addcommand("Full Bass",9,0,0);
eqPresetsMenu.addcommand("Full Trebble",10,0,0);


}

presetsLayer.onleftbuttondown(int x, int y){
int choice = eqPresetsMenu.popatmouse();

if (choice == 20)
{
System.setEqBand(0, 0);
System.setEqBand(1, 0);
System.setEqBand(2, 0);
System.setEqBand(3, 0);
System.setEqBand(4, 0);
System.setEqBand(5, 0);
System.setEqBand(6, 0);
System.setEqBand(7, 0);
System.setEqBand(8, 0);
System.setEqBand(9, 0);
prestesInfoText.settext("NORMAL");
system.setprivatestring(strSkinName, "eqpreset","Normal");
checkCommandfunc(20);
system.setprivateint(strSkinName,"checked",20);
}else if (choice == 1)
{
System.setEqBand(0, 40);
System.setEqBand(1, 40);
System.setEqBand(2, 20);
System.setEqBand(3, 0);
System.setEqBand(4, 0);
System.setEqBand(5, 0);
System.setEqBand(6, -16);
System.setEqBand(7, -40);
System.setEqBand(8, -64);
System.setEqBand(9, -80);
prestesInfoText.settext("CLASSICAL");
system.setprivatestring(strSkinName, "eqpreset","Classical");
checkCommandfunc(1);
system.setprivateint(strSkinName,"checked",1);

}else if (choice == 2)
{
.
.
.
.
....

krckoorascic
11th April 2005, 23:58
skin options:
open Winamp Modern and find attribs.m script, you only need to change it a bit and call it from some other script (you only need to include it and onLoad call initAttribs())

when you open attribs.m you'll see lot of #define statments, this is the main one

#define CUSTOM_OPTIONSMENU_ITEMS "{1828D28F-78DD-4647-8532-EBA504B8FC04}"

you also need a "custom page", in Winamp Modern it's defined like this:

#define CUSTOM_PAGE "{26E26319-AECA-4433-B8F1-F4A5BF2A9ED5}"

you can use as much pages as you want (you'll see in WA Modern CUSOM_PAGE_DRAWER, CUSTOM_PAGE_SONGTICKER...) you may put any guid you want just use guidgen (comes with visual studio)

now, you'll see initAttribs() function, this is where all magic hapens:

ConfigItem custom_page = Config.newItem("Skin Name", CUSTOM_PAGE);

here you create your custom page (your skin options menu)

now you need to attach it to options menu, heres how you do that:

//first get handle
ConfigItem custom_options_page = Config.getItem(CUSTOM_OPTIONSMENU_ITEMS);
//then add your custom page to main options menu
ConfigAttribute submenuattrib = custom_options_page.newAttribute("Skin Name", "");
submenuattrib.setData(CUSTOM_PAGE); // discard any default value and point at our custom cfgpage


now only you need is add some menu items :)

attDesktopAlpha = custom_page.newAttribute("Enable Desktop Alpha", "1");

this will add "Enable Desktop Alpha" to skin menu (be sure you declared attDesktopAlpha as Global ConfigAttribute)
....

rohan_pwln
17th April 2005, 12:44
And what about sub-menus?

krckoorascic
17th April 2005, 21:24
first declare one more guid for e.g. "Drawers" submenu (u can use guidgen to get the guid)
like so:

#define CUSTOM_PAGE_DRAWER "{C338B30F-2A04-4b10-871F-4E9D52D62806}"


then, in initAttribs add this line:

ConfigItem custom_page_drawer = Config.newItem("Drawers", CUSTOM_PAGE_DRAWER);


then, after this peace of code (that is posted above)

//first get handle
ConfigItem custom_options_page = Config.getItem(CUSTOM_OPTIONSMENU_ITEMS);
//then add your custom page to main options menu
ConfigAttribute submenuattrib = custom_options_page.newAttribute("Skin Name", "");
submenuattrib.setData(CUSTOM_PAGE); // discard any default value and point at our custom cfgpage


add this:

ConfigAttribute drawersubmenu = custom_page.newAttribute("Drawers", "");
drawersubmenu.setData(CUSTOM_PAGE_DRAWER);


and thats all! :) u only have now to add items to custom_page_drawer, like this:

attAnimateDrawers = custom_page_drawer.newAttribute("Animate Drawers", "0");

this will add "Animate Drawers" menu item as submenu of "Drawers" menu, and again, be sure that you have declared attAnimateDrawers as

Global ConfigAttribute attAnimateDrawers;


cheers!

mike-db
18th April 2005, 04:53
now for us even STUPIDER people wtf does that mean? like do i just add that into my skin.xml file?

krckoorascic
18th April 2005, 21:39
erm.. noup :D
its done in maki :) no xml

almost every modern skin (i mean on those GOOD skins) has its option menu. for example load Winamp Modern skin and right-click it to show context menu, go to Options, there you'll see a "Winamp Modern" menu with options for that skin, also you can access this menu in winamp preferances; fire up preferances (Ctrl+P), goto "Modern Skins" then to tab "Current Skin" and you'll see a button on the bottom of that window, click it!... :)

cya

The Cool Dude
19th April 2005, 07:27
I tried this log ago. its quite simple just copy atribs.m i ur skin and play around with it replace names, etc and its done. once u do that reading this thread will help.