Permalink
Browse files

Code cleanups related to GoToFile work; STL looks to compile clean at…

… level 4 w/ VS2008, so starting to remove guards.
  • Loading branch information...
1 parent 0d08382 commit 355c2872ddacc28ec4f8759707574d146252c24f @adamv adamv committed Jul 4, 2009
Showing with 41 additions and 60 deletions.
  1. +1 −0 src/EditorFrame.cpp
  2. +1 −1 src/FindCmdDlg.cpp
  3. +7 −0 src/GotoFileDlg.cpp
  4. +4 −15 src/GotoFileDlg.h
  5. +1 −1 src/IEditorSymbols.h
  6. +13 −11 src/SearchListBox.cpp
  7. +8 −13 src/SearchListBox.h
  8. +2 −7 src/SymbolList.cpp
  9. +4 −12 src/SymbolList.h
View
@@ -19,6 +19,7 @@
#include <wx/filename.h>
#include <wx/artprov.h>
#include <wx/ffile.h>
+#include <wx/dir.h>
#include <wx/fontmap.h>
#include <wx/sysopt.h>
#include <wx/mstream.h>
View
@@ -108,7 +108,7 @@ void FindCmdDlg::ActionList::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n)
const bool isCurrent = IsCurrent(n);
dc.SetTextForeground(isCurrent ? m_hlTextColor : m_textColor);
- const unsigned int ypos = rect.y + m_topMargen;
+ const unsigned int ypos = rect.y + m_topMargin;
unsigned int rightBorder = rect.GetRight();
const tmAction& action = *m_items[n].action;
View
@@ -12,8 +12,15 @@
******************************************************************************/
#include "GotoFileDlg.h"
+
+using namespace std;
+#include <map>
#include <algorithm>
+
+#include <wx/dir.h>
+
#include "ProjectInfoHandler.h"
+#include "SearchListBox.h"
class FileEntry {
public:
View
@@ -19,18 +19,7 @@
#include <wx/wx.h>
#endif
-// STL can't compile with Level 4
-#ifdef __WXMSW__
- #pragma warning(push, 1)
-#endif
-#include <map>
-#ifdef __WXMSW__
- #pragma warning(pop)
-#endif
-using namespace std;
-
-#include <wx/dir.h>
-#include "SearchListBox.h"
+#include <vector>
class ProjectInfoHandler;
class cxProjectInfo;
@@ -61,13 +50,13 @@ class GotoFileDlg : public wxDialog {
// Member variables
ProjectInfoHandler& m_project;
- vector<FileEntry*> m_files;
+ std::vector<FileEntry*> m_files;
bool m_isDone;
// Dir traversing state
bool m_filesLoaded;
- vector<DirState*> m_dirStack;
- vector<cxProjectInfo*> m_filters;
+ std::vector<DirState*> m_dirStack;
+ std::vector<cxProjectInfo*> m_filters;
// Ctrls
wxTextCtrl* m_searchCtrl;
View
@@ -6,7 +6,7 @@
class IEditorSymbols : public IGetChangeState {
public:
- virtual int GetSymbols(vector<SymbolRef>& symbols) const = 0;
+ virtual int GetSymbols(std::vector<SymbolRef>& symbols) const = 0;
virtual wxString GetSymbolString(const SymbolRef& sr) const = 0;
virtual void GotoSymbolPos(unsigned int pos) = 0;
};
View
@@ -12,14 +12,16 @@
******************************************************************************/
#include "SearchListBox.h"
-#include <wx/wx.h>
+
+using namespace std;
BEGIN_EVENT_TABLE(SearchListBox, wxVListBox)
EVT_CHAR(SearchListBox::OnChar)
END_EVENT_TABLE()
-SearchListBox::SearchListBox(wxWindow* parent, wxWindowID id)
-: wxVListBox(parent, id, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER) {
+SearchListBox::SearchListBox(wxWindow* parent, wxWindowID id):
+ wxVListBox(parent, id, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER)
+{
m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
m_boldFont = m_font;
m_boldFont.SetWeight(wxFONTWEIGHT_BOLD);
@@ -33,25 +35,25 @@ SearchListBox::SearchListBox(wxWindow* parent, wxWindowID id)
dc.GetTextExtent(wxT("Xj"), &x, &m_itemHeight);
m_itemHeight += 4; // Add a bit of margin
- m_topMargen = 1;
- m_leftMargen = 1;
+ m_topMargin = 1;
+ m_leftMargin = 1;
}
wxCoord SearchListBox::OnMeasureItem(size_t WXUNUSED(n)) const {
return m_itemHeight;
}
void SearchListBox::DrawItemText(wxDC& dc, const wxRect& rect, const wxString& name, const vector<unsigned int>& hl, bool isCurrent) const {
- const unsigned int ypos = rect.y + m_topMargen;
+ const unsigned int ypos = rect.y + m_topMargin;
// Draw action name
if (hl.empty()) {
dc.SetFont(m_font);
if (!isCurrent) dc.SetTextForeground(m_textColor);
- dc.DrawText(name, rect.x + m_leftMargen, ypos);
+ dc.DrawText(name, rect.x + m_leftMargin, ypos);
}
else {
- unsigned int lastxpos = rect.x + m_leftMargen;
+ unsigned int lastxpos = rect.x + m_leftMargin;
unsigned int lastchar = 0;
const unsigned int len = name.length();
int w, h;
@@ -63,7 +65,7 @@ void SearchListBox::DrawItemText(wxDC& dc, const wxRect& rect, const wxString& n
if (lastchar < e) {
wxString str = name.substr(lastchar, e - lastchar);
- //dc.SetFont(m_font);
+ dc.SetFont(m_font);
dc.GetTextExtent(str, &w, &h);
@@ -77,7 +79,7 @@ void SearchListBox::DrawItemText(wxDC& dc, const wxRect& rect, const wxString& n
// highlight char
if (e == *p) {
const wxString charStr(name[e]);
- //dc.SetFont(m_boldFont);
+ dc.SetFont(m_boldFont);
if (!isCurrent) dc.SetTextForeground(*wxBLACK);
dc.DrawText(charStr, lastxpos, ypos);
@@ -91,7 +93,7 @@ void SearchListBox::DrawItemText(wxDC& dc, const wxRect& rect, const wxString& n
}
if (lastchar < name.size()) {
- //dc.SetFont(m_font);
+ dc.SetFont(m_font);
if (!isCurrent) dc.SetTextForeground(m_textColor);
dc.DrawText(name.substr(lastchar), lastxpos, ypos);
}
View
@@ -15,18 +15,13 @@
#define __SEARCHLISTBOX_H__
#include "wx/wxprec.h"
-#include <wx/vlbox.h>
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+#include <wx/vlbox.h>
-// STL can't compile with Level 4
-#ifdef __WXMSW__
- #pragma warning(push, 1)
-#endif
#include <vector>
-#ifdef __WXMSW__
- #pragma warning(pop)
-#endif
-using namespace std;
class SearchListBox : public wxVListBox {
public:
@@ -36,10 +31,10 @@ class SearchListBox : public wxVListBox {
void SelectPrev();
// utility functions
- static unsigned int CalcRank(const vector<unsigned int>& hl);
+ static unsigned int CalcRank(const std::vector<unsigned int>& hl);
protected:
- void DrawItemText(wxDC& dc, const wxRect& rect, const wxString& name, const vector<unsigned int>& hl, bool isCurrent) const;
+ void DrawItemText(wxDC& dc, const wxRect& rect, const wxString& name, const std::vector<unsigned int>& hl, bool isCurrent) const;
wxCoord OnMeasureItem(size_t n) const;
@@ -52,8 +47,8 @@ class SearchListBox : public wxVListBox {
wxFont m_boldFont;
wxColour m_textColor;
wxColour m_hlTextColor;
- unsigned int m_topMargen;
- unsigned int m_leftMargen;
+ unsigned int m_topMargin;
+ unsigned int m_leftMargin;
};
#endif // __SEARCHLISTBOX_H__
View
@@ -14,20 +14,15 @@
#include "SymbolList.h"
#include "IFrameSymbolService.h"
-// STL can't compile with Level 4
-#ifdef __WXMSW__
- #pragma warning(push, 1)
-#endif
#include <algorithm>
-#ifdef __WXMSW__
- #pragma warning(pop)
-#endif
#ifndef WX_PRECOMP
#include <wx/sizer.h>
#include <wx/dc.h>
#endif
+using namespace std;
+
// Ctrl id's
enum {
CTRL_SEARCH,
View
@@ -23,15 +23,7 @@
#include "SearchListBox.h"
#include "IEditorSymbols.h"
-// STL can't compile with Level 4
-#ifdef __WXMSW__
- #pragma warning(push, 1)
-#endif
#include <vector>
-#ifdef __WXMSW__
- #pragma warning(pop)
-#endif
-using namespace std;
class IFrameSymbolService;
@@ -64,7 +56,7 @@ class SymbolList : public wxPanel {
class aItem {
public:
aItem() : id(0), action(NULL), rank(0) {};
- aItem(unsigned int id, const wxString* a, const vector<unsigned int>& hl)
+ aItem(unsigned int id, const wxString* a, const std::vector<unsigned int>& hl)
: id(id), action(a), hlChars(hl), rank(SearchListBox::CalcRank(hl)) {};
bool operator<(const aItem& ai) const {
if (rank < ai.rank) return true;
@@ -74,12 +66,12 @@ class SymbolList : public wxPanel {
}
unsigned int id;
const wxString* action;
- vector<unsigned int> hlChars;
+ std::vector<unsigned int> hlChars;
unsigned int rank;
};
const wxArrayString& m_actions;
- vector<aItem> m_items;
+ std::vector<aItem> m_items;
wxString m_searchText;
};
@@ -94,7 +86,7 @@ class SymbolList : public wxPanel {
bool m_keepOpen;
- vector<SymbolRef> m_symbols;
+ std::vector<SymbolRef> m_symbols;
wxArrayString m_symbolStrings;
};

0 comments on commit 355c287

Please sign in to comment.