toolbar - Mud-H/TorqueLab GitHub Wiki
The toolbar in TorqueLab is made to be easy to customize with a simple drag and drop system which allow to organize the toolbars as you like. To remove an icon, you simply drag it into the removal drop zone which render under toolbar when dragging an icon or icon group.
Plugins extend TorqueLab with their own interface which you have to select to use plugin features
The toolbar support different type of items which allow to organize and group icons efficiently
- Standard icon - Can be used like standard button or as toggle button.
- Special Box - Container to show any ctrl type in toolbar (Ex: Grid size edit)
- Icons Group - A group of icons that can be dragged and which add an extra spacing between groups.
- Mini Toolbar - Arrangement of icons and group into a standalone toolbar which can be hide/show at anytime (Not implemented)
- Plugin Toolbar - Toolbar which is only shown when it plugin is active
The toolbar is mainly divided in 3 parts:
- Toolbar Begin - General Items shown before Toolbar Plugins
- Toolbar Plugins - Plugin specific items
- Toolbar End - General Items shown after Toolbar Plugins
All those can have the same items and you are able to create your own items if you have a specific need. Simply use the Toolbar Manager item creator (Not implemented) to select an icon, behavior and action which you can then add to any toolbar or items group.
- Toolbar - SuperClass: ToolbarDnD class: TBDnD
- Toolbar Group - SuperClass: Draggable class: TBGroupDnD
- Toolbar Icon - SuperClass: Draggable class: TBIconDnd
- Toolbar Box - SuperClass: Draggable class: TBBoxDnd
The toolbar system is built to be as autonomous as possible so it's easy to use while developing a plugin and also simple to adapt to specific needs by adding custom toolbar items
There' various way to add new toolbar items so that anyone can create custom items quickly. You can add items by adding a specific GUI control with the proper superClass. The editor will treat them as toolbar item when it add a new toolbar item with proper superClass. There's 2 type of Gui Control that can be used for Toolbar items. GuiIconButtonCtrl for standard icon or GuiBoxCtrl (TL Box Gui COntrol) in which you can add any Gui controls you want that fit in the toolbar height, the width will be adjusted.
- ToolbarIcon - Standard GuiIconButtonCtrl in which you set your command and icon like a standard GUI. The only requirement is to set superClass to ToolbarIcon, there's other options which will be discussed after.
- ToolbarBox - GuiBoxCtrl container which can contain any Gui Control setup that you want to see in toolbar. (superClass must be ToolbarBox).Ex: Camera Speed slider
Simply create a Gui Control from script with proper superClass: ToolbarIcon or ToolbarBox. The editor will use them as toolbar item when added. GuiControls Toolbar Items Examples
To manage user UI preferences and settings, TorqueLab use a special file named user-ui.pref that have to be found in root of TorqueLab (usually tlab/). The file won't be created until a user UI setting have been saved. You can simply create one manually and edit it with your prefered text editor. By editing that file, you can customize some user general settings but also create your own UI objects. For now, it only support Toolbar items but later, some others might be added if found usefull.
TorqueLab will generate fresh icons based on the Toolbar data coming from different sources. It support standard editor GuiIconButtonCtrl controls stored in a stack but also simplified item creation from script or a preset file. It will gather toolbar items data by using different methods to get toolbar items informations. It support standard icons control like current stock T3D editor but also simplified listing using specific syntax and/or special file format. For each items found, TorqueLab create it own GuiIconButtonCtrl (or toolbar Box from source Toolbar Box Container) so they are all using same setup. Those use some reserved setting but most are overwritable if found in item data,only the bitmap is required for Icons, for others, the most common setting value change needs are: command, variable, buttonType,internalName.
The Toolbar system provide also some helpers to make it easier to use them safely regardless of their location (unlike stock T3D editor common usage with internalName check which break if icon/toolbar not in main toolbar.) It's also made to keep everything synced and up-to-date.
You can create your toolbar item (icon or box) by using standard Gui Control which are grouped under a stack with superClass setted to ToolbarStack All items generated are added to the ToolbarItems SimSet and until added to a toolbar container, they will be placed in the Disabled Bin (ToolbarDisabledBin). At end, only unused icons will be there
@startuml
package "Some Group" {
HTTP - [First Component]
[Another Component]
}
node "Other Groups" {
FTP - [Second Component]
[First Component] --> FTP
}
cloud {
[Example 1]
}
database "MySql" {
folder "This is my folder" {
[Folder 3]
}
frame "Foo" {
[Frame 4]
}
}
[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]
@enduml
All the items ( Icons and Boxes) found will be stored in an array with required informations: ` TAB TAB TAB '
- UniqueName: No other icon shold have the same name which is used as internalName to retrieve button if needed
- ImgPath: Path of image, first check is relative to tlab/art/icons/, if not found, standard path will be checked.
- Command: Command to call when button pressed
-
Extra: Any custom field/value needed by using format:
field=value
, multiple field/value should be seperated with|
Ex:variable=$pref::MyVariable|myString=My string|myNumber:100
All the groups have their own array All the items ( Icons and Boxes) found will be stored in an array with required informations: ` TAB TAB TAB '
- UniqueName: No other icon shold have the same name which is used as internalName to retrieve button if needed
- ImgPath: Path of image, first check is relative to tlab/art/icons/, if not found, standard path will be checked.
- Command: Command to call when button pressed
-
Extra: Any custom field/value needed by using format:
field=value
, multiple field/value should be seperated with|
Ex:variable=$pref::MyVariable|myString=My string|myNumber:100
Extensions provide new features globally which can be used from all plugins/editors. In general, they use a Window dialog to manage their features but they could be mostly anything (Toolbars,menus,functionalities,etc)
Themes allow to change the appearance of TorqueLab and provide extra customization. There's 2 type of themes: Master and Child. Master are full featured themes while Child are Master clones with limited modifications.