Пример #1
0
int
lapsi_backend_init(CustomData *data,int* argc,char*** argv)
{
  GstBus *bus;

  /* Initialize our data structure */
  memset (data, 0, sizeof (data));
  data->duration = GST_CLOCK_TIME_NONE;

  /* Create the elements */
  data->playbin = gst_element_factory_make ("playbin", "playbin");

  if (!data->playbin)
  {
    g_printerr ("Not all elements could be created.\n");
    return -1;
  }

  /* Connect to interesting signals in playbin */
  bus = gst_element_get_bus (data->playbin);
  gst_bus_add_signal_watch (bus);

  /* Create the GUI */
  create_ui (data);

  /* Instruct the bus to emit signals for each received message, and connect to the interesting signals */
  gst_bus_set_sync_handler(bus,(GstBusSyncHandler)busSyncHandler,NULL,NULL);
  g_signal_connect (G_OBJECT (bus), "message::error", (GCallback)error_cb, data);
  g_signal_connect (G_OBJECT (bus), "message::eos", (GCallback)eos_cb, data);
  g_signal_connect (G_OBJECT (bus), "message::state-changed", (GCallback)state_changed_cb,data);
  return 0;

}
Пример #2
0
// /////////////////////////////////////////////////////////////////
// display_help
// /////////////////////////////////////////////////////////////////
void
HelpAgent::display_help (Widget w)
{
  char* locator_id=get_locator_id(w);
  if(locator_id == NULL)
  {
    message_mgr().error_dialog ((char*)UAS_String(
                  CATGETS(Set_Messages, 3, "No help available")));
    return;
  }

  Wait_Cursor bob;

  if (f_helper == NULL)
    create_ui();
  XtVaSetValues(f_helper,
                DtNhelpType, DtHELP_TYPE_TOPIC,
                DtNhelpVolume, "Infomgr",
                DtNlocationId, locator_id,
                XmNdialogStyle, XmDIALOG_MODELESS,
                NULL);

  XtManageChild(f_helper);
  Popup();
}
Пример #3
0
static xtk_widget_t*
create_skinned_box(xtk_widget_t *c, skin_t *skin, tcconf_section_t *sec,
                   tchash_table_t *parameters)
{
    int x, y, width, height;
    widget_data_t *wd;
    int i=0;

    i += tcconf_getvalue(sec, "position", "%d %d", &x, &y);
    i += tcconf_getvalue(sec, "size", "%d %d", &width, &height);

    if(i != 4){
        return NULL;
    }

    xtk_widget_t *w = xtk_widget_container_create(c, x, y, width, height);
    wd = tcallocdz(sizeof(*wd), NULL, widgetdata_free);
    wd->skin = tcref(skin);
    xtk_widget_container_set_data(w, wd);
    w->on_destroy = destroy_skinned_box;

    create_ui(w, skin, sec, parameters);

    return w;
}
Пример #4
0
GameOptionsState::GameOptionsState(Urho3D::Context *context,
                                   std::unique_ptr<Options> const &options)
    : GameState(context), m_options(options) {
    Urho3D::ResourceCache *cache = GetSubsystem<Urho3D::ResourceCache>();
    ui_factory =
        UIManager(context_, cache->GetResource<Urho3D::Font>("Fonts/Anonymous Pro.ttf", 20),
                  Urho3D::Color(), cache->GetResource<Urho3D::XMLFile>("UI/DefaultStyle.xml"),
                  GetSubsystem<Urho3D::UI>()->GetRoot());
    create_ui();
}
Пример #5
0
MainGameState::MainGameState(Urho3D::Context *context) : GameState(context) {

    Urho3D::ResourceCache *cache = GetSubsystem<Urho3D::ResourceCache>();
    ui_factory =
        UIManager(context_, cache->GetResource<Urho3D::Font>("Fonts/Anonymous Pro.ttf", 20),
                  Urho3D::Color(), cache->GetResource<Urho3D::XMLFile>("UI/DefaultStyle.xml"),
                  GetSubsystem<Urho3D::UI>()->GetRoot());
    create_ui();
    subscribe_to_events();
    m_systems.add<TestSystem>();
    m_systems.configure();
}
Пример #6
0
void
PrefAgent::display()
{
  Wait_Cursor bob;
  if (f_shell == 0)
    create_ui();

  // Always reset on new popup. 
  reset();

  f_shell.Popup();
  f_shell.DeIconify();
}
Пример #7
0
PUSS_EXPORT void* puss_plugin_create(Puss* app) {
	SearchTools* self;

	bindtextdomain(TEXT_DOMAIN, app->get_locale_path());
	bind_textdomain_codeset(TEXT_DOMAIN, "UTF-8");

	self = g_new0(SearchTools, 1);
	self->app = app;
	create_ui(self);

	g_object_ref(self->result_store);

	return self;
}
Пример #8
0
int main (int argc, char *argv[])
{
    /* Initialisation */
    gst_init (&argc, &argv);

    /* Initialize GTK */
    gtk_init (&argc, &argv);

    /* initialize out gstreamer pipeline */
    create_pipeline();

    /* create our window that shall display everything */
    w = create_ui();
    
    /* do not display the video in own frame but integrate it into our window */
    gst_x_overlay_set_window_handle(GST_X_OVERLAY(p.sink), GDK_WINDOW_XID(w->video_window->window));

    /* Set the pipeline to "playing" state */
    g_print ("Now playing stream from: %s\n", CAMERA);

    /*
       IMPORTANT after state changed to playing the capabilities are fixed.
     */
    gst_element_set_state (p.pipeline, GST_STATE_PLAYING);

    g_print ("Running...");

    /* finished construction and now run the main loop while waiting for user interaction */
    g_main_loop_run (p.loop);

    
    /* ===== clean up ===== */

    /* Out of the main loop, clean up nicely */
    g_print ("Returned, stopping playback\n");
    gst_element_set_state (p.pipeline, GST_STATE_PAUSED);
    gst_element_set_state (p.pipeline, GST_STATE_NULL);

    g_print("Deleting pipeline\n");
    gst_object_unref (GST_OBJECT (p.pipeline));
    g_source_remove (p.bus_watch_id);
    g_main_loop_unref (p.loop);

    free(w);
    w = NULL;

    return 0;
}
/* External functions
 */
