• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン380 (tree)
日時2007-07-13 02:25:50
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/TextureDialog.cpp (revision 379)
+++ marathon/trunk/MapEditorWX/src/TextureDialog.cpp (revision 380)
@@ -15,6 +15,77 @@
1515 ID_SCROLL,
1616 };
1717
18+static void drawPanel(int collection, int clut, std::map<int, wxImage>* imgMap,
19+ wxDC* dc, TextureArea* panel)
20+{
21+// wxWindowDC dc(panel_13);
22+ wxSize size = panel->GetMaxSize();
23+ dc->SetPen(*wxWHITE_PEN);
24+ dc->SetBrush(*wxWHITE_BRUSH);
25+ dc->DrawRectangle(0,0,size.GetWidth(), size.GetHeight());
26+
27+ //パレット表示
28+ const int MERGIN_X = 10;
29+ const int MERGIN_Y = 10;
30+ const int ITEM_W = 100;
31+ const int ITEM_H = ITEM_W;
32+ const int ITEM_INTERVAL_X = 10;
33+ const int ITEM_INTERVAL_Y = 10;
34+ const int PITCH = (size.GetWidth() - MERGIN_X * 2) / (ITEM_W + ITEM_INTERVAL_X);
35+
36+ std::map<int, wxImage>::iterator it;
37+ int counter = 0;
38+ for(it = imgMap->begin(); it != imgMap->end(); it ++){
39+ int x = (counter % PITCH) * (ITEM_W + ITEM_INTERVAL_X) + MERGIN_X;
40+ int y = (counter / PITCH) * (ITEM_H + ITEM_INTERVAL_Y) + MERGIN_Y;
41+ wxImage scaledImg = it->second.Scale(ITEM_W, ITEM_H);
42+ wxBitmap bmp(scaledImg);
43+ dc->DrawBitmap(bmp, x, y);
44+ counter ++;
45+ }
46+
47+}
48+
49+BEGIN_EVENT_TABLE(TextureArea, wxScrolledWindow)
50+ EVT_SCROLLWIN( TextureArea::OnScroll)
51+ // end wxGlade
52+END_EVENT_TABLE()
53+
54+TextureArea::TextureArea(wxWindow* parent, wxWindowID id):
55+wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxSTATIC_BORDER|wxTAB_TRAVERSAL)
56+{
57+}
58+TextureArea::~TextureArea()
59+{
60+}
61+
62+void TextureArea::OnScroll(wxScrollWinEvent &event)
63+{
64+ wxScrolledWindow::OnScroll(event);
65+ Refresh();
66+}
67+void TextureArea::OnDraw(wxDC& dc)
68+{
69+ if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
70+ //wxBufferedPaintDC dcB(this);
71+ //wxMemoryDC memDC(dc);
72+
73+ //親
74+ TextureDialog* par = (TextureDialog*)GetParent();
75+ //wxPaintDC dcW(par->panel_13);
76+ //panel_13->PrepareDC(dcW);
77+ int colIndex = par->choice_collection->GetSelection();
78+ if(colIndex >= 0){
79+ int collection = par->collectionIndexTable[colIndex];
80+ int clut = par->choice_clut->GetSelection();
81+
82+ std::map<int, std::map<int, std::map<int, wxImage> > >* tmap = &((MapEditorMainFrame*)par->GetParent())->textureMap;
83+ drawPanel(collection, clut, &tmap->find(collection)->second[clut], &dc,
84+ par->panel_13);
85+ }
86+ }
87+}
88+////////////////////////////////////////////
1889 BEGIN_EVENT_TABLE(TextureDialog, wxDialog)
1990 // begin wxGlade: TextureDialog::event_table
2091 EVT_CHOICE(wxID_ANY, TextureDialog::OnType)
@@ -21,9 +92,10 @@
2192 EVT_CHOICE(wxID_ANY, TextureDialog::OnCollection)
2293 EVT_CHOICE(ID_TYPE, TextureDialog::OnCLUT)
2394 EVT_PAINT(TextureDialog::OnPaint)
24- EVT_SCROLLWIN( TextureDialog::OnScroll)
95+// EVT_SCROLLWIN( TextureDialog::OnScroll)
2596 // end wxGlade
2697 END_EVENT_TABLE()
98+
2799 TextureDialog::TextureDialog()
28100 {
29101 }
@@ -36,7 +108,7 @@
36108
37109 label_75 = new wxStaticText(this, wxID_ANY, wxT("type"));
38110 choice_30 = new wxChoice(this, ID_TYPE);
39- panel_13 = new wxScrolledWindow(this, ID_SCROLL, wxDefaultPosition, wxDefaultSize, wxSTATIC_BORDER|wxTAB_TRAVERSAL);
111+ panel_13 = new TextureArea(this, ID_SCROLL);
40112 wxStaticText* label_collection = new wxStaticText(this, wxID_ANY, wxT("Collection"));
41113 choice_collection = new wxChoice(this, ID_COLLECTION);
42114 wxStaticText* label_clut = new wxStaticText(this, wxID_ANY, wxT("CLUT"));
@@ -115,36 +187,6 @@
115187 {
116188 this->isFloor_ = floor;
117189 }
118-void TextureDialog::drawPanel(int collection, int clut, std::map<int, wxImage>* imgMap,
119- wxDC* dc)
120-{
121-// wxWindowDC dc(panel_13);
122- wxSize size = panel_13->GetMaxSize();
123- dc->SetPen(*wxWHITE_PEN);
124- dc->SetBrush(*wxWHITE_BRUSH);
125- dc->DrawRectangle(0,0,size.GetWidth(), size.GetHeight());
126-
127- //パレット表示
128- const int MERGIN_X = 10;
129- const int MERGIN_Y = 10;
130- const int ITEM_W = 100;
131- const int ITEM_H = ITEM_W;
132- const int ITEM_INTERVAL_X = 10;
133- const int ITEM_INTERVAL_Y = 10;
134- const int PITCH = (size.GetWidth() - MERGIN_X * 2) / (ITEM_W + ITEM_INTERVAL_X);
135-
136- std::map<int, wxImage>::iterator it;
137- int counter = 0;
138- for(it = imgMap->begin(); it != imgMap->end(); it ++){
139- int x = (counter % PITCH) * (ITEM_W + ITEM_INTERVAL_X) + MERGIN_X;
140- int y = (counter / PITCH) * (ITEM_H + ITEM_INTERVAL_Y) + MERGIN_Y;
141- wxImage scaledImg = it->second.Scale(ITEM_W, ITEM_H);
142- wxBitmap bmp(scaledImg);
143- dc->DrawBitmap(bmp, x, y);
144- counter ++;
145- }
146-
147-}
148190 void TextureDialog::setupDialog(int collection)
149191 {
150192 if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
@@ -175,7 +217,7 @@
175217 {
176218 wxPaintDC dc(this);
177219
178- wxPaintDC dcW(panel_13);
220+/* wxPaintDC dcW(panel_13);
179221 //panel_13->PrepareDC(dcW);
180222 int colIndex = choice_collection->GetSelection();
181223 if(colIndex >= 0){
@@ -183,13 +225,14 @@
183225 int clut = choice_clut->GetSelection();
184226
185227 std::map<int, std::map<int, std::map<int, wxImage> > >* tmap = &((MapEditorMainFrame*)GetParent())->textureMap;
186- this->drawPanel(collection, clut, &tmap->find(collection)->second[clut], &dcW);
187- }
228+ drawPanel(collection, clut, &tmap->find(collection)->second[clut], &dcW,
229+ panel_13);
230+ }*/
188231 }
189232
190-void TextureDialog::OnScroll(wxScrollWinEvent &event)
233+/*void TextureDialog::OnScroll(wxScrollWinEvent &event)
191234 {
192235 wxPaintEvent dummy;
193236 OnPaint(dummy);
194237 Refresh();
195-}
238+}*/
--- marathon/trunk/MapEditorWX/src/DlgCommon.h (revision 379)
+++ marathon/trunk/MapEditorWX/src/DlgCommon.h (revision 380)
@@ -18,6 +18,7 @@
1818 #include <wx/colordlg.h>
1919 #include <wx/scrolwin.h>
2020 #include <wx/event.h>
21+#include <wx/dcbuffer.h>
2122
2223 #include "HPLLib/HPLEventManager.h"
2324 #include "MapEditorOneSetting.h"
--- marathon/trunk/MapEditorWX/src/TextureDialog.h (revision 379)
+++ marathon/trunk/MapEditorWX/src/TextureDialog.h (revision 380)
@@ -3,6 +3,7 @@
33
44 #include "DlgCommon.h"
55
6+
67 class TextureArea: public wxScrolledWindow{
78 public:
89 TextureArea(wxWindow* parent, wxWindowID id);
@@ -10,23 +11,23 @@
1011 protected:
1112 DECLARE_EVENT_TABLE()
1213 void OnScroll(wxScrollWinEvent &event);
13- void OnDraw();
14+ void OnDraw(wxDC& dc);
1415 };
1516
1617 class TextureDialog: public wxDialog{
17- wxStaticText* label_75;
18- wxChoice* choice_30;
19- wxScrolledWindow* panel_13;
2018
21- wxChoice* choice_collection;
22- wxChoice* choice_clut;
23-
2419 bool isFloor_;
2520 int indexSelected;
2621
22+public:
2723 //コレクションチョイスと実際のコレクション番号との対応リスト
2824 std::vector<int> collectionIndexTable;
29-public:
25+ wxStaticText* label_75;
26+ wxChoice* choice_30;
27+
28+ wxChoice* choice_collection;
29+ wxChoice* choice_clut;
30+ TextureArea* panel_13;
3031 TextureDialog();
3132 bool Create(wxWindow* parent, wxWindowID id);
3233 virtual ~TextureDialog();
@@ -40,7 +41,6 @@
4041
4142 public:
4243 void setFloor(bool floor);
43- void drawPanel(int collection, int clut, std::map<int, wxImage>* imgMap, wxDC* dc);
4444 void setupDialog(int collection);
4545
4646 int getIndexSelected();
--- marathon/trunk/MapEditorCommonSrc/MapEditorOneInnerSetting.cpp (revision 379)
+++ marathon/trunk/MapEditorCommonSrc/MapEditorOneInnerSetting.cpp (revision 380)
@@ -21,13 +21,7 @@
2121 std::ifstream ifs;
2222 ifs.open(tagNameFilePath);
2323 if(!ifs.is_open()){
24-#ifdef WIN32
25- MessageBox(NULL, L"Cannot open tag file", L"", MB_OK);
26-#else
27- fprintf(stderr, "Couldn't open tag file");
28-#endif
29-
30- exit(-1);
24+ hpl::error::halt("Couldn't open inner setting file[%s]", tagNameFilePath);
3125 }
3226 //タグ読み取り
3327 int counter = 0;
@@ -40,8 +34,7 @@
4034 counter ++;
4135 }
4236 if(counter < mapeditorone::TagType::MaxTagTypes){
43- MessageBox(NULL, L"The number of InnerSetting tags is too few", L"Error", MB_OK);
44- exit(1);
37+ hpl::error::halt("The number of InnerSetting tags is too few");
4538 }
4639 ifs.close();
4740 }
@@ -49,8 +42,7 @@
4942 {
5043 ifstream ifs(dataFilePath);
5144 if(!ifs.is_open()){
52- MessageBox(NULL, L"Cannot open inner data file", L"", MB_OK);
53- exit(-1);
45+ hpl::error::halt("Cannot open inner data file");
5446 }
5547 int counter = 0;
5648 while(ifs.getline(buf, MAX_FILE_PATH) != NULL){
@@ -69,8 +61,7 @@
6961 }
7062 }
7163 if(counter < mapeditorone::TagType::MaxTagTypes){
72- MessageBox(NULL, L"The number of InnerSetting datas is too few", L"Error", MB_OK);
73- exit(1);
64+ hpl::error::halt("The number of InnerSetting datas is too few");
7465 }
7566 ifs.close();
7667 }
旧リポジトリブラウザで表示