Commit a019b12b authored by bitplane's avatar bitplane

Made the GUI editor use MAKE_IRR_ID for its own event types instead of using...

Made the GUI editor use MAKE_IRR_ID for its own event types instead of using user events, and forced EEVENT_TYPE to 32-bit so this always works for users.

Renamed VC8 GUI editor and font tool project files. Disabled vector fonts since there's still no loader.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1618 dfc29bdd-3216-0410-991c-e03cc46cb475
parent dee929e0
...@@ -52,7 +52,12 @@ namespace irr ...@@ -52,7 +52,12 @@ namespace irr
casted to s32 and used as UserData1 and UserData2. casted to s32 and used as UserData1 and UserData2.
MacOS: Not yet implemented MacOS: Not yet implemented
*/ */
EET_USER_EVENT EET_USER_EVENT,
//! This enum is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
EGUIET_FORCE_32_BIT = 0x7fffffff
}; };
//! Enumeration for all mouse input events //! Enumeration for all mouse input events
......
...@@ -22,7 +22,7 @@ namespace irr ...@@ -22,7 +22,7 @@ namespace irr
namespace gui namespace gui
{ {
const u32 ATTRIBEDIT_ATTRIB_CHANGED=0xA77ED17; // hopefully nobody else is using this number const u32 ATTRIBEDIT_ATTRIB_CHANGED=MAKE_IRR_ID('A','T','T','R');
class CGUIAttribute : public IGUIElement class CGUIAttribute : public IGUIElement
{ {
...@@ -133,10 +133,9 @@ namespace gui ...@@ -133,10 +133,9 @@ namespace gui
{ {
// build event and pass to parent // build event and pass to parent
SEvent event; SEvent event;
event.EventType = EET_USER_EVENT; event.EventType = (EEVENT_TYPE)ATTRIBEDIT_ATTRIB_CHANGED;
event.UserEvent.UserData1 = ATTRIBEDIT_ATTRIB_CHANGED; event.UserEvent.UserData1 = MyParentID;
event.UserEvent.UserData2 = MyParentID; event.UserEvent.UserData2 = Index;
event.UserEvent.UserData3 = (f32)Index;
return Parent->OnEvent(event); return Parent->OnEvent(event);
} }
......
...@@ -224,39 +224,31 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e) ...@@ -224,39 +224,31 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
IGUIFileOpenDialog* dialog=0; IGUIFileOpenDialog* dialog=0;
switch(e.EventType) switch(e.EventType)
{ {
case EET_USER_EVENT: case (EEVENT_TYPE)ATTRIBEDIT_ATTRIB_CHANGED:
{ {
switch (e.UserEvent.UserData1) switch (e.UserEvent.UserData1)
{ {
case ATTRIBEDIT_ATTRIB_CHANGED: case EGUIEDCE_ATTRIB_EDITOR:
{ {
switch (e.UserEvent.UserData2) // update selected items attributes
if (SelectedElement)
{ {
case EGUIEDCE_ATTRIB_EDITOR: SelectedElement->deserializeAttributes(EditorWindow->getAttributeEditor()->getAttribs());
{
// update selected items attributes
if (SelectedElement)
{
SelectedElement->deserializeAttributes(EditorWindow->getAttributeEditor()->getAttribs());
}
return true;
}
case EGUIEDCE_OPTION_EDITOR:
{
// update editor options
deserializeAttributes(EditorWindow->getOptionEditor()->getAttribs());
return true;
}
case EGUIEDCE_ENV_EDITOR:
{
// update environment
Environment->deserializeAttributes(EditorWindow->getEnvironmentEditor()->getAttribs());
return true;
}
} }
return true;
}
case EGUIEDCE_OPTION_EDITOR:
{
// update editor options
deserializeAttributes(EditorWindow->getOptionEditor()->getAttribs());
return true;
}
case EGUIEDCE_ENV_EDITOR:
{
// update environment
Environment->deserializeAttributes(EditorWindow->getEnvironmentEditor()->getAttribs());
return true;
} }
break;
} }
} }
break; break;
......
...@@ -24,10 +24,9 @@ namespace gui ...@@ -24,10 +24,9 @@ namespace gui
// custom events // custom events
enum EGUIEDIT_CUSTOM_EVENTS enum EGUIEDIT_CUSTOM_EVENTS
{ {
EGUIEDCE_ATTRIB_EDITOR=0xED17, // some number hopefully nobody else is using EGUIEDCE_ATTRIB_EDITOR = MAKE_IRR_ID('g','A','t','t'),
EGUIEDCE_OPTION_EDITOR, EGUIEDCE_OPTION_EDITOR = MAKE_IRR_ID('g','O','p','t'),
EGUIEDCE_ENV_EDITOR, EGUIEDCE_ENV_EDITOR = MAKE_IRR_ID('g','E','n','v')
EGUIEDCE_COUNT
}; };
class CGUIEditWorkspace : public IGUIElement class CGUIEditWorkspace : public IGUIElement
......
...@@ -650,7 +650,7 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format) ...@@ -650,7 +650,7 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format)
c[0] = (*it).getKey(); c[0] = (*it).getKey();
c[1] = L'\0'; c[1] = L'\0';
core::stringw area, under, over, image; core::stringw area, under, over, image;
area = fa.rectangle.UpperLeftCorner.X; area = core::stringw(fa.rectangle.UpperLeftCorner.X);
area += L", "; area += L", ";
area += fa.rectangle.UpperLeftCorner.Y; area += fa.rectangle.UpperLeftCorner.Y;
area += L", "; area += L", ";
...@@ -668,7 +668,7 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format) ...@@ -668,7 +668,7 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format)
// image number // image number
if (fa.sourceimage != 0) if (fa.sourceimage != 0)
{ {
image = (s32) fa.sourceimage; image = core::stringw(fa.sourceimage);
names.push_back(core::stringw(L"i")); names.push_back(core::stringw(L"i"));
values.push_back(image); values.push_back(image);
} }
...@@ -678,13 +678,13 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format) ...@@ -678,13 +678,13 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format)
if (fa.underhang != 0) if (fa.underhang != 0)
{ {
under = fa.underhang; under = core::stringw(fa.underhang);
names.push_back(core::stringw(L"u")); names.push_back(core::stringw(L"u"));
values.push_back(under); values.push_back(under);
} }
if (fa.overhang != 0) if (fa.overhang != 0)
{ {
over = fa.overhang; over = core::stringw(fa.overhang);
names.push_back(core::stringw(L"o")); names.push_back(core::stringw(L"o"));
values.push_back(over); values.push_back(over);
} }
......
...@@ -1059,8 +1059,8 @@ public: ...@@ -1059,8 +1059,8 @@ public:
c[0] = chars[n]; c[0] = chars[n];
c[1] = L'\0'; c[1] = L'\0';
core::stringw area, under, over; core::stringw area, under, over;
area = fa.rectangle.LowerRightCorner.X- area = core::stringw(fa.rectangle.LowerRightCorner.X-
fa.rectangle.UpperLeftCorner.X; fa.rectangle.UpperLeftCorner.X);
area += L", "; area += L", ";
area += fa.rectangle.LowerRightCorner.Y- area += fa.rectangle.LowerRightCorner.Y-
fa.rectangle.UpperLeftCorner.Y; fa.rectangle.UpperLeftCorner.Y;
...@@ -1087,13 +1087,13 @@ public: ...@@ -1087,13 +1087,13 @@ public:
if (fa.underhang != 0) if (fa.underhang != 0)
{ {
under = fa.underhang; under = core::stringw(fa.underhang);
names.push_back(core::stringw(L"u")); names.push_back(core::stringw(L"u"));
values.push_back(under); values.push_back(under);
} }
if (fa.overhang != 0) if (fa.overhang != 0)
{ {
over = fa.overhang; over = core::stringw(fa.overhang);
names.push_back(core::stringw(L"o")); names.push_back(core::stringw(L"o"));
values.push_back(over); values.push_back(over);
} }
...@@ -1105,7 +1105,7 @@ public: ...@@ -1105,7 +1105,7 @@ public:
// write vertex data // write vertex data
core::stringw data, count; core::stringw data, count;
data = L""; data = L"";
count = triangles.positions.size(); count = core::stringw(triangles.positions.size());
for (u32 i=0; i<triangles.positions.size(); ++i) for (u32 i=0; i<triangles.positions.size(); ++i)
{ {
if (i!=0) if (i!=0)
...@@ -1119,7 +1119,7 @@ public: ...@@ -1119,7 +1119,7 @@ public:
// write index list // write index list
data = L""; data = L"";
count = triangles.indexes.size(); count = core::stringw(triangles.indexes.size());
for (u32 i=0; i<triangles.indexes.size(); i+=3) for (u32 i=0; i<triangles.indexes.size(); i+=3)
{ {
if (i!=0) if (i!=0)
......
 
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005 # Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_v8.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
...@@ -196,8 +196,9 @@ public: ...@@ -196,8 +196,9 @@ public:
chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ANTIALIAS,true); chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ANTIALIAS,true);
bool aa = chk->isChecked(); bool aa = chk->isChecked();
chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true); // vector fonts disabled
bool vec = chk->isChecked(); //chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true);
bool vec = false;//chk->isChecked();
FontTool->makeBitmapFont(fontname, charset, FontTool->FontSizes[fontsize], texturesizes[texwidth], texturesizes[texheight], bold, italic, aa, alpha); FontTool->makeBitmapFont(fontname, charset, FontTool->FontSizes[fontsize], texturesizes[texwidth], texturesizes[texheight], bold, italic, aa, alpha);
...@@ -254,8 +255,9 @@ public: ...@@ -254,8 +255,9 @@ public:
IGUIComboBox *fmt = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true); IGUIComboBox *fmt = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true);
core::stringc format = fmt->getItem(fmt->getSelected()); core::stringc format = fmt->getItem(fmt->getSelected());
// vector fonts disabled
IGUICheckBox *chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true); IGUICheckBox *chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true);
bool vec = chk->isChecked(); bool vec = false; // chk->isChecked();
if (vec && VecTool) if (vec && VecTool)
VecTool->saveVectorFont(name.c_str(), format.c_str()); VecTool->saveVectorFont(name.c_str(), format.c_str());
...@@ -358,7 +360,10 @@ void createGUI(IrrlichtDevice* device, CFontTool* fc) ...@@ -358,7 +360,10 @@ void createGUI(IrrlichtDevice* device, CFontTool* fc)
xp = xs; xp = xs;
yp += (s32)(h*1.5f); yp += (s32)(h*1.5f);
/*
// vector fonts can't be loaded yet
env->addCheckBox(false, core::rect<s32>(xp,yp,xp+200,yp+h),win, MYGUI_VECTOR, L"Vector Font"); env->addCheckBox(false, core::rect<s32>(xp,yp,xp+200,yp+h),win, MYGUI_VECTOR, L"Vector Font");
*/
yp += (s32)(h*1.5f); yp += (s32)(h*1.5f);
...@@ -460,10 +465,10 @@ int main() ...@@ -460,10 +465,10 @@ int main()
} }
} }
device->drop();
// drop the font tool and resources // drop the font tool and resources
fc->drop(); fc->drop();
device->drop();
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment