1 /* $TOG: dtpad.h /main/20 1999/09/15 15:14:33 mgreess $ */
2 /**********************************<+>*************************************
3 ***************************************************************************
7 ** Project: COSE dtpad, a memo maker type editor based on the motif
12 ** This is the header file for the dtpad list of file which include:
15 *******************************************************************
16 ** (c) Copyright Hewlett-Packard Company, 1990. All rights are
17 ** reserved. Copying or other reproduction of this program
18 ** except for archival purposes is prohibited without prior
19 ** written consent of Hewlett-Packard Company.
20 ********************************************************************
22 ********************************************************************
23 ** (c) Copyright 1993, 1994 Hewlett-Packard Company
24 ** (c) Copyright 1993, 1994 International Business Machines Corp.
25 ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
26 ** (c) Copyright 1993, 1994 Novell, Inc.
27 ********************************************************************
30 **************************************************************************
31 **********************************<+>*************************************/
40 #include <sys/types.h>
43 #include <X11/Xatom.h>
44 #include <X11/Intrinsic.h>
45 #include <X11/Shell.h>
46 #include <Xm/Protocols.h>
50 #include <Xm/CascadeB.h>
51 #include <Xm/CascadeBG.h>
52 #include <Xm/FileSB.h>
53 #include <Xm/LabelG.h>
56 #include <Xm/MessageB.h>
58 #include <Xm/PushBG.h>
59 #include <Xm/RowColumn.h>
60 #include <Xm/SelectioB.h>
61 #include <Xm/SeparatoG.h>
64 #include <Xm/ToggleB.h>
65 #include <Xm/ToggleBG.h>
67 #include <Dt/Session.h>
70 #include <Dt/Message.h>
71 #include <Dt/UserMsg.h>
72 #include <Dt/Editor.h>
74 #include <Dt/PrintOptionsP.h>
78 #define DTPAD_CLASS_NAME "Dtpad"
79 #define CHECKSPELLING 0
83 #define UNKNOWN_ACTION -1
84 #define EXTEND_SELECTION 0
89 #define DEFAULT_GEOMETRY_STR "80x24"
90 #define DEFAULT_COLS 80
91 #define DEFAULT_ROWS 24
101 /************************************************************************
103 ************************************************************************/
109 Boolean missingFileWarning;
110 Boolean readOnlyWarning;
113 String workspaceList;
119 Boolean exitOnLastClose;
120 } ApplicationData, *ApplicationDataPtr;
123 /************************************************************************
124 * structures related to various dialogs
125 ************************************************************************/
132 /* -----> "Open" file selection box and "Save?" dialog widgets
133 * (indentation indicates widget hierarchy) */
146 ToggleWidgets toggleWidgets;
149 /* -----> "Save As" file selection box and "Already Exists" dialog widgets
150 * (indentation indicates widget hierarchy) */
154 ToggleWidgets toggleWidgets;
158 typedef struct _confirm {
159 int confirmationStatus; /* status from resource-spec'd comfirm dlg */
166 /************************************************************************
167 * structures related to menu bar functions
168 ************************************************************************/
169 /* -----> structs related to "File" pulldown menu */
180 Widget silentPrintBtn;
181 Widget xprintBtn; /* Added temporarily to support X Print Service */
186 void (*pendingFileFunc)();
187 void (*pendingFileHelpFunc)();
192 *netfile, /* obpaque Took Talk string handle to file */
195 pathDir[512], /* dir in specified path */
196 includePathDir[512]; /* dir in specified path */
197 FileWidgets fileWidgets;
204 /* -----> structs related to "Edit" pulldown menu */
221 /* -----> structs related to "Format" pulldown menu */
232 FormatWidgets widgets;
233 int right_margin; /* format size */
237 /* -----> structs related to "Options" pulldown menu */
239 Widget overstrikeBtn,
244 } OptionsMenuWidgets;
247 OptionsMenuWidgets widgets;
250 /* -----> structs related to "Help" pulldown menu */
251 typedef struct _helpStruct {
252 struct _helpStruct *pNext;
253 struct _helpStruct *pPrev;
259 /************************************************************************
260 * structs related to the status line
261 ************************************************************************/
262 typedef struct _statusWidgets {
270 typedef struct _status {
271 StatusWidgets widgets;
277 /************************************************************************
278 * structs related to a ToolTalk Edit/Display/Instantiate message and any
279 * related Quit and Save messages.
280 ************************************************************************/
281 typedef struct _ttEditRequest {
282 Tt_message contract; /* media request */
283 char *msg_id; /* id of ToolTalk media request */
284 Tttk_op op; /* op code = Edit/Display/Instantiate */
285 char *vtype; /* media type */
286 Boolean contents; /* indicates file or buffer request */
287 Boolean returnBufContents; /* indicates if contents returned in reply */
288 char *fileName; /* file name supplied in media request */
289 char *docName; /* title of file/buffer */
290 Tt_pattern savePattern; /* pattern to handle Save requests */
293 typedef struct _ttQuitRequest {
294 Tt_message contract; /* original TTDT_QUIT request */
295 Boolean silent; /* arg #1 */
296 Boolean force; /* arg #2 */
297 char * operation2Quit; /* arg #3 - window to quit (its Edit msg ID) */
300 typedef struct _ttSaveRequest {
301 Tt_message contract; /* original TTDT_SAVE request */
302 char * messageID; /* window to save (i.e. its Edit message ID) */
305 /************************************************************************
306 * Editor struct - the primary sturcture for each Editor instance
307 ************************************************************************/
308 typedef struct _editor {
309 char *progname; /* program name without the full pathname */
310 char *dialogTitle; /* string retrieved from message catalog */
311 Display *display; /* Display */
312 XtAppContext app_context; /* Application Context */
313 ApplicationData xrdb;
314 TTEditRequest ttEditReq; /* ToolTalk Edit/Display/Instantiate msg info */
315 TTQuitRequest ttQuitReq; /* ToolTalk Quit msg info */
316 TTSaveRequest ttSaveReq; /* ToolTalk Save msg info */
317 HelpStruct *pHelpCache;
318 FileStuff fileStuff; /* all data for File functions */
319 EditStuff editStuff; /* all data for Edit functions */
320 FormatStuff formatStuff; /* all data for Format functions */
321 OptionsStuff optionsStuff; /* all data for Options functions */
322 ConfirmStuff confirmStuff; /* data for resource spec'd confirm dialog */
323 StatusStuff statusStuff;
329 Dimension width, height;
331 char select_string[512];
332 Widget app_shell, /* ApplicationShell */
333 editor, /* Dt Editor widget */
334 statusLineMsg, /* Dt Editor widget status line text field */
335 panedWindow, /* Paned window */
336 mainWindow, /* MainWindow */
337 menu_bar, /* RowColumn */
345 unsigned short group_id, /* users group id - for file type checking */
346 user_id; /* the users id - for file type checking */
347 struct _editor *pNextPad;
348 struct _editor *pPrevPad;
353 XtWorkProcId fileExitWorkprocID;
362 /************************************************************************
363 * Printing structs - structures to support prining using the X Print Service
364 ************************************************************************/
366 * Enums for the strings that appear in the header and footer fields
370 PRINT_NONE_STRING_TYPE_ENUM,
371 PRINT_DATE_STRING_TYPE_ENUM,
372 PRINT_DOCNAME_STRING_TYPE_ENUM,
373 PRINT_PAGE_NUMBER_STRING_TYPE_ENUM,
374 PRINT_USER_NAME_STRING_TYPE_ENUM
375 } PrintStringTypeEnum;
379 * Data structure to saving print options from the PrintSetup GUI.
397 * Structure summarizing the setup context for a print job.
398 * Includes the widgets which make up the print setup dialog,
399 * and the printing options retrieved from the print setup dialog.
401 typedef struct print_setup_widgets {
412 typedef struct print_setup {
420 XtPointer cancelClosure,
435 * Structure summarizing a print job including the print options used
436 * and the current state of the job.
438 typedef struct print_output {
451 Dimension marginRight;
452 Dimension marginBottom;
453 Dimension marginLeft;
458 * Structure summarizing a print job including the print options used
459 * and the current state of the job.
461 typedef struct print_job {
462 struct _editor *pPad;
468 PrintOutput *pOutput;
471 DtPrintSetupData *printData;
476 Widget nextpageShell,
481 /************************************************************************
482 * macro to get message catalog strings
483 ************************************************************************/
484 #ifndef NO_MESSAGE_CATALOG
485 # define GETMESSAGE(set, number, string)\
486 _DtpadGetMessage(set, number, string)
488 # define GETMESSAGE(set, number, string)\
492 #define UNNAMED_TITLE ((char *)GETMESSAGE(7, 6, "(UNTITLED)"))
493 /*[SuG 5/10/95] Added for fixing print bug. */
494 #define UNNAMED_TITLE_P ((char *)GETMESSAGE(5, 21, "UNTITLED"))
497 /************************************************************************
498 * functions in fileCB.c
499 ************************************************************************/
500 extern void FileCascadingCB(
504 extern void FileNewCB(
508 extern void FileOpenCB(
512 extern void FileIncludeCB(
516 extern void FileSaveCB(
520 extern void FileSaveAsCB(
524 extern void FilePrintCB(
528 extern void FileXpPrintCB(
532 extern void FileExitCB(
536 extern void NoSaveCB(
540 extern void CancelFileSelectCB(
544 extern void SaveNewLinesCB(
546 XtPointer client_data,
547 XtPointer call_data);
548 extern void SaveAsOkCB(
552 extern void AlrdyExistsOkCB(
556 extern void SaveAsCancelCB(
560 extern void AlrdyExistsCancelCB(
564 extern void AskIfSaveCancelCB(
569 /************************************************************************
570 * functions in fileDlg.c
571 ************************************************************************/
572 extern void PostAlreadyExistsDlg(
574 extern void SetSaveAsDefaultString(Editor *pPad);
575 extern void CreateSaveAsDialog(
577 extern void ExtractAndStoreDir(
581 extern void GetFileName(
585 extern char *DialogTitle(
590 unsigned char dialogType);
591 extern void AskIfSave(
593 extern void PostSaveError(
596 DtEditorErrorCode errorCode);
597 extern void AskForConfirmation(
601 /************************************************************************
602 * functions in editCB.c
603 ************************************************************************/
604 extern void EditUndoCB(
608 extern void EditCutCB(
612 extern void EditCopyCB(
616 extern void EditPasteCB(
620 extern void EditClearCB(
624 extern void EditDeleteCB(
628 extern void SelectAllCB(
632 extern void FindChangeCB(
636 extern void CheckSpellingCB(
640 extern void SetSelectionMenuItems(
642 Boolean sensitivity);
643 extern void TextSelectedCB(
647 extern void TextDeselectedCB(
653 /************************************************************************
654 * functions in formatCB.c
655 ************************************************************************/
656 extern void FormatCB(
660 extern void FormatParaCB(
664 extern void FormatAllCB(
670 /************************************************************************
671 * functions in optionsCB.c
672 ************************************************************************/
673 extern void OverstrikeCB(
678 extern void WordWrapCB(
683 extern void StatusLineCB(
689 /************************************************************************
690 * functions in main.c
691 ************************************************************************/
692 extern void CreatePad(
694 extern void StartDbUpdate(
695 XtPointer clientData);
699 XtPointer clientData);
700 extern void setPanicConditions(void);
701 extern void SetWindowSize(
703 extern void SetAppShellResizeHints(
705 extern void RealizeNewPad(
707 extern void ManageOldPad(
709 Boolean isCurrentlyVisible);
710 extern void InitDtEditSession(
714 extern void SigcldHndlr(
716 extern void UnmanageAllDialogs(
718 extern void RestoreInitialServerResources(
721 #ifndef NO_MESSAGE_CATALOG
722 extern char * _DtpadGetMessage(
729 /************************************************************************
730 * functions in dtpad.c
731 ************************************************************************/
732 extern void CreateDefaultImage(
737 extern void ChangeMainWindowTitle(
739 extern void SetWindowTitles(
741 extern void SetSaveAsLabelAndDialog(
743 extern void CreateMenuBar(
745 extern void CreateEditorWidget(
747 extern Boolean FindOrCreatePad(
749 extern char *MbStrchr(
752 extern char *MbStrchri(
756 extern char *MbStrrchr(
759 extern char *MbBasename(
761 #ifndef NO_MESSAGE_CATALOG
762 extern char *GetMessage(
767 extern void SetStatusMessage(
770 extern void ClearStatusMessage(
774 /************************************************************************
775 * functions in session.c
776 ************************************************************************/
777 extern void SaveSessionCB(
785 extern void restoreSession(
787 extern void RestorePad(
793 /************************************************************************
794 * functions in fileIo.c
795 ************************************************************************/
796 extern void LoadFile(
799 extern char * GetTempFile(
801 extern void PanicSave(
803 extern void SetStatusLineMsg(
807 /************************************************************************
808 * functions in helpDlg.c
809 ************************************************************************/
810 extern void SetHelpVolAndDisplayHelp(
814 extern void DisplayHelp(
818 extern void DisplayNewHelpWindow(
822 extern Widget CreateHelpDialog(
824 extern void DisplayHelpDialog(
831 /************************************************************************
832 * functions in helpCB.c
833 ************************************************************************/
834 extern void HelpMenubarCB(
839 extern void HelpFileCB(
843 extern void HelpEditCB(
847 extern void HelpFormatCB(
851 extern void HelpOptionsCB(
855 extern void HelpHelpCB(
860 extern void HelpOpenDialogCB(
864 extern void HelpIncludeDialogCB(
868 extern void HelpSaveAsDialogCB(
872 extern void HelpFileSaveNewLinesCB(
876 extern void HelpAskIfSaveDialogCB(
880 extern void HelpFileAlreadyExistsCB(
884 extern void HelpEditorWidgetCB(
889 extern void HelpPrintSetupDialogCB(
891 XtPointer client_data,
892 XtPointer call_data );
893 extern void HelpPrintSetupAppSpecificCB(
895 XtPointer client_data,
896 XtPointer call_data );
897 extern void HelpPrintSetupGenericCB(
899 XtPointer client_data,
900 XtPointer call_data );
901 extern void HelpPrintSetupPageHeadersFootersCB(
903 XtPointer client_data,
904 XtPointer call_data );
905 extern void HelpPrintSetupPageMargins(
907 XtPointer client_data,
908 XtPointer call_data );
910 extern void HelpOverviewCB(
914 extern void HelpTasksCB(
918 extern void HelpTOCCB(
922 extern void HelpReferenceCB(
926 extern void HelpOnItemCB(
930 extern void HelpUsingHelpCB(
934 extern void HelpAboutCB(
939 extern void HelpHyperlinkCB(
943 extern void HelpCloseCB(
949 /************************************************************************
950 * functions in ttMsgSupport.c
951 ************************************************************************/
952 extern Tt_status TTstartDesktopMediaExchange(
953 Widget topLevelWithWmCommand,
955 extern Boolean TTmediaDepositContents(
957 extern Boolean TTmediaReply(
959 extern void TTresetQuitArgs(
961 extern void TTfailPendingQuit(
963 extern Tt_status TTdesktopOpen(
966 Boolean sendStarted );
967 extern void TTwarning(
972 /************************************************************************
973 * functions in printJob.c
974 ************************************************************************/
975 extern PrintJob * PrintJobCreate(
980 extern void PrintJobDestroy(
982 extern void PrintJobExecute(
984 extern void PrintJobCancel(
987 extern Display * PrintJobGetErrorPrintDisplay();
988 extern void PrintJobSetErrorPrintDisplay(Display *display);
989 extern Boolean PrintJobIsActivePrintDisplay(Display *display);
991 /************************************************************************
992 * functions in printOption.c
993 ************************************************************************/
994 extern void PrintOptionsGetCurrent(
995 PrintOptions *pOptions);
996 extern void PrintOptionsGetDefault(
997 PrintOptions *pOptions);
998 extern void PrintOptionsSave(
999 PrintOptions *pOptions);
1001 /************************************************************************
1002 * functions in printOutput.c
1003 ************************************************************************/
1004 extern PrintOutput *PrintOutputCreate(
1006 extern void PrintOutputDestroy(
1007 PrintOutput *pOutput);
1008 extern void PrintOutputHideFooters(
1009 PrintOutput *pOutput);
1010 extern void PrintOutputShowFooters(
1011 PrintOutput *pOutput);
1012 extern void PrintOutputHideHeaders(
1013 PrintOutput *pOutput);
1014 extern void PrintOutputShowHeaders(
1015 PrintOutput *pOutput);
1016 extern void PrintOutputSetHdrFtrString(
1017 PrintOutput *pOutput,
1018 _DtPrintHdrFtrEnum which,
1020 extern void PrintOutputSetHdrFtrStrings(
1021 PrintOutput *pOutput,
1026 extern void PrintOutputSetPageMargin(
1027 PrintOutput *pOutput,
1028 _DtPrintMarginEnum which,
1030 Boolean *parseError);
1031 extern void PrintOutputSetPageMargins(
1032 PrintOutput *pOutput,
1033 const char *marginTop,
1034 const char *marginRight,
1035 const char *marginBottom,
1036 const char *marginLeft,
1037 Boolean *parseError);
1038 extern void PrintOutputSetWordWrap(
1039 PrintOutput *pOutput,
1041 extern int PrintOutputGetLinesPerPage(
1042 PrintOutput *pOutput);
1043 extern int PrintOutputGetNumLines(
1044 PrintOutput *pOutput);
1045 extern Boolean PrintOutputPageUp(
1046 PrintOutput *pOutput);
1047 extern Boolean PrintOutputPageDown(
1048 PrintOutput *pOutput);
1049 extern void PrintOutputFirstPage(
1050 PrintOutput *pOutput);
1051 extern DtEditorErrorCode PrintOutputLoadFile(
1052 PrintOutput *pOutput,
1055 /************************************************************************
1056 * functions in printSetup.c
1057 ************************************************************************/
1058 extern PrintSetup *PrintSetupCreate(
1063 XtCallbackProc cancelCB, XtPointer cancelClosure,
1064 XtCallbackProc closeDisplayCB, XtPointer closeDisplayClosure,
1065 XtCallbackProc printCB, XtPointer printClosure,
1066 XtCallbackProc setupCB, XtPointer setupClosure
1068 extern void PrintSetupDestroy(
1069 PrintSetup *pSetup);
1070 extern void PrintSetupDisplay(
1071 PrintSetup *pSetup);
1072 extern void PrintSetupSaveOptions(
1073 PrintSetup *pSetup);
1074 extern PrintStringTypeEnum PrintSetupGetHdrFtrSpec(
1076 _DtPrintHdrFtrEnum which);
1077 extern char *PrintSetupGetMarginSpec(
1079 _DtPrintMarginEnum which);
1080 extern Boolean PrintSetupGetDefaultPrintData(
1082 DtPrintSetupData *pData);
1083 extern Boolean PrintSetupUseWordWrap(
1084 PrintSetup *pSetup);
1086 #endif /* DTPAD_H */