Modificati leggermete metodi dei TMessage e TMailbox

Aggiunta distruzione cursori alla printapp
F2 cancella anche i campi automagic e persistent


git-svn-id: svn://10.65.10.50/trunk@446 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-10-24 15:06:49 +00:00
parent ef15b9b004
commit e61426336c
11 changed files with 80 additions and 59 deletions

View File

@ -32,7 +32,7 @@ bool TConfig::_read_paragraph()
int ind = l.find('=');
if (ind == -1)
{
warning_box("Errore configurazione: file %s, vicino a riga %ud",
warning_box("Errore configurazione: file %s, vicino alla riga %ud",
(const char*)_file, scan.linenum());
continue;
}
@ -171,7 +171,7 @@ bool TConfig::set(const char* var, const char* value, const char* section,
bool TConfig::set(const char* var, long value, const char* section,
bool force, int index)
{
TString t; t << value;
TString16 t; t << value;
return set(var,t,section,force,index);
}

View File

@ -26,8 +26,6 @@ class TDate : TObject
friend bool operator ==(const TDate& a, const TDate& b);
friend bool operator !=(const TDate& a, const TDate& b);
static int last_day(int month, int year);
public:
// @FPUB
char* string(int yeardgts = 4, char sep = '-') const ;
@ -41,6 +39,7 @@ public:
bool ok() const; // Vero se la data e' corretta
static bool isdate(const char*); // Vero se la stringa passata e' una data corretta
static int last_day(int month, int year);
bool is_end_month();
void set_end_month(); // setta il giorno del mese all'ultimo possibile
// implementando la filastrocchina

View File

@ -1,4 +1,4 @@
// $Id: mailbox.cpp,v 1.3 1994-09-28 10:35:45 villa Exp $
// $Id: mailbox.cpp,v 1.4 1994-10-24 15:06:26 guy Exp $
#include <stdlib.h>
#include <fstream.h>
@ -21,7 +21,7 @@ TMessage::TMessage(const char* to, const char* sub, const char* text,
{
_to = to; _subject = sub;
_text = text;
_from = (from == NULL ? MainApp()->name() : from);
_from = (from == NULL || *from == '\0' ? main_app().name() : from);
_flags = 0x00; _number = -1;
}
@ -136,10 +136,8 @@ TMessage* TMailbox::next_f(char* f, bool read)
void TMailbox::send(TMessage& m)
{
CHECK(m.from() != NULL && m.to() != NULL &&
(m.subject() != NULL || m.body() != NULL),
"can't send partially empty message");
CHECK(m.from() && m.to() && (m.subject() || m.body()),
"Can't send partially empty message");
// strcpy(to_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));
TFilename to_path; to_path.tempdir();
@ -175,7 +173,7 @@ char* TMailbox::readcmd(char*)
TMailbox::TMailbox(const char* appname) : _msgs(DEF_MSGS_CAPACITY)
{
if (appname == NULL)
appname = MainApp()->name(); // myself; must be global
appname = main_app().name(); // myself; must be global
_path.tempdir();
// strcpy(_path, getenv("TMPDIR") == NULL ? MAILDIR : getenv("TMPDIR"));

View File

@ -1,4 +1,4 @@
// $Id: mailbox.h,v 1.3 1994-09-28 10:35:46 villa Exp $
// $Id: mailbox.h,v 1.4 1994-10-24 15:06:27 guy Exp $
/* si', trattasi di -*-c++-*- */
// Mailbox.h
@ -21,31 +21,31 @@
class TMessage : public TObject
// basic message
{
TString _from;
TString _to;
TString _subject;
TString16 _from;
TString16 _to;
TString80 _subject;
TString _text;
byte _flags;
int _number;
friend class TMailbox;
protected:
void setread() { _flags |= MSG_READ; }
bool isread() { return _flags & MSG_READ; }
int number(int n = -1)
{ return (n == -1 ? _number : (_number = n)); }
int number(int n = -1) { return (n == -1 ? _number : (_number = n)); }
public:
const TString& from() const { return _from; }
const TString& to() const { return _to; }
const TString& subject() const { return _subject; }
const TString& body() const { return _text; }
const char* from(const char* f = NULL) // get-set sender
{ return f == NULL ? _from : (_from = f); }
const char* to (const char* f = NULL) // get-set recipient
{ return f == NULL ? _to : (_to = f); }
const char* subject(const char* f = NULL) // get-set subject
{ return f == NULL ? _subject : (_subject = f); }
const char* body(const char* f = NULL) // get-set body
{ return f == NULL ? _text : (_text = f); }
const TString& from(const char* f) { return _from = f; }
const TString& to(const char* t) { return _to = t; }
const TString& subject(const char* s) { return _subject = s; }
const TString& body(const char* b) { return _text = b; }
void send();
TMessage(const char* to, const char* sub, const char* text,
@ -58,7 +58,7 @@ class TMailbox : public TObject
TArray _msgs;
int _lastread, n_new;
long _lastpos;
int _cnt;
int _cnt;
protected:

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.34 1994-10-20 13:32:15 guy Exp $
// $Id: maskfld.cpp,v 1.35 1994-10-24 15:06:30 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -732,7 +732,8 @@ bool TMask_field::on_key(KEY key)
beep();
break;
case K_F2:
reset();
if (is_edit()) set("");
else reset();
set_dirty();
break;
case K_F3:

View File

@ -871,7 +871,24 @@ void TSpreadsheet::enable_cell(int row, int column, bool on)
void TSpreadsheet::enable_column(int col, bool on)
{
const bool change = _column_disabled[col] == on;
_column_disabled.set(col, !on);
if (change)
{
int num;
XI_OBJ** columns = xi_get_member_list(_list, &num);
CHECKD(col+1 < num, "Can't enable column ", col);
XI_OBJ* column = columns[col+1];
long attr = xi_get_attrib(column);
if (on) attr |= XI_ATR_ENABLED;
else attr &= ~XI_ATR_ENABLED;
xi_move_focus(_itf); // Set focus to interface
xi_set_attrib(column, attr); // Set new attributes
RCT r; xi_get_rect(column, &r);
xi_set_column_width(column, (r.right-r.left+1) / CHARX); // Force redraw
}
}

View File

@ -1,4 +1,4 @@
// $Id: printapp.cpp,v 1.12 1994-09-22 07:47:59 guy Exp $
// $Id: printapp.cpp,v 1.13 1994-10-24 15:06:37 guy Exp $
#include <ctype.h>
#include <stdarg.h>
@ -1217,8 +1217,9 @@ bool TPrint_application::create ()
bool TPrint_application::destroy ()
{
user_destroy ();
TApplication::destroy ();
return TRUE;
reset_files();
_cursors.destroy();
return TApplication::destroy ();
}
void TPrint_application::do_print (int n)
@ -1274,7 +1275,15 @@ TPrint_application::TPrint_application ():TApplication (), _transtab (10),
_last_choice = BAR_ITEM (1);
}
void TPrint_application::reset_files()
{
if (_pr_tree != NULL)
{
_reset_tree(_pr_tree);
_pr_tree = NULL;
}
}
TPrint_application::~TPrint_application ()
{
reset_files ();
}
{}

View File

@ -415,7 +415,7 @@ public:
void reset_footer();
// vedi sopra per capire
void reset_files() { _reset_tree(_pr_tree); _pr_tree = NULL; }
void reset_files();
void add_file(int file, int from = 0);
void add_file(const char* tab, int from = 0);

View File

@ -662,7 +662,7 @@ TPrinter::TPrinter()
_headersize = 0;
_footersize = 0;
_isopen = FALSE;
_multiple_copies = MainApp()->class_id() == CLASS_PRINT_APPLICATION;
_multiple_copies = main_app().class_id() == CLASS_PRINT_APPLICATION;
// read configuration file
read_configuration (_config);
@ -743,7 +743,7 @@ void TPrinter::read_configuration (const char *conf)
}
fclose (cnfp);
TString s ("printer.def");
TFilename s ("printer.def");
#if XVT_OS == XVT_OS_SCOUNIX
s << format (".%d", getuid ());
#endif
@ -1133,11 +1133,18 @@ bool TPrinter::open ()
void TPrinter::set()
{
main_app().disable_menu_item (M_FILE_PG_SETUP);
TMask mask ("bagn001a");
TToken_string pn1 (50), pn2 (100);
int i;
TFilename defile("printer.def");
#if XVT_OS == XVT_OS_SCOUNIX
defile << format (".%d", getuid ());
#endif
mask.set_workfile(defile);
MainApp()->disable_menu_item (M_FILE_PG_SETUP);
#if XVT_OS != XVT_OS_WIN
@ -1177,19 +1184,12 @@ void TPrinter::set()
mask.set(MSK_1_NPAGES, _ncopies);
mask.reset (MSK_1_SAVE);
if (mask.run () == K_ESC)
return;
if (mask.get (MSK_1_SAVE).not_empty ())
{
TString s ("printer.def");
#if XVT_OS == XVT_OS_SCOUNIX
s << format (".%d", getuid ());
#endif
mask.set_workfile (s);
mask.save ();
}
if (mask.get_bool(MSK_1_SAVE))
mask.save();
// get user choices
@ -1302,12 +1302,8 @@ void TPrinter::set()
_curprn = atoi(mask.get(MSK_1_PRINTERS));
if (mask.get (MSK_1_SAVE).not_empty ())
{
TString s ("printer.def");
mask.set_workfile (s);
if (mask.get_bool(MSK_1_SAVE))
mask.save ();
}
_ncopies = atoi (mask.get (MSK_1_NPAGES));
@ -1337,7 +1333,7 @@ void TPrinter::set()
#endif
MainApp ()->enable_menu_item (M_FILE_PG_SETUP);
main_app().enable_menu_item (M_FILE_PG_SETUP);
}
void TPrinter::close ()

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.18 1994-10-20 13:32:20 guy Exp $
// $Id: relapp.cpp,v 1.19 1994-10-24 15:06:47 guy Exp $
#include <mailbox.h>
#include <sheet.h>
#include <urldefid.h>
@ -799,7 +799,7 @@ bool TRelation_application::filter()
if (msg)
{
_mask = get_mask(MODE_MOD);
TToken_string body(msg->body());
TToken_string body = msg->body();
short id = body.get_int();
while (id > 0)
@ -843,13 +843,13 @@ bool TRelation_application::filter()
{
TToken_string body(msg->body());
const int key = body.get_int();
const int max = _mask->fields();
_autoins_caller = msg->from();
_lnflag = TRUE;
const char* v = body.get();
const int max = _mask->fields();
for (int i = 0; i < max && v != NULL; i++)
{
TMask_field& f = _mask->fld(i);

View File

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