예제 #1
0
static gboolean
on_plugin_idle_init (gpointer dummy)
{
  create_panel ();
  
  return FALSE;
}
예제 #2
0
파일: vpfmisc.c 프로젝트: LucHermitte/ossim
/*************************************************************************
 *
 *N  displaymessage
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function displays a list of text strings in a
 *     popup text window.  The list must be NULL-terminated.  Must be in
 *     graphics mode to call this function.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    string <input> == (char *) first text string to be displayed.
 *    ... <input> == (char *) variable list of text strings to be displayed.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels    August 1991                        DOS Turbo C
 *E
 *************************************************************************/
void displaymessage( char *string, ... )
{
   int         i,maxw,height,x,y,pad, nlines;
   panel_type  panel;
   char **text;
   va_list arglist;

   va_start(arglist,string);
   nlines = 1;
   while (va_arg(arglist,char *)) nlines++;
   va_end(arglist);

   text = (char **)vpfmalloc((nlines+1)*sizeof(char *));
   text[0] = string;
   va_start(arglist,string);
   for (i=1;i<nlines;i++) {
      text[i] = va_arg(arglist,char *);
   }
   va_end(arglist);

   settextstyle( SMALL_FONT, HORIZ_DIR, 4 );
   maxw = 0;
   height = 0;
   for (i=0;i<nlines;i++) {
      if (textwidth(text[i]) > maxw) maxw = textwidth(text[i]);
      height = height + textheight(text[i]) + 5;

   }
   if (maxw < (textwidth("Continue") + 10))
      maxw = textwidth("Continue") + 10;
   pad = (maxw*10)/100;
   maxw = maxw + (2*pad);
   if (maxw > getmaxx())
     maxw = getmaxx() - 8;
   height = height + 2*(textheight("Continue") + 5) + 5;

   create_panel( &panel, maxw, height, menucolor, menubordercolor );
   x = pad;
   y = 0;
   for (i=0;i<nlines;i++) {
      y = y + textheight(text[i]) + 5;
      create_label( text[i], x, y, SMALL_FONT, 4, menutextcolor, &panel );
   }
   y = height - (textheight("Continue") + 6);
   x = (maxw - (textwidth("Continue") + 10))/2;
   create_button( 27, "Continue", x, y, SMALL_FONT, 4,
		  menutextcolor, menucolor, menubordercolor, RELIEVED,
		  &panel );

   get_display_position( &x, &y, panel.window );

   display_panel( &panel, x, y );
   i = process_panel( &panel, i );

   destroy_panel( &panel );
   close_panel( &panel );

   free(text);
}
예제 #3
0
static void
create_reader(GtkWidget *vbox, Reader *reader, gint first_create)
{
	if (1) /* FIXME */
		create_chart(vbox, reader, first_create);
	else
		create_panel(vbox, reader, first_create);
}
예제 #4
0
파일: vpfmisc.c 프로젝트: LucHermitte/ossim
/*************************************************************************
 *
 *N  yes_no
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function displays a panel asking the user a yes or no
 *     question and returns the response.  Must be in graphics mode to call
 *     this function.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    text     <input>==(char *) question string.
 *    return  <output>==(int) yes (TRUE) or no (FALSE).
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels   May 1991                    DOS Turbo C
 *E
 *************************************************************************/
int yes_no( char *text )
{
   panel_type  panel;
   int         no_id = 27;
   int         yes_id = 13;
   int         x,y,width,height,maxheight,id=0;

   settextstyle( SMALL_FONT, HORIZ_DIR, 4 );

   width = 0;
   maxheight = 0;
   width = textwidth(text);
   maxheight = textheight(text);

   width = width + 50;
   if (width > getmaxx())
      width = getmaxx()-10;
   height = maxheight * 5;

   create_panel( &panel,width,height,menucolor,menubordercolor );

   y = maxheight;
   create_label( text,CENTER,y,SMALL_FONT,4,menutextcolor,&panel );
   y += maxheight;

   create_button( yes_id, "Yes",
		  3, height-textheight("Y")-6,
		  SMALL_FONT, 4,
		  menutextcolor, menucolor, menubordercolor, RELIEVED,
		  &panel );
   create_button( no_id, "No",
		  width-textwidth("No")-13,
		  height-textheight("No")-6,
		  SMALL_FONT, 4,
		  menutextcolor, menucolor, menubordercolor, RELIEVED,
		  &panel );

   get_display_position( &x, &y, panel.window );

   display_panel( &panel, x,y );

   id = process_panel(&panel, id);

   destroy_panel( &panel );
   close_panel( &panel );

   if (id == yes_id)
      return TRUE;
   else
      return FALSE;
}
예제 #5
0
파일: vpfmisc.c 프로젝트: LucHermitte/ossim
/*************************************************************************
 *
 *N  displayinfo
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function displays an array of text strings in a
 *     popup text window.  Must be in graphics mode to call this function.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    text[] <input> == (char *) array of text strings to be displayed.
 *    nlines <input> == (int) number of text lines.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels    June 1990    Original Version    DOS Turbo C
 *E
 *************************************************************************/
void displayinfo( char *text[],
		  int  nlines )
{
   int         i,maxw,height,x,y,pad;
   panel_type  panel;

   arrow_cursor();
   settextstyle( SMALL_FONT, HORIZ_DIR, 4 );
   maxw = 0;
   height = 0;
   for (i=0;i<nlines;i++) {
      if (textwidth(text[i]) > maxw) maxw = textwidth(text[i]);
      height = height + textheight(text[i]) + 5;
   }
   if (maxw < (textwidth("Continue") + 10))
      maxw = textwidth("Continue") + 10;
   pad = (maxw*10)/100;
   maxw = maxw + (2*pad);
   if (maxw > getmaxx())
     maxw = getmaxx() - 8;
   height = height + 2*(textheight("Continue") + 10);

   create_panel( &panel, maxw, height, menucolor, menubordercolor );
   x = pad;
   y = 0;
   for (i=0;i<nlines;i++) {
      y = y + textheight(text[i]) + 3;
      create_label( text[i], x, y, SMALL_FONT, 4, menutextcolor, &panel );
   }
   y = height - (textheight("Continue") + 6);
   x = (maxw - (textwidth("Continue") + 10))/2;
   create_button( 27, "Continue", x, y, SMALL_FONT, 4,
		  menutextcolor, menucolor, menubordercolor, RELIEVED,
		  &panel );

   get_display_position( &x, &y, panel.window );

   display_panel( &panel, x, y );
   i = process_panel( &panel, i );

   destroy_panel( &panel );
   close_panel( &panel );
}
예제 #6
0
파일: vpfmisc.c 프로젝트: LucHermitte/ossim
/*************************************************************************
 *
 *N  displayerror
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function displays an error message when a disk error is detected.
 *     It displays the given lines of text in a popup panel and waits for
 *     the user to click on either retry or cancel.  It returns 1 for retry
 *     and 0 for cancel.  Must be in graphics mode to call this function.
 *
 *     text strings may contain embedded newlines, in which case text to the
 *     right of the newline will be displayed on (what else?) a new line.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    text[]  <input> == (char *) array of text strings to be displayed.
 *    nlines  <input> == (int) number of lines of text (this count ignores
 *                             newline characters embedded in the text
 *                             strings
 *    return <output> == (VPF_BOOLEAN) 1 => retry,
 *                                 0 => cancel.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels    July 1990    Prototype 3    DOS Turbo C
 *E
 *************************************************************************/
