Skip to content

Patch implementing Bullet and numeric lists and hyper links in qt5 an…#2

Open
jesusrmx wants to merge 1 commit intoskalogryz:masterfrom
jesusrmx:master
Open

Patch implementing Bullet and numeric lists and hyper links in qt5 an…#2
jesusrmx wants to merge 1 commit intoskalogryz:masterfrom
jesusrmx:master

Conversation

@jesusrmx
Copy link

…d gtk2.

Copy link
Owner

@skalogryz skalogryz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is definetly very desired overall, but it seems like it was done parts

The initial approach was to implement Gtk2 (by extending RichMemo APIs, due to limitations of Gtk2 itself)
But the later addition of Qt5 doesn't require all was extensions (as Qt5 rich editor is smarter than Gtk2).

Can you create a separate change request for RTF reading part only? :)

property OnPrintAction: TPrintActionEvent read fOnPrintAction write fOnPrintAction;
property OnLinkAction: TLinkActionEvent read fOnLinkAction write fOnLinkAction;
property CanRedo: Boolean read GetCanRedo;
property FastLoad: boolean read fFastLoad write fFastLoad;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"FastLoad" property is my biggest concern. Doesn't look like a nice API design.
I can understand if it's added as a parameter to LoadRTF, but adding it as a property seems awkward to me,
Because It doesn't affect the behavior of the control in general, it only comes into effect when loading data.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, FastLoad was not supposed to be exposed to the user, I will remove it and replace it with a developer flag, I'm not ready to remove the previous default code because I intended to do some tests and want it for reference. The chunked (fast) loading is what will remain.

end;

class function TWSCustomRichMemo.HandleKeyDown(const AWinControl: TWinControl;
key: word): boolean;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this TWSCustomRichMemo.HandleKeyDown() actually Gtk2 handle key?
I can see it's has a different implementation for Qt5.

Should the default implementation return false (just like Win version does) and this implementation move to Gtk2?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, I first implemented the gtk part without knowing that qt already do some things (and I have not touched the cocoa part yet), the intention was to handle bullet and numbered lists managing in a widgetset independent way, but it turned out to be not necessary, I hope cocoa also will not need it and then it will be moved to the gtk side.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about making a qt5 implentation first?

cocoa does do everything by itself, just like Windows and Qt.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!, then that solves it. I will move everything to gtk

@jesusrmx
Copy link
Author

The change is definetly very desired overall, but it seems like it was done parts

The initial approach was to implement Gtk2 (by extending RichMemo APIs, due to limitations of Gtk2 itself)
But the later addition of Qt5 doesn't require all was extensions (as Qt5 rich editor is smarter than Gtk2).

Can you create a separate change request for RTF reading part only? :)

You mean to split the parser/loading/saving from the rest?, I thought about it before submitting the pull request to split it in several parts, but in the end I didn't see gain on it. I cannot submit first the reading part, because it needs the Link and Lists support, but submitting first the other part will make the previous reading part not useful as there is not knowledge or support from the new part, also one can say that the gtk part could be splitted from the qt part, but as I say there seems to be no real gain on it.

Yet if you prefer it that way I can try to do it.

@jesusrmx
Copy link
Author

Ahem, I how do I do this?, I intend to start again by committing step by step, but how do I start? should I remove my fork or reset hard to the starting point? should first the pull request be cancelled? would that remove this conversation? ....

@skalogryz
Copy link
Owner

you might want to create a branch on your repository (the branch should be on the code w/o changes done).
Then commit (i.e. by cherry-picking) Qt5 related changes only.
And then create a pull-request based on that branch.

@skalogryz
Copy link
Owner

You mean to split the parser/loading/saving from the rest?,
yes and no.
I did notice that you're forcefully using RichMemo's built-in RTF reader/writer for Qt5.
I'm not really in a favor of that, BUT since i'm not the Qt5 maintainer, I totally agree with such approach :)

Thus I'd think that Qt5 update and RTF reader update could be delivered with a single pull request.

Gtk2 requires rework (to put everything insider of gtk2wsrichmemo) and should be pull requested separately

@jesusrmx
Copy link
Author

You mean to split the parser/loading/saving from the rest?,
yes and no.
I did notice that you're forcefully using RichMemo's built-in RTF reader/writer for Qt5.
I'm not really in a favor of that, BUT since i'm not the Qt5 maintainer, I totally agree with such approach :)

I don't know if QT5 can read and write .rtf format files, I could not find it (but I have to admit that I didn't search very hard), if you have other info please share it. The reference here was the windows writer as it its closed source we have to play with its restrictions, then the internal QT5 reader/writer (if it exists) will require to load and save in this same format. My patches make sure that read/write works cross widgetsets (or more precisely: except for windows and cocoa it seems)

Thus I'd think that Qt5 update and RTF reader update could be delivered with a single pull request.

Gtk2 requires rework (to put everything insider of gtk2wsrichmemo) and should be pull requested separately

The current implementation is completely agnostic on the widgetsets (I think it will work even in windows if the windows version of GetStyleRange is modified to process paragraphs in order to dectect numbered lists) so there is no way isolate only the Qt5 reader/writer part (or the gtk2 part)

@jesusrmx
Copy link
Author

you might want to create a branch on your repository (the branch should be on the code w/o changes done).
Then commit (i.e. by cherry-picking) Qt5 related changes only.
And then create a pull-request based on that branch.

I will try, it can be made in four stages. a)Qt5, b)Gtk2 c)Win d)Read/Write, thus can be abcd, adbc, bdac, any combination as you prefer, well except for dxxx because that would not compile, also d cannot be divided in Qt5 or Gtk parts btw.

@skalogryz
Copy link
Owner

I don't know if QT5 can read and write .rtf format files, I could not find it (but I have to admit that I didn't search very hard),
From my research the answer is No. Qt5 has a built-in support for some subset of HTML, but nothing for RTF.

My patches make sure that read/write works cross widgetsets (or more precisely: except for windows and cocoa it seems)
Exactly. This is the exact reason why the "custom parser" is even there. So users can disable "system native" parsers and use cross-platform support. Yes, it's limited, but should produce consistent results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants