Added a list style editor page to the formatting dialog.

Added a style organiser dialog, which can be used to browse
for and apply styles and can be limited to show one of
the three style types, or all three.
Added a font name cache since it's an expensive operation
that's used frequently by the rich text dialogs.
Added ability to switch off tooltips for new dialogs
(off by default). Improved the previews. Pressing tab or shift-tab
at the start of a list item now demotes or promotes the item.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2006-10-19 14:04:13 +00:00
parent 0c7e0a8771
commit dadd4f5523
20 changed files with 2892 additions and 259 deletions

View File

@ -993,12 +993,12 @@ public:
/// Number/renumber any list elements in the given range.
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
/// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
/// Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously

View File

@ -205,12 +205,12 @@ public:
/// Number/renumber any list elements in the given range
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
/// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
// translate between the position (which is just an index in the text ctrl
@ -737,6 +737,10 @@ public:
// Implementation
/// Font names take a long time to retrieve, so cache them (on demand)
static const wxArrayString& GetAvailableFontNames();
static void ClearAvailableFontNames();
WX_FORWARD_TO_SCROLL_HELPER()
// Overrides
@ -799,6 +803,8 @@ private:
/// Threshold for doing delayed layout
long m_delayedLayoutThreshold;
static wxArrayString sm_availableFontNames;
};
/*!

View File

@ -34,7 +34,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog;
class WXDLLIMPEXP_CORE wxImageList;
/*!
* Flags determining the pages to be created in the dialog
* Flags determining the pages and buttons to be created in the dialog
*/
#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001
@ -42,6 +42,9 @@ class WXDLLIMPEXP_CORE wxImageList;
#define wxRICHTEXT_FORMAT_TABS 0x0004
#define wxRICHTEXT_FORMAT_BULLETS 0x0008
#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010
#define wxRICHTEXT_FORMAT_LIST_STYLE 0x0020
#define wxRICHTEXT_FORMAT_HELP_BUTTON 0x0100
/*!
* Shorthand for common combinations of pages
@ -110,7 +113,7 @@ public:
void Init();
bool Create(long flags, wxWindow* parent, const wxString& title, wxWindowID id,
bool Create(long flags, wxWindow* parent, const wxString& title = _("Formatting"), wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
@ -168,6 +171,12 @@ public:
/// Helper for pages to get the style
static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win);
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
/// Map book control page index to our page id
void AddPageId(int id) { m_pageIds.Add(id); }
@ -180,6 +189,7 @@ protected:
wxArrayInt m_pageIds; // mapping of book control indexes to page ids
static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;
static bool sm_showToolTips;
DECLARE_EVENT_TABLE()
};

View File

@ -0,0 +1,245 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextliststylepage.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 10/18/2006 11:36:37 AM
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTLISTSTYLEPAGE_H_
#define _RICHTEXTLISTSTYLEPAGE_H_
/*!
* Includes
*/
////@begin includes
#include "wx/spinctrl.h"
#include "wx/notebook.h"
#include "wx/statline.h"
////@end includes
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE _("wxRichTextListStylePage")
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME ID_RICHTEXTLISTSTYLEPAGE
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextListStylePage class declaration
*/
class wxRichTextListStylePage: public wxPanel
{
DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage )
DECLARE_EVENT_TABLE()
public:
/// Constructors
wxRichTextListStylePage( );
wxRichTextListStylePage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE );
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Updates the bullets preview
void UpdatePreview();
/// Transfer data from/to window
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
/// Get attributes for selected level
wxTextAttrEx* GetAttributesForSelection();
/// Update for symbol-related controls
void OnSymbolUpdate( wxUpdateUIEvent& event );
/// Update for number-related controls
void OnNumberUpdate( wxUpdateUIEvent& event );
/// Just transfer to the window
void DoTransferDataToWindow();
/// Transfer from the window and preview
void TransferAndPreview();
////@begin wxRichTextListStylePage event handler declarations
/// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelUpdated( wxSpinEvent& event );
/// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelUp( wxSpinEvent& event );
/// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelDown( wxSpinEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelTextUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
void OnChooseFontClick( wxCommandEvent& event );
/// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
void OnStylelistboxSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
void OnSymbolstaticUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
void OnSymbolctrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
void OnSymbolctrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
void OnSymbolctrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
void OnChooseSymbolClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
void OnChooseSymbolUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
void OnParenthesesctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
void OnParenthesesctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
void OnPeriodctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
void OnPeriodctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
void OnRichtextliststylepageAlignleftSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
void OnRichtextliststylepageAlignrightSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
void OnRichtextliststylepageJustifiedSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
void OnRichtextliststylepageCenteredSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
void OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
void OnIndentLeftUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
void OnIndentFirstLineUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
void OnIndentRightUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
void OnSpacingBeforeUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
void OnSpacingAfterUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
void OnLineSpacingSelected( wxCommandEvent& event );
////@end wxRichTextListStylePage event handler declarations
////@begin wxRichTextListStylePage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextListStylePage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextListStylePage member variables
wxSpinCtrl* m_levelCtrl;
wxListBox* m_styleListBox;
wxComboBox* m_symbolCtrl;
wxComboBox* m_symbolFontCtrl;
wxCheckBox* m_parenthesesCtrl;
wxCheckBox* m_periodCtrl;
wxRadioButton* m_alignmentLeft;
wxRadioButton* m_alignmentRight;
wxRadioButton* m_alignmentJustified;
wxRadioButton* m_alignmentCentred;
wxRadioButton* m_alignmentIndeterminate;
wxTextCtrl* m_indentLeft;
wxTextCtrl* m_indentLeftFirst;
wxTextCtrl* m_indentRight;
wxTextCtrl* m_spacingBefore;
wxTextCtrl* m_spacingAfter;
wxComboBox* m_spacingLine;
wxRichTextCtrl* m_previewCtrl;
/// Control identifiers
enum {
ID_RICHTEXTLISTSTYLEPAGE = 10616,
ID_RICHTEXTLISTSTYLEPAGE_LEVEL = 10617,
ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT = 10604,
ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK = 10618,
ID_RICHTEXTLISTSTYLEPAGE_BULLETS = 10619,
ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX = 10620,
ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC = 10621,
ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL = 10622,
ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL = 10623,
ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL = 10625,
ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL = 10626,
ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL = 10627,
ID_RICHTEXTLISTSTYLEPAGE_SPACING = 10628,
ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT = 10629,
ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT = 10630,
ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED = 10631,
ID_RICHTEXTLISTSTYLEPAGE_CENTERED = 10632,
ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE = 10633,
ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT = 10634,
ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE = 10635,
ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT = 10636,
ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE = 10637,
ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER = 10638,
ID_RICHTEXTLISTSTYLEPAGE_LINESPACING = 10639,
ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL = 10640
};
////@end wxRichTextListStylePage member variables
bool m_dontUpdate;
int m_currentLevel;
};
#endif
// _RICHTEXTLISTSTYLEPAGE_H_

View File

@ -0,0 +1,237 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextstyledlg.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 10/5/2006 12:05:31 PM
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTSTYLEDLG_H_
#define _RICHTEXTSTYLEDLG_H_
/*!
* Includes
*/
////@begin includes
////@end includes
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextstyles.h"
#include "wx/richtext/richtextctrl.h"
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
class wxRichTextStyleListCtrl;
class wxRichTextCtrl;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE _("Style Organiser")
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Flags for specifying permitted operations
*/
#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
#define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008
#define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010
#define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020
#define wxRICHTEXT_ORGANISER_RENUMBER 0x0040
// The permitted style types to show
#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x0800
// Common combinations
#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES)
#define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
#define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
/*!
* wxRichTextStyleOrganiserDialog class declaration
*/
class wxRichTextStyleOrganiserDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
DECLARE_EVENT_TABLE()
public:
/// Constructors
wxRichTextStyleOrganiserDialog( );
wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
/// Creation
bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
/// Creates the controls and sizers
void CreateControls();
/// Initialise member variables
void Init();
/// Transfer data from/to window
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
/// Set/get style sheet
void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; }
wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; }
/// Set/get control
void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
/// Set/get flags
void SetFlags(int flags) { m_flags = flags; }
int GetFlags() const { return m_flags; }
/// Show preview for given or selected preview
void ShowPreview(int sel = -1);
/// Clears the preview
void ClearPreview();
/// List selection
void OnListSelection(wxCommandEvent& event);
/// Get/set restart numbering boolean
bool GetRestartNumbering() const { return m_restartNumbering; }
void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; }
/// Get selected style name or definition
wxString GetSelectedStyle() const;
wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
/// Apply the style
bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
////@begin wxRichTextStyleOrganiserDialog event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
void OnNewCharClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
void OnNewCharUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
void OnNewParaClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
void OnNewParaUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
void OnNewListClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
void OnNewListUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
void OnApplyClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
void OnApplyUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
void OnRenameClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
void OnRenameUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
void OnEditClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
void OnEditUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
void OnDeleteClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
void OnDeleteUpdate( wxUpdateUIEvent& event );
////@end wxRichTextStyleOrganiserDialog event handler declarations
////@begin wxRichTextStyleOrganiserDialog member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextStyleOrganiserDialog member function declarations
////@begin wxRichTextStyleOrganiserDialog member variables
wxBoxSizer* m_innerSizer;
wxBoxSizer* m_buttonSizerParent;
wxRichTextStyleListCtrl* m_stylesListBox;
wxRichTextCtrl* m_previewCtrl;
wxBoxSizer* m_buttonSizer;
wxButton* m_newCharacter;
wxButton* m_newParagraph;
wxButton* m_newList;
wxButton* m_applyStyle;
wxButton* m_renameStyle;
wxButton* m_editStyle;
wxButton* m_deleteStyle;
wxButton* m_closeButton;
wxBoxSizer* m_bottomButtonSizer;
wxCheckBox* m_restartNumberingCtrl;
wxButton* m_okButton;
wxButton* m_cancelButton;
/// Control identifiers
enum {
ID_RICHTEXTSTYLEORGANISERDIALOG = 10500,
ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501,
ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508,
ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503,
ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502,
ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506,
ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507,
ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511
};
////@end wxRichTextStyleOrganiserDialog member variables
private:
wxRichTextCtrl* m_richTextCtrl;
wxRichTextStyleSheet* m_richTextStyleSheet;
bool m_dontUpdate;
int m_flags;
static bool sm_showToolTips;
bool m_restartNumbering;
};
#endif
// _RICHTEXTSTYLEDLG_H_

