2001-03-15 18:21:56 +00:00
|
|
|
// -*- C++ -*-
|
2001-03-07 14:25:31 +00:00
|
|
|
/**
|
|
|
|
* \file FormFiledialog.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-10-07 18:44:17 +00:00
|
|
|
*
|
2001-03-07 14:25:31 +00:00
|
|
|
* \author unknown
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-03-07 14:25:31 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
#ifndef FORMFILEDIALOG_H
|
|
|
|
#define FORMFILEDIALOG_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-22 16:19:48 +00:00
|
|
|
#include "LString.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms_fwd.h"
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
|
|
#include "frontends/FileDialog.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <boost/signals/connection.hpp>
|
|
|
|
#include <boost/signals/trackable.hpp>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
class Dialogs;
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
/// DirEntry internal structure definition
|
|
|
|
class DirEntry {
|
1999-11-22 16:19:48 +00:00
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string name_;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string displayed_;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string ls_entry_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-09-09 22:02:19 +00:00
|
|
|
//extern "C" {
|
|
|
|
// void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
|
|
|
|
// void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
|
|
|
|
// int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
class FD_filedialog;
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
class FileDialog::Private : public boost::signals::trackable {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2002-07-02 19:23:10 +00:00
|
|
|
Private(Dialogs &);
|
2000-11-28 06:46:06 +00:00
|
|
|
///
|
2001-03-07 14:25:31 +00:00
|
|
|
~Private();
|
1999-11-22 16:19:48 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// sets file selector user button action
|
2001-03-07 14:25:31 +00:00
|
|
|
void SetButton(int iIndex, string const & pszName = string(),
|
1999-10-02 16:21:10 +00:00
|
|
|
string const & pszPath = string());
|
1999-09-27 18:44:28 +00:00
|
|
|
/// gets last dialog directory
|
2000-09-14 17:53:12 +00:00
|
|
|
string const GetDirectory() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// launches dialog and returns selected file
|
2000-09-14 17:53:12 +00:00
|
|
|
string const Select(string const & pszTitle = string(),
|
1999-10-02 16:21:10 +00:00
|
|
|
string const & pszPath = string(),
|
2001-03-07 14:25:31 +00:00
|
|
|
string const & pszMask = string(),
|
1999-10-02 16:21:10 +00:00
|
|
|
string const & pszSuggested = string());
|
2003-01-14 21:51:34 +00:00
|
|
|
/// launches dialog and returns selected directory
|
|
|
|
string const SelectDir(string const & pszTitle = string(),
|
|
|
|
string const & pszPath = string(),
|
|
|
|
string const & pszSuggested = string());
|
1999-09-27 18:44:28 +00:00
|
|
|
/// XForms objects callback (static)
|
|
|
|
static void FileDlgCB(FL_OBJECT *, long);
|
|
|
|
/// Callback for double click in list
|
|
|
|
static void DoubleClickCB(FL_OBJECT *, long);
|
1999-10-25 14:18:30 +00:00
|
|
|
/// Handle Cancel CB from WM close
|
|
|
|
static int CancelCB(FL_FORM *, void *);
|
2001-03-07 14:25:31 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
1999-11-22 16:19:48 +00:00
|
|
|
/// data
|
2002-07-16 08:31:21 +00:00
|
|
|
static FD_filedialog * file_dlg_form_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
static FileDialog::Private * current_dlg_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2003-01-12 19:35:40 +00:00
|
|
|
static int minw_;
|
|
|
|
///
|
|
|
|
static int minh_;
|
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string user_path1_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string user_path2_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string directory_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string mask_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string file_name_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
int depth_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
int last_sel_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
long last_time_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
string info_line_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2001-03-07 14:25:31 +00:00
|
|
|
typedef std::vector<DirEntry> DirEntries;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
DirEntries dir_entries_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
bool force_cancel_;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2002-07-16 08:31:21 +00:00
|
|
|
bool force_ok_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-11-28 06:46:06 +00:00
|
|
|
/** Redraw the form (on receipt of a Signal indicating, for example,
|
|
|
|
that the xform colors have been re-mapped).
|
|
|
|
*/
|
|
|
|
void redraw();
|
1999-09-27 18:44:28 +00:00
|
|
|
/// updates dialog list to match class directory
|
|
|
|
void Reread();
|
|
|
|
/// sets dialog current directory
|
1999-10-02 16:21:10 +00:00
|
|
|
void SetDirectory(string const & pszPath);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// sets dialog file mask
|
1999-10-02 16:21:10 +00:00
|
|
|
void SetMask(string const & pszNewMask);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// sets dialog information line
|
1999-10-02 16:21:10 +00:00
|
|
|
void SetInfoLine(string const & pszLine);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// handle dialog during file selection
|
|
|
|
bool RunDialog();
|
|
|
|
/// Handle callback from list
|
|
|
|
void HandleListHit();
|
|
|
|
/// Handle double click from list
|
|
|
|
bool HandleDoubleClick();
|
|
|
|
/// Handle OK button call
|
|
|
|
bool HandleOK();
|
|
|
|
/// Simulates a click on OK/Cancel
|
|
|
|
void Force(bool);
|
2000-11-28 06:46:06 +00:00
|
|
|
/// Redraw connection.
|
2002-05-29 16:21:03 +00:00
|
|
|
boost::signals::connection r_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
#endif // FORMFILEDIALOG_H
|