1 static const char CVSID
[] = "$Id: windowTitle.c,v 1.8 2002/07/11 21:18:12 slobasso Exp $";
2 /*******************************************************************************
4 * windowTitle.c -- Nirvana Editor window title customization *
6 * Copyright (C) 2001, Arne Forlie *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
13 * This software is distributed in the hope that it will be useful, but WITHOUT *
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
18 * You should have received a copy of the GNU General Public License along with *
19 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
20 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * Nirvana Text Editor *
25 * Written by Arne Forlie, http://arne.forlie.com *
27 *******************************************************************************/
30 #include "../config.h"
33 #include "windowTitle.h"
36 #include "preferences.h"
38 #include "../util/prefFile.h"
39 #include "../util/misc.h"
40 #include "../util/DialogF.h"
41 #include "../util/utils.h"
42 #include "../util/fileUtils.h"
49 #include "../util/VMSparam.h"
52 #include <sys/param.h>
54 #include "../util/clearcase.h"
58 #include <Xm/SelectioB.h>
61 #include <Xm/SeparatoG.h>
62 #include <Xm/LabelG.h>
63 #include <Xm/PushBG.h>
65 #include <Xm/ToggleBG.h>
66 #include <Xm/ToggleB.h>
67 #include <Xm/RowColumn.h>
68 #include <Xm/CascadeBG.h>
78 #define WINDOWTITLE_MAX_LEN 500
80 /* Customize window title dialog information */
102 Widget oFileChangedW
;
104 Widget oFileReadOnlyW
;
105 Widget oServerEqualViewW
;
107 char filename
[MAXPATHLEN
];
108 char path
[MAXPATHLEN
];
109 char viewTag
[MAXPATHLEN
];
110 char serverName
[MAXPATHLEN
];
116 int suppressFormatUpdate
;
121 static char* removeSequence(char* sourcePtr
, char c
)
123 while (*sourcePtr
== c
) {
131 ** Two functions for performing safe insertions into a finite
132 ** size buffer so that we don't get any memory overruns.
134 static char* safeStrCpy(char* dest
, char* destEnd
, const char* source
)
136 int len
= (int)strlen(source
);
137 if (len
<= (destEnd
- dest
)) {
138 strcpy(dest
, source
);
142 strncpy(dest
, source
, destEnd
- dest
);
148 static char* safeCharAdd(char* dest
, char* destEnd
, char c
)
150 if (destEnd
- dest
> 0)
159 ** Remove empty paranthesis pairs and multiple spaces in a row
161 ** Also remove leading and trailing spaces and dashes.
163 static void compressWindowTitle(char *title
)
165 /* Compress the title */
168 char *sourcePtr
= title
;
169 char *destPtr
= sourcePtr
;
170 char c
= *sourcePtr
++;
174 /* Remove leading spaces and dashes */
175 while (c
== ' ' || c
== '-') {
179 /* Remove empty constructs */
182 /* remove sequences */
185 sourcePtr
= removeSequence(sourcePtr
, c
);
186 *destPtr
++ = c
; /* leave one */
189 /* remove empty paranthesis pairs */
191 if (*sourcePtr
== ')') {
196 sourcePtr
= removeSequence(sourcePtr
, ' ');
200 if (*sourcePtr
== ']') {
205 sourcePtr
= removeSequence(sourcePtr
, ' ');
209 if (*sourcePtr
== '}') {
214 sourcePtr
= removeSequence(sourcePtr
, ' ');
225 /* Remove trailing spaces and dashes */
226 while (destPtr
-- > title
) {
227 if (*destPtr
!= ' ' && *destPtr
!= '-')
231 } while (modified
== True
);
236 ** Format the windows title using a printf like formatting string.
237 ** The following flags are recognised:
238 ** %c : ClearCase view tag
240 ** %[n]d : directory, with one optional digit specifying the max number
241 ** of trailing directory components to display. Skipped components are
242 ** replaced by an ellipsis (...).
248 ** if the ClearCase view tag and server name are identical, only the first one
249 ** specified in the formatting string will be displayed.
251 char *FormatWindowTitle(const char* filename
,
253 const char* clearCaseViewTag
,
254 const char* serverName
,
259 const char* titleFormat
)
261 static char title
[WINDOWTITLE_MAX_LEN
];
262 char *titlePtr
= title
;
263 char* titleEnd
= title
+ WINDOWTITLE_MAX_LEN
- 1;
266 /* Flags to supress one of these if both are specified and they are identical */
267 int serverNameSeen
= False
;
268 int clearCaseViewTagSeen
= False
;
270 int fileNamePresent
= False
;
271 int hostNamePresent
= False
;
272 int userNamePresent
= False
;
273 int serverNamePresent
= False
;
274 int clearCasePresent
= False
;
275 int fileStatusPresent
= False
;
276 int dirNamePresent
= False
;
277 int noOfComponents
= -1;
278 int shortStatus
= False
;
280 *titlePtr
= '\0'; /* always start with an empty string */
282 while (*titleFormat
!= '\0' && titlePtr
< titleEnd
) {
283 char c
= *titleFormat
++;
288 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, '%');
292 case 'c': /* ClearCase view tag */
293 clearCasePresent
= True
;
294 if (clearCaseViewTag
!= NULL
) {
295 if (serverNameSeen
== False
||
296 strcmp(serverName
, clearCaseViewTag
) != 0) {
297 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, clearCaseViewTag
);
298 clearCaseViewTagSeen
= True
;
303 case 's': /* server name */
304 serverNamePresent
= True
;
305 if (isServer
&& serverName
[0] != '\0') { /* only applicable for servers */
306 if (clearCaseViewTagSeen
== False
||
307 strcmp(serverName
, clearCaseViewTag
) != 0) {
308 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, serverName
);
309 serverNameSeen
= True
;
314 case 'd': /* directory without any limit to no. of components */
315 dirNamePresent
= True
;
317 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, path
);
321 case '0': /* directory with limited no. of components */
331 if (*titleFormat
== 'd') {
332 dirNamePresent
= True
;
333 noOfComponents
= c
- '0';
334 titleFormat
++; /* delete the argument */
337 const char* trailingPath
= GetTrailingPathComponents(path
,
340 /* prefix with ellipsis if components were skipped */
341 if (trailingPath
> path
) {
342 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "...");
344 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, trailingPath
);
349 case 'f': /* file name */
350 fileNamePresent
= True
;
351 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, filename
);
354 case 'h': /* host name */
355 hostNamePresent
= True
;
356 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, GetNameOfHost());
359 case 'S': /* file status */
360 fileStatusPresent
= True
;
361 if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
) && fileChanged
)
362 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "read only, modified");
363 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
))
364 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "read only");
365 else if (IS_USER_LOCKED(lockReasons
) && fileChanged
)
366 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "locked, modified");
367 else if (IS_USER_LOCKED(lockReasons
))
368 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "locked");
369 else if (fileChanged
)
370 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "modified");
373 case 'u': /* user name */
374 userNamePresent
= True
;
375 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, GetUserName());
378 case '%': /* escaped % */
379 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, '%');
382 case '*': /* short file status ? */
383 fileStatusPresent
= True
;
384 if (*titleFormat
&& *titleFormat
== 'S')
388 if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
) && fileChanged
)
389 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "RO*");
390 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
))
391 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "RO");
392 else if (IS_USER_LOCKED(lockReasons
) && fileChanged
)
393 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "LO*");
394 else if (IS_USER_LOCKED(lockReasons
))
395 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "LO");
396 else if (fileChanged
)
397 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "*");
402 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, c
);
407 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, c
);
411 compressWindowTitle(title
);
415 sprintf(&title
[0], "<empty>"); /* For preview purposes only */
420 /* Prevent recursive callback loop */
421 etDialog
.suppressFormatUpdate
= True
;
423 /* Sync radio buttons with format string (in case the user entered
424 the format manually) */
425 XmToggleButtonSetState(etDialog
.fileW
, fileNamePresent
, False
);
426 XmToggleButtonSetState(etDialog
.statusW
, fileStatusPresent
, False
);
427 XmToggleButtonSetState(etDialog
.serverW
, serverNamePresent
, False
);
429 XmToggleButtonSetState(etDialog
.ccW
, clearCasePresent
, False
);
431 XmToggleButtonSetState(etDialog
.dirW
, dirNamePresent
, False
);
432 XmToggleButtonSetState(etDialog
.hostW
, hostNamePresent
, False
);
433 XmToggleButtonSetState(etDialog
.nameW
, userNamePresent
, False
);
435 XtSetSensitive(etDialog
.shortStatusW
, fileStatusPresent
);
436 if (fileStatusPresent
)
438 XmToggleButtonSetState(etDialog
.shortStatusW
, shortStatus
, False
);
441 /* Directory components are also sensitive to presence of dir */
442 XtSetSensitive(etDialog
.ndirW
, dirNamePresent
);
443 XtSetSensitive(etDialog
.mdirW
, dirNamePresent
);
445 if (dirNamePresent
) /* Avoid erasing number when not active */
447 if (noOfComponents
>= 0)
449 char* value
= XmTextGetString(etDialog
.ndirW
);
451 sprintf(&buf
[0], "%d", noOfComponents
);
452 if (strcmp(&buf
[0], value
)) /* Don't overwrite unless diff. */
453 SetIntText(etDialog
.ndirW
, noOfComponents
);
458 XmTextSetString(etDialog
.ndirW
, "");
462 /* Enable/disable test buttons, depending on presence of codes */
463 XtSetSensitive(etDialog
.oFileChangedW
, fileStatusPresent
);
464 XtSetSensitive(etDialog
.oFileReadOnlyW
, fileStatusPresent
);
465 XtSetSensitive(etDialog
.oFileLockedW
, fileStatusPresent
&&
466 !IS_PERM_LOCKED(etDialog
.lockReasons
));
468 XtSetSensitive(etDialog
.oServerNameW
, serverNamePresent
);
471 XtSetSensitive(etDialog
.oCcViewTagW
, clearCasePresent
);
472 XtSetSensitive(etDialog
.oServerEqualViewW
, clearCasePresent
&&
476 XtSetSensitive(etDialog
.oDirW
, dirNamePresent
);
478 etDialog
.suppressFormatUpdate
= False
;
486 /* a utility that sets the values of all toggle buttons */
487 static void setToggleButtons(void)
489 XmToggleButtonSetState(etDialog
.oDirW
,
490 etDialog
.filenameSet
== True
, False
);
491 XmToggleButtonSetState(etDialog
.oFileChangedW
,
492 etDialog
.fileChanged
== True
, False
);
493 XmToggleButtonSetState(etDialog
.oFileReadOnlyW
,
494 IS_PERM_LOCKED(etDialog
.lockReasons
), False
);
495 XmToggleButtonSetState(etDialog
.oFileLockedW
,
496 IS_USER_LOCKED(etDialog
.lockReasons
), False
);
497 /* Read-only takes precedence on locked */
498 XtSetSensitive(etDialog
.oFileLockedW
, !IS_PERM_LOCKED(etDialog
.lockReasons
));
501 XmToggleButtonSetState(etDialog
.oServerNameW
, etDialog
.isServer
, False
);
503 XmToggleButtonSetState(etDialog
.oCcViewTagW
,
504 GetClearCaseViewTag() != NULL
, False
);
505 XmToggleButtonSetState(etDialog
.oServerNameW
,
506 etDialog
.isServer
, False
);
508 if (GetClearCaseViewTag() != NULL
&&
510 GetPrefServerName()[0] != '\0' &&
511 strcmp(GetClearCaseViewTag(), GetPrefServerName()) == 0) {
512 XmToggleButtonSetState(etDialog
.oServerEqualViewW
,
515 XmToggleButtonSetState(etDialog
.oServerEqualViewW
,
521 static void formatChangedCB(Widget w
, XtPointer clientData
, XtPointer callData
)
524 int filenameSet
= XmToggleButtonGetState(etDialog
.oDirW
);
526 const char* serverName
;
528 if (etDialog
.suppressFormatUpdate
)
530 return; /* Prevent recursive feedback */
533 format
= XmTextGetString(etDialog
.formatW
);
536 if (XmToggleButtonGetState(etDialog
.oServerEqualViewW
) &&
537 XmToggleButtonGetState(etDialog
.ccW
)) {
538 serverName
= etDialog
.viewTag
;
542 serverName
= XmToggleButtonGetState(etDialog
.oServerNameW
) ?
543 etDialog
.serverName
: "";
546 title
= FormatWindowTitle(
548 etDialog
.filenameSet
== True
?
550 "/a/very/long/path/used/as/example/",
554 XmToggleButtonGetState(etDialog
.oCcViewTagW
) ?
555 etDialog
.viewTag
: NULL
,
560 etDialog
.lockReasons
,
561 XmToggleButtonGetState(etDialog
.oFileChangedW
),
564 XmTextFieldSetString(etDialog
.previewW
, title
);
568 static void ccViewTagCB(Widget w
, XtPointer clientData
, XtPointer callData
)
570 if (XmToggleButtonGetState(w
) == False
) {
571 XmToggleButtonSetState(etDialog
.oServerEqualViewW
, False
, False
);
573 formatChangedCB(w
, clientData
, callData
);
577 static void serverNameCB(Widget w
, XtPointer clientData
, XtPointer callData
)
579 if (XmToggleButtonGetState(w
) == False
) {
580 XmToggleButtonSetState(etDialog
.oServerEqualViewW
, False
, False
);
582 etDialog
.isServer
= XmToggleButtonGetState(w
);
583 formatChangedCB(w
, clientData
, callData
);
586 static void fileChangedCB(Widget w
, XtPointer clientData
, XtPointer callData
)
588 etDialog
.fileChanged
= XmToggleButtonGetState(w
);
589 formatChangedCB(w
, clientData
, callData
);
592 static void fileLockedCB(Widget w
, XtPointer clientData
, XtPointer callData
)
594 SET_USER_LOCKED(etDialog
.lockReasons
, XmToggleButtonGetState(w
));
595 formatChangedCB(w
, clientData
, callData
);
598 static void fileReadOnlyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
600 SET_PERM_LOCKED(etDialog
.lockReasons
, XmToggleButtonGetState(w
));
601 formatChangedCB(w
, clientData
, callData
);
605 static void serverEqualViewCB(Widget w
, XtPointer clientData
, XtPointer callData
)
607 if (XmToggleButtonGetState(w
) == True
) {
608 XmToggleButtonSetState(etDialog
.oCcViewTagW
, True
, False
);
609 XmToggleButtonSetState(etDialog
.oServerNameW
, True
, False
);
610 etDialog
.isServer
= True
;
612 formatChangedCB(w
, clientData
, callData
);
616 static void applyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
618 char *format
= XmTextGetString(etDialog
.formatW
);
620 /* pop down the dialog */
621 /* XtUnmanageChild(etDialog.form); */
623 if (strcmp(format
, GetPrefTitleFormat()) != 0) {
624 SetPrefTitleFormat(format
);
629 static void dismissCB(Widget w
, XtPointer clientData
, XtPointer callData
)
631 /* pop down the dialog */
632 XtUnmanageChild(etDialog
.form
);
635 static void restoreCB(Widget w
, XtPointer clientData
, XtPointer callData
)
637 XmTextSetString(etDialog
.formatW
, "{%c} [%s] %f (%S) - %d");
640 static void helpCB(Widget w
, XtPointer clientData
, XtPointer callData
)
642 Help(etDialog
.form
, HELP_CUSTOM_TITLE_DIALOG
);
645 static void wtDestroyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
647 if (w
== etDialog
.form
) /* Prevent disconnecting the replacing dialog */
648 etDialog
.form
= NULL
;
651 static void wtUnmapCB(Widget w
, XtPointer clientData
, XtPointer callData
)
653 if (etDialog
.form
== w
) /* Prevent destroying the replacing dialog */
654 XtDestroyWidget(etDialog
.form
);
657 static void appendToFormat(const char* string
)
659 char *format
= XmTextGetString(etDialog
.formatW
);
660 char *buf
= XtMalloc(strlen(string
) + strlen(format
) + 1);
663 XmTextSetString(etDialog
.formatW
, buf
);
668 static void removeFromFormat(const char* string
)
670 char *format
= XmTextGetString(etDialog
.formatW
);
673 /* There can be multiple occurences */
674 while ((pos
= strstr(format
, string
)))
676 /* If the string is preceded or followed by a brace, include
677 the brace(s) for removal */
679 char* end
= pos
+ strlen(string
);
682 if (post
== '}' || post
== ')' || post
== ']' || post
== '>')
690 char pre
= *(start
-1);
691 if (pre
== '{' || pre
== '(' || pre
== '[' || pre
== '<')
696 char pre
= *(start
-1);
697 /* If there is a space in front and behind, remove one space
698 (there can be more spaces, but in that case it is likely
699 that the user entered them manually); also remove trailing
701 if (pre
== ' ' && post
== ' ')
705 else if (pre
== ' ' && post
== (char)0)
707 /* Remove (1) trailing space */
712 /* Contract the string: move end to start */
716 /* Remove leading and trailing space */
718 while (*pos
== ' ') ++pos
;
721 pos
= format
+ strlen(format
) - 1;
722 while (pos
>= format
&& *pos
== ' ')
728 XmTextSetString(etDialog
.formatW
, format
);
733 static void toggleFileCB(Widget w
, XtPointer clientData
, XtPointer callData
)
735 if (XmToggleButtonGetState(etDialog
.fileW
))
736 appendToFormat(" %f");
738 removeFromFormat("%f");
741 static void toggleServerCB(Widget w
, XtPointer clientData
, XtPointer callData
)
743 if (XmToggleButtonGetState(etDialog
.serverW
))
744 appendToFormat(" [%s]");
746 removeFromFormat("%s");
749 static void toggleHostCB(Widget w
, XtPointer clientData
, XtPointer callData
)
751 if (XmToggleButtonGetState(etDialog
.hostW
))
752 appendToFormat(" [%h]");
754 removeFromFormat("%h");
758 static void toggleClearCaseCB(Widget w
, XtPointer clientData
, XtPointer callData
)
760 if (XmToggleButtonGetState(etDialog
.ccW
))
761 appendToFormat(" {%c}");
763 removeFromFormat("%c");
767 static void toggleStatusCB(Widget w
, XtPointer clientData
, XtPointer callData
)
769 if (XmToggleButtonGetState(etDialog
.statusW
))
771 if (XmToggleButtonGetState(etDialog
.shortStatusW
))
772 appendToFormat(" (%*S)");
774 appendToFormat(" (%S)");
778 removeFromFormat("%S");
779 removeFromFormat("%*S");
783 static void toggleShortStatusCB(Widget w
, XtPointer clientData
, XtPointer callData
)
787 if (etDialog
.suppressFormatUpdate
)
792 format
= XmTextGetString(etDialog
.formatW
);
794 if (XmToggleButtonGetState(etDialog
.shortStatusW
))
796 /* Find all %S occurrences and replace them by %*S */
799 pos
= strstr(format
, "%S");
802 char* tmp
= (char*)XtMalloc((strlen(format
)+2)*sizeof(char));
803 strncpy(tmp
, format
, (size_t)(pos
-format
+1));
804 tmp
[pos
-format
+1] = 0;
815 /* Replace all %*S occurences by %S */
818 pos
= strstr(format
, "%*S");
821 strcpy(pos
+1, pos
+2);
827 XmTextSetString(etDialog
.formatW
, format
);
831 static void toggleUserCB(Widget w
, XtPointer clientData
, XtPointer callData
)
833 if (XmToggleButtonGetState(etDialog
.nameW
))
834 appendToFormat(" %u");
836 removeFromFormat("%u");
839 static void toggleDirectoryCB(Widget w
, XtPointer clientData
, XtPointer callData
)
841 if (XmToggleButtonGetState(etDialog
.dirW
))
845 char *value
= XmTextGetString(etDialog
.ndirW
);
848 if (sscanf(value
, "%d", &maxComp
) > 0)
850 sprintf(&buf
[0], " %%%dd ", maxComp
);
854 sprintf(&buf
[0], " %%d "); /* Should not be necessary */
859 sprintf(&buf
[0], " %%d ");
867 removeFromFormat("%d");
871 sprintf(&buf
[0], "%%%dd", i
);
872 removeFromFormat(buf
);
877 static void enterMaxDirCB(Widget w
, XtPointer clientData
, XtPointer callData
)
883 if (etDialog
.suppressFormatUpdate
)
888 format
= XmTextGetString(etDialog
.formatW
);
889 value
= XmTextGetString(etDialog
.ndirW
);
893 if (sscanf(value
, "%d", &maxComp
) <= 0)
895 /* Don't allow non-digits to be entered */
896 XBell(XtDisplay(w
), 0);
897 XmTextSetString(etDialog
.ndirW
, "");
906 insert
[0] = (char)('0' + maxComp
);
907 insert
[1] = (char)0; /* '0' digit and 0 char ! */
909 /* Find all %d and %nd occurrences and replace them by the new value */
914 pos
= strstr(format
, "%d");
917 char* tmp
= (char*)XtMalloc((strlen(format
)+2)*sizeof(char));
918 strncpy(tmp
, format
, (size_t)(pos
-format
+1));
919 tmp
[pos
-format
+1] = 0;
920 strcat(tmp
, &insert
[0]);
930 sprintf(&buf
[0], "%%%dd", i
);
933 pos
= strstr(format
, &buf
[0]);
936 *(pos
+1) = insert
[0];
948 /* Replace all %nd occurences by %d */
957 sprintf(&buf
[0], "%%%dd", i
);
958 pos
= strstr(format
, &buf
[0]);
961 strcpy(pos
+1, pos
+2);
969 XmTextSetString(etDialog
.formatW
, format
);
974 static void createEditTitleDialog(Widget parent
, WindowInfo
*window
)
976 #define LEFT_MARGIN_POS 2
977 #define RIGHT_MARGIN_POS 98
979 #define RADIO_INDENT 3
981 Widget buttonForm
, formatLbl
, previewFrame
;
982 Widget previewForm
, previewBox
, selectFrame
, selectBox
, selectForm
;
983 Widget testLbl
, selectLbl
;
984 Widget applyBtn
, dismissBtn
, restoreBtn
, helpBtn
;
988 int defaultBtnOffset
;
989 Dimension shadowThickness
;
990 Dimension radioHeight
, textHeight
;
994 XtSetArg(args
[ac
], XmNautoUnmanage
, False
); ac
++;
995 XtSetArg(args
[ac
], XmNtitle
, "Customize Window Title"); ac
++;
996 etDialog
.form
= CreateFormDialog(parent
, "customizeTitle", args
, ac
);
999 * Destroy the dialog every time it is unmapped (otherwise it 'sticks'
1000 * to the window for which it was created originally).
1002 XtAddCallback(etDialog
.form
, XmNunmapCallback
, wtUnmapCB
, NULL
);
1003 XtAddCallback(etDialog
.form
, XmNdestroyCallback
, wtDestroyCB
, NULL
);
1005 etDialog
.shell
= XtParent(etDialog
.form
);
1007 /* Definition form */
1008 selectFrame
= XtVaCreateManagedWidget("selectionFrame", xmFrameWidgetClass
,
1010 XmNleftAttachment
, XmATTACH_POSITION
,
1011 XmNleftPosition
, LEFT_MARGIN_POS
,
1012 XmNtopAttachment
, XmATTACH_FORM
,
1013 XmNtopOffset
, V_MARGIN
,
1014 XmNrightAttachment
, XmATTACH_POSITION
,
1015 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1017 XtVaCreateManagedWidget("titleLabel", xmLabelGadgetClass
,
1020 s1
=XmStringCreateSimple("Title definition"),
1021 XmNchildType
, XmFRAME_TITLE_CHILD
,
1022 XmNchildHorizontalAlignment
, XmALIGNMENT_BEGINNING
, NULL
);
1025 selectForm
= XtVaCreateManagedWidget("selectForm", xmFormWidgetClass
,
1027 XmNleftAttachment
, XmATTACH_POSITION
,
1028 XmNleftPosition
, LEFT_MARGIN_POS
,
1029 XmNtopAttachment
, XmATTACH_FORM
,
1030 XmNtopOffset
, V_MARGIN
,
1031 XmNrightAttachment
, XmATTACH_POSITION
,
1032 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1034 selectLbl
= XtVaCreateManagedWidget("selectLabel", xmLabelGadgetClass
,
1036 XmNlabelString
, s1
=XmStringCreateSimple("Select title components to include: "),
1037 XmNleftAttachment
, XmATTACH_POSITION
,
1038 XmNleftPosition
, LEFT_MARGIN_POS
,
1041 XmNtopAttachment
, XmATTACH_FORM
, NULL
);
1044 selectBox
= XtVaCreateManagedWidget("selectBox", xmFormWidgetClass
,
1046 XmNorientation
, XmHORIZONTAL
,
1047 XmNpacking
, XmPACK_TIGHT
,
1048 XmNradioBehavior
, False
,
1049 XmNleftAttachment
, XmATTACH_FORM
,
1050 XmNrightAttachment
, XmATTACH_FORM
,
1052 XmNtopAttachment
, XmATTACH_WIDGET
,
1053 XmNtopWidget
, selectLbl
,
1056 etDialog
.fileW
= XtVaCreateManagedWidget("file",
1057 xmToggleButtonWidgetClass
, selectBox
,
1058 XmNleftAttachment
, XmATTACH_POSITION
,
1059 XmNleftPosition
, RADIO_INDENT
,
1060 XmNtopAttachment
, XmATTACH_FORM
,
1061 XmNlabelString
, s1
=XmStringCreateSimple("File name (%f)"),
1062 XmNmnemonic
, 'F', NULL
);
1063 XtAddCallback(etDialog
.fileW
, XmNvalueChangedCallback
, toggleFileCB
, NULL
);
1066 etDialog
.statusW
= XtVaCreateManagedWidget("status",
1067 xmToggleButtonWidgetClass
, selectBox
,
1068 XmNleftAttachment
, XmATTACH_POSITION
,
1069 XmNleftPosition
, RADIO_INDENT
,
1070 XmNtopAttachment
, XmATTACH_WIDGET
,
1071 XmNtopWidget
, etDialog
.fileW
,
1072 XmNlabelString
, s1
=XmStringCreateSimple("File status (%S) "),
1073 XmNmnemonic
, 't', NULL
);
1074 XtAddCallback(etDialog
.statusW
, XmNvalueChangedCallback
, toggleStatusCB
, NULL
);
1077 etDialog
.shortStatusW
= XtVaCreateManagedWidget("shortStatus",
1078 xmToggleButtonWidgetClass
, selectBox
,
1079 XmNleftAttachment
, XmATTACH_WIDGET
,
1080 XmNleftWidget
, etDialog
.statusW
,
1081 XmNtopAttachment
, XmATTACH_WIDGET
,
1082 XmNtopWidget
, etDialog
.fileW
,
1083 XmNlabelString
, s1
=XmStringCreateSimple("brief"),
1084 XmNmnemonic
, 'b', NULL
);
1085 XtAddCallback(etDialog
.shortStatusW
, XmNvalueChangedCallback
, toggleShortStatusCB
, NULL
);
1088 etDialog
.ccW
= XtVaCreateManagedWidget("ccView",
1089 xmToggleButtonWidgetClass
, selectBox
,
1090 XmNleftAttachment
, XmATTACH_POSITION
,
1091 XmNleftPosition
, RADIO_INDENT
,
1092 XmNtopAttachment
, XmATTACH_WIDGET
,
1093 XmNtopWidget
, etDialog
.statusW
,
1094 XmNlabelString
, s1
=XmStringCreateSimple("ClearCase view tag (%c) "),
1095 XmNmnemonic
, 'C', NULL
);
1097 XtSetSensitive(etDialog
.ccW
, False
);
1099 XtAddCallback(etDialog
.ccW
, XmNvalueChangedCallback
, toggleClearCaseCB
, NULL
);
1103 etDialog
.dirW
= XtVaCreateManagedWidget("directory",
1104 xmToggleButtonWidgetClass
, selectBox
,
1105 XmNleftAttachment
, XmATTACH_POSITION
,
1106 XmNleftPosition
, RADIO_INDENT
,
1107 XmNtopAttachment
, XmATTACH_WIDGET
,
1108 XmNtopWidget
, etDialog
.ccW
,
1109 XmNlabelString
, s1
=XmStringCreateSimple("Directory (%d),"),
1110 XmNmnemonic
, 'D', NULL
);
1111 XtAddCallback(etDialog
.dirW
, XmNvalueChangedCallback
, toggleDirectoryCB
, NULL
);
1114 etDialog
.mdirW
= XtVaCreateManagedWidget("componentLab",
1115 xmLabelGadgetClass
, selectBox
,
1116 XmNheight
, radioHeight
,
1117 XmNleftAttachment
, XmATTACH_WIDGET
,
1118 XmNleftWidget
, etDialog
.dirW
,
1119 XmNtopAttachment
, XmATTACH_WIDGET
,
1120 XmNtopWidget
, etDialog
.ccW
,
1121 XmNlabelString
, s1
=XmStringCreateSimple("max. components: "),
1122 XmNmnemonic
, 'x', NULL
);
1125 etDialog
.ndirW
= XtVaCreateManagedWidget("dircomp",
1126 xmTextWidgetClass
, selectBox
,
1129 XmNleftAttachment
, XmATTACH_WIDGET
,
1130 XmNleftWidget
, etDialog
.mdirW
,
1131 XmNtopAttachment
, XmATTACH_WIDGET
,
1132 XmNtopWidget
, etDialog
.ccW
,
1134 XtAddCallback(etDialog
.ndirW
, XmNvalueChangedCallback
, enterMaxDirCB
, NULL
);
1135 RemapDeleteKey(etDialog
.ndirW
);
1136 XtVaSetValues(etDialog
.mdirW
, XmNuserData
, etDialog
.ndirW
, NULL
); /* mnemonic processing */
1138 XtVaGetValues(etDialog
.ndirW
, XmNheight
, &textHeight
, NULL
);
1139 XtVaSetValues(etDialog
.dirW
, XmNheight
, textHeight
, NULL
);
1140 XtVaSetValues(etDialog
.mdirW
, XmNheight
, textHeight
, NULL
);
1142 etDialog
.hostW
= XtVaCreateManagedWidget("host",
1143 xmToggleButtonWidgetClass
, selectBox
,
1144 XmNleftAttachment
, XmATTACH_POSITION
,
1145 XmNleftPosition
, 50 + RADIO_INDENT
,
1146 XmNtopAttachment
, XmATTACH_FORM
,
1147 XmNlabelString
, s1
=XmStringCreateSimple("Host name (%h)"),
1148 XmNmnemonic
, 'H', NULL
);
1149 XtAddCallback(etDialog
.hostW
, XmNvalueChangedCallback
, toggleHostCB
, NULL
);
1152 etDialog
.nameW
= XtVaCreateManagedWidget("name",
1153 xmToggleButtonWidgetClass
, selectBox
,
1154 XmNleftAttachment
, XmATTACH_POSITION
,
1155 XmNleftPosition
, 50 + RADIO_INDENT
,
1156 XmNtopAttachment
, XmATTACH_WIDGET
,
1157 XmNtopWidget
, etDialog
.hostW
,
1158 XmNlabelString
, s1
=XmStringCreateSimple("User name (%u)"),
1159 XmNmnemonic
, 'U', NULL
);
1160 XtAddCallback(etDialog
.nameW
, XmNvalueChangedCallback
, toggleUserCB
, NULL
);
1163 etDialog
.serverW
= XtVaCreateManagedWidget("server",
1164 xmToggleButtonWidgetClass
, selectBox
,
1165 XmNleftAttachment
, XmATTACH_POSITION
,
1166 XmNleftPosition
, 50 + RADIO_INDENT
,
1167 XmNtopAttachment
, XmATTACH_WIDGET
,
1168 XmNtopWidget
, etDialog
.nameW
,
1169 XmNlabelString
, s1
=XmStringCreateSimple("NEdit server name (%s)"),
1170 XmNmnemonic
, 's', NULL
);
1171 XtAddCallback(etDialog
.serverW
, XmNvalueChangedCallback
, toggleServerCB
, NULL
);
1174 formatLbl
= XtVaCreateManagedWidget("formatLbl", xmLabelGadgetClass
,
1176 XmNlabelString
, s1
=XmStringCreateSimple("Format: "),
1178 XmNleftAttachment
, XmATTACH_POSITION
,
1179 XmNleftPosition
, LEFT_MARGIN_POS
,
1180 XmNtopAttachment
, XmATTACH_WIDGET
,
1181 XmNtopWidget
, selectBox
,
1182 XmNbottomAttachment
, XmATTACH_FORM
, NULL
);
1184 etDialog
.formatW
= XtVaCreateManagedWidget("format", xmTextWidgetClass
,
1186 XmNmaxLength
, WINDOWTITLE_MAX_LEN
,
1187 XmNtopAttachment
, XmATTACH_WIDGET
,
1188 XmNtopWidget
, selectBox
,
1190 XmNleftAttachment
, XmATTACH_WIDGET
,
1191 XmNleftWidget
, formatLbl
,
1192 XmNrightAttachment
, XmATTACH_POSITION
,
1193 XmNrightPosition
, RIGHT_MARGIN_POS
,
1194 XmNbottomAttachment
, XmATTACH_FORM
,
1195 XmNbottomOffset
, 5, NULL
);
1196 RemapDeleteKey(etDialog
.formatW
);
1197 XtVaSetValues(formatLbl
, XmNuserData
, etDialog
.formatW
, NULL
);
1198 XtAddCallback(etDialog
.formatW
, XmNvalueChangedCallback
, formatChangedCB
, NULL
);
1200 XtVaGetValues(etDialog
.formatW
, XmNheight
, &textHeight
, NULL
);
1201 XtVaSetValues(formatLbl
, XmNheight
, textHeight
, NULL
);
1203 previewFrame
= XtVaCreateManagedWidget("previewFrame", xmFrameWidgetClass
,
1205 XmNtopAttachment
, XmATTACH_WIDGET
,
1206 XmNtopWidget
, selectFrame
,
1207 XmNleftAttachment
, XmATTACH_POSITION
,
1208 XmNleftPosition
, LEFT_MARGIN_POS
,
1209 XmNrightAttachment
, XmATTACH_POSITION
,
1210 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1212 XtVaCreateManagedWidget("previewLabel", xmLabelGadgetClass
,
1214 XmNlabelString
, s1
=XmStringCreateSimple("Preview"),
1215 XmNchildType
, XmFRAME_TITLE_CHILD
,
1216 XmNchildHorizontalAlignment
, XmALIGNMENT_BEGINNING
, NULL
);
1219 previewForm
= XtVaCreateManagedWidget("previewForm", xmFormWidgetClass
,
1221 XmNleftAttachment
, XmATTACH_FORM
,
1222 XmNleftPosition
, LEFT_MARGIN_POS
,
1223 XmNtopAttachment
, XmATTACH_FORM
,
1224 XmNtopOffset
, V_MARGIN
,
1225 XmNrightAttachment
, XmATTACH_FORM
,
1226 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1228 /* Copy a variable width font from one of the labels to use for the
1229 preview (no editing is allowed, and with a fixed size font the
1230 preview easily gets partially obscured). Also copy the form background
1231 color to make it clear that this field is not editable */
1232 XtVaGetValues(formatLbl
, XmNfontList
, &fontList
, NULL
);
1233 XtVaGetValues(previewForm
, XmNbackground
, &background
, NULL
);
1235 etDialog
.previewW
= XtVaCreateManagedWidget("sample",
1236 xmTextFieldWidgetClass
, previewForm
,
1238 XmNcursorPositionVisible
, False
,
1239 XmNtopAttachment
, XmATTACH_FORM
,
1240 XmNleftAttachment
, XmATTACH_FORM
,
1241 XmNleftOffset
, V_MARGIN
,
1242 XmNrightAttachment
, XmATTACH_FORM
,
1243 XmNrightOffset
, V_MARGIN
,
1244 XmNfontList
, fontList
,
1245 XmNbackground
, background
,
1248 previewBox
= XtVaCreateManagedWidget("previewBox", xmFormWidgetClass
,
1250 XmNorientation
, XmHORIZONTAL
,
1251 XmNpacking
, XmPACK_TIGHT
,
1252 XmNradioBehavior
, False
,
1253 XmNleftAttachment
, XmATTACH_FORM
,
1254 XmNrightAttachment
, XmATTACH_FORM
,
1255 XmNtopAttachment
, XmATTACH_WIDGET
,
1256 XmNtopWidget
, etDialog
.previewW
, NULL
);
1258 testLbl
= XtVaCreateManagedWidget("testLabel", xmLabelGadgetClass
,
1260 XmNlabelString
, s1
=XmStringCreateSimple("Test settings: "),
1261 XmNleftAttachment
, XmATTACH_POSITION
,
1262 XmNleftPosition
, LEFT_MARGIN_POS
,
1265 XmNtopAttachment
, XmATTACH_FORM
, NULL
);
1268 etDialog
.oFileChangedW
= XtVaCreateManagedWidget("fileChanged",
1269 xmToggleButtonWidgetClass
, previewBox
,
1270 XmNleftAttachment
, XmATTACH_POSITION
,
1271 XmNleftPosition
, RADIO_INDENT
,
1272 XmNtopAttachment
, XmATTACH_WIDGET
,
1273 XmNtopWidget
, testLbl
,
1274 XmNlabelString
, s1
=XmStringCreateSimple("File modified"),
1275 XmNmnemonic
, 'o', NULL
);
1276 XtAddCallback(etDialog
.oFileChangedW
, XmNvalueChangedCallback
, fileChangedCB
, NULL
);
1279 etDialog
.oFileReadOnlyW
= XtVaCreateManagedWidget("fileReadOnly",
1280 xmToggleButtonWidgetClass
, previewBox
,
1281 XmNleftAttachment
, XmATTACH_WIDGET
,
1282 XmNleftWidget
, etDialog
.oFileChangedW
,
1283 XmNtopAttachment
, XmATTACH_WIDGET
,
1284 XmNtopWidget
, testLbl
,
1285 XmNlabelString
, s1
=XmStringCreateSimple("File read only"),
1286 XmNmnemonic
, 'n', NULL
);
1287 XtAddCallback(etDialog
.oFileReadOnlyW
, XmNvalueChangedCallback
, fileReadOnlyCB
, NULL
);
1290 etDialog
.oFileLockedW
= XtVaCreateManagedWidget("fileLocked",
1291 xmToggleButtonWidgetClass
, previewBox
,
1292 XmNleftAttachment
, XmATTACH_WIDGET
,
1293 XmNleftWidget
, etDialog
.oFileReadOnlyW
,
1294 XmNtopAttachment
, XmATTACH_WIDGET
,
1295 XmNtopWidget
, testLbl
,
1296 XmNlabelString
, s1
=XmStringCreateSimple("File locked"),
1297 XmNmnemonic
, 'l', NULL
);
1298 XtAddCallback(etDialog
.oFileLockedW
, XmNvalueChangedCallback
, fileLockedCB
, NULL
);
1301 etDialog
.oServerNameW
= XtVaCreateManagedWidget("servernameSet",
1302 xmToggleButtonWidgetClass
, previewBox
,
1303 XmNleftAttachment
, XmATTACH_POSITION
,
1304 XmNleftPosition
, RADIO_INDENT
,
1305 XmNtopAttachment
, XmATTACH_WIDGET
,
1306 XmNtopWidget
, etDialog
.oFileChangedW
,
1307 XmNlabelString
, s1
=XmStringCreateSimple("Server name present"),
1308 XmNmnemonic
, 'v', NULL
);
1309 XtAddCallback(etDialog
.oServerNameW
, XmNvalueChangedCallback
, serverNameCB
, NULL
);
1312 etDialog
.oCcViewTagW
= XtVaCreateManagedWidget("ccViewTagSet",
1313 xmToggleButtonWidgetClass
, previewBox
,
1314 XmNleftAttachment
, XmATTACH_POSITION
,
1315 XmNleftPosition
, RADIO_INDENT
,
1316 XmNtopAttachment
, XmATTACH_WIDGET
,
1317 XmNtopWidget
, etDialog
.oServerNameW
,
1318 XmNlabelString
, s1
=XmStringCreateSimple("CC view tag present"),
1322 XmNset
, GetClearCaseViewTag() != NULL
,
1324 XmNmnemonic
, 'w', NULL
);
1326 XtSetSensitive(etDialog
.oCcViewTagW
, False
);
1328 XtAddCallback(etDialog
.oCcViewTagW
, XmNvalueChangedCallback
, ccViewTagCB
, NULL
);
1332 etDialog
.oServerEqualViewW
= XtVaCreateManagedWidget("serverEqualView",
1333 xmToggleButtonWidgetClass
, previewBox
,
1334 XmNleftAttachment
, XmATTACH_WIDGET
,
1335 XmNleftWidget
, etDialog
.oCcViewTagW
,
1336 XmNtopAttachment
, XmATTACH_WIDGET
,
1337 XmNtopWidget
, etDialog
.oServerNameW
,
1338 XmNlabelString
, s1
=XmStringCreateSimple("Server name equals CC view tag "),
1339 XmNmnemonic
, 'q', NULL
);
1341 XtSetSensitive(etDialog
.oServerEqualViewW
, False
);
1343 XtAddCallback(etDialog
.oServerEqualViewW
, XmNvalueChangedCallback
, serverEqualViewCB
, NULL
);
1347 etDialog
.oDirW
= XtVaCreateManagedWidget("pathSet",
1348 xmToggleButtonWidgetClass
, previewBox
,
1349 XmNleftAttachment
, XmATTACH_POSITION
,
1350 XmNleftPosition
, RADIO_INDENT
,
1351 XmNtopAttachment
, XmATTACH_WIDGET
,
1352 XmNtopWidget
, etDialog
.oCcViewTagW
,
1353 XmNlabelString
, s1
=XmStringCreateSimple("Directory present"),
1354 XmNmnemonic
, 'i', NULL
);
1355 XtAddCallback(etDialog
.oDirW
, XmNvalueChangedCallback
, formatChangedCB
, NULL
);
1357 XtVaGetValues(etDialog
.fileW
, XmNheight
, &radioHeight
, NULL
);
1360 buttonForm
= XtVaCreateManagedWidget("buttonForm", xmFormWidgetClass
,
1362 XmNleftAttachment
, XmATTACH_POSITION
,
1363 XmNleftPosition
, LEFT_MARGIN_POS
,
1364 XmNtopAttachment
, XmATTACH_WIDGET
,
1365 XmNtopWidget
, previewFrame
,
1366 XmNtopOffset
, V_MARGIN
,
1367 XmNbottomOffset
, V_MARGIN
,
1368 XmNbottomAttachment
, XmATTACH_FORM
,
1369 XmNrightAttachment
, XmATTACH_POSITION
,
1370 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1372 applyBtn
= XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass
,
1374 XmNhighlightThickness
, 2,
1375 XmNlabelString
, s1
=XmStringCreateSimple("Apply"),
1376 XmNshowAsDefault
, (short)1,
1377 XmNleftAttachment
, XmATTACH_POSITION
,
1379 XmNrightAttachment
, XmATTACH_POSITION
,
1380 XmNrightPosition
, 25,
1381 XmNbottomAttachment
, XmATTACH_FORM
,
1383 XtAddCallback(applyBtn
, XmNactivateCallback
, applyCB
, NULL
);
1385 XtVaGetValues(applyBtn
, XmNshadowThickness
, &shadowThickness
, NULL
);
1386 defaultBtnOffset
= shadowThickness
+ 4;
1388 dismissBtn
= XtVaCreateManagedWidget("dismiss", xmPushButtonWidgetClass
,
1390 XmNhighlightThickness
, 2,
1391 XmNlabelString
, s1
=XmStringCreateSimple("Dismiss"),
1392 XmNleftAttachment
, XmATTACH_POSITION
,
1393 XmNleftPosition
, 52,
1394 XmNrightAttachment
, XmATTACH_POSITION
,
1395 XmNrightPosition
, 71,
1396 XmNbottomAttachment
, XmATTACH_FORM
,
1397 XmNbottomOffset
, defaultBtnOffset
,
1399 XtAddCallback(dismissBtn
, XmNactivateCallback
, dismissCB
, NULL
);
1402 restoreBtn
= XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass
,
1404 XmNhighlightThickness
, 2,
1405 XmNlabelString
, s1
=XmStringCreateSimple("Default"),
1406 XmNleftAttachment
, XmATTACH_POSITION
,
1407 XmNleftPosition
, 29,
1408 XmNrightAttachment
, XmATTACH_POSITION
,
1409 XmNrightPosition
, 48,
1410 XmNbottomAttachment
, XmATTACH_FORM
,
1411 XmNbottomOffset
, defaultBtnOffset
,
1412 XmNmnemonic
, 'e', NULL
);
1413 XtAddCallback(restoreBtn
, XmNactivateCallback
, restoreCB
, NULL
);
1416 helpBtn
= XtVaCreateManagedWidget("help", xmPushButtonWidgetClass
,
1418 XmNhighlightThickness
, 2,
1419 XmNlabelString
, s1
=XmStringCreateSimple("Help"),
1420 XmNleftAttachment
, XmATTACH_POSITION
,
1421 XmNleftPosition
, 75,
1422 XmNrightAttachment
, XmATTACH_POSITION
,
1423 XmNrightPosition
, 94,
1424 XmNbottomAttachment
, XmATTACH_FORM
,
1425 XmNbottomOffset
, defaultBtnOffset
,
1426 XmNmnemonic
, 'p', NULL
);
1427 XtAddCallback(helpBtn
, XmNactivateCallback
, helpCB
, NULL
);
1430 /* Set initial default button */
1431 XtVaSetValues(etDialog
.form
, XmNdefaultButton
, applyBtn
, NULL
);
1432 XtVaSetValues(etDialog
.form
, XmNcancelButton
, dismissBtn
, NULL
);
1434 /* Handle mnemonic selection of buttons and focus to dialog */
1435 AddDialogMnemonicHandler(etDialog
.form
, FALSE
);
1437 etDialog
.suppressFormatUpdate
= FALSE
;
1440 void EditCustomTitleFormat(Widget parent
, WindowInfo
*window
)
1442 /* copy attributes from current window so that we can use as many
1443 * 'real world' defaults as possible when testing the effect
1444 * of different formatting strings.
1446 strcpy(etDialog
.path
, window
->path
);
1447 strcpy(etDialog
.filename
, window
->filename
);
1449 strcpy(etDialog
.viewTag
, GetClearCaseViewTag() != NULL
?
1450 GetClearCaseViewTag() :
1453 strcpy(etDialog
.serverName
, IsServer
?
1454 GetPrefServerName() :
1456 etDialog
.isServer
= IsServer
;
1457 etDialog
.filenameSet
= window
->filenameSet
;
1458 etDialog
.lockReasons
= window
->lockReasons
;
1459 etDialog
.fileChanged
= window
->fileChanged
;
1461 if (etDialog
.window
!= window
&& etDialog
.form
)
1463 /* Destroy the dialog owned by the other window.
1464 Note: don't rely on the destroy event handler to reset the
1465 form. Events are handled asynchronously, so the old dialog
1466 may continue to live for a while. */
1467 XtDestroyWidget(etDialog
.form
);
1468 etDialog
.form
= NULL
;
1471 etDialog
.window
= window
;
1473 /* Create the dialog if it doesn't already exist */
1474 if (etDialog
.form
== NULL
)
1476 createEditTitleDialog(window
->shell
, window
);
1480 /* If the window is already up, just pop it to the top */
1481 if (XtIsManaged(etDialog
.form
)) {
1483 RaiseShellWindow(XtParent(etDialog
.form
));
1485 /* force update of the dialog */
1487 formatChangedCB(0, 0, 0);
1492 /* set initial value of format field */
1493 XmTextSetString(etDialog
.formatW
, (char *)GetPrefTitleFormat());
1495 /* force update of the dialog */
1497 formatChangedCB(0, 0, 0);
1499 /* put up dialog and wait for user to press ok or cancel */
1500 ManageDialogCenteredOnPointer(etDialog
.form
);