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

This class represents a dialog for creating a package from a set of procedures. More...

#include <packagedialog.hpp>

Inheritance diagram for PackageDialog:
Collaboration diagram for PackageDialog:

Public Member Functions

 PackageDialog (wxWindow *parent, NumeReTerminal *terminal, IconManager *icons)
 Constructor. More...
 
void loadProjectFile (const wxString &filename)
 Loads a NumeRe package project file to memory and updates the UI correspondingly. More...
 
void setMainFile (const wxString &mainfile)
 This function can be used to insert the current mainfile to the dialog. Used by the main window, if the user clicks on "Create package". More...
 
wxArrayString getProcedures ()
 This member function will create a string array containing the procedure files, which are currently part of the list view, and return them. More...
 
wxString getInstallInfo ()
 This member function will create the install information section of the package based upon the setted properties. More...
 
wxString getPackageName ()
 This member function returns the name of the package, as been set by the user. More...
 
wxString getPackageIdentifier ()
 This member function returns the package identifier, which is constructed from the name and only contains lowercase alphanumeric characters and the underscore. More...
 
wxString getPackageVersion ()
 Returns the version of the defined package as a simple string. More...
 
wxString getDocFile ()
 Returns the user-chosen documentation file. More...
 
bool includeDocs ()
 This member function returns whether the user selected the "include docs" property. More...
 
bool isPlugin ()
 This member function returns, whether the user selected a plugin type as install type. More...
 

Private Member Functions

void OnAutoDetect (wxCommandEvent &event)
 This is the event handler for the autodetect button. More...
 
void OnAddItems (wxCommandEvent &event)
 This is the event handler for the add files button. More...
 
void OnRemoveItems (wxCommandEvent &event)
 This is the event handler for the remove files button. More...
 
void OnLoadProjectFile (wxCommandEvent &event)
 Button event handler to load an existing project file. More...
 
void OnSaveProjectFile (wxCommandEvent &event)
 Button event handler to save a prepared package setting to a project file. More...
 
void OnCreatePackage (wxCommandEvent &event)
 Called upon clicking on "Create package" button. Will ask for saving the project. More...
 
void OnAbort (wxCommandEvent &event)
 Called upon clicking on "Cancel" button. Will ask for saving the project. More...
 
void OnPropGridChange (wxPropertyGridEvent &event)
 Event handler for all property grid changes. More...
 
void OnClose (wxCloseEvent &event)
 Event handler, which is called, when the user closes the dialog. More...
 
void SaveOnClose ()
 Evaluates, whether the current project has been saved and prompt the user a saving dialog, if not. More...
 
void autoDetect (const wxArrayString &mainfiles)
 This function autodetects the dependencies of the passed files by calling the PackageDialog::followBranch() function recursively. More...
 
void followBranch (const std::string &sFile, std::set< std::string > &fileSet)
 This function will recursively call itself to detect a whole branch of file dependencies. More...
 
void findLayoutDependencies (const std::string &sFile, std::set< std::string > &fileSet)
 This member function uses the event procedures of a window layout file to create a dependency tree for this layout. More...
 
void saveProjectFile (const wxString &filename)
 Saves a prepared package configuration as a NumeRe package project file to the HDD. More...
 
void markUnsaved ()
 Marks the current project as modified. More...
 
bool isSaved ()
 Returns true, if the current project is in a saved state. More...
 

Private Attributes

wxPropertyGrid * m_packageProperties
 
wxListView * m_fileList
 
NumeReTerminalm_terminal
 
IconManagerm_icons
 
bool m_isAutoIncrement
 

Detailed Description

This class represents a dialog for creating a package from a set of procedures.

Definition at line 36 of file packagedialog.hpp.

Constructor & Destructor Documentation

◆ PackageDialog()

PackageDialog::PackageDialog ( wxWindow *  parent,
NumeReTerminal terminal,
IconManager icons 
)

Constructor.

Parameters
parentwxWindow*
terminalNumeReTerminal*
iconsIconManager*

Definition at line 63 of file packagedialog.cpp.

