Thu, 04 Nov 2021 20:10:48 +0200
#228 Dialog autosize bug is fixed
* Better workspace coloring and color handling
--- a/Source/Gorgon/UI/Widget.cpp Thu Nov 04 16:55:16 2021 +0200 +++ b/Source/Gorgon/UI/Widget.cpp Thu Nov 04 20:10:48 2021 +0200 @@ -161,8 +161,8 @@ ); if(llocation != l) { + llocation = l; move(l); - llocation = l; } auto s = UI::Convert( @@ -180,8 +180,8 @@ } if(lsize != s) { + lsize = s; resize(s); - lsize = s; } }
--- a/Source/Gorgon/UI/Widget.h Thu Nov 04 16:55:16 2021 +0200 +++ b/Source/Gorgon/UI/Widget.h Thu Nov 04 20:10:48 2021 +0200 @@ -337,20 +337,23 @@ std::string tooltip; - /// last set location, used to determine if move is necessary + /// last set location in pixels, used to determine if move is necessary Geometry::Point llocation = {0, 0}; - /// last set size, used to determine if resize is necessary + /// last set size in pixels, used to determine if resize is necessary Geometry::Size lsize = {-1, -1}; + + /// currently set location, used to determine if move is necessary + UnitPoint location = {0, 0}; + + /// currently set size, used to determine if resize is necessary + UnitSize size = {-1, -1}; private: bool visible = true; bool enabled = true; bool focus = false; bool floating= false; - - UnitPoint location = {0, 0}; - UnitSize size = {-1, -1}; /// Never call this function virtual void hide() = 0;
--- a/Source/Gorgon/UI/Window.cpp Thu Nov 04 16:55:16 2021 +0200 +++ b/Source/Gorgon/UI/Window.cpp Thu Nov 04 20:10:48 2021 +0200 @@ -87,10 +87,7 @@ void Window::updateregistry() { if(autobg) { - if(!bgimg) - bgimg = new Graphics::BlankImage; - bgimg->SetColor(Widgets::Registry::Active().Backcolor(Graphics::Color::Workspace)); - Gorgon::Window::SetBackground(static_cast<Graphics::RectangularAnimation&>(*bgimg)); + Gorgon::Window::SetBackground(Widgets::Registry::Active().Backcolor(Graphics::Color::Workspace)); } } @@ -185,9 +182,9 @@ other.Layer::Remove(*underlayer); other.underlayer = nullptr; - bgimg = other.bgimg; - other.bgimg = nullptr; autobg = other.autobg; + other.autobg = true; + other.Destroy(); @@ -272,9 +269,8 @@ other.Layer::Remove(*underlayer); other.underlayer = nullptr; - bgimg = other.bgimg; - other.bgimg = nullptr; autobg = other.autobg; + other.autobg = true; Gorgon::Window::operator = (std::move(other));
--- a/Source/Gorgon/UI/Window.h Thu Nov 04 16:55:16 2021 +0200 +++ b/Source/Gorgon/UI/Window.h Thu Nov 04 20:10:48 2021 +0200 @@ -292,7 +292,6 @@ private: bool autobg = true; - Graphics::BlankImage *bgimg = nullptr; bool quiting = false; LayerAdapter extenderadapter, windowadapter, baradapter, dialogadapter, underadapter; Graphics::Layer *extenderlayer = nullptr;
--- a/Source/Gorgon/Widgets/Generator.h Thu Nov 04 16:55:16 2021 +0200 +++ b/Source/Gorgon/Widgets/Generator.h Thu Nov 04 20:10:48 2021 +0200 @@ -736,7 +736,7 @@ {Graphics::Color::Active, {Graphics::Color::Ivory, {Graphics::Color::Charcoal, 0.8}}}, {Graphics::Color::Error, {Graphics::Color::DarkRed, {Graphics::Color::White, 0.2}}}, {Graphics::Color::Title, {Graphics::Color::DarkGreen, Graphics::Color::Transparent}}, - {Graphics::Color::Workspace, {Graphics::Color::Charcoal, {Graphics::Color::LightGrey, Graphics::Color::ElectricBlue, 0.3}}}, + {Graphics::Color::Workspace, {Graphics::Color::Charcoal, {Graphics::Color::Grey, Graphics::Color::OceanBlue, 0.1}}}, }; void initfontrelated();
--- a/Source/Gorgon/Widgets/Panel.cpp Thu Nov 04 16:55:16 2021 +0200 +++ b/Source/Gorgon/Widgets/Panel.cpp Thu Nov 04 20:10:48 2021 +0200 @@ -103,8 +103,10 @@ } bool Panel::ResizeInterior(const UI::UnitSize &size) { - if(interiorsized != std::make_pair(true, true)) + if(interiorsized != std::make_pair(true, true)) { lsize = {-1, -1}; + this->size = {-1, -1}; + } interiorsized = {true, true}; ComponentStackWidget::Resize(size); @@ -113,8 +115,10 @@ } bool Panel::SetInteriorWidth(const UI::UnitDimension &size) { - if(interiorsized.first != true) + if(interiorsized.first != true) { lsize = {-1, -1}; + this->size.Width = -1; + } interiorsized = {true, interiorsized.second}; ComponentStackWidget::Resize({size, GetSize().Height}); @@ -123,8 +127,10 @@ } bool Panel::SetInteriorHeight(const UI::UnitDimension &size) { - if(interiorsized.second != true) + if(interiorsized.second != true) { lsize = {-1, -1}; + this->size.Height = -1; + } interiorsized = {interiorsized.first, true}; ComponentStackWidget::Resize({GetSize().Width, size});
--- a/Testing/Source/Manual/GraphicsHelper.h Thu Nov 04 16:55:16 2021 +0200 +++ b/Testing/Source/Manual/GraphicsHelper.h Thu Nov 04 20:10:48 2021 +0200 @@ -61,9 +61,11 @@ } wind.setname("Wind"); - bgimage = BGImage(tilesize, tilesize, colmod, colmod*3); - bgimage.Prepare(); - bgimage.DrawIn(l); + if(tilesize) { + bgimage = BGImage(tilesize, tilesize, colmod, colmod*3); + bgimage.Prepare(); + bgimage.DrawIn(l); + } int sz = 13; #ifdef WIN32
--- a/Testing/Source/Manual/UI_Generate.cpp Thu Nov 04 16:55:16 2021 +0200 +++ b/Testing/Source/Manual/UI_Generate.cpp Thu Nov 04 20:10:48 2021 +0200 @@ -96,7 +96,7 @@ }); int main() { - basic_Application<UI::Window> app("uitest", "UI Generator Test", helptext, 1, 0x80); + basic_Application<UI::Window> app("uitest", "UI Generator Test", helptext, 0, 0x80); ///Blank Panel & elements with Registry & Regulars // Widgets::SimpleGenerator generator;