1
0
Fork 0

(svn r25984) [1.3] -Backport from trunk:

- Fix: Some spelling corrections to Catalan and Latin American town names [FS#5746] (r25775, r25774)
- Fix: If old savegames contain bridges over owned land, keep on drawing the bridges nevertheless [FS#5725] (r25753)
- Fix: [OSX] Text input into an edit box would trigger hotkeys [FS#5705] (r25743, r25671)
- Fix: Several RTL alignment issues [FS#5692] (r25733, r25732, r25731)
release/1.3
rubidium 2013-11-13 21:43:16 +00:00
parent 27bf9549d6
commit 95569e444b
13 changed files with 82 additions and 60 deletions

View File

@ -338,7 +338,7 @@ public:
if (!as->IsAvailable()) {
GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, PC_BLACK, FILLRECT_CHECKER);
}
DrawString(r.left + WD_MATRIX_LEFT, r.right + WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK);
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK);
y += this->line_height;
}
break;

View File

@ -910,7 +910,7 @@ void DrawEngineList(VehicleType type, int l, int r, int y, const GUIEngineList *
const uint num_engines = GetGroupNumEngines(_local_company, selected_group, engine);
SetDParam(0, engine);
DrawString(text_left, text_right, y + normal_text_y_offset, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK, (rtl ? SA_RIGHT : SA_LEFT));
DrawString(text_left, text_right, y + normal_text_y_offset, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK);
DrawVehicleEngine(l, r, sprite_x, y + sprite_y_offset, engine, (show_count && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_company), EIT_PURCHASE);
if (show_count) {
SetDParam(0, num_engines);

View File

@ -44,6 +44,7 @@
#include "gfx_type.h"
#include "strings_type.h"
#include "string_type.h"
void GameLoop();
@ -69,7 +70,7 @@ extern Dimension _resolutions[32];
extern Dimension _cur_resolution;
extern Palette _cur_palette; ///< Current palette
void HandleKeypress(uint32 key);
void HandleKeypress(uint keycode, WChar key);
void HandleCtrlChanged();
void HandleMouseEvents();
void CSleep(int milliseconds);

View File

@ -378,24 +378,37 @@ public:
virtual void DrawWidget(const Rect &r, int widget) const
{
switch (widget) {
case WID_DPI_MATRIX_WIDGET:
case WID_DPI_MATRIX_WIDGET: {
uint text_left, text_right, icon_left, icon_right;
if (_current_text_dir == TD_RTL) {
icon_right = r.right - WD_MATRIX_RIGHT;
icon_left = icon_right - 10;
text_right = icon_right - BuildIndustryWindow::MATRIX_TEXT_OFFSET;
text_left = r.left + WD_MATRIX_LEFT;
} else {
icon_left = r.left + WD_MATRIX_LEFT;
icon_right = icon_left + 10;
text_left = icon_left + BuildIndustryWindow::MATRIX_TEXT_OFFSET;
text_right = r.right - WD_MATRIX_RIGHT;
}
for (byte i = 0; i < this->vscroll->GetCapacity() && i + this->vscroll->GetPosition() < this->count; i++) {
int x = r.left + WD_MATRIX_LEFT;
int y = r.top + WD_MATRIX_TOP + i * this->resize.step_height;
bool selected = this->selected_index == i + this->vscroll->GetPosition();
if (this->index[i + this->vscroll->GetPosition()] == INVALID_INDUSTRYTYPE) {
DrawString(x + MATRIX_TEXT_OFFSET, r.right - WD_MATRIX_RIGHT, y, STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE);
DrawString(text_left, text_right, y, STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE);
continue;
}
const IndustrySpec *indsp = GetIndustrySpec(this->index[i + this->vscroll->GetPosition()]);
/* Draw the name of the industry in white is selected, otherwise, in orange */
DrawString(x + MATRIX_TEXT_OFFSET, r.right - WD_MATRIX_RIGHT, y, indsp->name, selected ? TC_WHITE : TC_ORANGE);
GfxFillRect(x, y + 1, x + 10, y + 7, selected ? PC_WHITE : PC_BLACK);
GfxFillRect(x + 1, y + 2, x + 9, y + 6, indsp->map_colour);
DrawString(text_left, text_right, y, indsp->name, selected ? TC_WHITE : TC_ORANGE);
GfxFillRect(icon_left, y + 1, icon_right, y + 7, selected ? PC_WHITE : PC_BLACK);
GfxFillRect(icon_left + 1, y + 2, icon_right - 1, y + 6, indsp->map_colour);
}
break;
}
case WID_DPI_INFOPANEL: {
int y = r.top + WD_FRAMERECT_TOP;

View File

@ -391,7 +391,7 @@ static void DrawTile_Object(TileInfo *ti)
DrawNewObjectTile(ti, spec);
}
if (spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) DrawBridgeMiddle(ti);
DrawBridgeMiddle(ti);
}
static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y)

View File

@ -198,7 +198,7 @@ struct SignListWindow : Window, SignList {
uint y = r.top + WD_FRAMERECT_TOP; // Offset from top of widget.
/* No signs? */
if (this->vscroll->GetCount() == 0) {
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right, y, STR_STATION_LIST_NONE);
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, STR_STATION_LIST_NONE);
return;
}

View File

@ -447,7 +447,7 @@ public:
case WID_STL_FACILALL: {
int cg_ofst = this->IsWidgetLowered(widget) ? 2 : 1;
DrawString(r.left + cg_ofst, r.right + cg_ofst, r.top + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
DrawString(r.left + cg_ofst, r.right + cg_ofst, r.top + cg_ofst, STR_ABBREV_ALL, TC_BLACK, SA_HOR_CENTER);
break;
}

View File

@ -627,9 +627,9 @@ static const char * const _name_spanish_real[] = {
"Morrocoy",
"Cata",
"Cataito",
"Ciudad Bolivar",
"Ciudad Bol\xC3\xADvar",
"Barquisimeto",
"Merida",
"M\xC3\xA9rida",
"Puerto Ordaz",
"Santa Elena",
"San Juan",
@ -638,12 +638,12 @@ static const char * const _name_spanish_real[] = {
"Santiago",
"Barcelona",
"Barinas",
"San Cristobal",
"San Crist\xC3\xB3""bal",
"San Fransisco",
"San Martin",
"San Mart\xC3\xADn",
"Guayana",
"San Carlos",
"El Limon",
"El Lim\xC3\xB3n",
"Coro",
"Corocoro",
"Puerto Ayacucho",
@ -663,7 +663,7 @@ static const char * const _name_spanish_real[] = {
"Quito",
"Cuenca",
"Huacho",
"Tulcan",
"Tulc\xC3\xA1n",
"Esmeraldas",
"Ibarra",
"San Lorenzo",
@ -674,20 +674,20 @@ static const char * const _name_spanish_real[] = {
"Latacunga",
"Tena",
"Cochabamba",
"Ascension",
"Ascensi\xC3\xB3n",
"Magdalena",
"Santa Ana",
"Manoa",
"Sucre",
"Oruro",
"Uyuni",
"Potosi",
"Potos\xC3\xAD",
"Tupiza",
"La Quiaca",
"Yacuiba",
"San Borja",
"Fuerte Olimpio",
"Fortin Esteros",
"Fort\xC3\xADn Esteros",
"Campo Grande",
"Bogota",
"El Banco",
@ -3149,7 +3149,7 @@ static const char * const _name_italian_river2[] = {
static const char * const _name_catalan_real[] = {
"Barcelona",
"Hospitalet",
"L'Hospitalet de Llobregat",
"Cerdanyola",
"Martorell",
"Badalona",
@ -3161,7 +3161,7 @@ static const char * const _name_catalan_real[] = {
"Reus",
"Valls",
"Vic",
"Vielha",
"Vielha e Mijaran",
"Amposta",
"Tortosa",
"Berga",
@ -3171,12 +3171,12 @@ static const char * const _name_catalan_real[] = {
"Figueres",
"Balaguer",
"Vilafranca del Pened\xC3\xA8s",
"La seu d'Urgell",
"Pont de Suert",
"La Seu d'Urgell",
"El Pont de Suert",
"Igualada",
"Manresa",
"Solsona",
"Les borges blanques",
"Les Borges Blanques",
"Tremp",
"Sort",
"Colera",
@ -3194,21 +3194,21 @@ static const char * const _name_catalan_real[] = {
"Campdev\xC3\xA0nol",
"Cambrils",
"Begur",
"Set Cases",
"Setcases",
"Palafrugell",
"Begues",
"El Bruc",
"Cadaqu\xC3\xA9s",
"Collbat\xC3\xB3",
"Cervell\xC3\xB3",
"Esparraguera",
"Esparreguera",
"Abrera",
"Alp",
"Das",
"Cercs",
"Manlleu",
"Masnou",
"Molins de rei",
"El Masnou",
"Molins de Rei",
"Monistrol",
"Rocallaura",
"Rub\xC3\xAD",
@ -3218,15 +3218,15 @@ static const char * const _name_catalan_real[] = {
};
static const char * const _name_catalan_pref[] = {
"Pont de ",
"El Pont de ",
"Parets de ",
"Canet de ",
"Castellar de ",
"Corbera de ",
"Arenys de ",
"Calella de ",
"La seu de ",
"La bisbal de ",
"La Seu de ",
"La Bisbal de ",
"Torroella de ",
"Port de ",
"Vilafranca de ",
@ -3262,13 +3262,13 @@ static const char * const _name_catalan_1m[] = {
};
static const char * const _name_catalan_1f[] = {
"Aigua",
"Selva ",
"Pala",
"Selva",
"Vall",
"Serra",
"Torre",
"Riba",
"Vall",
"Cova",
"Terra",
};
@ -3280,7 +3280,7 @@ static const char * const _name_catalan_2m[] = {
"vent\xC3\xB3s",
"negre",
"roig",
"gris",
"gr\xC3\xADs",
};
static const char * const _name_catalan_2f[] = {
@ -3295,16 +3295,16 @@ static const char * const _name_catalan_2f[] = {
};
static const char * const _name_catalan_3[] = {
" desp\xC3\xAD",
" desvern",
" del cam\xC3\xAD",
" Desp\xC3\xAD",
" Desvern",
" del Cam\xC3\xAD",
" de Mar",
" de Dalt",
" de Baix",
" del Vall\xC3\xA8s",
" de Bergued\xC3\xA0",
" de Conflent",
" de la plana",
" de la Plana",
};
static const char * const _name_catalan_river1[] = {

View File

@ -304,7 +304,7 @@ static const VkMapping _vk_mapping[] = {
AS(KEY_TILDE, WKC_BACKQUOTE),
};
static uint32 ConvertAllegroKeyIntoMy()
static uint32 ConvertAllegroKeyIntoMy(WChar *character)
{
int scancode;
int unicode = ureadkey(&scancode);
@ -326,7 +326,9 @@ static uint32 ConvertAllegroKeyIntoMy()
DEBUG(driver, 0, "Scancode character pressed %u", scancode);
DEBUG(driver, 0, "Unicode character pressed %u", unicode);
#endif
return (key << 16) + unicode;
*character = unicode;
return key;
}
static const uint LEFT_BUTTON = 0;
@ -414,7 +416,9 @@ static void PollEvent()
if ((key_shifts & KB_ALT_FLAG) && (key[KEY_ENTER] || key[KEY_F])) {
ToggleFullScreen(!_fullscreen);
} else if (keypressed()) {
HandleKeypress(ConvertAllegroKeyIntoMy());
WChar character;
uint keycode = ConvertAllegroKeyIntoMy(&character);
HandleKeypress(keycode, character);
}
}

View File

@ -34,6 +34,7 @@
#include "../../gfx_func.h"
#include "../../network/network.h"
#include "../../core/random_func.hpp"
#include "../../core/math_func.hpp"
#include "../../texteff.hpp"
#import <sys/time.h> /* gettimeofday */
@ -250,7 +251,7 @@ static uint32 QZ_MapKey(unsigned short sym)
if (_current_mods & NSAlternateKeyMask) key |= WKC_ALT;
if (_current_mods & NSCommandKeyMask) key |= (_settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_META : WKC_CTRL);
return key << 16;
return key;
}
static void QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL down)
@ -272,8 +273,11 @@ static void QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL dow
}
if (down) {
uint32 pressed_key = QZ_MapKey(keycode) | unicode;
HandleKeypress(pressed_key);
uint32 pressed_key = QZ_MapKey(keycode);
/* Don't handle normal characters if an edit box has the focus. */
if (!EditBoxInGlobalFocus() || (!IsInsideMM(pressed_key, 'A', 'Z' + 1) && !IsInsideMM(pressed_key, '0', '9' + 1))) {
HandleKeypress(pressed_key, unicode);
}
DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), down, mapping: %x", keycode, unicode, pressed_key);
} else {
DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), up", keycode, unicode);

View File

@ -495,7 +495,7 @@ static const VkMapping _vk_mapping[] = {
AS(SDLK_PERIOD, WKC_PERIOD)
};
static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, WChar *character)
{
const VkMapping *map;
uint key = 0;
@ -531,7 +531,8 @@ static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
if (sym->mod & KMOD_CTRL) key |= WKC_CTRL;
if (sym->mod & KMOD_ALT) key |= WKC_ALT;
return (key << 16) + sym->unicode;
*character = sym->unicode;
return key;
}
int VideoDriver_SDL::PollEvent()
@ -617,7 +618,9 @@ int VideoDriver_SDL::PollEvent()
(ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_f)) {
ToggleFullScreen(!_fullscreen);
} else {
HandleKeypress(ConvertSdlKeyIntoMy(&ev.key.keysym));
WChar character;
uint keycode = ConvertSdlKeyIntoMy(&ev.key.keysym, &character);
HandleKeypress(keycode, character);
}
break;

View File

@ -493,7 +493,7 @@ static LRESULT HandleCharMsg(uint keycode, WChar charcode)
prev_char = 0;
#endif /* UNICODE */
HandleKeypress(GB(charcode, 0, 16) | (keycode << 16));
HandleKeypress(keycode, charcode);
return 0;
}
@ -684,7 +684,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
/* No character translation? */
if (charcode == 0) {
HandleKeypress(0 | (keycode << 16));
HandleKeypress(keycode, 0);
return 0;
}
@ -716,11 +716,11 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
return 0; // do nothing
case VK_F10: // F10, ignore activation of menu
HandleKeypress(MapWindowsKey(wParam) << 16);
HandleKeypress(MapWindowsKey(wParam), 0);
return 0;
default: // ALT in combination with something else
HandleKeypress(MapWindowsKey(wParam) << 16);
HandleKeypress(MapWindowsKey(wParam), 0);
break;
}
break;

View File

@ -2313,18 +2313,15 @@ EventState Window::HandleEditBoxKey(int wid, WChar key, uint16 keycode)
/**
* Handle keyboard input.
* @param raw_key Lower 8 bits contain the ASCII character, the higher 16 bits the keycode
* @param keycode Virtual keycode of the key.
* @param key Unicode character of the key.
*/
void HandleKeypress(uint32 raw_key)
void HandleKeypress(uint keycode, WChar key)
{
/* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */
assert(HasModalProgress() || IsLocalCompany());
/* Setup event */
uint16 key = GB(raw_key, 0, 16);
uint16 keycode = GB(raw_key, 16, 16);
/*
* The Unicode standard defines an area called the private use area. Code points in this
* area are reserved for private use and thus not portable between systems. For instance,