Issue 453 : Virtual keyboard setting

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1999 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2012-09-18 23:41:55 +00:00
parent b31cf6b61e
commit 144a28412b
7 changed files with 137 additions and 122 deletions

View File

@ -57,7 +57,7 @@ ifdef COMSPEC
RMDIR = rmdir --ignore-fail-on-non-empty
CP = cp
BIN = ../bin/grafx2.exe
COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT) $(VKEYCOPT) $(LUACOPT)
COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT) $(LUACOPT)
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng14 $(LUALOPT)
LUALOPT = -llua
CC = gcc
@ -268,7 +268,7 @@ endif
LUACOPT = -I/resources/indexes/include
LUALOPT = -llua
BIN = ../bin/grafx2
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g `sdl-config --cflags` -I/resources/indexes/include/SDL $(TTFCOPT) $(LUACOPT) $(JOYCOPT) $(VKEYCOPT) -O$(OPTIM)
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g `sdl-config --cflags` -I/resources/indexes/include/SDL $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM)
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT) -lm
CC = gcc
OBJDIR = ../obj/syllable
@ -306,7 +306,7 @@ endif
#cross compile an exec for the gp2x
CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc
BIN = ../bin/grafx2.gpe
COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -static -g -O$(OPTIM) -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --cflags` $(TTFCOPT) -D__GP2X__ $(TTFCOPT) $(JOYCOPT) $(VKEYCOPT) $(LUACOPT)
COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -static -g -O$(OPTIM) -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --cflags` $(TTFCOPT) -D__GP2X__ $(TTFCOPT) $(JOYCOPT) $(LUACOPT)
LOPT = -static -lSDL_image `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --static-libs` -ljpeg -lpng -lz -lm $(TTFLOPT) $(LUALOPT)
OBJDIR = ../obj/gp2x
NOTTF = 1
@ -346,7 +346,7 @@ endif
# Compiles a regular linux executable for the native platform
BIN = ../bin/grafx2
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT) $(LUACOPT) $(JOYCOPT) $(VKEYCOPT) -O$(OPTIM) `pkg-config --cflags libpng`
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM) `pkg-config --cflags libpng`
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) `pkg-config --libs libpng` $(LUALOPT) -lm
CC = gcc
OBJDIR = ../obj/unix
@ -417,13 +417,6 @@ ifeq ($(USE_JOYSTICK),1)
JOYCOPT = -DUSE_JOYSTICK
endif
#To enable virtual keyboard input (mouse-driven), make VIRT_KEY=1
#This is automatically enabled on some platforms, but this
#switch allows you to test the virtual keyboard on any other platform.
ifeq ($(VIRT_KEY),1)
VKEYCOPT = -DVIRT_KEY
endif
### And now for the real build rules ###
.PHONY : all debug release clean depend zip version force install uninstall

View File

@ -756,6 +756,13 @@ const T_Lookup Lookup_SwapButtons[] = {
{NULL,-1},
};
const T_Lookup Lookup_VirtualKeyboard[] = {
{"Auto",0},
{"ON",1},
{"OFF",2},
{NULL,-1},
};
typedef struct {
const char* Label;
byte Type; // 0: label, 1+: setting (size in bytes)
@ -937,7 +944,7 @@ void Button_Settings(void)
//{" horizontally:",1,&(selected_config.Mouse_sensitivity_index_x),1,4,0,Lookup_MouseSpeed},
//{" vertically:",1,&(selected_config.Mouse_sensitivity_index_y),1,4,0,Lookup_MouseSpeed},
{"Key to swap buttons:",2,&(selected_config.Swap_buttons),0,0,0,Lookup_SwapButtons},
{"",0,NULL,0,0,0,NULL},
{"Virtual keyboard",1,&(selected_config.Use_virtual_keyboard),0,2,0,Lookup_VirtualKeyboard},
{"",0,NULL,0,0,0,NULL},
{"",0,NULL,0,0,0,NULL},

View File

@ -2473,6 +2473,15 @@ static const T_Help_table helptable_settings_details[] =
HELP_TEXT ("controllers, such as touchscreens and")
HELP_TEXT ("tablets.")
HELP_TEXT ("")
HELP_BOLD (" Virtual keyboard")
HELP_TEXT ("This setting activates a graphical 'virtual")
HELP_TEXT ("keyboard' whenever you have to type text in")
HELP_TEXT ("a menu. It's designed for devices that don't")
HELP_TEXT ("provide a physical keyboard, such as tablet")
HELP_TEXT ("PCs and portable consoles. The default")
HELP_TEXT ("setting 'auto' means ON for a portable")
HELP_TEXT ("console and OFF for all others.")
HELP_TEXT ("")
HELP_TITLE("EDITING")
HELP_TEXT ("")
HELP_TEXT ("")

View File

@ -979,7 +979,13 @@ int Load_INI(T_Config * conf)
conf->Tilemap_show_count=(values[0]!=0);
}
conf->Use_virtual_keyboard=0;
// Optional, enables virtual keyboard (>=2.4)
if (!Load_INI_get_values (file,buffer,"Use_virtual_keyboard",1,values))
{
if (values[0]>=0 && values[0]<=2)
conf->Use_virtual_keyboard=values[0];
}
// Insert new values here

View File

@ -51,11 +51,11 @@
#include <datatypes/textclass.h>
#endif
// Virtual keyboard is mandatory on these platforms:
// Virtual keyboard is ON by default on these platforms:
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
#ifndef VIRT_KEY
#define VIRT_KEY 1
#endif
#define VIRT_KEY_DEFAULT_ON 1
#else
#define VIRT_KEY_DEFAULT_ON 0
#endif
#define TEXT_COLOR MC_Black
@ -369,7 +369,6 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
word window_y=Window_pos_Y;
byte offset=0; // index du premier caractère affiché
#ifdef VIRT_KEY
// Virtual keyboard
byte use_virtual_keyboard=0;
static byte caps_lock=0;
@ -386,7 +385,6 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
':',';','`','\'','"','~',
'!','?','^','&','#','$'
};
#endif
// Si on a commencé à editer par un clic-droit, on vide la chaine.
if (Mouse_K==RIGHT_SIDE)
@ -404,7 +402,9 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
}
// Virtual keyboards
#ifdef VIRT_KEY
if (Config.Use_virtual_keyboard==1 ||
(VIRT_KEY_DEFAULT_ON && Config.Use_virtual_keyboard==0))
{
if (input_type == INPUT_TYPE_STRING || input_type == INPUT_TYPE_FILENAME )
{
int x,y;
@ -507,7 +507,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
Update_window_area(0,0,Window_width, Window_height);
Display_cursor();
}
#endif
}
Keyboard_click_allowed = 0;
Hide_cursor();
@ -546,7 +546,6 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
while ((input_key!=SDLK_RETURN) && (input_key!=KEY_ESC))
{
Display_cursor();
#ifdef VIRT_KEY
if (use_virtual_keyboard)
{
int clicked_button;
@ -583,7 +582,6 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
}
}
else
#endif
{
do
{
@ -751,7 +749,6 @@ affichage:
} // End du "while"
Keyboard_click_allowed = 1;
#ifdef VIRT_KEY
if (use_virtual_keyboard)
{
byte old_mouse_k = Mouse_K;
@ -759,7 +756,6 @@ affichage:
Mouse_K=old_mouse_k;
Input_sticky_control=0;
}
#endif
// Effacement de la chaîne
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),

View File

@ -717,6 +717,10 @@ int Save_INI(T_Config * conf)
if ((return_code=Save_INI_set_values (old_file,new_file,buffer,"Tilemap_count",1,values,1)))
goto Erreur_Retour;
values[0]=conf->Use_virtual_keyboard;
if ((return_code=Save_INI_set_values (old_file,new_file,buffer,"Use_virtual_keyboard",1,values,0)))
goto Erreur_Retour;
// Insert new values here

View File

@ -373,7 +373,7 @@ typedef struct
byte Tilemap_allow_flipped_x; ///< Boolean, true if the Tilemap tool should detect x-flipped tiles.
byte Tilemap_allow_flipped_y; ///< Boolean, true if the Tilemap tool should detect y-flipped tiles.
byte Tilemap_show_count; ///< Boolean, true if the Tilemap tool should display tile count after analysis.
byte Use_virtual_keyboard; ///< 0: Auto, 1: On, 2: Off
} T_Config;