Definition at line 750 of file TextEdit.h. References ClampDocY(), ComputeCaretPosition(), FindLineAtY(), GetLineAtIndex(), OglGui::OglWindow::H(), mCaret, mCaretY, OglGui::DocDimensions::mDocY, mLineH, mMark, mText, and mUpDownPos. Referenced by KeyboardFunc(). 00751 { 00752 bool shift = (state & oglShift) ? true : false; 00753 bool control = (state & oglControl) ? true : false; 00754 string str; 00755 00756 if (c==oglUP || c==oglDOWN || c==oglPAGEUP || c==oglPAGEDOWN) 00757 { 00758 int lineInd = FindLineAtY(mCaretY, mCaretY); 00759 int dY; 00760 00761 if (mUpDownPos == -1) 00762 mUpDownPos = mCaret - lineInd; 00763 00764 if (c==oglUP || c==oglDOWN) 00765 dY = (c==oglUP ? mLineH : -mLineH); 00766 else 00767 dY = (c==oglPAGEUP ? H()-2*mLineH : -H()+2*mLineH); 00768 00769 lineInd = FindLineAtY(mCaretY + dY, mCaretY); 00770 if (c==oglPAGEUP || c==oglPAGEDOWN) 00771 { 00772 int oldCaretY = mCaretY; 00773 ComputeCaretPosition(); 00774 mDocY += mCaretY - oldCaretY; 00775 ClampDocY(); 00776 } 00777 GetLineAtIndex(&str, lineInd); 00778 int sLen = str.length(); 00779 mCaret = lineInd + ((sLen > mUpDownPos) ? mUpDownPos : sLen); 00780 } 00781 else 00782 { 00783 mUpDownPos = -1; 00784 if (c==oglLEFT || c==oglRIGHT) 00785 if ((mCaret += (c==oglLEFT) ? -1 : 1) < 0) 00786 mCaret = 0; 00787 00788 if (c==oglHOME && control) 00789 mCaret = 0; 00790 else if(c == oglHOME) 00791 mCaret = FindLineAtY(mCaretY, mCaretY); 00792 00793 if (c==oglEND && control) 00794 mCaret = mText.size(); 00795 else if (c==oglEND) 00796 { 00797 int lineInd = FindLineAtY(mCaretY, mCaretY); 00798 GetLineAtIndex(&str, lineInd); 00799 mCaret = lineInd + str.length(); 00800 } 00801 } 00802 00803 if (mCaret > mText.length()) 00804 mCaret = mText.length(); 00805 00806 if (!shift) 00807 mMark = mCaret; 00808 00809 ComputeCaretPosition(); 00810 }
Here is the call graph for this function:
|