format documents

This commit is contained in:
2026-09-05 17:04:28 +02:00
parent 85f50df154
commit 8c1063640c
13 changed files with 68 additions and 74 deletions
+1 -1
View File
@@ -23,9 +23,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include <functional>
#include <pd/ui7/container/container.hpp> #include <pd/ui7/container/container.hpp>
#include <pd/ui7/io.hpp> #include <pd/ui7/io.hpp>
#include <functional>
namespace PD { namespace PD {
namespace UI7 { namespace UI7 {
+1 -2
View File
@@ -56,8 +56,7 @@ class PD_API Context {
void AddViewPort(const ID& id, const ivec4& vp); void AddViewPort(const ID& id, const ivec4& vp);
void UseViewPort(const ID& id); void UseViewPort(const ID& id);
void Update(); void Update();
Menu* BeginMenu(const ID& id, UI7MenuFlags flags = 0, Menu* BeginMenu(const ID& id, UI7MenuFlags flags = 0, bool* pShow = nullptr);
bool* pShow = nullptr);
Menu* CurrentMenu() { return pCurrent; } Menu* CurrentMenu() { return pCurrent; }
void EndMenu(); void EndMenu();
void AboutMenu(bool* show = nullptr); void AboutMenu(bool* show = nullptr);
+4 -6
View File
@@ -33,8 +33,7 @@ PD_API void ColorEdit::HandleInput() {
} }
// Assert(screen.get(), "Screen is not set up!"); // Assert(screen.get(), "Screen is not set up!");
// if (screen->ScreenType() == Screen::Bottom) { // if (screen->ScreenType() == Screen::Bottom) {
if (io->InputHandler.DragObject(this->GetID() + 2, if (io->InputHandler.DragObject(this->GetID() + 2, fvec4(FinalPos(), size))) {
fvec4(FinalPos(), size))) {
if (io->InputHandler.DragReleasedAW) { if (io->InputHandler.DragReleasedAW) {
is_shown = !is_shown; is_shown = !is_shown;
} }
@@ -55,8 +54,7 @@ PD_API void ColorEdit::Draw() {
} }
layout->SetPosition(FinalPos()); layout->SetPosition(FinalPos());
layout->AddObjectEx( layout->AddObjectEx(
new DynObj( new DynObj([=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) {
[=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) {
thiz->SetSize(layout->GetSize()); thiz->SetSize(layout->GetSize());
// l->Layer(30); // l->Layer(30);
l->PathRect(thiz->GetPos(), thiz->GetPos() + thiz->GetSize(), l->PathRect(thiz->GetPos(), thiz->GetPos() + thiz->GetSize(),
@@ -64,8 +62,8 @@ PD_API void ColorEdit::Draw() {
l->PathFill(io->Theme.Get(UI7Color_FrameBackground)); l->PathFill(io->Theme.Get(UI7Color_FrameBackground));
}), }),
UI7LytAdd_Front | UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle); UI7LytAdd_Front | UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle);
auto obj = new DynObj( auto obj =
[=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) { new DynObj([=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) {
l->PathRect(thiz->FinalPos(), thiz->FinalPos() + io->ItemRowHeight, l->PathRect(thiz->FinalPos(), thiz->FinalPos() + io->ItemRowHeight,
io->FrameRounding); io->FrameRounding);
l->PathFill(*color_ref); l->PathFill(*color_ref);
+2 -2
View File
@@ -31,8 +31,8 @@ PD_API void Container::HandleScrolling(fvec2 scrolling, fvec4 viewport) {
} }
last_use = PD::Os::GetTime(); last_use = PD::Os::GetTime();
pos -= fvec2(0, scrolling.y); pos -= fvec2(0, scrolling.y);
skippable = !Li::Math::InBounds( skippable =
pos, size, !Li::Math::InBounds(pos, size,
fvec4(viewport.x, viewport.y, viewport.x + viewport.z, fvec4(viewport.x, viewport.y, viewport.x + viewport.z,
viewport.y + viewport.w)); viewport.y + viewport.w));
} }
+3 -3
View File
@@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include <algorithm>
#include <pd/ui7/container/dragdata.hpp> #include <pd/ui7/container/dragdata.hpp>
#include <pd/ui7/container/label.hpp> #include <pd/ui7/container/label.hpp>
#include <type_traits> #include <type_traits>
#include <algorithm>
namespace PD { namespace PD {
namespace UI7 { namespace UI7 {
@@ -93,8 +93,8 @@ PD_API void DragData<T>::Draw() {
// list->LayerDown(); // list->LayerDown();
off_x += td.x + io->ItemSpace.x + io->FramePadding.x; off_x += td.x + io->ItemSpace.x + io->FramePadding.x;
} }
list->DrawText(FinalPos() + fvec2(off_x, io->FramePadding.y * 0.5), label.c_str(), list->DrawText(FinalPos() + fvec2(off_x, io->FramePadding.y * 0.5),
io->Theme.Get(UI7Color_Text)); label.c_str(), io->Theme.Get(UI7Color_Text));
} }
template <typename T> template <typename T>
+3 -3
View File
@@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include <algorithm>
#include <pd/ui7/container/label.hpp> #include <pd/ui7/container/label.hpp>
#include <pd/ui7/container/slider.hpp> #include <pd/ui7/container/slider.hpp>
#include <type_traits> #include <type_traits>
#include <algorithm>
namespace PD { namespace PD {
namespace UI7 { namespace UI7 {
@@ -57,8 +57,8 @@ PD_API void Slider<T>::HandleInput() {
fvec4(FinalPos() + fvec2(2, 0), fvec2(width, GetSize().y)))) { fvec4(FinalPos() + fvec2(2, 0), fvec2(width, GetSize().y)))) {
if (!io->InputHandler.DragReleasedAW) { if (!io->InputHandler.DragReleasedAW) {
*data = std::clamp( *data = std::clamp(
T(max * (std::clamp(io->InputHandler.DragLastPosition.x - xps, 0.f, T(max *
width) / (std::clamp(io->InputHandler.DragLastPosition.x - xps, 0.f, width) /
width)), width)),
this->min, this->max); this->min, this->max);
} }
+1 -1
View File
@@ -22,8 +22,8 @@ SOFTWARE.
*/ */
#include <pd/core/core.hpp> #include <pd/core/core.hpp>
#include <pd/ui7/io.hpp>
#include <pd/drivers/drivers.hpp> #include <pd/drivers/drivers.hpp>
#include <pd/ui7/io.hpp>
namespace PD { namespace PD {
PD_API void UI7::IO::Update() { PD_API void UI7::IO::Update() {
+6 -7
View File
@@ -21,9 +21,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include <algorithm>
#include <pd/ui7/containers.hpp> #include <pd/ui7/containers.hpp>
#include <pd/ui7/menu.hpp> #include <pd/ui7/menu.hpp>
#include <algorithm>
namespace PD { namespace PD {
namespace UI7 { namespace UI7 {
@@ -84,8 +84,8 @@ PD_API void Menu::ColorEdit(const std::string& label, u32& clr) {
PD_API void Menu::Separator() { PD_API void Menu::Separator() {
// Dynamic Objects are very simple... // Dynamic Objects are very simple...
Container* r = new DynObj( Container* r =
[=, this](UI7::IO* io, Li::Drawlist* l, UI7::Container* self) { new DynObj([=, this](UI7::IO* io, Li::Drawlist* l, UI7::Container* self) {
l->DrawRectFilled(self->FinalPos(), self->GetSize(), l->DrawRectFilled(self->FinalPos(), self->GetSize(),
pIO.Theme.Get(UI7Color_TextDead)); pIO.Theme.Get(UI7Color_TextDead));
}); });
@@ -394,13 +394,12 @@ PD_API bool Menu::BeginTreeNode(const ID& id) {
l->DrawTriangleFilled(ts, ts + pl[0], ts + pl[1], l->DrawTriangleFilled(ts, ts + pl[0], ts + pl[1],
io->Theme.Get(UI7Color_FrameBackground)); io->Theme.Get(UI7Color_FrameBackground));
l->DrawText(self->FinalPos() + fvec2(10 + io->ItemSpace.x, 0), id.GetName().c_str(), l->DrawText(self->FinalPos() + fvec2(10 + io->ItemSpace.x, 0),
io->Theme.Get(UI7Color_Text)); id.GetName().c_str(), io->Theme.Get(UI7Color_Text));
}); });
/** Yes this new function handler was created for tree nodes */ /** Yes this new function handler was created for tree nodes */
r->AddInputHandler([=, this](IO* io, Container* self) { r->AddInputHandler([=, this](IO* io, Container* self) {
if (io->InputHandler.DragObject( if (io->InputHandler.DragObject(ID(pID.GetName() + id.GetName()),
ID(pID.GetName() + id.GetName()),
fvec4(self->FinalPos(), self->GetSize()))) { fvec4(self->FinalPos(), self->GetSize()))) {
if (io->InputHandler.DragReleased) { if (io->InputHandler.DragReleased) {
n->second = !n->second; n->second = !n->second;
+2 -4
View File
@@ -51,8 +51,7 @@ PD_API void Context::UseViewPort(const ID& id) {
pIO.CurrentViewPort = pIO.ViewPorts[id.RawID()]; pIO.CurrentViewPort = pIO.ViewPorts[id.RawID()];
} }
PD_API Menu* Context::BeginMenu(const ID& id, UI7MenuFlags flags, PD_API Menu* Context::BeginMenu(const ID& id, UI7MenuFlags flags, bool* pShow) {
bool* pShow) {
if (pCurrent) { if (pCurrent) {
PDERR("UI7: You are already in {} Menu!", pCurrent->pID.GetName()); PDERR("UI7: You are already in {} Menu!", pCurrent->pID.GetName());
return nullptr; return nullptr;
@@ -256,8 +255,7 @@ PD_API void Context::MetricsMenu(bool* show) {
m->Label(std::format("Cursor: {}", pMenus[it]->pLayout.Cursor)); m->Label(std::format("Cursor: {}", pMenus[it]->pLayout.Cursor));
if (m->BeginTreeNode( if (m->BeginTreeNode(
"ID Objects (" + "ID Objects (" +
std::to_string(pMenus[it]->pLayout.IDObjects.size()) + std::to_string(pMenus[it]->pLayout.IDObjects.size()) + ")")) {
")")) {
for (auto& jt : pMenus[it]->pLayout.IDObjects) { for (auto& jt : pMenus[it]->pLayout.IDObjects) {
m->Label(std::format("{:08X}", jt->GetID())); m->Label(std::format("{:08X}", jt->GetID()));
} }