GrafX2 2.9.3227
The ultimate 256-color painting program
init.c File Reference
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include "gfx2mem.h"
#include "buttons.h"
#include "const.h"
#include "errors.h"
#include "global.h"
#include "graph.h"
#include "init.h"
#include "io.h"
#include "factory.h"
#include "help.h"
#include "hotkeys.h"
#include "keyboard.h"
#include "loadsave.h"
#include "misc.h"
#include "mountlist.h"
#include "operatio.h"
#include "palette.h"
#include "screen.h"
#include "setup.h"
#include "struct.h"
#include "transform.h"
#include "windows.h"
#include "layers.h"
#include "special.h"
#include "gfx2surface.h"
#include "init_buttons.h"
+ Include dependency graph for init.c:

Macros

#define HIDE_CURSOR   1
 
#define FAST_MOUSE   1
 

Functions

static byte GUI_seek_down (T_GFX2_Surface *gui, int *start_x, int *start_y, byte neutral_color, char *section)
 
static byte GUI_seek_right (T_GFX2_Surface *gui, int *start_x, int start_y, byte neutral_color, char *section)
 
static byte Read_GUI_block (T_Gui_skin *gfx, T_GFX2_Surface *gui, int start_x, int start_y, void *dest, int width, int height, char *section, int type)
 
static byte Read_GUI_pattern (T_Gui_skin *gfx, T_GFX2_Surface *gui, int start_x, int start_y, word *dest, char *section)
 
void Center_GUI_cursor (T_Gui_skin *gfx, byte *cursor_buffer, int cursor_number)
 
static byte Parse_skin (T_GFX2_Surface *gui, T_Gui_skin *gfx)
 
T_Gui_skinLoad_graphics (const char *skin_file, T_Gradient_array *gradients)
 
static byteParse_font (T_GFX2_Surface *image, int is_main)
 
byteLoad_font (const char *font_name, int is_main)
 Loads a 8x8 monochrome font, the kind used in all menus and screens. More...
 
static void Load_Unicode_font (const char *fullname, const char *filename)
 
void Load_Unicode_fonts (void)
 Load fonts for additional Unicode characters. More...
 
static void Do_nothing (int btn)
 
static void Init_button (byte btn_number, const char *tooltip, word x_offset, word y_offset, word width, word height, byte shape, Func_btn_action left_action, Func_btn_action right_action, byte left_instant, byte right_instant, Func_btn_action unselect_action, byte family)
 
void Init_buttons (void)
 
void Init_operation (byte operation_number, byte mouse_button, byte stack_index, Func_action action, byte hide_cursor, byte fast_mouse)
 
void Init_operations (void)
 
static void Set_video_mode (short width, short height, byte mode, word fullscreen)
 
int Compare_video_modes (const void *p1, const void *p2)
 
void Set_all_video_modes (void)
 
int Load_CFG (int reload_all)
 
int Save_CFG (void)
 
void Set_config_defaults (void)
 
void Init_sighandler (void)
 
void Init_brush_container (void)
 
void Set_current_skin (const char *skinfile, T_Gui_skin *gfx)
 
void Init_paintbrush (int index, int width, int height, byte shape, const char *bitmap)
 
void Init_paintbrushes (void)
 

Variables

char Gui_loading_error_message [256]
 

Macro Definition Documentation

◆ HIDE_CURSOR

#define HIDE_CURSOR   1

◆ FAST_MOUSE

#define FAST_MOUSE   1

Function Documentation

◆ GUI_seek_down()

static byte GUI_seek_down ( T_GFX2_Surface gui,
int *  start_x,
int *  start_y,
byte  neutral_color,
char *  section 
)
static

◆ GUI_seek_right()

static byte GUI_seek_right ( T_GFX2_Surface gui,
int *  start_x,
int  start_y,
byte  neutral_color,
char *  section 
)
static

◆ Read_GUI_block()

static byte Read_GUI_block ( T_Gui_skin gfx,
T_GFX2_Surface gui,
int  start_x,
int  start_y,
void *  dest,
int  width,
int  height,
char *  section,
int  type 
)
static

◆ Read_GUI_pattern()

