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
// fv 12/8/93
// relation class for isam files
@ -190,7 +190,8 @@ void TRelation::restore_status()
{
int err = _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);
}
for (i = 0; i < _reldefs.items(); i++)
@ -206,7 +207,7 @@ void TRelation::save_status()
for (int i = 0; i < _files.items(); i++)
{
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",recno));
}

View File

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

View File

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