Ejemplo n.º 1
0
Archivo: bcard.c Proyecto: pacew/bcard
void
setup_fonts (void)
{
	name_font = setup_font ("Lucida Sans Bold", 12);
	main_font = setup_font ("Lucida Sans", 8);
	mono_font = setup_font ("Courier Bold", 11.4);
}
Ejemplo n.º 2
0
void  print_people( int ref )
{
	int reference ;					/* person selected for printing		*/
	char *alert_ptr, alert_str[200] ;
	short i, count = 0 ;
	Str_prt_params params ;
	
	while( !count )
	{
		if( !ref )
		{
			reference =  get_person_reference( NULL, TRUE ) ;
			if( !reference )  return ;		/* exit if nobody selected	*/

			count = entries ;	/* entries is number of people selected	*/
			if( count > 1 )
			{
				rsrc_gaddr( R_STRING, PRINT_MANY, &alert_ptr ) ;
				sprintf( alert_str, alert_ptr, count ) ;
				if( form_alert( 0, alert_str ) == 2 )  count = 0 ;
			}
		}
		else
		{
			matches[0] = ref ;	/* force selector list					*/
			count = 1 ;
		}	

		if( count )
		{
			if( open_printer( &params ) )
			{
				params.ref2 = 0 ;		/* Do not print second reference.	*/
				
				if( params.use_gdos )
					setup_font( &params, fontinfo ) ;

				if( params.chs_across < 40 )
				{
					rsrc_gaddr( R_STRING, GROSS_FONT, &alert_ptr ) ;
					rsrc_form_alert( 1, GROSS_FONT ) ;
				}
				else
				{
					busy( BUSY_MORE ) ;
			
					start_print_checking( &params ) ;

					i = 0 ;
					while(  printing_ok( &params ) && ( reference = matches[i++] ) )
						print_person( reference, &params ) ;

					close_printer( &params ) ;
					busy( BUSY_LESS ) ;
				}
			}
		}
	}
}
Ejemplo n.º 3
0
void test_text(Screen* screen) {
	fill_screen(screen, color_make(2, 0, 0));
	Font* font = setup_font();

	char* str = "Lorem ipsum dolor sit amet consectetur apipiscing elit Donex purus arcu suscipit ed felis eu blandit blandit quam Donec finibus euismod lobortis Sed massa nunc malesuada ac ante eleifend dictum laoreet massa Aliquam nec dictum turpis pellentesque lacinia ligula Donec et tellus maximum dapibus justo auctor egestas sapien Integer venantis egesta malesdada Maecenas venenatis urna id posuere bibendum eros torto gravida ipsum sed tempor arcy andte ac odio Morbi elementum libero id velit bibendum auctor It sit amet ex eget urna venenatis laoreet Proin posuere urna nec ante tutum lobortis Cras nec elit tristique dolor congue eleifend";
	Label* label = create_label(rect_make(point_make(0, 0), size_make(screen->window->size.width, screen->window->size.height)), str);
	label->text_color = color_make(12, 0, 0);
	//draw_label(screen, label);
}
Ejemplo n.º 4
0
static void gl_render_msg_place(void *data, float pos_x, float pos_y, float scale, uint32_t color, const char *msg)
{
   (void)data;
   (void)msg;
   (void)color;

#ifdef HAVE_FREETYPE
   setup_font(data, msg, scale, pos_x, pos_y);
#endif
}
Ejemplo n.º 5
0
static void gl_render_msg(void *data, const char *msg)
{
   (void)data;
   (void)msg;

   gl_t *gl = (gl_t*)data;
   setup_font(data, msg,
         g_settings.video.font_scale ? (GLfloat)gl->vp.width / (GLfloat)gl->full_x : 1.0f,
         g_settings.video.msg_pos_x, g_settings.video.msg_pos_y);
}
Ejemplo n.º 6
0
  void param_set_notify(const vsx_string<>& name)
  {
    if (!declare_run)
      return;

    if (name == "font_in" || name == "glyph_size")
    {
      setup_font();
      if (ftfont)
      {
        process_lines();
      }
    }
  }
