src/Screens/ModelEditorScreen.cpp
// handle what happens when a user presses a key
handle what happens when a user presses a key
handle what happens when a user presses a key
bool modelEditorOnKeydown(ModelEditorScreen::Impl& impl, SDL_KeyboardEvent const& e) {
        if (e.keysym.mod & KMOD_CTRL) {  
            if (e.keysym.mod & KMOD_SHIFT) {  +Shift
                switch (e.keysym.sym) {
                case SDLK_z:  +Shift+Z : undo focused model
                    actionRedoCurrentlyEditedModel(*impl.st);
                    return true;
                }
                return false;
            }
            switch (e.keysym.sym) {
            case SDLK_z:  +Z: undo focused model
                actionUndoCurrentlyEditedModel(*impl.st);
                return true;
            case SDLK_r:  +R: start a new simulation from focused model
                actionStartSimulationFromEditedModel(*impl.st);
                App::cur().requestTransition<SimulatorScreen>(impl.st);
                return true;
            case SDLK_a:  +A: clear selection
                actionClearSelectionFromEditedModel(*impl.st);
                return true;
            case SDLK_e:  +E: show simulation screen
                App::cur().requestTransition<SimulatorScreen>(std::move(impl.st));
                return true;
            }
            return false;
        }
        switch (e.keysym.sym) {
        case SDLK_DELETE:  
            actionTryDeleteSelectionFromEditedModel(impl.st->editedModel);
            return true;
        }
        return false;
    }
bool modelEditorOnKeydown ( ModelEditorScreen :: Impl & impl , SDL_KeyboardEvent const & e ) { if ( e . keysym . mod & KMOD_CTRL ) { if ( e . keysym . mod & KMOD_SHIFT ) { switch ( e . keysym . sym ) { case SDLK_z : actionRedoCurrentlyEditedModel ( * impl . st ) ; return true ; } return false ; } switch ( e . keysym . sym ) { case SDLK_z : actionUndoCurrentlyEditedModel ( * impl . st ) ; return true ; case SDLK_r : actionStartSimulationFromEditedModel ( * impl . st ) ; App :: cur ( ) . requestTransition < SimulatorScreen > ( impl . st ) ; return true ; case SDLK_a : actionClearSelectionFromEditedModel ( * impl . st ) ; return true ; case SDLK_e : App :: cur ( ) . requestTransition < SimulatorScreen > ( std :: move ( impl . st ) ) ; return true ; } return false ; } switch ( e . keysym . sym ) { case SDLK_DELETE : actionTryDeleteSelectionFromEditedModel ( impl . st -> editedModel ) ; return true ; } return false ; }
handle what happens when a user presses a key
handle what happens when a user presses a key
// Ctrl // Ctrl+Shift // Ctrl+Shift+Z : undo focused model // Ctrl+Z: undo focused model // Ctrl+R: start a new simulation from focused model // Ctrl+A: clear selection // Ctrl+E: show simulation screen // DELETE: delete selection