diff --git a/src/include/globals.h b/src/include/globals.h index 566dbb6551..c4023d71d2 100644 --- a/src/include/globals.h +++ b/src/include/globals.h @@ -260,12 +260,28 @@ extern DLLIMPORT bool cbResolveSymLinkedDirPath(wxString& dirpath); /// @return The resolved path or the same path if not a symlink. extern DLLIMPORT wxString cbResolveSymLinkedDirPathRecursive(wxString dirpath); +/** + * Return true if the indentation line endings should be consistent in the file, + * so you have to detect the line ending of the file you are editing. + * If the value is false use cbGetEOLStr(-1) go get the line ending. + */ +extern DLLIMPORT bool cbEnsureLineEndingConsistency(); + /** Reads settings if eolMode is -1 * Expected input (defined in sdk/wxscintilla/include/wx/wxscintilla.h) is: * wxSCI_EOL_CRLF=0, wxSCI_EOL_CR=1, or wxSCI_EOL_LF=2 */ extern DLLIMPORT wxString GetEOLStr(int eolMode = -1); +/** + * Return true if the indentation style should be detected automatically, or false if the indentation should be used like in the settings + */ +extern DLLIMPORT bool cbDetectTabStrAutomatically(); +/** + * Return the tab character as set in the settings. (\t or the set number of spaces) + */ +extern DLLIMPORT wxString cbGetTabStr(); + extern DLLIMPORT wxString URLEncode(const wxString &str); extern DLLIMPORT wxString ExpandBackticks(wxString &str); diff --git a/src/plugins/contrib/wxSmith/wxscoder.cpp b/src/plugins/contrib/wxSmith/wxscoder.cpp index b8c9524656..b117118216 100644 --- a/src/plugins/contrib/wxSmith/wxscoder.cpp +++ b/src/plugins/contrib/wxSmith/wxscoder.cpp @@ -271,11 +271,10 @@ void wxsCoder::FlushFile(const wxString& FileName) if ( Editor ) { - wxString EOL; while ( Changes ) { CodeChange* Next = Changes->Next; - ApplyChangesEditor(Editor,Changes->Header,Changes->End,Changes->Code,Changes->CodeHasHeader,Changes->CodeHasEnd,EOL); + ApplyChangesEditor(Editor,Changes->Header,Changes->End,Changes->Code,Changes->CodeHasHeader,Changes->CodeHasEnd); delete Changes; Changes = Next; } @@ -283,7 +282,6 @@ void wxsCoder::FlushFile(const wxString& FileName) else { // Reading file content - wxString EOL; bool HasChanged = false; //wxStopWatch SW; @@ -299,7 +297,7 @@ void wxsCoder::FlushFile(const wxString& FileName) while ( Changes ) { CodeChange* Next = Changes->Next; - ApplyChangesString(Content,Changes->Header,Changes->End,Changes->Code,Changes->CodeHasHeader,Changes->CodeHasEnd,HasChanged,EOL); + ApplyChangesString(Content,Changes->Header,Changes->End,Changes->Code,Changes->CodeHasHeader,Changes->CodeHasEnd,HasChanged); delete Changes; Changes = Next; } @@ -325,32 +323,65 @@ void wxsCoder::FlushFile(const wxString& FileName) CodeChanges[Index] = 0; } -bool wxsCoder::ApplyChangesEditor(cbEditor* Editor,const wxString& Header,const wxString& End,wxString& Code,bool CodeHasHeader,bool CodeHasEnd,wxString& EOL) +void wxsCoder::GetLineEndingIndentation(const wxString& line, wxString& indentation, wxString& lineending) { - cbStyledTextCtrl* Ctrl = Editor->GetControl(); - int FullLength = Ctrl->GetLength(); + const size_t length = line.length(); + // Fetching indentation + if(cbDetectTabStrAutomatically() && !line.IsEmpty() ) + { + wxString BaseIndentation; - if ( EOL.IsEmpty() ) + size_t IndentPos = length; + while ( --IndentPos >= 0 ) + { + wxChar ch = line.GetChar(IndentPos); + if ( (ch == _T('\n')) || (ch == _T('\r')) ) break; + } + while ( ++IndentPos < length ) + { + wxChar ch = line.GetChar(IndentPos); + BaseIndentation.Append( + ( ch == _T('\t') ) ? _T('\t') : _T(' ')); + } + + indentation = BaseIndentation; + } + else { + indentation = cbGetTabStr(); + } + + if ( cbEnsureLineEndingConsistency() && !line.IsEmpty() ) { // Detecting EOL style in source - for ( int i=0; iGetCharAt(i); + wxChar ch = line.GetChar(i); if ( ch==_T('\n') || ch==_T('\r') ) { - EOL = ch; - if ( ++i < FullLength ) + lineending = ch; + if ( ++i < length ) { - wxChar ch2 = Ctrl->GetCharAt(i); + wxChar ch2 = line.GetChar(i); if ( (ch2==_T('\n') || ch2==_T('\r')) && ch!=ch2 ) { - EOL.Append(ch2); + lineending.Append(ch2); } } break; } } } + else + { + lineending = GetEOLStr(-1); + } +} + + +bool wxsCoder::ApplyChangesEditor(cbEditor* Editor,const wxString& Header,const wxString& End,wxString& Code,bool CodeHasHeader,bool CodeHasEnd) +{ + cbStyledTextCtrl* Ctrl = Editor->GetControl(); + int FullLength = Ctrl->GetLength(); // Searching for beginning of section to replace Ctrl->SetSearchFlags(wxSCI_FIND_MATCHCASE); @@ -366,6 +397,10 @@ bool wxsCoder::ApplyChangesEditor(cbEditor* Editor,const wxString& Header,const return false; } + wxString EOL; + wxString tab; + GetLineEndingIndentation(Ctrl->GetLine(Ctrl->LineFromPosition(Position)) , tab, EOL); + // Beginning of this code block is in Position, now searching for end Ctrl->SetTargetStart(Position); Ctrl->SetTargetEnd(FullLength); @@ -378,7 +413,6 @@ bool wxsCoder::ApplyChangesEditor(cbEditor* Editor,const wxString& Header,const return false; } - // Fetching indentation wxString BaseIndentation; int IndentPos = Position; @@ -393,8 +427,7 @@ bool wxsCoder::ApplyChangesEditor(cbEditor* Editor,const wxString& Header,const BaseIndentation.Append( ( ch == _T('\t') ) ? _T('\t') : _T(' ')); } - - Code = RebuildCode(BaseIndentation,Code.c_str(),(int)Code.Length(),EOL); + Code = RebuildCode(BaseIndentation, Code.c_str(),(int)Code.Length(), EOL, tab); // Fixing up positions to contain or not header / ending sequence if ( !CodeHasHeader ) Position += Header.Length(); @@ -423,32 +456,11 @@ bool wxsCoder::ApplyChangesEditor(cbEditor* Editor,const wxString& Header,const return true; } -bool wxsCoder::ApplyChangesString(wxString& BaseContent,const wxString& Header,const wxString& End,wxString& Code,bool CodeHasHeader,bool CodeHasEnd,bool& HasChanged,wxString& EOL) +bool wxsCoder::ApplyChangesString(wxString& BaseContent,const wxString& Header,const wxString& End,wxString& Code,bool CodeHasHeader,bool CodeHasEnd,bool& HasChanged) { wxString Content = BaseContent; - if ( EOL.IsEmpty() ) - { - // Detecting EOL in this sources - for ( size_t i=0; iGetConfigManager(_T("editor"))->ReadBool(_T("/use_tab"), false); - int TabSize = Manager::Get()->GetConfigManager(_T("editor"))->ReadInt(_T("/tab_size"), 4); - if ( !UseTab ) - { - Tab.Append(_T(' '),TabSize); - } + const bool UseTab = tab == _("\t"); if ( EOL.IsEmpty() ) EOL = GetEOLStr(); @@ -535,7 +546,7 @@ wxString wxsCoder::RebuildCode(wxString& BaseIndentation,const wxChar* Code,int Result << BaseIndentation; break; } - case _T('\t'): if ( UseTab ) { Result << Tab; break; } + case _T('\t'): if ( !UseTab ) { Result << tab; break; } default: Result << *Code; } diff --git a/src/plugins/contrib/wxSmith/wxscoder.h b/src/plugins/contrib/wxSmith/wxscoder.h index 41fa23d442..13d71e5d11 100644 --- a/src/plugins/contrib/wxSmith/wxscoder.h +++ b/src/plugins/contrib/wxSmith/wxscoder.h @@ -91,6 +91,12 @@ class wxsCoder: public wxEvtHandler /** \brief Function getting singleton object from system */ static wxsCoder* Get() { return Singleton; } + /** \brief detect the tab style (indentation) and line ending of the line */ + static void GetLineEndingIndentation(const wxString& line, wxString& indentation, wxString& lineending); + + /** \brief Rebuilding code to support current editor settings */ + static wxString RebuildCode(wxString& BaseIndentation, const wxChar* Code, int CodeLen, wxString EOL, const wxString& tab); + private: /** \brief Structure which contains one data change */ @@ -124,8 +130,7 @@ class wxsCoder: public wxEvtHandler const wxString& End, wxString& Code, bool CodeHasHeader, - bool CodeHasEnd, - wxString& EOL); + bool CodeHasEnd); /** \brief Applying changes to string (file's content) */ bool ApplyChangesString( @@ -135,8 +140,7 @@ class wxsCoder: public wxEvtHandler wxString& Code, bool CodeHasHeader, bool CodeHasEnd, - bool& HasChanged, - wxString& EOL); + bool& HasChanged); /** \brief Flushing all changes for given file */ void FlushFile(const wxString& FileName); @@ -147,9 +151,6 @@ class wxsCoder: public wxEvtHandler /** \brief Flush timer procedure */ void FlushTimerEvent(wxTimerEvent& event); - /** \brief Rebuilding code to support current editor settings */ - wxString RebuildCode(wxString& BaseIndentation,const wxChar* Code,int CodeLen,wxString& EOL); - /** \brief Cutting off given number of spaces at every new line */ wxString CutSpaces(wxString Code,int Count); diff --git a/src/plugins/contrib/wxSmith/wxwidgets/wxseventseditor.cpp b/src/plugins/contrib/wxSmith/wxwidgets/wxseventseditor.cpp index d67444ac1c..902915fd7c 100644 --- a/src/plugins/contrib/wxSmith/wxwidgets/wxseventseditor.cpp +++ b/src/plugins/contrib/wxSmith/wxwidgets/wxseventseditor.cpp @@ -429,17 +429,20 @@ bool wxsEventsEditor::CreateNewFunction(const wxsEventDesc* Event,const wxString return false; } + cbStyledTextCtrl* Ctrl = Editor->GetControl(); + int LineNumber = Ctrl->GetLineCount(); + wxString eof, tab; + wxsCoder::GetLineEndingIndentation(Ctrl->GetLine(LineNumber/2), tab, eof); // Get line endings form a random position in the editor control wxString NewFunctionCode; NewFunctionCode << - _T("\n") - _T("void ") << m_Class << _T("::") << NewFunctionName << _T("(") << Event->ArgType << _T("& event)\n") - _T("{\n") - _T("}\n"); + eof << + _T("void ") << m_Class << _T("::") << NewFunctionName << _T("(") << Event->ArgType << _T("& event)") << eof << + _T("{") << eof << + _T("}") << eof; // TODO: Replace line endings with propert string - cbStyledTextCtrl* Ctrl = Editor->GetControl(); - int LineNumber = Ctrl->GetLineCount(); + Ctrl->DocumentEnd(); Ctrl->AddText(NewFunctionCode); Editor->SetModified(); diff --git a/src/plugins/contrib/wxSmith/wxwidgets/wxsitemres.cpp b/src/plugins/contrib/wxSmith/wxwidgets/wxsitemres.cpp index f64b8f0ccb..49ed7a90a8 100644 --- a/src/plugins/contrib/wxSmith/wxwidgets/wxsitemres.cpp +++ b/src/plugins/contrib/wxSmith/wxwidgets/wxsitemres.cpp @@ -375,9 +375,9 @@ bool wxsItemRes::CreateNewResource(NewResourceParams& Params) } } Header.Replace(_T("$(HandlersScope)"),Scope); - - // TODO: Use wxsCoder to save file's content, so it will - // have proper encoding and EOL stuff + wxString Indentation, EOL, tab; + wxsCoder::GetLineEndingIndentation(wxEmptyString, tab, EOL); + Header = wxsCoder::RebuildCode(Indentation, Header.c_str(), Header.length(), EOL, tab); if ( !HdrFile.Write(Header) ) return false; } @@ -422,8 +422,9 @@ bool wxsItemRes::CreateNewResource(NewResourceParams& Params) SourceStr.Replace(_T("$(BaseClassName)"),Params.BaseClass); SourceStr.Replace(_T("$(CtorInit)"),CtorInitCode); SourceStr.Replace(_T("$(InternalHeadersPch)"),IntHeadersPch); - // TODO: Use wxsCoder to save file's content, so it will - // have proper encoding and EOL stuff + wxString Indentation, EOL, tab; + wxsCoder::GetLineEndingIndentation(wxEmptyString, tab, EOL); + SourceStr = wxsCoder::RebuildCode(Indentation, SourceStr.c_str(), SourceStr.length(), EOL, tab); if ( !SrcFile.Write(SourceStr) ) return false; } diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/common/app.cpp b/src/plugins/scriptedwizard/resources/wxwidgets/common/app.cpp index d9d7a2d9b2..ce6137168a 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/common/app.cpp +++ b/src/plugins/scriptedwizard/resources/wxwidgets/common/app.cpp @@ -22,11 +22,11 @@ IMPLEMENT_APP([CLASS_PREFIX]App); bool [CLASS_PREFIX]App::OnInit() { - [IF WXFRAME][CLASS_PREFIX]Frame* frame = new [CLASS_PREFIX]Frame(0L[IF NONE], _("wxWidgets Application Template")[ENDIF NONE]); - [IF WINDOWS]frame->SetIcon(wxICON(aaaa)); // To Set App Icon[ENDIF WINDOWS] - frame->Show();[ENDIF WXFRAME] - [IF WXDIALOG][CLASS_PREFIX]Dialog* dlg = new [CLASS_PREFIX]Dialog(0L[IF NONE], _("wxWidgets Application Template")[ENDIF NONE]); - [IF WINDOWS]dlg->SetIcon(wxICON(aaaa)); // To Set App Icon[ENDIF WINDOWS] - dlg->Show();[ENDIF WXDIALOG] - return true; + [IF WXFRAME][CLASS_PREFIX]Frame* frame = new [CLASS_PREFIX]Frame(0L[IF NONE], _("wxWidgets Application Template")[ENDIF NONE]); + [IF WINDOWS]frame->SetIcon(wxICON(aaaa)); // To Set App Icon[ENDIF WINDOWS] + frame->Show();[ENDIF WXFRAME] + [IF WXDIALOG][CLASS_PREFIX]Dialog* dlg = new [CLASS_PREFIX]Dialog(0L[IF NONE], _("wxWidgets Application Template")[ENDIF NONE]); + [IF WINDOWS]dlg->SetIcon(wxICON(aaaa)); // To Set App Icon[ENDIF WINDOWS] + dlg->Show();[ENDIF WXDIALOG] + return true; } diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/common/main.cpp b/src/plugins/scriptedwizard/resources/wxwidgets/common/main.cpp index b99fd1004f..4d2536c706 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/common/main.cpp +++ b/src/plugins/scriptedwizard/resources/wxwidgets/common/main.cpp @@ -19,69 +19,69 @@ //helper functions enum wxbuildinfoformat { - short_f, long_f }; + short_f, long_f }; wxString wxbuildinfo(wxbuildinfoformat format) { - wxString wxbuild(wxVERSION_STRING); + wxString wxbuild(wxVERSION_STRING); - if (format == long_f ) - { + if (format == long_f ) + { #if defined(__WXMSW__) - wxbuild << _T("-Windows"); + wxbuild << _T("-Windows"); #elif defined(__WXMAC__) - wxbuild << _T("-Mac"); + wxbuild << _T("-Mac"); #elif defined(__UNIX__) - wxbuild << _T("-Linux"); + wxbuild << _T("-Linux"); #endif #if wxUSE_UNICODE - wxbuild << _T("-Unicode build"); + wxbuild << _T("-Unicode build"); #else - wxbuild << _T("-ANSI build"); + wxbuild << _T("-ANSI build"); #endif // wxUSE_UNICODE - } + } - return wxbuild; + return wxbuild; } [IF WXFRAME][IF NONE]BEGIN_EVENT_TABLE([CLASS_PREFIX]Frame, wxFrame) - EVT_CLOSE([CLASS_PREFIX]Frame::OnClose) - EVT_MENU(idMenuQuit, [CLASS_PREFIX]Frame::OnQuit) - EVT_MENU(idMenuAbout, [CLASS_PREFIX]Frame::OnAbout) + EVT_CLOSE([CLASS_PREFIX]Frame::OnClose) + EVT_MENU(idMenuQuit, [CLASS_PREFIX]Frame::OnQuit) + EVT_MENU(idMenuAbout, [CLASS_PREFIX]Frame::OnAbout) END_EVENT_TABLE() [CLASS_PREFIX]Frame::[CLASS_PREFIX]Frame(wxFrame *frame, const wxString& title) - : wxFrame(frame, -1, title) + : wxFrame(frame, -1, title) { #if wxUSE_MENUS - // create a menu bar - wxMenuBar* mbar = new wxMenuBar(); - wxMenu* fileMenu = new wxMenu(_T("")); - fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application")); - mbar->Append(fileMenu, _("&File")); + // create a menu bar + wxMenuBar* mbar = new wxMenuBar(); + wxMenu* fileMenu = new wxMenu(_T("")); + fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application")); + mbar->Append(fileMenu, _("&File")); - wxMenu* helpMenu = new wxMenu(_T("")); - helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application")); - mbar->Append(helpMenu, _("&Help")); + wxMenu* helpMenu = new wxMenu(_T("")); + helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application")); + mbar->Append(helpMenu, _("&Help")); - SetMenuBar(mbar); + SetMenuBar(mbar); #endif // wxUSE_MENUS #if wxUSE_STATUSBAR - // create a status bar with some information about the used wxWidgets version - CreateStatusBar(2); - SetStatusText(_("Hello Code::Blocks user!"),0); - SetStatusText(wxbuildinfo(short_f), 1); + // create a status bar with some information about the used wxWidgets version + CreateStatusBar(2); + SetStatusText(_("Hello Code::Blocks user!"),0); + SetStatusText(wxbuildinfo(short_f), 1); #endif // wxUSE_STATUSBAR }[ENDIF NONE] [IF WXFB][CLASS_PREFIX]Frame::[CLASS_PREFIX]Frame(wxFrame *frame) - : GUIFrame(frame) + : GUIFrame(frame) { #if wxUSE_STATUSBAR - statusBar->SetStatusText(_("Hello Code::Blocks user!"), 0); - statusBar->SetStatusText(wxbuildinfo(short_f), 1); + statusBar->SetStatusText(_("Hello Code::Blocks user!"), 0); + statusBar->SetStatusText(wxbuildinfo(short_f), 1); #endif }[ENDIF WXFB] @@ -91,49 +91,49 @@ END_EVENT_TABLE() void [CLASS_PREFIX]Frame::OnClose(wxCloseEvent &event) { - Destroy(); + Destroy(); } void [CLASS_PREFIX]Frame::OnQuit(wxCommandEvent &event) { - Destroy(); + Destroy(); } void [CLASS_PREFIX]Frame::OnAbout(wxCommandEvent &event) { - wxString msg = wxbuildinfo(long_f); - wxMessageBox(msg, _("Welcome to...")); + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, _("Welcome to...")); }[ENDIF WXFRAME] [IF WXDIALOG][IF NONE]BEGIN_EVENT_TABLE([CLASS_PREFIX]Dialog, wxDialog) - EVT_CLOSE([CLASS_PREFIX]Dialog::OnClose) - EVT_BUTTON(idBtnQuit, [CLASS_PREFIX]Dialog::OnQuit) - EVT_BUTTON(idBtnAbout, [CLASS_PREFIX]Dialog::OnAbout) + EVT_CLOSE([CLASS_PREFIX]Dialog::OnClose) + EVT_BUTTON(idBtnQuit, [CLASS_PREFIX]Dialog::OnQuit) + EVT_BUTTON(idBtnAbout, [CLASS_PREFIX]Dialog::OnAbout) END_EVENT_TABLE() [CLASS_PREFIX]Dialog::[CLASS_PREFIX]Dialog(wxDialog *dlg, const wxString &title) - : wxDialog(dlg, -1, title) + : wxDialog(dlg, -1, title) { - this->SetSizeHints(wxDefaultSize, wxDefaultSize); - wxBoxSizer* bSizer1; - bSizer1 = new wxBoxSizer(wxHORIZONTAL); - m_staticText1 = new wxStaticText(this, wxID_ANY, wxT("Welcome To\nwxWidgets"), wxDefaultPosition, wxDefaultSize, 0); - m_staticText1->SetFont(wxFont(20, 74, 90, 90, false, wxT("Arial"))); - bSizer1->Add(m_staticText1, 0, wxALL|wxEXPAND, 5); - wxBoxSizer* bSizer2; - bSizer2 = new wxBoxSizer(wxVERTICAL); - BtnAbout = new wxButton(this, idBtnAbout, wxT("&About"), wxDefaultPosition, wxDefaultSize, 0); - bSizer2->Add(BtnAbout, 0, wxALL, 5); - m_staticline1 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL); - bSizer2->Add(m_staticline1, 0, wxALL|wxEXPAND, 5); - BtnQuit = new wxButton(this, idBtnQuit, wxT("&Quit"), wxDefaultPosition, wxDefaultSize, 0); - bSizer2->Add(BtnQuit, 0, wxALL, 5); - bSizer1->Add(bSizer2, 1, wxEXPAND, 5); - this->SetSizer(bSizer1); - this->Layout(); - bSizer1->Fit(this); + this->SetSizeHints(wxDefaultSize, wxDefaultSize); + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer(wxHORIZONTAL); + m_staticText1 = new wxStaticText(this, wxID_ANY, wxT("Welcome To\nwxWidgets"), wxDefaultPosition, wxDefaultSize, 0); + m_staticText1->SetFont(wxFont(20, 74, 90, 90, false, wxT("Arial"))); + bSizer1->Add(m_staticText1, 0, wxALL|wxEXPAND, 5); + wxBoxSizer* bSizer2; + bSizer2 = new wxBoxSizer(wxVERTICAL); + BtnAbout = new wxButton(this, idBtnAbout, wxT("&About"), wxDefaultPosition, wxDefaultSize, 0); + bSizer2->Add(BtnAbout, 0, wxALL, 5); + m_staticline1 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL); + bSizer2->Add(m_staticline1, 0, wxALL|wxEXPAND, 5); + BtnQuit = new wxButton(this, idBtnQuit, wxT("&Quit"), wxDefaultPosition, wxDefaultSize, 0); + bSizer2->Add(BtnQuit, 0, wxALL, 5); + bSizer1->Add(bSizer2, 1, wxEXPAND, 5); + this->SetSizer(bSizer1); + this->Layout(); + bSizer1->Fit(this); }[ENDIF NONE] [IF WXFB][CLASS_PREFIX]Dialog::[CLASS_PREFIX]Dialog(wxDialog *dlg) - : GUIDialog(dlg) + : GUIDialog(dlg) { }[ENDIF WXFB] @@ -143,16 +143,16 @@ END_EVENT_TABLE() void [CLASS_PREFIX]Dialog::OnClose(wxCloseEvent &event) { - Destroy(); + Destroy(); } void [CLASS_PREFIX]Dialog::OnQuit(wxCommandEvent &event) { - Destroy(); + Destroy(); } void [CLASS_PREFIX]Dialog::OnAbout(wxCommandEvent &event) { - wxString msg = wxbuildinfo(long_f); - wxMessageBox(msg, _("Welcome to...")); + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, _("Welcome to...")); }[ENDIF WXDIALOG] diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/common/main.h b/src/plugins/scriptedwizard/resources/wxwidgets/common/main.h index dbd8ad0bf4..24526c9774 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/common/main.h +++ b/src/plugins/scriptedwizard/resources/wxwidgets/common/main.h @@ -11,74 +11,74 @@ #define [PROJECT_HDR]MAIN_H [IF NONE]#ifndef WX_PRECOMP - #include + #include #endif[ENDIF NONE] #include "[FILENAME_PREFIX]App.h" [IF WXFRAME][IF NONE]class [CLASS_PREFIX]Frame: public wxFrame { - public: - [CLASS_PREFIX]Frame(wxFrame *frame, const wxString& title); - ~[CLASS_PREFIX]Frame(); - private: - enum - { - idMenuQuit = 1000, - idMenuAbout - }; - void OnClose(wxCloseEvent& event); - void OnQuit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - DECLARE_EVENT_TABLE() + public: + [CLASS_PREFIX]Frame(wxFrame *frame, const wxString& title); + ~[CLASS_PREFIX]Frame(); + private: + enum + { + idMenuQuit = 1000, + idMenuAbout + }; + void OnClose(wxCloseEvent& event); + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + DECLARE_EVENT_TABLE() };[ENDIF NONE] [IF WXFB]#include "GUIFrame.h" class [CLASS_PREFIX]Frame: public GUIFrame { - public: - [CLASS_PREFIX]Frame(wxFrame *frame); - ~[CLASS_PREFIX]Frame(); - private: - virtual void OnClose(wxCloseEvent& event); - virtual void OnQuit(wxCommandEvent& event); - virtual void OnAbout(wxCommandEvent& event); + public: + [CLASS_PREFIX]Frame(wxFrame *frame); + ~[CLASS_PREFIX]Frame(); + private: + virtual void OnClose(wxCloseEvent& event); + virtual void OnQuit(wxCommandEvent& event); + virtual void OnAbout(wxCommandEvent& event); };[ENDIF WXFB][ENDIF WXFRAME] [IF WXDIALOG][IF NONE]#include #include class [CLASS_PREFIX]Dialog: public wxDialog { - public: - [CLASS_PREFIX]Dialog(wxDialog *dlg, const wxString& title); - ~[CLASS_PREFIX]Dialog(); + public: + [CLASS_PREFIX]Dialog(wxDialog *dlg, const wxString& title); + ~[CLASS_PREFIX]Dialog(); - protected: - enum - { - idBtnQuit = 1000, - idBtnAbout - }; - wxStaticText* m_staticText1; - wxButton* BtnAbout; - wxStaticLine* m_staticline1; - wxButton* BtnQuit; + protected: + enum + { + idBtnQuit = 1000, + idBtnAbout + }; + wxStaticText* m_staticText1; + wxButton* BtnAbout; + wxStaticLine* m_staticline1; + wxButton* BtnQuit; - private: - void OnClose(wxCloseEvent& event); - void OnQuit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - DECLARE_EVENT_TABLE() + private: + void OnClose(wxCloseEvent& event); + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + DECLARE_EVENT_TABLE() };[ENDIF NONE] [IF WXFB]#include "GUIDialog.h" class [CLASS_PREFIX]Dialog: public GUIDialog { - public: - [CLASS_PREFIX]Dialog(wxDialog *dlg); - ~[CLASS_PREFIX]Dialog(); - private: - virtual void OnClose(wxCloseEvent& event); - virtual void OnQuit(wxCommandEvent& event); - virtual void OnAbout(wxCommandEvent& event); + public: + [CLASS_PREFIX]Dialog(wxDialog *dlg); + ~[CLASS_PREFIX]Dialog(); + private: + virtual void OnClose(wxCloseEvent& event); + virtual void OnQuit(wxCommandEvent& event); + virtual void OnAbout(wxCommandEvent& event); };[ENDIF WXFB][ENDIF WXDIALOG] #endif // [PROJECT_HDR]MAIN_H diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wizard.script b/src/plugins/scriptedwizard/resources/wxwidgets/wizard.script index 79b05df2d0..c179a782b9 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wizard.script +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wizard.script @@ -1286,6 +1286,9 @@ function SubstituteMacros(buffer) buffer.Replace(_T("[NOW]"), ReplaceMacros(_T("$(TODAY)"), false)); buffer.Replace(_T("[PCH_INCLUDE]"), PchInclude); + buffer.Replace(_T("\n"), GetEOLStr()); + buffer.Replace(_T("\t"), cbGetTabStr()); + return buffer; } diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.cpp b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.cpp index 02c7c6dd41..83b5539cd7 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.cpp +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.cpp @@ -19,38 +19,38 @@ /////////////////////////////////////////////////////////////////////////// BEGIN_EVENT_TABLE( GUIDialog, wxDialog ) - EVT_CLOSE( GUIDialog::_wxFB_OnClose ) - EVT_BUTTON( idBtnAbout, GUIDialog::_wxFB_OnAbout ) - EVT_BUTTON( idBtnQuit, GUIDialog::_wxFB_OnQuit ) + EVT_CLOSE( GUIDialog::_wxFB_OnClose ) + EVT_BUTTON( idBtnAbout, GUIDialog::_wxFB_OnAbout ) + EVT_BUTTON( idBtnQuit, GUIDialog::_wxFB_OnQuit ) END_EVENT_TABLE() GUIDialog::GUIDialog( wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer1; - bSizer1 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Welcome To\nwxWidgets"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->SetFont( wxFont( 20, 74, 90, 90, false, wxT("Arial") ) ); - - bSizer1->Add( m_staticText1, 0, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer2; - bSizer2 = new wxBoxSizer( wxVERTICAL ); - - BtnAbout = new wxButton( this, idBtnAbout, wxT("&About"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer2->Add( BtnAbout, 0, wxALL, 5 ); - - m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer2->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 ); - - BtnQuit = new wxButton( this, idBtnQuit, wxT("&Quit"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer2->Add( BtnQuit, 0, wxALL, 5 ); - - bSizer1->Add( bSizer2, 1, wxEXPAND, 5 ); - - this->SetSizer( bSizer1 ); - this->Layout(); - bSizer1->Fit( this ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Welcome To\nwxWidgets"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->SetFont( wxFont( 20, 74, 90, 90, false, wxT("Arial") ) ); + + bSizer1->Add( m_staticText1, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer2; + bSizer2 = new wxBoxSizer( wxVERTICAL ); + + BtnAbout = new wxButton( this, idBtnAbout, wxT("&About"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer2->Add( BtnAbout, 0, wxALL, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer2->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 ); + + BtnQuit = new wxButton( this, idBtnQuit, wxT("&Quit"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer2->Add( BtnQuit, 0, wxALL, 5 ); + + bSizer1->Add( bSizer2, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer1 ); + this->Layout(); + bSizer1->Fit( this ); } diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.h b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.h index 495f2106c6..2aea14ca9f 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.h +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/dialog/GUIDialog.h @@ -29,36 +29,36 @@ /////////////////////////////////////////////////////////////////////////////// class GUIDialog : public wxDialog { - DECLARE_EVENT_TABLE() - private: - - // Private event handlers - void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); } - void _wxFB_OnAbout( wxCommandEvent& event ){ OnAbout( event ); } - void _wxFB_OnQuit( wxCommandEvent& event ){ OnQuit( event ); } - - - protected: - enum - { - idBtnAbout = 1000, - idBtnQuit, - }; - - wxStaticText* m_staticText1; - wxButton* BtnAbout; - wxStaticLine* m_staticline1; - wxButton* BtnQuit; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } - virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } - virtual void OnQuit( wxCommandEvent& event ){ event.Skip(); } - - - public: - GUIDialog( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("wxWidgets Application Template"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxDEFAULT_DIALOG_STYLE ); - + DECLARE_EVENT_TABLE() + private: + + // Private event handlers + void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); } + void _wxFB_OnAbout( wxCommandEvent& event ){ OnAbout( event ); } + void _wxFB_OnQuit( wxCommandEvent& event ){ OnQuit( event ); } + + + protected: + enum + { + idBtnAbout = 1000, + idBtnQuit, + }; + + wxStaticText* m_staticText1; + wxButton* BtnAbout; + wxStaticLine* m_staticline1; + wxButton* BtnQuit; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } + virtual void OnQuit( wxCommandEvent& event ){ event.Skip(); } + + + public: + GUIDialog( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("wxWidgets Application Template"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxDEFAULT_DIALOG_STYLE ); + }; #endif //__GUIDialog__ diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.cpp b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.cpp index 3ef1e32ad3..197c2e423c 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.cpp +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.cpp @@ -19,27 +19,27 @@ /////////////////////////////////////////////////////////////////////////// BEGIN_EVENT_TABLE( GUIFrame, wxFrame ) - EVT_CLOSE( GUIFrame::_wxFB_OnClose ) - EVT_MENU( idMenuQuit, GUIFrame::_wxFB_OnQuit ) - EVT_MENU( idMenuAbout, GUIFrame::_wxFB_OnAbout ) + EVT_CLOSE( GUIFrame::_wxFB_OnClose ) + EVT_MENU( idMenuQuit, GUIFrame::_wxFB_OnQuit ) + EVT_MENU( idMenuAbout, GUIFrame::_wxFB_OnAbout ) END_EVENT_TABLE() GUIFrame::GUIFrame( wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style ) : wxFrame( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - mbar = new wxMenuBar( 0 ); - wxMenu* fileMenu; - fileMenu = new wxMenu(); - wxMenuItem* menuFileQuit = new wxMenuItem( fileMenu, idMenuQuit, wxString( wxT("&Quit") ) + wxT('\t') + wxT("Alt+F4"), wxT("Quit the application"), wxITEM_NORMAL ); - fileMenu->Append( menuFileQuit ); - mbar->Append( fileMenu, wxT("&File") ); - wxMenu* helpMenu; - helpMenu = new wxMenu(); - wxMenuItem* menuHelpAbout = new wxMenuItem( helpMenu, idMenuAbout, wxString( wxT("&About") ) + wxT('\t') + wxT("F1"), wxT("Show info about this application"), wxITEM_NORMAL ); - helpMenu->Append( menuHelpAbout ); - mbar->Append( helpMenu, wxT("&Help") ); - this->SetMenuBar( mbar ); - - statusBar = this->CreateStatusBar( 2, wxST_SIZEGRIP, wxID_ANY ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + mbar = new wxMenuBar( 0 ); + wxMenu* fileMenu; + fileMenu = new wxMenu(); + wxMenuItem* menuFileQuit = new wxMenuItem( fileMenu, idMenuQuit, wxString( wxT("&Quit") ) + wxT('\t') + wxT("Alt+F4"), wxT("Quit the application"), wxITEM_NORMAL ); + fileMenu->Append( menuFileQuit ); + mbar->Append( fileMenu, wxT("&File") ); + wxMenu* helpMenu; + helpMenu = new wxMenu(); + wxMenuItem* menuHelpAbout = new wxMenuItem( helpMenu, idMenuAbout, wxString( wxT("&About") ) + wxT('\t') + wxT("F1"), wxT("Show info about this application"), wxITEM_NORMAL ); + helpMenu->Append( menuHelpAbout ); + mbar->Append( helpMenu, wxT("&Help") ); + this->SetMenuBar( mbar ); + + statusBar = this->CreateStatusBar( 2, wxST_SIZEGRIP, wxID_ANY ); } diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.h b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.h index de5e0877e4..7f61a36bec 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.h +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wxfb/frame/GUIFrame.h @@ -31,28 +31,28 @@ /////////////////////////////////////////////////////////////////////////////// class GUIFrame : public wxFrame { - DECLARE_EVENT_TABLE() - private: - - // Private event handlers - void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); } - void _wxFB_OnQuit( wxCommandEvent& event ){ OnQuit( event ); } - void _wxFB_OnAbout( wxCommandEvent& event ){ OnAbout( event ); } - - - protected: - wxMenuBar* mbar; - wxStatusBar* statusBar; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } - virtual void OnQuit( wxCommandEvent& event ){ event.Skip(); } - virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } - - - public: - GUIFrame( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("wxWidgets Application Template"), wxPoint pos = wxDefaultPosition, wxSize size = wxSize( 481,466 ), int style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); - + DECLARE_EVENT_TABLE() + private: + + // Private event handlers + void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); } + void _wxFB_OnQuit( wxCommandEvent& event ){ OnQuit( event ); } + void _wxFB_OnAbout( wxCommandEvent& event ){ OnAbout( event ); } + + + protected: + wxMenuBar* mbar; + wxStatusBar* statusBar; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnQuit( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } + + + public: + GUIFrame( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("wxWidgets Application Template"), wxPoint pos = wxDefaultPosition, wxSize size = wxSize( 481,466 ), int style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + }; #endif //__GUIFrame__ diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/app.cpp b/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/app.cpp index dd5b9f01df..8341c9e35c 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/app.cpp +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/app.cpp @@ -16,8 +16,8 @@ IMPLEMENT_APP([CLASS_PREFIX]App); bool [CLASS_PREFIX]App::OnInit() { - //(*AppInitialize - //*) - return wxsOK; + //(*AppInitialize + //*) + return wxsOK; } diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.cpp b/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.cpp index 820481c988..27135f6486 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.cpp +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.cpp @@ -15,86 +15,86 @@ //helper functions enum wxbuildinfoformat { - short_f, long_f }; + short_f, long_f }; wxString wxbuildinfo(wxbuildinfoformat format) { - wxString wxbuild(wxVERSION_STRING); + wxString wxbuild(wxVERSION_STRING); - if (format == long_f ) - { + if (format == long_f ) + { #if defined(__WXMSW__) - wxbuild << _T("-Windows"); + wxbuild << _T("-Windows"); #elif defined(__UNIX__) - wxbuild << _T("-Linux"); + wxbuild << _T("-Linux"); #endif #if wxUSE_UNICODE - wxbuild << _T("-Unicode build"); + wxbuild << _T("-Unicode build"); #else - wxbuild << _T("-ANSI build"); + wxbuild << _T("-ANSI build"); #endif // wxUSE_UNICODE - } + } - return wxbuild; + return wxbuild; } [IF WXFRAME]//(*IdInit([CLASS_PREFIX]Frame) //*) BEGIN_EVENT_TABLE([CLASS_PREFIX]Frame,wxFrame) - //(*EventTable([CLASS_PREFIX]Frame) - //*) + //(*EventTable([CLASS_PREFIX]Frame) + //*) END_EVENT_TABLE() [CLASS_PREFIX]Frame::[CLASS_PREFIX]Frame(wxWindow* parent,wxWindowID id) { - //(*Initialize([CLASS_PREFIX]Frame) - //*) + //(*Initialize([CLASS_PREFIX]Frame) + //*) } [CLASS_PREFIX]Frame::~[CLASS_PREFIX]Frame() { - //(*Destroy([CLASS_PREFIX]Frame) - //*) + //(*Destroy([CLASS_PREFIX]Frame) + //*) } void [CLASS_PREFIX]Frame::OnQuit(wxCommandEvent& event) { - Close(); + Close(); } void [CLASS_PREFIX]Frame::OnAbout(wxCommandEvent& event) { - wxString msg = wxbuildinfo(long_f); - wxMessageBox(msg, _("Welcome to...")); + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, _("Welcome to...")); }[ENDIF WXFRAME][IF WXDIALOG]//(*IdInit([CLASS_PREFIX]Dialog) //*) BEGIN_EVENT_TABLE([CLASS_PREFIX]Dialog,wxDialog) - //(*EventTable([CLASS_PREFIX]Dialog) - //*) + //(*EventTable([CLASS_PREFIX]Dialog) + //*) END_EVENT_TABLE() [CLASS_PREFIX]Dialog::[CLASS_PREFIX]Dialog(wxWindow* parent,wxWindowID id) { - //(*Initialize([CLASS_PREFIX]Dialog) - //*) + //(*Initialize([CLASS_PREFIX]Dialog) + //*) } [CLASS_PREFIX]Dialog::~[CLASS_PREFIX]Dialog() { - //(*Destroy([CLASS_PREFIX]Dialog) - //*) + //(*Destroy([CLASS_PREFIX]Dialog) + //*) } void [CLASS_PREFIX]Dialog::OnQuit(wxCommandEvent& event) { - Close(); + Close(); } void [CLASS_PREFIX]Dialog::OnAbout(wxCommandEvent& event) { - wxString msg = wxbuildinfo(long_f); - wxMessageBox(msg, _("Welcome to...")); + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, _("Welcome to...")); }[ENDIF WXDIALOG] diff --git a/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.h b/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.h index df55c372a1..26ce084147 100644 --- a/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.h +++ b/src/plugins/scriptedwizard/resources/wxwidgets/wxsmith/main.h @@ -15,51 +15,51 @@ class [CLASS_PREFIX]Frame: public wxFrame { - public: + public: - [CLASS_PREFIX]Frame(wxWindow* parent,wxWindowID id = -1); - virtual ~[CLASS_PREFIX]Frame(); + [CLASS_PREFIX]Frame(wxWindow* parent,wxWindowID id = -1); + virtual ~[CLASS_PREFIX]Frame(); - private: + private: - //(*Handlers([CLASS_PREFIX]Frame) - void OnQuit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - //*) + //(*Handlers([CLASS_PREFIX]Frame) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + //*) - //(*Identifiers([CLASS_PREFIX]Frame) - //*) + //(*Identifiers([CLASS_PREFIX]Frame) + //*) - //(*Declarations([CLASS_PREFIX]Frame) - //*) + //(*Declarations([CLASS_PREFIX]Frame) + //*) - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() };[ENDIF WXFRAME][IF WXDIALOG]//(*Headers([CLASS_PREFIX]Dialog) //*) class [CLASS_PREFIX]Dialog: public wxDialog { - public: + public: - [CLASS_PREFIX]Dialog(wxWindow* parent,wxWindowID id = -1); - virtual ~[CLASS_PREFIX]Dialog(); + [CLASS_PREFIX]Dialog(wxWindow* parent,wxWindowID id = -1); + virtual ~[CLASS_PREFIX]Dialog(); - private: + private: - //(*Handlers([CLASS_PREFIX]Dialog) - void OnQuit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - //*) + //(*Handlers([CLASS_PREFIX]Dialog) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + //*) - //(*Identifiers([CLASS_PREFIX]Dialog) + //(*Identifiers([CLASS_PREFIX]Dialog) - //*) + //*) - //(*Declarations([CLASS_PREFIX]Dialog) + //(*Declarations([CLASS_PREFIX]Dialog) - //*) + //*) - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() };[ENDIF WXDIALOG] #endif // [PROJECT_HDR]MAIN_H diff --git a/src/sdk/globals.cpp b/src/sdk/globals.cpp index 19ef335e38..de47f33964 100644 --- a/src/sdk/globals.cpp +++ b/src/sdk/globals.cpp @@ -831,6 +831,30 @@ wxString GetEOLStr(int eolMode) } } +bool cbEnsureLineEndingConsistency() +{ + return Manager::Get()->GetConfigManager(wxT("editor"))->ReadBool(_T("/eol/ensure_consistent_line_ends"), false); +} + +bool cbDetectTabStrAutomatically() +{ + ConfigManager *CfgMan = Manager::Get()->GetConfigManager(_T("editor")); + return CfgMan->ReadBool(_T("/detect_indent"), false); +} + +wxString cbGetTabStr() +{ + ConfigManager *CfgMan = Manager::Get()->GetConfigManager(_T("editor")); + const bool UseTab = CfgMan->ReadBool(_T("/use_tab"), false); + if ( !UseTab ) + { + const int TabSize = CfgMan->ReadInt(_T("/tab_size"), 4); + return wxString(' ', TabSize); + } + else + return _T("\t"); +} + wxString URLEncode(const wxString &str) // not sure this is 100% standards compliant, but I hope so { wxString ret; diff --git a/src/sdk/scripting/bindings/sc_globals.cpp b/src/sdk/scripting/bindings/sc_globals.cpp index 8fbc91a2be..545396f6ee 100644 --- a/src/sdk/scripting/bindings/sc_globals.cpp +++ b/src/sdk/scripting/bindings/sc_globals.cpp @@ -196,6 +196,11 @@ namespace ScriptBindings return value; } + wxString GetEOL() + { + return GetEOLStr(-1); + } + void Register_Globals() { @@ -246,6 +251,9 @@ namespace ScriptBindings SquirrelVM::CreateFunctionGlobal(IsNull, "IsNull", "*"); + SqPlus::RegisterGlobal(GetEOL, "GetEOLStr"); + SqPlus::RegisterGlobal(cbGetTabStr, "cbGetTabStr"); + // now for some wx globals (utility) functions SqPlus::RegisterGlobal(wxLaunchDefaultBrowser, "wxLaunchDefaultBrowser"); SquirrelVM::CreateFunctionGlobal(wx_GetColourFromUser, "wxGetColourFromUser", "*");