Merge pull request #462 from Pan7/deprcombo

Replace deprecated gtk combo
This commit is contained in:
Timothee "TTimo" Besset 2017-04-27 08:33:05 -05:00 committed by GitHub
commit ceb9873524
11 changed files with 353 additions and 254 deletions

View file

@ -98,13 +98,15 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer
}
static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){
gchar *text;
TwinWidget* tw = (TwinWidget*)data;
GtkEntry* entry = GTK_ENTRY( tw->one );
GtkCombo* combo = GTK_COMBO( tw->two );
GtkComboBoxText* combo = GTK_COMBO_BOX_TEXT( tw->two );
const gchar* tex = gtk_entry_get_text( GTK_ENTRY( combo->entry ) );
gtk_entry_set_text( entry, tex );
text = gtk_combo_box_text_get_active_text( combo );
gtk_entry_set_text( entry, text );
g_free( text );
}
/*--------------------------------
@ -423,6 +425,11 @@ int DoPolygonBox( PolygonRS* rs ){
// ---- hbox2 ----
sides_label = w = gtk_label_new( _( "Number Of Sides" ) );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
text1 = gtk_entry_new();
gtk_entry_set_alignment( GTK_ENTRY( text1 ), 1.0 ); //right
gtk_entry_set_max_length( GTK_ENTRY( text1 ), 256 );
@ -430,11 +437,6 @@ int DoPolygonBox( PolygonRS* rs ){
gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 );
gtk_widget_show( text1 );
sides_label = w = gtk_label_new( _( "Number Of Sides" ) );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
// ---- /hbox2 ----
hbox2 = gtk_hbox_new( FALSE, 10 );
@ -443,6 +445,11 @@ int DoPolygonBox( PolygonRS* rs ){
// ---- hbox2 ----
width_label = w = gtk_label_new( _( "Border Width" ) );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
text2 = gtk_entry_new();
gtk_entry_set_alignment( GTK_ENTRY( text2 ), 1.0 ); //right
gtk_entry_set_max_length( GTK_ENTRY( text2 ), 256 );
@ -450,11 +457,6 @@ int DoPolygonBox( PolygonRS* rs ){
gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 );
gtk_widget_show( text2 );
width_label = w = gtk_label_new( _( "Border Width" ) );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
// ---- /hbox2 ----
// ---- /vbox2 ----
@ -799,6 +801,7 @@ int DoDoorsBox( DoorRS* rs ){
GtkWidget *buttonSetMain, *buttonSetTrim;
GtkWidget *radioNS, *radioEW;
GSList *radioOrientation;
GList *lst;
TwinWidget tw1, tw2;
int ret, loop;
@ -901,10 +904,12 @@ int DoDoorsBox( DoorRS* rs ){
// djbob: lists added
comboMain = gtk_combo_new();
comboMain = gtk_combo_box_text_new();
gtk_box_pack_start( GTK_BOX( hbox ), comboMain, FALSE, FALSE, 0 );
gtk_combo_set_popdown_strings( GTK_COMBO( comboMain ), listMainTextures );
gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
for ( lst = listMainTextures; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( comboMain ), (const char *)lst->data );
}
gtk_widget_show( comboMain );
tw1.one = textFrontBackTex;
@ -921,10 +926,12 @@ int DoDoorsBox( DoorRS* rs ){
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
comboTrim = gtk_combo_new();
comboTrim = gtk_combo_box_text_new();
gtk_box_pack_start( GTK_BOX( hbox ), comboTrim, FALSE, FALSE, 0 );
gtk_combo_set_popdown_strings( GTK_COMBO( comboTrim ), listTrimTextures );
gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
for ( lst = listTrimTextures; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( comboTrim ), (const char *)lst->data );
}
gtk_widget_show( comboTrim );
tw2.one = textTrimTex;
@ -1292,7 +1299,12 @@ int DoResetTextureBox( ResetTextureRS* rs ){
// ---- hbox ----
texSelected = _( "Currently Selected Face: " );
w = gtk_label_new( _( "Currently Selected Face: " ) );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
texSelected = "";
if ( g_SelectedFaceTable.m_pfnGetSelectedFaceCount() == 1 ) {
texSelected += GetCurrentTexture();
}

View file

@ -41,6 +41,10 @@ static GtkWidget *g_pTrackCamera = NULL;
static GtkWidget *g_pCamName = NULL;
static char *g_cNull = '\0';
#define EVENT_TEXT_COLUMN (0)
#define EVENT_INDEX_COLUMN (1)
static gint ci_editmode_edit( GtkWidget *widget, gpointer data ){
g_iEditMode = 0;
@ -233,29 +237,37 @@ static GtkWidget *g_pPathListCombo = NULL;
static GtkLabel *g_pPathType = NULL;
static void RefreshPathListCombo( void ){
GList *combo_list = (GList*)NULL;
GList *lst;
GtkListStore *store;
if ( !g_pPathListCombo ) {
return;
}
GList *combo_list = (GList*)NULL;
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 {
// add one empty string make gtk be quiet
combo_list = g_list_append( combo_list, (gpointer)g_cNull );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_text_remove_all( GTK_COMBO_BOX_TEXT( g_pPathListCombo ) );
#else
store = GTK_LIST_STORE( gtk_combo_box_get_model( GTK_COMBO_BOX( g_pPathListCombo ) ) );
gtk_list_store_clear( store );
#endif
for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( g_pPathListCombo ), (const gchar *)lst->data );
}
gtk_combo_set_popdown_strings( GTK_COMBO( g_pPathListCombo ), combo_list );
g_list_free( combo_list );
gtk_combo_box_set_active( GTK_COMBO_BOX( g_pPathListCombo ), 0 );
}
static gint ci_pathlist_changed( GtkWidget *widget, gpointer data ){
const char *str = gtk_entry_get_text( GTK_ENTRY( widget ) );
char *str = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( widget ) );
if ( !str || !GetCurrentCam() ) {
return TRUE;
@ -288,18 +300,24 @@ static gint ci_pathlist_changed( GtkWidget *widget, gpointer data ){
DoStartEdit( GetCurrentCam() );
}
g_free( str );
return TRUE;
}
static void RefreshEventList( void ){
int i;
char buf[128];
GtkListStore *store;
store = GTK_LIST_STORE( GTK_TREE_MODEL( gtk_tree_view_get_model( GTK_TREE_VIEW( g_pEventsList ) ) ) );
// Clear events list
gtk_clist_freeze( GTK_CLIST( g_pEventsList ) );
gtk_clist_clear( GTK_CLIST( g_pEventsList ) );
gtk_list_store_clear( store );
if ( GetCurrentCam() ) {
GtkTreeIter iter;
// Fill events list
for ( i = 0; i < GetCurrentCam()->GetCam()->numEvents(); i++ ) {
char rowbuf[3][128], *row[3];
@ -307,7 +325,9 @@ static void RefreshEventList( void ){
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 );
gtk_list_store_append( store, &iter );
gtk_list_store_set( store, &iter, EVENT_TEXT_COLUMN, row, EVENT_INDEX_COLUMN, i, -1 );
}
// Total duration might have changed
@ -319,7 +339,6 @@ static void RefreshEventList( void ){
gtk_adjustment_set_upper( g_pTimeLine, ( GetCurrentCam()->GetCam()->getTotalTime() * 1000 ) );
}
gtk_clist_thaw( GTK_CLIST( g_pEventsList ) );
}
static gint ci_rename( GtkWidget *widget, gpointer data ){
@ -507,7 +526,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
if ( str && str[0] ) {
int type;
GList *li;
GList *li, *children;
if ( gtk_toggle_button_get_active( (GtkToggleButton*)fixed ) ) {
type = 0;
@ -525,9 +544,15 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
// Rebuild the listbox
RefreshPathListCombo();
children = gtk_container_get_children( GTK_CONTAINER( g_pPathListCombo ) );
// Select the last item in the listbox
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 ) );
li = g_list_last( children );
if ( li ) {
gtk_combo_box_set_active( GTK_COMBO_BOX( g_pPathListCombo ), g_list_index( children, GTK_WIDGET( li->data ) ) );
}
if ( children ) {
g_list_free( children );
}
// If this was the first one, refresh the event list
if ( GetCurrentCam()->GetCam()->numTargets() == 1 ) {
@ -558,6 +583,7 @@ void RefreshCamListCombo( void ){
}
GList *combo_list = (GList*)NULL;
GList *lst;
CCamera *combo_cam = firstCam;
if ( combo_cam ) {
while ( combo_cam ) {
@ -574,35 +600,39 @@ void RefreshCamListCombo( void ){
combo_cam = combo_cam->GetNext();
}
}
else {
// add one empty string make gtk be quiet
combo_list = g_list_append( combo_list, (gpointer)g_cNull );
for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( g_pCamListCombo ), (const gchar *)lst->data );
}
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() ) {
GList *li, *children;
// 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;
li = children = gtk_container_get_children( GTK_CONTAINER( g_pCamListCombo ) );
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 ) );
gtk_combo_box_set_active( GTK_COMBO_BOX( g_pCamListCombo ), g_list_index( li, GTK_WIDGET( li->data ) ) );
break;
}
li = li->next;
combo_cam = combo_cam->GetNext();
}
if ( children ) {
g_list_free( children );
}
}
RefreshPathListCombo();
}
static gint ci_camlist_changed( GtkWidget *widget, gpointer data ){
const char *str = gtk_entry_get_text( GTK_ENTRY( widget ) );
char *str = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( widget ) );
CCamera *combo_cam = firstCam;
while ( str && combo_cam ) {
@ -675,6 +705,8 @@ static gint ci_camlist_changed( GtkWidget *widget, gpointer data ){
DoStartEdit( GetCurrentCam() );
}
g_free( str );
return TRUE;
}
@ -847,13 +879,23 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
}
static gint ci_del( GtkWidget *widget, gpointer data ){
GtkTreeIter iter;
GtkTreeModel *model;
guint *index;
GtkTreeSelection *select;
// TODO: add support to splines lib
if ( GetCurrentCam() && GTK_CLIST( g_pEventsList )->focus_row >= 0 ) {
GetCurrentCam()->GetCam()->removeEvent( GTK_CLIST( g_pEventsList )->focus_row );
select = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_pEventsList ) );
if( gtk_tree_selection_get_selected( select, &model, &iter ) )
{
gtk_tree_model_get( model, &iter, EVENT_INDEX_COLUMN, &index, -1 );
GetCurrentCam()->GetCam()->removeEvent( *index );
// Refresh event list
RefreshEventList();
}
g_free( index );
}
return TRUE;
}
@ -883,6 +925,9 @@ static gint ci_timeline_changed( GtkAdjustment *adjustment ){
GtkWidget *CreateCameraInspectorDialog( void ){
GtkWidget *dialog, *w, *vbox, *hbox, *table, *frame;
GtkWidget *content_area;
GtkListStore *store;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
dialog = gtk_dialog_new_with_buttons( _( "Camera Inspector" ), NULL, flags, NULL );
@ -923,9 +968,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
g_pCamListCombo = gtk_combo_new();
g_pCamListCombo = gtk_combo_box_text_new();
gtk_box_pack_start( GTK_BOX( hbox ), g_pCamListCombo, TRUE, TRUE, 0 );
gtk_widget_show( g_pCamListCombo );
g_signal_connect( G_OBJECT( GTK_COMBO_BOX( g_pCamListCombo ) ), "changed", G_CALLBACK( ci_camlist_changed ), NULL );
// -------------------------- //
@ -954,8 +1000,6 @@ GtkWidget *CreateCameraInspectorDialog( void ){
RefreshCamListCombo();
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( g_pCamListCombo )->entry ), FALSE );
g_signal_connect( G_OBJECT( GTK_COMBO( g_pCamListCombo )->entry ), "changed", G_CALLBACK( ci_camlist_changed ), NULL );
// -------------------------- //
@ -981,14 +1025,13 @@ GtkWidget *CreateCameraInspectorDialog( void ){
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
g_pPathListCombo = gtk_combo_new();
g_pPathListCombo = gtk_combo_box_text_new();
gtk_box_pack_start( GTK_BOX( hbox ), g_pPathListCombo, TRUE, TRUE, 0 );
gtk_widget_show( g_pPathListCombo );
g_signal_connect( G_OBJECT( GTK_COMBO_BOX( g_pPathListCombo ) ), "changed", G_CALLBACK( ci_pathlist_changed ), NULL );
RefreshPathListCombo();
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( g_pPathListCombo )->entry ), FALSE );
g_signal_connect( G_OBJECT( GTK_COMBO( g_pPathListCombo )->entry ), "changed", G_CALLBACK( ci_pathlist_changed ), NULL );
// -------------------------- //
@ -1152,14 +1195,22 @@ GtkWidget *CreateCameraInspectorDialog( void ){
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_widget_show( w );
g_pEventsList = gtk_clist_new( 3 );
store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_UINT ); //2 data columns
g_pEventsList = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
g_object_unref( G_OBJECT( store ) );
renderer = gtk_cell_renderer_text_new();
//1 view column with the events
column = gtk_tree_view_column_new_with_attributes( "events", renderer, "text", EVENT_TEXT_COLUMN, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( g_pEventsList ), column );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_pEventsList ), FALSE );
gtk_container_add( GTK_CONTAINER( w ), g_pEventsList );
//g_signal_connect( G_OBJECT(g_pEventsList), "select_row", G_CALLBACK (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 );
gtk_tree_selection_set_mode( gtk_tree_view_get_selection( GTK_TREE_VIEW( g_pEventsList ) ), GTK_SELECTION_BROWSE );
gtk_widget_show( g_pEventsList );
vbox = gtk_vbox_new( FALSE, 5 );

View file

@ -291,6 +291,7 @@ static void PopulateTextureComboList(){
texdef_to_face_t* temp_texdef_face_list;
char blank[1];
GList *items = NULL;
GList *lst;
int num_of_list_items = 0;
blank[0] = 0;
@ -328,9 +329,13 @@ static void PopulateTextureComboList(){
strcpy( old_texture_entry, blank );
}
gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
for( lst = items; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( texture_combo ), (const char *)lst->data );
}
g_list_free( items );
gtk_combo_box_set_active( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( texture_combo ) ), 0 );
}
static void ZeroOffsetValues(){
@ -677,14 +682,11 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label );
texture_combo = gtk_combo_new();
g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ),
"KeepMeAround", texture_combo );
gtk_combo_disable_activate( (GtkCombo*) texture_combo );
texture_combo = gtk_combo_box_text_new_with_entry();
gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 );
gtk_widget_show( texture_combo );
texture_combo_entry = GTK_COMBO( texture_combo )->entry;
texture_combo_entry = gtk_bin_get_child( GTK_BIN( texture_combo ) );
gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 );
gtk_widget_show( texture_combo_entry );

View file

@ -256,6 +256,7 @@ static void PopulateTextureComboList(){
texdef_to_face_t* temp_texdef_face_list;
char blank[1];
GList *items = NULL;
GList *lst;
int num_of_list_items = 0;
blank[0] = 0;
@ -293,7 +294,10 @@ static void PopulateTextureComboList(){
strcpy( old_texture_entry, blank );
}
gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
for( lst = items; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( texture_combo ), (const char *)lst->data );
}
g_list_free( items );
}
@ -328,7 +332,7 @@ static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer
}
static gint surface_inspector_key_press_event( GtkWidget *widget, GdkEventKey* event, gpointer data ) {
if ( event->keyval == GDK_Escape ) {
if ( event->keyval == GDK_KEY_Escape ) {
HideDlg();
return TRUE;
}
@ -573,14 +577,11 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label );
texture_combo = gtk_combo_new();
g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ),
"KeepMeAround", texture_combo );
gtk_combo_disable_activate( (GtkCombo*) texture_combo );
texture_combo = gtk_combo_box_text_new_with_entry();
gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 );
gtk_widget_show( texture_combo );
texture_combo_entry = GTK_COMBO( texture_combo )->entry;
texture_combo_entry = gtk_bin_get_child( GTK_BIN( texture_combo ) );
gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 1024 );
gtk_widget_show( texture_combo_entry );

View file

@ -166,28 +166,6 @@ void Dialog::UpdateData( bool retrieve ){
case DLG_ADJ_INT:
*(int*)data->buffer = (int) gtk_adjustment_get_value( GTK_ADJUSTMENT( data->object ) );
break;
case DLG_COMBO_INT:
{
GList *lst = gtk_container_get_children( GTK_CONTAINER( GTK_COMBO( data->object )->list ) );
const char *labeltext;
const char *entrytext;
int i;
*(int*)data->buffer = -1;
entrytext = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( data->object )->entry ) );
for ( i = 0; lst != NULL; lst = g_list_next( lst ) )
{
labeltext = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( lst->data ) ) ) );
if ( strcmp( labeltext, entrytext ) == 0 ) {
*(int*)data->buffer = i;
break;
}
i++;
}
}
break;
case DLG_COMBO_BOX_INT: {
*(int*)data->buffer = gtk_combo_box_get_active( GTK_COMBO_BOX( data->object ) );
}
@ -237,25 +215,6 @@ void Dialog::UpdateData( bool retrieve ){
case DLG_ADJ_INT:
gtk_adjustment_set_value( GTK_ADJUSTMENT( data->object ), ( *(int*)data->buffer ) );
break;
case DLG_COMBO_INT: {
GList *lst = gtk_container_get_children( GTK_CONTAINER( GTK_COMBO( data->object )->list ) );
const char *text = NULL;
GtkEntry *entry = GTK_ENTRY( GTK_COMBO( data->object )->entry );
if ( *(int*)data->buffer != -1 ) {
lst = g_list_nth( lst, *(int*)data->buffer );
if ( lst != NULL ) {
text = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( lst->data ) ) ) );
}
}
if ( text ) {
gtk_entry_set_text( entry, text );
}
else{
gtk_entry_set_text( entry, "" );
}
}
break;
case DLG_COMBO_BOX_INT: {
gtk_combo_box_set_active( GTK_COMBO_BOX( data->object ), *(int*)data->buffer );
}

View file

@ -414,21 +414,34 @@ void OnSelchangeComboWhatgame( GtkWidget *widget, gpointer data ){
GtkWidget *fs_game_entry;
GtkWidget* game_select;
size_t x;
const gchar *name;
#if GTK_CHECK_VERSION( 3, 0, 0 )
const gchar *fs_game;
#else
gchar *name;
#endif
game_select = GTK_WIDGET( g_object_get_data( G_OBJECT( data ), "game_select" ) );
name = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ) );
#if GTK_CHECK_VERSION( 3, 0, 0 )
fs_game = gtk_combo_box_get_active_id( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( game_select ) ) );
if( !fs_game ) {
return;
}
#else
name = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( game_select ) );
if( !name ) {
return;
}
#endif
fs_game_entry = GTK_WIDGET( g_object_get_data( G_OBJECT( data ), "fs_game_entry" ) );
for( x = 0; x < G_N_ELEMENTS( gameList ); x++ )
{
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gameList[x].gameFile ) == 0
#if GTK_CHECK_VERSION( 3, 0, 0 )
&& strcmp( fs_game, gameList[x].fs_game ) == 0 ) {
#else
&& strcmp( name, gameList[x].name ) == 0 ) {
#endif
if( gameList[x].custom ) {
gtk_entry_set_text( GTK_ENTRY( fs_game_entry ), gameList[x].fs_game );
gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), true );
@ -440,6 +453,11 @@ void OnSelchangeComboWhatgame( GtkWidget *widget, gpointer data ){
break;
}
}
#if GTK_CHECK_VERSION( 3, 0, 0 )
//combo active id is an interned string
#else
g_free( name );
#endif
}
@ -568,25 +586,26 @@ void DoProjectSettings(){
gtk_widget_show( table2 );
mod_list = newModListForGameFile( g_pGameDescription->mGameFile );
game_select = gtk_combo_new();
game_select = gtk_combo_box_text_new();
for( lst = mod_list; lst != NULL; lst = g_list_next( lst ) )
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 ) {
combo_list = g_list_append( combo_list, (void *)game_x->name );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_text_append( GTK_COMBO_BOX_TEXT( game_select ), game_x->fs_game, game_x->name );
#else
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select ), game_x->name );
combo_list = g_list_append( combo_list, (void*)game_x->name );
#endif
}
}
gtk_combo_set_popdown_strings( GTK_COMBO( game_select ), combo_list );
g_list_free( combo_list );
gtk_table_attach( GTK_TABLE( table2 ), game_select, 1, 2, 6, 7,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( game_select );
g_signal_connect( G_OBJECT( GTK_COMBO( game_select )->entry ), "changed",
g_signal_connect( G_OBJECT( GTK_COMBO_BOX( game_select ) ), "changed",
G_CALLBACK( OnSelchangeComboWhatgame ), dialog );
g_object_set_data( G_OBJECT( dialog ), "game_select", game_select );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( game_select )->entry ), FALSE );
fs_game_entry = entry = gtk_entry_new();
gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), false );
@ -603,7 +622,11 @@ void DoProjectSettings(){
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && strcmp( game_x->fs_game, fs_game ) == 0 ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), game_x->name );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_set_active_id( GTK_COMBO_BOX( game_select ), fs_game );
#else
gtk_combo_box_set_active( GTK_COMBO_BOX( game_select ), g_list_index( combo_list, game_x->name ) );
#endif
isBasegame = qfalse;
break;
}
@ -613,7 +636,11 @@ void DoProjectSettings(){
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && game_x->custom ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), game_x->name );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_set_active_id( GTK_COMBO_BOX( game_select ), game_x->fs_game );
#else
gtk_combo_box_set_active( GTK_COMBO_BOX( game_select ), g_list_index( combo_list, game_x->name ) );
#endif
gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), true );
isBasegame = qfalse;
break;
@ -626,13 +653,18 @@ void DoProjectSettings(){
{
const game_t *game_x = (const game_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && game_x->base ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), game_x->name );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_set_active_id( GTK_COMBO_BOX( game_select ), game_x->fs_game );
#else
gtk_combo_box_set_active( GTK_COMBO_BOX( game_select ), g_list_index( combo_list, game_x->name ) );
#endif
fs_game = game_x->fs_game;
break;
}
}
}
gtk_entry_set_text( GTK_ENTRY( fs_game_entry ), fs_game );
g_list_free( combo_list );
gamemode_list = newMappingModesListForGameFile( g_pGameDescription->mGameFile );
if( gamemode_list ) {
@ -641,30 +673,32 @@ void DoProjectSettings(){
combo_list = NULL;
gamemode_combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( gamemode_combo );
for( lst = gamemode_list; lst != NULL; lst = g_list_next( lst ) )
{
const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 ) {
combo_list = g_list_append( combo_list, (void *)gamemode_x->name );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_text_append( GTK_COMBO_BOX_TEXT( gamemode_combo ), gamemode_x->mode, gamemode_x->name );
#else
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( gamemode_combo ), gamemode_x->name );
combo_list = g_list_append( combo_list, (void*)gamemode_x->name );
#endif
}
}
gamemode_combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
gtk_widget_show( gamemode_combo );
gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_list_free( combo_list );
combo_list = NULL;
label = gtk_label_new( _( "Mapping mode" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1.0, 0.5 );
gtk_widget_show( label );
gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
isBasemode = qtrue;
@ -672,7 +706,11 @@ void DoProjectSettings(){
{
const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 && strcmp( gamemode_x->mode, gamemode ) == 0 ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), gamemode_x->name );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_set_active_id( GTK_COMBO_BOX( gamemode_combo ), gamemode_x->mode );
#else
gtk_combo_box_set_active( GTK_COMBO_BOX( gamemode_combo ), g_list_index( combo_list, gamemode_x->name ) );
#endif
isBasemode = qfalse;
break;
}
@ -682,11 +720,16 @@ void DoProjectSettings(){
{
const gamemode_t *gamemode_x = (const gamemode_t *)lst->data;
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), gamemode_x->gameFile ) == 0 && gamemode_x->base ) {
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), gamemode_x->name );
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_set_active_id( GTK_COMBO_BOX( gamemode_combo ), gamemode_x->mode );
#else
gtk_combo_box_set_active( GTK_COMBO_BOX( gamemode_combo ), g_list_index( combo_list, gamemode_x->name ) );
#endif
break;
}
}
}
g_list_free( combo_list );
}
/*
@ -750,7 +793,11 @@ void DoProjectSettings(){
*w = '\0';
SetKeyValue( g_qeglobals.d_project_entity, "basepath", buf );
selected_game = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ) );
#if GTK_CHECK_VERSION( 3, 0, 0 )
selected_game = gtk_combo_box_get_active_id( GTK_COMBO_BOX( game_select ) );
#else
selected_game = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( game_select ) );
#endif
custom_fs_game = gtk_entry_get_text( GTK_ENTRY( fs_game_entry ) );
isBasegame = qfalse;
@ -762,7 +809,11 @@ void DoProjectSettings(){
for( lst = mod_list; lst != NULL; lst = g_list_next( lst ) )
{
const game_t *game_x = (const game_t *)lst->data;
#if GTK_CHECK_VERSION( 3, 0, 0 )
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && strcmp( game_x->fs_game, selected_game ) == 0 ) {
#else
if( strcmp( g_pGameDescription->mGameFile.GetBuffer(), game_x->gameFile ) == 0 && strcmp( game_x->name, selected_game ) == 0 ) {
#endif
if( game_x->base ) {
isBasegame = qtrue;
} else if( game_x->custom ) {
@ -790,7 +841,7 @@ void DoProjectSettings(){
const char *selected_mode;
const char *new_mode;
selected_mode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
selected_mode = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( gamemode_combo ) );
new_mode = NULL;
if( !selected_mode ) {
@ -838,6 +889,13 @@ void DoProjectSettings(){
SetKeyValue( g_qeglobals.d_project_entity, "brush_primit", ( g_qeglobals.m_bBrushPrimitMode ? "1" : "0" ) );
QE_SaveProject( g_PrefsDlg.m_strLastProject.GetBuffer() );
#if GTK_CHECK_VERSION( 3, 0, 0 )
//combo active id is an interned string
#else
g_free( selected_game );
#endif
}
g_list_free( mod_list );
@ -1838,11 +1896,14 @@ void DoNewPatchDlg(){
response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
if( response_id == GTK_RESPONSE_OK ) {
const char* w = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( width_combo ) );
const char* h = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( height_combo ) );
char* w = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( width_combo ) );
char* h = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( height_combo ) );
Patch_GenericMesh( atoi( w ), atoi( h ), g_pParentWnd->ActiveXY()->GetViewType() );
Sys_UpdateWindows( W_ALL );
g_free( w );
g_free( h );
}
gtk_widget_destroy( dialog );

View file

@ -4045,7 +4045,7 @@ void MainFrame::CleanPlugInMenu(){
seplst = g_list_find( children, sep );
if( seplst ) {
for ( lst = g_list_next( seplst ); lst != NULL; lst = g_list_next( lst ) )
{
{
gtk_container_remove( GTK_CONTAINER( menu ), GTK_WIDGET( lst->data ) );
}
}

View file

@ -291,6 +291,7 @@ void PatchDialog::BuildDialog(){
GtkWidget *dlg, *vbox, *vbox2, *hbox, *hbox2, *frame, *table, *label;
GtkWidget *button, *entry, *spin, *combo, *row_label, *col_label;
GtkAdjustment *adj;
GList *lst, *cells;
GtkSizeGroup *size_group;
GtkWidget *cap_button, *set_button, *nat_button, *fit_button;
@ -348,31 +349,37 @@ void PatchDialog::BuildDialog(){
gtk_size_group_add_widget( size_group, col_label );
g_object_unref( size_group );
combo = gtk_combo_new();
combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table ), combo, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( combo, 60, -1 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
gtk_entry_set_alignment( GTK_ENTRY( GTK_COMBO( combo )->entry ), 1.0 ); //right
gtk_widget_show( combo );
g_signal_connect( G_OBJECT( GTK_COMBO( combo )->entry ), "changed",
g_signal_connect( G_OBJECT( GTK_COMBO_BOX( combo ) ), "changed",
G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( combo, &m_nRow, DLG_COMBO_INT );
AddDialogData( combo, &m_nRow, DLG_COMBO_BOX_INT );
m_pRowCombo = combo;
cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( combo ) );
for( lst = cells; lst != NULL; lst = g_list_next( lst ) )
{
g_object_set( lst->data, "xalign", 1.0, NULL );
}
g_list_free( cells );
combo = gtk_combo_new();
combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( combo, 60, -1 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
gtk_entry_set_alignment( GTK_ENTRY( GTK_COMBO( combo )->entry ), 1.0 ); //right
gtk_widget_show( combo );
g_signal_connect( G_OBJECT( GTK_COMBO( combo )->entry ), "changed",
g_signal_connect( G_OBJECT( GTK_COMBO_BOX( combo ) ), "changed",
G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( combo, &m_nCol, DLG_COMBO_INT );
AddDialogData( combo, &m_nCol, DLG_COMBO_BOX_INT );
m_pColCombo = combo;
cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( combo ) );
for( lst = cells; lst != NULL; lst = g_list_next( lst ) )
{
g_object_set( lst->data, "xalign", 1.0, NULL );
}
g_list_free( cells );
table = gtk_table_new( 5, 2, FALSE );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
@ -713,7 +720,7 @@ void PatchDialog::UpdateData( bool retrieve ){
void PatchDialog::GetPatchInfo(){
m_Patch = SinglePatchSelected();
if ( m_Patch != NULL ) {
GList *combo_list = NULL;
gchar buffer[11];
int i;
m_strName = m_Patch->pShader->getName();
@ -722,32 +729,24 @@ void PatchDialog::GetPatchInfo(){
m_bListenChanged = false;
for ( i = 0; i < m_Patch->height; i++ )
combo_list = g_list_append( combo_list, g_strdup_printf( "%i", i ) ); // NOTE: leaving the g_strdup cause we free with g_free later on
gtk_combo_set_popdown_strings( GTK_COMBO( m_pRowCombo ), combo_list );
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( m_pRowCombo )->entry ), "0" );
while ( combo_list )
{
g_free( combo_list->data );
combo_list = g_list_remove( combo_list, combo_list->data );
g_snprintf( buffer, sizeof( buffer ), "%i", i );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( m_pRowCombo ), buffer );
}
gtk_combo_box_set_active( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( m_pRowCombo ) ), 0 );
for ( i = 0; i < m_Patch->width; i++ )
combo_list = g_list_append( combo_list, g_strdup_printf( "%i", i ) );
gtk_combo_set_popdown_strings( GTK_COMBO( m_pColCombo ), combo_list );
gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( m_pColCombo )->entry ), "0" );
while ( combo_list )
{
g_free( combo_list->data );
combo_list = g_list_remove( combo_list, combo_list->data );
g_snprintf( buffer, sizeof( buffer ), "%i", i );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( m_pColCombo ), buffer );
}
gtk_combo_box_set_active( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( m_pColCombo ) ), 0 );
m_bListenChanged = true;
}
else{
Sys_FPrintf( SYS_WRN, "WARNING: no patch\n" );
Sys_FPrintf( SYS_WRN, "WARNING: No patch selected.\n" );
}
// fill in our internal structs
m_nRow = 0; m_nCol = 0;

View file

@ -1056,11 +1056,11 @@ GtkWidget* CGameDialog::GetGlobalFrame(){
gtk_widget_show( text );
gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 );*/
combo = gtk_combo_box_new_text();
combo = gtk_combo_box_text_new();
gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 );
gtk_widget_show( combo );
AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
mGameCombo = GTK_COMBO_BOX( combo );
mGameCombo = GTK_COMBO_BOX_TEXT( combo );
UpdateGameCombo();
@ -1157,7 +1157,7 @@ void CGameDialog::BuildDialog() {
G_CALLBACK( SInstallCallback ), this );
button = gtk_button_new_with_label( _( "Exit" ) );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, TRUE, TRUE, 0 );
gtk_widget_show( button );
AddModalButton( button, IDCANCEL );
@ -1167,24 +1167,24 @@ void CGameDialog::BuildDialog() {
void CGameDialog::UpdateGameCombo() {
// fill in with the game descriptions
list<CGameDescription *>::iterator iGame;
GtkListStore *store;
if ( mGameCombo == NULL ) {
Sys_Printf( "mGameCombo == NULL\n" );
return;
}
// clear whatever is in - wtf no way to know how many text entries?
// use set/get active to track
gtk_combo_box_set_active( mGameCombo, 0 );
while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) {
gtk_combo_box_remove_text( mGameCombo, 0 );
gtk_combo_box_set_active( mGameCombo, 0 );
}
//clear combo box
#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_combo_box_text_remove_all( GTK_COMBO_BOX_TEXT( mGameCombo ) );
#else
store = GTK_LIST_STORE( gtk_combo_box_get_model( GTK_COMBO_BOX( mGameCombo ) ) );
gtk_list_store_clear( store );
#endif
for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
gtk_combo_box_append_text( mGameCombo, ( *iGame )->mGameName.GetBuffer() );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( mGameCombo ), ( *iGame )->mGameName.GetBuffer() );
}
gtk_combo_box_set_active( mGameCombo, 0 );
gtk_combo_box_set_active( GTK_COMBO_BOX( mGameCombo ), 0 );
}
void CGameDialog::ScanForGames(){
@ -1559,7 +1559,7 @@ void PrefsDlg::BuildDialog(){
*radio, *button, *pageframe, *vbox;
GList *combo_list = (GList*)NULL;
GList *lst;
GtkAdjustment *adj;
dialog = m_pWidget;
@ -1798,8 +1798,6 @@ void PrefsDlg::BuildDialog(){
gtk_widget_show( check );
AddDialogData( check, &m_bGlPtWorkaround, DLG_CHECK_BOOL );
g_list_free( combo_list );
#ifdef ATIHACK_812
// ATI bugs
check = gtk_check_button_new_with_label( _( "ATI and Intel cards w/ buggy drivers (disappearing polygons)" ) );
@ -1907,19 +1905,22 @@ void PrefsDlg::BuildDialog(){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label );
combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( combo );
AddDialogData( combo, &m_nCamDragMultiSelect, DLG_COMBO_BOX_INT );
combo_list = NULL;
combo_list = g_list_append( combo_list, (void *)_( "No" ) );
combo_list = g_list_append( combo_list, (void *)_( "Yes" ) );
combo_list = g_list_append( combo_list, (void *)_( "Yes (Classic Key Setup)" ) );
combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list );
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
gtk_widget_show( combo );
AddDialogData( combo, &m_nCamDragMultiSelect, DLG_COMBO_INT );
for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), (const char *)lst->data );
}
g_list_free( combo_list );
// Freelook in Camera view
check = gtk_check_button_new_with_label( _( "Freelook in Camera view" ) );
@ -2031,6 +2032,15 @@ void PrefsDlg::BuildDialog(){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label );
combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( combo );
AddDialogData( combo, &m_nTextureCompressionFormat, DLG_COMBO_BOX_INT );
// Texture compression choice label
combo_list = NULL;
// NONE will always be in pos 0
@ -2048,15 +2058,10 @@ void PrefsDlg::BuildDialog(){
combo_list = g_list_append( combo_list, (void *)_( "S3TC DXT3" ) );
combo_list = g_list_append( combo_list, (void *)_( "S3TC DXT5" ) );
}
combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list );
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
gtk_widget_show( combo );
AddDialogData( combo, &m_nTextureCompressionFormat, DLG_COMBO_INT );
for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), (const char *)lst->data );
}
g_list_free( combo_list );
// container
@ -2075,6 +2080,13 @@ void PrefsDlg::BuildDialog(){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label );
combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( combo );
AddDialogData( combo, &m_nLatchedShader, DLG_COMBO_BOX_INT );
// combo list
combo_list = NULL;
combo_list = g_list_append( combo_list, (void *)_( "None" ) );
@ -2088,14 +2100,10 @@ void PrefsDlg::BuildDialog(){
combo_list = g_list_append( combo_list, (void *)_( "Common" ) );
}
combo_list = g_list_append( combo_list, (void *)_( "All" ) );
combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list );
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
gtk_widget_show( combo );
AddDialogData( combo, &m_nLatchedShader, DLG_COMBO_INT );
for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), (const char *)lst->data );
}
g_list_free( combo_list );
// Add the page to the notebook
@ -2634,19 +2642,22 @@ void PrefsDlg::BuildDialog(){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label );
combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( combo );
AddDialogData( combo, &m_nLightRadiuses, DLG_COMBO_BOX_INT );
combo_list = NULL;
combo_list = g_list_append( combo_list, (void *)_( "Disabled" ) );
combo_list = g_list_append( combo_list, (void *)_( "True Q3Map2 Style" ) );
combo_list = g_list_append( combo_list, (void *)_( "Classic Style" ) );
combo = gtk_combo_new();
gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list );
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
gtk_widget_show( combo );
AddDialogData( combo, &m_nLightRadiuses, DLG_COMBO_INT );
for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) )
{
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), (const char *)lst->data );
}
g_list_free( combo_list );
#ifdef _WIN32
check = gtk_check_button_new_with_label( _( "Use win32 file associations to open text files instead of builtin editor" ) );
@ -3360,15 +3371,17 @@ void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) {
CGameInstall* i = static_cast<CGameInstall*>( data );
i->UpdateData( TRUE );
i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) );
gchar * str = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( widget ) );
i->m_strName = str;
g_free( str );
i->UpdateData( FALSE );
int game_id = i->m_availGames[ i->m_nComboSelect ];
if ( game_id == GAME_Q2 || game_id == GAME_QUETOO ) {
gtk_widget_show( i->m_executablesVBox );
} else {
gtk_widget_hide( i->m_executablesVBox );
}
int game_id = i->m_availGames[ i->m_nComboSelect ];
if ( game_id == GAME_Q2 || game_id == GAME_QUETOO ) {
gtk_widget_show( i->m_executablesVBox );
} else {
gtk_widget_hide( i->m_executablesVBox );
}
}
void CGameInstall::BuildDialog() {
@ -3391,7 +3404,7 @@ void CGameInstall::BuildDialog() {
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
game_select_combo = gtk_combo_box_new_text();
game_select_combo = gtk_combo_box_text_new();
gtk_widget_show( game_select_combo );
gtk_box_pack_start( GTK_BOX( vbox2 ), game_select_combo, FALSE, FALSE, 0 );
@ -3399,49 +3412,49 @@ void CGameInstall::BuildDialog() {
while ( m_availGames[ iGame ] != GAME_NONE ) {
switch ( m_availGames[ iGame ] ) {
case GAME_Q1:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Quake" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Quake" ) );
break;
case GAME_Q2:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Quake II" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Quake II" ) );
break;
case GAME_Q3:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Quake III Arena and mods" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Quake III Arena and mods" ) );
break;
case GAME_URT:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Urban Terror (standalone)" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Urban Terror (standalone)" ) );
break;
case GAME_UFOAI:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "UFO: Alien Invasion" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "UFO: Alien Invasion" ) );
break;
case GAME_QUETOO:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Quetoo" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Quetoo" ) );
break;
case GAME_WARSOW:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Warsow" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Warsow" ) );
break;
case GAME_NEXUIZ:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Nexuiz" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Nexuiz" ) );
break;
case GAME_TREMULOUS:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Tremulous" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Tremulous" ) );
break;
case GAME_JA:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Jedi Academy and mods" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Jedi Academy and mods" ) );
break;
case GAME_REACTION:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Reaction Quake 3" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Reaction Quake 3" ) );
break;
case GAME_ET:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Wolfenstein: Enemy Territory" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Wolfenstein: Enemy Territory" ) );
break;
case GAME_QL:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Quake Live" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Quake Live" ) );
break;
case GAME_STVEF:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Star Trek - Voyager: Elite Force" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Star Trek - Voyager: Elite Force" ) );
break;
case GAME_WOLF:
gtk_combo_box_append_text( GTK_COMBO_BOX( game_select_combo ), _( "Return To Castle Wolfenstein" ) );
gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( game_select_combo ), _( "Return To Castle Wolfenstein" ) );
break;
}
iGame++;
@ -3468,7 +3481,7 @@ void CGameInstall::BuildDialog() {
entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 );
AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
button = gtk_button_new_with_label( _( "..." ) );
@ -3477,8 +3490,8 @@ void CGameInstall::BuildDialog() {
gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
m_executablesVBox = gtk_vbox_new( TRUE, 0 );
gtk_widget_show( m_executablesVBox );
gtk_box_pack_start( GTK_BOX( vbox2 ), m_executablesVBox, FALSE, FALSE, 0 );
gtk_widget_show( m_executablesVBox );
text = gtk_label_new( _( "Engine binaries directory:" ) );
gtk_widget_show( text );
@ -3490,7 +3503,7 @@ void CGameInstall::BuildDialog() {
entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 );
AddDialogData( entry, &m_strExecutables, DLG_ENTRY_TEXT );
button = gtk_button_new_with_label( _( "..." ) );
@ -3500,15 +3513,15 @@ void CGameInstall::BuildDialog() {
button = gtk_button_new_with_label( _( "OK" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, TRUE, TRUE, 0 );
AddModalButton( button, IDOK );
button = gtk_button_new_with_label( _( "Cancel" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, TRUE, TRUE, 0 );
AddModalButton( button, IDCANCEL );
gtk_widget_set_size_request( dlg, 320, -1);
gtk_widget_set_size_request( dlg, 320, -1 );
// triggers the callback - sets the game name, shows/hide extra settings depending on project
gtk_combo_box_set_active( GTK_COMBO_BOX( game_select_combo ), 0 );

View file

@ -286,7 +286,7 @@ class CGameDialog : public Dialog
GtkWidget *mFrame; ///< this is built on-demand first time it's used
GtkWidget *mTopBox; ///< top level box used to store the dialog frame, must unhook after modal use
GtkComboBox *mGameCombo; // combo box holds the selection of available game
GtkComboBoxText *mGameCombo; // combo box holds the selection of available game
/*!
global prefs storage

View file

@ -1599,8 +1599,9 @@ void FillBSPMenu(){
// first token is menu name
children = gtk_container_get_children( GTK_CONTAINER( menu ) );
if( children ) {
if( g_list_first( children ) )
if( g_list_first( children ) ) {
gtk_label_set_text( GTK_LABEL( g_list_first( children )->data ), token );
}
g_list_free( children );
}
token = strtok( NULL, ",;" );