summaryrefslogtreecommitdiffstats
path: root/perl-install/pixmaps/langs/lang-uk.png
blob: cee670ee39fc89d812bcc4a840d122570d0b6a0f (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 a9 00 00 00 0f 08 06 00 00 00 9f 90 ef .PNG........IHDR................
0020 dc 00 00 02 c5 49 44 41 54 78 9c ed d8 cf 8b d7 45 1c c7 f1 87 a6 60 92 88 e2 41 51 09 84 3a 08 .....IDATx......E.....`...AQ..:.
0040 5d 42 eb 22 5d 02 7f 20 e8 9a 22 c6 b2 b4 52 9a 48 09 4a 17 5b 4c 05 0f 8a 84 04 51 9e b6 c8 7f ]B."]....."...R.H.J.[L.....Q....
0060 20 94 8e 12 4a 81 6b 68 21 a1 90 a2 87 0e da 25 72 fd 95 ab f1 f5 30 f3 61 67 3f fb f9 b8 9f 15 ....J.kh!......%r.....0.ag?.....
0080 fc e8 c6 3c 61 e0 f3 99 f7 7b 66 de c3 bc 98 79 cf 90 c9 4c 00 1e 60 75 8d ed 18 4e b7 14 47 07 ...<a....{f....y...L..`u...N..G.
00a0 df 27 df db 5a 1a 37 33 01 f8 1a bf 62 52 a9 7e a1 20 e0 95 2d c5 b1 0f 9b 92 ef 25 2d 8d 9b 99 .'..Z.73....bR.~....-......%-...
00c0 00 cc c5 6d c3 02 29 38 82 73 ed 87 93 c9 54 b3 1f 7f 60 4a fc 9f 85 5b 58 9f f8 74 d0 15 bf 37 ...m..)8.s....T...`J...[X..t...7
00e0 63 10 1f 26 b6 8f 70 01 43 b8 82 f7 4a 63 4c c2 4e fc 8e 7f 71 07 a7 f0 46 e2 d3 15 fb aa 1a b3 c..&..p.C...JcL.N...q...F.......
0100 ae ae 37 f6 79 1f 57 b1 75 8c f6 75 7d 95 e7 d4 24 de 4c 8b bc 84 bf b0 25 fe 7f 8a 4b 98 9c f8 ..7.y.W.u..u}...$.L.....%...K...
0120 14 0b 3a 03 7f 63 05 5e 4c 6c 83 d8 88 99 82 40 87 8c 14 f9 0e dc c4 5a 2c c0 eb f8 19 97 13 9f ..:..c.^Ll.....@.......Z,.......
0140 f1 8a b4 5b 10 e7 07 b1 cf f7 f1 9f e1 1c bb a9 48 ab e6 d4 24 de 4c cb 6c c7 9f 82 c8 6e 18 bd ...[............H...$.L.l....n..
0160 13 16 0b ba 17 c7 2b 6c 9f 95 ea 8e 0a 8b 5a b0 06 eb 4a 3e dd 82 a8 0a c6 2b d2 01 7c 55 b2 ef ......+l......Z...J>.....+..|U..
0180 14 c4 56 d7 be aa af aa 39 35 89 37 d3 32 53 84 23 7f 00 d7 0c 1f fd 05 1d 41 bc 37 30 bf c2 f6 ..V.....95.7.2S.#........A.70...
01a0 56 a9 ae 57 c8 75 53 96 a2 0f fd c2 ab c1 2d 23 45 59 25 d2 5e 21 6f 2e 4a 2a bc 3b d1 5e 47 27 V..W.uS.......-#EY%.^!o.J*.;.^G'
01c0 29 77 71 c6 c8 8b e0 e3 e6 d4 24 de 4c 0b a4 c7 f9 43 ec 16 72 ae c3 f1 bf cc 27 38 6b f4 ee c5 )wq.......$.L....C..r.....'8k...
01e0 e8 1d 66 72 a9 ae 0f 3f 61 31 2e e2 60 ec 6f 2c be c1 f5 a4 a4 bc 60 6c d1 6c c6 3c bc 86 1f 71 ..fr...?a1..`.o,......`l.l.<...q
0200 02 af 24 f6 ba 39 3d 69 bc 99 a7 cc 0a 41 08 d3 2a 6c c5 0e 36 4f d8 c1 36 96 6c bb 4a fe fd 82 ..$..9=i.....A..*l..6O..6.l.J...
0220 28 0a 06 8d 4e 09 f6 c4 b6 c5 f3 d7 78 8f fb f3 f8 a2 64 ff 16 5f d6 b4 9f 1e eb de 6d 30 a7 26 (...N.......x.....d.._......m0.&
0240 f1 66 5a 64 25 de 14 6e b2 db 6b 7c d2 05 3f 24 dc e0 a7 26 b6 7f f0 8e 70 6c 7e 2c bc b1 2e 4f .fZd%..n..k|..?$...&....pl~,...O
0260 da 5f c1 49 bc 8c 39 c2 65 67 30 b6 9d 1e 7d c6 2b d2 1e dc 13 72 c5 05 c2 d1 3f 84 55 89 6f 4f ._.I..9.eg0...}.+....r....?.U.oO
0280 1c 6f 11 0e 08 27 c4 ab 0d e6 d4 24 de 4c 8b 5c 13 72 b6 ef 8c 4c 01 52 d2 05 9d 2d 88 72 47 62 .o...'.....$.L.\.r...L.R...-.rGb
02a0 fb 1c bf 09 22 b9 20 5c 3c 52 96 e2 97 68 bf 89 1f f0 76 6c bb 2c fa 3c c9 13 d4 16 21 97 7e 20 ...."..\<R...h....vl.,.<....!.~.
02c0 dc bc 7b 4a be 45 79 28 bc 58 94 4f 80 ba 39 35 89 37 33 81 e8 60 c3 b3 0e 22 f3 ff a4 6e d7 cc ..{J.Ey(.X.O..95.73..`..."...n..
02e0 64 9e 1b b2 48 33 cf 3d 8f 00 e4 62 eb 32 36 93 e5 4a 00 00 00 00 49 45 4e 44 ae 42 60 82 d...H3.=...b.26..J....IEND.B`.
>180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
package my_gtk; # $Id$

use diagnostics;
use strict;
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border);

@ISA = qw(Exporter);
%EXPORT_TAGS = (
    helpers => [ qw(create_okcancel createScrolledWindow create_menu create_notebook create_packtable create_hbox create_vbox create_adjustment create_box_with_title create_treeitem) ],
    wrappers => [ qw(gtksignal_connect gtkradio gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtkpowerpack gtkset_editable gtksetstyle gtkset_tip gtkappenditems gtkappend gtkset_shadow_type gtkset_layout gtkset_relief gtkadd gtkput gtktext_insert gtkset_usize gtksize gtkset_justify gtkset_active gtkset_sensitive gtkset_modal gtkset_border_width gtkmove gtkresize gtkshow gtkhide gtkdestroy gtkcolor gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkpng create_pix_text get_text_coord fill_tiled gtkicons_labels_widget write_on_pixmap gtkcreate_xpm gtkcreate_png gtkbuttonset gtkroot gtkentry) ],
    ask => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_browse_tree_info ask_browse_tree_info_given_widgets ask_dir) ],
);
$EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ];
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;

use ugtk qw(:helpers :wrappers :various);
use common;
use log;


my $forgetTime = 1000; #- in milli-seconds
$border = 5;

#-###############################################################################
#- OO stuff
#-###############################################################################

sub new {
    my ($type, $title, %opts) = @_;

    Gtk->init;
    Gtk->set_locale;

    my $o = bless { %opts }, $type;
    $o->_create_window($title);
    while (my $e = shift @tempory::objects) { $e->destroy }
    foreach (@interactive::objects) {
	$_->{rwindow}->set_modal(0) if $_->{rwindow}->can('set_modal');
    }
    push @interactive::objects, $o if !$opts{no_interactive_objects};
    $o->{rwindow}->set_position('center_always') if $::isStandalone;
    $o->{rwindow}->set_modal(1) if $my_gtk::grab || $o->{grab};
    
    if ($::isWizard && !$my_gtk::pop_it) {
	$o->{window} = new Gtk::VBox(0,0);
	$o->{window}->set_border_width($::Wizard_splash ? 0 : 10);
	$o->{rwindow} = $o->{window};
	if (!defined($::WizardWindow)) {
	    $::WizardWindow = new Gtk::Window;
	    $::WizardWindow->set_position('center_always');
	    $::WizardWindow->signal_connect(delete_event => sub { die 'wizcancel' });
	    $::WizardTable = new Gtk::Table(2, 2, 0);
	    $::WizardWindow->add($::WizardTable);
	    my $draw1 = new Gtk::DrawingArea;
	    $draw1->set_usize(540,100);
	    my $draw2 = new Gtk::DrawingArea;
	    $draw2->set_usize(100,300);
	    my ($im_up, $mask_up) = gtkcreate_png($::Wizard_pix_up || "wiz_default_up.png");
	    my ($y1, $x1) = $im_up->get_size;
	    my ($im_left, $mask_left) = gtkcreate_png($::Wizard_pix_left || "wiz_default_left.png");
	    my ($y2, $x2) = $im_left->get_size;
	    my $style = $draw1->style->copy();
	    $style->font(Gtk::Gdk::Font->fontset_load("-adobe-utopia-regular-r-*-*-25-*-*-*-p-*-iso8859-*"));
	    my $w = $style->font->string_width($::Wizard_title);
	    $draw1->signal_connect(expose_event => sub {
				       for (my $i = 0; $i < (540/$y1); $i++) {
					   $draw1->window->draw_pixmap ($draw1->style->bg_gc('normal'),
									$im_up, 0, 0, 0, $y1*$i,
									$x1 , $y1);
					   $draw1->window->draw_string(
								       $style->font,
								       $draw1->style->white_gc,
								       140+(380-$w)/2, 62,
								       ($::Wizard_title) );
				       }
				   });
	    $draw2->signal_connect(expose_event => sub {
				       for (my $i = 0; $i < (300/$y2); $i++) {
					   $draw2->window->draw_pixmap ($draw2->style->bg_gc('normal'),
									$im_left, 0, 0, 0, $y2*$i,
									$x2 , $y2);
				       }
				   });
	    $::WizardTable->attach($draw1, 0, 2, 0, 1, 'fill', 'fill', 0, 0);
	    #- $::WizardTable->attach($draw2, 0, 1, 1, 2, 'fill', 'fill', 0, 0);
	    $::WizardTable->set_usize(540,400);
	    $::WizardWindow->show_all;
	    flush();
	}
	$::WizardTable->attach($o->{window}, 0, 2, 1, 2, [-fill, -expand], [-fill, -expand], 0, 0);
    }

    if ($::isEmbedded && !$my_gtk::pop_it && !eval { $::Plug->child }) {
	$o->{window} = new Gtk::HBox(0,0);
	$o->{rwindow} = $o->{window};
	$::Plug ||= new Gtk::Plug ($::XID);
	$::Plug->show;
	flush();
	$::Plug->add($o->{window});
    }
    $::CCPID and kill "USR2", $::CCPID;
    $o;
}
sub main {
    my ($o, $completed, $canceled) = @_;
    gtkset_mousecursor_normal();
    my $timeout = Gtk->timeout_add(1000, sub { gtkset_mousecursor_normal(); 1 });
    my $b = MDK::Common::Func::before_leaving { Gtk->timeout_remove($timeout) };
    $o->show;

    do {
	local $::setstep = 1;
	Gtk->main;
    } while ($o->{retval} ? $completed && !$completed->() : $canceled && !$canceled->());
    $o->destroy;
    $o->{retval}
}

sub show($) {
    my ($o) = @_;
    $o->{window}->show;
    $o->{rwindow}->show;
}
sub destroy($) {
    my ($o) = @_;
    $o->{rwindow} and $o->{rwindow}->destroy;
    gtkset_mousecursor_wait();
    flush();
}
sub DESTROY { goto &destroy }
sub sync {
    my ($o) = @_;
    show($o);
    flush();
}
sub flush { gtkflush() }

#-###############################################################################
#- createXXX functions

#- these functions return a widget
#-###############################################################################

sub create_okcancel {
    my ($w, $ok, $cancel, $spread, @other) = @_;
    my $one = ($ok xor $cancel);
    $spread ||= $::isWizard ? "end" : "spread";
    $ok ||= $::isWizard ? ($::Wizard_finished ? _("Finish") : _("Next ->")) : _("Ok");
    $cancel ||= $::isWizard ? _("<- Previous") : _("Cancel");
    my $b1 = gtksignal_connect($w->{ok} = new Gtk::Button($ok), clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk->main_quit });
    my $b2 = !$one && gtksignal_connect($w->{cancel} = new Gtk::Button($cancel), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk->main_quit });
    $::isWizard and gtksignal_connect($w->{wizcancel} = new Gtk::Button(_("Cancel")), clicked => sub { die 'wizcancel' });
    my @l = grep { $_ } $::isWizard ? ($w->{wizcancel}, $::Wizard_no_previous ? () : $b2, $b1): ($b1, $b2);
    push @l, map { gtksignal_connect(new Gtk::Button($_->[0]), clicked => $_->[1]) } @other;

    $_->can_default($::isWizard) foreach @l;
    gtkadd(create_hbox($spread), @l);
}


sub _create_window($$) {
    my ($o, $title) = @_;
    my $w = new Gtk::Window;
    my $gc = Gtk::Gdk::GC->new(gtkroot());
    !$::isStandalone && !$::live && !$::g_auto_install and $my_gtk::shape_width = 3;
#-  $gc->set_foreground(gtkcolor(8448, 17664, 40191)); #- in hex : 33, 69, 157
    $gc->set_foreground(gtkcolor(5120, 10752, 22784)); #- in hex : 20, 42, 89
#-    $gc->set_foreground(gtkcolor(16896, 16896, 16896)); #- in hex : 66, 66, 66
    my $inner = gtkadd(my $f_ = gtkset_shadow_type(new Gtk::Frame(undef), 'out'),
		       my $f = gtkset_border_width(gtkset_shadow_type(new Gtk::Frame(undef), 'none'), 3)
		      );
    my $table;
    if ($::isStandalone || $::live || $::g_auto_install || $::noShadow) { gtkadd($w, $inner) if !$::noBorder } else {
	my $sqw = $my_gtk::shape_width;
	gtkadd($w, $table = new Gtk::Table(2, 2, 0));
	$table->attach($inner, 0, 1, 0, 1, 1|4, 1|4, 0, 0);
	$table->attach(gtksignal_connect(gtkset_usize(new Gtk::DrawingArea, $sqw, 1), expose_event => sub {
					      $_[0]->window->draw_rectangle($_[0]->style->bg_gc('normal'), 1, 0, 0, $sqw, $sqw);
					      $_[0]->window->draw_rectangle($gc, 1, 0, $sqw, $sqw, $_[0]->allocation->[3]);
					  }),
			1, 2, 0, 1, 'fill', 'fill', 0, 0);
	$table->attach(gtksignal_connect(gtkset_usize(new Gtk::DrawingArea, 1, $sqw), expose_event => sub {
					      $_[0]->window->draw_rectangle($_[0]->style->bg_gc('normal'), 1, 0, 0, $sqw, $sqw);
					      $_[0]->window->draw_rectangle($gc, 1, $sqw, 0, $_[0]->allocation->[2], $sqw);
					  }),
			0, 1, 1, 2, 'fill', 'fill', 0, 0);
	$table->attach(gtksignal_connect(gtkset_usize(new Gtk::DrawingArea, $sqw, $sqw), expose_event => sub {
					      $_[0]->window->draw_rectangle($gc, 1, 0, 0, $sqw, $sqw);
					  }),
			1, 2, 1, 2, 'fill', 'fill', 0, 0);
	$table->show_all;
    }
    $w->set_name("Title");
    $w->set_title($title);

    $w->signal_connect(expose_event => sub { eval { $interactive::objects[-1]{rwindow} == $w and $w->window->XSetInputFocus } }) if $my_gtk::force_focus || $o->{force_focus};
    $w->signal_connect(delete_event => sub { $w->destroy; die 'wizcancel' });
    $w->set_uposition(@{$my_gtk::force_position || $o->{force_position}}) if $my_gtk::force_position || $o->{force_position};

    my $focusing;
    $w->signal_connect(focus => sub { 
        return 1 if $focusing;
	$focusing = 1;
	Gtk->idle_add(sub { $w->ensure_focus($_[0]); $focusing = 0; 0 }, $_[1]);
    }) if $w->can('ensure_focus');

    if ($::o->{mouse}{unsafe}) {
	$w->set_events("pointer_motion_mask");
	my $signal;
	$signal = $w->signal_connect(motion_notify_event => sub {
	    delete $::o->{mouse}{unsafe};
	    log::l("unsetting unsafe mouse");
	    $w->signal_disconnect($signal);
	});
    }
    $w->signal_connect(key_press_event => sub {
	my $d = ${{ 0xffbe => 'help',
		    0xffbf => 'screenshot',
	            0xffc9 => 'next',
		    0xffc8 => 'previous' }}{$_[1]{keyval}};

	if ($d eq "help") {
	    require install_gtk;
	    install_gtk::create_big_help($::o);
	} elsif ($::isInstall && $d eq 'screenshot') {
	    common::take_screenshot($o);
	} elsif (chr($_[1]{keyval}) eq 'e' && $_[1]{state} & 8) {
	    log::l("Switching to " . ($::expert ? "beginner" : "expert"));
	    $::expert = !$::expert;
	} elsif ($d) {
	    #- previous field is created here :(
	    my $s; foreach (reverse @{$::o->{orderedSteps}}) {
		$s->{previous} = $_ if $s;
		$s = $::o->{steps}{$_};
	    }
	    $s = $::o->{step};
	    do { $s = $::o->{steps}{$s}{$d} } until !$s || $::o->{steps}{$s}{reachable};
	    $::setstep && $s and die "setstep $s\n";
	}
    }); #- if $::isInstall;

    $w->signal_connect(size_allocate => sub {
	my ($wi, $he) = @{$_[1]}[2,3];
	my ($X, $Y, $Wi, $He) = @{$my_gtk::force_center || $o->{force_center}};
        $w->set_uposition(max(0, $X + ($Wi - $wi) / 2), max(0, $Y + ($He - $he) / 2));

	if (!$::isStandalone && !$::live && !$::g_auto_install && !$::noShadow) {
	    my $sqw = $my_gtk::shape_width; #square width
	    my $wia = int(($wi+7)/8);
	    my $s = "\xFF" x ($wia*$he);
	    my $wib = $wia*8;
	    my $dif = $wib-$wi;
	    foreach my $y (0..$sqw-1) { vec($s, $wib-1-$dif-$_+$wib*$y, 1) = 0x0 foreach (0..$sqw-1) }
	    foreach my $y (0..$sqw-1) { vec($s, (($he-1)*$wib)-$wib*$y+$_, 1) = 0x0 foreach (0..$sqw-1) }
	    $w->realize;
	    my $b = Gtk::Gdk::Bitmap->create_from_data($w->window, $s, $wib, $he);
	    $w->window->shape_combine_mask($b, 0, 0);
	}
    }) if ($my_gtk::force_center || $o->{force_center}) && !($my_gtk::force_position || $o->{force_position}) ;

    $o->{window} = $::noBorder ? $w : $f;
    $o->{rwindow} = $w;
    $table and $table->draw(undef);
}