Browse Source

win32 openGL tweaks. Fixes for a couple of File methods. New "cpp + header" file creation option for the new jucer.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
e2156acbd0
5 changed files with 62 additions and 43 deletions
  1. +45
    -10
      extras/Jucer (experimental)/Source/Project/jucer_NewFileWizard.cpp
  2. +1
    -1
      extras/Jucer (experimental)/Source/Project/jucer_NewFileWizard.h
  3. +8
    -16
      juce_amalgamated.cpp
  4. +3
    -3
      src/io/files/juce_File.cpp
  5. +5
    -13
      src/native/windows/juce_win32_OpenGLComponent.cpp

+ 45
- 10
extras/Jucer (experimental)/Source/Project/jucer_NewFileWizard.cpp View File

@@ -49,15 +49,22 @@ public:
void createNewFile (Project::Item parent)
{
File newFile = askUserToChooseNewFile ("SourceCode.cpp", "*.cpp", parent);
const File newFile (askUserToChooseNewFile ("SourceCode.cpp", "*.cpp", parent));
if (newFile != File::nonexistent)
create (parent, newFile);
}
static bool create (Project::Item parent, const File& newFile)
{
if (fillInNewCppFileTemplate (newFile, parent, "jucer_NewCppFileTemplate_cpp"))
{
if (fillInNewCppFileTemplate (newFile, parent, "jucer_NewCppFileTemplate_cpp"))
parent.addFile (newFile, 0);
else
showFailedToWriteMessage (newFile);
parent.addFile (newFile, 0);
return true;
}
showFailedToWriteMessage (newFile);
return false;
}
};
@@ -72,18 +79,45 @@ public:
void createNewFile (Project::Item parent)
{
File newFile = askUserToChooseNewFile ("SourceCode.h", "*.h", parent);
const File newFile (askUserToChooseNewFile ("SourceCode.h", "*.h", parent));
if (newFile != File::nonexistent)
create (parent, newFile);
}
static bool create (Project::Item parent, const File& newFile)
{
if (fillInNewCppFileTemplate (newFile, parent, "jucer_NewCppFileTemplate_h"))
{
if (fillInNewCppFileTemplate (newFile, parent, "jucer_NewCppFileTemplate_h"))
parent.addFile (newFile, 0);
else
showFailedToWriteMessage (newFile);
parent.addFile (newFile, 0);
return true;
}
showFailedToWriteMessage (newFile);
return false;
}
};
//==============================================================================
class NewCppAndHeaderFileWizard : public NewFileWizard::Type
{
public:
NewCppAndHeaderFileWizard() {}
~NewCppAndHeaderFileWizard() {}
const String getName() { return "CPP & Header File"; }
void createNewFile (Project::Item parent)
{
const File newFile (askUserToChooseNewFile ("SourceCode.h", "*.h;*.cpp", parent));
if (newFile != File::nonexistent)
{
if (NewHeaderFileWizard::create (parent, newFile.withFileExtension ("h")))
NewCppFileWizard::create (parent, newFile.withFileExtension ("cpp"));
}
}
};
//==============================================================================
void NewFileWizard::Type::showFailedToWriteMessage (const File& file)
@@ -113,6 +147,7 @@ NewFileWizard::NewFileWizard()
{
registerWizard (new NewCppFileWizard());
registerWizard (new NewHeaderFileWizard());
registerWizard (new NewCppAndHeaderFileWizard());
}
NewFileWizard::~NewFileWizard()


+ 1
- 1
extras/Jucer (experimental)/Source/Project/jucer_NewFileWizard.h View File

@@ -56,7 +56,7 @@ public:
const File askUserToChooseNewFile (const String& suggestedFilename, const String& wildcard,
const Project::Item& projectGroupToAddTo);
void showFailedToWriteMessage (const File& file);
static void showFailedToWriteMessage (const File& file);
};
//==============================================================================


+ 8
- 16
juce_amalgamated.cpp View File

@@ -7483,7 +7483,7 @@ int File::findChildFiles (Array<File>& results,

int File::getNumberOfChildFiles (const int whatToLookFor, const String& wildCardPattern) const
{
DirectoryIterator di (*this, false, "*", whatToLookFor);
DirectoryIterator di (*this, false, wildCardPattern, whatToLookFor);

int total = 0;
while (di.next())
@@ -7924,7 +7924,7 @@ public:

expect (tempFile.exists());
expect (tempFile.getSize() == 10);
expect (std::abs ((int64) (tempFile.getLastModificationTime().toMilliseconds() - Time::getCurrentTime().toMilliseconds())) < 3000);
expect (std::abs ((int) (tempFile.getLastModificationTime().toMilliseconds() - Time::getCurrentTime().toMilliseconds())) < 3000);
expect (tempFile.loadFileAsString() == "0123456789");
expect (! demoFolder.containsSubDirectories());

@@ -7945,7 +7945,7 @@ public:
Time t (Time::getCurrentTime());
tempFile.setLastModificationTime (t);
Time t2 = tempFile.getLastModificationTime();
expect (std::abs ((int64) (t2.toMilliseconds() - t.toMilliseconds())) <= 1000);
expect (std::abs ((int) (t2.toMilliseconds() - t.toMilliseconds())) <= 1000);

{
MemoryBlock mb;
@@ -246329,22 +246329,14 @@ private:

void createNativeWindow()
{
nativeWindow = new Win32ComponentPeer (component, 0, 0);
Win32ComponentPeer* topLevelPeer = dynamic_cast <Win32ComponentPeer*> (component->getTopLevelComponent()->getPeer());

nativeWindow = new Win32ComponentPeer (component, ComponentPeer::windowIgnoresMouseClicks,
topLevelPeer == 0 ? 0 : (HWND) topLevelPeer->getNativeHandle());
nativeWindow->dontRepaint = true;
nativeWindow->setVisible (true);

HWND hwnd = (HWND) nativeWindow->getNativeHandle();

Win32ComponentPeer* const peer = dynamic_cast <Win32ComponentPeer*> (component->getTopLevelComponent()->getPeer());

if (peer != 0)
{
SetParent (hwnd, (HWND) peer->getNativeHandle());
juce_setWindowStyleBit (hwnd, GWL_STYLE, WS_CHILD, true);
juce_setWindowStyleBit (hwnd, GWL_STYLE, WS_POPUP, false);
}

dc = GetDC (hwnd);
dc = GetDC ((HWND) nativeWindow->getNativeHandle());
}

bool fillInPixelFormatDetails (const int pixelFormatIndex,


+ 3
- 3
src/io/files/juce_File.cpp View File

@@ -551,7 +551,7 @@ int File::findChildFiles (Array<File>& results,
int File::getNumberOfChildFiles (const int whatToLookFor, const String& wildCardPattern) const
{
DirectoryIterator di (*this, false, "*", whatToLookFor);
DirectoryIterator di (*this, false, wildCardPattern, whatToLookFor);
int total = 0;
while (di.next())
@@ -1003,7 +1003,7 @@ public:
expect (tempFile.exists());
expect (tempFile.getSize() == 10);
expect (std::abs ((int64) (tempFile.getLastModificationTime().toMilliseconds() - Time::getCurrentTime().toMilliseconds())) < 3000);
expect (std::abs ((int) (tempFile.getLastModificationTime().toMilliseconds() - Time::getCurrentTime().toMilliseconds())) < 3000);
expect (tempFile.loadFileAsString() == "0123456789");
expect (! demoFolder.containsSubDirectories());
@@ -1024,7 +1024,7 @@ public:
Time t (Time::getCurrentTime());
tempFile.setLastModificationTime (t);
Time t2 = tempFile.getLastModificationTime();
expect (std::abs ((int64) (t2.toMilliseconds() - t.toMilliseconds())) <= 1000);
expect (std::abs ((int) (t2.toMilliseconds() - t.toMilliseconds())) <= 1000);
{
MemoryBlock mb;


+ 5
- 13
src/native/windows/juce_win32_OpenGLComponent.cpp View File

@@ -391,22 +391,14 @@ private:
//==============================================================================
void createNativeWindow()
{
nativeWindow = new Win32ComponentPeer (component, 0, 0);
Win32ComponentPeer* topLevelPeer = dynamic_cast <Win32ComponentPeer*> (component->getTopLevelComponent()->getPeer());
nativeWindow = new Win32ComponentPeer (component, ComponentPeer::windowIgnoresMouseClicks,
topLevelPeer == 0 ? 0 : (HWND) topLevelPeer->getNativeHandle());
nativeWindow->dontRepaint = true;
nativeWindow->setVisible (true);
HWND hwnd = (HWND) nativeWindow->getNativeHandle();
Win32ComponentPeer* const peer = dynamic_cast <Win32ComponentPeer*> (component->getTopLevelComponent()->getPeer());
if (peer != 0)
{
SetParent (hwnd, (HWND) peer->getNativeHandle());
juce_setWindowStyleBit (hwnd, GWL_STYLE, WS_CHILD, true);
juce_setWindowStyleBit (hwnd, GWL_STYLE, WS_POPUP, false);
}
dc = GetDC (hwnd);
dc = GetDC ((HWND) nativeWindow->getNativeHandle());
}
bool fillInPixelFormatDetails (const int pixelFormatIndex,


Loading…
Cancel
Save