VPF_BOOLEAN displayerror( char *text[],
		      int  nlines )
{
   register int i;
   int          maxw,
		height,
		x,
		y,
		pad,
		choice,
		n_real_lines;
   panel_type   panel;
   int          retry_button  = 'r',
		cancel_button = 'c',
		msg_ar_sz     = 10;
   char       * walker,
	     ** msgs;
   struct viewporttype view;

   getviewsettings( &view );
   setviewport(0,0,getmaxx(),getmaxy(),1);


   settextstyle( SMALL_FONT, HORIZ_DIR, 4 );
   msgs = (char **) vpfmalloc(msg_ar_sz * sizeof(char *));
   maxw = height = 0;

   for (n_real_lines = i = 0; i < nlines; i++) {
     walker = text[i];
     while (1) {
	size_t substr_len = strcspn(walker, "\n");
	char   plug;

	maxw                 = max(maxw, textwidth(walker));
	height               = height + textheight(walker) + 5;
	plug                 = walker[substr_len];
	walker[substr_len]   = '\0';
	msgs[n_real_lines++] = strdup(walker);

	if (n_real_lines == msg_ar_sz)
	  msgs = (char **) realloc(msgs, (msg_ar_sz += 5) * sizeof(char *));
	if (plug == 0)
	  break;

	walker[substr_len] = plug;
	walker            += substr_len + 1;
     }
   }

   if (maxw < (textwidth("Retry") + textwidth("Cancel") + 20))
      maxw = textwidth("Retry") + textwidth("Cancel") + 20;

   pad    = (maxw*10)/100;
   maxw   = maxw + (2*pad);
   height = height + 2*(textheight("Retry") + 5) + 1;
   maxw   = min(getmaxx(), maxw);
   height = min(getmaxy()-10, height);

   create_panel( &panel, maxw, height, menucolor, menubordercolor );

   for (y = i = 0; i < n_real_lines; i++) {
     create_label(msgs[i], pad, y, SMALL_FONT, 4, menutextcolor, &panel );
     y += textheight(msgs[i]) + 3;
   }

   y = height-15;

   create_button( retry_button,
		  "Retry",
		  3,
		  y,
		  SMALL_FONT,
		  4,
		  menutextcolor,
		  menucolor,
		  menubordercolor,
		  RELIEVED,
		  &panel );
   create_button( cancel_button,
		  "Cancel",
		  maxw - (textwidth("Cancel") + 13),
		  y,
		  SMALL_FONT,
		  4,
		  menutextcolor,
		  menucolor,
		  menubordercolor,
		  RELIEVED,
		  &panel );

   get_display_position( &x, &y, panel.window );

   display_panel( &panel, x,y );
   showmousecursor();
   arrow_cursor();
   choice = process_panel( &panel, 0 );
   hidemousecursor();

   destroy_panel( &panel );
   close_panel( &panel );

   setviewport(view.left,view.top,view.right,view.bottom,view.clip);

   for (i = 0; i < n_real_lines; i++)
     free(msgs[i]);
   free(msgs);

   return (choice == retry_button) ? 1 : 0;
}
예제 #7
0
파일: menu2.c 프로젝트: nnagabus/GCompris
static void menu_start (GcomprisBoard *agcomprisBoard)
{

    current_x = 0.0;
    current_y = 0.0;

    /* initialisations */
    /* in case we will make this parametrable */

    panel_x = P_X;
    panel_y = P_Y;
    panel_w = P_W;
    panel_h = P_H;

    top_x = T_X;
    top_y = T_Y;
    top_w = T_W;
    top_h = T_H;
    top_int_x = T_INT_X;
    top_arrow_size = T_ARROW_SIZE;

    display_x = D_X;
    display_y = D_Y;
    display_w = D_W;
    display_h = D_H;
    display_int_x = D_INT_X;
    display_int_y = D_INT_Y;

    info_x = I_X;
    info_y = I_Y;
    info_w = I_W;
    info_h = I_H;

    icon_size = ICON_SIZE;
    icon_size_panel = ICON_SIZE_PANEL;
    icon_size_top = ICON_SIZE_TOP;

    if(agcomprisBoard != NULL)
    {
        RsvgHandle *svg_handle;

        gcomprisBoard=agcomprisBoard;

        /* set initial values for this level */
        gcomprisBoard->level = 1;
        gcomprisBoard->maxlevel=1;

        /* Set back the bar to it's original location */
        gc_bar_set(GC_BAR_CONFIG|GC_BAR_ABOUT|GC_BAR_JOURNAL|GC_BAR_SHARE);

        menuitems = g_new(MenuItems, 1);

        svg_handle = gc_skin_rsvg_get();

        gc_set_background_by_id (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                 svg_handle,
                                 "#BACKGROUND");

        boardRootItem = \
                        goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                              NULL);

        g_object_set_data_full(G_OBJECT (boardRootItem),
                               "menuitems", menuitems, g_free);

        goo_canvas_svg_new (boardRootItem,
                            svg_handle,
                            "svg-id", "#SELECTOR",
                            "pointer-events", GOO_CANVAS_EVENTS_NONE,
                            NULL);

        goo_canvas_svg_new (boardRootItem,
                            svg_handle,
                            "svg-id", "#BUTTON_HORIZONTAL",
                            "pointer-events", GOO_CANVAS_EVENTS_NONE,
                            NULL);

        create_info_area(boardRootItem, menuitems);

        create_panel(boardRootItem);

        if (menu_position)
            display_section(menu_position);
        else
            display_welcome(menuitems);

        {
            if ( strcmp(gc_prop_get()->profile->name, GC_PROFILE_DEFAULT) != 0 )
            {
                gchar *text = g_strdup_printf(_("Profile: %s"),
                                              gc_prop_get()->profile->name);
                goo_canvas_text_new (boardRootItem,
                                     text,
                                     BOARDWIDTH - 10,
                                     BOARDHEIGHT - 30,
                                     -1,
                                     GTK_ANCHOR_EAST,
                                     "font", gc_skin_font_board_tiny,
                                     "fill-color-rgba", gc_skin_get_color("menu/text"),
                                     "alignment", PANGO_ALIGN_RIGHT,
                                     NULL);
                g_free(text);
            }
        }

        {
            gchar *text = g_strdup_printf(_("Number of activities: %d"),
                                          gc_board_get_number_of_activity());
            goo_canvas_text_new (boardRootItem,
                                 text,
                                 BOARDWIDTH - 10,
                                 BOARDHEIGHT - 10,
                                 -1,
                                 GTK_ANCHOR_EAST,
                                 "font", gc_skin_font_board_tiny,
                                 "fill-color-rgba", gc_skin_get_color("menu/text"),
                                 "alignment", PANGO_ALIGN_RIGHT,
                                 NULL);
            g_free(text);
        }

        menu_pause(FALSE);

    }

}
예제 #8
0
/**
 * Create a full screen panel control
 *
 * @param children	Children controls to appear in the panel
 * @param R, G, B	Background colour numbers (RGB) for the parts of the panel shown
 */
Control* create_fs_panel(char* bg_path, Link* children_head) {

	return create_panel(0, 0, 0, 0, WIN_W, WIN_H, bg_path, children_head);
}