Supporto per nuova dll sicurezza
git-svn-id: svn://10.65.10.50/branches/R_10_00@22731 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e1a988050f
commit
8e2a048d2d
2176
xvaga/oswin32.cpp
2176
xvaga/oswin32.cpp
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,27 @@ static const char* xvt_dongle_sa_id()
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* xvt_dongle_sa_product()
|
||||||
|
{
|
||||||
|
static const char* product = NULL;
|
||||||
|
if (product == NULL)
|
||||||
|
{
|
||||||
|
const char* const products[] = { "CAMPO", "Campo", "campo", NULL };
|
||||||
|
for (int i = 0; products[i]; i++)
|
||||||
|
{
|
||||||
|
if (SSA_Login(xvt_dongle_sa_id(), products[i]) == 0)
|
||||||
|
{
|
||||||
|
product = products[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (product == NULL)
|
||||||
|
product = products[0];
|
||||||
|
}
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOLEAN xvt_dongle_sa_is_remote_ba0()
|
static BOOLEAN xvt_dongle_sa_is_remote_ba0()
|
||||||
{
|
{
|
||||||
BOOLEAN yes = FALSE;
|
BOOLEAN yes = FALSE;
|
||||||
@ -76,11 +97,10 @@ int xvt_dongle_sa_login(const char* module)
|
|||||||
{
|
{
|
||||||
if (_ssa_serial < 0)
|
if (_ssa_serial < 0)
|
||||||
{
|
{
|
||||||
err = SSA_Login(xvt_dongle_sa_id(), "Campo");
|
err = SSA_Login(xvt_dongle_sa_id(), xvt_dongle_sa_product());
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
{
|
{
|
||||||
err = _ssa_serial = SSA_NumeroSerie("Campo");
|
err = _ssa_serial = SSA_NumeroSerie(xvt_dongle_sa_product());
|
||||||
|
|
||||||
if (_ssa_timer == NULL && xvt_dongle_sa_is_remote_ba0())
|
if (_ssa_timer == NULL && xvt_dongle_sa_is_remote_ba0())
|
||||||
_ssa_timer = new TSSA_Pinger;
|
_ssa_timer = new TSSA_Pinger;
|
||||||
}
|
}
|
||||||
@ -131,7 +151,7 @@ int xvt_dongle_sa_logout(const char* module)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = SSA_Logout(xvt_dongle_sa_id(), "Campo");
|
err = SSA_Logout(xvt_dongle_sa_id(), xvt_dongle_sa_product());
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
{
|
{
|
||||||
_ssa_serial = SSA_UTENTE_NON_LOGGATO;
|
_ssa_serial = SSA_UTENTE_NON_LOGGATO;
|
||||||
|
794
xvaga/xvtart.cpp
794
xvaga/xvtart.cpp
@ -1,393 +1,393 @@
|
|||||||
#include "wxinc.h"
|
#include "wxinc.h"
|
||||||
|
|
||||||
#include "xvt.h"
|
#include "xvt.h"
|
||||||
#include "xvtart.h"
|
#include "xvtart.h"
|
||||||
#include "oswin32.h"
|
#include "oswin32.h"
|
||||||
|
|
||||||
#include <wx/artprov.h>
|
#include <wx/artprov.h>
|
||||||
#include <wx/aui/aui.h>
|
#include <wx/aui/aui.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
||||||
wxString xvtart_GetResourceIni()
|
wxString xvtart_GetResourceIni()
|
||||||
{
|
{
|
||||||
DIRECTORY dir; xvt_fsys_get_default_dir(&dir);
|
DIRECTORY dir; xvt_fsys_get_default_dir(&dir);
|
||||||
wxString str = dir.path;
|
wxString str = dir.path;
|
||||||
str += "/res/resource.ini";
|
str += "/res/resource.ini";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString xvtart_GetResourceName(const char* type, int rid)
|
wxString xvtart_GetResourceName(const char* type, int rid)
|
||||||
{
|
{
|
||||||
wxString strName(type); strName << "s";
|
wxString strName(type); strName << "s";
|
||||||
wxString strKey; strKey.Printf("%d", rid);
|
wxString strKey; strKey.Printf("%d", rid);
|
||||||
|
|
||||||
DIRECTORY dir; xvt_fsys_get_default_dir(&dir);
|
DIRECTORY dir; xvt_fsys_get_default_dir(&dir);
|
||||||
wxString startup_dir = dir.path;
|
wxString startup_dir = dir.path;
|
||||||
|
|
||||||
if ((rid == ICON_RSRC || rid == 0) && strName == "Icons")
|
if ((rid == ICON_RSRC || rid == 0) && strName == "Icons")
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
switch (xvt_sys_get_os_version())
|
switch (xvt_sys_get_os_version())
|
||||||
{
|
{
|
||||||
case XVT_WS_WIN_2000:
|
case XVT_WS_WIN_2000:
|
||||||
case XVT_WS_WIN_2003: i = 0; break; // Cerco prima l'icona a 256 colori
|
case XVT_WS_WIN_2003: i = 0; break; // Cerco prima l'icona a 256 colori
|
||||||
default : i = 1; break; // Cerco solo l'icona in RGBA
|
default : i = 1; break; // Cerco solo l'icona in RGBA
|
||||||
}
|
}
|
||||||
for (; i < 2; i++)
|
for (; i < 2; i++)
|
||||||
{
|
{
|
||||||
const char* const oem_var = i == 0 ? "Icon256" : "Icon";
|
const char* const oem_var = i == 0 ? "Icon256" : "Icon";
|
||||||
char name[MAX_PATH];
|
char name[MAX_PATH];
|
||||||
if (xvt_sys_get_oem_string(oem_var, "", name, sizeof(name)))
|
if (xvt_sys_get_oem_string(oem_var, "", name, sizeof(name)))
|
||||||
{
|
{
|
||||||
wxFileName fname(startup_dir + "/setup/" + name);
|
wxFileName fname(startup_dir + "/setup/" + name);
|
||||||
if (fname.FileExists())
|
if (fname.FileExists())
|
||||||
{
|
{
|
||||||
fname.Normalize();
|
fname.Normalize();
|
||||||
strName = fname.GetFullPath().Lower();
|
strName = fname.GetFullPath().Lower();
|
||||||
return strName;
|
return strName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString val;
|
wxString val;
|
||||||
char* buff = val.GetWriteBuf(MAX_PATH);
|
char* buff = val.GetWriteBuf(MAX_PATH);
|
||||||
xvt_sys_get_profile_string(xvtart_GetResourceIni(), strName, strKey, "", buff, MAX_PATH);
|
xvt_sys_get_profile_string(xvtart_GetResourceIni(), strName, strKey, "", buff, MAX_PATH);
|
||||||
val.UngetWriteBuf();
|
val.UngetWriteBuf();
|
||||||
|
|
||||||
if (!val.IsEmpty())
|
if (!val.IsEmpty())
|
||||||
{
|
{
|
||||||
strName = startup_dir;
|
strName = startup_dir;
|
||||||
strName += "/custom/";
|
strName += "/custom/";
|
||||||
strName += val;
|
strName += val;
|
||||||
|
|
||||||
if (!wxFileExists(strName))
|
if (!wxFileExists(strName))
|
||||||
{
|
{
|
||||||
strName = startup_dir;
|
strName = startup_dir;
|
||||||
strName += "/res/";
|
strName += "/res/";
|
||||||
strName += val;
|
strName += val;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName fname(strName);
|
wxFileName fname(strName);
|
||||||
fname.Normalize();
|
fname.Normalize();
|
||||||
strName = fname.GetFullPath().Lower();
|
strName = fname.GetFullPath().Lower();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strName.Empty();
|
strName.Empty();
|
||||||
|
|
||||||
return strName;
|
return strName;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TArtProvider
|
// TArtProvider
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TArtProvider : public wxArtProvider
|
class TArtProvider : public wxArtProvider
|
||||||
{
|
{
|
||||||
#if !wxCHECK_VERSION(2,9,0)
|
#if !wxCHECK_VERSION(2,9,0)
|
||||||
WX_DECLARE_STRING_HASH_MAP(wxIconBundle, TIconBundleHashTable);
|
WX_DECLARE_STRING_HASH_MAP(wxIconBundle, TIconBundleHashTable);
|
||||||
TIconBundleHashTable m_hmBundles;
|
TIconBundleHashTable m_hmBundles;
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP(unsigned, TIconIdHashTable);
|
WX_DECLARE_STRING_HASH_MAP(unsigned, TIconIdHashTable);
|
||||||
TIconIdHashTable m_hmIds;
|
TIconIdHashTable m_hmIds;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size);
|
virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size);
|
||||||
virtual wxIconBundle CreateIconBundle(const wxArtID& id, const wxArtClient& client);
|
virtual wxIconBundle CreateIconBundle(const wxArtID& id, const wxArtClient& client);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if !wxCHECK_VERSION(2,9,0)
|
#if !wxCHECK_VERSION(2,9,0)
|
||||||
wxIconBundle GetIconBundle(const wxArtID& id, const wxArtClient& client);
|
wxIconBundle GetIconBundle(const wxArtID& id, const wxArtClient& client);
|
||||||
wxIcon GetIcon(const wxArtID& id, const wxArtClient& client = wxART_OTHER, const wxSize& size = wxDefaultSize);
|
wxIcon GetIcon(const wxArtID& id, const wxArtClient& client = wxART_OTHER, const wxSize& size = wxDefaultSize);
|
||||||
wxSize GetNativeSizeHint(const wxArtClient& client);
|
wxSize GetNativeSizeHint(const wxArtClient& client);
|
||||||
#endif
|
#endif
|
||||||
unsigned int GetIconBundleNumber(const wxArtID& id);
|
unsigned int GetIconBundleNumber(const wxArtID& id);
|
||||||
};
|
};
|
||||||
|
|
||||||
TArtProvider* _TheArtProvider = NULL;
|
TArtProvider* _TheArtProvider = NULL;
|
||||||
|
|
||||||
void xvtart_Init()
|
void xvtart_Init()
|
||||||
{
|
{
|
||||||
if (_TheArtProvider == NULL)
|
if (_TheArtProvider == NULL)
|
||||||
_TheArtProvider = new TArtProvider;
|
_TheArtProvider = new TArtProvider;
|
||||||
wxArtProvider::Push(_TheArtProvider);
|
wxArtProvider::Push(_TheArtProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap TArtProvider::CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size)
|
wxBitmap TArtProvider::CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size)
|
||||||
{
|
{
|
||||||
wxString strName;
|
wxString strName;
|
||||||
|
|
||||||
long tool = -1;
|
long tool = -1;
|
||||||
if (id.StartsWith(wxT("wxART")))
|
if (id.StartsWith(wxT("wxART")))
|
||||||
{
|
{
|
||||||
if (id == wxART_ERROR) tool = 201; else
|
if (id == wxART_ERROR) tool = 201; else
|
||||||
if (id == wxART_HELP) tool = 163; else
|
if (id == wxART_HELP) tool = 163; else
|
||||||
if (id == wxART_INFORMATION) tool = 162; else
|
if (id == wxART_INFORMATION) tool = 162; else
|
||||||
if (id == wxART_MISSING_IMAGE) tool = 100; else
|
if (id == wxART_MISSING_IMAGE) tool = 100; else
|
||||||
if (id == wxART_NEW) tool = 105; else
|
if (id == wxART_NEW) tool = 105; else
|
||||||
if (id == wxART_QUESTION) tool = 202; else
|
if (id == wxART_QUESTION) tool = 202; else
|
||||||
if (id == wxART_QUIT) tool = 114; else
|
if (id == wxART_QUIT) tool = 114; else
|
||||||
if (id == wxART_WARNING) tool = 203; else
|
if (id == wxART_WARNING) tool = 203; else
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
id.ToLong(&tool);
|
id.ToLong(&tool);
|
||||||
|
|
||||||
if (tool > 0)
|
if (tool > 0)
|
||||||
{
|
{
|
||||||
strName = xvtart_GetResourceName("Tool", tool);
|
strName = xvtart_GetResourceName("Tool", tool);
|
||||||
if (strName.IsEmpty() || !::wxFileExists(strName))
|
if (strName.IsEmpty() || !::wxFileExists(strName))
|
||||||
strName = xvtart_GetResourceName("Tool", 100); // Default empty icon
|
strName = xvtart_GetResourceName("Tool", 100); // Default empty icon
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strName = id;
|
strName = id;
|
||||||
|
|
||||||
if (!strName.IsEmpty() && ::wxFileExists(strName))
|
if (!strName.IsEmpty() && ::wxFileExists(strName))
|
||||||
{
|
{
|
||||||
if (strName.EndsWith(".ico"))
|
if (strName.EndsWith(".ico"))
|
||||||
{
|
{
|
||||||
const wxIcon ico = GetIcon(strName, client, size);
|
const wxIcon ico = GetIcon(strName, client, size);
|
||||||
return wxBitmap(ico);
|
return wxBitmap(ico);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int sx = size.x, sy = size.y;
|
int sx = size.x, sy = size.y;
|
||||||
if (sx <= 0 || sy <= 0)
|
if (sx <= 0 || sy <= 0)
|
||||||
{
|
{
|
||||||
const wxSize sz = GetNativeSizeHint(client);
|
const wxSize sz = GetNativeSizeHint(client);
|
||||||
if (sx <= 0) sx = sz.x;
|
if (sx <= 0) sx = sz.x;
|
||||||
if (sy <= 0) sy = sz.y;
|
if (sy <= 0) sy = sz.y;
|
||||||
}
|
}
|
||||||
wxImage img(strName, wxBITMAP_TYPE_ANY);
|
wxImage img(strName, wxBITMAP_TYPE_ANY);
|
||||||
img.Rescale(sx, sy, wxIMAGE_QUALITY_HIGH);
|
img.Rescale(sx, sy, wxIMAGE_QUALITY_HIGH);
|
||||||
return wxBitmap(img);
|
return wxBitmap(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxNullBitmap;
|
return wxNullBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient& WXUNUSED(client))
|
wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient& WXUNUSED(client))
|
||||||
{
|
{
|
||||||
wxString strName = id;
|
wxString strName = id;
|
||||||
|
|
||||||
long nIco = -1;
|
long nIco = -1;
|
||||||
if (id.StartsWith(wxT("wxART")))
|
if (id.StartsWith(wxT("wxART")))
|
||||||
{
|
{
|
||||||
if (id == wxART_EXECUTABLE_FILE) nIco = ICON_RSRC; else
|
if (id == wxART_EXECUTABLE_FILE) nIco = ICON_RSRC; else
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
id.ToLong(&nIco);
|
id.ToLong(&nIco);
|
||||||
|
|
||||||
if (nIco > 0)
|
if (nIco > 0)
|
||||||
strName = xvtart_GetResourceName("Icon", nIco);
|
strName = xvtart_GetResourceName("Icon", nIco);
|
||||||
|
|
||||||
wxIconBundle ib;
|
wxIconBundle ib;
|
||||||
bool bFound = false;
|
bool bFound = false;
|
||||||
if (::wxFileExists(strName))
|
if (::wxFileExists(strName))
|
||||||
{
|
{
|
||||||
const bool bLog = wxLog::EnableLogging(false); // Evita segnalazione di errore di formato icona
|
const bool bLog = wxLog::EnableLogging(false); // Evita segnalazione di errore di formato icona
|
||||||
if (strName.EndsWith(wxT(".ico")))
|
if (strName.EndsWith(wxT(".ico")))
|
||||||
{
|
{
|
||||||
ib.AddIcon(strName, wxBITMAP_TYPE_ICO);
|
ib.AddIcon(strName, wxBITMAP_TYPE_ICO);
|
||||||
bFound = true;
|
bFound = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ib.AddIcon(OsWin32_LoadIcon(strName));
|
ib.AddIcon(OsWin32_LoadIcon(strName));
|
||||||
bFound = true;
|
bFound = true;
|
||||||
}
|
}
|
||||||
wxLog::EnableLogging(bLog);
|
wxLog::EnableLogging(bLog);
|
||||||
|
|
||||||
for (wxCoord s = 16; s <= 48; s += 16)
|
for (wxCoord s = 16; s <= 48; s += 16)
|
||||||
{
|
{
|
||||||
const wxIcon smico = ib.GetIcon(s);
|
const wxIcon smico = ib.GetIcon(s);
|
||||||
if (smico.GetWidth() != s)
|
if (smico.GetWidth() != s)
|
||||||
{
|
{
|
||||||
wxBitmap bmpbig(ib.GetIcon());
|
wxBitmap bmpbig(ib.GetIcon());
|
||||||
wxImage img = bmpbig.ConvertToImage();
|
wxImage img = bmpbig.ConvertToImage();
|
||||||
img.Rescale(s, s, wxIMAGE_QUALITY_HIGH);
|
img.Rescale(s, s, wxIMAGE_QUALITY_HIGH);
|
||||||
wxBitmap bmpsmall(img);
|
wxBitmap bmpsmall(img);
|
||||||
wxIcon icosmall; icosmall.CopyFromBitmap(bmpsmall);
|
wxIcon icosmall; icosmall.CopyFromBitmap(bmpsmall);
|
||||||
ib.AddIcon(icosmall);
|
ib.AddIcon(icosmall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!strName.IsEmpty()) // Getione caso strName=".ext"
|
if (!strName.IsEmpty()) // Getione caso strName=".ext"
|
||||||
{
|
{
|
||||||
ib.AddIcon(OsWin32_LoadIcon(strName));
|
ib.AddIcon(OsWin32_LoadIcon(strName));
|
||||||
bFound = true;
|
bFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bFound && nIco == ICON_RSRC)
|
if (!bFound && nIco == ICON_RSRC)
|
||||||
{
|
{
|
||||||
strName.Printf("%d", ICON_RSRC); // id puo' essere wxART_EXECUTABLE_FILE
|
strName.Printf("%d", ICON_RSRC); // id puo' essere wxART_EXECUTABLE_FILE
|
||||||
ib.AddIcon(wxIcon(strName, wxBITMAP_TYPE_ICO_RESOURCE));
|
ib.AddIcon(wxIcon(strName, wxBITMAP_TYPE_ICO_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ib;
|
return ib;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !wxCHECK_VERSION(2,9,0)
|
#if !wxCHECK_VERSION(2,9,0)
|
||||||
|
|
||||||
wxSize TArtProvider::GetNativeSizeHint(const wxArtClient& client)
|
wxSize TArtProvider::GetNativeSizeHint(const wxArtClient& client)
|
||||||
{
|
{
|
||||||
int ix = 32, iy = 32;
|
int ix = 32, iy = 32;
|
||||||
|
|
||||||
if (client == wxART_FRAME_ICON)
|
if (client == wxART_FRAME_ICON)
|
||||||
{
|
{
|
||||||
const int x = wxSystemSettings::GetMetric(wxSYS_SMALLICON_X);
|
const int x = wxSystemSettings::GetMetric(wxSYS_SMALLICON_X);
|
||||||
const int y = wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y);
|
const int y = wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y);
|
||||||
if (x > 0 && y > 0)
|
if (x > 0 && y > 0)
|
||||||
{ ix = x; iy = y; }
|
{ ix = x; iy = y; }
|
||||||
else
|
else
|
||||||
{ ix /= 2; iy /= 2; }
|
{ ix /= 2; iy /= 2; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int x = wxSystemSettings::GetMetric(wxSYS_ICON_X);
|
const int x = wxSystemSettings::GetMetric(wxSYS_ICON_X);
|
||||||
const int y = wxSystemSettings::GetMetric(wxSYS_ICON_Y);
|
const int y = wxSystemSettings::GetMetric(wxSYS_ICON_Y);
|
||||||
if (x > 0 && y > 0)
|
if (x > 0 && y > 0)
|
||||||
{ ix = x; iy = y; }
|
{ ix = x; iy = y; }
|
||||||
if (client == wxART_MESSAGE_BOX)
|
if (client == wxART_MESSAGE_BOX)
|
||||||
{ ix *= 2; iy *= 2; }
|
{ ix *= 2; iy *= 2; }
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxSize(ix,iy);
|
return wxSize(ix,iy);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxIconBundle TArtProvider::GetIconBundle(const wxArtID& id, const wxArtClient& client)
|
wxIconBundle TArtProvider::GetIconBundle(const wxArtID& id, const wxArtClient& client)
|
||||||
{
|
{
|
||||||
TIconBundleHashTable::iterator it = m_hmBundles.find(id);
|
TIconBundleHashTable::iterator it = m_hmBundles.find(id);
|
||||||
if (it == m_hmBundles.end())
|
if (it == m_hmBundles.end())
|
||||||
{
|
{
|
||||||
const wxIconBundle b = CreateIconBundle(id, client);
|
const wxIconBundle b = CreateIconBundle(id, client);
|
||||||
m_hmBundles[id] = b;
|
m_hmBundles[id] = b;
|
||||||
|
|
||||||
unsigned long uid = 0;
|
unsigned long uid = 0;
|
||||||
if (!id.ToULong(&uid))
|
if (!id.ToULong(&uid))
|
||||||
{
|
{
|
||||||
wxString numid; numid.Printf(wxT("%lu"), GetIconBundleNumber(id));
|
wxString numid; numid.Printf(wxT("%lu"), GetIconBundleNumber(id));
|
||||||
m_hmBundles[numid] = b;
|
m_hmBundles[numid] = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxIcon TArtProvider::GetIcon(const wxArtID& id, const wxArtClient& client, const wxSize& size)
|
wxIcon TArtProvider::GetIcon(const wxArtID& id, const wxArtClient& client, const wxSize& size)
|
||||||
{
|
{
|
||||||
wxIconBundle bundle = GetIconBundle(id, client);
|
wxIconBundle bundle = GetIconBundle(id, client);
|
||||||
const wxSize sz = size == wxDefaultSize ? GetNativeSizeHint(client) : size;
|
const wxSize sz = size == wxDefaultSize ? GetNativeSizeHint(client) : size;
|
||||||
wxIcon ico = bundle.GetIcon(sz);
|
wxIcon ico = bundle.GetIcon(sz);
|
||||||
if (ico.IsOk() && sz.x != ico.GetWidth()) // Should never happen :-)
|
if (ico.IsOk() && sz.x != ico.GetWidth()) // Should never happen :-)
|
||||||
{
|
{
|
||||||
wxBitmap bmpbig(bundle.GetIcon());
|
wxBitmap bmpbig(bundle.GetIcon());
|
||||||
wxImage img = bmpbig.ConvertToImage();
|
wxImage img = bmpbig.ConvertToImage();
|
||||||
img.Rescale(sz.x, sz.y, wxIMAGE_QUALITY_HIGH);
|
img.Rescale(sz.x, sz.y, wxIMAGE_QUALITY_HIGH);
|
||||||
wxBitmap bmpsmall(img);
|
wxBitmap bmpsmall(img);
|
||||||
wxIcon icosmall; icosmall.CopyFromBitmap(bmpsmall);
|
wxIcon icosmall; icosmall.CopyFromBitmap(bmpsmall);
|
||||||
ico = icosmall;
|
ico = icosmall;
|
||||||
bundle.AddIcon(ico);
|
bundle.AddIcon(ico);
|
||||||
}
|
}
|
||||||
return ico;
|
return ico;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Metodo fichissimo per assegnare un identificatore univoco alle icone chiamate per nome del file.*
|
// Metodo fichissimo per assegnare un identificatore univoco alle icone chiamate per nome del file.*
|
||||||
unsigned int TArtProvider::GetIconBundleNumber(const wxArtID& id)
|
unsigned int TArtProvider::GetIconBundleNumber(const wxArtID& id)
|
||||||
{
|
{
|
||||||
unsigned int num = m_hmIds[id];
|
unsigned int num = m_hmIds[id];
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
{
|
{
|
||||||
num = 60000+m_hmIds.size();
|
num = 60000+m_hmIds.size();
|
||||||
m_hmIds[id] = num;
|
m_hmIds[id] = num;
|
||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// xvt_sys_load_icon
|
// xvt_sys_load_icon
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
const wxBitmap xvtart_GetToolResource(int nIcon, int nDesiredSize)
|
const wxBitmap xvtart_GetToolResource(int nIcon, int nDesiredSize)
|
||||||
{
|
{
|
||||||
if (nDesiredSize < 16) nDesiredSize = 16; else
|
if (nDesiredSize < 16) nDesiredSize = 16; else
|
||||||
if (nDesiredSize > 128) nDesiredSize = 128;
|
if (nDesiredSize > 128) nDesiredSize = 128;
|
||||||
wxArtID id; id.Printf("%d", nIcon);
|
wxArtID id; id.Printf("%d", nIcon);
|
||||||
return wxArtProvider::GetBitmap(id, wxART_TOOLBAR, wxSize(nDesiredSize, nDesiredSize));
|
return wxArtProvider::GetBitmap(id, wxART_TOOLBAR, wxSize(nDesiredSize, nDesiredSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxIcon xvtart_GetIconResource(int nIcon, const char* client, const int size)
|
const wxIcon xvtart_GetIconResource(int nIcon, const char* client, const int size)
|
||||||
{
|
{
|
||||||
wxASSERT(_TheArtProvider != NULL);
|
wxASSERT(_TheArtProvider != NULL);
|
||||||
|
|
||||||
if (nIcon <= 0)
|
if (nIcon <= 0)
|
||||||
nIcon = ICON_RSRC;
|
nIcon = ICON_RSRC;
|
||||||
|
|
||||||
wxArtID id; id.Printf("%d", nIcon);
|
wxArtID id; id.Printf("%d", nIcon);
|
||||||
wxArtClient cl = client && * client ? client : wxART_OTHER;
|
wxArtClient cl = client && * client ? client : wxART_OTHER;
|
||||||
wxSize sz(size, size);
|
wxSize sz(size, size);
|
||||||
return _TheArtProvider->GetIcon(id, cl, sz);
|
return _TheArtProvider->GetIcon(id, cl, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int xvt_sys_load_icon(const char* file)
|
unsigned int xvt_sys_load_icon(const char* file)
|
||||||
{
|
{
|
||||||
wxASSERT(_TheArtProvider != NULL);
|
wxASSERT(_TheArtProvider != NULL);
|
||||||
const wxArtID id = file;
|
const wxArtID id = file;
|
||||||
const wxIcon ico = _TheArtProvider->GetIcon(id);
|
const wxIcon ico = _TheArtProvider->GetIcon(id);
|
||||||
return ico.IsOk() ? _TheArtProvider->GetIconBundleNumber(id) : ICON_RSRC;
|
return ico.IsOk() ? _TheArtProvider->GetIconBundleNumber(id) : ICON_RSRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
WX_DECLARE_HASH_MAP(int, wxCursor, wxIntegerHash, wxIntegerEqual, TCursorHashTable);
|
WX_DECLARE_HASH_MAP(int, wxCursor, wxIntegerHash, wxIntegerEqual, TCursorHashTable);
|
||||||
|
|
||||||
const wxCursor xvtart_GetCursorResource(int rid)
|
const wxCursor xvtart_GetCursorResource(int rid)
|
||||||
{
|
{
|
||||||
static TCursorHashTable _nice_cursors;
|
static TCursorHashTable _nice_cursors;
|
||||||
wxCursor cursor = _nice_cursors[rid];
|
wxCursor cursor = _nice_cursors[rid];
|
||||||
|
|
||||||
if (!cursor.IsOk())
|
if (!cursor.IsOk())
|
||||||
{
|
{
|
||||||
switch (rid)
|
switch (rid)
|
||||||
{
|
{
|
||||||
case CURSOR_CROCE: cursor = wxCURSOR_CROSS; break;
|
case CURSOR_CROCE: cursor = wxCURSOR_CROSS; break;
|
||||||
case CURSOR_IBEAM: cursor = wxCURSOR_IBEAM; break;
|
case CURSOR_IBEAM: cursor = wxCURSOR_IBEAM; break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
const wxString strName = xvtart_GetResourceName("Cursor", rid);
|
const wxString strName = xvtart_GetResourceName("Cursor", rid);
|
||||||
if (::wxFileExists(strName))
|
if (::wxFileExists(strName))
|
||||||
{
|
{
|
||||||
if (strName.Find(".ico") > 0)
|
if (strName.Find(".ico") > 0)
|
||||||
cursor = wxCursor(strName, wxBITMAP_TYPE_ICO);
|
cursor = wxCursor(strName, wxBITMAP_TYPE_ICO);
|
||||||
else
|
else
|
||||||
cursor = wxCursor(strName, wxBITMAP_TYPE_CUR);
|
cursor = wxCursor(strName, wxBITMAP_TYPE_CUR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!cursor.IsOk())
|
if (!cursor.IsOk())
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("Invalid cursor"));
|
wxFAIL_MSG(_("Invalid cursor"));
|
||||||
cursor = *wxSTANDARD_CURSOR;
|
cursor = *wxSTANDARD_CURSOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
_nice_cursors[rid] = cursor;
|
_nice_cursors[rid] = cursor;
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TAuiManager
|
// TAuiManager
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
class TAuiManager : public wxAuiManager
|
class TAuiManager : public wxAuiManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -395,7 +395,7 @@ public:
|
|||||||
static bool BaseColours(wxColour& base, wxColour& light, wxColour& dark, wxColour& text);
|
static bool BaseColours(wxColour& base, wxColour& light, wxColour& dark, wxColour& text);
|
||||||
TAuiManager();
|
TAuiManager();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TAuiManager::BaseColours(wxColour& base, wxColour& light, wxColour& dark, wxColour& text)
|
bool TAuiManager::BaseColours(wxColour& base, wxColour& light, wxColour& dark, wxColour& text)
|
||||||
{
|
{
|
||||||
const wxSize sz(256,256);
|
const wxSize sz(256,256);
|
||||||
@ -465,9 +465,9 @@ TAuiManager::TAuiManager()
|
|||||||
{
|
{
|
||||||
SetArtProvider(new TDockArt);
|
SetArtProvider(new TDockArt);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxAuiManager* xvtart_CreateManager(wxWindow* win)
|
wxAuiManager* xvtart_CreateManager(wxWindow* win)
|
||||||
{
|
{
|
||||||
return new wxAuiManager(win); // will be TAUIManager
|
return new wxAuiManager(win); // will be TAUIManager
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user