Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 : #include "specialcharactersdialog.h"
23 :
24 : #include <QListWidget>
25 : #include <QSplitter>
26 :
27 : #include "palettewidget.h"
28 :
29 : #include "translation.h"
30 :
31 : #include "engraving/dom/masterscore.h"
32 : #include "engraving/dom/score.h"
33 : #include "engraving/dom/symbol.h"
34 : #include "engraving/types/symnames.h"
35 : #include "engraving/infrastructure/smufl.h"
36 :
37 : #include "notation/inotation.h"
38 : #include "notation/inotationinteraction.h"
39 :
40 : #include "ui/view/widgetstatestore.h"
41 :
42 : static const QString SPECIAL_CHARACTERS_DIALOG_NAME("SpecialCharactersDialog");
43 :
44 : using namespace mu::engraving;
45 : using namespace mu::notation;
46 : using namespace mu::palette;
47 : using namespace muse::ui;
48 :
49 : static constexpr SymId commonScoreSymbols[] = {
50 : SymId::accidentalFlat,
51 : SymId::accidentalNatural,
52 : SymId::accidentalSharp,
53 : SymId::accidentalDoubleFlat,
54 : SymId::accidentalDoubleSharp,
55 : SymId::metNoteWhole,
56 : SymId::metNoteHalfUp,
57 : SymId::metNoteQuarterUp,
58 : SymId::metNote8thUp,
59 : SymId::metNote16thUp,
60 : SymId::metNote32ndUp,
61 : SymId::metNote64thUp,
62 : SymId::metNote128thUp,
63 : SymId::metAugmentationDot,
64 : SymId::tuplet3,
65 : SymId::restWholeLegerLine,
66 : SymId::restHalfLegerLine,
67 : SymId::restQuarter,
68 : SymId::rest8th,
69 : SymId::rest16th,
70 : SymId::rest32nd,
71 : SymId::rest64th,
72 : SymId::rest128th,
73 : SymId::segno,
74 : SymId::coda,
75 : SymId::segnoSerpent1,
76 : SymId::codaSquare,
77 : SymId::repeat1Bar,
78 : SymId::repeat2Bars,
79 : SymId::repeat4Bars,
80 : SymId::gClef,
81 : SymId::fClef,
82 : SymId::cClef,
83 : SymId::lyricsElisionNarrow,
84 : SymId::lyricsElision,
85 : SymId::lyricsElisionWide,
86 : SymId::dynamicPiano,
87 : SymId::dynamicMezzo,
88 : SymId::dynamicForte,
89 : SymId::dynamicNiente,
90 : SymId::dynamicRinforzando,
91 : SymId::dynamicSforzando,
92 : SymId::dynamicZ,
93 : SymId::space
94 : };
95 :
96 : struct UnicodeRange {
97 : char32_t first;
98 : char32_t last;
99 : const char* name;
100 : };
101 : static constexpr UnicodeRange unicodeRanges[] = {
102 : //: For strings in the "palette/unicodeRanges" context,
103 : //: it may help to refer to https://en.wikipedia.org/wiki/Unicode_block
104 : //: or translated versions of this resource.
105 : { 0x0020, 0x007F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Basic Latin") }, // leaving out the first 32 non-printable characters
106 : { 0x0080, 0x00FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Latin-1 Supplement") },
107 : { 0x0100, 0x017F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Latin Extended-A") },
108 : { 0x0180, 0x024F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Latin Extended-B") },
109 : { 0x0250, 0x02AF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "IPA Extensions") },
110 : { 0x02B0, 0x02FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Spacing Modifier Letters") },
111 : { 0x0300, 0x036F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Combining Diacritical Marks") },
112 : { 0x0370, 0x03FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Greek and Coptic") },
113 : { 0x0400, 0x04FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cyrillic") },
114 : { 0x0500, 0x052F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cyrillic Supplement") },
115 : { 0x0530, 0x058F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Armenian") },
116 : { 0x0590, 0x05FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hebrew") },
117 : { 0x0600, 0x06FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Arabic") },
118 : { 0x0700, 0x074F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Syriac") },
119 : { 0x0750, 0x077F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Arabic Supplement") },
120 : { 0x0780, 0x07BF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Thaana") },
121 : { 0x07C0, 0x07FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "NKo") },
122 : { 0x0800, 0x083F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Samaritan") },
123 : { 0x0840, 0x085F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mandaic") },
124 : { 0x0860, 0x086F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Syriac Supplement") },
125 : { 0x08A0, 0x08FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Arabic Extended-A") },
126 : { 0x0900, 0x097F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Devanagari") },
127 : { 0x0980, 0x09FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Bengali") },
128 : { 0x0A00, 0x0A7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Gurmukhi") },
129 : { 0x0A80, 0x0AFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Gujarati") },
130 : { 0x0B00, 0x0B7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Oriya") },
131 : { 0x0B80, 0x0BFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tamil") },
132 : { 0x0C00, 0x0C7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Telugu") },
133 : { 0x0C80, 0x0CFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kannada") },
134 : { 0x0D00, 0x0D7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Malayalam") },
135 : { 0x0D80, 0x0DFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sinhala") },
136 : { 0x0E00, 0x0E7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Thai") },
137 : { 0x0E80, 0x0EFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Lao") },
138 : { 0x0F00, 0x0FFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tibetan") },
139 : { 0x1000, 0x109F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Myanmar") },
140 : { 0x10A0, 0x10FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Georgian") },
141 : { 0x1100, 0x11FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hangul Jamo") },
142 : { 0x1200, 0x137F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ethiopic") },
143 : { 0x1380, 0x139F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ethiopic Supplement") },
144 : { 0x13A0, 0x13FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cherokee") },
145 : { 0x1400, 0x167F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Unified Canadian Aboriginal Syllabics") },
146 : { 0x1680, 0x169F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ogham") },
147 : { 0x16A0, 0x16FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Runic") },
148 : { 0x1700, 0x171F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tagalog") },
149 : { 0x1720, 0x173F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hanunoo") },
150 : { 0x1740, 0x175F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Buhid") },
151 : { 0x1760, 0x177F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tagbanwa") },
152 : { 0x1780, 0x17FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Khmer") },
153 : { 0x1800, 0x18AF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mongolian") },
154 : { 0x18B0, 0x18FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Unified Canadian Aboriginal Syllabics Extended") },
155 : { 0x1900, 0x194F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Limbu") },
156 : { 0x1950, 0x197F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tai Le") },
157 : { 0x1980, 0x19DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "New Tai Lue") },
158 : { 0x19E0, 0x19FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Khmer Symbols") },
159 : { 0x1A00, 0x1A1F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Buginese") },
160 : { 0x1A20, 0x1AAF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tai Tham") },
161 : { 0x1AB0, 0x1AFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Combining Diacritical Marks Extended") },
162 : { 0x1B00, 0x1B7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Balinese") },
163 : { 0x1B80, 0x1BBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sundanese") },
164 : { 0x1BC0, 0x1BFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Batak") },
165 : { 0x1C00, 0x1C4F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Lepcha") },
166 : { 0x1C50, 0x1C7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ol Chiki") },
167 : { 0x1C80, 0x1C8F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cyrillic Extended-C") },
168 : { 0x1C90, 0x1CBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Georgian Extended") },
169 : { 0x1CC0, 0x1CCF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sundanese Supplement") },
170 : { 0x1CD0, 0x1CFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Vedic Extensions") },
171 : { 0x1D00, 0x1D7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Phonetic Extensions") },
172 : { 0x1D80, 0x1DBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Phonetic Extensions Supplement") },
173 : { 0x1DC0, 0x1DFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Combining Diacritical Marks Supplement") },
174 : { 0x1E00, 0x1EFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Latin Extended Additional") },
175 : { 0x1F00, 0x1FFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Greek Extended") },
176 : { 0x2000, 0x206F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "General Punctuation") },
177 : { 0x2070, 0x209F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Superscripts and Subscripts") },
178 : { 0x20A0, 0x20CF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Currency Symbols") },
179 : { 0x20D0, 0x20FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Combining Diacritical Marks for Symbols") },
180 : { 0x2100, 0x214F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Letterlike Symbols") },
181 : { 0x2150, 0x218F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Number Forms") },
182 : { 0x2190, 0x21FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Arrows") },
183 : { 0x2200, 0x22FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mathematical Operators") },
184 : { 0x2300, 0x23FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Miscellaneous Technical") },
185 : { 0x2400, 0x243F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Control Pictures") },
186 : { 0x2440, 0x245F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Optical Character Recognition") },
187 : { 0x2460, 0x24FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Enclosed Alphanumerics") },
188 : { 0x2500, 0x257F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Box Drawing") },
189 : { 0x2580, 0x259F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Block Elements") },
190 : { 0x25A0, 0x25FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Geometric Shapes") },
191 : { 0x2600, 0x26FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Miscellaneous Symbols") },
192 : { 0x2700, 0x27BF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Dingbats") },
193 : { 0x27C0, 0x27EF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Miscellaneous Mathematical Symbols-A") },
194 : { 0x27F0, 0x27FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplemental Arrows-A") },
195 : { 0x2800, 0x28FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Braille Patterns") },
196 : { 0x2900, 0x297F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplemental Arrows-B") },
197 : { 0x2980, 0x29FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Miscellaneous Mathematical Symbols-B") },
198 : { 0x2A00, 0x2AFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplemental Mathematical Operators") },
199 : { 0x2B00, 0x2BFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Miscellaneous Symbols and Arrows") },
200 : { 0x2C00, 0x2C5F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Glagolitic") },
201 : { 0x2C60, 0x2C7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Latin Extended-C") },
202 : { 0x2C80, 0x2CFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Coptic") },
203 : { 0x2D00, 0x2D2F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Georgian Supplement") },
204 : { 0x2D30, 0x2D7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tifinagh") },
205 : { 0x2D80, 0x2DDF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ethiopic Extended") },
206 : { 0x2DE0, 0x2DFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cyrillic Extended-A") },
207 : { 0x2E00, 0x2E7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplemental Punctuation") },
208 : { 0x2E80, 0x2EFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Radicals Supplement") },
209 : { 0x2F00, 0x2FDF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kangxi Radicals") },
210 : { 0x2FF0, 0x2FFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ideographic Description Characters") },
211 : { 0x3000, 0x303F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Symbols and Punctuation") },
212 : { 0x3040, 0x309F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hiragana") },
213 : { 0x30A0, 0x30FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Katakana") },
214 : { 0x3100, 0x312F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Bopomofo") },
215 : { 0x3130, 0x318F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hangul Compatibility Jamo") },
216 : { 0x3190, 0x319F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kanbun") },
217 : { 0x31A0, 0x31BF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Bopomofo Extended") },
218 : { 0x31C0, 0x31EF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Strokes") },
219 : { 0x31F0, 0x31FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Katakana Phonetic Extensions") },
220 : { 0x3200, 0x32FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Enclosed CJK Letters and Months") },
221 : { 0x3300, 0x33FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Compatibility") },
222 : { 0x3400, 0x4DB5, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Unified Ideographs Extension A") },
223 : { 0x4DC0, 0x4DFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Yijing Hexagram Symbols") },
224 : { 0x4E00, 0x9FCC, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Unified Ideographs") },
225 : { 0xA000, 0xA48F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Yi Syllables") },
226 : { 0xA490, 0xA4CF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Yi Radicals") },
227 : { 0xA4D0, 0xA4FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Lisu") },
228 : { 0xA500, 0xA63F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Vai") },
229 : { 0xA640, 0xA69F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cyrillic Extended-B") },
230 : { 0xA6A0, 0xA6FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Bamum") },
231 : { 0xA700, 0xA71F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Modifier Tone Letters") },
232 : { 0xA720, 0xA7FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Latin Extended-D") },
233 : { 0xA800, 0xA82F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Syloti Nagri") },
234 : { 0xA830, 0xA83F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Common Indic Number Forms") },
235 : { 0xA840, 0xA87F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Phags-pa") },
236 : { 0xA880, 0xA8DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Saurashtra") },
237 : { 0xA8E0, 0xA8FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Devanagari Extended") },
238 : { 0xA900, 0xA92F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kayah Li") },
239 : { 0xA930, 0xA95F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Rejang") },
240 : { 0xA960, 0xA97F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hangul Jamo Extended-A") },
241 : { 0xA980, 0xA9DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Javanese") },
242 : { 0xA9E0, 0xA9FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Myanmar Extended-B") },
243 : { 0xAA00, 0xAA5F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cham") },
244 : { 0xAA60, 0xAA7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Myanmar Extended-A") },
245 : { 0xAA80, 0xAADF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tai Viet") },
246 : { 0xAAE0, 0xAAFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Meetei Mayek Extensions") },
247 : { 0xAB00, 0xAB2F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ethiopic Extended-A") },
248 : { 0xAB30, 0xAB6F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Latin Extended-E") },
249 : { 0xAB70, 0xABBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cherokee Supplement") },
250 : { 0xABC0, 0xABFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Meetei Mayek") },
251 : { 0xAC00, 0xD7A3, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hangul Syllables") },
252 : { 0xD7B0, 0xD7FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hangul Jamo Extended-B") },
253 : { 0xD800, 0xDB7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "High Surrogates") },
254 : { 0xDB80, 0xDBFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "High Private Use Surrogates") },
255 : { 0xDC00, 0xDFFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Low Surrogates") },
256 : { 0xE000, 0xF8FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Private Use Area"), },
257 : { 0xF900, 0xFAFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Compatibility Ideographs"), },
258 : { 0xFB00, 0xFB4F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Alphabetic Presentation Forms"), },
259 : { 0xFB50, 0xFDFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Arabic Presentation Forms-A"), },
260 : { 0xFE00, 0xFE0F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Variation Selectors"), },
261 : { 0xFE10, 0xFE1F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Vertical Forms"), },
262 : { 0xFE20, 0xFE2F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Combining Half Marks"), },
263 : { 0xFE30, 0xFE4F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Compatibility Forms"), },
264 : { 0xFE50, 0xFE6F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Small Form Variants"), },
265 : { 0xFE70, 0xFEFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Arabic Presentation Forms-B"), },
266 : { 0xFF00, 0xFFEF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Halfwidth and Fullwidth Forms"), },
267 : { 0xFFF0, 0xFFFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Specials"), },
268 : { 0x10000, 0x1007F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Linear B Syllabary") },
269 : { 0x10080, 0x100FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Linear B Ideograms") },
270 : { 0x10100, 0x1013F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Aegean Numbers") },
271 : { 0x10140, 0x1018F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ancient Greek Numbers") },
272 : { 0x10190, 0x101CF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ancient Symbols") },
273 : { 0x101D0, 0x101FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Phaistos Disc") },
274 : { 0x10280, 0x1029F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Lycian") },
275 : { 0x102A0, 0x102DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Carian") },
276 : { 0x102E0, 0x102FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Coptic Epact Numbers") },
277 : { 0x10300, 0x1032F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old Italic") },
278 : { 0x10330, 0x1034F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Gothic") },
279 : { 0x10350, 0x1037F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old Permic") },
280 : { 0x10380, 0x1039F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ugaritic") },
281 : { 0x103A0, 0x103DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old Persian") },
282 : { 0x10400, 0x1044F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Deseret") },
283 : { 0x10450, 0x1047F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Shavian") },
284 : { 0x10480, 0x104AF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Osmanya") },
285 : { 0x104B0, 0x104FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Osage") },
286 : { 0x10500, 0x1052F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Elbasan") },
287 : { 0x10530, 0x1056F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Caucasian Albanian") },
288 : { 0x10600, 0x1077F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Linear A") },
289 : { 0x10800, 0x1083F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cypriot Syllabary") },
290 : { 0x10840, 0x1085F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Imperial Aramaic") },
291 : { 0x10860, 0x1087F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Palmyrene") },
292 : { 0x10880, 0x108AF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Nabataean") },
293 : { 0x108E0, 0x108EF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hatran") },
294 : { 0x10900, 0x1091F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Phoenician") },
295 : { 0x10920, 0x1093F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Lydian") },
296 : { 0x10980, 0x1099F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Meroitic Hieroglyphs") },
297 : { 0x109A0, 0x109FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Meroitic Cursive") },
298 : { 0x10A00, 0x10A5F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kharoshthi") },
299 : { 0x10A60, 0x10A7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old South Arabian") },
300 : { 0x10A80, 0x10A9F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old North Arabian") },
301 : { 0x10AC0, 0x10AFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Manichaean") },
302 : { 0x10B00, 0x10B3F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Avestan") },
303 : { 0x10B40, 0x10B5F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Inscriptional Parthian") },
304 : { 0x10B60, 0x10B7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Inscriptional Pahlavi") },
305 : { 0x10B80, 0x10BAF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Psalter Pahlavi") },
306 : { 0x10C00, 0x10C4F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old Turkic") },
307 : { 0x10C80, 0x10CFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old Hungarian") },
308 : { 0x10D00, 0x10D3F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Hanifi Rohingya") },
309 : { 0x10E60, 0x10E7F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Rumi Numeral Symbols") },
310 : { 0x10E80, 0x10EBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Yezidi") },
311 : { 0x10F00, 0x10F2F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Old Sogdian") },
312 : { 0x10F30, 0x10F6F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sogdian") },
313 : { 0x10FB0, 0x10FDF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Chorasmian") },
314 : { 0x10FE0, 0x10FFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Elymaic") },
315 : { 0x11000, 0x1107F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Brahmi") },
316 : { 0x11080, 0x110CF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kaithi") },
317 : { 0x110D0, 0x110FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sora Sompeng") },
318 : { 0x11100, 0x1114F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Chakma") },
319 : { 0x11150, 0x1117F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mahajani") },
320 : { 0x11180, 0x111DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sharada") },
321 : { 0x111E0, 0x111FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sinhala Archaic Numbers") },
322 : { 0x11200, 0x1124F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Khojki") },
323 : { 0x11280, 0x112AF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Multani") },
324 : { 0x112B0, 0x112FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Khudawadi") },
325 : { 0x11300, 0x1137F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Grantha") },
326 : { 0x11400, 0x1147F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Newa") },
327 : { 0x11480, 0x114DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tirhuta") },
328 : { 0x11580, 0x115FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Siddham") },
329 : { 0x11600, 0x1165F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Modi") },
330 : { 0x11660, 0x1167F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mongolian Supplement") },
331 : { 0x11680, 0x116CF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Takri") },
332 : { 0x11700, 0x1173F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ahom") },
333 : { 0x11800, 0x1184F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Dogra") },
334 : { 0x118A0, 0x118FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Warang Citi") },
335 : { 0x11900, 0x1195F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Dives Akuru") },
336 : { 0x116A0, 0x119FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Nandinagari") },
337 : { 0x11A00, 0x11A4F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Zanabazer Square") },
338 : { 0x11A50, 0x11AAF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Soyombo") },
339 : { 0x11AC0, 0x11AFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Pau Cin Hau") },
340 : { 0x11C00, 0x11C6F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Bhaiksuki") },
341 : { 0x11C70, 0x11CBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Marchen") },
342 : { 0x11D00, 0x11D5F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Masaram Gondi") },
343 : { 0x11D60, 0x11DAF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Gunjala Gondi") },
344 : { 0x11EE0, 0x11EFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Makasar") },
345 : { 0x11FB0, 0x11FBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Lisu Supplement") },
346 : { 0x11FC0, 0x11FFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tamil Supplement") },
347 : { 0x12000, 0x123FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cuneiform") },
348 : { 0x12400, 0x1247F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Cuneiform Numbers and Punctuation") },
349 : { 0x12480, 0x1254F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Early Dynastic Cuneiform") },
350 : { 0x13000, 0x1342F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Egyptian Hieroglyphs") },
351 : { 0x13430, 0x1343F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Egyptian Hieroglyph Format Controls") },
352 : { 0x14400, 0x1467F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Anatolian Hieroglyphs") },
353 : { 0x16800, 0x16A3F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Bamum Supplement") },
354 : { 0x16A40, 0x16A6F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mro") },
355 : { 0x16AD0, 0x16AFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Bassa Vah") },
356 : { 0x16B00, 0x16B8F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Pahawh Hmong") },
357 : { 0x16E40, 0x16E9F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Medefaidrin") },
358 : { 0x16F00, 0x16F9F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Miao") },
359 : { 0x16FE0, 0x16FFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ideographic Symbols and Punctuation") },
360 : { 0x18800, 0x18AFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tangut Components") },
361 : { 0x18B00, 0x16CFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Khitan Small Script") },
362 : { 0x18D00, 0x16D8F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tangut Supplement") },
363 : { 0x1B000, 0x1B0FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kana Supplement") },
364 : { 0x1B100, 0x1B12F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Kana Extended-A") },
365 : { 0x1B130, 0x1B16F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Small Kana Extension") },
366 : { 0x1B170, 0x1B2FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Nushu") },
367 : { 0x1BC00, 0x1BC9F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Duployan") },
368 : { 0x1BCA0, 0x1BCAF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Shorthand Format Controls") },
369 : { 0x1D000, 0x1D0FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Byzantine Musical Symbols") },
370 : { 0x1D100, 0x1D1FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Musical Symbols") },
371 : { 0x1D200, 0x1D24F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ancient Greek Musical Notation") },
372 : { 0x1D300, 0x1D35F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tai Xuan Jing Symbols") },
373 : { 0x1D360, 0x1D37F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Counting Rod Numerals") },
374 : { 0x1D400, 0x1D7FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mathematical Alphanumeric Symbols") },
375 : { 0x1D800, 0x1DAAF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Sutton SignWriting") },
376 : { 0x1E000, 0x1E02F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Glagolitic Supplement") },
377 : { 0x1E100, 0x1E14F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Nyiakeng Puachue Hmong") },
378 : { 0x1E2C0, 0x1E2FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Wancho") },
379 : { 0x1E800, 0x1E8DF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mende Kikakui") },
380 : { 0x1E900, 0x1E95F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Adlam") },
381 : { 0x1EC70, 0x1ECBF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Indic Siyaq Numbers") },
382 : { 0x1ED00, 0x1ED4F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ottoman Siyaq Numbers") },
383 : { 0x1EE00, 0x1EEFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Arabic Mathematical Alphabetic Symbols") },
384 : { 0x1F000, 0x1F02F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Mahjong Tiles") },
385 : { 0x1F030, 0x1F09F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Domino Tiles") },
386 : { 0x1F0A0, 0x1F0FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Playing Cards") },
387 : { 0x1F100, 0x1F1FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Enclosed Alphanumeric Supplement") },
388 : { 0x1F200, 0x1F2FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Enclosed Ideographic Supplement") },
389 : { 0x1F300, 0x1F5FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Miscellaneous Symbols and Pictographs") },
390 : { 0x1F600, 0x1F64F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Emoticons (Emoji)") },
391 : { 0x1F650, 0x1F67F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Ornamental Dingbats") },
392 : { 0x1F680, 0x1F6FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Transport and Map Symbols") },
393 : { 0x1F700, 0x1F77F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Alchemical Symbols") },
394 : { 0x1F780, 0x1F7FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Geometric Shapes Extended") },
395 : { 0x1F800, 0x1F8FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplemental Arrows-C") },
396 : { 0x1F900, 0x1F9FF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplemental Symbols and Pictographs") },
397 : { 0x1FA00, 0x1FA6F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Chess Symbols") },
398 : { 0x1FA70, 0x1FAFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Symbols and Pictographs Extended-A") },
399 : { 0x1FB00, 0x1FBFF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Symbols for Legacy Computing") },
400 : { 0x20000, 0x2A6D6, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Unified Ideographs Extension B") },
401 : { 0x2A700, 0x2B734, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Unified Ideographs Extension C") },
402 : { 0x2B740, 0x2B81D, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Unified Ideographs Extension D") },
403 : { 0x2F800, 0x2F81D, QT_TRANSLATE_NOOP("palette/unicodeRanges", "CJK Compatibility Ideographs Supplement") },
404 : { 0xE0001, 0xE007F, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Tags") },
405 : { 0xE0100, 0xE01EF, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Variation Selectors Supplement") },
406 : { 0xF0000, 0xFFFFD, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplementary Private Use Area-A") },
407 : { 0x100000, 0x10FFFD, QT_TRANSLATE_NOOP("palette/unicodeRanges", "Supplementary Private Use Area-B") }
408 : };
409 :
410 : //---------------------------------------------------------
411 : // SpecialCharactersDialog
412 : //---------------------------------------------------------
413 :
414 0 : SpecialCharactersDialog::SpecialCharactersDialog(QWidget* parent)
415 0 : : TopLevelDialog(parent)
416 : {
417 0 : setObjectName(SPECIAL_CHARACTERS_DIALOG_NAME);
418 0 : setWindowFlags(Qt::Tool);
419 0 : setupUi(this);
420 :
421 0 : m_pCommon = new PaletteWidget;
422 0 : m_pCommon->setMag(0.8);
423 0 : m_pCommon->setGridSize(33, 60);
424 0 : m_pCommon->setReadOnly(true);
425 :
426 0 : m_pSmufl = new PaletteWidget;
427 0 : m_pSmufl->setMag(0.8);
428 0 : m_pSmufl->setGridSize(33, 60);
429 0 : m_pSmufl->setReadOnly(true);
430 :
431 0 : m_pUnicode = new PaletteWidget;
432 0 : m_pUnicode->setMag(0.8);
433 0 : m_pUnicode->setGridSize(33, 60);
434 0 : m_pUnicode->setReadOnly(true);
435 :
436 0 : PaletteScrollArea* psa = new PaletteScrollArea(m_pCommon);
437 0 : psa->setRestrictHeight(false);
438 :
439 0 : tabWidget->clear();
440 0 : tabWidget->addTab(psa, muse::qtrc("palette", "Common symbols"));
441 :
442 0 : psa = new PaletteScrollArea(m_pSmufl);
443 0 : psa->setRestrictHeight(false);
444 :
445 0 : QSplitter* ws = new QSplitter;
446 0 : m_lws = new QListWidget;
447 :
448 0 : QStringList smuflRangeNames;
449 0 : for (const auto& pair: Smufl::smuflRanges()) {
450 0 : smuflRangeNames << pair.first.toQString();
451 : }
452 :
453 0 : m_lws->addItems(smuflRangeNames);
454 0 : m_lws->setCurrentRow(0);
455 :
456 0 : ws->addWidget(m_lws);
457 0 : ws->addWidget(psa);
458 :
459 0 : tabWidget->addTab(ws, muse::qtrc("palette", "Musical symbols"));
460 :
461 0 : psa = new PaletteScrollArea(m_pUnicode);
462 0 : psa->setRestrictHeight(false);
463 :
464 0 : QSplitter* wu = new QSplitter;
465 0 : m_lwu = new QListWidget;
466 0 : m_lwu->setSortingEnabled(true);
467 :
468 0 : int index = 0;
469 0 : for (const UnicodeRange& range : unicodeRanges) {
470 0 : QListWidgetItem* newItem = new QListWidgetItem(muse::qtrc("palette/unicodeRanges", range.name));
471 0 : newItem->setData(Qt::UserRole, index);
472 0 : m_lwu->addItem(newItem);
473 0 : if (index == 0) {
474 0 : m_lwu->setCurrentItem(newItem);
475 : }
476 0 : index++;
477 : }
478 :
479 0 : wu->addWidget(m_lwu);
480 0 : wu->addWidget(psa);
481 :
482 0 : tabWidget->addTab(wu, muse::qtrc("palette", "Unicode symbols"));
483 :
484 0 : connect(m_lws, &QListWidget::currentRowChanged, this, &SpecialCharactersDialog::populateSmufl);
485 0 : connect(m_lwu, &QListWidget::currentRowChanged, this, &SpecialCharactersDialog::populateUnicode);
486 0 : }
487 :
488 0 : void SpecialCharactersDialog::classBegin()
489 : {
490 0 : m_pCommon->setIocContext();
491 0 : m_pSmufl->setIocContext();
492 0 : m_pUnicode->setIocContext();
493 :
494 : // others are done in setFont
495 0 : populateSmufl();
496 :
497 0 : setFocusPolicy(Qt::NoFocus);
498 :
499 0 : INotationPtr notation = projectSession()->currentNotation();
500 0 : INotationInteractionPtr interaction = notation ? notation->interaction() : nullptr;
501 :
502 0 : if (interaction) {
503 0 : const TextBase* editedText = interaction->editedText();
504 0 : setFont(editedText->font());
505 : }
506 0 : }
507 :
508 0 : void SpecialCharactersDialog::showEvent(QShowEvent* event)
509 : {
510 0 : WidgetStateStore::restoreGeometry(this);
511 0 : TopLevelDialog::showEvent(event);
512 0 : }
513 :
514 0 : void SpecialCharactersDialog::hideEvent(QHideEvent* event)
515 : {
516 0 : WidgetStateStore::saveGeometry(this);
517 0 : QDialog::hideEvent(event);
518 0 : }
519 :
520 : //---------------------------------------------------------
521 : // populateCommon
522 : //---------------------------------------------------------
523 :
524 : static constexpr char32_t unicodeAccidentals[] = { //better size and alignment, so put these first
525 : 0x1d12b, // double flat
526 : 0x266d, // flat
527 : 0x266e, // natural
528 : 0x266f, // sharp
529 : 0x1d12a // double sharp
530 : };
531 :
532 : static constexpr char32_t commonTextSymbols[] = {
533 : 0x00a9, // ©
534 :
535 : // upper case ligatures
536 : 0x00c0, // À
537 : 0x00c1, // Á
538 : 0x00c2, // Â
539 : 0x00c3, // Ã
540 : 0x00c4, // Ä
541 : 0x00c5, // Å
542 : 0x00c6, // Æ
543 : 0x00c7, // Ç
544 : 0x00c8, // È
545 : 0x00c9, // É
546 : 0x00ca, // Ê
547 : 0x00cb, // Ë
548 : 0x00cc, // Ì
549 : 0x00cd, // Í
550 : 0x00ce, // Î
551 : 0x00cf, // Ï
552 :
553 : 0x00d0, // Ð
554 : 0x00d1, // Ñ
555 : 0x00d2, // Ò
556 : 0x00d3, // Ó
557 : 0x00d4, // Ô
558 : 0x00d5, // Õ
559 : 0x00d6, // Ö
560 : 0x00d7, // ×
561 : 0x00d8, // Ø
562 : 0x00d9, // Ù
563 : 0x00da, // Ú
564 : 0x00db, // Û
565 : 0x00dc, // Ü
566 : 0x00dd, // Ý
567 : 0x00de, // Þ
568 : 0x00df, // ß
569 :
570 : // upper case letters esperanto
571 : 0x0108, // Ĉ ?
572 : 0x011c, // Ĝ ?
573 : 0x0124, // Ĥ ?
574 : 0x0134, // Ĵ ?
575 : 0x0152, // Œ
576 : 0x015c, // Ŝ ?
577 : 0x0160, // Š
578 : 0x016c, // &Ucaron; ?
579 : 0x0178, // Ÿ
580 :
581 : // lower case ligatures
582 : 0x00e0, // à
583 : 0x00e1, // á
584 : 0x00e2, // â
585 : 0x00e3, // ã
586 : 0x00e4, // ä
587 : 0x00e5, // å
588 : 0x00e6, // æ
589 : 0x00e7, // &ccdil;
590 : 0x00e8, // è
591 : 0x00e9, // é
592 : 0x00ea, // ê
593 : 0x00eb, // ë
594 : 0x00ec, // igrave;
595 : 0x00ed, // í
596 : 0x00ee, // î
597 : 0x00ef, // ï
598 :
599 : 0x00f0, // ð
600 : 0x00f1, // ñ
601 : 0x00f2, // ò
602 : 0x00f3, // ó
603 : 0x00f4, // ô
604 : 0x00f5, // õ
605 : 0x00f6, // ö
606 : 0x00f7, // ÷
607 : 0x00f8, // ø
608 : 0x00f9, // ù
609 : 0x00fa, // ú
610 : 0x00fb, // û
611 : 0x00fc, // ü
612 : 0x00fd, // ý
613 : 0x00fe, // þ
614 : 0x00ff, // ÿ
615 :
616 : // lower case letters esperanto
617 : 0x0109, // ĉ ?
618 : 0x011d, // ĝ ?
619 : 0x0125, // ĥ ?
620 : 0x0135, // ĵ ?
621 : 0x0153, // œ
622 : 0x015d, // ŝ ?
623 : 0x0161, // š
624 : 0x016d, // &ucaron; ?
625 :
626 : 0x00BC, // ¼
627 : 0x00BD, // ½
628 : 0x00BE, // ¾
629 : 0x2153, // ⅓ ?
630 : 0x2154, // ⅔ ?
631 : 0x2155, // ⅕ ?
632 : 0x2156, // ⅖ ?
633 : 0x2157, // ⅗ ?
634 : 0x2158, // ⅘ ?
635 : 0x2159, // ⅙ ?
636 : 0x215A, // ⅚ ?
637 : 0x215B, // ⅛ ?
638 : 0x215C, // ⅜ ?
639 : 0x215D, // ⅝ ?
640 : 0x215E, // ⅞ ?
641 :
642 : //0x203F, // undertie
643 : 0x035c, // curved ligature to connect two syllables
644 : //0x2040, // character tie
645 : 0x0361, // curved ligature (top)
646 :
647 : 0x2013, // &endash
648 : 0x2014, // &emdash
649 : 0x2018, // ’
650 : 0x2019, // ‘
651 : 0x201C, // “
652 : 0x201D, // ”
653 : 0x2039, // ‹
654 : 0x203A, // ›
655 : 0x00AB, // «
656 : 0x00BB, // »
657 : 0x2020, // †
658 : 0x2021, // ‡
659 : 0x2022, // •
660 : 0x2026, // …
661 : 0x00A7, // §
662 : 0x00B0, // °
663 : 0x00B1, // ±
664 : 0x00B9, // ¹
665 : 0x00B2, // ²
666 : 0x00B3, // ³
667 :
668 : 0x0024, // $
669 : 0x20Ac, // €
670 : 0x00A2, // ¢
671 : 0x00A3, // £
672 : 0x00A5, // ¥
673 : };
674 :
675 0 : void SpecialCharactersDialog::populateCommon()
676 : {
677 0 : m_pCommon->clear();
678 :
679 0 : auto paletteScore = paletteScoreProvider()->paletteScore();
680 :
681 0 : for (char32_t id : unicodeAccidentals) {
682 0 : std::shared_ptr<FSymbol> fs = std::make_shared<FSymbol>(paletteScore->dummy());
683 0 : fs->setCode(id);
684 0 : fs->setFont(m_font);
685 0 : m_pCommon->appendElement(fs, QString::fromUcs4(&id, 1));
686 0 : }
687 :
688 0 : for (SymId id : commonScoreSymbols) {
689 0 : std::shared_ptr<Symbol> s = std::make_shared<Symbol>(paletteScore->dummy());
690 0 : s->setSym(id, paletteScore->engravingFont());
691 0 : m_pCommon->appendElement(s, SymNames::translatedUserNameForSymId(id));
692 0 : }
693 :
694 0 : for (char32_t id : commonTextSymbols) {
695 0 : std::shared_ptr<FSymbol> fs = std::make_shared<FSymbol>(paletteScore->dummy());
696 0 : fs->setCode(id);
697 0 : fs->setFont(m_font);
698 0 : m_pCommon->appendElement(fs, QString::fromUcs4(&id, 1));
699 0 : }
700 0 : }
701 :
702 : //---------------------------------------------------------
703 : // populateSmufl
704 : //---------------------------------------------------------
705 :
706 0 : void SpecialCharactersDialog::populateSmufl()
707 : {
708 0 : m_pSmufl->clear();
709 :
710 0 : int row = m_lws->currentRow();
711 0 : std::vector<SymId> symIds = std::next(Smufl::smuflRanges().begin(), row)->second;
712 :
713 0 : auto paletteScore = paletteScoreProvider()->paletteScore();
714 0 : for (SymId symId : symIds) {
715 0 : std::shared_ptr<Symbol> s = std::make_shared<Symbol>(paletteScore->dummy());
716 0 : s->setSym(symId, paletteScore->engravingFont());
717 0 : m_pSmufl->appendElement(s, SymNames::translatedUserNameForSymId(symId));
718 0 : }
719 0 : }
720 :
721 : //---------------------------------------------------------
722 : // populateUnicode
723 : //---------------------------------------------------------
724 :
725 0 : void SpecialCharactersDialog::populateUnicode()
726 : {
727 0 : int row = m_lwu->currentItem()->data(Qt::UserRole).toInt();
728 0 : const UnicodeRange& range = unicodeRanges[row];
729 0 : m_pUnicode->clear();
730 :
731 0 : auto paletteScore = paletteScoreProvider()->paletteScore();
732 0 : for (char32_t code = range.first; code <= range.last; ++code) {
733 0 : std::shared_ptr<FSymbol> fs = std::make_shared<FSymbol>(paletteScore->dummy());
734 0 : fs->setCode(code);
735 0 : fs->setFont(m_font);
736 0 : m_pUnicode->appendElement(fs, QString("0x%1").arg(static_cast<int>(code), 5, 16, QLatin1Char('0')));
737 0 : }
738 0 : }
739 :
740 0 : void SpecialCharactersDialog::setFont(const muse::draw::Font& font)
741 : {
742 0 : m_font = font;
743 0 : m_font.setPointSizeF(20);
744 0 : populateUnicode();
745 0 : populateCommon();
746 0 : update();
747 0 : }
|