+ reposition_slider();
+}
+
+void Entry::reposition_slider()
+{
+ if(!slider)
+ return;
+
+ for(list<Part>::const_iterator i=style->get_parts().begin(); i!=style->get_parts().end(); ++i)
+ if(i->get_name()=="slider")
+ {
+ Geometry sgeom = i->get_geometry();
+ i->get_alignment().apply(sgeom, geom, i->get_margin());
+ slider->set_geometry(sgeom);
+ }
+}
+
+void Entry::slider_value_changed(double value)
+{
+ if(text.get_n_lines()>visible_rows)
+ first_row = text.get_n_lines()-visible_rows-static_cast<unsigned>(value);
+}
+
+void Entry::check_view_range()
+{
+ if(!multiline || !text_part)
+ return;
+
+ const GL::Font *font = style->get_font();
+ float font_size = font->get_default_size();
+ unsigned line_spacing = static_cast<unsigned>(font_size*6/5);
+
+ const Sides &margin = text_part->get_margin();
+ visible_rows = max((geom.h-margin.top-margin.bottom)/line_spacing, 1U);
+
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+
+ if(first_row>row)
+ first_row = row;
+ else if(row>=first_row+visible_rows)
+ first_row = row+1-visible_rows;
+
+ if(slider)
+ {
+ unsigned scroll = max(text.get_n_lines(), visible_rows)-visible_rows;
+ slider->set_range(0, scroll);
+ slider->set_value(scroll-first_row);
+ }