[layers] Merged r1063 from trunk. Separated the controls for layers from translucency keys. Can now control up to 8 layers

git-svn-id: svn://pulkomandy.tk/GrafX2/branches/layers@1065 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-10-07 00:07:27 +00:00
commit 0b07b43722
30 changed files with 370 additions and 115 deletions

View File

@ -175,6 +175,23 @@ else
CC = gcc
OBJDIR = obj/skyos
ZIP = zip
else ifeq ($(findstring Kickstart,$(shell version)),Kickstart)
# Classic amiga without gcc. Use vbcc.
PLATFORM = amiga-vbcc
DELCOMMAND = delete
MKDIR = makedir
RMDIR= delete
CP = copy
BIN = grafx2
COPT = -c99 -Ivbcc:PosixLib/include -D__amigaos__ $(TTFCOPT)
CC = vc
OBJDIR = obj/amiga-vbcc
ZIP = lha
ZIPOPT = a
NOTTF = 1
else
# Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested.
@ -245,12 +262,16 @@ else
JOYCOPT =
endif
ifneq ($(PLATFORM),amiga-vbcc)
COPT += -DSVN_revision='"$(shell svnversion .)"' -DProgram_version='"$(LABEL)"'
endif
### And now for the real build rules ###
.PHONY : all debug release clean depend zip version force install uninstall
.PHONY : all debug release clean depend zip force install uninstall
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o $(PLATFORMOBJ)
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o $(PLATFORMOBJ)
SKIN_FILES = skins/skin_classic.png skins/skin_modern.png skins/font_Classic.png skins/font_Fun.png
@ -295,27 +316,6 @@ testsed :
$(BIN) : $(OBJ)
$(CC) $(OBJ) -o $(BIN) $(LOPT)
# SVN revision number
version.c :
echo "char SVN_revision[]=\"`svnversion .`\";" > version.c
ifeq ($(LABEL),)
else
echo "char Program_version[]=\"$(LABEL)\";" > pversion.c
endif
version : delversion delpversion version.c pversion.c $(OBJDIR)/version.o $(OBJDIR)/pversion.o all
delversion :
$(DELCOMMAND) version.c
delpversion :
ifeq ($(LABEL),)
else
$(DELCOMMAND) pversion.c
endif
$(OBJDIR)/%.o : %.c
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
$(CC) $(COPT) -c $*.c -o $(OBJDIR)/$*.o
@ -335,6 +335,7 @@ clean :
$(DELCOMMAND) $(OBJ)
$(DELCOMMAND) $(BIN)
ifneq ($(PLATFORM),amiga-vbcc)
# Linux installation of the program
install : $(BIN)
# Create dirs
@ -376,5 +377,7 @@ uninstall :
$(DELCOMMAND) $(DESTDIR)$(datadir)/icons/grafx2.xpm
@echo Uninstall complete
endif
-include Makefile.dep

View File

@ -4,7 +4,7 @@ $(OBJDIR)/brush.o: brush.c global.h struct.h const.h graph.h misc.h errors.h \
$(OBJDIR)/buttons.o: buttons.c const.h struct.h global.h misc.h graph.h engine.h \
readline.h filesel.h loadsave.h init.h buttons.h operatio.h pages.h \
palette.h errors.h readini.h saveini.h shade.h io.h help.h text.h \
sdlscreen.h windows.h brush.h input.h
sdlscreen.h windows.h brush.h input.h special.h
$(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h \
buttons.h operatio.h shade.h errors.h sdlscreen.h windows.h brush.h \
input.h engine.h
@ -26,7 +26,8 @@ $(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h
$(OBJDIR)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h
$(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h errors.h global.h io.h \
loadsave.h misc.h op_c.h pages.h palette.h sdlscreen.h windows.h
loadsave.h misc.h op_c.h pages.h palette.h sdlscreen.h windows.h \
engine.h
$(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.h \
engine.h pages.h loadsave.h sdlscreen.h errors.h readini.h saveini.h \
io.h text.h setup.h windows.h brush.h palette.h realpath.h
@ -43,18 +44,20 @@ $(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readlin
palette.h shade.h
$(OBJDIR)/pversion.o: pversion.c
$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h misc.h \
pxdouble.h pxwide.h
$(OBJDIR)/pxquad.o: pxquad.c global.h struct.h const.h sdlscreen.h misc.h pxquad.h
graph.h pxdouble.h pxwide.h
$(OBJDIR)/pxquad.o: pxquad.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxquad.h
$(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h sdlscreen.h misc.h \
pxsimple.h
$(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h misc.h pxtall.h \
pxsimple.h
$(OBJDIR)/pxtall2.o: pxtall2.c global.h struct.h const.h sdlscreen.h misc.h \
graph.h pxsimple.h
$(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxtall.h pxsimple.h
$(OBJDIR)/pxtall2.o: pxtall2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxtall2.h
$(OBJDIR)/pxtriple.o: pxtriple.c global.h struct.h const.h sdlscreen.h misc.h \
pxtriple.h
$(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h sdlscreen.h misc.h pxwide.h
$(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h \
graph.h pxtriple.h
$(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxwide.h
$(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxwide2.h
$(OBJDIR)/readini.o: readini.c const.h global.h struct.h misc.h readini.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h misc.h errors.h \
@ -76,4 +79,4 @@ $(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.
pages.h
$(OBJDIR)/version.o: version.c
$(OBJDIR)/windows.o: windows.c windows.h struct.h const.h global.h graph.h engine.h \
misc.h sdlscreen.h errors.h
misc.h sdlscreen.h errors.h input.h

View File

@ -53,6 +53,10 @@
#include "input.h"
#include "special.h"
#ifdef __VBCC__
#define __attribute__(x)
#endif
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/dos.h>
#include <dirent.h>
@ -66,7 +70,7 @@
#define isHidden(x) ((x)->d_name[0]=='.')
#endif
extern char Program_version[]; // generated in pversion.c
//extern char Program_version[]; // generated in pversion.c
extern short Old_MX;
extern short Old_MY;
@ -1508,7 +1512,7 @@ void Button_Copy_page(void)
Copy_image_only();
if (clicked_button==5)
Remap_picture();
Remap_spare();
if (clicked_button!=2) // copie de la palette
memcpy(Spare_palette,Main_palette,sizeof(T_Palette));
@ -4282,6 +4286,9 @@ void Transparency_set(byte amount)
void Layer_activate(short layer, short side)
{
byte old_layers;
if (layer >= Main_backups->Pages->Nb_layers)
return;
// Keep a copy of which layers were visible
old_layers = Main_layers_visible;

18
const.h
View File

@ -33,7 +33,7 @@
#define BETA1 98 ///< Version number for gfx2.cfg (3/4)
#define BETA2 0 ///< Version number for gfx2.cfg (4/4)
#define MAX_VIDEO_MODES 100 ///< Maximum number of video modes Grafx2 can propose.
#define NB_SHORTCUTS 159 ///< Number of actions that can have a key combination associated to it.
#define NB_SHORTCUTS 175 ///< Number of actions that can have a key combination associated to it.
#define NB_ZOOM_FACTORS 12 ///< Number of zoom levels available in the magnifier.
#define MENU_WIDTH 254 ///< Width of the menu (not counting the palette)
#define MENU_HEIGHT 44 ///< Height of the menu.
@ -408,6 +408,22 @@ enum SPECIAL_ACTIONS
SPECIAL_ZOOM_18,
SPECIAL_ZOOM_20,
SPECIAL_SHOW_GRID,
SPECIAL_LAYER1_SELECT,
SPECIAL_LAYER1_TOGGLE,
SPECIAL_LAYER2_SELECT,
SPECIAL_LAYER2_TOGGLE,
SPECIAL_LAYER3_SELECT,
SPECIAL_LAYER3_TOGGLE,
SPECIAL_LAYER4_SELECT,
SPECIAL_LAYER4_TOGGLE,
SPECIAL_LAYER5_SELECT,
SPECIAL_LAYER5_TOGGLE,
SPECIAL_LAYER6_SELECT,
SPECIAL_LAYER6_TOGGLE,
SPECIAL_LAYER7_SELECT,
SPECIAL_LAYER7_TOGGLE,
SPECIAL_LAYER8_SELECT,
SPECIAL_LAYER8_TOGGLE,
NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts
};

View File

@ -21,6 +21,10 @@
/// Functions and macros for tracing and error reporting.
//////////////////////////////////////////////////////////////////////////////
#ifndef __func__
#define __func__ "stupid compiler !"
#endif
/// Prints the source filename, line number, function name, a string and an integer.
#define DEBUG(y,z) printf("%s %d %s | %s : %d###\n",__FILE__,__LINE__,__func__,y,(unsigned int)z)

BIN
gfx2.cfg

Binary file not shown.

View File

@ -47,6 +47,11 @@
#include "windows.h"
#include "input.h"
#ifdef __VBCC__
#define __attribute__(x)
#define M_PI 3.141592653589793238462643
#endif
// Generic pixel-drawing function.
Func_pixel Pixel_figure;
@ -618,7 +623,7 @@ void Resize_image(word chosen_width,word chosen_height)
void Remap_picture(void)
void Remap_spare(void)
{
short x_pos; // Variable de balayage de la brosse
short y_pos; // Variable de balayage de la brosse
@ -2857,4 +2862,4 @@ void Redraw_grid(short x, short y, unsigned short w, unsigned short h)
Vertical_grid_line(col, y, h);
col+= Snap_width*Main_magnifier_factor;
}
}
}

View File

@ -95,7 +95,8 @@ void Draw_grad_rectangle(short rax,short ray,short rbx,short rby,short vax,short
void Polyfill_general(int vertices, short * points, int color);
void Polyfill(int vertices, short * points, int color);
void Remap_picture(void);
/// Remap the spare page according to the main page's palette
void Remap_spare(void);
///
/// All the figure-drawing functions work by calling this function for each

3
help.c
View File

@ -46,9 +46,6 @@
#include "hotkeys.h"
#include "errors.h"
extern char SVN_revision[]; // generated in version.c
extern char Program_version[]; // generated in pversion.c
// Recherche un raccourci clavier:
word * Shortcut(word shortcut_number)
{

View File

@ -283,6 +283,23 @@ static const T_Help_table helptable_help[] =
HELP_LINK (" Next : %s", SPECIAL_NEXT_USER_BACKCOLOR)
HELP_LINK (" Previous: %s", SPECIAL_PREVIOUS_USER_BACKCOLOR)
HELP_TEXT ("")
HELP_TEXT ("LAYERS")
HELP_LINK (" Select 1 : %s", SPECIAL_LAYER1_SELECT)
HELP_LINK (" Toggle 1 : %s", SPECIAL_LAYER1_TOGGLE)
HELP_LINK (" Select 2 : %s", SPECIAL_LAYER2_SELECT)
HELP_LINK (" Toggle 2 : %s", SPECIAL_LAYER2_TOGGLE)
HELP_LINK (" Select 3 : %s", SPECIAL_LAYER3_SELECT)
HELP_LINK (" Toggle 3 : %s", SPECIAL_LAYER3_TOGGLE)
HELP_LINK (" Select 4 : %s", SPECIAL_LAYER4_SELECT)
HELP_LINK (" Toggle 4 : %s", SPECIAL_LAYER4_TOGGLE)
HELP_LINK (" Select 5 : %s", SPECIAL_LAYER5_SELECT)
HELP_LINK (" Toggle 5 : %s", SPECIAL_LAYER5_TOGGLE)
HELP_LINK (" Select 6 : %s", SPECIAL_LAYER6_SELECT)
HELP_LINK (" Toggle 6 : %s", SPECIAL_LAYER6_TOGGLE)
HELP_LINK (" Select 7 : %s", SPECIAL_LAYER7_SELECT)
HELP_LINK (" Toggle 7 : %s", SPECIAL_LAYER7_TOGGLE)
HELP_LINK (" Select 8 : %s", SPECIAL_LAYER8_SELECT)
HELP_LINK (" Toggle 8 : %s", SPECIAL_LAYER8_TOGGLE)
};
static const T_Help_table helptable_credits[] =
{

150
hotkeys.c
View File

@ -21,6 +21,11 @@
#include "global.h"
#include "hotkeys.h"
#ifdef __VBCC__
#define false 0
#define true 1
#endif
T_Key_config ConfigKey[NB_SHORTCUTS] = {
{0,
"Scroll up",
@ -1294,6 +1299,135 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
true,
SDLK_g|MOD_SHIFT|MOD_ALT, // Shift + Alt + G,
0},
{159,
"Select layer 1",
"Makes the layer 1 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{160,
"Toggle layer 1",
"Makes layer 1 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
{161,
"Select layer 2",
"Makes the layer 2 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{162,
"Toggle layer 2",
"Makes layer 2 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
{163,
"Select layer 3",
"Makes the layer 3 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{164,
"Toggle layer 3",
"Makes layer 3 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
{165,
"Select layer 4",
"Makes the layer 4 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{166,
"Toggle layer 4",
"Makes layer 4 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
{167,
"Select layer 5",
"Makes the layer 5 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{168,
"Toggle layer 5",
"Makes layer 5 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
{169,
"Select layer 6",
"Makes the layer 6 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{170,
"Toggle layer 6",
"Makes layer 6 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
{171,
"Select layer 7",
"Makes the layer 7 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{172,
"Toggle layer 7",
"Makes layer 7 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
{173,
"Select layer 8",
"Makes the layer 8 visible and",
"set it as the active one, where",
"you can draw.",
true,
0,
0},
{174,
"Toggle layer 8",
"Makes layer 8 visible or invisible.",
"If it's the current active layer,",
"toggle all other layers instead.",
true,
0,
0},
};
word Ordering[NB_SHORTCUTS]=
@ -1457,4 +1591,20 @@ word Ordering[NB_SHORTCUTS]=
SPECIAL_ZOOM_18, /**< Sets zoom factor to 18:1 */
SPECIAL_ZOOM_20, /**< Sets zoom factor to 20:1 */
SPECIAL_SHOW_GRID,
SPECIAL_LAYER1_SELECT,
SPECIAL_LAYER1_TOGGLE,
SPECIAL_LAYER2_SELECT,
SPECIAL_LAYER2_TOGGLE,
SPECIAL_LAYER3_SELECT,
SPECIAL_LAYER3_TOGGLE,
SPECIAL_LAYER4_SELECT,
SPECIAL_LAYER4_TOGGLE,
SPECIAL_LAYER5_SELECT,
SPECIAL_LAYER5_TOGGLE,
SPECIAL_LAYER6_SELECT,
SPECIAL_LAYER6_TOGGLE,
SPECIAL_LAYER7_SELECT,
SPECIAL_LAYER7_TOGGLE,
SPECIAL_LAYER8_SELECT,
SPECIAL_LAYER8_TOGGLE,
};

View File

@ -24,7 +24,11 @@
/// The actual data is in hotkeys.c
//////////////////////////////////////////////////////////////////////////////
#include <stdbool.h>
#ifndef __VBCC__
#include <stdbool.h>
#else
#define bool char
#endif
#include <SDL.h>
/*** Types definitions and structs ***/

9
init.c
View File

@ -25,11 +25,14 @@
#if defined(__WIN32__) || defined(__linux__)
#define GRAFX2_CATCHES_SIGNALS
#endif
#include <fcntl.h>
#include <stdio.h>
#include <fcntl.h>
//#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#ifndef __VBCC__
#include <unistd.h>
#endif
#include <stdlib.h>
#include <errno.h>
#include <SDL_byteorder.h>

45
input.c
View File

@ -28,6 +28,10 @@
#include "misc.h"
#include "input.h"
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Handle_window_resize(SDL_ResizeEvent event);
void Handle_window_exit(SDL_QuitEvent event);
@ -198,40 +202,6 @@ int Move_cursor_with_constraints()
return feedback;
}
// Inhibits a key shortcut if it's disallowed during an operation.
dword Inhibit_shortcut(dword key)
{
if (Operation_stack_size!=0 && key != 0)
{
//Enfin, on inhibe les touches (sauf si c'est un changement de couleur
//ou de taille de pinceau lors d'une des operations suivantes:
//OPERATION_CONTINUOUS_DRAW, OPERATION_DISCONTINUOUS_DRAW, OPERATION_AIRBRUSH)
if(Allow_color_change_during_operation)
{
//A ce stade là, on sait qu'on est dans une des 3 opérations
//supportant le changement de couleur ou de taille de pinceau.
if(
(!Is_shortcut(key,SPECIAL_NEXT_FORECOLOR)) &&
(!Is_shortcut(key,SPECIAL_PREVIOUS_FORECOLOR)) &&
(!Is_shortcut(key,SPECIAL_NEXT_BACKCOLOR)) &&
(!Is_shortcut(key,SPECIAL_PREVIOUS_BACKCOLOR)) &&
(!Is_shortcut(key,SPECIAL_SMALLER_PAINTBRUSH)) &&
(!Is_shortcut(key,SPECIAL_BIGGER_PAINTBRUSH)) &&
(!Is_shortcut(key,SPECIAL_NEXT_USER_FORECOLOR)) &&
(!Is_shortcut(key,SPECIAL_PREVIOUS_USER_FORECOLOR)) &&
(!Is_shortcut(key,SPECIAL_NEXT_USER_BACKCOLOR)) &&
(!Is_shortcut(key,SPECIAL_PREVIOUS_USER_BACKCOLOR))
)
{
key=0;
}
}
else key = 0;
}
return key;
}
// WM events management
void Handle_window_resize(SDL_ResizeEvent event)
@ -290,16 +260,16 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
break;
case SDL_BUTTON_MIDDLE:
Key = Inhibit_shortcut(KEY_MOUSEMIDDLE|Key_modifiers(SDL_GetModState()));
Key = KEY_MOUSEMIDDLE|Key_modifiers(SDL_GetModState());
// TODO: repeat system maybe?
return 0;
case SDL_BUTTON_WHEELUP:
Key = Inhibit_shortcut(KEY_MOUSEWHEELUP|Key_modifiers(SDL_GetModState()));
Key = KEY_MOUSEWHEELUP|Key_modifiers(SDL_GetModState());
return 0;
case SDL_BUTTON_WHEELDOWN:
Key = Inhibit_shortcut(KEY_MOUSEWHEELDOWN|Key_modifiers(SDL_GetModState()));
Key = KEY_MOUSEWHEELDOWN|Key_modifiers(SDL_GetModState());
return 0;
default:
return 0;
@ -364,7 +334,6 @@ int Handle_key_press(SDL_KeyboardEvent event)
return Move_cursor_with_constraints();
}
Key = Inhibit_shortcut(Key);
return 0;
}

View File

@ -871,6 +871,7 @@ void Save_PAL(void)
//////////////////////////////////// IMG ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
byte Filler1[6];
@ -878,7 +879,8 @@ typedef struct
word Height;
byte Filler2[118];
T_Palette Palette;
} __attribute__((__packed__)) T_IMG_Header;
} T_IMG_Header;
#pragma pack()
// -- Tester si un fichier est au format IMG --------------------------------
void Test_IMG(void)
@ -1040,6 +1042,7 @@ void Save_IMG(void)
//////////////////////////////////// PKM ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
char Ident[3]; // Chaîne "PKM" }
@ -1053,7 +1056,8 @@ typedef struct
T_Palette Palette; // Palette RVB 256*3
word Jump; // Taille du saut entre le header et l'image:
// On va s'en servir pour rajouter un commentaire
} __attribute__((__packed__)) T_PKM_Header;
} T_PKM_Header;
#pragma pack()
// -- Tester si un fichier est au format PKM --------------------------------
void Test_PKM(void)
@ -1498,6 +1502,7 @@ void Save_PKM(void)
//////////////////////////////////// LBM ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
word Width;
@ -1513,7 +1518,8 @@ typedef struct
byte Y_aspect; // Inutile
word X_screen;
word Y_screen;
} __attribute__((__packed__)) T_LBM_Header;
} T_LBM_Header;
#pragma pack()
byte * LBM_buffer;
FILE *LBM_file;
@ -2282,7 +2288,7 @@ void Save_LBM(void)
//////////////////////////////////// BMP ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
word Signature; // ='BM' = 0x4D42
@ -2302,7 +2308,8 @@ typedef struct
dword YPM;
dword Nb_Clr;
dword Clr_Imprt;
} __attribute__((__packed__)) T_BMP_Header;
} T_BMP_Header;
#pragma pack()
// -- Tester si un fichier est au format BMP --------------------------------
void Test_BMP(void)
@ -2852,6 +2859,7 @@ void Save_BMP(void)
//////////////////////////////////// GIF ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
word Width; // width de l'écran virtuel
@ -2859,7 +2867,7 @@ typedef struct
byte Resol; // Informations sur la résolution (et autres)
byte Backcol; // color de fond
byte Aspect; // Informations sur l'aspect ratio (et autres)
} __attribute__((__packed__)) T_GIF_LSDB; // Logical Screen Descriptor Block
} T_GIF_LSDB; // Logical Screen Descriptor Block
typedef struct
{
@ -2869,7 +2877,8 @@ typedef struct
word Image_height; // height de l'image
byte Indicator; // Informations diverses sur l'image
byte Nb_bits_pixel; // Nb de bits par pixel
} __attribute__((__packed__)) T_GIF_IDB; // Image Descriptor Block
} T_GIF_IDB; // Image Descriptor Block
#pragma pack()
// -- Tester si un fichier est au format GIF --------------------------------
@ -3719,6 +3728,7 @@ void Save_GIF(void)
//////////////////////////////////// PCX ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
byte Manufacturer; // |_ Il font chier ces cons! Ils auraient pu
@ -3739,7 +3749,8 @@ typedef struct
word Screen_X; // |_ Dimensions de
word Screen_Y; // | l'écran d'origine
byte Filler[54]; // Ca... J'adore!
} __attribute__((__packed__)) T_PCX_Header;
} T_PCX_Header;
#pragma pack()
T_PCX_Header PCX_header;
@ -4258,11 +4269,12 @@ void Save_PCX(void)
//////////////////////////////////// CEL ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
word Width; // width de l'image
word Height; // height de l'image
} __attribute__((__packed__)) T_CEL_Header1;
} T_CEL_Header1;
typedef struct
{
@ -4275,7 +4287,8 @@ typedef struct
word X_offset; // Offset en X de l'image
word Y_offset; // Offset en Y de l'image
byte Filler2[16]; // ???
} __attribute__((__packed__)) T_CEL_Header2;
} T_CEL_Header2;
#pragma pack()
// -- Tester si un fichier est au format CEL --------------------------------
@ -4575,6 +4588,7 @@ void Save_CEL(void)
//////////////////////////////////// KCF ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
struct
@ -4585,7 +4599,8 @@ typedef struct
byte Byte2;
} color[16];
} Palette[10];
} __attribute__((__packed__)) T_KCF_Header;
} T_KCF_Header;
#pragma pack()
// -- Tester si un fichier est au format KCF --------------------------------
@ -4834,6 +4849,7 @@ void Save_KCF(void)
//////////////////////////////////// SCx ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#pragma pack(1)
typedef struct
{
byte Filler1[4];
@ -4841,7 +4857,8 @@ typedef struct
word Height;
byte Filler2;
byte Planes;
} __attribute__((__packed__)) T_SCx_Header;
} T_SCx_Header;
#pragma pack()
// -- Tester si un fichier est au format SCx --------------------------------
void Test_SCx(void)

15
main.c
View File

@ -92,11 +92,20 @@ void Display_syntax(void)
printf("\t/tall2 to emulate a video mode with double tall pixels (2x4)\n");
printf("\t/triple to emulate a video mode with triple pixels (3x3)\n");
printf("\t/quadruple to emulate a video mode with quadruple pixels (4x4)\n");
printf("\t/skin <filename> use an alternate file with the menu graphics\n");
printf("\t/rgb n to reduce RGB precision from 256 to n levels\n");
printf("\t/skin <filename> to use an alternate file with the menu graphics\n");
printf("\t/mode <videomode> to set a video mode\n\n");
printf("Available video modes:\n\n");
for (mode_index=0; mode_index<Nb_video_modes; mode_index++)
printf("\t%s\n",Mode_label(mode_index));
for (mode_index = 0; mode_index < Nb_video_modes; mode_index += 12)
{
int k;
for (k = 0; k < 6; k++)
{
if (mode_index + k >= Nb_video_modes) break;
printf("%12s",Mode_label(mode_index + k));
}
puts("");
}
}

12
misc.c
View File

@ -741,15 +741,15 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line,
#define _WIN32_WINNT 0x0500
#include <windows.h>
#elif defined(__macosx__) || defined(__FreeBSD__)
#include <sys/sysctl.h>
#include <sys/sysctl.h>
#elif defined(__BEOS__) || defined(__HAIKU__)
// sysinfo not implemented
// sysinfo not implemented
#elif defined(__AROS__) || defined(__amigaos4__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/exec.h>
#include <proto/exec.h>
#elif defined(__SKYOS__)
#include <skyos/sysinfo.h>
#include <skyos/sysinfo.h>
#else
#include <sys/sysinfo.h> // sysinfo() for free RAM
#include <sys/sysinfo.h> // sysinfo() for free RAM
#endif
// Indique quelle est la mémoire disponible
@ -870,4 +870,6 @@ int Convert_videomode_arg(const char *argument)
return mode_index;
return -1;
}

