2007-11-04 03:51:54 +00:00
/*
2012-03-17 20:01:54 +00:00
Copyright ( C ) 1999 - 2007 id Software , Inc . and contributors .
For a list of contributors , see the accompanying CONTRIBUTORS file .
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
This file is part of GtkRadiant .
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
GtkRadiant is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
GtkRadiant is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
You should have received a copy of the GNU General Public License
along with GtkRadiant ; if not , write to the Free Software
Foundation , Inc . , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 USA
*/
2007-11-04 03:51:54 +00:00
/*
2012-03-17 20:01:54 +00:00
Camera plugin for GtkRadiant
Copyright ( C ) 2002 Splash Damage Ltd .
*/
2007-11-04 03:51:54 +00:00
# include "camera.h"
2008-07-25 07:31:37 +00:00
# include <glib.h>
# include <glib/gi18n.h>
2007-11-04 03:51:54 +00:00
static GSList * g_pEditTypeRadio = NULL ;
static GtkWidget * g_pEditModeEditRadioButton = NULL ;
GtkWidget * g_pEditModeAddRadioButton = NULL ;
static GtkWidget * g_pSecondsEntry = NULL ;
static GtkWidget * g_pEventsList = NULL ;
static GtkLabel * g_pCurrentTime = NULL ;
static GtkLabel * g_pTotalTime = NULL ;
static GtkAdjustment * g_pTimeLine = NULL ;
static GtkWidget * g_pTrackCamera = NULL ;
static GtkWidget * g_pCamName = NULL ;
static char * g_cNull = ' \0 ' ;
2012-03-17 20:01:54 +00:00
static gint ci_editmode_edit ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
g_iEditMode = 0 ;
return TRUE ;
}
2012-03-17 20:01:54 +00:00
static gint ci_editmode_add ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
g_iEditMode = 1 ;
return TRUE ;
}
/*static gint ci_delete_selected( GtkWidget *widget, gpointer data )
2012-03-17 20:01:54 +00:00
{
return TRUE ;
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
static gint ci_select_all ( GtkWidget * widget , gpointer data )
{
return TRUE ;
} */
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
static gint ci_new ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
GtkWidget * window , * w , * vbox , * vbox2 , * hbox , * frame ; //, *name;
GtkWidget * fixed , * interpolated , * spline ;
int ret , loop = 1 ;
GSList * targetTypeRadio = NULL ;
// char buf[128];
// create the window
2012-03-17 20:01:54 +00:00
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 ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
g_object_set_data ( G_OBJECT ( window ) , " loop " , & loop ) ;
g_object_set_data ( G_OBJECT ( window ) , " ret " , & ret ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
gtk_widget_realize ( window ) ;
2007-11-04 03:51:54 +00:00
// fill the window
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_container_add ( GTK_CONTAINER ( window ) , vbox ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
frame = gtk_frame_new ( _ ( " Type " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , frame , TRUE , TRUE , 0 ) ;
gtk_widget_show ( frame ) ;
2007-11-04 03:51:54 +00:00
vbox2 = gtk_vbox_new ( FALSE , 5 ) ;
gtk_container_add ( GTK_CONTAINER ( frame ) , vbox2 ) ;
2012-03-17 20:01:54 +00:00
gtk_container_set_border_width ( GTK_CONTAINER ( vbox2 ) , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox2 ) ;
// -------------------------- //
fixed = gtk_radio_button_new_with_label ( targetTypeRadio , " Fixed " ) ;
gtk_box_pack_start ( GTK_BOX ( vbox2 ) , fixed , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( fixed ) ;
targetTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( fixed ) ) ;
2007-11-04 03:51:54 +00:00
interpolated = gtk_radio_button_new_with_label ( targetTypeRadio , " Interpolated " ) ;
gtk_box_pack_start ( GTK_BOX ( vbox2 ) , interpolated , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( interpolated ) ;
targetTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( interpolated ) ) ;
2007-11-04 03:51:54 +00:00
spline = gtk_radio_button_new_with_label ( targetTypeRadio , " Spline " ) ;
gtk_box_pack_start ( GTK_BOX ( vbox2 ) , spline , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( spline ) ;
targetTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( spline ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_hseparator_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 2 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
// -------------------------- //
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
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 ( IDOK ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
GTK_WIDGET_SET_FLAGS ( w , GTK_CAN_DEFAULT ) ;
gtk_widget_grab_default ( w ) ;
2012-03-17 20:01:54 +00:00
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 ( IDCANCEL ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
ret = IDCANCEL ;
// -------------------------- //
2012-03-17 20:01:54 +00:00
gtk_window_set_position ( GTK_WINDOW ( window ) , GTK_WIN_POS_CENTER ) ;
gtk_widget_show ( window ) ;
gtk_grab_add ( window ) ;
2007-11-04 03:51:54 +00:00
bool dialogError = TRUE ;
2012-03-17 20:01:54 +00:00
while ( dialogError ) {
2007-11-04 03:51:54 +00:00
loop = 1 ;
2012-03-17 20:01:54 +00:00
while ( loop )
gtk_main_iteration ( ) ;
2008-07-04 22:11:30 +00:00
2007-11-04 03:51:54 +00:00
dialogError = FALSE ;
2012-03-17 20:01:54 +00:00
if ( ret = = IDOK ) {
if ( gtk_toggle_button_get_active ( ( GtkToggleButton * ) fixed ) ) {
2007-11-04 03:51:54 +00:00
DoNewFixedCamera ( ) ;
2012-03-17 20:01:54 +00:00
}
else if ( gtk_toggle_button_get_active ( ( GtkToggleButton * ) interpolated ) ) {
2007-11-04 03:51:54 +00:00
DoNewInterpolatedCamera ( ) ;
2012-03-17 20:01:54 +00:00
}
else if ( gtk_toggle_button_get_active ( ( GtkToggleButton * ) spline ) ) {
2007-11-04 03:51:54 +00:00
DoNewSplineCamera ( ) ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
}
}
2012-03-17 20:01:54 +00:00
gtk_grab_remove ( window ) ;
gtk_widget_destroy ( window ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_load ( GtkWidget * widget , gpointer data ) {
DoLoadCamera ( ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_save ( GtkWidget * widget , gpointer data ) {
DoSaveCamera ( ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_unload ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
DoUnloadCamera ( ) ;
return TRUE ;
}
2012-03-17 20:01:54 +00:00
static gint ci_apply ( GtkWidget * widget , gpointer data ) {
if ( GetCurrentCam ( ) ) {
2007-11-04 03:51:54 +00:00
const char * str ;
char buf [ 128 ] ;
bool build = false ;
2012-03-17 20:01:54 +00:00
str = gtk_entry_get_text ( GTK_ENTRY ( g_pCamName ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( str ) {
2007-11-04 03:51:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > setName ( str ) ;
build = true ;
}
2012-03-17 20:01:54 +00:00
str = gtk_entry_get_text ( GTK_ENTRY ( g_pSecondsEntry ) ) ;
2008-07-04 22:11:30 +00:00
2012-03-17 20:01:54 +00:00
if ( str ) {
2007-11-04 03:51:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > setBaseTime ( atof ( str ) ) ;
build = true ;
}
2012-03-17 20:01:54 +00:00
if ( build ) {
2007-11-04 03:51:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > buildCamera ( ) ;
}
sprintf ( buf , " %.2f " , GetCurrentCam ( ) - > GetCam ( ) - > getBaseTime ( ) ) ;
2012-03-17 20:01:54 +00:00
gtk_entry_set_text ( GTK_ENTRY ( g_pSecondsEntry ) , buf ) ;
2007-11-04 03:51:54 +00:00
sprintf ( buf , " %.2f " , GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) ) ;
gtk_label_set_text ( g_pCurrentTime , " 0.00 " ) ;
gtk_label_set_text ( g_pTotalTime , buf ) ;
gtk_adjustment_set_value ( g_pTimeLine , 0.f ) ;
g_pTimeLine - > upper = GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) * 1000 ;
GetCurrentCam ( ) - > HasBeenModified ( ) ;
}
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_preview ( GtkWidget * widget , gpointer data ) {
if ( GetCurrentCam ( ) ) {
2007-11-04 03:51:54 +00:00
g_iPreviewRunning = 1 ;
g_FuncTable . m_pfnSysUpdateWindows ( W_XY_OVERLAY | W_CAMERA ) ;
}
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_expose ( GtkWidget * widget , gpointer data ) {
// start edit mode
DoStartEdit ( GetCurrentCam ( ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return FALSE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_close ( GtkWidget * widget , gpointer data ) {
gtk_widget_hide ( g_pCameraInspectorWnd ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// exit edit mode
DoStopEdit ( ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
static GtkWidget * g_pPathListCombo = NULL ;
static GtkLabel * g_pPathType = NULL ;
2012-03-17 20:01:54 +00:00
static void RefreshPathListCombo ( void ) {
if ( ! g_pPathListCombo ) {
return ;
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
GList * combo_list = ( GList * ) NULL ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( GetCurrentCam ( ) ) {
combo_list = g_list_append ( combo_list , ( void * ) GetCurrentCam ( ) - > GetCam ( ) - > getPositionObj ( ) - > getName ( ) ) ;
for ( int i = 0 ; i < GetCurrentCam ( ) - > GetCam ( ) - > numTargets ( ) ; i + + ) {
combo_list = g_list_append ( combo_list , ( void * ) GetCurrentCam ( ) - > GetCam ( ) - > getActiveTarget ( i ) - > getName ( ) ) ;
}
}
else {
2007-11-04 03:51:54 +00:00
// add one empty string make gtk be quiet
combo_list = g_list_append ( combo_list , ( gpointer ) g_cNull ) ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
gtk_combo_set_popdown_strings ( GTK_COMBO ( g_pPathListCombo ) , combo_list ) ;
g_list_free ( combo_list ) ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_pathlist_changed ( GtkWidget * widget , gpointer data ) {
const char * str = gtk_entry_get_text ( GTK_ENTRY ( widget ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( ! str | | ! GetCurrentCam ( ) ) {
return TRUE ;
}
2007-11-04 03:51:54 +00:00
int i ;
2012-03-17 20:01:54 +00:00
for ( i = 0 ; i < GetCurrentCam ( ) - > GetCam ( ) - > numTargets ( ) ; i + + ) {
if ( ! strcmp ( str , GetCurrentCam ( ) - > GetCam ( ) - > getActiveTarget ( i ) - > getName ( ) ) ) {
break ;
}
}
if ( i > = 0 & & i < GetCurrentCam ( ) - > GetCam ( ) - > numTargets ( ) ) {
GetCurrentCam ( ) - > GetCam ( ) - > setActiveTarget ( i ) ;
g_iActiveTarget = i ;
if ( g_pPathType ) {
gtk_label_set_text ( g_pPathType , GetCurrentCam ( ) - > GetCam ( ) - > getActiveTarget ( g_iActiveTarget ) - > typeStr ( ) ) ;
}
}
else {
g_iActiveTarget = - 1 ;
if ( g_pPathType ) {
2007-11-04 03:51:54 +00:00
gtk_label_set_text ( g_pPathType , GetCurrentCam ( ) - > GetCam ( ) - > getPositionObj ( ) - > typeStr ( ) ) ;
2012-03-17 20:01:54 +00:00
}
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// start edit mode
if ( g_pCameraInspectorWnd & & GTK_WIDGET_VISIBLE ( g_pCameraInspectorWnd ) ) {
DoStartEdit ( GetCurrentCam ( ) ) ;
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static void RefreshEventList ( void ) {
2007-11-04 03:51:54 +00:00
int i ;
char buf [ 128 ] ;
// Clear events list
2012-03-17 20:01:54 +00:00
gtk_clist_freeze ( GTK_CLIST ( g_pEventsList ) ) ;
gtk_clist_clear ( GTK_CLIST ( g_pEventsList ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( GetCurrentCam ( ) ) {
2007-11-04 03:51:54 +00:00
// Fill events list
2012-03-17 20:01:54 +00:00
for ( i = 0 ; i < GetCurrentCam ( ) - > GetCam ( ) - > numEvents ( ) ; i + + ) {
2007-11-04 03:51:54 +00:00
char rowbuf [ 3 ] [ 128 ] , * row [ 3 ] ;
// FIXME: sort by time?
2012-03-17 20:01:54 +00:00
sprintf ( rowbuf [ 0 ] , " %li " , GetCurrentCam ( ) - > GetCam ( ) - > getEvent ( i ) - > getTime ( ) ) ; row [ 0 ] = rowbuf [ 0 ] ;
strncpy ( rowbuf [ 1 ] , GetCurrentCam ( ) - > GetCam ( ) - > getEvent ( i ) - > typeStr ( ) , sizeof ( rowbuf [ 0 ] ) ) ; row [ 1 ] = rowbuf [ 1 ] ;
strncpy ( rowbuf [ 2 ] , GetCurrentCam ( ) - > GetCam ( ) - > getEvent ( i ) - > getParam ( ) , sizeof ( rowbuf [ 1 ] ) ) ; row [ 2 ] = rowbuf [ 2 ] ;
gtk_clist_append ( GTK_CLIST ( g_pEventsList ) , row ) ;
2007-11-04 03:51:54 +00:00
}
// Total duration might have changed
sprintf ( buf , " %.2f " , GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) ) ;
gtk_label_set_text ( g_pCurrentTime , " 0.00 " ) ;
gtk_label_set_text ( g_pTotalTime , buf ) ;
gtk_adjustment_set_value ( g_pTimeLine , 0.f ) ;
g_pTimeLine - > upper = ( GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) * 1000 ) ;
}
2012-03-17 20:01:54 +00:00
gtk_clist_thaw ( GTK_CLIST ( g_pEventsList ) ) ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_rename ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
GtkWidget * window , * w , * vbox , * hbox , * name ;
int ret , loop = 1 ;
2012-03-17 20:01:54 +00:00
if ( ! GetCurrentCam ( ) ) {
2007-11-04 03:51:54 +00:00
return TRUE ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
// create the window
2012-03-17 20:01:54 +00:00
window = gtk_window_new ( GTK_WINDOW_TOPLEVEL ) ;
gtk_window_set_title ( GTK_WINDOW ( window ) , " Rename Path " ) ;
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 ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
g_object_set_data ( G_OBJECT ( window ) , " loop " , & loop ) ;
g_object_set_data ( G_OBJECT ( window ) , " ret " , & ret ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
gtk_widget_realize ( window ) ;
2007-11-04 03:51:54 +00:00
// fill the window
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_container_add ( GTK_CONTAINER ( window ) , vbox ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( " Name: " ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
name = gtk_entry_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , name , FALSE , FALSE , 0 ) ;
gtk_widget_show ( name ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( g_iActiveTarget < 0 ) {
gtk_entry_set_text ( GTK_ENTRY ( name ) , GetCurrentCam ( ) - > GetCam ( ) - > getPositionObj ( ) - > getName ( ) ) ;
}
else {
gtk_entry_set_text ( GTK_ENTRY ( name ) , GetCurrentCam ( ) - > GetCam ( ) - > getActiveTarget ( g_iActiveTarget ) - > getName ( ) ) ;
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_hseparator_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 2 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
// -------------------------- //
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
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 ( IDOK ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
GTK_WIDGET_SET_FLAGS ( w , GTK_CAN_DEFAULT ) ;
gtk_widget_grab_default ( w ) ;
2012-03-17 20:01:54 +00:00
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 ( IDCANCEL ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
ret = IDCANCEL ;
// -------------------------- //
2012-03-17 20:01:54 +00:00
gtk_window_set_position ( GTK_WINDOW ( window ) , GTK_WIN_POS_CENTER ) ;
gtk_widget_show ( window ) ;
gtk_grab_add ( window ) ;
2007-11-04 03:51:54 +00:00
bool dialogError = TRUE ;
2012-03-17 20:01:54 +00:00
while ( dialogError ) {
2007-11-04 03:51:54 +00:00
loop = 1 ;
2012-03-17 20:01:54 +00:00
while ( loop )
gtk_main_iteration ( ) ;
2008-07-04 22:11:30 +00:00
2007-11-04 03:51:54 +00:00
dialogError = FALSE ;
2012-03-17 20:01:54 +00:00
if ( ret = = IDOK ) {
const char * str = gtk_entry_get_text ( GTK_ENTRY ( name ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( str & & str [ 0 ] ) {
2007-11-04 03:51:54 +00:00
// Update the path
2012-03-17 20:01:54 +00:00
if ( g_iActiveTarget < 0 ) {
2007-11-04 03:51:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > getPositionObj ( ) - > setName ( str ) ;
2012-03-17 20:01:54 +00:00
}
else {
GetCurrentCam ( ) - > GetCam ( ) - > getActiveTarget ( g_iActiveTarget ) - > setName ( str ) ;
}
2007-11-04 03:51:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > buildCamera ( ) ;
// Rebuild the listbox
RefreshPathListCombo ( ) ;
2012-03-17 20:01:54 +00:00
}
else {
2007-11-04 03:51:54 +00:00
dialogError = TRUE ;
}
}
}
2012-03-17 20:01:54 +00:00
gtk_grab_remove ( window ) ;
gtk_widget_destroy ( window ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_add_target ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
GtkWidget * window , * w , * vbox , * vbox2 , * hbox , * frame , * name ;
GtkWidget * fixed , * interpolated , * spline ;
int ret , loop = 1 ;
GSList * targetTypeRadio = NULL ;
char buf [ 128 ] ;
2012-03-17 20:01:54 +00:00
if ( ! GetCurrentCam ( ) ) {
2007-11-04 03:51:54 +00:00
return TRUE ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
// create the window
2012-03-17 20:01:54 +00:00
window = gtk_window_new ( GTK_WINDOW_TOPLEVEL ) ;
gtk_window_set_title ( GTK_WINDOW ( window ) , " Add Target " ) ;
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 ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
g_object_set_data ( G_OBJECT ( window ) , " loop " , & loop ) ;
g_object_set_data ( G_OBJECT ( window ) , " ret " , & ret ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
gtk_widget_realize ( window ) ;
2007-11-04 03:51:54 +00:00
// fill the window
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_container_add ( GTK_CONTAINER ( window ) , vbox ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( " Name: " ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
name = gtk_entry_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , name , TRUE , TRUE , 0 ) ;
gtk_widget_show ( name ) ;
2007-11-04 03:51:54 +00:00
sprintf ( buf , " target%i " , GetCurrentCam ( ) - > GetCam ( ) - > numTargets ( ) + 1 ) ;
2012-03-17 20:01:54 +00:00
gtk_entry_set_text ( GTK_ENTRY ( name ) , buf ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
frame = gtk_frame_new ( _ ( " Type " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , frame , TRUE , TRUE , 0 ) ;
gtk_widget_show ( frame ) ;
2007-11-04 03:51:54 +00:00
vbox2 = gtk_vbox_new ( FALSE , 5 ) ;
gtk_container_add ( GTK_CONTAINER ( frame ) , vbox2 ) ;
2012-03-17 20:01:54 +00:00
gtk_container_set_border_width ( GTK_CONTAINER ( vbox2 ) , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox2 ) ;
// -------------------------- //
2012-03-17 20:01:54 +00:00
fixed = gtk_radio_button_new_with_label ( targetTypeRadio , _ ( " Fixed " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox2 ) , fixed , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( fixed ) ;
targetTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( fixed ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
interpolated = gtk_radio_button_new_with_label ( targetTypeRadio , _ ( " Interpolated " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox2 ) , interpolated , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( interpolated ) ;
targetTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( interpolated ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
spline = gtk_radio_button_new_with_label ( targetTypeRadio , _ ( " Spline " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox2 ) , spline , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( spline ) ;
targetTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( spline ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_hseparator_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 2 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
// -------------------------- //
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
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 ( IDOK ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
GTK_WIDGET_SET_FLAGS ( w , GTK_CAN_DEFAULT ) ;
gtk_widget_grab_default ( w ) ;
2012-03-17 20:01:54 +00:00
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 ( IDCANCEL ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
ret = IDCANCEL ;
// -------------------------- //
2012-03-17 20:01:54 +00:00
gtk_window_set_position ( GTK_WINDOW ( window ) , GTK_WIN_POS_CENTER ) ;
gtk_widget_show ( window ) ;
gtk_grab_add ( window ) ;
2007-11-04 03:51:54 +00:00
bool dialogError = TRUE ;
2012-03-17 20:01:54 +00:00
while ( dialogError ) {
2007-11-04 03:51:54 +00:00
loop = 1 ;
2012-03-17 20:01:54 +00:00
while ( loop )
gtk_main_iteration ( ) ;
2008-07-04 22:11:30 +00:00
2007-11-04 03:51:54 +00:00
dialogError = FALSE ;
2012-03-17 20:01:54 +00:00
if ( ret = = IDOK ) {
const char * str = gtk_entry_get_text ( GTK_ENTRY ( name ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( str & & str [ 0 ] ) {
2007-11-04 03:51:54 +00:00
int type ;
GList * li ;
2012-03-17 20:01:54 +00:00
if ( gtk_toggle_button_get_active ( ( GtkToggleButton * ) fixed ) ) {
2007-11-04 03:51:54 +00:00
type = 0 ;
2012-03-17 20:01:54 +00:00
}
else if ( gtk_toggle_button_get_active ( ( GtkToggleButton * ) interpolated ) ) {
2007-11-04 03:51:54 +00:00
type = 1 ;
2012-03-17 20:01:54 +00:00
}
else if ( gtk_toggle_button_get_active ( ( GtkToggleButton * ) spline ) ) {
2007-11-04 03:51:54 +00:00
type = 2 ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
// Add the target
2012-03-17 20:01:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > addTarget ( str , static_cast < idCameraPosition : : positionType > ( type ) ) ;
2007-11-04 03:51:54 +00:00
// Rebuild the listbox
RefreshPathListCombo ( ) ;
// Select the last item in the listbox
2012-03-17 20:01:54 +00:00
li = g_list_last ( GTK_LIST ( GTK_COMBO ( g_pPathListCombo ) - > list ) - > children ) ;
gtk_list_select_child ( GTK_LIST ( GTK_COMBO ( g_pPathListCombo ) - > list ) , GTK_WIDGET ( li - > data ) ) ;
2007-11-04 03:51:54 +00:00
// If this was the first one, refresh the event list
2012-03-17 20:01:54 +00:00
if ( GetCurrentCam ( ) - > GetCam ( ) - > numTargets ( ) = = 1 ) {
2007-11-04 03:51:54 +00:00
RefreshEventList ( ) ;
}
// Go to editmode Add
2012-03-17 20:01:54 +00:00
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( g_pEditModeAddRadioButton ) , TRUE ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
}
else {
2007-11-04 03:51:54 +00:00
dialogError = TRUE ;
}
}
}
2012-03-17 20:01:54 +00:00
gtk_grab_remove ( window ) ;
gtk_widget_destroy ( window ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
static GtkWidget * g_pCamListCombo = NULL ;
static GtkLabel * g_pCamType = NULL ;
2012-03-17 20:01:54 +00:00
void RefreshCamListCombo ( void ) {
if ( ! g_pCamListCombo ) {
return ;
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
GList * combo_list = ( GList * ) NULL ;
CCamera * combo_cam = firstCam ;
if ( combo_cam ) {
while ( combo_cam ) {
2007-11-04 03:51:54 +00:00
//combo_list = g_list_append( combo_list, (void *)combo_cam->GetCam()->getName() );
//if( combo_cam->HasBeenSaved() ) {
2012-03-17 20:01:54 +00:00
combo_list = g_list_append ( combo_list , ( void * ) combo_cam - > GetFileName ( ) ) ;
2007-11-04 03:51:54 +00:00
/*} else {
2012-03-17 20:01:54 +00:00
char buf [ 128 ] ;
sprintf ( buf , " Unsaved Camera %i " , combo_cam - > GetCamNum ( ) ) ;
combo_list = g_list_append ( combo_list , ( void * ) buf ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
//combo_list = g_list_append( combo_list, (void *)combo_cam->GetCam()->getName() ); // FIXME: this requires camera.dll to create unique names for new cams
} */
2007-11-04 03:51:54 +00:00
combo_cam = combo_cam - > GetNext ( ) ;
}
2012-03-17 20:01:54 +00:00
}
else {
2007-11-04 03:51:54 +00:00
// add one empty string make gtk be quiet
combo_list = g_list_append ( combo_list , ( gpointer ) g_cNull ) ;
}
2012-03-17 20:01:54 +00:00
gtk_combo_set_popdown_strings ( GTK_COMBO ( g_pCamListCombo ) , combo_list ) ;
g_list_free ( combo_list ) ;
// select our current entry in the list
if ( GetCurrentCam ( ) ) {
// stop editing on the current cam
//GetCurrentCam()->GetCam()->stopEdit(); // FIXME: this crashed on creating new cameras, why is it here?
GList * li = GTK_LIST ( GTK_COMBO ( g_pCamListCombo ) - > list ) - > children ;
combo_cam = firstCam ;
while ( li & & combo_cam ) {
if ( combo_cam = = GetCurrentCam ( ) ) {
gtk_list_select_child ( GTK_LIST ( GTK_COMBO ( g_pCamListCombo ) - > list ) , GTK_WIDGET ( li - > data ) ) ;
break ;
}
li = li - > next ;
combo_cam = combo_cam - > GetNext ( ) ;
}
}
RefreshPathListCombo ( ) ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_camlist_changed ( GtkWidget * widget , gpointer data ) {
const char * str = gtk_entry_get_text ( GTK_ENTRY ( widget ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
CCamera * combo_cam = firstCam ;
while ( str & & combo_cam ) {
//if( !strcmp( str, combo_cam->GetCam()->getName() ) )
2007-11-04 03:51:54 +00:00
//if( combo_cam->HasBeenSaved() ) {
2012-03-17 20:01:54 +00:00
if ( ! strcmp ( str , combo_cam - > GetFileName ( ) ) ) {
break ;
}
2007-11-04 03:51:54 +00:00
/*} else {
2012-03-17 20:01:54 +00:00
char buf [ 128 ] ;
sprintf ( buf , " Unsaved Camera %i " , combo_cam - > GetCamNum ( ) ) ;
if ( ! strcmp ( str , buf ) )
//if( !strcmp( str, combo_cam->GetCam()->getName() ) )
break ;
} */
combo_cam = combo_cam - > GetNext ( ) ;
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
SetCurrentCam ( combo_cam ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( g_pCamType ) {
if ( GetCurrentCam ( ) ) {
2007-11-04 03:51:54 +00:00
// Fill in our widgets fields for this camera
char buf [ 128 ] ;
// Set Name
2012-03-17 20:01:54 +00:00
gtk_entry_set_text ( GTK_ENTRY ( g_pCamName ) , GetCurrentCam ( ) - > GetCam ( ) - > getName ( ) ) ;
2007-11-04 03:51:54 +00:00
// Set type
gtk_label_set_text ( g_pCamType , GetCurrentCam ( ) - > GetCam ( ) - > getPositionObj ( ) - > typeStr ( ) ) ;
// Set duration
sprintf ( buf , " %.2f " , GetCurrentCam ( ) - > GetCam ( ) - > getBaseTime ( ) ) ;
2012-03-17 20:01:54 +00:00
gtk_entry_set_text ( GTK_ENTRY ( g_pSecondsEntry ) , buf ) ;
2007-11-04 03:51:54 +00:00
sprintf ( buf , " %.2f " , GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) ) ;
gtk_label_set_text ( g_pCurrentTime , " 0.00 " ) ;
gtk_label_set_text ( g_pTotalTime , buf ) ;
gtk_adjustment_set_value ( g_pTimeLine , 0.f ) ;
g_pTimeLine - > upper = GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) * 1000 ;
2012-03-17 20:01:54 +00:00
}
else {
2007-11-04 03:51:54 +00:00
// Set Name
2012-03-17 20:01:54 +00:00
gtk_entry_set_text ( GTK_ENTRY ( g_pCamName ) , " " ) ;
2007-11-04 03:51:54 +00:00
// Set type
gtk_label_set_text ( g_pCamType , " " ) ;
// Set duration
2012-03-17 20:01:54 +00:00
gtk_entry_set_text ( GTK_ENTRY ( g_pSecondsEntry ) , " 30.00 " ) ;
2007-11-04 03:51:54 +00:00
gtk_label_set_text ( g_pCurrentTime , " 0.00 " ) ;
gtk_label_set_text ( g_pTotalTime , " 30.00 " ) ;
gtk_adjustment_set_value ( g_pTimeLine , 0.f ) ;
g_pTimeLine - > upper = 30000 ;
}
// Refresh event list
RefreshEventList ( ) ;
}
2012-03-17 20:01:54 +00:00
RefreshPathListCombo ( ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// start edit mode
g_iActiveTarget = - 1 ;
if ( g_pCameraInspectorWnd & & GTK_WIDGET_VISIBLE ( g_pCameraInspectorWnd ) ) {
DoStartEdit ( GetCurrentCam ( ) ) ;
}
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
enum camEventType {
EVENT_NA = 0x00 ,
2012-03-17 20:01:54 +00:00
EVENT_WAIT , //
EVENT_TARGETWAIT , //
EVENT_SPEED , //
EVENT_TARGET , // char(name)
EVENT_SNAPTARGET , //
EVENT_FOV , // int(time), int(targetfov)
EVENT_CMD , //
EVENT_TRIGGER , //
EVENT_STOP , //
EVENT_CAMERA , //
EVENT_FADEOUT , // int(time)
EVENT_FADEIN , // int(time)
EVENT_FEATHER , //
2008-07-04 22:11:30 +00:00
EVENT_COUNT
2007-11-04 03:51:54 +00:00
} ;
// { requires parameters, enabled }
const bool camEventFlags [ ] [ 2 ] = {
2012-03-17 20:01:54 +00:00
{ false , false } ,
{ false , true } ,
{ false , false } ,
{ false , false } ,
{ true , true } ,
{ false , false } ,
{ true , true } ,
{ false , false } ,
{ false , false } ,
{ false , true } ,
{ true , true } ,
{ true , true } ,
{ true , true } ,
{ false , true } ,
2007-11-04 03:51:54 +00:00
} ;
const char * camEventStr [ ] = {
2012-03-17 20:01:54 +00:00
N_ ( " n/a " ) ,
N_ ( " Wait " ) ,
N_ ( " Target wait " ) ,
N_ ( " Speed " ) ,
N_ ( " Change Target <string:name> " ) ,
N_ ( " Snap Target " ) ,
N_ ( " FOV <int:duration> <int:targetfov> " ) ,
N_ ( " Run Script " ) ,
N_ ( " Trigger " ) ,
N_ ( " Stop " ) ,
N_ ( " Change to Camera <string:camera> (or <int:cameranum> <string:camera> " ) ,
N_ ( " Fade Out <int:duration> " ) ,
N_ ( " Fade In <int:duration> " ) ,
N_ ( " Feather " )
2007-11-04 03:51:54 +00:00
} ;
2012-03-17 20:01:54 +00:00
static gint ci_add ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
GtkWidget * window , * w , * vbox , * vbox2 , * hbox , * frame , * parameters ;
GtkWidget * eventWidget [ EVENT_COUNT ] ;
int i , ret , loop = 1 ;
GSList * eventTypeRadio = NULL ;
// char buf[128];
2012-03-17 20:01:54 +00:00
if ( ! GetCurrentCam ( ) ) {
2007-11-04 03:51:54 +00:00
return TRUE ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
// create the window
2012-03-17 20:01:54 +00:00
window = gtk_window_new ( GTK_WINDOW_TOPLEVEL ) ;
gtk_window_set_title ( GTK_WINDOW ( window ) , _ ( " Add Event " ) ) ;
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 ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
g_object_set_data ( G_OBJECT ( window ) , " loop " , & loop ) ;
g_object_set_data ( G_OBJECT ( window ) , " ret " , & ret ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
gtk_widget_realize ( window ) ;
2007-11-04 03:51:54 +00:00
// fill the window
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_container_add ( GTK_CONTAINER ( window ) , vbox ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
frame = gtk_frame_new ( _ ( " Type " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , frame , TRUE , TRUE , 0 ) ;
gtk_widget_show ( frame ) ;
2007-11-04 03:51:54 +00:00
vbox2 = gtk_vbox_new ( FALSE , 5 ) ;
gtk_container_add ( GTK_CONTAINER ( frame ) , vbox2 ) ;
2012-03-17 20:01:54 +00:00
gtk_container_set_border_width ( GTK_CONTAINER ( vbox2 ) , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox2 ) ;
// -------------------------- //
2012-03-17 20:01:54 +00:00
for ( i = 1 ; i < EVENT_COUNT ; i + + ) {
2007-11-04 03:51:54 +00:00
eventWidget [ i ] = gtk_radio_button_new_with_label ( eventTypeRadio , camEventStr [ i ] ) ;
gtk_box_pack_start ( GTK_BOX ( vbox2 ) , eventWidget [ i ] , FALSE , FALSE , 3 ) ;
gtk_widget_show ( eventWidget [ i ] ) ;
eventTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( eventWidget [ i ] ) ) ;
2012-03-17 20:01:54 +00:00
if ( camEventFlags [ i ] [ 1 ] = = false ) {
gtk_widget_set_sensitive ( eventWidget [ i ] , FALSE ) ;
}
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Parameters: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
parameters = gtk_entry_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , parameters , TRUE , TRUE , 0 ) ;
gtk_widget_show ( parameters ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_hseparator_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 2 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
// -------------------------- //
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
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 ( IDOK ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
GTK_WIDGET_SET_FLAGS ( w , GTK_CAN_DEFAULT ) ;
gtk_widget_grab_default ( w ) ;
2012-03-17 20:01:54 +00:00
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 ( IDCANCEL ) ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
ret = IDCANCEL ;
// -------------------------- //
2012-03-17 20:01:54 +00:00
gtk_window_set_position ( GTK_WINDOW ( window ) , GTK_WIN_POS_CENTER ) ;
gtk_widget_show ( window ) ;
gtk_grab_add ( window ) ;
2007-11-04 03:51:54 +00:00
bool dialogError = TRUE ;
2012-03-17 20:01:54 +00:00
while ( dialogError ) {
2007-11-04 03:51:54 +00:00
loop = 1 ;
2012-03-17 20:01:54 +00:00
while ( loop )
gtk_main_iteration ( ) ;
2008-07-04 22:11:30 +00:00
2007-11-04 03:51:54 +00:00
dialogError = FALSE ;
2012-03-17 20:01:54 +00:00
if ( ret = = IDOK ) {
const char * str = gtk_entry_get_text ( GTK_ENTRY ( parameters ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
if ( ! camEventFlags [ i ] [ 0 ] | | ( str & & str [ 0 ] ) ) {
2007-11-04 03:51:54 +00:00
int type = 0 ;
// GList *li;
2012-03-17 20:01:54 +00:00
for ( type = 1 ; type < EVENT_COUNT ; type + + ) {
if ( gtk_toggle_button_get_active ( ( GtkToggleButton * ) eventWidget [ type ] ) ) {
2007-11-04 03:51:54 +00:00
break ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
}
// Add the event
2012-03-17 20:01:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > addEvent ( static_cast < idCameraEvent : : eventType > ( type ) , str , ( long ) ( g_pTimeLine - > value ) ) ;
2007-11-04 03:51:54 +00:00
// Refresh event list
RefreshEventList ( ) ;
2012-03-17 20:01:54 +00:00
}
else {
2007-11-04 03:51:54 +00:00
dialogError = TRUE ;
}
}
}
2012-03-17 20:01:54 +00:00
gtk_grab_remove ( window ) ;
gtk_widget_destroy ( window ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_del ( GtkWidget * widget , gpointer data ) {
2007-11-04 03:51:54 +00:00
// TODO: add support to splines lib
2012-03-17 20:01:54 +00:00
if ( GetCurrentCam ( ) & & GTK_CLIST ( g_pEventsList ) - > focus_row > = 0 ) {
GetCurrentCam ( ) - > GetCam ( ) - > removeEvent ( GTK_CLIST ( g_pEventsList ) - > focus_row ) ;
2007-11-04 03:51:54 +00:00
// Refresh event list
RefreshEventList ( ) ;
}
2012-03-17 20:01:54 +00:00
return TRUE ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
static gint ci_timeline_changed ( GtkAdjustment * adjustment ) {
2007-11-04 03:51:54 +00:00
char buf [ 128 ] ;
sprintf ( buf , " %.2f " , adjustment - > value / 1000.f ) ;
gtk_label_set_text ( g_pCurrentTime , buf ) ;
// FIXME: this will never work completely perfect. Startcamera calls buildcamera, which sets all events to 'nottriggered'.
// So if you have a wait at the end of the path, this will go to nontriggered immediately when you go over it and the camera
// will have no idea where on the track it should be.
2012-03-17 20:01:54 +00:00
if ( GetCurrentCam ( ) & & gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( g_pTrackCamera ) ) ) {
2007-11-04 03:51:54 +00:00
float fov ;
2012-03-17 20:01:54 +00:00
vec3_t origin = { 0.0f , 0.0f , 0.0f } , dir = { 0.0f , 0.0f , 0.0f } , angles ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > startCamera ( 0 ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > getCameraInfo ( ( long ) ( adjustment - > value ) , & origin [ 0 ] , & dir [ 0 ] , & fov ) ;
VectorSet ( angles , asin ( dir [ 2 ] ) * 180 / 3.14159 , atan2 ( dir [ 1 ] , dir [ 0 ] ) * 180 / 3.14159 , 0 ) ;
2008-07-04 22:11:30 +00:00
g_CameraTable . m_pfnSetCamera ( origin , angles ) ;
}
2007-11-04 03:51:54 +00:00
return TRUE ;
}
2012-03-17 20:01:54 +00:00
GtkWidget * CreateCameraInspectorDialog ( void ) {
GtkWidget * window , * w , * vbox , * hbox , * table , * frame ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// create the window
window = gtk_window_new ( GTK_WINDOW_TOPLEVEL ) ;
gtk_window_set_title ( GTK_WINDOW ( window ) , _ ( " Camera Inspector " ) ) ;
gtk_signal_connect ( GTK_OBJECT ( window ) , " delete_event " , GTK_SIGNAL_FUNC ( ci_close ) , NULL ) ;
gtk_signal_connect ( GTK_OBJECT ( window ) , " expose_event " , GTK_SIGNAL_FUNC ( ci_expose ) , NULL ) ;
2007-11-04 03:51:54 +00:00
// gtk_signal_connect( GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
2012-03-17 20:01:54 +00:00
gtk_window_set_transient_for ( GTK_WINDOW ( window ) , GTK_WINDOW ( g_pRadiantWnd ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// don't use show, as you don't want to have it displayed on startup ;-)
gtk_widget_realize ( window ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// fill the window
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// the table
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
table = gtk_table_new ( 3 , 2 , FALSE ) ;
gtk_widget_show ( table ) ;
gtk_container_add ( GTK_CONTAINER ( window ) , table ) ;
gtk_container_set_border_width ( GTK_CONTAINER ( table ) , 5 ) ;
gtk_table_set_row_spacings ( GTK_TABLE ( table ) , 5 ) ;
gtk_table_set_col_spacings ( GTK_TABLE ( table ) , 5 ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// the properties column
2007-11-04 03:51:54 +00:00
// -------------------------- //
vbox = gtk_vbox_new ( FALSE , 5 ) ;
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
gtk_table_attach ( GTK_TABLE ( table ) , vbox , 0 , 1 , 0 , 1 ,
( GtkAttachOptions ) ( GTK_EXPAND | GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " File: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
g_pCamListCombo = gtk_combo_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , g_pCamListCombo , TRUE , TRUE , 0 ) ;
gtk_widget_show ( g_pCamListCombo ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Name: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
g_pCamName = gtk_entry_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , g_pCamName , FALSE , FALSE , 0 ) ;
gtk_widget_show ( g_pCamName ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Type: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( " " ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
g_pCamType = GTK_LABEL ( w ) ;
2012-03-17 20:01:54 +00:00
RefreshCamListCombo ( ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
gtk_entry_set_editable ( GTK_ENTRY ( GTK_COMBO ( g_pCamListCombo ) - > entry ) , FALSE ) ;
gtk_signal_connect ( GTK_OBJECT ( GTK_COMBO ( g_pCamListCombo ) - > entry ) , " changed " , GTK_SIGNAL_FUNC ( ci_camlist_changed ) , NULL ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
frame = gtk_frame_new ( _ ( " Path and Target editing " ) ) ;
gtk_widget_show ( frame ) ;
gtk_table_attach ( GTK_TABLE ( table ) , frame , 0 , 1 , 1 , 2 ,
( GtkAttachOptions ) ( GTK_EXPAND | GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2007-11-04 03:51:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
gtk_container_add ( GTK_CONTAINER ( frame ) , vbox ) ;
2012-03-17 20:01:54 +00:00
gtk_container_set_border_width ( GTK_CONTAINER ( vbox ) , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Edit: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
g_pPathListCombo = gtk_combo_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , g_pPathListCombo , TRUE , TRUE , 0 ) ;
gtk_widget_show ( g_pPathListCombo ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
RefreshPathListCombo ( ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
gtk_entry_set_editable ( GTK_ENTRY ( GTK_COMBO ( g_pPathListCombo ) - > entry ) , FALSE ) ;
gtk_signal_connect ( GTK_OBJECT ( GTK_COMBO ( g_pPathListCombo ) - > entry ) , " changed " , GTK_SIGNAL_FUNC ( ci_pathlist_changed ) , NULL ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
g_pEditModeEditRadioButton = gtk_radio_button_new_with_label ( g_pEditTypeRadio , _ ( " Edit Points " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , g_pEditModeEditRadioButton , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( g_pEditModeEditRadioButton ) ;
g_pEditTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( g_pEditModeEditRadioButton ) ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( g_pEditModeEditRadioButton ) , " clicked " , GTK_SIGNAL_FUNC ( ci_editmode_edit ) , NULL ) ;
2012-03-17 20:01:54 +00:00
g_pEditModeAddRadioButton = gtk_radio_button_new_with_label ( g_pEditTypeRadio , _ ( " Add Points " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , g_pEditModeAddRadioButton , FALSE , FALSE , 3 ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( g_pEditModeAddRadioButton ) ;
g_pEditTypeRadio = gtk_radio_button_group ( GTK_RADIO_BUTTON ( g_pEditModeAddRadioButton ) ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( g_pEditModeAddRadioButton ) , " clicked " , GTK_SIGNAL_FUNC ( ci_editmode_add ) , NULL ) ;
// see if we should use a different default
2012-03-17 20:01:54 +00:00
if ( g_iEditMode = = 1 ) {
2007-11-04 03:51:54 +00:00
// Go to editmode Add
2012-03-17 20:01:54 +00:00
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( g_pEditModeAddRadioButton ) , TRUE ) ;
2007-11-04 03:51:54 +00:00
}
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Type: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( " " ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
g_pPathType = GTK_LABEL ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Rename... " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , TRUE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_rename ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Add Target... " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , TRUE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_add_target ) , NULL ) ;
gtk_widget_show ( w ) ;
// not available in splines library
/*w = gtk_button_new_with_label( "Delete Selected" );
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , TRUE , 0 ) ;
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_delete_selected ) , NULL ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( " Select All " ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , TRUE , 0 ) ;
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_select_all ) , NULL ) ;
gtk_widget_show ( w ) ; */
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
frame = gtk_frame_new ( _ ( " Time " ) ) ;
gtk_widget_show ( frame ) ;
gtk_table_attach ( GTK_TABLE ( table ) , frame , 0 , 1 , 2 , 3 ,
( GtkAttachOptions ) ( GTK_EXPAND | GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2007-11-04 03:51:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
gtk_container_add ( GTK_CONTAINER ( frame ) , vbox ) ;
2012-03-17 20:01:54 +00:00
gtk_container_set_border_width ( GTK_CONTAINER ( vbox ) , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Length (seconds): " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
g_pSecondsEntry = gtk_entry_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , g_pSecondsEntry , FALSE , FALSE , 0 ) ;
gtk_widget_show ( g_pSecondsEntry ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Current Time: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " 0.00 " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
g_pCurrentTime = GTK_LABEL ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " of " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " 0.00 " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
g_pTotalTime = GTK_LABEL ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
g_pTimeLine = GTK_ADJUSTMENT ( gtk_adjustment_new ( 0 , 0 , 30000 , 100 , 250 , 0 ) ) ;
2012-03-17 20:01:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( g_pTimeLine ) , " value_changed " , GTK_SIGNAL_FUNC ( ci_timeline_changed ) , NULL ) ;
w = gtk_hscale_new ( g_pTimeLine ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , TRUE , TRUE , 0 ) ;
gtk_widget_show ( w ) ;
gtk_scale_set_draw_value ( GTK_SCALE ( w ) , FALSE ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
g_pTrackCamera = gtk_check_button_new_with_label ( _ ( " Track Camera " ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , g_pTrackCamera , FALSE , FALSE , 0 ) ;
gtk_widget_show ( g_pTrackCamera ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_label_new ( _ ( " Events: " ) ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_scrolled_window_new ( NULL , NULL ) ;
gtk_widget_set_usize ( w , 0 , 150 ) ;
gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( w ) , GTK_POLICY_AUTOMATIC , GTK_POLICY_AUTOMATIC ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , TRUE , TRUE , 0 ) ;
gtk_widget_show ( w ) ;
g_pEventsList = gtk_clist_new ( 3 ) ;
gtk_container_add ( GTK_CONTAINER ( w ) , g_pEventsList ) ;
//gtk_signal_connect( GTK_OBJECT(g_pEventsList), "select_row", GTK_SIGNAL_FUNC (proplist_select_row), NULL);
gtk_clist_set_selection_mode ( GTK_CLIST ( g_pEventsList ) , GTK_SELECTION_BROWSE ) ;
gtk_clist_column_titles_hide ( GTK_CLIST ( g_pEventsList ) ) ;
gtk_clist_set_column_auto_resize ( GTK_CLIST ( g_pEventsList ) , 0 , TRUE ) ;
gtk_clist_set_column_auto_resize ( GTK_CLIST ( g_pEventsList ) , 1 , TRUE ) ;
gtk_clist_set_column_auto_resize ( GTK_CLIST ( g_pEventsList ) , 2 , TRUE ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( g_pEventsList ) ;
2012-03-17 20:01:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , vbox , FALSE , FALSE , 0 ) ;
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Add... " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_add ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Del " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_del ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
// the buttons column
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
gtk_table_attach ( GTK_TABLE ( table ) , vbox , 1 , 2 , 0 , 1 ,
( GtkAttachOptions ) ( GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " New... " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_new ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Load... " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_load ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
gtk_table_attach ( GTK_TABLE ( table ) , vbox , 1 , 2 , 1 , 2 ,
( GtkAttachOptions ) ( GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Save... " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_save ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Unload " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_unload ) , NULL ) ;
gtk_widget_show ( w ) ;
2008-07-04 22:11:30 +00:00
2012-03-17 20:01:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , TRUE , TRUE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Apply " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_apply ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Preview " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_preview ) , NULL ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( vbox ) ;
2012-03-17 20:01:54 +00:00
gtk_table_attach ( GTK_TABLE ( table ) , vbox , 1 , 2 , 2 , 3 ,
( GtkAttachOptions ) ( GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2007-11-04 03:51:54 +00:00
hbox = gtk_hbox_new ( FALSE , 5 ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , TRUE , TRUE , 0 ) ;
gtk_widget_show ( hbox ) ;
2012-03-17 20:01:54 +00:00
w = gtk_button_new_with_label ( _ ( " Close " ) ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , w , FALSE , FALSE , 0 ) ;
2007-11-04 03:51:54 +00:00
gtk_signal_connect ( GTK_OBJECT ( w ) , " clicked " , GTK_SIGNAL_FUNC ( ci_close ) , NULL ) ;
GTK_WIDGET_SET_FLAGS ( w , GTK_CAN_DEFAULT ) ;
gtk_widget_grab_default ( w ) ;
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
return window ;
2007-11-04 03:51:54 +00:00
}