Back to index

gcompris  8.2.2
Defines | Typedefs | Enumerations | Functions
gcompris.h File Reference
#include <libgnomecanvas/libgnomecanvas.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
#include <libintl.h>
#include <gmodule.h>
#include "plugin.h"
#include "gcompris-board.h"
#include "board.h"
#include "board_config.h"
#include "properties.h"
#include "gameutil.h"
#include "gc_net.h"
#include "bonus.h"
#include "timer.h"
#include "score.h"
#include "skin.h"
#include "anim.h"
#include "profile.h"
#include "gcompris_db.h"
#include "wordlist.h"
#include "gcompris_im.h"
#include "gcompris_alphabeta.h"

Go to the source code of this file.

Defines

#define BOARDWIDTH   800
#define BOARDHEIGHT   520
#define BARHEIGHT   80
#define DEFAULT_SKIN   "gartoon"
#define _(String)   gettext (String)
#define gettext_noop(String)   String
#define GCOMPRIS_LOG_STATUS_PASSED   "PASSED"
#define GCOMPRIS_LOG_STATUS_FAILED   "FAILED"
#define GCOMPRIS_LOG_STATUS_DRAW   "DRAW"
#define GCOMPRIS_LOG_STATUS_COMPLETED   "COMPLETED"
#define COLOR_TITLE   0x0F0FC0FF
#define COLOR_TEXT_BUTTON   0x0F0FC0FF
#define COLOR_CONTENT   0x0D0DFAFF
#define COLOR_SUBTITLE   0xB00400FF
#define COLOR_SHADOW   0x000000FF
#define FONT_TITLE   "Sans 20"
#define FONT_TITLE_FALLBACK   "Sans 12"
#define FONT_SUBTITLE   "Sans 16"
#define FONT_SUBTITLE_FALLBACK   "Sans 12"
#define FONT_CONTENT   "Sans 12"
#define FONT_CONTENT_FALLBACK   "Sans 12"
#define FONT_BOARD_TINY   "Sans 10"
#define FONT_BOARD_SMALL   "Sans 12"
#define FONT_BOARD_MEDIUM   "Sans 14"
#define FONT_BOARD_BIG   "Sans 16"
#define FONT_BOARD_BIG_BOLD   "Sans bold 16"
#define FONT_BOARD_FIXED   "Fixed 12"
#define FONT_BOARD_TITLE   "Sans 20"
#define FONT_BOARD_TITLE_BOLD   "Sans bold 20"
#define FONT_BOARD_HUGE   "Sans 28"
#define FONT_BOARD_HUGE_BOLD   "Sans bold 28"
#define GCOMPRIS_FIRST_CUSTOM_CURSOR   1000
#define GCOMPRIS_BIG_RED_ARROW_CURSOR   1001
#define GCOMPRIS_BIRD_CURSOR   1002
#define GCOMPRIS_LINE_CURSOR   1003
#define GCOMPRIS_FILLRECT_CURSOR   1004
#define GCOMPRIS_RECT_CURSOR   1005
#define GCOMPRIS_FILLCIRCLE_CURSOR   1006
#define GCOMPRIS_CIRCLE_CURSOR   1007
#define GCOMPRIS_DEL_CURSOR   1008
#define GCOMPRIS_FILL_CURSOR   1009
#define GCOMPRIS_SELECT_CURSOR   1010
#define GCOMPRIS_DEFAULT_CURSOR   GCOMPRIS_BIG_RED_ARROW_CURSOR

Typedefs

typedef void(* ImageSelectorCallBack )(gchar *image)
typedef void(* FileSelectorCallBack )(gchar *file, gchar *file_type)
typedef void(* DialogBoxCallBack )()
typedef void(* ConfirmCallBack )(gboolean answer)

Enumerations

enum  GComprisBarFlags {
  GC_BAR_LEVEL = 1 << 0, GC_BAR_OK = 1 << 1, GC_BAR_REPEAT = 1 << 2, GC_BAR_CONFIG = 1 << 3,
  GC_BAR_ABOUT = 1 << 4, GC_BAR_REPEAT_ICON = 1 << 5, GC_BAR_QUIT = 1 << 6
}
enum  GcomprisFilterType { GCOMPRIS_FILTER_NONE, GCOMPRIS_FILTER_EQUAL, GCOMPRIS_FILTER_UNDER, GCOMPRIS_FILTER_ABOVE }

Functions

void gc_board_end (void)
 Call me to end an activity.
void gc_bar_start (GnomeCanvas *theCanvas)
GnomeCanvasItem * gc_set_background (GnomeCanvasGroup *parent, gchar *file)
void gc_bar_set_level (GcomprisBoard *gcomprisBoard)
void gc_bar_set_repeat_icon (GdkPixbuf *pixmap)
void gc_bar_set (const GComprisBarFlags flags)
void gc_bar_hide (gboolean hide)
GnomeCanvas * gc_get_canvas (void)
 Return the main canvas we run in.
GtkWidget * gc_get_window (void)
void gc_ignore_next_focus_out (void)
const gchar * gc_locale_get (void)
void gc_locale_set (gchar *locale)
char * gc_locale_get_user_default (void)
gchar * gc_locale_get_name (gchar *locale)
 Given the locale name, return the full translated name If not found, simply return the name.
void gc_cursor_set (guint gdk_cursor_type)
void gc_selector_images_start (GcomprisBoard *gcomprisBoard, gchar *dataset, ImageSelectorCallBack imscb)
void gc_selector_images_stop (void)
void gc_selector_file_load (GcomprisBoard *gcomprisBoard, gchar *rootdir, gchar *file_types, FileSelectorCallBack fscb)
void gc_selector_file_save (GcomprisBoard *gcomprisBoard, gchar *rootdir, gchar *file_types, FileSelectorCallBack fscb)
void gc_selector_file_stop (void)
gchar * gc_db_get_filename ()
void gc_dialog (gchar *str, DialogBoxCallBack dbcb)
void gc_dialog_close ()
void gc_confirm_box (gchar *title, gchar *question_text, gchar *yes_text, gchar *no_text, ConfirmCallBack iscb)
void gc_confirm_box_stop (void)
int gc_canvas_item_grab (GnomeCanvasItem *item, unsigned int event_mask, GdkCursor *cursor, guint32 etime)
void gc_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime)
void gc_log_set_comment (GcomprisBoard *gcomprisBoard, gchar *expected, gchar *got)
 gc_log_set_comment
void gc_log_end (GcomprisBoard *gcomprisBoard, gchar *status)
 gc_log_end
