Jump to content

[1.2.0] Toolbar 1.7.13 - Common API for draggable/resizable buttons toolbar


blizzy78

Recommended Posts

Not sure, I'll need to think about it. You see, the problem with something like folder "hints" is that it gets tricky to decide if the folder should be added once the toolbar loads up or not. Like, is this the first time the hinting plugin is run? Or is this a subsequent run, but the user has decided to keep the folder? What do we do if the user throws the folder away (moving all buttons into the main toolbar), then restarts KSP?

The way things are right now is rather simple: Plugins add their buttons, and they usually go into the main toolbar. Then, if the user decides to add folders and put buttons into them, that information is saved, and can be used for subsequent toolbar plugin runs. There just is nothing a third-party plugin can do to override which buttons go into which folders.

Cross-responding to your post in the SteamGauges thread.

I figured it was set up something like that. I don't know that its really worth being able to force folders on users anyway, just a thought I had since I was adding no less than 10 buttons with one mod.

Keep it up!

Link to comment
Share on other sites

It's precisely because of mods like Trueborn's (thanks for adding the "ton of icons" mode) that I ask for the functionality of dragging icons from the icon repository to the toolbar(s). I actually only use one of those gauges and only want that icon. Also, the goofy way Sarbian had to add individual icons for each MechJeb module because he didn't want to spam the toolbar with icons for every module. I envision every author able to include whatever icons they want and the users able to choose from those icons (from the repository) which of them they want on the toolbar(s). The toolbar itself will just send the click notification to the icons corresponding dll and change the icon if the addon's dll tells it to.


From previous post:

Suggested toolbar functionality:

All add-ons with dependency or option for Toolbar have their icons made available in a 'toolbar icon set repository' (like the Firefox list of icons when customizing its toolbar). From drop-down menu, click "Customize" (unlock shape & position and unlock icon position functions are combined on "Customize"). The available icon set list shows up (with two buttons - "Add New Toolbar" and "Done"). Then drag and drop icons to the toolbar(s). Adjust their position(s) and/or the shape(s) and position(s) of the toolbar(s). Click "Done" in the icon set list window to finish customizing.

Get the double-horizontal-arrow or double-diagonal-arrow when mousing over border of toolbar(s) to indicate you can change size/shape. Place anchor points at 1/3 & 2/3 positions for mouse over to switch to the 'you can move the toolbar' icon.

After this fine toolbar is tweaked, I'd like to see something like the MCM for Skyrim/Fallout3 made for all the addons and stock options in Kerbal. One button on the Toolbar (same as any other toolbar icon set) to open/close the MCM (MCM with tabs to set options for all the add-ons). Each mod maker makes their own MCM plugin to set the options in their config.

Link to comment
Share on other sites

I envision every author able to include whatever icons they want and the users able to choose from those icons (from the repository) which of them they want on the toolbar(s).

While I personally find this a good concept, there is however an issue that shouldn't be overlooked: Discoverability. Say you have your toolbar all set up, then install a new plugin that adds new buttons. They won't appear on the toolbar the next time you run KSP, but instead go in a hidden repository where you can drag the ones out you want. I can already see the complaints about not finding the buttons that the new plugin is supposed to have. I don't know how many pages you read on the two Toolbar Plugin threads, but you might be surprised that some players are actually unable to find the option to reposition the toolbar because they just don't try and click on that triangle. And I actually stole the triangle button idea from other programs, so it's not like that's a new thing.

I'd like to see something like the MCM for Skyrim/Fallout3 made for all the addons

I don't know anything about that MCM thing.

Link to comment
Share on other sites

Don't worry Oinker, I've got you covered with the next release.

blizzy, I've got another thought. Other than changing the caption and visibility, how about some way to indicate if a button is selected or not? Like, changing the style to "in" instead of "out," or changing the texture. Personally, I would prefer the style change, but I'm not sure if the GUI can do that easily or not.

Link to comment
Share on other sites

I don't know anything about that MCM thing.

Okay, so I had a look to see what the MCM is. It is the Mod Configuration Menu that can be opened from the pause menu in Fallout. All mods supporting it can be configured from this central place. So essentially it is some sort of standardized interface that third-party mod authors can use, I'd guess also saving the GUI work along the way.

So while I do think that's a good thing to have (I'm used to something like that from WoW), it is clearly out of scope for the Toolbar Plugin.

Link to comment
Share on other sites

While I personally find this a good concept, there is however an issue that shouldn't be overlooked: Discoverability. Say you have your toolbar all set up, then install a new plugin that adds new buttons. They won't appear on the toolbar the next time you run KSP, but instead go in a hidden repository where you can drag the ones out you want. I can already see the complaints about not finding the buttons that the new plugin is supposed to have. I don't know how many pages you read on the two Toolbar Plugin threads, but you might be surprised that some players are actually unable to find the option to reposition the toolbar because they just don't try and click on that triangle. And I actually stole the triangle button idea from other programs, so it's not like that's a new thing.

