Patch level : 2.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Aggiunto supporto per sintesi vocale.
Potenziata gestione directory custom.
Aggiunto nuovo config CONFIG_GUI alternativo a CONFIG_USER per gestione colori


git-svn-id: svn://10.65.10.50/trunk@11494 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-10-14 13:42:54 +00:00
parent 66acb35beb
commit 73159b6e3b
8 changed files with 73 additions and 43 deletions

View File

@ -219,7 +219,7 @@ int TSelect_color_mask::add_color_def(const char * key, const char * prompt, COL
riga << p->get_prompt(); riga << p->get_prompt();
TString tmp(_mask_name) ; tmp << "_" << _paragraph; TString tmp(_mask_name) ; tmp << "_" << _paragraph;
TConfig conf(CONFIG_USER, tmp); TConfig conf(CONFIG_GUI, tmp);
tmp = p->get_key(); tmp = p->get_key();
if (conf.exist(tmp)) if (conf.exist(tmp))
@ -313,7 +313,7 @@ TSelect_color_mask::TSelect_color_mask(const TSheet_field & field)
void TSelect_color_mask::save() const void TSelect_color_mask::save() const
{ {
TString tmp(_mask_name) ; tmp << "_" << _paragraph; TString tmp(_mask_name) ; tmp << "_" << _paragraph;
TConfig conf(CONFIG_USER, tmp); TConfig conf(CONFIG_GUI, tmp);
const int items = _color_defs.items(); const int items = _color_defs.items();
for (int i = 0; i < items; i++) for (int i = 0; i < items; i++)

View File

@ -701,16 +701,18 @@ TConfig::TConfig(int which_config, const char* paragraph)
_file.add("ditta.ini"); _file.add("ditta.ini");
if (!_file.exist()) if (!_file.exist())
{ {
TFilename oldfile = firm2dir(prefix().get_codditta()); TFilename oldfile = _file;
const int pos = oldfile.find("ditta.ini");
oldfile.cut(pos);
oldfile.add("prassid.ini"); // Old config file! oldfile.add("prassid.ini"); // Old config file!
if (oldfile.exist()) if (oldfile.exist())
fcopy(oldfile, _file); fcopy(oldfile, _file);
} }
break; break;
case CONFIG_STUDIO: case CONFIG_STUDIO:
case CONFIG_USER:
case CONFIG_STAMPE: case CONFIG_STAMPE:
case CONFIG_GUI:
case CONFIG_USER:
_file = firm2dir(-1); // Directory dati _file = firm2dir(-1); // Directory dati
_file.add("config"); // + Directory config _file.add("config"); // + Directory config
if (!_file.exist()) // Creala se necessario if (!_file.exist()) // Creala se necessario
@ -720,18 +722,28 @@ TConfig::TConfig(int which_config, const char* paragraph)
{ {
case CONFIG_STUDIO: case CONFIG_STUDIO:
_file.add("studio.ini"); _file.add("studio.ini");
if (!_file.exist() && fexist("studio.ini")) if (!_file.exist())
{ {
TFilename old = _file.path(); TFilename oldfile = _file;
old.add("prassis.ini"); // Old config file! const int pos = oldfile.find("studio.ini");
if (old.exist()) oldfile.cut(pos);
fcopy(old, _file); oldfile.add("prassid.ini"); // Old config file!
} if (oldfile.exist())
fcopy(oldfile, _file);
}
break; break;
case CONFIG_STAMPE: case CONFIG_STAMPE:
_file.add("print.ini"); _file.add("print.ini");
break; break;
case CONFIG_GUI:
{
TFilename gui = "gui.ini";
if (gui.custom_path()) // I colori sono qui, scavalca utente
{
_file = gui;
break;
}
}
case CONFIG_USER: case CONFIG_USER:
{ {
TString16 u = user(); TString16 u = user();
@ -760,8 +772,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
_file = CGetCampoIni(); _file = CGetCampoIni();
break; break;
case CONFIG_GODMODE: case CONFIG_GODMODE:
_file = firm2dir(0); _file = "gm.ini";
_file.add("gm.ini"); _file.custom_path();
if (paragraph == NULL || *paragraph == '\0') if (paragraph == NULL || *paragraph == '\0')
paragraph = "GODMODE"; paragraph = "GODMODE";
break; break;

View File

@ -22,8 +22,10 @@ class TConfig;
#define CONFIG_USER 5 #define CONFIG_USER 5
// file parametri stampe // file parametri stampe
#define CONFIG_STAMPE 6 #define CONFIG_STAMPE 6
// file parametri GUI (nel senso di Graphic User Interface)
#define CONFIG_GUI 7
// file parametri godmode // file parametri godmode
#define CONFIG_GODMODE 7 #define CONFIG_GODMODE 8
// Callback per for_each_paragraph // Callback per for_each_paragraph
typedef int (*CONFIG_CALLBACK)(TConfig& cfg, void* jolly); typedef int (*CONFIG_CALLBACK)(TConfig& cfg, void* jolly);

View File

@ -147,7 +147,7 @@ XVT_FNTID xvt_default_font(bool bold)
{ {
DEF_FONT = xvt_dwin_get_font(TASK_WIN); DEF_FONT = xvt_dwin_get_font(TASK_WIN);
TConfig font(CONFIG_USER, "Font"); TConfig font(CONFIG_GUI, "Font");
TString font_ser_desc(font.get("FontDesc")); TString font_ser_desc(font.get("FontDesc"));
if (font_ser_desc.empty()) if (font_ser_desc.empty())
font_ser_desc = "01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier"; font_ser_desc = "01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier";
@ -229,7 +229,7 @@ void customize_colors()
// @xref <c TConfig> // @xref <c TConfig>
{ {
TConfig colors(CONFIG_USER, "Colors"); TConfig colors(CONFIG_GUI, "Colors");
MASK_BACK_COLOR = colors.get_color("MaskBack", NULL, -1, MASK_BACK_COLOR); MASK_BACK_COLOR = colors.get_color("MaskBack", NULL, -1, MASK_BACK_COLOR);
MASK_LIGHT_COLOR = colors.get_color("MaskLight", NULL, -1, MASK_LIGHT_COLOR); MASK_LIGHT_COLOR = colors.get_color("MaskLight", NULL, -1, MASK_LIGHT_COLOR);
@ -246,6 +246,8 @@ void customize_colors()
AUTOSELECT = colors.get_bool("AutoSelect", NULL, -1, AUTOSELECT); AUTOSELECT = colors.get_bool("AutoSelect", NULL, -1, AUTOSELECT);
ADVANCED_GRAPHICS = colors.get_bool("AdvancedGraphics", NULL, -1, ADVANCED_GRAPHICS); ADVANCED_GRAPHICS = colors.get_bool("AdvancedGraphics", NULL, -1, ADVANCED_GRAPHICS);
SMALL_ICONS = colors.get_bool("SmallIcons", NULL, -1, SMALL_ICONS); SMALL_ICONS = colors.get_bool("SmallIcons", NULL, -1, SMALL_ICONS);
const int SPEECH_MODE = colors.get_int("SpeechMode", NULL, -1, 0);
xvt_vobj_set_attr(NULL_WIN, ATTR_SPEECH_MODE, SPEECH_MODE);
xi_set_pref(XI_PREF_COLOR_LIGHT, MASK_LIGHT_COLOR); xi_set_pref(XI_PREF_COLOR_LIGHT, MASK_LIGHT_COLOR);
xi_set_pref(XI_PREF_COLOR_CTRL, MASK_BACK_COLOR); xi_set_pref(XI_PREF_COLOR_CTRL, MASK_BACK_COLOR);
@ -375,15 +377,9 @@ HIDDEN XI_BITMAP* get_background_bitmap()
{ {
if (bmp == NULL && !checked) if (bmp == NULL && !checked)
{ {
const char* ext[] = { "jpg", "gif", "bmp", NULL }; TConfig ini(CONFIG_GUI, "Colors");
bool ok = false; TFilename back = ini.get("Tile");
TFilename back("back"); if (back.custom_path())
for (int i = 0; !ok && ext[i]; i++)
{
back.ext(ext[i]);
ok = back.custom_path();
}
if (ok)
bmp = xi_bitmap_create(back.get_buffer(), XI_BITMAP_TILE); bmp = xi_bitmap_create(back.get_buffer(), XI_BITMAP_TILE);
checked = TRUE; checked = TRUE;
} }
@ -1353,7 +1349,7 @@ void TButton_control::create(WINDOW win, short cid,
{ {
bool bold; bool bold;
COLOR color; COLOR color;
TString80 txt(text); txt.trim(); TString txt(text); txt.trim();
char mnemonic = '\0'; char mnemonic = '\0';
int underscore = -1; int underscore = -1;

View File

@ -551,7 +551,8 @@ bool TMask_field::error_box(
{ {
build_msg(); build_msg();
if (mask().is_sheetmask() && !mask().is_running()) if (mask().is_sheetmask() && !mask().is_running())
{ {
xvt_dm_post_speech(_msg, 0, TRUE);
xvt_statbar_set(_msg); xvt_statbar_set(_msg);
beep(); beep();
} }
@ -585,6 +586,7 @@ bool TMask_field::warning_box(
if (mask().is_sheetmask() && !mask().is_running()) if (mask().is_sheetmask() && !mask().is_running())
{ {
xvt_dm_post_speech(_msg, 1, TRUE);
xvt_statbar_set(_msg); xvt_statbar_set(_msg);
beep(); beep();
} }
@ -1146,6 +1148,13 @@ bool TButton_field::on_key(KEY key)
} }
if (ok) if (ok)
{ {
if (xvt_vobj_get_attr(NULL_WIN, ATTR_SPEECH_MODE) & (1<<7))
{
TString str = prompt();
str.strip("~");
xvt_dm_post_speech(str, 7, TRUE);
}
ok = on_hit(); ok = on_hit();
if (ok && _exit_key > 0 && !has_message()) if (ok && _exit_key > 0 && !has_message())
mask().stop_run(_exit_key); mask().stop_run(_exit_key);

View File

@ -1175,14 +1175,14 @@ int safely_close_closeable_isamfiles()
bool TPrefix::build_firm_data(long codditta, bool flagcom) bool TPrefix::build_firm_data(long codditta, bool flagcom)
{ {
const char * const ndir = "/dir.gen"; const char * const ndir = "dir.gen";
const char * const ntrc = "/trc.gen"; const char * const ntrc = "trc.gen";
TFilename s(firm2dir(codditta)); s << ndir; TFilename s(firm2dir(codditta)); s.add(ndir);
bool exist = s.exist(); bool exist = s.exist();
if (!exist) if (!exist)
{ {
s = s.path(); s.rtrim(1); s << ntrc; s = s.path(); s.add(ntrc);
exist = s.exist(); exist = s.exist();
} }
if (exist) if (exist)
@ -1200,17 +1200,17 @@ bool TPrefix::build_firm_data(long codditta, bool flagcom)
} }
set_autoload_new_files(yesno_box("Si desidera precaricare gli archivi standard")); set_autoload_new_files(yesno_box("Si desidera precaricare gli archivi standard"));
s = s.path(); s.rtrim(1); s = s.path(); s.rtrim(1);
if (!s.exist() && !make_dir(s)) if (!s.exist() && !make_dir(s))
return error_box("Impossibile creare il direttorio della ditta %ld (%s)", return error_box("Impossibile creare il direttorio della ditta %ld (%s)",
codditta, (const char*)s); codditta, (const char*)s);
s << ndir; s.add(ndir);
if (!fcopy(&ndir[1], s)) if (!fcopy(&ndir[1], s))
return error_box("Impossibile copiare il file %s della ditta %ld", return error_box("Impossibile copiare il file %s della ditta %ld",
&ndir[1], codditta); &ndir[1], codditta);
s = s.path(); s << ntrc; s = s.path(); s.add(ntrc);
if (!fcopy(&ntrc[1], s)) if (!fcopy(&ntrc[1], s))
return error_box("Impossibile copiare il file %s della ditta %ld", return error_box("Impossibile copiare il file %s della ditta %ld",
ntrc, codditta); ntrc, codditta);

View File

@ -19,6 +19,7 @@
10213=zipgold.ico 10213=zipgold.ico
10214=notepad.ico 10214=notepad.ico
10215=boxopen.ico 10215=boxopen.ico
10216=pref.ico
[Images] [Images]
101=ok.bmp 101=ok.bmp

View File

@ -2,6 +2,7 @@
#include <strstrea.h> #include <strstrea.h>
#include <dongle.h> #include <dongle.h>
#include <prefix.h>
#include <real.h> #include <real.h>
#include <regexp.h> #include <regexp.h>
#include <utility.h> #include <utility.h>
@ -1292,13 +1293,19 @@ bool TFilename::input()
bool TFilename::custom_path(const char* path_list) bool TFilename::custom_path(const char* path_list)
{ {
const char* fname = name(); bool ok = false;
if (!is_absolute_path())
if (*this == fname) // Non c'e' path
{ {
TToken_string pl = path_list; TToken_string pl = path_list;
if (pl.empty()) if (pl.empty_items())
pl = "custom"; {
pl = firm2dir(prefix().get_codditta());
pl << SLASH << "custom";
pl.add(firm2dir(-1));
pl << "custom";
pl.add("custom");
}
const TString fname = name();
FOR_EACH_TOKEN(pl, path) FOR_EACH_TOKEN(pl, path)
{ {
TFilename cust = path; TFilename cust = path;
@ -1306,11 +1313,14 @@ bool TFilename::custom_path(const char* path_list)
if (cust.exist()) if (cust.exist())
{ {
set(cust); set(cust);
return true; ok = true;
break;
} }
} }
} }
return false; else
ok = exist();
return ok;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////