config.cpp Corretto salvataggio di valori che sono delle token string
golem.cpp Corretto editing tramite bottoni git-svn-id: svn://10.65.10.50/trunk@5562 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5c8e3ccdc8
commit
2a831c5f10
@ -73,13 +73,13 @@ void TConfig::_write_paragraph(
|
||||
for (THash_object* o = _data.get_hashobj(); o; o = _data.get_hashobj())
|
||||
out << o->key() << " = " << (TString&)(o->obj()) << '\n';
|
||||
*/
|
||||
TString_array a; list_variables(a, TRUE);
|
||||
TString_array a; list_variables(a, FALSE);
|
||||
a.sort();
|
||||
for (int i = 0; i < a.items(); i++)
|
||||
{
|
||||
TToken_string& row = a.row(i);
|
||||
out << row.get(0) << " = ";
|
||||
out << row.get() << endl;
|
||||
TToken_string& name = a.row(i);
|
||||
out << name << " = ";
|
||||
out << get(name) << endl;
|
||||
}
|
||||
|
||||
out << endl;
|
||||
|
@ -92,44 +92,58 @@ HIDDEN word file2icon(const char* filename)
|
||||
{
|
||||
word icon = 0;
|
||||
|
||||
char ext[_MAX_EXT];
|
||||
if (*filename == '.')
|
||||
strncpy(ext, filename, _MAX_EXT);
|
||||
TString ext(_MAX_EXT);
|
||||
if (*filename == '.' && strlen(filename) < _MAX_EXT)
|
||||
ext = filename;
|
||||
else
|
||||
{
|
||||
if (internet_address(filename))
|
||||
strcpy(ext, ".htm");
|
||||
ext = ".htm";
|
||||
else
|
||||
_splitpath(filename, NULL, NULL, NULL, ext);
|
||||
_splitpath(filename, NULL, NULL, NULL, ext.get_buffer());
|
||||
}
|
||||
ext.lower();
|
||||
|
||||
int icon_number = 0;
|
||||
TFilename key;
|
||||
|
||||
if (stricmp(ext, ".exe") != 0)
|
||||
{
|
||||
if (get_reg_key(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
|
||||
{
|
||||
key << "\\DefaultIcon";
|
||||
if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS) // Windows 95 only
|
||||
{
|
||||
const int comma = key.find(',');
|
||||
if (comma > 0)
|
||||
{
|
||||
icon_number = atoi(key.mid(comma+1));
|
||||
key.cut(comma);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!file2app(filename, key))
|
||||
file2app(".htm", key);
|
||||
}
|
||||
if (ext != ".exe")
|
||||
{
|
||||
// Prima controlla il mio registro delle applicazioni ...
|
||||
TConfig link(CONFIG_USER, "Link");
|
||||
key = link.get(ext.mid(1, -1)); // Ignora il .
|
||||
|
||||
if (key.not_empty())
|
||||
{
|
||||
ext = key.ext();
|
||||
if (ext.empty())
|
||||
key.ext("exe");
|
||||
}
|
||||
else // ... poi controlla il registro di Windows
|
||||
{
|
||||
if (get_reg_key(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
|
||||
{
|
||||
key << "\\DefaultIcon";
|
||||
if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS) // Windows 95 only
|
||||
{
|
||||
const int comma = key.find(',');
|
||||
if (comma > 0)
|
||||
{
|
||||
icon_number = atoi(key.mid(comma+1));
|
||||
key.cut(comma);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!file2app(filename, key))
|
||||
file2app(".htm", key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
key = filename;
|
||||
|
||||
|
||||
if (fexist(key))
|
||||
{
|
||||
HINSTANCE hInst = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
@ -147,6 +161,18 @@ HIDDEN word file2icon(const char* filename)
|
||||
|
||||
HIDDEN bool goto_url(const char* url)
|
||||
{
|
||||
TFilename app(url);
|
||||
|
||||
TConfig link(CONFIG_USER, "Link");
|
||||
app = link.get(app.ext());
|
||||
if (app.not_empty())
|
||||
{
|
||||
app << ' ' << url;
|
||||
UINT error = WinExec(app, SW_SHOWNORMAL);
|
||||
if (error > 32)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool retflag = FALSE;
|
||||
|
||||
HINSTANCE hinst = ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
||||
@ -154,7 +180,6 @@ HIDDEN bool goto_url(const char* url)
|
||||
UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning
|
||||
if (error <= 32)
|
||||
{
|
||||
TFilename app(_MAX_PATH);
|
||||
if (file2app(".htm", app))
|
||||
{
|
||||
app << ' ' << url;
|
||||
@ -315,23 +340,25 @@ bool TGolem_mask::ole_handler(TMask_field& f, KEY k)
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TSheet_field& sheet = f.mask().sfield(F_SHEET);
|
||||
if (sheet.items() == 0)
|
||||
sheet.row(-1);
|
||||
|
||||
sheet.check_row(sheet.selected());
|
||||
TMask& sm = sheet.sheet_mask();
|
||||
|
||||
int selected = sheet.selected();
|
||||
if (sheet.items() == 0 || !sm.field(S_FILE).empty())
|
||||
{
|
||||
sheet.row(-1);
|
||||
selected = sheet.items()-1;
|
||||
}
|
||||
sheet.check_row(selected);
|
||||
|
||||
TString16 ext = f.prompt();
|
||||
if (ext[0] != '.')
|
||||
ext.insert(".", 0);
|
||||
|
||||
TFilename file = sm.get(S_FILE);
|
||||
if (file.blank())
|
||||
{
|
||||
file.temp(NULL, ext);
|
||||
sm.set(S_FILE, file);
|
||||
ofstream out(file);
|
||||
sheet.row(sheet.selected()) = file;
|
||||
}
|
||||
|
||||
TFilename file;
|
||||
file.temp(NULL, ext);
|
||||
sm.set(S_FILE, file);
|
||||
ofstream out(file);
|
||||
sheet.row(selected) = file;
|
||||
sheet.force_update();
|
||||
|
||||
TFilename app; file2app(ext, app);
|
||||
|
Loading…
x
Reference in New Issue
Block a user