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 ) {
2017-03-23 08:37:50 +00:00
GtkWidget * dialog , * w , * vbox , * vbox2 , * hbox , * frame ; //, *name;
GtkWidget * fixed , * interpolated , * spline , * content_area ;
2007-11-04 03:51:54 +00:00
GSList * targetTypeRadio = NULL ;
// char buf[128];
2017-03-23 08:37:50 +00:00
gint response_id ;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT ;
2007-11-04 03:51:54 +00:00
// create the window
2017-03-23 08:37:50 +00:00
dialog = gtk_dialog_new_with_buttons ( _ ( " New Camera " ) , NULL , flags , NULL ) ;
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " OK " ) , GTK_RESPONSE_OK ) ;
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " Cancel " ) , GTK_RESPONSE_CANCEL ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ) , GTK_WINDOW ( g_pCameraInspectorWnd ) ) ;
gtk_window_set_position ( GTK_WINDOW ( dialog ) , GTK_WIN_POS_CENTER_ON_PARENT ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
content_area = gtk_dialog_get_content_area ( GTK_DIALOG ( dialog ) ) ;
2007-11-04 03:51:54 +00:00
// fill the window
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2017-03-23 08:37:50 +00:00
gtk_container_add ( GTK_CONTAINER ( content_area ) , 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 ) ;
// -------------------------- //
2017-03-16 11:40:56 +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 ) ;
2017-03-10 21:44:05 +00:00
targetTypeRadio = gtk_radio_button_get_group ( GTK_RADIO_BUTTON ( fixed ) ) ;
2007-11-04 03:51:54 +00:00
2017-03-16 11:40:56 +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 ) ;
2017-03-10 21:44:05 +00:00
targetTypeRadio = gtk_radio_button_get_group ( GTK_RADIO_BUTTON ( interpolated ) ) ;
2007-11-04 03:51:54 +00:00
2017-03-16 11:40:56 +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 ) ;
2017-03-10 21:44:05 +00:00
targetTypeRadio = gtk_radio_button_get_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
// -------------------------- //
2017-03-23 08:37:50 +00:00
response_id = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
if ( response_id = = GTK_RESPONSE_OK ) {
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
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 ( ) ;
2007-11-04 03:51:54 +00:00
}
}
2017-03-23 08:37:50 +00:00
gtk_widget_destroy ( dialog ) ;
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 ) ;
2017-03-10 21:44:05 +00:00
gtk_adjustment_set_upper ( g_pTimeLine , GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) * 1000 ) ;
2007-11-04 03:51:54 +00:00
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
}
2017-03-23 08:37:50 +00:00
static void ci_show ( GtkWidget * widget , gpointer data ) {
2012-03-17 20:01:54 +00:00
// start edit mode
DoStartEdit ( GetCurrentCam ( ) ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
return ;
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
2017-03-15 10:58:36 +00:00
if ( g_pCameraInspectorWnd & & gtk_widget_get_visible ( g_pCameraInspectorWnd ) ) {
2012-03-17 20:01:54 +00:00
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 ) ;
2017-03-10 21:44:05 +00:00
gtk_adjustment_set_upper ( g_pTimeLine , ( GetCurrentCam ( ) - > GetCam ( ) - > getTotalTime ( ) * 1000 ) ) ;
2007-11-04 03:51:54 +00:00
}
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 ) {
2017-03-23 08:37:50 +00:00
GtkWidget * dialog , * w , * vbox , * hbox , * name , * content_area ;
gint response_id ;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT ;
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
return TRUE ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
dialog = gtk_dialog_new_with_buttons ( _ ( " Rename Path " ) , NULL , flags , NULL ) ;
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ) , GTK_WINDOW ( g_pCameraInspectorWnd ) ) ;
gtk_window_set_position ( GTK_WINDOW ( dialog ) , GTK_WIN_POS_CENTER_ON_PARENT ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " OK " ) , GTK_RESPONSE_OK ) ;
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " Cancel " ) , GTK_RESPONSE_CANCEL ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
content_area = gtk_dialog_get_content_area ( GTK_DIALOG ( dialog ) ) ;
2007-11-04 03:51:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2017-03-23 08:37:50 +00:00
gtk_container_add ( GTK_CONTAINER ( content_area ) , 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 ) ;
2017-03-10 22:03:03 +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
// -------------------------- //
bool dialogError = TRUE ;
2017-03-23 08:37:50 +00:00
while ( dialogError )
{
response_id = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ;
2008-07-04 22:11:30 +00:00
2007-11-04 03:51:54 +00:00
dialogError = FALSE ;
2017-03-23 08:37:50 +00:00
if ( response_id = = GTK_RESPONSE_OK ) {
2012-03-17 20:01:54 +00:00
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 ;
}
}
}
2017-03-23 08:37:50 +00:00
gtk_widget_destroy ( dialog ) ;
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 ) {
2017-03-23 08:37:50 +00:00
GtkWidget * dialog , * w , * vbox , * vbox2 , * hbox , * frame , * name ;
GtkWidget * fixed , * interpolated , * spline , * content_area ;
2007-11-04 03:51:54 +00:00
GSList * targetTypeRadio = NULL ;
char buf [ 128 ] ;
2017-03-23 08:37:50 +00:00
gint response_id ;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT ;
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
return TRUE ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
dialog = gtk_dialog_new_with_buttons ( _ ( " Add Target " ) , NULL , flags , NULL ) ;
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ) , GTK_WINDOW ( g_pCameraInspectorWnd ) ) ;
gtk_window_set_position ( GTK_WINDOW ( dialog ) , GTK_WIN_POS_CENTER ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " OK " ) , GTK_RESPONSE_OK ) ;
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " Cancel " ) , GTK_RESPONSE_CANCEL ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
content_area = gtk_dialog_get_content_area ( GTK_DIALOG ( dialog ) ) ;
2007-11-04 03:51:54 +00:00
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2017-03-23 08:37:50 +00:00
gtk_container_add ( GTK_CONTAINER ( content_area ) , 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 ) ;
2017-03-10 22:03:03 +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 ) ;
2017-03-10 21:44:05 +00:00
targetTypeRadio = gtk_radio_button_get_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 ) ;
2017-03-10 21:44:05 +00:00
targetTypeRadio = gtk_radio_button_get_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 ) ;
2017-03-10 21:44:05 +00:00
targetTypeRadio = gtk_radio_button_get_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
// -------------------------- //
bool dialogError = TRUE ;
2017-03-23 08:37:50 +00:00
while ( dialogError )
{
response_id = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ;
2008-07-04 22:11:30 +00:00
2007-11-04 03:51:54 +00:00
dialogError = FALSE ;
2017-03-23 08:37:50 +00:00
if ( response_id = = GTK_RESPONSE_OK ) {
2012-03-17 20:01:54 +00:00
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 ;
2017-02-25 20:55:03 +00:00
} else {
assert ( 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 ;
}
}
}
2017-03-23 08:37:50 +00:00
gtk_widget_destroy ( dialog ) ;
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 ) ;
2017-03-10 21:44:05 +00:00
gtk_adjustment_set_upper ( g_pTimeLine , 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 ) ;
2017-03-10 21:44:05 +00:00
gtk_adjustment_set_upper ( g_pTimeLine , 30000 ) ;
2007-11-04 03:51:54 +00:00
}
// 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 ;
2017-03-15 10:58:36 +00:00
if ( g_pCameraInspectorWnd & & gtk_widget_get_visible ( g_pCameraInspectorWnd ) ) {
2012-03-17 20:01:54 +00:00
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 ) {
2017-03-23 08:37:50 +00:00
GtkWidget * dialog , * w , * vbox , * vbox2 , * hbox , * frame , * parameters ;
GtkWidget * eventWidget [ EVENT_COUNT ] , * content_area ;
int i ;
2007-11-04 03:51:54 +00:00
GSList * eventTypeRadio = NULL ;
// char buf[128];
2017-03-23 08:37:50 +00:00
gint response_id ;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT ;
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
return TRUE ;
2012-03-17 20:01:54 +00:00
}
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
dialog = gtk_dialog_new_with_buttons ( _ ( " Add Event " ) , NULL , flags , NULL ) ;
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ) , GTK_WINDOW ( g_pCameraInspectorWnd ) ) ;
gtk_window_set_position ( GTK_WINDOW ( dialog ) , GTK_WIN_POS_CENTER_ON_PARENT ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " OK " ) , GTK_RESPONSE_OK ) ;
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " Cancel " ) , GTK_RESPONSE_CANCEL ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
content_area = gtk_dialog_get_content_area ( GTK_DIALOG ( dialog ) ) ;
2007-11-04 03:51:54 +00:00
// fill the window
vbox = gtk_vbox_new ( FALSE , 5 ) ;
2017-03-23 08:37:50 +00:00
gtk_container_add ( GTK_CONTAINER ( content_area ) , 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 ] ) ;
2017-03-10 21:44:05 +00:00
eventTypeRadio = gtk_radio_button_get_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
// -------------------------- //
bool dialogError = TRUE ;
2017-03-23 08:37:50 +00:00
while ( dialogError )
{
response_id = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ;
2008-07-04 22:11:30 +00:00
2007-11-04 03:51:54 +00:00
dialogError = FALSE ;
2017-03-23 08:37:50 +00:00
if ( response_id = = GTK_RESPONSE_OK ) {
2012-03-17 20:01:54 +00:00
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
2017-03-10 21:44:05 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > addEvent ( static_cast < idCameraEvent : : eventType > ( type ) , str , ( long ) ( gtk_adjustment_get_value ( g_pTimeLine ) ) ) ;
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 ;
}
}
}
2017-03-23 08:37:50 +00:00
gtk_widget_destroy ( dialog ) ;
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 ] ;
2017-03-10 21:44:05 +00:00
sprintf ( buf , " %.2f " , gtk_adjustment_get_value ( adjustment ) / 1000.f ) ;
2007-11-04 03:51:54 +00:00
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
2017-03-10 21:44:05 +00:00
GetCurrentCam ( ) - > GetCam ( ) - > getCameraInfo ( ( long ) ( gtk_adjustment_get_value ( adjustment ) ) , & origin [ 0 ] , & dir [ 0 ] , & fov ) ;
2012-03-17 20:01:54 +00:00
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 ) {
2017-03-23 08:37:50 +00:00
GtkWidget * dialog , * w , * vbox , * hbox , * table , * frame ;
GtkWidget * content_area ;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
dialog = gtk_dialog_new_with_buttons ( _ ( " Camera Inspector " ) , NULL , flags , NULL ) ;
w = gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( " OK " ) , GTK_RESPONSE_OK ) ;
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_close ) , NULL ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
g_signal_connect ( dialog , " delete_event " , G_CALLBACK ( ci_close ) , NULL ) ;
g_signal_connect ( dialog , " show " , G_CALLBACK ( ci_show ) , NULL ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ) , GTK_WINDOW ( g_pCameraInspectorWnd ) ) ;
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
content_area = gtk_dialog_get_content_area ( GTK_DIALOG ( dialog ) ) ;
2007-11-04 03:51:54 +00:00
2012-03-17 20:01:54 +00:00
table = gtk_table_new ( 3 , 2 , FALSE ) ;
2017-03-23 08:37:50 +00:00
gtk_container_add ( GTK_CONTAINER ( content_area ) , table ) ;
2012-03-17 20:01:54 +00:00
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 ) ;
2017-03-23 08:37:50 +00:00
gtk_widget_show ( table ) ;
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 ) ;
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 ) ;
2017-03-23 08:37:50 +00:00
gtk_widget_show ( vbox ) ;
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( GTK_COMBO ( g_pCamListCombo ) - > entry ) , " changed " , G_CALLBACK ( 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_table_attach ( GTK_TABLE ( table ) , frame , 0 , 1 , 1 , 2 ,
( GtkAttachOptions ) ( GTK_EXPAND | GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2017-03-23 08:37:50 +00:00
gtk_widget_show ( frame ) ;
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( GTK_COMBO ( g_pPathListCombo ) - > entry ) , " changed " , G_CALLBACK ( 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 ) ;
2017-03-10 21:44:05 +00:00
g_pEditTypeRadio = gtk_radio_button_get_group ( GTK_RADIO_BUTTON ( g_pEditModeEditRadioButton ) ) ;
2007-11-04 03:51:54 +00:00
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( g_pEditModeEditRadioButton ) , " clicked " , G_CALLBACK ( ci_editmode_edit ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
2017-03-10 21:44:05 +00:00
g_pEditTypeRadio = gtk_radio_button_get_group ( GTK_RADIO_BUTTON ( g_pEditModeAddRadioButton ) ) ;
2007-11-04 03:51:54 +00:00
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( g_pEditModeAddRadioButton ) , " clicked " , G_CALLBACK ( ci_editmode_add ) , NULL ) ;
2007-11-04 03:51:54 +00:00
// 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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_rename ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_add_target ) , NULL ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( w ) ;
// not available in splines library
2017-03-16 11:40:56 +00:00
/*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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_delete_selected ) , NULL ) ;
2012-03-17 20:01:54 +00:00
gtk_widget_show ( w ) ;
2007-11-04 03:51:54 +00:00
2017-03-16 11:40:56 +00:00
w = gtk_button_new_with_label ( _ ( " Select All " ) ) ;
2012-03-17 20:01:54 +00:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , w , FALSE , TRUE , 0 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_select_all ) , NULL ) ;
2012-03-17 20:01:54 +00:00
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_table_attach ( GTK_TABLE ( table ) , frame , 0 , 1 , 2 , 3 ,
( GtkAttachOptions ) ( GTK_EXPAND | GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2017-03-23 08:37:50 +00:00
gtk_widget_show ( frame ) ;
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 ) ;
2017-03-10 21:44:05 +00:00
g_object_set ( g_pSecondsEntry , " xalign " , 1.0 , NULL ) ;
2012-03-17 20:01:54 +00:00
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 ) ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( g_pTimeLine ) , " value-changed " , G_CALLBACK ( ci_timeline_changed ) , NULL ) ;
2012-03-17 20:01:54 +00:00
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_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 ) ;
2017-03-15 10:58:36 +00:00
//g_signal_connect( G_OBJECT(g_pEventsList), "select_row", G_CALLBACK (proplist_select_row), NULL);
2012-03-17 20:01:54 +00:00
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_add ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_del ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
gtk_table_attach ( GTK_TABLE ( table ) , vbox , 1 , 2 , 0 , 1 ,
( GtkAttachOptions ) ( GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2017-03-23 08:37:50 +00:00
gtk_widget_show ( vbox ) ;
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_new ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_load ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
gtk_table_attach ( GTK_TABLE ( table ) , vbox , 1 , 2 , 1 , 2 ,
( GtkAttachOptions ) ( GTK_FILL ) ,
( GtkAttachOptions ) ( GTK_FILL ) , 0 , 0 ) ;
2017-03-23 08:37:50 +00:00
gtk_widget_show ( vbox ) ;
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_save ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_unload ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_apply ) , NULL ) ;
2007-11-04 03:51:54 +00:00
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 ) ;
2017-03-15 10:58:36 +00:00
g_signal_connect ( G_OBJECT ( w ) , " clicked " , G_CALLBACK ( ci_preview ) , NULL ) ;
2007-11-04 03:51:54 +00:00
gtk_widget_show ( w ) ;
2012-03-17 20:01:54 +00:00
// -------------------------- //
2007-11-04 03:51:54 +00:00
2017-03-23 08:37:50 +00:00
return dialog ;
2007-11-04 03:51:54 +00:00
}