string(AddPath(system_lyxdir, "examples"))));
FileDialog::Result result =
- fileDlg.Select(initpath,
+ fileDlg.open(initpath,
_("*.lyx| LyX Documents (*.lyx)"));
if (result.first == FileDialog::Later)
+2002-11-17 John Levon <levon@movementarian.org>
+
+ * BufferView_pimpl.C:
+ * lyx_cb.C:
+ * lyxfunc.C: split filedialog into open/save
+
2002-11-08 Juergen Vigna <jug@sad.it>
* undo_funcs.C (textHandleUndo): fixed problems with undo introduced
+2002-11-17 John Levon <levon@movementarian.org>
+
+ * FileDialog.h: split Select() into open()/save() for
+ benefit of Qt
+
2002-11-01 Herbert Voss <voss@perce.de>
* ControlGraphics.C: "Default" is now a part of the rotate-list
/**
* 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(),
+ * 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.
*
~FileDialog();
/**
- * Choose a file for selection, starting in directory \param
+ * Choose a file for opening, starting in directory \param
* path, with the file selection \param mask. The \param mask
* string is of the form :
*
*
* FIXME: should support multiple lines of these for different file types.
*/
- Result const Select(string const & path = string(),
+ Result const open(string const & path = string(),
+ string const & mask = string(),
+ string const & suggested = string());
+
+ /**
+ * Choose a file for saving, starting in directory \param
+ * path, with the file selection \param mask. The \param mask
+ * string is of the form :
+ *
+ * <glob to match> | <description>
+ *
+ * for example, "*.ps | PostScript files (*.ps)".
+ */
+ Result const save(string const & path = string(),
string const & mask = string(),
string const & suggested = string());
+2002-11-17 John Levon <levon@movementarian.org>
+
+ * helper_funcs.C and users: specify save/open in file dialog
+
2002-11-15 John Levon <levon@movementarian.org>
* ControlPrefs.h:
pair<string, string> dir1(_("Documents|#o#O"),
string(lyxrc.document_path));
return browseRelFile(&lv_, in_name, buffer()->filePath(),
- title, pattern, dir1);
+ title, pattern, false, dir1);
}
std::pair<string, string> dir1(N_("Documents|#o#O"),
string(lyxrc.document_path));
- return browseRelFile(&lv_, input, bufpath, title, pattern, dir1);
+ return browseRelFile(&lv_, input, bufpath, title, pattern, false, dir1);
}
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
// Show the file browser dialog
return browseRelFile(&lv_, in_name, buffer()->filePath(),
- title, "*.*", dir1, dir2);
+ title, "*.*", false, dir1, dir2);
}
string const docpath = OnlyPath(params().masterFilename_);
- return browseRelFile(&lv_, in_name, docpath, title, pattern, dir1);
+ return browseRelFile(&lv_, in_name, docpath, title, pattern, false, dir1);
}
name = _("User Bind|#U#u");
pair<string,string> dir2(name, dir);
- return browseFile(&lv_, file, _("Choose bind file"), "*.bind", dir1, dir2);
+ return browseFile(&lv_, file, _("Choose bind file"), "*.bind", false, dir1, dir2);
}
name = _("User UI|#U#u");
pair<string,string> dir2(name, dir);
- return browseFile(&lv_, file, _("Choose UI file"), "*.ui", dir1, dir2);
+ return browseFile(&lv_, file, _("Choose UI file"), "*.ui", false, dir1, dir2);
}
string const name = _("Key maps|#K#k");
pair<string, string> dir1(name, dir);
- return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", dir1);
+ return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", false, dir1);
}
string const ControlPrefs::browse(string const & file, string const & title)
{
- return browseFile(&lv_, file, title, "*");
+ return browseFile(&lv_, file, title, "*", true);
}
// Show the file browser dialog
return browseRelFile(&lv_, in_name, buffer()->filePath(),
- title, pattern);
+ title, pattern, true);
}
string const browseFile(LyXView * lv, string const & filename,
string const & title,
string const & pattern,
+ bool save,
pair<string,string> const & dir1,
pair<string,string> const & dir2)
{
FileDialog::Result result;
while (true) {
- result = fileDlg.Select(lastPath, pattern,
- OnlyFilename(filename));
+ if (save)
+ result = fileDlg.save(lastPath, pattern,
+ OnlyFilename(filename));
+ else
+ result = fileDlg.open(lastPath, pattern,
+ OnlyFilename(filename));
if (result.second.empty())
return result.second;
string const & refpath,
string const & title,
string const & pattern,
+ bool save = false,
pair<string,string> const & dir1,
pair<string,string> const & dir2)
{
string const fname = MakeAbsPath(filename, refpath);
- string const outname = browseFile(lv, fname, title, pattern,
+ string const outname = browseFile(lv, fname, title, pattern, save,
dir1, dir2);
string const reloutname = MakeRelPath(outname, refpath);
if (prefixIs(reloutname, "../"))
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
*/
string const
-browseFile(LyXView *lv, string const & filename,
+browseFile(LyXView * lv, string const & filename,
string const & title,
string const & pattern,
+ bool save = false,
std::pair<string,string> const & dir1 =
std::make_pair(string(), string()),
std::pair<string,string> const & dir2 =
intended to be useful for insets which encapsulate files/
*/
string const
-browseRelFile(LyXView *lv, string const & filename,
+browseRelFile(LyXView * lv, string const & filename,
string const & refpath,
string const & title,
string const & pattern,
+ bool save = false,
std::pair<string,string> const & dir1 =
std::make_pair(string(), string()),
std::pair<string,string> const & dir2 =
+2002-11-17 John Levon <levon@movementarian.org>
+
+ * FileDialog.C: split into open/save so open
+ no longer says "Save" !
+
2002-11-17 John Levon <levon@movementarian.org>
* QPrefsDialog.h:
}
-FileDialog::Result const FileDialog::Select(string const & path,
+FileDialog::Result const FileDialog::save(string const & path,
string const & mask,
string const & suggested)
{
if (!suggested.empty())
dlg.setSelection(suggested.c_str());
- // This code relies on DestructiveClose which is broken
- // in Qt < 3.0.5. So we just don't allow it for now.
- //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());
+ dlg.hide();
+ return result;
+}
+
+
+FileDialog::Result const FileDialog::open(string const & path,
+ string const & mask,
+ string const & suggested)
+{
+ string filter(mask);
+ if (mask.empty())
+ filter = _("*|All files");
+
+ LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
+ lyxerr[Debug::GUI] << "Select with path \"" << path
+ << "\", mask \"" << filter
+ << "\", suggested \"" << suggested << endl;
+
+ if (!suggested.empty())
+ dlg.setSelection(suggested.c_str());
FileDialog::Result result;
lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
result.second = string(dlg.selectedFile().data());
dlg.hide();
return result;
-#if 0
- dlg->show();
- return make_pair(FileDialog::Later, string());
-#endif
}
}
-// FIXME: we would like to highlight the new entry ... also user must
+// FIXME: user must
// specify unique from/to or it doesn't appear. This is really bad UI
void QPrefsDialog::new_converter()
{
form_->converters_.updateLast(form_->formats_);
}
updateConverters();
+ convertersModule->convertersLB->setCurrentItem(convertersModule->convertersLB->count() - 1);
}
<rect>
<x>0</x>
<y>0</y>
- <width>305</width>
+ <width>301</width>
<height>259</height>
</rect>
</property>
<name>caption</name>
<string>Colors</string>
</property>
- <grid>
+ <hbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
<name>spacing</name>
<number>6</number>
</property>
- <widget row="1" column="0" rowspan="2" colspan="1" >
- <class>QListBox</class>
- <item>
- <property>
- <name>text</name>
- <string>New Item</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>lyxObjectsLB</cstring>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>lyxObjectsLA</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>LyX &Objects:</string>
- </property>
- <property>
- <name>buddy</name>
- <cstring>lyxObjectsLB</cstring>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>colorChangePB</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Chan&ge Color...</string>
+ <cstring>Layout2</cstring>
</property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lyxObjectsLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Colors</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>lyxObjectsLB</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>New Item</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lyxObjectsLB</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>colorChangePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Alter ...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
</widget>
- <spacer row="2" column="1" >
+ <spacer>
<property>
<name>name</name>
- <cstring>Spacer6</cstring>
+ <cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
- <enum>Vertical</enum>
+ <enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
</size>
</property>
</spacer>
- </grid>
+ </hbox>
</widget>
</UI>
+2002-11-17 John Levon <levon@movementarian.org>
+
+ * FileDialog.C: open/save name change
+
2002-11-15 John Levon <levon@movementarian.org>
* Dialogs2.C:
}
-FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
+FileDialog::Result const FileDialog::save(string const & path, string const & mask, string const & suggested)
+{
+ open(path, mask, suggested);
+}
+
+
+FileDialog::Result const FileDialog::open(string const & path, string const & mask, string const & suggested)
{
string filter = mask;
filter = mask;
}
- lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << "\"" << endl;
+ lyxerr[Debug::GUI] << "filedialog open with path \"" << path << "\", mask \""
+ << filter << "\", suggested \"" << suggested << "\"" << endl;
// no support for asynchronous selection yet
fname += ".lyx";
FileDialog::Result result =
- fileDlg.Select(OnlyPath(fname),
+ fileDlg.save(OnlyPath(fname),
_("*.lyx|LyX Documents (*.lyx)"),
OnlyFilename(fname));
FileDialog fileDlg(bv->owner(), _("Select file to insert"),
(asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
- FileDialog::Result result = fileDlg.Select(bv->owner()->buffer()->filePath());
+ FileDialog::Result result = fileDlg.open(bv->owner()->buffer()->filePath());
if (result.first == FileDialog::Later)
return string();
string(lyxrc.template_path)));
FileDialog::Result result =
- fileDlg.Select(lyxrc.template_path,
+ fileDlg.open(lyxrc.template_path,
_("*.lyx|LyX Documents (*.lyx)"));
if (result.first == FileDialog::Later)
string(AddPath(system_lyxdir, "examples"))));
FileDialog::Result result =
- fileDlg.Select(initpath,
+ fileDlg.open(initpath,
"*.lyx|LyX Documents (*.lyx)");
if (result.first == FileDialog::Later)
+ "| " + formats.prettyName(format)
+ " (*." + formats.extension(format) + ")";
- FileDialog::Result result = fileDlg.Select(initpath,
+ FileDialog::Result result = fileDlg.open(initpath,
extension);
if (result.first == FileDialog::Later)