Mercurial > vim
comparison src/gui_xmdlg.c @ 18788:e1f4e9d78a6a v8.1.2383
patch 8.1.2383: using old C style comments
Commit: https://github.com/vim/vim/commit/734a867ffe198886da7365b618be67ab8ed9d9f6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 2 22:49:38 2019 +0100
patch 8.1.2383: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 02 Dec 2019 23:00:04 +0100 |
parents | 90af0c60d78d |
children | b545334ae654 |
comparison
equal
deleted
inserted
replaced
18787:06ed2fe62dce | 18788:e1f4e9d78a6a |
---|---|
44 # define apply_fontlist(w) gui_motif_menu_fontlist(w) | 44 # define apply_fontlist(w) gui_motif_menu_fontlist(w) |
45 #else | 45 #else |
46 # define apply_fontlist(w) | 46 # define apply_fontlist(w) |
47 #endif | 47 #endif |
48 | 48 |
49 /**************************************************************************** | 49 ///////////////////////////////////////////////////////////////////////////// |
50 * Font selection dialogue implementation. | 50 // Font selection dialogue implementation. |
51 */ | |
52 | 51 |
53 static char wild[3] = "*"; | 52 static char wild[3] = "*"; |
54 | 53 |
55 /* | 54 /* |
56 * FIXME: This is a generic function, which should be used throughout the whole | 55 * FIXME: This is a generic function, which should be used throughout the whole |
66 { | 65 { |
67 static Atom wmp_atom = 0; | 66 static Atom wmp_atom = 0; |
68 static Atom dw_atom = 0; | 67 static Atom dw_atom = 0; |
69 Display *display = XtDisplay(shell); | 68 Display *display = XtDisplay(shell); |
70 | 69 |
71 /* deactivate the built-in delete response of killing the application */ | 70 // deactivate the built-in delete response of killing the application |
72 XtVaSetValues(shell, XmNdeleteResponse, XmDO_NOTHING, NULL); | 71 XtVaSetValues(shell, XmNdeleteResponse, XmDO_NOTHING, NULL); |
73 | 72 |
74 /* add a delete window protocol callback instead */ | 73 // add a delete window protocol callback instead |
75 if (!dw_atom) | 74 if (!dw_atom) |
76 { | 75 { |
77 wmp_atom = XmInternAtom(display, "WM_PROTOCOLS", True); | 76 wmp_atom = XmInternAtom(display, "WM_PROTOCOLS", True); |
78 dw_atom = XmInternAtom(display, "WM_DELETE_WINDOW", True); | 77 dw_atom = XmInternAtom(display, "WM_DELETE_WINDOW", True); |
79 } | 78 } |
103 Widget encoding_pulldown; | 102 Widget encoding_pulldown; |
104 Widget encoding_menu; | 103 Widget encoding_menu; |
105 Widget list[NONE]; | 104 Widget list[NONE]; |
106 Widget name; | 105 Widget name; |
107 Widget sample; | 106 Widget sample; |
108 char **names; /* font name array of arrays */ | 107 char **names; // font name array of arrays |
109 int num; /* number of font names */ | 108 int num; // number of font names |
110 String sel[NONE]; /* selection category */ | 109 String sel[NONE]; // selection category |
111 Boolean in_pixels; /* toggle state - size in pixels */ | 110 Boolean in_pixels; // toggle state - size in pixels |
112 char *font_name; /* current font name */ | 111 char *font_name; // current font name |
113 XFontStruct *old; /* font data structure for sample display */ | 112 XFontStruct *old; // font data structure for sample display |
114 XmFontList old_list; /* font data structure for sample display */ | 113 XmFontList old_list; // font data structure for sample display |
115 Boolean exit; /* used for program exit control */ | 114 Boolean exit; // used for program exit control |
116 } SharedFontSelData; | 115 } SharedFontSelData; |
117 | 116 |
118 /* | 117 /* |
119 * Checking access to the font name array for validity. | 118 * Checking access to the font name array for validity. |
120 */ | 119 */ |
121 static char * | 120 static char * |
122 fn(SharedFontSelData *data, int i) | 121 fn(SharedFontSelData *data, int i) |
123 { | 122 { |
124 /* Assertion checks: */ | 123 // Assertion checks: |
125 if (data->num < 0) | 124 if (data->num < 0) |
126 abort(); | 125 abort(); |
127 if (i >= data->num) | 126 if (i >= data->num) |
128 i = data->num - 1; | 127 i = data->num - 1; |
129 if (i < 0) | 128 if (i < 0) |
277 int j; | 276 int j; |
278 | 277 |
279 if (*count == MAX_ENTRIES_IN_LIST) | 278 if (*count == MAX_ENTRIES_IN_LIST) |
280 return; | 279 return; |
281 | 280 |
282 /* avoid duplication */ | 281 // avoid duplication |
283 for (i = 0; i < *count; ++i) | 282 for (i = 0; i < *count; ++i) |
284 { | 283 { |
285 if (!strcmp(buf[i], item)) | 284 if (!strcmp(buf[i], item)) |
286 return; | 285 return; |
287 } | 286 } |
288 | 287 |
289 /* find order place, but make sure that wild card comes first */ | 288 // find order place, but make sure that wild card comes first |
290 if (!strcmp(item, wild)) | 289 if (!strcmp(item, wild)) |
291 i = 0; | 290 i = 0; |
292 else | 291 else |
293 for (i = 0; i < *count; ++i) | 292 for (i = 0; i < *count; ++i) |
294 if (strcmp(buf[i], item) > 0 && strcmp(buf[i], wild)) | 293 if (strcmp(buf[i], item) > 0 && strcmp(buf[i], wild)) |
295 break; | 294 break; |
296 | 295 |
297 /* now insert the item */ | 296 // now insert the item |
298 for (j = *count; j > i; --j) | 297 for (j = *count; j > i; --j) |
299 buf[j] = buf[j-1]; | 298 buf[j] = buf[j-1]; |
300 buf[i] = XtNewString(item); | 299 buf[i] = XtNewString(item); |
301 | 300 |
302 ++(*count); | 301 ++(*count); |
308 static Boolean | 307 static Boolean |
309 match(SharedFontSelData *data, enum ListSpecifier l, int i) | 308 match(SharedFontSelData *data, enum ListSpecifier l, int i) |
310 { | 309 { |
311 char buf[TEMP_BUF_SIZE]; | 310 char buf[TEMP_BUF_SIZE]; |
312 | 311 |
313 /* An empty selection or a wild card matches anything. | 312 // An empty selection or a wild card matches anything. |
314 */ | |
315 if (!data->sel[l] || !strcmp(data->sel[l], wild)) | 313 if (!data->sel[l] || !strcmp(data->sel[l], wild)) |
316 return True; | 314 return True; |
317 | 315 |
318 /* chunk out the desired part... */ | 316 // chunk out the desired part... |
319 switch (l) | 317 switch (l) |
320 { | 318 { |
321 case ENCODING: | 319 case ENCODING: |
322 encoding_part(fn(data, i), buf); | 320 encoding_part(fn(data, i), buf); |
323 break; | 321 break; |
335 break; | 333 break; |
336 default: | 334 default: |
337 ; | 335 ; |
338 } | 336 } |
339 | 337 |
340 /* ...and chew it now */ | 338 // ...and chew it now |
341 | 339 |
342 return !strcmp(buf, data->sel[l]); | 340 return !strcmp(buf, data->sel[l]); |
343 } | 341 } |
344 | 342 |
345 static Boolean | 343 static Boolean |
372 int idx; | 370 int idx; |
373 | 371 |
374 for (idx = (int)ENCODING; idx < (int)NONE; ++idx) | 372 for (idx = (int)ENCODING; idx < (int)NONE; ++idx) |
375 count[idx] = 0; | 373 count[idx] = 0; |
376 | 374 |
377 /* First we insert the wild char into every single list. */ | 375 // First we insert the wild char into every single list. |
378 if (fix != ENCODING) | 376 if (fix != ENCODING) |
379 add_to_list(list[ENCODING], wild, &count[ENCODING]); | 377 add_to_list(list[ENCODING], wild, &count[ENCODING]); |
380 if (fix != NAME) | 378 if (fix != NAME) |
381 add_to_list(list[NAME], wild, &count[NAME]); | 379 add_to_list(list[NAME], wild, &count[NAME]); |
382 if (fix != STYLE) | 380 if (fix != STYLE) |
434 { | 432 { |
435 Cardinal n_items; | 433 Cardinal n_items; |
436 WidgetList children; | 434 WidgetList children; |
437 Widget selected_button = 0; | 435 Widget selected_button = 0; |
438 | 436 |
439 /* Get and update the current button list. */ | 437 // Get and update the current button list. |
440 XtVaGetValues(data->encoding_pulldown, | 438 XtVaGetValues(data->encoding_pulldown, |
441 XmNchildren, &children, | 439 XmNchildren, &children, |
442 XmNnumChildren, &n_items, | 440 XmNnumChildren, &n_items, |
443 NULL); | 441 NULL); |
444 | 442 |
448 | 446 |
449 items[i] = XmStringCreateLocalized(list[ENCODING][i]); | 447 items[i] = XmStringCreateLocalized(list[ENCODING][i]); |
450 | 448 |
451 if (i < (int)n_items) | 449 if (i < (int)n_items) |
452 { | 450 { |
453 /* recycle old button */ | 451 // recycle old button |
454 XtVaSetValues(children[i], | 452 XtVaSetValues(children[i], |
455 XmNlabelString, items[i], | 453 XmNlabelString, items[i], |
456 XmNuserData, i, | 454 XmNuserData, i, |
457 NULL); | 455 NULL); |
458 button = children[i]; | 456 button = children[i]; |
459 } | 457 } |
460 else | 458 else |
461 { | 459 { |
462 /* create a new button */ | 460 // create a new button |
463 button = XtVaCreateManagedWidget("button", | 461 button = XtVaCreateManagedWidget("button", |
464 xmPushButtonGadgetClass, | 462 xmPushButtonGadgetClass, |
465 data->encoding_pulldown, | 463 data->encoding_pulldown, |
466 XmNlabelString, items[i], | 464 XmNlabelString, items[i], |
467 XmNuserData, i, | 465 XmNuserData, i, |
477 selected_button = button; | 475 selected_button = button; |
478 } | 476 } |
479 XtFree(list[ENCODING][i]); | 477 XtFree(list[ENCODING][i]); |
480 } | 478 } |
481 | 479 |
482 /* Destroy all the outstanding menu items. | 480 // Destroy all the outstanding menu items. |
483 */ | |
484 for (i = count[ENCODING]; i < (int)n_items; ++i) | 481 for (i = count[ENCODING]; i < (int)n_items; ++i) |
485 { | 482 { |
486 XtUnmanageChild(children[i]); | 483 XtUnmanageChild(children[i]); |
487 XtDestroyWidget(children[i]); | 484 XtDestroyWidget(children[i]); |
488 } | 485 } |
489 | 486 |
490 /* Preserve the current selection visually. | 487 // Preserve the current selection visually. |
491 */ | |
492 if (selected_button) | 488 if (selected_button) |
493 { | 489 { |
494 XtVaSetValues(data->encoding_menu, | 490 XtVaSetValues(data->encoding_menu, |
495 XmNmenuHistory, selected_button, | 491 XmNmenuHistory, selected_button, |
496 NULL); | 492 NULL); |
520 break; | 516 break; |
521 case SIZE: | 517 case SIZE: |
522 w = data->list[SIZE]; | 518 w = data->list[SIZE]; |
523 break; | 519 break; |
524 default: | 520 default: |
525 w = (Widget)0; /* for lint */ | 521 w = (Widget)0; // for lint |
526 } | 522 } |
527 | 523 |
528 for (i = 0; i < count[idx]; ++i) | 524 for (i = 0; i < count[idx]; ++i) |
529 { | 525 { |
530 items[i] = XmStringCreateLocalized(list[idx][i]); | 526 items[i] = XmStringCreateLocalized(list[idx][i]); |
633 data->sel[which] = XtNewString(sel); | 629 data->sel[which] = XtNewString(sel); |
634 else | 630 else |
635 { | 631 { |
636 if (!strcmp(data->sel[which], sel)) | 632 if (!strcmp(data->sel[which], sel)) |
637 { | 633 { |
638 /* unselecting current selection */ | 634 // unselecting current selection |
639 XtFree(data->sel[which]); | 635 XtFree(data->sel[which]); |
640 data->sel[which] = NULL; | 636 data->sel[which] = NULL; |
641 if (w) | 637 if (w) |
642 XmListDeselectItem(w, call_data->item); | 638 XmListDeselectItem(w, call_data->item); |
643 } | 639 } |
649 } | 645 } |
650 XtFree(sel); | 646 XtFree(sel); |
651 | 647 |
652 fill_lists(which, data); | 648 fill_lists(which, data); |
653 | 649 |
654 /* If there is a font selection, we display it. */ | 650 // If there is a font selection, we display it. |
655 if (data->sel[ENCODING] | 651 if (data->sel[ENCODING] |
656 && data->sel[NAME] | 652 && data->sel[NAME] |
657 && data->sel[STYLE] | 653 && data->sel[STYLE] |
658 && data->sel[SIZE] | 654 && data->sel[SIZE] |
659 && strcmp(data->sel[ENCODING], wild) | 655 && strcmp(data->sel[ENCODING], wild) |
902 strcpy(big_font, fn(data, idx)); | 898 strcpy(big_font, fn(data, idx)); |
903 } | 899 } |
904 data->old = XLoadQueryFont(XtDisplay(parent), big_font); | 900 data->old = XLoadQueryFont(XtDisplay(parent), big_font); |
905 data->old_list = gui_motif_create_fontlist(data->old); | 901 data->old_list = gui_motif_create_fontlist(data->old); |
906 | 902 |
907 /* Set the title of the Dialog window. */ | 903 // Set the title of the Dialog window. |
908 data->dialog = XmCreateDialogShell(parent, "fontSelector", NULL, 0); | 904 data->dialog = XmCreateDialogShell(parent, "fontSelector", NULL, 0); |
909 str = XmStringCreateLocalized(_("Vim - Font Selector")); | 905 str = XmStringCreateLocalized(_("Vim - Font Selector")); |
910 | 906 |
911 /* Create form popup dialog widget. */ | 907 // Create form popup dialog widget. |
912 form = XtVaCreateWidget("form", | 908 form = XtVaCreateWidget("form", |
913 xmFormWidgetClass, data->dialog, | 909 xmFormWidgetClass, data->dialog, |
914 XmNdialogTitle, str, | 910 XmNdialogTitle, str, |
915 XmNautoUnmanage, False, | 911 XmNautoUnmanage, False, |
916 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL, | 912 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL, |
946 XmNtopOffset, 4, | 942 XmNtopOffset, 4, |
947 XmNshowAsDefault, True, | 943 XmNshowAsDefault, True, |
948 NULL); | 944 NULL); |
949 apply_fontlist(data->cancel); | 945 apply_fontlist(data->cancel); |
950 | 946 |
951 /* Create the separator for beauty. */ | 947 // Create the separator for beauty. |
952 n = 0; | 948 n = 0; |
953 XtSetArg(args[n], XmNorientation, XmVERTICAL); n++; | 949 XtSetArg(args[n], XmNorientation, XmVERTICAL); n++; |
954 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; | 950 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; |
955 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; | 951 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; |
956 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; | 952 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; |
957 XtSetArg(args[n], XmNrightWidget, sub_form); n++; | 953 XtSetArg(args[n], XmNrightWidget, sub_form); n++; |
958 XtSetArg(args[n], XmNrightOffset, 4); n++; | 954 XtSetArg(args[n], XmNrightOffset, 4); n++; |
959 separator = XmCreateSeparatorGadget(form, "separator", args, n); | 955 separator = XmCreateSeparatorGadget(form, "separator", args, n); |
960 XtManageChild(separator); | 956 XtManageChild(separator); |
961 | 957 |
962 /* Create font name text widget and the corresponding label. */ | 958 // Create font name text widget and the corresponding label. |
963 data->name = XtVaCreateManagedWidget("fontName", | 959 data->name = XtVaCreateManagedWidget("fontName", |
964 xmTextWidgetClass, form, | 960 xmTextWidgetClass, form, |
965 XmNbottomAttachment, XmATTACH_FORM, | 961 XmNbottomAttachment, XmATTACH_FORM, |
966 XmNbottomOffset, 4, | 962 XmNbottomOffset, 4, |
967 XmNleftAttachment, XmATTACH_FORM, | 963 XmNleftAttachment, XmATTACH_FORM, |
987 XmNtopOffset, 1, | 983 XmNtopOffset, 1, |
988 NULL); | 984 NULL); |
989 XmStringFree(str); | 985 XmStringFree(str); |
990 apply_fontlist(name); | 986 apply_fontlist(name); |
991 | 987 |
992 /* create sample display label widget */ | 988 // create sample display label widget |
993 disp_frame = XtVaCreateManagedWidget("sampleFrame", | 989 disp_frame = XtVaCreateManagedWidget("sampleFrame", |
994 xmFrameWidgetClass, form, | 990 xmFrameWidgetClass, form, |
995 XmNshadowType, XmSHADOW_ETCHED_IN, | 991 XmNshadowType, XmSHADOW_ETCHED_IN, |
996 XmNleftAttachment, XmATTACH_FORM, | 992 XmNleftAttachment, XmATTACH_FORM, |
997 XmNleftOffset, 4, | 993 XmNleftOffset, 4, |
1012 XmNalignment, XmALIGNMENT_BEGINNING, | 1008 XmNalignment, XmALIGNMENT_BEGINNING, |
1013 XmNrecomputeSize, False, | 1009 XmNrecomputeSize, False, |
1014 XmNfontList, data->old_list, | 1010 XmNfontList, data->old_list, |
1015 NULL); | 1011 NULL); |
1016 | 1012 |
1017 /* create toggle button */ | 1013 // create toggle button |
1018 str = XmStringCreateLocalized(_("Show size in Points")); | 1014 str = XmStringCreateLocalized(_("Show size in Points")); |
1019 size_toggle = XtVaCreateManagedWidget("sizeToggle", | 1015 size_toggle = XtVaCreateManagedWidget("sizeToggle", |
1020 xmToggleButtonGadgetClass, form, | 1016 xmToggleButtonGadgetClass, form, |
1021 XmNlabelString, str, | 1017 XmNlabelString, str, |
1022 XmNleftAttachment, XmATTACH_FORM, | 1018 XmNleftAttachment, XmATTACH_FORM, |
1027 NULL); | 1023 NULL); |
1028 XmStringFree(str); | 1024 XmStringFree(str); |
1029 apply_fontlist(size_toggle); | 1025 apply_fontlist(size_toggle); |
1030 XtManageChild(size_toggle); | 1026 XtManageChild(size_toggle); |
1031 | 1027 |
1032 /* Encoding pulldown menu. | 1028 // Encoding pulldown menu. |
1033 */ | |
1034 | 1029 |
1035 data->encoding_pulldown = XmCreatePulldownMenu(form, | 1030 data->encoding_pulldown = XmCreatePulldownMenu(form, |
1036 "encodingPulldown", NULL, 0); | 1031 "encodingPulldown", NULL, 0); |
1037 str = XmStringCreateLocalized(_("Encoding:")); | 1032 str = XmStringCreateLocalized(_("Encoding:")); |
1038 n = 0; | 1033 n = 0; |
1068 XmNtopAttachment, XmATTACH_FORM, | 1063 XmNtopAttachment, XmATTACH_FORM, |
1069 XmNtopOffset, 2, | 1064 XmNtopOffset, 2, |
1070 XmNorientation, XmVERTICAL, | 1065 XmNorientation, XmVERTICAL, |
1071 NULL); | 1066 NULL); |
1072 | 1067 |
1073 /* font list */ | 1068 // font list |
1074 frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form, | 1069 frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form, |
1075 XmNshadowThickness, 0, | 1070 XmNshadowThickness, 0, |
1076 XmNtopAttachment, XmATTACH_FORM, | 1071 XmNtopAttachment, XmATTACH_FORM, |
1077 XmNbottomAttachment, XmATTACH_FORM, | 1072 XmNbottomAttachment, XmATTACH_FORM, |
1078 XmNleftAttachment, XmATTACH_FORM, | 1073 XmNleftAttachment, XmATTACH_FORM, |
1099 XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC); ++n; | 1094 XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC); ++n; |
1100 #endif | 1095 #endif |
1101 data->list[NAME] = XmCreateScrolledList(frame, "fontList", args, n); | 1096 data->list[NAME] = XmCreateScrolledList(frame, "fontList", args, n); |
1102 XtVaSetValues(name, XmNuserData, data->list[NAME], NULL); | 1097 XtVaSetValues(name, XmNuserData, data->list[NAME], NULL); |
1103 | 1098 |
1104 /* style list */ | 1099 // style list |
1105 frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form, | 1100 frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form, |
1106 XmNshadowThickness, 0, | 1101 XmNshadowThickness, 0, |
1107 XmNtopAttachment, XmATTACH_FORM, | 1102 XmNtopAttachment, XmATTACH_FORM, |
1108 XmNbottomAttachment, XmATTACH_FORM, | 1103 XmNbottomAttachment, XmATTACH_FORM, |
1109 XmNleftAttachment, XmATTACH_POSITION, | 1104 XmNleftAttachment, XmATTACH_POSITION, |
1132 XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC); ++n; | 1127 XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC); ++n; |
1133 #endif | 1128 #endif |
1134 data->list[STYLE] = XmCreateScrolledList(frame, "styleList", args, n); | 1129 data->list[STYLE] = XmCreateScrolledList(frame, "styleList", args, n); |
1135 XtVaSetValues(name, XmNuserData, data->list[STYLE], NULL); | 1130 XtVaSetValues(name, XmNuserData, data->list[STYLE], NULL); |
1136 | 1131 |
1137 /* size list */ | 1132 // size list |
1138 frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form, | 1133 frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, sub_form, |
1139 XmNshadowThickness, 0, | 1134 XmNshadowThickness, 0, |
1140 XmNtopAttachment, XmATTACH_FORM, | 1135 XmNtopAttachment, XmATTACH_FORM, |
1141 XmNbottomAttachment, XmATTACH_FORM, | 1136 XmNbottomAttachment, XmATTACH_FORM, |
1142 XmNleftAttachment, XmATTACH_POSITION, | 1137 XmNleftAttachment, XmATTACH_POSITION, |
1164 XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC); ++n; | 1159 XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC); ++n; |
1165 #endif | 1160 #endif |
1166 data->list[SIZE] = XmCreateScrolledList(frame, "sizeList", args, n); | 1161 data->list[SIZE] = XmCreateScrolledList(frame, "sizeList", args, n); |
1167 XtVaSetValues(name, XmNuserData, data->list[SIZE], NULL); | 1162 XtVaSetValues(name, XmNuserData, data->list[SIZE], NULL); |
1168 | 1163 |
1169 /* update form widgets cancel button */ | 1164 // update form widgets cancel button |
1170 XtVaSetValues(form, XmNcancelButton, data->cancel, NULL); | 1165 XtVaSetValues(form, XmNcancelButton, data->cancel, NULL); |
1171 | 1166 |
1172 XtAddCallback(size_toggle, XmNvalueChangedCallback, | 1167 XtAddCallback(size_toggle, XmNvalueChangedCallback, |
1173 (XtCallbackProc)stoggle_callback, (XtPointer)data); | 1168 (XtCallbackProc)stoggle_callback, (XtPointer)data); |
1174 XtAddCallback(data->list[NAME], XmNbrowseSelectionCallback, | 1169 XtAddCallback(data->list[NAME], XmNbrowseSelectionCallback, |
1182 XtAddCallback(data->cancel, XmNactivateCallback, | 1177 XtAddCallback(data->cancel, XmNactivateCallback, |
1183 (XtCallbackProc)cancel_callback, (XtPointer)data); | 1178 (XtCallbackProc)cancel_callback, (XtPointer)data); |
1184 | 1179 |
1185 XmProcessTraversal(data->list[NAME], XmTRAVERSE_CURRENT); | 1180 XmProcessTraversal(data->list[NAME], XmTRAVERSE_CURRENT); |
1186 | 1181 |
1187 /* setup tabgroups */ | 1182 // setup tabgroups |
1188 | 1183 |
1189 XmAddTabGroup(data->list[NAME]); | 1184 XmAddTabGroup(data->list[NAME]); |
1190 XmAddTabGroup(data->list[STYLE]); | 1185 XmAddTabGroup(data->list[STYLE]); |
1191 XmAddTabGroup(data->list[SIZE]); | 1186 XmAddTabGroup(data->list[SIZE]); |
1192 XmAddTabGroup(size_toggle); | 1187 XmAddTabGroup(size_toggle); |
1194 XmAddTabGroup(data->ok); | 1189 XmAddTabGroup(data->ok); |
1195 XmAddTabGroup(data->cancel); | 1190 XmAddTabGroup(data->cancel); |
1196 | 1191 |
1197 add_cancel_action(data->dialog, (XtCallbackProc)cancel_callback, data); | 1192 add_cancel_action(data->dialog, (XtCallbackProc)cancel_callback, data); |
1198 | 1193 |
1199 /* Preset selection data. */ | 1194 // Preset selection data. |
1200 | 1195 |
1201 data->exit = False; | 1196 data->exit = False; |
1202 data->in_pixels= True; | 1197 data->in_pixels= True; |
1203 data->sel[ENCODING] = NULL; | 1198 data->sel[ENCODING] = NULL; |
1204 data->sel[NAME] = NULL; | 1199 data->sel[NAME] = NULL; |
1205 data->sel[STYLE] = NULL; | 1200 data->sel[STYLE] = NULL; |
1206 data->sel[SIZE] = NULL; | 1201 data->sel[SIZE] = NULL; |
1207 data->font_name = NULL; | 1202 data->font_name = NULL; |
1208 | 1203 |
1209 /* set up current font parameters */ | 1204 // set up current font parameters |
1210 if (current && current[0] != '\0') | 1205 if (current && current[0] != '\0') |
1211 { | 1206 { |
1212 int i; | 1207 int i; |
1213 char **names; | 1208 char **names; |
1214 | 1209 |
1242 display_sample(data); | 1237 display_sample(data); |
1243 XmTextSetString(data->name, data->font_name); | 1238 XmTextSetString(data->name, data->font_name); |
1244 } | 1239 } |
1245 else | 1240 else |
1246 { | 1241 { |
1247 /* We can't preset a symbolic name, which isn't a full font | 1242 // We can't preset a symbolic name, which isn't a full font |
1248 * description. Therefore we just behave the same way as if the | 1243 // description. Therefore we just behave the same way as if the |
1249 * user didn't have selected anything thus far. | 1244 // user didn't have selected anything thus far. |
1250 * | 1245 // |
1251 * Unfortunately there is no known way to expand an abbreviated | 1246 // Unfortunately there is no known way to expand an abbreviated |
1252 * font name. | 1247 // font name. |
1253 */ | |
1254 | |
1255 data->font_name = NULL; | 1248 data->font_name = NULL; |
1256 } | 1249 } |
1257 } | 1250 } |
1258 XFreeFontNames(names); | 1251 XFreeFontNames(names); |
1259 } | 1252 } |
1260 | 1253 |
1261 fill_lists(NONE, data); | 1254 fill_lists(NONE, data); |
1262 | 1255 |
1263 /* Unfortunately LessTif doesn't align the list widget's properly. I don't | 1256 // Unfortunately LessTif doesn't align the list widget's properly. I don't |
1264 * have currently any idea how to fix this problem. | 1257 // have currently any idea how to fix this problem. |
1265 */ | |
1266 XtManageChild(data->list[NAME]); | 1258 XtManageChild(data->list[NAME]); |
1267 XtManageChild(data->list[STYLE]); | 1259 XtManageChild(data->list[STYLE]); |
1268 XtManageChild(data->list[SIZE]); | 1260 XtManageChild(data->list[SIZE]); |
1269 XtManageChild(data->encoding_menu); | 1261 XtManageChild(data->encoding_menu); |
1270 manage_centered(form); | 1262 manage_centered(form); |
1271 | 1263 |
1272 /* modal event loop */ | 1264 // modal event loop |
1273 while (!data->exit) | 1265 while (!data->exit) |
1274 XtAppProcessEvent(XtWidgetToApplicationContext(data->dialog), | 1266 XtAppProcessEvent(XtWidgetToApplicationContext(data->dialog), |
1275 (XtInputMask)XtIMAll); | 1267 (XtInputMask)XtIMAll); |
1276 | 1268 |
1277 if (data->old) | 1269 if (data->old) |