GrafX2 2.9.3227
The ultimate 256-color painting program
buttons.c File Reference
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/stat.h>
#include "const.h"
#include "struct.h"
#include "global.h"
#include "misc.h"
#include "osdep.h"
#include "graph.h"
#include "engine.h"
#include "readline.h"
#include "filesel.h"
#include "fileseltools.h"
#include "loadsave.h"
#include "init.h"
#include "buttons.h"
#include "operatio.h"
#include "pages.h"
#include "palette.h"
#include "errors.h"
#include "readini.h"
#include "saveini.h"
#include "shade.h"
#include "io.h"
#include "help.h"
#include "text.h"
#include "screen.h"
#include "windows.h"
#include "brush.h"
#include "input.h"
#include "special.h"
#include "tiles.h"
#include "setup.h"
#include "unicode.h"
#include "keycodes.h"
#include <dirent.h>
+ Include dependency graph for buttons.c:

Data Structures

struct  T_Lookup
 
struct  T_Setting
 

Macros

#define SETTING_PER_PAGE   11
 
#define SETTING_PAGES   5
 
#define SETTING_HEIGHT   12
 
#define FILESEL_Y   34
 
#define MODELIST_LINES   10
 Number of video modes to display in the resolution menu. More...
 
#define TOLERANCE_X   8
 
#define TOLERANCE_Y   4
 
#define C1   10
 
#define C2   99
 
#define C3   184
 
#define L1   19
 
#define L2   38
 
#define L3   57
 
#define L4   76
 
#define L5   95
 

Functions

void Message_out_of_memory (void)
 Displays an error message when there is no more memory for the requested operation. More...
 
void Button_Message_initial (void)
 Displays the splash screen at program startup. More...
 
void Change_paintbrush_shape (byte shape)
 Changes brush shape. More...
 
void Button_Undo (int btn)
 Undo the last modification to the picture. More...
 
void Button_Redo (int btn)
 Redo the last modification to the picture. More...
 
void Button_Pal_left (int btn)
 Callback for the palette scroller buttons left click. More...
 
void Button_Pal_left_fast (int btn)
 Callback for the palette scroller buttons right click. More...
 
void Button_Pal_right (int btn)
 Callback for the palette scroller buttons left click. More...
 
void Button_Pal_right_fast (int btn)
 Callback for the palette scroller buttons right click. More...
 
void Button_Select_forecolor (int btn)
 Callback for the palette color buttons left click. More...
 
void Button_Select_backcolor (int btn)
 Callback for the palette color buttons right click. More...
 
void Button_Hide_menu (int btn)
 Hides the menubar. More...
 
void Button_Toggle_toolbar (int btn)
 Shows a dropdown panel where you can choose which toolbars are visible. More...
 
void Button_Toggle_all_toolbars (int btn)
 Hides all toolbars (except status) or shows them again. More...
 
byte Button_Quit_local_function (void)
 
void Button_Quit (int btn)
 Quits the program. More...
 
void Button_Clear (int btn)
 Clear the whole screen with black (color index 0). More...
 
void Button_Clear_with_backcolor (int btn)
 Clear the screen with the selected backcolor. More...
 
long int Get_setting_value (const T_Setting *item)
 
void Set_setting_value (const T_Setting *item, long int value)
 
const char * Lookup_code (int code, const T_Lookup *lookup)
 
int Lookup_next (int code, const T_Lookup *lookup)
 Increase an enum to next-higher value (wrapping). More...
 
int Lookup_previous (int code, const T_Lookup *lookup)
 Decrease an enum to previous value (wrapping). More...
 
void Settings_display_config (const T_Setting *setting, T_Config *conf, T_Special_button *panel)
 
void Settings_save_config (T_Config *conf)
 
void Settings_load_config (T_Config *conf)
 
void Button_Settings (int btn)
 Display the setting menu. More...
 
char * Format_font_filename (const char *fname)
 
static void Add_font_or_skin (const char *full_name, const char *fname)
 
void Draw_one_skin_name (word x, word y, word index, byte highlighted)
 
void Button_Skins (int btn)
 Skin selector window. More...
 
void Button_Page (int btn)
 Swap main and spare drawing pages. More...
 
void Copy_image_only (void)
 Copy only pixel data from main page to spare page (no palette copy). More...
 
void Copy_some_colors (void)
 
void Button_Copy_page (int btn)
 Copy main page to spare page. More...
 
void Button_Kill (int btn)
 Kill (free from memory) the current page. More...
 
void Check_mode_button (short x_pos, short y_pos, byte state)
 
void Display_modes_list (short list_start, short cursor_position)
 
void Scroll_list_of_modes (short list_start, short cursor_position, int *selected_mode)
 
void Button_Resolution (int btn)
 Display the screenmode menu. More...
 
void Button_Safety_resolution (int btn)
 Set the screen to the "safe resolution" (320x200 pixel window). More...
 
void Button_Draw (int btn)
 Callback for the freehand draw button left click. More...
 
void Button_Draw_switch_mode (int btn)
 Callback for the freehand draw button right click. More...
 
void Button_Empty_rectangle (int btn)
 Callback for the empty rectangle button. More...
 
void Button_Filled_rectangle (int btn)
 Callback for the filled rectangle button. More...
 
void Button_circle_ellipse (int btn)
 Callback for the circle/ellipse buttons Starts drawing circle/ellipse. More...
 
