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:
parent
3665d52903
commit
a3c51ee273
@ -1103,7 +1103,8 @@ int xvt_dwin_get_text_width(WINDOW win, const char *s, int len)
|
||||
int width = 0;
|
||||
if (s && *s && len != 0)
|
||||
{
|
||||
CAST_DC(win, dc);
|
||||
CAST_DC(win, dc);
|
||||
|
||||
wxString str = s;
|
||||
if (str.StartsWith("ABCDEFGH") || str.StartsWith("MMMMMMMM"))
|
||||
{
|
||||
@ -3877,7 +3878,9 @@ void xvt_vobj_destroy(WINDOW win)
|
||||
xvt_win_set_caret_visible(win, FALSE);
|
||||
w->Destroy(); // same as delete w
|
||||
_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)
|
||||
@ -4044,32 +4047,27 @@ long xvt_vobj_get_attr(WINDOW win, long data)
|
||||
RCT* xvt_vobj_get_client_rect(WINDOW win, RCT *rctp)
|
||||
{
|
||||
XVT_ASSERT(rctp != NULL);
|
||||
int l, h;
|
||||
if (win != NULL_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
|
||||
{
|
||||
l = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
|
||||
h = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
|
||||
}
|
||||
|
||||
rctp->left = rctp->top = 0;
|
||||
rctp->right = l; rctp->bottom = h;
|
||||
return rctp;
|
||||
int l = 0, h = 0;
|
||||
switch (win)
|
||||
{
|
||||
case NULL_WIN:
|
||||
l = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
|
||||
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);
|
||||
return rctp;
|
||||
}
|
||||
|
||||
long xvt_vobj_get_data(WINDOW win)
|
||||
@ -4106,7 +4104,7 @@ XVT_PALETTE xvt_vobj_get_palet(WINDOW WXUNUSED(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;
|
||||
CAST_WIN(win, w);
|
||||
return (WINDOW)w.GetParent();
|
||||
@ -4120,24 +4118,6 @@ char* xvt_vobj_get_title(WINDOW win, char *title, int sz_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 ok = win != NULL_WIN && win != PRINTER_WIN && xvt_vobj_is_valid(win);
|
||||
|
@ -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)
|
||||
{
|
||||
wxASSERT(NbrWindows >= 2);
|
||||
wxASSERT(wins != NULL_WIN && NbrWindows >= 2);
|
||||
for (int i = 0; i < NbrWindows; i++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
TwxTreeCtrl* tc = wxDynamicCast(w, TwxTreeCtrl);
|
||||
if (tc != NULL)
|
||||
switch (xvt_vobj_get_type(win))
|
||||
{
|
||||
tc->SetColors(colors);
|
||||
return;
|
||||
}
|
||||
TwxPropertyGrid* pg = wxDynamicCast(w, TwxPropertyGrid);
|
||||
if (pg != NULL)
|
||||
{
|
||||
pg->SetColors(colors);
|
||||
return;
|
||||
case WC_TREE : wxStaticCast(w, TwxTreeCtrl)->SetColors(colors); return;
|
||||
case WC_PROPGRID: wxStaticCast(w, TwxPropertyGrid)->SetColors(colors); return;
|
||||
case WC_TREELIST: wxStaticCast(w, TwxTreeListCtrl)->SetColors(colors); return;
|
||||
default: break;;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// 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
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ BOOLEAN xvt_app_escape(int esc_code, PRINT_RCD* rcd, long* ph, long* pw, long* p
|
||||
wxPrintData data;
|
||||
|
||||
RCD2data(prcd, data);
|
||||
data.SetOrientation(*ph > *pw ? wxPORTRAIT : wxLANDSCAPE);
|
||||
data.SetOrientation(*ph >= *pw ? wxPORTRAIT : wxLANDSCAPE);
|
||||
data.ConvertToNative();
|
||||
data2RCD(data, prcd);
|
||||
|
||||
@ -541,6 +541,8 @@ BOOLEAN xvt_print_close_page(PRINT_RCD* WXUNUSED(precp))
|
||||
const TwxPrintOut& po = m_PrintoutCache.Get(NULL);
|
||||
wxDC* dc = po.GetDC();
|
||||
dc->EndPage();
|
||||
|
||||
GetTDCMapper().DestroyTDC(PRINTER_WIN); // Elimina dalla lista dei display context
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ TwxPDFDC::TwxPDFDC (const wxPrintData& printData, const char* strFilename)
|
||||
|
||||
for(int i=0; i < PDF_IMG_CACHE_SIZE; i++)
|
||||
{
|
||||
m_filenames[i] = "";
|
||||
m_filenames[i].Empty();
|
||||
m_handles[i] = 0;
|
||||
}
|
||||
m_cacheidx = 0;
|
||||
@ -676,32 +676,39 @@ int TwxPDFDC::GetBitmapHandle(const wxBitmap& bitmap) const
|
||||
int TwxPDFDC::GetImageHandle(const wxString& name)
|
||||
{
|
||||
int intFound = -1;
|
||||
int intNewHandle = -1;
|
||||
for (int i=PDF_IMG_CACHE_SIZE;i>0;i--)
|
||||
{
|
||||
int idx = (i + m_cacheidx) % PDF_IMG_CACHE_SIZE;
|
||||
if (m_filenames[idx]!="" && m_filenames[idx]==name)
|
||||
intFound = idx;
|
||||
if (intFound>=0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (intFound<0 && (intNewHandle=m_PDFlib->PDF_load_image(m_p, "auto", name, 0, ""))>=0)
|
||||
if (!name.IsEmpty())
|
||||
{
|
||||
PDF_TRY_DL(m_PDFlib, m_p)
|
||||
for (int i=PDF_IMG_CACHE_SIZE; i>0; i--)
|
||||
{
|
||||
m_filenames[m_cacheidx] = name;
|
||||
m_handles[m_cacheidx] = intNewHandle;
|
||||
intFound = m_cacheidx;
|
||||
m_cacheidx++;
|
||||
const int idx = (i + m_cacheidx) % PDF_IMG_CACHE_SIZE;
|
||||
if (m_filenames[idx]==name)
|
||||
{
|
||||
intFound = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
PDF_CATCH_DL(m_PDFlib, m_p)
|
||||
// Se non la trovo, provo ad aggiungerla
|
||||
if (intFound<0 && m_cacheidx<PDF_IMG_CACHE_SIZE)
|
||||
{
|
||||
wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p));
|
||||
const int intNewHandle = m_PDFlib->PDF_load_image(m_p, "auto", name, 0, "");
|
||||
if (intNewHandle >=0 )
|
||||
{
|
||||
PDF_TRY_DL(m_PDFlib, m_p)
|
||||
{
|
||||
m_filenames[m_cacheidx] = name;
|
||||
m_handles[m_cacheidx] = intNewHandle;
|
||||
intFound = m_cacheidx++;
|
||||
}
|
||||
PDF_CATCH_DL(m_PDFlib, 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,
|
||||
|
@ -12,7 +12,7 @@ struct PDF_c {};
|
||||
|
||||
class TwxPDFDC : public wxDC
|
||||
{
|
||||
enum { PDF_IMG_CACHE_SIZE = 13 };
|
||||
enum { PDF_IMG_CACHE_SIZE = 32 };
|
||||
|
||||
protected:
|
||||
TwxPDFDC(); // Dummy constructor for dynamic construction
|
||||
|
@ -334,6 +334,8 @@ wxDC& TDC::GetDC(bool bPaint)
|
||||
if (_dirty < 0 || FontChanged())
|
||||
{
|
||||
const wxFont& f = _font.Font(_dc, (WINDOW)_owner);
|
||||
wxASSERT_MSG(f.IsOk(), "Trying to set an invalid font");
|
||||
|
||||
_dc->SetFont(f);
|
||||
_real_font = _font;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user