Patch level : 10.0 146

Files correlati     : tutti
Ricompilazione Demo : [ ]
Commento            :
Migliorata gestione stampanti in modo da non bloccare Campo,
quando si selezionino stampanti non compatibili


git-svn-id: svn://10.65.10.50/trunk@17538 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-11-03 12:01:37 +00:00
parent ad8effc4fc
commit 7b324606fd
6 changed files with 54 additions and 30 deletions

View File

@ -565,7 +565,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
def->v.itf->menu_win = (XinWindow)TASK_WIN; // Window that owns the menu def->v.itf->menu_win = (XinWindow)TASK_WIN; // Window that owns the menu
XI_BITMAP* bmpback = get_background_bitmap(); XI_BITMAP* bmpback = get_background_bitmap();
if (bmpback != NULL /* && !tabs */) if (bmpback != NULL)
{ {
def->v.itf->back_color = 0; def->v.itf->back_color = 0;
def->v.itf->bitmap = bmpback; def->v.itf->bitmap = bmpback;

View File

@ -1292,6 +1292,10 @@ WINDOW TMask::create_bar(int height)
{ {
const long flags = TOOL_TEXT ? CTL_FLAG_PASSWORD : 0; const long flags = TOOL_TEXT ? CTL_FLAG_PASSWORD : 0;
w = xvt_toolbar_create(-1, 0, 0, -1, TOOL_SIZE, flags, win()); // Top bar w = xvt_toolbar_create(-1, 0, 0, -1, TOOL_SIZE, flags, win()); // Top bar
XVT_COLOR_COMPONENT cc[4]; memset(cc, 0, sizeof(cc));
cc[0].type = XVT_COLOR_TROUGH; cc[0].color = MASK_BACK_COLOR;
cc[1].type = XVT_COLOR_FOREGROUND; cc[1].color = NORMAL_COLOR;
xvt_ctl_set_colors(w, cc, XVT_COLOR_ACTION_SET);
} }
insert_bar(w); // Inserisce toolbar e crea notebook, se necessario insert_bar(w); // Inserisce toolbar e crea notebook, se necessario
return w; return w;

View File

@ -4186,13 +4186,22 @@ const char* TReal_field::reformat(const char* data) const
if (!real::is_null(data)) if (!real::is_null(data))
{ {
str = data; const int d = decimals();
word s = size();
if (d == 0 && s <= 6)
{
str.format("%ld", atol(data)); // Gestione "veloce" degli interi
}
else
{
const real r(data); // Gestione standard dei reali
str = r.string(0, decimals());
}
if (_flags.zerofilled) if (_flags.zerofilled)
{ {
word s = size();
if (roman()) if (roman())
{ {
s = decimals(); s = d;
if (s <= 0) s = 4; if (s <= 0) s = 4;
} }
str.right_just(s, '0'); str.right_just(s, '0');

View File

@ -28,16 +28,17 @@ private:
TString _pdev, _font; TString _pdev, _font;
PRINT_RCD* _pcd; PRINT_RCD* _pcd;
int _pcd_size; int _pcd_size;
bool _pcd_owned;
protected: protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
void fill_font_list(); int fill_font_list();
void fill_size_list(); void fill_size_list();
public: public:
void set_print_rcd(PRINT_RCD* pcd, int size); void set_print_rcd(PRINT_RCD* pcd, int size);
PRINT_RCD* get_print_rcd(int& size) const; PRINT_RCD* get_print_rcd(int& size);
TPrinter_setup_mask(); TPrinter_setup_mask();
virtual ~TPrinter_setup_mask(); virtual ~TPrinter_setup_mask();
@ -45,18 +46,23 @@ public:
void TPrinter_setup_mask::set_print_rcd(PRINT_RCD* pcd, int size) void TPrinter_setup_mask::set_print_rcd(PRINT_RCD* pcd, int size)
{ {
if (_pcd != NULL && _pcd_owned)
xvt_print_destroy(_pcd);
_pcd_owned = _pcd != NULL; // Sto impostando una nuova stampante
_pcd = pcd; _pcd = pcd;
_pcd_size = size; _pcd_size = size;
xvt_print_get_name(pcd, _pdev.get_buffer(), _pdev.size()); 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)
{ {
_pcd_owned = false;
size = _pcd_size; size = _pcd_size;
return _pcd; return _pcd;
} }
void TPrinter_setup_mask::fill_font_list() int TPrinter_setup_mask::fill_font_list()
{ {
const int MAX_FAMILIES = 256; const int MAX_FAMILIES = 256;
char* family[MAX_FAMILIES]; char* family[MAX_FAMILIES];
@ -77,6 +83,8 @@ void TPrinter_setup_mask::fill_font_list()
if (fn.get_pos(oldfont) < 0) if (fn.get_pos(oldfont) < 0)
oldfont = fn.get(0); oldfont = fn.get(0);
set(MSK_FONT, oldfont, 0x1); set(MSK_FONT, oldfont, 0x1);
return num_families;
} }
void TPrinter_setup_mask::fill_size_list() void TPrinter_setup_mask::fill_size_list()
@ -125,10 +133,14 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
if (pdev != _pdev) if (pdev != _pdev)
{ {
TWait_cursor hourglass; TWait_cursor hourglass;
xvt_print_destroy(_pcd); int tmp_size = 0;
_pcd = xvt_print_create_by_name(&_pcd_size, pdev); PRINT_RCD* tmp_pcd = xvt_print_create_by_name(&tmp_size, pdev);
_pdev = pdev; if (tmp_pcd != NULL)
fill_font_list(); {
set_print_rcd(tmp_pcd, tmp_size);
if (fill_font_list() <= 0)
return error_box(TR("La stampante selezionata non risulta essere compatibile"));
}
} }
} }
break; break;
@ -182,7 +194,7 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
} }
TPrinter_setup_mask::TPrinter_setup_mask() TPrinter_setup_mask::TPrinter_setup_mask()
: TAutomask("bagn001a") : TAutomask("bagn001a"), _pcd(NULL), _pcd_size(0), _pcd_owned(false)
{ {
TPrinter& pr = printer(); TPrinter& pr = printer();
set(MSK_FILENAME, pr.get_printerfile()); set(MSK_FILENAME, pr.get_printerfile());
@ -233,7 +245,14 @@ TPrinter_setup_mask::TPrinter_setup_mask()
} }
TPrinter_setup_mask::~TPrinter_setup_mask() TPrinter_setup_mask::~TPrinter_setup_mask()
{ } {
if (_pcd_owned && _pcd != NULL)
{
xvt_print_destroy(_pcd);
_pcd_owned = false;
_pcd = NULL;
}
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TPrinter // TPrinter
@ -1774,20 +1793,14 @@ bool TPrinter::set()
TPrinter_setup_mask mask; TPrinter_setup_mask mask;
const KEY k = mask.run(); const KEY k = mask.run();
_print_rcd = mask.get_print_rcd(_print_rcd_size);
if (k == K_ESC) if (k != K_ESC)
{
xvt_print_destroy(_print_rcd);
_print_rcd = xvt_print_create_by_name(&_print_rcd_size, oldprn);
memcpy(_print_rcd, oldrcd, _print_rcd_size);
}
else
{ {
_manual_setup = true; _manual_setup = true;
_prname = mask.get(MSK_PRINTERS); _print_rcd = mask.get_print_rcd(_print_rcd_size);
xvt_print_get_name(_print_rcd, _prname.get_buffer(80), 80);
switch (atoi (mask.get (MSK_TYPE))) switch (mask.get_int(MSK_TYPE))
{ {
case 1: // file case 1: // file
_printertype = fileprinter; _printertype = fileprinter;

View File

@ -444,11 +444,9 @@ int TReport_section::add(TObject* obj)
return TArray::add(obj); return TArray::add(obj);
} }
int TReport_section::add(TObject& obj) int TReport_section::add(const TObject& obj)
{ {
TReport_field& rf = (TReport_field&)obj; return add(obj.dup());
rf.set_section(this);
return TArray::add(obj);
} }
int TReport_section::find_field_pos(int id) int TReport_section::find_field_pos(int id)

View File

@ -171,7 +171,7 @@ protected:
public: public:
virtual int add(TObject* obj); virtual int add(TObject* obj);
virtual int add(TObject& obj); virtual int add(const TObject& obj);
TReport_field& field(int i) { return *(TReport_field*)objptr(i); } TReport_field& field(int i) { return *(TReport_field*)objptr(i); }
const TReport_field& field(int i) const { return *(TReport_field*)objptr(i); } const TReport_field& field(int i) const { return *(TReport_field*)objptr(i); }
int find_field_pos(int id); int find_field_pos(int id);