Patch level : aga 2.0 .385

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Riportata la versione P@rtners 2.0 patch 385


git-svn-id: svn://10.65.10.50/trunk@10801 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2003-02-05 14:26:24 +00:00
parent 1ed89cabb0
commit 33f1088e04
19 changed files with 145 additions and 111 deletions

View File

@ -341,9 +341,9 @@ void TMenu::import(const char* filename, TString& first)
const int bracket = line.rfind('<'); const int bracket = line.rfind('<');
if (bracket > 0) if (bracket > 0)
{ {
TString16 name = line.mid(bracket+1); const int endbracket = line.find('>', bracket);
name.strip("< >"); TFilename name = line.sub(bracket+1, endbracket);
if (fexist(name)) if (name.exist())
{ {
import(name, name); import(name, name);
TMenu_item& child = sub->add_child(line); TMenu_item& child = sub->add_child(line);

View File

@ -1,6 +1,6 @@
#include "cg1700.h" #include "cg1700.h"
PAGE "Stampa causali" -1 -1 70 9 PAGE "Stampa causali" -1 -1 70 10
NUMBER F_CODDITTA 5 NUMBER F_CODDITTA 5
BEGIN BEGIN

View File

@ -124,7 +124,7 @@ int TDate::last_day(int month, int year)
// per default ce n'ha trentuno"); // per default ce n'ha trentuno");
{ {
int d = _days_in_month[month-1]; int d = _days_in_month[month-1];
if (month == 2 && is_leap(year) == 0) if (month == 2 && is_leap(year))
d++; d++;
return d; return d;
} }

View File

@ -2464,6 +2464,7 @@ int TSystemisamfile::load(
s1.rtrim(1); s1.rtrim(1);
s1.ltrim(1); s1.ltrim(1);
} }
if (curr().type((const TString&) fld[j]) == _memofld) if (curr().type((const TString&) fld[j]) == _memofld)
{ {
@ -2473,6 +2474,7 @@ int TSystemisamfile::load(
} }
put((const TString&) fld[j], s1); put((const TString&) fld[j], s1);
} }
} }
@ -2874,7 +2876,7 @@ int TRectype::compare_key(
// @xref <mf TRectype::build_key> // @xref <mf TRectype::build_key>
{ {
TString256 key1= build_key(key); TString256 key1 = build_key(key);
TString256 key2 = rec.build_key(key); TString256 key2 = rec.build_key(key);
if (skip_last > 0) if (skip_last > 0)
{ {

View File

@ -1613,7 +1613,6 @@ public:
void set_header(const char* head); void set_header(const char* head);
void set_row_height(int rh); void set_row_height(int rh);
TTree_field(TMask* m) : TWindowed_field(m) { } TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { } virtual ~TTree_field() { }
}; };
@ -1639,4 +1638,3 @@ public:
}; };
#endif // __MASKFLD_H #endif // __MASKFLD_H

View File

@ -1007,6 +1007,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
static char tmp[16]; static char tmp[16];
static clock_t digit_timer = 0; static clock_t digit_timer = 0;
BOOLEAN& refused = xiev->refused; BOOLEAN& refused = xiev->refused;
@ -1111,6 +1112,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
xiev->v.cell_request.back_color = REQUIRED_BACK_COLOR; xiev->v.cell_request.back_color = REQUIRED_BACK_COLOR;
} }

View File

