Blender  V3.3
Macros
editfont.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_text_types.h"
#include "DNA_vfont_types.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_vfont.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_curve.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "UI_interface.h"
#include "curve_intern.h"

Go to the source code of this file.

Macros

#define MAXTEXT   32766
 

Functions

Internal Utilities
static int kill_selection (Object *obedit, int ins)
 
static char32_t findaccent (char32_t char1, const char code)
 
static int insert_into_textbuf (Object *obedit, uintptr_t c)
 
static void text_update_edited (bContext *C, Object *obedit, int mode)
 
Generic Paste Functions
static bool font_paste_wchar (Object *obedit, const char32_t *str, const size_t str_len, struct CharInfo *str_info)
 
static bool font_paste_utf8 (bContext *C, const char *str, const size_t str_len)
 
Paste From File Operator
static int paste_from_file (bContext *C, ReportList *reports, const char *filepath)
 
static int paste_from_file_exec (bContext *C, wmOperator *op)
 
static int paste_from_file_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
void FONT_OT_text_paste_from_file (wmOperatorType *ot)
 
Text To Object
static void txt_add_object (bContext *C, const TextLine *firstline, int totline, const float offset[3])
 
void ED_text_to_object (bContext *C, const Text *text, const bool split_lines)
 
Toggle Style Operator
static int toggle_style_exec (bContext *C, wmOperator *op)
 
void FONT_OT_style_toggle (wmOperatorType *ot)
 
Select All Operator
static int font_select_all_exec (bContext *C, wmOperator *UNUSED(op))
 
void FONT_OT_select_all (wmOperatorType *ot)
 
Copy Text Operator
static void copy_selection (Object *obedit)
 
static int copy_text_exec (bContext *C, wmOperator *UNUSED(op))
 
void FONT_OT_text_copy (wmOperatorType *ot)
 
Cut Text Operator
static int cut_text_exec (bContext *C, wmOperator *UNUSED(op))
 
void FONT_OT_text_cut (wmOperatorType *ot)
 
Paste Text Operator
static bool paste_selection (Object *obedit, ReportList *reports)
 
static int paste_text_exec (bContext *C, wmOperator *op)
 
void FONT_OT_text_paste (wmOperatorType *ot)
 
Move Select Operator
static int move_select_exec (bContext *C, wmOperator *op)
 
void FONT_OT_move_select (wmOperatorType *ot)
 
Change Spacing
static int change_spacing_exec (bContext *C, wmOperator *op)
 
void FONT_OT_change_spacing (wmOperatorType *ot)
 
Change Character
static int change_character_exec (bContext *C, wmOperator *op)
 
void FONT_OT_change_character (wmOperatorType *ot)
 
Line Break Operator
static int line_break_exec (bContext *C, wmOperator *UNUSED(op))
 
void FONT_OT_line_break (wmOperatorType *ot)
 
Insert Text Operator
static int insert_text_exec (bContext *C, wmOperator *op)
 
static int insert_text_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void FONT_OT_text_insert (wmOperatorType *ot)
 
Text-Box Add Operator
static int textbox_add_exec (bContext *C, wmOperator *UNUSED(op))
 
void FONT_OT_textbox_add (wmOperatorType *ot)
 
Text-Box Remove Operator
static int textbox_remove_exec (bContext *C, wmOperator *op)
 
void FONT_OT_textbox_remove (wmOperatorType *ot)
 
Editmode Enter/Exit
void ED_curve_editfont_make (Object *obedit)
 
void ED_curve_editfont_load (Object *obedit)
 
void ED_curve_editfont_free (Object *obedit)
 
Toggle Case Operator
static int toggle_case_exec (bContext *C, wmOperator *UNUSED(op))
 
void FONT_OT_case_toggle (wmOperatorType *ot)
 
static void font_ui_template_init (bContext *C, wmOperator *op)
 
static void font_open_cancel (bContext *UNUSED(C), wmOperator *op)
 
static int font_open_exec (bContext *C, wmOperator *op)
 
static int open_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
void FONT_OT_open (wmOperatorType *ot)
 

Set Style Operator

static const EnumPropertyItem style_items []
 
static int set_style (bContext *C, const int style, const bool clear)
 
