Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AC_CHECK_FUNCS(getopt_long gettimeofday strcspn strdup strtod)

# Checks for GTK+ libraries.
#
AM_PATH_GTK_2_0(2.0.1, , AC_MSG_ERROR([Cannot find proper GTK+ version]))
PKG_CHECK_MODULES([GTK], [gtk+-3.0])

#
# Check for OpenGL libraries
Expand Down Expand Up @@ -71,11 +71,7 @@ if test -n "$with_gtkgl_prefix" ; then
GTKGL_LDOPTS="-L$with_gtkgl_prefix/lib"
fi

AC_CHECK_LIB(gtkgl-2.0, gtk_gl_area_new, ,
AC_MSG_ERROR([Cannot find GtkGLArea library.]),
$GTKGL_LDOPTS $GTK_LIBS $GL_LIBS)

GTKGL_LIBS="$GTKGL_LDOPTS -lgtkgl-2.0"
GTKGL_LIBS="$GTKGL_LDOPTS"

#
# Test for libpng
Expand Down
213 changes: 74 additions & 139 deletions src/gtkwidgets.c

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions src/infodisp.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ info_display( int message1, int message2 )

if (disp_velocity) {
sprintf( disp_str, STR_INF_velocity_ARG, velocity_string( velocity, TRUE ) );
ogl_draw_string( disp_str, POS_BOTTOM_LEFT, 2 );
/*TODO: Disable for now in GTK3*/ //ogl_draw_string( disp_str, POS_BOTTOM_LEFT, 2 );
}

if (disp_time_t) {
sprintf( disp_str, STR_INF_time_ARG, time_string( ) );
ogl_draw_string( disp_str, POS_TOP_LEFT, 2 );
/*TODO: Disable for now in GTK3*/ //ogl_draw_string( disp_str, POS_TOP_LEFT, 2 );
}

if (disp_gamma) {
sprintf( disp_str, STR_INF_gamma_ARG, lorentz_factor( velocity ) );
ogl_draw_string( disp_str, POS_BOTTOM_RIGHT, 1 );
/*TODO: Disable for now in GTK3*/ //ogl_draw_string( disp_str, POS_BOTTOM_RIGHT, 1 );
}

/* Get status of each of the warp transforms */
Expand All @@ -109,6 +109,8 @@ info_display( int message1, int message2 )
no_headlight = !warp( QUERY, MESG_(WARP_HEADLIGHT_EFFECT) );
no_doppler = !warp( QUERY, MESG_(WARP_DOPPLER_SHIFT) );

/*TODO: Disable for now in GTK3*/
/*
if (no_contract && no_doppler && no_headlight && no_deform)
ogl_draw_string( STR_INF_no_relativity, POS_TOP_RIGHT, 1 );
else {
Expand All @@ -124,10 +126,10 @@ info_display( int message1, int message2 )
if (no_deform)
ogl_draw_string( STR_INF_no_deformation, POS_TOP_RIGHT, 0 );
}

*/
if (disp_framerate) {
sprintf( disp_str, STR_INF_fps_ARG, framerate );
ogl_draw_string( disp_str, POS_TOP_RIGHT, 0 );
/*TODO: Disable for now in GTK3*/ //ogl_draw_string( disp_str, POS_TOP_RIGHT, 0 );
}

glEnable( GL_LIGHTING );
Expand Down
7 changes: 5 additions & 2 deletions src/lightspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,22 @@ main( int argc, char **argv )
gtk_init( &argc, &argv );

/* Check for OpenGL support (GLX extension) */
/* TODO: The check is temporarily deactivated as gdk_gl_query does not exist in GTK3 */
/*
if (gdk_gl_query( ) == FALSE) {
fprintf( stderr, "Light Speed! requires OpenGL support to run." );
fflush( stderr );
return -1;
}

*/

/* Generate/load initial object */
if (init_obj_file == NULL)
make_lattice( DEF_LATTICE_X, DEF_LATTICE_Y, DEF_LATTICE_Z, DEF_LATTICE_SMOOTH );
else {
i = import_objects( init_obj_file );
if (i < 0) {
gtk_timeout_add( 5000, (GtkFunction)gtk_main_quit, NULL );
g_timeout_add( 5000, (GSourceFunc)gtk_main_quit, NULL );
gtk_main( );
return -1;
}
Expand Down
7 changes: 3 additions & 4 deletions src/lightspeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
/* GTK+ */
#include <gtk/gtk.h>
#include <gtkgl/gtkglarea.h>
#include <gtk/gtktext.h>
#include <gtk/gtkaccelgroup.h>

/* Compile-time settings */
Expand Down Expand Up @@ -432,9 +431,9 @@ void keybind( GtkWidget *widget, char *keys );
GtkWidget *add_hbox( GtkWidget *parent_w, int homog, int spacing );
GtkWidget *add_vbox( GtkWidget *parent_w, int homog, int spacing );
GtkWidget *add_frame( GtkWidget *parent_w, const char *title );
GtkWidget *add_hscale( GtkWidget *parent_w, GtkObject *adjustment );
GtkWidget *add_vscale( GtkWidget *parent_w, GtkObject *adjustment );
GtkWidget *add_spin_button( GtkWidget *parent_w, GtkObject *adjustment );
GtkWidget *add_hscale( GtkWidget *parent_w, GObject *adjustment );
GtkWidget *add_vscale( GtkWidget *parent_w, GObject *adjustment );
GtkWidget *add_spin_button( GtkWidget *parent_w, GObject *adjustment );
GtkWidget *add_check_button( GtkWidget *parent_w, const char *label, int init_state, void *callback, void *callback_data );
GtkWidget *add_entry( GtkWidget *parent_w, const char *init_str, void *callback, void *callback_data );
void set_entry_width( GtkWidget *entry_w, const char *span_str );
Expand Down
25 changes: 13 additions & 12 deletions src/mainwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,21 @@ void main_window( void )
/* Main window widget */
main_window_w = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_window_set_title( GTK_WINDOW(main_window_w), STR_Light_Speed );
gtk_widget_set_usize( main_window_w, 600, 450 );
gtk_widget_set_size_request( main_window_w, 600, 450 );
gtk_container_set_border_width( GTK_CONTAINER(main_window_w), 0 );
gtk_signal_connect( GTK_OBJECT(main_window_w), "focus_in_event",
GTK_SIGNAL_FUNC(camera_set_current), NULL );
g_signal_connect( G_OBJECT(main_window_w), "focus_in_event",
G_CALLBACK(camera_set_current), NULL );

/* Need to set this so assoc_cam_id( ) will work */
usr_cams[0]->window_w = main_window_w;
usr_cams[0]->ogl_w = NULL; /* for ogl_make_widget( ) */

/* (and its obligatory kill buttons) */
gtk_signal_connect( GTK_OBJECT(main_window_w), "delete_event",
GTK_SIGNAL_FUNC(gtk_main_quit), NULL );
g_signal_connect( G_OBJECT(main_window_w), "delete_event",
G_CALLBACK(gtk_main_quit), NULL );
/* Destroy window before exiting */
gtk_quit_add_destroy( 1, GTK_OBJECT(main_window_w) );
/*TODO: This doesn't work in GTK3 */
//gtk_quit_add_destroy( 1, G_OBJECT(main_window_w) );

/* Main vertical box widget */
main_vbox_w = add_vbox( main_window_w, FALSE, 0 );
Expand Down Expand Up @@ -133,7 +134,7 @@ void main_window( void )
velocity_input( hbox_w, MESG_(INITIALIZE) );

/* Horizontal box for viewport and velocity slider */
hbox_w = gtk_hbox_new( FALSE, 0 );
hbox_w = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
gtk_box_pack_start( GTK_BOX(main_vbox_w), hbox_w, TRUE, TRUE, 0 );
gtk_widget_show( hbox_w );

Expand Down Expand Up @@ -187,8 +188,8 @@ void add_Camera_menu( GtkWidget *menu_bar_w, GtkWidget *window_w )
}
add_separator( submenu_w );
menu_item_w = add_radio_menu_item( submenu_w, STR_MNU_Custom, dialog_Camera_Lens_Custom, MESG_(DIALOG_OPEN) );
gtk_signal_connect( GTK_OBJECT(menu_item_w), "activate",
GTK_SIGNAL_FUNC(dialog_Camera_Lens_Custom), MESG_(DIALOG_OPEN) );
g_signal_connect( G_OBJECT(menu_item_w), "activate",
G_CALLBACK(dialog_Camera_Lens_Custom), MESG_(DIALOG_OPEN) );
/* Lens submenu finished */
if (advanced_interface)
add_menu_item( menu_w, STR_MNU_Position, dialog_Camera_Position, MESG_(DIALOG_OPEN) );
Expand Down Expand Up @@ -230,9 +231,9 @@ void add_Camera_menu( GtkWidget *menu_bar_w, GtkWidget *window_w )
}
else {
/* For spawned cameras */
menu_item_w = add_menu_item( menu_w, STR_MNU_Close, NULL, GTK_OBJECT(window_w) );
gtk_signal_connect_object( GTK_OBJECT(menu_item_w), "activate",
GTK_SIGNAL_FUNC(menu_Camera_Close), GTK_OBJECT(window_w) );
menu_item_w = add_menu_item( menu_w, STR_MNU_Close, NULL, G_OBJECT(window_w) );
g_signal_connect( G_OBJECT(menu_item_w), "activate",
G_CALLBACK(menu_Camera_Close), G_OBJECT(window_w) );
keybind( menu_item_w, "^X" );
}
}
Expand Down
Loading