diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index 22b7bea6..b24fa5a2 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -4,6 +4,7 @@ use warnings; use utf8; use FindBin; +use Slic3r::GUI::AboutDialog; use Slic3r::GUI::ConfigWizard; use Slic3r::GUI::Plater; use Slic3r::GUI::OptionsGroup; @@ -119,13 +120,9 @@ sub OnInit { sub about { my $frame = shift; - my $info = Wx::AboutDialogInfo->new; - $info->SetName('Slic3r'); - $info->AddDeveloper('Alessandro Ranellucci'); - $info->SetVersion($Slic3r::VERSION); - $info->SetDescription('G-code generator for 3D printers'); - - Wx::AboutBox($info); + my $about = Slic3r::GUI::AboutDialog->new($frame); + $about->ShowModal; + $about->Destroy; } sub on_close { diff --git a/lib/Slic3r/GUI/AboutDialog.pm b/lib/Slic3r/GUI/AboutDialog.pm new file mode 100644 index 00000000..26fad832 --- /dev/null +++ b/lib/Slic3r/GUI/AboutDialog.pm @@ -0,0 +1,108 @@ +package Slic3r::GUI::AboutDialog; +use strict; +use warnings; +use utf8; + +use Wx qw(:font :html :misc :sizer :systemsettings); +use Wx::Event qw(EVT_HTML_LINK_CLICKED); +use Wx::Html; +use base 'Wx::Dialog'; + +sub new { + my $class = shift; + my ($parent) = @_; + my $self = $class->SUPER::new($parent, -1, 'About Slic3r', wxDefaultPosition, [600, 270]); + + $self->SetBackgroundColour(Wx::wxWHITE); + my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL); + $self->SetSizer($hsizer); + + # logo + my $logo = Slic3r::GUI::AboutDialog::Logo->new($self, -1, wxDefaultPosition, wxDefaultSize); + $logo->SetBackgroundColour(Wx::wxWHITE); + $hsizer->Add($logo, 0, wxEXPAND | wxLEFT | wxRIGHT, 30); + + my $vsizer = Wx::BoxSizer->new(wxVERTICAL); + $hsizer->Add($vsizer, 1, wxEXPAND, 0); + + # title + my $title = Wx::StaticText->new($self, -1, 'Slic3r', wxDefaultPosition, wxDefaultSize); + my $title_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + $title_font->SetWeight(wxFONTWEIGHT_BOLD); + $title_font->SetFamily(wxFONTFAMILY_ROMAN); + $title_font->SetPointSize(24); + $title->SetFont($title_font); + $vsizer->Add($title, 0, wxALIGN_LEFT | wxTOP, 30); + + # version + my $version = Wx::StaticText->new($self, -1, "Version $Slic3r::VERSION", wxDefaultPosition, wxDefaultSize); + my $version_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + $version_font->SetPointSize(&Wx::wxMSW ? 9 : 11); + $version->SetFont($version_font); + $vsizer->Add($version, 0, wxALIGN_LEFT | wxBOTTOM, 10); + + # text + my $text = + '' . + '' . + '' . + 'Copyright © 2011-2012 Alessandro Ranellucci. All rights reserved. ' . + 'Slic3r is licensed under the ' . + 'GNU Affero General Public License, version 3.' . + '


' . + 'Slic3r logo designed by Corey Daniels, Silk Icon Set designed by Mark James. ' . + 'Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess and numerous others.' . + '
' . + '' . + ''; + my $html = Wx::HtmlWindow->new($self, -1, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER); + my $font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + my $size = &Wx::wxMSW ? 8 : 10; + $html->SetFonts($font->GetFaceName, $font->GetFaceName, [$size, $size, $size, $size, $size, $size, $size]); + $html->SetBorders(2); + $html->SetPage($text); + $vsizer->Add($html, 1, wxEXPAND | wxALIGN_LEFT | wxRIGHT | wxBOTTOM, 20); + EVT_HTML_LINK_CLICKED($self, $html, \&link_clicked); + + return $self; +} + +sub link_clicked { + my ($self, $event) = @_; + + Wx::LaunchDefaultBrowser($event->GetLinkInfo->GetHref); + $event->Skip(0); +} + +package Slic3r::GUI::AboutDialog::Logo; +use Wx qw(:bitmap :dc); +use Wx::Event qw(EVT_PAINT); +use base 'Wx::Panel'; + +sub new { + my $class = shift; + my $self = $class->SUPER::new(@_); + + $self->{logo} = Wx::Bitmap->new("$Slic3r::var/Slic3r_192px.png", wxBITMAP_TYPE_PNG); + $self->SetMinSize(Wx::Size->new($self->{logo}->GetWidth, $self->{logo}->GetHeight)); + + EVT_PAINT($self, \&repaint); + + return $self; +} + +sub repaint { + my ($self, $event) = @_; + + my $dc = Wx::PaintDC->new($self); + $dc->SetBackgroundMode(wxTRANSPARENT); + + my $size = $self->GetSize; + my $logo_w = $self->{logo}->GetWidth; + my $logo_h = $self->{logo}->GetHeight; + $dc->DrawBitmap($self->{logo}, ($size->GetWidth - $logo_w) / 2, ($size->GetHeight - $logo_h) / 2, 1); + + $event->Skip; +} + +1; diff --git a/var/Slic3r_192px.png b/var/Slic3r_192px.png new file mode 100644 index 00000000..cfb7a574 Binary files /dev/null and b/var/Slic3r_192px.png differ