Remove the number of colors entry field from "New Sprite" dialog

This field is disabled, and the program isn't ready to support less than
256 colors in Indexed mode, so it's better if we remove this field to avoid
confusion.
This commit is contained in:
David Capello 2014-05-06 00:08:43 -03:00
parent 81d30fb24d
commit 5a45d1ec23
2 changed files with 11 additions and 10 deletions

View File

@ -15,11 +15,11 @@
<separator text="Color Mode:" left="true" horizontal="true" />
<box vertical="true" homogeneous="true" childspacing="0">
<box horizontal="true">
<radio id="radio3" text="&amp;Indexed with " group="1" tooltip="Using a palette of 256 colors&#10;(8 bits per pixel)" />
<entry id="colors" maxsize="8" tooltip="Maximum number of colors&#10;(only for Indexed images)&#10;&#10;This field cannot be modified in this beta version." disabled="true" />
<label text="Colors" />
<radio id="radio3" text="&amp;Indexed color" group="1" tooltip="Using a palette of 256 colors&#10;(8 bits per pixel)" />
<!-- <entry id="colors" maxsize="8" tooltip="Maximum number of colors&#10;(only for Indexed images)&#10;&#10;This field cannot be modified in this beta version." disabled="true" /> -->
<!-- <label text="Colors" /> -->
</box>
<radio id="radio1" text="&amp;RGB Color" group="1" tooltip="RGBA color mode&#10;(32 bits per pixel)" />
<radio id="radio1" text="&amp;RGB color" group="1" tooltip="RGBA color mode&#10;(32 bits per pixel)" />
<radio id="radio2" text="&amp;Grayscale" group="1" tooltip="Value and Alpha&#10;(16 bits per pixel)" />
</box>

View File

@ -76,7 +76,7 @@ NewFileCommand::NewFileCommand()
void NewFileCommand::onExecute(Context* context)
{
PixelFormat format;
int w, h, bg, ncolors;
int w, h, bg, ncolors = raster::Palette::MaxColors;
char buf[1024];
app::Color bg_table[] = {
app::Color::fromMask(),
@ -93,7 +93,7 @@ void NewFileCommand::onExecute(Context* context)
Widget* radio1 = app::find_widget<Widget>(window, "radio1");
Widget* radio2 = app::find_widget<Widget>(window, "radio2");
Widget* radio3 = app::find_widget<Widget>(window, "radio3");
Widget* colors = app::find_widget<Widget>(window, "colors");
// Widget* colors = app::find_widget<Widget>(window, "colors");
ListBox* bg_box = app::find_widget<ListBox>(window, "bg_box");
Widget* ok = app::find_widget<Widget>(window, "ok_button");
@ -106,7 +106,7 @@ void NewFileCommand::onExecute(Context* context)
w = get_config_int("NewSprite", "Width", 320);
h = get_config_int("NewSprite", "Height", 240);
bg = get_config_int("NewSprite", "Background", 4); // Default = Background color
ncolors = get_config_int("NewSprite", "Colors", 256);
// ncolors = get_config_int("NewSprite", "Colors", 256);
// If the clipboard contains an image, we can show the size of the
// clipboard as default image size.
@ -118,7 +118,7 @@ void NewFileCommand::onExecute(Context* context)
width->setTextf("%d", MAX(1, w));
height->setTextf("%d", MAX(1, h));
colors->setTextf("%d", MID(2, ncolors, 256));
// colors->setTextf("%d", MID(2, ncolors, 256));
// Select image-type
switch (format) {
@ -143,7 +143,7 @@ void NewFileCommand::onExecute(Context* context)
w = width->getTextInt();
h = height->getTextInt();
ncolors = colors->getTextInt();
// ncolors = colors->getTextInt();
bg = bg_box->getSelectedIndex();
w = MID(1, w, 65535);
@ -190,7 +190,8 @@ void NewFileCommand::onExecute(Context* context)
layerImage->configureAsBackground();
Image* image = sprite->getStock()->getImage(layerImage->getCel(FrameNumber(0))->getImage());
raster::clear_image(image, color_utils::color_for_image(color, format));
raster::clear_image(image,
color_utils::color_for_image(color, format, -1));
}
}