mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-04 16:42:57 +00:00
Applied John's FileDialog patch.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1702 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c9196a82ff
commit
765db1102d
@ -1,3 +1,8 @@
|
|||||||
|
2001-03-06 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* ui/default.ui:
|
||||||
|
* bind/<various>: update for file dialog change
|
||||||
|
|
||||||
2001-03-06 Chanop Silpa-Anan <chanop@debian.org>
|
2001-03-06 Chanop Silpa-Anan <chanop@debian.org>
|
||||||
|
|
||||||
* encodings:
|
* encodings:
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
\bind "C-n" "buffer-new"
|
\bind "C-n" "buffer-new"
|
||||||
\bind "C-S-N" "buffer-new-template"
|
\bind "C-S-N" "buffer-new-template"
|
||||||
\bind "C-o" "buffer-open"
|
\bind "C-o" "file-open"
|
||||||
\bind "C-r" "buffer-reload"
|
\bind "C-r" "buffer-reload"
|
||||||
\bind "C-w" "buffer-close"
|
\bind "C-w" "buffer-close"
|
||||||
\bind "C-s" "buffer-write"
|
\bind "C-s" "buffer-write"
|
||||||
@ -77,7 +77,7 @@
|
|||||||
#bind "F1" "help" # Not yet implemented!
|
#bind "F1" "help" # Not yet implemented!
|
||||||
#bind "C-F1" "help-context" # Not yet implemented!
|
#bind "C-F1" "help-context" # Not yet implemented!
|
||||||
\bind "F2" "buffer-write"
|
\bind "F2" "buffer-write"
|
||||||
\bind "F3" "buffer-open"
|
\bind "F3" "file-open"
|
||||||
\bind "C-F4" "buffer-close"
|
\bind "C-F4" "buffer-close"
|
||||||
\bind "F5" "screen-recenter"
|
\bind "F5" "screen-recenter"
|
||||||
\bind "M-F4" "lyx-quit"
|
\bind "M-F4" "lyx-quit"
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#
|
#
|
||||||
#\bind "M-d n" "buffer-new"
|
#\bind "M-d n" "buffer-new"
|
||||||
#\bind "M-d v" "buffer-new-template"
|
#\bind "M-d v" "buffer-new-template"
|
||||||
#\bind "M-d o" "buffer-open"
|
#\bind "M-d o" "file-open"
|
||||||
#\bind "M-d c" "buffer-close"
|
#\bind "M-d c" "buffer-close"
|
||||||
#\bind "M-d s" "buffer-write"
|
#\bind "M-d s" "buffer-write"
|
||||||
#\bind "M-d u" "buffer-write-as"
|
#\bind "M-d u" "buffer-write-as"
|
||||||
@ -131,8 +131,8 @@
|
|||||||
#\bind "M-e a" "figure-insert"
|
#\bind "M-e a" "figure-insert"
|
||||||
#\bind "M-e t" "table-insert"
|
#\bind "M-e t" "table-insert"
|
||||||
#\bind "M-e d" "buffer-child-insert"
|
#\bind "M-e d" "buffer-child-insert"
|
||||||
#\bind "M-e c z" "file-insert-ascii line"
|
#\bind "M-e c z" "file-insert-ascii"
|
||||||
#\bind "M-e c a" "file-insert-ascii paragraph"
|
#\bind "M-e c a" "file-insert-ascii-para"
|
||||||
#\bind "M-e l" "file-insert"
|
#\bind "M-e l" "file-insert"
|
||||||
#\bind "M-e f" "footnote-insert"
|
#\bind "M-e f" "footnote-insert"
|
||||||
#\bind "M-e r" "marginpar-insert"
|
#\bind "M-e r" "marginpar-insert"
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
\bind "C-x C-b" "menu-open documents"
|
\bind "C-x C-b" "menu-open documents"
|
||||||
\bind "C-x C-c" "lyx-quit"
|
\bind "C-x C-c" "lyx-quit"
|
||||||
\bind "C-x C-d" "buffer-new"
|
\bind "C-x C-d" "buffer-new"
|
||||||
\bind "C-x C-f" "buffer-open"
|
\bind "C-x C-f" "file-open"
|
||||||
\bind "C-x C-g" "buffer-view ps"
|
\bind "C-x C-g" "buffer-view ps"
|
||||||
\bind "C-x C-p" "buffer-view dvi"
|
\bind "C-x C-p" "buffer-view dvi"
|
||||||
\bind "C-x C-q" "buffer-toggle-read-only"
|
\bind "C-x C-q" "buffer-toggle-read-only"
|
||||||
@ -118,7 +118,7 @@
|
|||||||
#bind "F1" "help" # Not yet implemented!
|
#bind "F1" "help" # Not yet implemented!
|
||||||
#bind "C-F1" "help-context" # Not yet implemented!
|
#bind "C-F1" "help-context" # Not yet implemented!
|
||||||
#\bind "F2" "buffer-write"
|
#\bind "F2" "buffer-write"
|
||||||
#\bind "F3" "buffer-open"
|
#\bind "F3" "file-open"
|
||||||
#bind "F4" "------"
|
#bind "F4" "------"
|
||||||
#bind "F5" "------"
|
#bind "F5" "------"
|
||||||
#bind "F6" "------"
|
#bind "F6" "------"
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#\bind "M-f n" "buffer-new" #Nouveau
|
#\bind "M-f n" "buffer-new" #Nouveau
|
||||||
#\bind "M-f m" "buffer-new-template" #... Modèle
|
#\bind "M-f m" "buffer-new-template" #... Modèle
|
||||||
#\bind "M-f o" "buffer-open" #Ouvrir
|
#\bind "M-f o" "file-open" #Ouvrir
|
||||||
#\bind "M-f f" "buffer-close" #Fermer
|
#\bind "M-f f" "buffer-close" #Fermer
|
||||||
#\bind "M-f e" "buffer-write" #Enregistrer
|
#\bind "M-f e" "buffer-write" #Enregistrer
|
||||||
#\bind "M-f s" "buffer-write-as" #Enregistrer Sous
|
#\bind "M-f s" "buffer-write-as" #Enregistrer Sous
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#\bind "M-f space" "menu-open Fájl"
|
#\bind "M-f space" "menu-open Fájl"
|
||||||
#\bind "M-f j" "buffer-new"
|
#\bind "M-f j" "buffer-new"
|
||||||
#\bind "M-f a" "buffer-new-template"
|
#\bind "M-f a" "buffer-new-template"
|
||||||
#\bind "M-f n" "buffer-open"
|
#\bind "M-f n" "file-open"
|
||||||
#\bind "M-f z" "buffer-close"
|
#\bind "M-f z" "buffer-close"
|
||||||
#\bind "M-f m" "buffer-write"
|
#\bind "M-f m" "buffer-write"
|
||||||
#\bind "M-f t" "buffer-write-as"
|
#\bind "M-f t" "buffer-write-as"
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#\bind "M-a n" "buffer-new"
|
#\bind "M-a n" "buffer-new"
|
||||||
#\bind "M-a m" "buffer-new-template"
|
#\bind "M-a m" "buffer-new-template"
|
||||||
#\bind "M-a a" "buffer-open"
|
#\bind "M-a a" "file-open"
|
||||||
#\bind "M-a f" "buffer-close"
|
#\bind "M-a f" "buffer-close"
|
||||||
#\bind "M-a l" "buffer-write"
|
#\bind "M-a l" "buffer-write"
|
||||||
#\bind "M-a c" "buffer-write-as"
|
#\bind "M-a c" "buffer-write-as"
|
||||||
@ -107,8 +107,8 @@
|
|||||||
#\bind "M-i g" "figure-insert"
|
#\bind "M-i g" "figure-insert"
|
||||||
#\bind "M-i b" "table-insert"
|
#\bind "M-i b" "table-insert"
|
||||||
#\bind "M-i a" "buffer-child-insert"
|
#\bind "M-i a" "buffer-child-insert"
|
||||||
#\bind "M-i i l" "file-insert-ascii line"
|
#\bind "M-i i l" "file-insert-ascii"
|
||||||
#\bind "M-i i p" "file-insert-ascii paragraph"
|
#\bind "M-i i p" "file-insert-ascii-para"
|
||||||
#\bind "M-i x" "file-insert"
|
#\bind "M-i x" "file-insert"
|
||||||
#\bind "M-i r" "footnote-insert"
|
#\bind "M-i r" "footnote-insert"
|
||||||
#\bind "M-i m" "marginpar-insert"
|
#\bind "M-i m" "marginpar-insert"
|
||||||
|
@ -249,7 +249,7 @@
|
|||||||
#\bind "M-f c" "buffer-close"
|
#\bind "M-f c" "buffer-close"
|
||||||
#\bind "M-f n" "buffer-new"
|
#\bind "M-f n" "buffer-new"
|
||||||
#\bind "M-f l" "file-last" # Not yet implemented.
|
#\bind "M-f l" "file-last" # Not yet implemented.
|
||||||
#\bind "M-f o" "buffer-open"
|
#\bind "M-f o" "file-open"
|
||||||
#\bind "M-f p" "buffer-print"
|
#\bind "M-f p" "buffer-print"
|
||||||
#\bind "M-f q" "lyx-quit"
|
#\bind "M-f q" "lyx-quit"
|
||||||
#\bind "M-f r" "buffer-update dvi"
|
#\bind "M-f r" "buffer-update dvi"
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#\bind "M-f n" "buffer-new"
|
#\bind "M-f n" "buffer-new"
|
||||||
#\bind "M-f m" "buffer-new-template"
|
#\bind "M-f m" "buffer-new-template"
|
||||||
#\bind "M-f p" "buffer-open"
|
#\bind "M-f p" "file-open"
|
||||||
#\bind "M-f g" "buffer-close"
|
#\bind "M-f g" "buffer-close"
|
||||||
#\bind "M-f s" "buffer-write"
|
#\bind "M-f s" "buffer-write"
|
||||||
#\bind "M-f o" "buffer-write-as"
|
#\bind "M-f o" "buffer-write-as"
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
\bind "C-x C-b" "menu-open documents" # list all buffers
|
\bind "C-x C-b" "menu-open documents" # list all buffers
|
||||||
\bind "C-x C-c" "lyx-quit"
|
\bind "C-x C-c" "lyx-quit"
|
||||||
\bind "C-x C-d" "buffer-new"
|
\bind "C-x C-d" "buffer-new"
|
||||||
\bind "C-x C-f" "buffer-open"
|
\bind "C-x C-f" "file-open"
|
||||||
\bind "C-x C-g" "buffer-view ps"
|
\bind "C-x C-g" "buffer-view ps"
|
||||||
\bind "C-x C-l" "word-lowcase" # downcase-region!
|
\bind "C-x C-l" "word-lowcase" # downcase-region!
|
||||||
\bind "C-x C-p" "buffer-view dvi"
|
\bind "C-x C-p" "buffer-view dvi"
|
||||||
@ -121,7 +121,7 @@
|
|||||||
#bind "F1" "help" # Not yet implemented!
|
#bind "F1" "help" # Not yet implemented!
|
||||||
#bind "C-F1" "help-context" # Not yet implemented!
|
#bind "C-F1" "help-context" # Not yet implemented!
|
||||||
#\bind "F2" "buffer-write"
|
#\bind "F2" "buffer-write"
|
||||||
#\bind "F3" "buffer-open"
|
#\bind "F3" "file-open"
|
||||||
#bind "F4" "------"
|
#bind "F4" "------"
|
||||||
#bind "F5" "------"
|
#bind "F5" "------"
|
||||||
#bind "F6" "------"
|
#bind "F6" "------"
|
||||||
|
@ -28,7 +28,7 @@ Menuset
|
|||||||
Menu "file_nobuffer"
|
Menu "file_nobuffer"
|
||||||
Item "New...|N" "buffer-new"
|
Item "New...|N" "buffer-new"
|
||||||
Item "New from Template...|T" "buffer-new-template"
|
Item "New from Template...|T" "buffer-new-template"
|
||||||
Item "Open...|O" "buffer-open"
|
Item "Open...|O" "file-open"
|
||||||
Separator
|
Separator
|
||||||
Submenu "Import|I" "file_import"
|
Submenu "Import|I" "file_import"
|
||||||
Separator
|
Separator
|
||||||
@ -40,7 +40,7 @@ Menuset
|
|||||||
Menu "file"
|
Menu "file"
|
||||||
Item "New...|N" "buffer-new"
|
Item "New...|N" "buffer-new"
|
||||||
Item "New from Template...|T" "buffer-new-template"
|
Item "New from Template...|T" "buffer-new-template"
|
||||||
Item "Open...|O" "buffer-open"
|
Item "Open...|O" "file-open"
|
||||||
Separator
|
Separator
|
||||||
Item "Close|C" "buffer-close"
|
Item "Close|C" "buffer-close"
|
||||||
Item "Save|S" "buffer-write"
|
Item "Save|S" "buffer-write"
|
||||||
@ -219,8 +219,8 @@ Menuset
|
|||||||
|
|
||||||
Menu "insert_file"
|
Menu "insert_file"
|
||||||
Item "LyX Document...|X" "file-insert"
|
Item "LyX Document...|X" "file-insert"
|
||||||
Item "Ascii as Lines...|L" "file-insert-ascii lines"
|
Item "Ascii as Lines...|L" "file-insert-ascii"
|
||||||
Item "Ascii as Paragraphs...|P" "file-insert-ascii paragraphs"
|
Item "Ascii as Paragraphs...|P" "file-insert-ascii-para"
|
||||||
End
|
End
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -335,7 +335,7 @@ End
|
|||||||
|
|
||||||
Toolbar
|
Toolbar
|
||||||
Layouts
|
Layouts
|
||||||
Icon "buffer-open"
|
Icon "file-open"
|
||||||
Icon "buffer-write"
|
Icon "buffer-write"
|
||||||
Icon "buffer-print"
|
Icon "buffer-print"
|
||||||
Separator
|
Separator
|
||||||
|
@ -13,7 +13,6 @@ src/CutAndPaste.C
|
|||||||
src/debug.C
|
src/debug.C
|
||||||
src/exporter.C
|
src/exporter.C
|
||||||
src/ext_l10n.h
|
src/ext_l10n.h
|
||||||
src/filedlg.C
|
|
||||||
src/FontLoader.C
|
src/FontLoader.C
|
||||||
src/form1.C
|
src/form1.C
|
||||||
src/frontends/gnome/FormCitation.C
|
src/frontends/gnome/FormCitation.C
|
||||||
@ -43,6 +42,7 @@ src/frontends/kde/dlg/parageneraldlgdata.C
|
|||||||
src/frontends/kde/dlg/printdlgdata.C
|
src/frontends/kde/dlg/printdlgdata.C
|
||||||
src/frontends/kde/dlg/tabcreatedlgdata.C
|
src/frontends/kde/dlg/tabcreatedlgdata.C
|
||||||
src/frontends/kde/docdlg.C
|
src/frontends/kde/docdlg.C
|
||||||
|
src/frontends/kde/FileDialog.C
|
||||||
src/frontends/kde/FormCitation.C
|
src/frontends/kde/FormCitation.C
|
||||||
src/frontends/kde/FormCopyright.C
|
src/frontends/kde/FormCopyright.C
|
||||||
src/frontends/kde/FormDocument.C
|
src/frontends/kde/FormDocument.C
|
||||||
@ -72,6 +72,7 @@ src/frontends/qt2/FormSearch.C
|
|||||||
src/frontends/qt2/FormTabularCreate.C
|
src/frontends/qt2/FormTabularCreate.C
|
||||||
src/frontends/qt2/paragraphdlgimpl.C
|
src/frontends/qt2/paragraphdlgimpl.C
|
||||||
src/frontends/qt2/tabularcreatedlgimpl.C
|
src/frontends/qt2/tabularcreatedlgimpl.C
|
||||||
|
src/frontends/xforms/FileDialog.C
|
||||||
src/frontends/xforms/FormBase.h
|
src/frontends/xforms/FormBase.h
|
||||||
src/frontends/xforms/form_bibitem.C
|
src/frontends/xforms/form_bibitem.C
|
||||||
src/frontends/xforms/FormBibitem.C
|
src/frontends/xforms/FormBibitem.C
|
||||||
@ -88,6 +89,8 @@ src/frontends/xforms/form_document.C
|
|||||||
src/frontends/xforms/FormDocument.C
|
src/frontends/xforms/FormDocument.C
|
||||||
src/frontends/xforms/form_error.C
|
src/frontends/xforms/form_error.C
|
||||||
src/frontends/xforms/FormError.C
|
src/frontends/xforms/FormError.C
|
||||||
|
src/frontends/xforms/form_filedialog.C
|
||||||
|
src/frontends/xforms/FormFiledialog.C
|
||||||
src/frontends/xforms/form_graphics.C
|
src/frontends/xforms/form_graphics.C
|
||||||
src/frontends/xforms/FormGraphics.C
|
src/frontends/xforms/FormGraphics.C
|
||||||
src/frontends/xforms/form_include.C
|
src/frontends/xforms/form_include.C
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "insets/insettext.h"
|
#include "insets/insettext.h"
|
||||||
/// added for Dispatch functions
|
/// added for Dispatch functions
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "filedlg.h"
|
#include "frontends/FileDialog.h"
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "FloatList.h"
|
#include "FloatList.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
@ -1424,7 +1424,6 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
|
|||||||
if (filename.empty()) {
|
if (filename.empty()) {
|
||||||
// Launch a file browser
|
// Launch a file browser
|
||||||
string initpath = lyxrc.document_path;
|
string initpath = lyxrc.document_path;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
|
||||||
if (available()) {
|
if (available()) {
|
||||||
string const trypath = owner_->buffer()->filepath;
|
string const trypath = owner_->buffer()->filepath;
|
||||||
@ -1433,21 +1432,24 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
|
|||||||
initpath = trypath;
|
initpath = trypath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// launches dialog
|
FileDialog fileDlg(bv_->owner(), _("Select LyX document to insert"),
|
||||||
ProhibitInput(bv_);
|
LFUN_FILE_INSERT,
|
||||||
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
|
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||||
fileDlg.SetButton(1, _("Examples"),
|
make_pair(string(_("Examples")), string(AddPath(system_lyxdir, "examples"))));
|
||||||
AddPath(system_lyxdir, "examples"));
|
|
||||||
filename = fileDlg.Select(_("Select Document to Insert"),
|
FileDialog::Result result = fileDlg.Select(initpath, _("*.lyx| LyX Documents (*.lyx)"));
|
||||||
initpath, "*.lyx");
|
|
||||||
AllowInput(bv_);
|
if (result.first == FileDialog::Later)
|
||||||
|
return;
|
||||||
|
|
||||||
|
filename = result.second;
|
||||||
|
|
||||||
// check selected filename
|
// check selected filename
|
||||||
if (filename.empty()) {
|
if (filename.empty()) {
|
||||||
owner_->getMiniBuffer()->Set(_("Canceled."));
|
owner_->getMiniBuffer()->Set(_("Canceled."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get absolute path of file and make sure the filename ends
|
// get absolute path of file and make sure the filename ends
|
||||||
// with .lyx
|
// with .lyx
|
||||||
@ -1618,12 +1620,13 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_FILE_INSERT_ASCII_PARA:
|
||||||
|
InsertAsciiFile(bv_, argument, true);
|
||||||
|
break;
|
||||||
|
|
||||||
case LFUN_FILE_INSERT_ASCII:
|
case LFUN_FILE_INSERT_ASCII:
|
||||||
{
|
InsertAsciiFile(bv_, argument, false);
|
||||||
bool asPara = (argument == "paragraph");
|
break;
|
||||||
InsertAsciiFile(bv_, string(), asPara);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_LAYOUT:
|
case LFUN_LAYOUT:
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
2001-03-06 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* Makefile.am:
|
||||||
|
* filedlg.h:
|
||||||
|
* filedlg.C:
|
||||||
|
* LyXAction.C:
|
||||||
|
* ToolbarDefaults.C:
|
||||||
|
* bufferlist.C:
|
||||||
|
* commandtags.h:
|
||||||
|
* form1.C:
|
||||||
|
* form1.h:
|
||||||
|
* lyx_cb.C:
|
||||||
|
* lyx_cb.h:
|
||||||
|
* lyxfunc.h:
|
||||||
|
* lyxfunc.C:
|
||||||
|
* BufferView_pimpl.C: use new file dialog in GUII
|
||||||
|
|
||||||
|
* lyx_cb.h:
|
||||||
|
* lyx_cb.C: remove LayoutsCB to Toolbar
|
||||||
|
|
||||||
2001-03-07 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
2001-03-07 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* ShareContainer.h (get): add std:: qualifier
|
* ShareContainer.h (get): add std:: qualifier
|
||||||
|
@ -140,7 +140,6 @@ void LyXAction::init()
|
|||||||
{ LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
|
{ LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
|
||||||
{ LFUN_MENUNEWTMPLT,"buffer-new-template",
|
{ LFUN_MENUNEWTMPLT,"buffer-new-template",
|
||||||
N_("New document from template"), NoBuffer },
|
N_("New document from template"), NoBuffer },
|
||||||
{ LFUN_MENUOPEN, "buffer-open", N_("Open"), NoBuffer },
|
|
||||||
{ LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly },
|
{ LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly },
|
||||||
{ LFUN_MENURELOAD, "buffer-reload",
|
{ LFUN_MENURELOAD, "buffer-reload",
|
||||||
N_("Revert to saved"), ReadOnly },
|
N_("Revert to saved"), ReadOnly },
|
||||||
@ -151,7 +150,7 @@ void LyXAction::init()
|
|||||||
{ LFUN_UPDATE, "buffer-update", N_("Update"), ReadOnly },
|
{ LFUN_UPDATE, "buffer-update", N_("Update"), ReadOnly },
|
||||||
{ LFUN_PREVIEW, "buffer-view", N_("View") , ReadOnly },
|
{ LFUN_PREVIEW, "buffer-view", N_("View") , ReadOnly },
|
||||||
{ LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly },
|
{ LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly },
|
||||||
{ LFUN_MENUWRITEAS, "buffer-write-as", N_("Save As"),
|
{ LFUN_WRITEAS, "buffer-write-as", N_("Save As"),
|
||||||
ReadOnly },
|
ReadOnly },
|
||||||
{ LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer },
|
{ LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer },
|
||||||
{ LFUN_INSET_CAPTION, "caption-insert", "", Noop },
|
{ LFUN_INSET_CAPTION, "caption-insert", "", Noop },
|
||||||
@ -197,9 +196,10 @@ void LyXAction::init()
|
|||||||
{ LFUN_INSET_GRAPHICS, "graphics-insert",
|
{ LFUN_INSET_GRAPHICS, "graphics-insert",
|
||||||
N_("Insert Graphics"), Noop },
|
N_("Insert Graphics"), Noop },
|
||||||
{ LFUN_FILE_INSERT, "file-insert", "", Noop },
|
{ LFUN_FILE_INSERT, "file-insert", "", Noop },
|
||||||
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop },
|
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", _("Insert ASCII files as lines"), Noop },
|
||||||
|
{ LFUN_FILE_INSERT_ASCII_PARA, "file-insert-ascii-para", _("Insert ASCII file as a paragraph"), Noop },
|
||||||
{ LFUN_FILE_NEW, "file-new", "", NoBuffer },
|
{ LFUN_FILE_NEW, "file-new", "", NoBuffer },
|
||||||
{ LFUN_FILE_OPEN, "file-open", "", NoBuffer },
|
{ LFUN_FILE_OPEN, "file-open", _("Open a file"), NoBuffer },
|
||||||
{ LFUN_MENUSEARCH, "find-replace", N_("Find & Replace"),
|
{ LFUN_MENUSEARCH, "find-replace", N_("Find & Replace"),
|
||||||
ReadOnly },
|
ReadOnly },
|
||||||
{ LFUN_INSET_FLOAT, "float-insert", "", Noop },
|
{ LFUN_INSET_FLOAT, "float-insert", "", Noop },
|
||||||
|
@ -117,8 +117,6 @@ lyx_SOURCES = \
|
|||||||
exporter.h \
|
exporter.h \
|
||||||
ext_l10n.h \
|
ext_l10n.h \
|
||||||
figure.h \
|
figure.h \
|
||||||
filedlg.C \
|
|
||||||
filedlg.h \
|
|
||||||
font.C \
|
font.C \
|
||||||
font.h \
|
font.h \
|
||||||
form1.C \
|
form1.C \
|
||||||
|
@ -46,7 +46,7 @@ void ToolbarDefaults::add(int action)
|
|||||||
void ToolbarDefaults::init()
|
void ToolbarDefaults::init()
|
||||||
{
|
{
|
||||||
add(LAYOUTS);
|
add(LAYOUTS);
|
||||||
add(LFUN_MENUOPEN);
|
add(LFUN_FILE_OPEN);
|
||||||
//add(LFUN_CLOSEBUFFER);
|
//add(LFUN_CLOSEBUFFER);
|
||||||
add(LFUN_MENUWRITE);
|
add(LFUN_MENUWRITE);
|
||||||
add(LFUN_MENUPRINT);
|
add(LFUN_MENUPRINT);
|
||||||
|
@ -113,7 +113,7 @@ bool BufferList::QwriteAll()
|
|||||||
_("Save document?"))) {
|
_("Save document?"))) {
|
||||||
case 1: // Yes
|
case 1: // Yes
|
||||||
if ((*it)->isUnnamed())
|
if ((*it)->isUnnamed())
|
||||||
reask = !MenuWriteAs(current_view, (*it));
|
reask = !WriteAs(current_view, (*it));
|
||||||
else {
|
else {
|
||||||
reask = !MenuWrite(current_view, (*it));
|
reask = !MenuWrite(current_view, (*it));
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ bool BufferList::close(Buffer * buf)
|
|||||||
_("Save document?"))){
|
_("Save document?"))){
|
||||||
case 1: // Yes
|
case 1: // Yes
|
||||||
if (buf->isUnnamed())
|
if (buf->isUnnamed())
|
||||||
reask = !MenuWriteAs(current_view, buf);
|
reask = !WriteAs(current_view, buf);
|
||||||
else if (buf->save()) {
|
else if (buf->save()) {
|
||||||
lastfiles->newFile(buf->fileName());
|
lastfiles->newFile(buf->fileName());
|
||||||
reask = false;
|
reask = false;
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
Please add new functions at the end of the enum, right
|
Please add new functions at the end of the enum, right
|
||||||
before LFUN_LASTACTION.
|
before LFUN_LASTACTION.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum kb_action {
|
enum kb_action {
|
||||||
LFUN_UNKNOWN_ACTION = -1,
|
LFUN_UNKNOWN_ACTION = -1,
|
||||||
LFUN_NOACTION = 0,
|
LFUN_NOACTION = 0,
|
||||||
LFUN_PREFIX,
|
LFUN_PREFIX,
|
||||||
LFUN_CENTER,
|
LFUN_CENTER,
|
||||||
LFUN_MENUNEW,
|
LFUN_MENUNEW,
|
||||||
LFUN_MENUOPEN,
|
|
||||||
LFUN_MENUWRITE,
|
LFUN_MENUWRITE,
|
||||||
LFUN_MENUWRITEAS,
|
LFUN_WRITEAS,
|
||||||
LFUN_MENUPRINT,
|
LFUN_MENUPRINT,
|
||||||
LFUN_MENUSENDTO,
|
LFUN_MENUSENDTO,
|
||||||
LFUN_BUILDPROG,
|
LFUN_BUILDPROG,
|
||||||
@ -177,6 +177,7 @@ enum kb_action {
|
|||||||
LFUN_EXEC_COMMAND,
|
LFUN_EXEC_COMMAND,
|
||||||
LFUN_FILE_INSERT,
|
LFUN_FILE_INSERT,
|
||||||
LFUN_FILE_INSERT_ASCII, // CFO-G 1997-11-19
|
LFUN_FILE_INSERT_ASCII, // CFO-G 1997-11-19
|
||||||
|
LFUN_FILE_INSERT_ASCII_PARA, // Levon 2001-02-14
|
||||||
LFUN_FILE_NEW,
|
LFUN_FILE_NEW,
|
||||||
LFUN_FILE_OPEN, // 160
|
LFUN_FILE_OPEN, // 160
|
||||||
LFUN_UP_PARAGRAPH, // Asger 1996-10-01
|
LFUN_UP_PARAGRAPH, // Asger 1996-10-01
|
||||||
@ -274,6 +275,7 @@ enum kb_action {
|
|||||||
LFUN_BOOKMARK_SAVE, // Dekel 20010127
|
LFUN_BOOKMARK_SAVE, // Dekel 20010127
|
||||||
LFUN_BOOKMARK_GOTO, // Dekel 20010127
|
LFUN_BOOKMARK_GOTO, // Dekel 20010127
|
||||||
LFUN_CHILD_CREATE, // Levon 20010207
|
LFUN_CHILD_CREATE, // Levon 20010207
|
||||||
|
LFUN_SELECT_FILE_SYNC, // Levon 20010214
|
||||||
LFUN_LASTACTION /* this marks the end of the table */
|
LFUN_LASTACTION /* this marks the end of the table */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
57
src/form1.C
57
src/form1.C
@ -217,60 +217,3 @@ FD_Figure *create_form_Figure(void)
|
|||||||
return fdui;
|
return fdui;
|
||||||
}
|
}
|
||||||
/*---------------------------------------*/
|
/*---------------------------------------*/
|
||||||
|
|
||||||
FD_FileDlg *create_form_FileDlg(void)
|
|
||||||
{
|
|
||||||
FL_OBJECT *obj;
|
|
||||||
FD_FileDlg *fdui = (FD_FileDlg *) fl_calloc(1, sizeof(FD_FileDlg));
|
|
||||||
|
|
||||||
fdui->FileDlg = fl_bgn_form(FL_NO_BOX, 440, 380);
|
|
||||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 380, "");
|
|
||||||
fdui->FileInfo = obj = fl_add_text(FL_NORMAL_TEXT, 10, 260, 420, 30, "");
|
|
||||||
fl_set_object_boxtype(obj, FL_SHADOW_BOX);
|
|
||||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
|
||||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
|
|
||||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
|
||||||
fdui->DirBox = obj = fl_add_input(FL_NORMAL_INPUT, 100, 10, 330, 30, idex(_("Directory:|#D")));fl_set_button_shortcut(obj, scex(_("Directory:|#D")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
|
|
||||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
|
||||||
fdui->PatBox = obj = fl_add_input(FL_NORMAL_INPUT, 100, 40, 330, 30, idex(_("Pattern:|#P")));fl_set_button_shortcut(obj, scex(_("Pattern:|#P")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
|
|
||||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
|
||||||
fdui->List = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 80, 320, 170, "");
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
|
||||||
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
|
|
||||||
fdui->Filename = obj = fl_add_input(FL_NORMAL_INPUT, 100, 300, 330, 30, idex(_("Filename:|#F")));fl_set_button_shortcut(obj, scex(_("Filename:|#F")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
|
|
||||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
|
||||||
fdui->Rescan = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 80, 90, 30, idex(_("Rescan|#R#r")));fl_set_button_shortcut(obj, scex(_("Rescan|#R#r")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
|
||||||
fdui->Home = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 120, 90, 30, idex(_("Home|#H#h")));fl_set_button_shortcut(obj, scex(_("Home|#H#h")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
|
||||||
fdui->User1 = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 160, 90, 30, idex(_("User1|#1")));fl_set_button_shortcut(obj, scex(_("User1|#1")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
|
||||||
fdui->User2 = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 200, 90, 30, idex(_("User2|#2")));fl_set_button_shortcut(obj, scex(_("User2|#2")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
|
||||||
fdui->Ready = obj = fl_add_button(FL_RETURN_BUTTON, 220, 340, 100, 30, _("OK"));
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
|
||||||
fdui->Cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 340, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
|
||||||
fdui->timer = obj = fl_add_timer(FL_HIDDEN_TIMER, 10, 350, 20, 20, "");
|
|
||||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
|
||||||
fl_end_form();
|
|
||||||
|
|
||||||
fdui->FileDlg->fdui = fdui;
|
|
||||||
|
|
||||||
return fdui;
|
|
||||||
}
|
|
||||||
/*---------------------------------------*/
|
|
||||||
|
|
||||||
|
20
src/form1.h
20
src/form1.h
@ -67,26 +67,6 @@ typedef struct {
|
|||||||
} FD_Figure;
|
} FD_Figure;
|
||||||
|
|
||||||
extern FD_Figure * create_form_Figure(void);
|
extern FD_Figure * create_form_Figure(void);
|
||||||
typedef struct {
|
|
||||||
FL_FORM *FileDlg;
|
|
||||||
void *vdata;
|
|
||||||
char *cdata;
|
|
||||||
long ldata;
|
|
||||||
FL_OBJECT *FileInfo;
|
|
||||||
FL_OBJECT *DirBox;
|
|
||||||
FL_OBJECT *PatBox;
|
|
||||||
FL_OBJECT *List;
|
|
||||||
FL_OBJECT *Filename;
|
|
||||||
FL_OBJECT *Rescan;
|
|
||||||
FL_OBJECT *Home;
|
|
||||||
FL_OBJECT *User1;
|
|
||||||
FL_OBJECT *User2;
|
|
||||||
FL_OBJECT *Ready;
|
|
||||||
FL_OBJECT *Cancel;
|
|
||||||
FL_OBJECT *timer;
|
|
||||||
} FD_FileDlg;
|
|
||||||
|
|
||||||
extern FD_FileDlg * create_form_FileDlg(void);
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FL_FORM *form_search;
|
FL_FORM *form_search;
|
||||||
void *vdata;
|
void *vdata;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2001-02-26 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* Makefile.am
|
||||||
|
* FileDialog.h: new GUII FileDialog
|
||||||
|
|
||||||
2001-02-23 Edwin Leuven <leuven@fee.uva.nl)
|
2001-02-23 Edwin Leuven <leuven@fee.uva.nl)
|
||||||
|
|
||||||
* Dialogs.h: setUserFreeFont, showLayoutCharacter
|
* Dialogs.h: setUserFreeFont, showLayoutCharacter
|
||||||
|
96
src/frontends/FileDialog.h
Normal file
96
src/frontends/FileDialog.h
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/**
|
||||||
|
* \file FileDialog.h
|
||||||
|
* Copyright 2001 the LyX Team
|
||||||
|
* Read the file COPYING
|
||||||
|
*
|
||||||
|
* \author unknown
|
||||||
|
* \author John Levon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FILEDIALOG_H
|
||||||
|
#define FILEDIALOG_H
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "commandtags.h"
|
||||||
|
|
||||||
|
#include "LString.h"
|
||||||
|
|
||||||
|
class LyXView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class FileDialog
|
||||||
|
* \brief GUI-I definition of file dialog interface
|
||||||
|
*/
|
||||||
|
class FileDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/// label, directory path button
|
||||||
|
typedef std::pair<string, string> Button;
|
||||||
|
|
||||||
|
/// result type
|
||||||
|
enum ResultType {
|
||||||
|
Later, /**< modeless chooser, no result */
|
||||||
|
Chosen /**< string contains filename */
|
||||||
|
};
|
||||||
|
|
||||||
|
/// result return
|
||||||
|
typedef std::pair<FileDialog::ResultType, string> Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a file dialog attached to LyXView \param lv, with
|
||||||
|
* title \param title. If param \a is \const LFUN_SELECT_FILE_SYNC
|
||||||
|
* then a value will be returned immediately upon performing a Select(),
|
||||||
|
* otherwise a callback Dispatch() will be invoked with the filename as
|
||||||
|
* argument, of action \param a.
|
||||||
|
*
|
||||||
|
* Up to two optional extra buttons are allowed for specifying addtional
|
||||||
|
* directories in the navigation.
|
||||||
|
*/
|
||||||
|
FileDialog(LyXView * lv, string const & title, kb_action a = LFUN_SELECT_FILE_SYNC,
|
||||||
|
Button b1 = Button(string(), string()),
|
||||||
|
Button b2 = Button(string(), string()));
|
||||||
|
|
||||||
|
|
||||||
|
~FileDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Choose a file for selection, starting in directory \param path, with the file
|
||||||
|
* selection \param mask. The \param mask string is of the form :
|
||||||
|
*
|
||||||
|
* <regular expression to match> | <description>
|
||||||
|
*
|
||||||
|
* for example, "*.ps | PostScript files (*.ps)".
|
||||||
|
*
|
||||||
|
* FIXME: should support multiple lines of these for different file types.
|
||||||
|
*/
|
||||||
|
Result const Select(string const & path = string(),
|
||||||
|
string const & mask = string(),
|
||||||
|
string const & suggested = string());
|
||||||
|
|
||||||
|
|
||||||
|
/* This *has* to be public because there is no way to specify extern "C" functions
|
||||||
|
* as friends of Private implementation for the xforms implementation ... grr
|
||||||
|
*/
|
||||||
|
class Private;
|
||||||
|
friend class Private;
|
||||||
|
Private * private_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// our LyXView
|
||||||
|
LyXView * lv_;
|
||||||
|
|
||||||
|
/// the dialog title
|
||||||
|
string title_;
|
||||||
|
|
||||||
|
/// success action to perform if not synchronous
|
||||||
|
kb_action success_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FILEDIALOG_H
|
@ -15,6 +15,7 @@ libfrontends_la_SOURCES=\
|
|||||||
ButtonPolicies.h \
|
ButtonPolicies.h \
|
||||||
Dialogs.h \
|
Dialogs.h \
|
||||||
DialogBase.h \
|
DialogBase.h \
|
||||||
|
FileDialog.h \
|
||||||
GUIRunTime.h \
|
GUIRunTime.h \
|
||||||
Liason.C \
|
Liason.C \
|
||||||
Liason.h \
|
Liason.h \
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
2001-02-26 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* <various>: remove noncopyable (now inherited from DialogBase)
|
||||||
|
|
||||||
|
* Makefile.am:
|
||||||
|
* FileDialog.C:
|
||||||
|
* FileDialog_private.C:
|
||||||
|
* moc/Makefile.am:
|
||||||
|
* FileDialog_private.h: add File Dialog
|
||||||
|
|
||||||
|
* docdlg.C: remove DEFAULT_LANGUAGE stuff
|
||||||
|
|
||||||
2001-02-26 Dekel Tsur <dekelts@tau.ac.il>
|
2001-02-26 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
* FormRef.C (apply): Update bookmark #0 after inserting a reference.
|
* FormRef.C (apply): Update bookmark #0 after inserting a reference.
|
||||||
|
@ -46,6 +46,7 @@ Signal0<void> Dialogs::redrawGUI;
|
|||||||
|
|
||||||
Dialogs::Dialogs(LyXView * lv)
|
Dialogs::Dialogs(LyXView * lv)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
dialogs_.push_back(new FormBibitem(lv, this));
|
dialogs_.push_back(new FormBibitem(lv, this));
|
||||||
dialogs_.push_back(new FormBibtex(lv, this));
|
dialogs_.push_back(new FormBibtex(lv, this));
|
||||||
dialogs_.push_back(new FormCitation(lv, this));
|
dialogs_.push_back(new FormCitation(lv, this));
|
||||||
@ -72,6 +73,7 @@ Dialogs::Dialogs(LyXView * lv)
|
|||||||
// reduce the number of connections needed in
|
// reduce the number of connections needed in
|
||||||
// dialogs by a simple connection here.
|
// dialogs by a simple connection here.
|
||||||
hideAll.connect(hideBufferDependent.slot());
|
hideAll.connect(hideBufferDependent.slot());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
79
src/frontends/kde/FileDialog.C
Normal file
79
src/frontends/kde/FileDialog.C
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
* \file FileDialog.C
|
||||||
|
* Copyright 2001 the LyX Team
|
||||||
|
* Read the file COPYING
|
||||||
|
*
|
||||||
|
* \author John Levon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <gettext.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "commandtags.h"
|
||||||
|
|
||||||
|
#include "LString.h"
|
||||||
|
|
||||||
|
#include "frontends/FileDialog.h"
|
||||||
|
|
||||||
|
#include "FileDialog_private.h"
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
using std::make_pair;
|
||||||
|
using std::pair;
|
||||||
|
using std::endl;
|
||||||
|
|
||||||
|
FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
|
||||||
|
: private_(0), lv_(lv), title_(t), success_(s)
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileDialog::~FileDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
|
||||||
|
{
|
||||||
|
string filter = mask;
|
||||||
|
|
||||||
|
if (mask.empty())
|
||||||
|
filter = _("*|All files");
|
||||||
|
|
||||||
|
LyXKFileDialog * dlg = new LyXKFileDialog(lv_, success_, path, filter, title_);
|
||||||
|
|
||||||
|
lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
|
||||||
|
|
||||||
|
if (!suggested.empty())
|
||||||
|
dlg->setSelection(suggested.c_str());
|
||||||
|
|
||||||
|
if (success_ == LFUN_SELECT_FILE_SYNC) {
|
||||||
|
FileDialog::Result result;
|
||||||
|
|
||||||
|
lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
|
||||||
|
|
||||||
|
result.first = FileDialog::Chosen;
|
||||||
|
|
||||||
|
int res = dlg->exec();
|
||||||
|
|
||||||
|
lyxerr[Debug::GUI] << "result " << res << endl;
|
||||||
|
|
||||||
|
if (res == QDialog::Accepted)
|
||||||
|
result.second = string(dlg->selectedFile().data());
|
||||||
|
|
||||||
|
delete dlg;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
dlg->show();
|
||||||
|
|
||||||
|
return make_pair(FileDialog::Later, string());
|
||||||
|
}
|
39
src/frontends/kde/FileDialog_private.C
Normal file
39
src/frontends/kde/FileDialog_private.C
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* \file FileDialog_private.C
|
||||||
|
* Copyright 2001 the LyX Team
|
||||||
|
* Read the file COPYING
|
||||||
|
*
|
||||||
|
* \author John Levon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "LString.h"
|
||||||
|
|
||||||
|
#include <kapp.h>
|
||||||
|
#include <kfiledialog.h>
|
||||||
|
|
||||||
|
#include "QtLyXView.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#include "FileDialog_private.h"
|
||||||
|
|
||||||
|
LyXKFileDialog::LyXKFileDialog(LyXView * lv, kb_action a, string const & p, string const & m, string const & t)
|
||||||
|
: KFileDialog(p.c_str(), m.c_str(), KApplication::getKApplication()->topWidget(), t.c_str(), a == LFUN_SELECT_FILE_SYNC, false),
|
||||||
|
lv_(lv), action_(a)
|
||||||
|
{
|
||||||
|
setCaption(t.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXKFileDialog::done(int what)
|
||||||
|
{
|
||||||
|
lyxerr[Debug::GUI] << "Done FileDialog, value " << what << endl;
|
||||||
|
|
||||||
|
if (action_ == LFUN_SELECT_FILE_SYNC) {
|
||||||
|
QDialog::done(what);
|
||||||
|
return;
|
||||||
|
} else if (what == QDialog::Accepted)
|
||||||
|
lv_->getLyXFunc()->Dispatch(action_, selectedFile().data());
|
||||||
|
delete this;
|
||||||
|
}
|
38
src/frontends/kde/FileDialog_private.h
Normal file
38
src/frontends/kde/FileDialog_private.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* \file FileDialog_private.h
|
||||||
|
* Copyright 2001 the LyX Team
|
||||||
|
* Read the file COPYING
|
||||||
|
*
|
||||||
|
* \author John Levon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FILEDIALOG_PRIVATE_H
|
||||||
|
#define FILEDIALOG_PRIVATE_H
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <kfiledialog.h>
|
||||||
|
|
||||||
|
#include "LString.h"
|
||||||
|
#include "lyxfunc.h"
|
||||||
|
|
||||||
|
#include "frontends/FileDialog.h"
|
||||||
|
|
||||||
|
class LyXView;
|
||||||
|
|
||||||
|
class LyXKFileDialog : public KFileDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LyXKFileDialog(LyXView * lv, kb_action a, string const & p, string const & m, string const & t);
|
||||||
|
|
||||||
|
friend class FileDialog;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void done(int);
|
||||||
|
|
||||||
|
private:
|
||||||
|
LyXView * lv_;
|
||||||
|
int action_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FILEDIALOG_PRIVATE_H
|
@ -20,7 +20,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class CitationDialog;
|
class CitationDialog;
|
||||||
|
|
||||||
class FormCitation : public DialogBase, public noncopyable {
|
class FormCitation : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormCitation(LyXView *, Dialogs *);
|
FormCitation(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class CopyrightDialog;
|
class CopyrightDialog;
|
||||||
|
|
||||||
class FormCopyright : public DialogBase, public noncopyable {
|
class FormCopyright : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormCopyright(LyXView *, Dialogs *);
|
FormCopyright(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class BufferParams;
|
|||||||
/**
|
/**
|
||||||
* \brief the LyXian side of the complex Document dialog
|
* \brief the LyXian side of the complex Document dialog
|
||||||
*/
|
*/
|
||||||
class FormDocument : public DialogBase, public noncopyable {
|
class FormDocument : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormDocument(LyXView *, Dialogs *);
|
FormDocument(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class IndexDialog;
|
class IndexDialog;
|
||||||
|
|
||||||
class FormIndex : public DialogBase, public noncopyable {
|
class FormIndex : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormIndex(LyXView *, Dialogs *);
|
FormIndex(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class LogDialog;
|
class LogDialog;
|
||||||
|
|
||||||
class FormLog : public DialogBase, public noncopyable {
|
class FormLog : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormLog(LyXView *, Dialogs *);
|
FormLog(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class ParaDialog;
|
class ParaDialog;
|
||||||
|
|
||||||
class FormParagraph : public DialogBase, public noncopyable {
|
class FormParagraph : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormParagraph(LyXView *, Dialogs *);
|
FormParagraph(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class PrintDialog;
|
|||||||
using SigC::Connection;
|
using SigC::Connection;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class FormPrint : public DialogBase, public noncopyable {
|
class FormPrint : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormPrint(LyXView *, Dialogs *);
|
FormPrint(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class RefDialog;
|
class RefDialog;
|
||||||
|
|
||||||
class FormRef : public DialogBase, public noncopyable {
|
class FormRef : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormRef(LyXView *, Dialogs *);
|
FormRef(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class TabularCreateDialog;
|
class TabularCreateDialog;
|
||||||
|
|
||||||
class FormTabularCreate : public DialogBase, public noncopyable {
|
class FormTabularCreate : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormTabularCreate(LyXView *, Dialogs *);
|
FormTabularCreate(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
class Dialogs;
|
class Dialogs;
|
||||||
class TocDialog;
|
class TocDialog;
|
||||||
|
|
||||||
class FormToc : public DialogBase, public noncopyable {
|
class FormToc : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormToc(LyXView *, Dialogs *);
|
FormToc(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class UrlDialog;
|
class UrlDialog;
|
||||||
|
|
||||||
class FormUrl : public DialogBase, public noncopyable {
|
class FormUrl : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormUrl(LyXView *, Dialogs *);
|
FormUrl(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class Dialogs;
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class LogDialog;
|
class LogDialog;
|
||||||
|
|
||||||
class FormVCLog : public DialogBase, public noncopyable {
|
class FormVCLog : public DialogBase {
|
||||||
public:
|
public:
|
||||||
FormVCLog(LyXView *, Dialogs *);
|
FormVCLog(LyXView *, Dialogs *);
|
||||||
|
|
||||||
|
@ -48,6 +48,9 @@ LDFLAGS= $(libkde_la_OBJADD)
|
|||||||
ETAGS_ARGS = --lang=c++
|
ETAGS_ARGS = --lang=c++
|
||||||
libkde_la_SOURCES = \
|
libkde_la_SOURCES = \
|
||||||
Dialogs.C \
|
Dialogs.C \
|
||||||
|
FileDialog.C \
|
||||||
|
FileDialog_private.C \
|
||||||
|
FileDialog_private.h \
|
||||||
GUIRunTime.C \
|
GUIRunTime.C \
|
||||||
QtLyXView.h \
|
QtLyXView.h \
|
||||||
Timeout_pimpl.C \
|
Timeout_pimpl.C \
|
||||||
@ -103,6 +106,7 @@ libkde_la_SOURCES = \
|
|||||||
urldlg.C \
|
urldlg.C \
|
||||||
urldlg.h
|
urldlg.h
|
||||||
|
|
||||||
|
moc/FileDialog_private_moc.C: FileDialog_private.C FileDialog_private.h
|
||||||
moc/citationdlg_moc.C: citationdlg.C citationdlg.h
|
moc/citationdlg_moc.C: citationdlg.C citationdlg.h
|
||||||
moc/copyrightdlg_moc.C: copyrightdlg.C copyrightdlg.h
|
moc/copyrightdlg_moc.C: copyrightdlg.C copyrightdlg.h
|
||||||
moc/docdlg_moc.C: docdlg.C docdlg.h
|
moc/docdlg_moc.C: docdlg.C docdlg.h
|
||||||
|
@ -138,9 +138,6 @@ DocDialog::DocDialog(FormDocument * form, QWidget * parent, char const * name, b
|
|||||||
geometry->margins->insertItem(_("A4 very wide margins"));
|
geometry->margins->insertItem(_("A4 very wide margins"));
|
||||||
setSizeHint(geometry->margins);
|
setSizeHint(geometry->margins);
|
||||||
|
|
||||||
#ifdef DO_USE_DEFAULT_LANGUAGE
|
|
||||||
language->language->insertItem(_("default"));
|
|
||||||
#endif
|
|
||||||
for (Languages::const_iterator cit = languages.begin();
|
for (Languages::const_iterator cit = languages.begin();
|
||||||
cit != languages.end(); ++cit)
|
cit != languages.end(); ++cit)
|
||||||
language->language->insertItem((*cit).second.lang().c_str());
|
language->language->insertItem((*cit).second.lang().c_str());
|
||||||
|
@ -5,7 +5,8 @@ BOOST_INCLUDES = -I$(top_srcdir)/boost
|
|||||||
INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
|
INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
|
||||||
${SIGC_CFLAGS} ${FRONTEND_INCLUDES} ${BOOST_INCLUDES}
|
${SIGC_CFLAGS} ${FRONTEND_INCLUDES} ${BOOST_INCLUDES}
|
||||||
|
|
||||||
libkdemoc_la_SOURCES = citationdlg_moc.C \
|
libkdemoc_la_SOURCES = FileDialog_private_moc.C \
|
||||||
|
citationdlg_moc.C \
|
||||||
copyrightdlg_moc.C \
|
copyrightdlg_moc.C \
|
||||||
docdlg_moc.C \
|
docdlg_moc.C \
|
||||||
indexdlg_moc.C \
|
indexdlg_moc.C \
|
||||||
@ -24,6 +25,8 @@ DISTCLEANFILES = $(libkdemoc_la_SOURCES) *.orig *.rej *~ *.bak core
|
|||||||
LIBS=
|
LIBS=
|
||||||
ETAGS_ARGS = --lang=c++
|
ETAGS_ARGS = --lang=c++
|
||||||
|
|
||||||
|
FileDialog_private_moc.C: ../FileDialog_private.h
|
||||||
|
$(MOC) $< -o $@
|
||||||
citationdlg_moc.C: ../citationdlg.h
|
citationdlg_moc.C: ../citationdlg.h
|
||||||
$(MOC) $< -o $@
|
$(MOC) $< -o $@
|
||||||
copyrightdlg_moc.C: ../copyrightdlg.h
|
copyrightdlg_moc.C: ../copyrightdlg.h
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
2001-03-06 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* Makefile.am:
|
||||||
|
* FileDialog.C:
|
||||||
|
* FormFiledialog.C:
|
||||||
|
* FormFiledialog.h:
|
||||||
|
* form_filedialog.C:
|
||||||
|
* form_filedialog.h:
|
||||||
|
* FormGraphics.C:
|
||||||
|
* FormInclude.C:
|
||||||
|
* FormPreferences.C:
|
||||||
|
* FormPrint.C:
|
||||||
|
* xforms_helpers.C:
|
||||||
|
* xforms_helpers.h:
|
||||||
|
* forms/fdfix.sh:
|
||||||
|
* forms/makefile:
|
||||||
|
* form/form_filedialog.fd: add File Dialog
|
||||||
|
* Toolbar_pimpl.h:
|
||||||
|
* Toolbar_pimpl.C: move LayoutsCB to here
|
||||||
|
|
||||||
2001-03-06 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
2001-03-06 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||||
|
|
||||||
* FormParagraph.C: changes because of ParagraphParameters.
|
* FormParagraph.C: changes because of ParagraphParameters.
|
||||||
|
80
src/frontends/xforms/FileDialog.C
Normal file
80
src/frontends/xforms/FileDialog.C
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/**
|
||||||
|
* \file FileDialog.C
|
||||||
|
* Copyright 2001 the LyX Team
|
||||||
|
* Read the file COPYING
|
||||||
|
*
|
||||||
|
* \author John Levon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <gettext.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "commandtags.h"
|
||||||
|
|
||||||
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
|
// temp. hack until Allow/ProhibitInput is not
|
||||||
|
// needed any more in src/ - for now it's simplest
|
||||||
|
// to leave it there
|
||||||
|
#include "LyXView.h"
|
||||||
|
#include "bufferview_funcs.h"
|
||||||
|
|
||||||
|
#include "frontends/FileDialog.h"
|
||||||
|
|
||||||
|
#include "FormFiledialog.h"
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
using std::make_pair;
|
||||||
|
using std::pair;
|
||||||
|
using std::endl;
|
||||||
|
|
||||||
|
FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
|
||||||
|
: private_(0), lv_(lv), title_(t), success_(s)
|
||||||
|
{
|
||||||
|
private_ = new FileDialog::Private();
|
||||||
|
|
||||||
|
private_->SetButton(0, b1.first, b1.second);
|
||||||
|
private_->SetButton(1, b2.first, b2.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileDialog::~FileDialog()
|
||||||
|
{
|
||||||
|
delete private_;
|
||||||
|
private_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
|
||||||
|
{
|
||||||
|
string filter = mask;
|
||||||
|
|
||||||
|
if (mask.empty())
|
||||||
|
filter = _("*");
|
||||||
|
else {
|
||||||
|
rsplit(mask, filter, '|');
|
||||||
|
if (filter.empty())
|
||||||
|
filter = mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << "\"" << endl;
|
||||||
|
|
||||||
|
// no support for asynchronous selection yet
|
||||||
|
|
||||||
|
ProhibitInput(lv_->view());
|
||||||
|
|
||||||
|
FileDialog::Result result;
|
||||||
|
|
||||||
|
result.first = FileDialog::Chosen;
|
||||||
|
result.second = private_->Select(title_, path, filter, suggested);
|
||||||
|
|
||||||
|
AllowInput(lv_->view());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
@ -1,13 +1,11 @@
|
|||||||
// -*- C++ -*-
|
/**
|
||||||
/* This file is part of
|
* \file FormFiledialog.C
|
||||||
* ======================================================
|
* Copyright 2001 the LyX Team
|
||||||
*
|
* Read the file COPYING
|
||||||
* LyX, The Document Processor
|
|
||||||
*
|
|
||||||
* Copyright 1995 Matthias Ettrich
|
|
||||||
* Copyright 1995-2000 The LyX Team.
|
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* \author unknown
|
||||||
|
* \author John Levon
|
||||||
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -23,7 +21,7 @@ using std::map;
|
|||||||
using std::max;
|
using std::max;
|
||||||
using std::sort;
|
using std::sort;
|
||||||
|
|
||||||
#include "lyx_gui_misc.h" // CancelCloseCB
|
#include "lyx_gui_misc.h" // for WriteFSAlert
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -61,6 +59,7 @@ using std::sort;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// FIXME: should be autoconfiscated
|
||||||
#ifdef BROKEN_HEADERS
|
#ifdef BROKEN_HEADERS
|
||||||
extern "C" int gettimeofday(struct timeval *, struct timezone *);
|
extern "C" int gettimeofday(struct timeval *, struct timezone *);
|
||||||
#endif
|
#endif
|
||||||
@ -70,7 +69,7 @@ extern "C" int gettimeofday(struct timeval *, struct timezone *);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "filedlg.h"
|
#include "FormFiledialog.h"
|
||||||
|
|
||||||
#ifdef SIGC_CXX_NAMESPACES
|
#ifdef SIGC_CXX_NAMESPACES
|
||||||
using SigC::slot;
|
using SigC::slot;
|
||||||
@ -103,7 +102,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void UserCache::add(uid_t ID) const
|
void UserCache::add(uid_t ID) const
|
||||||
{
|
{
|
||||||
string pszNewName;
|
string pszNewName;
|
||||||
struct passwd * pEntry;
|
struct passwd * pEntry;
|
||||||
@ -135,7 +134,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
string const & GroupCache::find(gid_t ID) const
|
string const & GroupCache::find(gid_t ID) const
|
||||||
{
|
{
|
||||||
Groups::const_iterator cit = groups.find(ID);
|
Groups::const_iterator cit = groups.find(ID);
|
||||||
if (cit == groups.end()) {
|
if (cit == groups.end()) {
|
||||||
@ -146,7 +145,7 @@ string const & GroupCache::find(gid_t ID) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GroupCache::add(gid_t ID) const
|
void GroupCache::add(gid_t ID) const
|
||||||
{
|
{
|
||||||
string pszNewName;
|
string pszNewName;
|
||||||
struct group * pEntry;
|
struct group * pEntry;
|
||||||
@ -166,20 +165,14 @@ static UserCache lyxUserCache;
|
|||||||
static GroupCache lyxGroupCache;
|
static GroupCache lyxGroupCache;
|
||||||
|
|
||||||
|
|
||||||
// some "C" wrappers around callbacks
|
|
||||||
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT *, long lArgument);
|
|
||||||
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *, long);
|
|
||||||
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *, void *);
|
|
||||||
|
|
||||||
|
|
||||||
// compares two LyXDirEntry objects content (used for sort)
|
// compares two LyXDirEntry objects content (used for sort)
|
||||||
class comp_direntry {
|
class comp_direntry {
|
||||||
public:
|
public:
|
||||||
int operator()(LyXDirEntry const & r1,
|
int operator()(DirEntry const & r1,
|
||||||
LyXDirEntry const & r2) const ;
|
DirEntry const & r2) const ;
|
||||||
};
|
};
|
||||||
int comp_direntry::operator()(LyXDirEntry const & r1,
|
int comp_direntry::operator()(DirEntry const & r1,
|
||||||
LyXDirEntry const & r2) const {
|
DirEntry const & r2) const {
|
||||||
bool r1d = suffixIs(r1.pszName, '/');
|
bool r1d = suffixIs(r1.pszName, '/');
|
||||||
bool r2d = suffixIs(r2.pszName, '/');
|
bool r2d = suffixIs(r2.pszName, '/');
|
||||||
if (r1d && !r2d) return 1;
|
if (r1d && !r2d) return 1;
|
||||||
@ -188,20 +181,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// *** LyXFileDlg class implementation
|
// *** FileDialog::Private class implementation
|
||||||
|
|
||||||
// static members
|
// static members
|
||||||
FD_FileDlg * LyXFileDlg::pFileDlgForm = 0;
|
FD_form_filedialog * FileDialog::Private::pFileDlgForm = 0;
|
||||||
LyXFileDlg * LyXFileDlg::pCurrentDlg = 0;
|
FileDialog::Private * FileDialog::Private::pCurrentDlg = 0;
|
||||||
|
|
||||||
|
|
||||||
// Reread: updates dialog list to match class directory
|
// Reread: updates dialog list to match class directory
|
||||||
void LyXFileDlg::Reread()
|
void FileDialog::Private::Reread()
|
||||||
{
|
{
|
||||||
// Opens directory
|
// Opens directory
|
||||||
DIR * pDirectory = ::opendir(pszDirectory.c_str());
|
DIR * pDirectory = ::opendir(pszDirectory.c_str());
|
||||||
if (!pDirectory) {
|
if (!pDirectory) {
|
||||||
WriteFSAlert(_("Warning! Couldn't open directory."),
|
WriteFSAlert(_("Warning! Couldn't open directory."),
|
||||||
pszDirectory);
|
pszDirectory);
|
||||||
pszDirectory = lyx::getcwd();
|
pszDirectory = lyx::getcwd();
|
||||||
pDirectory = ::opendir(pszDirectory.c_str());
|
pDirectory = ::opendir(pszDirectory.c_str());
|
||||||
@ -240,7 +233,7 @@ void LyXFileDlg::Reread()
|
|||||||
bool isLink = false, isDir = false;
|
bool isLink = false, isDir = false;
|
||||||
|
|
||||||
// If the pattern doesn't start with a dot, skip hidden files
|
// If the pattern doesn't start with a dot, skip hidden files
|
||||||
if (!pszMask.empty() && pszMask[0] != '.' &&
|
if (!pszMask.empty() && pszMask[0] != '.' &&
|
||||||
pDirEntry->d_name[0] == '.')
|
pDirEntry->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -314,7 +307,7 @@ void LyXFileDlg::Reread()
|
|||||||
} else if (!(isDir = fileInfo.isDir()))
|
} else if (!(isDir = fileInfo.isDir()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LyXDirEntry tmp;
|
DirEntry tmp;
|
||||||
|
|
||||||
// Note pszLsEntry is an string!
|
// Note pszLsEntry is an string!
|
||||||
tmp.pszLsEntry = Buffer;
|
tmp.pszLsEntry = Buffer;
|
||||||
@ -352,7 +345,7 @@ void LyXFileDlg::Reread()
|
|||||||
|
|
||||||
|
|
||||||
// SetDirectory: sets dialog current directory
|
// SetDirectory: sets dialog current directory
|
||||||
void LyXFileDlg::SetDirectory(string const & Path)
|
void FileDialog::Private::SetDirectory(string const & Path)
|
||||||
{
|
{
|
||||||
if (!pszDirectory.empty()) {
|
if (!pszDirectory.empty()) {
|
||||||
string TempPath = ExpandPath(Path); // Expand ~/
|
string TempPath = ExpandPath(Path); // Expand ~/
|
||||||
@ -363,7 +356,7 @@ void LyXFileDlg::SetDirectory(string const & Path)
|
|||||||
|
|
||||||
|
|
||||||
// SetMask: sets dialog file mask
|
// SetMask: sets dialog file mask
|
||||||
void LyXFileDlg::SetMask(string const & NewMask)
|
void FileDialog::Private::SetMask(string const & NewMask)
|
||||||
{
|
{
|
||||||
pszMask = NewMask;
|
pszMask = NewMask;
|
||||||
fl_set_input(pFileDlgForm->PatBox, pszMask.c_str());
|
fl_set_input(pFileDlgForm->PatBox, pszMask.c_str());
|
||||||
@ -371,21 +364,21 @@ void LyXFileDlg::SetMask(string const & NewMask)
|
|||||||
|
|
||||||
|
|
||||||
// SetInfoLine: sets dialog information line
|
// SetInfoLine: sets dialog information line
|
||||||
void LyXFileDlg::SetInfoLine(string const & Line)
|
void FileDialog::Private::SetInfoLine(string const & Line)
|
||||||
{
|
{
|
||||||
pszInfoLine = Line;
|
pszInfoLine = Line;
|
||||||
fl_set_object_label(pFileDlgForm->FileInfo, pszInfoLine.c_str());
|
fl_set_object_label(pFileDlgForm->FileInfo, pszInfoLine.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXFileDlg::LyXFileDlg()
|
FileDialog::Private::Private()
|
||||||
{
|
{
|
||||||
pszDirectory = MakeAbsPath(string("."));
|
pszDirectory = MakeAbsPath(string("."));
|
||||||
pszMask = '*';
|
pszMask = '*';
|
||||||
|
|
||||||
// Creates form if necessary.
|
// Creates form if necessary.
|
||||||
if (!pFileDlgForm) {
|
if (!pFileDlgForm) {
|
||||||
pFileDlgForm = create_form_FileDlg();
|
pFileDlgForm = build_filedialog();
|
||||||
// Set callbacks. This means that we don't need a patch file
|
// Set callbacks. This means that we don't need a patch file
|
||||||
fl_set_object_callback(pFileDlgForm->DirBox,
|
fl_set_object_callback(pFileDlgForm->DirBox,
|
||||||
C_LyXFileDlg_FileDlgCB, 0);
|
C_LyXFileDlg_FileDlgCB, 0);
|
||||||
@ -405,7 +398,7 @@ LyXFileDlg::LyXFileDlg()
|
|||||||
C_LyXFileDlg_FileDlgCB, 13);
|
C_LyXFileDlg_FileDlgCB, 13);
|
||||||
|
|
||||||
// Make sure pressing the close box doesn't crash LyX. (RvdK)
|
// Make sure pressing the close box doesn't crash LyX. (RvdK)
|
||||||
fl_set_form_atclose(pFileDlgForm->FileDlg,
|
fl_set_form_atclose(pFileDlgForm->form,
|
||||||
C_LyXFileDlg_CancelCB, 0);
|
C_LyXFileDlg_CancelCB, 0);
|
||||||
// Register doubleclick callback
|
// Register doubleclick callback
|
||||||
fl_set_browser_dblclick_callback(pFileDlgForm->List,
|
fl_set_browser_dblclick_callback(pFileDlgForm->List,
|
||||||
@ -415,25 +408,25 @@ LyXFileDlg::LyXFileDlg()
|
|||||||
fl_hide_object(pFileDlgForm->User1);
|
fl_hide_object(pFileDlgForm->User1);
|
||||||
fl_hide_object(pFileDlgForm->User2);
|
fl_hide_object(pFileDlgForm->User2);
|
||||||
|
|
||||||
r_ = Dialogs::redrawGUI.connect(slot(this, &LyXFileDlg::redraw));
|
r_ = Dialogs::redrawGUI.connect(slot(this, &FileDialog::Private::redraw));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXFileDlg::~LyXFileDlg()
|
FileDialog::Private::~Private()
|
||||||
{
|
{
|
||||||
r_.disconnect();
|
r_.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXFileDlg::redraw()
|
void FileDialog::Private::redraw()
|
||||||
{
|
{
|
||||||
if (pFileDlgForm->FileDlg && pFileDlgForm->FileDlg->visible)
|
if (pFileDlgForm->form && pFileDlgForm->form->visible)
|
||||||
fl_redraw_form(pFileDlgForm->FileDlg);
|
fl_redraw_form(pFileDlgForm->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SetButton: sets file selector user button action
|
// SetButton: sets file selector user button action
|
||||||
void LyXFileDlg::SetButton(int iIndex, string const & pszName,
|
void FileDialog::Private::SetButton(int iIndex, string const & pszName,
|
||||||
string const & pszPath)
|
string const & pszPath)
|
||||||
{
|
{
|
||||||
FL_OBJECT * pObject;
|
FL_OBJECT * pObject;
|
||||||
@ -459,7 +452,7 @@ void LyXFileDlg::SetButton(int iIndex, string const & pszName,
|
|||||||
|
|
||||||
|
|
||||||
// GetDirectory: gets last dialog directory
|
// GetDirectory: gets last dialog directory
|
||||||
string const LyXFileDlg::GetDirectory() const
|
string const FileDialog::Private::GetDirectory() const
|
||||||
{
|
{
|
||||||
if (!pszDirectory.empty())
|
if (!pszDirectory.empty())
|
||||||
return pszDirectory;
|
return pszDirectory;
|
||||||
@ -469,7 +462,7 @@ string const LyXFileDlg::GetDirectory() const
|
|||||||
|
|
||||||
|
|
||||||
// RunDialog: handle dialog during file selection
|
// RunDialog: handle dialog during file selection
|
||||||
bool LyXFileDlg::RunDialog()
|
bool FileDialog::Private::RunDialog()
|
||||||
{
|
{
|
||||||
force_cancel = false;
|
force_cancel = false;
|
||||||
force_ok = false;
|
force_ok = false;
|
||||||
@ -481,8 +474,8 @@ bool LyXFileDlg::RunDialog()
|
|||||||
if (pObject == pFileDlgForm->Ready) {
|
if (pObject == pFileDlgForm->Ready) {
|
||||||
if (HandleOK())
|
if (HandleOK())
|
||||||
return true;
|
return true;
|
||||||
} else if (pObject == pFileDlgForm->Cancel
|
} else if (pObject == pFileDlgForm->Cancel
|
||||||
|| force_cancel)
|
|| force_cancel)
|
||||||
return false;
|
return false;
|
||||||
else if (force_ok)
|
else if (force_ok)
|
||||||
return true;
|
return true;
|
||||||
@ -491,7 +484,7 @@ bool LyXFileDlg::RunDialog()
|
|||||||
|
|
||||||
|
|
||||||
// XForms objects callback (static)
|
// XForms objects callback (static)
|
||||||
void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
|
void FileDialog::Private::FileDlgCB(FL_OBJECT *, long lArgument)
|
||||||
{
|
{
|
||||||
if (!pCurrentDlg) return;
|
if (!pCurrentDlg) return;
|
||||||
|
|
||||||
@ -545,14 +538,14 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data)
|
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
LyXFileDlg::FileDlgCB(ob, data);
|
FileDialog::Private::FileDlgCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Handle callback from list
|
// Handle callback from list
|
||||||
void LyXFileDlg::HandleListHit()
|
void FileDialog::Private::HandleListHit()
|
||||||
{
|
{
|
||||||
// set info line
|
// set info line
|
||||||
int const iSelect = fl_get_browser(pFileDlgForm->List);
|
int const iSelect = fl_get_browser(pFileDlgForm->List);
|
||||||
@ -565,7 +558,7 @@ void LyXFileDlg::HandleListHit()
|
|||||||
|
|
||||||
|
|
||||||
// Callback for double click in list
|
// Callback for double click in list
|
||||||
void LyXFileDlg::DoubleClickCB(FL_OBJECT *, long)
|
void FileDialog::Private::DoubleClickCB(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
if (pCurrentDlg->HandleDoubleClick())
|
if (pCurrentDlg->HandleDoubleClick())
|
||||||
// Simulate click on OK button
|
// Simulate click on OK button
|
||||||
@ -575,12 +568,12 @@ void LyXFileDlg::DoubleClickCB(FL_OBJECT *, long)
|
|||||||
|
|
||||||
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data)
|
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
LyXFileDlg::DoubleClickCB(ob, data);
|
FileDialog::Private::DoubleClickCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Handle double click from list
|
// Handle double click from list
|
||||||
bool LyXFileDlg::HandleDoubleClick()
|
bool FileDialog::Private::HandleDoubleClick()
|
||||||
{
|
{
|
||||||
string pszTemp;
|
string pszTemp;
|
||||||
|
|
||||||
@ -631,7 +624,7 @@ bool LyXFileDlg::HandleDoubleClick()
|
|||||||
|
|
||||||
|
|
||||||
// Handle OK button call
|
// Handle OK button call
|
||||||
bool LyXFileDlg::HandleOK()
|
bool FileDialog::Private::HandleOK()
|
||||||
{
|
{
|
||||||
// mask was changed
|
// mask was changed
|
||||||
string pszTemp = fl_get_input(pFileDlgForm->PatBox);
|
string pszTemp = fl_get_input(pFileDlgForm->PatBox);
|
||||||
@ -670,7 +663,7 @@ bool LyXFileDlg::HandleOK()
|
|||||||
|
|
||||||
|
|
||||||
// Handle Cancel CB from WM close
|
// Handle Cancel CB from WM close
|
||||||
int LyXFileDlg::CancelCB(FL_FORM *, void *)
|
int FileDialog::Private::CancelCB(FL_FORM *, void *)
|
||||||
{
|
{
|
||||||
// Simulate a click on the cancel button
|
// Simulate a click on the cancel button
|
||||||
pCurrentDlg->Force(true);
|
pCurrentDlg->Force(true);
|
||||||
@ -680,12 +673,12 @@ int LyXFileDlg::CancelCB(FL_FORM *, void *)
|
|||||||
|
|
||||||
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev)
|
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev)
|
||||||
{
|
{
|
||||||
return LyXFileDlg::CancelCB(fl, xev);
|
return FileDialog::Private::CancelCB(fl, xev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Simulates a click on OK/Cancel
|
// Simulates a click on OK/Cancel
|
||||||
void LyXFileDlg::Force(bool cancel)
|
void FileDialog::Private::Force(bool cancel)
|
||||||
{
|
{
|
||||||
if (cancel) {
|
if (cancel) {
|
||||||
force_cancel = true;
|
force_cancel = true;
|
||||||
@ -700,7 +693,7 @@ void LyXFileDlg::Force(bool cancel)
|
|||||||
|
|
||||||
|
|
||||||
// Select: launches dialog and returns selected file
|
// Select: launches dialog and returns selected file
|
||||||
string const LyXFileDlg::Select(string const & title, string const & path,
|
string const FileDialog::Private::Select(string const & title, string const & path,
|
||||||
string const & mask, string const & suggested)
|
string const & mask, string const & suggested)
|
||||||
{
|
{
|
||||||
// handles new mask and path
|
// handles new mask and path
|
||||||
@ -719,7 +712,7 @@ string const LyXFileDlg::Select(string const & title, string const & path,
|
|||||||
int sel = 0;
|
int sel = 0;
|
||||||
string const filename = OnlyFilename(suggested);
|
string const filename = OnlyFilename(suggested);
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
i < fl_get_browser_maxline(pFileDlgForm->List); ++i) {
|
i < fl_get_browser_maxline(pFileDlgForm->List); ++i) {
|
||||||
string s =
|
string s =
|
||||||
fl_get_browser_line(pFileDlgForm->List, i + 1);
|
fl_get_browser_line(pFileDlgForm->List, i + 1);
|
||||||
@ -744,15 +737,15 @@ string const LyXFileDlg::Select(string const & title, string const & path,
|
|||||||
fl_set_input(pFileDlgForm->Filename, suggested.c_str());
|
fl_set_input(pFileDlgForm->Filename, suggested.c_str());
|
||||||
fl_set_button(pFileDlgForm->Cancel, 0);
|
fl_set_button(pFileDlgForm->Cancel, 0);
|
||||||
fl_set_button(pFileDlgForm->Ready, 0);
|
fl_set_button(pFileDlgForm->Ready, 0);
|
||||||
fl_set_focus_object(pFileDlgForm->FileDlg, pFileDlgForm->Filename);
|
fl_set_focus_object(pFileDlgForm->form, pFileDlgForm->Filename);
|
||||||
fl_deactivate_all_forms();
|
fl_deactivate_all_forms();
|
||||||
fl_show_form(pFileDlgForm->FileDlg,
|
fl_show_form(pFileDlgForm->form,
|
||||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
FL_PLACE_MOUSE | FL_FREE_SIZE, 0,
|
||||||
title.c_str());
|
title.c_str());
|
||||||
|
|
||||||
isOk = RunDialog();
|
isOk = RunDialog();
|
||||||
|
|
||||||
fl_hide_form(pFileDlgForm->FileDlg);
|
fl_hide_form(pFileDlgForm->form);
|
||||||
fl_activate_all_forms();
|
fl_activate_all_forms();
|
||||||
pCurrentDlg = 0;
|
pCurrentDlg = 0;
|
||||||
|
|
||||||
@ -762,7 +755,7 @@ string const LyXFileDlg::Select(string const & title, string const & path,
|
|||||||
pszFileName = fl_get_input(pFileDlgForm->Filename);
|
pszFileName = fl_get_input(pFileDlgForm->Filename);
|
||||||
|
|
||||||
if (!AbsolutePath(pszFileName)) {
|
if (!AbsolutePath(pszFileName)) {
|
||||||
pszFileName = AddName(fl_get_input(pFileDlgForm->DirBox),
|
pszFileName = AddName(fl_get_input(pFileDlgForm->DirBox),
|
||||||
pszFileName);
|
pszFileName);
|
||||||
}
|
}
|
||||||
return pszFileName;
|
return pszFileName;
|
@ -1,35 +1,37 @@
|
|||||||
// -*- C++ -*-
|
/**
|
||||||
/* This file is part of
|
* \file FormFiledialog.h
|
||||||
* ======================================================
|
* Copyright 2001 the LyX Team
|
||||||
*
|
* Read the file COPYING
|
||||||
* LyX, The Document Processor
|
|
||||||
*
|
|
||||||
* Copyright 1995 Matthias Ettrich
|
|
||||||
* Copyright 1995-2000 The LyX Team.
|
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* \author unknown
|
||||||
|
* \author John Levon
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef FILEDLG_H
|
#ifndef FORMFILEDIALOG_H
|
||||||
#define FILEDLG_H
|
#define FORMFILEDIALOG_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sigc++/signal_system.h>
|
#include <sigc++/signal_system.h>
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "form1.h"
|
#include "form_filedialog.h"
|
||||||
|
|
||||||
|
#include "frontends/FileDialog.h"
|
||||||
|
|
||||||
#ifdef SIGC_CXX_NAMESPACES
|
#ifdef SIGC_CXX_NAMESPACES
|
||||||
using SigC::Object;
|
using SigC::Object;
|
||||||
using SigC::Connection;
|
using SigC::Connection;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// LyXDirEntry internal structure definition
|
/// DirEntry internal structure definition
|
||||||
class LyXDirEntry {
|
class DirEntry {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
string pszName;
|
string pszName;
|
||||||
@ -39,25 +41,27 @@ public:
|
|||||||
string pszLsEntry;
|
string pszLsEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
|
||||||
|
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
|
||||||
|
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
|
||||||
|
|
||||||
/// FileDlg class definition
|
class FileDialog::Private : public Object
|
||||||
class LyXFileDlg : public Object
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
LyXFileDlg();
|
Private();
|
||||||
///
|
///
|
||||||
~LyXFileDlg();
|
~Private();
|
||||||
|
|
||||||
/// sets file selector user button action
|
/// sets file selector user button action
|
||||||
void SetButton(int iIndex, string const & pszName = string(),
|
void SetButton(int iIndex, string const & pszName = string(),
|
||||||
string const & pszPath = string());
|
string const & pszPath = string());
|
||||||
/// gets last dialog directory
|
/// gets last dialog directory
|
||||||
string const GetDirectory() const;
|
string const GetDirectory() const;
|
||||||
/// launches dialog and returns selected file
|
/// launches dialog and returns selected file
|
||||||
string const Select(string const & pszTitle = string(),
|
string const Select(string const & pszTitle = string(),
|
||||||
string const & pszPath = string(),
|
string const & pszPath = string(),
|
||||||
string const & pszMask = string(),
|
string const & pszMask = string(),
|
||||||
string const & pszSuggested = string());
|
string const & pszSuggested = string());
|
||||||
/// XForms objects callback (static)
|
/// XForms objects callback (static)
|
||||||
static void FileDlgCB(FL_OBJECT *, long);
|
static void FileDlgCB(FL_OBJECT *, long);
|
||||||
@ -65,11 +69,12 @@ public:
|
|||||||
static void DoubleClickCB(FL_OBJECT *, long);
|
static void DoubleClickCB(FL_OBJECT *, long);
|
||||||
/// Handle Cancel CB from WM close
|
/// Handle Cancel CB from WM close
|
||||||
static int CancelCB(FL_FORM *, void *);
|
static int CancelCB(FL_FORM *, void *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// data
|
/// data
|
||||||
static FD_FileDlg * pFileDlgForm;
|
static FD_form_filedialog * pFileDlgForm;
|
||||||
///
|
///
|
||||||
static LyXFileDlg * pCurrentDlg;
|
static FileDialog::Private * pCurrentDlg;
|
||||||
///
|
///
|
||||||
string pszUserPath1;
|
string pszUserPath1;
|
||||||
///
|
///
|
||||||
@ -89,7 +94,7 @@ private:
|
|||||||
///
|
///
|
||||||
string pszInfoLine;
|
string pszInfoLine;
|
||||||
///
|
///
|
||||||
typedef std::vector<LyXDirEntry> DirEntries;
|
typedef std::vector<DirEntry> DirEntries;
|
||||||
///
|
///
|
||||||
DirEntries direntries;
|
DirEntries direntries;
|
||||||
///
|
///
|
||||||
@ -97,6 +102,9 @@ private:
|
|||||||
///
|
///
|
||||||
bool force_ok;
|
bool force_ok;
|
||||||
|
|
||||||
|
/// build the dialog
|
||||||
|
FD_form_filedialog * build_filedialog();
|
||||||
|
|
||||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||||
that the xform colors have been re-mapped).
|
that the xform colors have been re-mapped).
|
||||||
*/
|
*/
|
||||||
@ -123,4 +131,4 @@ private:
|
|||||||
Connection r_;
|
Connection r_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // FORMFILEDIALOG_H
|
@ -357,7 +357,8 @@ void FormGraphics::browse()
|
|||||||
string const filename = fl_get_input(dialog_->input_filename);
|
string const filename = fl_get_input(dialog_->input_filename);
|
||||||
|
|
||||||
string const title = N_("Graphics");
|
string const title = N_("Graphics");
|
||||||
string const pattern = "*(ps|png)";
|
// we need the second '|' to prevent mis-interpretation
|
||||||
|
string const pattern = "*.(ps|png)|";
|
||||||
|
|
||||||
// Does user clipart directory exist?
|
// Does user clipart directory exist?
|
||||||
string clipdir = AddName (user_lyxdir, "clipart");
|
string clipdir = AddName (user_lyxdir, "clipart");
|
||||||
@ -369,7 +370,7 @@ void FormGraphics::browse()
|
|||||||
|
|
||||||
// Show the file browser dialog
|
// Show the file browser dialog
|
||||||
string const new_filename =
|
string const new_filename =
|
||||||
browseFile(filename, title, pattern, dir1,
|
browseFile(lv_, filename, title, pattern, dir1,
|
||||||
make_pair(string(), string()));
|
make_pair(string(), string()));
|
||||||
|
|
||||||
// Save the filename to the dialog
|
// Save the filename to the dialog
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <utility>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
@ -17,9 +17,9 @@
|
|||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "FormInclude.h"
|
#include "FormInclude.h"
|
||||||
#include "insets/insetinclude.h"
|
#include "insets/insetinclude.h"
|
||||||
#include "filedlg.h"
|
#include "frontends/FileDialog.h"
|
||||||
#include "support/filetools.C"
|
#include "support/filetools.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
@ -28,15 +28,13 @@
|
|||||||
|
|
||||||
#include "form_include.h"
|
#include "form_include.h"
|
||||||
|
|
||||||
using std::cout;
|
using std::make_pair;
|
||||||
|
using std::pair;
|
||||||
|
|
||||||
FormInclude::FormInclude(LyXView * lv, Dialogs * d)
|
FormInclude::FormInclude(LyXView * lv, Dialogs * d)
|
||||||
: FormCommand(lv, d, _("Include file"), new OkCancelPolicy),
|
: FormCommand(lv, d, _("Include file"), new OkCancelPolicy),
|
||||||
dialog_(0)
|
dialog_(0)
|
||||||
{
|
{
|
||||||
// let the dialog be shown
|
|
||||||
// These are permanent connections so we won't bother
|
|
||||||
// storing a copy because we won't be disconnecting.
|
|
||||||
d->showInclude.connect(slot(this, &FormInclude::showInset));
|
d->showInclude.connect(slot(this, &FormInclude::showInset));
|
||||||
d->createInclude.connect(slot(this, &FormInclude::createInset));
|
d->createInclude.connect(slot(this, &FormInclude::createInset));
|
||||||
}
|
}
|
||||||
@ -125,7 +123,7 @@ void FormInclude::apply()
|
|||||||
//inset_->setNoLoad(fl_get_button(dialog_->flag1));
|
//inset_->setNoLoad(fl_get_button(dialog_->flag1));
|
||||||
|
|
||||||
params.setContents(fl_get_input(dialog_->filename));
|
params.setContents(fl_get_input(dialog_->filename));
|
||||||
cout << params.getContents() << endl;
|
|
||||||
if (fl_get_button(dialog_->flag2))
|
if (fl_get_button(dialog_->flag2))
|
||||||
params.setCmdName("input");
|
params.setCmdName("input");
|
||||||
else if (fl_get_button(dialog_->flag3))
|
else if (fl_get_button(dialog_->flag3))
|
||||||
@ -156,19 +154,19 @@ bool FormInclude::input(FL_OBJECT *, long data)
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
case BROWSE: {
|
case BROWSE: {
|
||||||
// Should browsing too be disabled in RO-mode?
|
// Should browsing too be disabled in RO-mode?
|
||||||
LyXFileDlg fileDlg;
|
FileDialog fileDlg(lv_, _("Select document to include"),
|
||||||
|
LFUN_SELECT_FILE_SYNC,
|
||||||
|
make_pair(string(_("Documents")), string(lyxrc.document_path)));
|
||||||
|
|
||||||
string ext;
|
string ext;
|
||||||
|
|
||||||
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
|
|
||||||
|
|
||||||
/* input TeX, verbatim, or LyX file ? */
|
/* input TeX, verbatim, or LyX file ? */
|
||||||
if (fl_get_button(dialog_->flag2))
|
if (fl_get_button(dialog_->flag2))
|
||||||
ext = "*.tex";
|
ext = _("*.tex| LaTeX Documents (*.tex)");
|
||||||
else if (fl_get_button(dialog_->flag4))
|
else if (fl_get_button(dialog_->flag4))
|
||||||
ext = "*";
|
ext = _("*| All files ");
|
||||||
else
|
else
|
||||||
ext = "*.lyx";
|
ext = _("*.lyx| LyX Documents (*.lyx)");
|
||||||
|
|
||||||
string mpath;
|
string mpath;
|
||||||
|
|
||||||
@ -176,18 +174,16 @@ bool FormInclude::input(FL_OBJECT *, long data)
|
|||||||
//if (inset_)
|
//if (inset_)
|
||||||
// mpath = OnlyPath(inset_->getMasterFilename());
|
// mpath = OnlyPath(inset_->getMasterFilename());
|
||||||
|
|
||||||
string const filename = fileDlg.Select(_("Select Child Document"),
|
FileDialog::Result result = fileDlg.Select(mpath, ext, fl_get_input(dialog_->filename));
|
||||||
mpath, ext, fl_get_input(dialog_->filename));
|
|
||||||
XFlush(fl_get_display());
|
|
||||||
|
|
||||||
// check selected filename
|
// check selected filename
|
||||||
if (filename.empty())
|
if (result.second.empty())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
string const filename2 = MakeRelPath(filename, mpath);
|
string const filename2 = MakeRelPath(result.second, mpath);
|
||||||
|
|
||||||
if (prefixIs(filename2, ".."))
|
if (prefixIs(filename2, ".."))
|
||||||
fl_set_input(dialog_->filename, filename.c_str());
|
fl_set_input(dialog_->filename, result.second.c_str());
|
||||||
else
|
else
|
||||||
fl_set_input(dialog_->filename, filename2.c_str());
|
fl_set_input(dialog_->filename, filename2.c_str());
|
||||||
|
|
||||||
@ -203,8 +199,7 @@ bool FormInclude::input(FL_OBJECT *, long data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case INPUTINCLUDE:
|
case INPUTINCLUDE:
|
||||||
cout << "inputinclude" << endl;
|
/* FIXME: huh ? why doesn't this work ? */
|
||||||
/* huh ? why doesn't this work ? */
|
|
||||||
setEnabled(dialog_->flag41, false);
|
setEnabled(dialog_->flag41, false);
|
||||||
fl_set_button(dialog_->flag41, 0);
|
fl_set_button(dialog_->flag41, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -2931,7 +2931,7 @@ void FormPreferences::browse(FL_OBJECT * inpt,
|
|||||||
|
|
||||||
// Show the file browser dialog
|
// Show the file browser dialog
|
||||||
string const new_filename =
|
string const new_filename =
|
||||||
browseFile(filename, title, pattern, dir1, dir2);
|
browseFile(lv_, filename, title, pattern, dir1, dir2);
|
||||||
|
|
||||||
// Save the filename to the dialog
|
// Save the filename to the dialog
|
||||||
if (new_filename != filename && !new_filename.empty()) {
|
if (new_filename != filename && !new_filename.empty()) {
|
||||||
|
@ -263,7 +263,7 @@ void FormPrint::browse()
|
|||||||
|
|
||||||
// Show the file browser dialog
|
// Show the file browser dialog
|
||||||
string const new_filename =
|
string const new_filename =
|
||||||
browseFile(filename, title, pattern,
|
browseFile(lv_, filename, title, pattern,
|
||||||
make_pair(string(), string()),
|
make_pair(string(), string()),
|
||||||
make_pair(string(), string()));
|
make_pair(string(), string()));
|
||||||
|
|
||||||
|
@ -17,6 +17,11 @@ libxforms_la_SOURCES = \
|
|||||||
Color.C \
|
Color.C \
|
||||||
Color.h \
|
Color.h \
|
||||||
Dialogs.C \
|
Dialogs.C \
|
||||||
|
FileDialog.C \
|
||||||
|
FormFiledialog.h \
|
||||||
|
FormFiledialog.C \
|
||||||
|
form_filedialog.C \
|
||||||
|
form_filedialog.h \
|
||||||
GUIRunTime.C \
|
GUIRunTime.C \
|
||||||
FormBase.C \
|
FormBase.C \
|
||||||
FormBase.h \
|
FormBase.h \
|
||||||
|
@ -27,12 +27,11 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "LyXAction.h"
|
#include "LyXAction.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
|
#include "support/lstrings.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
// this one is not "C" because combox callbacks are really C++ %-|
|
|
||||||
extern void LayoutsCB(int, void *, Combox *);
|
|
||||||
extern char const ** get_pixmap_from_symbol(char const * arg, int, int);
|
extern char const ** get_pixmap_from_symbol(char const * arg, int, int);
|
||||||
extern LyXAction lyxaction;
|
extern LyXAction lyxaction;
|
||||||
|
|
||||||
@ -115,7 +114,7 @@ extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data)
|
|||||||
static
|
static
|
||||||
int BubblePost(FL_OBJECT *ob, int event,
|
int BubblePost(FL_OBJECT *ob, int event,
|
||||||
FL_Coord /*mx*/, FL_Coord /*my*/,
|
FL_Coord /*mx*/, FL_Coord /*my*/,
|
||||||
int /*key*/, void */*xev*/)
|
int /*key*/, void * /*xev*/)
|
||||||
{
|
{
|
||||||
FL_OBJECT * bubble_timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata);
|
FL_OBJECT * bubble_timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata);
|
||||||
|
|
||||||
@ -142,6 +141,21 @@ extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// this one is not "C" because combox callbacks are really C++ %-|
|
||||||
|
void Toolbar::Pimpl::layoutSelectedCB(int sel, void * arg, Combox *)
|
||||||
|
{
|
||||||
|
Toolbar::Pimpl * tb = reinterpret_cast<Toolbar::Pimpl *>(arg);
|
||||||
|
|
||||||
|
tb->layoutSelected(sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Toolbar::Pimpl::layoutSelected(int sel)
|
||||||
|
{
|
||||||
|
string const tmp = tostr(sel);
|
||||||
|
owner->getLyXFunc()->Dispatch(LFUN_LAYOUTNO, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::activate()
|
void Toolbar::Pimpl::activate()
|
||||||
{
|
{
|
||||||
@ -361,7 +375,7 @@ void Toolbar::Pimpl::set(bool doingmain)
|
|||||||
if (!combox)
|
if (!combox)
|
||||||
combox = new Combox(FL_COMBOX_DROPLIST);
|
combox = new Combox(FL_COMBOX_DROPLIST);
|
||||||
combox->add(xpos, ypos, 135, height, 400);
|
combox->add(xpos, ypos, 135, height, 400);
|
||||||
combox->setcallback(LayoutsCB);
|
combox->setcallback(layoutSelectedCB, this);
|
||||||
combox->resize(FL_RESIZE_ALL);
|
combox->resize(FL_RESIZE_ALL);
|
||||||
combox->gravity(NorthWestGravity, NorthWestGravity);
|
combox->gravity(NorthWestGravity, NorthWestGravity);
|
||||||
xpos += 135;
|
xpos += 135;
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
*/
|
*/
|
||||||
struct Toolbar::Pimpl {
|
struct Toolbar::Pimpl {
|
||||||
public:
|
public:
|
||||||
|
/// called when user selects a layout from combox
|
||||||
|
static void layoutSelectedCB(int, void *, Combox *);
|
||||||
///
|
///
|
||||||
Pimpl(LyXView * o, int x, int y);
|
Pimpl(LyXView * o, int x, int y);
|
||||||
|
|
||||||
@ -61,6 +63,7 @@ public:
|
|||||||
/// update the state of the icons
|
/// update the state of the icons
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|
||||||
/// select the right layout in the combox
|
/// select the right layout in the combox
|
||||||
void setLayout(int layout);
|
void setLayout(int layout);
|
||||||
/// Populate the layout combox; re-do everything if force is true.
|
/// Populate the layout combox; re-do everything if force is true.
|
||||||
@ -69,6 +72,8 @@ public:
|
|||||||
void openLayoutList();
|
void openLayoutList();
|
||||||
/// Erase the layout list
|
/// Erase the layout list
|
||||||
void clearLayoutList();
|
void clearLayoutList();
|
||||||
|
/// and the non-static version
|
||||||
|
void layoutSelected(int);
|
||||||
|
|
||||||
///
|
///
|
||||||
struct toolbarItem
|
struct toolbarItem
|
||||||
|
108
src/frontends/xforms/form_filedialog.C
Normal file
108
src/frontends/xforms/form_filedialog.C
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||||
|
#include <config.h>
|
||||||
|
#include "lyx_gui_misc.h"
|
||||||
|
#include "gettext.h"
|
||||||
|
|
||||||
|
/* Form definition file generated with fdesign. */
|
||||||
|
|
||||||
|
#include FORMS_H_LOCATION
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "form_filedialog.h"
|
||||||
|
#include "FormFiledialog.h"
|
||||||
|
|
||||||
|
FD_form_filedialog::~FD_form_filedialog()
|
||||||
|
{
|
||||||
|
if ( form->visible ) fl_hide_form( form );
|
||||||
|
fl_free_form( form );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FD_form_filedialog * FileDialog::Private::build_filedialog()
|
||||||
|
{
|
||||||
|
FL_OBJECT *obj;
|
||||||
|
FD_form_filedialog *fdui = new FD_form_filedialog;
|
||||||
|
|
||||||
|
fdui->form = fl_bgn_form(FL_NO_BOX, 440, 380);
|
||||||
|
fdui->form->u_vdata = this;
|
||||||
|
obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 380, "");
|
||||||
|
fdui->FileInfo = obj = fl_add_text(FL_NORMAL_TEXT, 10, 260, 420, 30, "");
|
||||||
|
fl_set_object_boxtype(obj, FL_SHADOW_BOX);
|
||||||
|
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||||
|
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
|
||||||
|
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("Directory:|#D");
|
||||||
|
fdui->DirBox = obj = fl_add_input(FL_NORMAL_INPUT, 100, 10, 330, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
|
||||||
|
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("Pattern:|#P");
|
||||||
|
fdui->PatBox = obj = fl_add_input(FL_NORMAL_INPUT, 100, 40, 330, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
|
||||||
|
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||||
|
fdui->List = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 80, 320, 170, "");
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||||
|
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("Filename:|#F");
|
||||||
|
fdui->Filename = obj = fl_add_input(FL_NORMAL_INPUT, 100, 300, 330, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
|
||||||
|
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("Rescan|#R#r");
|
||||||
|
fdui->Rescan = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 80, 90, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("Home|#H#h");
|
||||||
|
fdui->Home = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 120, 90, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("User1|#1");
|
||||||
|
fdui->User1 = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 160, 90, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("User2|#2");
|
||||||
|
fdui->User2 = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 200, 90, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||||
|
fdui->Ready = obj = fl_add_button(FL_RETURN_BUTTON, 220, 340, 100, 30, _("OK"));
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("Cancel|^[");
|
||||||
|
fdui->Cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 340, 100, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||||
|
fdui->timer = obj = fl_add_timer(FL_HIDDEN_TIMER, 10, 350, 20, 20, "");
|
||||||
|
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
||||||
|
fl_end_form();
|
||||||
|
|
||||||
|
fdui->form->fdui = fdui;
|
||||||
|
|
||||||
|
return fdui;
|
||||||
|
}
|
||||||
|
/*---------------------------------------*/
|
||||||
|
|
29
src/frontends/xforms/form_filedialog.h
Normal file
29
src/frontends/xforms/form_filedialog.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
|
||||||
|
/** Header file generated with fdesign **/
|
||||||
|
|
||||||
|
#ifndef FD_form_filedialog_h_
|
||||||
|
#define FD_form_filedialog_h_
|
||||||
|
|
||||||
|
/** Callbacks, globals and object handlers **/
|
||||||
|
|
||||||
|
|
||||||
|
/**** Forms and Objects ****/
|
||||||
|
struct FD_form_filedialog {
|
||||||
|
~FD_form_filedialog();
|
||||||
|
|
||||||
|
FL_FORM *form;
|
||||||
|
FL_OBJECT *FileInfo;
|
||||||
|
FL_OBJECT *DirBox;
|
||||||
|
FL_OBJECT *PatBox;
|
||||||
|
FL_OBJECT *List;
|
||||||
|
FL_OBJECT *Filename;
|
||||||
|
FL_OBJECT *Rescan;
|
||||||
|
FL_OBJECT *Home;
|
||||||
|
FL_OBJECT *User1;
|
||||||
|
FL_OBJECT *User2;
|
||||||
|
FL_OBJECT *Ready;
|
||||||
|
FL_OBJECT *Cancel;
|
||||||
|
FL_OBJECT *timer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FD_form_filedialog_h_ */
|
@ -1,4 +1,4 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh -x
|
||||||
#
|
#
|
||||||
# NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms
|
# NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms
|
||||||
# It is a modified version to suit use for gui-indep.
|
# It is a modified version to suit use for gui-indep.
|
||||||
@ -73,6 +73,15 @@ echo >> $COUT
|
|||||||
|
|
||||||
sed -f $FDFIXC_MOD < $CIN >> $COUT
|
sed -f $FDFIXC_MOD < $CIN >> $COUT
|
||||||
|
|
||||||
|
# hack for file dialog
|
||||||
|
if [ "$CLASSNAME" = "FormFiledialog" ] ; then
|
||||||
|
ed $COUT >/dev/null 2>/dev/null << EOF
|
||||||
|
/FormFiledialog::build_filedialog
|
||||||
|
s/FormFiledialog/FileDialog::Private/
|
||||||
|
wq
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# Patch the .C file if a patch exists
|
# Patch the .C file if a patch exists
|
||||||
if [ -f "$COUT.patch" ] ; then
|
if [ -f "$COUT.patch" ] ; then
|
||||||
echo "Patching $COUT with $COUT.patch"
|
echo "Patching $COUT with $COUT.patch"
|
||||||
|
250
src/frontends/xforms/forms/form_filedialog.fd
Normal file
250
src/frontends/xforms/forms/form_filedialog.fd
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
Magic: 13000
|
||||||
|
|
||||||
|
Internal Form Definition File
|
||||||
|
(do not change)
|
||||||
|
|
||||||
|
Number of forms: 1
|
||||||
|
Unit of measure: FL_COORD_PIXEL
|
||||||
|
|
||||||
|
=============== FORM ===============
|
||||||
|
Name: form_filedialog
|
||||||
|
Width: 440
|
||||||
|
Height: 380
|
||||||
|
Number of Objects: 13
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BOX
|
||||||
|
type: UP_BOX
|
||||||
|
box: 0 0 440 380
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_DEFAULT_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label:
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_ALL
|
||||||
|
gravity: FL_NoGravity FL_NoGravity
|
||||||
|
name:
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_TEXT
|
||||||
|
type: NORMAL_TEXT
|
||||||
|
box: 10 260 420 30
|
||||||
|
boxtype: FL_SHADOW_BOX
|
||||||
|
colors: FL_COL1 FL_MCOL
|
||||||
|
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_DEFAULT_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label:
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_X
|
||||||
|
gravity: FL_SouthWest FL_SouthEast
|
||||||
|
name: FileInfo
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_INPUT
|
||||||
|
type: NORMAL_INPUT
|
||||||
|
box: 100 10 330 30
|
||||||
|
boxtype: FL_DOWN_BOX
|
||||||
|
colors: FL_COL1 FL_MCOL
|
||||||
|
alignment: FL_ALIGN_LEFT
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Directory:|#D
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_X
|
||||||
|
gravity: FL_NorthWest FL_NorthEast
|
||||||
|
name: DirBox
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_INPUT
|
||||||
|
type: NORMAL_INPUT
|
||||||
|
box: 100 40 330 30
|
||||||
|
boxtype: FL_DOWN_BOX
|
||||||
|
colors: FL_COL1 FL_MCOL
|
||||||
|
alignment: FL_ALIGN_LEFT
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Pattern:|#P
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_X
|
||||||
|
gravity: FL_NorthWest FL_NorthEast
|
||||||
|
name: PatBox
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BROWSER
|
||||||
|
type: HOLD_BROWSER
|
||||||
|
box: 10 80 320 170
|
||||||
|
boxtype: FL_DOWN_BOX
|
||||||
|
colors: FL_COL1 FL_YELLOW
|
||||||
|
alignment: FL_ALIGN_TOP
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label:
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_ALL
|
||||||
|
gravity: FL_NorthWest FL_SouthEast
|
||||||
|
name: List
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_INPUT
|
||||||
|
type: NORMAL_INPUT
|
||||||
|
box: 100 300 330 30
|
||||||
|
boxtype: FL_DOWN_BOX
|
||||||
|
colors: FL_COL1 FL_MCOL
|
||||||
|
alignment: FL_ALIGN_LEFT
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Filename:|#F
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_X
|
||||||
|
gravity: FL_SouthWest FL_SouthEast
|
||||||
|
name: Filename
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BUTTON
|
||||||
|
type: NORMAL_BUTTON
|
||||||
|
box: 340 80 90 30
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Rescan|#R#r
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_NorthEast FL_NorthEast
|
||||||
|
name: Rescan
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BUTTON
|
||||||
|
type: NORMAL_BUTTON
|
||||||
|
box: 340 120 90 30
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Home|#H#h
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_NorthEast FL_NorthEast
|
||||||
|
name: Home
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BUTTON
|
||||||
|
type: NORMAL_BUTTON
|
||||||
|
box: 340 160 90 30
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: User1|#1
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_NorthEast FL_NorthEast
|
||||||
|
name: User1
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BUTTON
|
||||||
|
type: NORMAL_BUTTON
|
||||||
|
box: 340 200 90 30
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: User2|#2
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_NorthEast FL_NorthEast
|
||||||
|
name: User2
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BUTTON
|
||||||
|
type: RETURN_BUTTON
|
||||||
|
box: 220 340 100 30
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: OK
|
||||||
|
shortcut: ^M
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
|
name: Ready
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BUTTON
|
||||||
|
type: NORMAL_BUTTON
|
||||||
|
box: 330 340 100 30
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Cancel|^[
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
|
name: Cancel
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_TIMER
|
||||||
|
type: HIDDEN_TIMER
|
||||||
|
box: 10 350 20 20
|
||||||
|
boxtype: FL_DOWN_BOX
|
||||||
|
colors: FL_COL1 FL_RED
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_DEFAULT_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label:
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_SouthWest FL_SouthWest
|
||||||
|
name: timer
|
||||||
|
callback:
|
||||||
|
argument:
|
||||||
|
|
||||||
|
==============================
|
||||||
|
--------------------
|
@ -24,6 +24,7 @@ SRCS := form_bibitem.fd \
|
|||||||
form_copyright.fd \
|
form_copyright.fd \
|
||||||
form_document.fd \
|
form_document.fd \
|
||||||
form_error.fd \
|
form_error.fd \
|
||||||
|
form_filedialog.fd \
|
||||||
form_graphics.fd \
|
form_graphics.fd \
|
||||||
form_include.fd \
|
form_include.fd \
|
||||||
form_index.fd \
|
form_index.fd \
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
#ifdef __GNUG_
|
#ifdef __GNUG_
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "xforms_helpers.h"
|
#include "xforms_helpers.h"
|
||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
#include "filedlg.h" // LyXFileDlg
|
#include "frontends/FileDialog.h"
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "lyx_gui_misc.h" // WriteAlert
|
#include "lyx_gui_misc.h" // WriteAlert
|
||||||
@ -83,7 +83,7 @@ string formatted(string const & sin, int w, int size, int style)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const browseFile(string const & filename,
|
string const browseFile(LyXView * lv, string const & filename,
|
||||||
string const & title,
|
string const & title,
|
||||||
string const & pattern,
|
string const & pattern,
|
||||||
pair<string,string> const & dir1,
|
pair<string,string> const & dir1,
|
||||||
@ -92,43 +92,27 @@ string const browseFile(string const & filename,
|
|||||||
string lastPath = ".";
|
string lastPath = ".";
|
||||||
if (!filename.empty()) lastPath = OnlyPath(filename);
|
if (!filename.empty()) lastPath = OnlyPath(filename);
|
||||||
|
|
||||||
LyXFileDlg fileDlg;
|
FileDialog fileDlg(lv, title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
|
||||||
|
|
||||||
if (!dir1.second.empty()) {
|
FileDialog::Result result;
|
||||||
FileInfo fileInfo(dir1.second);
|
|
||||||
if (fileInfo.isOK() && fileInfo.isDir())
|
while (1) {
|
||||||
fileDlg.SetButton(0, _(dir1.first), dir1.second);
|
result = fileDlg.Select(lastPath, pattern, OnlyFilename(filename));
|
||||||
|
|
||||||
|
if (result.second.empty())
|
||||||
|
return result.second;
|
||||||
|
|
||||||
|
lastPath = OnlyPath(result.second);
|
||||||
|
|
||||||
|
if (result.second.find_first_of("#~$% ") == string::npos)
|
||||||
|
break;
|
||||||
|
|
||||||
|
WriteAlert(_("Filename can't contain any "
|
||||||
|
"of these characters:"),
|
||||||
|
_("space, '#', '~', '$' or '%'."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dir2.second.empty()) {
|
return result.second;
|
||||||
FileInfo fileInfo(dir2.second);
|
|
||||||
if (fileInfo.isOK() && fileInfo.isDir())
|
|
||||||
fileDlg.SetButton(1, _(dir2.first), dir2.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool error = false;
|
|
||||||
string buf;
|
|
||||||
do {
|
|
||||||
string p = fileDlg.Select(_(title),
|
|
||||||
lastPath,
|
|
||||||
pattern, OnlyFilename(filename));
|
|
||||||
|
|
||||||
if (p.empty()) return p;
|
|
||||||
|
|
||||||
lastPath = OnlyPath(p);
|
|
||||||
|
|
||||||
if (p.find_first_of("#~$% ") != string::npos) {
|
|
||||||
WriteAlert(_("Filename can't contain any "
|
|
||||||
"of these characters:"),
|
|
||||||
_("space, '#', '~', '$' or '%'."));
|
|
||||||
error = true;
|
|
||||||
} else {
|
|
||||||
error = false;
|
|
||||||
buf = p;
|
|
||||||
}
|
|
||||||
} while (error);
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,13 +16,15 @@ void setEnabled(FL_OBJECT *, bool enable);
|
|||||||
// Take a string and add breaks so that it fits into a desired label width, w
|
// Take a string and add breaks so that it fits into a desired label width, w
|
||||||
string formatted(string const &label, int w, int size, int style);
|
string formatted(string const &label, int w, int size, int style);
|
||||||
|
|
||||||
|
class LyXView;
|
||||||
|
|
||||||
/** Launch a file dialog and return the chosen file.
|
/** Launch a file dialog and return the chosen file.
|
||||||
filename: a suggested filename.
|
filename: a suggested filename.
|
||||||
title: the title of the dialog.
|
title: the title of the dialog.
|
||||||
pattern: *.ps etc.
|
pattern: *.ps etc.
|
||||||
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
||||||
*/
|
*/
|
||||||
string const browseFile(string const & filename,
|
string const browseFile(LyXView *lv, string const & filename,
|
||||||
string const & title,
|
string const & title,
|
||||||
string const & pattern,
|
string const & pattern,
|
||||||
std::pair<string,string> const & dir1,
|
std::pair<string,string> const & dir1,
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2001-03-06 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* insetexternal.C:
|
||||||
|
* figinset.C: use new File Dialog
|
||||||
|
|
||||||
2001-03-06 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
2001-03-06 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||||
|
|
||||||
* insettext.C: changes becuase of ParagraphParameters.
|
* insettext.C: changes becuase of ParagraphParameters.
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
@ -47,7 +48,7 @@
|
|||||||
#include "lyx.h"
|
#include "lyx.h"
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "filedlg.h"
|
#include "frontends/FileDialog.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "LyXView.h" // just because of form_main
|
#include "LyXView.h" // just because of form_main
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -80,6 +81,8 @@ using std::flush;
|
|||||||
using std::endl;
|
using std::endl;
|
||||||
using std::ostringstream;
|
using std::ostringstream;
|
||||||
using std::copy;
|
using std::copy;
|
||||||
|
using std::pair;
|
||||||
|
using std::make_pair;
|
||||||
|
|
||||||
extern BufferView * current_view;
|
extern BufferView * current_view;
|
||||||
extern FL_OBJECT * figinset_canvas;
|
extern FL_OBJECT * figinset_canvas;
|
||||||
@ -1931,7 +1934,6 @@ void InsetFig::BrowseFile()
|
|||||||
{
|
{
|
||||||
static string current_figure_path;
|
static string current_figure_path;
|
||||||
static int once = 0;
|
static int once = 0;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
|
||||||
if (lyxerr.debugging()) {
|
if (lyxerr.debugging()) {
|
||||||
lyxerr << "Filename: "
|
lyxerr << "Filename: "
|
||||||
@ -1956,23 +1958,21 @@ void InsetFig::BrowseFile()
|
|||||||
bufclip = AddName (system_lyxdir, "clipart");
|
bufclip = AddName (system_lyxdir, "clipart");
|
||||||
|
|
||||||
|
|
||||||
fileDlg.SetButton(0, _("Clipart"), bufclip);
|
FileDialog fileDlg(current_view->owner(), _("Select an EPS figure"),
|
||||||
fileDlg.SetButton(1, _("Document"), buf);
|
LFUN_SELECT_FILE_SYNC,
|
||||||
|
make_pair(string(_("Clip art")), string(bufclip)),
|
||||||
|
make_pair(string(_("Documents")), string(buf)));
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
do {
|
do {
|
||||||
ProhibitInput(current_view);
|
string const path = (once) ? current_figure_path : buf;
|
||||||
if (once) {
|
|
||||||
p = fileDlg.Select(_("EPS Figure"),
|
|
||||||
current_figure_path,
|
|
||||||
"*ps", string());
|
|
||||||
} else {
|
|
||||||
p = fileDlg.Select(_("EPS Figure"), buf,
|
|
||||||
"*ps", string());
|
|
||||||
}
|
|
||||||
AllowInput(current_view);
|
|
||||||
|
|
||||||
if (p.empty()) return;
|
FileDialog::Result result = fileDlg.Select(path, _("*ps| PostScript documents"));
|
||||||
|
|
||||||
|
string const p = result.second;
|
||||||
|
|
||||||
|
if (p.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
buf = MakeRelPath(p, buf2);
|
buf = MakeRelPath(p, buf2);
|
||||||
current_figure_path = OnlyPath(p);
|
current_figure_path = OnlyPath(p);
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "insetexternal.h"
|
#include "insetexternal.h"
|
||||||
#include "ExternalTemplate.h"
|
#include "ExternalTemplate.h"
|
||||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "filedlg.h"
|
#include "frontends/FileDialog.h"
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
@ -36,7 +37,8 @@ using SigC::slot;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
using std::pair;
|
||||||
|
using std::make_pair;
|
||||||
|
|
||||||
InsetExternal::InsetExternal()
|
InsetExternal::InsetExternal()
|
||||||
: form_external(0)
|
: form_external(0)
|
||||||
@ -128,7 +130,6 @@ void InsetExternal::browseCB(FL_OBJECT * ob, long)
|
|||||||
|
|
||||||
static string current_path;
|
static string current_path;
|
||||||
static int once = 0;
|
static int once = 0;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
|
||||||
string p = inset->filename;
|
string p = inset->filename;
|
||||||
string buf = MakeAbsPath(holder->view->buffer()->fileName());
|
string buf = MakeAbsPath(holder->view->buffer()->fileName());
|
||||||
@ -140,7 +141,11 @@ void InsetExternal::browseCB(FL_OBJECT * ob, long)
|
|||||||
buf = OnlyPath(holder->view->buffer()->fileName());
|
buf = OnlyPath(holder->view->buffer()->fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
fileDlg.SetButton(0, _("Document"), buf);
|
FileDialog fileDlg(holder->view->owner(), _("Select external file"),
|
||||||
|
LFUN_SELECT_FILE_SYNC,
|
||||||
|
make_pair(string(_("Document")), string(buf)));
|
||||||
|
|
||||||
|
// FIXME: should have "nice name" for file type e.g. "Xfig files"
|
||||||
|
|
||||||
/// Determine the template file extension
|
/// Determine the template file extension
|
||||||
ExternalTemplate et = inset->getTemplate(inset->getCurrentTemplate());
|
ExternalTemplate et = inset->getTemplate(inset->getCurrentTemplate());
|
||||||
@ -149,18 +154,17 @@ void InsetExternal::browseCB(FL_OBJECT * ob, long)
|
|||||||
regexp = "*";
|
regexp = "*";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
regexp += "|";
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
do {
|
do {
|
||||||
if (once) {
|
string const path = (once) ? current_path : buf;
|
||||||
p = fileDlg.Select(_("External inset file"),
|
FileDialog::Result result = fileDlg.Select(path, regexp);
|
||||||
current_path,
|
|
||||||
regexp, string());
|
|
||||||
} else {
|
|
||||||
p = fileDlg.Select(_("External inset file"), buf,
|
|
||||||
regexp, string());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.empty()) return;
|
if (result.second.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
string p = result.second;
|
||||||
|
|
||||||
buf = MakeRelPath(p, buf2);
|
buf = MakeRelPath(p, buf2);
|
||||||
current_path = OnlyPath(p);
|
current_path = OnlyPath(p);
|
||||||
|
119
src/lyx_cb.C
119
src/lyx_cb.C
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
@ -24,7 +25,7 @@
|
|||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "combox.h"
|
#include "combox.h"
|
||||||
#include "bufferlist.h"
|
#include "bufferlist.h"
|
||||||
#include "filedlg.h"
|
#include "frontends/FileDialog.h"
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "lastfiles.h"
|
#include "lastfiles.h"
|
||||||
@ -44,6 +45,7 @@ using std::cout;
|
|||||||
using std::ios;
|
using std::ios;
|
||||||
using std::istream_iterator;
|
using std::istream_iterator;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
|
using std::make_pair;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::sort;
|
using std::sort;
|
||||||
using std::equal;
|
using std::equal;
|
||||||
@ -146,103 +148,102 @@ void ShowMessage(Buffer const * buf,
|
|||||||
//
|
//
|
||||||
// File menu
|
// File menu
|
||||||
//
|
//
|
||||||
|
|
||||||
// should be moved to lyxfunc.C
|
// should be moved to lyxfunc.C
|
||||||
bool MenuWrite(BufferView * bv, Buffer * buffer)
|
bool MenuWrite(BufferView * bv, Buffer * buffer)
|
||||||
{
|
{
|
||||||
|
// FIXME: needed ?
|
||||||
XFlush(fl_get_display());
|
XFlush(fl_get_display());
|
||||||
|
|
||||||
if (!buffer->save()) {
|
if (!buffer->save()) {
|
||||||
string const fname = buffer->fileName();
|
string const fname = buffer->fileName();
|
||||||
string const s = MakeAbsPath(fname);
|
string const s = MakeAbsPath(fname);
|
||||||
if (AskQuestion(_("Save failed. Rename and try again?"),
|
if (AskQuestion(_("Save failed. Rename and try again?"),
|
||||||
MakeDisplayPath(s, 50),
|
MakeDisplayPath(s, 50),
|
||||||
_("(If not, document is not saved.)"))) {
|
_("(If not, document is not saved.)"))) {
|
||||||
return MenuWriteAs(bv, buffer);
|
return WriteAs(bv, buffer);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else
|
||||||
lastfiles->newFile(buffer->fileName());
|
lastfiles->newFile(buffer->fileName());
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// should be moved to BufferView.C
|
// should be moved to BufferView.C
|
||||||
// Half of this func should be in LyXView, the rest in BufferView.
|
// Half of this func should be in LyXView, the rest in BufferView.
|
||||||
bool MenuWriteAs(BufferView * bv, Buffer * buffer)
|
bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
|
||||||
{
|
{
|
||||||
// Why do we require BufferView::text to be able to write a
|
|
||||||
// document? I see no point in that. (Lgb)
|
|
||||||
//if (!bv->text) return;
|
|
||||||
|
|
||||||
string fname = buffer->fileName();
|
string fname = buffer->fileName();
|
||||||
string oldname = fname;
|
string oldname = fname;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
|
||||||
ProhibitInput(bv);
|
if (filename.empty()) {
|
||||||
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
|
|
||||||
fileDlg.SetButton(1, _("Templates"), lyxrc.template_path);
|
|
||||||
|
|
||||||
if (!IsLyXFilename(fname))
|
FileDialog fileDlg(bv->owner(), _("Choose a filename to save document as"),
|
||||||
fname += ".lyx";
|
LFUN_WRITEAS,
|
||||||
|
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||||
|
make_pair(string(_("Templates")), string(lyxrc.template_path)));
|
||||||
|
|
||||||
fname = fileDlg.Select(_("Enter Filename to Save Document as"),
|
if (!IsLyXFilename(fname))
|
||||||
OnlyPath(fname),
|
fname += ".lyx";
|
||||||
"*.lyx",
|
|
||||||
OnlyFilename(fname));
|
|
||||||
|
|
||||||
AllowInput(bv);
|
FileDialog::Result result = fileDlg.Select(OnlyPath(fname), _("*.lyx|LyX Documents (*.lyx)"), OnlyFilename(fname));
|
||||||
|
|
||||||
if (fname.empty())
|
if (result.first == FileDialog::Later)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
fname = result.second;
|
||||||
|
|
||||||
|
if (fname.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Make sure the absolute filename ends with appropriate suffix
|
||||||
|
fname = MakeAbsPath(fname);
|
||||||
|
if (!IsLyXFilename(fname))
|
||||||
|
fname += ".lyx";
|
||||||
|
} else
|
||||||
|
fname = filename;
|
||||||
|
|
||||||
// Make sure the absolute filename ends with appropriate suffix
|
|
||||||
string s = MakeAbsPath(fname);
|
|
||||||
if (!IsLyXFilename(s))
|
|
||||||
s += ".lyx";
|
|
||||||
|
|
||||||
// Same name as we have already?
|
// Same name as we have already?
|
||||||
if (!buffer->isUnnamed() && s == oldname) {
|
if (!buffer->isUnnamed() && fname == oldname) {
|
||||||
if (!AskQuestion(_("Same name as document already has:"),
|
if (!AskQuestion(_("Same name as document already has:"),
|
||||||
MakeDisplayPath(s, 50),
|
MakeDisplayPath(fname, 50),
|
||||||
_("Save anyway?")))
|
_("Save anyway?")))
|
||||||
return false;
|
return false;
|
||||||
// Falls through to name change and save
|
// Falls through to name change and save
|
||||||
}
|
}
|
||||||
// No, but do we have another file with this name open?
|
// No, but do we have another file with this name open?
|
||||||
else if (!buffer->isUnnamed() && bufferlist.exists(s)) {
|
else if (!buffer->isUnnamed() && bufferlist.exists(fname)) {
|
||||||
if (AskQuestion(_("Another document with same name open!"),
|
if (AskQuestion(_("Another document with same name open!"),
|
||||||
MakeDisplayPath(s, 50),
|
MakeDisplayPath(fname, 50),
|
||||||
_("Replace with current document?")))
|
_("Replace with current document?")))
|
||||||
{
|
{
|
||||||
bufferlist.close(bufferlist.getBuffer(s));
|
bufferlist.close(bufferlist.getBuffer(fname));
|
||||||
|
|
||||||
// Ok, change the name of the buffer, but don't save!
|
// Ok, change the name of the buffer, but don't save!
|
||||||
buffer->setFileName(s);
|
buffer->setFileName(fname);
|
||||||
buffer->markDirty();
|
buffer->markDirty();
|
||||||
|
|
||||||
ShowMessage(buffer, _("Document renamed to '"),
|
ShowMessage(buffer, _("Document renamed to '"),
|
||||||
MakeDisplayPath(s), _("', but not saved..."));
|
MakeDisplayPath(fname), _("', but not saved..."));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} // Check whether the file exists
|
} // Check whether the file exists
|
||||||
else {
|
else {
|
||||||
FileInfo const myfile(s);
|
FileInfo const myfile(fname);
|
||||||
if (myfile.isOK() && !AskQuestion(_("Document already exists:"),
|
if (myfile.isOK() && !AskQuestion(_("Document already exists:"),
|
||||||
MakeDisplayPath(s, 50),
|
MakeDisplayPath(fname, 50),
|
||||||
_("Replace file?")))
|
_("Replace file?")))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok, change the name of the buffer
|
// Ok, change the name of the buffer
|
||||||
buffer->setFileName(s);
|
buffer->setFileName(fname);
|
||||||
buffer->markDirty();
|
buffer->markDirty();
|
||||||
bool unnamed = buffer->isUnnamed();
|
bool unnamed = buffer->isUnnamed();
|
||||||
buffer->setUnnamed(false);
|
buffer->setUnnamed(false);
|
||||||
// And save
|
|
||||||
// Small bug: If the save fails, we have irreversible changed the name
|
|
||||||
// of the document.
|
|
||||||
// Hope this is fixed this way! (Jug)
|
|
||||||
if (!MenuWrite(bv, buffer)) {
|
if (!MenuWrite(bv, buffer)) {
|
||||||
buffer->setFileName(oldname);
|
buffer->setFileName(oldname);
|
||||||
buffer->setUnnamed(unnamed);
|
buffer->setUnnamed(unnamed);
|
||||||
@ -418,17 +419,23 @@ Buffer * NewLyxFile(string const & filename)
|
|||||||
void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
|
void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
|
||||||
{
|
{
|
||||||
string fname = f;
|
string fname = f;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
if (!bv->available())
|
||||||
if (!bv->available()) return;
|
return;
|
||||||
|
|
||||||
if (fname.empty()) {
|
if (fname.empty()) {
|
||||||
ProhibitInput(bv);
|
FileDialog fileDlg(bv->owner(), _("Select file to insert"),
|
||||||
fname = fileDlg.Select(_("File to Insert"),
|
(asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
|
||||||
bv->owner()->buffer()->filepath,
|
|
||||||
"*");
|
FileDialog::Result result = fileDlg.Select(bv->owner()->buffer()->filepath);
|
||||||
AllowInput(bv);
|
|
||||||
if (fname.empty()) return;
|
if (result.first == FileDialog::Later)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fname = result.second;
|
||||||
|
|
||||||
|
if (fname.empty())
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileInfo fi(fname);
|
FileInfo fi(fname);
|
||||||
@ -557,16 +564,6 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is _only_ used in Toolbar_pimpl.C, move it there and get rid of
|
|
||||||
// current_view. (Lgb)
|
|
||||||
void LayoutsCB(int sel, void *, Combox *)
|
|
||||||
{
|
|
||||||
string const tmp = tostr(sel);
|
|
||||||
current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
|
|
||||||
tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MenuLayoutSave(BufferView * bv)
|
void MenuLayoutSave(BufferView * bv)
|
||||||
{
|
{
|
||||||
if (!bv->available())
|
if (!bv->available())
|
||||||
|
@ -25,8 +25,8 @@ void ShowMessage(Buffer const * buf,
|
|||||||
string const & msg3 = string(), int delay = 6);
|
string const & msg3 = string(), int delay = 6);
|
||||||
///
|
///
|
||||||
bool MenuWrite(BufferView * bv, Buffer * buffer);
|
bool MenuWrite(BufferView * bv, Buffer * buffer);
|
||||||
///
|
/// write the given file, or ask if no name given
|
||||||
bool MenuWriteAs(BufferView * bv, Buffer * buffer);
|
bool WriteAs(BufferView * bv, Buffer * buffer, const string & filename = string());
|
||||||
///
|
///
|
||||||
int MenuRunChktex(Buffer * buffer);
|
int MenuRunChktex(Buffer * buffer);
|
||||||
///
|
///
|
||||||
@ -40,8 +40,6 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph);
|
|||||||
///
|
///
|
||||||
void MenuInsertLabel(BufferView * bv, string const & arg);
|
void MenuInsertLabel(BufferView * bv, string const & arg);
|
||||||
///
|
///
|
||||||
void LayoutsCB(int sel, void *, Combox *);
|
|
||||||
///
|
|
||||||
void MenuLayoutCharacter();
|
void MenuLayoutCharacter();
|
||||||
///
|
///
|
||||||
void MenuLayoutSave(BufferView * bv);
|
void MenuLayoutSave(BufferView * bv);
|
||||||
|
130
src/lyxfunc.C
130
src/lyxfunc.C
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <utility>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
@ -60,7 +62,6 @@
|
|||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "vspace.h"
|
#include "vspace.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "filedlg.h"
|
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
@ -76,6 +77,7 @@
|
|||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "WorkArea.h"
|
#include "WorkArea.h"
|
||||||
#include "bufferview_funcs.h"
|
#include "bufferview_funcs.h"
|
||||||
|
#include "frontends/FileDialog.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
#include "frontends/Toolbar.h"
|
#include "frontends/Toolbar.h"
|
||||||
#include "frontends/Menubar.h"
|
#include "frontends/Menubar.h"
|
||||||
@ -88,6 +90,7 @@
|
|||||||
#include "lyxfind.h"
|
#include "lyxfind.h"
|
||||||
|
|
||||||
using std::pair;
|
using std::pair;
|
||||||
|
using std::make_pair;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::find_if;
|
using std::find_if;
|
||||||
|
|
||||||
@ -692,6 +695,8 @@ string const LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert(action != LFUN_SELECT_FILE_SYNC);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
// --- Misc -------------------------------------------
|
// --- Misc -------------------------------------------
|
||||||
case LFUN_WORDFINDFORWARD :
|
case LFUN_WORDFINDFORWARD :
|
||||||
@ -793,10 +798,6 @@ string const LyXFunc::Dispatch(int ac,
|
|||||||
MenuNew(true);
|
MenuNew(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_MENUOPEN:
|
|
||||||
MenuOpen();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_CLOSEBUFFER:
|
case LFUN_CLOSEBUFFER:
|
||||||
CloseBuffer();
|
CloseBuffer();
|
||||||
break;
|
break;
|
||||||
@ -807,19 +808,12 @@ string const LyXFunc::Dispatch(int ac,
|
|||||||
MakeDisplayPath(owner->buffer()->fileName()),
|
MakeDisplayPath(owner->buffer()->fileName()),
|
||||||
"...");
|
"...");
|
||||||
MenuWrite(owner->view(), owner->buffer());
|
MenuWrite(owner->view(), owner->buffer());
|
||||||
//owner->getMiniBuffer()-> {
|
} else
|
||||||
// Set(_("Document saved as"),
|
WriteAs(owner->view(), owner->buffer());
|
||||||
// MakeDisplayPath(owner->buffer()->fileName()));
|
|
||||||
//} else {
|
|
||||||
//owner->getMiniBuffer()->Set(_("Save failed!"));
|
|
||||||
//}
|
|
||||||
} else {
|
|
||||||
MenuWriteAs(owner->view(), owner->buffer());
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_MENUWRITEAS:
|
case LFUN_WRITEAS:
|
||||||
MenuWriteAs(owner->view(), owner->buffer());
|
WriteAs(owner->view(), owner->buffer(), argument);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_MENURELOAD:
|
case LFUN_MENURELOAD:
|
||||||
@ -1114,7 +1108,7 @@ string const LyXFunc::Dispatch(int ac,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_FILE_OPEN:
|
case LFUN_FILE_OPEN:
|
||||||
owner->view()->buffer(bufferlist.loadLyXFile(argument));
|
Open(argument);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_LATEX_LOG:
|
case LFUN_LATEX_LOG:
|
||||||
@ -1146,11 +1140,7 @@ string const LyXFunc::Dispatch(int ac,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_LAYOUT_PARAGRAPH:
|
case LFUN_LAYOUT_PARAGRAPH:
|
||||||
#ifdef USE_OLD_PARAGRAPH_LAYOUT
|
|
||||||
MenuLayoutParagraph();
|
|
||||||
#else
|
|
||||||
owner->getDialogs()->showLayoutParagraph();
|
owner->getDialogs()->showLayoutParagraph();
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_LAYOUT_CHARACTER:
|
case LFUN_LAYOUT_CHARACTER:
|
||||||
@ -1537,7 +1527,6 @@ void LyXFunc::setupLocalKeymap()
|
|||||||
void LyXFunc::MenuNew(bool fromTemplate)
|
void LyXFunc::MenuNew(bool fromTemplate)
|
||||||
{
|
{
|
||||||
string initpath = lyxrc.document_path;
|
string initpath = lyxrc.document_path;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
|
||||||
if (owner->view()->available()) {
|
if (owner->view()->available()) {
|
||||||
string const trypath = owner->buffer()->filepath;
|
string const trypath = owner->buffer()->filepath;
|
||||||
@ -1550,14 +1539,14 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
|||||||
string s;
|
string s;
|
||||||
|
|
||||||
if (lyxrc.new_ask_filename) {
|
if (lyxrc.new_ask_filename) {
|
||||||
ProhibitInput(owner->view());
|
FileDialog fileDlg(owner, _("Enter filename for new document"),
|
||||||
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
|
LFUN_SELECT_FILE_SYNC,
|
||||||
fileDlg.SetButton(1, _("Templates"), lyxrc.template_path);
|
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||||
string fname = fileDlg.Select(_("Enter Filename for new document"),
|
make_pair(string(_("Templates")), string(lyxrc.template_path)));
|
||||||
initpath, "*.lyx", _("newfile"));
|
|
||||||
AllowInput(owner->view());
|
FileDialog::Result result = fileDlg.Select(initpath, _("*.lyx|LyX Documents (*.lyx)"), _("newfile"));
|
||||||
|
|
||||||
if (fname.empty()) {
|
if (result.second.empty()) {
|
||||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||||
lyxerr.debug() << "New Document Cancelled." << endl;
|
lyxerr.debug() << "New Document Cancelled." << endl;
|
||||||
return;
|
return;
|
||||||
@ -1565,7 +1554,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
|||||||
|
|
||||||
// get absolute path of file and make sure the filename ends
|
// get absolute path of file and make sure the filename ends
|
||||||
// with .lyx
|
// with .lyx
|
||||||
s = MakeAbsPath(fname);
|
s = MakeAbsPath(result.second);
|
||||||
if (!IsLyXFilename(s))
|
if (!IsLyXFilename(s))
|
||||||
s += ".lyx";
|
s += ".lyx";
|
||||||
|
|
||||||
@ -1624,12 +1613,20 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
|||||||
// The template stuff
|
// The template stuff
|
||||||
string templname;
|
string templname;
|
||||||
if (fromTemplate) {
|
if (fromTemplate) {
|
||||||
ProhibitInput(owner->view());
|
FileDialog fileDlg(owner, _("Select template file"),
|
||||||
string const fname = fileDlg.Select(_("Choose template"),
|
LFUN_SELECT_FILE_SYNC,
|
||||||
lyxrc.template_path,
|
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||||
"*.lyx");
|
make_pair(string(_("Templates")), string(lyxrc.template_path)));
|
||||||
AllowInput(owner->view());
|
|
||||||
if (fname.empty()) return;
|
FileDialog::Result result = fileDlg.Select(initpath, _("*.lyx|LyX Documents (*.lyx)"));
|
||||||
|
|
||||||
|
if (result.first == FileDialog::Later)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string const fname = result.second;
|
||||||
|
|
||||||
|
if (fname.empty())
|
||||||
|
return;
|
||||||
templname = fname;
|
templname = fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1639,10 +1636,9 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXFunc::MenuOpen()
|
void LyXFunc::Open(string const & fname)
|
||||||
{
|
{
|
||||||
string initpath = lyxrc.document_path;
|
string initpath = lyxrc.document_path;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
|
||||||
if (owner->view()->available()) {
|
if (owner->view()->available()) {
|
||||||
string const trypath = owner->buffer()->filepath;
|
string const trypath = owner->buffer()->filepath;
|
||||||
@ -1651,20 +1647,28 @@ void LyXFunc::MenuOpen()
|
|||||||
initpath = trypath;
|
initpath = trypath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// launches dialog
|
string filename;
|
||||||
ProhibitInput(owner->view());
|
|
||||||
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
|
|
||||||
fileDlg.SetButton(1, _("Examples"),
|
|
||||||
AddPath(system_lyxdir, "examples"));
|
|
||||||
string filename = fileDlg.Select(_("Select Document to Open"),
|
|
||||||
initpath, "*.lyx");
|
|
||||||
AllowInput(owner->view());
|
|
||||||
|
|
||||||
// check selected filename
|
if (fname.empty()) {
|
||||||
if (filename.empty()) {
|
FileDialog fileDlg(owner, _("Select document to open"),
|
||||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
LFUN_FILE_OPEN,
|
||||||
return;
|
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||||
}
|
make_pair(string(_("Examples")), string(AddPath(system_lyxdir, "examples"))));
|
||||||
|
|
||||||
|
FileDialog::Result result = fileDlg.Select(initpath, "*.lyx|LyX Documents (*.lyx)");
|
||||||
|
|
||||||
|
if (result.first == FileDialog::Later)
|
||||||
|
return;
|
||||||
|
|
||||||
|
filename = result.second;
|
||||||
|
|
||||||
|
// check selected filename
|
||||||
|
if (filename.empty()) {
|
||||||
|
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
filename = fname;
|
||||||
|
|
||||||
// get absolute path of file and make sure the filename ends
|
// get absolute path of file and make sure the filename ends
|
||||||
// with .lyx
|
// with .lyx
|
||||||
@ -1698,7 +1702,6 @@ void LyXFunc::doImport(string const & argument)
|
|||||||
|
|
||||||
if (filename.empty()) { // need user interaction
|
if (filename.empty()) { // need user interaction
|
||||||
string initpath = lyxrc.document_path;
|
string initpath = lyxrc.document_path;
|
||||||
LyXFileDlg fileDlg;
|
|
||||||
|
|
||||||
if (owner->view()->available()) {
|
if (owner->view()->available()) {
|
||||||
string const trypath = owner->buffer()->filepath;
|
string const trypath = owner->buffer()->filepath;
|
||||||
@ -1707,16 +1710,23 @@ void LyXFunc::doImport(string const & argument)
|
|||||||
initpath = trypath;
|
initpath = trypath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// launches dialog
|
|
||||||
ProhibitInput(owner->view());
|
|
||||||
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
|
|
||||||
fileDlg.SetButton(1, _("Examples"),
|
|
||||||
AddPath(system_lyxdir, "examples"));
|
|
||||||
string const text = _("Select ") + formats.PrettyName(format)
|
string const text = _("Select ") + formats.PrettyName(format)
|
||||||
+ _(" file to import");
|
+ _(" file to import");
|
||||||
string const extension = "*." + formats.Extension(format);
|
|
||||||
filename = fileDlg.Select(text, initpath, extension);
|
FileDialog fileDlg(owner, text,
|
||||||
AllowInput(owner->view());
|
LFUN_IMPORT,
|
||||||
|
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||||
|
make_pair(string(_("Examples")), string(AddPath(system_lyxdir, "examples"))));
|
||||||
|
|
||||||
|
string const extension = "*." + formats.Extension(format) + "| " +
|
||||||
|
formats.PrettyName(format) + " (*." + formats.Extension(format) + ")";
|
||||||
|
|
||||||
|
FileDialog::Result result = fileDlg.Select(initpath, extension);
|
||||||
|
|
||||||
|
if (result.first == FileDialog::Later)
|
||||||
|
return;
|
||||||
|
|
||||||
|
filename = result.second;
|
||||||
|
|
||||||
// check selected filename
|
// check selected filename
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
|
@ -118,7 +118,7 @@ private:
|
|||||||
void MenuNew(bool fromTemplate);
|
void MenuNew(bool fromTemplate);
|
||||||
|
|
||||||
///
|
///
|
||||||
void MenuOpen();
|
void Open(string const &);
|
||||||
|
|
||||||
///
|
///
|
||||||
void doImport(string const &);
|
void doImport(string const &);
|
||||||
|
Loading…
Reference in New Issue
Block a user