Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Die Delphi-IDE (https://www.delphipraxis.net/62-die-delphi-ide/)
-   -   Neuerung ab Delphi 10.4: Schriftgröße änderbar! Wie IOTA-mäßig abfragen? (https://www.delphipraxis.net/208137-neuerung-ab-delphi-10-4-schriftgroesse-aenderbar-wie-iota-maessig-abfragen.html)

r29d43 16. Jun 2021 19:42


Neuerung ab Delphi 10.4: Schriftgröße änderbar! Wie IOTA-mäßig abfragen?
 
Hallo,

mit Delphi 10.4 kam die Neuerung, die Schriftgröße des IDE-Editors frei wählbar zu machen.

Weiß eventuell jemand, wo man IOTA-mäßig an diese Einstellung herankommt bzw. diese auslesen kann?

Da es dieses Feature noch nicht lange gibt, nehme ich mal an, wird man in ToolsAPI.pas danach vergeblich suchen?

Thx im Voraus
..

TiGü 17. Jun 2021 07:31

AW: IOTA-Neuerung ab Delphi 10.4: Schriftgröße änderbar! Wie abfragen?
 
Ich nehme an, du meinst diese neue Möglichkeit mit der TTrackbar und den beiden TButtons für kleiner und größer unterhalb des Editorsfensters.
Das sind ja nur Controls, die auf die bisherige Schrifteinstellung über Tools | Options | IDE | User Interface | Editor | Display mappen.

Da die Wizards vom CnPack das schon gefühlt schon immer konnten, lohnt sich ein Blick ins öffentliche GitHub-Repository:
https://github.com/cnpack/cnwizards/...orFontZoom.pas
https://github.com/cnpack/cnwizards/...CnWizUtils.pas

Daraus folgt für größer:
Delphi-Quellcode:
procedure TCnEditorFontInc.Execute;
var
  Option: IOTAEditOptions;
begin
  Option := CnOtaGetEditOptions;
  if Assigned(Option) then
    Option.FontSize := Round(Option.FontSize * 1.1);
end;

Und für kleiner:
Delphi-Quellcode:
procedure TCnEditorFontDec.Execute;
var
  Option: IOTAEditOptions;
begin
  Option := CnOtaGetEditOptions;
  if Assigned(Option) then
    Option.FontSize := Round(Option.FontSize / 1.1);
end;

Natürlich mithilfe von:
Delphi-Quellcode:
function CnOtaGetEditOptions: IOTAEditOptions;
var
  Svcs: IOTAEditorServices;
begin
  QuerySvcs(BorlandIDEServices, IOTAEditorServices, Svcs);
  if Assigned(Svcs) then
  begin
  {$IFDEF COMPILER7_UP}
    if Assigned(Svcs.GetTopBuffer) then
      Result := Svcs.GetTopBuffer.EditOptions
    else if Svcs.EditOptionsCount > 0 then
      Result := Svcs.GetEditOptionsIndex(0)
    else
      Result := nil;
  {$ELSE}
    Result := Svcs.GetEditOptions;
  {$ENDIF}
  end
  else
    Result := nil;
end;
QuerySvcs ist hier nur ein Wrapper mit Logmöglichkeit für das normale Supports() und kann damit ersetzt werden.

r29d43 17. Jun 2021 07:37

AW: Neuerung ab Delphi 10.4: Schriftgröße änderbar! Wie IOTA-mäßig abfragen?
 
Ja, thx, ich werde mir das nachher mal ansehen.

Ich hatte mich jetzt allerdings auch zu einer Lösung durchgewühlt:

Im

Zitat:

TViewPaintNotifier = class(TInterfacedObject, IOTANotifier, INTAEditViewNotifier)
steht nämlich diese von mir gesuchte Information faktisch im CellSize:TSize -Parameter der PaintLine-Procedure:

Delphi-Quellcode:
    procedure PaintLine(const View: IOTAEditView; LineNumber: Integer;
      const LineText: PAnsiChar; const TextWidth: Word;
      const LineAttributes: TOTAAttributeArray; const Canvas: TCanvas;
      const TextRect: TRect; const LineRect: TRect; const CellSize: TSize);
CellSize.CX ist da die Pixelzahl was ein Char breit ist.
CellSize.CY ist da die Pixelzahl was ein Char hoch ist.

Wird nun die Schriftgrößte per IDE-Schriftgrößtenregler geändert, spiegelt sich das also sofort auch in diesem Parameter wieder. Muss ja auch :stupid:

Stevie 17. Jun 2021 17:09

AW: IOTA-Neuerung ab Delphi 10.4: Schriftgröße änderbar! Wie abfragen?
 
Zitat:

Zitat von TiGü (Beitrag 1491168)
Das sind ja nur Controls, die auf die bisherige Schrifteinstellung über Tools | Options | IDE | User Interface | Editor | Display mappen.

Bzw Strg + Num+/-


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:25 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz