richmemo: refactored numbering API

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3832 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2014-12-10 12:06:44 +00:00
parent c67b638795
commit ff15ba407a
3 changed files with 39 additions and 17 deletions

View File

@@ -59,11 +59,20 @@ type
, pnLowRoman, pnUpLetter, pnUpRoman, pnCustomChar); , pnLowRoman, pnUpLetter, pnUpRoman, pnCustomChar);
TParaNumbering = record TParaNumbering = record
Numbering : TParaNumStyle; Style : TParaNumStyle;
NumCustom : WideChar; Indent : Double;
NumIndent : Double; CustomChar : WideChar;
NumberStart : Integer; // must be negative one to continue numbering, used for pnNumber only
SepChar : WideChar;
end; end;
const
SepNone : WideChar = #0;
SepPar : WideChar = ')';
SepDot : WideChar = '.';
type
TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles, tmm_BackColor); TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles, tmm_BackColor);
TParaModifyMask = set of (pmm_FirstLine, pmm_HeadIndent, pmm_TailIndent, pmm_SpaceBefore, pmm_SpaceAfter, pmm_LineSpacing); TParaModifyMask = set of (pmm_FirstLine, pmm_HeadIndent, pmm_TailIndent, pmm_SpaceBefore, pmm_SpaceAfter, pmm_LineSpacing);

View File

@@ -615,20 +615,20 @@ begin
RichEditManager.SetEventMask(AWinControl.Handle, eventmask); RichEditManager.SetEventMask(AWinControl.Handle, eventmask);
case para.wNumbering of case para.wNumbering of
PFN_BULLET: ANumber.Numbering:=pnBullet; PFN_BULLET: ANumber.Style:=pnBullet;
PFN_ARABIC: ANumber.Numbering:=pnNumber; PFN_ARABIC: ANumber.Style:=pnNumber;
PFN_LCLETTER: ANumber.Numbering:=pnLowLetter; PFN_LCLETTER: ANumber.Style:=pnLowLetter;
PFN_LCROMAN: ANumber.Numbering:=pnLowRoman; PFN_LCROMAN: ANumber.Style:=pnLowRoman;
PFN_UCLETTER: ANumber.Numbering:=pnUpLetter; PFN_UCLETTER: ANumber.Style:=pnUpLetter;
PFN_UCROMAN: ANumber.Numbering:=pnUpRoman; PFN_UCROMAN: ANumber.Style:=pnUpRoman;
PFN_CUSTOM: begin PFN_CUSTOM: begin
ANumber.Numbering:=pnCustomChar; ANumber.Style:=pnCustomChar;
ANumber.NumCustom:=WideChar(para.wNumberingStart); ANumber.CustomChar:=WideChar(para.wNumberingStart);
end; end;
else else
ANumber.Numbering:=pnNone; ANumber.Style:=pnNone;
end; end;
ANumber.NumIndent:=para.wNumberingTab/20; ANumber.Indent:=para.wNumberingTab/20;
Result:=true Result:=true
end; end;
@@ -645,22 +645,27 @@ begin
para.cbSize:=sizeof(para); para.cbSize:=sizeof(para);
para.dwMask:= para.dwMask:=
PFM_NUMBERING or PFM_NUMBERINGTAB; PFM_NUMBERING or PFM_NUMBERINGTAB;
case ANumber.Numbering of case ANumber.Style of
pnNone: para.wNumbering:=0; pnNone: para.wNumbering:=0;
pnBullet: para.wNumbering:=PFN_BULLET; pnBullet: para.wNumbering:=PFN_BULLET;
pnNumber: para.wNumbering:=PFN_ARABIC; pnNumber: begin
para.wNumbering:=PFN_ARABIC;
para.dwMask:=para.dwMask or PFM_NUMBERINGSTART;
para.wNumberingStart:=ANumber.NumberStart;
para.wNumberingStyle:=PFNS_NEWNUMBER;
end;
pnLowLetter: para.wNumbering:=PFN_LCLETTER; pnLowLetter: para.wNumbering:=PFN_LCLETTER;
pnLowRoman: para.wNumbering:=PFN_LCROMAN; pnLowRoman: para.wNumbering:=PFN_LCROMAN;
pnUpLetter: para.wNumbering:=PFN_UCLETTER; pnUpLetter: para.wNumbering:=PFN_UCLETTER;
pnUpRoman: para.wNumbering:=PFN_UCROMAN; pnUpRoman: para.wNumbering:=PFN_UCROMAN;
pnCustomChar: begin pnCustomChar: begin
para.wNumbering:=PFN_CUSTOM; para.wNumbering:=PFN_CUSTOM;
para.wNumberingStart:=Word(ANumber.NumCustom); para.wNumberingStart:=Word(ANumber.CustomChar);
para.dwMask:=para.dwMask or PFM_NUMBERINGSTART; para.dwMask:=para.dwMask or PFM_NUMBERINGSTART;
end; end;
end; end;
para.wNumberingTab:=round(ANumber.NumIndent*20); para.wNumberingTab:=round(ANumber.Indent*20);
eventmask:=RichEditManager.SetEventMask(AWinControl.Handle, 0); eventmask:=RichEditManager.SetEventMask(AWinControl.Handle, 0);
RichEditManager.SetPara2(AWinControl.Handle, TextStart, TextLen, para); RichEditManager.SetPara2(AWinControl.Handle, TextStart, TextLen, para);
RichEditManager.SetEventMask(AWinControl.Handle, eventmask) RichEditManager.SetEventMask(AWinControl.Handle, eventmask)

View File

@@ -184,6 +184,14 @@ const
CFM_BACKCOLOR = $04000000; CFM_BACKCOLOR = $04000000;
CFE_AUTOBACKCOLOR = CFM_BACKCOLOR; CFE_AUTOBACKCOLOR = CFM_BACKCOLOR;
const
PFNS_PAREN = $0000;
PFNS_PARENS = $0100;
PFNS_PERIOD = $0200;
PFNS_PLAIN = $0300;
PFNS_NONUMBER = $0400;
PFNS_NEWNUMBER = $8000;
implementation implementation
const const