Beispiel #1
0
static void
make_dialog(DraftStoreUI *dsui, GtkWindow *parent) {
	GtkWidget *vbox, *bbox, *button;

	dsui->win = gtk_dialog_new_with_buttons(_("Entries"),
			parent, GTK_DIALOG_MODAL,
			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
			GTK_STOCK_OK, GTK_RESPONSE_OK,
			NULL);
	g_signal_connect(G_OBJECT(dsui->win), "destroy",
			G_CALLBACK(dsui_destroy_cb), dsui);
	gtk_window_set_default_size(GTK_WINDOW(dsui->win), 500, 400);
	gtk_dialog_set_default_response(GTK_DIALOG(dsui->win), GTK_RESPONSE_OK);

	vbox = gtk_vbox_new(FALSE, 5);
	gtk_box_pack_start(GTK_BOX(vbox), make_view(dsui), TRUE, TRUE, 0);
	/*dsui->lstats = gtk_label_new("");
	gtk_label_set_selectable(GTK_LABEL(dsui->lstats), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), dsui->lstats, FALSE, FALSE, 0);*/

	bbox = jam_dialog_buttonbox_new();
	button = jam_dialog_buttonbox_button_from_stock(bbox, GTK_STOCK_DELETE);
	g_signal_connect(G_OBJECT(button), "clicked",
			G_CALLBACK(delete_cb), dsui);

	jam_dialog_set_contents_buttonbox(dsui->win, vbox, bbox);
}
Beispiel #2
0
void window_server_t::push_back(const char* name, size_enum_t dialog_size)
{
    boost::filesystem::path     relative_path(window_list_m.back()->path_m.branch_path() / name);
    iterator                    window(window_list_m.insert(window_list_m.end(), NULL));
    boost::filesystem::path     file_name;

    try
    {
        file_name = find_resource(name);
    }
    catch (...)
    {
        file_name = relative_path;
    }

    boost::filesystem::ifstream stream(file_name);

    /*
    Update before attaching the window so that we can correctly capture contributing for reset.
    */
    
    sheet_m.update();

    window_list_m.back() = make_view(   name_t(file_name.string().c_str()),
                                        line_position_t::getline_proc_t(),
                                        stream,
                                        sheet_m,
                                        behavior_m,
                                        boost::bind(&window_server_t::dispatch_window_action,
                                            boost::ref(*this), window, _1, _2),
                                        dialog_size,
                                        default_widget_factory_proc_with_factory(widget_factory_m)).release();
    
    sheet_m.update(); // Force values to their correct states.

    window_list_m.back()->path_m = file_name;
    window_list_m.back()->eve_m.evaluate(eve_t::evaluate_nested);
    window_list_m.back()->show_window_m();
}
Beispiel #3
0
void window_server_t::push_back(std::istream&                                   data,
                                const boost::filesystem::path&                  path,
                                const line_position_t::getline_proc_t&   getline_proc,
                                size_enum_t                              dialog_size)
{
    /*
    Update before attaching the window so that we can correctly capture contributing for reset.
    */
    sheet_m.update();

    iterator window (window_list_m.insert(window_list_m.end(), NULL));

    //
    // REVISIT (ralpht): Where does this made-up filename get used? Does it need to be localized
    //  or actually be an existing file?
    //
    //  REVISIT (fbrereto) :    The file name is for error reporting purposes; see the const char*
    //                          push_back API where this is filled in. It should be valid, lest the
    //                          user not know the erroneous file.
    //
    window_list_m.back() = make_view(   name_t(path.string().c_str()),
                                        getline_proc,
                                        data,
                                        sheet_m,
                                        behavior_m,
                                        boost::bind(&window_server_t::dispatch_window_action,
                                            boost::ref(*this), window, _1, _2),
                                        dialog_size,
                                        default_widget_factory_proc_with_factory(widget_factory_m)).release();

    sheet_m.update(); // Force values to their correct states.

    window_list_m.back()->path_m = path;
    window_list_m.back()->eve_m.evaluate(eve_t::evaluate_nested);
    window_list_m.back()->show_window_m();
}
Beispiel #4
0
 String_view view() const { return make_view(str); }
Beispiel #5
0
// Return a the symbol for the given string or nullptr if the
// symbol is not in the table.
inline Symbol*
lookup_symbol(String const& s)
{
  return symbols().lookup(make_view(s));
}
Beispiel #6
0
// Returns the symbol corresponding to the stirng `s`. Insert
// the symbol if it does not exist.
inline Symbol&
get_symbol(String const& s, int k = unknown_tok)
{
  return symbols().insert(make_view(s), k);
}
Beispiel #7
0
/** A partial implementation of glCopyImageSubData
 *
 * This is a partial implementation of glCopyImageSubData that works only
 * if both textures are uncompressed and the destination texture is
 * renderable.  It uses a slight abuse of a texture view (see make_view) to
 * turn the source texture into the destination texture type and then uses
 * _mesa_meta_BlitFramebuffers to do the copy.
 */
