mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r17427) -Codechange: Removing some unneeded widget parts (for reduced compilation time).
This commit is contained in:
parent
1776a4ecc1
commit
0be5e59355
|
@ -2458,15 +2458,6 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WPT_RESIZE_PTR: {
|
|
||||||
NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest);
|
|
||||||
if (nwrb != NULL) {
|
|
||||||
assert(parts->u.xy_ptr->x >= 0 && parts->u.xy_ptr->y >= 0);
|
|
||||||
nwrb->SetResize(parts->u.xy_ptr->x, parts->u.xy_ptr->y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case WPT_MINSIZE: {
|
case WPT_MINSIZE: {
|
||||||
NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest);
|
NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest);
|
||||||
if (nwrb != NULL) {
|
if (nwrb != NULL) {
|
||||||
|
@ -2476,15 +2467,6 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WPT_MINSIZE_PTR: {
|
|
||||||
NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest);
|
|
||||||
if (nwrb != NULL) {
|
|
||||||
assert(parts->u.xy_ptr->x >= 0 && parts->u.xy_ptr->y >= 0);
|
|
||||||
nwrb->SetMinimalSize((uint)(parts->u.xy_ptr->x), (uint)(parts->u.xy_ptr->y));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case WPT_FILL: {
|
case WPT_FILL: {
|
||||||
NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest);
|
NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest);
|
||||||
if (nwrb != NULL) nwrb->SetFill(parts->u.xy.x != 0, parts->u.xy.y != 0);
|
if (nwrb != NULL) nwrb->SetFill(parts->u.xy.x != 0, parts->u.xy.y != 0);
|
||||||
|
@ -2500,15 +2482,6 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WPT_DATATIP_PTR: {
|
|
||||||
NWidgetCore *nwc = dynamic_cast<NWidgetCore *>(*dest);
|
|
||||||
if (nwc != NULL) {
|
|
||||||
nwc->widget_data = parts->u.datatip_ptr->data;
|
|
||||||
nwc->tool_tip = parts->u.datatip_ptr->tooltip;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case WPT_PADDING:
|
case WPT_PADDING:
|
||||||
if (*dest != NULL) (*dest)->SetPadding(parts->u.padding.top, parts->u.padding.right, parts->u.padding.bottom, parts->u.padding.left);
|
if (*dest != NULL) (*dest)->SetPadding(parts->u.padding.top, parts->u.padding.right, parts->u.padding.bottom, parts->u.padding.left);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -124,12 +124,9 @@ enum WidgetType {
|
||||||
|
|
||||||
/* Nested widget part types. */
|
/* Nested widget part types. */
|
||||||
WPT_RESIZE, ///< Widget part for specifying resizing.
|
WPT_RESIZE, ///< Widget part for specifying resizing.
|
||||||
WPT_RESIZE_PTR, ///< Widget part for specifying resizing via a pointer.
|
|
||||||
WPT_MINSIZE, ///< Widget part for specifying minimal size.
|
WPT_MINSIZE, ///< Widget part for specifying minimal size.
|
||||||
WPT_MINSIZE_PTR, ///< Widget part for specifying minimal size via a pointer.
|
|
||||||
WPT_FILL, ///< Widget part for specifying fill.
|
WPT_FILL, ///< Widget part for specifying fill.
|
||||||
WPT_DATATIP, ///< Widget part for specifying data and tooltip.
|
WPT_DATATIP, ///< Widget part for specifying data and tooltip.
|
||||||
WPT_DATATIP_PTR, ///< Widget part for specifying data and tooltip via a pointer.
|
|
||||||
WPT_PADDING, ///< Widget part for specifying a padding.
|
WPT_PADDING, ///< Widget part for specifying a padding.
|
||||||
WPT_PIPSPACE, ///< Widget part for specifying pre/inter/post space for containers.
|
WPT_PIPSPACE, ///< Widget part for specifying pre/inter/post space for containers.
|
||||||
WPT_ENDCONTAINER, ///< Widget part to denote end of a container.
|
WPT_ENDCONTAINER, ///< Widget part to denote end of a container.
|
||||||
|
@ -618,9 +615,7 @@ struct NWidgetPart {
|
||||||
WidgetType type; ///< Type of the part. @see NWidgetPartType.
|
WidgetType type; ///< Type of the part. @see NWidgetPartType.
|
||||||
union {
|
union {
|
||||||
Point xy; ///< Part with an x/y size.
|
Point xy; ///< Part with an x/y size.
|
||||||
Point *xy_ptr; ///< Part with a pointer to an x/y size.
|
|
||||||
NWidgetPartDataTip data_tip; ///< Part with a data/tooltip.
|
NWidgetPartDataTip data_tip; ///< Part with a data/tooltip.
|
||||||
NWidgetPartDataTip *datatip_ptr; ///< Part with a pointer to data/tooltip.
|
|
||||||
NWidgetPartWidget widget; ///< Part with a start of a widget.
|
NWidgetPartWidget widget; ///< Part with a start of a widget.
|
||||||
NWidgetPartPaddings padding; ///< Part with paddings.
|
NWidgetPartPaddings padding; ///< Part with paddings.
|
||||||
NWidgetPartPIP pip; ///< Part with pre/inter/post spaces.
|
NWidgetPartPIP pip; ///< Part with pre/inter/post spaces.
|
||||||
|
@ -646,21 +641,6 @@ static inline NWidgetPart SetResize(int16 dx, int16 dy)
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Widget part function for using a pointer to set the resize step.
|
|
||||||
* @param ptr Pointer to horizontal and vertical resize step.
|
|
||||||
* @ingroup NestedWidgetParts
|
|
||||||
*/
|
|
||||||
static inline NWidgetPart SetResize(Point *ptr)
|
|
||||||
{
|
|
||||||
NWidgetPart part;
|
|
||||||
|
|
||||||
part.type = WPT_RESIZE_PTR;
|
|
||||||
part.u.xy_ptr = ptr;
|
|
||||||
|
|
||||||
return part;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget part function for setting the minimal size.
|
* Widget part function for setting the minimal size.
|
||||||
* @param dx Horizontal minimal size.
|
* @param dx Horizontal minimal size.
|
||||||
|
@ -678,21 +658,6 @@ static inline NWidgetPart SetMinimalSize(int16 x, int16 y)
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Widget part function for using a pointer to set the minimal size.
|
|
||||||
* @param ptr Pointer to horizontal and vertical minimal size.
|
|
||||||
* @ingroup NestedWidgetParts
|
|
||||||
*/
|
|
||||||
static inline NWidgetPart SetMinimalSize(Point *ptr)
|
|
||||||
{
|
|
||||||
NWidgetPart part;
|
|
||||||
|
|
||||||
part.type = WPT_MINSIZE_PTR;
|
|
||||||
part.u.xy_ptr = ptr;
|
|
||||||
|
|
||||||
return part;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget part function for setting filling.
|
* Widget part function for setting filling.
|
||||||
* @param x_fill Allow horizontal filling from minimal size.
|
* @param x_fill Allow horizontal filling from minimal size.
|
||||||
|
@ -740,21 +705,6 @@ static inline NWidgetPart SetDataTip(uint16 data, StringID tip)
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Widget part function for setting the data and tooltip via a pointer.
|
|
||||||
* @param ptr Pointer to the data and tooltip of the widget.
|
|
||||||
* @ingroup NestedWidgetParts
|
|
||||||
*/
|
|
||||||
static inline NWidgetPart SetDataTip(NWidgetPartDataTip *ptr)
|
|
||||||
{
|
|
||||||
NWidgetPart part;
|
|
||||||
|
|
||||||
part.type = WPT_DATATIP_PTR;
|
|
||||||
part.u.datatip_ptr = ptr;
|
|
||||||
|
|
||||||
return part;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget part function for setting additional space around a widget.
|
* Widget part function for setting additional space around a widget.
|
||||||
* Parameters start above the widget, and are specified in clock-wise direction.
|
* Parameters start above the widget, and are specified in clock-wise direction.
|
||||||
|
|
Loading…
Reference in New Issue