[TextEditor-mcc] Re: MUIA_TextEditor_ContentsLen

  • From: Jens Langner <Jens.Langner@xxxxxxxxxxxxxx>
  • To: texteditor_mcc@xxxxxxxxxxxxx
  • Date: Thu, 28 May 2009 10:30:08 +0200

Hi Gianfranco,

Gianfranco "ShInKurO" Gignina schrieb:

>> Hmm, ok. Now I see what you are using "ULONG operation" for. However, I
>> feel this is incorrect. You are using MUIF_#? for the "ULONG
>> operation". But MUIF_#? defines are meant to carry flags and not
>> operations. In addition the autodoc do not explain what the "ULONG
>> flags" is then for? What is the difference between operation and flags
>> there?
>>
> 
> Yes, operation is what you see into other methods like a flag, I've used
> this because in this way who use this method already knows which for
> example MUIF_TextEditor_SetBlock_StyleBold is similar to
> MUIA_TextEditor_StyleBold, in effect I don't know what could use instead of
> MUIF_#?, is there another MUI standard to indicate an operation?
> ULONG flag is interpreted differently: if you use 
> MUIF_TextEditor_SetBlock_Color then method wants a number pen (like
> MUIA_TextEditor_Pen), while if operation is a style then method will read
> flag like a boolean value...

Ok, now I get it. However, I do feel that the functionality have to be a
little bit tuned/refined.

So please see my suggested autodoc entry for that new
MUIM_TextEditor_SetBlock method:

-- cut here --
TextEditor.mcc/MUIM_TextEditor_SetBlock

    NAME
        MUIM_TextEditor_SetBlock (v15.29)

    SYNOPSIS
        DoMethod(obj, MUIM_TextEditor_SetBlock,
                      ULONG startx, ULONG starty,
                      ULONG stopx, ULONG stopy,
                      ULONG operation, ULONG value);

    FUNCTION
        This method performs a specific operation on a text block that
        is defined by four coordinates (startx,starty,stopx,stopy)
        (see MUIM_TextEditor_BlockInfo). The types of operations that
        can be performed are supplied via a flag variable 'operation'
        and an optional value for all operations can be supplied via
        'value'.

        Possible flags for the 'operation' variable are:

          MUIF_TextEditor_SetBlock_Color:
            The text block will be assigned a text color in accordance
            to the supplied color number in parameter 'value'.
            (see MUIA_TextEditor_ColorMap and MUIA_TextEditor_Pen).

          MUIF_TextEditor_SetBlock_StyleBold:
            Depending on the content of the 'value' (TRUE/FALSE) the
            selected text block will get the bold style added or
            removed.

          MUIF_TextEditor_SetBlock_StyleItalic:
            Depending on the content of 'value' (TRUE/FALSE) the
            selected text block will get the italic style added or
            removed.

          MUIF_TextEditor_SetBlock_StyleUnderline:
            Depending on the content of 'value' (TRUE/FALSE) the
            selected text block will get the underline style added or
            removed.

          MUIF_TextEditor_SetBlock_Flow:
            Depending on the content of 'value' the selected text block
            will change it's alignment.
            (see MUIA_TextEditor_Flow for possible values)

    RESULT
        TRUE if operation succeeded, FALSE if it failed.

    NOTE
        When combining multiple operations via flags, care have to be
        taken for the content of 'value'. E.g. it is not possible to
        have bold style added and italic style removed because of the
        global usage of the 'value' parameter. So for mutual exclusive
        operations you will have to call this method multiple times.

    SEE ALSO
        MUIA_TextEditor_ExportBlock
        MUIM_TextEditor_BlockInfo
        MUIA_TextEditor_ColorMap
        MUIA_TextEditor_Pen
        MUIA_TextEditor_Flow
-- cut here --

As you can see I have changed/suggested a few changes:

(1) renaming 'flags' to 'value' to make it more clear.

(2) make the text more clear on what the real purpose is. In addition, I
added a NOTE about the mutual exclusive character of this method.

(3) added the MUIF_TextEditor_SetBlock_Flow flag to it to allow to also
change the text alignment on a specified text block.

So, Gianfranco, it would be great if you could check my above changed to
your suggested functionality and adapt your SetBlock method accordingly.
Then please resubmit your diff file and if everything looks fine you cna
commit your changes.

Of course, comments from others on this mailinglist are welcome.

regards,
jens
-- 
Jens Langner, Dresden/Germany
http://www.jens-langner.de/
-- 
_____________________________________________________________________________
TextEditor ML   - //www.freelists.org/list/texteditor_mcc
Listserver help - mailto:texteditor_mcc-request@xxxxxxxxxxxxx?Subject=HELP
Bugtracker......: http://sourceforge.net/tracker/?atid=731469&group_id=135025


Other related posts: