• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン367 (tree)
日時2007-07-06 00:59:07
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/HPLShapesManager.h (revision 366)
+++ marathon/trunk/MapEditorWX/src/HPLShapesManager.h (nonexistent)
@@ -1,40 +0,0 @@
1-#ifndef _HPL_SHAPES_MANAGER_
2-#define _HPL_SHAPES_MANAGER_
3-
4-#include "header.h"
5-#include "extensions.h"
6-#include "FileHandler.h"
7-#include "map.h"
8-#include "game_wad.h"
9-#include "weapons.h"
10-#include "items.h"
11-#include "monsters.h"
12-#include "scenery_definitions.h"
13-#include "mysound.h"
14-#include "computer_interface.h"
15-#include "editor.h"
16-#include "lightsource.h"
17-#include "media.h"
18-
19-namespace hpl{
20-namespace shapes{
21- class HPLShapesManager{
22- //Shapesファイルを読み込めていたら真 <en> true when Shapes file loaded
23- bool isLoadedShapesFile_;
24-
25- public:
26- HPLShapesManager();
27- ~HPLShapesManager();
28-
29- public:
30- bool isLoadedShapesFile();
31- /**
32- Shapesファイルを読み込みます
33- <en> load Shapes file
34- @param path Shapesファイルパス <en> Shapes file's path
35- */
36- void loadShapesFile(const char* path);
37- };
38-};
39-};
40-#endif
--- marathon/trunk/MapEditorWX/src/HPLShapesManager.cpp (revision 366)
+++ marathon/trunk/MapEditorWX/src/HPLShapesManager.cpp (nonexistent)
@@ -1,34 +0,0 @@
1-#include "HPLShapesManager.h"
2-
3-hpl::shapes::HPLShapesManager::HPLShapesManager()
4-{
5- this->isLoadedShapesFile_ = false;
6-}
7-hpl::shapes::HPLShapesManager::~HPLShapesManager()
8-{
9-}
10-bool hpl::shapes::HPLShapesManager::isLoadedShapesFile()
11-{
12- return this->isLoadedShapesFile_;
13-}
14-/**
15- Shapesファイルを読み込みます
16- <en> load Shapes file
17- @param path Shapesファイルパス <en> Shapes file's path
18-*/
19-void hpl::shapes::HPLShapesManager::loadShapesFile(const char* path)
20-{
21- initialize_shape_handler();
22-
23- FileSpecifier ShapesFile(path);
24- if(!ShapesFile.Exists()){
25- MessageBox(L"no shapes file");
26- }else{
27- isLoadedShapesFile_ = true;
28- open_shapes_file(ShapesFile);
29- for(int i = 0; i < NUMBER_OF_COLLECTIONS; i ++){
30- mark_collection_for_loading(i);
31- }
32- load_collections(false, false);
33- }
34-}
--- marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 366)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 367)
@@ -145,14 +145,16 @@
145145 char *cursorSkull = "cursor2.bmp";
146146 char *cursorPolygon = "cur00004.bmp";
147147 char *cursorLine = "LineCursor1.bmp";
148+ char *cursorFill = "pot.bmp";
149+ char *cursorMag = "mag.bmp";
148150
149151 int cursorId[] ={
150152 wxCURSOR_ARROW,
151- wxCURSOR_PAINT_BRUSH,
153+ -1,
152154 wxCURSOR_HAND,
153155 -1,
154- wxCURSOR_MAGNIFIER,
155156 -1,
157+ -1,
156158 wxCURSOR_IBEAM,
157159 -1
158160 };
@@ -170,6 +172,10 @@
170172 fname = cursorPolygon;
171173 }else if(i == ToolType::TI_LINE){
172174 fname = cursorLine;
175+ }else if(i == ToolType::TI_FILL){
176+ fname = cursorFill;
177+ }else if(i == ToolType::TI_MAGNIFY){
178+ fname = cursorMag;
173179 }
174180 wxString path = wxConvCurrent->cMB2WX(CURSOR_BASE_DIR);
175181 wxString pathF = wxConvCurrent->cMB2WX(fname);
@@ -184,27 +190,17 @@
184190 }
185191 {
186192 wxImage img;
187- wxString str = wxConvCurrent->cMB2WX("data/img/onLine.bmp");
188- img.LoadFile(str);
189- img.SetMaskColour(255,255,255);
190- this->onLineCursor = wxCursor(img);
191- img = wxImage();
192- img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/onPoint.bmp")));
193- img.SetMaskColour(255,255,255);
194- this->onPointCursor = wxCursor(img);
195- //追加中
196- img = wxImage();
197- img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/onPoint2.bmp")));
198- img.SetMaskColour(255,255,255);
199- this->onPointCursorAdding = wxCursor(img);
200- img = wxImage();
201- img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/onLine2.bmp")));
202- img.SetMaskColour(255,255,255);
203- this->onLineCursorAdding = wxCursor(img);
204- img = wxImage();
205- img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/LineCursor2.bmp")));
206- img.SetMaskColour(255,255,255);
207- this->lineToolCursorAdding = wxCursor(img);
193+ loadImage("data/img/onLine.bmp", &img, 255,255,255);
194+ onLineCursor = wxCursor(img);
195+ loadImage("data/img/onPoint.bmp", &img, 255,255,255);
196+ onPointCursor = wxCursor(img);
197+ loadImage("data/img/onPoint2.bmp", &img, 255,255,255);
198+ onPointCursorAdding = wxCursor(img);
199+ loadImage("data/img/onLine2.bmp", &img, 255,255,255);
200+ onLineCursorAdding = wxCursor(img);
201+ loadImage("data/img/LineCursor2.bmp", &img, 255,255,255);
202+ lineToolCursorAdding = wxCursor(img);
203+
208204 }
209205
210206 //対象外の線を表示するかどうか
@@ -230,6 +226,11 @@
230226 {
231227 return &this->stockManager;
232228 }
229+//Shapesマネージャー取得
230+hpl::shapes::HPLShapesManager* MapEditorWX::getShapesManager()
231+{
232+ return &this->shapesManager;
233+}
233234
234235 //ビュー座標をワールド座標に直す操作の簡易版
235236 world_point2d MapEditorWX::getWorldPointFromViewPoint(int vx, int vy)
@@ -262,7 +263,21 @@
262263 if(!bitmap->LoadFile(wxConvCurrent->cMB2WX(fname), wxBITMAP_TYPE_BMP)){
263264 hpl::error::halt("Couldn't load bitmap[%s]", fname);
264265 }
266+
265267 }
268+void MapEditorWX::loadImage(const char* fname, wxImage* bitmap)
269+{
270+ loadBitmap(fname, bitmap);
271+}
272+/**
273+ カラーマスク付きで読み込み
274+*/
275+void MapEditorWX::loadImage(const char* fname, wxImage* img, int r, int g, int b)
276+{
277+ loadBitmap(fname, img);
278+ //カラーマスク設定
279+ img->SetMaskColour(r,g,b);
280+}
266281
267282 /**
268283 現在のモード・ツールにあわせてカーソルを変更します
--- marathon/trunk/MapEditorWX/src/PolygonPropDialog.cpp (revision 366)
+++ marathon/trunk/MapEditorWX/src/PolygonPropDialog.cpp (revision 367)
@@ -536,7 +536,7 @@
536536 return ;
537537 }
538538 PlatformDialog dlg;
539- dlg.Create(this, wxID_ANY);
539+ dlg.Create(this, wxID_ANY, this->getPolyIndex());
540540 if(dlg.ShowModal() == wxID_OK){
541541 //TODO
542542 //設定変更
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 366)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 367)
@@ -560,12 +560,17 @@
560560 wxGetApp().setting.getColorSetting()->strings[1],
561561 wxGetApp().setting.getColorSetting()->strings[2]);
562562 dc->SetTextForeground(col);
563+ dc->SetPen(wxRED_PEN);
564+ dc->SetBrush(wxTRANSPARENT_BRUSH);
565+
563566 for(int i = 0; i < (int)MapAnnotationList.size(); i ++){
564567 map_annotation *annotation = &MapAnnotationList[i];
565568 int drawPoint[2];
566569 wxGetApp().getViewPointFromWorldPoint(annotation->location, drawPoint);
567570
568- //
571+ //点の位置を赤丸で表示
572+ dc->DrawCircle(drawPoint[0], drawPoint[1], POINT_DISTANCE_EPSILON);
573+ //文字列描画
569574 wxString str(wxConvCurrent->cMB2WX(annotation->text));
570575 dc->DrawText(str, drawPoint[0], drawPoint[1]);
571576 }
--- marathon/trunk/MapEditorWX/src/ObjectPropDialog.cpp (revision 366)
+++ marathon/trunk/MapEditorWX/src/ObjectPropDialog.cpp (revision 367)
@@ -324,10 +324,10 @@
324324
325325 //obj.polygon_index = text_ctr
326326
327- obj.facing = atoi(wxConvertWX2MB(text_ctrl_38));
328- obj.location.x = atoi(wxConvertWX2MB(text_ctrl_39));
329- obj.location.x = atoi(wxConvertWX2MB(text_ctrl_40));
330- obj.location.x = atoi(wxConvertWX2MB(text_ctrl_41));
327+ obj.facing = atoi(wxConvertWX2MB(text_ctrl_38->GetValue()));
328+ obj.location.x = atoi(wxConvertWX2MB(text_ctrl_39->GetValue()));
329+ obj.location.x = atoi(wxConvertWX2MB(text_ctrl_40->GetValue()));
330+ obj.location.x = atoi(wxConvertWX2MB(text_ctrl_41->GetValue()));
331331 return obj;
332332 }
333333
--- marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 366)
+++ marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 367)
@@ -135,6 +135,8 @@
135135 }
136136 }
137137 //何も選択していない状態
138+
139+
138140 //一つを選択できるか試してみます
139141 if(this->tryToSelectOneItem(ev)){
140142 //選択範囲は解除します
@@ -182,6 +184,7 @@
182184 //選択の優先順位は
183185 //1:オブジェクト
184186 //2:点
187+ //-:アノテーション
185188 //3:線
186189 //4:ポリゴン
187190
@@ -586,7 +589,7 @@
586589 int flags = 0;
587590 map_object objv = this->objPropDialog.getObject();
588591 objv.polygon_index = i;
589- int newIndex = hpl::aleph::map::addMapSavedObject(obj);
592+ int newIndex = hpl::aleph::map::addMapSavedObject(objv);
590593 found = true;
591594 break;
592595 }
@@ -600,33 +603,65 @@
600603 {
601604 #ifdef MAP_VIEWER
602605 #else
603- //アノテーション追加
604- //ダイアログ準備
605- AnnotationDialog dlg;
606- map_annotation sample;
607- //初期化
608- memset(&sample, 0, SIZEOF_map_annotation);
606+ //shiftを押しながらだと編集モードになる
607+ if(ev.ShiftDown()){
608+ int annotationIndex = NONE;
609+ //アノテーションを選択できるか試してみます
610+ for(int i = 0; i < (int)MapAnnotationList.size(); i ++){
611+ map_annotation* annotation = &MapAnnotationList[i];
612+ if(hpl::aleph::map::isSelectPoint(mx, my,
613+ annotation->location.x, annotation->location.y,
614+ voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD,
615+ div, POINT_DISTANCE_EPSILON))
616+ {
617+ //選択出来た
618+ annotationIndex = i;
619+ break;
620+ }
621+ }
622+ if(annotationIndex != NONE){
623+ //アノテーションを編集します
624+ AnnotationDialog dlg;
625+ dlg.Create(this, wxID_ANY, MapAnnotation[annotationIndex]);
626+ if(dlg.ShowModal() == wxOK){
627+ map_annotation newAn = dlg.getAnnotation();
628+ //変更
629+ memcpy(&MapAnnotation[annotationIndex],
630+ &newAn, sizeof(map_annotation));
631+ }
632+ }
609633
610- //マウス座標の位置に追加する
611- int viewX = ev.m_x;
612- int viewY = ev.m_y;
613- world_point2d wpoint = wxGetApp().getWorldPointFromViewPoint(viewX, viewY);
614- sample.location.x = wpoint.x;
615- sample.location.y = wpoint.y;
616- sample.polygon_index = NONE;
634+ //見つからなかった
635+ hpl::error;;caution("No annotation found there");
636+ }else{
617637
618- //ダイアログ表示
619- dlg.Create(this, ID_ANNOTATION_DIALOG, sample);
620- if(dlg.ShowModal() == wxID_OK){
621- //決定
622- //アノテーションデータを取得
623- map_annotation newAnnotation = dlg.getAnnotation();
624- //追加
625- hpl::aleph::map::addAnnotation(newAnnotation);
638+ //アノテーション追加
639+ //ダイアログ準備
640+ AnnotationDialog dlg;
641+ map_annotation sample;
642+ //初期化
643+ memset(&sample, 0, SIZEOF_map_annotation);
644+
645+ //マウス座標の位置に追加する
646+ int viewX = ev.m_x;
647+ int viewY = ev.m_y;
648+ world_point2d wpoint = wxGetApp().getWorldPointFromViewPoint(viewX, viewY);
649+ sample.location.x = wpoint.x;
650+ sample.location.y = wpoint.y;
651+ sample.polygon_index = NONE;
652+
653+ //ダイアログ表示
654+ dlg.Create(this, ID_ANNOTATION_DIALOG, sample);
655+ if(dlg.ShowModal() == wxID_OK){
656+ //決定
657+ //アノテーションデータを取得
658+ map_annotation newAnnotation = dlg.getAnnotation();
659+ //追加
660+ hpl::aleph::map::addAnnotation(newAnnotation);
661+ }
662+ //情報を更新する
663+ wxGetApp().getStockManager()->updateDeletes();
626664 }
627- //情報を更新する
628- wxGetApp().getStockManager()->updateDeletes();
629-
630665 #endif
631666 }
632667 void MapEditorMainFrame::doLButtonOnPolygonTool(wxMouseEvent& ev)
--- marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 366)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 367)
@@ -206,6 +206,8 @@
206206 //ストック情報管理
207207 hpl::aleph::HPLStockManager stockManager;
208208
209+ //Shapesマネージャー
210+ hpl::shapes::HPLShapesManager shapesManager;
209211
210212 //ツールごとのカーソル
211213 wxCursor cursors[ToolType::NUMBER_OF_TOOLS];
@@ -222,6 +224,11 @@
222224 wxCursor onPointCursorAdding;
223225 wxCursor lineToolCursorAdding;
224226
227+ //バケツ
228+ wxCursor fillCursor;
229+ //虫眼鏡
230+ wxCursor magCursor;
231+
225232 //ウインドウフレーム
226233 MapEditorMainFrame *frame;
227234 public:
@@ -234,6 +241,9 @@
234241 */
235242 hpl::aleph::view::HPLViewGridManager* getViewGridManager();
236243
244+ //Shapesマネージャー取得
245+ hpl::shapes::HPLShapesManager* getShapesManager();
246+
237247 virtual bool OnInit();
238248 /**
239249 一般的な初期化
@@ -261,6 +271,11 @@
261271 ビットマップの読み込み(簡易版)
262272 */
263273 void loadBitmap(const char* fname, wxImage* bitmap);
274+ void loadImage(const char* fname, wxImage* bitmap);
275+ /**
276+ カラーマスク付きで読み込み
277+ */
278+ void loadImage(const char* fname, wxImage* img, int r, int g, int b);
264279
265280 /**
266281 現在のモード・ツールにあわせてカーソルを変更します
--- marathon/trunk/HPLLib/HPLAlephLib.h (revision 366)
+++ marathon/trunk/HPLLib/HPLAlephLib.h (revision 367)
@@ -8,6 +8,7 @@
88 #include "HPLViewGridManager.h"
99 #include "HPLEventManager.h"
1010 #include "HPLStockManager.h"
11+#include "HPLShapesManager.h"
1112
1213 //一般向け
1314 #include "HPLMath.h"
旧リポジトリブラウザで表示