Layer toolbar visible by default. Grafx2 now records which toolbars are visible on exit, and restores them next time.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1327 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
b0a700850f
commit
6f08d59f01
31
buttons.c
31
buttons.c
@ -402,26 +402,13 @@ void Button_Hide_menu(void)
|
||||
|
||||
|
||||
void Set_bar_visibility(word bar, byte visible)
|
||||
{
|
||||
int i;
|
||||
int offset;
|
||||
|
||||
{
|
||||
if (!visible && Menu_bars[bar].Visible)
|
||||
{
|
||||
// Hide it
|
||||
Menu_bars[bar].Visible=0;
|
||||
|
||||
// Recompute all offsets
|
||||
offset=0;
|
||||
for (i = MENUBAR_COUNT-1; i >=0; i--)
|
||||
{
|
||||
Menu_bars[i].Top = offset;
|
||||
if(Menu_bars[i].Visible)
|
||||
offset += Menu_bars[i].Height;
|
||||
}
|
||||
// Update global menu coordinates
|
||||
Menu_Y += Menu_bars[bar].Height * Menu_factor_Y;
|
||||
Menu_height -= Menu_bars[bar].Height;
|
||||
Compute_menu_offsets();
|
||||
|
||||
if (Main_magnifier_mode)
|
||||
{
|
||||
@ -465,18 +452,8 @@ void Set_bar_visibility(word bar, byte visible)
|
||||
{
|
||||
// Show it
|
||||
Menu_bars[bar].Visible = 1;
|
||||
// Recompute all offsets
|
||||
offset=0;
|
||||
for (i = MENUBAR_COUNT-1; i >=0; i--)
|
||||
{
|
||||
Menu_bars[i].Top = offset;
|
||||
if(Menu_bars[i].Visible)
|
||||
offset += Menu_bars[i].Height;
|
||||
}
|
||||
// Update global menu coordinates
|
||||
Menu_Y -= Menu_bars[bar].Height * Menu_factor_Y;
|
||||
Menu_height += Menu_bars[bar].Height;
|
||||
|
||||
|
||||
Compute_menu_offsets();
|
||||
Compute_magnifier_data();
|
||||
if (Main_magnifier_mode)
|
||||
Position_screen_according_to_zoom();
|
||||
|
||||
11
gfx2def.ini
11
gfx2def.ini
@ -345,6 +345,15 @@
|
||||
; Valid values are 1 to 255.
|
||||
Grid_XOR_color = 255; (Default 255)
|
||||
|
||||
Pixel_ratio = 1;
|
||||
; This records the last pixel ratio used, to restore it on start.
|
||||
; Valid values are from 0 to 7 for: Simple, Wide, Tall, Double,
|
||||
; Triple, Wide2, Tall2, Quadruple.
|
||||
;
|
||||
Pixel_ratio = 1; (Default 0)
|
||||
|
||||
; This records the visibility of toolbars, to restore them on start.
|
||||
; It's a bitfield, where 1=Status, 2=Layers, 4=Tools
|
||||
;
|
||||
Menubars_visible = 7; (Default 7)
|
||||
|
||||
; end of configuration
|
||||
|
||||
4
global.h
4
global.h
@ -492,8 +492,8 @@ GFX2_GLOBAL word Menu_palette_cell_width;
|
||||
GFX2_GLOBAL T_Menu_Bar Menu_bars[MENUBAR_COUNT]
|
||||
#ifdef GLOBAL_VARIABLES
|
||||
=
|
||||
{{MENU_WIDTH, 9, 1, 35, NULL, 20, BUTTON_HIDE }, // Status
|
||||
{MENU_WIDTH, 10, 0, 35, NULL, 144, BUTTON_LAYER_SELECT }, // Layers
|
||||
{{MENU_WIDTH, 9, 1, 45, NULL, 20, BUTTON_HIDE }, // Status
|
||||
{MENU_WIDTH, 10, 1, 35, NULL, 144, BUTTON_LAYER_SELECT }, // Layers
|
||||
{MENU_WIDTH, 35, 1, 0, NULL, 254, BUTTON_CHOOSE_COL }} // Main
|
||||
#endif
|
||||
;
|
||||
|
||||
24
init.c
24
init.c
@ -2657,3 +2657,27 @@ void Set_current_skin(const char *skinfile, T_Gui_skin *gfx)
|
||||
Menu_bars[MENUBAR_LAYERS].Skin = (byte*)&(gfx->Layerbar_block);
|
||||
Menu_bars[MENUBAR_STATUS].Skin = (byte*)&(gfx->Statusbar_block);
|
||||
}
|
||||
|
||||
///
|
||||
/// Based on which toolbars are visible, updates their offsets and
|
||||
/// computes ::Menu_height and ::Menu_Y
|
||||
void Compute_menu_offsets(void)
|
||||
{
|
||||
int i;
|
||||
int offset;
|
||||
|
||||
// Recompute all offsets
|
||||
offset=0;
|
||||
Menu_height=0;
|
||||
for (i = MENUBAR_COUNT-1; i >=0; i--)
|
||||
{
|
||||
Menu_bars[i].Top = offset;
|
||||
if(Menu_bars[i].Visible)
|
||||
{
|
||||
offset += Menu_bars[i].Height;
|
||||
Menu_height += Menu_bars[i].Height;
|
||||
}
|
||||
}
|
||||
// Update global menu coordinates
|
||||
Menu_Y = Screen_height - Menu_height * Menu_factor_Y;
|
||||
}
|
||||
5
init.h
5
init.h
@ -44,3 +44,8 @@ extern char Gui_loading_error_message[512];
|
||||
/// If an error is encountered, it frees what needs it, prints an error message
|
||||
/// in ::Gui_loading_error_message, and returns NULL.
|
||||
byte * Load_font(const char * font_name);
|
||||
|
||||
///
|
||||
/// Based on which toolbars are visible, updates their offsets and
|
||||
/// computes ::Menu_height and ::Menu_Y
|
||||
void Compute_menu_offsets(void);
|
||||
|
||||
3
main.c
3
main.c
@ -553,7 +553,6 @@ int Init_program(int argc,char * argv[])
|
||||
Quitting=0;
|
||||
// Données sur l'état du menu:
|
||||
Menu_is_visible=1;
|
||||
Menu_height=MENU_HEIGHT;
|
||||
// Données sur les couleurs et la palette:
|
||||
First_color_in_palette=0;
|
||||
// Données sur le curseur:
|
||||
@ -642,6 +641,8 @@ int Init_program(int argc,char * argv[])
|
||||
if (temp)
|
||||
Error(temp);
|
||||
|
||||
Compute_menu_offsets();
|
||||
|
||||
file_in_command_line=Analyze_command_line(argc, argv, main_filename, main_directory, spare_filename, spare_directory);
|
||||
|
||||
Current_help_section=0;
|
||||
|
||||
11
readini.c
11
readini.c
@ -877,6 +877,17 @@ int Load_INI(T_Config * conf)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Optional, Menu bars visibility (> 2.1)
|
||||
if (!Load_INI_get_values (file, buffer,"Menubars_visible",1,values))
|
||||
{
|
||||
int index;
|
||||
for (index=MENUBAR_STATUS+1; index<MENUBAR_COUNT;index++)
|
||||
{
|
||||
// Note that I skip the status bar, always enabled.
|
||||
Menu_bars[index].Visible = (values[0] & (1<<index)) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
|
||||
11
saveini.c
11
saveini.c
@ -659,7 +659,16 @@ int Save_INI(T_Config * conf)
|
||||
DEBUG("saving pixel ratio",return_code);
|
||||
goto Erreur_Retour;
|
||||
}
|
||||
|
||||
|
||||
values[0]=0;
|
||||
for (index=0; index<MENUBAR_COUNT;index++)
|
||||
{
|
||||
values[0] |= Menu_bars[index].Visible ? (1<<index) : 0;
|
||||
}
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Menubars_visible",1,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
|
||||
Save_INI_flush(Ancien_fichier,Nouveau_fichier,buffer);
|
||||
|
||||
fclose(Nouveau_fichier);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user