References _guilang, GroupPanel::CreateButton(), GroupPanel::createGroup(), GroupPanel::CreateListView(), DOCFILE, g_pixelScale, Language::get(), ID_PKGDLG_ABORT, ID_PKGDLG_ADD, ID_PKGDLG_AUTODETECT, ID_PKGDLG_CREATEPACKAGE, ID_PKGDLG_LOADPROJECT, ID_PKGDLG_REMOVE, ID_PKGDLG_SAVEPROJECT, and INCLUDEDOCS.

Here is the call graph for this function:

Member Function Documentation

◆ autoDetect()

void PackageDialog::autoDetect ( const wxArrayString &  mainfiles)
private

This function autodetects the dependencies of the passed files by calling the PackageDialog::followBranch() function recursively.

Parameters
mainfilesconst wxArrayString&
Returns
void

Definition at line 453 of file packagedialog.cpp.

References findLayoutDependencies(), followBranch(), IconManager::GetIconIndex(), m_fileList, m_icons, markUnsaved(), replacePathSeparator(), and resolveIncludes().

Referenced by OnAutoDetect().

Here is the call graph for this function:

◆ findLayoutDependencies()

void PackageDialog::findLayoutDependencies ( const std::string &  sFile,
std::set< std::string > &  fileSet 
)
private

This member function uses the event procedures of a window layout file to create a dependency tree for this layout.

Parameters
sFileconst std::string&
fileSetstd::set<std::string>&
Returns
void

Definition at line 531 of file packagedialog.cpp.

References followBranch(), and getEventProcedures().

Referenced by autoDetect().

Here is the call graph for this function:

◆ followBranch()

void PackageDialog::followBranch ( const std::string &  sFile,
std::set< std::string > &  fileSet 
)
private

This function will recursively call itself to detect a whole branch of file dependencies.

Parameters
sFileconst std::string&
fileSetstd::set<std::string>&
Returns
void

Definition at line 497 of file packagedialog.cpp.

References followBranch(), ProcedureElement::getDependencies(), Dependencies::getDependencyMap(), NumeReTerminal::getKernel(), ProcedureLibrary::getProcedureContents(), NumeReKernel::getProcedureLibrary(), m_terminal, and replacePathSeparator().

Referenced by autoDetect(), findLayoutDependencies(), and followBranch().

Here is the call graph for this function:

◆ getDocFile()

wxString PackageDialog::getDocFile ( )

Returns the user-chosen documentation file.

Returns
wxString

Definition at line 934 of file packagedialog.cpp.

References DOCFILE, and m_packageProperties.

Referenced by NumeReWindow::OnCreatePackage().

◆ getInstallInfo()

wxString PackageDialog::getInstallInfo ( )

This member function will create the install information section of the package based upon the setted properties.

Returns
wxString

Definition at line 815 of file packagedialog.cpp.

References getPackageName(), isPlugin(), m_packageProperties, and sVersion.

Referenced by NumeReWindow::OnCreatePackage().

Here is the call graph for this function:

◆ getPackageIdentifier()

wxString PackageDialog::getPackageIdentifier ( )

This member function returns the package identifier, which is constructed from the name and only contains lowercase alphanumeric characters and the underscore.

Returns
wxString

Definition at line 892 of file packagedialog.cpp.

References getPackageName(), isPlugin(), and toLowerCase().

Referenced by NumeReWindow::OnCreatePackage(), OnLoadProjectFile(), OnSaveProjectFile(), and SaveOnClose().

Here is the call graph for this function:

◆ getPackageName()

wxString PackageDialog::getPackageName ( )

This member function returns the name of the package, as been set by the user.

Returns
wxString

Definition at line 871 of file packagedialog.cpp.

References m_packageProperties, and name.

Referenced by getInstallInfo(), getPackageIdentifier(), and NumeReWindow::OnCreatePackage().

◆ getPackageVersion()

wxString PackageDialog::getPackageVersion ( )

Returns the version of the defined package as a simple string.

Returns
wxString

Definition at line 919 of file packagedialog.cpp.

References m_packageProperties.

◆ getProcedures()

wxArrayString PackageDialog::getProcedures ( )

This member function will create a string array containing the procedure files, which are currently part of the list view, and return them.

Returns
wxArrayString

Definition at line 794 of file packagedialog.cpp.

References m_fileList.

Referenced by OnAutoDetect(), and NumeReWindow::OnCreatePackage().

◆ includeDocs()

bool PackageDialog::includeDocs ( )

This member function returns whether the user selected the "include docs" property.

Returns
bool

Definition at line 947 of file packagedialog.cpp.

References INCLUDEDOCS, and m_packageProperties.

Referenced by NumeReWindow::OnCreatePackage().

◆ isPlugin()

bool PackageDialog::isPlugin ( )

This member function returns, whether the user selected a plugin type as install type.

Returns
bool

Definition at line 961 of file packagedialog.cpp.

References m_packageProperties.

Referenced by getInstallInfo(), and getPackageIdentifier().

◆ isSaved()

bool PackageDialog::isSaved ( )
private

Returns true, if the current project is in a saved state.

Returns
bool

Definition at line 758 of file packagedialog.cpp.

Referenced by markUnsaved(), OnLoadProjectFile(), OnPropGridChange(), and SaveOnClose().

◆ loadProjectFile()

void PackageDialog::loadProjectFile ( const wxString &  filename)

Loads a NumeRe package project file to memory and updates the UI correspondingly.

Parameters
filenameconst wxString&
Returns
void

Definition at line 554 of file packagedialog.cpp.

References _guilang, tinyxml2::XMLElement::Attribute(), tinyxml2::XMLElement::BoolAttribute(), DOCFILE, fileExists(), tinyxml2::XMLNode::FirstChildElement(), Language::get(), IconManager::GetIconIndex(), tinyxml2::XMLElement::GetText(), incrementVersion(), tinyxml2::XMLDocument::LoadFile(), m_fileList, m_icons, m_isAutoIncrement, m_packageProperties, markUnsaved(), and tinyxml2::XMLNode::NextSiblingElement().

Referenced by NumeReWindow::OnCreatePackage(), and OnLoadProjectFile().

Here is the call graph for this function:

◆ markUnsaved()

void PackageDialog::markUnsaved ( )
private

Marks the current project as modified.

Returns
void

Definition at line 744 of file packagedialog.cpp.

References isSaved().

Referenced by autoDetect(), loadProjectFile(), OnAddItems(), OnRemoveItems(), and setMainFile().

Here is the call graph for this function:

◆ OnAbort()

void PackageDialog::OnAbort ( wxCommandEvent &  event)
private

Called upon clicking on "Cancel" button. Will ask for saving the project.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 345 of file packagedialog.cpp.

References SaveOnClose().

Here is the call graph for this function:

◆ OnAddItems()

void PackageDialog::OnAddItems ( wxCommandEvent &  event)
private

This is the event handler for the add files button.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 219 of file packagedialog.cpp.

References _guilang, Language::get(), IconManager::GetIconIndex(), NumeReTerminal::getPathSettings(), m_fileList, m_icons, m_terminal, markUnsaved(), PROCPATH, and replacePathSeparator().

Here is the call graph for this function:

◆ OnAutoDetect()

void PackageDialog::OnAutoDetect ( wxCommandEvent &  event)
private

This is the event handler for the autodetect button.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 197 of file packagedialog.cpp.

References autoDetect(), and getProcedures().

Here is the call graph for this function:

◆ OnClose()

void PackageDialog::OnClose ( wxCloseEvent &  event)
private

Event handler, which is called, when the user closes the dialog.

Parameters
eventwxCloseEvent&
Returns
void

Definition at line 377 of file packagedialog.cpp.

References SaveOnClose().

Here is the call graph for this function:

◆ OnCreatePackage()

void PackageDialog::OnCreatePackage ( wxCommandEvent &  event)
private

Called upon clicking on "Create package" button. Will ask for saving the project.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 330 of file packagedialog.cpp.

References SaveOnClose().

Here is the call graph for this function:

◆ OnLoadProjectFile()

