From 27bddb53f8365766b903b52711de34b52b950c01 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Sun, 10 Mar 2024 20:57:39 +0100 Subject: [PATCH] Improving style pokemon edition. --- lib/GEmeTool/View/PokemonEditorWindow.pm | 30 +++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/GEmeTool/View/PokemonEditorWindow.pm b/lib/GEmeTool/View/PokemonEditorWindow.pm index fac6732..7c9390f 100644 --- a/lib/GEmeTool/View/PokemonEditorWindow.pm +++ b/lib/GEmeTool/View/PokemonEditorWindow.pm @@ -89,12 +89,17 @@ sub draw { $cairo->paint; } ); - $grid->attach( $canvas, 0, 0, 2, 4 ); + $grid->attach( $canvas, 0, 0, 2, 2 ); my @species = (@Rsaves::Constants::Emerald::Species::SPECIES); my $string_list = Gtk4::StringList->new( [@species] ); my $save_button = Gtk4::Button->new_with_label('Save changes'); $self->_selected_species( $pokemon->species ); - $self->create_change_nickname_entry($grid); + my $box_right_image = Gtk4::Box->new('vertical', 1); + $box_right_image->set_margin_top(30); + $box_right_image->set_valign('start'); + $box_right_image->set_halign('start'); + $grid->attach($box_right_image, 2, 0, 4, 2); + $self->create_change_nickname_entry($box_right_image); $save_button->signal_connect( clicked => sub { $pokemon->species( $self->_selected_species ); @@ -105,9 +110,9 @@ sub draw { $self->draw; } ); - $self->draw_dropdown_pokemon_list($grid); + $self->draw_dropdown_pokemon_list($box_right_image); $self->create_modify_personality($grid); - $grid->attach( $save_button, 12, 7, 1, 1 ); + $grid->attach( $save_button, 4, 7, 1, 1 ); $window->set_child($grid); } @@ -221,18 +226,20 @@ sub open_window_personality { sub create_change_nickname_entry { my $self = shift; - my $grid = shift; + my $box = shift; my $pokemon = $self->pokemon; my $label = Gtk4::Label->new('Change the nickname:'); my $entry = Gtk4::Entry->new; my $nickname = Rsaves::translate_3rd_encoding( $pokemon->nickname ); + my $box_nickname = Gtk4::Box->new('horizontal', 10); $entry->get_buffer->set_text( $nickname, length $nickname ); $entry->set_halign('start'); $entry->set_valign('start'); $label->set_halign('start'); $label->set_valign('start'); - $grid->attach( $label, 4, 1, 1, 1 ); - $grid->attach( $entry, 5, 1, 1, 1 ); + $box_nickname->append( $label); + $box_nickname->append( $entry); + $box->append($box_nickname); $self->onSave( sub { my $translated_nickname = Rsaves::to_3rd_encoding($entry->get_buffer->get_text); @@ -252,7 +259,7 @@ sub create_change_nickname_entry { sub draw_dropdown_pokemon_list { my $self = shift; - my $grid = shift; + my $box = shift; my $pokemon = $self->pokemon; my $button_box = Gtk4::Box->new( 'horizontal', 1 ); my $box_popover = Gtk4::Box->new( 'vertical', 1 ); @@ -302,13 +309,14 @@ sub draw_dropdown_pokemon_list { $popover_dropdown->set_size_request( 100, 400 ); $button_box->append($popover_dropdown); my $label_button = Gtk4::Label->new('Change species:'); - $grid->attach( $label_button, 2, 1, 1, 1 ); - $grid->attach( $button, 3, 1, 1, 1 ); + my $box_dropdown = Gtk4::Box->new('horizontal', 10); + $box_dropdown->append( $label_button); + $box_dropdown->append( $button); + $box->append($box_dropdown); $label_button->set_valign('start'); $label_button->set_halign('start'); $button->set_valign('start'); $button->set_halign('start'); - $grid->set_vexpand(1); } sub fill_dropdown {