-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanTree.cpp
149 lines (149 loc) · 2.82 KB
/
cleanTree.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include "G.h"
/*
void G::CheckByte( void )
{
u8 mode = codeType_D->GetSelection();
u8 loop = codeLoop_SN->GetValue();
if ( loop > 0 || mode == CT_LIST )
{
s8 size = codeSize_D->GetSelection();
xStr text;
switch ( size )
{
case 1: text = wxT( "x 2 to Address" ); break;
case 2: text = wxT( "x 4 to Address" ); break;
case 3: text = wxT( "x 8 to Address" ); break;
default: text = wxT( "x 1 to Address" ); break;
}
codeByteInc_S2->SetLabel( text );
codeByteInc_P->Show();
if ( mode != CT_LIST )
{
codeSum_P->Show();
}
else
{
codeSum_P->Hide();
}
}
else
{
if ( mode != CT_LIST )
{
codeByteInc_P->Hide();
}
codeSum_P->Hide();
}
code_P->Layout();
}
//*/
void G::tree_TOnSelect( wxTreeEvent& event )
{
xTreeID id = tree_T->GetSelection();
gSetHack( mGetHack( id ) );
mShowHack();
}
void G::tree_TOnKeyUp( wxKeyEvent& event )
{
bool doEvent = true;
s32 key = event.GetKeyCode();
switch ( key )
{
case WXK_UP:
case WXK_LEFT:
case WXK_RIGHT:
case WXK_DOWN:
case WXK_SPACE:
doEvent = false;
}
if ( !doEvent )
{
xTreeID tid = GetHackID();
if ( key == WXK_SPACE )
{
HACK* hack = mGetHack( tid );
hack->use = !mUseHack_CB->GetValue();
mUseHack_CB->SetValue( hack->use );
}
else
{
if ( event.ControlDown() )
{
mMoveHack( tid, key );
}
else
{
doEvent = true;
}
}
}
event.Skip( doEvent );
}
void G::tree_TOnKeyDown( wxKeyEvent& event )
{
bool doEvent = true;
s32 key = event.GetKeyCode();
xTreeID tid = GetHackID();
xTreeID id;
switch ( key )
{
case WXK_DOWN:
if ( tid.IsOk() )
{
id = tree_T->GetNextSibling( tid );
}
if ( id.IsOk() )
{
doEvent = false;
break;
}
case WXK_RIGHT:
if ( tid.IsOk() && tree_T->HasChildren( tid ) )
{
xTreeIDV tidv;
id = tree_T->GetFirstChild( tid, tidv );
}
if ( !id.IsOk() )
{
id = tid;
}
doEvent = false;
break;
case WXK_UP:
if ( tid.IsOk() )
{
id = tree_T->GetPrevSibling( tid );
}
if ( id.IsOk() )
{
doEvent = false;
break;
}
case WXK_LEFT:
id = GetHackRoot( tid );
doEvent = false;
}
if ( !doEvent )
{
if ( !event.ControlDown() ) tree_T->SelectItem( id );
else doEvent = true;
}
event.Skip( doEvent );
}
void G::tree_TOnBeginDrag( wxTreeEvent& event )
{
treePrev = event.GetItem();
event.Allow();
}
void G::tree_TOnEndDrag( wxTreeEvent& event )
{
xTreeID id = event.GetItem();
xTreeID root = GetHackRoot( id );
xTreeID idf = treePrev;
xStr name = tree_T->GetItemText( idf );
HACK* hack = mGetHack( idf );
xTreeID idt = mNewHack( root, name, hack, id, ADD_NEXT );
mMoveHack( idf, idt );
tree_T->Expand( idt );
tree_T->SelectItem( idt );
}