# HG changeset patch # Parent 27319399f7f11ae9f63cb670cb040ce873cbc095 -Add: ToggleTextDirection() changes the current text direction and ReInit all opened windows if the 'gui.developer' setting is set. diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1126,6 +1126,23 @@ void ToggleDirtyBlocks() } /** + * Toggle the text direction. + * @note has only effect when \c developer setting is set. + * + * \c ReInit() is called for all windows to redraw them in the new text direction. + */ +void ToggleTextDirection() +{ + if (_settings_client.gui.developer) { + _current_text_dir = (_current_text_dir == TD_LTR) ? TD_RTL : TD_LTR; + Window *w; + FOR_ALL_WINDOWS_FROM_BACK(w) { + w->ReInit(); + } + } +} + +/** * Choose the proper callback function for the main toolbar's help menu. * @param index The menu index which was selected. * @return CBF_NONE diff --git a/src/toolbar_gui.h b/src/toolbar_gui.h --- a/src/toolbar_gui.h +++ b/src/toolbar_gui.h @@ -15,5 +15,6 @@ void AllocateToolbar(); void ToggleBoundingBoxes(); void ToggleDirtyBlocks(); +void ToggleTextDirection(); #endif /* TOOLBAR_GUI_H */