mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Add functions provided by the midend to tell a front end whether GUI
buttons for undo and redo should currently be greyed out. [originally from svn r9139]
This commit is contained in:
18
devel.but
18
devel.but
@ -3096,6 +3096,24 @@ The front end can expect its drawing API and/or
|
|||||||
\cw{activate_timer()} to be called from within a call to this
|
\cw{activate_timer()} to be called from within a call to this
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
\H{midend-can-undo} \cw{midend_can_undo()}
|
||||||
|
|
||||||
|
\c int midend_can_undo(midend *me);
|
||||||
|
|
||||||
|
Returns \cw{TRUE} if the midend is currently in a state where the undo
|
||||||
|
operation is meaningful (i.e. at least one position exists on the undo
|
||||||
|
chain before the present one). Front ends may wish to use this to
|
||||||
|
visually activate and deactivate an undo button.
|
||||||
|
|
||||||
|
\H{midend-can-redo} \cw{midend_can_redo()}
|
||||||
|
|
||||||
|
\c int midend_can_redo(midend *me);
|
||||||
|
|
||||||
|
Returns \cw{TRUE} if the midend is currently in a state where the redo
|
||||||
|
operation is meaningful (i.e. at least one position exists on the redo
|
||||||
|
chain after the present one). Front ends may wish to use this to
|
||||||
|
visually activate and deactivate a redo button.
|
||||||
|
|
||||||
\H{midend-serialise} \cw{midend_serialise()}
|
\H{midend-serialise} \cw{midend_serialise()}
|
||||||
|
|
||||||
\c void midend_serialise(midend *me,
|
\c void midend_serialise(midend *me,
|
||||||
|
10
midend.c
10
midend.c
@ -428,6 +428,16 @@ void midend_new_game(midend *me)
|
|||||||
me->pressed_mouse_button = 0;
|
me->pressed_mouse_button = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int midend_can_undo(midend *me)
|
||||||
|
{
|
||||||
|
return (me->statepos > 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int midend_can_redo(midend *me)
|
||||||
|
{
|
||||||
|
return (me->statepos < me->nstates);
|
||||||
|
}
|
||||||
|
|
||||||
static int midend_undo(midend *me)
|
static int midend_undo(midend *me)
|
||||||
{
|
{
|
||||||
if (me->statepos > 1) {
|
if (me->statepos > 1) {
|
||||||
|
@ -253,6 +253,8 @@ char *midend_get_game_id(midend *me);
|
|||||||
int midend_can_format_as_text_now(midend *me);
|
int midend_can_format_as_text_now(midend *me);
|
||||||
char *midend_text_format(midend *me);
|
char *midend_text_format(midend *me);
|
||||||
char *midend_solve(midend *me);
|
char *midend_solve(midend *me);
|
||||||
|
int midend_can_undo(midend *me);
|
||||||
|
int midend_can_redo(midend *me);
|
||||||
void midend_supersede_game_desc(midend *me, char *desc, char *privdesc);
|
void midend_supersede_game_desc(midend *me, char *desc, char *privdesc);
|
||||||
char *midend_rewrite_statusbar(midend *me, char *text);
|
char *midend_rewrite_statusbar(midend *me, char *text);
|
||||||
void midend_serialise(midend *me,
|
void midend_serialise(midend *me,
|
||||||
|
Reference in New Issue
Block a user