summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-07-25 12:38:06 +0000
committeralberth <alberth@openttd.org>2010-07-25 12:38:06 +0000
commitb59a6a53de8b5d15666e63ddd863d49984eebf2f (patch)
tree34a6b4cdde3476796b353f1601251ea626ea7ba7 /src
parent43b4d23b07d1565bab7556b8f3dd43040637bc4e (diff)
downloadopenttd-b59a6a53de8b5d15666e63ddd863d49984eebf2f.tar.xz
(svn r20216) -Fix: Increase scrolling speed of industry cargoes window, enlarge height slightly so small chains fit by default.
Diffstat (limited to 'src')
-rw-r--r--src/industry_gui.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index db3ad4071..50e6b8be4 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -1290,7 +1290,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_BROWN, ICW_PANEL), SetResize(1, 1), SetMinimalSize(200, 90), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN, ICW_PANEL), SetResize(1, 10), SetMinimalSize(200, 90), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_BROWN, ICW_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
@@ -1300,7 +1300,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = {
/** Window description for the industry cargoes window. */
static const WindowDesc _industry_cargoes_desc(
- WDP_AUTO, 300, 200,
+ WDP_AUTO, 300, 210,
WC_INDUSTRY_CARGOES, WC_NONE,
0,
_nested_industry_cargoes_widgets, lengthof(_nested_industry_cargoes_widgets)
@@ -2147,7 +2147,8 @@ struct IndustryCargoesWindow : public Window {
this->ShortenCargoColumn(1, 1, num_indrows);
this->ShortenCargoColumn(3, 1, num_indrows);
- this->vscroll.SetCount(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height);
+ const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL);
+ this->vscroll.SetCount(CeilDiv(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height, nwp->resize_y));
this->SetDirty();
}
@@ -2210,7 +2211,8 @@ struct IndustryCargoesWindow : public Window {
}
this->ShortenCargoColumn(1, 1, num_indrows);
- this->vscroll.SetCount(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height);
+ const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL);
+ this->vscroll.SetCount(CeilDiv(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height, nwp->resize_y));
this->SetDirty();
}
@@ -2239,7 +2241,8 @@ struct IndustryCargoesWindow : public Window {
if (this->ind_cargo >= NUM_INDUSTRYTYPES) left_pos += (CargoesField::industry_width + CargoesField::CARGO_FIELD_WIDTH) / 2;
int last_column = (this->ind_cargo < NUM_INDUSTRYTYPES) ? 4 : 2;
- int vpos = -this->vscroll.GetPosition();
+ const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL);
+ int vpos = -this->vscroll.GetPosition() * nwp->resize_y;
for (uint i = 0; i < this->fields.Length(); i++) {
int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height;
if (vpos + row_height >= 0) {
@@ -2274,11 +2277,11 @@ struct IndustryCargoesWindow : public Window {
*/
bool CalculatePositionInWidget(Point pt, Point *fieldxy, Point *xy)
{
- NWidgetBase *nw = this->GetWidget<NWidgetBase>(ICW_PANEL);
+ const NWidgetBase *nw = this->GetWidget<NWidgetBase>(ICW_PANEL);
pt.x -= nw->pos_x;
pt.y -= nw->pos_y;
- int vpos = WD_FRAMERECT_TOP + CargoesField::small_height - this->vscroll.GetPosition();
+ int vpos = WD_FRAMERECT_TOP + CargoesField::small_height - this->vscroll.GetPosition() * nw->resize_y;
if (pt.y < vpos) return false;
int row = (pt.y - vpos) / CargoesField::normal_height; // row is relative to row 1.