void Button_Circle_switch_mode (int btn)
 Callback for the cicle button right click. More...
 
void Draw_button_gradient_style (short x_pos, short y_pos, int technique)
 
void Load_gradient_data (int index)
 Gets the informations from the gradations table and set the global vars for the current gradation. More...
 
static void Draw_gradient_preview (short start_x, short start_y, short width, short height, int index)
 draw the gradient preview for the Gradation menu More...
 
static void Tag_color_gradient_range (const T_Gradient_range *range)
 Tag colors from a gradient range. More...
 
static void Print_color_cycling_details (short y_pos)
 Print the Color cycling speed in Hz, ms and in DP2E unit. More...
 
void Button_Gradients (int btn)
 Callback for the gradation button. More...
 
void Button_Grad_rectangle (int btn)
 Callback for the gradation rectangle button. More...
 
void Button_Fill (int btn)
 Callback for the fill button left click. More...
 
void Button_Replace (int btn)
 Callback for the fill button right click. More...
 
void Button_Unselect_fill (int btn)
 Disable and release the fill button. More...
 
byte Same_paintbrush (byte index)
 Checks if the current brush is identical to a preset one. More...
 
void Button_Paintbrush_menu (int btn)
 Callback for the brush button right click. More...
 
void Button_Brush_monochrome (int btn)
 Callback for the brush button left click. More...
 
static int Best_video_mode (void)
 
void Load_picture (enum CONTEXT_TYPE type)
 Load picture from file. More...
 
void Button_Load (int btn)
 Opens the load file dialog. More...
 
void Button_Reload (int btn)
 Reload current picture from disk. More...
 
static void Backup_existing_file (const char *filename)
 
void Save_picture (enum CONTEXT_TYPE type)
 Save picture to file. More...
 
void Button_Save (int btn)
 Open the save file dialog. More...
 
void Button_Autosave (int btn)
 Save main image over existing file (no fileselector) More...
 
void Button_Lines (int btn)
 Callback for the lines button left click. More...
 
void Button_Lines_switch_mode (int btn)
 Callback for the lines button right click. More...
 
void Button_Brush (int btn)
 Callback for the brush button left click. More...
 
void Button_Unselect_brush (int btn)
 Disables the custom brush and set back a regular one. More...
 
void Button_Restore_brush (int btn)
 Callback for the brush button right click. More...
 
void Button_Lasso (int btn)
 Callback for the freehand brush pick button left click. More...
 
void Button_Unselect_lasso (int btn)
 Disables the custom freehand brush and set back a regular one. More...
 
void Button_Colorpicker (int btn)
 Starts the color picking operation. More...
 
void Button_Unselect_colorpicker (int btn)
 Disables the color picker button and get back to the previously selected drawing mode. More...
 
void Button_Invert_foreback (int btn)
 Swap fore- and background colors. More...
 
void Button_Magnify (int btn)
 Enters magnify mode. More...
 
void Button_Magnify_menu (int btn)
 Displays magnify menu. More...
 
void Button_Unselect_magnifier (int btn)
 Exit magnify mode. More...
 
void Button_Brush_FX (int btn)
 Display the Brush effects window. More...
 
void Button_Curves (int btn)
 Callback for the curves button left click. More...
 
void Button_Curves_switch_mode (int btn)
 Callback for the curves button right click. More...
 
void Button_Airbrush (int btn)
 Callback for the spray button left click. More...
 
void Refresh_airbrush_settings (byte selected_color, byte update_slider)
 
void Button_Airbrush_menu (int btn)
 Callback for the spray button right click. More...
 
void Button_polygon (int btn)
 Callback for the polyline button left click. More...
 
void Button_Polyform (int btn)
 Callback for the polyline right click. More...
 
void Button_Polyfill (int btn)
 Callback for the polyfill button left click. More...
 
void Button_Filled_polyform (int btn)
 Callback for the polyfill button right click. More...
 
void Button_Adjust (int btn)
 Callback for the adjust picture button. More...
 
void Display_effect_sprite (int sprite_number, short start_x, short start_y)
 
void Display_effect_state (short x, short y, char *label, byte state)
 
void Display_effect_states (void)
 
void Display_feedback_state (void)
 
void Button_Effects (int btn)
 Callback for the effects button click. More...
 
void Draw_one_font_name (word x, word y, word index, byte highlighted)
 
void Button_Text (int btn)
 Callback for the text button. More...
 
void Display_stored_brush_in_window (word x_pos, word y_pos, int index)
 
void Store_brush (int index)
 Store the current brush in brush container. More...
 
void Select_paintbrush (int index)
 Retrieve a normal paintbrush. More...
 
byte Store_paintbrush (int index)
 Store the current brush in paintbrush slot, if possible. More...
 
byte Restore_brush (int index)
 
void Button_Brush_container (void)
 
byte Any_effect_active (void)
 

Variables

char Program_version []
 
short Old_MX
 
short Old_MY
 
const T_Lookup Lookup_YesNo []
 
const T_Lookup Lookup_FFF []
 
const T_Lookup Lookup_AutoRes []
 
const T_Lookup Lookup_Coords []
 
const T_Lookup Lookup_MenuRatio []
 
const T_Lookup Lookup_MouseSpeed []
 
const T_Lookup Lookup_SwapButtons []
 
const T_Lookup Lookup_VirtualKeyboard []
 
T_Fileselector Skin_files_list
 
