Support for textured toolbars of variable length. Grafx2 repeats the last two columns, so the dither pattern of Modern skin works.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1191 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									22b5dc56e5
								
							
						
					
					
						commit
						f7a5b23541
					
				
							
								
								
									
										20
									
								
								buttons.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								buttons.c
									
									
									
									
									
								
							@ -395,9 +395,9 @@ void Button_Hide_menu(void)
 | 
			
		||||
    Menu_is_visible=1;
 | 
			
		||||
    Pixel_in_menu=Pixel_in_toolbar;
 | 
			
		||||
    Menu_Y=Screen_height;
 | 
			
		||||
    for (current_menu = 0; current_menu < MENUBARS_COUNT; current_menu++)
 | 
			
		||||
      if (Menu_bars[current_menu].visible)
 | 
			
		||||
        Menu_Y -= Menu_bars[current_menu].height * Menu_factor_Y;
 | 
			
		||||
    for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++)
 | 
			
		||||
      if (Menu_bars[current_menu].Visible)
 | 
			
		||||
        Menu_Y -= Menu_bars[current_menu].Height * Menu_factor_Y;
 | 
			
		||||
 | 
			
		||||
    Compute_magnifier_data();
 | 
			
		||||
    if (Main_magnifier_mode)
 | 
			
		||||
@ -415,12 +415,12 @@ void Button_Hide_menu(void)
 | 
			
		||||
void Button_Show_layerbar(void)
 | 
			
		||||
{
 | 
			
		||||
  Hide_cursor();
 | 
			
		||||
  if (Menu_bars[layers_bar].visible)
 | 
			
		||||
  if (Menu_bars[MENUBAR_LAYERS].Visible)
 | 
			
		||||
  {
 | 
			
		||||
    // Hide it
 | 
			
		||||
    Menu_bars[layers_bar].visible=0;
 | 
			
		||||
    Menu_Y += Menu_bars[layers_bar].height * Menu_factor_Y;
 | 
			
		||||
    Menu_height -= Menu_bars[layers_bar].height;
 | 
			
		||||
    Menu_bars[MENUBAR_LAYERS].Visible=0;
 | 
			
		||||
    Menu_Y += Menu_bars[MENUBAR_LAYERS].Height * Menu_factor_Y;
 | 
			
		||||
    Menu_height -= Menu_bars[MENUBAR_LAYERS].Height;
 | 
			
		||||
 | 
			
		||||
    if (Main_magnifier_mode)
 | 
			
		||||
    {
 | 
			
		||||
@ -463,9 +463,9 @@ void Button_Show_layerbar(void)
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    // Show it
 | 
			
		||||
    Menu_bars[layers_bar].visible = 1;
 | 
			
		||||
    Menu_Y -= Menu_bars[layers_bar].height * Menu_factor_Y;
 | 
			
		||||
    Menu_height += Menu_bars[layers_bar].height;
 | 
			
		||||
    Menu_bars[MENUBAR_LAYERS].Visible = 1;
 | 
			
		||||
    Menu_Y -= Menu_bars[MENUBAR_LAYERS].Height * Menu_factor_Y;
 | 
			
		||||
    Menu_height += Menu_bars[MENUBAR_LAYERS].Height;
 | 
			
		||||
 | 
			
		||||
    Compute_magnifier_data();
 | 
			
		||||
    if (Main_magnifier_mode)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								const.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								const.h
									
									
									
									
									
								
							@ -270,6 +270,7 @@ enum BUTTON_NUMBERS
 | 
			
		||||
  BUTTON_LAYER_REMOVE,
 | 
			
		||||
  BUTTON_LAYER_UP,
 | 
			
		||||
  BUTTON_LAYER_DOWN,
 | 
			
		||||
  BUTTON_LAYER_SELECT,
 | 
			
		||||
 | 
			
		||||
  // Main menu
 | 
			
		||||
  BUTTON_PAINTBRUSHES,
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										22
									
								
								engine.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								engine.c
									
									
									
									
									
								
							@ -74,7 +74,7 @@ char * Menu_tooltip[NB_BUTTONS]=
 | 
			
		||||
  "Drop layer              ",
 | 
			
		||||
  "Raise layer             ",
 | 
			
		||||
  "Lower layer             ",
 | 
			
		||||
 | 
			
		||||
  "Layer select / toggle   ",
 | 
			
		||||
  "Paintbrush choice       ",
 | 
			
		||||
  "Adjust / Transform menu ",
 | 
			
		||||
  "Freehand draw. / Toggle ",
 | 
			
		||||
@ -160,11 +160,11 @@ int Button_under_mouse(void)
 | 
			
		||||
  x_pos = Mouse_X / Menu_factor_X;
 | 
			
		||||
 | 
			
		||||
  // Find in which menubar we are
 | 
			
		||||
  for (current_menu = 0; current_menu < MENUBARS_COUNT; current_menu ++)
 | 
			
		||||
  for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu ++)
 | 
			
		||||
  {
 | 
			
		||||
    if (Menu_bars[current_menu].visible)
 | 
			
		||||
    if (Menu_bars[current_menu].Visible)
 | 
			
		||||
    {
 | 
			
		||||
      current_offset -= Menu_bars[current_menu].height * Menu_factor_Y;
 | 
			
		||||
      current_offset -= Menu_bars[current_menu].Height * Menu_factor_Y;
 | 
			
		||||
      if (Mouse_Y >= current_offset)
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
@ -172,9 +172,9 @@ int Button_under_mouse(void)
 | 
			
		||||
  y_pos=(Mouse_Y - current_offset)/Menu_factor_Y;
 | 
			
		||||
 | 
			
		||||
  if (current_menu == 0) first_button = 0;
 | 
			
		||||
  else first_button = Menu_bars[current_menu - 1].last_button_index + 1;
 | 
			
		||||
  else first_button = Menu_bars[current_menu - 1].Last_button_index + 1;
 | 
			
		||||
 | 
			
		||||
  for (btn_number=first_button;btn_number<=Menu_bars[current_menu].last_button_index;btn_number++)
 | 
			
		||||
  for (btn_number=first_button;btn_number<=Menu_bars[current_menu].Last_button_index;btn_number++)
 | 
			
		||||
  {
 | 
			
		||||
    switch(Buttons_Pool[btn_number].Shape)
 | 
			
		||||
    {
 | 
			
		||||
@ -206,7 +206,7 @@ int Button_under_mouse(void)
 | 
			
		||||
  return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define Pixel_in_skinmenu(x,y,color) Menu_bars[current_menu].skin[(y - y_off)*Menu_bars[current_menu].width + x] = color
 | 
			
		||||
#define Pixel_in_skinmenu(x,y,color) Menu_bars[current_menu].Skin[(y - y_off)*Menu_bars[current_menu].Skin_width + x] = color
 | 
			
		||||
#define Pixel_in_menu_and_skin(x,y,color) Pixel_in_skinmenu(x,y,color); Pixel_in_menu(x,y,color)
 | 
			
		||||
 | 
			
		||||
///Draw the frame for a menu button
 | 
			
		||||
@ -225,12 +225,12 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
 | 
			
		||||
  word y_off = 0;
 | 
			
		||||
 | 
			
		||||
  // Find in which menu the button is
 | 
			
		||||
  for (current_menu = 0; current_menu < MENUBARS_COUNT; current_menu++)
 | 
			
		||||
  for (current_menu = 0; current_menu < MENUBAR_COUNT; current_menu++)
 | 
			
		||||
  {
 | 
			
		||||
    if(Menu_bars[current_menu].visible)
 | 
			
		||||
    if(Menu_bars[current_menu].Visible)
 | 
			
		||||
    {
 | 
			
		||||
      y_off += Menu_bars[current_menu].height;
 | 
			
		||||
      if (Menu_bars[current_menu].last_button_index >= btn_number)
 | 
			
		||||
      y_off += Menu_bars[current_menu].Height;
 | 
			
		||||
      if (Menu_bars[current_menu].Last_button_index >= btn_number)
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								global.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								global.h
									
									
									
									
									
								
							@ -476,12 +476,12 @@ GFX2_GLOBAL byte  Menu_factor_Y;
 | 
			
		||||
/// Size of a color cell in the menu's palette.
 | 
			
		||||
GFX2_GLOBAL word  Menu_palette_cell_width;
 | 
			
		||||
 | 
			
		||||
GFX2_GLOBAL T_Menu_Bar Menu_bars[MENUBARS_COUNT] 
 | 
			
		||||
GFX2_GLOBAL T_Menu_Bar Menu_bars[MENUBAR_COUNT] 
 | 
			
		||||
#ifdef GLOBAL_VARIABLES
 | 
			
		||||
  = 
 | 
			
		||||
{{MENU_WIDTH, 9, 1, NULL, BUTTON_HIDE }, // Status
 | 
			
		||||
 {MENU_WIDTH, 10, 0, NULL, BUTTON_LAYER_DOWN }, // Layers
 | 
			
		||||
 {MENU_WIDTH, 35, 1, NULL, BUTTON_CHOOSE_COL }} // Main
 | 
			
		||||
{{MENU_WIDTH, 9, 1, NULL, 20, BUTTON_HIDE }, // Status
 | 
			
		||||
 {MENU_WIDTH, 10, 0, NULL, 144, BUTTON_LAYER_SELECT }, // Layers
 | 
			
		||||
 {MENU_WIDTH, 35, 1, NULL, 254, BUTTON_CHOOSE_COL }} // Main
 | 
			
		||||
#endif
 | 
			
		||||
 ;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								helpfile.h
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								helpfile.h
									
									
									
									
									
								
							@ -2538,7 +2538,22 @@ static const T_Help_table helptable_layerdown[] =
 | 
			
		||||
  HELP_TEXT ("Move the current layer below the previous one")
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
static const T_Help_table helptable_layerselect[] =
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  HELP_TITLE("LAYER SELECTION")
 | 
			
		||||
  HELP_TEXT ("")
 | 
			
		||||
  HELP_BOLD ("LEFT CLICK")
 | 
			
		||||
  HELP_TEXT ("")
 | 
			
		||||
  HELP_TEXT ("Choose a layer as the current one for")
 | 
			
		||||
  HELP_TEXT ("drawing.")
 | 
			
		||||
  HELP_TEXT ("")
 | 
			
		||||
  HELP_BOLD ("RIGHT CLICK")
 | 
			
		||||
  HELP_TEXT ("")
 | 
			
		||||
  HELP_TEXT ("Makes a layer visible or invisible.")
 | 
			
		||||
  HELP_TEXT ("If you click the current layer, this toggles")
 | 
			
		||||
  HELP_TEXT ("the visibility of all other layers instead.")
 | 
			
		||||
};
 | 
			
		||||
#define HELP_TABLE_DECLARATION(x) {x, sizeof(x)/sizeof(const T_Help_table)},
 | 
			
		||||
 | 
			
		||||
T_Help_section Help_section[] =
 | 
			
		||||
@ -2557,6 +2572,7 @@ T_Help_section Help_section[] =
 | 
			
		||||
  HELP_TABLE_DECLARATION(helptable_layerdel)
 | 
			
		||||
  HELP_TABLE_DECLARATION(helptable_layerup)
 | 
			
		||||
  HELP_TABLE_DECLARATION(helptable_layerdown)
 | 
			
		||||
  HELP_TABLE_DECLARATION(helptable_layerselect)
 | 
			
		||||
  HELP_TABLE_DECLARATION(helptable_paintbrush)
 | 
			
		||||
  HELP_TABLE_DECLARATION(helptable_adjust)
 | 
			
		||||
  HELP_TABLE_DECLARATION(helptable_draw)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										42
									
								
								init.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								init.c
									
									
									
									
									
								
							@ -347,30 +347,30 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
 | 
			
		||||
  // Menu
 | 
			
		||||
  if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu"))
 | 
			
		||||
    return 1;
 | 
			
		||||
  if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block, Menu_bars[main_bar].width, Menu_bars[main_bar].height,"menu",0))
 | 
			
		||||
  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;
 | 
			
		||||
 | 
			
		||||
  // Preview
 | 
			
		||||
  cursor_x += Menu_bars[main_bar].width;
 | 
			
		||||
  cursor_x += Menu_bars[MENUBAR_TOOLS].Skin_width;
 | 
			
		||||
  if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "preview"))
 | 
			
		||||
	return 1;
 | 
			
		||||
  if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Preview, 173, 16, "logo", 0))
 | 
			
		||||
	return 1;
 | 
			
		||||
  cursor_y+= Menu_bars[main_bar].height;
 | 
			
		||||
  cursor_y+= Menu_bars[MENUBAR_TOOLS].Height;
 | 
			
		||||
 | 
			
		||||
  // Layerbar
 | 
			
		||||
  if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "layer bar"))
 | 
			
		||||
    return 1;
 | 
			
		||||
  if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Layerbar_block, Menu_bars[layers_bar].width, Menu_bars[layers_bar].height,"layer bar",0))
 | 
			
		||||
  if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Layerbar_block, Menu_bars[MENUBAR_LAYERS].Skin_width, Menu_bars[MENUBAR_LAYERS].Height,"layer bar",0))
 | 
			
		||||
    return 1;
 | 
			
		||||
  cursor_y+= Menu_bars[layers_bar].height;
 | 
			
		||||
  cursor_y+= Menu_bars[MENUBAR_LAYERS].Height;
 | 
			
		||||
 | 
			
		||||
  // Status bar
 | 
			
		||||
  if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "status bar"))
 | 
			
		||||
    return 1;
 | 
			
		||||
  if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Statusbar_block, Menu_bars[status_bar].width, Menu_bars[status_bar].height,"status bar",0))
 | 
			
		||||
  if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Statusbar_block, Menu_bars[MENUBAR_STATUS].Skin_width, Menu_bars[MENUBAR_STATUS].Height,"status bar",0))
 | 
			
		||||
    return 1;
 | 
			
		||||
  cursor_y+= Menu_bars[status_bar].height;
 | 
			
		||||
  cursor_y+= Menu_bars[MENUBAR_STATUS].Height;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // Effects
 | 
			
		||||
