Gestita meglio la chiamata di programmi Windows in cascata

git-svn-id: svn://10.65.10.50/trunk@110 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-08-31 12:20:38 +00:00
parent 11cbb99740
commit 5e097d8630
9 changed files with 1542 additions and 1530 deletions

View File

@ -169,8 +169,9 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
void TApplication::about() const
{
#include <prassi.ver>
const TFilename n(__argv[0]);
message_box("PRASSI Versione %g\nProgramma %s\nLibreria del %s",
VERSION, (const char*)name(), __DATE__);
VERSION, (const char*)n.name(), __DATE__);
}

View File

@ -23,7 +23,7 @@
class TApplication
{
// @DPRIV
// @DPRIV
int _bar;
int __argc;
const char** __argv;
@ -43,13 +43,13 @@ protected:
void about() const;
public:
// @FPUB
// @FPUB
void setbar(int menubar) { _bar = menubar;} // Modifica la menu-bar
void run(int argc, char* argv[], const char* name);
// @DES Queste funzioni possono essere ridefinite da ogni applicazione
// @FPUB
// @DES Queste funzioni possono essere ridefinite da ogni applicazione
// @FPUB
virtual bool create(); // Crea la finestra principale
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
virtual bool destroy(); // Rimuove l'applicazione
@ -62,7 +62,7 @@ public:
void disable_menu_item(MENU_TAG item) { enable_menu_item(item, FALSE); }
void dispatch_e_menu(MENU_TAG item);
const char* name() const { return _name; }
const TString& name() const { return _name; }
const char** argv() const { return __argv; }
const char* argv(int i) const { return __argv[i]; }
int argc() const { return __argc; }

View File

@ -138,7 +138,7 @@ public:
TForm_item::TForm_item(TPrint_section* section)
: _section(section), _x(-1), _y(-1), _width(0), _heigth(0)
: _section(section), _x(-1), _y(-1), _width(0), _heigth(0)
{}
bool TForm_item::parse_head(TScanner& scanner)
@ -600,7 +600,7 @@ public:
TForm_date::TForm_date(TPrint_section* section)
: TForm_string(section)
: TForm_string(section)
{
if (automagic())
{
@ -639,7 +639,7 @@ public:
};
TForm_list::TForm_list(TPrint_section* section)
: TForm_string(section)
: TForm_string(section)
{}
bool TForm_list::parse_item(TScanner& scanner)
@ -736,9 +736,17 @@ bool TForm_list::update()
// TPrint_section
///////////////////////////////////////////////////////////
void TPrint_section::init(const char* name, TForm* f)
{
_name = name;
_form = f;
}
TPrint_section::TPrint_section(const char* name, TForm* f)
: _name(name), _heigth(0), _form(f)
{}
: _heigth(0)
{
init(name, f);
}
TPrintrow& TPrint_section::row(int num)
{
@ -1027,9 +1035,7 @@ bool TForm::edit(int mode, int section)
TForm::TForm(const char* name)
: _name(name),
_head("HEADER", this), _body("BODY", this), _foot("FOOTER", this)
TForm::TForm(const char* name) : _name(name)
{
_name.ext("frm");
TScanner scanner(_name);
@ -1044,6 +1050,10 @@ TForm::TForm(const char* name)
ok = parse_join(scanner);
scanner.push();
_head.init("HEADER", this);
_body.init("BODY", this);
_foot.init("FOOTER", this);
while (scanner.popkey() == "PA")
{
scanner.pop();

View File

@ -19,7 +19,7 @@ class TForm_item;
class TPrint_section : public TArray
{
TString _name;
TString16 _name;
int _heigth;
TForm* _form;
@ -41,7 +41,8 @@ public:
bool edit(int mode);
TPrint_section(const char* name, TForm* f);
TPrint_section(const char* name = "", TForm* form = NULL);
void init(const char* name, TForm* form);
};

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.9 1994-08-30 14:40:25 guy Exp $
// $Id: maskfld.cpp,v 1.10 1994-08-31 12:20:32 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -597,7 +597,7 @@ bool TMask_field::do_message(int num)
if (value != prev)
{
f.set(value);
if (f.showed())
if (f.showed() || f.ghost())
f.on_hit();
}
}
@ -1240,6 +1240,7 @@ bool TBrowse::do_insert()
{
app = _insert.mid(1);
#if XVT_OS == XVT_OS_WIN
if (strnicmp(app, MainApp()->name(), 3) == 0)
app.insert("a", 3);
#endif
}

View File

@ -28,7 +28,7 @@ class TSpreadsheet : public TWindow
int _columns;
bool _dirty;
XI_OBJ *_list;
XI_OBJ *_list, *_itf;
SPREADSHEET_NOTIFY _notify;
@ -217,8 +217,8 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
xi_create(NULL, itfdef);
xi_tree_free(itfdef);
XI_OBJ* itf = xi_get_itf(win);
_list = xi_get_obj(itf, LIST_CID);
_itf = xi_get_itf(win);
_list = xi_get_obj(_itf, LIST_CID);
}
@ -337,8 +337,6 @@ void TSpreadsheet::update(int row)
{
xi_cell_request(_list); // Force updatde
xi_scroll(_list, XI_SCROLL_FIRST);
XI_OBJ* itf = xi_get_itf(win()); // Remove focus
xi_move_focus(itf);
set_front_window(win()); // Seems necessary
}
else
@ -468,6 +466,7 @@ if (xiev->v.xi_obj->type == XIT_LIST)
}
break;
case XIE_ON_ROW:
if (_check_enabled)
{
const int rec = row2rec(xiev->v.xi_obj->v.row);
if (rec < items())
@ -505,6 +504,7 @@ break;
}
break;
case XIE_ON_CELL:
if (_check_enabled)
{
TMask_field* f = cell2field(xiev->v.xi_obj);
const int col = (f->dlg() - FIRST_FIELD) % 100;
@ -512,22 +512,15 @@ break;
{
_edit_field = f;
_cur_col = xiev->v.xi_obj->v.cell.column;
_check_enabled = FALSE;
xi_set_focus(_itf);
xi_set_color(xiev->v.xi_obj, XIC_BACK, FOCUS_BACK_COLOR);
xi_set_focus(xiev->v.xi_obj);
_check_enabled = TRUE;
}
else
{
xiev->refused = TRUE; // Refuse focus on disabled cells
/*
const int r = xiev->v.xi_obj->v.cell.row;
int c = xiev->v.xi_obj->v.cell.column;
c += cur_col > col ? -1 : +1;
if (c < 1) c = _columns-1; else
if (c >= _columns) c = 1;
XI_OBJ cell;
XI_MAKE_CELL(&cell, _list, r, c);
xi_move_focus(&cell);
*/
}
}
break;
@ -581,8 +574,7 @@ break;
case E_FOCUS:
if (ep->v.active == FALSE)
{
XI_OBJ* itf = xi_get_itf(win());
const bool ok = (bool)xi_move_focus(itf);
const bool ok = (bool)xi_move_focus(_itf);
if (!ok)
{
set_dirty(2);
@ -621,8 +613,7 @@ break;
case K_PREV:
case K_NEXT:
{
XI_OBJ* itf = xi_get_itf(win());
const bool ok = (bool)xi_move_focus(itf);
const bool ok = (bool)xi_move_focus(_itf);
if (ok) dispatch_e_char(parent(), k);
}
break;

View File

@ -713,6 +713,13 @@ const char* TToken_string::get(int n)
}
// Certified 99%
char TToken_string::get_char(int n)
{
const char* num = get(n);
return num ? *num : '\0';
}
// Certified 99%
int TToken_string::get_int(int n)
{

View File

@ -16,19 +16,19 @@
class TString : public TObject
{
protected:
// @DPROT
// @DPROT
char* _str; // Puntatore alla stringa
int _size; // Lunghezza
// @END
// @END
// @FPROT
// @FPROT
int make_room(int size); // Cerca spazio per altri size caratteri
TString& set(const char*); // Inizializza con la stringa puntata da char* di lunghezza size
TString(char* str, int size) : _str(str), _size(size) {}
public:
// @FPUB
// @FPUB
virtual void resize(int size, bool cpy); // Ri/alloca la stringa
TString();
@ -37,11 +37,11 @@ public:
TString(const TString& s); // Costruttore da un oggetto TString s
virtual ~TString(); // Deallocates the string
///////////////////////////////////////////////////////////
// @DES Methods derived from TObject
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// @DES Methods derived from TObject
///////////////////////////////////////////////////////////
// @FPUB
// @FPUB
virtual const char* class_name() const; // Ritorna il nome della classe
virtual word class_id() const; // Ritorna l'identificatore della classe
virtual bool ok() const { return _str != NULL; }
@ -50,11 +50,11 @@ public:
virtual void read_from(istream& in);
virtual word hash() const; // Return hash value
///////////////////////////////////////////////////////////
// @DES Query methods
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// @DES Query methods
///////////////////////////////////////////////////////////
// @FPUB
// @FPUB
operator const char*() const { return (const char*)_str; } // *(TString) -> _str
char& operator[](int i) const { return _str[i]; } // TString[i] -> _str[i]
@ -71,11 +71,11 @@ public:
const char* sub(int from, int to = -1) const; // Ritorna la stringa da FROM a TO (escluso)
const char* right(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da destra
///////////////////////////////////////////////////////////
// @DES Modifying methods
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// @DES Modifying methods
///////////////////////////////////////////////////////////
// @FPUB
// @FPUB
TString& fill(char c, int n = -1); // Riempie con n caratteri c
TString& spaces(int n = -1) { return fill(' ', n); }
TString& overwrite(const char* s, int pos = 0); // Sovrascrive la stringa s dalla posizione pos
@ -99,11 +99,11 @@ public:
TString& upper(); // Mette la stringa in maiuscolo
TString& lower(); // Mette la stringa in minuscolo
///////////////////////////////////////////////////////////
// @DES Standard operators
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// @DES Standard operators
///////////////////////////////////////////////////////////
// @FPUB
// @FPUB
const TString& operator =(const TString& s) { return set(s._str); }
const TString& operator =(const char* s) { return set(s); }
@ -187,12 +187,12 @@ public:
class TFilename : public TString
{
public:
// @FPUB
// @FPUB
TFilename(const char* n = "") : TString(24) { set(n); }
const TString& operator =(const char* s) { return set(s); }
// assegnazione tra TFile e stringa
// assegnazione tra TFile e stringa
const char* ext() const; // Ritorna l'estensione
void ext(const char*); // Imposta come estensione la stringa puntata da char*
@ -208,18 +208,18 @@ public:
class TToken_string : public TString
{
// @DPRIV
// @DPRIV
char _separator; // Carattere separatore
int _last; // Puntatore all'ultimo
protected:
// @FPROT
// @FPROT
TObject* dup() const; // Crea un duplicato della token string
bool set_item(const char* v, int n);
public:
// @FPUB
// @FPUB
TToken_string(const char* = "", char separator = '|');
TToken_string(int n, char separator = '|');
TToken_string(const TToken_string& s);
@ -237,6 +237,7 @@ public:
void destroy(int pos); // Toglie il token pos
const char* get(); // Ritorna il prossimo token
const char* get(int n); // Ritorna un token (-1 = prossimo; -2 = ultimo; n = ennesimo)
char get_char(int n = -1); // Ritorna un carattere
int get_int(int n = -1); // Ritorna un intero
long get_long(int n = -1); // Ritorna un intero esteso
int get_pos(const char* s); // Ritorna la posizione dell'item s

View File

@ -75,7 +75,7 @@ char* format(const char* fmt, ...)
const char* cmd2name(const char* argv0, const char* argv1)
{
TFilename app(argv0); app.ext(""); app = app.name();
if (argv1) app << ' ' << argv1;
if (argv1 != NULL) app << ' ' << argv1;
app.lower();
const int par = app.find(" -");