T_Fileselector Font_files_list
 
byte Coming_from_zoom_factor_menu =0
 

Macro Definition Documentation

◆ SETTING_PER_PAGE

#define SETTING_PER_PAGE   11

◆ SETTING_PAGES

#define SETTING_PAGES   5

◆ SETTING_HEIGHT

#define SETTING_HEIGHT   12

◆ FILESEL_Y

#define FILESEL_Y   34

◆ MODELIST_LINES

#define MODELIST_LINES   10

Number of video modes to display in the resolution menu.

◆ TOLERANCE_X

#define TOLERANCE_X   8

◆ TOLERANCE_Y

#define TOLERANCE_Y   4

◆ C1

#define C1   10

◆ C2

#define C2   99

◆ C3

#define C3   184

◆ L1

#define L1   19

◆ L2

#define L2   38

◆ L3

#define L3   57

◆ L4

#define L4   76

◆ L5

#define L5   95

Function Documentation

◆ Message_out_of_memory()

void Message_out_of_memory ( void  )

◆ Button_Message_initial()

◆ Change_paintbrush_shape()

void Change_paintbrush_shape ( byte  shape)

Changes brush shape.

This function saves the current brush shape and swith to the default one (single pixel brush) for the filler and the color picker. These functions don't need (and will not work with) a custom brush.

References Current_operation, Display_paintbrush_in_menu(), OPERATION_COLORPICK, OPERATION_FILL, Paintbrush_shape, Paintbrush_shape_before_colorpicker, Paintbrush_shape_before_fill, PAINTBRUSH_SHAPE_NONE, and PAINTBRUSH_SHAPE_POINT.

Referenced by Button_Brush_monochrome(), Button_Paintbrush_menu(), Button_Restore_brush(), Button_Sieve_menu(), Button_Text(), Load_picture(), Main_handler(), Restore_brush(), Return_to_draw_mode(), and Select_paintbrush().

◆ Button_Undo()

◆ Button_Redo()

◆ Button_Pal_left()

void Button_Pal_left ( int  btn)

Callback for the palette scroller buttons left click.

Scrolls the menubar palette one column to the left.

References Config, Display_cursor(), Display_menu_palette(), First_color_in_palette, Hide_cursor, Palette_cells_X(), Palette_cells_Y(), T_Config::Palette_vertical, and Unselect_button().

◆ Button_Pal_left_fast()

void Button_Pal_left_fast ( int  btn)

Callback for the palette scroller buttons right click.

Scrolls the menubar palette faster to the left.

References Display_cursor(), Display_menu_palette(), First_color_in_palette, Hide_cursor, Palette_cells_X(), Palette_cells_Y(), and Unselect_button().

◆ Button_Pal_right()

void Button_Pal_right ( int  btn)

Callback for the palette scroller buttons left click.

Scrolls the menubar palette one column to the right.

References Config, Display_cursor(), Display_menu_palette(), First_color_in_palette, Hide_cursor, Palette_cells_X(), Palette_cells_Y(), T_Config::Palette_vertical, and Unselect_button().

◆ Button_Pal_right_fast()

void Button_Pal_right_fast ( int  btn)

Callback for the palette scroller buttons right click.

Scrolls the menubar palette faster to the right.

References Config, Display_cursor(), Display_menu_palette(), First_color_in_palette, Hide_cursor, Palette_cells_X(), Palette_cells_Y(), T_Config::Palette_vertical, and Unselect_button().

◆ Button_Select_forecolor()

void Button_Select_forecolor ( int  btn)

Callback for the palette color buttons left click.

Selects the foreground drawing color when clicking on the menubar palette.

References Button_Palette(), Button_under_mouse(), Config, Display_cursor(), T_Config::Double_click_speed, Fore_color, Get_input(), GFX2_GetTicks(), Hide_cursor, Mouse_K, Pick_color_in_palette(), Set_fore_color(), and Status_print_palette_color().

◆ Button_Select_backcolor()

void Button_Select_backcolor ( int  btn)

Callback for the palette color buttons right click.

Selects the background drawing color when clicking on the menubar palette.

References Back_color, Button_under_mouse(), Display_cursor(), Get_input(), Hide_cursor, Mouse_K, Pick_color_in_palette(), Set_back_color(), and Status_print_palette_color().

◆ Button_Hide_menu()

◆ Button_Toggle_toolbar()

◆ Button_Toggle_all_toolbars()

void Button_Toggle_all_toolbars ( int  btn)

◆ Button_Quit_local_function()

◆ Button_Quit()

void Button_Quit ( int  btn)

Quits the program.

Display a requester to save the changes to the picture before exiting if the pic was modified since last save.

References Button_Page(), BUTTON_PAGE, Button_Quit_local_function(), Display_cursor(), Hide_cursor, T_Document::image_is_modified, Menu_is_visible, Menu_Y, Mouse_Y, Quitting, Spare, and Unselect_button().

Referenced by Main_handler().

◆ Button_Clear()

◆ Button_Clear_with_backcolor()

◆ Get_setting_value()

long int Get_setting_value ( const T_Setting item)

◆ Set_setting_value()

void Set_setting_value ( const T_Setting item,
long int  value 
)

References T_Setting::Type, and T_Setting::Value.

Referenced by Button_Settings().

◆ Lookup_code()

const char * Lookup_code ( int  code,
const T_Lookup lookup 
)

