// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/special/cursor.cpp
// Function: smooth::GUI::Cursor::GetContextMenu()
S::GUI::PopupMenu *S::GUI::Cursor::GetContextMenu()
{
	if (!IsActive() && text == NIL) return NIL;

	if (contextMenu == NIL) contextMenu = new PopupMenu();

	contextMenu->RemoveAllEntries();

	MenuEntry	*entryUndo    = contextMenu->AddEntry(I18n::Translator::defaultTranslator->TranslateString("Undo"));

	contextMenu->AddEntry();

	MenuEntry	*entryCut     = contextMenu->AddEntry(I18n::Translator::defaultTranslator->TranslateString("Cut"));
	MenuEntry	*entryCopy    = contextMenu->AddEntry(I18n::Translator::defaultTranslator->TranslateString("Copy"));
	MenuEntry	*entryInsert  = contextMenu->AddEntry(I18n::Translator::defaultTranslator->TranslateString("Paste"));
	MenuEntry	*entryDelete  = contextMenu->AddEntry(I18n::Translator::defaultTranslator->TranslateString("Clear"));

	contextMenu->AddEntry();

	MenuEntry	*entryMarkAll = contextMenu->AddEntry(I18n::Translator::defaultTranslator->TranslateString("Select all"));

	entryUndo->onAction.Connect(&Cursor::Undo, this);

	entryCut->onAction.Connect(&Cursor::OnCut, this);
	entryCopy->onAction.Connect(&Cursor::CopyToClipboard, this);
	entryInsert->onAction.Connect(&Cursor::OnInsert, this);
	entryDelete->onAction.Connect(&Cursor::DeleteSelectedText, this);

	entryMarkAll->onAction.Connect(&Cursor::MarkAll, this);

	/* Disable modification if inactive.
	 */
	if (!IsActive())
	{
		entryUndo->Deactivate();
		entryCut->Deactivate();
		entryInsert->Deactivate();
		entryDelete->Deactivate();
	}

	/* Disable copy and delete if nothing is selected.
	 */
	if (markStart == markEnd)
	{
		entryCut->Deactivate();
		entryCopy->Deactivate();
		entryDelete->Deactivate();
	}

	/* Disable "Select all" if everything is selected already.
	 */
	if ((markStart == 0 && markEnd == text.Length()) || text == NIL)
	{
		entryMarkAll->Deactivate();
	}

	/* Disable undo if no history is available.
	 */
	if (historyPos == 1)
	{
		entryUndo->Deactivate();
	}

	return contextMenu;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x178(%rbp)
movq (%rdi), %rax
callq *0x98(%rax)
testb $0x1, %al
jne 0xc983f
movq -0x178(%rbp), %rdi
addq $0xf0, %rdi
xorl %esi, %esi
callq 0x59320
testb $0x1, %al
jne 0xc9832
jmp 0xc983f
movq $0x0, -0x8(%rbp)
jmp 0xca048
movq -0x178(%rbp), %rax
cmpq $0x0, 0x648(%rax)
jne 0xc98a7
movl $0x6b8, %edi            # imm = 0x6B8
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x180(%rbp)
callq 0x5d910
jmp 0xc986e
movq -0x178(%rbp), %rax
movq -0x180(%rbp), %rcx
movq %rcx, 0x648(%rax)
jmp 0xc98a7
movq -0x180(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x6b8, %esi            # imm = 0x6B8
callq 0x595b0
jmp 0xca055
movq -0x178(%rbp), %rax
movq 0x648(%rax), %rdi
movq (%rdi), %rax
movq 0x168(%rax), %rax
callq *%rax
movq -0x178(%rbp), %rax
movq 0x648(%rax), %rax
movq %rax, -0x1a0(%rbp)
movq 0x13eae3(%rip), %rax    # 0x2083c0
movq (%rax), %rax
movq %rax, -0x198(%rbp)
leaq 0xc13b3(%rip), %rsi     # 0x18aca1
leaq -0x40(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x5c1f0
movq -0x198(%rbp), %rdi
movq -0x190(%rbp), %rsi
callq 0x5cc30
movq %rax, -0x188(%rbp)
jmp 0xc991a
movq -0x188(%rbp), %rsi
movq -0x1a0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x59b50
movq %rax, -0x1a8(%rbp)
jmp 0xc993a
leaq -0x40(%rbp), %rdi
callq 0x5df00
movq -0x1a8(%rbp), %rcx
movq -0x178(%rbp), %rax
movq %rcx, -0x28(%rbp)
movq 0x648(%rax), %rax
movq %rax, -0x1b8(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
xorl %esi, %esi
movl %esi, -0x1bc(%rbp)
callq 0x5da90
movl -0x1bc(%rbp), %eax
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
movl %eax, %edx
callq 0x59b50
jmp 0xc9998
leaq -0x58(%rbp), %rdi
callq 0x5df00
movq -0x178(%rbp), %rax
movq 0x648(%rax), %rax
movq %rax, -0x1e0(%rbp)
movq 0x13ea03(%rip), %rax    # 0x2083c0
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
leaq 0xc12d8(%rip), %rsi     # 0x18aca6
leaq -0x78(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x5c1f0
movq -0x1d8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
callq 0x5cc30
movq %rax, -0x1c8(%rbp)
jmp 0xc99fa
movq -0x1c8(%rbp), %rsi
movq -0x1e0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x59b50
movq %rax, -0x1e8(%rbp)
jmp 0xc9a1a
leaq -0x78(%rbp), %rdi
callq 0x5df00
movq -0x1e8(%rbp), %rcx
movq -0x178(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq 0x648(%rax), %rax
movq %rax, -0x208(%rbp)
movq 0x13e976(%rip), %rax    # 0x2083c0
movq (%rax), %rax
movq %rax, -0x200(%rbp)
leaq 0xdd045(%rip), %rsi     # 0x1a6aa0
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x5c1f0
movq -0x200(%rbp), %rdi
movq -0x1f8(%rbp), %rsi
callq 0x5cc30
movq %rax, -0x1f0(%rbp)
jmp 0xc9a8a
movq -0x1f0(%rbp), %rsi
movq -0x208(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x59b50
movq %rax, -0x210(%rbp)
jmp 0xc9aaa
leaq -0x98(%rbp), %rdi
callq 0x5df00
movq -0x210(%rbp), %rcx
movq -0x178(%rbp), %rax
movq %rcx, -0x80(%rbp)
movq 0x648(%rax), %rax
movq %rax, -0x230(%rbp)
movq 0x13e8e3(%rip), %rax    # 0x2083c0
movq (%rax), %rax
movq %rax, -0x228(%rbp)
leaq 0xc11bc(%rip), %rsi     # 0x18acaa
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x5c1f0
movq -0x228(%rbp), %rdi
movq -0x220(%rbp), %rsi
callq 0x5cc30
movq %rax, -0x218(%rbp)
jmp 0xc9b1d
movq -0x218(%rbp), %rsi
movq -0x230(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x59b50
movq %rax, -0x238(%rbp)
jmp 0xc9b3d
leaq -0xb8(%rbp), %rdi
callq 0x5df00
movq -0x238(%rbp), %rcx
movq -0x178(%rbp), %rax
movq %rcx, -0xa0(%rbp)
movq 0x648(%rax), %rax
movq %rax, -0x258(%rbp)
movq 0x13e84d(%rip), %rax    # 0x2083c0
movq (%rax), %rax
movq %rax, -0x250(%rbp)
leaq 0xc112c(%rip), %rsi     # 0x18acb0
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x5c1f0
movq -0x250(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x5cc30
movq %rax, -0x240(%rbp)
jmp 0xc9bb3
movq -0x240(%rbp), %rsi
movq -0x258(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x59b50
movq %rax, -0x260(%rbp)
jmp 0xc9bd3
leaq -0xd8(%rbp), %rdi
callq 0x5df00
movq -0x260(%rbp), %rcx
movq -0x178(%rbp), %rax
movq %rcx, -0xc0(%rbp)
movq 0x648(%rax), %rax
movq %rax, -0x270(%rbp)
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x268(%rbp)
xorl %esi, %esi
movl %esi, -0x274(%rbp)
callq 0x5da90
movl -0x274(%rbp), %eax
movq -0x270(%rbp), %rdi
movq -0x268(%rbp), %rsi
movl %eax, %edx
callq 0x59b50
jmp 0xc9c3a
leaq -0xf0(%rbp), %rdi
callq 0x5df00
movq -0x178(%rbp), %rax
movq 0x648(%rax), %rax
movq %rax, -0x298(%rbp)
movq 0x13e75e(%rip), %rax    # 0x2083c0
movq (%rax), %rax
movq %rax, -0x290(%rbp)
leaq 0xc1043(%rip), %rsi     # 0x18acb6
leaq -0x110(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x5c1f0
movq -0x290(%rbp), %rdi
movq -0x288(%rbp), %rsi
callq 0x5cc30
movq %rax, -0x280(%rbp)
jmp 0xc9ca2
movq -0x280(%rbp), %rsi
movq -0x298(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x59b50
movq %rax, -0x2a0(%rbp)
jmp 0xc9cc2
leaq -0x110(%rbp), %rdi
callq 0x5df00
movq -0x2a0(%rbp), %rax
movq -0x178(%rbp), %rcx
movq %rax, -0xf8(%rbp)
movq -0x28(%rbp), %rdi
addq $0x478, %rdi            # imm = 0x478
movq 0x13e7ab(%rip), %rax    # 0x2084a0
movq %rax, -0x120(%rbp)
movq $0x0, -0x118(%rbp)
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdx
callq 0xd0c10
movq -0x178(%rbp), %rcx
movq -0x60(%rbp), %rdi
addq $0x478, %rdi            # imm = 0x478
movq 0x13eea5(%rip), %rax    # 0x208bd8
movq %rax, -0x130(%rbp)
movq $0x0, -0x128(%rbp)
movq -0x130(%rbp), %rsi
movq -0x128(%rbp), %rdx
callq 0xd0c10
movq -0x178(%rbp), %rcx
movq -0x80(%rbp), %rdi
addq $0x478, %rdi            # imm = 0x478
movq 0x13f01f(%rip), %rax    # 0x208d90
movq %rax, -0x140(%rbp)
movq $0x0, -0x138(%rbp)
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
callq 0xd0c10
movq -0x178(%rbp), %rcx
movq -0xa0(%rbp), %rdi
addq $0x478, %rdi            # imm = 0x478
movq 0x13e746(%rip), %rax    # 0x2084f8
movq %rax, -0x150(%rbp)
movq $0x0, -0x148(%rbp)
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %rdx
callq 0xd0c10
movq -0x178(%rbp), %rcx
movq -0xc0(%rbp), %rdi
addq $0x478, %rdi            # imm = 0x478
movq 0x13f055(%rip), %rax    # 0x208e48
movq %rax, -0x160(%rbp)
movq $0x0, -0x158(%rbp)
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
callq 0xd0c10
movq -0x178(%rbp), %rcx
movq -0xf8(%rbp), %rdi
addq $0x478, %rdi            # imm = 0x478
movq 0x13ee6c(%rip), %rax    # 0x208ca0
movq %rax, -0x170(%rbp)
movq $0x0, -0x168(%rbp)
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
callq 0xd0fb0
movq -0x178(%rbp), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
testb $0x1, %al
jne 0xc9f83
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0xa0(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0xc0(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
jmp 0xc9f83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x5df00
jmp 0xca055
movq -0x178(%rbp), %rcx
movl 0x5c8(%rcx), %eax
cmpl 0x5cc(%rcx), %eax
jne 0xc9fb9
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0x80(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0xc0(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0x178(%rbp), %rax
cmpl $0x0, 0x5c8(%rax)
jne 0xc9ff4
movq -0x178(%rbp), %rdi
movl 0x5cc(%rdi), %eax
movl %eax, -0x2a4(%rbp)
addq $0xf0, %rdi
callq 0x5b800
movl %eax, %ecx
movl -0x2a4(%rbp), %eax
cmpl %ecx, %eax
je 0xca00f
movq -0x178(%rbp), %rdi
addq $0xf0, %rdi
xorl %esi, %esi
callq 0x59320
testb $0x1, %al
jne 0xca00f
jmp 0xca01c
movq -0xf8(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0x178(%rbp), %rax
cmpl $0x1, 0x700(%rax)
jne 0xca036
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq -0x178(%rbp), %rax
movq 0x648(%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x5b6b0
nop