[Freeciv-Dev] Re: PATCH: remove of obsolete spaces from options.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
here a suggestion how to change the XAW-Client to allow non-space
padded strings. Only messagedlg.c. Optiondlg.c is missing.
I do not like this solution much, as it uses an array and like the
old way relies on non-proportional fonts. Maybe someone more familiar
with XAW will make a better solution (also for optiondlg.c).
diff -ur ../../freeciv-cvs/freeciv/client/gui-xaw/messagedlg.c
client/gui-xaw/messagedlg.c
--- ../../freeciv-cvs/freeciv/client/gui-xaw/messagedlg.c Sat Aug 19
13:57:31 2000
+++ client/gui-xaw/messagedlg.c Sun Aug 20 09:59:14 2000
@@ -87,9 +87,9 @@
{
Widget shell,form,title,explanation,ok,cancel,col1,col2;
Widget colhead1, colhead2;
- Widget label,last_label=0;
+ Widget long_label = 0, label[E_LAST];
Widget toggle=0;
- int i, j;
+ int i, j, strl = 0;
shell = I_T(XtCreatePopupShell("messageoptpopup",
transientShellWidgetClass,
@@ -126,26 +126,33 @@
for(i=0;i<E_LAST;i++) {
int top_line = (!i || i==E_LAST/2);
int is_col1 = i<E_LAST/2;
- label = XtVaCreateManagedWidget("label",
+ label[i] = XtVaCreateManagedWidget("label",
labelWidgetClass,
is_col1?col1:col2,
XtNlabel, _(message_text[sorted_events[i]]),
XtNfromVert, top_line?
- is_col1?colhead1:colhead2:last_label,
+ is_col1?colhead1:colhead2:label[i-1],
NULL);
+ j = strlen(_(message_text[sorted_events[i]]));
+ if(!i || strl < j)
+ {
+ long_label = label[i]; strl = j;
+ }
+ }
+ for(i=0;i<E_LAST;i++) {
+ int top_line = (!i || i==E_LAST/2);
+ int is_col1 = i<E_LAST/2;
for(j=0; j<NUM_MW; j++) {
toggle = XtVaCreateManagedWidget("toggle",
toggleWidgetClass,
is_col1?col1:col2,
- XtNfromHoriz, (j==0?label:toggle),
+ XtNfromHoriz, (j==0?long_label:toggle),
XtNfromVert, top_line?
- is_col1?colhead1:colhead2:last_label,
+ is_col1?colhead1:colhead2:label[i-1],
NULL);
XtAddCallback(toggle, XtNcallback, toggle_callback, NULL);
messageopt_toggles[sorted_events[i]][j]=toggle;
}
-
- last_label=label;
}
ok = I_L(XtVaCreateManagedWidget("messageoptokcommand",
Ciao
____ _ _ ____ _ _ _ _ ____
| | | | | | \ / | | | the cool Gremlin from Bischofswerda
| __ | ____| | \/ | | | WWW: http://home.pages.de/~stoecker/
| | | | | | | | PGP key available on www page.
|____| _|_ |____| _|_ _|_ |____| I hope AMIGA never ends to make fun!
************************************************************************
* snail-mail: Dirk Stoecker * e-mail: *
* Geschwister-Scholl-Str. 10 * stoecker@xxxxxxxxxxxxxx *
* 01877 Bischofswerda * phone: *
* GERMANY * GERMANY +49 (0)3594/706666 *
************************************************************************
|
|