bool
_mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
                                         struct gl_texture_image *src_tex_image,
                                         struct gl_renderbuffer *src_renderbuffer,
                                         int src_x, int src_y, int src_z,
                                         struct gl_texture_image *dst_tex_image,
                                         struct gl_renderbuffer *dst_renderbuffer,
                                         int dst_x, int dst_y, int dst_z,
                                         int src_width, int src_height)
{
   mesa_format src_format, dst_format;
   GLint src_internal_format, dst_internal_format;
   GLuint src_view_texture = 0;
   struct gl_texture_image *src_view_tex_image;
   struct gl_framebuffer *readFb;
   struct gl_framebuffer *drawFb = NULL;
   bool success = false;
   GLbitfield mask;
   GLenum status, attachment;

   if (src_renderbuffer) {
      src_format = src_renderbuffer->Format;
      src_internal_format = src_renderbuffer->InternalFormat;
   } else {
      assert(src_tex_image);
      src_format = src_tex_image->TexFormat;
      src_internal_format = src_tex_image->InternalFormat;
   }

   if (dst_renderbuffer) {
      dst_format = dst_renderbuffer->Format;
      dst_internal_format = dst_renderbuffer->InternalFormat;
   } else {
      assert(dst_tex_image);
      dst_format = dst_tex_image->TexFormat;
      dst_internal_format = dst_tex_image->InternalFormat;
   }

   if (_mesa_is_format_compressed(src_format))
      return false;

   if (_mesa_is_format_compressed(dst_format))
      return false;

   if (src_internal_format == dst_internal_format) {
      src_view_tex_image = src_tex_image;
   } else {
      if (src_renderbuffer) {
         assert(src_tex_image == NULL);
         src_tex_image = wrap_renderbuffer(ctx, src_renderbuffer);
      }
      if (!make_view(ctx, src_tex_image, &src_view_tex_image, &src_view_texture,
                     dst_internal_format))
         goto cleanup;
   }

   /* We really only need to stash the bound framebuffers and scissor. */
   _mesa_meta_begin(ctx, MESA_META_SCISSOR);

   readFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
   if (readFb == NULL)
      goto meta_end;

   drawFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
   if (drawFb == NULL)
      goto meta_end;

   _mesa_bind_framebuffers(ctx, drawFb, readFb);

   switch (_mesa_get_format_base_format(src_format)) {
   case GL_DEPTH_COMPONENT:
      attachment = GL_DEPTH_ATTACHMENT;
      mask = GL_DEPTH_BUFFER_BIT;
      break;
   case GL_DEPTH_STENCIL:
      attachment = GL_DEPTH_STENCIL_ATTACHMENT;
      mask = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
      break;
   case GL_STENCIL_INDEX:
      attachment = GL_STENCIL_ATTACHMENT;
      mask = GL_STENCIL_BUFFER_BIT;
      break;
   default:
      attachment = GL_COLOR_ATTACHMENT0;
      mask = GL_COLOR_BUFFER_BIT;
      _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
      _mesa_ReadBuffer(GL_COLOR_ATTACHMENT0);
   }

   if (src_view_tex_image) {
      /* Prefer the tex image because, even if we have a renderbuffer, we may
       * have had to wrap it in a texture view.
       */
      _mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer, attachment,
                                           src_view_tex_image, src_z);
   } else {
      _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, attachment,
                                     src_renderbuffer);
   }

   status = _mesa_check_framebuffer_status(ctx, ctx->ReadBuffer);
   if (status != GL_FRAMEBUFFER_COMPLETE)
      goto meta_end;

   if (dst_renderbuffer) {
      _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, attachment,
                                     dst_renderbuffer);
   } else {
      _mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer, attachment,
                                           dst_tex_image, dst_z);
   }

   status = _mesa_check_framebuffer_status(ctx, ctx->DrawBuffer);
   if (status != GL_FRAMEBUFFER_COMPLETE)
      goto meta_end;

   /* Explicitly disable sRGB encoding */
   ctx->DrawBuffer->Visual.sRGBCapable = false;

   /* Since we've bound a new draw framebuffer, we need to update its
    * derived state -- _Xmin, etc -- for BlitFramebuffer's clipping to
    * be correct.
    */
   _mesa_update_state(ctx);

   /* We skip the core BlitFramebuffer checks for format consistency.
    * We have already created views to ensure that the texture formats
    * match.
    */
   ctx->Driver.BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
                               src_x, src_y,
                               src_x + src_width, src_y + src_height,
                               dst_x, dst_y,
                               dst_x + src_width, dst_y + src_height,
                               mask, GL_NEAREST);

   success = true;

meta_end:
   _mesa_reference_framebuffer(&readFb, NULL);
   _mesa_reference_framebuffer(&drawFb, NULL);
   _mesa_meta_end(ctx);

cleanup:
   _mesa_DeleteTextures(1, &src_view_texture);

   /* If we got a renderbuffer source, delete the temporary texture */
   if (src_renderbuffer && src_tex_image)
      ctx->Driver.DeleteTexture(ctx, src_tex_image->TexObject);

   return success;
}
/** A partial implementation of glCopyImageSubData
 *
 * This is a partial implementation of glCopyImageSubData that works only
 * if both textures are uncompressed and the destination texture is
 * renderable.  It uses a slight abuse of a texture view (see make_view) to
 * turn the source texture into the destination texture type and then uses
 * _mesa_meta_BlitFramebuffers to do the copy.
 */
