gyscos / cursive

A Text User Interface library for the Rust programming language
MIT License
4.25k stars 244 forks source link

Add SliderView #26

Open gyscos opened 8 years ago

gyscos commented 8 years ago

Either something like AlsaMixer, or one that looks like the current scrollbars.

matthiasbeyer commented 8 years ago

I like that idea! One should have the possibility to make it either horizontal or vertical. Also, one might want to open this in a sub window (I'm pretty sure I do not get the terminology right here, hope you understand anyways).

gyscos commented 8 years ago

Vertical/Horizontal layouts are planned. As for the new window, users can implement that if they want (have Enter add a new layer with a single slider, and retrieve the value when the dialog is closed).

gyscos commented 8 years ago

Added a basic version in ce6992a8c5589e82968bb3196ec7297f662be255, it uses the same visuals as the scrollbars (with - instead of | for horizontal sliders), only without the "lighter" color of the cursor. It is limited to one cell-increments (which means as many possible values as the size of the view). The user is responsible to scale it to his desired range.

Adding the option to decorrelate view size and value range would mean that a "move" (an arrow key press) no longer maps 1-1 for a visual movement of the cursor:

It is also currently limited to a 1x1 cursor (unlike scrollbars). I guess larger cursors might make sense for large views and small range (so that the successive positions appear to touch each other).

gyscos commented 8 years ago

Also, vertical sliders are top-to-bottom (like most other views). This mean the top value is actually the lowest (unlike the alsa mixer example in the first post). Again, it could be up to the user to do the translation...