NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
EditorNotebook Class Reference

This class represents the notebook containing all editors of one main pane. More...

#include <NumeReNotebook.h>

Inheritance diagram for EditorNotebook:
Collaboration diagram for EditorNotebook:

Public Member Functions

 EditorNotebook (wxWindow *parent, wxWindowID id, IconManager *icons, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
 Constructor. More...
 
 ~EditorNotebook ()
 Empty destructor. More...
 
void SetTopParent (NumeReWindow *window)
 
void SetShowPathsOrIconsOnTabs (bool showText, bool showIcons)
 This member function enables/disables the relative paths or icons on the tab and refreshes the tab texts automatically. More...
 
void SetTabText (size_t nTab, const wxString &text)
 Set a text for the selected editor tab. Note that this function expects a filepath. More...
 
NumeReEditorcreateEditor (const wxString &text)
 Create a new editor and add it to a new tab automatically. The passed text is used for the tab name. More...
 
NumeReEditorgetEditor (size_t pageNum, bool secondary=false)
 Returns a pointer to the embedded editor instance. Will return the left or top editor pointer or the secondary editor, if the boolean is set to true. The return value might be a nullptr. More...
 
NumeReEditorgetCurrentEditor (bool secondary=false)
 Returns a pointer to the current viewed editor in this notebook. Will return the left or top editor or the secondary one, if the boolean is set to true. The return value might be a nullptr. This is a convenience wrapper around EditorNotebook::getEditor. More...
 
NumeReEditorgetFocusedEditor ()
 Returns a pointer to the current focused editor. This will automatically return the secondary editor, it that is the focused one. This handling might be weak. In doubt, the primary editor is returned. More...
 
void split (size_t pageNum, bool horizontal)
 Split the current editor horizontally or vertically (depending on the flag), if it is not already splitted. More...
 
void unsplit (size_t pageNum)
 Remove the splitted view. More...
 
bool isSplit (size_t pageNum) const
 Check, whether the editor is currently splitted. More...
 
void OnUnsplit (wxSplitterEvent &event)
 Event handler, if the user drags the sash to the outermost edge. More...
 
int FindPagePosition (wxNotebookPage *page)
 
void OnButtonClicked (wxAuiNotebookEvent &event)
 Executes the closing command, if the user clickes with the middle mouse button on a tab. More...
 
void OnTabRightClicked (wxAuiNotebookEvent &event)
 Shows the context menu for the current tab. More...
 
void OnTabMove (wxAuiNotebookEvent &event)
 This event handler fixes the issue that the control does not correctly update the selected page during moving a page. More...
 
void OnTabMiddleClicked (wxAuiNotebookEvent &event)
 Executes the closing command, if the user clickes on the button of a tab. More...
 
void OnTabScroll (wxMouseEvent &event)
 Scrolls through the notebook pages, if the user hovers over the tabs and uses the mouse wheel. More...
 
void OnEnter (wxMouseEvent &event)
 Focuses the tabs, if the user hovers over them. More...
 
void OnLeave (wxMouseEvent &event)
 Deactivates the internal mouse focus state. More...
 
void OnSize (wxSizeEvent &event)
 Size event handling function. More...
 
bool GetMouseFocus ()
 
int GetTabFromPoint (const wxPoint &pt)
 Returns the tab at the defined absolute coordinates. Actually more or less the same than the generic HitTest() member functions. More...
 

Private Attributes

IconManagerm_manager
 
NumeReWindowm_top_parent
 
bool m_mouseFocus
 
bool m_showPathsOnTabs
 
bool m_showIconsOnTabs
 

Detailed Description

This class represents the notebook containing all editors of one main pane.

Definition at line 19 of file NumeReNotebook.h.

Constructor & Destructor Documentation

◆ EditorNotebook()

EditorNotebook::EditorNotebook ( wxWindow *  parent,
wxWindowID  id,
IconManager icons,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = 0 
)

Constructor.

Parameters
parentwxWindow*
idwxWindowID
iconsIconManager*
posconst wxPoint&
sizeconst wxSize&
stylelong

Definition at line 42 of file NumeReNotebook.cpp.

◆ ~EditorNotebook()

EditorNotebook::~EditorNotebook ( )

Empty destructor.

Definition at line 56 of file NumeReNotebook.cpp.

Member Function Documentation

◆ createEditor()

NumeReEditor * EditorNotebook::createEditor ( const wxString &  text)

Create a new editor and add it to a new tab automatically. The passed text is used for the tab name.

Parameters
textconst wxString&
Returns
NumeReEditor*

Definition at line 151 of file NumeReNotebook.cpp.

References NumeReWindow::getOptions(), GenericTerminal::getSyntax(), NumeReWindow::getTerminal(), and m_top_parent.

Referenced by NumeReWindow::DefaultPage(), NumeReWindow::NewFile(), and NumeReWindow::OpenSourceFile().

Here is the call graph for this function:

◆ FindPagePosition()

int EditorNotebook::FindPagePosition ( wxNotebookPage *  page)

public FindPagePosition Finds the index of a given notebook page

Parameters
pagewxNotebookPage * The generated notebook event
Returns
int The index of the requested page (-1 if not found)
Author
Mark Erikson
Date
04-22-2004

Definition at line 537 of file NumeReNotebook.cpp.

References getEditor().

Here is the call graph for this function:

◆ getCurrentEditor()

NumeReEditor * EditorNotebook::getCurrentEditor ( bool  secondary = false)

◆ getEditor()

NumeReEditor * EditorNotebook::getEditor ( size_t  pageNum,
bool  secondary = false 
)

◆ getFocusedEditor()

NumeReEditor * EditorNotebook::getFocusedEditor ( )

Returns a pointer to the current focused editor. This will automatically return the secondary editor, it that is the focused one. This handling might be weak. In doubt, the primary editor is returned.

Returns
NumeReEditor*

Definition at line 219 of file NumeReNotebook.cpp.

References getCurrentEditor().

Referenced by NumeReWindow::FindAndOpenProcedure(), NumeReWindow::FindString(), NumeReWindow::gotoLine(), NumeReWindow::OnFileEventTimer(), NumeReWindow::OnFindEvent(), NumeReWindow::OnFindReplace(), NumeReWindow::OnMenuEvent(), NumeReWindow::OnTreeItemActivated(), NumeReWindow::OpenSourceFile(), NumeReWindow::reloadFileIfOpen(), NumeReWindow::ReplaceAllStrings(), and NumeReWindow::UpdateStatusBar().

Here is the call graph for this function:

◆ GetMouseFocus()

bool EditorNotebook::GetMouseFocus ( )
inline

Definition at line 55 of file NumeReNotebook.h.

References m_mouseFocus.

◆ GetTabFromPoint()

int EditorNotebook::GetTabFromPoint ( const wxPoint &  pt)

Returns the tab at the defined absolute coordinates. Actually more or less the same than the generic HitTest() member functions.

Parameters
ptconst wxPoint&
Returns
int

Definition at line 504 of file NumeReNotebook.cpp.

References DetachedLogger::debug(), g_logger, and toString().

Referenced by OnButtonClicked(), OnTabMiddleClicked(), OnTabMove(), and OnTabRightClicked().

Here is the call graph for this function:

◆ isSplit()

bool EditorNotebook::isSplit ( size_t  pageNum) const

Check, whether the editor is currently splitted.

Parameters
pageNumsize_t
Returns
bool

Definition at line 311 of file NumeReNotebook.cpp.

Referenced by OnTabRightClicked().

◆ OnButtonClicked()

void EditorNotebook::OnButtonClicked ( wxAuiNotebookEvent &  event)

Executes the closing command, if the user clickes with the middle mouse button on a tab.

Parameters
eventwxAuiNotebookEvent&
Returns
void

Definition at line 557 of file NumeReNotebook.cpp.

References GetTabFromPoint(), ID_MENU_CLOSETAB, ID_MENU_CLOSETABFORCE, m_top_parent, NumeReWindow::SetIntVar(), and VN_CLICKEDTAB.

Here is the call graph for this function:

◆ OnEnter()

void EditorNotebook::OnEnter ( wxMouseEvent &  event)

Focuses the tabs, if the user hovers over them.

Parameters
eventwxMouseEvent&
Returns
void

Definition at line 458 of file NumeReNotebook.cpp.

References m_mouseFocus.

◆ OnLeave()

void EditorNotebook::OnLeave ( wxMouseEvent &  event)

Deactivates the internal mouse focus state.

Parameters
eventwxMouseEvent&
Returns
void

Definition at line 474 of file NumeReNotebook.cpp.

References m_mouseFocus.

◆ OnSize()

void EditorNotebook::OnSize ( wxSizeEvent &  event)

Size event handling function.

Parameters
eventwxSizeEvent&
Returns
void

Definition at line 488 of file NumeReNotebook.cpp.

◆ OnTabMiddleClicked()

void EditorNotebook::OnTabMiddleClicked ( wxAuiNotebookEvent &  event)

Executes the closing command, if the user clickes on the button of a tab.

Parameters
eventwxAuiNotebookEvent&
Returns
void

Definition at line 586 of file NumeReNotebook.cpp.

References GetTabFromPoint(), ID_MENU_CLOSETAB, ID_MENU_CLOSETABFORCE, m_top_parent, NumeReWindow::SetIntVar(), and VN_CLICKEDTAB.

Here is the call graph for this function:

◆ OnTabMove()

void EditorNotebook::OnTabMove ( wxAuiNotebookEvent &  event)

This event handler fixes the issue that the control does not correctly update the selected page during moving a page.

Parameters
eventwxAuiNotebookEvent&
Returns
void

Definition at line 399 of file NumeReNotebook.cpp.

References GetTabFromPoint().

Here is the call graph for this function:

◆ OnTabRightClicked()

void EditorNotebook::OnTabRightClicked ( wxAuiNotebookEvent &  event)

Shows the context menu for the current tab.

Parameters
eventwxAuiNotebookEvent&
Returns
void

Definition at line 344 of file NumeReNotebook.cpp.

References _guilang, DetachedLogger::debug(), g_logger, Language::get(), getEditor(), NumeReEditor::GetFileNameAndPath(), GetTabFromPoint(), VersionControlSystemManager::hasRevisions(), ID_MENU_CLOSEALL, ID_MENU_CLOSEOTHERS, ID_MENU_CLOSETAB, ID_MENU_OPEN_FOLDER, ID_MENU_RUN_FROM_TAB, ID_MENU_SHOW_REVISIONS_FROM_TAB, ID_MENU_SPLIT_TAB_H, ID_MENU_SPLIT_TAB_V, ID_MENU_UNSPLIT_TAB, isSplit(), m_top_parent, NumeReWindow::SetIntVar(), toString(), and VN_CLICKEDTAB.

Here is the call graph for this function:

◆ OnTabScroll()

void EditorNotebook::OnTabScroll ( wxMouseEvent &  event)

Scrolls through the notebook pages, if the user hovers over the tabs and uses the mouse wheel.

Parameters
eventwxMouseEvent&
Returns
void

Definition at line 419 of file NumeReNotebook.cpp.

◆ OnUnsplit()

void EditorNotebook::OnUnsplit ( wxSplitterEvent &  event)

Event handler, if the user drags the sash to the outermost edge.

Parameters
eventwxSplitterEvent&
Returns
void

Definition at line 330 of file NumeReNotebook.cpp.

◆ SetShowPathsOrIconsOnTabs()

void EditorNotebook::SetShowPathsOrIconsOnTabs ( bool  showText,
bool  showIcons 
)

This member function enables/disables the relative paths or icons on the tab and refreshes the tab texts automatically.

Parameters
showTextbool
showIconsbool
Returns
void

Definition at line 71 of file NumeReNotebook.cpp.

References getEditor(), NumeReEditor::GetFileNameAndPath(), m_showIconsOnTabs, m_showPathsOnTabs, and SetTabText().

Referenced by NumeReWindow::EvaluateOptions().

Here is the call graph for this function:

◆ SetTabText()

void EditorNotebook::SetTabText ( size_t  nTab,
const wxString &  text 
)

Set a text for the selected editor tab. Note that this function expects a filepath.

Parameters
nTabsize_t
textconst wxString&
Returns
void

Definition at line 96 of file NumeReNotebook.cpp.

References _guilang, Language::get(), IconManager::GetIconIndex(), NumeReWindow::getPathDefs(), LOADPATH, m_manager, m_showIconsOnTabs, m_showPathsOnTabs, m_top_parent, PATH_LAST, replacePathSeparator(), shortenFileName(), and toUpperCase().

Referenced by NumeReWindow::NewFile(), NumeReWindow::OpenSourceFile(), NumeReWindow::SaveTab(), SetShowPathsOrIconsOnTabs(), and NumeReWindow::UpdateLocationIfOpen().

Here is the call graph for this function:

◆ SetTopParent()

void EditorNotebook::SetTopParent ( NumeReWindow window)
inline

Definition at line 28 of file NumeReNotebook.h.

References m_top_parent.

Referenced by NumeReWindow::NumeReWindow().

◆ split()

void EditorNotebook::split ( size_t  pageNum,
bool  horizontal 
)

Split the current editor horizontally or vertically (depending on the flag), if it is not already splitted.

Parameters
pageNumsize_t
horizontalbool
Returns
void

Definition at line 241 of file NumeReNotebook.cpp.

References NumeReDropTarget::EDITOR, NumeReEditor::FoldAll(), NumeReEditor::GetFileName(), Options::GetFoldDuringLoading(), NumeReWindow::getOptions(), NumeReEditor::getSettings(), GenericTerminal::getSyntax(), NumeReWindow::getTerminal(), m_top_parent, NumeReEditor::SetFilename(), NumeReEditor::ToggleSettings(), and NumeReEditor::UpdateSyntaxHighlighting().

Referenced by NumeReWindow::OnMenuEvent().

Here is the call graph for this function:

◆ unsplit()

void EditorNotebook::unsplit ( size_t  pageNum)

Remove the splitted view.

Parameters
pageNumsize_t
Returns
void

Definition at line 286 of file NumeReNotebook.cpp.

Referenced by NumeReWindow::OnMenuEvent().

Member Data Documentation

◆ m_manager

IconManager* EditorNotebook::m_manager
private

Definition at line 59 of file NumeReNotebook.h.

Referenced by SetTabText().

◆ m_mouseFocus

bool EditorNotebook::m_mouseFocus
private

Definition at line 61 of file NumeReNotebook.h.

Referenced by GetMouseFocus(), OnEnter(), and OnLeave().

◆ m_showIconsOnTabs

bool EditorNotebook::m_showIconsOnTabs
private

Definition at line 63 of file NumeReNotebook.h.

Referenced by SetShowPathsOrIconsOnTabs(), and SetTabText().

◆ m_showPathsOnTabs

bool EditorNotebook::m_showPathsOnTabs
private

Definition at line 62 of file NumeReNotebook.h.

Referenced by SetShowPathsOrIconsOnTabs(), and SetTabText().

◆ m_top_parent

NumeReWindow* EditorNotebook::m_top_parent
private

The documentation for this class was generated from the following files: