From a6b634bc89d80089c6af5a504aba1ed9f5de5ffe Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 31 Oct 2020 03:54:54 +0100 Subject: [PATCH] Solve compilation issues, remove trailing whitespaces --- src/torque.xpm | 2 +- src/torqueideapp.h | 6 ++++-- src/torqueideframe.cpp | 29 +++++++++++++++-------------- src/torqueideframe.h | 8 ++++---- src/torqueideprefs.cpp | 4 ++-- src/torqueideprefs.h | 12 ++++++------ src/torqueidestc.cpp | 37 +++++++++++++++++++------------------ src/torqueidestc.h | 20 ++++++++++---------- 8 files changed, 61 insertions(+), 57 deletions(-) diff --git a/src/torque.xpm b/src/torque.xpm index 885b60a..2869d07 100644 --- a/src/torque.xpm +++ b/src/torque.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * torque_xpm[] = { +static const char *const torque_xpm[] = { "32 32 48 1", " c None", ". c #4D4D4D", diff --git a/src/torqueideapp.h b/src/torqueideapp.h index aac1b4b..29658f4 100644 --- a/src/torqueideapp.h +++ b/src/torqueideapp.h @@ -27,6 +27,8 @@ */ #include +#include "torqueideabout.h" +#include "torqueideframe.h" class TorqueIDEApp : public wxApp { @@ -43,11 +45,11 @@ class TorqueIDEApp : public wxApp * Think of this as a destructor. */ virtual int OnExit(); - + private: TorqueIDEFrame *frame; }; DECLARE_APP(TorqueIDEApp); -#endif _TORQUEIDEAPP_H +#endif /* _TORQUEIDEAPP_H */ diff --git a/src/torqueideframe.cpp b/src/torqueideframe.cpp index 415962a..3c980dc 100644 --- a/src/torqueideframe.cpp +++ b/src/torqueideframe.cpp @@ -26,6 +26,7 @@ // For compilers that support precompilation, includes "wx/wx.h" #include +#include #ifndef WX_PRECOMP #include @@ -51,7 +52,7 @@ TorqueIDEFrame::TorqueIDEFrame(const wxString &title) : wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) { scintilla = new TorqueIDESTC(this); - + /** * Scintilla initialization */ @@ -59,16 +60,16 @@ TorqueIDEFrame::TorqueIDEFrame(const wxString &title) : wxFrame ((wxFrame *)NULL scintilla->SetMarginWidth(0, 30); // turn on the linenumbers margin, set width to 30pixels scintilla->SetMarginWidth(1, 0); // turn off the folding margin scintilla->SetMarginType(0, 1); // set margin type to linenumbers - + // Give the app our icon SetIcon(wxIcon(_("torque"))); // Does this mess with cross-platform abilities? - + // Menu InitMenu(); - + // StatusBar InitStatusBar(); - + // ToolBar // Nothing in the toolbar yet, so it just takes space //InitToolBar(); @@ -87,9 +88,9 @@ void TorqueIDEFrame::InitMenu() wxMenu *menu_edit; wxMenu *menu_search; wxMenu *menu_help; - + menuBar = new wxMenuBar(); - + // File menu_file = new wxMenu(); menu_file->Append(MENU_FILE_NEW, _("&New"), _("Creates a new document")); @@ -99,7 +100,7 @@ void TorqueIDEFrame::InitMenu() menu_file->AppendSeparator(); menu_file->Append(MENU_FILE_QUIT, _("&Quit"), _("Quits the application; prompts to save documents")); menuBar->Append(menu_file, _("&File")); - + // Edit menu_edit = new wxMenu(); menu_edit->Append(MENU_EDIT_UNDO, _("&Undo"), _("Undoes the last action")); @@ -113,7 +114,7 @@ void TorqueIDEFrame::InitMenu() menu_edit->Append(MENU_EDIT_SELECTALL, _("Select A&ll"), _("Selects the entire document")); menu_edit->Append(MENU_EDIT_SELECTLINE, _("Select Lin&e"), _("Selects the current line")); menuBar->Append(menu_edit, _("&Edit")); - + // Search menu_search = new wxMenu(); menu_search->Append(MENU_SEARCH_FIND, _("&Find"), _("Finds the specified text")); @@ -123,7 +124,7 @@ void TorqueIDEFrame::InitMenu() menu_search->AppendSeparator(); menu_search->Append(MENU_SEARCH_GOTO, _("&Goto"), _("Goto the specified line")); menuBar->Append(menu_search, _("&Search")); - + // Help menu_help = new wxMenu(); menu_help->Append(MENU_HELP_ABOUT, _("&About"), _("Displays the program information and copyright")); @@ -132,7 +133,7 @@ void TorqueIDEFrame::InitMenu() menuBar->Append(menu_help, _("&Help")); SetMenuBar(menuBar); // Make this the TorqueIDE's menubar - + menuBar = menuBar; } @@ -195,7 +196,7 @@ void TorqueIDEFrame::OnMenuFileNew(wxCommandEvent &event) void TorqueIDEFrame::OnMenuFileOpen(wxCommandEvent &event) { - wxFileDialog *dlg = new wxFileDialog(this, _("Open"), _(""), _(""), _("TorqueSCRIPT Files(*.cs, *.gui, *.mis)|*.cs;*.gui;*.mis|All files(*.*)|*.*"), wxOPEN, wxDefaultPosition); + wxFileDialog *dlg = new wxFileDialog(this, _("Open"), _(""), _(""), _("TorqueSCRIPT Files(*.cs, *.gui, *.mis)|*.cs;*.gui;*.mis|All files(*.*)|*.*"), wxFD_OPEN, wxDefaultPosition); if(dlg->ShowModal() == wxID_OK) { scintilla->LoadFile(dlg->GetPath()); @@ -215,12 +216,12 @@ void TorqueIDEFrame::OnMenuFileSave(wxCommandEvent &event) void TorqueIDEFrame::OnMenuFileSaveAs(wxCommandEvent &event) { - wxFileDialog *dlg = new wxFileDialog(this, _("Save As"), _(""), _(""), _("TorqueSCRIPT Files(*.cs)|*.cs|All files(*.*)|*.*"), wxSAVE, wxDefaultPosition); + wxFileDialog *dlg = new wxFileDialog(this, _("Save As"), _(""), _(""), _("TorqueSCRIPT Files(*.cs)|*.cs|All files(*.*)|*.*"), wxFD_SAVE, wxDefaultPosition); if(dlg->ShowModal() == wxID_OK) { scintilla->SaveFile(dlg->GetPath()); scintilla->SetSavePoint(); - + SetStatusText(dlg->GetPath(), 1); // GetFilename for just the filename } dlg->Destroy(); diff --git a/src/torqueideframe.h b/src/torqueideframe.h index e9dace9..b7bf792 100644 --- a/src/torqueideframe.h +++ b/src/torqueideframe.h @@ -149,15 +149,15 @@ class TorqueIDEFrame : public wxFrame private: // Editor TorqueIDESTC *scintilla; - + // Statusbar wxStatusBar *statusBar; void InitStatusBar(); - + // Toolbar wxToolBar *toolBar; void InitToolBar(); - + // Menu wxMenuBar *menuBar; void InitMenu(); @@ -194,4 +194,4 @@ class TorqueIDEFrame : public wxFrame }; }; -#endif _TORQUEIDEFRAME_H +#endif /* _TORQUEIDEFRAME_H */ diff --git a/src/torqueideprefs.cpp b/src/torqueideprefs.cpp index b1d596b..74918f9 100644 --- a/src/torqueideprefs.cpp +++ b/src/torqueideprefs.cpp @@ -93,7 +93,7 @@ wxChar* PythonWordlist2 = _T("LISTBOX LTEXT MENU MENUEX MENUITEM MESSAGETABLE POPUP PUSHBUTTON ") _T("RADIOBUTTON RCDATA RTEXT SCROLLBAR SEPARATOR SHIFT STATE3 ") _T("STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY"); - + /** * TorqueSCRIPT */ @@ -225,7 +225,7 @@ const LanguageInfo languagePrefs [] = { {-1, NULL}}, TORQUEIDESTC_FOLD_COMMENTPY | TORQUEIDESTC_FOLD_QUOTESPY}, // * (any) - {(wxChar *)DEFAULT_LANGUAGE, + {(const wxChar *)DEFAULT_LANGUAGE, _T("*.*"), wxSTC_LEX_PROPERTIES, {{TORQUEIDESTC_TYPE_DEFAULT, NULL}, diff --git a/src/torqueideprefs.h b/src/torqueideprefs.h index 8dff064..c828305 100644 --- a/src/torqueideprefs.h +++ b/src/torqueideprefs.h @@ -6,7 +6,7 @@ * * Copyright (C) 2005 Robert Pierce ** Adapted from wxWidgets STC example - * + * * Refer to the file CONTRIB.txt for the people who have helped. * * This program is free software; you can redistribute it @@ -26,7 +26,7 @@ * Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ - + #include // STC Related Prefs @@ -115,8 +115,8 @@ extern const CommonInfo commonPrefs; // Language Information struct LanguageInfo { - wxChar *name; - wxChar *filepattern; + const wxChar *name; + const wxChar *filepattern; int lexer; struct { int type; @@ -141,5 +141,5 @@ struct StyleInfo { extern const StyleInfo stylePrefs[]; extern const int stylePrefsSize; - -#endif _TORQUEIDEPREFS_H + +#endif /* _TORQUEIDEPREFS_H */ diff --git a/src/torqueidestc.cpp b/src/torqueidestc.cpp index 75fdd67..658cb2f 100644 --- a/src/torqueidestc.cpp +++ b/src/torqueidestc.cpp @@ -27,6 +27,7 @@ // For compilers that supports precompilation, include "wx/wx.h" #include +#include #ifndef WX_PRECOMP #include @@ -79,7 +80,7 @@ TorqueIDESTC::TorqueIDESTC(wxWindow *parent, wxWindowID id, const wxPoint &pos, MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_CIRCLEPLUSCONNECTED); MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_CIRCLEMINUSCONNECTED); MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNERCURVE); - + // miscelaneous lineNumMargin = TextWidth(wxSTC_STYLE_LINENUMBER, _T("_999999")); foldingMargin = 16; @@ -91,7 +92,7 @@ TorqueIDESTC::~TorqueIDESTC() { } -wxString TorqueIDESTC::DeterminePrefs(const wxString &file) +wxString TorqueIDESTC::DeterminePrefs(const wxString &file) { LanguageInfo const* curInfo; @@ -103,7 +104,7 @@ wxString TorqueIDESTC::DeterminePrefs(const wxString &file) filepattern.Lower(); while (!filepattern.IsEmpty()) { wxString cur = filepattern.BeforeFirst (';'); - if ((cur == file) || (cur == (file.BeforeLast ('.') + _T(".*"))) || (cur == (_T("*.") + file.AfterLast ('.')))) + if ((cur == file) || (cur == (file.BeforeLast ('.') + _T(".*"))) || (cur == (_T("*.") + file.AfterLast ('.')))) { return curInfo->name; } @@ -113,7 +114,7 @@ wxString TorqueIDESTC::DeterminePrefs(const wxString &file) return wxEmptyString; } -bool TorqueIDESTC::InitializePrefs (const wxString &name) +bool TorqueIDESTC::InitializePrefs (const wxString &name) { // Init Styles StyleClearAll(); @@ -133,7 +134,7 @@ bool TorqueIDESTC::InitializePrefs (const wxString &name) { return false; } - + // Set Lexer and Language SetLexer(curInfo->lexer); language = curInfo; @@ -154,7 +155,7 @@ bool TorqueIDESTC::InitializePrefs (const wxString &name) // Set Common Styles StyleSetForeground(wxSTC_STYLE_DEFAULT, wxColour (_T("DARK GREY"))); StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (_T("DARK GREY"))); - + // Init Settings if(commonPrefs.syntaxEnable) { int keywordNum = 0; @@ -227,21 +228,21 @@ bool TorqueIDESTC::InitializePrefs (const wxString &name) return true; } -bool TorqueIDESTC::LoadFile() +bool TorqueIDESTC::LoadFile() { // Get Filename - if (!filename) + if (!filename) { - wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""), _T("Any file (*)|*"), wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR); + wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""), _T("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR); if (dlg.ShowModal() != wxID_OK) return false; filename = dlg.GetPath(); } - + // Load File return LoadFile(filename); } -bool TorqueIDESTC::LoadFile(const wxString &file) +bool TorqueIDESTC::LoadFile(const wxString &file) { // Load File and clear undo if (!file.IsEmpty()) @@ -268,18 +269,18 @@ bool TorqueIDESTC::LoadFile(const wxString &file) // Determine Lexer Language wxFileName fname(file); InitializePrefs(DeterminePrefs(fname.GetFullName())); - + return true; } -bool TorqueIDESTC::SaveFile() +bool TorqueIDESTC::SaveFile() { // return if no change if (!Modified()) return true; // Get Filename if (!filename) { - wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxSAVE | wxOVERWRITE_PROMPT); + wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (dlg.ShowModal() != wxID_OK) return false; filename = dlg.GetPath(); } @@ -288,7 +289,7 @@ bool TorqueIDESTC::SaveFile() return SaveFile(filename); } -bool TorqueIDESTC::SaveFile(const wxString &file) +bool TorqueIDESTC::SaveFile(const wxString &file) { // return if no change if (!Modified()) return true; @@ -309,7 +310,7 @@ bool TorqueIDESTC::SaveFile(const wxString &file) return wxStyledTextCtrl::SaveFile(file); } -bool TorqueIDESTC::Modified () +bool TorqueIDESTC::Modified () { // Return Modified State @@ -325,7 +326,7 @@ BEGIN_EVENT_TABLE(TorqueIDESTC, wxStyledTextCtrl) EVT_STC_CHARADDED(wxID_ANY, TorqueIDESTC::OnCharAdded) END_EVENT_TABLE() -void TorqueIDESTC::OnSize(wxSizeEvent& event) +void TorqueIDESTC::OnSize(wxSizeEvent& event) { int x = GetClientSize().x + (commonPrefs.lineNumberEnable? lineNumMargin: 0) + (commonPrefs.foldEnable? foldingMargin: 0); if (x > 0) SetScrollWidth(x); @@ -342,7 +343,7 @@ void TorqueIDESTC::OnMarginClick(wxStyledTextEvent &event) { } } -void TorqueIDESTC::OnCharAdded(wxStyledTextEvent &event) +void TorqueIDESTC::OnCharAdded(wxStyledTextEvent &event) { char chr = (char)event.GetKey(); int currentLine = GetCurrentLine(); diff --git a/src/torqueidestc.h b/src/torqueidestc.h index 365529c..2745a45 100644 --- a/src/torqueidestc.h +++ b/src/torqueidestc.h @@ -37,7 +37,7 @@ class TorqueIDESTC : public wxStyledTextCtrl /** * Constructor */ - TorqueIDESTC(wxWindow *parent, wxWindowID id = wxID_ANY, + TorqueIDESTC(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxSUNKEN_BORDER|wxVSCROLL @@ -47,18 +47,18 @@ class TorqueIDESTC : public wxStyledTextCtrl * Destructor */ ~TorqueIDESTC(); - + // Events void OnSize(wxSizeEvent &event); void OnMarginClick(wxStyledTextEvent &event); void OnCharAdded(wxStyledTextEvent &event); - - + + // Language/Lexer wxString DeterminePrefs(const wxString &file); bool InitializePrefs(const wxString &file); LanguageInfo const* GetLanguageInfo() {return language;}; - + // Loading/Saving bool LoadFile(); bool LoadFile(const wxString &file); @@ -67,20 +67,20 @@ class TorqueIDESTC : public wxStyledTextCtrl bool Modified(); wxString GetFilename() {return filename;}; void SetFilename(const wxString &file) {filename = file;}; - + private: wxString filename; - + LanguageInfo const* language; - + // Margin Variables int lineNumID; int lineNumMargin; int foldingID; int foldingMargin; int dividerID; - + DECLARE_EVENT_TABLE() }; -#endif _TORQUEIDESCINTILLA_H +#endif /* _TORQUEIDESCINTILLA_H */