Modificato meccanismo richiamo programmi esterni
git-svn-id: svn://10.65.10.50/trunk@793 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
af3b1f3113
commit
e8dcb49a76
@ -301,6 +301,17 @@ void TApplication::terminate()
|
|||||||
if (_create_ok)
|
if (_create_ok)
|
||||||
{
|
{
|
||||||
destroy(); // Distruzione files e maschere
|
destroy(); // Distruzione files e maschere
|
||||||
|
#if XVT_OS == XVT_OS_WIN
|
||||||
|
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
|
||||||
|
const HTASK ht = GetCurrentTask();
|
||||||
|
SendMessage(HWND_BROADCAST, WM_WAKEUP, ht, 0L);
|
||||||
|
|
||||||
|
if (fexist("prassi.hlp"))
|
||||||
|
{
|
||||||
|
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||||
|
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
do_events();
|
do_events();
|
||||||
|
|
||||||
if (_printer != NULL) // Distruzione dell'eventuale stampante
|
if (_printer != NULL) // Distruzione dell'eventuale stampante
|
||||||
@ -310,13 +321,6 @@ void TApplication::terminate()
|
|||||||
delete _printer;
|
delete _printer;
|
||||||
_printer = NULL;
|
_printer = NULL;
|
||||||
}
|
}
|
||||||
#if XVT_OS == XVT_OS_WIN
|
|
||||||
if (fexist("prassi.hlp"))
|
|
||||||
{
|
|
||||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
|
||||||
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_files())
|
if (use_files())
|
||||||
@ -392,17 +396,9 @@ void TApplication::check_parameters(int & argc, char* argv[])
|
|||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
else _user = "PRASSI";
|
else _user = "PRASSI";
|
||||||
#endif
|
#endif
|
||||||
long twin_style = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE;
|
|
||||||
|
|
||||||
if (stricmp(argv[argc-1], "-icon") == 0)
|
|
||||||
{
|
|
||||||
twin_style |= WSF_ICONIZED;
|
|
||||||
argc--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
twin_style |= WSF_MAXIMIZED;
|
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
|
const long twin_style = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE | WSF_MAXIMIZED;
|
||||||
set_value(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, twin_style);
|
set_value(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, twin_style);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ class TApplication
|
|||||||
|
|
||||||
long _savefirm;
|
long _savefirm;
|
||||||
bool _create_ok;
|
bool _create_ok;
|
||||||
|
word _waiting;
|
||||||
|
|
||||||
static TString16 _user;
|
static TString16 _user;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -96,6 +98,10 @@ public:
|
|||||||
long get_firm() const;
|
long get_firm() const;
|
||||||
const char* get_firm_dir() const;
|
const char* get_firm_dir() const;
|
||||||
|
|
||||||
|
void wait_for(word taskid) { _waiting = taskid; }
|
||||||
|
void wake_up() { _waiting = 0; }
|
||||||
|
word waiting() const { return _waiting; }
|
||||||
|
|
||||||
TApplication();
|
TApplication();
|
||||||
virtual ~TApplication();
|
virtual ~TApplication();
|
||||||
};
|
};
|
||||||
|
@ -146,7 +146,6 @@ int yesnofatal_box(const char* fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int yesnocancel_box(const char* fmt, ...)
|
int yesnocancel_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
@ -170,6 +169,19 @@ int yesnocancel_box(const char* fmt, ...)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __trace(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
buildmsg();
|
||||||
|
FILE* f = fopen("trace.log", "a");
|
||||||
|
if (f != NULL)
|
||||||
|
{
|
||||||
|
fprintf(f, "%s\n", msg);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return f != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // XVT_OS
|
#endif // XVT_OS
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ int fatal_box(const char* fmt, ...);
|
|||||||
int yesno_box(const char* fmt, ...);
|
int yesno_box(const char* fmt, ...);
|
||||||
int yesnocancel_box(const char* fmt, ...);
|
int yesnocancel_box(const char* fmt, ...);
|
||||||
int yesnofatal_box(const char* fmt, ...);
|
int yesnofatal_box(const char* fmt, ...);
|
||||||
|
int __trace(const char* fmt, ...);
|
||||||
|
|
||||||
/* @END */
|
/* @END */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -49,9 +50,9 @@ Utilizzate in fase di debug (definire il simbolo DBG in compilazione)
|
|||||||
Utilizzata in fase di debug (definire il simbolo TRC in compilazione)
|
Utilizzata in fase di debug (definire il simbolo TRC in compilazione)
|
||||||
*/
|
*/
|
||||||
#ifdef TRC
|
#ifdef TRC
|
||||||
#define TRACE(m) warning_box(m)
|
#define TRACE __trace
|
||||||
#else
|
#else
|
||||||
#define TRACE(m) ((void) 0)
|
#define TRACE 1 ? 0 : __trace
|
||||||
#endif
|
#endif
|
||||||
/* @END */
|
/* @END */
|
||||||
|
|
||||||
|
@ -665,7 +665,6 @@ wrec = buffer di lavoro.
|
|||||||
|
|
||||||
{
|
{
|
||||||
int knum = (isfd->i.PN+1), werr, junk;
|
int knum = (isfd->i.PN+1), werr, junk;
|
||||||
RecType wrec;
|
|
||||||
RecNoType neweox;
|
RecNoType neweox;
|
||||||
|
|
||||||
*err = NoErr;
|
*err = NoErr;
|
||||||
@ -717,11 +716,13 @@ wrec = buffer di lavoro.
|
|||||||
IRecallRec(record);
|
IRecallRec(record);
|
||||||
if (test_share() && isfd->f.LockMode != ExclLock)
|
if (test_share() && isfd->f.LockMode != ExclLock)
|
||||||
{
|
{
|
||||||
wrec = malloc(isfd->d->LenR);
|
RecType wrec = malloc(isfd->d->LenR);
|
||||||
memcpy(wrec, record, isfd->d->LenR);
|
memcpy(wrec, record, isfd->d->LenR);
|
||||||
savekeystat(isfd);
|
savekeystat(isfd);
|
||||||
junk = cisstart(isfd, 1, wrec, INTTLOCK+IsEqual, &junk);
|
junk = cisstart(isfd, 1, wrec, NoLock+IsEqual, &junk);
|
||||||
restkeystat(isfd, knum);
|
restkeystat(isfd, knum);
|
||||||
|
free(wrec);
|
||||||
|
|
||||||
if ((junk == NoErr) || (junk == ISLOCKED))
|
if ((junk == NoErr) || (junk == ISLOCKED))
|
||||||
{
|
{
|
||||||
*err = IsReInsert;
|
*err = IsReInsert;
|
||||||
@ -733,7 +734,6 @@ wrec = buffer di lavoro.
|
|||||||
isfd->RecNo = 0;
|
isfd->RecNo = 0;
|
||||||
return(*err);
|
return(*err);
|
||||||
}
|
}
|
||||||
free(wrec);
|
|
||||||
}
|
}
|
||||||
isfd->RecNo = (++isfd->d->EOD);
|
isfd->RecNo = (++isfd->d->EOD);
|
||||||
if ((isfd->r->NKeys) && IndActive)
|
if ((isfd->r->NKeys) && IndActive)
|
||||||
|
@ -505,6 +505,7 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
|||||||
{
|
{
|
||||||
switch(id)
|
switch(id)
|
||||||
{
|
{
|
||||||
|
|
||||||
case DLG_OK:
|
case DLG_OK:
|
||||||
if (strcmp("Conferma", caption()) == 0)
|
if (strcmp("Conferma", caption()) == 0)
|
||||||
capt = format("#%d", BMP_OK);
|
capt = format("#%d", BMP_OK);
|
||||||
@ -526,21 +527,23 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
|||||||
if (strcmp("Nuovo", caption()) == 0) // Puo' essere Gestione
|
if (strcmp("Nuovo", caption()) == 0) // Puo' essere Gestione
|
||||||
capt = format("#%d#%d", BMP_NEWREC, BMP_NEWRECDN);
|
capt = format("#%d#%d", BMP_NEWREC, BMP_NEWRECDN);
|
||||||
break;
|
break;
|
||||||
|
case DLG_STOPREC:
|
||||||
|
capt = format("#%d", BMP_STOPREC);
|
||||||
|
break;
|
||||||
|
/*
|
||||||
case DLG_FIRSTREC:
|
case DLG_FIRSTREC:
|
||||||
capt = format("#%d", BMP_FIRSTREC);
|
capt = format("#%d", BMP_FIRSTREC);
|
||||||
break;
|
break;
|
||||||
case DLG_PREVREC:
|
case DLG_PREVREC:
|
||||||
capt = format("#%d", BMP_PREVREC);
|
capt = format("#%d", BMP_PREVREC);
|
||||||
break;
|
break;
|
||||||
case DLG_STOPREC:
|
|
||||||
capt = format("#%d", BMP_STOPREC);
|
|
||||||
break;
|
|
||||||
case DLG_NEXTREC:
|
case DLG_NEXTREC:
|
||||||
capt = format("#%d", BMP_NEXTREC);
|
capt = format("#%d", BMP_NEXTREC);
|
||||||
break;
|
break;
|
||||||
case DLG_LASTREC:
|
case DLG_LASTREC:
|
||||||
capt = format("#%d", BMP_LASTREC);
|
capt = format("#%d", BMP_LASTREC);
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
case DLG_SAVEREC:
|
case DLG_SAVEREC:
|
||||||
capt = format("#%d#%d", BMP_SAVEREC, BMP_SAVERECDN);
|
capt = format("#%d#%d", BMP_SAVEREC, BMP_SAVERECDN);
|
||||||
break;
|
break;
|
||||||
|
@ -30,15 +30,12 @@ bool TExternal_app::can_run() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TExternal_app::run(bool async, bool iconized)
|
int TExternal_app::run(bool async, bool user)
|
||||||
{
|
{
|
||||||
TString256 path(_path);
|
TString256 path(_path);
|
||||||
|
|
||||||
if (!async)
|
if (user)
|
||||||
{
|
|
||||||
if (iconized) path << " -icon";
|
|
||||||
path << " -u" << main_app().user();
|
path << " -u" << main_app().user();
|
||||||
}
|
|
||||||
|
|
||||||
_error = 0;
|
_error = 0;
|
||||||
_exitcode = 0;
|
_exitcode = 0;
|
||||||
@ -59,34 +56,32 @@ int TExternal_app::run(bool async, bool iconized)
|
|||||||
CURSOR oldcur = get_cursor(TASK_WIN);
|
CURSOR oldcur = get_cursor(TASK_WIN);
|
||||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||||
|
|
||||||
const UINT sh = iconized ? SW_SHOWMINIMIZED : SW_SHOW;
|
_exitcode = WinExec((char*)(const char*)path, SW_SHOW);
|
||||||
_exitcode = WinExec((char*)(const char*)path, sh);
|
|
||||||
|
|
||||||
if (_exitcode >= 32)
|
if (_exitcode >= 32)
|
||||||
{
|
{
|
||||||
if (!async)
|
if (!async)
|
||||||
{
|
|
||||||
if (!iconized)
|
|
||||||
{
|
{
|
||||||
TTemp_window tw(TASK_WIN);
|
TTemp_window tw(TASK_WIN);
|
||||||
tw.iconize();
|
tw.iconize();
|
||||||
}
|
|
||||||
|
|
||||||
HTASK child = NULL;
|
HTASK child = NULL;
|
||||||
TASKENTRY te; te.dwSize = sizeof(TASKENTRY);
|
TASKENTRY te; te.dwSize = sizeof(TASKENTRY);
|
||||||
for (bool ok = TaskFirst(&te); ok; ok = TaskNext(&te))
|
for (bool ok = TaskFirst(&te); ok; ok = TaskNext(&te))
|
||||||
if (te.hInst == (HINSTANCE)_exitcode) child = te.hTask;
|
if (te.hInst == (HINSTANCE)_exitcode) child = te.hTask;
|
||||||
CHECK(child, "Can't find child task");
|
CHECK(child, "Can't find child task");
|
||||||
while(TaskFindHandle(&te, child))
|
|
||||||
process_events();
|
|
||||||
|
|
||||||
if (!iconized)
|
main_app().wait_for(child);
|
||||||
|
for (byte i = 0; main_app().waiting(); i++)
|
||||||
{
|
{
|
||||||
TTemp_window tw(TASK_WIN);
|
if (i == 0 && TaskFindHandle(&te, child) == FALSE)
|
||||||
|
break;
|
||||||
|
process_events();
|
||||||
|
}
|
||||||
|
|
||||||
tw.maximize();
|
tw.maximize();
|
||||||
|
}
|
||||||
xvt_statbar_refresh();
|
xvt_statbar_refresh();
|
||||||
}
|
|
||||||
}
|
|
||||||
_exitcode = 0;
|
_exitcode = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -96,7 +91,6 @@ int TExternal_app::run(bool async, bool iconized)
|
|||||||
else
|
else
|
||||||
error_box("Impossibile eseguire '%s':\nErrore %d", (const char*)_path, _exitcode);
|
error_box("Impossibile eseguire '%s':\nErrore %d", (const char*)_path, _exitcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_cursor(TASK_WIN, oldcur);
|
set_cursor(TASK_WIN, oldcur);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -23,7 +23,7 @@ class TExternal_app : public TObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
bool can_run() const;
|
bool can_run() const;
|
||||||
int run(bool async = FALSE, bool iconized = FALSE);
|
int run(bool async = FALSE, bool user = TRUE);
|
||||||
int error() { return _error;};
|
int error() { return _error;};
|
||||||
int exitcode() { return _exitcode;};
|
int exitcode() { return _exitcode;};
|
||||||
int count() { return _count; };
|
int count() { return _count; };
|
||||||
|
205
include/form.cpp
205
include/form.cpp
@ -2,13 +2,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <msksheet.h>
|
|
||||||
#include <form.h>
|
#include <form.h>
|
||||||
|
#include <msksheet.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include <bagn003.h>
|
#include "..\ba\ba2100.h"
|
||||||
|
|
||||||
static TForm* _form = NULL;
|
static TForm* _form = NULL;
|
||||||
|
|
||||||
@ -71,7 +71,8 @@ void TForm_flags::print_on(ostream& out) const
|
|||||||
if (!enabled) s << "D";
|
if (!enabled) s << "D";
|
||||||
if (!shown) s << "H";
|
if (!shown) s << "H";
|
||||||
|
|
||||||
if (s.not_empty()) out << " FLAGS \"" << s << '"' << endl;
|
if (s.not_empty())
|
||||||
|
out << " FLAGS \"" << s << '"' << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,7 +144,7 @@ public:
|
|||||||
|
|
||||||
bool in_group(byte g) const { return g == 0 || _group[g]; }
|
bool in_group(byte g) const { return g == 0 || _group[g]; }
|
||||||
const TString& key() const { return _desc; }
|
const TString& key() const { return _desc; }
|
||||||
void to_row(TToken_string& row) const;
|
void print_on(TToken_string& row) const;
|
||||||
|
|
||||||
void show(bool on = TRUE) { _flag.shown = on; }
|
void show(bool on = TRUE) { _flag.shown = on; }
|
||||||
void hide() { show(FALSE); }
|
void hide() { show(FALSE); }
|
||||||
@ -375,11 +376,15 @@ bool TForm_item::update()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TForm_item::to_row(TToken_string& row) const
|
void TForm_item::print_on(TToken_string& row) const
|
||||||
{
|
{
|
||||||
row = class_name();
|
row = class_name();
|
||||||
row.add(_y);
|
row.add(_y);
|
||||||
row.add(_x);
|
row.add(_x);
|
||||||
|
|
||||||
|
const long fu = _group.first_one();
|
||||||
|
if (fu > 0) row.add(fu);
|
||||||
|
else row.add(" ");
|
||||||
row.add(key());
|
row.add(key());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,10 +793,27 @@ bool TForm_list::update()
|
|||||||
// TPrint_section
|
// TPrint_section
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TPrint_section::TPrint_section(TForm* f)
|
TMask* TPrint_section::_msk = NULL;
|
||||||
: _height(0), _form(f)
|
|
||||||
|
TPrint_section::TPrint_section(TForm* f) : _height(0), _form(f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TPrint_section::~TPrint_section()
|
||||||
|
{
|
||||||
|
if (_msk)
|
||||||
|
{
|
||||||
|
delete _msk;
|
||||||
|
_msk = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const TPrint_section& TPrint_section::copy(const TPrint_section& ps)
|
||||||
|
{
|
||||||
|
_item = ps._item;
|
||||||
|
_height = ps._height;
|
||||||
|
return ps;
|
||||||
|
}
|
||||||
|
|
||||||
TPrintrow& TPrint_section::row(int num)
|
TPrintrow& TPrint_section::row(int num)
|
||||||
{
|
{
|
||||||
TPrintrow* pr = (TPrintrow*)objptr(num);
|
TPrintrow* pr = (TPrintrow*)objptr(num);
|
||||||
@ -815,7 +837,7 @@ TForm_item* TPrint_section::parse_item(const TString& s)
|
|||||||
if (s == "LI")
|
if (s == "LI")
|
||||||
return new TForm_list(this);
|
return new TForm_list(this);
|
||||||
|
|
||||||
CHECKS(NULL, "Elemento di stampa sconosciuto: ", (const char*)s);
|
CHECKS(NULL, "Campo di stampa sconosciuto: ", (const char*)s);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -868,51 +890,63 @@ bool TPrint_section::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TPrint_section::edit()
|
bool TPrint_section::edit(const char* title)
|
||||||
{
|
{
|
||||||
TMask m("bagn003");
|
TMask m("ba2100s");
|
||||||
|
m.set_caption(title);
|
||||||
|
|
||||||
TString80 title("Campi della sezione");
|
m.set(F_HEIGHT, _height);
|
||||||
|
|
||||||
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Riga|Col.|Descrizione@80", 0xE);
|
if (m.run() == K_ESC)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
bool dirty = m.dirty() != 0;
|
||||||
|
|
||||||
|
if (dirty)
|
||||||
|
_height = m.get_int(F_HEIGHT);
|
||||||
|
|
||||||
|
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Riga|Col.|Gr.|Descrizione@40", 0xE);
|
||||||
|
|
||||||
for (word i = 0; i < fields(); i++)
|
for (word i = 0; i < fields(); i++)
|
||||||
{
|
{
|
||||||
TToken_string* s = new TToken_string(128);
|
TToken_string* s = new TToken_string(128);
|
||||||
field(i).to_row(*s);
|
field(i).print_on(*s);
|
||||||
a.add(s);
|
a.add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dirty = FALSE;
|
|
||||||
KEY k;
|
KEY k;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
k = a.run();
|
k = a.run();
|
||||||
i = (word)a.selected();
|
i = (word)a.selected();
|
||||||
|
|
||||||
|
if (k == K_ENTER || k == K_INS && _msk == NULL)
|
||||||
|
_msk = new TMask("ba2100f");
|
||||||
|
|
||||||
switch(k)
|
switch(k)
|
||||||
{
|
{
|
||||||
case K_ENTER:
|
case K_ENTER:
|
||||||
m.set_mode(MODE_MOD);
|
_msk->set_mode(MODE_MOD);
|
||||||
if (field(i).edit(m))
|
if (field(i).edit(*_msk))
|
||||||
{
|
{
|
||||||
|
field(i).print_on(a.row(i));
|
||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
field(i).to_row(a.row(i));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_INS:
|
case K_INS:
|
||||||
{
|
{
|
||||||
m.set_mode(MODE_INS);
|
_msk->set_mode(MODE_INS);
|
||||||
TForm_string dummy(this);
|
TForm_string dummy(this);
|
||||||
if (dummy.edit(m))
|
if (dummy.edit(*_msk))
|
||||||
{
|
{
|
||||||
const TString& c = m.get(F_CLASS).left(2);
|
const TString& c = _msk->get(F_CLASS).left(2);
|
||||||
TForm_item* item = parse_item(c);
|
TForm_item* item = parse_item(c);
|
||||||
item->read_from(m);
|
item->read_from(*_msk);
|
||||||
_item.insert(item, i);
|
_item.insert(item, i);
|
||||||
|
|
||||||
TToken_string s(128); item->to_row(s);
|
TToken_string s(128); item->print_on(s);
|
||||||
a.insert(s, i);
|
a.insert(s, i);
|
||||||
|
dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -921,6 +955,7 @@ bool TPrint_section::edit()
|
|||||||
{
|
{
|
||||||
_item.destroy(i, TRUE);
|
_item.destroy(i, TRUE);
|
||||||
a.destroy(i);
|
a.destroy(i);
|
||||||
|
dirty = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -933,7 +968,7 @@ bool TPrint_section::edit()
|
|||||||
|
|
||||||
void TPrint_section::print_on(ostream& out) const
|
void TPrint_section::print_on(ostream& out) const
|
||||||
{
|
{
|
||||||
out << _height << endl;
|
out << ' ' << _height << endl;
|
||||||
for(word i = 0; i < fields(); i++)
|
for(word i = 0; i < fields(); i++)
|
||||||
out << field(i);
|
out << field(i);
|
||||||
}
|
}
|
||||||
@ -952,23 +987,14 @@ bool TForm::parse_use(TScanner& scanner)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
tab = scanner.pop();
|
tab = scanner.pop();
|
||||||
if (strlen(tab) > 4)
|
|
||||||
return error_box("'%s' non e' una tabella valida: %d", tab);
|
|
||||||
_relation = new TRelation(tab);
|
_relation = new TRelation(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
int key = 1;
|
int key = 1;
|
||||||
if (scanner.popkey() == "KE")
|
if (scanner.popkey() == "KE")
|
||||||
{
|
|
||||||
key = scanner.integer();
|
key = scanner.integer();
|
||||||
if (key < 1)
|
else
|
||||||
{
|
scanner.push();
|
||||||
error_box("Chiave non valida '%s': uso 1",
|
|
||||||
(const char*)scanner.token());
|
|
||||||
key = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else scanner.push();
|
|
||||||
|
|
||||||
_cursor = new TCursor(_relation, "", key);
|
_cursor = new TCursor(_relation, "", key);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -977,7 +1003,7 @@ bool TForm::parse_use(TScanner& scanner)
|
|||||||
|
|
||||||
bool TForm::parse_join(TScanner& scanner)
|
bool TForm::parse_join(TScanner& scanner)
|
||||||
{
|
{
|
||||||
TString j(scanner.pop()); // File or table
|
TString16 j(scanner.pop()); // File or table
|
||||||
|
|
||||||
int to = 0;
|
int to = 0;
|
||||||
if (scanner.popkey() == "TO") // TO keyword
|
if (scanner.popkey() == "TO") // TO keyword
|
||||||
@ -1020,13 +1046,16 @@ bool TForm::parse_join(TScanner& scanner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TPrint_section& TForm::page2pos(const TArray& s, word p) const
|
TPrint_section& TForm::section(char s, word p)
|
||||||
{
|
{
|
||||||
pagetype pos = odd_page;
|
pagetype pos = odd_page;
|
||||||
if (p == 0 && s.objptr(last_page)) pos = last_page;
|
if (p == 0 && exist(s, last_page)) pos = last_page;
|
||||||
if (p == 1 && s.objptr(first_page)) pos = first_page;
|
if (p == 1 && exist(s, first_page)) pos = first_page;
|
||||||
if (pos == 0 && (p & 0x1) == 0 && s.objptr(even_page)) pos = even_page;
|
if (pos == 0 && (p & 0x1) == 0 && exist(s, even_page)) pos = even_page;
|
||||||
return (TPrint_section&)s[pos];
|
|
||||||
|
TPrint_section* sec = exist(s, pos);
|
||||||
|
CHECKD(sec, "Can't find section for page ", p);
|
||||||
|
return *sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
word TForm::set_header(word p, bool u)
|
word TForm::set_header(word p, bool u)
|
||||||
@ -1034,10 +1063,14 @@ word TForm::set_header(word p, bool u)
|
|||||||
TPrinter& printer = main_app().printer();
|
TPrinter& printer = main_app().printer();
|
||||||
printer.resetheader();
|
printer.resetheader();
|
||||||
|
|
||||||
TPrint_section& head = page2pos(_head, p);
|
TPrint_section& head = section('H', p);
|
||||||
|
|
||||||
if (u) head.update();
|
if (u) head.update();
|
||||||
else head.reset();
|
else
|
||||||
|
{
|
||||||
|
head.reset();
|
||||||
|
printer.headerlen(head.height());
|
||||||
|
}
|
||||||
|
|
||||||
for (word j = 0; j < head.height(); j++)
|
for (word j = 0; j < head.height(); j++)
|
||||||
printer.setheaderline(j, head.row(j));
|
printer.setheaderline(j, head.row(j));
|
||||||
@ -1047,7 +1080,7 @@ word TForm::set_header(word p, bool u)
|
|||||||
|
|
||||||
word TForm::set_body(word p, bool u)
|
word TForm::set_body(word p, bool u)
|
||||||
{
|
{
|
||||||
TPrint_section& body = page2pos(_body, p);
|
TPrint_section& body = section('B', p);
|
||||||
|
|
||||||
if (u) body.update();
|
if (u) body.update();
|
||||||
else body.reset();
|
else body.reset();
|
||||||
@ -1067,10 +1100,14 @@ word TForm::set_footer(word p, bool u)
|
|||||||
TPrinter& printer = main_app().printer();
|
TPrinter& printer = main_app().printer();
|
||||||
printer.resetfooter();
|
printer.resetfooter();
|
||||||
|
|
||||||
TPrint_section& foot = page2pos(_foot, p);
|
TPrint_section& foot = section('F', p);
|
||||||
|
|
||||||
if (u) foot.update();
|
if (u) foot.update();
|
||||||
else foot.reset();
|
else
|
||||||
|
{
|
||||||
|
foot.reset();
|
||||||
|
printer.footerlen(foot.height());
|
||||||
|
}
|
||||||
|
|
||||||
for (word j = 0; j < foot.height(); j++)
|
for (word j = 0; j < foot.height(); j++)
|
||||||
printer.setfooterline(j, foot.row(j));
|
printer.setfooterline(j, foot.row(j));
|
||||||
@ -1110,13 +1147,13 @@ long TForm::records() const
|
|||||||
|
|
||||||
bool TForm::print(long from, long to)
|
bool TForm::print(long from, long to)
|
||||||
{
|
{
|
||||||
CHECK(form == NULL, "Can't print two forms");
|
_form = this; // setta il form corrente
|
||||||
_form = this;
|
|
||||||
_lastpage = FALSE;
|
_lastpage = FALSE;
|
||||||
|
|
||||||
TPrinter& printer = main_app().printer();
|
TPrinter& printer = main_app().printer();
|
||||||
printer.setheaderhandler(header_handler);
|
printer.setheaderhandler(header_handler);
|
||||||
printer.setfooterhandler(footer_handler);
|
printer.setfooterhandler(footer_handler);
|
||||||
|
printer.formlen(height());
|
||||||
|
|
||||||
const bool was_open = printer.isopen();
|
const bool was_open = printer.isopen();
|
||||||
|
|
||||||
@ -1141,7 +1178,7 @@ bool TForm::print(long from, long to)
|
|||||||
|
|
||||||
if (i > records())
|
if (i > records())
|
||||||
{
|
{
|
||||||
if (_head.objptr(last_page) || _body.objptr(last_page) || _foot.objptr(last_page))
|
if (exist('H', last_page) || exist('B', last_page) || exist('F', last_page))
|
||||||
{
|
{
|
||||||
_lastpage = TRUE;
|
_lastpage = TRUE;
|
||||||
set_header(0, TRUE);
|
set_header(0, TRUE);
|
||||||
@ -1153,18 +1190,23 @@ bool TForm::print(long from, long to)
|
|||||||
if (!was_open)
|
if (!was_open)
|
||||||
printer.close();
|
printer.close();
|
||||||
|
|
||||||
_form = NULL;
|
_form = NULL; // resetta form
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TForm::print_section(ostream& out, const TArray& s, const char* name) const
|
void TForm::print_section(ostream& out, char s) const
|
||||||
{
|
{
|
||||||
for (pagetype t = odd_page; t <= last_page; t = pagetype(t+1)) if (s.objptr(t))
|
for (pagetype t = odd_page; t <= last_page; t = pagetype(t+1))
|
||||||
{
|
{
|
||||||
|
const TPrint_section* sec = ((TForm*)this)->exist(s, t);
|
||||||
|
if (sec)
|
||||||
|
{
|
||||||
|
const char* name = s == 'H' ? "HEADER" : (s == 'F' ? "FOOTER" : "BODY");
|
||||||
out << "SECTION " << name << ' ' << int(t);
|
out << "SECTION " << name << ' ' << int(t);
|
||||||
out << s[t];
|
out << *sec;
|
||||||
out << "END\n" << endl;
|
out << "END\n" << endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TForm::print_on(ostream& out) const
|
void TForm::print_on(ostream& out) const
|
||||||
@ -1172,14 +1214,15 @@ void TForm::print_on(ostream& out) const
|
|||||||
if (relation())
|
if (relation())
|
||||||
out << *relation() << endl;
|
out << *relation() << endl;
|
||||||
|
|
||||||
print_section(out, _head, "HEADER");
|
print_section(out, 'H');
|
||||||
print_section(out, _body, "BODY");
|
print_section(out, 'B');
|
||||||
print_section(out, _foot, "FOOTER");
|
print_section(out, 'F');
|
||||||
|
|
||||||
out << "END" << endl;
|
out << "END" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPrint_section& TForm::section(char s, pagetype t)
|
|
||||||
|
TPrint_section* TForm::exist(char s, pagetype t, bool create)
|
||||||
{
|
{
|
||||||
TArray* a = NULL;
|
TArray* a = NULL;
|
||||||
switch (s)
|
switch (s)
|
||||||
@ -1193,33 +1236,29 @@ TPrint_section& TForm::section(char s, pagetype t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TPrint_section* sec = (TPrint_section*)a->objptr(t);
|
TPrint_section* sec = (TPrint_section*)a->objptr(t);
|
||||||
if (sec == NULL) a->add(sec = new TPrint_section(this));
|
if (sec == NULL && create)
|
||||||
return (TPrint_section&)*sec;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TForm::edit(char s, pagetype t)
|
|
||||||
{
|
|
||||||
bool dirty = FALSE;
|
|
||||||
|
|
||||||
section(s, t).edit();
|
|
||||||
|
|
||||||
if (dirty && yesno_box("Salvare le modifiche?"))
|
|
||||||
{
|
{
|
||||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
sec = new TPrint_section(this);
|
||||||
TFilename bak(_name); bak.ext("bak");
|
a->add(sec, t);
|
||||||
rename(_name, bak);
|
|
||||||
ofstream out(_name);
|
|
||||||
print_on(out);
|
|
||||||
set_cursor(TASK_WIN, CURSOR_ARROW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dirty;
|
return sec;
|
||||||
|
}
|
||||||
|
|
||||||
|
word TForm::height()
|
||||||
|
{
|
||||||
|
word h = 0;
|
||||||
|
if (_head.items())
|
||||||
|
h += section('H', 1).height();
|
||||||
|
if (_body.items())
|
||||||
|
h += section('B', 1).height();
|
||||||
|
if (_foot.items())
|
||||||
|
h += section('F', 1).height();
|
||||||
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TForm::TForm(const char* name)
|
TForm::TForm(const char* name) : _name(name), _relation(NULL), _cursor(NULL)
|
||||||
: _name(name), _relation(NULL), _cursor(NULL)
|
|
||||||
{
|
{
|
||||||
const CURSOR oldcur = get_cursor(TASK_WIN);
|
const CURSOR oldcur = get_cursor(TASK_WIN);
|
||||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||||
@ -1234,14 +1273,16 @@ TForm::TForm(const char* name)
|
|||||||
while (ok && scanner.popkey() == "JO")
|
while (ok && scanner.popkey() == "JO")
|
||||||
ok = parse_join(scanner);
|
ok = parse_join(scanner);
|
||||||
}
|
}
|
||||||
scanner.push();
|
|
||||||
|
|
||||||
while (scanner.popkey() != "" && ok)
|
while (ok)
|
||||||
{
|
{
|
||||||
const char sec = scanner.key()[0];
|
scanner.popkey();
|
||||||
|
const char sec = toupper(scanner.key()[0]);
|
||||||
|
if (sec <= ' ' || sec == 'E')
|
||||||
|
break;
|
||||||
const pagetype p = (pagetype)scanner.integer();
|
const pagetype p = (pagetype)scanner.integer();
|
||||||
TPrint_section& ps = section(sec, p);
|
TPrint_section* ps = exist(sec, p, TRUE);
|
||||||
ok = ps.parse(scanner);
|
ok = ps->parse(scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_cursor(TASK_WIN, oldcur);
|
set_cursor(TASK_WIN, oldcur);
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
#include <scanner.h>
|
#include <scanner.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __MASK_H
|
||||||
|
class TMask;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __RELATION_H
|
#ifndef __RELATION_H
|
||||||
class TRelation;
|
class TRelation;
|
||||||
class TCursor;
|
class TCursor;
|
||||||
@ -21,11 +25,15 @@ class TForm_item;
|
|||||||
|
|
||||||
class TPrint_section : public TArray
|
class TPrint_section : public TArray
|
||||||
{
|
{
|
||||||
|
static TMask* _msk;
|
||||||
|
|
||||||
word _height; // Altezza della sezione
|
word _height; // Altezza della sezione
|
||||||
|
|
||||||
TForm* _form; // Form cui appartiene alla sezione
|
TForm* _form; // Form cui appartiene alla sezione
|
||||||
TArray _item; // Lista dei campi da stampare
|
TArray _item; // Lista dei campi da stampare
|
||||||
|
|
||||||
|
const TPrint_section& copy(const TPrint_section& ps);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
TForm_item* parse_item(const TString& key);
|
TForm_item* parse_item(const TString& key);
|
||||||
@ -43,15 +51,19 @@ public:
|
|||||||
bool update();
|
bool update();
|
||||||
bool parse(TScanner& scanner);
|
bool parse(TScanner& scanner);
|
||||||
|
|
||||||
bool edit();
|
bool edit(const char* title);
|
||||||
|
|
||||||
|
const TPrint_section& operator=(const TPrint_section& ps) { return copy(ps); }
|
||||||
TPrint_section(TForm* parent);
|
TPrint_section(TForm* parent);
|
||||||
virtual ~TPrint_section() {}
|
TPrint_section(const TPrint_section& ps) { copy(ps); }
|
||||||
|
virtual ~TPrint_section();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TForm : public TObject
|
class TForm : public TObject
|
||||||
{
|
{
|
||||||
|
friend class TForm_editor;
|
||||||
|
|
||||||
TFilename _name; // Profile name
|
TFilename _name; // Profile name
|
||||||
|
|
||||||
TRelation* _relation; // Can be NULL
|
TRelation* _relation; // Can be NULL
|
||||||
@ -61,18 +73,21 @@ class TForm : public TObject
|
|||||||
TArray _body; // Bodies
|
TArray _body; // Bodies
|
||||||
TArray _foot; // Footers
|
TArray _foot; // Footers
|
||||||
|
|
||||||
bool _lastpage;
|
bool _lastpage; // I am about to print the last page
|
||||||
|
|
||||||
TPrint_section& page2pos(const TArray& a, word p) const;
|
TPrint_section* exist(char s, pagetype t, bool create = FALSE); // Can be NULL
|
||||||
|
|
||||||
static void header_handler(TPrinter& p);
|
static void header_handler(TPrinter& p);
|
||||||
static void footer_handler(TPrinter& p);
|
static void footer_handler(TPrinter& p);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TPrint_section& section(char s, pagetype t); // H = Header, B = Body, F = Footer
|
// H = Header, B = Body, F = Footer, R = Relation
|
||||||
|
TPrint_section& section(char s = 'B', word page = 1);
|
||||||
|
word height(); // Height of first page
|
||||||
|
|
||||||
void print_section(ostream& out, const TArray& s, const char* name) const;
|
void print_section(ostream& out, char s) const;
|
||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
|
bool edit_relation();
|
||||||
|
|
||||||
bool parse_use(TScanner&);
|
bool parse_use(TScanner&);
|
||||||
bool parse_join(TScanner&);
|
bool parse_join(TScanner&);
|
||||||
@ -87,13 +102,13 @@ protected:
|
|||||||
public:
|
public:
|
||||||
bool print(long from = 0L, long to = -1L);
|
bool print(long from = 0L, long to = -1L);
|
||||||
|
|
||||||
|
const TFilename& name() const { return _name; }
|
||||||
|
|
||||||
TRelation* relation() const { return _relation; }
|
TRelation* relation() const { return _relation; }
|
||||||
TCursor* cursor() const { return _cursor; }
|
TCursor* cursor() const { return _cursor; }
|
||||||
|
|
||||||
bool edit(char section, pagetype t);
|
|
||||||
|
|
||||||
TForm(const char* form);
|
TForm(const char* form);
|
||||||
~TForm();
|
virtual ~TForm();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NOT_LINKED(i,f) CHECKS(i != NULL, "Record senza tracciato: impossibile eseguire ", f)
|
#define NOT_LINKED(i,f) CHECKS(i != NULL, "Record senza tracciato: impossibile eseguire ", f)
|
||||||
#define NOT_OPEN(f) CHECKS(_isamfile != NULL, "File chiuso, impossibile eseguire ", f)
|
#define NOT_OPEN(f) CHECKS(_isamfile != NULL, "File chiuso: ", f)
|
||||||
|
|
||||||
HIDDEN void UNKNOWN_FIELD(int num, const char* name)
|
HIDDEN void UNKNOWN_FIELD(int num, const char* name)
|
||||||
{ yesnofatal_box("Il campo '%s' non appartiene al file %d", name, num); }
|
{ yesnofatal_box("Il campo '%s' non appartiene al file %d", name, num); }
|
||||||
@ -38,7 +38,6 @@ HIDDEN void UNKNOWN_FIELD(int num, const char* name)
|
|||||||
HIDDEN bool __autoload = TRUE;
|
HIDDEN bool __autoload = TRUE;
|
||||||
|
|
||||||
void set_autoload_new_files(bool on)
|
void set_autoload_new_files(bool on)
|
||||||
|
|
||||||
{
|
{
|
||||||
__autoload = on;
|
__autoload = on;
|
||||||
}
|
}
|
||||||
@ -193,13 +192,23 @@ const char* TBaseisamfile::name() const
|
|||||||
|
|
||||||
const char* TBaseisamfile::filename() const
|
const char* TBaseisamfile::filename() const
|
||||||
{
|
{
|
||||||
NOT_OPEN(name());
|
if (_isamfile == NULL)
|
||||||
|
{
|
||||||
|
TDir d;
|
||||||
|
d.get(num());
|
||||||
|
return strcpy(__tmp_string, d.name());
|
||||||
|
}
|
||||||
return _isamfile->d->SysName;
|
return _isamfile->d->SysName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TBaseisamfile::description() const
|
const char* TBaseisamfile::description() const
|
||||||
{
|
{
|
||||||
NOT_OPEN(name());
|
if (_isamfile == NULL)
|
||||||
|
{
|
||||||
|
TDir d;
|
||||||
|
d.get(num());
|
||||||
|
return strcpy(__tmp_string, d.des());
|
||||||
|
}
|
||||||
return _isamfile->d->Des;
|
return _isamfile->d->Des;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#ifndef __ISAM_H
|
#ifndef __ISAM_H
|
||||||
#define __ISAM_H
|
#define __ISAM_H
|
||||||
|
|
||||||
#ifndef __ARRAY_H
|
|
||||||
#include <array.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __SYSFLD_H
|
#ifndef __SYSFLD_H
|
||||||
#include <sysfld.h>
|
#include <sysfld.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: maskfld.cpp,v 1.63 1994-12-20 15:11:11 guy Exp $
|
// $Id: maskfld.cpp,v 1.64 1994-12-27 14:58:54 guy Exp $
|
||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
@ -6,6 +6,7 @@
|
|||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
|
#include <prefix.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
@ -38,6 +39,7 @@ TMask_field::TField_Flags::TField_Flags()
|
|||||||
roman = exchange = FALSE;
|
roman = exchange = FALSE;
|
||||||
firm = ghost = FALSE;
|
firm = ghost = FALSE;
|
||||||
password = FALSE;
|
password = FALSE;
|
||||||
|
trim = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
@ -47,6 +49,9 @@ char TMask_field::TField_Flags::update(const char* s)
|
|||||||
for (; *s; s++)
|
for (; *s; s++)
|
||||||
switch(toupper(*s))
|
switch(toupper(*s))
|
||||||
{
|
{
|
||||||
|
case ' ':
|
||||||
|
case '_':
|
||||||
|
trim = FALSE; break;
|
||||||
case '*':
|
case '*':
|
||||||
password = TRUE; break;
|
password = TRUE; break;
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -471,7 +476,8 @@ TString& TMask_field::get() const
|
|||||||
else
|
else
|
||||||
gpark = get_field_data();
|
gpark = get_field_data();
|
||||||
|
|
||||||
return gpark.trim();
|
if (_flags.trim) gpark.trim();
|
||||||
|
return gpark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -575,7 +581,7 @@ bool TMask_field::do_message(int num)
|
|||||||
KEY key = 0;
|
KEY key = 0;
|
||||||
msg = m;
|
msg = m;
|
||||||
value = msg.get();
|
value = msg.get();
|
||||||
value.trim();
|
// value.trim(); // TBR
|
||||||
const char* dlg = msg.get();
|
const char* dlg = msg.get();
|
||||||
|
|
||||||
int cmd = -1;
|
int cmd = -1;
|
||||||
@ -748,8 +754,20 @@ bool TMask_field::on_key(KEY key)
|
|||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (fexist("prassi.hlp"))
|
if (fexist("prassi.hlp"))
|
||||||
{
|
{
|
||||||
|
struct MULTIGUY
|
||||||
|
{
|
||||||
|
UINT mkSize;
|
||||||
|
BYTE mkKeylist;
|
||||||
|
char mkKeyphrase[16];
|
||||||
|
} mk;
|
||||||
|
|
||||||
|
TFilename topic(mask().source_file()); topic.ext("");
|
||||||
|
mk.mkSize = sizeof(MULTIGUY);
|
||||||
|
mk.mkKeylist = 'M';
|
||||||
|
strcpy(mk.mkKeyphrase, topic);
|
||||||
|
|
||||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||||
WinHelp(hwnd, "prassi.hlp", HELP_KEY, (DWORD)(const char*)mask().source_file());
|
WinHelp(hwnd, "prassi.hlp", HELP_MULTIKEY, (DWORD)&mk);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (_help.not_empty())
|
if (_help.not_empty())
|
||||||
@ -1435,29 +1453,8 @@ KEY TBrowse::run()
|
|||||||
do_input(TRUE);
|
do_input(TRUE);
|
||||||
_cursor->read(_isgteq);
|
_cursor->read(_isgteq);
|
||||||
|
|
||||||
TString80 caption;
|
|
||||||
const TLocalisamfile& f = _cursor->file();
|
const TLocalisamfile& f = _cursor->file();
|
||||||
if (f.tab())
|
TString80 caption(prefhndl->description(f.name()));
|
||||||
{
|
|
||||||
TFilename name("batb");
|
|
||||||
name << _cursor->file().name() << ".msk";
|
|
||||||
if (fexist(name.lower()))
|
|
||||||
{
|
|
||||||
TScanner m(name);
|
|
||||||
while (m.line().left(2) != "PA"); // Find PAGE
|
|
||||||
const int apicia = m.token().find('"')+1;
|
|
||||||
const int apicic = m.token().find('"', apicia);
|
|
||||||
caption = m.token().sub(apicia, apicic);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
caption = name.mid(4);
|
|
||||||
caption.cut(caption.find('.'));
|
|
||||||
caption.insert("Tabella ", 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
caption = f.description();
|
|
||||||
if (!isalnum(caption[0]))
|
if (!isalnum(caption[0]))
|
||||||
caption = "Selezione";
|
caption = "Selezione";
|
||||||
|
|
||||||
@ -1900,7 +1897,7 @@ const char* TEdit_field::get_field_data() const
|
|||||||
const char* TEdit_field::format(const char* d)
|
const char* TEdit_field::format(const char* d)
|
||||||
{
|
{
|
||||||
fpark = d;
|
fpark = d;
|
||||||
fpark.trim();
|
if (_flags.trim) fpark.trim();
|
||||||
|
|
||||||
if (fpark.not_empty())
|
if (fpark.not_empty())
|
||||||
{
|
{
|
||||||
@ -1944,7 +1941,8 @@ const char* TEdit_field::picture_data(const char* data, bool video)
|
|||||||
|
|
||||||
set_window_data(data);
|
set_window_data(data);
|
||||||
TMask_field::get_window_data();
|
TMask_field::get_window_data();
|
||||||
fpark.trim();
|
|
||||||
|
if (_flags.trim) fpark.trim();
|
||||||
return fpark;
|
return fpark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2245,6 +2243,12 @@ void TButton_field::parse_head(TScanner& scanner)
|
|||||||
|
|
||||||
bool TButton_field::parse_item(TScanner& scanner)
|
bool TButton_field::parse_item(TScanner& scanner)
|
||||||
{
|
{
|
||||||
|
if (scanner.key() == "PI")
|
||||||
|
{
|
||||||
|
const int bmp = scanner.integer();
|
||||||
|
_prompt << '#' << bmp;
|
||||||
|
return bmp > 0;
|
||||||
|
}
|
||||||
return TMask_field::parse_item(scanner);
|
return TMask_field::parse_item(scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2267,6 +2271,8 @@ void TButton_field::create(WINDOW parent)
|
|||||||
_virtual_key = _exit_key = K_ESC;
|
_virtual_key = _exit_key = K_ESC;
|
||||||
break;
|
break;
|
||||||
case DLG_DELREC:
|
case DLG_DELREC:
|
||||||
|
if (_prompt.empty())
|
||||||
|
_prompt = "Elimina";
|
||||||
_virtual_key = 'E';
|
_virtual_key = 'E';
|
||||||
_exit_key = K_DEL;
|
_exit_key = K_DEL;
|
||||||
break;
|
break;
|
||||||
@ -2301,8 +2307,9 @@ void TButton_field::create(WINDOW parent)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if XWTWS == WMWS
|
#if XWTWS == WMWS
|
||||||
|
const int diesis = _prompt.find('#');
|
||||||
|
if (diesis > 0) _prompt.cut(diesis);
|
||||||
_prompt.center_just(_width);
|
_prompt.center_just(_width);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
/* $Id: maskfld.h,v 1.15 1994-12-15 18:06:30 guy Exp $ */
|
/* $Id: maskfld.h,v 1.16 1994-12-27 14:58:59 guy Exp $ */
|
||||||
#ifndef __MASKFLD_H
|
#ifndef __MASKFLD_H
|
||||||
#define __MASKFLD_H
|
#define __MASKFLD_H
|
||||||
|
|
||||||
#ifndef __ARRAY_H
|
|
||||||
#include <array.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __REAL_H
|
#ifndef __REAL_H
|
||||||
#include <real.h>
|
#include <real.h>
|
||||||
#endif
|
#endif
|
||||||
@ -76,6 +72,7 @@ protected:
|
|||||||
bool roman : 1; // Is a Roman number ?
|
bool roman : 1; // Is a Roman number ?
|
||||||
bool shown : 1; // Is visible
|
bool shown : 1; // Is visible
|
||||||
bool show_default : 1;
|
bool show_default : 1;
|
||||||
|
bool trim : 1; // Trim the string
|
||||||
bool uppercase : 1;
|
bool uppercase : 1;
|
||||||
bool exchange : 1; // Value exchange
|
bool exchange : 1; // Value exchange
|
||||||
bool zerofilled : 1;
|
bool zerofilled : 1;
|
||||||
|
@ -20,15 +20,13 @@ extern "C"
|
|||||||
// TSpreadsheet
|
// TSpreadsheet
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define K_PLUS '+'
|
|
||||||
|
|
||||||
class TSpreadsheet : public TWindow
|
class TSpreadsheet : public TWindow
|
||||||
{
|
{
|
||||||
friend class TSheet_field;
|
friend class TSheet_field;
|
||||||
|
|
||||||
enum { ITF_CID = 0, LIST_CID = 1 };
|
enum { ITF_CID = 0, LIST_CID = 1 };
|
||||||
|
|
||||||
TArray _str; // Array di TToken_strings
|
TString_array _str; // Array di TToken_strings
|
||||||
TBit_array _column_disabled;
|
TBit_array _column_disabled;
|
||||||
TArray _disabled; // Array di TBit_array
|
TArray _disabled; // Array di TBit_array
|
||||||
|
|
||||||
@ -70,11 +68,12 @@ protected:
|
|||||||
public:
|
public:
|
||||||
void update(int row);
|
void update(int row);
|
||||||
|
|
||||||
TToken_string& row(int n);
|
TToken_string& row(int n) { return _str.row(n); }
|
||||||
TArray& rows_array() const { return (TArray&)_str; }
|
int add(const TToken_string& s) { return _str.add(s); }
|
||||||
int add(TToken_string&);
|
int add(TToken_string* s) { return _str.add(s); }
|
||||||
int insert(int rec);
|
int insert(int rec);
|
||||||
bool destroy(int rec = -1);
|
bool destroy(int rec = -1);
|
||||||
|
TString_array& rows_array() { return _str; }
|
||||||
|
|
||||||
void set_focus_cell(int riga, int colonna);
|
void set_focus_cell(int riga, int colonna);
|
||||||
void activate(bool on);
|
void activate(bool on);
|
||||||
@ -381,7 +380,7 @@ int TSpreadsheet::insert(int rec)
|
|||||||
const bool ok = notify(rec, K_INS);
|
const bool ok = notify(rec, K_INS);
|
||||||
if (!ok) return -1;
|
if (!ok) return -1;
|
||||||
|
|
||||||
TToken_string s; // Empty row
|
TToken_string s(80); // Empty row
|
||||||
const int r = _str.insert(s, rec);
|
const int r = _str.insert(s, rec);
|
||||||
_disabled.insert(NULL, rec);
|
_disabled.insert(NULL, rec);
|
||||||
|
|
||||||
@ -505,7 +504,7 @@ break;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
src = row(rec).get(col); // Set value for cell
|
src = row(rec).get(col); // Set value for cell
|
||||||
if (src && *src && (acqua == CLASS_REAL_FIELD || acqua == CLASS_DATE_FIELD))
|
if (src && *src && f->is_edit())
|
||||||
{
|
{
|
||||||
src = f->picture_data(src, FALSE); // Get formatted string
|
src = f->picture_data(src, FALSE); // Get formatted string
|
||||||
}
|
}
|
||||||
@ -525,11 +524,7 @@ break;
|
|||||||
if (src)
|
if (src)
|
||||||
{
|
{
|
||||||
strncpy(dst, src, len);
|
strncpy(dst, src, len);
|
||||||
if (isspace(*dst))
|
// if (isspace(*dst)) { TFixed_string d(dst); d.ltrim(); } TBR
|
||||||
{
|
|
||||||
TFixed_string d(dst);
|
|
||||||
d.ltrim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
@ -830,16 +825,6 @@ void TSpreadsheet::activate(bool on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TSpreadsheet::add(TToken_string& t)
|
|
||||||
{
|
|
||||||
return _str.add(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
TToken_string& TSpreadsheet::row(int n)
|
|
||||||
{
|
|
||||||
return (TToken_string&)_str[n];
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
@ -868,8 +853,6 @@ public:
|
|||||||
TSpreadsheet(short x, short y, short dx, short dy, const char* maskname, int maskno,
|
TSpreadsheet(short x, short y, short dx, short dy, const char* maskname, int maskno,
|
||||||
const char* head, WINDOW parent, TSheet_field * o);
|
const char* head, WINDOW parent, TSheet_field * o);
|
||||||
|
|
||||||
TArray& rows_array() const { return data(); }
|
|
||||||
|
|
||||||
TMask& sheet_mask() { return _mask; }
|
TMask& sheet_mask() { return _mask; }
|
||||||
TMask& mask() const;
|
TMask& mask() const;
|
||||||
|
|
||||||
@ -1218,12 +1201,12 @@ bool TSheet_field::parse_item(TScanner& scanner)
|
|||||||
void TSheet_field::create(WINDOW parent)
|
void TSheet_field::create(WINDOW parent)
|
||||||
{
|
{
|
||||||
const TMask& m = mask();
|
const TMask& m = mask();
|
||||||
_sheet = new TSpreadsheet(_x, _y, _width, _size, m.source_file(), m.sheets(),
|
_sheet = new TSpreadsheet(_x, _y, _width, _size, m.source_file(),
|
||||||
_head, parent, this);
|
m.sheets(), _head, parent, this);
|
||||||
|
|
||||||
_win = _sheet->win();
|
_win = _sheet->win();
|
||||||
enable_window(_win, enabled());
|
|
||||||
show_window(_win, shown());
|
show_window(_win, shown());
|
||||||
|
if (!enabled()) disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1252,7 +1235,7 @@ TToken_string& TSheet_field::row(int n)
|
|||||||
if (n < 0 || n >= max)
|
if (n < 0 || n >= max)
|
||||||
{
|
{
|
||||||
if (n < 0) n = first_empty();
|
if (n < 0) n = first_empty();
|
||||||
if (n >= max) n = _sheet->add(TToken_string(80));
|
if (n >= max) n = _sheet->add(new TToken_string(80));
|
||||||
}
|
}
|
||||||
return _sheet->row(n);
|
return _sheet->row(n);
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
#define VERSION 1.1
|
#define VERSION 1.2
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <array.h>
|
|
||||||
#include <extcdecl.h>
|
#include <extcdecl.h>
|
||||||
|
#include <isam.h>
|
||||||
#include <scanner.h>
|
#include <scanner.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
HIDDEN const char* const glockname = "xx";
|
HIDDEN const char* const glockname = "xx";
|
||||||
|
|
||||||
TPrefix::TPrefix()
|
TPrefix::TPrefix() : _filelevel(0), _items(0)
|
||||||
{
|
{
|
||||||
CHECK(prefhndl == NULL, "Can't create two prefix objects");
|
CHECK(prefhndl == NULL, "Can't create two prefix objects");
|
||||||
|
|
||||||
@ -177,6 +177,7 @@ void TPrefix::set(const char* name, bool force, TFilelock mode)
|
|||||||
|
|
||||||
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
||||||
_filelevel = d.Flags;
|
_filelevel = d.Flags;
|
||||||
|
_items = (int)d.EOD;
|
||||||
openall(FALSE, excl, max, comfiles);
|
openall(FALSE, excl, max, comfiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,6 +248,49 @@ bool TPrefix::set_codditta(long codditta, bool force)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char* TPrefix::description(const char* cod) const
|
||||||
|
{
|
||||||
|
TString80 n(cod);
|
||||||
|
|
||||||
|
if (n[0] == '%')
|
||||||
|
n.ltrim(1);
|
||||||
|
|
||||||
|
const int logicnum = atoi(n);
|
||||||
|
if (logicnum == 0)
|
||||||
|
{
|
||||||
|
TFilename name("batb");
|
||||||
|
name << n << ".msk";
|
||||||
|
if (fexist(name.lower()))
|
||||||
|
{
|
||||||
|
TScanner m(name);
|
||||||
|
while (m.line().left(2) != "PA"); // Find PAGE
|
||||||
|
const int apicia = m.token().find('"')+1;
|
||||||
|
const int apicic = m.token().find('"', apicia);
|
||||||
|
n = m.token().sub(apicia, apicic);
|
||||||
|
}
|
||||||
|
else n.cut(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logicnum > 0 && logicnum < items())
|
||||||
|
{
|
||||||
|
const TBaseisamfile f(logicnum);
|
||||||
|
n = f.description();
|
||||||
|
}
|
||||||
|
else n.cut(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return strcpy(__tmp_string, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* TPrefix::description(int cod) const
|
||||||
|
{
|
||||||
|
TString16 n; n << cod;
|
||||||
|
return description(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Restituisce il nome di una directory dati
|
// Restituisce il nome di una directory dati
|
||||||
// Certified 90%
|
// Certified 90%
|
||||||
const char* firm2dir(long codditta)
|
const char* firm2dir(long codditta)
|
||||||
|
@ -24,6 +24,8 @@ class TPrefix : public TObject
|
|||||||
int* _dirfl;
|
int* _dirfl;
|
||||||
int* _recfl;
|
int* _recfl;
|
||||||
long _filelevel;
|
long _filelevel;
|
||||||
|
int _items;
|
||||||
|
|
||||||
SecDef* _fdir;
|
SecDef* _fdir;
|
||||||
SecDef* _rdir;
|
SecDef* _rdir;
|
||||||
|
|
||||||
@ -40,6 +42,10 @@ public:
|
|||||||
const char* name() const { return _prefix;}
|
const char* name() const { return _prefix;}
|
||||||
long filelevel() const {return _filelevel;}
|
long filelevel() const {return _filelevel;}
|
||||||
|
|
||||||
|
int items() const { return _items; }
|
||||||
|
const char* description(const char* cod) const;
|
||||||
|
const char* description(int cod) const;
|
||||||
|
|
||||||
TPrefix();
|
TPrefix();
|
||||||
virtual ~TPrefix();
|
virtual ~TPrefix();
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: relapp.cpp,v 1.40 1994-12-16 15:50:08 guy Exp $
|
// $Id: relapp.cpp,v 1.41 1994-12-27 14:59:08 guy Exp $
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -467,7 +467,9 @@ bool TRelation_application::modify_mode()
|
|||||||
|
|
||||||
TMask_field* TRelation_application::get_search_field() const
|
TMask_field* TRelation_application::get_search_field() const
|
||||||
{
|
{
|
||||||
if (_search_id > 0) return &_mask->field(_search_id);
|
if (_search_id > 0)
|
||||||
|
return &_mask->field(_search_id);
|
||||||
|
|
||||||
const TChiave& k = _maskeys->key(1);
|
const TChiave& k = _maskeys->key(1);
|
||||||
for (int i = 0; i < k.items(); i++)
|
for (int i = 0; i < k.items(); i++)
|
||||||
{
|
{
|
||||||
@ -624,6 +626,7 @@ bool TRelation_application::save(bool check_dirty)
|
|||||||
if (mode == MODE_INS)
|
if (mode == MODE_INS)
|
||||||
{
|
{
|
||||||
bool changed = TRUE;
|
bool changed = TRUE;
|
||||||
|
|
||||||
while (changed)
|
while (changed)
|
||||||
{
|
{
|
||||||
get_relation()->zero();
|
get_relation()->zero();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: relation.cpp,v 1.27 1994-12-20 15:11:20 guy Exp $
|
// $Id: relation.cpp,v 1.28 1994-12-27 14:59:10 guy Exp $
|
||||||
// relation.cpp
|
// relation.cpp
|
||||||
// fv 12/8/93
|
// fv 12/8/93
|
||||||
// relation class for isam files
|
// relation class for isam files
|
||||||
@ -9,6 +9,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <expr.h>
|
#include <expr.h>
|
||||||
#include <extcdecl.h>
|
#include <extcdecl.h>
|
||||||
|
#include <prefix.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
@ -149,6 +150,7 @@ void TRelationdef::print_on(TToken_string& out) const
|
|||||||
|
|
||||||
out = "";
|
out = "";
|
||||||
print_name(out, f);
|
print_name(out, f);
|
||||||
|
out.add(prefhndl->description(f.name()));
|
||||||
out << '|';
|
out << '|';
|
||||||
|
|
||||||
if (_numto > 0)
|
if (_numto > 0)
|
||||||
@ -161,7 +163,8 @@ void TRelationdef::print_on(TToken_string& out) const
|
|||||||
const TLocalisamfile& t = _rel->file(_numto);
|
const TLocalisamfile& t = _rel->file(_numto);
|
||||||
print_name(out, t);
|
print_name(out, t);
|
||||||
}
|
}
|
||||||
}
|
} else out << ' ';
|
||||||
|
|
||||||
out.add(_key);
|
out.add(_key);
|
||||||
out.add(_alias);
|
out.add(_alias);
|
||||||
out << '|';
|
out << '|';
|
||||||
@ -213,14 +216,16 @@ void TRelation::print_on(TArray& a) const
|
|||||||
const TLocalisamfile& f = file();
|
const TLocalisamfile& f = file();
|
||||||
TToken_string s(128);
|
TToken_string s(128);
|
||||||
print_name(s, f);
|
print_name(s, f);
|
||||||
|
s.add(prefhndl->description(f.name()));
|
||||||
|
s.add("");
|
||||||
s.add(f.getkey());
|
s.add(f.getkey());
|
||||||
|
s.add(" | ");
|
||||||
a.destroy();
|
a.destroy();
|
||||||
a.add(s, 0);
|
a.add(s);
|
||||||
for (int i = 0; i < _reldefs.items(); i++)
|
for (int i = 0; i < _reldefs.items(); i++)
|
||||||
{
|
{
|
||||||
((TRelationdef&)_reldefs[i]).print_on(s);
|
((TRelationdef&)_reldefs[i]).print_on(s);
|
||||||
a.add(s, i+1);
|
a.add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TSheet
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TSheet::TSheet(short x, short y, short dx, short dy,
|
TSheet::TSheet(short x, short y, short dx, short dy,
|
||||||
const char* title, const char* head, byte buttons,
|
const char* title, const char* head, byte buttons,
|
||||||
long first, WINDOW parent)
|
long first, WINDOW parent)
|
||||||
@ -146,13 +150,10 @@ void TSheet::set_first(long n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TSheet::set_row(const TToken_string& row, byte i)
|
void TSheet::set_row(const TToken_string& r, byte i)
|
||||||
{
|
{
|
||||||
if (i > 64) i = 0; else i++;
|
if (i > 64) i = 0; else i++;
|
||||||
if (_page.objptr(i) == NULL)
|
_page.add(r, i);
|
||||||
_page.add(row, i);
|
|
||||||
else
|
|
||||||
((TToken_string&)_page[i]) = row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,6 +271,8 @@ bool TSheet::on_key(KEY key)
|
|||||||
{
|
{
|
||||||
case K_ENTER:
|
case K_ENTER:
|
||||||
if (items() < 1) key = K_ESC;
|
if (items() < 1) key = K_ESC;
|
||||||
|
if (_disabled[selected()])
|
||||||
|
break;
|
||||||
case K_ESC:
|
case K_ESC:
|
||||||
stop_run(key);
|
stop_run(key);
|
||||||
case K_DEL:
|
case K_DEL:
|
||||||
@ -317,8 +320,11 @@ bool TSheet::on_key(KEY key)
|
|||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case K_SPACE:
|
case K_SPACE:
|
||||||
|
if (!_disabled[selected()])
|
||||||
|
{
|
||||||
_checked.not(selected());
|
_checked.not(selected());
|
||||||
force = TRUE;
|
force = TRUE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case K_F2:
|
case K_F2:
|
||||||
uncheck(-1);
|
uncheck(-1);
|
||||||
@ -337,6 +343,23 @@ bool TSheet::on_key(KEY key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TSheet::enable(long n, bool on)
|
||||||
|
{
|
||||||
|
if (n >= 0)
|
||||||
|
_disabled.set(n, !on);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (on)
|
||||||
|
_disabled.reset();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_disabled.set(items());
|
||||||
|
_disabled.set();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TSheet::select(long n)
|
void TSheet::select(long n)
|
||||||
{
|
{
|
||||||
if (n < 0) n = 0; else
|
if (n < 0) n = 0; else
|
||||||
@ -436,11 +459,15 @@ bool TSheet::update_row(long n)
|
|||||||
for (int j = 0; (s = t.get()) != NULL; x += _size[j++]+1)
|
for (int j = 0; (s = t.get()) != NULL; x += _size[j++]+1)
|
||||||
{
|
{
|
||||||
int x1 = x;
|
int x1 = x;
|
||||||
|
bool dis = FALSE;
|
||||||
if (n >= 0)
|
if (n >= 0)
|
||||||
{
|
{
|
||||||
if (_checkable && j == 0)
|
if (_checkable && j == 0)
|
||||||
s = _checked[n] ? "X" : " ";
|
s = _checked[n] ? "X" : " ";
|
||||||
|
|
||||||
|
dis = _disabled[n];
|
||||||
|
if (dis) set_color(COLOR_CYAN, COLOR_GRAY);
|
||||||
|
|
||||||
switch (_type[j])
|
switch (_type[j])
|
||||||
{
|
{
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -457,6 +484,7 @@ bool TSheet::update_row(long n)
|
|||||||
x1 += (_size[j]-strlen(s)) >> 1; // Centra le testate
|
x1 += (_size[j]-strlen(s)) >> 1; // Centra le testate
|
||||||
|
|
||||||
stringat(x1, y, s);
|
stringat(x1, y, s);
|
||||||
|
if (dis) set_color(COLOR_BLACK, COLOR_GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -578,7 +606,7 @@ long TArray_sheet::add(const TToken_string& s)
|
|||||||
|
|
||||||
long TArray_sheet::add(TToken_string* s)
|
long TArray_sheet::add(TToken_string* s)
|
||||||
{
|
{
|
||||||
const long n = _data.add(s, -1);
|
const long n = _data.add(s);
|
||||||
set_scroll_max(-1, n);
|
set_scroll_max(-1, n);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@ -721,7 +749,7 @@ void TBrowse_sheet::repos_buttons() const
|
|||||||
bool TBrowse_sheet::on_key(KEY k)
|
bool TBrowse_sheet::on_key(KEY k)
|
||||||
{
|
{
|
||||||
const WINDOW ctl = get_ctl_window(win(), 100);
|
const WINDOW ctl = get_ctl_window(win(), 100);
|
||||||
const bool alnum = k >= ' ' && k < 256;
|
const bool alnum = k >= ' ' && k < K_UP;
|
||||||
|
|
||||||
if (ctl != NULL_WIN && (alnum || k == K_BACKSPACE || k == K_DEL))
|
if (ctl != NULL_WIN && (alnum || k == K_BACKSPACE || k == K_DEL))
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#ifndef __SHEET_H
|
#ifndef __SHEET_H
|
||||||
#define __SHEET_H
|
#define __SHEET_H
|
||||||
|
|
||||||
#ifndef __ARRAY_H
|
|
||||||
#include <array.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
@ -21,6 +17,7 @@ class TCursor;
|
|||||||
class TEdit_field;
|
class TEdit_field;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
// class TSheet : public TScroll_window
|
// class TSheet : public TScroll_window
|
||||||
// @END
|
// @END
|
||||||
@ -29,7 +26,7 @@ class TSheet : public TScroll_window
|
|||||||
{
|
{
|
||||||
// @DPRIV
|
// @DPRIV
|
||||||
enum { MAX_BUT = 8, MAX_COL = 128 };
|
enum { MAX_BUT = 8, MAX_COL = 128 };
|
||||||
TArray _page;
|
TString_array _page;
|
||||||
|
|
||||||
byte _columns;
|
byte _columns;
|
||||||
byte _size[MAX_COL], _type[MAX_COL];
|
byte _size[MAX_COL], _type[MAX_COL];
|
||||||
@ -39,7 +36,7 @@ class TSheet : public TScroll_window
|
|||||||
|
|
||||||
bool _checkable;
|
bool _checkable;
|
||||||
bool _check_enabled;
|
bool _check_enabled;
|
||||||
TBit_array _checked;
|
TBit_array _checked, _disabled;
|
||||||
|
|
||||||
WINDOW _button[MAX_BUT];
|
WINDOW _button[MAX_BUT];
|
||||||
KEY _key[MAX_BUT];
|
KEY _key[MAX_BUT];
|
||||||
@ -95,20 +92,25 @@ public:
|
|||||||
void uncheck(long n) { check(n, FALSE); }
|
void uncheck(long n) { check(n, FALSE); }
|
||||||
void enable_check(bool yn = TRUE) { _check_enabled = yn; }
|
void enable_check(bool yn = TRUE) { _check_enabled = yn; }
|
||||||
void disable_check() { enable_check(FALSE); }
|
void disable_check() { enable_check(FALSE); }
|
||||||
|
|
||||||
|
void enable(long n = -1, bool on = TRUE);
|
||||||
|
void disable(long n = -1) { enable(n, FALSE); }
|
||||||
|
bool enabled(long n) const { return !_disabled[n]; }
|
||||||
|
bool disabled(long n) const { return _disabled[n]; }
|
||||||
|
|
||||||
bool one_checked() const { return _checked.first_one() != -1; }
|
bool one_checked() const { return _checked.first_one() != -1; }
|
||||||
long checked() const { return _checked.ones(); }
|
long checked() const { return _checked.ones(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TArray_sheet : public TSheet
|
class TArray_sheet : public TSheet
|
||||||
{
|
{
|
||||||
TArray _data;
|
TString_array _data;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void page_build(long first, byte num);
|
virtual void page_build(long first, byte num);
|
||||||
|
TToken_string& data(long n) { return _data.row((int)n); }
|
||||||
TArray& data() const { return (TArray&)_data; }
|
TString_array& rows_array() { return _data; }
|
||||||
TToken_string& data(long n) const { return (TToken_string&)_data[(int)n]; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TArray_sheet(short x, short y, short dx, short dy, const char* caption,
|
TArray_sheet(short x, short y, short dx, short dy, const char* caption,
|
||||||
|
@ -1012,3 +1012,24 @@ void TParagraph_string::tokenize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TString_array
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int TString_array::add(const char* s, int n)
|
||||||
|
{
|
||||||
|
if (objptr(n) == NULL)
|
||||||
|
n = TArray::add(new TToken_string(s), n);
|
||||||
|
else row(n) = s;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TString_array::add(const TToken_string& s, int n)
|
||||||
|
{
|
||||||
|
if (objptr(n) == NULL)
|
||||||
|
n = TArray::add(s);
|
||||||
|
else
|
||||||
|
row(n) = s;
|
||||||
|
return n;
|
||||||
|
}
|
@ -5,8 +5,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __OBJECT_H
|
#ifndef __ARRAY_H
|
||||||
#include <object.h>
|
#include <array.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
@ -284,6 +284,22 @@ public:
|
|||||||
void set_width(int width) { _width = width; }
|
void set_width(int width) { _width = width; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// @DES TString_array
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TString_array : public TArray
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TToken_string& row(int n) { return (TToken_string&)operator[](n); }
|
||||||
|
int add(TToken_string* s, int n = -1) { return TArray::add(s, n); }
|
||||||
|
int add(const TToken_string& s, int n = -1);
|
||||||
|
int add(const char* s, int n = -1);
|
||||||
|
|
||||||
|
TString_array(int size = 8) : TArray(size) {}
|
||||||
|
virtual ~TString_array() {}
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1832,7 +1832,7 @@ bool TViswin::call_editor ()
|
|||||||
newfilename.insert (" ", 0);
|
newfilename.insert (" ", 0);
|
||||||
newfilename.insert (editor, 0);
|
newfilename.insert (editor, 0);
|
||||||
TExternal_app edit (newfilename);
|
TExternal_app edit (newfilename);
|
||||||
if (edit.run(TRUE))
|
if (edit.run(TRUE, FALSE))
|
||||||
beep ();
|
beep ();
|
||||||
else
|
else
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
|
@ -99,6 +99,8 @@ HIDDEN COLORREF NormalForeColor = COLOR2RGB(NORMAL_COLOR);
|
|||||||
HIDDEN COLORREF NormalBackColor = COLOR2RGB(NORMAL_BACK_COLOR);
|
HIDDEN COLORREF NormalBackColor = COLOR2RGB(NORMAL_BACK_COLOR);
|
||||||
HIDDEN HBRUSH NormalBrush = CreateSolidBrush(NormalBackColor);
|
HIDDEN HBRUSH NormalBrush = CreateSolidBrush(NormalBackColor);
|
||||||
|
|
||||||
|
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
|
||||||
|
|
||||||
static BOOLEAN event_hook(HWND hwnd,
|
static BOOLEAN event_hook(HWND hwnd,
|
||||||
UINT msg,
|
UINT msg,
|
||||||
UINT wparam,
|
UINT wparam,
|
||||||
@ -200,6 +202,9 @@ static BOOLEAN event_hook(HWND hwnd,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (msg == WM_WAKEUP && wparam == main_app().waiting())
|
||||||
|
main_app().wake_up();
|
||||||
|
break;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,9 +398,8 @@ KEY e_char_to_key(const EVENT* ep)
|
|||||||
KEY key = ep->v.chr.ch;
|
KEY key = ep->v.chr.ch;
|
||||||
if (key < K_INS || key > K_HELP)
|
if (key < K_INS || key > K_HELP)
|
||||||
{
|
{
|
||||||
// if (ep->v.chr.shift && !isprint(key)) key += K_SHIFT;
|
if (ep->v.chr.shift && (key < ' ' || key >= K_UP)) key += K_SHIFT;
|
||||||
if (ep->v.chr.shift && (key < ' ' || key > 'z')) key += K_SHIFT;
|
if (ep->v.chr.control && key >= ' ') key += K_CTRL;
|
||||||
if (key >= ' ' && ep->v.chr.control) key += K_CTRL;
|
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
@ -543,9 +547,9 @@ void xvt_init_font()
|
|||||||
LogFont.lfWidth = (int)font.get_long("Width");
|
LogFont.lfWidth = (int)font.get_long("Width");
|
||||||
LogFont.lfWeight = FontWeight = (int)font.get_long("Weight");
|
LogFont.lfWeight = FontWeight = (int)font.get_long("Weight");
|
||||||
LogFont.lfCharSet = (int)font.get_long("CharSet");
|
LogFont.lfCharSet = (int)font.get_long("CharSet");
|
||||||
LogFont.lfClipPrecision = (int)font.get_long("Clip");
|
// LogFont.lfClipPrecision = (int)font.get_long("Clip");
|
||||||
LogFont.lfOutPrecision = (int)font.get_long("Precision");
|
// LogFont.lfOutPrecision = (int)font.get_long("Precision");
|
||||||
LogFont.lfQuality = (int)font.get_long("Quality");;
|
// LogFont.lfQuality = (int)font.get_long("Quality");;
|
||||||
LogFont.lfPitchAndFamily = (int)font.get_long("Pitch");
|
LogFont.lfPitchAndFamily = (int)font.get_long("Pitch");
|
||||||
strcpy(LogFont.lfFaceName, font.get("Name"));
|
strcpy(LogFont.lfFaceName, font.get("Name"));
|
||||||
}
|
}
|
||||||
@ -581,8 +585,6 @@ void xvt_set_font(WINDOW win, int family, int style, int dim)
|
|||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (dim < 1)
|
if (dim < 1)
|
||||||
{
|
{
|
||||||
// LogFont.lfWidth = CHARX - (style & FS_BOLD) ? 2 : 1;
|
|
||||||
// LogFont.lfHeight = CHARY - ((style & FS_BOLD) ? 4 : 2);
|
|
||||||
LogFont.lfWeight = FontWeight + ((style & FS_BOLD) ? 300 : 0);
|
LogFont.lfWeight = FontWeight + ((style & FS_BOLD) ? 300 : 0);
|
||||||
LogFont.lfItalic = (style & FS_ITALIC) ? TRUE : FALSE;
|
LogFont.lfItalic = (style & FS_ITALIC) ? TRUE : FALSE;
|
||||||
set_value(NULL_WIN, ATTR_WIN_PM_LOGFONT, (long)&LogFont);
|
set_value(NULL_WIN, ATTR_WIN_PM_LOGFONT, (long)&LogFont);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user