Hide button: inverted right and left clicks. Fixed credits. Lua: arguments of MatchColor and SetColor are now automatically clamped on 0 and 255 when they are too small or too big, instead of wrapping.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1321 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-02-05 01:27:00 +00:00
parent 06a5bafd32
commit 571cf70b58
7 changed files with 31 additions and 18 deletions

View File

@ -66,7 +66,7 @@ byte* Window_background[8];
///Table of tooltip texts for menu buttons
char * Menu_tooltip[NB_BUTTONS]=
{
"Toolbars / Hide toolbars",
"Hide toolbars / Select ",
"Layers manager ",
"Get/Set transparent col.",

View File

@ -52,6 +52,15 @@ static word Brush_backup_height;
static byte Palette_has_changed;
static byte Brush_was_altered;
/// Helper function to clamp a double to 0-255 range
inline byte clamp_byte(double value)
{
if (value<0.0)
return 0;
else if (value>255.0)
return 255;
else return (byte)value;
}
// Wrapper functions to call C from Lua
@ -224,10 +233,10 @@ int L_GetLayerPixel(lua_State* L)
int L_SetColor(lua_State* L)
{
byte c=lua_tonumber(L,1);
byte r=lua_tonumber(L,2);
byte g=lua_tonumber(L,3);
byte b=lua_tonumber(L,4);
byte r=clamp_byte(lua_tonumber(L,2));
byte g=clamp_byte(lua_tonumber(L,3));
byte b=clamp_byte(lua_tonumber(L,4));
Main_palette[c].R=Round_palette_component(r);
Main_palette[c].G=Round_palette_component(g);
Main_palette[c].B=Round_palette_component(b);
@ -258,7 +267,11 @@ int L_GetBackupColor(lua_State* L)
int L_MatchColor(lua_State* L)
{
int c = Best_color_nonexcluded(lua_tonumber(L,1), lua_tonumber(L, 2), lua_tonumber(L, 3));
byte r=clamp_byte(lua_tonumber(L,1));
byte g=clamp_byte(lua_tonumber(L,2));
byte b=clamp_byte(lua_tonumber(L,3));
int c = Best_color_nonexcluded(r,g,b);
lua_pushinteger(L, c);
return 1;
}

View File

@ -412,7 +412,7 @@ static const T_Help_table helptable_credits[] =
HELP_TEXT ("")
//HELP_TEXT ("0----5----0----5----0----5----0----5----0--X")
HELP_TEXT (" anibiqme blumunkee BDCIron ")
HELP_TEXT (" Ced Dawnbringer El Topo ")
HELP_TEXT (" Ced DawnBringer El Topo ")
HELP_TEXT (" falenblood fano Frost ")
HELP_TEXT (" Grimmy Gürkan Sengün Hatch ")
HELP_TEXT (" HoraK-FDF iLKke Iw2evk ")
@ -2479,17 +2479,17 @@ static const T_Help_table helptable_hide[] =
HELP_TITLE("HIDE MENU")
HELP_TEXT ("")
HELP_BOLD ("LEFT CLICK")
HELP_TEXT ("")
HELP_TEXT ("Opens a drop-down menu where you can choose")
HELP_TEXT ("Which toolbars are going to be visible in")
HELP_TEXT ("the menu.")
HELP_TEXT ("")
HELP_BOLD ("RIGHT CLICK")
HELP_LINK ("(Key:%s)",0x200+BUTTON_HIDE)
HELP_LINK ("(Key:%s)",0x100+BUTTON_HIDE)
HELP_TEXT ("")
HELP_TEXT ("Allows you to hide all toolbars, leaving")
HELP_TEXT ("only the status bar.")
HELP_TEXT ("Click again to show them again.")
HELP_TEXT ("")
HELP_BOLD ("RIGHT CLICK")
HELP_TEXT ("")
HELP_TEXT ("Opens a drop-down menu where you can choose")
HELP_TEXT ("Which toolbars are going to be visible in")
HELP_TEXT ("the menu.")
};

View File

@ -1499,7 +1499,7 @@ word Ordering[NB_SHORTCUTS]=
SPECIAL_MOUSE_RIGHT, // Emulate mouse right
SPECIAL_CLICK_LEFT, // Emulate mouse click left
SPECIAL_CLICK_RIGHT, // Emulate mouse click right
0x200+BUTTON_HIDE, // Show / Hide menus
0x100+BUTTON_HIDE, // Show / Hide menus
SPECIAL_SHOW_HIDE_CURSOR, // Show / Hide cursor
SPECIAL_DOT_PAINTBRUSH, // Paintbrush = "."
0x100+BUTTON_PAINTBRUSHES, // Paintbrush choice

4
init.c
View File

@ -1372,8 +1372,8 @@ void Init_buttons(void)
0,0,
16,9,
BUTTON_SHAPE_RECTANGLE,
Button_Toggle_toolbar, Button_Toggle_all_toolbars,
1,0,
Button_Toggle_all_toolbars, Button_Toggle_toolbar,
0,1,
Do_nothing,
FAMILY_TOOLBAR);
}

View File

@ -56,7 +56,7 @@ for y = 0, h - 1, 1 do
g = V + SPEC1 + SPEC2
b = V + SPEC1 + SPEC2
c = matchcolor(math.max(0,math.min(255,r)),math.max(0,math.min(255,g)),math.max(0,math.min(255,b)))
c = matchcolor(r,g,b)
putpicturepixel(x, y, c);