/**
 * Turn ON LCD, show base .
 */
static void _LcdOn(void)
{
	void *pBuffer = NULL;

	test_pattern_24RGB (base_desc.pbuffer);
	l2cc_clean_region((uint32_t)_base_buffer, (uint32_t)_base_buffer + sizeof(_base_buffer));

	/* OVR1 */
	pBuffer = create_canvas(&ovr1_desc);
	lcdd_set_color_keying(ovr1_desc.layer, 0, ovr1_desc.bg_color, 0xFFFFFF);
	lcdd_fill(ovr1_desc.bg_color);

	/* OVR2 */
	pBuffer = create_canvas(&ovr2_desc);
	lcdd_set_color_keying(ovr2_desc.layer, 0, ovr2_desc.bg_color, 0xFFFFFF);
	lcdd_fill(ovr2_desc.bg_color);

	/* HE0 */
	pBuffer = create_canvas(&heo_desc);
	lcdd_set_color_keying(heo_desc.layer, 0, heo_desc.bg_color, 0xFFFFFF);
	lcdd_fill(heo_desc.bg_color);
	lcdd_set_alpha(heo_desc.layer, 1, 128);
	lcdd_set_priority(heo_desc.layer, 0);

	lcdd_on();
	lcdd_set_backlight(bBackLight);
	lcdd_show_base(_base_buffer, 24, 0);

	/* BASE */
	lcdd_select_canvas(LCDD_BASE);
	//lcdd_fill(base_desc.bg_color);

}
Esempio n. 2
0
Canvas* create_svg_canvas(const Rect& bounds, XMLWriter* writer)
{
  ISize size = size_ round_out_rect(bounds);
  //TODO
  
  return create_canvas(device);
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
	if (argc < 2) {
		printf("Compositor server not specified.\n");
		return 1;
	}
	
	list_initialize(&led_devs);
	int rc = loc_register_cat_change_cb(loc_callback);
	if (rc != EOK) {
		printf("Unable to register callback for device discovery.\n");
		return 1;
	}
	
	led_timer = fibril_timer_create(NULL);
	if (!led_timer) {
		printf("Unable to create LED timer.\n");
		return 1;
	}
	
	frame_timer = fibril_timer_create(NULL);
	if (!frame_timer) {
		printf("Unable to create frame timer.\n");
		return 1;
	}
	
	if (!decode_frames())
		return 1;
	
	winreg = argv[1];
	window_t *main_window = window_open(argv[1], NULL,
	    WINDOW_MAIN | WINDOW_DECORATED, "barber");
	if (!main_window) {
		printf("Cannot open main window.\n");
		return 1;
	}
	
	frame_canvas = create_canvas(window_root(main_window), NULL,
	    FRAME_WIDTH, FRAME_HEIGHT, frames[frame]);
	
	if (!frame_canvas) {
		window_close(main_window);
		printf("Cannot create widgets.\n");
		return 1;
	}
	
	window_resize(main_window, 0, 0, FRAME_WIDTH + 8, FRAME_HEIGHT + 28,
	    WINDOW_PLACEMENT_RIGHT | WINDOW_PLACEMENT_BOTTOM);
	window_exec(main_window);
	
	plan_led_timer();
	plan_frame_timer(0);
	
	task_retval(0);
	async_manager();
	
	return 0;
}
Esempio n. 4
0
GtkWidget *
create_grabs_page (void)
{
  GtkWidget *vbox, *grid, *label;

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
  g_object_set (vbox, "margin", 4, NULL);
  gtk_widget_show (vbox);

  label = gtk_label_new ("Move the mouse over the widgets and canvas items on the right to see what events they receive.\nClick buttons to start explicit or implicit pointer grabs and see what events they receive now.\n(They should all receive the same events.)");
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
  gtk_widget_show (label);

  grid = gtk_grid_new ();
  g_object_set (grid, "margin", 12, NULL);
  gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
  gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE);
  g_object_set (grid, "halign", GTK_ALIGN_CENTER, NULL);
  gtk_widget_show (grid);

  /* Drawing area with explicit grabs. */
  create_fixed (GTK_GRID (grid), 1,
		"Widget with Explicit Grabs:",
		"widget-explicit");

  /* Drawing area with implicit grabs. */
  create_fixed (GTK_GRID (grid), 2,
		"Widget with Implicit Grabs:",
		"widget-implicit");

  /* Canvas with explicit grabs. */
  create_canvas (GTK_GRID (grid), 3,
		 "Canvas with Explicit Grabs:",
		 "canvas-explicit");

  /* Canvas with implicit grabs. */
  create_canvas (GTK_GRID (grid), 4,
		 "Canvas with Implicit Grabs:",
		 "canvas-implicit");

  return vbox;
}
Esempio n. 5
0
File: auto_ai.c Progetto: shouya/bar
void init_game(void) {
  srand(time(NULL));

  game.game_name = "Auto AI";
  game.author_name = "Ya Shou";
  game.author_email = "*****@*****.**";
  game.impl = &impl;

  game_ctrl.repeat_on = 0;
  game_ctrl.automove_interval = 10;
  game_ctrl.auto_move = &do_auto_move;
  game_ctrl.before_auto_move = &do_step_ai;
  game_ctrl.kill_bm_lines = &kill_lines_hook;
  game_ctrl.quit = 0;

  game_render.render = &do_render;
  game_render.clrscr = 0;
  game_render.draw_block = 0;
  game_render.update = 0;

  game_event.kbd_handler = &dealkbd;
  game_event.quit_handler = 0;

  g_cfg.scrw = WNDW;
  g_cfg.scrh = WNDH;
  g_cfg.ctrl = &game_ctrl;
  g_cfg.render = &game_render;
  g_cfg.event = &game_event;

  init_ui();
  init_graphic();
  
  default_init_shapes();

  impl.bm = create_blockmap(XRES, YRES);
  impl.queue = create_queue(7, 7);
  impl.sb = create_shapebuf(-1);
  impl.cvs = create_canvas(BOX_SZ*XRES, BOX_SZ*YRES);
  impl.pnl = create_canvas(WNDW-BOX_SZ*XRES, WNDH);

  newgame();
}
Esempio n. 6
0
File: main.c Progetto: czaber/ogwm
void setup_x(void) {
	screen = DefaultScreen(dpy);
	root = RootWindow(dpy, screen);

	XSetErrorHandler(on_xerror);
	XSelectInput (dpy, root, SubstructureNotifyMask|KeyPressMask|VisibilityChangeMask|ExposureMask);
	XCompositeRedirectSubwindows(dpy, root, CompositeRedirectAutomatic);

	overlay = create_overlay();
	canvas = create_canvas();
	debug("Root 0x%x, Overlay 0x%x, Canvas 0x%x\n", root, overlay, canvas);

	stop = 0;
}
Esempio n. 7
0
GtkWidget *
create_grabs_page (void)
{
  GtkWidget *table, *label;

  table = gtk_table_new (5, 2, FALSE);
  gtk_container_set_border_width (GTK_CONTAINER (table), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table), 12);
  gtk_table_set_col_spacings (GTK_TABLE (table), 12);
  gtk_widget_show (table);

  label = gtk_label_new ("Move the mouse over the widgets and canvas items on the right to see what events they receive.\nClick buttons to start explicit or implicit pointer grabs and see what events they receive now.\n(They should all receive the same events.)");
  gtk_table_attach (GTK_TABLE (table), label, 0, 2, 0, 1, 0, 0, 0, 0);
  gtk_widget_show (label);

  /* Drawing area with explicit grabs. */
  create_fixed (GTK_TABLE (table), 1,
		"Widget with Explicit Grabs:",
		"widget-explicit");

  /* Drawing area with implicit grabs. */
  create_fixed (GTK_TABLE (table), 2,
		"Widget with Implicit Grabs:",
		"widget-implicit");

  /* Canvas with explicit grabs. */
  create_canvas (GTK_TABLE (table), 3,
		 "Canvas with Explicit Grabs:",
		 "canvas-explicit");

  /* Canvas with implicit grabs. */
  create_canvas (GTK_TABLE (table), 4,
		 "Canvas with Implicit Grabs:",
		 "canvas-implicit");

  return table;
}
int captureScreen()
{
	char dstpath[MAX_PATH_LENGTH];
	char* scrimage;
	int width, height;
	Evas* ev = NULL;
	Evas_Object* img;
	screenshot_data sdata;
	probeInfo_t	probeInfo;
	int ret = 0;
	static pthread_mutex_t captureScreenLock = PTHREAD_MUTEX_INITIALIZER;

	pthread_mutex_lock(&captureScreenLock);

	probeBlockStart();

	setProbePoint(&probeInfo);
	sdata.ximage = NULL;
	scrimage = captureScreenShotX(&width, &height, &sdata);
	if(scrimage != NULL)
	{
		ev = create_canvas(width, height);
		if(likely(ev != NULL))
		{
			snprintf(dstpath, sizeof(dstpath),
				 SCREENSHOT_DIRECTORY "/%d_%d.png", getpid(),
				 probeInfo.eventIndex);

			// make image buffer
			if((img = evas_object_image_add(ev)) != NULL)
			{
				//image buffer set
				evas_object_image_data_set(img, NULL);
				evas_object_image_size_set(img, width, height);
				evas_object_image_data_set(img, scrimage);

				// resize image
				if(height > MAX_HEIGHT)
				{
					width = width * MAX_HEIGHT / height;
					height = MAX_HEIGHT;
					evas_object_resize(img, width, height);
					evas_object_image_fill_set(img, 0, 0, width, height);
				}
				evas_object_image_data_update_add(img, 0, 0, width, height);

				//save file
				if(evas_object_image_save(img, dstpath, NULL, "compress=5") != 0)
				{
					chmod(dstpath, 0777);

					/* welcome to the hell */
					log_t log;
					PREPARE_LOCAL_BUF_THOUGH((char *)&log);

					/* skip header */
					LOCAL_BUF += offsetof(log_t, data);
					/* pack screenshot name */
					BUF_PTR = pack_string(LOCAL_BUF, dstpath); /* file name */
					LOCAL_BUF = BUF_PTR;

					/* pack probe */
					PACK_COMMON_BEGIN(MSG_PROBE_SCREENSHOT, API_ID_captureScreen, "", 0);
					PACK_COMMON_END('d', 0, 0, 0);
					PACK_SCREENSHOT(dstpath, getOrientation());
					SET_MSG_LEN();
					log.length = GET_MSG_LEN() + MSG_LEN_OFFSET + strlen(dstpath) + 1;

					/* send all message */
					printLog(&log, MSG_IMAGE);
				}
				else
				{
					// captureScreen : evas_object_image_save failed
					ret = -1;
				}
			}
			else
			{
				// captureScreen : evas_object_image_add failed
				ret = -1;
			}
		}
		else
		{
			// captureScreen : create canvas failed
			ret = -1;
		}
	}
	else
	{
		// captureScreen : captureScreenShotX failed
		ret = -1;
	}

	// release resources
	releaseScreenShotX(&sdata);
	if(ev)
		destroy_canvas(ev);

	probeBlockEnd();

	pthread_mutex_unlock(&captureScreenLock);
	return ret;
}
Esempio n. 9
0
/**
 * @param ddisp The diagram display object that a window is created for
 * @param width Diagram widgth
 * @param height Diagram Height
 * @param title Window title
 * @param use_mbar Flag to indicate whether to add a menubar to the window
 */
void
create_display_shell(DDisplay *ddisp,
		     int width, int height,
		     char *title, int use_mbar)
{
  GtkWidget *table, *widget;
  GtkWidget *status_hbox;
  GtkWidget *root_vbox = NULL;
  GtkWidget *zoom_hbox, *zoom_label;
  int s_width, s_height;

  if (app_is_interactive() && is_integrated_ui())
  {
    use_integrated_ui_for_display_shell(ddisp, title);
    return;
  }
 
  ddisp->is_standalone_window = TRUE;
  ddisp->container            = NULL;

  s_width = gdk_screen_width ();
  s_height = gdk_screen_height ();
  if (width > s_width)
    width = s_width;
  if (height > s_height)
    height = s_height;

  /*  The toplevel shell */
  ddisp->shell = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (ddisp->shell), title);
  gtk_window_set_role (GTK_WINDOW (ddisp->shell), "diagram_window");
  gtk_window_set_icon_name (GTK_WINDOW (ddisp->shell), "dia");
  gtk_window_set_default_size(GTK_WINDOW (ddisp->shell), width, height);
  /* set_icon_name needs registered theme icons, not always available: provide fallback */
  if (!gtk_window_get_icon (GTK_WINDOW (ddisp->shell))) {
    static GdkPixbuf *pixbuf = NULL;

    if (!pixbuf)
      pixbuf = gdk_pixbuf_new_from_inline(-1, dia_diagram_icon, FALSE, NULL);
    if (pixbuf)
      gtk_window_set_icon (GTK_WINDOW (ddisp->shell), pixbuf);
  }

  g_object_set_data (G_OBJECT (ddisp->shell), "user_data", (gpointer) ddisp);

  _ddisplay_setup_events (ddisp, ddisp->shell);
  /* following two not shared with integrated UI */
  g_signal_connect (G_OBJECT (ddisp->shell), "delete_event",
		    G_CALLBACK (ddisplay_delete), ddisp);
  g_signal_connect (G_OBJECT (ddisp->shell), "destroy",
		    G_CALLBACK (ddisplay_destroy), ddisp);

  /*  the table containing all widgets  */
  table = gtk_table_new (4, 3, FALSE);
  gtk_table_set_col_spacing (GTK_TABLE (table), 0, 1);
  gtk_table_set_col_spacing (GTK_TABLE (table), 1, 2);
  gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
  gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
  gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  if (use_mbar) 
  {
      root_vbox = gtk_vbox_new (FALSE, 1);
      gtk_container_add (GTK_CONTAINER (ddisp->shell), root_vbox);
      gtk_box_pack_end (GTK_BOX (root_vbox), table, TRUE, TRUE, 0);
  }
  else
  {
      gtk_container_add (GTK_CONTAINER (ddisp->shell), table);
  }
  

  /*  scrollbars, rulers, canvas, menu popup button  */
  if (!use_mbar) {
      ddisp->origin = gtk_button_new();
#if GTK_CHECK_VERSION(2,18,0)
      gtk_widget_set_can_focus (ddisp->origin, FALSE);
#else
      GTK_WIDGET_UNSET_FLAGS(ddisp->origin, GTK_CAN_FOCUS);
#endif
      widget = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
      gtk_container_add(GTK_CONTAINER(ddisp->origin), widget);
      gtk_widget_set_tooltip_text(widget, _("Diagram menu."));
      gtk_widget_show(widget);
      g_signal_connect(G_OBJECT(ddisp->origin), "button_press_event",
		     G_CALLBACK(origin_button_press), ddisp);
  }
  else {
      ddisp->origin = gtk_frame_new (NULL);
      gtk_frame_set_shadow_type (GTK_FRAME (ddisp->origin), GTK_SHADOW_OUT);
  }
  
  _ddisplay_setup_rulers (ddisp, ddisp->shell, table);
  _ddisplay_setup_scrollbars (ddisp, table, width, height);
  _ddisplay_setup_navigation (ddisp, table);

  ddisp->canvas = create_canvas (ddisp);

  /*  pack all remaining widgets  */
  gtk_table_attach (GTK_TABLE (table), ddisp->origin, 0, 1, 0, 1,
                    GTK_FILL, GTK_FILL, 0, 0);
  gtk_table_attach (GTK_TABLE (table), ddisp->canvas, 1, 2, 1, 2,
                    GTK_EXPAND | GTK_SHRINK | GTK_FILL,
                    GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);

  /* TODO rob use per window accel */
  ddisp->accel_group = menus_get_display_accels ();
  gtk_window_add_accel_group(GTK_WINDOW(ddisp->shell), ddisp->accel_group);

  if (use_mbar) 
  {
    ddisp->menu_bar = menus_create_display_menubar (&ddisp->ui_manager, &ddisp->actions);
    g_assert (ddisp->menu_bar);
    gtk_box_pack_start (GTK_BOX (root_vbox), ddisp->menu_bar, FALSE, TRUE, 0);
  }

  /* the statusbars */
  status_hbox = gtk_hbox_new (FALSE, 2);

  /* Zoom status pseudo-optionmenu */
  ddisp->zoom_status = create_zoom_widget(ddisp);
  zoom_hbox = gtk_hbox_new(FALSE, 0);
  zoom_label = gtk_label_new(_("Zoom"));
  gtk_box_pack_start (GTK_BOX(zoom_hbox), zoom_label,
		      FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(zoom_hbox), ddisp->zoom_status,
		      FALSE, FALSE, 0);

  gtk_box_pack_start (GTK_BOX (status_hbox), zoom_hbox, FALSE, FALSE, 0);

  /* Grid on/off button */
  ddisp->grid_status = dia_toggle_button_new_with_icons(dia_on_grid_icon,
							dia_off_grid_icon);
  
  g_signal_connect(G_OBJECT(ddisp->grid_status), "toggled",
		   G_CALLBACK (grid_toggle_snap), ddisp);
  gtk_widget_set_tooltip_text(ddisp->grid_status,
		       _("Toggles snap-to-grid for this window."));
  gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->grid_status,
		      FALSE, FALSE, 0);


  ddisp->mainpoint_status = dia_toggle_button_new_with_icons(dia_mainpoints_on_icon,
							dia_mainpoints_off_icon);
  
  g_signal_connect(G_OBJECT(ddisp->mainpoint_status), "toggled",
		   G_CALLBACK (interface_toggle_mainpoint_magnetism), ddisp);
  gtk_widget_set_tooltip_text(ddisp->mainpoint_status,
		       _("Toggles object snapping for this window."));
  gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->mainpoint_status,
		      FALSE, FALSE, 0);


  /* Statusbar */
  ddisp->modified_status = gtk_statusbar_new ();

  gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->modified_status,
		      TRUE, TRUE, 0);

  gtk_table_attach (GTK_TABLE (table), status_hbox, 0, 3, 3, 4,
                    GTK_FILL, GTK_FILL, 0, 0);

  display_rulers_show (ddisp);
  gtk_widget_show (ddisp->zoom_status);
  gtk_widget_show (zoom_hbox);
  gtk_widget_show (zoom_label);
  gtk_widget_show (ddisp->grid_status);
  gtk_widget_show (ddisp->mainpoint_status);
  gtk_widget_show (ddisp->modified_status);
  gtk_widget_show (status_hbox);
  gtk_widget_show (table);
  if (use_mbar) 
  {
      gtk_widget_show (ddisp->menu_bar);
      gtk_widget_show (root_vbox);
  }
  gtk_widget_show (ddisp->shell);

  /* before showing up, checking canvas's REAL size */
  if (use_mbar && ddisp->hrule->allocation.width > width) 
  {
    /* The menubar is not shrinkable, so the shell will have at least
     * the menubar's width. If the diagram's requested width is smaller,
     * the canvas will be enlarged to fit the place. In this case, we
     * need to adjust the horizontal scrollbar according to the size
     * that will be allocated, which the same as the hrule got.
     */

    width = ddisp->hrule->allocation.width;

    gtk_adjustment_set_upper (ddisp->hsbdata, width);
    gtk_adjustment_set_page_increment (ddisp->hsbdata, (width - 1) / 4);
    gtk_adjustment_set_page_size (ddisp->hsbdata, width - 1);

    gtk_adjustment_changed (GTK_ADJUSTMENT(ddisp->hsbdata));
  }
  gtk_widget_show (ddisp->canvas);

  /*  set the focus to the canvas area  */
  gtk_widget_grab_focus (ddisp->canvas);
}
Esempio n. 10
0
/**
 * @param ddisp The diagram display object that a window is created for
 * @param title
 */
