mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
* First step towards default view format.
The icons could be replaced by something nicer. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29134 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
23f9e34a08
commit
25a14730ed
@ -1358,9 +1358,11 @@ lib_images_files = Split('''
|
||||
buffer-export_text.png
|
||||
buffer-new.png
|
||||
buffer-reload.png
|
||||
buffer-update.png
|
||||
buffer-update_dvi.png
|
||||
buffer-update_pdf2.png
|
||||
buffer-update_ps.png
|
||||
buffer-view.png
|
||||
buffer-view_dvi.png
|
||||
buffer-view_pdf2.png
|
||||
buffer-view_ps.png
|
||||
@ -1425,6 +1427,8 @@ lib_images_files = Split('''
|
||||
vc-register.png
|
||||
vc-revert.png
|
||||
marginalnote-insert.png
|
||||
master-buffer-update.png
|
||||
master-buffer-view.png
|
||||
math-display.png
|
||||
math-macro-add-greedy-optional-param.png
|
||||
math-macro-add-optional-param.png
|
||||
@ -1951,6 +1955,7 @@ lib_images_math_files = Split('''
|
||||
underset.png
|
||||
uparrow.png
|
||||
uparrow2.png
|
||||
update-others.png
|
||||
updownarrow.png
|
||||
updownarrow2.png
|
||||
upharpoonleft.png
|
||||
@ -1985,6 +1990,7 @@ lib_images_math_files = Split('''
|
||||
veebar.png
|
||||
vert.png
|
||||
vert2.png
|
||||
view-others.png
|
||||
vphantom.png
|
||||
wedge.png
|
||||
widehat.png
|
||||
|
@ -282,9 +282,11 @@ dist_images_DATA = \
|
||||
images/buffer-export_text.png \
|
||||
images/buffer-new.png \
|
||||
images/buffer-reload.png \
|
||||
images/buffer-update.png \
|
||||
images/buffer-update_dvi.png \
|
||||
images/buffer-update_pdf2.png \
|
||||
images/buffer-update_ps.png \
|
||||
images/buffer-view.png \
|
||||
images/buffer-view_dvi.png \
|
||||
images/buffer-view_pdf2.png \
|
||||
images/buffer-view_ps.png \
|
||||
@ -349,6 +351,8 @@ dist_images_DATA = \
|
||||
images/vc-register.png \
|
||||
images/vc-revert.png \
|
||||
images/marginalnote-insert.png \
|
||||
images/master-buffer-update.png \
|
||||
images/master-buffer-view.png \
|
||||
images/math-display.png \
|
||||
images/math-macro-add-greedy-optional-param.png \
|
||||
images/math-macro-add-optional-param.png \
|
||||
@ -868,6 +872,7 @@ dist_imagesmath_DATA = \
|
||||
images/math/underset.png \
|
||||
images/math/uparrow.png \
|
||||
images/math/uparrow2.png \
|
||||
images/math/update-others.png \
|
||||
images/math/updownarrow.png \
|
||||
images/math/updownarrow2.png \
|
||||
images/math/upharpoonleft.png \
|
||||
@ -902,6 +907,7 @@ dist_imagesmath_DATA = \
|
||||
images/math/veebar.png \
|
||||
images/math/vert.png \
|
||||
images/math/vert2.png \
|
||||
images/math/view-others.png \
|
||||
images/math/vphantom.png \
|
||||
images/math/wedge.png \
|
||||
images/math/widehat.png \
|
||||
|
BIN
lib/images/buffer-update.png
Normal file
BIN
lib/images/buffer-update.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
lib/images/buffer-view.png
Normal file
BIN
lib/images/buffer-view.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
lib/images/master-buffer-update.png
Normal file
BIN
lib/images/master-buffer-update.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
lib/images/master-buffer-view.png
Normal file
BIN
lib/images/master-buffer-view.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
lib/images/math/update-others.png
Normal file
BIN
lib/images/math/update-others.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
lib/images/math/view-others.png
Normal file
BIN
lib/images/math/view-others.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -297,11 +297,15 @@ Menuset
|
||||
Item "Fold Math Macro" "math-macro-fold"
|
||||
Separator
|
||||
Item "View Source|S" "dialog-toggle view-source"
|
||||
Submenu "Update|U" "view_update"
|
||||
ViewFormats
|
||||
Item "View|V" "buffer-view"
|
||||
Item "Update|U" "buffer-update"
|
||||
OptItem "View Master Document|M" "master-buffer-view"
|
||||
OptItem "Update Master Document|a" "master-buffer-update"
|
||||
Submenu "View (other formats)|f" "view_others"
|
||||
Submenu "Update (other formats)|p" "view_update"
|
||||
Separator
|
||||
Item "Split View Into Left And Right Half|i" "split-view horizontal"
|
||||
Item "Split View Into Upper And Lower Half|V" "split-view vertical"
|
||||
Item "Split View Into Upper And Lower Half|e" "split-view vertical"
|
||||
Item "Close Tab Group|G" "close-tab-group"
|
||||
Item "Fullscreen|l" "ui-toggle fullscreen"
|
||||
Submenu "Toolbars|b" "toolbars"
|
||||
@ -309,6 +313,10 @@ Menuset
|
||||
Documents
|
||||
End
|
||||
|
||||
Menu "view_others"
|
||||
ViewFormats
|
||||
End
|
||||
|
||||
Menu "view_update"
|
||||
UpdateFormats
|
||||
End
|
||||
|
@ -203,11 +203,24 @@ ToolbarSet
|
||||
End
|
||||
|
||||
Toolbar "view/update" "View/Update"
|
||||
Item "View" "buffer-view"
|
||||
Item "Update" "buffer-update"
|
||||
Item "View Master Document" "master-buffer-view"
|
||||
Item "Update Master Document" "master-buffer-update"
|
||||
Separator
|
||||
PopupMenu "view-others" "View Other Formats"
|
||||
PopupMenu "update-others" "Update Other Formats"
|
||||
End
|
||||
|
||||
Toolbar "view-others" "View Other Formats"
|
||||
Item "View DVI" "buffer-view dvi"
|
||||
Item "Update DVI" "buffer-update dvi"
|
||||
Item "View PDF (pdflatex)" "command-alternatives buffer-view pdf2;buffer-view pdf4"
|
||||
Item "Update PDF (pdflatex)" "command-alternatives buffer-update pdf2;buffer-view pdf4"
|
||||
Item "View PDF (pdflatex)" "buffer-view pdf2"
|
||||
Item "View PostScript" "buffer-view ps"
|
||||
End
|
||||
|
||||
Toolbar "update-others" "Update Other Formats"
|
||||
Item "Update DVI" "buffer-update dvi"
|
||||
Item "Update PDF (pdflatex)" "buffer-update pdf2"
|
||||
Item "Update PostScript" "buffer-update ps"
|
||||
End
|
||||
|
||||
|
@ -2652,6 +2652,21 @@ string Buffer::bufferFormat() const
|
||||
}
|
||||
|
||||
|
||||
string Buffer::getDefaultOutputFormat() const
|
||||
{
|
||||
typedef vector<Format const *> Formats;
|
||||
Formats formats = exportableFormats(true);
|
||||
if (isDocBook()
|
||||
|| isLiterate()
|
||||
|| params().useXetex
|
||||
|| params().encoding().package() == Encoding::japanese)
|
||||
// return the first we find
|
||||
return formats.front()->name();
|
||||
return lyxrc.default_view_format;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Buffer::doExport(string const & format, bool put_in_tempdir,
|
||||
string & result_file) const
|
||||
{
|
||||
|
@ -471,6 +471,8 @@ public:
|
||||
|
||||
/// return the format of the buffer on a string
|
||||
std::string bufferFormat() const;
|
||||
/// return the default output format of the current backend
|
||||
std::string getDefaultOutputFormat() const;
|
||||
|
||||
///
|
||||
bool doExport(std::string const & format, bool put_in_tempdir,
|
||||
|
@ -583,10 +583,17 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_UPDATE:
|
||||
case LFUN_BUFFER_VIEW:
|
||||
case LFUN_MASTER_BUFFER_UPDATE:
|
||||
case LFUN_MASTER_BUFFER_VIEW: {
|
||||
case LFUN_MASTER_BUFFER_VIEW:
|
||||
if (!buf->parent()) {
|
||||
enable = false;
|
||||
break;
|
||||
}
|
||||
case LFUN_BUFFER_UPDATE:
|
||||
case LFUN_BUFFER_VIEW: {
|
||||
string format = to_utf8(cmd.argument());
|
||||
if (cmd.argument().empty())
|
||||
format = buf->getDefaultOutputFormat();
|
||||
typedef vector<Format const *> Formats;
|
||||
Formats formats;
|
||||
formats = buf->exportableFormats(true);
|
||||
@ -594,7 +601,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
Formats::const_iterator end = formats.end();
|
||||
enable = false;
|
||||
for (; fit != end ; ++fit) {
|
||||
if ((*fit)->name() == to_utf8(cmd.argument()))
|
||||
if ((*fit)->name() == format)
|
||||
enable = true;
|
||||
}
|
||||
break;
|
||||
@ -867,25 +874,41 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_UPDATE:
|
||||
case LFUN_BUFFER_UPDATE: {
|
||||
LASSERT(lyx_view_ && buffer, /**/);
|
||||
buffer->doExport(argument, true);
|
||||
string format = argument;
|
||||
if (argument.empty())
|
||||
format = buffer->getDefaultOutputFormat();
|
||||
buffer->doExport(format, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_VIEW:
|
||||
case LFUN_BUFFER_VIEW: {
|
||||
LASSERT(lyx_view_ && buffer, /**/);
|
||||
buffer->preview(argument);
|
||||
string format = argument;
|
||||
if (argument.empty())
|
||||
format = buffer->getDefaultOutputFormat();
|
||||
buffer->preview(format);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MASTER_BUFFER_UPDATE:
|
||||
case LFUN_MASTER_BUFFER_UPDATE: {
|
||||
LASSERT(lyx_view_ && buffer && buffer->masterBuffer(), /**/);
|
||||
buffer->masterBuffer()->doExport(argument, true);
|
||||
string format = argument;
|
||||
if (argument.empty())
|
||||
format = buffer->masterBuffer()->getDefaultOutputFormat();
|
||||
buffer->masterBuffer()->doExport(format, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MASTER_BUFFER_VIEW:
|
||||
case LFUN_MASTER_BUFFER_VIEW: {
|
||||
LASSERT(lyx_view_ && buffer && buffer->masterBuffer(), /**/);
|
||||
buffer->masterBuffer()->preview(argument);
|
||||
string format = argument;
|
||||
if (argument.empty())
|
||||
format = buffer->masterBuffer()->getDefaultOutputFormat();
|
||||
buffer->masterBuffer()->preview(format);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BUILD_PROGRAM:
|
||||
LASSERT(lyx_view_ && buffer, /**/);
|
||||
@ -1874,6 +1897,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
||||
case LyXRC::RC_DEFAULT_LANGUAGE:
|
||||
case LyXRC::RC_GUI_LANGUAGE:
|
||||
case LyXRC::RC_DEFAULT_PAPERSIZE:
|
||||
case LyXRC::RC_DEFAULT_VIEW_FORMAT:
|
||||
case LyXRC::RC_DEFFILE:
|
||||
case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
|
||||
case LyXRC::RC_DISPLAY_GRAPHICS:
|
||||
|
@ -84,6 +84,7 @@ LexerKeyword lyxrcTags[] = {
|
||||
{ "\\def_file", LyXRC::RC_DEFFILE },
|
||||
{ "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
|
||||
{ "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
|
||||
{ "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
|
||||
{ "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
|
||||
{ "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
|
||||
{ "\\document_path", LyXRC::RC_DOCUMENTPATH },
|
||||
@ -227,6 +228,7 @@ void LyXRC::setDefaults()
|
||||
view_dvi_paper_option.erase();
|
||||
default_papersize = PAPER_DEFAULT;
|
||||
custom_export_format = "ps";
|
||||
default_view_format = "pdf2";
|
||||
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
|
||||
bibtex_command = "bibtex";
|
||||
fontenc = "default";
|
||||
@ -1017,6 +1019,10 @@ int LyXRC::read(Lexer & lexrc)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RC_DEFAULT_VIEW_FORMAT:
|
||||
lexrc >> default_view_format;
|
||||
break;
|
||||
|
||||
case RC_DEFAULT_LANGUAGE:
|
||||
lexrc >> default_language;
|
||||
break;
|
||||
@ -2389,6 +2395,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
<< "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_DEFAULT_VIEW_FORMAT:
|
||||
if (ignore_system_lyxrc ||
|
||||
default_view_format != system_lyxrc.default_view_format) {
|
||||
os << "\\default_view_format " << default_view_format << '\n';
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_VIEWER:
|
||||
// Ignore it
|
||||
if (tag != RC_LAST)
|
||||
@ -2554,6 +2567,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
||||
str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
|
||||
break;
|
||||
|
||||
case RC_DEFAULT_VIEW_FORMAT:
|
||||
str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
|
||||
break;
|
||||
|
||||
case RC_DEFAULT_LANGUAGE:
|
||||
str = _("New documents will be assigned this language.");
|
||||
break;
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
RC_DATE_INSERT_FORMAT,
|
||||
RC_DEFFILE,
|
||||
RC_DEFAULT_LANGUAGE,
|
||||
RC_DEFAULT_VIEW_FORMAT,
|
||||
RC_GUI_LANGUAGE,
|
||||
RC_DEFAULT_PAPERSIZE,
|
||||
RC_DIALOGS_ICONIFY_WITH_MAIN,
|
||||
@ -371,6 +372,8 @@ public:
|
||||
///
|
||||
std::string gui_language;
|
||||
///
|
||||
std::string default_view_format;
|
||||
///
|
||||
bool mac_like_word_movement;
|
||||
///
|
||||
bool cursor_follows_scrollbar;
|
||||
|
@ -1474,6 +1474,8 @@ PrefFileformats::PrefFileformats(GuiPreferences * form)
|
||||
this, SLOT(updatePrettyname()));
|
||||
connect(formatsCB->lineEdit(), SIGNAL(textEdited(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(defaultFormatCB, SIGNAL(activated(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
}
|
||||
|
||||
|
||||
@ -1492,36 +1494,55 @@ string const l10n_shortcut(string const prettyname, string const shortcut)
|
||||
}; // namespace anon
|
||||
|
||||
|
||||
void PrefFileformats::apply(LyXRC & /*rc*/) const
|
||||
void PrefFileformats::apply(LyXRC & rc) const
|
||||
{
|
||||
QString const default_format = defaultFormatCB->itemData(
|
||||
defaultFormatCB->currentIndex()).toString();
|
||||
rc.default_view_format = fromqstr(default_format);
|
||||
}
|
||||
|
||||
|
||||
void PrefFileformats::update(LyXRC const & /*rc*/)
|
||||
void PrefFileformats::update(LyXRC const & rc)
|
||||
{
|
||||
bool const init = defaultFormatCB->currentText().isEmpty();
|
||||
updateView();
|
||||
if (init) {
|
||||
int const pos = defaultFormatCB->findData(toqstr(
|
||||
rc.default_view_format));
|
||||
defaultFormatCB->setCurrentIndex(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PrefFileformats::updateView()
|
||||
{
|
||||
QString const current = formatsCB->currentText();
|
||||
QString const current_def = defaultFormatCB->currentText();
|
||||
|
||||
// update combobox with formats
|
||||
formatsCB->blockSignals(true);
|
||||
defaultFormatCB->blockSignals(true);
|
||||
formatsCB->clear();
|
||||
form_->formats().sort();
|
||||
Formats::const_iterator cit = form_->formats().begin();
|
||||
Formats::const_iterator end = form_->formats().end();
|
||||
for (; cit != end; ++cit)
|
||||
for (; cit != end; ++cit) {
|
||||
formatsCB->addItem(qt_(cit->prettyname()),
|
||||
QVariant(form_->formats().getNumber(cit->name())));
|
||||
if (form_->converters().isReachable("latex", cit->name())
|
||||
|| form_->converters().isReachable("pdflatex", cit->name()))
|
||||
defaultFormatCB->addItem(qt_(cit->prettyname()),
|
||||
QVariant(toqstr(cit->name())));
|
||||
}
|
||||
|
||||
// restore selection
|
||||
int const item = formatsCB->findText(current, Qt::MatchExactly);
|
||||
int item = formatsCB->findText(current, Qt::MatchExactly);
|
||||
formatsCB->setCurrentIndex(item < 0 ? 0 : item);
|
||||
on_formatsCB_currentIndexChanged(item < 0 ? 0 : item);
|
||||
item = defaultFormatCB->findText(current_def, Qt::MatchExactly);
|
||||
defaultFormatCB->setCurrentIndex(item < 0 ? 0 : item);
|
||||
formatsCB->blockSignals(false);
|
||||
defaultFormatCB->blockSignals(false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -791,8 +791,10 @@ void MenuDefinition::expandFormats(MenuItem::Kind kind, Buffer const * buf)
|
||||
label += "...";
|
||||
break;
|
||||
case MenuItem::ViewFormats:
|
||||
case MenuItem::ExportFormats:
|
||||
case MenuItem::UpdateFormats:
|
||||
if ((*fit)->name() == buf->getDefaultOutputFormat())
|
||||
continue;
|
||||
case MenuItem::ExportFormats:
|
||||
if (!(*fit)->documentFormat())
|
||||
continue;
|
||||
break;
|
||||
|
@ -5,8 +5,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>414</width>
|
||||
<height>322</height>
|
||||
<width>427</width>
|
||||
<height>413</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
@ -19,6 +19,53 @@
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="10" column="0" colspan="4" >
|
||||
<widget class="QGroupBox" name="defaultFormatGB" >
|
||||
<property name="toolTip" >
|
||||
<string>Specify the default output format when using (PDF)LaTeX</string>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Default Format</string>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="defaultFormatLA" >
|
||||
<property name="text" >
|
||||
<string>De&fault Output Format:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>defaultFormatCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="defaultFormatCB" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>124</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3" >
|
||||
<widget class="QLineEdit" name="copierED" />
|
||||
</item>
|
||||
@ -149,19 +196,6 @@
|
||||
<item row="4" column="1" >
|
||||
<widget class="QLineEdit" name="extensionED" />
|
||||
</item>
|
||||
<item row="9" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>168</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
|
Loading…
Reference in New Issue
Block a user