uppsrc: Chameleon fixes for default Fedora theme (Nodoka)

git-svn-id: svn://ultimatepp.org/upp/trunk@2161 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-03-01 00:04:34 +00:00
parent 83208586d9
commit 3184b938ce
11 changed files with 66 additions and 37 deletions

View file

@ -19,7 +19,7 @@ XftFont *CreateXftFont(Font font, int angle)
double sina, cosa;
Std(font);
int hg = abs(font.GetHeight());
if(hg == 0) hg = 10;
if(hg == 0) hg = max(GetStdFontCy(), 10);
String face = font.GetFaceName();
FcPattern *p = FcPatternCreate();
FcPatternAddString(p, FC_FAMILY, (FcChar8*)~face);

View file

@ -3,7 +3,7 @@
#include "Draw/init"
#include "plugin\bmp/init"
#include "RichText/init"
#define BLITZ_INDEX__ F0A6208DAEC7575B6117705E83EBFD054
#define BLITZ_INDEX__ FC7D3155EBFD63D91990D6369B831171A
#include "CtrlCore.icpp"
#undef BLITZ_INDEX__
#endif

View file

@ -170,7 +170,7 @@ int Pusher::GetVisualState() const
Pusher::Pusher() {
keypush = push = clickfocus = false;
accesskey = 0;
font = Null;
font = StdFont();
NoInitFocus();
}

View file

@ -589,6 +589,28 @@ extern String gtk_rgba;
extern void ClearFtFaceCache();
void SetDefTrough(ScrollBar::Style& s)
{
for(int i = 0; i < 4; i++) {
Image m = CtrlsImg::Get(CtrlsImg::I_SBVU + i);
ImageBuffer ib(m);
Size sz = ib.GetSize();
ib[0][sz.cx - 1] = ib[0][0] = SColorShadow();
ib.SetHotSpot(Point(0, 0));
ib.Set2ndSpot(Point(sz.cx - 1, 0));
m = ib;
s.vlower[i] = s.vupper[i] = m;
m = CtrlsImg::Get(CtrlsImg::I_SBHU + i);
ib = m;
sz = ib.GetSize();
ib[sz.cy - 1][0] = ib[0][0] = SColorShadow();
ib.SetHotSpot(Point(0, 0));
ib.Set2ndSpot(Point(0, sz.cy - 1));
m = ib;
s.hupper[i] = s.hlower[i] = m;
}
}
void ChHostSkin()
{
MemoryIgnoreLeaksBlock __;
@ -779,6 +801,7 @@ void ChHostSkin()
{
ScrollBar::Style& s = ScrollBar::StyleDefault().Write();
SetDefTrough(s);
s.through = true;
GtkObject *adj = gtk_adjustment_new(250, 0, 1000, 1, 1, 500);
static GtkWidget *vscrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(adj));
@ -791,9 +814,10 @@ void ChHostSkin()
s.isright2 = s.isdown2 = GtkInt("has-secondary-forward-stepper");
s.isleft2 = s.isup2 = GtkInt("has-secondary-backward-stepper");
for(int i = 0; i < 6; i++)
CtrlsImg::Set(CtrlsImg::I_DA + i, CtrlsImg::Get(CtrlsImg::I_kDA + i));
if(engine == "Qt") {
for(int i = 0; i < 6; i++)
CtrlsImg::Set(CtrlsImg::I_DA + i, CtrlsImg::Get(CtrlsImg::I_kDA + i));
int r = Null;
for(int i = 0; i < 4; i++) {
ImageDraw iw(64, 64);
@ -859,24 +883,7 @@ void ChHostSkin()
GtkChSlider(s.vthumb);
s.barsize += 2;
s.arrowsize++;
for(int i = 0; i < 4; i++) {
Image m = CtrlsImg::Get(CtrlsImg::I_SBVU + i);
ImageBuffer ib(m);
Size sz = ib.GetSize();
ib[0][sz.cx - 1] = ib[0][0] = SColorShadow();
ib.SetHotSpot(Point(0, 0));
ib.Set2ndSpot(Point(sz.cx - 1, 0));
m = ib;
s.vlower[i] = s.vupper[i] = m;
m = CtrlsImg::Get(CtrlsImg::I_SBHU + i);
ib = m;
sz = ib.GetSize();
ib[sz.cy - 1][0] = ib[0][0] = SColorShadow();
ib.SetHotSpot(Point(0, 0));
ib.Set2ndSpot(Point(0, sz.cy - 1));
m = ib;
s.hupper[i] = s.hlower[i] = m;
}
SetDefTrough(s);
static GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(adj));
ChGtkNew(hscrollbar, "slider", GTK_SLIDER|GTK_MARGIN1|GTK_XMARGIN);
GtkChSlider(s.hthumb);
@ -884,9 +891,11 @@ void ChHostSkin()
}
else {
GtkChSlider(s.vthumb);
ChGtkNew("trough", GTK_BGBOX);
GtkChTrough(s.vupper);
GtkChTrough(s.vlower);
if(engine != "Nodoka") {
ChGtkNew("trough", GTK_BGBOX);
GtkChTrough(s.vupper);
GtkChTrough(s.vlower);
}
bool atp = IsEmptyImage(GetGTK(ChGtkLast(), 2, 2, "vscrollbar", GTK_BOX|GTK_TOP|GTK_RANGEA, 16, 16));
Size asz(s.barsize / 2, s.arrowsize / 2);
if(engine == "Qt")
@ -918,8 +927,10 @@ void ChHostSkin()
}
}
else {
GtkIml(CtrlsImg::I_UA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_TOP|GTK_RANGEA, asz.cx, asz.cy);
GtkIml(CtrlsImg::I_DA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_VAL1|GTK_BOTTOM|GTK_RANGED, asz.cx, asz.cy);
if(engine != "Nodoka") {
GtkIml(CtrlsImg::I_UA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_TOP|GTK_RANGEA, asz.cx, asz.cy);
GtkIml(CtrlsImg::I_DA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_VAL1|GTK_BOTTOM|GTK_RANGED, asz.cx, asz.cy);
}
ChGtkNew("vscrollbar", GTK_BGBOX|GTK_TOP|GTK_RANGEA);
GtkChArrow(s.up.look, CtrlsImg::UA(), po);
@ -970,9 +981,11 @@ void ChHostSkin()
static GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(adj));
ChGtkNew(hscrollbar, "slider", GTK_SLIDER);
GtkChSlider(s.hthumb);
ChGtkNew("trough", GTK_BGBOX);
GtkChTrough(s.hupper);
GtkChTrough(s.hlower);
if(engine != "Nodoka") {
ChGtkNew("trough", GTK_BGBOX);
GtkChTrough(s.hupper);
GtkChTrough(s.hlower);
}
if(atp) {
ChGtkNew("hscrollbar", GTK_ARROW|GTK_VAL2);
GtkCh(s.left.look, "02141111");
@ -982,8 +995,10 @@ void ChHostSkin()
GtkCh(s.right2.look, "02141111");
}
else {
GtkIml(CtrlsImg::I_LA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL2|GTK_LEFT|GTK_RANGEA, asz.cy, asz.cx);
GtkIml(CtrlsImg::I_RA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL3|GTK_RIGHT|GTK_RANGED, asz.cy, asz.cx);
if(engine != "Nodoka") {
GtkIml(CtrlsImg::I_LA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL2|GTK_LEFT|GTK_RANGEA, asz.cy, asz.cx);
GtkIml(CtrlsImg::I_RA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL3|GTK_RIGHT|GTK_RANGED, asz.cy, asz.cx);
}
ChGtkNew("hscrollbar", GTK_BGBOX|GTK_LEFT|GTK_RANGEA);
GtkChArrow(s.left.look, CtrlsImg::LA(), po);
ChGtkNew("hscrollbar", GTK_BGBOX|GTK_VCENTER|GTK_RANGEC);

View file

@ -961,6 +961,7 @@ void EditField::Reset()
alignright = false;
SetStyle(StyleDefault());
SetFrame(edge);
font = StdFont();
}
EditField& EditField::SetFont(Font _font)

View file

@ -122,6 +122,7 @@ DrawLabel::DrawLabel()
align = valign = ALIGN_CENTER;
accesskey = 0;
accesspos = -1;
font = StdFont();
}
Size DrawLabel::GetSize(int txtcx) const

View file

@ -262,6 +262,16 @@ int MultiButton::ChState(int i)
: CTRL_NORMAL;
}
Rect MultiButton::GetMargin()
{
Rect m = style->margin;
int fcy = GetStdFontCy();
int cy = GetSize().cy;
if(m.top + m.bottom + fcy > cy)
m.top = m.bottom = max((cy - fcy) / 2, 0);
return m;
}
void MultiButton::Lay(Rect& r)
{
int border, lx, rx;
@ -280,7 +290,7 @@ void MultiButton::Lay(Rect& r)
}
else
if(frm) {
Rect m = style->margin;
Rect m = GetMargin();
r = Rect(r.left + max(lx, m.left), r.top + m.top, min(rx, r.right - m.right), r.bottom - m.bottom);
}
else {
@ -387,7 +397,7 @@ void MultiButton::Paint(Draw& w)
}
else
if(frm) {
Rect m = style->margin;
Rect m = GetMargin();
r = Rect(max(lx, m.left), m.top, min(rx, sz.cx - m.right), sz.cy - m.bottom);
Color paper;
if(mst == CTRL_HOT && !IsTrivial())

View file

@ -105,6 +105,7 @@ private:
bool GetPos(SubButton& b, int& lx, int& rx, int& x, int& cx, int px = -1);
void GetPos(int ii, int& x, int& cx);
int ChState(int i);
Rect GetMargin();
void Lay(Rect& r);
bool ComplexFrame();
bool Metrics(int& border, int& lx, int &rx, const Rect& r);

View file

@ -310,6 +310,7 @@ Switch::Switch() {
mincy = 0;
Transparent();
NoInitFocus();
font = StdFont();
}
Switch::~Switch() {}

View file

@ -96,7 +96,7 @@ void TrayIcon::Message(int type, const char *title, const char *text, int timeou
}
UntrapX11Errors(x11trap);
#else
if (!notify_init (title))
if (!notify_init(title))
return;
NotifyNotification* notification;
GError* error = NULL;

View file

@ -2,7 +2,7 @@
#define _CtrlLib_icpp_init_stub
#include "CtrlCore/init"
#include "PdfDraw/init"
#define BLITZ_INDEX__ F8CEBFB3B591328AB1E0EC796741AA480
#define BLITZ_INDEX__ F024C0B38D924382DCD64BDB53539FC50
#include "CtrlLib.icpp"
#undef BLITZ_INDEX__
#endif