Game* create_game(void)
{
    int ii;
    Game* G = (Game*)calloc(1, sizeof(Game));
    G->timer = create_timer();
    G->graphics = create_graphics();
    G->ui = create_ui(G->graphics);

    /* Set up camera */
    G->camera = transform_zero;
    G->camera.orientation = quat_from_euler(0, -0.75f * kPi, 0);
    G->camera.position.x = 4.0f;
    G->camera.position.y = 2;
    G->camera.position.z = 7.5f;

    /* Load scene */
    reset_timer(G->timer);
    G->scene = create_scene("lightHouse.obj");
    G->sun_light.position = vec3_create(-4.0f, 5.0f, 2.0f);
    G->sun_light.color = vec3_create(1, 1, 1);
    G->sun_light.size = 35.0f;

    G->lights[0].color = vec3_create(1, 0, 0);
    G->lights[1].color = vec3_create(1, 1, 0);
    G->lights[2].color = vec3_create(0, 1, 0);
    G->lights[3].color = vec3_create(1, 0, 1);
    G->lights[4].color = vec3_create(0, 0, 1);
    G->lights[5].color = vec3_create(0, 1, 1);

    for(ii=0;ii<NUM_LIGHTS;++ii) {
        float x = (20.0f/NUM_LIGHTS) * ii - 8.0f;
        G->lights[ii].color = vec3_create(_rand_float(), _rand_float(), _rand_float());
        G->lights[ii].color = vec3_normalize(G->lights[ii].color);
        if(ii % 2)
            G->lights[ii].position = vec3_create(x, _rand_float()*3 + 2.0f, 0.0f);
        else
            G->lights[ii].position = vec3_create(0.0f, _rand_float()*3 + 2.0f, x);
        G->lights[ii].size = 5;
    }

    get_model(G->scene, 3)->material->specular_color = vec3_create(0.5f, 0.5f, 0.5f);
    get_model(G->scene, 3)->material->specular_coefficient = 1.0f;

    G->dynamic_lights = 1;

    reset_timer(G->timer);
    return G;
}
Пример #10
0
void
QueryEditor::display()
{
  static int count = 0;
  if (count++ == 0) {
    if (f_shell == NULL)
      create_ui();

    if (f_query == NULL)
      edit_query (NULL);

    f_shell.Popup();
    f_shell.DeIconify();
  }
  count--;
}
Пример #11
0
int main( int argc, char *argv[] )
{
	// Create communication channel, thank you.
	mkfifo( "/tmp/iv_fifo", 0700 );

	gtk_init( &argc, &argv );
	APP app;

	app.file = NULL;
	app.fifo = open( "/tmp/iv_fifo", O_RDONLY | O_NONBLOCK );
	app.fullscreen = FALSE;
	app.width = 300;
	app.height = 300;

	create_ui( &app );
	gtk_widget_set_size_request( GTK_WIDGET( app.win ), 300, 300 );

	g_signal_connect( G_OBJECT( app.win ), "key-press-event",
		G_CALLBACK( key_press ), &app );

	g_signal_connect( G_OBJECT( app.win ), "destroy",
		G_CALLBACK( quit ), &app );
	
	g_signal_connect( G_OBJECT( app.win ), "configure-event",
		G_CALLBACK( state_changed ), &app );

	// We call every 500ms function read_from_pipe so we can
	// get commands from our pipe.
	g_timeout_add( 500, (GSourceFunc)read_from_pipe, &app );

	// Load file if it is given as an argument
	if( argc == 2 )
	{
		app.file = malloc( strlen( argv[1] ) );
		sprintf( app.file, "%s", argv[1] );
		load_image( &app );
	}

	gtk_main();

	return 0;
}
Пример #12
0
int 
main(int argc, char** argv)
{
     /* Initialize glib type and thread system */
     g_type_init ();
     g_debug ("glib type system is initialized");

     /* Initializing window toolkit */
     gtk_init (&argc, &argv);
     g_debug ("gtk toolkit is initialized");
     

     GtkWindow *window = create_ui ();

     gtk_widget_show_all (GTK_WIDGET (window));

     g_debug ("About to start main gtk loop");
     /* Starting main loop */
     gtk_main ();


     g_debug ("Terminating app");
     return 0;
}
Пример #13
0
void
HelpAgent::display_help (const String locatoridResourceString)
{
  Wait_Cursor bob;

  if (f_helper == NULL)
    create_ui();

  if (f_appXrmDb)
  {
    char* type;
    XrmValue value;

    if(env().debug())
      cerr << "Resource string: " << locatoridResourceString << endl;
    if(XrmGetResource(f_appXrmDb, locatoridResourceString,
                        locatoridResourceString, &type, &value ))
    {
      if(env().debug())
        cerr << "Value: " << value.addr << endl;
      XtVaSetValues(f_helper,
                    DtNhelpType, DtHELP_TYPE_TOPIC,
                    DtNhelpVolume, "Infomgr",
                    DtNlocationId, value.addr,
                    XmNdialogStyle, XmDIALOG_MODELESS,
                    NULL);
      XtManageChild(f_helper);
      Popup();
    }
    else
    {
      message_mgr().error_dialog (UAS_String(
                    CATGETS(Set_Messages, 3, "No help available")));
    }
  }
}
Пример #14
0
int main(int argc, char *argv[]) {
  CustomData data;
  GstStateChangeReturn ret;
  GstBus *bus;
  
  /* Initialize GTK */
  gtk_init (&argc, &argv);
  
  /* Initialize GStreamer */
  gst_init (&argc, &argv);
  
  /* Initialize our data structure */
  memset (&data, 0, sizeof (data));
  data.duration = GST_CLOCK_TIME_NONE;
  
  /* Create the elements */
  data.playbin = gst_element_factory_make ("playbin", "playbin");
   
  if (!data.playbin) {
    g_printerr ("Not all elements could be created.\n");
    return -1;
  }
  
  /* Set the URI to play */
  g_object_set (data.playbin, "uri", "http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
  
  /* Connect to interesting signals in playbin */
  g_signal_connect (G_OBJECT (data.playbin), "video-tags-changed", (GCallback) tags_cb, &data);
  g_signal_connect (G_OBJECT (data.playbin), "audio-tags-changed", (GCallback) tags_cb, &data);
  g_signal_connect (G_OBJECT (data.playbin), "text-tags-changed", (GCallback) tags_cb, &data);
  
  /* Create the GUI */
  create_ui (&data);
  
  /* Instruct the bus to emit signals for each received message, and connect to the interesting signals */
  bus = gst_element_get_bus (data.playbin);
  gst_bus_add_signal_watch (bus);
  g_signal_connect (G_OBJECT (bus), "message::error", (GCallback)error_cb, &data);
  g_signal_connect (G_OBJECT (bus), "message::eos", (GCallback)eos_cb, &data);
  g_signal_connect (G_OBJECT (bus), "message::state-changed", (GCallback)state_changed_cb, &data);
  g_signal_connect (G_OBJECT (bus), "message::application", (GCallback)application_cb, &data);
  gst_object_unref (bus);
  
  /* Start playing */
  ret = gst_element_set_state (data.playbin, GST_STATE_PLAYING);
  if (ret == GST_STATE_CHANGE_FAILURE) {
    g_printerr ("Unable to set the pipeline to the playing state.\n");
    gst_object_unref (data.playbin);
    return -1;
  }
  
  /* Register a function that GLib will call every second */
  g_timeout_add_seconds (1, (GSourceFunc)refresh_ui, &data);
  
  /* Start the GTK main loop. We will not regain control until gtk_main_quit is called. */
  gtk_main ();
  
  /* Free resources */
  gst_element_set_state (data.playbin, GST_STATE_NULL);
  gst_object_unref (data.playbin);
  return 0;
}
Пример #15
0
extern skin_t*
tcvp_open_ui(xtk_widget_t *w, void *p)
{
    char *buf;
    widget_data_t *wd;

    widget_data_t *owd = xtk_widget_get_data(w);

    char *uifile = owd->action_data;
    skin_t *s = owd->skin;

    buf = malloc(strlen(uifile) + strlen(s->path) + 2);
    sprintf(buf, "%s/%s", s->path, uifile);

    skin_t *skin = load_skin(buf);
    if(!skin) {
        return NULL;
    }

    skin->window = xtk_window_create(NULL, 0, 0, skin->width, skin->height);
    xtk_window_set_dnd_callback(skin->window, tcvp_add_file);
    xtk_window_set_class(skin->window, "TCVP");

    if(create_ui(skin->window, skin, skin->config, NULL) != 0){
        tc2_print("TCVPX", TC2_PRINT_ERROR,
                  "Unable to load skin: \"%s\"\n", buf);
        return NULL;
    }

    free(buf);

    wd = tcallocdz(sizeof(*wd), NULL, widgetdata_free);
    wd->action = skin->dblclick;
    wd->skin = tcref(skin);
    xtk_widget_container_set_data(skin->window, wd);

    xtk_window_set_doubleclick_callback(skin->window, lookup_action);

    xtk_window_set_sticky_callback(skin->window, sticky_cb);
    xtk_window_set_on_top_callback(skin->window, on_top_cb);

    char *default_text = malloc(1024);
    tcconf_getvalue(skin->config, "title", "%s", &wd->value);
    if(wd->value == NULL) {
        wd->value = strdup(tcvp_ui_tcvpx_conf_window_title);
    }
    register_textwidget(skin->window, wd->value);

    parse_text(wd->value, default_text, 1024);
    xtk_window_set_title(skin->window, default_text);
    free(default_text);

    xtk_window_show(skin->window);

    if((s->state & ST_STICKY) != 0) {
        xtk_window_set_sticky(skin->window, 1);
        skin->state |= ST_STICKY;
    }

    if((s->state & ST_ON_TOP) != 0) {
        xtk_window_set_always_on_top(skin->window, 1);
        skin->state |= ST_ON_TOP;
    }

    tcconf_getvalue(skin->config, "id", "%s", &skin->id);
    skin->skin_hash = s->skin_hash;
    if(skin->id != NULL) {
        tchash_search(skin->skin_hash, skin->id, -1, skin, NULL);
    }

    ui_count++;

    return skin;
}
Пример #16
0
void synth_main()
{
	gfx_wave_render_initialise();
	gfx_envelope_render_initialise();

	create_settings();
	create_ui();

	gfx_event_initialise();
	gfx_initialise();

	patch_initialise();
	synth_initialise();
	configure_audio();
	configure_profiling();

	config_setting_t* piglow_config = config_lookup(&app_config, CFG_DEVICES_PIGLOW);
	if (piglow_config != NULL)
	{
		piglow_initialise(piglow_config);
	}

	waveform_initialise();
	gfx_register_event_global_handler(GFX_EVENT_BUFFERSWAP, process_buffer_swap);

	// Done after synth setup as this can load controller values into the synth
	configure_midi();

	int profiling = 0;

	int32_t last_timestamp = get_elapsed_time_ms();

	while (1)
	{
		int midi_controller_value;

		if (midi_controller_update_and_read(&exit_controller, &midi_controller_value))
		{
			break;
		}

		if (midi_controller_update_and_read(&screenshot_controller, &midi_controller_value))
		{
			static int screenshot_count = 0;
			char screenshot_name[64];
			sprintf(screenshot_name, "pithesiser-img-%03d.png", screenshot_count++);
			gfx_screenshot(screenshot_name);
		}

		process_midi_events();

		if (!profiling && midi_controller_update_and_read(&profile_controller, &midi_controller_value))
		{
			if (profile_file != NULL)
			{
				ProfilerStart(profile_file);
				profiling = 1;
			}
		}

		alsa_sync_with_audio_output();

		int32_t timestamp = get_elapsed_time_ms();
		process_audio(timestamp - last_timestamp);
		last_timestamp = timestamp;
	}

	if (profiling)
	{
		ProfilerStop();
	}

	synth_controllers_save(SETTINGS_FILE);
	patch_save();
	patch_deinitialise();
	piglow_deinitialise();
	gfx_deinitialise();
	destroy_ui();
	gfx_envelope_render_deinitialise();
	gfx_wave_render_deinitialise();
	mod_matrix_controller_deinitialise();
	alsa_deinitialise();
	midi_deinitialise();
	synth_deinitialise();
	config_destroy(&app_config);

	LOG_INFO("Done: %d xruns", alsa_get_xruns_count());
}
Пример #17
0
void
MapAgent::display (UAS_Pointer<UAS_Common> &doc_ptr, bool popup)
{
  static bool first_time = True;
  u_int i, num_children;
  MapButton *parent_button, *child_button, *this_button = NULL;

  if (f_shell == NULL)
    create_ui();

  // Just pop up the window if the map has already been created
  // for the specified document.
  if (doc_ptr == f_doc_ptr)
    {
      if (popup) {
	f_shell->Popup();
        XMapRaised(XtDisplay(*f_shell), XtWindow(*f_shell));
      }
      f_onscreen = TRUE;
      return;
    }

  // Must have to create a new tree, so start by wiping out the old one. 
  if (f_tree != NULL)
    {
      f_tree->Destroy();
      delete f_tree;
    }
  f_tree = new WXawTree (*f_porthole, "tree");
  //  f_tree->Realize();

  // Tree gravity should be a preference that is retrieved right here.
  // (Or better yet stored in the class record.) 

  /* -------- Start the local map at this node's parent. -------- */

  UAS_Pointer<UAS_Common> toc_this = doc_ptr;
  UAS_Pointer<UAS_Common> toc_parent =
      (doc_ptr != (UAS_Pointer<UAS_Common>)0)
	  ? doc_ptr->parent() : (UAS_Pointer<UAS_Common>)0;

  // If the entry has a parent, create a button for it and each of
  // the entry's siblings. 
  if (toc_parent != (UAS_Pointer<UAS_Common>)NULL)
    {
      parent_button = new MapButton (*f_tree, toc_parent, NULL);
      //  parent_button->expand();

      /* -------- Create a button for each sibling. -------- */

      UAS_List<UAS_Common> kids = toc_parent->children();
      num_children = kids.length();
      UAS_Pointer<UAS_Common> toc_kid;
      for (i = 0; i < num_children; i++)
	{
	  toc_kid = kids[i];
	  child_button = new MapButton (*f_tree, toc_kid, parent_button);
	  if (toc_kid == doc_ptr)
            {
              f_doc_ptr = doc_ptr;
   	      this_button = child_button;
            }
	}
    }
  else // No TOC parent -- SWM: Also may be no TOC!!!
    {
      f_doc_ptr = doc_ptr;
      this_button = new MapButton (*f_tree, toc_this, NULL);
    }

  if (this_button == NULL)
    {
      message_mgr().
	error_dialog (CATGETS(Set_Messages, 7, "File a Bug"));
      return;
    }
  else
    {
      static bool first_time = TRUE;
      static Pixel highlight_bg, highlight_fg;
      if (first_time)
	{
	  const char *s;
	  unsigned long status;
	  s = window_system().get_string_default ("MapHighlightBackground");
	  if (s == NULL || *s == '\0')
	    {
	      highlight_bg = this_button->f_button.Foreground();
	    }
	  else
	    {
	      status = window_system().get_color (s, highlight_bg);
	      // On failure to allocate, just invert. 
	      if (status == 0)
		{
		  highlight_bg = this_button->f_button.Foreground();
		  highlight_fg = this_button->f_button.Background();
		}
	      // Got bg, so now try for fg. 
	      else
		{
	          s = window_system().
		        get_string_default ("MapHighlightForeground");
		  if (s == NULL || *s == '\0')
		    {
		      highlight_fg =this_button->f_button.Background();
		    }
		  else
		    {
		      status = window_system().get_color (s, highlight_fg);
		      // If we cant get both colors, just invert the button. 
		      if (status == 0)
			{
			  Display *dpy = window_system().display();
			  XFreeColors (dpy,
				       DefaultColormap(dpy,DefaultScreen(dpy)),
				       &highlight_bg, 1, 0);
			  highlight_bg = this_button->f_button.Foreground();
			  highlight_fg = this_button->f_button.Background();
			}
		    }
		}
	    }
	  if (highlight_fg == this_button->f_button.Foreground() ||
	      highlight_bg == this_button->f_button.Background() ||
	      highlight_fg == highlight_bg)
	    {
	      highlight_bg = this_button->f_button.Foreground();
	      highlight_fg = this_button->f_button.Background();
	    }
	  first_time = FALSE;
	}
      this_button->f_button.Background (highlight_bg);
      this_button->f_button.Foreground (highlight_fg);
      //  this_button->expand();
    }

  /* -------- Create a button for each child. -------- */

  if (toc_this != (UAS_Pointer<UAS_Common>)NULL)
    {
      UAS_List<UAS_Common> myKids = toc_this->children();
      num_children = myKids.length();
      for (i = 0; i < num_children; i++)
	child_button =
	  new MapButton (*f_tree, myKids[i], this_button);

#if 0
  if (!XtIsRealized(*f_shell))
    {
      f_tree->Manage();
      f_shell->Realize();
    }
#endif

    }
  // Manage all the children.
  MapButton::ManageKids();

  UAS_String buffer = CATGETS(Set_MapAgent, 2, "Dtinfo: ");
  buffer = buffer + doc_ptr->title();
  f_shell->Title ((char*)buffer);

  if (!XtIsRealized (*f_shell))
    f_shell->Realize();

  f_tree->Realize();
  f_tree->ForceLayout();

  f_min_tree_width = f_tree->Width();
  f_min_tree_height = f_tree->Height();
  ON_DEBUG (printf ("+++++ Tree min dims: %d x %d\n",
		    f_min_tree_width, f_min_tree_height));

  center_on (this_button);
  f_tree->Manage();

  if (popup)
    {
      if (first_time)
	{
  	  WXmForm form (XtParent (XtParent (*f_panner)));
	  form.Height (50);
	  first_time = False;
	}
      f_shell->Popup();
      XMapRaised(XtDisplay(*f_shell), XtWindow(*f_shell));
    }

  f_onscreen = TRUE;
}