Corretti errori(ni) vari

git-svn-id: svn://10.65.10.50/trunk@825 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-01-04 15:39:38 +00:00
parent 8d4438bda8
commit 3b41e66469
11 changed files with 86 additions and 71 deletions

View File

@ -31,15 +31,6 @@ HIDDEN TApplication* _application = NULL;
TString16 TApplication::_user;
TApplication* MainApp()
{
CHECK(_application, "NULL application!");
#ifdef DBG
error_box("Ti lascio usare MainApp ancora per pochi giorni!");
#endif
return _application;
}
TApplication& main_app()
{
CHECK(_application, "NULL application!");

View File

@ -92,8 +92,8 @@ public:
TPrinter& printer();
static void check_parameters(int & argc, char *argv[]);
const TString& user() const { return _user; }
static const TString& user() { return _user; }
bool has_module(int module, int checktype = CHK_ALL) const;
bool set_firm(long cod = -1);
long get_firm() const;
@ -111,7 +111,6 @@ public:
};
bool xvt_running(); // xvt is running?
TApplication* MainApp(); // main application (old fashioned: will be removed soon
TApplication& main_app();
#endif // __APPLICATION_H

View File

@ -130,7 +130,7 @@ TString& TConfig::get(const char* var, const char* section, int index, const cha
if (_data.is_key(vvar))
s = (TString&)_data[vvar];
else
s = def;
set(var, s = def, section, TRUE, index);
return s;
}

View File

@ -79,34 +79,49 @@ HIDDEN byte COLOR2PIC(COLOR c)
PICTURE xvt_picture_load(short id, bool convert)
{
PICTURE cpb = cpb_picture_load(id);
if (convert && MASK_BACK_COLOR != COLOR_DKCYAN)
static bool _can_convert = 2;
if (_can_convert == 2)
{
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
HDC hdc = GetDC(hwnd);
const int col = GetDeviceCaps(hdc, COLORRES);
_can_convert = col == 18;
ReleaseDC(hwnd, hdc);
}
PICTURE cpb = cpb_picture_load(id);
CHECKD(cpb, "Can't load picture ", id);
if (convert && _can_convert && MASK_BACK_COLOR != COLOR_DKCYAN)
{
const byte newba = COLOR2PIC(MASK_BACK_COLOR);
const byte newlt = COLOR2PIC(MASK_LIGHT_COLOR);
const byte newdk = COLOR2PIC(MASK_DARK_COLOR);
const PICTURE old = cpb;
RCT r; cpb_get_picture_size(old, &r);
long size;
char huge * buf = picture_lock(old, &size);
CHECK(buf, "Out of memory in picture_load");
const long first = 14;
const long last = first + (long)r.right*r.bottom;
for (long i = first; i < last; i++) switch((byte)buf[i])
char huge * buf = picture_lock(cpb, &size);
if (buf != NULL)
{
case 0x06:
buf[i] = newba; break;
case 0xF8:
buf[i] = newdk; break;
case 0xFE:
buf[i] = newlt; break;
default:
break;
}
cpb = picture_make(buf, size, &r);
picture_unlock(old);
picture_free(old);
RCT r; cpb_get_picture_size(cpb, &r);
const byte newba = COLOR2PIC(MASK_BACK_COLOR);
const byte newlt = COLOR2PIC(MASK_LIGHT_COLOR);
const byte newdk = COLOR2PIC(MASK_DARK_COLOR);
const long first = 14;
const long last = first + (long)r.right*r.bottom;
for (long i = first; i < last; i++) switch((byte)buf[i])
{
case 0x06:
buf[i] = newba; break;
case 0xF8:
buf[i] = newdk; break;
case 0xFE:
buf[i] = newlt; break;
default:
break;
}
const PICTURE old = cpb;
cpb = picture_make(buf, size, &r);
picture_unlock(old);
picture_free(old);
}
}
return cpb;

View File

