Now PreviewFilled configuration field is for tool.

This commit is contained in:
David Capello 2010-03-24 13:57:31 -03:00
parent 271e1df6bd
commit 685f4cf191
5 changed files with 14 additions and 4 deletions

View File

@ -86,6 +86,7 @@ public:
virtual int getOpacity() = 0;
virtual bool getFilled() = 0;
virtual bool getPreviewFilled() = 0;
virtual int getSprayWidth() = 0;
virtual int getSpraySpeed() = 0;

View File

@ -252,6 +252,7 @@ class UIToolSettingsImpl : public IToolSettings
UIPenSettingsImpl m_pen;
int m_opacity;
bool m_filled;
bool m_previewFilled;
int m_spray_width;
int m_spray_speed;
@ -265,6 +266,7 @@ public:
m_opacity = get_config_int(cfg_section.c_str(), "Opacity", 255);
m_opacity = MID(0, m_opacity, 255);
m_filled = false;
m_previewFilled = get_config_bool(cfg_section.c_str(), "PreviewFilled", false);
m_spray_width = 16;
m_spray_speed = 32;
@ -295,17 +297,21 @@ public:
set_config_int(cfg_section.c_str(), "SprayWidth", m_spray_width);
set_config_int(cfg_section.c_str(), "SpraySpeed", m_spray_speed);
}
set_config_bool(cfg_section.c_str(), "PreviewFilled", m_previewFilled);
}
IPenSettings* getPen() { return &m_pen; }
int getOpacity() { return m_opacity; }
bool getFilled() { return m_filled; }
bool getPreviewFilled() { return m_previewFilled; }
int getSprayWidth() { return m_spray_width; }
int getSpraySpeed() { return m_spray_speed; }
void setOpacity(int opacity) { m_opacity = opacity; }
void setFilled(bool state) { m_filled = state; }
bool setPreviewFilled(bool state) { m_previewFilled = state; }
void setSprayWidth(int width) { m_spray_width = width; }
void setSpraySpeed(int speed) { m_spray_speed = speed; }

View File

@ -18,7 +18,6 @@
#include "config.h"
#include "core/cfg.h"
#include "raster/algo.h"
#include "raster/image.h"
#include "tools/tool.h"
@ -107,7 +106,6 @@ void ToolIntertwine::doPointshapeLine(int x1, int y1, int x2, int y2, IToolLoop*
ToolLoopManager::ToolLoopManager(IToolLoop* toolLoop)
: m_toolLoop(toolLoop)
{
m_previewFilled = get_config_bool("Options", "PreviewFilled", false);
}
ToolLoopManager::~ToolLoopManager()
@ -225,7 +223,7 @@ void ToolLoopManager::doLoopStep(bool last_step)
}
// Get the modified area in the sprite with this intertwined set of points
if (!m_toolLoop->getFilled() || (!last_step && !m_previewFilled))
if (!m_toolLoop->getFilled() || (!last_step && !m_toolLoop->getPreviewFilled()))
m_toolLoop->getIntertwine()->joinPoints(m_toolLoop, points_to_interwine);
else
m_toolLoop->getIntertwine()->fillPoints(m_toolLoop, points_to_interwine);

View File

@ -284,6 +284,9 @@ public:
// To fill a shape, the ToolIntertwine::fillPoints function is used.
virtual bool getFilled() = 0;
// Returns true if the preview should be with filled shapes.
virtual bool getPreviewFilled() = 0;
// Spray configuration
virtual int getSprayWidth() = 0;
virtual int getSpraySpeed() = 0;
@ -343,7 +346,6 @@ class ToolLoopManager
IToolLoop* m_toolLoop;
std::vector<Point> m_points;
Point m_oldPoint;
bool m_previewFilled;
public:

View File

@ -1439,6 +1439,7 @@ class ToolLoopImpl : public IToolLoop
int m_old_cel_x;
int m_old_cel_y;
bool m_filled;
bool m_previewFilled;
int m_sprayWidth;
int m_spraySpeed;
TiledMode m_tiled_mode;
@ -1487,6 +1488,7 @@ public:
m_filled = settings->getToolSettings(m_tool)->getFilled();
break;
}
m_previewFilled = settings->getToolSettings(m_tool)->getPreviewFilled();
m_sprayWidth = settings->getToolSettings(m_tool)->getSprayWidth();
m_spraySpeed = settings->getToolSettings(m_tool)->getSpraySpeed();
@ -1696,6 +1698,7 @@ public:
int getOpacity() { return m_opacity; }
TiledMode getTiledMode() { return m_tiled_mode; }
bool getFilled() { return m_filled; }
bool getPreviewFilled() { return m_previewFilled; }
int getSprayWidth() { return m_sprayWidth; }
int getSpraySpeed() { return m_spraySpeed; }
Point getOffset() { return m_offset; }