[NEW] Document map follows the current text direction (RTL/LTR).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1303 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
134920648d
commit
428df19cbc
|
@ -2383,14 +2383,16 @@ void Notepad_plus::command(int id)
|
|||
case IDM_EDIT_RTL :
|
||||
case IDM_EDIT_LTR :
|
||||
{
|
||||
long exStyle = ::GetWindowLongPtr(_pEditView->getHSelf(), GWL_EXSTYLE);
|
||||
exStyle = (id == IDM_EDIT_RTL)?exStyle|WS_EX_LAYOUTRTL:exStyle&(~WS_EX_LAYOUTRTL);
|
||||
::SetWindowLongPtr(_pEditView->getHSelf(), GWL_EXSTYLE, exStyle);
|
||||
_pEditView->changeTextDirection(id == IDM_EDIT_RTL);
|
||||
|
||||
// Wrap then !wrap to fix problem of mirror characters
|
||||
bool isWraped = _pEditView->isWrap();
|
||||
_pEditView->wrap(!isWraped);
|
||||
_pEditView->wrap(isWraped);
|
||||
if (_pDocMap)
|
||||
{
|
||||
_pDocMap->changeTextDirection(id == IDM_EDIT_RTL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -3081,6 +3081,18 @@ void ScintillaEditView::quickSortLines(size_t fromLine, size_t toLine, bool isRe
|
|||
quickSortLines(pivotIndex + 1, toLine, isReverse);
|
||||
}
|
||||
|
||||
bool ScintillaEditView::isTextDirectionRTL() const
|
||||
{
|
||||
long exStyle = ::GetWindowLongPtr(_hSelf, GWL_EXSTYLE);
|
||||
return (exStyle & WS_EX_LAYOUTRTL) != 0;
|
||||
}
|
||||
|
||||
void ScintillaEditView::changeTextDirection(bool isRTL)
|
||||
{
|
||||
long exStyle = ::GetWindowLongPtr(_hSelf, GWL_EXSTYLE);
|
||||
exStyle = isRTL ? exStyle | WS_EX_LAYOUTRTL : exStyle&(~WS_EX_LAYOUTRTL);
|
||||
::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, exStyle);
|
||||
}
|
||||
|
||||
bool ScintillaEditView::swapLines(size_t line1, size_t line2)
|
||||
{
|
||||
|
|
|
@ -636,6 +636,8 @@ public:
|
|||
void scrollPosToCenter(int pos);
|
||||
bool swapLines(size_t line1, size_t line2);
|
||||
void quickSortLines(size_t fromLine, size_t toLine, bool isReverse = false);
|
||||
void changeTextDirection(bool isRTL);
|
||||
bool isTextDirectionRTL() const;
|
||||
|
||||
protected:
|
||||
static HINSTANCE _hLib;
|
||||
|
|
|
@ -89,9 +89,18 @@ void DocumentMap::initWrapMap()
|
|||
::MoveWindow(_pScintillaEditView->getHSelf(), 0, 0, rect.right - rect.left, rect.bottom-rect.top, TRUE);
|
||||
_pScintillaEditView->wrap(false);
|
||||
_pScintillaEditView->redraw(true);
|
||||
|
||||
bool isRTL = (*_ppEditView)->isTextDirectionRTL();
|
||||
if (_pScintillaEditView->isTextDirectionRTL() != isRTL)
|
||||
_pScintillaEditView->changeTextDirection(isRTL);
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentMap::changeTextDirection(bool isRTL)
|
||||
{
|
||||
_pScintillaEditView->changeTextDirection(isRTL);
|
||||
}
|
||||
|
||||
/*
|
||||
double ddd = (double)Xlength1/(double)Xlength2;
|
||||
char dchar[256];
|
||||
|
|
|
@ -131,6 +131,7 @@ public:
|
|||
void fold(int line, bool foldOrNot);
|
||||
void foldAll(bool mode);
|
||||
void setSyntaxHiliting();
|
||||
void changeTextDirection(bool isRTL);
|
||||
|
||||
protected:
|
||||
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
|
Loading…
Reference in New Issue