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
XI_BITMAP* bmpback = get_background_bitmap();
if (bmpback != NULL /* && !tabs */)
if (bmpback != NULL)
{
def->v.itf->back_color = 0;
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;
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
return w;

View File

@ -4186,13 +4186,22 @@ const char* TReal_field::reformat(const char* data) const
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)
{
word s = size();
if (roman())
{
s = decimals();
s = d;
if (s <= 0) s = 4;
}
str.right_just(s, '0');

View File

@ -28,16 +28,17 @@ private:
TString _pdev, _font;
PRINT_RCD* _pcd;
int _pcd_size;
bool _pcd_owned;
protected:
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();
public:
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();
virtual ~TPrinter_setup_mask();
@ -45,18 +46,23 @@ public:
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_size = 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;
return _pcd;
}
void TPrinter_setup_mask::fill_font_list()
int TPrinter_setup_mask::fill_font_list()
{
const int MAX_FAMILIES = 256;
char* family[MAX_FAMILIES];
@ -77,6 +83,8 @@ void TPrinter_setup_mask::fill_font_list()
if (fn.get_pos(oldfont) < 0)
oldfont = fn.get(0);
set(MSK_FONT, oldfont, 0x1);
return num_families;
}
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)
{
TWait_cursor hourglass;
xvt_print_destroy(_pcd);
_pcd = xvt_print_create_by_name(&_pcd_size, pdev);
_pdev = pdev;
fill_font_list();
int tmp_size = 0;
PRINT_RCD* tmp_pcd = xvt_print_create_by_name(&tmp_size, pdev);
if (tmp_pcd != NULL)
{
set_print_rcd(tmp_pcd, tmp_size);
if (fill_font_list() <= 0)
return error_box(TR("La stampante selezionata non risulta essere compatibile"));
}
}
}
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()
: TAutomask("bagn001a")
: TAutomask("bagn001a"), _pcd(NULL), _pcd_size(0), _pcd_owned(false)
{
TPrinter& pr = printer();
set(MSK_FILENAME, pr.get_printerfile());
@ -233,7 +245,14 @@ 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
@ -1774,20 +1793,14 @@ bool TPrinter::set()
TPrinter_setup_mask mask;
const KEY k = mask.run();
_print_rcd = mask.get_print_rcd(_print_rcd_size);
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
if (k != K_ESC)
{
_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
_printertype = fileprinter;

View File

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

View File

@ -152,7 +152,7 @@ class TReport_section : public TArray
char _type; // Head,Body,Tail
int _level; // 0,1,2,...
TPoint _pos; // Posizione assoluta in centesimi, default (0,0)
TPoint _size; // Dimensioni in centesimi, default (0,0)
TPoint _size; // Dimensioni in centesimi, default (0,0)
TString _condition, _groupby;
bool _page_break, _hidden_if_needed, _can_break, _keep_with_next, _repeat;
bool _hidden, _deactivated;
@ -171,7 +171,7 @@ protected:
public:
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); }
const TReport_field& field(int i) const { return *(TReport_field*)objptr(i); }
int find_field_pos(int id);