mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r20216) -Fix: Increase scrolling speed of industry cargoes window, enlarge height slightly so small chains fit by default.
This commit is contained in:
parent
43b4d23b07
commit
b59a6a53de
@ -1290,7 +1290,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = {
|
|||||||
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(NWID_HORIZONTAL),
|
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(NWID_VERTICAL),
|
||||||
NWidget(WWT_SCROLLBAR, COLOUR_BROWN, ICW_SCROLLBAR),
|
NWidget(WWT_SCROLLBAR, COLOUR_BROWN, ICW_SCROLLBAR),
|
||||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
|
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
|
||||||
@ -1300,7 +1300,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = {
|
|||||||
|
|
||||||
/** Window description for the industry cargoes window. */
|
/** Window description for the industry cargoes window. */
|
||||||
static const WindowDesc _industry_cargoes_desc(
|
static const WindowDesc _industry_cargoes_desc(
|
||||||
WDP_AUTO, 300, 200,
|
WDP_AUTO, 300, 210,
|
||||||
WC_INDUSTRY_CARGOES, WC_NONE,
|
WC_INDUSTRY_CARGOES, WC_NONE,
|
||||||
0,
|
0,
|
||||||
_nested_industry_cargoes_widgets, lengthof(_nested_industry_cargoes_widgets)
|
_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(1, 1, num_indrows);
|
||||||
this->ShortenCargoColumn(3, 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();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2210,7 +2211,8 @@ struct IndustryCargoesWindow : public Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->ShortenCargoColumn(1, 1, num_indrows);
|
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();
|
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;
|
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 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++) {
|
for (uint i = 0; i < this->fields.Length(); i++) {
|
||||||
int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height;
|
int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height;
|
||||||
if (vpos + row_height >= 0) {
|
if (vpos + row_height >= 0) {
|
||||||
@ -2274,11 +2277,11 @@ struct IndustryCargoesWindow : public Window {
|
|||||||
*/
|
*/
|
||||||
bool CalculatePositionInWidget(Point pt, Point *fieldxy, Point *xy)
|
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.x -= nw->pos_x;
|
||||||
pt.y -= nw->pos_y;
|
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;
|
if (pt.y < vpos) return false;
|
||||||
|
|
||||||
int row = (pt.y - vpos) / CargoesField::normal_height; // row is relative to row 1.
|
int row = (pt.y - vpos) / CargoesField::normal_height; // row is relative to row 1.
|
||||||
|
Loading…
Reference in New Issue
Block a user