The file dialog browser doesn't need a LyXView...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6223 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-02-21 12:22:25 +00:00
parent 12b3e1818e
commit 80db139a76
23 changed files with 80 additions and 50 deletions

View File

@ -872,8 +872,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
initpath = trypath;
}
FileDialog fileDlg(bv_->owner(),
_("Select LyX document to insert"),
FileDialog fileDlg(_("Select LyX document to insert"),
LFUN_FILE_INSERT,
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),

View File

@ -1,3 +1,10 @@
2003-02-21 Angus Leeming <leeming@lyx.org>
* BufferView_pimpl.C (MenuInsertLyXFile):
* lyx_cb.C (WriteAs, getContentsOfAsciiFile):
* lyxfunc.C (menuNew, open, doImport):
no longer pass a LyXView & to fileDlg.
2003-02-21 Angus Leeming <leeming@lyx.org>
* BufferView_pimpl.C: replace insetbib.h with insetbibtex.h.

View File

@ -2,6 +2,9 @@
* Dialogs.h: remove forward declarations of InsetBibKey, InsetBibtex.
* FileDialog.h: don't pass LyXView to the c-tor.
Don't store a LyXView &.
2003-02-14 John Levon <levon@movementarian.org>
* LyXView.h: prohibit/allowInput() -> busy(bool)

View File

@ -20,8 +20,6 @@
#include "LString.h"
class LyXView;
/**
* \class FileDialog
* \brief GUI-I definition of file dialog interface
@ -42,9 +40,9 @@ public:
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 open(),
* Constructs a file dialog with title \param title.
* If \param a is \const LFUN_SELECT_FILE_SYNC then a value
* will be returned immediately upon performing a open(),
* otherwise a callback Dispatch() will be invoked with the filename as
* argument, of action \param a.
*
@ -52,7 +50,7 @@ public:
* additional directories in the navigation (an empty
* directory is interpreted as getcwd())
*/
FileDialog(LyXView * lv, string const & title,
FileDialog(string const & title,
kb_action a = LFUN_SELECT_FILE_SYNC,
Button b1 = Button(string(), string()),
Button b2 = Button(string(), string()));
@ -104,9 +102,6 @@ public:
Private * private_;
private:
/// our LyXView
LyXView * lv_;
/// the dialog title
string title_;

View File

@ -1,3 +1,16 @@
2003-02-21 Angus Leeming <leeming@lyx.org>
* ControlBibtex.C (Browse):
* ControlExternal.C (Browse):
* ControlGraphics.C (Browse):
* ControlInclude.C (Browse):
* ControlPrefs.C (browsebind, browseUI, browsekbmap, browsedict,
browse, browsedir):
* ControlPrint.C (Browse):
don't pass a LyXView & to browseFile et al.
* helper_funcs.[Ch] (browseFile, browseRelFile, browseDir):
don't pass a LyXView & to fileDlg.
2003-02-17 John Levon <levon@movementarian.org>
* ControlDialog.tmpl: build dialog before calling setParams

View File

@ -59,7 +59,7 @@ string const ControlBibtex::Browse(string const & in_name,
{
pair<string, string> dir1(_("Documents|#o#O"),
string(lyxrc.document_path));
return browseRelFile(&lv_, in_name, buffer()->filePath(),
return browseRelFile(in_name, buffer()->filePath(),
title, pattern, false, dir1);
}

View File

@ -151,5 +151,5 @@ string const ControlExternal::Browse(string const & input) const
std::pair<string, string> dir1(N_("Documents|#o#O"),
string(lyxrc.document_path));
return browseRelFile(&lv_, input, bufpath, title, pattern, false, dir1);
return browseRelFile(input, bufpath, title, pattern, false, dir1);
}

View File

@ -89,7 +89,7 @@ string const ControlGraphics::Browse(string const & in_name)
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
// Show the file browser dialog
return browseRelFile(&lv_, in_name, buffer()->filePath(),
return browseRelFile(in_name, buffer()->filePath(),
title, "*.*", false, dir1, dir2);
}

View File

@ -69,7 +69,7 @@ string const ControlInclude::Browse(string const & in_name, Type in_type)
string const docpath = OnlyPath(params().masterFilename_);
return browseRelFile(&lv_, in_name, docpath, title, pattern, false, dir1);
return browseRelFile(in_name, docpath, title, pattern, false, dir1);
}

View File

@ -69,7 +69,7 @@ string const ControlPrefs::browsebind(string const & file)
name = _("User Bind|#U#u");
pair<string,string> dir2(name, dir);
return browseFile(&lv_, file, _("Choose bind file"), "*.bind", false, dir1, dir2);
return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
}
@ -85,7 +85,7 @@ string const ControlPrefs::browseUI(string const & file)
name = _("User UI|#U#u");
pair<string,string> dir2(name, dir);
return browseFile(&lv_, file, _("Choose UI file"), "*.ui", false, dir1, dir2);
return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
}
@ -95,25 +95,25 @@ string const ControlPrefs::browsekbmap(string const & file)
string const name = _("Key maps|#K#k");
pair<string, string> dir1(name, dir);
return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", false, dir1);
return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
}
string const ControlPrefs::browsedict(string const & file)
{
return browseFile(&lv_, file, _("Choose personal dictionary"), "*.ispell");
return browseFile(file, _("Choose personal dictionary"), "*.ispell");
}
string const ControlPrefs::browse(string const & file, string const & title)
{
return browseFile(&lv_, file, title, "*", true);
return browseFile(file, title, "*", true);
}
string const ControlPrefs::browsedir(string const & path, string const & title)
{
return browseDir(&lv_, path, title);
return browseDir(path, title);
}

