1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-02 03:20:06 +00:00

Introjucer: file type fix.

This commit is contained in:
jules 2012-09-11 09:35:26 +01:00
parent 9a24aa8a20
commit b396155430
2 changed files with 15 additions and 4 deletions

View file

@ -729,8 +729,8 @@ void IntrojucerLookAndFeel::drawButtonBackground (Graphics& g,
const bool flatOnTop = button.isConnectedOnTop();
const bool flatOnBottom = button.isConnectedOnBottom();
const float width = button.getWidth();
const float height = button.getHeight();
const float width = (float) button.getWidth();
const float height = (float) button.getHeight();
const float x = 0.5f;
const float y = 0.5f;

View file

@ -101,13 +101,24 @@ public:
return true;
MemoryBlock mb;
if (file.loadFileAsData (mb)
&& CharPointer_UTF8::isValidString (static_cast <const char*> (mb.getData()), mb.getSize()))
if (file.loadFileAsData (mb) && seemsToBeText (static_cast <const char*> (mb.getData()), (int) mb.getSize()))
return true;
return false;
}
static bool seemsToBeText (const char* const chars, const int num) noexcept
{
for (int i = 0; i < num; ++i)
{
const char c = chars[i];
if ((c < 32 && c != '\t' && c != '\r' && c != '\n') || chars[i] > 126)
return false;
}
return true;
}
Document* openFile (Project* project, const File& file) { return new SourceCodeDocument (project, file); }
};