From 854918c1f8ca379db2a6bb1a619baed72de26527 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sat, 28 Jul 2001 14:52:05 +0000 Subject: [PATCH] * editcmd.c (menu_save_mode_cmd): Resurrect i18n code lost in the last resync with Cooledit. Reported by David Martin --- gtkedit/ChangeLog | 4 ++++ gtkedit/editcmd.c | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gtkedit/ChangeLog b/gtkedit/ChangeLog index 468f17e8c..d1348977d 100644 --- a/gtkedit/ChangeLog +++ b/gtkedit/ChangeLog @@ -1,5 +1,9 @@ 2001-07-28 Pavel Roskin + * editcmd.c (menu_save_mode_cmd): Resurrect i18n code lost in + the last resync with Cooledit. + Reported by David Martin + * gtkedit.c (gtk_edit_delete_cb): Handler for "delete_event". (edit): Connect it. diff --git a/gtkedit/editcmd.c b/gtkedit/editcmd.c index 5b181e30d..106e9e6d5 100644 --- a/gtkedit/editcmd.c +++ b/gtkedit/editcmd.c @@ -409,10 +409,33 @@ void menu_save_mode_cmd (void) if (!i18n_flag) { int i; + int maxlen = 0; + int dlg_x; + int l1; + + /* Ok/Cancel buttons */ + l1 = strlen (_(widgets[0].text)) + strlen (_(widgets[1].text)) + 5; + maxlen = max (maxlen, l1); - for (i = 0; i < 3; i++ ) + for (i = 0; i < 3; i++ ) { str[i] = _(str[i]); + maxlen = max (maxlen, strlen (str[i]) + 7); + } i18n_flag = 1; + + dlg_x = maxlen + strlen (_(widgets[3].text)) + 5 + 1; + widgets[2].hotkey_pos = strlen (_(widgets[3].text)); /* input field length */ + dlg_x = min (COLS, dlg_x); + dialog.xlen = dlg_x; + + i = (dlg_x - l1)/3; + widgets[1].relative_x = i; + widgets[0].relative_x = i + strlen (_(widgets[1].text)) + i + 4; + + widgets[2].relative_x = widgets[3].relative_x = maxlen + 2; + + for (i = 0; i < sizeof (widgets)/sizeof (widgets[0]); i++) + widgets[i].x_divisions = dlg_x; } widgets[2].text = option_backup_ext;