Fixed the display of brush in the top left button
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1496 416bcca6-2ee7-4201-b75f-2eb2f807beb1
| 
		 Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB  | 
| 
		 Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB  | 
| 
		 Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB  | 
| 
		 Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB  | 
| 
		 Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB  | 
@ -305,7 +305,7 @@ endif
 | 
				
			|||||||
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
 | 
					# 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
 | 
					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 ../share/grafx2/skins/skin_Clax3.gif ../share/grafx2/skins/skin_Clax2.gif
 | 
					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 ../share/grafx2/skins/skin_Clax4.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_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
 | 
					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
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										36
									
								
								src/engine.c
									
									
									
									
									
								
							
							
						
						@ -287,6 +287,42 @@ void Draw_menu_button(byte btn_number,byte pressed)
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  // Special: Show specific shape
 | 
				
			||||||
 | 
					  if (btn_number==BUTTON_PAINTBRUSHES
 | 
				
			||||||
 | 
					    && Paintbrush_shape!=PAINTBRUSH_SHAPE_COLOR_BRUSH
 | 
				
			||||||
 | 
					    && Paintbrush_shape!=PAINTBRUSH_SHAPE_MONO_BRUSH)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    short x_pos,y_pos;
 | 
				
			||||||
 | 
					    short start_x;
 | 
				
			||||||
 | 
					    short menu_x_pos,menu_y_pos;
 | 
				
			||||||
 | 
					    short menu_start_x;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    // Print paintbrush shape
 | 
				
			||||||
 | 
					    menu_start_x=8-Paintbrush_offset_X;
 | 
				
			||||||
 | 
					    if (menu_start_x<1)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      start_x=Paintbrush_offset_X-7;
 | 
				
			||||||
 | 
					      menu_start_x=1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      start_x=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    menu_y_pos=9-Paintbrush_offset_Y;
 | 
				
			||||||
 | 
					    if (menu_y_pos<2)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      y_pos=Paintbrush_offset_Y-7;
 | 
				
			||||||
 | 
					      menu_y_pos=2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      y_pos=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (;((y_pos<Paintbrush_height) && (menu_y_pos<16));menu_y_pos++,y_pos++)
 | 
				
			||||||
 | 
					      for (menu_x_pos=menu_start_x,x_pos=start_x;((x_pos<Paintbrush_width) && (menu_x_pos<15));menu_x_pos++,x_pos++)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        if (Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos])
 | 
				
			||||||
 | 
					        Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos, menu_y_pos, MC_Black);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
 | 
					  if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
 | 
				
			||||||
    Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset),
 | 
					    Update_rect(Menu_factor_X*(Buttons_Pool[btn_number].X_offset),
 | 
				
			||||||
 | 
				
			|||||||
@ -724,9 +724,9 @@ int Init_program(int argc,char * argv[])
 | 
				
			|||||||
  Compute_paintbrush_coordinates();
 | 
					  Compute_paintbrush_coordinates();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // On affiche le menu:
 | 
					  // On affiche le menu:
 | 
				
			||||||
  Display_menu();
 | 
					 | 
				
			||||||
  Display_paintbrush_in_menu();
 | 
					  Display_paintbrush_in_menu();
 | 
				
			||||||
  Display_sprite_in_menu(BUTTON_PAL_LEFT,Config.Palette_vertical?MENU_SPRITE_VERTICAL_PALETTE_SCROLL:-1);
 | 
					  Display_sprite_in_menu(BUTTON_PAL_LEFT,Config.Palette_vertical?MENU_SPRITE_VERTICAL_PALETTE_SCROLL:-1);
 | 
				
			||||||
 | 
					  Display_menu();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // On affiche le curseur pour débutter correctement l'état du programme:
 | 
					  // On affiche le curseur pour débutter correctement l'état du programme:
 | 
				
			||||||
  Display_cursor();
 | 
					  Display_cursor();
 | 
				
			||||||
 | 
				
			|||||||
@ -1195,55 +1195,19 @@ void Display_sprite_in_menu(int btn_number,char sprite_number)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Display_paintbrush_in_menu(void)
 | 
					void Display_paintbrush_in_menu(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  short x_pos,y_pos;
 | 
					  switch(Paintbrush_shape)
 | 
				
			||||||
  short start_x;
 | 
					 | 
				
			||||||
  short menu_x_pos,menu_y_pos;
 | 
					 | 
				
			||||||
  short menu_start_x;
 | 
					 | 
				
			||||||
  byte color;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  switch (Paintbrush_shape)
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    case PAINTBRUSH_SHAPE_COLOR_BRUSH    : // Brush en couleur
 | 
					    case PAINTBRUSH_SHAPE_COLOR_BRUSH:
 | 
				
			||||||
      Display_sprite_in_menu(BUTTON_PAINTBRUSHES,MENU_SPRITE_COLOR_BRUSH);
 | 
					      Display_sprite_in_menu(BUTTON_PAINTBRUSHES, MENU_SPRITE_COLOR_BRUSH);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case PAINTBRUSH_SHAPE_MONO_BRUSH : // Brush monochrome
 | 
					    case PAINTBRUSH_SHAPE_MONO_BRUSH:
 | 
				
			||||||
      Display_sprite_in_menu(BUTTON_PAINTBRUSHES,MENU_SPRITE_MONO_BRUSH);
 | 
					      Display_sprite_in_menu(BUTTON_PAINTBRUSHES, MENU_SPRITE_MONO_BRUSH);
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					      Display_sprite_in_menu(BUTTON_PAINTBRUSHES, -1);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    default : // Pinceau
 | 
					 | 
				
			||||||
      // On efface le pinceau précédent
 | 
					 | 
				
			||||||
      for (menu_y_pos=2,y_pos=0;y_pos<MENU_SPRITE_HEIGHT;menu_y_pos++,y_pos++)
 | 
					 | 
				
			||||||
        for (menu_x_pos=1,x_pos=0;x_pos<MENU_SPRITE_WIDTH;menu_x_pos++,x_pos++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos, menu_y_pos, MC_Light);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      // On affiche le nouveau
 | 
					 | 
				
			||||||
      menu_start_x=8-Paintbrush_offset_X;
 | 
					 | 
				
			||||||
      if (menu_start_x<1)
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        start_x=Paintbrush_offset_X-7;
 | 
					 | 
				
			||||||
        menu_start_x=1;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        start_x=0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      menu_y_pos=9-Paintbrush_offset_Y;
 | 
					 | 
				
			||||||
      if (menu_y_pos<2)
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        y_pos=Paintbrush_offset_Y-7;
 | 
					 | 
				
			||||||
        menu_y_pos=2;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        y_pos=0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      for (;((y_pos<Paintbrush_height) && (menu_y_pos<16));menu_y_pos++,y_pos++)
 | 
					 | 
				
			||||||
        for (menu_x_pos=menu_start_x,x_pos=start_x;((x_pos<Paintbrush_width) && (menu_x_pos<15));menu_x_pos++,x_pos++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          color=(Paintbrush_sprite[(y_pos*MAX_PAINTBRUSH_SIZE)+x_pos])?MC_Black:MC_Light;
 | 
					 | 
				
			||||||
          Pixel_in_menu_and_skin(MENUBAR_TOOLS, menu_x_pos, menu_y_pos, color);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (Menu_is_visible && Menu_bars[MENUBAR_TOOLS].Visible)
 | 
					  Draw_menu_button(BUTTON_PAINTBRUSHES,BUTTON_RELEASED);
 | 
				
			||||||
    Update_rect(0,Menu_Y + Menu_bars[MENUBAR_TOOLS].Top*Menu_factor_Y,MENU_SPRITE_WIDTH*Menu_factor_X+3,MENU_SPRITE_HEIGHT*Menu_factor_Y+3);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // -- Dessiner un pinceau prédéfini dans la fenêtre --
 | 
					  // -- Dessiner un pinceau prédéfini dans la fenêtre --
 | 
				
			||||||
 | 
				
			|||||||