Changing The Insert Picture Dialog

General TRichView support forum. Please post your questions here
Post Reply
carloscastro
Posts: 13
Joined: Fri Feb 24, 2006 5:48 pm

Changing The Insert Picture Dialog

Post by carloscastro »

Hi,

Is there an easy way to change the default insert picture dialog but still using the default insertpicture action, like the colordialog in the control panel.

Also another doubt. By default temporary image files are saved with the "img" prefix. Is there a way to define this prefix or is it by default.

Thanks,
Carlos Castro
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TrvActionInsertPicture is not very complicated.
It displayes a file open dialog, loads the chosen picture (using temporal TPicture object, because it can detect graphic format), then inserts the picture using InsertPicture method.

I think if you need a different dialog, you can create your own action or menu command instead of it.
carloscastro
Posts: 13
Joined: Fri Feb 24, 2006 5:48 pm

Post by carloscastro »

Thanks Sergey,

I doing a new one, which as the ability to resize the image to a predefined maximux width and also has the ability to make simple adjustments like brithness, contrast and intensity.

But for the second part of the question, is there a way to change the "img" prefix, richedit uses to store temporary images.

Thanks,

Carlos Castro
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This prefix is a parameter of SaveHTML/SaveHTMLEx methods.
In RichViewActions, it can be modified as TrvActionExport.ImagePrefix property.
carloscastro
Posts: 13
Joined: Fri Feb 24, 2006 5:48 pm

Post by carloscastro »

Sorry Sergey,

As for the image prefix, is there a way to change the styles prefix from "rsv---. it get messy when you have several text generated by trichview within the same html page.

Thanks,

Carlos Castro
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am sorry, currently prefixes of text and paragraph styles are hardcoded.
To create one HTML from several documents, you need to create common collections of styles for them.

How to do it

Load the first document (LoadRVFFromStream). You can export it to HTML, but do not save CSS table yet.
Clear.

Load the next document using InsertRVFFromStream. Styles will be not replaced but added.
You can export it to HTML, but do not save CSS table yet.
Clear.

Repeat for all documents. Do not call Format, and this procedure will be fast.

At the end of this step, you have RVStyle containing styles necessary to display all your documents. You can save CSS table now.
carloscastro
Posts: 13
Joined: Fri Feb 24, 2006 5:48 pm

Post by carloscastro »

I understand but that solution doesnt fit my needs.
I already managed to work out a solution.

I am working with databases.
I have a database with news posts.
Each record has a text field which holds the html produced by the richview editor.
Then the webserver with php generates a page containing for exemple 10 news posts. That when thing got messy. because each record has the same styles names "rsvtX"
Showing 10 posts in a page produced by php would mess things up.

So what i did was before posting the html code to the database I export it to a stringlist and then use the id of each record and replace the "rsvt" text with someting like "csst1_", where the number 1 corresponds to the id of the record in the database.
The final html code which goes to the text field in the database has styles named like csst1_1, csst1_2 and ccsp1_1, cssp1_2 for the first record in the database.
For the second records it looks like csst2_1, csst2_2 and cssp2_1, cssp2_2.
So i can get as many records i want in an php html produced page that styles never get messed up.

I know html code get a little longer but not that much.

Hope you could understand my explanation as it gets useful for others.

Thanks anyway for your attention,

Regards,
Carlos Castro
carloscastro
Posts: 13
Joined: Fri Feb 24, 2006 5:48 pm

Post by carloscastro »

Sorry Sergey,

I have the remove unsed styles option set to True, but when i export to htmlcss it keeps some css styles which are not used in the html text.

Am i missing something here...do i have to execute something to remove them before exporting.

Thanks,

Carlos Castro
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1) Only styles that have Standard property = False can be deleted automatically. All styles added on inserting other documents have Standard=False (there was a bug in HTML importer, it added "Standard=True" styles, it was fixes). All styles added as a result of editing operations must have Standard=False (if you use RichViewActions, or your code in OnStyleConversion is based on trichview demos)
2) Unused styles are deleted on document loading.
Post Reply