merge mainline into ofwfb
This commit is contained in:
commit
e190e3d2cc
63 changed files with 7613 additions and 183 deletions
48
include/grub/bitmap_scale.h
Normal file
48
include/grub/bitmap_scale.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* bitmap_scale.h - Bitmap scaling functions. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_BITMAP_SCALE_HEADER
|
||||
#define GRUB_BITMAP_SCALE_HEADER 1
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/bitmap_scale.h>
|
||||
|
||||
enum grub_video_bitmap_scale_method
|
||||
{
|
||||
/* Choose the fastest interpolation algorithm. */
|
||||
GRUB_VIDEO_BITMAP_SCALE_METHOD_FASTEST,
|
||||
/* Choose the highest quality interpolation algorithm. */
|
||||
GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST,
|
||||
|
||||
/* Specific algorithms: */
|
||||
/* Nearest neighbor interpolation. */
|
||||
GRUB_VIDEO_BITMAP_SCALE_METHOD_NEAREST,
|
||||
/* Bilinear interpolation. */
|
||||
GRUB_VIDEO_BITMAP_SCALE_METHOD_BILINEAR
|
||||
};
|
||||
|
||||
grub_err_t
|
||||
grub_video_bitmap_create_scaled (struct grub_video_bitmap **dst,
|
||||
int dst_width, int dst_height,
|
||||
struct grub_video_bitmap *src,
|
||||
enum
|
||||
grub_video_bitmap_scale_method scale_method);
|
||||
|
||||
#endif /* ! GRUB_BITMAP_SCALE_HEADER */
|
1
include/grub/gfxmenu_model.h
Normal file
1
include/grub/gfxmenu_model.h
Normal file
|
@ -0,0 +1 @@
|
|||
|
107
include/grub/gfxmenu_view.h
Normal file
107
include/grub/gfxmenu_view.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
/* gfxmenu_view.h - gfxmenu view interface. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_GFXMENU_VIEW_HEADER
|
||||
#define GRUB_GFXMENU_VIEW_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/menu.h>
|
||||
#include <grub/font.h>
|
||||
#include <grub/gfxwidgets.h>
|
||||
|
||||
struct grub_gfxmenu_view; /* Forward declaration of opaque type. */
|
||||
typedef struct grub_gfxmenu_view *grub_gfxmenu_view_t;
|
||||
|
||||
|
||||
grub_gfxmenu_view_t grub_gfxmenu_view_new (const char *theme_path,
|
||||
int width, int height);
|
||||
|
||||
void grub_gfxmenu_view_destroy (grub_gfxmenu_view_t view);
|
||||
|
||||
/* Set properties on the view based on settings from the specified
|
||||
theme file. */
|
||||
grub_err_t grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view,
|
||||
const char *theme_path);
|
||||
|
||||
grub_err_t grub_gui_recreate_box (grub_gfxmenu_box_t *boxptr,
|
||||
const char *pattern, const char *theme_dir);
|
||||
|
||||
void grub_gfxmenu_view_draw (grub_gfxmenu_view_t view);
|
||||
|
||||
void
|
||||
grub_gfxmenu_redraw_menu (grub_gfxmenu_view_t view);
|
||||
|
||||
void
|
||||
grub_gfxmenu_redraw_timeout (grub_gfxmenu_view_t view);
|
||||
|
||||
void
|
||||
grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
|
||||
const grub_video_rect_t *region);
|
||||
|
||||
void
|
||||
grub_gfxmenu_clear_timeout (void *data);
|
||||
void
|
||||
grub_gfxmenu_print_timeout (int timeout, void *data);
|
||||
void
|
||||
grub_gfxmenu_set_chosen_entry (int entry, void *data);
|
||||
|
||||
/* Implementation details -- this should not be used outside of the
|
||||
view itself. */
|
||||
|
||||
#include <grub/video.h>
|
||||
#include <grub/bitmap.h>
|
||||
#include <grub/gui.h>
|
||||
#include <grub/gfxwidgets.h>
|
||||
#include <grub/icon_manager.h>
|
||||
|
||||
/* Definition of the private representation of the view. */
|
||||
struct grub_gfxmenu_view
|
||||
{
|
||||
grub_video_rect_t screen;
|
||||
|
||||
grub_font_t title_font;
|
||||
grub_font_t message_font;
|
||||
char *terminal_font_name;
|
||||
grub_gui_color_t title_color;
|
||||
grub_gui_color_t message_color;
|
||||
grub_gui_color_t message_bg_color;
|
||||
struct grub_video_bitmap *desktop_image;
|
||||
grub_gui_color_t desktop_color;
|
||||
grub_gfxmenu_box_t terminal_box;
|
||||
char *title_text;
|
||||
char *progress_message_text;
|
||||
char *theme_path;
|
||||
|
||||
grub_gui_container_t canvas;
|
||||
|
||||
int double_repaint;
|
||||
|
||||
int selected;
|
||||
|
||||
grub_video_rect_t progress_message_frame;
|
||||
|
||||
grub_menu_t menu;
|
||||
|
||||
int nested;
|
||||
|
||||
int first_timeout;
|
||||
};
|
||||
|
||||
#endif /* ! GRUB_GFXMENU_VIEW_HEADER */
|
44
include/grub/gfxterm.h
Normal file
44
include/grub/gfxterm.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_GFXTERM_HEADER
|
||||
#define GRUB_GFXTERM_HEADER 1
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
grub_err_t
|
||||
grub_gfxterm_set_window (struct grub_video_render_target *target,
|
||||
int x, int y, int width, int height,
|
||||
int double_repaint,
|
||||
const char *font_name, int border_width);
|
||||
|
||||
typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func);
|
||||
|
||||
void grub_gfxterm_schedule_repaint (void);
|
||||
|
||||
grub_err_t grub_gfxterm_fullscreen (void);
|
||||
|
||||
extern void (*grub_gfxterm_decorator_hook) (void);
|
||||
|
||||
#endif /* ! GRUB_GFXTERM_HEADER */
|
49
include/grub/gfxwidgets.h
Normal file
49
include/grub/gfxwidgets.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* gfxwidgets.h - Widgets for the graphical menu (gfxmenu). */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_GFXWIDGETS_HEADER
|
||||
#define GRUB_GFXWIDGETS_HEADER 1
|
||||
|
||||
#include <grub/video.h>
|
||||
|
||||
typedef struct grub_gfxmenu_box *grub_gfxmenu_box_t;
|
||||
|
||||
struct grub_gfxmenu_box
|
||||
{
|
||||
/* The size of the content. */
|
||||
int content_width;
|
||||
int content_height;
|
||||
|
||||
struct grub_video_bitmap **raw_pixmaps;
|
||||
struct grub_video_bitmap **scaled_pixmaps;
|
||||
|
||||
void (*draw) (grub_gfxmenu_box_t self, int x, int y);
|
||||
void (*set_content_size) (grub_gfxmenu_box_t self,
|
||||
int width, int height);
|
||||
int (*get_left_pad) (grub_gfxmenu_box_t self);
|
||||
int (*get_top_pad) (grub_gfxmenu_box_t self);
|
||||
int (*get_right_pad) (grub_gfxmenu_box_t self);
|
||||
int (*get_bottom_pad) (grub_gfxmenu_box_t self);
|
||||
void (*destroy) (grub_gfxmenu_box_t self);
|
||||
};
|
||||
|
||||
grub_gfxmenu_box_t grub_gfxmenu_create_box (const char *pixmaps_prefix,
|
||||
const char *pixmaps_suffix);
|
||||
|
||||
#endif /* ! GRUB_GFXWIDGETS_HEADER */
|
230
include/grub/gui.h
Normal file
230
include/grub/gui.h
Normal file
|
@ -0,0 +1,230 @@
|
|||
/* gui.h - GUI components header file. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/bitmap.h>
|
||||
#include <grub/gfxmenu_view.h>
|
||||
|
||||
#ifndef GRUB_GUI_H
|
||||
#define GRUB_GUI_H 1
|
||||
|
||||
/* A representation of a color. Unlike grub_video_color_t, this
|
||||
representation is independent of any video mode specifics. */
|
||||
typedef struct grub_gui_color
|
||||
{
|
||||
grub_uint8_t red;
|
||||
grub_uint8_t green;
|
||||
grub_uint8_t blue;
|
||||
grub_uint8_t alpha;
|
||||
} grub_gui_color_t;
|
||||
|
||||
typedef struct grub_gui_component *grub_gui_component_t;
|
||||
typedef struct grub_gui_container *grub_gui_container_t;
|
||||
typedef struct grub_gui_list *grub_gui_list_t;
|
||||
|
||||
typedef void (*grub_gui_component_callback) (grub_gui_component_t component,
|
||||
void *userdata);
|
||||
|
||||
/* Component interface. */
|
||||
|
||||
struct grub_gui_component_ops
|
||||
{
|
||||
void (*destroy) (void *self);
|
||||
const char * (*get_id) (void *self);
|
||||
int (*is_instance) (void *self, const char *type);
|
||||
void (*paint) (void *self, const grub_video_rect_t *bounds);
|
||||
void (*set_parent) (void *self, grub_gui_container_t parent);
|
||||
grub_gui_container_t (*get_parent) (void *self);
|
||||
void (*set_bounds) (void *self, const grub_video_rect_t *bounds);
|
||||
void (*get_bounds) (void *self, grub_video_rect_t *bounds);
|
||||
void (*get_minimal_size) (void *self, unsigned *width, unsigned *height);
|
||||
grub_err_t (*set_property) (void *self, const char *name, const char *value);
|
||||
void (*repaint) (void *self, int second_pass);
|
||||
};
|
||||
|
||||
struct grub_gui_container_ops
|
||||
{
|
||||
void (*add) (void *self, grub_gui_component_t comp);
|
||||
void (*remove) (void *self, grub_gui_component_t comp);
|
||||
void (*iterate_children) (void *self,
|
||||
grub_gui_component_callback cb, void *userdata);
|
||||
};
|
||||
|
||||
struct grub_gui_list_ops
|
||||
{
|
||||
void (*set_view_info) (void *self,
|
||||
grub_gfxmenu_view_t view);
|
||||
};
|
||||
|
||||
struct grub_gui_progress_ops
|
||||
{
|
||||
void (*set_state) (void *self, int visible, int start, int current, int end);
|
||||
};
|
||||
|
||||
typedef signed grub_fixed_signed_t;
|
||||
#define GRUB_FIXED_1 0x10000
|
||||
|
||||
static inline signed
|
||||
grub_fixed_sfs_divide (signed a, grub_fixed_signed_t b)
|
||||
{
|
||||
return (a * GRUB_FIXED_1) / b;
|
||||
}
|
||||
|
||||
static inline grub_fixed_signed_t
|
||||
grub_fixed_fsf_divide (grub_fixed_signed_t a, signed b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
static inline signed
|
||||
grub_fixed_sfs_multiply (signed a, grub_fixed_signed_t b)
|
||||
{
|
||||
return (a * b) / GRUB_FIXED_1;
|
||||
}
|
||||
|
||||
static inline signed
|
||||
grub_fixed_to_signed (grub_fixed_signed_t in)
|
||||
{
|
||||
return in / GRUB_FIXED_1;
|
||||
}
|
||||
|
||||
static inline grub_fixed_signed_t
|
||||
grub_signed_to_fixed (signed in)
|
||||
{
|
||||
return in * GRUB_FIXED_1;
|
||||
}
|
||||
|
||||
struct grub_gui_component
|
||||
{
|
||||
struct grub_gui_component_ops *ops;
|
||||
signed x;
|
||||
grub_fixed_signed_t xfrac;
|
||||
signed y;
|
||||
grub_fixed_signed_t yfrac;
|
||||
signed w;
|
||||
grub_fixed_signed_t wfrac;
|
||||
signed h;
|
||||
grub_fixed_signed_t hfrac;
|
||||
};
|
||||
|
||||
struct grub_gui_progress
|
||||
{
|
||||
struct grub_gui_component component;
|
||||
struct grub_gui_progress_ops *ops;
|
||||
};
|
||||
|
||||
struct grub_gui_container
|
||||
{
|
||||
struct grub_gui_component component;
|
||||
struct grub_gui_container_ops *ops;
|
||||
};
|
||||
|
||||
struct grub_gui_list
|
||||
{
|
||||
struct grub_gui_component component;
|
||||
struct grub_gui_list_ops *ops;
|
||||
};
|
||||
|
||||
|
||||
/* Interfaces to concrete component classes. */
|
||||
|
||||
grub_gui_container_t grub_gui_canvas_new (void);
|
||||
grub_gui_container_t grub_gui_vbox_new (void);
|
||||
grub_gui_container_t grub_gui_hbox_new (void);
|
||||
grub_gui_component_t grub_gui_label_new (void);
|
||||
grub_gui_component_t grub_gui_image_new (void);
|
||||
grub_gui_component_t grub_gui_progress_bar_new (void);
|
||||
grub_gui_component_t grub_gui_list_new (void);
|
||||
grub_gui_component_t grub_gui_circular_progress_new (void);
|
||||
|
||||
/* Manipulation functions. */
|
||||
|
||||
/* Visit all components with the specified ID. */
|
||||
void grub_gui_find_by_id (grub_gui_component_t root,
|
||||
const char *id,
|
||||
grub_gui_component_callback cb,
|
||||
void *userdata);
|
||||
|
||||
/* Visit all components. */
|
||||
void grub_gui_iterate_recursively (grub_gui_component_t root,
|
||||
grub_gui_component_callback cb,
|
||||
void *userdata);
|
||||
|
||||
/* Helper functions. */
|
||||
|
||||
static __inline void
|
||||
grub_gui_save_viewport (grub_video_rect_t *r)
|
||||
{
|
||||
grub_video_get_viewport ((unsigned *) &r->x,
|
||||
(unsigned *) &r->y,
|
||||
(unsigned *) &r->width,
|
||||
(unsigned *) &r->height);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
grub_gui_restore_viewport (const grub_video_rect_t *r)
|
||||
{
|
||||
grub_video_set_viewport (r->x, r->y, r->width, r->height);
|
||||
}
|
||||
|
||||
/* Set a new viewport relative the the current one, saving the current
|
||||
viewport in OLD so it can be later restored. */
|
||||
static __inline void
|
||||
grub_gui_set_viewport (const grub_video_rect_t *r, grub_video_rect_t *old)
|
||||
{
|
||||
grub_gui_save_viewport (old);
|
||||
grub_video_set_viewport (old->x + r->x,
|
||||
old->y + r->y,
|
||||
r->width,
|
||||
r->height);
|
||||
}
|
||||
|
||||
static __inline grub_gui_color_t
|
||||
grub_gui_color_rgb (int r, int g, int b)
|
||||
{
|
||||
grub_gui_color_t c;
|
||||
c.red = r;
|
||||
c.green = g;
|
||||
c.blue = b;
|
||||
c.alpha = 255;
|
||||
return c;
|
||||
}
|
||||
|
||||
static __inline grub_video_color_t
|
||||
grub_gui_map_color (grub_gui_color_t c)
|
||||
{
|
||||
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_video_have_common_points (const grub_video_rect_t *a,
|
||||
const grub_video_rect_t *b)
|
||||
{
|
||||
if (!((a->x <= b->x && b->x <= a->x + a->width)
|
||||
|| (b->x <= a->x && a->x <= b->x + b->width)))
|
||||
return 0;
|
||||
if (!((a->y <= b->y && b->y <= a->y + a->height)
|
||||
|| (b->y <= a->y && a->y <= b->y + b->height)))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_GUI_H */
|
37
include/grub/gui_string_util.h
Normal file
37
include/grub/gui_string_util.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* gui_string_util.h - String utilities for the graphical menu interface. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_GUI_STRING_UTIL_HEADER
|
||||
#define GRUB_GUI_STRING_UTIL_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/gui.h>
|
||||
|
||||
char *grub_new_substring (const char *buf,
|
||||
grub_size_t start, grub_size_t end);
|
||||
|
||||
char *grub_resolve_relative_path (const char *base, const char *path);
|
||||
|
||||
char *grub_get_dirname (const char *file_path);
|
||||
|
||||
int grub_gui_get_named_color (const char *name, grub_gui_color_t *color);
|
||||
|
||||
grub_err_t grub_gui_parse_color (const char *s, grub_gui_color_t *color);
|
||||
|
||||
#endif /* GRUB_GUI_STRING_UTIL_HEADER */
|
41
include/grub/icon_manager.h
Normal file
41
include/grub/icon_manager.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* icon_manager.h - gfxmenu icon manager. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_ICON_MANAGER_HEADER
|
||||
#define GRUB_ICON_MANAGER_HEADER 1
|
||||
|
||||
#include <grub/menu.h>
|
||||
#include <grub/bitmap.h>
|
||||
|
||||
/* Forward declaration of opaque structure handle type. */
|
||||
typedef struct grub_gfxmenu_icon_manager *grub_gfxmenu_icon_manager_t;
|
||||
|
||||
grub_gfxmenu_icon_manager_t grub_gfxmenu_icon_manager_new (void);
|
||||
void grub_gfxmenu_icon_manager_destroy (grub_gfxmenu_icon_manager_t mgr);
|
||||
void grub_gfxmenu_icon_manager_clear_cache (grub_gfxmenu_icon_manager_t mgr);
|
||||
void grub_gfxmenu_icon_manager_set_theme_path (grub_gfxmenu_icon_manager_t mgr,
|
||||
const char *path);
|
||||
void grub_gfxmenu_icon_manager_set_icon_size (grub_gfxmenu_icon_manager_t mgr,
|
||||
int width, int height);
|
||||
struct grub_video_bitmap *
|
||||
grub_gfxmenu_icon_manager_get_icon (grub_gfxmenu_icon_manager_t mgr,
|
||||
grub_menu_entry_t entry);
|
||||
|
||||
#endif /* GRUB_ICON_MANAGER_HEADER */
|
||||
|
|
@ -83,7 +83,6 @@ typedef struct grub_menu_execute_callback
|
|||
}
|
||||
*grub_menu_execute_callback_t;
|
||||
|
||||
|
||||
grub_menu_entry_t grub_menu_get_entry (grub_menu_t menu, int no);
|
||||
int grub_menu_get_timeout (void);
|
||||
void grub_menu_set_timeout (int timeout);
|
||||
|
@ -93,5 +92,6 @@ void grub_menu_execute_with_fallback (grub_menu_t menu,
|
|||
grub_menu_execute_callback_t callback,
|
||||
void *callback_data);
|
||||
void grub_menu_entry_run (grub_menu_entry_t entry);
|
||||
int grub_menu_get_default_entry_index (grub_menu_t menu);
|
||||
|
||||
#endif /* GRUB_MENU_HEADER */
|
||||
|
|
|
@ -110,6 +110,12 @@ char *EXPORT_FUNC(grub_strstr) (const char *haystack, const char *needle);
|
|||
int EXPORT_FUNC(grub_isspace) (int c);
|
||||
int EXPORT_FUNC(grub_isprint) (int c);
|
||||
|
||||
static inline int
|
||||
grub_iscntrl (int c)
|
||||
{
|
||||
return (c >= 0x00 && c <= 0x1F) || c == 0x7F;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isalpha (int c)
|
||||
{
|
||||
|
@ -128,6 +134,12 @@ grub_isdigit (int c)
|
|||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isalnum (int c)
|
||||
{
|
||||
return grub_isalpha (c) || grub_isdigit (c);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_tolower (int c)
|
||||
{
|
||||
|
@ -182,6 +194,43 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
|||
|
||||
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
||||
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
|
||||
|
||||
static inline long
|
||||
grub_strtol (const char *str, char **end, int base)
|
||||
{
|
||||
int negative = 0;
|
||||
unsigned long magnitude;
|
||||
|
||||
while (*str && grub_isspace (*str))
|
||||
str++;
|
||||
|
||||
if (*str == '-')
|
||||
{
|
||||
negative = 1;
|
||||
str++;
|
||||
}
|
||||
|
||||
magnitude = grub_strtoull (str, end, base);
|
||||
if (negative)
|
||||
{
|
||||
if (magnitude > (unsigned long) GRUB_LONG_MAX + 1)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, "negative overflow");
|
||||
return GRUB_LONG_MIN;
|
||||
}
|
||||
return -((long) magnitude);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (magnitude > GRUB_LONG_MAX)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, "positive overflow");
|
||||
return GRUB_LONG_MAX;
|
||||
}
|
||||
return (long) magnitude;
|
||||
}
|
||||
}
|
||||
|
||||
char *EXPORT_FUNC(grub_strdup) (const char *s);
|
||||
char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n);
|
||||
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
|
||||
|
|
44
include/grub/trig.h
Normal file
44
include/grub/trig.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* trig.h - Trigonometric function support. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_TRIG_HEADER
|
||||
#define GRUB_TRIG_HEADER 1
|
||||
|
||||
#define GRUB_TRIG_ANGLE_MAX 256
|
||||
#define GRUB_TRIG_ANGLE_MASK 255
|
||||
#define GRUB_TRIG_FRACTION_SCALE 16384
|
||||
|
||||
extern short grub_trig_sintab[];
|
||||
extern short grub_trig_costab[];
|
||||
|
||||
static __inline int
|
||||
grub_sin (int x)
|
||||
{
|
||||
x &= GRUB_TRIG_ANGLE_MASK;
|
||||
return grub_trig_sintab[x];
|
||||
}
|
||||
|
||||
static __inline int
|
||||
grub_cos (int x)
|
||||
{
|
||||
x &= GRUB_TRIG_ANGLE_MASK;
|
||||
return grub_trig_costab[x];
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_TRIG_HEADER */
|
|
@ -34,6 +34,10 @@ struct grub_video_render_target;
|
|||
struct grub_video_bitmap;
|
||||
|
||||
/* Defines used to describe video mode or rendering target. */
|
||||
/* If following is set render target contains currenly displayed image
|
||||
after swapping buffers (otherwise it contains previously displayed image).
|
||||
*/
|
||||
#define GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP 0x00000080
|
||||
#define GRUB_VIDEO_MODE_TYPE_PURE_TEXT 0x00000040
|
||||
#define GRUB_VIDEO_MODE_TYPE_ALPHA 0x00000020
|
||||
#define GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED 0x00000010
|
||||
|
@ -48,6 +52,8 @@ struct grub_video_bitmap;
|
|||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_MASK 0x0000ff00
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
|
||||
|
||||
/* The basic render target representing the whole display. This always
|
||||
renders to the back buffer when double-buffering is in use. */
|
||||
#define GRUB_VIDEO_RENDER_TARGET_DISPLAY \
|
||||
((struct grub_video_render_target *) 0)
|
||||
|
||||
|
@ -151,6 +157,16 @@ struct grub_video_mode_info
|
|||
grub_uint8_t fg_alpha;
|
||||
};
|
||||
|
||||
/* A 2D rectangle type. */
|
||||
struct grub_video_rect
|
||||
{
|
||||
unsigned x;
|
||||
unsigned y;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
};
|
||||
typedef struct grub_video_rect grub_video_rect_t;
|
||||
|
||||
struct grub_video_palette_data
|
||||
{
|
||||
grub_uint8_t r; /* Red color value (0-255). */
|
||||
|
|
|
@ -115,4 +115,15 @@ grub_video_fb_get_active_render_target (struct grub_video_fbrender_target **targ
|
|||
grub_err_t
|
||||
grub_video_fb_set_active_render_target (struct grub_video_fbrender_target *target);
|
||||
|
||||
typedef grub_err_t
|
||||
(*grub_video_fb_doublebuf_update_screen_t) (struct grub_video_fbrender_target *front,
|
||||
struct grub_video_fbrender_target *back);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_doublebuf_blit_init (struct grub_video_fbrender_target **front,
|
||||
struct grub_video_fbrender_target **back,
|
||||
grub_video_fb_doublebuf_update_screen_t *update_screen,
|
||||
struct grub_video_mode_info mode_info,
|
||||
void *framebuf);
|
||||
|
||||
#endif /* ! GRUB_VIDEO_FB_HEADER */
|
||||
|
|
|
@ -108,5 +108,8 @@ extern grub_uint32_t grub_xnu_heap_real_start;
|
|||
extern grub_size_t grub_xnu_heap_size;
|
||||
extern void *grub_xnu_heap_start;
|
||||
extern struct grub_video_bitmap *grub_xnu_bitmap;
|
||||
typedef enum {GRUB_XNU_BITMAP_CENTER, GRUB_XNU_BITMAP_STRETCH}
|
||||
grub_xnu_bitmap_mode_t;
|
||||
extern grub_xnu_bitmap_mode_t grub_xnu_bitmap_mode;
|
||||
extern int grub_xnu_is_64bit;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue