mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
parent
283b7c0829
commit
ecb2427f41
@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be
|
||||
|
||||
-----------------------
|
||||
|
||||
2019-03-26 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* format incremented to 569: New buffer param \tablestyle
|
||||
Determines the standard table template to be used.
|
||||
|
||||
2019-03-22 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* format incremented to 568: Support for the soul module:
|
||||
\so, \hl, \st, \ul, \caps
|
||||
|
@ -1434,6 +1434,15 @@ def revert_soul(document):
|
||||
revert_flex_inset(document.body, "Capitalize", "\\caps")
|
||||
|
||||
|
||||
def revert_tablestyle(document):
|
||||
" Remove tablestyle params "
|
||||
|
||||
i = 0
|
||||
i = find_token(document.header, "\\tablestyle", 0)
|
||||
if i != -1:
|
||||
del document.header[i]
|
||||
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
@ -1464,10 +1473,12 @@ convert = [
|
||||
[565, [convert_AdobeFonts]], # Handle adobe fonts in GUI
|
||||
[566, [convert_hebrew_parentheses]],
|
||||
[567, []],
|
||||
[568, []]
|
||||
[568, []],
|
||||
[569, []]
|
||||
]
|
||||
|
||||
revert = [
|
||||
[568, [revert_tablestyle]],
|
||||
[567, [revert_soul]],
|
||||
[566, [revert_malayalam]],
|
||||
[565, [revert_hebrew_parentheses]],
|
||||
|
@ -435,6 +435,7 @@ BufferParams::BufferParams()
|
||||
columns = 1;
|
||||
listings_params = string();
|
||||
pagestyle = "default";
|
||||
tablestyle = "default";
|
||||
suppress_date = false;
|
||||
justification = true;
|
||||
// no color is the default (white)
|
||||
@ -1052,6 +1053,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
sides = sidestranslator().find(psides);
|
||||
} else if (token == "\\paperpagestyle") {
|
||||
lex >> pagestyle;
|
||||
} else if (token == "\\tablestyle") {
|
||||
lex >> tablestyle;
|
||||
} else if (token == "\\bullet") {
|
||||
readBullets(lex);
|
||||
} else if (token == "\\bulletLaTeX") {
|
||||
@ -1396,7 +1399,8 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
||||
<< "\n\\dynamic_quotes " << dynamic_quotes
|
||||
<< "\n\\papercolumns " << columns
|
||||
<< "\n\\papersides " << sides
|
||||
<< "\n\\paperpagestyle " << pagestyle << '\n';
|
||||
<< "\n\\paperpagestyle " << pagestyle
|
||||
<< "\n\\tablestyle " << tablestyle << '\n';
|
||||
if (!listings_params.empty())
|
||||
os << "\\listings_params \"" <<
|
||||
InsetListingsParams(listings_params).encodedString() << "\"\n";
|
||||
|
@ -366,6 +366,8 @@ public:
|
||||
///
|
||||
std::string pagestyle;
|
||||
///
|
||||
std::string tablestyle;
|
||||
///
|
||||
RGBColor backgroundcolor;
|
||||
///
|
||||
bool isbackgroundcolor;
|
||||
|
@ -2077,7 +2077,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_TABULAR_INSERT:
|
||||
case LFUN_TABULAR_INSERT: {
|
||||
if (cur.buffer()->masterParams().tablestyle != "default") {
|
||||
FuncRequest fr(LFUN_TABULAR_STYLE_INSERT,
|
||||
cur.buffer()->masterParams().tablestyle + " "
|
||||
+ to_ascii(cmd.argument()));
|
||||
lyx::dispatch(fr);
|
||||
break;
|
||||
}
|
||||
// if there were no arguments, just open the dialog
|
||||
if (doInsertInset(cur, this, cmd, false, true))
|
||||
cur.posForward();
|
||||
@ -2085,6 +2092,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
bv->showDialog("tabularcreate");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_TABULAR_STYLE_INSERT: {
|
||||
string const style = cmd.getArg(0);
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "support/gettext.h"
|
||||
#include "support/lassert.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/Package.h"
|
||||
#include "support/TempFile.h"
|
||||
|
||||
#include "frontends/alert.h"
|
||||
@ -74,6 +75,7 @@
|
||||
#include <QColor>
|
||||
#include <QColorDialog>
|
||||
#include <QCloseEvent>
|
||||
#include <QDirIterator>
|
||||
#include <QFontDatabase>
|
||||
#include <QHeaderView>
|
||||
#include <QScrollBar>
|
||||
@ -828,6 +830,9 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
connect(textLayoutModule->justCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
connect(textLayoutModule->tableStyleCO, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
textLayoutModule->lspacingLE->setValidator(new QDoubleValidator(
|
||||
textLayoutModule->lspacingLE));
|
||||
textLayoutModule->indentLE->setValidator(new LengthValidator(
|
||||
@ -852,6 +857,9 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
// initialize the length validator
|
||||
bc().addCheckedLineEdit(textLayoutModule->indentLE);
|
||||
bc().addCheckedLineEdit(textLayoutModule->skipLE);
|
||||
|
||||
textLayoutModule->tableStyleCO->addItem(qt_("Default"), toqstr("default"));
|
||||
getTableStyles();
|
||||
|
||||
|
||||
// master/child handling
|
||||
@ -2967,6 +2975,45 @@ void GuiDocument::updateNumbering()
|
||||
}
|
||||
|
||||
|
||||
void GuiDocument::getTableStyles()
|
||||
{
|
||||
// We look for lyx files in the subdirectory dir of
|
||||
// 1) user_lyxdir
|
||||
// 2) build_lyxdir (if not empty)
|
||||
// 3) system_lyxdir
|
||||
// in this order. Files with a given sub-hierarchy will
|
||||
// only be listed once.
|
||||
// We also consider i18n subdirectories and store them separately.
|
||||
QStringList dirs;
|
||||
|
||||
// The three locations to look at.
|
||||
string const user = addPath(package().user_support().absFileName(), "tabletemplates");
|
||||
string const build = addPath(package().build_support().absFileName(), "tabletemplates");
|
||||
string const system = addPath(package().system_support().absFileName(), "tabletemplates");
|
||||
|
||||
dirs << toqstr(user)
|
||||
<< toqstr(build)
|
||||
<< toqstr(system);
|
||||
|
||||
for (int i = 0; i < dirs.size(); ++i) {
|
||||
QString const dir = dirs.at(i);
|
||||
QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
QString fn = QFileInfo(it.next()).fileName();
|
||||
if (!fn.endsWith(".lyx") || fn.contains("_1x"))
|
||||
continue;
|
||||
QString data = fn.left(fn.lastIndexOf(".lyx"));
|
||||
QString guiname = data;
|
||||
guiname = toqstr(translateIfPossible(qstring_to_ucs4(guiname.replace('_', ' '))));
|
||||
QString relpath = toqstr(makeRelPath(qstring_to_ucs4(fn),
|
||||
qstring_to_ucs4(dir)));
|
||||
if (textLayoutModule->tableStyleCO->findData(data) == -1)
|
||||
textLayoutModule->tableStyleCO->addItem(guiname, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GuiDocument::updateDefaultFormat()
|
||||
{
|
||||
if (!bufferview())
|
||||
@ -3285,6 +3332,8 @@ void GuiDocument::applyView()
|
||||
break;
|
||||
}
|
||||
}
|
||||
bp_.tablestyle = fromqstr(textLayoutModule->tableStyleCO->itemData(
|
||||
textLayoutModule->tableStyleCO->currentIndex()).toString());
|
||||
|
||||
bp_.options =
|
||||
fromqstr(latexModule->optionsLE->text());
|
||||
@ -3737,6 +3786,9 @@ void GuiDocument::paramsToDialog()
|
||||
bp_.spacing().getValueAsString());
|
||||
}
|
||||
setLSpacing(nitem);
|
||||
int ts = textLayoutModule->tableStyleCO->findData(toqstr(bp_.tablestyle));
|
||||
if (ts != -1)
|
||||
textLayoutModule->tableStyleCO->setCurrentIndex(ts);
|
||||
|
||||
if (bp_.paragraph_separation == BufferParams::ParagraphIndentSeparation) {
|
||||
textLayoutModule->indentRB->setChecked(true);
|
||||
|
@ -211,6 +211,8 @@ private:
|
||||
void setLayoutComboByIDString(std::string const & idString);
|
||||
/// Update quotes styles combo, indicating the current language's default
|
||||
void updateQuoteStyles(bool const set = false);
|
||||
///
|
||||
void getTableStyles();
|
||||
|
||||
/// available modules
|
||||
GuiIdListModel modules_av_model_;
|
||||
|
@ -7,14 +7,146 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>470</width>
|
||||
<height>380</height>
|
||||
<height>468</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="spacingGB">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Spacing</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lspacingL">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Line spacing:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lspacingCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="lspacingCO">
|
||||
<property name="toolTip">
|
||||
<string>Spacing type</string>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="lspacingLE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>69</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QGroupBox" name="tableStyleGB">
|
||||
<property name="title">
|
||||
<string>Table Style</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="tableStyleLA">
|
||||
<property name="text">
|
||||
<string>Default St&yle:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>tableStyleCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="tableStyleCO">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>403</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="separateGB">
|
||||
<property name="title">
|
||||
<string>Paragraph Separation</string>
|
||||
@ -185,87 +317,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="spacingGB">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Spacing</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lspacingL">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Line spacing:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lspacingCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="lspacingCO">
|
||||
<property name="toolTip">
|
||||
<string>Spacing type</string>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="lspacingLE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>69</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="twoColumnCB">
|
||||
<property name="toolTip">
|
||||
<string>Format text into two columns</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Two-&column document</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="justCB">
|
||||
<property name="toolTip">
|
||||
<string>Justify text in the LyX editor (this does not affect whether the text is justified in the output)</string>
|
||||
@ -275,21 +327,15 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="twoColumnCB">
|
||||
<property name="toolTip">
|
||||
<string>Format text into two columns</string>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
<property name="text">
|
||||
<string>Two-&column document</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>403</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
|
||||
|
||||
// Do not remove the comment below, so we get merge conflict in
|
||||
// independent branches. Instead add your own.
|
||||
#define LYX_FORMAT_LYX 568 // spitz :soul.module
|
||||
#define LYX_FORMAT_TEX2LYX 568
|
||||
#define LYX_FORMAT_LYX 569 // spitz: tablestyle buffer param
|
||||
#define LYX_FORMAT_TEX2LYX 569
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user