/// 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
/// 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
// 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
/// Threshold for doing delayed layout
long m_delayedLayoutThreshold;
+
+ static wxArrayString sm_availableFontNames;
};
/*!
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
#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
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);
/// 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); }
wxArrayInt m_pageIds; // mapping of book control indexes to page ids
static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;
+ static bool sm_showToolTips;
DECLARE_EVENT_TABLE()
};
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// 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_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// 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_
#ifndef _RICHTEXTSTYLEPAGE_H_
#define _RICHTEXTSTYLEPAGE_H_
-/*!
- * Includes
- */
-
-////@begin includes
-////@end includes
-
-/*!
- * Forward declarations
- */
-
-////@begin forward declarations
-////@end forward declarations
-
/*!
* Control identifiers
*/
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,
/// Apply the style
void ApplyStyle(int i);
- /// React to selection
- void OnSelect(wxCommandEvent& event);
-
/// Left click
void OnLeftDown(wxMouseEvent& event);
/// 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; }
wxRichTextCtrl* m_richTextCtrl;
bool m_applyOnSelection; // if true, applies style on selection
wxRichTextStyleType m_styleType; // style type to display
+ bool m_autoSetSelection;
};
/*!
* style types.
*/
+#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
+
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
{
DECLARE_CLASS(wxRichTextStyleListCtrl)
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;
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;
*/
////@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.
/// 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();
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 );
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__)
////@end wxSymbolPickerDialog member variables
bool m_dontUpdate;
+ static bool sm_showToolTips;
};
/*!
wxRichTextBuffer::CleanUpHandlers();
wxRichTextDecimalToRoman(-1);
wxRichTextParagraph::ClearDefaultTabs();
+ wxRichTextCtrl::ClearAvailableFontNames();
};
};
#include "wx/richtext/richtextbulletspage.h"
#include "wx/richtext/richtextsymboldlg.h"
-#include "wx/fontenum.h"
/*!
* wxRichTextBulletsPage type definition
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);
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);
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);
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);
m_symbolCtrl->Append(_("+"));
m_symbolCtrl->Append(_("~"));
- wxFontEnumerator enumerator;
- enumerator.EnumerateFacenames();
- wxArrayString facenames = enumerator.GetFacenames();
+ wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
facenames.Sort();
m_symbolFontCtrl->Append(facenames);
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()
bool wxRichTextBulletsPage::ShowToolTips()
{
- return true;
+ return wxRichTextFormattingDialog::ShowToolTips();
}
/*!
#include "wx/filename.h"
#include "wx/dcbuffer.h"
#include "wx/arrimpl.cpp"
+#include "wx/fontenum.h"
// DLL options compatibility check:
#include "wx/app.h"
* wxRichTextCtrl
*/
+wxArrayString wxRichTextCtrl::sm_availableFontNames;
+
wxRichTextCtrl::wxRichTextCtrl()
: wxScrollHelper(this)
{
GetBuffer().SetRichTextCtrl(this);
+ if (style & wxTE_READONLY)
+ SetEditable(false);
+
wxTextAttrEx attributes;
attributes.SetFont(GetFont());
attributes.SetTextColour(*wxBLACK);
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"));
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
bool wxRichTextFontPage::ShowToolTips()
{
- return true;
+ return wxRichTextFormattingDialog::ShowToolTips();
}
/*!
#include "wx/bookctrl.h"
#include "wx/colordlg.h"
-#include "wx/fontenum.h"
#include "wx/settings.h"
#include "wx/module.h"
#include "wx/imaglist.h"
#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__
#define wxRICHTEXT_USE_TOOLBOOK false
#endif
+bool wxRichTextFormattingDialog::sm_showToolTips = false;
+
IMPLEMENT_CLASS(wxRichTextFormattingDialog, wxPropertySheetDialog)
BEGIN_EVENT_TABLE(wxRichTextFormattingDialog, wxPropertySheetDialog)
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;
}
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];
/// 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
// 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)
/// 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();
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);
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 );
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 );
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);
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 );
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 );
};
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);
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
bool wxRichTextIndentsSpacingPage::ShowToolTips()
{
- return true;
+ return wxRichTextFormattingDialog::ShowToolTips();
}
/*!
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: richtextliststylepage.cpp
+// Purpose:
+// Author: Julian Smart
+// Modified by:
+// Created: 10/18/2006 11:36:37 AM
+// RCS-ID:
+// Copyright: (c) Julian Smart
+// Licence:
+/////////////////////////////////////////////////////////////////////////////
+
+#include "../../include/wx/richtext/richtextliststylepage.h"
+
+////@begin XPM images
+////@end XPM images
+
+/*!
+ * wxRichTextListStylePage type definition
+ */
+
+IMPLEMENT_DYNAMIC_CLASS( wxRichTextListStylePage, wxPanel )
+
+/*!
+ * wxRichTextListStylePage event table definition
+ */
+
+BEGIN_EVENT_TABLE( wxRichTextListStylePage, wxPanel )
+
+////@begin wxRichTextListStylePage event table entries
+ EVT_SPINCTRL( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUpdated )
+ EVT_SPIN_UP( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUp )
+ EVT_SPIN_DOWN( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelDown )
+ EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelTextUpdated )
+ EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUIUpdate )
+
+ EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT, wxRichTextListStylePage::OnChooseFontClick )
+
+ EVT_LISTBOX( ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxRichTextListStylePage::OnStylelistboxSelected )
+
+ EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, wxRichTextListStylePage::OnSymbolstaticUpdate )
+
+ EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlSelected )
+ EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlUpdated )
+ EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlUIUpdate )
+
+ EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextListStylePage::OnChooseSymbolClick )
+ EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextListStylePage::OnChooseSymbolUpdate )
+
+ EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlSelected )
+ EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlUpdated )
+ EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlUIUpdate )
+
+ EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, wxRichTextListStylePage::OnParenthesesctrlClick )
+ EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, wxRichTextListStylePage::OnParenthesesctrlUpdate )
+
+ EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, wxRichTextListStylePage::OnPeriodctrlClick )
+ EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, wxRichTextListStylePage::OnPeriodctrlUpdate )
+
+ EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT, wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected )
+
+ EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT, wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected )
+
+ EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED, wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected )
+
+ EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_CENTERED, wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected )
+
+ EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE, wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected )
+
+ EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, wxRichTextListStylePage::OnIndentLeftUpdated )
+
+ EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, wxRichTextListStylePage::OnIndentFirstLineUpdated )
+
+ EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, wxRichTextListStylePage::OnIndentRightUpdated )
+
+ EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, wxRichTextListStylePage::OnSpacingBeforeUpdated )
+
+ EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, wxRichTextListStylePage::OnSpacingAfterUpdated )
+
+ EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_LINESPACING, wxRichTextListStylePage::OnLineSpacingSelected )
+
+////@end wxRichTextListStylePage event table entries
+
+END_EVENT_TABLE()
+
+/*!
+ * wxRichTextListStylePage constructors
+ */
+
+wxRichTextListStylePage::wxRichTextListStylePage( )
+{
+ Init();
+}
+
+wxRichTextListStylePage::wxRichTextListStylePage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
+{
+ Init();
+ Create(parent, id, pos, size, style);
+}
+
+/*!
+ * wxRichTextListStylePage creator
+ */
+
+bool wxRichTextListStylePage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
+{
+////@begin wxRichTextListStylePage creation
+ wxPanel::Create( parent, id, pos, size, style );
+
+ CreateControls();
+ if (GetSizer())
+ {
+ GetSizer()->SetSizeHints(this);
+ }
+ Centre();
+////@end wxRichTextListStylePage creation
+ return true;
+}
+
+/*!
+ * Member initialisation
+ */
+
+void wxRichTextListStylePage::Init()
+{
+ m_dontUpdate = false;
+ m_currentLevel = 1;
+
+////@begin wxRichTextListStylePage member initialisation
+ m_levelCtrl = NULL;
+ m_styleListBox = NULL;
+ m_symbolCtrl = NULL;
+ m_symbolFontCtrl = NULL;
+ m_parenthesesCtrl = NULL;
+ m_periodCtrl = NULL;
+ m_alignmentLeft = NULL;
+ m_alignmentRight = NULL;
+ m_alignmentJustified = NULL;
+ m_alignmentCentred = NULL;
+ m_alignmentIndeterminate = NULL;
+ m_indentLeft = NULL;
+ m_indentLeftFirst = NULL;
+ m_indentRight = NULL;
+ m_spacingBefore = NULL;
+ m_spacingAfter = NULL;
+ m_spacingLine = NULL;
+ m_previewCtrl = NULL;
+////@end wxRichTextListStylePage member initialisation
+}
+/*!
+ * Control creation for wxRichTextListStylePage
+ */
+
+void wxRichTextListStylePage::CreateControls()
+{
+////@begin wxRichTextListStylePage content construction
+ wxRichTextListStylePage* itemPanel1 = this;
+
+ wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
+ itemPanel1->SetSizer(itemBoxSizer2);
+
+ wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL, 5);
+
+ wxStaticText* itemStaticText5 = new wxStaticText( itemPanel1, wxID_STATIC, _("&List level:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ m_levelCtrl = new wxSpinCtrl( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_LEVEL, _T("1"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 1, 10, 1 );
+ m_levelCtrl->SetHelpText(_("Selects the list level to edit."));
+ if (ShowToolTips())
+ m_levelCtrl->SetToolTip(_("Selects the list level to edit."));
+ itemBoxSizer4->Add(m_levelCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ itemBoxSizer4->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxButton* itemButton8 = new wxButton( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT, _("&Font for Level..."), wxDefaultPosition, wxDefaultSize, 0 );
+ itemButton8->SetHelpText(_("Click to choose the font for this level."));
+ if (ShowToolTips())
+ itemButton8->SetToolTip(_("Click to choose the font for this level."));
+ itemBoxSizer4->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxNotebook* itemNotebook9 = new wxNotebook( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
+
+ wxPanel* itemPanel10 = new wxPanel( itemNotebook9, ID_RICHTEXTLISTSTYLEPAGE_BULLETS, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
+ wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
+ itemPanel10->SetSizer(itemBoxSizer11);
+
+ wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer11->Add(itemBoxSizer12, 1, wxGROW, 5);
+ wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer12->Add(itemBoxSizer13, 0, wxGROW, 5);
+ wxStaticText* itemStaticText14 = new wxStaticText( itemPanel10, wxID_STATIC, _("&Bullet style:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
+
+ wxString* m_styleListBoxStrings = NULL;
+ m_styleListBox = new wxListBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_styleListBoxStrings, wxLB_SINGLE );
+ m_styleListBox->SetHelpText(_("The available bullet styles."));
+ if (ShowToolTips())
+ m_styleListBox->SetToolTip(_("The available bullet styles."));
+ itemBoxSizer13->Add(m_styleListBox, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+ itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
+ itemBoxSizer12->Add(itemStaticLine17, 0, wxGROW|wxALL, 5);
+
+ itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer12->Add(itemBoxSizer19, 0, wxGROW, 5);
+ wxStaticText* itemStaticText20 = new wxStaticText( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, _("&Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer19->Add(itemStaticText20, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer19->Add(itemBoxSizer21, 0, wxGROW, 5);
+ wxString* m_symbolCtrlStrings = NULL;
+ m_symbolCtrl = new wxComboBox( itemPanel10, 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."));
+ itemBoxSizer21->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
+
+ wxButton* itemButton23 = new wxButton( itemPanel10, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 );
+ itemButton23->SetHelpText(_("Click to browse for a symbol."));
+ if (ShowToolTips())
+ itemButton23->SetToolTip(_("Click to browse for a symbol."));
+ itemBoxSizer21->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ itemBoxSizer19->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+ wxStaticText* itemStaticText25 = new wxStaticText( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, _("Symbol &font:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer19->Add(itemStaticText25, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
+
+ wxString* m_symbolFontCtrlStrings = NULL;
+ m_symbolFontCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
+ if (ShowToolTips())
+ m_symbolFontCtrl->SetToolTip(_("Available fonts."));
+ itemBoxSizer19->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
+
+ itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxStaticLine* itemStaticLine28 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
+ itemBoxSizer12->Add(itemStaticLine28, 0, wxGROW|wxALL, 5);
+
+ itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer12->Add(itemBoxSizer30, 0, wxALIGN_TOP|wxRIGHT|wxTOP|wxBOTTOM, 5);
+ m_parenthesesCtrl = new wxCheckBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_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."));
+ itemBoxSizer30->Add(m_parenthesesCtrl, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_periodCtrl = new wxCheckBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_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."));
+ itemBoxSizer30->Add(m_periodCtrl, 0, wxALIGN_LEFT|wxALL, 5);
+
+ itemNotebook9->AddPage(itemPanel10, _("Bullet style"));
+
+ wxPanel* itemPanel33 = new wxPanel( itemNotebook9, ID_RICHTEXTLISTSTYLEPAGE_SPACING, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
+ wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
+ itemPanel33->SetSizer(itemBoxSizer34);
+
+ wxBoxSizer* itemBoxSizer35 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer34->Add(itemBoxSizer35, 0, wxGROW, 5);
+ wxBoxSizer* itemBoxSizer36 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer35->Add(itemBoxSizer36, 0, wxGROW, 5);
+ wxStaticText* itemStaticText37 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Alignment"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer36->Add(itemStaticText37, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer36->Add(itemBoxSizer38, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+ itemBoxSizer38->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
+
+ wxBoxSizer* itemBoxSizer40 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer38->Add(itemBoxSizer40, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5);
+ m_alignmentLeft = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT, _("&Left"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
+ m_alignmentLeft->SetValue(false);
+ m_alignmentLeft->SetHelpText(_("Left-align text."));
+ if (ShowToolTips())
+ m_alignmentLeft->SetToolTip(_("Left-align text."));
+ itemBoxSizer40->Add(m_alignmentLeft, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_alignmentRight = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT, _("&Right"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_alignmentRight->SetValue(false);
+ m_alignmentRight->SetHelpText(_("Right-align text."));
+ if (ShowToolTips())
+ m_alignmentRight->SetToolTip(_("Right-align text."));
+ itemBoxSizer40->Add(m_alignmentRight, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_alignmentJustified = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_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."));
+ itemBoxSizer40->Add(m_alignmentJustified, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_alignmentCentred = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_CENTERED, _("Cen&tred"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_alignmentCentred->SetValue(false);
+ m_alignmentCentred->SetHelpText(_("Centre text."));
+ if (ShowToolTips())
+ m_alignmentCentred->SetToolTip(_("Centre text."));
+ itemBoxSizer40->Add(m_alignmentCentred, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_alignmentIndeterminate = new wxRadioButton( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE, _("&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."));
+ itemBoxSizer40->Add(m_alignmentIndeterminate, 0, wxALIGN_LEFT|wxALL, 5);
+
+ itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxStaticLine* itemStaticLine47 = new wxStaticLine( itemPanel33, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
+ itemBoxSizer35->Add(itemStaticLine47, 0, wxGROW|wxLEFT|wxBOTTOM, 5);
+
+ itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer35->Add(itemBoxSizer49, 0, wxGROW, 5);
+ wxStaticText* itemStaticText50 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Indentation (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer49->Add(itemStaticText50, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer51 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer49->Add(itemBoxSizer51, 0, wxALIGN_LEFT|wxALL, 5);
+ itemBoxSizer51->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
+
+ wxFlexGridSizer* itemFlexGridSizer53 = new wxFlexGridSizer(2, 2, 0, 0);
+ itemBoxSizer51->Add(itemFlexGridSizer53, 0, wxALIGN_CENTER_VERTICAL, 5);
+ wxStaticText* itemStaticText54 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer53->Add(itemStaticText54, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer53->Add(itemBoxSizer55, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
+ m_indentLeft = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentLeft->SetHelpText(_("The left indent."));
+ if (ShowToolTips())
+ m_indentLeft->SetToolTip(_("The left indent."));
+ itemBoxSizer55->Add(m_indentLeft, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxStaticText* itemStaticText57 = new wxStaticText( itemPanel33, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer53->Add(itemStaticText57, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer58 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer53->Add(itemBoxSizer58, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
+ m_indentLeftFirst = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentLeftFirst->SetHelpText(_("The first line indent."));
+ if (ShowToolTips())
+ m_indentLeftFirst->SetToolTip(_("The first line indent."));
+ itemBoxSizer58->Add(m_indentLeftFirst, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxStaticText* itemStaticText60 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer53->Add(itemStaticText60, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer61 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer53->Add(itemBoxSizer61, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
+ m_indentRight = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_indentRight->SetHelpText(_("The right indent."));
+ if (ShowToolTips())
+ m_indentRight->SetToolTip(_("The right indent."));
+ itemBoxSizer61->Add(m_indentRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxStaticLine* itemStaticLine64 = new wxStaticLine( itemPanel33, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
+ itemBoxSizer35->Add(itemStaticLine64, 0, wxGROW|wxTOP|wxBOTTOM, 5);
+
+ itemBoxSizer35->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+
+ wxBoxSizer* itemBoxSizer66 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer35->Add(itemBoxSizer66, 0, wxGROW, 5);
+ wxStaticText* itemStaticText67 = new wxStaticText( itemPanel33, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer66->Add(itemStaticText67, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer68 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer66->Add(itemBoxSizer68, 0, wxALIGN_LEFT|wxALL, 5);
+ itemBoxSizer68->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
+
+ wxFlexGridSizer* itemFlexGridSizer70 = new wxFlexGridSizer(2, 2, 0, 0);
+ itemBoxSizer68->Add(itemFlexGridSizer70, 0, wxALIGN_CENTER_VERTICAL, 5);
+ wxStaticText* itemStaticText71 = new wxStaticText( itemPanel33, wxID_STATIC, _("Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer70->Add(itemStaticText71, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer72 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer70->Add(itemBoxSizer72, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
+ m_spacingBefore = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
+ if (ShowToolTips())
+ m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
+ itemBoxSizer72->Add(m_spacingBefore, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxStaticText* itemStaticText74 = new wxStaticText( itemPanel33, wxID_STATIC, _("After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer70->Add(itemStaticText74, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer75 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer70->Add(itemBoxSizer75, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
+ m_spacingAfter = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 );
+ m_spacingAfter->SetHelpText(_("The spacing after the paragraph."));
+ if (ShowToolTips())
+ m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
+ itemBoxSizer75->Add(m_spacingAfter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxStaticText* itemStaticText77 = new wxStaticText( itemPanel33, wxID_STATIC, _("Line spacing:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer70->Add(itemStaticText77, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer78 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer70->Add(itemBoxSizer78, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
+ wxString m_spacingLineStrings[] = {
+ _("Single"),
+ _("1.5"),
+ _("2")
+ };
+ m_spacingLine = new wxComboBox( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_LINESPACING, _("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."));
+ itemBoxSizer78->Add(m_spacingLine, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ itemNotebook9->AddPage(itemPanel33, _("Spacing"));
+
+ itemBoxSizer3->Add(itemNotebook9, 0, wxGROW|wxALL, 5);
+
+ m_previewCtrl = new wxRichTextCtrl( itemPanel1, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 180), wxSUNKEN_BORDER );
+ m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
+ if (ShowToolTips())
+ m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));
+ itemBoxSizer3->Add(m_previewCtrl, 0, wxGROW|wxALL, 5);
+
+////@end wxRichTextListStylePage content construction
+
+ m_styleListBox->Append(_("(None)"));
+ m_styleListBox->Append(_("Arabic"));
+ m_styleListBox->Append(_("Upper case letters"));
+ m_styleListBox->Append(_("Lower case letters"));
+ m_styleListBox->Append(_("Upper case roman numerals"));
+ m_styleListBox->Append(_("Lower case roman numerals"));
+ m_styleListBox->Append(_("Symbol"));
+ m_styleListBox->Append(_("Bitmap"));
+
+ m_symbolCtrl->Append(_("*"));
+ m_symbolCtrl->Append(_("-"));
+ m_symbolCtrl->Append(_(">"));
+ m_symbolCtrl->Append(_("+"));
+ m_symbolCtrl->Append(_("~"));
+
+ wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
+ facenames.Sort();
+
+ m_symbolFontCtrl->Append(facenames);
+}
+
+/// Updates the font preview
+void wxRichTextListStylePage::UpdatePreview()
+{
+ 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_para2 = wxT("Duis pharetra consequat dui. 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");
+
+ wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
+ wxRichTextListStyleDefinition);
+
+ wxTextAttrEx attr(def->GetStyle());
+ 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));
+
+ 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);
+
+ int i;
+ for (i = 0; i < 10; i++)
+ {
+ wxTextAttrEx levelAttr = * def->GetLevelAttributes(i);
+ levelAttr.SetBulletNumber(1);
+ m_previewCtrl->BeginStyle(levelAttr);
+ m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2);
+ m_previewCtrl->EndStyle();
+ }
+ m_previewCtrl->EndStyle();
+
+ m_previewCtrl->BeginStyle(normalParaAttr);
+ m_previewCtrl->WriteText(s_para3);
+ m_previewCtrl->EndStyle();
+
+ m_previewCtrl->Thaw();
+}
+
+/// Transfer data from/to window
+bool wxRichTextListStylePage::TransferDataFromWindow()
+{
+ wxPanel::TransferDataFromWindow();
+
+ m_currentLevel = m_levelCtrl->GetValue();
+
+ wxTextAttrEx* attr = GetAttributesForSelection();
+
+ if (m_alignmentLeft->GetValue())
+ attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT);
+ else if (m_alignmentCentred->GetValue())
+ attr->SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
+ else if (m_alignmentRight->GetValue())
+ attr->SetAlignment(wxTEXT_ALIGNMENT_RIGHT);
+ else if (m_alignmentJustified->GetValue())
+ attr->SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED);
+ else
+ {
+ attr->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT);
+ attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT));
+ }
+
+ wxString leftIndent(m_indentLeft->GetValue());
+ wxString leftFirstIndent(m_indentLeftFirst->GetValue());
+ if (!leftIndent.empty())
+ {
+ int visualLeftIndent = wxAtoi(leftIndent);
+ int visualLeftFirstIndent = wxAtoi(leftFirstIndent);
+ int actualLeftIndent = visualLeftFirstIndent;
+ int actualLeftSubIndent = visualLeftIndent - visualLeftFirstIndent;
+
+ attr->SetLeftIndent(actualLeftIndent, actualLeftSubIndent);
+ }
+ else
+ attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT));
+
+ wxString rightIndent(m_indentRight->GetValue());
+ if (!rightIndent.empty())
+ attr->SetRightIndent(wxAtoi(rightIndent));
+ else
+ attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT));
+
+ wxString spacingAfter(m_spacingAfter->GetValue());
+ if (!spacingAfter.empty())
+ attr->SetParagraphSpacingAfter(wxAtoi(spacingAfter));
+ else
+ attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER));
+
+ wxString spacingBefore(m_spacingBefore->GetValue());
+ if (!spacingBefore.empty())
+ attr->SetParagraphSpacingBefore(wxAtoi(spacingBefore));
+ else
+ attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE));
+
+ int spacingIndex = m_spacingLine->GetSelection();
+ int lineSpacing = 0;
+ if (spacingIndex == 0)
+ lineSpacing = 10;
+ else if (spacingIndex == 1)
+ lineSpacing = 15;
+ else if (spacingIndex == 2)
+ lineSpacing = 20;
+
+ if (lineSpacing == 0)
+ attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING));
+ else
+ attr->SetLineSpacing(lineSpacing);
+
+ /// BULLETS
+ if (true) // m_hasBulletStyle)
+ {
+ long bulletStyle = 0;
+
+ int index = m_styleListBox->GetSelection();
+ if (index == 1)
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ARABIC;
+ else if (index == 2)
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER;
+ else if (index == 3)
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER;
+ else if (index == 4)
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER;
+ else if (index == 5)
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER;
+ else if (index == 6)
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_SYMBOL;
+ else if (index == 7)
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_BITMAP;
+
+ if (m_parenthesesCtrl->GetValue())
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES;
+ if (m_periodCtrl->GetValue())
+ bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PERIOD;
+
+ attr->SetBulletStyle(bulletStyle);
+ }
+
+ // if (m_hasBulletSymbol)
+ {
+ wxChar c(wxT('*'));
+ if (m_symbolCtrl->GetValue().length() > 0)
+ c = m_symbolCtrl->GetValue()[0];
+ attr->SetBulletSymbol(c);
+ attr->SetBulletFont(m_symbolFontCtrl->GetValue());
+ }
+
+ return true;
+}
+
+bool wxRichTextListStylePage::TransferDataToWindow()
+{
+ DoTransferDataToWindow();
+ UpdatePreview();
+
+ return true;
+}
+
+/// Just transfer to the window
+void wxRichTextListStylePage::DoTransferDataToWindow()
+{
+ m_dontUpdate = true;
+
+ wxPanel::TransferDataToWindow();
+
+ m_levelCtrl->SetValue(m_currentLevel);
+
+ wxTextAttrEx* attr = GetAttributesForSelection();
+
+ if (attr->HasAlignment())
+ {
+ if (attr->GetAlignment() == wxTEXT_ALIGNMENT_LEFT)
+ m_alignmentLeft->SetValue(true);
+ else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
+ m_alignmentRight->SetValue(true);
+ else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
+ m_alignmentCentred->SetValue(true);
+ else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED)
+ m_alignmentJustified->SetValue(true);
+ else
+ m_alignmentIndeterminate->SetValue(true);
+ }
+ else
+ m_alignmentIndeterminate->SetValue(true);
+
+ if (attr->HasLeftIndent())
+ {
+ wxString leftIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent() + attr->GetLeftSubIndent()));
+ wxString leftFirstIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent()));
+
+ m_indentLeft->SetValue(leftIndent);
+ m_indentLeftFirst->SetValue(leftFirstIndent);
+ }
+ else
+ {
+ m_indentLeft->SetValue(wxEmptyString);
+ m_indentLeftFirst->SetValue(wxEmptyString);
+ }
+
+ if (attr->HasRightIndent())
+ {
+ wxString rightIndent(wxString::Format(wxT("%ld"), attr->GetRightIndent()));
+
+ m_indentRight->SetValue(rightIndent);
+ }
+ else
+ m_indentRight->SetValue(wxEmptyString);
+
+ if (attr->HasParagraphSpacingAfter())
+ {
+ wxString spacingAfter(wxString::Format(wxT("%d"), attr->GetParagraphSpacingAfter()));
+
+ m_spacingAfter->SetValue(spacingAfter);
+ }
+ else
+ m_spacingAfter->SetValue(wxEmptyString);
+
+ if (attr->HasParagraphSpacingBefore())
+ {
+ wxString spacingBefore(wxString::Format(wxT("%d"), attr->GetParagraphSpacingBefore()));
+
+ m_spacingBefore->SetValue(spacingBefore);
+ }
+ else
+ m_spacingBefore->SetValue(wxEmptyString);
+
+ if (attr->HasLineSpacing())
+ {
+ int index = 0;
+
+ int lineSpacing = attr->GetLineSpacing();
+ if (lineSpacing == 10)
+ index = 0;
+ else if (lineSpacing == 15)
+ index = 1;
+ else if (lineSpacing == 20)
+ index = 2;
+ else
+ index = -1;
+
+ m_spacingLine->SetSelection(index);
+ }
+ else
+ m_spacingLine->SetSelection(-1);
+
+ /// BULLETS
+ if (attr->HasBulletStyle())
+ {
+ int index = -1;
+ if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC)
+ index = 1;
+ else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER)
+ index = 2;
+ else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER)
+ index = 3;
+ else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER)
+ index = 4;
+ else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER)
+ index = 5;
+ else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
+ index = 6;
+ else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP)
+ index = 7;
+ m_styleListBox->SetSelection(index);
+
+ if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES)
+ m_parenthesesCtrl->SetValue(true);
+ else
+ m_parenthesesCtrl->SetValue(false);
+
+ if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD)
+ m_periodCtrl->SetValue(true);
+ else
+ m_periodCtrl->SetValue(false);
+ }
+ else
+ m_styleListBox->SetSelection(-1);
+
+ if (attr->HasBulletSymbol())
+ {
+ wxChar c = attr->GetBulletSymbol();
+ wxString s;
+ s << c;
+ m_symbolCtrl->SetValue(s);
+ m_symbolFontCtrl->SetValue(attr->GetBulletFont());
+ }
+ else
+ m_symbolCtrl->SetValue(wxEmptyString);
+
+ m_dontUpdate = false;
+}
+
+/// Get attributes for selected level
+wxTextAttrEx* wxRichTextListStylePage::GetAttributesForSelection()
+{
+ wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
+ wxRichTextListStyleDefinition);
+
+ int value = m_levelCtrl->GetValue();
+
+ if (def)
+ return def->GetLevelAttributes(value-1);
+ else
+ return NULL;
+}
+
+/// Just transfer from the window and update the preview
+void wxRichTextListStylePage::TransferAndPreview()
+{
+ if (!m_dontUpdate)
+ {
+ TransferDataFromWindow();
+ UpdatePreview();
+ }
+}
+
+
+/*!
+ * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ */
+
+void wxRichTextListStylePage::OnLevelUpdated( wxSpinEvent& WXUNUSED(event) )
+{
+ if (!m_dontUpdate)
+ {
+ m_currentLevel = m_levelCtrl->GetValue();
+ TransferDataToWindow();
+ }
+}
+
+/*!
+ * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ */
+
+void wxRichTextListStylePage::OnLevelUp( wxSpinEvent& WXUNUSED(event) )
+{
+ if (!m_dontUpdate)
+ {
+ m_currentLevel = m_levelCtrl->GetValue();
+ TransferDataToWindow();
+ }
+}
+
+/*!
+ * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ */
+
+void wxRichTextListStylePage::OnLevelDown( wxSpinEvent& WXUNUSED(event) )
+{
+ if (!m_dontUpdate)
+ {
+ m_currentLevel = m_levelCtrl->GetValue();
+ TransferDataToWindow();
+ }
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ */
+
+void wxRichTextListStylePage::OnLevelTextUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ if (!m_dontUpdate)
+ {
+ m_currentLevel = m_levelCtrl->GetValue();
+ TransferDataToWindow();
+ }
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
+ */
+
+void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent& event )
+{
+////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
+ // Before editing this code, remove the block markers.
+ event.Skip();
+////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
+}
+
+/*!
+ * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
+ */
+
+void wxRichTextListStylePage::OnStylelistboxSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
+ */
+
+void wxRichTextListStylePage::OnSymbolstaticUpdate( wxUpdateUIEvent& event )
+{
+ OnSymbolUpdate(event);
+}
+
+/*!
+ * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
+ */
+
+void wxRichTextListStylePage::OnSymbolctrlSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
+ */
+
+void wxRichTextListStylePage::OnSymbolctrlUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
+ */
+
+void wxRichTextListStylePage::OnSymbolctrlUIUpdate( wxUpdateUIEvent& event )
+{
+ OnSymbolUpdate(event);
+}
+
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
+ */
+
+void wxRichTextListStylePage::OnChooseSymbolClick( wxCommandEvent& WXUNUSED(event) )
+{
+ int sel = m_styleListBox->GetSelection();
+ if (sel == 6)
+ {
+ wxString symbol = m_symbolCtrl->GetValue();
+ wxString fontName = m_symbolFontCtrl->GetValue();
+ wxSymbolPickerDialog dlg(symbol, fontName, fontName, this);
+
+ if (dlg.ShowModal() == wxID_OK)
+ {
+ m_dontUpdate = true;
+
+ m_symbolCtrl->SetValue(dlg.GetSymbol());
+ m_symbolFontCtrl->SetValue(dlg.GetFontName());
+
+ TransferAndPreview();
+
+ m_dontUpdate = false;
+ }
+ }
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
+ */
+
+void wxRichTextListStylePage::OnChooseSymbolUpdate( wxUpdateUIEvent& event )
+{
+ OnSymbolUpdate(event);
+}
+
+/*!
+ * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
+ */
+
+void wxRichTextListStylePage::OnSymbolfontctrlSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
+ */
+
+void wxRichTextListStylePage::OnSymbolfontctrlUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
+ */
+
+void wxRichTextListStylePage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event )
+{
+ OnSymbolUpdate(event);
+}
+
+/*!
+ * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
+ */
+
+void wxRichTextListStylePage::OnParenthesesctrlClick( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
+ */
+
+void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event )
+{
+////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
+ // Before editing this code, remove the block markers.
+ event.Skip();
+////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
+}
+
+/*!
+ * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
+ */
+
+void wxRichTextListStylePage::OnPeriodctrlClick( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
+ */
+
+void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent& event )
+{
+////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
+ // Before editing this code, remove the block markers.
+ event.Skip();
+////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
+}
+
+/*!
+ * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
+ */
+
+void wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
+ */
+
+void wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
+ */
+
+void wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
+ */
+
+void wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
+ */
+
+void wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
+ */
+
+void wxRichTextListStylePage::OnIndentLeftUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
+ */
+
+void wxRichTextListStylePage::OnIndentFirstLineUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
+ */
+
+void wxRichTextListStylePage::OnIndentRightUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
+ */
+
+void wxRichTextListStylePage::OnSpacingBeforeUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
+ */
+
+void wxRichTextListStylePage::OnSpacingAfterUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
+ */
+
+void wxRichTextListStylePage::OnLineSpacingSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ TransferAndPreview();
+}
+
+/*!
+ * Should we show tooltips?
+ */
+
+bool wxRichTextListStylePage::ShowToolTips()
+{
+ return wxRichTextFormattingDialog::ShowToolTips();
+}
+
+/*!
+ * Get bitmap resources
+ */
+
+wxBitmap wxRichTextListStylePage::GetBitmapResource( const wxString& name )
+{
+ // Bitmap retrieval
+////@begin wxRichTextListStylePage bitmap retrieval
+ wxUnusedVar(name);
+ return wxNullBitmap;
+////@end wxRichTextListStylePage bitmap retrieval
+}
+
+/*!
+ * Get icon resources
+ */
+
+wxIcon wxRichTextListStylePage::GetIconResource( const wxString& name )
+{
+ // Icon retrieval
+////@begin wxRichTextListStylePage icon retrieval
+ wxUnusedVar(name);
+ return wxNullIcon;
+////@end wxRichTextListStylePage icon retrieval
+}
+
+/// Update for symbol-related controls
+void wxRichTextListStylePage::OnSymbolUpdate( wxUpdateUIEvent& event )
+{
+ int sel = m_styleListBox->GetSelection();
+ event.Enable(sel == 6);
+}
+
+/// Update for number-related controls
+void wxRichTextListStylePage::OnNumberUpdate( wxUpdateUIEvent& event )
+{
+ int sel = m_styleListBox->GetSelection();
+ event.Enable((sel != 6 && sel != 7 && sel != 0));
+}
+
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
+ */
+
+void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent& WXUNUSED(event) )
+{
+ wxTextAttrEx* attr = GetAttributesForSelection();
+
+ int pages = wxRICHTEXT_FORMAT_FONT;
+ wxRichTextFormattingDialog formatDlg;
+ formatDlg.SetStyle(*attr, false);
+ formatDlg.Create(pages, this);
+
+ if (formatDlg.ShowModal() == wxID_OK)
+ {
+ (*attr) = formatDlg.GetAttributes();
+ TransferAndPreview();
+ }
+}
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// 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();
+}
+
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);
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;
}
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 (sheet)
+ if (m_nextStyle->GetCount() == 0)
{
- size_t i;
- for (i = 0; i < sheet->GetParagraphStyleCount(); i++)
+ if (sheet)
{
- 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_nextStyle->Append(p->GetName());
+ }
}
}
+ m_nextStyle->SetValue(listDef->GetNextStyle());
}
- m_nextStyle->SetValue(paraDef->GetNextStyle());
- }
-
- if (m_basedOn->GetCount() == 0)
- {
- if (sheet)
+ else if (paraDef)
{
- if (paraDef)
+ if (m_nextStyle->GetCount() == 0)
{
- size_t i;
- for (i = 0; i < sheet->GetParagraphStyleCount(); i++)
+ if (sheet)
{
- wxRichTextParagraphStyleDefinition* p = wxDynamicCast(sheet->GetParagraphStyle(i), wxRichTextParagraphStyleDefinition);
- if (p)
- m_basedOn->Append(p->GetName());
+ size_t i;
+ for (i = 0; i < sheet->GetParagraphStyleCount(); i++)
+ {
+ wxRichTextParagraphStyleDefinition* p = wxDynamicCast(sheet->GetParagraphStyle(i), wxRichTextParagraphStyleDefinition);
+ if (p)
+ m_nextStyle->Append(p->GetName());
+ }
}
}
- else
+ m_nextStyle->SetValue(paraDef->GetNextStyle());
+ }
+
+ if (m_basedOn->GetCount() == 0)
+ {
+ if (sheet)
{
- size_t i;
- for (i = 0; i < sheet->GetCharacterStyleCount(); i++)
+ if (listDef)
+ {
+ 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)
{
- wxRichTextCharacterStyleDefinition* p = wxDynamicCast(sheet->GetCharacterStyle(i), wxRichTextCharacterStyleDefinition);
- if (p)
- m_basedOn->Append(p->GetName());
+ 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());
}
- m_basedOn->SetValue(def->GetBaseStyle());
-
return true;
}
bool wxRichTextStylePage::ShowToolTips()
{
- return true;
+ return wxRichTextFormattingDialog::ShowToolTips();
}
/*!
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)
{
if (GetStyleSheet())
{
+ SetSelection(wxNOT_FOUND);
+
if (GetStyleType() == wxRICHTEXT_STYLE_ALL)
SetItemCount(GetStyleSheet()->GetParagraphStyleCount()+GetStyleSheet()->GetCharacterStyleCount()+GetStyleSheet()->GetListStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_PARAGRAPH)
SetItemCount(GetStyleSheet()->GetCharacterStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_LIST)
SetItemCount(GetStyleSheet()->GetListStyleCount());
+
Refresh();
+
+ if (GetItemCount() > 0)
+ {
+ SetSelection(0);
+ SendSelectedEvent();
+ }
}
}
str << wxT("<td nowrap>");
+#ifdef __WXMSW__
+ int size = 3;
+#else
int size = 4;
+#endif
+
+ int stdFontSize = 12;
+ int thisFontSize = ((def->GetStyle().GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0) ? def->GetStyle().GetFontSize() : stdFontSize;
- // Standard size is 12, say
- size += (def->GetStyle().HasFont() ? def->GetStyle().GetFontSize() : 12) - 12;
+ if (thisFontSize < stdFontSize)
+ size ++;
+ else if (thisFontSize > stdFontSize)
+ size --;
str += wxT("<font");
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);
wxControl::Create(parent, id, pos, size, style);
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ if (size != wxDefaultSize)
+ SetBestFittingSize(size);
+
+ bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
- m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER);
+ m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, showSelector ? wxSIMPLE_BORDER : wxNO_BORDER);
+
+ wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
- wxArrayString choices;
- choices.Add(_("All styles"));
- choices.Add(_("Paragraph styles"));
- choices.Add(_("Character styles"));
- choices.Add(_("List styles"));
+ 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);
+ m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
- wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
- boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
- boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5);
+ 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);
+ 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;
wxRichTextStyleListCtrl::~wxRichTextStyleListCtrl()
{
+
}
/// React to style type choice
#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
*/
}
#endif
+bool wxSymbolPickerDialog::sm_showToolTips = false;
+
/*!
* wxSymbolPickerDialog type definition
*/
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);
#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."));
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);
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);
};
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
if (m_fontCtrl->GetCount() == 0)
{
- wxArrayString faceNames = wxFontEnumerator::GetFacenames();
+ wxArrayString faceNames = wxRichTextCtrl::GetAvailableFontNames();
faceNames.Sort();
faceNames.Insert(_("(Normal text)"), 0);
}
-/*!
- * Should we show tooltips?
- */
-
-bool wxSymbolPickerDialog::ShowToolTips()
-{
- return true;
-}
-
/*!
* Get bitmap resources
*/
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);
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
bool wxRichTextTabsPage::ShowToolTips()
{
- return true;
+ return wxRichTextFormattingDialog::ShowToolTips();
}
/*!