add strikethrough

This commit is contained in:
GenevensiS
2025-12-28 16:49:51 +01:00
parent 5c1b7b9dfc
commit 5390a032fc
36 changed files with 275 additions and 87 deletions
+29 -18
View File
@@ -18,6 +18,7 @@ Font::Font()
: name()
, size(1)
, underline(false)
, strikethrough(false)
, scale_down_to(100000)
, max_stretch(1.0)
, color(Color(0,0,0))
@@ -83,13 +84,14 @@ void Font::TallyResourceFonts(String fontsDirectoryPath, vector<String>& fontFil
bool Font::update(Context& ctx) {
bool changes = false;
changes |= name .update(ctx);
changes |= italic_name .update(ctx);
changes |= size .update(ctx);
changes |= weight .update(ctx);
changes |= style .update(ctx);
changes |= underline .update(ctx);
changes |= color .update(ctx);
changes |= name .update(ctx);
changes |= italic_name .update(ctx);
changes |= size .update(ctx);
changes |= weight .update(ctx);
changes |= style .update(ctx);
changes |= underline .update(ctx);
changes |= strikethrough .update(ctx);
changes |= color .update(ctx);
changes |= shadow_color .update(ctx);
changes |= shadow_displacement_x.update(ctx);
changes |= shadow_displacement_y.update(ctx);
@@ -100,20 +102,21 @@ bool Font::update(Context& ctx) {
return changes;
}
void Font::initDependencies(Context& ctx, const Dependency& dep) const {
name .initDependencies(ctx, dep);
italic_name .initDependencies(ctx, dep);
size .initDependencies(ctx, dep);
weight .initDependencies(ctx, dep);
style .initDependencies(ctx, dep);
underline .initDependencies(ctx, dep);
color .initDependencies(ctx, dep);
name .initDependencies(ctx, dep);
italic_name .initDependencies(ctx, dep);
size .initDependencies(ctx, dep);
weight .initDependencies(ctx, dep);
style .initDependencies(ctx, dep);
underline .initDependencies(ctx, dep);
strikethrough .initDependencies(ctx, dep);
color .initDependencies(ctx, dep);
shadow_color .initDependencies(ctx, dep);
shadow_displacement_x.initDependencies(ctx, dep);
shadow_displacement_y.initDependencies(ctx, dep);
shadow_blur .initDependencies(ctx, dep);
}
FontP Font::make(int add_flags, bool add_underline, String const* other_family, Color const* other_color, double const* other_size) const {
FontP Font::make(int add_flags, bool add_underline, bool add_strikethrough, String const* other_family, Color const* other_color, double const* other_size) const {
FontP f(new Font(*this));
f->flags |= add_flags;
if (add_flags & FONT_CODE_STRING) {
@@ -134,6 +137,9 @@ FontP Font::make(int add_flags, bool add_underline, String const* other_family,
if (add_underline) {
f->underline = true;
}
if (add_strikethrough) {
f->strikethrough = true;
}
if (other_color) {
f->color = *other_color;
}
@@ -156,13 +162,16 @@ wxFont Font::toWxFont(double scale) const {
if (flags & FONT_CODE) {
if (size_i < 2) {
return wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, weight_i, underline(), _("Courier New"));
font = wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, weight_i, underline(), _("Courier New"));
if (strikethrough()) font.MakeStrikethrough();
return font;
} else {
font = wxFont(size_i, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, weight_i, underline(), _("Courier New"));
}
} else if (name().empty()) {
font = *wxNORMAL_FONT;
font.SetPointSize(size > 1 ? size_i : int(scale * font.GetPointSize()));
font.SetPointSize(size > 1 ? size_i : int(scale * font.GetPointSize()));
if (strikethrough()) font.MakeStrikethrough();
return font;
} else if (flags & FONT_ITALIC && !italic_name().empty()) {
font = wxFont(size_i, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, weight_i, underline(), italic_name());
@@ -179,7 +188,8 @@ wxFont Font::toWxFont(double scale) const {
// make it independent of screen dpi, always use 96 dpi
// TODO: do something more sensible, and more portable
font.SetPixelSize(wxSize(0, -(int)(scale*size*96.0/72.0 + 0.5) ));
#endif
#endif
if (strikethrough()) font.MakeStrikethrough();
return font;
}
@@ -189,6 +199,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(Font) {
REFLECT(weight);
REFLECT(style);
REFLECT(underline);
REFLECT(strikethrough);
REFLECT(italic_name);
REFLECT(color);
REFLECT(scale_down_to);
+2 -1
View File
@@ -38,6 +38,7 @@ public:
Scriptable<double> size; ///< Size of the font
Scriptable<String> weight, style; ///< Weight and style of the font (bold/italic)
Scriptable<bool> underline; ///< Underlined?
Scriptable<bool> strikethrough; ///< Struck through?
double scale_down_to; ///< Smallest size to scale down to
double max_stretch; ///< How much should the font be stretched before scaling down?
Scriptable<Color> color; ///< Color to use
@@ -67,7 +68,7 @@ public:
}
/// Add style to a font, and optionally change the font family, color and size
FontP make(int add_flags, bool add_underline, String const* other_family, Color const* other_color, double const* other_size) const;
FontP make(int add_flags, bool add_underline, bool add_strikethrough, String const* other_family, Color const* other_color, double const* other_size) const;
/// Convert this font to a wxFont
wxFont toWxFont(double scale) const;
+1 -1
View File
@@ -650,7 +650,7 @@ void CardListBase::onContextMenu(wxContextMenuEvent&) {
m.AppendSeparator();
add_menu_item_tr(&m, ID_CARD_ADD, "card_add", "add card");
add_menu_item_tr(&m, ID_CARD_REMOVE, "card_del", "remove card");
add_menu_item_tr(&m, ID_CARD_LINK, "card_link", "link card");
add_menu_item_tr(&m, ID_CARD_LINK, settings.darkModePrefix() + "card_link", "link card");
PopupMenu(&m);
}
}
+9 -6
View File
@@ -136,7 +136,7 @@ CardsPanel::CardsPanel(Window* parent, int id)
add_menu_item(menuCard, ID_CARD_ADD_JSON, "card_add_multiple", _MENU_("add card json") + _(" "), _HELP_("add card json"));
add_menu_item_tr(menuCard, ID_CARD_ADD, "card_add", "add_card");
add_menu_item(menuCard, ID_CARD_REMOVE, "card_del", _MENU_("remove card")+_(" "), _HELP_("remove card"));
add_menu_item(menuCard, ID_CARD_LINK, "card_link", _MENU_("link card") + _(" "), _HELP_("link card"));
add_menu_item(menuCard, ID_CARD_LINK, settings.darkModePrefix() + "card_link", _MENU_("link card") + _(" "), _HELP_("link card"));
add_menu_item(menuCard, ID_CARD_AND_LINK_COPY, "card_copy", _MENU_("copy card and links") + _(" "), _HELP_("copy card and links"));
add_menu_item(menuCard, ID_CARD_BULK, "card_modify_multiple", _MENU_("bulk modify") + _(" "), _HELP_("bulk modify"));
menuCard->AppendSeparator();
@@ -153,7 +153,8 @@ CardsPanel::CardsPanel(Window* parent, int id)
menuFormat = new wxMenu();
add_menu_item_tr(menuFormat, ID_FORMAT_BOLD, settings.darkModePrefix() + "bold", "bold", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_ITALIC, settings.darkModePrefix() + "italic", "italic", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_STRIKETHROUGH, settings.darkModePrefix() + "strikethrough", "strikethrough", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_SYMBOL, settings.darkModePrefix() + "symbol", "symbols", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_REMINDER, settings.darkModePrefix() + "reminder", "reminder_text", wxITEM_CHECK);
menuFormat->AppendSeparator();
@@ -286,14 +287,15 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar
add_tool_tr(tb, ID_FORMAT_BOLD, settings.darkModePrefix() + "bold", "bold", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_ITALIC, settings.darkModePrefix() + "italic", "italic", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_STRIKETHROUGH, settings.darkModePrefix() + "strikethrough", "strikethrough", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_SYMBOL, settings.darkModePrefix() + "symbol", "symbols", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_REMINDER, settings.darkModePrefix() + "reminder", "reminder_text", false, wxITEM_CHECK);
tb->AddSeparator();
toolAddCard = add_tool_tr(tb, ID_CARD_ADD, "card_add", "add_card", false, wxITEM_DROPDOWN);
tb->SetDropdownMenu(ID_CARD_ADD, makeAddCardsSubmenu(true));
add_tool_tr(tb, ID_CARD_REMOVE, "card_del", "remove_card");
add_tool_tr(tb, ID_CARD_LINK, "card_link", "link_card");
add_tool_tr(tb, ID_CARD_LINK, settings.darkModePrefix() + "card_link", "link_card");
tb->AddSeparator();
add_tool_tr(tb, ID_CARD_ROTATE, "card_rotate", "rotate_card", false, wxITEM_DROPDOWN);
auto menuRotate = new wxMenu();
@@ -322,6 +324,7 @@ void CardsPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
tb->DeleteTool(ID_FORMAT_BOLD);
tb->DeleteTool(ID_FORMAT_ITALIC);
tb->DeleteTool(ID_FORMAT_UNDERLINE);
tb->DeleteTool(ID_FORMAT_STRIKETHROUGH);
tb->DeleteTool(ID_FORMAT_SYMBOL);
tb->DeleteTool(ID_FORMAT_REMINDER);
tb->DeleteTool(ID_CARD_ADD);
@@ -364,7 +367,7 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
case ID_CARD_REMOVE: ev.Enable(card_list->canDelete()); break;
case ID_CARD_LINK: ev.Enable(card_list->canLink()); break;
case ID_CARD_AND_LINK_COPY: ev.Enable(card_list->canCopy()); break;
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_STRIKETHROUGH: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
if (focused_control(this) == ID_EDITOR) {
ev.Enable(editor->canFormat(ev.GetId()));
ev.Check (editor->hasFormat(ev.GetId()));
@@ -472,7 +475,7 @@ void CardsPanel::onCommand(int id) {
case ID_SELECT_COLUMNS: {
card_list->selectColumns();
}
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_STRIKETHROUGH: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
if (focused_control(this) == ID_EDITOR) {
editor->doFormat(id);
}
+7 -4
View File
@@ -36,7 +36,8 @@ void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar
add_tool_tr(tb, ID_FORMAT_BOLD, settings.darkModePrefix() + "bold", "bold", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_ITALIC, settings.darkModePrefix() + "italic", "italic", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_STRIKETHROUGH, settings.darkModePrefix() + "strikethrough", "strikethrough", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_SYMBOL, settings.darkModePrefix() + "symbol", "symbols", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_REMINDER, settings.darkModePrefix() + "reminder", "reminder_text", false, wxITEM_CHECK);
tb->Realize();
@@ -44,7 +45,8 @@ void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
auto menuFormat = new wxMenu();
add_menu_item_tr(menuFormat, ID_FORMAT_BOLD, settings.darkModePrefix() + "bold", "bold", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_ITALIC, settings.darkModePrefix() + "italic", "italic", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_UNDERLINE, settings.darkModePrefix() + "underline", "underline", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_STRIKETHROUGH, settings.darkModePrefix() + "strikethrough", "strikethrough", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_SYMBOL, settings.darkModePrefix() + "symbol", "symbols", wxITEM_CHECK);
add_menu_item_tr(menuFormat, ID_FORMAT_REMINDER, settings.darkModePrefix() + "reminder", "reminder_text", wxITEM_CHECK);
mb->Insert(2, menuFormat, _MENU_("format"));
@@ -57,6 +59,7 @@ void SetInfoPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
tb->DeleteTool(ID_FORMAT_BOLD);
tb->DeleteTool(ID_FORMAT_ITALIC);
tb->DeleteTool(ID_FORMAT_UNDERLINE);
tb->DeleteTool(ID_FORMAT_STRIKETHROUGH);
tb->DeleteTool(ID_FORMAT_SYMBOL);
tb->DeleteTool(ID_FORMAT_REMINDER);
// Menus
@@ -65,7 +68,7 @@ void SetInfoPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
void SetInfoPanel::onUpdateUI(wxUpdateUIEvent& ev) {
switch (ev.GetId()) {
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_STRIKETHROUGH: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
ev.Enable(editor->canFormat(ev.GetId()));
ev.Check (editor->hasFormat(ev.GetId()));
break;
@@ -75,7 +78,7 @@ void SetInfoPanel::onUpdateUI(wxUpdateUIEvent& ev) {
void SetInfoPanel::onCommand(int id) {
switch (id) {
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_STRIKETHROUGH: case ID_FORMAT_SYMBOL: case ID_FORMAT_REMINDER: {
editor->doFormat(id);
break;
}
+7 -1
View File
@@ -805,7 +805,7 @@ bool TextValueEditor::doDelete() {
bool TextValueEditor::canFormat(int type) const {
switch (type) {
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE:
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_UNDERLINE: case ID_FORMAT_STRIKETHROUGH:
return !style().always_symbol && style().allow_formating;
case ID_FORMAT_SYMBOL:
return !style().always_symbol && style().allow_formating && style().symbol_font.valid();
@@ -825,6 +825,8 @@ bool TextValueEditor::hasFormat(int type) const {
return is_in_tag(value().value(), _("<i"), selection_start_i, selection_end_i);
case ID_FORMAT_UNDERLINE:
return is_in_tag(value().value(), _("<u"), selection_start_i, selection_end_i);
case ID_FORMAT_STRIKETHROUGH:
return is_in_tag(value().value(), _("<strike"), selection_start_i, selection_end_i);
case ID_FORMAT_SYMBOL:
return is_in_tag(value().value(), _("<sym"), selection_start_i, selection_end_i);
case ID_FORMAT_REMINDER: {
@@ -855,6 +857,10 @@ void TextValueEditor::doFormat(int type) {
addAction(toggle_format_action(valueP(), _("u"), selection_start_i, selection_end_i, selection_start, selection_end, _("Underline")));
break;
}
case ID_FORMAT_STRIKETHROUGH: {
addAction(toggle_format_action(valueP(), _("strike"), selection_start_i, selection_end_i, selection_start, selection_end, _("Strikethrough")));
break;
}
case ID_FORMAT_SYMBOL: {
addAction(toggle_format_action(valueP(), _("sym"), selection_start_i, selection_end_i, selection_start, selection_end, _("Symbols")));
break;
+30 -27
View File
@@ -34,7 +34,7 @@ struct Margins {
// Helper class for TextElements::fromString, to allow persistent formating state accross recusive calls
struct TextElementsFromString {
// What formatting is enabled?
int bold = 0, italic = 0, underline = 0, symbol = 0;
int bold = 0, italic = 0, underline = 0, strikethrough = 0, symbol = 0;
int soft = 0, kwpph = 0, param = 0, line = 0, soft_line = 0;
int code = 0, code_kw = 0, code_string = 0, param_ref = 0;
int param_id = 0, li = 0;
@@ -75,32 +75,34 @@ private:
// a (formatting) tag
size_t tag_start = pos;
pos = skip_tag(text, tag_start);
if (is_tag(text, tag_start, _( "<b"))) bold += 1;
else if (is_tag(text, tag_start, _("</b"))) bold -= 1;
else if (is_tag(text, tag_start, _( "<i"))) italic += 1;
else if (is_tag(text, tag_start, _("</i"))) italic -= 1;
else if (is_tag(text, tag_start, _("<u"))) underline += 1;
else if (is_tag(text, tag_start, _("</u"))) underline -= 1;
else if (is_tag(text, tag_start, _( "<sym"))) symbol += 1;
else if (is_tag(text, tag_start, _("</sym"))) symbol -= 1;
else if (is_tag(text, tag_start, _( "<line"))) line += 1;
else if (is_tag(text, tag_start, _("</line"))) line -= 1;
else if (is_tag(text, tag_start, _( "<soft-line"))) soft_line += 1;
else if (is_tag(text, tag_start, _("</soft-line"))) soft_line -= 1;
else if (is_tag(text, tag_start, _( "<sep-soft"))) soft += 1;
else if (is_tag(text, tag_start, _("</sep-soft"))) soft -= 1;
else if (is_tag(text, tag_start, _( "<soft"))) soft += 1; // must be after <soft-line
else if (is_tag(text, tag_start, _("</soft"))) soft -= 1;
else if (is_tag(text, tag_start, _( "<li"))) li += 1;
else if (is_tag(text, tag_start, _("</li"))) li -= 1;
else if (is_tag(text, tag_start, _( "<atom-kwpph"))) kwpph += 1;
else if (is_tag(text, tag_start, _("</atom-kwpph"))) kwpph -= 1;
else if (is_tag(text, tag_start, _( "<code-kw"))) code_kw += 1;
else if (is_tag(text, tag_start, _("</code-kw"))) code_kw -= 1;
else if (is_tag(text, tag_start, _( "<code-str"))) code_string += 1;
else if (is_tag(text, tag_start, _("</code-str"))) code_string -= 1;
else if (is_tag(text, tag_start, _( "<code"))) code += 1;
else if (is_tag(text, tag_start, _("</code"))) code -= 1;
if (is_tag(text, tag_start, _( "<b"))) bold += 1;
else if (is_tag(text, tag_start, _("</b"))) bold -= 1;
else if (is_tag(text, tag_start, _( "<i"))) italic += 1;
else if (is_tag(text, tag_start, _("</i"))) italic -= 1;
else if (is_tag(text, tag_start, _( "<u"))) underline += 1;
else if (is_tag(text, tag_start, _("</u"))) underline -= 1;
else if (is_tag(text, tag_start, _( "<strike"))) strikethrough += 1;
else if (is_tag(text, tag_start, _("</strike"))) strikethrough -= 1;
else if (is_tag(text, tag_start, _( "<sym"))) symbol += 1;
else if (is_tag(text, tag_start, _("</sym"))) symbol -= 1;
else if (is_tag(text, tag_start, _( "<line"))) line += 1;
else if (is_tag(text, tag_start, _("</line"))) line -= 1;
else if (is_tag(text, tag_start, _( "<soft-line"))) soft_line += 1;
else if (is_tag(text, tag_start, _("</soft-line"))) soft_line -= 1;
else if (is_tag(text, tag_start, _( "<sep-soft"))) soft += 1;
else if (is_tag(text, tag_start, _("</sep-soft"))) soft -= 1;
else if (is_tag(text, tag_start, _( "<soft"))) soft += 1; // must be after <soft-line
else if (is_tag(text, tag_start, _("</soft"))) soft -= 1;
else if (is_tag(text, tag_start, _( "<li"))) li += 1;
else if (is_tag(text, tag_start, _("</li"))) li -= 1;
else if (is_tag(text, tag_start, _( "<atom-kwpph"))) kwpph += 1;
else if (is_tag(text, tag_start, _("</atom-kwpph"))) kwpph -= 1;
else if (is_tag(text, tag_start, _( "<code-kw"))) code_kw += 1;
else if (is_tag(text, tag_start, _("</code-kw"))) code_kw -= 1;
else if (is_tag(text, tag_start, _( "<code-str"))) code_string += 1;
else if (is_tag(text, tag_start, _("</code-str"))) code_string -= 1;
else if (is_tag(text, tag_start, _( "<code"))) code += 1;
else if (is_tag(text, tag_start, _("</code"))) code -= 1;
else if (is_tag(text, tag_start, _( "<color"))) {
size_t colon = text.find_first_of(_(">:"), tag_start);
if (colon < pos - 1 && text.GetChar(colon) == _(':')) {
@@ -303,6 +305,7 @@ private:
(code_kw > 0 ? FONT_CODE_KW : FONT_NORMAL) |
(code_string > 0 ? FONT_CODE_STRING : FONT_NORMAL),
underline > 0,
strikethrough > 0,
fonts.empty() ? nullptr : &fonts.back(),
param > 0 || param_ref > 0
? &param_colors[(param_id++) % param_colors_count]
+12 -2
View File
@@ -218,6 +218,7 @@ String to_html(const String& str_in, const SymbolFontP& symbol_font, double symb
Tag bold (_("<b>"), _("</b>")),
italic(_("<i>"), _("</i>")),
underline(_("<u>"), _("</u>")),
strikethrough(_("<s>"), _("</s>")),
symbol(_("<span class=\"symbol\">"), _("</span>"));
TagStack tags;
String symbols;
@@ -237,6 +238,10 @@ String to_html(const String& str_in, const SymbolFontP& symbol_font, double symb
tags.open(ret, underline);
} else if (is_substr(str, i, _("/u"))) {
tags.close(ret, underline);
} else if (is_substr(str, i, _("strike"))) {
tags.open(ret, strikethrough);
} else if (is_substr(str, i, _("/strike"))) {
tags.close(ret, strikethrough);
} else if (is_substr(str, i, _("sym"))) {
tags.open (ret, symbol);
} else if (is_substr(str, i, _("/sym"))) {
@@ -312,8 +317,9 @@ String to_bbcode(const String& str_in) {
String str = remove_tag_contents(str_in,_("<sep-soft"));
String ret;
Tag bold (_("[b]"), _("[/b]")),
italic(_("[i]"), _("[/i]")),
underline(_("[u]"), _("[/u]"));
italic(_("[i]"), _("[/i]")),
underline(_("[u]"), _("[/u]")),
strikethrough(_("[s]"), _("[/s]"));
TagStack tags;
String symbols;
for (size_t i = 0 ; i < str.size() ; ) {
@@ -332,6 +338,10 @@ String to_bbcode(const String& str_in) {
tags.open(ret, underline);
} else if (is_substr(str, i, _("/u"))) {
tags.close(ret, underline);
} else if (is_substr(str, i, _("strike"))) {
tags.open(ret, strikethrough);
} else if (is_substr(str, i, _("/strike"))) {
tags.close(ret, strikethrough);
}
/*else if (is_substr(str, i, _("sym"))) {
tags.open (ret, symbol);
+1
View File
@@ -133,6 +133,7 @@ enum ChildMenuID {
ID_FORMAT_BOLD = 6201,
ID_FORMAT_ITALIC,
ID_FORMAT_UNDERLINE,
ID_FORMAT_STRIKETHROUGH,
ID_FORMAT_SYMBOL,
ID_FORMAT_REMINDER,
ID_INSERT_SYMBOL,