Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Debug/Language/English.xml
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,22 @@
<Item English_Text = "At Cursor" ID = "AtCursor"></Item>
<Item English_Text = "At Previous Position" ID = "AtPreviousPosition"></Item>

//Clip edit window, formatting toolbar tooltips
<Item English_Text = "Font..." ID = "EditToolbarFont"></Item>
<Item English_Text = "Font" ID = "EditToolbarFontName"></Item>
<Item English_Text = "Font Size" ID = "EditToolbarFontSize"></Item>
<Item English_Text = "Text Color" ID = "EditToolbarColor"></Item>
<Item English_Text = "Bold" ID = "EditToolbarBold"></Item>
<Item English_Text = "Italic" ID = "EditToolbarItalic"></Item>
<Item English_Text = "Underline" ID = "EditToolbarUnderline"></Item>
<Item English_Text = "Align Left" ID = "EditToolbarAlignLeft"></Item>
<Item English_Text = "Center" ID = "EditToolbarAlignCenter"></Item>
<Item English_Text = "Align Right" ID = "EditToolbarAlignRight"></Item>
<Item English_Text = "Increase Indent" ID = "EditToolbarIndent"></Item>
<Item English_Text = "Decrease Indent" ID = "EditToolbarOutdent"></Item>
<Item English_Text = "Bullets" ID = "EditToolbarBullet"></Item>
<Item English_Text = "Word Wrap" ID = "EditToolbarWrap"></Item>

</Ditto_String_Table>
<Ditto_Options_Sheet>
<Item English_Text = "OK" ID = "1"></Item>
Expand Down
14 changes: 14 additions & 0 deletions Debug/Language/Russian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,20 @@
<Item English_Text = "[Starred clips]" ID = "starred_clips">[Объекты со звёздочкой]</Item>
<Item English_Text = "There are no starred clips" ID = "NoStarredClips">Нет объектов со звёздочкой</Item>
<Item English_Text = "Description Options" ID = "DescriptionOptionsTooltip">Параметры описания</Item>
<Item English_Text = "Font..." ID = "EditToolbarFont">Шрифт...</Item>
<Item English_Text = "Font" ID = "EditToolbarFontName">Шрифт</Item>
<Item English_Text = "Font Size" ID = "EditToolbarFontSize">Размер шрифта</Item>
<Item English_Text = "Text Color" ID = "EditToolbarColor">Цвет текста</Item>
<Item English_Text = "Bold" ID = "EditToolbarBold">Полужирный</Item>
<Item English_Text = "Italic" ID = "EditToolbarItalic">Курсив</Item>
<Item English_Text = "Underline" ID = "EditToolbarUnderline">Подчёркнутый</Item>
<Item English_Text = "Align Left" ID = "EditToolbarAlignLeft">По левому краю</Item>
<Item English_Text = "Center" ID = "EditToolbarAlignCenter">По центру</Item>
<Item English_Text = "Align Right" ID = "EditToolbarAlignRight">По правому краю</Item>
<Item English_Text = "Increase Indent" ID = "EditToolbarIndent">Увеличить отступ</Item>
<Item English_Text = "Decrease Indent" ID = "EditToolbarOutdent">Уменьшить отступ</Item>
<Item English_Text = "Bullets" ID = "EditToolbarBullet">Маркированный список</Item>
<Item English_Text = "Word Wrap" ID = "EditToolbarWrap">Перенос по словам</Item>
</Ditto_String_Table>
<Ditto_Options_Sheet>
<Item English_Text = "OK" ID = "1">ОК</Item>
Expand Down
14 changes: 14 additions & 0 deletions Debug/Language/Ukrainian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,20 @@
<Item English_Text = "[Starred clips]" ID = "starred_clips">[Об’єкти із зірочкою]</Item>
<Item English_Text = "There are no starred clips" ID = "NoStarredClips">Немає об’єктів із зірочкою</Item>
<Item English_Text = "Description Options" ID = "DescriptionOptionsTooltip">Параметри опису</Item>
<Item English_Text = "Font..." ID = "EditToolbarFont">Шрифт...</Item>
<Item English_Text = "Font" ID = "EditToolbarFontName">Шрифт</Item>
<Item English_Text = "Font Size" ID = "EditToolbarFontSize">Розмір шрифту</Item>
<Item English_Text = "Text Color" ID = "EditToolbarColor">Колір тексту</Item>
<Item English_Text = "Bold" ID = "EditToolbarBold">Жирний</Item>
<Item English_Text = "Italic" ID = "EditToolbarItalic">Курсив</Item>
<Item English_Text = "Underline" ID = "EditToolbarUnderline">Підкреслений</Item>
<Item English_Text = "Align Left" ID = "EditToolbarAlignLeft">За лівим краєм</Item>
<Item English_Text = "Center" ID = "EditToolbarAlignCenter">По центру</Item>
<Item English_Text = "Align Right" ID = "EditToolbarAlignRight">За правим краєм</Item>
<Item English_Text = "Increase Indent" ID = "EditToolbarIndent">Збільшити відступ</Item>
<Item English_Text = "Decrease Indent" ID = "EditToolbarOutdent">Зменшити відступ</Item>
<Item English_Text = "Bullets" ID = "EditToolbarBullet">Маркований список</Item>
<Item English_Text = "Word Wrap" ID = "EditToolbarWrap">Перенесення за словами</Item>
</Ditto_String_Table>
<Ditto_Options_Sheet>
<Item English_Text = "OK" ID = "1">ОК</Item>
Expand Down
95 changes: 94 additions & 1 deletion src/RulerRichEditCtrl/RRECToolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions src/RulerRichEditCtrl/RRECToolbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down
51 changes: 50 additions & 1 deletion src/RulerRichEditCtrl/RulerRichEditCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 )
Expand Down
1 change: 1 addition & 0 deletions src/RulerRichEditCtrl/RulerRichEditCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class CRulerRichEditCtrl : public CWnd
void UpdateTabStops();

BOOL CreateToolbar();
void SetToolbarToolTips();
BOOL CreateRTFControl( BOOL autohscroll );
void CreateMargins();

Expand Down
Loading