View File

@ -12,20 +12,6 @@
#ifndef _RICHTEXTSTYLEPAGE_H_
#define _RICHTEXTSTYLEPAGE_H_
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/

View File

@ -383,6 +383,7 @@ public:
m_richTextCtrl = NULL;
m_applyOnSelection = false;
m_styleType = wxRICHTEXT_STYLE_PARAGRAPH;
m_autoSetSelection = true;
}
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
@ -414,9 +415,6 @@ public:
/// Apply the style
void ApplyStyle(int i);
/// React to selection
void OnSelect(wxCommandEvent& event);
/// Left click
void OnLeftDown(wxMouseEvent& event);
@ -431,7 +429,8 @@ public:
/// Can we set the selection based on the editor caret position?
/// Need to override this if being used in a combobox popup
virtual bool CanAutoSetSelection() { return true; }
virtual bool CanAutoSetSelection() { return m_autoSetSelection; }
virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; }
/// Set whether the style should be applied as soon as the item is selected (the default)
void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; }
@ -454,6 +453,7 @@ private:
wxRichTextCtrl* m_richTextCtrl;
bool m_applyOnSelection; // if true, applies style on selection
wxRichTextStyleType m_styleType; // style type to display
bool m_autoSetSelection;
};
/*!
@ -462,6 +462,8 @@ private:
* style types.
*/
#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
{
DECLARE_CLASS(wxRichTextStyleListCtrl)
@ -493,6 +495,9 @@ public:
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
/// Updates the style list box
void UpdateStyles();
/// Associates the control with a style manager
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
wxRichTextStyleSheet* GetStyleSheet() const;
@ -501,9 +506,6 @@ public:
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
wxRichTextCtrl* GetRichTextCtrl() const;
/// Updates the style list box
void UpdateStyles();
/// Set/get the style type to display
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;

View File

@ -24,10 +24,7 @@
*/
////@begin forward declarations
class WXDLLIMPEXP_RICHTEXT wxSymbolListCtrl;
class WXDLLIMPEXP_CORE wxComboBox;
class WXDLLIMPEXP_CORE wxStaticText;
class WXDLLIMPEXP_CORE wxTextCtrl;
class wxSymbolListCtrl;
////@end forward declarations
// __UNICODE__ is a symbol used by DialogBlocks-generated code.
@ -93,6 +90,12 @@ public:
/// Specifying normal text?
bool UseNormalFont() const { return m_fontName.IsEmpty(); }
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
/// Data transfer
virtual bool TransferDataToWindow();
@ -111,16 +114,12 @@ public:
void OnFromUnicodeSelected( wxCommandEvent& event );
#endif
#if defined(__WXMSW__) || \
defined(__WXMAC__) || \
defined(__WXGTK__) || \
defined(__WXPM__) || \
defined(__WXMGL__) || \
defined(__WXMOTIF__) || \
defined(__WXCOCOA__) || \
defined(__WXX11__) || \
defined(__WXPALMOS__)
#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXOS2__) || defined(__WXMGL__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || defined(__WXX11__) || defined(__WXPALMOS__)
/// wxEVT_UPDATE_UI event handler for wxID_OK
void OnOkUpdate( wxUpdateUIEvent& event );
#endif
#if defined(__WXMAC__)
/// wxEVT_UPDATE_UI event handler for wxID_OK
void OnOkUpdate( wxUpdateUIEvent& event );
@ -148,9 +147,6 @@ public:
wxIcon GetIconResource( const wxString& name );
////@end wxSymbolPickerDialog member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxSymbolPickerDialog member variables
wxComboBox* m_fontCtrl;
#if defined(__UNICODE__)
@ -178,6 +174,7 @@ public:
////@end wxSymbolPickerDialog member variables
bool m_dontUpdate;
static bool sm_showToolTips;
};
/*!

View File

@ -5357,6 +5357,7 @@ public:
wxRichTextBuffer::CleanUpHandlers();
wxRichTextDecimalToRoman(-1);
wxRichTextParagraph::ClearDefaultTabs();
wxRichTextCtrl::ClearAvailableFontNames();
};
};

View File

@ -14,7 +14,6 @@
#include "wx/richtext/richtextbulletspage.h"
#include "wx/richtext/richtextsymboldlg.h"
#include "wx/fontenum.h"
/*!
* wxRichTextBulletsPage type definition
@ -144,6 +143,9 @@ void wxRichTextBulletsPage::CreateControls()
wxString* m_styleListBoxStrings = NULL;
m_styleListBox = new wxListBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_styleListBoxStrings, wxLB_SINGLE );
m_styleListBox->SetHelpText(_("The available bullet styles."));
if (ShowToolTips())
m_styleListBox->SetToolTip(_("The available bullet styles."));
itemBoxSizer5->Add(m_styleListBox, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
@ -163,17 +165,16 @@ void wxRichTextBulletsPage::CreateControls()
itemBoxSizer11->Add(itemBoxSizer13, 0, wxGROW, 5);
wxString* m_symbolCtrlStrings = NULL;
m_symbolCtrl = new wxComboBox( itemPanel1,
ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL,
wxEmptyString,
wxDefaultPosition,
wxSize(60, wxDefaultCoord),
0,
m_symbolCtrlStrings,
wxCB_DROPDOWN );
m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN );
m_symbolCtrl->SetHelpText(_("The bullet character."));
if (ShowToolTips())
m_symbolCtrl->SetToolTip(_("The bullet character."));
itemBoxSizer13->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
wxButton* itemButton15 = new wxButton( itemPanel1, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 );
itemButton15->SetHelpText(_("Click to browse for a symbol."));
if (ShowToolTips())
itemButton15->SetToolTip(_("Click to browse for a symbol."));
itemBoxSizer13->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer11->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
@ -182,14 +183,10 @@ void wxRichTextBulletsPage::CreateControls()
itemBoxSizer11->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_symbolFontCtrlStrings = NULL;
m_symbolFontCtrl = new wxComboBox( itemPanel1,
ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
0,
m_symbolFontCtrlStrings,
wxCB_DROPDOWN );
m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
m_symbolFontCtrl->SetHelpText(_("Available fonts."));
if (ShowToolTips())
m_symbolFontCtrl->SetToolTip(_("Available fonts."));
itemBoxSizer11->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
@ -205,17 +202,26 @@ void wxRichTextBulletsPage::CreateControls()
wxStaticText* itemStaticText23 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, _("&Number:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer22->Add(itemStaticText23, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_numberCtrl = new wxSpinCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, _T("0"), wxDefaultPosition, wxSize(50, wxDefaultCoord), wxSP_ARROW_KEYS, 0, 100000, 0 );
m_numberCtrl = new wxSpinCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, _T("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 100000, 0 );
m_numberCtrl->SetHelpText(_("The list item number."));
if (ShowToolTips())
m_numberCtrl->SetToolTip(_("The list item number."));
itemBoxSizer22->Add(m_numberCtrl, 0, wxGROW|wxALL, 5);
itemBoxSizer22->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_parenthesesCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, _("&Parentheses"), wxDefaultPosition, wxDefaultSize, 0 );
m_parenthesesCtrl->SetValue(false);
m_parenthesesCtrl->SetHelpText(_("Check to enclose the bullet in parentheses."));
if (ShowToolTips())
m_parenthesesCtrl->SetToolTip(_("Check to enclose the bullet in parentheses."));
itemBoxSizer22->Add(m_parenthesesCtrl, 0, wxALIGN_LEFT|wxALL, 5);
m_periodCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PERIODCTRL, _("Peri&od"), wxDefaultPosition, wxDefaultSize, 0 );
m_periodCtrl->SetValue(false);
m_periodCtrl->SetHelpText(_("Check to add a period after the bullet."));
if (ShowToolTips())
m_periodCtrl->SetToolTip(_("Check to add a period after the bullet."));
itemBoxSizer22->Add(m_periodCtrl, 0, wxALIGN_LEFT|wxALL, 5);
itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
@ -243,9 +249,7 @@ void wxRichTextBulletsPage::CreateControls()
m_symbolCtrl->Append(_("+"));
m_symbolCtrl->Append(_("~"));
wxFontEnumerator enumerator;
enumerator.EnumerateFacenames();
wxArrayString facenames = enumerator.GetFacenames();
wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
facenames.Sort();
m_symbolFontCtrl->Append(facenames);
@ -388,16 +392,26 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
font.SetPointSize(9);
m_previewCtrl->SetFont(font);
font.SetWeight(wxBOLD);
attr.SetFont(font);
wxTextAttrEx normalParaAttr;
normalParaAttr.SetFont(font);
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
m_previewCtrl->Freeze();
m_previewCtrl->Clear();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para1);
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(attr);
m_previewCtrl->WriteText(s_para2);
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para3);
m_previewCtrl->EndStyle();
m_previewCtrl->Thaw();
}
wxTextAttrEx* wxRichTextBulletsPage::GetAttributes()
@ -411,7 +425,7 @@ wxTextAttrEx* wxRichTextBulletsPage::GetAttributes()
bool wxRichTextBulletsPage::ShowToolTips()
{
return true;
return wxRichTextFormattingDialog::ShowToolTips();
}
/*!

View File

@ -31,6 +31,7 @@
#include "wx/filename.h"
#include "wx/dcbuffer.h"
#include "wx/arrimpl.cpp"
#include "wx/fontenum.h"
// DLL options compatibility check:
#include "wx/app.h"
@ -91,6 +92,8 @@ END_EVENT_TABLE()
* wxRichTextCtrl
*/
wxArrayString wxRichTextCtrl::sm_availableFontNames;
wxRichTextCtrl::wxRichTextCtrl()
: wxScrollHelper(this)
{
@ -123,6 +126,9 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
GetBuffer().SetRichTextCtrl(this);
if (style & wxTE_READONLY)
SetEditable(false);
wxTextAttrEx attributes;
attributes.SetFont(GetFont());
attributes.SetTextColour(*wxBLACK);
@ -638,6 +644,27 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
event.Skip();
return;
}
if (keycode == wxT('\t'))
{
// See if we need to promote or demote the selection or paragraph at the cursor
// position, instead of inserting a tab.
long pos = GetAdjustedCaretPosition(GetCaretPosition());
wxRichTextParagraph* para = GetBuffer().GetParagraphAtPosition(pos);
if (para && para->GetRange().GetStart() == pos && para->GetAttributes().HasListStyleName())
{
wxRichTextRange range;
if (HasSelection())
range = GetSelectionRange();
else
range = para->GetRange().FromInternal();
int promoteBy = event.ShiftDown() ? 1 : -1;
PromoteList(promoteBy, range, NULL);
return;
}
}
BeginBatchUndo(_("Insert Text"));
@ -2908,6 +2935,21 @@ bool wxRichTextCtrl::PromoteList(int promoteBy, const wxRichTextRange& range, co
return GetBuffer().PromoteList(promoteBy, range.ToInternal(), defName, flags, specifiedLevel);
}
const wxArrayString& wxRichTextCtrl::GetAvailableFontNames()
{
if (sm_availableFontNames.GetCount() == 0)
{
sm_availableFontNames = wxFontEnumerator::GetFacenames();
sm_availableFontNames.Sort();
}
return sm_availableFontNames;
}
void wxRichTextCtrl::ClearAvailableFontNames()
{
sm_availableFontNames.Clear();
}
#endif
// wxUSE_RICHTEXT

