~ubuntu-branches/ubuntu/trusty/grafx2/trusty

« back to all changes in this revision

Viewing changes to init.c

  • Committer: Bazaar Package Importer
  • Author(s): Gürkan Sengün
  • Date: 2009-09-21 14:24:19 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090921142419-lhpqq102buior0ol
Tags: 2.1-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
#include "init.h"
67
67
#include "transform.h"
68
68
 
 
69
char Gui_loading_error_message[512];
69
70
 
70
71
// Rechercher la liste et le type des lecteurs de la machine
71
72
 
74
75
#endif
75
76
 
76
77
// Fonctions de lecture dans la skin de l'interface graphique
77
 
void GUI_seek_down(SDL_Surface *gui, int *start_x, int *start_y, byte neutral_color,char * section)
 
78
byte GUI_seek_down(SDL_Surface *gui, int *start_x, int *start_y, byte neutral_color,char * section)
78
79
{
79
80
  byte color;
80
81
  int y;
86
87
    if (color!=neutral_color)
87
88
    {
88
89
      *start_y=y;
89
 
      return;
 
90
      return 0;
90
91
    }
91
92
    y++;
92
93
  } while (y<gui->h);
93
94
  
94
 
  printf("Error in skin file: Was looking down from %d,%d for a '%s', and reached the end of the image\n",
 
95
  sprintf(Gui_loading_error_message, "Error in skin file: Was looking down from %d,%d for a '%s', and reached the end of the image\n",
95
96
    *start_x, *start_y, section);
96
 
  Error(ERROR_GUI_CORRUPTED);
 
97
  return 1;
97
98
}
98
99
 
99
 
void GUI_seek_right(SDL_Surface *gui, int *start_x, int start_y, byte neutral_color, char * section)
 
100
byte GUI_seek_right(SDL_Surface *gui, int *start_x, int start_y, byte neutral_color, char * section)
100
101
{
101
102
  byte color;
102
103
  int x;
108
109
    if (color!=neutral_color)
109
110
    {
110
111
      *start_x=x;
111
 
      return;
 
112
      return 0;
112
113
    }
113
114
    x++;
114
115
  } while (x<gui->w);
115
116
  
116
 
  printf("Error in skin file: Was looking right from %d,%d for a '%s', and reached the edege of the image\n",
 
117
  sprintf(Gui_loading_error_message, "Error in skin file: Was looking right from %d,%d for a '%s', and reached the edege of the image\n",
117
118
    *start_x, start_y, section);
118
 
  Error(ERROR_GUI_CORRUPTED);
 
119
  return 1;
119
120
}
120
121
 
121
 
void Read_GUI_block(SDL_Surface *gui, int start_x, int start_y, void *dest, int width, int height, char * section, int type)
 
122
byte Read_GUI_block(SDL_Surface *gui, int start_x, int start_y, void *dest, int width, int height, char * section, int type)
122
123
{
123
124
  // type: 0 = normal GUI element, only 4 colors allowed
124
125
  // type: 1 = mouse cursor, 4 colors allowed + transparent
132
133
  // Verification taille
133
134
  if (start_y+height>=gui->h || start_x+width>=gui->w)
134
135
  {
135
 
    printf("Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but it doesn't fit the image.\n",
 
136
    sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but it doesn't fit the image.\n",
136
137
      start_x, start_y, height, width, section);
137
 
    Error(ERROR_GUI_CORRUPTED);
 
138
    return 1;
138
139
  }
139
140
 
140
141
  for (y=start_y; y<start_y+height; y++)
144
145
      color=Get_SDL_pixel_8(gui,x,y);
145
146
      if (type==0 && (color != MC_Black && color != MC_Dark && color != MC_Light && color != MC_White))
146
147
      {
147
 
        printf("Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the GUI colors (which were detected as %d,%d,%d,%d.\n",
 
148
        sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the GUI colors (which were detected as %d,%d,%d,%d.\n",
148
149
          start_x, start_y, height, width, section, x, y, color, MC_Black, MC_Dark, MC_Light, MC_White);
149
 
        Error(ERROR_GUI_CORRUPTED);
 
150
        return 1;
150
151
      }
151
152
      if (type==1 && (color != MC_Black && color != MC_Dark && color != MC_Light && color != MC_White && color != MC_Trans))
152
153
      {
153
 
        printf("Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the mouse colors (which were detected as %d,%d,%d,%d,%d.\n",
 
154
        sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the mouse colors (which were detected as %d,%d,%d,%d,%d.\n",
154
155
          start_x, start_y, height, width, section, x, y, color, MC_Black, MC_Dark, MC_Light, MC_White, MC_Trans);
155
 
        Error(ERROR_GUI_CORRUPTED);
 
156
        return 1;
156
157
      }
157
158
      if (type==2)
158
159
      {
159
160
        if (color != MC_White && color != MC_Trans)
160
161
        {
161
 
          printf("Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the brush colors (which were detected as %d on %d.\n",
 
162
          sprintf(Gui_loading_error_message, "Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the brush colors (which were detected as %d on %d.\n",
162
163
            start_x, start_y, height, width, section, x, y, color, MC_White, MC_Trans);
163
 
          Error(ERROR_GUI_CORRUPTED);
 
164
          return 1;
164
165
        }
165
166
        // Conversion en 0/1 pour les brosses monochromes internes
166
167
        color = (color != MC_Trans);
169
170
      dest_ptr++;
170
171
    }
171
172
  }
 
173
  return 0;
172
174
}
173
175
 
174
 
void Read_GUI_pattern(SDL_Surface *gui, int start_x, int start_y, word *dest, char * section)
 
176
byte Read_GUI_pattern(SDL_Surface *gui, int start_x, int start_y, word *dest, char * section)
175
177
{
176
178
  byte buffer[256];
177
179
  int x,y;
178
180
  
179
 
  Read_GUI_block(gui, start_x, start_y, buffer, 16, 16, section, 2);
 
181
  if (Read_GUI_block(gui, start_x, start_y, buffer, 16, 16, section, 2))
 
182
    return 1;
180
183
 
181
184
  for (y=0; y<16; y++)
182
185
  {
187
190
    }
188
191
    dest++;
189
192
  }
 
193
  return 0;
190
194
}
191
195
 
192
 
void Center_GUI_cursor(byte *cursor_buffer, int cursor_number)
 
196
void Center_GUI_cursor(T_Gui_skin *gfx, byte *cursor_buffer, int cursor_number)
193
197
{
194
 
  // GFX_cursor_sprite[i]
195
 
  //Cursor_offset_X[CURSOR_SHAPE_ARROW]=0;
196
 
  //Cursor_offset_Y[CURSOR_SHAPE_ARROW]=0;
197
198
  int x,y;
198
199
  int start_x, start_y;
199
200
  byte found;
228
229
    if (found)
229
230
      break;
230
231
  }
231
 
  Cursor_offset_X[cursor_number]=14-start_x;
232
 
  Cursor_offset_Y[cursor_number]=14-start_y;
 
232
  gfx->Cursor_offset_X[cursor_number]=14-start_x;
 
233
  gfx->Cursor_offset_Y[cursor_number]=14-start_y;
233
234
 
234
235
  for (y=0;y<CURSOR_SPRITE_HEIGHT;y++)
235
236
    for (x=0;x<CURSOR_SPRITE_WIDTH;x++)
236
 
      GFX_cursor_sprite[cursor_number][y][x]=cursor_buffer[(start_y+y)*29+start_x+x];
 
237
      gfx->Cursor_sprite[cursor_number][y][x]=cursor_buffer[(start_y+y)*29+start_x+x];
237
238
}
238
239
 
239
 
void Load_graphics(const char * skin_file)
 
240
byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
240
241
{
241
242
  int  index;
242
 
  char filename[MAX_PATH_CHARACTERS];
243
 
  SDL_Surface * gui;
244
 
  SDL_Palette * SDLPal;
245
243
  int i;
246
244
  int cursor_x=0,cursor_y=0;
247
245
  byte color;
251
249
  int char_3=0;  // l'une des fontes dans l'ordre :  1 2
252
250
  int char_4=0;  //                                  3 4
253
251
  byte mouse_cursor_area[29][29];
254
 
  
255
 
  // Lecture du fichier "skin"
256
 
  strcpy(filename,Data_directory);
257
 
  strcat(filename,skin_file);
258
 
  
259
 
  gui=IMG_Load(filename);
260
 
  if (!gui)
261
 
  {
262
 
    Error(ERROR_GUI_MISSING);
263
 
  }
 
252
  SDL_Palette * SDLPal;
 
253
  
 
254
  // Default palette
264
255
  if (!gui->format || gui->format->BitsPerPixel != 8)
265
256
  {
266
 
    printf("Not a 8-bit image");
267
 
    Error(ERROR_GUI_CORRUPTED);
 
257
    sprintf(Gui_loading_error_message, "Not a 8-bit image");
 
258
    return 1;
268
259
  }
269
260
  SDLPal=gui->format->palette;
270
261
  if (!SDLPal || SDLPal->ncolors!=256)
271
262
  {
272
 
    printf("Not a 256-color palette");
273
 
    Error(ERROR_GUI_CORRUPTED);
 
263
    sprintf(Gui_loading_error_message, "Not a 256-color palette");
 
264
    return 1;
274
265
  }
275
 
  // Lecture de la palette par d�faut
 
266
  // Read the default palette
276
267
  for (i=0; i<256; i++)
277
268
  {
278
 
    Default_palette[i].R=SDLPal->colors[i].r;
279
 
    Default_palette[i].G=SDLPal->colors[i].g;
280
 
    Default_palette[i].B=SDLPal->colors[i].b;
 
269
    gfx->Default_palette[i].R=SDLPal->colors[i].r;
 
270
    gfx->Default_palette[i].G=SDLPal->colors[i].g;
 
271
    gfx->Default_palette[i].B=SDLPal->colors[i].b;
281
272
  }
282
 
  
 
273
 
283
274
  // Carr� "noir"
284
275
  MC_Black = Get_SDL_pixel_8(gui,cursor_x,cursor_y);
285
276
  do
286
277
  {
287
278
    if (++cursor_x>=gui->w)
288
279
    {
289
 
      printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
290
 
      Error(ERROR_GUI_CORRUPTED);
 
280
      sprintf(Gui_loading_error_message, "Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
 
281
      return 1;
291
282
    }
292
283
    color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
293
284
  } while(color==MC_Black);
297
288
  {
298
289
    if (++cursor_x>=gui->w)
299
290
    {
300
 
      printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
301
 
      Error(ERROR_GUI_CORRUPTED);
 
291
      sprintf(Gui_loading_error_message, "Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
 
292
      return 1;
302
293
    }
303
294
    color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
304
295
  } while(color==MC_Dark);
308
299
  {
309
300
    if (++cursor_x>gui->w)
310
301
    {
311
 
      printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
312
 
      Error(ERROR_GUI_CORRUPTED);
 
302
      sprintf(Gui_loading_error_message, "Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
 
303
      return 1;
313
304
    }
314
305
    color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
315
306
  } while(color==MC_Light);
319
310
  {
320
311
    if (++cursor_x>=gui->w)
321
312
    {
322
 
      printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
323
 
      Error(ERROR_GUI_CORRUPTED);
 
313
      sprintf(Gui_loading_error_message, "Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
 
314
      return 1;
324
315
    }
325
316
    color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
326
317
  } while(color==MC_White);
330
321
  {
331
322
    if (++cursor_x>=gui->w)
332
323
    {
333
 
      printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
334
 
      Error(ERROR_GUI_CORRUPTED);
 
324
      sprintf(Gui_loading_error_message, "Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
 
325
      return 1;
335
326
    }
336
327
    color=Get_SDL_pixel_8(gui,cursor_x,cursor_y);
337
328
  } while(color==MC_Trans);
346
337
    cursor_y++;
347
338
    if (cursor_y>=gui->h)
348
339
    {
349
 
      printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
350
 
      Error(ERROR_GUI_CORRUPTED);
 
340
      sprintf(Gui_loading_error_message, "Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
 
341
      return 1;
351
342
    }
352
343
  }
353
344
  
354
345
  // Menu
355
 
  GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu");
356
 
  Read_GUI_block(gui, cursor_x, cursor_y, GFX_menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0);
 
346
  if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu"))
 
347
    return 1;
 
348
  if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0))
 
349
    return 1;
357
350
  cursor_y+=MENU_HEIGHT;
358
351
 
359
352
  // Effets
360
353
  for (i=0; i<NB_EFFECTS_SPRITES; i++)
361
354
  {
362
355
    if (i==0)
363
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "effect sprite");
 
356
    {
 
357
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "effect sprite"))
 
358
        return 1;
 
359
    }
364
360
    else
365
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "effect sprite");
366
 
    Read_GUI_block(gui, cursor_x, cursor_y, GFX_effect_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "effect sprite",0);
 
361
    {
 
362
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "effect sprite"))
 
363
        return 1;
 
364
    }
 
365
    if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Effect_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "effect sprite",0))
 
366
      return 1;
367
367
    cursor_x+=MENU_SPRITE_WIDTH;
368
368
  }
369
369
  cursor_y+=MENU_SPRITE_HEIGHT;
372
372
  for (i=0; i<NB_CURSOR_SPRITES; i++)
373
373
  {
374
374
    if (i==0)
375
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "mouse cursor");
 
375
    {
 
376
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "mouse cursor"))
 
377
        return 1;
 
378
    }
376
379
    else
377
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "mouse cursor");
378
 
    Read_GUI_block(gui, cursor_x, cursor_y, mouse_cursor_area, 29, 29, "mouse cursor",1);
379
 
    Center_GUI_cursor((byte *)mouse_cursor_area,i);
 
380
    {
 
381
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "mouse cursor"))
 
382
        return 1;
 
383
    }
 
384
    if (Read_GUI_block(gui, cursor_x, cursor_y, mouse_cursor_area, 29, 29, "mouse cursor",1))
 
385
      return 1;
 
386
    Center_GUI_cursor(gfx, (byte *)mouse_cursor_area,i);
380
387
    cursor_x+=29;
381
388
  }
382
389
  cursor_y+=29;
385
392
  for (i=0; i<NB_MENU_SPRITES; i++)
386
393
  {
387
394
    if (i==0)
388
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu sprite");
 
395
    {
 
396
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu sprite"))
 
397
        return 1;
 
398
    }
389
399
    else
390
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "menu sprite");
391
 
    Read_GUI_block(gui, cursor_x, cursor_y, GFX_menu_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1);
 
400
    {
 
401
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "menu sprite"))
 
402
        return 1;
 
403
    }
 
404
    if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_sprite[i], MENU_SPRITE_WIDTH, MENU_SPRITE_HEIGHT, "menu sprite",1))
 
405
      return 1;
392
406
    cursor_x+=MENU_SPRITE_WIDTH;
393
407
  }
394
408
  cursor_y+=MENU_SPRITE_HEIGHT;
401
415
    {
402
416
      if (i!=0)
403
417
        cursor_y+=PAINTBRUSH_HEIGHT;
404
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "brush icon");
 
418
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "brush icon"))
 
419
        return 1;
405
420
    }
406
421
    else
407
422
    {
408
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "brush icon");
 
423
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "brush icon"))
 
424
        return 1;
409
425
    }
410
 
    Read_GUI_block(gui, cursor_x, cursor_y, GFX_paintbrush_sprite[i], PAINTBRUSH_WIDTH, PAINTBRUSH_HEIGHT, "brush icon",2);
 
426
    if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Paintbrush_sprite[i], PAINTBRUSH_WIDTH, PAINTBRUSH_HEIGHT, "brush icon",2))
 
427
      return 1;
411
428
    cursor_x+=PAINTBRUSH_WIDTH;
412
429
  }
413
430
  cursor_y+=PAINTBRUSH_HEIGHT;
416
433
  for (i=0; i<NB_ICON_SPRITES; i++)
417
434
  {
418
435
    if (i==0)
419
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sprite drive");
 
436
    {
 
437
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sprite drive"))
 
438
        return 1;
 
439
    }
420
440
    else
421
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sprite drive");
422
 
    Read_GUI_block(gui, cursor_x, cursor_y, GFX_icon_sprite[i], ICON_SPRITE_WIDTH, ICON_SPRITE_HEIGHT, "sprite drive",1);
 
441
    {
 
442
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sprite drive"))
 
443
        return 1;
 
444
    }
 
445
    if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Icon_sprite[i], ICON_SPRITE_WIDTH, ICON_SPRITE_HEIGHT, "sprite drive",1))
 
446
      return 1;
423
447
    cursor_x+=ICON_SPRITE_WIDTH;
424
448
  }
425
449
  cursor_y+=ICON_SPRITE_HEIGHT;
426
450
 
427
451
  // Logo splash screen
428
 
  if (!(GFX_logo_grafx2=(byte *)malloc(231*56)))
429
 
    Error(ERROR_MEMORY);
430
452
 
431
 
  GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "logo menu");
432
 
  Read_GUI_block(gui, cursor_x, cursor_y, GFX_logo_grafx2, 231, 56, "logo menu",3);
 
453
  if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "logo menu"))
 
454
    return 1;
 
455
  if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Logo_grafx2, 231, 56, "logo menu",3))
 
456
    return 1;
433
457
  cursor_y+=56;
434
458
  
435
459
  // Trames
436
460
  for (i=0; i<NB_PRESET_SIEVE; i++)
437
461
  {
438
462
    if (i==0)
439
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sieve pattern");
 
463
    {
 
464
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "sieve pattern"))
 
465
        return 1;
 
466
    }
440
467
    else
441
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sieve pattern");
442
 
    Read_GUI_pattern(gui, cursor_x, cursor_y, GFX_sieve_pattern[i],"sieve pattern");
 
468
    {
 
469
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "sieve pattern"))
 
470
        return 1;
 
471
    }
 
472
    if (Read_GUI_pattern(gui, cursor_x, cursor_y, gfx->Sieve_pattern[i],"sieve pattern"))
 
473
      return 1;
443
474
    cursor_x+=16;
444
475
  }
445
476
  cursor_y+=16;
446
 
  
447
 
  // Font Syst�me
448
 
  for (i=0; i<256; i++)
449
 
  {
450
 
    // Rang�s par ligne de 32
451
 
    if ((i%32)==0)
452
 
    {
453
 
      if (i!=0)
454
 
        cursor_y+=8;
455
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "system font");
456
 
    }
457
 
    else
458
 
    {
459
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "system font");
460
 
    }
461
 
    Read_GUI_block(gui, cursor_x, cursor_y, &GFX_system_font[i*64], 8, 8, "system font",2);
462
 
    cursor_x+=8;
463
 
  }
464
 
  cursor_y+=8;
465
 
  Menu_font=GFX_system_font;
466
 
 
467
 
  // Font Fun
468
 
  for (i=0; i<256; i++)
469
 
  {
470
 
    // Rang�s par ligne de 32
471
 
    if ((i%32)==0)
472
 
    {
473
 
      if (i!=0)
474
 
        cursor_y+=8;
475
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "fun font");
476
 
    }
477
 
    else
478
 
    {
479
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "fun font");
480
 
    }
481
 
    Read_GUI_block(gui, cursor_x, cursor_y, &GFX_fun_font[i*64], 8, 8, "fun font",2);
482
 
    cursor_x+=8;
483
 
  }
484
 
  cursor_y+=8;
485
477
 
486
478
  // Font help normale
487
479
  for (i=0; i<256; i++)
491
483
    {
492
484
      if (i!=0)
493
485
        cursor_y+=8;
494
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "help font (norm)");
 
486
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "help font (norm)"))
 
487
        return 1;
495
488
    }
496
489
    else
497
490
    {
498
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (norm)");
 
491
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (norm)"))
 
492
        return 1;
499
493
    }
500
 
    Read_GUI_block(gui, cursor_x, cursor_y, &(GFX_help_font_norm[i][0][0]), 6, 8, "help font (norm)",0);
 
494
    if (Read_GUI_block(gui, cursor_x, cursor_y, &(gfx->Help_font_norm[i][0][0]), 6, 8, "help font (norm)",0))
 
495
      return 1;
501
496
    cursor_x+=6;
502
497
  }
503
498
  cursor_y+=8;
510
505
    {
511
506
      if (i!=0)
512
507
        cursor_y+=8;
513
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "help font (bold)");
 
508
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "help font (bold)"))
 
509
        return 1;
514
510
    }
515
511
    else
516
512
    {
517
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (bold)");
 
513
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (bold)"))
 
514
        return 1;
518
515
    }
519
 
    Read_GUI_block(gui, cursor_x, cursor_y, &(GFX_bold_font[i][0][0]), 6, 8, "help font (bold)",0);
 
516
    if (Read_GUI_block(gui, cursor_x, cursor_y, &(gfx->Bold_font[i][0][0]), 6, 8, "help font (bold)",0))
 
517
      return 1;
520
518
    cursor_x+=6;
521
519
  }
522
520
  cursor_y+=8;
530
528
    {
531
529
      if (i!=0)
532
530
        cursor_y+=8;
533
 
      GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "help font (title)");
 
531
      if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "help font (title)"))
 
532
        return 1;
534
533
    }
535
534
    else
536
535
    {
537
 
      GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (title)");
 
536
      if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "help font (title)"))
 
537
        return 1;
538
538
    }
539
539
    
540
540
    if (i&1)
541
541
      if (i&64)
542
 
        dest=&(GFX_help_font_t4[char_4++][0][0]);
 
542
        dest=&(gfx->Help_font_t4[char_4++][0][0]);
543
543
      else
544
 
        dest=&(GFX_help_font_t2[char_2++][0][0]);
 
544
        dest=&(gfx->Help_font_t2[char_2++][0][0]);
545
545
    else
546
546
      if (i&64)
547
 
        dest=&(GFX_help_font_t3[char_3++][0][0]);
 
547
        dest=&(gfx->Help_font_t3[char_3++][0][0]);
548
548
      else
549
 
        dest=&(GFX_help_font_t1[char_1++][0][0]);
 
549
        dest=&(gfx->Help_font_t1[char_1++][0][0]);
550
550
    
551
 
    Read_GUI_block(gui, cursor_x, cursor_y, dest, 6, 8, "help font (title)",0);
 
551
    if (Read_GUI_block(gui, cursor_x, cursor_y, dest, 6, 8, "help font (title)",0))
 
552
      return 1;
552
553
    cursor_x+=6;
553
554
  }
554
555
  cursor_y+=8;
555
556
  
556
 
  // Termin�: lib�ration de l'image skin
557
 
  SDL_FreeSurface(gui);
558
 
 
559
557
  Current_help_section=0;
560
558
  Help_position=0;
561
559
 
562
 
  Preset_paintbrush_width[ 0]= 1;
563
 
  Preset_paintbrush_height[ 0]= 1;
564
 
  Paintbrush_type             [ 0]=PAINTBRUSH_SHAPE_SQUARE;
565
 
 
566
 
  Preset_paintbrush_width[ 1]= 2;
567
 
  Preset_paintbrush_height[ 1]= 2;
568
 
  Paintbrush_type             [ 1]=PAINTBRUSH_SHAPE_SQUARE;
569
 
 
570
 
  Preset_paintbrush_width[ 2]= 3;
571
 
  Preset_paintbrush_height[ 2]= 3;
572
 
  Paintbrush_type             [ 2]=PAINTBRUSH_SHAPE_SQUARE;
573
 
 
574
 
  Preset_paintbrush_width[ 3]= 4;
575
 
  Preset_paintbrush_height[ 3]= 4;
576
 
  Paintbrush_type             [ 3]=PAINTBRUSH_SHAPE_SQUARE;
577
 
 
578
 
  Preset_paintbrush_width[ 4]= 5;
579
 
  Preset_paintbrush_height[ 4]= 5;
580
 
  Paintbrush_type             [ 4]=PAINTBRUSH_SHAPE_SQUARE;
581
 
 
582
 
  Preset_paintbrush_width[ 5]= 7;
583
 
  Preset_paintbrush_height[ 5]= 7;
584
 
  Paintbrush_type             [ 5]=PAINTBRUSH_SHAPE_SQUARE;
585
 
 
586
 
  Preset_paintbrush_width[ 6]= 8;
587
 
  Preset_paintbrush_height[ 6]= 8;
588
 
  Paintbrush_type             [ 6]=PAINTBRUSH_SHAPE_SQUARE;
589
 
 
590
 
  Preset_paintbrush_width[ 7]=12;
591
 
  Preset_paintbrush_height[ 7]=12;
592
 
  Paintbrush_type             [ 7]=PAINTBRUSH_SHAPE_SQUARE;
593
 
 
594
 
  Preset_paintbrush_width[ 8]=16;
595
 
  Preset_paintbrush_height[ 8]=16;
596
 
  Paintbrush_type             [ 8]=PAINTBRUSH_SHAPE_SQUARE;
597
 
 
598
 
  Preset_paintbrush_width[ 9]=16;
599
 
  Preset_paintbrush_height[ 9]=16;
600
 
  Paintbrush_type             [ 9]=PAINTBRUSH_SHAPE_SIEVE_SQUARE;
601
 
 
602
 
  Preset_paintbrush_width[10]=15;
603
 
  Preset_paintbrush_height[10]=15;
604
 
  Paintbrush_type             [10]=PAINTBRUSH_SHAPE_DIAMOND;
605
 
 
606
 
  Preset_paintbrush_width[11]= 5;
607
 
  Preset_paintbrush_height[11]= 5;
608
 
  Paintbrush_type             [11]=PAINTBRUSH_SHAPE_DIAMOND;
609
 
 
610
 
  Preset_paintbrush_width[12]= 3;
611
 
  Preset_paintbrush_height[12]= 3;
612
 
  Paintbrush_type             [12]=PAINTBRUSH_SHAPE_ROUND;
613
 
 
614
 
  Preset_paintbrush_width[13]= 4;
615
 
  Preset_paintbrush_height[13]= 4;
616
 
  Paintbrush_type             [13]=PAINTBRUSH_SHAPE_ROUND;
617
 
 
618
 
  Preset_paintbrush_width[14]= 5;
619
 
  Preset_paintbrush_height[14]= 5;
620
 
  Paintbrush_type             [14]=PAINTBRUSH_SHAPE_ROUND;
621
 
 
622
 
  Preset_paintbrush_width[15]= 6;
623
 
  Preset_paintbrush_height[15]= 6;
624
 
  Paintbrush_type             [15]=PAINTBRUSH_SHAPE_ROUND;
625
 
 
626
 
  Preset_paintbrush_width[16]= 8;
627
 
  Preset_paintbrush_height[16]= 8;
628
 
  Paintbrush_type             [16]=PAINTBRUSH_SHAPE_ROUND;
629
 
 
630
 
  Preset_paintbrush_width[17]=10;
631
 
  Preset_paintbrush_height[17]=10;
632
 
  Paintbrush_type             [17]=PAINTBRUSH_SHAPE_ROUND;
633
 
 
634
 
  Preset_paintbrush_width[18]=12;
635
 
  Preset_paintbrush_height[18]=12;
636
 
  Paintbrush_type             [18]=PAINTBRUSH_SHAPE_ROUND;
637
 
 
638
 
  Preset_paintbrush_width[19]=14;
639
 
  Preset_paintbrush_height[19]=14;
640
 
  Paintbrush_type             [19]=PAINTBRUSH_SHAPE_ROUND;
641
 
 
642
 
  Preset_paintbrush_width[20]=16;
643
 
  Preset_paintbrush_height[20]=16;
644
 
  Paintbrush_type             [20]=PAINTBRUSH_SHAPE_ROUND;
645
 
 
646
 
  Preset_paintbrush_width[21]=15;
647
 
  Preset_paintbrush_height[21]=15;
648
 
  Paintbrush_type             [21]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
649
 
 
650
 
  Preset_paintbrush_width[22]=11;
651
 
  Preset_paintbrush_height[22]=11;
652
 
  Paintbrush_type             [22]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
653
 
 
654
 
  Preset_paintbrush_width[23]= 5;
655
 
  Preset_paintbrush_height[23]= 5;
656
 
  Paintbrush_type             [23]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
657
 
 
658
 
  Preset_paintbrush_width[24]= 2;
659
 
  Preset_paintbrush_height[24]= 1;
660
 
  Paintbrush_type             [24]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
661
 
 
662
 
  Preset_paintbrush_width[25]= 3;
663
 
  Preset_paintbrush_height[25]= 1;
664
 
  Paintbrush_type             [25]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
665
 
 
666
 
  Preset_paintbrush_width[26]= 4;
667
 
  Preset_paintbrush_height[26]= 1;
668
 
  Paintbrush_type             [26]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
669
 
 
670
 
  Preset_paintbrush_width[27]= 8;
671
 
  Preset_paintbrush_height[27]= 1;
672
 
  Paintbrush_type             [27]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
673
 
 
674
 
  Preset_paintbrush_width[28]= 1;
675
 
  Preset_paintbrush_height[28]= 2;
676
 
  Paintbrush_type             [28]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
677
 
 
678
 
  Preset_paintbrush_width[29]= 1;
679
 
  Preset_paintbrush_height[29]= 3;
680
 
  Paintbrush_type             [29]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
681
 
 
682
 
  Preset_paintbrush_width[30]= 1;
683
 
  Preset_paintbrush_height[30]= 4;
684
 
  Paintbrush_type             [30]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
685
 
 
686
 
  Preset_paintbrush_width[31]= 1;
687
 
  Preset_paintbrush_height[31]= 8;
688
 
  Paintbrush_type             [31]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
689
 
 
690
 
  Preset_paintbrush_width[32]= 3;
691
 
  Preset_paintbrush_height[32]= 3;
692
 
  Paintbrush_type             [32]=PAINTBRUSH_SHAPE_CROSS;
693
 
 
694
 
  Preset_paintbrush_width[33]= 5;
695
 
  Preset_paintbrush_height[33]= 5;
696
 
  Paintbrush_type             [33]=PAINTBRUSH_SHAPE_CROSS;
697
 
 
698
 
  Preset_paintbrush_width[34]= 5;
699
 
  Preset_paintbrush_height[34]= 5;
700
 
  Paintbrush_type             [34]=PAINTBRUSH_SHAPE_PLUS;
701
 
 
702
 
  Preset_paintbrush_width[35]=15;
703
 
  Preset_paintbrush_height[35]=15;
704
 
  Paintbrush_type             [35]=PAINTBRUSH_SHAPE_PLUS;
705
 
 
706
 
  Preset_paintbrush_width[36]= 2;
707
 
  Preset_paintbrush_height[36]= 2;
708
 
  Paintbrush_type             [36]=PAINTBRUSH_SHAPE_SLASH;
709
 
 
710
 
  Preset_paintbrush_width[37]= 4;
711
 
  Preset_paintbrush_height[37]= 4;
712
 
  Paintbrush_type             [37]=PAINTBRUSH_SHAPE_SLASH;
713
 
 
714
 
  Preset_paintbrush_width[38]= 8;
715
 
  Preset_paintbrush_height[38]= 8;
716
 
  Paintbrush_type             [38]=PAINTBRUSH_SHAPE_SLASH;
717
 
 
718
 
  Preset_paintbrush_width[39]= 2;
719
 
  Preset_paintbrush_height[39]= 2;
720
 
  Paintbrush_type             [39]=PAINTBRUSH_SHAPE_ANTISLASH;
721
 
 
722
 
  Preset_paintbrush_width[40]= 4;
723
 
  Preset_paintbrush_height[40]= 4;
724
 
  Paintbrush_type             [40]=PAINTBRUSH_SHAPE_ANTISLASH;
725
 
 
726
 
  Preset_paintbrush_width[41]= 8;
727
 
  Preset_paintbrush_height[41]= 8;
728
 
  Paintbrush_type             [41]=PAINTBRUSH_SHAPE_ANTISLASH;
729
 
 
730
 
  Preset_paintbrush_width[42]= 4;
731
 
  Preset_paintbrush_height[42]= 4;
732
 
  Paintbrush_type             [42]=PAINTBRUSH_SHAPE_RANDOM;
733
 
 
734
 
  Preset_paintbrush_width[43]= 8;
735
 
  Preset_paintbrush_height[43]= 8;
736
 
  Paintbrush_type             [43]=PAINTBRUSH_SHAPE_RANDOM;
737
 
 
738
 
  Preset_paintbrush_width[44]=13;
739
 
  Preset_paintbrush_height[44]=13;
740
 
  Paintbrush_type             [44]=PAINTBRUSH_SHAPE_RANDOM;
741
 
 
742
 
  Preset_paintbrush_width[45]= 3;
743
 
  Preset_paintbrush_height[45]= 3;
744
 
  Paintbrush_type             [45]=PAINTBRUSH_SHAPE_MISC;
745
 
 
746
 
  Preset_paintbrush_width[46]= 3;
747
 
  Preset_paintbrush_height[46]= 3;
748
 
  Paintbrush_type             [46]=PAINTBRUSH_SHAPE_MISC;
749
 
 
750
 
  Preset_paintbrush_width[47]= 7;
751
 
  Preset_paintbrush_height[47]= 7;
752
 
  Paintbrush_type             [47]=PAINTBRUSH_SHAPE_MISC;
 
560
  gfx->Preset_paintbrush_width [ 0]= 1;
 
561
  gfx->Preset_paintbrush_height[ 0]= 1;
 
562
  gfx->Paintbrush_type         [ 0]=PAINTBRUSH_SHAPE_SQUARE;
 
563
 
 
564
  gfx->Preset_paintbrush_width [ 1]= 2;
 
565
  gfx->Preset_paintbrush_height[ 1]= 2;
 
566
  gfx->Paintbrush_type         [ 1]=PAINTBRUSH_SHAPE_SQUARE;
 
567
 
 
568
  gfx->Preset_paintbrush_width [ 2]= 3;
 
569
  gfx->Preset_paintbrush_height[ 2]= 3;
 
570
  gfx->Paintbrush_type         [ 2]=PAINTBRUSH_SHAPE_SQUARE;
 
571
 
 
572
  gfx->Preset_paintbrush_width [ 3]= 4;
 
573
  gfx->Preset_paintbrush_height[ 3]= 4;
 
574
  gfx->Paintbrush_type         [ 3]=PAINTBRUSH_SHAPE_SQUARE;
 
575
 
 
576
  gfx->Preset_paintbrush_width [ 4]= 5;
 
577
  gfx->Preset_paintbrush_height[ 4]= 5;
 
578
  gfx->Paintbrush_type         [ 4]=PAINTBRUSH_SHAPE_SQUARE;
 
579
 
 
580
  gfx->Preset_paintbrush_width [ 5]= 7;
 
581
  gfx->Preset_paintbrush_height[ 5]= 7;
 
582
  gfx->Paintbrush_type         [ 5]=PAINTBRUSH_SHAPE_SQUARE;
 
583
 
 
584
  gfx->Preset_paintbrush_width [ 6]= 8;
 
585
  gfx->Preset_paintbrush_height[ 6]= 8;
 
586
  gfx->Paintbrush_type         [ 6]=PAINTBRUSH_SHAPE_SQUARE;
 
587
 
 
588
  gfx->Preset_paintbrush_width [ 7]=12;
 
589
  gfx->Preset_paintbrush_height[ 7]=12;
 
590
  gfx->Paintbrush_type         [ 7]=PAINTBRUSH_SHAPE_SQUARE;
 
591
 
 
592
  gfx->Preset_paintbrush_width [ 8]=16;
 
593
  gfx->Preset_paintbrush_height[ 8]=16;
 
594
  gfx->Paintbrush_type         [ 8]=PAINTBRUSH_SHAPE_SQUARE;
 
595
 
 
596
  gfx->Preset_paintbrush_width [ 9]=16;
 
597
  gfx->Preset_paintbrush_height[ 9]=16;
 
598
  gfx->Paintbrush_type         [ 9]=PAINTBRUSH_SHAPE_SIEVE_SQUARE;
 
599
 
 
600
  gfx->Preset_paintbrush_width [10]=15;
 
601
  gfx->Preset_paintbrush_height[10]=15;
 
602
  gfx->Paintbrush_type         [10]=PAINTBRUSH_SHAPE_DIAMOND;
 
603
 
 
604
  gfx->Preset_paintbrush_width [11]= 5;
 
605
  gfx->Preset_paintbrush_height[11]= 5;
 
606
  gfx->Paintbrush_type         [11]=PAINTBRUSH_SHAPE_DIAMOND;
 
607
 
 
608
  gfx->Preset_paintbrush_width [12]= 3;
 
609
  gfx->Preset_paintbrush_height[12]= 3;
 
610
  gfx->Paintbrush_type         [12]=PAINTBRUSH_SHAPE_ROUND;
 
611
 
 
612
  gfx->Preset_paintbrush_width [13]= 4;
 
613
  gfx->Preset_paintbrush_height[13]= 4;
 
614
  gfx->Paintbrush_type         [13]=PAINTBRUSH_SHAPE_ROUND;
 
615
 
 
616
  gfx->Preset_paintbrush_width [14]= 5;
 
617
  gfx->Preset_paintbrush_height[14]= 5;
 
618
  gfx->Paintbrush_type         [14]=PAINTBRUSH_SHAPE_ROUND;
 
619
 
 
620
  gfx->Preset_paintbrush_width [15]= 6;
 
621
  gfx->Preset_paintbrush_height[15]= 6;
 
622
  gfx->Paintbrush_type         [15]=PAINTBRUSH_SHAPE_ROUND;
 
623
 
 
624
  gfx->Preset_paintbrush_width [16]= 8;
 
625
  gfx->Preset_paintbrush_height[16]= 8;
 
626
  gfx->Paintbrush_type         [16]=PAINTBRUSH_SHAPE_ROUND;
 
627
 
 
628
  gfx->Preset_paintbrush_width [17]=10;
 
629
  gfx->Preset_paintbrush_height[17]=10;
 
630
  gfx->Paintbrush_type         [17]=PAINTBRUSH_SHAPE_ROUND;
 
631
 
 
632
  gfx->Preset_paintbrush_width [18]=12;
 
633
  gfx->Preset_paintbrush_height[18]=12;
 
634
  gfx->Paintbrush_type         [18]=PAINTBRUSH_SHAPE_ROUND;
 
635
 
 
636
  gfx->Preset_paintbrush_width [19]=14;
 
637
  gfx->Preset_paintbrush_height[19]=14;
 
638
  gfx->Paintbrush_type         [19]=PAINTBRUSH_SHAPE_ROUND;
 
639
 
 
640
  gfx->Preset_paintbrush_width [20]=16;
 
641
  gfx->Preset_paintbrush_height[20]=16;
 
642
  gfx->Paintbrush_type         [20]=PAINTBRUSH_SHAPE_ROUND;
 
643
 
 
644
  gfx->Preset_paintbrush_width [21]=15;
 
645
  gfx->Preset_paintbrush_height[21]=15;
 
646
  gfx->Paintbrush_type         [21]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
 
647
 
 
648
  gfx->Preset_paintbrush_width [22]=11;
 
649
  gfx->Preset_paintbrush_height[22]=11;
 
650
  gfx->Paintbrush_type         [22]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
 
651
 
 
652
  gfx->Preset_paintbrush_width [23]= 5;
 
653
  gfx->Preset_paintbrush_height[23]= 5;
 
654
  gfx->Paintbrush_type         [23]=PAINTBRUSH_SHAPE_SIEVE_ROUND;
 
655
 
 
656
  gfx->Preset_paintbrush_width [24]= 2;
 
657
  gfx->Preset_paintbrush_height[24]= 1;
 
658
  gfx->Paintbrush_type         [24]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
 
659
 
 
660
  gfx->Preset_paintbrush_width [25]= 3;
 
661
  gfx->Preset_paintbrush_height[25]= 1;
 
662
  gfx->Paintbrush_type         [25]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
 
663
 
 
664
  gfx->Preset_paintbrush_width [26]= 4;
 
665
  gfx->Preset_paintbrush_height[26]= 1;
 
666
  gfx->Paintbrush_type         [26]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
 
667
 
 
668
  gfx->Preset_paintbrush_width [27]= 8;
 
669
  gfx->Preset_paintbrush_height[27]= 1;
 
670
  gfx->Paintbrush_type         [27]=PAINTBRUSH_SHAPE_HORIZONTAL_BAR;
 
671
 
 
672
  gfx->Preset_paintbrush_width [28]= 1;
 
673
  gfx->Preset_paintbrush_height[28]= 2;
 
674
  gfx->Paintbrush_type         [28]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
 
675
 
 
676
  gfx->Preset_paintbrush_width [29]= 1;
 
677
  gfx->Preset_paintbrush_height[29]= 3;
 
678
  gfx->Paintbrush_type         [29]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
 
679
 
 
680
  gfx->Preset_paintbrush_width [30]= 1;
 
681
  gfx->Preset_paintbrush_height[30]= 4;
 
682
  gfx->Paintbrush_type         [30]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
 
683
 
 
684
  gfx->Preset_paintbrush_width [31]= 1;
 
685
  gfx->Preset_paintbrush_height[31]= 8;
 
686
  gfx->Paintbrush_type         [31]=PAINTBRUSH_SHAPE_VERTICAL_BAR;
 
687
 
 
688
  gfx->Preset_paintbrush_width [32]= 3;
 
689
  gfx->Preset_paintbrush_height[32]= 3;
 
690
  gfx->Paintbrush_type         [32]=PAINTBRUSH_SHAPE_CROSS;
 
691
 
 
692
  gfx->Preset_paintbrush_width [33]= 5;
 
693
  gfx->Preset_paintbrush_height[33]= 5;
 
694
  gfx->Paintbrush_type         [33]=PAINTBRUSH_SHAPE_CROSS;
 
695
 
 
696
  gfx->Preset_paintbrush_width [34]= 5;
 
697
  gfx->Preset_paintbrush_height[34]= 5;
 
698
  gfx->Paintbrush_type         [34]=PAINTBRUSH_SHAPE_PLUS;
 
699
 
 
700
  gfx->Preset_paintbrush_width [35]=15;
 
701
  gfx->Preset_paintbrush_height[35]=15;
 
702
  gfx->Paintbrush_type         [35]=PAINTBRUSH_SHAPE_PLUS;
 
703
 
 
704
  gfx->Preset_paintbrush_width [36]= 2;
 
705
  gfx->Preset_paintbrush_height[36]= 2;
 
706
  gfx->Paintbrush_type         [36]=PAINTBRUSH_SHAPE_SLASH;
 
707
 
 
708
  gfx->Preset_paintbrush_width [37]= 4;
 
709
  gfx->Preset_paintbrush_height[37]= 4;
 
710
  gfx->Paintbrush_type         [37]=PAINTBRUSH_SHAPE_SLASH;
 
711
 
 
712
  gfx->Preset_paintbrush_width [38]= 8;
 
713
  gfx->Preset_paintbrush_height[38]= 8;
 
714
  gfx->Paintbrush_type         [38]=PAINTBRUSH_SHAPE_SLASH;
 
715
 
 
716
  gfx->Preset_paintbrush_width [39]= 2;
 
717
  gfx->Preset_paintbrush_height[39]= 2;
 
718
  gfx->Paintbrush_type         [39]=PAINTBRUSH_SHAPE_ANTISLASH;
 
719
 
 
720
  gfx->Preset_paintbrush_width [40]= 4;
 
721
  gfx->Preset_paintbrush_height[40]= 4;
 
722
  gfx->Paintbrush_type         [40]=PAINTBRUSH_SHAPE_ANTISLASH;
 
723
 
 
724
  gfx->Preset_paintbrush_width [41]= 8;
 
725
  gfx->Preset_paintbrush_height[41]= 8;
 
726
  gfx->Paintbrush_type         [41]=PAINTBRUSH_SHAPE_ANTISLASH;
 
727
 
 
728
  gfx->Preset_paintbrush_width [42]= 4;
 
729
  gfx->Preset_paintbrush_height[42]= 4;
 
730
  gfx->Paintbrush_type         [42]=PAINTBRUSH_SHAPE_RANDOM;
 
731
 
 
732
  gfx->Preset_paintbrush_width [43]= 8;
 
733
  gfx->Preset_paintbrush_height[43]= 8;
 
734
  gfx->Paintbrush_type         [43]=PAINTBRUSH_SHAPE_RANDOM;
 
735
 
 
736
  gfx->Preset_paintbrush_width [44]=13;
 
737
  gfx->Preset_paintbrush_height[44]=13;
 
738
  gfx->Paintbrush_type         [44]=PAINTBRUSH_SHAPE_RANDOM;
 
739
 
 
740
  gfx->Preset_paintbrush_width [45]= 3;
 
741
  gfx->Preset_paintbrush_height[45]= 3;
 
742
  gfx->Paintbrush_type         [45]=PAINTBRUSH_SHAPE_MISC;
 
743
 
 
744
  gfx->Preset_paintbrush_width [46]= 3;
 
745
  gfx->Preset_paintbrush_height[46]= 3;
 
746
  gfx->Paintbrush_type         [46]=PAINTBRUSH_SHAPE_MISC;
 
747
 
 
748
  gfx->Preset_paintbrush_width [47]= 7;
 
749
  gfx->Preset_paintbrush_height[47]= 7;
 
750
  gfx->Paintbrush_type         [47]=PAINTBRUSH_SHAPE_MISC;
753
751
 
754
752
  for (index=0;index<NB_PAINTBRUSH_SPRITES;index++)
755
753
  {
756
 
    Preset_paintbrush_offset_X[index]=(Preset_paintbrush_width[index]>>1);
757
 
    Preset_paintbrush_offset_Y[index]=(Preset_paintbrush_height[index]>>1);
758
 
  }
759
 
 
 
754
    gfx->Preset_paintbrush_offset_X[index]=(gfx->Preset_paintbrush_width [index]>>1);
 
755
    gfx->Preset_paintbrush_offset_Y[index]=(gfx->Preset_paintbrush_height[index]>>1);
 
756
  }
 
757
  return 0;
 
758
}
 
759
 
 
760
T_Gui_skin * Load_graphics(const char * skin_file)
 
761
{
 
762
  T_Gui_skin * gfx;
 
763
  char filename[MAX_PATH_CHARACTERS];
 
764
  SDL_Surface * gui;
 
765
 
 
766
  gfx = (T_Gui_skin *)malloc(sizeof(T_Gui_skin));
 
767
  if (gfx == NULL)
 
768
  {
 
769
    sprintf(Gui_loading_error_message, "Not enough memory to read skin file\n");
 
770
    return NULL;
 
771
  }
 
772
  
 
773
  // Read the "skin" file
 
774
  strcpy(filename,Data_directory);
 
775
  strcat(filename,"skins" PATH_SEPARATOR);
 
776
  strcat(filename,skin_file);
 
777
  
 
778
  gui=IMG_Load(filename);
 
779
  if (!gui)
 
780
  {
 
781
    sprintf(Gui_loading_error_message, "Unable to load the skin image (missing? not an image file?)\n");
 
782
    free(gfx);
 
783
    return NULL;
 
784
  }
 
785
  if (Parse_skin(gui, gfx))
 
786
  {
 
787
    SDL_FreeSurface(gui);
 
788
    free(gfx);
 
789
    return NULL;
 
790
  }
 
791
  SDL_FreeSurface(gui);
 
792
  return gfx;
 
793
}
 
794
 
 
795
// ---- font loading -----
 
796
 
 
797
byte Parse_font(SDL_Surface * image, byte * font)
 
798
{
 
799
  int character;
 
800
  byte color;
 
801
  int x, y;
 
802
  int chars_per_line;
 
803
  
 
804
  // Check image size
 
805
  if (image->w % 8)
 
806
  {
 
807
    sprintf(Gui_loading_error_message, "Error in font file: Image width is not a multiple of 8.\n");
 
808
    return 1;
 
809
  }
 
810
  if (image->w * image->h < 8*8*256)
 
811
  {
 
812
    sprintf(Gui_loading_error_message, "Error in font file: Image is too small to be a 256-character 8x8 font.\n");
 
813
    return 1;
 
814
  }
 
815
  chars_per_line = image->w/8;
 
816
 
 
817
  for (character=0; character < 256; character++)
 
818
  {
 
819
    for (y=0; y<8; y++)
 
820
    {
 
821
      for (x=0;x<8; x++)
 
822
      {
 
823
        // Pick pixel
 
824
        color = Get_SDL_pixel_8(image, (character % chars_per_line)*8+x, (character / chars_per_line)*8+y);
 
825
        if (color > 1)
 
826
        {
 
827
          sprintf(Gui_loading_error_message, "Error in font file: Only colors 0 and 1 can be used for the font.\n");
 
828
          return 1;
 
829
        }
 
830
        // Put it in font. 0 = BG, 1 = FG.
 
831
        font[character*64 + y*8 + x]=color;
 
832
      }
 
833
    }
 
834
  }
 
835
  return 0;
 
836
}
 
837
 
 
838
byte * Load_font(const char * font_name)
 
839
{
 
840
  byte * font;
 
841
  char filename[MAX_PATH_CHARACTERS];
 
842
  SDL_Surface * image;
 
843
 
 
844
  font = (byte *)malloc(8*8*256);
 
845
  if (font == NULL)
 
846
  {
 
847
    sprintf(Gui_loading_error_message, "Not enough memory to read font file\n");
 
848
    return NULL;
 
849
  }
 
850
  
 
851
  // Read the file containing the image
 
852
  sprintf(filename,"%sskins%s%s", Data_directory, PATH_SEPARATOR, font_name);
 
853
  
 
854
  image=IMG_Load(filename);
 
855
  if (!image)
 
856
  {
 
857
    sprintf(Gui_loading_error_message, "Unable to load the skin image (missing? not an image file?)\n");
 
858
    free(font);
 
859
    return NULL;
 
860
  }
 
861
  if (Parse_font(image, font))
 
862
  {
 
863
    SDL_FreeSurface(image);
 
864
    free(font);
 
865
    return NULL;
 
866
  }
 
867
  SDL_FreeSurface(image);
 
868
  return font;
760
869
}
761
870
 
762
871
 
920
1029
 
921
1030
  Init_button(BUTTON_GRADRECT,
922
1031
                     85,1,
923
 
                     15,15,
924
 
                     BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
925
 
                     Button_Grad_rectangle,Button_Grad_rectangle,
 
1032
                     16,16,
 
1033
                     BUTTON_SHAPE_RECTANGLE,
 
1034
                     Button_Grad_rectangle,Button_Gradients,
926
1035
                     Do_nothing,
927
1036
                     FAMILY_TOOL);
928
1037
 
929
 
  Init_button(BUTTON_GRADMENU,
930
 
                     86,2,
931
 
                     15,15,
932
 
                     BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
933
 
                     Button_Gradients,Button_Gradients,
934
 
                     Do_nothing,
935
 
                     FAMILY_INSTANT);
936
 
 
937
1038
  Init_button(BUTTON_SPHERES,
938
1039
                     85,18,
939
1040
                     16,16,
1034
1135
                     178,18,
1035
1136
                     16,16,
1036
1137
                     BUTTON_SHAPE_RECTANGLE,
1037
 
                     Button_Settings,Button_Settings,
 
1138
                     Button_Settings,Button_Skins,
1038
1139
                     Do_nothing,
1039
1140
                     FAMILY_INSTANT);
1040
1141
 
1128
1229
void Init_operation(byte operation_number,
1129
1230
                           byte mouse_button,
1130
1231
                           byte stack_index,
1131
 
                           Func_action Action,
1132
 
                           byte Hide_cursor)
 
1232
                           Func_action action,
 
1233
                           byte hide_cursor,
 
1234
                           byte fast_mouse)
1133
1235
{
1134
1236
  Operation[operation_number][mouse_button]
1135
 
           [stack_index].Action=Action;
1136
 
  Operation[operation_number][mouse_button]
1137
 
           [stack_index].Hide_cursor=Hide_cursor;
 
1237
           [stack_index].Action=action;
 
1238
  Operation[operation_number][mouse_button]
 
1239
           [stack_index].Hide_cursor=hide_cursor;
 
1240
  Operation[operation_number][mouse_button]
 
1241
           [stack_index].Fast_mouse=fast_mouse;
1138
1242
}
1139
1243
 
1140
1244
 
1145
1249
  byte number; // Num�ro de l'option en cours d'auto-initialisation
1146
1250
  byte Button; // Button souris en cours d'auto-initialisation
1147
1251
  byte stack_index; // Taille de la pile en cours d'auto-initialisation
 
1252
  #define HIDE_CURSOR 1
 
1253
  #define FAST_MOUSE 1
1148
1254
 
1149
1255
  // Auto-initialisation des op�rations (vers des actions inoffensives)
1150
1256
 
1151
1257
  for (number=0;number<NB_OPERATIONS;number++)
1152
1258
    for (Button=0;Button<3;Button++)
1153
1259
      for (stack_index=0;stack_index<OPERATION_STACK_SIZE;stack_index++)
1154
 
        Init_operation(number,Button,stack_index,Print_coordinates,0);
 
1260
        Init_operation(number,Button,stack_index,Print_coordinates,HIDE_CURSOR,FAST_MOUSE);
1155
1261
 
1156
1262
 
1157
1263
  // Ici viennent les d�clarations d�taill�es des op�rations
1158
1264
  Init_operation(OPERATION_CONTINUOUS_DRAW,1,0,
1159
 
                        Freehand_mode1_1_0,1);
 
1265
                        Freehand_mode1_1_0,HIDE_CURSOR,0);
1160
1266
  Init_operation(OPERATION_CONTINUOUS_DRAW,1,2,
1161
 
                        Freehand_mode1_1_2,0);
 
1267
                        Freehand_mode1_1_2,0,0);
1162
1268
  Init_operation(OPERATION_CONTINUOUS_DRAW,0,2,
1163
 
                        Freehand_mode12_0_2,0);
 
1269
                        Freehand_mode12_0_2,0,0);
1164
1270
  Init_operation(OPERATION_CONTINUOUS_DRAW,2,0,
1165
 
                        Freehand_mode1_2_0,1);
 
1271
                        Freehand_mode1_2_0,HIDE_CURSOR,0);
1166
1272
  Init_operation(OPERATION_CONTINUOUS_DRAW,2,2,
1167
 
                        Freehand_mode1_2_2,0);
 
1273
                        Freehand_mode1_2_2,0,0);
1168
1274
 
1169
1275
  Init_operation(OPERATION_DISCONTINUOUS_DRAW,1,0,
1170
 
                        Freehand_mode2_1_0,1);
 
1276
                        Freehand_mode2_1_0,HIDE_CURSOR,0);
1171
1277
  Init_operation(OPERATION_DISCONTINUOUS_DRAW,1,2,
1172
 
                        Freehand_mode2_1_2,0);
 
1278
                        Freehand_mode2_1_2,0,0);
1173
1279
  Init_operation(OPERATION_DISCONTINUOUS_DRAW,0,2,
1174
 
                        Freehand_mode12_0_2,0);
 
1280
                        Freehand_mode12_0_2,0,0);
1175
1281
  Init_operation(OPERATION_DISCONTINUOUS_DRAW,2,0,
1176
 
                        Freehand_mode2_2_0,1);
 
1282
                        Freehand_mode2_2_0,HIDE_CURSOR,0);
1177
1283
  Init_operation(OPERATION_DISCONTINUOUS_DRAW,2,2,
1178
 
                        Freehand_mode2_2_2,0);
 
1284
                        Freehand_mode2_2_2,0,0);
1179
1285
 
1180
1286
  Init_operation(OPERATION_POINT_DRAW,1,0,
1181
 
                        Freehand_mode3_1_0,1);
 
1287
                        Freehand_mode3_1_0,HIDE_CURSOR,FAST_MOUSE);
1182
1288
  Init_operation(OPERATION_POINT_DRAW,2,0,
1183
 
                        Freehand_Mode3_2_0,1);
 
1289
                        Freehand_Mode3_2_0,HIDE_CURSOR,FAST_MOUSE);
1184
1290
  Init_operation(OPERATION_POINT_DRAW,0,1,
1185
 
                        Freehand_mode3_0_1,0);
 
1291
                        Freehand_mode3_0_1,0,FAST_MOUSE);
1186
1292
 
1187
1293
  Init_operation(OPERATION_LINE,1,0,
1188
 
                        Line_12_0,1);
 
1294
                        Line_12_0,HIDE_CURSOR,FAST_MOUSE);
1189
1295
  Init_operation(OPERATION_LINE,1,5,
1190
 
                        Line_12_5,0);
 
1296
                        Line_12_5,0,FAST_MOUSE);
1191
1297
  Init_operation(OPERATION_LINE,0,5,
1192
 
                        Line_0_5,1);
 
1298
                        Line_0_5,HIDE_CURSOR,FAST_MOUSE);
1193
1299
  Init_operation(OPERATION_LINE,2,0,
1194
 
                        Line_12_0,1);
 
1300
                        Line_12_0,HIDE_CURSOR,FAST_MOUSE);
1195
1301
  Init_operation(OPERATION_LINE,2,5,
1196
 
                        Line_12_5,0);
 
1302
                        Line_12_5,0,FAST_MOUSE);
1197
1303
 
1198
1304
  Init_operation(OPERATION_K_LIGNE,1,0,
1199
 
                        K_line_12_0,1);
 
1305
                        K_line_12_0,HIDE_CURSOR,FAST_MOUSE);
1200
1306
  Init_operation(OPERATION_K_LIGNE,1,6,
1201
 
                        K_line_12_6,0);
 
1307
                        K_line_12_6,0,FAST_MOUSE);
1202
1308
  Init_operation(OPERATION_K_LIGNE,1,7,
1203
 
                        K_line_12_7,1);
1204
 
  Init_operation(OPERATION_K_LIGNE,2,0,
1205
 
                        K_line_12_0,1);
 
1309
                        K_line_12_7,HIDE_CURSOR,FAST_MOUSE);
 
1310
  Init_operation(OPERATION_K_LIGNE,2,FAST_MOUSE,
 
1311
                        K_line_12_0,HIDE_CURSOR,FAST_MOUSE);
1206
1312
  Init_operation(OPERATION_K_LIGNE,2,6,
1207
 
                        K_line_12_6,0);
 
1313
                        K_line_12_6,0,FAST_MOUSE);
1208
1314
  Init_operation(OPERATION_K_LIGNE,2,7,
1209
 
                        K_line_12_7,1);
 
1315
                        K_line_12_7,HIDE_CURSOR,FAST_MOUSE);
1210
1316
  Init_operation(OPERATION_K_LIGNE,0,6,
1211
 
                        K_line_0_6,1);
 
1317
                        K_line_0_6,HIDE_CURSOR,FAST_MOUSE);
1212
1318
  Init_operation(OPERATION_K_LIGNE,0,7,
1213
 
                        K_line_12_6,0);
 
1319
                        K_line_12_6,0,FAST_MOUSE);
1214
1320
 
1215
1321
  Init_operation(OPERATION_EMPTY_RECTANGLE,1,0,
1216
 
                        Rectangle_12_0,1);
 
1322
                        Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
1217
1323
  Init_operation(OPERATION_EMPTY_RECTANGLE,2,0,
1218
 
                        Rectangle_12_0,1);
 
1324
                        Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
1219
1325
  Init_operation(OPERATION_EMPTY_RECTANGLE,1,5,
1220
 
                        Rectangle_12_5,0);
 
1326
                        Rectangle_12_5,0,FAST_MOUSE);
1221
1327
  Init_operation(OPERATION_EMPTY_RECTANGLE,2,5,
1222
 
                        Rectangle_12_5,0);
 
1328
                        Rectangle_12_5,0,FAST_MOUSE);
1223
1329
  Init_operation(OPERATION_EMPTY_RECTANGLE,0,5,
1224
 
                        Empty_rectangle_0_5,1);
 
1330
                        Empty_rectangle_0_5,HIDE_CURSOR,FAST_MOUSE);
1225
1331
 
1226
1332
  Init_operation(OPERATION_FILLED_RECTANGLE,1,0,
1227
 
                        Rectangle_12_0,1);
 
1333
                        Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
