Cleanup: move run-time VFont enum out of DNA
This commit is contained in:
parent
39386175e1
commit
54e346f1d5
|
@ -68,6 +68,20 @@ typedef struct EditFont {
|
||||||
|
|
||||||
} EditFont;
|
} EditFont;
|
||||||
|
|
||||||
|
typedef enum eEditFontMode {
|
||||||
|
FO_EDIT = 0,
|
||||||
|
FO_CURS = 1,
|
||||||
|
FO_CURSUP = 2,
|
||||||
|
FO_CURSDOWN = 3,
|
||||||
|
FO_DUPLI = 4,
|
||||||
|
FO_PAGEUP = 8,
|
||||||
|
FO_PAGEDOWN = 9,
|
||||||
|
FO_SELCHANGE = 10,
|
||||||
|
} eEditFontMode;
|
||||||
|
|
||||||
|
/* BKE_vfont_to_curve will move the cursor in these cases */
|
||||||
|
#define FO_CURS_IS_MOTION(mode) (ELEM(mode, FO_CURSUP, FO_CURSDOWN, FO_PAGEUP, FO_PAGEDOWN))
|
||||||
|
|
||||||
bool BKE_vfont_is_builtin(const struct VFont *vfont);
|
bool BKE_vfont_is_builtin(const struct VFont *vfont);
|
||||||
void BKE_vfont_builtin_register(const void *mem, int size);
|
void BKE_vfont_builtin_register(const void *mem, int size);
|
||||||
|
|
||||||
|
@ -83,20 +97,20 @@ struct VFont *BKE_vfont_load_exists(struct Main *bmain, const char *filepath);
|
||||||
|
|
||||||
bool BKE_vfont_to_curve_ex(struct Object *ob,
|
bool BKE_vfont_to_curve_ex(struct Object *ob,
|
||||||
struct Curve *cu,
|
struct Curve *cu,
|
||||||
int mode,
|
eEditFontMode mode,
|
||||||
struct ListBase *r_nubase,
|
struct ListBase *r_nubase,
|
||||||
const char32_t **r_text,
|
const char32_t **r_text,
|
||||||
int *r_text_len,
|
int *r_text_len,
|
||||||
bool *r_text_free,
|
bool *r_text_free,
|
||||||
struct CharTrans **r_chartransdata);
|
struct CharTrans **r_chartransdata);
|
||||||
bool BKE_vfont_to_curve_nubase(struct Object *ob, int mode, struct ListBase *r_nubase);
|
bool BKE_vfont_to_curve_nubase(struct Object *ob, eEditFontMode mode, struct ListBase *r_nubase);
|
||||||
|
|
||||||
int BKE_vfont_cursor_to_text_index(struct Object *ob, float cursor_location[2]);
|
int BKE_vfont_cursor_to_text_index(struct Object *ob, float cursor_location[2]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \warning Expects to have access to evaluated data (i.e. passed object should be evaluated one).
|
* \warning Expects to have access to evaluated data (i.e. passed object should be evaluated one).
|
||||||
*/
|
*/
|
||||||
bool BKE_vfont_to_curve(struct Object *ob, int mode);
|
bool BKE_vfont_to_curve(struct Object *ob, eEditFontMode mode);
|
||||||
void BKE_vfont_build_char(struct Curve *cu,
|
void BKE_vfont_build_char(struct Curve *cu,
|
||||||
struct ListBase *nubase,
|
struct ListBase *nubase,
|
||||||
unsigned int character,
|
unsigned int character,
|
||||||
|
|
|
@ -792,7 +792,7 @@ static float vfont_descent(const VFontData *vfd)
|
||||||
|
|
||||||
static bool vfont_to_curve(Object *ob,
|
static bool vfont_to_curve(Object *ob,
|
||||||
Curve *cu,
|
Curve *cu,
|
||||||
int mode,
|
const eEditFontMode mode,
|
||||||
VFontToCurveIter *iter_data,
|
VFontToCurveIter *iter_data,
|
||||||
VFontCursor_Params *cursor_params,
|
VFontCursor_Params *cursor_params,
|
||||||
ListBase *r_nubase,
|
ListBase *r_nubase,
|
||||||
|
@ -1501,6 +1501,12 @@ static bool vfont_to_curve(Object *ob,
|
||||||
case FO_PAGEDOWN:
|
case FO_PAGEDOWN:
|
||||||
lnr = ct->linenr + 10;
|
lnr = ct->linenr + 10;
|
||||||
break;
|
break;
|
||||||
|
/* Ignored. */
|
||||||
|
case FO_EDIT:
|
||||||
|
case FO_CURS:
|
||||||
|
case FO_DUPLI:
|
||||||
|
case FO_SELCHANGE:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cnr = ct->charnr;
|
cnr = ct->charnr;
|
||||||
/* Seek for char with `lnr` & `cnr`. */
|
/* Seek for char with `lnr` & `cnr`. */
|
||||||
|
@ -1826,7 +1832,7 @@ finally:
|
||||||
|
|
||||||
bool BKE_vfont_to_curve_ex(Object *ob,
|
bool BKE_vfont_to_curve_ex(Object *ob,
|
||||||
Curve *cu,
|
Curve *cu,
|
||||||
int mode,
|
const eEditFontMode mode,
|
||||||
ListBase *r_nubase,
|
ListBase *r_nubase,
|
||||||
const char32_t **r_text,
|
const char32_t **r_text,
|
||||||
int *r_text_len,
|
int *r_text_len,
|
||||||
|
@ -1880,14 +1886,14 @@ int BKE_vfont_cursor_to_text_index(Object *ob, float cursor_location[2])
|
||||||
#undef FONT_TO_CURVE_SCALE_ITERATIONS
|
#undef FONT_TO_CURVE_SCALE_ITERATIONS
|
||||||
#undef FONT_TO_CURVE_SCALE_THRESHOLD
|
#undef FONT_TO_CURVE_SCALE_THRESHOLD
|
||||||
|
|
||||||
bool BKE_vfont_to_curve_nubase(Object *ob, int mode, ListBase *r_nubase)
|
bool BKE_vfont_to_curve_nubase(Object *ob, const eEditFontMode mode, ListBase *r_nubase)
|
||||||
{
|
{
|
||||||
BLI_assert(ob->type == OB_FONT);
|
BLI_assert(ob->type == OB_FONT);
|
||||||
|
|
||||||
return BKE_vfont_to_curve_ex(ob, ob->data, mode, r_nubase, NULL, NULL, NULL, NULL);
|
return BKE_vfont_to_curve_ex(ob, ob->data, mode, r_nubase, NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BKE_vfont_to_curve(Object *ob, int mode)
|
bool BKE_vfont_to_curve(Object *ob, const eEditFontMode mode)
|
||||||
{
|
{
|
||||||
Curve *cu = ob->data;
|
Curve *cu = ob->data;
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void text_update_edited(bContext *C, Object *obedit, int mode)
|
static void text_update_edited(bContext *C, Object *obedit, const eEditFontMode mode)
|
||||||
{
|
{
|
||||||
Curve *cu = obedit->data;
|
Curve *cu = obedit->data;
|
||||||
EditFont *ef = cu->editfont;
|
EditFont *ef = cu->editfont;
|
||||||
|
|
|
@ -34,19 +34,6 @@ typedef struct VFont {
|
||||||
struct PackedFile *temp_pf;
|
struct PackedFile *temp_pf;
|
||||||
} VFont;
|
} VFont;
|
||||||
|
|
||||||
/* *************** FONT ****************** */
|
|
||||||
#define FO_EDIT 0
|
|
||||||
#define FO_CURS 1
|
|
||||||
#define FO_CURSUP 2
|
|
||||||
#define FO_CURSDOWN 3
|
|
||||||
#define FO_DUPLI 4
|
|
||||||
#define FO_PAGEUP 8
|
|
||||||
#define FO_PAGEDOWN 9
|
|
||||||
#define FO_SELCHANGE 10
|
|
||||||
|
|
||||||
/* BKE_vfont_to_curve will move the cursor in these cases */
|
|
||||||
#define FO_CURS_IS_MOTION(mode) (ELEM(mode, FO_CURSUP, FO_CURSDOWN, FO_PAGEUP, FO_PAGEDOWN))
|
|
||||||
|
|
||||||
#define FO_BUILTIN_NAME "<builtin>"
|
#define FO_BUILTIN_NAME "<builtin>"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue