*** empty log message ***
@@ -236,6 +236,13 @@ | ||
236 | 236 | { |
237 | 237 | return &this->visualModeManager; |
238 | 238 | } |
239 | +/** | |
240 | + 履歴マネージャーを取得します | |
241 | +*/ | |
242 | +hpl::aleph::map::HPLDoneHistory* MapEditorWX::getDoneHistoryManager() | |
243 | +{ | |
244 | + return &this->doneHistoryManager; | |
245 | +} | |
239 | 246 | |
240 | 247 | |
241 | 248 | //ビュー座標をワールド座標に直す操作の簡易版 |
@@ -434,13 +434,11 @@ | ||
434 | 434 | //点 |
435 | 435 | for(int i = 0; i < (int)sel->getSelPoints()->size(); i ++){ |
436 | 436 | struct hpl::aleph::map::SelPoint* selp = &sel->getSelPoints()->at(i); |
437 | + int index = selp->index; | |
437 | 438 | //位置変更 |
438 | - get_endpoint_data(selp->index)->vertex.x = wmp.x + selp->offset[0] * div; | |
439 | - get_endpoint_data(selp->index)->vertex.y = wmp.y + selp->offset[1] * div; | |
439 | + get_endpoint_data(index)->vertex.x = wmp.x + selp->offset[0] * div; | |
440 | + get_endpoint_data(index)->vertex.y = wmp.y + selp->offset[1] * div; | |
440 | 441 | |
441 | - //位置が変更されたことによる変更を行う | |
442 | - //関連する線 | |
443 | - std::vector<int> lineIndexes = | |
444 | 442 | } |
445 | 443 | |
446 | 444 | //線 |
@@ -144,6 +144,10 @@ | ||
144 | 144 | //選択できたので |
145 | 145 | //範囲選択は解除します |
146 | 146 | wxGetApp().getEventManager()->setSelectingGroup(false); |
147 | + | |
148 | + //アンドゥ情報に追加しておきます | |
149 | + hpl::aleph::map::HPLDoneHistory* hmgr = wxGetApp().getDoneHistoryManager(); | |
150 | + hmgr->push_back(&wxGetApp().selData); | |
147 | 151 | }else{ |
148 | 152 | //選択されなかった |
149 | 153 | //範囲選択の開始 |
@@ -163,10 +163,10 @@ | ||
163 | 163 | |
164 | 164 | //編集モードとメニューIDの対応 |
165 | 165 | //TODO menu |
166 | - std::map<int, int> menuIDMap; | |
166 | +// std::map<int, int> menuIDMap; | |
167 | 167 | |
168 | - //リソースファイル | |
169 | - wxXmlResource xrc; | |
168 | + //リソースファイル(試験的に定義) | |
169 | +// wxXmlResource xrc; | |
170 | 170 | |
171 | 171 | //高さが範囲外の線を表示するかどうか(デフォルト:false) |
172 | 172 | bool isRevealHiddenLines; |
@@ -214,6 +214,9 @@ | ||
214 | 214 | //ビジュアルモード管理 <en> manager for visual mode |
215 | 215 | hpl::shapes::HPLVisualModeManager visualModeManager; |
216 | 216 | |
217 | + //アンドゥ管理マネージャー | |
218 | + hpl::aleph::map::HPLDoneHistory doneHistoryManager; | |
219 | + | |
217 | 220 | //ツールごとのカーソル |
218 | 221 | wxCursor cursors[ToolType::NUMBER_OF_TOOLS]; |
219 | 222 |
@@ -241,6 +244,11 @@ | ||
241 | 244 | /////////////////////////////////// |
242 | 245 | // 関数 |
243 | 246 | |
247 | + /** | |
248 | + 履歴マネージャーを取得します | |
249 | + */ | |
250 | + hpl::aleph::map::HPLDoneHistory* getDoneHistoryManager(); | |
251 | + | |
244 | 252 | /** |
245 | 253 | ビューグリッドの調整マネージャーを取得します |
246 | 254 | */ |
@@ -90,6 +90,9 @@ | ||
90 | 90 | //セットアップ |
91 | 91 | wxGetApp().getStockManager()->updateDeletes(); |
92 | 92 | |
93 | + //履歴初期化 | |
94 | + wxGetApp().getDoneHistoryManager()->init(); | |
95 | + | |
93 | 96 | //プレイヤーポジションを設定 |
94 | 97 | //プレイヤーを捜す |
95 | 98 | for(int i = 0 ; i < (int)SavedObjectList.size(); i ++){ |
@@ -264,7 +264,7 @@ | ||
264 | 264 | |
265 | 265 | //?ʒu?L?? |
266 | 266 | ?{?^???????? |
267 | -?I?????聨?ʒu?{????? | |
267 | +?I??????(????????I??)???ʒu?{????? | |
268 | 268 | ?I????Ń{?^?????????ʒu?{????? |
269 | 269 | ?I???????? |
270 | -?{?^???????? | |
270 | +?{?^?????????ʒu?{???L?? |
@@ -78,6 +78,10 @@ | ||
78 | 78 | static char* INNER_DATA_FILE_PATH = "data/InnerSetting.ini"; |
79 | 79 | static char* START_POINT_IMAGE_FILE_PATH = "data/Map Icons/center X.bmp"; |
80 | 80 | |
81 | +//アンドゥ・リドゥの回数(合計) | |
82 | +const int UNDO_NUM = 10; | |
83 | + | |
84 | + | |
81 | 85 | //point flags |
82 | 86 | enum |
83 | 87 | { |
@@ -1,6 +1,8 @@ | ||
1 | 1 | #include "HPLDoneHistory.h" |
2 | 2 | #include "HPLError.h" |
3 | 3 | |
4 | +const int DEFAULT_INDEX_MAX = 10; | |
5 | + | |
4 | 6 | hpl::aleph::map::HPLActionItem::HPLActionItem(int t, hpl::aleph::map::HPLSelectData& sel, hpl::aleph::map::HPLRealMapData& real) |
5 | 7 | { |
6 | 8 | type = t; |
@@ -16,6 +18,7 @@ | ||
16 | 18 | hpl::aleph::map::HPLDoneHistory::HPLDoneHistory() |
17 | 19 | { |
18 | 20 | index = -1; |
21 | + setIndexMax(DEFAULT_INDEX_MAX); | |
19 | 22 | } |
20 | 23 | hpl::aleph::map::HPLDoneHistory::~HPLDoneHistory() |
21 | 24 | { |
@@ -22,6 +25,18 @@ | ||
22 | 25 | actionList.clear(); |
23 | 26 | } |
24 | 27 | /** |
28 | + 最大数を設定します | |
29 | +*/ | |
30 | +void hpl::aleph::map::HPLDoneHistory::setIndexMax(int m) | |
31 | +{ | |
32 | + this->indexMax = m; | |
33 | +} | |
34 | +int hpl::aleph::map::HPLDoneHistory::getIndexMax() | |
35 | +{ | |
36 | + return this->indexMax; | |
37 | +} | |
38 | + | |
39 | +/** | |
25 | 40 | 情報を追加します |
26 | 41 | */ |
27 | 42 | void hpl::aleph::map::HPLDoneHistory::push_back(int type, HPLSelectData& selData) |
@@ -87,6 +102,9 @@ | ||
87 | 102 | void hpl::aleph::map::HPLDoneHistory::updateIndexes(hpl::aleph::HPLStockManager* smgr) |
88 | 103 | { |
89 | 104 | //TODO |
105 | + //そんなもん保持するわけないだろう | |
106 | + //常識的に考えて… | |
107 | + hpl::error::halt("Invalid function you called :/"); | |
90 | 108 | } |
91 | 109 | int hpl::aleph::map::HPLDoneHistory::getIndex() |
92 | 110 | { |
@@ -100,3 +118,11 @@ | ||
100 | 118 | { |
101 | 119 | return (int)actionList.size() - index; |
102 | 120 | } |
121 | + | |
122 | +/** | |
123 | + 初期化します | |
124 | +*/ | |
125 | +void hpl::aleph::map::HPLDoneHistory::init() | |
126 | +{ | |
127 | + this->actionList.clear(); | |
128 | +} |
@@ -17,10 +17,26 @@ | ||
17 | 17 | namespace hpl{ |
18 | 18 | namespace aleph{ |
19 | 19 | namespace map{ |
20 | + /** | |
21 | + 行動タイプ | |
22 | + */ | |
20 | 23 | namespace ActionType{ |
21 | 24 | enum{ |
25 | + //何もしていない状態 | |
26 | + //移動前の情報を入れておく | |
27 | + None, | |
28 | + //新規作成 | |
29 | + //オブジェクト情報をそのまま保持。もし保存などを行いインデックスが整理されてしまった場合は | |
30 | + //最後に新規で作成され直すことになる。 | |
22 | 31 | Add, |
32 | + //削除 | |
33 | + //Addと同様 | |
23 | 34 | Delete, |
35 | + //移動 | |
36 | + //移動のみを扱い、それに伴う特性データを保持 | |
37 | + Move, | |
38 | + //情報の変更 | |
39 | + //特徴データの変更のみを行い、移動・追加・削除については無視 | |
24 | 40 | Modify, |
25 | 41 | }; |
26 | 42 | }; |
@@ -32,7 +48,13 @@ | ||
32 | 48 | private: |
33 | 49 | HPLActionItem(){} |
34 | 50 | public: |
35 | - HPLActionItem(int t, hpl::aleph::map::HPLSelectData& sel, hpl::aleph::map::HPLRealMapData& real); | |
51 | + /** | |
52 | + @param t タイプ ActionType:: | |
53 | + @param sel 選択している情報(インデックスのみ) | |
54 | + @param real 選択している物体の真の情報(memcpyの産物) | |
55 | + */ | |
56 | + HPLActionItem(int t, hpl::aleph::map::HPLSelectData& sel, | |
57 | + hpl::aleph::map::HPLRealMapData& real); | |
36 | 58 | ~HPLActionItem(); |
37 | 59 | int type; |
38 | 60 | hpl::aleph::map::HPLSelectData selectData; |
@@ -44,14 +66,19 @@ | ||
44 | 66 | std::vector<HPLActionItem> actionList; |
45 | 67 | |
46 | 68 | int index; |
69 | + int indexMax; | |
47 | 70 | public: |
48 | 71 | HPLDoneHistory(); |
49 | 72 | ~HPLDoneHistory(); |
50 | 73 | |
51 | 74 | public: |
75 | + /** | |
76 | + 最大数を設定します | |
77 | + */ | |
78 | + void setIndexMax(int m); | |
79 | + int getIndexMax(); | |
52 | 80 | /** |
53 | 81 | 情報を追加します |
54 | - @param type ActionTypeで定義している、ユーザが取った行動 | |
55 | 82 | */ |
56 | 83 | void push_back(int type, HPLSelectData& selData); |
57 | 84 |
@@ -71,6 +98,11 @@ | ||
71 | 98 | */ |
72 | 99 | void updateIndexes(hpl::aleph::HPLStockManager* smgr); |
73 | 100 | |
101 | + /** | |
102 | + 初期化します | |
103 | + */ | |
104 | + void init(); | |
105 | + | |
74 | 106 | int getIndex(); |
75 | 107 | int getRemainUndoCount(); |
76 | 108 | int getRemainRedoCount(); |