Enhance scrolling by using font point size as scroll rate

In wxWidgets documentation there are three ways to set the size of the
scrolling area. The most automatic (and newest) way is by using SetScrollRate:
  * http://docs.wxwidgets.org/trunk/classwx_scrolled.html#details
This commit is contained in:
Xoan Sampaiño 2017-05-03 21:28:53 +02:00
parent 8c77f47638
commit dfc364af3c
3 changed files with 10 additions and 3 deletions

View File

@ -101,6 +101,10 @@ our $medium_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
$medium_font->SetPointSize(12);
our $grey = Wx::Colour->new(200,200,200);
# to use in ScrolledWindow::SetScrollRate(xstep, ystep)
# step related to system font point size
our $scroll_step = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)->GetPointSize;
our $VERSION_CHECK_EVENT : shared = Wx::NewEventType;
our $DLP_projection_screen;

View File

@ -89,7 +89,9 @@ sub new {
}
$self->SetSizer($self->{sizer});
$self->SetScrollbars(0, 1, 0, 1);
# http://docs.wxwidgets.org/3.0/classwx_scrolled.html#details
$self->SetScrollRate(0, $Slic3r::GUI::scroll_step);
$self->set_opt_keys($params{opt_keys}) if $params{opt_keys};
$self->update_optgroup;

View File

@ -1602,11 +1602,12 @@ sub new {
$self->{title} = $title;
$self->{iconID} = $iconID;
$self->SetScrollbars(1, 1, 1, 1);
$self->{vsizer} = Wx::BoxSizer->new(wxVERTICAL);
$self->SetSizer($self->{vsizer});
# http://docs.wxwidgets.org/3.0/classwx_scrolled.html#details
$self->SetScrollRate($Slic3r::GUI::scroll_step, $Slic3r::GUI::scroll_step);
return $self;
}