Correzioni guido (da commentare)
git-svn-id: svn://10.65.10.50/trunk@389 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
41cac87df5
commit
9b74e03674
@ -140,27 +140,13 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
||||
stop_run(K_ESC); break;
|
||||
case DLG_QUIT :
|
||||
stop_run(K_FORCE_CLOSE); break;
|
||||
case DLG_NEWREC :
|
||||
if (test_focus_change()) stop_run(K_INS); break;
|
||||
case DLG_DELREC :
|
||||
if (test_focus_change()) stop_run(K_DEL); break;
|
||||
/*
|
||||
case DLG_PGDN :
|
||||
on_key(K_NEXT); break;
|
||||
case DLG_PGUP :
|
||||
on_key(K_PREV); break;
|
||||
case DLG_FIRSTREC:
|
||||
stop_run(K_HOME); break;
|
||||
case DLG_PREVREC :
|
||||
stop_run(K_PREV); break;
|
||||
case DLG_NEXTREC :
|
||||
stop_run(K_NEXT); break;
|
||||
case DLG_FINDREC :
|
||||
stop_run(K_F9); break;
|
||||
case DLG_LASTREC :
|
||||
stop_run(K_END); break;
|
||||
case DLG_SAVEREC :
|
||||
stop_run(K_SAVE); break;
|
||||
/*
|
||||
case DLG_NEWREC :
|
||||
if (test_focus_change()) stop_run(K_INS);
|
||||
break;
|
||||
case DLG_DELREC :
|
||||
if (test_focus_change()) stop_run(K_DEL);
|
||||
break;
|
||||
*/
|
||||
case DLG_F9:
|
||||
{
|
||||
@ -204,7 +190,7 @@ TMask::TMask(const char* title, int pages, int cols, int rows, int xpos,
|
||||
{
|
||||
init_mask(mode);
|
||||
for (_pages = 0; _pages < pages; _pages++)
|
||||
_pagewin[_pages] = create(xpos, ypos, cols, rows, title, WSF_CLOSE | WSF_SIZE, WD_MODAL);
|
||||
_pagewin[_pages] = create(xpos, ypos, cols, rows, title, WSF_CLOSE, WD_MODAL);
|
||||
set_win(NULL_WIN);
|
||||
add_buttons();
|
||||
}
|
||||
@ -321,12 +307,10 @@ void TMask::open()
|
||||
_open = TRUE;
|
||||
if (toolwin())
|
||||
show_window(toolwin(), TRUE);
|
||||
set_front_window(fld(0).win()); // TBR
|
||||
next_page(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_front_window(fld(0).win()); // TBR
|
||||
set_focus();
|
||||
}
|
||||
}
|
||||
@ -749,6 +733,7 @@ bool TMask::on_key(KEY key)
|
||||
"ed inizializzata mostruosamente in %ld millisecondi\n"
|
||||
"Grazie per la comprensione",
|
||||
fld(_focus).dlg(), (const char*)source_file(), clock1, clock2);
|
||||
set_focus();
|
||||
break;
|
||||
default:
|
||||
if (key > K_CTRL)
|
||||
@ -834,7 +819,7 @@ WINDOW TMask::read_page(TScanner& scanner, bool toolbar)
|
||||
else
|
||||
{
|
||||
w = create(r.left, r.top, r.right, r.bottom,
|
||||
title, WSF_CLOSE | WSF_SIZE | WSF_INVISIBLE, WD_MODAL);
|
||||
title, WSF_CLOSE | WSF_INVISIBLE, WD_MODAL);
|
||||
}
|
||||
|
||||
while (scanner.popkey() != "EN")
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: maskfld.cpp,v 1.29 1994-10-14 17:55:57 alex Exp $
|
||||
// $Id: maskfld.cpp,v 1.30 1994-10-14 19:15:06 guy Exp $
|
||||
#include <xvt.h>
|
||||
|
||||
#include <applicat.h>
|
||||
@ -1382,16 +1382,20 @@ KEY TBrowse::run()
|
||||
TFilename name("batb");
|
||||
if (f.num() == LF_TABCOM) name << '%';
|
||||
name << _cursor->file().name() << ".msk";
|
||||
if (fexist(name))
|
||||
if (fexist(name.lower()))
|
||||
{
|
||||
TScanner m(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 = f.description();
|
||||
else
|
||||
{
|
||||
caption = name.mid(4);
|
||||
caption.cut(caption.find('.'));
|
||||
caption.insert("Tabella ", 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
caption = f.description();
|
||||
|
@ -27,6 +27,7 @@ class TSpreadsheet : public TWindow
|
||||
TMask _mask;
|
||||
int _columns;
|
||||
bool _dirty;
|
||||
bool _firstfocus;
|
||||
|
||||
XI_OBJ *_list, *_itf;
|
||||
|
||||
@ -75,6 +76,7 @@ public:
|
||||
TMask& mask();
|
||||
|
||||
int items() const { return _str.items(); }
|
||||
int selected() const { return _cur_row; }
|
||||
int columns() const { return _columns; }
|
||||
bool dirty() const { return _dirty; }
|
||||
void set_notify(SPREADSHEET_NOTIFY n) { _notify = n; }
|
||||
@ -90,7 +92,6 @@ public:
|
||||
void TSpreadsheet::init()
|
||||
{
|
||||
static bool first = TRUE;
|
||||
|
||||
if (!first) return;
|
||||
|
||||
xvt_set_font(TASK_WIN, FF_FIXED, 0);
|
||||
@ -112,7 +113,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
const char* maskname, int maskno,
|
||||
const char* head, WINDOW parent)
|
||||
: _mask(maskname, NO_MODE, maskno), _notify(NULL), _edit_field(NULL), _cur_row(0), _cur_col(0),
|
||||
_row_dirty(FALSE), _check_enabled(TRUE)
|
||||
_row_dirty(FALSE), _check_enabled(TRUE), _firstfocus(TRUE)
|
||||
{
|
||||
const int NUMBER_WIDTH = 3;
|
||||
const int MAX_COL = 32;
|
||||
@ -181,9 +182,9 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
NORMAL_COLOR, DISABLED_BACK_COLOR, // disabled
|
||||
COLOR_RED, // active
|
||||
LIST_CID);
|
||||
listdef->v.list->sizable_columns = TRUE;
|
||||
listdef->v.list->movable_columns = TRUE;
|
||||
listdef->v.list->scroll_bar = TRUE;
|
||||
listdef->v.list->sizable_columns = FALSE;
|
||||
listdef->v.list->movable_columns = FALSE;
|
||||
listdef->v.list->scroll_bar_button = TRUE;
|
||||
listdef->v.list->fixed_columns = 1;
|
||||
listdef->v.list->width = rct.right-rct.left;
|
||||
@ -204,7 +205,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
|
||||
long flags = XI_ATR_EDITMENU | XI_ATR_AUTOSCROLL;
|
||||
if (f->class_id() == CLASS_REAL_FIELD) flags |= XI_ATR_RJUST;
|
||||
if (f->active()) flags |= XI_ATR_ENABLED;
|
||||
if (f->active()) flags |= XI_ATR_ENABLED | XI_ATR_FOCUSBORDER | XI_ATR_AUTOSELECT;
|
||||
else _column_disabled.set(i);
|
||||
|
||||
coldef = xi_add_column_def(listdef, cid, flags, cid, v_width[i], m_width[i], (char*)h);
|
||||
@ -221,13 +222,13 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
0, EM_ALL, (EVENT_HANDLER)xi_event, 0L);
|
||||
CHECK(win, "Can't create a window for the spreadsheet");
|
||||
|
||||
set_win(win); // Set TWindow::_win
|
||||
itfdef->v.itf->win = win;
|
||||
set_win(win); // Set TWindow::_win
|
||||
itfdef->v.itf->win = win; // Link interface to win
|
||||
|
||||
xi_create(NULL, itfdef);
|
||||
xi_tree_free(itfdef);
|
||||
xi_create(NULL, itfdef); // Create the whole thing!
|
||||
xi_tree_free(itfdef); // Free definitions
|
||||
|
||||
_itf = xi_get_itf(win);
|
||||
_itf = xi_get_itf(win); // Store useful references for later use
|
||||
_list = xi_get_obj(_itf, LIST_CID);
|
||||
}
|
||||
|
||||
@ -445,7 +446,7 @@ break;
|
||||
*dst = '\0';
|
||||
}
|
||||
break;
|
||||
case XIE_CHAR_CELL:
|
||||
case XIE_CHG_CELL:
|
||||
if (!_row_dirty)
|
||||
{
|
||||
notify(_cur_row, K_SPACE);
|
||||
@ -491,8 +492,14 @@ if (xiev->v.xi_obj->type == XIT_LIST)
|
||||
}
|
||||
break;
|
||||
case XIE_ON_LIST:
|
||||
mask().set_focus_win(win(), FALSE);
|
||||
break;
|
||||
if (_firstfocus) // Trick to avoid the sheet to keep the focus forever ...
|
||||
{ // .. it costed me two day worth of hard work!
|
||||
xiev->refused = TRUE;
|
||||
_firstfocus = FALSE;
|
||||
}
|
||||
else
|
||||
mask().set_focus_win(win(), FALSE);
|
||||
break;
|
||||
case XIE_OFF_LIST:
|
||||
break;
|
||||
case XIE_ON_ROW:
|
||||
@ -707,7 +714,7 @@ public:
|
||||
const char* head, WINDOW parent);
|
||||
|
||||
TArray& rows_array() const { return data(); }
|
||||
|
||||
|
||||
TMask& sheet_mask() { return _mask; }
|
||||
TMask& mask();
|
||||
|
||||
@ -1082,6 +1089,11 @@ int TSheet_field::items() const
|
||||
}
|
||||
|
||||
|
||||
int TSheet_field::selected() const
|
||||
{
|
||||
return _sheet->selected();
|
||||
}
|
||||
|
||||
void TSheet_field::set_notify(SPREADSHEET_NOTIFY n)
|
||||
{
|
||||
_sheet->set_notify(n);
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
TArray& rows_array() const; // Get all rows
|
||||
int first_empty() const; // First empty row
|
||||
int items() const; // Number of rows
|
||||
int selected() const; // Number of current row
|
||||
|
||||
virtual void reset();
|
||||
void destroy(int r = -1); // Destroy row
|
||||
|
@ -1 +1 @@
|
||||
#define VERSION 1.9
|
||||
#define VERSION 1.10
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relapp.cpp,v 1.15 1994-10-14 17:59:12 alex Exp $
|
||||
// $Id: relapp.cpp,v 1.16 1994-10-14 19:15:17 guy Exp $
|
||||
#include <mailbox.h>
|
||||
#include <sheet.h>
|
||||
#include <urldefid.h>
|
||||
@ -216,11 +216,7 @@ void TRelation_application::enable_query()
|
||||
TMask_field& c = _mask->fld(num);
|
||||
const bool has_query = c.has_query();
|
||||
if (k == 1)
|
||||
{
|
||||
// THIS should have been fixed
|
||||
// if (!query && has_query) c.check(STARTING_CHECK);
|
||||
c.enable(query);
|
||||
}
|
||||
if (has_query)
|
||||
((TEdit_field&)c).enable_check(query);
|
||||
}
|
||||
@ -253,26 +249,9 @@ void TRelation_application::set_toolbar(bool all)
|
||||
}
|
||||
_mask->fld(pos).enable(enabdel);
|
||||
}
|
||||
/*
|
||||
const bool full = !file().empty() && _first != -1;
|
||||
pos = _mask->id2pos(DLG_FIRSTREC);
|
||||
if (pos >= 0) _mask->fld(pos).enable(full);
|
||||
pos = _mask->id2pos(DLG_LASTREC);
|
||||
if (pos >= 0) _mask->fld(pos).enable(full);
|
||||
pos = _mask->id2pos(DLG_STOPREC);
|
||||
if (pos >= 0) _mask->fld(pos).enable(full);
|
||||
*/
|
||||
}
|
||||
|
||||
enable_query();
|
||||
|
||||
/*
|
||||
const TRecnotype rpos = file().recno();
|
||||
pos = _mask->id2pos(DLG_PREVREC);
|
||||
if (pos >= 0) _mask->fld(pos).enable(mod && rpos != _first);
|
||||
pos = _mask->id2pos(DLG_NEXTREC);
|
||||
if (pos >= 0) _mask->fld(pos).enable(mod && rpos != _last);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -313,11 +292,14 @@ int TRelation_application::set_mode(int mode)
|
||||
bool TRelation_application::autonum(TMask* m, bool rec)
|
||||
{
|
||||
TToken_string k(get_next_key());
|
||||
|
||||
|
||||
if (!rec && !m->query_mode())
|
||||
m->reset();
|
||||
|
||||
for (const char* n = k.get(0); n && *n; n = k.get())
|
||||
{
|
||||
const short id = atoi(n);
|
||||
if (id < 1) break;
|
||||
const short id = atoi(n);
|
||||
CHECKD (id > 0, "Identificatore di autonumerazione errato: ", id);
|
||||
const char* val = k.get();
|
||||
TMask_field& f = m->field(id);
|
||||
if (rec || f.get().empty()) f.set(val);
|
||||
@ -340,7 +322,7 @@ void TRelation_application::query_mode(bool pre_ins)
|
||||
if (changing)
|
||||
{
|
||||
if (old) _mask->open_modal();
|
||||
if (_maskeys) delete _maskeys;
|
||||
if (_maskeys) delete _maskeys;
|
||||
_maskeys = new TKey_array(_mask);
|
||||
set_limits();
|
||||
}
|
||||
@ -350,7 +332,6 @@ void TRelation_application::query_mode(bool pre_ins)
|
||||
if (pre_ins)
|
||||
{
|
||||
set_mode(NO_MODE);
|
||||
autonum(_mask, FALSE);
|
||||
init_query_insert_mode(*_mask);
|
||||
}
|
||||
else
|
||||
@ -362,38 +343,47 @@ void TRelation_application::query_mode(bool pre_ins)
|
||||
|
||||
|
||||
void TRelation_application::insert_mode()
|
||||
{
|
||||
if (test_key(1, FALSE) == FALSE)
|
||||
{
|
||||
if (_mask->query_mode())
|
||||
{
|
||||
if (test_key(1, FALSE) == FALSE)
|
||||
{
|
||||
if (!autonum(_mask, FALSE))
|
||||
{
|
||||
query_insert_mode();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const bool changing = changing_mask(MODE_INS);
|
||||
TFilename workname; workname.temp("msk$$");
|
||||
if (changing)
|
||||
{
|
||||
_mask->set_workfile(workname);
|
||||
_mask->save();
|
||||
_mask->close_modal();
|
||||
}
|
||||
_mask = get_mask(MODE_INS);
|
||||
if (changing)
|
||||
{
|
||||
_mask->reset();
|
||||
_mask->set_workfile(workname);
|
||||
_mask->load();
|
||||
::remove(workname);
|
||||
_mask->open_modal();
|
||||
delete _maskeys;
|
||||
_maskeys = new TKey_array(_mask);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!autonum(_mask, FALSE))
|
||||
{
|
||||
query_insert_mode();
|
||||
query_insert_mode();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const bool changing = changing_mask(MODE_INS);
|
||||
|
||||
TFilename workname; workname.temp("rim$$");
|
||||
|
||||
if (changing)
|
||||
{
|
||||
_mask->set_workfile(workname);
|
||||
_mask->save();
|
||||
_mask->close_modal();
|
||||
}
|
||||
_mask = get_mask(MODE_INS);
|
||||
if (changing)
|
||||
{
|
||||
_mask->reset();
|
||||
_mask->set_workfile(workname);
|
||||
_mask->load();
|
||||
::remove(workname);
|
||||
_mask->open_modal();
|
||||
delete _maskeys;
|
||||
_maskeys = new TKey_array(_mask);
|
||||
}
|
||||
|
||||
|
||||
set_mode(MODE_INS);
|
||||
init_insert_mode(*_mask);
|
||||
}
|
||||
@ -735,11 +725,8 @@ bool TRelation_application::main_loop()
|
||||
}
|
||||
break;
|
||||
case K_INS:
|
||||
if (_mask->mode() == MODE_QUERY)
|
||||
if (_mask->query_mode() || _mask->save(TRUE))
|
||||
insert_mode();
|
||||
else
|
||||
if (save(TRUE))
|
||||
query_mode(TRUE);
|
||||
break;
|
||||
case K_DEL:
|
||||
{
|
||||
|
@ -524,7 +524,7 @@ TString& TFixed_string::format(const char* fmt, ...)
|
||||
va_start(pars, fmt);
|
||||
const int tot = vsprintf(_str, fmt, pars);
|
||||
va_end(pars);
|
||||
CHECK(tot >= 0 && tot < size(), "Ue'! Quanto scrivi?");
|
||||
CHECK(tot >= 0 && tot < size(), "Ue'! Quanto scrivi con 'sta format?");
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -658,7 +658,6 @@ const TFilename& TFilename::temp(const char* prefix)
|
||||
// Certified 100%
|
||||
TToken_string::TToken_string(const char* s, char separator)
|
||||
: TString(s), _separator(separator)
|
||||
|
||||
{
|
||||
restart();
|
||||
}
|
||||
@ -666,7 +665,6 @@ TToken_string::TToken_string(const char* s, char separator)
|
||||
// Certified 100%
|
||||
TToken_string::TToken_string(int n, char separator)
|
||||
: TString(n), _separator(separator), _last(0)
|
||||
|
||||
{}
|
||||
|
||||
// Certified 100%
|
||||
@ -896,7 +894,6 @@ void TToken_string::destroy(int n)
|
||||
restart();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Paragraph string
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -61,8 +61,11 @@ public:
|
||||
CHECKD(i >= 0 && i <= _size, "Bad string subscript: ", i);
|
||||
return _str[i];
|
||||
}
|
||||
|
||||
char operator[](int i) const { return _str[i]; } // TString[i] -> _str[i]
|
||||
char operator[](int i) const // TString[i] -> _str[i]
|
||||
{
|
||||
CHECKD(i >= 0 && i <= _size, "Bad string subscript: ", i);
|
||||
return _str[i];
|
||||
}
|
||||
|
||||
int size() const { return _size; }
|
||||
int len() const { return strlen(_str); }
|
||||
@ -225,7 +228,7 @@ protected:
|
||||
|
||||
virtual TObject* dup() const; // Crea un duplicato della token string
|
||||
bool set_item(const char* v, int n);
|
||||
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
TToken_string(const char* = "", char separator = '|');
|
||||
@ -238,11 +241,11 @@ public:
|
||||
const TString& operator =(const char* s) { set(s);restart();return *this; }
|
||||
const TString& operator =(const TString& s) { set(s);restart();return *this; }
|
||||
|
||||
void add(const char* s, int n = -1); // Aggiunge un token
|
||||
void add(char c, int pos = -1); // Aggiunge un char
|
||||
void add(long n, int pos = -1); // Aggiunge un intero
|
||||
void add(int n, int pos = -1); // Aggiunge un intero
|
||||
void destroy(int pos); // Toglie il token pos
|
||||
void add(const char* s, int n = -1); // Aggiunge una stringa
|
||||
void add(char c, int pos = -1); // Aggiunge un char
|
||||
void add(long n, int pos = -1); // Aggiunge un intero
|
||||
void add(int n, int pos = -1); // Aggiunge un intero
|
||||
void destroy(int pos); // Toglie la stringa 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
|
||||
|
@ -1053,17 +1053,18 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
break;
|
||||
case E_MOUSE_MOVE:
|
||||
{
|
||||
if (!_selecting && !_iscross) // no buttons pressed
|
||||
|
||||
{
|
||||
p = ep->v.mouse.where;
|
||||
if (in_text (p))
|
||||
{
|
||||
p.x += (origin ().x - 6);
|
||||
p.y += (origin ().y - 1);
|
||||
check_link (&p);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (!_selecting && !_iscross) // no buttons pressed
|
||||
{
|
||||
p = ep->v.mouse.where;
|
||||
if (in_text (p))
|
||||
{
|
||||
p.x += (origin ().x - 6);
|
||||
p.y += (origin ().y - 1);
|
||||
check_link (&p);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (_selecting || _iscross)
|
||||
{
|
||||
p = ep->v.mouse.where;
|
||||
|
Loading…
x
Reference in New Issue
Block a user