|
@@ -167,25 +167,25 @@ struct SignListWindow : Window, SignList
|
|
|
this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text.
|
|
|
resize->height = max<uint>(FONT_HEIGHT_NORMAL, GetSpriteSize(SPR_PLAYER_ICON).height);
|
|
|
Dimension d = {this->text_offset + MAX_LENGTH_SIGN_NAME_PIXELS + WD_FRAMETEXT_RIGHT, WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM};
|
|
|
*size = maxdim(*size, d);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnInvalidateData(int data)
|
|
|
{
|
|
|
if (data == 0) { // New or deleted sign.
|
|
|
this->signs.ForceRebuild();
|
|
|
this->BuildSignsList();
|
|
|
this->InvalidateWidget(SLW_CAPTION);
|
|
|
this->SetWidgetDirty(SLW_CAPTION);
|
|
|
this->vscroll.SetCount(this->signs.Length());
|
|
|
} else { // Change of sign contents.
|
|
|
this->signs.ForceResort();
|
|
|
}
|
|
|
|
|
|
this->SortSignsList();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
static const NWidgetPart _nested_sign_list_widgets[] = {
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_GREY, SLW_CLOSEBOX),
|
|
@@ -263,25 +263,25 @@ struct SignWindow : QueryStringBaseWindo
|
|
|
/* Display an empty string when the sign hasnt been edited yet */
|
|
|
if (si->name != NULL) {
|
|
|
SetDParam(0, si->index);
|
|
|
GetString(this->edit_str_buf, STR_SIGN_NAME, last_of);
|
|
|
} else {
|
|
|
GetString(this->edit_str_buf, STR_EMPTY, last_of);
|
|
|
}
|
|
|
*last_of = '\0';
|
|
|
|
|
|
this->cur_sign = si->index;
|
|
|
InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, MAX_LENGTH_SIGN_NAME_PIXELS);
|
|
|
|
|
|
this->InvalidateWidget(QUERY_EDIT_SIGN_WIDGET_TEXT);
|
|
|
this->SetWidgetDirty(QUERY_EDIT_SIGN_WIDGET_TEXT);
|
|
|
this->SetFocusedWidget(QUERY_EDIT_SIGN_WIDGET_TEXT);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Returns a pointer to the (alphabetically) previous or next sign of the current sign.
|
|
|
* @param next false if the previous sign is wanted, true if the next sign is wanted
|
|
|
* @return pointer to the previous/next sign
|
|
|
*/
|
|
|
const Sign *PrevNextSign(bool next)
|
|
|
{
|
|
|
/* Rebuild the sign list */
|
|
|
this->signs.ForceRebuild();
|