Blender  V3.3
Classes
interface_undo.c File Reference
#include <string.h>
#include "BLI_listbase.h"
#include "DNA_listBase.h"
#include "MEM_guardedalloc.h"
#include "interface_intern.h"

Go to the source code of this file.

Classes

struct  uiUndoStack_Text_State
 
struct  uiUndoStack_Text
 

Text Field Undo Stack

typedef struct uiUndoStack_Text_State uiUndoStack_Text_State
 
typedef struct uiUndoStack_Text uiUndoStack_Text
 
static const char * ui_textedit_undo_impl (uiUndoStack_Text *stack, int *r_cursor_index)
 
static const char * ui_textedit_redo_impl (uiUndoStack_Text *stack, int *r_cursor_index)
 
const char * ui_textedit_undo (uiUndoStack_Text *stack, int direction, int *r_cursor_index)
 
void ui_textedit_undo_push (uiUndoStack_Text *stack, const char *text, int cursor_index)
 
uiUndoStack_Textui_textedit_undo_stack_create (void)
 
void ui_textedit_undo_stack_destroy (uiUndoStack_Text *stack)
 

Detailed Description

Undo stack to use for UI widgets that manage their own editing state.

Definition in file interface_undo.c.

Typedef Documentation

◆ uiUndoStack_Text

◆ uiUndoStack_Text_State

Function Documentation

◆ ui_textedit_redo_impl()

static const char* ui_textedit_redo_impl ( uiUndoStack_Text stack,
int *  r_cursor_index 
)
static

◆ ui_textedit_undo()

const char* ui_textedit_undo ( uiUndoStack_Text stack,
int  direction,
int *  r_cursor_index 
)

Definition at line 69 of file interface_undo.c.

References BLI_assert, ELEM, ui_textedit_redo_impl(), and ui_textedit_undo_impl().

Referenced by ui_do_but_textedit().

◆ ui_textedit_undo_impl()

static const char* ui_textedit_undo_impl ( uiUndoStack_Text stack,
int *  r_cursor_index 
)
static

◆ ui_textedit_undo_push()

void ui_textedit_undo_push ( struct uiUndoStack_Text undo_stack,
const char *  text,
int  cursor_index 
)

Push the information in the arguments to a new state in the undo stack.

Note
Currently the total length of the undo stack is not limited.

Definition at line 78 of file interface_undo.c.

References BLI_addtail(), BLI_remlink(), uiUndoStack_Text::current, uiUndoStack_Text_State::cursor_index, MEM_freeN, MEM_mallocN, uiUndoStack_Text_State::next, NULL, state, uiUndoStack_Text::states, and uiUndoStack_Text_State::text.

Referenced by ui_do_but_textedit(), and ui_textedit_begin().

◆ ui_textedit_undo_stack_create()

uiUndoStack_Text* ui_textedit_undo_stack_create ( void  )

Start the undo stack.

Note
The current state should be pushed immediately after calling this.

Definition at line 97 of file interface_undo.c.

References BLI_listbase_clear(), uiUndoStack_Text::current, MEM_mallocN, NULL, and uiUndoStack_Text::states.

Referenced by ui_textedit_begin().

◆ ui_textedit_undo_stack_destroy()

void ui_textedit_undo_stack_destroy ( uiUndoStack_Text stack)

Definition at line 106 of file interface_undo.c.

References BLI_freelistN(), MEM_freeN, and uiUndoStack_Text::states.

Referenced by ui_textedit_end().