2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: dtpad.h /main/20 1999/09/15 15:14:33 mgreess $ */
24 /**********************************<+>*************************************
25 ***************************************************************************
29 ** Project: COSE dtpad, a memo maker type editor based on the motif
34 ** This is the header file for the dtpad list of file which include:
37 *******************************************************************
38 ** (c) Copyright Hewlett-Packard Company, 1990. All rights are
39 ** reserved. Copying or other reproduction of this program
40 ** except for archival purposes is prohibited without prior
41 ** written consent of Hewlett-Packard Company.
42 ********************************************************************
44 ********************************************************************
45 ** (c) Copyright 1993, 1994 Hewlett-Packard Company
46 ** (c) Copyright 1993, 1994 International Business Machines Corp.
47 ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
48 ** (c) Copyright 1993, 1994 Novell, Inc.
49 ********************************************************************
52 **************************************************************************
53 **********************************<+>*************************************/
63 #include <sys/types.h>
66 #include <X11/Xatom.h>
67 #include <X11/Intrinsic.h>
68 #include <X11/Shell.h>
69 #include <Xm/Protocols.h>
73 #include <Xm/CascadeB.h>
74 #include <Xm/CascadeBG.h>
75 #include <Xm/FileSB.h>
76 #include <Xm/LabelG.h>
79 #include <Xm/MessageB.h>
81 #include <Xm/PushBG.h>
82 #include <Xm/RowColumn.h>
83 #include <Xm/SelectioB.h>
84 #include <Xm/SeparatoG.h>
87 #include <Xm/ToggleB.h>
88 #include <Xm/ToggleBG.h>
90 #include <Dt/Session.h>
93 #include <Dt/Message.h>
94 #include <Dt/UserMsg.h>
95 #include <Dt/Editor.h>
97 #include <Dt/PrintOptionsP.h>
101 #define DTPAD_CLASS_NAME "Dtpad"
102 #define CHECKSPELLING 0
106 #define UNKNOWN_ACTION -1
107 #define EXTEND_SELECTION 0
112 #define DEFAULT_GEOMETRY_STR "80x24"
113 #define DEFAULT_COLS 80
114 #define DEFAULT_ROWS 24
124 /************************************************************************
126 ************************************************************************/
132 Boolean missingFileWarning;
133 Boolean readOnlyWarning;
136 String workspaceList;
142 Boolean exitOnLastClose;
143 } ApplicationData, *ApplicationDataPtr;
146 /************************************************************************
147 * structures related to various dialogs
148 ************************************************************************/
155 /* -----> "Open" file selection box and "Save?" dialog widgets
156 * (indentation indicates widget hierarchy) */
169 ToggleWidgets toggleWidgets;
172 /* -----> "Save As" file selection box and "Already Exists" dialog widgets
173 * (indentation indicates widget hierarchy) */
177 ToggleWidgets toggleWidgets;
181 typedef struct _confirm {
182 int confirmationStatus; /* status from resource-spec'd comfirm dlg */
189 /************************************************************************
190 * structures related to menu bar functions
191 ************************************************************************/
192 /* -----> structs related to "File" pulldown menu */
203 Widget silentPrintBtn;
204 Widget xprintBtn; /* Added temporarily to support X Print Service */
209 void (*pendingFileFunc)();
210 void (*pendingFileHelpFunc)();
215 *netfile, /* obpaque Took Talk string handle to file */
218 pathDir[512], /* dir in specified path */
219 includePathDir[512]; /* dir in specified path */
220 FileWidgets fileWidgets;
227 /* -----> structs related to "Edit" pulldown menu */
244 /* -----> structs related to "Format" pulldown menu */
255 FormatWidgets widgets;
256 int right_margin; /* format size */
260 /* -----> structs related to "Options" pulldown menu */
262 Widget overstrikeBtn,
267 } OptionsMenuWidgets;
270 OptionsMenuWidgets widgets;
273 /* -----> structs related to "Help" pulldown menu */
274 typedef struct _helpStruct {
275 struct _helpStruct *pNext;
276 struct _helpStruct *pPrev;
282 /************************************************************************
283 * structs related to the status line
284 ************************************************************************/
285 typedef struct _statusWidgets {
293 typedef struct _status {
294 StatusWidgets widgets;
300 /************************************************************************
301 * structs related to a ToolTalk Edit/Display/Instantiate message and any
302 * related Quit and Save messages.
303 ************************************************************************/
304 typedef struct _ttEditRequest {
305 Tt_message contract; /* media request */
306 char *msg_id; /* id of ToolTalk media request */
307 Tttk_op op; /* op code = Edit/Display/Instantiate */
308 char *vtype; /* media type */
309 Boolean contents; /* indicates file or buffer request */
310 Boolean returnBufContents; /* indicates if contents returned in reply */
311 char *fileName; /* file name supplied in media request */
312 char *docName; /* title of file/buffer */
313 Tt_pattern savePattern; /* pattern to handle Save requests */
316 typedef struct _ttQuitRequest {
317 Tt_message contract; /* original TTDT_QUIT request */
318 Boolean silent; /* arg #1 */
319 Boolean force; /* arg #2 */
320 char * operation2Quit; /* arg #3 - window to quit (its Edit msg ID) */
323 typedef struct _ttSaveRequest {
324 Tt_message contract; /* original TTDT_SAVE request */
325 char * messageID; /* window to save (i.e. its Edit message ID) */
328 /************************************************************************
329 * Editor struct - the primary sturcture for each Editor instance
330 ************************************************************************/
331 typedef struct _editor {
332 char *progname; /* program name without the full pathname */
333 char *dialogTitle; /* string retrieved from message catalog */
334 Display *display; /* Display */
335 XtAppContext app_context; /* Application Context */
336 ApplicationData xrdb;
337 TTEditRequest ttEditReq; /* ToolTalk Edit/Display/Instantiate msg info */
338 TTQuitRequest ttQuitReq; /* ToolTalk Quit msg info */
339 TTSaveRequest ttSaveReq; /* ToolTalk Save msg info */
340 HelpStruct *pHelpCache;
341 FileStuff fileStuff; /* all data for File functions */
342 EditStuff editStuff; /* all data for Edit functions */
343 FormatStuff formatStuff; /* all data for Format functions */
344 OptionsStuff optionsStuff; /* all data for Options functions */
345 ConfirmStuff confirmStuff; /* data for resource spec'd confirm dialog */
346 StatusStuff statusStuff;
352 Dimension width, height;
354 char select_string[512];
355 Widget app_shell, /* ApplicationShell */
356 editor, /* Dt Editor widget */
357 statusLineMsg, /* Dt Editor widget status line text field */
358 panedWindow, /* Paned window */
359 mainWindow, /* MainWindow */
360 menu_bar, /* RowColumn */
368 unsigned short group_id, /* users group id - for file type checking */
369 user_id; /* the users id - for file type checking */
370 struct _editor *pNextPad;
371 struct _editor *pPrevPad;
376 XtWorkProcId fileExitWorkprocID;
385 /************************************************************************
386 * Printing structs - structures to support prining using the X Print Service
387 ************************************************************************/
389 * Enums for the strings that appear in the header and footer fields
393 PRINT_NONE_STRING_TYPE_ENUM,
394 PRINT_DATE_STRING_TYPE_ENUM,
395 PRINT_DOCNAME_STRING_TYPE_ENUM,
396 PRINT_PAGE_NUMBER_STRING_TYPE_ENUM,
397 PRINT_USER_NAME_STRING_TYPE_ENUM
398 } PrintStringTypeEnum;
402 * Data structure to saving print options from the PrintSetup GUI.
420 * Structure summarizing the setup context for a print job.
421 * Includes the widgets which make up the print setup dialog,
422 * and the printing options retrieved from the print setup dialog.
424 typedef struct print_setup_widgets {
435 typedef struct print_setup {
443 XtPointer cancelClosure,
458 * Structure summarizing a print job including the print options used
459 * and the current state of the job.
461 typedef struct print_output {
474 Dimension marginRight;
475 Dimension marginBottom;
476 Dimension marginLeft;
481 * Structure summarizing a print job including the print options used
482 * and the current state of the job.
484 typedef struct print_job {
485 struct _editor *pPad;
491 PrintOutput *pOutput;
494 DtPrintSetupData *printData;
499 Widget nextpageShell,
504 /************************************************************************
505 * macro to get message catalog strings
506 ************************************************************************/
507 #ifndef NO_MESSAGE_CATALOG
508 # define GETMESSAGE(set, number, string)\
509 _DtpadGetMessage(set, number, string)
511 # define GETMESSAGE(set, number, string)\
515 #define UNNAMED_TITLE ((char *)GETMESSAGE(7, 6, "(UNTITLED)"))
516 /*[SuG 5/10/95] Added for fixing print bug. */
517 #define UNNAMED_TITLE_P ((char *)GETMESSAGE(5, 21, "UNTITLED"))
520 /************************************************************************
521 * functions in fileCB.c
522 ************************************************************************/
523 extern void FileCascadingCB(
527 extern void FileNewCB(
531 extern void FileOpenCB(
535 extern void FileIncludeCB(
539 extern void FileSaveCB(
543 extern void FileSaveAsCB(
547 extern void FilePrintCB(
551 extern void FileXpPrintCB(
555 extern void FileExitCB(
559 extern void NoSaveCB(
563 extern void CancelFileSelectCB(
567 extern void SaveNewLinesCB(
569 XtPointer client_data,
570 XtPointer call_data);
571 extern void SaveAsOkCB(
575 extern void AlrdyExistsOkCB(
579 extern void SaveAsCancelCB(
583 extern void AlrdyExistsCancelCB(
587 extern void AskIfSaveCancelCB(
592 /************************************************************************
593 * functions in fileDlg.c
594 ************************************************************************/
595 extern void PostAlreadyExistsDlg(
597 extern void SetSaveAsDefaultString(Editor *pPad);
598 extern void CreateSaveAsDialog(
600 extern void ExtractAndStoreDir(
604 extern void GetFileName(
608 extern char *DialogTitle(
613 unsigned char dialogType);
614 extern void AskIfSave(
616 extern void PostSaveError(
619 DtEditorErrorCode errorCode);
620 extern void AskForConfirmation(
624 /************************************************************************
625 * functions in editCB.c
626 ************************************************************************/
627 extern void EditUndoCB(
631 extern void EditCutCB(
635 extern void EditCopyCB(
639 extern void EditPasteCB(
643 extern void EditClearCB(
647 extern void EditDeleteCB(
651 extern void SelectAllCB(
655 extern void FindChangeCB(
659 extern void CheckSpellingCB(
663 extern void SetSelectionMenuItems(
665 Boolean sensitivity);
666 extern void TextSelectedCB(
670 extern void TextDeselectedCB(
676 /************************************************************************
677 * functions in formatCB.c
678 ************************************************************************/
679 extern void FormatCB(
683 extern void FormatParaCB(
687 extern void FormatAllCB(
693 /************************************************************************
694 * functions in optionsCB.c
695 ************************************************************************/
696 extern void OverstrikeCB(
701 extern void WordWrapCB(
706 extern void StatusLineCB(
712 /************************************************************************
713 * functions in main.c
714 ************************************************************************/
715 extern void CreatePad(
717 extern void StartDbUpdate(
718 XtPointer clientData);
722 XtPointer clientData);
723 extern void setPanicConditions(void);
724 extern void SetWindowSize(
726 extern void SetAppShellResizeHints(
728 extern void RealizeNewPad(
730 extern void ManageOldPad(
732 Boolean isCurrentlyVisible);
733 extern void InitDtEditSession(
737 extern void SigcldHndlr(
739 extern void UnmanageAllDialogs(
741 extern void RestoreInitialServerResources(
744 #ifndef NO_MESSAGE_CATALOG
745 extern char * _DtpadGetMessage(
752 /************************************************************************
753 * functions in dtpad.c
754 ************************************************************************/
755 extern void CreateDefaultImage(
760 extern void ChangeMainWindowTitle(
762 extern void SetWindowTitles(
764 extern void SetSaveAsLabelAndDialog(
766 extern void CreateMenuBar(
768 extern void CreateEditorWidget(
770 extern Boolean FindOrCreatePad(
772 extern char *MbStrchr(
775 extern char *MbStrchri(
779 extern char *MbStrrchr(
782 extern char *MbBasename(
784 #ifndef NO_MESSAGE_CATALOG
785 extern char *GetMessage(
790 extern void SetStatusMessage(
793 extern void ClearStatusMessage(
797 /************************************************************************
798 * functions in session.c
799 ************************************************************************/
800 extern void SaveSessionCB(
808 extern void restoreSession(
810 extern void RestorePad(
816 /************************************************************************
817 * functions in fileIo.c
818 ************************************************************************/
819 extern void LoadFile(
822 extern char * GetTempFile(
824 extern void PanicSave(
826 extern void SetStatusLineMsg(
830 /************************************************************************
831 * functions in helpDlg.c
832 ************************************************************************/
833 extern void SetHelpVolAndDisplayHelp(
837 extern void DisplayHelp(
841 extern void DisplayNewHelpWindow(
845 extern Widget CreateHelpDialog(
847 extern void DisplayHelpDialog(
854 /************************************************************************
855 * functions in helpCB.c
856 ************************************************************************/
857 extern void HelpMenubarCB(
862 extern void HelpFileCB(
866 extern void HelpEditCB(
870 extern void HelpFormatCB(
874 extern void HelpOptionsCB(
878 extern void HelpHelpCB(
883 extern void HelpOpenDialogCB(
887 extern void HelpIncludeDialogCB(
891 extern void HelpSaveAsDialogCB(
895 extern void HelpFileSaveNewLinesCB(
899 extern void HelpAskIfSaveDialogCB(
903 extern void HelpFileAlreadyExistsCB(
907 extern void HelpEditorWidgetCB(
912 extern void HelpPrintSetupDialogCB(
914 XtPointer client_data,
915 XtPointer call_data );
916 extern void HelpPrintSetupAppSpecificCB(
918 XtPointer client_data,
919 XtPointer call_data );
920 extern void HelpPrintSetupGenericCB(
922 XtPointer client_data,
923 XtPointer call_data );
924 extern void HelpPrintSetupPageHeadersFootersCB(
926 XtPointer client_data,
927 XtPointer call_data );
928 extern void HelpPrintSetupPageMargins(
930 XtPointer client_data,
931 XtPointer call_data );
933 extern void HelpOverviewCB(
937 extern void HelpTasksCB(
941 extern void HelpTOCCB(
945 extern void HelpReferenceCB(
949 extern void HelpOnItemCB(
953 extern void HelpUsingHelpCB(
957 extern void HelpAboutCB(
962 extern void HelpHyperlinkCB(
966 extern void HelpCloseCB(
972 /************************************************************************
973 * functions in ttMsgSupport.c
974 ************************************************************************/
975 extern Tt_status TTstartDesktopMediaExchange(
976 Widget topLevelWithWmCommand,
978 extern Boolean TTmediaDepositContents(
980 extern Boolean TTmediaReply(
982 extern void TTresetQuitArgs(
984 extern void TTfailPendingQuit(
986 extern Tt_status TTdesktopOpen(
989 Boolean sendStarted );
990 extern void TTwarning(
995 /************************************************************************
996 * functions in printJob.c
997 ************************************************************************/
998 extern PrintJob * PrintJobCreate(
1003 extern void PrintJobDestroy(
1005 extern void PrintJobExecute(
1007 extern void PrintJobCancel(
1010 extern Display * PrintJobGetErrorPrintDisplay();
1011 extern void PrintJobSetErrorPrintDisplay(Display *display);
1012 extern Boolean PrintJobIsActivePrintDisplay(Display *display);
1014 /************************************************************************
1015 * functions in printOption.c
1016 ************************************************************************/
1017 extern void PrintOptionsGetCurrent(
1018 PrintOptions *pOptions);
1019 extern void PrintOptionsGetDefault(
1020 PrintOptions *pOptions);
1021 extern void PrintOptionsSave(
1022 PrintOptions *pOptions);
1024 /************************************************************************
1025 * functions in printOutput.c
1026 ************************************************************************/
1027 extern PrintOutput *PrintOutputCreate(
1029 extern void PrintOutputDestroy(
1030 PrintOutput *pOutput);
1031 extern void PrintOutputHideFooters(
1032 PrintOutput *pOutput);
1033 extern void PrintOutputShowFooters(
1034 PrintOutput *pOutput);
1035 extern void PrintOutputHideHeaders(
1036 PrintOutput *pOutput);
1037 extern void PrintOutputShowHeaders(
1038 PrintOutput *pOutput);
1039 extern void PrintOutputSetHdrFtrString(
1040 PrintOutput *pOutput,
1041 _DtPrintHdrFtrEnum which,
1043 extern void PrintOutputSetHdrFtrStrings(
1044 PrintOutput *pOutput,
1049 extern void PrintOutputSetPageMargin(
1050 PrintOutput *pOutput,
1051 _DtPrintMarginEnum which,
1053 Boolean *parseError);
1054 extern void PrintOutputSetPageMargins(
1055 PrintOutput *pOutput,
1056 const char *marginTop,
1057 const char *marginRight,
1058 const char *marginBottom,
1059 const char *marginLeft,
1060 Boolean *parseError);
1061 extern void PrintOutputSetWordWrap(
1062 PrintOutput *pOutput,
1064 extern int PrintOutputGetLinesPerPage(
1065 PrintOutput *pOutput);
1066 extern int PrintOutputGetNumLines(
1067 PrintOutput *pOutput);
1068 extern Boolean PrintOutputPageUp(
1069 PrintOutput *pOutput);
1070 extern Boolean PrintOutputPageDown(
1071 PrintOutput *pOutput);
1072 extern void PrintOutputFirstPage(
1073 PrintOutput *pOutput);
1074 extern DtEditorErrorCode PrintOutputLoadFile(
1075 PrintOutput *pOutput,
1078 /************************************************************************
1079 * functions in printSetup.c
1080 ************************************************************************/
1081 extern PrintSetup *PrintSetupCreate(
1086 XtCallbackProc cancelCB, XtPointer cancelClosure,
1087 XtCallbackProc closeDisplayCB, XtPointer closeDisplayClosure,
1088 XtCallbackProc printCB, XtPointer printClosure,
1089 XtCallbackProc setupCB, XtPointer setupClosure
1091 extern void PrintSetupDestroy(
1092 PrintSetup *pSetup);
1093 extern void PrintSetupDisplay(
1094 PrintSetup *pSetup);
1095 extern void PrintSetupSaveOptions(
1096 PrintSetup *pSetup);
1097 extern PrintStringTypeEnum PrintSetupGetHdrFtrSpec(
1099 _DtPrintHdrFtrEnum which);
1100 extern char *PrintSetupGetMarginSpec(
1102 _DtPrintMarginEnum which);
1103 extern Boolean PrintSetupGetDefaultPrintData(
1105 DtPrintSetupData *pData);
1106 extern Boolean PrintSetupUseWordWrap(
1107 PrintSetup *pSetup);
1109 #endif /* DTPAD_H */