Cleanup: use doxy sections for text operators
This commit is contained in:
@@ -61,7 +61,9 @@
|
||||
|
||||
static void txt_screen_clamp(SpaceText *st, ARegion *ar);
|
||||
|
||||
/************************ util ***************************/
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Util
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Tests if the given character represents a start of a new line or the
|
||||
@@ -138,14 +140,18 @@ static char *buf_tabs_to_spaces(const char *in_buf, const int tab_size)
|
||||
return out_buf;
|
||||
}
|
||||
|
||||
/************************ poll ***************************/
|
||||
|
||||
BLI_INLINE int text_pixel_x_to_column(SpaceText *st, const int x)
|
||||
{
|
||||
/* add half the char width so mouse cursor selection is inbetween letters */
|
||||
return (x + (st->cwidth / 2)) / st->cwidth;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Operator Poll
|
||||
* \{ */
|
||||
|
||||
static bool text_new_poll(bContext *UNUSED(C))
|
||||
{
|
||||
return 1;
|
||||
@@ -206,7 +212,11 @@ static bool text_region_edit_poll(bContext *C)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/********************** updates *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Updates
|
||||
* \{ */
|
||||
|
||||
void text_update_line_edited(TextLine *line)
|
||||
{
|
||||
@@ -230,7 +240,11 @@ void text_update_edited(Text *text)
|
||||
}
|
||||
}
|
||||
|
||||
/******************* new operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name New Operator
|
||||
* \{ */
|
||||
|
||||
static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -281,7 +295,11 @@ void TEXT_OT_new(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* open operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Open Operator
|
||||
* \{ */
|
||||
|
||||
static void text_open_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -392,7 +410,11 @@ void TEXT_OT_open(wmOperatorType *ot)
|
||||
ot->srna, "internal", 0, "Make internal", "Make text file internal after loading");
|
||||
}
|
||||
|
||||
/******************* reload operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Reload Operator
|
||||
* \{ */
|
||||
|
||||
static int text_reload_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -443,7 +465,11 @@ void TEXT_OT_reload(wmOperatorType *ot)
|
||||
ot->poll = text_edit_poll;
|
||||
}
|
||||
|
||||
/******************* delete operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Delete Operator
|
||||
* \{ */
|
||||
|
||||
static bool text_unlink_poll(bContext *C)
|
||||
{
|
||||
@@ -495,7 +521,11 @@ void TEXT_OT_unlink(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* make internal operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Make Internal Operator
|
||||
* \{ */
|
||||
|
||||
static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -529,7 +559,11 @@ void TEXT_OT_make_internal(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* save operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Save Operator
|
||||
* \{ */
|
||||
|
||||
static bool text_save_poll(bContext *C)
|
||||
{
|
||||
@@ -614,7 +648,11 @@ void TEXT_OT_save(wmOperatorType *ot)
|
||||
ot->poll = text_save_poll;
|
||||
}
|
||||
|
||||
/******************* save as operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Save As Operator
|
||||
* \{ */
|
||||
|
||||
static int text_save_as_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -690,7 +728,11 @@ void TEXT_OT_save_as(wmOperatorType *ot)
|
||||
FILE_SORT_ALPHA); // XXX TODO, relative_path
|
||||
}
|
||||
|
||||
/******************* run script operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Run Script Operator
|
||||
* \{ */
|
||||
|
||||
static bool text_run_script_poll(bContext *C)
|
||||
{
|
||||
@@ -765,7 +807,11 @@ void TEXT_OT_run_script(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* refresh pyconstraints operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Refresh Pyconstraints Operator
|
||||
* \{ */
|
||||
|
||||
static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -825,7 +871,11 @@ void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
|
||||
ot->poll = text_edit_poll;
|
||||
}
|
||||
|
||||
/******************* paste operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Paste Operator
|
||||
* \{ */
|
||||
|
||||
static int text_paste_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -889,7 +939,11 @@ void TEXT_OT_paste(wmOperatorType *ot)
|
||||
"Paste text selected elsewhere rather than copied (X11 only)");
|
||||
}
|
||||
|
||||
/**************** duplicate operator *******************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Duplicate Operator
|
||||
* \{ */
|
||||
|
||||
static int text_duplicate_line_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -924,7 +978,11 @@ void TEXT_OT_duplicate_line(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* copy operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Copy Operator
|
||||
* \{ */
|
||||
|
||||
static void txt_copy_clipboard(Text *text)
|
||||
{
|
||||
@@ -963,7 +1021,11 @@ void TEXT_OT_copy(wmOperatorType *ot)
|
||||
ot->poll = text_edit_poll;
|
||||
}
|
||||
|
||||
/******************* cut operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Cut Operator
|
||||
* \{ */
|
||||
|
||||
static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1002,7 +1064,11 @@ void TEXT_OT_cut(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* indent operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Indent Operator
|
||||
* \{ */
|
||||
|
||||
static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1043,7 +1109,11 @@ void TEXT_OT_indent(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* unindent operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Unindent Operator
|
||||
* \{ */
|
||||
|
||||
static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1079,7 +1149,11 @@ void TEXT_OT_unindent(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* line break operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Line Break Operator
|
||||
* \{ */
|
||||
|
||||
static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1132,7 +1206,11 @@ void TEXT_OT_line_break(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* comment operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Comment Operator
|
||||
* \{ */
|
||||
|
||||
static int text_comment_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1170,7 +1248,11 @@ void TEXT_OT_comment(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* uncomment operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Uncomment Operator
|
||||
* \{ */
|
||||
|
||||
static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1209,7 +1291,11 @@ void TEXT_OT_uncomment(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* convert whitespace operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Convert Whitespace Operator
|
||||
* \{ */
|
||||
|
||||
enum { TO_SPACES, TO_TABS };
|
||||
static const EnumPropertyItem whitespace_type_items[] = {
|
||||
@@ -1360,7 +1446,11 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot)
|
||||
"Type of whitespace to convert to");
|
||||
}
|
||||
|
||||
/******************* select all operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Select All Operator
|
||||
* \{ */
|
||||
|
||||
static int text_select_all_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1386,7 +1476,11 @@ void TEXT_OT_select_all(wmOperatorType *ot)
|
||||
ot->poll = text_edit_poll;
|
||||
}
|
||||
|
||||
/******************* select line operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Select Line Operator
|
||||
* \{ */
|
||||
|
||||
static int text_select_line_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1412,7 +1506,11 @@ void TEXT_OT_select_line(wmOperatorType *ot)
|
||||
ot->poll = text_edit_poll;
|
||||
}
|
||||
|
||||
/******************* select word operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Select Word Operator
|
||||
* \{ */
|
||||
|
||||
static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -1441,7 +1539,11 @@ void TEXT_OT_select_word(wmOperatorType *ot)
|
||||
ot->poll = text_edit_poll;
|
||||
}
|
||||
|
||||
/********************* move lines operators ***********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Move Lines Operators
|
||||
* \{ */
|
||||
|
||||
static int move_lines_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -1487,7 +1589,11 @@ void TEXT_OT_move_lines(wmOperatorType *ot)
|
||||
RNA_def_enum(ot->srna, "direction", direction_items, 1, "Direction", "");
|
||||
}
|
||||
|
||||
/************************ move operator ************************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Move Operator
|
||||
* \{ */
|
||||
|
||||
static const EnumPropertyItem move_type_items[] = {
|
||||
{LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
|
||||
@@ -2126,7 +2232,11 @@ void TEXT_OT_move(wmOperatorType *ot)
|
||||
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
|
||||
}
|
||||
|
||||
/******************* move select operator ********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Move Select Operator
|
||||
* \{ */
|
||||
|
||||
static int text_move_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -2155,7 +2265,11 @@ void TEXT_OT_move_select(wmOperatorType *ot)
|
||||
"Where to move cursor to, to make a selection");
|
||||
}
|
||||
|
||||
/******************* jump operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Jump Operator
|
||||
* \{ */
|
||||
|
||||
static int text_jump_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -2203,7 +2317,11 @@ void TEXT_OT_jump(wmOperatorType *ot)
|
||||
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_TEXT);
|
||||
}
|
||||
|
||||
/******************* delete operator **********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Delete Operator
|
||||
* \{ */
|
||||
|
||||
static const EnumPropertyItem delete_type_items[] = {
|
||||
{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
|
||||
@@ -2317,7 +2435,11 @@ void TEXT_OT_delete(wmOperatorType *ot)
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
/******************* toggle overwrite operator **********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Toggle Overwrite Operator
|
||||
* \{ */
|
||||
|
||||
static int text_toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -2342,7 +2464,11 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
|
||||
ot->poll = text_space_edit_poll;
|
||||
}
|
||||
|
||||
/******************* scroll operator **********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Scroll Operator
|
||||
* \{ */
|
||||
|
||||
static void txt_screen_clamp(SpaceText *st, ARegion *ar)
|
||||
{
|
||||
@@ -2571,7 +2697,11 @@ void TEXT_OT_scroll(wmOperatorType *ot)
|
||||
ot->srna, "lines", 1, INT_MIN, INT_MAX, "Lines", "Number of lines to scroll", -100, 100);
|
||||
}
|
||||
|
||||
/******************** scroll bar operator *******************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Scroll Bar Operator
|
||||
* \{ */
|
||||
|
||||
static bool text_region_scroll_poll(bContext *C)
|
||||
{
|
||||
@@ -3073,7 +3203,11 @@ void TEXT_OT_selection_set(wmOperatorType *ot)
|
||||
RNA_def_boolean(ot->srna, "select", 0, "Select", "Set selection end rather than cursor");
|
||||
}
|
||||
|
||||
/******************* set cursor operator **********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Set Cursor Operator
|
||||
* \{ */
|
||||
|
||||
static int text_cursor_set_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -3121,7 +3255,11 @@ void TEXT_OT_cursor_set(wmOperatorType *ot)
|
||||
RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX);
|
||||
}
|
||||
|
||||
/******************* line number operator **********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Line Number Operator
|
||||
* \{ */
|
||||
|
||||
static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
|
||||
{
|
||||
@@ -3177,7 +3315,11 @@ void TEXT_OT_line_number(wmOperatorType *ot)
|
||||
ot->poll = text_region_edit_poll;
|
||||
}
|
||||
|
||||
/******************* insert operator **********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Insert Operator
|
||||
* \{ */
|
||||
|
||||
static int text_insert_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -3284,7 +3426,11 @@ void TEXT_OT_insert(wmOperatorType *ot)
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
/******************* find operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Find Operator
|
||||
* \{ */
|
||||
|
||||
/* mode */
|
||||
#define TEXT_FIND 0
|
||||
@@ -3378,7 +3524,11 @@ void TEXT_OT_find(wmOperatorType *ot)
|
||||
ot->poll = text_space_edit_poll;
|
||||
}
|
||||
|
||||
/******************* replace operator *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Replace Operator
|
||||
* \{ */
|
||||
|
||||
static int text_replace_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -3400,7 +3550,11 @@ void TEXT_OT_replace(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/******************* find set selected *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Find Set Selected
|
||||
* \{ */
|
||||
|
||||
static int text_find_set_selected_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -3431,7 +3585,11 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot)
|
||||
ot->poll = text_space_edit_poll;
|
||||
}
|
||||
|
||||
/******************* replace set selected *********************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Replace Set Selected
|
||||
* \{ */
|
||||
|
||||
static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
@@ -3461,7 +3619,11 @@ void TEXT_OT_replace_set_selected(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/****************** resolve conflict operator ******************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Resolve Conflict Operator
|
||||
* \{ */
|
||||
|
||||
enum { RESOLVE_IGNORE, RESOLVE_RELOAD, RESOLVE_SAVE, RESOLVE_MAKE_INTERNAL };
|
||||
static const EnumPropertyItem resolution_items[] = {
|
||||
@@ -3574,7 +3736,11 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot)
|
||||
"How to solve conflict due to differences in internal and external text");
|
||||
}
|
||||
|
||||
/********************** to 3d object operator *****************/
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name To 3D Object Operator
|
||||
* \{ */
|
||||
|
||||
static int text_to_3d_object_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -3604,3 +3770,5 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot)
|
||||
RNA_def_boolean(
|
||||
ot->srna, "split_lines", 0, "Split Lines", "Create one object per line in the text");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user