Implemented palette ordering (issue 112). You can activate it in the secondary palette window (shift-P), it's saved in gfx2.ini.
The skin file has 2 more icons for the arrows (Ilija, grafx2 won't load if you don't update yours) Updated contextual help for the secondary palette window. Fixed some typos in code. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@704 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									eb781b9bd6
								
							
						
					
					
						commit
						8ff9028eab
					
				
							
								
								
									
										31
									
								
								buttons.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								buttons.c
									
									
									
									
									
								
							@ -234,13 +234,14 @@ void Button_Redo(void)
 | 
			
		||||
//---------------------------- SCROLL PALETTE LEFT ---------------------------
 | 
			
		||||
void Button_Pal_left(void)
 | 
			
		||||
{
 | 
			
		||||
  short cells_y = Palette_cells_Y();
 | 
			
		||||
  short cells;
 | 
			
		||||
  cells = (Config.Palette_vertical)?Palette_cells_X():Palette_cells_Y();
 | 
			
		||||
 | 
			
		||||
  Hide_cursor();
 | 
			
		||||
  if (First_color_in_palette)
 | 
			
		||||
  {
 | 
			
		||||
    if (First_color_in_palette>=cells_y)
 | 
			
		||||
      First_color_in_palette-=cells_y;
 | 
			
		||||
    if (First_color_in_palette>=cells)
 | 
			
		||||
      First_color_in_palette-=cells;
 | 
			
		||||
    else
 | 
			
		||||
      First_color_in_palette=0;
 | 
			
		||||
    Display_menu_palette();
 | 
			
		||||
@ -251,14 +252,14 @@ void Button_Pal_left(void)
 | 
			
		||||
 | 
			
		||||
void Button_Pal_left_fast(void)
 | 
			
		||||
{
 | 
			
		||||
  short cells_X = Palette_cells_X();
 | 
			
		||||
  short cells_x = Palette_cells_X();
 | 
			
		||||
  short cells_y = Palette_cells_Y();
 | 
			
		||||
 | 
			
		||||
  Hide_cursor();
 | 
			
		||||
  if (First_color_in_palette)
 | 
			
		||||
  {
 | 
			
		||||
    if (First_color_in_palette>=cells_y*cells_X)
 | 
			
		||||
      First_color_in_palette-=cells_y*cells_X;
 | 
			
		||||
    if (First_color_in_palette>=cells_y*cells_x)
 | 
			
		||||
      First_color_in_palette-=cells_y*cells_x;
 | 
			
		||||
    else
 | 
			
		||||
      First_color_in_palette=0;
 | 
			
		||||
    Display_menu_palette();
 | 
			
		||||
@ -271,30 +272,32 @@ void Button_Pal_left_fast(void)
 | 
			
		||||
//--------------------------- SCROLL PALETTE RIGHT ---------------------------
 | 
			
		||||
void Button_Pal_right(void)
 | 
			
		||||
{
 | 
			
		||||
  short cells_y = Palette_cells_Y();
 | 
			
		||||
  short cells;
 | 
			
		||||
  cells = (Config.Palette_vertical)?Palette_cells_X():Palette_cells_Y();
 | 
			
		||||
 | 
			
		||||
  Hide_cursor();
 | 
			
		||||
  if ((int)First_color_in_palette+cells_y*Palette_cells_X()<256)
 | 
			
		||||
  if ((int)First_color_in_palette+Palette_cells_X()*Palette_cells_Y()<256)
 | 
			
		||||
  {
 | 
			
		||||
    First_color_in_palette+=cells_y;
 | 
			
		||||
    First_color_in_palette+=cells;
 | 
			
		||||
    Display_menu_palette();
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  Unselect_bouton(BUTTON_PAL_RIGHT);
 | 
			
		||||
  Display_cursor();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Button_Pal_right_fast(void)
 | 
			
		||||
{
 | 
			
		||||
  short cells_X = Palette_cells_X();
 | 
			
		||||
  short cells_x = Palette_cells_X();
 | 
			
		||||
  short cells_y = Palette_cells_Y();
 | 
			
		||||
 | 
			
		||||
  Hide_cursor();
 | 
			
		||||
  if ((int)First_color_in_palette+cells_y*cells_X<256)
 | 
			
		||||
  if ((int)First_color_in_palette+cells_y*cells_x<256)
 | 
			
		||||
  {
 | 
			
		||||
    if ((int)First_color_in_palette+(cells_y)*cells_X*2<256)
 | 
			
		||||
      First_color_in_palette+=cells_X*cells_y;
 | 
			
		||||
    if ((int)First_color_in_palette+(cells_y)*cells_x*2<256)
 | 
			
		||||
      First_color_in_palette+=cells_x*cells_y;
 | 
			
		||||
    else
 | 
			
		||||
      First_color_in_palette=255/cells_y*cells_y-(cells_X-1)*cells_y;
 | 
			
		||||
      First_color_in_palette=255/cells_y*cells_y-(cells_x-1)*cells_y;
 | 
			
		||||
    Display_menu_palette();
 | 
			
		||||
  }
 | 
			
		||||
  Unselect_bouton(BUTTON_PAL_RIGHT);
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								const.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								const.h
									
									
									
									
									
								
							@ -46,7 +46,7 @@
 | 
			
		||||
#define CURSOR_SPRITE_WIDTH       15    // Largeur d'un sprite de curseur en pixels
 | 
			
		||||
#define CURSOR_SPRITE_HEIGHT      15    // Hauteur d'un sprite de curseur en pixels
 | 
			
		||||
#define NB_EFFECTS_SPRITES        9     // Nombre de sprites d'effets
 | 
			
		||||
#define NB_MENU_SPRITES           18    // Nombre de sprites de menu
 | 
			
		||||
#define NB_MENU_SPRITES           20    // Nombre de sprites de menu
 | 
			
		||||
#define MENU_SPRITE_WIDTH         14    // Largeur d'un sprite de menu en pixels
 | 
			
		||||
#define MENU_SPRITE_HEIGHT        14    // Hauteur d'un sprite de menu en pixels
 | 
			
		||||
#define PAINTBRUSH_WIDTH          16    // Largeur d'un sprite de pinceau prédéfini
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								engine.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								engine.c
									
									
									
									
									
								
							@ -139,8 +139,8 @@ char * Menu_tooltip[NB_BUTTONS]=
 | 
			
		||||
  "Kill current page       ",
 | 
			
		||||
  "Quit                    ",
 | 
			
		||||
  "Palette editor          ",
 | 
			
		||||
  "Scroll pal. left / Fast ",
 | 
			
		||||
  "Scroll pal. right / Fast",
 | 
			
		||||
  "Scroll pal. bkwd / Fast ",
 | 
			
		||||
  "Scroll pal. fwd / Fast  ",
 | 
			
		||||
  "Color #"                 ,
 | 
			
		||||
  "Hide tool bar           "
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -323,4 +323,10 @@
 | 
			
		||||
  Bookmark_label = 
 | 
			
		||||
  Bookmark_directory = 
 | 
			
		||||
 | 
			
		||||
  ; In the classic layout, the palette in the menu has colors from left to
 | 
			
		||||
  ; right. If you prefer the colors ordered top to bottom, set this option
 | 
			
		||||
  ; to YES.
 | 
			
		||||
  ; 
 | 
			
		||||
  Palette_vertical = NO; (Default NO)
 | 
			
		||||
 | 
			
		||||
  ; end of configuration
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								gfx2gui.gif
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gfx2gui.gif
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB  | 
							
								
								
									
										57
									
								
								helpfile.h
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								helpfile.h
									
									
									
									
									
								
							@ -217,10 +217,10 @@ static const T_Help_table helptable_help[] =
 | 
			
		||||
  HELP_LINK ("Exclude colors menu: %s",   SPECIAL_EXCLUDE_COLORS_MENU)
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("Scroll palette")
 | 
			
		||||
  HELP_LINK ("  Left: %s",   0x100+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("  Right: %s",   0x100+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_LINK ("  Left faster: %s",   0x200+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("  Right faster: %s",   0x200+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_LINK ("  Back:           %s",   0x100+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("  Forward:        %s",   0x100+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_LINK ("  Back faster:    %s",   0x200+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("  Forward faster: %s",   0x200+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("Change brush attachement")
 | 
			
		||||
  HELP_LINK ("  Center      : %s",   SPECIAL_CENTER_ATTACHMENT)
 | 
			
		||||
@ -2094,21 +2094,44 @@ static const T_Help_table helptable_palette[] =
 | 
			
		||||
  HELP_TEXT("remapped as it was just before this action.")
 | 
			
		||||
  HELP_TEXT("Only Cancel will.")
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TITLE("PALETTE OPTIONS")
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_BOLD ("RIGHT CLICK")
 | 
			
		||||
  HELP_LINK ("(Key:%s)",0x200+BUTTON_PALETTE)
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("Opens a menu from where you can access the")
 | 
			
		||||
  HELP_TEXT("following menus:")
 | 
			
		||||
  HELP_TEXT("Opens a menu from where you have the")
 | 
			
		||||
  HELP_TEXT("following options:")
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("- A menu in which you can select the colors")
 | 
			
		||||
  HELP_TEXT("that have not to be used")
 | 
			
		||||
  HELP_TEXT("for smoothing, for the transparency mode and")
 | 
			
		||||
  HELP_TEXT("for remapping.")
 | 
			
		||||
  HELP_TEXT("- Colors for best match:")
 | 
			
		||||
  HELP_TEXT("A menu in which you can select the colors")
 | 
			
		||||
  HELP_TEXT("that have not to be used for smoothing, for")
 | 
			
		||||
  HELP_TEXT("the transparency mode and for remapping.")
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("- A menu in which you can define color")
 | 
			
		||||
  HELP_TEXT("series.")
 | 
			
		||||
  HELP_TEXT("- User's color series:")
 | 
			
		||||
  HELP_TEXT("A menu in which you can define color series")
 | 
			
		||||
  HELP_TEXT("for next/previous colors.")
 | 
			
		||||
  HELP_TEXT("*** Not implemented yet ***")
 | 
			
		||||
};
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("- Palette layout:")
 | 
			
		||||
  HELP_TEXT("Lets you customize the palette that appears")
 | 
			
		||||
  HELP_TEXT("on the right of the menu. You can choose the")
 | 
			
		||||
  HELP_TEXT("number of lines and columns.")
 | 
			
		||||
  HELP_TEXT("If you want the colors to run top to bottom,")
 | 
			
		||||
  HELP_TEXT("check the 'Vertical' button, otherwise the")
 | 
			
		||||
  HELP_TEXT("colors runs left to right.")
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("- RGB Scale:")
 | 
			
		||||
  HELP_TEXT("Lets you set the scale of the R G B sliders")
 | 
			
		||||
  HELP_TEXT("in the palette screen. You should normally")
 | 
			
		||||
  HELP_TEXT("leave it at 256 to get the full 0-255 range,")
 | 
			
		||||
  HELP_TEXT("but if you want to constrain the palette")
 | 
			
		||||
  HELP_TEXT("to the capabilities of some specific")
 | 
			
		||||
  HELP_TEXT("computers and consoles, you can choose eg:")
 | 
			
		||||
  HELP_TEXT("   64 : VGA")
 | 
			
		||||
  HELP_TEXT("   16 : Amiga")
 | 
			
		||||
  HELP_TEXT("    4 : MSX2")
 | 
			
		||||
  HELP_TEXT("    2 : Amstrad CPC")
 | 
			
		||||
  };
 | 
			
		||||
static const T_Help_table helptable_pal_scroll[] =
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -2118,14 +2141,14 @@ static const T_Help_table helptable_pal_scroll[] =
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("Scrolls the palette window in the right of")
 | 
			
		||||
  HELP_TEXT("the menu.")
 | 
			
		||||
  HELP_LINK ("Key for left:  %s",0x100+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("Key for right: %s",0x100+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_LINK ("Key for back:    %s",   0x100+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("Key for forward: %s",   0x100+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_BOLD ("RIGHT CLICK")
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
  HELP_TEXT("Same as above, but faster.")
 | 
			
		||||
  HELP_LINK ("Key for left:  %s",0x200+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("Key for right: %s",0x200+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_LINK ("Key for back:    %s",   0x200+BUTTON_PAL_LEFT)
 | 
			
		||||
  HELP_LINK ("Key for forward: %s",   0x200+BUTTON_PAL_RIGHT)
 | 
			
		||||
  HELP_TEXT("")
 | 
			
		||||
};
 | 
			
		||||
static const T_Help_table helptable_color_select[] =
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								init.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								init.c
									
									
									
									
									
								
							@ -1055,7 +1055,7 @@ void Init_buttons(void)
 | 
			
		||||
                     237,9,
 | 
			
		||||
                     16,8,
 | 
			
		||||
                     BUTTON_SHAPE_RECTANGLE,
 | 
			
		||||
                     Button_Palette,Button_Pecondary_palette,
 | 
			
		||||
                     Button_Palette,Button_Secondary_palette,
 | 
			
		||||
                     Do_nothing,
 | 
			
		||||
                     FAMILY_INSTANT);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								main.c
									
									
									
									
									
								
							@ -587,6 +587,7 @@ int Init_program(int argc,char * argv[])
 | 
			
		||||
  // On affiche le menu:
 | 
			
		||||
  Display_menu();
 | 
			
		||||
  Display_paintbrush_in_menu();
 | 
			
		||||
  Display_sprite_in_menu(BUTTON_PAL_LEFT,18+(Config.Palette_vertical!=0));
 | 
			
		||||
 | 
			
		||||
  // On affiche le curseur pour débutter correctement l'état du programme:
 | 
			
		||||
  Display_cursor();
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										29
									
								
								palette.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								palette.c
									
									
									
									
									
								
							@ -2074,7 +2074,7 @@ void Button_Palette(void)
 | 
			
		||||
 | 
			
		||||
//---------------------- Menu de palettes secondaires ------------------------
 | 
			
		||||
 | 
			
		||||
void Button_Pecondary_palette(void)
 | 
			
		||||
void Button_Secondary_palette(void)
 | 
			
		||||
{
 | 
			
		||||
  short clicked_button;
 | 
			
		||||
  byte dummy;
 | 
			
		||||
@ -2082,6 +2082,7 @@ void Button_Pecondary_palette(void)
 | 
			
		||||
  T_Scroller_button * lines_slider;
 | 
			
		||||
  T_Scroller_button * rgb_scale_slider;
 | 
			
		||||
  char str[4];
 | 
			
		||||
  byte palette_vertical = Config.Palette_vertical;
 | 
			
		||||
  byte palette_needs_redraw=0;
 | 
			
		||||
  
 | 
			
		||||
  Open_window(200,146,"Palettes");
 | 
			
		||||
@ -2090,8 +2091,8 @@ void Button_Pecondary_palette(void)
 | 
			
		||||
  Window_set_normal_button(10,37,180,14,"User's color series"  ,14,0,SDLK_s); // 2
 | 
			
		||||
  Window_set_normal_button(139,126,53,14,"OK"                  , 0,1,SDLK_RETURN); // 3
 | 
			
		||||
  Window_set_normal_button( 80,126,53,14,"Cancel"              , 0,1,KEY_ESC); // 4
 | 
			
		||||
  Window_display_frame(10,55,122,51);
 | 
			
		||||
  Print_in_window(18,59,"palette layout",MC_Dark,MC_Light);
 | 
			
		||||
  Window_display_frame(10,55,122,66);
 | 
			
		||||
  Print_in_window(18,59,"Palette layout",MC_Dark,MC_Light);
 | 
			
		||||
  Print_in_window(35,77,"Cols",MC_Dark,MC_Light);
 | 
			
		||||
  Print_in_window(84,77,"Lines",MC_Dark,MC_Light);
 | 
			
		||||
  Print_in_window(157,66,"RGB",MC_Dark,MC_Light);
 | 
			
		||||
@ -2109,6 +2110,10 @@ void Button_Pecondary_palette(void)
 | 
			
		||||
  Num2str(RGB_scale,str,3);
 | 
			
		||||
  Print_in_window(157,89,str,MC_Black,MC_Light);
 | 
			
		||||
 | 
			
		||||
  Window_set_normal_button(35,106,13,11,"",-1,1,SDLK_LAST); // 8
 | 
			
		||||
  Print_in_window(38,108,(palette_vertical)?"X":" ",MC_Black,MC_Light);
 | 
			
		||||
  Print_in_window(51,108,"Vertical",MC_Dark,MC_Light);
 | 
			
		||||
  
 | 
			
		||||
  Update_rect(Window_pos_X,Window_pos_Y,Menu_factor_X*200,Menu_factor_Y*80);
 | 
			
		||||
 | 
			
		||||
  Display_cursor();
 | 
			
		||||
@ -2119,7 +2124,7 @@ void Button_Pecondary_palette(void)
 | 
			
		||||
    if (Is_shortcut(Key,0x100+BUTTON_HELP))
 | 
			
		||||
    {
 | 
			
		||||
      Key=0;
 | 
			
		||||
      Window_help(BUTTON_PALETTE, NULL);
 | 
			
		||||
      Window_help(BUTTON_PALETTE, "PALETTE OPTIONS");
 | 
			
		||||
    }
 | 
			
		||||
    switch(clicked_button)
 | 
			
		||||
    {
 | 
			
		||||
@ -2135,6 +2140,12 @@ void Button_Pecondary_palette(void)
 | 
			
		||||
        Num2str(256-Window_attribute2,str,3);
 | 
			
		||||
        Print_in_window(157,89,str,MC_Black,MC_Light);
 | 
			
		||||
        break;
 | 
			
		||||
      case 8:
 | 
			
		||||
        palette_vertical = !palette_vertical;
 | 
			
		||||
        Hide_cursor();
 | 
			
		||||
        Print_in_window(38,108,(palette_vertical)?"X":" ",MC_Black,MC_Light);
 | 
			
		||||
        Display_cursor();
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  while (clicked_button!=1 && clicked_button!=3 && clicked_button!=4);
 | 
			
		||||
@ -2146,12 +2157,16 @@ void Button_Pecondary_palette(void)
 | 
			
		||||
  if (clicked_button==4) // Cancel
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  if (palette_vertical != Config.Palette_vertical)
 | 
			
		||||
  {
 | 
			
		||||
    Config.Palette_vertical=palette_vertical;
 | 
			
		||||
    palette_needs_redraw=1;
 | 
			
		||||
  }
 | 
			
		||||
  if (columns_slider->Position!=256-Config.Palette_cells_X ||
 | 
			
		||||
    lines_slider->Position!=16-Config.Palette_cells_Y)
 | 
			
		||||
  {
 | 
			
		||||
    Config.Palette_cells_X = 256-columns_slider->Position;
 | 
			
		||||
    Config.Palette_cells_Y = 16-lines_slider->Position;
 | 
			
		||||
    Change_palette_cells();
 | 
			
		||||
    palette_needs_redraw=1;
 | 
			
		||||
  }
 | 
			
		||||
  if (rgb_scale_slider->Position!=256-RGB_scale)
 | 
			
		||||
@ -2165,5 +2180,9 @@ void Button_Pecondary_palette(void)
 | 
			
		||||
    Menu_tag_colors("Tag colors to exclude",Exclude_color,&dummy,1, NULL);
 | 
			
		||||
  }
 | 
			
		||||
  if (palette_needs_redraw)
 | 
			
		||||
  {
 | 
			
		||||
    Change_palette_cells();
 | 
			
		||||
    Display_menu();
 | 
			
		||||
    Display_sprite_in_menu(BUTTON_PAL_LEFT,18+(Config.Palette_vertical!=0));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@
 | 
			
		||||
    59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
*/
 | 
			
		||||
void Button_Palette(void);
 | 
			
		||||
void Button_Pecondary_palette(void);
 | 
			
		||||
void Button_Secondary_palette(void);
 | 
			
		||||
 | 
			
		||||
// Choose the number of graduations for RGB components, from 2 to 256.
 | 
			
		||||
void Set_palette_RGB_scale(int);
 | 
			
		||||
 | 
			
		||||
@ -765,7 +765,14 @@ int Load_INI(T_Config * conf)
 | 
			
		||||
    else
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  conf->Palette_vertical=0;
 | 
			
		||||
  // Optionnel, vertical palette option (>98.0%)
 | 
			
		||||
  if (!Load_INI_get_values (file,buffer,"Palette_vertical",1,values))
 | 
			
		||||
  {
 | 
			
		||||
    if ((values[0]<0) || (values[0]>1))
 | 
			
		||||
      goto Erreur_ERREUR_INI_CORROMPU;
 | 
			
		||||
    conf->Palette_vertical=values[0];
 | 
			
		||||
  }
 | 
			
		||||
  fclose(file);
 | 
			
		||||
 | 
			
		||||
  free(filename);
 | 
			
		||||
 | 
			
		||||
@ -627,6 +627,10 @@ int Save_INI(T_Config * conf)
 | 
			
		||||
    if ((return_code=Save_INI_set_strings (Ancien_fichier,Nouveau_fichier,buffer,"Bookmark_directory",conf->Bookmark_directory[index])))
 | 
			
		||||
      goto Erreur_Retour;
 | 
			
		||||
  }
 | 
			
		||||
  values[0]=(conf->Palette_vertical);
 | 
			
		||||
  if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Palette_vertical",1,values,1)))
 | 
			
		||||
    goto Erreur_Retour;
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
  Save_INI_flush(Ancien_fichier,Nouveau_fichier,buffer);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								struct.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								struct.h
									
									
									
									
									
								
							@ -238,6 +238,7 @@ typedef struct
 | 
			
		||||
  byte Couleurs_separees;
 | 
			
		||||
  word Palette_cells_X;
 | 
			
		||||
  word Palette_cells_Y;
 | 
			
		||||
  byte Palette_vertical;
 | 
			
		||||
  byte FX_Feedback;
 | 
			
		||||
  byte Safety_colors;
 | 
			
		||||
  byte Opening_message;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										134
									
								
								windows.c
									
									
									
									
									
								
							
							
						
						
									
										134
									
								
								windows.c
									
									
									
									
									
								
							@ -157,8 +157,40 @@ void Display_foreback(void)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  // -- Tracer un cadre de couleur autour de la Fore_color dans le menu --
 | 
			
		||||
/*! Get the top left corner for the palette cell of a color
 | 
			
		||||
    @param index Index of the color, starting at 0 for the top left one. Limited to Menu_cells_X/Menu_cells_Y.
 | 
			
		||||
*/
 | 
			
		||||
word Palette_cell_X(byte index)
 | 
			
		||||
{
 | 
			
		||||
  if (Config.Palette_vertical)
 | 
			
		||||
  {
 | 
			
		||||
    return (MENU_WIDTH+1+((index-First_color_in_palette)%Menu_cells_X)*Menu_palette_cell_width)*Menu_factor_X;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    return (MENU_WIDTH+1+((index-First_color_in_palette)/Menu_cells_Y)*Menu_palette_cell_width)*Menu_factor_X;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*! Get the top left corner for the palette cell of a color
 | 
			
		||||
    @param index Index of the color, starting at 0 for the top left one. Limited to Menu_cells_X/Menu_cells_Y.
 | 
			
		||||
*/
 | 
			
		||||
word Palette_cell_Y(byte index)
 | 
			
		||||
{
 | 
			
		||||
  if (Config.Palette_vertical)
 | 
			
		||||
  {
 | 
			
		||||
    return Menu_Y+((2+(((index-First_color_in_palette)/Menu_cells_X)*(32/Menu_cells_Y)))*Menu_factor_Y);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    return Menu_Y+((2+(((index-First_color_in_palette)%Menu_cells_Y)*(32/Menu_cells_Y)))*Menu_factor_Y);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///
 | 
			
		||||
/// Redraw the cell in the menu palette for ::Fore_color.
 | 
			
		||||
/// This function checks bounds, it won't draw anything if Fore_color is not visible.
 | 
			
		||||
/// @param color: Pass MC_White to mark the color with a frame, MC_Black to unmark it.
 | 
			
		||||
void Frame_menu_color(byte color)
 | 
			
		||||
{
 | 
			
		||||
  word start_x,start_y,end_x,end_y;
 | 
			
		||||
@ -169,8 +201,8 @@ void Frame_menu_color(byte color)
 | 
			
		||||
  {
 | 
			
		||||
    if (Config.Couleurs_separees)
 | 
			
		||||
    {
 | 
			
		||||
      start_x=(MENU_WIDTH+((Fore_color-First_color_in_palette)/Menu_cells_Y)*Menu_palette_cell_width)*Menu_factor_X;
 | 
			
		||||
      start_y=Menu_Y+((1+(((Fore_color-First_color_in_palette)%Menu_cells_Y)*cell_height))*Menu_factor_Y);
 | 
			
		||||
      start_x=Palette_cell_X(Fore_color)-1*Menu_factor_X;
 | 
			
		||||
      start_y=Palette_cell_Y(Fore_color)-1*Menu_factor_Y;
 | 
			
		||||
 | 
			
		||||
      Block(start_x,start_y,(Menu_palette_cell_width+1)*Menu_factor_X,Menu_factor_Y,color);
 | 
			
		||||
      Block(start_x,start_y+(Menu_factor_Y*cell_height),(Menu_palette_cell_width+1)*Menu_factor_X,Menu_factor_Y,color);
 | 
			
		||||
@ -184,39 +216,40 @@ void Frame_menu_color(byte color)
 | 
			
		||||
    {
 | 
			
		||||
      if (color==MC_Black)
 | 
			
		||||
      {
 | 
			
		||||
        start_x=(MENU_WIDTH+1+((Fore_color-First_color_in_palette)/Menu_cells_Y)*Menu_palette_cell_width)*Menu_factor_X;
 | 
			
		||||
        start_y=Menu_Y+((2+(((Fore_color-First_color_in_palette)%Menu_cells_Y)*cell_height))*Menu_factor_Y);
 | 
			
		||||
        start_x=Palette_cell_X(Fore_color);
 | 
			
		||||
        start_y=Palette_cell_Y(Fore_color);
 | 
			
		||||
 | 
			
		||||
        Block(start_x,start_y,Menu_palette_cell_width*Menu_factor_X,
 | 
			
		||||
              Menu_factor_Y*cell_height,Fore_color);
 | 
			
		||||
              cell_height*Menu_factor_Y,Fore_color);
 | 
			
		||||
 | 
			
		||||
        Update_rect(start_x,start_y,Menu_palette_cell_width*Menu_factor_X,Menu_factor_Y*cell_height);
 | 
			
		||||
        Update_rect(start_x,start_y,Menu_palette_cell_width*Menu_factor_X,cell_height*Menu_factor_Y);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        start_x=MENU_WIDTH+1+((Fore_color-First_color_in_palette)/Menu_cells_Y)*Menu_palette_cell_width;
 | 
			
		||||
        start_y=2+(((Fore_color-First_color_in_palette)%Menu_cells_Y)*cell_height);
 | 
			
		||||
        start_x=Palette_cell_X(Fore_color);
 | 
			
		||||
        start_y=Palette_cell_Y(Fore_color);
 | 
			
		||||
 | 
			
		||||
        end_x=start_x+Menu_palette_cell_width-1;
 | 
			
		||||
        end_y=start_y+cell_height-1;
 | 
			
		||||
        end_x=Menu_palette_cell_width-1;
 | 
			
		||||
        end_y=cell_height-1;
 | 
			
		||||
 | 
			
		||||
        for (index=start_x; index<=end_x; index++)
 | 
			
		||||
          Block(index*Menu_factor_X,Menu_Y+(start_y*Menu_factor_Y),
 | 
			
		||||
        // Top line
 | 
			
		||||
        for (index=0; index<=end_x; index++)
 | 
			
		||||
          Block(start_x+index*Menu_factor_X,start_y,
 | 
			
		||||
                Menu_factor_X,Menu_factor_Y,
 | 
			
		||||
                ((index+start_y)&1)?MC_White:MC_Black);
 | 
			
		||||
 | 
			
		||||
        for (index=start_y+1; index<end_y; index++)
 | 
			
		||||
          Block(start_x*Menu_factor_X,Menu_Y+(index*Menu_factor_Y),
 | 
			
		||||
                ((index)&1)?MC_White:MC_Black);
 | 
			
		||||
        // Left line
 | 
			
		||||
        for (index=1; index<end_y; index++)
 | 
			
		||||
          Block(start_x,start_y+index*Menu_factor_Y,
 | 
			
		||||
                Menu_factor_X,Menu_factor_Y,
 | 
			
		||||
                ((index+start_x)&1)?MC_White:MC_Black);
 | 
			
		||||
 | 
			
		||||
        for (index=start_y+1; index<end_y; index++)
 | 
			
		||||
          Block(end_x*Menu_factor_X,Menu_Y+(index*Menu_factor_Y),
 | 
			
		||||
                ((index)&1)?MC_White:MC_Black);
 | 
			
		||||
        // Right line
 | 
			
		||||
        for (index=1; index<end_y; index++)
 | 
			
		||||
          Block(start_x+end_x*Menu_factor_Y,start_y+index*Menu_factor_Y,
 | 
			
		||||
                Menu_factor_X,Menu_factor_Y,
 | 
			
		||||
                ((index+end_x)&1)?MC_White:MC_Black);
 | 
			
		||||
 | 
			
		||||
        for (index=start_x; index<=end_x; index++)
 | 
			
		||||
          Block(index*Menu_factor_X,Menu_Y+(end_y*Menu_factor_Y),
 | 
			
		||||
        // Bottom line
 | 
			
		||||
        for (index=0; index<=end_x; index++)
 | 
			
		||||
          Block(start_x+index*Menu_factor_X,start_y+end_y*Menu_factor_Y,
 | 
			
		||||
                Menu_factor_X,Menu_factor_Y,
 | 
			
		||||
                ((index+end_y)&1)?MC_White:MC_Black);
 | 
			
		||||
 | 
			
		||||
@ -239,19 +272,19 @@ void Display_menu_palette(void)
 | 
			
		||||
    Block(MENU_WIDTH*Menu_factor_X,Menu_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),(MENU_HEIGHT-9)*Menu_factor_Y,MC_Black);
 | 
			
		||||
 | 
			
		||||
    if (Config.Couleurs_separees)
 | 
			
		||||
      for (color=0;First_color_in_palette+color<256&&color<Menu_cells_X*Menu_cells_Y;color++)
 | 
			
		||||
        Block((MENU_WIDTH+1+(color/Menu_cells_Y)*Menu_palette_cell_width)*Menu_factor_X,
 | 
			
		||||
              Menu_Y+((2+((color%Menu_cells_Y)*cell_height))*Menu_factor_Y),
 | 
			
		||||
      for (color=First_color_in_palette;color<256&&(color-First_color_in_palette)<Menu_cells_X*Menu_cells_Y;color++)
 | 
			
		||||
        Block(Palette_cell_X(color),
 | 
			
		||||
              Palette_cell_Y(color),
 | 
			
		||||
              (Menu_palette_cell_width-1)*Menu_factor_X,
 | 
			
		||||
              Menu_factor_Y*(cell_height-1),
 | 
			
		||||
              First_color_in_palette+color);
 | 
			
		||||
              (cell_height-1)*Menu_factor_Y,
 | 
			
		||||
              color);
 | 
			
		||||
    else
 | 
			
		||||
      for (color=0;First_color_in_palette+color<256&&color<Menu_cells_X*Menu_cells_Y;color++)
 | 
			
		||||
        Block((MENU_WIDTH+1+(color/Menu_cells_Y)*Menu_palette_cell_width)*Menu_factor_X,
 | 
			
		||||
              Menu_Y+((2+((color%Menu_cells_Y)*cell_height))*Menu_factor_Y),
 | 
			
		||||
      for (color=First_color_in_palette;color<256&&color-First_color_in_palette<Menu_cells_X*Menu_cells_Y;color++)
 | 
			
		||||
        Block(Palette_cell_X(color),
 | 
			
		||||
              Palette_cell_Y(color),
 | 
			
		||||
              Menu_palette_cell_width*Menu_factor_X,
 | 
			
		||||
              Menu_factor_Y*cell_height,
 | 
			
		||||
              First_color_in_palette+color);
 | 
			
		||||
              cell_height*Menu_factor_Y,
 | 
			
		||||
              color);
 | 
			
		||||
 | 
			
		||||
    Frame_menu_color(MC_White);
 | 
			
		||||
    Update_rect(MENU_WIDTH*Menu_factor_X,Menu_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),(MENU_HEIGHT-9)*Menu_factor_Y);
 | 
			
		||||
@ -264,16 +297,22 @@ void Display_menu_palette(void)
 | 
			
		||||
void Reposition_palette(void)
 | 
			
		||||
{
 | 
			
		||||
  byte old_color=First_color_in_palette;
 | 
			
		||||
  short cells;
 | 
			
		||||
  if (Config.Palette_vertical)
 | 
			
		||||
    cells=Menu_cells_X;
 | 
			
		||||
  else
 | 
			
		||||
    cells=Menu_cells_Y;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
  if (Fore_color<First_color_in_palette)
 | 
			
		||||
  {
 | 
			
		||||
    while (Fore_color<First_color_in_palette)
 | 
			
		||||
      First_color_in_palette-=Menu_cells_Y;
 | 
			
		||||
      First_color_in_palette-=cells;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    while (Fore_color>=First_color_in_palette+Menu_cells_X*Menu_cells_Y)
 | 
			
		||||
      First_color_in_palette+=Menu_cells_Y;
 | 
			
		||||
      First_color_in_palette+=cells;
 | 
			
		||||
  }
 | 
			
		||||
  if (old_color!=First_color_in_palette)
 | 
			
		||||
    Display_menu_palette();
 | 
			
		||||
@ -300,7 +339,10 @@ void Change_palette_cells()
 | 
			
		||||
    Menu_cells_X--;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  // Cale First_color_in_palette sur un multiple de cells_y (arrondi inférieur)
 | 
			
		||||
  // Cale First_color_in_palette sur un multiple du nombre de cellules (arrondi inférieur)
 | 
			
		||||
  if (Config.Palette_vertical)
 | 
			
		||||
    First_color_in_palette=First_color_in_palette/Menu_cells_X*Menu_cells_X;
 | 
			
		||||
  else
 | 
			
		||||
    First_color_in_palette=First_color_in_palette/Menu_cells_Y*Menu_cells_Y;
 | 
			
		||||
 | 
			
		||||
  // Si le nombre de cellules a beaucoup augmenté et qu'on était près de
 | 
			
		||||
@ -325,10 +367,18 @@ int Pick_color_in_palette()
 | 
			
		||||
{
 | 
			
		||||
  int color;
 | 
			
		||||
  int line;
 | 
			
		||||
  line=(((Mouse_Y-Menu_Y)/Menu_factor_Y)-2)/(32/Menu_cells_Y);
 | 
			
		||||
  int column;
 | 
			
		||||
 | 
			
		||||
  color=First_color_in_palette+line+
 | 
			
		||||
    ((((Mouse_X/Menu_factor_X)-(MENU_WIDTH+1))/Menu_palette_cell_width)*Menu_cells_Y);
 | 
			
		||||
  line=(((Mouse_Y-Menu_Y)/Menu_factor_Y)-2)/(32/Menu_cells_Y);
 | 
			
		||||
  column=(((Mouse_X/Menu_factor_X)-(MENU_WIDTH+1))/Menu_palette_cell_width);
 | 
			
		||||
  if (Config.Palette_vertical)
 | 
			
		||||
  {
 | 
			
		||||
    color=First_color_in_palette+line*Menu_cells_X+column;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    color=First_color_in_palette+line+column*Menu_cells_Y;
 | 
			
		||||
  }
 | 
			
		||||
  if (color<0 || color>255)
 | 
			
		||||
    return -1;
 | 
			
		||||
  return color;
 | 
			
		||||
@ -1025,8 +1075,8 @@ void Display_menu_palette_avoiding_window(byte * table)
 | 
			
		||||
  {
 | 
			
		||||
    if (table[real_color]!=real_color)
 | 
			
		||||
    {
 | 
			
		||||
      start_x=(MENU_WIDTH+1+(color/Menu_cells_Y)*Menu_palette_cell_width)*Menu_factor_X;
 | 
			
		||||
      start_y=Menu_Y_before_window+((2+((color%Menu_cells_Y)*(32/Menu_cells_Y)))*Menu_factor_Y);
 | 
			
		||||
      start_x=Palette_cell_X(real_color);
 | 
			
		||||
      start_y=Palette_cell_Y(real_color); //Menu_Y_before_window ??!
 | 
			
		||||
      end_x=start_x+width;
 | 
			
		||||
      end_y=start_y+height;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user