// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/window/window.cpp
// Function: smooth::GUI::Window::CalculateOffsets()
S::Void S::GUI::Window::CalculateOffsets()
{
	Widget	*lastTopWidget	= NIL;
	Int	 positions	= 0;

	innerOffset = Rect(Point(frameWidth, frameWidth), Size(0, 0));

	for (Int i = 0; i < GetNOfObjects(); i++)
	{
		Widget	*widget = GetNthObject(i);

		positions |= widget->GetOrientation();

		if (widget->GetOrientation() == OR_TOP)
		{
			lastTopWidget = widget;

			widget->SetMetrics(Point(innerOffset.left, innerOffset.top), Size(GetWidth() - innerOffset.left - innerOffset.right, widget->GetHeight()));

			innerOffset.top += widget->GetHeight();

			if (widget->subtype == WO_SEPARATOR) innerOffset.top += 3;
		}
		else if (widget->GetOrientation() == OR_BOTTOM)
		{
			widget->SetMetrics(Point(innerOffset.left, GetHeight() - innerOffset.bottom - widget->GetHeight()), Size(GetWidth() - innerOffset.left - innerOffset.right, widget->GetHeight()));

			innerOffset.bottom += widget->GetHeight();
		}
	}

	if (positions & OR_TOP)	   innerOffset.top    += 3;
	if (positions & OR_BOTTOM) innerOffset.bottom += 5;

	if (lastTopWidget != NIL)  innerOffset.top    += (lastTopWidget->subtype == WO_NOSEPARATOR ? 3 : 0);

	for (Int i = 0; i < GetNOfObjects(); i++)
	{
		Widget	*widget = GetNthObject(i);

		if (widget->GetOrientation() == OR_LEFT)
		{
			widget->SetMetrics(Point(innerOffset.left, innerOffset.top), Size(widget->GetWidth(), GetHeight() - innerOffset.top - innerOffset.bottom));

			innerOffset.left += widget->GetWidth();
		}
		else if (widget->GetOrientation() == OR_RIGHT)
		{
			widget->SetMetrics(Point(GetWidth() - innerOffset.right - widget->GetWidth(), innerOffset.top), Size(widget->GetWidth(), GetHeight() - innerOffset.top - innerOffset.bottom));

			innerOffset.right += widget->GetWidth();
		}
	}

	if (positions & OR_LEFT)  innerOffset.left  += 3;
	if (positions & OR_RIGHT) innerOffset.right += 3;

	for (Int i = 0; i < GetNOfObjects(); i++)
	{
		Widget	*widget = GetNthObject(i);

		if (widget->GetOrientation() == OR_CENTER)
		{
			widget->SetMetrics(Point(innerOffset.left, innerOffset.top), Size(GetWidth() - innerOffset.left - innerOffset.right, GetHeight() - innerOffset.top - innerOffset.bottom));
			widget->SetOrientation(OR_CENTER);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl 0x5e8(%rax), %esi
movl 0x5e8(%rax), %edx
leaq -0x2c(%rbp), %rdi
callq 0x5c2c0
leaq -0x34(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x59260
leaq -0x24(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x34(%rbp), %rdx
callq 0x59ff0
movq -0xb8(%rbp), %rax
movq -0x24(%rbp), %rcx
movq %rcx, 0x5d8(%rax)
movq -0x1c(%rbp), %rcx
movq %rcx, 0x5e0(%rax)
movl $0x0, -0x38(%rbp)
movq -0xb8(%rbp), %rdi
movl -0x38(%rbp), %eax
movl %eax, -0xbc(%rbp)
callq 0x5b470
movl %eax, %ecx
movl -0xbc(%rbp), %eax
cmpl %ecx, %eax
jge 0xd6af3
movq -0xb8(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x5c230
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x4, %eax
jne 0xd6a00
movq -0xb8(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, -0x10(%rbp)
movq -0x40(%rbp), %rcx
movq %rcx, -0xc8(%rbp)
movl 0x5d8(%rax), %esi
movl 0x5dc(%rax), %edx
leaq -0x48(%rbp), %rdi
callq 0x5c2c0
movq -0xb8(%rbp), %rdi
callq 0x5a210
movq -0xb8(%rbp), %rcx
subl 0x5d8(%rcx), %eax
subl 0x5e0(%rcx), %eax
movl %eax, -0xcc(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5b860
movl -0xcc(%rbp), %esi
movl %eax, %edx
leaq -0x50(%rbp), %rdi
callq 0x59260
movq -0xc8(%rbp), %rdi
movq (%rdi), %rax
leaq -0x48(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq *0x150(%rax)
movq -0x40(%rbp), %rdi
callq 0x5b860
movl %eax, %ecx
movq -0xb8(%rbp), %rax
addl 0x5dc(%rax), %ecx
movl %ecx, 0x5dc(%rax)
movq -0x40(%rbp), %rax
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xd69fb
movq -0xb8(%rbp), %rax
movl 0x5dc(%rax), %ecx
addl $0x3, %ecx
movl %ecx, 0x5dc(%rax)
jmp 0xd6ae3
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x8, %eax
jne 0xd6ae1
movq -0xb8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0xd8(%rbp)
movl 0x5d8(%rdi), %eax
movl %eax, -0xe0(%rbp)
callq 0x5b860
movq -0xb8(%rbp), %rcx
subl 0x5e4(%rcx), %eax
movl %eax, -0xe4(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5b860
movl -0xe4(%rbp), %edx
movl -0xe0(%rbp), %esi
subl %eax, %edx
leaq -0x58(%rbp), %rdi
callq 0x5c2c0
movq -0xb8(%rbp), %rdi
callq 0x5a210
movq -0xb8(%rbp), %rcx
subl 0x5d8(%rcx), %eax
subl 0x5e0(%rcx), %eax
movl %eax, -0xdc(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5b860
movl -0xdc(%rbp), %esi
movl %eax, %edx
leaq -0x60(%rbp), %rdi
callq 0x59260
movq -0xd8(%rbp), %rdi
movq (%rdi), %rax
leaq -0x58(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq *0x150(%rax)
movq -0x40(%rbp), %rdi
callq 0x5b860
movl %eax, %ecx
movq -0xb8(%rbp), %rax
addl 0x5e4(%rax), %ecx
movl %ecx, 0x5e4(%rax)
jmp 0xd6ae3
jmp 0xd6ae5
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd68d0
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xd6b14
movq -0xb8(%rbp), %rax
movl 0x5dc(%rax), %ecx
addl $0x3, %ecx
movl %ecx, 0x5dc(%rax)
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xd6b35
movq -0xb8(%rbp), %rax
movl 0x5e4(%rax), %ecx
addl $0x5, %ecx
movl %ecx, 0x5e4(%rax)
cmpq $0x0, -0x10(%rbp)
je 0xd6b67
movq -0xb8(%rbp), %rax
movq -0x10(%rbp), %rcx
movswl 0x1a0(%rcx), %esi
xorl %ecx, %ecx
movl $0x3, %edx
cmpl $0x2, %esi
cmovel %edx, %ecx
addl 0x5dc(%rax), %ecx
movl %ecx, 0x5dc(%rax)
movl $0x0, -0x64(%rbp)
movq -0xb8(%rbp), %rdi
movl -0x64(%rbp), %eax
movl %eax, -0xe8(%rbp)
callq 0x5b470
movl %eax, %ecx
movl -0xe8(%rbp), %eax
cmpl %ecx, %eax
jge 0xd6d59
movq -0xb8(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x5c230
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x10, %eax
jne 0xd6c5d
movq -0xb8(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, -0xf0(%rbp)
movl 0x5d8(%rax), %esi
movl 0x5dc(%rax), %edx
leaq -0x78(%rbp), %rdi
callq 0x5c2c0
movq -0x70(%rbp), %rdi
callq 0x5a210
movq -0xb8(%rbp), %rdi
movl %eax, -0xf4(%rbp)
callq 0x5b860
movl -0xf4(%rbp), %esi
movl %eax, %edx
movq -0xb8(%rbp), %rax
subl 0x5dc(%rax), %edx
subl 0x5e4(%rax), %edx
leaq -0x80(%rbp), %rdi
callq 0x59260
movq -0xf0(%rbp), %rdi
movq (%rdi), %rax
leaq -0x78(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq *0x150(%rax)
movq -0x70(%rbp), %rdi
callq 0x5a210
movl %eax, %ecx
movq -0xb8(%rbp), %rax
addl 0x5d8(%rax), %ecx
movl %ecx, 0x5d8(%rax)
jmp 0xd6d49
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x20, %eax
jne 0xd6d47
movq -0xb8(%rbp), %rdi
movq -0x70(%rbp), %rax
movq %rax, -0x100(%rbp)
callq 0x5a210
movq -0xb8(%rbp), %rcx
subl 0x5e0(%rcx), %eax
movl %eax, -0x108(%rbp)
movq -0x70(%rbp), %rdi
callq 0x5a210
movl -0x108(%rbp), %esi
movl %eax, %ecx
movq -0xb8(%rbp), %rax
subl %ecx, %esi
movl 0x5dc(%rax), %edx
leaq -0x88(%rbp), %rdi
callq 0x5c2c0
movq -0x70(%rbp), %rdi
callq 0x5a210
movq -0xb8(%rbp), %rdi
movl %eax, -0x104(%rbp)
callq 0x5b860
movl -0x104(%rbp), %esi
movl %eax, %edx
movq -0xb8(%rbp), %rax
subl 0x5dc(%rax), %edx
subl 0x5e4(%rax), %edx
leaq -0x90(%rbp), %rdi
callq 0x59260
movq -0x100(%rbp), %rdi
movq (%rdi), %rax
leaq -0x88(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq *0x150(%rax)
movq -0x70(%rbp), %rdi
callq 0x5a210
movl %eax, %ecx
movq -0xb8(%rbp), %rax
addl 0x5e0(%rax), %ecx
movl %ecx, 0x5e0(%rax)
jmp 0xd6d49
jmp 0xd6d4b
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xd6b6e
movl -0x14(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xd6d7a
movq -0xb8(%rbp), %rax
movl 0x5d8(%rax), %ecx
addl $0x3, %ecx
movl %ecx, 0x5d8(%rax)
movl -0x14(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xd6d9b
movq -0xb8(%rbp), %rax
movl 0x5e0(%rax), %ecx
addl $0x3, %ecx
movl %ecx, 0x5e0(%rax)
movl $0x0, -0x94(%rbp)
movq -0xb8(%rbp), %rdi
movl -0x94(%rbp), %eax
movl %eax, -0x10c(%rbp)
callq 0x5b470
movl %eax, %ecx
movl -0x10c(%rbp), %eax
cmpl %ecx, %eax
jge 0xd6ec6
movq -0xb8(%rbp), %rdi
movl -0x94(%rbp), %esi
callq 0x5c230
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x40, %eax
jne 0xd6eb0
movq -0xb8(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq %rcx, -0x118(%rbp)
movl 0x5d8(%rax), %esi
movl 0x5dc(%rax), %edx
leaq -0xa8(%rbp), %rdi
callq 0x5c2c0
movq -0xb8(%rbp), %rdi
callq 0x5a210
movq -0xb8(%rbp), %rdi
subl 0x5d8(%rdi), %eax
subl 0x5e0(%rdi), %eax
movl %eax, -0x11c(%rbp)
callq 0x5b860
movl -0x11c(%rbp), %esi
movl %eax, %edx
movq -0xb8(%rbp), %rax
subl 0x5dc(%rax), %edx
subl 0x5e4(%rax), %edx
leaq -0xb0(%rbp), %rdi
callq 0x59260
movq -0x118(%rbp), %rdi
movq (%rdi), %rax
leaq -0xa8(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq *0x150(%rax)
movq -0xa0(%rbp), %rdi
movq (%rdi), %rax
movl $0x40, %esi
callq *0x120(%rax)
jmp 0xd6eb2
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0xd6da5
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nop