Browse Source

Introjucer: refactored icons.

tags/2021-05-28
jules 13 years ago
parent
commit
1f2b26a30b
9 changed files with 54 additions and 48 deletions
  1. +4
    -4
      extras/Introjucer/Source/Project/jucer_ConfigPage.cpp
  2. +1
    -2
      extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp
  3. +5
    -5
      extras/Introjucer/Source/Project/jucer_Project.cpp
  4. +1
    -1
      extras/Introjucer/Source/Project/jucer_Project.h
  5. +1
    -1
      extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.h
  6. +2
    -4
      extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h
  7. +22
    -0
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.h
  8. +16
    -18
      extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp
  9. +2
    -13
      extras/Introjucer/Source/Utility/jucer_StoredSettings.h

+ 4
- 4
extras/Introjucer/Source/Project/jucer_ConfigPage.cpp View File

@@ -74,7 +74,7 @@ namespace ProjectSettingsTreeClasses
String getRenamingName() const { return getDisplayName(); } String getRenamingName() const { return getDisplayName(); }
String getDisplayName() const { return config->getName(); } String getDisplayName() const { return config->getName(); }
void setName (const String&) {} void setName (const String&) {}
const Drawable* getIcon() const { return getIcons().config; }
Icon getIcon() const { return Icon (getIcons().config, Colours::darkgreen); }
void showDocument() { showSettingsPage (new SettingsComp (config, exporterName)); } void showDocument() { showSettingsPage (new SettingsComp (config, exporterName)); }
void itemOpennessChanged (bool) {} void itemOpennessChanged (bool) {}
@@ -175,7 +175,7 @@ namespace ProjectSettingsTreeClasses
String getDisplayName() const { return exporter->getName(); } String getDisplayName() const { return exporter->getName(); }
void setName (const String&) {} void setName (const String&) {}
bool isMissing() { return false; } bool isMissing() { return false; }
const Drawable* getIcon() const { return getIcons().exporter; }
Icon getIcon() const { return Icon (getIcons().exporter, Colours::darkgrey); }
void showDocument() { showSettingsPage (new SettingsComp (exporter)); } void showDocument() { showSettingsPage (new SettingsComp (exporter)); }
void deleteItem() void deleteItem()
@@ -297,7 +297,7 @@ namespace ProjectSettingsTreeClasses
String getDisplayName() const { return "Modules"; } String getDisplayName() const { return "Modules"; }
void setName (const String&) {} void setName (const String&) {}
bool isMissing() { return false; } bool isMissing() { return false; }
const Drawable* getIcon() const { return getIcons().graph; }
Icon getIcon() const { return Icon (getIcons().graph, Colours::darkred); }
void showDocument() { showSettingsPage (new SettingsComp (project)); } void showDocument() { showSettingsPage (new SettingsComp (project)); }
private: private:
@@ -349,7 +349,7 @@ namespace ProjectSettingsTreeClasses
String getDisplayName() const { return project.getTitle(); } String getDisplayName() const { return project.getTitle(); }
void setName (const String&) {} void setName (const String&) {}
bool isMissing() { return false; } bool isMissing() { return false; }
const Drawable* getIcon() const { return project.getMainGroup().getIcon(); }
Icon getIcon() const { return project.getMainGroup().getIcon(); }
void showDocument() { showSettingsPage (new SettingsComp (project)); } void showDocument() { showSettingsPage (new SettingsComp (project)); }
bool canBeSelected() const { return true; } bool canBeSelected() const { return true; }
bool mightContainSubItems() { return project.getNumExporters() > 0; } bool mightContainSubItems() { return project.getNumExporters() > 0; }


+ 1
- 2
extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp View File

