Patch level : 10.0
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Corretta gestione icona standard in base ad OEM Ridotte dimensioni del pannello centrale della status bar git-svn-id: svn://10.65.10.50/trunk@18047 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d6f0c029e0
commit
9da48e0d59
@ -217,29 +217,17 @@ static bool RectIntersect(const wxRect &rect1, const wxRect &rect2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString GetResourceIni()
|
wxString GetResourceIni()
|
||||||
{
|
{ return _startup_dir + "/res/resource.ini"; }
|
||||||
wxString strName;
|
|
||||||
strName = _startup_dir;
|
|
||||||
strName += "/res/resource.ini";
|
|
||||||
return strName;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString _GetResourceName(const char* type, int rid)
|
wxString _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);
|
||||||
wxString val;
|
|
||||||
|
|
||||||
#ifdef WIN32
|
wxString val;
|
||||||
char* buff = val.GetWriteBuf(260);
|
char* buff = val.GetWriteBuf(MAX_PATH);
|
||||||
::GetPrivateProfileString(strName, strKey, "", buff, 260, GetResourceIni());
|
xvt_sys_get_profile_string(GetResourceIni(), strName, strKey, "", buff, MAX_PATH);
|
||||||
val.UngetWriteBuf();
|
val.UngetWriteBuf();
|
||||||
#else
|
|
||||||
wxFileConfig ini("", "", GetResourceIni());
|
|
||||||
strName.insert(0, '/');
|
|
||||||
ini.SetPath(strName);
|
|
||||||
ini.Read(strKey, &val);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!val.IsEmpty())
|
if (!val.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -258,25 +246,54 @@ wxString _GetResourceName(const char* type, int rid)
|
|||||||
return strName;
|
return strName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static wxIcon* _GetDefaultIcon()
|
||||||
|
{
|
||||||
|
wxIcon* icon = NULL;
|
||||||
|
wxString strName = _startup_dir + "/setup/oem.ini";
|
||||||
|
|
||||||
|
const int oem = xvt_sys_get_profile_int(strName, "MAIN", "OEM", -1);
|
||||||
|
if (oem >= 0)
|
||||||
|
{
|
||||||
|
wxString strPara; strPara << "OEM_" << oem;
|
||||||
|
char name[MAX_PATH];
|
||||||
|
xvt_sys_get_profile_string(strName, strPara, "Icon", "", name, sizeof(name));
|
||||||
|
if (*name)
|
||||||
|
{
|
||||||
|
strName = _startup_dir + "/setup/" + name;
|
||||||
|
if (wxFileExists(strName))
|
||||||
|
icon = new wxIcon(strName, wxBITMAP_TYPE_ICO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (icon == NULL)
|
||||||
|
{
|
||||||
|
strName = _GetResourceName("Icon", ICON_RSRC);
|
||||||
|
if (::wxFileExists(strName))
|
||||||
|
icon = new wxIcon(strName, wxBITMAP_TYPE_ICO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (icon == NULL)
|
||||||
|
{
|
||||||
|
strName.Printf("%d", ICON_RSRC);
|
||||||
|
icon = new wxIcon(strName, wxBITMAP_TYPE_ICO_RESOURCE);
|
||||||
|
}
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
const wxIcon& _GetIconResource(int rid)
|
const wxIcon& _GetIconResource(int rid)
|
||||||
{
|
{
|
||||||
wxIcon* icon = wxDynamicCast(_nice_icons.Get(rid), wxIcon);
|
wxIcon* icon = wxDynamicCast(_nice_icons.Get(rid), wxIcon);
|
||||||
if (icon == NULL)
|
if (icon == NULL)
|
||||||
{
|
{
|
||||||
wxString strName = _GetResourceName("Icon", rid);
|
if (rid > 0 && rid != ICON_RSRC)
|
||||||
if (::wxFileExists(strName))
|
|
||||||
{
|
{
|
||||||
|
const wxString strName = _GetResourceName("Icon", rid);
|
||||||
|
if (::wxFileExists(strName))
|
||||||
icon = new wxIcon(strName, wxBITMAP_TYPE_ICO);
|
icon = new wxIcon(strName, wxBITMAP_TYPE_ICO);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
icon = wxDynamicCast(_nice_icons.Get(ICON_RSRC), wxIcon);
|
|
||||||
if (icon == NULL)
|
if (icon == NULL)
|
||||||
{
|
icon = _GetDefaultIcon(); // Icona di salvezza
|
||||||
strName.Printf("%d", ICON_RSRC);
|
|
||||||
icon = new wxIcon(strName); // Icona di salvezza
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_nice_icons.Put(rid, icon);
|
_nice_icons.Put(rid, icon);
|
||||||
}
|
}
|
||||||
return *icon;
|
return *icon;
|
||||||
@ -4666,7 +4683,7 @@ WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
|
|||||||
pStatusBar = w->CreateStatusBar(3, nStyle);
|
pStatusBar = w->CreateStatusBar(3, nStyle);
|
||||||
if (pStatusBar != NULL)
|
if (pStatusBar != NULL)
|
||||||
{
|
{
|
||||||
const int widths[4] = { -4, -5, -2, 0 };
|
const int widths[4] = { -4, -2, -2, 0 };
|
||||||
pStatusBar->SetStatusWidths(3, widths);
|
pStatusBar->SetStatusWidths(3, widths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1143,8 +1143,8 @@ const char* xvt_fsys_get_campo_ini()
|
|||||||
#endif
|
#endif
|
||||||
if (!xvt_fsys_file_exists(path))
|
if (!xvt_fsys_file_exists(path))
|
||||||
{
|
{
|
||||||
char msg[256];
|
char msg[_MAX_PATH];
|
||||||
sprintf(msg, "Impossibile aprire '%s'", (const char *)path);
|
sprintf(msg, "Impossibile aprire '%s'", path);
|
||||||
xvt_dm_post_fatal_exit(msg);
|
xvt_dm_post_fatal_exit(msg);
|
||||||
}
|
}
|
||||||
prawin = xvt_str_duplicate(path);
|
prawin = xvt_str_duplicate(path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user