[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/xfns.c [lexbind]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/src/xfns.c [lexbind] |
Date: |
Thu, 04 Nov 2004 08:28:48 -0500 |
Index: emacs/src/xfns.c
diff -c emacs/src/xfns.c:1.549.2.17 emacs/src/xfns.c:1.549.2.18
*** emacs/src/xfns.c:1.549.2.17 Fri Oct 29 02:05:11 2004
--- emacs/src/xfns.c Thu Nov 4 13:12:29 2004
***************
*** 5106,5132 ****
}
! DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0,
doc: /* Read file name, prompting with PROMPT in directory DIR.
! Use a file selection dialog.
! Select DEFAULT-FILENAME in the dialog's file selection box, if
! specified. Don't let the user enter a file name in the file
! selection dialog's entry field, if MUSTMATCH is non-nil. */)
! (prompt, dir, default_filename, mustmatch)
! Lisp_Object prompt, dir, default_filename, mustmatch;
{
int result;
struct frame *f = SELECTED_FRAME ();
Lisp_Object file = Qnil;
! Widget dialog, text, list, help;
Arg al[10];
int ac = 0;
extern XtAppContext Xt_app_con;
XmString dir_xmstring, pattern_xmstring;
int count = SPECPDL_INDEX ();
! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
! GCPRO5 (prompt, dir, default_filename, mustmatch, file);
CHECK_STRING (prompt);
CHECK_STRING (dir);
--- 5106,5131 ----
}
! DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
doc: /* Read file name, prompting with PROMPT in directory DIR.
! Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
! selection box, if specified. If MUSTMATCH is non-nil, the returned file
! or directory must exist. ONLY-DIR-P is ignored." */)
! (prompt, dir, default_filename, mustmatch, only_dir_p)
! Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
{
int result;
struct frame *f = SELECTED_FRAME ();
Lisp_Object file = Qnil;
! Widget dialog, text, help;
Arg al[10];
int ac = 0;
extern XtAppContext Xt_app_con;
XmString dir_xmstring, pattern_xmstring;
int count = SPECPDL_INDEX ();
! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
! GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
CHECK_STRING (prompt);
CHECK_STRING (dir);
***************
*** 5159,5167 ****
XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb,
(XtPointer) &result);
! /* Disable the help button since we can't display help. */
help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
! XtSetSensitive (help, False);
/* Mark OK button as default. */
XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON),
--- 5158,5166 ----
XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb,
(XtPointer) &result);
! /* Remove the help button since we can't display help. */
help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
! XtUnmanageChild (help);
/* Mark OK button as default. */
XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON),
***************
*** 5183,5212 ****
/* Manage the dialog, so that list boxes get filled. */
XtManageChild (dialog);
- /* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME
- must include the path for this to work. */
- list = XmFileSelectionBoxGetChild (dialog, XmDIALOG_LIST);
if (STRINGP (default_filename))
{
XmString default_xmstring;
! int item_pos;
! default_xmstring
! = XmStringCreateLocalized (SDATA (default_filename));
- if (!XmListItemExists (list, default_xmstring))
- {
- /* Add a new item if DEFAULT_FILENAME is not in the list. */
- XmListAddItem (list, default_xmstring, 0);
- item_pos = 0;
- }
- else
- item_pos = XmListItemPos (list, default_xmstring);
XmStringFree (default_xmstring);
-
- /* Select the item and scroll it into view. */
- XmListSelectPos (list, item_pos, True);
- XmListSetPos (list, item_pos);
}
/* Process events until the user presses Cancel or OK. */
--- 5182,5211 ----
/* Manage the dialog, so that list boxes get filled. */
XtManageChild (dialog);
if (STRINGP (default_filename))
{
XmString default_xmstring;
! Widget wtext = XmFileSelectionBoxGetChild (dialog, XmDIALOG_TEXT);
! Widget list = XmFileSelectionBoxGetChild (dialog, XmDIALOG_LIST);
! XmTextPosition last_pos = XmTextFieldGetLastPosition (wtext);
! XmTextFieldReplace (wtext, 0, last_pos,
! (SDATA (Ffile_name_nondirectory
(default_filename))));
!
! /* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME
! must include the path for this to work. */
!
! default_xmstring = XmStringCreateLocalized (SDATA (default_filename));
!
! if (XmListItemExists (list, default_xmstring))
! {
! int item_pos = XmListItemPos (list, default_xmstring);
! /* Select the item and scroll it into view. */
! XmListSelectPos (list, item_pos, True);
! XmListSetPos (list, item_pos);
! }
XmStringFree (default_xmstring);
}
/* Process events until the user presses Cancel or OK. */
***************
*** 5250,5272 ****
#ifdef USE_GTK
! DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0,
! "Read file name, prompting with PROMPT in directory DIR.\n\
! Use a file selection dialog.\n\
! Select DEFAULT-FILENAME in the dialog's file selection box, if\n\
! specified. Don't let the user enter a file name in the file\n\
! selection dialog's entry field, if MUSTMATCH is non-nil.")
! (prompt, dir, default_filename, mustmatch)
! Lisp_Object prompt, dir, default_filename, mustmatch;
{
FRAME_PTR f = SELECTED_FRAME ();
char *fn;
Lisp_Object file = Qnil;
int count = specpdl_ptr - specpdl;
! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
char *cdef_file;
! GCPRO5 (prompt, dir, default_filename, mustmatch, file);
CHECK_STRING (prompt);
CHECK_STRING (dir);
--- 5249,5271 ----
#ifdef USE_GTK
! DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
! doc: /* Read file name, prompting with PROMPT in directory DIR.
! Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
! selection box, if specified. If MUSTMATCH is non-nil, the returned file
! or directory must exist. If ONLY-DIR-P is non-nil, the user can only select
! directories. */)
! (prompt, dir, default_filename, mustmatch, only_dir_p)
! Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
{
FRAME_PTR f = SELECTED_FRAME ();
char *fn;
Lisp_Object file = Qnil;
int count = specpdl_ptr - specpdl;
! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
char *cdef_file;
! GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
CHECK_STRING (prompt);
CHECK_STRING (dir);
***************
*** 5280,5286 ****
else
cdef_file = SDATA (dir);
! fn = xg_get_file_name (f, SDATA (prompt), cdef_file, ! NILP (mustmatch));
if (fn)
{
--- 5279,5287 ----
else
cdef_file = SDATA (dir);
! fn = xg_get_file_name (f, SDATA (prompt), cdef_file,
! ! NILP (mustmatch),
! ! NILP (only_dir_p));
if (fn)
{
- [Emacs-diffs] Changes to emacs/src/xfns.c [lexbind],
Miles Bader <=