]> git.lyx.org Git - features.git/commitdiff
The file dialog browser doesn't need a LyXView...
authorAngus Leeming <leeming@lyx.org>
Fri, 21 Feb 2003 12:22:25 +0000 (12:22 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 21 Feb 2003 12:22:25 +0000 (12:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6223 a592a061-630c-0410-9148-cb99ea01b6c8

23 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/frontends/ChangeLog
src/frontends/FileDialog.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlGraphics.C
src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlPrefs.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/helper_funcs.C
src/frontends/controllers/helper_funcs.h
src/frontends/gnome/ChangeLog
src/frontends/gnome/FileDialog.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/FileDialog.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FileDialog.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormFiledialog.h
src/lyx_cb.C
src/lyxfunc.C

index b974d55d478f30e40dbd7e5fb864654d41f87f50..734dcebeb6708d60851a1360ae6746e83d13c503 100644 (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)),
index 954c50d7d72f223bcaba970160a443575a5d18b1..ca3329bcba5b43b2c932f4a0f33cd0991d12975e 100644 (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.
index a95b92dea16e7fc2cfe64fa93da8d79c08806fcc..10084e01465ab9620a61ab44eb8616917ded8f26 100644 (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)
index 06397a848e81246877aaa6be3c062824a3e5e757..6355bd39cf39c014dd1c648986a2c91d06b1c72d 100644 (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_;
 
index ab544de3b28ec69e4eb632d625259f41db138b2c..3e6ee386ce894096750374784dc8526b7ae1ebf6 100644 (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
index 4fb819857ea2978b86444995d7b24b157d017857..e29ff0bc2019c6d0f55e90cf8a970acfee4287fa 100644 (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);
 }
 
index 07d5d3e6bb5e17ae2645bd68bfffa0de7b2e4d4c..3572b00320260cfe543d22ec160b79eb5b335430 100644 (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);
 }
index ba9d275790212e9cf625667d5f653b331c3051ad..146980e0ca4a60f56c44ffbf910a63cf90650bfa 100644 (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);
 }
 
index 2530b7b7f374163464bd64750c6ad4582dba4731..4e6282c677ef642f19e88ee604471fc3ef28c135 100644 (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);
 }
 
 
index ec142632d00133d14a3489175290f8a7a6160418..74888b16d4f4cfe38d6474ee5a11465e57697e53 100644 (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);
 }
 
 
index 7ad3d926a3042ba3cfa503662de1e750fecacf56..d6fb50274900e31c3fa843d3ce2b60303fa0e71c 100644 (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);
 }
 
index 4d3f6e683e764541387968b2bc2af1297dc2ee43..34ac0f1207a9a156061d489d7cd1f5c9a26cc61d 100644 (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;
 
index 556595482fed6ccf9d1a608db0f239e521b93a20..6288ef1eead1ecbf3552ecbe372f99702b7fe33f 100644 (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()),
index 1ae6db7cbc0d9e1310c0b3f1a4168e893d6ee8cc..9b33c9939fe7b804fbb2ff9a5c4301a2ad4cf3c7 100644 (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()
index c9c2a653803f2c1eeacba1681d686e3369712cfe..f8494d0389249427e5857fe848c6ccc213ac95b8 100644 (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);
 }
index 09336bbd690895dffc540f6ab186ff7f389d5625..8a192aefcd18e3b808d39e41ad17ca25e0679815 100644 (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:
index a5a5ba95f1c417221aaf464b29dc07ae86551439..50c531c77f290753cb561c7ed78e241dd5339c9d 100644 (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;
-}
\ No newline at end of file
+}
index 6bb61d7fab877224a69fae4a3b8f32a9424c7f89..8605a20ed5fa50f5fc36806a2d2130f13479ee8e 100644 (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:
index 0cb76e10c0e14aa3eb2c88747e65100d3f089e70..807476c1915099ec5178c62f5cd9d5e1ad8e0bd9 100644 (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);
index 2fea4dae905af39446da34f631d0b26e680bfb1b..0e9120de3eebb1a2cc0da3cadefeee22d678dfbb 100644 (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));
 }
 
 
index 6467603892037a695582eaec7ab4a0fe70e3c665..c670f3d05b9cfc2ce276bbfee3ba50559f23f727 100644 (file)
@@ -52,7 +52,7 @@ class FD_filedialog;
 class FileDialog::Private : public boost::signals::trackable {
 public:
        ///
-       Private(Dialogs &);
+       Private();
        ///
        ~Private();
 
index 4451fba912983340f8e14b289269b950b8ad3b54..e3578314111db3cc6f221767fdd4d4196ab0cddb 100644 (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());
index 9cdd982fab168cd1bbe1b17b3f894ccfa7f40d21..2b0a43513ad719c84fc1109c83a6b888a45c3ca0 100644 (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)),