CtrlLib: Fixed issue with rect selection and Alt+F2 in theide, CodeEditor: added .t #809

git-svn-id: svn://ultimatepp.org/upp/trunk@7514 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-07-16 07:04:38 +00:00
parent c7911e1e1c
commit c125ca2a8e
8 changed files with 248 additions and 73 deletions

View file

@ -10,6 +10,9 @@ NAMESPACE_UPP
#define IMAGEFILE <CodeEditor/CodeEditor.iml>
#include <Draw/iml_source.h>
#define TFILE <CodeEditor/CodeEditor.t>
#include <Core/t.h>
One<EditorSyntax> CodeEditor::GetSyntax(int line)
{
CTIMING("GetSyntax");
@ -636,7 +639,7 @@ void CodeEditor::SetI(Ctrl *edit)
void CodeEditor::Goto() {
String line = AsString(GetCursorLine());
if(EditText(line, "Go to", "Line:"))
if(EditText(line, t_("Go to"), t_("Line:")))
SetCursor(GetPos(atoi(line) - 1));
}
@ -933,7 +936,7 @@ void CodeEditor::HighlightLine(int line, Vector<LineEdit::Highlight>& hl, int po
void CodeEditor::PutI(WithDropChoice<EditString>& edit)
{
edit.AddButton().SetMonoImage(CodeEditorImg::I()).Tip("Set word/selection (Ctrl+I)")
edit.AddButton().SetMonoImage(CodeEditorImg::I()).Tip(t_("Set word/selection (Ctrl+I)"))
<<= THISBACK1(SetI, &edit);
}

View file

@ -15,6 +15,7 @@ NAMESPACE_UPP
#define IMAGEFILE <CodeEditor/CodeEditor.iml>
#include <Draw/iml_header.h>
void FindWildcardMenu(Callback1<const char *> cb, Point p, bool tablf, Ctrl *owner, bool regexp);
struct LineInfoRecord {

View file

@ -0,0 +1,167 @@
#ifdef _MSC_VER
#pragma setlocale("C")
#endif
// hl_color.i
T_("Normal text")
T_("Normal background")
T_("Selected text")
T_("Selected background")
T_("Disabled text")
T_("Read only background")
T_("Comment text")
T_("String constant text")
T_("Operator text")
T_("Keyword text")
T_("U++ identifier text")
T_("t_/t__ background")
T_("Umatched bracket")
T_("Brackets level 1")
T_("Brackets level 2")
T_("Brackets level 3")
T_("Brackets level 4")
T_("Decimal constant")
T_("FP constant")
T_("Hexadecimal constant")
T_("Octal constant")
T_("Format field")
T_("Cursor bracket")
T_("Matching bracket")
T_("Block level 1")
T_("Block level 2")
T_("Block level 3")
T_("Block level 4")
T_("#preprocesor text")
T_("#define background")
T_("#if/#else/#endif background")
T_("#if/#else/#endif comment")
T_("Upper text")
T_("Sql keywords")
T_("Sql functions")
T_("Sql boolean expressions")
T_("U++ macros")
T_("U++ log macros")
T_("Selected word through file")
T_("Error in compiler messages")
T_("Warning in compiler messages")
// FindReplace.cpp
T_("Replace in selection")
T_("One or more spaces")
T_("One or more any characters")
T_("Word")
T_("Number")
T_("Any character")
T_("Tab")
T_("C++ identifier")
T_("Line feed")
T_("Matched subpattern %d")
T_("Matched spaces")
T_("Matched one or more any characters")
T_("Matched C++ identifier")
T_("Matched number")
T_("Matched any character")
T_("0-based replace index")
T_("1-based replace index")
T_("To upper")
T_("To lower")
T_("InitCaps")
// CodeEditor.cpp
T_("Go to")
T_("Line:")
T_("Set word/selection (Ctrl+I)")
// CodeEditor.lay
T_("&Find")
T_("&Replace")
T_("Wild&cards")
T_("&Whole word")
T_("&Ignore case")
T_("RegExp")
T_("&Incremental")
T_("from cursor")
T_("Mimic case")
T_("Find")
T_("Replace")
T_("RegEx")
T_("Cancel")

View file

@ -32,6 +32,7 @@ file
CodeEditor.cpp,
CodeEditor.lay,
CodeEditor.iml,
CodeEditor.t,
Info readonly separator,
Copying;

View file

@ -571,7 +571,7 @@ void CodeEditor::FindReplace(bool pick_selection, bool pick_text, bool replace)
findreplace.itext = GetI();
SetLayout_BlockReplaceLayout(findreplace);
findreplace.SetRect(WithBlockReplaceLayout<EmptyClass>::GetLayoutSize());
findreplace.Title("Replace in selection");
findreplace.Title(t_("Replace in selection"));
findreplace.amend.Hide();
findreplace.prev.Hide();
findreplace.next.Ok() <<= findreplace.Breaker(IDOK);
@ -600,26 +600,26 @@ void FindWildcardMenu(Callback1<const char *> cb, Point p, bool tablf, Ctrl *own
{
MenuBar menu;
if(regexp) {
menu.Add("One or more spaces", callback1(cb, " +"));
menu.Add("One or more any characters", callback1(cb, ".+"));
menu.Add("Word", callback1(cb, "\\w+"));
menu.Add("Number", callback1(cb, "\\d+"));
menu.Add("Any character", callback1(cb, "."));
menu.Add(t_("One or more spaces"), callback1(cb, " +"));
menu.Add(t_("One or more any characters"), callback1(cb, ".+"));
menu.Add(t_("Word"), callback1(cb, "\\w+"));
menu.Add(t_("Number"), callback1(cb, "\\d+"));
menu.Add(t_("Any character"), callback1(cb, "."));
if(tablf) {
menu.Separator();
menu.Add("Tab", callback1(cb, "\\t"));
menu.Add(t_("Tab"), callback1(cb, "\\t"));
}
}
else {
menu.Add("One or more spaces", callback1(cb, "%"));
menu.Add("One or more any characters", callback1(cb, "*"));
menu.Add("C++ identifier", callback1(cb, "$"));
menu.Add("Number", callback1(cb, "#"));
menu.Add("Any character", callback1(cb, "?"));
menu.Add(t_("One or more spaces"), callback1(cb, "%"));
menu.Add(t_("One or more any characters"), callback1(cb, "*"));
menu.Add(t_("C++ identifier"), callback1(cb, "$"));
menu.Add(t_("Number"), callback1(cb, "#"));
menu.Add(t_("Any character"), callback1(cb, "?"));
if(tablf) {
menu.Separator();
menu.Add("Tab", callback1(cb, "\\t"));
menu.Add("Line feed", callback1(cb, "\\n"));
menu.Add(t_("Tab"), callback1(cb, "\\t"));
menu.Add(t_("Line feed"), callback1(cb, "\\n"));
}
}
menu.Execute(owner, p);
@ -647,27 +647,27 @@ void CodeEditor::ReplaceWildcard()
MenuBar menu;
String ptxt;
if(findreplace.regexp) {
ptxt = "Matched subpattern %d";
ptxt = t_("Matched subpattern %d");
}
else {
menu.Add("Matched spaces", THISBACK1(InsertWildcard, "%"));
menu.Add("Matched one or more any characters", THISBACK1(InsertWildcard, "*"));
menu.Add("Matched C++ identifier", THISBACK1(InsertWildcard, "$"));
menu.Add("Matched number", THISBACK1(InsertWildcard, "#"));
menu.Add("Matched any character", THISBACK1(InsertWildcard, "?"));
menu.Add(t_("Matched spaces"), THISBACK1(InsertWildcard, "%"));
menu.Add(t_("Matched one or more any characters"), THISBACK1(InsertWildcard, "*"));
menu.Add(t_("Matched C++ identifier"), THISBACK1(InsertWildcard, "$"));
menu.Add(t_("Matched number"), THISBACK1(InsertWildcard, "#"));
menu.Add(t_("Matched any character"), THISBACK1(InsertWildcard, "?"));
}
menu.Add("0-based replace index", THISBACK1(InsertWildcard, "0"));
menu.Add("1-based replace index", THISBACK1(InsertWildcard, "1"));
menu.Add(t_("0-based replace index"), THISBACK1(InsertWildcard, "0"));
menu.Add(t_("1-based replace index"), THISBACK1(InsertWildcard, "1"));
menu.Separator();
for(int i = 1; i <= 9; i++)
menu.Add(Format(ptxt, i), THISBACK1(InsertWildcard, "@"+AsString(i)));
menu.Separator();
menu.Add("To upper", THISBACK1(InsertWildcard, "+"));
menu.Add("To lower", THISBACK1(InsertWildcard, "-"));
menu.Add("InitCaps", THISBACK1(InsertWildcard, "!"));
menu.Add(t_("To upper"), THISBACK1(InsertWildcard, "+"));
menu.Add(t_("To lower"), THISBACK1(InsertWildcard, "-"));
menu.Add(t_("InitCaps"), THISBACK1(InsertWildcard, "!"));
menu.Separator();
menu.Add("Tab", THISBACK1(InsertWildcard, "\\t"));
menu.Add("Line feed", THISBACK1(InsertWildcard, "\\n"));
menu.Add(t_("Tab"), THISBACK1(InsertWildcard, "\\t"));
menu.Add(t_("Line feed"), THISBACK1(InsertWildcard, "\\n"));
int l, h;
findreplace.replace.GetSelection(l, h);
iwc.Clear();

View file

@ -1,51 +1,51 @@
//#BLITZ_APPROVE
HL_COLOR(INK_NORMAL, "Normal text", 1)
HL_COLOR(PAPER_NORMAL, "Normal background", 0)
HL_COLOR(INK_SELECTED, "Selected text", 1)
HL_COLOR(PAPER_SELECTED, "Selected background", 0)
HL_COLOR(INK_DISABLED, "Disabled text", 1)
HL_COLOR(PAPER_READONLY, "Read only background", 0)
HL_COLOR(INK_NORMAL, t_("Normal text"), 1)
HL_COLOR(PAPER_NORMAL, t_("Normal background"), 0)
HL_COLOR(INK_SELECTED, t_("Selected text"), 1)
HL_COLOR(PAPER_SELECTED, t_("Selected background"), 0)
HL_COLOR(INK_DISABLED, t_("Disabled text"), 1)
HL_COLOR(PAPER_READONLY, t_("Read only background"), 0)
HL_COLOR(INK_COMMENT, "Comment text", 1)
HL_COLOR(INK_CONST_STRING, "String constant text", 1)
HL_COLOR(INK_OPERATOR, "Operator text", 1)
HL_COLOR(INK_KEYWORD, "Keyword text", 1)
HL_COLOR(INK_UPP, "U++ identifier text", 1)
HL_COLOR(PAPER_LNG, "t_/t__ background", 0)
HL_COLOR(INK_ERROR, "Umatched bracket", 1)
HL_COLOR(INK_PAR0, "Brackets level 1", 1)
HL_COLOR(INK_PAR1, "Brackets level 2", 1)
HL_COLOR(INK_PAR2, "Brackets level 3", 1)
HL_COLOR(INK_PAR3, "Brackets level 4", 1)
HL_COLOR(INK_CONST_INT, "Decimal constant", 1)
//HL_COLOR(INK_CONST_INT_3, "Decimal constant thousands", 1)
HL_COLOR(INK_CONST_FLOAT, "FP constant", 1)
//HL_COLOR(INK_CONST_FLOAT_3, "FP constant thousands", 1)
HL_COLOR(INK_CONST_HEX, "Hexadecimal constant", 1)
HL_COLOR(INK_CONST_OCT, "Octal constant", 1)
HL_COLOR(INK_CONST_STRINGOP, "Format field", 1)
HL_COLOR(PAPER_BRACKET0, "Cursor bracket", 0)
HL_COLOR(PAPER_BRACKET, "Matching bracket", 0)
HL_COLOR(INK_COMMENT, t_("Comment text"), 1)
HL_COLOR(INK_CONST_STRING, t_("String constant text"), 1)
HL_COLOR(INK_OPERATOR, t_("Operator text"), 1)
HL_COLOR(INK_KEYWORD, t_("Keyword text"), 1)
HL_COLOR(INK_UPP, t_("U++ identifier text"), 1)
HL_COLOR(PAPER_LNG, t_("t_/t__ background"), 0)
HL_COLOR(INK_ERROR, t_("Umatched bracket"), 1)
HL_COLOR(INK_PAR0, t_("Brackets level 1"), 1)
HL_COLOR(INK_PAR1, t_("Brackets level 2"), 1)
HL_COLOR(INK_PAR2, t_("Brackets level 3"), 1)
HL_COLOR(INK_PAR3, t_("Brackets level 4"), 1)
HL_COLOR(INK_CONST_INT, t_("Decimal constant"), 1)
//HL_COLOR(INK_CONST_INT_3, t_("Decimal constant thousands"), 1)
HL_COLOR(INK_CONST_FLOAT, t_("FP constant"), 1)
//HL_COLOR(INK_CONST_FLOAT_3, t_("FP constant thousands"), 1)
HL_COLOR(INK_CONST_HEX, t_("Hexadecimal constant"), 1)
HL_COLOR(INK_CONST_OCT, t_("Octal constant"), 1)
HL_COLOR(INK_CONST_STRINGOP, t_("Format field"), 1)
HL_COLOR(PAPER_BRACKET0, t_("Cursor bracket"), 0)
HL_COLOR(PAPER_BRACKET, t_("Matching bracket"), 0)
HL_COLOR(PAPER_BLOCK1, "Block level 1", 0)
HL_COLOR(PAPER_BLOCK2, "Block level 2", 0)
HL_COLOR(PAPER_BLOCK3, "Block level 3", 0)
HL_COLOR(PAPER_BLOCK4, "Block level 4", 0)
HL_COLOR(PAPER_BLOCK1, t_("Block level 1"), 0)
HL_COLOR(PAPER_BLOCK2, t_("Block level 2"), 0)
HL_COLOR(PAPER_BLOCK3, t_("Block level 3"), 0)
HL_COLOR(PAPER_BLOCK4, t_("Block level 4"), 0)
HL_COLOR(INK_MACRO, "#preprocesor text", 1)
HL_COLOR(PAPER_MACRO, "#define background", 0)
HL_COLOR(PAPER_IFDEF, "#if/#else/#endif background", 0)
HL_COLOR(INK_IFDEF, "#if/#else/#endif comment", 1)
HL_COLOR(INK_MACRO, t_("#preprocesor text"), 1)
HL_COLOR(PAPER_MACRO, t_("#define background"), 0)
HL_COLOR(PAPER_IFDEF, t_("#if/#else/#endif background"), 0)
HL_COLOR(INK_IFDEF, t_("#if/#else/#endif comment"), 1)
HL_COLOR(INK_UPPER, "Upper text", 0)
HL_COLOR(INK_SQLBASE, "Sql keywords", 1)
HL_COLOR(INK_SQLFUNC, "Sql functions", 1)
HL_COLOR(INK_SQLBOOL, "Sql boolean expressions", 1)
HL_COLOR(INK_UPPMACROS, "U++ macros", 0)
HL_COLOR(INK_UPPLOGS, "U++ log macros", 0)
HL_COLOR(INK_UPPER, t_("Upper text"), 0)
HL_COLOR(INK_SQLBASE, t_("Sql keywords"), 1)
HL_COLOR(INK_SQLFUNC, t_("Sql functions"), 1)
HL_COLOR(INK_SQLBOOL, t_("Sql boolean expressions"), 1)
HL_COLOR(INK_UPPMACROS, t_("U++ macros"), 0)
HL_COLOR(INK_UPPLOGS, t_("U++ log macros"), 0)
HL_COLOR(PAPER_SELWORD, "Selected word through file", 0)
HL_COLOR(PAPER_SELWORD, t_("Selected word through file"), 0)
HL_COLOR(PAPER_ERROR, "Error in compiler messages", 0)
HL_COLOR(PAPER_WARNING, "Warning in compiler messages", 0)
HL_COLOR(PAPER_ERROR, t_("Error in compiler messages"), 0)
HL_COLOR(PAPER_WARNING, t_("Warning in compiler messages"), 0)

View file

@ -582,6 +582,7 @@ void LineEdit::LeftDown(Point p, dword flags) {
}
dorectsel = flags & K_ALT;
PlaceCaret(mpos, (flags & K_SHIFT) || dorectsel);
dorectsel = false;
SetFocus();
SetCapture();
}
@ -902,6 +903,7 @@ bool LineEdit::Key(dword key, int count) {
SelectAll();
break;
default:
dorectsel = false;
if(IsReadOnly())
return MenuBar::Scan(WhenBar, key);
switch(key) {
@ -928,6 +930,7 @@ bool LineEdit::Key(dword key, int count) {
}
return true;
}
dorectsel = false;
Sync();
return true;
}

View file

@ -280,7 +280,7 @@ protected:
bool showspaces;
bool showlines;
bool showreadonly;
bool dorectsel;
bool dorectsel; // TODO: Refactor this ugly hack!
void Paint0(Draw& w);