1#ifndef CHAMELEONWINDOW__H
2#define CHAMELEONWINDOW__H
17#include <wx/treectrl.h>
18#include <wx/aui/auibook.h>
19#include <wx/snglinst.h>
26#include "../common/datastructures.h"
27#include "../common/filewatcher.hpp"
28#include "../kernel/windowmanager.hpp"
29#include "../kernel/core/ui/language.hpp"
30#include "../kernel/core/utils/tools.hpp"
31#include "../kernel/core/plotting/graph_helper.hpp"
32#include "../kernel/core/datamanagement/container.hpp"
33#include "../kernel/core/datamanagement/table.hpp"
42#define OPENFILE_NOTHING 0
43#define OPENFILE_BLACKLIST_ADD 1
44#define OPENFILE_BLACKLIST_REMOVE 2
45#define OPENFILE_FORCE 4
108class WindowPointerArray;
110class wxSplitterWindow;
117class wxNotebookEvent;
118class wxSplitterEvent;
124class VariableWatchPanel;
127class CompilerOutputPanel;
130class wxCHMHelpController;
154 virtual bool OnInit()
override;
155 virtual int OnExit()
override;
179 NumeReWindow(
const wxString& title,
const wxPoint& pos,
const wxSize& size);
183 void SetIntVar(
int variableName,
int value);
187 void ShowRevision(
const wxString& revisionName,
const wxString& revisionContent);
193 void openPDF(wxFileName filename);
194 bool ShowHelp(
const wxString& sDocId);
195 void openHTML(wxString HTMLcontent);
200 void showTable(
const wxString& tableName,
const wxString& tableDisplayName);
202 void pass_command(
const wxString& command,
bool isEvent =
false);
234 bool GetFileContents(wxString fileToLoad, wxString &fileContents, wxString &fileName);
288 void OnClose(wxCloseEvent& event);
289 void Test(wxCommandEvent& event);
293 void OnIdle(wxIdleEvent &event);
327 bool SaveAll(
bool refreshLibrary);
328 void CloseFile(
int pageNr = -1,
bool askforsave =
true);
335 int GetPageNum(wxFileName fn,
bool compareWholePath =
true,
int startingTab = 0);
342 int FindString(
const wxString &findString,
int start_pos = -1,
int flags = -1,
bool highlight =
TRUE);
343 int ReplaceAllStrings(
const wxString &findString,
const wxString &replaceString,
int flags = -1);
486 DECLARE_EVENT_TABLE()
This class implements the DDE server for the first (main) NumeRe instance.
This class represents the notebook containing all editors of one main pane.
This class handles the internal language system and returns the language strings of the selected lang...
This class represents the application controller, which will create the main frame of the actual appl...
virtual bool OnExceptionInMainLoop() override
This handler should be called, if an unhandled exception propagated through the event loop....
DDE::Server * m_DDEServer
virtual bool OnInit() override
"Main program" equivalent: the program execution "starts" here. If we detect an already instance of N...
wxSingleInstanceChecker * m_singlinst
~MyApp()
Empty destructor.
virtual int OnExit() override
Called on application shut down. Will free the memory of the IPC class instances.
This data container is a copy- efficient table to interchange data between Kernel and GUI.
This class represents an abstract window handled by the window manager.
The class of the editor window.
The terminal class for the GUI. It's a specialisation of the GenericTerminal.
This class is the actual NumeRe main frame. The application's logic is implemented here.
wxString m_filterNPRCFiles
void editTable(NumeRe::Container< std::string > _stringTable, const std::string &tableDisplayName)
This member function displays the contents of the "string()" table or a cluster and enables editing i...
void OnStatusTimer(wxTimerEvent &event)
std::vector< std::string > GetDocIndex()
This member function returns the documentation index as a vector.
void EvaluateTab()
This member function executes the contents of the editor page connected to the selected tab.
void AddToHistory(const wxString &sCommand)
This function is a wrapper for the corresponding function from the history widget and stores the pass...
void OnPrintPreview()
This member function displays the styled text of the current editor in the print preview window.
void LoadFilesToTree(wxString fromPath, FileFilterType fileType, wxTreeItemId treeid)
This member function loads the file details to the file tree.
void deleteFile()
This member function moves the selected file from the file tree directly to the Windows trash bin,...
void OnPageChange(wxAuiNotebookEvent &event)
void Test(wxCommandEvent &event)
void addToReloadBlackList(const wxString &sFilename)
This member function adds the passed file name to the list of files, which shall not be reloaded auto...
void OnShowRevisions()
This method displays the revision dialog for the selected tree item.
wxString m_filterSupportedFiles
void unregisterWindow(wxWindow *window)
Removes the passed window form the internal window list (only if it exists).
void NewFile(FileFilterType _filetype=FILE_NONSOURCE, const wxString &defaultfilename="")
void OpenFileByType(const wxFileName &filename)
This member function opens the file with the passed name in the corresponding widget (either editor,...
void insertCopiedFile()
This member function copies the selected file in the file tree to the target location in the file tre...
void Ready()
This member function tells NumeRe that it shall display the "ready" state to the user.
wxString m_filterNonsource
void OnTagCurrentRevision()
This method allows the user to tag the current active revision of a file.
std::vector< wxString > vReloadBlackList
void showTable(const wxString &tableName, const wxString &tableDisplayName)
This member function is a wrapper for an event handler of the variable viewer to display the contents...
wxTreeItemId m_copiedTreeItem
void CloseOtherTabs()
This member function closes all other editor tabs except of the current selected one.
void UpdatePackageMenu()
Updates the package menu after an installation.
void OnCopyAsPath()
The member function copies the path of the selected tree item to the clipboard, so that it can be ins...
void showConsole()
This member function unhides the terminal, if it was hidden before.
MyTipProvider * tipProvider
void CreateProcedureTree(const std::string &sProcedurePath)
This member function finds every procedure in the default search path and adds them to the syntax aut...
bool GetFileContents(wxString fileToLoad, wxString &fileContents, wxString &fileName)
wxString getTreePath(const wxTreeItemId &itemId)
This member function returns the paths connected to a specific file or directory in the file tree.
wxRect DeterminePrintSize()
void OnRemoveFolder()
This member function moves the selected directory directly to the Windows trash bin,...
wxString m_filterNumeReFiles
void PassImageList(wxImageList *imagelist)
void OnOpenInExplorer()
This member function uses the Windows shell to open the selected folder in the Windows explorer.
void UpdateTerminalNotebook()
wxString ConstructFilterString(FileFilterType filterType)
void SetIntVar(int variableName, int value)
wxString m_filterNLYTFiles
void openTable(NumeRe::Container< std::string > _stringTable, const std::string &tableDisplayName, const std::string &sIntName)
This member function displays the contents of the "string()" table or a cluster.
void FindAndOpenProcedure(const wxString &procedureName)
Wrapper for the corresponding function of the editor.
void OnTreeItemActivated(wxTreeEvent &event)
void showWindow(NumeRe::Window &window)
This public member function handles the creation of windows requested by the kernel.
void OnPluginMenuEvent(wxCommandEvent &event)
Handles events, which originate from package menu (i.e. graphical plugins).
void OnOpenSourceFile(int id)
This member function opens a file dialog to let the user choose the files to open in the editor.
void Busy()
This member function tells NumeRe that it shall display the "busy" state to the user.
void runLaTeX()
This member function creates the LaTeX documentation files and uses the Windows shell to run the XeLa...
void notifyInstallationDone()
Notifies all instances of the PackagRepoBrowser to refresh its internal list of installed packages an...
std::vector< std::string > getPathDefs()
This member function returns the standard path definitions as a vector.
void compileLaTeX()
This function runs the XeLaTeX compiler on the TeX source in the current editor (if it is a TeX sourc...
VariableWatchPanel * m_watchPanel
bool ShowHelp(const wxString &sDocId)
This member function displays the help page for the selected documentation ID.
wxString m_filterTeXSource
void openImage(wxFileName filename)
This member function opens the selected image in the image viewer window.
FileFilterType m_projectSelectedFolderType
IconManager * m_iconManager
wxTreeItemId m_dragDropSourceItem
void forceHistoryPageDown()
This member function is a simple helper to force that the history displays the last line at start-up.
void OpenSourceFile(wxArrayString fnames, unsigned int nLine=0, int nOpenFileFlag=OPENFILE_NOTHING)
Opens the given list of source files in the editor.
ProcedureViewer * m_procedureViewer
void removeFromReloadBlackList(const wxString &sFilename)
This member function removes the passed file name from the list of files, which shall not be reloaded...
FileTree * m_functionTree
wxString m_filterImageFiles
void OnTreeDragDrop(wxTreeEvent &event)
This member function prepares the data to be dragged from one of the both trees.
CompilerOutputPanel * m_outputPanel
std::map< wxWindow *, WindowType > m_openedWindows
void OnFindReplace(int id)
This member function displays the find and replace dialog.
void OnAskForNewFile()
This member function catches the new file toolbar button and asks the user for a specific file type.
void ShowRevision(const wxString &revisionName, const wxString &revisionContent)
This member function creates a new editor page and copies the passed revision contents to this page.
std::string m_UnrecoverableFiles
void setViewerFocus()
This member function focuses the last opened ImageViewer window.
int CopyEditorSettings(FileFilterType _fileType)
This member function returns the settings from the current editor for the passed FileFilterType.
void OnShowRevisionsFromTab()
This method displays the revision dialog for the selected tab item.
void InitializeProgramOptions()
This member function loads the configuration file available for the graphical user interface.
TreePanel * m_functionPanel
void showListDialog(NumeRe::Window &window)
This private member function shows a list dialog.
void prepareFunctionTree()
This member function creates the contents of the symbols tree.
std::vector< std::string > getFileForInstaller(const std::string &sLayoutFileName)
This member function obtains the contents of a file and transforms it to be used by an installer scri...
wxTreeItemId m_projectFileFolders[5]
NumeReWindow(const wxString &title, const wxPoint &pos, const wxSize &size)
NumeReEditor * GetCurrentEditor()
Public access method for accessing the currently viewed editor. Does only return a pointer to the top...
std::map< size_t, std::string > m_pluginMenuMap
void PageHasChanged(int pageNr=-1)
int ReplaceAllStrings(const wxString &findString, const wxString &replaceString, int flags=-1)
void OnTreeItemRightClick(wxTreeEvent &event)
wxTermContainer * m_debugTermContainer
void prepareSession()
This member function recreates the last session by reading the session file or creates a new empty se...
std::map< wxString, __time64_t > m_filesLastSaveTime
void showGraph(NumeRe::Window &window)
This private member function displays a graph.
void updateTipAtStartupSetting(bool bTipAtStartup)
This function can be used to deactivate the "Tip of the day" functionality directly from the dialog.
VariableViewer * m_varViewer
bool m_loadingFilesDuringStartup
ProportionalSplitterWindow * m_splitCommandHistory
void OnCompareFiles()
Event handler for comparing two files using the diff functionalities.
wxIcon getStandardIcon()
This public member function returns the default icon usable by different windows.
void showFileDialog(NumeRe::Window &window)
This private member function displays a file dialog.
wxTreeItemId getDragDropSourceItem()
This member function gets the drag-drop source item, if the source was the file tree.
ProportionalSplitterWindow * m_splitEditorOutput
void EvaluateCommandLine(wxArrayString &wxArgV)
This member function evaluates the command line passed to this application at startup and evaluates,...
void OnExecuteFile(const std::string &sFileName, int id)
This function executes the file in the current editor.
void UpdateVarViewer()
This member function gets the current variable list from the kernel and updates the variable viewer w...
wxString m_filterDataFiles
void toggleConsole()
This member function toggles the bottom part of the window containing the terminal and the list view ...
void OnClose(wxCloseEvent &event)
void OnTreeItemToolTip(wxTreeEvent &event)
This member function displays the tooltip requested for the item below the mouse cursor.
NumeReTerminal * getTerminal()
void OpenFilesFromList(const wxArrayString &filenameslist)
This member function opens a list of files depending on their type in the correct widget.
wxString getFileDetails(const wxFileName &filename)
This member function displays extended file informations of NDAT files, if this was enabled in the se...
bool isOnReloadBlackList(wxString sFilename)
This member function returns true, if the passed file name is currently part of the list of files,...
void OnOptions()
This member function displays the settings dialog and performs all necessary updates,...
void closeWindows(WindowType type=WT_ALL)
Close all windows of the selected WindowType or simply use WT_ALL to close all terminal-closable floa...
void OnIdle(wxIdleEvent &event)
void OnFileEventTimer(wxTimerEvent &event)
This member function handles the events from the file event timer.
void OnCalculateDependencies()
This member function runs the dependency calculating process in the procedure library.
void evaluateDebugInfo(const std::vector< std::string > &vDebugInfo)
This function will pass the obtained debugging information to the debug viewer. If this object does n...
int * SelectIntVar(int variableName)
wxString m_filterExecutableFiles
wxSplitterWindow * m_splitProjectEditor
int GetPageNum(wxFileName fn, bool compareWholePath=true, int startingTab=0)
void OpenContainingFolder()
This member function uses the Windows shell to open the containing folder of the selected tab in the ...
OptionsDialog * m_optionsDialog
wxTreeItemId m_clickedTreeItem
NumeReStatusbar * m_statusBar
void renameFile()
This member function renames the selected file in the file tree with a new name provided by the user ...
void DefaultPage()
This member function creates a new editor page and copies the contents of the default page template t...
void toggleFiletree()
This member function toggles the left sidebar of the window containing both trees.
std::map< int, wxMenuItem * > m_menuItems
bool m_currentlyDebugging
void pass_command(const wxString &command, bool isEvent=false)
This member function is a wrapper for the corresponding terminal function to pass a command to the ke...
ViewerFrame * m_currentView
void OnSplitterDoubleClick(wxSplitterEvent &event)
void OnSaveSourceFile(int id)
This member function saves the file in the current editor.
void showSelectionDialog(NumeRe::Window &window)
This private member function shows a selection dialog.
int GetIntVar(int variableName)
wxFindReplaceData m_findData
void toggleHistory()
This member function toggles the rightmost part of the lower window section containing the history an...
void OnPrintPage()
This member function prints the styled text of the current editor.
void ToolbarStatusUpdate()
NumeReHistory * m_history
void OnFindEvent(wxFindDialogEvent &event)
ProportionalSplitterWindow * m_watchPanelSplitter
void createLaTeXFile()
This member function uses the parsed contents from the current editor to create a new LaTeX file from...
wxString m_filterAllFiles
wxString getTreeFolderPath(const wxTreeItemId &itemId)
This member function returns the paths connected to a specific directory in the file tree.
NumeReTerminal * m_terminal
void CloseFile(int pageNr=-1, bool askforsave=true)
Closes a given editor, based on its index in the editor notebook.
DebugViewer * m_debugViewer
void setEditorFocus()
This member function focuses the editor widget.
void showDirDialog(NumeRe::Window &window)
This private member function displays a directory dialog.
wxPrintData * setDefaultPrinterSettings()
This member function sets the default printer settings.
int HandleModifiedFile(int pageNr, ModifiedFileAction fileAction)
Handle user interaction when closing or reloading an editor.
wxPanel * m_watchPanelContainer
void openPDF(wxFileName filename)
This member function opens a PDF document using the windows shell.
void gotoLine()
This member function opens a text entry dialog, where the user can enter the target line number,...
wxTimer * m_fileEventTimer
void OnPrintSetup()
This member function displays the printing page setup dialog.
void refreshFunctionTree()
This member function is a simple wrapper for refreshing the contents of the function tree.
void reloadFileIfOpen(const wxString &fname, bool force=false)
Reloads a file if it is open in any editor.
wxString getProgramFolder()
This member function returns the application's root path.
void UpdateWindowTitle(const wxString &filename)
This member function updates the application's window title using the current opened file's name.
void OnMenuEvent(wxCommandEvent &event)
void OnCreatePackage(const wxString &projectFile)
This member function launches the package creator dialog and creates the install file,...
void showMessageBox(NumeRe::Window &window)
This private member function displays a message box.
int FindString(const wxString &findString, int start_pos=-1, int flags=-1, bool highlight=TRUE)
void registerWindow(wxWindow *window, WindowType type)
Registers a new window in the internal map.
bool SaveAll(bool refreshLibrary)
Saves all currently opened files to the harddisk.
wxArrayString OpenFile(FileFilterType filterType)
void OnAbout()
This member function displays the "About" dialog.
void OnHelp()
This member function displays the help root page.
wxString GetDocContent(wxString docid)
This member function returns the HTML string containing the documentation for the selected topic/doc ...
void OnFileSystemEvent(wxFileSystemWatcherEvent &event)
This member function handles all events, which result from changes in the file system.
bool SaveTab(int tab)
Saves the file in the selected editor tab.
bool SaveCurrentFile(bool saveas)
Saves the current opened file.
void OnCreateNewFolder()
This member function creates a new folder below the currently selected folder. The name is supplied b...
wxString m_filterNSCRFiles
wxTermContainer * m_termContainer
void showTextEntry(NumeRe::Window &window)
This private member function displays a text entry dialog.
wxString addLinebreaks(const wxString &sLine)
This member function adds line break characters to the passed string to stick below a line length of ...
std::vector< std::pair< int, wxString > > m_modifiedFiles
void UpdateLocationIfOpen(const wxFileName &fname, const wxFileName &newFName)
Updates the editor's and notebook's filename location, if it already opened and not modified.
void CloseTab(bool force)
std::string prepareTooltip(const std::string &sTooltiptext)
This member function prepares the tooltip shown by the symbols tree.
void openHTML(wxString HTMLcontent)
This member function opens a HTML document (a documentation article) in the documentation viewer.
This class represents the settings dialog in memory.
This class implements an interface of the internal Settings object adapted to be usable from the GUI.
This class represents a splitter window, which can controlled using a floating point proportion inste...
This class generalizes a set of basic floating window functionalities like being closable by pressing...
WindowType
This enumeration defines all terminal- closable window types.