diff --git a/Debug/Language/English.xml b/Debug/Language/English.xml
index 9d87d6e3..093564f5 100644
--- a/Debug/Language/English.xml
+++ b/Debug/Language/English.xml
@@ -446,6 +446,22 @@
+ //Clip edit window, formatting toolbar tooltips
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Debug/Language/Russian.xml b/Debug/Language/Russian.xml
index 6f95b2e7..d87b2deb 100644
--- a/Debug/Language/Russian.xml
+++ b/Debug/Language/Russian.xml
@@ -490,6 +490,20 @@
- [Объекты со звёздочкой]
- Нет объектов со звёздочкой
- Параметры описания
+ - Шрифт...
+ - Шрифт
+ - Размер шрифта
+ - Цвет текста
+ - Полужирный
+ - Курсив
+ - Подчёркнутый
+ - По левому краю
+ - По центру
+ - По правому краю
+ - Увеличить отступ
+ - Уменьшить отступ
+ - Маркированный список
+ - Перенос по словам
- ОК
diff --git a/Debug/Language/Ukrainian.xml b/Debug/Language/Ukrainian.xml
index c48a21ad..0c6c6483 100644
--- a/Debug/Language/Ukrainian.xml
+++ b/Debug/Language/Ukrainian.xml
@@ -462,6 +462,20 @@
- [Об’єкти із зірочкою]
- Немає об’єктів із зірочкою
- Параметри опису
+ - Шрифт...
+ - Шрифт
+ - Розмір шрифту
+ - Колір тексту
+ - Жирний
+ - Курсив
+ - Підкреслений
+ - За лівим краєм
+ - По центру
+ - За правим краєм
+ - Збільшити відступ
+ - Зменшити відступ
+ - Маркований список
+ - Перенесення за словами
- ОК
diff --git a/src/RulerRichEditCtrl/RRECToolbar.cpp b/src/RulerRichEditCtrl/RRECToolbar.cpp
index 55ff51d2..961cc656 100644
--- a/src/RulerRichEditCtrl/RRECToolbar.cpp
+++ b/src/RulerRichEditCtrl/RRECToolbar.cpp
@@ -110,7 +110,7 @@ BOOL CRRECToolbar::Create( CWnd* parent, CRect& rc, int resourceId)
memset(&tb, 0, sizeof(tb));
memset(&tbSep, 0, sizeof(tbSep));
- result = CToolBarCtrl::Create(WS_VISIBLE|WS_CHILD, rc, parent, resourceId);
+ result = CToolBarCtrl::Create(WS_VISIBLE|WS_CHILD|TBSTYLE_TOOLTIPS, rc, parent, resourceId);
if(result)
{
@@ -305,6 +305,99 @@ LRESULT CRRECToolbar::OnColorButton( WPARAM w, LPARAM l)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////
+// CRRECToolbar tooltips
+
+void CRRECToolbar::SetButtonToolTip( int command, const CString& text )
+/* ============================================================
+ Function : CRRECToolbar::SetButtonToolTip
+ Description : Sets the tooltip text of a toolbar button
+ Access : Public
+
+ Return : void
+ Parameters : int command - Button command id
+ CString& text - Tooltip text
+
+ Usage : Called from the parent editor after the
+ toolbar is created. The toolbar registers
+ every button with its tooltip itself
+ (TBSTYLE_TOOLTIPS), this only sets the text.
+
+ ============================================================*/
+{
+ CToolTipCtrl* tips = GetToolTips();
+ if( tips && tips->m_hWnd )
+ tips->UpdateTipText( text, this, command );
+}
+
+void CRRECToolbar::SetControlToolTips( const CString& fontName, const CString& fontSize, const CString& color )
+/* ============================================================
+ Function : CRRECToolbar::SetControlToolTips
+ Description : Adds tooltips to the font name and size
+ combos and the color picker, which are child
+ windows over toolbar separators
+ Access : Public
+
+ Return : void
+ Parameters : CString& fontName - Font name combo text
+ CString& fontSize - Font size combo text
+ CString& color - Color picker text
+
+ Usage : Called from the parent editor after the
+ toolbar is created.
+
+ ============================================================*/
+{
+ CToolTipCtrl* tips = GetToolTips();
+ if( tips == NULL || tips->m_hWnd == NULL )
+ return;
+
+ if( m_fontCombo.m_hWnd )
+ {
+ AddWindowToolTip( tips, &m_fontCombo, fontName );
+
+ // the font name combo is editable, its edit box covers most of it
+ CWnd* edit = m_fontCombo.GetWindow( GW_CHILD );
+ if( edit )
+ AddWindowToolTip( tips, edit, fontName );
+ }
+
+ if( m_size.m_hWnd )
+ AddWindowToolTip( tips, &m_size, fontSize );
+
+ if( m_color.m_hWnd )
+ AddWindowToolTip( tips, &m_color, color );
+}
+
+void CRRECToolbar::AddWindowToolTip( CToolTipCtrl* tips, CWnd* wnd, const CString& text )
+/* ============================================================
+ Function : CRRECToolbar::AddWindowToolTip
+ Description : Adds a child window as a tooltip tool
+ Access : Private
+
+ Return : void
+ Parameters : CToolTipCtrl* tips - Toolbar tooltip
+ CWnd* wnd - Child window
+ CString& text - Tooltip text
+
+ Usage : The toolbar relays only its own mouse
+ messages, so the tool subclasses the child
+ window (TTF_SUBCLASS) to see the mouse over it.
+ CToolTipCtrl::AddTool does not set that flag.
+
+ ============================================================*/
+{
+ TOOLINFO ti;
+ memset( &ti, 0, sizeof( ti ) );
+ ti.cbSize = sizeof( ti );
+ ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
+ ti.hwnd = ::GetParent( wnd->m_hWnd );
+ ti.uId = ( UINT_PTR ) wnd->m_hWnd;
+ ti.lpszText = ( LPTSTR ) ( LPCTSTR ) text;
+
+ tips->SendMessage( TTM_ADDTOOL, 0, ( LPARAM ) &ti );
+}
+
/////////////////////////////////////////////////////////////////////////////
// CRRECToolbar UI updaters
diff --git a/src/RulerRichEditCtrl/RRECToolbar.h b/src/RulerRichEditCtrl/RRECToolbar.h
index 2da1a0ed..e6957a9c 100644
--- a/src/RulerRichEditCtrl/RRECToolbar.h
+++ b/src/RulerRichEditCtrl/RRECToolbar.h
@@ -44,6 +44,9 @@ class CRRECToolbar : public CToolBarCtrl
void SetFontSize( int size );
void SetFontColor( COLORREF color );
+ void SetButtonToolTip( int command, const CString& text );
+ void SetControlToolTips( const CString& fontName, const CString& fontSize, const CString& color );
+
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRRECToolbar)
@@ -66,6 +69,8 @@ class CRRECToolbar : public CToolBarCtrl
private:
+ void AddWindowToolTip( CToolTipCtrl* tips, CWnd* wnd, const CString& text );
+
CFontComboBox m_fontCombo;
CSizeComboBox m_size;
CColourPicker m_color;
diff --git a/src/RulerRichEditCtrl/RulerRichEditCtrl.cpp b/src/RulerRichEditCtrl/RulerRichEditCtrl.cpp
index 5445dce2..74f94765 100644
--- a/src/RulerRichEditCtrl/RulerRichEditCtrl.cpp
+++ b/src/RulerRichEditCtrl/RulerRichEditCtrl.cpp
@@ -49,6 +49,7 @@
#include "TextFile/TextFile.h"
#include "..\Options.h"
#include "..\Misc.h"
+#include "..\CP_Main.h"
#include "..\HyperLink.h"
#include ".\rulerricheditctrl.h"
#include "..\..\resource.h"
@@ -277,7 +278,55 @@ BOOL CRulerRichEditCtrl::CreateToolbar()
GetClientRect( rect );
CRect toolbarRect( 0, 0, rect.right, m_dpi.Scale(TOOLBAR_HEIGHT));
- return m_toolbar.Create( this, toolbarRect, ToolbarIdPerDPI());
+ BOOL result = m_toolbar.Create( this, toolbarRect, ToolbarIdPerDPI());
+ if( result )
+ SetToolbarToolTips();
+
+ return result;
+}
+
+void CRulerRichEditCtrl::SetToolbarToolTips()
+/* ============================================================
+ Function : CRulerRichEditCtrl::SetToolbarToolTips
+ Description : Sets the tooltip texts of the toolbar buttons
+ and controls, with shortcuts handled in
+ PreTranslateMessage
+ Access : Private
+
+ Return : void
+ Parameters : none
+
+ Usage : Called from CreateToolbar, also when the
+ toolbar is recreated after a DPI change
+
+ ============================================================*/
+{
+ CString text;
+
+ m_toolbar.SetButtonToolTip( BUTTON_FONT, theApp.m_Language.GetString( "EditToolbarFont", "Font..." ) );
+
+ text.Format( _T( "%s Ctrl - B" ), theApp.m_Language.GetString( "EditToolbarBold", "Bold" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_BOLD, text );
+
+ text.Format( _T( "%s Ctrl - I" ), theApp.m_Language.GetString( "EditToolbarItalic", "Italic" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_ITALIC, text );
+
+ text.Format( _T( "%s Ctrl - U" ), theApp.m_Language.GetString( "EditToolbarUnderline", "Underline" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_UNDERLINE, text );
+
+ m_toolbar.SetButtonToolTip( BUTTON_LEFTALIGN, theApp.m_Language.GetString( "EditToolbarAlignLeft", "Align Left" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_CENTERALIGN, theApp.m_Language.GetString( "EditToolbarAlignCenter", "Center" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_RIGHTALIGN, theApp.m_Language.GetString( "EditToolbarAlignRight", "Align Right" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_INDENT, theApp.m_Language.GetString( "EditToolbarIndent", "Increase Indent" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_OUTDENT, theApp.m_Language.GetString( "EditToolbarOutdent", "Decrease Indent" ) );
+ m_toolbar.SetButtonToolTip( BUTTON_BULLET, theApp.m_Language.GetString( "EditToolbarBullet", "Bullets" ) );
+
+ text.Format( _T( "%s Ctrl - W" ), theApp.m_Language.GetString( "EditToolbarWrap", "Word Wrap" ) );
+ m_toolbar.SetButtonToolTip( ID_BUTTONWRAP, text );
+
+ m_toolbar.SetControlToolTips( theApp.m_Language.GetString( "EditToolbarFontName", "Font" ),
+ theApp.m_Language.GetString( "EditToolbarFontSize", "Font Size" ),
+ theApp.m_Language.GetString( "EditToolbarColor", "Text Color" ) );
}
BOOL CRulerRichEditCtrl::CreateRTFControl( BOOL autohscroll )
diff --git a/src/RulerRichEditCtrl/RulerRichEditCtrl.h b/src/RulerRichEditCtrl/RulerRichEditCtrl.h
index ffcea8c2..6197a2f3 100644
--- a/src/RulerRichEditCtrl/RulerRichEditCtrl.h
+++ b/src/RulerRichEditCtrl/RulerRichEditCtrl.h
@@ -146,6 +146,7 @@ class CRulerRichEditCtrl : public CWnd
void UpdateTabStops();
BOOL CreateToolbar();
+ void SetToolbarToolTips();
BOOL CreateRTFControl( BOOL autohscroll );
void CreateMargins();