1228
1334
  Init_operation(OPERATION_FILLED_RECTANGLE,2,0,
1229
 
                        Rectangle_12_0,1);
 
1335
                        Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
1230
1336
  Init_operation(OPERATION_FILLED_RECTANGLE,1,5,
1231
 
                        Rectangle_12_5,0);
 
1337
                        Rectangle_12_5,0,FAST_MOUSE);
1232
1338
  Init_operation(OPERATION_FILLED_RECTANGLE,2,5,
1233
 
                        Rectangle_12_5,0);
 
1339
                        Rectangle_12_5,0,FAST_MOUSE);
1234
1340
  Init_operation(OPERATION_FILLED_RECTANGLE,0,5,
1235
 
                        Filled_rectangle_0_5,1);
 
1341
                        Filled_rectangle_0_5,HIDE_CURSOR,FAST_MOUSE);
1236
1342
 
1237
1343
  Init_operation(OPERATION_EMPTY_CIRCLE,1,0,
1238
 
                        Circle_12_0,1);
 
1344
                        Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
1239
1345
  Init_operation(OPERATION_EMPTY_CIRCLE,2,0,
1240
 
                        Circle_12_0,1);
 
1346
                        Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
1241
1347
  Init_operation(OPERATION_EMPTY_CIRCLE,1,5,
1242
 
                        Circle_12_5,0);
 
1348
                        Circle_12_5,0,FAST_MOUSE);
1243
1349
  Init_operation(OPERATION_EMPTY_CIRCLE,2,5,
1244
 
                        Circle_12_5,0);
 
1350
                        Circle_12_5,0,FAST_MOUSE);
1245
1351
  Init_operation(OPERATION_EMPTY_CIRCLE,0,5,
1246
 
                        Empty_circle_0_5,1);
 
1352
                        Empty_circle_0_5,HIDE_CURSOR,FAST_MOUSE);
1247
1353
 
1248
1354
  Init_operation(OPERATION_FILLED_CIRCLE,1,0,
1249
 
                        Circle_12_0,1);
 
1355
                        Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
1250
1356
  Init_operation(OPERATION_FILLED_CIRCLE,2,0,
1251
 
                        Circle_12_0,1);
 
1357
                        Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
1252
1358
  Init_operation(OPERATION_FILLED_CIRCLE,1,5,
1253
 
                        Circle_12_5,0);
 
1359
                        Circle_12_5,0,FAST_MOUSE);
1254
1360
  Init_operation(OPERATION_FILLED_CIRCLE,2,5,
1255
 
                        Circle_12_5,0);
 
1361
                        Circle_12_5,0,FAST_MOUSE);
1256
1362
  Init_operation(OPERATION_FILLED_CIRCLE,0,5,
1257
 
                        Filled_circle_0_5,1);
 
1363
                        Filled_circle_0_5,HIDE_CURSOR,FAST_MOUSE);
1258
1364
 
1259
1365
  Init_operation(OPERATION_EMPTY_ELLIPSE,1,0,
1260
 
                        Ellipse_12_0,1);
 
1366
                        Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
1261
1367
  Init_operation(OPERATION_EMPTY_ELLIPSE,2,0,
1262
 
                        Ellipse_12_0,1);
 
1368
                        Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
1263
1369
  Init_operation(OPERATION_EMPTY_ELLIPSE,1,5,
1264
 
                        Ellipse_12_5,0);
 
1370
                        Ellipse_12_5,0,FAST_MOUSE);
1265
1371
  Init_operation(OPERATION_EMPTY_ELLIPSE,2,5,
1266
 
                        Ellipse_12_5,0);
 
1372
                        Ellipse_12_5,0,FAST_MOUSE);
1267
1373
  Init_operation(OPERATION_EMPTY_ELLIPSE,0,5,
1268
 
                        Empty_ellipse_0_5,1);
 
1374
                        Empty_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
1269
1375
 
1270
1376
  Init_operation(OPERATION_FILLED_ELLIPSE,1,0,
1271
 
                        Ellipse_12_0,1);
 
1377
                        Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
1272
1378
  Init_operation(OPERATION_FILLED_ELLIPSE,2,0,
1273
 
                        Ellipse_12_0,1);
 
1379
                        Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
1274
1380
  Init_operation(OPERATION_FILLED_ELLIPSE,1,5,
1275
 
                        Ellipse_12_5,0);
 
1381
                        Ellipse_12_5,0,FAST_MOUSE);
1276
1382
  Init_operation(OPERATION_FILLED_ELLIPSE,2,5,
1277
 
                        Ellipse_12_5,0);
 
1383
                        Ellipse_12_5,0,FAST_MOUSE);
1278
1384
  Init_operation(OPERATION_FILLED_ELLIPSE,0,5,
1279
 
                        Filled_ellipse_0_5,1);
 
1385
                        Filled_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
1280
1386
 
1281
1387
  Init_operation(OPERATION_FILL,1,0,
1282
 
                        Fill_1_0,0);
 
1388
                        Fill_1_0,0,FAST_MOUSE);
1283
1389
  Init_operation(OPERATION_FILL,2,0,
1284
 
                        Fill_2_0,0);
 
1390
                        Fill_2_0,0,FAST_MOUSE);
1285
1391
 
1286
1392
  Init_operation(OPERATION_REPLACE,1,0,
1287
 
                        Replace_1_0,0);
 
1393
                        Replace_1_0,0,FAST_MOUSE);
1288
1394
  Init_operation(OPERATION_REPLACE,2,0,
1289
 
                        Replace_2_0,0);
 
1395
                        Replace_2_0,0,FAST_MOUSE);
1290
1396
 
1291
1397
  Init_operation(OPERATION_GRAB_BRUSH,1,0,
1292
 
                        Brush_12_0,1);
 
1398
                        Brush_12_0,HIDE_CURSOR,FAST_MOUSE);
1293
1399
  Init_operation(OPERATION_GRAB_BRUSH,2,0,
1294
 
                        Brush_12_0,1);
 
1400
                        Brush_12_0,HIDE_CURSOR,FAST_MOUSE);
1295
1401
  Init_operation(OPERATION_GRAB_BRUSH,1,5,
1296
 
                        Brush_12_5,0);
 
1402
                        Brush_12_5,0,FAST_MOUSE);
1297
1403
  Init_operation(OPERATION_GRAB_BRUSH,2,5,
1298
 
                        Brush_12_5,0);
 
1404
                        Brush_12_5,0,FAST_MOUSE);
1299
1405
  Init_operation(OPERATION_GRAB_BRUSH,0,5,
1300
 
                        Brush_0_5,1);
 
1406
                        Brush_0_5,HIDE_CURSOR,FAST_MOUSE);
1301
1407
 
1302
1408
  Init_operation(OPERATION_STRETCH_BRUSH,1,0,
1303
 
                        Stretch_brush_12_0,1);
 
1409
                        Stretch_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
1304
1410
  Init_operation(OPERATION_STRETCH_BRUSH,2,0,
1305
 
                        Stretch_brush_12_0,1);
 
1411
                        Stretch_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
1306
1412
  Init_operation(OPERATION_STRETCH_BRUSH,1,7,
1307
 
                        Stretch_brush_1_7,0);
 
1413
                        Stretch_brush_1_7,0,FAST_MOUSE);
1308
1414
  Init_operation(OPERATION_STRETCH_BRUSH,0,7,
1309
 
                        Stretch_brush_0_7,0);
 
1415
                        Stretch_brush_0_7,0,FAST_MOUSE);
1310
1416
  Init_operation(OPERATION_STRETCH_BRUSH,2,7,
1311
 
                        Stretch_brush_2_7,1);
 
1417
                        Stretch_brush_2_7,HIDE_CURSOR,FAST_MOUSE);
1312
1418
 
1313
1419
  Init_operation(OPERATION_ROTATE_BRUSH,1,0,
1314
 
                        Rotate_brush_12_0,1);
 
1420
                        Rotate_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
1315
1421
  Init_operation(OPERATION_ROTATE_BRUSH,2,0,
1316
 
                        Rotate_brush_12_0,1);
 
1422
                        Rotate_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
1317
1423
  Init_operation(OPERATION_ROTATE_BRUSH,1,5,
1318
 
                        Rotate_brush_1_5,0);
 
1424
                        Rotate_brush_1_5,0,FAST_MOUSE);
1319
1425
  Init_operation(OPERATION_ROTATE_BRUSH,0,5,
1320
 
                        Rotate_brush_0_5,0);
 
1426
                        Rotate_brush_0_5,0,FAST_MOUSE);
1321
1427
  Init_operation(OPERATION_ROTATE_BRUSH,2,5,
1322
 
                        Rotate_brush_2_5,1);
 
1428
                        Rotate_brush_2_5,HIDE_CURSOR,FAST_MOUSE);
1323
1429
 
1324
1430
  Init_operation(OPERATION_DISTORT_BRUSH,0,0,
1325
 
                        Distort_brush_0_0,0);
 
1431
                        Distort_brush_0_0,0,FAST_MOUSE);
1326
1432
  Init_operation(OPERATION_DISTORT_BRUSH,1,0,
1327
 
                        Distort_brush_1_0,0);
 
1433
                        Distort_brush_1_0,0,FAST_MOUSE);
1328
1434
  Init_operation(OPERATION_DISTORT_BRUSH,1,8,
1329
 
                        Distort_brush_1_8,0);
 
1435
                        Distort_brush_1_8,0,FAST_MOUSE);
1330
1436
  Init_operation(OPERATION_DISTORT_BRUSH,2,8,
1331
 
                        Distort_brush_2_8,1);
 
1437
                        Distort_brush_2_8,HIDE_CURSOR,FAST_MOUSE);
1332
1438
  Init_operation(OPERATION_DISTORT_BRUSH,2,0,
1333
 
                        Distort_brush_2_0,1);
 
1439
                        Distort_brush_2_0,HIDE_CURSOR,FAST_MOUSE);
1334
1440
  Init_operation(OPERATION_DISTORT_BRUSH,1,9,
1335
 
                        Distort_brush_1_9,0);
 
1441
                        Distort_brush_1_9,0,FAST_MOUSE);
1336
1442
  Init_operation(OPERATION_DISTORT_BRUSH,0,9,
1337
 
                        Distort_brush_0_9,0);
 
1443
                        Distort_brush_0_9,0,FAST_MOUSE);
1338
1444
 
1339
1445
 
1340
1446
  Init_operation(OPERATION_POLYBRUSH,1,0,
1341
 
                        Filled_polyform_12_0,1);
 
1447
                        Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
1342
1448
  Init_operation(OPERATION_POLYBRUSH,2,0,
1343
 
                        Filled_polyform_12_0,1);
 
1449
                        Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
1344
1450
  Init_operation(OPERATION_POLYBRUSH,1,8,
1345
 
                        Polybrush_12_8,0);
 
1451
                        Polybrush_12_8,0,0);
1346
1452
  Init_operation(OPERATION_POLYBRUSH,2,8,
1347
 
                        Polybrush_12_8,0);
 
1453
                        Polybrush_12_8,0,0);
1348
1454
  Init_operation(OPERATION_POLYBRUSH,0,8,
1349
 
                        Filled_polyform_0_8,0);
 
1455
                        Filled_polyform_0_8,0,FAST_MOUSE);
1350
1456
 
1351
1457
  Colorpicker_color=-1;
1352
1458
  Init_operation(OPERATION_COLORPICK,1,0,
1353
 
                        Colorpicker_12_0,1);
 
1459
                        Colorpicker_12_0,HIDE_CURSOR,FAST_MOUSE);
1354
1460
  Init_operation(OPERATION_COLORPICK,2,0,
1355
 
                        Colorpicker_12_0,0);
 
1461
                        Colorpicker_12_0,0,FAST_MOUSE);
1356
1462
  Init_operation(OPERATION_COLORPICK,1,1,
1357
 
                        Colorpicker_1_1,0);
 
1463
                        Colorpicker_1_1,0,FAST_MOUSE);
1358
1464
  Init_operation(OPERATION_COLORPICK,2,1,
1359
 
                        Colorpicker_2_1,0);
 
1465
                        Colorpicker_2_1,0,FAST_MOUSE);
1360
1466
  Init_operation(OPERATION_COLORPICK,0,1,
1361
 
                        Colorpicker_0_1,1);
 