@ -855,9 +855,10 @@ void TPrinter::init_formlen(
// @comm Nel caso <p prwin> sia NULL_WIN vengono solamente aggiornati i valori // @comm Nel caso <p prwin> sia NULL_WIN vengono solamente aggiornati i valori
{ {
long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, get_printrcd(), &ph, &pw, &pvr, &phr); xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, get_printrcd(), &ph, &pw, &pvr, &phr);
if (pvr != 0) if (pvr > 0)
{ {
_formlen = int(ph * _lines_per_inch / pvr); // Total number of lines per page _formlen = int(ph * _lines_per_inch / pvr); // Total number of lines per page
_dots_per_line = int(pvr / _lines_per_inch); // Number of point per line _dots_per_line = int(pvr / _lines_per_inch); // Number of point per line
@ -891,9 +892,6 @@ void TPrinter::init_formlen(
_horz_offset = 0; _horz_offset = 0;
} }
} }
else
warning_box ("Il driver della stampante non e' valido.\n"
"Non stampare prima di averlo reinstallato");
} }
// Handler della maschera di setup // Handler della maschera di setup
@ -1081,15 +1079,17 @@ void TPrinter::read_configuration(
} }
} }
if (!xvt_print_is_valid(get_printrcd())) if (xvt_print_is_valid(_print_rcd))
{
init_formlen();
_prname = (const char*)_print_rcd + 4; // Deep hacking
}
else
{ {
error_box("Attenzione: la stampante corrente non e' valida.\n" error_box("Attenzione: la stampante corrente non e' valida.\n"
"Si prega di selezionare e registrare una nuova stampante."); "Si prega di selezionare e registrare una nuova stampante.");
set_printrcd(); set_printrcd();
} }
init_formlen();
_prname = (const char*)get_printrcd() + 4; // Deep hacking
} }
delete iniptr; iniptr = NULL; delete iniptr; iniptr = NULL;

View File

@ -354,7 +354,7 @@ bool TPrintwin::do_print()
ok = rct != NULL; ok = rct != NULL;
if (ok) if (ok)
{ {
// set_font(XVT_FFN_SYSTEM, XVT_FS_NONE, _char_size); set_font(XVT_FFN_SYSTEM, XVT_FS_NONE, _char_size); // ???
set_font(printer().fontname(), XVT_FS_NONE, _char_size); set_font(printer().fontname(), XVT_FS_NONE, _char_size);
LEN_SPACES(win(), -1); // Resetta bene le dimensioni font LEN_SPACES(win(), -1); // Resetta bene le dimensioni font
ok = print_band(page, *rct); ok = print_band(page, *rct);

View File

@ -833,6 +833,7 @@ public:
void set_header(const char* head); void set_header(const char* head);
void set_row_height(int rh); void set_row_height(int rh);
TTree_window(int x, int y, int dx, int dy, TTree_window(int x, int y, int dx, int dy,
WINDOW parent, TTree_field* owner); WINDOW parent, TTree_field* owner);
virtual ~TTree_window() { } virtual ~TTree_window() { }
@ -1415,7 +1416,6 @@ void TTree_field::set_row_height(int rh)
} }
TField_window* TTree_field::create_window(int x, int y, int dx, int dy, WINDOW parent) TField_window* TTree_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{ {
return new TTree_window(x, y, dx, dy, parent, this); return new TTree_window(x, y, dx, dy, parent, this);

View File

@ -3738,24 +3738,11 @@ void TPlanning_app ::openfiles()
} }
bool TPlanning_app ::create() bool TPlanning_app ::create()
{ {
if (TSkeleton_application::create())
{
openfiles(); openfiles();
_m = new TPlanning_mask(); _m = new TPlanning_mask();
_m->field(F_MSCHEDULEPLAN).set(" "); _m->field(F_MSCHEDULEPLAN).set(" ");
return TRUE; return TSkeleton_application::create();
}
return FALSE;
}
bool TPlanning_app::menu(MENU_TAG mt)
{
bool ok = TRUE;
if (mt == MENU_ITEM(1))
mask().sel().run();
else
ok = TSkeleton_application::menu(mt);
return ok;
} }
void TPlanning_app::main_loop() void TPlanning_app::main_loop()
@ -3779,4 +3766,3 @@ int mr2200(int argc, char* argv[])
a.run(argc, argv, "Pianificazione ordini"); a.run(argc, argv, "Pianificazione ordini");
return 0; return 0;
} }

View File

