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

Minor clean-ups. Jucer development.

This commit is contained in:
Julian Storer 2010-04-14 20:08:21 +01:00
parent 61252d75c6
commit d4435ca8b8
85 changed files with 900 additions and 569 deletions

View file

@ -51,7 +51,7 @@ public:
static void createLines (Array <CodeDocumentLine*>& newLines, const String& text)
{
const tchar* const t = (const tchar*) text;
const juce_wchar* const t = text;
int pos = 0;
while (t [pos] != 0)
@ -709,26 +709,20 @@ void CodeDocument::checkLastLineStatus()
//==============================================================================
void CodeDocument::addListener (CodeDocument::Listener* const listener) throw()
{
listeners.addIfNotAlreadyThere (listener);
listeners.add (listener);
}
void CodeDocument::removeListener (CodeDocument::Listener* const listener) throw()
{
listeners.removeValue (listener);
listeners.remove (listener);
}
void CodeDocument::sendListenerChangeMessage (const int startLine, const int endLine)
{
const Position startPos (this, startLine, 0);
const Position endPos (this, endLine, 0);
Position startPos (this, startLine, 0);
Position endPos (this, endLine, 0);
for (int i = listeners.size(); --i >= 0;)
{
Listener* const l = (Listener*) listeners[i];
if (l != 0)
l->codeDocumentChanged (startPos, endPos);
}
listeners.call (&Listener::codeDocumentChanged, startPos, endPos);
}
//==============================================================================

View file

@ -28,7 +28,7 @@
#include "../../../utilities/juce_UndoManager.h"
#include "../../graphics/colour/juce_Colour.h"
#include "../../../containers/juce_VoidArray.h"
#include "../../../events/juce_ListenerList.h"
#include "../../../io/streams/juce_InputStream.h"
#include "../../../io/streams/juce_OutputStream.h"
class CodeDocumentLine;
@ -392,7 +392,7 @@ private:
UndoManager undoManager;
int currentActionIndex, indexOfSavedState;
int maximumLineLength;
VoidArray listeners;
ListenerList <Listener> listeners;
String newLineChars;
void sendListenerChangeMessage (int startLine, int endLine);

View file

@ -33,8 +33,8 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
class CaretComponent : public Component,
public Timer
class CodeEditorComponent::CaretComponent : public Component,
public Timer
{
public:
CaretComponent()
@ -66,6 +66,10 @@ public:
const Rectangle<int> pos (owner.getCharacterBounds (owner.getCaretPos()));
setBounds (pos.getX(), pos.getY(), 2, pos.getHeight());
}
private:
CaretComponent (const CaretComponent&);
CaretComponent& operator= (const CaretComponent&);
};
//==============================================================================
@ -348,7 +352,7 @@ void CodeEditorComponent::codeDocumentChanged (const CodeDocument::Position& aff
triggerAsyncUpdate();
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
columnToTryToMaintain = -1;
if (affectedTextEnd.getPosition() >= selectionStart.getPosition()
@ -368,7 +372,7 @@ void CodeEditorComponent::resized()
columnsOnScreen = (int) ((getWidth() - scrollbarThickness) / charWidth);
lines.clear();
rebuildLineTokens();
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
verticalScrollBar->setBounds (getWidth() - scrollbarThickness, 0, scrollbarThickness, getHeight() - scrollbarThickness);
horizontalScrollBar->setBounds (gutter, getHeight() - scrollbarThickness, getWidth() - scrollbarThickness - gutter, scrollbarThickness);
@ -511,7 +515,7 @@ void CodeEditorComponent::moveCaretTo (const CodeDocument::Position& newPos, con
deselectAll();
}
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
scrollToKeepCaretOnScreen();
updateScrollBars();
}
@ -542,7 +546,7 @@ void CodeEditorComponent::scrollToLineInternal (int newFirstLineOnScreen)
if (newFirstLineOnScreen != firstLineOnScreen)
{
firstLineOnScreen = newFirstLineOnScreen;
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
updateCachedIterators (firstLineOnScreen);
triggerAsyncUpdate();
@ -556,7 +560,7 @@ void CodeEditorComponent::scrollToColumnInternal (double column)
if (xOffset != newOffset)
{
xOffset = newOffset;
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
repaint();
}
}

View file

@ -260,7 +260,8 @@ private:
CodeDocument::Position caretPos;
CodeDocument::Position selectionStart, selectionEnd;
Component* caret;
class CaretComponent;
CaretComponent* caret;
ScrollBar* verticalScrollBar;
ScrollBar* horizontalScrollBar;