Solve compilation issues, remove trailing whitespaces

This commit is contained in:
Xavier Del Campo Romero 2020-10-31 03:54:54 +01:00
parent ae1587c201
commit a6b634bc89
8 changed files with 61 additions and 57 deletions

View File

@ -1,5 +1,5 @@
/* XPM */ /* XPM */
static char * torque_xpm[] = { static const char *const torque_xpm[] = {
"32 32 48 1", "32 32 48 1",
" c None", " c None",
". c #4D4D4D", ". c #4D4D4D",

View File

@ -27,6 +27,8 @@
*/ */
#include <wx/wx.h> #include <wx/wx.h>
#include "torqueideabout.h"
#include "torqueideframe.h"
class TorqueIDEApp : public wxApp class TorqueIDEApp : public wxApp
{ {
@ -43,11 +45,11 @@ class TorqueIDEApp : public wxApp
* Think of this as a destructor. * Think of this as a destructor.
*/ */
virtual int OnExit(); virtual int OnExit();
private: private:
TorqueIDEFrame *frame; TorqueIDEFrame *frame;
}; };
DECLARE_APP(TorqueIDEApp); DECLARE_APP(TorqueIDEApp);
#endif _TORQUEIDEAPP_H #endif /* _TORQUEIDEAPP_H */

View File

@ -26,6 +26,7 @@
// For compilers that support precompilation, includes "wx/wx.h" // For compilers that support precompilation, includes "wx/wx.h"
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include <wx/filedlg.h>
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <wx/wx.h> #include <wx/wx.h>
@ -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) 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 = new TorqueIDESTC(this);
/** /**
* Scintilla initialization * 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(0, 30); // turn on the linenumbers margin, set width to 30pixels
scintilla->SetMarginWidth(1, 0); // turn off the folding margin scintilla->SetMarginWidth(1, 0); // turn off the folding margin
scintilla->SetMarginType(0, 1); // set margin type to linenumbers scintilla->SetMarginType(0, 1); // set margin type to linenumbers
// Give the app our icon // Give the app our icon
SetIcon(wxIcon(_("torque"))); // Does this mess with cross-platform abilities? SetIcon(wxIcon(_("torque"))); // Does this mess with cross-platform abilities?
// Menu // Menu
InitMenu(); InitMenu();
// StatusBar // StatusBar
InitStatusBar(); InitStatusBar();
// ToolBar // ToolBar
// Nothing in the toolbar yet, so it just takes space // Nothing in the toolbar yet, so it just takes space
//InitToolBar(); //InitToolBar();
@ -87,9 +88,9 @@ void TorqueIDEFrame::InitMenu()
wxMenu *menu_edit; wxMenu *menu_edit;
wxMenu *menu_search; wxMenu *menu_search;
wxMenu *menu_help; wxMenu *menu_help;
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
// File // File
menu_file = new wxMenu(); menu_file = new wxMenu();
menu_file->Append(MENU_FILE_NEW, _("&New"), _("Creates a new document")); menu_file->Append(MENU_FILE_NEW, _("&New"), _("Creates a new document"));
@ -99,7 +100,7 @@ void TorqueIDEFrame::InitMenu()
menu_file->AppendSeparator(); menu_file->AppendSeparator();
menu_file->Append(MENU_FILE_QUIT, _("&Quit"), _("Quits the application; prompts to save documents")); menu_file->Append(MENU_FILE_QUIT, _("&Quit"), _("Quits the application; prompts to save documents"));
menuBar->Append(menu_file, _("&File")); menuBar->Append(menu_file, _("&File"));
// Edit // Edit
menu_edit = new wxMenu(); menu_edit = new wxMenu();
menu_edit->Append(MENU_EDIT_UNDO, _("&Undo"), _("Undoes the last action")); 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_SELECTALL, _("Select A&ll"), _("Selects the entire document"));
menu_edit->Append(MENU_EDIT_SELECTLINE, _("Select Lin&e"), _("Selects the current line")); menu_edit->Append(MENU_EDIT_SELECTLINE, _("Select Lin&e"), _("Selects the current line"));
menuBar->Append(menu_edit, _("&Edit")); menuBar->Append(menu_edit, _("&Edit"));
// Search // Search
menu_search = new wxMenu(); menu_search = new wxMenu();
menu_search->Append(MENU_SEARCH_FIND, _("&Find"), _("Finds the specified text")); menu_search->Append(MENU_SEARCH_FIND, _("&Find"), _("Finds the specified text"));
@ -123,7 +124,7 @@ void TorqueIDEFrame::InitMenu()
menu_search->AppendSeparator(); menu_search->AppendSeparator();
menu_search->Append(MENU_SEARCH_GOTO, _("&Goto"), _("Goto the specified line")); menu_search->Append(MENU_SEARCH_GOTO, _("&Goto"), _("Goto the specified line"));
menuBar->Append(menu_search, _("&Search")); menuBar->Append(menu_search, _("&Search"));
// Help // Help
menu_help = new wxMenu(); menu_help = new wxMenu();
menu_help->Append(MENU_HELP_ABOUT, _("&About"), _("Displays the program information and copyright")); 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")); menuBar->Append(menu_help, _("&Help"));
SetMenuBar(menuBar); // Make this the TorqueIDE's menubar SetMenuBar(menuBar); // Make this the TorqueIDE's menubar
menuBar = menuBar; menuBar = menuBar;
} }
@ -195,7 +196,7 @@ void TorqueIDEFrame::OnMenuFileNew(wxCommandEvent &event)
void TorqueIDEFrame::OnMenuFileOpen(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) if(dlg->ShowModal() == wxID_OK)
{ {
scintilla->LoadFile(dlg->GetPath()); scintilla->LoadFile(dlg->GetPath());
@ -215,12 +216,12 @@ void TorqueIDEFrame::OnMenuFileSave(wxCommandEvent &event)
void TorqueIDEFrame::OnMenuFileSaveAs(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) if(dlg->ShowModal() == wxID_OK)
{ {
scintilla->SaveFile(dlg->GetPath()); scintilla->SaveFile(dlg->GetPath());
scintilla->SetSavePoint(); scintilla->SetSavePoint();
SetStatusText(dlg->GetPath(), 1); // GetFilename for just the filename SetStatusText(dlg->GetPath(), 1); // GetFilename for just the filename
} }
dlg->Destroy(); dlg->Destroy();

View File

@ -149,15 +149,15 @@ class TorqueIDEFrame : public wxFrame
private: private:
// Editor // Editor
TorqueIDESTC *scintilla; TorqueIDESTC *scintilla;
// Statusbar // Statusbar
wxStatusBar *statusBar; wxStatusBar *statusBar;
void InitStatusBar(); void InitStatusBar();
// Toolbar // Toolbar
wxToolBar *toolBar; wxToolBar *toolBar;
void InitToolBar(); void InitToolBar();
// Menu // Menu
wxMenuBar *menuBar; wxMenuBar *menuBar;
void InitMenu(); void InitMenu();
@ -194,4 +194,4 @@ class TorqueIDEFrame : public wxFrame
}; };
}; };
#endif _TORQUEIDEFRAME_H #endif /* _TORQUEIDEFRAME_H */

View File

@ -93,7 +93,7 @@ wxChar* PythonWordlist2 =
_T("LISTBOX LTEXT MENU MENUEX MENUITEM MESSAGETABLE POPUP PUSHBUTTON ") _T("LISTBOX LTEXT MENU MENUEX MENUITEM MESSAGETABLE POPUP PUSHBUTTON ")
_T("RADIOBUTTON RCDATA RTEXT SCROLLBAR SEPARATOR SHIFT STATE3 ") _T("RADIOBUTTON RCDATA RTEXT SCROLLBAR SEPARATOR SHIFT STATE3 ")
_T("STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY"); _T("STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY");
/** /**
* TorqueSCRIPT * TorqueSCRIPT
*/ */
@ -225,7 +225,7 @@ const LanguageInfo languagePrefs [] = {
{-1, NULL}}, {-1, NULL}},
TORQUEIDESTC_FOLD_COMMENTPY | TORQUEIDESTC_FOLD_QUOTESPY}, TORQUEIDESTC_FOLD_COMMENTPY | TORQUEIDESTC_FOLD_QUOTESPY},
// * (any) // * (any)
{(wxChar *)DEFAULT_LANGUAGE, {(const wxChar *)DEFAULT_LANGUAGE,
_T("*.*"), _T("*.*"),
wxSTC_LEX_PROPERTIES, wxSTC_LEX_PROPERTIES,
{{TORQUEIDESTC_TYPE_DEFAULT, NULL}, {{TORQUEIDESTC_TYPE_DEFAULT, NULL},

View File

@ -6,7 +6,7 @@
* *
* Copyright (C) 2005 Robert Pierce * Copyright (C) 2005 Robert Pierce
** Adapted from wxWidgets STC example ** Adapted from wxWidgets STC example
* *
* Refer to the file CONTRIB.txt for the people who have helped. * Refer to the file CONTRIB.txt for the people who have helped.
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
@ -26,7 +26,7 @@
* Software Foundation, Inc., 59 Temple Place, Suite 330, * Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA * Boston, MA 02111-1307 USA
*/ */
#include <wx/stc/stc.h> #include <wx/stc/stc.h>
// STC Related Prefs // STC Related Prefs
@ -115,8 +115,8 @@ extern const CommonInfo commonPrefs;
// Language Information // Language Information
struct LanguageInfo { struct LanguageInfo {
wxChar *name; const wxChar *name;
wxChar *filepattern; const wxChar *filepattern;
int lexer; int lexer;
struct { struct {
int type; int type;
@ -141,5 +141,5 @@ struct StyleInfo {
extern const StyleInfo stylePrefs[]; extern const StyleInfo stylePrefs[];
extern const int stylePrefsSize; extern const int stylePrefsSize;
#endif _TORQUEIDEPREFS_H #endif /* _TORQUEIDEPREFS_H */

View File

@ -27,6 +27,7 @@
// For compilers that supports precompilation, include "wx/wx.h" // For compilers that supports precompilation, include "wx/wx.h"
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include <wx/filedlg.h>
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <wx/wx.h> #include <wx/wx.h>
@ -79,7 +80,7 @@ TorqueIDESTC::TorqueIDESTC(wxWindow *parent, wxWindowID id, const wxPoint &pos,
MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_CIRCLEPLUSCONNECTED); MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_CIRCLEPLUSCONNECTED);
MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_CIRCLEMINUSCONNECTED); MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_CIRCLEMINUSCONNECTED);
MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNERCURVE); MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNERCURVE);
// miscelaneous // miscelaneous
lineNumMargin = TextWidth(wxSTC_STYLE_LINENUMBER, _T("_999999")); lineNumMargin = TextWidth(wxSTC_STYLE_LINENUMBER, _T("_999999"));
foldingMargin = 16; foldingMargin = 16;
@ -91,7 +92,7 @@ TorqueIDESTC::~TorqueIDESTC()
{ {
} }
wxString TorqueIDESTC::DeterminePrefs(const wxString &file) wxString TorqueIDESTC::DeterminePrefs(const wxString &file)
{ {
LanguageInfo const* curInfo; LanguageInfo const* curInfo;
@ -103,7 +104,7 @@ wxString TorqueIDESTC::DeterminePrefs(const wxString &file)
filepattern.Lower(); filepattern.Lower();
while (!filepattern.IsEmpty()) { while (!filepattern.IsEmpty()) {
wxString cur = filepattern.BeforeFirst (';'); 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; return curInfo->name;
} }
@ -113,7 +114,7 @@ wxString TorqueIDESTC::DeterminePrefs(const wxString &file)
return wxEmptyString; return wxEmptyString;
} }
bool TorqueIDESTC::InitializePrefs (const wxString &name) bool TorqueIDESTC::InitializePrefs (const wxString &name)
{ {
// Init Styles // Init Styles
StyleClearAll(); StyleClearAll();
@ -133,7 +134,7 @@ bool TorqueIDESTC::InitializePrefs (const wxString &name)
{ {
return false; return false;
} }
// Set Lexer and Language // Set Lexer and Language
SetLexer(curInfo->lexer); SetLexer(curInfo->lexer);
language = curInfo; language = curInfo;
@ -154,7 +155,7 @@ bool TorqueIDESTC::InitializePrefs (const wxString &name)
// Set Common Styles // Set Common Styles
StyleSetForeground(wxSTC_STYLE_DEFAULT, wxColour (_T("DARK GREY"))); StyleSetForeground(wxSTC_STYLE_DEFAULT, wxColour (_T("DARK GREY")));
StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (_T("DARK GREY"))); StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (_T("DARK GREY")));
// Init Settings // Init Settings
if(commonPrefs.syntaxEnable) { if(commonPrefs.syntaxEnable) {
int keywordNum = 0; int keywordNum = 0;
@ -227,21 +228,21 @@ bool TorqueIDESTC::InitializePrefs (const wxString &name)
return true; return true;
} }
bool TorqueIDESTC::LoadFile() bool TorqueIDESTC::LoadFile()
{ {
// Get Filename // 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; if (dlg.ShowModal() != wxID_OK) return false;
filename = dlg.GetPath(); filename = dlg.GetPath();
} }
// Load File // Load File
return LoadFile(filename); return LoadFile(filename);
} }
bool TorqueIDESTC::LoadFile(const wxString &file) bool TorqueIDESTC::LoadFile(const wxString &file)
{ {
// Load File and clear undo // Load File and clear undo
if (!file.IsEmpty()) if (!file.IsEmpty())
@ -268,18 +269,18 @@ bool TorqueIDESTC::LoadFile(const wxString &file)
// Determine Lexer Language // Determine Lexer Language
wxFileName fname(file); wxFileName fname(file);
InitializePrefs(DeterminePrefs(fname.GetFullName())); InitializePrefs(DeterminePrefs(fname.GetFullName()));
return true; return true;
} }
bool TorqueIDESTC::SaveFile() bool TorqueIDESTC::SaveFile()
{ {
// return if no change // return if no change
if (!Modified()) return true; if (!Modified()) return true;
// Get Filename // Get Filename
if (!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; if (dlg.ShowModal() != wxID_OK) return false;
filename = dlg.GetPath(); filename = dlg.GetPath();
} }
@ -288,7 +289,7 @@ bool TorqueIDESTC::SaveFile()
return SaveFile(filename); return SaveFile(filename);
} }
bool TorqueIDESTC::SaveFile(const wxString &file) bool TorqueIDESTC::SaveFile(const wxString &file)
{ {
// return if no change // return if no change
if (!Modified()) return true; if (!Modified()) return true;
@ -309,7 +310,7 @@ bool TorqueIDESTC::SaveFile(const wxString &file)
return wxStyledTextCtrl::SaveFile(file); return wxStyledTextCtrl::SaveFile(file);
} }
bool TorqueIDESTC::Modified () bool TorqueIDESTC::Modified ()
{ {
// Return Modified State // Return Modified State
@ -325,7 +326,7 @@ BEGIN_EVENT_TABLE(TorqueIDESTC, wxStyledTextCtrl)
EVT_STC_CHARADDED(wxID_ANY, TorqueIDESTC::OnCharAdded) EVT_STC_CHARADDED(wxID_ANY, TorqueIDESTC::OnCharAdded)
END_EVENT_TABLE() 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); int x = GetClientSize().x + (commonPrefs.lineNumberEnable? lineNumMargin: 0) + (commonPrefs.foldEnable? foldingMargin: 0);
if (x > 0) SetScrollWidth(x); 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(); char chr = (char)event.GetKey();
int currentLine = GetCurrentLine(); int currentLine = GetCurrentLine();

View File

@ -37,7 +37,7 @@ class TorqueIDESTC : public wxStyledTextCtrl
/** /**
* Constructor * Constructor
*/ */
TorqueIDESTC(wxWindow *parent, wxWindowID id = wxID_ANY, TorqueIDESTC(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxSUNKEN_BORDER|wxVSCROLL long style = wxSUNKEN_BORDER|wxVSCROLL
@ -47,18 +47,18 @@ class TorqueIDESTC : public wxStyledTextCtrl
* Destructor * Destructor
*/ */
~TorqueIDESTC(); ~TorqueIDESTC();
// Events // Events
void OnSize(wxSizeEvent &event); void OnSize(wxSizeEvent &event);
void OnMarginClick(wxStyledTextEvent &event); void OnMarginClick(wxStyledTextEvent &event);
void OnCharAdded(wxStyledTextEvent &event); void OnCharAdded(wxStyledTextEvent &event);
// Language/Lexer // Language/Lexer
wxString DeterminePrefs(const wxString &file); wxString DeterminePrefs(const wxString &file);
bool InitializePrefs(const wxString &file); bool InitializePrefs(const wxString &file);
LanguageInfo const* GetLanguageInfo() {return language;}; LanguageInfo const* GetLanguageInfo() {return language;};
// Loading/Saving // Loading/Saving
bool LoadFile(); bool LoadFile();
bool LoadFile(const wxString &file); bool LoadFile(const wxString &file);
@ -67,20 +67,20 @@ class TorqueIDESTC : public wxStyledTextCtrl
bool Modified(); bool Modified();
wxString GetFilename() {return filename;}; wxString GetFilename() {return filename;};
void SetFilename(const wxString &file) {filename = file;}; void SetFilename(const wxString &file) {filename = file;};
private: private:
wxString filename; wxString filename;
LanguageInfo const* language; LanguageInfo const* language;
// Margin Variables // Margin Variables
int lineNumID; int lineNumID;
int lineNumMargin; int lineNumMargin;
int foldingID; int foldingID;
int foldingMargin; int foldingMargin;
int dividerID; int dividerID;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif _TORQUEIDESCINTILLA_H #endif /* _TORQUEIDESCINTILLA_H */