mirror of https://github.com/AxioDL/metaforce.git
Win32 fixes
This commit is contained in:
parent
8959431a2b
commit
a4a531a558
|
@ -167,7 +167,7 @@ private:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
float m_columnSplits[3] = {0.0, 0.7, 0.9};
|
||||
float m_columnSplits[3] = {0.0f, 0.7f, 0.9f};
|
||||
|
||||
bool columnSplitResizeAllowed() const {return true;}
|
||||
|
||||
|
@ -261,6 +261,10 @@ private:
|
|||
{
|
||||
HECL::SystemString m_path;
|
||||
std::string m_name;
|
||||
|
||||
Entry(std::pair<HECL::SystemString, std::string>&& path)
|
||||
: m_path(std::move(path.first)), m_name(std::move(path.second)) {}
|
||||
|
||||
Entry(const HECL::SystemString& path)
|
||||
: m_path(path)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ class Table : public View
|
|||
size_t m_rows = 0;
|
||||
size_t m_columns = 0;
|
||||
size_t m_selectedRow = -1;
|
||||
size_t m_deferredActivation = -1;
|
||||
size_t m_clickFrames = 15;
|
||||
|
||||
struct CellView : public View
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
bool m_space = false;
|
||||
|
||||
RenderGlyphInfo(uint32_t ch, int width, int height, int adv)
|
||||
: m_char(ch), m_dims(width, height), m_adv(adv), m_space(iswspace(ch)) {}
|
||||
: m_char(ch), m_dims(width, height), m_adv(adv), m_space(iswspace(ch) != 0) {}
|
||||
};
|
||||
std::vector<RenderGlyph>& accessGlyphs() {return m_glyphs;}
|
||||
const std::vector<RenderGlyph>& accessGlyphs() const {return m_glyphs;}
|
||||
|
|
|
@ -76,9 +76,9 @@ FileBrowser::FileBrowser(ViewResources& res, View& parentView, const std::string
|
|||
m_recentBookmarksLabel->typesetGlyphs(vm.translateOr("recent_files", "Recent Files"), res.themeData().uiText());
|
||||
|
||||
/* Populate system bookmarks */
|
||||
std::vector<HECL::SystemString> systemLocs = HECL::GetSystemLocations();
|
||||
for (const HECL::SystemString& loc : systemLocs)
|
||||
m_systemBookmarkBind.m_entries.emplace_back(loc);
|
||||
std::vector<std::pair<HECL::SystemString, std::string>> systemLocs = HECL::GetSystemLocations();
|
||||
for (auto& loc : systemLocs)
|
||||
m_systemBookmarkBind.m_entries.emplace_back(std::move(loc));
|
||||
m_systemBookmarks.m_view->updateData();
|
||||
|
||||
navigateToPath(initialPath);
|
||||
|
@ -112,6 +112,13 @@ void FileBrowser::SyncBookmarkSelections(Table& table, BookmarkDataBind& binding
|
|||
void FileBrowser::navigateToPath(const HECL::SystemString& path)
|
||||
{
|
||||
HECL::Sstat theStat;
|
||||
#if _WIN32
|
||||
if (path.size() == 2 && path[1] == L':')
|
||||
{
|
||||
if (HECL::Stat((path + L'/').c_str(), &theStat))
|
||||
return;
|
||||
} else
|
||||
#endif
|
||||
if (HECL::Stat(path.c_str(), &theStat))
|
||||
return;
|
||||
|
||||
|
@ -192,7 +199,14 @@ void FileBrowser::okActivated(bool viaButton)
|
|||
}
|
||||
|
||||
HECL::Sstat theStat;
|
||||
#if _WIN32
|
||||
HECL::SystemString fixPath = path;
|
||||
if (path.size() == 2 && path[1] == L':')
|
||||
fixPath += L'/';
|
||||
if (HECL::Stat(fixPath.c_str(), &theStat) || !S_ISDIR(theStat.st_mode))
|
||||
#else
|
||||
if (HECL::Stat(path.c_str(), &theStat) || !S_ISDIR(theStat.st_mode))
|
||||
#endif
|
||||
{
|
||||
HECL::SystemUTF8View utf8(path);
|
||||
m_fileField.m_view->setErrorState(
|
||||
|
@ -202,7 +216,7 @@ void FileBrowser::okActivated(bool viaButton)
|
|||
}
|
||||
|
||||
path += _S('/');
|
||||
path += m_fileField.m_view->getText();
|
||||
path += HECL::SystemStringView(m_fileField.m_view->getText()).sys_str();
|
||||
|
||||
int err = HECL::Stat(path.c_str(), &theStat);
|
||||
if (m_type == Type::SaveFile)
|
||||
|
@ -271,7 +285,7 @@ void FileBrowser::cancelActivated()
|
|||
}
|
||||
|
||||
path += _S('/');
|
||||
path += m_fileField.m_view->getText();
|
||||
path += HECL::SystemStringView(m_fileField.m_view->getText()).sys_str();
|
||||
|
||||
m_returnFunc(false, path);
|
||||
close();
|
||||
|
|
|
@ -308,7 +308,7 @@ void Table::mouseDown(const boo::SWindowCoord& coord,
|
|||
}
|
||||
if (abs(coord.pixel[0] - rect.location[0]) < 4 &&
|
||||
unsigned(coord.pixel[1] - subRect().location[1] -
|
||||
subRect().size[1] + rect.size[1]) < rect.size[1])
|
||||
subRect().size[1] + rect.size[1]) < unsigned(rect.size[1]))
|
||||
{
|
||||
m_hDraggingIdx = cIdx;
|
||||
rootView().setActiveDragView(this);
|
||||
|
@ -321,6 +321,12 @@ void Table::mouseDown(const boo::SWindowCoord& coord,
|
|||
m_scroll.mouseDown(coord, button, mod);
|
||||
if (m_headerNeedsUpdate)
|
||||
_setHeaderVerts(subRect());
|
||||
|
||||
if (m_deferredActivation != -1 && m_state)
|
||||
{
|
||||
m_state->rowActivated(m_deferredActivation);
|
||||
m_deferredActivation = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void Table::RowsView::mouseDown(const boo::SWindowCoord& coord,
|
||||
|
@ -340,8 +346,8 @@ void Table::CellView::mouseDown(const boo::SWindowCoord& coord,
|
|||
if (m_r != -1)
|
||||
{
|
||||
m_t.selectRow(m_r);
|
||||
if (m_t.m_clickFrames < 15 && m_t.m_state)
|
||||
m_t.m_state->rowActivated(m_r);
|
||||
if (m_t.m_clickFrames < 15)
|
||||
m_t.m_deferredActivation = m_r;
|
||||
else
|
||||
m_t.m_clickFrames = 0;
|
||||
}
|
||||
|
@ -415,7 +421,7 @@ void Table::mouseMove(const boo::SWindowCoord& coord)
|
|||
continue;
|
||||
if (abs(coord.pixel[0] - rect.location[0]) < 4 &&
|
||||
unsigned(coord.pixel[1] - subRect().location[1] -
|
||||
subRect().size[1] + rect.size[1]) < rect.size[1])
|
||||
subRect().size[1] + rect.size[1]) < unsigned(rect.size[1]))
|
||||
{
|
||||
hovering = true;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue