1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
jules 2007-06-27 12:19:24 +00:00
parent 29a4d1f99c
commit 315a8ea1f5
9 changed files with 50 additions and 27 deletions

View file

@ -187,7 +187,7 @@ enum MouseButtons
WheelDown = 5 WheelDown = 5
}; };
static void getMousePos (int& x, int& y, int& mouseMods) static void getMousePos (int& x, int& y, int& mouseMods) throw()
{ {
Window root, child; Window root, child;
int winx, winy; int winx, winy;
@ -223,7 +223,7 @@ static bool numLock = 0;
static bool capsLock = 0; static bool capsLock = 0;
static char keyStates [32]; static char keyStates [32];
static void updateKeyStates (const int keycode, const bool press) static void updateKeyStates (const int keycode, const bool press) throw()
{ {
const int keybyte = keycode >> 3; const int keybyte = keycode >> 3;
const int keybit = (1 << (keycode & 7)); const int keybit = (1 << (keycode & 7));
@ -234,7 +234,7 @@ static void updateKeyStates (const int keycode, const bool press)
keyStates [keybyte] &= ~keybit; keyStates [keybyte] &= ~keybit;
} }
static bool keyDown (const int keycode) static bool keyDown (const int keycode) throw()
{ {
const int keybyte = keycode >> 3; const int keybyte = keycode >> 3;
const int keybit = (1 << (keycode & 7)); const int keybit = (1 << (keycode & 7));
@ -271,7 +271,7 @@ bool KeyPress::isKeyCurrentlyDown (int keyCode)
//============================================================================== //==============================================================================
// Alt and Num lock are not defined by standard X // Alt and Num lock are not defined by standard X
// modifier constants: check what they're mapped to // modifier constants: check what they're mapped to
static void getModifierMapping() static void getModifierMapping() throw()
{ {
const int altLeftCode = XKeysymToKeycode (display, XK_Alt_L); const int altLeftCode = XKeysymToKeycode (display, XK_Alt_L);
const int numLockCode = XKeysymToKeycode (display, XK_Num_Lock); const int numLockCode = XKeysymToKeycode (display, XK_Num_Lock);
@ -313,7 +313,7 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime()
return ModifierKeys (currentModifiers); return ModifierKeys (currentModifiers);
} }
static void updateKeyModifiers (const int status) static void updateKeyModifiers (const int status) throw()
{ {
currentModifiers &= ~(ModifierKeys::shiftModifier currentModifiers &= ~(ModifierKeys::shiftModifier
| ModifierKeys::ctrlModifier | ModifierKeys::ctrlModifier
@ -332,7 +332,7 @@ static void updateKeyModifiers (const int status)
capsLock = ((status & LockMask) != 0); capsLock = ((status & LockMask) != 0);
} }
static bool updateKeyModifiersFromSym (KeySym sym, const bool press) static bool updateKeyModifiersFromSym (KeySym sym, const bool press) throw()
{ {
int modifier = 0; int modifier = 0;
bool isModifier = true; bool isModifier = true;
@ -387,7 +387,7 @@ static bool updateKeyModifiersFromSym (KeySym sym, const bool press)
//============================================================================== //==============================================================================
#if JUCE_USE_XSHM #if JUCE_USE_XSHM
static bool isShmAvailable() static bool isShmAvailable() throw()
{ {
static bool isChecked = false; static bool isChecked = false;
static bool isAvailable = false; static bool isAvailable = false;
@ -703,7 +703,7 @@ public:
return (void*) windowH; return (void*) windowH;
} }
static LinuxComponentPeer* getPeerFor (Window windowHandle) static LinuxComponentPeer* getPeerFor (Window windowHandle) throw()
{ {
LinuxComponentPeer* peer = 0; LinuxComponentPeer* peer = 0;
@ -1455,6 +1455,16 @@ public:
updateBorderSize(); updateBorderSize();
handleMovedOrResized(); handleMovedOrResized();
// if the native title bar is dragged, need to tell any active menus, etc.
if ((styleFlags & windowHasTitleBar) != 0
&& component->isCurrentlyBlockedByAnotherModalComponent())
{
Component* const currentModalComp = Component::getCurrentlyModalComponent();
if (currentModalComp != 0)
currentModalComp->inputAttemptWhenModal();
}
XConfigureEvent* const confEvent = (XConfigureEvent*) &event->xconfigure; XConfigureEvent* const confEvent = (XConfigureEvent*) &event->xconfigure;
if (confEvent->window == windowH if (confEvent->window == windowH
@ -2107,7 +2117,7 @@ private:
{} {}
} }
static int64 getEventTime (::Time t) static int64 getEventTime (::Time t) throw()
{ {
static int64 eventTimeOffset = 0x12345678; static int64 eventTimeOffset = 0x12345678;
const int64 thisMessageTime = t; const int64 thisMessageTime = t;
@ -2118,7 +2128,7 @@ private:
return eventTimeOffset + thisMessageTime; return eventTimeOffset + thisMessageTime;
} }
static void setWindowTitle (Window xwin, const char* const title) static void setWindowTitle (Window xwin, const char* const title) throw()
{ {
XTextProperty nameProperty; XTextProperty nameProperty;
char* strings[] = { (char*) title }; char* strings[] = { (char*) title };
@ -2127,6 +2137,8 @@ private:
{ {
XSetWMName (display, xwin, &nameProperty); XSetWMName (display, xwin, &nameProperty);
XSetWMIconName (display, xwin, &nameProperty); XSetWMIconName (display, xwin, &nameProperty);
XFree (nameProperty.value);
} }
} }
@ -2623,10 +2635,8 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
{ {
case MouseCursor::NoCursor: case MouseCursor::NoCursor:
{ {
void* invisibleCursor;
Image im (Image::ARGB, 16, 16, true); Image im (Image::ARGB, 16, 16, true);
invisibleCursor = juce_createMouseCursorFromImage (im, 0, 0); void* const invisibleCursor = juce_createMouseCursorFromImage (im, 0, 0);
return invisibleCursor; return invisibleCursor;
} }
@ -2636,7 +2646,6 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
case MouseCursor::DraggingHandCursor: case MouseCursor::DraggingHandCursor:
{ {
void* dragHandCursor;
static unsigned char dragHandData[] = {71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0, static unsigned char dragHandData[] = {71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0,
0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0, 0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0,
16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39, 16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39,
@ -2644,8 +2653,8 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 }; 247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 };
const int dragHandDataSize = 99; const int dragHandDataSize = 99;
Image* im = ImageFileFormat::loadFrom ((const char*) dragHandData, dragHandDataSize); Image* const im = ImageFileFormat::loadFrom ((const char*) dragHandData, dragHandDataSize);
dragHandCursor = juce_createMouseCursorFromImage (*im, 8, 7); void* const dragHandCursor = juce_createMouseCursorFromImage (*im, 8, 7);
delete im; delete im;
return dragHandCursor; return dragHandCursor;
@ -2653,8 +2662,6 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
case MouseCursor::CopyingCursor: case MouseCursor::CopyingCursor:
{ {
void* copyCursor;
static unsigned char copyCursorData[] = {71,73,70,56,57,97,21,0,21,0,145,0,0,0,0,0,255,255,255,0, static unsigned char copyCursorData[] = {71,73,70,56,57,97,21,0,21,0,145,0,0,0,0,0,255,255,255,0,
128,128,255,255,255,33,249,4,1,0,0,3,0,44,0,0,0,0,21,0, 128,128,255,255,255,33,249,4,1,0,0,3,0,44,0,0,0,0,21,0,
21,0,0,2,72,4,134,169,171,16,199,98,11,79,90,71,161,93,56,111, 21,0,0,2,72,4,134,169,171,16,199,98,11,79,90,71,161,93,56,111,
@ -2663,8 +2670,8 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
252,114,147,74,83,5,50,68,147,208,217,16,71,149,252,124,5,0,59,0,0 }; 252,114,147,74,83,5,50,68,147,208,217,16,71,149,252,124,5,0,59,0,0 };
const int copyCursorSize = 119; const int copyCursorSize = 119;
Image* im = ImageFileFormat::loadFrom ((const char*)copyCursorData, copyCursorSize); Image* const im = ImageFileFormat::loadFrom ((const char*) copyCursorData, copyCursorSize);
copyCursor = juce_createMouseCursorFromImage (*im, 1, 3); void* const copyCursor = juce_createMouseCursorFromImage (*im, 1, 3);
delete im; delete im;
return copyCursor; return copyCursor;
@ -2886,7 +2893,7 @@ void juce_repaintOpenGLWindow (void* context)
//============================================================================== //==============================================================================
static void initClipboard (Window root, Atom* cutBuffers) static void initClipboard (Window root, Atom* cutBuffers) throw()
{ {
static bool init = false; static bool init = false;

View file

@ -350,6 +350,8 @@ public:
/** Called by the host to find out the value of one of the plugin's parameters. /** Called by the host to find out the value of one of the plugin's parameters.
The host will expect the value returned to be between 0 and 1.0.
This could be called quite frequently, so try to make your code efficient. This could be called quite frequently, so try to make your code efficient.
*/ */
virtual float JUCE_CALLTYPE getParameter (int parameterIndex) = 0; virtual float JUCE_CALLTYPE getParameter (int parameterIndex) = 0;
@ -367,6 +369,8 @@ public:
setParameterNotifyingHost() method, which will also send a message to setParameterNotifyingHost() method, which will also send a message to
the host telling it about the change. If the message isn't sent, the host the host telling it about the change. If the message isn't sent, the host
won't be able to automate your parameters properly. won't be able to automate your parameters properly.
The value passed will be between 0 and 1.0.
*/ */
virtual void JUCE_CALLTYPE setParameter (int parameterIndex, virtual void JUCE_CALLTYPE setParameter (int parameterIndex,
float newValue) = 0; float newValue) = 0;
@ -374,7 +378,7 @@ public:
/** Your plugin can call this when it needs to change one of its parameters. /** Your plugin can call this when it needs to change one of its parameters.
This could happen when the editor or some other internal operation changes This could happen when the editor or some other internal operation changes
a parameter. This method will call the setParamete() method to change the a parameter. This method will call the setParameter() method to change the
value, and will then send a message to the host telling it about the change. value, and will then send a message to the host telling it about the change.
*/ */
void JUCE_CALLTYPE setParameterNotifyingHost (int parameterIndex, void JUCE_CALLTYPE setParameterNotifyingHost (int parameterIndex,

View file

@ -120,7 +120,7 @@ void MessageManager::deliverMessage (void* message)
++messageCounter; ++messageCounter;
} }
else if (m->intParameter1 == quitMessageId) else if (recipient == 0 && m->intParameter1 == quitMessageId)
{ {
quitMessageReceived = true; quitMessageReceived = true;
useMaximumForceWhenQuitting = (m->intParameter2 != 0); useMaximumForceWhenQuitting = (m->intParameter2 != 0);

View file

@ -61,7 +61,8 @@ Button::Button (const String& name)
needsToRelease (false), needsToRelease (false),
needsRepainting (false), needsRepainting (false),
isKeyDown (false), isKeyDown (false),
triggerOnMouseDown (false) triggerOnMouseDown (false),
generateTooltip (false)
{ {
setWantsKeyboardFocus (true); setWantsKeyboardFocus (true);
} }

View file

@ -45,6 +45,8 @@ class ListBoxRowComponent : public Component
public: public:
ListBoxRowComponent (ListBox& owner_) ListBoxRowComponent (ListBox& owner_)
: owner (owner_), : owner (owner_),
row (-1),
selected (false),
isDragging (false) isDragging (false)
{ {
} }

View file

@ -60,6 +60,8 @@ MenuBarComponent::MenuBarComponent (MenuBarModel* model_)
itemUnderMouse (-1), itemUnderMouse (-1),
currentPopupIndex (-1), currentPopupIndex (-1),
indexToShowAgain (-1), indexToShowAgain (-1),
lastMouseX (0),
lastMouseY (0),
inModalState (false), inModalState (false),
currentPopup (0) currentPopup (0)
{ {

View file

@ -316,6 +316,7 @@ public:
numColumns (0), numColumns (0),
contentHeight (0), contentHeight (0),
childYOffset (0), childYOffset (0),
timeEnteredCurrentChildComp (0),
scrollAcceleration (1.0) scrollAcceleration (1.0)
{ {
menuCreationTime = lastFocused = lastScroll = Time::getMillisecondCounter(); menuCreationTime = lastFocused = lastScroll = Time::getMillisecondCounter();

View file

@ -41,6 +41,7 @@ BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
DrawableImage::DrawableImage() DrawableImage::DrawableImage()
: image (0), : image (0),
canDeleteImage (false),
opacity (1.0f), opacity (1.0f),
overlayColour (0x00000000) overlayColour (0x00000000)
{ {

View file

@ -406,8 +406,14 @@ private:
//============================================================================== //==============================================================================
struct CachedFace struct CachedFace
{ {
int lastUsageCount; CachedFace() throw()
: lastUsageCount (0),
flags (0)
{
}
String typefaceName; String typefaceName;
int lastUsageCount;
int flags; int flags;
Typeface::Ptr typeFace; Typeface::Ptr typeFace;
}; };
@ -427,9 +433,8 @@ public:
while (--numToCache >= 0) while (--numToCache >= 0)
{ {
CachedFace* const face = new CachedFace(); CachedFace* const face = new CachedFace();
faces.add (face);
face->lastUsageCount = 0;
face->typeFace = new Typeface(); face->typeFace = new Typeface();
faces.add (face);
} }
} }