How about removing the slider and replacing it with some buttons next to the 
lists? I hate fiddling with my mouse to position it over that tiny thing.

Diff comments:

> 
> === modified file 'src/wui/attack_box.h'
> --- src/wui/attack_box.h      2019-02-23 11:00:49 +0000
> +++ src/wui/attack_box.h      2019-05-07 12:26:33 +0000
> @@ -88,6 +91,76 @@
>       std::unique_ptr<UI::Button> less_soldiers_;
>       std::unique_ptr<UI::Button> more_soldiers_;
>  
> +     // A SoldierPanel is not applicable here as it's keyed to a building 
> and thinks too much

OK, we won't want that then.

> +     struct ListOfSoldiers : public UI::Panel {
> +             ListOfSoldiers(UI::Panel* const parent,
> +                            AttackBox* parent_box,
> +                            int32_t const x,
> +                            int32_t const y,
> +                            int const w,
> +                            int const h,
> +                        const std::string& tooltip,
> +                            int16_t max_size = 8,
> +                            bool restrict_rows = false);
> +
> +             bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) 
> override;
> +
> +             const Widelands::Soldier* soldier_at(int32_t x, int32_t y) 
> const;
> +             void add(const Widelands::Soldier*);
> +             void remove(const Widelands::Soldier*);
> +             bool contains(const Widelands::Soldier* soldier) const {
> +                     for (const auto& s : soldiers_) {
> +                             if (s == soldier) {
> +                                     return true;
> +                             }
> +                     }
> +                     return false;
> +             }
> +
> +             std::vector<const Widelands::Soldier*> get_soldiers() const {
> +                     return soldiers_;
> +             }
> +             const Widelands::Soldier* get_soldier() const {
> +                     return soldiers_.back();
> +             }
> +
> +             size_t count_soldiers() const {
> +                     return soldiers_.size();
> +             }
> +             Widelands::Extent size() const;
> +             bool row_number_restricted() const {
> +                     return restricted_row_number_;
> +             }
> +             int16_t size_restriction() const {
> +                     return size_restriction_;
> +             }
> +             void set_size_restriction(int16_t r) {
> +                     size_restriction_ = r;
> +             }
> +             void set_row_number_restricted(bool r) {
> +                     restricted_row_number_ = r;
> +             }
> +
> +             void draw(RenderTarget& dst) override;
> +
> +             void set_complement(ListOfSoldiers* o) {
> +                     other_ = o;
> +             }
> +
> +     private:
> +             int16_t size_restriction_; // Highest number of rows or columns
> +             bool restricted_row_number_;
> +             std::vector<const Widelands::Soldier*> soldiers_;
> +
> +             ListOfSoldiers* other_;
> +             AttackBox* attack_box_;
> +
> +             void update_desired_size() override;
> +     };
> +
> +     std::unique_ptr<ListOfSoldiers> attacking_soldiers_;
> +     std::unique_ptr<ListOfSoldiers> remaining_soldiers_;
> +
>       /// The last time the information in this Panel got updated
>       uint32_t lastupdate_;
>  };


-- 
https://code.launchpad.net/~widelands-dev/widelands/choose-attack-soldiers/+merge/367041
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/choose-attack-soldiers into lp:widelands.

_______________________________________________
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