www.pudn.com > TurboPadSource.tar.gz > parent.h


/** 
*    \class Parent 
*    MDI Parent Frame class 
* 
*    Parent frame class. Holds all Child frames, menus and the toolbar. 
*/ 
 
#ifndef Parent_H 
#define Parent_H 
 
class Parent; 
typedef Parent* PPtr; 
 
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
 
#include "child.h" 
#include "project.h" 
#include "syntax.h" 
#include "status.h" 
#include "template.h" 
#include "exec.h" 
#include "printout.h" 
#include "option.h" 
 
WX_DEFINE_ARRAY(CPtr, CPtrArray); 
 
class Parent : public wxMDIParentFrame 
{ 
    public: 
        Parent(wxWindow* parent, wxWindowID id, const wxString& title, 
               const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, 
               long style = wxDEFAULT_FRAME_STYLE); 
        ~Parent(); 
 
        void About(wxCommandEvent &event); 
        void AddToProj(wxCommandEvent &event); 
        #ifdef __WXMSW__ 
        void AlwaysOnTop(wxCommandEvent &event); 
        #endif 
        void Build(wxCommandEvent &event); 
        void CloseAll(wxCommandEvent &event); 
        void CloseChild(wxCommandEvent &event); 
        void CloseProj(wxCommandEvent &event); 
        void Comment(wxCommandEvent &event); 
        void Compile(wxCommandEvent &event); 
        void ConvertCRLF(wxCommandEvent &event); 
        void ConvertLF(wxCommandEvent &event); 
        void ConvertCR(wxCommandEvent &event); 
        void Copy(wxCommandEvent &event); 
        void Cut(wxCommandEvent &event); 
        void Exit(wxCommandEvent &event); 
        void Find(wxCommandEvent &event); 
        void FindAgain(wxCommandEvent &event); 
        void FindButton(wxFindDialogEvent &event); 
        void FindClose(wxFindDialogEvent &event); 
        void FindNext(wxFindDialogEvent &event); 
        void FindPrevious(wxCommandEvent &event); 
        void GoToLine(wxCommandEvent &event); 
        void Help(wxCommandEvent &event); 
        void Indent(wxCommandEvent &event); 
        void InsDT(wxCommandEvent &event); 
        void InsTemplate(wxCommandEvent &event); 
        void Lower(wxCommandEvent &event); 
        void MatchBrace(wxCommandEvent &event); 
        void NewProj(wxCommandEvent &event); 
        void NextBookMark(wxCommandEvent &event); 
        void OnHighlighterChange(wxCommandEvent &event); 
        void OnWindowClose(wxCloseEvent& event); 
        void Open(wxCommandEvent &event); 
        void OpenProject(wxCommandEvent &event); 
        void PageSetup(wxCommandEvent &event); 
        void Paste(wxCommandEvent &event); 
        void PreviousBookMark(wxCommandEvent &event); 
        void Print(wxCommandEvent &event); 
        void PrintPreview(wxCommandEvent &event); 
        void ReadOnly(wxCommandEvent &event); 
        void Redo(wxCommandEvent &event); 
        void RemoveBookMarks(wxCommandEvent &event); 
        void Replace(wxCommandEvent &event); 
        void ReplaceAll(wxFindDialogEvent &event); 
        void ReplaceSel(wxFindDialogEvent &event); 
        void Run(wxCommandEvent &event); 
        void Save(wxCommandEvent &event); 
        void SaveAll(wxCommandEvent &event); 
        void SaveAs(wxCommandEvent &event); 
        void SelAll(wxCommandEvent &event); 
        void SortText(wxCommandEvent &event); 
        void ToggleBookMark(wxCommandEvent &event); 
        void Undo(wxCommandEvent &event); 
        void Unindent(wxCommandEvent &event); 
        void Update(wxCommandEvent &event); 
        void Upper(wxCommandEvent &event); 
        void UseTabs(wxCommandEvent &event); 
        void WordWrap(wxCommandEvent &event); 
 
        inline CPtr CreateChild(const wxString &title = ""); 
 
        inline void NewFile(wxCommandEvent &event); 
        inline void OpenFile(const wxString &fileName); 
        inline void OpenFiles(const wxArrayString &files); 
 
        inline wxString GetHil() { return hlt->GetStringSelection(); } 
        void ChangeHil(const wxString &hil) {hlt->SetStringSelection(hil); } 
        void SetHil(const wxString &hil, bool load = true); 
 
        inline CPtr GetCWin() { return cWin; } 
        inline void SetCWin(CPtr newCWin) { cWin = newCWin; } 
 
        inline CPtrArray& GetFrames() { return cFrames; } 
        inline int GetFCount() { return cFrames.GetCount(); } 
 
        inline void AddFrame(CPtr frame) { cFrames.Add(frame); } 
        inline void RemoveFrame(CPtr frame) { cFrames.Remove(frame); } 
 
        inline Project* GetProject() { return proj; } 
        inline Status* GetWindowStatus() { return status; } 
        inline Syntax* GetSyntax() { return syn; } 
 
        inline void EnableMenus(bool enable = true); 
        inline void UpdateMenus(); 
 
    private: 
        void LoadHil (const wxString &hil); 
        wxString HilFromName (wxString fileName); 
 
        inline void InitToolbar(); 
        inline void InitMenus(); 
 
        bool Exec(const wxString &fileName, int execNum); 
        int GetHighlighterIndex(); 
 
        void ShowError(const wxString &error = "", const wxString &title = ""); 
 
        CPtr cWin;              ///< Pointer to the current child frame 
        CPtrArray cFrames;      ///< Pointer array of child frames 
 
        Project *proj; 
        Status *status; 
        Syntax *syn; 
        Options *opt; 
 
        wxPrintData *pData; 
        wxPageSetupDialogData *psData; 
 
        wxFindReplaceData *fData; 
        wxFindReplaceData *rData; 
        wxFindReplaceDialog *fDialog; 
        wxFindReplaceDialog *rDialog; 
 
        wxMenuBar *menuBar; 
 
        wxMenu *editMenu; 
        wxMenu *fileMenu; 
        wxMenu *formatMenu; 
        wxMenu *helpMenu; 
        wxMenu *optionsMenu; 
        wxMenu *projectMenu; 
        wxMenu *searchMenu; 
        wxMenu *toolsMenu; 
        wxMenu *viewMenu; 
 
        wxMenu *exportMenu; 
        wxMenu *insertMenu; 
        wxMenu *lineEndingMenu; 
 
        wxToolBar *toolBar; 
        wxChoice *hlt; 
 
        DECLARE_EVENT_TABLE() 
}; 
 
static const wxString Types = 
( 
    "All files (*.*)|*.*|" 
    "C/C++ files (*.cpp, *.c, *.cc, *.cp, *.h, *.hpp)|*.c; *.cc; *.cxx; *.cp; *.hpp; *.h; *.cpp|" 
    "Config Files (*.cfg, *.ini, *.reg)|*.reg; *.cfg; *.ini|" 
    "Dos Batch files (*.bat)|*.bat|" 
    "Fortran files (*.for)|*.for|" 
    "HTML files (*.html, *.htm, *.asp, *.shtml)|*.htm; *.asp; *.shtml; *.html|" 
    "Java files (*.java)|*.java|" 
    "Javascript files (*.js)|*.js|" 
    "Make files (Mak*, mak*)|mak*; Mak*|" 
    "Pascal files (*.pas, *.dpr, *.dpk, *.inc, *.pp)|*.dpr; *.dpk; *.inc; *.pp; *.pas|" 
    "Perl files (*.pl, *.pm, *.cgi)|*.pm; *.cgi; *.pl|" 
    "PHP files (*.php, *php3, *.phtml)|*.php3; *.phtml; *.php|" 
    "Python files (*.py)|*.py|" 
    "Ruby files (*.rb, *.rbw)|*.rbw; *.rb|" 
    "SQL files (*.sql)|*.sql|" 
    "TCL/TK files (*.tcl)|*.tcl|" 
    "Text files (*.txt, *.log)|*.log; *.txt|" 
    "Visual Basic files (*.bas, *.vbs, *.frm, *.cls)|*.vbs; *.frm; *.cls; *.bas|" 
    "Windows Resource files (*.rc)|*.rc|" 
    "X86 Assembler files (*.asm)|*.asm|" 
    "XML documents (*.xml, *.xsd, *.xsl, *.xslt)|*.xsd; *.xsl; *.xslt; *.xml|" 
); 
 
static const wxString PrjTypes = 
( 
    "Project Files (*.prj)|*.prj|" 
    "All files (*.*)|*.*|" 
); 
 
enum 
{ 
    Par_About = wxID_HIGHEST + 1, 
    Par_AddProj, 
    #ifdef __WXMSW__ 
    Par_AlwaysTop, 
    #endif 
    Par_Build, 
    Par_Close, 
    Par_CloseAll, 
    Par_CloseProj, 
    Par_CodeTemps, 
    Par_Comment, 
    Par_Compile, 
    Par_ConvertLF, 
    Par_ConvertCR, 
    Par_ConvertCRLF, 
    Par_Copy, 
    Par_CustomHelp, 
    Par_Cut, 
    Par_EnvOptions, 
    Par_Exit, 
    Par_ExpHTML, 
    Par_Export, 
    Par_ExpRTF, 
    Par_Find, 
    Par_FindNex, 
    Par_FindPre, 
    Par_GoToLine, 
    Par_Help, 
    Par_Indent, 
    Par_InsDT, 
    Par_Insert, 
    Par_InsTempl, 
    Par_Lang, 
    Par_LineEndings, 
    Par_Lower, 
    Par_MatchBrace, 
    Par_NewFile, 
    Par_NewProj, 
    Par_NextBookMark, 
    Par_Open, 
    Par_OpenProj, 
    Par_Paste, 
    Par_PrevBookMark, 
    Par_Print, 
    Par_PrintPre, 
    Par_ProjOption, 
    Par_Ps, 
    Par_ReadOnly, 
    Par_Redo, 
    Par_Refresh, 
    Par_RemoveAllBookMarks, 
    Par_Replace, 
    Par_Run, 
    Par_Save, 
    Par_SaveAll, 
    Par_SaveAs, 
    Par_SelAll, 
    Par_SortText, 
    Par_ToDo, 
    Par_ToggleBookMark, 
    Par_Undo, 
    Par_Unindent, 
    Par_Update, 
    Par_Upper, 
    Par_UseTabs, 
    Par_WordWrap 
}; 
 
#endif