bagn006.h Aggiunti identificatori per maschera golem
bagn006.uml Maschera per gestire i golem controls.* Aggiunto il metodo set_icon per i TPushbutton_control default.url Rinnovato il set di icone standard execp.* Aggiunta la funzione ext2app e print_url golem.* Rivoluzionati completamente i golem mask.cpp Aggiunto il riconmoscimento del nuo campo TGolem maskfld.* Aggiunto nuovo tipo di campo golem e tolto il vecchio strings.h Modificata la derivazione della classe TFilename urldefid.h Aggiunto identificatore icona dei golem utility.cpp Migliorata la fexist per riconoscere i nomi lunghi validate.cpp Migliorato il valdate FILENAME_FUNC window.* Aggiunto nuovo costruttore per la classe TImage git-svn-id: svn://10.65.10.50/trunk@5336 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8314a8a0c3
commit
ab3cf55295
@ -1,3 +1,8 @@
|
|||||||
#define F_CLASSE 101
|
#define F_NEWREC 201
|
||||||
#define F_CODICE 102
|
#define F_LINK 202
|
||||||
#define F_DESC 103
|
#define F_PRINT 203
|
||||||
|
#define F_SHEET 300
|
||||||
|
|
||||||
|
#define S_FILE 101
|
||||||
|
#define S_ALIAS 102
|
||||||
|
#define S_LINK 103
|
@ -1,37 +1,92 @@
|
|||||||
#include <bagn006.h>
|
#include <bagn006.h>
|
||||||
|
|
||||||
PAGE "Caratteristiche oggetto" -1, -1, 66, 6
|
PAGE "Oggetti esterni" -1, -1, 76, 16
|
||||||
|
|
||||||
STRING F_CLASSE 8
|
SPREADSHEET F_SHEET 0 -3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Classe "
|
PROMPT 1 1 "Lista"
|
||||||
FLAGS "DU"
|
ITEM "File@35"
|
||||||
FIELD CLASSE
|
ITEM "Nome@15"
|
||||||
END
|
ITEM "Collegamento"
|
||||||
|
END
|
||||||
NUMBER F_CODICE 8
|
|
||||||
BEGIN
|
|
||||||
PROMPT 48 1 "Codice "
|
|
||||||
FLAGS "D"
|
|
||||||
FIELD CHIAVE
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_DESC 50
|
|
||||||
BEGIN
|
|
||||||
PROMPT 1 3 "Descrizione "
|
|
||||||
CHECKTYPE REQUIRED
|
|
||||||
WARNING "E' necessaria una breve descrizione"
|
|
||||||
FIELD DESC
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -12 -1 ""
|
PROMPT -15 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON F_NEWREC 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -25 -1 ""
|
||||||
|
PICTURE BMP_NEWREC
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON F_LINK 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -35 -1 ""
|
||||||
|
PICTURE BMP_LINK
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON F_PRINT 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -45 -1 ""
|
||||||
|
PICTURE BMP_PRINT
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 10 2
|
BUTTON DLG_CANCEL 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -22 -1 ""
|
PROMPT -55 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
||||||
|
|
||||||
|
PAGE "Oggetto esterno" -1, -1, 60, 6
|
||||||
|
|
||||||
|
STRING S_FILE 256 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "File "
|
||||||
|
FLAGS "B"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING S_ALIAS 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 2 "Alias "
|
||||||
|
FLAGS "DG"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN S_LINK
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 3 "Collegamento esterno"
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_OK 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -15 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON F_NEWREC 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -25 -1 ""
|
||||||
|
PICTURE BMP_NEWREC
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON F_LINK 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -35 -1 ""
|
||||||
|
PICTURE BMP_LINK
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON F_PRINT 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -45 -1 ""
|
||||||
|
PICTURE BMP_PRINT
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CANCEL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -55 -1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
@ -1363,7 +1363,7 @@ TPushbutton_control::TPushbutton_control(WINDOW win, short cid,
|
|||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text,
|
const char* flags, const char* text,
|
||||||
short bmp_up, short bmp_dn)
|
short bmp_up, short bmp_dn)
|
||||||
: _bmp_up(bmp_up), _bmp_dn(bmp_dn)
|
: _bmp_up(bmp_up), _bmp_dn(bmp_dn), _hicon(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
bool bold;
|
bool bold;
|
||||||
@ -1383,6 +1383,26 @@ TPushbutton_control::TPushbutton_control(WINDOW win, short cid,
|
|||||||
set_bmp(bmp_up, bmp_dn);
|
set_bmp(bmp_up, bmp_dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TPushbutton_control::~TPushbutton_control()
|
||||||
|
{
|
||||||
|
if (_hicon)
|
||||||
|
DestroyIcon((HICON)_hicon);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPushbutton_control::set_icon(word hicon)
|
||||||
|
{
|
||||||
|
if (_hicon)
|
||||||
|
{
|
||||||
|
DestroyIcon((HICON)_hicon);
|
||||||
|
_hicon = NULL;
|
||||||
|
}
|
||||||
|
if (hicon)
|
||||||
|
{
|
||||||
|
_hicon = hicon;
|
||||||
|
set_bmp(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
|
void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
|
||||||
{
|
{
|
||||||
if (bmp_up > 0)
|
if (bmp_up > 0)
|
||||||
@ -1392,6 +1412,7 @@ void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
|
|||||||
_picture->add(_bmp_dn = bmp_dn);
|
_picture->add(_bmp_dn = bmp_dn);
|
||||||
else
|
else
|
||||||
_bmp_dn = _bmp_up;
|
_bmp_dn = _bmp_up;
|
||||||
|
set_icon(NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1405,7 +1426,17 @@ void TPushbutton_control::update()
|
|||||||
const WINDOW win = parent();
|
const WINDOW win = parent();
|
||||||
|
|
||||||
if (attrib & XI_ATR_VISIBLE)
|
if (attrib & XI_ATR_VISIBLE)
|
||||||
{
|
{
|
||||||
|
if (_hicon)
|
||||||
|
{
|
||||||
|
HDC hdc = (HDC)xvt_vobj_get_attr(win, ATTR_NATIVE_GRAPHIC_CONTEXT);
|
||||||
|
const RCT& rct = _obj->v.btn->rct;
|
||||||
|
int x = rct.left + (rct.right - rct.left - 32) / 2;
|
||||||
|
int y = rct.top + (rct.bottom - rct.top - 32) / 2;
|
||||||
|
DrawIcon(hdc, x, y, (HICON)_hicon);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const short bmp = (_bmp_dn > 0 && _obj->v.btn->down) ? _bmp_dn : _bmp_up;
|
const short bmp = (_bmp_dn > 0 && _obj->v.btn->down) ? _bmp_dn : _bmp_up;
|
||||||
if (bmp > 0)
|
if (bmp > 0)
|
||||||
{
|
{
|
||||||
|
@ -203,6 +203,7 @@ class TPushbutton_control : public TButton_control
|
|||||||
TString _caption;
|
TString _caption;
|
||||||
int _underscore;
|
int _underscore;
|
||||||
short _bmp_up, _bmp_dn;
|
short _bmp_up, _bmp_dn;
|
||||||
|
word _hicon;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
@ -212,12 +213,13 @@ public:
|
|||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
void set_bmp(short up, short dn);
|
void set_bmp(short up, short dn);
|
||||||
|
void set_icon(word hicon);
|
||||||
|
|
||||||
TPushbutton_control(WINDOW win, short cid,
|
TPushbutton_control(WINDOW win, short cid,
|
||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text,
|
const char* flags, const char* text,
|
||||||
short bmp_up = 0, short _bmp_dn = 0);
|
short bmp_up = 0, short _bmp_dn = 0);
|
||||||
virtual ~TPushbutton_control() {}
|
virtual ~TPushbutton_control();
|
||||||
};
|
};
|
||||||
|
|
||||||
class TRadiobutton_control : public TButton_control
|
class TRadiobutton_control : public TButton_control
|
||||||
|
@ -117,10 +117,7 @@ image BMP_LINK QRESDIR"link.bmp"
|
|||||||
image BMP_PRINT QRESDIR"print.bmp"
|
image BMP_PRINT QRESDIR"print.bmp"
|
||||||
image BMP_SETPRINT QRESDIR"setprint.bmp"
|
image BMP_SETPRINT QRESDIR"setprint.bmp"
|
||||||
image BMP_RECALC QRESDIR"recalc.bmp"
|
image BMP_RECALC QRESDIR"recalc.bmp"
|
||||||
image BMP_BMP QRESDIR"bmp.bmp"
|
image BMP_OLE QRESDIR"ole.bmp"
|
||||||
image BMP_XLS QRESDIR"xls.bmp"
|
|
||||||
image BMP_WAV QRESDIR"wav.bmp"
|
|
||||||
image BMP_DOC QRESDIR"doc.bmp"
|
|
||||||
image BMP_LENTE QRESDIR"lente.bmp"
|
image BMP_LENTE QRESDIR"lente.bmp"
|
||||||
image BMP_FAX QRESDIR"fax.bmp"
|
image BMP_FAX QRESDIR"fax.bmp"
|
||||||
|
|
||||||
|
@ -380,31 +380,48 @@ static long get_reg_key(HKEY key, const char* subkey, TString& retdata)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ext2app(const char* ext, TString& app)
|
||||||
|
{
|
||||||
|
bool ok = FALSE;
|
||||||
|
TString key(_MAX_PATH);
|
||||||
|
|
||||||
|
key = ext;
|
||||||
|
if (key[0] != '.')
|
||||||
|
key.insert(".", 0);
|
||||||
|
|
||||||
|
if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
key << "\\shell\\open\\command";
|
||||||
|
if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
key.strip("\"");
|
||||||
|
int pos = key.find("%1");
|
||||||
|
if (pos > 0)
|
||||||
|
key.cut(pos);
|
||||||
|
key.trim();
|
||||||
|
app = key;
|
||||||
|
ok = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
bool goto_url(const char* url)
|
bool goto_url(const char* url)
|
||||||
{
|
{
|
||||||
TString key(MAX_PATH*2);
|
|
||||||
bool retflag = FALSE;
|
bool retflag = FALSE;
|
||||||
|
|
||||||
HINSTANCE hinst = ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
HINSTANCE hinst = ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
||||||
DWORD winst = DWORD((DWORD*)hinst);
|
DWORD winst = DWORD((DWORD*)hinst);
|
||||||
UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning
|
UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning
|
||||||
if (error < 32)
|
if (error <= 32)
|
||||||
{
|
{
|
||||||
if (get_reg_key(HKEY_CLASSES_ROOT, ".htm", key) == ERROR_SUCCESS)
|
TString app(_MAX_PATH);
|
||||||
|
if (ext2app(".htm", app))
|
||||||
{
|
{
|
||||||
key << "\\shell\\open\\command";
|
app << ' ' << url;
|
||||||
if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS)
|
error = WinExec(app, SW_SHOWNORMAL);
|
||||||
{
|
if (error > 32)
|
||||||
int pos = key.find("\"%1\"");
|
retflag = TRUE;
|
||||||
if (pos < 0)
|
|
||||||
pos = key.find("%1");
|
|
||||||
if (pos > 0)
|
|
||||||
key.cut(pos);
|
|
||||||
key << ' ' << url;
|
|
||||||
error = WinExec(key, SW_SHOWNORMAL);
|
|
||||||
if (error > 31)
|
|
||||||
retflag = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -412,3 +429,12 @@ bool goto_url(const char* url)
|
|||||||
|
|
||||||
return retflag;
|
return retflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool print_url(const char* url)
|
||||||
|
{
|
||||||
|
HINSTANCE hinst = ShellExecute(NULL, "print", url, NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
DWORD winst = DWORD((DWORD*)hinst);
|
||||||
|
UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning
|
||||||
|
return error >= 32;
|
||||||
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __EXECP_H
|
#ifndef __EXECP_H
|
||||||
#define __EXECP_H
|
#define __EXECP_H
|
||||||
|
|
||||||
#ifndef __OBJECT_H
|
#ifndef __STRINGS_H
|
||||||
#include <object.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
@ -51,7 +51,11 @@ public:
|
|||||||
TExternal_app(const char* p);
|
TExternal_app(const char* p);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Estrae lapplicazione associata all'estensione
|
||||||
|
bool ext2app(const char* ext, TString& app);
|
||||||
// Va ad un URl qualsiasi
|
// Va ad un URl qualsiasi
|
||||||
bool goto_url(const char* url);
|
bool goto_url(const char* url);
|
||||||
|
// Stampa un URl qualsiasi
|
||||||
|
bool print_url(const char* url);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,212 +1,354 @@
|
|||||||
#define STRICT
|
#define STRICT
|
||||||
#define XVT_INCL_NATIVE
|
#define XVT_INCL_NATIVE
|
||||||
#include <applicat.h>
|
#include <controls.h>
|
||||||
#include <config.h>
|
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <golem.h>
|
#include <golem.h>
|
||||||
#include <mask.h>
|
#include <msksheet.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include <bagn006.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
long TGolem::_count = 0;
|
#include "bagn006.h"
|
||||||
TFilename* TGolem::_path = NULL;
|
|
||||||
TConfig* TGolem::_config = NULL;
|
|
||||||
TRelation* TGolem::_golem = NULL;
|
|
||||||
|
|
||||||
TGolem::TGolem(const char* cls, long id)
|
///////////////////////////////////////////////////////////
|
||||||
: _class(cls), _id(id)
|
// Campi GOLEM
|
||||||
{
|
///////////////////////////////////////////////////////////
|
||||||
CHECK(_class.not_empty() && id >= 0, "Invalid Golem creation");
|
|
||||||
_class.upper();
|
|
||||||
|
|
||||||
if (_count == 0)
|
TString& TGolem_field::get_window_data()
|
||||||
{
|
{
|
||||||
CHECK(_path == NULL, "Golem construction count error");
|
return _str;
|
||||||
_path = new TFilename;
|
|
||||||
_config = new TConfig(CONFIG_GOLEM, _class);
|
|
||||||
_golem = new TRelation(LF_GOLEM);
|
|
||||||
}
|
|
||||||
_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TGolem::~TGolem()
|
void TGolem_field::set_window_data(const char* data)
|
||||||
{
|
{
|
||||||
_count--;
|
TFilename app(_MAX_PATH);
|
||||||
if (_count == 0)
|
if (*data > ' ')
|
||||||
{
|
{
|
||||||
CHECK(_path != NULL, "Golem destruction count error");
|
TFilename file(data);
|
||||||
delete _golem; _golem = NULL;
|
const int pipe = file.find('|');
|
||||||
delete _config; _config = NULL;
|
if (pipe > 0) file.cut(pipe);
|
||||||
delete _path; _path = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TConfig& TGolem::config() const
|
|
||||||
{
|
|
||||||
_config->set_paragraph(_class);
|
|
||||||
return *_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TGolem::ok() const
|
|
||||||
{
|
|
||||||
return _id > 0 && fexist(path());
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* TGolem::class_name() const
|
|
||||||
{
|
|
||||||
*_path = "GOLEM_";
|
|
||||||
*_path << _class << "_CLASS";
|
|
||||||
return *_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
word TGolem::class_id() const
|
|
||||||
{
|
|
||||||
return CLASS_GOLEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
short TGolem::icon() const
|
|
||||||
{
|
|
||||||
const short id = config().get_int("Icon", NULL, -1, DLG_F9);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char* TGolem::ext() const
|
|
||||||
{
|
|
||||||
return config().get("Extension", NULL, -1, _class.left(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const TFilename& TGolem::path(bool test) const
|
|
||||||
{
|
|
||||||
const char* e = ext();
|
|
||||||
*_path = firm2dir(-1); // C:\PRASSI\DATI
|
|
||||||
_path->add("golem"); // C:\PRASSI\DATI\GOLEM
|
|
||||||
if (test && !fexist(*_path))
|
|
||||||
make_dir(*_path);
|
|
||||||
|
|
||||||
_path->add(_class); // C:\PRASSI\DATI\GOLEM\BITMAP
|
|
||||||
if (test && !fexist(*_path))
|
|
||||||
make_dir(*_path);
|
|
||||||
|
|
||||||
if (_id > 0)
|
|
||||||
{
|
|
||||||
_path->add(format("%ld", _id));// C:\PRASSI\DATI\GOLEM\BMP\883
|
|
||||||
_path->ext(e); // C:\PRASSI\DATI\GOLEM\BMP\883.BMP
|
|
||||||
}
|
|
||||||
return *_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
int TGolem::compare(const TSortable& s) const
|
|
||||||
{
|
|
||||||
if (s.class_id() != class_id())
|
|
||||||
return UNDEFINED;
|
|
||||||
const TGolem& g = (const TGolem&)s;
|
|
||||||
return int(_id - g._id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TGolem::edit()
|
|
||||||
{
|
|
||||||
const TFilename& p = path();
|
|
||||||
bool ok = fexist(p);
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
TFilename e(config().get("Editor"));
|
|
||||||
e << ' ' << p;
|
|
||||||
|
|
||||||
TExternal_app app(e);
|
HINSTANCE hinst = FindExecutable(file, ".", app.get_buffer());
|
||||||
ok = app.run(FALSE, FALSE) == 0;
|
DWORD* pinst = (DWORD*)hinst;
|
||||||
|
UINT err = LOWORD(pinst);
|
||||||
|
if (err <= 32)
|
||||||
|
ext2app(".htm", app);
|
||||||
|
if (err > 32 && !fexist(app))
|
||||||
|
{
|
||||||
|
warning_box("Il file %s e' associato all'applicazione\n"
|
||||||
|
"%s, che non e' presente sul sistema",
|
||||||
|
file.get_buffer(), app.get_buffer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TPushbutton_control* btn = (TPushbutton_control*)_ctl;
|
||||||
|
if (app.not_empty())
|
||||||
|
{
|
||||||
|
HINSTANCE hInst = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||||
|
HICON hicon = ExtractIcon(hInst, app, 0);
|
||||||
|
DWORD dwicon = DWORD((DWORD*)hicon);
|
||||||
|
WORD icon = LOWORD(dwicon);
|
||||||
|
if (icon)
|
||||||
|
btn->set_icon(icon);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef DBG
|
||||||
|
warning_box("Can't extract %s icon!", app.get_buffer());
|
||||||
|
#endif
|
||||||
|
btn->set_bmp(BMP_OLE, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
btn->set_bmp(BMP_OLE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
RCT rct; btn->get_rect(rct);
|
||||||
|
xi_invalidate_rect(btn->parent(), &rct);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGolem_field::is_editable() const
|
||||||
|
{ return FALSE; }
|
||||||
|
|
||||||
|
void TGolem_field::parse_head(TScanner& scanner)
|
||||||
|
{
|
||||||
|
_ctl_data._width = scanner.integer();
|
||||||
|
if (_ctl_data._width <= 0) _ctl_data._width = 10;
|
||||||
|
_ctl_data._height = scanner.integer(); // Height
|
||||||
|
if (_ctl_data._height <= 0) _ctl_data._height = 1;
|
||||||
|
_ctl_data._bmp_up = BMP_OLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGolem_field::create(WINDOW parent)
|
||||||
|
{
|
||||||
|
_ctl = new TPushbutton_control(parent, _ctl_data._dlg,
|
||||||
|
_ctl_data._x, _ctl_data._y,
|
||||||
|
_ctl_data._width+2, _ctl_data._height,
|
||||||
|
_ctl_data._flags, _ctl_data._prompt,
|
||||||
|
_ctl_data._bmp_up, _ctl_data._bmp_dn);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGolem_field::autoload(const TRelation& r)
|
||||||
|
{
|
||||||
|
const bool ok = TEditable_field::autoload(r);
|
||||||
|
if (ok)
|
||||||
|
_old_value = get();
|
||||||
|
else
|
||||||
|
_old_value.cut(0);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TGolem_field::autosave(TRelation& r)
|
||||||
long TGolem::new_id() const
|
{
|
||||||
{
|
if (field() != NULL)
|
||||||
long id = 0;
|
|
||||||
|
|
||||||
TLocalisamfile& gol = _golem->lfile();
|
|
||||||
gol.zero();
|
|
||||||
gol.put("CLASSE", _class);
|
|
||||||
gol.put("CHIAVE", "99999999");
|
|
||||||
|
|
||||||
const int err = gol.read(_isgteq);
|
|
||||||
switch (err)
|
|
||||||
{
|
{
|
||||||
case NOERR:
|
TToken_string new_value(get(), '\n');
|
||||||
id = 0; break;
|
if (new_value != _old_value)
|
||||||
case _isemptyfile:
|
{
|
||||||
id = 1; break;
|
TFilename golem_path(_MAX_PATH);
|
||||||
default:
|
TDir dir; dir.get(r.lfile().num());
|
||||||
if (gol.get("CLASSE") != _class)
|
const long ditta = dir.is_com() ? 0 : prefix().get_codditta();
|
||||||
gol.prev();
|
golem_path = firm2dir(ditta);
|
||||||
if (gol.get("CLASSE") == _class)
|
golem_path.add("golem");
|
||||||
id = gol.get_long("CHIAVE")+1;
|
if (!fexist(golem_path))
|
||||||
else
|
make_dir(golem_path);
|
||||||
id = 1;
|
|
||||||
break;
|
const int old_items = _old_value.items();
|
||||||
}
|
const int new_items = new_value.items();
|
||||||
return id;
|
const int items = new_items > old_items ? new_items : old_items;
|
||||||
}
|
|
||||||
|
TToken_string old_row, new_row;
|
||||||
bool TGolem::import()
|
TFilename old_file, new_file;
|
||||||
{
|
for (int i = 0; i < items; i++)
|
||||||
FILE_SPEC fs;
|
|
||||||
const char* const e = ext();
|
|
||||||
xvt_fsys_convert_str_to_dir(".", &fs.dir);
|
|
||||||
strcpy(fs.type, e);
|
|
||||||
sprintf(fs.name, "*.%s", e);
|
|
||||||
strcpy(fs.creator, "GOLEM");
|
|
||||||
|
|
||||||
xvt_fsys_save_dir();
|
|
||||||
FL_STATUS ok = xvt_dm_post_file_open(&fs, "Selezionare il file ...");
|
|
||||||
xvt_fsys_restore_dir();
|
|
||||||
if (ok == FL_OK)
|
|
||||||
{
|
|
||||||
TFilename from;
|
|
||||||
xvt_fsys_convert_dir_to_str(&fs.dir, (char*)(const char*)from, 80);
|
|
||||||
from.add(fs.name); from.ext(e);
|
|
||||||
|
|
||||||
TMask msk("bagn006");
|
|
||||||
msk.set(F_CLASSE, _class);
|
|
||||||
msk.set(F_CODICE, new_id());
|
|
||||||
|
|
||||||
bool correct = msk.run() == K_ENTER;
|
|
||||||
if (correct)
|
|
||||||
{
|
|
||||||
_id = msk.get_long(F_CODICE);
|
|
||||||
correct = fcopy(from, path(TRUE));
|
|
||||||
if (correct)
|
|
||||||
{
|
{
|
||||||
msk.autosave(*_golem);
|
old_row = _old_value.get(i); // Devo usare l'indice ogni volta ...
|
||||||
int err = _golem->write();
|
new_row = new_value.get(i); // ... perche' le TToken_string cambiano!
|
||||||
if (err == _isreinsert)
|
|
||||||
err = _golem->rewrite();
|
|
||||||
if (err != NOERR)
|
|
||||||
{
|
|
||||||
error_box("Errore nell'aggiornamento del file degli oggetti");
|
|
||||||
ok = FL_BAD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error_box("Spazio su disco insufficiente per l'oggetto");
|
|
||||||
ok = FL_BAD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else ok = FL_CANCEL;
|
|
||||||
|
|
||||||
}
|
old_file = old_row.get(0);
|
||||||
|
new_file = new_row.get(0);
|
||||||
return ok == FL_OK;
|
|
||||||
|
if (old_file != new_file)
|
||||||
|
{
|
||||||
|
const was_stored = old_row.get_char(2) <= ' ';
|
||||||
|
const is_stored = new_row.get_char(2) <= ' ';
|
||||||
|
if (was_stored && fexist(old_file))
|
||||||
|
::remove(old_file);
|
||||||
|
if (is_stored && !new_file.blank())
|
||||||
|
{
|
||||||
|
char ext[_MAX_EXT];
|
||||||
|
_splitpath(new_file, NULL, NULL, NULL, ext);
|
||||||
|
|
||||||
|
// Very childish! I can do much better
|
||||||
|
for (long n = 1; ; n++)
|
||||||
|
{
|
||||||
|
TString16 name; name.format("%08ld%s", n, ext);
|
||||||
|
old_file = golem_path;
|
||||||
|
old_file.add(name);
|
||||||
|
if (!fexist(old_file))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fcopy(new_file, old_file);
|
||||||
|
new_row.add(old_file, 0);
|
||||||
|
new_value.add(new_row, i);
|
||||||
|
|
||||||
|
// Cancella il file originale se temporaneo
|
||||||
|
TFilename tmp; tmp.tempdir();
|
||||||
|
if (tmp.compare(new_file, tmp.len(), TRUE) == 0)
|
||||||
|
::remove(new_file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_old_value = new_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TEditable_field::autosave(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool file_handler(TMask_field& f, KEY k)
|
||||||
|
{
|
||||||
|
TMask& m = f.mask();
|
||||||
|
|
||||||
|
if (k == K_F9)
|
||||||
|
{
|
||||||
|
FILE_SPEC fs;
|
||||||
|
xvt_fsys_convert_str_to_dir(".", &fs.dir);
|
||||||
|
strcpy(fs.type, "");
|
||||||
|
strcpy(fs.name, "*.*");
|
||||||
|
strcpy(fs.creator, "GOLEM");
|
||||||
|
|
||||||
|
xvt_fsys_save_dir();
|
||||||
|
FL_STATUS ok = xvt_dm_post_file_open(&fs, "Selezionare il file ...");
|
||||||
|
if (ok == FL_OK)
|
||||||
|
{
|
||||||
|
xvt_fsys_restore_dir();
|
||||||
|
|
||||||
|
TFilename file;
|
||||||
|
xvt_fsys_convert_dir_to_str(&fs.dir, file.get_buffer(), file.size());
|
||||||
|
file.add(fs.name);
|
||||||
|
file.ext(fs.type);
|
||||||
|
f.set(file);
|
||||||
|
k = K_TAB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k == K_TAB && f.focusdirty())
|
||||||
|
{
|
||||||
|
TFilename file = m.get(S_FILE);
|
||||||
|
if (fexist(file))
|
||||||
|
{
|
||||||
|
char ext[_MAX_EXT];
|
||||||
|
char name[_MAX_FNAME];
|
||||||
|
_splitpath(file, NULL, NULL, name, ext);
|
||||||
|
file = name; file.ext(ext);
|
||||||
|
m.enable(S_LINK);
|
||||||
|
m.disable(F_NEWREC);
|
||||||
|
m.enable(F_LINK);
|
||||||
|
m.enable(F_PRINT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const bool full = file.not_empty();
|
||||||
|
m.set(S_LINK, full ? "X" : "");
|
||||||
|
m.disable(S_LINK);
|
||||||
|
m.enable(F_NEWREC, full);
|
||||||
|
m.enable(F_LINK, full);
|
||||||
|
m.disable(F_PRINT);
|
||||||
|
file.cut(0);
|
||||||
|
}
|
||||||
|
m.set(S_ALIAS, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool link_handler(TMask_field& f, KEY k)
|
||||||
|
{
|
||||||
|
if (k == K_SPACE)
|
||||||
|
{
|
||||||
|
TMask& m = f.mask();
|
||||||
|
TFilename url = m.get(S_FILE);
|
||||||
|
short id = f.dlg();
|
||||||
|
if (id == F_NEWREC && url.not_empty())
|
||||||
|
{
|
||||||
|
if (!fexist(url))
|
||||||
|
{
|
||||||
|
TFilename name;
|
||||||
|
char ext[_MAX_EXT];
|
||||||
|
_splitpath(url, NULL, NULL, name.get_buffer(), ext);
|
||||||
|
if (name.not_empty() && *ext)
|
||||||
|
{
|
||||||
|
name.ext(ext);
|
||||||
|
url.tempdir();
|
||||||
|
url.add(name);
|
||||||
|
ofstream out(url); // Crea un file vuoto
|
||||||
|
}
|
||||||
|
else
|
||||||
|
url.cut(0);
|
||||||
|
m.set(S_FILE, url, TRUE); // ... memorizza il suo nome ...
|
||||||
|
m.reset(S_LINK); // Non puo' essere un collegamento
|
||||||
|
}
|
||||||
|
else
|
||||||
|
id = F_LINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url.not_empty())
|
||||||
|
{
|
||||||
|
bool open = TRUE;
|
||||||
|
if (id == DLG_PRINT)
|
||||||
|
open = !print_url(url);
|
||||||
|
if (open)
|
||||||
|
goto_url(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool main_link_handler(TMask_field& f, KEY k)
|
||||||
|
{
|
||||||
|
if (k == K_SPACE)
|
||||||
|
{
|
||||||
|
TSheet_field& sheet = f.mask().sfield(F_SHEET);
|
||||||
|
if (sheet.items() > 0)
|
||||||
|
{
|
||||||
|
sheet.check_row(sheet.selected());
|
||||||
|
TMask& sm = sheet.sheet_mask();
|
||||||
|
TMask_field& link = sm.field(f.dlg());
|
||||||
|
link_handler(link, K_SPACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGolem_field::on_key(KEY key)
|
||||||
|
{
|
||||||
|
bool ok = TRUE;
|
||||||
|
if (key == K_SPACE)
|
||||||
|
{
|
||||||
|
TMask* msk = new TMask("bagn006");
|
||||||
|
TSheet_field& sheet = msk->sfield(F_SHEET);
|
||||||
|
|
||||||
|
TMask& sm = sheet.sheet_mask();
|
||||||
|
sm.set_handler(S_FILE, file_handler);
|
||||||
|
sm.set_handler(F_NEWREC, link_handler);
|
||||||
|
sm.set_handler(F_LINK, link_handler);
|
||||||
|
sm.set_handler(F_PRINT, link_handler);
|
||||||
|
|
||||||
|
TToken_string tmp = get();
|
||||||
|
|
||||||
|
if (roman())
|
||||||
|
{
|
||||||
|
tmp.separator('\n');
|
||||||
|
for (const char* row = tmp.get(0); row; row = tmp.get())
|
||||||
|
{
|
||||||
|
if (*row > ' ')
|
||||||
|
sheet.row(-1) = row;
|
||||||
|
}
|
||||||
|
msk->set_handler(F_NEWREC, main_link_handler);
|
||||||
|
msk->set_handler(F_LINK, main_link_handler);
|
||||||
|
msk->set_handler(F_PRINT, main_link_handler);
|
||||||
|
if (msk->run() == K_ENTER)
|
||||||
|
{
|
||||||
|
tmp.cut(0);
|
||||||
|
for (int r = 0; r < sheet.items(); r++)
|
||||||
|
{
|
||||||
|
TToken_string& row = sheet.row(r);
|
||||||
|
if (row[0] > ' ')
|
||||||
|
tmp.add(row);
|
||||||
|
}
|
||||||
|
set(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
sm.set(S_FILE+i, tmp.get());
|
||||||
|
|
||||||
|
if (sm.run() == K_ENTER)
|
||||||
|
{
|
||||||
|
tmp.cut(0);
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
tmp.add(sm.get(S_FILE+i));
|
||||||
|
set(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete msk;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
TGolem_field::TGolem_field(TMask* m)
|
||||||
|
: TEditable_field(m), _old_value(80, '\n')
|
||||||
|
{ }
|
||||||
|
|
||||||
|
TGolem_field::~TGolem_field()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Obsolete DDE management
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||||
|
|
||||||
|
@ -1,89 +1,10 @@
|
|||||||
#ifndef __GOLEM_H
|
#ifndef __GOLEM_H
|
||||||
#define __GOLEM_H
|
#define __GOLEM_H
|
||||||
|
|
||||||
#ifndef __WINDOW_H
|
|
||||||
#include <window.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
|
||||||
class TConfig;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __RELATION_H
|
|
||||||
class TRelation;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @class TGolem | Classe per le gestione del Generic Object Linking & Embedding Mechanism
|
|
||||||
//
|
|
||||||
// @base public | TSortable
|
|
||||||
class TGolem : public TSortable
|
|
||||||
|
|
||||||
// @author:(INTERNAL) Guido
|
|
||||||
|
|
||||||
// @access:(INTERNAL) Private Member
|
|
||||||
{
|
|
||||||
// @cmember:(INTERNAL) Numero di GOLEM costruiti fin'ora
|
|
||||||
static long _count;
|
|
||||||
// @cmember:(INTERNAL) <c TConfig> di appoggio per leggere i paramentri
|
|
||||||
static TConfig* _config;
|
|
||||||
// @cmember:(INTERNAL) Nome del file di config
|
|
||||||
static TFilename* _path;
|
|
||||||
// @cmember:(INTERNAL) <c TRelation> dei GOLEM
|
|
||||||
static TRelation* _golem;
|
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Nome della classe del GOLEM
|
|
||||||
TString16 _class;
|
|
||||||
// @cmember:(INTERNAL) Identificatore del GOLEM
|
|
||||||
long _id;
|
|
||||||
|
|
||||||
// @access Protected Member
|
|
||||||
protected:
|
|
||||||
// @cmember Ritorna il path completo dell'oggetto inserito. <p test> verifica se esiste
|
|
||||||
const TFilename& path(bool test = FALSE) const;
|
|
||||||
// @cmember Ritorna l'estensione del GOLEM
|
|
||||||
const char* ext() const;
|
|
||||||
// @cmember Ritorna il <c TConfig> di appoggio per leggere i paramentri
|
|
||||||
TConfig& config() const;
|
|
||||||
// @cmember Genera il prossimo identificatore libero
|
|
||||||
long new_id() const;
|
|
||||||
|
|
||||||
protected:// TSortable
|
|
||||||
// @cmember Confronta due GOLEM (vedi <c TSortable>)
|
|
||||||
virtual int compare(const TSortable& o) const;
|
|
||||||
|
|
||||||
// @access Public Member
|
|
||||||
public: // TObject
|
|
||||||
// @cmember Ritorna il nome della classe
|
|
||||||
virtual const char* class_name() const;
|
|
||||||
// @cmember Ritorna l'identificatore della classe
|
|
||||||
virtual word class_id() const;
|
|
||||||
// @cmember Ritorna se si tratta di un oggetto valido
|
|
||||||
virtual bool ok() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// @cmember Ritorna l'identificatore dell'icona del GOLEM
|
|
||||||
virtual short icon() const;
|
|
||||||
// @cmember Chiama il programma di moifica del GOLEM
|
|
||||||
virtual bool edit();
|
|
||||||
// @cmember Mostra il dialog box di selezione del file
|
|
||||||
virtual bool import();
|
|
||||||
|
|
||||||
// @cmember Ritorna l'identificatore del GOLEM
|
|
||||||
long id() const
|
|
||||||
{ return _id; }
|
|
||||||
|
|
||||||
// @cmember Costruttore
|
|
||||||
TGolem(const char* cls, long id);
|
|
||||||
// @cmember Distruttore
|
|
||||||
virtual ~TGolem();
|
|
||||||
};
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @class TDDE | Classe per la gestione del DDE
|
// @class TDDE | Classe per la gestione del DDE
|
||||||
|
@ -836,7 +836,8 @@ TMask_field* TMask::parse_field(TScanner& scanner)
|
|||||||
if (k == "LI") return new TList_field(this);
|
if (k == "LI") return new TList_field(this);
|
||||||
if (k == "RA") return new TRadio_field(this);
|
if (k == "RA") return new TRadio_field(this);
|
||||||
if (k == "ME") return new TMemo_field(this);
|
if (k == "ME") return new TMemo_field(this);
|
||||||
if (k == "ZO") return new TZoom_field(this);
|
if (k == "ZO") return new TZoom_field(this);
|
||||||
|
if (k == "GO") return new TGolem_field(this);
|
||||||
if (k == "BR") return new TBrowsefile_field(this);
|
if (k == "BR") return new TBrowsefile_field(this);
|
||||||
if (k == "SP")
|
if (k == "SP")
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <golem.h>
|
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
@ -1755,13 +1754,6 @@ void TBrowse::parse_input(TScanner& scanner)
|
|||||||
scanner.push();
|
scanner.push();
|
||||||
TString& str = scanner.line();
|
TString& str = scanner.line();
|
||||||
_inp_id.add(str);
|
_inp_id.add(str);
|
||||||
|
|
||||||
if (_cursor->file().num() == LF_GOLEM) // GOLEM 2 detected!
|
|
||||||
{
|
|
||||||
str.strip("\"");
|
|
||||||
_insert = "G";
|
|
||||||
_insert << str;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // Field on the mask
|
else // Field on the mask
|
||||||
{
|
{
|
||||||
@ -2392,30 +2384,11 @@ KEY TBrowse::run()
|
|||||||
switch (k)
|
switch (k)
|
||||||
{
|
{
|
||||||
case K_CTRL+'G':
|
case K_CTRL+'G':
|
||||||
if (_insert[0] == 'G')
|
*_cursor = selected;
|
||||||
{
|
k = do_link(FALSE) ? K_ENTER : K_ESC;
|
||||||
field().set(format("%ld", selected+1));
|
|
||||||
TGolem golem(&_insert[1], atol(field().get()));
|
|
||||||
k = golem.edit() ? K_ENTER : K_ESC;
|
|
||||||
if (k = K_ESC)
|
|
||||||
error_box("Impossibile modificare l'oggetto");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*_cursor = selected;
|
|
||||||
k = do_link(FALSE) ? K_ENTER : K_ESC;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case K_INS:
|
case K_INS:
|
||||||
if (_insert[0] == 'G')
|
k = do_link(TRUE) ? K_ENTER : K_ESC;
|
||||||
{
|
|
||||||
TGolem gol(&_insert[1], 0);
|
|
||||||
if (gol.import())
|
|
||||||
field().set(format("%ld", gol.id()));
|
|
||||||
k = K_ENTER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
k = do_link(TRUE) ? K_ENTER : K_ESC;
|
|
||||||
break;
|
break;
|
||||||
case K_ENTER:
|
case K_ENTER:
|
||||||
*_cursor = selected;
|
*_cursor = selected;
|
||||||
@ -4201,3 +4174,6 @@ const char* TZoom_field::win2raw(const char* data) const
|
|||||||
|
|
||||||
const char* TZoom_field::get_first_line() const
|
const char* TZoom_field::get_first_line() const
|
||||||
{ return raw2win(_str); }
|
{ return raw2win(_str); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -653,7 +653,6 @@ public:
|
|||||||
// @cmember Ritorna TRUE se il campo e' di tipo editable
|
// @cmember Ritorna TRUE se il campo e' di tipo editable
|
||||||
virtual bool is_editable() const { return TRUE; }
|
virtual bool is_editable() const { return TRUE; }
|
||||||
|
|
||||||
|
|
||||||
TEditable_field(TMask* m);
|
TEditable_field(TMask* m);
|
||||||
virtual ~TEditable_field();
|
virtual ~TEditable_field();
|
||||||
};
|
};
|
||||||
@ -1386,6 +1385,32 @@ public:
|
|||||||
virtual ~TZoom_field();
|
virtual ~TZoom_field();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TGolem_field : public TEditable_field
|
||||||
|
{
|
||||||
|
TToken_string _old_value;
|
||||||
|
|
||||||
|
protected: // TEditable_field
|
||||||
|
virtual TString& get_window_data();
|
||||||
|
virtual void set_window_data(const char* data);
|
||||||
|
|
||||||
|
virtual bool on_key(KEY k);
|
||||||
|
|
||||||
|
// @cmember Ritorna FALSE in quanto il campo non e' realmente editable
|
||||||
|
virtual bool is_editable() const;
|
||||||
|
|
||||||
|
virtual void parse_head(TScanner& scanner);
|
||||||
|
virtual void create(WINDOW parent);
|
||||||
|
|
||||||
|
// @cmember Legge dalla relazione il valore del campo
|
||||||
|
virtual bool autoload(const TRelation& r);
|
||||||
|
// @cmember Scrive sulla relazione il valore del campo
|
||||||
|
virtual bool autosave(TRelation& r);
|
||||||
|
|
||||||
|
public:
|
||||||
|
TGolem_field(TMask* m);
|
||||||
|
virtual ~TGolem_field();
|
||||||
|
};
|
||||||
|
|
||||||
#endif // __MASKFLD_H
|
#endif // __MASKFLD_H
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,25 +379,24 @@ public:
|
|||||||
|
|
||||||
// @class TFilename | Classe per la gestione dei nome dei file
|
// @class TFilename | Classe per la gestione dei nome dei file
|
||||||
//
|
//
|
||||||
// @base public | TString80
|
// @base public | TString
|
||||||
class TFilename : public TString80
|
class TFilename : public TString
|
||||||
// @author:(INTERNAL) Guido
|
// @author:(INTERNAL) Guido
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// @comm Nel caso di utilizzo di Windows 95 occorre cambiare le classe base in <c TString256>
|
// @comm Nel caso di utilizzo di Windows 95 occorre cambiare le classe base in <c TString256>
|
||||||
|
|
||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
TFilename(const char* n = "") : TString80(n)
|
TFilename(const char* n = "") : TString(256)
|
||||||
{}
|
{ set(n); }
|
||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
TFilename(const TString& n) : TString80((const char*)n)
|
TFilename(const TString& n) : TString(256)
|
||||||
{}
|
{ set(n); }
|
||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
TFilename(const TFilename& n) : TString80((const char*)n)
|
TFilename(const TFilename& n) : TString(256)
|
||||||
{}
|
{ set(n); }
|
||||||
|
|
||||||
// @cmember Assegnazione tra TFile e stringa
|
// @cmember Assegnazione tra TFile e stringa
|
||||||
const TString& operator =(const char* s)
|
const TString& operator =(const char* s)
|
||||||
|
@ -66,10 +66,10 @@
|
|||||||
#define BMP_BOOK2 132
|
#define BMP_BOOK2 132
|
||||||
#define BMP_BOOK3 133
|
#define BMP_BOOK3 133
|
||||||
#define BMP_MODULE 134
|
#define BMP_MODULE 134
|
||||||
#define BMP_BMP 135
|
#define BMP_OLE 135
|
||||||
#define BMP_WAV 136
|
#define BMP_1 136
|
||||||
#define BMP_XLS 137
|
#define BMP_2 137
|
||||||
#define BMP_DOC 138
|
#define BMP_3 138
|
||||||
#define BMP_SAVERECDN 153
|
#define BMP_SAVERECDN 153
|
||||||
#define BMP_DELRECDN 154
|
#define BMP_DELRECDN 154
|
||||||
#define BMP_NEWRECDN 155
|
#define BMP_NEWRECDN 155
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -78,8 +79,8 @@ bool fcopy(
|
|||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
while (ok)
|
while (ok)
|
||||||
{
|
{
|
||||||
const word letti = fread((char*)(const char*)buffer, 1, size, i);
|
const word letti = fread(buffer.get_buffer(), 1, size, i);
|
||||||
ok = fwrite((char*)(const char*)buffer, 1, letti, o) == letti;
|
ok = fwrite(buffer.get_buffer(), 1, letti, o) == letti;
|
||||||
if (letti < size) break;
|
if (letti < size) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,8 +102,18 @@ bool fcopy(
|
|||||||
// @flag FALSE | Se il file non esiste
|
// @flag FALSE | Se il file non esiste
|
||||||
bool fexist(
|
bool fexist(
|
||||||
const char* file) // @parm Nome del file di cui contrallarne l'esistenza
|
const char* file) // @parm Nome del file di cui contrallarne l'esistenza
|
||||||
{
|
{
|
||||||
return access(file, F_OK) == 0;
|
int err = access(file, F_OK);
|
||||||
|
if (err) // Se la access fallisce provo con la _lopen
|
||||||
|
{
|
||||||
|
HFILE hf = _lopen(file, READ);
|
||||||
|
if (hf != HFILE_ERROR)
|
||||||
|
{
|
||||||
|
_lclose(hf);
|
||||||
|
err = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
@ -433,46 +444,3 @@ os_type get_os_type()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WATCOMC__
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @func Costruisce il percorso per un file temporaneo
|
|
||||||
//
|
|
||||||
// @rdesc Ritorna il nome assoluto del file temporaneo
|
|
||||||
char * tempnam(
|
|
||||||
const char * dir , // @parm Nome della directory nel quale inserire il file temporaneo
|
|
||||||
const char * prefix) // @parm Evenutale prefisso da dare al file temporaneo
|
|
||||||
|
|
||||||
// @comm Il nome della directory viene letto dalla variabile d'ambiente chiamata
|
|
||||||
// TMP, solo nel caso questa non esista viene utilizzato il nome passato
|
|
||||||
// in <p dir>.
|
|
||||||
// <nl>E' definita solo nel caso si utilizzi il WATCOM C/C++.
|
|
||||||
|
|
||||||
{
|
|
||||||
TFilename tmpdir(getenv("TMP"));
|
|
||||||
static word counter = 1;
|
|
||||||
|
|
||||||
if (tmpdir.empty() || !fexist(tmpdir))
|
|
||||||
{
|
|
||||||
tmpdir = dir;
|
|
||||||
if (tmpdir.empty() || !fexist(tmpdir))
|
|
||||||
tmpdir = "";
|
|
||||||
}
|
|
||||||
if (is_not_slash(tmpdir.right(1)[0]))
|
|
||||||
tmpdir << '/';
|
|
||||||
tmpdir << prefix ;
|
|
||||||
const int lastpos = tmpdir.len() ;
|
|
||||||
tmpdir << format("%ud", counter);
|
|
||||||
|
|
||||||
while (!fexist(tmpdir))
|
|
||||||
{
|
|
||||||
counter++;
|
|
||||||
if (counter == 0) counter = 1;
|
|
||||||
tmpdir.cut(lastpos);
|
|
||||||
tmpdir << format("%ud", counter);
|
|
||||||
}
|
|
||||||
return strdup(tmpdir);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ HIDDEN bool _chkfld_val(TMask_field& f, KEY k)
|
|||||||
HIDDEN bool _filename_val(TMask_field& f, KEY)
|
HIDDEN bool _filename_val(TMask_field& f, KEY)
|
||||||
{
|
{
|
||||||
const TFilename fn(f.get());
|
const TFilename fn(f.get());
|
||||||
return fn.ok();
|
return fn.blank() || fn.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN bool _zerofill_val(TMask_field& f, KEY k)
|
HIDDEN bool _zerofill_val(TMask_field& f, KEY k)
|
||||||
|
@ -389,6 +389,12 @@ TImage::TImage(const TImage& im, short w, short h) : _image(NULL)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Certified 90%
|
||||||
|
TImage::TImage(short w, short h, XVT_IMAGE_FORMAT fmt) : _image(NULL)
|
||||||
|
{
|
||||||
|
set(xvt_image_create(fmt, w, h, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
TImage::~TImage()
|
TImage::~TImage()
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,8 @@ public:
|
|||||||
TImage(short id);
|
TImage(short id);
|
||||||
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
||||||
TImage(const TImage& i, short width, short height);
|
TImage(const TImage& i, short width, short height);
|
||||||
|
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
||||||
|
TImage(short width, short height, XVT_IMAGE_FORMAT fmt = XVT_IMAGE_CL8);
|
||||||
// @cmember Distruttore
|
// @cmember Distruttore
|
||||||
virtual ~TImage();
|
virtual ~TImage();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user