Files
lotherkandClaude Sonnet 5.5 bf0bd544fe docs/reference/file-dialog.txt: the stock open/save dialog and how each program uses it (t0189, step 1)
What XmFileSelectionBox offers (resources, fileTypeMask values, search procs
that replace the list filling, the callback struct, the child names incl.
WORK_AREA), and the call sites of dtpad, dtphoto, dtpaint, dtsystemsettings,
dtmail and dticon with what each sets.  Findings: dtpad's Open reaches into the
box (filter text, selection text, file list), dtmail already adds its own
toggle 'Show hidden folders and files' as a child of the dialog, dticon uses
the widget class with all its labels, four programs remove the help button.
Not yet read: dtfile's Navigation.c and Columns.c (step 2); whether the
replacement is a new widget or a skin over the stock box is left open.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 22:31:31 +00:00

90 lines
5.7 KiB
Plaintext

The open and save dialog -- saved documentation (t0189, step 1)
Read 2026-11-14. Sources: ext/src/mcde/motif/doc/man/man3/XmFileSelectionBox.3
and XmFileSelectionBoxGetChild.3 (the Motif 2.3.8 pages of this tree, rendered
with man -l), and the call sites listed in section 3 (file:line, read today).
NOT yet read: dtfile's Navigation.c and Columns.c (step 2 of the task: the
places list and the column view that the new dialog is to share with dtfile).
1. What the stock dialog offers (XmFileSelectionBox.3)
- Created by XmCreateFileSelectionDialog(parent, name, args, n), a dialog
shell around the widget; the programs below all use it.
- Resources the page lists: XmNdirectory, XmNdirMask, XmNpattern,
XmNdirSpec, XmNfileTypeMask, XmNfileFilterStyle, XmNpathMode,
XmNdirListItems/ItemCount, XmNfileListItems/ItemCount, XmNlistUpdated,
XmNnoMatchString, XmNmustMatch, XmNdirSearchProc, XmNfileSearchProc,
XmNqualifySearchDataProc, the label strings (XmNfilterLabelString,
XmNdirListLabelString, XmNfileListLabelString, XmNselectionLabelString,
XmNokLabelString, XmNapplyLabelString, XmNcancelLabelString,
XmNhelpLabelString), the callbacks XmNokCallback, XmNapplyCallback,
XmNcancelCallback, XmNnoMatchCallback, XmNhelpCallback.
- "XmNfileTypeMask: Specifies the type of files listed in the file list.
The possible values are XmFILE_REGULAR (only regular files),
XmFILE_DIRECTORY (only directories), XmFILE_ANY_TYPE."
- "XmNfileFilterStyle: Specifies whether or not the "hidden" files (those
whose names begin with . (period) ...) will be listed" -- XmFILTER_NONE or
XmFILTER_HIDDEN_FILES.
- "XmNdirSearchProc: Specifies a directory search procedure to replace the
default directory search procedure ... you can replace the default search
procedure." XmNfileSearchProc says the same for files: the application
can replace how the lists are filled.
- The callbacks get XmFileSelectionBoxCallbackStruct: reason, event, value
(the chosen path, an XmString), length, mask, dir, pattern (each with its
length).
- XmFileSelectionBoxGetChild (the page's list): XmDIALOG_APPLY_BUTTON,
CANCEL_BUTTON, DEFAULT_BUTTON, DIR_LIST, DIR_LIST_LABEL, FILTER_LABEL,
FILTER_TEXT, HELP_BUTTON, LIST, LIST_LABEL, OK_BUTTON, SELECTION_LABEL,
SEPARATOR, TEXT, WORK_AREA. A WORK_AREA child exists; the pages say
nothing more about it.
2. What the task asks of a replacement (t0189): a sidebar of places, views
(list, columns) with a preview, a search field, an area of the program under
the list ("Plain Text Encoding"), Cancel and Open (default), a save variant;
a call that can replace XmCreateFileSelectionDialog "in a few lines".
3. How the programs use the stock dialog today (what the replacement must carry)
- dtpad/fileDlg.c:345 (Save As): XmNdialogTitle, XmNmwmFunctions (move,
close), XmNmwmDecorations (border, title), XmNallowShellResize False;
XmNcancelCallback, XmNokCallback, XmNhelpCallback.
- dtpad/fileDlg.c:574 (Open): XmNhelpLabelString, XmNcancelCallback, and
it reaches INTO the box: XmFileSelectionBoxGetChild for the filter text,
the selection text and the file list (pSelect->filter_text, select_text,
file_list). dtpad needs more than a drop-in call.
- dtphoto/dtphoto.c:1000 and dtpaint/dtpaint.c:673: "file", XmNokCallback,
XmNcancelCallback, XmNfileTypeMask XmFILE_REGULAR; dtpaint hands a save
flag to the OK callback (one dialog for open and save).
- dtsystemsettings/desktop.c:505 and sharing.c:270: XmNfileTypeMask
XmFILE_DIRECTORY (a folder chooser), XmNdialogTitle, one callback for OK and
Cancel, the help button unmanaged.
- dtmail/MotifApp/SelectFileCmd.C:172: XmNdialogTitle, XmNokLabelString, and
a ToggleButton "Show hidden folders and files" that it creates as a CHILD
of the dialog (XtVaCreateManagedWidget on _fileBrowser, XmNnavigationType
XmSTICKY_TAB_GROUP): a control of the program inside the stock box -- the
"area of the program" the task asks for already exists in this use.
dtmail/dtmail/AttachCmds.C:107
and :662: help button unmanaged, the file list's XmNselectionPolicy
XmBROWSE_SELECT, XmNdirectory set as a typed string, XmNcancelCallback.
- dticon/fileIODialog.c:126 uses the WIDGET CLASS (xmFileSelectionBoxWidgetClass,
not the dialog helper) and sets every label string (filter, dir list,
file list, selection, apply, cancel, help).
- Not examined: dtprintinfo/libUI/MotifUI/Dialog.C:335, dtcreate/OpenFile.c:163,
dtinfo/.../AddLibraryAgentMotif.C:251, dtudcexch/getbdffn.c:64,
lib/DtPrint/PsubDefProc.c:555; dtappbuilder has its own choosers and the
examples/ and motif/demos use the stock box as samples.
- In four programs the help button is removed; the common calls are the OK,
Cancel and Help callbacks, a title, files versus folders, and a start
folder.
4. What follows, as a reading and not as a measurement
- A replacement needs: title, mode (open, save, folder), OK/Cancel/Help
callbacks with the chosen path, a start folder, an area for the program
(dtpad's encoding; the stock WORK_AREA is the nearest thing), and
"folders only" (dtsystemsettings, dtpaint save).
- dtpad's Open reads the filter text, the selection text and the list: it has
to be reworked, not just recompiled, when it moves to the new dialog.
- dticon uses the widget class with all its labels, so its conversion is its
own piece of work.
5. Not decided here: whether McdeFileDialog is a new widget (the task) or a
skin over XmFileSelectionBox with XmNdirSearchProc / XmNfileSearchProc and a
work area; that needs step 2 (what dtfile's code gives to share).