|
|
@ -463,6 +463,9 @@ void wxText::DoPeriodicAction(void) // mac platform only
|
|
|
|
void wxText::OnChar(wxKeyEvent& event) // mac platform only
|
|
|
|
void wxText::OnChar(wxKeyEvent& event) // mac platform only
|
|
|
|
{
|
|
|
|
{
|
|
|
|
long st,se;
|
|
|
|
long st,se;
|
|
|
|
|
|
|
|
int no_change = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetCurrentDC();
|
|
|
|
|
|
|
|
|
|
|
|
HLock((Handle)cMacTE);
|
|
|
|
HLock((Handle)cMacTE);
|
|
|
|
st = (*cMacTE)->selStart;
|
|
|
|
st = (*cMacTE)->selStart;
|
|
|
@ -494,33 +497,12 @@ void wxText::OnChar(wxKeyEvent& event) // mac platform only
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#if 0 // tom replaces:
|
|
|
|
|
|
|
|
case WXK_UP:
|
|
|
|
|
|
|
|
code = 30;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_DOWN:
|
|
|
|
|
|
|
|
code = 31;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_LEFT:
|
|
|
|
|
|
|
|
code = 28;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_RIGHT:
|
|
|
|
|
|
|
|
code = 29;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetCurrentDC();
|
|
|
|
|
|
|
|
::TEKey(code, cMacTE);
|
|
|
|
|
|
|
|
macAdjustScrollBars();
|
|
|
|
|
|
|
|
cTextModified = TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
case WXK_UP:
|
|
|
|
case WXK_UP:
|
|
|
|
case WXK_DOWN:
|
|
|
|
case WXK_DOWN:
|
|
|
|
|
|
|
|
no_change = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case WXK_LEFT:
|
|
|
|
case WXK_LEFT:
|
|
|
|
|
|
|
|
no_change = 1;
|
|
|
|
if (st>0) {
|
|
|
|
if (st>0) {
|
|
|
|
st--;
|
|
|
|
st--;
|
|
|
|
TESetSelect(st,st,cMacTE);
|
|
|
|
TESetSelect(st,st,cMacTE);
|
|
|
@ -532,6 +514,7 @@ void wxText::OnChar(wxKeyEvent& event) // mac platform only
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case WXK_RIGHT:
|
|
|
|
case WXK_RIGHT:
|
|
|
|
|
|
|
|
no_change = 1;
|
|
|
|
if (se<(*cMacTE)->teLength) {
|
|
|
|
if (se<(*cMacTE)->teLength) {
|
|
|
|
se++;
|
|
|
|
se++;
|
|
|
|
TESetSelect(se,se,cMacTE);
|
|
|
|
TESetSelect(se,se,cMacTE);
|
|
|
@ -539,10 +522,12 @@ void wxText::OnChar(wxKeyEvent& event) // mac platform only
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case WXK_HOME:
|
|
|
|
case WXK_HOME:
|
|
|
|
|
|
|
|
no_change = 1;
|
|
|
|
st = 0;
|
|
|
|
st = 0;
|
|
|
|
TESetSelect(st,st,cMacTE);
|
|
|
|
TESetSelect(st,st,cMacTE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case WXK_END:
|
|
|
|
case WXK_END:
|
|
|
|
|
|
|
|
no_change = 1;
|
|
|
|
se = (*cMacTE)->teLength;
|
|
|
|
se = (*cMacTE)->teLength;
|
|
|
|
TESetSelect(se,se,cMacTE);
|
|
|
|
TESetSelect(se,se,cMacTE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -556,11 +541,12 @@ void wxText::OnChar(wxKeyEvent& event) // mac platform only
|
|
|
|
TEDelete(cMacTE);
|
|
|
|
TEDelete(cMacTE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case WXK_PAGEUP:
|
|
|
|
case WXK_PAGEUP:
|
|
|
|
|
|
|
|
no_change = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case WXK_PAGEDOWN:
|
|
|
|
case WXK_PAGEDOWN:
|
|
|
|
|
|
|
|
no_change = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
SetCurrentDC(); // tom: I am not sure about this call...
|
|
|
|
|
|
|
|
char theChar = event.keyCode;
|
|
|
|
char theChar = event.keyCode;
|
|
|
|
::TEKey(theChar, cMacTE);
|
|
|
|
::TEKey(theChar, cMacTE);
|
|
|
|
//macAdjustScrollBars();
|
|
|
|
//macAdjustScrollBars();
|
|
|
@ -573,7 +559,14 @@ void wxText::OnChar(wxKeyEvent& event) // mac platform only
|
|
|
|
TEScroll(-10,0,cMacTE);
|
|
|
|
TEScroll(-10,0,cMacTE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HUnlock((Handle)cMacTE);
|
|
|
|
HUnlock((Handle)cMacTE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (!no_change) {
|
|
|
|
|
|
|
|
wxCommandEvent *commandEvent = new wxCommandEvent(wxEVENT_TYPE_TEXT_COMMAND);
|
|
|
|
|
|
|
|
commandEvent->commandString = GetValue();
|
|
|
|
|
|
|
|
commandEvent->eventObject = this;
|
|
|
|
|
|
|
|
ProcessCommand(*commandEvent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
@ -705,16 +698,7 @@ char* wxText::GetLabel(void)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
char* wxText::GetValue(void)
|
|
|
|
char* wxText::GetValue(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CharsHandle theMacText = ::TEGetText(cMacTE);
|
|
|
|
return GetContents();
|
|
|
|
int theMacTextLength = (**cMacTE).teLength;
|
|
|
|
|
|
|
|
#if 1 // CJC
|
|
|
|
|
|
|
|
char *result = wxBuffer;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
char* result = new char[theMacTextLength + 1];
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BlockMove(*theMacText, result, theMacTextLength);
|
|
|
|
|
|
|
|
result[theMacTextLength] = 0; // terminate "C" string
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|