View File

@ -76,7 +76,7 @@ string const ControlPrint::Browse(string const & in_name)
string const pattern = "*.ps";
// Show the file browser dialog
return browseRelFile(&lv_, in_name, buffer()->filePath(),
return browseRelFile(in_name, buffer()->filePath(),
title, pattern, true);
}

View File

@ -26,7 +26,7 @@ using std::vector;
using std::make_pair;
string const browseFile(LyXView * lv, string const & filename,
string const browseFile(string const & filename,
string const & title,
string const & pattern,
bool save,
@ -37,7 +37,7 @@ string const browseFile(LyXView * lv, string const & filename,
if (!filename.empty())
lastPath = OnlyPath(filename);
FileDialog fileDlg(lv, title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
FileDialog fileDlg(title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
FileDialog::Result result;
@ -66,7 +66,7 @@ string const browseFile(LyXView * lv, string const & filename,
}
string const browseRelFile(LyXView * lv, string const & filename,
string const browseRelFile(string const & filename,
string const & refpath,
string const & title,
string const & pattern,
@ -76,7 +76,7 @@ string const browseRelFile(LyXView * lv, string const & filename,
{
string const fname = MakeAbsPath(filename, refpath);
string const outname = browseFile(lv, fname, title, pattern, save,
string const outname = browseFile(fname, title, pattern, save,
dir1, dir2);
string const reloutname = MakeRelPath(outname, refpath);
if (prefixIs(reloutname, "../"))
@ -86,7 +86,7 @@ string const browseRelFile(LyXView * lv, string const & filename,
}
string const browseDir(LyXView * lv, string const & pathname,
string const browseDir(string const & pathname,
string const & title,
pair<string,string> const & dir1,
pair<string,string> const & dir2)
@ -95,7 +95,7 @@ string const browseDir(LyXView * lv, string const & pathname,
if (!pathname.empty())
lastPath = OnlyPath(pathname);
FileDialog fileDlg(lv, title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
FileDialog fileDlg(title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
FileDialog::Result result;

View File

@ -18,8 +18,6 @@
#include <utility> // pair
#include <vector> // pair
class LyXView;
/** Launch a file dialog and return the chosen file.
filename: a suggested filename.
title: the title of the dialog.
@ -27,7 +25,7 @@ class LyXView;
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
*/
string const
browseFile(LyXView * lv, string const & filename,
browseFile(string const & filename,
string const & title,
string const & pattern,
bool save = false,
@ -44,7 +42,7 @@ browseFile(LyXView * lv, string const & filename,
intended to be useful for insets which encapsulate files/
*/
string const
browseRelFile(LyXView * lv, string const & filename,
browseRelFile(string const & filename,
string const & refpath,
string const & title,
string const & pattern,
@ -61,7 +59,7 @@ browseRelFile(LyXView * lv, string const & filename,
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
*/
string const
browseDir(LyXView * lv, string const & pathname,
browseDir(string const & pathname,
string const & title,
std::pair<string,string> const & dir1 =
std::make_pair(string(), string()),

View File

@ -1,3 +1,7 @@
2003-02-21 Angus Leeming <leeming@lyx.org>
* FileDialog.C (FileDialog): no need for LyXView *.
2003-02-14 John Levon <levon@movementarian.org>
* FileDialog.C: remove spurious allow/prohibitInput()

View File

@ -72,10 +72,10 @@ void FileDialog::Private::button_clicked(bool canceled)
// FileDialog
FileDialog::FileDialog(LyXView * lv, string const & title, kb_action a,
FileDialog::FileDialog(string const & title, kb_action a,
Button /*b1*/, Button /*b2*/)
: private_(new Private(title))
, lv_(lv), title_(title), success_(a)
, title_(title), success_(a)
{
private_->set_modal(LFUN_SELECT_FILE_SYNC == a);
}

View File

@ -1,3 +1,7 @@
2003-02-21 Angus Leeming <leeming@lyx.org>
* FileDialog.C (FileDialog): no need for LyXView *.
2003-02-17 John Levon <levon@movementarian.org>
* QSpellchecker.h:

View File

@ -34,9 +34,9 @@ struct FileDialog::Private {
};
FileDialog::FileDialog(LyXView * lv, string const & t,
FileDialog::FileDialog(string const & t,
kb_action s, Button b1, Button b2)
: private_(new FileDialog::Private), lv_(lv), title_(t), success_(s)
: private_(new FileDialog::Private), title_(t), success_(s)
{
private_->b1 = b1;
private_->b2 = b2;
@ -130,4 +130,4 @@ FileDialog::Result const FileDialog::opendir(string const & path,
result.second = string(dlg.selectedFile().data());
dlg.hide();
return result;
}
}

View File

@ -1,3 +1,11 @@
2003-02-21 Angus Leeming <leeming@lyx.org>
* FileFialog.C (c-tor): no longer receives a LyXView &, nor passes
it to the Provate c-tor.
* FormFiledialog.[Ch] (c-tor): no longer receives a LyXView &.
Dialogs::redrawGUI is a static member, so can reference it without
a specific instance.
2003-02-17 John Levon <levon@movementarian.org>
* FormSpellchecker.h:

View File

@ -26,10 +26,10 @@ 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)
FileDialog::FileDialog(string const &t, kb_action s, Button b1, Button b2)
: private_(0), title_(t), success_(s)
{
private_ = new FileDialog::Private(lv->getDialogs());
private_ = new FileDialog::Private();
private_->SetButton(0, b1.first, b1.second);
private_->SetButton(1, b2.first, b2.second);

View File

@ -381,7 +381,7 @@ void FileDialog::Private::SetInfoLine(string const & line)
}
FileDialog::Private::Private(Dialogs & dia)
FileDialog::Private::Private()
{
directory_ = MakeAbsPath(string("."));
mask_ = '*';
@ -420,7 +420,7 @@ FileDialog::Private::Private(Dialogs & dia)
fl_hide_object(file_dlg_form_->User1);
fl_hide_object(file_dlg_form_->User2);
r_ = dia.redrawGUI().connect(boost::bind(&FileDialog::Private::redraw, this));
r_ = Dialogs::redrawGUI().connect(boost::bind(&FileDialog::Private::redraw, this));
}

View File

@ -52,7 +52,7 @@ class FD_filedialog;
class FileDialog::Private : public boost::signals::trackable {
public:
///
Private(Dialogs &);
Private();
///
~Private();

View File

@ -104,8 +104,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
if (filename.empty()) {
FileDialog fileDlg(bv->owner(),
_("Choose a filename to save document as"),
FileDialog fileDlg(_("Choose a filename to save document as"),
LFUN_WRITEAS,
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
@ -420,7 +419,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
string fname = f;
if (fname.empty()) {
FileDialog fileDlg(bv->owner(), _("Select file to insert"),
FileDialog fileDlg(_("Select file to insert"),
(asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
FileDialog::Result result = fileDlg.open(bv->owner()->buffer()->filePath());

View File

@ -1644,7 +1644,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
// The template stuff
string templname;
if (fromTemplate) {
FileDialog fileDlg(owner, _("Select template file"),
FileDialog fileDlg(_("Select template file"),
LFUN_SELECT_FILE_SYNC,
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
@ -1683,7 +1683,7 @@ void LyXFunc::open(string const & fname)
string filename;
if (fname.empty()) {
FileDialog fileDlg(owner, _("Select document to open"),
FileDialog fileDlg(_("Select document to open"),
LFUN_FILE_OPEN,
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
@ -1788,7 +1788,7 @@ void LyXFunc::doImport(string const & argument)
+ _(" file to import");;
#endif
FileDialog fileDlg(owner, text,
FileDialog fileDlg(text,
LFUN_IMPORT,
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),