diff options
author | jcid <devnull@localhost> | 2008-09-21 19:50:16 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-09-21 19:50:16 +0200 |
commit | 5b3d1e2e437423d9f144caf5121a6d48bd14bef8 (patch) | |
tree | 9d815da9cf02ead01fadca04f255ba697050639b /src | |
parent | c4c1f249911ed6dca7bacfe3d7a854eb9aa452d1 (diff) |
- Some i18n in view source and tab labels.
Diffstat (limited to 'src')
-rw-r--r-- | src/dialog.cc | 3 | ||||
-rw-r--r-- | src/ui.cc | 16 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/dialog.cc b/src/dialog.cc index 167ab38d..0adb1d1a 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -125,6 +125,7 @@ void *a_Dialog_make_text_window(const char *txt, const char *title) //int wh = 600, ww = 650, bh = 30; int wh = prefs.height, ww = prefs.width, bh = 30; int lines, line_num_width; + Font *textfont = font(prefs.fw_fontname, 0); Window *window = new Window(ww, wh, title ? title : "Untitled"); window->callback(window_close_cb, window); @@ -135,6 +136,8 @@ void *a_Dialog_make_text_window(const char *txt, const char *title) /* enable wrapping lines; text uses entire width of window */ td->wrap_mode(true, 0); + if (textfont) + td->textfont(textfont); td->textsize((int) rint(13.0 * prefs.font_factor)); fltk::setfont(td->textfont(), td->textsize()); @@ -19,6 +19,7 @@ #include <fltk/damage.h> #include <fltk/xpmImage.h> #include <fltk/events.h> // for mouse buttons and keys +#include <fltk/Font.h> // UI label font for tabs #include <fltk/InvisibleBox.h> #include <fltk/PopupMenu.h> #include <fltk/Item.h> @@ -607,6 +608,10 @@ UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) : { int s_h = 20; + Font *f = font(prefs.vw_fontname, 0); + if (f) + this->labelfont(f); + Tabs = NULL; TabTooltip = NULL; TopGroup = new PackedGroup(0, 0, ww, wh); @@ -1081,10 +1086,17 @@ void UI::set_page_title(const char *label) this->window()->redraw_label(); if (tabs() && *label) { - const size_t tab_chars = 18; + size_t tab_chars = 18; snprintf(title, tab_chars + 1, "%s", label); - if (strlen(label) > tab_chars) + if (strlen(label) > tab_chars) { + while (label[tab_chars] & 0x80 && !(label[tab_chars] & 0x40) && + tab_chars < 23) { + // In the middle of a multibyte UTF-8 character. + title[tab_chars] = label[tab_chars]; + tab_chars++; + } snprintf(title + tab_chars, 4, "..."); + } this->copy_label(title); this->redraw_label(); |