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 void TApplication::about() const
{ {
#include <prassi.ver> #include <prassi.ver>
const TFilename n(__argv[0]);
message_box("PRASSI Versione %g\nProgramma %s\nLibreria del %s", message_box("PRASSI Versione %g\nProgramma %s\nLibreria del %s",
VERSION, (const char*)name(), __DATE__); VERSION, (const char*)n.name(), __DATE__);
} }

View File

@ -62,7 +62,7 @@ public:
void disable_menu_item(MENU_TAG item) { enable_menu_item(item, FALSE); } void disable_menu_item(MENU_TAG item) { enable_menu_item(item, FALSE); }
void dispatch_e_menu(MENU_TAG item); 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() const { return __argv; }
const char* argv(int i) const { return __argv[i]; } const char* argv(int i) const { return __argv[i]; }
int argc() const { return __argc; } int argc() const { return __argc; }

View File

@ -736,9 +736,17 @@ bool TForm_list::update()
// TPrint_section // TPrint_section
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
void TPrint_section::init(const char* name, TForm* f)
{
_name = name;
_form = f;
}
TPrint_section::TPrint_section(const char* name, TForm* 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) TPrintrow& TPrint_section::row(int num)
{ {
@ -1027,9 +1035,7 @@ bool TForm::edit(int mode, int section)
TForm::TForm(const char* name) TForm::TForm(const char* name) : _name(name)
: _name(name),
_head("HEADER", this), _body("BODY", this), _foot("FOOTER", this)
{ {
_name.ext("frm"); _name.ext("frm");
TScanner scanner(_name); TScanner scanner(_name);
@ -1044,6 +1050,10 @@ TForm::TForm(const char* name)
ok = parse_join(scanner); ok = parse_join(scanner);
scanner.push(); scanner.push();
_head.init("HEADER", this);
_body.init("BODY", this);
_foot.init("FOOTER", this);
while (scanner.popkey() == "PA") while (scanner.popkey() == "PA")
{ {
scanner.pop(); scanner.pop();

View File

@ -19,7 +19,7 @@ class TForm_item;
class TPrint_section : public TArray class TPrint_section : public TArray
{ {
TString _name; TString16 _name;
int _heigth; int _heigth;
TForm* _form; TForm* _form;
@ -41,7 +41,8 @@ public:
bool edit(int mode); 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 <xvt.h>
#include <applicat.h> #include <applicat.h>
@ -597,7 +597,7 @@ bool TMask_field::do_message(int num)
if (value != prev) if (value != prev)
{ {
f.set(value); f.set(value);
if (f.showed()) if (f.showed() || f.ghost())
f.on_hit(); f.on_hit();
} }
} }
@ -1240,6 +1240,7 @@ bool TBrowse::do_insert()
{ {
app = _insert.mid(1); app = _insert.mid(1);
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
if (strnicmp(app, MainApp()->name(), 3) == 0)
app.insert("a", 3); app.insert("a", 3);
#endif #endif
} }

View File

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

View File

@ -237,6 +237,7 @@ public:
void destroy(int pos); // Toglie il token pos void destroy(int pos); // Toglie il token pos
const char* get(); // Ritorna il prossimo token const char* get(); // Ritorna il prossimo token
const char* get(int n); // Ritorna un token (-1 = prossimo; -2 = ultimo; n = ennesimo) 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 int get_int(int n = -1); // Ritorna un intero
long get_long(int n = -1); // Ritorna un intero esteso long get_long(int n = -1); // Ritorna un intero esteso
int get_pos(const char* s); // Ritorna la posizione dell'item s 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) const char* cmd2name(const char* argv0, const char* argv1)
{ {
TFilename app(argv0); app.ext(""); app = app.name(); TFilename app(argv0); app.ext(""); app = app.name();
if (argv1) app << ' ' << argv1; if (argv1 != NULL) app << ' ' << argv1;
app.lower(); app.lower();
const int par = app.find(" -"); const int par = app.find(" -");