Browse Source

Fix for some audio plugin window focus issues. Changed the Jucer to use a CodeEditorComponent for its preview panel.

tags/2021-05-28
Julian Storer 16 years ago
parent
commit
e53a0efb56
3 changed files with 22 additions and 6 deletions
  1. +2
    -0
      .gitignore
  2. +5
    -6
      extras/the jucer/src/ui/jucer_JucerDocumentHolder.cpp
  3. +15
    -0
      src/native/mac/juce_mac_NSViewComponentPeer.mm

+ 2
- 0
.gitignore View File

@@ -13,6 +13,8 @@
*.idb *.idb
*.manifest *.manifest
*.manifest.res *.manifest.res
*.o
*.d
extras/juce demo/build/macosx/build extras/juce demo/build/macosx/build
extras/juce demo/build/win32_vc8/Debug extras/juce demo/build/win32_vc8/Debug
extras/juce demo/build/win32_vc8/Release extras/juce demo/build/win32_vc8/Release


+ 5
- 6
extras/the jucer/src/ui/jucer_JucerDocumentHolder.cpp View File

@@ -302,10 +302,7 @@ public:
: document (document_), : document (document_),
isHeader (showHeaderFileFirst) isHeader (showHeaderFileFirst)
{ {
addAndMakeVisible (editor = new TextEditor());
editor->setMultiLine (true, false);
editor->setReadOnly (true);
editor->setFont (Font (Font::getDefaultMonospacedFontName(), 13.0f, Font::plain));
addAndMakeVisible (editor = new CodeEditorComponent (codeDocument, &tokeniser));
addAndMakeVisible (switchButton = new TextButton (String::empty)); addAndMakeVisible (switchButton = new TextButton (String::empty));
switchButton->addButtonListener (this); switchButton->addButtonListener (this);
@@ -322,7 +319,7 @@ public:
void showFile (const bool isHeader_) void showFile (const bool isHeader_)
{ {
isHeader = isHeader_; isHeader = isHeader_;
editor->setText (isHeader ? h : cpp, false);
editor->loadContent (isHeader ? h : cpp);
switchButton->setButtonText (isHeader ? T("Show .cpp") : T("Show .h")); switchButton->setButtonText (isHeader ? T("Show .cpp") : T("Show .h"));
} }
@@ -351,7 +348,9 @@ private:
JucerDocument& document; JucerDocument& document;
String h, cpp; String h, cpp;
bool isHeader; bool isHeader;
TextEditor* editor;
CodeDocument codeDocument;
CPlusPlusCodeTokeniser tokeniser;
CodeEditorComponent* editor;
TextButton* switchButton; TextButton* switchButton;
static bool showHeaderFileFirst; static bool showHeaderFileFirst;


+ 15
- 0
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -66,6 +66,7 @@ END_JUCE_NAMESPACE
- (void) scrollWheel: (NSEvent*) ev; - (void) scrollWheel: (NSEvent*) ev;
- (BOOL) acceptsFirstMouse: (NSEvent*) ev; - (BOOL) acceptsFirstMouse: (NSEvent*) ev;
- (void) frameChanged: (NSNotification*) n; - (void) frameChanged: (NSNotification*) n;
- (void) viewDidMoveToWindow;
- (void) keyDown: (NSEvent*) ev; - (void) keyDown: (NSEvent*) ev;
- (void) keyUp: (NSEvent*) ev; - (void) keyUp: (NSEvent*) ev;
@@ -186,6 +187,8 @@ public:
virtual bool windowShouldClose(); virtual bool windowShouldClose();
virtual void redirectMovedOrResized(); virtual void redirectMovedOrResized();
virtual void viewMovedToWindow();
virtual NSRect constrainRect (NSRect r); virtual NSRect constrainRect (NSRect r);
static void showArrowCursorIfNeeded(); static void showArrowCursorIfNeeded();
@@ -368,6 +371,12 @@ END_JUCE_NAMESPACE
owner->redirectMovedOrResized(); owner->redirectMovedOrResized();
} }
- (void) viewDidMoveToWindow
{
if (owner != 0)
owner->viewMovedToWindow();
}
- (void) asyncRepaint: (id) rect - (void) asyncRepaint: (id) rect
{ {
NSRect* r = (NSRect*) [((NSData*) rect) bytes]; NSRect* r = (NSRect*) [((NSData*) rect) bytes];
@@ -1498,6 +1507,12 @@ void NSViewComponentPeer::redirectMovedOrResized()
handleMovedOrResized(); handleMovedOrResized();
} }
void NSViewComponentPeer::viewMovedToWindow()
{
if (isSharedWindow)
window = [view window];
}
//============================================================================== //==============================================================================
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
{ {


Loading…
Cancel
Save