Page 1 of 1

[Demo] Dual editor for translators

Posted: Tue Sep 06, 2005 5:26 pm
by Sergey Tkachenko
Demo:
http://www.trichview.com/support/files/dualeditor.zip

A helper for human translators. It has two editors - one for the original text and one for the translated text. This screenshot shows English text and its Russian translation:
Image

This demo does two things:
1) synchronizes scrolling
2) highlights the currect paragraph in the focused editor, and the corresponding paragraph in another editor.

While (1) is a straightforward procedure, (2) is a kind of trick, because
custom drawing events were not designed for such things, and it slows down editing (because it needs to repaint both editors on each caret movement). If you decide to implement (2) in your application, I recommend to make it optional.

Posted: Tue Sep 06, 2005 11:36 pm
by lkessler
It would seem to me that this could be used to implement a splitter to divide a RVEdit window into two screens. That's something I will want to implement in the future. However, I will need it to work with tables.

Also, is the Invalidate function "smart" in knowing that it only needs to refresh the screen and not need to reformat?

Posted: Wed Sep 07, 2005 9:52 am
by Sergey Tkachenko
This demo does not modify the second editor, if the text in the first editor is changed. It only highlights paragraph with the same index.

Displaying 'Filename' for open document/file

Posted: Sat May 13, 2006 2:14 pm
by Nostradamus
Hello Sergey,

1 How do I display filenames {in a status bar TPanel} in the dualeditor for two open documents?

Would this be done the same way as for Editor 2 in the demos provided?

2 When I do SaveAs,,,

when the dialog window opens .... How do I get the current filename to appear in the window where it asks name of file?

Any help is appreciated

Richard

Posted: Mon May 15, 2006 1:45 pm
by Sergey Tkachenko
Yes, do it like in the Editor2 demo.
TRichView does not store names of files, you need to do it yourself (or use RichViewActions)

Re: [Demo] Dual editor for translators

Posted: Sat Aug 25, 2018 5:37 am
by Nostradamus
Hello Sergey ,

I have upgraded to Delphi 10 and the Translator demo no longer works. Can you tweet it so it will work with Delphi 2010 ? the error log mentions incompatible types 'Char' and 'Word'
Cheers

Richard

Re: [Demo] Dual editor for translators

Posted: Mon Aug 27, 2018 6:30 am
by Sergey Tkachenko
I cannot reproduce the problem. I just compiled this demo using TRichView 17.5 and a new version of Delphi.

Where is the error exactly?

Re: [Demo] Dual editor for translators

Posted: Tue Aug 28, 2018 5:34 am
by Nostradamus
Hi Sergey,

Yes I tried that version & it does work with D 2010

I have a more elaborate version which selects/highlights words [Previous.Word button & Next.word Button ] that trigger a table. source.word search and retrieves table target word
and posts results in DBEdit.

This Project worked OK in Delphi 5 Enterprise with TNT Controls, TRichView and Rubicon Text Search.

Maybe I can get it to work or open if I try downloading and installing TNT Controls for 2009.
Otherwise, I will have to start from scratch.

I will try a few more things before asking again.

Thanks

Richard

Re: [Demo] Dual editor for translators

Posted: Sun Jul 07, 2019 6:19 am
by Nostradamus
HELLO SERGEY,

I HAVE DECIDED TO TRY AGAIN TO GET THIS OLD DELPHI 5 PROJECT WHICH IS MODIFIED TO SELECT WORDS

WORKING UNDER DELPHI 2010 ENTERPRISE

I HAVE ZIPPED IT FOR YOU TO SEE AND EXPLAIN IF POSSIBLE HOW TO CHANGE IT TO RUN ON DELPHI 2010 WITH WINDOWS 7
ANY HELP IS APPRECIATED

SEE ATTACHED PROJECT DUALEDITOR.ZIP

RICHARD

FROM AUSTRALIA

Re: [Demo] Dual editor for translators

Posted: Mon Jul 08, 2019 10:46 am
by Sergey Tkachenko
Nostradamus, this project was created in the old version of TRichView. The only required change to make it work in the new version of TRichView, is removing type-casting to Word in all calls of IsDelimiterW.
For example, change

Code: Select all

rve.RVData.IsDelimiterW(Word(ws[Offs]))
to

Code: Select all

rve.RVData.IsDelimiterW(ws[Offs])

Re: [Demo] Dual editor for translators

Posted: Mon Jul 08, 2019 11:22 am
by Nostradamus
GREAT !

IT WORKS NOW

THANKS SERGEY

Re: [Demo] Dual editor for translators

Posted: Sat Aug 26, 2023 3:11 am
by Nostradamus
Hello Sergey,
Can you please show me how to connect the Label.caption text data into a search
eg Highlighted word in TRichViewEdit is "above".
So....as part of the Onclick event
Select from table "Uni_Dict "
using the following :-
Label.caption := "above" [this is just a static example the real code will need to dynamically search for new words from Label.caption
after the "next-word"" button click or "previous-word" button click]

I guess a drop database or something would start a fresh search after each button click.
then search database "Uni_Dict"
where Uni_Dict.Eng := [Label.Caption]
I will send a zip of the project it runs from folder "C:\Delphi_DB_Projects\DB_Dual Editor WORD SELECT"
The current highlighted word would cause the upper dbText and DBEdit windows on the MAINFORM to be populated for each new word located in the database.

Any Help is appreciated.
I think this will help Lajos.

Cheers
Nostradamus

Re: [Demo] Dual editor for translators

Posted: Tue Aug 29, 2023 9:22 am
by Sergey Tkachenko
Use GetCurrentWord function from RVGetTextW unit, assign its result to the label's Caption.
Do it in OnChange and in OnCaretMove events.