Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/branches/R_10_00@21974 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-04-18 15:29:46 +00:00
parent 3665d52903
commit a3c51ee273
6 changed files with 95 additions and 79 deletions

View File

@ -1104,6 +1104,7 @@ int xvt_dwin_get_text_width(WINDOW win, const char *s, int len)
if (s && *s && len != 0) if (s && *s && len != 0)
{ {
CAST_DC(win, dc); CAST_DC(win, dc);
wxString str = s; wxString str = s;
if (str.StartsWith("ABCDEFGH") || str.StartsWith("MMMMMMMM")) if (str.StartsWith("ABCDEFGH") || str.StartsWith("MMMMMMMM"))
{ {
@ -3877,7 +3878,9 @@ void xvt_vobj_destroy(WINDOW win)
xvt_win_set_caret_visible(win, FALSE); xvt_win_set_caret_visible(win, FALSE);
w->Destroy(); // same as delete w w->Destroy(); // same as delete w
_nice_windows.Delete(win); // Elimina "di nuovo" dalla lista delle finestre attive _nice_windows.Delete(win); // Elimina "di nuovo" dalla lista delle finestre attive
} } else
if (win == PRINTER_WIN)
GetTDCMapper().DestroyTDC(win);
} }
static long xvt_vobj_get_metric(WINDOW win, wxSystemMetric data) static long xvt_vobj_get_metric(WINDOW win, wxSystemMetric data)
@ -4044,31 +4047,26 @@ long xvt_vobj_get_attr(WINDOW win, long data)
RCT* xvt_vobj_get_client_rect(WINDOW win, RCT *rctp) RCT* xvt_vobj_get_client_rect(WINDOW win, RCT *rctp)
{ {
XVT_ASSERT(rctp != NULL); XVT_ASSERT(rctp != NULL);
int l, h; int l = 0, h = 0;
if (win != NULL_WIN) switch (win)
{
if (win == PRINTER_WIN)
{
l = h = 6000; // circa A4 height
} else
if (win == SCREEN_WIN)
{
l = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
h = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) - 32; // Puerile tentativo di escludere la task bar
} else
{
CAST_WIN(win, w);
w.GetClientSize(&l, &h);
}
}
else // NULL_WIN = schermo intero
{ {
case NULL_WIN:
l = wxSystemSettings::GetMetric(wxSYS_SCREEN_X); l = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
h = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y); h = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
break;
case 882: // SCREEN_WIN
l = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
h = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) - 32; // Puerile tentativo di escludere la task bar
break;
case PRINTER_WIN:
l = 4600; h = 6800; // circa A4 size at 600 DPI
break;
default:
CAST_WIN(win, w);
w.GetClientSize(&l, &h);
break;
} }
xvt_rect_set(rctp, 0, 0, l, h);
rctp->left = rctp->top = 0;
rctp->right = l; rctp->bottom = h;
return rctp; return rctp;
} }
@ -4106,7 +4104,7 @@ XVT_PALETTE xvt_vobj_get_palet(WINDOW WXUNUSED(win))
WINDOW xvt_vobj_get_parent(WINDOW win) WINDOW xvt_vobj_get_parent(WINDOW win)
{ {
if (win == NULL_WIN || win == TASK_WIN) if (win == NULL_WIN || win == TASK_WIN || win == SCREEN_WIN)
return NULL_WIN; return NULL_WIN;
CAST_WIN(win, w); CAST_WIN(win, w);
return (WINDOW)w.GetParent(); return (WINDOW)w.GetParent();
@ -4120,24 +4118,6 @@ char* xvt_vobj_get_title(WINDOW win, char *title, int sz_title)
return title; return title;
} }
WIN_TYPE xvt_vobj_get_type(WINDOW win)
{
if (win == NULL_WIN)
return W_NONE;
if (win == TASK_WIN)
return W_TASK;
if (win == SCREEN_WIN)
return W_SCREEN;
if (win == PRINTER_WIN)
return W_PRINT;
TwxWindow* w = wxDynamicCast((wxObject*)win, TwxWindow);
if (w != NULL)
return w->_type;
return WO_TE; // Unknown custom control
}
BOOLEAN xvt_vobj_is_focusable(WINDOW win) BOOLEAN xvt_vobj_is_focusable(WINDOW win)
{ {
BOOLEAN ok = win != NULL_WIN && win != PRINTER_WIN && xvt_vobj_is_valid(win); BOOLEAN ok = win != NULL_WIN && win != PRINTER_WIN && xvt_vobj_is_valid(win);

View File

@ -391,7 +391,7 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
void xvt_ctl_check_radio_button(WINDOW win, WINDOW* wins, int NbrWindows) void xvt_ctl_check_radio_button(WINDOW win, WINDOW* wins, int NbrWindows)
{ {
wxASSERT(NbrWindows >= 2); wxASSERT(wins != NULL_WIN && NbrWindows >= 2);
for (int i = 0; i < NbrWindows; i++) for (int i = 0; i < NbrWindows; i++)
{ {
wxRadioButton* rb = wxDynamicCast((wxObject*)wins[i], wxRadioButton); wxRadioButton* rb = wxDynamicCast((wxObject*)wins[i], wxRadioButton);
@ -415,17 +415,12 @@ void xvt_ctl_set_colors(WINDOW win, const XVT_COLOR_COMPONENT* colors, XVT_COLOR
{ {
if (action == XVT_COLOR_ACTION_SET) if (action == XVT_COLOR_ACTION_SET)
{ {
TwxTreeCtrl* tc = wxDynamicCast(w, TwxTreeCtrl); switch (xvt_vobj_get_type(win))
if (tc != NULL)
{ {
tc->SetColors(colors); case WC_TREE : wxStaticCast(w, TwxTreeCtrl)->SetColors(colors); return;
return; case WC_PROPGRID: wxStaticCast(w, TwxPropertyGrid)->SetColors(colors); return;
} case WC_TREELIST: wxStaticCast(w, TwxTreeListCtrl)->SetColors(colors); return;
TwxPropertyGrid* pg = wxDynamicCast(w, TwxPropertyGrid); default: break;;
if (pg != NULL)
{
pg->SetColors(colors);
return;
} }
for (int i = 0; colors[i].type; i++) for (int i = 0; colors[i].type; i++)
{ {
@ -3173,3 +3168,33 @@ XVT_TREEVIEW_NODE xvt_treelist_find_node_string(WINDOW win, const char* text)
} }
return node; return node;
} }
///////////////////////////////////////////////////////////
// Sad but needed migration from xvaga.cpp
///////////////////////////////////////////////////////////
WIN_TYPE xvt_vobj_get_type(WINDOW win)
{
if (win == NULL_WIN)
return W_NONE;
if (win == TASK_WIN)
return W_TASK;
if (win == SCREEN_WIN)
return W_SCREEN;
if (win == PRINTER_WIN)
return W_PRINT;
const TwxWindow* w = wxDynamicCast((wxObject*)win, TwxWindow);
if (w != NULL)
return w->_type;
const wxControl* ctl = wxDynamicCast((wxObject*)win, wxControl);
if (ctl != NULL)
{
if (ctl->IsKindOf(CLASSINFO(wxTreeCtrl))) return WC_TREE;
if (ctl->IsKindOf(CLASSINFO(wxPropertyGrid))) return WC_PROPGRID;
if (ctl->IsKindOf(CLASSINFO(wxTreeListCtrl))) return WC_TREELIST;
}
return WO_TE; // Unknown custom control
}

View File

@ -430,7 +430,7 @@ BOOLEAN xvt_app_escape(int esc_code, PRINT_RCD* rcd, long* ph, long* pw, long* p
wxPrintData data; wxPrintData data;
RCD2data(prcd, data); RCD2data(prcd, data);
data.SetOrientation(*ph > *pw ? wxPORTRAIT : wxLANDSCAPE); data.SetOrientation(*ph >= *pw ? wxPORTRAIT : wxLANDSCAPE);
data.ConvertToNative(); data.ConvertToNative();
data2RCD(data, prcd); data2RCD(data, prcd);
@ -541,6 +541,8 @@ BOOLEAN xvt_print_close_page(PRINT_RCD* WXUNUSED(precp))
const TwxPrintOut& po = m_PrintoutCache.Get(NULL); const TwxPrintOut& po = m_PrintoutCache.Get(NULL);
wxDC* dc = po.GetDC(); wxDC* dc = po.GetDC();
dc->EndPage(); dc->EndPage();
GetTDCMapper().DestroyTDC(PRINTER_WIN); // Elimina dalla lista dei display context
} }
return ok; return ok;
} }

View File

@ -27,7 +27,7 @@ TwxPDFDC::TwxPDFDC (const wxPrintData& printData, const char* strFilename)
for(int i=0; i < PDF_IMG_CACHE_SIZE; i++) for(int i=0; i < PDF_IMG_CACHE_SIZE; i++)
{ {
m_filenames[i] = ""; m_filenames[i].Empty();
m_handles[i] = 0; m_handles[i] = 0;
} }
m_cacheidx = 0; m_cacheidx = 0;
@ -676,32 +676,39 @@ int TwxPDFDC::GetBitmapHandle(const wxBitmap& bitmap) const
int TwxPDFDC::GetImageHandle(const wxString& name) int TwxPDFDC::GetImageHandle(const wxString& name)
{ {
int intFound = -1; int intFound = -1;
int intNewHandle = -1;
if (!name.IsEmpty())
{
for (int i=PDF_IMG_CACHE_SIZE; i>0; i--) for (int i=PDF_IMG_CACHE_SIZE; i>0; i--)
{ {
int idx = (i + m_cacheidx) % PDF_IMG_CACHE_SIZE; const int idx = (i + m_cacheidx) % PDF_IMG_CACHE_SIZE;
if (m_filenames[idx]!="" && m_filenames[idx]==name) if (m_filenames[idx]==name)
{
intFound = idx; intFound = idx;
if (intFound>=0)
break; break;
} }
}
if (intFound<0 && (intNewHandle=m_PDFlib->PDF_load_image(m_p, "auto", name, 0, ""))>=0) // Se non la trovo, provo ad aggiungerla
if (intFound<0 && m_cacheidx<PDF_IMG_CACHE_SIZE)
{
const int intNewHandle = m_PDFlib->PDF_load_image(m_p, "auto", name, 0, "");
if (intNewHandle >=0 )
{ {
PDF_TRY_DL(m_PDFlib, m_p) PDF_TRY_DL(m_PDFlib, m_p)
{ {
m_filenames[m_cacheidx] = name; m_filenames[m_cacheidx] = name;
m_handles[m_cacheidx] = intNewHandle; m_handles[m_cacheidx] = intNewHandle;
intFound = m_cacheidx; intFound = m_cacheidx++;
m_cacheidx++;
} }
PDF_CATCH_DL(m_PDFlib, m_p) PDF_CATCH_DL(m_PDFlib, m_p)
{ {
wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p)); wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p));
} }
} }
}
}
return m_handles[intFound]; return intFound >= 0 ? m_handles[intFound] : -1;
} }
bool TwxPDFDC::DoBlit( wxCoord xdest, wxCoord ydest, bool TwxPDFDC::DoBlit( wxCoord xdest, wxCoord ydest,

View File

@ -12,7 +12,7 @@ struct PDF_c {};
class TwxPDFDC : public wxDC class TwxPDFDC : public wxDC
{ {
enum { PDF_IMG_CACHE_SIZE = 13 }; enum { PDF_IMG_CACHE_SIZE = 32 };
protected: protected:
TwxPDFDC(); // Dummy constructor for dynamic construction TwxPDFDC(); // Dummy constructor for dynamic construction

View File

@ -334,6 +334,8 @@ wxDC& TDC::GetDC(bool bPaint)
if (_dirty < 0 || FontChanged()) if (_dirty < 0 || FontChanged())
{ {
const wxFont& f = _font.Font(_dc, (WINDOW)_owner); const wxFont& f = _font.Font(_dc, (WINDOW)_owner);
wxASSERT_MSG(f.IsOk(), "Trying to set an invalid font");
_dc->SetFont(f); _dc->SetFont(f);
_real_font = _font; _real_font = _font;