[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 --

        MUIM_TextEditor_SetBlock (v15.29)

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

        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

        Possible flags for the 'operation' variable are:

            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).

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

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

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

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

        TRUE if operation succeeded, FALSE if it failed.

        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.

-- 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.

Jens Langner, Dresden/Germany
TextEditor ML   - http://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: