Comment 4 for bug 763517

Hans Joachim Desserud (hjd) wrote :

Ok, I have made some attempts to establish a common default height and width for buttons, but have so far been unsuccessful. The current situation is that each menu, for instance src/ui_fsmenu/main.cc:
        m_butw (get_w() * 7 / 20),
        m_buth (get_h() * 18 / 300),
These variables are then sent as arguments when the buttons are created. This means that the default height/width is duplicated in each file needing it, and all occurrences need to be updated.

My suggestion is to organize so that it is possible to call the button constructor without specifying height/width and it will be assigned a default value. This would allow us to move it to one place where it can be updated. Also for any buttons we don't want the default size, calling the constructor with height/width parameters will override it. (In essence two constructors, one with height/width and one without, where the latter would redirect to the first with the default values specified) I have tried adding default values to the constructor, but the compiler does not like it when the rest of the parameters have no default values.

However, I suspect the reason it is done the way it is currently is due to the get_w()/get_h() methods which will not be available in the button class. Which means my approach may not even work if done correctly. I would still really like to see this defined in a single place. Does anyone have any ideas?

Oh, and I'm not sure if I have mentioned this already, but while I know programming, I don't really know c++ :/