View File

@ -26,8 +26,13 @@
#ifndef MOUNTLIST_H_
# define MOUNTLIST_H_
# include <stdbool.h>
# include <sys/types.h>
#ifndef __VBCC__
# include <stdbool.h>
#else
#define bool char
#endif
#include <sys/types.h>
/* A mount table entry. */
struct mount_entry

View File

@ -35,7 +35,8 @@
#include "brush.h"
#include "windows.h"
#if defined(__GP2X__)
// PI is NOT part of math.h according to C standards...
#if defined(__GP2X__) || defined(__VBCC__)
#define M_PI 3.14159265358979323846
#endif

View File

@ -32,6 +32,10 @@
#define ZOOMX 2
#define ZOOMY 2
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Pixel_double (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -31,6 +31,10 @@
#define ZOOMX 4
#define ZOOMY 4
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Pixel_quad (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -28,6 +28,10 @@
#include "graph.h"
#include "pxsimple.h"
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Pixel_simple (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -32,6 +32,10 @@
#define ZOOMX 1
#define ZOOMY 2
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Pixel_tall (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -31,6 +31,10 @@
#define ZOOMX 2
#define ZOOMY 4
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Pixel_tall2 (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -31,6 +31,10 @@
#define ZOOMX 3
#define ZOOMY 3
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Pixel_triple (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -31,6 +31,10 @@
#define ZOOMX 2
#define ZOOMY 1
#ifdef __VBCC__
#define __attribute__(x)
#endif
void Pixel_wide (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -31,6 +31,10 @@
#define ZOOMX 4
#define ZOOMY 2
#ifdef __VBCC__
#define __attribute__(w)
#endif
void Pixel_wide2 (word x,word y,byte color)
/* Affiche un pixel de la color aux coords x;y à l'écran */
{

View File

@ -49,7 +49,7 @@ int Create_ConfigDirectory(char * config_dir)
#endif
}
#if defined(__macosx__) || defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#if defined(__macosx__) || defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) && !defined(__VBCC__)
#define ARG_UNUSED __attribute__((unused))
#else
#define ARG_UNUSED

View File

@ -17,6 +17,8 @@
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
#include "struct.h"
//////////////////////////////////////////////////////////////////////////////
///@file special.h
/// Editor functions that can be hooked to a keyboard shortcut, but don't have
@ -45,4 +47,4 @@ void Zoom_set(int index);
void Display_stored_brush_in_window(word x,word y,int number);
void Store_brush(int index);
byte Restore_brush(int index);
byte Restore_brush(int index);

View File

@ -70,12 +70,14 @@ typedef void (* Func_draw_brush) (byte *,word,word,word,word,word,word,byte,word
typedef void (* Func_draw_list_item) (word,word,word,byte);
/// A set of RGB values.
#pragma pack(1)
typedef struct
{
byte R; ///< Red
byte G; ///< Green
byte B; ///< Blue
}__attribute__ ((__packed__)) T_Components, T_Palette[256]; ///< A complete 256-entry RGB palette (768 bytes).
} T_Components, T_Palette[256]; ///< A complete 256-entry RGB palette (768 bytes).
#pragma pack()
/// A normal rectangular button in windows and menus.
typedef struct T_Normal_button
@ -225,13 +227,15 @@ typedef struct
byte Mode; ///< Shade mode: Normal, Loop, or No-saturation see ::SHADE_MODES
} T_Shade;
#pragma pack(1) // is it useful ?
/// Data for one fullscreen video mode in configuration file. Warning, this one is saved/loaded as binary.
typedef struct
{
byte State; ///< How good is the mode supported. 0:Good (white) 1:OK (light) 2:So-so (dark) 4:User-disabled (black); +128 => System doesn't support it at all.
word Width; ///< Videomode width in pixels.
word Height;///< Videomode height in pixels.
} __attribute__((__packed__)) T_Config_video_mode;
} T_Config_video_mode;
/// Header for gfx2.cfg. Warning, this one is saved/loaded as binary.
typedef struct
@ -241,7 +245,9 @@ typedef struct
byte Version2; ///< Minor version number (ex: 0)
byte Beta1; ///< Major beta version number (ex: 96)
byte Beta2; ///< Major beta version number (ex: 5)
} __attribute__((__packed__)) T_Config_header;
} T_Config_header;
#pragma pack()
/// Header for a config chunk in for gfx2.cfg. Warning, this one is saved/loaded as binary.
typedef struct
@ -250,13 +256,15 @@ typedef struct
word Size; ///< Size of the configuration block that follows, in bytes.
} T_Config_chunk;
#pragma pack(1)
/// Configuration for one keyboard shortcut in gfx2.cfg. Warning, this one is saved/loaded as binary.
typedef struct
{
word Number; ///< Indicates the shortcut action. This is a number starting from 0, which matches ::T_Key_config.Number
word Key; ///< Keyboard shortcut: SDLK_something, or -1 for none
word Key2; ///< Alternate keyboard shortcut: SDLK_something, or -1 for none
} __attribute__((__packed__)) T_Config_shortcut_info;
} T_Config_shortcut_info;
#pragma pack()
/// This structure holds all the settings saved and loaded as gfx2.ini.
typedef struct