ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.124 by root, Wed Dec 26 18:09:30 2007 UTC vs.
Revision 1.128 by root, Thu Apr 17 20:13:17 2008 UTC

1package CFPlus::MapWidget; 1package DC::MapWidget;
2 2
3use strict; 3use strict;
4use utf8; 4use utf8;
5 5
6use List::Util qw(min max); 6use List::Util qw(min max);
7 7
8use CFPlus; 8use DC;
9use CFPlus::OpenGL; 9use DC::OpenGL;
10use CFPlus::UI; 10use DC::UI;
11use CFPlus::Macro; 11use DC::Macro;
12 12
13our @ISA = CFPlus::UI::Base::; 13our @ISA = DC::UI::Base::;
14 14
15my $magicmap_tex = 15my $magicmap_tex =
16 new_from_file CFPlus::Texture CFPlus::find_rcfile "magicmap.png", 16 new_from_file DC::Texture DC::find_rcfile "magicmap.png",
17 mipmap => 1, wrap => 0, internalformat => GL_ALPHA; 17 mipmap => 1, wrap => 0, internalformat => GL_ALPHA;
18 18
19sub new { 19sub new {
20 my $class = shift; 20 my $class = shift;
21 21
66 66
67sub editor_invoke { 67sub editor_invoke {
68 my $editsup = $::CONN && $::CONN->{editor_support} 68 my $editsup = $::CONN && $::CONN->{editor_support}
69 or return; 69 or return;
70 70
71 CFPlus::background { 71 DC::background {
72 print "preparing editor startup...\n"; 72 print "preparing editor startup...\n";
73 73
74 my $server = $editsup->{gameserver} || "default"; 74 my $server = $editsup->{gameserver} || "default";
75 $server =~ s/([^a-zA-Z0-9_\-])/sprintf "=%x=", ord $1/ge; 75 $server =~ s/([^a-zA-Z0-9_\-])/sprintf "=%x=", ord $1/ge;
76 76
78 local $ENV{CROSSFIRE_LIBDIR} = my $libdir = "$Deliantra::VARDIR/lib.$server"; mkdir $libdir; 78 local $ENV{CROSSFIRE_LIBDIR} = my $libdir = "$Deliantra::VARDIR/lib.$server"; mkdir $libdir;
79 79
80 print "map directory is $mapdir\n"; 80 print "map directory is $mapdir\n";
81 print "lib directory is $libdir\n"; 81 print "lib directory is $libdir\n";
82 82
83 my $ua = CFPlus::lwp_useragent; 83 my $ua = DC::lwp_useragent;
84 84
85 for my $file (qw(archetypes crossfire.0)) { 85 for my $file (qw(archetypes crossfire.0)) {
86 my $url = "$editsup->{lib_root}$file"; 86 my $url = "$editsup->{lib_root}$file";
87 print "mirroring $url...\n"; 87 print "mirroring $url...\n";
88 CFPlus::lwp_check $ua->mirror ($url, "$libdir/$file"); 88 DC::lwp_check $ua->mirror ($url, "$libdir/$file");
89 printf "%s size %d octets\n", $file, -s "$libdir/$file"; 89 printf "%s size %d octets\n", $file, -s "$libdir/$file";
90 } 90 }
91 91
92 if (1) { # upload a map 92 if (1) { # upload a map
93 my $mapname = $::CONN->{map_info}[0]; 93 my $mapname = $::CONN->{map_info}[0];
98 98
99 print "getting map revision for $mapname...\n"; 99 print "getting map revision for $mapname...\n";
100 100
101 # try to get the most recent head revision, what a hack, 101 # try to get the most recent head revision, what a hack,
102 # this should have been returned while downloading *sigh* 102 # this should have been returned while downloading *sigh*
103 my $log = (CFPlus::lwp_check $ua->get ("$editsup->{cvs_root}/$mapname?view=log&logsort=rev"))->decoded_content; 103 my $log = (DC::lwp_check $ua->get ("$editsup->{cvs_root}/$mapname?view=log&logsort=rev"))->decoded_content;
104 104
105 if ($log =~ /\?rev=(\d+\.\d+)"/) { 105 if ($log =~ /\?rev=(\d+\.\d+)"/) {
106 my $rev = $1; 106 my $rev = $1;
107 107
108 print "downloading revision $rev...\n"; 108 print "downloading revision $rev...\n";
109 109
110 my $map = (CFPlus::lwp_check $ua->get ("$editsup->{cvs_root}/$mapname?rev=$rev"))->decoded_content; 110 my $map = (DC::lwp_check $ua->get ("$editsup->{cvs_root}/$mapname?rev=$rev"))->decoded_content;
111 111
112 my $meta = { 112 my $meta = {
113 %$editsup, 113 %$editsup,
114 path => $mapname, 114 path => $mapname,
115 revision => $rev, 115 revision => $rev,
120 require File::Path; 120 require File::Path;
121 121
122 File::Path::mkpath (File::Basename::dirname ($mappath)); 122 File::Path::mkpath (File::Basename::dirname ($mappath));
123 open my $fh, ">:raw:perlio", "$mappath.meta" 123 open my $fh, ">:raw:perlio", "$mappath.meta"
124 or die "$mappath.meta: $!\n"; 124 or die "$mappath.meta: $!\n";
125 print $fh CFPlus::encode_json $meta; 125 print $fh DC::encode_json $meta;
126 close $fh; 126 close $fh;
127 open my $fh, ">:raw:perlio:utf8", $mappath 127 open my $fh, ">:raw:perlio:utf8", $mappath
128 or die "$mappath: $!\n"; 128 or die "$mappath: $!\n";
129 print $fh $map; 129 print $fh $map;
130 close $fh; 130 close $fh;
171 171
172 if ($ev->{button} == 1) { 172 if ($ev->{button} == 1) {
173 $self->grab_focus; 173 $self->grab_focus;
174 return unless $::CONN; 174 return unless $::CONN;
175 175
176 my $x = $self->{dx} + CFPlus::floor +($ev->{x} - $self->{sx0}) / $self->{ctilesize}; 176 my $x = $self->{dx} + DC::floor +($ev->{x} - $self->{sx0}) / $self->{ctilesize};
177 my $y = $self->{dy} + CFPlus::floor +($ev->{y} - $self->{sy0}) / $self->{ctilesize}; 177 my $y = $self->{dy} + DC::floor +($ev->{y} - $self->{sy0}) / $self->{ctilesize};
178 178
179 $x -= CFPlus::floor $::MAP->w * 0.5; 179 $x -= DC::floor $::MAP->w * 0.5;
180 $y -= CFPlus::floor $::MAP->h * 0.5; 180 $y -= DC::floor $::MAP->h * 0.5;
181 181
182 if ($::CONN) { 182 if ($::CONN) {
183 $::CONN->lookat ($x, $y) 183 $::CONN->lookat ($x, $y)
184 } 184 }
185 185
216 sub { $::PICKUP_ENABLE->toggle } 216 sub { $::PICKUP_ENABLE->toggle }
217 ], 217 ],
218 ); 218 );
219 219
220 if ($::CONN && $::CONN->{editor_support}) { 220 if ($::CONN && $::CONN->{editor_support}) {
221 push @items, [ 221# push @items, [
222 "Edit this map <span size='xx-small'>(" . (CFPlus::asxml $::CONN->{map_info}[0]) . ")</span>", 222# "Edit this map <span size='xx-small'>(" . (DC::asxml $::CONN->{map_info}[0]) . ")</span>",
223 \&editor_invoke, 223# \&editor_invoke,
224 ]; 224# ];
225 225
226 for my $type (qw(test name)) { 226 for my $type (qw(test name)) {
227 $::CONN->{editor_support}{type} ne $type 227 $::CONN->{editor_support}{type} ne $type
228 or next; 228 or next;
229 my $server = $::CONN->{editor_support}{"${type}server"} 229 my $server = $::CONN->{editor_support}{"${type}server"}
230 or next; 230 or next;
231 231
232 push @items, [ 232 push @items, [
233 "Login on $type server <span size='xx-small'>(" . (CFPlus::asxml $server) . ")</span>", 233 "Login on $type server <span size='xx-small'>(" . (DC::asxml $server) . ")</span>",
234 sub { server_login $server }, 234 sub { server_login $server },
235 ]; 235 ];
236 } 236 }
237 } 237 }
238 238
246 } 246 }
247 } 247 }
248 ], 248 ],
249 ; 249 ;
250 250
251 (new CFPlus::UI::Menu 251 (new DC::UI::Menu
252 items => \@items, 252 items => \@items,
253 )->popup ($ev); 253 )->popup ($ev);
254 } 254 }
255 255
256 1 256 1
278 278
279sub size_request { 279sub size_request {
280 my ($self) = @_; 280 my ($self) = @_;
281 281
282 ( 282 (
283 $self->{tilesize} * CFPlus::ceil $::WIDTH / $self->{tilesize}, 283 $self->{tilesize} * DC::ceil $::WIDTH / $self->{tilesize},
284 $self->{tilesize} * CFPlus::ceil $::HEIGHT / $self->{tilesize}, 284 $self->{tilesize} * DC::ceil $::HEIGHT / $self->{tilesize},
285 ) 285 )
286} 286}
287 287
288sub update { 288sub update {
289 my ($self) = @_; 289 my ($self) = @_;
291 $self->{need_update} = 1; 291 $self->{need_update} = 1;
292 $self->SUPER::update; 292 $self->SUPER::update;
293} 293}
294 294
295my %DIR = ( 295my %DIR = (
296 ( "," . CFPlus::SDLK_KP5 ), [0, "stay fire"], 296 ( "," . DC::SDLK_KP5 ), [0, "stay fire"],
297 ( "," . CFPlus::SDLK_KP8 ), [1, "north"], 297 ( "," . DC::SDLK_KP8 ), [1, "north"],
298 ( "," . CFPlus::SDLK_KP9 ), [2, "northeast"], 298 ( "," . DC::SDLK_KP9 ), [2, "northeast"],
299 ( "," . CFPlus::SDLK_KP6 ), [3, "east"], 299 ( "," . DC::SDLK_KP6 ), [3, "east"],
300 ( "," . CFPlus::SDLK_KP3 ), [4, "southeast"], 300 ( "," . DC::SDLK_KP3 ), [4, "southeast"],
301 ( "," . CFPlus::SDLK_KP2 ), [5, "south"], 301 ( "," . DC::SDLK_KP2 ), [5, "south"],
302 ( "," . CFPlus::SDLK_KP1 ), [6, "southwest"], 302 ( "," . DC::SDLK_KP1 ), [6, "southwest"],
303 ( "," . CFPlus::SDLK_KP4 ), [7, "west"], 303 ( "," . DC::SDLK_KP4 ), [7, "west"],
304 ( "," . CFPlus::SDLK_KP7 ), [8, "northwest"], 304 ( "," . DC::SDLK_KP7 ), [8, "northwest"],
305 305
306 ( "," . CFPlus::SDLK_UP ), [1, "north"], 306 ( "," . DC::SDLK_UP ), [1, "north"],
307 ("1," . CFPlus::SDLK_UP ), [2, "northeast"], 307 ("1," . DC::SDLK_UP ), [2, "northeast"],
308 ( "," . CFPlus::SDLK_RIGHT), [3, "east"], 308 ( "," . DC::SDLK_RIGHT), [3, "east"],
309 ("1," . CFPlus::SDLK_RIGHT), [4, "southeast"], 309 ("1," . DC::SDLK_RIGHT), [4, "southeast"],
310 ( "," . CFPlus::SDLK_DOWN ), [5, "south"], 310 ( "," . DC::SDLK_DOWN ), [5, "south"],
311 ("1," . CFPlus::SDLK_DOWN ), [6, "southwest"], 311 ("1," . DC::SDLK_DOWN ), [6, "southwest"],
312 ( "," . CFPlus::SDLK_LEFT ), [7, "west"], 312 ( "," . DC::SDLK_LEFT ), [7, "west"],
313 ("1," . CFPlus::SDLK_LEFT ), [8, "northwest"], 313 ("1," . DC::SDLK_LEFT ), [8, "northwest"],
314); 314);
315 315
316sub invoke_key_down { 316sub invoke_key_down {
317 my ($self, $ev) = @_; 317 my ($self, $ev) = @_;
318 318
319 my $mod = $ev->{mod}; 319 my $mod = $ev->{mod};
320 my $sym = $ev->{sym}; 320 my $sym = $ev->{sym};
321 my $uni = $ev->{unicode}; 321 my $uni = $ev->{unicode};
322 322
323 $mod &= CFPlus::KMOD_CTRL | CFPlus::KMOD_ALT | CFPlus::KMOD_SHIFT; 323 $mod &= DC::KMOD_CTRL | DC::KMOD_ALT | DC::KMOD_SHIFT;
324 324
325 if ($::CONN && (my $dir = $DIR{(!!($mod & CFPlus::KMOD_ALT)) . ",$sym"})) { 325 if ($::CONN && (my $dir = $DIR{(!!($mod & DC::KMOD_ALT)) . ",$sym"})) {
326 if ($mod & CFPlus::KMOD_SHIFT) { 326 if ($mod & DC::KMOD_SHIFT) {
327 $self->{shft}++; 327 $self->{shft}++;
328 if ($dir->[0] != $self->{fire_dir}) { 328 if ($dir->[0] != $self->{fire_dir}) {
329 $::CONN->user_send ("fire $dir->[0]"); 329 $::CONN->user_send ("fire $dir->[0]");
330 } 330 }
331 $self->{fire_dir} = $dir->[0]; 331 $self->{fire_dir} = $dir->[0];
332 } elsif ($mod & CFPlus::KMOD_CTRL) { 332 } elsif ($mod & DC::KMOD_CTRL) {
333 $self->{ctrl}++; 333 $self->{ctrl}++;
334 $::CONN->user_send ("run $dir->[0]"); 334 $::CONN->user_send ("run $dir->[0]");
335 } else { 335 } else {
336 $::CONN->user_send ("$dir->[1]"); 336 $::CONN->user_send ("$dir->[1]");
337 } 337 }
348 my $res = 0; 348 my $res = 0;
349 my $mod = $ev->{mod}; 349 my $mod = $ev->{mod};
350 my $sym = $ev->{sym}; 350 my $sym = $ev->{sym};
351 351
352 if ($::CFG->{shift_fire_stop}) { 352 if ($::CFG->{shift_fire_stop}) {
353 if (!($mod & CFPlus::KMOD_SHIFT) && delete $self->{shft}) { 353 if (!($mod & DC::KMOD_SHIFT) && delete $self->{shft}) {
354 $::CONN->user_send ("fire_stop"); 354 $::CONN->user_send ("fire_stop");
355 delete $self->{fire_dir}; 355 delete $self->{fire_dir};
356 $res = 1; 356 $res = 1;
357 } 357 }
358 } else { 358 } else {
359 if (exists $DIR{(!!($mod & CFPlus::KMOD_ALT)) . ",$sym"} && delete $self->{shft}) { 359 if (exists $DIR{(!!($mod & DC::KMOD_ALT)) . ",$sym"} && delete $self->{shft}) {
360 $::CONN->user_send ("fire_stop"); 360 $::CONN->user_send ("fire_stop");
361 delete $self->{fire_dir}; 361 delete $self->{fire_dir};
362 $res = 1; 362 $res = 1;
363 } elsif (($sym == CFPlus::SDLK_LSHIFT || $sym == CFPlus::SDLK_RSHIFT) 363 } elsif (($sym == DC::SDLK_LSHIFT || $sym == DC::SDLK_RSHIFT)
364 && delete $self->{shft}) { # XXX: is RSHIFT ok? 364 && delete $self->{shft}) { # XXX: is RSHIFT ok?
365 $::CONN->user_send ("fire_stop"); 365 $::CONN->user_send ("fire_stop");
366 delete $self->{fire_dir}; 366 delete $self->{fire_dir};
367 $res = 1; 367 $res = 1;
368 } 368 }
369 } 369 }
370 370
371 if (!($mod & CFPlus::KMOD_CTRL ) && delete $self->{ctrl}) { 371 if (!($mod & DC::KMOD_CTRL ) && delete $self->{ctrl}) {
372 $::CONN->user_send ("run_stop"); 372 $::CONN->user_send ("run_stop");
373 $res = 1; 373 $res = 1;
374 } 374 }
375 375
376 $res 376 $res
400 400
401 if ($::MAP && $::CONN) { 401 if ($::MAP && $::CONN) {
402 if (delete $self->{need_update}) { 402 if (delete $self->{need_update}) {
403 my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1; 403 my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1;
404 404
405 my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize; 405 my $sw = $self->{sw} = 1 + DC::ceil $self->{w} / $tilesize;
406 my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize; 406 my $sh = $self->{sh} = 1 + DC::ceil $self->{h} / $tilesize;
407 407
408 my $sx = CFPlus::ceil $::CFG->{map_shift_x} / $tilesize; 408 my $sx = DC::ceil $::CFG->{map_shift_x} / $tilesize;
409 my $sy = CFPlus::ceil $::CFG->{map_shift_y} / $tilesize; 409 my $sy = DC::ceil $::CFG->{map_shift_y} / $tilesize;
410 410
411 my $sx0 = $self->{sx0} = $::CFG->{map_shift_x} - $sx * $tilesize; 411 my $sx0 = $self->{sx0} = $::CFG->{map_shift_x} - $sx * $tilesize;
412 my $sy0 = $self->{sy0} = $::CFG->{map_shift_y} - $sy * $tilesize; 412 my $sy0 = $self->{sy0} = $::CFG->{map_shift_y} - $sy * $tilesize;
413 413
414 my $dx = $self->{dx} = CFPlus::ceil 0.5 * ($::MAP->w - $sw) - $sx; 414 my $dx = $self->{dx} = DC::ceil 0.5 * ($::MAP->w - $sw) - $sx;
415 my $dy = $self->{dy} = CFPlus::ceil 0.5 * ($::MAP->h - $sh) - $sy; 415 my $dy = $self->{dy} = DC::ceil 0.5 * ($::MAP->h - $sh) - $sy;
416 416
417 if ($::CFG->{fow_enable}) { 417 if ($::CFG->{fow_enable}) {
418 my ($w, $h, $data) = $::MAP->fow_texture ($dx, $dy, $sw, $sh); 418 my ($w, $h, $data) = $::MAP->fow_texture ($dx, $dy, $sw, $sh);
419 419
420 $self->{fow_texture} = new CFPlus::Texture 420 $self->{fow_texture} = new DC::Texture
421 w => $w, 421 w => $w,
422 h => $h, 422 h => $h,
423 data => $data, 423 data => $data,
424 internalformat => GL_ALPHA, 424 internalformat => GL_ALPHA,
425 format => GL_ALPHA; 425 format => GL_ALPHA;
475 475
476 $self->{root}->on_post_alloc (prepare => sub { $self->refresh_hook }); 476 $self->{root}->on_post_alloc (prepare => sub { $self->refresh_hook });
477 477
478 return unless $self->{list}; 478 return unless $self->{list};
479 479
480 my $focused = $CFPlus::UI::FOCUS == $self 480 my $focused = $DC::UI::FOCUS == $self
481 || $CFPlus::UI::FOCUS == $::COMPLETER->{entry}; 481 || $DC::UI::FOCUS == $::COMPLETER->{entry};
482 482
483 return 483 return
484 unless $focused || !$::FAST; 484 unless $focused || !$::FAST;
485 485
486 glCallList $self->{list}; 486 glCallList $self->{list};
506 glDeleteList $self->{list}; 506 glDeleteList $self->{list};
507 507
508 $self->SUPER::DESTROY; 508 $self->SUPER::DESTROY;
509} 509}
510 510
511package CFPlus::MapWidget::MapMap; 511package DC::MapWidget::MapMap;
512 512
513use strict; 513use strict;
514use utf8; 514use utf8;
515 515
516our @ISA = CFPlus::UI::Base::; 516our @ISA = DC::UI::Base::;
517 517
518use Time::HiRes qw(time); 518use Time::HiRes qw(time);
519use CFPlus::OpenGL; 519use DC::OpenGL;
520 520
521sub size_request { 521sub size_request {
522 ($::HEIGHT * 0.2, $::HEIGHT * 0.2) 522 ($::HEIGHT * 0.2, $::HEIGHT * 0.2)
523} 523}
524 524
549 $self->{y0} = $y0; 549 $self->{y0} = $y0;
550 550
551 $self->{texture_atime} = time + 1/3; 551 $self->{texture_atime} = time + 1/3;
552 552
553 $self->{texture} = 553 $self->{texture} =
554 new CFPlus::Texture 554 new DC::Texture
555 w => $w, 555 w => $w,
556 h => $h, 556 h => $h,
557 data => $::MAP->mapmap (-$ox, -$oy, $w, $h), 557 data => $::MAP->mapmap (-$ox, -$oy, $w, $h),
558 type => $CFPlus::GL_VERSION >= 1.2 ? GL_UNSIGNED_INT_8_8_8_8_REV : GL_UNSIGNED_BYTE; 558 type => $DC::GL_VERSION >= 1.2 ? GL_UNSIGNED_INT_8_8_8_8_REV : GL_UNSIGNED_BYTE;
559 } 559 }
560} 560}
561 561
562sub invoke_visibility_change { 562sub invoke_visibility_change {
563 my ($self) = @_; 563 my ($self) = @_;
609 glEnd; 609 glEnd;
610 610
611 glDisable GL_BLEND; 611 glDisable GL_BLEND;
612} 612}
613 613
614package CFPlus::MapWidget::Command; 614package DC::MapWidget::Command;
615 615
616use strict; 616use strict;
617 617
618use CFPlus::OpenGL; 618use DC::OpenGL;
619 619
620our @ISA = CFPlus::UI::Frame::; 620our @ISA = DC::UI::Frame::;
621 621
622sub new { 622sub new {
623 my $class = shift; 623 my $class = shift;
624 624
625 my $self = $class->SUPER::new ( 625 my $self = $class->SUPER::new (
626 bg => [0, 0, 0, 0.8], 626 bg => [0, 0, 0, 0.8],
627 @_, 627 @_,
628 ); 628 );
629 629
630 $self->add ($self->{vbox} = new CFPlus::UI::VBox); 630 $self->add ($self->{vbox} = new DC::UI::VBox);
631 631
632 $self->{label} = [ 632 $self->{label} = [
633 map 633 map
634 CFPlus::UI::Label->new ( 634 DC::UI::Label->new (
635 align => 0,
635 can_hover => 1, 636 can_hover => 1,
636 can_events => 1, 637 can_events => 1,
637 tooltip_width => 0.33, 638 tooltip_width => 0.33,
638 fontsize => $_, 639 fontsize => $_,
639 ), (0.8) x 16 640 ), (0.8) x 16
640 ]; 641 ];
641 642
642 $self->{entry} = new CFPlus::UI::Entry 643 $self->{entry} = new DC::UI::Entry
643 on_changed => sub { 644 on_changed => sub {
644 $self->update_labels; 645 $self->update_labels;
645 0 646 0
646 }, 647 },
647 on_button_down => sub { 648 on_button_down => sub {
648 my ($entry, $ev, $x, $y) = @_; 649 my ($entry, $ev, $x, $y) = @_;
649 650
650 if ($ev->{button} == 3) { 651 if ($ev->{button} == 3) {
651 (new CFPlus::UI::Menu 652 (new DC::UI::Menu
652 items => [ 653 items => [
653 ["bind <i>" . (CFPlus::asxml $self->{select}) . "</i> to a key" 654 ["bind <i>" . (DC::asxml $self->{select}) . "</i> to a key"
654 => sub { CFPlus::Macro::quick_macro [$self->{select}], sub { $entry->grab_focus } }] 655 => sub { DC::Macro::quick_macro [$self->{select}], sub { $entry->grab_focus } }]
655 ], 656 ],
656 )->popup ($ev); 657 )->popup ($ev);
657 return 1; 658 return 1;
658 } 659 }
659 0 660 0
674 $self->hide; 675 $self->hide;
675 } 676 }
676 } elsif ($ev->{sym} == 27) { 677 } elsif ($ev->{sym} == 27) {
677 $self->{hist_ptr} = 0; 678 $self->{hist_ptr} = 0;
678 $self->hide; 679 $self->hide;
679 } elsif ($ev->{sym} == CFPlus::SDLK_DOWN) { 680 } elsif ($ev->{sym} == DC::SDLK_DOWN) {
680 if ($self->{hist_ptr} > 1) { 681 if ($self->{hist_ptr} > 1) {
681 $self->{hist_ptr}--; 682 $self->{hist_ptr}--;
682 $self->{entry}->set_text ($self->{history}->[$self->{hist_ptr} - 1]); 683 $self->{entry}->set_text ($self->{history}->[$self->{hist_ptr} - 1]);
683 } elsif ($self->{hist_ptr} > 0) { 684 } elsif ($self->{hist_ptr} > 0) {
684 $self->{hist_ptr}--; 685 $self->{hist_ptr}--;
686 } else { 687 } else {
687 ++$self->{select_offset} 688 ++$self->{select_offset}
688 if $self->{select_offset} < $#{ $self->{last_match} || [] }; 689 if $self->{select_offset} < $#{ $self->{last_match} || [] };
689 } 690 }
690 $self->update_labels; 691 $self->update_labels;
691 } elsif ($ev->{sym} == CFPlus::SDLK_UP) { 692 } elsif ($ev->{sym} == DC::SDLK_UP) {
692 if ($self->{select_offset}) { 693 if ($self->{select_offset}) {
693 --$self->{select_offset} 694 --$self->{select_offset}
694 } else { 695 } else {
695 unless ($self->{hist_ptr}) { 696 unless ($self->{hist_ptr}) {
696 $self->{hist_saveback} = $self->{entry}->get_text; 697 $self->{hist_saveback} = $self->{entry}->get_text;
854 855
855sub _draw { 856sub _draw {
856 my ($self) = @_; 857 my ($self) = @_;
857 858
858 # hack 859 # hack
859 local $CFPlus::UI::FOCUS = $self->{entry}; 860 local $DC::UI::FOCUS = $self->{entry};
860 861
861 $self->SUPER::_draw; 862 $self->SUPER::_draw;
862} 863}
863 864
8641 8651

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines