More TODO -> LONGTERM migration. Also made it so uiSpinbox and uiSlider merely swap min and max if min is larger.

This commit is contained in:
Pietro Gagliardi 2016-05-22 20:11:52 -04:00
parent ab0a9102b4
commit 61185072f7
11 changed files with 45 additions and 12 deletions

View File

@ -22,6 +22,7 @@ This README is being written.<br>
* uiAreas on Windows and some internal Direct2D areas now respond to `WM_PRINTCLIENT` properly, which should hopefully increase the quality of screenshots.
* uiDateTimePicker on GTK+ works properly on RTL layouts and no longer disappears off the bottom of the screen if not enough room is available. It will also no longer be marked for localization of the time format (what the separator should be and whether to use 24-hour time), as that information is not provided by the locale system. :(
* Added `uiUserBugCannotSetParentOnToplevel()`, which should be used by implementations of toplevel controls in their `SetParent()` implementations. This will also be the beginning of consolidating common user bug messages into a single place, though this will be one of the only few exported user bug functions.
* uiSpinbox and uiSlider now merely swap their min and max if min ≥ max. They will no longer panic and do nothing, respectively.
## Runtime Requirements

View File

@ -114,6 +114,13 @@ uiSlider *uiNewSlider(intmax_t min, intmax_t max)
{
uiSlider *s;
NSSliderCell *cell;
intmax_t temp;
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiDarwinNewControl(uiSlider, s);

View File

@ -182,10 +182,13 @@ static void defaultOnChanged(uiSpinbox *s, void *data)
uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
{
uiSpinbox *s;
intmax_t temp;
// TODO implicitly swap instead?
if (min >= max)
userbug("min >= max is invalid for a uiSpinbox.");
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiDarwinNewControl(uiSpinbox, s);

1
doc/slider Normal file
View File

@ -0,0 +1 @@
if min >= max then they are swapped

1
doc/spinbox Normal file
View File

@ -0,0 +1 @@
if min >= max then they are swapped

View File

@ -100,7 +100,7 @@ PangoFont *pangoDescToPangoFont(PangoFontDescription *pdesc)
context = mkGenericPangoCairoContext();
f = pango_font_map_load_font(pango_cairo_font_map_get_default(), context, pdesc);
if (f == NULL) {
// TODO
// LONGTERM
g_error("[libui] no match in pangoDescToPangoFont(); report to andlabs");
}
g_object_unref(context);

View File

@ -47,6 +47,13 @@ void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *, void *), void *data)
uiSlider *uiNewSlider(intmax_t min, intmax_t max)
{
uiSlider *s;
intmax_t temp;
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiUnixNewControl(uiSlider, s);

View File

@ -34,7 +34,7 @@ void uiSpinboxSetValue(uiSpinbox *s, intmax_t value)
{
// we need to inhibit sending of ::value-changed because this WILL send a ::value-changed otherwise
g_signal_handler_block(s->spinButton, s->onChangedSignal);
// TODO does this clamp?
// this clamps for us
gtk_spin_button_set_value(s->spinButton, (gdouble) value);
g_signal_handler_unblock(s->spinButton, s->onChangedSignal);
}
@ -48,10 +48,13 @@ void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *, void *), void *data
uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
{
uiSpinbox *s;
intmax_t temp;
// TODO just swap?
if (min >= max)
userbug("min >= max not allowed in uiNewSpinbox().");
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiUnixNewControl(uiSpinbox, s);

View File

@ -244,7 +244,7 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
if (hr != S_OK)
logHRESULT(L"error finding font family", hr);
if (!exists)
implbug("TODO family not found in uiDrawLoadClosestFont()", hr);
implbug("LONGTERM family not found in uiDrawLoadClosestFont()", hr);
hr = collection->GetFontFamily(index, &family);
if (hr != S_OK)
logHRESULT(L"error loading font family", hr);

View File

@ -71,6 +71,13 @@ void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *, void *), void *data)
uiSlider *uiNewSlider(intmax_t min, intmax_t max)
{
uiSlider *s;
intmax_t temp;
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiWindowsNewControl(uiSlider, s);

View File

@ -182,10 +182,13 @@ static void onResize(uiWindowsControl *c)
uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
{
uiSpinbox *s;
intmax_t temp;
if (min >= max)
// TODO
implbug("error: min >= max in uiNewSpinbox()");
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiWindowsNewControl(uiSpinbox, s);