Ticket #1552: boxes.c.diff
File boxes.c.diff, 3.6 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 int i18n_displays_flag; 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 = 30; 153 static int cancel_start = 40; 152 154 153 155 displays_status = _status; 154 156 155 157 if (!i18n_displays_flag) { 156 int i, l, maxlen = 0; 158 int i, l, maxlen; 159 int ok_size = 6, cancel_size = 4; /* Button extras. */ 160 int button_gap; 157 161 const char *cp; 158 162 159 display_title = _(display_title);163 maxlen = 0; 160 164 for (i = 0; i < LIST_TYPES; i++) { 161 165 displays[i] = _(displays[i]); 162 if ((l = str_term_width1 (displays[i])) > maxlen) 166 l = str_term_width1 (displays[i]); 167 if (l > maxlen) 163 168 maxlen = l; 164 169 } 165 166 i = str_term_width1 (ok_button) + 5; 167 l = str_term_width1 (cancel_button) + 3; 168 l = max (i, l); 169 170 i = maxlen + l + 16; 171 if (i > DISPLAY_X) 172 DISPLAY_X = i; 173 174 i = str_term_width1 (user_mini_status) + 13; 175 if (i > DISPLAY_X) 176 DISPLAY_X = i; 177 178 i = str_term_width1 (display_title) + 10; 179 if (i > DISPLAY_X) 180 DISPLAY_X = i; 181 182 button_start = DISPLAY_X - l - 5; 170 maxlen += 11; 171 if (maxlen > DISPLAY_X) 172 DISPLAY_X = maxlen; 173 174 maxlen = str_term_width1 (user_mini_status) + 11; 175 if (maxlen > DISPLAY_X) 176 DISPLAY_X = maxlen; 177 178 maxlen = str_term_width1 (display_title) + 10; 179 if (maxlen > DISPLAY_X) 180 DISPLAY_X = maxlen; 181 182 ok_size += str_term_width1 (ok_button); 183 cancel_size += str_term_width1 (cancel_button); 184 maxlen = ok_size + cancel_size + 6 ; 185 if (maxlen > DISPLAY_X) 186 DISPLAY_X = maxlen; 187 188 button_gap = ( DISPLAY_X - 10 - ok_size - cancel_size ) / 3; 189 ok_start = button_gap + 5; 190 cancel_start = DISPLAY_X - button_gap - cancel_size - 4; 183 191 184 192 /* get hotkey of user-defined format string */ 185 193 cp = strchr (displays[USER_TYPE], '&'); … … 193 201 DLG_CENTER | DLG_REVERSE); 194 202 195 203 add_widget (dd, 196 button_new ( 4, button_start, B_CANCEL, NORMAL_BUTTON,204 button_new (DISPLAY_Y - 3, cancel_start, B_CANCEL, NORMAL_BUTTON, 197 205 cancel_button, 0)); 198 206 199 207 add_widget (dd, 200 button_new ( 3, button_start, B_ENTER, DEFPUSH_BUTTON,208 button_new (DISPLAY_Y - 3, ok_start, B_ENTER, DEFPUSH_BUTTON, 201 209 ok_button, 0)); 202 210 203 211 status = 204 input_new (10, 9, INPUT_COLOR, DISPLAY_X - 14, _status[radio_sel],212 input_new (10, 8, INPUT_COLOR, DISPLAY_X - 12, _status[radio_sel], 205 213 "mini-input", INPUT_COMPLETE_DEFAULT); 206 214 add_widget (dd, status); 207 215 input_set_point (status, 0); 208 216 209 217 check_status = 210 check_new (9, 5, _check_status, user_mini_status);218 check_new (9, 4, _check_status, user_mini_status); 211 219 add_widget (dd, check_status); 212 220 213 221 user = 214 input_new (7, 9, INPUT_COLOR, DISPLAY_X - 14, init_text,222 input_new (7, 8, INPUT_COLOR, DISPLAY_X - 12, init_text, 215 223 "user-fmt-input", INPUT_COMPLETE_DEFAULT); 216 224 add_widget (dd, user); 217 225 input_set_point (user, 0); 218 226 219 my_radio = radio_new (3, 5, LIST_TYPES, displays);227 my_radio = radio_new (3, 4, LIST_TYPES, displays); 220 228 my_radio->sel = my_radio->pos = current_mode; 221 229 add_widget (dd, my_radio); 222 230 }