1467
                        Colorpicker_0_1,HIDE_CURSOR,FAST_MOUSE);
1362
1468
 
1363
1469
  Init_operation(OPERATION_MAGNIFY,1,0,
1364
 
                        Magnifier_12_0,0);
 
1470
                        Magnifier_12_0,0,FAST_MOUSE);
1365
1471
  Init_operation(OPERATION_MAGNIFY,2,0,
1366
 
                        Magnifier_12_0,0);
 
1472
                        Magnifier_12_0,0,FAST_MOUSE);
1367
1473
 
1368
1474
  Init_operation(OPERATION_4_POINTS_CURVE,1,0,
1369
 
                        Curve_34_points_1_0,1);
 
1475
                        Curve_34_points_1_0,HIDE_CURSOR,FAST_MOUSE);
1370
1476
  Init_operation(OPERATION_4_POINTS_CURVE,2,0,
1371
 
                        Curve_34_points_2_0,1);
 
1477
                        Curve_34_points_2_0,HIDE_CURSOR,FAST_MOUSE);
1372
1478
  Init_operation(OPERATION_4_POINTS_CURVE,1,5,
1373
 
                        Curve_34_points_1_5,0);
 
1479
                        Curve_34_points_1_5,0,FAST_MOUSE);
1374
1480
  Init_operation(OPERATION_4_POINTS_CURVE,2,5,
1375
 
                        Curve_34_points_2_5,0);
 
1481
                        Curve_34_points_2_5,0,FAST_MOUSE);
1376
1482
  Init_operation(OPERATION_4_POINTS_CURVE,0,5,
1377
 
                        Curve_4_points_0_5,1);
 
1483
                        Curve_4_points_0_5,HIDE_CURSOR,FAST_MOUSE);
1378
1484
  Init_operation(OPERATION_4_POINTS_CURVE,1,9,
1379
 
                        Curve_4_points_1_9,0);
 
1485
                        Curve_4_points_1_9,0,FAST_MOUSE);
1380
1486
  Init_operation(OPERATION_4_POINTS_CURVE,2,9,
1381
 
                        Curve_4_points_2_9,0);
 
1487
                        Curve_4_points_2_9,0,FAST_MOUSE);
1382
1488
 
1383
1489
  Init_operation(OPERATION_3_POINTS_CURVE,1,0,
1384
 
                        Curve_34_points_1_0,1);
 
1490
                        Curve_34_points_1_0,HIDE_CURSOR,FAST_MOUSE);
1385
1491
  Init_operation(OPERATION_3_POINTS_CURVE,2,0,
1386
 
                        Curve_34_points_2_0,1);
 
1492
                        Curve_34_points_2_0,HIDE_CURSOR,FAST_MOUSE);
1387
1493
  Init_operation(OPERATION_3_POINTS_CURVE,1,5,
1388
 
                        Curve_34_points_1_5,0);
 
1494
                        Curve_34_points_1_5,0,FAST_MOUSE);
1389
1495
  Init_operation(OPERATION_3_POINTS_CURVE,2,5,
1390
 
                        Curve_34_points_2_5,0);
 
1496
                        Curve_34_points_2_5,0,FAST_MOUSE);
1391
1497
  Init_operation(OPERATION_3_POINTS_CURVE,0,5,
1392
 
                        Curve_3_points_0_5,1);
 
1498
                        Curve_3_points_0_5,HIDE_CURSOR,FAST_MOUSE);
1393
1499
  Init_operation(OPERATION_3_POINTS_CURVE,0,11,
1394
 
                        Curve_3_points_0_11,0);
 
1500
                        Curve_3_points_0_11,0,FAST_MOUSE);
1395
1501
  Init_operation(OPERATION_3_POINTS_CURVE,1,11,
1396
 
                        Curve_3_points_12_11,0);
 
1502
                        Curve_3_points_12_11,0,FAST_MOUSE);
1397
1503
  Init_operation(OPERATION_3_POINTS_CURVE,2,11,
1398
 
                        Curve_3_points_12_11,0);
 
1504
                        Curve_3_points_12_11,0,FAST_MOUSE);
1399
1505
 
1400
1506
  Init_operation(OPERATION_AIRBRUSH,1,0,
1401
 
                        Airbrush_1_0,0);
 
1507
                        Airbrush_1_0,0,0);
1402
1508
  Init_operation(OPERATION_AIRBRUSH,2,0,
1403
 
                        Airbrush_2_0,0);
 
1509
                        Airbrush_2_0,0,0);
1404
1510
  Init_operation(OPERATION_AIRBRUSH,1,2,
1405
 
                        Airbrush_12_2,0);
 
1511
                        Airbrush_12_2,0,0);
1406
1512
  Init_operation(OPERATION_AIRBRUSH,2,2,
1407
 
                        Airbrush_12_2,0);
 
1513
                        Airbrush_12_2,0,0);
1408
1514
  Init_operation(OPERATION_AIRBRUSH,0,2,
1409
 
                        Airbrush_0_2,0);
 
1515
                        Airbrush_0_2,0,0);
1410
1516
 
1411
1517
  Init_operation(OPERATION_POLYGON,1,0,
1412
 
                        Polygon_12_0,1);
 
1518
                        Polygon_12_0,HIDE_CURSOR,FAST_MOUSE);
1413
1519
  Init_operation(OPERATION_POLYGON,2,0,
1414
 
                        Polygon_12_0,1);
 
1520
                        Polygon_12_0,HIDE_CURSOR,FAST_MOUSE);
1415
1521
  Init_operation(OPERATION_POLYGON,1,8,
1416
 
                        K_line_12_6,0);
 
1522
                        K_line_12_6,0,FAST_MOUSE);
1417
1523
  Init_operation(OPERATION_POLYGON,2,8,
1418
 
                        K_line_12_6,0);
 
1524
                        K_line_12_6,0,FAST_MOUSE);
1419
1525
  Init_operation(OPERATION_POLYGON,1,9,
1420
 
                        Polygon_12_9,1);
 
1526
                        Polygon_12_9,HIDE_CURSOR,FAST_MOUSE);
1421
1527
  Init_operation(OPERATION_POLYGON,2,9,
1422
 
                        Polygon_12_9,1);
 
1528
                        Polygon_12_9,HIDE_CURSOR,FAST_MOUSE);
1423
1529
  Init_operation(OPERATION_POLYGON,0,8,
1424
 
                        K_line_0_6,1);
 
1530
                        K_line_0_6,HIDE_CURSOR,FAST_MOUSE);
1425
1531
  Init_operation(OPERATION_POLYGON,0,9,
1426
 
                        K_line_12_6,0);
 
1532
                        K_line_12_6,0,FAST_MOUSE);
1427
1533
 
1428
1534
  Init_operation(OPERATION_POLYFILL,1,0,
1429
 
                        Polyfill_12_0,1);
 
1535
                        Polyfill_12_0,HIDE_CURSOR,FAST_MOUSE);
1430
1536
  Init_operation(OPERATION_POLYFILL,2,0,
1431
 
                        Polyfill_12_0,1);
 
1537
                        Polyfill_12_0,HIDE_CURSOR,FAST_MOUSE);
1432
1538
  Init_operation(OPERATION_POLYFILL,1,8,
1433
 
                        Polyfill_12_8,0);
 
1539
                        Polyfill_12_8,0,FAST_MOUSE);
1434
1540
  Init_operation(OPERATION_POLYFILL,2,8,
1435
 
                        Polyfill_12_8,0);
 
1541
                        Polyfill_12_8,0,FAST_MOUSE);
1436
1542
  Init_operation(OPERATION_POLYFILL,1,9,
1437
 
                        Polyfill_12_9,0);
 
1543
                        Polyfill_12_9,0,FAST_MOUSE);
1438
1544
  Init_operation(OPERATION_POLYFILL,2,9,
1439
 
                        Polyfill_12_9,0);
 
1545
                        Polyfill_12_9,0,FAST_MOUSE);
1440
1546
  Init_operation(OPERATION_POLYFILL,0,8,
1441
 
                        Polyfill_0_8,1);
 
1547
                        Polyfill_0_8,HIDE_CURSOR,FAST_MOUSE);
1442
1548
  Init_operation(OPERATION_POLYFILL,0,9,
1443
 
                        Polyfill_12_8,0);
 
1549
                        Polyfill_12_8,0,FAST_MOUSE);
1444
1550
 
1445
1551
  Init_operation(OPERATION_POLYFORM,1,0,
1446
 
                        Polyform_12_0,1);
 
1552
                        Polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
1447
1553
  Init_operation(OPERATION_POLYFORM,2,0,
1448
 
                        Polyform_12_0,1);
 
1554
                        Polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
1449
1555
  Init_operation(OPERATION_POLYFORM,1,8,
1450
 
                        Polyform_12_8,0);
 
1556
                        Polyform_12_8,0,0);
1451
1557
  Init_operation(OPERATION_POLYFORM,2,8,
1452
 
                        Polyform_12_8,0);
 
1558
                        Polyform_12_8,0,0);
1453
1559
  Init_operation(OPERATION_POLYFORM,0,8,
1454
 
                        Polyform_0_8,0);
 
1560
                        Polyform_0_8,0,FAST_MOUSE);
1455
1561
 
1456
1562
  Init_operation(OPERATION_FILLED_POLYFORM,1,0,
1457
 
                        Filled_polyform_12_0,1);
 
1563
                        Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
1458
1564
  Init_operation(OPERATION_FILLED_POLYFORM,2,0,
1459
 
                        Filled_polyform_12_0,1);
 
1565
                        Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
1460
1566
  Init_operation(OPERATION_FILLED_POLYFORM,1,8,
1461
 
                        Filled_polyform_12_8,0);
 
1567
                        Filled_polyform_12_8,0,0);
1462
1568
  Init_operation(OPERATION_FILLED_POLYFORM,2,8,
1463
 
                        Filled_polyform_12_8,0);
 
1569
                        Filled_polyform_12_8,0,0);
1464
1570
  Init_operation(OPERATION_FILLED_POLYFORM,0,8,
1465
 
                        Filled_polyform_0_8,0);
 
1571
                        Filled_polyform_0_8,0,FAST_MOUSE);
1466
1572
 
1467
1573
  Init_operation(OPERATION_FILLED_CONTOUR,1,0,
1468
 
                        Filled_polyform_12_0,1);
 
1574
                        Filled_polyform_12_0,HIDE_CURSOR,0);
1469
1575
  Init_operation(OPERATION_FILLED_CONTOUR,2,0,
1470
 
                        Filled_polyform_12_0,1);
 
1576
                        Filled_polyform_12_0,HIDE_CURSOR,0);
1471
1577
  Init_operation(OPERATION_FILLED_CONTOUR,1,8,
1472
 
                        Filled_polyform_12_8,0);
 
1578
                        Filled_polyform_12_8,0,0);
1473
1579
  Init_operation(OPERATION_FILLED_CONTOUR,2,8,
1474
 
                        Filled_polyform_12_8,0);
 
1580
                        Filled_polyform_12_8,0,0);
1475
1581
  Init_operation(OPERATION_FILLED_CONTOUR,0,8,
1476
 
                        Filled_contour_0_8,0);
 
1582
                        Filled_contour_0_8,0,0);
1477
1583
 
1478
1584
  Init_operation(OPERATION_SCROLL,1,0,
1479
 
                        Scroll_12_0,1);
 
1585
                        Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
1480
1586
  Init_operation(OPERATION_SCROLL,2,0,
1481
 
                        Scroll_12_0,1);
 
1587
                        Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
1482
1588
  Init_operation(OPERATION_SCROLL,1,4,
1483
 
                        Scroll_12_4,0);
 
1589
                        Scroll_12_4,0,FAST_MOUSE);
1484
1590
  Init_operation(OPERATION_SCROLL,2,4,
1485
 
                        Scroll_12_4,0);
 
1591
                        Scroll_12_4,0,FAST_MOUSE);
1486
1592
  Init_operation(OPERATION_SCROLL,0,4,
1487
 
                        Scroll_0_4,1);
1488
 
 
1489
 
  Init_operation(OPERATION_GRAD_CIRCLE,1,0,Grad_circle_12_0,1);
