Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Figate dell'ultimo momento e aggiunte diemnticate


git-svn-id: svn://10.65.10.50/trunk@8008 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1999-04-02 11:03:12 +00:00
parent e7ee308a15
commit 1ec0fe70d1
8 changed files with 123 additions and 55 deletions

View File

@ -1339,17 +1339,25 @@ void TButton_control::create(WINDOW win, short cid,
TString txt(text); TString txt(text);
char mnemonic = '\0'; char mnemonic = '\0';
int underscore = txt.find('~'); int underscore = -1;
if (underscore < 0) if (wc == WC_PUSHBUTTON)
underscore = txt.find('&'); {
if (underscore >= 0) underscore = txt.find('~');
mnemonic = txt[underscore+1]; if (underscore < 0)
underscore = txt.find('&');
txt.strip("&~"); if (underscore >= 0)
mnemonic = txt[underscore+1];
txt.strip("&~");
}
const char* t = parse_caption(txt, bold, color); const char* t = parse_caption(txt, bold, color);
if (width <= 0) width = strlen(t)+3; if (width <= 0) width = strlen(t)+3;
RCT rct; coord2rct(win, left, top, width, height, rct); RCT rct; coord2rct(win, left, top, width, height, rct);
if (wc == WC_PUSHBUTTON && height == 1) // Troppo bassi!
{
rct.top--;
rct.bottom++;
}
const unsigned long attrib = flags2attr(flags); const unsigned long attrib = flags2attr(flags);
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, (XinRect *) &rct, attrib, (char*)t, cid); XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, (XinRect *) &rct, attrib, (char*)t, cid);

View File

@ -17,7 +17,7 @@
#include <defmask.h> #include <defmask.h>
#endif #endif
#include "../ba/bafrm.h" #include "/u/guy/p.due/ba/bafrm.h"
// per lo sheet di edit campi // per lo sheet di edit campi
HIDDEN const int idt_id = 101; HIDDEN const int idt_id = 101;

21
include/journal.h Executable file
View File

@ -0,0 +1,21 @@
#ifndef __JOURNAL_H
#define __JOURNAL_H
#pragma pack(4)
struct TJournalHeader
{
char _signature[4];
long _header_length;
time_t _time;
long _firm;
long _logic_num;
char _operation[4];
char _type[4];
long _data_size;
char _name[32];
};
#pragma pack()
#endif

View File

@ -1053,6 +1053,8 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (xiev->v.xi_obj->type == XIT_ROW) if (xiev->v.xi_obj->type == XIT_ROW)
{ {
_check_enabled = FALSE; _check_enabled = FALSE;
owner().mask().notify_focus_field(owner().dlg());
if (_cell_dirty) if (_cell_dirty)
off_cell_handler(); off_cell_handler();
@ -1090,13 +1092,10 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
TMask_field& button = sm.fld(button_pos); TMask_field& button = sm.fld(button_pos);
if (button.active()) if (button.active())
{ {
str2mask(_cur_rec); // Non commentare! notify_change();
button.on_hit(); button.on_hit();
if (sm.dirty()) if (sm.dirty())
{
notify_change();
mask2str(_cur_rec); mask2str(_cur_rec);
}
} }
} }
owner().highlight(); owner().highlight();
@ -1428,13 +1427,10 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
TMask_field& button = sm.fld(button_pos); TMask_field& button = sm.fld(button_pos);
if (button.active()) if (button.active())
{ {
str2mask(_cur_rec); notify_change();
button.on_hit(); button.on_hit();
if (sm.dirty()) if (sm.dirty())
{
notify_change();
mask2str(_cur_rec); mask2str(_cur_rec);
}
} }
} }
_check_enabled = TRUE; _check_enabled = TRUE;

View File

