Compile Time Changes

UnitLoadDialog apply unit load changes

Deprecated the following and replaced with a new method. The deprecated method would loop through and gather all Snappers in mainWorld that use a unit load. This was too broad for the intention of the method and would gather significantly more snappers than required. The new method will gather all Snappers in mainWorld that use one of the unit load objects passed in as an argument.

Deprecated: extend public CoreObject{} getAffectedObjects() : deprecated {
New: extend public CoreObject{} getAffectedObjects(UnitLoad[] unitLoads) {

Similarly, we have deprecated and replaced the following method as well for the same reason.

Deprecated: extend public bool hasLoad(CoreObject obj) : deprecated {
New: extend public bool usesLoad(CoreObject obj, UnitLoad[] unitLoads) {

The method applyAllCallback(UnitLoad[] applyUnitLoads) has been updated to use the new method getAffectedObjects(UnitLoad[] unitLoads) so if you have overridden it, check if you need to update your method call as well.

Runtime/Behavior Changes

UnitLoadDialog Redesign Changes

Important to note: You do not have to make any changes for 15.5 Minor, but they will be required in 16.0 Major. The individual interface changes will also be included in the 16.0 Major migration guide.

See Unit Load Editor Redesign in the New Features page to learn about how to switch to the new design for your extension. This redesign is opt-in and the dialog will still default to the old design.

As a general rule of thumb, you can search for useV2 in order to find the new code and the old code for each of those methods, where the old code will be in the else block. You can also search for FIXME 16.0 remove to identify all methods that are used for the old design and will be removed.

The following fields and methods in UnitLoadDialog are only used for the old design and will be removed in 16.0 Major. Copy them over to your custom class if you wish to maintain the old design in 16.0 Major.

public class UnitLoadDialog extends DialogWindow {
    // Fields.
    public TreeView userRegisteredTree;
    public DropDownTreeView systemRegisteredTree;

    // Methods.
    extend public SubWindow buildAddTemplateWin(Window parent) {
    extend public void buildUserUnitLoadWin(Window sub, Window templateInsert) {
    extend public void buildApplyButtons() {
    extend public pointI paneMargin() {
    extend public void updateUnitLoadSelectorWin() {
    extend public void updatePreviewWin() {
    extend public void updatePropsWin() {
    extend public void updatePanes() {
    extend public void addSelectedTemplateToUserRegistry(bool refresh) {
    extend public str propsLabel(UnitLoad unitLoad) {
    extend public TreeViewItem getSelectedSystemUnitLoad() {
}

The following fields and methods in UnitLoadDialog have been introduced for the new design. Extend these methods in your custom class if you wish to adopt the new design.

public class UnitLoadDialog extends DialogWindow {
    // Fields.
    public Window mainSub;
    public UnitLoadDropDownTreeView registeredUnitLoadTV;
    public Window buttonSub;
    public bool useV2; // Will be removed!

    // Methods.
    public constructor(bool useV2, Window parent=null, pointI pos=(-1, -1)) { // Will be removed!
    extend public void buildMenuBar() {
    extend public void buildMenuBarSubMenus() {
    extend public void buildMenuBarFileMenu() {
    extend public void buildMenuBarEditMenu() {
    extend public void appendMenuBarFileItems() {
    extend public void appendMenuBarEditItems() {
    extend public void toggleMenuBarItems() {
    extend public void buildMainSub() {
    extend public void buildUnitLoadSelectorWin2() { // Will be renamed to buildUnitLoadSelectorWin
    extend public void fillInRegisteredUnitLoadTV() {
    extend public void updateUnitLoadTreeView() {
    extend public void buildPropertiesWin2() { // Will be renamed to buildPropertiesWin
    extend public void buildPreviewWin2() { // Will be renamed to buildPreviewWin
    extend public void buildButtonsSub() {
    extend public sizeI defaultSize() {
    extend public void handleEvent(str event) {
    extend public bool allowModifyUnitLoad() {
    extend public bool allowRemoveUnitLoad() {
    extend public void toggleSaveApplyButtons() {
    extend public bool allowSaveCurrentUnitLoad() {
    extend public bool allowSaveAllUnitLoads() {
    extend public bool allowSelectApplyUnitLoad() {
    extend public void addSelectedTemplateToUserRegistry(UnitLoad ul, UnitLoadGroup grp) {
    extend public void openTemplateSelectorDialog() {
    extend public void openRenamePopup() {
    extend public void renameUnitLoadItem(UnitLoadTreeViewItem2 item, str newName) {
    extend public void duplicateUnitLoad() {
    extend public void removeUnitLoad() {
    extend public int promptUserRemoveUnitLoad() {
    extend public UnitLoadTreeViewItem2 getSelectedUnitLoadTVI() {
}

The following methods in UnitLoadDialog will remain but have been modified to have different behaviors for the old and new design. If you wish to maintain the old design, override these methods and copy over the old code in the else blocks of the if (useV2) check.

public class UnitLoadDialog extends DialogWindow {
    extend public void build() {
    extend public void unitLoadSelectionChanged() {
    public void rebuild() {
    extend public void populatePropsWindow(UnitLoad mtbh) {
    extend public void removeProps() {
    extend public void createPropsUI(UnitLoad mtbh) {
    extend public void animApplyCallback() {
    extend public void applyAllCallback(UnitLoad[] applyUnitLoads) {
    extend public void afterPropertyChanged(CoreProperty property, Object oldValue) {
    extend public void clearModifiedUnitLoads(str->UnitLoad newLoads=null) {
    extend public UnitLoad getSelectedUserUnitLoad(bool actual=false) {
    extend public bool selectUserUnitLoad(UnitLoad mtbh) {
    extend public void validateUserUnitLoadsInUse() {
}

Some other details to be mentioned:

  1. When using the new design, refer to registeredUnitLoadTV instead for the list of unit loads in the drawing.
public class UnitLoadDialog extends DialogWindow {
    Old: public TreeView userRegisteredTree; // To be removed in 16.0 major.
    New: public UnitLoadDropDownTreeView registeredUnitLoadTV
}
  1. The feature of adding new unit loads objects into the drawing has been modified. systemRegisteredTree is not used in the new design and has been replaced with a new dialog UnitLoadTemplateSelectorDialog.
public class UnitLoadDialog extends DialogWindow {
    Old: public DropDownTreeView systemRegisteredTree; // To be removed in 16.0 major.
    New:
    /**
     * Open unit load template selector dialog.
     */
    extend public void openTemplateSelectorDialog() {
        UnitLoadTemplateSelectorDialog(this);
    }


    Old: extend public void addSelectedTemplateToUserRegistry(bool refresh) { // To be removed in 16.0 major.
    New: extend public void addSelectedTemplateToUserRegistry(UnitLoad ul, UnitLoadGroup grp) {
}
  1. We have moved the responsibility of duplicating/renaming/removing unit loads from UnitLoadTreeViewItem into UnitLoadDialog for the new design. If you have extended UnitLoadTreeViewItem and modified these features, considering extending these methods in your UnitLoadDialog class.
public class UnitLoadDialog extends DialogWindow {
    // Methods.
    extend public bool allowModifyUnitLoad() {
    extend public bool allowRemoveUnitLoad() {
    extend public void openRenamePopup() {
    extend public void renameUnitLoadItem(UnitLoadTreeViewItem2 item, str newName) {
    extend public void duplicateUnitLoad() {
    extend public void removeUnitLoad() {
    extend public int promptUserRemoveUnitLoad() {
}

Due to this, in 16.0 Major we will be removing the following fields and methods in UnitLoadTreeViewItem. It will basically be replaced by UnitLoadTreeViewItem2 (which will take its class name).

public class UnitLoadTreeViewItem extends TreeViewItem : inherit constructors {
    // Fields.
    public rectI editButtonRect;
    public rectI cpyButtonRect;
    public rectI rmButtonRect;
    public byte over = 0;

    // Methods.
    extend public void drawColoredRect(PixelDevice c, rectI r, rectI clipRect, treeViewItemState state, treeViewSelectionStyle style) {
    extend public void drawMainArrow(PixelDevice d, rectI r, rectI clipRect) {
    extend public rectI drawBtn(str btnK, Image img, PixelDevice d, rectI r, rectI clipRect) {
    extend public rectI drawBtn(str btnK, Image img, PixelDevice d, rectI r, rectI clipRect, bool disable) {
    extend public pointI getBtnPos(str btnK, Image img, rectI r) {
    extend public Brush backgroundBrush(treeViewItemState state) {
    extend public bool showSelectedAsWhite(treeViewItemState state, treeViewSelectionStyle style) {
    extend public ScrollBar vScrollBar(bool ifVisible=false) {
    extend public void updateApplyButtons(TreeView tv) {
    extend public void openEditNamePopup(TreeView tv) {
    extend public void editName(str newName, TreeView tv) {
    extend public void copyUnitLoadDown(TreeView tv) {
    extend public void removeUnitLoad(TreeView tv) {
    extend public void updateTreeView(TreeView tv) {
    extend public bool isMainSelection() {
    extend public bool isMultiSelect() {