mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Rename Color::toFormalString -> toHumanReadableString and replace bool param with an enum.
This commit is contained in:
parent
041140f528
commit
385f4b66a2
@ -186,12 +186,11 @@ std::string Color::toString() const
|
||||
return result.str();
|
||||
}
|
||||
|
||||
std::string Color::toFormalString(PixelFormat pixelFormat, bool long_format) const
|
||||
std::string Color::toHumanReadableString(PixelFormat pixelFormat, HumanReadableString humanReadable) const
|
||||
{
|
||||
std::stringstream result;
|
||||
|
||||
// Long format
|
||||
if (long_format) {
|
||||
if (humanReadable == LongHumanReadableString) {
|
||||
switch (getType()) {
|
||||
|
||||
case Color::MaskType:
|
||||
@ -256,8 +255,7 @@ std::string Color::toFormalString(PixelFormat pixelFormat, bool long_format) con
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Short format
|
||||
else {
|
||||
else if (humanReadable == ShortHumanReadableString) {
|
||||
switch (getType()) {
|
||||
|
||||
case Color::MaskType:
|
||||
|
@ -36,6 +36,11 @@ public:
|
||||
IndexType,
|
||||
};
|
||||
|
||||
enum HumanReadableString {
|
||||
ShortHumanReadableString,
|
||||
LongHumanReadableString
|
||||
};
|
||||
|
||||
// Default ctor is mask color
|
||||
Color() : m_type(MaskType) { }
|
||||
|
||||
@ -50,7 +55,7 @@ public:
|
||||
static Color fromString(const std::string& str);
|
||||
|
||||
std::string toString() const;
|
||||
std::string toFormalString(PixelFormat format, bool long_format) const;
|
||||
std::string toHumanReadableString(PixelFormat format, HumanReadableString type) const;
|
||||
|
||||
bool operator==(const Color& other) const;
|
||||
bool operator!=(const Color& other) const {
|
||||
|
@ -213,7 +213,8 @@ void ColorButton::onPaint(PaintEvent& ev) // TODO use "ev.getGraphics()"
|
||||
this->hasMouseOver(), false);
|
||||
|
||||
// Draw text
|
||||
std::string str = m_color.toFormalString(m_pixelFormat, false);
|
||||
std::string str = m_color.toHumanReadableString(m_pixelFormat,
|
||||
Color::ShortHumanReadableString);
|
||||
|
||||
setTextQuiet(str.c_str());
|
||||
jwidget_get_texticon_info(this, &box, &text, &icon, 0, 0, 0);
|
||||
|
@ -522,7 +522,8 @@ bool StatusBar::onProcessMessage(Message* msg)
|
||||
x += (32+4)*jguiscale();
|
||||
|
||||
// Draw color description
|
||||
std::string str = m_color.toFormalString(app_get_current_pixel_format(), true);
|
||||
std::string str = m_color.toHumanReadableString(app_get_current_pixel_format(),
|
||||
Color::LongHumanReadableString);
|
||||
if (m_alpha < 255) {
|
||||
char buf[512];
|
||||
usprintf(buf, ", Alpha %d", m_alpha);
|
||||
|
Loading…
x
Reference in New Issue
Block a user