@ -24,24 +24,11 @@ protected:
bool TOrdAcq_app::create() bool TOrdAcq_app::create()
{ {
if (TSkeleton_application::create())
{
openfiles(); openfiles();
_m = new TOrdAcq_mask(); _m = new TOrdAcq_mask();
_m->field(F_MSCHEDULEPLAN).set(" "); _m->field(F_MSCHEDULEPLAN).set(" ");
_m->disable_page(4); _m->disable_page(4);
// Li facciamo gestire return TSkeleton_application::create();
// _m->sfield(F_ARTICOLI).delete_column(F_CODIMP-FIRST_FIELD);
// _m->sfield(F_ARTICOLI).delete_column(F_CODLIN-FIRST_FIELD);
// _m->set(F_NOIMP_IN,"X");
// _m->hide(F_NOIMP_IN);
// _m->set(F_NOLIN_IN,"X");
// _m->hide(F_NOLIN_IN);
return TRUE;
}
return FALSE;
} }
int mr2400(int argc, char* argv[]) int mr2400(int argc, char* argv[])

View File

@ -1897,7 +1897,6 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
else else
_righe_iva->add(r, conto, ALL_DECIMALS, perc); _righe_iva->add(r, conto, ALL_DECIMALS, perc);
} }
r.put(RDOC_CODIVA, codiva2); //Restore r.put(RDOC_CODIVA, codiva2); //Restore
} }

View File

@ -2360,7 +2360,6 @@ bool TDocumento_mask::controeuro_handler( TMask_field& f, KEY key )
bool TDocumento_mask::codval_handler( TMask_field& f, KEY key ) bool TDocumento_mask::codval_handler( TMask_field& f, KEY key )
{ {
if (key == K_TAB && f.focusdirty()) if (key == K_TAB && f.focusdirty())
{ {

View File

@ -133,15 +133,20 @@ void* OsWin32_GetPrinterInfo(int& size, const char* printer)
else else
strcpy(name, printer); strcpy(name, printer);
LPDEVMODE pdm = (LPDEVMODE) new char[16*1024]; LPDEVMODE pdm = NULL;
HANDLE hPrinter; HANDLE hPrinter;
if (::OpenPrinter(name, &hPrinter, NULL) == 0) if (::OpenPrinter(name, &hPrinter, NULL) != 0)
return NULL; {
size = ::DocumentProperties(0, hPrinter, name, NULL, NULL, 0); // Determina dimensione DEVMODE
::DocumentProperties(0, hPrinter, name, pdm, NULL, DM_OUT_BUFFER); if (size > 0)
{
pdm = (LPDEVMODE) new char[size]; // Alloca un DEVMODE sufficientemente capiente
::DocumentProperties(0, hPrinter, name, pdm, NULL, DM_OUT_BUFFER); // Legge DEVMODE
}
else
size = 0;
::ClosePrinter(hPrinter); ::ClosePrinter(hPrinter);
}
size = pdm->dmSize + pdm->dmDriverExtra;
return pdm; return pdm;
} }

View File

@ -4,6 +4,7 @@ void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nSize);
void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nSize); void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nSize);
void OsWin32_DrawBitmap(unsigned int hBitmap, unsigned int hDC, void OsWin32_DrawBitmap(unsigned int hBitmap, unsigned int hDC,
int xd, int yd, int wd, int hd, int xs, int ys, int ws, int hs); int xd, int yd, int wd, int hd, int xs, int ys, int ws, int hs);
void OsWin32_DrawSmallIcon(unsigned int hIcon, unsigned int hDC, int x, int y);
int OsWin32_EnumerateFamilies(unsigned int hDC, char** families, int max_count); int OsWin32_EnumerateFamilies(unsigned int hDC, char** families, int max_count);
int OsWin32_EnumerateSizes(unsigned int hDC, const char* name, long* sizes, short* scalable, int max_count); int OsWin32_EnumerateSizes(unsigned int hDC, const char* name, long* sizes, short* scalable, int max_count);
void OsWin32_SetCaptionStyle(unsigned int handle, bool set); void OsWin32_SetCaptionStyle(unsigned int handle, bool set);

View File

