Dialogs are right-to-left friendly now!
This commit is contained in:
parent
bcc8169cf2
commit
ab0c663c7a
2 changed files with 46 additions and 28 deletions
|
|
@ -296,6 +296,9 @@ $Id$
|
||||||
* 'tuxpaint-import' script didn't support files with spaces. Fixed.
|
* 'tuxpaint-import' script didn't support files with spaces. Fixed.
|
||||||
James Le Cuirot <jerseychewi@users.sourceforge.net>
|
James Le Cuirot <jerseychewi@users.sourceforge.net>
|
||||||
|
|
||||||
|
* Fixed display bugs and icon positioning in pop-up dialogs when
|
||||||
|
using right-to-left languages (like Hebrew or Arabic).
|
||||||
|
|
||||||
|
|
||||||
2008.June.26 (0.9.20)
|
2008.June.26 (0.9.20)
|
||||||
* New translations:
|
* New translations:
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - May 31, 2009
|
June 14, 2002 - June 13, 2009
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -11637,6 +11637,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
int img1_w, img2_w, img3_w, max_img_w, img_x, img_y, offset;
|
int img1_w, img2_w, img3_w, max_img_w, img_x, img_y, offset;
|
||||||
SDL_Surface *img1b;
|
SDL_Surface *img1b;
|
||||||
int free_img1b;
|
int free_img1b;
|
||||||
|
int txt_left, txt_right, img_left, btn_left, txt_btn_left, txt_btn_right;
|
||||||
|
|
||||||
hide_blinking_cursor();
|
hide_blinking_cursor();
|
||||||
|
|
||||||
|
|
@ -11769,8 +11770,6 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
/* If we're showing any images on the right, determine the widest width
|
/* If we're showing any images on the right, determine the widest width
|
||||||
for them: */
|
for them: */
|
||||||
|
|
||||||
/* FIXME: This needs to be fixed for right-to-left interfaces! */
|
|
||||||
|
|
||||||
offset = img1_w = img2_w = img3_w = 0;
|
offset = img1_w = img2_w = img3_w = 0;
|
||||||
|
|
||||||
if (img1b != NULL)
|
if (img1b != NULL)
|
||||||
|
|
@ -11788,19 +11787,36 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
|
|
||||||
/* Draw the question: */
|
/* Draw the question: */
|
||||||
|
|
||||||
wordwrap_text(text, black,
|
if (need_right_to_left == 0)
|
||||||
166 + PROMPTOFFSETX, 100 + PROMPTOFFSETY,
|
{
|
||||||
475 + PROMPTOFFSETX - offset, 1);
|
txt_left = 166 + PROMPTOFFSETX;
|
||||||
|
txt_right = 475 + PROMPTOFFSETX - offset;
|
||||||
|
img_left = 475 + PROMPTOFFSETX - max_img_w - 4;
|
||||||
|
btn_left = 166 + PROMPTOFFSETX;
|
||||||
|
txt_btn_left = txt_left + img_yes->w + 4;
|
||||||
|
txt_btn_right = txt_right;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
txt_left = 166 + PROMPTOFFSETX + offset;
|
||||||
|
txt_right = 457 + PROMPTOFFSETX;
|
||||||
|
img_left = 166 + PROMPTOFFSETX + 4;
|
||||||
|
btn_left = 475 + PROMPTOFFSETX - img_yes->w - 4;
|
||||||
|
txt_btn_left = txt_left;
|
||||||
|
txt_btn_right = btn_left;
|
||||||
|
}
|
||||||
|
|
||||||
|
wordwrap_text(text, black, txt_left, 100 + PROMPTOFFSETY, txt_right, 1);
|
||||||
|
|
||||||
|
|
||||||
/* Draw the images (if any, and if not animated): */
|
/* Draw the images (if any, and if not animated): */
|
||||||
|
|
||||||
img_x = 457 + PROMPTOFFSETX - offset;
|
img_x = img_left;
|
||||||
img_y = 100 + PROMPTOFFSETY + 4;
|
img_y = 100 + PROMPTOFFSETY + 4;
|
||||||
|
|
||||||
if (img1b != NULL)
|
if (img1b != NULL)
|
||||||
{
|
{
|
||||||
dest.x = img_x + (max_img_w - img1b->w) / 2;
|
dest.x = img_left + (max_img_w - img1b->w) / 2;
|
||||||
dest.y = img_y;
|
dest.y = img_y;
|
||||||
|
|
||||||
SDL_BlitSurface(img1b, NULL, screen, &dest);
|
SDL_BlitSurface(img1b, NULL, screen, &dest);
|
||||||
|
|
@ -11813,7 +11829,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
{
|
{
|
||||||
if (img2 != NULL)
|
if (img2 != NULL)
|
||||||
{
|
{
|
||||||
dest.x = img_x + (max_img_w - img2->w) / 2;
|
dest.x = img_left + (max_img_w - img2->w) / 2;
|
||||||
dest.y = img_y;
|
dest.y = img_y;
|
||||||
|
|
||||||
SDL_BlitSurface(img2, NULL, screen, &dest);
|
SDL_BlitSurface(img2, NULL, screen, &dest);
|
||||||
|
|
@ -11823,7 +11839,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
|
|
||||||
if (img3 != NULL)
|
if (img3 != NULL)
|
||||||
{
|
{
|
||||||
dest.x = img_x + (max_img_w - img3->w) / 2;
|
dest.x = img_left + (max_img_w - img3->w) / 2;
|
||||||
dest.y = img_y;
|
dest.y = img_y;
|
||||||
|
|
||||||
SDL_BlitSurface(img3, NULL, screen, &dest);
|
SDL_BlitSurface(img3, NULL, screen, &dest);
|
||||||
|
|
@ -11835,28 +11851,27 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
|
|
||||||
/* Draw yes button: */
|
/* Draw yes button: */
|
||||||
|
|
||||||
dest.x = 166 + PROMPTOFFSETX;
|
dest.x = btn_left;
|
||||||
dest.y = 178 + PROMPTOFFSETY;
|
dest.y = 178 + PROMPTOFFSETY;
|
||||||
SDL_BlitSurface(img_yes, NULL, screen, &dest);
|
SDL_BlitSurface(img_yes, NULL, screen, &dest);
|
||||||
|
|
||||||
|
|
||||||
/* (Bound to UTF8 domain, so always ask for UTF8 rendering!) */
|
/* (Bound to UTF8 domain, so always ask for UTF8 rendering!) */
|
||||||
|
|
||||||
wordwrap_text(btn_yes, black, 166 + PROMPTOFFSETX + 48 + 4,
|
wordwrap_text(btn_yes, black, txt_btn_left,
|
||||||
183 + PROMPTOFFSETY, 475 + PROMPTOFFSETX, 1);
|
183 + PROMPTOFFSETY, txt_btn_right, 1);
|
||||||
|
|
||||||
|
|
||||||
/* Draw no button: */
|
/* Draw no button: */
|
||||||
|
|
||||||
if (strlen(btn_no) != 0)
|
if (strlen(btn_no) != 0)
|
||||||
{
|
{
|
||||||
dest.x = 166 + PROMPTOFFSETX;
|
dest.x = btn_left;
|
||||||
dest.y = 230 + PROMPTOFFSETY;
|
dest.y = 230 + PROMPTOFFSETY;
|
||||||
SDL_BlitSurface(img_no, NULL, screen, &dest);
|
SDL_BlitSurface(img_no, NULL, screen, &dest);
|
||||||
|
|
||||||
wordwrap_text(btn_no, black,
|
wordwrap_text(btn_no, black, txt_btn_left,
|
||||||
166 + PROMPTOFFSETX + 48 + 4, 235 + PROMPTOFFSETY,
|
235 + PROMPTOFFSETY, txt_btn_right, 1);
|
||||||
475 + PROMPTOFFSETX, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -11930,18 +11945,18 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
else if (event.type == SDL_MOUSEBUTTONDOWN &&
|
else if (event.type == SDL_MOUSEBUTTONDOWN &&
|
||||||
valid_click(event.button.button))
|
valid_click(event.button.button))
|
||||||
{
|
{
|
||||||
if (event.button.x >= 166 + PROMPTOFFSETX &&
|
if (event.button.x >= btn_left &&
|
||||||
event.button.x < 166 + PROMPTOFFSETX + 48)
|
event.button.x < btn_left + img_yes->w)
|
||||||
{
|
{
|
||||||
if (event.button.y >= 178 + PROMPTOFFSETY &&
|
if (event.button.y >= 178 + PROMPTOFFSETY &&
|
||||||
event.button.y < 178 + PROMPTOFFSETY + 48)
|
event.button.y < 178 + PROMPTOFFSETY + img_yes->h)
|
||||||
{
|
{
|
||||||
ans = 1;
|
ans = 1;
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
else if (strlen(btn_no) != 0 &&
|
else if (strlen(btn_no) != 0 &&
|
||||||
event.button.y >= 230 + PROMPTOFFSETY &&
|
event.button.y >= 230 + PROMPTOFFSETY &&
|
||||||
event.button.y < 230 + PROMPTOFFSETY + 48)
|
event.button.y < 230 + PROMPTOFFSETY + img_no->h)
|
||||||
{
|
{
|
||||||
ans = 0;
|
ans = 0;
|
||||||
done = 1;
|
done = 1;
|
||||||
|
|
@ -11950,13 +11965,13 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
}
|
}
|
||||||
else if (event.type == SDL_MOUSEMOTION)
|
else if (event.type == SDL_MOUSEMOTION)
|
||||||
{
|
{
|
||||||
if (event.button.x >= 166 + PROMPTOFFSETX &&
|
if (event.button.x >= btn_left &&
|
||||||
event.button.x < 166 + 48 + PROMPTOFFSETX &&
|
event.button.x < btn_left + img_yes->w &&
|
||||||
((event.button.y >= 178 + PROMPTOFFSETY &&
|
((event.button.y >= 178 + PROMPTOFFSETY &&
|
||||||
event.button.y < 178 + 48 + PROMPTOFFSETY) ||
|
event.button.y < 178 + img_yes->h + PROMPTOFFSETY) ||
|
||||||
(strlen(btn_no) != 0 &&
|
(strlen(btn_no) != 0 &&
|
||||||
event.button.y >= 230 + PROMPTOFFSETY &&
|
event.button.y >= 230 + PROMPTOFFSETY &&
|
||||||
event.button.y < 230 + 48 + PROMPTOFFSETY)))
|
event.button.y < 230 + img_yes->h + PROMPTOFFSETY)))
|
||||||
{
|
{
|
||||||
do_setcursor(cursor_hand);
|
do_setcursor(cursor_hand);
|
||||||
}
|
}
|
||||||
|
|
@ -11975,7 +11990,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
|
|
||||||
if (counter == 5)
|
if (counter == 5)
|
||||||
{
|
{
|
||||||
dest.x = img_x + (max_img_w - img2->w) / 2;
|
dest.x = img_left + (max_img_w - img2->w) / 2;
|
||||||
dest.y = img_y;
|
dest.y = img_y;
|
||||||
|
|
||||||
SDL_BlitSurface(img2, NULL, screen, &dest);
|
SDL_BlitSurface(img2, NULL, screen, &dest);
|
||||||
|
|
@ -11985,7 +12000,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
{
|
{
|
||||||
if (img3 != NULL)
|
if (img3 != NULL)
|
||||||
{
|
{
|
||||||
dest.x = img_x + (max_img_w - img3->w) / 2;
|
dest.x = img_left + (max_img_w - img3->w) / 2;
|
||||||
dest.y = img_y;
|
dest.y = img_y;
|
||||||
|
|
||||||
SDL_BlitSurface(img3, NULL, screen, &dest);
|
SDL_BlitSurface(img3, NULL, screen, &dest);
|
||||||
|
|
@ -11997,7 +12012,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
||||||
|
|
||||||
if (counter == 15)
|
if (counter == 15)
|
||||||
{
|
{
|
||||||
dest.x = img_x + (max_img_w - img1b->w) / 2;
|
dest.x = img_left + (max_img_w - img1b->w) / 2;
|
||||||
dest.y = img_y;
|
dest.y = img_y;
|
||||||
|
|
||||||
SDL_BlitSurface(img1b, NULL, screen, &dest);
|
SDL_BlitSurface(img1b, NULL, screen, &dest);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue