1 // $Id: growthmenus.cpp,v 1.16 2010/03/17 17:25:58 bobgian Exp $
2 
3 /*
4   Copyright 2002  Peter Beerli, Mary Kuhner, Jon Yamato and Joseph Felsenstein
5 
6   This software is distributed free of charge for non-commercial use
7   and is copyrighted.  Of course, we do not guarantee that the software
8   works, and are not responsible for any damage you may cause or have.
9 */
10 
11 #include <string>
12 #include "constants.h"
13 #include "constraintmenus.h"
14 #include "forcesummary.h"
15 #include "growthmenus.h"
16 #include "lamarc_strings.h"
17 #include "menu_strings.h"
18 #include "newmenuitems.h"
19 #include "priormenus.h"
20 #include "setmenuitem.h"
21 #include "togglemenuitem.h"
22 #include "ui_interface.h"
23 #include "ui_strings.h"
24 #include "profilemenus.h"
25 
26 using std::string;
27 
SetAllGrowthMenuItem(string myKey,UIInterface & ui)28 SetAllGrowthMenuItem::SetAllGrowthMenuItem(string myKey, UIInterface & ui)
29     : SetMenuItemId(myKey,ui,uistr::globalGrowth, UIId(force_GROW, uiconst::GLOBAL_ID))
30 {
31 }
32 
~SetAllGrowthMenuItem()33 SetAllGrowthMenuItem::~SetAllGrowthMenuItem()
34 {
35 }
36 
IsVisible()37 bool SetAllGrowthMenuItem::IsVisible()
38 {
39     return ui.doGetBool(uistr::growth);
40 }
41 
GetVariableText()42 std::string SetAllGrowthMenuItem::GetVariableText()
43 {
44     return "";
45 }
46 
47 //------------------------------------------------------------------------------------
48 
ToggleMenuItemGrowthScheme(string k,UIInterface & myui)49 ToggleMenuItemGrowthScheme::ToggleMenuItemGrowthScheme(string k, UIInterface & myui)
50     : ToggleMenuItemNoId(k,myui,uistr::growthScheme)
51 {
52 }
53 
~ToggleMenuItemGrowthScheme()54 ToggleMenuItemGrowthScheme::~ToggleMenuItemGrowthScheme()
55 {
56 }
57 
IsVisible()58 bool ToggleMenuItemGrowthScheme::IsVisible()
59 {
60 #ifdef NDEBUG
61     return false;
62 #else
63     return ui.doGetBool(uistr::growth);
64 #endif
65 }
66 
67 //------------------------------------------------------------------------------------
68 
ToggleMenuItemGrowthType(string k,UIInterface & myui)69 ToggleMenuItemGrowthType::ToggleMenuItemGrowthType(string k, UIInterface & myui)
70     : ToggleMenuItemNoId(k,myui,uistr::growthType)
71 {
72 }
73 
~ToggleMenuItemGrowthType()74 ToggleMenuItemGrowthType::~ToggleMenuItemGrowthType()
75 {
76 }
77 
IsVisible()78 bool ToggleMenuItemGrowthType::IsVisible()
79 {
80 #ifdef NDEBUG
81     return false;
82 #else
83     return ui.doGetBool(uistr::growth);
84 #endif
85 }
86 
87 //------------------------------------------------------------------------------------
88 
SetMenuItemGrowths(UIInterface & myui)89 SetMenuItemGrowths::SetMenuItemGrowths(UIInterface & myui)
90     : SetMenuItemGroup(myui,uistr::growthByID)
91 {
92 }
93 
~SetMenuItemGrowths()94 SetMenuItemGrowths::~SetMenuItemGrowths()
95 {
96 }
97 
GetVisibleIds()98 vector<UIId> SetMenuItemGrowths::GetVisibleIds()
99 {
100     return ui.doGetUIIdVec1d(uistr::validParamsForForce,UIId(force_GROW));
101 }
102 
103 //------------------------------------------------------------------------------------
104 
GrowthMenu(UIInterface & myui)105 GrowthMenu::GrowthMenu (UIInterface & myui )
106     : NewMenu (myui,lamarcmenu::growTitle,lamarcmenu::growInfo)
107 {
108     AddMenuItem(new ToggleMenuItemNoId("X",ui,uistr::growth));
109     UIId id(force_GROW);
110     AddMenuItem(new ToggleMenuItemGrowthScheme("S",ui));
111     AddMenuItem(new ToggleMenuItemGrowthType("I",ui));
112     AddMenuItem(new SubMenuConstraintsForOneForce("C",ui,id));
113     AddMenuItem(new SubMenuProfileForOneForce("P",ui,id));
114     AddMenuItem(new SubMenuPriorForOneForce("B",ui,id));
115     AddMenuItem(new SetAllGrowthMenuItem("G",ui));
116     AddMenuItem(new SetMenuItemGrowths(ui));
117 }
118 
~GrowthMenu()119 GrowthMenu::~GrowthMenu ()
120 {
121 }
122 
123 //____________________________________________________________________________________
124