static byte Read_GUI_pattern ( T_Gui_skin gfx,
T_GFX2_Surface gui,
int  start_x,
int  start_y,
word dest,
char *  section 
)
static

References Read_GUI_block().

Referenced by Parse_skin().

◆ Center_GUI_cursor()

void Center_GUI_cursor ( T_Gui_skin gfx,
byte cursor_buffer,
int  cursor_number 
)

◆ Parse_skin()

◆ Load_graphics()

T_Gui_skin * Load_graphics ( const char *  skin_file,
T_Gradient_array gradients 
)

◆ Parse_font()

static byte * Parse_font ( T_GFX2_Surface image,
int  is_main 
)
static

◆ Load_font()

byte * Load_font ( const char *  font_name,
int  is_main 
)

Loads a 8x8 monochrome font, the kind used in all menus and screens.

This function allocates the memory, and returns a pointer to it when successful. If an error is encountered, it frees what needs it, prints an error message in Gui_loading_error_message, and returns NULL.

References Data_directory, Free_GFX2_Surface(), GFX2_malloc, Gui_loading_error_message, Load_surface(), NULL, Parse_font(), and SKINS_SUBDIRECTORY.

Referenced by Button_Skins(), Init_program(), and Load_Unicode_font().

◆ Load_Unicode_font()

static void Load_Unicode_font ( const char *  fullname,
const char *  filename 
)
static

◆ Load_Unicode_fonts()

void Load_Unicode_fonts ( void  )

Load fonts for additional Unicode characters.

References Data_directory, Filepath_append_to_dir(), For_each_file(), Load_Unicode_font(), and SKINS_SUBDIRECTORY.

Referenced by Init_program().

◆ Do_nothing()

static void Do_nothing ( int  btn)
static

Referenced by Init_buttons().

◆ Init_button()

◆ Init_buttons()

◆ Init_operation()

void Init_operation ( byte  operation_number,
byte  mouse_button,
byte  stack_index,
Func_action  action,
byte  hide_cursor,
byte  fast_mouse 
)

References Operation.

Referenced by Init_operations().

◆ Init_operations()

void Init_operations ( void  )

