diff --git a/lib/Exd/Gui.pm b/lib/Exd/Gui.pm index 20367f6..8169a74 100644 --- a/lib/Exd/Gui.pm +++ b/lib/Exd/Gui.pm @@ -23,6 +23,7 @@ use Exd::DeviceToBluetooth; use Exd::DeviceToImage; use Exd::FileFormat; use Exd::Gui::PrinterConfigure; +use Exd::Gui::FontGallery; use JSON; @@ -748,6 +749,11 @@ sub _create_gallery_image( $self, $hash ) { return $picture; } +sub _open_fonts_gallery($self) { + my $font_gallery = Exd::Gui::FontGallery->new(app => $self); + $font_gallery->start; +} + sub _activate($self, $exd_file = undef) { say "My pid is $$."; $self->parent_pid($$); @@ -779,12 +785,18 @@ sub _activate($self, $exd_file = undef) { my $preview_button = Gtk4::Button->new_with_label('Preview'); my $select_printer = Gtk4::Button->new_with_label('Select Printer'); my $open_gallery = Gtk4::Button->new_with_label('Open image gallery'); + my $edit_fonts = Gtk4::Button->new_with_label('Open font gallery'); $open_gallery->signal_connect( 'clicked', sub { $self->_open_gallery; } ); + $edit_fonts->signal_connect( + clicked => sub { + $self->_open_fonts_gallery; + } + ); $select_printer->signal_connect( 'clicked', sub { @@ -826,6 +838,7 @@ sub _activate($self, $exd_file = undef) { $box_buttons->append($preview_button); $box_buttons->append($select_printer); $box_buttons->append($open_gallery); + $box_buttons->append($edit_fonts); $self->_populate_editor_and_preview($box_vertical); $box_vertical->append($box_buttons); my $execute_log_window = Gtk4::ScrolledWindow->new; diff --git a/lib/Exd/Gui/FontGallery.pm b/lib/Exd/Gui/FontGallery.pm new file mode 100644 index 0000000..4a0085b --- /dev/null +++ b/lib/Exd/Gui/FontGallery.pm @@ -0,0 +1,22 @@ +package Exd::Gui::FontGallery; + +use v5.40.0; + +use strict; +use warnings; +use utf8; + +use Moo; + +has app => (is => 'ro', required => 1); +has _window => ( is => 'rw', ); + +sub start($self) { + my $window = Gtk4::Window->new; + $self->_window($window); + $window->set_default_size( 650, 600 ); + $window->set_title('Font gallery'); + $window->set_transient_for( $self->app->window ); + $window->present; +} +1;