… | |
… | |
1635 | } |
1635 | } |
1636 | |
1636 | |
1637 | $self |
1637 | $self |
1638 | } |
1638 | } |
1639 | |
1639 | |
1640 | sub escape($) { |
|
|
1641 | local $_ = $_[0]; |
|
|
1642 | |
|
|
1643 | s/&/&/g; |
|
|
1644 | s/>/>/g; |
|
|
1645 | s/</</g; |
|
|
1646 | |
|
|
1647 | $_ |
|
|
1648 | } |
|
|
1649 | |
|
|
1650 | sub update { |
1640 | sub update { |
1651 | my ($self) = @_; |
1641 | my ($self) = @_; |
1652 | |
1642 | |
1653 | delete $self->{texture}; |
1643 | delete $self->{texture}; |
1654 | $self->SUPER::update; |
1644 | $self->SUPER::update; |
… | |
… | |
2203 | $self->{aspect} ||= $self->{tex}{w} / $self->{tex}{h}; |
2193 | $self->{aspect} ||= $self->{tex}{w} / $self->{tex}{h}; |
2204 | |
2194 | |
2205 | $self |
2195 | $self |
2206 | } |
2196 | } |
2207 | |
2197 | |
|
|
2198 | sub STORABLE_freeze { |
|
|
2199 | my ($self, $cloning) = @_; |
|
|
2200 | |
|
|
2201 | warn "freeze<$self>\n";#d# |
|
|
2202 | |
|
|
2203 | $self->{path} |
|
|
2204 | or die "cannot serialise CFClient::UI::Image on non-loadable images\n"; |
|
|
2205 | |
|
|
2206 | $self->{path} |
|
|
2207 | } |
|
|
2208 | |
|
|
2209 | sub STORABLE_attach { |
|
|
2210 | my ($self, $cloning, $path) = @_; |
|
|
2211 | warn "attach<@_>\n";#d# |
|
|
2212 | |
|
|
2213 | $self->new (path => $path) |
|
|
2214 | } |
|
|
2215 | |
2208 | sub size_request { |
2216 | sub size_request { |
2209 | my ($self) = @_; |
2217 | my ($self) = @_; |
2210 | |
2218 | |
2211 | ($self->{tex}{w}, $self->{tex}{h}) |
2219 | ($self->{tex}{w}, $self->{tex}{h}) |
2212 | } |
2220 | } |
… | |
… | |
2226 | } |
2234 | } |
2227 | |
2235 | |
2228 | glEnable GL_TEXTURE_2D; |
2236 | glEnable GL_TEXTURE_2D; |
2229 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2237 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2230 | |
2238 | |
2231 | $tex->draw_quad_alpha (0, 0, $w, $h); |
2239 | $tex->draw_quad (0, 0, $w, $h); |
2232 | |
2240 | |
2233 | glDisable GL_TEXTURE_2D; |
2241 | glDisable GL_TEXTURE_2D; |
2234 | } |
2242 | } |
2235 | |
2243 | |
2236 | ############################################################################# |
2244 | ############################################################################# |
… | |
… | |
2528 | sub invoke_mouse_wheel { |
2536 | sub invoke_mouse_wheel { |
2529 | my ($self, $ev) = @_; |
2537 | my ($self, $ev) = @_; |
2530 | |
2538 | |
2531 | my $delta = $self->{vertical} ? $ev->{dy} : $ev->{dx}; |
2539 | my $delta = $self->{vertical} ? $ev->{dy} : $ev->{dx}; |
2532 | |
2540 | |
2533 | $self->set_value ($self->{range}[0] + $delta * $self->{range}[3] * 0.1); |
2541 | $self->set_value ($self->{range}[0] + $delta * $self->{range}[3] * 0.2); |
2534 | |
2542 | |
2535 | ! ! $delta |
2543 | ! ! $delta |
2536 | } |
2544 | } |
2537 | |
2545 | |
2538 | sub update { |
2546 | sub update { |