… | |
… | |
664 | # right: accept |
664 | # right: accept |
665 | $table->add_at (4, 0, new DC::UI::Button |
665 | $table->add_at (4, 0, new DC::UI::Button |
666 | text => "Accept", |
666 | text => "Accept", |
667 | on_activate => sub { |
667 | on_activate => sub { |
668 | $conn->send ("reply n"); |
668 | $conn->send ("reply n"); |
669 | $STATS_PAGE->hide; |
|
|
670 | destroy_query_dialog $conn; |
669 | destroy_query_dialog $conn; |
671 | 0 |
670 | 0 |
672 | }, |
671 | }, |
673 | ); |
672 | ); |
674 | |
673 | |
… | |
… | |
739 | my ($host, $port) = split /:/, $PROFILE->{host}; |
738 | my ($host, $port) = split /:/, $PROFILE->{host}; |
740 | |
739 | |
741 | $MAP = new DC::Map; |
740 | $MAP = new DC::Map; |
742 | |
741 | |
743 | $CONN = eval { |
742 | $CONN = eval { |
|
|
743 | local $SIG{__DIE__}; |
|
|
744 | |
744 | new DC::Protocol |
745 | new DC::Protocol |
745 | host => $host, |
746 | host => $host, |
746 | port => $port || 13327, |
747 | port => $port || 13327, |
747 | user => $PROFILE->{user}, |
748 | user => $PROFILE->{user}, |
748 | pass => $PROFILE->{password}, |
749 | pass => $PROFILE->{password}, |
… | |
… | |
1621 | $CFG->{show_tips} = $value; |
1622 | $CFG->{show_tips} = $value; |
1622 | 0 |
1623 | 0 |
1623 | } |
1624 | } |
1624 | ); |
1625 | ); |
1625 | |
1626 | |
1626 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Messages Window Size"); |
1627 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); |
1627 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1628 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1628 | text => $CFG->{logview_max_par}, |
1629 | text => $CFG->{logview_max_par}, |
1629 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1630 | tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server " |
1630 | . "sends more messages than this number, older messages get removed to save memory and " |
1631 | . "sends more messages than this number, older messages get removed to save memory and " |
1631 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1632 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1632 | on_changed => sub { |
1633 | on_changed => sub { |
1633 | my ($self, $value) = @_; |
1634 | my ($self, $value) = @_; |
1634 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
1635 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
… | |
… | |
1743 | |
1744 | |
1744 | $r |
1745 | $r |
1745 | } |
1746 | } |
1746 | |
1747 | |
1747 | my %SORT_ORDER = ( |
1748 | my %SORT_ORDER = ( |
1748 | type => undef, |
1749 | type => sub { |
|
|
1750 | sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_ |
|
|
1751 | }, |
1749 | mtime => sub { |
1752 | mtime => sub { |
1750 | my $NOW = time; |
1753 | my $NOW = time; |
1751 | sort { |
1754 | sort { |
1752 | my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; |
1755 | my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; |
1753 | my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; |
1756 | my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; |
… | |
… | |
2242 | force_h => $::HEIGHT * 0.6, |
2245 | force_h => $::HEIGHT * 0.6, |
2243 | has_close_button => 1, |
2246 | has_close_button => 1, |
2244 | ; |
2247 | ; |
2245 | |
2248 | |
2246 | $METASERVER = metaserver_dialog; |
2249 | $METASERVER = metaserver_dialog; |
2247 | $MESSAGE_WINDOW = new DC::UI::Dockbar (name => 'message_window', title => 'Messages'); |
2250 | # the name is changed to not conflict with the older name as users could have hidden it |
|
|
2251 | $MESSAGE_WINDOW = new DC::UI::Dockbar |
|
|
2252 | name => "message_window2", |
|
|
2253 | title => 'Messages', |
|
|
2254 | force_w => $::WIDTH * 0.6, |
|
|
2255 | force_h => $::HEIGHT * 0.25, |
|
|
2256 | ; |
|
|
2257 | |
2248 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2258 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2249 | |
2259 | |
2250 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, |
2260 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, |
2251 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2261 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2252 | |
2262 | |
2253 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
2263 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
2254 | "Configure the server to play on, your username and password."); |
2264 | "Configure the server to play on, your username and password."); |
2255 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2265 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
… | |
… | |
2273 | $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
2283 | $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
2274 | |
2284 | |
2275 | $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
2285 | $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
2276 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
2286 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
2277 | |
2287 | |
2278 | $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW, |
2288 | # $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW, |
2279 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
2289 | # tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
2280 | |
2290 | |
2281 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
2291 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
2282 | |
2292 | |
2283 | $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window, |
2293 | $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window, |
2284 | tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); |
2294 | tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); |
… | |
… | |
2294 | }, |
2304 | }, |
2295 | ); |
2305 | ); |
2296 | |
2306 | |
2297 | $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, |
2307 | $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, |
2298 | tooltip => "View Documentation"); |
2308 | tooltip => "View Documentation"); |
2299 | |
|
|
2300 | |
2309 | |
2301 | $BUTTONBAR->add (new DC::UI::Button |
2310 | $BUTTONBAR->add (new DC::UI::Button |
2302 | text => "Quit", |
2311 | text => "Quit", |
2303 | tooltip => "Terminates the program", |
2312 | tooltip => "Terminates the program", |
2304 | on_activate => sub { |
2313 | on_activate => sub { |
… | |
… | |
2475 | pickup => 0, |
2484 | pickup => 0, |
2476 | inv_sort => "mtime", |
2485 | inv_sort => "mtime", |
2477 | default => "profile", # default profile |
2486 | default => "profile", # default profile |
2478 | show_tips => 1, |
2487 | show_tips => 1, |
2479 | logview_max_par => 1000, |
2488 | logview_max_par => 1000, |
|
|
2489 | shift_fire_stop => 0, |
2480 | ); |
2490 | ); |
2481 | |
2491 | |
2482 | while (my ($k, $v) = each %DEF_CFG) { |
2492 | while (my ($k, $v) = each %DEF_CFG) { |
2483 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2493 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2484 | } |
2494 | } |