mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 06:15:16 +00:00
*** New Symbols Dialog ***
* src/Encoding.{cpp,h}: - new public member getSymbolsList() * src/frontends/qt4/GuiSymbols.cpp: * src/frontends/qt4/GuiSymbols.h: * src/frontends/qt4/ui/SymbolsUi.ui - new files * src/frontends/qt4/GuiView.cpp: * src/frontends/qt4/Makefile.am: * development/scons/scons_manifest.py: - add new dialog * lib/ui/classic.ui: * lib/ui/stdmenus.ui: - menu item for symbols dialog. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22832 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
344f629629
commit
9bdca85f26
@ -752,6 +752,7 @@ src_frontends_qt4_header_files = Split('''
|
|||||||
GuiSetBorder.h
|
GuiSetBorder.h
|
||||||
GuiShowFile.h
|
GuiShowFile.h
|
||||||
GuiSpellchecker.h
|
GuiSpellchecker.h
|
||||||
|
GuiSymbols.h
|
||||||
GuiTabularCreate.h
|
GuiTabularCreate.h
|
||||||
GuiTabular.h
|
GuiTabular.h
|
||||||
GuiTexinfo.h
|
GuiTexinfo.h
|
||||||
@ -841,6 +842,7 @@ src_frontends_qt4_files = Split('''
|
|||||||
GuiSetBorder.cpp
|
GuiSetBorder.cpp
|
||||||
GuiShowFile.cpp
|
GuiShowFile.cpp
|
||||||
GuiSpellchecker.cpp
|
GuiSpellchecker.cpp
|
||||||
|
GuiSymbols.cpp
|
||||||
GuiTabular.cpp
|
GuiTabular.cpp
|
||||||
GuiTabularCreate.cpp
|
GuiTabularCreate.cpp
|
||||||
GuiTexinfo.cpp
|
GuiTexinfo.cpp
|
||||||
@ -940,6 +942,7 @@ src_frontends_qt4_ui_files = Split('''
|
|||||||
ShortcutUi.ui
|
ShortcutUi.ui
|
||||||
ShowFileUi.ui
|
ShowFileUi.ui
|
||||||
SpellcheckerUi.ui
|
SpellcheckerUi.ui
|
||||||
|
SymbolsUi.ui
|
||||||
TabularCreateUi.ui
|
TabularCreateUi.ui
|
||||||
TabularUi.ui
|
TabularUi.ui
|
||||||
TexinfoUi.ui
|
TexinfoUi.ui
|
||||||
|
@ -238,6 +238,7 @@ Menuset
|
|||||||
End
|
End
|
||||||
|
|
||||||
Menu "insert_special"
|
Menu "insert_special"
|
||||||
|
Item "Symbols...|b" "dialog-show symbols"
|
||||||
Item "Superscript|S" "command-sequence math-mode on; math-superscript; math-insert \text;"
|
Item "Superscript|S" "command-sequence math-mode on; math-superscript; math-insert \text;"
|
||||||
Item "Subscript|u" "command-sequence math-mode on; math-subscript; math-insert \text;"
|
Item "Subscript|u" "command-sequence math-mode on; math-subscript; math-insert \text;"
|
||||||
Item "Horizontal Fill|H" "hfill-insert"
|
Item "Horizontal Fill|H" "hfill-insert"
|
||||||
|
@ -344,6 +344,7 @@ Menuset
|
|||||||
End
|
End
|
||||||
|
|
||||||
Menu "insert_special"
|
Menu "insert_special"
|
||||||
|
Item "Symbols...|b" "dialog-show symbols"
|
||||||
Item "Ellipsis|i" "specialchar-insert dots"
|
Item "Ellipsis|i" "specialchar-insert dots"
|
||||||
Item "End of Sentence|E" "specialchar-insert end-of-sentence"
|
Item "End of Sentence|E" "specialchar-insert end-of-sentence"
|
||||||
Item "Ordinary Quote|Q" "self-insert \""
|
Item "Ordinary Quote|Q" "self-insert \""
|
||||||
|
@ -341,6 +341,27 @@ docstring const Encoding::latexChar(char_type c) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
set<char_type> Encoding::getSymbolsList()
|
||||||
|
{
|
||||||
|
// assure the used encoding is properly initialized
|
||||||
|
if (!complete_)
|
||||||
|
init();
|
||||||
|
BOOST_ASSERT(complete_);
|
||||||
|
|
||||||
|
// first all encodable characters
|
||||||
|
CharSet symbols = encodable_;
|
||||||
|
// add those below start_encodable_
|
||||||
|
for (char_type c = 0; c < start_encodable_; ++c)
|
||||||
|
symbols.insert(c);
|
||||||
|
// now the ones from the unicodesymbols file
|
||||||
|
CharInfoMap::const_iterator const end = unicodesymbols.end();
|
||||||
|
for (CharInfoMap::const_iterator it = unicodesymbols.begin(); it != end; ++it) {
|
||||||
|
symbols.insert(it->first);
|
||||||
|
}
|
||||||
|
return symbols;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Encodings::validate(char_type c, LaTeXFeatures & features)
|
void Encodings::validate(char_type c, LaTeXFeatures & features)
|
||||||
{
|
{
|
||||||
CharInfoMap::const_iterator const it = unicodesymbols.find(c);
|
CharInfoMap::const_iterator const it = unicodesymbols.find(c);
|
||||||
|
@ -70,6 +70,8 @@ public:
|
|||||||
docstring const latexChar(char_type c) const;
|
docstring const latexChar(char_type c) const;
|
||||||
/// Which LaTeX package handles this encoding?
|
/// Which LaTeX package handles this encoding?
|
||||||
Package package() const { return package_; }
|
Package package() const { return package_; }
|
||||||
|
/// A list of all characters usable in this encoding
|
||||||
|
std::set<char_type> getSymbolsList();
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
std::string Name_;
|
std::string Name_;
|
||||||
|
305
src/frontends/qt4/GuiSymbols.cpp
Normal file
305
src/frontends/qt4/GuiSymbols.cpp
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
/**
|
||||||
|
* \file GuiSymbols.cpp
|
||||||
|
* This file is part of LyX, the document processor.
|
||||||
|
* Licence details can be found in the file COPYING.
|
||||||
|
*
|
||||||
|
* \author Jürgen Spitzmüller
|
||||||
|
*
|
||||||
|
* Full author contact details are available in file CREDITS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "GuiSymbols.h"
|
||||||
|
|
||||||
|
#include "Buffer.h"
|
||||||
|
#include "BufferView.h"
|
||||||
|
|
||||||
|
#include "GuiApplication.h"
|
||||||
|
#include "GuiView.h"
|
||||||
|
|
||||||
|
#include "qt_helpers.h"
|
||||||
|
|
||||||
|
#include "Encoding.h"
|
||||||
|
#include "support/gettext.h"
|
||||||
|
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
|
// Set to zero if unicode symbols are preferred.
|
||||||
|
#define USE_PIXMAP 1
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
namespace lyx {
|
||||||
|
namespace frontend {
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
/// name of unicode block, start and end code point
|
||||||
|
struct UnicodeBlocks {
|
||||||
|
char const * name;
|
||||||
|
char_type start;
|
||||||
|
char_type end;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// all unicode blocks with start and end code point
|
||||||
|
UnicodeBlocks unicode_blocks[] = {
|
||||||
|
{ N_("Basic Latin"), 0x0000, 0x007f },
|
||||||
|
{ N_("Latin-1 Supplement"), 0x0080, 0x00ff },
|
||||||
|
{ N_("Latin Extended-A"), 0x0100, 0x017f },
|
||||||
|
{ N_("Latin Extended-B"), 0x0180, 0x024f },
|
||||||
|
{ N_("IPA Extensions"), 0x0250, 0x02af },
|
||||||
|
{ N_("Spacing Modifier Letters"), 0x02b0, 0x02ff },
|
||||||
|
{ N_("Combining Diacritical Marks"), 0x0300, 0x036f },
|
||||||
|
{ N_("Greek"), 0x0370, 0x03ff },
|
||||||
|
{ N_("Cyrillic"), 0x0400, 0x04ff },
|
||||||
|
{ N_("Armenian"), 0x0530, 0x058f },
|
||||||
|
{ N_("Hebrew"), 0x0590, 0x05ff },
|
||||||
|
{ N_("Arabic"), 0x0600, 0x06ff },
|
||||||
|
{ N_("Devanagari"), 0x0900, 0x097f },
|
||||||
|
{ N_("Bengali"), 0x0980, 0x09ff },
|
||||||
|
{ N_("Gurmukhi"), 0x0a00, 0x0a7f },
|
||||||
|
{ N_("Gujarati"), 0x0a80, 0x0aff },
|
||||||
|
{ N_("Oriya"), 0x0b00, 0x0b7f },
|
||||||
|
{ N_("Tamil"), 0x0b80, 0x0bff },
|
||||||
|
{ N_("Telugu"), 0x0c00, 0x0c7f },
|
||||||
|
{ N_("Kannada"), 0x0c80, 0x0cff },
|
||||||
|
{ N_("Malayalam"), 0x0d00, 0x0d7f },
|
||||||
|
{ N_("Thai"), 0x0e00, 0x0e7f },
|
||||||
|
{ N_("Lao"), 0x0e80, 0x0eff },
|
||||||
|
{ N_("Tibetan"), 0x0f00, 0x0fbf },
|
||||||
|
{ N_("Georgian"), 0x10a0, 0x10ff },
|
||||||
|
{ N_("Hangul Jamo"), 0x1100, 0x11ff },
|
||||||
|
{ N_("Latin Extended Additional"), 0x1e00, 0x1eff },
|
||||||
|
{ N_("Greek Extended"), 0x1f00, 0x1fff },
|
||||||
|
{ N_("General Punctuation"), 0x2000, 0x206f },
|
||||||
|
{ N_("Superscripts and Subscripts"), 0x2070, 0x209f },
|
||||||
|
{ N_("Currency Symbols"), 0x20a0, 0x20cf },
|
||||||
|
{ N_("Combining Diacritical Marks for Symbols"), 0x20d0, 0x20ff },
|
||||||
|
{ N_("Letterlike Symbols"), 0x2100, 0x214f },
|
||||||
|
{ N_("Number Forms"), 0x2150, 0x218f },
|
||||||
|
{ N_("Arrows"), 0x2190, 0x21ff },
|
||||||
|
{ N_("Mathematical Operators"), 0x2200, 0x22ff },
|
||||||
|
{ N_("Miscellaneous Technical"), 0x2300, 0x23ff },
|
||||||
|
{ N_("Control Pictures"), 0x2400, 0x243f },
|
||||||
|
{ N_("Optical Character Recognition"), 0x2440, 0x245f },
|
||||||
|
{ N_("Enclosed Alphanumerics"), 0x2460, 0x24ff },
|
||||||
|
{ N_("Box Drawing"), 0x2500, 0x257f },
|
||||||
|
{ N_("Block Elements"), 0x2580, 0x259f },
|
||||||
|
{ N_("Geometric Shapes"), 0x25a0, 0x25ff },
|
||||||
|
{ N_("Miscellaneous Symbols"), 0x2600, 0x26ff },
|
||||||
|
{ N_("Dingbats"), 0x2700, 0x27bf },
|
||||||
|
{ N_("CJK Symbols and Punctuation"), 0x3000, 0x303f },
|
||||||
|
{ N_("Hiragana"), 0x3040, 0x309f },
|
||||||
|
{ N_("Katakana"), 0x30a0, 0x30ff },
|
||||||
|
{ N_("Bopomofo"), 0x3100, 0x312f },
|
||||||
|
{ N_("Hangul Compatibility Jamo"), 0x3130, 0x318f },
|
||||||
|
{ N_("Kanbun"), 0x3190, 0x319f },
|
||||||
|
{ N_("Enclosed CJK Letters and Months"), 0x3200, 0x32ff },
|
||||||
|
{ N_("CJK Compatibility"), 0x3300, 0x33ff },
|
||||||
|
{ N_("CJK Unified Ideographs"), 0x4e00, 0x9fa5 },
|
||||||
|
{ N_("Hangul Syllables"), 0xac00, 0xd7a3 },
|
||||||
|
{ N_("High Surrogates"), 0xd800, 0xdb7f },
|
||||||
|
{ N_("Private Use High Surrogates"), 0xdb80, 0xdbff },
|
||||||
|
{ N_("Low Surrogates"), 0xdc00, 0xdfff },
|
||||||
|
{ N_("Private Use Area"), 0xe000, 0xf8ff },
|
||||||
|
{ N_("CJK Compatibility Ideographs"), 0xf900, 0xfaff },
|
||||||
|
{ N_("Alphabetic Presentation Forms"), 0xfb00, 0xfb4f },
|
||||||
|
{ N_("Arabic Presentation Forms-A"), 0xfb50, 0xfdff },
|
||||||
|
{ N_("Combining Half Marks"), 0xfe20, 0xfe2f },
|
||||||
|
{ N_("CJK Compatibility Forms"), 0xfe30, 0xfe4f },
|
||||||
|
{ N_("Small Form Variants"), 0xfe50, 0xfe6f },
|
||||||
|
{ N_("Arabic Presentation Forms-B"), 0xfe70, 0xfeff },
|
||||||
|
{ N_("Halfwidth and Fullwidth Forms"), 0xff00, 0xffef },
|
||||||
|
{ N_("Specials"), 0xfff0, 0xffff },
|
||||||
|
{ N_("Linear B Syllabary"), 0x10000, 0x1007f },
|
||||||
|
{ N_("Linear B Ideograms"), 0x10080, 0x100ff },
|
||||||
|
{ N_("Aegean Numbers"), 0x10100, 0x1013f },
|
||||||
|
{ N_("Ancient Greek Numbers"), 0x10140, 0x1018f },
|
||||||
|
{ N_("Old Italic"), 0x10300, 0x1032f },
|
||||||
|
{ N_("Gothic"), 0x10330, 0x1034f },
|
||||||
|
{ N_("Ugaritic"), 0x10380, 0x1039f },
|
||||||
|
{ N_("Old Persian"), 0x103a0, 0x103df },
|
||||||
|
{ N_("Deseret"), 0x10400, 0x1044f },
|
||||||
|
{ N_("Shavian"), 0x10450, 0x1047f },
|
||||||
|
{ N_("Osmanya"), 0x10480, 0x104af },
|
||||||
|
{ N_("Cypriot Syllabary"), 0x10800, 0x1083f },
|
||||||
|
{ N_("Kharoshthi"), 0x10a00, 0x10a5f },
|
||||||
|
{ N_("Byzantine Musical Symbols"), 0x1d000, 0x1d0ff },
|
||||||
|
{ N_("Musical Symbols"), 0x1d100, 0x1d1ff },
|
||||||
|
{ N_("Ancient Greek Musical Notation"), 0x1d200, 0x1d24f },
|
||||||
|
{ N_("Tai Xuan Jing Symbols"), 0x1d300, 0x1d35f },
|
||||||
|
{ N_("Mathematical Alphanumeric Symbols"), 0x1d400, 0x1d7ff },
|
||||||
|
{ N_("CJK Unified Ideographs Extension B"), 0x20000, 0x2a6d6 },
|
||||||
|
{ N_("CJK Compatibility Ideographs Supplement"), 0x2f800, 0x2fa1f },
|
||||||
|
{ N_("Tags"), 0xe0000, 0xe007f },
|
||||||
|
{ N_("Variation Selectors Supplement"), 0xe0100, 0xe01ef },
|
||||||
|
{ N_("Supplementary Private Use Area-A"), 0xf0000, 0xe01ef },
|
||||||
|
{ N_("Supplementary Private Use Area-B"), 0x100000, 0x10ffff }
|
||||||
|
};
|
||||||
|
|
||||||
|
const int no_blocks = sizeof(unicode_blocks) / sizeof(UnicodeBlocks);
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
|
GuiSymbols::GuiSymbols(GuiView & lv)
|
||||||
|
: DialogView(lv, "symbols", qt_("Symbols")), encoding_("ascii")
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
|
||||||
|
setFocusProxy(symbolsLW);
|
||||||
|
|
||||||
|
symbolsLW->setViewMode(QListView::IconMode);
|
||||||
|
symbolsLW->setUniformItemSizes(true);
|
||||||
|
// increase the display size of the symbols a bit
|
||||||
|
QFont font= symbolsLW->font();
|
||||||
|
int size = font.pointSize() + 3;
|
||||||
|
font.setPointSize(size);
|
||||||
|
symbolsLW->setFont(font);
|
||||||
|
|
||||||
|
okPB->setEnabled(!chosenLE->text().isEmpty() &&
|
||||||
|
!bufferview()->buffer().isReadonly());
|
||||||
|
applyPB->setEnabled(!chosenLE->text().isEmpty() &&
|
||||||
|
!bufferview()->buffer().isReadonly());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::updateView()
|
||||||
|
{
|
||||||
|
chosenLE->clear();
|
||||||
|
initialiseParams(bufferview()->cursor().getEncoding()->name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_applyPB_clicked()
|
||||||
|
{
|
||||||
|
dispatchParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_okPB_clicked()
|
||||||
|
{
|
||||||
|
dispatchParams();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_closePB_clicked()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_symbolsLW_itemActivated(QListWidgetItem *)
|
||||||
|
{
|
||||||
|
on_okPB_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_chosenLE_textChanged(QString const & text)
|
||||||
|
{
|
||||||
|
okPB->setEnabled(!text.isEmpty() && !bufferview()->buffer().isReadonly());
|
||||||
|
applyPB->setEnabled(!text.isEmpty() && !bufferview()->buffer().isReadonly());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_chosenLE_returnPressed()
|
||||||
|
{
|
||||||
|
on_okPB_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_symbolsLW_itemClicked(QListWidgetItem * item)
|
||||||
|
{
|
||||||
|
QString const text = item->text();
|
||||||
|
if (text.isEmpty())
|
||||||
|
return;
|
||||||
|
chosenLE->insert(text);
|
||||||
|
QString const category = getBlock(text.data()->unicode());
|
||||||
|
categoryCO->setCurrentIndex(categoryCO->findText(category));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::on_categoryCO_activated(QString const & text)
|
||||||
|
{
|
||||||
|
if (used_blocks.find(text) != used_blocks.end())
|
||||||
|
symbolsLW->scrollToItem(used_blocks[text]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::updateSymbolList()
|
||||||
|
{
|
||||||
|
symbolsLW->clear();
|
||||||
|
used_blocks.clear();
|
||||||
|
categoryCO->clear();
|
||||||
|
|
||||||
|
typedef set<char_type> SymbolsList;
|
||||||
|
Encoding enc = *(encodings.getFromLyXName(encoding_));
|
||||||
|
SymbolsList symbols = enc.getSymbolsList();
|
||||||
|
|
||||||
|
SymbolsList::const_iterator const end = symbols.end();
|
||||||
|
for (SymbolsList::const_iterator it = symbols.begin(); it != end; ++it) {
|
||||||
|
char_type c = *it;
|
||||||
|
// we do not want control or space characters
|
||||||
|
if (QChar(c).category() == QChar::Other_Control ||
|
||||||
|
QChar(c).category() == QChar::Separator_Space)
|
||||||
|
continue;
|
||||||
|
QListWidgetItem * lwi = new QListWidgetItem(QChar(c));
|
||||||
|
lwi->setTextAlignment(Qt::AlignCenter);
|
||||||
|
symbolsLW->addItem(lwi);
|
||||||
|
QString block = getBlock(c);
|
||||||
|
if (used_blocks.find(block) == used_blocks.end())
|
||||||
|
used_blocks[block] = lwi;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update category combo
|
||||||
|
for (UsedBlocks::iterator it = used_blocks.begin(); it != used_blocks.end(); ++it) {
|
||||||
|
categoryCO->addItem(it->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString const GuiSymbols::getBlock(char_type c) const
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while (c > unicode_blocks[i].end && i < no_blocks)
|
||||||
|
++i;
|
||||||
|
if (unicode_blocks[i].name)
|
||||||
|
return toqstr(unicode_blocks[i].name);
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiSymbols::initialiseParams(string const & data)
|
||||||
|
{
|
||||||
|
if (data == encoding_)
|
||||||
|
// everything up to date
|
||||||
|
return true;
|
||||||
|
if (!data.empty())
|
||||||
|
encoding_ = data;
|
||||||
|
updateSymbolList();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiSymbols::dispatchParams()
|
||||||
|
{
|
||||||
|
dispatch(FuncRequest(LFUN_SELF_INSERT, fromqstr(chosenLE->text())));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Dialog * createGuiSymbols(GuiView & lv)
|
||||||
|
{
|
||||||
|
return new GuiSymbols(lv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace frontend
|
||||||
|
} // namespace lyx
|
||||||
|
|
||||||
|
#include "GuiSymbols_moc.cpp"
|
67
src/frontends/qt4/GuiSymbols.h
Normal file
67
src/frontends/qt4/GuiSymbols.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
/**
|
||||||
|
* \file GuiSymbols.h
|
||||||
|
* This file is part of LyX, the document processor.
|
||||||
|
* Licence details can be found in the file COPYING.
|
||||||
|
*
|
||||||
|
* \author Jürgen Spitzmüller
|
||||||
|
*
|
||||||
|
* Full author contact details are available in file CREDITS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GUISYMBOLSDIALOG_H
|
||||||
|
#define GUISYMBOLSDIALOG_H
|
||||||
|
|
||||||
|
#include "DialogView.h"
|
||||||
|
#include "ui_SymbolsUi.h"
|
||||||
|
#include "Encoding.h"
|
||||||
|
|
||||||
|
class QListWidgetItem;
|
||||||
|
class Encoding;
|
||||||
|
|
||||||
|
namespace lyx {
|
||||||
|
namespace frontend {
|
||||||
|
|
||||||
|
class GuiSymbols : public DialogView, public Ui::SymbolsUi
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GuiSymbols(GuiView & lv);
|
||||||
|
|
||||||
|
/// Dialog inherited methods
|
||||||
|
//@{
|
||||||
|
void updateView();
|
||||||
|
void dispatchParams();
|
||||||
|
bool initialiseParams(std::string const & data);
|
||||||
|
void clearParams() {}
|
||||||
|
bool isBufferDependent() const { return true; }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void on_applyPB_clicked();
|
||||||
|
void on_okPB_clicked();
|
||||||
|
void on_closePB_clicked();
|
||||||
|
void on_symbolsLW_itemActivated(QListWidgetItem *);
|
||||||
|
void on_symbolsLW_itemClicked(QListWidgetItem * item);
|
||||||
|
void on_categoryCO_activated(QString const & text);
|
||||||
|
void on_chosenLE_returnPressed();
|
||||||
|
void on_chosenLE_textChanged(QString const &);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// update the widgets (symbol browser, category combo)
|
||||||
|
void updateSymbolList();
|
||||||
|
/// get the unicode block associated with \p c
|
||||||
|
QString const getBlock(char_type c) const;
|
||||||
|
/// the encoding at cursor position
|
||||||
|
std::string encoding_;
|
||||||
|
/// which blocks do we actually include?
|
||||||
|
typedef std::map<QString, QListWidgetItem *> UsedBlocks;
|
||||||
|
///
|
||||||
|
UsedBlocks used_blocks;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace frontend
|
||||||
|
} // namespace lyx
|
||||||
|
|
||||||
|
#endif // GUISYMBOLSDIALOG_H
|
@ -981,6 +981,14 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd)
|
|||||||
enable = ic != ERT_CODE && ic != LISTINGS_CODE;
|
enable = ic != ERT_CODE && ic != LISTINGS_CODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (name == "symbols") {
|
||||||
|
if (!view() || view()->cursor().inMathed())
|
||||||
|
enable = false;
|
||||||
|
else {
|
||||||
|
InsetCode ic = view()->cursor().inset().lyxCode();
|
||||||
|
enable = ic != ERT_CODE && ic != LISTINGS_CODE;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (name == "latexlog")
|
else if (name == "latexlog")
|
||||||
enable = FileName(buf->logName()).isReadableFile();
|
enable = FileName(buf->logName()).isReadableFile();
|
||||||
else if (name == "spellchecker")
|
else if (name == "spellchecker")
|
||||||
@ -1767,6 +1775,10 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
string const data = "vc " +
|
string const data = "vc " +
|
||||||
Lexer::quoteString(buffer()->lyxvc().getLogFile());
|
Lexer::quoteString(buffer()->lyxvc().getLogFile());
|
||||||
showDialog("log", data);
|
showDialog("log", data);
|
||||||
|
} else if (name == "symbols") {
|
||||||
|
data = bv->cursor().getEncoding()->name();
|
||||||
|
if (!data.empty())
|
||||||
|
showDialog("symbols", data);
|
||||||
} else
|
} else
|
||||||
showDialog(name, data);
|
showDialog(name, data);
|
||||||
break;
|
break;
|
||||||
@ -1836,8 +1848,8 @@ char const * const dialognames[] = {
|
|||||||
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
|
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
|
||||||
"citation", "document", "embedding", "errorlist", "ert", "external", "file",
|
"citation", "document", "embedding", "errorlist", "ert", "external", "file",
|
||||||
"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
|
"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
|
||||||
"mathdelimiter", "mathmatrix", "note", "paragraph",
|
"mathdelimiter", "mathmatrix", "note", "paragraph", "prefs", "print",
|
||||||
"prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
|
"ref", "sendto", "spellchecker", "symbols", "tabular", "tabularcreate",
|
||||||
|
|
||||||
#ifdef HAVE_LIBAIKSAURUS
|
#ifdef HAVE_LIBAIKSAURUS
|
||||||
"thesaurus",
|
"thesaurus",
|
||||||
@ -2064,6 +2076,7 @@ Dialog * createGuiSearch(GuiView & lv);
|
|||||||
Dialog * createGuiSendTo(GuiView & lv);
|
Dialog * createGuiSendTo(GuiView & lv);
|
||||||
Dialog * createGuiShowFile(GuiView & lv);
|
Dialog * createGuiShowFile(GuiView & lv);
|
||||||
Dialog * createGuiSpellchecker(GuiView & lv);
|
Dialog * createGuiSpellchecker(GuiView & lv);
|
||||||
|
Dialog * createGuiSymbols(GuiView & lv);
|
||||||
Dialog * createGuiTabularCreate(GuiView & lv);
|
Dialog * createGuiTabularCreate(GuiView & lv);
|
||||||
Dialog * createGuiTabular(GuiView & lv);
|
Dialog * createGuiTabular(GuiView & lv);
|
||||||
Dialog * createGuiTexInfo(GuiView & lv);
|
Dialog * createGuiTexInfo(GuiView & lv);
|
||||||
@ -2141,6 +2154,8 @@ Dialog * GuiView::build(string const & name)
|
|||||||
return createGuiSendTo(*this);
|
return createGuiSendTo(*this);
|
||||||
if (name == "spellchecker")
|
if (name == "spellchecker")
|
||||||
return createGuiSpellchecker(*this);
|
return createGuiSpellchecker(*this);
|
||||||
|
if (name == "symbols")
|
||||||
|
return createGuiSymbols(*this);
|
||||||
if (name == "tabular")
|
if (name == "tabular")
|
||||||
return createGuiTabular(*this);
|
return createGuiTabular(*this);
|
||||||
if (name == "tabularcreate")
|
if (name == "tabularcreate")
|
||||||
|
@ -110,6 +110,7 @@ SOURCEFILES = \
|
|||||||
GuiSetBorder.cpp \
|
GuiSetBorder.cpp \
|
||||||
GuiShowFile.cpp \
|
GuiShowFile.cpp \
|
||||||
GuiSpellchecker.cpp \
|
GuiSpellchecker.cpp \
|
||||||
|
GuiSymbols.cpp \
|
||||||
GuiTabular.cpp \
|
GuiTabular.cpp \
|
||||||
GuiTabularCreate.cpp \
|
GuiTabularCreate.cpp \
|
||||||
GuiTexinfo.cpp \
|
GuiTexinfo.cpp \
|
||||||
@ -198,6 +199,7 @@ MOCHEADER = \
|
|||||||
GuiSetBorder.h \
|
GuiSetBorder.h \
|
||||||
GuiShowFile.h \
|
GuiShowFile.h \
|
||||||
GuiSpellchecker.h \
|
GuiSpellchecker.h \
|
||||||
|
GuiSymbols.h \
|
||||||
GuiTabularCreate.h \
|
GuiTabularCreate.h \
|
||||||
GuiTabular.h \
|
GuiTabular.h \
|
||||||
GuiTexinfo.h \
|
GuiTexinfo.h \
|
||||||
@ -286,6 +288,7 @@ UIFILES = \
|
|||||||
ShortcutUi.ui \
|
ShortcutUi.ui \
|
||||||
ShowFileUi.ui \
|
ShowFileUi.ui \
|
||||||
SpellcheckerUi.ui \
|
SpellcheckerUi.ui \
|
||||||
|
SymbolsUi.ui \
|
||||||
TabularCreateUi.ui \
|
TabularCreateUi.ui \
|
||||||
TabularUi.ui \
|
TabularUi.ui \
|
||||||
TexinfoUi.ui \
|
TexinfoUi.ui \
|
||||||
|
182
src/frontends/qt4/ui/SymbolsUi.ui
Normal file
182
src/frontends/qt4/ui/SymbolsUi.ui
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
<ui version="4.0" >
|
||||||
|
<class>SymbolsUi</class>
|
||||||
|
<widget class="QDialog" name="SymbolsUi" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>486</width>
|
||||||
|
<height>338</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>300</width>
|
||||||
|
<height>330</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize" >
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="sizeGripEnabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="categoryLA" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Ca&tegory:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy" >
|
||||||
|
<cstring>categoryCO</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="categoryCO" />
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>301</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2" >
|
||||||
|
<widget class="QListWidget" name="symbolsLW" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize" >
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy" >
|
||||||
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize" >
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode" >
|
||||||
|
<enum>QListView::Adjust</enum>
|
||||||
|
</property>
|
||||||
|
<property name="spacing" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="currentRow" >
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2" >
|
||||||
|
<widget class="QLineEdit" name="chosenLE" >
|
||||||
|
<property name="readOnly" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType" >
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>211</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="okPB" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="applyPB" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Insert the delimiters</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Apply</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="closePB" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="9" />
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>applyPB</tabstop>
|
||||||
|
<tabstop>closePB</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<includes>
|
||||||
|
<include location="local" >qt_helpers.h</include>
|
||||||
|
</includes>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue
Block a user