* 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:
Benoît Minisini 2009-12-30 20:59:27 +00:00
parent 69ca2092f3
commit c188e5e00c
4 changed files with 10 additions and 35 deletions

View file

@ -131,22 +131,6 @@ static int Begin(GB_PAINT *d)
}
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);
cairo_surface_reference(target);
w = ((GB_IMG *)device)->width;

View file

@ -206,6 +206,7 @@ void gFont::reset()
void gFont::realize()
{
ct = NULL;
_height = 0;
reset();
@ -371,6 +372,7 @@ void gFont::setName(char *nm)
pango_font_description_set_family (desc,nm);
_name_set = true;
_height = 0;
}
double gFont::size()
@ -396,6 +398,7 @@ void gFont::setSize(double sz)
pango_font_description_set_size (desc,(int)(sz*PANGO_SCALE));
_size_set = true;
_height = 0;
}
void gFont::setGrade(int grade)
@ -474,18 +477,20 @@ int gFont::height(const char *text, int len)
int h;
if (len == 0 || !text || !*text) text = " ";
ly=pango_layout_new(ct);
pango_layout_set_text(ly,text,len);
pango_layout_get_size(ly,NULL,&h);
g_object_unref(G_OBJECT(ly));
return gt_pango_to_pixel(h);
}
int gFont::height()
{
return height(" ", 1);
if (!_height)
_height = height(" ", 1);
return _height;
}
bool gFont::scalable()

View file

@ -92,6 +92,7 @@ private:
bool uline;
bool strike;
void realize();
int _height;
};
#endif

View file

@ -25,29 +25,14 @@
#include "gapplication.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)
{
if (!strcmp(arg1->name, "position")) // && !data->_notify)
{
//data->performArrange();
if (!strcmp(arg1->name, "position"))
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)
{
//g_debug("gSplitter: cb_size_allocate: %s", data->name());
//data->performArrange();
data->updateChild(gtk_paned_get_child1(widget));
}