GList * gc_menu_getlist (gchar *section)
GcomprisBoard * gc_menu_section_get (gchar *section)
GList * gc_menu_get_boards ()

Define Documentation

#define _ (   String)    gettext (String)

Definition at line 72 of file gcompris.h.

#define BARHEIGHT   80

Definition at line 68 of file gcompris.h.

#define BOARDHEIGHT   520

Definition at line 67 of file gcompris.h.

#define BOARDWIDTH   800

Definition at line 66 of file gcompris.h.

#define COLOR_CONTENT   0x0D0DFAFF

Definition at line 189 of file gcompris.h.

#define COLOR_SHADOW   0x000000FF

Definition at line 191 of file gcompris.h.

#define COLOR_SUBTITLE   0xB00400FF

Definition at line 190 of file gcompris.h.

#define COLOR_TEXT_BUTTON   0x0F0FC0FF

Definition at line 188 of file gcompris.h.

#define COLOR_TITLE   0x0F0FC0FF

Definition at line 187 of file gcompris.h.

#define DEFAULT_SKIN   "gartoon"

Definition at line 70 of file gcompris.h.

#define FONT_BOARD_BIG   "Sans 16"

Definition at line 203 of file gcompris.h.

#define FONT_BOARD_BIG_BOLD   "Sans bold 16"

Definition at line 204 of file gcompris.h.

#define FONT_BOARD_FIXED   "Fixed 12"

Definition at line 205 of file gcompris.h.

#define FONT_BOARD_HUGE   "Sans 28"

Definition at line 208 of file gcompris.h.

#define FONT_BOARD_HUGE_BOLD   "Sans bold 28"

Definition at line 209 of file gcompris.h.

#define FONT_BOARD_MEDIUM   "Sans 14"

Definition at line 202 of file gcompris.h.

#define FONT_BOARD_SMALL   "Sans 12"

Definition at line 201 of file gcompris.h.

#define FONT_BOARD_TINY   "Sans 10"

Definition at line 200 of file gcompris.h.

#define FONT_BOARD_TITLE   "Sans 20"

Definition at line 206 of file gcompris.h.

#define FONT_BOARD_TITLE_BOLD   "Sans bold 20"

Definition at line 207 of file gcompris.h.

#define FONT_CONTENT   "Sans 12"

Definition at line 197 of file gcompris.h.

#define FONT_CONTENT_FALLBACK   "Sans 12"

Definition at line 198 of file gcompris.h.

#define FONT_SUBTITLE   "Sans 16"

Definition at line 195 of file gcompris.h.

#define FONT_SUBTITLE_FALLBACK   "Sans 12"

Definition at line 196 of file gcompris.h.

#define FONT_TITLE   "Sans 20"

Definition at line 193 of file gcompris.h.

#define FONT_TITLE_FALLBACK   "Sans 12"

Definition at line 194 of file gcompris.h.

#define GCOMPRIS_BIG_RED_ARROW_CURSOR   1001

Definition at line 215 of file gcompris.h.

#define GCOMPRIS_BIRD_CURSOR   1002

Definition at line 216 of file gcompris.h.

#define GCOMPRIS_CIRCLE_CURSOR   1007

Definition at line 221 of file gcompris.h.

Definition at line 226 of file gcompris.h.

#define GCOMPRIS_DEL_CURSOR   1008

Definition at line 222 of file gcompris.h.

#define GCOMPRIS_FILL_CURSOR   1009

Definition at line 223 of file gcompris.h.

#define GCOMPRIS_FILLCIRCLE_CURSOR   1006

Definition at line 220 of file gcompris.h.

#define GCOMPRIS_FILLRECT_CURSOR   1004

Definition at line 218 of file gcompris.h.

#define GCOMPRIS_FIRST_CUSTOM_CURSOR   1000

Definition at line 214 of file gcompris.h.

#define GCOMPRIS_LINE_CURSOR   1003

Definition at line 217 of file gcompris.h.

#define GCOMPRIS_LOG_STATUS_COMPLETED   "COMPLETED"

Definition at line 171 of file gcompris.h.

#define GCOMPRIS_LOG_STATUS_DRAW   "DRAW"

Definition at line 170 of file gcompris.h.

#define GCOMPRIS_LOG_STATUS_FAILED   "FAILED"

Definition at line 169 of file gcompris.h.

#define GCOMPRIS_LOG_STATUS_PASSED   "PASSED"

Definition at line 168 of file gcompris.h.

#define GCOMPRIS_RECT_CURSOR   1005

Definition at line 219 of file gcompris.h.

#define GCOMPRIS_SELECT_CURSOR   1010

Definition at line 224 of file gcompris.h.

#define gettext_noop (   String)    String

Definition at line 73 of file gcompris.h.


Typedef Documentation

typedef void(* ConfirmCallBack)(gboolean answer)

Definition at line 151 of file gcompris.h.

typedef void(* DialogBoxCallBack)()

Definition at line 146 of file gcompris.h.

typedef void(* FileSelectorCallBack)(gchar *file, gchar *file_type)

Definition at line 132 of file gcompris.h.

typedef void(* ImageSelectorCallBack)(gchar *image)

Definition at line 126 of file gcompris.h.


Enumeration Type Documentation

Enumerator:
GC_BAR_LEVEL 
GC_BAR_OK 
GC_BAR_REPEAT 
GC_BAR_CONFIG 
GC_BAR_ABOUT 
GC_BAR_REPEAT_ICON 
GC_BAR_QUIT 

Definition at line 92 of file gcompris.h.

{
  GC_BAR_LEVEL          = 1 << 0,
  GC_BAR_OK      = 1 << 1,
  GC_BAR_REPEAT         = 1 << 2,
  GC_BAR_CONFIG         = 1 << 3,
  GC_BAR_ABOUT          = 1 << 4,
  GC_BAR_REPEAT_ICON = 1 << 5,
  GC_BAR_QUIT    = 1 << 6,
} GComprisBarFlags;
Enumerator:
GCOMPRIS_FILTER_NONE 
GCOMPRIS_FILTER_EQUAL 
GCOMPRIS_FILTER_UNDER 
GCOMPRIS_FILTER_ABOVE 

Definition at line 104 of file gcompris.h.


Function Documentation

void gc_bar_hide ( gboolean  hide)

Definition at line 394 of file bar.c.

