--- deliantra/Deliantra-Client/bin/cfplus 2006/05/27 20:26:22 1.17
+++ deliantra/Deliantra-Client/bin/cfplus 2006/05/28 01:37:45 1.22
@@ -179,6 +179,8 @@
sub client_setup {
my $dialog = new CFClient::UI::FancyFrame
+ req_x => 1,
+ req_y => $HEIGHT * (1/8),
name => "client_setup",
title => "Client Setup",
child => (my $vbox = new CFClient::UI::VBox);
@@ -204,7 +206,7 @@
$table->add (1, $row++, new CFClient::UI::CheckBox
state => $CFG->{fullscreen},
tooltip => "Bring the client into fullscreen mode.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{fullscreen} = $value;
}
@@ -214,7 +216,7 @@
$table->add (1, $row++, new CFClient::UI::CheckBox
state => $CFG->{fast},
tooltip => "Lower the visual quality considerably to speed up rendering.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{fast} = $value;
}
@@ -224,7 +226,7 @@
$table->add (1, $row++, new CFClient::UI::Slider
range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1],
tooltip => "Enlarge or shrink the displayed map. Changes are instant.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{map_scale} = 2 ** $value;
}
@@ -234,7 +236,7 @@
$table->add (1, $row++, new CFClient::UI::CheckBox
state => $CFG->{fow_enable},
tooltip => "Fog-of-War marks areas that cannot be seen by the player. Changes are instant.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{fow_enable} = $value;
}
@@ -244,7 +246,7 @@
$table->add (1, $row++, new CFClient::UI::Slider
range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256],
tooltip => "Fog of War Lightness. The higher the intensity, the lighter the Fog-of-War color. Changes are instant.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{fow_intensity} = $value;
}
@@ -254,7 +256,7 @@
$table->add (1, $row++, new CFClient::UI::CheckBox
state => $CFG->{fow_smooth},
tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{fow_smooth} = $value;
status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::OpenGL::GL_VERSION < 1.2;
@@ -265,14 +267,14 @@
$table->add (1, $row++, new CFClient::UI::Slider
range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1],
tooltip => "The base font size used by most GUI elements that do not have their own setting.",
- connect_changed => sub { $CFG->{gui_fontsize} = $_[1] },
+ on_changed => sub { $CFG->{gui_fontsize} = $_[1] },
);
$table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Message Fontsize");
$table->add (1, $row++, new CFClient::UI::Slider
range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1],
tooltip => "The font size used by the message/server log window only. Changes are instant.",
- connect_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) },
+ on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) },
);
$table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize");
@@ -280,7 +282,7 @@
$table->add (1, $row++, new CFClient::UI::Slider
range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1],
tooltip => "The font size used by the statistics window only. Changes are instant.",
- connect_changed => sub {
+ on_changed => sub {
$CFG->{stat_fontsize} = $_[1];
&set_stats_window_fontsize;
}
@@ -290,7 +292,7 @@
$table->add (1, $row++, new CFClient::UI::Slider
range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1],
tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.",
- connect_changed => sub {
+ on_changed => sub {
$CFG->{gauge_fontsize} = $_[1];
&set_gauge_window_fontsize;
}
@@ -298,9 +300,9 @@
$table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size");
$table->add (1, $row++, new CFClient::UI::Slider
- range => [$CFG->{gauge_size}, 0.2, 0.8],
- tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.",
- connect_changed => sub {
+ range => [$CFG->{gauge_size}, 0.2, 0.8],
+ tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.",
+ on_changed => sub {
$CFG->{gauge_size} = $_[1];
$GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size});
}
@@ -309,7 +311,7 @@
$table->add (1, $row++, new CFClient::UI::Button
expand => 1, align => 0, text => "Apply",
tooltip => "Apply the video settings",
- connect_activate => sub {
+ on_activate => sub {
video_shutdown ();
video_init ();
}
@@ -319,12 +321,12 @@
$table->add (1, $row++, new CFClient::UI::CheckBox
state => $CFG->{audio_enable},
tooltip => "Master Audio Enable. If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.",
- connect_changed => sub {
+ on_changed => sub {
$CFG->{audio_enable} = $_[1];
}
);
# $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume");
-# $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub {
+# $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub {
# $CFG->{effects_volume} = $_[1];
# });
$table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music");
@@ -332,14 +334,14 @@
$hbox->add (new CFClient::UI::CheckBox
expand => 1, state => $CFG->{bgm_enable},
tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
- connect_changed => sub {
+ on_changed => sub {
$CFG->{bgm_enable} = $_[1];
}
);
$hbox->add (new CFClient::UI::Slider
expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
tooltip => "The volume of the background music. Changes are instant.",
- connect_changed => sub {
+ on_changed => sub {
$CFG->{bgm_volume} = $_[1];
CFClient::MixMusic::volume $_[1] * 128;
}
@@ -348,7 +350,7 @@
$table->add (1, $row++, new CFClient::UI::Button
expand => 1, align => 0, text => "Apply",
tooltip => "Apply the audio settings",
- connect_activate => sub {
+ on_activate => sub {
audio_shutdown ();
audio_init ();
}
@@ -360,7 +362,7 @@
tooltip => "This is the command that will be used if you write a line in the message window entry or press \" in the map window. "
. "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
. "But you could also set it to tell playername to only chat with that user.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{say_command} = $value;
}
@@ -385,9 +387,10 @@
my $gh = int $HEIGHT * $CFG->{gauge_size};
my $win = new CFClient::UI::Frame (
- req_y => -1,
- user_w => $WIDTH,
- user_h => $gh,
+ req_x => 0,
+ req_y => -1,
+ def_w => $WIDTH,
+ def_h => $gh,
);
$win->add (my $hbox = new CFClient::UI::HBox
@@ -434,7 +437,11 @@
}
sub make_stats_window {
- my $tgw = new CFClient::UI::FancyFrame title => "Stats", name => "stats_window";
+ my $tgw = new CFClient::UI::FancyFrame
+ req_y => $HEIGHT * (2/8),
+ req_x => -1,
+ title => "Stats",
+ name => "stats_window";
$tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox);
$vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1,
@@ -691,7 +698,7 @@
$y++;
$table->add (0, $y, new CFClient::UI::VBox children => [
- (new CFClient::UI::Button text => "Use", connect_activate => sub {
+ (new CFClient::UI::Button text => "Use", on_activate => sub {
$HOST->set_text ($CFG->{host} = $host);
}),
(new CFClient::UI::Empty expand => 1),
@@ -707,10 +714,17 @@
sub server_setup {
my $dialog = new CFClient::UI::FancyFrame
- name => "server_setup",
- title => "Server Setup",
- child => (my $vbox = new CFClient::UI::VBox);
-
+ x => $WIDTH * (1/3),
+ y => $HEIGHT * (1/8),
+ name => "server_setup",
+ title => "Server Setup",
+ child => (my $vbox = new CFClient::UI::VBox),
+ on_visibility_change => sub {
+ my ($self, $visible) = @_;
+ $self->center if $visible;
+ },
+ ;
+
$vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
$table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port");
@@ -722,7 +736,7 @@
expand => 1,
text => $CFG->{host},
tooltip => "The hostname or ip address of the Crossfire(+) server to connect to",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{host} = $value;
}
@@ -735,7 +749,7 @@
text => "Server List",
other => $METASERVER,
tooltip => "Show a list of available crossfire servers",
- connect_open => sub {
+ on_open => sub {
update_metaserver $HOST;
}
);
@@ -745,7 +759,7 @@
$table->add (1, 4, new CFClient::UI::Entry
text => $CFG->{user},
tooltip => "The name of your character on the server",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{user} = $value;
}
@@ -756,7 +770,7 @@
text => $CFG->{password},
hidden => 1,
tooltip => "The password for your character",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{password} = $value;
}
@@ -770,7 +784,7 @@
. "If you set this to a high value you will be able to see further, "
. "but you also increase bandwidth requirements and latency. "
. "This option is only used once at log-in.",
- connect_changed => sub {
+ on_changed => sub {
my ($self, $value) = @_;
$CFG->{mapsize} = $self->{range}[0] = $value = int $value;
@@ -787,28 +801,28 @@
. "It also uses up server bandwidth on every connect, "
. "so only set it if you really need to prefetch images. "
. "This option can be set and unset any time.",
- connect_changed => sub { $CFG->{face_prefetch} = $_[1] },
+ on_changed => sub { $CFG->{face_prefetch} = $_[1] },
);
$table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count");
$table->add (1, 9, new CFClient::UI::Entry
text => $CFG->{output_count},
tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
- connect_changed => sub { $CFG->{output_count} = $_[1] },
+ on_changed => sub { $CFG->{output_count} = $_[1] },
);
$table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync");
$table->add (1, 10, new CFClient::UI::Entry
text => $CFG->{output_sync},
tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
- connect_changed => sub { $CFG->{output_sync} = $_[1] },
+ on_changed => sub { $CFG->{output_sync} = $_[1] },
);
$table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button
expand => 1,
align => 0,
text => "Login",
- connect_activate => sub {
+ on_activate => sub {
$CONN ? stop_game
: start_game;
},
@@ -823,8 +837,10 @@
title => "Messages",
border_bg => [1, 1, 1, 1],
bg => [0, 0, 0, 0.75],
- user_w => int $::WIDTH / 3,
- user_h => int $::HEIGHT / 5,
+ req_x => -1,
+ req_y => 0,
+ def_w => int $::WIDTH / 3,
+ def_h => int $::HEIGHT / 5,
child => (my $vbox = new CFClient::UI::VBox);
$vbox->add ($LOGVIEW);
@@ -834,7 +850,7 @@
. "from the client setup will be prepended (e.g. shout, chat...). "
. "If you prepend a slash (/), you will submit a command instead (similar to IRC). "
. "A better way to submit commands (and the occasional chat command) is often the map command completer.",
- connect_focus_in => sub {
+ on_focus_in => sub {
my ($input, $prev_focus) = @_;
delete $input->{refocus_map};
@@ -844,7 +860,7 @@
}
delete $input->{auto_activated};
},
- connect_activate => sub {
+ on_activate => sub {
my ($input, $text) = @_;
$input->set_text ('');
@@ -859,7 +875,7 @@
$MAPWIDGET->focus_in
}
},
- connect_escape => sub {
+ on_escape => sub {
$MAPWIDGET->focus_in
},
);
@@ -874,7 +890,6 @@
sub open_quit_dialog {
unless ($QUIT_DIALOG) {
-
$QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?";
$QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1);
@@ -888,45 +903,50 @@
$hb->add (new CFClient::UI::Button
text => "Ok",
expand => 1,
- connect_activate => sub { $QUIT_DIALOG->hide },
+ on_activate => sub { $QUIT_DIALOG->hide },
);
$hb->add (new CFClient::UI::Button
text => "Quit anyway",
expand => 1,
- connect_activate => sub { exit },
+ on_activate => sub { exit },
);
-
- $QUIT_DIALOG->show_centered;
- } else {
- $QUIT_DIALOG->show_centered;
}
+
+ $QUIT_DIALOG->show;
+ $QUIT_DIALOG->center;
}
sub make_inventory_window {
my $invwin = new CFClient::UI::FancyFrame
- user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Inventory", name => "inventory_window";
+ def_w => $WIDTH * 7/8,
+ def_h => $HEIGHT * 7/8,
+ title => "Inventory",
+ name => "inventory_window",
+ on_visibility_change => sub {
+ my ($self, $visible) = @_;
+ $self->center if $visible;
+ },
+ ;
- $invwin->add (my $hb = new CFClient::UI::HBox expand => 1);
+ $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1);
- $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1);
- $vb1->add (my $lbl = new CFClient::UI::Label align => 0);
- $lbl->set_text ("Player");
- $vb1->add ($INV = new CFClient::UI::Inventory expand => 1);
+ $hb->add (my $vb1 = new CFClient::UI::VBox);
+ $vb1->add (new CFClient::UI::Label align => 0, text => "Player");
+ $vb1->add ($INV = new CFClient::UI::Inventory expand => 1);
- $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1);
+ $hb->add (my $vb2 = new CFClient::UI::VBox);
$vb2->add (my $hb2 = new CFClient::UI::HBox);
- $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1);
+ $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1, text => "Floor");
$hb2->add (new CFClient::UI::Button
text => "Close",
tooltip => "Close the currently open container (if one is open)",
- connect_activate => sub {
+ on_activate => sub {
$CONN->send ("apply $CONN->{open_container}")
if $CONN->{open_container} != 0;
},
);
- $INVR_LBL->set_text ("Floor");
$vb2->add ($INVR = new CFClient::UI::Inventory expand => 1);
$invwin
@@ -934,7 +954,9 @@
sub make_help_window {
my $win = new CFClient::UI::FancyFrame
- user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Documentation";
+ def_w => int $WIDTH * 7/8,
+ def_h => int $HEIGHT * 7/8,
+ title => "Documentation";
$win->add (my $vbox = new CFClient::UI::VBox);
@@ -951,7 +973,7 @@
$buttons->add (new CFClient::UI::Button
text => $label,
- connect_activate => sub {
+ on_activate => sub {
my $parser = new Pod::POM;
my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod");
@@ -1069,7 +1091,7 @@
$BUTTONBAR->add (new CFClient::UI::Button
text => "Save Config",
tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.",
- connect_activate => sub {
+ on_activate => sub {
$::CFG->{layout} = CFClient::UI::get_layout;
CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
status "Configuration Saved";
@@ -1080,9 +1102,9 @@
tooltip => "View Documentation");
$BUTTONBAR->add (new CFClient::UI::Button
- text => "Quit",
- tooltip => "Terminates the program",
- connect_activate => sub {
+ text => "Quit",
+ tooltip => "Terminates the program",
+ on_activate => sub {
if ($CONN) {
open_quit_dialog;
} else {
@@ -1095,13 +1117,7 @@
$STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]);
- # delay till geometry is constant
- $CFClient::UI::ROOT->on_post_alloc (startup => sub {
- $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
- my $widget = $GAUGES->{win};
- $widget->move (0, $HEIGHT - $widget->{h});#d# to in toplevel
- });
- force_refresh ();
+ $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
}
}