bool
_mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
                                         struct gl_texture_image *src_tex_image,
                                         int src_x, int src_y, int src_z,
                                         struct gl_texture_image *dst_tex_image,
                                         int dst_x, int dst_y, int dst_z,
                                         int src_width, int src_height)
{
   GLuint src_view_texture = 0;
   struct gl_texture_image *src_view_tex_image;
   GLuint fbos[2];
   bool success = false;
   GLbitfield mask;
   GLenum status, attachment;

   if (_mesa_is_format_compressed(dst_tex_image->TexFormat))
      return false;

   if (_mesa_is_format_compressed(src_tex_image->TexFormat))
      return false;

   if (src_tex_image->InternalFormat == dst_tex_image->InternalFormat) {
      src_view_tex_image = src_tex_image;
   } else {
      if (!make_view(ctx, src_tex_image, &src_view_tex_image, &src_view_texture,
                     dst_tex_image->InternalFormat))
         goto cleanup;
   }

   /* We really only need to stash the bound framebuffers. */
   _mesa_meta_begin(ctx, 0);

   _mesa_GenFramebuffers(2, fbos);
   _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]);
   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);

   switch (_mesa_get_format_base_format(src_tex_image->TexFormat)) {
   case GL_DEPTH_COMPONENT:
      attachment = GL_DEPTH_ATTACHMENT;
      mask = GL_DEPTH_BUFFER_BIT;
      break;
   case GL_DEPTH_STENCIL:
      attachment = GL_DEPTH_STENCIL_ATTACHMENT;
      mask = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
      break;
   case GL_STENCIL_INDEX:
      attachment = GL_STENCIL_ATTACHMENT;
      mask = GL_STENCIL_BUFFER_BIT;
      break;
   default:
      attachment = GL_COLOR_ATTACHMENT0;
      mask = GL_COLOR_BUFFER_BIT;
      _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
      _mesa_ReadBuffer(GL_COLOR_ATTACHMENT0);
   }

   _mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, attachment,
                             src_view_tex_image, src_z);

   status = _mesa_CheckFramebufferStatus(GL_READ_FRAMEBUFFER);
   if (status != GL_FRAMEBUFFER_COMPLETE)
      goto meta_end;

   _mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, attachment,
                             dst_tex_image, dst_z);

   status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
   if (status != GL_FRAMEBUFFER_COMPLETE)
      goto meta_end;

   /* Since we've bound a new draw framebuffer, we need to update its
    * derived state -- _Xmin, etc -- for BlitFramebuffer's clipping to
    * be correct.
    */
   _mesa_update_state(ctx);

   /* We skip the core BlitFramebuffer checks for format consistency.
    * We have already created views to ensure that the texture formats
    * match.
    */
   ctx->Driver.BlitFramebuffer(ctx, src_x, src_y,
                               src_x + src_width, src_y + src_height,
                               dst_x, dst_y,
                               dst_x + src_width, dst_y + src_height,
                               mask, GL_NEAREST);

   success = true;

meta_end:
   _mesa_DeleteFramebuffers(2, fbos);
   _mesa_meta_end(ctx);

cleanup:
   _mesa_DeleteTextures(1, &src_view_texture);

   return success;
}
Beispiel #9
0
 // compute Jte at block level
 template<class Result, class J, class E, class Tag> inline void jte(Result& result, const J& j, const E& erreur, ttt::wrap<Tag> const&)
 {
   result -= transpose(j) * make_view(erreur,ttt::wrap<Tag>());
 }
Beispiel #10
0
void display()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	switch (style) {
	case 0:
		make_view(4);
		make_projection(4);
		glViewport(width / 2, 0, width / 2, height / 2);
		draw_scene();

		make_view(1);
		make_projection(1);
		glViewport(0, height / 2, width / 2, height / 2);
		draw_scene();
		make_view(1);
		draw_view();

		make_view(2);
		glViewport(width / 2, height / 2, width / 2, height / 2);
		draw_scene();
		make_view(2);
		draw_view();

		make_view(3);
		glViewport(0, 0, width / 2, height / 2);
		draw_scene();
		make_view(3);
		draw_view();
		break;

	case 1:
		make_view(1);
		make_projection(1);
		glViewport(0, 0, width, height);
		draw_scene();
		make_view(1);
		draw_view();
		break;

	case 2:
		make_view(2);
		glViewport(0, 0, width, height);
		draw_scene();
		make_view(2);
		draw_view();
		break;

	case 3:
		make_view(3);
		glViewport(0, 0, width, height);
		draw_scene();
		make_view(3);
		draw_view();
		break;
	case 4:
		glViewport(0, 0, width, height);
		make_view(4);
		make_projection(4);
		draw_scene();
		break;
	}
	/*-------Swap the back buffer to the front --------*/
	glutSwapBuffers();
	return;
}