Ticket #1552: boxes2.c.diff
File boxes2.c.diff, 3.4 KB (added by dmartina, 15 years ago) |
---|
-
src/boxes.c
old new 68 68 #include "../vfs/gc.h" 69 69 #endif 70 70 71 static int DISPLAY_X = 45, DISPLAY_Y = 14;72 71 73 72 static Dlg_head *dd; 74 73 static WRadio *my_radio; … … 142 141 display_init (int radio_sel, char *init_text, int _check_status, 143 142 char **_status) 144 143 { 145 static const char *display_title = N_("Listing mode"); 144 static int DISPLAY_X = 48, DISPLAY_Y = 15; 145 146 146 static gboolean i18n_displays_flag = FALSE; 147 const char *display_title = _("Listing mode"); 147 148 const char *user_mini_status = _("user &Mini status"); 148 149 const char *ok_button = _("&OK"); 149 150 const char *cancel_button = _("&Cancel"); 150 151 151 static int button_start = 30;152 static int ok_start, cancel_start; 152 153 153 154 displays_status = _status; 154 155 155 156 if (!i18n_displays_flag) { 156 int i, l, maxlen = 0; 157 int i, maxlen; 158 int ok_size = 6, cancel_size = 4; /* Button extras. */ 159 int button_gap; 157 160 const char *cp; 158 161 159 display_title = _(display_title);162 maxlen = 0; 160 163 for (i = 0; i < LIST_TYPES; i++) { 161 164 #ifdef ENABLE_NLS 162 165 displays[i] = _(displays[i]); … … 164 167 maxlen = max (maxlen, str_term_width1 (displays[i])); 165 168 } 166 169 167 l = max (str_term_width1 (ok_button) + 5, str_term_width1 (cancel_button) + 3); 168 DISPLAY_X = max (DISPLAY_X, maxlen + l + 16); 169 DISPLAY_X = max (DISPLAY_X, str_term_width1 (user_mini_status) + 13); 170 DISPLAY_X = max (DISPLAY_X, str_term_width1 (display_title) + 10); 171 button_start = DISPLAY_X - l - 5; 170 maxlen += 11; 171 DISPLAY_X = max (maxlen, DISPLAY_X); 172 173 maxlen = str_term_width1 (user_mini_status) + 11; 174 DISPLAY_X = max (maxlen, DISPLAY_X); 175 176 maxlen = str_term_width1 (display_title) + 10; 177 DISPLAY_X = max (maxlen, DISPLAY_X); 178 179 ok_size += str_term_width1 (ok_button); 180 cancel_size += str_term_width1 (cancel_button); 181 maxlen = ok_size + cancel_size + 6 ; 182 DISPLAY_X = max (maxlen, DISPLAY_X); 183 184 button_gap = ( DISPLAY_X - 10 - ok_size - cancel_size ) / 3; 185 ok_start = button_gap + 5; 186 cancel_start = DISPLAY_X - button_gap - cancel_size - 4; 172 187 173 188 /* get hotkey of user-defined format string */ 174 189 cp = strchr (displays[USER_TYPE], '&'); … … 183 198 DLG_CENTER | DLG_REVERSE); 184 199 185 200 add_widget (dd, 186 button_new ( 4, button_start, B_CANCEL, NORMAL_BUTTON,201 button_new (DISPLAY_Y - 3, cancel_start, B_CANCEL, NORMAL_BUTTON, 187 202 cancel_button, 0)); 188 203 189 204 add_widget (dd, 190 button_new ( 3, button_start, B_ENTER, DEFPUSH_BUTTON,205 button_new (DISPLAY_Y - 3, ok_start, B_ENTER, DEFPUSH_BUTTON, 191 206 ok_button, 0)); 192 207 193 208 status = 194 input_new (10, 9, INPUT_COLOR, DISPLAY_X - 14, _status[radio_sel],209 input_new (10, 8, INPUT_COLOR, DISPLAY_X - 12, _status[radio_sel], 195 210 "mini-input", INPUT_COMPLETE_DEFAULT); 196 211 add_widget (dd, status); 197 212 input_set_point (status, 0); 198 213 199 214 check_status = 200 check_new (9, 5, _check_status, user_mini_status);215 check_new (9, 4, _check_status, user_mini_status); 201 216 add_widget (dd, check_status); 202 217 203 218 user = 204 input_new (7, 9, INPUT_COLOR, DISPLAY_X - 14, init_text,219 input_new (7, 8, INPUT_COLOR, DISPLAY_X - 12, init_text, 205 220 "user-fmt-input", INPUT_COMPLETE_DEFAULT); 206 221 add_widget (dd, user); 207 222 input_set_point (user, 0); 208 223 209 my_radio = radio_new (3, 5, LIST_TYPES, displays);224 my_radio = radio_new (3, 4, LIST_TYPES, displays); 210 225 my_radio->sel = my_radio->pos = current_mode; 211 226 add_widget (dd, my_radio); 212 227 }