@ -402,6 +402,9 @@ int TRecord_array::remove() const
// TFile_cache // TFile_cache
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
unsigned long TFile_cache::_hits = 0;
unsigned long TFile_cache::_miss = 0;
TFile_cache::TFile_cache(TLocalisamfile *f , int key) TFile_cache::TFile_cache(TLocalisamfile *f , int key)
: _file(NULL), _key(key), _last_firm(-883), : _file(NULL), _key(key), _last_firm(-883),
_test_changes(FALSE), _last_read(0), _limit(0) _test_changes(FALSE), _last_read(0), _limit(0)
@ -558,7 +561,10 @@ const TObject& TFile_cache::query(const char* code)
} }
obj = rec2obj(curr); obj = rec2obj(curr);
_cache.add(_code, obj); _cache.add(_code, obj);
_miss++;
} }
else
_hits++;
return *obj; return *obj;
} }
@ -581,6 +587,7 @@ long TFile_cache::fill()
test_firm(); test_firm();
TLocalisamfile& f = file(); TLocalisamfile& f = file();
TRectype& curr = f.curr(); TRectype& curr = f.curr();
const RecDes* recd = curr.rec_des(); // Descrizione del record della testata const RecDes* recd = curr.rec_des(); // Descrizione del record della testata
const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave

View File

@ -152,6 +152,8 @@ class TFile_cache : public TObject
long _last_read, _limit; long _last_read, _limit;
bool _test_changes; bool _test_changes;
static unsigned long _hits, _miss;
protected: protected:
TAssoc_array _cache; TAssoc_array _cache;

View File

@ -519,28 +519,26 @@ int TRelation_application::delete_mode()
TToken_string items(brw->items()); TToken_string items(brw->items());
items.insert(" |", 0); items.insert(" |", 0);
TPointer_array keys;
int tab1 = 0, tab2 = 0, y = 0; int tab1 = 0, tab2 = 0, y = 0;
for (int kf = 0; ; kf++) // Nuovo modo basato sugli input
TToken_string inplist = brw->get_input_fields();
if (inplist.not_empty())
{ {
TEditable_field* e = _mask->get_key_field(1, kf == 0); FOR_EACH_TOKEN(inplist, tok)
if (e) {
{ if (*tok != '"' && strchr(tok, '@') == NULL)
if (e->shown())
{ {
keys.add(e); TMask_field& e = _mask->field(short(atoi(tok)));
if (e->enabled()) if (e.active())
{ {
const int len = strlen(e->prompt()); const int len = strlen(e.prompt());
if (len > tab1) tab1 = len; if (len > tab1) tab1 = len;
const int size = e->size(); const int size = e.size();
if (size > tab2) tab2 = size; if (size > tab2) tab2 = size;
y++; y++;
} }
} }
} }
else
break;
} }
tab1 += 5; tab1 += 5;
tab2 += tab1+2; tab2 += tab1+2;
@ -550,11 +548,15 @@ int TRelation_application::delete_mode()
y = -1; // Posizione del campo precedente y = -1; // Posizione del campo precedente
TString prompt; // Prompt del campo corrente TString prompt; // Prompt del campo corrente
for(int k = 0; k < keys.items(); k++)
FOR_EACH_TOKEN(inplist, tok)
{ {
TEditable_field& e = (TEditable_field&)keys[k]; if (*tok != '"' && strchr(tok, '@') == NULL)
if (e.enabled())
{ {
TMask_field& e = _mask->field(atoi(tok));
if (!e.active())
continue;
const short id = 1000+e.dlg(); const short id = 1000+e.dlg();
prompt = "Da "; prompt << e.prompt(); prompt = "Da "; prompt << e.prompt();
sht.add_static(DLG_NULL, 0, prompt, 1, ++y); sht.add_static(DLG_NULL, 0, prompt, 1, ++y);
@ -584,7 +586,7 @@ int TRelation_application::delete_mode()
} }
} }
sht.open(); sht.open_modal();
KEY tasto; KEY tasto;
bool keep_running = TRUE; bool keep_running = TRUE;
@ -594,18 +596,40 @@ int TRelation_application::delete_mode()
if (tasto == K_ENTER) if (tasto == K_ENTER)
{ {
TRectype rec_from(cur.file().num()), rec_to(cur.file().num()); TRectype rec_from(cur.file().num()), rec_to(cur.file().num());
for(int k = 0; k < keys.items(); k++) TToken_string fldlist = brw->get_input_field_names();
{ TString80 str;
TEditable_field& e = (TEditable_field&)keys[k]; int fi = 0;
const TFieldref* ref = e.field(); for (TString80 tok = inplist.get(fi); tok.not_empty(); tok = inplist.get(), fi++)
if (ref) {
{ const TString16 fn = fldlist.get(fi);
const TString& fr = e.enabled() ? sht.get(e.dlg()+1000) : e.get(); if (*tok == '"')
ref->write(fr, rec_from); {
const TString& to = e.enabled() ? sht.get(e.dlg()+2000) : e.get(); str = tok;
if (to.not_empty()) ref->write(to, rec_to); str.ltrim(1); str.rtrim(1);
rec_from.put(fn, str);
rec_to.put(fn, str);
} }
else
{
const short id = short(atoi(tok));
if (sht.id2pos(id+1000) >= 0)
{
str = sht.get(id+1000);
if (str.not_empty())
rec_from.put(fn, str);
str = sht.get(id+2000);
if (str.not_empty())
rec_to.put(fn, str);
}
else
{
str = _mask->get(id);
rec_from.put(fn, str);
rec_to.put(fn, str);
}
}
} }
cur.curr() = rec_from; cur.curr() = rec_from;
cur.read(); cur.read();
while (cur.file().status() == NOERR && cur.curr() <= rec_to) while (cur.file().status() == NOERR && cur.curr() <= rec_to)
@ -619,23 +643,23 @@ int TRelation_application::delete_mode()
keep_running = FALSE; keep_running = FALSE;
if (tasto == K_DEL && sht.checked() == 0) if (tasto == K_DEL && sht.checked() == 0)
{ {
error_box("Non e' stato selezionato nessun documento"); error_box("Non e' stato selezionato nessun elemento");
sht.select(0); sht.select(0);
keep_running = TRUE; keep_running = TRUE;
} }
} }
} }
sht.close(); sht.close_modal();
if (tasto == K_DEL) if (tasto == K_DEL)
{ {
long deleting = sht.checked(); long deleting = sht.checked();
TString msg; TString msg;
msg = "Confermate l'eliminazione de"; msg = "Confermate l'eliminazione d";
if (deleting == 1) if (deleting == 1)
msg << "l documento selezionato?"; msg << "ell'elemento selezionato?";
else else
msg << "i " << deleting << " documenti selezionati?"; msg << "i " << deleting << " elementi selezionati?";
bool can_delete = yesno_box(msg); bool can_delete = yesno_box(msg);
if (can_delete && deleting > 100) if (can_delete && deleting > 100)
@ -679,9 +703,9 @@ int TRelation_application::delete_mode()
if (skipped > 0) if (skipped > 0)
{ {
if (skipped == 1) if (skipped == 1)
warning_box("Un documento non e' stato cancellato in quanto protetto."); warning_box("Un elemento non e' stato cancellato in quanto protetto.");
else else
warning_box("%ld documenti non sono stati cancellati in quanto protetti.", skipped); warning_box("%ld elementi non sono stati cancellati in quanto protetti.", skipped);
} }
} }
} }

View File

@ -395,9 +395,14 @@ int TString::find(
// Nel caso <p from> sia maggiore della lunghezza della stringa manda // Nel caso <p from> sia maggiore della lunghezza della stringa manda
// un messaggio di errore // un messaggio di errore
{ {
CHECKD(from <= len(), "Trying to find past end of string", from); int pos = -1;
const char* p = strchr(_str + from, c); if (from < len())
return p ? int(p - _str) : -1; {
const char* p = strchr(_str + from, c);
if (p)
pos = int(p - _str);
}
return pos;
} }
int TString::rfind( int TString::rfind(
@ -429,9 +434,14 @@ HIDDEN char* strstr(const char* string1, const char* string2)
// Certified 100% // Certified 100%
int TString::find(const char* s, int from) const int TString::find(const char* s, int from) const
{ {
CHECKD(from <= len(), "Trying to find past end of string", from); int pos = -1;
const char* p = strstr(_str + from, s); if (from < len())
return p ? int(p - _str) : -1; {
const char* p = strstr(_str + from, s);
if (p)
pos = int(p - _str);
}
return pos;
} }
bool TString::match(const char* pat) const bool TString::match(const char* pat) const