Sostituito il metodo enable con activate nelle TWindow e TMask

Corretti spreadsheet di conseguenza


git-svn-id: svn://10.65.10.50/trunk@746 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-12-07 18:03:51 +00:00
parent 6f9ba45c36
commit 98efeaff69
10 changed files with 86 additions and 83 deletions

View File

@ -51,7 +51,7 @@ bool TForm_flags::update(const char* s)
void TForm_flags::print_on(ostream& out) const
{
TString s(4);
TString16 s;
if (automagic) s << "A";
if (disabled) s << "D";
@ -199,7 +199,7 @@ bool TForm_item::parse_item(TScanner& scanner)
if (scanner.key() == "ME")
{
TString m(scanner.line());
TFixed_string m(scanner.line());
m.strip_spaces();
message(0).add(m);
return TRUE;
@ -287,7 +287,7 @@ void TForm_item::send_message(const TString& cmd, TForm_item* des) const
} else
if (cmd == "APPEND")
{
TString val(80);
TString80 val;
val = des->get();
if (val.not_empty()) val << ' ';
val << get();
@ -316,7 +316,7 @@ void TForm_item::send_message(const TString& cmd, TForm_item* des) const
} else
if (cmd[0] == '"')
{
TString val(cmd);
TString80 val(cmd);
val.strip("\"");
des->set(val);
} else
@ -330,7 +330,7 @@ bool TForm_item::do_message(int num)
if (message(num).empty()) return FALSE;
TToken_string msg(16, ',');
TString cmd(8);
TString16 cmd;
const char* m;
message(num).restart();
@ -378,7 +378,7 @@ void TForm_item::to_mask(TMask& m) const
m.set(F_WIDTH, _width);
_flag.to_mask(m);
TString g;
TString16 g;
g << _group;
m.set(F_GROUP, g);
}
@ -391,7 +391,7 @@ void TForm_item::from_mask(const TMask& m)
_prompt = m.get(F_PROMPT);
_width = atoi(m.get(F_WIDTH));
TString flag;
TString16 flag;
if (m.get(F_AUTOMAGIC) == "X") flag << "A";
if (m.get(F_HIDDEN) == "X") flag << "H";
_flag.update(flag);
@ -403,7 +403,7 @@ bool TForm_item::edit(TMaskmode mode)
TMask m("bagn003");
if (mode == MODE_INS)
{
m.TWindow::disable();
m.disable(0);
m.show();
}

View File

@ -329,7 +329,8 @@ int TMask::first_focus(short id)
if (tempfirstfocus)
{
f = tempfirstfocus;
fld(f).set_dirty();
if (fld(f).dirty() == FALSE)
fld(f).set_dirty();
}
tempfirstfocus = 0;
}
@ -1004,9 +1005,9 @@ void TMask::set(short fld_id, long n, bool hit)
}
void TMask::enable(bool on)
void TMask::activate(bool on)
{
TWindow::enable(on);
TWindow::activate(on);
if (toolwin() != NULL_WIN)
show_window(toolwin(), on);
}

View File

@ -125,7 +125,7 @@ public:
virtual void open();
virtual void close();
virtual void enable(bool on = TRUE);
virtual void activate(bool on = TRUE);
int id2pos(short id) const;
TMask_field& fld(int i) const { return (TMask_field&)_field[i]; } // Ritorna il campo i-esimo della maschera

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.59 1994-12-07 11:10:39 guy Exp $
// $Id: maskfld.cpp,v 1.60 1994-12-07 18:03:37 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -377,12 +377,7 @@ word TMask_field::last_key() const
void TMask_field::set_dirty(bool d)
{
#ifdef DBG
if (dlg() == 103)
d *= 1;
#endif
if (_flags.dirty > TRUE && d == FALSE)
if (_flags.dirty == 3 && d == FALSE)
return;
_flags.dirty = d;
set_focusdirty(d);

View File

@ -28,7 +28,7 @@ class TSpreadsheet : public TWindow
TMask _mask;
int _columns;
bool _firstfocus, _enabled;
bool _firstfocus, _active;
XI_OBJ *_list, *_itf;
@ -66,7 +66,7 @@ public:
bool destroy(int rec = -1);
void set_focus_cell(int riga, int colonna);
void enable(bool on);
void activate(bool on);
void enable_column(int col, bool on = TRUE);
void enable_cell(int row, int column, bool on = TRUE);
bool cell_disabled(int row, int column) const;
@ -85,7 +85,7 @@ public:
bool dirty() const { return _owner->dirty(); }
void set_dirty(bool spork = TRUE) { _owner->set_dirty(spork); }
bool enabled() const { return _enabled; }
bool active() const { return _active; }
void set_notify(SPREADSHEET_NOTIFY n) { _notify = n; }
@ -119,7 +119,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
const char* head, WINDOW parent,
TSheet_field* o)
: _mask(maskname, maskno), _notify(NULL), _edit_field(NULL),
_owner(o), _cur_row(0), _cur_col(0),
_owner(o), _cur_row(0), _cur_col(0), _active(TRUE),
_row_dirty(FALSE), _check_enabled(TRUE), _firstfocus(TRUE)
{
const int NUMBER_WIDTH = 3;
@ -703,9 +703,9 @@ break;
}
}
void TSpreadsheet::enable(bool on)
void TSpreadsheet::activate(bool on)
{
_enabled = on;
_active = on;
const dword old = xi_get_attrib(_list);
dword att = on ? (old & ~XI_ATR_NAVIGATE) : (old | XI_ATR_NAVIGATE);
@ -986,7 +986,7 @@ void TSpreadsheet::str2mask(int riga)
{
TMask_field& f = sheet_mask().fld(pos);
f.set(val);
const bool on = enabled() ? !cell_disabled(riga, id-FIRST_FIELD) : FALSE;
const bool on = active() ? !cell_disabled(riga, id-FIRST_FIELD) : FALSE;
f.enable(on);
if (f.dirty() <= TRUE)
@ -1197,7 +1197,7 @@ void TSheet_field::highlight() const
void TSheet_field::enable(bool on)
{
_sheet->enable(on);
_sheet->activate(on);
}
void TSheet_field::enable_column(int column, bool on)

View File

@ -1 +1 @@
#define VERSION 1.18
#define VERSION 1.16

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.38 1994-12-07 12:21:01 guy Exp $
// $Id: relapp.cpp,v 1.39 1994-12-07 18:03:46 guy Exp $
#include <mailbox.h>
#include <sheet.h>
#include <urldefid.h>
@ -131,10 +131,11 @@ void TRelation_application::set_limits(byte what)
{
if (has_filtered_cursor())
{
TEdit_field* f = (TEdit_field*) get_search_field();
TEdit_field* f = (TEdit_field*)get_search_field();
CHECK(f, "Manca il campo di ricerca");
TCursor* cur = f->browse()->cursor();
TBrowse* b = f->browse();
TCursor* cur = b ? b->cursor() : NULL;
if (cur)
{
cur->setkey();
@ -156,6 +157,7 @@ void TRelation_application::set_limits(byte what)
return;
}
}
file().setkey(1);
if (what & 0x1)
{
@ -166,7 +168,6 @@ void TRelation_application::set_limits(byte what)
_first = file().recno();
}
}
if (what & 0x2)
{
if (file().empty()) _last = 1;
@ -790,6 +791,8 @@ bool TRelation_application::main_loop()
case K_DEL:
if (relation_remove())
query_mode();
if (_autoins_caller.not_empty())
k = K_QUIT;
break;
case K_F9:
if (save(TRUE))

View File

@ -629,64 +629,74 @@ bool TFilename::ok() const
// Certified 70%
const TFilename& TFilename::tempdir()
{
const char* dirpref = getenv("TEMP");
if (dirpref == NULL) dirpref = getenv("TMP");
if (dirpref == NULL) dirpref = "/tmp";
set(dirpref);
{
static TFilename _tempdir;
const int last = len()-1;
if (!is_not_slash(_str[last]))
cut(last);
int res = 0;
if (!fexist(_str))
{
res =
if (_tempdir.empty())
{
const char* dirpref = getenv("TEMP");
if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP");
if (dirpref == NULL || *dirpref == '\0')
#if XVT_OS==XVT_OS_SCOUNIX
mkdir(_str, 0777);
dirpref = "/tmp";
#else
mkdir(_str);
dirpref = "\\tmp";
#endif
_tempdir = dirpref;
const int last = len()-1;
if (!is_not_slash(_str[last]))
_tempdir.cut(last);
int res = 0;
if (!fexist(_tempdir))
{
#if XVT_OS==XVT_OS_SCOUNIX
res = mkdir(_tempdir, 0777);
#else
res = mkdir(_tempdir);
#endif
}
}
#ifndef FOXPRO
const TString& user = main_app().user();
if (res == 0 && user.not_empty())
{
const TString& user = main_app().user();
if (res == 0 && user.not_empty())
{
#if XVT_OS==XVT_OS_SCOUNIX
*this << '/'
_tempdir << '/' << user;
#else
*this << '\\'
_tempdir << '\\' << user;
#endif
<< user;
lower();
if (!fexist(_str))
{
res =
lower();
if (!fexist(_tempdir))
{
#if XVT_OS==XVT_OS_SCOUNIX
mkdir(_str, 0777);
res = mkdir(_str, 0777);
#else
mkdir(_str);
res = mkdir(_str);
#endif
}
}
}
#endif /* FOXPRO */
if (res != 0)
fatal_box("Impossibile creare la directory '%s' per i file temporanei", (const char*)_tempdir);
_tempdir.insert("TMP=", 0);
putenv(_tempdir);
}
if (res != 0)
fatal_box("Impossibile creare la directory '%s' per i file temporanei", _str);
return *this;
return set(_tempdir.mid(4));
}
// Certified 50%
const TFilename& TFilename::temp(const char* prefix)
{
TFilename dirpref(tempdir());
tempdir();
if (prefix && *prefix)
{
@ -709,16 +719,10 @@ const TFilename& TFilename::temp(const char* prefix)
}
else cut(0);
TFilename oldtmp(getenv("TMP"));
dirpref.insert("TMP=", 0);
putenv(dirpref);
char* t = tempnam(NULL, (char*)_str);
CHECK(t != NULL, "Can't execute tempnam");
set(t);
free(t);
oldtmp.insert("TMP=", 0);
putenv(oldtmp);
#ifdef DBG
if (fexist(_str))

View File

@ -122,7 +122,7 @@ void TWindow_manager::reg(TWindow* m)
case 1 :
win_menu_enable(TASK_WIN, M_FILE_QUIT, FALSE);
default:
_window[_current-1]->disable(); break;
_window[_current-1]->deactivate(); break;
}
_window[_current] = m;
@ -147,7 +147,7 @@ void TWindow_manager::unreg(const TWindow* m)
}
else
{
cur_win()->enable();
cur_win()->activate();
win_menu_enable(TASK_WIN, M_FILE_QUIT, _current == 0);
win_update_menu_bar(TASK_WIN);
cur_win()->set_focus();
@ -180,7 +180,7 @@ bool TWindow::_ctools_saved;
TWindow::TWindow()
: _win(NULL_WIN), _open(FALSE), _modal(FALSE),
: _win(NULL_WIN), _open(FALSE), _modal(FALSE), _active(TRUE),
_running(FALSE), _pixmap(FALSE), _lastkey(0)
{}
@ -357,9 +357,9 @@ void TWindow::maximize() const
#endif
}
void TWindow::enable(bool on)
void TWindow::activate(bool on)
{
enable_window(win(), _enabled = on);
enable_window(win(), _active = on);
}

View File

@ -60,7 +60,7 @@ protected:
// @DPROT
bool _open : 1; // Se la finestra e' aperta
bool _modal : 1; // Se la finestra e' modale
bool _enabled : 1; // Se la finestra e' abilitata
bool _active : 1; // Se la finestra e' abilitata
bool _running : 1; // Se la finestra e' in esecuzione
bool _pixmap : 1; // Se se le coordiante sono in pixel
@ -94,7 +94,7 @@ public:
bool is_open() const { return _open; } // Ritorna _open
bool is_modal() const { return _modal; } // Ritorna _modal
bool is_running() const { return _running; } // Ritorna _running
bool enabled() const { return _enabled; }
bool active() const { return _active; }
TPoint size() const; // Determina numero di righe e colonne nella finestra
short rows() const { return (short)size().y; }// Ritorna numero di righe
@ -110,8 +110,8 @@ public:
void iconize() const;
void maximize() const;
virtual void enable(bool = TRUE);
void disable() { enable(FALSE); }
virtual void activate(bool = TRUE);
void deactivate() { activate(FALSE); }
void open_modal(); // Mostra la finestra modale
void close_modal(); // Nasconde la finestra modale