2007-05-06 16:03:28 +00:00
|
|
|
/* Macros utiles */
|
|
|
|
|
|
|
|
#ifndef MACROS_H
|
|
|
|
#define MACROS_H
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#if wxUSE_UNICODE
|
|
|
|
#define CONV_TO_UTF8(wxstring) ((const char*) wxConvCurrent->cWX2MB(wxstring))
|
|
|
|
#define CONV_FROM_UTF8(utf8string) ( wxConvCurrent->cMB2WC(utf8string))
|
|
|
|
#else
|
|
|
|
#define CONV_TO_UTF8(wxstring) ((const char*)(wxstring.c_str()))
|
|
|
|
#define CONV_FROM_UTF8(utf8string) (utf8string)
|
|
|
|
#endif
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
/* violation of C++ standard, cannot use MIN() and MAX()
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifndef min
|
2007-08-23 04:28:46 +00:00
|
|
|
#define MIN(x, y) ((x) > (y) ? (y) : (x))
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
|
|
|
#ifndef max
|
2007-08-23 04:28:46 +00:00
|
|
|
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
2007-08-23 04:28:46 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifndef MIN
|
|
|
|
#define MIN(x, y) ((x) > (y) ? (y) : (x))
|
|
|
|
#endif
|
|
|
|
#ifndef MAX
|
|
|
|
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ABS
|
|
|
|
#define ABS(y) ((y) >= 0 ? (y) : (-(y)))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define DEG2RAD(Deg) ((Deg) * M_PI / 180.0)
|
|
|
|
#define RAD2DEG(Rad) ((Rad) * 180.0 / M_PI)
|
|
|
|
|
|
|
|
/* Normalize angle to be in the -360.0 .. 360.0 range or 0 .. 360.0: */
|
|
|
|
#define NORMALIZE_ANGLE(Angle) { while (Angle < 0) Angle += 3600; \
|
|
|
|
while (Angle > 3600) Angle -= 3600; }
|
|
|
|
|
|
|
|
/* Normalize angle to be in the 0.0 .. 360.0 range: */
|
|
|
|
#define NORMALIZE_ANGLE_POS(Angle) { while (Angle < 0) Angle += 3600; while (Angle >= 3600) Angle -= 3600; }
|
|
|
|
#define NEGATE_AND_NORMALIZE_ANGLE_POS(Angle) \
|
|
|
|
{ Angle = - Angle; while (Angle < 0) Angle += 3600; while (Angle >= 3600) Angle -= 3600; }
|
|
|
|
|
2007-07-30 11:15:54 +00:00
|
|
|
/* Normalize angle to be in the -90.0 .. 90.0 range */
|
|
|
|
#define NORMALIZE_ANGLE_90(Angle) { while (Angle < -900) Angle += 1800; \
|
|
|
|
while (Angle > 900) Angle -= 1800; }
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
/* exchange 2 donnees */
|
|
|
|
#define EXCHG(a,b) { typeof(a) __temp__ = (a); (a) = (b); (b) = __temp__; }
|
|
|
|
|
|
|
|
/* macro for insert menuitems with a icon: */
|
|
|
|
#define ADD_MENUITEM(menu, id, text, icon) {\
|
|
|
|
wxMenuItem * l_item;\
|
|
|
|
l_item = new wxMenuItem(menu, id, text);\
|
|
|
|
l_item->SetBitmap(icon); menu->Append(l_item);}
|
|
|
|
|
2007-06-25 08:05:45 +00:00
|
|
|
#define ADD_MENUITEM_WITH_HELP(menu, id, text, help, icon) {\
|
|
|
|
wxMenuItem * l_item;\
|
|
|
|
l_item = new wxMenuItem(menu, id, text, help);\
|
|
|
|
l_item->SetBitmap(icon); menu->Append(l_item);}
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
#define ADD_MENUITEM_WITH_SUBMENU(menu, submenu, id, text, icon) {\
|
|
|
|
wxMenuItem * l_item;\
|
|
|
|
l_item = new wxMenuItem(menu, id, text);\
|
|
|
|
l_item->SetSubMenu(submenu);\
|
|
|
|
l_item->SetBitmap(icon);\
|
|
|
|
l_item->SetFont(* g_ItalicFont);\
|
|
|
|
menu->Append(l_item);}
|
|
|
|
|
|
|
|
#define ADD_MENUITEM_WITH_HELP_AND_SUBMENU(menu, submenu, id, text, help, icon) {\
|
|
|
|
wxMenuItem * l_item;\
|
|
|
|
l_item = new wxMenuItem(menu, id, text, help);\
|
|
|
|
l_item->SetSubMenu(submenu);\
|
|
|
|
l_item->SetBitmap(icon);\
|
|
|
|
l_item->SetFont(*g_ItalicFont);\
|
|
|
|
menu->Append(l_item);}
|
|
|
|
#else
|
|
|
|
#define ADD_MENUITEM_WITH_SUBMENU(menu, submenu, id, text, icon) {\
|
|
|
|
wxMenuItem * l_item;\
|
|
|
|
l_item = new wxMenuItem(menu, id, text);\
|
|
|
|
l_item->SetSubMenu(submenu);\
|
|
|
|
l_item->SetBitmap(icon);\
|
|
|
|
menu->Append(l_item);}
|
|
|
|
|
|
|
|
#define ADD_MENUITEM_WITH_HELP_AND_SUBMENU(menu, submenu, id, text, help, icon) {\
|
|
|
|
wxMenuItem * l_item;\
|
|
|
|
l_item = new wxMenuItem(menu, id, text, help);\
|
|
|
|
l_item->SetSubMenu(submenu);\
|
|
|
|
l_item->SetBitmap(icon);\
|
|
|
|
menu->Append(l_item);}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WINDOWS__
|
|
|
|
#define SETBITMAPS(icon) item->SetBitmaps(apply_xpm, (icon))
|
|
|
|
#else
|
|
|
|
#define SETBITMAPS(icon)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ifdef MACRO_H */
|
|
|
|
|