References T_Lookup::Label, and NULL.

Referenced by Settings_display_config().

◆ Lookup_next()

int Lookup_next ( int  code,
const T_Lookup lookup 
)

Increase an enum to next-higher value (wrapping).

References T_Lookup::Code, T_Lookup::Label, and NULL.

Referenced by Button_Settings().

◆ Lookup_previous()

int Lookup_previous ( int  code,
const T_Lookup lookup 
)

Decrease an enum to previous value (wrapping).

References T_Lookup::Label, and NULL.

Referenced by Button_Settings().

◆ Settings_display_config()

◆ Settings_save_config()

void Settings_save_config ( T_Config conf)

References Error, Save_CFG(), and Save_INI().

Referenced by Button_Settings().

◆ Settings_load_config()

void Settings_load_config ( T_Config conf)

References Error, Load_CFG(), and Load_INI().

Referenced by Button_Settings().

◆ Button_Settings()

void Button_Settings ( int  btn)

Display the setting menu.

References T_Config::Adjust_brush_pick, T_Config::Allow_multi_shortcuts, T_Config::Auto_discontinuous, T_Config::Auto_nb_used, T_Config::Auto_save, T_Config::Auto_set_res, T_Config::Backup, Brush_selector, BUTTON_HELP, BUTTON_SETTINGS, T_Config::Clear_palette, T_Config::Clear_with_stencil, Close_window(), Compute_optimal_menu_colors(), Config, T_Config::Coords_rel, T_Config::Delay_left_click_on_slider, T_Config::Delay_right_click_on_slider, T_Setting::Digits, Display_cursor(), T_Config::Display_image_limits, Display_menu(), T_Config::Double_click_speed, T_Config::Double_key_speed, T_Config::Fast_zoom, T_Config::Find_file_fast, Get_setting_value(), Hide_cursor, INPUT_TYPE_INTEGER, Is_shortcut(), Key, KEY_a, KEY_ESC, KEY_MOUSEWHEELDOWN, KEY_MOUSEWHEELUP, KEY_r, KEY_RETURN, KEY_s, LEFT_SIDE, T_Setting::Lookup, Lookup_AutoRes, Lookup_Coords, Lookup_FFF, Lookup_MenuRatio, Lookup_next(), Lookup_previous(), Lookup_SwapButtons, Lookup_VirtualKeyboard, Lookup_YesNo, Main, T_Config::Max_undo_pages, T_Setting::Max_value, T_Config::Maximize_preview, Menu_factor_Y, T_Setting::Min_value, T_Config::MOTO_gamma, Mouse_K, T_Config::Mouse_merge_movement, T_Config::Mouse_motion_debounce, Mouse_Y, NB_BUTTONS, T_Config::Nb_max_vertices_per_polygon, NULL, Num2str, T_Selector_settings::Offset, Open_window(), T_Config::Opening_message, T_Document::palette, Palette_selector, T_Special_button::Pos_X, T_Special_button::Pos_Y, T_Selector_settings::Position, Quit_is_required, T_Config::Ratio, Readline(), Remove_duplicate_shortcuts(), T_Config::Right_click_colorpick, RIGHT_SIDE, T_Config::Safety_colors, T_Config::Screen_size_in_GIF, T_Document::selector, T_Config::Separate_colors, Set_number_of_backups(), T_Config::Set_resolution_according_to, Set_setting_value(), SETTING_HEIGHT, SETTING_PAGES, SETTING_PER_PAGE, Settings_display_config(), Settings_load_config(), Settings_save_config(), T_Config::Show_hidden_directories, T_Config::Show_hidden_files, Spare, T_Config::Swap_buttons, T_Config::Sync_views, T_Config::Timer_delay, T_Setting::Type, Unselect_button(), Update_window_area, T_Config::Use_virtual_keyboard, T_Special_button::Width, Window_attribute2, Window_clicked_button(), Window_draw_slider(), Window_height, Window_help(), Window_normal_button_onclick(), Window_pos_Y, Window_scroller_button_list, Window_set_normal_button(), Window_set_scroller_button(), Window_set_special_button(), and Window_width.

◆ Format_font_filename()

char * Format_font_filename ( const char *  fname)

References ELLIPSIS_CHARACTER, and FONT_PREFIX.

Referenced by Add_font_or_skin().

◆ Add_font_or_skin()

static void Add_font_or_skin ( const char *  full_name,
const char *  fname 
)
static

◆ Draw_one_skin_name()

void Draw_one_skin_name ( word  x,
word  y,
word  index,
byte  highlighted 
)

◆ Button_Skins()

void Button_Skins ( int  btn)

Skin selector window.

Display the skin selector window.

References Add_font_or_skin(), Any_effect_active(), BUTTON_EFFECTS, BUTTON_HELP, BUTTON_MAGNIFIER, BUTTON_SETTINGS, Buttons_Pool, Close_window(), T_Gui_skin::Color, Compute_optimal_menu_colors(), Config, T_Config::Cursor, T_List_button::Cursor_position, Data_directory, T_Gui_skin::Default_palette, Display_cursor(), T_Config::Display_image_limits, Display_menu(), Draw_menu_button(), Draw_one_skin_name(), Filepath_append_to_dir(), FILESEL_Y, Find_file_in_fileselector(), T_Config::Font_file, Font_files_list, For_each_file(), Free_fileselector_list(), T_Fileselector_item::Full_name, Get_item_by_index(), Gfx, Gui_loading_error_message, T_Dropdown_button::Height, Hide_cursor, Is_shortcut(), Key, KEY_ESCAPE, KEY_NONE, KEY_RETURN, LEFT_SIDE, T_List_button::List_start, Load_font(), Load_graphics(), T_Document::magnifier_mode, Main, MC_Black, MC_Dark, MC_Light, MC_White, Menu_font, NB_BUTTONS, T_Fileselector::Nb_elements, T_Fileselector::Nb_files, NULL, Open_window(), T_Document::palette, Pixel_in_window(), T_Dropdown_button::Pos_X, T_Dropdown_button::Pos_Y, T_Toolbar_button::Pressed, T_Gui_skin::Preview, Print_in_window(), Print_in_window_limited(), Quit_is_required, RIGHT_SIDE, T_Config::Separate_colors, Set_color(), Set_current_skin(), Set_palette(), T_Fileselector_item::Short_name, T_Config::Skin_file, Skin_files_list, SKINS_SUBDIRECTORY, Sort_list_of_files(), Unselect_button(), Update_window_area, Verbose_message(), Window_attribute2, Window_clicked_button(), Window_display_frame_in(), Window_dropdown_add_item(), Window_height, Window_help(), Window_rectangle(), Window_redraw_list(), Window_set_dropdown_button(), Window_set_list_button(), Window_set_normal_button(), Window_set_scroller_button(), Window_set_special_button(), and Window_width.

◆ Button_Page()

◆ Copy_image_only()

◆ Copy_some_colors()

void Copy_some_colors ( void  )

◆ Button_Copy_page()

◆ Button_Kill()

◆ Check_mode_button()

void Check_mode_button ( short  x_pos,
short  y_pos,
byte  state 
)

◆ Display_modes_list()

void Display_modes_list ( short  list_start,
short  cursor_position 
)

◆ Scroll_list_of_modes()

void Scroll_list_of_modes ( short  list_start,
short  cursor_position,
int *  selected_mode 
)

◆ Button_Resolution()

void Button_Resolution ( int  btn)

◆ Button_Safety_resolution()

void Button_Safety_resolution ( int  btn)

◆ Button_Draw()

void Button_Draw ( int  btn)

Callback for the freehand draw button left click.

Selects freehand drawing mode, depending on the current state of the freehand button.

References Display_cursor(), Hide_cursor, Selected_freehand_mode, and Start_operation_stack().

◆ Button_Draw_switch_mode()

◆ Button_Empty_rectangle()

void Button_Empty_rectangle ( int  btn)

Callback for the empty rectangle button.

Start the rectangle operation.

References Display_cursor(), Hide_cursor, OPERATION_EMPTY_RECTANGLE, and Start_operation_stack().

◆ Button_Filled_rectangle()

void Button_Filled_rectangle ( int  btn)

Callback for the filled rectangle button.

Start the filled rectangle operation.

References Display_cursor(), Hide_cursor, OPERATION_FILLED_RECTANGLE, and Start_operation_stack().

◆ Button_circle_ellipse()

void Button_circle_ellipse ( int  btn)

◆ Button_Circle_switch_mode()

◆ Draw_button_gradient_style()

void Draw_button_gradient_style ( short  x_pos,
short  y_pos,
int  technique 
)

◆ Load_gradient_data()

◆ Draw_gradient_preview()

static void Draw_gradient_preview ( short  start_x,
short  start_y,
short  width,
short  height,
int  index 
)
static

draw the gradient preview for the Gradation menu

References Gradient_function, Gradient_total_range, Load_gradient_data(), Menu_factor_X, Menu_factor_Y, Update_rect(), Window_pos_X, and Window_pos_Y.

Referenced by Button_Gradients().

◆ Tag_color_gradient_range()

static void Tag_color_gradient_range ( const T_Gradient_range range)
static

Tag colors from a gradient range.

References T_Gradient_range::End, T_Gradient_range::Start, and Tag_color_range().

Referenced by Button_Gradients().

◆ Print_color_cycling_details()

static void Print_color_cycling_details ( short  y_pos)
static

◆ Button_Gradients()

◆ Button_Grad_rectangle()

void Button_Grad_rectangle ( int  btn)

Callback for the gradation rectangle button.

Starts the gradation rectangle drawing operation.

References Display_cursor(), Hide_cursor, OPERATION_GRAD_RECTANGLE, and Start_operation_stack().

◆ Button_Fill()

◆ Button_Replace()

◆ Button_Unselect_fill()

void Button_Unselect_fill ( int  btn)

Disable and release the fill button.

Restores the cursor (custom brushes are disabled for the fill operation). Cleans the status bar if the color replacement tool put a preview color inside it.

References Current_operation, T_Document::magnifier_mode, Main, Menu_is_visible, Menu_Y, Mouse_X, Mouse_Y, OPERATION_REPLACE, Paintbrush_shape, Paintbrush_shape_before_fill, Print_in_menu(), T_Document::separator_position, and T_Document::X_zoom.

◆ Same_paintbrush()

byte Same_paintbrush ( byte  index)

Checks if the current brush is identical to a preset one.

References MAX_PAINTBRUSH_SIZE, Paintbrush, Paintbrush_height, Paintbrush_shape, PAINTBRUSH_SHAPE_MISC, Paintbrush_sprite, and Paintbrush_width.

