Browse Source

Minor introjucer fixes.

tags/2021-05-28
jules 12 years ago
parent
commit
9f37bf2e58
5 changed files with 35 additions and 44 deletions
  1. +16
    -0
      extras/Introjucer/Source/Application/jucer_Application.h
  2. +7
    -8
      extras/Introjucer/Source/ComponentEditor/ui/jucer_EditingPanelBase.cpp
  3. +1
    -2
      extras/Introjucer/Source/ComponentEditor/ui/jucer_PaintRoutineEditor.cpp
  4. +9
    -23
      extras/Introjucer/Source/ComponentEditor/ui/jucer_SnapGridPainter.h
  5. +2
    -11
      extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp

+ 16
- 0
extras/Introjucer/Source/Application/jucer_Application.h View File

@@ -520,8 +520,24 @@ public:
virtual void doExtraInitialisation() {}
virtual void addExtraConfigItems (Project&, TreeViewItem&) {}
virtual String getLogFolderName() const { return "com.juce.introjucer"; }
virtual PropertiesFile::Options getPropertyFileOptionsFor (const String& filename)
{
PropertiesFile::Options options;
options.applicationName = filename;
options.filenameSuffix = "settings";
options.osxLibrarySubFolder = "Application Support";
#if JUCE_LINUX
options.folderName = ".introjucer";
#else
options.folderName = "Introjucer";
#endif
return options;
}
virtual Component* createProjectContentComponent() const
{
return new ProjectContentComponent();


+ 7
- 8
extras/Introjucer/Source/ComponentEditor/ui/jucer_EditingPanelBase.cpp View File

@@ -49,8 +49,7 @@ public:
void setScaleFactor (double newScale)
{
scaleFactor = newScale;
content->setTransform (AffineTransform::scale ((float) scaleFactor,
(float) scaleFactor));
content->setTransform (AffineTransform::scale ((float) scaleFactor));
}
private:
@@ -70,14 +69,14 @@ public:
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
{
if (e.mods.isCtrlDown() || e.mods.isAltDown() || e.mods.isCommandDown())
{
const double factor = 1.0f / (1.0f - wheel.deltaY);
panel->setZoom (panel->getZoom() * factor, e.x, e.y);
}
mouseMagnify (e, 1.0f / (1.0f - wheel.deltaY));
else
{
Viewport::mouseWheelMove (e, wheel);
}
}
void mouseMagnify (const MouseEvent& e, float factor)
{
panel->setZoom (panel->getZoom() * factor, e.x, e.y);
}
void dragKeyHeldDown (const bool isKeyDown)


+ 1
- 2
extras/Introjucer/Source/ComponentEditor/ui/jucer_PaintRoutineEditor.cpp View File

@@ -181,7 +181,6 @@ void PaintRoutineEditor::refreshAllElements()
if (currentBackgroundColour != graphics.getBackgroundColour())
{
currentBackgroundColour = graphics.getBackgroundColour();
grid.updateColour();
repaint();
}
@@ -241,7 +240,7 @@ void PaintRoutineEditor::findLassoItemsInArea (Array <PaintElement*>& results, c
{
for (int i = 0; i < getNumChildComponents(); ++i)
if (PaintElement* const e = dynamic_cast <PaintElement*> (getChildComponent (i)))
if (e->getBounds().expanded (-e->borderThickness, -e->borderThickness).intersects (lasso))
if (e->getBounds().expanded (-e->borderThickness).intersects (lasso))
results.add (e);
}


+ 9
- 23
extras/Introjucer/Source/ComponentEditor/ui/jucer_SnapGridPainter.h View File

@@ -46,50 +46,36 @@ public:
{
snapGridSize = design.getSnappingGridSize();
snapShown = design.isSnapShown() && design.isSnapActive (false);
backgroundFill = Image();
return true;
}
return false;
}
void updateColour()
{
backgroundFill = Image();
}
void draw (Graphics& g, PaintRoutine* backgroundGraphics)
{
if (backgroundFill.isNull() && snapShown)
if (snapShown && snapGridSize > 2)
{
backgroundFill = Image (Image::ARGB, snapGridSize, snapGridSize, true);
Graphics g2 (backgroundFill);
Colour col (Colours::black);
if (backgroundGraphics != nullptr)
col = backgroundGraphics->getBackgroundColour().contrasting();
if (snapGridSize > 2)
{
g2.setColour (col.withAlpha (0.1f));
g2.drawRect (0, 0, snapGridSize + 1, snapGridSize + 1);
}
}
g.setColour (col.withAlpha (0.1f));
if (backgroundFill.isValid())
{
g.setTiledImageFill (backgroundFill, 0, 0, 1.0f);
g.fillAll();
const Rectangle<int> clip (g.getClipBounds());
for (int y = clip.getY() - (clip.getY() % snapGridSize); y < clip.getBottom(); y += snapGridSize)
g.drawHorizontalLine (y, 0.0f, (float) clip.getRight());
for (int x = clip.getX() - (clip.getX() % snapGridSize); x < clip.getRight(); x += snapGridSize)
g.drawVerticalLine (x, 0.0f, (float) clip.getBottom());
}
}
private:
int snapGridSize;
bool snapShown;
Image backgroundFill;
};


+ 2
- 11
extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp View File

@@ -57,17 +57,8 @@ PropertiesFile& StoredSettings::getGlobalProperties()
static PropertiesFile* createPropsFile (const String& filename)
{
PropertiesFile::Options options;
options.applicationName = filename;
options.filenameSuffix = "settings";
options.osxLibrarySubFolder = "Application Support";
#if JUCE_LINUX
options.folderName = ".introjucer";
#else
options.folderName = "Introjucer";
#endif
return new PropertiesFile (options);
return new PropertiesFile (IntrojucerApp::getApp()
.getPropertyFileOptionsFor (filename));
}
PropertiesFile& StoredSettings::getProjectProperties (const String& projectUID)


Loading…
Cancel
Save