GrafX2 2.9.3227
The ultimate 256-color painting program
|
#include <windows.h>
#include <windowsx.h>
#include <malloc.h>
#include <stdio.h>
#include "gfx2mem.h"
#include "gfx2log.h"
#include "screen.h"
#include "errors.h"
#include "input.h"
#include "keyboard.h"
#include "unicode.h"
Functions | |
int | Handle_special_key_press (void) |
check Keys that emulate mouse moves, etc. More... | |
int | Release_control (int key_code, int modifier) |
void * | GFX2_Get_Window_Handle () |
static void | Win32_Repaint (HWND hwnd) |
Blit our "framebuffer" bitmap to the Window. More... | |
static LRESULT CALLBACK | Win32_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
WindowProc callback function. More... | |
int | Init_Win32 (HINSTANCE hInstance, HINSTANCE hPrevInstance) |
static int | Video_AllocateDib (int width, int height) |
static void | Win32_CreateWindow (int width, int height, int fullscreen) |
void | GFX2_Set_mode (int *width, int *height, int fullscreen) |
Sets the new screen/window dimensions. More... | |
byte | Get_Screen_pixel (int x, int y) |
void | Set_Screen_pixel (int x, int y, byte value) |
byte * | Get_Screen_pixel_ptr (int x, int y) |
void | Screen_FillRect (int x, int y, int w, int h, byte color) |
void | Update_rect (short x, short y, unsigned short width, unsigned short height) |
void | Flush_update (void) |
void | Update_status_line (short char_pos, short width) |
int | GFX2_SetPalette (const T_Components *colors, int firstcolor, int ncolors) |
void | Clear_border (byte color) |
Clears the parts of screen that are outside of the editing area. More... | |
void | Allow_drag_and_drop (int flag) |
Activates or desactivates file drag-dropping in program window. More... | |
void | Define_icon (void) |
Set application icon(s) More... | |
void | Set_mouse_position (void) |
set (system) mouse cursor position More... | |
int | GFX2_GetScreenSize (int *width, int *height) |
Get Screen dimensions. More... | |
int | GFX2_MessageBox (const char *text, const char *caption, unsigned int type) |
Display a modal message. More... | |
Variables | |
int | user_feedback_required |
word | Input_new_mouse_X |
word | Input_new_mouse_Y |
byte | Input_new_mouse_K |
static HBITMAP | Windows_DIB = NULL |
static void * | Windows_Screen = NULL |
static int | Windows_DIB_width = 0 |
static int | Windows_DIB_height = 0 |
static HWND | Win32_hwnd = NULL |
static int | Win32_Is_Fullscreen = 0 |
volatile int | Allow_colorcycling = 0 |
int Handle_special_key_press | ( | void | ) |
check Keys that emulate mouse moves, etc.
References D_JOYSTICK_DOWN, D_JOYSTICK_LEFT, D_JOYSTICK_RIGHT, D_JOYSTICK_UP, Directional_click, Directional_emulated, Handle_mouse_btn_change(), Input_new_mouse_K, Is_shortcut(), Key, Keyboard_click_allowed, Pan_shortcut_pressed, SPECIAL_CLICK_LEFT, SPECIAL_CLICK_RIGHT, SPECIAL_HOLD_PAN, SPECIAL_MOUSE_DOWN, SPECIAL_MOUSE_LEFT, SPECIAL_MOUSE_RIGHT, and SPECIAL_MOUSE_UP.
Referenced by Get_input(), and Win32_WindowProc().
int Release_control | ( | int | key_code, |
int | modifier | ||
) |
References Button_inverter, Config, Config_Key, Directional_click, Directional_emulated, GFX2_MOD_SHIFT, Handle_mouse_btn_change(), Input_new_mouse_K, Pan_shortcut_pressed, Snap_axis, SPECIAL_CLICK_LEFT, SPECIAL_CLICK_RIGHT, SPECIAL_HOLD_PAN, SPECIAL_MOUSE_DOWN, SPECIAL_MOUSE_LEFT, SPECIAL_MOUSE_RIGHT, SPECIAL_MOUSE_UP, and T_Config::Swap_buttons.
Referenced by Get_input(), and Win32_WindowProc().
void * GFX2_Get_Window_Handle | ( | ) |
References Win32_hwnd.
Referenced by Allow_drag_and_drop(), Define_icon(), GFX2_GetTextClipboard(), GFX2_MessageBox(), Init_program(), Load_ClipBoard_Image(), Program_shutdown(), and Save_ClipBoard_Image().
|
static |
Blit our "framebuffer" bitmap to the Window.
References FALSE, GFX2_INFO, GFX2_Log(), and Windows_DIB.
Referenced by Win32_WindowProc().
|
static |
WindowProc callback function.
References Config, Drop_file_name, Drop_file_name_unicode, FALSE, Get_Key_modifiers(), GFX2_DEBUG, GFX2_ERROR, GFX2_INFO, GFX2_Log(), GFX2_malloc, GFX2_MOD_ALT, GFX2_MOD_CTRL, GFX2_MOD_META, GFX2_MOD_SHIFT, GFX2_WARNING, GFX2_WINDOW_MAXIMIZED, GFX2_WINDOW_MINIMIZED, GFX2_WINDOW_STANDARD, Handle_mouse_btn_change(), Handle_special_key_press(), Input_new_mouse_K, Key, Key_ANSI, KEY_MOUSEMIDDLE, KEY_MOUSEWHEELDOWN, KEY_MOUSEWHEELLEFT, KEY_MOUSEWHEELRIGHT, KEY_MOUSEWHEELUP, Key_UNICODE, Move_cursor_with_constraints(), NULL, Pixel_height, Pixel_width, Quit_is_required, Release_control(), Resize_height, Resize_width, TRUE, user_feedback_required, Win32_Is_Fullscreen, Win32_Repaint(), T_Config::Window_pos_x, T_Config::Window_pos_y, and Window_state.
Referenced by Init_Win32().
int Init_Win32 | ( | HINSTANCE | hInstance, |
HINSTANCE | hPrevInstance | ||
) |
References Error, ERROR_INIT, GFX2_Log(), GFX2_WARNING, NULL, and Win32_WindowProc().
Referenced by main().
|
static |
References GFX2_Log(), GFX2_WARNING, NULL, Windows_DIB, Windows_DIB_height, Windows_DIB_width, and Windows_Screen.
Referenced by GFX2_Set_mode().
|
static |
References Config, Error, ERROR_INIT, FALSE, NULL, Win32_hwnd, T_Config::Window_pos_x, and T_Config::Window_pos_y.
Referenced by GFX2_Set_mode().
void GFX2_Set_mode | ( | int * | width, |
int * | height, | ||
int | fullscreen | ||
) |
Sets the new screen/window dimensions.
References Config, FALSE, NULL, Video_AllocateDib(), Win32_CreateWindow(), Win32_hwnd, Win32_Is_Fullscreen, T_Config::Window_pos_x, and T_Config::Window_pos_y.
byte Get_Screen_pixel | ( | int | x, |
int | y | ||
) |
References NULL, Windows_DIB_width, and Windows_Screen.
void Set_Screen_pixel | ( | int | x, |
int | y, | ||
byte | value | ||
) |
References NULL, Windows_DIB_width, and Windows_Screen.
byte * Get_Screen_pixel_ptr | ( | int | x, |
int | y | ||
) |
References NULL, Windows_DIB_width, and Windows_Screen.
Referenced by Screen_FillRect().
void Screen_FillRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
byte | color | ||
) |
References Get_Screen_pixel_ptr(), Windows_DIB_height, and Windows_DIB_width.
void Update_rect | ( | short | x, |
short | y, | ||
unsigned short | width, | ||
unsigned short | height | ||
) |
References FALSE, NULL, Pixel_height, Pixel_width, and Win32_hwnd.
Referenced by Update_status_line().
void Flush_update | ( | void | ) |
void Update_status_line | ( | short | char_pos, |
short | width | ||
) |
References Menu_factor_X, Menu_factor_Y, Menu_status_Y, and Update_rect().
int GFX2_SetPalette | ( | const T_Components * | colors, |
int | firstcolor, | ||
int | ncolors | ||
) |
References T_Components::B, FALSE, T_Components::G, NULL, T_Components::R, Win32_hwnd, and Windows_DIB.
void Clear_border | ( | byte | color | ) |
Clears the parts of screen that are outside of the editing area.
There is such area only if the screen mode is not a multiple of the pixel size, eg: 3x3 pixels in 1024x768 leaves 1 column on the right, 0 rows on bottom.
void Allow_drag_and_drop | ( | int | flag | ) |
Activates or desactivates file drag-dropping in program window.
References FALSE, GFX2_Get_Window_Handle(), and TRUE.
void Define_icon | ( | void | ) |
Set application icon(s)
void Set_mouse_position | ( | void | ) |
set (system) mouse cursor position
References GFX2_Log(), GFX2_WARNING, Mouse_X, Mouse_Y, Pixel_height, Pixel_width, and Win32_hwnd.
int GFX2_GetScreenSize | ( | int * | width, |
int * | height | ||
) |
int GFX2_MessageBox | ( | const char * | text, |
const char * | caption, | ||
unsigned int | type | ||
) |
Display a modal message.
text | body of the modal message |
caption | title of the message |
type | one of GFX2_MB_INFO, GFX2_MB_ERROR, GFX2_MB_WARNING |
References GFX2_Get_Window_Handle().
|
extern |
Referenced by Get_input(), and Win32_WindowProc().
|
extern |
Referenced by Cursor_displace(), Get_input(), and Move_cursor_with_constraints().
|
extern |
Referenced by Cursor_displace(), Get_input(), and Move_cursor_with_constraints().
|
extern |
Referenced by Get_input(), Handle_mouse_btn_change(), Handle_special_key_press(), Release_control(), and Win32_WindowProc().
|
static |
Referenced by GFX2_SetPalette(), Video_AllocateDib(), and Win32_Repaint().
|
static |
Referenced by Get_Screen_pixel(), Get_Screen_pixel_ptr(), Set_Screen_pixel(), and Video_AllocateDib().
|
static |
Referenced by Get_Screen_pixel(), Get_Screen_pixel_ptr(), Screen_FillRect(), Set_Screen_pixel(), and Video_AllocateDib().
|
static |
Referenced by Screen_FillRect(), and Video_AllocateDib().
|
static |
Referenced by GFX2_Get_Window_Handle(), GFX2_Set_mode(), GFX2_SetPalette(), Set_mouse_position(), Update_rect(), and Win32_CreateWindow().
|
static |
Referenced by GFX2_Set_mode(), and Win32_WindowProc().
volatile int Allow_colorcycling = 0 |