[GB.GTK]
* BUG: Fix splitter arrangement again. * OPT: gFont::height() has been cached. git-svn-id: svn://localhost/gambas/trunk@2567 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
69ca2092f3
commit
c188e5e00c
4 changed files with 10 additions and 35 deletions
|
@ -131,22 +131,6 @@ static int Begin(GB_PAINT *d)
|
||||||
}
|
}
|
||||||
else if (GB.Is(device, CLASS_Image))
|
else if (GB.Is(device, CLASS_Image))
|
||||||
{
|
{
|
||||||
/*gPicture *picture = CIMAGE_get(((CIMAGE *)device));
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
|
|
||||||
if (picture->isVoid())
|
|
||||||
{
|
|
||||||
GB.Error("Bad picture");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pixbuf = picture->getPixbuf();
|
|
||||||
w = picture->width();
|
|
||||||
h = picture->height();
|
|
||||||
|
|
||||||
target =
|
|
||||||
cairo_image_surface_create_for_data(picture->data(), CAIRO_FORMAT_ARGB32, w, h,
|
|
||||||
cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, w));*/
|
|
||||||
target = check_image(device);
|
target = check_image(device);
|
||||||
cairo_surface_reference(target);
|
cairo_surface_reference(target);
|
||||||
w = ((GB_IMG *)device)->width;
|
w = ((GB_IMG *)device)->width;
|
||||||
|
|
|
@ -206,6 +206,7 @@ void gFont::reset()
|
||||||
void gFont::realize()
|
void gFont::realize()
|
||||||
{
|
{
|
||||||
ct = NULL;
|
ct = NULL;
|
||||||
|
_height = 0;
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
@ -371,6 +372,7 @@ void gFont::setName(char *nm)
|
||||||
pango_font_description_set_family (desc,nm);
|
pango_font_description_set_family (desc,nm);
|
||||||
|
|
||||||
_name_set = true;
|
_name_set = true;
|
||||||
|
_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double gFont::size()
|
double gFont::size()
|
||||||
|
@ -396,6 +398,7 @@ void gFont::setSize(double sz)
|
||||||
pango_font_description_set_size (desc,(int)(sz*PANGO_SCALE));
|
pango_font_description_set_size (desc,(int)(sz*PANGO_SCALE));
|
||||||
|
|
||||||
_size_set = true;
|
_size_set = true;
|
||||||
|
_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gFont::setGrade(int grade)
|
void gFont::setGrade(int grade)
|
||||||
|
@ -474,18 +477,20 @@ int gFont::height(const char *text, int len)
|
||||||
int h;
|
int h;
|
||||||
|
|
||||||
if (len == 0 || !text || !*text) text = " ";
|
if (len == 0 || !text || !*text) text = " ";
|
||||||
|
|
||||||
ly=pango_layout_new(ct);
|
ly=pango_layout_new(ct);
|
||||||
pango_layout_set_text(ly,text,len);
|
pango_layout_set_text(ly,text,len);
|
||||||
pango_layout_get_size(ly,NULL,&h);
|
pango_layout_get_size(ly,NULL,&h);
|
||||||
g_object_unref(G_OBJECT(ly));
|
g_object_unref(G_OBJECT(ly));
|
||||||
|
|
||||||
return gt_pango_to_pixel(h);
|
return gt_pango_to_pixel(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gFont::height()
|
int gFont::height()
|
||||||
{
|
{
|
||||||
return height(" ", 1);
|
if (!_height)
|
||||||
|
_height = height(" ", 1);
|
||||||
|
return _height;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gFont::scalable()
|
bool gFont::scalable()
|
||||||
|
|
|
@ -92,6 +92,7 @@ private:
|
||||||
bool uline;
|
bool uline;
|
||||||
bool strike;
|
bool strike;
|
||||||
void realize();
|
void realize();
|
||||||
|
int _height;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,29 +25,14 @@
|
||||||
#include "gapplication.h"
|
#include "gapplication.h"
|
||||||
#include "gsplitter.h"
|
#include "gsplitter.h"
|
||||||
|
|
||||||
// static gboolean notify_later(gSplitter *data)
|
|
||||||
// {
|
|
||||||
// data->performArrange();
|
|
||||||
// data->emit(SIGNAL(data->onResize));
|
|
||||||
// data->_notify = false;
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
static void cb_notify(GtkPaned *paned, GParamSpec *arg1, gSplitter *data)
|
static void cb_notify(GtkPaned *paned, GParamSpec *arg1, gSplitter *data)
|
||||||
{
|
{
|
||||||
if (!strcmp(arg1->name, "position")) // && !data->_notify)
|
if (!strcmp(arg1->name, "position"))
|
||||||
{
|
|
||||||
//data->performArrange();
|
|
||||||
data->emit(SIGNAL(data->onResize));
|
data->emit(SIGNAL(data->onResize));
|
||||||
//data->_notify = true;
|
|
||||||
//g_timeout_add(0, (GSourceFunc)notify_later, data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cb_size_allocate(GtkPaned *widget, GtkAllocation *allocation, gSplitter *data)
|
static void cb_size_allocate(GtkPaned *widget, GtkAllocation *allocation, gSplitter *data)
|
||||||
{
|
{
|
||||||
//g_debug("gSplitter: cb_size_allocate: %s", data->name());
|
|
||||||
//data->performArrange();
|
|
||||||
data->updateChild(gtk_paned_get_child1(widget));
|
data->updateChild(gtk_paned_get_child1(widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue