Skins with flat buttons (Issue 352). Sample skins: Clax2, Clax3

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1494 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-05-30 17:59:32 +00:00
parent eec8610817
commit e5edfda5cc
5 changed files with 100 additions and 29 deletions

View File

@ -305,7 +305,7 @@ endif
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o $(OBJDIR)/factory.o $(PLATFORMOBJ) $(OBJDIR)/fileformats.o $(OBJDIR)/miscfileformats.o $(OBJDIR)/libraw2crtc.o $(OBJDIR)/brush_ops.o $(OBJDIR)/buttons_effects.o $(OBJDIR)/layers.o
SKIN_FILES = ../share/grafx2/skins/skin_classic.png ../share/grafx2/skins/skin_modern.png ../share/grafx2/skins/skin_DPaint.png ../share/grafx2/skins/font_Classic.png ../share/grafx2/skins/font_Fun.png ../share/grafx2/skins/font_Fairlight.png ../share/grafx2/skins/font_Melon.png ../share/grafx2/skins/font_DPaint.png ../share/grafx2/skins/skin_scenish.png ../share/grafx2/skins/font_Seen.png ../share/grafx2/skins/skin_Aurora.png
SKIN_FILES = ../share/grafx2/skins/skin_classic.png ../share/grafx2/skins/skin_modern.png ../share/grafx2/skins/skin_DPaint.png ../share/grafx2/skins/font_Classic.png ../share/grafx2/skins/font_Fun.png ../share/grafx2/skins/font_Fairlight.png ../share/grafx2/skins/font_Melon.png ../share/grafx2/skins/font_DPaint.png ../share/grafx2/skins/skin_scenish.png ../share/grafx2/skins/font_Seen.png ../share/grafx2/skins/skin_Aurora.png ../share/grafx2/skins/skin_Clax3.gif ../share/grafx2/skins/skin_Clax2.gif
SCRIPT_FILES1 = ../share/grafx2/scripts/bru_db_Amigaball.lua ../share/grafx2/scripts/bru_db_ColorSphere.lua ../share/grafx2/scripts/bru_db_FindAA.lua ../share/grafx2/scripts/bru_db_Fisheye.lua ../share/grafx2/scripts/bru_db_GrayscaleAvg.lua ../share/grafx2/scripts/bru_db_GrayscaleDesat.lua ../share/grafx2/scripts/bru_db_Halfsmooth.lua ../share/grafx2/scripts/bru_db_Mandelbrot.lua ../share/grafx2/scripts/bru_db_Waves.lua ../share/grafx2/scripts/pal_db_Desaturate.lua ../share/grafx2/scripts/pal_db_ExpandColors.lua ../share/grafx2/scripts/pal_db_FillColorCube.lua ../share/grafx2/scripts/pal_db_InvertedRGB.lua ../share/grafx2/scripts/pal_db_Set3bit.lua ../share/grafx2/scripts/pal_db_Set6bit.lua ../share/grafx2/scripts/pal_db_SetC64Palette.lua ../share/grafx2/scripts/pal_db_ShiftHue.lua ../share/grafx2/scripts/pic_db_Pic2isometric.lua ../share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua ../share/grafx2/scripts/pic_db_SierpinskyCarpet.lua
SCRIPT_FILES2 = ../share/grafx2/scripts/pic_db_SierpinskyTriangle.lua ../share/grafx2/scripts/pic_ni_Colorspace12bit.lua ../share/grafx2/scripts/pic_ni_Colorspace15bit.lua ../share/grafx2/scripts/pic_ni_Colorspace18bit.lua ../share/grafx2/scripts/pic_ni_GlassGridFilter.lua ../share/grafx2/scripts/pic_ni_Grid8.lua ../share/grafx2/scripts/pic_ni_Grid8red.lua ../share/grafx2/scripts/pic_ni_GridIso.lua ../share/grafx2/scripts/pic_ni_PaletteX1.lua ../share/grafx2/scripts/pic_ni_PaletteX8.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua ../share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua

View File

@ -230,6 +230,8 @@ enum PAINTBRUSH_SHAPES
#define BUTTON_RELEASED 0
/// State of a menu button that is being pressed.
#define BUTTON_PRESSED 1
/// State of a button temporarily highligted
#define BUTTON_HIGHLIGHTED 2
/// The different modes of the Shade
enum SHADE_MODES

View File

