Пример #1
0
void QERPlug_Dispatch (const char* p, float* vMin, float* vMax, bool bSingleBrush)
{
  if( !strcmp( p, "New Fixed Camera" ) )
    DoNewFixedCamera();
  else if( !strcmp( p, "New Interpolated Camera" ) )
    DoNewInterpolatedCamera();
  else if( !strcmp( p, "New Spline Camera" ) )
    DoNewSplineCamera();
  else if( !strcmp( p, "Camera Inspector..." ) )
    DoCameraInspector();
  else if( !strcmp( p, "Preview Camera" ) )
    DoPreviewCamera();
  else if( !strcmp( p, "Load Camera..." ) )
    DoLoadCamera();
  else if( !strcmp( p, "About..." ) )
    g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, PLUGIN_ABOUT, "About", MB_OK, NULL );
}
Пример #2
0
static gint ci_new( GtkWidget *widget, gpointer data )
{
	GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame; //, *name;
	GtkWidget *fixed, *interpolated, *spline;
	EMessageBoxReturn ret;
  int loop = 1;
	GSList *targetTypeRadio = NULL;
//	char buf[128];

	// create the window
  window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
	gtk_window_set_title( GTK_WINDOW (window), "New Camera" );
  gtk_signal_connect( GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
  gtk_signal_connect( GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
  gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );

	g_object_set_data (G_OBJECT (window), "loop", &loop);
	g_object_set_data (G_OBJECT (window), "ret", &ret);

	gtk_widget_realize (window);

	// fill the window
	vbox = gtk_vbox_new( FALSE, 5 );
	gtk_container_add (GTK_CONTAINER (window), vbox);
	gtk_widget_show( vbox );

  // -------------------------- //

	hbox = gtk_hbox_new( FALSE, 5 );
  gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
	gtk_widget_show( hbox );

  frame = gtk_frame_new( "Type" );
  gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
  gtk_widget_show( frame );

	vbox2 = gtk_vbox_new( FALSE, 5 );
	gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
  gtk_container_set_border_width( GTK_CONTAINER (vbox2), 5 );
	gtk_widget_show( vbox2 );

	// -------------------------- //

	fixed = gtk_radio_button_new_with_label( targetTypeRadio, "Fixed" );
	gtk_box_pack_start( GTK_BOX( vbox2 ), fixed, FALSE, FALSE, 3 );
  gtk_widget_show( fixed );
  targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( fixed ) );

	interpolated = gtk_radio_button_new_with_label( targetTypeRadio, "Interpolated" );
	gtk_box_pack_start( GTK_BOX( vbox2 ), interpolated, FALSE, FALSE, 3 );
  gtk_widget_show( interpolated );
  targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( interpolated ) );

	spline = gtk_radio_button_new_with_label( targetTypeRadio, "Spline" );
	gtk_box_pack_start( GTK_BOX( vbox2 ), spline, FALSE, FALSE, 3 );
  gtk_widget_show( spline );
  targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( spline ) );

  // -------------------------- //

  w = gtk_hseparator_new ();
  gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 2);
  gtk_widget_show (w);

	// -------------------------- //

	hbox = gtk_hbox_new( FALSE, 5 );
  gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
	gtk_widget_show( hbox );

	w = gtk_button_new_with_label ("Ok");
	gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
	gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (eIDOK));
	gtk_widget_show (w);

	GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
	gtk_widget_grab_default( w );

	w = gtk_button_new_with_label ("Cancel");
	gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
	gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (eIDCANCEL));
	gtk_widget_show (w);
	ret = eIDCANCEL;

	// -------------------------- //

	gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
	gtk_widget_show (window);
	gtk_grab_add (window);

	bool dialogError = TRUE;
	while (dialogError) {
		loop = 1;
		while (loop)
			gtk_main_iteration ();
 
		dialogError = FALSE;

		if( ret == eIDOK ) {
			if( gtk_toggle_button_get_active( (GtkToggleButton*)fixed ) )
				DoNewFixedCamera();
			else if( gtk_toggle_button_get_active( (GtkToggleButton*)interpolated ) )
				DoNewInterpolatedCamera();
			else if( gtk_toggle_button_get_active( (GtkToggleButton*)spline ) )
				DoNewSplineCamera();
		}
	}

	gtk_grab_remove (window);
	gtk_widget_destroy (window);

  return TRUE;
}