📄 rvrvdata.pas
字号:
procedure TRichViewRVData.DoRVMouseUp(Button: TMouseButton;
Shift: TShiftState; ItemNo, X, Y: Integer);
begin
if IsAssignedRVMouseUp then
TCustomRichView(FRichView).OnRVMouseUp(TCustomRichView(FRichView),Button,Shift,ItemNo,X,Y);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DoRVRightClick(const ClickedWord: String;
StyleNo, X, Y: Integer);
begin
if Assigned(TCustomRichView(FRichView).OnRVRightClick) then
TCustomRichView(FRichView).OnRVRightClick(TCustomRichView(FRichView), ClickedWord,
StyleNo, X, Y);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DoJump(id: Integer);
begin
if Assigned(TCustomRichView(FRichView).OnJump) then
TCustomRichView(FRichView).OnJump(TCustomRichView(FRichView), id);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.HTMLSaveImage(RVData: TCustomRVData; ItemNo: Integer;
const Path: String; BackgroundColor: TColor;
var Location: String; var DoDefault: Boolean);
begin
Location := '';
DoDefault := True;
if Assigned(TCustomRichView(FRichView).OnHTMLSaveImage) then
TCustomRichView(FRichView).OnHTMLSaveImage(TCustomRichView(FRichView), RVData, ItemNo, Path, BackgroundColor, Location, DoDefault);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DoRVDblClick(const ClickedWord: String; StyleNo: Integer);
begin
if Assigned(TCustomRichView(FRichView).OnRVDblClick) then
TCustomRichView(FRichView).OnRVDblClick(TCustomRichView(FRichView), ClickedWord, StyleNo);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DoSelect;
begin
if Assigned(TCustomRichView(FRichView).OnSelect) and
not (csDestroying in FRichView.ComponentState) and
FRichView.HandleAllocated then
TCustomRichView(FRichView).OnSelect(TCustomRichView(FRichView));
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DoCheckpointVisible(CheckpointData: TCheckpointData);
begin
if Assigned(TCustomRichView(FRichView).OnCheckpointVisible) then
TCustomRichView(FRichView).OnCheckpointVisible(TCustomRichView(FRichView), CheckpointData);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.ControlAction2(ControlAction: TRVControlAction;
ItemNo: Integer; var Control: TControl);
begin
if Assigned(TCustomRichView(FRichView).OnControlAction) then
TCustomRichView(FRichView).OnControlAction(TCustomRichView(FRichView), ControlAction,
ItemNo, Control);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.ItemAction(ItemAction: TRVItemAction; Item: TCustomRVItemInfo;
var Text: String; RVData: TCustomRVData);
begin
if Assigned(TCustomRichView(FRichView).OnItemAction) then
TCustomRichView(FRichView).OnItemAction(TCustomRichView(FRichView), ItemAction,
Item, Text, RVData);
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetWidth: Integer;
begin
Result := FRichView.ClientWidth;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetHeight: Integer;
begin
Result := FRichView.ClientHeight;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetAreaWidth: Integer;
begin
Result := FRichView.AreaWidth;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetFlags: TRVFlags;
begin
Result := TCustomRichView(FRichView).Flags;
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.SetFlags(const Value: TRVFlags);
begin
TCustomRichView(FRichView).Flags := Value;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetHOffs: Integer;
begin
Result := TCustomRichView(FRichView).HScrollPos;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetVOffs: Integer;
begin
Result := TCustomRichView(FRichView).VScrollPos*TCustomRichView(FRichView).VSmallStep;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetLeftMargin: Integer;
begin
Result := TCustomRichView(FRichView).LeftMargin;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetRightMargin: Integer;
begin
Result := TCustomRichView(FRichView).RightMargin;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetBottomMargin: Integer;
begin
Result := TCustomRichView(FRichView).BottomMargin;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetTopMargin: Integer;
begin
Result := TCustomRichView(FRichView).TopMargin;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetMaxTextWidth: Integer;
begin
Result := TCustomRichView(FRichView).MaxTextWidth;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetMinTextWidth: Integer;
begin
Result := TCustomRichView(FRichView).MinTextWidth;
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.AdjustVScrollUnits;
var v: Integer;
begin
if DocumentHeight div TCustomRichView(FRichView).VSmallStep > 32000 then begin
v := DocumentHeight div 32000;
if DocumentHeight div v > 32000 then
inc(v);
TCustomRichView(FRichView).VSmallStep := v;
end
{$IFNDEF DONOTDECVSCROLLUNITS}
else if (TCustomRichView(FRichView).VSmallStep>10) and
(DocumentHeight div 10 <= 32000) then
TCustomRichView(FRichView).VSmallStep := 10;
{$ENDIF}
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.SetDocumentAreaSize(Width, Height: Integer;
UpdateH: Boolean);
var h: Integer;
begin
//Width := MulDiv(Width,ZoomPercent,100);
//Height := MulDiv(Height,ZoomPercent,100);
{$IFDEF RVDEBUG}{$I Debug\c.inc}{$ENDIF}
h := Height div TCustomRichView(FRichView).VSmallStep;
if (Height mod TCustomRichView(FRichView).VSmallStep)>0 then
inc(h);
FRichView.UpdateScrollBars(Width, h, UpdateH,True);
{$IFDEF RV_ODHC}
if Assigned(TCustomRichView(FRichView).OnDocumentHeightChange) then
TCustomRichView(FRichView).OnDocumentHeightChange(FRichView);
{$ENDIF}
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.ScrollTo(Y: Integer; Redraw: Boolean);
begin
if rvstNoScroll in State then
exit;
if Redraw then
FRichView.ScrollTo(Y)
else
FRichView.ScrollToNoRedraw(Y)
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.HScrollTo(X: Integer);
begin
if rvstNoScroll in State then
exit;
TCustomRichView(FRichView).HScrollPos := X;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetVSmallStep: Integer;
begin
Result := TCustomRichView(FRichView).VSmallStep;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetBackground: TRVBackground;
begin
Result := TCustomRichView(FRichView).Background;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetColor: TColor;
begin
if TCustomRichView(FRichView).Color<>clNone then
Result := TCustomRichView(FRichView).Color
else
Result := TCustomRichView(FRichView).Style.Color;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetNormalCursor: TCursor;
begin
Result := TCustomRichView(FRichView).Cursor;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetDelimiters: String;
begin
Result := TCustomRichView(FRichView).Delimiters;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetCPEventKind: TCPEventKind;
begin
Result := TCustomRichView(FRichView).CPEventKind;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetCanvas: TCanvas;
begin
Result := TCustomRichView(FRichView).Canvas;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetRVStyle: TRVStyle;
begin
Result := TCustomRichView(FRichView).Style;
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.ClearTemporal;
begin
//if not (rvstResizing in State) then
// FRichView.DestroyInplace;
inherited ClearTemporal;
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.AssignChosenRVData(RVData: TCustomRVFormattedData;
Item: TCustomRVItemInfo);
begin
FRichView.AssignChosenRVData(RVData, Item);
inherited AssignChosenRVData(RVData, Item);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.SilentReplaceChosenRVData(
RVData: TCustomRVFormattedData);
begin
FRichView.SilentReplaceChosenRVData(RVData);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.UnassignChosenRVData(RVData: TCustomRVData);
begin
if rvstUnAssigningChosen in State then
exit;
State := State+[rvstUnAssigningChosen];
try
inherited UnassignChosenRVData(RVData);
FRichView.UnassignChosenRVData(RVData);
finally
State := State-[rvstUnAssigningChosen]
end;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetInplaceEditor: TControl;
begin
Result := TCustomRichView(FRichView).InplaceEditor;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetChosenRVData: TCustomRVData;
begin
Result := TCustomRichView(FRichView).ChosenRVData as TCustomRVData;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetChosenItem: TCustomRVItemInfo;
begin
Result := TCustomRichView(FRichView).ChosenItem as TCustomRVItemInfo;
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DestroyInplaceEditor;
begin
FRichView.DestroyInplace;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetRTFProperties: TPersistent;
begin
Result := TCustomRichView(FRichView).RTFReadProperties
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetRVFParaStylesReadMode: TRVFReaderStyleMode;
begin
Result := TCustomRichView(FRichView).RVFParaStylesReadMode;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetRVFTextStylesReadMode: TRVFReaderStyleMode;
begin
Result := TCustomRichView(FRichView).RVFTextStylesReadMode;
end;
{------------------------------------------------------------------------------}
function TRichViewRVData.GetBiDiMode: TRVBiDiMode;
begin
Result := TCustomRichView(FRichView).BiDiMode;
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.InitStyleMappings(var PTextStylesMapping,
PParaStylesMapping, PListStylesMapping: PRVIntegerList);
begin
PTextStylesMapping := @RVFTextStylesMapping;
PParaStylesMapping := @RVFParaStylesMapping;
PListStylesMapping := @RVFListStyleMapping;
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DoneStyleMappings(PTextStylesMapping,
PParaStylesMapping, PListStylesMapping: PRVIntegerList);
begin
(PTextStylesMapping^).Free;
(PParaStylesMapping^).Free;
(PListStylesMapping^).Free;
PTextStylesMapping^ := nil;
PParaStylesMapping^ := nil;
PListStylesMapping^ := nil;
end;
{------------------------------------------------------------------------------}
{$IFNDEF RVDONOTUSELISTS}
function TRichViewRVData.GetMarkers(AllowCreate: Boolean): TRVMarkerList;
begin
if rvflRoot in Flags then begin
if (FMarkers=nil) and AllowCreate then
FMarkers := TRVMarkerList.Create;
Result := FMarkers;
end
else
Result := inherited GetMarkers(AllowCreate);
end;
{------------------------------------------------------------------------------}
procedure TRichViewRVData.DestroyMarkers;
begin
if rvflRoot in Flags then begin
FMarkers.Free;
FMarkers := nil;
end
else
inherited DestroyMarkers;
end;
{$ENDIF}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -