Changeset 124 for cafu/branches/cafu_to_wx/CaWE/ChildFrame.cpp
- Timestamp:
- 08/20/10 15:06:58 (21 months ago)
- Files:
-
- 1 modified
-
cafu/branches/cafu_to_wx/CaWE/ChildFrame.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cafu/branches/cafu_to_wx/CaWE/ChildFrame.cpp
r108 r124 459 459 wxToolBar* ToolbarTools=new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER); 460 460 ToolbarTools->SetToolBitmapSize(wxSize(21, 18)); 461 462 // Note that we cannot have separators between these tools, because they must all be in the same radio group. 461 463 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_SELECTION, "Selection", wxBitmap("CaWE/res/Tool_Selection.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "Selection", "Selection" ); 462 464 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_CAMERA, "Camera", wxBitmap("CaWE/res/Tool_Camera.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "Camera" ); 463 ToolbarTools->AddSeparator();464 465 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_NEWBRUSH, "New Brush", wxBitmap("CaWE/res/Tool_NewBrush.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "New Brush" ); 465 466 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_NEWENTITY, "New Entity", wxBitmap("CaWE/res/Tool_NewEntity.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "New Entity" ); … … 468 469 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_NEWLIGHT, "New Light", wxBitmap("CaWE/res/Tool_NewLight.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "New Light" ); 469 470 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_NEWDECAL, "New Decal", wxBitmap("CaWE/res/Tool_NewDecal.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "New Decal" ); 470 ToolbarTools->AddSeparator();471 471 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_EDITSURFACEPROPERTIES, "Edit Surface Properties", wxBitmap("CaWE/res/Tool_EditSurfProps.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "Edit Surface Properties"); 472 472 ToolbarTools->AddRadioTool(ID_MENU_TOOLS_TOOL_TERRAINEDITOR, "Edit Terrain", wxBitmap("CaWE/res/Tool_EditTerrain.png", wxBITMAP_TYPE_PNG), wxNullBitmap, "Edit Terrain" ); … … 1134 1134 void ChildFrameT::OnMenuTools(wxCommandEvent& CE) 1135 1135 { 1136 switch (CE.GetId()) 1137 { 1138 case 0: 1139 default: 1140 { 1141 // Find the tool whose wxWidgets event ID matches CE.GetId(). 1142 const ArrayT<ToolT*>& Tools=m_ToolManager->GetTools(); 1143 1144 for (unsigned long ToolNr=0; ToolNr<Tools.Size(); ToolNr++) 1145 { 1146 ToolT* Tool=Tools[ToolNr]; 1147 1148 if (Tool->GetWxEventID()==CE.GetId()) 1149 { 1150 m_ToolManager->SetActiveTool(Tool->GetType()); 1151 break; 1152 } 1153 } 1136 // Find the tool whose wxWidgets event ID matches CE.GetId(). 1137 const ArrayT<ToolT*>& Tools=m_ToolManager->GetTools(); 1138 1139 for (unsigned long ToolNr=0; ToolNr<Tools.Size(); ToolNr++) 1140 { 1141 ToolT* Tool=Tools[ToolNr]; 1142 1143 if (Tool->GetWxEventID()==CE.GetId()) 1144 { 1145 m_ToolManager->SetActiveTool(Tool->GetType()); 1146 break; 1154 1147 } 1155 1148 } … … 1159 1152 void ChildFrameT::OnMenuToolsUpdate(wxUpdateUIEvent& UE) 1160 1153 { 1161 switch (UE.GetId()) 1162 { 1163 case 0: 1164 default: 1165 { 1166 // Find the tool whose wxWidgets event ID matches UE.GetId(). 1167 const ArrayT<ToolT*>& Tools=m_ToolManager->GetTools(); 1168 1169 for (unsigned long ToolNr=0; ToolNr<Tools.Size(); ToolNr++) 1170 { 1171 ToolT* Tool=Tools[ToolNr]; 1172 1173 if (Tool->GetWxEventID()==UE.GetId()) 1174 { 1175 UE.Check(Tool->IsActiveTool()); 1176 break; 1177 } 1178 } 1179 } 1180 } 1154 const ToolT* ActiveTool=m_ToolManager->GetActiveTool(); 1155 1156 if (ActiveTool && ActiveTool->GetWxEventID()==UE.GetId()) 1157 UE.Check(true); 1181 1158 } 1182 1159
