User forums > Help
When will we get Code::Blocks for Mac OS X?
Pecan:
--- Quote from: bnilsson on July 17, 2006, 02:39:33 pm ---I realize I have not presented my platform:
PoweMac G5 dual 2.3GHz
Mac OS X 10.4.7
wxwidgets 2.6.3 / darwinports
I did svn checkout of CB, a re-install of wxwidgets, bootstrap, configure and make.
This time I did not get very far in make:
./infowindow.h:52: error: expected class-name before '{' token
make[2]: *** [sdk.h.gch] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
and if I just remove by // : public wxPopupWindow
to test and condinue make I get another halt at
./src/propgrid/propgrid.cpp: In member function 'virtual bool wxPropertyGrid::SetFont(const wxFont&)':
./src/propgrid/propgrid.cpp:5904: error: 'res' was not declared in this scope
I see no reason to continue at this point.
Any hints would be appreciated.
--- End quote ---
wxWidgets for Mac has no support for wxPopupWindow. Here is a workaround.
Replace infowindow.h and infowindow.cpp with the following.
infowindow.h
--- Code: ---/*
* Objects of type InfoWindow are autonomous and must therefore always be instantiated using operator new.
* In addition to this, InfoWindow does not have any non-static public class members.
*
* Since a (technically 100% correct) statement like
* new InfoWindow("foo", "bar");
* is unintuitive, confusing or even objective to some people, this class uses a variation of the "Named Constructor Idiom".
*
* InfoWindow::Display("foo", "bar");
* does the exact same thing as the above statement but looks a lot nicer.
*/
#ifndef INFOWINDOW_H
#define INFOWINDOW_H
//#define __WXMAC__
//-----------------------------------------------------------------------------
#if (defined(__WXMAC__) || defined(_TEST_NO_INFOWINDOW_))
//-----------------------------------------------------------------------------
// There is no wxPopupWindows for wxMac. Use wxMessageBox instead.
class InfoWindow : public wxWindow
{
public:
InfoWindow(const wxString& title, const wxString& message, unsigned int delay, unsigned int hysteresis)
{ ::wxMessageBox(message, title, wxOK, NULL, -1, -1);
Destroy();
}
~InfoWindow() {;}
static void Display(const wxString& title, const wxString& message, unsigned int delay = 5000, unsigned int hysteresis = 1)
{ new InfoWindow(title, message, delay, hysteresis);}
};
#endif //(_WXMAC_)
//-----------------------------------------------------------------------------
#if (!defined(__WXMAC__) && !defined(_TEST_NO_INFOWINDOW_))
//-----------------------------------------------------------------------------
#include <wx/event.h>
#include <wx/timer.h>
#include <wx/string.h>
#include <wx/popupwin.h>
#undef new
#include <list>
#include <algorithm>
class Stacker
{
std::list<int> widths;
public:
int StackMe(int mySize)
{
mySize += 3;
int pos = 0;
if(!widths.empty())
pos = *(std::max_element(widths.begin(), widths.end()));
widths.push_back(pos + mySize);
return pos + mySize;
};
void ReleaseMe(int myPos)
{
std::list<int>::iterator it = std::find(widths.begin(), widths.end(), myPos);
if(it != widths.end())
widths.erase(it);
};
};
class InfoWindow : public wxPopupWindow
{
wxTimer *m_timer;
int left;
int top;
int hMin;
int pos;
unsigned int status;
unsigned int m_delay;
unsigned int ks;
static Stacker stacker;
static int screenWidth;
static int screenHeight;
InfoWindow(const wxString& title, const wxString& message, unsigned int delay, unsigned int hysteresis);
virtual ~InfoWindow();
void OnTimer(wxTimerEvent& e);
void OnMove(wxMouseEvent& e);
void OnClick(wxMouseEvent& e);
DECLARE_EVENT_TABLE()
public:
static void Display(const wxString& title, const wxString& message, unsigned int delay = 5000, unsigned int hysteresis = 1)
{new InfoWindow(title, message, delay, hysteresis);};
};
#endif //!defined( _WX_MAC_)
#endif
--- End code ---
Replace infowindow.cpp with the following:
--- Code: ---#include "sdk_precomp.h"
// --------------------------------------------------------------------------
#if (!defined(__WXMAC__) && !defined(_TEST_NO_INFOWINDOW_))
// --------------------------------------------------------------------------
#ifndef CB_PRECOMP
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/settings.h>
#include "infowindow.h"
#include "manager.h"
#endif
BEGIN_EVENT_TABLE(InfoWindow, wxPopupWindow)
EVT_TIMER(-1, InfoWindow::OnTimer)
EVT_MOTION(InfoWindow::OnMove)
EVT_LEFT_DOWN(InfoWindow::OnClick)
EVT_RIGHT_DOWN(InfoWindow::OnClick)
END_EVENT_TABLE()
const wxColour titleBackground(96,96,96); // dark grey
const wxColour textBackground(255,255,160); // yellowish
const char *iBitmap[] = {
"20 20 38 1",
" c #606060",
". c gray38",
"X c #646464",
"o c #656565",
"O c gray40",
"+ c gray45",
"@ c gray50",
"# c blue",
"$ c #0808FF",
"% c #0A0AFF",
"& c #0B0BFF",
"* c #2121FF",
"= c #2828FF",
"- c #3838FF",
"; c #4545FF",
": c #4646FF",
"> c #5656FF",
", c #5959FF",
"< c gray51",
"1 c #8E8E8E",
"2 c gray59",
"3 c #9191A7",
"4 c #8888EF",
"5 c #8080F7",
"6 c #8282F7",
"7 c #8787FE",
"8 c #8A8AFE",
"9 c #9696FE",
"0 c #9797FF",
"q c #ABABFF",
"w c #CDCDFF",
"e c #D5D5FF",
"r c #E4E4F9",
"t c gray96",
"y c #F6F6F6",
"u c gray97",
"i c #F8F8F8",
"p c gray100",
" X+<1221<+O ",
" X+35,=&&=,63+X ",
" X@4:########:4@X ",
" X@5*#&>0ww0,&#*5@X ",
" +4*#-qppppppq:#*4+ ",
"X3:#:eppp##pppe:#:3X",
"+6#&qpppp##ppppq+",
"<,#,ppppp##ppppp,#,@",
"1=#9ppppp##ppppp0#=1",
"2&#wppppp##pppppw#&2",
"i&#wppppp##pppppw#&u",
"i=#9ppppp##ppppp0#=u",
"u,#>pppppppppppp>#,y",
"y8#&qpppp##ppppq$#8y",
"yr:#:eppp##pppe:#:rt",
"yy9*#:qppppppq:#*9yt",
"yyy7*#$>0ww0>&#*7ytt",
"ttyy9:########:9yytt",
"ttttyr8,=&&=,8ryyttt",
"ttttyyyyiuuuuyyyyttt"
};
Stacker InfoWindow::stacker;
// in wxGTK this initialization raises an assertion (makes sense too)
// so initialize them to -1 and we 'll set them up correctly in InfoWindow's ctor the first time
int InfoWindow::screenWidth = -1;//wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
int InfoWindow::screenHeight = -1;//wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
namespace // anonumous
{
// while in windows world, sleep(1) takes anywhere between 20-50 milliseconds,
// in linux sleep(1) means sleep 1 millisecond.
// so we need conditional compilation here in order for the scrolling effect to be
// visible under non-windows platforms :)
#ifdef __WXMSW__
static const int scroll_millis = 1;
#else
static const int scroll_millis = 5;
#endif
} // anonumous namespace
class ForwardingTextControl : public wxStaticText
{
void OnEvent(wxMouseEvent& e){e.ResumePropagation(10); e.Skip();};
DECLARE_EVENT_TABLE();
public:
ForwardingTextControl(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0) : wxStaticText(parent, id, label, pos, size, style){};
};
BEGIN_EVENT_TABLE(ForwardingTextControl, wxStaticText)
EVT_MOUSE_EVENTS(ForwardingTextControl::OnEvent)
END_EVENT_TABLE()
InfoWindow::InfoWindow(const wxString& title, const wxString& message, unsigned int delay, unsigned int hysteresis)
: wxPopupWindow(Manager::Get()->GetAppWindow(), wxSIMPLE_BORDER | wxWS_EX_TRANSIENT | wxCLIP_CHILDREN),
m_timer(new wxTimer(this, 0)), status(0), m_delay(delay), ks(2)
{
wxBoxSizer *bs = new wxBoxSizer(wxVERTICAL);
wxWindow* o = 0;
#ifdef __WXGTK__
wxBoxSizer *pbs = new wxBoxSizer(wxVERTICAL);
wxPanel* pnl = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
pnl->SetBackgroundColour(titleBackground);
ForwardingTextControl *titleC = new ForwardingTextControl(pnl, -1, title, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
pbs->Add(titleC, 0, wxALL|wxALIGN_CENTER, 5);
pnl->SetSizer(pbs);
pbs->SetSizeHints(pnl);
o = pnl;
#else
ForwardingTextControl *titleC = new ForwardingTextControl(this, -1, title, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
titleC->SetBackgroundColour(titleBackground);
o = titleC;
#endif
titleC->SetForegroundColour(*wxWHITE);
titleC->SetFont(wxFont(11, wxSWISS, wxNORMAL, wxBOLD));
bs->Add(o, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5);
ForwardingTextControl *text = new ForwardingTextControl(this, -1, message, wxDefaultPosition, wxDefaultSize, 0);
text->SetBackgroundColour(textBackground);
bs->Add(text, 0, wxALIGN_CENTER|wxALL, 12);
SetBackgroundColour(textBackground);
SetSizer(bs);
bs->SetSizeHints(this);
Layout();
#ifndef __WXGTK__
// since we used a panel, no more bitmap :(
new wxStaticBitmap(this, -1, wxBitmap(iBitmap), wxPoint(4, o->GetRect().GetBottom() - 9));
#endif
wxCoord w, h;
GetClientSize(&w, &h);
pos = stacker.StackMe(w);
// setup variables first time we enter here
if (screenWidth == -1)
screenWidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
if (screenHeight == -1)
screenHeight = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
left = screenWidth - pos;
hMin = screenHeight - h;
top = screenHeight;
Move(left, top);
Show();
m_timer->Start(hysteresis, false);
};
InfoWindow::~InfoWindow()
{
delete m_timer;
stacker.ReleaseMe(pos);
};
void InfoWindow::OnTimer(wxTimerEvent& e)
{
switch(status)
{
case 0:
status = 1;
m_timer->Start(scroll_millis, false);
break;
case 1:
top -= 2;
Move(left, top);
if(top <= hMin)
{
status = 2;
m_timer->Start(m_delay, true);
}
break;
case 2:
status = 3;
m_timer->Start(scroll_millis, false);
break;
case 3:
top += ks;
Move(left, top);
if(top > screenHeight)
{
Hide();
Destroy();
}
break;
};
};
void InfoWindow::OnMove(wxMouseEvent& e)
{
if(status == 2)
m_timer->Start(m_delay, true);
}
void InfoWindow::OnClick(wxMouseEvent& e)
{
ks = 6;
status = 3;
m_timer->Start(scroll_millis, false);
}
// --------------------------------------------------------------------------
#endif //!defined(__WXMAC__)
// --------------------------------------------------------------------------
--- End code ---
I have not tested this extensively, but I have forced it to execute on both windows and OS X 10.3.
I will make a patch as soon as I'm certain it works on all platforms.
thomas:
--- Quote ---wxWidgets for Mac has no support for wxPopupWindow. Here is a workaround.
--- End quote ---
The purpose of InfoWindow was to remove many of those annoying, intrusive dialog boxes. The idea was that even if you show messages of low importance that way ("the project was created"), it does not prevent the user from doing his work. On the downside, because InfoWindow is a lot less disturbing, we now have even more of them than before. Reverting to message boxes will probably make life on Macintosh a pain :?
The reason for using wxPopupWindow in the first place was that there is no obvious way (at least not obvious to me) to open a window that doesn't immediately hijack the focus and move the top-level window back. wxPopupWindow, on the other hand side (although not documented) is perfectly unintrusive.
Do you think it would be a good idea to try to find a hack that generates a "normal" thin-border toplevel window which gives back focus to the main window as soon as it gets it? There must be a way to accomplish this, since for example the popups shown by a wxChoice or wxComboBox are implemented using wxPopupWindow under GTK and Windows. Obviously, there must be a way to do this on MacOS, too.
--- Quote ---Or is it just a waste of time (mine and everybody else's) before a core developer gets his/her hands on a Mac?
--- End quote ---
Well, let's put it that way: my estimate of the likelihood for this to happen during the next half year is zero.
To my knowledge, none of the other core devs has access to a Mac. I am a former Mac user decided to never spend one Euro on overpriced underpowered Apple hardware again, so that concludes myself, anyway ;)
Yiannis might possibly buy a machine from the project's donations one distant day in the future. However, to date, the donations do not even cover the web hosting for the forums, so that idea is way out of sight.
Thus... unless a core dev happens to change jobs and happens to find a Mac over there, or some crazy rich Texan donates a Mac, the chances are dim, very dim... :(
Pecan:
--- Quote from: thomas on July 17, 2006, 05:58:22 pm ---
--- Quote ---wxWidgets for Mac has no support for wxPopupWindow...
--- End quote ---
The purpose of InfoWindow was to remove many of those annoying, intrusive dialog boxes.
<snip>
Do you think it would be a good idea to try to find a hack that generates a "normal" thin-border toplevel window which gives back focus to the main window as soon as it gets it? There must be a way to accomplish this, since for example the popups shown by a wxChoice or wxComboBox are implemented using wxPopupWindow under GTK and Windows. Obviously, there must be a way to do this on MacOS, too.
--- End quote ---
Yes, a hack is needed. And thank you for the hints re: wxComboBox and wxChoice.
The only reason I "hacked back" to messageBox was to get the new squirrel code working on the Mac and create new project xml's and patches.
I had already put the "infoMessage" support on the todo list.
I do, however, think that there are going to be many developers using CB on the Mac someday. Probably sooner than later looking at the interest stirred up on the forum. (Especially in schools)
Being an old Mac poo'er myself I was given the iMac and challenged to make CB work on it. With the promise that there would be a MacnTel in the future if I succeeded. So here I am..
Note: there is a wxBounty on making wxPopupWindow work on the Mac. Anyone interested?
bnilsson:
Pecan,
Thanks for the advice, I applied the workaround to infowindow.
I also made a change to wxPropertyGrid::SetFont, and moved the last return statement on line 5904 to a place inside the #if !defined(__WXMAC__) statement since it was undeclared in this context.
Now it compiles ok, but it does not link to wxwidgets, it concludes all wx symbols to be unresolved:
/usr/bin/ld: Undefined symbols:
wxStringBase::npos
wxStringBase::InitWith(wchar_t const*, unsigned long, unsigned long)
wxThread::TestDestroy()
wxThread::~wxThread()
...and more.
My wxWidgets is installed at /opt/local/lib:
ls -la /opt/local/lib/libwx*
-rwxr-xr-x 2 root admin 7245824 Jul 17 13:48 /opt/local/lib/libwx_macu-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 26 Jul 17 13:56 /opt/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 22 Jul 17 13:56 /opt/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib
-rwxr-xr-x 2 root admin 93992 Jul 17 13:52 /opt/local/lib/libwx_macu_animate-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 34 Jul 17 13:56 /opt/local/lib/libwx_macu_animate-2.6.0.dylib -> libwx_macu_animate-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 30 Jul 17 13:56 /opt/local/lib/libwx_macu_animate-2.6.dylib -> libwx_macu_animate-2.6.0.dylib
-rwxr-xr-x 2 root admin 524160 Jul 17 13:52 /opt/local/lib/libwx_macu_deprecated-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 37 Jul 17 13:56 /opt/local/lib/libwx_macu_deprecated-2.6.0.dylib -> libwx_macu_deprecated-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 33 Jul 17 13:56 /opt/local/lib/libwx_macu_deprecated-2.6.dylib -> libwx_macu_deprecated-2.6.0.dylib
-rwxr-xr-x 2 root admin 471244 Jul 17 13:49 /opt/local/lib/libwx_macu_fl-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 29 Jul 17 13:56 /opt/local/lib/libwx_macu_fl-2.6.0.dylib -> libwx_macu_fl-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 25 Jul 17 13:56 /opt/local/lib/libwx_macu_fl-2.6.dylib -> libwx_macu_fl-2.6.0.dylib
-rwxr-xr-x 2 root admin 259340 Jul 17 13:49 /opt/local/lib/libwx_macu_gizmos-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 33 Jul 17 13:56 /opt/local/lib/libwx_macu_gizmos-2.6.0.dylib -> libwx_macu_gizmos-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 29 Jul 17 13:56 /opt/local/lib/libwx_macu_gizmos-2.6.dylib -> libwx_macu_gizmos-2.6.0.dylib
-rwxr-xr-x 2 root admin 44872 Jul 17 13:49 /opt/local/lib/libwx_macu_gizmos_xrc-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 37 Jul 17 13:56 /opt/local/lib/libwx_macu_gizmos_xrc-2.6.0.dylib -> libwx_macu_gizmos_xrc-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 33 Jul 17 13:56 /opt/local/lib/libwx_macu_gizmos_xrc-2.6.dylib -> libwx_macu_gizmos_xrc-2.6.0.dylib
-rwxr-xr-x 2 root admin 73348 Jul 17 13:48 /opt/local/lib/libwx_macu_gl-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 29 Jul 17 13:56 /opt/local/lib/libwx_macu_gl-2.6.0.dylib -> libwx_macu_gl-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 25 Jul 17 13:56 /opt/local/lib/libwx_macu_gl-2.6.dylib -> libwx_macu_gl-2.6.0.dylib
-rwxr-xr-x 2 root admin 474980 Jul 17 13:50 /opt/local/lib/libwx_macu_ogl-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 30 Jul 17 13:56 /opt/local/lib/libwx_macu_ogl-2.6.0.dylib -> libwx_macu_ogl-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 26 Jul 17 13:56 /opt/local/lib/libwx_macu_ogl-2.6.dylib -> libwx_macu_ogl-2.6.0.dylib
-rwxr-xr-x 2 root admin 148260 Jul 17 13:50 /opt/local/lib/libwx_macu_plot-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 31 Jul 17 13:56 /opt/local/lib/libwx_macu_plot-2.6.0.dylib -> libwx_macu_plot-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 27 Jul 17 13:56 /opt/local/lib/libwx_macu_plot-2.6.dylib -> libwx_macu_plot-2.6.0.dylib
-rwxr-xr-x 2 root admin 1189712 Jul 17 13:51 /opt/local/lib/libwx_macu_stc-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 30 Jul 17 13:56 /opt/local/lib/libwx_macu_stc-2.6.0.dylib -> libwx_macu_stc-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 26 Jul 17 13:56 /opt/local/lib/libwx_macu_stc-2.6.dylib -> libwx_macu_stc-2.6.0.dylib
-rwxr-xr-x 2 root admin 99268 Jul 17 13:51 /opt/local/lib/libwx_macu_svg-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 30 Jul 17 13:56 /opt/local/lib/libwx_macu_svg-2.6.0.dylib -> libwx_macu_svg-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 26 Jul 17 13:56 /opt/local/lib/libwx_macu_svg-2.6.dylib -> libwx_macu_svg-2.6.0.dylib
What is the expected path for wxWidgets?
Pecan:
--- Quote from: bnilsson on July 17, 2006, 06:25:58 pm ---Pecan,
Thanks for the advice, I applied the workaround to infowindow.
I also made a change to wxPropertyGrid::SetFont, and moved the last return statement on line 5904 to a place inside the #if !defined(__WXMAC__) statement since it was undeclared in this context.
Now it compiles ok, but it does not link to wxwidgets, it concludes all wx symbols to be unresolved:
/usr/bin/ld: Undefined symbols:
wxStringBase::npos
wxStringBase::InitWith(wchar_t const*, unsigned long, unsigned long)
wxThread::TestDestroy()
wxThread::~wxThread()
...and more.
My wxWidgets is installed at /opt/local/lib:
ls -la /opt/local/lib/libwx*
-rwxr-xr-x 2 root admin 7245824 Jul 17 13:48 /opt/local/lib/libwx_macu-2.6.0.3.1.dylib
lrwxr-xr-x 1 root admin 26 Jul 17 13:56 /opt/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib
<snip>
lrwxr-xr-x 1 root admin 26 Jul 17 13:56 /opt/local/lib/libwx_macu_svg-2.6.dylib -> libwx_macu_svg-2.6.0.dylib
What is the expected path for wxWidgets?
--- End quote ---
1) you're using unicode. Is codeblocks compiled as unicode? or ansi?
2) what does your "wx-config --cflags" and "wx-config --libs" produce?
So far, I believe I'm the only one using unicode. It has a bug that'll byte you hard.
Do a search on this forum for strconv.cpp
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version