View File

@ -483,7 +483,7 @@ void wxRichTextFontPage::UpdatePreview()
bool wxRichTextFontPage::ShowToolTips()
{
return true;
return wxRichTextFormattingDialog::ShowToolTips();
}
/*!

View File

@ -38,7 +38,6 @@
#include "wx/bookctrl.h"
#include "wx/colordlg.h"
#include "wx/fontenum.h"
#include "wx/settings.h"
#include "wx/module.h"
#include "wx/imaglist.h"
@ -52,12 +51,14 @@
#include "../../src/richtext/richtexttabspage.cpp"
#include "../../src/richtext/richtextbulletspage.cpp"
#include "../../src/richtext/richtextstylepage.cpp"
#include "../../src/richtext/richtextliststylepage.cpp"
#else
#include "richtextfontpage.cpp"
#include "richtextindentspage.cpp"
#include "richtexttabspage.cpp"
#include "richtextbulletspage.cpp"
#include "richtextstylepage.cpp"
#include "richtextliststylepage.cpp"
#endif
#if 0 // def __WXMAC__
@ -66,6 +67,8 @@
#define wxRICHTEXT_USE_TOOLBOOK false
#endif
bool wxRichTextFormattingDialog::sm_showToolTips = false;
IMPLEMENT_CLASS(wxRichTextFormattingDialog, wxPropertySheetDialog)
BEGIN_EVENT_TABLE(wxRichTextFormattingDialog, wxPropertySheetDialog)
@ -287,6 +290,12 @@ wxPanel* wxRichTextFormattingDialogFactory::CreatePage(int page, wxString& title
title = _("Bullets");
return page;
}
else if (page == wxRICHTEXT_FORMAT_LIST_STYLE)
{
wxRichTextListStylePage* page = new wxRichTextListStylePage(dialog->GetBookCtrl(), wxID_ANY);
title = _("List Style");
return page;
}
else
return NULL;
}
@ -299,9 +308,10 @@ int wxRichTextFormattingDialogFactory::GetPageId(int i) const
wxRICHTEXT_FORMAT_FONT,
wxRICHTEXT_FORMAT_INDENTS_SPACING,
wxRICHTEXT_FORMAT_BULLETS,
wxRICHTEXT_FORMAT_TABS };
wxRICHTEXT_FORMAT_TABS,
wxRICHTEXT_FORMAT_LIST_STYLE };
if (i < 0 || i > 4)
if (i < 0 || i > 5)
return -1;
return pages[i];
@ -310,7 +320,7 @@ int wxRichTextFormattingDialogFactory::GetPageId(int i) const
/// Get the number of available page identifiers
int wxRichTextFormattingDialogFactory::GetPageIdCount() const
{
return 5;
return 6;
}
/// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create
@ -342,7 +352,8 @@ bool wxRichTextFormattingDialogFactory::CreateButtons(wxRichTextFormattingDialog
// If using a toolbook, also follow Mac style and don't create buttons
int flags = wxOK|wxCANCEL;
#ifndef __WXWINCE__
flags |= wxHELP;
if (dialog->GetWindowStyleFlag() & wxRICHTEXT_FORMAT_HELP_BUTTON)
flags |= wxHELP;
#endif
if (!useToolBook)
@ -541,9 +552,7 @@ int wxRichTextFontListBox::SetFaceNameSelection(const wxString& name)
/// Updates the font list
void wxRichTextFontListBox::UpdateFonts()
{
wxFontEnumerator enumerator;
enumerator.EnumerateFacenames();
wxArrayString facenames = enumerator.GetFacenames();
wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
m_faceNames = facenames;
m_faceNames.Sort();

View File

@ -145,22 +145,37 @@ void wxRichTextIndentsSpacingPage::CreateControls()
m_alignmentLeft = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT, _("&Left"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_alignmentLeft->SetValue(false);
m_alignmentLeft->SetHelpText(_("Left-align text."));
if (ShowToolTips())
m_alignmentLeft->SetToolTip(_("Left-align text."));
itemBoxSizer9->Add(m_alignmentLeft, 0, wxALIGN_LEFT|wxALL, 5);
m_alignmentRight = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT, _("&Right"), wxDefaultPosition, wxDefaultSize, 0 );
m_alignmentRight->SetValue(false);
m_alignmentRight->SetHelpText(_("Right-align text."));
if (ShowToolTips())
m_alignmentRight->SetToolTip(_("Right-align text."));
itemBoxSizer9->Add(m_alignmentRight, 0, wxALIGN_LEFT|wxALL, 5);
m_alignmentJustified = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED, _("&Justified"), wxDefaultPosition, wxDefaultSize, 0 );
m_alignmentJustified->SetValue(false);
m_alignmentJustified->SetHelpText(_("Justify text left and right."));
if (ShowToolTips())
m_alignmentJustified->SetToolTip(_("Justify text left and right."));
itemBoxSizer9->Add(m_alignmentJustified, 0, wxALIGN_LEFT|wxALL, 5);
m_alignmentCentred = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED, _("Cen&tred"), wxDefaultPosition, wxDefaultSize, 0 );
m_alignmentCentred->SetValue(false);
m_alignmentCentred->SetHelpText(_("Centre text."));
if (ShowToolTips())
m_alignmentCentred->SetToolTip(_("Centre text."));
itemBoxSizer9->Add(m_alignmentCentred, 0, wxALIGN_LEFT|wxALL, 5);
m_alignmentIndeterminate = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE, _("&Indeterminate"), wxDefaultPosition, wxDefaultSize, 0 );
m_alignmentIndeterminate->SetValue(false);
m_alignmentIndeterminate->SetHelpText(_("Use the current alignment setting."));
if (ShowToolTips())
m_alignmentIndeterminate->SetToolTip(_("Use the current alignment setting."));
itemBoxSizer9->Add(m_alignmentIndeterminate, 0, wxALIGN_LEFT|wxALL, 5);
itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
@ -190,12 +205,10 @@ void wxRichTextIndentsSpacingPage::CreateControls()
wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
m_indentLeft = new wxTextCtrl( itemPanel1,
ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT,
wxEmptyString,
wxDefaultPosition,
wxSize(50, wxDefaultCoord),
0 );
m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
m_indentLeft->SetHelpText(_("The left indent."));
if (ShowToolTips())
m_indentLeft->SetToolTip(_("The left indent."));
itemBoxSizer24->Add(m_indentLeft, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText26 = new wxStaticText( itemPanel1, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 );
@ -204,12 +217,10 @@ void wxRichTextIndentsSpacingPage::CreateControls()
wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
m_indentLeftFirst = new wxTextCtrl( itemPanel1,
ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST,
wxEmptyString,
wxDefaultPosition,
wxSize(50, wxDefaultCoord),
0 );
m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
m_indentLeftFirst->SetHelpText(_("The first line indent."));
if (ShowToolTips())
m_indentLeftFirst->SetToolTip(_("The first line indent."));
itemBoxSizer27->Add(m_indentLeftFirst, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText29 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 );
@ -218,12 +229,10 @@ void wxRichTextIndentsSpacingPage::CreateControls()
wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer22->Add(itemBoxSizer30, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
m_indentRight = new wxTextCtrl( itemPanel1,
ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT,
wxEmptyString,
wxDefaultPosition,
wxSize(50, wxDefaultCoord),
0 );
m_indentRight = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
m_indentRight->SetHelpText(_("The right indent."));
if (ShowToolTips())
m_indentRight->SetToolTip(_("The right indent."));
itemBoxSizer30->Add(m_indentRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
@ -253,12 +262,10 @@ void wxRichTextIndentsSpacingPage::CreateControls()
wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer39->Add(itemBoxSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
m_spacingBefore = new wxTextCtrl( itemPanel1,
ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE,
wxEmptyString,
wxDefaultPosition,
wxSize(50, wxDefaultCoord),
0 );
m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
if (ShowToolTips())
m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
itemBoxSizer41->Add(m_spacingBefore, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText43 = new wxStaticText( itemPanel1, wxID_STATIC, _("After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
@ -267,12 +274,9 @@ void wxRichTextIndentsSpacingPage::CreateControls()
wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL);
itemFlexGridSizer39->Add(itemBoxSizer44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
m_spacingAfter = new wxTextCtrl( itemPanel1,
ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER,
wxEmptyString,
wxDefaultPosition,
wxSize(50, wxDefaultCoord),
0 );
m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
if (ShowToolTips())
m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
itemBoxSizer44->Add(m_spacingAfter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText46 = new wxStaticText( itemPanel1, wxID_STATIC, _("Line spacing:"), wxDefaultPosition, wxDefaultSize, 0 );
@ -288,6 +292,9 @@ void wxRichTextIndentsSpacingPage::CreateControls()
};
m_spacingLine = new wxComboBox( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE, _("Single"), wxDefaultPosition, wxDefaultSize, 3, m_spacingLineStrings, wxCB_READONLY );
m_spacingLine->SetStringSelection(_("Single"));
m_spacingLine->SetHelpText(_("The line spacing."));
if (ShowToolTips())
m_spacingLine->SetToolTip(_("The line spacing."));
itemBoxSizer47->Add(m_spacingLine, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
@ -329,16 +336,26 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
font.SetPointSize(9);
m_previewCtrl->SetFont(font);
font.SetWeight(wxBOLD);
attr.SetFont(font);
wxTextAttrEx normalParaAttr;
normalParaAttr.SetFont(font);
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
m_previewCtrl->Freeze();
m_previewCtrl->Clear();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para1);
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(attr);
m_previewCtrl->WriteText(s_para2);
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para3);
m_previewCtrl->EndStyle();
m_previewCtrl->Thaw();
}
/// Transfer data from/to window
@ -509,7 +526,7 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow()
bool wxRichTextIndentsSpacingPage::ShowToolTips()
{
return true;
return wxRichTextFormattingDialog::ShowToolTips();
}
/*!

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,857 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextstyledlg.cpp
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 10/5/2006 12:05:31 PM
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
////@end includes
#include "wx/richtext/richtextstyledlg.h"
#include "wx/richtext/richtextformatdlg.h"
////@begin XPM images
////@end XPM images
/*!
* wxRichTextStyleOrganiserDialog type definition
*/
bool wxRichTextStyleOrganiserDialog::sm_showToolTips = false;
IMPLEMENT_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog, wxDialog )
/*!
* wxRichTextStyleOrganiserDialog event table definition
*/
BEGIN_EVENT_TABLE( wxRichTextStyleOrganiserDialog, wxDialog )
EVT_LISTBOX(wxID_ANY, wxRichTextStyleOrganiserDialog::OnListSelection)
////@begin wxRichTextStyleOrganiserDialog event table entries
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR, wxRichTextStyleOrganiserDialog::OnNewCharClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR, wxRichTextStyleOrganiserDialog::OnNewCharUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA, wxRichTextStyleOrganiserDialog::OnNewParaClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA, wxRichTextStyleOrganiserDialog::OnNewParaUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, wxRichTextStyleOrganiserDialog::OnNewListClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, wxRichTextStyleOrganiserDialog::OnNewListUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, wxRichTextStyleOrganiserDialog::OnApplyClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, wxRichTextStyleOrganiserDialog::OnApplyUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME, wxRichTextStyleOrganiserDialog::OnRenameClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME, wxRichTextStyleOrganiserDialog::OnRenameUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT, wxRichTextStyleOrganiserDialog::OnEditClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT, wxRichTextStyleOrganiserDialog::OnEditUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE, wxRichTextStyleOrganiserDialog::OnDeleteClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE, wxRichTextStyleOrganiserDialog::OnDeleteUpdate )
////@end wxRichTextStyleOrganiserDialog event table entries
END_EVENT_TABLE()
/*!
* wxRichTextStyleOrganiserDialog constructors
*/
wxRichTextStyleOrganiserDialog::wxRichTextStyleOrganiserDialog( )
{
Init();
}
wxRichTextStyleOrganiserDialog::wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Init();
Create(flags, sheet, ctrl, parent, id, caption, pos, size, style);
}
/*!
* Member initialisation for wxSymbolPickerDialog
*/
void wxRichTextStyleOrganiserDialog::Init()
{
m_richTextStyleSheet = NULL;
m_richTextCtrl = NULL;
m_dontUpdate = NULL;
m_flags = 0;
m_restartNumbering = true;
////@begin wxRichTextStyleOrganiserDialog member initialisation
m_innerSizer = NULL;
m_buttonSizerParent = NULL;
m_stylesListBox = NULL;
m_previewCtrl = NULL;
m_buttonSizer = NULL;
m_newCharacter = NULL;
m_newParagraph = NULL;
m_newList = NULL;
m_applyStyle = NULL;
m_renameStyle = NULL;
m_editStyle = NULL;
m_deleteStyle = NULL;
m_closeButton = NULL;
m_bottomButtonSizer = NULL;
m_restartNumberingCtrl = NULL;
m_okButton = NULL;
m_cancelButton = NULL;
////@end wxRichTextStyleOrganiserDialog member initialisation
}
/*!
* wxRichTextStyleOrganiserDialog creator
*/
bool wxRichTextStyleOrganiserDialog::Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
m_richTextStyleSheet = sheet;
m_richTextCtrl = ctrl;
m_flags = flags;
////@begin wxRichTextStyleOrganiserDialog creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS|wxDIALOG_EX_CONTEXTHELP);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end wxRichTextStyleOrganiserDialog creation
return true;
}
/*!
* Control creation for wxRichTextStyleOrganiserDialog
*/
void wxRichTextStyleOrganiserDialog::CreateControls()
{
bool hideTypeSelector = false;
wxRichTextStyleListBox::wxRichTextStyleType typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL;
if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_CHARACTER) != 0)
{
typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER;
hideTypeSelector = true;
}
else if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH) != 0)
{
typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH;
hideTypeSelector = true;
}
else if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_LIST) != 0)
{
typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST;
hideTypeSelector = true;
}
else
{
// wxRICHTEXT_ORGANISER_SHOW_ALL is implied if the other styles aren't included
}
long listCtrlStyle = 0;
if (hideTypeSelector)
listCtrlStyle = wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR;
////@begin wxRichTextStyleOrganiserDialog content construction
wxRichTextStyleOrganiserDialog* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
m_innerSizer = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(m_innerSizer, 1, wxGROW|wxALL, 5);
m_buttonSizerParent = new wxBoxSizer(wxHORIZONTAL);
m_innerSizer->Add(m_buttonSizerParent, 1, wxGROW, 5);
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
m_buttonSizerParent->Add(itemBoxSizer5, 1, wxGROW, 5);
wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Styles:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_stylesListBox = new wxRichTextStyleListCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES, wxDefaultPosition, wxSize(200, 350), wxSIMPLE_BORDER|listCtrlStyle );
m_stylesListBox->SetHelpText(_("The available styles."));
if (ShowToolTips())
m_stylesListBox->SetToolTip(_("The available styles."));
itemBoxSizer5->Add(m_stylesListBox, 1, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
m_buttonSizerParent->Add(itemBoxSizer8, 0, wxGROW, 5);
wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, wxID_STATIC, _(" "), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(itemStaticText9, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_previewCtrl = new wxRichTextCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW, wxEmptyString, wxDefaultPosition, wxSize(310, 200), wxSIMPLE_BORDER|wxTE_READONLY );
m_previewCtrl->SetHelpText(_("The style preview."));
if (ShowToolTips())
m_previewCtrl->SetToolTip(_("The style preview."));
itemBoxSizer8->Add(m_previewCtrl, 1, wxGROW|wxALL, 5);
m_buttonSizer = new wxBoxSizer(wxVERTICAL);
m_buttonSizerParent->Add(m_buttonSizer, 0, wxGROW, 5);
wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _(" "), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonSizer->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_newCharacter = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR, _("New &Character Style..."), wxDefaultPosition, wxDefaultSize, 0 );
m_newCharacter->SetHelpText(_("Click to create a new character style."));
if (ShowToolTips())
m_newCharacter->SetToolTip(_("Click to create a new character style."));
m_buttonSizer->Add(m_newCharacter, 0, wxGROW|wxALL, 5);
m_newParagraph = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA, _("New &Paragraph Style..."), wxDefaultPosition, wxDefaultSize, 0 );
m_newParagraph->SetHelpText(_("Click to create a new paragraph style."));
if (ShowToolTips())
m_newParagraph->SetToolTip(_("Click to create a new paragraph style."));
m_buttonSizer->Add(m_newParagraph, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_newList = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, _("New &List Style..."), wxDefaultPosition, wxDefaultSize, 0 );
m_newList->SetHelpText(_("Click to create a new list style."));
if (ShowToolTips())
m_newList->SetToolTip(_("Click to create a new list style."));
m_buttonSizer->Add(m_newList, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_buttonSizer->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_applyStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, _("&Apply Style"), wxDefaultPosition, wxDefaultSize, 0 );
m_applyStyle->SetHelpText(_("Click to apply the selected style."));
if (ShowToolTips())
m_applyStyle->SetToolTip(_("Click to apply the selected style."));
m_buttonSizer->Add(m_applyStyle, 0, wxGROW|wxALL, 5);
m_renameStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME, _("&Rename Style..."), wxDefaultPosition, wxDefaultSize, 0 );
m_renameStyle->SetHelpText(_("Click to rename the selected style."));
if (ShowToolTips())
m_renameStyle->SetToolTip(_("Click to rename the selected style."));
m_buttonSizer->Add(m_renameStyle, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_editStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT, _("&Edit Style..."), wxDefaultPosition, wxDefaultSize, 0 );
m_editStyle->SetHelpText(_("Click to edit the selected style."));
if (ShowToolTips())
m_editStyle->SetToolTip(_("Click to edit the selected style."));
m_buttonSizer->Add(m_editStyle, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_deleteStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE, _("&Delete Style..."), wxDefaultPosition, wxDefaultSize, 0 );
m_deleteStyle->SetHelpText(_("Click to delete the selected style."));
if (ShowToolTips())
m_deleteStyle->SetToolTip(_("Click to delete the selected style."));
m_buttonSizer->Add(m_deleteStyle, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_buttonSizer->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_closeButton = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
m_closeButton->SetDefault();
m_closeButton->SetHelpText(_("Click to close this window."));
if (ShowToolTips())
m_closeButton->SetToolTip(_("Click to close this window."));
m_buttonSizer->Add(m_closeButton, 0, wxGROW|wxALL, 5);
m_bottomButtonSizer = new wxBoxSizer(wxHORIZONTAL);
m_innerSizer->Add(m_bottomButtonSizer, 0, wxGROW, 5);
m_restartNumberingCtrl = new wxCheckBox( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING, _("&Restart numbering"), wxDefaultPosition, wxDefaultSize, 0 );
m_restartNumberingCtrl->SetValue(false);
m_restartNumberingCtrl->SetHelpText(_("Check to restart numbering."));
if (ShowToolTips())
m_restartNumberingCtrl->SetToolTip(_("Check to restart numbering."));
m_bottomButtonSizer->Add(m_restartNumberingCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_bottomButtonSizer->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_okButton = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_okButton->SetDefault();
m_okButton->SetHelpText(_("Click to confirm your selection."));
if (ShowToolTips())
m_okButton->SetToolTip(_("Click to confirm your selection."));
m_bottomButtonSizer->Add(m_okButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_cancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_cancelButton->SetHelpText(_("Click to cancel this window."));
if (ShowToolTips())
m_cancelButton->SetToolTip(_("Click to cancel this window."));
m_bottomButtonSizer->Add(m_cancelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
////@end wxRichTextStyleOrganiserDialog content construction
if ((m_flags & wxRICHTEXT_ORGANISER_CREATE_STYLES) == 0)
{
m_buttonSizer->Show(m_newCharacter, false);
m_buttonSizer->Show(m_newParagraph, false);
m_buttonSizer->Show(m_newList, false);
}
if ((m_flags & wxRICHTEXT_ORGANISER_DELETE_STYLES) == 0)
{
m_buttonSizer->Show(m_deleteStyle, false);
}
if ((m_flags & wxRICHTEXT_ORGANISER_APPLY_STYLES) == 0)
{
m_buttonSizer->Show(m_applyStyle, false);
}
if ((m_flags & wxRICHTEXT_ORGANISER_EDIT_STYLES) == 0)
{
m_buttonSizer->Show(m_editStyle, false);
}
if ((m_flags & wxRICHTEXT_ORGANISER_RENAME_STYLES) == 0)
{
m_buttonSizer->Show(m_renameStyle, false);
}
if ((m_flags & wxRICHTEXT_ORGANISER_RENUMBER) == 0)
{
m_bottomButtonSizer->Show(m_restartNumberingCtrl, false);
}
if ((m_flags & wxRICHTEXT_ORGANISER_OK_CANCEL) == 0)
{
m_bottomButtonSizer->Show(m_okButton, false);
m_bottomButtonSizer->Show(m_cancelButton, false);
}
else
{
m_buttonSizer->Show(m_closeButton, false);
}
// No buttons in the vertical group are shown, so hide the whole sizer
if ((m_flags & wxRICHTEXT_ORGANISER_ORGANISE) == 0)
{
m_buttonSizerParent->Show(m_buttonSizer, false);
}
// No buttons in the horizontal group are shown, so hide the whole sizer
if ((m_flags & (wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)) == 0)
{
m_innerSizer->Show(m_bottomButtonSizer, false);
}
if (hideTypeSelector)
{
m_stylesListBox->GetStyleListBox()->SetStyleType(typesToShow);
}
m_stylesListBox->SetStyleSheet(m_richTextStyleSheet);
m_stylesListBox->SetRichTextCtrl(m_richTextCtrl);
m_stylesListBox->UpdateStyles();
m_stylesListBox->GetStyleListBox()->SetAutoSetSelection(false); // stop idle-time auto selection
if (m_stylesListBox->GetStyleListBox()->GetItemCount() > 0)
{
m_stylesListBox->GetStyleListBox()->SetSelection(0);
ShowPreview();
}
}
/*!
* Should we show tooltips?
*/
/// Get selected style name or definition
wxString wxRichTextStyleOrganiserDialog::GetSelectedStyle() const
{
wxRichTextStyleDefinition* def = GetSelectedStyleDefinition();
if (def)
return def->GetName();
else
return wxEmptyString;
}
wxRichTextStyleDefinition* wxRichTextStyleOrganiserDialog::GetSelectedStyleDefinition() const
{
int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
return m_stylesListBox->GetStyleListBox()->GetStyle(sel);
}
/// Transfer data from/to window
bool wxRichTextStyleOrganiserDialog::TransferDataFromWindow()
{
if (!wxDialog::TransferDataFromWindow())
return false;
m_restartNumbering = m_restartNumberingCtrl->GetValue();
return true;
}
bool wxRichTextStyleOrganiserDialog::TransferDataToWindow()
{
if (!wxDialog::TransferDataToWindow())
return false;
m_restartNumberingCtrl->SetValue(m_restartNumbering);
return true;
}
/// Show preview for given or selected preview
void wxRichTextStyleOrganiserDialog::ShowPreview(int sel)
{
static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.");
static const wxChar* s_para2List = wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.");
static const wxChar* s_para2 = wxT("Duis pharetra consequat dui. Cum sociis natoque penatibus \
et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.");
static const wxChar* s_para3 = wxT("\nInteger convallis dolor at augue \
iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
if (sel == -1)
{
sel = m_stylesListBox->GetStyleListBox()->GetSelection();
if (sel == -1)
return;
}
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
//wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition);
//wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition);
wxTextAttrEx attr(def->GetStyle());
#if 0
attr.SetFlags(attr.GetFlags() &
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
wxTEXT_ATTR_LINE_SPACING|
wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_SYMBOL));
#endif
wxFont font(m_previewCtrl->GetFont());
font.SetPointSize(9);
m_previewCtrl->SetFont(font);
wxTextAttrEx normalParaAttr;
normalParaAttr.SetFont(font);
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
m_previewCtrl->Freeze();
m_previewCtrl->Clear();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para1);
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(attr);
if (listDef)
{
int i;
for (i = 0; i < 10; i++)
{
wxTextAttrEx levelAttr = * listDef->GetLevelAttributes(i);
levelAttr.SetBulletNumber(1);
m_previewCtrl->BeginStyle(levelAttr);
m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2List);
m_previewCtrl->EndStyle();
}
}
else
{
m_previewCtrl->WriteText(wxString(wxT("\n")) + s_para2);
}
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para3);
m_previewCtrl->EndStyle();
m_previewCtrl->Thaw();
}
/// Clears the preview
void wxRichTextStyleOrganiserDialog::ClearPreview()
{
m_richTextCtrl->Clear();
}
bool wxRichTextStyleOrganiserDialog::ApplyStyle(wxRichTextCtrl* ctrl)
{
int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
if (sel == -1)
return false;
if (!ctrl)
ctrl = GetRichTextCtrl();
if (!ctrl)
return false;
if (!ctrl->HasSelection())
return false;
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
if (listDef && m_restartNumberingCtrl->GetValue())
{
wxRichTextRange range = ctrl->GetSelectionRange();
return ctrl->SetListStyle(range, listDef, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
}
else
{
return ctrl->ApplyStyle(def);
}
}
/*!
* Get bitmap resources
*/
wxBitmap wxRichTextStyleOrganiserDialog::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin wxRichTextStyleOrganiserDialog bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end wxRichTextStyleOrganiserDialog bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon wxRichTextStyleOrganiserDialog::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin wxRichTextStyleOrganiserDialog icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end wxRichTextStyleOrganiserDialog icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
*/
void wxRichTextStyleOrganiserDialog::OnApplyClick( wxCommandEvent& WXUNUSED(event) )
{
ApplyStyle();
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
*/
void wxRichTextStyleOrganiserDialog::OnApplyUpdate( wxUpdateUIEvent& event )
{
event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_APPLY_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
*/
void wxRichTextStyleOrganiserDialog::OnNewCharClick( wxCommandEvent& WXUNUSED(event) )
{
wxString styleName = wxGetTextFromUser(_("Enter a character style name"), _("New Style"));
if (!styleName.IsEmpty())
{
if (GetStyleSheet()->FindCharacterStyle(styleName))
{
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
}
wxRichTextCharacterStyleDefinition* style = new wxRichTextCharacterStyleDefinition(styleName);
int pages = wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_STYLE_EDITOR;
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*style, GetStyleSheet());
formatDlg.Create(pages, this);
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition);
(*((wxRichTextCharacterStyleDefinition* ) style)) = (*charDef);
GetStyleSheet()->AddCharacterStyle(style);
m_stylesListBox->UpdateStyles();
ShowPreview();
}
else
delete style;
}
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
*/
void wxRichTextStyleOrganiserDialog::OnNewCharUpdate( wxUpdateUIEvent& event )
{
event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
*/
void wxRichTextStyleOrganiserDialog::OnNewParaClick( wxCommandEvent& WXUNUSED(event) )
{
wxString styleName = wxGetTextFromUser(_("Enter a paragraph style name"), _("New Style"));
if (!styleName.IsEmpty())
{
if (GetStyleSheet()->FindParagraphStyle(styleName))
{
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
}
wxRichTextParagraphStyleDefinition* style = new wxRichTextParagraphStyleDefinition(styleName);
int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*style, GetStyleSheet());
formatDlg.Create(pages, this);
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition);
(*((wxRichTextParagraphStyleDefinition* ) style)) = (*paraDef);
GetStyleSheet()->AddParagraphStyle(style);
m_stylesListBox->UpdateStyles();
ShowPreview();
}
else
delete style;
}
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
*/
void wxRichTextStyleOrganiserDialog::OnNewParaUpdate( wxUpdateUIEvent& event )
{
event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
*/
void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event) )
{
int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
if (sel != wxNOT_FOUND)
{
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR;
if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
{
pages |= wxRICHTEXT_FORMAT_FONT;
}
else if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
{
pages |= wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING;
}
else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
{
pages |= wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
}
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*def, GetStyleSheet());
formatDlg.Create(pages, this);
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition);
wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition);
if (listDef)
{
(*((wxRichTextListStyleDefinition* ) def)) = (*listDef);
}
else if (paraDef)
{
(*((wxRichTextParagraphStyleDefinition* ) def)) = (*paraDef);
}
else
{
(*((wxRichTextCharacterStyleDefinition* ) def)) = (*charDef);
}
m_stylesListBox->UpdateStyles();
ShowPreview();
}
}
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
*/
void wxRichTextStyleOrganiserDialog::OnEditUpdate( wxUpdateUIEvent& event )
{
event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_EDIT_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
*/
void wxRichTextStyleOrganiserDialog::OnDeleteClick( wxCommandEvent& WXUNUSED(event) )
{
int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
if (sel != wxNOT_FOUND)
{
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxString name(def->GetName());
if (wxYES == wxMessageBox(wxString::Format(_("Delete style %s?"), (const wxChar*) name), _("Delete Style"), wxYES_NO|wxICON_QUESTION, this))
{
m_stylesListBox->GetStyleListBox()->SetItemCount(0);
if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true);
m_stylesListBox->UpdateStyles();
if (m_stylesListBox->GetStyleListBox()->GetSelection() != -1)
ShowPreview();
else
ClearPreview();
}
}
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
*/
void wxRichTextStyleOrganiserDialog::OnDeleteUpdate( wxUpdateUIEvent& event )
{
event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_DELETE_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
*/
void wxRichTextStyleOrganiserDialog::OnNewListClick( wxCommandEvent& WXUNUSED(event) )
{
wxString styleName = wxGetTextFromUser(_("Enter a list style name"), _("New Style"));
if (!styleName.IsEmpty())
{
if (GetStyleSheet()->FindListStyle(styleName))
{
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
}
wxRichTextListStyleDefinition* style = new wxRichTextListStyleDefinition(styleName);
// Initialize the style to make it easier to edit
int i;
for (i = 0; i < 10; i++)
{
wxString bulletSymbol;
if (i == 0)
bulletSymbol = wxT("*");
else if (i == 1)
bulletSymbol = wxT("-");
else if (i == 2)
bulletSymbol = wxT("*");
else if (i == 3)
bulletSymbol = wxT("-");
else
bulletSymbol = wxT("*");
style->SetAttributes(i, (i+1)*60, 60, wxTEXT_ATTR_BULLET_STYLE_SYMBOL, bulletSymbol);
}
int pages = wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING;
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*style, GetStyleSheet());
formatDlg.Create(pages, this);
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition);
(*((wxRichTextListStyleDefinition* ) style)) = (*listDef);
GetStyleSheet()->AddListStyle(style);
m_stylesListBox->UpdateStyles();
ShowPreview();
}
else
delete style;
}
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
*/
void wxRichTextStyleOrganiserDialog::OnNewListUpdate( wxUpdateUIEvent& event )
{
event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
*/
void wxRichTextStyleOrganiserDialog::OnRenameClick( wxCommandEvent& WXUNUSED(event) )
{
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
*/
void wxRichTextStyleOrganiserDialog::OnRenameUpdate( wxUpdateUIEvent& event )
{
event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_RENAME_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
}
/// List selection
void wxRichTextStyleOrganiserDialog::OnListSelection(wxCommandEvent& event)
{
if (event.GetEventObject() == m_stylesListBox->GetStyleListBox())
ShowPreview();
else
event.Skip();
}

View File

@ -103,40 +103,30 @@ void wxRichTextStylePage::CreateControls()
wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Style:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_styleName = new wxTextCtrl( itemPanel1,
ID_RICHTEXTSTYLEPAGE_STYLE_NAME,
wxEmptyString,
wxDefaultPosition,
wxSize(300, wxDefaultCoord),
0 );
m_styleName = new wxTextCtrl( itemPanel1, ID_RICHTEXTSTYLEPAGE_STYLE_NAME, _T(""), wxDefaultPosition, wxSize(300, -1), wxTE_READONLY );
m_styleName->SetHelpText(_("The style name."));
if (ShowToolTips())
m_styleName->SetToolTip(_("The style name."));
itemBoxSizer5->Add(m_styleName, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Based on:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_basedOnStrings = NULL;
m_basedOn = new wxComboBox( itemPanel1,
ID_RICHTEXTSTYLEPAGE_BASED_ON,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
0,
m_basedOnStrings,
wxCB_DROPDOWN );
m_basedOn = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_BASED_ON, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_basedOnStrings, wxCB_DROPDOWN );
m_basedOn->SetHelpText(_("The style on which this style is based."));
if (ShowToolTips())
m_basedOn->SetToolTip(_("The style on which this style is based."));
itemBoxSizer5->Add(m_basedOn, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Next style:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxString* m_nextStyleStrings = NULL;
m_nextStyle = new wxComboBox( itemPanel1,
ID_RICHTEXTSTYLEPAGE_NEXT_STYLE,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
0,
m_nextStyleStrings,
wxCB_DROPDOWN );
m_nextStyle = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_NEXT_STYLE, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_nextStyleStrings, wxCB_DROPDOWN );
m_nextStyle->SetHelpText(_("The default style for the next paragraph."));
if (ShowToolTips())
m_nextStyle->SetToolTip(_("The default style for the next paragraph."));
itemBoxSizer5->Add(m_nextStyle, 0, wxGROW|wxALL, 5);
itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
@ -150,12 +140,15 @@ bool wxRichTextStylePage::TransferDataFromWindow()
wxPanel::TransferDataFromWindow();
wxRichTextStyleDefinition* def = wxRichTextFormattingDialog::GetDialogStyleDefinition(this);
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition);
if (paraDef)
paraDef->SetNextStyle(m_nextStyle->GetValue());
def->SetName(m_styleName->GetValue());
def->SetBaseStyle(m_basedOn->GetValue());
if (def)
{
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition);
if (paraDef)
paraDef->SetNextStyle(m_nextStyle->GetValue());
def->SetName(m_styleName->GetValue());
def->SetBaseStyle(m_basedOn->GetValue());
}
return true;
}
@ -165,58 +158,90 @@ bool wxRichTextStylePage::TransferDataToWindow()
wxPanel::TransferDataToWindow();
wxRichTextStyleDefinition* def = wxRichTextFormattingDialog::GetDialogStyleDefinition(this);
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition);
wxRichTextStyleSheet* sheet = wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
m_styleName->SetValue(def->GetName());
if (paraDef)
if (def)
{
if (m_nextStyle->GetCount() == 0)
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
// wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition);
wxRichTextStyleSheet* sheet = wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
m_styleName->SetValue(def->GetName());
if (listDef)
{
if (m_nextStyle->GetCount() == 0)
{
if (sheet)
{
size_t i;
for (i = 0; i < sheet->GetListStyleCount(); i++)
{
wxRichTextListStyleDefinition* p = wxDynamicCast(sheet->GetListStyle(i), wxRichTextListStyleDefinition);
if (p)
m_nextStyle->Append(p->GetName());
}
}
}
m_nextStyle->SetValue(listDef->GetNextStyle());
}
else if (paraDef)
{
if (m_nextStyle->GetCount() == 0)
{
if (sheet)
{
size_t i;
for (i = 0; i < sheet->GetParagraphStyleCount(); i++)
{
wxRichTextParagraphStyleDefinition* p = wxDynamicCast(sheet->GetParagraphStyle(i), wxRichTextParagraphStyleDefinition);
if (p)
m_nextStyle->Append(p->GetName());
}
}
}
m_nextStyle->SetValue(paraDef->GetNextStyle());
}
if (m_basedOn->GetCount() == 0)
{
if (sheet)
{
size_t i;
for (i = 0; i < sheet->GetParagraphStyleCount(); i++)
if (listDef)
{
wxRichTextParagraphStyleDefinition* p = wxDynamicCast(sheet->GetParagraphStyle(i), wxRichTextParagraphStyleDefinition);
if (p)
m_nextStyle->Append(p->GetName());
size_t i;
for (i = 0; i < sheet->GetListStyleCount(); i++)
{
wxRichTextListStyleDefinition* p = wxDynamicCast(sheet->GetListStyle(i), wxRichTextListStyleDefinition);
if (p)
m_basedOn->Append(p->GetName());
}
}
else if (paraDef)
{
size_t i;
for (i = 0; i < sheet->GetParagraphStyleCount(); i++)
{
wxRichTextParagraphStyleDefinition* p = wxDynamicCast(sheet->GetParagraphStyle(i), wxRichTextParagraphStyleDefinition);
if (p)
m_basedOn->Append(p->GetName());
}
}
else
{
size_t i;
for (i = 0; i < sheet->GetCharacterStyleCount(); i++)
{
wxRichTextCharacterStyleDefinition* p = wxDynamicCast(sheet->GetCharacterStyle(i), wxRichTextCharacterStyleDefinition);
if (p)
m_basedOn->Append(p->GetName());
}
}
}
}
m_nextStyle->SetValue(paraDef->GetNextStyle());
m_basedOn->SetValue(def->GetBaseStyle());
}
if (m_basedOn->GetCount() == 0)
{
if (sheet)
{
if (paraDef)
{
size_t i;
for (i = 0; i < sheet->GetParagraphStyleCount(); i++)
{
wxRichTextParagraphStyleDefinition* p = wxDynamicCast(sheet->GetParagraphStyle(i), wxRichTextParagraphStyleDefinition);
if (p)
m_basedOn->Append(p->GetName());
}
}
else
{
size_t i;
for (i = 0; i < sheet->GetCharacterStyleCount(); i++)
{
wxRichTextCharacterStyleDefinition* p = wxDynamicCast(sheet->GetCharacterStyle(i), wxRichTextCharacterStyleDefinition);
if (p)
m_basedOn->Append(p->GetName());
}
}
}
}
m_basedOn->SetValue(def->GetBaseStyle());
return true;
}
@ -231,7 +256,7 @@ wxTextAttrEx* wxRichTextStylePage::GetAttributes()
bool wxRichTextStylePage::ShowToolTips()
{
return true;
return wxRichTextFormattingDialog::ShowToolTips();
}
/*!

View File

@ -389,7 +389,6 @@ bool wxRichTextStyleSheet::operator==(const wxRichTextStyleSheet& WXUNUSED(sheet
IMPLEMENT_CLASS(wxRichTextStyleListBox, wxHtmlListBox)
BEGIN_EVENT_TABLE(wxRichTextStyleListBox, wxHtmlListBox)
EVT_LISTBOX(wxID_ANY, wxRichTextStyleListBox::OnSelect)
EVT_LEFT_DOWN(wxRichTextStyleListBox::OnLeftDown)
EVT_LEFT_DCLICK(wxRichTextStyleListBox::OnLeftDoubleClick)
EVT_IDLE(wxRichTextStyleListBox::OnIdle)
@ -464,6 +463,8 @@ void wxRichTextStyleListBox::UpdateStyles()
{
if (GetStyleSheet())
{
SetSelection(wxNOT_FOUND);
if (GetStyleType() == wxRICHTEXT_STYLE_ALL)
SetItemCount(GetStyleSheet()->GetParagraphStyleCount()+GetStyleSheet()->GetCharacterStyleCount()+GetStyleSheet()->GetListStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_PARAGRAPH)
@ -472,7 +473,14 @@ void wxRichTextStyleListBox::UpdateStyles()
SetItemCount(GetStyleSheet()->GetCharacterStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_LIST)
SetItemCount(GetStyleSheet()->GetListStyleCount());
Refresh();
if (GetItemCount() > 0)
{
SetSelection(0);
SendSelectedEvent();
}
}
}
@ -531,10 +539,19 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons
str << wxT("<td nowrap>");
#ifdef __WXMSW__
int size = 3;
#else
int size = 4;
#endif
// Standard size is 12, say
size += (def->GetStyle().HasFont() ? def->GetStyle().GetFontSize() : 12) - 12;
int stdFontSize = 12;
int thisFontSize = ((def->GetStyle().GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0) ? def->GetStyle().GetFontSize() : stdFontSize;
if (thisFontSize < stdFontSize)
size ++;
else if (thisFontSize > stdFontSize)
size --;
str += wxT("<font");
@ -593,18 +610,6 @@ int wxRichTextStyleListBox::ConvertTenthsMMToPixels(wxDC& dc, int units) const
return (int) pixels;
}
/// React to selection
void wxRichTextStyleListBox::OnSelect(wxCommandEvent& WXUNUSED(event))
{
#if 0
wxRichTextStyleDefinition* def = GetStyle(event.GetSelection());
if (def)
{
wxMessageBox(def->GetName());
}
#endif
}
void wxRichTextStyleListBox::OnLeftDown(wxMouseEvent& event)
{
wxVListBox::OnLeftDown(event);
@ -726,27 +731,43 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo
wxControl::Create(parent, id, pos, size, style);
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
if (size != wxDefaultSize)
SetBestFittingSize(size);
m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER);
wxArrayString choices;
choices.Add(_("All styles"));
choices.Add(_("Paragraph styles"));
choices.Add(_("Character styles"));
choices.Add(_("List styles"));
m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, showSelector ? wxSIMPLE_BORDER : wxNO_BORDER);
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5);
SetSizer(boxSizer);
if (showSelector)
{
wxArrayString choices;
choices.Add(_("All styles"));
choices.Add(_("Paragraph styles"));
choices.Add(_("Character styles"));
choices.Add(_("List styles"));
m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5);
}
else
{
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 0);
}
SetSizer(boxSizer);
Layout();
m_dontUpdate = true;
int i = StyleTypeToIndex(m_styleListBox->GetStyleType());
m_styleChoice->SetSelection(i);
if (m_styleChoice)
{
int i = StyleTypeToIndex(m_styleListBox->GetStyleType());
m_styleChoice->SetSelection(i);
}
m_dontUpdate = false;
@ -755,6 +776,7 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo
wxRichTextStyleListCtrl::~wxRichTextStyleListCtrl()
{
}
/// React to style type choice

View File

@ -30,9 +30,11 @@
#include "wx/listbox.h"
#endif
#include "wx/fontenum.h"
#include "wx/dcbuffer.h"
// Only for cached font name
#include "wx/richtext/richtextctrl.h"
/* Microsoft Unicode subset numbering
*/
@ -274,6 +276,8 @@ bool wxSubsetValidForFont(int subsetIndex, FONTSIGNATURE *fontSig)
}
#endif
bool wxSymbolPickerDialog::sm_showToolTips = false;
/*!
* wxSymbolPickerDialog type definition
*/
@ -396,14 +400,10 @@ void wxSymbolPickerDialog::CreateControls()
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
wxString* m_fontCtrlStrings = NULL;
m_fontCtrl = new wxComboBox( itemDialog1,
ID_SYMBOLPICKERDIALOG_FONT,
wxEmptyString,
wxDefaultPosition,
wxSize(240, wxDefaultCoord),
0,
m_fontCtrlStrings,
wxCB_READONLY );
m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, _T(""), wxDefaultPosition, wxSize(240, -1), 0, m_fontCtrlStrings, wxCB_READONLY );
m_fontCtrl->SetHelpText(_("The font from which to take the symbol."));
if (ShowToolTips())
m_fontCtrl->SetToolTip(_("The font from which to take the symbol."));
itemBoxSizer5->Add(m_fontCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer5->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
@ -416,14 +416,7 @@ void wxSymbolPickerDialog::CreateControls()
#if defined(__UNICODE__)
wxString* m_subsetCtrlStrings = NULL;
m_subsetCtrl = new wxComboBox( itemDialog1,
ID_SYMBOLPICKERDIALOG_SUBSET,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
0,
m_subsetCtrlStrings,
wxCB_READONLY );
m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_subsetCtrlStrings, wxCB_READONLY );
m_subsetCtrl->SetHelpText(_("Shows a Unicode subset."));
if (ShowToolTips())
m_subsetCtrl->SetToolTip(_("Shows a Unicode subset."));
@ -437,7 +430,7 @@ void wxSymbolPickerDialog::CreateControls()
wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer3->Add(itemBoxSizer12, 0, wxGROW, 5);
m_symbolStaticCtrl = new wxStaticText( itemDialog1, wxID_STATIC, _("xxxx"), wxDefaultPosition, wxSize(40, wxDefaultCoord), wxALIGN_CENTRE );
m_symbolStaticCtrl = new wxStaticText( itemDialog1, wxID_STATIC, _("xxxx"), wxDefaultPosition, wxSize(40, -1), wxALIGN_CENTRE );
itemBoxSizer12->Add(m_symbolStaticCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
itemBoxSizer12->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
@ -445,12 +438,10 @@ void wxSymbolPickerDialog::CreateControls()
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Character code:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer12->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
m_characterCodeCtrl = new wxTextCtrl( itemDialog1,
ID_SYMBOLPICKERDIALOG_CHARACTERCODE,
wxEmptyString,
wxDefaultPosition,
wxSize(140, wxDefaultCoord),
wxTE_READONLY|wxTE_CENTRE );
m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, _T(""), wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE );
m_characterCodeCtrl->SetHelpText(_("The character code."));
if (ShowToolTips())
m_characterCodeCtrl->SetToolTip(_("The character code."));
itemBoxSizer12->Add(m_characterCodeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer12->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
@ -468,6 +459,9 @@ void wxSymbolPickerDialog::CreateControls()
};
m_fromUnicodeCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FROM, _("ASCII"), wxDefaultPosition, wxDefaultSize, 2, m_fromUnicodeCtrlStrings, wxCB_READONLY );
m_fromUnicodeCtrl->SetStringSelection(_("ASCII"));
m_fromUnicodeCtrl->SetHelpText(_("The range to show."));
if (ShowToolTips())
m_fromUnicodeCtrl->SetToolTip(_("The range to show."));
itemBoxSizer12->Add(m_fromUnicodeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
#endif
@ -525,7 +519,7 @@ bool wxSymbolPickerDialog::TransferDataToWindow()
if (m_fontCtrl->GetCount() == 0)
{
wxArrayString faceNames = wxFontEnumerator::GetFacenames();
wxArrayString faceNames = wxRichTextCtrl::GetAvailableFontNames();
faceNames.Sort();
faceNames.Insert(_("(Normal text)"), 0);
@ -727,15 +721,6 @@ int wxSymbolPickerDialog::GetSymbolChar() const
}
/*!
* Should we show tooltips?
*/
bool wxSymbolPickerDialog::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/

View File

@ -113,16 +113,16 @@ void wxRichTextTabsPage::CreateControls()
wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Position (tenths of a mm):"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_tabEditCtrl = new wxTextCtrl( itemPanel1,
ID_RICHTEXTTABSPAGE_TABEDIT,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
0 );
m_tabEditCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTTABSPAGE_TABEDIT, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
m_tabEditCtrl->SetHelpText(_("The tab position."));
if (ShowToolTips())
m_tabEditCtrl->SetToolTip(_("The tab position."));
itemBoxSizer5->Add(m_tabEditCtrl, 0, wxGROW|wxALL, 5);
wxString* m_tabListCtrlStrings = NULL;
m_tabListCtrl = new wxListBox( itemPanel1, ID_RICHTEXTTABSPAGE_TABLIST, wxDefaultPosition, wxSize(80, 200), 0, m_tabListCtrlStrings, wxLB_SINGLE );
wxString m_tabListCtrlStrings[] = {
_("The tab positions.")
};
m_tabListCtrl = new wxListBox( itemPanel1, ID_RICHTEXTTABSPAGE_TABLIST, wxDefaultPosition, wxSize(80, 200), 1, m_tabListCtrlStrings, wxLB_SINGLE );
itemBoxSizer5->Add(m_tabListCtrl, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
@ -130,21 +130,25 @@ void wxRichTextTabsPage::CreateControls()
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer4->Add(itemBoxSizer10, 0, wxGROW, 5);
wxStaticText* itemStaticText11 = new wxStaticText( itemPanel1,
wxID_STATIC,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
0 );
wxStaticText* itemStaticText11 = new wxStaticText( itemPanel1, wxID_STATIC, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxADJUST_MINSIZE, 5);
wxButton* itemButton12 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_NEW_TAB, _("&New"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton12->SetHelpText(_("Click to create a new tab position."));
if (ShowToolTips())
itemButton12->SetToolTip(_("Click to create a new tab position."));
itemBoxSizer10->Add(itemButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxButton* itemButton13 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_DELETE_TAB, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton13->SetHelpText(_("Click to delete the selected tab position."));
if (ShowToolTips())
itemButton13->SetToolTip(_("Click to delete the selected tab position."));
itemBoxSizer10->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxButton* itemButton14 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS, _("Delete A&ll"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton14->SetHelpText(_("Click to delete all tab positions."));
if (ShowToolTips())
itemButton14->SetToolTip(_("Click to delete all tab positions."));
itemBoxSizer10->Add(itemButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
////@end wxRichTextTabsPage content construction
@ -233,7 +237,7 @@ wxTextAttrEx* wxRichTextTabsPage::GetAttributes()
bool wxRichTextTabsPage::ShowToolTips()
{
return true;
return wxRichTextFormattingDialog::ShowToolTips();
}
/*!