RichEdit: Header/Footer now follow DarkContent / AllowDarkContent

This commit is contained in:
Mirek Fidler 2024-12-27 17:47:01 +01:00
parent 299853b620
commit c36182dcf0
4 changed files with 21 additions and 4 deletions

View file

@ -67,7 +67,7 @@ void ParaFormatting::SetupIndent()
void ParaFormatting::EditHdrFtr()
{
if(EditRichHeaderFooter(header_qtf, footer_qtf))
if(EditRichHeaderFooter(header_qtf, footer_qtf, allow_dark, dark))
modified = true;
}
@ -351,6 +351,8 @@ ParaFormatting::ParaFormatting(const RichEdit& e)
rulerstyle.Add(RichPara::RULER_DASH);
e.SetupDark(rulerink);
allow_dark = e.allow_dark_content;
dark = e.dark_content;
}
void StyleManager::EnterStyle()

View file

@ -132,6 +132,10 @@ void HeaderFooterDlg::Save(RichText& text)
void RichEdit::HeaderFooter()
{
HeaderFooterDlg dlg;
dlg.header_editor.AllowDarkContent(allow_dark_content);
dlg.footer_editor.AllowDarkContent(allow_dark_content);
dlg.header_editor.DarkContent(dark_content);
dlg.footer_editor.DarkContent(dark_content);
dlg.Load(text);
dlg.SetRect(0, 0, GetSize().cx, dlg.GetLayoutSize().cy);
if(dlg.Execute() == IDOK) {
@ -141,9 +145,13 @@ void RichEdit::HeaderFooter()
}
}
bool EditRichHeaderFooter(String& header_qtf, String& footer_qtf)
bool EditRichHeaderFooter(String& header_qtf, String& footer_qtf, bool allow_dark, bool dark)
{
HeaderFooterDlg dlg;
dlg.header_editor.AllowDarkContent(allow_dark);
dlg.footer_editor.AllowDarkContent(allow_dark);
dlg.header_editor.DarkContent(dark);
dlg.footer_editor.DarkContent(dark);
dlg.Set(header_qtf, footer_qtf);
if(dlg.Execute() == IDOK) {
dlg.Get(header_qtf, footer_qtf);

View file

@ -126,7 +126,7 @@ struct FontHeight : public WithDropChoice<EditDouble> {
#define LAYOUTFILE <RichEdit/RichEdit.lay>
#include <CtrlCore/lay.h>
bool EditRichHeaderFooter(String& header_qtf, String& footer_qtf);
bool EditRichHeaderFooter(String& header_qtf, String& footer_qtf, bool allow_dark, bool dark);
class RichEdit;
@ -142,6 +142,8 @@ private:
Font font;
bool modified;
String header_qtf, footer_qtf;
bool dark = false;
bool allow_dark = false;
RichPara::NumberFormat GetNumbering();
bool IsNumbering();
@ -660,6 +662,7 @@ private:
friend class StyleKeysDlg;
friend class StyleManager;
friend class ParaFormatting;
using Ctrl::Accept;

View file

@ -100,10 +100,12 @@ int CharFilterEqualize(int c)
struct RichEditTableProperties : WithTablePropertiesLayout<TopWindow> {
String header_qtf, footer_qtf;
bool dark = false;
bool allow_dark = false;
void EditHdrFtr()
{
EditRichHeaderFooter(header_qtf, footer_qtf);
EditRichHeaderFooter(header_qtf, footer_qtf, allow_dark, dark);
}
void NewHdrFtr()
@ -135,6 +137,8 @@ void RichEdit::TableProps()
RichEditTableProperties dlg;
SetupDark(dlg.framecolor);
SetupDark(dlg.gridcolor);
dlg.allow_dark = allow_dark_content;
dlg.dark = dark_content;
dlg.Breaker(dlg.destroy, IDNO);
RichTable::Format fmt = text.GetTableFormat(cursorp.table);
String ratios;