Commit bde41f0f authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Made spinbox wrap around

parent 7c40093a
......@@ -54,7 +54,7 @@ static struct ui_widget set_time_screen = {
#define SPINBOX_NUMBER 4
enum SPINBOX { H1 = 0, H2, M1, M2 };
static const char const *hours1 = "012";
static const char const *hours1 = "01";
static const char const *minutes1 = "012345";
static const char **char_sets[SPINBOX_NUMBER] = {
......
......@@ -26,6 +26,8 @@
#include "spinbox.h"
#include <string.h>
// Default character sets.
const char *char_digits = "0123456789\x0";
const char *char_letters = "abcdefghijklmnopqrstuvwxyz\0";
......@@ -38,13 +40,17 @@ static void spinbox_event(struct ui_widget *w, const struct event *evt)
if(evt->data.button == BUT_BR) {
if(s->chars[s->value_idx + 1] != 0) {
++s->value_idx;
w->flags |= WF_DIRTY;
} else {
s->value_idx = 0;
}
w->flags |= WF_DIRTY;
} else if(evt->data.button == BUT_BL) {
if(s->value_idx > 0) {
--s->value_idx;
w->flags |= WF_DIRTY;
} else {
s->value_idx = strlen(s->chars) - 1;
}
w->flags |= WF_DIRTY;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment