mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-09 18:44:46 +00:00
Use new Entry suffixes in SpriteSizeCommand
This commit is contained in:
parent
527c85e26e
commit
7c15aee0a5
@ -12,8 +12,8 @@
|
|||||||
<label text="Height:" />
|
<label text="Height:" />
|
||||||
</box>
|
</box>
|
||||||
<box vertical="true" homogeneous="true" expansive="true">
|
<box vertical="true" homogeneous="true" expansive="true">
|
||||||
<entry expansive="true" id="width_px" maxsize="8" magnet="true" tooltip="New width for the sprite (in pixels)" />
|
<entry expansive="true" id="width_px" suffix="px" maxsize="8" magnet="true" tooltip="New width for the sprite (in pixels)" />
|
||||||
<entry expansive="true" id="height_px" maxsize="8" tooltip="New height for the sprite (in pixels)" />
|
<entry expansive="true" id="height_px" suffix="px" maxsize="8" tooltip="New height for the sprite (in pixels)" />
|
||||||
</box>
|
</box>
|
||||||
<check text="Lock Ratio" id="lock_ratio" selected="true" />
|
<check text="Lock Ratio" id="lock_ratio" selected="true" />
|
||||||
</box>
|
</box>
|
||||||
@ -26,8 +26,8 @@
|
|||||||
<label text="Height:" />
|
<label text="Height:" />
|
||||||
</box>
|
</box>
|
||||||
<box vertical="true" homogeneous="true" expansive="true">
|
<box vertical="true" homogeneous="true" expansive="true">
|
||||||
<entry expansive="true" text="100%%" id="width_perc" maxsize="8" magnet="true" tooltip="New width for the sprite Percentage of current width." />
|
<entry expansive="true" text="100" suffix="%" id="width_perc" maxsize="8" magnet="true" tooltip="New width for the sprite Percentage of current width." />
|
||||||
<entry expansive="true" text="100%%" id="height_perc" maxsize="8" tooltip="New height for the sprite Percentage of current height." />
|
<entry expansive="true" text="100" suffix="%" id="height_perc" maxsize="8" tooltip="New height for the sprite Percentage of current height." />
|
||||||
</box>
|
</box>
|
||||||
<box horizontal="true" width="64" />
|
<box horizontal="true" width="64" />
|
||||||
</box>
|
</box>
|
||||||
|
@ -239,8 +239,9 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
|||||||
}
|
}
|
||||||
/* entry */
|
/* entry */
|
||||||
else if (ustrcmp(elem_name, "entry") == 0) {
|
else if (ustrcmp(elem_name, "entry") == 0) {
|
||||||
const char *maxsize = elem->Attribute("maxsize");
|
const char* maxsize = elem->Attribute("maxsize");
|
||||||
const char *text = elem->Attribute("text");
|
const char* text = elem->Attribute("text");
|
||||||
|
const char* suffix = elem->Attribute("suffix");
|
||||||
|
|
||||||
if (maxsize != NULL) {
|
if (maxsize != NULL) {
|
||||||
bool readonly = bool_attr_is_true(elem, "readonly");
|
bool readonly = bool_attr_is_true(elem, "readonly");
|
||||||
@ -250,7 +251,12 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
|||||||
|
|
||||||
if (readonly)
|
if (readonly)
|
||||||
((Entry*)widget)->setReadOnly(true);
|
((Entry*)widget)->setReadOnly(true);
|
||||||
|
|
||||||
|
if (suffix)
|
||||||
|
((Entry*)widget)->setSuffix(suffix);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error("<entry> element found without 'maxsize' attribute");
|
||||||
}
|
}
|
||||||
/* grid */
|
/* grid */
|
||||||
else if (ustrcmp(elem_name, "grid") == 0) {
|
else if (ustrcmp(elem_name, "grid") == 0) {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
#define PERC_FORMAT "%.1f%%"
|
#define PERC_FORMAT "%.1f"
|
||||||
|
|
||||||
class SpriteSizeJob : public Job
|
class SpriteSizeJob : public Job
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user