Porcheriole; migliorata restore- e save-status delle relazioni

git-svn-id: svn://10.65.10.50/trunk@53 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1994-08-24 07:24:08 +00:00
parent 6d79069eb6
commit aba005889b
3 changed files with 102 additions and 126 deletions

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.3 1994-08-22 09:06:05 alex Exp $ // $Id: relation.cpp,v 1.4 1994-08-24 07:24:04 villa Exp $
// relation.cpp // relation.cpp
// fv 12/8/93 // fv 12/8/93
// relation class for isam files // relation class for isam files
@ -190,7 +190,8 @@ void TRelation::restore_status()
{ {
int err = _status.get_int(); int err = _status.get_int();
int recno = _status.get_int(); int recno = _status.get_int();
file(i)->readat(recno); if (recno >= 0l) file(i)->readat(recno);
else file(i)->curr().zero();
file(i)->setstatus(err); file(i)->setstatus(err);
} }
for (i = 0; i < _reldefs.items(); i++) for (i = 0; i < _reldefs.items(); i++)
@ -206,7 +207,7 @@ void TRelation::save_status()
for (int i = 0; i < _files.items(); i++) for (int i = 0; i < _files.items(); i++)
{ {
int err = file(i)->status(); int err = file(i)->status();
TRecnotype recno = file(i)->recno(); TRecnotype recno = file(i)->eof() ? -1l : file(i)->recno();
_status.add (format ("%d",err)); _status.add (format ("%d",err));
_status.add (format ("%d",recno)); _status.add (format ("%d",recno));
} }

View File

@ -2,18 +2,18 @@
#define __TABUTIL_H #define __TABUTIL_H
#ifndef __ISAM_H #ifndef __ISAM_H
#include <isam.h> #include <isam.h>
#endif #endif
/* /*
@(SH) Header @(SH) Header
@(C#) PUBBLICHE @(C#) PUBBLICHE
@(C$) PRIVATE @(C$) PRIVATE
@(VG#) PUBBLICHE @(VG#) PUBBLICHE
@(VG$) PRIVATE @(VG$) PRIVATE
*/ */
// @C // @C
// Classe TTable : public TLocalisamfile // Classe TTable : public TLocalisamfile
@ -21,35 +21,35 @@
class TTable : public TLocalisamfile class TTable : public TLocalisamfile
{ {
// @DPRIV // @DPRIV
TString _tabname; TString _tabname;
public: public:
// @FPUB // @FPUB
int first(word lockop = _nolock); int first(word lockop = _nolock);
int last(word lockop = _nolock); int last(word lockop = _nolock);
int next(word lockop = _nolock); int next(word lockop = _nolock);
int prev(word lockop = _nolock); int prev(word lockop = _nolock);
int reread(word lockop = _nolock, TDate& = botime); int reread(word lockop = _nolock, TDate& = botime);
int reread(TRectype& rec, word lockop = _nolock, TDate& = botime); int reread(TRectype& rec, word lockop = _nolock, TDate& = botime);
int skip(TRecnotype nrec, word lockop = _nolock); int skip(TRecnotype nrec, word lockop = _nolock);
int read(word op = _isequal, word lockop = _nolock, TDate& = botime); int read(word op = _isequal, word lockop = _nolock, TDate& = botime);
int read(TRectype& rec, word op = _isequal, word lockop = _nolock, TDate& = botime); int read(TRectype& rec, word op = _isequal, word lockop = _nolock, TDate& = botime);
int readat(TRecnotype nrec, word lockop = _nolock); int readat(TRecnotype nrec, word lockop = _nolock);
int readat(TRectype& rec, TRecnotype nrec, word lockop = _nolock); int readat(TRectype& rec, TRecnotype nrec, word lockop = _nolock);
int write(TDate& = botime); int write(TDate& = botime);
int write(const TRectype& rec, TDate& = botime); int write(const TRectype& rec, TDate& = botime);
int rewrite(TDate& = botime); int rewrite(TDate& = botime);
int rewrite(const TRectype& rec, TDate& = botime); int rewrite(const TRectype& rec, TDate& = botime);
int remove(TDate& = botime); int remove(TDate& = botime);
int remove(const TRectype& rec, TDate& = botime); int remove(const TRectype& rec, TDate& = botime);
virtual const char* name() const { return (const char*) _tabname;} virtual const char* name() const { return (const char*) _tabname;}
TTable(const char* tabname, bool linkrecinst = FALSE); TTable(const char* tabname, bool linkrecinst = FALSE);
virtual ~TTable() {} virtual ~TTable() {}
static int name2log(const char* tabname); static int name2log(const char* tabname);
}; };