1490
 
  Init_operation(OPERATION_GRAD_CIRCLE,2,0,Grad_circle_12_0,1);
1491
 
  Init_operation(OPERATION_GRAD_CIRCLE,1,6,Grad_circle_12_6,0);
1492
 
  Init_operation(OPERATION_GRAD_CIRCLE,2,6,Grad_circle_12_6,0);
1493
 
  Init_operation(OPERATION_GRAD_CIRCLE,0,6,Grad_circle_0_6,1);
1494
 
  Init_operation(OPERATION_GRAD_CIRCLE,1,8,Grad_circle_12_8,0);
1495
 
  Init_operation(OPERATION_GRAD_CIRCLE,2,8,Grad_circle_12_8,0);
1496
 
  Init_operation(OPERATION_GRAD_CIRCLE,0,8,Grad_circle_or_ellipse_0_8,0);
1497
 
 
1498
 
  Init_operation(OPERATION_GRAD_ELLIPSE,1,0,Grad_ellipse_12_0,1);
1499
 
  Init_operation(OPERATION_GRAD_ELLIPSE,2,0,Grad_ellipse_12_0,1);
1500
 
  Init_operation(OPERATION_GRAD_ELLIPSE,1,6,Grad_ellipse_12_6,0);
1501
 
  Init_operation(OPERATION_GRAD_ELLIPSE,2,6,Grad_ellipse_12_6,0);
1502
 
  Init_operation(OPERATION_GRAD_ELLIPSE,0,6,Grad_ellipse_0_6,1);
1503
 
  Init_operation(OPERATION_GRAD_ELLIPSE,1,8,Grad_ellipse_12_8,0);
1504
 
  Init_operation(OPERATION_GRAD_ELLIPSE,2,8,Grad_ellipse_12_8,0);
1505
 
  Init_operation(OPERATION_GRAD_ELLIPSE,0,8,Grad_circle_or_ellipse_0_8,0);
1506
 
 
1507
 
  Init_operation(OPERATION_GRAD_RECTANGLE,1,0,Grad_rectangle_12_0,0);
1508
 
  Init_operation(OPERATION_GRAD_RECTANGLE,1,5,Grad_rectangle_12_5,0);
1509
 
  Init_operation(OPERATION_GRAD_RECTANGLE,0,5,Grad_rectangle_0_5,1);
1510
 
  Init_operation(OPERATION_GRAD_RECTANGLE,0,7,Grad_rectangle_0_7,0);
1511
 
  Init_operation(OPERATION_GRAD_RECTANGLE,1,7,Grad_rectangle_12_7,1);
1512
 
  Init_operation(OPERATION_GRAD_RECTANGLE,2,7,Grad_rectangle_12_7,1);
1513
 
  Init_operation(OPERATION_GRAD_RECTANGLE,1,9,Grad_rectangle_12_9,1);
1514
 
  Init_operation(OPERATION_GRAD_RECTANGLE,0,9,Grad_rectangle_0_9,0);
 
1593
                        Scroll_0_4,HIDE_CURSOR,FAST_MOUSE);
 
1594
 
 
1595
  Init_operation(OPERATION_GRAD_CIRCLE,1,0,Grad_circle_12_0,HIDE_CURSOR,FAST_MOUSE);
 
1596
  Init_operation(OPERATION_GRAD_CIRCLE,2,0,Grad_circle_12_0,HIDE_CURSOR,FAST_MOUSE);
 
1597
  Init_operation(OPERATION_GRAD_CIRCLE,1,6,Grad_circle_12_6,0,FAST_MOUSE);
 
1598
  Init_operation(OPERATION_GRAD_CIRCLE,2,6,Grad_circle_12_6,0,FAST_MOUSE);
 
1599
  Init_operation(OPERATION_GRAD_CIRCLE,0,6,Grad_circle_0_6,HIDE_CURSOR,FAST_MOUSE);
 
1600
  Init_operation(OPERATION_GRAD_CIRCLE,1,8,Grad_circle_12_8,0,FAST_MOUSE);
 
1601
  Init_operation(OPERATION_GRAD_CIRCLE,2,8,Grad_circle_12_8,0,FAST_MOUSE);
 
1602
  Init_operation(OPERATION_GRAD_CIRCLE,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
 
1603
 
 
1604
  Init_operation(OPERATION_GRAD_ELLIPSE,1,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
 
1605
  Init_operation(OPERATION_GRAD_ELLIPSE,2,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
 
1606
  Init_operation(OPERATION_GRAD_ELLIPSE,1,6,Grad_ellipse_12_6,0,FAST_MOUSE);
 
1607
  Init_operation(OPERATION_GRAD_ELLIPSE,2,6,Grad_ellipse_12_6,0,FAST_MOUSE);
 
1608
  Init_operation(OPERATION_GRAD_ELLIPSE,0,6,Grad_ellipse_0_6,HIDE_CURSOR,FAST_MOUSE);
 
1609
  Init_operation(OPERATION_GRAD_ELLIPSE,1,8,Grad_ellipse_12_8,0,FAST_MOUSE);
 
1610
  Init_operation(OPERATION_GRAD_ELLIPSE,2,8,Grad_ellipse_12_8,0,FAST_MOUSE);
 
1611
  Init_operation(OPERATION_GRAD_ELLIPSE,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
 
1612
 
 
1613
  Init_operation(OPERATION_GRAD_RECTANGLE,1,0,Grad_rectangle_12_0,0,FAST_MOUSE);
 
1614
  Init_operation(OPERATION_GRAD_RECTANGLE,1,5,Grad_rectangle_12_5,0,FAST_MOUSE);
 
1615
  Init_operation(OPERATION_GRAD_RECTANGLE,0,5,Grad_rectangle_0_5,HIDE_CURSOR,FAST_MOUSE);
 
1616
  Init_operation(OPERATION_GRAD_RECTANGLE,0,7,Grad_rectangle_0_7,0,FAST_MOUSE);
 
1617
  Init_operation(OPERATION_GRAD_RECTANGLE,1,7,Grad_rectangle_12_7,HIDE_CURSOR,FAST_MOUSE);
 
1618
  Init_operation(OPERATION_GRAD_RECTANGLE,2,7,Grad_rectangle_12_7,HIDE_CURSOR,FAST_MOUSE);
 
1619
  Init_operation(OPERATION_GRAD_RECTANGLE,1,9,Grad_rectangle_12_9,HIDE_CURSOR,FAST_MOUSE);
 
1620
  Init_operation(OPERATION_GRAD_RECTANGLE,0,9,Grad_rectangle_0_9,0,FAST_MOUSE);
1515
1621
 
1516
1622
 
1517
1623
  Init_operation(OPERATION_CENTERED_LINES,1,0,
1518
 
                        Centered_lines_12_0,1);
 
1624
                        Centered_lines_12_0,HIDE_CURSOR,FAST_MOUSE);
1519
1625
  Init_operation(OPERATION_CENTERED_LINES,2,0,
1520
 
                        Centered_lines_12_0,1);
 
1626
                        Centered_lines_12_0,HIDE_CURSOR,FAST_MOUSE);
1521
1627
  Init_operation(OPERATION_CENTERED_LINES,1,3,
1522
 
                        Centered_lines_12_3,0);
 
1628
                        Centered_lines_12_3,0,FAST_MOUSE);
1523
1629
  Init_operation(OPERATION_CENTERED_LINES,2,3,
1524
 
                        Centered_lines_12_3,0);
 
1630
                        Centered_lines_12_3,0,FAST_MOUSE);
1525
1631
  Init_operation(OPERATION_CENTERED_LINES,0,3,
1526
 
                        Centered_lines_0_3,1);
 
1632
                        Centered_lines_0_3,HIDE_CURSOR,FAST_MOUSE);
1527
1633
  Init_operation(OPERATION_CENTERED_LINES,1,7,
1528
 
                        Centered_lines_12_7,0);
 
1634
                        Centered_lines_12_7,0,FAST_MOUSE);
1529
1635
  Init_operation(OPERATION_CENTERED_LINES,2,7,
1530
 
                        Centered_lines_12_7,0);
 
1636
                        Centered_lines_12_7,0,FAST_MOUSE);
1531
1637
  Init_operation(OPERATION_CENTERED_LINES,0,7,
1532
 
                        Centered_lines_0_7,0);
 
1638
                        Centered_lines_0_7,0,FAST_MOUSE);
1533
1639
}
1534
1640
 
1535
1641
 
1671
1777
    for (index=0; Modes[index]; index++)
1672
1778
    {
1673
1779
      int index2;
1674
 
      for (index2=1; index2 < Nb_video_modes; index2++)
 
1780
#if defined(__GP2X__)
 
1781
          // On the GP2X the first mode is not windowed, so include it in the search.
 
1782
          index2=0;
 
1783
#else
 
1784
          index2=1;
 
1785
#endif
 
1786
      for (/**/; index2 < Nb_video_modes; index2++)
1675
1787
        if (Modes[index]->w == Video_mode[index2].Width &&
1676
1788
            Modes[index]->h == Video_mode[index2].Height)
1677
1789
        {
1813
1925
              !Read_word_le(Handle, &cfg_video_mode.Height) )
1814
1926
            goto Erreur_lecture_config;
1815
1927
 
1816
 
          for (index2=1; index2<Nb_video_modes; index2++)
 
1928
#if defined(__GP2X__)
 
1929
                  index2=0;
 
1930
#else
 
1931
                  index2=1;
 
1932
#endif
 
1933
          for (/**/; index2<Nb_video_modes; index2++)
1817
1934
          {
1818
1935
            if (Video_mode[index2].Width==cfg_video_mode.Width &&
1819
1936
                Video_mode[index2].Height==cfg_video_mode.Height)
2044
2161
 
2045
2162
  // D'abord compter les modes pour lesquels l'utilisateur a mis une pr�f�rence
2046
2163
  modes_to_save=0;
2047
 
  for (index=1; index<Nb_video_modes; index++)
 
2164
#if defined(__GP2X__)
 
2165
  index = 0;
 
2166
#else
 
2167
  index = 1;
 
2168
#endif
 
2169
  for (/**/; index<Nb_video_modes; index++)
2048
2170
    if (Video_mode[index].State==0 || Video_mode[index].State==2 || Video_mode[index].State==3)
2049
2171
      modes_to_save++;
2050
2172
 
2055
2177
  if (!Write_byte(Handle, Chunk.Number) ||
2056
2178
      !Write_word_le(Handle, Chunk.Size) )
2057
2179
    goto Erreur_sauvegarde_config;
2058
 
  for (index=1; index<Nb_video_modes; index++)
 
2180
#if defined(__GP2X__)
 
2181
  index = 0;
 
2182
#else
 
2183
  index = 1;
 
2184
#endif
 
2185
  for (/**/; index<Nb_video_modes; index++)
2059
2186
    if (Video_mode[index].State==0 || Video_mode[index].State==2 || Video_mode[index].State==3)
2060
2187
    {
2061
2188
      cfg_video_mode.State   =Video_mode[index].State;
2319
2446
#endif
2320
2447
}
2321
2448
 
 
2449
void Init_brush_container(void)
 
2450
{
 
2451
  int i;
 
2452
  
 
2453
  for (i=0; i<BRUSH_CONTAINER_COLUMNS*BRUSH_CONTAINER_ROWS; i++)
 
2454
  {
 
2455
    int x,y;
 
2456
    
 
2457
    Brush_container[i].Paintbrush_shape=PAINTBRUSH_SHAPE_MAX;
 
2458
    Brush_container[i].Width=0;
 
2459
    Brush_container[i].Height=0;
 
2460
    memset(Brush_container[i].Palette,sizeof(T_Palette),0);
 
2461
    Brush_container[i].Transp_color=0;  
 
2462
    for (y=0; y<BRUSH_CONTAINER_PREVIEW_WIDTH; y++)
 
2463
      for (x=0; x<BRUSH_CONTAINER_PREVIEW_HEIGHT; x++)
 
2464
        Brush_container[i].Thumbnail[y][x]=0;
 
2465
        
 
2466
    Brush_container[i].Brush = NULL;
 
2467
  }
 
2468
}
 
 
b'\\ No newline at end of file'