Skip to content

Commit

Permalink
CLEANUP: major changes to ims_gui.cpp; changed some confusing names t…
Browse files Browse the repository at this point in the history
…o more intuitive;
  • Loading branch information
Raais committed May 7, 2022
1 parent 8b5600b commit 6bf1ed0
Show file tree
Hide file tree
Showing 7 changed files with 463 additions and 513 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
1
2
3
4
36 changes: 13 additions & 23 deletions src/sources/ims_buffer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "ims_buffer.h"

void ImStudio::BufferWindow::drawall(int *select)
void ImStudio::BufferWindow::drawall()
{
if (state)
{
Expand Down Expand Up @@ -31,17 +31,11 @@ void ImStudio::BufferWindow::drawall(int *select)
{
if (o.type != "child")
{
o.draw(select, staticlayout);
o.draw(&selected_obj_id, staticlayout);
}
else
{
if (!o.child.init)
{
current_child = &o;
o.child.init = true;
}

o.child.drawall(select, staticlayout);
o.child.drawall(&selected_obj_id, staticlayout);
}
}
}
Expand Down Expand Up @@ -87,24 +81,20 @@ ImStudio::BaseObject *ImStudio::BufferWindow::getbaseobj(int id)

void ImStudio::BufferWindow::create(std::string type_)
{
idvar++;
if (!current_child)
idgen++;
if (!((open_child) &&
(getbaseobj(open_child_id)) &&
(getobj(open_child_id)->child.open)))
{
Object widget(idvar, type_);
// no child window open
Object widget(idgen, type_);
objects.push_back(widget);
}
else
{
if (!current_child->child.open)
{
Object widget(idvar, type_);
objects.push_back(widget);
}
else
{
BaseObject childwidget(idvar, type_, current_child->id);
childwidget.parent = current_child;
current_child->child.objects.push_back(childwidget);
}
// child window open
BaseObject childwidget(idgen, type_, open_child_id);
getobj(open_child_id)->child.objects.push_back(childwidget);
}
selected_obj_id = idgen; // select the new object
}
8 changes: 5 additions & 3 deletions src/sources/ims_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ namespace ImStudio
bool state = false; //
ImVec2 size = {}; //
ImVec2 pos = {}; //
int idvar = 0; //
Object* current_child = nullptr; //
int idgen = 0; //
bool open_child = false; //
int open_child_id = -1; //
int selected_obj_id = -1; //

bool staticlayout = false; //

std::vector<Object> objects = {}; //

void drawall (int *select);
void drawall ();
Object * getobj (int id);
BaseObject * getbaseobj (int id);
void create (std::string type_);
Expand Down
Loading

0 comments on commit 6bf1ed0

Please sign in to comment.