{
  if(hide)
    {
      if(exit_item)
       gnome_canvas_item_hide(exit_item);
      gnome_canvas_item_hide(home_item);
      gnome_canvas_item_hide(level_item);
      gnome_canvas_item_hide(ok_item);
      gnome_canvas_item_hide(help_item);
      gnome_canvas_item_hide(repeat_item);
      if(config_item)
       gnome_canvas_item_hide(config_item);
      gnome_canvas_item_hide(about_item);
    }
  else
    {
      gnome_canvas_item_show(home_item);
      gc_bar_set(current_flags);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_bar_set ( const GComprisBarFlags  flags)

Definition at line 334 of file bar.c.

{

  current_flags = flags;

  update_exit_button();

  if(flags&GC_BAR_LEVEL)
    gnome_canvas_item_show(level_item);
  else
    gnome_canvas_item_hide(level_item);

  if(flags&GC_BAR_OK)
    gnome_canvas_item_show(ok_item);
  else
    gnome_canvas_item_hide(ok_item);

  if(gc_help_has_board(gc_board_get_current()))
    gnome_canvas_item_show(help_item);
  else
    gnome_canvas_item_hide(help_item);

  if(flags&GC_BAR_REPEAT) {
    GdkPixbuf *pixmap;

    /* Set the repeat icon to the original one */
    pixmap = gc_skin_pixmap_load("repeat.png");
    gnome_canvas_item_set (repeat_item,
                        "pixbuf", pixmap,
                        NULL);
    gdk_pixbuf_unref(pixmap);

    gnome_canvas_item_show(repeat_item);
  } else {

    if(flags&GC_BAR_REPEAT_ICON)
      gnome_canvas_item_show(repeat_item);
    else
      gnome_canvas_item_hide(repeat_item);
  }

  if(flags&GC_BAR_CONFIG && config_item)
    gnome_canvas_item_show(config_item);
  else
    gnome_canvas_item_hide(config_item);

  if(flags&GC_BAR_ABOUT)
    gnome_canvas_item_show(about_item);
  else
    gnome_canvas_item_hide(about_item);

  /* FIXME : Workaround for bugged canvas */
  //  gnome_canvas_update_now(gc_board_get_current()->canvas);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_bar_set_level ( GcomprisBoard *  gcomprisBoard)

Definition at line 280 of file bar.c.

{
  char *str = NULL;
  GdkPixbuf *pixmap = NULL;

  /* Non yet initialized : Something Wrong */
  if(level_item==NULL)
    {
      g_message("in bar_set_level, level_item uninitialized : should not happen\n");
      return;
    }

  if(gcomprisBoard!=NULL)
    {

      str = g_strdup_printf("level%d.png", gcomprisBoard->level);
      pixmap = gc_skin_pixmap_load(str);

      g_free(str);
      /* Warning changing the image needs to free the focus first */
      gc_item_focus_free(level_item, NULL);

      gnome_canvas_item_set (level_item,
                          "pixbuf", pixmap,
                          NULL);
      gdk_pixbuf_unref(pixmap);
    }

  current_level=gcomprisBoard->level;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_bar_set_repeat_icon ( GdkPixbuf *  pixmap)

Definition at line 323 of file bar.c.

{
  /* Warning changing the image needs to update pixbuf_ref for the focus usage */
  gc_item_focus_free(repeat_item, NULL);
  gnome_canvas_item_set (repeat_item,
                      "pixbuf", pixmap,
                      NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_bar_start ( GnomeCanvas *  theCanvas)

Definition at line 70 of file bar.c.

{
  GcomprisProperties *properties = gc_prop_get();
  GdkPixbuf   *pixmap = NULL;
  GnomeCanvasItem *rootitem;
  gint16           width, height;
  double           zoom;

  width  = BOARDWIDTH;
  height = BARHEIGHT-2;

  bar_reset_sound_id();

  rootitem = \
    gnome_canvas_item_new (gnome_canvas_root(theCanvas),
                        gnome_canvas_group_get_type (),
                        "x", (double)0,
                        "y", (double)0,
                        NULL);

  pixmap = gc_skin_pixmap_load("bar_bg.jpg");
  bar_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) 0,
                            "y", (double) 0,
                            NULL);
  gdk_pixbuf_unref(pixmap);

  // EXIT
  if(properties->disable_quit == 0)
    {
      pixmap = gc_skin_pixmap_load("button_exit.png");
      zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
      exit_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                    gnome_canvas_pixbuf_get_type (),
                                    "pixbuf", pixmap,
                                    "x", (double) (width/NUMBER_OF_ITEMS) * 1 -
                                    gdk_pixbuf_get_width(pixmap)/2,
                                    "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                                    NULL);
      gdk_pixbuf_unref(pixmap);

      gtk_signal_connect(GTK_OBJECT(exit_item), "event",
                      (GtkSignalFunc) item_event_bar,
                      "quit");

      gtk_signal_connect(GTK_OBJECT(exit_item), "event",
                      (GtkSignalFunc) gc_item_focus_event,
                      NULL);
    }

  // HOME
  pixmap = gc_skin_pixmap_load("home.png");
  zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
  home_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                 gnome_canvas_pixbuf_get_type (),
                                 "pixbuf", pixmap,
                                 "x", (double) (width/NUMBER_OF_ITEMS) * 9 -
                                 gdk_pixbuf_get_width(pixmap)/2,
                                 "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                                 NULL);
  gdk_pixbuf_unref(pixmap);

  gtk_signal_connect(GTK_OBJECT(home_item), "event",
                   (GtkSignalFunc) item_event_bar,
                   "back");

  gtk_signal_connect(GTK_OBJECT(home_item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);


  // OK
  pixmap = gc_skin_pixmap_load("ok.png");
  zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
  ok_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                               gnome_canvas_pixbuf_get_type (),
                               "pixbuf", pixmap,
                               "x", (double) (width/NUMBER_OF_ITEMS) * 7 -
                               gdk_pixbuf_get_width(pixmap)/2,
                               "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                               NULL);
  gdk_pixbuf_unref(pixmap);

  gtk_signal_connect(GTK_OBJECT(ok_item), "event",
                   (GtkSignalFunc) item_event_bar,
                   "ok");

  gtk_signal_connect(GTK_OBJECT(ok_item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);


  // LEVEL
  pixmap = gc_skin_pixmap_load("level1.png");
  zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
  level_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                  gnome_canvas_pixbuf_get_type (),
                                  "pixbuf", pixmap,
                                  "x", (double) (width/NUMBER_OF_ITEMS) * 5 -
                                  gdk_pixbuf_get_width(pixmap)/2,
                                  "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                                  NULL);
  gdk_pixbuf_unref(pixmap);

  current_level = 1;
  gtk_signal_connect(GTK_OBJECT(level_item), "event",
                   (GtkSignalFunc) item_event_bar,
                   "level");

  level_handler_id =   gtk_signal_connect(GTK_OBJECT(level_item), "event",
                                     (GtkSignalFunc) gc_item_focus_event,
                                     NULL);

  // REPEAT
  pixmap = gc_skin_pixmap_load("repeat.png");
  zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
  repeat_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                   gnome_canvas_pixbuf_get_type (),
                                   "pixbuf", pixmap,
                                   "x", (double) (width/NUMBER_OF_ITEMS) * 6 -
                                   gdk_pixbuf_get_width(pixmap)/2,
                                   "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                                   NULL);
  gdk_pixbuf_unref(pixmap);

  gtk_signal_connect(GTK_OBJECT(repeat_item), "event",
                   (GtkSignalFunc) item_event_bar,
                   "repeat");

  gtk_signal_connect(GTK_OBJECT(repeat_item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);

  // HELP
  pixmap = gc_skin_pixmap_load("help.png");
  zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
  help_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                 gnome_canvas_pixbuf_get_type (),
                                 "pixbuf", pixmap,
                                 "x", (double) (width/NUMBER_OF_ITEMS) * 4 -
                                 gdk_pixbuf_get_width(pixmap)/2,
                                 "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                                 NULL);
  gdk_pixbuf_unref(pixmap);

  gtk_signal_connect(GTK_OBJECT(help_item), "event",
                   (GtkSignalFunc) item_event_bar,
                   "help");

  gtk_signal_connect(GTK_OBJECT(help_item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);

  // CONFIG
  if(properties->disable_config == 0)
    {
      pixmap = gc_skin_pixmap_load("config.png");
      zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
      config_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                      gnome_canvas_pixbuf_get_type (),
                                      "pixbuf", pixmap,
                                      "x", (double) (width/NUMBER_OF_ITEMS) * 3 -
                                      gdk_pixbuf_get_width(pixmap)/2,
                                      "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                                      NULL);
      gdk_pixbuf_unref(pixmap);

      gtk_signal_connect(GTK_OBJECT(config_item), "event",
                      (GtkSignalFunc) item_event_bar,
                      "configuration");

      gtk_signal_connect(GTK_OBJECT(config_item), "event",
                      (GtkSignalFunc) gc_item_focus_event,
                      NULL);
    }

  // ABOUT
  pixmap = gc_skin_pixmap_load("about.png");
  zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
  about_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                 gnome_canvas_pixbuf_get_type (),
                                 "pixbuf", pixmap,
                                 "x", (double) (width/NUMBER_OF_ITEMS) * 2 -
                                 gdk_pixbuf_get_width(pixmap)/2,
                                 "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2,
                                 NULL);
  gdk_pixbuf_unref(pixmap);

  gtk_signal_connect(GTK_OBJECT(about_item), "event",
                   (GtkSignalFunc) item_event_bar,
                   "about");

  gtk_signal_connect(GTK_OBJECT(about_item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);

  // Show them all
  update_exit_button();
  gnome_canvas_item_hide(level_item);
  gnome_canvas_item_hide(ok_item);
  gnome_canvas_item_hide(help_item);
  gnome_canvas_item_hide(repeat_item);
  if(config_item)
    gnome_canvas_item_hide(config_item);
  gnome_canvas_item_hide(about_item);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_board_end ( void  )

Call me to end an activity.

Definition at line 938 of file gcompris.c.

{
  if (gc_board_get_current()->previous_board) {
    /* Run the previous board */
    gc_board_play(gc_board_get_current()->previous_board);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int gc_canvas_item_grab ( GnomeCanvasItem *  item,
unsigned int  event_mask,
GdkCursor *  cursor,
guint32  etime 
)

Definition at line 985 of file gcompris.c.

{
  int retval;

  retval = gnome_canvas_item_grab(item, event_mask, cursor, etime);
  if (retval != GDK_GRAB_SUCCESS)
    return retval;

#ifdef XF86_VIDMODE
  /* When fullscreen override mouse grab with our own which
     confines the cursor to our fullscreen window */
  if (XF86VidModeData.fullscreen_active)
    if (gdk_pointer_grab(item->canvas->layout.bin_window, FALSE, event_mask,
          window->window, cursor, etime+1) != GDK_GRAB_SUCCESS)
      g_warning("Pointer grab failed");
#endif

  return retval;
}

Here is the caller graph for this function:

void gc_canvas_item_ungrab ( GnomeCanvasItem *  item,
guint32  etime 
)

Definition at line 1006 of file gcompris.c.

{
  gnome_canvas_item_ungrab(item, etime);
#ifdef XF86_VIDMODE
  /* When fullscreen restore the normal mouse grab which avoids
     scrolling the virtual desktop */
  if (XF86VidModeData.fullscreen_active)
    if (gdk_pointer_grab(window->window, TRUE, 0, window->window, NULL,
          etime+1) != GDK_GRAB_SUCCESS)
      g_warning("Pointer grab failed");
#endif
}

Here is the caller graph for this function:

void gc_confirm_box ( gchar *  title,
gchar *  question_text,
gchar *  yes_text,
gchar *  no_text,
ConfirmCallBack  iscb 
)

Definition at line 110 of file gcompris_confirm.c.

{
  display_confirm(title, 
                question_text, 
                yes_text,
                no_text,
                iscb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_confirm_box_stop ( void  )

Definition at line 128 of file gcompris_confirm.c.

{
  GcomprisBoard *gcomprisBoard = gc_board_get_current();

  // Destroy the box
  /* FIXME: Crashes randomly */
  if(rootitem!=NULL)
    {
      /* WORKAROUND: There is a bug in the richtex item and we need to remove it first */
      while (g_idle_remove_by_data (richtext));
      gtk_object_destroy (GTK_OBJECT(richtext));
      while (g_idle_remove_by_data (richtext_s));
      gtk_object_destroy (GTK_OBJECT(richtext_s));
      gtk_object_destroy(GTK_OBJECT(rootitem));
    }

  rootitem = NULL;     

  if(gcomprisBoard!=NULL && confirm_displayed)
    gc_board_pause(FALSE);

  gc_bar_hide(FALSE);
  confirm_displayed = FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_cursor_set ( guint  gdk_cursor_type)

Definition at line 531 of file gcompris.c.

{
  GdkCursor *cursor;

  // Little hack to force gcompris to use the default cursor
  if(gdk_cursor_type==GCOMPRIS_DEFAULT_CURSOR)
    gdk_cursor_type=properties->defaultcursor;

  // I suppose there is less than GCOMPRIS_FIRST_CUSTOM_CURSOR cursors defined in gdkcursors.h !
  if (gdk_cursor_type < GCOMPRIS_FIRST_CUSTOM_CURSOR) {
    cursor = gdk_cursor_new(gdk_cursor_type);
    gdk_window_set_cursor (window->window, cursor);
    gdk_cursor_destroy(cursor);
  } else { // we use a custom cursor
    GdkColor fg, bg;
    //    static const gchar * cursor;
    static const gchar ** bits;

    gdk_color_parse("rgb:FFFF/FFFF/FFFF",&fg);
    gdk_color_parse("rgb:FFFF/3FFF/0000",&bg);

    gdk_color_parse("black",&fg);
    gdk_color_parse("red",&bg);

    switch (gdk_cursor_type) {
    case GCOMPRIS_BIG_RED_ARROW_CURSOR :
      bits = big_red_arrow_cursor_bits;
      break;
    case GCOMPRIS_BIRD_CURSOR :
      bits = bird_cursor_bits;
      break;
    case GCOMPRIS_LINE_CURSOR :
      bits = big_red_line_cursor_bits;
      break;
    case GCOMPRIS_RECT_CURSOR :
      bits = big_red_rectangle_cursor_bits;
      break;
    case GCOMPRIS_FILLRECT_CURSOR :
      bits = big_red_filledrectangle_cursor_bits;
      break;
    case GCOMPRIS_CIRCLE_CURSOR :
      bits = big_red_circle_cursor_bits;
      break;
    case GCOMPRIS_FILLCIRCLE_CURSOR :
      bits = big_red_filledcircle_cursor_bits;
      break;
    case GCOMPRIS_FILL_CURSOR :
      bits = big_red_fill_cursor_bits;
      break;
    case GCOMPRIS_DEL_CURSOR :
      bits = big_red_del_cursor_bits;
      break;
    case GCOMPRIS_SELECT_CURSOR :
      bits = big_red_select_cursor_bits;
      break;
    default : bits = big_red_arrow_cursor_bits;
    }

    cursor = gdk_cursor_new_from_data(bits, 40 , 40, &fg, &bg, 0, 0);
    if(cursor)
      {
       gdk_window_set_cursor(window->window, cursor);
       gdk_cursor_unref(cursor);
      }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

gchar* gc_db_get_filename ( )

Definition at line 1144 of file gcompris.c.

{
  g_assert(properties!=NULL);

  return (properties->database);
}

Here is the caller graph for this function:

void gc_dialog ( gchar *  str,
DialogBoxCallBack  dbcb 
)

Definition at line 56 of file dialog.c.

{
  GnomeCanvasItem *item_text   = NULL;
  GnomeCanvasItem *item_text_ok   = NULL;
  GdkPixbuf       *pixmap_dialog = NULL;
  GtkTextIter      iter_start, iter_end;
  GtkTextBuffer   *buffer;
  GtkTextTag      *txt_tag;

  g_warning("Dialog=%s\n", str);

  /* If we are already running do nothing */
  if(rootDialogItem) {
    g_warning("Cannot run a dialog box, one is already running. Message = %s\n", str);
    return;
  }

  /* First pause the board */
  gc_board_pause(TRUE);

  gc_bar_hide(TRUE);

  rootDialogItem = \
    GNOME_CANVAS_GROUP(gnome_canvas_item_new (gnome_canvas_root(gc_get_canvas()),
                                         gnome_canvas_group_get_type (),
                                         "x", (double) 0,
                                         "y", (double) 0,
                                         NULL));

  pixmap_dialog = gc_skin_pixmap_load("dialogbox.png");

  itemDialogText = gnome_canvas_item_new (rootDialogItem,
                                   gnome_canvas_pixbuf_get_type (),
                                   "pixbuf", pixmap_dialog,
                                   "x", (double) (BOARDWIDTH - gdk_pixbuf_get_width(pixmap_dialog))/2,
                                   "y", (double) (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap_dialog))/2,
                                  NULL);

  /* OK Text */
  item_text_ok = gnome_canvas_item_new (rootDialogItem,
                                   gnome_canvas_text_get_type (),
                                   "text", _("OK"),
                                   "font", gc_skin_font_title,
                                   "x", (double)  BOARDWIDTH*0.5,
                                   "y", (double)  (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap_dialog))/2 +
                                   gdk_pixbuf_get_height(pixmap_dialog) - 35,
                                   "anchor", GTK_ANCHOR_CENTER,
                                   "fill_color_rgba", gc_skin_color_text_button,
                                   "weight", PANGO_WEIGHT_HEAVY,
                            NULL);

  gdk_pixbuf_unref(pixmap_dialog);

  gtk_signal_connect(GTK_OBJECT(itemDialogText), "event",
                   (GtkSignalFunc) item_event_ok,
                   dbcb);

  item_text = gnome_canvas_item_new (rootDialogItem,
                                 gnome_canvas_rich_text_get_type (),
                                 "x", (double) BOARDWIDTH/2,
                                 "y", (double) 100.0,
                                 "width", (double)BOARDWIDTH-260.0,
                                 "height", 400.0,
                                 "anchor", GTK_ANCHOR_NORTH,
                                 "justification", GTK_JUSTIFY_CENTER,
                                 "grow_height", FALSE,
                                 "cursor_visible", FALSE,
                                 "cursor_blink", FALSE,
                                 "editable", FALSE,
                                 NULL);

  gnome_canvas_item_set (item_text,
                      "text", str,
                      NULL);

  buffer  = gnome_canvas_rich_text_get_buffer(GNOME_CANVAS_RICH_TEXT(item_text));
  txt_tag = gtk_text_buffer_create_tag(buffer, NULL,
                                   "font",       gc_skin_font_board_medium,
                                   "foreground", "blue",
                                   "family-set", TRUE,
                                   NULL);
  gtk_text_buffer_get_end_iter(buffer, &iter_end);
  gtk_text_buffer_get_start_iter(buffer, &iter_start);
  gtk_text_buffer_apply_tag(buffer, txt_tag, &iter_start, &iter_end);

  gtk_signal_connect(GTK_OBJECT(item_text), "event",
                   (GtkSignalFunc) item_event_ok,
                   dbcb);
  gtk_signal_connect(GTK_OBJECT(item_text_ok), "event",
                   (GtkSignalFunc) item_event_ok,
                   dbcb);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_dialog_close ( )

Definition at line 36 of file dialog.c.

                       {

  /* If we already running delete the previous one */
  if(rootDialogItem) {
    /* WORKAROUND: There is a bug in the richtex item and we need to remove it first */
    while (g_idle_remove_by_data (itemDialogText));
    gtk_object_destroy (GTK_OBJECT(itemDialogText));
    itemDialogText = NULL;

    gtk_object_destroy(GTK_OBJECT(rootDialogItem));
  }

  rootDialogItem = NULL;

}

Here is the caller graph for this function:

GnomeCanvas* gc_get_canvas ( void  )

Return the main canvas we run in.

Definition at line 370 of file gcompris.c.

{
  return canvas;
}

Here is the caller graph for this function:

GtkWidget* gc_get_window ( void  )

Definition at line 375 of file gcompris.c.

{
  return window;
}

Here is the caller graph for this function:

void gc_ignore_next_focus_out ( void  )

Definition at line 380 of file gcompris.c.

{
#ifdef XF86_VIDMODE
  XF86VidModeData.ignore_focus_out++;
#endif
}

Here is the caller graph for this function:

const gchar* gc_locale_get ( void  )

Definition at line 1155 of file gcompris.c.

{
  const gchar *locale;

  /* First check locale got overrided by the user */
  if(gc_locale != NULL)
    return(gc_locale);

  locale = g_getenv("LC_ALL");
  if(locale == NULL)
    locale = g_getenv("LC_MESSAGES");
  if(locale == NULL)
    locale = g_getenv("LANG");

  if(locale!=NULL)
    return(locale);

  return("en_US.UTF-8");
}

Here is the caller graph for this function:

gchar* gc_locale_get_name ( gchar *  locale)

Given the locale name, return the full translated name If not found, simply return the name.

Definition at line 530 of file config.c.

{
  guint i = 0;

  /* en (US) is not in the Linguas table */
  if(locale[0] != '\0' && !strncmp(locale, "en", strlen(locale)))
    return(_("English (United State)"));

  while(linguas[i] != NULL)
    {

      if(!strncmp(locale, linguas[i], strlen(locale)))
       return(gettext(linguas[i+1]));

      i=i+2;
    }
  // Oups this locale is not in the table. Return the first one (system default)
  return(linguas[1]);
}

Here is the caller graph for this function:

char* gc_locale_get_user_default ( void  )

Definition at line 1180 of file gcompris.c.

Here is the caller graph for this function:

void gc_locale_set ( gchar *  locale)

Definition at line 1190 of file gcompris.c.

{

  if(!locale)
    return;

  g_message("gc_locale_set '%s'\n", locale);
  if(gc_locale != NULL)
    g_free(gc_locale);

#if defined WIN32
  /* On windows, it always works */
  gc_locale = g_strdup(locale);
  setlocale(LC_MESSAGES, locale);
  setlocale(LC_ALL, locale);
#else
  gc_locale = g_strdup(setlocale(LC_MESSAGES, locale));
  if (!gc_locale)
    gc_locale = g_strdup(locale);
#endif

  if(gc_locale!=NULL && strcmp(locale, gc_locale))
    g_warning("Requested locale '%s' got '%s'", locale, gc_locale);

  if(gc_locale==NULL)
    g_warning("Failed to set requested locale %s got %s", locale, gc_locale);

  /* Override the env locale to what the user requested */
  /* This makes gettext to give us the new locale text  */
  gc_setenv ("LC_ALL", gc_locale_get());
  gc_setenv ("LC_MESSAGES", gc_locale_get());
  gc_setenv ("LANGUAGE", gc_locale_get());
  gc_setenv ("LANG", gc_locale_get());

  /* This does update gettext translation uppon next gettext call */
  /* Call for localization startup */
  bindtextdomain (GETTEXT_PACKAGE, properties->package_locale_dir);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

#ifndef WIN32
  /* Make change known.  */
  {
    extern int  _nl_msg_cat_cntr;
    ++_nl_msg_cat_cntr;
  }
#endif

}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_log_end ( GcomprisBoard *  gcomprisBoard,
gchar *  status 
)

gc_log_end

Parameters:
GcomprisBoard*gcomprisBoard: the board for which the event happen
status,:a string representing the status like PASSED, FAILED.

Definition at line 147 of file log.c.

                                                              {
  FILE *flog;
  gchar *file;

  /* Prepare our log */

  /* The default format for time represenation.  See strftime(3) */
  char *fmt = "%F %T";

  char buf[256];

  /* get the current time from the Unix kernel */
  time_t end_time = time(NULL);
  double duration = difftime(end_time,start_time);

  struct tm *tp;

  GcomprisUser *gcomprisUser = gc_profile_get_current_user();
  const char *username = g_get_user_name();

  if(gcomprisBoard_set != gcomprisBoard)
    return;

  if(gcomprisUser && gcomprisUser->login)
    username = gcomprisUser->login;

  /* and convert it to UTC or local time representation */
  if (USE_UTC)
    tp = gmtime(&start_time);
  else
    tp = localtime(&start_time);

  /* convert the time to a string according to the format specification in fmt */
  strftime(buf, sizeof(buf), fmt, tp);

  /* Print it out */
  if(g_get_home_dir()) {
    file = g_strconcat(g_get_home_dir(), "/.gcompris/gcompris.log", NULL);
  } else {
    /* On WIN98, No home dir */
    file = g_strdup("gcompris.log");
  }

  flog = g_fopen(file,"a");

  /* date,computer,user,board,level,sublevel,status, duration,comment */
  if(flog)
    fprintf(flog, "%s;%s;%s;gcompris;%s;%d;%d;%s;%d;%s;%s\n", buf, hostname, username,
           gcomprisBoard->name,
           gcomprisBoard->level, gcomprisBoard->sublevel,
           status,
           (guint)duration,
           comment_set,
           keylog);
  else
    g_warning("Failed to save the log in file '%s'", file);

  g_warning("%s;%s;%s;gcompris;%s;%d;%d;%s;%d;%s;%s\n", buf, hostname, username,
           gcomprisBoard->name,
           gcomprisBoard->level, gcomprisBoard->sublevel,
           status,
           (guint)duration,
           comment_set,
           keylog);

  if(flog)
    fclose(flog);

  g_free(file);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_log_set_comment ( GcomprisBoard *  gcomprisBoard,
gchar *  expected,
gchar *  got 
)

gc_log_set_comment

Parameters:
GcomprisBoard*gcomprisBoard: the board for which the event happen
expected,:string describing what was expected. This string is copied.
got,:string describing what we got from the user. This string is copied.

Note: Do not include the charater ';' in expected or got

Definition at line 85 of file log.c.

                                                                                    {

  printf("gc_log_set_comment %s %s\n", expected, got);
  if(gcomprisBoard_set != gcomprisBoard) {
    return;
  }

  if(expected==NULL)
    expected="";

  if(got==NULL)
    got="";

  /* If We already had a comment, log the previous one */
  if(comment_set[0] != '\0') {
    gc_log_end(gcomprisBoard, GCOMPRIS_LOG_STATUS_FAILED);
  }

  comment_set = g_strdup_printf("%s;%s", expected, got);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GList* gc_menu_get_boards ( )

Definition at line 40 of file menu.c.

{
  return boards_list;
}

Here is the caller graph for this function:

GList* gc_menu_getlist ( gchar *  section)

Definition at line 412 of file menu.c.

{
  GList *list = NULL;
  GList *result_list = NULL;

  GcomprisProperties *properties = gc_prop_get();

  if(!section){
    g_error("gc_menu_getlist called with section == NULL !");
    return NULL;
  }

  if (strlen(section)==1)
    section = "";

  for(list = boards_list; list != NULL; list = list->next) {
    GcomprisBoard *board = list->data;

    if ( (!properties->experimental) &&
        (strcmp (board->name, "experimental") == 0))
      continue;

    if (strcmp (section, board->section) == 0) {
      if (strlen(board->name) != 0)
       {
         if(strcmp(board->type, "menu") == 0)
           {
             /* We must check first this menu is not empty */
             if(gc_menu_has_activity(board->section, board->name))
              result_list = g_list_append(result_list, board);
           }
         else
           {
             result_list = g_list_append(result_list, board);
           }
       }
    }
  }

  /* Sort the list now */
  result_list = g_list_sort(result_list, boardlist_compare_func);

  return result_list;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GcomprisBoard* gc_menu_section_get ( gchar *  section)

Definition at line 330 of file menu.c.

{
  GList *list = NULL;

  for(list = boards_list; list != NULL; list = list->next) {
    GcomprisBoard *board = list->data;

    gchar *fullname = NULL;

    fullname = g_strdup_printf("%s/%s",
                            board->section, board->name);

    if (strcmp (fullname, section) == 0){
      g_free(fullname);
      return board;
    }
    g_free(fullname);

  }
  g_warning("gc_menu_section_get searching '%s' but NOT FOUND\n", section);
  return NULL;
}

Here is the caller graph for this function:

void gc_selector_file_load ( GcomprisBoard *  gcomprisBoard,
gchar *  rootdir,
gchar *  file_types,
FileSelectorCallBack  fscb 
)

Definition at line 128 of file file_selector.c.

{
  display_file_selector(MODE_LOAD, gcomprisBoard, rootdir, file_types,
                     iscb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_selector_file_save ( GcomprisBoard *  gcomprisBoard,
gchar *  rootdir,
gchar *  file_types,
FileSelectorCallBack  fscb 
)

Definition at line 120 of file file_selector.c.

{
  display_file_selector(MODE_SAVE, gcomprisBoard, rootdir, file_types,
                     iscb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_selector_file_stop ( void  )

Definition at line 140 of file file_selector.c.

{
  GcomprisBoard *gcomprisBoard = gc_board_get_current();

  if(gcomprisBoard!=NULL && file_selector_displayed)
    gc_board_pause(FALSE);

  // Destroy the file_selector box
  /* FIXME: Crashes randomly */
  if(rootitem!=NULL)
    gtk_object_destroy(GTK_OBJECT(rootitem));

  rootitem = NULL;

  /* No need to destroy it since it's in rootitem but just clear it */
  file_root_item = NULL;

  /* Cleanup the file list */
  if(file_list) {
    //    g_list_foreach(file_list, (GFunc)g_free, NULL);
    g_list_free(file_list);
  }
  file_list = NULL;

  gc_bar_hide(FALSE);
  file_selector_displayed = FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_selector_images_start ( GcomprisBoard *  gcomprisBoard,
gchar *  dataset,
ImageSelectorCallBack  imscb 
)

Definition at line 104 of file images_selector.c.

{

  GnomeCanvasItem *item, *item2;
  GdkPixbuf   *pixmap = NULL;
  gint         y = 0;
  gint         y_start = 0;
  gint         x_start = 0;
  gchar              *dataseturl = NULL;

  GtkWidget     *w;

  if(rootitem)
    return;

  gc_bar_hide(TRUE);

  gc_board_pause(TRUE);

  imageSelectorCallBack=iscb;

  rootitem = \
    gnome_canvas_item_new (gnome_canvas_root(gc_get_canvas()),
                        gnome_canvas_group_get_type (),
                        "x", (double)0,
                        "y", (double)0,
                        NULL);

  images_selector_displayed = TRUE;

  pixmap = gc_skin_pixmap_load("images_selector_bg.png");
  y_start = (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap))/2;
  x_start = (BOARDWIDTH - gdk_pixbuf_get_width(pixmap))/2;
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) x_start,
                            "y", (double) y_start,
                            NULL);
  y = BOARDHEIGHT - (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap))/2;
  gdk_pixbuf_unref(pixmap);

  y_start += 110;

  pixmap = gc_skin_pixmap_load("button_large.png");

  /*
   * Create the list scrollbar
   * -------------------------
   */
  canvas_list_selector     = GNOME_CANVAS(gnome_canvas_new ());

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_widget_get_type (),
                      "widget", GTK_WIDGET(canvas_list_selector),
                      "x", (double) LIST_AREA_X1,
                      "y", (double) LIST_AREA_Y1,
                      "width",  LIST_AREA_X2 - LIST_AREA_X1,
                      "height", LIST_AREA_Y2 - LIST_AREA_Y1 - 35.0,
                      NULL);

  gtk_widget_show (GTK_WIDGET(canvas_list_selector));

  /* Set the new canvas to the background color or it's white */
  list_bg_item = gnome_canvas_item_new (gnome_canvas_root(canvas_list_selector),
                                   gnome_canvas_rect_get_type (),
                                   "x1", (double) 0,
                                   "y1", (double) 0,
                                   "x2", (double) LIST_AREA_X2 - LIST_AREA_X1,
                                   "y2", (double) LIST_AREA_Y2 - LIST_AREA_Y1,
                                   "fill_color_rgba", gc_skin_get_color("gcompris/imageselectbg"),
                                   NULL);


  w = gtk_vscrollbar_new (GTK_LAYOUT(canvas_list_selector)->vadjustment);

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_widget_get_type (),
                      "widget", GTK_WIDGET(w),
                      "x", (double) LIST_AREA_X2 - 5.0,
                      "y", (double) LIST_AREA_Y1,
                      "width", 30.0,
                      "height", LIST_AREA_Y2 - LIST_AREA_Y1 - 20.0,
                      NULL);
  gtk_widget_show (w);
  gnome_canvas_set_center_scroll_region (GNOME_CANVAS (canvas_list_selector), FALSE);

  /* Set the scrollwheel event */
  gtk_signal_connect(GTK_OBJECT(canvas_list_selector), "event",
                   (GtkSignalFunc) item_event_scroll,
                   GNOME_CANVAS(canvas_list_selector));

  /*
   * Create the image scrollbar
   * --------------------------
   */
  canvas_image_selector     = GNOME_CANVAS(gnome_canvas_new ());

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_widget_get_type (),
                      "widget", GTK_WIDGET(canvas_image_selector),
                      "x", (double) DRAWING_AREA_X1,
                      "y", (double) DRAWING_AREA_Y1,
                      "width",  DRAWING_AREA_X2 - DRAWING_AREA_X1,
                      "height", DRAWING_AREA_Y2 - DRAWING_AREA_Y1 - 35.0,
                      NULL);

  gtk_widget_show (GTK_WIDGET(canvas_image_selector));

  /* Set the new canvas to the background color or it's white */
  image_bg_item = gnome_canvas_item_new (gnome_canvas_root(canvas_image_selector),
                                   gnome_canvas_rect_get_type (),
                                   "x1", (double) 0,
                                   "y1", (double) 0,
                                   "x2", (double) DRAWING_AREA_X2 - DRAWING_AREA_X1,
                                   "y2", (double) DRAWING_AREA_Y2 - DRAWING_AREA_Y1,
                                    "fill_color_rgba", gc_skin_get_color("gcompris/imageselectbg"),
                                   NULL);


  w = gtk_vscrollbar_new (GTK_LAYOUT(canvas_image_selector)->vadjustment);

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_widget_get_type (),
                      "widget", GTK_WIDGET(w),
                      "x", (double) DRAWING_AREA_X2 - 5.0,
                      "y", (double) DRAWING_AREA_Y1,
                      "width", 30.0,
                      "height", DRAWING_AREA_Y2 - DRAWING_AREA_Y1 - 20.0,
                      NULL);
  gtk_widget_show (w);
  gnome_canvas_set_center_scroll_region (GNOME_CANVAS (canvas_image_selector), FALSE);

  /* Set the scrollwheel event */
  gtk_signal_connect(GTK_OBJECT(canvas_image_selector), "event",
                   (GtkSignalFunc) item_event_scroll,
                   GNOME_CANVAS(canvas_image_selector));

  /*
   * DISPLAY IMAGES
   */

  /* Initial image position */
  ix  = 0;
  iy  = 0;
  isy = 0;

  /* I need  the following :
     -> if dataset is a file read it.
     -> if dataset is a directory, read all xml file in it.
  */
  dataseturl = \
    gc_file_find_absolute(dataset,
                                NULL);

  /* if the file doesn't exist */
  if(g_file_test ((dataseturl), G_FILE_TEST_IS_DIR) )
    {
      g_warning("dataset %s is a directory. Trying to read xml", dataseturl);

      read_dataset_directory(dataseturl);
    }
  else if(dataseturl)
    {
      /* Read the given data set file, local or net */
      read_xml_file(dataseturl);
    }
  else
    {
      /* Network code for dataset directory */
      GSList *filelist = NULL;
      GSList *i = NULL;

      g_free(dataseturl);
      dataseturl = g_strconcat("boards/", dataset, NULL);

      filelist = gc_net_dir_read_name(dataseturl, ".xml");

      for (i = filelist; i != NULL; i = g_slist_next (i))
       {
         gchar *url = gc_file_find_absolute(i->data,
                                        NULL);
         g_warning("processing dataset=%s\n", (char *)i->data);
         read_xml_file(url);
         g_free(url);
       }

      g_slist_free(filelist);

    }
  g_free(dataseturl);

  /*
   * OK Button
   * ---------
   */
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) (BOARDWIDTH*0.5) - gdk_pixbuf_get_width(pixmap)/2,
                            "y", (double) y - gdk_pixbuf_get_height(pixmap) - 10,
                            NULL);

  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) item_event_images_selector,
                   "/ok/");
  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);

  item2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_text_get_type (),
                            "text", _("OK"),
                            "font", gc_skin_font_title,
                            "x", (double)  BOARDWIDTH*0.5,
                            "y", (double)  y - gdk_pixbuf_get_height(pixmap) + 15,
                            "anchor", GTK_ANCHOR_CENTER,
                            "fill_color_rgba", gc_skin_color_text_button,
                            NULL);
  gtk_signal_connect(GTK_OBJECT(item2), "event",
                   (GtkSignalFunc) item_event_images_selector,
                   "/ok/");
  gtk_signal_connect(GTK_OBJECT(item2), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   item);
  gdk_pixbuf_unref(pixmap);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_selector_images_stop ( void  )

Definition at line 338 of file images_selector.c.

{
  GcomprisBoard *gcomprisBoard = gc_board_get_current();

  if(gcomprisBoard!=NULL && images_selector_displayed)
    {
      gc_board_pause(FALSE);
    }

  // Destroy the images_selector box
  if(rootitem!=NULL)
    {
      gtk_object_destroy(GTK_OBJECT(rootitem));
    }
  rootitem = NULL;
  current_root_set = NULL;

  gc_bar_hide(FALSE);
  images_selector_displayed = FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GnomeCanvasItem* gc_set_background ( GnomeCanvasGroup *  parent,
gchar *  file 
)

Definition at line 387 of file gcompris.c.

{
  GdkPixbuf *background_pixmap = NULL;

  background_pixmap = gc_pixmap_load (file);

  if(backgroundimg)
      gnome_canvas_item_set (backgroundimg,
                          "pixbuf", background_pixmap,
                          NULL);
  else
    backgroundimg=gnome_canvas_item_new (parent,
                                    gnome_canvas_pixbuf_get_type (),
                                    "pixbuf", background_pixmap,
                                    "x", 0.0,
                                    "y", 0.0,
                                    "width", (double) BOARDWIDTH,
                                    "height", (double) BOARDHEIGHT,
                                    NULL);
  gnome_canvas_item_lower_to_bottom(backgroundimg);

  gdk_pixbuf_unref(background_pixmap);

  return (backgroundimg);
}

Here is the call graph for this function:

Here is the caller graph for this function: