Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: WSH Panel Mod (Read 818467 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #450
T.P Wang
Code is here, at post #438. It was called from marc2003 script at #428 instead of UpdateFileInfoSimple.

WSH Panel Mod

Reply #451
@U'nik:
Have you tried 1.2.1 Beta 2, they are hopefully fixed in that version.

WSH Panel Mod

Reply #452
Testing now, it seems that with 1.2.1 the script is more stable and just says that database is locked instead object and foobar crashing.

WSH Panel Mod

Reply #453
1.2.1 Beta 3 Uploaded:

Code: [Select]
v1.2.1
- ADD: IMainMenuManager interface, use fb.CreateMainMenuManager() to create one.
- ADD: GdiDrawText() now handles DT_CALCRECT flag, eg: g.GdiDrawText(..., DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT).
- ADD: utils.GetSysColor() and utils.GetSystemMetrics() methods.
- ADD: MainMenuManager sample.
- CHG: Global callbacks are invoked asynchronously now.
- CHG: window.NotifyOthers() is now asynchronous (inflict some configs which rely on this).
- CHG: IMainMenuManager.ExecuteByID() now returns true if command was executed successfully.
- CHG: Notes & Hints.txt, tag "[OBSOLETE]".
- CHG: Help button in WSH Panel Mod Preference page is accessible now.
- DEL: Callbacks.txt, remove restriction information about global callbacks.



WSH Panel Mod

Reply #456
And WSH Panel 1.2.1 is released  now 

Code: [Select]
v1.2.1
- ADD: IMainMenuManager interface, use fb.CreateMainMenuManager() to create an instance (#Interfaces.txt).
- ADD: IStyleTextRender interface, use gdi.CreateStyleTextRender() to create an instance (#Interfaces.txt).
- ADD: GdiDrawText() now handles DT_CALCRECT flag, eg: g.GdiDrawText(..., DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT).
- ADD: utils.GetSysColor() and utils.GetSystemMetrics() methods.
- ADD: "MainMenuManager" and "Glow Text" sample.
- CHG: Global callbacks are invoked asynchronously now.
- CHG: window.NotifyOthers() is now asynchronous (inflict some configs which rely on this).
- CHG: IMainMenuManager.ExecuteByID() now returns true if command was executed successfully.
- CHG: Notes & Hints.txt, tag "[OBSOLETE]".
- CHG: Help button in WSH Panel Mod Preference page is accessible now.
- DEL: Callbacks.txt, remove restriction information about global callbacks.

WSH Panel Mod

Reply #457
The new version is great! 

But for some reason I can't create the "Help" menu.
If I try this:
mmobj.Init("Help");
or
mmobj.Init("help");

the console spits:
>>JScript runtime error:
>>Invalid procedure call or argument

Bug or idiocy?
(The other menus work perfectly btw, using latest stable fb2k and latest CUI)
<insert signature here>

WSH Panel Mod

Reply #458
Oooops, fixed, please re-download

 

WSH Panel Mod

Reply #459
How to execute submenus in this example:

Code: [Select]
    var _context = fb.CreateContextMenuManager();
    var menuman = fb.CreateMainMenuManager();
    
    var _basemenu = window.CreatePopupMenu();
    
    var _file = window.CreatePopupMenu();
    var _select = window.CreatePopupMenu();    
    
    var ret;
    
    _basemenu.AppendMenuItem(MF_STRING | MF_POPUP, _file.ID, "File");
    _basemenu.AppendMenuSeparator();
    _basemenu.AppendMenuItem(MF_STRING | MF_POPUP, _select.ID, "Selection");    

    menuman.Init("File");
    menuman.BuildMenu(_file, 1, 128);

    _context.InitContext(g_handle);
    _context.BuildMenu(_select, 2, -1);

    ret = _basemenu.TrackPopupMenu(x, y);

    if (ret == 0)
        return;

    switch (ret)

It probably looks like a mess and wrongly done, but I can't find any useful info about those functions

WSH Panel Mod

Reply #460
@2E7AH:
In menu, every menu item has an unique ID.

You built a menu which items were overlapped with each other.

WSH Panel Mod

Reply #461
Is there a way to make context menu with main menu items?

WSH Panel Mod

Reply #462
^ For example:
Code: [Select]
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;

var g_contextman = fb.CreateContextMenuManager();
var g_menuman = fb.CreateMainMenuManager();

var g_handle = fb.GetNowPlaying();

function on_mouse_lbtn_down(x, y) {
if (!g_handle) return;

var _base = window.CreatePopupMenu();
var _file = window.CreatePopupMenu();
var _select = window.CreatePopupMenu();

    _base.AppendMenuItem(MF_STRING | MF_POPUP, _file.ID, "File");
    _base.AppendMenuSeparator();
    _base.AppendMenuItem(MF_STRING | MF_POPUP, _select.ID, "Selection");   

    g_menuman.Init("File");
    g_menuman.BuildMenu(_file, 1, 32);

    g_contextman.InitContext(g_handle);
// range is different from g_menuman.BuildMenu()
    g_contextman.BuildMenu(_select, 33, -1);

    ret = _base.TrackPopupMenu(x, y);

if (ret == 0) return;

if (ret >= 1 && ret <=32) {
// File menu
g_menuman.ExecuteById(ret -1);
} else if (ret >= 33) {
g_contextman.ExecuteById(ret - 33);
}
}


WSH Panel Mod

Reply #463
Thanks T.P.Wang  ,
First time it crashed when I put the script in panel and I send the report. Now it doesn't crashes but context menu isn't triggered when I left click (or else) 

For "file" menu you entered count=32. How can I know which number to enter for "edit", "view" and other menus?
[edit] Is it 32, 64, 128... ?

WSH Panel Mod

Reply #464
@2E7AH:
It's not valid because of:
Code: [Select]
g_handle = fb.GetNowPlaying()
...
if (!g_handle) return;


Just specify a large enough range, you can specify 20, 21, 22....., up to 65535:

Code: [Select]
    1 ~ a : File
a + 1 ~ b : Edit
b + 1 ~ c : View
c + 1 ~ d : Playback
...


a - 1 = count of File menu items
b - a = count of Edit menu items
...

WSH Panel Mod

Reply #465
I can't make it, foobar constantly crashes or doesn't show the menu:

Code: [Select]
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;

var c_man = fb.CreateContextMenuManager();
var m_man = fb.CreateMainMenuManager();

var g_handle = fb.GetFocusItem();

function on_mouse_lbtn_down(x, y) {

var _base = window.CreatePopupMenu();

var _file = window.CreatePopupMenu();
var _edit = window.CreatePopupMenu();
var _view = window.CreatePopupMenu();
var _play = window.CreatePopupMenu();
var _lib = window.CreatePopupMenu();
var _help = window.CreatePopupMenu();

var _playing = window.CreatePopupMenu();
var _select = window.CreatePopupMenu();

var ret;

_base.AppendMenuItem(MF_STRING | MF_POPUP, _file.ID, "File");
_base.AppendMenuItem(MF_STRING | MF_POPUP, _edit.ID, "Edit");
_base.AppendMenuItem(MF_STRING | MF_POPUP, _view.ID, "View");
_base.AppendMenuItem(MF_STRING | MF_POPUP, _play.ID, "Playback");
_base.AppendMenuItem(MF_STRING | MF_POPUP, _lib.ID, "Library");
_base.AppendMenuItem(MF_STRING | MF_POPUP, _help.ID, "Help");
_base.AppendMenuSeparator();
_base.AppendMenuItem(MF_STRING | MF_POPUP, _select.ID, "Selection");
_base.AppendMenuItem(MF_STRING | MF_POPUP, _playing.ID, "Now Playing");

m_man.Init("File");
m_man.BuildMenu(_file, 1, 32);

m_man.Init("File");
m_man.BuildMenu(_file, 33, 64);

m_man.Init("Edit");
m_man.BuildMenu(_edit, 65, 96);

m_man.Init("View");
m_man.BuildMenu(_view, 97, 128);

m_man.Init("Playback");
m_man.BuildMenu(_play, 129, 160);

m_man.Init("Library");
m_man.BuildMenu(_lib, 161, 192);

m_man.Init("Help");
m_man.BuildMenu(_lib, 193, 224);

c_man.InitContext(g_handle);
c_man.BuildMenu(_select, 225, -1);

c_man.InitNowPlaying();
c_man.BuildMenu(_playing, 226, -1);


ret = _base.TrackPopupMenu(x, y);

if (ret == 0)
return;

if (ret >= 1 && ret <= 32) {
m_man.ExecuteById(ret - 1);
}
if (ret >= 33 && ret <= 64) {
m_man.ExecuteById(ret - 33);
}
if (ret >= 65 && ret <= 96) {
m_man.ExecuteById(ret - 65);
}
if (ret >= 97 && ret <= 128) {
m_man.ExecuteById(ret - 97);
}
if (ret >= 129 && ret <= 160) {
m_man.ExecuteById(ret - 129);
}
if (ret >= 161 && ret <= 192) {
m_man.ExecuteById(ret - 161);
}
if (ret >= 193 && ret <= 224) {
m_man.ExecuteById(ret - 193);
}
if (ret == 225) {
c_man.ExecuteById(ret - 225);
}
if (ret == 226) {
c_man.ExecuteById(ret - 226);
}

m_man.Dispose();
c_man.Dispose();
}

WSH Panel Mod

Reply #466
Hi,

I have a question: how can i get RunContextCommandWithMetadb to work with a multiple selection?
If i use getFocusItem i only get the first one.

Thanks

WSH Panel Mod

Reply #467
Quote
how can i get RunContextCommandWithMetadb to work with a multiple selection?


Unless it's been added in one of the most recent versions, I don't believe you can.

WSH Panel Mod

Reply #468
@2E7AH:
I wonder where the exception "Overflow" come from (though I've received 6 crashes about that by now from one machine), may be you should update some components.

EDIT:
PS: I knew some one will encounter "Unhanded exception: Overflow" error while they were trying to poping a main menu up.

WSH Panel Mod

Reply #469
And here I must clarify one thing:
It's not possible to create multiple submenus using main menu manager(or context menu manager) at the same time.
The .Init...() method tell that implicitly.

WSH Panel Mod

Reply #470
@2E7AH:
I finally find out one component probably cause that crash: foo_menu_addons.

WSH Panel Mod

Reply #471
Thanks for the info, I tried making it on portable without other components and while it shows nicely menu items are executed randomly

And here I must clarify one thing:
It's not possible to create multiple submenus using main menu manager(or context menu manager) at the same time.
The .Init...() method tell that implicitly.


fb.trace(ret) returns this i.e.:
"file > open" has ret = 1,
"file > open cd" has ret = 5,
"view > always on top" has ret = 78, etc

isn't possible to use that for executing right menu entries, or you are saying it's bad idea?

WSH Panel Mod

Reply #472
@2E7AH:
It's not possible now, in order to achieve that, I may write another menu generator on my own

WSH Panel Mod

Reply #473
OK, thanks for consideration and clearance 

[edit] would be great if it could be .Init("Main Menu") 

WSH Panel Mod

Reply #474
Hello. I just recently installed FooBar2000 under Wine 1.1.34 running on Kubuntu Linux 9.10/Karmic .

After the installation, FooBar worked flawlessly -- it's when I got around to installing the DarkOne v1.6
theme where problems arose.

Specifically, after importing DarkOne_v1_6.fcl from File->Preferences->Display->Columns UI->FCL importing and exporting->Import... ,
I get 3 "WSH Panel Mod" scripting errors as well as a messed up UI :

Scripting Engine Initialization Failed (GUID: F7CA1517-F171-44C3-871B-FA17038AF28A, CODE: 0x80004001): Unknown error code (2147500033)



Scripting Engine Initialization Failed (GUID: FF1A308A-F5B2-49E1-B98F-594F180E0BA6, CODE: 0x80004001): Unknown error code (2147500033)



Scripting Engine Initialization Failed (GUID: 08886804-F90F-4666-8B93-12335E0F92D8, CODE: 0x80004001): Unknown error code (2147500033)



Here's the screencap of the FB2K main window. As you can see the UI is quite screwed up :




Might anyone know what the problem could be in this case, or have a solution?

Thanks,

jdb2