static int set_style_exec (bContext *C, wmOperator *op)
 
void FONT_OT_style_set (wmOperatorType *ot)
 

Move Operator

static const EnumPropertyItem move_type_items []
 
static int move_cursor (bContext *C, int type, const bool select)
 
static int move_exec (bContext *C, wmOperator *op)
 
void FONT_OT_move (wmOperatorType *ot)
 

Delete Operator

static const EnumPropertyItem delete_type_items []
 
static int delete_exec (bContext *C, wmOperator *op)
 
void FONT_OT_delete (wmOperatorType *ot)
 
static int font_unlink_exec (bContext *C, wmOperator *op)
 
void FONT_OT_unlink (wmOperatorType *ot)
 
bool ED_curve_editfont_select_pick (bContext *C, const int mval[2], const struct SelectPick_Params *params)
 

Set Case Operator

static const EnumPropertyItem case_items []
 
static int set_case (bContext *C, int ccase)
 
static int set_case_exec (bContext *C, wmOperator *op)
 
void FONT_OT_case_set (wmOperatorType *ot)
 

Macro Definition Documentation

◆ MAXTEXT

#define MAXTEXT   32766

Definition at line 54 of file editfont.c.

Function Documentation

◆ change_character_exec()

static int change_character_exec ( bContext C,
wmOperator op 
)
static

◆ change_spacing_exec()

static int change_spacing_exec ( bContext C,
wmOperator op 
)
static

◆ copy_selection()

static void copy_selection ( Object obedit)
static

◆ copy_text_exec()

static int copy_text_exec ( bContext C,
wmOperator UNUSEDop 
)
static

Definition at line 916 of file editfont.c.

References C, copy_selection(), CTX_data_edit_object(), and OPERATOR_FINISHED.

Referenced by FONT_OT_text_copy().

◆ cut_text_exec()

static int cut_text_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ delete_exec()

static int delete_exec ( bContext C,
wmOperator op 
)
static

◆ ED_curve_editfont_free()

void ED_curve_editfont_free ( Object obedit)

Definition at line 1903 of file editfont.c.

References BKE_curve_editfont_free(), and Object::data.

Referenced by ED_object_editmode_load_free_ex().

◆ ED_curve_editfont_load()

void ED_curve_editfont_load ( Object obedit)

◆ ED_curve_editfont_make()

void ED_curve_editfont_make ( Object obedit)

◆ ED_curve_editfont_select_pick()

bool ED_curve_editfont_select_pick ( struct bContext C,
const int  mval[2],
const struct SelectPick_Params params 
)

◆ ED_text_to_object()

void ED_text_to_object ( bContext C,
const Text text,
const bool  split_lines 
)

◆ findaccent()

static char32_t findaccent ( char32_t  char1,
const char  code 
)
static

Definition at line 62 of file editfont.c.

Referenced by insert_text_invoke().

◆ font_open_cancel()

static void font_open_cancel ( bContext UNUSEDC,
wmOperator op 
)
static

Definition at line 2033 of file editfont.c.

References wmOperator::customdata, MEM_freeN, and NULL.

Referenced by FONT_OT_open().

◆ font_open_exec()

static int font_open_exec ( bContext C,
wmOperator op 
)
static

◆ FONT_OT_case_set()

void FONT_OT_case_set ( wmOperatorType ot)

◆ FONT_OT_case_toggle()

void FONT_OT_case_toggle ( wmOperatorType ot)

◆ FONT_OT_change_character()

void FONT_OT_change_character ( wmOperatorType ot)

◆ FONT_OT_change_spacing()

void FONT_OT_change_spacing ( wmOperatorType ot)

◆ FONT_OT_delete()

void FONT_OT_delete ( wmOperatorType ot)

◆ FONT_OT_line_break()

void FONT_OT_line_break ( wmOperatorType ot)

◆ FONT_OT_move()

void FONT_OT_move ( wmOperatorType ot)

◆ FONT_OT_move_select()

void FONT_OT_move_select ( wmOperatorType ot)

◆ FONT_OT_open()

void FONT_OT_open ( wmOperatorType ot)

◆ FONT_OT_select_all()

void FONT_OT_select_all ( wmOperatorType ot)