@ -1266,50 +1266,56 @@ void Init_buttons(void)
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_menu, Button_Layer_menu,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_TOOLBAR);
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  Init_button(BUTTON_LAYER_COLOR,
 | 
			
		||||
                     58,0,
 | 
			
		||||
                     13,9,
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_color, Button_Layer_color,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_TOOLBAR);
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  Init_button(BUTTON_LAYER_MERGE,
 | 
			
		||||
                     72,0,
 | 
			
		||||
                     13,9,
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_merge, Button_Layer_merge,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_TOOLBAR);
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  Init_button(BUTTON_LAYER_ADD,
 | 
			
		||||
                     86,0,
 | 
			
		||||
                     13,9,
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_add, Button_Layer_add,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_TOOLBAR);
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  Init_button(BUTTON_LAYER_REMOVE,
 | 
			
		||||
                     100,0,
 | 
			
		||||
                     13,9,
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_remove, Button_Layer_remove,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_TOOLBAR);
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  Init_button(BUTTON_LAYER_UP,
 | 
			
		||||
                     114,0,
 | 
			
		||||
                     13,9,
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_up, Button_Layer_up,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_TOOLBAR);
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  Init_button(BUTTON_LAYER_DOWN,
 | 
			
		||||
                     128,0,
 | 
			
		||||
                     13,9,
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_down, Button_Layer_down,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_TOOLBAR);
 | 
			
		||||
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  Init_button(BUTTON_LAYER_SELECT,
 | 
			
		||||
                     142,0,
 | 
			
		||||
                     13,9, // Will be updated according to actual number of layers
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Layer_select, Button_Layer_select,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
  // Status bar
 | 
			
		||||
  Init_button(BUTTON_HIDE,
 | 
			
		||||
                     0,0,
 | 
			
		||||
@ -2592,7 +2598,7 @@ void Set_current_skin(const char *skinfile, T_Gui_skin *gfx)
 | 
			
		||||
  MC_Trans = gfx->Color_trans;
 | 
			
		||||
 | 
			
		||||
  // Set menubars to point to the new data
 | 
			
		||||
  Menu_bars[main_bar].skin = (byte*)&(gfx->Menu_block);
 | 
			
		||||
  Menu_bars[layers_bar].skin = (byte*)&(gfx->Layerbar_block);
 | 
			
		||||
  Menu_bars[status_bar].skin = (byte*)&(gfx->Statusbar_block);
 | 
			
		||||
  Menu_bars[MENUBAR_TOOLS].Skin = (byte*)&(gfx->Menu_block);
 | 
			
		||||
  Menu_bars[MENUBAR_LAYERS].Skin = (byte*)&(gfx->Layerbar_block);
 | 
			
		||||
  Menu_bars[MENUBAR_STATUS].Skin = (byte*)&(gfx->Statusbar_block);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										7
									
								
								layers.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								layers.c
									
									
									
									
									
								
							@ -63,6 +63,13 @@ void Button_Layer_remove(void)
 | 
			
		||||
  Unselect_button(BUTTON_LAYER_REMOVE);
 | 
			
		||||
  Display_cursor();
 | 
			
		||||
}
 | 
			
		||||
void Button_Layer_select(void)
 | 
			
		||||
{
 | 
			
		||||
  Hide_cursor();
 | 
			
		||||
  Unselect_button(BUTTON_LAYER_SELECT);
 | 
			
		||||
  Display_cursor();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
void Button_Layer_1(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								layers.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								layers.h
									
									
									
									
									
								
							@ -37,3 +37,5 @@ void Button_Layer_color(void);
 | 
			
		||||
void Button_Layer_merge(void);
 | 
			
		||||
void Button_Layer_up(void);
 | 
			
		||||
void Button_Layer_down(void);
 | 
			
		||||
void Button_Layer_select(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										23
									
								
								struct.h
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								struct.h
									
									
									
									
									
								
							@ -417,8 +417,8 @@ typedef struct
 | 
			
		||||
  
 | 
			
		||||
  /// Bitmap data for the menu, a single rectangle.
 | 
			
		||||
  byte Menu_block[35][MENU_WIDTH];
 | 
			
		||||
  byte Layerbar_block[10][MENU_WIDTH];
 | 
			
		||||
  byte Statusbar_block[9][MENU_WIDTH];
 | 
			
		||||
  byte Layerbar_block[10][144];
 | 
			
		||||
  byte Statusbar_block[9][20];
 | 
			
		||||
  /// Bitmap data for the icons that are displayed over the menu.
 | 
			
		||||
  byte Menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH];
 | 
			
		||||
  /// Bitmap data for the different "effects" icons.
 | 
			
		||||
@ -466,18 +466,19 @@ typedef struct
 | 
			
		||||
 | 
			
		||||
// A menubar.
 | 
			
		||||
typedef struct {
 | 
			
		||||
  word width;
 | 
			
		||||
  word height;
 | 
			
		||||
  byte visible;
 | 
			
		||||
  byte* skin;
 | 
			
		||||
  byte last_button_index;
 | 
			
		||||
  word Width;
 | 
			
		||||
  word Height;
 | 
			
		||||
  byte Visible;
 | 
			
		||||
  byte* Skin;
 | 
			
		||||
  word Skin_width;
 | 
			
		||||
  byte Last_button_index;
 | 
			
		||||
} T_Menu_Bar;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
  status_bar = 0, // MUST be 0
 | 
			
		||||
  layers_bar,
 | 
			
		||||
  main_bar,
 | 
			
		||||
  MENUBARS_COUNT
 | 
			
		||||
  MENUBAR_STATUS = 0, // MUST be 0
 | 
			
		||||
  MENUBAR_LAYERS,
 | 
			
		||||
  MENUBAR_TOOLS,
 | 
			
		||||
  MENUBAR_COUNT
 | 
			
		||||
} T_Menubars;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										67
									
								
								windows.c
									
									
									
									
									
								
							
							
						
						
									
										67
									
								
								windows.c
									
									
									
									
									
								
							@ -183,11 +183,11 @@ word Palette_cell_Y(byte index)
 | 
			
		||||
{
 | 
			
		||||
  if (Config.Palette_vertical)
 | 
			
		||||
  {
 | 
			
		||||
    return Menu_Y+((2+(((index-First_color_in_palette)/Menu_cells_X)*(Menu_bars[main_bar].height/Menu_cells_Y)))*Menu_factor_Y);
 | 
			
		||||
    return Menu_Y+((2+(((index-First_color_in_palette)/Menu_cells_X)*(Menu_bars[MENUBAR_TOOLS].Height/Menu_cells_Y)))*Menu_factor_Y);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    return Menu_Y+((2+(((index-First_color_in_palette)%Menu_cells_Y)*(Menu_bars[main_bar].height/Menu_cells_Y)))*Menu_factor_Y);
 | 
			
		||||
    return Menu_Y+((2+(((index-First_color_in_palette)%Menu_cells_Y)*(Menu_bars[MENUBAR_TOOLS].Height/Menu_cells_Y)))*Menu_factor_Y);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -220,7 +220,7 @@ void Frame_menu_color(byte id)
 | 
			
		||||
{
 | 
			
		||||
  word start_x,start_y,end_x,end_y;
 | 
			
		||||
  word index;
 | 
			
		||||
  word cell_height=Menu_bars[main_bar].height*Menu_factor_Y/Menu_cells_Y;
 | 
			
		||||
  word cell_height=Menu_bars[MENUBAR_TOOLS].Height*Menu_factor_Y/Menu_cells_Y;
 | 
			
		||||
  byte color;
 | 
			
		||||
 | 
			
		||||
  if (id==Fore_color)
 | 
			
		||||
@ -294,12 +294,17 @@ void Frame_menu_color(byte id)
 | 
			
		||||
void Display_menu_palette(void)
 | 
			
		||||
{
 | 
			
		||||
  int color;
 | 
			
		||||
  byte cell_height=(Menu_bars[main_bar].height)*Menu_factor_Y/Menu_cells_Y;
 | 
			
		||||
  byte cell_height=(Menu_bars[MENUBAR_TOOLS].Height)*Menu_factor_Y/Menu_cells_Y;
 | 
			
		||||
  // width: Menu_palette_cell_width
 | 
			
		||||
  
 | 
			
		||||
  if (Menu_is_visible)
 | 
			
		||||
  {
 | 
			
		||||
    Block(MENU_WIDTH*Menu_factor_X,Menu_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),(Menu_height-11+2)*Menu_factor_Y,MC_Black);
 | 
			
		||||
    Block(
 | 
			
		||||
      Menu_bars[MENUBAR_TOOLS].Width*Menu_factor_X,
 | 
			
		||||
      Menu_Y,
 | 
			
		||||
      Screen_width-(Menu_bars[MENUBAR_TOOLS].Width*Menu_factor_X),
 | 
			
		||||
      (Menu_bars[MENUBAR_TOOLS].Height)*Menu_factor_Y,
 | 
			
		||||
      MC_Black);
 | 
			
		||||
 | 
			
		||||
    if (Config.Separate_colors)
 | 
			
		||||
      for (color=First_color_in_palette;color<256&&(color-First_color_in_palette)<Menu_cells_X*Menu_cells_Y;color++)
 | 
			
		||||
@ -427,25 +432,25 @@ void Display_menu(void)
 | 
			
		||||
  if (Menu_is_visible)
 | 
			
		||||
  {
 | 
			
		||||
    // display menu sprite
 | 
			
		||||
    for (current_menu = MENUBARS_COUNT - 1; current_menu >= 0; current_menu --)
 | 
			
		||||
    for (current_menu = MENUBAR_COUNT - 1; current_menu >= 0; current_menu --)
 | 
			
		||||
    {
 | 
			
		||||
      if(Menu_bars[current_menu].visible)
 | 
			
		||||
      if(Menu_bars[current_menu].Visible)
 | 
			
		||||
      {
 | 
			
		||||
        for (y_pos=0;y_pos<Menu_bars[current_menu].height;y_pos++)
 | 
			
		||||
          for (x_pos=0;x_pos<Menu_bars[current_menu].width;x_pos++)
 | 
			
		||||
            Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].skin[y_pos * Menu_bars[current_menu].width + x_pos]);
 | 
			
		||||
        y_off += Menu_bars[current_menu].height;
 | 
			
		||||
        // Skinned area
 | 
			
		||||
        for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
 | 
			
		||||
          for (x_pos=0;x_pos<Menu_bars[current_menu].Skin_width;x_pos++)
 | 
			
		||||
            Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + x_pos]);
 | 
			
		||||
 | 
			
		||||
        // If some area is remaining to the right, texture it with a copy of
 | 
			
		||||
        // the last two columns
 | 
			
		||||
        for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
 | 
			
		||||
          for (x_pos=Menu_bars[current_menu].Skin_width;x_pos<Screen_width/Menu_factor_X;x_pos++)
 | 
			
		||||
            Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + Menu_bars[current_menu].Skin_width - 2 + (x_pos&1)]);
 | 
			
		||||
 | 
			
		||||
        // Next bar
 | 
			
		||||
        y_off += Menu_bars[current_menu].Height;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // Grey area for filename below palette
 | 
			
		||||
    Block(MENU_WIDTH*Menu_factor_X,Menu_status_Y-Menu_factor_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),9*Menu_factor_Y,MC_Light);
 | 
			
		||||
 | 
			
		||||
    // Black area below palette
 | 
			
		||||
    if(Menu_bars[layers_bar].visible)
 | 
			
		||||
      Block(MENU_WIDTH*Menu_factor_X,
 | 
			
		||||
          Menu_Y + Menu_bars[main_bar].height*Menu_factor_Y,
 | 
			
		||||
          Screen_width-(MENU_WIDTH*Menu_factor_X),
 | 
			
		||||
          Menu_bars[layers_bar].height*Menu_factor_Y,MC_Black);
 | 
			
		||||
 | 
			
		||||
    // Display palette
 | 
			
		||||
    Display_menu_palette();
 | 
			
		||||
@ -456,17 +461,17 @@ void Display_menu(void)
 | 
			
		||||
 | 
			
		||||
    if (!Windows_open)
 | 
			
		||||
    {
 | 
			
		||||
      if ((Mouse_Y<Menu_Y) &&                                                    // Souris dans l'image
 | 
			
		||||
      if ((Mouse_Y<Menu_Y) && // Mouse in the picture area
 | 
			
		||||
          ( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ))
 | 
			
		||||
      {
 | 
			
		||||
		// Prepare display of XY coordinates even if in some cases they will be
 | 
			
		||||
		// erased with some other text
 | 
			
		||||
        // Prepare display of XY coordinates even if in some cases they will be
 | 
			
		||||
        // erased with some other text
 | 
			
		||||
        if ( (Current_operation!=OPERATION_COLORPICK)
 | 
			
		||||
          && (Current_operation!=OPERATION_REPLACE) )
 | 
			
		||||
          Print_in_menu("X:       Y:             ",0);
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
		  // The colorpicker display the color id between the parentheses
 | 
			
		||||
          // The colorpicker display the color id between the parentheses
 | 
			
		||||
          Print_in_menu("X:       Y:       (    )",0);
 | 
			
		||||
          Num2str(Colorpicker_color,str,3);
 | 
			
		||||
          Print_in_menu(str,20);
 | 
			
		||||
@ -476,7 +481,7 @@ void Display_menu(void)
 | 
			
		||||
      }
 | 
			
		||||
      Print_filename();
 | 
			
		||||
    }
 | 
			
		||||
	// Now update the area: menu height and whole screen width (including palette)
 | 
			
		||||
    // Now update the area: menu height and whole screen width (including palette)
 | 
			
		||||
    Update_rect(0,Menu_Y,Screen_width,Menu_height*Menu_factor_Y);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -2670,8 +2675,8 @@ void Remap_menu_sprites()
 | 
			
		||||
        for (i=0; i<CURSOR_SPRITE_WIDTH; i++)
 | 
			
		||||
          Remap_pixel(&Gfx->Cursor_sprite[k][j][i]);
 | 
			
		||||
    // Main menu bar
 | 
			
		||||
    for (j=0; j<35; j++)
 | 
			
		||||
      for (i=0; i<MENU_WIDTH; i++)
 | 
			
		||||
    for (j=0; j<Menu_bars[MENUBAR_TOOLS].Height; j++)
 | 
			
		||||
      for (i=0; i<Menu_bars[MENUBAR_TOOLS].Skin_width; i++)
 | 
			
		||||
        Remap_pixel(&Gfx->Menu_block[j][i]);
 | 
			
		||||
    // Menu sprites
 | 
			
		||||
    for (k=0; k<NB_MENU_SPRITES; k++)
 | 
			
		||||
@ -2691,12 +2696,12 @@ void Remap_menu_sprites()
 | 
			
		||||
            Remap_pixel(&Gfx->Layer_sprite[l][k][j][i]);
 | 
			
		||||
    
 | 
			
		||||
    // Status bar
 | 
			
		||||
    for (j=0; j<9; j++)
 | 
			
		||||
      for (i=0; i<MENU_WIDTH; i++)
 | 
			
		||||
    for (j=0; j<Menu_bars[MENUBAR_STATUS].Height; j++)
 | 
			
		||||
      for (i=0; i<Menu_bars[MENUBAR_STATUS].Skin_width; i++)
 | 
			
		||||
        Remap_pixel(&Gfx->Statusbar_block[j][i]);
 | 
			
		||||
    // Layer bar
 | 
			
		||||
    for (j=0; j<10; j++)
 | 
			
		||||
      for (i=0; i<MENU_WIDTH; i++)
 | 
			
		||||
    for (j=0; j<Menu_bars[MENUBAR_LAYERS].Height; j++)
 | 
			
		||||
      for (i=0; i<Menu_bars[MENUBAR_LAYERS].Skin_width; i++)
 | 
			
		||||
        Remap_pixel(&Gfx->Layerbar_block[j][i]);
 | 
			
		||||
    
 | 
			
		||||
    // Help fonts
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user