summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-08 19:49:13 +0000
committerrubidium <rubidium@openttd.org>2009-11-08 19:49:13 +0000
commit85a3dce45c00b33dbe642be164bba061aa8f04f2 (patch)
treef8e4e53507c1830cacf748a7348b7aae537684bb /src
parentefbdba72b34da7e5add5d91c65b7d10e5ce47621 (diff)
downloadopenttd-85a3dce45c00b33dbe642be164bba061aa8f04f2.tar.xz
(svn r18022) -Cleanup: remove some (now) unused button resize functions
Diffstat (limited to 'src')
-rw-r--r--src/widget.cpp87
-rw-r--r--src/window_gui.h2
2 files changed, 0 insertions, 89 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 0f9232ac6..aabd1c573 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -725,93 +725,6 @@ void Window::DrawWidgets() const
}
}
-/**
- * Evenly distribute the combined horizontal length of two consecutive widgets.
- * @param w Window containing the widgets.
- * @param a Left widget to resize.
- * @param b Right widget to resize.
- * @note Widgets are assumed to lie against each other.
- */
-static void ResizeWidgets(Window *w, byte a, byte b)
-{
- int16 offset = w->widget[a].left;
- int16 length = w->widget[b].right - offset;
-
- w->widget[a].right = (length / 2) + offset;
-
- w->widget[b].left = w->widget[a].right + 1;
-}
-
-/**
- * Evenly distribute the combined horizontal length of three consecutive widgets.
- * @param w Window containing the widgets.
- * @param a Left widget to resize.
- * @param b Middle widget to resize.
- * @param c Right widget to resize.
- * @note Widgets are assumed to lie against each other.
- */
-static void ResizeWidgets(Window *w, byte a, byte b, byte c)
-{
- int16 offset = w->widget[a].left;
- int16 length = w->widget[c].right - offset;
-
- w->widget[a].right = length / 3;
- w->widget[b].right = w->widget[a].right * 2;
-
- w->widget[a].right += offset;
- w->widget[b].right += offset;
-
- /* Now the right side of the buttons are set. We will now set the left sides next to them */
- w->widget[b].left = w->widget[a].right + 1;
- w->widget[c].left = w->widget[b].right + 1;
-}
-
-/** Evenly distribute some widgets when resizing horizontally (often a button row)
- * When only two arguments are given, the widgets are presumed to be on a line and only the ends are given
- * @param w Window to modify
- * @param left The leftmost widget to resize
- * @param right The rightmost widget to resize. Since right side of it is used, remember to set it to RESIZE_RIGHT
- */
-void ResizeButtons(Window *w, byte left, byte right)
-{
- int16 num_widgets = right - left + 1;
-
- if (num_widgets < 2) NOT_REACHED();
-
- switch (num_widgets) {
- case 2: ResizeWidgets(w, left, right); break;
- case 3: ResizeWidgets(w, left, left + 1, right); break;
- default: {
- /* Looks like we got more than 3 widgets to resize
- * Now we will find the middle of the space desinated for the widgets
- * and place half of the widgets on each side of it and call recursively.
- * Eventually we will get down to blocks of 2-3 widgets and we got code to handle those cases */
- int16 offset = w->widget[left].left;
- int16 length = w->widget[right].right - offset;
- byte widget = ((num_widgets - 1)/ 2) + left; // rightmost widget of the left side
-
- /* Now we need to find the middle of the widgets.
- * It will not always be the middle because if we got an uneven number of widgets,
- * we will need it to be 2/5, 3/7 and so on
- * To get this, we multiply with num_widgets/num_widgets. Since we calculate in int, we will get:
- *
- * num_widgets/2 (rounding down)
- * ---------------
- * num_widgets
- *
- * as multiplier to length. We just multiply before divide to that we stay in the int area though */
- int16 middle = ((length * num_widgets) / (2 * num_widgets)) + offset;
-
- /* Set left and right on the widgets, that's next to our "middle" */
- w->widget[widget].right = middle;
- w->widget[widget + 1].left = w->widget[widget].right + 1;
- /* Now resize the left and right of the middle */
- ResizeButtons(w, left, widget);
- ResizeButtons(w, widget + 1, right);
- }
- }
-}
-
/** Resize a widget and shuffle other widgets around to fit. */
void ResizeWindowForWidget(Window *w, uint widget, int delta_x, int delta_y)
{
diff --git a/src/window_gui.h b/src/window_gui.h
index ab6bee1da..b3d8556db 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -956,8 +956,6 @@ bool EditBoxInGlobalFocus();
void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y);
void ScrollbarClickHandler(Window *w, const NWidgetCore *nw, int x, int y);
-void ResizeButtons(Window *w, byte left, byte right);
-
void ResizeWindowForWidget(Window *w, uint widget, int delta_x, int delta_y);
#endif /* WINDOW_GUI_H */