1 static const char CVSID
[] = "$Id: windowTitle.c,v 1.9 2002/09/26 12:37:40 ajhood 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
;
117 } etDialog
= {NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,
118 NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,
119 NULL
,NULL
,"","","","",0,0,0,0,0};
123 static char* removeSequence(char* sourcePtr
, char c
)
125 while (*sourcePtr
== c
) {
133 ** Two functions for performing safe insertions into a finite
134 ** size buffer so that we don't get any memory overruns.
136 static char* safeStrCpy(char* dest
, char* destEnd
, const char* source
)
138 int len
= (int)strlen(source
);
139 if (len
<= (destEnd
- dest
)) {
140 strcpy(dest
, source
);
144 strncpy(dest
, source
, destEnd
- dest
);
150 static char* safeCharAdd(char* dest
, char* destEnd
, char c
)
152 if (destEnd
- dest
> 0)
161 ** Remove empty paranthesis pairs and multiple spaces in a row
163 ** Also remove leading and trailing spaces and dashes.
165 static void compressWindowTitle(char *title
)
167 /* Compress the title */
170 char *sourcePtr
= title
;
171 char *destPtr
= sourcePtr
;
172 char c
= *sourcePtr
++;
176 /* Remove leading spaces and dashes */
177 while (c
== ' ' || c
== '-') {
181 /* Remove empty constructs */
184 /* remove sequences */
187 sourcePtr
= removeSequence(sourcePtr
, c
);
188 *destPtr
++ = c
; /* leave one */
191 /* remove empty paranthesis pairs */
193 if (*sourcePtr
== ')') {
198 sourcePtr
= removeSequence(sourcePtr
, ' ');
202 if (*sourcePtr
== ']') {
207 sourcePtr
= removeSequence(sourcePtr
, ' ');
211 if (*sourcePtr
== '}') {
216 sourcePtr
= removeSequence(sourcePtr
, ' ');
227 /* Remove trailing spaces and dashes */
228 while (destPtr
-- > title
) {
229 if (*destPtr
!= ' ' && *destPtr
!= '-')
233 } while (modified
== True
);
238 ** Format the windows title using a printf like formatting string.
239 ** The following flags are recognised:
240 ** %c : ClearCase view tag
242 ** %[n]d : directory, with one optional digit specifying the max number
243 ** of trailing directory components to display. Skipped components are
244 ** replaced by an ellipsis (...).
250 ** if the ClearCase view tag and server name are identical, only the first one
251 ** specified in the formatting string will be displayed.
253 char *FormatWindowTitle(const char* filename
,
255 const char* clearCaseViewTag
,
256 const char* serverName
,
261 const char* titleFormat
)
263 static char title
[WINDOWTITLE_MAX_LEN
];
264 char *titlePtr
= title
;
265 char* titleEnd
= title
+ WINDOWTITLE_MAX_LEN
- 1;
268 /* Flags to supress one of these if both are specified and they are identical */
269 int serverNameSeen
= False
;
270 int clearCaseViewTagSeen
= False
;
272 int fileNamePresent
= False
;
273 int hostNamePresent
= False
;
274 int userNamePresent
= False
;
275 int serverNamePresent
= False
;
276 int clearCasePresent
= False
;
277 int fileStatusPresent
= False
;
278 int dirNamePresent
= False
;
279 int noOfComponents
= -1;
280 int shortStatus
= False
;
282 *titlePtr
= '\0'; /* always start with an empty string */
284 while (*titleFormat
!= '\0' && titlePtr
< titleEnd
) {
285 char c
= *titleFormat
++;
290 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, '%');
294 case 'c': /* ClearCase view tag */
295 clearCasePresent
= True
;
296 if (clearCaseViewTag
!= NULL
) {
297 if (serverNameSeen
== False
||
298 strcmp(serverName
, clearCaseViewTag
) != 0) {
299 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, clearCaseViewTag
);
300 clearCaseViewTagSeen
= True
;
305 case 's': /* server name */
306 serverNamePresent
= True
;
307 if (isServer
&& serverName
[0] != '\0') { /* only applicable for servers */
308 if (clearCaseViewTagSeen
== False
||
309 strcmp(serverName
, clearCaseViewTag
) != 0) {
310 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, serverName
);
311 serverNameSeen
= True
;
316 case 'd': /* directory without any limit to no. of components */
317 dirNamePresent
= True
;
319 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, path
);
323 case '0': /* directory with limited no. of components */
333 if (*titleFormat
== 'd') {
334 dirNamePresent
= True
;
335 noOfComponents
= c
- '0';
336 titleFormat
++; /* delete the argument */
339 const char* trailingPath
= GetTrailingPathComponents(path
,
342 /* prefix with ellipsis if components were skipped */
343 if (trailingPath
> path
) {
344 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "...");
346 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, trailingPath
);
351 case 'f': /* file name */
352 fileNamePresent
= True
;
353 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, filename
);
356 case 'h': /* host name */
357 hostNamePresent
= True
;
358 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, GetNameOfHost());
361 case 'S': /* file status */
362 fileStatusPresent
= True
;
363 if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
) && fileChanged
)
364 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "read only, modified");
365 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
))
366 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "read only");
367 else if (IS_USER_LOCKED(lockReasons
) && fileChanged
)
368 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "locked, modified");
369 else if (IS_USER_LOCKED(lockReasons
))
370 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "locked");
371 else if (fileChanged
)
372 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "modified");
375 case 'u': /* user name */
376 userNamePresent
= True
;
377 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, GetUserName());
380 case '%': /* escaped % */
381 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, '%');
384 case '*': /* short file status ? */
385 fileStatusPresent
= True
;
386 if (*titleFormat
&& *titleFormat
== 'S')
390 if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
) && fileChanged
)
391 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "RO*");
392 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons
))
393 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "RO");
394 else if (IS_USER_LOCKED(lockReasons
) && fileChanged
)
395 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "LO*");
396 else if (IS_USER_LOCKED(lockReasons
))
397 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "LO");
398 else if (fileChanged
)
399 titlePtr
= safeStrCpy(titlePtr
, titleEnd
, "*");
404 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, c
);
409 titlePtr
= safeCharAdd(titlePtr
, titleEnd
, c
);
413 compressWindowTitle(title
);
417 sprintf(&title
[0], "<empty>"); /* For preview purposes only */
422 /* Prevent recursive callback loop */
423 etDialog
.suppressFormatUpdate
= True
;
425 /* Sync radio buttons with format string (in case the user entered
426 the format manually) */
427 XmToggleButtonSetState(etDialog
.fileW
, fileNamePresent
, False
);
428 XmToggleButtonSetState(etDialog
.statusW
, fileStatusPresent
, False
);
429 XmToggleButtonSetState(etDialog
.serverW
, serverNamePresent
, False
);
431 XmToggleButtonSetState(etDialog
.ccW
, clearCasePresent
, False
);
433 XmToggleButtonSetState(etDialog
.dirW
, dirNamePresent
, False
);
434 XmToggleButtonSetState(etDialog
.hostW
, hostNamePresent
, False
);
435 XmToggleButtonSetState(etDialog
.nameW
, userNamePresent
, False
);
437 XtSetSensitive(etDialog
.shortStatusW
, fileStatusPresent
);
438 if (fileStatusPresent
)
440 XmToggleButtonSetState(etDialog
.shortStatusW
, shortStatus
, False
);
443 /* Directory components are also sensitive to presence of dir */
444 XtSetSensitive(etDialog
.ndirW
, dirNamePresent
);
445 XtSetSensitive(etDialog
.mdirW
, dirNamePresent
);
447 if (dirNamePresent
) /* Avoid erasing number when not active */
449 if (noOfComponents
>= 0)
451 char* value
= XmTextGetString(etDialog
.ndirW
);
453 sprintf(&buf
[0], "%d", noOfComponents
);
454 if (strcmp(&buf
[0], value
)) /* Don't overwrite unless diff. */
455 SetIntText(etDialog
.ndirW
, noOfComponents
);
460 XmTextSetString(etDialog
.ndirW
, "");
464 /* Enable/disable test buttons, depending on presence of codes */
465 XtSetSensitive(etDialog
.oFileChangedW
, fileStatusPresent
);
466 XtSetSensitive(etDialog
.oFileReadOnlyW
, fileStatusPresent
);
467 XtSetSensitive(etDialog
.oFileLockedW
, fileStatusPresent
&&
468 !IS_PERM_LOCKED(etDialog
.lockReasons
));
470 XtSetSensitive(etDialog
.oServerNameW
, serverNamePresent
);
473 XtSetSensitive(etDialog
.oCcViewTagW
, clearCasePresent
);
474 XtSetSensitive(etDialog
.oServerEqualViewW
, clearCasePresent
&&
478 XtSetSensitive(etDialog
.oDirW
, dirNamePresent
);
480 etDialog
.suppressFormatUpdate
= False
;
488 /* a utility that sets the values of all toggle buttons */
489 static void setToggleButtons(void)
491 XmToggleButtonSetState(etDialog
.oDirW
,
492 etDialog
.filenameSet
== True
, False
);
493 XmToggleButtonSetState(etDialog
.oFileChangedW
,
494 etDialog
.fileChanged
== True
, False
);
495 XmToggleButtonSetState(etDialog
.oFileReadOnlyW
,
496 IS_PERM_LOCKED(etDialog
.lockReasons
), False
);
497 XmToggleButtonSetState(etDialog
.oFileLockedW
,
498 IS_USER_LOCKED(etDialog
.lockReasons
), False
);
499 /* Read-only takes precedence on locked */
500 XtSetSensitive(etDialog
.oFileLockedW
, !IS_PERM_LOCKED(etDialog
.lockReasons
));
503 XmToggleButtonSetState(etDialog
.oServerNameW
, etDialog
.isServer
, False
);
505 XmToggleButtonSetState(etDialog
.oCcViewTagW
,
506 GetClearCaseViewTag() != NULL
, False
);
507 XmToggleButtonSetState(etDialog
.oServerNameW
,
508 etDialog
.isServer
, False
);
510 if (GetClearCaseViewTag() != NULL
&&
512 GetPrefServerName()[0] != '\0' &&
513 strcmp(GetClearCaseViewTag(), GetPrefServerName()) == 0) {
514 XmToggleButtonSetState(etDialog
.oServerEqualViewW
,
517 XmToggleButtonSetState(etDialog
.oServerEqualViewW
,
523 static void formatChangedCB(Widget w
, XtPointer clientData
, XtPointer callData
)
526 int filenameSet
= XmToggleButtonGetState(etDialog
.oDirW
);
528 const char* serverName
;
530 if (etDialog
.suppressFormatUpdate
)
532 return; /* Prevent recursive feedback */
535 format
= XmTextGetString(etDialog
.formatW
);
538 if (XmToggleButtonGetState(etDialog
.oServerEqualViewW
) &&
539 XmToggleButtonGetState(etDialog
.ccW
)) {
540 serverName
= etDialog
.viewTag
;
544 serverName
= XmToggleButtonGetState(etDialog
.oServerNameW
) ?
545 etDialog
.serverName
: "";
548 title
= FormatWindowTitle(
550 etDialog
.filenameSet
== True
?
552 "/a/very/long/path/used/as/example/",
556 XmToggleButtonGetState(etDialog
.oCcViewTagW
) ?
557 etDialog
.viewTag
: NULL
,
562 etDialog
.lockReasons
,
563 XmToggleButtonGetState(etDialog
.oFileChangedW
),
566 XmTextFieldSetString(etDialog
.previewW
, title
);
570 static void ccViewTagCB(Widget w
, XtPointer clientData
, XtPointer callData
)
572 if (XmToggleButtonGetState(w
) == False
) {
573 XmToggleButtonSetState(etDialog
.oServerEqualViewW
, False
, False
);
575 formatChangedCB(w
, clientData
, callData
);
579 static void serverNameCB(Widget w
, XtPointer clientData
, XtPointer callData
)
581 if (XmToggleButtonGetState(w
) == False
) {
582 XmToggleButtonSetState(etDialog
.oServerEqualViewW
, False
, False
);
584 etDialog
.isServer
= XmToggleButtonGetState(w
);
585 formatChangedCB(w
, clientData
, callData
);
588 static void fileChangedCB(Widget w
, XtPointer clientData
, XtPointer callData
)
590 etDialog
.fileChanged
= XmToggleButtonGetState(w
);
591 formatChangedCB(w
, clientData
, callData
);
594 static void fileLockedCB(Widget w
, XtPointer clientData
, XtPointer callData
)
596 SET_USER_LOCKED(etDialog
.lockReasons
, XmToggleButtonGetState(w
));
597 formatChangedCB(w
, clientData
, callData
);
600 static void fileReadOnlyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
602 SET_PERM_LOCKED(etDialog
.lockReasons
, XmToggleButtonGetState(w
));
603 formatChangedCB(w
, clientData
, callData
);
607 static void serverEqualViewCB(Widget w
, XtPointer clientData
, XtPointer callData
)
609 if (XmToggleButtonGetState(w
) == True
) {
610 XmToggleButtonSetState(etDialog
.oCcViewTagW
, True
, False
);
611 XmToggleButtonSetState(etDialog
.oServerNameW
, True
, False
);
612 etDialog
.isServer
= True
;
614 formatChangedCB(w
, clientData
, callData
);
618 static void applyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
620 char *format
= XmTextGetString(etDialog
.formatW
);
622 /* pop down the dialog */
623 /* XtUnmanageChild(etDialog.form); */
625 if (strcmp(format
, GetPrefTitleFormat()) != 0) {
626 SetPrefTitleFormat(format
);
631 static void dismissCB(Widget w
, XtPointer clientData
, XtPointer callData
)
633 /* pop down the dialog */
634 XtUnmanageChild(etDialog
.form
);
637 static void restoreCB(Widget w
, XtPointer clientData
, XtPointer callData
)
639 XmTextSetString(etDialog
.formatW
, "{%c} [%s] %f (%S) - %d");
642 static void helpCB(Widget w
, XtPointer clientData
, XtPointer callData
)
644 Help(etDialog
.form
, HELP_CUSTOM_TITLE_DIALOG
);
647 static void wtDestroyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
649 if (w
== etDialog
.form
) /* Prevent disconnecting the replacing dialog */
650 etDialog
.form
= NULL
;
653 static void wtUnmapCB(Widget w
, XtPointer clientData
, XtPointer callData
)
655 if (etDialog
.form
== w
) /* Prevent destroying the replacing dialog */
656 XtDestroyWidget(etDialog
.form
);
659 static void appendToFormat(const char* string
)
661 char *format
= XmTextGetString(etDialog
.formatW
);
662 char *buf
= XtMalloc(strlen(string
) + strlen(format
) + 1);
665 XmTextSetString(etDialog
.formatW
, buf
);
670 static void removeFromFormat(const char* string
)
672 char *format
= XmTextGetString(etDialog
.formatW
);
675 /* There can be multiple occurences */
676 while ((pos
= strstr(format
, string
)))
678 /* If the string is preceded or followed by a brace, include
679 the brace(s) for removal */
681 char* end
= pos
+ strlen(string
);
684 if (post
== '}' || post
== ')' || post
== ']' || post
== '>')
692 char pre
= *(start
-1);
693 if (pre
== '{' || pre
== '(' || pre
== '[' || pre
== '<')
698 char pre
= *(start
-1);
699 /* If there is a space in front and behind, remove one space
700 (there can be more spaces, but in that case it is likely
701 that the user entered them manually); also remove trailing
703 if (pre
== ' ' && post
== ' ')
707 else if (pre
== ' ' && post
== (char)0)
709 /* Remove (1) trailing space */
714 /* Contract the string: move end to start */
718 /* Remove leading and trailing space */
720 while (*pos
== ' ') ++pos
;
723 pos
= format
+ strlen(format
) - 1;
724 while (pos
>= format
&& *pos
== ' ')
730 XmTextSetString(etDialog
.formatW
, format
);
735 static void toggleFileCB(Widget w
, XtPointer clientData
, XtPointer callData
)
737 if (XmToggleButtonGetState(etDialog
.fileW
))
738 appendToFormat(" %f");
740 removeFromFormat("%f");
743 static void toggleServerCB(Widget w
, XtPointer clientData
, XtPointer callData
)
745 if (XmToggleButtonGetState(etDialog
.serverW
))
746 appendToFormat(" [%s]");
748 removeFromFormat("%s");
751 static void toggleHostCB(Widget w
, XtPointer clientData
, XtPointer callData
)
753 if (XmToggleButtonGetState(etDialog
.hostW
))
754 appendToFormat(" [%h]");
756 removeFromFormat("%h");
760 static void toggleClearCaseCB(Widget w
, XtPointer clientData
, XtPointer callData
)
762 if (XmToggleButtonGetState(etDialog
.ccW
))
763 appendToFormat(" {%c}");
765 removeFromFormat("%c");
769 static void toggleStatusCB(Widget w
, XtPointer clientData
, XtPointer callData
)
771 if (XmToggleButtonGetState(etDialog
.statusW
))
773 if (XmToggleButtonGetState(etDialog
.shortStatusW
))
774 appendToFormat(" (%*S)");
776 appendToFormat(" (%S)");
780 removeFromFormat("%S");
781 removeFromFormat("%*S");
785 static void toggleShortStatusCB(Widget w
, XtPointer clientData
, XtPointer callData
)
789 if (etDialog
.suppressFormatUpdate
)
794 format
= XmTextGetString(etDialog
.formatW
);
796 if (XmToggleButtonGetState(etDialog
.shortStatusW
))
798 /* Find all %S occurrences and replace them by %*S */
801 pos
= strstr(format
, "%S");
804 char* tmp
= (char*)XtMalloc((strlen(format
)+2)*sizeof(char));
805 strncpy(tmp
, format
, (size_t)(pos
-format
+1));
806 tmp
[pos
-format
+1] = 0;
817 /* Replace all %*S occurences by %S */
820 pos
= strstr(format
, "%*S");
823 strcpy(pos
+1, pos
+2);
829 XmTextSetString(etDialog
.formatW
, format
);
833 static void toggleUserCB(Widget w
, XtPointer clientData
, XtPointer callData
)
835 if (XmToggleButtonGetState(etDialog
.nameW
))
836 appendToFormat(" %u");
838 removeFromFormat("%u");
841 static void toggleDirectoryCB(Widget w
, XtPointer clientData
, XtPointer callData
)
843 if (XmToggleButtonGetState(etDialog
.dirW
))
847 char *value
= XmTextGetString(etDialog
.ndirW
);
850 if (sscanf(value
, "%d", &maxComp
) > 0)
852 sprintf(&buf
[0], " %%%dd ", maxComp
);
856 sprintf(&buf
[0], " %%d "); /* Should not be necessary */
861 sprintf(&buf
[0], " %%d ");
869 removeFromFormat("%d");
873 sprintf(&buf
[0], "%%%dd", i
);
874 removeFromFormat(buf
);
879 static void enterMaxDirCB(Widget w
, XtPointer clientData
, XtPointer callData
)
885 if (etDialog
.suppressFormatUpdate
)
890 format
= XmTextGetString(etDialog
.formatW
);
891 value
= XmTextGetString(etDialog
.ndirW
);
895 if (sscanf(value
, "%d", &maxComp
) <= 0)
897 /* Don't allow non-digits to be entered */
898 XBell(XtDisplay(w
), 0);
899 XmTextSetString(etDialog
.ndirW
, "");
908 insert
[0] = (char)('0' + maxComp
);
909 insert
[1] = (char)0; /* '0' digit and 0 char ! */
911 /* Find all %d and %nd occurrences and replace them by the new value */
916 pos
= strstr(format
, "%d");
919 char* tmp
= (char*)XtMalloc((strlen(format
)+2)*sizeof(char));
920 strncpy(tmp
, format
, (size_t)(pos
-format
+1));
921 tmp
[pos
-format
+1] = 0;
922 strcat(tmp
, &insert
[0]);
932 sprintf(&buf
[0], "%%%dd", i
);
935 pos
= strstr(format
, &buf
[0]);
938 *(pos
+1) = insert
[0];
950 /* Replace all %nd occurences by %d */
959 sprintf(&buf
[0], "%%%dd", i
);
960 pos
= strstr(format
, &buf
[0]);
963 strcpy(pos
+1, pos
+2);
971 XmTextSetString(etDialog
.formatW
, format
);
976 static void createEditTitleDialog(Widget parent
, WindowInfo
*window
)
978 #define LEFT_MARGIN_POS 2
979 #define RIGHT_MARGIN_POS 98
981 #define RADIO_INDENT 3
983 Widget buttonForm
, formatLbl
, previewFrame
;
984 Widget previewForm
, previewBox
, selectFrame
, selectBox
, selectForm
;
985 Widget testLbl
, selectLbl
;
986 Widget applyBtn
, dismissBtn
, restoreBtn
, helpBtn
;
990 int defaultBtnOffset
;
991 Dimension shadowThickness
;
992 Dimension radioHeight
, textHeight
;
996 XtSetArg(args
[ac
], XmNautoUnmanage
, False
); ac
++;
997 XtSetArg(args
[ac
], XmNtitle
, "Customize Window Title"); ac
++;
998 etDialog
.form
= CreateFormDialog(parent
, "customizeTitle", args
, ac
);
1001 * Destroy the dialog every time it is unmapped (otherwise it 'sticks'
1002 * to the window for which it was created originally).
1004 XtAddCallback(etDialog
.form
, XmNunmapCallback
, wtUnmapCB
, NULL
);
1005 XtAddCallback(etDialog
.form
, XmNdestroyCallback
, wtDestroyCB
, NULL
);
1007 etDialog
.shell
= XtParent(etDialog
.form
);
1009 /* Definition form */
1010 selectFrame
= XtVaCreateManagedWidget("selectionFrame", xmFrameWidgetClass
,
1012 XmNleftAttachment
, XmATTACH_POSITION
,
1013 XmNleftPosition
, LEFT_MARGIN_POS
,
1014 XmNtopAttachment
, XmATTACH_FORM
,
1015 XmNtopOffset
, V_MARGIN
,
1016 XmNrightAttachment
, XmATTACH_POSITION
,
1017 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1019 XtVaCreateManagedWidget("titleLabel", xmLabelGadgetClass
,
1022 s1
=XmStringCreateSimple("Title definition"),
1023 XmNchildType
, XmFRAME_TITLE_CHILD
,
1024 XmNchildHorizontalAlignment
, XmALIGNMENT_BEGINNING
, NULL
);
1027 selectForm
= XtVaCreateManagedWidget("selectForm", xmFormWidgetClass
,
1029 XmNleftAttachment
, XmATTACH_POSITION
,
1030 XmNleftPosition
, LEFT_MARGIN_POS
,
1031 XmNtopAttachment
, XmATTACH_FORM
,
1032 XmNtopOffset
, V_MARGIN
,
1033 XmNrightAttachment
, XmATTACH_POSITION
,
1034 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1036 selectLbl
= XtVaCreateManagedWidget("selectLabel", xmLabelGadgetClass
,
1038 XmNlabelString
, s1
=XmStringCreateSimple("Select title components to include: "),
1039 XmNleftAttachment
, XmATTACH_POSITION
,
1040 XmNleftPosition
, LEFT_MARGIN_POS
,
1043 XmNtopAttachment
, XmATTACH_FORM
, NULL
);
1046 selectBox
= XtVaCreateManagedWidget("selectBox", xmFormWidgetClass
,
1048 XmNorientation
, XmHORIZONTAL
,
1049 XmNpacking
, XmPACK_TIGHT
,
1050 XmNradioBehavior
, False
,
1051 XmNleftAttachment
, XmATTACH_FORM
,
1052 XmNrightAttachment
, XmATTACH_FORM
,
1054 XmNtopAttachment
, XmATTACH_WIDGET
,
1055 XmNtopWidget
, selectLbl
,
1058 etDialog
.fileW
= XtVaCreateManagedWidget("file",
1059 xmToggleButtonWidgetClass
, selectBox
,
1060 XmNleftAttachment
, XmATTACH_POSITION
,
1061 XmNleftPosition
, RADIO_INDENT
,
1062 XmNtopAttachment
, XmATTACH_FORM
,
1063 XmNlabelString
, s1
=XmStringCreateSimple("File name (%f)"),
1064 XmNmnemonic
, 'F', NULL
);
1065 XtAddCallback(etDialog
.fileW
, XmNvalueChangedCallback
, toggleFileCB
, NULL
);
1068 etDialog
.statusW
= XtVaCreateManagedWidget("status",
1069 xmToggleButtonWidgetClass
, selectBox
,
1070 XmNleftAttachment
, XmATTACH_POSITION
,
1071 XmNleftPosition
, RADIO_INDENT
,
1072 XmNtopAttachment
, XmATTACH_WIDGET
,
1073 XmNtopWidget
, etDialog
.fileW
,
1074 XmNlabelString
, s1
=XmStringCreateSimple("File status (%S) "),
1075 XmNmnemonic
, 't', NULL
);
1076 XtAddCallback(etDialog
.statusW
, XmNvalueChangedCallback
, toggleStatusCB
, NULL
);
1079 etDialog
.shortStatusW
= XtVaCreateManagedWidget("shortStatus",
1080 xmToggleButtonWidgetClass
, selectBox
,
1081 XmNleftAttachment
, XmATTACH_WIDGET
,
1082 XmNleftWidget
, etDialog
.statusW
,
1083 XmNtopAttachment
, XmATTACH_WIDGET
,
1084 XmNtopWidget
, etDialog
.fileW
,
1085 XmNlabelString
, s1
=XmStringCreateSimple("brief"),
1086 XmNmnemonic
, 'b', NULL
);
1087 XtAddCallback(etDialog
.shortStatusW
, XmNvalueChangedCallback
, toggleShortStatusCB
, NULL
);
1090 etDialog
.ccW
= XtVaCreateManagedWidget("ccView",
1091 xmToggleButtonWidgetClass
, selectBox
,
1092 XmNleftAttachment
, XmATTACH_POSITION
,
1093 XmNleftPosition
, RADIO_INDENT
,
1094 XmNtopAttachment
, XmATTACH_WIDGET
,
1095 XmNtopWidget
, etDialog
.statusW
,
1096 XmNlabelString
, s1
=XmStringCreateSimple("ClearCase view tag (%c) "),
1097 XmNmnemonic
, 'C', NULL
);
1099 XtSetSensitive(etDialog
.ccW
, False
);
1101 XtAddCallback(etDialog
.ccW
, XmNvalueChangedCallback
, toggleClearCaseCB
, NULL
);
1105 etDialog
.dirW
= XtVaCreateManagedWidget("directory",
1106 xmToggleButtonWidgetClass
, selectBox
,
1107 XmNleftAttachment
, XmATTACH_POSITION
,
1108 XmNleftPosition
, RADIO_INDENT
,
1109 XmNtopAttachment
, XmATTACH_WIDGET
,
1110 XmNtopWidget
, etDialog
.ccW
,
1111 XmNlabelString
, s1
=XmStringCreateSimple("Directory (%d),"),
1112 XmNmnemonic
, 'D', NULL
);
1113 XtAddCallback(etDialog
.dirW
, XmNvalueChangedCallback
, toggleDirectoryCB
, NULL
);
1116 etDialog
.mdirW
= XtVaCreateManagedWidget("componentLab",
1117 xmLabelGadgetClass
, selectBox
,
1118 XmNheight
, radioHeight
,
1119 XmNleftAttachment
, XmATTACH_WIDGET
,
1120 XmNleftWidget
, etDialog
.dirW
,
1121 XmNtopAttachment
, XmATTACH_WIDGET
,
1122 XmNtopWidget
, etDialog
.ccW
,
1123 XmNlabelString
, s1
=XmStringCreateSimple("max. components: "),
1124 XmNmnemonic
, 'x', NULL
);
1127 etDialog
.ndirW
= XtVaCreateManagedWidget("dircomp",
1128 xmTextWidgetClass
, selectBox
,
1131 XmNleftAttachment
, XmATTACH_WIDGET
,
1132 XmNleftWidget
, etDialog
.mdirW
,
1133 XmNtopAttachment
, XmATTACH_WIDGET
,
1134 XmNtopWidget
, etDialog
.ccW
,
1136 XtAddCallback(etDialog
.ndirW
, XmNvalueChangedCallback
, enterMaxDirCB
, NULL
);
1137 RemapDeleteKey(etDialog
.ndirW
);
1138 XtVaSetValues(etDialog
.mdirW
, XmNuserData
, etDialog
.ndirW
, NULL
); /* mnemonic processing */
1140 XtVaGetValues(etDialog
.ndirW
, XmNheight
, &textHeight
, NULL
);
1141 XtVaSetValues(etDialog
.dirW
, XmNheight
, textHeight
, NULL
);
1142 XtVaSetValues(etDialog
.mdirW
, XmNheight
, textHeight
, NULL
);
1144 etDialog
.hostW
= XtVaCreateManagedWidget("host",
1145 xmToggleButtonWidgetClass
, selectBox
,
1146 XmNleftAttachment
, XmATTACH_POSITION
,
1147 XmNleftPosition
, 50 + RADIO_INDENT
,
1148 XmNtopAttachment
, XmATTACH_FORM
,
1149 XmNlabelString
, s1
=XmStringCreateSimple("Host name (%h)"),
1150 XmNmnemonic
, 'H', NULL
);
1151 XtAddCallback(etDialog
.hostW
, XmNvalueChangedCallback
, toggleHostCB
, NULL
);
1154 etDialog
.nameW
= XtVaCreateManagedWidget("name",
1155 xmToggleButtonWidgetClass
, selectBox
,
1156 XmNleftAttachment
, XmATTACH_POSITION
,
1157 XmNleftPosition
, 50 + RADIO_INDENT
,
1158 XmNtopAttachment
, XmATTACH_WIDGET
,
1159 XmNtopWidget
, etDialog
.hostW
,
1160 XmNlabelString
, s1
=XmStringCreateSimple("User name (%u)"),
1161 XmNmnemonic
, 'U', NULL
);
1162 XtAddCallback(etDialog
.nameW
, XmNvalueChangedCallback
, toggleUserCB
, NULL
);
1165 etDialog
.serverW
= XtVaCreateManagedWidget("server",
1166 xmToggleButtonWidgetClass
, selectBox
,
1167 XmNleftAttachment
, XmATTACH_POSITION
,
1168 XmNleftPosition
, 50 + RADIO_INDENT
,
1169 XmNtopAttachment
, XmATTACH_WIDGET
,
1170 XmNtopWidget
, etDialog
.nameW
,
1171 XmNlabelString
, s1
=XmStringCreateSimple("NEdit server name (%s)"),
1172 XmNmnemonic
, 's', NULL
);
1173 XtAddCallback(etDialog
.serverW
, XmNvalueChangedCallback
, toggleServerCB
, NULL
);
1176 formatLbl
= XtVaCreateManagedWidget("formatLbl", xmLabelGadgetClass
,
1178 XmNlabelString
, s1
=XmStringCreateSimple("Format: "),
1180 XmNleftAttachment
, XmATTACH_POSITION
,
1181 XmNleftPosition
, LEFT_MARGIN_POS
,
1182 XmNtopAttachment
, XmATTACH_WIDGET
,
1183 XmNtopWidget
, selectBox
,
1184 XmNbottomAttachment
, XmATTACH_FORM
, NULL
);
1186 etDialog
.formatW
= XtVaCreateManagedWidget("format", xmTextWidgetClass
,
1188 XmNmaxLength
, WINDOWTITLE_MAX_LEN
,
1189 XmNtopAttachment
, XmATTACH_WIDGET
,
1190 XmNtopWidget
, selectBox
,
1192 XmNleftAttachment
, XmATTACH_WIDGET
,
1193 XmNleftWidget
, formatLbl
,
1194 XmNrightAttachment
, XmATTACH_POSITION
,
1195 XmNrightPosition
, RIGHT_MARGIN_POS
,
1196 XmNbottomAttachment
, XmATTACH_FORM
,
1197 XmNbottomOffset
, 5, NULL
);
1198 RemapDeleteKey(etDialog
.formatW
);
1199 XtVaSetValues(formatLbl
, XmNuserData
, etDialog
.formatW
, NULL
);
1200 XtAddCallback(etDialog
.formatW
, XmNvalueChangedCallback
, formatChangedCB
, NULL
);
1202 XtVaGetValues(etDialog
.formatW
, XmNheight
, &textHeight
, NULL
);
1203 XtVaSetValues(formatLbl
, XmNheight
, textHeight
, NULL
);
1205 previewFrame
= XtVaCreateManagedWidget("previewFrame", xmFrameWidgetClass
,
1207 XmNtopAttachment
, XmATTACH_WIDGET
,
1208 XmNtopWidget
, selectFrame
,
1209 XmNleftAttachment
, XmATTACH_POSITION
,
1210 XmNleftPosition
, LEFT_MARGIN_POS
,
1211 XmNrightAttachment
, XmATTACH_POSITION
,
1212 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1214 XtVaCreateManagedWidget("previewLabel", xmLabelGadgetClass
,
1216 XmNlabelString
, s1
=XmStringCreateSimple("Preview"),
1217 XmNchildType
, XmFRAME_TITLE_CHILD
,
1218 XmNchildHorizontalAlignment
, XmALIGNMENT_BEGINNING
, NULL
);
1221 previewForm
= XtVaCreateManagedWidget("previewForm", xmFormWidgetClass
,
1223 XmNleftAttachment
, XmATTACH_FORM
,
1224 XmNleftPosition
, LEFT_MARGIN_POS
,
1225 XmNtopAttachment
, XmATTACH_FORM
,
1226 XmNtopOffset
, V_MARGIN
,
1227 XmNrightAttachment
, XmATTACH_FORM
,
1228 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1230 /* Copy a variable width font from one of the labels to use for the
1231 preview (no editing is allowed, and with a fixed size font the
1232 preview easily gets partially obscured). Also copy the form background
1233 color to make it clear that this field is not editable */
1234 XtVaGetValues(formatLbl
, XmNfontList
, &fontList
, NULL
);
1235 XtVaGetValues(previewForm
, XmNbackground
, &background
, NULL
);
1237 etDialog
.previewW
= XtVaCreateManagedWidget("sample",
1238 xmTextFieldWidgetClass
, previewForm
,
1240 XmNcursorPositionVisible
, False
,
1241 XmNtopAttachment
, XmATTACH_FORM
,
1242 XmNleftAttachment
, XmATTACH_FORM
,
1243 XmNleftOffset
, V_MARGIN
,
1244 XmNrightAttachment
, XmATTACH_FORM
,
1245 XmNrightOffset
, V_MARGIN
,
1246 XmNfontList
, fontList
,
1247 XmNbackground
, background
,
1250 previewBox
= XtVaCreateManagedWidget("previewBox", xmFormWidgetClass
,
1252 XmNorientation
, XmHORIZONTAL
,
1253 XmNpacking
, XmPACK_TIGHT
,
1254 XmNradioBehavior
, False
,
1255 XmNleftAttachment
, XmATTACH_FORM
,
1256 XmNrightAttachment
, XmATTACH_FORM
,
1257 XmNtopAttachment
, XmATTACH_WIDGET
,
1258 XmNtopWidget
, etDialog
.previewW
, NULL
);
1260 testLbl
= XtVaCreateManagedWidget("testLabel", xmLabelGadgetClass
,
1262 XmNlabelString
, s1
=XmStringCreateSimple("Test settings: "),
1263 XmNleftAttachment
, XmATTACH_POSITION
,
1264 XmNleftPosition
, LEFT_MARGIN_POS
,
1267 XmNtopAttachment
, XmATTACH_FORM
, NULL
);
1270 etDialog
.oFileChangedW
= XtVaCreateManagedWidget("fileChanged",
1271 xmToggleButtonWidgetClass
, previewBox
,
1272 XmNleftAttachment
, XmATTACH_POSITION
,
1273 XmNleftPosition
, RADIO_INDENT
,
1274 XmNtopAttachment
, XmATTACH_WIDGET
,
1275 XmNtopWidget
, testLbl
,
1276 XmNlabelString
, s1
=XmStringCreateSimple("File modified"),
1277 XmNmnemonic
, 'o', NULL
);
1278 XtAddCallback(etDialog
.oFileChangedW
, XmNvalueChangedCallback
, fileChangedCB
, NULL
);
1281 etDialog
.oFileReadOnlyW
= XtVaCreateManagedWidget("fileReadOnly",
1282 xmToggleButtonWidgetClass
, previewBox
,
1283 XmNleftAttachment
, XmATTACH_WIDGET
,
1284 XmNleftWidget
, etDialog
.oFileChangedW
,
1285 XmNtopAttachment
, XmATTACH_WIDGET
,
1286 XmNtopWidget
, testLbl
,
1287 XmNlabelString
, s1
=XmStringCreateSimple("File read only"),
1288 XmNmnemonic
, 'n', NULL
);
1289 XtAddCallback(etDialog
.oFileReadOnlyW
, XmNvalueChangedCallback
, fileReadOnlyCB
, NULL
);
1292 etDialog
.oFileLockedW
= XtVaCreateManagedWidget("fileLocked",
1293 xmToggleButtonWidgetClass
, previewBox
,
1294 XmNleftAttachment
, XmATTACH_WIDGET
,
1295 XmNleftWidget
, etDialog
.oFileReadOnlyW
,
1296 XmNtopAttachment
, XmATTACH_WIDGET
,
1297 XmNtopWidget
, testLbl
,
1298 XmNlabelString
, s1
=XmStringCreateSimple("File locked"),
1299 XmNmnemonic
, 'l', NULL
);
1300 XtAddCallback(etDialog
.oFileLockedW
, XmNvalueChangedCallback
, fileLockedCB
, NULL
);
1303 etDialog
.oServerNameW
= XtVaCreateManagedWidget("servernameSet",
1304 xmToggleButtonWidgetClass
, previewBox
,
1305 XmNleftAttachment
, XmATTACH_POSITION
,
1306 XmNleftPosition
, RADIO_INDENT
,
1307 XmNtopAttachment
, XmATTACH_WIDGET
,
1308 XmNtopWidget
, etDialog
.oFileChangedW
,
1309 XmNlabelString
, s1
=XmStringCreateSimple("Server name present"),
1310 XmNmnemonic
, 'v', NULL
);
1311 XtAddCallback(etDialog
.oServerNameW
, XmNvalueChangedCallback
, serverNameCB
, NULL
);
1314 etDialog
.oCcViewTagW
= XtVaCreateManagedWidget("ccViewTagSet",
1315 xmToggleButtonWidgetClass
, previewBox
,
1316 XmNleftAttachment
, XmATTACH_POSITION
,
1317 XmNleftPosition
, RADIO_INDENT
,
1318 XmNtopAttachment
, XmATTACH_WIDGET
,
1319 XmNtopWidget
, etDialog
.oServerNameW
,
1320 XmNlabelString
, s1
=XmStringCreateSimple("CC view tag present"),
1324 XmNset
, GetClearCaseViewTag() != NULL
,
1326 XmNmnemonic
, 'w', NULL
);
1328 XtSetSensitive(etDialog
.oCcViewTagW
, False
);
1330 XtAddCallback(etDialog
.oCcViewTagW
, XmNvalueChangedCallback
, ccViewTagCB
, NULL
);
1334 etDialog
.oServerEqualViewW
= XtVaCreateManagedWidget("serverEqualView",
1335 xmToggleButtonWidgetClass
, previewBox
,
1336 XmNleftAttachment
, XmATTACH_WIDGET
,
1337 XmNleftWidget
, etDialog
.oCcViewTagW
,
1338 XmNtopAttachment
, XmATTACH_WIDGET
,
1339 XmNtopWidget
, etDialog
.oServerNameW
,
1340 XmNlabelString
, s1
=XmStringCreateSimple("Server name equals CC view tag "),
1341 XmNmnemonic
, 'q', NULL
);
1343 XtSetSensitive(etDialog
.oServerEqualViewW
, False
);
1345 XtAddCallback(etDialog
.oServerEqualViewW
, XmNvalueChangedCallback
, serverEqualViewCB
, NULL
);
1349 etDialog
.oDirW
= XtVaCreateManagedWidget("pathSet",
1350 xmToggleButtonWidgetClass
, previewBox
,
1351 XmNleftAttachment
, XmATTACH_POSITION
,
1352 XmNleftPosition
, RADIO_INDENT
,
1353 XmNtopAttachment
, XmATTACH_WIDGET
,
1354 XmNtopWidget
, etDialog
.oCcViewTagW
,
1355 XmNlabelString
, s1
=XmStringCreateSimple("Directory present"),
1356 XmNmnemonic
, 'i', NULL
);
1357 XtAddCallback(etDialog
.oDirW
, XmNvalueChangedCallback
, formatChangedCB
, NULL
);
1359 XtVaGetValues(etDialog
.fileW
, XmNheight
, &radioHeight
, NULL
);
1362 buttonForm
= XtVaCreateManagedWidget("buttonForm", xmFormWidgetClass
,
1364 XmNleftAttachment
, XmATTACH_POSITION
,
1365 XmNleftPosition
, LEFT_MARGIN_POS
,
1366 XmNtopAttachment
, XmATTACH_WIDGET
,
1367 XmNtopWidget
, previewFrame
,
1368 XmNtopOffset
, V_MARGIN
,
1369 XmNbottomOffset
, V_MARGIN
,
1370 XmNbottomAttachment
, XmATTACH_FORM
,
1371 XmNrightAttachment
, XmATTACH_POSITION
,
1372 XmNrightPosition
, RIGHT_MARGIN_POS
, NULL
);
1374 applyBtn
= XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass
,
1376 XmNhighlightThickness
, 2,
1377 XmNlabelString
, s1
=XmStringCreateSimple("Apply"),
1378 XmNshowAsDefault
, (short)1,
1379 XmNleftAttachment
, XmATTACH_POSITION
,
1381 XmNrightAttachment
, XmATTACH_POSITION
,
1382 XmNrightPosition
, 25,
1383 XmNbottomAttachment
, XmATTACH_FORM
,
1385 XtAddCallback(applyBtn
, XmNactivateCallback
, applyCB
, NULL
);
1387 XtVaGetValues(applyBtn
, XmNshadowThickness
, &shadowThickness
, NULL
);
1388 defaultBtnOffset
= shadowThickness
+ 4;
1390 dismissBtn
= XtVaCreateManagedWidget("dismiss", xmPushButtonWidgetClass
,
1392 XmNhighlightThickness
, 2,
1393 XmNlabelString
, s1
=XmStringCreateSimple("Dismiss"),
1394 XmNleftAttachment
, XmATTACH_POSITION
,
1395 XmNleftPosition
, 52,
1396 XmNrightAttachment
, XmATTACH_POSITION
,
1397 XmNrightPosition
, 71,
1398 XmNbottomAttachment
, XmATTACH_FORM
,
1399 XmNbottomOffset
, defaultBtnOffset
,
1401 XtAddCallback(dismissBtn
, XmNactivateCallback
, dismissCB
, NULL
);
1404 restoreBtn
= XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass
,
1406 XmNhighlightThickness
, 2,
1407 XmNlabelString
, s1
=XmStringCreateSimple("Default"),
1408 XmNleftAttachment
, XmATTACH_POSITION
,
1409 XmNleftPosition
, 29,
1410 XmNrightAttachment
, XmATTACH_POSITION
,
1411 XmNrightPosition
, 48,
1412 XmNbottomAttachment
, XmATTACH_FORM
,
1413 XmNbottomOffset
, defaultBtnOffset
,
1414 XmNmnemonic
, 'e', NULL
);
1415 XtAddCallback(restoreBtn
, XmNactivateCallback
, restoreCB
, NULL
);
1418 helpBtn
= XtVaCreateManagedWidget("help", xmPushButtonWidgetClass
,
1420 XmNhighlightThickness
, 2,
1421 XmNlabelString
, s1
=XmStringCreateSimple("Help"),
1422 XmNleftAttachment
, XmATTACH_POSITION
,
1423 XmNleftPosition
, 75,
1424 XmNrightAttachment
, XmATTACH_POSITION
,
1425 XmNrightPosition
, 94,
1426 XmNbottomAttachment
, XmATTACH_FORM
,
1427 XmNbottomOffset
, defaultBtnOffset
,
1428 XmNmnemonic
, 'p', NULL
);
1429 XtAddCallback(helpBtn
, XmNactivateCallback
, helpCB
, NULL
);
1432 /* Set initial default button */
1433 XtVaSetValues(etDialog
.form
, XmNdefaultButton
, applyBtn
, NULL
);
1434 XtVaSetValues(etDialog
.form
, XmNcancelButton
, dismissBtn
, NULL
);
1436 /* Handle mnemonic selection of buttons and focus to dialog */
1437 AddDialogMnemonicHandler(etDialog
.form
, FALSE
);
1439 etDialog
.suppressFormatUpdate
= FALSE
;
1442 void EditCustomTitleFormat(Widget parent
, WindowInfo
*window
)
1444 /* copy attributes from current window so that we can use as many
1445 * 'real world' defaults as possible when testing the effect
1446 * of different formatting strings.
1448 strcpy(etDialog
.path
, window
->path
);
1449 strcpy(etDialog
.filename
, window
->filename
);
1451 strcpy(etDialog
.viewTag
, GetClearCaseViewTag() != NULL
?
1452 GetClearCaseViewTag() :
1455 strcpy(etDialog
.serverName
, IsServer
?
1456 GetPrefServerName() :
1458 etDialog
.isServer
= IsServer
;
1459 etDialog
.filenameSet
= window
->filenameSet
;
1460 etDialog
.lockReasons
= window
->lockReasons
;
1461 etDialog
.fileChanged
= window
->fileChanged
;
1463 if (etDialog
.window
!= window
&& etDialog
.form
)
1465 /* Destroy the dialog owned by the other window.
1466 Note: don't rely on the destroy event handler to reset the
1467 form. Events are handled asynchronously, so the old dialog
1468 may continue to live for a while. */
1469 XtDestroyWidget(etDialog
.form
);
1470 etDialog
.form
= NULL
;
1473 etDialog
.window
= window
;
1475 /* Create the dialog if it doesn't already exist */
1476 if (etDialog
.form
== NULL
)
1478 createEditTitleDialog(window
->shell
, window
);
1482 /* If the window is already up, just pop it to the top */
1483 if (XtIsManaged(etDialog
.form
)) {
1485 RaiseShellWindow(XtParent(etDialog
.form
));
1487 /* force update of the dialog */
1489 formatChangedCB(0, 0, 0);
1494 /* set initial value of format field */
1495 XmTextSetString(etDialog
.formatW
, (char *)GetPrefTitleFormat());
1497 /* force update of the dialog */
1499 formatChangedCB(0, 0, 0);
1501 /* put up dialog and wait for user to press ok or cancel */
1502 ManageDialogCenteredOnPointer(etDialog
.form
);