code cleanup: favor braces when blocks have mixed brace use.
[blender.git] / source / blender / editors / space_text / text_ops.c
index ae5de4c..e6f95c3 100644 (file)
  */
 
 
-#include <stdlib.h>
 #include <string.h>
-#include <ctype.h> /* ispunct */
-#include <sys/stat.h>
 #include <errno.h>
 
 #include "MEM_guardedalloc.h"
 
 #include "DNA_text_types.h"
-#include "DNA_userdef_types.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
 
 #include "BLF_translation.h"
 
@@ -72,6 +67,7 @@
 #endif
 
 #include "text_intern.h"
+#include "text_format.h"
 
 /************************ poll ***************************/
 
@@ -102,7 +98,7 @@ static int text_edit_poll(bContext *C)
        return 1;
 }
 
-static int text_space_edit_poll(bContext *C)
+int text_space_edit_poll(bContext *C)
 {
        SpaceText *st = CTX_wm_space_text(C);
        Text *text = CTX_data_edit_text(C);
@@ -165,11 +161,12 @@ void text_update_edited(Text *text)
 static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
 {
        SpaceText *st = CTX_wm_space_text(C);
+       Main *bmain = CTX_data_main(C);
        Text *text;
        PointerRNA ptr, idptr;
        PropertyRNA *prop;
 
-       text = BKE_text_add("Text");
+       text = BKE_text_add(bmain, "Text");
 
        /* hook into UI */
        uiIDContextProperty(C, &ptr, &prop);
@@ -230,6 +227,7 @@ static int text_open_cancel(bContext *UNUSED(C), wmOperator *op)
 static int text_open_exec(bContext *C, wmOperator *op)
 {
        SpaceText *st = CTX_wm_space_text(C);
+       Main *bmain = CTX_data_main(C);
        Text *text;
        PropertyPointerRNA *pprop;
        PointerRNA idptr;
@@ -238,7 +236,7 @@ static int text_open_exec(bContext *C, wmOperator *op)
 
        RNA_string_get(op->ptr, "filepath", str);
 
-       text = BKE_text_load(str, G.main->name);
+       text = BKE_text_load(bmain, str, G.main->name);
 
        if (!text) {
                if (op->customdata) MEM_freeN(op->customdata);
@@ -615,6 +613,8 @@ static int text_run_script(bContext *C, ReportList *reports)
                }
 
                BKE_report(reports, RPT_ERROR, "Python script fail, look in the console for now...");
+
+               return OPERATOR_FINISHED;
        }
 #else
        (void)C;
@@ -1129,21 +1129,20 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
        TextLine *tmp;
        FlattenString fs;
        size_t a, j;
-       char *text_check_line, *new_line;
+       char *new_line;
        int extra, number; //unknown for now
        int type = RNA_enum_get(op->ptr, "type");
-       
-       tmp = text->lines.first;
-       
+
        /* first convert to all space, this make it a lot easier to convert to tabs
         * because there is no mixtures of ' ' && '\t' */
-       while (tmp) {
-               text_check_line = tmp->line;
+       for (tmp = text->lines.first; tmp; tmp = tmp->next) {
+               const char *text_check_line     = tmp->line;
+               const int   text_check_line_len = tmp->len;
                number = flatten_string(st, &fs, text_check_line) + 1;
                flatten_string_free(&fs);
                new_line = MEM_callocN(number, "Converted_Line");
                j = 0;
-               for (a = 0; a < strlen(text_check_line); a++) { //foreach char in line
+               for (a = 0; a < text_check_line_len; a++) { //foreach char in line
                        if (text_check_line[a] == '\t') { //checking for tabs
                                //get the number of spaces this tabs is showing
                                //i don't like doing it this way but will look into it later
@@ -1173,20 +1172,19 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
                tmp->line = new_line;
                tmp->len = strlen(new_line);
                tmp->format = NULL;
-               tmp = tmp->next;
        }
        
        if (type == TO_TABS) { // Converting to tabs
                //start over from the beginning
-               tmp = text->lines.first;
                
-               while (tmp) {
-                       text_check_line = tmp->line;
+               for (tmp = text->lines.first; tmp; tmp = tmp->next) {
+                       const char *text_check_line     = tmp->line;
+                       const int   text_check_line_len = tmp->len;
                        extra = 0;
-                       for (a = 0; a < strlen(text_check_line); a++) {
+                       for (a = 0; a < text_check_line_len; a++) {
                                number = 0;
                                for (j = 0; j < (size_t)st->tabnumber; j++) {
-                                       if ((a + j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
+                                       if ((a + j) <= text_check_line_len) { //check to make sure we are not pass the end of the line
                                                if (text_check_line[a + j] != ' ') {
                                                        number = 1;
                                                }
@@ -1199,12 +1197,12 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
                        }
                        
                        if (extra > 0) {   //got tabs make malloc and do what you have to do
-                               new_line = MEM_callocN(strlen(text_check_line) - (((st->tabnumber * extra) - extra) - 1), "Converted_Line");
+                               new_line = MEM_callocN(text_check_line_len - (((st->tabnumber * extra) - extra) - 1), "Converted_Line");
                                extra = 0; //reuse vars
-                               for (a = 0; a < strlen(text_check_line); a++) {
+                               for (a = 0; a < text_check_line_len; a++) {
                                        number = 0;
                                        for (j = 0; j < (size_t)st->tabnumber; j++) {
-                                               if ((a + j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
+                                               if ((a + j) <= text_check_line_len) { //check to make sure we are not pass the end of the line
                                                        if (text_check_line[a + j] != ' ') {
                                                                number = 1;
                                                        }
@@ -1231,7 +1229,6 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
                                tmp->len = strlen(new_line);
                                tmp->format = NULL;
                        }
-                       tmp = tmp->next;
                }
        }
 
@@ -1315,9 +1312,11 @@ void TEXT_OT_select_line(wmOperatorType *ot)
 static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Text *text = CTX_data_edit_text(C);
+       /* don't advance cursor before stepping */
+       const bool use_init_step = false;
 
-       txt_jump_left(text, 0);
-       txt_jump_right(text, 1);
+       txt_jump_left(text, false, use_init_step);
+       txt_jump_right(text, true, use_init_step);
 
        text_update_cursor_moved(C);
        WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
@@ -1377,104 +1376,6 @@ void TEXT_OT_move_lines(wmOperatorType *ot)
        RNA_def_enum(ot->srna, "direction", direction_items, 1, "Direction", "");
 }
 
-/******************* previous marker operator *********************/
-
-static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       Text *text = CTX_data_edit_text(C);
-       TextMarker *mrk;
-       int lineno;
-
-       lineno = txt_get_span(text->lines.first, text->curl);
-       mrk = text->markers.last;
-       while (mrk && (mrk->lineno > lineno || (mrk->lineno == lineno && mrk->end > text->curc)))
-               mrk = mrk->prev;
-       if (!mrk) mrk = text->markers.last;
-       if (mrk) {
-               txt_move_to(text, mrk->lineno, mrk->start, 0);
-               txt_move_to(text, mrk->lineno, mrk->end, 1);
-       }
-
-       text_update_cursor_moved(C);
-       WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
-       return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_previous_marker(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name = "Previous Marker";
-       ot->idname = "TEXT_OT_previous_marker";
-       ot->description = "Move to previous marker";
-       
-       /* api callbacks */
-       ot->exec = text_previous_marker_exec;
-       ot->poll = text_edit_poll;
-}
-
-/******************* next marker operator *********************/
-
-static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       Text *text = CTX_data_edit_text(C);
-       TextMarker *mrk;
-       int lineno;
-
-       lineno = txt_get_span(text->lines.first, text->curl);
-       mrk = text->markers.first;
-       while (mrk && (mrk->lineno < lineno || (mrk->lineno == lineno && mrk->start <= text->curc)))
-               mrk = mrk->next;
-       if (!mrk) mrk = text->markers.first;
-       if (mrk) {
-               txt_move_to(text, mrk->lineno, mrk->start, 0);
-               txt_move_to(text, mrk->lineno, mrk->end, 1);
-       }
-
-       text_update_cursor_moved(C);
-       WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
-       return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_next_marker(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name = "Next Marker";
-       ot->idname = "TEXT_OT_next_marker";
-       ot->description = "Move to next marker";
-       
-       /* api callbacks */
-       ot->exec = text_next_marker_exec;
-       ot->poll = text_edit_poll;
-}
-
-/******************* clear all markers operator *********************/
-
-static int text_clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       Text *text = CTX_data_edit_text(C);
-
-       txt_clear_markers(text, 0, 0);
-
-       text_update_cursor_moved(C);
-       WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
-       return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_markers_clear(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name = "Clear All Markers";
-       ot->idname = "TEXT_OT_markers_clear";
-       ot->description = "Clear all markers";
-       
-       /* api callbacks */
-       ot->exec = text_clear_all_markers_exec;
-       ot->poll = text_edit_poll;
-}
-
 /************************ move operator ************************/
 
 static EnumPropertyItem move_type_items[] = {
@@ -1512,7 +1413,9 @@ static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int
                        chars = st->tabnumber - i % st->tabnumber;
                        ch = ' ';
                }
-               else chars = 1;
+               else {
+                       chars = 1;
+               }
 
                while (chars--) {
                        if (rell == 0 && i - start == relc) {
@@ -1690,7 +1593,9 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
                        chars = st->tabnumber - i % st->tabnumber;
                        ch = ' ';
                }
-               else chars = 1;
+               else {
+                       chars = 1;
+               }
 
                while (chars--) {
                        if (i - start >= max) {
@@ -1756,7 +1661,9 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
                        chars = st->tabnumber - i % st->tabnumber;
                        ch = ' ';
                }
-               else chars = 1;
+               else {
+                       chars = 1;
+               }
 
                while (chars--) {
                        if (i - start >= max) {
@@ -1815,7 +1722,9 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel)
                        visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
                        *charp = text_get_cursor_rel(st, ar, *linep, visible_lines - 1, col);
                }
-               else *charp = 0;
+               else {
+                       *charp = 0;
+               }
        }
 
        if (!sel) txt_pop_sel(text);
@@ -1844,7 +1753,9 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel)
                        *linep = (*linep)->next;
                        *charp = text_get_cursor_rel(st, ar, *linep, 0, col);
                }
-               else *charp = (*linep)->len;
+               else {
+                       *charp = (*linep)->len;
+               }
        }
 
        if (!sel) txt_pop_sel(text);
@@ -1917,11 +1828,11 @@ static int text_move_cursor(bContext *C, int type, int select)
                        break;
 
                case PREV_WORD:
-                       txt_jump_left(text, select);
+                       txt_jump_left(text, select, true);
                        break;
 
                case NEXT_WORD:
-                       txt_jump_right(text, select);
+                       txt_jump_right(text, select, true);
                        break;
 
                case PREV_CHAR:
@@ -2028,12 +1939,14 @@ static int text_jump_exec(bContext *C, wmOperator *op)
 
 static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-       return WM_operator_props_dialog_popup(C, op, 200, 100);
+       return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 5 * UI_UNIT_Y);
 
 }
 
 void TEXT_OT_jump(wmOperatorType *ot)
 {
+       PropertyRNA *prop;
+
        /* identifiers */
        ot->name = "Jump";
        ot->idname = "TEXT_OT_jump";
@@ -2045,7 +1958,8 @@ void TEXT_OT_jump(wmOperatorType *ot)
        ot->poll = text_edit_poll;
 
        /* properties */
-       RNA_def_int(ot->srna, "line", 1, 1, INT_MAX, "Line", "Line number to jump to", 1, 10000);
+       prop = RNA_def_int(ot->srna, "line", 1, 1, INT_MAX, "Line", "Line number to jump to", 1, 10000);
+       RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_TEXT);
 }
 
 /******************* delete operator **********************/
@@ -2202,10 +2116,10 @@ static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
 
        if (!tsc->scrollbar) {
                txtdelta[0] = -tsc->delta[0] / st->cwidth;
-               txtdelta[1] = tsc->delta[1] / (st->lheight + TXT_LINE_SPACING);
+               txtdelta[1] = tsc->delta[1] / (st->lheight_dpi + TXT_LINE_SPACING);
 
                tsc->delta[0] %= st->cwidth;
-               tsc->delta[1] %= (st->lheight + TXT_LINE_SPACING);
+               tsc->delta[1] %= (st->lheight_dpi + TXT_LINE_SPACING);
        }
        else {
                txtdelta[1] = -tsc->delta[1] * st->pix_per_line;
@@ -2300,7 +2214,7 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
                tsc->old[1] = event->y;
                /* Sensitivity of scroll set to 4pix per line/char */
                tsc->delta[0] = (event->x - event->prevx) * st->cwidth / 4;
-               tsc->delta[1] = (event->y - event->prevy) * st->lheight / 4;
+               tsc->delta[1] = (event->y - event->prevy) * st->lheight_dpi / 4;
                tsc->first = 0;
                tsc->scrollbar = 0;
                text_scroll_apply(C, op, event);
@@ -2446,7 +2360,9 @@ static int flatten_len(SpaceText *st, const char *str)
                if (str[i] == '\t') {
                        total += st->tabnumber - total % st->tabnumber;
                }
-               else total++;
+               else {
+                       total++;
+               }
        }
        
        return total;
@@ -2508,7 +2424,9 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
                                chars = st->tabnumber - i % st->tabnumber;
                                ch = ' ';
                        }
-                       else chars = 1;
+                       else {
+                               chars = 1;
+                       }
                        
                        while (chars--) {
                                /* Gone too far, go back to last wrap point */
@@ -2599,7 +2517,7 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int
 {
        Text *text = st->text;
        text_update_character_width(st);
-       y = (ar->winy - 2 - y) / (st->lheight + TXT_LINE_SPACING);
+       y = (ar->winy - 2 - y) / (st->lheight_dpi + TXT_LINE_SPACING);
 
        if (st->showlinenrs) x -= TXT_OFFSET + TEXTXLOC;
        else x -= TXT_OFFSET;
@@ -2956,14 +2874,13 @@ void TEXT_OT_insert(wmOperatorType *ot)
 /* mode */
 #define TEXT_FIND       0
 #define TEXT_REPLACE    1
-#define TEXT_MARK_ALL   2
 
 static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
 {
        Main *bmain = CTX_data_main(C);
        SpaceText *st = CTX_wm_space_text(C);
-       Text *start = NULL, *text = st->text;
-       int flags, first = 1;
+       Text *text = st->text;
+       int flags;
        int found = 0;
        char *tmp;
 
@@ -2972,79 +2889,48 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
 
        flags = st->flags;
        if (flags & ST_FIND_ALL)
-               flags ^= ST_FIND_WRAP;
+               flags &= ~ST_FIND_WRAP;
 
-       do {
-               int proceed = 0;
+       /* Replace current */
+       if (mode != TEXT_FIND && txt_has_sel(text)) {
+               tmp = txt_sel_to_buf(text);
 
-               if (first) {
-                       if (text->markers.first)
-                               WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+               if (flags & ST_MATCH_CASE) found = strcmp(st->findstr, tmp) == 0;
+               else found = BLI_strcasecmp(st->findstr, tmp) == 0;
 
-                       txt_clear_markers(text, TMARK_GRP_FINDALL, 0);
-               }
-
-               first = 0;
-               
-               /* Replace current */
-               if (mode != TEXT_FIND && txt_has_sel(text)) {
-                       tmp = txt_sel_to_buf(text);
-
-                       if (flags & ST_MATCH_CASE) proceed = strcmp(st->findstr, tmp) == 0;
-                       else proceed = BLI_strcasecmp(st->findstr, tmp) == 0;
-
-                       if (proceed) {
-                               if (mode == TEXT_REPLACE) {
-                                       txt_insert_buf(text, st->replacestr);
-                                       if (text->curl && text->curl->format) {
-                                               MEM_freeN(text->curl->format);
-                                               text->curl->format = NULL;
-                                       }
-                                       text_update_cursor_moved(C);
-                                       WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-                                       text_drawcache_tag_update(CTX_wm_space_text(C), 1);
-                               }
-                               else if (mode == TEXT_MARK_ALL) {
-                                       unsigned char color[4];
-                                       UI_GetThemeColor4ubv(TH_SHADE2, color);
-
-                                       if (txt_find_marker(text, text->curl, text->selc, TMARK_GRP_FINDALL, 0)) {
-                                               if (tmp) MEM_freeN(tmp), tmp = NULL;
-                                               break;
-                                       }
-
-                                       txt_add_marker(text, text->curl, text->curc, text->selc, color, TMARK_GRP_FINDALL, TMARK_EDITALL);
-                                       text_update_cursor_moved(C);
-                                       WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+               if (found) {
+                       if (mode == TEXT_REPLACE) {
+                               txt_insert_buf(text, st->replacestr);
+                               if (text->curl && text->curl->format) {
+                                       MEM_freeN(text->curl->format);
+                                       text->curl->format = NULL;
                                }
+                               text_update_cursor_moved(C);
+                               WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+                               text_drawcache_tag_update(CTX_wm_space_text(C), 1);
                        }
-                       MEM_freeN(tmp);
-                       tmp = NULL;
                }
+               MEM_freeN(tmp);
+               tmp = NULL;
+       }
 
-               /* Find next */
-               if (txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
-                       text_update_cursor_moved(C);
-                       WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
-               }
-               else if (flags & ST_FIND_ALL) {
-                       if (text == start) break;
-                       if (!start) start = text;
-                       if (text->id.next)
-                               text = st->text = text->id.next;
-                       else
-                               text = st->text = bmain->text.first;
-                       txt_move_toline(text, 0, 0);
-                       text_update_cursor_moved(C);
-                       WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
-                       first = 1;
-               }
-               else {
-                       if (!found && !proceed) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
-                       break;
-               }
-               found = 1;
-       } while (mode == TEXT_MARK_ALL);
+       /* Find next */
+       if (txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
+               text_update_cursor_moved(C);
+               WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
+       }
+       else if (flags & ST_FIND_ALL) {
+               if (text->id.next)
+                       text = st->text = text->id.next;
+               else
+                       text = st->text = bmain->text.first;
+               txt_move_toline(text, 0, 0);
+               text_update_cursor_moved(C);
+               WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
+       }
+       else {
+               if (!found) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
+       }
 
        return OPERATOR_FINISHED;
 }
@@ -3085,25 +2971,6 @@ void TEXT_OT_replace(wmOperatorType *ot)
        ot->poll = text_space_edit_poll;
 }
 
-/******************* mark all operator *********************/
-
-static int text_mark_all_exec(bContext *C, wmOperator *op)
-{
-       return text_find_and_replace(C, op, TEXT_MARK_ALL);
-}
-
-void TEXT_OT_mark_all(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name = "Mark All";
-       ot->idname = "TEXT_OT_mark_all";
-       ot->description = "Mark all specified text";
-       
-       /* api callbacks */
-       ot->exec = text_mark_all_exec;
-       ot->poll = text_space_edit_poll;
-}
-
 /******************* find set selected *********************/
 
 static int text_find_set_selected_exec(bContext *C, wmOperator *op)
@@ -3257,27 +3124,31 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UN
                case 1:
                        if (text->flags & TXT_ISDIRTY) {
                                /* modified locally and externally, ahhh. offer more possibilites. */
-                               pup = uiPupMenuBegin(C, "File Modified Outside and Inside Blender", ICON_NONE);
+                               pup = uiPupMenuBegin(C, IFACE_("File Modified Outside and Inside Blender"), ICON_NONE);
                                layout = uiPupMenuLayout(pup);
-                               uiItemEnumO_ptr(layout, op->type, "Reload from disk (ignore local changes)", 0, "resolution", RESOLVE_RELOAD);
-                               uiItemEnumO_ptr(layout, op->type, "Save to disk (ignore outside changes)", 0, "resolution", RESOLVE_SAVE);
-                               uiItemEnumO_ptr(layout, op->type, "Make text internal (separate copy)", 0, "resolution", RESOLVE_MAKE_INTERNAL);
+                               uiItemEnumO_ptr(layout, op->type, IFACE_("Reload from disk (ignore local changes)"),
+                                               0, "resolution", RESOLVE_RELOAD);
+                               uiItemEnumO_ptr(layout, op->type, IFACE_("Save to disk (ignore outside changes)"),
+                                               0, "resolution", RESOLVE_SAVE);
+                               uiItemEnumO_ptr(layout, op->type, IFACE_("Make text internal (separate copy)"),
+                                               0, "resolution", RESOLVE_MAKE_INTERNAL);
                                uiPupMenuEnd(C, pup);
                        }
                        else {
-                               pup = uiPupMenuBegin(C, "File Modified Outside Blender", ICON_NONE);
+                               pup = uiPupMenuBegin(C, IFACE_("File Modified Outside Blender"), ICON_NONE);
                                layout = uiPupMenuLayout(pup);
-                               uiItemEnumO_ptr(layout, op->type, "Reload from disk", 0, "resolution", RESOLVE_RELOAD);
-                               uiItemEnumO_ptr(layout, op->type, "Make text internal (separate copy)", 0, "resolution", RESOLVE_MAKE_INTERNAL);
-                               uiItemEnumO_ptr(layout, op->type, "Ignore", 0, "resolution", RESOLVE_IGNORE);
+                               uiItemEnumO_ptr(layout, op->type, IFACE_("Reload from disk"), 0, "resolution", RESOLVE_RELOAD);
+                               uiItemEnumO_ptr(layout, op->type, IFACE_("Make text internal (separate copy)"),
+                                               0, "resolution", RESOLVE_MAKE_INTERNAL);
+                               uiItemEnumO_ptr(layout, op->type, IFACE_("Ignore"), 0, "resolution", RESOLVE_IGNORE);
                                uiPupMenuEnd(C, pup);
                        }
                        break;
                case 2:
-                       pup = uiPupMenuBegin(C, "File Deleted Outside Blender", ICON_NONE);
+                       pup = uiPupMenuBegin(C, IFACE_("File Deleted Outside Blender"), ICON_NONE);
                        layout = uiPupMenuLayout(pup);
-                       uiItemEnumO_ptr(layout, op->type, "Make text internal", 0, "resolution", RESOLVE_MAKE_INTERNAL);
-                       uiItemEnumO_ptr(layout, op->type, "Recreate file", 0, "resolution", RESOLVE_SAVE);
+                       uiItemEnumO_ptr(layout, op->type, IFACE_("Make text internal"), 0, "resolution", RESOLVE_MAKE_INTERNAL);
+                       uiItemEnumO_ptr(layout, op->type, IFACE_("Recreate file"), 0, "resolution", RESOLVE_SAVE);
                        uiPupMenuEnd(C, pup);
                        break;
        }