For all the line types I defined special text- and parastyles, 8 all in all
It looks that way:
Dialogue (HENRY, ALICE)
Code: Select all
rv.GetSelectionBounds(ItS, OfS, ItE, OfE, Norm);
rv.GetCurrentItem.StyleNo := 25;
rv.GetCurrentItem.ParaNo := 3;
rv.AddText(AnsiUppercase(tlJ.FocusedNode.Strings[tcJ.Index]), 25);
rv.AddText(#9, 26);
rv.GetSelectionBounds(ItS, OfS, ItE, OfE, Norm);
rv.Format;
Inc(ItE, 2);
rv.SetSelectionBounds(ItE, OfE, ItE, OfE);
if rv.CanFocus then
rv.SetFocus;
Directives (Regieanweisung, Sound)
For the other 7 line types the user presse [enter] for a new line and the he presses a button to choose the line typ (stage direction, music, sound etc.) Nothing else should happen that the current (caret position) changes to a spcial defined style.
Code: Select all
procedure TfMain.ScreenplayMode(Text, Para: Integer);
var ItS, OfS, ItE, OfE: Integer;
Norm: Boolean;
begin
rv.GetCurrentItem.StyleNo := Text;
rv.GetCurrentItem.ParaNo := Para;
rv.AddText('... ', Text); // +#+#+ bringt nichts
rv.GetSelectionBounds(ItS, OfS, ItE, OfE, Norm);
rv.Format;
rv.SetSelectionBounds(ItE, OfE, ItE, OfE);
end;
1. Dialogue - and I think other types too - change style during reloading the file. I think it is because the text file contains no information about a specific style number (logically) and RVEdit gets during opening the first fitting style. In case of the sample RVEdit changes 'blabla ...', because the textstyle is the same as No. 0 (normal) - should be 25. Thats very bad, because the user should be able to configure style- and para options. But the style assignment is lost ...
Q: How can I permanently assign a text- an parastyle to an item?
2. With the remaining 7 styles it only looks fine on the screen. But if I explore the text- and parastyles, I notice thet there are al large quantity of duplicate styles an each new text is assigned to one or two or three.
Q: How can I define in an existing line a special text-/para style without hundreds of style duplicates and without some text in the line?
I also tried out other ways e.g.
(caret is at the beginning of an empty line too)
Code: Select all
procedure TfMain.ScreenplayMode(Text, Para: Integer); // Text and Para are the style numbers
var ItS, OfS, ItE, OfE: Integer;
Norm: Boolean;
begin
FScreenplayConv := True;
rv.ApplyStyleConversion(Text);
FScreenplayConv := True;
rv.ApplyParaStyleConversion(Para);
end;
procedure TfMain.rvStyleConversion(Sender: TCustomRichViewEdit; StyleNo, UserData: Integer; AppliedToText: Boolean; var NewStyleNo: Integer);
begin
// Screenplay
if FScreenplayConv then
begin
NewStyleNo := UserData;
FScreenplayConv := False;
end;
end;
procedure TfMain.rvParaStyleConversion(Sender: TCustomRichViewEdit; StyleNo, UserData: Integer; AppliedToText: Boolean; var NewStyleNo: Integer);
begin
if FScreenplayConv then
begin
NewStyleNo := UserData;
FScreenplayConv := False;
end
end;
The problem is very complex, because the RVEdit rv is the main editor in a 31.000 lines unit and I'm very happy that in the meantime the program works properly