Correzioni a colori property sheet

git-svn-id: svn://10.65.10.50/branches/R_10_00@22701 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-07-11 12:25:11 +00:00
parent 5a92f0910b
commit 7c99b8816c
3 changed files with 96 additions and 9 deletions

View File

@ -2,12 +2,10 @@
#include "xvt.h"
#include "xvtart.h"
#ifdef __WXMSW__
#include "oswin32.h"
#endif
#include <wx/artprov.h>
#include <wx/aui/aui.h>
#include <wx/filename.h>
wxString xvtart_GetResourceIni()
@ -196,13 +194,11 @@ wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient
ib.AddIcon(strName, wxBITMAP_TYPE_ICO);
bFound = true;
}
#ifdef __WXMSW__
else
{
ib.AddIcon(OsWin32_LoadIcon(strName));
bFound = true;
}
#endif
wxLog::EnableLogging(bLog);
for (wxCoord s = 16; s <= 48; s += 16)
@ -219,7 +215,6 @@ wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient
}
}
}
#ifdef __WXMSW__
else
{
if (!strName.IsEmpty()) // Getione caso strName=".ext"
@ -228,7 +223,6 @@ wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient
bFound = true;
}
}
#endif
if (!bFound && nIco == ICON_RSRC)
{
@ -389,3 +383,91 @@ const wxCursor xvtart_GetCursorResource(int rid)
return cursor;
}
///////////////////////////////////////////////////////////
// TAuiManager
///////////////////////////////////////////////////////////
/*
class TAuiManager : public wxAuiManager
{
public:
static bool DrawBackground(wxDC& dc, wxWindow* window, int orientation, const wxRect &rect);
static bool BaseColours(wxColour& base, wxColour& light, wxColour& dark, wxColour& text);
TAuiManager();
};
bool TAuiManager::BaseColours(wxColour& base, wxColour& light, wxColour& dark, wxColour& text)
{
const wxSize sz(256,256);
wxBitmap bmp = wxArtProvider::GetBitmap(wxArtID(wxT("Skin")), wxART_OTHER, sz);
if (bmp.IsOk())
{
wxColourBase::ChannelType ldark = 255, llight = 0;
dark = *wxWHITE;
light = *wxBLACK;
wxNativePixelData data(bmp);
const int dim = data.GetHeight();
wxNativePixelData::Iterator p(data);
double r = 0, g = 0, b = 0;
for (int i = 0; i < dim; i++)
{
p.MoveTo(data, i, i);
r += p.Red();
g += p.Green();
b += p.Blue();
const wxColour col(p.Red(), p.Green(), p.Blue());
const wxColourBase::ChannelType lcol = Luma(col);
if (lcol < ldark)
{
dark = col;
ldark = lcol;
}
if (lcol > llight)
{
light = col;
llight = lcol;
}
}
r /= dim; g /= dim; b /= dim;
base = wxColour(r, g, b);
const wxColourBase::ChannelType lbase = Luma(base);
if (lbase - ldark < 40)
dark = ModulatedColor(dark, -(40 - lbase + ldark));
if (llight - lbase < 40)
light = ModulatedColor(light, +(40 - llight + lbase));
text = ContrastingColor(base);
}
return bmp.IsOk();
}
bool TAuiManager::DrawBackground(wxDC& dc, wxWindow* WXUNUSED(window),
int WXUNUSED(orientation), const wxRect &rect)
{
const wxBitmap bmp = wxArtProvider::GetBitmap(wxArtID(wxT("Skin")), wxART_OTHER, wxSize(256,256));
if (bmp.IsOk())
{
const wxSize szBm = bmp.GetSize();
for (wxCoord y = rect.y; y < rect.GetBottom(); y += szBm.y)
{
for (wxCoord x = rect.x; x < rect.GetRight(); x += szBm.x)
dc.DrawBitmap(bmp, x, y);
}
}
return bmp.IsOk();
}
TAuiManager::TAuiManager()
{
SetArtProvider(new TDockArt);
}
*/
wxAuiManager* xvtart_CreateManager(wxWindow* win)
{
return new wxAuiManager(win); // will be TAUIManager
}

View File

@ -1,12 +1,17 @@
#ifndef __XVTART_H__
#define __XVTART_H__
#ifndef _WX_FRAMEMANAGER_H_
class wxAuiManager;
#endif
const wxCursor xvtart_GetCursorResource(int rid);
const wxIcon xvtart_GetIconResource(int rid, const char* client = NULL, int size = -1);
wxString xvtart_GetResourceIni();
wxString xvtart_GetResourceName(const char* type, int rid);
const wxBitmap xvtart_GetToolResource(int rid, int size);
void xvtart_Init();
void xvtart_Init();
wxAuiManager* xvtart_CreateManager(wxWindow* win);
#endif

View File

@ -871,7 +871,7 @@ BOOLEAN TwxWindow::AddPane(wxWindow* wnd, const char* caption, int nDock, int nF
if (ok)
{
if (m_pManager == NULL)
m_pManager = new wxAuiManager(this);
m_pManager = xvtart_CreateManager(this);
wxAuiPaneInfo pane;
pane.DefaultPane(); pane.Dockable(false);
const wxSize sz = wnd->GetSize();