@@ -105,8 +105,7 @@ public:
{ {
int x = getHeight() + 6; int x = getHeight() + 6;
item.getIcon()->drawWithin (g, Rectangle<float> (2.0f, 2.0f, x - 4.0f, getHeight() - 4.0f),
RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f);
item.getIcon().draw (g, Rectangle<float> (2.0f, 2.0f, x - 4.0f, getHeight() - 4.0f));
g.setColour (Colours::black); g.setColour (Colours::black);
g.setFont (getHeight() * 0.6f); g.setFont (getHeight() * 0.6f);


+ 5
- 5
extras/Introjucer/Source/Project/jucer_Project.cpp View File

@@ -771,23 +771,23 @@ bool Project::Item::addRelativeFile (const RelativePath& file, int insertIndex,
return false; return false;
} }
const Drawable* Project::Item::getIcon() const
Icon Project::Item::getIcon() const
{ {
const Icons& icons = getIcons(); const Icons& icons = getIcons();
if (isFile()) if (isFile())
{ {
if (isImageFile()) if (isImageFile())
return icons.imageDoc;
return Icon (icons.imageDoc, Colours::blue);
return icons.document;
return Icon (icons.document, Colours::yellow.darker (1.0f));
} }
else if (isMainGroup()) else if (isMainGroup())
{ {
return icons.juceLogo;
return Icon (icons.juceLogo, Colours::orange);
} }
return icons.folder;
return Icon (icons.folder, Colours::darkgrey);
} }
//============================================================================== //==============================================================================


+ 1
- 1
extras/Introjucer/Source/Project/jucer_Project.h View File

@@ -184,7 +184,7 @@ public:
UndoManager* getUndoManager() const { return project.getUndoManagerFor (state); } UndoManager* getUndoManager() const { return project.getUndoManagerFor (state); }
const Drawable* getIcon() const;
Icon getIcon() const;
Project& project; Project& project;
ValueTree state; ValueTree state;


+ 1
- 1
extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.h View File

@@ -101,7 +101,7 @@ protected:
//============================================================================== //==============================================================================
void treeChildrenChanged (const ValueTree& parentTree); void treeChildrenChanged (const ValueTree& parentTree);
virtual ProjectTreeViewBase* createSubItem (const Project::Item& node) = 0; virtual ProjectTreeViewBase* createSubItem (const Project::Item& node) = 0;
const Drawable* getIcon() const { return item.getIcon(); }
Icon getIcon() const { return item.getIcon(); }
//============================================================================== //==============================================================================
void triggerAsyncRename (const Project::Item& itemToRename); void triggerAsyncRename (const Project::Item& itemToRename);


+ 2
- 4
extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h View File

@@ -54,7 +54,7 @@ public:
virtual String getDisplayName() const = 0; virtual String getDisplayName() const = 0;
virtual void setName (const String& newName) = 0; virtual void setName (const String& newName) = 0;
virtual bool isMissing() = 0; virtual bool isMissing() = 0;
virtual const Drawable* getIcon() const = 0;
virtual Icon getIcon() const = 0;
virtual float getIconSize() const; virtual float getIconSize() const;
virtual void paintContent (Graphics& g, const Rectangle<int>& area); virtual void paintContent (Graphics& g, const Rectangle<int>& area);
virtual int getMillisecsAllowedForDragGesture() { return 120; }; virtual int getMillisecsAllowedForDragGesture() { return 120; };
@@ -186,9 +186,7 @@ public:
void paintIcon (Graphics& g) void paintIcon (Graphics& g)
{ {
const float iconSize = item.getIconSize();
item.getIcon()->drawWithin (g, Rectangle<float> (4.0f, 2.0f, iconSize, getHeight() - 4.0f),
RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f);
item.getIcon().draw (g, Rectangle<float> (4.0f, 2.0f, item.getIconSize(), getHeight() - 4.0f));
} }
void resized() void resized()


+ 22
- 0
extras/Introjucer/Source/Utility/jucer_MiscUtilities.h View File

@@ -57,6 +57,28 @@ void launchAsyncCallOutBox (Component& attachTo, Component* content);
bool cancelAnyModalComponents(); bool cancelAnyModalComponents();
bool reinvokeCommandAfterCancellingModalComps (const ApplicationCommandTarget::InvocationInfo&); bool reinvokeCommandAfterCancellingModalComps (const ApplicationCommandTarget::InvocationInfo&);
//==============================================================================
struct Icon
{
Icon() : path (nullptr) {}
Icon (const Path& p, const Colour& c) : path (&p), colour (c) {}
void draw (Graphics& g, const Rectangle<float>& area) const
{
if (path != nullptr)
{
g.setColour (colour);
const RectanglePlacement placement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize);
g.fillPath (*path, placement.getTransformToFit (path->getBounds(), area));
}
}
const Path* path;
Colour colour;
};
//============================================================================== //==============================================================================
class RolloverHelpComp : public Component, class RolloverHelpComp : public Component,
private Timer private Timer


+ 16
- 18
extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp
File diff suppressed because it is too large
View File


+ 2
- 13
extras/Introjucer/Source/Utility/jucer_StoredSettings.h View File

@@ -88,21 +88,10 @@ public:
void reload (const Colour& backgroundColour); void reload (const Colour& backgroundColour);
const Drawable* folder;
const Drawable* document;
const Drawable* imageDoc;
const Drawable* config;
const Drawable* exporter;
const Drawable* juceLogo;
const Drawable* graph;
const Drawable* jigsaw;
const Drawable* info;
const Drawable* warning;
const Drawable* bug;
Path folder, document, imageDoc, config, exporter,
juceLogo, graph, jigsaw, info, warning, bug;
private: private:
OwnedArray<Drawable> drawables;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Icons); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Icons);
}; };


Loading…
Cancel
Save