Section A - Compile time changes overview
PropsScheme overhaul
PropsScheme has undergone an evolution, with some new improved behaviours, new features and UI. It is now designed to look and function similar across extensions in CET Designer. There has been lot of interfaces removed and replaced with newer functionality.
It is recommended to go over the interface changes listed for the back end classes. For the scheme dialog (PropsSchemeDialog) itself, we recommend to take a look at Fika Scheme, and decide whether to re-implement customisations again. Also, do take a look on new behavior section.
MaterialSelection and MaterialSettingLimb refactor
As part of converting Wall Settings to be based of PropsScheme, we had to move some code to build the material selector up to cm/core/material.
- Common code from IndustryMaterialSelection and OfficeMaterialSelection has been moved up to MaterialSelection in cm/core/materialSelection.cm
MaterialSelection -- cm.core.material |---IndustryMaterialSelection -- cm.abstract.industry | |---+ |---OfficeMaterialSelection -- cm.abstract.office | |---+
- Common interfaces across IndustryMaterialLimb and OfficeMaterialLimb has been moved up to MaterialSettingLimb in cm/core/materialSettingLimb.cm
MaterialSettingLimb -- cm.core.material |---IndustryMaterialLimb -- cm.abstract.industry |---OfficeMaterialLimb -- cm.abstract.office
Section B - Compile time changes details
PropsScheme back end changes
PropsScheme
Old: extend public void setSchemeValue(str k, Object v, Object env=null) New: final public void setSchemeValue(str k, Object v, Object env=null) New: extend public void setSchemeValue(str k, Object v, Object env |, bool undoRecord) Old: extend public void saveSchemeEvent(Control c) New: extend public bool saveSchemeEvent(Control c) Old: extend public void applyScheme(Snapper{} snappers) New: final public void applyScheme(Snapper{} snappers) New: extend public void applyScheme(CoreObject{} objects) Old: extend public void checkAllRecursive(Window w, bool check=true) New: final public void checkAllRecursive(Window w, bool check=true) New: extend public void checkAllRecursiveAux(Window w, bool check=true) Deprecated: extend public str schemesDialogWindowLabel() New: extend public str systemName() Removed: extend public str dialogApplyFilterKey()
Open Scheme from QP
Removed: public void openPropsScheme(PropObj obj, str key) Deprecated: public class OpenSchemePropertyPropDef extends PropDef Note: If you have streamed OpenSchemePropertyPropDef, please clean that up on load.
PropsSchemeData
Old: extend public void applyScheme(CoreObject{} objects, PropsScheme scheme=null) New: extend public bool applyScheme(CoreObject{} objects, PropsScheme scheme) Old: extend public void applyScheme(PropObj obj, PropsScheme scheme=null) New: extend public bool applyScheme(PropObj obj, PropsScheme scheme=null)
PropsSchemeContainer
Removed: public str->str current();
PropsSchemeManager
Removed: public propsSchemeDialogFilterType currentApplyFilter; Removed: public bool[] tagEnables; Removed: public str[] tagStates;
UI Factory
Old: public class CheckAllButton New: public class PSCheckAllButton Old: public CheckAllButton::constructor(Window parent, str key, Image image=null, Font font=controlFont, pointI margins=(6, 4), str toolTip=null, function(Control) callback=function propsSchemeCheckAllCB) New: public PSCheckAllButton::constructor(Window parent, str key, str label=null, Image image=null, Font font=controlFont, pointI margins=(6, 4), str toolTip=null, function(Control) callback=function propsSchemeCheckAllCB Old: public class PropsSchemeCheckButton New: public class PropsSchemeApplyToggle
PropsSchemeDialog changes
General changes
Old: extend public void preBuildInitailize() New: extend public void preBuildInitialize() Old: extend public void selectScheme(Control c, TreeViewItem item) New: extend public void selectScheme(str systemKey, str label) Old: extend public void updateSchemeSelector(str systemKey, TreeView selector=null) New: extend public void updateSchemeSelector(str systemKey) Old: public Button applyBtnA; New: public Button applyBtnAll; New: public Button applyBtnSel;
As we have reworked how save and load of schemes are handled, the following methods have changed.
Old: extend public void openScheme() New: extend public bool openScheme() New: extend public void afterLoad() Old: extend public void save(Url url) New: extend public bool save(PropsScheme schemeToSave, Url url) Old: extend public void saveSchemeAs() New: extend public bool saveSchemeAs(PropsScheme schemeToSave) Removed: extend public str->Object allKeyValues(PropObj z, str->Object list=null, str base=null) Removed: extend public str->Object add(PropObj z, str key, sorted str->Object list=null, str base=null) Removed: extend public bool filterSave(PropObj z, PropDef d, str key, str longKey)
Removal of UI windows and their related methods.
Removed: public enum propsSchemeDialogFilterType : field access Removed: public GroupBox applyFilterWindow; Removed: extend public GroupBox buildApplyFilterWindow(Window apply) Removed: public TreeView schemeSelector; Removed: extend public TreeView buildSchemeSelector() Removed: public SubWindow toolbarWindow; Removed: extend public SubWindow buildToolbar() Removed: extend public void buildToolbarItems(SubWindow toolbar) Removed: extend public void layoutToolbarItems(Window reference=null) Removed: public Button saveBtnT; Removed: public Button loadBtnT; Removed: public Button saveAsBtnT; Removed: public Button newBtnT; Removed: public Button cpyBtnT; Removed: public Button renameBtnT; Removed: public Button deleteBtnT; Removed: public StateControlGroup applyFilterGroup; Removed: extend public void setInitialApplyMode() Removed: extend public str updateApplyFilterGroup() Removed: extend public void setFilterType(str filter) Removed: public CheckBox[] tagCheckBoxes; Removed: public DropDownTreeView[] tagDropDowns; Removed: public Display[] tagDisplays; Removed: extend public void updateEnabledTags() Removed: extend public void setTagNames() Removed: extend public bool tagFilterMatch(Snapper s) Removed: public Brush propsSchemeGradientBrush; Removed: public Brush propsSchemeLightGradientBrush; Removed: public Brush propsSchemeSuperLightGradientBrush;
Section C - Runtime/behaviour changes
Changes to SpaceSelection behavior
Single select works slightly differently now, users are prevented from deselecting a lonely remove snapper from its connected snapper.
- Place a Fika panel, place a storage unit (lonely remove) on the panel.
- Copy and paste the panel and storage.
- Select both panels by using Ctrl+Click.
- Deselect the storage units by Ctrl+Click on them.
- Try to move the panels by click and drag on the selection.
Previously, doing the above steps would cause one of the storage unit to be disconnected and removed. Now, the panels would move together with their storage units.
Changes to PropsScheme behaviors
We have moved the following files from cm.core to cm.core.propsScheme. This new package is exported by core and uses "use export" so no compile time changes should be necessary however it may cause an issue where the package was hardcoded.
Old | New |
cm/core/propsScheme.cm | cm/core/propsScheme/propsScheme.cm |
cm/core/propsSchemeApplyAnimation.cm | cm/core/propsScheme/propsSchemeApplyAnimation.cm |
cm/core/propsSchemeContainer.cm | cm/core/propsScheme/propsSchemeContainer.cm |
cm/core/propsSchemeData.cm | cm/core/propsScheme/propsSchemeData.cm |
cm/core/propsSchemeDialog.cm | cm/core/propsScheme/propsSchemeDialog.cm |
cm/core/propsSchemeManager.cm | cm/core/propsScheme/propsSchemeManager.cm |
cm/core/propsSchemeUiFactory.cm | cm/core/propsScheme/propsSchemeUiFactory.cm |
PropsScheme changes
- PropsScheme constructor no longer calls initData(). It is built on demand.
- PropsScheme will have all toggles disabled/turned off by default as addDefaultValues() will call excludeAllSchemePropDefs().
- PropsScheme checkAllEvent() and uncheckAllEvent() will only apply to options in the current card instead of applying to all cards.
- Calling initFromPropsScheme(..) will now apply all options from the scheme (even unchecked options).
- Default scheme is streamed as part of preference.
- Saved schemes persists on creation of new drawings.
PropsSchemeUIFactory behaviour changes
- appendFirstDefaultControls() no longer draws PropsSchemeCheckButton.
- appendLastDefaultControls() no longer draws PropsSchemeSingleApplyButton and PropsSchemeSingleApplyAnimateButton. The existing PropsSchemePushPropButton is still drawn, and we have a new PropsSchemeApplyToggle (replaces PropsSchemeCheckButton).
- PSCardWindow has been changed, to not show card flaps. Now, PropsSchemeDialog builds up the the card selector instead for added flexibility.
PropsSchemeDialog behaviour changes
- User can only propagate checked options that are in the current selected card by default.
- The 'Apply To' section has been replaced with a button that applies to current space selection or drawing.
- The toggle state of an option is enabled when user changes the option.
Section D - New Features
PropsScheme new features
- Scheme Explorer. All registered PropsScheme show up here. For a scheme defined in custom.manufacturer.product, you will need to make sure the following interfaces inside PropsScheme return following:
extend public str groupKey() // Used by backend to specify a manufacturer extend public str groupName() // A human readable name for the manufacturer extend public Image groupIcon() // An icon to display your manufacturer extend public str systemName() // A human readable name for the product/scheme extend public Image icon() // An icon to identify your scheme (i.e. library icon)
For most cases, you will only need to implement PropsScheme::groupIcon() and PropsScheme::icon().
-
Preview snappers. Changes to the scheme options will be reflected to these snappers located at the lower left area of the scheme dialog. Implement the following methods inside PropsScheme and reopen the scheme dialog:
extend public bool allowPreview() extend public Snapper{} previewSnappers(str cardKey)
- More Properties dialog. This shows up in quick properties, displaying scheme options relevant to the snapper. The main requirement is to make sure your snapper and scheme propdef keys match up. Then do the following:
- Implement this method, and specify a key starting with an underscore (i.e. _mySchemeKey):
extend public str schemeSystemKeyRef()
- Make sure your snapper's constructor calls this function:
public void initFromPropsScheme(str systemKey, PropObj obj)
- The system should automatically pick up the relevant PropDef keys (from PropDefTracker) for that snapper. If you want to remove or add a bunch of extra keys, you can implement the following method on your snapper:
extend public str{} schemeProps()
- Implement this method, and specify a key starting with an underscore (i.e. _mySchemeKey):
- Global scheme. It is a special scheme that pushes schemes values to another schemes. The concept it that if the value existed in the property domain, this feature will set the value of that particular property. You can make a scheme behave as a Global scheme by implementing the following methods:
extend public bool allowPropagateToScheme() extend public bool acceptPropagateTarget(PropsScheme targetScheme)
- PushPropVisitor. This is an intermediate appliance before actually pushing values to another propObj. It is essentially an injection point where some modification need to be done first before we can actually push it. You can declare a visitor when extending PropsSchemeData to specify your own visitor. An example of how to use this is in custom/fika/office/foMasterScheme.cm:
extend public PushPropsVisitor visitor()
- Scheme selector within the extension library. To get it, do the following steps.
- Implement these two methods in PropsScheme so they work as expected. This interface is also used to locate component tab for a scheme.
extend public symbol libraryPackage() extend public str libraryFunctionName()
- Inside your library, call this function which will build the selector for you.
public void appendSchemeSelector(LibraryLimb parent, symbol pkg, str libraryFunctionName, str systemKey)
- Implement these two methods in PropsScheme so they work as expected. This interface is also used to locate component tab for a scheme.
- Undo/Redo/Revert scheme options. In certain scenarios, selecting the same option again (i.e. re-selecting Undecided) causes an extra undo operation to be recorded. In this instance, you will need to override the following method inside PropsScheme to handle the special case.
extend public bool sameObject(Object a, Object b)
- Possibility of loading old scheme files from GroupScheme. We have written some code to translate saved GroupScheme scheme/library into PropsScheme. To make use of that, you will need to implement this two methods. An example of this can be found inside custom/genericStorage/shelving/ltShelving/ltPropsScheme.cm
extend public str{} legacyGroupSchemeKeys() extend public <str, Object> translateGroupToProps(str key, Object value, Object groupScheme)
Comments
0 comments
Please sign in to leave a comment.