 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Mon Sep 15, 2014 11:26 am Post subject: |
|
|
For text underline it does it with a standard underline because it's a Windows font and not a stick (stroke) font.
My suggestion is that you keep a list of graphics elements including the text complete with their bounding coordinates on screen, where they can be clicked to select (also coordinates), and their specific features such as colour, type (text, filled polygon, unfilled polygon etc). On receiving a 'selection click', run through the list to choose which graphic element has been selected, and then draw it with some sort of highlight, e.g. a bounding box.
If the editable items are movable, then you will need to enable 'click and drag', if text strings are scalable you may need to draw 'handles' to allow the bounding box to be stretched. You can permit text editing in a pop up window which is probably simplest. If you want 'on screen' or 'in place' editing, you will need to do a graphics update after each keystroke, and this will cause the screen to flicker unless you have a fast computer: you only need to update an area equal to the larger of the original or new bounding boxes.
You will also need an 'end of editing' convention: this is easiest with the pop up window, because it coincides with window closure. You will also have to figure out a stack of changes if you need an 'undo-redo' facility.
In another thread we had some code for a resizable 'stretchy box' which was done in this thread:
"Some suggestions for future enhancements to Clearwin+"
and it might give you some ideas as how to implement editing in your graphics callback routine.
Eddie |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Tue Sep 16, 2014 10:53 am Post subject: |
|
|
John,
The 'list' would be a set of arrays (for a simple man like myself) or data structures containing the data to allow any element to be selected, modified and/or be redrawn, so yes, stored in the program.
When it comes to editing a text string with attributes for every character, then doing it in a string edit box in a popup window could save you a vast amount of programming. If you want to do it yourself then you need to get into the intricacies of such things as the EDIT_INFO structure. %lv and %bv etc give me heartburn ...
Your para c. has hit the nail on the head. If you do the editing on the surface you do need to update after each character: if you do it in a popup you only need to refresh when that window is closed. The routine is SET_UPDATE_RECTANGLE@, but unless you want to set clipping limits yourself, or your drawing is extremely complex, just redraw everything: Clearwin+ and Windows will do the clipping for you and only update in the selected rectangle. Only the update rectangle will flash, and clashes are sorted out automatically: text is probably the last to be drawn.
The reminder of the 'stretchy box' was a reminder that all of this has to be done in a graphics callback, and the first step is to decide how you select which object to edit (and show that it is selected). The stretchy box updates on screen, has no undo, and edits with the mouse. You may need to have a toolbar, and/or menu items, and/or accelerator shortcut keys for your specific functions as well as accepting keys and mouse edits!
I agree that the documentation is sometimes out of date, and/or minimalist. I have at various times printed out the full PDF documentation, and the .ENH file. The PDF documentation is years out of date, one or two things aren't even in the ENH file but only on the knowledgebase, and the CHM file doesn't always give you what you want either.
Eddie |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Tue Sep 16, 2014 4:27 pm Post subject: |
|
|
My last thoughts for today are to have a go with a graphics program and watch very carefully how it is done there. My favourite is CorelDraw!
If you want more than simple string editing, then do it in a popup window that instead of an editable string window has its own %gr box, and update that after every keystroke. The routine GET_TEXT_SIZE@ could be useful in this. CorelDraw! has such a thing after a text label has been selected if you press Ctrl-Shift_T.
Maybe every character should have qualifications stored as bits for B, I, u, subscript, superscript etc so you only need a byte extra per character (you have to be comfortable with bit-handling), but you'll need more than that to remember font changes.
I know I should get a life, but I have diligently read the ENH file for ideas, then in the FTN95.CHM I have read through the alphabetical lists of allowable format codes ('format code reference'), the alphabetical list of library routines ('library reference'). This has given me vague recollections along the lines of 'I know there's something about that in the ...' Finally, read the MS User Experience Guidelines.
Eddie |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Wed Sep 17, 2014 8:26 pm Post subject: |
|
|
No, I meant start a new window. The �Edit text� window in CorelDRAW! could be programmed with Clearwin+ like this, starting with:
Code: | I=WINIO@(�%ca[Edit text] � |
And the window probably needs a %ww with options nomaxminbox, toolwindow and fixed_size.
The next line contains a drop-down selection box with a list of font names, a drop-down box with font sizes, buttons for bold, italic, underline, then a drop down list box for justification options (left, centre, right) � all this lot looking like a toolbar. The buttons would be generated with %tb or %ib. It is clearly followed by a %nl, then a %gr which displays the text, followed by another %nl � then some buttons in a row:
Code: | I=WINIO@(%8bt[Options]%8bt[Import]%8bt[OK]%8bt[Cancel]%8bt[Help]�) |
(Don't forget the ^ qualifiers to set up callbacks, and ~ for the buttons that are greyable)
If you do it the same way as CorelDRAW!, you would need callbacks for the drop-down selection boxes and the buttons in the top row.
The first two of the buttons (and the last one) in the final row of labelled buttons launch other dialog boxes, the others exit the window.In the %gr area, the cursor is turned to the I-beam text selector style, and left-click and click and drag are enabled to select text for editing � which is done in the calback for %gr..
Maybe I should have called it a �new dialog box�.
Eddie |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|