Changeset 442
- Timestamp:
- 12/13/11 11:31:01 (5 months ago)
- Location:
- cafu/trunk/CaWE
- Files:
-
- 4 modified
-
DialogInsp-PrimitiveProps.cpp (modified) (16 diffs)
-
DialogInsp-PrimitiveProps.hpp (modified) (2 diffs)
-
ToolOptionsBars.cpp (modified) (3 diffs)
-
ToolOptionsBars.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/DialogInsp-PrimitiveProps.cpp
r414 r442 33 33 #include "MapCommands/ChangePlantDescr.hpp" 34 34 #include "MapCommands/ModifyModel.hpp" 35 #include "MapCommands/SetBPSubdivs.hpp" 35 36 36 37 #include "wx/notebook.h" … … 50 51 const wxString& label=wxPG_LABEL, 51 52 const wxString& value=wxEmptyString, 52 MapDocumentT* MapDoc _=NULL,53 wxString Filter _="All files (*.*)|*.*",54 wxString SubDir _=wxEmptyString)53 MapDocumentT* MapDoc=NULL, 54 wxString Filter="All files (*.*)|*.*", 55 wxString SubDir=wxEmptyString) 55 56 : wxLongStringProperty(name, label, value), 56 MapDoc(MapDoc_),57 Filter(Filter_),58 SubDir(SubDir_)57 m_MapDoc(MapDoc), 58 m_Filter(Filter), 59 m_SubDir(SubDir) 59 60 { 60 61 } … … 63 64 virtual bool OnButtonClick(wxPropertyGrid* propGrid, wxString& value) 64 65 { 65 wxString InitialDir = MapDoc->GetGameConfig()->ModDir+SubDir;66 wxString FileNameStr=wxFileSelector("Please select a file", InitialDir, "", "", Filter, wxFD_OPEN | wxFD_FILE_MUST_EXIST);66 wxString InitialDir =m_MapDoc->GetGameConfig()->ModDir+m_SubDir; 67 wxString FileNameStr=wxFileSelector("Please select a file", InitialDir, "", "", m_Filter, wxFD_OPEN | wxFD_FILE_MUST_EXIST); 67 68 68 69 if (FileNameStr=="") return false; 69 70 70 71 wxFileName FileName(FileNameStr); 71 FileName.MakeRelativeTo( MapDoc->GetGameConfig()->ModDir);72 FileName.MakeRelativeTo(m_MapDoc->GetGameConfig()->ModDir); 72 73 value=FileName.GetFullPath(wxPATH_UNIX); 73 74 return true; … … 77 78 private: 78 79 79 MapDocumentT* MapDoc;80 wxString Filter;81 wxString SubDir;80 MapDocumentT* m_MapDoc; 81 wxString m_Filter; 82 wxString m_SubDir; 82 83 }; 83 84 84 85 85 BEGIN_EVENT_TABLE(InspDlgPrimitivePropsT, wxPanel)86 EVT_PG_CHANGED(ID_PROPERTY_GRID_MAN, InspDlgPrimitivePropsT::OnPropertyGridChanged)87 END_EVENT_TABLE()88 89 90 86 wxSizer* InspDlgPrimitivePropsT::InspectorPrimitivePropsInit(wxWindow* parent, bool call_fit, bool set_sizer) 91 87 { 92 88 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); 93 89 94 SelectionText=new wxStaticText(parent, -1, wxT("No map primitve is selected."), wxDefaultPosition, wxDefaultSize, 0);95 item0->Add( SelectionText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);90 m_SelectionText=new wxStaticText(parent, -1, wxT("No map primitve is selected."), wxDefaultPosition, wxDefaultSize, 0); 91 item0->Add(m_SelectionText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2); 96 92 97 93 // BEGIN CUSTOM code, not generated by wxDesigner. 98 94 99 PropMan=new wxPropertyGridManager(this, ID_PROPERTY_GRID_MAN, wxDefaultPosition, wxDefaultSize, wxPG_BOLD_MODIFIED | wxPG_SPLITTER_AUTO_CENTER | wxPG_TOOLBAR | wxPG_DESCRIPTION);100 PropMan->SetExtraStyle(wxPG_EX_HELP_AS_TOOLTIPS | wxPG_EX_MODE_BUTTONS);101 102 PropMan->AddPage("Properties");95 m_PropMan=new wxPropertyGridManager(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_BOLD_MODIFIED | wxPG_SPLITTER_AUTO_CENTER | wxPG_TOOLBAR | wxPG_DESCRIPTION); 96 m_PropMan->SetExtraStyle(wxPG_EX_HELP_AS_TOOLTIPS | wxPG_EX_MODE_BUTTONS); 97 98 m_PropMan->AddPage("Properties"); 103 99 104 100 // END CUSTOM code, not generated by wxDesigner. 105 101 106 item0->Add( PropMan, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 2 );102 item0->Add( m_PropMan, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 2 ); 107 103 108 104 if (set_sizer) … … 117 113 118 114 119 InspDlgPrimitivePropsT::InspDlgPrimitivePropsT(wxWindow* Parent_, MapDocumentT* MapDoc_) 120 : wxPanel(Parent_), 121 MapDoc(MapDoc_), 122 SelectionText(NULL), 123 IsRecursiveSelfNotify(false) 124 { 115 InspDlgPrimitivePropsT::InspDlgPrimitivePropsT(wxWindow* Parent, MapDocumentT* MapDoc) 116 : wxPanel(Parent), 117 m_MapDoc(MapDoc), 118 m_PropMan(NULL), 119 m_SelectionText(NULL), 120 m_IsRecursiveSelfNotify(false) 121 { 122 wxPropertyGridInterface::RegisterAdditionalEditors(); 123 125 124 InspectorPrimitivePropsInit(this); 126 MapDoc->RegisterObserver(this); 125 Bind(wxEVT_PG_CHANGED, &InspDlgPrimitivePropsT::OnPropertyGridChanged, this); 126 m_MapDoc->RegisterObserver(this); 127 127 } 128 128 … … 130 130 InspDlgPrimitivePropsT::~InspDlgPrimitivePropsT() 131 131 { 132 PropMan->Clear();133 if ( MapDoc)MapDoc->UnregisterObserver(this);132 m_PropMan->Clear(); 133 if (m_MapDoc) m_MapDoc->UnregisterObserver(this); 134 134 } 135 135 … … 137 137 void InspDlgPrimitivePropsT::NotifySubjectChanged_Selection(SubjectT* Subject, const ArrayT<MapElementT*>& OldSelection, const ArrayT<MapElementT*>& NewSelection) 138 138 { 139 if ( IsRecursiveSelfNotify) return;139 if (m_IsRecursiveSelfNotify) return; 140 140 141 141 UpdateGrid(); … … 145 145 void InspDlgPrimitivePropsT::NotifySubjectChanged_Deleted(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements) 146 146 { 147 // No need to react on deleted objects.147 // No need to act on deleted objects. 148 148 // If the deletion of an object changes the current selection the inspector is notified in the NotifySubjectChanged_Selection method. 149 149 } … … 152 152 void InspDlgPrimitivePropsT::NotifySubjectChanged_Modified(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements, MapElemModDetailE Detail) 153 153 { 154 if ( IsRecursiveSelfNotify) return;154 if (m_IsRecursiveSelfNotify) return; 155 155 156 156 if (Detail!=MEMD_PRIMITIVE_PROPS_CHANGED && Detail!=MEMD_GENERIC) return; … … 169 169 void InspDlgPrimitivePropsT::NotifySubjectChanged_Modified(SubjectT* Subject, const ArrayT<MapElementT*>& MapElements, MapElemModDetailE Detail, const ArrayT<BoundingBox3fT>& OldBounds) 170 170 { 171 if ( IsRecursiveSelfNotify) return;171 if (m_IsRecursiveSelfNotify) return; 172 172 173 173 if (Detail!=MEMD_PRIMITIVE_PROPS_CHANGED) return; … … 186 186 void InspDlgPrimitivePropsT::NotifySubjectDies(SubjectT* dyingSubject) 187 187 { 188 wxASSERT(dyingSubject== MapDoc);189 MapDoc=NULL;188 wxASSERT(dyingSubject==m_MapDoc); 189 m_MapDoc=NULL; 190 190 } 191 191 … … 195 195 ArrayT<MapPrimitiveT*> SelectedPrimitives; 196 196 197 // Loop over the map selection in order to determine the list of selected map primitves. 198 for (unsigned long i=0; i<MapDoc->GetSelection().Size(); i++) 199 { 200 MapPrimitiveT* Prim=dynamic_cast<MapPrimitiveT*>(MapDoc->GetSelection()[i]); 197 // Find the map primitives in the selection (ignore all entities). 198 // There is no need to bother with the entities, as it's up to the selection tool 199 // to explicitly add their items/children to the selection - or not. 200 for (unsigned long i=0; i<m_MapDoc->GetSelection().Size(); i++) 201 { 202 MapPrimitiveT* Prim=dynamic_cast<MapPrimitiveT*>(m_MapDoc->GetSelection()[i]); 201 203 202 204 if (Prim) 203 {204 205 SelectedPrimitives.PushBack(Prim); 205 continue;206 }207 208 MapEntityBaseT* Ent=dynamic_cast<MapEntityBaseT*>(MapDoc->GetSelection()[i]);209 210 if (Ent)211 {212 SelectedPrimitives.PushBack(Ent->GetPrimitives());213 continue;214 }215 206 } 216 207 217 208 // Update the selection description text. 218 209 if (SelectedPrimitives.Size()==0) 219 SelectionText->SetLabel("No map primitive selected.");210 m_SelectionText->SetLabel("No map primitive selected."); 220 211 else if (SelectedPrimitives.Size()==1) 221 SelectionText->SetLabel("1 map primitive selected.");212 m_SelectionText->SetLabel("1 map primitive selected."); 222 213 else 223 SelectionText->SetLabel(wxString::Format("%lu map primitives selected.", SelectedPrimitives.Size())); 224 225 PropMan->ClearSelection(); // Clear the property grid. 226 PropMan->ClearPage(0); // At the moment we only got one page, so we only need to delete this page. 227 228 unsigned int BrushCount =0; 229 unsigned int BPCount =0; 230 unsigned int TerrainCount=0; 231 unsigned int PlantCount =0; 232 unsigned int ModelCount =0; 214 m_SelectionText->SetLabel(wxString::Format("%lu map primitives selected.", SelectedPrimitives.Size())); 215 216 m_PropMan->ClearSelection(); // Clear the property grid. 217 m_PropMan->ClearPage(0); // At the moment we only got one page, so we only need to delete this page. 218 219 static const wxColour HEADING_COLOR("#CCCCCC"); 233 220 234 221 // Create a category for every selected map primitve and fill it with the primitves properties. 235 222 for (unsigned long i=0; i<SelectedPrimitives.Size(); i++) 236 223 { 224 const int EntityNr=m_MapDoc->GetEntities().Find(SelectedPrimitives[i]->GetParent()); 225 const int ItemNr =EntityNr>=0 ? m_MapDoc->GetEntities()[EntityNr]->GetPrimitives().Find(SelectedPrimitives[i]) : -1; 226 const wxString ItemStr =wxString::Format(" (item %i in entity %i)", ItemNr, EntityNr); 227 237 228 if (dynamic_cast<MapBrushT*>(SelectedPrimitives[i])!=NULL) 238 229 { 239 wxPGProperty* Cat=PropMan->Append(new wxStringProperty(SelectedPrimitives[i]->GetType()->ClassName+wxString::Format("%i", ++BrushCount), wxPG_LABEL, "<composed>")); 240 PropMan->DisableProperty(Cat); 230 wxPGProperty* Cat=m_PropMan->Append(new wxStringProperty("Brush" + ItemStr, wxPG_LABEL, "<composed>")); 231 232 // Must do this last, as new children pick up the color of their parent. 233 m_PropMan->SetPropertyBackgroundColour(Cat, HEADING_COLOR, 0 /*don't recurse*/); 241 234 } 242 235 243 236 if (dynamic_cast<MapBezierPatchT*>(SelectedPrimitives[i])!=NULL) 244 237 { 245 wxPGProperty* Cat=PropMan->Append(new wxStringProperty(SelectedPrimitives[i]->GetType()->ClassName+wxString::Format("%i", ++BPCount), wxPG_LABEL, "<composed>")); 246 PropMan->DisableProperty(Cat); 238 wxPGProperty* Cat=m_PropMan->Append(new wxStringProperty("Bezier Patch" + ItemStr, wxPG_LABEL, "<composed>")); 239 MapBezierPatchT* BP=(MapBezierPatchT*)SelectedPrimitives[i]; 240 241 wxPGProperty* SdHorzIntProp=new wxIntProperty("Subdivs horz", wxPG_LABEL, BP->GetSubdivsHorz()); 242 m_PropMan->AppendIn(Cat, SdHorzIntProp)->SetClientData(BP); 243 m_PropMan->SetPropertyEditor(SdHorzIntProp, wxPGEditor_SpinCtrl); 244 245 wxPGProperty* SdVertIntProp=new wxIntProperty("Subdivs vert", wxPG_LABEL, BP->GetSubdivsVert()); 246 m_PropMan->AppendIn(Cat, SdVertIntProp)->SetClientData(BP); 247 m_PropMan->SetPropertyEditor(SdVertIntProp, wxPGEditor_SpinCtrl); 248 249 // Must do this last, as new children pick up the color of their parent. 250 m_PropMan->SetPropertyBackgroundColour(Cat, HEADING_COLOR, 0 /*don't recurse*/); 247 251 } 248 252 249 253 if (dynamic_cast<MapTerrainT*>(SelectedPrimitives[i])!=NULL) 250 254 { 251 wxPGProperty* Cat=PropMan->Append(new wxStringProperty(SelectedPrimitives[i]->GetType()->ClassName+wxString::Format("%i", ++TerrainCount), wxPG_LABEL, "<composed>")); 252 PropMan->DisableProperty(Cat); 255 wxPGProperty* Cat=m_PropMan->Append(new wxStringProperty("Terrain" + ItemStr, wxPG_LABEL, "<composed>")); 256 257 // Must do this last, as new children pick up the color of their parent. 258 m_PropMan->SetPropertyBackgroundColour(Cat, HEADING_COLOR, 0 /*don't recurse*/); 253 259 } 254 260 255 261 if (dynamic_cast<MapPlantT*>(SelectedPrimitives[i])!=NULL) 256 262 { 257 wxPGProperty* Cat=PropMan->Append(new wxStringProperty(SelectedPrimitives[i]->GetType()->ClassName+wxString::Format("%i", ++PlantCount), wxPG_LABEL, "<composed>")); 258 PropMan->DisableProperty(Cat); 259 263 wxPGProperty* Cat=m_PropMan->Append(new wxStringProperty("Plant" + ItemStr, wxPG_LABEL, "<composed>")); 260 264 MapPlantT* Plant=(MapPlantT*)SelectedPrimitives[i]; 261 265 262 PropMan->AppendIn(Cat, new GameFilePropertyT("Plant Description", wxPG_LABEL, Plant->m_DescrFileName, MapDoc, "Plant Description Files (*.cpd)|*.cpd|All Files (*.*)|*.*", "/Plants/"))->SetClientData(Plant); 263 PropMan->AppendIn(Cat, new wxIntProperty("Random Seed", wxPG_LABEL, Plant->m_RandomSeed))->SetClientData(Plant); 266 m_PropMan->AppendIn(Cat, new GameFilePropertyT("Plant Description", wxPG_LABEL, Plant->m_DescrFileName, m_MapDoc, "Plant Description Files (*.cpd)|*.cpd|All Files (*.*)|*.*", "/Plants/"))->SetClientData(Plant); 267 m_PropMan->AppendIn(Cat, new wxIntProperty("Random Seed", wxPG_LABEL, Plant->m_RandomSeed))->SetClientData(Plant); 268 269 // Must do this last, as new children pick up the color of their parent. 270 m_PropMan->SetPropertyBackgroundColour(Cat, HEADING_COLOR, 0 /*don't recurse*/); 264 271 } 265 272 266 273 if (dynamic_cast<MapModelT*>(SelectedPrimitives[i])!=NULL) 267 274 { 268 wxPGProperty* Cat=PropMan->Append(new wxStringProperty(SelectedPrimitives[i]->GetType()->ClassName+wxString::Format("%i", ++ModelCount), wxPG_LABEL, "<composed>")); 269 PropMan->DisableProperty(Cat); 270 275 wxPGProperty* Cat=m_PropMan->Append(new wxStringProperty("Model" + ItemStr, wxPG_LABEL, "<composed>")); 271 276 MapModelT* Model=(MapModelT*)SelectedPrimitives[i]; 272 277 273 PropMan->AppendIn(Cat, new GameFilePropertyT("Model", wxPG_LABEL, Model->m_Model->GetFileName(),MapDoc, "All Files (*.*)|*.*|Model files (*.mdl)|*.mdl|Model Files (*.ase)|*.ase|Model Files (*.dlod)|*.dlod", "/Models/"))->SetClientData(Model);274 PropMan->AppendIn(Cat, new GameFilePropertyT("Collision Model", wxPG_LABEL, Model->m_CollModelFileName,MapDoc, "Collision Model (*.cmap)|*.cmap|All Files (*.*)|*.*", "/Models/"))->SetClientData(Model);275 PropMan->AppendIn(Cat, new wxStringProperty ("Label", wxPG_LABEL, Model->m_Label))->SetClientData(Model);276 PropMan->AppendIn(Cat, new wxFloatProperty ("Scale", wxPG_LABEL, Model->m_Scale))->SetClientData(Model);277 PropMan->AppendIn(Cat, new wxIntProperty ("Sequence Number", wxPG_LABEL, Model->m_SeqNumber))->SetClientData(Model);278 PropMan->AppendIn(Cat, new wxFloatProperty ("Frame Offset", wxPG_LABEL, Model->m_FrameOffset))->SetClientData(Model);279 PropMan->AppendIn(Cat, new wxFloatProperty ("Frame Scale", wxPG_LABEL, Model->m_FrameTimeScale))->SetClientData(Model);280 281 wxPGProperty* AnimateProp= PropMan->AppendIn(Cat, new wxBoolProperty("Animated", wxPG_LABEL, Model->m_Animated));278 m_PropMan->AppendIn(Cat, new GameFilePropertyT("Model", wxPG_LABEL, Model->m_Model->GetFileName(), m_MapDoc, "All Files (*.*)|*.*|Model files (*.mdl)|*.mdl|Model Files (*.ase)|*.ase|Model Files (*.dlod)|*.dlod", "/Models/"))->SetClientData(Model); 279 m_PropMan->AppendIn(Cat, new GameFilePropertyT("Collision Model", wxPG_LABEL, Model->m_CollModelFileName, m_MapDoc, "Collision Model (*.cmap)|*.cmap|All Files (*.*)|*.*", "/Models/"))->SetClientData(Model); 280 m_PropMan->AppendIn(Cat, new wxStringProperty ("Label", wxPG_LABEL, Model->m_Label))->SetClientData(Model); 281 m_PropMan->AppendIn(Cat, new wxFloatProperty ("Scale", wxPG_LABEL, Model->m_Scale))->SetClientData(Model); 282 m_PropMan->AppendIn(Cat, new wxIntProperty ("Sequence Number", wxPG_LABEL, Model->m_SeqNumber))->SetClientData(Model); 283 m_PropMan->AppendIn(Cat, new wxFloatProperty ("Frame Offset", wxPG_LABEL, Model->m_FrameOffset))->SetClientData(Model); 284 m_PropMan->AppendIn(Cat, new wxFloatProperty ("Frame Scale", wxPG_LABEL, Model->m_FrameTimeScale))->SetClientData(Model); 285 286 wxPGProperty* AnimateProp=m_PropMan->AppendIn(Cat, new wxBoolProperty("Animated", wxPG_LABEL, Model->m_Animated)); 282 287 AnimateProp->SetClientData(Model); 283 PropMan->SetPropertyAttributeAll(wxPG_BOOL_USE_CHECKBOX, true); // Use checkbox instead of choice. 284 } 285 } 286 287 PropMan->RefreshGrid(); 288 m_PropMan->SetPropertyAttributeAll(wxPG_BOOL_USE_CHECKBOX, true); // Use checkbox instead of choice. 289 290 // Must do this last, as new children pick up the color of their parent. 291 m_PropMan->SetPropertyBackgroundColour(Cat, HEADING_COLOR, 0 /*don't recurse*/); 292 } 293 } 294 295 m_PropMan->RefreshGrid(); 288 296 } 289 297 … … 297 305 if (Object->GetType()==&MapBrushT::TypeInfo) 298 306 { 299 // Nothing yet.307 // TODO. 300 308 } 301 309 else if (Object->GetType()==&MapBezierPatchT::TypeInfo) 302 310 { 303 // Nothing yet. 311 MapBezierPatchT* BP =(MapBezierPatchT*)Object; 312 const wxPGProperty* Prop =Event.GetProperty(); 313 const wxString PropName=Prop->GetName().AfterLast('.'); 314 CommandT* Command =NULL; 315 316 if (PropName=="Subdivs horz") 317 Command=new CommandSetBPSubdivsT(m_MapDoc, BP, Prop->GetValue().GetLong(), HORIZONTAL); 318 else if (PropName=="Subdivs vert") 319 Command=new CommandSetBPSubdivsT(m_MapDoc, BP, Prop->GetValue().GetLong(), VERTICAL); 320 321 if (Command) 322 { 323 m_IsRecursiveSelfNotify=true; 324 m_MapDoc->GetHistory().SubmitCommand(Command); 325 m_IsRecursiveSelfNotify=false; 326 } 304 327 } 305 328 else if (Object->GetType()==&MapTerrainT::TypeInfo) 306 329 { 307 // Nothing yet.330 // TODO. 308 331 } 309 332 else if (Object->GetType()==&MapPlantT::TypeInfo) … … 317 340 { 318 341 // Command to change the random seed. 319 CommandT* Command=new CommandChangePlantSeedT(* MapDoc, Plant, Event.GetProperty()->GetValue().GetLong());320 321 IsRecursiveSelfNotify=true;322 MapDoc->GetHistory().SubmitCommand(Command);323 IsRecursiveSelfNotify=false;342 CommandT* Command=new CommandChangePlantSeedT(*m_MapDoc, Plant, Event.GetProperty()->GetValue().GetLong()); 343 344 m_IsRecursiveSelfNotify=true; 345 m_MapDoc->GetHistory().SubmitCommand(Command); 346 m_IsRecursiveSelfNotify=false; 324 347 } 325 348 … … 327 350 { 328 351 // Command to change the plant description. 329 CommandT* Command=new CommandChangePlantDescrT(* MapDoc, Plant, Event.GetProperty()->GetValueAsString());330 331 IsRecursiveSelfNotify=true;332 MapDoc->GetHistory().SubmitCommand(Command);333 IsRecursiveSelfNotify=false;352 CommandT* Command=new CommandChangePlantDescrT(*m_MapDoc, Plant, Event.GetProperty()->GetValueAsString()); 353 354 m_IsRecursiveSelfNotify=true; 355 m_MapDoc->GetHistory().SubmitCommand(Command); 356 m_IsRecursiveSelfNotify=false; 334 357 } 335 358 } … … 345 368 346 369 if (PropName=="Model") 347 Command=new CommandModifyModelT(* MapDoc, Model, Prop->GetValueAsString(), Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated);370 Command=new CommandModifyModelT(*m_MapDoc, Model, Prop->GetValueAsString(), Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated); 348 371 else if (PropName=="Collision Model") 349 Command=new CommandModifyModelT(* MapDoc, Model, Model->m_ModelFileName, Prop->GetValueAsString(), Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated);372 Command=new CommandModifyModelT(*m_MapDoc, Model, Model->m_ModelFileName, Prop->GetValueAsString(), Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated); 350 373 else if (PropName=="Label") 351 Command=new CommandModifyModelT(* MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Prop->GetValueAsString(), Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated);374 Command=new CommandModifyModelT(*m_MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Prop->GetValueAsString(), Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated); 352 375 else if (PropName=="Scale") 353 Command=new CommandModifyModelT(* MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, PropValueF, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated);376 Command=new CommandModifyModelT(*m_MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, PropValueF, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated); 354 377 else if (PropName=="Sequence Number") 355 Command=new CommandModifyModelT(* MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Prop->GetValue().GetLong(), Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated);378 Command=new CommandModifyModelT(*m_MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Prop->GetValue().GetLong(), Model->m_FrameOffset, Model->m_FrameTimeScale, Model->m_Animated); 356 379 else if (PropName=="Frame Offset") 357 Command=new CommandModifyModelT(* MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, PropValueF, Model->m_FrameTimeScale, Model->m_Animated);380 Command=new CommandModifyModelT(*m_MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, PropValueF, Model->m_FrameTimeScale, Model->m_Animated); 358 381 else if (PropName=="Frame Scale") 359 Command=new CommandModifyModelT(* MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, PropValueF, Model->m_Animated);382 Command=new CommandModifyModelT(*m_MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, PropValueF, Model->m_Animated); 360 383 else if (PropName=="Animated") 361 Command=new CommandModifyModelT(* MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Prop->GetValue().GetBool());384 Command=new CommandModifyModelT(*m_MapDoc, Model, Model->m_ModelFileName, Model->m_CollModelFileName, Model->m_Label, Model->m_Scale, Model->m_SeqNumber, Model->m_FrameOffset, Model->m_FrameTimeScale, Prop->GetValue().GetBool()); 362 385 363 386 if (Command) 364 387 { 365 IsRecursiveSelfNotify=true;366 MapDoc->GetHistory().SubmitCommand(Command);367 IsRecursiveSelfNotify=false;388 m_IsRecursiveSelfNotify=true; 389 m_MapDoc->GetHistory().SubmitCommand(Command); 390 m_IsRecursiveSelfNotify=false; 368 391 } 369 392 } -
cafu/trunk/CaWE/DialogInsp-PrimitiveProps.hpp
r285 r442 38 38 public: 39 39 40 InspDlgPrimitivePropsT(wxWindow* Parent _, MapDocumentT* MapDoc_);40 InspDlgPrimitivePropsT(wxWindow* Parent, MapDocumentT* MapDoc); 41 41 ~InspDlgPrimitivePropsT(); 42 42 … … 52 52 53 53 wxSizer* InspectorPrimitivePropsInit(wxWindow* parent, bool call_fit=true, bool set_sizer=true); 54 55 void UpdateGrid(); 54 void UpdateGrid(); 56 55 57 56 // Event handler methods. 58 57 void OnPropertyGridChanged(wxPropertyGridEvent& Event); 59 58 60 MapDocumentT* MapDoc; 61 wxPropertyGridManager* PropMan; 62 wxStaticText* SelectionText; ///< Text that is displayed above the property grid. It shows the number of selected primitives. 63 64 bool IsRecursiveSelfNotify; 65 66 67 // IDs for the controls whose events we are interested in. 68 enum 69 { 70 ID_PROPERTY_GRID_MAN=wxID_HIGHEST+1 71 }; 72 73 DECLARE_EVENT_TABLE() 59 MapDocumentT* m_MapDoc; 60 wxPropertyGridManager* m_PropMan; 61 wxStaticText* m_SelectionText; ///< Text that is displayed above the property grid. It shows the number of selected primitives. 62 bool m_IsRecursiveSelfNotify; 74 63 }; 75 64 -
cafu/trunk/CaWE/ToolOptionsBars.cpp
r285 r442 27 27 #include "ToolClip.hpp" 28 28 #include "ToolMorph.hpp" 29 #include "MapCommands/SetBPSubdivs.hpp"30 29 31 30 #include "wx/statline.h" … … 234 233 235 234 BEGIN_EVENT_TABLE(OptionsBar_NewBezierPatchToolT, wxPanel) 236 EVT_CHOICE (OptionsBar_NewBezierPatchToolT::ID_PATCHTYPE, OptionsBar_NewBezierPatchToolT::OnPatchTypeChoice) 237 EVT_SPINCTRL(OptionsBar_NewBezierPatchToolT::ID_SUBDIVSHORZ, OptionsBar_NewBezierPatchToolT::OnSubdivsSpinChangeHorz) 238 EVT_SPINCTRL(OptionsBar_NewBezierPatchToolT::ID_SUBDIVSVERT, OptionsBar_NewBezierPatchToolT::OnSubdivsSpinChangeVert) 239 EVT_TEXT (OptionsBar_NewBezierPatchToolT::ID_SUBDIVSHORZ, OptionsBar_NewBezierPatchToolT::OnSubdivsManualChangeHorz) 240 EVT_TEXT (OptionsBar_NewBezierPatchToolT::ID_SUBDIVSVERT, OptionsBar_NewBezierPatchToolT::OnSubdivsManualChangeVert) 235 EVT_CHOICE(OptionsBar_NewBezierPatchToolT::ID_PATCHTYPE, OptionsBar_NewBezierPatchToolT::OnPatchTypeChoice) 241 236 END_EVENT_TABLE() 242 237 … … 399 394 400 395 401 void OptionsBar_NewBezierPatchToolT::OnSubdivsSpinChangeHorz(wxSpinEvent& Event)402 {403 // If more objects or no BP is selected, do nothing.404 if (m_MapDoc.GetSelection().Size()!=1) return;405 406 // If one object is selected and this object is a bezier patch, update the BP.407 MapBezierPatchT* selectedBP=dynamic_cast<MapBezierPatchT*>(m_MapDoc.GetSelection()[0]);408 409 if (selectedBP!=NULL)410 m_MapDoc.GetHistory().SubmitCommand(new CommandSetBPSubdivsT(&m_MapDoc, selectedBP, m_SpinCtrlSubdivsHorz->GetValue(), HORIZONTAL));411 }412 413 414 void OptionsBar_NewBezierPatchToolT::OnSubdivsSpinChangeVert(wxSpinEvent& Event)415 {416 // If more objects or no BP is selected, do nothing.417 if (m_MapDoc.GetSelection().Size()!=1) return;418 419 // If one object is selected and this object is a bezier patch, update the BP.420 MapBezierPatchT* selectedBP=dynamic_cast<MapBezierPatchT*>(m_MapDoc.GetSelection()[0]);421 422 if (selectedBP!=NULL)423 m_MapDoc.GetHistory().SubmitCommand(new CommandSetBPSubdivsT(&m_MapDoc, selectedBP, m_SpinCtrlSubdivsVert->GetValue(), VERTICAL));424 }425 426 427 void OptionsBar_NewBezierPatchToolT::OnSubdivsManualChangeHorz(wxCommandEvent& Event)428 {429 // SpinCtrl handles manual inputs aumatically and maps them to it's own value range, so nothing to do here except430 // call the spinchange method to update the selected BP.431 wxSpinEvent tmpEvent;432 OnSubdivsSpinChangeHorz(tmpEvent);433 }434 435 436 void OptionsBar_NewBezierPatchToolT::OnSubdivsManualChangeVert(wxCommandEvent& Event)437 {438 // SpinCtrl handles manual inputs aumatically and maps them to it's own value range, so nothing to do here except439 // call the spinchange method to update the selected BP.440 wxSpinEvent tmpEvent;441 OnSubdivsSpinChangeVert(tmpEvent);442 }443 444 445 396 BEGIN_EVENT_TABLE(OptionsBar_NewTerrainToolT, wxPanel) 446 397 EVT_BUTTON(OptionsBar_NewTerrainToolT::ID_BUTTON_BROWSE, OptionsBar_NewTerrainToolT::OnButtonBrowse) -
cafu/trunk/CaWE/ToolOptionsBars.hpp
r285 r442 150 150 wxCheckBox* m_CheckConcave; 151 151 152 void OnPatchTypeChoice(wxCommandEvent& Event); ///< Handles events that occur, when a patch type is choosen from the patch type choice box. 153 void OnSubdivsSpinChangeHorz(wxSpinEvent& Event); ///< Handles events that occur, when the content of the horizontal Subdivs SpinCtrl is changed using the +/- buttons. 154 void OnSubdivsSpinChangeVert(wxSpinEvent& Event); ///< Handles events that occur, when the content of the vertical Subdivs SpinCtrl is changed using the +/- buttons. 155 void OnSubdivsManualChangeHorz(wxCommandEvent& Event); ///< Handles events that occur, when the content of the horizontal Subdivs SpinCtrl is changed entering values manually. 156 void OnSubdivsManualChangeVert(wxCommandEvent& Event); ///< Handles events that occur, when the content of the vertical Subdivs SpinCtrl is changed entering values manually. 152 void OnPatchTypeChoice(wxCommandEvent& Event); ///< Handles events that occur when a patch type is choosen from the patch type choice box. 157 153 158 154 /// IDs for the controls whose events we are interested in.
