Patch level : 2.0 680

Files correlati     : avaga.dll
Ricompilazione Demo : [ ]
Commento            :

Aggiunta possibilta' di disabiltare la trasformazione del "punto" del tastierino
numerico in "virgola".  Aggiungere nel paragrafo [Main] del campo.ini
la voce: Point2Comma=0.  Se tale voce non esiste si sottointende Point2Comma=1


git-svn-id: svn://10.65.10.50/trunk@11751 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-02-06 15:16:17 +00:00
parent cdef646712
commit 05af1c9d28
3 changed files with 116 additions and 24 deletions

View File

@ -673,15 +673,22 @@ void TwxWindow::DoXvtEvent(EVENT& e)
void TwxWindow::OnChar(wxKeyEvent& event)
{
static bool bSkipNextDotKey = FALSE;
static int nSkipNextDotKey = -883; // Valore indefinito
if (nSkipNextDotKey == -883) // Devo stabilire se attivare la gestione o no
{
const char* campoini = xvt_fsys_get_campo_ini();
char strPoint2Comma[2];
xvt_sys_get_profile_string(campoini, "Main", "Point2Comma", "1", strPoint2Comma, 2);
nSkipNextDotKey = atoi(strPoint2Comma) != 0 ? 0 : -1; // Dis/Abilita conversione punto in virgola
}
EVENT e; memset(&e, 0, sizeof(EVENT));
e.type = E_CHAR;
int k = event.GetKeyCode();
if (bSkipNextDotKey)
if (nSkipNextDotKey == 1)
{
bSkipNextDotKey = FALSE;
nSkipNextDotKey = 0;
if (k == '.')
{
event.Skip();
@ -707,8 +714,11 @@ void TwxWindow::OnChar(wxKeyEvent& event)
return;
case WXK_NUMPAD_DECIMAL: // ??? Non arriva mai
case WXK_DECIMAL: // ??? Arriva sia '.' sia WXK_DECIMAL=340
k = ','; // Trasformo il punto in virgola
bSkipNextDotKey = TRUE;
if (nSkipNextDotKey == 0)
{
k = ','; // Trasformo il punto in virgola
nSkipNextDotKey = 1;
}
break;
case WXK_NUMPAD_ADD: k = '+'; break;
case WXK_DOWN : k = K_DOWN; break;
@ -1568,7 +1578,6 @@ BOOLEAN xvt_dm_post_speech(const char* text, int priority, BOOLEAN async)
{
#ifdef WIN32
ok = OsWin32_Speak(text, async != 0);
#else
#endif
}
#endif
@ -3961,24 +3970,6 @@ void xvt_sys_searchenv(const char * filename, const char * varname, char * pathn
const char * value = getenv(varname);
if (value)
{
/*
char path_list[4096];
const char * s = path_list;
strcpy(path_list, value);
do
{
char* s1 = strchr(s, ';');
if (s1 != NULL)
*s1 = '\0';
char fname[256];
strcpy(fname, s);
strcat(fname, filename);
if (wxFileExists(fname))
strcpy(pathname, s); // Secondo Guy manca break
if (s1 != NULL)
s = s1 + 1;
} while (s); // Secondo Guy e' sempre != NULL
*/
char path_list[4096];
strcpy(path_list, value);
for (const char* s = path_list; *s; )

View File

@ -165,6 +165,7 @@ XVTDLL BOOLEAN xvt_fsys_rmdir(const char *pathname);
XVTDLL BOOLEAN xvt_fsys_removefile(const char *pathname);
XVTDLL BOOLEAN xvt_fsys_access(const char *pathname, int mode);
XVTDLL BOOLEAN xvt_fsys_file_exists(const char *pathname);
XVTDLL const char* xvt_fsys_get_campo_ini();
XVTDLL void xvt_help_close_helpfile(XVT_HELP_INFO hi);
XVTDLL XVT_HELP_INFO xvt_help_open_helpfile(FILE_SPEC *fs, unsigned long flags);

View File

@ -710,3 +710,103 @@ BOOLEAN xvt_print_get_default_device(char* name, int namesize)
return ok;
}
///////////////////////////////////////////////////////////
// Gestione files di configurazione
///////////////////////////////////////////////////////////
int xvt_fsys_get_campo_stp_value(const char* name, char* value, int valsize)
{
BOOLEAN bFound = FALSE;
#ifdef WIN32
const char* stpfile = "c:/campo.stp";
int p;
DIRECTORY dir;
char exedir[_MAX_PATH], path[_MAX_PATH];
xvt_fsys_get_default_dir(&dir);
xvt_fsys_convert_dir_to_str(&dir, exedir, sizeof(exedir));
for (p = 1; ; p++)
{
int len = 0;
char para[4]; sprintf(para, "%d", p);
len = xvt_sys_get_profile_string(stpfile, para, "Program", "", path, sizeof(path));
if (len <= 0)
break;
if (path[len-1] == '\\' || path[len-1] == '/')
{
len--;
path[len] = '\0';
}
if (xvt_str_compare_ignoring_case(path, exedir) == 0)
{
xvt_sys_get_profile_string(stpfile, para, name, "", value, valsize);
bFound = *value > ' ';
break;
}
}
#endif
return bFound;
}
/*
@($) CGetCampoIni FILES
@(ID)
Restituisce il nome del file che contiene il prefisso corrente.
@(FD)
@(ISV)
s,s1 = stringhe di lavoro.
Versione WIN32 e LINUX.
@(FSV)
*/
const char* xvt_fsys_get_campo_ini()
{
static char* prawin = NULL;
if (prawin == NULL)
{
BOOLEAN bFound = FALSE;
#ifdef WIN32
// Nelle installazioni sfigate con programmi in rete cerca di stabilire il percorso locale di Campo.ini
DIRECTORY dir;
char exedir[_MAX_PATH], path[_MAX_PATH];
xvt_fsys_get_default_dir(&dir);
xvt_fsys_convert_dir_to_str(&dir, exedir, sizeof(exedir));
if (xvt_fsys_is_network_drive(exedir))
{
bFound = xvt_fsys_get_campo_stp_value("CampoIni", path, sizeof(path));
if (!bFound)
{
const char* pp = getenv("PREFPATH");
if (pp != NULL)
{
char dri[_MAX_DRIVE], dir[_MAX_PATH];
xvt_fsys_parse_pathname(pp, dri, dir, NULL, NULL, NULL);
xvt_fsys_build_pathname(path, dri, dir, "campo", "ini", NULL);
bFound = TRUE;
}
}
}
#endif
if (!bFound)
{
#ifdef LINUX
char ininame[32];
sprintf(ininame, "campo%u", getuid());
xvt_fsys_build_pathname(path, NULL, exedir, ininame, "ini", NULL);
#else
xvt_fsys_build_pathname(path, NULL, exedir, "campo", "ini", NULL);
#endif
if (!xvt_fsys_file_exists(path))
{
char msg[256];
sprintf(msg, "Impossibile aprire '%s'", (const char *)path);
xvt_dm_post_fatal_exit(msg);
}
}
prawin = xvt_str_duplicate(path);
}
return prawin;
}