@ -34,15 +34,17 @@ static EVENT_HANDLER _task_win_handler = NULL;
static XVT_ERRMSG_HANDLER _error_handler = NULL; static XVT_ERRMSG_HANDLER _error_handler = NULL;
void XVT_ASSERT(bool test, XVT_ERRSEV sev = SEV_FATAL) #define XVT_ASSERT(test) assert_box((test), __LINE__)
void assert_box(bool test, int line)
{ {
if (!test) if (!test)
{ {
bool display = (_error_handler == NULL) || (_error_handler(sev, NULL) == FALSE); bool display = (_error_handler == NULL) || (_error_handler(SEV_FATAL, NULL) == FALSE);
if (display) if (display)
{ {
const wxString strMessage = "We're very sorry, but you passed some invalid parameters..."; const wxString strMessage = wxString::Format("Sorry, the application passed some invalid parameters on line %d.", line);
const wxString strCaption = "Emulated XVT Error"; const wxString strCaption = "Emulated XVT Error ";
::wxMessageBox(strMessage, strCaption, wxOK|wxICON_ERROR); ::wxMessageBox(strMessage, strCaption, wxOK|wxICON_ERROR);
} }
} }
@ -309,6 +311,12 @@ TDC::~TDC()
KillDC(); KillDC();
} }
void TDC::SetDirty(int d)
{
if (_dirty >= 0)
_dirty = d;
}
static int PatternToStyle(PAT_STYLE pat) static int PatternToStyle(PAT_STYLE pat)
{ {
int style; int style;
@ -440,7 +448,7 @@ wxDC& TDC::GetDC(bool bPaint)
if (_dirty < 0 || FontChanged()) if (_dirty < 0 || FontChanged())
{ {
_dc->SetFont(_font.Font()); _dc->SetFont(_font.Font(_dc));
_real_font = _font; _real_font = _font;
} }
@ -468,7 +476,6 @@ void TDC::SetClippingBox(const RCT* pRct)
_dc->DestroyClippingRegion(); _dc->DestroyClippingRegion();
#endif #endif
wxRect rct = NormalizeRCT(pRct); wxRect rct = NormalizeRCT(pRct);
// rct.width++; rct.height++;
GetDC().SetClippingRegion(rct); GetDC().SetClippingRegion(rct);
_clip = *pRct; _clip = *pRct;
} }
@ -476,9 +483,9 @@ void TDC::SetClippingBox(const RCT* pRct)
{ {
if (_dc != NULL) // Inutile resettare il nulla! if (_dc != NULL) // Inutile resettare il nulla!
_dc->DestroyClippingRegion(); _dc->DestroyClippingRegion();
// xvt_rect_set_empty(&_clip);
_clip.left = _clip.top = 0; _clip.left = _clip.top = 0;
_clip.right = _clip.bottom = 32000; _clip.right = _clip.bottom = 32000;
} }
} }
@ -1374,7 +1381,7 @@ BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, un
{ {
TFontId& font = *(TFontId*)font_id; TFontId& font = *(TFontId*)font_id;
wxFontData data; wxFontData data;
data.SetInitialFont(font.Font()); data.SetInitialFont(font.Font(NULL));
data.EnableEffects(FALSE); data.EnableEffects(FALSE);
wxFontDialog dlg(_task_win, &data); wxFontDialog dlg(_task_win, &data);
BOOLEAN ok = dlg.ShowModal() == wxID_OK; BOOLEAN ok = dlg.ShowModal() == wxID_OK;
@ -1595,7 +1602,6 @@ int TFontId::Family() const
return wxMODERN; return wxMODERN;
if (m_strFace == XVT_FFN_SYSTEM) if (m_strFace == XVT_FFN_SYSTEM)
return wxDEFAULT; return wxDEFAULT;
return wxROMAN; return wxROMAN;
} }
@ -1609,15 +1615,47 @@ bool TFontId::Underline() const
return (m_wMask & XVT_FS_UNDERLINE) != 0; return (m_wMask & XVT_FS_UNDERLINE) != 0;
} }
wxFont& TFontId::Font() const
wxFont& TFontId::Font(wxDC* dc) const
{ {
int nSize = PointSize(); int nSize = PointSize();
if (m_win == _print_win) if (m_win == _print_win)
{ {
long ph, pw, pvr, phr; static wxDC* lastDC = NULL;
xvt_app_escape(XVT_ESC_GET_PRINTER_INFO, NULL, &ph, &pw, &pvr, &phr); static double dPrintScale = 1.0;
nSize = pvr*nSize/120;
if (dc != lastDC)
{
const wxSize ppi = dc->GetPPI();
dPrintScale = ppi.x / 96.0; // First guess for scaling factor
int nBestSize = 0;
double nMin = dPrintScale-0.1;
double nMax = dPrintScale+0.1;
while (true)
{
const double nScale = (nMin+nMax)/2.0;
const int nFontSize = int(12.0 * nScale); // First guess for PointSize
if (nFontSize == nBestSize)
break;
wxFont courier(nFontSize, wxMODERN, wxNORMAL, wxNORMAL);
dc->SetFont(courier);
int tw; dc->GetTextExtent("0123456789", &tw, NULL);
if (tw > ppi.x)
nMax = nScale;
else
{
nMin = nScale;
nBestSize = nFontSize;
} }
}
dPrintScale = nBestSize / 12.0;
lastDC = dc;
}
nSize = int(nSize * dPrintScale);
}
const int nWeight = (m_wMask & XVT_FS_BOLD) ? wxBOLD : wxNORMAL; const int nWeight = (m_wMask & XVT_FS_BOLD) ? wxBOLD : wxNORMAL;
wxFont* font = wxTheFontList->FindOrCreateFont( wxFont* font = wxTheFontList->FindOrCreateFont(
nSize, Family(), Style(), nWeight, Underline(), FaceName()); nSize, Family(), Style(), nWeight, Underline(), FaceName());
@ -1658,7 +1696,6 @@ void xvt_dwin_draw_arc(WINDOW Win, RCT* r, int sx, int sy, int ex, int ey)
void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid) void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid)
{ {
wxIcon* ico = ::GetIconResource(rid); wxIcon* ico = ::GetIconResource(rid);
XVT_ASSERT(ico != NULL);
if (ico) if (ico)
{ {
CAST_DC(win, dc); CAST_DC(win, dc);
@ -1848,14 +1885,14 @@ void xvt_dwin_set_back_color(WINDOW win, COLOR color)
{ {
CAST_TDC(win, dc); CAST_TDC(win, dc);
dc._dct.back_color = color; dc._dct.back_color = color;
dc._dirty = true; dc.SetDirty();
} }
void xvt_dwin_set_cbrush(WINDOW win, CBRUSH* cbrush) void xvt_dwin_set_cbrush(WINDOW win, CBRUSH* cbrush)
{ {
CAST_TDC(win, dc); CAST_TDC(win, dc);
memcpy(&dc._dct.brush, cbrush, sizeof(CBRUSH)); memcpy(&dc._dct.brush, cbrush, sizeof(CBRUSH));
dc._dirty = true; dc.SetDirty();
} }
void xvt_dwin_set_clip(WINDOW win, RCT* rctp) void xvt_dwin_set_clip(WINDOW win, RCT* rctp)
@ -1868,21 +1905,21 @@ void xvt_dwin_set_cpen(WINDOW win, CPEN* cpen)
{ {
CAST_TDC(win, dc); CAST_TDC(win, dc);
memcpy(&dc._dct.pen, cpen, sizeof(CPEN)); memcpy(&dc._dct.pen, cpen, sizeof(CPEN));
dc._dirty = true; dc.SetDirty();
} }
void xvt_dwin_set_draw_ctools(WINDOW win, DRAW_CTOOLS* xct) void xvt_dwin_set_draw_ctools(WINDOW win, DRAW_CTOOLS* xct)
{ {
CAST_TDC(win, dc); CAST_TDC(win, dc);
memcpy(&dc._dct, xct, sizeof(DRAW_CTOOLS)); memcpy(&dc._dct, xct, sizeof(DRAW_CTOOLS));
dc._dirty = true; dc.SetDirty();
} }
void xvt_dwin_set_draw_mode(WINDOW win, DRAW_MODE mode) void xvt_dwin_set_draw_mode(WINDOW win, DRAW_MODE mode)
{ {
CAST_TDC(win, dc); CAST_TDC(win, dc);
dc._dct.mode = mode; dc._dct.mode = mode;
dc._dirty = true; dc.SetDirty();
} }
void xvt_dwin_set_font(WINDOW win, XVT_FNTID font_id) void xvt_dwin_set_font(WINDOW win, XVT_FNTID font_id)
@ -1893,7 +1930,7 @@ void xvt_dwin_set_font(WINDOW win, XVT_FNTID font_id)
if (dc._font != font) if (dc._font != font)
{ {
dc._font = font; dc._font = font;
dc._dirty = true; dc.SetDirty();
} }
} }
@ -1901,7 +1938,7 @@ void xvt_dwin_set_fore_color(WINDOW win, COLOR color)
{ {
CAST_TDC(win, dc); CAST_TDC(win, dc);
dc._dct.fore_color = color; dc._dct.fore_color = color;
dc._dirty = true; dc.SetDirty();
} }
void xvt_dwin_set_std_cpen(WINDOW win, long flag) void xvt_dwin_set_std_cpen(WINDOW win, long flag)
@ -2037,7 +2074,7 @@ void xvt_font_get_metrics(XVT_FNTID font_id, int *leadingp, int *ascentp, int *d
CAST_DC(win, dc); CAST_DC(win, dc);
const wxString str = "Mq"; const wxString str = "Mq";
int height, desc, lead; int height, desc, lead;
dc.GetTextExtent(str, NULL, &height, &desc, &lead, &font.Font()); dc.GetTextExtent(str, NULL, &height, &desc, &lead, &font.Font(&dc));
if (leadingp) if (leadingp)
*leadingp = lead; *leadingp = lead;
if (ascentp) if (ascentp)
@ -2048,8 +2085,8 @@ void xvt_font_get_metrics(XVT_FNTID font_id, int *leadingp, int *ascentp, int *d
BOOLEAN xvt_font_get_native_desc(XVT_FNTID font_id, char *buf, long max_buf) BOOLEAN xvt_font_get_native_desc(XVT_FNTID font_id, char *buf, long max_buf)
{ {
*buf = '\0'; // Ignored long len = xvt_font_serialize(font_id, buf, max_buf);
return TRUE; return len > 0;
} }
long xvt_font_get_size(XVT_FNTID font_id) long xvt_font_get_size(XVT_FNTID font_id)

View File

@ -31,7 +31,7 @@ public:
int Family() const; int Family() const;
void Copy(const wxFont& rFont); void Copy(const wxFont& rFont);
wxFont& Font() const; wxFont& Font(wxDC* dc) const;
TFontId& operator=(const TFontId& f) { Copy(f); return *this; } TFontId& operator=(const TFontId& f) { Copy(f); return *this; }
bool operator==(const TFontId& f) const { return IsEqual(f); } bool operator==(const TFontId& f) const { return IsEqual(f); }
@ -48,6 +48,7 @@ class TDC : public wxObject
protected: protected:
wxDC* _dc; wxDC* _dc;
RCT _clip; RCT _clip;
int _dirty; // false = 0, true = 1, very_dirty = -1;
DRAW_CTOOLS _real_dct; DRAW_CTOOLS _real_dct;
TFontId _real_font; TFontId _real_font;
@ -59,13 +60,11 @@ protected:
public: public:
DRAW_CTOOLS _dct; DRAW_CTOOLS _dct;
TFontId _font; TFontId _font;
int _dirty; // false = 0, true = 1, very_dirty = -1;
wxPoint _pnt; wxPoint _pnt;
void SetClippingBox(const RCT* pRct); void SetClippingBox(const RCT* pRct);
bool GetClippingBox(RCT* pRct) const; bool GetClippingBox(RCT* pRct) const;
void SetDirty(int d = 1);
virtual wxDC& GetDC(bool bPaint = false); virtual wxDC& GetDC(bool bPaint = false);
void KillDC(); void KillDC();

View File

@ -123,6 +123,8 @@ TwxPrintOut::~TwxPrintOut()
wxDC& TPrintDC::GetDC(bool) wxDC& TPrintDC::GetDC(bool)
{ {
_dc = m_po->GetDC(); // Forza display context corrente _dc = m_po->GetDC(); // Forza display context corrente
if (_dirty)
_dirty = -1;
return TDC::GetDC(false); return TDC::GetDC(false);
} }
@ -140,9 +142,11 @@ TPrintDC::~TPrintDC()
BOOLEAN xvt_app_escape(int esc_code, PRINT_RCD* rcd, long* ph, long* pw, long* pvr, long* phr) BOOLEAN xvt_app_escape(int esc_code, PRINT_RCD* rcd, long* ph, long* pw, long* pvr, long* phr)
{ {
*ph = *pw = *pvr = *phr = 0;
switch (esc_code) switch (esc_code)
{ {
case XVT_ESC_GET_PRINTER_INFO: case XVT_ESC_GET_PRINTER_INFO:
if (rcd == NULL || xvt_print_is_valid(rcd))
{ {
const bool temp = m_po == NULL; const bool temp = m_po == NULL;
if (temp) if (temp)
@ -157,8 +161,9 @@ BOOLEAN xvt_app_escape(int esc_code, PRINT_RCD* rcd, long* ph, long* pw, long* p
delete m_po; delete m_po;
m_po = NULL; m_po = NULL;
} }
}
return TRUE; return TRUE;
}
break;
default: default:
break; break;
} }
@ -247,30 +252,40 @@ BOOLEAN xvt_print_close_page(PRINT_RCD* /*precp*/)
PRINT_RCD* xvt_print_create(int *sizep) PRINT_RCD* xvt_print_create(int *sizep)
{ {
TPRINT_RCD* pr = new TPRINT_RCD; TPRINT_RCD* pr = NULL;
*sizep = 0;
#ifdef WIN32 #ifdef WIN32
void* data = OsWin32_GetPrinterInfo(*sizep, NULL); void* data = OsWin32_GetPrinterInfo(*sizep, NULL);
if (data != NULL)
{
pr = new TPRINT_RCD;
pr->SetData(data, *sizep); pr->SetData(data, *sizep);
delete data;
*sizep += 4; // Spazio per puntatore iniziale *sizep += 4; // Spazio per puntatore iniziale
#else delete data;
*sizep = 0; }
#endif #endif
return pr; return pr;
} }
// Nuova funzione inventata da Aga // Nuova funzione inventata da Aga
PRINT_RCD* xvt_print_create_by_name(int* sizep, const char* name) PRINT_RCD* xvt_print_create_by_name(int* sizep, const char* name)
{ {
TPRINT_RCD* pr = new TPRINT_RCD; TPRINT_RCD* pr = NULL;
*sizep = 0;
#ifdef WIN32 #ifdef WIN32
void* data = OsWin32_GetPrinterInfo(*sizep, name); void* data = OsWin32_GetPrinterInfo(*sizep, name);
if (data != NULL)
{
pr = new TPRINT_RCD;
pr->SetData(data, *sizep); pr->SetData(data, *sizep);
delete data;
*sizep += 4; // Spazio per puntatore iniziale *sizep += 4; // Spazio per puntatore iniziale
#else delete data;
*sizep = 0; }
#endif #endif
return pr; return pr;
} }
@ -343,11 +358,15 @@ BOOLEAN xvt_print_start_thread(BOOLEAN(*print_fcn)(long), long data)
return TRUE; return TRUE;
} }
BOOLEAN xvt_print_open_page(PRINT_RCD* /* precp */) BOOLEAN xvt_print_open_page(PRINT_RCD* precp)
{ {
BOOLEAN ok = m_po != NULL; BOOLEAN ok = m_po != NULL;
if (ok) if (ok)
{
// TPRINT_RCD* rcd = (TPRINT_RCD*)precp;
// m_po->InitDC(rcd);
m_po->GetDC()->StartPage(); m_po->GetDC()->StartPage();
}
return ok; return ok;
} }