From b12423d03be805f96627de4cb342666e9b366300 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 19 Sep 2009 22:41:51 +0000 Subject: [PATCH 1/6] Trying to compile on amiga with vbcc. Removed some useless unixisms. Still not working. Hope I did not break too much things. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1035 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- Makefile | 45 ++++++++++++++++++++++----------------------- Makefile.dep | 2 -- buttons.c | 6 +++++- errors.h | 4 ++++ graph.c | 10 +++++++--- hotkeys.h | 6 +++++- init.c | 11 +++++++---- loadsave.c | 41 +++++++++++++++++++++++++++++------------ main.c | 2 +- misc.c | 12 +++++++----- mountlist.h | 9 +++++++-- operatio.c | 3 ++- special.h | 4 +++- struct.h | 16 ++++++++++++---- 14 files changed, 111 insertions(+), 60 deletions(-) diff --git a/Makefile b/Makefile index 21af96b7..8617ae2d 100644 --- a/Makefile +++ b/Makefile @@ -175,6 +175,21 @@ 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__ + CC = vc + OBJDIR = obj/amiga-vbcc + ZIP = lha + ZIPOPT= a + else # Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested. @@ -245,12 +260,14 @@ else JOYCOPT = endif +COPT += -DSVN_revision="$(shell svnversion .)" -DProgram_Revision="$(Label)" + ### 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 +312,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 +331,7 @@ clean : $(DELCOMMAND) $(OBJ) $(DELCOMMAND) $(BIN) +ifneq ($(PLATFORM),amiga-vbcc) # Linux installation of the program install : $(BIN) # Create dirs @@ -376,5 +373,7 @@ uninstall : $(DELCOMMAND) $(DESTDIR)$(datadir)/icons/grafx2.xpm @echo Uninstall complete +endif + -include Makefile.dep diff --git a/Makefile.dep b/Makefile.dep index 3ff0f878..f911692d 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -41,7 +41,6 @@ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h misc.h \ $(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \ buttons.h pages.h help.h sdlscreen.h errors.h op_c.h windows.h input.h \ 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 @@ -74,6 +73,5 @@ $(OBJDIR)/text.o: text.c SFont.h struct.h const.h global.h sdlscreen.h io.h \ $(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.h \ sdlscreen.h windows.h input.h help.h misc.h readline.h buttons.h \ 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 diff --git a/buttons.c b/buttons.c index 1e64abd0..59ddacbc 100644 --- a/buttons.c +++ b/buttons.c @@ -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 #include @@ -5965,4 +5969,4 @@ void Button_Brush_container(void) //Unselect_button(BUTTON_PAINTBRUSHES); Display_cursor(); -} \ No newline at end of file +} diff --git a/errors.h b/errors.h index 238471b7..cade3071 100644 --- a/errors.h +++ b/errors.h @@ -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) diff --git a/graph.c b/graph.c index d6947b8c..baedbde5 100644 --- a/graph.c +++ b/graph.c @@ -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; @@ -109,8 +114,7 @@ void Update_part_of_screen(short x, short y, short width, short height) effective_h = Menu_Y - effective_Y; /* - SDL_Rect r; - r.x=effective_X; + SDL_Rect r; r.x=effective_X; r.y=effective_Y; r.h=effective_h; r.w=effective_w; @@ -2853,4 +2857,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; } -} \ No newline at end of file +} diff --git a/hotkeys.h b/hotkeys.h index d8fc377a..b90e4340 100644 --- a/hotkeys.h +++ b/hotkeys.h @@ -24,7 +24,11 @@ /// The actual data is in hotkeys.c ////////////////////////////////////////////////////////////////////////////// -#include +#ifndef __VBCC__ + #include +#else + #define bool char +#endif #include /*** Types definitions and structs ***/ diff --git a/init.c b/init.c index 2cc6761a..65495059 100644 --- a/init.c +++ b/init.c @@ -25,11 +25,14 @@ #if defined(__WIN32__) || defined(__linux__) #define GRAFX2_CATCHES_SIGNALS #endif -#include #include -#include +//#include #include -#include + +#ifndef __VBCC__ + #include +#endif + #include #include #include @@ -2465,4 +2468,4 @@ void Init_brush_container(void) Brush_container[i].Brush = NULL; } -} \ No newline at end of file +} diff --git a/loadsave.c b/loadsave.c index de983439..81083f5f 100644 --- a/loadsave.c +++ b/loadsave.c @@ -868,6 +868,7 @@ void Save_PAL(void) //////////////////////////////////// IMG //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#pragma pack(1) typedef struct { byte Filler1[6]; @@ -875,7 +876,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) @@ -1037,6 +1039,7 @@ void Save_IMG(void) //////////////////////////////////// PKM //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#pragma pack(1) typedef struct { char Ident[3]; // Chaîne "PKM" } @@ -1050,7 +1053,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) @@ -1495,6 +1499,7 @@ void Save_PKM(void) //////////////////////////////////// LBM //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#pragma pack(1) typedef struct { word Width; @@ -1510,7 +1515,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; @@ -2279,7 +2285,7 @@ void Save_LBM(void) //////////////////////////////////// BMP //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - +#pragma pack(1) typedef struct { word Signature; // ='BM' = 0x4D42 @@ -2299,7 +2305,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) @@ -2849,6 +2856,7 @@ void Save_BMP(void) //////////////////////////////////// GIF //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#pragma pack(1) typedef struct { word Width; // width de l'écran virtuel @@ -2856,7 +2864,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 { @@ -2866,7 +2874,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 -------------------------------- @@ -3685,6 +3694,7 @@ void Save_GIF(void) //////////////////////////////////// PCX //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#pragma pack(1) typedef struct { byte Manufacturer; // |_ Il font chier ces cons! Ils auraient pu @@ -3705,7 +3715,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; @@ -4224,11 +4235,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 { @@ -4241,7 +4253,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 -------------------------------- @@ -4541,6 +4554,7 @@ void Save_CEL(void) //////////////////////////////////// KCF //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#pragma pack(1) typedef struct { struct @@ -4551,7 +4565,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 -------------------------------- @@ -4800,6 +4815,7 @@ void Save_KCF(void) //////////////////////////////////// SCx //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#pragma pack(1) typedef struct { byte Filler1[4]; @@ -4807,7 +4823,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) diff --git a/main.c b/main.c index 7d7ef312..4b6576aa 100644 --- a/main.c +++ b/main.c @@ -25,7 +25,7 @@ #include #include #include -#include +//#include #include #include diff --git a/misc.c b/misc.c index fc6d00f9..39a7316d 100644 --- a/misc.c +++ b/misc.c @@ -717,15 +717,15 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line, #define _WIN32_WINNT 0x0500 #include #elif defined(__macosx__) || defined(__FreeBSD__) -#include + #include #elif defined(__BEOS__) || defined(__HAIKU__) -// sysinfo not implemented + // sysinfo not implemented #elif defined(__AROS__) || defined(__amigaos4__) || defined(__MORPHOS__) || defined(__amigaos__) -#include + #include #elif defined(__SKYOS__) -#include + #include #else -#include // sysinfo() for free RAM + #include // sysinfo() for free RAM #endif // Indique quelle est la mémoire disponible @@ -846,4 +846,6 @@ int Convert_videomode_arg(const char *argument) return mode_index; return -1; + + } diff --git a/mountlist.h b/mountlist.h index 43a15b21..3a5a3906 100644 --- a/mountlist.h +++ b/mountlist.h @@ -26,8 +26,13 @@ #ifndef MOUNTLIST_H_ # define MOUNTLIST_H_ -# include -# include +#ifndef __VBCC__ + # include +#else + #define bool char +#endif + +#include /* A mount table entry. */ struct mount_entry diff --git a/operatio.c b/operatio.c index c30a1f1b..a477c954 100644 --- a/operatio.c +++ b/operatio.c @@ -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 diff --git a/special.h b/special.h index 7930aedc..d6d64b37 100644 --- a/special.h +++ b/special.h @@ -17,6 +17,8 @@ along with Grafx2; if not, see */ +#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); \ No newline at end of file +byte Restore_brush(int index); diff --git a/struct.h b/struct.h index 7ffed0b4..5b03f0f2 100644 --- a/struct.h +++ b/struct.h @@ -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 From b3f2deedacae08c49f76d629a74fa57832942984 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 19 Sep 2009 22:47:10 +0000 Subject: [PATCH 2/6] ... and fixes the build back. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1036 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- Makefile | 2 +- gfx2.cfg | Bin 10217 -> 10212 bytes help.c | 3 --- main.c | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8617ae2d..1174246d 100644 --- a/Makefile +++ b/Makefile @@ -260,7 +260,7 @@ else JOYCOPT = endif -COPT += -DSVN_revision="$(shell svnversion .)" -DProgram_Revision="$(Label)" +COPT += -DSVN_revision='"$(shell svnversion .)"' -DProgram_version='"$(LABEL)"' ### And now for the real build rules ### diff --git a/gfx2.cfg b/gfx2.cfg index eacf653bdb5c66e77dd7093073d60b5dd73ddf00..49832a9795d375d126a1448981593ccddc9abb4f 100644 GIT binary patch delta 345 zcmWm9H%~%w6o&EVf3Hd$j56qAOs*iJSn1e%!-Bo{-V651cktRjf|ChfLBq%-+5}!%li_Co0bJIYx8km2& zEoP994Lb!mD8xw-#keS;lrqYx09A<_4_7kcCB2x4-z#u~mGr}lij5EO`Q%r}MVU{^b=2>8oC6-xXl{MDcV3RGj*ZrO1>e{$Hq)$ delta 220 zcmZ9^Jqp5L3>)K#bwF!JOS2dMTJz{U@UGi5qFr1d%VR17UB^v@q{{2XCBTh@XDyk7|0R? z0}KmrVc<8{FDL@xJgp$;aQ+;=?tjjQnbm^O}eq=Vq^jGrlw^TD~B1>-i@$VWR R)nt`#dmtwEq;-`?^aV&uBgFs! diff --git a/help.c b/help.c index 7dc1079a..f5e75e5b 100644 --- a/help.c +++ b/help.c @@ -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) { diff --git a/main.c b/main.c index 4b6576aa..7d7ef312 100644 --- a/main.c +++ b/main.c @@ -25,7 +25,7 @@ #include #include #include -//#include +#include #include #include From 93efc7e9e9f21da3a3afa7d1eff8d220153e2ac7 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 19 Sep 2009 23:49:52 +0000 Subject: [PATCH 3/6] Everything compiles. Some kludges left regarding version and pversion. Now to get it to link... git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1037 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- Makefile | 10 +++++++--- hotkeys.c | 5 +++++ input.c | 4 ++++ pxdouble.c | 4 ++++ pxquad.c | 4 ++++ pxsimple.c | 4 ++++ pxtall.c | 4 ++++ pxtall2.c | 4 ++++ pxtriple.c | 4 ++++ pxwide.c | 4 ++++ pxwide2.c | 4 ++++ setup.c | 2 +- 12 files changed, 49 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1174246d..318f5256 100644 --- a/Makefile +++ b/Makefile @@ -184,11 +184,13 @@ else RMDIR= delete CP = copy BIN = grafx2 - COPT = -c99 -Ivbcc:PosixLib/include -D__amigaos__ + COPT = -c99 -Ivbcc:PosixLib/include -D__amigaos__ $(TTFCOPT) CC = vc OBJDIR = obj/amiga-vbcc ZIP = lha - ZIPOPT= a + ZIPOPT = a + + NOTTF = 1 else @@ -260,7 +262,9 @@ else JOYCOPT = endif -COPT += -DSVN_revision='"$(shell svnversion .)"' -DProgram_version='"$(LABEL)"' +ifneq ($(PLATFORM),amiga-vbcc) + COPT += -DSVN_revision='"$(shell svnversion .)"' -DProgram_version='"$(LABEL)"' +endif ### And now for the real build rules ### diff --git a/hotkeys.c b/hotkeys.c index fba26f53..9c394d50 100644 --- a/hotkeys.c +++ b/hotkeys.c @@ -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", diff --git a/input.c b/input.c index f5cb582d..c6f87c43 100644 --- a/input.c +++ b/input.c @@ -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); diff --git a/pxdouble.c b/pxdouble.c index c4f4fd3a..a0758684 100644 --- a/pxdouble.c +++ b/pxdouble.c @@ -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 */ { diff --git a/pxquad.c b/pxquad.c index 1b1e328f..d7bb35f2 100644 --- a/pxquad.c +++ b/pxquad.c @@ -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 */ { diff --git a/pxsimple.c b/pxsimple.c index f7bfdebb..a9290da7 100644 --- a/pxsimple.c +++ b/pxsimple.c @@ -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 */ { diff --git a/pxtall.c b/pxtall.c index c63df96d..71d923b7 100644 --- a/pxtall.c +++ b/pxtall.c @@ -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 */ { diff --git a/pxtall2.c b/pxtall2.c index ca4b1b0d..4393feee 100644 --- a/pxtall2.c +++ b/pxtall2.c @@ -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 */ { diff --git a/pxtriple.c b/pxtriple.c index 99f58efd..fc299cfb 100644 --- a/pxtriple.c +++ b/pxtriple.c @@ -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 */ { diff --git a/pxwide.c b/pxwide.c index f0d60074..2656dd25 100644 --- a/pxwide.c +++ b/pxwide.c @@ -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 */ { diff --git a/pxwide2.c b/pxwide2.c index d0d2f400..498756be 100644 --- a/pxwide2.c +++ b/pxwide2.c @@ -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 */ { diff --git a/setup.c b/setup.c index 4e259390..548af219 100644 --- a/setup.c +++ b/setup.c @@ -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 From bdf0186c7fcf8b27a938334c6bbdc0b2c43fd98d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 6 Oct 2009 12:26:29 +0000 Subject: [PATCH 4/6] -Added help about rgb option -Better formatting of the video mode list git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1061 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 7d7ef312..af3c342d 100644 --- a/main.c +++ b/main.c @@ -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 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 to use an alternate file with the menu graphics\n"); printf("\t/mode to set a video mode\n\n"); printf("Available video modes:\n\n"); - for (mode_index=0; mode_index= Nb_video_modes) break; + printf("%12s",Mode_label(mode_index + k)); + } + puts(""); + } } From 5fd28bdd3b15d5b17370a725cb420e590b02a377 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Tue, 6 Oct 2009 22:42:43 +0000 Subject: [PATCH 5/6] trunk: Reserved hotkeys for layers. Allowed a single shortcut to launch several actions (Issue 88) git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1062 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 2 +- const.h | 18 +- engine.c | 1054 +++++++++++++++++++++++++++------------------------- gfx2.cfg | Bin 10212 -> 10308 bytes helpfile.h | 17 + hotkeys.c | 145 ++++++++ 6 files changed, 722 insertions(+), 514 deletions(-) diff --git a/buttons.c b/buttons.c index 59ddacbc..308748ec 100644 --- a/buttons.c +++ b/buttons.c @@ -70,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; diff --git a/const.h b/const.h index 20892d2f..0966e758 100644 --- a/const.h +++ b/const.h @@ -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 }; diff --git a/engine.c b/engine.c index 20223d15..ea2b2aec 100644 --- a/engine.c +++ b/engine.c @@ -476,11 +476,11 @@ void Main_handler(void) int button_index; // Numéro de bouton de menu en cours int prev_button_number=0; // Numéro de bouton de menu sur lequel on était précédemment byte blink; // L'opération demande un effacement du curseur - int shortcut_button; // Button à enclencher d'après la touche de raccourci enfoncée - byte clicked_button = 0; // Côté du bouton à enclencher d'après la touche de raccourci enfoncée int key_index; // index du tableau de touches spéciales correspondant à la touche enfoncée char str[25]; byte temp; + byte effect_modified; + byte action; do { @@ -498,526 +498,556 @@ void Main_handler(void) if(Get_input()) { - - // Evenement de fermeture - if (Quit_is_required) - { - Quit_is_required=0; - Button_Quit(); - } - - // Gestion des touches - if (Key) - { - for (key_index=0;(key_indexSPECIAL_CLICK_RIGHT) - switch(key_index) + action = 0; + + // Evenement de fermeture + if (Quit_is_required) { - case SPECIAL_SCROLL_UP : // Scroll up - if (Main_magnifier_mode) - Scroll_magnifier(0,-(Main_magnifier_height>>2)); - else - Scroll_screen(0,-(Screen_height>>3)); - Key=0; - break; - case SPECIAL_SCROLL_DOWN : // Scroll down - if (Main_magnifier_mode) - Scroll_magnifier(0,(Main_magnifier_height>>2)); - else - Scroll_screen(0,(Screen_height>>3)); - Key=0; - break; - case SPECIAL_SCROLL_LEFT : // Scroll left - if (Main_magnifier_mode) - Scroll_magnifier(-(Main_magnifier_width>>2),0); - else - Scroll_screen(-(Screen_width>>3),0); - Key=0; - break; - case SPECIAL_SCROLL_RIGHT : // Scroll right - if (Main_magnifier_mode) - Scroll_magnifier((Main_magnifier_width>>2),0); - else - Scroll_screen((Screen_width>>3),0); - Key=0; - break; - case SPECIAL_SCROLL_UP_FAST : // Scroll up faster - if (Main_magnifier_mode) - Scroll_magnifier(0,-(Main_magnifier_height>>1)); - else - Scroll_screen(0,-(Screen_height>>2)); - Key=0; - break; - case SPECIAL_SCROLL_DOWN_FAST : // Scroll down faster - if (Main_magnifier_mode) - Scroll_magnifier(0,(Main_magnifier_height>>1)); - else - Scroll_screen(0,(Screen_height>>2)); - Key=0; - break; - case SPECIAL_SCROLL_LEFT_FAST : // Scroll left faster - if (Main_magnifier_mode) - Scroll_magnifier(-(Main_magnifier_width>>1),0); - else - Scroll_screen(-(Screen_width>>2),0); - Key=0; - break; - case SPECIAL_SCROLL_RIGHT_FAST : // Scroll right faster - if (Main_magnifier_mode) - Scroll_magnifier((Main_magnifier_width>>1),0); - else - Scroll_screen((Screen_width>>2),0); - Key=0; - break; - case SPECIAL_SCROLL_UP_SLOW : // Scroll up slower - if (Main_magnifier_mode) - Scroll_magnifier(0,-1); - else - Scroll_screen(0,-1); - Key=0; - break; - case SPECIAL_SCROLL_DOWN_SLOW : // Scroll down slower - if (Main_magnifier_mode) - Scroll_magnifier(0,1); - else - Scroll_screen(0,1); - Key=0; - break; - case SPECIAL_SCROLL_LEFT_SLOW : // Scroll left slower - if (Main_magnifier_mode) - Scroll_magnifier(-1,0); - else - Scroll_screen(-1,0); - Key=0; - break; - case SPECIAL_SCROLL_RIGHT_SLOW : // Scroll right slower - if (Main_magnifier_mode) - Scroll_magnifier(1,0); - else - Scroll_screen(1,0); - Key=0; - break; - case SPECIAL_NEXT_FORECOLOR : // Next foreground color - Special_next_forecolor(); - Key=0; - break; - case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color - Special_previous_forecolor(); - Key=0; - break; - case SPECIAL_NEXT_BACKCOLOR : // Next background color - Special_next_backcolor(); - Key=0; - break; - case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color - Special_previous_backcolor(); - Key=0; - break; - case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau - Smaller_paintbrush(); - Key=0; - break; - case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau - Bigger_paintbrush(); - Key=0; - break; - case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color - Special_next_user_forecolor(); - Key=0; - break; - case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color - Special_previous_user_forecolor(); - Key=0; - break; - case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color - Special_next_user_backcolor(); - Key=0; - break; - case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color - Special_previous_user_backcolor(); - Key=0; - break; - case SPECIAL_SHOW_HIDE_CURSOR : // Show / Hide cursor - Hide_cursor(); - Cursor_hidden=!Cursor_hidden; - Display_cursor(); - Key=0; - break; - case SPECIAL_DOT_PAINTBRUSH : // Paintbrush = "." - Hide_cursor(); - Paintbrush_shape=PAINTBRUSH_SHAPE_ROUND; - Set_paintbrush_size(1,1); - Change_paintbrush_shape(PAINTBRUSH_SHAPE_ROUND); - Display_cursor(); - Key=0; - break; - case SPECIAL_CONTINUOUS_DRAW : // Continuous freehand drawing - Select_button(BUTTON_DRAW,LEFT_SIDE); - // ATTENTION CE TRUC EST MOCHE ET VA MERDER SI ON SE MET A UTILISER DES BOUTONS POPUPS - while (Current_operation!=OPERATION_CONTINUOUS_DRAW) - Select_button(BUTTON_DRAW,RIGHT_SIDE); - Key=0; - break; - case SPECIAL_FLIP_X : // Flip X - Hide_cursor(); - Flip_X_lowlevel(Brush, Brush_width, Brush_height); - Display_cursor(); - Key=0; - break; - case SPECIAL_FLIP_Y : // Flip Y - Hide_cursor(); - Flip_Y_lowlevel(Brush, Brush_width, Brush_height); - Display_cursor(); - Key=0; - break; - case SPECIAL_ROTATE_90 : // 90° brush rotation - Hide_cursor(); - Rotate_90_deg(); - Display_cursor(); - Key=0; - break; - case SPECIAL_ROTATE_180 : // 180° brush rotation - Hide_cursor(); - Rotate_180_deg_lowlevel(Brush, Brush_width, Brush_height); - Brush_offset_X=(Brush_width>>1); - Brush_offset_Y=(Brush_height>>1); - Display_cursor(); - Key=0; - break; - case SPECIAL_STRETCH : // Stretch brush - Hide_cursor(); - Start_operation_stack(OPERATION_STRETCH_BRUSH); - Display_cursor(); - Key=0; - break; - case SPECIAL_DISTORT : // Distort brush - Hide_cursor(); - Start_operation_stack(OPERATION_DISTORT_BRUSH); - Display_cursor(); - Key=0; - break; - case SPECIAL_ROTATE_ANY_ANGLE : // Rotate brush by any angle - Hide_cursor(); - Start_operation_stack(OPERATION_ROTATE_BRUSH); - Display_cursor(); - Key=0; - break; - case SPECIAL_OUTLINE : // Outline brush - Hide_cursor(); - Outline_brush(); - Display_cursor(); - Key=0; - break; - case SPECIAL_NIBBLE : // Nibble brush - Hide_cursor(); - Nibble_brush(); - Display_cursor(); - Key=0; - break; - case SPECIAL_GET_BRUSH_COLORS : // Get colors from brush - Get_colors_from_brush(); - Key=0; - break; - case SPECIAL_RECOLORIZE_BRUSH : // Recolorize brush - Hide_cursor(); - Remap_brush(); - Display_cursor(); - Key=0; - break; - case SPECIAL_LOAD_BRUSH : - Load_picture(0); - Key=0; - break; - case SPECIAL_SAVE_BRUSH : - Save_picture(0); - Key=0; - break; - case SPECIAL_ZOOM_IN : // Zoom in - Zoom(+1); - Key=0; - break; - case SPECIAL_ZOOM_OUT : // Zoom out - Zoom(-1); - Key=0; - break; - case SPECIAL_CENTER_ATTACHMENT : // Center brush attachment - Hide_cursor(); - Brush_offset_X=(Brush_width>>1); - Brush_offset_Y=(Brush_height>>1); - Display_cursor(); - Key=0; - break; - case SPECIAL_TOP_LEFT_ATTACHMENT : // Top-left brush attachment - Hide_cursor(); - Brush_offset_X=0; - Brush_offset_Y=0; - Display_cursor(); - Key=0; - break; - case SPECIAL_TOP_RIGHT_ATTACHMENT : // Top-right brush attachment - Hide_cursor(); - Brush_offset_X=(Brush_width-1); - Brush_offset_Y=0; - Display_cursor(); - Key=0; - break; - case SPECIAL_BOTTOM_LEFT_ATTACHMENT : // Bottom-left brush attachment - Hide_cursor(); - Brush_offset_X=0; - Brush_offset_Y=(Brush_height-1); - Display_cursor(); - Key=0; - break; - case SPECIAL_BOTTOM_RIGHT_ATTACHMENT : // Bottom right brush attachment - Hide_cursor(); - Brush_offset_X=(Brush_width-1); - Brush_offset_Y=(Brush_height-1); - Display_cursor(); - Key=0; - break; - case SPECIAL_EXCLUDE_COLORS_MENU : // Exclude colors menu - Menu_tag_colors("Tag colors to exclude",Exclude_color,&temp,1, NULL, SPECIAL_EXCLUDE_COLORS_MENU); - Key=0; - break; - case SPECIAL_INVERT_SIEVE : - Invert_trame(); - Key=0; - break; - case SPECIAL_SHADE_MODE : - Button_Shade_mode(); - Key=0; - break; - case SPECIAL_SHADE_MENU : - Button_Shade_menu(); - Key=0; - break; - case SPECIAL_QUICK_SHADE_MODE : - Button_Quick_shade_mode(); - Key=0; - break; - case SPECIAL_QUICK_SHADE_MENU : - Button_Quick_shade_menu(); - Key=0; - break; - case SPECIAL_STENCIL_MODE : - Button_Stencil_mode(); - Key=0; - break; - case SPECIAL_STENCIL_MENU : - Button_Stencil_menu(); - Key=0; - break; - case SPECIAL_MASK_MODE : - Button_Mask_mode(); - Key=0; - break; - case SPECIAL_MASK_MENU : - Button_Mask_menu(); - Key=0; - break; - case SPECIAL_GRID_MODE : - Button_Snap_mode(); - Key=0; - break; - case SPECIAL_GRID_MENU : - Button_Grid_menu(); - Key=0; - break; - case SPECIAL_SHOW_GRID : - Button_Show_grid(); - Key=0; - break; - case SPECIAL_SIEVE_MODE : - Button_Sieve_mode(); - Key=0; - break; - case SPECIAL_SIEVE_MENU : - Button_Sieve_menu(); - Key=0; - break; - case SPECIAL_COLORIZE_MODE : - Button_Colorize_mode(); - Key=0; - break; - case SPECIAL_COLORIZE_MENU : - Button_Colorize_menu(); - Key=0; - break; - case SPECIAL_SMOOTH_MODE : - Button_Smooth_mode(); - Key=0; - break; - case SPECIAL_SMOOTH_MENU : - Button_Smooth_menu(); - Key=0; - break; - case SPECIAL_SMEAR_MODE : - Button_Smear_mode(); - Key=0; - break; - case SPECIAL_TILING_MODE : - Button_Tiling_mode(); - Key=0; - break; - case SPECIAL_TILING_MENU : - Button_Tiling_menu(); - Key=0; - break; - case SPECIAL_EFFECTS_OFF : - Effects_off(); - Key=0; - break; - case SPECIAL_TRANSPARENCY_1 : - Transparency_set(1); - Key=0; - break; - case SPECIAL_TRANSPARENCY_2 : - Transparency_set(2); - Key=0; - break; - case SPECIAL_TRANSPARENCY_3 : - Transparency_set(3); - Key=0; - break; - case SPECIAL_TRANSPARENCY_4 : - Transparency_set(4); - Key=0; - break; - case SPECIAL_TRANSPARENCY_5 : - Transparency_set(5); - Key=0; - break; - case SPECIAL_TRANSPARENCY_6 : - Transparency_set(6); - Key=0; - break; - case SPECIAL_TRANSPARENCY_7 : - Transparency_set(7); - Key=0; - break; - case SPECIAL_TRANSPARENCY_8 : - Transparency_set(8); - Key=0; - break; - case SPECIAL_TRANSPARENCY_9 : - Transparency_set(9); - Key=0; - break; - case SPECIAL_TRANSPARENCY_0 : - Transparency_set(0); - Key=0; - break; - case SPECIAL_ZOOM_1 : - Zoom_set(-1); - Key=0; - break; - case SPECIAL_ZOOM_2 : - Zoom_set(0); - Key=0; - break; - case SPECIAL_ZOOM_3 : - Zoom_set(1); - Key=0; - break; - case SPECIAL_ZOOM_4 : - Zoom_set(2); - Key=0; - break; - case SPECIAL_ZOOM_5 : - Zoom_set(3); - Key=0; - break; - case SPECIAL_ZOOM_6 : - Zoom_set(4); - Key=0; - break; - case SPECIAL_ZOOM_8 : - Zoom_set(5); - Key=0; - break; - case SPECIAL_ZOOM_10 : - Zoom_set(6); - Key=0; - break; - case SPECIAL_ZOOM_12 : - Zoom_set(7); - Key=0; - break; - case SPECIAL_ZOOM_14 : - Zoom_set(8); - Key=0; - break; - case SPECIAL_ZOOM_16 : - Zoom_set(9); - Key=0; - break; - case SPECIAL_ZOOM_18 : - Zoom_set(10); - Key=0; - break; - case SPECIAL_ZOOM_20 : - Zoom_set(11); - Key=0; - break; - default : // Gestion des touches de raccourci de bouton: - // Pour chaque bouton - shortcut_button=-1; - for (button_index=0;button_index>2)); + else + Scroll_screen(0,-(Screen_height>>3)); + action++; + break; + case SPECIAL_SCROLL_DOWN : // Scroll down + if (Main_magnifier_mode) + Scroll_magnifier(0,(Main_magnifier_height>>2)); + else + Scroll_screen(0,(Screen_height>>3)); + action++; + break; + case SPECIAL_SCROLL_LEFT : // Scroll left + if (Main_magnifier_mode) + Scroll_magnifier(-(Main_magnifier_width>>2),0); + else + Scroll_screen(-(Screen_width>>3),0); + action++; + break; + case SPECIAL_SCROLL_RIGHT : // Scroll right + if (Main_magnifier_mode) + Scroll_magnifier((Main_magnifier_width>>2),0); + else + Scroll_screen((Screen_width>>3),0); + action++; + break; + case SPECIAL_SCROLL_UP_FAST : // Scroll up faster + if (Main_magnifier_mode) + Scroll_magnifier(0,-(Main_magnifier_height>>1)); + else + Scroll_screen(0,-(Screen_height>>2)); + action++; + break; + case SPECIAL_SCROLL_DOWN_FAST : // Scroll down faster + if (Main_magnifier_mode) + Scroll_magnifier(0,(Main_magnifier_height>>1)); + else + Scroll_screen(0,(Screen_height>>2)); + action++; + break; + case SPECIAL_SCROLL_LEFT_FAST : // Scroll left faster + if (Main_magnifier_mode) + Scroll_magnifier(-(Main_magnifier_width>>1),0); + else + Scroll_screen(-(Screen_width>>2),0); + action++; + break; + case SPECIAL_SCROLL_RIGHT_FAST : // Scroll right faster + if (Main_magnifier_mode) + Scroll_magnifier((Main_magnifier_width>>1),0); + else + Scroll_screen((Screen_width>>2),0); + action++; + break; + case SPECIAL_SCROLL_UP_SLOW : // Scroll up slower + if (Main_magnifier_mode) + Scroll_magnifier(0,-1); + else + Scroll_screen(0,-1); + action++; + break; + case SPECIAL_SCROLL_DOWN_SLOW : // Scroll down slower + if (Main_magnifier_mode) + Scroll_magnifier(0,1); + else + Scroll_screen(0,1); + action++; + break; + case SPECIAL_SCROLL_LEFT_SLOW : // Scroll left slower + if (Main_magnifier_mode) + Scroll_magnifier(-1,0); + else + Scroll_screen(-1,0); + action++; + break; + case SPECIAL_SCROLL_RIGHT_SLOW : // Scroll right slower + if (Main_magnifier_mode) + Scroll_magnifier(1,0); + else + Scroll_screen(1,0); + action++; + break; + case SPECIAL_NEXT_FORECOLOR : // Next foreground color + Special_next_forecolor(); + action++; + break; + case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color + Special_previous_forecolor(); + action++; + break; + case SPECIAL_NEXT_BACKCOLOR : // Next background color + Special_next_backcolor(); + action++; + break; + case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color + Special_previous_backcolor(); + action++; + break; + case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau + Smaller_paintbrush(); + action++; + break; + case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau + Bigger_paintbrush(); + action++; + break; + case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color + Special_next_user_forecolor(); + action++; + break; + case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color + Special_previous_user_forecolor(); + action++; + break; + case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color + Special_next_user_backcolor(); + action++; + break; + case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color + Special_previous_user_backcolor(); + action++; + break; + case SPECIAL_SHOW_HIDE_CURSOR : // Show / Hide cursor + Hide_cursor(); + Cursor_hidden=!Cursor_hidden; + Display_cursor(); + action++; + break; + case SPECIAL_DOT_PAINTBRUSH : // Paintbrush = "." + Hide_cursor(); + Paintbrush_shape=PAINTBRUSH_SHAPE_ROUND; + Set_paintbrush_size(1,1); + Change_paintbrush_shape(PAINTBRUSH_SHAPE_ROUND); + Display_cursor(); + action++; + break; + case SPECIAL_CONTINUOUS_DRAW : // Continuous freehand drawing + Select_button(BUTTON_DRAW,LEFT_SIDE); + // ATTENTION CE TRUC EST MOCHE ET VA MERDER SI ON SE MET A UTILISER DES BOUTONS POPUPS + while (Current_operation!=OPERATION_CONTINUOUS_DRAW) + Select_button(BUTTON_DRAW,RIGHT_SIDE); + action++; + break; + case SPECIAL_FLIP_X : // Flip X + Hide_cursor(); + Flip_X_lowlevel(Brush, Brush_width, Brush_height); + Display_cursor(); + action++; + break; + case SPECIAL_FLIP_Y : // Flip Y + Hide_cursor(); + Flip_Y_lowlevel(Brush, Brush_width, Brush_height); + Display_cursor(); + action++; + break; + case SPECIAL_ROTATE_90 : // 90° brush rotation + Hide_cursor(); + Rotate_90_deg(); + Display_cursor(); + action++; + break; + case SPECIAL_ROTATE_180 : // 180° brush rotation + Hide_cursor(); + Rotate_180_deg_lowlevel(Brush, Brush_width, Brush_height); + Brush_offset_X=(Brush_width>>1); + Brush_offset_Y=(Brush_height>>1); + Display_cursor(); + action++; + break; + case SPECIAL_STRETCH : // Stretch brush + Hide_cursor(); + Start_operation_stack(OPERATION_STRETCH_BRUSH); + Display_cursor(); + action++; + break; + case SPECIAL_DISTORT : // Distort brush + Hide_cursor(); + Start_operation_stack(OPERATION_DISTORT_BRUSH); + Display_cursor(); + action++; + break; + case SPECIAL_ROTATE_ANY_ANGLE : // Rotate brush by any angle + Hide_cursor(); + Start_operation_stack(OPERATION_ROTATE_BRUSH); + Display_cursor(); + action++; + break; + case SPECIAL_OUTLINE : // Outline brush + Hide_cursor(); + Outline_brush(); + Display_cursor(); + action++; + break; + case SPECIAL_NIBBLE : // Nibble brush + Hide_cursor(); + Nibble_brush(); + Display_cursor(); + action++; + break; + case SPECIAL_GET_BRUSH_COLORS : // Get colors from brush + Get_colors_from_brush(); + action++; + break; + case SPECIAL_RECOLORIZE_BRUSH : // Recolorize brush + Hide_cursor(); + Remap_brush(); + Display_cursor(); + action++; + break; + case SPECIAL_LOAD_BRUSH : + Load_picture(0); + action++; + break; + case SPECIAL_SAVE_BRUSH : + Save_picture(0); + action++; + break; + case SPECIAL_ZOOM_IN : // Zoom in + Zoom(+1); + action++; + break; + case SPECIAL_ZOOM_OUT : // Zoom out + Zoom(-1); + action++; + break; + case SPECIAL_CENTER_ATTACHMENT : // Center brush attachment + Hide_cursor(); + Brush_offset_X=(Brush_width>>1); + Brush_offset_Y=(Brush_height>>1); + Display_cursor(); + action++; + break; + case SPECIAL_TOP_LEFT_ATTACHMENT : // Top-left brush attachment + Hide_cursor(); + Brush_offset_X=0; + Brush_offset_Y=0; + Display_cursor(); + action++; + break; + case SPECIAL_TOP_RIGHT_ATTACHMENT : // Top-right brush attachment + Hide_cursor(); + Brush_offset_X=(Brush_width-1); + Brush_offset_Y=0; + Display_cursor(); + action++; + break; + case SPECIAL_BOTTOM_LEFT_ATTACHMENT : // Bottom-left brush attachment + Hide_cursor(); + Brush_offset_X=0; + Brush_offset_Y=(Brush_height-1); + Display_cursor(); + action++; + break; + case SPECIAL_BOTTOM_RIGHT_ATTACHMENT : // Bottom right brush attachment + Hide_cursor(); + Brush_offset_X=(Brush_width-1); + Brush_offset_Y=(Brush_height-1); + Display_cursor(); + action++; + break; + case SPECIAL_EXCLUDE_COLORS_MENU : // Exclude colors menu + Menu_tag_colors("Tag colors to exclude",Exclude_color,&temp,1, NULL, SPECIAL_EXCLUDE_COLORS_MENU); + action++; + break; + case SPECIAL_INVERT_SIEVE : + Invert_trame(); + action++; + break; + case SPECIAL_SHADE_MODE : + Button_Shade_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_SHADE_MENU : + Button_Shade_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_QUICK_SHADE_MODE : + Button_Quick_shade_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_QUICK_SHADE_MENU : + Button_Quick_shade_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_STENCIL_MODE : + Button_Stencil_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_STENCIL_MENU : + Button_Stencil_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_MASK_MODE : + Button_Mask_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_MASK_MENU : + Button_Mask_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_GRID_MODE : + Button_Snap_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_GRID_MENU : + Button_Grid_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_SHOW_GRID : + Button_Show_grid(); + effect_modified = 1; + action++; + break; + case SPECIAL_SIEVE_MODE : + Button_Sieve_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_SIEVE_MENU : + Button_Sieve_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_COLORIZE_MODE : + Button_Colorize_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_COLORIZE_MENU : + Button_Colorize_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_SMOOTH_MODE : + Button_Smooth_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_SMOOTH_MENU : + Button_Smooth_menu(); + effect_modified = 1; + action++; + break; + case SPECIAL_SMEAR_MODE : + Button_Smear_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_TILING_MODE : + Button_Tiling_mode(); + effect_modified = 1; + action++; + break; + case SPECIAL_TILING_MENU : + effect_modified = 1; + Button_Tiling_menu(); + action++; + break; + case SPECIAL_EFFECTS_OFF : + Effects_off(); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_1 : + Transparency_set(1); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_2 : + Transparency_set(2); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_3 : + Transparency_set(3); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_4 : + Transparency_set(4); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_5 : + Transparency_set(5); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_6 : + Transparency_set(6); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_7 : + Transparency_set(7); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_8 : + Transparency_set(8); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_9 : + Transparency_set(9); + effect_modified = 1; + action++; + break; + case SPECIAL_TRANSPARENCY_0 : + Transparency_set(0); + effect_modified = 1; + action++; + break; + case SPECIAL_ZOOM_1 : + Zoom_set(-1); + action++; + break; + case SPECIAL_ZOOM_2 : + Zoom_set(0); + action++; + break; + case SPECIAL_ZOOM_3 : + Zoom_set(1); + action++; + break; + case SPECIAL_ZOOM_4 : + Zoom_set(2); + action++; + break; + case SPECIAL_ZOOM_5 : + Zoom_set(3); + action++; + break; + case SPECIAL_ZOOM_6 : + Zoom_set(4); + action++; + break; + case SPECIAL_ZOOM_8 : + Zoom_set(5); + action++; + break; + case SPECIAL_ZOOM_10 : + Zoom_set(6); + action++; + break; + case SPECIAL_ZOOM_12 : + Zoom_set(7); + action++; + break; + case SPECIAL_ZOOM_14 : + Zoom_set(8); + action++; + break; + case SPECIAL_ZOOM_16 : + Zoom_set(9); + action++; + break; + case SPECIAL_ZOOM_18 : + Zoom_set(10); + action++; + break; + case SPECIAL_ZOOM_20 : + Zoom_set(11); + action++; + break; } } - // Après avoir scruté les boutons, si la recherche a été fructueuse, - // on lance le bouton. - if (shortcut_button!=-1) - { - Select_button(shortcut_button,clicked_button); + } // End of special keys + + // Shortcut for functions of Menu buttons + for (button_index=0;button_index=SPECIAL_SHADE_MODE) - && (key_index<=SPECIAL_TILING_MENU)) - { - Hide_cursor(); - Draw_menu_button_frame(BUTTON_EFFECTS, - (Shade_mode||Quick_shade_mode||Colorize_mode||Smooth_mode||Tiling_mode||Smear_mode||Stencil_mode||Mask_mode||Sieve_mode||Snap_mode)); - Display_cursor(); - } - } + if (action) + Key=0; } else - { - // No event : we go asleep for a while, but we try to get waked up at constant intervals of time - // no matter the machine speed or system load. The time is fixed to 10ms (that should be about a cpu slice on most systems) - // This allows nice smooth mouse movement. - const int delay = 10; - - Uint32 debut; - debut = SDL_GetTicks(); - // Première attente : le complément de "delay" millisecondes - SDL_Delay(delay - (debut % delay)); - // Si ça ne suffit pas, on complète par des attentes successives de "1ms". - // (Remarque, Windows arrondit généralement aux 10ms supérieures) - while ( SDL_GetTicks()/delay <= debut/delay) - { - SDL_Delay(1); - } - } + { + // No event : we go asleep for a while, but we try to get waked up at constant intervals of time + // no matter the machine speed or system load. The time is fixed to 10ms (that should be about a cpu slice on most systems) + // This allows nice smooth mouse movement. + const int delay = 10; + + Uint32 debut; + debut = SDL_GetTicks(); + // Première attente : le complément de "delay" millisecondes + SDL_Delay(delay - (debut % delay)); + // Si ça ne suffit pas, on complète par des attentes successives de "1ms". + // (Remarque, Windows arrondit généralement aux 10ms supérieures) + while ( SDL_GetTicks()/delay <= debut/delay) + { + SDL_Delay(1); + } + } // Gestion de la souris diff --git a/gfx2.cfg b/gfx2.cfg index 49832a9795d375d126a1448981593ccddc9abb4f..662d545c8023ea348b49394994cdef8a99550e35 100644 GIT binary patch delta 119 zcmaFjeS@Wh|X+0C7aA&G%u7xPB0UCf(RSQJzMVCM$f diff --git a/helpfile.h b/helpfile.h index 7f31ade4..4b443f94 100644 --- a/helpfile.h +++ b/helpfile.h @@ -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[] = { diff --git a/hotkeys.c b/hotkeys.c index 9c394d50..0ce265ff 100644 --- a/hotkeys.c +++ b/hotkeys.c @@ -1299,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]= @@ -1462,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, }; From 6f8223b09b206e22f3b90b302c15e8754d106d17 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Tue, 6 Oct 2009 23:24:00 +0000 Subject: [PATCH 6/6] trunk: Continued the handling of multiple effect on single shortcuts. Multiple window-open work (one after an other), and the restriction on shortcuts that are disabled while drawing is now applied correctly. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1063 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 2 +- engine.c | 128 ++++++++++++++++++++++++++++++++---------------------- graph.c | 2 +- graph.h | 3 +- input.c | 41 ++--------------- 5 files changed, 82 insertions(+), 94 deletions(-) diff --git a/buttons.c b/buttons.c index 308748ec..88fd9a7b 100644 --- a/buttons.c +++ b/buttons.c @@ -1488,7 +1488,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)); diff --git a/engine.c b/engine.c index ea2b2aec..80a49c94 100644 --- a/engine.c +++ b/engine.c @@ -481,6 +481,7 @@ void Main_handler(void) byte temp; byte effect_modified; byte action; + dword key_pressed; do { @@ -499,6 +500,12 @@ void Main_handler(void) if(Get_input()) { action = 0; + + // Inhibit all keys if a drawing operation is in progress. + // We make an exception for the freehand operations, but these will + // only accept a very limited number of shortcuts. + if (Operation_stack_size!=0 && !Allow_color_change_during_operation) + Key=0; // Evenement de fermeture if (Quit_is_required) @@ -507,7 +514,6 @@ void Main_handler(void) Button_Quit(); } - // Gestion des touches if (Key) { effect_modified = 0; @@ -518,6 +524,54 @@ void Main_handler(void) { // Special keys (functions not hooked to a UI button) switch(key_index) + { + case SPECIAL_NEXT_FORECOLOR : // Next foreground color + Special_next_forecolor(); + action++; + break; + case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color + Special_previous_forecolor(); + action++; + break; + case SPECIAL_NEXT_BACKCOLOR : // Next background color + Special_next_backcolor(); + action++; + break; + case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color + Special_previous_backcolor(); + action++; + break; + case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau + Smaller_paintbrush(); + action++; + break; + case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau + Bigger_paintbrush(); + action++; + break; + case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color + Special_next_user_forecolor(); + action++; + break; + case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color + Special_previous_user_forecolor(); + action++; + break; + case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color + Special_next_user_backcolor(); + action++; + break; + case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color + Special_previous_user_backcolor(); + action++; + break; + } + + // Other shortcuts are forbidden while an operation is in progress + if (Operation_stack_size!=0) + continue; + + switch (key_index) { case SPECIAL_SCROLL_UP : // Scroll up if (Main_magnifier_mode) @@ -603,46 +657,6 @@ void Main_handler(void) Scroll_screen(1,0); action++; break; - case SPECIAL_NEXT_FORECOLOR : // Next foreground color - Special_next_forecolor(); - action++; - break; - case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color - Special_previous_forecolor(); - action++; - break; - case SPECIAL_NEXT_BACKCOLOR : // Next background color - Special_next_backcolor(); - action++; - break; - case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color - Special_previous_backcolor(); - action++; - break; - case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau - Smaller_paintbrush(); - action++; - break; - case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau - Bigger_paintbrush(); - action++; - break; - case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color - Special_next_user_forecolor(); - action++; - break; - case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color - Special_previous_user_forecolor(); - action++; - break; - case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color - Special_next_user_backcolor(); - action++; - break; - case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color - Special_previous_user_backcolor(); - action++; - break; case SPECIAL_SHOW_HIDE_CURSOR : // Show / Hide cursor Hide_cursor(); Cursor_hidden=!Cursor_hidden; @@ -1000,20 +1014,28 @@ void Main_handler(void) } } // End of special keys - // Shortcut for functions of Menu buttons - for (button_index=0;button_index