added localisation fixes and map editor tool tips by sworddragon

This commit is contained in:
oy 2010-08-16 01:29:11 +02:00
parent 5922cbb56d
commit 4c2dcc4f2b
4 changed files with 21 additions and 15 deletions

View file

@ -462,7 +462,7 @@ void CEditor::RenderBackground(CUIRect View, int Texture, float Size, float Brig
Graphics()->QuadsEnd(); Graphics()->QuadsEnd();
} }
int CEditor::UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Current, int Min, int Max, float Scale) int CEditor::UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Current, int Min, int Max, float Scale, const char *pToolTip)
{ {
// logic // logic
static float s_Value; static float s_Value;
@ -496,7 +496,8 @@ int CEditor::UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Cu
Current = Max; Current = Max;
} }
} }
m_pTooltip = Localize("Use left mouse button to drag and the change the value. Hold shift to be more precise."); if(pToolTip)
m_pTooltip = pToolTip;
} }
else if(UI()->HotItem() == pId) else if(UI()->HotItem() == pId)
{ {
@ -506,7 +507,8 @@ int CEditor::UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Cu
s_Value = 0; s_Value = 0;
UI()->SetActiveItem(pId); UI()->SetActiveItem(pId);
} }
m_pTooltip = Localize("Use left mouse button to drag and the change the value. Hold shift to be more precise."); if(pToolTip)
m_pTooltip = pToolTip;
} }
if(Inside) if(Inside)
@ -728,7 +730,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_RotationAmount = 90; static int s_RotationAmount = 90;
s_RotationAmount = UiDoValueSelector(&s_RotationAmount, &Button, "", s_RotationAmount, 1, 360, 2.0f); s_RotationAmount = UiDoValueSelector(&s_RotationAmount, &Button, "", s_RotationAmount, 1, 360, 2.0f, Localize("Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise."));
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top); TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
@ -1603,7 +1605,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int *
} }
else if(pProps[i].m_Type == PROPTYPE_INT_SCROLL) else if(pProps[i].m_Type == PROPTYPE_INT_SCROLL)
{ {
int NewValue = UiDoValueSelector(&pIds[i], &Shifter, "", pProps[i].m_Value, pProps[i].m_Min, pProps[i].m_Max, 1.0f); int NewValue = UiDoValueSelector(&pIds[i], &Shifter, "", pProps[i].m_Value, pProps[i].m_Min, pProps[i].m_Max, 1.0f, Localize("Use left mouse button to drag and change the value. Hold shift to be more precise."));
if(NewValue != pProps[i].m_Value) if(NewValue != pProps[i].m_Value)
{ {
*pNewVal = NewValue; *pNewVal = NewValue;
@ -1619,7 +1621,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIds, int *
for(int c = 0; c < 4; c++) for(int c = 0; c < 4; c++)
{ {
int v = (pProps[i].m_Value >> s_aShift[c])&0xff; int v = (pProps[i].m_Value >> s_aShift[c])&0xff;
NewColor |= UiDoValueSelector(((char *)&pIds[i])+c, &Shifter, s_paTexts[c], v, 0, 255, 1.0f)<<s_aShift[c]; NewColor |= UiDoValueSelector(((char *)&pIds[i])+c, &Shifter, s_paTexts[c], v, 0, 255, 1.0f, Localize("Use left mouse button to drag and change the color value. Hold shift to be more precise."))<<s_aShift[c];
if(c != 3) if(c != 3)
{ {
@ -2067,7 +2069,7 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
static int s_NewImageButton = 0; static int s_NewImageButton = 0;
ToolBox.HSplitTop(10.0f, &Slot, &ToolBox); ToolBox.HSplitTop(10.0f, &Slot, &ToolBox);
ToolBox.HSplitTop(12.0f, &Slot, &ToolBox); ToolBox.HSplitTop(12.0f, &Slot, &ToolBox);
if(DoButton_Editor(&s_NewImageButton, "Add", 0, &Slot, 0, Localize("Load a new image to use in the map"))) if(DoButton_Editor(&s_NewImageButton, Localize("Add"), 0, &Slot, 0, Localize("Load a new image to use in the map")))
InvokeFileDialog(IStorage::TYPE_ALL, Localize("Add Image"), Localize("Add"), "mapres/", "", AddImage, this); InvokeFileDialog(IStorage::TYPE_ALL, Localize("Add Image"), Localize("Add"), "mapres/", "", AddImage, this);
} }
@ -2398,13 +2400,16 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar); ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
static const char *s_paNames[4][4] = { static const char *s_paNames[2][4] = {
{"X", "", "", ""},
{"X", "Y", "", ""},
{"X", "Y", "R", ""}, {"X", "Y", "R", ""},
{"R", "G", "B", "A"}, {"R", "G", "B", "A"},
}; };
const char *paDescriptions[2][4] = {
{Localize("X-axis of the envelope"), Localize("Y-axis of the envelope"), Localize("Rotation of the envelope"), ""},
{Localize("Red value of the envelope"), Localize("Green value of the envelope"), Localize("Blue value of the envelope"), Localize("Alpha value of the envelope")},
};
static int s_aChannelButtons[4] = {0}; static int s_aChannelButtons[4] = {0};
int Bit = 1; int Bit = 1;
//ui_draw_button_func draw_func; //ui_draw_button_func draw_func;
@ -2417,7 +2422,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
else if(i == envelope->channels-1) draw_func = draw_editor_button_r; else if(i == envelope->channels-1) draw_func = draw_editor_button_r;
else draw_func = draw_editor_button_m;*/ else draw_func = draw_editor_button_m;*/
if(DoButton_Editor(&s_aChannelButtons[i], s_paNames[pEnvelope->m_Channels-1][i], s_ActiveChannels&Bit, &Button, 0, 0)) if(DoButton_Editor(&s_aChannelButtons[i], s_paNames[pEnvelope->m_Channels-3][i], s_ActiveChannels&Bit, &Button, 0, paDescriptions[pEnvelope->m_Channels-3][i]))
s_ActiveChannels ^= Bit; s_ActiveChannels ^= Bit;
} }
} }
@ -2721,7 +2726,7 @@ int CEditor::PopupMenuFile(CEditor *pEditor, CUIRect View)
View.HSplitTop(10.0f, &Slot, &View); View.HSplitTop(10.0f, &Slot, &View);
View.HSplitTop(12.0f, &Slot, &View); View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_ExitButton, "Exit", 0, &Slot, 0, Localize("Exits from the editor"))) if(pEditor->DoButton_MenuItem(&s_ExitButton, Localize("Exit"), 0, &Slot, 0, Localize("Exits from the editor")))
{ {
g_Config.m_ClEditor = 0; g_Config.m_ClEditor = 0;
return 1; return 1;

View file

@ -574,7 +574,7 @@ public:
void UiInvokePopupMenu(void *pId, int Flags, float x, float y, float w, float h, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra=0); void UiInvokePopupMenu(void *pId, int Flags, float x, float y, float w, float h, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra=0);
void UiDoPopupMenu(); void UiDoPopupMenu();
int UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Current, int Min, int Max, float Scale); int UiDoValueSelector(void *pId, CUIRect *r, const char *pLabel, int Current, int Min, int Max, float Scale, const char *pToolTip);
static int PopupGroup(CEditor *pEditor, CUIRect View); static int PopupGroup(CEditor *pEditor, CUIRect View);
static int PopupLayer(CEditor *pEditor, CUIRect View); static int PopupLayer(CEditor *pEditor, CUIRect View);

View file

@ -5,6 +5,7 @@
#include "ed_editor.h" #include "ed_editor.h"
#include <game/generated/client_data.h> #include <game/generated/client_data.h>
#include <game/client/render.h> #include <game/client/render.h>
#include <game/localization.h>
CLayerQuads::CLayerQuads() CLayerQuads::CLayerQuads()
{ {
@ -220,7 +221,7 @@ int CLayerQuads::RenderProperties(CUIRect *pToolBox)
}; };
CProperty aProps[] = { CProperty aProps[] = {
{"Image", m_Image, PROPTYPE_IMAGE, -1, 0}, {Localize("Image"), m_Image, PROPTYPE_IMAGE, -1, 0},
{0}, {0},
}; };

View file

@ -346,7 +346,7 @@ int CEditor::PopupPoint(CEditor *pEditor, CUIRect View)
CProperty aProps[] = { CProperty aProps[] = {
{"Color", Color, PROPTYPE_COLOR, -1, pEditor->m_Map.m_lEnvelopes.size()}, {Localize("Color"), Color, PROPTYPE_COLOR, -1, pEditor->m_Map.m_lEnvelopes.size()},
{0}, {0},
}; };