Will clean up the code along your comments, thx.

Diff comments:

> 
> === modified file 'src/graphic/align.h'
> --- src/graphic/align.h       2017-01-25 18:55:59 +0000
> +++ src/graphic/align.h       2017-02-12 13:44:05 +0000
> @@ -24,29 +24,41 @@
>  
>  namespace UI {
>  
> +/**
> + * This Enum is a binary mix of one-dimensional and two-dimensional 
> alignments.
> + *
> + * bits 0,1 values 0,1,2,3  are horizontal
> + * bits 2,3 values 0,4,8,12 are vertical
> + *
> + * mixed aligenments are results of a binary | operation.
> + *
> + */
> +
> + // TODO(klaus.halfmann): as this is not a real enum all compiler warnings 
> about
> + // incomplete usage are useless.
> +
>  enum class Align {
> -     kLeft = 0,
> -     kHCenter = 1,
> -     kRight = 2,
> -     kHorizontal = 3,
> -
> -     kTop = 0,
> -     kVCenter = 4,
> -     kBottom = 8,
> -     kVertical = 12,
> -
> -     kTopLeft = 0,
> -     kCenterLeft = Align::kVCenter,
> -     kBottomLeft = Align::kBottom,
> -
> -     kTopCenter = Align::kHCenter,
> -     kCenter = Align::kHCenter | Align::kVCenter,
> -     kBottomCenter = Align::kHCenter | Align::kBottom,
> -
> -     kTopRight = Align::kRight,
> -     kCenterRight = Align::kRight | Align::kVCenter,
> -
> -     kBottomRight = Align::kRight | Align::kBottom,
> +     kLeft       = 0x00,

This was "just" some warm up to understand the compiler warnings about alignent.
I intent to refactor this (if possible) into HAlign, VAlign and HVAlign, to 
finally fix the warnings.

> +     kHCenter    = 0x01,
> +     kRight      = 0x02,
> +     kHorizontal = 0x03,
> +
> +     kTop        = 0x00,
> +     kVCenter    = 0x04,
> +     kBottom     = 0x08,
> +     kVertical   = 0x0C,
> +
> +     kTopLeft        = kLeft | kTop,
> +     kCenterLeft     = kLeft | kVCenter,
> +     kBottomLeft     = kLeft | kBottom,
> +
> +    kTopCenter      = kHCenter | kTop,
> +     kCenter         = kHCenter | kVCenter,
> +     kBottomCenter   = kHCenter | kBottom,
> +
> +     kTopRight       = kRight | kTop,
> +     kCenterRight    = kRight | kVCenter,
> +     kBottomRight    = kRight | kBottom,
>  };
>  
>  inline Align operator&(Align a, Align b) {
> 
> === modified file 'src/notifications/notifications_impl.h'
> --- src/notifications/notifications_impl.h    2017-01-25 18:55:59 +0000
> +++ src/notifications/notifications_impl.h    2017-02-12 13:44:05 +0000
> @@ -70,7 +70,8 @@
>  
>       // Publishes 'message' to all subscribers.
>       template <typename T> void publish(const T& message) {
> -             for (void* p_subscriber : 
> note_id_to_subscribers_[T::note_id()]) {
> +        std::list<void*> subscribers = note_id_to_subscribers_[T::note_id()];
> +             for (void* p_subscriber : subscribers) {

I needed this, so I could inspect that list in the debugger. I will revert this.

>                       Subscriber<T>* subscriber = 
> static_cast<Subscriber<T>*>(p_subscriber);
>                       subscriber->callback_(message);
>               }
> 
> === modified file 'src/ui_basic/box.cc'
> --- src/ui_basic/box.cc       2017-01-25 18:55:59 +0000
> +++ src/ui_basic/box.cc       2017-02-12 13:44:05 +0000
> @@ -376,16 +377,15 @@
>                       maxbreadth = get_inner_w();
>               }
>               switch (it.u.panel.align) {
> -             case UI::Align::kHCenter:
> -                     breadth = (maxbreadth - breadth) / 2;
> -                     break;
> +            case UI::Align::kHCenter:
> +                breadth = (maxbreadth - breadth) >> 1;

It's totally unrelatet and I will revert this.

> +                break;
>  
> -             case UI::Align::kRight:
> -                     breadth = maxbreadth - breadth;
> -                     break;
> -             case UI::Align::kLeft:
> -             default:
> -                     breadth = 0;
> +            case UI::Align::kRight:
> +                breadth = maxbreadth - breadth;
> +                break;
> +            default: // UI::Align::left
> +                breadth = 0;
>               }
>  
>               if (orientation_ == Horizontal)


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1658489-epedition-tab/+merge/317047
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1658489-epedition-tab.

_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to     : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to