Skip to content

Commit

Permalink
chore: finished container consolidation (#1801)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt authored Jun 13, 2022
1 parent 21beac0 commit 6c064ba
Show file tree
Hide file tree
Showing 28 changed files with 1,587 additions and 1,740 deletions.
6 changes: 0 additions & 6 deletions DearPyGui/cmake/dpg_sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ set(MARVEL_SOURCES
"src/ui/AppItems/mvAppItemState.cpp"
"src/ui/AppItems/mvAppItem.cpp"
"src/ui/AppItems/mvItemRegistry.cpp"
"src/ui/AppItems/containers/mvCollapsingHeader.cpp"
"src/ui/AppItems/containers/mvGroup.cpp"
"src/ui/AppItems/containers/mvTabBar.cpp"
"src/ui/AppItems/containers/mvTreeNode.cpp"
"src/ui/AppItems/containers/mvWindowAppItem.cpp"
"src/ui/AppItems/containers/mvDragPayload.cpp"
"src/ui/AppItems/custom/mvDatePicker.cpp"
"src/ui/AppItems/custom/mvTimePicker.cpp"
"src/ui/AppItems/custom/mvSlider3D.cpp"
Expand Down
91 changes: 68 additions & 23 deletions DearPyGui/src/modules/dearpygui_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ set_x_scroll(PyObject* self, PyObject* args, PyObject* kwargs)

auto pWindow = static_cast<mvWindowAppItem*>(window);

pWindow->_scrollX = value;
pWindow->_scrollXSet = true;
pWindow->configData.scrollX = value;
pWindow->configData._scrollXSet = true;
}
else if (window->type == mvAppItemType::mvChildWindow)
{
auto pChild = static_cast<mvChildWindow*>(window);
pChild->configData.scrollX = value;
pChild->configData.scrollXSet = true;
pChild->configData._scrollXSet = true;
}
else
{
Expand Down Expand Up @@ -273,14 +273,14 @@ set_y_scroll(PyObject* self, PyObject* args, PyObject* kwargs)

auto pWindow = static_cast<mvWindowAppItem*>(window);

pWindow->_scrollY = value;
pWindow->_scrollYSet = true;
pWindow->configData.scrollY = value;
pWindow->configData._scrollYSet = true;
}
else if (window->type == mvAppItemType::mvChildWindow)
{
auto pChild = static_cast<mvChildWindow*>(window);
pChild->configData.scrollY = value;
pChild->configData.scrollYSet = true;
pChild->configData._scrollYSet = true;
}
else
{
Expand Down Expand Up @@ -318,7 +318,7 @@ get_x_scroll(PyObject* self, PyObject* args, PyObject* kwargs)

auto pWindow = static_cast<mvWindowAppItem*>(window);

return ToPyFloat(pWindow->_scrollX);
return ToPyFloat(pWindow->configData.scrollX);
}
else if (window->type == mvAppItemType::mvChildWindow)
{
Expand Down Expand Up @@ -362,7 +362,7 @@ get_y_scroll(PyObject* self, PyObject* args, PyObject* kwargs)

auto pWindow = static_cast<mvWindowAppItem*>(window);

return ToPyFloat(pWindow->_scrollY);
return ToPyFloat(pWindow->configData.scrollY);
}
else if (window->type == mvAppItemType::mvChildWindow)
{
Expand Down Expand Up @@ -406,7 +406,7 @@ get_x_scroll_max(PyObject* self, PyObject* args, PyObject* kwargs)

auto pWindow = static_cast<mvWindowAppItem*>(window);

return ToPyFloat(pWindow->_scrollMaxX);
return ToPyFloat(pWindow->configData.scrollMaxX);
}
else if (window->type == mvAppItemType::mvChildWindow)
{
Expand Down Expand Up @@ -450,7 +450,7 @@ get_y_scroll_max(PyObject* self, PyObject* args, PyObject* kwargs)

auto pWindow = static_cast<mvWindowAppItem*>(window);

return ToPyFloat(pWindow->_scrollMaxY);
return ToPyFloat(pWindow->configData.scrollMaxY);
}
else if (window->type == mvAppItemType::mvChildWindow)
{
Expand Down Expand Up @@ -2882,27 +2882,72 @@ set_primary_window(PyObject* self, PyObject* args, PyObject* kwargs)

mvUUID item = GetIDFromPyObject(itemraw);

mvWindowAppItem* window = GetWindow(*GContext->itemRegistry, item);

if (window)
{
if (window->getWindowAsMainStatus() == (bool)value)
return GetPyNone();
mvWindowAppItem* window = GetWindow(*GContext->itemRegistry, item);

if (window)
{
if (window->configData.mainWindow == (bool)value)
return GetPyNone();
else
{
window->configData.mainWindow = value;
if (value)
{
window->configData._oldWindowflags = window->configData.windowflags;
window->configData.windowflags = ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoSavedSettings
| ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar;

if (window->configData._oldWindowflags & ImGuiWindowFlags_MenuBar)
window->configData.windowflags |= ImGuiWindowFlags_MenuBar;
window->configData._oldxpos = window->state.pos.x;
window->configData._oldypos = window->state.pos.y;
window->configData._oldWidth = window->config.width;
window->configData._oldHeight = window->config.height;
}
else
{
window->info.focusNextFrame = true;
if (window->configData.windowflags & ImGuiWindowFlags_MenuBar)
window->configData._oldWindowflags |= ImGuiWindowFlags_MenuBar;
window->configData.windowflags = window->configData._oldWindowflags;
if (window->configData.windowflags & ImGuiWindowFlags_MenuBar)
window->configData.windowflags |= ImGuiWindowFlags_MenuBar;
window->state.pos = { window->configData._oldxpos , window->configData._oldypos };
window->config.width = window->configData._oldWidth;
window->config.height = window->configData._oldHeight;
window->info.dirtyPos = true;
window->info.dirty_size = true;
}
}
}
else
window->setWindowAsMainStatus(value);
}
else
{
mvThrowPythonError(mvErrorCode::mvItemNotFound, "set_primary_window",
"Item not found: " + std::to_string(item), nullptr);
assert(false);
{
mvThrowPythonError(mvErrorCode::mvItemNotFound, "set_primary_window",
"Item not found: " + std::to_string(item), nullptr);
assert(false);
}
}

// reset other windows
for (auto& window : GContext->itemRegistry->windowRoots)
{
if (window->uuid != item)
static_cast<mvWindowAppItem*>(window.get())->setWindowAsMainStatus(false);
{
mvWindowAppItem* windowActual = static_cast<mvWindowAppItem*>(window.get());
windowActual->configData.mainWindow = false;
window->info.focusNextFrame = true;
if (windowActual->configData.windowflags & ImGuiWindowFlags_MenuBar)
windowActual->configData._oldWindowflags |= ImGuiWindowFlags_MenuBar;
windowActual->configData.windowflags = windowActual->configData._oldWindowflags;
if (windowActual->configData.windowflags & ImGuiWindowFlags_MenuBar)
windowActual->configData.windowflags |= ImGuiWindowFlags_MenuBar;
window->state.pos = { windowActual->configData._oldxpos , windowActual->configData._oldypos };
window->config.width = windowActual->configData._oldWidth;
window->config.height = windowActual->configData._oldHeight;
window->info.dirtyPos = true;
window->info.dirty_size = true;
}
}

return GetPyNone();
Expand Down
6 changes: 6 additions & 0 deletions DearPyGui/src/mvDearPyGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ struct mvColorMapButtonConfig;
struct mvColorMapScaleConfig;
struct mvColorMapSliderConfig;
struct mvChildWindowConfig;
struct mvTreeNodeConfig;
struct mvGroupConfig;
struct mvDragPayloadConfig;
struct mvCollapsingHeaderConfig;
struct mvTabBarConfig;
struct mvWindowAppItemConfig;

// plots
struct mvPlotConfig;
Expand Down
192 changes: 0 additions & 192 deletions DearPyGui/src/ui/AppItems/containers/mvCollapsingHeader.cpp

This file was deleted.

Loading

0 comments on commit 6c064ba

Please sign in to comment.