Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
comparison FrmMainWindow.cs @ 110:76b73f15d07e
Re #344: Show unit requirement failures
* First pass using new Requirement objects on FrmNewUnit - needs more testing and styling
* Remove old references from main window until we get a replacement
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 01 Aug 2011 20:22:48 +0000 |
parents | b51935854587 |
children | f58f69ea2435 |
comparison
equal
deleted
inserted
replaced
109:4ae69806bb2d | 110:76b73f15d07e |
---|---|
21 using IBBoard.WarFoundry.API.Commands; | 21 using IBBoard.WarFoundry.API.Commands; |
22 using IBBoard.WarFoundry.API.Exporters; | 22 using IBBoard.WarFoundry.API.Exporters; |
23 using IBBoard.WarFoundry.API.Factories; | 23 using IBBoard.WarFoundry.API.Factories; |
24 using IBBoard.WarFoundry.API.Factories.Xml; | 24 using IBBoard.WarFoundry.API.Factories.Xml; |
25 using IBBoard.WarFoundry.API.Objects; | 25 using IBBoard.WarFoundry.API.Objects; |
26 using IBBoard.WarFoundry.API.Requirements; | |
27 using IBBoard.WarFoundry.API.Savers; | 26 using IBBoard.WarFoundry.API.Savers; |
28 using IBBoard.WarFoundry.GUI.GTK.Widgets; | 27 using IBBoard.WarFoundry.GUI.GTK.Widgets; |
29 using IBBoard.Xml; | 28 using IBBoard.Xml; |
30 using log4net; | 29 using log4net; |
31 using WFObjects = IBBoard.WarFoundry.API.Objects; | 30 using WFObjects = IBBoard.WarFoundry.API.Objects; |
42 private CommandStack commandStack; | 41 private CommandStack commandStack; |
43 private Dictionary<WFObjects.Unit, UnitDisplayWidget> unitToWidgetMap = new Dictionary<WFObjects.Unit,UnitDisplayWidget>(); | 42 private Dictionary<WFObjects.Unit, UnitDisplayWidget> unitToWidgetMap = new Dictionary<WFObjects.Unit,UnitDisplayWidget>(); |
44 private ObjectAddDelegate UnitAddedMethod; | 43 private ObjectAddDelegate UnitAddedMethod; |
45 private ObjectRemoveDelegate UnitRemovedMethod; | 44 private ObjectRemoveDelegate UnitRemovedMethod; |
46 private DoubleValChangedDelegate PointsValueChangedMethod; | 45 private DoubleValChangedDelegate PointsValueChangedMethod; |
47 private FailedUnitRequirementDelegate FailedUnitRequirementMethod; | |
48 private StringValChangedDelegate UnitNameChangedMethod; | 46 private StringValChangedDelegate UnitNameChangedMethod; |
49 private GameSystem system; | 47 private GameSystem system; |
50 private string loadedArmyPath; | 48 private string loadedArmyPath; |
51 private MenuToolButton undoMenuButton, redoMenuButton; | 49 private MenuToolButton undoMenuButton, redoMenuButton; |
52 | 50 |
150 Translation.TranslationChanged += Retranslate; | 148 Translation.TranslationChanged += Retranslate; |
151 Translate(); | 149 Translate(); |
152 UnitAddedMethod = new ObjectAddDelegate(OnUnitAdded); | 150 UnitAddedMethod = new ObjectAddDelegate(OnUnitAdded); |
153 UnitRemovedMethod = new ObjectRemoveDelegate(OnUnitRemoved); | 151 UnitRemovedMethod = new ObjectRemoveDelegate(OnUnitRemoved); |
154 PointsValueChangedMethod = new DoubleValChangedDelegate(OnPointsValueChanged); | 152 PointsValueChangedMethod = new DoubleValChangedDelegate(OnPointsValueChanged); |
155 FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(OnFailedUnitRequirement); | |
156 UnitNameChangedMethod = new StringValChangedDelegate(OnUnitNameChanged); | 153 UnitNameChangedMethod = new StringValChangedDelegate(OnUnitNameChanged); |
157 | 154 |
158 //FIXME: Temporary hack to add paths and factories before we get preferences and plugins | 155 //FIXME: Temporary hack to add paths and factories before we get preferences and plugins |
159 WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + "data")); | 156 WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + "data")); |
160 WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory()); | 157 WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory()); |
400 private void OnPointsValueChanged(WarFoundryObject obj, double before, double after) | 397 private void OnPointsValueChanged(WarFoundryObject obj, double before, double after) |
401 { | 398 { |
402 SetPointsPanelText(); | 399 SetPointsPanelText(); |
403 } | 400 } |
404 | 401 |
405 private void OnFailedUnitRequirement(List<FailedUnitRequirement> failedRequirement) | |
406 { | |
407 //Show error message in panel | |
408 } | |
409 | |
410 public Preferences Preferences | 402 public Preferences Preferences |
411 { | 403 { |
412 get { return preferences; } | 404 get { return preferences; } |
413 set { preferences = value; } | 405 set { preferences = value; } |
414 } | 406 } |
526 if (oldArmy != null) | 518 if (oldArmy != null) |
527 { | 519 { |
528 oldArmy.UnitAdded -= UnitAddedMethod; | 520 oldArmy.UnitAdded -= UnitAddedMethod; |
529 oldArmy.UnitRemoved -= UnitRemovedMethod; | 521 oldArmy.UnitRemoved -= UnitRemovedMethod; |
530 oldArmy.PointsValueChanged -= PointsValueChangedMethod; | 522 oldArmy.PointsValueChanged -= PointsValueChangedMethod; |
531 oldArmy.FailedRequirement -= FailedUnitRequirementMethod; | |
532 } | 523 } |
533 | 524 |
534 unitToWidgetMap.Clear(); | 525 unitToWidgetMap.Clear(); |
535 | 526 |
536 while (unitsNotebook.NPages > 0) | 527 while (unitsNotebook.NPages > 0) |
545 else | 536 else |
546 { | 537 { |
547 newArmy.UnitAdded += UnitAddedMethod; | 538 newArmy.UnitAdded += UnitAddedMethod; |
548 newArmy.UnitRemoved += UnitRemovedMethod; | 539 newArmy.UnitRemoved += UnitRemovedMethod; |
549 newArmy.PointsValueChanged += PointsValueChangedMethod; | 540 newArmy.PointsValueChanged += PointsValueChangedMethod; |
550 newArmy.FailedRequirement += FailedUnitRequirementMethod; | |
551 //TODO: Clear all buttons | 541 //TODO: Clear all buttons |
552 EnableCategoryButtons(); | 542 EnableCategoryButtons(); |
553 | 543 |
554 if (newArmy.Race.HasCategoryOverrides()) | 544 if (newArmy.Race.HasCategoryOverrides()) |
555 { | 545 { |