Patch level : 2.0 664

Files correlati     : librerie, ma soprattutto ve
Ricompilazione Demo : [ ]
Commento            :

array.cpp    indentazione
controls.cpp doppio click sui listbox
form.cpp     indentazione
isamrpc.cpp  migliore generazione password per dongle server
printer.cpp  migliore get_printer_name
progind.cpp  migliore calcolo dei tempi di attesa
relapp.cpp   corretta gestione tasto ESC


git-svn-id: svn://10.65.10.50/trunk@11679 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-12-19 08:15:17 +00:00
parent 94e00bac25
commit 5e957d628a
8 changed files with 70 additions and 40 deletions

View File

@ -672,13 +672,15 @@ TBit_array::~TBit_array()
// Certified 100% // Certified 100%
void TBit_array::set() void TBit_array::set()
{ {
if (_bit) memset(_bit, 0xFF, _size); if (_bit)
memset(_bit, 0xFF, _size);
} }
// Certified 100% // Certified 100%
void TBit_array::reset() void TBit_array::reset()
{ {
if (_bit) memset(_bit, 0x0, _size); if (_bit)
memset(_bit, 0x0, _size);
} }
// Certified 99% // Certified 99%

View File

@ -1971,18 +1971,26 @@ void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev)
} }
break; break;
case XIE_XVT_EVENT: case XIE_XVT_EVENT:
if (xiev->v.xvte.type == E_CHAR) switch (xiev->v.xvte.type)
{ {
const KEY k = xiev->v.xvte.v.chr.ch; case E_CHAR:
if (k == K_ENTER || k == K_ESC)
ddl->close();
else
{ {
if (k >= ' ' && k <= 'z') const KEY k = xiev->v.xvte.v.chr.ch;
ddl->select_by_initial(char(k)); if (k == K_ENTER || k == K_ESC)
} ddl->close();
else
{
if (k >= ' ' && k <= 'z')
ddl->select_by_initial(char(k));
}
}
break;
case E_MOUSE_DBL:
ddl->close();
break;
default:
break;
} }
break;
default: default:
break; break;
} }
@ -2235,8 +2243,13 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
{ {
case XIE_DBL_FIELD: case XIE_DBL_FIELD:
case XIE_BUTTON: case XIE_BUTTON:
if (!_ddl->is_open() && !_button_blocked) if (!_button_blocked)
_ddl->open(); {
if (_ddl->is_open())
_ddl->close();
else
_ddl->open();
}
break; break;
case XIE_CHAR_FIELD: case XIE_CHAR_FIELD:
{ {
@ -2269,6 +2282,11 @@ void TDropDownList::on_mouse_down(const PNT& pt)
if (_open) if (_open)
{ {
RCT rct; RCT rct;
xi_get_rect(_obj, (XinRect*)&rct);
if (xvt_rect_has_point(&rct, pt))
return; // E' nel campo di testo proprietario della lista
xvt_vobj_get_outer_rect((WINDOW)xi_get_window(_xi_lst->itf), &rct); xvt_vobj_get_outer_rect((WINDOW)xi_get_window(_xi_lst->itf), &rct);
if (!xvt_rect_has_point(&rct, pt)) if (!xvt_rect_has_point(&rct, pt))
close(); close();

View File

@ -2425,7 +2425,7 @@ void TPrint_section::reset()
// Aggiorna tutti i campi // Aggiorna tutti i campi
bool TPrint_section::update() bool TPrint_section::update()
{ {
bool ok = TRUE; bool ok = true;
reset(); reset();
for (word i = 0; i < fields(); i++) for (word i = 0; i < fields(); i++)
@ -2433,7 +2433,8 @@ bool TPrint_section::update()
if (!field(i).is_section()) if (!field(i).is_section())
{ {
const bool esito = field(i).update(); const bool esito = field(i).update();
if (!esito) ok = FALSE; if (!esito)
ok = false;
} }
} }
@ -2445,7 +2446,6 @@ bool TPrint_section::update()
return ok; return ok;
} }
TForm_item* TPrint_section::exist_field(short id) const TForm_item* TPrint_section::exist_field(short id) const
{ {
TForm_item* f = find_field_everywhere(id,this); TForm_item* f = find_field_everywhere(id,this);

View File

@ -1,6 +1,5 @@
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <time.h> #include <time.h>
#include <checks.h> #include <checks.h>
@ -18,6 +17,7 @@ bool rpc_Start()
bool ok = TRUE; bool ok = TRUE;
if (_client == NULL) if (_client == NULL)
{ {
srand(clock());
_client = new TSocketClient; _client = new TSocketClient;
if (!_client->IsOk()) if (!_client->IsOk())
{ {
@ -216,7 +216,6 @@ unsigned rpc_DongleYear()
static unsigned int CreatePassword(TString& pass) static unsigned int CreatePassword(TString& pass)
{ {
const int BASE = 19; const int BASE = 19;
srand(clock());
unsigned int num = 0; unsigned int num = 0;
do do
{ {
@ -235,7 +234,7 @@ static unsigned int CreatePassword(TString& pass)
num /= BASE; num /= BASE;
pass.insert(str); pass.insert(str);
} }
} while (pass.len() < 6); } while (pass.len() < 5);
return num; return num;
} }

View File

@ -46,7 +46,7 @@ void TPrinter_setup_mask::set_print_rcd(PRINT_RCD* pcd, int size)
{ {
_pcd = pcd; _pcd = pcd;
_pcd_size = size; _pcd_size = size;
_pdev = ((const char*)pcd)+4; xvt_print_get_name(pcd, _pdev.get_buffer(), _pdev.size());
} }
PRINT_RCD* TPrinter_setup_mask::get_print_rcd(int& size) const PRINT_RCD* TPrinter_setup_mask::get_print_rcd(int& size) const
@ -148,9 +148,9 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
if (xvt_dm_post_page_setup(_pcd)) if (xvt_dm_post_page_setup(_pcd))
{ {
// see if user has changed printer // see if user has changed printer
// determine index of currently selected printer // determine name of currently selected printer
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE! TString name;
const char* name = (const char *)(_pcd) + 4; xvt_print_get_name(_pcd, name.get_buffer(), name.size());
set(MSK_PRINTERS, name, 0x1); set(MSK_PRINTERS, name, 0x1);
} }
} }
@ -1104,18 +1104,15 @@ void TPrinter::set_printrcd()
{ {
_print_rcd = xvt_print_create_by_name(&_print_rcd_size, _prname); _print_rcd = xvt_print_create_by_name(&_print_rcd_size, _prname);
ok = xvt_print_is_valid(_print_rcd) != 0; ok = xvt_print_is_valid(_print_rcd) != 0;
if (!ok)
error_box(FR("Errore di inizializzazione della stampante %s"), (const char*)_prname);
} }
if (!ok) if (!ok)
{ {
_print_rcd = xvt_print_create(&_print_rcd_size); _print_rcd = xvt_print_create(&_print_rcd_size);
xvt_print_get_name(_print_rcd, _prname.get_buffer(), _prname.size());
ok = xvt_print_is_valid(_print_rcd) != 0; ok = xvt_print_is_valid(_print_rcd) != 0;
if (ok)
_prname = ((const char*)_print_rcd)+4;
else
error_box(TR("Errore di inizializzazione della stampante corrente"));
} }
if (!ok)
error_box(FR("Errore di inizializzazione della stampante %s"), (const char*)_prname);
} }
PRINT_RCD* TPrinter::get_printrcd(int *size) PRINT_RCD* TPrinter::get_printrcd(int *size)
@ -1294,7 +1291,7 @@ void TPrinter::read_configuration(
if (xvt_print_is_valid(_print_rcd)) if (xvt_print_is_valid(_print_rcd))
{ {
init_formlen(); init_formlen();
_prname = (const char*)_print_rcd + 4; // Deep hacking xvt_print_get_name(_print_rcd, _prname.get_buffer(), _prname.size());
} }
else else
{ {

View File

@ -22,13 +22,10 @@ word TIndwin::measure_text(TToken_string& s, word& maxlen) const
} }
// Certified 70% // Certified 70%
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div) TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
: _text(NULL), _cancel(NULL), _bar(0), : _text(NULL), _cancel(NULL), _bar(0),
_status(0L), _max(max), _flags(0x0) _status(0L), _max(tot), _flags(0x0)
{ {
if (_max <= 0)
_max = 1;
TToken_string testo(txt, '\n'); TToken_string testo(txt, '\n');
word maxlen = div; word maxlen = div;
const word lines = measure_text(testo, maxlen); const word lines = measure_text(testo, maxlen);
@ -57,7 +54,7 @@ TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
do_events(); do_events();
_indwin_count++; _indwin_count++;
_start_time = clock(); setmax(tot);
} }
// @doc EXTERNAL // @doc EXTERNAL
@ -86,6 +83,12 @@ void TIndwin::set_text(
} }
} }
void TIndwin::setmax(long m)
{
_max = m <= 0 ? 1 : m;
_start_time = clock();
}
TIndwin::~TIndwin() TIndwin::~TIndwin()
{ {
if (is_open()) if (is_open())

View File

@ -90,6 +90,9 @@ public:
// @cmember Setta il testo della finestra // @cmember Setta il testo della finestra
void set_text(const char* t); void set_text(const char* t);
// @cmember Setta il valore massimo della barra d'attesa
void setmax(long m);
// @cmember Costruttore // @cmember Costruttore
TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 60); TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 60);
// @cmember Distruttore // @cmember Distruttore
@ -106,9 +109,6 @@ class TProgind : public TIndwin
{ {
// @access Public Member // @access Public Member
public: public:
// @cmember Setta il valore massimo della barra d'attesa
void setmax(long m)
{ _max = m; }
// @cmember Setta lo stato della barra d'attesa // @cmember Setta lo stato della barra d'attesa
bool setstatus(long l); bool setstatus(long l);
// @cmember Aggiorna la barra d'attesa aggiungendo l'incremento fatto dell'applicazione // @cmember Aggiorna la barra d'attesa aggiungendo l'incremento fatto dell'applicazione

View File

@ -1030,8 +1030,19 @@ bool TRelation_application::save(bool check_dirty)
if (annulla) if (annulla)
{ {
TMask_field& ff = _mask->focus_field();
if (ff.focusdirty() && ff.is_edit()) // I need simulate tab on the current field!
{
if (!ff.on_key(K_TAB))
{
_mask->first_focus(-ff.dlg());
was_dirty = TRUE;
return FALSE;
}
}
if (!_mask->check_fields()) // Exit with ESC didn't check values if (!_mask->check_fields()) // Exit with ESC didn't check values
{ {
// check_fields sets the focus on the blocking field
_mask->first_focus(-_mask->focus_field().dlg()); _mask->first_focus(-_mask->focus_field().dlg());
was_dirty = TRUE; was_dirty = TRUE;
return FALSE; return FALSE;