Exemplo n.º 1
0
app_config::app_config(portaudio::System &system) :
    store(new private_configs()),
    globals(new misc_globals(system))
{
    store->colors = default_colors();
    init_action_maps();
    store->global_keymap = default_global_keymap();
    store->pattern_keymap = default_pattern_keymap();
}
  void draw ()
  {
    XSetForeground (display, gc, gray_pixel);
    XFillRectangle (display, win, gc, 0, 0, width, height);

    for (widg *w = widgs; w; w = w->next) {
      default_colors ();
      w->draw ();
    }
  }
Exemplo n.º 3
0
static void setcolor_button_pressed(Widget widget, XtPointer client_data, 
				  XtPointer call_data)
{
  Widget parent;
  Widget change_widget;
  XColor color;
  ColorDataPtr colordata;
  Arg arg[1];

  change_widget = XtNameToWidget(fetched,"color_change_BB.color_change");
  parent = XtParent(XtParent(change_widget));

  XtSetArg(arg[0],XmNuserData,&colordata);
  XtGetValues(parent,arg,1);

  /* store rgb values from foreground into appropriate field */
  color.red = colordata->color.red;
  color.green = colordata->color.green;
  color.blue = colordata->color.blue;
  color.flags = colordata->color.flags;

  if(toggle_flag == 'F'){
    XtSetArg(arg[0],XmNforeground,&(color.pixel));
    XtGetValues(change_widget,arg,1);
  }
  else if(toggle_flag == 'B'){
    XtSetArg(arg[0],XmNbackground,&(color.pixel));
    XtGetValues(change_widget,arg,1);
    XtSetArg(arg[0], XmNbackground, color.pixel);
    XtSetValues(XtParent(change_widget), arg, 1);
  }
  else if(toggle_flag == 'X'){
    XtSetArg(arg[0],XmNbottomShadowColor,&(color.pixel));
    XtGetValues(change_widget,arg,1);
  }
  else if(toggle_flag == 'T'){
    XtSetArg(arg[0],XmNtopShadowColor,&(color.pixel));
    XtGetValues(change_widget,arg,1);
  }
  else if(toggle_flag == 'A'){
    XtSetArg(arg[0],XmNarmColor,&(color.pixel));
    XtGetValues(change_widget,arg,1);
  }
  else if(toggle_flag == 'D'){
    default_colors();
    return;
  }
  else return;

  XStoreColor(dpy,cmap,&color);
}
Exemplo n.º 4
0
int main(int argc, char *argv[])
{
	/* function declarations */
	void string(char *str);
	void default_colors(struct colors *c);
	void c2html(const char *filename, char *err, struct colors *c);

	/* varaible declarations */
	char filename[STR_MAX];
	char err[STR_MAX+256];
	err[0] = filename[0] = '\0';
	struct colors c;
	default_colors(&c);

	/* user interface */
	puts("===========================================");
	puts(" << SOURCE CODE TEXT TO HTML TRANSLATOR >> ");
	puts("===========================================");
	puts("  This program converts C source code text "); 
	puts("  file to an HTML page with line numbers.  ");
	puts("  This program was written by Arjun Menon. ");
	puts("-------------------------------------------");
	puts("  To modify the default color settings,    ");
	puts("  precede the filename with : colon symbol ");
	puts("  for monochrome, or ? for user-defined.   ");
	puts("===========================================");

	if(argc<=1)  /* the are no arguments */
	{
		puts("Please enter the name of the file to translate...");
		printf("\nFilename: ");
		fgets(filename,STR_MAX,stdin);
		string(filename);
	}
	else  /* there are arguments */
	{ /* only the first argument is read */
		strcpy(filename,argv[1]);
		printf("\nFilenaeme: %s\n",filename);
	}

	/* now translate the file */
	c2html(filename,err,&c);
	/* check for errors */
	if(strlen(err))
	printf("\nError: %s\n",err);
	/* bye bye */
	printf("\nProgram Terminated.");
    getc(stdin);
	return 0;
}
  void init (char *name, dist width, dist height)
  {
    int screen_num = DefaultScreen(display);
    int screen_width = DisplayWidth(display, screen_num);
    int screen_height = DisplayHeight(display, screen_num);
    background_pixel = WhitePixel(display, screen_num);
    foreground_pixel = BlackPixel(display, screen_num);
    Window root_window = RootWindow(display, screen_num);

    int max_width = int (.9 * screen_width);
    int max_height = int (.9 * screen_height);
    width = width > max_width ? max_width : width;
    height = height > max_height ? max_height : height;
    int win_x = 30;
    int win_y = 30;
    int win_border_width = 2;

    win = XCreateSimpleWindow(display, root_window,
                              win_x, win_y, width, height,
                              win_border_width,
                              foreground_pixel, background_pixel);

    set_dialog_properties (display, win, name, width, height);

    Visual* default_visual = DefaultVisual(display, DefaultScreen(display));
    Colormap colormap = XCreateColormap(display, win, default_visual,
                                        AllocNone);
    XColor gray;
    // if (!XAllocColor (display, colormap, &gray))
    if (!XAllocNamedColor (display, colormap, "lightgray", &gray, &gray))
      fatal ("can't allocate gray");
    gray_pixel = gray.pixel;

    unsigned long valuemask = 0;
    XGCValues values;
    gc = XCreateGC(display, win, valuemask, &values);
    if (gc < 0) {
      fprintf(stderr, "XCreateGC failed\n");
    }

    unsigned int line_width = 1;
    int line_style = LineSolid;
    int cap_style = CapButt;
    int join_style = JoinMiter;
    XSetLineAttributes(display, gc,
                       line_width, line_style, cap_style, join_style);

    default_colors ();
    XSetFillStyle(display, gc, FillSolid);
  }