1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
1999-11-15 12:01:38 +00:00
|
|
|
* ======================================================
|
1999-10-07 18:44:17 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2000-03-16 04:29:22 +00:00
|
|
|
* Copyright 1995-2000 The LyX Team.
|
1999-10-07 18:44:17 +00:00
|
|
|
*
|
1999-11-15 12:01:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
#ifndef FILEDLG_H
|
|
|
|
#define FILEDLG_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
1999-11-22 16:19:48 +00:00
|
|
|
#include <vector>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-22 16:19:48 +00:00
|
|
|
#include "LString.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
#include "form1.h"
|
|
|
|
|
|
|
|
/// LyXDirEntry internal structure definition
|
2000-08-07 20:58:24 +00:00
|
|
|
class LyXDirEntry {
|
1999-11-22 16:19:48 +00:00
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszName;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszDisplayed;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszLsEntry;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// FileDlg class definition
|
|
|
|
class LyXFileDlg
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
LyXFileDlg();
|
1999-11-22 16:19:48 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// sets file selector user button action
|
1999-10-02 16:21:10 +00:00
|
|
|
void SetButton(int iIndex, string const & pszName = string(),
|
|
|
|
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(),
|
|
|
|
string const & pszMask = 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 *);
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
1999-11-22 16:19:48 +00:00
|
|
|
/// data
|
|
|
|
static FD_FileDlg * pFileDlgForm;
|
|
|
|
///
|
|
|
|
static LyXFileDlg * pCurrentDlg;
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszUserPath1;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszUserPath2;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszDirectory;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszMask;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszFileName;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
int iDepth;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
int iLastSel;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
long lLastTime;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pszInfoLine;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::vector<LyXDirEntry> DirEntries;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
|
|
|
DirEntries direntries;
|
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
bool force_cancel;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
bool force_ok;
|
|
|
|
|
|
|
|
/// 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);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|