--- deliantra/Deliantra-Client/bin/deliantra 2007/12/28 17:28:01 1.21 +++ deliantra/Deliantra-Client/bin/deliantra 2008/03/25 19:28:56 1.32 @@ -80,7 +80,7 @@ # prepend private library directory BEGIN { for (grep !ref, @INC) { - my $path = "$_/Deliantra/Client/private/dc"; + my $path = "$_/Deliantra/Client/private"; if (-d $path) { unshift @INC, $path; last; @@ -110,8 +110,10 @@ use DC::UI::Inventory; use DC::UI::SpellList; use DC::UI::Dockable; +use DC::UI::Dockbar; use DC::UI::MessageWindow; use DC::UI::ChatView; +use DC::MessageDistributor; use DC::Pod; use DC::MapWidget; use DC::Macro; @@ -180,6 +182,7 @@ our $HELP_WINDOW; our $MESSAGE_WINDOW; +our $MESSAGE_DIST; our $FLOORBOX; our $GAUGES; our $STATWIDS; @@ -189,6 +192,7 @@ our $ALT_ENTER_MESSAGE; our $STATUSBOX; +our $MODBOX; our $DEBUG_STATUS; our $INV; @@ -206,7 +210,33 @@ } sub message { - $MESSAGE_WINDOW->message (@_); + $MESSAGE_DIST->message (@_); +} + +sub update_modbox { + my $mod = DC::SDL_GetModState; + + my $markup; + + $markup .= $mod & DC::KMOD_CTRL + ? ($MAPWIDGET->{ctrl} ? "[REPEAT]" : "[REPEAT]") + : "[ once ]"; + + $markup .= $mod & DC::KMOD_SHIFT + ? ($MAPWIDGET->{shft} ? "[FIRE]" : "[FIRE]") + : "[move]"; + + $markup .= $mod & (DC::KMOD_ALT | DC::KMOD_META) + ? "[ALT]" + : "[alt]"; + + $markup .= $mod & DC::KMOD_NUM + ? "[NUM]" + : "[num]"; + + # around next statement works around some bug that keeps the + # "font =>" from being used on windows + $MODBOX->set_markup ("$markup"); } ############################################################################# @@ -655,7 +685,6 @@ my ($name, $id) = @$_; $hbox->add (new DC::UI::Label markup => "$conn->{stat}{$id} $name", - align => 0, expand => 1, can_events => 1, can_hover => 1, @@ -720,7 +749,7 @@ mapw => $mapsize, maph => $mapsize, - client => "cfplus $DC::VERSION $] $^O", + client => "$DC::VERSION $] $^O", map_widget => $MAPWIDGET, statusbox => $STATUSBOX, @@ -738,6 +767,7 @@ status "login successful"; } else { + warn $@; status "unable to connect"; stop_game(); } @@ -771,8 +801,8 @@ my $row = 0; - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "OpenGL Info"); - $table->add_at (1, $row++, new DC::UI::Label valign => 0, fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version, + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "OpenGL Info"); + $table->add_at (1, $row++, new DC::UI::Label fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version, can_events => 1, tooltip => "" . (DC::OpenGL::gl_extensions) . ""); @@ -780,14 +810,14 @@ "Video Mode. The video mode to use for fullscreen (and the window size for windowed operation). " . "The format is width x height \@ depth-per-channel + alpha-channel."; - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Video Mode"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Video Mode"); $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); $hbox->add (my $mode_slider = new DC::UI::Slider force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1], tooltip => $vidmode_tooltip); $hbox->add (my $mode_label = new DC::UI::Label - align => 0, valign => 0, height => 0.8, template => "9999x9999@9+9", + height => 0.8, template => "9999x9999@9+9", can_events => 1, tooltip => $vidmode_tooltip); $mode_slider->connect (changed => sub { @@ -798,17 +828,17 @@ }); $mode_slider->emit (changed => $mode_slider->{range}[0]); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fullscreen"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fullscreen"); $table->add_at (1, $row++, $FULLSCREEN_ENABLE = new DC::UI::CheckBox state => $CFG->{fullscreen}, tooltip => "Bring the client into fullscreen mode.", on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Force OpenGL 1.1"); $table->add_at (1, $row++, new DC::UI::CheckBox state => $CFG->{force_opengl11}, - tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " + tooltip => "Limit Deliantra to use OpenGL 1.1 features only. This will normally result in " . "higher memory usage and slower performance. It will, however, help tremendously on " . "cards that claim to support a feature but fall back to software rendering. " . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " @@ -817,7 +847,7 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Compress Textures"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures"); $table->add_at (1, $row++, new DC::UI::CheckBox state => $CFG->{texture_compression}, tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " @@ -827,14 +857,14 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly"); $table->add_at (1, $row++, new DC::UI::CheckBox state => $CFG->{fast}, tooltip => "Lower the visual quality considerably to speed up rendering.", on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "GUI Fontsize"); $table->add_at (1, $row++, new DC::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.", @@ -842,7 +872,7 @@ ); $table->add_at (1, $row++, new DC::UI::Button - expand => 1, align => 0, text => "Apply", + expand => 1, text => "Apply", tooltip => "Apply the video settings above.", on_activate => sub { video_shutdown (); @@ -851,14 +881,14 @@ } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Scale"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); $table->add_at (1, $row++, new DC::UI::Slider range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], tooltip => "Enlarge or shrink the displayed map. Changes are instant.", on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Smoothing"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Smoothing"); $table->add_at (1, $row++, new DC::UI::CheckBox state => $CFG->{map_smoothing}, tooltip => "Map Smoothing tries to make tile borders less square. " @@ -867,29 +897,29 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fog of War"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fog of War"); $table->add_at (1, $row++, new DC::UI::CheckBox state => $CFG->{fow_enable}, tooltip => "Fog-of-War marks areas that cannot be seen by the player. Changes are instant.", on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "FoW Intensity"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); $table->add_at (1, $row++, new DC::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.", on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Message Fontsize"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Fontsize"); $table->add_at (1, $row++, new DC::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, " . "but you still need to press apply to correctly re-layout the widget.", - on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, + on_changed => sub { $MESSAGE_DIST->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge fontsize"); $table->add_at (1, $row++, new DC::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.", @@ -900,7 +930,7 @@ } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge size"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge size"); $table->add_at (1, $row++, new DC::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.", @@ -944,14 +974,14 @@ my $row = 0; - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Audio Enable"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); $table->add_at (1, $row++, new DC::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.", on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Sound Effects"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); $table->add_at (1, $row, new DC::UI::CheckBox expand => 1, state => $CFG->{effects_enable}, tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", @@ -968,7 +998,7 @@ on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Background Music"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); $table->add_at (1, $row, new DC::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.", @@ -985,7 +1015,7 @@ on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Frequency"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Frequency"); $table->add_at (1, $row++, new DC::UI::Selector c_colspan => 2, expand => 1, value => $CFG->{audio_hw_frequency}, @@ -1004,7 +1034,7 @@ } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Channels"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Channels"); $table->add_at (1, $row++, new DC::UI::Selector c_colspan => 2, expand => 1, value => $CFG->{audio_hw_channels}, @@ -1023,7 +1053,7 @@ } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Latency"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency"); $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector c_colspan => 2, expand => 1, value => $CFG->{audio_hw_chunksize}, @@ -1037,7 +1067,7 @@ ); # should really be a slider - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Mixer Voices"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Mixer Voices"); $table->add_at (1, $row++, new DC::UI::ValSlider c_colspan => 2, expand => 1, tooltip => "The number of simultaneous sound effects possible. Higher is better, but also more cpu-intensive and might cause stuttering.", @@ -1053,7 +1083,7 @@ ); $table->add_at (1, $row++, new DC::UI::Button - c_colspan => 2, expand => 1, align => 0, text => "Apply", + c_colspan => 2, expand => 1, text => "Apply", tooltip => "Apply the audio settings", on_activate => sub { audio_shutdown (); @@ -1113,10 +1143,10 @@ $hb->add (my $gg = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace"); $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); - $vbox->add (my $exp = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); + $vbox->add (my $exp = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); $vbox->add (my $prg = new DC::UI::ExperienceProgress); $vbox->add (my $sklprg = new DC::UI::ExperienceProgress); - $vbox->add (my $rng = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); + $vbox->add (my $rng = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); $GAUGES = { exp => $exp, prg => $prg, sklprg => $sklprg, @@ -1192,18 +1222,18 @@ child => (my $pi = new DC::UI::VBox), ); - $pi->add ($STATWIDS->{title} = new DC::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, + $pi->add ($STATWIDS->{title} = new DC::UI::Label text => "Title:", expand => 1, align => 0, can_hover => 1, can_events => 1, tooltip => "Your name and title. You can change your title by using the title command, if supported by the server."); - $pi->add ($STATWIDS->{map} = new DC::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, + $pi->add ($STATWIDS->{map} = new DC::UI::Label align => 0, text => "Map:", expand => 1, can_hover => 1, can_events => 1, tooltip => "The map you are currently on (if supported by the server)."); $pi->add (my $hb0 = new DC::UI::HBox); - $hb0->add ($STATWIDS->{weight} = new DC::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1, + $hb0->add ($STATWIDS->{weight} = new DC::UI::Label text => "Weight:", expand => 1, align => 0, can_hover => 1, can_events => 1, tooltip => "The weight of the player including all inventory items."); - $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, + $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label align => 0, text => "Max weight:", expand => 1, can_hover => 1, can_events => 1, tooltip => "The weight limit: you cannot carry more than this."); @@ -1234,16 +1264,16 @@ my ($col, $row, $id, $label, $template) = @$_; $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label - font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, - align => +1, template => $template, tooltip => "#stat_$label"); + font => $FONT_FIXED, can_hover => 1, can_events => 1, + align => 1, template => $template, tooltip => "#stat_$label"); $tbl->add_at ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new DC::UI::Label - font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, - align => -1, text => $label, tooltip => "#stat_$label"); + font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, + align => 0, text => $label, tooltip => "#stat_$label"); } $vb->add (new DC::UI::FancyFrame label => "Resistancies", - child => (my $tbl2 = new DC::UI::Table expand => 1), + child => (my $tbl2 = new DC::UI::Table expand => 1, col_expand => [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0]), ); my $row = 0; @@ -1292,13 +1322,12 @@ drain acid pois para deat phys blind fear tund elec cold ghit/) { - $tbl2->add_at ($col, $row, + $tbl2->add_at ($col + 2, $row, $STATWIDS->{"res_$_"} = new DC::UI::Label font => $FONT_FIXED, template => "-100%", - align => +1, - valign => 0, + align => 1, can_events => 1, can_hover => 1, tooltip => $resist_names{$_}->[1], @@ -1310,9 +1339,10 @@ path => "ui/resist/resist_$_.png", tooltip => $resist_names{$_}->[1], ); - $tbl2->add_at ($col + 2, $row, new DC::UI::Label + $tbl2->add_at ($col + 0, $row, new DC::UI::Label text => $resist_names{$_}->[0], font => $FONT_FIXED, + align => 1, can_hover => 1, can_events => 1, tooltip => $resist_names{$_}->[1], @@ -1320,7 +1350,7 @@ $row++; if ($row % 6 == 0) { - $col += 3; + $col += 4; $row = 0; } } @@ -1376,12 +1406,11 @@ ); my @col = qw(#Users Host Uptime Version Description); $table->add_at ($_, 0, new DC::UI::Label - can_hover => 1, can_events => 1, - align => 0, fg => [1, 1, 0], + can_hover => 1, can_events => 1, fg => [1, 1, 0], text => $col[$_], tooltip => $tip[$_]) for 0 .. $#col; - my @align = qw(1 0 1 1 -1); + my @align = qw(1 0.5 1 1 0); my $y = 0; for my $m (@{ $msg->{servers} }) { @@ -1472,14 +1501,14 @@ child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), ); - $table->add_at (0, 4, new DC::UI::Label valign => 0, align => 1, text => "Username"); + $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); $table->add_at (1, 4, new DC::UI::Entry text => $CFG->{profile}{default}{user}, tooltip => "The name of your character on the server.", on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } ); - $table->add_at (0, 5, new DC::UI::Label valign => 0, align => 1, text => "Password"); + $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); $table->add_at (1, 5, new DC::UI::Entry text => $CFG->{profile}{default}{password}, hidden => 1, @@ -1489,7 +1518,6 @@ $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button expand => 1, - align => 0, text => "Login / Register", tooltip => "This button will either login to the account configured above or register a new account.", on_activate => sub { @@ -1502,7 +1530,7 @@ $vbox->add (new DC::UI::FancyFrame label => "Registering", min_h => 200, - child => (new DC::UI::Label valign => -1, ellipsise => 0, + child => (new DC::UI::Label valign => 0, ellipsise => 0, markup => "To register a new account, choose a username that hasn't been taken yet and " . "try to log-in. Follow the instructions in the Log tab in the message window.", @@ -1522,7 +1550,7 @@ my $row = 0; - $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Host:Port"); + $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Host:Port"); { $table->add_at (1, $row, my $vbox = new DC::UI::VBox); @@ -1530,7 +1558,7 @@ $HOST_ENTRY = new DC::UI::Entry expand => 1, text => $CFG->{profile}{default}{host}, - tooltip => "The hostname or ip address of the Deliantra server to connect to", + tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. gameserver.deliantra.net)", on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{host} = $value; @@ -1543,14 +1571,14 @@ expand => 1, text => "Server List", other => $METASERVER, - tooltip => "Show a list of available crossfire servers", + tooltip => "Show a list of available Deliantra servers", on_activate => sub { $METASERVER->toggle_visibility; 0 }, on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, ); }#d# } - $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Map Size"); + $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Map Size"); $table->add_at (1, $row, new DC::UI::Slider force_w => 100, range => [$CFG->{mapsize}, 10, 100, 0, 1], @@ -1561,7 +1589,7 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, ); - $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Output-Rate"); + $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate"); $table->add_at (1, $row, new DC::UI::Entry text => $CFG->{output_rate}, tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " @@ -1584,7 +1612,7 @@ my $row = 0; - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Tip of the day"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); $table->add_at (1, $row++, new DC::UI::CheckBox state => $CFG->{show_tips}, tooltip => "Show the Tip of the day window at startup?", @@ -1595,7 +1623,7 @@ } ); - $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Messages Window Size"); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Messages Window Size"); $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry text => $CFG->{logview_max_par}, tooltip => "This is maximum number of messages remembered in the Messages window. If the server " @@ -1603,7 +1631,7 @@ . "computing time. A value of 0 disables this feature, but that is not recommended.", on_changed => sub { my ($self, $value) = @_; - $MESSAGE_WINDOW->set_max_para ($CFG->{logview_max_par} = $value*1); + $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); 0 }, ); @@ -1739,7 +1767,7 @@ my $hb = new DC::UI::HBox homogeneous => 1; $hb->add (my $vb1 = new DC::UI::VBox); - $vb1->add (new DC::UI::Label align => 0, text => "Player"); + $vb1->add (new DC::UI::Label text => "Player"); $vb1->add (my $hb1 = new DC::UI::HBox); @@ -1759,7 +1787,7 @@ ); $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1); #TODO# update to weigh/maxweight - $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => -1); + $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => 0); $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); $sw1->add ($INV = new DC::UI::Inventory); @@ -1949,7 +1977,7 @@ for my $node (@path) { $buttons->add (new DC::UI::Button - text => $node->{kw}[0], + text => $node->[DC::Pod::N_KW][0], tooltip => "go to " . (DC::asxml DC::Pod::full_path $node) . "", on_activate => sub { push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = (); @@ -1959,7 +1987,7 @@ $buttons->add (new DC::UI::Label text => "/"); } - $buttons->add (new DC::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4); + $buttons->add (new DC::UI::Label text => $node->[DC::Pod::N_KW][0], padding_x => 4, padding_y => 4); $curnode = $node; @@ -2148,15 +2176,35 @@ $DEBUG_STATUS->show; $STATUSBOX = new DC::UI::Statusbox; - $STATUSBOX->add ("Use Alt-Enter to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); + + $MODBOX = new DC::UI::Label + can_events => 1, + can_hover => 1, + markup => "", + align => 0, + font => $FONT_FIXED, + tooltip => "#modifier_box", + tooltip_width => 0.67, + ; + + update_modbox; (new DC::UI::Frame bg => [0, 0, 0, 0.4], force_x => 0, force_y => "max", - child => $STATUSBOX, + child => (my $LR = new DC::UI::VBox), )->show; + $LR->add ($STATUSBOX); + $LR->add ($MODBOX); + $LR->add (new DC::UI::Label + align => 0, + markup => "Use Alt-Enter to toggle fullscreen mode", + fontsize => 0.5, + fg => [1, 1, 0, 0.7], + ); + DC::UI::Toplevel->new ( title => "Minimap", name => "mapmap", @@ -2173,8 +2221,8 @@ $MAPWIDGET->connect (activate_console => sub { my ($mapwidget, $preset) = @_; - $MESSAGE_WINDOW->activate_console ($preset) - if $MESSAGE_WINDOW; + $MESSAGE_DIST->activate_console ($preset) + if $MESSAGE_DIST; }); $MAPWIDGET->show; $MAPWIDGET->grab_focus; @@ -2196,7 +2244,8 @@ ; $METASERVER = metaserver_dialog; - $MESSAGE_WINDOW = new DC::UI::MessageWindow; + $MESSAGE_WINDOW = new DC::UI::Dockbar (name => 'message_window', title => 'Messages'); + $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); @@ -2346,10 +2395,14 @@ video_shutdown; video_init; } else { - DC::UI::feed_sdl_key_down_event ($_[0]); + &DC::UI::feed_sdl_key_down_event; } + update_modbox; + }, + DC::SDL_KEYUP => sub { + &DC::UI::feed_sdl_key_up_event; + update_modbox; }, - DC::SDL_KEYUP => \&DC::UI::feed_sdl_key_up_event, DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, @@ -2375,7 +2428,7 @@ } else { #TODO: compatibility cruft DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; - print STDERR "INFO: used old configuratrion file\n"; + print STDERR "INFO: used old configuration file\n"; } DC::DB::Server::run; @@ -2458,12 +2511,12 @@ DC::add_font $_ for @fonts; - DC::pango_init; - $FONT_PROP = new_from_file DC::Font $fonts[0]; $FONT_FIXED = new_from_file DC::Font $fonts[1]; $FONT_PROP->make_default; + + DC::pango_init; } # compare mono (ft) vs. rgba (cairo)