summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrol-center128
1 files changed, 96 insertions, 32 deletions
diff --git a/control-center b/control-center
index bd89de54..25140f8b 100755
--- a/control-center
+++ b/control-center
@@ -68,14 +68,14 @@ my $png_path="$_iconsdir";
$::isWiz = $in->do_pkgs->is_installed(q(wizard));
my @tree =
- ( [_("Boot"), 'boot-mdk.png',
+ ( [_("Boot"), 'boot-mdk',
[
[_("Boot Disk"), 'drakfloppy-mdk.png', "$_xbindir/drakfloppy.real"],
[_("Boot Config"),'drakboot-mdk.png', "$_sbindir/drakboot"],
[_("Auto Install"), 'drakfloppy-mdk.png', "$_sbindir/drakautoinst"],
]
],
- [_("Hardware"), 'drakhard-mdk.png',
+ [_("Hardware"), 'drakhard-mdk',
[
[_("Display"),'XFdrake-mdk.png', "$_sbindir/XFdrake"],
[_("Hardware"),'harddrake-mdk.png', "$_sbindir/harddrake"],
@@ -85,20 +85,20 @@ my @tree =
[_("Mount Points"),'partition-mdk.png', "$_sbindir/diskdrake"],
]
],
- [_("Network & Internet"),'net-mdk.png',
+ [_("Network & Internet"),'net-mdk',
[
[_("Connection"), 'draknet-mdk.png', "$_sbindir/draknet"],
[_("Connection Sharing"),'drakgw-mdk.png', "$_sbindir/drakgw"],
#[_("Proxy"), 'drakgw-mdk.png', "$_sbindir/drakproxy"],
],
],
- [_("Security"),'security-mdk.png',
+ [_("Security"),'security-mdk',
[
[_("Security Level"), 'draksec-mdk.png', "$_sbindir/draksec"],
[_("Firewalling"), 'firewall-mdk.png', "$_sbindir/tinyfirewall"],
]
],
- [_("System"),'system-mdk.png',
+ [_("System"),'system-mdk',
[
[_("Menus") , 'menudrake-mdk.png', "$_sbindir/menus.pm"],
[_("Services") , 'service-mdk.png', "$_sbindir/drakxservices"],
@@ -128,32 +128,82 @@ $window_global->set_position(1);
$window_global->set_title( _("Mandrake Control Center %s", $_version));
#$window_global->border_width(0);
-my ($pixmap_back_left, undef) = gtkcreate_png('mcc-left-back');
+my $notebook_global;
-my @darea_left_list = map {
+my ($pixmap_back_left, undef) = gtkcreate_png('mcc-left-back');
+my @darea_left_list;
+my $cursor_hand = new Gtk::Gdk::Cursor 60;
+my $cursor_normal = new Gtk::Gdk::Cursor 68;
+my @back;
+($back[0], undef) = gtkcreate_png('mcc-left-back');
+($back[2], undef) = gtkcreate_png('mcc-left-back2');
+$back[1] = $back[0];
+my $style_dflt = new Gtk::Style;
+my $index = 0;
+foreach (@tree) {
+ $index++;
+ my $index = $index;
my $text = $_->[0];
+ my @icon;
+ ($icon[0], undef) = gtkcreate_png($_->[1]);
+ ($icon[1], undef) = gtkcreate_png("$_->[1]_highlight");
+ ($icon[2], undef) = gtkcreate_png("$_->[1]2");
my $darea_left = gtkset_usize(new Gtk::DrawingArea, 160, 45);
+ $darea_left->{state} = 0;
my $dbl_area_left;
- my ($pixmap_back_left, undef) = gtkcreate_png('mcc-left-back');
+ $darea_left->set_events(['exposure_mask', 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]);
$darea_left->signal_connect( size_allocate => sub { $dbl_area_left = undef });
$darea_left->signal_connect( expose_event => sub {
+ my $plop = defined($dbl_area_left) ? $dbl_area_left->{state} : "not defined";
my ($dx, $dy) = ($darea_left->allocation->[2], $darea_left->allocation->[3]);
- if (!defined($dbl_area_left)) {
- my ($dbl_area_left, $width, $height, $asc, $desc) = create_pix_text($darea_left, $text, "#0#0#0",
- _("-urw-helvetica-medium-r-normal-*-*-100-*-*-p-*-iso8859-1"),
- max($dx-40, 0), $dy, 0, 0, 5, $pixmap_back_left, 160, 45); #"#0#0#0",
+ if (!defined($dbl_area_left) || $darea_left->{state} != $dbl_area_left->{state} ) {
+ my $state = $darea_left->{state};
+ my ($pix, $width, $height, $asc, $desc) = create_pix_text($darea_left, $text, "#0#0#0",
+ $style_dflt->font,
+ max($dx-40, 0), $dy, 0, 0, $back[$state], 160, 45, 0, 1); #"#0#0#0",
$dbl_area_left = new Gtk::Gdk::Pixmap($darea_left->window, $dx, $dy);
+ $dbl_area_left->{state} = $darea_left->{state};
+ $darea_left->{dbl} = $dbl_area_left;
+ #FIXME
+ fill_tiled($darea_left, $dbl_area_left, $back[$state], 40, $dy, 40, 45);
$dbl_area_left->draw_pixmap($darea_left->style->bg_gc('normal'),
- $pixmap_icon, 0, 0, 4, ($dy-35) 0, 35, 35);
- my $y_pos = int( (55-$height)/2/5 )*5 + 10;
+ $icon[$state], 0, 0, 4, int(($dy-35)/2/5)*5, 35, 35);
$dbl_area_left->draw_pixmap($darea_left->style->bg_gc('normal'),
- $pix, 0, 0, 336, $y_pos, $width, $height);
+ $pix, 0, 0, 40, 0, $width, $height);
}
$darea_left->window->draw_pixmap($darea_left->style->bg_gc('normal'),
$dbl_area_left, 0, 0, 0, 0, ($dx, $dy));
});
- $darea_left;
-} @tree;
+ $darea_left->signal_connect( realize => sub { $darea_left->window->set_cursor($cursor_hand) });
+ $darea_left->signal_connect( enter_notify_event => sub {
+ if ($darea_left->{state} == 0) {
+ $darea_left->{state} = 1;
+ $darea_left->draw(undef);
+ }
+ });
+ $darea_left->signal_connect( leave_notify_event => sub {
+ if ($darea_left->{state} == 1) {
+ $darea_left->{state} = 0;
+ $darea_left->draw(undef);
+ }
+ });
+ $darea_left->signal_connect( button_release_event => sub {
+ $darea_left->{state} == 2 and return;
+ for (my $i = 1; $i < @darea_left_list; $i+=2) {
+ $darea_left_list[$i]->window->set_cursor($cursor_hand);
+ if($darea_left_list[$i]->{state} != 0) {
+ $darea_left_list[$i]->{state} = 0;
+ $darea_left_list[$i]->draw(undef);
+ }
+ }
+ $darea_left->window->set_cursor($cursor_normal);
+ $darea_left->{state} = 2, $darea_left->draw(undef);
+ print "index : $index \n";
+ $notebook_global->set_page($index);
+ });
+
+ push @darea_left_list, (0, $darea_left);
+}
$window_global->add(
gtkpack_(new Gtk::VBox(0, 0),
@@ -161,16 +211,29 @@ $window_global->add(
0, my $darea_title = gtkset_usize(new Gtk::DrawingArea, 450, 55),
0, new Gtk::HSeparator,
1, gtkpack_(new Gtk::HBox(0, 0),
- gtkpack_(new Gtk::HBox(0, 0),
- 0,
-
- ),
- 1, my $notebook_global = new Gtk::Widget ('Gtk::Notebook',
+ 0, gtkpack2_(new Gtk::VBox(0, 0),
+ @darea_left_list,
+ 1, my $last_darea = new Gtk::DrawingArea,
+ ),
+ 1, $notebook_global = new Gtk::Widget ('Gtk::Notebook',
show_border => 0,
show_tabs => 0),
)
)
);
+my $dbl_arealast;
+$last_darea->signal_connect( size_allocate => sub { $dbl_arealast = undef });
+$last_darea->signal_connect( expose_event => sub {
+ my ($dx, $dy) = ($last_darea->allocation->[2], $last_darea->allocation->[3]);
+ if (!defined($dbl_arealast)) {
+ $dbl_arealast = new Gtk::Gdk::Pixmap($last_darea->window, $dx, $dy);
+ #FIXME
+ fill_tiled($last_darea, $dbl_arealast, $back[0], $dx, $dy, 160, 45);
+ }
+ $last_darea->window->draw_pixmap($last_darea->style->bg_gc('normal'),
+ $dbl_arealast, 0, 0, 0, 0, ($dx, $dy));
+ });
+
my $dbl_area;
my ($pixmap_back, undef) = gtkcreate_png('mcc-title-back');
@@ -186,9 +249,8 @@ $darea_title->signal_connect( expose_event => sub {
my ($pix, $width, $height, $asc, $desc) = create_pix_text($darea_title, "welcome", "#255#255#255",
_("-urw-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1"),
#_("-urw-times-bold-r-normal-*-*-200-*-*-p-*-iso8859-1"),
- max($dx-336, 0), $dy, 0, 1, 5, $pixmap_back, 5, 5); #"#0#0#0",
+ max($dx-336, 0), $dy, 0, 1, $pixmap_back, 110, 55, 0, 0); #"#0#0#0" $pixmap_back,
$dbl_area = new Gtk::Gdk::Pixmap($darea_title->window, $dx, $dy);
- print "CALL tiled : $dx, $dy\n";
fill_tiled($darea_title, $dbl_area, $pixmap_back, 110, 55, $dx, $dy);
$dbl_area->draw_pixmap($darea_title->style->bg_gc('normal'),
$pixmap_icon, 0, 0, 0, 0, 336, 55);
@@ -242,23 +304,26 @@ $darea1->signal_connect( expose_event => sub {
0, 0, ($dx-540)/2, ($dy-460)/2, 540, 460);
my $style = new Gtk::Style;
my $style_dflt = new Gtk::Style;
- $style->font(Gtk::Gdk::Font->fontset_load(_("-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*")));
- $pix_dbl->draw_string($style->font, $darea1->style->black_gc, 103, 165, _("Welcome to the Mandrake Control Center") );
+ $style->font(Gtk::Gdk::Font->fontset_load(_("-urw-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1")));
+ #_("-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*")));
+ $pix_dbl->draw_string($style->font, $darea1->style->black_gc, 80, 165, _("Welcome to the Mandrake Control Center") );
my @revtree;
open VERS, "/etc/mandrake-release" or die _("cannot open this file for read: %s", $!);
while (<VERS>) { push (@revtree,$_) }
my @info_tree = split / /, $revtree[0];
my ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
my $style1 = new Gtk::Style;
- $style1->font(Gtk::Gdk::Font->fontset_load(_("-adobe-times-bold-r-normal--14-*-100-100-p-*-iso8859-*,*-r-*")));
+ $style1->font(Gtk::Gdk::Font->fontset_load(_("-urw-helvetica-medium-r-normal-*-*-90-*-*-p-*-iso8859-1")));
+ #_("-adobe-times-bold-r-normal--14-*-100-100-p-*-iso8859-*,*-r-*")));
my $i=0;
foreach(
[_("System:"), "$info_tree[0] $info_tree[1] $info_tree[3] $info_tree[4]"],
[_("Hostname:"), $nodename],
[_("Kernel Version:"), "$release $version"],
[_("Machine:"), $machine] ) {
- $pix_dbl->draw_string($style1->font, $darea1->style->black_gc, 80, 220+$i, $_->[0]);
- $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 200, 220+$i, $_->[1]);
+ $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 80, 200+$i, $_->[0]);
+ $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 81, 200+$i, $_->[0]);
+ $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 200, 200+$i, $_->[1]);
$i+=20;
}
}
@@ -298,11 +363,10 @@ foreach (@tree) {
$notebook_global->append_page(
# gtkicons_labels_widget($_->[2], $window_global, "#0#0#0", _("-urw-times-bold-r-normal-*-*-100-*-*-p-*-iso8859-1"),
# 2, $pixmap_back_right, 540, 460, 44, 40, 5, 5, 32, 32)
- gtkicons_labels_widget($_->[2], $window_global, "#0#0#0", _("-b&h-lucida sans unicode-medium-r-normal-*-*-100-*-*-p-*-iso8859-1"),
+ gtkicons_labels_widget($_->[2], $window_global, "#0#0#0", $style_dflt->font,
#"-urw-times-bold-r-normal-*-*-100-*-*-p-*-iso8859-1"),
- 2, $pixmap_back_right, 540, 460, 44, 40, 50, 50, 32, 32)
+ $pixmap_back_right, 540, 460, 44, 40, 50, 50, 32, 32)
);
-
}
# my $cursor = new Gtk::Gdk::Cursor 10;