localization of symbol editor

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@227 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-03-22 14:27:55 +00:00
parent 1bf5af3de4
commit 21781a559a
10 changed files with 271 additions and 145 deletions
+25 -20
View File
@@ -35,13 +35,14 @@ void SymbolBasicShapeEditor::draw(DC& dc) {
void SymbolBasicShapeEditor::initUI(wxToolBar* tb, wxMenuBar* mb) {
sides = new wxSpinCtrl( tb, ID_SIDES, _("3"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 50, 3);
sidesL = new wxStaticText(tb, ID_SIDES, _(" sides: "));
sidesL = new wxStaticText(tb, ID_SIDES, _(" ") + _LABEL_("sides") + _(": "));
sides->SetHelpText(_HELP_("sides"));
sides->SetSize(50, -1);
tb->AddSeparator();
tb->AddTool(ID_SHAPE_CIRCLE, _("Ellipse"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _("Circle / Ellipse"), _("Draw circles and ellipses"));
tb->AddTool(ID_SHAPE_RECTANGLE, _("Rectangle"), load_resource_tool_image(_("rectangle")), wxNullBitmap, wxITEM_CHECK, _("Square / Rectangle"), _("Draw squares and rectangles"));
tb->AddTool(ID_SHAPE_POLYGON, _("Polygon"), load_resource_tool_image(_("triangle")), wxNullBitmap, wxITEM_CHECK, _("Polygon"), _("Draw triangles, pentagons and other regular polygons"));
tb->AddTool(ID_SHAPE_STAR, _("Star"), load_resource_tool_image(_("star")), wxNullBitmap, wxITEM_CHECK, _("Star"), _("Draw stars"));
tb->AddTool(ID_SHAPE_CIRCLE, _TOOL_("ellipse"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("ellipse"), _HELP_("ellipse"));
tb->AddTool(ID_SHAPE_RECTANGLE, _TOOL_("rectangle"), load_resource_tool_image(_("rectangle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("rectangle"), _HELP_("rectangle"));
tb->AddTool(ID_SHAPE_POLYGON, _TOOL_("polygon"), load_resource_tool_image(_("triangle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("polygon"), _HELP_("polygon"));
tb->AddTool(ID_SHAPE_STAR, _TOOL_("star"), load_resource_tool_image(_("star")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("star"), _HELP_("star"));
tb->AddControl(sidesL);
tb->AddControl(sides);
tb->Realize();
@@ -90,7 +91,7 @@ void SymbolBasicShapeEditor::onLeftDown (const Vector2D& pos, wxMouseEvent& ev
// Start drawing
drawing = true;
start = end = pos;
SetStatusText(_("Drag to resize shape, Ctrl constrains shape, Shift centers shape"));
SetStatusText(_HELP_("drag to draw shape"));
}
void SymbolBasicShapeEditor::onLeftUp (const Vector2D& pos, wxMouseEvent& ev) {
@@ -138,16 +139,16 @@ void SymbolBasicShapeEditor::stopActions() {
drawing = false;
switch (mode) {
case ID_SHAPE_CIRCLE:
SetStatusText(_("Click and drag to draw a ellipse, hold Ctrl for a circle"));
SetStatusText(_HELP_("draw ellipse"));
break;
case ID_SHAPE_RECTANGLE:
SetStatusText(_("Click and drag to draw a rectangle, hold Ctrl for a square"));
SetStatusText(_HELP_("draw rectangle"));
break;
case ID_SHAPE_POLYGON:
SetStatusText(_("Click and drag to draw a polygon"));
SetStatusText(_HELP_("draw polygon"));
break;
case ID_SHAPE_STAR:
SetStatusText(_("Click and drag to draw a star"));
SetStatusText(_HELP_("draw star"));
break;
}
control.Refresh(false);
@@ -183,9 +184,9 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
case ID_SHAPE_CIRCLE: {
// A circle / ellipse
if (constrained) {
shape->name = _("Circle");
shape->name = capitalize(_TYPE_("circle"));
} else {
shape->name = _("Ellipse");
shape->name = capitalize(_TYPE_("ellipse"));
}
// a circle has 4 control points, the first is: (x+r, y) db(0, kr) da(0, -kr)
// kr is a magic constant
@@ -198,9 +199,9 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
} case ID_SHAPE_RECTANGLE: {
// A rectangle / square
if (constrained) {
shape->name = _("Square");
shape->name = capitalize(_TYPE_("square"));
} else {
shape->name = _("Rectangle");
shape->name = capitalize(_TYPE_("rectangle"));
}
// a rectangle just has four corners
shape->points.push_back(new_shared2<ControlPoint>(c.x - r.x, c.y - r.y));
@@ -211,12 +212,16 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
} default: {
// A polygon or star
int n = sides->GetValue(); // number of sides
switch (n) {
case 3: shape->name = _("Triangle");
case 4: shape->name = _("Rhombus");
case 5: shape->name = _("Pentagon");
case 6: shape->name = _("Hexagon");
default: shape->name = _("Polygon");
if (mode == ID_SHAPE_POLYGON) {
switch (n) {
case 3: shape->name = capitalize(_TYPE_("triangle"));
case 4: shape->name = capitalize(_TYPE_("rhombus"));
case 5: shape->name = capitalize(_TYPE_("pentagon"));
case 6: shape->name = capitalize(_TYPE_("hexagon"));
default: shape->name = capitalize(_TYPE_("polygon"));
}
} else { // star
shape->name = capitalize(_TYPE_("star"));
}
// Example: n == 7
// a a..g = corners
+11 -11
View File
@@ -155,12 +155,12 @@ wxPen SymbolPointEditor::handlePen(WhichPen p, LockMode lock) {
void SymbolPointEditor::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Initialize toolbar
tb->AddSeparator();
tb->AddTool(ID_SEGMENT_LINE, _("Line"), load_resource_tool_image(_("line")), wxNullBitmap, wxITEM_CHECK, _("To straigt line"), _("Makes the selected line straight"));
tb->AddTool(ID_SEGMENT_CURVE, _("Curve"), load_resource_tool_image(_("curve")), wxNullBitmap, wxITEM_CHECK, _("To curve"), _("Makes the selected line curved"));
tb->AddSeparator();
tb->AddTool(ID_LOCK_FREE, _("Free"), load_resource_tool_image(_("lock_free")), wxNullBitmap, wxITEM_CHECK, _("Unlock node"), _("Allows the two control points on the node to be moved freely"));
tb->AddTool(ID_LOCK_DIR, _("Smooth"), load_resource_tool_image(_("lock_dir")), wxNullBitmap, wxITEM_CHECK, _("Make node smooth"), _("Makes the selected node smooth by placing the two control points opposite each other"));
tb->AddTool(ID_LOCK_SIZE, _("Symmetric"), load_resource_tool_image(_("lock_size")), wxNullBitmap, wxITEM_CHECK, _("Make node symmetric"), _("Makes the selected node symetric"));
tb->AddTool(ID_SEGMENT_LINE, _TOOL_("line segment"), load_resource_tool_image(_("line")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("line segment"), _HELP_("line segment"));
tb->AddTool(ID_SEGMENT_CURVE, _TOOL_("curve segment"), load_resource_tool_image(_("curve")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("curve segment"), _HELP_("curve segment"));
tb->AddSeparator();
tb->AddTool(ID_LOCK_FREE, _TOOL_("free point"), load_resource_tool_image(_("lock_free")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("free point"), _HELP_("free point"));
tb->AddTool(ID_LOCK_DIR, _TOOL_("smooth point"), load_resource_tool_image(_("lock_dir")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("smooth point"), _HELP_("smooth point"));
tb->AddTool(ID_LOCK_SIZE, _TOOL_("symmetric point"), load_resource_tool_image(_("lock_size")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("symmetric point"), _HELP_("symmetric point"));
tb->Realize();
// TODO : menu bar
//mb->Insert(2, curveMenu, _("&Curve"))
@@ -325,11 +325,11 @@ void SymbolPointEditor::onKeyChange(wxKeyEvent& ev) {
if (ev.AltDown()) {
hovering = SELECTED_LINE;
control.SetCursor(pointCurve);
SetStatusText(_("Drag to move curve"));
SetStatusText(_HELP_("drag to move curve"));
} else {
hovering = SELECTED_NEW_POINT;
control.SetCursor(pointAdd);
SetStatusText(_("Alt + drag to move curve; double click to add control point on this line"));
SetStatusText(_HELP_("drag to move line"));
}
control.Refresh(false);
} else if (ev.GetKeyCode() == WXK_CONTROL || ev.GetKeyCode() == WXK_SHIFT) {
@@ -469,18 +469,18 @@ void SymbolPointEditor::findHoveredItem(const Vector2D& pos, bool altDown) {
if (hover_handle.handle) {
hovering = SELECTED_HANDLE;
control.SetCursor(pointMove);
SetStatusText(_("Click and drag to move control point"));
SetStatusText(_HELP_("drag to move point"));
} else {
// Not on a point or handle, maybe the cursor is on a curve
if (checkPosOnCurve(pos)) {
if (altDown) {
hovering = SELECTED_LINE;
control.SetCursor(pointCurve);
SetStatusText(_("Drag to move curve"));
SetStatusText(_HELP_("drag to move curve"));
} else {
hovering = SELECTED_NEW_POINT;
control.SetCursor(pointAdd);
SetStatusText(_("Alt + drag to move curve; double click to add control point on this line"));
SetStatusText(_HELP_("drag to move line"));
}
} else {
hovering = SELECTED_NONE;
+10 -9
View File
@@ -108,12 +108,12 @@ void SymbolSelectEditor::drawRotationCenter(DC& dc, const Vector2D& pos) {
void SymbolSelectEditor::initUI(wxToolBar* tb, wxMenuBar* mb) {
tb->AddSeparator();
tb->AddTool(ID_PART_MERGE, _("Merge"), load_resource_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _("Merge with shapes below"), _("Merges this shape with those below it"));
tb->AddTool(ID_PART_SUBTRACT, _("Subtract"), load_resource_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _("Subtract from shapes below"), _("Subtracts this shape from shapes below it, leaves only the area in that shape that is not in this shape"));
tb->AddTool(ID_PART_INTERSECTION, _("Intersect"), load_resource_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _("Intersect with shapes below"), _("Intersects this shape with shapes below it, leaves only the area in both shapes"));
tb->AddTool(ID_PART_MERGE, _TOOL_("merge"), load_resource_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("merge"), _HELP_("merge"));
tb->AddTool(ID_PART_SUBTRACT, _TOOL_("subtract"), load_resource_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("subtract"), _HELP_("subtract"));
tb->AddTool(ID_PART_INTERSECTION, _TOOL_("intersect"),load_resource_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("intersect"), _HELP_("intersect"));
// note: difference doesn't work (yet)
tb->AddTool(ID_PART_OVERLAP, _("Overlap"), load_resource_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _("Place above other shapes"), _("Place this shape, and its border above shapes below it"));
tb->AddTool(ID_PART_BORDER, _("Border"), load_resource_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _("Draw as a border"), _("Draws this shape as a border"));
tb->AddTool(ID_PART_OVERLAP, _TOOL_("overlap"), load_resource_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("overlap"), _HELP_("overlap"));
tb->AddTool(ID_PART_BORDER, _TOOL_("border"), load_resource_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("border"), _HELP_("border"));
tb->Realize();
}
void SymbolSelectEditor::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
@@ -247,17 +247,18 @@ void SymbolSelectEditor::onMouseMove (const Vector2D& from, const Vector2D& to,
if (!control.selected_parts.empty() && onAnyHandle(to, &dx, &dy)) {
// we are on a handle, don't highlight
highlightPart = SymbolPartP();
String shapes = control.selected_parts.size() > 1 ? _TYPE_("shapes") : _TYPE_("shape");
if (rotate) {
// shear or rotating?
if (dx == 0 || dy == 0) {
SetStatusText(String(_("Drag to shear selected shape")) + (control.selected_parts.size() > 1 ? _("s") : _("")));
SetStatusText(_HELP_1_("drag to shear", shapes));
control.SetCursor(dx == 0 ? cursorShearX : cursorShearY);
} else {
SetStatusText(String(_("Drag to rotate selected shape")) + (control.selected_parts.size() > 1 ? _("s") : _("")) + _(", Ctrl constrains angle to multiples of 15 degrees"));
SetStatusText(_HELP_1_("drag to rotate", shapes));
control.SetCursor(cursorRotate);
}
} else {
SetStatusText(String(_("Drag to resize selected shape")) + (control.selected_parts.size() > 1 ? _("s") : _("")) + _(", Ctrl constrains size"));
SetStatusText(_HELP_1_("drag to resize", shapes));
// what cursor to use?
if (dx == dy) control.SetCursor(wxCURSOR_SIZENWSE);
else if (dx == -dy) control.SetCursor(wxCURSOR_SIZENESW);
@@ -266,7 +267,7 @@ void SymbolSelectEditor::onMouseMove (const Vector2D& from, const Vector2D& to,
}
} else {
if (highlightPart) {
SetStatusText(_("Click to select shape, drag to move shape, double click to edit shape"));
SetStatusText(_HELP_("click to select shape"));
} else {
SetStatusText(_(""));
}
+12 -12
View File
@@ -92,26 +92,26 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) {
// Toolbar
wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL | wxTB_TEXT);
tb->AddTool(ID_FILE_STORE, _("Store"), load_resource_tool_image(_("apply")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("store symbol"), _HELP_("store symbol"));
tb->AddTool(ID_FILE_STORE, _TOOL_("store symbol"), load_resource_tool_image(_("apply")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("store symbol"), _HELP_("store symbol"));
tb->AddSeparator();
tb->AddTool(ID_EDIT_UNDO, _("Undo"), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _("Redo"), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString));
tb->AddTool(ID_EDIT_UNDO, _TOOL_("undo"), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _TOOL_("redo"), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_1_("redo",wxEmptyString));
tb->AddSeparator();
tb->AddTool(ID_VIEW_GRID, _("Grid"), load_resource_tool_image(_("grid")), wxNullBitmap, wxITEM_CHECK, _TOOL_("grid"));
tb->AddTool(ID_VIEW_GRID_SNAP,_("Snap"), load_resource_tool_image(_("grid_snap")), wxNullBitmap, wxITEM_CHECK, _TOOL_("snap"));
tb->AddTool(ID_VIEW_GRID, _TOOL_("grid"), load_resource_tool_image(_("grid")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("grid"), _HELP_("grid"));
tb->AddTool(ID_VIEW_GRID_SNAP, _TOOL_("snap"), load_resource_tool_image(_("grid_snap")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("snap"), _HELP_("snap"));
tb->Realize();
// Edit mode toolbar
wxPanel* emp = new wxPanel(this, wxID_ANY);
wxToolBar* em = new wxToolBar(emp, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_VERTICAL | wxTB_TEXT | wxTB_HORZ_LAYOUT);
em->AddTool(ID_MODE_SELECT,_("Select"), load_resource_tool_image(_("mode_select")), wxNullBitmap, wxITEM_CHECK, _TOOL_("select"), _HELP_("select"));
em->AddTool(ID_MODE_ROTATE,_("Rotate"), load_resource_tool_image(_("mode_rotate")), wxNullBitmap, wxITEM_CHECK, _TOOL_("rotate"), _HELP_("rotate"));
em->AddTool(ID_MODE_SELECT, _TOOL_("select"), load_resource_tool_image(_("mode_select")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("select"), _HELP_("select"));
em->AddTool(ID_MODE_ROTATE, _TOOL_("rotate"), load_resource_tool_image(_("mode_rotate")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("rotate"), _HELP_("rotate"));
em->AddSeparator();
em->AddTool(ID_MODE_POINTS,_("Points"), load_resource_tool_image(_("mode_curve")), wxNullBitmap, wxITEM_CHECK, _TOOL_("points"), _HELP_("points"));
em->AddTool(ID_MODE_POINTS, _TOOL_("points"), load_resource_tool_image(_("mode_curve")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("points"), _HELP_("points"));
em->AddSeparator();
em->AddTool(ID_MODE_SHAPES,_("Basic Shapes"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _TOOL_("basic shapes"), _HELP_("basic shapes"));
em->AddTool(ID_MODE_SHAPES, _TOOL_("basic shapes"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("basic shapes"), _HELP_("basic shapes"));
em->AddSeparator();
em->AddTool(ID_MODE_PAINT, _("Paint"), load_resource_tool_image(_("mode_paint")), wxNullBitmap, wxITEM_CHECK, _TOOL_("paint"), _HELP_("paint"));
em->AddTool(ID_MODE_PAINT, _TOOL_("paint"), load_resource_tool_image(_("mode_paint")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("paint"), _HELP_("paint"));
em->AddSeparator();
em->Realize();
@@ -228,13 +228,13 @@ void SymbolWindow::onUpdateUI(wxUpdateUIEvent& ev) {
ev.Enable(control->getSymbol()->actions.canUndo());
String label = control->getSymbol()->actions.undoName();
ev.SetText(_MENU_1_("undo", label));
GetToolBar()->SetToolShortHelp(ID_EDIT_UNDO, _TOOL_1_("undo", label));
GetToolBar()->SetToolShortHelp(ID_EDIT_UNDO, _TOOLTIP_1_("undo", label));
break;
} case ID_EDIT_REDO: {
ev.Enable(control->getSymbol()->actions.canRedo());
String label = control->getSymbol()->actions.redoName();
ev.SetText(_MENU_1_("redo", label));
GetToolBar()->SetToolShortHelp(ID_EDIT_REDO, _TOOL_1_("redo", label));
GetToolBar()->SetToolShortHelp(ID_EDIT_REDO, _TOOLTIP_1_("redo", label));
break;
} default: {
// items created by the editor control