Recent

Author Topic: lzRichEdit: Windows/Linux rich text implementation  (Read 35356 times)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2514
    • havefunsoft.com
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #60 on: December 07, 2014, 06:38:13 am »
I am very interested in this component, the feature I like most is Get/SetZoomState, which should make it much more useful than RichMemo. I presume it will zoom all text on the lzRichEdit.
Why don't you try this property then?
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

ekimtrah

  • New member
  • *
  • Posts: 5
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #61 on: December 07, 2014, 11:46:47 am »
@typo
But the one in lazrichedit.pas is

Code: [Select]
uses
  RichBox, WSRichBoxFactory, WSRichBox, Gtk2WSRichBox, Gtk2WSRichBoxFactory,
  Gtk2RTFTool, LazarusPackageIntf;

Which has no compiler directive, should I edit this file, even though it says

Code: [Select]
{ This file was automatically created by Lazarus. Do not edit!
  This source is only used to compile and install the package.
 }

Michael.
« Last Edit: December 07, 2014, 11:48:33 am by ekimtrah »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #62 on: December 07, 2014, 02:25:35 pm »
lazrichedit.pas:

Code: [Select]
{ This file was automatically created by Lazarus. Do not edit!
  This source is only used to compile and install the package.
 }

unit LazRichEdit;

interface

uses
    RichBox, WSRichBoxFactory, WSRichBox,
    {$IFDEF LCLWIN32} Win32WSRichBox, Win32WSRichBoxFactory,{$ENDIF}
    {$IFDEF LCLGTK2}Gtk2WSRichBox, Gtk2WSRichBoxFactory, Gtk2RTFTool,{$ENDIF}
  LazarusPackageIntf;   

Don't download lzRichEdit from SVN, download it from the wiki link.
« Last Edit: December 07, 2014, 04:39:48 pm by typo »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #63 on: December 07, 2014, 02:27:13 pm »
I am very interested in this component, the feature I like most is Get/SetZoomState, which should make it much more useful than RichMemo. I presume it will zoom all text on the lzRichEdit.
Why don't you try this property then?

Congratulations, skalogryz, good work. Finally Lazarus will have a RichEdit. Or two.

RichEdit was becoming an item of great frustration for Delphi users.

I have improved the HTML conversion for lzRichEdit, now it converts the metafile in PNG and the image can appear in the HTML pages. Although it is not part of the component itself. And the demo can also demonstrate how to use lzRichEdit in chat applications.
« Last Edit: December 07, 2014, 02:53:12 pm by typo »

ekimtrah

  • New member
  • *
  • Posts: 5
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #64 on: December 08, 2014, 12:59:09 am »
Why don't you try this property then?

Thank You, I obviously missed that one.

Don't download lzRichEdit from SVN, download it from the wiki link.

My bad, I thought I had got it from the wiki as that svn command is not in my history, but I just downloaded it from the wiki link and it was fine. Any hints on how to use the zoom ?
Thank You

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #65 on: December 08, 2014, 01:05:06 am »
Run the demo project.

Edit > Zoom

ti_dic

  • New member
  • *
  • Posts: 8
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #66 on: December 08, 2014, 10:09:07 pm »
Hi, the demo on http://sourceforge.net/projects/lazarusfiles/files/lzRichEdit.zip/download don't compile on linux.

some "uses" don't work under linux and some {$IFNDEF WINDOWS}  are missing for replacing TRichEditAlignment by TAlignment
« Last Edit: December 08, 2014, 10:10:43 pm by ti_dic »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #67 on: December 08, 2014, 10:50:12 pm »
Have you downloaded it from the wiki link?

There are compiler directives around all of them. There should be several modifications after you downloaded it.

RichEdit alignment needs an aditional value, which is for full justification. So TRichEditAlignment has 4 possible values, while TAlignment has 3. For instance, function GetAlignment is declared so:

Code: [Select]
function GetAlignment: {$IFNDEF WINDOWS}TAlignment {$ELSE}TRichEditAlignment {$ENDIF};

Please correct something which is not in this way.

« Last Edit: December 09, 2014, 02:58:38 am by typo »

ti_dic

  • New member
  • *
  • Posts: 8
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #68 on: December 09, 2014, 09:23:04 am »
I downloaded the sources from the wiki link.
do you have a svn or git? it's will be more easy for me to make a patch.