static void
use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
{
  GtkWidget *table;
  GtkWidget *label;                /* Text label for the notebook page */
  GtkWidget *tab_label_container;  /* Container to hold text label & close button */
  int width, height;               /* Width/Heigth of the diagram */
  GtkWidget *image;
  GtkWidget *close_button;         /* Close button for the notebook page */
  GtkRcStyle *rcstyle;
  gint       notebook_page_index;

  ddisp->is_standalone_window = FALSE;

  ddisp->shell = GTK_WIDGET (ui.main_window);
  ddisp->modified_status = GTK_WIDGET (ui.statusbar);
 
  tab_label_container = gtk_hbox_new(FALSE,3);
  label = gtk_label_new( title );
  gtk_box_pack_start( GTK_BOX(tab_label_container), label, FALSE, FALSE, 0 );
  gtk_widget_show (label);
  /* Create a new tab page */
  ddisp->container = gtk_vbox_new(FALSE, 0);

  /* <from GEdit> */
  /* don't allow focus on the close button */
  close_button = gtk_button_new();
  gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
  gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);

  /* make it as small as possible */
  rcstyle = gtk_rc_style_new ();
  rcstyle->xthickness = rcstyle->ythickness = 0;
  gtk_widget_modify_style (close_button, rcstyle);
  g_object_unref (rcstyle),

  image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
                                    GTK_ICON_SIZE_MENU);

  gtk_container_add (GTK_CONTAINER(close_button), image);
  g_signal_connect (G_OBJECT (close_button), "clicked", 
                    G_CALLBACK (close_notebook_page_callback), ddisp->container);
  /* </from GEdit> */

  gtk_box_pack_start( GTK_BOX(tab_label_container), close_button, FALSE, FALSE, 0 );
  gtk_widget_show (close_button);
  gtk_widget_show (image);

  /* Set events for new tab page */
  _ddisplay_setup_events (ddisp, ddisp->container);

  notebook_page_index = gtk_notebook_append_page (GTK_NOTEBOOK(ui.diagram_notebook),
                                                  ddisp->container,
                                                  tab_label_container);

  g_object_set_data (G_OBJECT (ddisp->container), "DDisplay",  ddisp);
  g_object_set_data (G_OBJECT (ddisp->container), "tab-label", label);
  g_object_set_data (G_OBJECT (ddisp->container), "window",    ui.main_window);

  /*  the table containing all widgets  */
  table = gtk_table_new (3, 3, FALSE);
  gtk_table_set_col_spacing (GTK_TABLE (table), 0, 1);
  gtk_table_set_col_spacing (GTK_TABLE (table), 1, 2);
  gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
  gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
  gtk_container_set_border_width (GTK_CONTAINER (table), 2);

  gtk_box_pack_start( GTK_BOX(ddisp->container), table, TRUE, TRUE, 0 );

  /*  scrollbars, rulers, canvas, menu popup button  */
  ddisp->origin = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (ddisp->origin), GTK_SHADOW_OUT);

  _ddisplay_setup_rulers (ddisp, ddisp->container, table);

  /* Get the width/height of the Notebook child area */
  /* TODO: Fix width/height hardcoded values */
  width = 100;
  height = 100;
  _ddisplay_setup_scrollbars (ddisp, table, width, height);
  _ddisplay_setup_navigation (ddisp, table);

  ddisp->canvas = create_canvas (ddisp);

  /*  place all remaining widgets  */
  gtk_table_attach (GTK_TABLE (table), ddisp->origin, 0, 1, 0, 1,
                    GTK_FILL, GTK_FILL, 0, 0);
  gtk_table_attach (GTK_TABLE (table), ddisp->canvas, 1, 2, 1, 2,
                    GTK_EXPAND | GTK_SHRINK | GTK_FILL,
                    GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);

  ddisp->common_toolbar = ui.toolbar;
  /* Stand-alone window menubar */
  ddisp->menu_bar = NULL;
  /* Stand-alone window Zoom status/menu */
  ddisp->zoom_status = NULL;
  /* Stand-alone window Grid on/off button */
  ddisp->grid_status = NULL;
  /* Stand-alone window Object Snapping button */
  ddisp->mainpoint_status = NULL;

  gtk_widget_show (ddisp->container);
  gtk_widget_show (table);
  display_rulers_show (ddisp);
  gtk_widget_show (ddisp->canvas);

  /* Show new page */
  gtk_notebook_set_current_page (ui.diagram_notebook, notebook_page_index);

  integrated_ui_toolbar_grid_snap_synchronize_to_display (ddisp);
  integrated_ui_toolbar_object_snap_synchronize_to_display (ddisp);

  /*  set the focus to the canvas area  */
  gtk_widget_grab_focus (ddisp->canvas);
}
Esempio n. 11
0
int main(void)
{
   Evas *canvas;
   Evas_Object *bg, *r1, *r2, *r3;

   evas_init();

   // create your canvas
   // NOTE: consider using ecore_evas_buffer_new() instead!
   canvas = create_canvas(WIDTH, HEIGHT);
   if (!canvas)
     return -1;

   bg = evas_object_rectangle_add(canvas);
   evas_object_color_set(bg, 255, 255, 255, 255); // white bg
   evas_object_move(bg, 0, 0);                    // at origin
   evas_object_resize(bg, WIDTH, HEIGHT);         // covers full canvas
   evas_object_show(bg);

   puts("initial scene, with just background:");
   draw_scene(canvas);

   r1 = evas_object_rectangle_add(canvas);
   evas_object_color_set(r1, 255, 0, 0, 255); // 100% opaque red
   evas_object_move(r1, 10, 10);
   evas_object_resize(r1, 100, 100);
   evas_object_show(r1);

   // pay attention to transparency! Evas color values are pre-multiplied by
   // alpha, so 50% opaque green is:
   // non-premul: r=0, g=255, b=0    a=128 (50% alpha)
   // premul:
   //         r_premul = r * a / 255 =      0 * 128 / 255 =      0
   //         g_premul = g * a / 255 =    255 * 128 / 255 =    128
   //         b_premul = b * a / 255 =      0 * 128 / 255 =      0
   //
   // this 50% green is over a red background, so it will show in the
   // final output as yellow (green + red = yellow)
   r2 = evas_object_rectangle_add(canvas);
   evas_object_color_set(r2, 0, 128, 0, 128); // 50% opaque green
   evas_object_move(r2, 10, 10);
   evas_object_resize(r2, 50, 50);
   evas_object_show(r2);

   r3 = evas_object_rectangle_add(canvas);
   evas_object_color_set(r3, 0, 128, 0, 255); // 100% opaque dark green
   evas_object_move(r3, 60, 60);
   evas_object_resize(r3, 50, 50);
   evas_object_show(r3);

   puts("final scene (note updates):");
   draw_scene(canvas);
   save_scene(canvas, "/tmp/evas-buffer-simple-render.ppm");

   // NOTE: use ecore_evas_buffer_new() and here ecore_evas_free()
   destroy_canvas(canvas);

   evas_shutdown();

   return 0;
}
Esempio n. 12
0
void
plD_bop_ntk(PLStream *pls)
{
  create_canvas(pls);
}