* \use_qimage
This is no longer necessary due to the rewrite of the painter.
+* \date_insert_format
+ The function date-insert has been removed and superseded by info-insert date.
+ The latter does not need a pref value anymore.
+
!!!The following new LyX functions have been introduced in 2.4:
* info-insert buffer vcs-*: renamed to info-insert vcs *
+!!!The following LyX functions have been removed in 2.4:
+
+* date-insert: obsoleted by info-insert date.
+
+
!!!The following LyX documents have been moved in 2.4:
\end_layout
\begin_layout Verbatim
-
This is Verbatim.
\end_layout
\begin_layout Verbatim
\noindent
\align block
-
The following 2 lines are empty:
\end_layout
\end_layout
\begin_layout Verbatim
-
Almost everything is allowed in Verbatim:"%&$§#~'`
\backslash
}][{|
\end_layout
\begin_layout Verbatim*
-
This is Verbatim*.
\end_layout
\end_layout
\begin_layout Description
+
+\change_deleted -712698321 1534601711
Date
\begin_inset space ~
\end_inset
\end_inset
prints the date as day/month/year.
+\change_unchanged
+
\end_layout
\begin_layout Description
\end_layout
\begin_layout Verbatim
-
Dies ist Unformatiert.
\end_layout
\begin_layout Verbatim
-
Die folgenden 2 Zeilen sind leer:
\end_layout
\end_layout
\begin_layout Verbatim
-
Fast alles ist in Unformatiert erlaubt:"%&$§#~'`
\backslash
}][{|
\end_layout
\begin_layout Verbatim*
-
Dies ist Unformatiert*.
\end_layout
langen Zeile ausgegeben.
\end_layout
-\begin_layout Description
-Datumsformat
-\begin_inset Index idx
-status collapsed
-
-\begin_layout Plain Layout
-Datumsformat
-\end_layout
-
-\end_inset
-
-
-\begin_inset Index idx
-status collapsed
-
-\begin_layout Plain Layout
-Einstellungen ! Datumsformat
-\end_layout
-
-\end_inset
-
- Das Datumsformat kann eines oder eine Mischung der hier aufgelisteten Formate
- sein:
-\begin_inset Newline newline
-\end_inset
-
-
-\begin_inset Flex URL
-status collapsed
-
-\begin_layout Plain Layout
-
-http://man7.org/linux/man-pages/man1/date.1.html
-\end_layout
-
-\end_inset
-
-
-\begin_inset Newline newline
-\end_inset
-
-Zum Beispiel gibt das Format
-\begin_inset Newline newline
-\end_inset
-
-%d/%m/%y
-\begin_inset Newline newline
-\end_inset
-
-das Datum in der Form Tag/Monat/Jahr aus.
-\end_layout
-
\begin_layout Description
Beim
\begin_inset space ~
return simple_renaming(line, "info-insert buffer vcs-tree-revision", "info-insert vcs tree-revision")
+def remove_date_insert(line):
+ return simple_remove(line, "date-insert")
+
+
#
###########################################################
info_rename_vcsdate,
info_rename_vcstime,
info_rename_vcsrevision,
- info_rename_vcstreerevision
+ info_rename_vcstreerevision,
+ remove_date_insert
]]
]
# Incremented to format 27, by spitz
# Add optional flavor value to needaux flag
+# Incremented to format 28, by spitz
+# Remove date_insert_format
+
# NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py.
return no_match
return (True, "")
+def remove_date_insert_format(line):
+ if not line.lower().startswith("\\date_insert_format "):
+ return no_match
+ return (True, "")
+
# End conversions for LyX 2.3 to 2.4
####################################
[ 24, [rename_collapsible]],
[ 25, [remove_use_qimage]],
[ 26, [remove_font_encoding]],
- [ 27, []]
+ [ 27, []],
+ [ 28, [remove_date_insert_format]]
]
LFUN_PREFERENCES_SAVE,
LFUN_HELP_OPEN, // Jug 990627
// 175
- LFUN_DATE_INSERT, // jdblair 20000131
+ LFUN_LAYOUT_TOGGLE, // lasgouttes 20180514
LFUN_LANGUAGE, // Dekel 20000203
LFUN_ERT_INSERT, // Jug 20000218
LFUN_FOOTNOTE_INSERT, // Jug 20000307
LFUN_BUFFER_ANONYMIZE, // sanda, 20180201
LFUN_GRAPHICS_UNIFY, // sanda, 20180207
LFUN_MASTER_BUFFER_EXPORT, // rkh, 20180417
- LFUN_LAYOUT_TOGGLE, // lasgouttes 20180514
- // 375
LFUN_INSET_END_EDIT, // gb/rkh, 20180605
+ // 375
LFUN_LASTACTION // end of the table
};
*/
{ LFUN_CUT, "cut", Noop, Edit },
-/*!
- * \var lyx::FuncCode lyx::LFUN_DATE_INSERT
- * \li Action: Inserts the current date.
- * \li Syntax: date-insert [<ARG>]
- * \li Params: <ARG>: Format of date. The default value (%x) can be set
- in Preferences->Output->General->Date format. For
- possible formats see the manual page of the
- strftime function.
- * \li Origin: jdblair, 31 Jan 2000
- * \endvar
- */
- { LFUN_DATE_INSERT, "date-insert", Noop, Edit },
-
/*!
* \var lyx::FuncCode lyx::LFUN_DEBUG_LEVEL_SET
* \li Action: Set debug output level.
// The format should also be updated in configure.py, and conversion code
// should be added to prefs2prefs_prefs.py.
-static unsigned int const LYXRC_FILEFORMAT = 27; // spitz: add flavor value to needaux flag
+static unsigned int const LYXRC_FILEFORMAT = 28; // spitz: remove \\date_insert_format
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
{ "\\copier", LyXRC::RC_COPIER },
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
{ "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
- { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
{ "\\def_file", LyXRC::RC_DEFFILE },
{ "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
{ "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
show_banner = true;
windows_style_tex_paths = false;
tex_allows_spaces = false;
- date_insert_format = "%x";
cursor_follows_scrollbar = false;
scroll_below_document = false;
scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
if (lexrc.next())
default_length_unit = (Length::UNIT) lexrc.getInteger();
break;
- case RC_DATE_INSERT_FORMAT:
- lexrc >> date_insert_format;
- break;
case RC_LANGUAGE_CUSTOM_PACKAGE:
lexrc >> language_custom_package;
break;
if (tag != RC_LAST)
break;
// fall through
- case RC_DATE_INSERT_FORMAT:
- if (ignore_system_lyxrc ||
- date_insert_format != system_lyxrc.date_insert_format) {
- os << "\\date_insert_format \"" << date_insert_format
- << "\"\n";
- }
- if (tag != RC_LAST)
- break;
- // fall through
case RC_USER_NAME:
os << "\\user_name \"" << user_name << "\"\n";
if (tag != RC_LAST)
case LyXRC::RC_COPIER:
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
- case LyXRC::RC_DATE_INSERT_FORMAT:
case LyXRC::RC_GUI_LANGUAGE:
case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
break;
- case RC_DATE_INSERT_FORMAT:
- //xgettext:no-c-format
- str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
- break;
-
case RC_DEFFILE:
str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
break;
RC_COPIER,
RC_CURSOR_FOLLOWS_SCROLLBAR,
RC_CURSOR_WIDTH,
- RC_DATE_INSERT_FORMAT,
RC_DEFAULT_DECIMAL_POINT,
RC_DEFAULT_LENGTH_UNIT,
RC_DEFAULT_OTF_VIEW_FORMAT,
///
std::string lyxpipes;
///
- std::string date_insert_format;
- ///
std::string language_custom_package;
///
bool language_auto_begin;
break;
}
- case LFUN_DATE_INSERT: {
- string const format = cmd.argument().empty()
- ? lyxrc.date_insert_format : to_utf8(cmd.argument());
- string const time = formatted_time(current_time(), format);
- lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, time));
- break;
- }
-
case LFUN_MOUSE_TRIPLE:
if (cmd.button() == mouse_button::button1) {
tm->cursorHome(cur);
enable = !inDescriptionItem(cur);
break;
- case LFUN_DATE_INSERT: {
- string const format = cmd.argument().empty()
- ? lyxrc.date_insert_format : to_utf8(cmd.argument());
- enable = support::os::is_valid_strftime(format);
- break;
- }
-
case LFUN_LANGUAGE:
enable = !cur.paragraph().isPassThru();
flag.setOnOff(cmd.getArg(0) == cur.real_current_font.language()->lang());
}
-/////////////////////////////////////////////////////////////////////
-//
-// StrftimeValidator
-//
-/////////////////////////////////////////////////////////////////////
-
-class StrftimeValidator : public QValidator
-{
-public:
- StrftimeValidator(QWidget *);
- QValidator::State validate(QString & input, int & pos) const;
-};
-
-
-StrftimeValidator::StrftimeValidator(QWidget * parent)
- : QValidator(parent)
-{
-}
-
-
-QValidator::State StrftimeValidator::validate(QString & input, int & /*pos*/) const
-{
- if (is_valid_strftime(fromqstr(input)))
- return QValidator::Acceptable;
- else
- return QValidator::Intermediate;
-}
-
-
/////////////////////////////////////////////////////////////////////
//
// PrefOutput
{
setupUi(this);
- DateED->setValidator(new StrftimeValidator(DateED));
dviCB->setValidator(new NoNewLineValidator(dviCB));
pdfCB->setValidator(new NoNewLineValidator(pdfCB));
- connect(DateED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(overwriteCO, SIGNAL(activated(int)),
}
-void PrefOutput::on_DateED_textChanged(const QString &)
-{
- QString t = DateED->text();
- int p = 0;
- bool valid = DateED->validator()->validate(t, p)
- == QValidator::Acceptable;
- setValid(DateLA, valid);
-}
-
-
void PrefOutput::applyRC(LyXRC & rc) const
{
- rc.date_insert_format = fromqstr(DateED->text());
rc.plaintext_linelen = plaintextLinelengthSB->value();
rc.forward_search_dvi = fromqstr(dviCB->currentText());
rc.forward_search_pdf = fromqstr(pdfCB->currentText());
void PrefOutput::updateRC(LyXRC const & rc)
{
- DateED->setText(toqstr(rc.date_insert_format));
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
dviCB->setEditText(toqstr(rc.forward_search_dvi));
pdfCB->setEditText(toqstr(rc.forward_search_pdf));
addModule(new PrefLanguage(this));
addModule(new PrefSpellchecker(this));
- //for strftime validator
PrefOutput * output = new PrefOutput(this);
addModule(output);
addModule(new PrefLatex(this));
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
bc().setRestore(buttonBox->button(QDialogButtonBox::Reset));
-
- // initialize the strftime validator
- bc().addCheckedLineEdit(output->DateED);
}
virtual void applyRC(LyXRC & rc) const;
virtual void updateRC(LyXRC const & rc);
-
-private Q_SLOTS:
- void on_DateED_textChanged(const QString &);
};
<x>0</x>
<y>0</y>
<width>356</width>
- <height>393</height>
+ <height>442</height>
</rect>
</property>
<property name="windowTitle">
</item>
</layout>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <widget class="QLabel" name="DateLA">
- <property name="text">
- <string>&Date format:</string>
- </property>
- <property name="buddy">
- <cstring>DateED</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="DateED">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Date format for strftime output</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
}
-string const formatted_time(time_t t, string const & fmt)
-{
- struct tm * loc_tm = localtime(&t);
- char date[50];
- strftime(date, sizeof(date), fmt.c_str(), loc_tm);
- return string(date);
-}
-
-
docstring formatted_datetime(time_t t, string const & fmt)
{
QString qres;
time_t current_time();
-/** Returns a locale-dependent formatting of the date
- * and time encoded in \c time. The \p fmt string
- * holds the formatting arguments of \c strftime.
- * Prefer the function formatted_datetime below.
- */
-std::string const formatted_time(time_t t, std::string const & fmt);
-
/** Returns a locale-dependent formatting of the date and time encoded in \c t
* The \p fmt string holds the formatting arguments of QDateTime::toString().
* If fmt is empty then the formatting of the date and time is itself according
*/
std::string latex_path_list(std::string const & p);
-/// Checks if the format string is suitable on the OS
-bool is_valid_strftime(std::string const & p);
-
/** Returns a string suitable to be passed to popen when
* reading a file.
*/
}
-bool is_valid_strftime(string const & p)
-{
- string::size_type pos = p.find_first_of('%');
- while (pos != string::npos) {
- if (pos + 1 == string::npos)
- break;
- if (!containsOnly(p.substr(pos + 1, 1),
- "aAbBcCdDeEFgGhHIjklmMnOpPrRsStTuUVwWxXyYzZ%+"))
- return false;
- if (pos + 2 == string::npos)
- break;
- pos = p.find_first_of('%', pos + 2);
- }
- return true;
-}
-
-
// returns a string suitable to be passed to popen when
// reading a pipe
char const * popen_read_mode()
}
-bool is_valid_strftime(string const & p)
-{
- string::size_type pos = p.find_first_of('%');
- while (pos != string::npos) {
- if (pos + 1 == string::npos)
- break;
- if (!containsOnly(p.substr(pos + 1, 1),
- "aAbBcCdDeEFgGhHIjklmMnOpPrRsStTuUVwWxXyYzZ%+"))
- return false;
- if (pos + 2 == string::npos)
- break;
- pos = p.find_first_of('%', pos + 2);
- }
- return true;
-}
-
-
char const * popen_read_mode()
{
return "r";
}
-bool is_valid_strftime(string const & p)
-{
- string::size_type pos = p.find_first_of('%');
- while (pos != string::npos) {
- if (pos + 1 == string::npos)
- break;
- if (!containsOnly(p.substr(pos + 1, 1),
- "aAbBcdfHIjmMpSUwWxXyYzZ%"))
- return false;
- if (pos + 2 == string::npos)
- break;
- pos = p.find_first_of('%', pos + 2);
- }
- return true;
-}
-
-
// returns a string suitable to be passed to popen when
// reading a pipe
char const * popen_read_mode()