Moved Transparent Color button to ContextBar

Implemented SelectionSettings class

Transparent Color button for moving pixels moved from status bar to
context bar.  Current Transparent Color stored by new SelectionSettings
class, retrievable from ISettings.

Also implemented Observer classes for existing Settings interfaces for
future use.

StatusBarObserver interface and supporting code removed from StatusBar.
This commit is contained in:
Joel Madigan 2013-11-29 15:59:28 -05:00
parent f531f6d0d0
commit 3ce805f63d
11 changed files with 288 additions and 140 deletions

View File

@ -50,7 +50,11 @@ namespace app {
virtual bool isExecutingMacro() const { return false; }
virtual bool isExecutingScript() const { return false; }
ISettings* getSettings() { return m_settings; }
// TODO Refactor codebase to use ISettings::settings() instead
ISettings* getSettings() {
return settings();
}
ISettings* settings() { return m_settings; }
const Documents& getDocuments() const;

View File

@ -26,12 +26,18 @@
#include "raster/pen_type.h"
namespace app {
class ColorSwatches;
class Document;
class IColorSwatchesStore;
class IDocumentSettings;
class IPenSettings;
class PenSettingsObserver;
class IToolSettings;
class ToolSettingsObserver;
class ISelectionSettings;
class SelectionSettingsObserver;
class GlobalSettingsObserver;
namespace tools {
class Tool;
@ -61,7 +67,13 @@ namespace app {
// Specific configuration for the given tool.
virtual IToolSettings* getToolSettings(tools::Tool* tool) = 0;
// Specific configuration for the current selection
virtual ISelectionSettings* selection() = 0;
virtual IColorSwatchesStore* getColorSwatchesStore() = 0;
virtual void addObserver(GlobalSettingsObserver* observer) = 0;
virtual void removeObserver(GlobalSettingsObserver *observer) = 0;
};
// Tool's settings
@ -86,6 +98,9 @@ namespace app {
virtual void setSprayWidth(int width) = 0;
virtual void setSpraySpeed(int speed) = 0;
virtual void setInkType(InkType inkType) = 0;
virtual void addObserver(ToolSettingsObserver* observer) = 0;
virtual void removeObserver(ToolSettingsObserver *observer) = 0;
};
// Settings for a tool's pen
@ -100,6 +115,22 @@ namespace app {
virtual void setType(PenType type) = 0;
virtual void setSize(int size) = 0;
virtual void setAngle(int angle) = 0;
virtual void addObserver(PenSettingsObserver* observer) = 0;
virtual void removeObserver(PenSettingsObserver *observer) = 0;
};
class ISelectionSettings {
public:
virtual ~ISelectionSettings() {}
// Mask color used during a move operation
virtual app::Color getMoveTransparentColor() = 0;
virtual void setMoveTransparentColor(app::Color color) = 0;
virtual void addObserver(SelectionSettingsObserver* observer) = 0;
virtual void removeObserver(SelectionSettingsObserver* observer) = 0;
};
class IColorSwatchesStore {

View File

@ -0,0 +1,78 @@
/* Aseprite
* Copyright (C) 2001-2013 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef APP_SETTINGS_SETTINGS_OBSERVERS_H_INCLUDED
#define APP_SETTINGS_SETTINGS_OBSERVERS_H_INCLUDED
#include "app/color.h"
#include "app/settings/ink_type.h"
#include "raster/pen_type.h"
namespace app {
namespace tools {
class Tool;
}
class ColorSwatches;
class PenSettingsObserver
{
public:
virtual ~PenSettingsObserver() {}
virtual void onSetPenSize(int newSize) {}
virtual void onSetPenType(raster::PenType newType) {}
virtual void onSetPenAngle(int newAngle) {}
};
class ToolSettingsObserver
{
public:
virtual ~ToolSettingsObserver() {}
virtual void onSetOpacity(int newOpacity) {}
virtual void onSetTolerance(int newTolerance) {}
virtual void onSetFilled(bool filled) {}
virtual void onSetPreviewFilled(bool previewFilled) {}
virtual void onSetSprayWidth(int newSprayWidth) {}
virtual void onSetSpraySpeed(int newSpraySpeed) {}
virtual void onSetInkType(InkType newInkType) {}
};
class SelectionSettingsObserver
{
public:
virtual ~SelectionSettingsObserver() {}
virtual void onSetMoveTransparentColor(app::Color newColor) {}
};
class GlobalSettingsObserver
{
public:
virtual ~GlobalSettingsObserver() {}
virtual void onSetFgColor(app::Color newColor) {}
virtual void onSetBgColor(app::Color newColor) {}
virtual void onSetCurrentTool(tools::Tool* newTool) {}
virtual void onSetColorSwatches(ColorSwatches* swaches) {}
};
} // namespace app
#endif // APP_SETTINGS_SETTINGS_OBSERVERS_H_INCLUDED

View File

@ -30,9 +30,7 @@
#include "app/tools/tool.h"
#include "app/tools/tool_box.h"
#include "app/ui/color_bar.h"
#include "app/ui/main_window.h"
#include "app/ui/workspace.h"
#include "app/ui_context.h"
#include "base/observable.h"
#include "ui/manager.h"
#include <algorithm>
@ -149,6 +147,7 @@ UISettingsImpl::UISettingsImpl()
: m_currentTool(NULL)
, m_globalDocumentSettings(new UIDocumentSettingsImpl)
, m_colorSwatches(NULL)
, m_selectionSettings(new SelectionSettings)
{
m_colorSwatches = new app::ColorSwatches("Default");
for (size_t i=0; i<16; ++i)
@ -230,6 +229,7 @@ void UISettingsImpl::setCurrentTool(tools::Tool* tool)
void UISettingsImpl::setColorSwatches(app::ColorSwatches* colorSwatches)
{
m_colorSwatches = colorSwatches;
notifyObservers<app::ColorSwatches*>(&GlobalSettingsObserver::onSetColorSwatches, colorSwatches);
}
IDocumentSettings* UISettingsImpl::getDocumentSettings(const Document* document)
@ -260,6 +260,14 @@ void UISettingsImpl::removeColorSwatches(app::ColorSwatches* colorSwatches)
m_colorSwatchesStore.erase(it);
}
void UISettingsImpl::addObserver(GlobalSettingsObserver* observer) {
base::Observable<GlobalSettingsObserver>::addObserver(observer);
}
void UISettingsImpl::removeObserver(GlobalSettingsObserver* observer) {
base::Observable<GlobalSettingsObserver>::addObserver(observer);
}
//////////////////////////////////////////////////////////////////////
// IDocumentSettings implementation
@ -408,7 +416,10 @@ void UIDocumentSettingsImpl::setOnionskinOpacityStep(int step)
//////////////////////////////////////////////////////////////////////
// Tools & pen settings
class UIPenSettingsImpl : public IPenSettings {
class UIPenSettingsImpl
: public IPenSettings
, public base::Observable<PenSettingsObserver> {
private:
PenType m_type;
int m_size;
int m_angle;
@ -434,6 +445,7 @@ public:
void setType(PenType type)
{
m_type = MID(PEN_TYPE_FIRST, type, PEN_TYPE_LAST);
notifyObservers<PenType>(&PenSettingsObserver::onSetPenType, m_type);
}
void setSize(int size)
@ -448,6 +460,7 @@ public:
// Trigger PenSizeAfterChange signal
if (m_fireSignals)
App::instance()->PenSizeAfterChange();
notifyObservers<int>(&PenSettingsObserver::onSetPenSize, m_size);
}
void setAngle(int angle)
@ -468,9 +481,18 @@ public:
m_fireSignals = state;
}
void addObserver(PenSettingsObserver* observer) OVERRIDE{
base::Observable<PenSettingsObserver>::addObserver(observer);
}
void removeObserver(PenSettingsObserver* observer) OVERRIDE{
base::Observable<PenSettingsObserver>::addObserver(observer);
}
};
class UIToolSettingsImpl : public IToolSettings {
class UIToolSettingsImpl
: public IToolSettings
, base::Observable<ToolSettingsObserver> {
tools::Tool* m_tool;
UIPenSettingsImpl m_pen;
int m_opacity;
@ -550,6 +572,14 @@ public:
void setSpraySpeed(int speed) OVERRIDE { m_spray_speed = speed; }
void setInkType(InkType inkType) OVERRIDE { m_inkType = inkType; }
void addObserver(ToolSettingsObserver* observer) OVERRIDE {
base::Observable<ToolSettingsObserver>::addObserver(observer);
}
void removeObserver(ToolSettingsObserver* observer) OVERRIDE{
base::Observable<ToolSettingsObserver>::removeObserver(observer);
}
private:
std::string getCfgSection() const {
return std::string("Tool:") + m_tool->getId();
@ -573,4 +603,41 @@ IToolSettings* UISettingsImpl::getToolSettings(tools::Tool* tool)
}
}
//////////////////////////////////////////////////////////////////////
// Selection Settings
SelectionSettings::SelectionSettings() : m_moveTransparentColor(app::Color::fromMask())
{
}
SelectionSettings::~SelectionSettings()
{
}
ISelectionSettings* UISettingsImpl::selection()
{
return m_selectionSettings;
}
void SelectionSettings::setMoveTransparentColor(app::Color color)
{
m_moveTransparentColor = color;
notifyObservers(&SelectionSettingsObserver::onSetMoveTransparentColor, color);
}
app::Color SelectionSettings::getMoveTransparentColor()
{
return m_moveTransparentColor;
}
void SelectionSettings::addObserver(SelectionSettingsObserver* observer)
{
base::Observable<SelectionSettingsObserver>::addObserver(observer);
}
void SelectionSettings::removeObserver(SelectionSettingsObserver* observer)
{
base::Observable<SelectionSettingsObserver>::removeObserver(observer);
}
} // namespace app

View File

@ -23,13 +23,17 @@
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "app/settings/settings.h"
#include "app/settings/settings_observers.h"
#include "base/compiler_specific.h"
#include "base/observable.h"
namespace app {
class UISettingsImpl : public ISettings,
public IColorSwatchesStore {
class UISettingsImpl
: public ISettings
, public IColorSwatchesStore
, base::Observable<GlobalSettingsObserver> {
public:
UISettingsImpl();
~UISettingsImpl();
@ -40,25 +44,51 @@ namespace app {
app::Color getBgColor() OVERRIDE;
tools::Tool* getCurrentTool() OVERRIDE;
app::ColorSwatches* getColorSwatches() OVERRIDE;
void setFgColor(const app::Color& color) OVERRIDE;
void setBgColor(const app::Color& color) OVERRIDE;
void setCurrentTool(tools::Tool* tool) OVERRIDE;
void setColorSwatches(app::ColorSwatches* colorSwatches) OVERRIDE;
IDocumentSettings* getDocumentSettings(const Document* document) OVERRIDE;
IToolSettings* getToolSettings(tools::Tool* tool) OVERRIDE;
IColorSwatchesStore* getColorSwatchesStore() OVERRIDE;
ISelectionSettings* selection() OVERRIDE;
// IColorSwatchesStore implementation
void addColorSwatches(app::ColorSwatches* colorSwatches) OVERRIDE;
void removeColorSwatches(app::ColorSwatches* colorSwatches) OVERRIDE;
void addObserver(GlobalSettingsObserver* observer) OVERRIDE;
void removeObserver(GlobalSettingsObserver* observer) OVERRIDE;
private:
tools::Tool* m_currentTool;
IDocumentSettings* m_globalDocumentSettings;
std::map<std::string, IToolSettings*> m_toolSettings;
app::ColorSwatches* m_colorSwatches;
std::vector<app::ColorSwatches*> m_colorSwatchesStore;
ISelectionSettings* m_selectionSettings;
};
class SelectionSettings
: public ISelectionSettings
, public base::Observable<SelectionSettingsObserver> {
public:
SelectionSettings();
~SelectionSettings();
void setMoveTransparentColor(app::Color color);
app::Color getMoveTransparentColor();
void addObserver(SelectionSettingsObserver* observer);
void removeObserver(SelectionSettingsObserver* observer);
private:
app::Color m_moveTransparentColor;
};
} // namespace app

View File

@ -26,12 +26,15 @@
#include "app/modules/gui.h"
#include "app/settings/ink_type.h"
#include "app/settings/settings.h"
#include "app/settings/settings_observers.h"
#include "app/tools/ink.h"
#include "app/tools/point_shape.h"
#include "app/tools/tool.h"
#include "app/ui/button_set.h"
#include "app/ui/color_button.h"
#include "app/ui/skin/skin_theme.h"
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/unique_ptr.h"
#include "raster/conversion_alleg.h"
#include "raster/image.h"
@ -336,6 +339,20 @@ protected:
}
};
class ContextBar::TransparentColorField : public ColorButton
{
public:
TransparentColorField() : ColorButton(app::Color::fromMask(), IMAGE_RGB) {
Change.connect(Bind<void>(&TransparentColorField::onChange, this));
}
protected:
void onChange() {
UIContext::instance()->settings()->selection()->setMoveTransparentColor(getColor());
}
};
ContextBar::ContextBar()
: Box(JI_HORIZONTAL)
{
@ -366,6 +383,10 @@ ContextBar::ContextBar()
m_sprayBox->addChild(m_sprayWidth = new SprayWidthField());
m_sprayBox->addChild(m_spraySpeed = new SpraySpeedField());
addChild(m_selectionOptionsBox = new HBox());
m_selectionOptionsBox->addChild(new Label("Transparent Color:"));
m_selectionOptionsBox->addChild(m_transparentColor = new TransparentColorField);
TooltipManager* tooltipManager = new TooltipManager();
addChild(tooltipManager);
@ -375,6 +396,7 @@ ContextBar::ContextBar()
tooltipManager->addTooltipFor(m_inkOpacity, "Opacity (Alpha value in RGBA)", JI_CENTER | JI_BOTTOM);
tooltipManager->addTooltipFor(m_sprayWidth, "Spray Width", JI_CENTER | JI_BOTTOM);
tooltipManager->addTooltipFor(m_spraySpeed, "Spray Speed", JI_CENTER | JI_BOTTOM);
tooltipManager->addTooltipFor(m_transparentColor, "Transparent Color", JI_BOTTOM | JI_BOTTOM);
App::instance()->PenSizeAfterChange.connect(&ContextBar::onPenSizeChange, this);
App::instance()->PenAngleAfterChange.connect(&ContextBar::onPenAngleChange, this);
@ -451,6 +473,9 @@ void ContextBar::onCurrentToolChange()
bool hasSprayOptions = (currentTool->getPointShape(0)->isSpray() ||
currentTool->getPointShape(1)->isSpray());
bool hasSelectOptions = (currentTool->getInk(0)->isSelection() ||
currentTool->getInk(1)->isSelection());
// Show/Hide fields
m_brushLabel->setVisible(hasOpacity);
m_brushType->setVisible(hasOpacity);
@ -463,6 +488,7 @@ void ContextBar::onCurrentToolChange()
m_toleranceLabel->setVisible(hasTolerance);
m_tolerance->setVisible(hasTolerance);
m_sprayBox->setVisible(hasSprayOptions);
m_selectionOptionsBox->setVisible(hasSelectOptions);
layout();
}

View File

@ -50,6 +50,7 @@ namespace app {
class InkOpacityField;
class SprayWidthField;
class SpraySpeedField;
class TransparentColorField;
ui::Label* m_brushLabel;
BrushTypeField* m_brushType;
@ -64,6 +65,8 @@ namespace app {
ui::Box* m_sprayBox;
SprayWidthField* m_sprayWidth;
SpraySpeedField* m_spraySpeed;
ui::Box* m_selectionOptionsBox;
TransparentColorField* m_transparentColor;
};
} // namespace app

View File

@ -28,6 +28,7 @@
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/modules/gui.h"
#include "app/settings/settings.h"
#include "app/tools/ink.h"
#include "app/tools/tool.h"
#include "app/ui/editor/editor.h"
@ -63,6 +64,8 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo
// pixels movement/transformation preview.
//ASSERT(!editor->getCurrentEditorTool()->getInk(0)->isSelection());
UIContext* context = UIContext::instance();
EditorCustomizationDelegate* customization = editor->getCustomizationDelegate();
m_pixelsMovement = pixelsMovement;
@ -75,19 +78,15 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo
}
// Setup mask color
setTransparentColor(StatusBar::instance()->getTransparentColor());
setTransparentColor(context->settings()->selection()->getMoveTransparentColor());
// Add this class as:
// - observer of the UI context: so we know if the user wants to
// execute other command, so we can drop pixels.
// - observer of the status bar to know if the user has changed the
// transparent color.
UIContext::instance()->addObserver(this);
StatusBar::instance()->addObserver(this);
// Show controls to modify the "pixels movement" options (e.g. the
// transparent color).
StatusBar::instance()->showMovePixelsOptions();
// - observer of SelectionSettings to be informed of changes to Transparent Color
// changes from Context Bar.
context->addObserver(this);
context->settings()->selection()->addObserver(this);
// Add the current editor as filter for key message of the manager
// so we can catch the Enter key, and avoid to execute the
@ -99,7 +98,7 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo
MovingPixelsState::~MovingPixelsState()
{
UIContext::instance()->removeObserver(this);
StatusBar::instance()->removeObserver(this);
UIContext::instance()->settings()->selection()->removeObserver(this);
delete m_pixelsMovement;
@ -128,7 +127,6 @@ EditorState::BeforeChangeAction MovingPixelsState::onBeforeChangeState(Editor* e
editor->releaseMouse();
StatusBar::instance()->hideMovePixelsOptions();
return DiscardState;
}
else {
@ -375,7 +373,7 @@ bool MovingPixelsState::onUpdateStatusBar(Editor* editor)
gfx::Size imageSize = m_pixelsMovement->getInitialImageSize();
StatusBar::instance()->setStatusText
(100, "Pos %d %d, Size %d %d, Orig: %3d %3d (%.02f%% %.02f%%), Angle %.1f",
(100, "Moving Pixels - Pos %d %d, Size %d %d, Orig: %3d %3d (%.02f%% %.02f%%), Angle %.1f",
transform.bounds().x, transform.bounds().y,
transform.bounds().w, transform.bounds().h,
imageSize.w, imageSize.h,
@ -393,14 +391,9 @@ void MovingPixelsState::onCommandBeforeExecution(Context* context)
dropPixels(m_currentEditor);
}
void MovingPixelsState::dispose()
{
// Never called as MovingPixelsState is removed automatically as
// StatusBar's observer.
}
void MovingPixelsState::onChangeTransparentColor(const app::Color& color)
void MovingPixelsState::onSetMoveTransparentColor(app::Color newColor)
{
app::Color color = UIContext::instance()->settings()->selection()->getMoveTransparentColor();
setTransparentColor(color);
}

View File

@ -20,8 +20,10 @@
#define APP_UI_EDITOR_MOVING_PIXELS_STATE_H_INCLUDED
#include "app/context_observer.h"
#include "app/settings/settings_observers.h"
#include "app/ui/editor/handle_type.h"
#include "app/ui/editor/standby_state.h"
#include "app/ui/context_bar.h"
#include "app/ui/status_bar.h"
#include "base/compiler_specific.h"
@ -33,7 +35,10 @@ namespace app {
class Editor;
class PixelsMovement;
class MovingPixelsState : public StandbyState, StatusBarObserver, ContextObserver {
class MovingPixelsState
: public StandbyState
, ContextObserver
, SelectionSettingsObserver {
public:
MovingPixelsState(Editor* editor, ui::MouseMessage* msg, PixelsMovement* pixelsMovement, HandleType handle);
virtual ~MovingPixelsState();
@ -52,13 +57,12 @@ namespace app {
// ContextObserver
virtual void onCommandBeforeExecution(Context* context) OVERRIDE;
// SettingsObserver
virtual void onSetMoveTransparentColor(app::Color newColor) OVERRIDE;
virtual gfx::Transformation getTransformation(Editor* editor) OVERRIDE;
protected:
// StatusBarObserver interface
virtual void dispose() OVERRIDE;
virtual void onChangeTransparentColor(const app::Color& color) OVERRIDE;
private:
void setTransparentColor(const app::Color& color);

View File

@ -240,22 +240,6 @@ StatusBar::StatusBar()
m_notificationsBox = box1;
}
// Construct move-pixels box
{
Box* filler = new Box(JI_HORIZONTAL);
filler->setExpansive(true);
m_movePixelsBox = new Box(JI_HORIZONTAL);
m_transparentLabel = new Label("Transparent Color:");
m_transparentColor = new ColorButton(app::Color::fromMask(), IMAGE_RGB);
m_movePixelsBox->addChild(filler);
m_movePixelsBox->addChild(m_transparentLabel);
m_movePixelsBox->addChild(m_transparentColor);
m_transparentColor->Change.connect(Bind<void>(&StatusBar::onTransparentColorChange, this));
}
addChild(m_notificationsBox);
App::instance()->CurrentToolChange.connect(&StatusBar::onCurrentToolChange, this);
@ -267,21 +251,10 @@ StatusBar::~StatusBar()
delete *it;
delete m_tipwindow; // widget
delete m_movePixelsBox;
delete m_commandsBox;
delete m_notificationsBox;
}
void StatusBar::addObserver(StatusBarObserver* observer)
{
m_observers.addObserver(observer);
}
void StatusBar::removeObserver(StatusBarObserver* observer)
{
m_observers.removeObserver(observer);
}
void StatusBar::onCurrentToolChange()
{
if (isVisible()) {
@ -293,12 +266,6 @@ void StatusBar::onCurrentToolChange()
}
}
void StatusBar::onTransparentColorChange()
{
m_observers.notifyObservers<const app::Color&>(&StatusBarObserver::onChangeTransparentColor,
getTransparentColor());
}
void StatusBar::clearText()
{
setStatusText(1, "");
@ -397,27 +364,6 @@ void StatusBar::showTool(int msecs, tools::Tool* tool)
}
}
void StatusBar::showMovePixelsOptions()
{
if (!hasChild(m_movePixelsBox)) {
addChild(m_movePixelsBox);
invalidate();
}
}
void StatusBar::hideMovePixelsOptions()
{
if (hasChild(m_movePixelsBox)) {
removeChild(m_movePixelsBox);
invalidate();
}
}
app::Color StatusBar::getTransparentColor()
{
return m_transparentColor->getColor();
}
void StatusBar::showNotification(const char* text, const char* link)
{
m_linkLabel->setText(text);
@ -575,8 +521,7 @@ bool StatusBar::onProcessMessage(Message* msg)
x -= width+4;
}
}
// Show layers only when we are not moving pixels
else if (!hasChild(m_movePixelsBox)) {
else {
// Available width for layers buttons
int width = rc.w/4;
@ -654,29 +599,28 @@ bool StatusBar::onProcessMessage(Message* msg)
const Document* document = UIContext::instance()->getActiveDocument();
bool state = (document != NULL);
if (!hasChild(m_movePixelsBox)) {
if (state && !hasChild(m_commandsBox)) {
updateCurrentFrame();
if (state && !hasChild(m_commandsBox)) {
updateCurrentFrame();
m_b_first->setEnabled(state);
m_b_prev->setEnabled(state);
m_b_play->setEnabled(state);
m_b_next->setEnabled(state);
m_b_last->setEnabled(state);
m_b_first->setEnabled(state);
m_b_prev->setEnabled(state);
m_b_play->setEnabled(state);
m_b_next->setEnabled(state);
m_b_last->setEnabled(state);
updateFromLayer();
updateFromLayer();
if (hasChild(m_notificationsBox))
removeChild(m_notificationsBox);
if (hasChild(m_notificationsBox))
removeChild(m_notificationsBox);
addChild(m_commandsBox);
invalidate();
}
else if (!state && !hasChild(m_notificationsBox)) {
addChild(m_notificationsBox);
invalidate();
}
addChild(m_commandsBox);
invalidate();
}
else if (!state && !hasChild(m_notificationsBox)) {
addChild(m_notificationsBox);
invalidate();
}
break;
}
@ -798,12 +742,6 @@ void StatusBar::onResize(ResizeEvent& ev)
rc = ev.getBounds();
rc.w -= rc.w/4 + 4*jguiscale();
m_commandsBox->setBounds(rc);
rc = ev.getBounds();
Size reqSize = m_movePixelsBox->getPreferredSize();
rc.x = rc.x2() - reqSize.w;
rc.w = reqSize.w;
m_movePixelsBox->setBounds(rc);
}
void StatusBar::onPreferredSize(PreferredSizeEvent& ev)

View File

@ -39,7 +39,6 @@ namespace ui {
}
namespace app {
class ColorButton;
class StatusBar;
namespace tools {
@ -61,15 +60,6 @@ namespace app {
double m_pos;
};
class StatusBarObserver {
public:
virtual ~StatusBarObserver() { }
virtual void dispose() = 0;
virtual void onChangeTransparentColor(const app::Color& color) = 0;
};
typedef base::Observers<StatusBarObserver> StatusBarObservers;
class StatusBar : public ui::Widget {
static StatusBar* m_instance;
public:
@ -78,9 +68,6 @@ namespace app {
StatusBar();
~StatusBar();
void addObserver(StatusBarObserver* observer);
void removeObserver(StatusBarObserver* observer);
void clearText();
bool setStatusText(int msecs, const char *format, ...);
@ -88,11 +75,6 @@ namespace app {
void showColor(int msecs, const char* text, const Color& color, int alpha);
void showTool(int msecs, tools::Tool* tool);
void showMovePixelsOptions();
void hideMovePixelsOptions();
Color getTransparentColor();
// Methods to add and remove progress bars
Progress* addProgress();
void removeProgress(Progress* progress);
@ -107,7 +89,6 @@ namespace app {
private:
void onCurrentToolChange();
void onTransparentColorChange();
void updateFromLayer();
void updateCurrentFrame();
void newFrame();
@ -144,18 +125,11 @@ namespace app {
ui::Widget* m_notificationsBox;
ui::LinkLabel* m_linkLabel;
// Box with move-pixels commands (when the user drag-and-drop selected pixels using the editor)
ui::Box* m_movePixelsBox;
ui::Widget* m_transparentLabel;
ColorButton* m_transparentColor;
// Tip window
class CustomizedTipWindow;
CustomizedTipWindow* m_tipwindow;
raster::LayerIndex m_hot_layer;
StatusBarObservers m_observers;
};
} // namespace app