◆ FONT_OT_style_set()

void FONT_OT_style_set ( wmOperatorType ot)

◆ FONT_OT_style_toggle()

void FONT_OT_style_toggle ( wmOperatorType ot)

◆ FONT_OT_text_copy()

void FONT_OT_text_copy ( wmOperatorType ot)

◆ FONT_OT_text_cut()

void FONT_OT_text_cut ( wmOperatorType ot)

◆ FONT_OT_text_insert()

void FONT_OT_text_insert ( wmOperatorType ot)

◆ FONT_OT_text_paste()

void FONT_OT_text_paste ( wmOperatorType ot)

◆ FONT_OT_text_paste_from_file()

void FONT_OT_text_paste_from_file ( wmOperatorType ot)

◆ FONT_OT_textbox_add()

void FONT_OT_textbox_add ( wmOperatorType ot)

◆ FONT_OT_textbox_remove()

void FONT_OT_textbox_remove ( wmOperatorType ot)

◆ FONT_OT_unlink()

void FONT_OT_unlink ( wmOperatorType ot)

◆ font_paste_utf8()

static bool font_paste_utf8 ( bContext C,
const char *  str,
const size_t  str_len 
)
static

◆ font_paste_wchar()

static bool font_paste_wchar ( Object obedit,
const char32_t *  str,
const size_t  str_len,
struct CharInfo str_info 
)
static

◆ font_select_all_exec()

static int font_select_all_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ font_ui_template_init()

static void font_ui_template_init ( bContext C,
wmOperator op 
)
static

◆ font_unlink_exec()

static int font_unlink_exec ( bContext C,
wmOperator op 
)
static

◆ insert_into_textbuf()

static int insert_into_textbuf ( Object obedit,
uintptr_t  c 
)
static

◆ insert_text_exec()

static int insert_text_exec ( bContext C,
wmOperator op 
)
static

◆ insert_text_invoke()

static int insert_text_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ kill_selection()

static int kill_selection ( Object obedit,
int  ins 
)
static

◆ line_break_exec()

static int line_break_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ move_cursor()

static int move_cursor ( bContext C,
int  type,
const bool  select 
)
static

◆ move_exec()

static int move_exec ( bContext C,
wmOperator op 
)
static

Definition at line 1223 of file editfont.c.

References C, move_cursor(), wmOperator::ptr, RNA_enum_get(), and type.

Referenced by FONT_OT_move().

◆ move_select_exec()

static int move_select_exec ( bContext C,
wmOperator op 
)
static

Definition at line 1254 of file editfont.c.

References C, move_cursor(), wmOperator::ptr, RNA_enum_get(), and type.

Referenced by FONT_OT_move_select().

◆ open_invoke()

static int open_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSEDevent 
)
static

◆ paste_from_file()

static int paste_from_file ( bContext C,
ReportList reports,
const char *  filepath 
)
static

◆ paste_from_file_exec()

static int paste_from_file_exec ( bContext C,
wmOperator op 
)
static

◆ paste_from_file_invoke()

static int paste_from_file_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSEDevent 
)
static

◆ paste_selection()

static bool paste_selection ( Object obedit,
ReportList reports 
)
static

Definition at line 981 of file editfont.c.

References BKE_report(), BKE_vfont_clipboard_get(), font_paste_wchar(), len, NULL, and RPT_WARNING.

Referenced by paste_text_exec().

◆ paste_text_exec()

static int paste_text_exec ( bContext C,
wmOperator op 
)
static

◆ set_case()

static int set_case ( bContext C,
int  ccase 
)
static

◆ set_case_exec()

static int set_case_exec ( bContext C,
wmOperator op 
)
static

Definition at line 1958 of file editfont.c.

References C, wmOperator::ptr, RNA_enum_get(), and set_case().

Referenced by FONT_OT_case_set().

◆ set_style()

static int set_style ( bContext C,
const int  style,
const bool  clear 
)
static

◆ set_style_exec()

static int set_style_exec ( bContext C,
wmOperator op 
)
static

Definition at line 774 of file editfont.c.

References C, clear(), wmOperator::ptr, RNA_boolean_get(), RNA_enum_get(), and set_style().

Referenced by FONT_OT_style_set().