Ejemplo n.º 7
0
int main( int argc, char *argv[] )
{
   Display *dpy;
   Window win;

   dpy = XOpenDisplay(NULL);

   win = make_rgb_db_window( dpy, 0, 0, 300, 300 );
   setup_font( dpy );

   glShadeModel( GL_FLAT );
   glClearColor( 0.5, 0.5, 1.0, 1.0 );

   XMapWindow( dpy, win );

   event_loop( dpy );
   return 0;
}
Ejemplo n.º 8
0
static void gl_render_msg(void *data, const char *msg, void *parms)
{
   GLfloat x, y, scale, alpha;
   gl_t *gl;
   font_params_t *params;
   int i;

   (void)data;
   (void)msg;
   
   gl = (gl_t*)data;
   params = (font_params_t*)parms;

   if (!gl)
      return;

   if (params)
   {
      x = params->x;
      y = params->y;
      scale = params->scale;
      alpha = params->alpha;

      // If alpha is 0.0f, turn it into default 1.0f
      if (alpha <= 0.0f)
         alpha = 1.0f;
   }
   else
   {
      x = g_settings.video.msg_pos_x;
      y = g_settings.video.msg_pos_y;
      scale = g_settings.video.font_scale ? (GLfloat)gl->vp.width / (GLfloat)gl->full_x : 1.0f;
      alpha = 1.0f;
   }

   for (i = 0; i < 4; i++)
   {
      gl->font_color[4 * i + 3] = alpha;
      gl->font_color_dark[4 * i + 3] = alpha;
   }

   setup_font(data, msg, scale, x, y);
}
Ejemplo n.º 9
0
Archivo: vga.c Proyecto: Haifisch/axle
Screen* switch_to_vga() {
	kernel_begin_critical();

	int width = 320;
	int height = 200;

	Screen* screen = (Screen*)kmalloc(sizeof(Screen));
	screen->window = create_window(rect_make(point_make(0, 0), size_make(width, height)));
	screen->depth = VGA_DEPTH;
	screen->vmem = kmalloc(width * height * sizeof(uint8_t));
	screen->physbase = VRAM_START;
	screen->font = setup_font();

	regs16_t regs;
	regs.ax = 0x0013;
	int32(0x10, &regs);
	
	//start refresh loop
	setup_vga_screen_refresh(screen, 33);

	kernel_end_critical();

	return screen;
}
Ejemplo n.º 10
0
void  print_footer_lines( Str_prt_params *ps_ptr )
{
	char buffer[FOOTER_CHARS+1] ;
	short line = 0 ;
	Str_prt_params params ;
	
	params = *ps_ptr ;
	
	if( params.use_gdos )  setup_font( &params, fontinfo ) ;
	
	params.y_pos = params.chs_up ;	/* for GDOS ensures footer in right place			*/
	params.align = LEFT ;
	params.max_len = 0 ;			/* turn off justification							*/
	params.chs_up = 32767 ;			/* to avoid infinite nested calls to print footers	*/
	if( footer_lines() )  printout_strings( " ", NULL, &params ) ;
	for( line = 0; line < FOOTER_LINES ; line++ )
	{
		if( footers.line[line].enable )
		{
			params.x_pos = 0 ;
			params.align = LEFT ;
			params.downlines = 0 ;
			form_footer_part( buffer, footers.line[line].left, params.ref1, params.ref2, params.page ) ;
			printout_strings( buffer, NULL, &params ) ;
			params.x_pos = params.chs_across / 2 ;
			params.align = CENTRE ;
			form_footer_part( buffer, footers.line[line].centre, params.ref1, params.ref2, params.page ) ;
			printout_strings( buffer, NULL, &params ) ;
			params.x_pos = params.chs_across ;
			params.align = RIGHT ;
			params.downlines = 1 ;
			form_footer_part( buffer, footers.line[line].right, params.ref1, params.ref2, params.page ) ;
			printout_strings( buffer, NULL, &params ) ;
		}
	}
}
Ejemplo n.º 11
0
Archivo: vesa.c Proyecto: Haifisch/axle
//sets up VESA for mode
Screen* switch_to_vesa() {
		kernel_begin_critical();
		
		vesa_info info;
		vbe_mode_info mode_info;
		regs16_t regs;

		//get VESA information
		
		//buffer stores info before being copied into structure	
		uint32_t buffer = (uint32_t)kmalloc(sizeof(vesa_info)) & 0xFFFFF;

		memcpy(buffer, "VBE2", 4);
		memset(&regs, 0, sizeof(regs));

		regs.ax = 0x4F00; //00 gets VESA information
		regs.di = buffer & 0xF;
		regs.es = (buffer >> 4) & 0xFFFF;
		int32(0x10, &regs);

		//copy info from buffer into struct
		memcpy(&info, buffer, sizeof(vesa_info));

		//get VESA mode information

		//buffer to store mode info before copying into structure
		uint32_t mode_buffer = (uint32_t)kmalloc(sizeof(vbe_mode_info)) & 0xFFFFF;

		memset(&regs, 0, sizeof(regs));

		uint32_t vesa_mode = 0x118; //1024x768x24

		regs.ax = 0x4F01; //01 gets VBE mode information
		regs.di = mode_buffer & 0xF;
		regs.es = (mode_buffer >> 4) & 0xFFFF;
		regs.cx = vesa_mode; //mode to get info for
		int32(0x10, &regs);
		
		//copy mode info from buffer into struct
		memcpy(&mode_info, mode_buffer, sizeof(vbe_mode_info));
	
		regs.ax = 0x4F02; //02 sets graphics mode

		//sets up mode with linear frame buffer instead of bank switching
		//or 0x4000 turns on linear frame buffer
		regs.bx = (vesa_mode | 0x4000);
		int32(0x10, &regs);

		Screen* screen = (Screen*)kmalloc(sizeof(Screen));
		screen->vmem = kmalloc(mode_info.x_res * mode_info.y_res * (mode_info.bpp / 8));
		screen->depth = mode_info.bpp;
		//linear frame buffer (LFB) address
		screen->physbase = (uint8_t*)mode_info.physbase;
		
		screen->font = setup_font();
		screen->window = create_window(rect_make(point_make(0, 0), size_make(mode_info.x_res, mode_info.y_res)));
		set_frame(screen->window->title_view, rect_make(point_make(0, 0), size_make(0, 0)));
		set_frame(screen->window->content_view, screen->window->frame);
		set_border_width(screen->window, 0);
		desktop_setup(screen);

		//start refresh loop
		//screen->finished_drawing = 0;
		setup_vesa_screen_refresh(screen, 83);
		//refresh once now so we don't wait for the first tick
		vesa_screen_refresh(screen);

		kernel_end_critical();

		return screen;
}
Ejemplo n.º 12
0
void  print_person( int reference, Str_prt_params *ps_ptr )
{
	Person *pptr ;
	Couple *cptr ;
	short cblk ;						/* block number					*/
	int coup, father, mother, ch, spouse ;
										/* references					*/
	char *ch_ptr ;						/* ptr to array of child refs	*/
	char *coupls_ptr ;					/* ptr to array of couplings	*/
	short first_ch ;					/* flag to print "sibling" or	*/
										/* "children" before first one	*/
	char temp_str[100] ;
	short dist_down ;
	short dummy ;
	short omit_baptism_details = TRUE ;
	short omit_will_details = TRUE ;
	short omit_death_details = TRUE ;
	short omit_wed_details ;
	short omit_divorce_details ;
	short i ;

	busy( BUSY_MORE ) ;
	pptr = get_pdata_ptr( reference, &dummy ) ;
	ps_ptr->ref1 = reference ;
	
	if( ps_ptr->use_gdos )
		setup_font( ps_ptr, largefont ) ;

	ps_ptr->last_x_end = 0 ;
	ps_ptr->y_pos = 0 ;
	ps_ptr->downlines = 1 ;
	ps_ptr->tabpos = 0 ;
	sprintf( temp_str, "%s    %s", pptr->forenames, pptr->family_name ) ;
	ps_ptr->align = RIGHT ;
	ps_ptr->x_pos = ps_ptr->chs_across ;
	print_str( NULL, 0, temp_str, 0, ps_ptr ) ;
	ps_ptr->align = RIGHT ;
	ps_ptr->x_pos = ps_ptr->chs_across ;
	ps_ptr->tabpos = 0 ;
	print_int( NULL, 0, pptr->reference, 0, ps_ptr ) ;

	dist_down = ps_ptr->y_pos * ps_ptr->cell_height ;
	if( ps_ptr->use_gdos )  setup_font( ps_ptr, fontinfo ) ;
	ps_ptr->y_pos = ( dist_down + ps_ptr->cell_height - 1 ) 
													/ ps_ptr->cell_height ;
	ps_ptr->align = LEFT_WRAP ;
	ps_ptr->x_pos = 0 ;
	ps_ptr->max_len = 0 ;
	ps_ptr->last_x_end = 0 ;
	ps_ptr->tabpos = 28 ;	
	print_date( pers_form.fm_ptr, BIRTH_SOURCE, pptr->birth_date, 0, ps_ptr ) ;

//	ps_ptr->align = LEFT_WRAP ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	print_str( pers_form.fm_ptr, BIRTH_PLACE, pptr->birth_place, 1, ps_ptr ) ;

//	ps_ptr->align = LEFT_WRAP ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
//	ps_ptr->downlines = 1 ;
	print_str( birth_form.fm_ptr, BI_SOURCE_TITLE, pptr->birth_source, 1, ps_ptr ) ;

	if( pptr->occupation )  down_n_lines( 1, ps_ptr ) ;

	ps_ptr->x_pos = 0 ;
	ps_ptr->tabpos = 28 ;
	print_str( pers_form.fm_ptr, OCCUPATION, pptr->occupation, 1, ps_ptr ) ;

	down_n_lines( 1, ps_ptr ) ;

	if( coup = pptr->parents )
	{
		father = couples[coup].male_reference ;
		names_ref( father, temp_str, 40, FALSE ) ;
											/* format names into string	*/
		ps_ptr->x_pos = 0 ;
		ps_ptr->tabpos = 28 ;
		print_str( pers_form.fm_ptr, FATHER, temp_str, 0, ps_ptr ) ;
		mother = couples[coup].female_reference ;
		names_ref( mother, temp_str, 40, FALSE ) ;
											/* format names into string	*/
		print_str( pers_form.fm_ptr, MOTHER, temp_str, 0, ps_ptr ) ;

		cptr = get_cdata_ptr( coup, &cblk ) ;
		if( ch_ptr = cptr->children )
		{
			first_ch = TRUE ;
			while( ch = form_ref( &ch_ptr ) )
			{
				if( ch != reference )
				{
					if( first_ch )
					{
						first_ch = FALSE ;
						ps_ptr->x_pos = 4 ;
						ps_ptr->tabpos = 0 ;
						print_str( pers_form.fm_ptr, SIB_STRING, NULL, 0, ps_ptr ) ;
						ps_ptr->x_pos = 28 ;
					}
					names_ref( ch, temp_str, 40, FALSE ) ;
					print_str( NULL, 0, temp_str, 0, ps_ptr ) ;
				}
			}
		}
		if( ps_ptr->y_pos < printer_lines )  down_n_lines( 1, ps_ptr ) ;
	}

	if( pptr->baptism_date || pptr->baptism_place || pptr->baptism_source )
		omit_baptism_details = FALSE ;
	ps_ptr->x_pos = 0 ;
	ps_ptr->tabpos = 28 ;
	print_date( pers_form.fm_ptr, BAPTISM, pptr->baptism_date,
										omit_baptism_details, ps_ptr ) ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	print_str( baptism_form.fm_ptr, BA_PLACE, pptr->baptism_place, 1, ps_ptr ) ;
	print_str( baptism_form.fm_ptr, BA_SOURCE, pptr->baptism_source, 1, ps_ptr ) ;
	if( !omit_baptism_details )
		if( ps_ptr->y_pos < printer_lines )  down_n_lines( 1, ps_ptr ) ;
	
	if( coupls_ptr = pptr->couplings )
	{
		while( coup = form_ref( &coupls_ptr ) )
		{
			omit_wed_details = TRUE ;
			omit_divorce_details = TRUE ;

			cptr = get_cdata_ptr( coup, &cblk ) ;
			if( cptr->male_reference == reference )
				spouse = cptr->female_reference ;
			else  spouse = cptr->male_reference ;
			names_ref( spouse, temp_str, 40, FALSE ) ;
			ps_ptr->x_pos = 0 ;
			ps_ptr->tabpos = 28 ;
			print_str( pers_form.fm_ptr, SPOUSE, temp_str, 0, ps_ptr ) ;
			
			if( cptr->wedding_date || cptr->wedding_place || cptr->wedding_place
									|| cptr->wedd_wit1 || cptr->wedd_wit2 )
				omit_wed_details = FALSE ;
			ps_ptr->x_pos = 4 ;
			ps_ptr->tabpos = 24 ;
			print_date( coup_form.fm_ptr, C_SOURCE, cptr->wedding_date,
				omit_wed_details, ps_ptr ) ;
			print_str( coup_form.fm_ptr, W_PLACE, cptr->wedding_place, 1, ps_ptr ) ;			
			print_str( co_src_form.fm_ptr, W_SOURCE, cptr->wedding_source, 1, ps_ptr ) ;	
			ps_ptr->x_pos = 8 ;
			ps_ptr->tabpos = 20 ;
			print_str( co_src_form.fm_ptr, WWIT1, cptr->wedd_wit1, 1, ps_ptr ) ;
			print_str( co_src_form.fm_ptr, WWIT2, cptr->wedd_wit2, 1, ps_ptr ) ;
			
			if( cptr->divorce_date || cptr->divorce_source )
				omit_divorce_details = FALSE ;
				
			ps_ptr->x_pos = 4 ;
			ps_ptr->tabpos = 24 ;
			print_date( coup_form.fm_ptr, C_DIVORCE, cptr->divorce_date,
				omit_divorce_details, ps_ptr ) ;
			ps_ptr->x_pos = 8 ;
			ps_ptr->tabpos = 20 ;
			print_str( divorce_form.fm_ptr, DI_SOURCE_TITLE, cptr->divorce_source, 1, ps_ptr ) ;					
			
			if( ch_ptr = cptr->children )
			{
				first_ch = TRUE ;
				while( ch = form_ref( &ch_ptr ) )
				{
					if( first_ch )
					{
						first_ch = FALSE ;
						ps_ptr->x_pos = 4 ;
						ps_ptr->tabpos = 0 ;
						print_str( pers_form.fm_ptr, CH_STRING, NULL, 0, ps_ptr ) ;
						ps_ptr->x_pos = 28 ;
					}
					names_ref( ch, temp_str, 40, FALSE ) ;
					print_str( NULL, 0, temp_str, 0, ps_ptr ) ;
				}
			}
			if( ps_ptr->y_pos < printer_lines )  down_n_lines( 1, ps_ptr ) ;
		}
	}

	if( pptr->will_date || pptr->will_wit1 || pptr->will_wit2
			|| pptr->will_exe1 || pptr->will_exe2
			|| pptr->will_sol || pptr->will_bens
			|| pptr->will_bens2 || pptr->will_bens3 )
			omit_will_details = FALSE ;
	if( pptr->death_date || pptr->death_place || pptr->death_source
			|| pptr->burial_date || pptr->burial_place || !omit_will_details )
		omit_death_details = FALSE ;
	ps_ptr->x_pos = 0 ;
	ps_ptr->tabpos = 28 ;
	print_date( pers_form.fm_ptr, DEATH, pptr->death_date,
										omit_death_details, ps_ptr ) ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	print_str( death_form.fm_ptr, D_PLACE, pptr->death_place, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BC_PLACE, pptr->burial_place, 1, ps_ptr ) ;
	print_date( death_form.fm_ptr, BCDATE, pptr->burial_date, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, D_SOURCE, pptr->death_source, 1, ps_ptr ) ;

	print_date( death_form.fm_ptr, D_WILL, pptr->will_date, omit_will_details,
																ps_ptr ) ;
	ps_ptr->x_pos = 8 ;
	ps_ptr->tabpos = 20 ;
	print_str( death_form.fm_ptr, DWIT1, pptr->will_wit1, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, DWIT2, pptr->will_wit2, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, EXEC1, pptr->will_exe1, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, EXEC2, pptr->will_exe2, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, SOLIC, pptr->will_sol, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BENEF, pptr->will_bens, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BENEF2, pptr->will_bens2, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BENEF3, pptr->will_bens3, 1, ps_ptr ) ;

	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	for( i=7; i>=0; i-- )  print_flag( i, pptr->flags, ps_ptr ) ;
	
	if( pptr->notes )
	{
		ps_ptr->tabpos = 0 ;
		ps_ptr->x_pos = 0 ;
//		ps_ptr->downlines = 1 ;
		ps_ptr->align = LEFT ;
		
		print_str( NULL, 0, NULL, 0, ps_ptr ) ;
		
		ps_ptr->downlines = 2 ;
		
		print_str( pers_form.fm_ptr, NOTES, NULL, 0, ps_ptr ) ;
	
		print_notes_indented( pptr, ps_ptr ) ;
	}

	end_page( ps_ptr, FALSE ) ;
	busy( BUSY_LESS ) ;
}
Ejemplo n.º 13
0
void
setup() {
	int i, j;
	struct config *c;

	XSetWindowAttributes wattr;
	XModifierKeymap *modmap;

	xerrorxlib = XSetErrorHandler(handle_xerror);

	dpy = XOpenDisplay(NULL);
	root = DefaultRootWindow(dpy);
	screen = DefaultScreen(dpy);
	visual = DefaultVisual(dpy, screen);
	cmap = DefaultColormap(dpy, screen);
	gc = DefaultGC(dpy, screen);

	sw = DisplayWidth(dpy, screen);
	sh = DisplayHeight(dpy, screen);

	wattr.override_redirect = True;
	wattr.background_pixel = bgcol.pixel; 
	wattr.border_pixel = fgcol.pixel;
	win = XCreateWindow(dpy, root, 0, 0, ww, wh, bw,
			CopyFromParent, InputOutput, CopyFromParent,
			CWOverrideRedirect | CWBackPixel | CWBorderPixel, &wattr);

	/* Grab keys */
	/* modifier stuff taken from evilwm */
	modmap = XGetModifierMapping(dpy);
	for (i = 0; i < 8; i++) {
		for (j = 0; j < modmap->max_keypermod; j++) {
			if (modmap->modifiermap[i * modmap->max_keypermod + j] ==
			XKeysymToKeycode(dpy, XK_Num_Lock)) {
				numlockmask = (1 << i);
			}
		}
	}
	for(c=config; c; c=c->next)
		grabkey(c->mod, c->key);

	XSelectInput(dpy, root, KeyPressMask | SubstructureNotifyMask);
	XSelectInput(dpy, win, ButtonPressMask);

	setup_font(&fontbig, fontstrbig);
	setup_font(&fontsmall, fontstrsmall);

	getcolor(fgcolor, &fgcol);
	getcolor(bgcolor, &bgcol);
	getcolor(errcolor, &errcol);

	NetWMWindowOpacity = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
	if(opacity > 1.0 || opacity < 0.0)
		opacity = 0.0;
	unsigned long real_opacity[] = { opacity * 0xffffffff };
	XChangeProperty(dpy, win, NetWMWindowOpacity, XA_CARDINAL, 32,
			PropModeReplace, (unsigned char *)real_opacity, 1);

	draw = XftDrawCreate(dpy, win, visual, cmap);

	signal(SIGALRM, sigalrm);
	signal(SIGCHLD, sigchld);
}
Ejemplo n.º 14
0
 void start()
 {
   cur_font = "";
   setup_font();
 }
Ejemplo n.º 15
0
 void run()
 {
   setup_font();
 }