示例#1
0
void EMU::start_auto_key()
{
	stop_auto_key();
	
	if(OpenClipboard(NULL)) {
		HANDLE hClip = GetClipboardData(CF_TEXT);
		if(hClip) {
			autokey_buffer->clear();
			char* buf = (char*)GlobalLock(hClip);
			int size = strlen(buf), prev_kana = 0;
			for(int i = 0; i < size; i++) {
				int code = buf[i] & 0xff;
				if((0x81 <= code && code <= 0x9f) || 0xe0 <= code) {
					i++;	// kanji ?
					continue;
				}
				else if(code == 0xa) {
					continue;	// cr-lf
				}
				if((code = autokey_table[code]) != 0) {
					int kana = code & 0x200;
					if(prev_kana != kana) {
						autokey_buffer->write(0xf2);
					}
					prev_kana = kana;
#if defined(USE_AUTO_KEY_NO_CAPS)
					if((code & 0x100) && !(code & (0x400 | 0x800))) {
#elif defined(USE_AUTO_KEY_CAPS)
					if(code & (0x100 | 0x800)) {
#else
					if(code & (0x100 | 0x400)) {
#endif
						autokey_buffer->write((code & 0xff) | 0x100);
					}
					else {
						autokey_buffer->write(code & 0xff);
					}
				}
			}
			if(prev_kana) {
				autokey_buffer->write(0xf2);
			}
			GlobalUnlock(hClip);
			
			autokey_phase = 1;
			autokey_shift = 0;
		}
		CloseClipboard();
	}
}

void EMU::stop_auto_key()
{
	if(autokey_shift) {
		key_up(VK_SHIFT);
	}
	autokey_phase = autokey_shift = 0;
}
示例#2
0
文件: menu.cpp 项目: Arnaud474/Warmux
void Menu::HandleEvent(const SDL_Event& evnt)
{
  if (evnt.type == SDL_QUIT) {
#if defined MAEMO || defined __SYMBIAN32__
    AppWarmux::EmergencyExit();
#else
    key_cancel();
#endif
  } else if (evnt.type == SDL_KEYDOWN) {

    // Drop key events that are purely modifiers
    if (Keyboard::IsModifier(evnt.key.keysym.sym))
      return;

    // Allow widgets to interpret any key they want,
    // and do not reserve esc/return/delete/backspace
    bool used_by_widget = widgets.SendKey(evnt.key.keysym);

    if (!used_by_widget) {
      switch (evnt.key.keysym.sym) {
      case SDLK_ESCAPE:
        key_cancel();
        break;
      case SDLK_RETURN:
      case SDLK_KP_ENTER:
        key_ok();
        break;
      case SDLK_UP:
        key_up();
        break;
      case SDLK_DOWN:
        key_down();
        break;
      case SDLK_LEFT:
        key_left();
        break;
      case SDLK_RIGHT:
        key_right();
        break;
      case SDLK_TAB:
        key_tab();
        break;
      default:
        // should have been handle upper!
        break;
      }
    }
  } else if (evnt.type == SDL_MOUSEBUTTONUP) {
    Point2i mousePosition(evnt.button.x, evnt.button.y);

    if (!BasicOnClickUp(mousePosition)) {
      OnClickUp(mousePosition, evnt.button.button);
    }
  } else if (evnt.type == SDL_MOUSEBUTTONDOWN) {
    Point2i mousePosition(evnt.button.x, evnt.button.y);
    OnClick(mousePosition, evnt.button.button);
  }
}
示例#3
0
文件: main.c 项目: rofl0r/libxauto
void TEST_key_up() {
    char *routine = "TEST_key_up";
    printf(testing, routine);
    //It's necessary to send both down and up commands
    //"100" happens to be the code for "Left" on my computer
    assert(key_down(100));
    assert(key_up(100));
    printf(done, routine);
}
示例#4
0
    void _run()
    {
        boost::shared_ptr< sdl_event_t > e;

        while ( _cancel == false )
        {
            if ( get_queue() )
            {
                std::cout << "before get event." << std::endl;
                get_queue()->dequeue( e );
                std::cout << "after get event." << std::endl;

                switch ( e->type() )
                {
                case detail::redraw_event::type:
                {
                    lock();

                    _redraw_handler->redraw( wrap_sdl_image( _screen ));

                    unlock();

                    break;
                }

                case detail::key_up_event::type:
                {
                    lock();

                    if ( key_up() == true )
                    {
                        _redraw_handler->redraw( wrap_sdl_image( _screen ));
                    }

                    unlock();

                    break;
                }

                case detail::quit_event::type:
                {
                    std::cout << "received quit event." << std::endl;

                    quit();
                }
                }
            }
        }


        std::cout << "thread main is done." << std::endl;
    }
示例#5
0
文件: kbd.c 项目: schnitzeltony/z80
void cgenie_key_up(void *cookie, osd_key_t *key)
{
#if	DUMP_KEYCODE
	printf("keyup: %s sym:%#x uni:%#x '%c' ",
		osd_key_name(key), key->sym, key->unicode, PRINTABLE(key->unicode));
#endif
	key_up(key);
#if	DUMP_KEYCODE
	printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",
		keymap[0], keymap[1], keymap[2], keymap[3],
		keymap[4], keymap[5], keymap[6], keymap[7]);
#endif
}
示例#6
0
int dgreed_main(int argc, const char** argv) {
	params_init(argc, argv);
	rand_init(time(NULL));
	layouts_init();
	layouts_set("dvorak");

	bool fullscreen = true;
	if(params_find("-windowed") != ~0)
		fullscreen = false;

	video_init_ex(SCREEN_WIDTH, SCREEN_HEIGHT, 
		SCREEN_WIDTH, SCREEN_HEIGHT, "KeyMingler", fullscreen);
	font = font_load(FONT_FILE);	
	float text_width = font_width(font, LOADING_TEXT);
	float text_height = font_height(font);
	Vector2 pos = vec2((SCREEN_WIDTH - text_width) / 2.0f,
		(SCREEN_HEIGHT - text_height) / 2.0f);
	font_draw(font, LOADING_TEXT, 0, &pos, COLOR_WHITE);	
	video_present();
	system_update();

	game_init();
	sounds_init();
	music = sound_load_stream(MUSIC_FILE);
	sound_play(music);

	while(system_update()) {
		game_update();
		game_render();
		video_present();
		sound_update();

		if(key_up(KEY_QUIT))
			break;
	}
	
	font_free(font);
	sound_free(music);
	sounds_close();
	game_close();
	video_close();
	layouts_close();

	return 0;
}
示例#7
0
文件: ui.c 项目: estibi/audioplayer
void
curses_loop()
{
	int key, w_height, w_width;

	notimeout(main_win, true);

	for (;;) {
		getmaxyx(status_win, w_height, w_width);
		mvwprintw(status_win, w_height - 2 , 1, "p - play, s - stop, q - quit");
		wrefresh(status_win);

		key = wgetch(main_win);
		switch (key) {
		case KEY_UP:
			break;
		case 10:	// 10 == ENTER
		case 'p':
			key_enter();
			break;
		case ' ':
			mvwprintw(status_win, 1, 5, "CMD: PAUSE");
			send_pause_command(sock_fd);
			break;
		case 'q':
			mvwprintw(status_win, 1, 5, "CMD: QUIT ");
			send_quit_command(sock_fd);
			wrefresh(status_win);
			return;
		case 's':
			mvwprintw(status_win, 1, 5, "CMD: STOP ");
			send_stop_command(sock_fd);
			break;
		case 68:
			mvwprintw(status_win, 1, 5, "CMD: REV  ");
			send_rev_command(sock_fd);
			break;
		case 67:
			mvwprintw(status_win, 1, 5, "CMD: FF   ");
			send_ff_command(sock_fd);
			break;
		case 66:
			// DOWN - scroll files
			key_down();
			break;
		case 65:
			// UP - scroll files
			key_up();
			break;
		//case 410:
		case KEY_RESIZE:
			resize_windows();
			break;
		default:
			mvwprintw(status_win, 10, 1, "pressed:");
			mvwprintw(status_win, 11, 1, "%3d as '%c'", key, key);
			break;
		}
		wrefresh(status_win);
	}
}
示例#8
0
文件: world.c 项目: brownman/bastos85
/**
 * Function called when a keyboard key is released
 */
static void keyboard_up_func(unsigned char key, int x, int y){
	key_up(key);
}
int commandes_clavier()//la fonction sprintf tue l acces clavier
{
if ( keypressed())
{

int chi = readkey(); 
scan_ascii_is=(chi & 0xff);//prend pas en compte touches fonctions
scan_allegro_key_is=(chi >> 8);//prend en compte tout le monde mais à redistribuer fr et anglais


switch (chi >> 8)  
{	
    

case KEY_ESC://nettoyage chaine de caractere et deselection totale

reset_indexs_confirmation();
reset_index_actions();
key_unselect_ch();
if(window_focus_id==W_PLOT )
{
if(index_menus_lighting_plot==1) unselect_all_shapes();
else if( index_menus_lighting_plot==2 || index_menus_lighting_plot==4)
{reset_symbols_selected(view_plot_calc_number_is);}
}
else if(window_focus_id==W_ASKCONFIRM)
{
 substract_a_window(W_ASKCONFIRM);
 substract_a_window(previous_window_focus_id);
 mouse_released=1;
 window_focus_id=previous_window_focus_id;
 add_a_window(window_focus_id);      
}
sprintf(string_key_id,list_keyname[9]);
break;

///////////////////////PAGE UP DOWN POUR FENETRES /////////////////////////////
case KEY_PGUP: 
sprintf(string_key_id,list_keyname[0]);
key_switch_window_up();
break; 
case KEY_PGDN: 
sprintf(string_key_id,list_keyname[0]);
key_switch_window_down();
break; 
//////////////////SPECIAL KEYS ////////////////////////////////////////////////
case  KEY_TILDE://carré
if(window_focus_id==W_PLOT) {index_move_plot_view_port=toggle(index_move_plot_view_port);}
break;

case KEY_F1://dock mode
if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
{
reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_overrecord_mem=1;
clear_keybuf();

}
else if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
{
int mem_to_rec=(int)(atof(numeric)*10);

reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_create_mem=1;
}
else
{
index_do_report=0;
index_do_modify=0; 
index_main_clear=0;
index_do_dock=toggle(index_do_dock);

switch (window_focus_id)
{
case W_CHASERS:
index_affect_chaser_to_dock=index_do_dock;
break;   
case W_GRID:
for(int i=0;i<4;i++)
{
if(index_show_grid_player[i]==1)
{
gridplayer_to_affect_is=i; break;
}
}
break;
case W_MOVER:
index_affect_to_dock_mover=index_do_dock;     
break;    
case W_DRAW:
index_affect_draw_to_dock=index_do_dock;
break;
case W_ECHO:
index_affect_echo_to_dock=index_do_dock;
break;
case W_TIME:
index_affect_time=index_do_dock;   
break;
case W_TRACKINGVIDEO:
index_affect_video_tracking_to_dock=index_do_dock; 
break;
case W_TRICHROMY:
index_affect_color_to_dock=index_do_dock; 
break;
case W_AUDIO:
index_affect_audio_to_dock=index_do_dock;
player_to_affect_to_dock=0;
audio_type_for_dock_affectation_is=0;
break;
case W_CFGMENU:
if(config_page_is==1) { index_affect_dmxin=index_do_dock; }
else if(config_page_is==3) {index_do_affect_net_to_dock=index_do_dock; } 
break;
default:
break;      
}

}
break;
      
case KEY_F2:
index_do_dock=0;
index_do_report=0;
index_main_clear=0;
index_do_modify=toggle(index_do_modify);;      
break;      

case KEY_F3:
if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
{
index_do_dock=0;
index_do_modify=0; 
index_main_clear=0;
index_do_report=1;
reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_overecord_mem_plus_faders=1;               
}     
else if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) //creation mémoires en mode merge Faders / seq
{
index_do_dock=0;
index_do_modify=0; 
index_main_clear=0;
index_do_report=1;
int mem_to_rec=(int)(atof(numeric)*10);
reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_create_mem_plus_faders=1;
}
else
{
index_do_dock=0;
index_do_modify=0; 
index_main_clear=0;
index_do_report=toggle(index_do_report); 
}
break;  

case KEY_F4:
index_do_dock=0;
index_do_modify=0; 
index_do_report=0;     
index_main_clear=toggle(index_main_clear);
break;  

case KEY_F5:
              index_type=toggle(index_type);
              sprintf(numeric,"");numeric_postext=0;
break; 

case KEY_F6:
         if(index_time==0){add_a_window(W_TIME);  } 
           else {   substract_a_window(W_TIME); }
break;  

case KEY_F7:
if(index_trichro_window==0){add_a_window(W_TRICHROMY);} 
else  { substract_a_window(W_TRICHROMY);  }
break;  

case KEY_F8:
  if(index_video_window==0){ add_a_window(W_TRACKINGVIDEO); } 
 else{ substract_a_window(W_TRACKINGVIDEO);}
break;  

case KEY_F9:
          if(index_window_sequentiel==0){;add_a_window(W_SEQUENCIEL);}
          else {substract_a_window(W_SEQUENCIEL);}
break;
case KEY_F10:
if (key_shifts & KB_SHIFT_FLAG  || index_false_shift==1) //CONFIG
{
if(index_show_minifaders==0){add_a_window(W_MINIFADERS);}
else {substract_a_window(W_MINIFADERS);}
}
else
{
if(index_show_faders==0){add_a_window(W_FADERS);}
else {substract_a_window(W_FADERS);}
}

break;  

case KEY_F11:
if (key_shifts & KB_SHIFT_FLAG  || index_false_shift==1) //CONFIG
{
if(index_show_config_window==0){add_a_window(W_CFGMENU);}
else {substract_a_window(W_CFGMENU);}     
}
else if (key_shifts & KB_CTRL_FLAG  || index_false_control==1 ) 
{index_blind=toggle(index_blind);   }
else
{
if(index_show_banger_window==0)
          {add_a_window(W_BANGER);mouse_level_for_event=mouse_z;mouse_level_for_banger=mouse_z;}
          else {substract_a_window(W_BANGER);}       
}
break;  
              
case KEY_F12://black out

if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
{
index_ask_confirm=1;index_do_quit_with_save=1;
}

else if (key_shifts & KB_SHIFT_FLAG   || index_false_shift==1) 
{
for (int i=0;i<12;i++)
{
specify_who_to_save_load[i]=0;}
reset_save_load_report_string();     
index_ask_confirm=1;index_do_quit_without_save=1;
}

else
{
if(index_blind==0)
{
for (int rs=0;rs<513;rs++)
{bufferSaisie[rs]=0;Selected_Channel[rs]=0;   }   
sprintf(string_Last_Order,">> Black Out done for On Stage channels");      
}     
else if(index_blind==1)
{
for (int rs=0;rs<513;rs++)
{bufferBlind[rs]=0; Selected_Channel[rs]=0;   }    
sprintf(string_Last_Order,">> Black Out done for On Blind channels");                       
}
             
substract_channel_selection_to_layers_plot();
}  
break;    


case KEY_UP:
key_up();
sprintf(string_key_id,list_keyname[1]);
break;

case KEY_DOWN:
key_down();
sprintf(string_key_id,list_keyname[2]);
break;

case KEY_ENTER :
key_affectation();
sprintf(string_key_id,list_keyname[3]);
break; 

case KEY_ENTER_PAD:
key_affectation();
sprintf(string_key_id,list_keyname[4]);
break; 

case KEY_EQUALS://+
key_add_ch();
sprintf(string_key_id,list_keyname[5]);
break;

case KEY_PLUS_PAD://+ num
key_add_ch();
sprintf(string_key_id,list_keyname[6]);
break;

case KEY_MINUS://-
key_minus_ch();
sprintf(string_key_id,list_keyname[7]);
break;

case KEY_MINUS_PAD://- num
key_minus_ch();
sprintf(string_key_id,list_keyname[8]);
break;


case KEY_TAB:
if(numeric_postext>0)
{
key_thruth();
sprintf(string_key_id,list_keyname[10]);
}
else 
{
if(window_focus_id==W_PLOT) {index_tab_on=toggle(index_tab_on); }  
}
break;
////////////////////////////////////////////////////////////////////////////////////////////////


////////////////////TEXT TYPING OR FUNCTIONS CALLING//////////////////////////////////////////

case KEY_SPACE: 
              if (index_type==0)
             {
             key_go();
             }
              else if(index_type==1)
             {
             numeric[numeric_postext]=' ';
             numeric_postext++;
             }
       sprintf(string_key_id,list_keyname[11]);
       break;
             
         

        case KEY_Q: //lettre a
        if (key_shifts & KB_CTRL_FLAG  || index_false_control==1)
        {
        if(index_show_audio_window==0){add_a_window(W_AUDIO);}
        else {substract_a_window(W_AUDIO);}
        reset_audio_indexs_to_dock();       
        }
        else 
        {

             if(index_type==0)
             {
             key_presetvideo(0);
             }
             else  if (index_type==1)
             {
             numeric[numeric_postext]='A';
             numeric_postext++;
             }
         }
         sprintf(string_key_id,list_keyname[12]);
         break;  
       case KEY_B:
           if (index_type==0)
           {
           key_roi(10);
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='B';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[13]);
           break;
           
        case KEY_C:
            if (index_type==0)
           { 
            if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
            {
            if(numeric_postext==0)
            {
            channel_copy();
            }
            else
            {
            snap_mem_to_copy();  
            }
            } 
            else  if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
            {
            if(index_window_chasers==0){add_a_window(W_CHASERS);} 
            else {substract_a_window(W_CHASERS);}
            } 
           else
           {
           key_roi(8);         }
           } 
           else if (index_type==1)
           {
           numeric[numeric_postext]='C';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[14]);
           break;
           
        case KEY_D://dock mode on
           if(index_type==0)
           {
            key_roi(2);
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='D';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[15]);
           break;
           
        case KEY_E:
            if (index_type==0)
           {
           key_presetvideo(2);
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='E';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[16]);
           break;
           
        case KEY_F:
           if(index_type==0)
           {
           key_roi(3);
           }
           
           else if (index_type==1)
           {
           numeric[numeric_postext]='F';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[17]);
           break;
           
        case KEY_G:
            if (index_type==0)
           {
           if ((key_shifts & KB_CTRL_FLAG || index_false_control==1 ) && numeric_postext>0)
           {
           //GET CHANNELS FROM A MEMORY     
           int mem_to_take=(int)(atof(numeric)*10);
           if(MemoiresExistantes[mem_to_take]==1)
           {
           Get_channels_from_memory(mem_to_take);  
           }
           else {sprintf(string_Last_Order,"Get Sel. channel from %d.%d: mem doesn't exist",mem_to_take/10,mem_to_take%10);}   
           } 
           else {key_roi(4);}
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='G';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[18]);
           break;
           
           case KEY_H:

            if (index_type==0)
           {
           key_roi(5);   
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='H';
           numeric_postext++;
           }
           
           sprintf(string_key_id,list_keyname[19]);
           break;
        
        case KEY_I:    
           if(index_type==0) //full
           {
           key_full();
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='I';
           numeric_postext++;
           }
         sprintf(string_key_id,list_keyname[20]);
           break;
           
        case KEY_J:
           if (index_type==0)
           {
           key_time_out();
           }        
           if (index_type==1)
           {
           numeric[numeric_postext]='J';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[21]);
           break;
           
        case KEY_K:
            if (index_type==0)
           {
           key_time_in();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='K';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[22]);
           break;
           
        case KEY_L://in + out
           if(index_type==0)
           {
           key_time_in_out();
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='L';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[23]);
           break;
        
        case KEY_SEMICOLON:
           if(index_type==0)//le M qui est point en clavier americain
           {
           if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
           { if(index_show_mover_window=0){add_a_window(W_MOVER);}
           else {substract_a_window(W_MOVER);}}
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='M';
           numeric_postext++;     
           }
           sprintf(string_key_id,list_keyname[38]);
           break;  
                
        case KEY_N:
           if (index_type==0)
           {
           key_roi(11);          
           } 
           else if (index_type==1)
           {
           numeric[numeric_postext]='N';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[24]);
           break;
           
        case KEY_O:
       
         
           if(index_type==0)
           { 
           key_at_zero();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='O';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[25]);
           break;
           
        case KEY_P:

          if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
           {
           if(index_patch_window==0){add_a_window(W_PATCH);}
           else {substract_a_window(W_PATCH);} 
           } 
           else{
           if (index_type==0)
           {
             if(index_visual_pad==0){add_a_window(W_NUMPAD);}
             else {substract_a_window(W_NUMPAD);}  
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='P';
           numeric_postext++;
           }
           }
           sprintf(string_key_id,list_keyname[39]);
           break;

        case KEY_A: // lettre Q
            if (index_type==0)
           {
           key_roi(1);
            }
           else if (index_type==1)
           {
           numeric[numeric_postext]='Q';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[26]);
           break;        
  
        case KEY_R://report mode on
        if(index_type==0 )
        {
        key_presetvideo(3);;//les banques de tracking cam
        }
        else if(index_type==1)
        {
           numeric[numeric_postext]='R';
           numeric_postext++;
        }
        sprintf(string_key_id,list_keyname[27]);
           break;
           
        case KEY_S:
            if (index_type==0)
           {
           if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
           {
           if(index_is_saving==0){index_save_global_is=1;index_do_quick_save=1;}
           }
           else
           {
           key_roi(1);
           }
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='S';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[28]);
           break;
           
       case KEY_T:
           if(index_type==0)
           {
           key_presetvideo(4);//les banques de tracking cam
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='T';
           numeric_postext++;
           }         
           sprintf(string_key_id,list_keyname[29]);
           break;
           
        case KEY_U://inverse selection
           if (index_type==0)
           {
           key_select_inv();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='U';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[30]);
           break;
           
        case KEY_V:
           if (index_type==0)
           {
           if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
           {
           if(numeric_postext==0)
            {
            channel_paste();
            }
            else//si chiffre de mem tapée
            {
            index_copy_mem_in=1; 
            index_ask_confirm=1;
            
            }              
           } 
           else
           {
           //les aires de tracking cam
           key_roi(9);
           }
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='V';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[31]);
           break;
           
        case KEY_Z://w
           if (index_type==0)
           {
           if(key_shifts )
           {
           key_backward();
           }
           else{//les aires de tracking cam
           key_roi(6);
           }        
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='W';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[32]);
           break;
           
        case KEY_X:
           if (index_type==0)
           {
           if(key_shifts)
           {
           key_forward();
           }
          
           else{//les aires de tracking cam
           key_roi(7);
           }
           }
           else  if (index_type==1)
           {
           numeric[numeric_postext]='X';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[33]);
           break;
           
        case KEY_Y://select all 
          
          if (index_type==0)
           {
          key_select_all();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='Y';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[34]);
           break;
           
        case KEY_W://z
           if (key_shifts & KB_CTRL_FLAG  || index_false_control==1)
             {
             //ctrl Z reload mem as recorded
             index_do_reload_mem=1;
             index_ask_confirm=1;                   
             }
             else if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1)
             {
             //ctrl Z resurrect mem as recorded
             mem_to_resurrect=(int)(atof(numeric)*10);   
             index_do_resurrect_mem=1;  
             index_ask_confirm=1;                            
             }
           else
           {
            if (index_type==0 )
           {
           key_presetvideo(1);//les banques de tracking cam
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='Z';
           numeric_postext++;
           }
           }
           sprintf(string_key_id,list_keyname[35]);
           break;
           
    case KEY_LEFT:
    key_left(); 
    sprintf(string_key_id,list_keyname[36]);
    break;
       
       case KEY_RIGHT:
       key_right();
       sprintf(string_key_id,list_keyname[37]);
       break;
      
      case KEY_DEL:
      if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
      {
      reset_indexs_confirmation(); 
      index_do_delete_mem=1;  
      index_ask_confirm=1;       
      }
      break;
//////////////////////ENTREES NUMERIQUES COMMUNES//////////////////////////////////////////

case KEY_0:
numeric[numeric_postext]='0';
numeric_postext++;
break;
case KEY_0_PAD:
numeric[numeric_postext]='0';
numeric_postext++;
break;
case KEY_1:
numeric[numeric_postext]='1';
numeric_postext++;
break;
case KEY_1_PAD:
numeric[numeric_postext]='1';
numeric_postext++;
break;

case KEY_2:
numeric[numeric_postext]='2';
numeric_postext++;
break;
case KEY_2_PAD:
numeric[numeric_postext]='2';
numeric_postext++;
break;
case KEY_3:
numeric[numeric_postext]='3';
numeric_postext++;
break;
case KEY_3_PAD:
numeric[numeric_postext]='3';
numeric_postext++;
break;
case KEY_4:
numeric[numeric_postext]='4';
numeric_postext++;
break;
case KEY_4_PAD:
numeric[numeric_postext]='4';
numeric_postext++;
break;
case KEY_5:
numeric[numeric_postext]='5';
numeric_postext++;
break;
case KEY_5_PAD:
numeric[numeric_postext]='5';
numeric_postext++;
break;
case KEY_6:
numeric[numeric_postext]='6';
numeric_postext++;
break;
case KEY_6_PAD:
numeric[numeric_postext]='6';
numeric_postext++;
break;
case KEY_7:
numeric[numeric_postext]='7';
numeric_postext++;
break;
case KEY_7_PAD:
numeric[numeric_postext]='7';
numeric_postext++;
break;
case KEY_8:
numeric[numeric_postext]='8';
numeric_postext++;
break;
case KEY_8_PAD:
numeric[numeric_postext]='8';
numeric_postext++;
break;
case KEY_9:
numeric[numeric_postext]='9';
numeric_postext++;
break;
case KEY_9_PAD:
numeric[numeric_postext]='9';
numeric_postext++;
break;   

case KEY_COMMA:
numeric[numeric_postext]='.';
numeric_postext++;
break;

case  KEY_DEL_PAD:
numeric[numeric_postext]='.';
numeric_postext++;
break;

case  KEY_M:
numeric[numeric_postext]='.';
numeric_postext++;
break;


case KEY_BACKSPACE:
numeric[numeric_postext]=' ';
numeric_postext--;
numeric[numeric_postext]=' ';
if (numeric_postext<0) {numeric_postext=0;}
break;   

////////////////////MISE EN MEMOIRES DES FENETRES ET TOGGLE/////////////////////
case KEY_PRTSCR:
key_printscreen();              
break; 

default:
      
break;
}  
for(int u=0;u<nbre_key_persos;u++)
{
//keys persos
if( (int)(chi & 0xff)==mapping_temporaire[u])
{
switch(u)
{
case 0://AT level
key_affectation();
sprintf(string_key_id,"At Level");//max 16 char
break;
case 1://CH+
key_add_ch();
sprintf(string_key_id,"Ch +");//max 16 char
break;
case 2://CH-
key_minus_ch();
sprintf(string_key_id,"Ch -");//max 16 char     
break;
case 3://CH THRUTH
key_thruth();
sprintf(string_key_id,"To Ch");//max 16 char     
break;
case 4://CLEAR
key_unselect_ch();
sprintf(string_key_id,"Clear");//max 16 char        
break;
default:
break;
}
}
}



   
//protections

if (numeric_postext>maxchar_numeric){numeric[numeric_postext]=' ';numeric_postext=maxchar_numeric-1;}

if (numeric_postext<0) {numeric_postext=0;} 


       
}
sprintf(string_numeric_entry,"<< %s",numeric);


