Exemplo n.º 1
0
int
main (int argc, char *argv[])
{
    App *app;

    app = (App *) g_new (App, 1);

    gtk_init (&argc, &argv);

    app_init (app);

    GET_UI_ELEMENT (GtkWidget, mainwindow);
    GET_UI_ELEMENT (GtkWidget, layout1);

    g_signal_connect (G_OBJECT (layout1), "draw",
                      G_CALLBACK (layout_draw_cb), app);

    make_button ("eventbox1", app);
    make_button ("eventbox2", app);

    gtk_widget_show_all (mainwindow);

    gtk_main ();

    return 0;
}
Exemplo n.º 2
0
/*---------------------------------------------------------------------*/
static void
make_hop_console() {
   GtkWidget *view;
   GtkWidget *but;
   GtkWidget *hboxbut;
   PangoFontDescription *font_desc;

   console = gtk_scrolled_window_new( NULL, NULL );
   view = gtk_text_view_new();
   
   console_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( view ) );
   gtk_text_buffer_get_iter_at_offset( console_buffer, &end_of_buffer, -1 );
   
   font_desc = pango_font_description_from_string( HOP_CONSOLE_FONT );
   
   gtk_widget_modify_font( view, font_desc );
   pango_font_description_free( font_desc );
   
   gtk_container_add( GTK_CONTAINER( console ), view );
   gtk_container_add( GTK_CONTAINER( right_vbox ), console );
   
   hboxbut = gtk_hbutton_box_new();
   but = make_button( "Clear console" );
   g_signal_connect( G_OBJECT( but ), "clicked",
		     G_CALLBACK( clear_hop_console ), console );
   gtk_container_add( GTK_CONTAINER( hboxbut ), but );
   gtk_box_pack_end( GTK_BOX( right_vbox ), hboxbut, FALSE, FALSE, 2 );
}
Exemplo n.º 3
0
/*---------------------------------------------------------------------*/
void
make_hop_restart() {
   PangoFontDescription *font_desc;
   GtkWidget *port_lbl;
   GtkWidget *hbox, *hboxbut;
   GtkWidget *but;
   
   font_desc = pango_font_description_from_string( HOP_MONOSPACE_FONT );
   port_lbl = gtk_label_new( "Port: " );
   port_entry = gtk_entry_new();
   gtk_entry_set_width_chars( GTK_ENTRY( port_entry ), 4 );
   hbox = gtk_hbox_new( FALSE, 0 );

   gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( port_lbl ) );
   gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( port_entry ) );
   gtk_entry_set_text( GTK_ENTRY( port_entry ), (const gchar *)hop_port );
   gtk_widget_modify_font( port_lbl, font_desc );
   gtk_widget_modify_font( port_entry, font_desc );
   
   pango_font_description_free( font_desc );

   but = make_button( "Restart Hop" );
   g_signal_connect( G_OBJECT( but ), "clicked",
		     G_CALLBACK( run_hop_with_port ), win );

   hboxbut = gtk_hbutton_box_new();
   gtk_box_pack_start( GTK_BOX( hboxbut ), but, FALSE, FALSE, 2 );
   
   gtk_box_pack_start( GTK_BOX( left_vbox ), hboxbut, FALSE, FALSE, 10 );
   gtk_box_pack_start( GTK_BOX( left_vbox ), hbox, FALSE, FALSE, 2 );
}
Exemplo n.º 4
0
void make_users_control_graph(void)
{
pause_thread(THREAD_SCREEN);
// Set a negative number here.
// In case several windows are desired, give them different
// negative numbers and use scro[m].no to decide what to do
// in your mouse_on_users_graph routine.
scro[users_graph_scro].no=USERS_GRAPH_TYPE1;
// These are the coordinates of the border lines.
scro[users_graph_scro].x1=ug.xleft;
scro[users_graph_scro].x2=ug.xright;
scro[users_graph_scro].y1=ug.ytop;
scro[users_graph_scro].y2=ug.ybottom;
// Each border line is treated as a button.
// That is for the mouse to get hold of them so the window can be moved.
ugbutt[UG_LEFT].x1=ug.xleft;
ugbutt[UG_LEFT].x2=ug.xleft;
ugbutt[UG_LEFT].y1=ug.ytop;
ugbutt[UG_LEFT].y2=ug.ybottom;
ugbutt[UG_RIGHT].x1=ug.xright;
ugbutt[UG_RIGHT].x2=ug.xright;
ugbutt[UG_RIGHT].y1=ug.ytop;
ugbutt[UG_RIGHT].y2=ug.ybottom;
ugbutt[UG_TOP].x1=ug.xleft;
ugbutt[UG_TOP].x2=ug.xright;
ugbutt[UG_TOP].y1=ug.ytop;
ugbutt[UG_TOP].y2=ug.ytop;
ugbutt[UG_BOTTOM].x1=ug.xleft;
ugbutt[UG_BOTTOM].x2=ug.xright;
ugbutt[UG_BOTTOM].y1=ug.ybottom;
ugbutt[UG_BOTTOM].y2=ug.ybottom;
// Draw the border lines
graph_borders((void*)&ug,7);
settextcolor(7);
make_button(ug.xleft+text_width,ug.ybottom-3*text_height/2-2,
                                         ugbutt,UG_DECREASE_PAR1,25);
make_button(ug.xright-text_width,ug.ybottom-3*text_height/2-2,
                                     ugbutt,UG_INCREASE_PAR1,24); 
make_button(ug.xleft+text_width,ug.ybottom-text_height/2-2,
                                         ugbutt,UG_DO_WHATEVER,'A');
show_user_parms();
resume_thread(THREAD_SCREEN);
}
Exemplo n.º 5
0
Arquivo: menu.c Projeto: g7/fbpanel
static int
menu_constructor(plugin_instance *p)
{
    menu_priv *m;

    ENTER;
    m = (menu_priv *) p;
    m->icon_size = MENU_DEFAULT_ICON_SIZE;
    XCG(p->xc, "iconsize", &m->icon_size, int);
    DBG("icon_size=%d\n", m->icon_size);
    make_button(p, p->xc);
    g_signal_connect_swapped(G_OBJECT(icon_theme),
        "changed", (GCallback) schedule_rebuild_menu, p);
    schedule_rebuild_menu(p);
    RET(1);
}
Exemplo n.º 6
0
static void sendbutton(int button, int x, int y, Window w, Window s)
{
	make_button(button, x, y, (XButtonEvent*)&xev);
	xev.xbutton.window = w;
	xev.xbutton.subwindow = s;
	sendpointer_enter_or_leave(w, EnterNotify);
	sendpointer_enter_or_leave(s, EnterNotify);

	XSendEvent(dpy, w, True, ButtonPressMask, &xev);
	XSync(dpy, True);
	xev.type = ButtonRelease;
	xev.xkey.state |= 0x100;
	usleep(1000);
	xev.xkey.time = fake_timestamp();
	XSendEvent(dpy, w, True, ButtonReleaseMask, &xev);
	sendpointer_enter_or_leave(s, LeaveNotify);
	sendpointer_enter_or_leave(w, LeaveNotify);
	XSync(dpy, True);
}
void edit_properties(GtkWidget *widget, gpointer data)
{
   GtkWidget *props_window;
   GtkWidget *main_box;
   GtkWidget *settings_box;
   GtkWidget *wide_box;
   GtkWidget *general_frame;
   GtkWidget *general_box;

   GtkWidget *syntax_frame;
   GtkWidget *syntax_box;
   GtkWidget *bracket_frame;
   GtkWidget *bracket_box;
   GtkWidget *tabs_frame;
   GtkWidget *tabs_box;
   GtkWidget *compile_frame;
   GtkWidget *compile_box;
  
   GtkWidget *util_box;
   GtkWidget *util_label;

   GtkWidget *buttons_box;
   GtkWidget *ok_button;
   GtkWidget *defaults_button;
   GtkWidget *undo_button;
   GtkWidget *close_button;
   FileProps *file_props;
   gchar *chars = NULL;
   GtkWidget *hsep;

   if(cur_file->props_dialog && GTK_IS_WINDOW(cur_file->props_dialog))
   {
      gdk_window_raise(cur_file->props_dialog->window);
      return;
   }

   file_props = g_new(FileProps, 1);
   file_props->defaults = cur_file->tables ? &cur_file->tables->props : NULL;
   file_props->current = &cur_file->props;
   file_props->backups = g_new(GdsFileProperties, 1);

   copy_properties(file_props->backups, file_props->current);

   props_window = gtk_window_new(GTK_WINDOW_DIALOG);
   gtk_container_set_border_width(GTK_CONTAINER(props_window), 5);
   chars = g_strconcat(_("GdsFileProperties Editor - "), cur_file->filename, NULL);
   gtk_window_set_title(GTK_WINDOW(props_window), chars);
   g_free(chars);
   cur_file->props_dialog = props_window;

   main_box = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(props_window), main_box);
   gtk_widget_show(main_box);

   settings_box = gtk_vbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(settings_box), 0);
   gtk_box_pack_start(GTK_BOX(main_box), settings_box, FALSE, FALSE, 0);
   gtk_widget_show(settings_box);

   /* File Settings */
   general_frame = gtk_frame_new(_("File Specific Settings"));
   gtk_box_pack_start(GTK_BOX(settings_box), general_frame, FALSE, FALSE, 0);
   gtk_widget_show(general_frame);

   wide_box = gtk_hbox_new(FALSE, 5);
   gtk_container_set_border_width(GTK_CONTAINER(wide_box), 5);
   gtk_container_add(GTK_CONTAINER(general_frame), wide_box);
   gtk_widget_show(wide_box);

   general_box = gtk_vbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(wide_box), general_box, TRUE, TRUE, 0);   
   gtk_widget_show(general_box);

   util_box = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(general_box), util_box, TRUE, TRUE, 5);
   gtk_container_set_border_width(GTK_CONTAINER(util_box), 5);
   gtk_widget_show(util_box);
   file_props->over_ride = make_button(_("Override defaults ?"), util_box, &file_props->current->over_ride);

   util_box = gtk_hbox_new(FALSE, 5);
   gtk_box_pack_start(GTK_BOX(general_box), util_box, TRUE, TRUE, 5);
   gtk_widget_show(util_box);
   util_label = gtk_label_new(_("Directory:"));
   gtk_box_pack_start(GTK_BOX(util_box), util_label, FALSE, FALSE, 0);   
   gtk_widget_show(util_label);   
   file_props->dir = gnome_direntry_new();
   gtk_box_pack_start(GTK_BOX(util_box), file_props->dir, TRUE, TRUE, 0);   
   gtk_widget_show(file_props->dir);   

   bracket_frame = gtk_frame_new(_("Bracket Highlighting"));
   gtk_box_pack_start(GTK_BOX(general_box), bracket_frame, FALSE, FALSE, 0);
   gtk_widget_show(bracket_frame);
   bracket_box = gtk_vbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(bracket_box), 5);
   gtk_container_add(GTK_CONTAINER(bracket_frame), bracket_box);   
   gtk_widget_show(bracket_box);
   util_box  = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(bracket_box), util_box, FALSE, TRUE, 0);         
   gtk_widget_show(util_box);
   file_props->bracketmatch = make_button(_("Enable bracket highlighting ?"), util_box, &file_props->current->bracketmatch);

   syntax_frame = gtk_frame_new(_("Syntax Highlighting"));
   gtk_box_pack_start(GTK_BOX(general_box), syntax_frame, FALSE, FALSE, 0);
   gtk_widget_show(syntax_frame);
   syntax_box = gtk_vbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(syntax_box), 5);
   gtk_container_add(GTK_CONTAINER(syntax_frame), syntax_box);   
   gtk_widget_show(syntax_box);
   util_box  = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(syntax_box), util_box, FALSE, TRUE, 0);         
   gtk_widget_show(util_box);
   file_props->syntax = make_button(_("Enable syntax highlighting ?"), util_box, &file_props->current->syntax);

   tabs_frame = gtk_frame_new(_("Indentation"));
   gtk_box_pack_start(GTK_BOX(general_box), tabs_frame, TRUE, TRUE, 0);
   gtk_widget_show(tabs_frame);
   tabs_box = gtk_vbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(tabs_box), 5);
   gtk_container_add(GTK_CONTAINER(tabs_frame), tabs_box);   
   gtk_widget_show(tabs_box);

   util_box = gtk_hbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(util_box), 5);
   gtk_box_pack_start(GTK_BOX(tabs_box), util_box, TRUE, TRUE, 0);
   gtk_widget_show(util_box);
   file_props->auto_indent = make_button(_("Auto Indent ?"), util_box, &file_props->current->auto_indent);

   util_box = gtk_hbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(util_box), 5);
   gtk_box_pack_start(GTK_BOX(tabs_box), util_box, TRUE, TRUE, 0);
   gtk_widget_show(util_box);
   file_props->use_spaces = make_button(_("Use spaces instead of tabs ?"), util_box, &file_props->current->use_spaces);

   util_box = gtk_hbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(util_box), 5);
   gtk_box_pack_start(GTK_BOX(tabs_box), util_box, TRUE, TRUE, 0);
   gtk_widget_show(util_box);
   util_label = gtk_label_new(_("Tab stop:"));
   gtk_box_pack_start(GTK_BOX(util_box), util_label, FALSE, FALSE, 0);
   gtk_widget_show(util_label);
   file_props->spaces_spin = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(0, 1, 8, 1, 2, 0)), 1, 0);
   gtk_box_pack_start(GTK_BOX(util_box), file_props->spaces_spin, TRUE, TRUE, 0);
   gtk_widget_show(file_props->spaces_spin);

   compile_frame = gtk_frame_new(_("Build Information"));
   gtk_box_pack_start(GTK_BOX(wide_box), compile_frame, TRUE, TRUE, 0);
   gtk_widget_show(compile_frame);
   compile_box = gtk_vbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(compile_box), 5);
   gtk_container_add(GTK_CONTAINER(compile_frame), compile_box);   
   gtk_widget_show(compile_box);

   util_box = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(compile_box), util_box, TRUE, TRUE, 5);
   gtk_widget_show(util_box);
   util_label = gtk_label_new(_("Compiler: "));
   gtk_box_pack_start(GTK_BOX(util_box), util_label, FALSE, FALSE, 0);   
   gtk_widget_show(util_label);
   file_props->compiler = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(util_box), file_props->compiler, TRUE, TRUE, 0);
   gtk_widget_show(file_props->compiler);

   util_box = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(compile_box), util_box, TRUE, TRUE, 5);
   gtk_widget_show(util_box);
   util_label = gtk_label_new(_("Debugger: "));
   gtk_box_pack_start(GTK_BOX(util_box), util_label, FALSE, FALSE, 0);   
   gtk_widget_show(util_label);
   file_props->debugger = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(util_box), file_props->debugger, TRUE, TRUE, 0);
   gtk_widget_show(file_props->debugger);

   util_box = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(compile_box), util_box, TRUE, TRUE, 5);
   gtk_widget_show(util_box);
   util_label = gtk_label_new(_("Execution: "));
   gtk_box_pack_start(GTK_BOX(util_box), util_label, FALSE, FALSE, 0);   
   gtk_widget_show(util_label);
   file_props->execution = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(util_box), file_props->execution, TRUE, TRUE, 0);
   gtk_widget_show(file_props->execution);
   
   hsep = gtk_hseparator_new();
   gtk_box_pack_start(GTK_BOX(main_box), hsep, FALSE, TRUE, 10);
   gtk_widget_show(hsep);

   buttons_box = gtk_hbutton_box_new();
   gtk_box_pack_start(GTK_BOX(main_box), buttons_box, FALSE, TRUE, 0);
   gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons_box), gnome_preferences_get_button_layout());
   gtk_button_box_set_spacing(GTK_BUTTON_BOX(buttons_box), GNOME_PAD);
   gtk_widget_show(buttons_box);

   ok_button = gnome_stock_button(GNOME_STOCK_BUTTON_OK);
   gtk_box_pack_start(GTK_BOX(buttons_box), ok_button, FALSE, TRUE, 0);
   gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", GTK_SIGNAL_FUNC(save_properties), file_props);
   gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", GTK_SIGNAL_FUNC(set_properties), cur_file);
   gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", GTK_SIGNAL_FUNC(kill_widget), GTK_OBJECT(props_window));
   GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT);
   gtk_widget_show(ok_button);

   defaults_button = gnome_stock_or_ordinary_button(_("Defaults"));
   gtk_box_pack_start(GTK_BOX(buttons_box), defaults_button, FALSE, TRUE, 0);
   gtk_signal_connect(GTK_OBJECT(defaults_button), "clicked", GTK_SIGNAL_FUNC(get_default_props), file_props);
   GTK_WIDGET_SET_FLAGS(defaults_button, GTK_CAN_DEFAULT);
   gtk_widget_show(defaults_button);

   undo_button = gnome_stock_or_ordinary_button(_("Undo"));
   gtk_box_pack_start(GTK_BOX(buttons_box), undo_button, FALSE, TRUE, 0);   
   gtk_signal_connect(GTK_OBJECT(undo_button), "clicked", GTK_SIGNAL_FUNC(get_backup_props), file_props);
   GTK_WIDGET_SET_FLAGS(undo_button, GTK_CAN_DEFAULT);
   gtk_widget_show(undo_button);

   close_button = gnome_stock_button(GNOME_STOCK_BUTTON_CLOSE);
   gtk_box_pack_end(GTK_BOX(buttons_box), close_button, FALSE, TRUE, 0);   
   gtk_signal_connect(GTK_OBJECT(close_button), "clicked", GTK_SIGNAL_FUNC(kill_widget), GTK_OBJECT(props_window));
   gtk_signal_connect(GTK_OBJECT(close_button), "clicked", GTK_SIGNAL_FUNC(redo_backup_props), file_props);
   GTK_WIDGET_SET_FLAGS(close_button, GTK_CAN_DEFAULT);
   gtk_widget_grab_default(close_button);
   gtk_widget_show(close_button);

   gtk_signal_connect(GTK_OBJECT(props_window), "destroy", GTK_SIGNAL_FUNC(kill_widget_ptr), &cur_file->props_dialog);
   gtk_signal_connect(GTK_OBJECT(props_window), "destroy", GTK_SIGNAL_FUNC(free_properties), file_props->backups);
   gtk_signal_connect(GTK_OBJECT(props_window), "destroy", GTK_SIGNAL_FUNC(kill_data), file_props);
   put_properties(file_props, file_props->current);
   gtk_widget_show(props_window);
}
Exemplo n.º 8
0
int
main (int argc,
    char *argv[])
{
  ClutterActor *actor, *stage, *buttons, *button;
  ChamplainMarkerLayer *layer;
  ChamplainPathLayer *path;
  gfloat width, total_width = 0;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 800, 600);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  /* Create the map view */
  actor = champlain_view_new ();
  clutter_actor_set_size (CLUTTER_ACTOR (actor), 800, 600);
  clutter_actor_add_child (stage, actor);

  /* Create the buttons */
  buttons = clutter_actor_new ();
  clutter_actor_set_position (buttons, PADDING, PADDING);

  button = make_button ("Zoom in");
  clutter_actor_add_child (buttons, button);
  clutter_actor_set_reactive (button, TRUE);
  clutter_actor_get_size (button, &width, NULL);
  total_width += width + PADDING;
  g_signal_connect (button, "button-release-event",
      G_CALLBACK (zoom_in),
      actor);

  button = make_button ("Zoom out");
  clutter_actor_add_child (buttons, button);
  clutter_actor_set_reactive (button, TRUE);
  clutter_actor_set_position (button, total_width, 0);
  clutter_actor_get_size (button, &width, NULL);
  g_signal_connect (button, "button-release-event",
      G_CALLBACK (zoom_out),
      actor);

  clutter_actor_add_child (stage, buttons);

  ClutterContent *canvas;
  canvas = clutter_canvas_new ();
  clutter_canvas_set_size (CLUTTER_CANVAS (canvas), 512, 256);
  g_signal_connect (canvas, "draw", G_CALLBACK (draw_background_tile), NULL);
  clutter_content_invalidate (canvas);
  champlain_view_set_background_pattern (CHAMPLAIN_VIEW (actor), canvas);

  /* Create the markers and marker layer */
  layer = create_marker_layer (CHAMPLAIN_VIEW (actor), &path);
  champlain_view_add_layer (CHAMPLAIN_VIEW (actor), CHAMPLAIN_LAYER (layer));

  /* Connect to the click event */
  clutter_actor_set_reactive (actor, TRUE);
  g_signal_connect (actor, "button-release-event",
      G_CALLBACK (map_view_button_release_cb),
      actor);

  /* Finish initialising the map view */
  g_object_set (G_OBJECT (actor), "zoom-level", 12,
      "kinetic-mode", TRUE, NULL);
  champlain_view_center_on (CHAMPLAIN_VIEW (actor), 45.466, -73.75);

  clutter_actor_show (stage);
  clutter_main ();

  return 0;
}
Exemplo n.º 9
0
StartWindow::StartWindow(void)
	:
	BWindow(BRect(0, 0, -1, -1), "Paladin", B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	RegisterWindow();

	AddShortcut('O', B_COMMAND_KEY, new BMessage(M_SHOW_OPEN_PROJECT));
	AddShortcut('N', B_COMMAND_KEY, new BMessage(M_NEW_PROJECT));
	AddShortcut('I', B_COMMAND_KEY, new BMessage(M_SHOW_IMPORT));

	AddCommonFilter(new EscapeCancelFilter());

	// new button and label

	fNewButton = make_button("new", "NewProjectButtonUp.png",
		"NewProjectButtonDown.png", M_NEW_PROJECT);

	ClickableStringView* newLabel = make_label(fNewButton, TR("Create a new project"));
	newLabel->SetMessage(new BMessage(M_NEW_PROJECT));

	// open button and label

	fOpenButton = make_button("open", "OpenProjectButtonUp.png",
		"OpenProjectButtonDown.png", M_SHOW_OPEN_PROJECT);

	ClickableStringView* openLabel = make_label(fOpenButton, "Open a project");
	openLabel->SetMessage(new BMessage(M_SHOW_OPEN_PROJECT));

	// open recent button and label

	fOpenRecentButton = make_button("openrecent", "OpenRecentButtonUp.png",
		"OpenRecentButtonDown.png", M_OPEN_SELECTION);
	SetToolTip(fOpenRecentButton,
		TR("Open a project in the list on the right. You "
		   "can also press Command + a number key."));

	ClickableStringView* openRecentLabel = make_label(fOpenRecentButton,
		TR("Open the selected project"));
	openRecentLabel->SetMessage(new BMessage(M_OPEN_SELECTION));

	// quick import button and label

	fQuickImportButton = make_button("quickimport", "QuickImportButtonUp.png",
		"QuickImportButtonDown.png", M_SHOW_IMPORT);
	SetToolTip(fQuickImportButton,
		TR("Quickly make a project by importing all source files and resource files.\n"
		   "You can also import a BeIDE project."));

	ClickableStringView* quickImportLabel = make_label(fQuickImportButton,
		"Import an existing project");
	quickImportLabel->SetMessage(new BMessage(M_SHOW_IMPORT));
	SetToolTip(quickImportLabel,
		TR("Quickly make a project by importing all source files "
		   "and resource files.\n You can also import a BeIDE project."));

	// online import button and label

	fOnlineImportButton = make_button("onlineimport", "OnlineImportButtonUp.png",
		"OnlineImportButtonDown.png", M_ONLINE_IMPORT);
	SetToolTip(fQuickImportButton,
		TR("Import a project from an online repository"));

	ClickableStringView* onlineImportLabel = make_label(fOnlineImportButton,
		"Import a project from online");
	onlineImportLabel->SetMessage(new BMessage(M_ONLINE_IMPORT));
	SetToolTip(onlineImportLabel, TR("Import a project from an online repository"));

	// recent projects list view and scroller

	fRecentProjectsListView = new RecentProjectsList();
	// set the minimum width to 16em
	float minWidth = fRecentProjectsListView->StringWidth("M") * 16;
	fRecentProjectsListView->SetExplicitMinSize(BSize(minWidth, B_SIZE_UNSET));
	fRecentProjectsListView->SetInvocationMessage(new BMessage(M_OPEN_SELECTION));
	SetToolTip(fRecentProjectsListView,
		"Open a recent project. You can also press Command + a number key.");

	BLayoutBuilder::Group<>(this, B_HORIZONTAL)
		.AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
			.Add(fNewButton, 0, 0)
			.Add(newLabel, 1, 0)

			.Add(fOpenButton, 0, 1)
			.Add(openLabel, 1, 1)

			.Add(fOpenRecentButton, 0, 2)
			.Add(openRecentLabel, 1, 2)

			.Add(fQuickImportButton, 0, 3)
			.Add(quickImportLabel, 1, 3)

			.Add(fOnlineImportButton, 0, 4)
			.Add(onlineImportLabel, 1, 4)
			.End()
		.AddStrut(20)
		.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
			.Add(new BStringView("recentProjectsLabel", TR("Recent projects:")))
			.Add(new BScrollView("recentProjectsScroller", fRecentProjectsListView, 0,
				false, true))
			.End()
		.SetInsets(B_USE_DEFAULT_SPACING)
		.End();

#ifdef DISABLE_ONLINE_IMPORT
	fOnlineImportButton->Hide();
#endif

	BMessenger messager(this);
	BEntry entry(gProjectPath.GetFullPath());
	entry_ref ref;
	entry.GetRef(&ref);
	fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messager, &ref, B_FILE_NODE, true,
		new BMessage(M_OPEN_PROJECT));
	BString titleString(TR("Open Project"));
	titleString.Prepend("Paladin: ");
	fOpenPanel->Window()->SetTitle(titleString.String());

	fImportPanel = new BFilePanel(B_OPEN_PANEL, &messager, &ref, B_DIRECTORY_NODE,
		true, new BMessage(M_QUICK_IMPORT));
	titleString = TR("Choose Project Folder");
	titleString.Prepend("Paladin: ");
	fImportPanel->Window()->SetTitle(titleString.String());

	gSettings.Lock();
	int32 index = 0;
	while (gSettings.FindRef("recentitems", index++, &ref) == B_OK) {
		if (!BEntry(&ref).Exists()) {
			index--;
			gSettings.RemoveData("recentitems",index);
		} else
			fRecentProjectsListView->AddItem(new RefStringItem(ref),0);
	}
	gSettings.Unlock();

	// Alt + number opens that number project from the list
	int32 count = (fRecentProjectsListView->CountItems() > 9) ? 9 : fRecentProjectsListView->CountItems();
	for (int32 i = 0; i < count; i++) {
		BMessage* listMessage = new BMessage(M_OPEN_FROM_LIST);
		listMessage->AddInt32("index", i);
		AddShortcut('1' + i, B_COMMAND_KEY, listMessage);
	}

	fNewButton->MakeFocus(true);

	CenterOnScreen();
}
Exemplo n.º 10
0
void make_users_control_graph(void)
{
pause_thread(THREAD_SCREEN);
// Set a negative number here.
// In case several windows are desired, give them different
// negative numbers and use scro[m].no to decide what to do
// in your mouse_on_users_graph routine.
check_ug_borders();  // required for move graph
scro[users_graph_scro].no=USERS_GRAPH_TYPE1;
// These are the coordinates of the border lines.
scro[users_graph_scro].x1=ug.xleft;
scro[users_graph_scro].x2=ug.xright;
scro[users_graph_scro].y1=ug.ytop;
scro[users_graph_scro].y2=ug.ybottom;
// Each border line is treated as a button.
// That is for the mouse to get hold of them so the window can be moved.
ugbutt[UG_LEFT].x1=ug.xleft;
ugbutt[UG_LEFT].x2=ug.xleft+2;
ugbutt[UG_LEFT].y1=ug.ytop;
ugbutt[UG_LEFT].y2=ug.ybottom;
ugbutt[UG_RIGHT].x1=ug.xright;
ugbutt[UG_RIGHT].x2=ug.xright-2;
ugbutt[UG_RIGHT].y1=ug.ytop;
ugbutt[UG_RIGHT].y2=ug.ybottom;
ugbutt[UG_TOP].x1=ug.xleft;
ugbutt[UG_TOP].x2=ug.xright;
ugbutt[UG_TOP].y1=ug.ytop;
ugbutt[UG_TOP].y2=ug.ytop+2;
ugbutt[UG_BOTTOM].x1=ug.xleft;
ugbutt[UG_BOTTOM].x2=ug.xright;
ugbutt[UG_BOTTOM].y1=ug.ybottom;
ugbutt[UG_BOTTOM].y2=ug.ybottom-2;
// Draw the border lines
graph_borders((void*)&ug,7);
ug_oldx=-10000;                   //from freq_control
settextcolor(7);
make_button(ug.xleft+27.5*text_width+2,ug.ybottom-1*text_height/2-1,
                                         ugbutt,UG_DECREASE_OFFS_HZ,25);
make_button(ug.xleft+29*text_width+2,ug.ybottom-1*text_height/2-1,
                                     ugbutt,UG_INCREASE_OFFS_HZ,24); 

make_button(ug.xleft+27.5*text_width+2,ug.ybottom-3*text_height/2-1,
                                         ugbutt,UG_DECREASE_OFFS_KHZ,25);
make_button(ug.xleft+29*text_width+2,ug.ybottom-3*text_height/2-1,
                                     ugbutt,UG_INCREASE_OFFS_KHZ,24); 

make_button(ug.xleft+27.5*text_width+2,ug.ybottom-5*text_height/2-1,
                                         ugbutt,UG_DECREASE_SERPORT_NMBR,25);
make_button(ug.xleft+29*text_width+2,ug.ybottom-5*text_height/2-1,
                                     ugbutt,UG_INCREASE_SERPORT_NMBR,24);

make_button(ug.xleft+57.5*text_width+2,ug.ytop+1.5*text_height/2-1,
                                         ugbutt,UG_DECREASE_TRANSCEIVER_NMBR,25);
make_button(ug.xleft+59*text_width+2,ug.ytop+1.5*text_height/2-1,
                                     ugbutt,UG_INCREASE_TRANSCEIVER_NMBR,24);
show_user_parms();
//draw separatorlines in usergraph
//vertical
lir_line(ug.xleft+30.5*text_width,ug.ytop+1.3*text_height,ug.xleft+30.5*text_width,ug.ybottom,7);
lir_line(ug.xleft+10*text_width,ug.ytop+0*text_height,ug.xleft+10*text_width,ug.ytop+1.3*text_height,7);
//horizontal
lir_line(ug.xleft,ug.ytop+1.3*text_height,ug.xright,ug.ytop+1.3*text_height,7);
//
resume_thread(THREAD_SCREEN);
}
Exemplo n.º 11
0
void make_meter_graph(int clear_old)
{
int i, ypix, sunit_flag;
double t1, t2;
if(clear_old)
  {
  pause_thread(THREAD_SCREEN);
  hide_mouse(mg_old_x1,mg_old_x2,mg_old_y1,mg_old_y2);
  lir_fillbox(mg_old_x1,mg_old_y1,mg_old_x2-mg_old_x1+1,
                                                    mg_old_y2-mg_old_y1+1,0);
  }
current_graph_minh=MG_MIN_HEIGHT;
current_graph_minw=MG_MIN_WIDTH;
check_graph_placement((void*)(&mg));
clear_button(mgbutt, MAX_MGBUTT);
scro[meter_graph_scro].no=METER_GRAPH;
scro[meter_graph_scro].x1=mg.xleft;
scro[meter_graph_scro].x2=mg.xright;
scro[meter_graph_scro].y1=mg.ytop;
scro[meter_graph_scro].y2=mg.ybottom;
// Each border line is treated as a button.
// That is for the mouse to get hold of them so the window can be moved.
mgbutt[MG_LEFT].x1=mg.xleft;
mgbutt[MG_LEFT].x2=mg.xleft+2;
mgbutt[MG_LEFT].y1=mg.ytop;
mgbutt[MG_LEFT].y2=mg.ybottom;
mgbutt[MG_RIGHT].x1=mg.xright-2;
mgbutt[MG_RIGHT].x2=mg.xright;
mgbutt[MG_RIGHT].y1=mg.ytop;
mgbutt[MG_RIGHT].y2=mg.ybottom;
mgbutt[MG_TOP].x1=mg.xleft;
mgbutt[MG_TOP].x2=mg.xright;
mgbutt[MG_TOP].y1=mg.ytop;
mgbutt[MG_TOP].y2=mg.ytop+2;
mgbutt[MG_BOTTOM].x1=mg.xleft;
mgbutt[MG_BOTTOM].x2=mg.xright;
mgbutt[MG_BOTTOM].y1=mg.ybottom-2;
mgbutt[MG_BOTTOM].y2=mg.ybottom;
if(mg.xright-mg.xleft < 12.5*text_width)
  {
  mg_bar=TRUE;
  for(i=4; i<MAX_MGBUTT; i++)
    {
    mgbutt[i].x1=screen_width+1;
    mgbutt[i].x2=screen_width+1;
    }
  }
else
  {
  mg_bar=FALSE;
  make_button(mg.xright-3*text_width,mg.ybottom-text_height/2-2,
                                                  mgbutt,MG_INCREASE_AVGN,27); 
  make_button(mg.xright-5*text_width,mg.ybottom-text_height/2-2,
                                                  mgbutt,MG_DECREASE_AVGN,26);
  make_button(mg.xleft+text_width,mg.ytop+text_height/2+2,
                                                  mgbutt,MG_INCREASE_GAIN,24); 
  make_button(mg.xleft+text_width,mg.ybottom-text_height/2-2,
                                                  mgbutt,MG_DECREASE_GAIN,25);
  make_button(mg.xright-text_width,mg.ybottom-text_height/2-2,
                                                  mgbutt,MG_INCREASE_YREF,25); 
  make_button(mg.xright-text_width,mg.ytop+text_height/2+2,
                                                  mgbutt,MG_DECREASE_YREF,24); 
  make_button(mg.xright-3*text_width,mg.ytop+text_height/2+2,
                                                 mgbutt,MG_CHANGE_TRACKS,' ');
  if(mg.scale_type != MG_SCALE_DB)
    {
    mgbutt[MG_CHANGE_CAL].x1=mg.xleft+2*text_width;
    mgbutt[MG_CHANGE_CAL].x2=mg.xleft+8.5*text_width;
    mgbutt[MG_CHANGE_CAL].y1=mg.ytop+1;
    mgbutt[MG_CHANGE_CAL].y2=mg.ytop+text_height+2;
    }
  else
    {
    mgbutt[MG_CHANGE_CAL].x1=screen_width+1;
    mgbutt[MG_CHANGE_CAL].x2=screen_width+1;
    }  
  mgbutt[MG_CHANGE_TYPE].x1=mg.xleft+2*text_width;
  mgbutt[MG_CHANGE_TYPE].y1=mg.ybottom-3-text_height;
  mgbutt[MG_CHANGE_TYPE].y2=mg.ybottom-2;
  switch (mg.scale_type)
    {
    case MG_SCALE_DB:
    mgbutt[MG_CHANGE_TYPE].x2=mg.xleft+4.5*text_width;
    break;
  
    case MG_SCALE_DBM:
    mgbutt[MG_CHANGE_TYPE].x2=mg.xleft+5.5*text_width;
    break;

    case MG_SCALE_SUNITS:
    mgbutt[MG_CHANGE_TYPE].x2=mg.xleft+3.5*text_width;
    break;
    }
  }
mg_first_xpixel=mg.xleft+7*text_width;
mg_last_xpixel=mg.xright-1;
// ************************************************
// Make an Y-scale in dB, dBm or S-units.
// ************************************************
// The separation between scale lines, has to be at least
// MG_MIN_SCALESEP*text_height. In dB this corresponds to mg_dbstep.
mg_dbstep=10*MG_MIN_SCALESEP*text_height/mg.ygain;
if(mg.scale_type == MG_SCALE_SUNITS)
  {  
  i=1+mg_dbstep/6;
  mg_dbstep=6*i;
  }
else
  {
  adjust_scale(&mg_dbstep);
  }
// Make mg_dbscale_start the dB value for the first pixel in the graph (mg_rms_meter[]=0)
// Then make it a multiple of mg_dbstep and make sure we have enough
// space to write text. 
mg_scale_offset=0;
if(mg.scale_type == MG_SCALE_DBM)mg_scale_offset=106+fg.gain+mg.cal_dbm;
if(mg.scale_type == MG_SCALE_SUNITS)mg_scale_offset=6+fg.gain+mg.cal_s_units;
mg_dbscale_start=-10*mg.yzero/mg.ygain-mg_scale_offset;      
mg_dbscale_start/=mg_dbstep;
mg_dbscale_start=(int)mg_dbscale_start;
mg_dbscale_start*=mg_dbstep;
for(i=0; i<screen_height; i++)mg_behind_meter[i]=0;
mg_ymin=mg.ybottom-5-text_height;
mg_ymax=mg.ytop+3+text_height;
ypix=mg.yzero+0.1*mg.ygain*(mg_dbscale_start+mg_scale_offset);
mg_midscale=mg_dbscale_start;
t1=mg_dbscale_start;
t2=mg_dbstep;
sunit_flag=0;
mg_bar_x1=mg.xleft+2*text_width;
mg_bar_x2=mg_bar_x1+3*text_width;
mg_y0=mg.ybottom-1;
while(mg_ymin-ypix > mg_ymax)
  {
  if(ypix >=0)
    {
    if(mg.scale_type == MG_SCALE_SUNITS)
      {
      if(t1 > 54.111 && sunit_flag == 0)
        {
        sunit_flag=1;
        i=1+mg_dbstep/5;
        t2=5*i;
        t1=54+t2;
        ypix=mg.yzero+0.1*mg.ygain*(t1+mg_scale_offset);
        }        
      }
    if(mg_ymin-ypix > mg_ymax)
      {
      mg_behind_meter[mg_ymin-ypix]=57;
      }
    }
  t1+=t2;
  ypix=mg.yzero+0.1*mg.ygain*(t1+mg_scale_offset);
  }
mg_midscale=0.1*(mg_scale_offset+(mg_midscale+t1-t2)*0.5);
make_modepar_file(GRAPHTYPE_MG);
for(i=0; i<ui.rx_rf_channels*mg_size; i++)
  {
  mg_peak_ypix[i]=mg_ymin;
  mg_rms_ypix[i]=mg_ymin;
  }
sc[SC_MG_REDRAW]++;
if(clear_old) resume_thread(THREAD_SCREEN);
}
Exemplo n.º 12
0
Arquivo: motif.c Projeto: E-LLP/QuIP
Nav_Panel *create_nav_panel(QSP_ARG_DECL  const char *name)
{
	Nav_Panel *np_p;
#ifdef HAVE_MOTIF
	Panel_Obj *po;
#endif


	np_p = new_nav_panel(QSP_ARG  name);
	if( np_p == NO_NAV_PANEL ){
		sprintf(ERROR_STRING,
"create_nav_panel:  error creating nav_panel \"%s\"!?",name);
		WARN(ERROR_STRING);
		return NO_NAV_PANEL;
	}
	SET_GW_TYPE( NAVP_GW(np_p), GW_NAV_PANEL );

#ifdef HAVE_MOTIF

// BUG on iOS the panel size defaults to the whole screen...

#define DEFAULT_NAV_PANEL_WIDTH		480
#define DEFAULT_NAV_PANEL_HEIGHT	720

	// Now make a regular panel...
	// new_panel is supposed to push a scrnobj context...
	po = new_panel(QSP_ARG  name, DEFAULT_NAV_PANEL_WIDTH, DEFAULT_NAV_PANEL_HEIGHT );
	if( po == NO_PANEL_OBJ ){
		WARN("Error creating panel for nav_panel!?");
		// BUG clean up (delete np_p)
		return NULL;
	}
	//np_p->np_po = po;
	SET_NAVP_PANEL(np_p,po);

	SET_GW_TYPE(PO_GW(po),GW_NAV_PANEL_OBJ);

#endif /* HAVE_MOTIF */

	IOS_Item_Context *icp;
	
	icp = create_navgrp_context(QSP_ARG  name );
	// We need to push the context, and pop when we finish?
	// We don't push until we enter the navigation submenu...

//fprintf(stderr,"create_nav_panel, pushing group context %s\n",
//CTX_NAME(icp));
//	PUSH_ITEM_CONTEXT(nav_group_itp, icp);
	SET_NAVP_GRP_CONTEXT(np_p, icp);

	icp = create_navitm_context(QSP_ARG  name );
//	PUSH_ITEM_CONTEXT(nav_item_itp, icp);
	SET_NAVP_ITM_CONTEXT(np_p, icp);

	// In motif, we don't have real nav panels (an iOS-ism)
	// So to emulate the functionality, we have to add
	// a "back" button...
	{
	Screen_Obj *bo;
	prepare_for_decoration(QSP_ARG  NAVP_PANEL(np_p) );

	// next 7 lines from get_parts, screen_objs.c
	bo = simple_object(QSP_ARG  "Back");
	if( bo == NO_SCREEN_OBJ ){
		WARN("Error creating back button for nav_panel!?");
		goto no_back_button;
	}

	SET_SOB_ACTION(bo, savestr("Pop_Nav"));

	// next 6 lines from mk_button, screen_objs.c
	SET_SOB_TYPE(bo, SOT_BUTTON);

	make_button(QSP_ARG  bo);
	add_to_panel(curr_panel,bo);

	INC_PO_CURR_Y(curr_panel, BUTTON_HEIGHT + GAP_HEIGHT );



	unprepare_for_decoration(SINGLE_QSP_ARG);
	}
no_back_button:

	return np_p;
} // create_nav_panel