📄 init.cc
字号:
//**************************************************************//* filename: init.cc *//* *//**************************************************************//* programmed by: Thomas Wagner *//* last change: 27-02-95 *//**************************************************************#include <stdio.h>#include <stdlib.h>#include "init.h"#include "cursors/maincursor1.bmp"#include "cursors/maincursor2.bmp"#include "cursors/rotcursor1.bmp"#include "cursors/rotcursor2.bmp"#include "cursors/deletecursor1.bmp"#include "cursors/deletecursor2.bmp"#include "cursors/movepointcursor1.bmp"#include "cursors/movepointcursor2.bmp"#include "cursors/createpointcursor1.bmp"#include "cursors/createpointcursor2.bmp"#include "cursors/moveaxes1.bmp"#include "cursors/moveaxes2.bmp"#include "cursors/diskcursor1.bmp"#include "cursors/diskcursor2.bmp"#include "cursors/movecursor1.bmp"#include "cursors/movecursor2.bmp"#include "cursors/wait1.bmp"#include "cursors/wait2.bmp"#include "cursors/delete1.bmp"#include "cursors/delete2.bmp"#include "cursors/createend1.bmp"#include "cursors/createend2.bmp"#include "cursors/createstart1.bmp"#include "cursors/createstart2.bmp"#include "cursors/moveend1.bmp"#include "cursors/moveend2.bmp"#include "cursors/movestart1.bmp"#include "cursors/movestart2.bmp"#if 1Cursor movestartcursor, moveendcursor, movecursor, moveaxescursor, movepointcursor, createpointcursor, rotatecursor, createstartcursor, createendcursor, delconnectcursor, maincursor, waitcursor, deleteiconcursor, diskcursor;unsigned long buttonpix, lightpix, shadowpix, redbuttonpix, bluelightpix, blueshadowpix, bluebuttonpix, redlightpix, redshadowpix, greenbuttonpix, greenlightpix, greenshadowpix, yellowbuttonpix, yellowlightpix, yellowshadowpix, blackpix, whitepix, selectpix, redpix, indexcolor[INDEXCOLORNUMBER];#endifColormap colormap;Visual *visual;void initcolors (Display * display){ char *bgcolor = "white", *fgcolor = "black"; int screen = DefaultScreen (display);//short depth=DefaultDepth(display,screen); XColor color;// Now select the colors using the default colormap Colormap default_cmap = DefaultColormap (display, screen);/* { XVisualInfo vis_info; if(XMatchVisualInfo(display,screen,depth,PseudoColor,&vis_info)) { printf("ok\n"); visual=vis_info.visual; } colormap=XCreateColormap(display, RootWindow(display,screen), visual,//DefaultVisual(display,screen), AllocAll); XColor *colors; int i,colormap_size=DisplayCells(display,screen); for(i=0;i<colormap_size;i++) { colors[i].pixel=i; colors[i].flags=DoRed|DoGreen|DoBlue; } XQueryColors(display, DefaultColormap(display, screen), colors, colormap_size); default_cmap=colormap; color.red=65535; color.green=65535; color.blue=65535; color.flags=DoRed|DoGreen|DoBlue; color.pixel=0; XStoreColor(display,default_cmap, &color); color.red=48705; color.green=56865; color.blue=48705; color.pixel=3; XStoreColor(display,default_cmap, &color); color.red=65025; color.green=55025; color.blue=21930; color.pixel=4; XStoreColor(display,default_cmap, &color); } */// background color if (XParseColor (display, default_cmap, bgcolor, &color) == 0 || XAllocColor (display, default_cmap, &color) == 0) whitepix = WhitePixel (display, DefaultScreen (display)); else whitepix = color.pixel;// foreground color if (XParseColor (display, default_cmap, fgcolor, &color) == 0 || XAllocColor (display, default_cmap, &color) == 0) blackpix = BlackPixel (display, DefaultScreen (display)); else blackpix = color.pixel; color.red = 50283; color.green = 50283; color.blue = 56283; color.flags = DoRed | DoGreen | DoBlue; if (XAllocColor (display, default_cmap, &color) == 0) buttonpix = whitepix; else buttonpix = color.pixel; color.red = 19041; color.green = 33410; color.blue = 37522; if (XAllocColor (display, default_cmap, &color) == 0) shadowpix = blackpix; else shadowpix = color.pixel; color.red = 60535; color.green = 60535; color.blue = 65535; if (XAllocColor (display, default_cmap, &color) == 0) lightpix = whitepix; else lightpix = color.pixel; color.red = 61000; //58650; color.green = 40000; //37995; color.blue = 40000; //37995; if (XAllocColor (display, default_cmap, &color) == 0) redbuttonpix = buttonpix; else redbuttonpix = color.pixel; color.red = 50490; color.green = 28305; color.blue = 28305; if (XAllocColor (display, default_cmap, &color) == 0) redshadowpix = shadowpix; else redshadowpix = color.pixel; color.red = 58395; color.green = 47940; color.blue = 47940; if (XAllocColor (display, default_cmap, &color) == 0) redlightpix = lightpix; else redlightpix = color.pixel; color.red = 42000; color.green = 52000; color.blue = 42000; if (XAllocColor (display, default_cmap, &color) == 0) greenbuttonpix = buttonpix; else greenbuttonpix = color.pixel; color.red = 14535; color.green = 39270; color.blue = 14535; if (XAllocColor (display, default_cmap, &color) == 0) greenshadowpix = shadowpix; else greenshadowpix = color.pixel; color.red = 48705; color.green = 56865; color.blue = 48705; if (XAllocColor (display, default_cmap, &color) == 0) greenlightpix = lightpix; else greenlightpix = color.pixel; color.red = 65025; color.green = 55025; color.blue = 21930; if (XAllocColor (display, default_cmap, &color) == 0) yellowbuttonpix = buttonpix; else yellowbuttonpix = color.pixel; color.red = 65025; color.green = 48707; color.blue = 17859; color.red = 55025; color.green = 43707; color.blue = 12859; if (XAllocColor (display, default_cmap, &color) == 0) yellowshadowpix = shadowpix; else yellowshadowpix = color.pixel; color.red = 60025; color.green = 60025; color.blue = 51000; if (XAllocColor (display, default_cmap, &color) == 0) yellowlightpix = lightpix; else yellowlightpix = color.pixel; color.red = 50025; color.green = 50025; color.blue = 65025; if (XAllocColor (display, default_cmap, &color) == 0) bluebuttonpix = buttonpix; else bluebuttonpix = color.pixel; color.blue = 55025; color.green = 43707; color.red = 12859; if (XAllocColor (display, default_cmap, &color) == 0) blueshadowpix = shadowpix; else blueshadowpix = color.pixel; color.blue = 65025; color.green = 60025; color.red = 51930; if (XAllocColor (display, default_cmap, &color) == 0) bluelightpix = lightpix; else bluelightpix = color.pixel; color.red = 30535; color.green = 30535; color.blue = 65535; if (XAllocColor (display, default_cmap, &color) == 0) selectpix = shadowpix; else selectpix = color.pixel; color.red = 65535; color.green = 0; color.blue = 0; if (XAllocColor (display, default_cmap, &color) == 0) redpix = lightpix; else redpix = color.pixel; char counter; unsigned short redvalue[INDEXCOLORNUMBER] = {65535, 0, 0, 44000, 0, 0, 22000, 0, 0, 0, 0, 0}, greenvalue[INDEXCOLORNUMBER] = {0, 65535, 0, 0, 44000, 0, 0, 22000, 0, 0, 0, 0}, bluevalue[INDEXCOLORNUMBER] = {0, 0, 65535, 0, 0, 44000, 0, 0, 22000, 0, 0, 0}; for (counter = 0; counter < INDEXCOLORNUMBER; counter++) { color.red = redvalue[counter]; color.green = greenvalue[counter]; color.blue = bluevalue[counter]; if (XAllocColor (display, default_cmap, &color) == 0) indexcolor[counter] = BlackPixel (display, DefaultScreen (display)); else indexcolor[counter] = color.pixel; }}void initcursors (Display * display){ Pixmap fgpixmap, bgpixmap; XColor color1, color2; color1.red = 65535; color1.green = 0; color1.blue = 0; color2.red = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -