summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-widgets.c
Commit message (Collapse)AuthorAgeFilesLines
* ui/ncurses: Validate URL fieldv1.7.0Samuel Mendoza-Jonas2018-02-271-0/+16
| | | | | | | Make sure the URL field is a valid URL before allowing the user to proceed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Treat left/right arrow keys properlySamuel Mendoza-Jonas2016-08-231-2/+6
| | | | | | | | | It turns out ncurses helpfully provides REQ_LEFT_FIELD and REQ_RIGHT_FIELD to navigate between visually horizontal fields. Update widgetset_process_key() to use these for KEY_LEFT and KEY_RIGHT respectively. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Call widget process_key handlers firstSamuel Mendoza-Jonas2016-07-211-5/+15
| | | | | | | | | | | | | | | Adding KEY_LEFT and KEY_RIGHT brought to light the problem that widgetset_process_keys() may handle keystrokes that would have also been handled by a widget's process_keys function. In particular the cursor in a textbox widget could no longer be moved with the left/right keys. This updates widgetset_process_keys() to call the focussed widget's process_keys function before handling the key in any other way. All of the widget process_keys functions correctly return false if the key is not relevant to the widget except for textbox_process_key() which is updated to ignore the main navigational keys. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Properly set focus when updating subsetSamuel Mendoza-Jonas2016-07-131-2/+6
| | | | | | | | | | | When a subset widget is made empty focus is switched to the first visible field. It should actually be set to the first visible and active field, otherwise we can try to focus an un-selectable label. While we're here, also properly set the visibility for the autoboot enable/disable widget. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Update keybindings for subsetsSamuel Mendoza-Jonas2016-07-131-19/+4
| | | | | | | | | | We now use KEY_LEFT and KEY_RIGHT for general navigation; update subset_process_key() to use the following keybindings: Reorder items up/down: Minus/Plus keys (-/+) Delete item: Delete or Backspace Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Interpret left/right keys as up/downSamuel Mendoza-Jonas2016-05-241-0/+2
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Remove redundant assignmentSamuel Mendoza-Jonas2015-12-181-3/+1
| | | | | | Fixes Coverity defect #30484 Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* ui/ncurses: Allow text wrapping in select widgetsSamuel Mendoza-Jonas2015-09-101-15/+64
| | | | | | | | | | Several string translations used in select widgets are longer than the maximum possible width of the widget. Rather than associating several FIELDs with a select option, use a fold_text callback to pad out substrings of the original string such that the ncurses O_WRAP option properly wraps strings within the field. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* ui/ncurses: Fix positioning of i18n strings in button labelsSamuel Mendoza-Jonas2015-08-311-12/+26
| | | | | | | | | | | | Since the visual length of localised strings is not necessarily equal to the number of chars in the array, button labels could 'finish' early. For example: '[確定] ' and '[ 說明 ] ' vs the correct '[ 確定 ]' and '[ 說明 ]' Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* ui/ncurses: Use sorted field navigationSamuel Mendoza-Jonas2015-05-051-4/+4
| | | | | | | | | Changing the visual order of widgets will cause their associated fields to be out of order relative to the widgetset field array. Rather than manually resorting the array, use sorted navigation to move according to a field's visual positon Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* ui/ncurses: Add nc_widget_subsetSamuel Mendoza-Jonas2015-05-051-1/+364
| | | | | | | | The new nc_widget_subset is similar to nc_widget_select, but hides added options until they are made active. This allows the widget to have multiple options selected and ordered without cluttering the screen. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* ui/ncurses: Warn if widget runs over horizontal pad widthSamuel Mendoza-Jonas2014-10-081-0/+4
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* ui/ncurses: allow tab/backtab to skip through a widget's fieldsJeremy Kerr2014-07-221-2/+19
| | | | | | | | Since we may have a long list of devices on the configuration screen, we'd like a way to jump between widgets. This change repeats the PREV_FIELD/NEXT_FIELD driver request on these events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use a fixed-sized for small, known-length fieldsJeremy Kerr2014-04-161-0/+5
| | | | | | | | | | | | | Fields without O_STATIC can "scroll" horizontally, and we may miss a left-hand section of text from the current display. This can mean that the user can't leave a validated field with no indication why, if the off-to-the-left data is not a valid entry. This change adds a widgetset function to mark a field as fixed-size, so we don't have this scrolling behaviour. This means that the entire field contents will always be visible, and any validation errors can be seen. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-widgets: Add initial textbox validation functionsJeremy Kerr2013-12-181-0/+63
| | | | | | | | | We'd like to do some validation of the system configuration parameters, so add a few validation types to the widget code. We currently need integer, ipv4 address and multiple ipv4 address types. These are implemented as small wrappers around the ncurses form validator code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Use AC_GNU_SOURCEJeremy Kerr2013-12-181-3/+2
| | | | | | | Rather than #defining _GNU_SOURCE in our .c files, we can define this from config.h instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-widgets: Unify select keyJeremy Kerr2013-11-221-15/+11
| | | | | | | | We have a few instances where we check for a 'select' action (enter or space key event), and some are inconsistent. Unify these with a key_is_select() function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add widgetset_set_windowJeremy Kerr2013-11-221-0/+7
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add widget_select_drop_optionsJeremy Kerr2013-11-221-0/+39
| | | | | | We want to be able to re-set the options in a select widget. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/widgets: Add widget focus offset queryJeremy Kerr2013-11-221-0/+23
| | | | | | | | | | When we have widgets that are larger than the screen, we'd like to scroll to the currently-focussed component of that widget. This change introduces a widget_focus_y function, which returns the y offset of the field's focus. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/widgets: Add n_options check to widget_select_get_valueJeremy Kerr2013-11-221-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Make boot editor API consistent with config & sysinfo screensJeremy Kerr2013-11-221-0/+27
| | | | | | | | | | | | The boot-editor API is a little more exposed than it needs to be: the boot_editor struct does not need to be available to other files, and the init function and on_exit functions differ from those provided for the config and sysinfo screens. This change unifies the boot_editor API with those for the other screens. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add simple ncurses form widget setJeremy Kerr2013-11-131-0/+728
We're doing a lot of the same stuff with forms, and we'll to implement a lot of fields with the upcoming configuration interface. This change introduces a simple ncurses widget set. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud