1010 reset_win32_state ();
1018 char *display_name = NULL;
1020 unsigned int border_width = 2;
1021 XTextProperty windowName;
1024 const char *cnames[
NUM_COLOR] = {
"white",
"black",
"grey55",
"grey75",
"blue",
1025 "green",
"yellow",
"cyan",
"red",
"RGBi:0.0/0.5/0.0",
"magenta",
1026 "bisque",
"lightblue",
"thistle",
"plum",
"khaki",
"coral",
1027 "turquoise",
"mediumpurple",
"darkslateblue",
"darkkhaki" };
1031 unsigned long valuemask = 0;
1036 if ( (
display=XOpenDisplay(display_name)) == NULL )
1038 fprintf( stderr,
"Cannot connect to X server %s\n",
1039 XDisplayName(display_name));
1058 if (!XParseColor(
display,cmap,cnames[i],&exact_def)) {
1059 fprintf(stderr,
"Color name %s not in database", cnames[i]);
1062 if (!XAllocColor(
display, cmap, &exact_def)) {
1063 fprintf(stderr,
"Couldn't allocate color %s.\n",cnames[i]);
1066 fprintf(stderr,
"Will try to allocate a private colourmap.\n");
1067 fprintf(stderr,
"Colours will only display correctly when your "
1068 "cursor is in the graphics window.\n"
1069 "Exit other colour applications and rerun this "
1070 "program if you don't like that.\n\n");
1074 if (!XAllocColor (
display, cmap, &exact_def)) {
1075 fprintf (stderr,
"Couldn't allocate color %s as private.\n",
1082 fprintf (stderr,
"Couldn't allocate color %s as private.\n",
1087 colors[i] = exact_def.pixel;
1098 ButtonPressMask | PointerMotionMask | KeyPressMask);
1105 values.function = GXxor;
1106 values.foreground =
colors[cindex];
1124 strncpy (window_name_copy, window_name,
BUFSIZE);
1125 XStringListToTextProperty(&window_name_copy, 1, &windowName);
1126 free (window_name_copy);
1127 window_name_copy = NULL;
1135 free (windowName.value);
1151 HINSTANCE hInstance = GetModuleHandle(NULL);
1154 lb.lbStyle = BS_SOLID;
1156 lb.lbHatch = (LONG)NULL;
1171 wsprintf(szAppName, TEXT(window_name));
1174 hGraphicsPen = ExtCreatePen(PS_GEOMETRIC | win32_line_styles[
currentlinestyle] |
1175 PS_ENDCAP_FLAT, 1, &lb, (LONG)NULL, NULL);
1178 hGraphicsBrush = CreateSolidBrush(win32_colors[
DARKGREY]);
1181 hGrayBrush = CreateSolidBrush(win32_colors[
LIGHTGREY]);
1191 wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
1192 wndclass.lpfnWndProc = MainWND;
1193 wndclass.cbClsExtra = 0;
1194 wndclass.cbWndExtra = 0;
1195 wndclass.hInstance = hInstance;
1196 wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
1197 wndclass.hCursor = LoadCursor( NULL, IDC_ARROW);
1198 wndclass.hbrBackground = (HBRUSH) CreateSolidBrush(win32_colors[cindex]);
1199 wndclass.lpszMenuName = NULL;
1200 wndclass.lpszClassName = szAppName;
1202 if (!RegisterClass(&wndclass)) {
1203 printf (
"Error code: %d\n", GetLastError());
1204 MessageBox(NULL, TEXT(
"Initialization of Windows graphics (init_graphics) failed."),
1205 szAppName, MB_ICONERROR);
1210 wndclass.lpfnWndProc = GraphicsWND;
1211 wndclass.hIcon = NULL;
1212 wndclass.lpszClassName = szGraphicsName;
1214 if(!RegisterClass(&wndclass))
1218 wndclass.lpfnWndProc = StatusWND;
1219 wndclass.hIcon = NULL;
1220 wndclass.lpszClassName = szStatusName;
1221 wndclass.hbrBackground = hGrayBrush;
1223 if(!RegisterClass(&wndclass))
1227 wndclass.lpfnWndProc = ButtonsWND;
1228 wndclass.hIcon = NULL;
1229 wndclass.lpszClassName = szButtonsName;
1230 wndclass.hbrBackground = hGrayBrush;
1232 if (!RegisterClass(&wndclass))
1235 hMainWnd = CreateWindow(szAppName, TEXT(window_name),
1237 NULL, NULL, hInstance, NULL);
1245 if (ShowWindow(hMainWnd, SW_SHOWNORMAL))
1248 if (!UpdateWindow(hMainWnd))
1250 win32_drain_message_queue ();
static t_gl_state gl_state
static Bool test_if_exposed(Display *disp, XEvent *event_ptr, XPointer dummy)
static XFontStruct * font_info[MAX_FONT_SIZE+1]
static void reset_common_state()
static const int menu_font_size
static int display_height
static void force_setcolor(int cindex)
static int currentlinewidth
static void load_font(int pointsize)
static int currentfontsize
static void force_setfontsize(int pointsize)
static Colormap private_cmap
static void * my_malloc(int ibytes)
static void force_setlinewidth(int linewidth)
static void build_textarea(void)
static int currentlinestyle
static void force_setlinestyle(int linestyle)
static int colors[NUM_COLOR]
static void build_default_menu(void)