◆ text_update_edited()

static void text_update_edited ( bContext C,
Object obedit,
int  mode 
)
static

◆ textbox_add_exec()

static int textbox_add_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ textbox_remove_exec()

static int textbox_remove_exec ( bContext C,
wmOperator op 
)
static

◆ toggle_case_exec()

static int toggle_case_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ toggle_style_exec()

static int toggle_style_exec ( bContext C,
wmOperator op 
)
static

◆ txt_add_object()

static void txt_add_object ( bContext C,
const TextLine firstline,
int  totline,
const float  offset[3] 
)
static

Variable Documentation

◆ case_items

const EnumPropertyItem case_items[]
static
Initial value:
= {
{CASE_LOWER, "LOWER", 0, "Lower", ""},
{CASE_UPPER, "UPPER", 0, "Upper", ""},
{0, NULL, 0, NULL, NULL},
}
@ CASE_LOWER
Definition: curve_intern.h:29
@ CASE_UPPER
Definition: curve_intern.h:29

Definition at line 1914 of file editfont.c.

Referenced by FONT_OT_case_set().

◆ delete_type_items

const EnumPropertyItem delete_type_items[]
static
Initial value:
= {
{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{DEL_SELECTION, "SELECTION", 0, "Selection", ""},
{DEL_NEXT_SEL, "NEXT_OR_SELECTION", 0, "Next or Selection", ""},
{DEL_PREV_SEL, "PREVIOUS_OR_SELECTION", 0, "Previous or Selection", ""},
{0, NULL, 0, NULL, NULL},
}
@ DEL_SELECTION
Definition: curve_intern.h:25
@ DEL_PREV_WORD
Definition: curve_intern.h:24
@ DEL_PREV_SEL
Definition: curve_intern.h:27
@ DEL_PREV_CHAR
Definition: curve_intern.h:22
@ DEL_NEXT_WORD
Definition: curve_intern.h:23
@ DEL_NEXT_CHAR
Definition: curve_intern.h:21
@ DEL_NEXT_SEL
Definition: curve_intern.h:26

Definition at line 1452 of file editfont.c.

Referenced by FONT_OT_delete().

◆ move_type_items

const EnumPropertyItem move_type_items[]
static
Initial value:
= {
{LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
{LINE_END, "LINE_END", 0, "Line End", ""},
{PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{PREV_LINE, "PREVIOUS_LINE", 0, "Previous Line", ""},
{NEXT_LINE, "NEXT_LINE", 0, "Next Line", ""},
{PREV_PAGE, "PREVIOUS_PAGE", 0, "Previous Page", ""},
{NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""},
{0, NULL, 0, NULL, NULL},
}
#define NEXT_CHAR(fmt)
@ NEXT_LINE
Definition: curve_intern.h:38
@ LINE_BEGIN
Definition: curve_intern.h:31
@ PREV_WORD
Definition: curve_intern.h:35
@ PREV_LINE
Definition: curve_intern.h:37
@ PREV_CHAR
Definition: curve_intern.h:33
@ LINE_END
Definition: curve_intern.h:32
@ PREV_PAGE
Definition: curve_intern.h:39
@ NEXT_PAGE
Definition: curve_intern.h:40
@ NEXT_WORD
Definition: curve_intern.h:36

Definition at line 1084 of file editfont.c.

Referenced by FONT_OT_move(), and FONT_OT_move_select().

◆ style_items

const EnumPropertyItem style_items[]
static
Initial value:
= {
{CU_CHINFO_BOLD, "BOLD", 0, "Bold", ""},
{CU_CHINFO_ITALIC, "ITALIC", 0, "Italic", ""},
{CU_CHINFO_UNDERLINE, "UNDERLINE", 0, "Underline", ""},
{CU_CHINFO_SMALLCAPS, "SMALL_CAPS", 0, "Small Caps", ""},
{0, NULL, 0, NULL, NULL},
}
@ CU_CHINFO_UNDERLINE
@ CU_CHINFO_BOLD
@ CU_CHINFO_ITALIC
@ CU_CHINFO_SMALLCAPS

Definition at line 740 of file editfont.c.

Referenced by FONT_OT_style_set(), and FONT_OT_style_toggle().