[741] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/
|
---|
| 2 | // Copyright (C) 1999-2018 Maciej Komosinski and Szymon Ulatowski.
|
---|
| 3 | // See LICENSE.txt for details.
|
---|
| 4 |
|
---|
| 5 | #ifndef _MODELCHECKPOINTS_H_
|
---|
| 6 | #define _MODELCHECKPOINTS_H_
|
---|
| 7 |
|
---|
| 8 | #include <frams/userinput/modelviewiface.h>
|
---|
| 9 | #include <frams/userinput/modelselprop.h>
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | Helper class that manages interactions between checkpoint selector, model display and model selection.
|
---|
| 13 | 1. Showing geno without checkpoints -> disable checkpoint selector, enable model selection, pass to model display
|
---|
| 14 | 2. Showing geno with checkpoints -> enable checkpoint selector
|
---|
| 15 | 2a. Checkpoint selected -> disable model selection, display selected checkpoint
|
---|
| 16 | 2b. Final stage selected -> enable model selection, display final stage
|
---|
| 17 | */
|
---|
| 18 | class ModelCheckpointSupport : public ModelViewInterface
|
---|
| 19 | {
|
---|
| 20 | ModelSelectionPropagator &mod_sel_prop;
|
---|
| 21 | ModelViewInterface &model_view;
|
---|
| 22 | Model *mod, *mod_checkpoints;
|
---|
| 23 | float current_value, max_value;
|
---|
| 24 | int current_index;
|
---|
| 25 | bool selection_enabled;
|
---|
| 26 | int current_checkpoint;
|
---|
| 27 | bool use_checkpoints;
|
---|
| 28 | void freeModel();
|
---|
| 29 | void enableSelection(bool e);
|
---|
| 30 |
|
---|
| 31 | public:
|
---|
| 32 | enum CheckpointsMode {
|
---|
| 33 | Disabled /** not displaying checkpoints because use_checkpoints=false in showGeno */,
|
---|
| 34 | EnabledUnknown /** checkpoints enabled, displaying main model, checkpoint availability not known, slider not clicked yet */,
|
---|
| 35 | EnabledActive /** checkpoints enabled, displaying checkpoints or main model depending on the slider */,
|
---|
| 36 | EnabledUnavailable /** checkpoints enabled but only the main model is available */
|
---|
| 37 | };
|
---|
| 38 | ModelCheckpointSupport(ModelSelectionPropagator &msp, ModelViewInterface &_model_view);
|
---|
| 39 | virtual ~ModelCheckpointSupport();
|
---|
| 40 |
|
---|
| 41 | void fromguiPhase(float p);
|
---|
| 42 | virtual void toguiCheckpoints(CheckpointsMode mode, float maxvalue, float value) {}
|
---|
| 43 | SString checkpointHint();
|
---|
| 44 |
|
---|
[1255] | 45 | int showGeno(const Geno*, bool use_checkpoints) override;
|
---|
| 46 | int showModel(const Model *m, bool reset_view=true) override;
|
---|
| 47 | Model *getModel() override;
|
---|
| 48 | ModelSelection& getModelSelection() override;
|
---|
[741] | 49 | CheckpointsMode getCheckpointsMode();
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | #endif
|
---|