diff --git a/mk/windoze/Glest.suo b/mk/windoze/Glest.suo index 66b5de973..acd65b35d 100755 Binary files a/mk/windoze/Glest.suo and b/mk/windoze/Glest.suo differ diff --git a/mk/windoze/glest_editor.vcproj b/mk/windoze/glest_editor.vcproj index e41c7b8a9..f6e08b31b 100755 --- a/mk/windoze/glest_editor.vcproj +++ b/mk/windoze/glest_editor.vcproj @@ -117,7 +117,7 @@ - #include "conversion.h" - #include "icons.h" - +#include "platform_common.h" +#include using namespace Shared::Util; +using namespace Shared::PlatformCommon; using namespace std; namespace MapEditor { @@ -288,10 +287,10 @@ MainWindow::MainWindow() this->panel->SetSizer(boxsizer); this->Layout(); -#ifndef WIN32 +//#ifndef WIN32 timer = new wxTimer(this); timer->Start(100); -#endif +//#endif glCanvas->SetFocus(); } @@ -301,13 +300,14 @@ void MainWindow::onToolPlayer(wxCommandEvent& event){ void MainWindow::init(string fname) { glCanvas->SetCurrent(); + program = new Program(glCanvas->GetClientSize().x, glCanvas->GetClientSize().y); fileName = "New (unsaved) Map"; if (!fname.empty() && fileExists(fname)) { program->loadMap(fname); currentFile = fname; - fileName = cutLastExt(basename(fname.c_str())); + fileName = cutLastExt(extractFileFromDirectoryPath(fname.c_str())); } SetTitle(ToUnicode(winHeader + "; " + currentFile)); setDirty(false); @@ -355,6 +355,9 @@ void MainWindow::setExtension() { void MainWindow::onTimer(wxTimerEvent &event) { wxPaintEvent paintEvent; onPaint(paintEvent); +#ifdef WIN32 + Update(); +#endif } void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) { @@ -414,7 +417,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event) { if (fileDialog.ShowModal() == wxID_OK) { currentFile = fileDialog.GetPath().ToAscii(); program->loadMap(currentFile); - fileName = cutLastExt(basename(currentFile.c_str())); + fileName = cutLastExt(extractFileFromDirectoryPath(currentFile.c_str())); setDirty(false); setExtension(); SetTitle(ToUnicode(winHeader + "; " + currentFile)); @@ -439,7 +442,7 @@ void MainWindow::onMenuFileSaveAs(wxCommandEvent &event) { currentFile = fileDialog.GetPath().ToAscii(); setExtension(); program->saveMap(currentFile); - fileName = cutLastExt(basename(currentFile.c_str())); + fileName = cutLastExt(extractFileFromDirectoryPath(currentFile.c_str())); setDirty(false); } SetTitle(ToUnicode(winHeader + "; " + currentFile)); @@ -910,6 +913,7 @@ void GlCanvas::onKeyDown(wxKeyEvent &event) { mainWindow->onKeyDown(event); } + BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas) EVT_KEY_DOWN(GlCanvas::onKeyDown) @@ -926,7 +930,7 @@ void SimpleDialog::addValue(const string &key, const string &value) { } string SimpleDialog::getValue(const string &key) { - for (int i = 0; i < values.size(); ++i) { + for (unsigned int i = 0; i < values.size(); ++i) { if (values[i].first == key) { return values[i].second; } @@ -952,7 +956,7 @@ void SimpleDialog::show() { ShowModal(); - for (int i = 0; i < texts.size(); ++i) { + for (unsigned int i = 0; i < texts.size(); ++i) { values[i].second = texts[i]->GetValue().ToAscii(); } } @@ -970,6 +974,15 @@ bool App::OnInit() { mainWindow = new MainWindow(); mainWindow->Show(); mainWindow->init(fileparam); + mainWindow->Update(); + +#ifdef WIN32 + wxPoint pos = mainWindow->GetScreenPosition(); + wxSize size = mainWindow->GetSize(); + mainWindow->SetSize(pos.x, pos.y, size.x-1, size.y, wxSIZE_FORCE); + mainWindow->Update(); +#endif + return true; } diff --git a/source/shared_lib/include/platform/common/platform_common.h b/source/shared_lib/include/platform/common/platform_common.h index 4645fb09f..566c09542 100644 --- a/source/shared_lib/include/platform/common/platform_common.h +++ b/source/shared_lib/include/platform/common/platform_common.h @@ -22,11 +22,10 @@ #include #include -#include - #include "types.h" #include "checksum.h" #include +#include using std::string; using std::vector; @@ -112,6 +111,7 @@ vector > getFolderTreeContentsCheckSumListRecursively(ve vector > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector > *recursiveMap); void createDirectoryPaths(string Path); +string extractFileFromDirectoryPath(string filename); string extractDirectoryPathFromFile(string filename); string extractExtension(const string& filename); diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index f86b498a3..c1d4a1800 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -558,9 +558,32 @@ vector > getFolderTreeContentsCheckSumListRecursively(co return crcTreeCache[cacheKey]; } +string extractFileFromDirectoryPath(string filename) +{ + size_t lastDirectory_Win = filename.find_last_of('\\'); + size_t lastDirectory_Lin = filename.find_last_of('/'); + size_t lastDirectory = (lastDirectory_Win