void PackageDialog::OnLoadProjectFile ( wxCommandEvent &  event)
private

Button event handler to load an existing project file.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 282 of file packagedialog.cpp.

References _guilang, Language::get(), getPackageIdentifier(), NumeReTerminal::getPathSettings(), isSaved(), loadProjectFile(), m_terminal, saveProjectFile(), and SCRIPTPATH.

Here is the call graph for this function:

◆ OnPropGridChange()

void PackageDialog::OnPropGridChange ( wxPropertyGridEvent &  event)
private

Event handler for all property grid changes.

Parameters
eventwxPropertyGridEvent&
Returns
void

Definition at line 360 of file packagedialog.cpp.

References isSaved().

Here is the call graph for this function:

◆ OnRemoveItems()

void PackageDialog::OnRemoveItems ( wxCommandEvent &  event)
private

This is the event handler for the remove files button.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 259 of file packagedialog.cpp.

References m_fileList, and markUnsaved().

Here is the call graph for this function:

◆ OnSaveProjectFile()

void PackageDialog::OnSaveProjectFile ( wxCommandEvent &  event)
private

Button event handler to save a prepared package setting to a project file.

Parameters
eventwxCommandEvent&
Returns
void

Definition at line 312 of file packagedialog.cpp.

References _guilang, Language::get(), getPackageIdentifier(), NumeReTerminal::getPathSettings(), m_terminal, saveProjectFile(), and SCRIPTPATH.

Here is the call graph for this function:

◆ SaveOnClose()

void PackageDialog::SaveOnClose ( )
private

Evaluates, whether the current project has been saved and prompt the user a saving dialog, if not.

Returns
void

Definition at line 392 of file packagedialog.cpp.

References _guilang, Language::get(), getPackageIdentifier(), NumeReTerminal::getPathSettings(), isSaved(), m_terminal, saveProjectFile(), and SCRIPTPATH.

Referenced by OnAbort(), OnClose(), and OnCreatePackage().

Here is the call graph for this function:

◆ saveProjectFile()

void PackageDialog::saveProjectFile ( const wxString &  filename)
private

Saves a prepared package configuration as a NumeRe package project file to the HDD.

Parameters
filenameconst wxString&
Returns
void

Definition at line 649 of file packagedialog.cpp.

References _guilang, Language::get(), VersionControlSystemManager::getRevisions(), tinyxml2::XMLNode::InsertEndChild(), tinyxml2::XMLNode::InsertFirstChild(), m_fileList, m_isAutoIncrement, m_packageProperties, tinyxml2::XMLDocument::NewElement(), tinyxml2::XMLDocument::SaveFile(), tinyxml2::XMLElement::SetAttribute(), tinyxml2::XMLElement::SetText(), and sVersion.

Referenced by OnLoadProjectFile(), OnSaveProjectFile(), and SaveOnClose().

Here is the call graph for this function:

◆ setMainFile()

void PackageDialog::setMainFile ( const wxString &  mainfile)

This function can be used to insert the current mainfile to the dialog. Used by the main window, if the user clicks on "Create package".

Parameters
mainfileconst wxString&
Returns
void

Definition at line 774 of file packagedialog.cpp.

References IconManager::GetIconIndex(), m_fileList, m_icons, markUnsaved(), and replacePathSeparator().

Referenced by NumeReWindow::OnCreatePackage().

Here is the call graph for this function:

Member Data Documentation

◆ m_fileList

wxListView* PackageDialog::m_fileList
private

◆ m_icons

IconManager* PackageDialog::m_icons
private

Definition at line 42 of file packagedialog.hpp.

Referenced by autoDetect(), loadProjectFile(), OnAddItems(), and setMainFile().

◆ m_isAutoIncrement

bool PackageDialog::m_isAutoIncrement
private

Definition at line 43 of file packagedialog.hpp.

Referenced by loadProjectFile(), and saveProjectFile().

◆ m_packageProperties

wxPropertyGrid* PackageDialog::m_packageProperties
private

◆ m_terminal

NumeReTerminal* PackageDialog::m_terminal
private

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