Roxen.git
/
server
/
modules
/
graphics
/
gbutton.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/modules/graphics/gbutton.pike:18:
// icon-data -- inline icon data // align -- left|center|right text alignment // align-icon -- left|center-before|center-after|right icon alignment // valign-icon -- above|middle|below icon vertical alignment // >Button text</gbutton> // // Alignment restriction: when text alignment is either left or right, icons // must also be aligned left or right.
-
constant cvs_version = "$Id: gbutton.pike,v 1.
65
2000/11/
17
15
:
56
:
30
anders
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
66
2000/11/
21
12
:
02
:
52
per
Exp $";
constant thread_safe = 1; #include <module.h> inherit "module"; roxen.ImageCache button_cache; constant module_type = MODULE_TAG; constant module_name = "GButton"; constant module_doc =
Roxen.git/server/modules/graphics/gbutton.pike:721:
"extra_right_layers":args["extra-right-layers"], "extra_background_layers":args["extra-background-layers"], "extra_mask_layers":args["extra-mask-layers"], "extra_frame_layers":args["extra-frame-layers"], "scale":args["scale"], "format":args["format"], "gamma":args["gamma"], "crop":args["crop"], ]);
+
+
if( fi )
+
new_args->stat = (id->conf->stat_file( fi,id )
+
|| file_stat( fi )
+
|| ({ 0,0,0,0 }))[ST_MTIME];
+
+
string fn;
+
// only for real files, to save CPU. That's somewhat hard on
+
// SiteBuilder, though, but the idea is that the cache object will
+
// be automatically destructed by sitebuilder when the image file
+
// is changed.
+
if( new_args->stat && (fn = id->conf->real_file( fi, id ) ) )
+
{
+
function(RequestID,object:int) get_cache_callback( string file, int ost )
+
{
+
return lambda( RequestID id, object key )
+
{
+
Stat st = file_stat( file );
+
if( !st || (st[ST_MTIME] != ost) )
+
{
+
destruct( key );
+
return 0;
+
}
+
return 1;
+
};
+
};
+
Roxen.add_cache_callback( id, get_cache_callback( fn, new_args->stat ) );
+
}
+
new_args->quant = args->quant || 128; foreach(glob("*-*", indices(args)), string n) new_args[n] = args[n]; string img_src = query_internal_location() + button_cache->store( ({ new_args, content }), id); return ({ img_src, new_args }); }