View File

@ -58,8 +58,7 @@ extern "C"
const long E_ADDLINE = 488l; const long E_ADDLINE = 488l;
const long E_ADDLINE_ONSCREEN = 467l; const long E_ADDLINE_ONSCREEN = 467l;
void TViswin :: void TViswin::display_link (long y, long x1, long x2, const char *d)
display_link (long y, long x1, long x2, const char *d)
{ {
if (!_link_displayed) if (!_link_displayed)
{ {
@ -73,8 +72,7 @@ display_link (long y, long x1, long x2, const char *d)
} }
} }
void TViswin :: void TViswin::erase_link (long y, long x1, long x2)
erase_link (long y, long x1, long x2)
{ {
if (_link_displayed) if (_link_displayed)
{ {
@ -88,15 +86,13 @@ erase_link (long y, long x1, long x2)
} }
} }
void TViswin :: void TViswin::paint_link (long y, long x1, long x2)
paint_link (long y, long x1, long x2)
{ {
if (adjust_box (x1, x2, y)) if (adjust_box (x1, x2, y))
invert_bar ((int) (x1 + 6l), (int) (y + 1l), (int) (x2 + 6l), (int) (y + 2l)); invert_bar ((int) (x1 + 6l), (int) (y + 1l), (int) (x2 + 6l), (int) (y + 2l));
} }
bool TViswin :: bool TViswin::adjust_box (long &x1, long &x2, long y)
adjust_box (long &x1, long &x2, long y)
{ {
if (y < origin ().y || y > origin ().y + _textrows) if (y < origin ().y || y > origin ().y + _textrows)
return FALSE; return FALSE;
@ -107,8 +103,7 @@ adjust_box (long &x1, long &x2, long y)
return TRUE; return TRUE;
} }
bool TViswin :: bool TViswin::check_link (TPoint * p)
check_link (TPoint * p)
{ {
static char descr[128], pdescr[128]; static char descr[128], pdescr[128];
static int old_id = -1, plinkID = -1; static int old_id = -1, plinkID = -1;
@ -206,16 +201,13 @@ check_link (TPoint * p)
return FALSE; return FALSE;
} }
bool TViswin :: bool TViswin::in_text (const TPoint & p) const
in_text (const TPoint & p)
const
{ {
if (p.x > 5 && p.x < columns () && p.y > 0 && p.y < (rows () - 3)) if (p.x > 5 && p.x < columns () && p.y > 0 && p.y < (rows () - 3))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
// general use, will probably move elsewhere
bool TViswin ::need_paint_sel (bool smart) bool TViswin ::need_paint_sel (bool smart)
{ {
@ -230,24 +222,21 @@ bool TViswin ::need_paint_sel (bool smart)
return r; return r;
} }
void TViswin :: void TViswin::erase_selection ()
erase_selection ()
{ {
if (_sel_displayed) if (_sel_displayed)
paint_selection (); paint_selection ();
_sel_displayed = FALSE; _sel_displayed = FALSE;
} }
void TViswin :: void TViswin::display_selection ()
display_selection ()
{ {
if (!_sel_displayed) if (!_sel_displayed)
paint_selection (); paint_selection ();
_sel_displayed = TRUE; _sel_displayed = TRUE;
} }
void TViswin :: void TViswin::adjust_selection (TPoint & p1, TPoint & p2)
adjust_selection (TPoint & p1, TPoint & p2)
{ {
if (_sel_start.y < _sel_end.y) if (_sel_start.y < _sel_end.y)
{ {
@ -261,8 +250,7 @@ adjust_selection (TPoint & p1, TPoint & p2)
} }
} }
void TViswin :: void TViswin::shift_screen (scroll dir)
shift_screen (scroll dir)
{ {
RCT r; RCT r;
@ -291,8 +279,7 @@ shift_screen (scroll dir)
_scrolling = FALSE; _scrolling = FALSE;
} }
WINDOW TViswin :: WINDOW TViswin::add_button (short id, const char *caption)
add_button (short id, const char *caption)
{ {
const int BUT_HEIGHT = const int BUT_HEIGHT =
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
@ -313,8 +300,7 @@ add_button (short id, const char *caption)
return b; return b;
} }
void TViswin :: void TViswin::repos_buttons ()
repos_buttons ()
{ {
for (int buttons = 0; _button[buttons] != NULL_WIN; buttons++) for (int buttons = 0; _button[buttons] != NULL_WIN; buttons++)
if (buttons == MAXBUT - 1) if (buttons == MAXBUT - 1)
@ -351,8 +337,7 @@ repos_buttons ()
} }
} }
void TViswin :: void TViswin::open ()
open ()
{ {
set_scroll_max (MAXLEN, _txt.lines () <= _textrows ? _txt.lines () : _txt.lines () - _textrows); set_scroll_max (MAXLEN, _txt.lines () <= _textrows ? _txt.lines () : _txt.lines () - _textrows);
repos_buttons (); repos_buttons ();
@ -362,8 +347,7 @@ open ()
} }
// prints the window contents // prints the window contents
void TViswin :: void TViswin::paint_screen ()
paint_screen ()
{ {
bool first = TRUE; bool first = TRUE;
for (long j = 0; j < _textrows; j++) for (long j = 0; j < _textrows; j++)
@ -399,8 +383,7 @@ paint_screen ()
} }
} }
void TViswin :: void TViswin::paint_background (long j, int row)
paint_background (long j, int row)
{ {
if (!_isbackground) if (!_isbackground)
return; return;
@ -495,8 +478,7 @@ paint_background (long j, int row)
set_pen (COLOR_BLACK); set_pen (COLOR_BLACK);
} }
void TViswin :: void TViswin::paint_row (long j)
paint_row (long j)
{ {
// int or = (int)origin().x; // int or = (int)origin().x;
long y = origin ().y; long y = origin ().y;
@ -578,8 +560,7 @@ paint_row (long j)
autoscroll (TRUE); autoscroll (TRUE);
} }
void TViswin :: void TViswin::paint_column (long j, bool end)
paint_column (long j, bool end)
{ {
paint_header (); paint_header ();
set_opaque_text (TRUE); set_opaque_text (TRUE);
@ -622,8 +603,7 @@ paint_column (long j, bool end)
autoscroll (TRUE); autoscroll (TRUE);
} }
void TViswin :: void TViswin::draw_crossbars ()
draw_crossbars ()
// prints reference crossbars // prints reference crossbars
{ {
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
@ -654,24 +634,21 @@ draw_crossbars ()
#endif #endif
} }
void TViswin :: void TViswin::display_crossbar ()
display_crossbar ()
{ {
if (!_cross_displayed) if (!_cross_displayed)
draw_crossbars (); draw_crossbars ();
_cross_displayed = TRUE; _cross_displayed = TRUE;
} }
void TViswin :: void TViswin::erase_crossbar ()
erase_crossbar ()
{ {
if (_cross_displayed) if (_cross_displayed)
draw_crossbars (); draw_crossbars ();
_cross_displayed = FALSE; _cross_displayed = FALSE;
} }
void TViswin :: void TViswin::display_point ()
display_point ()
{ {
if (!_point_displayed) if (!_point_displayed)
@ -679,16 +656,14 @@ display_point ()
_point_displayed = TRUE; _point_displayed = TRUE;
} }
void TViswin :: void TViswin::erase_point ()
erase_point ()
{ {
if (_point_displayed) if (_point_displayed)
paint_point (); paint_point ();
_point_displayed = FALSE; _point_displayed = FALSE;
} }
void TViswin :: void TViswin::paint_point (bool erase)
paint_point (bool erase)
{ {
autoscroll (FALSE); autoscroll (FALSE);
static bool wasbar; static bool wasbar;
@ -714,8 +689,7 @@ paint_point (bool erase)
} }
// draw screen header // draw screen header
void TViswin :: void TViswin::paint_header ()
paint_header ()
{ {
set_mode (M_COPY); set_mode (M_COPY);
set_opaque_text (TRUE); set_opaque_text (TRUE);
@ -734,8 +708,7 @@ paint_header ()
autoscroll (TRUE); autoscroll (TRUE);
} }
void TViswin :: void TViswin::paint_selection ()
paint_selection ()
{ {
TPoint p1, p2; TPoint p1, p2;
adjust_selection (p1, p2); adjust_selection (p1, p2);
@ -792,8 +765,7 @@ paint_waitbar (bool xor)
autoscroll (TRUE); autoscroll (TRUE);
} }
void TViswin :: void TViswin::update ()
update ()
{ {
if (_scrolling) if (_scrolling)
return; return;
@ -834,8 +806,7 @@ else
_need_scroll = none; _need_scroll = none;
} }
void TViswin :: void TViswin::abort_print ()
abort_print ()
{ {
if (yesno_box ("Interruzione della stampa su video?")) if (yesno_box ("Interruzione della stampa su video?"))
{ {
@ -846,8 +817,7 @@ abort_print ()
} }
} }
void TViswin :: void TViswin::handler (WINDOW win, EVENT * ep)
handler (WINDOW win, EVENT * ep)
{ {
int kdiff_x, kdiff_y; int kdiff_x, kdiff_y;
PNT newcross; PNT newcross;
@ -1160,6 +1130,14 @@ handler (WINDOW win, EVENT * ep)
case E_SIZE: case E_SIZE:
if (is_open ()) if (is_open ())
{ {
// riga bottoni di menta
// ne' giusto ne' bello, ma tant'e'
autoscroll (FALSE);
set_mode (M_COPY);
set_brush (MASK_BACK_COLOR);
bar (5, rows () - 3, columns () + 1, rows () + 1);
autoscroll (TRUE);
check_link (); check_link ();
erase_point (); erase_point ();
if (_isselection) if (_isselection)
@ -1478,7 +1456,7 @@ on_key (KEY key)
_curbut--; _curbut--;
break; break;
case K_SPACE: case K_SPACE:
case K_CTRL_ENTER: case K_SHIFT_ENTER:
if (_linkID != -1) if (_linkID != -1)
{ {
LINKHANDLER pl = MainApp ()->printer ().getlinkhandler (); LINKHANDLER pl = MainApp ()->printer ().getlinkhandler ();
@ -1733,11 +1711,10 @@ on_key (KEY key)
default: default:
break; break;
} }
return TWindow ::on_key (key); return TWindow::on_key (key);
} }
bool TViswin :: bool TViswin::call_editor ()
call_editor ()
{ {
TConfig cnf (CONFIG_STUDIO, "Main"); TConfig cnf (CONFIG_STUDIO, "Main");
TString editor (cnf.get ("Editor")); TString editor (cnf.get ("Editor"));
@ -1783,8 +1760,7 @@ call_editor ()
return ok; return ok;
} }
void TViswin :: void TViswin::add_line (const char *l)
add_line (const char *l)
{ {
if (_isopen && !_frozen) if (_isopen && !_frozen)
{ {
@ -1804,8 +1780,7 @@ add_line (const char *l)
} }
} }
void TViswin :: void TViswin::close_print ()
close_print ()
{ {
_isopen = FALSE; _isopen = FALSE;
kill_timer (_wtimer); kill_timer (_wtimer);