diff --git a/include/colors.cpp b/include/colors.cpp index 27e5c057d..7667a7324 100755 --- a/include/colors.cpp +++ b/include/colors.cpp @@ -219,7 +219,7 @@ int TSelect_color_mask::add_color_def(const char * key, const char * prompt, COL riga << p->get_prompt(); TString tmp(_mask_name) ; tmp << "_" << _paragraph; - TConfig conf(CONFIG_USER, tmp); + TConfig conf(CONFIG_GUI, tmp); tmp = p->get_key(); if (conf.exist(tmp)) @@ -313,7 +313,7 @@ TSelect_color_mask::TSelect_color_mask(const TSheet_field & field) void TSelect_color_mask::save() const { TString tmp(_mask_name) ; tmp << "_" << _paragraph; - TConfig conf(CONFIG_USER, tmp); + TConfig conf(CONFIG_GUI, tmp); const int items = _color_defs.items(); for (int i = 0; i < items; i++) diff --git a/include/config.cpp b/include/config.cpp index 66a5f643b..13a6b707c 100755 --- a/include/config.cpp +++ b/include/config.cpp @@ -701,16 +701,18 @@ TConfig::TConfig(int which_config, const char* paragraph) _file.add("ditta.ini"); 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! if (oldfile.exist()) fcopy(oldfile, _file); } - break; case CONFIG_STUDIO: - case CONFIG_USER: case CONFIG_STAMPE: + case CONFIG_GUI: + case CONFIG_USER: _file = firm2dir(-1); // Directory dati _file.add("config"); // + Directory config if (!_file.exist()) // Creala se necessario @@ -720,18 +722,28 @@ TConfig::TConfig(int which_config, const char* paragraph) { case CONFIG_STUDIO: _file.add("studio.ini"); - if (!_file.exist() && fexist("studio.ini")) - { - TFilename old = _file.path(); - old.add("prassis.ini"); // Old config file! - if (old.exist()) - fcopy(old, _file); - } - + if (!_file.exist()) + { + TFilename oldfile = _file; + const int pos = oldfile.find("studio.ini"); + oldfile.cut(pos); + oldfile.add("prassid.ini"); // Old config file! + if (oldfile.exist()) + fcopy(oldfile, _file); + } break; case CONFIG_STAMPE: _file.add("print.ini"); break; + case CONFIG_GUI: + { + TFilename gui = "gui.ini"; + if (gui.custom_path()) // I colori sono qui, scavalca utente + { + _file = gui; + break; + } + } case CONFIG_USER: { TString16 u = user(); @@ -760,8 +772,8 @@ TConfig::TConfig(int which_config, const char* paragraph) _file = CGetCampoIni(); break; case CONFIG_GODMODE: - _file = firm2dir(0); - _file.add("gm.ini"); + _file = "gm.ini"; + _file.custom_path(); if (paragraph == NULL || *paragraph == '\0') paragraph = "GODMODE"; break; diff --git a/include/config.h b/include/config.h index d710d92cf..5c5fc0b04 100755 --- a/include/config.h +++ b/include/config.h @@ -22,8 +22,10 @@ class TConfig; #define CONFIG_USER 5 // file parametri stampe #define CONFIG_STAMPE 6 +// file parametri GUI (nel senso di Graphic User Interface) +#define CONFIG_GUI 7 // file parametri godmode -#define CONFIG_GODMODE 7 +#define CONFIG_GODMODE 8 // Callback per for_each_paragraph typedef int (*CONFIG_CALLBACK)(TConfig& cfg, void* jolly); diff --git a/include/controls.cpp b/include/controls.cpp index 3a981d096..b8211e646 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -147,7 +147,7 @@ XVT_FNTID xvt_default_font(bool bold) { 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")); 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"; @@ -229,7 +229,7 @@ void customize_colors() // @xref { - TConfig colors(CONFIG_USER, "Colors"); + TConfig colors(CONFIG_GUI, "Colors"); MASK_BACK_COLOR = colors.get_color("MaskBack", NULL, -1, MASK_BACK_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); ADVANCED_GRAPHICS = colors.get_bool("AdvancedGraphics", NULL, -1, ADVANCED_GRAPHICS); 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_CTRL, MASK_BACK_COLOR); @@ -375,15 +377,9 @@ HIDDEN XI_BITMAP* get_background_bitmap() { if (bmp == NULL && !checked) { - const char* ext[] = { "jpg", "gif", "bmp", NULL }; - bool ok = false; - TFilename back("back"); - for (int i = 0; !ok && ext[i]; i++) - { - back.ext(ext[i]); - ok = back.custom_path(); - } - if (ok) + TConfig ini(CONFIG_GUI, "Colors"); + TFilename back = ini.get("Tile"); + if (back.custom_path()) bmp = xi_bitmap_create(back.get_buffer(), XI_BITMAP_TILE); checked = TRUE; } @@ -1353,7 +1349,7 @@ void TButton_control::create(WINDOW win, short cid, { bool bold; COLOR color; - TString80 txt(text); txt.trim(); + TString txt(text); txt.trim(); char mnemonic = '\0'; int underscore = -1; diff --git a/include/maskfld.cpp b/include/maskfld.cpp index ba220905c..576171118 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -551,7 +551,8 @@ bool TMask_field::error_box( { build_msg(); if (mask().is_sheetmask() && !mask().is_running()) - { + { + xvt_dm_post_speech(_msg, 0, TRUE); xvt_statbar_set(_msg); beep(); } @@ -585,6 +586,7 @@ bool TMask_field::warning_box( if (mask().is_sheetmask() && !mask().is_running()) { + xvt_dm_post_speech(_msg, 1, TRUE); xvt_statbar_set(_msg); beep(); } @@ -1146,6 +1148,13 @@ bool TButton_field::on_key(KEY key) } 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(); if (ok && _exit_key > 0 && !has_message()) mask().stop_run(_exit_key); diff --git a/include/prefix.cpp b/include/prefix.cpp index 48071e5da..052e4dbe5 100755 --- a/include/prefix.cpp +++ b/include/prefix.cpp @@ -1175,14 +1175,14 @@ int safely_close_closeable_isamfiles() bool TPrefix::build_firm_data(long codditta, bool flagcom) { - const char * const ndir = "/dir.gen"; - const char * const ntrc = "/trc.gen"; - TFilename s(firm2dir(codditta)); s << ndir; + const char * const ndir = "dir.gen"; + const char * const ntrc = "trc.gen"; + TFilename s(firm2dir(codditta)); s.add(ndir); bool exist = s.exist(); if (!exist) { - s = s.path(); s.rtrim(1); s << ntrc; + s = s.path(); s.add(ntrc); exist = s.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")); - s = s.path(); s.rtrim(1); + s = s.path(); s.rtrim(1); if (!s.exist() && !make_dir(s)) return error_box("Impossibile creare il direttorio della ditta %ld (%s)", codditta, (const char*)s); - s << ndir; + s.add(ndir); if (!fcopy(&ndir[1], s)) return error_box("Impossibile copiare il file %s della ditta %ld", &ndir[1], codditta); - s = s.path(); s << ntrc; + s = s.path(); s.add(ntrc); if (!fcopy(&ntrc[1], s)) return error_box("Impossibile copiare il file %s della ditta %ld", ntrc, codditta); diff --git a/include/resource.ini b/include/resource.ini index 60f405a06..82e6397b9 100755 --- a/include/resource.ini +++ b/include/resource.ini @@ -19,6 +19,7 @@ 10213=zipgold.ico 10214=notepad.ico 10215=boxopen.ico +10216=pref.ico [Images] 101=ok.bmp diff --git a/include/strings.cpp b/include/strings.cpp index 21da99582..c0eb89dc2 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -1292,13 +1293,19 @@ bool TFilename::input() bool TFilename::custom_path(const char* path_list) { - const char* fname = name(); - - if (*this == fname) // Non c'e' path + bool ok = false; + if (!is_absolute_path()) { TToken_string pl = path_list; - if (pl.empty()) - pl = "custom"; + if (pl.empty_items()) + { + 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) { TFilename cust = path; @@ -1306,11 +1313,14 @@ bool TFilename::custom_path(const char* path_list) if (cust.exist()) { set(cust); - return true; + ok = true; + break; } } } - return false; + else + ok = exist(); + return ok; } ///////////////////////////////////////////////////////////