for example in UParagrafo.pas line 147 the $IFDEF is missing for the case
Code: [Select]
  case TRichBox(RichControl).Paragraph.Alignment of
    traLeft: ComboBox1.ItemIndex:= 2;
    traCenter: ComboBox1.ItemIndex:= 0;
    traRight: ComboBox1.ItemIndex:= 1;
    traJustify: ComboBox1.ItemIndex:= 3;
  end;
i think it's would be more easier to replace TAlignment by TRichEditAlignment in linux case. And in TRichEditAlignment to set inside $IFDEF the  "traJustify", there will be less code to correct.

in UPrincipal.Pas, line 423 the routine GetFileNameHandle should be inside a $IFDEF
etc...


Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1251
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #69 on: December 09, 2014, 10:07:21 am »
Nice :-)   Just wanted to say Thanks @Typo - you're right, this has been outstanding for too long.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

ekimtrah

  • New member
  • *
  • Posts: 5
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #70 on: December 09, 2014, 01:26:05 pm »
Run the demo project.

Edit > Zoom

Hi, the demo on http://sourceforge.net/projects/lazarusfiles/files/lzRichEdit.zip/download don't compile on linux.

I could not get it to compile on Linux either (It was from the wiki link, I attached the errors in a file), so I copied a bit of the code from the demo project and put it in a small test project (attached, see TForm1.Button1Click). Single stepping from the call to SetZoomState ends up in TWSCustomRichBox.SetZoomState, which is empty. Is this Linux specific code which hasn't been filled in yet. I would be happy to test any proposed changes.
Michael

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #71 on: December 09, 2014, 02:09:01 pm »
@ti_dic

Code: [Select]
case ComboBox1.ItemIndex of
    {$IFDEF WINDOWS}
    3: TRichBox(RichControl).Paragraph.Alignment := traJustify;
    {$ENDIF}
    2: TRichBox(RichControl).Paragraph.Alignment := {$IFNDEF WINDOWS}taLeftJustify
                                                    {$ELSE}traLeft{$ENDIF};
    1: TRichBox(RichControl).Paragraph.Alignment := {$IFNDEF WINDOWS}taRightJustify
                                                    {$ELSE}traRight{$ENDIF};
    0: TRichBox(RichControl).Paragraph.Alignment := {$IFNDEF WINDOWS}taCenter
                                                    {$ELSE}traCenter{$ENDIF};
  end;

Code: [Select]
case TRichBox(RichControl).Paragraph.Alignment of
    {$IFNDEF WINDOWS}taLeftJustify{$ELSE}traLeft{$ENDIF}:
      ComboBox1.ItemIndex:= 2;
    {$IFNDEF WINDOWS}taCenter{$ELSE}traCenter{$ENDIF}:
      ComboBox1.ItemIndex:= 0;
    {$IFNDEF WINDOWS}taRightJustify{$ELSE}traRight{$ENDIF}:
      ComboBox1.ItemIndex:= 1;
    {$IFDEF WINDOWS}traJustify: ComboBox1.ItemIndex:= 3;{$ENDIF}
  end;     

@ekimtrah

Thanks for the info. If you download now, the errors are already corrected. See the code above.

If you make the above modifications, you can run the demo and can see what lzRichEdit can do in Linux. It is not so much. If you can help, I would appreciate. If you can contribute with code, you could use this ( https://sourceforge.net/p/lazarusfiles/discussion/general/ ) or post it here.
« Last Edit: December 09, 2014, 03:14:43 pm by typo »

ti_dic

  • New member
  • *
  • Posts: 8
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #72 on: December 09, 2014, 03:57:26 pm »
@typo :

thank but i already corrected all compilation error on my computer (when i have wrote my first message), i don't know how to make a patch which i can send to you, without a svn.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #73 on: December 09, 2014, 04:29:31 pm »
You can post code directly in that forum, without patch.

ti_dic

  • New member
  • *
  • Posts: 8
Re: lzRichEdit: Windows/Linux rich text implementation
« Reply #74 on: December 09, 2014, 04:37:06 pm »
for the all demo compile with the lastest source code i added that :

Code: [Select]
{$IFNDEF WINDOWS}
const
  traLeft = taLeftJustify;
  traRight = taRightJustify;
  traCenter = taCenter;
  traJustify = taLeftJustify;
type
{$ELSE}
TRichEditAlignment = (traLeft, traRight, traCenter, traJustify);    // added
{$ENDIF} 


 

TinyPortal © 2005-2018