@ -44,14 +44,7 @@ int TExternal_app::run(bool async, bool user)
save_dir();
#if XVT_OS == XVT_OS_WIN
if (!can_run())
{
error_box("Le risorse di Windows sono quasi esaurite:\n"
"impossibile eseguire %s", (const char*)_path);
_exitcode = 8;
}
if (_exitcode == 0)
if (can_run())
{
main_app().begin_wait();
_exitcode = WinExec((char*)(const char*)path, SW_SHOW);
@ -80,17 +73,27 @@ int TExternal_app::run(bool async, bool user)
tw.maximize();
}
xvt_statbar_refresh();
_exitcode = 0;
}
else
{
if (_exitcode == 16)
error_box("'%s' e' gia' in esecuzione", (const char*)_path);
else
error_box("Impossibile eseguire '%s':\nErrore %d", (const char*)_path, _exitcode);
}
main_app().end_wait();
}
} else _exitcode = 8;
switch (_exitcode)
{
case 0:
case 8:
error_box("Risorse insufficienti per eseguire '%s'", (const char*)_path); break;
case 2:
case 3:
error_box("Impossibile trovare '%s'", (const char*)_path); break;
case 16:
error_box("'%s' e' gia' in esecuzione", (const char*)_path); break;
default:
if (_exitcode < 32)
error_box("Impossibile eseguire '%s':\nErrore %d", (const char*)_path, _exitcode);
else
_exitcode = 0;
break;
}
#else
switch (fork())

View File

@ -1268,7 +1268,9 @@ void TForm::print_section(ostream& out, char s) const
}
void TForm::print_on(ostream& out) const
{
{
main_app().begin_wait();
if (relation())
out << *relation() << endl;
@ -1277,6 +1279,8 @@ void TForm::print_on(ostream& out) const
print_section(out, 'F');
out << "END" << endl;
main_app().end_wait();
}

View File

@ -635,23 +635,26 @@ int TBaseisamfile::_close()
TLocalisamfile::TLocalisamfile(int logicnum, bool linkrecinst)
: TBaseisamfile(logicnum, linkrecinst)
: TBaseisamfile(logicnum, linkrecinst)
{
open();
if (!linkrecinst) setkey(1); // Dangerous change by Guy
if (_was_open) // Dangerous change by Guy
{
_oldkey = getkey();
setkey(1);
}
}
TLocalisamfile::~TLocalisamfile()
{
{
if (_was_open) // Dangerous change by Guy
setkey(_oldkey);
close();
}
int TLocalisamfile::close()
{
int err = NOERR;

View File

@ -378,8 +378,9 @@ public:
class TLocalisamfile : public TBaseisamfile
{
// @DPRIV
bool _was_open; // Vero se il file e' stato aperto come Localisamfile
bool _isatab; // Vero se il file e' una tabella
bool _was_open; // Vero se il file e' stato aperto come Localisamfile
bool _isatab; // Vero se il file e' una tabella
int _oldkey; // Old key if already open
public:
// @FPUB

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.43 1995-01-03 15:06:34 guy Exp $
// $Id: relapp.cpp,v 1.44 1995-01-04 15:39:31 guy Exp $
#include <mailbox.h>
#include <sheet.h>
#include <urldefid.h>
@ -212,16 +212,16 @@ bool TRelation_application::destroy()
void TRelation_application::set_fixed()
{
TString s(80);
TString256 s;
for (const char* f = _fixed.get(0); f && *f; f = _fixed.get())
{
s = f;
const int u = s.find('=');
const int id = atoi(s.left(u));
_mask->disable(id);
const char* val = s.mid(u+1);
if (*val)
_mask->set(id, val);
_mask->disable(id);
}
}

View File

@ -662,7 +662,7 @@ const TFilename& TFilename::tempdir()
#ifndef FOXPRO
const TString& user = main_app().user();
const TString& user = TApplication::user();
if (res == 0 && user.not_empty())
{
#if XVT_OS==XVT_OS_SCOUNIX

View File

@ -581,9 +581,8 @@ HIDDEN bool _zerofill_val(TEdit_field& f, KEY k)
{
if (f.to_check(k))
{
const int columns = atoi(get_val_param(0));
TString & val = f.get();
const int columns = atoi(get_val_param(0));
TString& val = f.get();
if (val.len() < columns && real::is_natural(val))
{
val.right_just(columns, '0');