Patch level :4.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :aggiunte delle wxCheckVersion per permettere la compilazione con wx263 e wx287


git-svn-id: svn://10.65.10.50/trunk@16007 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2008-01-17 14:05:43 +00:00
parent c8654d38b5
commit 6a81865319
3 changed files with 68 additions and 19 deletions

View File

@ -846,7 +846,7 @@ BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, un
wxFontData data; wxFontData data;
data.SetInitialFont(font.Font(NULL, win)); data.SetInitialFont(font.Font(NULL, win));
data.EnableEffects(reserved != 0); data.EnableEffects(reserved != 0);
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
wxFontDialog dlg(_task_win, data); wxFontDialog dlg(_task_win, data);
#else #else
wxFontDialog dlg(_task_win, &data); wxFontDialog dlg(_task_win, &data);
@ -1201,7 +1201,7 @@ void xvt_dwin_draw_gradient_circular(WINDOW win, const RCT* r, COLOR col1, COLOR
const wxRect rect = NormalizeRCT(r); const wxRect rect = NormalizeRCT(r);
CAST_COLOR(col1, color1); CAST_COLOR(col1, color1);
CAST_COLOR(col2, color2); CAST_COLOR(col2, color2);
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
if (center != NULL) if (center != NULL)
dc.GradientFillConcentric(rect, color1, color2, wxPoint(center->h, center->v)); dc.GradientFillConcentric(rect, color1, color2, wxPoint(center->h, center->v));
else else
@ -1236,7 +1236,7 @@ void xvt_dwin_draw_gradient_linear(WINDOW win, const RCT* r, COLOR col1, COLOR c
case 2: dir = wxLEFT; break; case 2: dir = wxLEFT; break;
default: dir = wxDOWN; break; default: dir = wxDOWN; break;
} }
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
dc.GradientFillLinear(rect, color1, color2, dir); dc.GradientFillLinear(rect, color1, color2, dir);
#else #else
// Gradiente dei poveri // Gradiente dei poveri
@ -2159,8 +2159,18 @@ long xvt_fsys_file_attr(const char* path, long attr)
break; break;
case XVT_FILE_ATTR_SIZE: case XVT_FILE_ATTR_SIZE:
{ {
#if wxCHECK_VERSION(2,8,7)
const wxULongLong sz = wxFileName::GetSize(name); const wxULongLong sz = wxFileName::GetSize(name);
ret = sz.GetHi() != 0 ? INT_MAX : sz.GetLo(); ret = sz.GetHi() != 0 ? INT_MAX : sz.GetLo();
#else
FILE* f = fopen(name, "r");
if (f != NULL)
{
fseek(f, 0, SEEK_END);
ret = ftell(f);
fclose(f);
}
#endif
} }
break; break;
case XVT_FILE_ATTR_MTIME: case XVT_FILE_ATTR_MTIME:
@ -2509,7 +2519,7 @@ BOOLEAN xvt_menu_popup(MENU_ITEM *menu_p, WINDOW win, PNT pos,
for (MENU_ITEM* mi = menu_p; mi != NULL && mi->tag != 0; mi++) for (MENU_ITEM* mi = menu_p; mi != NULL && mi->tag != 0; mi++)
{ {
wxMenuItem* item = NULL; wxMenuItem* item = NULL;
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
if (mi->separator) if (mi->separator)
menu.AppendSeparator(); menu.AppendSeparator();
else else
@ -2661,7 +2671,7 @@ int xvt_rect_get_width(RCT *rctp)
BOOLEAN xvt_rect_has_point(RCT *rctp, PNT pnt) BOOLEAN xvt_rect_has_point(RCT *rctp, PNT pnt)
{ {
const wxRect rct = NormalizeRCT(rctp); const wxRect rct = NormalizeRCT(rctp);
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
return rct.Contains(pnt.h, pnt.v); return rct.Contains(pnt.h, pnt.v);
#else #else
return rct.Inside(pnt.h, pnt.v); return rct.Inside(pnt.h, pnt.v);
@ -2951,7 +2961,7 @@ void xvt_sbar_set_pos(WINDOW win, SCROLL_TYPE t, int pos)
case HVGAUGE: case HVGAUGE:
{ {
CAST_GAUGE(win, g); CAST_GAUGE(win, g);
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
if (g.GetRange() <= 1) if (g.GetRange() <= 1)
g.Pulse(); g.Pulse();
else else
@ -3532,7 +3542,7 @@ int xvt_sys_get_session_id()
unsigned long xvt_sys_get_free_memory() unsigned long xvt_sys_get_free_memory()
{ {
unsigned long mem = 0; unsigned long mem = 0;
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
if (::wxGetFreeMemory().GetHi()) if (::wxGetFreeMemory().GetHi())
mem = -1; mem = -1;
else else
@ -4230,6 +4240,7 @@ WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down) void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
{ {
#if wxCHECK_VERSION(2,8,7)
wxBitmapButton* pb = (wxBitmapButton*)win; wxBitmapButton* pb = (wxBitmapButton*)win;
XVT_ASSERT(pb != NULL); XVT_ASSERT(pb != NULL);
@ -4268,4 +4279,5 @@ void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
pb->SetBitmapSelected(bmpUp); pb->SetBitmapSelected(bmpUp);
} }
} }
#endif
} }

View File

@ -1,6 +1,6 @@
#include "../xvaga/wxinc.h" #include "../xvaga/wxinc.h"
#if wxCHECK_VERSION(2,8,3) #if wxCHECK_VERSION(2,8,7)
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/snglinst.h> #include <wx/snglinst.h>
#endif #endif
@ -10,7 +10,7 @@ extern int xvt_main(int argc, char** argv);
class TMainApp : public wxApp class TMainApp : public wxApp
{ {
wxLocale m_Locale; wxLocale m_Locale;
#if wxCHECK_VERSION(2,8,3) #if wxCHECK_VERSION(2,8,7)
wxSingleInstanceChecker* m_sic; wxSingleInstanceChecker* m_sic;
#endif #endif
@ -42,7 +42,7 @@ void TMainApp::OnTimer(wxTimerEvent& event)
bool TMainApp::OnInit() bool TMainApp::OnInit()
{ {
#if wxCHECK_VERSION(2,8,3) #if wxCHECK_VERSION(2,8,7)
wxFileName strWrk = argv[0]; wxFileName strWrk = argv[0];
const wxString strApp = strWrk.GetName().Lower(); const wxString strApp = strWrk.GetName().Lower();
m_sic = new wxSingleInstanceChecker(strApp); m_sic = new wxSingleInstanceChecker(strApp);
@ -56,7 +56,7 @@ bool TMainApp::OnInit()
int TMainApp::OnExit() int TMainApp::OnExit()
{ {
#if wxCHECK_VERSION(2,8,3) #if wxCHECK_VERSION(2,8,7)
delete m_sic; delete m_sic;
m_sic = NULL; m_sic = NULL;
#endif #endif

View File

@ -4,10 +4,12 @@
#include "xvt.h" #include "xvt.h"
#include "xvtwin.h" #include "xvtwin.h"
#include "wx/image.h"
#include "wx/notebook.h" #include "wx/notebook.h"
#include "wx/treectrl.h" #include "wx/treectrl.h"
#if wxCHECK_VERSION(2,8,7)
#include "wx/aui/aui.h" #include "wx/aui/aui.h"
#endif
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Utilities // Utilities
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -469,6 +471,13 @@ bool TwxWindowBase::CreateBase(wxWindow *parent, wxWindowID id, const wxString &
// Evita inutili sfarfallamenti in quanto wxWidgets crea le finestre visibili per default // Evita inutili sfarfallamenti in quanto wxWidgets crea le finestre visibili per default
wxWindowBase::Show(false); wxWindowBase::Show(false);
bool ok = Create(parent, id, pos, size, style, title); bool ok = Create(parent, id, pos, size, style, title);
if (ok)
{
#if wxCHECK_VERSION(2,8,7)
#else
SetTitle(title); // Triste necessita', la Create sembra ignorare il titolo
#endif
}
return ok; return ok;
} }
@ -493,7 +502,7 @@ BEGIN_EVENT_TABLE(TwxWindow, TwxWindowBase)
EVT_MIDDLE_DOWN(TwxWindow::OnMouseDown) EVT_MIDDLE_DOWN(TwxWindow::OnMouseDown)
EVT_MIDDLE_UP(TwxWindow::OnMouseUp) EVT_MIDDLE_UP(TwxWindow::OnMouseUp)
EVT_MOTION(TwxWindow::OnMouseMove) EVT_MOTION(TwxWindow::OnMouseMove)
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
EVT_MOUSE_CAPTURE_LOST(TwxWindow::OnMouseCaptureLost) EVT_MOUSE_CAPTURE_LOST(TwxWindow::OnMouseCaptureLost)
#endif #endif
EVT_MOUSEWHEEL(TwxWindow::OnMouseWheel) EVT_MOUSEWHEEL(TwxWindow::OnMouseWheel)
@ -656,7 +665,7 @@ void TwxWindow::OnMenu(wxCommandEvent& evt)
DoXvtEvent(e); DoXvtEvent(e);
} }
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,7)
void TwxWindow::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(e)) void TwxWindow::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(e))
{ {
xvt_win_release_pointer(); xvt_win_release_pointer();
@ -866,7 +875,8 @@ void TwxWindow::SetMenuTree(const MENU_ITEM* tree)
BOOLEAN TwxWindow::AddPane(wxWindow* wnd, const char* caption, int nDock, int nFlags) BOOLEAN TwxWindow::AddPane(wxWindow* wnd, const char* caption, int nDock, int nFlags)
{ {
BOOLEAN ok = wnd != NULL_WIN; BOOLEAN ok = wnd != NULL;
#if wxCHECK_VERSION(2,8,7)
if (ok) if (ok)
{ {
if (m_pManager == NULL) if (m_pManager == NULL)
@ -898,6 +908,7 @@ BOOLEAN TwxWindow::AddPane(wxWindow* wnd, const char* caption, int nDock, int nF
if (ok) if (ok)
m_pManager->Update(); m_pManager->Update();
} }
#endif
return ok; return ok;
} }
@ -918,13 +929,13 @@ TwxWindow::~TwxWindow()
{ {
if (_timer) if (_timer)
delete _timer; delete _timer;
#if wxCHECK_VERSION(2,8,7)
if (m_pManager) if (m_pManager)
{ {
m_pManager->UnInit(); // Obbligatorio ma, chissa' perche', non gestito dal distruttore! m_pManager->UnInit(); // Obbligatorio ma, chissa' perche', non gestito dal distruttore!
delete m_pManager; delete m_pManager;
} }
#endif
if (m_menu) if (m_menu)
{ {
xvt_res_free_menu_tree(m_menu); xvt_res_free_menu_tree(m_menu);
@ -1116,8 +1127,12 @@ public:
class TwxTreeCtrl : public wxTreeCtrl class TwxTreeCtrl : public wxTreeCtrl
{ {
#if wxCHECK_VERSION(2,8,7)
WX_DECLARE_VOIDPTR_HASH_MAP(int, XVT_IMAGE_Map); WX_DECLARE_VOIDPTR_HASH_MAP(int, XVT_IMAGE_Map);
XVT_IMAGE_Map m_img; XVT_IMAGE_Map m_img;
#else
wxHashTable m_img;
#endif
wxFont m_font; wxFont m_font;
int m_nFrozen; int m_nFrozen;
@ -1135,7 +1150,11 @@ protected:
public: public:
void SetNodeImages(const wxTreeItemId& id, XVT_IMAGE item_image, void SetNodeImages(const wxTreeItemId& id, XVT_IMAGE item_image,
XVT_IMAGE collapsed_image, XVT_IMAGE expanded_image); XVT_IMAGE collapsed_image, XVT_IMAGE expanded_image);
#if wxCHECK_VERSION(2,8,7)
virtual bool SetFont(const wxFont& font) { m_font = font; return font.IsOk(); } virtual bool SetFont(const wxFont& font) { m_font = font; return font.IsOk(); }
#else
virtual bool SetFont(const wxFont& font) { m_font = font; return true; }
#endif
virtual wxFont GetFont() const; virtual wxFont GetFont() const;
void Suspend(); void Suspend();
@ -1373,8 +1392,10 @@ short xvt_notebk_get_num_tabs(WINDOW notebk)
void xvt_notebk_set_front_page(WINDOW notebk, short tab_no, short page_no) void xvt_notebk_set_front_page(WINDOW notebk, short tab_no, short page_no)
{ {
#if wxCHECK_VERSION(2,8,7)
CAST_NOTEBOOK(notebk, nb); CAST_NOTEBOOK(notebk, nb);
nb.ChangeSelection(tab_no); // Non generare eventi di cambio pagina! nb.ChangeSelection(tab_no); // Non generare eventi di cambio pagina!
#endif
} }
void xvt_notebk_set_tab_title(WINDOW notebk, short tab_no, const char* title) void xvt_notebk_set_tab_title(WINDOW notebk, short tab_no, const char* title)
@ -1472,7 +1493,11 @@ int TwxTreeCtrl::img2int(XVT_IMAGE xvt_img)
int i = -1; int i = -1;
if (xvt_img != NULL) if (xvt_img != NULL)
{ {
#if wxCHECK_VERSION(2,8,7)
i = m_img[xvt_img] - 1; // Ho memorizzato indice+1 i = m_img[xvt_img] - 1; // Ho memorizzato indice+1
#else
i = (int)m_img.Get((long)xvt_img) - 1;
#endif
if (i < 0) // Immagine sconosciuta if (i < 0) // Immagine sconosciuta
{ {
const wxImage& img = *(wxImage*)xvt_img; const wxImage& img = *(wxImage*)xvt_img;
@ -1484,7 +1509,11 @@ int TwxTreeCtrl::img2int(XVT_IMAGE xvt_img)
AssignImageList(il); // DON'T CALL SetImageList! AssignImageList(il); // DON'T CALL SetImageList!
} }
i = il->Add(wxBitmap(img)); i = il->Add(wxBitmap(img));
#if wxCHECK_VERSION(2,8,7)
m_img[xvt_img] = i+1; // Memorizzo indice+1 m_img[xvt_img] = i+1; // Memorizzo indice+1
#else
m_img.Put((long)xvt_img, (wxObject*)(i+1)); // Memorizzo indice+1
#endif
} }
if (i < 0) if (i < 0)
SORRY_BOX(); SORRY_BOX();
@ -1512,7 +1541,13 @@ void TwxTreeCtrl::SetNodeImages(const wxTreeItemId& id, XVT_IMAGE item_image,
} }
wxFont TwxTreeCtrl::GetFont() const wxFont TwxTreeCtrl::GetFont() const
{ return m_font.IsOk() ? m_font : wxTreeCtrl::GetFont(); } {
#if wxCHECK_VERSION(2,8,7)
return m_font.IsOk() ? m_font : wxTreeCtrl::GetFont();
#else
return wxTreeCtrl::GetFont();
#endif
}
void TwxTreeCtrl::Suspend() void TwxTreeCtrl::Suspend()
{ m_nFrozen++; } { m_nFrozen++; }
@ -1630,9 +1665,11 @@ BOOLEAN xvt_treeview_expand_node(WINDOW win, XVT_TREEVIEW_NODE node, BOOLEAN rec
{ {
CAST_TREEVIEW(win, tv); CAST_TREEVIEW(win, tv);
const wxTreeItemId id(node); const wxTreeItemId id(node);
#if wxCHECK_VERSION(2,8,7)
if (recurse) if (recurse)
tv.ExpandAllChildren(id); tv.ExpandAllChildren(id);
else else
#endif
tv.Expand(id); tv.Expand(id);
} }
return ok; return ok;