mirror of
https://review.haiku-os.org/haiku
synced 2025-02-12 00:28:19 +01:00
StyledEdit: Add menu to strikeout text
Change-Id: I390b700db29a838baade1d8ab52983306a93e751 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8863 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: nephele nephele <nep-git@packageloss.eu>
This commit is contained in:
parent
4624f9f260
commit
3e2f510808
@ -55,6 +55,7 @@ const uint32 FONT_COLOR = 'Fcol';
|
|||||||
const uint32 kMsgSetItalic = 'Fita';
|
const uint32 kMsgSetItalic = 'Fita';
|
||||||
const uint32 kMsgSetBold = 'Fbld';
|
const uint32 kMsgSetBold = 'Fbld';
|
||||||
const uint32 kMsgSetUnderline = 'Fuln';
|
const uint32 kMsgSetUnderline = 'Fuln';
|
||||||
|
const uint32 kMsgSetStrikeout = 'Fsto';
|
||||||
const uint32 kMsgSetFontDown = 'Fsdw';
|
const uint32 kMsgSetFontDown = 'Fsdw';
|
||||||
const uint32 kMsgSetFontUp = 'Fsup';
|
const uint32 kMsgSetFontUp = 'Fsup';
|
||||||
|
|
||||||
|
@ -384,6 +384,7 @@ StyledEditWindow::MessageReceived(BMessage* message)
|
|||||||
fItalicItem->SetMarked((font.Face() & B_ITALIC_FACE) != 0);
|
fItalicItem->SetMarked((font.Face() & B_ITALIC_FACE) != 0);
|
||||||
fBoldItem->SetMarked((font.Face() & B_BOLD_FACE) != 0);
|
fBoldItem->SetMarked((font.Face() & B_BOLD_FACE) != 0);
|
||||||
fUnderlineItem->SetMarked((font.Face() & B_UNDERSCORE_FACE) != 0);
|
fUnderlineItem->SetMarked((font.Face() & B_UNDERSCORE_FACE) != 0);
|
||||||
|
fStrikeoutItem->SetMarked((font.Face() & B_STRIKEOUT_FACE) != 0);
|
||||||
|
|
||||||
_SetFontStyle(fontFamily, fontStyle);
|
_SetFontStyle(fontFamily, fontStyle);
|
||||||
break;
|
break;
|
||||||
@ -409,6 +410,7 @@ StyledEditWindow::MessageReceived(BMessage* message)
|
|||||||
fItalicItem->SetMarked((font.Face() & B_ITALIC_FACE) != 0);
|
fItalicItem->SetMarked((font.Face() & B_ITALIC_FACE) != 0);
|
||||||
fBoldItem->SetMarked((font.Face() & B_BOLD_FACE) != 0);
|
fBoldItem->SetMarked((font.Face() & B_BOLD_FACE) != 0);
|
||||||
fUnderlineItem->SetMarked((font.Face() & B_UNDERSCORE_FACE) != 0);
|
fUnderlineItem->SetMarked((font.Face() & B_UNDERSCORE_FACE) != 0);
|
||||||
|
fStrikeoutItem->SetMarked((font.Face() & B_STRIKEOUT_FACE) != 0);
|
||||||
|
|
||||||
_SetFontStyle(fontFamily, fontStyle);
|
_SetFontStyle(fontFamily, fontStyle);
|
||||||
break;
|
break;
|
||||||
@ -500,6 +502,23 @@ StyledEditWindow::MessageReceived(BMessage* message)
|
|||||||
_SetFontStyle(family, style);
|
_SetFontStyle(family, style);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case kMsgSetStrikeout:
|
||||||
|
{
|
||||||
|
uint32 sameProperties;
|
||||||
|
BFont font;
|
||||||
|
fTextView->GetFontAndColor(&font, &sameProperties);
|
||||||
|
|
||||||
|
if (fStrikeoutItem->IsMarked())
|
||||||
|
font.SetFace(B_REGULAR_FACE);
|
||||||
|
fStrikeoutItem->SetMarked(!fStrikeoutItem->IsMarked());
|
||||||
|
|
||||||
|
font_family family;
|
||||||
|
font_style style;
|
||||||
|
font.GetFamilyAndStyle(&family, &style);
|
||||||
|
|
||||||
|
_SetFontStyle(family, style);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case FONT_COLOR:
|
case FONT_COLOR:
|
||||||
{
|
{
|
||||||
ssize_t colorLength;
|
ssize_t colorLength;
|
||||||
@ -769,6 +788,7 @@ StyledEditWindow::MenusBeginning()
|
|||||||
fBoldItem->SetMarked((font.Face() & B_BOLD_FACE) != 0);
|
fBoldItem->SetMarked((font.Face() & B_BOLD_FACE) != 0);
|
||||||
fItalicItem->SetMarked((font.Face() & B_ITALIC_FACE) != 0);
|
fItalicItem->SetMarked((font.Face() & B_ITALIC_FACE) != 0);
|
||||||
fUnderlineItem->SetMarked((font.Face() & B_UNDERSCORE_FACE) != 0);
|
fUnderlineItem->SetMarked((font.Face() & B_UNDERSCORE_FACE) != 0);
|
||||||
|
fStrikeoutItem->SetMarked((font.Face() & B_STRIKEOUT_FACE) != 0);
|
||||||
|
|
||||||
switch (fTextView->Alignment()) {
|
switch (fTextView->Alignment()) {
|
||||||
case B_ALIGN_LEFT:
|
case B_ALIGN_LEFT:
|
||||||
@ -1243,6 +1263,10 @@ StyledEditWindow::_InitWindow(uint32 encoding)
|
|||||||
new BMessage(kMsgSetUnderline));
|
new BMessage(kMsgSetUnderline));
|
||||||
fUnderlineItem->SetShortcut('U', 0);
|
fUnderlineItem->SetShortcut('U', 0);
|
||||||
|
|
||||||
|
fStrikeoutItem = new BMenuItem(B_TRANSLATE("Strikeout"),
|
||||||
|
new BMessage(kMsgSetStrikeout));
|
||||||
|
fStrikeoutItem->SetShortcut('K', 0);
|
||||||
|
|
||||||
fFontMenu = new BMenu(B_TRANSLATE("Font"));
|
fFontMenu = new BMenu(B_TRANSLATE("Font"));
|
||||||
fCurrentFontItem = 0;
|
fCurrentFontItem = 0;
|
||||||
fCurrentStyleItem = 0;
|
fCurrentStyleItem = 0;
|
||||||
@ -1257,6 +1281,7 @@ StyledEditWindow::_InitWindow(uint32 encoding)
|
|||||||
.AddItem(fBoldItem)
|
.AddItem(fBoldItem)
|
||||||
.AddItem(fItalicItem)
|
.AddItem(fItalicItem)
|
||||||
.AddItem(fUnderlineItem)
|
.AddItem(fUnderlineItem)
|
||||||
|
.AddItem(fStrikeoutItem)
|
||||||
.AddSeparator()
|
.AddSeparator()
|
||||||
.End();
|
.End();
|
||||||
|
|
||||||
@ -1915,6 +1940,9 @@ StyledEditWindow::_SetFontStyle(const char* fontFamily, const char* fontStyle)
|
|||||||
if (fUnderlineItem->IsMarked())
|
if (fUnderlineItem->IsMarked())
|
||||||
face |= B_UNDERSCORE_FACE;
|
face |= B_UNDERSCORE_FACE;
|
||||||
|
|
||||||
|
if (fStrikeoutItem->IsMarked())
|
||||||
|
face |= B_STRIKEOUT_FACE;
|
||||||
|
|
||||||
font.SetFace(face);
|
font.SetFace(face);
|
||||||
|
|
||||||
fTextView->SetFontAndColor(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_FACE);
|
fTextView->SetFontAndColor(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_FACE);
|
||||||
|
@ -127,6 +127,7 @@ private:
|
|||||||
BMenuItem* fBoldItem;
|
BMenuItem* fBoldItem;
|
||||||
BMenuItem* fItalicItem;
|
BMenuItem* fItalicItem;
|
||||||
BMenuItem* fUnderlineItem;
|
BMenuItem* fUnderlineItem;
|
||||||
|
BMenuItem* fStrikeoutItem;
|
||||||
|
|
||||||
BMenuItem* fWrapItem;
|
BMenuItem* fWrapItem;
|
||||||
BMenuItem* fAlignLeft;
|
BMenuItem* fAlignLeft;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user