[haiku-bugs] Re: [Haiku] #7002: Context menu for TextInput

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Thu, 23 Dec 2010 13:20:54 -0000

#7002: Context menu for TextInput
--------------------------+------------------------------------------------
  Reporter:  dancxjo      |        Owner:  axeld
      Type:  enhancement  |       Status:  new
  Priority:  normal       |    Milestone:  R1
 Component:               |      Version:  R1/Development
  Kits/Interface Kit      |     Keywords:  context menu text edit textinput
Resolution:               |  Has a Patch:  1
Blocked By:               |     Blocking:
  Platform:  All          |
--------------------------+------------------------------------------------

Comment (by bonefish):

 Replying to [comment:11 dancxjo]:
 > Really awesome suggestion on the layout builder! I'm not sure if it was
 correct of me to indent the .SetEnabled's in the layout builder, though.
 Your thoughts?

 Strictly according to the coding guidelines the indentation would be
 incorrect. However, for layout building code an indentation outlining the
 structure of the layout significantly increases the readability and is
 therefore preferred. Indenting the `.SetEnabled()` calls is fine, as they
 affect the previous item, not the menu.

 Regarding the style guide:
  - Two blank lines should be used between the `#include` and the `using`
 blocks, between the `using` and the `B_TRANSLATE_CONTEXT` blocks, and
 between the latter and the `namespace ...`.
  - The `{` for a function/method definition goes to a separate line.
  - Uncommon abbreviations for identifier names should be avoided, i.e.
 e.g. `undoStr` should be renamed to `undoString`/`undoName`/`undoLabel`.
  - `BPopUpMenu *menu;`

 Moreover:
  - For aesthetical reasons I would move the creation of the `BPopUpMenu`
 object to the definition of the variable.
  - I would cache the `IsEditable()` result in a variable to avoid multiple
 calls.
  - `B_UNDO` is erroneously used for the redo menu item.

 > I want to ask PulkoMandy if there is a cleaner way to handle all those
 translated strings. It would be nice to be able to just use an inline
 B_TRANSLATE.

 The problem is that this is libbe and liblocale depends on libbe. Directly
 using liblocale functionality in libbe would make dependencies cyclic.
 Hence the unusual way to get the translated string. Things could be
 simplified by introducing a macro specially for libbe code (e.g.
 `B_TRANSLATE_LIBBE`), which would do exactly what has now to be programmed
 by hand. I believe it needs to be supported explicitly by
 `collectcatkeys`, though. Another option would be to merge liblocale into
 libbe. To avoid loading the largish ICU libraries when not needed, that
 would require a dynamically loaded ICU bridge, though.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7002#comment:12>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: