Then over in Plugins.cpp:
-------------------------------------
1. Add the function:
void ToolbarSetVisibility (int idx, int b)
{
if(b==0)
theApp.m_pMostRecentBrowserFrame->m_wndReBar.SetVisibility(idx, FALSE);
else
theApp.m_pMostRecentBrowserFrame->m_wndReBar.SetVisibility(idx, TRUE);
}
2. Add "ToolbarSetVisibility" to the bottom of kmeleonFunctions kmelFuncs = {};
Last, in kmeleon_plugin.h
----------------------------------------
1. Add the definition as follows at the very bottom of the structure, typedef struct {} kmeleonFunctions;
// toggles toolbar visibility
void (*ToolbarSetVisibility)(int idx, int b);
Ok, now I make a macro as follows:
----------------------------------------------------
test{
$vis = "";
$tb_idx = getpref(INT,"kmeleon.toolband.Throbber.index");
getpref(BOOL, "kmeleon.toolband.Throbber.visibility")=="true" ? $vis="false" : $vis="true";
$vis == "true" ? setpref(BOOL, "kmeleon.toolband.Throbber.visibility", true) : setpref(BOOL, "kmeleon.toolband.Throbber.visibility", false);
$vis == "true" ? tbtoggle($tb_idx, 1) : tbtoggle($tb_idx, 0);
}
Now...expected behavior is that the Throbber would disapear, and the pref would be set to false, since it is visible by default and the pref is true...what actually happens is the pref is set to false and SOME OTHER toolband is hidden.
HUH?? That's what I said too...
So, after playing with this for a bit, I found out the correct index numbers that needed to be passed to m_wndReBar.SetVisibility()
0 for "Url Bar"
1 for "Throbber"
2 for "Layers"
3 for "Tool Bar"
4 for "QuickLaunch"
5 for "Menu"
6 for "Bookmarks"
and so on...
The problem is that these don't match the index in the pref file, which says:
And these values in Prefs.js change based on the z-order of the toolbars.
Now, I also tried unprotecting the function member FindByName() and using the value it returned as the index, but it returned the same value that is in the prefs file...
I am trying to figure out how to get this real index values above, as opposed to the z-order index values stored in the prefs file.
I'm thinking the order for the real index values go like this:
K-meleon defaults:
0 for "Url Bar"
1 for "Throbber"
If the layers plugin is loaded:
2 for "Layers"
Toolbar default toolband, plus any extra in toolbars.cfg:
3 for "Tool Bar"
4 for "QuickLaunch"
Menu defaults from menus.cfg:
5 for "Menu"
Any extra plugin toolbars:
6 for "Bookmarks"
(????) 7 for "Hotlist" (????)
(????) 8 for "Favorites" (????)
One good thing however, is that after you figure out the real index values they don't seem to change.
2. Add "ToggleToolbarVisibility" to the bottom of kmeleonFunctions kmelFuncs = {};
Last, in kmeleon_plugin.h
----------------------------------------
1. Add the definition as follows at the very bottom of the structure, typedef struct {} kmeleonFunctions;
In accel.cfg use the values 2000 - 2049 instead of ID strings. In my setup I have the menu bar (which is static) and on the next row, the toolbar (back,forward,reload,stop), url bar, and throbber. 2000 = url bar, 2001 = throbber, 2002 = tool bar.
So ALT 1 = 2002 in accel.cfg toggles the tool bar. I have no idea (yet) what the deal is with the order. In prefs.js they're in screen order (0 = tool bar, 1 = url bar, 2 = throbber). Note there is a ID_VIEW_STATUS_BAR command which toggles the status bar.
That will set all the visible to invisible, but since we're not changing the perf file there, they will still all have the same settings, so running the same macro again will reshow the originally showing toolbands--exactly like the fullscreen plugin does.
OK, this appears to be the rundown on the index values:
From what I can gather all values are relative to 0.
If any particular toolband is not LOADED (I don't mean not showing, I mean the plugin is not loaded or, the plugin is loaded but the toolbar option is not enabled), then the values change relatively.
Here are the values with all the toolbars possible, as well as an extra one from toolbars.cfg (namely, Quicklaunch):
0 - toolband.URL Bar
1 - toolband.Throbber
2 - toolband.Layers
3 - toolband.Hotlist
4 - toolband.Favorites
5 - toolband.Winamp
6 - toolband.Tool Bar
7 - toolband.Quicklaunch
8 - toolband.Menu
9 - toolband.Bookmarks
Here is what they look like without the Hotlist or Favorites plugins loaded:
0 - toolband.URL Bar
1 - toolband.Throbber
2 - toolband.Layers
3 - toolband.Winamp
4 - toolband.Tool Bar
5 - toolband.Quicklaunch
6 - toolband.Menu
7 - toolband.Bookmarks
Here is what they look like without the Hotlist or Favorites or Winamp plugins loaded, and without the Quicklaunch definition in toolbars.cfg:
0 - toolband.URL Bar
1 - toolband.Throbber
2 - toolband.Layers
3 - toolband.Tool Bar
4 - toolband.Menu
5 - toolband.Bookmarks
Can you please confirm this, and also test out the tbtoggle() functionality?
The index numbers are assigned in toolbar creation order so the URL bar will always be first (0) and the throbber second (1), then the plugins, most likely in the order they are in the kplugins subdirectory.
On the issue of accelerators here's a minor update - currently the pgup and pgdn keys are VK_PRIOR and VK_NEXT (apparently a win32 thing). There should be aliases VK_PAGE_UP and VK_PAGE_DOWN. Adding the following to AccelParser.cpp addresses this (bug 376):
Yup, that worked. Bug 376 is fixed. In a few minutes I'll update the binary at http://monkeesage.d2g.com/k-meleon.exe for this fix and the prefs panel fix.