mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-19 12:20:27 +00:00
c49cd69998
From: "Joel A. Kulesza" <jkulesza@gmail.com> Date: Mon, 24 Oct 2016 17:37:58 -0600 Subject: [PATCH] Add "Swap & Reverse" to math delimiter dialog When "Keep matched" is unchecked, a button becomes enabled to "Swap & Reverse" the left and right delimiters. This is expected to be of use with line-wrapped equations featuring one or more set of delimiters that break across the lines. When "Keep matched" is checked, the button is visible but disabled. The most common use case is expected to be the user entering a pair of unmatched delimiters on the first line of an equation (e.g., "(" and "(None)"), entering the inner text, going to the next line, and inserting the opposite set of delimiters (e.g., "(None)" and ")"). This button will negate the need to find the correct corresponding combination. However, it relies on the dialog's memory of the previous unmatched set. This change addresses Ticket #10457 ----------- Modifications by spitz to the original patch: * Only enable the button if an unmatched pair is selected * Consider l7n when locating the string "(None)" * Add an accelerator and a tooltip to the dialog * Simplify the code a bit
60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file GuiDelimiter.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef GUIDELIMITERDIALOG_H
|
|
#define GUIDELIMITERDIALOG_H
|
|
|
|
#include "GuiDialog.h"
|
|
|
|
#include "ui_DelimiterUi.h"
|
|
|
|
class QListWidgetItem;
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
class GuiDelimiter : public GuiDialog, public Ui::DelimiterUi
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
GuiDelimiter(GuiView & lv);
|
|
|
|
bool initialiseParams(std::string const &) { return true; }
|
|
void clearParams() {}
|
|
void dispatchParams() {}
|
|
bool isBufferDependent() const { return true; }
|
|
|
|
public Q_SLOTS:
|
|
void on_leftLW_itemActivated(QListWidgetItem *);
|
|
void on_rightLW_itemActivated(QListWidgetItem *);
|
|
void on_leftLW_currentRowChanged(int);
|
|
void on_rightLW_currentRowChanged(int);
|
|
void on_matchCB_stateChanged(int);
|
|
void on_insertPB_clicked();
|
|
void on_swapPB_clicked();
|
|
void on_sizeCO_activated(int);
|
|
|
|
private:
|
|
///
|
|
char_type doMatch(char_type const symbol);
|
|
///
|
|
void updateTeXCode(int size);
|
|
|
|
/// TeX code that will be inserted.
|
|
docstring tex_code_;
|
|
};
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|
|
|
|
#endif // GUIDELIMITERDIALOG_H
|