//CTRL-S
if(index_do_quick_save==1 )
      {
      Save_Show();
      sprintf(string_Last_Order,">> Show Saved at %s", tmp_time);
      index_do_quick_save=0;
      }
      
poll_keyboard();
      
return(0);  
}
示例#10
0
void EMU::update_input()
{
#ifdef USE_SHIFT_NUMPAD_KEY
	// update numpad key status
	if(key_shift_pressed && !key_shift_released) {
		if(key_status[VK_SHIFT] == 0) {
			// shift key is newly pressed
			key_status[VK_SHIFT] = 0x80;
#ifdef NOTIFY_KEY_DOWN
			vm->key_down(VK_SHIFT, false);
#endif
		}
	}
	else if(!key_shift_pressed && key_shift_released) {
		if(key_status[VK_SHIFT] != 0) {
			// shift key is newly released
			key_status[VK_SHIFT] = 0;
#ifdef NOTIFY_KEY_DOWN
			vm->key_up(VK_SHIFT);
#endif
			// check l/r shift
			if(!(GetAsyncKeyState(VK_LSHIFT) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
			if(!(GetAsyncKeyState(VK_RSHIFT) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
		}
	}
	key_shift_pressed = key_shift_released = false;
#endif
	
	// release keys
#ifdef USE_AUTO_KEY
	if(lost_focus && autokey_phase == 0) {
#else
	if(lost_focus) {
#endif
		// we lost key focus so release all pressed keys
		for(int i = 0; i < 256; i++) {
			if(key_status[i] & 0x80) {
				key_status[i] &= 0x7f;
#ifdef NOTIFY_KEY_DOWN
				if(!key_status[i]) {
					vm->key_up(i);
				}
#endif
			}
		}
	}
	else {
		for(int i = 0; i < 256; i++) {
			if(key_status[i] & 0x7f) {
				key_status[i] = (key_status[i] & 0x80) | ((key_status[i] & 0x7f) - 1);
#ifdef NOTIFY_KEY_DOWN
				if(!key_status[i]) {
					vm->key_up(i);
				}
#endif
			}
		}
	}
	lost_focus = false;
	
	// update joystick status
	memset(joy_status, 0, sizeof(joy_status));
	for(int i = 0; i < joy_num && i < 2; i++) {
		JOYINFOEX joyinfo;
		joyinfo.dwSize = sizeof(JOYINFOEX);
		joyinfo.dwFlags = JOY_RETURNALL;
		if(joyGetPosEx(i, &joyinfo) == JOYERR_NOERROR) {
			if(joyinfo.dwYpos < 0x3fff) joy_status[i] |= 0x01;	// up
			if(joyinfo.dwYpos > 0xbfff) joy_status[i] |= 0x02;	// down
			if(joyinfo.dwXpos < 0x3fff) joy_status[i] |= 0x04;	// left
			if(joyinfo.dwXpos > 0xbfff) joy_status[i] |= 0x08;	// right
			joy_status[i] |= ((joyinfo.dwButtons & joy_mask[i]) << 4);
		}
	}
#ifdef USE_KEY_TO_JOY
	// emulate joystick #1 with keyboard
	if(key_status[0x26]) joy_status[0] |= 0x01;	// up
	if(key_status[0x28]) joy_status[0] |= 0x02;	// down
	if(key_status[0x25]) joy_status[0] |= 0x04;	// left
	if(key_status[0x27]) joy_status[0] |= 0x08;	// right
#endif
	
	// update mouse status
	memset(mouse_status, 0, sizeof(mouse_status));
	if(mouse_enabled) {
		// get current status
		POINT pt;
		GetCursorPos(&pt);
		ScreenToClient(main_window_handle, &pt);
		mouse_status[0]  = pt.x - display_width / 2;
		mouse_status[1]  = pt.y - display_height / 2;
		mouse_status[2]  = (GetAsyncKeyState(VK_LBUTTON) & 0x8000) ? 1 : 0;
		mouse_status[2] |= (GetAsyncKeyState(VK_RBUTTON) & 0x8000) ? 2 : 0;
		mouse_status[2] |= (GetAsyncKeyState(VK_MBUTTON) & 0x8000) ? 4 : 0;
		// move mouse cursor to the center of window
		if(!(mouse_status[0] == 0 && mouse_status[1] == 0)) {
			pt.x = display_width / 2;
			pt.y = display_height / 2;
			ClientToScreen(main_window_handle, &pt);
			SetCursorPos(pt.x, pt.y);
		}
	}
	
#ifdef USE_AUTO_KEY
	// auto key
	switch(autokey_phase) {
	case 1:
		if(autokey_buffer && !autokey_buffer->empty()) {
			// update shift key status
			int shift = autokey_buffer->read_not_remove(0) & 0x100;
			if(shift && !autokey_shift) {
				key_down(VK_SHIFT, false);
			}
			else if(!shift && autokey_shift) {
				key_up(VK_SHIFT);
			}
			autokey_shift = shift;
			autokey_phase++;
			break;
		}
	case 3:
		if(autokey_buffer && !autokey_buffer->empty()) {
			key_down(autokey_buffer->read_not_remove(0) & 0xff, false);
		}
		autokey_phase++;
		break;
	case USE_AUTO_KEY:
		if(autokey_buffer && !autokey_buffer->empty()) {
			key_up(autokey_buffer->read_not_remove(0) & 0xff);
		}
		autokey_phase++;
		break;
	case USE_AUTO_KEY_RELEASE:
		if(autokey_buffer && !autokey_buffer->empty()) {
			// wait enough while vm analyzes one line
			if(autokey_buffer->read() == 0xd) {
				autokey_phase++;
				break;
			}
		}
	case 30:
		if(autokey_buffer && !autokey_buffer->empty()) {
			autokey_phase = 1;
		}
		else {
			stop_auto_key();
		}
		break;
	default:
		if(autokey_phase) {
			autokey_phase++;
		}
	}
#endif
}

#ifdef USE_SHIFT_NUMPAD_KEY
static const int numpad_table[256] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//	0x00, 0x69, 0x63, 0x61, 0x67, 0x64, 0x68, 0x66, 0x62, 0x00, 0x00, 0x00, 0x00, 0x60, 0x6e, 0x00,
	0x00, 0x69, 0x63, 0x61, 0x67, 0x64, 0x68, 0x66, 0x62, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,	// remove shift + period
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#endif

void EMU::key_down(int code, bool repeat)
{
	bool keep_frames = false;
	
	if(code == VK_SHIFT) {
		if(GetAsyncKeyState(VK_LSHIFT) & 0x8000) key_status[VK_LSHIFT] = 0x80;
		if(GetAsyncKeyState(VK_RSHIFT) & 0x8000) key_status[VK_RSHIFT] = 0x80;
		if(!(key_status[VK_LSHIFT] || key_status[VK_RSHIFT])) key_status[VK_LSHIFT] = 0x80;
	}
	else if(code == VK_CONTROL) {
		if(GetAsyncKeyState(VK_LCONTROL) & 0x8000) key_status[VK_LCONTROL] = 0x80;
		if(GetAsyncKeyState(VK_RCONTROL) & 0x8000) key_status[VK_RCONTROL] = 0x80;
		if(!(key_status[VK_LCONTROL] || key_status[VK_RCONTROL])) key_status[VK_LCONTROL] = 0x80;
	}
	else if(code == VK_MENU) {
		if(GetAsyncKeyState(VK_LMENU) & 0x8000) key_status[VK_LMENU] = 0x80;
		if(GetAsyncKeyState(VK_RMENU) & 0x8000) key_status[VK_RMENU] = 0x80;
		if(!(key_status[VK_LMENU] || key_status[VK_RMENU])) key_status[VK_LMENU] = 0x80;
	}
	else if(code == 0xf0) {
		code = VK_CAPITAL;
		keep_frames = true;
	}
	else if(code == 0xf2) {
		code = VK_KANA;
		keep_frames = true;
	}
	else if(code == 0xf3 || code == 0xf4) {
		code = VK_KANJI;
		keep_frames = true;
	}
#ifdef USE_SHIFT_NUMPAD_KEY
	if(code == VK_SHIFT) {
		key_shift_pressed = true;
		return;
	}
	else if(numpad_table[code] != 0) {
		if(key_shift_pressed || key_shift_released) {
			key_converted[code] = 1;
			key_shift_pressed = true;
			code = numpad_table[code];
		}
	}
#endif
	if(!(code == VK_SHIFT || code == VK_CONTROL || code == VK_MENU)) {
		code = keycode_conv[code];
	}
	
#ifdef DONT_KEEEP_KEY_PRESSED
	if(!(code == VK_SHIFT || code == VK_CONTROL || code == VK_MENU)) {
		key_status[code] = KEY_KEEP_FRAMES;
	}
	else
#endif
	key_status[code] = keep_frames ? KEY_KEEP_FRAMES : 0x80;
#ifdef NOTIFY_KEY_DOWN
	if(keep_frames) {
		repeat = false;
	}
	vm->key_down(code, repeat);
#endif
}