References Airbrush_0_2(), Airbrush_12_2(), Airbrush_1_0(), Airbrush_2_0(), Brush_0_5(), Brush_12_0(), Brush_12_5(), Centered_lines_0_3(), Centered_lines_0_7(), Centered_lines_12_0(), Centered_lines_12_3(), Centered_lines_12_7(), Circle_12_0(), Circle_12_5(), Colorpicker_0_1(), Colorpicker_12_0(), Colorpicker_1_1(), Colorpicker_2_1(), Colorpicker_color, Curve_34_points_1_0(), Curve_34_points_1_5(), Curve_34_points_2_0(), Curve_34_points_2_5(), Curve_3_points_0_11(), Curve_3_points_0_5(), Curve_3_points_12_11(), Curve_4_points_0_5(), Curve_4_points_1_9(), Curve_4_points_2_9(), Distort_brush_0_0(), Distort_brush_0_9(), Distort_brush_1_0(), Distort_brush_1_8(), Distort_brush_1_9(), Distort_brush_2_0(), Distort_brush_2_8(), Ellipse_12_0(), Ellipse_12_5(), Empty_circle_0_5(), Empty_ellipse_0_5(), Empty_rectangle_0_5(), FAST_MOUSE, Fill_1_0(), Fill_2_0(), Filled_circle_0_5(), Filled_contour_0_8(), Filled_ellipse_0_5(), Filled_polyform_0_8(), Filled_polyform_12_0(), Filled_polyform_12_8(), Filled_rectangle_0_5(), Freehand_mode12_0_2(), Freehand_mode1_1_0(), Freehand_mode1_1_2(), Freehand_mode1_2_0(), Freehand_mode1_2_2(), Freehand_mode2_1_0(), Freehand_mode2_1_2(), Freehand_mode2_2_0(), Freehand_mode2_2_2(), Freehand_mode3_0_1(), Freehand_mode3_1_0(), Freehand_Mode3_2_0(), Grad_circle_0_6(), Grad_circle_12_0(), Grad_circle_12_6(), Grad_circle_12_8(), Grad_circle_or_ellipse_0_8(), Grad_ellipse_0_6(), Grad_ellipse_12_0(), Grad_ellipse_12_6(), Grad_ellipse_12_8(), Grad_rectangle_0_5(), Grad_rectangle_0_7(), Grad_rectangle_0_9(), Grad_rectangle_12_0(), Grad_rectangle_12_5(), Grad_rectangle_12_7(), Grad_rectangle_12_9(), HIDE_CURSOR, Init_operation(), K_line_0_6(), K_line_12_0(), K_line_12_6(), K_line_12_7(), Line_0_5(), Line_12_0(), Line_12_5(), Magnifier_12_0(), NB_OPERATIONS, OPERATION_3_POINTS_CURVE, OPERATION_4_POINTS_CURVE, OPERATION_AIRBRUSH, OPERATION_CENTERED_LINES, OPERATION_COLORPICK, OPERATION_CONTINUOUS_DRAW, OPERATION_DISCONTINUOUS_DRAW, OPERATION_DISTORT_BRUSH, OPERATION_EMPTY_CIRCLE_CRN, OPERATION_EMPTY_CIRCLE_CTR, OPERATION_EMPTY_ELLIPSE_CRN, OPERATION_EMPTY_ELLIPSE_CTR, OPERATION_EMPTY_RECTANGLE, OPERATION_FILL, OPERATION_FILLED_CIRCLE_CRN, OPERATION_FILLED_CIRCLE_CTR, OPERATION_FILLED_CONTOUR, OPERATION_FILLED_ELLIPSE_CRN, OPERATION_FILLED_ELLIPSE_CTR, OPERATION_FILLED_POLYFORM, OPERATION_FILLED_RECTANGLE, OPERATION_GRAB_BRUSH, OPERATION_GRAD_CIRCLE_CRN, OPERATION_GRAD_CIRCLE_CTR, OPERATION_GRAD_ELLIPSE_CRN, OPERATION_GRAD_ELLIPSE_CTR, OPERATION_GRAD_RECTANGLE, OPERATION_K_LINE, OPERATION_LINE, OPERATION_MAGNIFY, OPERATION_PAN_VIEW, OPERATION_POINT_DRAW, OPERATION_POLYBRUSH, OPERATION_POLYFILL, OPERATION_POLYFORM, OPERATION_POLYGON, OPERATION_REPLACE, OPERATION_RMB_COLORPICK, OPERATION_ROTATE_BRUSH, OPERATION_SCROLL, OPERATION_STACK_SIZE, OPERATION_STRETCH_BRUSH, Pan_view_0_0(), Pan_view_0_2(), Pan_view_12_0(), Pan_view_12_2(), Polybrush_12_8(), Polyfill_0_8(), Polyfill_12_0(), Polyfill_12_8(), Polyfill_12_9(), Polyform_0_8(), Polyform_12_0(), Polyform_12_8(), Polygon_12_0(), Polygon_12_9(), Print_coordinates(), Rectangle_12_0(), Rectangle_12_5(), Replace_1_0(), Replace_2_0(), Rightclick_colorpick_0_1(), Rotate_brush_0_5(), Rotate_brush_12_0(), Rotate_brush_1_5(), Rotate_brush_2_5(), Scroll_0_5(), Scroll_12_0(), Scroll_12_5(), Stretch_brush_0_7(), Stretch_brush_12_0(), Stretch_brush_1_7(), and Stretch_brush_2_7().

Referenced by Init_program().

◆ Set_video_mode()

static void Set_video_mode ( short  width,
short  height,
byte  mode,
word  fullscreen 
)
static

◆ Compare_video_modes()

int Compare_video_modes ( const void *  p1,
const void *  p2 
)

◆ Set_all_video_modes()

◆ Load_CFG()

◆ Save_CFG()

◆ Set_config_defaults()

◆ Init_sighandler()

void Init_sighandler ( void  )

Referenced by Init_program().

◆ Init_brush_container()

◆ Set_current_skin()

◆ Init_paintbrush()

void Init_paintbrush ( int  index,
int  width,
int  height,
byte  shape,
const char *  bitmap 
)

◆ Init_paintbrushes()

Variable Documentation

◆ Gui_loading_error_message