~stellarium/stellarium/trunk

« back to all changes in this revision

Viewing changes to src/stel_ui.cpp

  • Committer: digitalises
  • Date: 2005-11-30 04:25:31 UTC
  • Revision ID: vcs-imports@canonical.com-20051130042531-j1za2ndc76g7lin9
script playback features and bugfixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
943
943
                        core->quit();
944
944
                }
945
945
 
 
946
#ifndef MACOSX
 
947
                if(key==0x0010)
 
948
                { // CTRL-P  Play startup script, NOW!
 
949
#else
 
950
                if (key == SDLK_p && SDL_GetModState() & KMOD_META)
 
951
                {
 
952
#endif
 
953
 
 
954
                        // first clear out audio and images kept in core
 
955
                        core->commander->execute_command( "script action end");
 
956
                        core->scripts->play_startup_script();
 
957
                        return 1;
 
958
                }
946
959
 
947
960
 
948
961
                // if script is running, only script control keys are accessible
969
982
                                core->commander->execute_command( "script action end");
970
983
                                if(key==SDLK_m) core->FlagShowTuiMenu = true;
971
984
                        }
 
985
                        // TODO n is bad key if ui allowed
972
986
                        else if(key==SDLK_GREATER || key==SDLK_n)
973
987
                        {
974
988
                                core->commander->execute_command( "audio volume increment");
975
989
                        }
 
990
                        // TODO d is bad key if ui allowed
976
991
                        else if(key==SDLK_LESS || key==SDLK_d)
977
992
                        {
978
993
                                core->commander->execute_command( "audio volume decrement");
997
1012
                                core->time_multiplier *= 2;
998
1013
                                if(core->time_multiplier>8) core->time_multiplier = 8;
999
1014
                        }
1000
 
                        else cout << "Playing a script.  Press CTRL-C (or 7) to stop." << endl;
1001
 
 
1002
 
                        return 0;
 
1015
                        else if(!core->scripts->get_allow_ui()) {
 
1016
                                cout << "Playing a script.  Press CTRL-C (or 7) to stop." << endl;
 
1017
                        }
 
1018
 
 
1019
                        if(!core->scripts->get_allow_ui()) return 0;  // only limited user interaction allowed with script
 
1020
 
1003
1021
                } else {
1004
1022
                        core->time_multiplier = 1;  // if no script in progress always real time
 
1023
 
 
1024
                        // normal time controls here (taken over for script control above if playing a script)
 
1025
                        if(key==SDLK_k) core->commander->execute_command( "timerate rate 1");
 
1026
                        if(key==SDLK_l) core->commander->execute_command( "timerate action increment");
 
1027
                        if(key==SDLK_j) core->commander->execute_command( "timerate action decrement");
 
1028
                        if(key==SDLK_6) core->commander->execute_command( "timerate action pause");
 
1029
                        if(key==SDLK_7) core->commander->execute_command( "timerate rate 0");
 
1030
                        if(key==SDLK_8) core->commander->execute_command( "date load preset");
 
1031
 
1005
1032
                }
1006
1033
 
1007
 
 
 
1034
#ifndef MACOSX
1008
1035
                if(key==0x0012)
1009
 
                {  // ctrl-r
 
1036
                { // CTRL-R
 
1037
#else
 
1038
                if (key == SDLK_r && SDL_GetModState() & KMOD_META)
 
1039
                {
 
1040
#endif
1010
1041
                        if(core->scripts->is_recording())
1011
1042
                        {
1012
1043
                                core->commander->execute_command( "script action cancelrecord");
1183
1214
                if(key==SDLK_m && core->FlagEnableTuiMenu) core->FlagShowTuiMenu = true;  // not recorded
1184
1215
 
1185
1216
                if(key==SDLK_o) core->commander->execute_command( "flag moon_scaled toggle");
1186
 
                if(key==SDLK_k) core->commander->execute_command( "timerate rate 1");
1187
 
                if(key==SDLK_l) core->commander->execute_command( "timerate action increment");
1188
 
                if(key==SDLK_j) core->commander->execute_command( "timerate action decrement");
1189
 
                if(key==SDLK_6) core->commander->execute_command( "timerate action pause");
1190
 
                if(key==SDLK_7) core->commander->execute_command( "timerate rate 0");
1191
 
                if(key==SDLK_8) core->commander->execute_command( "date load preset");
1192
1217
 
1193
1218
                if(key==SDLK_9)
1194
1219
                {