@ -240,18 +240,45 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
end_x =start_x+Buttons_Pool[btn_number].Width;
end_y =start_y+Buttons_Pool[btn_number].Height;
if (!pressed)
switch (pressed)
{
default:
case BUTTON_RELEASED:
if (Gfx->No_outline)
{
color_top_left=MC_Light;
color_bottom_right=MC_Light;
color_diagonal=MC_Light;
}
else
{
color_top_left=MC_White;
color_bottom_right=MC_Dark;
color_diagonal=MC_Light;
}
break;
case BUTTON_PRESSED:
if (Gfx->No_outline)
{
color_top_left=MC_Dark;
color_bottom_right=MC_White;
color_diagonal=MC_White;
}
else
{
color_top_left=MC_Dark;
color_bottom_right=MC_Black;
color_diagonal=MC_Dark;
}
break;
case BUTTON_HIGHLIGHTED:
color_top_left=MC_White;
color_bottom_right=MC_Dark;
color_diagonal=MC_Light;
break;
}
switch(Buttons_Pool[btn_number].Shape)
{
@ -282,9 +309,9 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
break;
case BUTTON_SHAPE_TRIANGLE_TOP_LEFT:
// On colorie le point haut droit
Pixel_in_menu_and_skin(current_menu, end_x, start_y, color_diagonal);
Pixel_in_menu_and_skin(current_menu, end_x, start_y, color_top_left);
// On colorie le point bas gauche
Pixel_in_menu_and_skin(current_menu, start_x, end_y, color_diagonal);
Pixel_in_menu_and_skin(current_menu, start_x, end_y, color_top_left);
// On colorie le coin haut gauche
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{
@ -292,6 +319,15 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
Pixel_in_menu_and_skin(current_menu, start_x, start_y+x_pos, color_top_left);
}
// On colorie la diagonale
if (Gfx->No_outline)
{
if (! Buttons_Pool[btn_number+1].Pressed)
for (x_pos=0;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{
Pixel_in_menu_and_skin(current_menu, start_x+x_pos+1, end_y-x_pos, color_bottom_right);
}
}
else
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, end_y-x_pos, color_bottom_right);
@ -303,6 +339,15 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
// On colorie le point bas gauche
Pixel_in_menu_and_skin(current_menu, start_x, end_y, color_diagonal);
// On colorie la diagonale
if (Gfx->No_outline)
{
if (! Buttons_Pool[btn_number-1].Pressed)
for (x_pos=1;x_pos<=Buttons_Pool[btn_number].Width;x_pos++)
{
Pixel_in_menu_and_skin(current_menu, start_x+x_pos-1, end_y-x_pos, color_top_left);
}
}
else
for (x_pos=1;x_pos<Buttons_Pool[btn_number].Width;x_pos++)
{
Pixel_in_menu_and_skin(current_menu, start_x+x_pos, end_y-x_pos, color_top_left);
@ -1171,6 +1216,10 @@ void Main_handler(void)
{
// On nettoie les coordonnées
Hide_cursor();
if (Gfx->No_outline && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
Draw_menu_button_frame(prev_button_number, BUTTON_RELEASED);
Block(18*Menu_factor_X,Menu_status_Y,192*Menu_factor_X,Menu_factor_Y<<3,MC_Light);
Update_rect(18*Menu_factor_X,Menu_status_Y,192*Menu_factor_X,Menu_factor_Y<<3);
Display_cursor();
@ -1186,7 +1235,15 @@ void Main_handler(void)
if (button_index!=BUTTON_CHOOSE_COL)
{
Hide_cursor();
if (Gfx->No_outline && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
Draw_menu_button_frame(prev_button_number, BUTTON_RELEASED);
Print_in_menu(Menu_tooltip[button_index],0);
if (Gfx->No_outline && !Buttons_Pool[button_index].Pressed)
Draw_menu_button_frame(button_index, 2 /* BUTTON_HIGHLIGHTED */);
Display_cursor();
}
else
@ -1240,23 +1297,28 @@ void Main_handler(void)
// Le curseur se trouve dans l'image
if ( (!Cursor_in_menu) && (Menu_is_visible) && (Old_MY != Mouse_Y || Old_MX != Mouse_X || Key || Mouse_K)) // On ne met les coordonnées à jour que si l'utilisateur a fait un truc
{
if ( (Current_operation!=OPERATION_COLORPICK) && (Current_operation!=OPERATION_REPLACE) )
{
if(Cursor_in_menu_previous)
{
Hide_cursor();
if (Gfx->No_outline && prev_button_number > -1 && !Buttons_Pool[prev_button_number].Pressed)
Draw_menu_button_frame(prev_button_number, BUTTON_RELEASED);
if ( (Current_operation!=OPERATION_COLORPICK) && (Current_operation!=OPERATION_REPLACE) )
{
Print_in_menu("X: Y: ",0);
}
}
else
{
if(Cursor_in_menu_previous)
{
Print_in_menu("X: Y: ( )",0);
}
}
Display_cursor();
Cursor_in_menu_previous = 0;
}
}
if(Cursor_in_menu)
{

View File

@ -277,6 +277,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
sprintf(Gui_loading_error_message, "Not a 256-color palette");
return 1;
}
// Read the default palette
Get_SDL_Palette(SDLPal, gfx->Default_palette);
@ -357,6 +358,10 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block, Menu_bars[MENUBAR_TOOLS].Skin_width, Menu_bars[MENUBAR_TOOLS].Height,"menu",0))
return 1;
// Check the skin as "No outline" if the first button
// has a grey pixel at top left angle.
gfx->No_outline=gfx->Menu_block[1][0]==gfx->Color[2];
// Preview
cursor_x += Menu_bars[MENUBAR_TOOLS].Skin_width;
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "preview"))

View File

@ -448,6 +448,8 @@ typedef struct
/// Transparent GUI color index in skin file
byte Color_trans;
/// Boolean, true if the buttons have normally no outline
byte No_outline;
} T_Gui_skin;