Referenced by Button_Paintbrush_menu().

◆ Button_Paintbrush_menu()

◆ Button_Brush_monochrome()

void Button_Brush_monochrome ( int  btn)

Callback for the brush button left click.

Selects the monochrome brush mode when right clicking on the brush button.

References Change_paintbrush_shape(), Display_cursor(), Hide_cursor, PAINTBRUSH_SHAPE_MONO_BRUSH, and Unselect_button().

◆ Best_video_mode()

◆ Load_picture()

void Load_picture ( enum CONTEXT_TYPE  type)

Load picture from file.

References T_Config::Auto_discontinuous, T_Config::Auto_set_res, T_Document::backups, Best_video_mode(), Brush_file_directory, Brush_fileformat, Brush_filename, Brush_filename_unicode, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_selector, Brush_width, BUTTON_DRAW, Button_Load_or_Save(), BUTTON_MAGNIFIER, Change_paintbrush_shape(), Check_menu_mode(), Compute_limits(), Compute_optimal_menu_colors(), Compute_paintbrush_coordinates(), Config, Confirmation_box(), CONTEXT_BRUSH, CONTEXT_MAIN_IMAGE, CONTEXT_PALETTE, Current_operation, Current_resolution, Cursor_shape, CURSOR_SHAPE_HOURGLASS, Destroy_context(), Display_all_screen(), Display_cursor(), Display_menu(), Draw_menu_button(), End_of_modification(), T_IO_Context::File_directory, T_Page::File_directory, File_error, T_IO_Context::File_name, T_IO_Context::File_name_unicode, T_Document::fileformat, T_Page::Filename, T_Page::Filename_unicode, T_IO_Context::Format, FORMAT_PAL, Get_fileformat(), Hide_cursor, T_Document::image_height, T_Document::image_is_modified, T_Document::image_width, Init_context_brush(), Init_context_layered_image(), Init_mode_video(), LEFT_SIDE, Load_image(), T_Document::magnifier_mode, Main, NULL, T_Document::offset_X, T_Document::offset_Y, OPERATION_DISCONTINUOUS_DRAW, Original_screen_X, Original_screen_Y, T_List_of_pages::Pages, PAINTBRUSH_SHAPE_COLOR_BRUSH, T_Document::palette, T_Format::Palette_only, Palette_selector, Pixel_preview, Pixel_preview_normal, Pixel_ratio, PIXEL_TALL, PIXEL_TALL2, PIXEL_TALL3, PIXEL_WIDE, PIXEL_WIDE2, Print_filename(), T_IO_Context::Ratio, Redraw_layered_image(), RIGHT_SIDE, Select_button(), T_Document::selector, Set_palette(), Tiling_offset_X, Tiling_offset_Y, T_IO_Context::Type, Unicode_strdup(), and Video_mode.

Referenced by Button_Brush_FX(), Button_Load(), Button_Palette(), and Main_handler().

◆ Button_Load()

void Button_Load ( int  btn)

Opens the load file dialog.

References CONTEXT_MAIN_IMAGE, Load_picture(), Main, Tilemap_update(), and Upload_infos_page().

◆ Button_Reload()

◆ Backup_existing_file()

static void Backup_existing_file ( const char *  filename)
static

◆ Save_picture()

◆ Button_Save()

void Button_Save ( int  btn)

Open the save file dialog.

References CONTEXT_MAIN_IMAGE, and Save_picture().

◆ Button_Autosave()

◆ Button_Lines()

void Button_Lines ( int  btn)

Callback for the lines button left click.

Selects lines drawing mode, depending on the current state of the lines button.

References Display_cursor(), Hide_cursor, Selected_line_mode, and Start_operation_stack().

◆ Button_Lines_switch_mode()

void Button_Lines_switch_mode ( int  btn)

◆ Button_Brush()

void Button_Brush ( int  btn)

Callback for the brush button left click.

Start the brush picking operation.

References Current_operation, Display_cursor(), Hide_cursor, OPERATION_GRAB_BRUSH, Start_operation_stack(), and Unselect_button().

◆ Button_Unselect_brush()

void Button_Unselect_brush ( int  btn)

Disables the custom brush and set back a regular one.

References Operation_before_interrupt, and Start_operation_stack().

◆ Button_Restore_brush()

void Button_Restore_brush ( int  btn)

Callback for the brush button right click.

Activates the last captured custom brush.

References Change_paintbrush_shape(), Display_cursor(), Hide_cursor, PAINTBRUSH_SHAPE_COLOR_BRUSH, and Unselect_button().

◆ Button_Lasso()

void Button_Lasso ( int  btn)

Callback for the freehand brush pick button left click.

Starts freehand brush picking operation.

References Current_operation, Display_cursor(), Hide_cursor, OPERATION_POLYBRUSH, Paintbrush_shape, Paintbrush_shape_before_lasso, PAINTBRUSH_SHAPE_POINT, Start_operation_stack(), and Unselect_button().

◆ Button_Unselect_lasso()

void Button_Unselect_lasso ( int  btn)

Disables the custom freehand brush and set back a regular one.

References Current_operation, Operation_before_interrupt, OPERATION_POLYBRUSH, Paintbrush_shape, Paintbrush_shape_before_lasso, and Start_operation_stack().

◆ Button_Colorpicker()

◆ Button_Unselect_colorpicker()

◆ Button_Invert_foreback()

void Button_Invert_foreback ( int  btn)

◆ Button_Magnify()

◆ Button_Magnify_menu()

◆ Button_Unselect_magnifier()

◆ Button_Brush_FX()

◆ Button_Curves()

void Button_Curves ( int  btn)

Callback for the curves button left click.

Start curve operation according to the selected mode.

References Display_cursor(), Hide_cursor, Selected_curve_mode, and Start_operation_stack().

◆ Button_Curves_switch_mode()

void Button_Curves_switch_mode ( int  btn)

◆ Button_Airbrush()

void Button_Airbrush ( int  btn)

Callback for the spray button left click.

Start the spray operation.

References Display_cursor(), Hide_cursor, OPERATION_AIRBRUSH, and Start_operation_stack().

◆ Refresh_airbrush_settings()

void Refresh_airbrush_settings ( byte  selected_color,
byte  update_slider 
)

◆ Button_Airbrush_menu()

◆ Button_polygon()

void Button_polygon ( int  btn)

Callback for the polyline button left click.

Starts drawing a polygon.

References Display_cursor(), Hide_cursor, OPERATION_POLYGON, and Start_operation_stack().

◆ Button_Polyform()

void Button_Polyform ( int  btn)

Callback for the polyline right click.

Starts drawing a polyform.

References Display_cursor(), Hide_cursor, OPERATION_POLYFORM, and Start_operation_stack().

◆ Button_Polyfill()

void Button_Polyfill ( int  btn)

Callback for the polyfill button left click.

Starts drawing a filled polygon.

References Display_cursor(), Hide_cursor, OPERATION_POLYFILL, and Start_operation_stack().

◆ Button_Filled_polyform()

void Button_Filled_polyform ( int  btn)

Callback for the polyfill button right click.

Starts drawing a filled polyform.

References Display_cursor(), Hide_cursor, OPERATION_FILLED_POLYFORM, and Start_operation_stack().

◆ Button_Adjust()

void Button_Adjust ( int  btn)

Callback for the adjust picture button.

Start the adjust picture operation.

References Display_cursor(), Hide_cursor, OPERATION_SCROLL, and Start_operation_stack().

◆ Display_effect_sprite()

void Display_effect_sprite ( int  sprite_number,
short  start_x,
short  start_y 
)

◆ Display_effect_state()

void Display_effect_state ( short  x,
short  y,
char *  label,
byte  state 
)

◆ Display_effect_states()

◆ Display_feedback_state()

void Display_feedback_state ( void  )

◆ Button_Effects()

void Button_Effects ( int  btn)

Callback for the effects button click.

Displays the effect selection menu.

References Any_effect_active(), T_Document::backups, Button_Colorize_menu(), Button_Colorize_mode(), Button_Constraint_menu(), Button_Constraint_mode(), BUTTON_EFFECTS, Button_Grid_menu(), BUTTON_HELP, Button_Mask_menu(), Button_Mask_mode(), Button_Quick_shade_menu(), Button_Quick_shade_mode(), Button_Shade_menu(), Button_Shade_mode(), Button_Sieve_menu(), Button_Sieve_mode(), Button_Smear_mode(), Button_Smooth_menu(), Button_Smooth_mode(), Button_Snap_mode(), Button_Stencil_menu(), Button_Stencil_mode(), Button_Tilemap_menu(), Button_Tilemap_mode(), Button_Tiling_menu(), Button_Tiling_mode(), C1, C2, C3, Close_window(), Config, Config_Key, Display_cursor(), Display_effect_sprite(), Display_effect_state(), Display_effect_states(), Display_feedback_state(), Effects_off(), EFFECTS_SPRITE_8BIT, EFFECTS_SPRITE_GRID, EFFECTS_SPRITE_MASK, EFFECTS_SPRITE_SHADE, EFFECTS_SPRITE_SIEVE, EFFECTS_SPRITE_SMEAR, EFFECTS_SPRITE_SMOOTH, EFFECTS_SPRITE_STENCIL, EFFECTS_SPRITE_TILING, EFFECTS_SPRITE_TRANSP, T_Config::FX_Feedback, Hide_cursor, T_Page::Image_mode, IMAGE_MODE_ANIMATION, Input_sticky_control, Is_shortcut(), Key, KEY_DELETE, KEY_ESC, KEY_f, KEY_RETURN, L1, L2, L3, L4, L5, LEFT_SIDE, Main, Mask_mode, MC_Black, MC_Dark, MC_Light, NULL, Open_window(), T_List_of_pages::Pages, Print_in_window(), Print_in_window_underscore(), Quit_is_required, Selected_Constraint_Mode, Show_grid, Sieve_mode, Snap_mode, SPECIAL_COLORIZE_MODE, SPECIAL_FORMAT_CHECKER_MENU, SPECIAL_GRID_MODE, SPECIAL_MASK_MODE, SPECIAL_QUICK_SHADE_MODE, SPECIAL_SHADE_MODE, SPECIAL_SHOW_GRID, SPECIAL_SIEVE_MODE, SPECIAL_SMEAR_MODE, SPECIAL_SMOOTH_MODE, SPECIAL_STENCIL_MODE, SPECIAL_TILEMAP_MODE, SPECIAL_TILING_MODE, Stencil_mode, T_Document::tilemap_mode, Unselect_button(), Update_FX_feedback(), Update_window_area, Window_attribute1, Window_clicked_button(), Window_display_frame_mono(), Window_get_clicked_button(), Window_height, Window_help(), Window_rectangle(), Window_set_normal_button(), and Window_width.

◆ Draw_one_font_name()

void Draw_one_font_name ( word  x,
word  y,
word  index,
byte  highlighted 
)

◆ Button_Text()

void Button_Text ( int  btn)

Callback for the text button.

Opens the text setup window.

References T_Config::Auto_discontinuous, Back_color, Best_color_perceptual_except(), Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_palette, Brush_width, BUTTON_DRAW, BUTTON_EFFECTS, BUTTON_HELP, BUTTON_PRESSED, BUTTON_TEXT, Change_paintbrush_shape(), Close_window(), Colorize_current_mode, Colorize_mode, Config, Current_operation, T_List_button::Cursor_position, Display_brush, Display_cursor(), Draw_menu_button(), Draw_one_font_name(), Effect_alpha_colorize(), Effect_function, Error, Font_count(), Fore_color, T_Special_button::Height, Hide_cursor, INPUT_TYPE_INTEGER, INPUT_TYPE_STRING, Is_shortcut(), Key, KEY_a, KEY_b, KEY_ESC, KEY_i, KEY_NONE, KEY_RETURN, KEY_s, KEY_t, LEFT_SIDE, T_List_button::List_start, MC_Black, MC_Dark, MC_Light, Menu_factor_X, Menu_factor_Y, Min(), NULL, Num2str, Open_window(), OPERATION_DISCONTINUOUS_DRAW, PAINTBRUSH_SHAPE_COLOR_BRUSH, PAINTBRUSH_SHAPE_MONO_BRUSH, T_Special_button::Pos_X, T_Special_button::Pos_Y, Print_in_window(), Print_in_window_underscore(), Quick_shade_mode, Quit_is_required, Readline(), Readline_ex(), Realloc_brush(), Remap_brush(), Remap_general_lowlevel(), Render_text(), RIGHT_SIDE, Select_button(), Shade_mode, Smear_mode, Smooth_mode, Tiling_mode, TrueType_font(), Unselect_button(), Update_window_area, T_Special_button::Width, Window_attribute2, Window_clicked_button(), Window_display_frame_in(), Window_height, Window_help(), Window_input_content(), Window_pos_X, Window_pos_Y, Window_rectangle(), Window_redraw_list(), Window_set_input_button_s(), Window_set_list_button(), Window_set_normal_button(), Window_set_repeatable_button(), Window_set_scroller_button(), Window_set_special_button(), and Window_width.

◆ Display_stored_brush_in_window()

◆ Store_brush()

◆ Select_paintbrush()

◆ Store_paintbrush()

◆ Restore_brush()

◆ Button_Brush_container()

◆ Any_effect_active()

Variable Documentation

◆ Program_version

char Program_version[]
extern

Referenced by Button_Message_initial().

◆ Old_MX

short Old_MX
extern

◆ Old_MY

short Old_MY
extern

◆ Lookup_YesNo

const T_Lookup Lookup_YesNo[]
Initial value:
= {
{"NO",0},
{"YES",1},
{NULL,-1},
}
#define NULL
Definition: 6502types.h:18

Referenced by Button_Settings().

◆ Lookup_FFF

const T_Lookup Lookup_FFF[]
Initial value:
= {
{"All",0},
{"Files",1},
{"Dirs.",2},
{NULL,-1},
}

Referenced by Button_Settings().

◆ Lookup_AutoRes

const T_Lookup Lookup_AutoRes[]
Initial value:
= {
{"Internal",1},
{"Real",2},
{NULL,-1},
}

Referenced by Button_Settings().

◆ Lookup_Coords

const T_Lookup Lookup_Coords[]
Initial value:
= {
{"Absolute",0},
{"Relative",1},
{NULL,-1},
}

Referenced by Button_Settings().

◆ Lookup_MenuRatio

const T_Lookup Lookup_MenuRatio[]
Initial value:
= {
{"None",0},
{"x2",254},
{"x3",253},
{"x4",252},
{"Moderate",2},
{"Maximum",1},
{NULL,-1},
}

Referenced by Button_Settings().

◆ Lookup_MouseSpeed

const T_Lookup Lookup_MouseSpeed[]
Initial value:
= {
{"Normal",1},
{"/2",2},
{"/3",3},
{"/4",4},
{NULL,-1},
}

◆ Lookup_SwapButtons

const T_Lookup Lookup_SwapButtons[]
Initial value:
= {
{"None",0},
{"Control",GFX2_MOD_CTRL},
{"Alt",GFX2_MOD_ALT},
{NULL,-1},
}
#define GFX2_MOD_ALT
Key modifier for ALT key. Used as mask in Key, for example.
Definition: global.h:109
#define GFX2_MOD_CTRL
Key modifier for CONTROL key. Used as mask in Key, for example.
Definition: global.h:107

Referenced by Button_Settings().

◆ Lookup_VirtualKeyboard

const T_Lookup Lookup_VirtualKeyboard[]
Initial value:
= {
{"Auto",0},
{"ON",1},
{"OFF",2},
{NULL,-1},
}

Referenced by Button_Settings().

◆ Skin_files_list

◆ Font_files_list

T_Fileselector Font_files_list

Referenced by Add_font_or_skin(), and Button_Skins().

◆ Coming_from_zoom_factor_menu

byte Coming_from_zoom_factor_menu =0