For the icon, both on iPad and Android devices, the "Settings" icon is typically a picture of a gear. Maybe draw one up and use that instead of the DOWN arrow? I'd make a request to even highlight the button AS a button, as it could blend into the background.

As for the discoverablity ideal, the two thoughts I had on this is allowing the developers to automatically make their own folders, or, allowing the user to hide and show icons.

I've not looked at (Or remember looking at -- maybe I have?) the code or the API, so you'll have to translate.

The first thought I'd have is for your code to determine if "by default" the mod developer using your toolbar wants to throw a command into a folder directly. So in the case of MJ, using the icons for Settings, Launch and Landing icons, the developer could use something like "MJ2:Settings", "MJ2:Launch", and "MJ2:Landing". Depending on how your code creates the buttons, you may not be able to create a component named "MJ2:Landing" but prior to actually making the button, you actively change the developer naming scheme from MJ2:Landing to MJ2_Landing but then programatically go through the routine of creating the MJ2 folder then moving the MJ2_Landing button to the MJ2 folder, with appropriate config saves. As for icons, the author could also include the default icon by providing the PNG or whatever named as mj2_folder.png or define via the API what the folder icon is supposed to be. With this approach, a mod author could throw in multiple root folders if the functions of the mod conceivably cover more than one root function.

The second thought I had was just throw everything at the user at the main menu that the mod wants to have, but allow for the user to easily hide the buttons. One method would be to use the middle mouse button to hide the icons, or, ALT+Right-Click for them Mac lovers who may not have a middle button. (HOW DO YOU FUNCTION WITHOUT A MIDDLE BUTTON!?!?!) Either that, have something in the settings drop down that will allow the user to selectively hide and unhide buttons that are controlled by the toolbar.

Link to comment
Share on other sites

As for the discoverablity ideal, ... The second thought I had was just throw everything at the user at the main menu that the mod wants to have, but allow for the user to easily hide the buttons. One method would be to use the middle mouse button to hide the icons, or, ALT+Right-Click for them Mac lovers who may not have a middle button. Either that or have something in the settings drop down that will allow the user to selectively hide and unhide buttons that are controlled by the toolbar.

That works. It's just as easy to hide the unwanted icons as it is to show already hidden ones. As long as the toolbar knows which icons the user wants hidden in the different screens and there is a means of unhiding them later if the user desires, that will work.

Link to comment
Share on other sites

Toolbar Plugin 1.5.0 is now available for download, adding the ability for players to configure the visibility of each button.

With this change, there is no longer a need for plugin authors (*) to provide a configuration mechanism that lets players chose which buttons to show on the toolbar, because they can now configure that themselves. Just plop all your buttons into the Toolbar Plugin API. Of course you should continue to set IButton.Visible=false etc. as necessary.

* Hi Sarbian.

Link to comment
Share on other sites

Looks great, but after selecting which buttons i wanted to show for each page, would never close and go away. I kept changing pages until all froze. will try again and post info.

again, wow, great idea and looking good, just some new version bug(s) ....

Link to comment
Share on other sites

Looks great, but after selecting which buttons i wanted to show for each page, would never close and go away. I kept changing pages until all froze.

Not sure what you are talking about. Does "page" mean "game scene," such as vehicle assembly building or the flight scene?

Link to comment
Share on other sites

Toolbar Plugin 1.5.2 is now available for download.

I have created an official wrapper that enables plugin authors to provide Toolbar Plugin support without creating a hard dependency to it. This wrapper provides full compatibility to the Toolbar Plugin API and can be used as a complete drop-in replacement without the need to change code.

Please see the OP for details on how to use.

Edited by blizzy78
Link to comment
Share on other sites

Toolbar Plugin 1.5.2 is now available for download.

I have created an official wrapper that enables plugin authors to provide Toolbar Plugin support without creating a hard dependency to it. This wrapper provides full compatibility to the Toolbar Plugin API and can be used as a complete drop-in replacement without the need to change code.

Please see the OP for details on how to use.

Awesome Blizzy78, thanks. Just one note in your instructions for using this, I'll just "use" the namespace in my code files rather than changing the wrapper file, then updating will be easier, maybe you could add a note to that effect in the instructions - "Either Edit the namespace in ToolbarWrapper.cs to match your plugin's namespace, or call the functions via the ToolbarWrapper Namespace"

Link to comment
Share on other sites

Not changing the namespace might run the risk of having two separate copies (in different plugins) with different functionality in the same namespace. I'm not sure how the mindless DLL system handles that. It could end up with your code calling ToolbarWrapper.cs code from a different plugin that could be incompatible. Changing the namespace to your plugin's namespace will prevent that.

Link to comment
Share on other sites

So after some fiddling with the wrapper file I have it all working well, but I didn't use the same namespace as my dll as the terms Button and ClickEvent were too similar in the test project. I considered renaming em to TButton, TClickEvent, etc where necessary so I can tell a Toolbar object from others at a glance, but just using the full namespace was enough for now.

Thanks again blizzy78, I really like this, and can only see the dynamic dependacy option helping with uptake.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...