OpenXcom Forum

OpenXcom => Suggestions => Topic started by: Falko on July 02, 2014, 07:09:21 pm

Title: Disable Base-Buttons if not needed
Post by: Falko on July 02, 2014, 07:09:21 pm
see image
it would be nice to disable unusable buttons in base
it already works for the "new base" button -> (it gets black)
no soldiers -> disable soldiers
no crafts -> disable craft equip
no scientist -> disable research
no engineer  -> disable manufacture

also possible but a little more complex:
no item/crafts/aliens/staff -> disable sell/transfer
no space left in base -> disable build new facilities
no storage/hangar/quarters/alien containment -> disable purchase

i sometime click on the wrong base to research stuff so i can likely avoid it
Title: Re: Disable Base-Buttons if not needed
Post by: Unknown Hero on July 02, 2014, 07:36:41 pm
Make sense, I support this proposal, there is no need to go to a screen if nothing can be done, apart to close the screen.  ;)

But why not in red?  ::)  8)
Title: Re: Disable Base-Buttons if not needed
Post by: Falko on July 02, 2014, 07:47:20 pm
red = important = do something! <- thats not the case here

grey = disabled :)

+grey is easy to do if one shifts the button color by a specific range the same color range is not available in red in the base palette iirc
Title: Re: Disable Base-Buttons if not needed
Post by: Unknown Hero on July 02, 2014, 07:58:41 pm
It was just a joke.  :D
Title: Re: Disable Base-Buttons if not needed
Post by: Solarius Scorch on July 11, 2014, 05:48:57 pm
I wholly support this idea!
Well, the grey version. :D
Title: Re: Disable Base-Buttons if not needed
Post by: Falko on July 11, 2014, 05:59:39 pm
i have made the source changes already as test
additionally i made "new base" grey instead of black and removed the "clickable" function there but the rest of the grey button can still open their window

but no idea how to get this into the repository :(
Title: Re: Disable Base-Buttons if not needed
Post by: niculinux on July 11, 2014, 10:26:13 pm
I wholly support this idea!
Well, the grey version. :D

Mee too. A confortable one
Title: Re: Disable Base-Buttons if not needed
Post by: Aldorn on July 12, 2014, 03:00:10 pm
+1

For the grey version !
Title: Re: Disable Base-Buttons if not needed
Post by: El Yahpo on July 14, 2014, 08:28:31 am
Is there room for another button? (for the alien containment)

With this feature you could have a greyed out "Prisoners" button.
Title: Re: Disable Base-Buttons if not needed
Post by: Falko on July 14, 2014, 11:19:33 am
the room is well used
i looked for a good space for a aliens-button in subwindows but could not find a good place
Title: Re: Disable Base-Buttons if not needed
Post by: redv on July 14, 2014, 01:54:58 pm
Working code:

https://github.com/SupSuper/OpenXcom/pull/607

You can use it as you want, but IMHO this is not a good idea as it seems. Especially in basescape.
I tested it and I closed this pull request.
Title: Re: Disable Base-Buttons if not needed
Post by: Falko on July 14, 2014, 02:48:48 pm
can you put this in basscapestate.cpp around line ~221?
Code: [Select]
if (_base->getScientists()>0)
{
_btnResearch->setColor(Palette::blockOffset(13)+5);
}else{
_btnResearch->setColor(Palette::blockOffset(13)+0);
}
if (_base->getEngineers()>0)
{
_btnManufacture->setColor(Palette::blockOffset(13)+5);
}else{
_btnManufacture->setColor(Palette::blockOffset(13)+0);
}
if (_base->getSoldiers()->size()>0)
{
_btnSoldiers->setColor(Palette::blockOffset(13)+5);
}else{
_btnSoldiers->setColor(Palette::blockOffset(13)+0);
}
if (_base->getCrafts()->size()>0)
{
_btnCrafts->setColor(Palette::blockOffset(13)+5);
}else{
_btnCrafts->setColor(Palette::blockOffset(13)+0);
}
if (_base->countAvailableSpace()>0)
{
_btnFacilities->setColor(Palette::blockOffset(13)+5);
}else{
_btnFacilities->setColor(Palette::blockOffset(13)+0);
}
if (_game->getSavedGame()->getBases()->size() < MiniBaseView::MAX_BASES){
_btnNewBase->setColor(Palette::blockOffset(13)+5);
_btnNewBase->onMouseClick((ActionHandler)&BasescapeState::btnNewBaseClick);
}else{
_btnNewBase->setColor(Palette::blockOffset(13)+0);
_btnNewBase->onMouseClick(0);
}
https://_btnNewBase->setVisible(_game->getSavedGame()->getBases()->size() < MiniBaseView::MAX_BASES);
why did you change the textbutton?
Title: Re: Disable Base-Buttons if not needed
Post by: redv on July 14, 2014, 03:04:53 pm
can you put this in basscapestate.cpp around line ~221?

First version of PR did it:
https://github.com/redv/OpenXcom/commit/96ccf669b0883bfd1797952ac4bfc827f56533ec
Just need change two strings in BasescapeState.cpp

why did you change the textbutton?

Because class TextButton has new field
Code: [Select]
_inactiveColor and new method
Code: [Select]
void setActive(bool active);https://github.com/SupSuper/OpenXcom/pull/607/files#diff-0a913ca0ca15ef780316dacfeac21158R74

Believe me, grey "New Base" is very annoying.
Title: Re: Disable Base-Buttons if not needed
Post by: Falko on July 14, 2014, 03:27:46 pm
i found the non-clickable grey new base button not annoying in any way but besides that
could yo add the rest of my code that accomplishe the stuff i suggested in the start thread (grey for buttons that are not needed)
i just changed the color paltte from Palette::blockOffset(13)+5 to  to Palette::blockOffset(13)+0 without a need to change the text button
do you have a enable-option in you PR?
Title: Re: Disable Base-Buttons if not needed
Post by: redv on July 14, 2014, 03:41:22 pm
do you have a enable-option in you PR?

Yes, you can use:
    btn->setActive(true);    https:// for activate a button
    btn->setActive(false);   https:// for deactivate.
Title: Re: Disable Base-Buttons if not needed
Post by: Falko on July 14, 2014, 03:50:42 pm
i meant a user option to let the "keep the UI vanilla" guys happy
Title: Re: Disable Base-Buttons if not needed
Post by: redv on July 14, 2014, 04:11:09 pm
No. Because PR affected only on not-vanilla elements of UI.
Title: Re: Disable Base-Buttons if not needed
Post by: redv on July 14, 2014, 04:33:04 pm
could yo add the rest of my code that accomplishe the stuff i suggested in the start thread (grey for buttons that are not needed)

No. Because I lost interest in this option.