Keyboard shortcut for enabling/disabling color cycle.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1595 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-08-29 18:11:16 +00:00
parent a5b5fa69e8
commit 05e05d0d75
7 changed files with 35 additions and 9 deletions

View File

@ -11,7 +11,7 @@ $(OBJDIR)/buttons_effects.o: buttons_effects.c buttons.h struct.h const.h engine
global.h graph.h help.h input.h misc.h readline.h sdlscreen.h windows.h global.h graph.h help.h input.h misc.h readline.h sdlscreen.h windows.h
$(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.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 \ buttons.h operatio.h shade.h errors.h sdlscreen.h windows.h brush.h \
input.h engine.h pages.h layers.h factory.h input.h engine.h pages.h layers.h factory.h loadsave.h io.h
$(OBJDIR)/factory.o: factory.c brush.h struct.h const.h buttons.h engine.h errors.h \ $(OBJDIR)/factory.o: factory.c brush.h struct.h const.h buttons.h engine.h errors.h \
filesel.h loadsave.h global.h graph.h io.h misc.h pages.h readline.h \ filesel.h loadsave.h global.h graph.h io.h misc.h pages.h readline.h \
sdlscreen.h windows.h palette.h input.h help.h sdlscreen.h windows.h palette.h input.h help.h
@ -32,7 +32,7 @@ $(OBJDIR)/init.o: init.c buttons.h struct.h const.h errors.h global.h graph.h \
mountlist.h operatio.h palette.h sdlscreen.h setup.h transform.h \ mountlist.h operatio.h palette.h sdlscreen.h setup.h transform.h \
windows.h layers.h windows.h layers.h
$(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \ $(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \
windows.h errors.h misc.h input.h windows.h errors.h misc.h input.h loadsave.h
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.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)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h
$(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h \ $(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h \
@ -43,7 +43,7 @@ $(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h errors.h global.h io
engine.h engine.h
$(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.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 \ 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 io.h text.h setup.h windows.h brush.h palette.h realpath.h input.h
$(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons.h \ $(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons.h \
engine.h misc.h keyboard.h windows.h palette.h input.h graph.h pages.h engine.h misc.h keyboard.h windows.h palette.h input.h graph.h pages.h
$(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \ $(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \
@ -51,7 +51,8 @@ $(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.
$(OBJDIR)/mountlist.o: mountlist.c $(OBJDIR)/mountlist.o: mountlist.c
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h errors.h $(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h errors.h
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \ $(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \
operatio.h buttons.h pages.h errors.h sdlscreen.h brush.h windows.h operatio.h buttons.h pages.h errors.h sdlscreen.h brush.h windows.h \
input.h
$(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h loadsave.h \ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h loadsave.h \
misc.h windows.h misc.h windows.h
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \ $(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \
@ -88,9 +89,10 @@ $(OBJDIR)/shade.o: shade.c global.h struct.h const.h graph.h engine.h errors.h \
$(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h engine.h windows.h \ $(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h engine.h windows.h \
special.h pages.h misc.h buttons.h special.h pages.h misc.h buttons.h
$(OBJDIR)/text.o: text.c SFont.h struct.h const.h global.h sdlscreen.h io.h \ $(OBJDIR)/text.o: text.c SFont.h struct.h const.h global.h sdlscreen.h io.h \
errors.h errors.h windows.h
$(OBJDIR)/tiles.o: tiles.c
$(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.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 sdlscreen.h windows.h input.h help.h misc.h readline.h buttons.h pages.h
$(OBJDIR)/version.o: version.c $(OBJDIR)/version.o: version.c
$(OBJDIR)/windows.o: windows.c windows.h struct.h const.h engine.h errors.h \ $(OBJDIR)/windows.o: windows.c windows.h struct.h const.h engine.h errors.h \
global.h graph.h input.h misc.h readline.h sdlscreen.h global.h graph.h input.h misc.h op_c.h readline.h sdlscreen.h palette.h

View File

@ -481,6 +481,7 @@ enum SPECIAL_ACTIONS
SPECIAL_RUN_SCRIPT_8, SPECIAL_RUN_SCRIPT_8,
SPECIAL_RUN_SCRIPT_9, SPECIAL_RUN_SCRIPT_9,
SPECIAL_RUN_SCRIPT_10, SPECIAL_RUN_SCRIPT_10,
SPECIAL_CYCLE_MODE,
NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts
}; };

View File

@ -1307,6 +1307,13 @@ void Main_handler(void)
action++; action++;
#endif #endif
break; break;
case SPECIAL_CYCLE_MODE:
Cycling_mode= !Cycling_mode;
// Restore palette
if (!Cycling_mode)
Set_palette(Main_palette);
action++;
break;
} }
} }
} // End of special keys } // End of special keys
@ -1579,7 +1586,12 @@ void Open_window(word width,word height, const char * title)
Cursor_shape=CURSOR_SHAPE_ARROW; Cursor_shape=CURSOR_SHAPE_ARROW;
Paintbrush_hidden_before_window=Paintbrush_hidden; Paintbrush_hidden_before_window=Paintbrush_hidden;
Paintbrush_hidden=1; Paintbrush_hidden=1;
Allow_colorcycling=0; if (Allow_colorcycling)
{
Allow_colorcycling=0;
// Restore palette
Set_palette(Main_palette);
}
} }
// Initialisation des listes de boutons de la fenêtre // Initialisation des listes de boutons de la fenêtre

View File

@ -785,6 +785,8 @@ GFX2_GLOBAL Func_pixel Gradient_pixel;
GFX2_GLOBAL T_Gradient_array Gradient_array[16]; GFX2_GLOBAL T_Gradient_array Gradient_array[16];
/// Index in ::Gradient_array of the currently selected gradient. /// Index in ::Gradient_array of the currently selected gradient.
GFX2_GLOBAL byte Current_gradient; GFX2_GLOBAL byte Current_gradient;
/// Boolean, true when the color cycling is active.
GFX2_GLOBAL byte Cycling_mode;
// -- Airbrush data // -- Airbrush data

View File

@ -1605,6 +1605,14 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
true, true,
0, // No shortcut 0, // No shortcut
0}, 0},
{197,
"Toggle color cycling",
"Activates or desactivates color",
"cycling, if the current image has",
"cycling colors. (See gradient menu)",
true,
SDLK_BACKQUOTE|MOD_CTRL, // Ctrl + `~
0},
}; };
word Ordering[NB_SHORTCUTS]= word Ordering[NB_SHORTCUTS]=
@ -1806,4 +1814,5 @@ word Ordering[NB_SHORTCUTS]=
SPECIAL_RUN_SCRIPT_8, SPECIAL_RUN_SCRIPT_8,
SPECIAL_RUN_SCRIPT_9, SPECIAL_RUN_SCRIPT_9,
SPECIAL_RUN_SCRIPT_10, SPECIAL_RUN_SCRIPT_10,
SPECIAL_CYCLE_MODE,
}; };

View File

@ -33,7 +33,7 @@
#endif #endif
#include <SDL.h> #include <SDL.h>
#define NB_SHORTCUTS 197 ///< Number of actions that can have a key combination associated to it. #define NB_SHORTCUTS 198 ///< Number of actions that can have a key combination associated to it.
/*** Types definitions and structs ***/ /*** Types definitions and structs ***/

View File

@ -923,7 +923,7 @@ int Color_cycling(__attribute__((unused)) void* useless)
start = SDL_GetTicks(); start = SDL_GetTicks();
return 1; return 1;
} }
if (!Allow_colorcycling) if (!Allow_colorcycling || !Cycling_mode)
return 1; return 1;